diff options
author | Michaël Zasso <targos@protonmail.com> | 2018-12-04 08:20:37 +0100 |
---|---|---|
committer | Michaël Zasso <targos@protonmail.com> | 2018-12-06 15:23:33 +0100 |
commit | 9b4bf7de6c9a7c25f116c7a502384c20b5cfaea3 (patch) | |
tree | 2b0c843168dafb939d8df8a15b2aa72b76dee51d /deps/v8/test | |
parent | b8fbe69db1292307adb2c2b2e0d5ef48c4ab2faf (diff) | |
download | android-node-v8-9b4bf7de6c9a7c25f116c7a502384c20b5cfaea3.tar.gz android-node-v8-9b4bf7de6c9a7c25f116c7a502384c20b5cfaea3.tar.bz2 android-node-v8-9b4bf7de6c9a7c25f116c7a502384c20b5cfaea3.zip |
deps: update V8 to 7.1.302.28
PR-URL: https://github.com/nodejs/node/pull/23423
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Gus Caplan <me@gus.host>
Reviewed-By: Myles Borins <myles.borins@gmail.com>
Diffstat (limited to 'deps/v8/test')
546 files changed, 26609 insertions, 5493 deletions
diff --git a/deps/v8/test/benchmarks/testcfg.py b/deps/v8/test/benchmarks/testcfg.py index dbae4e6216..8333f49c78 100644 --- a/deps/v8/test/benchmarks/testcfg.py +++ b/deps/v8/test/benchmarks/testcfg.py @@ -105,7 +105,7 @@ class TestSuite(testsuite.TestSuite): return TestCase -class TestCase(testcase.TestCase): +class TestCase(testcase.D8TestCase): def _get_files_params(self): path = self.path testroot = self.suite.testroot diff --git a/deps/v8/test/cctest/BUILD.gn b/deps/v8/test/cctest/BUILD.gn index c4aa51b818..df37a3d4c5 100644 --- a/deps/v8/test/cctest/BUILD.gn +++ b/deps/v8/test/cctest/BUILD.gn @@ -214,6 +214,7 @@ v8_source_set("cctest_sources") { "test-roots.cc", "test-sampler-api.cc", "test-serialize.cc", + "test-smi-lexicographic-compare.cc", "test-strings.cc", "test-strtod.cc", "test-symbols.cc", @@ -237,6 +238,7 @@ v8_source_set("cctest_sources") { "trace-extension.cc", "trace-extension.h", "types-fuzz.h", + "unicode-helpers.cc", "unicode-helpers.h", "wasm/test-c-wasm-entry.cc", "wasm/test-jump-table-assembler.cc", @@ -285,6 +287,7 @@ v8_source_set("cctest_sources") { "test-code-stubs.h", "test-disasm-arm.cc", "test-macro-assembler-arm.cc", + "test-poison-disasm-arm.cc", "test-sync-primitives-arm.cc", ] } else if (v8_current_cpu == "arm64") { diff --git a/deps/v8/test/cctest/cctest.cc b/deps/v8/test/cctest/cctest.cc index 0919f39efe..1b1eeb5d41 100644 --- a/deps/v8/test/cctest/cctest.cc +++ b/deps/v8/test/cctest/cctest.cc @@ -123,16 +123,21 @@ void CcTest::CollectGarbage(i::AllocationSpace space) { heap()->CollectGarbage(space, i::GarbageCollectionReason::kTesting); } -void CcTest::CollectAllGarbage() { - CollectAllGarbage(i::Heap::kFinalizeIncrementalMarkingMask); +void CcTest::CollectAllGarbage(i::Isolate* isolate) { + i::Isolate* iso = isolate ? isolate : i_isolate(); + iso->heap()->CollectAllGarbage(i::Heap::kNoGCFlags, + i::GarbageCollectionReason::kTesting); } -void CcTest::CollectAllGarbage(int flags) { - heap()->CollectAllGarbage(flags, i::GarbageCollectionReason::kTesting); +void CcTest::CollectAllAvailableGarbage(i::Isolate* isolate) { + i::Isolate* iso = isolate ? isolate : i_isolate(); + iso->heap()->CollectAllAvailableGarbage(i::GarbageCollectionReason::kTesting); } -void CcTest::CollectAllAvailableGarbage() { - heap()->CollectAllAvailableGarbage(i::GarbageCollectionReason::kTesting); +void CcTest::PreciseCollectAllGarbage(i::Isolate* isolate) { + i::Isolate* iso = isolate ? isolate : i_isolate(); + iso->heap()->PreciseCollectAllGarbage(i::Heap::kNoGCFlags, + i::GarbageCollectionReason::kTesting); } v8::base::RandomNumberGenerator* CcTest::random_number_generator() { @@ -210,12 +215,12 @@ InitializedHandleScope::InitializedHandleScope() initialized_handle_scope_impl_( new InitializedHandleScopeImpl(main_isolate_)) {} -InitializedHandleScope::~InitializedHandleScope() {} +InitializedHandleScope::~InitializedHandleScope() = default; HandleAndZoneScope::HandleAndZoneScope() : main_zone_(new i::Zone(&allocator_, ZONE_NAME)) {} -HandleAndZoneScope::~HandleAndZoneScope() {} +HandleAndZoneScope::~HandleAndZoneScope() = default; static void PrintTestList(CcTest* current) { if (current == nullptr) return; diff --git a/deps/v8/test/cctest/cctest.h b/deps/v8/test/cctest/cctest.h index 383771710a..9d4af5af3f 100644 --- a/deps/v8/test/cctest/cctest.h +++ b/deps/v8/test/cctest/cctest.h @@ -37,6 +37,7 @@ #include "src/heap/factory.h" #include "src/isolate.h" #include "src/objects.h" +#include "src/register-configuration.h" #include "src/utils.h" #include "src/v8.h" #include "src/zone/accounting-allocator.h" @@ -50,6 +51,13 @@ class RandomNumberGenerator; namespace internal { +#if defined(V8_TARGET_ARCH_IA32) && defined(V8_EMBEDDED_BUILTINS) +// TODO(v8:6666): Fold into Default config once root is fully supported. +const auto GetRegConfig = RegisterConfiguration::PreserveRootIA32; +#else +const auto GetRegConfig = RegisterConfiguration::Default; +#endif + class HandleScope; class Zone; @@ -131,9 +139,9 @@ class CcTest { static i::Heap* heap(); static void CollectGarbage(i::AllocationSpace space); - static void CollectAllGarbage(); - static void CollectAllGarbage(int flags); - static void CollectAllAvailableGarbage(); + static void CollectAllGarbage(i::Isolate* isolate = nullptr); + static void CollectAllAvailableGarbage(i::Isolate* isolate = nullptr); + static void PreciseCollectAllGarbage(i::Isolate* isolate = nullptr); static v8::base::RandomNumberGenerator* random_number_generator(); @@ -193,7 +201,7 @@ class ApiTestFuzzer: public v8::base::Thread { void CallTest(); // The ApiTestFuzzer is also a Thread, so it has a Run method. - virtual void Run(); + void Run() override; enum PartOfTest { FIRST_PART, @@ -220,7 +228,7 @@ class ApiTestFuzzer: public v8::base::Thread { test_number_(num), gate_(0), active_(true) {} - ~ApiTestFuzzer() {} + ~ApiTestFuzzer() override = default; static bool fuzzing_; static int tests_being_run_; @@ -275,14 +283,15 @@ class RegisterThreadedTest { // A LocalContext holds a reference to a v8::Context. class LocalContext { public: - LocalContext(v8::Isolate* isolate, v8::ExtensionConfiguration* extensions = 0, + LocalContext(v8::Isolate* isolate, + v8::ExtensionConfiguration* extensions = nullptr, v8::Local<v8::ObjectTemplate> global_template = v8::Local<v8::ObjectTemplate>(), v8::Local<v8::Value> global_object = v8::Local<v8::Value>()) { Initialize(isolate, extensions, global_template, global_object); } - LocalContext(v8::ExtensionConfiguration* extensions = 0, + LocalContext(v8::ExtensionConfiguration* extensions = nullptr, v8::Local<v8::ObjectTemplate> global_template = v8::Local<v8::ObjectTemplate>(), v8::Local<v8::Value> global_object = v8::Local<v8::Value>()) { @@ -506,9 +515,7 @@ static inline void ExpectInt32(const char* code, int expected) { static inline void ExpectBoolean(const char* code, bool expected) { v8::Local<v8::Value> result = CompileRun(code); CHECK(result->IsBoolean()); - CHECK_EQ(expected, - result->BooleanValue(v8::Isolate::GetCurrent()->GetCurrentContext()) - .FromJust()); + CHECK_EQ(expected, result->BooleanValue(v8::Isolate::GetCurrent())); } @@ -597,11 +604,11 @@ class StaticOneByteResource : public v8::String::ExternalOneByteStringResource { public: explicit StaticOneByteResource(const char* data) : data_(data) {} - ~StaticOneByteResource() {} + ~StaticOneByteResource() override = default; - const char* data() const { return data_; } + const char* data() const override { return data_; } - size_t length() const { return strlen(data_); } + size_t length() const override { return strlen(data_); } private: const char* data_; @@ -677,13 +684,14 @@ class TestPlatform : public v8::Platform { } void CallOnForegroundThread(v8::Isolate* isolate, v8::Task* task) override { - old_platform_->CallOnForegroundThread(isolate, task); + // This is a deprecated function and should not be called anymore. + UNREACHABLE(); } void CallDelayedOnForegroundThread(v8::Isolate* isolate, v8::Task* task, double delay_in_seconds) override { - old_platform_->CallDelayedOnForegroundThread(isolate, task, - delay_in_seconds); + // This is a deprecated function and should not be called anymore. + UNREACHABLE(); } double MonotonicallyIncreasingTime() override { @@ -696,7 +704,8 @@ class TestPlatform : public v8::Platform { void CallIdleOnForegroundThread(v8::Isolate* isolate, v8::IdleTask* task) override { - old_platform_->CallIdleOnForegroundThread(isolate, task); + // This is a deprecated function and should not be called anymore. + UNREACHABLE(); } bool IdleTasksEnabled(v8::Isolate* isolate) override { @@ -709,7 +718,7 @@ class TestPlatform : public v8::Platform { protected: TestPlatform() : old_platform_(i::V8::GetCurrentPlatform()) {} - ~TestPlatform() { i::V8::SetPlatformForTesting(old_platform_); } + ~TestPlatform() override { i::V8::SetPlatformForTesting(old_platform_); } v8::Platform* old_platform() const { return old_platform_; } diff --git a/deps/v8/test/cctest/cctest.status b/deps/v8/test/cctest/cctest.status index c59c443b06..feaf2eb327 100644 --- a/deps/v8/test/cctest/cctest.status +++ b/deps/v8/test/cctest/cctest.status @@ -93,6 +93,9 @@ 'test-cpu-profiler/TracingCpuProfiler': [SKIP], 'test-sampler/LibSamplerCollectSample': [SKIP], + # BUG(v8:8209). Flaky + 'test-cpu-profiler/Issue1398': [SKIP], + # BUG(7702). Flaky data race and other test failures. 'test-cpu-profiler/MultipleProfilers': [SKIP], @@ -154,7 +157,7 @@ 'test-mark-compact/Promotion': [PASS, FAIL], # BUG(v8:3434). - ' test-api/LoadICFastApi_DirectCall_GCMoveStubWithProfiler': [SKIP], + 'test-api/LoadICFastApi_DirectCall_GCMoveStubWithProfiler': [SKIP], }], # 'arch == arm64' ['arch == arm64 and simulator_run', { @@ -256,6 +259,9 @@ # BUG(5920): Flaky crash. 'test-serialize/PartialSerializerContext': [PASS, ['arch == x64 and mode == debug', SKIP]], + + # BUG(v8:8220). Flaky + 'test-log/LogAll': [SKIP], }], # 'system == windows' ############################################################################## @@ -285,10 +291,13 @@ 'test-serialize/StartupSerializerTwice': [SKIP], 'test-serialize/StartupSerializerOnceRunScript': [SKIP], 'test-serialize/StartupSerializerTwiceRunScript': [SKIP], +}], # 'arch == arm' +############################################################################## +['arch == arm and not simulator_run', { # crbug.com/v8/7605 - 'test-heap/OutOfMemorySmallObjects': [PASS, ['not simulator_run', SKIP]], -}], # 'arch == arm' + 'test-heap/OutOfMemorySmallObjects': [SKIP], +}], # 'arch == arm and not simulator_run' ############################################################################## ['arch == mipsel or arch == mips', { @@ -314,12 +323,10 @@ }], # 'arch == mips' ############################################################################## -['arch == mips or arch == mips64', { - # TODO(mips-team): Implement LiftOff on big-endian - 'test-run-wasm/RunWasmLiftoff*': [SKIP], - 'test-run-wasm-64/RunWasmLiftoff*': [SKIP], -}], # 'arch == mips or arch == mips64' - +['arch == mips64', { + # TODO(mips-team): Currently fails on mips64 board. + 'test-run-wasm/RunWasmLiftoff_I32Binop*': [SKIP], +}], # 'arch == mips64' ############################################################################## ['arch == mips64el or arch == mips64', { # BUG(v8:3154). @@ -345,11 +352,10 @@ }], # '(arch == mipsel or arch == mips64el or arch == mips or arch == mips64) and not simd_mips' ############################################################################## -['arch == mipsel or arch == mips64el or arch == mips or arch == mips64 or arch == ppc or arch == ppc64 or arch == s390 or arch == s390x', { +['arch == mipsel or arch == mips64el or arch == mips or arch == mips64', { # TODO(mips-team): Implement I64Atomic operations on MIPS - # TODO(ppc-team, s390-team): Implement I64Atomic operations on PPC/s390 'test-run-wasm-atomics64/*': [SKIP], -}], # 'arch == mipsel or arch == mips64el or arch == mips or arch == mips64 or arch == ppc or arch == ppc64 or arch == s390 or arch == s390x' +}], # 'arch == mipsel or arch == mips64el or arch == mips or arch == mips64' ############################################################################## ['mips_arch_variant == r6', { @@ -372,6 +378,12 @@ }], # 'arch == android_arm or arch == android_ia32' ############################################################################## +['system == android', { + # Uses too much memory. + 'test-api/NewStringRangeError': [SKIP], +}], # 'system == android' + +############################################################################## ['system == aix and arch == ppc64', { # BUG 2857 diff --git a/deps/v8/test/cctest/compiler/call-tester.h b/deps/v8/test/cctest/compiler/call-tester.h index 8a0ea70a2a..4bf06a9ba3 100644 --- a/deps/v8/test/cctest/compiler/call-tester.h +++ b/deps/v8/test/cctest/compiler/call-tester.h @@ -21,7 +21,7 @@ class CallHelper { : csig_(csig), isolate_(isolate) { USE(isolate_); } - virtual ~CallHelper() {} + virtual ~CallHelper() = default; template <typename... Params> R Call(Params... args) { @@ -46,7 +46,7 @@ class CodeRunner : public CallHelper<T> { public: CodeRunner(Isolate* isolate, Handle<Code> code, MachineSignature* csig) : CallHelper<T>(isolate, csig), code_(code) {} - virtual ~CodeRunner() {} + ~CodeRunner() override = default; Address Generate() override { return code_->entry(); } diff --git a/deps/v8/test/cctest/compiler/codegen-tester.h b/deps/v8/test/cctest/compiler/codegen-tester.h index c58eb3b485..f9fbd4af3a 100644 --- a/deps/v8/test/cctest/compiler/codegen-tester.h +++ b/deps/v8/test/cctest/compiler/codegen-tester.h @@ -39,7 +39,25 @@ class RawMachineAssemblerTester : public HandleAndZoneScope, InstructionSelector::SupportedMachineOperatorFlags(), InstructionSelector::AlignmentRequirements()) {} - virtual ~RawMachineAssemblerTester() {} + template <typename... ParamMachTypes> + RawMachineAssemblerTester(Code::Kind kind, ParamMachTypes... p) + : HandleAndZoneScope(), + CallHelper<ReturnType>( + main_isolate(), + CSignature::New(main_zone(), MachineTypeForC<ReturnType>(), p...)), + RawMachineAssembler( + main_isolate(), new (main_zone()) Graph(main_zone()), + Linkage::GetSimplifiedCDescriptor( + main_zone(), + CSignature::New(main_zone(), MachineTypeForC<ReturnType>(), + p...), + true), + MachineType::PointerRepresentation(), + InstructionSelector::SupportedMachineOperatorFlags(), + InstructionSelector::AlignmentRequirements()), + kind_(kind) {} + + ~RawMachineAssemblerTester() override = default; void CheckNumber(double expected, Object* number) { CHECK(this->isolate()->factory()->NewNumber(expected)->SameValue(number)); @@ -59,13 +77,12 @@ class RawMachineAssemblerTester : public HandleAndZoneScope, } protected: - virtual Address Generate() { + Address Generate() override { if (code_.is_null()) { Schedule* schedule = this->Export(); auto call_descriptor = this->call_descriptor(); Graph* graph = this->graph(); - OptimizedCompilationInfo info(ArrayVector("testing"), main_zone(), - Code::STUB); + OptimizedCompilationInfo info(ArrayVector("testing"), main_zone(), kind_); code_ = Pipeline::GenerateCodeForTesting( &info, main_isolate(), call_descriptor, graph, AssemblerOptions::Default(main_isolate()), schedule); @@ -74,6 +91,7 @@ class RawMachineAssemblerTester : public HandleAndZoneScope, } private: + Code::Kind kind_ = Code::Kind::STUB; MaybeHandle<Code> code_; }; @@ -395,7 +413,7 @@ class BinopGen { public: virtual void gen(RawMachineAssemblerTester<int32_t>* m, Node* a, Node* b) = 0; virtual T expected(T a, T b) = 0; - virtual ~BinopGen() {} + virtual ~BinopGen() = default; }; // A helper class to generate various combination of input shape combinations diff --git a/deps/v8/test/cctest/compiler/graph-builder-tester.h b/deps/v8/test/cctest/compiler/graph-builder-tester.h index c16feae340..e0045979d4 100644 --- a/deps/v8/test/cctest/compiler/graph-builder-tester.h +++ b/deps/v8/test/cctest/compiler/graph-builder-tester.h @@ -62,7 +62,7 @@ class GraphBuilderTester : public HandleAndZoneScope, Begin(static_cast<int>(parameter_count())); InitParameters(); } - virtual ~GraphBuilderTester() {} + ~GraphBuilderTester() override = default; void GenerateCode() { Generate(); } Node* Parameter(size_t index) { diff --git a/deps/v8/test/cctest/compiler/test-branch-combine.cc b/deps/v8/test/cctest/compiler/test-branch-combine.cc index ab17ff0992..090a0f23cd 100644 --- a/deps/v8/test/cctest/compiler/test-branch-combine.cc +++ b/deps/v8/test/cctest/compiler/test-branch-combine.cc @@ -309,12 +309,12 @@ class CmpMaterializeBoolGen : public BinopGen<int32_t> { CmpMaterializeBoolGen(IrOpcode::Value opcode, bool i) : w(opcode), invert(i) {} - virtual void gen(RawMachineAssemblerTester<int32_t>* m, Node* a, Node* b) { + void gen(RawMachineAssemblerTester<int32_t>* m, Node* a, Node* b) override { Node* cond = w.MakeNode(m, a, b); if (invert) cond = m->Word32Equal(cond, m->Int32Constant(0)); m->Return(cond); } - virtual int32_t expected(int32_t a, int32_t b) { + int32_t expected(int32_t a, int32_t b) override { if (invert) return !w.Int32Compare(a, b) ? 1 : 0; return w.Int32Compare(a, b) ? 1 : 0; } @@ -333,7 +333,7 @@ class CmpBranchGen : public BinopGen<int32_t> { CmpBranchGen(IrOpcode::Value opcode, bool i, bool t, int32_t eq, int32_t ne) : w(opcode), invert(i), true_first(t), eq_constant(eq), ne_constant(ne) {} - virtual void gen(RawMachineAssemblerTester<int32_t>* m, Node* a, Node* b) { + void gen(RawMachineAssemblerTester<int32_t>* m, Node* a, Node* b) override { RawMachineLabel blocka, blockb; Node* cond = w.MakeNode(m, a, b); if (invert) cond = m->Word32Equal(cond, m->Int32Constant(0)); @@ -350,7 +350,7 @@ class CmpBranchGen : public BinopGen<int32_t> { m->Return(m->Int32Constant(eq_constant)); } } - virtual int32_t expected(int32_t a, int32_t b) { + int32_t expected(int32_t a, int32_t b) override { if (invert) return !w.Int32Compare(a, b) ? eq_constant : ne_constant; return w.Int32Compare(a, b) ? eq_constant : ne_constant; } diff --git a/deps/v8/test/cctest/compiler/test-code-assembler.cc b/deps/v8/test/cctest/compiler/test-code-assembler.cc index 91065cd546..a2243e6edd 100644 --- a/deps/v8/test/cctest/compiler/test-code-assembler.cc +++ b/deps/v8/test/cctest/compiler/test-code-assembler.cc @@ -30,7 +30,7 @@ Node* SmiTag(CodeAssembler& m, Node* value) { } Node* UndefinedConstant(CodeAssembler& m) { - return m.LoadRoot(Heap::kUndefinedValueRootIndex); + return m.LoadRoot(RootIndex::kUndefinedValue); } Node* SmiFromInt32(CodeAssembler& m, Node* value) { diff --git a/deps/v8/test/cctest/compiler/test-code-generator.cc b/deps/v8/test/cctest/compiler/test-code-generator.cc index a3b80bc887..8bf29dca69 100644 --- a/deps/v8/test/cctest/compiler/test-code-generator.cc +++ b/deps/v8/test/cctest/compiler/test-code-generator.cc @@ -50,7 +50,7 @@ Handle<Code> BuildTeardownFunction(Isolate* isolate, // arguments: // ~~~ // FixedArray setup(CodeObject* test, FixedArray state_in) { -// FixedArray state_out = AllocateFixedArray(state_in.length()); +// FixedArray state_out = AllocateZeroedFixedArray(state_in.length()); // // `test` will tail-call to its first parameter which will be `teardown`. // return test(teardown, state_out, state_in[0], state_in[1], // state_in[2], ...); @@ -83,8 +83,8 @@ Handle<Code> BuildSetupFunction(Isolate* isolate, // First allocate the FixedArray which will hold the final results. Here we // should take care of all allocations, meaning we allocate HeapNumbers and // FixedArrays representing Simd128 values. - TNode<FixedArray> state_out = __ Cast(__ AllocateFixedArray( - PACKED_ELEMENTS, __ IntPtrConstant(parameters.size()))); + TNode<FixedArray> state_out = + __ AllocateZeroedFixedArray(__ IntPtrConstant(parameters.size())); for (int i = 0; i < static_cast<int>(parameters.size()); i++) { switch (parameters[i].representation()) { case MachineRepresentation::kTagged: @@ -94,8 +94,8 @@ Handle<Code> BuildSetupFunction(Isolate* isolate, __ StoreFixedArrayElement(state_out, i, __ AllocateHeapNumber()); break; case MachineRepresentation::kSimd128: { - TNode<FixedArray> vector = __ Cast( - __ AllocateFixedArray(PACKED_SMI_ELEMENTS, __ IntPtrConstant(4))); + TNode<FixedArray> vector = + __ AllocateZeroedFixedArray(__ IntPtrConstant(4)); for (int lane = 0; lane < 4; lane++) { __ StoreFixedArrayElement(vector, lane, __ SmiConstant(0)); } @@ -361,7 +361,11 @@ class TestEnvironment : public HandleAndZoneScope { public: // These constants may be tuned to experiment with different environments. +#if defined(V8_TARGET_ARCH_IA32) && defined(V8_EMBEDDED_BUILTINS) + static constexpr int kGeneralRegisterCount = 3; +#else static constexpr int kGeneralRegisterCount = 4; +#endif static constexpr int kDoubleRegisterCount = 6; static constexpr int kTaggedSlotCount = 64; @@ -431,13 +435,10 @@ class TestEnvironment : public HandleAndZoneScope { // kReturnRegister0 as the first parameter, and the call will need a // register to hold the CodeObject address. So the maximum number of // registers left to test with is the number of available registers minus 2. - DCHECK_LE( - kGeneralRegisterCount, - RegisterConfiguration::Default()->num_allocatable_general_registers() - - 2); + DCHECK_LE(kGeneralRegisterCount, + GetRegConfig()->num_allocatable_general_registers() - 2); - int32_t general_mask = - RegisterConfiguration::Default()->allocatable_general_codes_mask(); + int32_t general_mask = GetRegConfig()->allocatable_general_codes_mask(); // kReturnRegister0 is used to hold the "teardown" code object, do not // generate moves using it. std::unique_ptr<const RegisterConfiguration> registers( @@ -639,18 +640,21 @@ class TestEnvironment : public HandleAndZoneScope { case MachineRepresentation::kTagged: state->set(i, Smi::FromInt(rng_->NextInt(Smi::kMaxValue))); break; - case MachineRepresentation::kFloat32: + case MachineRepresentation::kFloat32: { // HeapNumbers are Float64 values. However, we will convert it to a // Float32 and back inside `setup` and `teardown`. Make sure the value // we pick fits in a Float32. - state->set( - i, *main_isolate()->factory()->NewHeapNumber( - static_cast<double>(DoubleToFloat32(rng_->NextDouble())))); + Handle<HeapNumber> num = main_isolate()->factory()->NewHeapNumber( + static_cast<double>(DoubleToFloat32(rng_->NextDouble()))); + state->set(i, *num); break; - case MachineRepresentation::kFloat64: - state->set( - i, *main_isolate()->factory()->NewHeapNumber(rng_->NextDouble())); + } + case MachineRepresentation::kFloat64: { + Handle<HeapNumber> num = + main_isolate()->factory()->NewHeapNumber(rng_->NextDouble()); + state->set(i, *num); break; + } case MachineRepresentation::kSimd128: { Handle<FixedArray> vector = main_isolate()->factory()->NewFixedArray(4); @@ -968,7 +972,7 @@ class CodeGeneratorTester { linkage_(environment->test_descriptor()), frame_(environment->test_descriptor()->CalculateFixedFrameSize()) { // Pick half of the stack parameters at random and move them into spill - // slots, seperated by `extra_stack_space` bytes. + // slots, separated by `extra_stack_space` bytes. // When testing a move with stack slots using CheckAssembleMove or // CheckAssembleSwap, we'll transparently make use of local spill slots // instead of stack parameters for those that were picked. This allows us to @@ -1285,7 +1289,7 @@ TEST(FuzzAssembleMoveAndSwap) { } TEST(AssembleTailCallGap) { - const RegisterConfiguration* conf = RegisterConfiguration::Default(); + const RegisterConfiguration* conf = GetRegConfig(); TestEnvironment env; // This test assumes at least 4 registers are allocatable. diff --git a/deps/v8/test/cctest/compiler/test-js-typed-lowering.cc b/deps/v8/test/cctest/compiler/test-js-typed-lowering.cc index eec562cf36..559ed1088c 100644 --- a/deps/v8/test/cctest/compiler/test-js-typed-lowering.cc +++ b/deps/v8/test/cctest/compiler/test-js-typed-lowering.cc @@ -32,7 +32,7 @@ class JSTypedLoweringTester : public HandleAndZoneScope { simplified(main_zone()), common(main_zone()), graph(main_zone()), - typer(main_isolate(), &js_heap_broker, Typer::kNoFlags, &graph), + typer(&js_heap_broker, Typer::kNoFlags, &graph), context_node(nullptr) { graph.SetStart(graph.NewNode(common.Start(num_parameters))); graph.SetEnd(graph.NewNode(common.End(1), graph.start())); diff --git a/deps/v8/test/cctest/compiler/test-multiple-return.cc b/deps/v8/test/cctest/compiler/test-multiple-return.cc index b591d193e7..dccdbd9b92 100644 --- a/deps/v8/test/cctest/compiler/test-multiple-return.cc +++ b/deps/v8/test/cctest/compiler/test-multiple-return.cc @@ -190,11 +190,10 @@ void TestReturnMultipleValues(MachineType type) { std::unique_ptr<wasm::NativeModule> module = AllocateNativeModule( handles.main_isolate(), code->raw_instruction_size()); - byte* code_start = module->AddCodeCopy(code, wasm::WasmCode::kFunction, 0) - ->instructions() - .start(); + byte* code_start = + module->AddCodeForTesting(code)->instructions().start(); - RawMachineAssemblerTester<int32_t> mt; + RawMachineAssemblerTester<int32_t> mt(Code::Kind::JS_TO_WASM_FUNCTION); const int input_count = 2 + param_count; Node* call_inputs[2 + kMaxParamCount]; call_inputs[0] = mt.PointerConstant(code_start); @@ -280,9 +279,7 @@ void ReturnLastValue(MachineType type) { std::unique_ptr<wasm::NativeModule> module = AllocateNativeModule( handles.main_isolate(), code->raw_instruction_size()); - byte* code_start = module->AddCodeCopy(code, wasm::WasmCode::kFunction, 0) - ->instructions() - .start(); + byte* code_start = module->AddCodeForTesting(code)->instructions().start(); // Generate caller. int expect = return_count - 1; @@ -343,9 +340,7 @@ void ReturnSumOfReturns(MachineType type) { std::unique_ptr<wasm::NativeModule> module = AllocateNativeModule( handles.main_isolate(), code->raw_instruction_size()); - byte* code_start = module->AddCodeCopy(code, wasm::WasmCode::kFunction, 0) - ->instructions() - .start(); + byte* code_start = module->AddCodeForTesting(code)->instructions().start(); // Generate caller. RawMachineAssemblerTester<int32_t> mt; diff --git a/deps/v8/test/cctest/compiler/test-representation-change.cc b/deps/v8/test/cctest/compiler/test-representation-change.cc index 894338b3e2..c334ecb383 100644 --- a/deps/v8/test/cctest/compiler/test-representation-change.cc +++ b/deps/v8/test/cctest/compiler/test-representation-change.cc @@ -6,6 +6,7 @@ #include "src/compiler/node-matchers.h" #include "src/compiler/representation-change.h" +#include "src/compiler/type-cache.h" #include "src/objects-inl.h" #include "test/cctest/cctest.h" #include "test/cctest/compiler/codegen-tester.h" @@ -46,6 +47,12 @@ class RepresentationChangerTester : public HandleAndZoneScope, CHECK_EQ(expected, m.Value()); } + void CheckInt64Constant(Node* n, int64_t expected) { + Int64Matcher m(n); + CHECK(m.HasValue()); + CHECK_EQ(expected, m.Value()); + } + void CheckUint32Constant(Node* n, uint32_t expected) { Uint32Matcher m(n); CHECK(m.HasValue()); @@ -267,6 +274,18 @@ TEST(ToUint32_constant) { } } +TEST(ToInt64_constant) { + RepresentationChangerTester r; + FOR_INT32_INPUTS(i) { + Node* n = r.jsgraph()->Constant(*i); + Node* use = r.Return(n); + Node* c = r.changer()->GetRepresentationFor( + n, MachineRepresentation::kTagged, TypeCache::Get().kSafeInteger, use, + UseInfo(MachineRepresentation::kWord64, Truncation::None())); + r.CheckInt64Constant(c, *i); + } +} + static void CheckChange(IrOpcode::Value expected, MachineRepresentation from, Type from_type, UseInfo use_info) { RepresentationChangerTester r; @@ -291,7 +310,7 @@ static void CheckChange(IrOpcode::Value expected, MachineRepresentation from, static void CheckChange(IrOpcode::Value expected, MachineRepresentation from, Type from_type, MachineRepresentation to) { - CheckChange(expected, from, from_type, UseInfo(to, Truncation::None())); + CheckChange(expected, from, from_type, UseInfo(to, Truncation::Any())); } static void CheckTwoChanges(IrOpcode::Value expected2, @@ -328,6 +347,132 @@ static void CheckChange(IrOpcode::Value expected, MachineRepresentation from, CHECK_EQ(n, c->InputAt(0)); } +TEST(Word64) { + CheckChange(IrOpcode::kChangeInt32ToInt64, MachineRepresentation::kWord8, + TypeCache::Get().kInt8, MachineRepresentation::kWord64); + CheckChange(IrOpcode::kChangeUint32ToUint64, MachineRepresentation::kWord8, + TypeCache::Get().kUint8, MachineRepresentation::kWord64); + CheckChange(IrOpcode::kChangeInt32ToInt64, MachineRepresentation::kWord16, + TypeCache::Get().kInt16, MachineRepresentation::kWord64); + CheckChange(IrOpcode::kChangeUint32ToUint64, MachineRepresentation::kWord16, + TypeCache::Get().kUint16, MachineRepresentation::kWord64); + CheckChange(IrOpcode::kChangeInt32ToInt64, MachineRepresentation::kWord32, + Type::Signed32(), MachineRepresentation::kWord64); + CheckChange(IrOpcode::kChangeUint32ToUint64, MachineRepresentation::kWord32, + Type::Unsigned32(), MachineRepresentation::kWord64); + + CheckChange(IrOpcode::kTruncateInt64ToInt32, MachineRepresentation::kWord64, + Type::Signed32(), MachineRepresentation::kWord32); + CheckChange(IrOpcode::kTruncateInt64ToInt32, MachineRepresentation::kWord64, + Type::Unsigned32(), MachineRepresentation::kWord32); + CheckChange(IrOpcode::kTruncateInt64ToInt32, MachineRepresentation::kWord64, + TypeCache::Get().kSafeInteger, MachineRepresentation::kWord32, + UseInfo::TruncatingWord32()); + CheckChange( + IrOpcode::kCheckedInt64ToInt32, MachineRepresentation::kWord64, + TypeCache::Get().kSafeInteger, MachineRepresentation::kWord32, + UseInfo::CheckedSigned32AsWord32(kIdentifyZeros, VectorSlotPair())); + CheckChange( + IrOpcode::kCheckedUint64ToInt32, MachineRepresentation::kWord64, + TypeCache::Get().kPositiveSafeInteger, MachineRepresentation::kWord32, + UseInfo::CheckedSigned32AsWord32(kIdentifyZeros, VectorSlotPair())); + + CheckChange(IrOpcode::kChangeFloat64ToInt64, MachineRepresentation::kFloat64, + Type::Signed32(), MachineRepresentation::kWord64); + CheckChange(IrOpcode::kChangeFloat64ToInt64, MachineRepresentation::kFloat64, + Type::Unsigned32(), MachineRepresentation::kWord64); + CheckChange(IrOpcode::kChangeFloat64ToInt64, MachineRepresentation::kFloat64, + TypeCache::Get().kSafeInteger, MachineRepresentation::kWord64); + CheckChange(IrOpcode::kChangeFloat64ToInt64, MachineRepresentation::kFloat64, + TypeCache::Get().kInt64, MachineRepresentation::kWord64); + CheckChange(IrOpcode::kChangeFloat64ToUint64, MachineRepresentation::kFloat64, + TypeCache::Get().kUint64, MachineRepresentation::kWord64); + + CheckChange(IrOpcode::kChangeInt64ToFloat64, MachineRepresentation::kWord64, + Type::Signed32(), MachineRepresentation::kFloat64); + CheckChange(IrOpcode::kChangeInt64ToFloat64, MachineRepresentation::kWord64, + Type::Unsigned32(), MachineRepresentation::kFloat64); + CheckChange(IrOpcode::kChangeInt64ToFloat64, MachineRepresentation::kWord64, + TypeCache::Get().kSafeInteger, MachineRepresentation::kFloat64); + + CheckTwoChanges(IrOpcode::kChangeFloat32ToFloat64, + IrOpcode::kChangeFloat64ToInt64, + MachineRepresentation::kFloat32, Type::Signed32(), + MachineRepresentation::kWord64); + CheckTwoChanges(IrOpcode::kChangeFloat32ToFloat64, + IrOpcode::kChangeFloat64ToInt64, + MachineRepresentation::kFloat32, Type::Unsigned32(), + MachineRepresentation::kWord64); + CheckTwoChanges(IrOpcode::kChangeFloat32ToFloat64, + IrOpcode::kChangeFloat64ToInt64, + MachineRepresentation::kFloat32, TypeCache::Get().kInt64, + MachineRepresentation::kWord64); + CheckTwoChanges(IrOpcode::kChangeFloat32ToFloat64, + IrOpcode::kChangeFloat64ToUint64, + MachineRepresentation::kFloat32, TypeCache::Get().kUint64, + MachineRepresentation::kWord64); + + CheckTwoChanges(IrOpcode::kChangeInt64ToFloat64, + IrOpcode::kTruncateFloat64ToFloat32, + MachineRepresentation::kWord64, Type::Signed32(), + MachineRepresentation::kFloat32); + + CheckChange(IrOpcode::kChangeTaggedToInt64, MachineRepresentation::kTagged, + Type::Signed32(), MachineRepresentation::kWord64); + CheckChange(IrOpcode::kChangeTaggedToInt64, MachineRepresentation::kTagged, + Type::Unsigned32(), MachineRepresentation::kWord64); + CheckChange(IrOpcode::kChangeTaggedToInt64, MachineRepresentation::kTagged, + TypeCache::Get().kSafeInteger, MachineRepresentation::kWord64); + CheckChange(IrOpcode::kChangeTaggedToInt64, MachineRepresentation::kTagged, + TypeCache::Get().kInt64, MachineRepresentation::kWord64); + CheckChange(IrOpcode::kChangeTaggedSignedToInt64, + MachineRepresentation::kTaggedSigned, Type::SignedSmall(), + MachineRepresentation::kWord64); + + CheckTwoChanges(IrOpcode::kTruncateInt64ToInt32, + IrOpcode::kChangeInt31ToTaggedSigned, + MachineRepresentation::kWord64, Type::Signed31(), + MachineRepresentation::kTagged); + CheckTwoChanges(IrOpcode::kTruncateInt64ToInt32, + IrOpcode::kChangeInt32ToTagged, + MachineRepresentation::kWord64, Type::Signed32(), + MachineRepresentation::kTagged); + CheckTwoChanges(IrOpcode::kTruncateInt64ToInt32, + IrOpcode::kChangeUint32ToTagged, + MachineRepresentation::kWord64, Type::Unsigned32(), + MachineRepresentation::kTagged); + CheckChange(IrOpcode::kChangeInt64ToTagged, MachineRepresentation::kWord64, + TypeCache::Get().kSafeInteger, MachineRepresentation::kTagged); + CheckChange(IrOpcode::kChangeUint64ToTagged, MachineRepresentation::kWord64, + TypeCache::Get().kPositiveSafeInteger, + MachineRepresentation::kTagged); + + CheckTwoChanges(IrOpcode::kTruncateInt64ToInt32, + IrOpcode::kChangeInt31ToTaggedSigned, + MachineRepresentation::kWord64, Type::Signed31(), + MachineRepresentation::kTaggedSigned); + if (SmiValuesAre32Bits()) { + CheckTwoChanges(IrOpcode::kTruncateInt64ToInt32, + IrOpcode::kChangeInt32ToTagged, + MachineRepresentation::kWord64, Type::Signed32(), + MachineRepresentation::kTaggedSigned); + } + CheckChange(IrOpcode::kCheckedInt64ToTaggedSigned, + MachineRepresentation::kWord64, TypeCache::Get().kSafeInteger, + MachineRepresentation::kTaggedSigned, + UseInfo::CheckedSignedSmallAsTaggedSigned(VectorSlotPair())); + CheckChange(IrOpcode::kCheckedUint64ToTaggedSigned, + MachineRepresentation::kWord64, + TypeCache::Get().kPositiveSafeInteger, + MachineRepresentation::kTaggedSigned, + UseInfo::CheckedSignedSmallAsTaggedSigned(VectorSlotPair())); + + CheckTwoChanges(IrOpcode::kChangeInt64ToFloat64, + IrOpcode::kChangeFloat64ToTaggedPointer, + MachineRepresentation::kWord64, TypeCache::Get().kSafeInteger, + MachineRepresentation::kTaggedPointer); +} + TEST(SingleChanges) { CheckChange(IrOpcode::kChangeTaggedToBit, MachineRepresentation::kTagged, Type::Boolean(), MachineRepresentation::kBit); @@ -371,6 +516,10 @@ TEST(SingleChanges) { // Int32,Uint32 <-> Float64 are actually machine conversions. CheckChange(IrOpcode::kChangeInt32ToFloat64, MachineRepresentation::kWord32, Type::Signed32(), MachineRepresentation::kFloat64); + CheckChange(IrOpcode::kChangeInt32ToFloat64, MachineRepresentation::kWord32, + Type::Signed32OrMinusZero(), MachineRepresentation::kFloat64, + UseInfo(MachineRepresentation::kFloat64, + Truncation::Any(kIdentifyZeros))); CheckChange(IrOpcode::kChangeUint32ToFloat64, MachineRepresentation::kWord32, Type::Unsigned32(), MachineRepresentation::kFloat64); CheckChange(IrOpcode::kChangeFloat64ToInt32, MachineRepresentation::kFloat64, @@ -425,7 +574,8 @@ TEST(SignednessInWord32) { Type::Signed32(), MachineRepresentation::kWord32); CheckChange(IrOpcode::kTruncateFloat64ToWord32, MachineRepresentation::kFloat64, Type::Number(), - MachineRepresentation::kWord32); + MachineRepresentation::kWord32, + UseInfo(MachineRepresentation::kWord32, Truncation::Word32())); CheckChange(IrOpcode::kCheckedTruncateTaggedToWord32, MachineRepresentation::kTagged, Type::NonInternal(), MachineRepresentation::kWord32, @@ -523,16 +673,10 @@ TEST(TypeErrors) { MachineRepresentation::kWord64); r.CheckTypeError(MachineRepresentation::kTagged, Type::Boolean(), MachineRepresentation::kWord64); - - // Word64 / Word32 shouldn't be implicitly converted. r.CheckTypeError(MachineRepresentation::kWord64, Type::Internal(), MachineRepresentation::kWord32); r.CheckTypeError(MachineRepresentation::kWord32, Type::Number(), MachineRepresentation::kWord64); - r.CheckTypeError(MachineRepresentation::kWord32, Type::Signed32(), - MachineRepresentation::kWord64); - r.CheckTypeError(MachineRepresentation::kWord32, Type::Unsigned32(), - MachineRepresentation::kWord64); } } // namespace compiler diff --git a/deps/v8/test/cctest/compiler/test-run-bytecode-graph-builder.cc b/deps/v8/test/cctest/compiler/test-run-bytecode-graph-builder.cc index c62ed69105..681669f334 100644 --- a/deps/v8/test/cctest/compiler/test-run-bytecode-graph-builder.cc +++ b/deps/v8/test/cctest/compiler/test-run-bytecode-graph-builder.cc @@ -60,7 +60,7 @@ class BytecodeGraphCallable { public: BytecodeGraphCallable(Isolate* isolate, Handle<JSFunction> function) : isolate_(isolate), function_(function) {} - virtual ~BytecodeGraphCallable() {} + virtual ~BytecodeGraphCallable() = default; MaybeHandle<Object> operator()(A... args) { return CallFunction(isolate_, function_, args...); @@ -79,7 +79,7 @@ class BytecodeGraphTester { i::FLAG_always_opt = false; i::FLAG_allow_natives_syntax = true; } - virtual ~BytecodeGraphTester() {} + virtual ~BytecodeGraphTester() = default; template <class... A> BytecodeGraphCallable<A...> GetCallable( diff --git a/deps/v8/test/cctest/compiler/test-run-intrinsics.cc b/deps/v8/test/cctest/compiler/test-run-intrinsics.cc index efae91343f..82c4c447f2 100644 --- a/deps/v8/test/cctest/compiler/test-run-intrinsics.cc +++ b/deps/v8/test/cctest/compiler/test-run-intrinsics.cc @@ -20,21 +20,6 @@ TEST(Call) { T.CheckCall(T.Val("6x"), T.NewObject("({d:'x'})"), T.NewObject("f")); } - -TEST(ClassOf) { - FunctionTester T("(function(a) { return %_ClassOf(a); })", flags); - - T.CheckCall(T.Val("Function"), T.NewObject("(function() {})")); - T.CheckCall(T.Val("Array"), T.NewObject("([1])")); - T.CheckCall(T.Val("Object"), T.NewObject("({})")); - T.CheckCall(T.Val("RegExp"), T.NewObject("(/x/)")); - T.CheckCall(T.null(), T.undefined()); - T.CheckCall(T.null(), T.null()); - T.CheckCall(T.null(), T.Val("x")); - T.CheckCall(T.null(), T.Val(1)); -} - - TEST(IsArray) { FunctionTester T("(function(a) { return %_IsArray(a); })", flags); @@ -50,36 +35,6 @@ TEST(IsArray) { } -TEST(IsDate) { - FunctionTester T("(function(a) { return %_IsDate(a); })", flags); - - T.CheckTrue(T.NewObject("new Date()")); - T.CheckFalse(T.NewObject("(function() {})")); - T.CheckFalse(T.NewObject("([1])")); - T.CheckFalse(T.NewObject("({})")); - T.CheckFalse(T.NewObject("(/x/)")); - T.CheckFalse(T.undefined()); - T.CheckFalse(T.null()); - T.CheckFalse(T.Val("x")); - T.CheckFalse(T.Val(1)); -} - - -TEST(IsFunction) { - FunctionTester T("(function(a) { return %_IsFunction(a); })", flags); - - T.CheckFalse(T.NewObject("new Date()")); - T.CheckTrue(T.NewObject("(function() {})")); - T.CheckFalse(T.NewObject("([1])")); - T.CheckFalse(T.NewObject("({})")); - T.CheckFalse(T.NewObject("(/x/)")); - T.CheckFalse(T.undefined()); - T.CheckFalse(T.null()); - T.CheckFalse(T.Val("x")); - T.CheckFalse(T.Val(1)); -} - - TEST(IsSmi) { FunctionTester T("(function(a) { return %_IsSmi(a); })", flags); @@ -96,15 +51,6 @@ TEST(IsSmi) { T.CheckFalse(T.Val(-2.3)); } - -TEST(StringAdd) { - FunctionTester T("(function(a,b) { return %_StringAdd(a,b); })", flags); - - T.CheckCall(T.Val("aaabbb"), T.Val("aaa"), T.Val("bbb")); - T.CheckCall(T.Val("aaa"), T.Val("aaa"), T.Val("")); - T.CheckCall(T.Val("bbb"), T.Val(""), T.Val("bbb")); -} - } // namespace compiler } // namespace internal } // namespace v8 diff --git a/deps/v8/test/cctest/compiler/test-run-machops.cc b/deps/v8/test/cctest/compiler/test-run-machops.cc index 71adbc738d..419d1b0699 100644 --- a/deps/v8/test/cctest/compiler/test-run-machops.cc +++ b/deps/v8/test/cctest/compiler/test-run-machops.cc @@ -4174,7 +4174,6 @@ TEST(RunChangeFloat64ToInt32_B) { } } - TEST(RunChangeFloat64ToUint32) { BufferedRawMachineAssemblerTester<uint32_t> m(MachineType::Float64()); m.Return(m.ChangeFloat64ToUint32(m.Parameter(0))); @@ -6340,6 +6339,29 @@ TEST(RunCallCFunction9) { #if V8_TARGET_ARCH_64_BIT // TODO(titzer): run int64 tests on all platforms when supported. +TEST(RunChangeFloat64ToInt64) { + BufferedRawMachineAssemblerTester<int64_t> m(MachineType::Float64()); + m.Return(m.ChangeFloat64ToInt64(m.Parameter(0))); + + FOR_INT64_INPUTS(i) { + double input = static_cast<double>(*i); + if (static_cast<int64_t>(input) == *i) { + CHECK_EQ(static_cast<int64_t>(input), m.Call(input)); + } + } +} + +TEST(RunChangeInt64ToFloat64) { + BufferedRawMachineAssemblerTester<double> m(MachineType::Int64()); + m.Return(m.ChangeInt64ToFloat64(m.Parameter(0))); + FOR_INT64_INPUTS(i) { + double output = static_cast<double>(*i); + if (static_cast<int64_t>(output) == *i) { + CHECK_EQ(output, m.Call(*i)); + } + } +} + TEST(RunBitcastInt64ToFloat64) { int64_t input = 1; Float64 output; 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 b23bd500c6..2ddaa1bc07 100644 --- a/deps/v8/test/cctest/compiler/test-run-native-calls.cc +++ b/deps/v8/test/cctest/compiler/test-run-native-calls.cc @@ -2,6 +2,8 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. +#include <vector> + #include "src/assembler.h" #include "src/codegen.h" #include "src/compiler/linkage.h" @@ -9,6 +11,7 @@ #include "src/machine-type.h" #include "src/objects-inl.h" #include "src/register-configuration.h" +#include "src/wasm/wasm-linkage.h" #include "test/cctest/cctest.h" #include "test/cctest/compiler/codegen-tester.h" @@ -20,8 +23,6 @@ namespace internal { namespace compiler { namespace test_run_native_calls { -const auto GetRegConfig = RegisterConfiguration::Default; - namespace { typedef float float32; typedef double float64; @@ -84,21 +85,12 @@ class RegisterPairs : public Pairs { GetRegConfig()->allocatable_general_codes()) {} }; - -// Pairs of double registers. +// Pairs of float registers. class Float32RegisterPairs : public Pairs { public: Float32RegisterPairs() - : Pairs( - 100, -#if V8_TARGET_ARCH_ARM - // TODO(bbudge) Modify wasm linkage to allow use of all float regs. - GetRegConfig()->num_allocatable_double_registers() / 2 - 2, -#else - GetRegConfig()->num_allocatable_double_registers(), -#endif - GetRegConfig()->allocatable_double_codes()) { - } + : Pairs(100, GetRegConfig()->num_allocatable_float_registers(), + GetRegConfig()->allocatable_float_codes()) {} }; @@ -112,48 +104,39 @@ class Float64RegisterPairs : public Pairs { // Helper for allocating either an GP or FP reg, or the next stack slot. -struct Allocator { - Allocator(int* gp, int gpc, int* fp, int fpc) - : gp_count(gpc), - gp_offset(0), - gp_regs(gp), - fp_count(fpc), - fp_offset(0), - fp_regs(fp), - stack_offset(0) {} - - int gp_count; - int gp_offset; - int* gp_regs; - - int fp_count; - int fp_offset; - int* fp_regs; - - int stack_offset; +class Allocator { + public: + Allocator(int* gp, int gpc, int* fp, int fpc) : stack_offset_(0) { + for (int i = 0; i < gpc; ++i) { + gp_.push_back(Register::from_code(gp[i])); + } + for (int i = 0; i < fpc; ++i) { + fp_.push_back(DoubleRegister::from_code(fp[i])); + } + Reset(); + } + + int stack_offset() const { return stack_offset_; } LinkageLocation Next(MachineType type) { if (IsFloatingPoint(type.representation())) { // Allocate a floating point register/stack location. - if (fp_offset < fp_count) { - int code = fp_regs[fp_offset++]; -#if V8_TARGET_ARCH_ARM - // TODO(bbudge) Modify wasm linkage to allow use of all float regs. - if (type.representation() == MachineRepresentation::kFloat32) code *= 2; -#endif + if (reg_allocator_->CanAllocateFP(type.representation())) { + int code = reg_allocator_->NextFpReg(type.representation()); return LinkageLocation::ForRegister(code, type); } else { - int offset = -1 - stack_offset; - stack_offset += StackWords(type); + int offset = -1 - stack_offset_; + stack_offset_ += StackWords(type); return LinkageLocation::ForCallerFrameSlot(offset, type); } } else { // Allocate a general purpose register/stack location. - if (gp_offset < gp_count) { - return LinkageLocation::ForRegister(gp_regs[gp_offset++], type); + if (reg_allocator_->CanAllocateGP()) { + int code = reg_allocator_->NextGpReg(); + return LinkageLocation::ForRegister(code, type); } else { - int offset = -1 - stack_offset; - stack_offset += StackWords(type); + int offset = -1 - stack_offset_; + stack_offset_ += StackWords(type); return LinkageLocation::ForCallerFrameSlot(offset, type); } } @@ -163,10 +146,17 @@ struct Allocator { return size <= kPointerSize ? 1 : size / kPointerSize; } void Reset() { - fp_offset = 0; - gp_offset = 0; - stack_offset = 0; + stack_offset_ = 0; + reg_allocator_.reset( + new wasm::LinkageAllocator(gp_.data(), static_cast<int>(gp_.size()), + fp_.data(), static_cast<int>(fp_.size()))); } + + private: + std::vector<Register> gp_; + std::vector<DoubleRegister> fp_; + std::unique_ptr<wasm::LinkageAllocator> reg_allocator_; + int stack_offset_; }; @@ -197,7 +187,7 @@ class RegisterConfig { MachineType target_type = MachineType::AnyTagged(); LinkageLocation target_loc = LinkageLocation::ForAnyRegister(); - int stack_param_count = params.stack_offset; + int stack_param_count = params.stack_offset(); return new (zone) CallDescriptor( // -- CallDescriptor::kCallCodeObject, // kind target_type, // target MachineType @@ -868,7 +858,7 @@ TEST(Float32Select_registers) { return; } - int rarray[] = {GetRegConfig()->GetAllocatableDoubleCode(0)}; + int rarray[] = {GetRegConfig()->GetAllocatableFloatCode(0)}; ArgsBuffer<float32>::Sig sig(2); Float32RegisterPairs pairs; @@ -912,7 +902,7 @@ TEST(Float64Select_registers) { TEST(Float32Select_stack_params_return_reg) { - int rarray[] = {GetRegConfig()->GetAllocatableDoubleCode(0)}; + int rarray[] = {GetRegConfig()->GetAllocatableFloatCode(0)}; Allocator params(nullptr, 0, nullptr, 0); Allocator rets(nullptr, 0, rarray, 1); RegisterConfig config(params, rets); diff --git a/deps/v8/test/cctest/compiler/value-helper.h b/deps/v8/test/cctest/compiler/value-helper.h index e66c1ff454..8e652ec3b5 100644 --- a/deps/v8/test/cctest/compiler/value-helper.h +++ b/deps/v8/test/cctest/compiler/value-helper.h @@ -345,29 +345,37 @@ template <typename type> struct FloatCompareWrapper { type value; explicit FloatCompareWrapper(type x) : value(x) {} - bool operator==(type other) const { + bool operator==(FloatCompareWrapper<type> const& other) const { return std::isnan(value) - ? std::isnan(other) - : value == other && std::signbit(value) == std::signbit(other); + ? std::isnan(other.value) + : value == other.value && + std::signbit(value) == std::signbit(other.value); } }; template <typename type> std::ostream& operator<<(std::ostream& out, FloatCompareWrapper<type> wrapper) { - return out << wrapper.value; + uint8_t bytes[sizeof(type)]; + memcpy(bytes, &wrapper.value, sizeof(type)); + out << wrapper.value << " (0x"; + const char* kHexDigits = "0123456789ABCDEF"; + for (unsigned i = 0; i < sizeof(type); ++i) { + out << kHexDigits[bytes[i] >> 4] << kHexDigits[bytes[i] & 15]; + } + return out << ")"; } #define CHECK_FLOAT_EQ(lhs, rhs) \ do { \ using FloatWrapper = ::v8::internal::compiler::FloatCompareWrapper<float>; \ - CHECK_EQ(FloatWrapper(lhs), rhs); \ + CHECK_EQ(FloatWrapper(lhs), FloatWrapper(rhs)); \ } while (false) #define CHECK_DOUBLE_EQ(lhs, rhs) \ do { \ using DoubleWrapper = \ ::v8::internal::compiler::FloatCompareWrapper<double>; \ - CHECK_EQ(DoubleWrapper(lhs), rhs); \ + CHECK_EQ(DoubleWrapper(lhs), DoubleWrapper(rhs)); \ } while (false) } // namespace compiler diff --git a/deps/v8/test/cctest/heap/heap-utils.cc b/deps/v8/test/cctest/heap/heap-utils.cc index 5beed7f4cb..8f70847c9a 100644 --- a/deps/v8/test/cctest/heap/heap-utils.cc +++ b/deps/v8/test/cctest/heap/heap-utils.cc @@ -9,16 +9,15 @@ #include "src/heap/incremental-marking.h" #include "src/heap/mark-compact.h" #include "src/isolate.h" +#include "test/cctest/cctest.h" namespace v8 { namespace internal { namespace heap { void SealCurrentObjects(Heap* heap) { - heap->CollectAllGarbage(Heap::kFinalizeIncrementalMarkingMask, - GarbageCollectionReason::kTesting); - heap->CollectAllGarbage(Heap::kFinalizeIncrementalMarkingMask, - GarbageCollectionReason::kTesting); + CcTest::CollectAllGarbage(); + CcTest::CollectAllGarbage(); heap->mark_compact_collector()->EnsureSweepingCompleted(); heap->old_space()->FreeLinearAllocationArea(); for (Page* page : *heap->old_space()) { diff --git a/deps/v8/test/cctest/heap/test-alloc.cc b/deps/v8/test/cctest/heap/test-alloc.cc index 5a19f806bc..a669233b3a 100644 --- a/deps/v8/test/cctest/heap/test-alloc.cc +++ b/deps/v8/test/cctest/heap/test-alloc.cc @@ -168,84 +168,10 @@ TEST(StressJS) { .ToLocalChecked() ->Run(env) .ToLocalChecked(); - CHECK_EQ(true, result->BooleanValue(env).FromJust()); + CHECK_EQ(true, result->BooleanValue(CcTest::isolate())); env->Exit(); } - -// CodeRange test. -// Tests memory management in a CodeRange by allocating and freeing blocks, -// using a pseudorandom generator to choose block sizes geometrically -// distributed between 2 * Page::kPageSize and 2^5 + 1 * Page::kPageSize. -// Ensure that the freed chunks are collected and reused by allocating (in -// total) more than the size of the CodeRange. - -// This pseudorandom generator does not need to be particularly good. -// Use the lower half of the V8::Random() generator. -unsigned int Pseudorandom() { - static uint32_t lo = 2345; - lo = 18273 * (lo & 0xFFFF) + (lo >> 16); // Provably not 0. - return lo & 0xFFFF; -} - -namespace { - -// Plain old data class. Represents a block of allocated memory. -class Block { - public: - Block(Address base_arg, int size_arg) - : base(base_arg), size(size_arg) {} - - Address base; - int size; -}; - -} // namespace - -TEST(CodeRange) { - const size_t code_range_size = 32*MB; - CcTest::InitializeVM(); - CodeRange code_range(reinterpret_cast<Isolate*>(CcTest::isolate()), - code_range_size); - size_t current_allocated = 0; - size_t total_allocated = 0; - std::vector<Block> blocks; - blocks.reserve(1000); - - while (total_allocated < 5 * code_range_size) { - if (current_allocated < code_range_size / 10) { - // Allocate a block. - // Geometrically distributed sizes, greater than - // kMaxRegularHeapObjectSize (which is greater than code page area). - // TODO(gc): instead of using 3 use some contant based on code_range_size - // kMaxRegularHeapObjectSize. - size_t requested = (kMaxRegularHeapObjectSize << (Pseudorandom() % 3)) + - Pseudorandom() % 5000 + 1; - requested = RoundUp(requested, MemoryAllocator::GetCommitPageSize()); - size_t allocated = 0; - - // The request size has to be at least 2 code guard pages larger than the - // actual commit size. - Address base = code_range.AllocateRawMemory( - requested, requested - (2 * MemoryAllocator::CodePageGuardSize()), - &allocated); - CHECK_NE(base, kNullAddress); - blocks.emplace_back(base, static_cast<int>(allocated)); - current_allocated += static_cast<int>(allocated); - total_allocated += static_cast<int>(allocated); - } else { - // Free a block. - size_t index = Pseudorandom() % blocks.size(); - code_range.FreeRawMemory(blocks[index].base, blocks[index].size); - current_allocated -= blocks[index].size; - if (index < blocks.size() - 1) { - blocks[index] = blocks.back(); - } - blocks.pop_back(); - } - } -} - } // namespace heap } // namespace internal } // namespace v8 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 cb35a73126..272c8831fd 100644 --- a/deps/v8/test/cctest/heap/test-array-buffer-tracker.cc +++ b/deps/v8/test/cctest/heap/test-array-buffer-tracker.cc @@ -323,10 +323,8 @@ UNINITIALIZED_TEST(ArrayBuffer_SemiSpaceCopyMultipleTasks) { Heap* heap = i_isolate->heap(); // Ensure heap is in a clean state. - heap->CollectAllGarbage(Heap::kFinalizeIncrementalMarkingMask, - GarbageCollectionReason::kTesting); - heap->CollectAllGarbage(Heap::kFinalizeIncrementalMarkingMask, - GarbageCollectionReason::kTesting); + CcTest::CollectAllGarbage(i_isolate); + CcTest::CollectAllGarbage(i_isolate); Local<v8::ArrayBuffer> ab1 = v8::ArrayBuffer::New(isolate, 100); Handle<JSArrayBuffer> buf1 = v8::Utils::OpenHandle(*ab1); diff --git a/deps/v8/test/cctest/heap/test-concurrent-marking.cc b/deps/v8/test/cctest/heap/test-concurrent-marking.cc index 0f10b1b9bd..d49ccf6213 100644 --- a/deps/v8/test/cctest/heap/test-concurrent-marking.cc +++ b/deps/v8/test/cctest/heap/test-concurrent-marking.cc @@ -39,9 +39,10 @@ TEST(ConcurrentMarking) { } ConcurrentMarking::MarkingWorklist shared, bailout, on_hold; + ConcurrentMarking::EmbedderTracingWorklist embedder_objects; WeakObjects weak_objects; - ConcurrentMarking* concurrent_marking = - new ConcurrentMarking(heap, &shared, &bailout, &on_hold, &weak_objects); + ConcurrentMarking* concurrent_marking = new ConcurrentMarking( + heap, &shared, &bailout, &on_hold, &weak_objects, &embedder_objects); PublishSegment(&shared, ReadOnlyRoots(heap).undefined_value()); concurrent_marking->ScheduleTasks(); concurrent_marking->Stop( @@ -61,9 +62,10 @@ TEST(ConcurrentMarkingReschedule) { } ConcurrentMarking::MarkingWorklist shared, bailout, on_hold; + ConcurrentMarking::EmbedderTracingWorklist embedder_objects; WeakObjects weak_objects; - ConcurrentMarking* concurrent_marking = - new ConcurrentMarking(heap, &shared, &bailout, &on_hold, &weak_objects); + ConcurrentMarking* concurrent_marking = new ConcurrentMarking( + heap, &shared, &bailout, &on_hold, &weak_objects, &embedder_objects); PublishSegment(&shared, ReadOnlyRoots(heap).undefined_value()); concurrent_marking->ScheduleTasks(); concurrent_marking->Stop( @@ -87,9 +89,10 @@ TEST(ConcurrentMarkingPreemptAndReschedule) { } ConcurrentMarking::MarkingWorklist shared, bailout, on_hold; + ConcurrentMarking::EmbedderTracingWorklist embedder_objects; WeakObjects weak_objects; - ConcurrentMarking* concurrent_marking = - new ConcurrentMarking(heap, &shared, &bailout, &on_hold, &weak_objects); + ConcurrentMarking* concurrent_marking = new ConcurrentMarking( + heap, &shared, &bailout, &on_hold, &weak_objects, &embedder_objects); for (int i = 0; i < 5000; i++) PublishSegment(&shared, ReadOnlyRoots(heap).undefined_value()); concurrent_marking->ScheduleTasks(); diff --git a/deps/v8/test/cctest/heap/test-external-string-tracker.cc b/deps/v8/test/cctest/heap/test-external-string-tracker.cc index 501825a296..cfade38da7 100644 --- a/deps/v8/test/cctest/heap/test-external-string-tracker.cc +++ b/deps/v8/test/cctest/heap/test-external-string-tracker.cc @@ -27,14 +27,14 @@ class TestOneByteResource : public v8::String::ExternalOneByteStringResource { length_(strlen(data) - offset), counter_(counter) {} - ~TestOneByteResource() { + ~TestOneByteResource() override { i::DeleteArray(orig_data_); if (counter_ != nullptr) ++*counter_; } - const char* data() const { return data_; } + const char* data() const override { return data_; } - size_t length() const { return length_; } + size_t length() const override { return length_; } private: const char* orig_data_; diff --git a/deps/v8/test/cctest/heap/test-heap.cc b/deps/v8/test/cctest/heap/test-heap.cc index f73f6f0195..8c6a3c446c 100644 --- a/deps/v8/test/cctest/heap/test-heap.cc +++ b/deps/v8/test/cctest/heap/test-heap.cc @@ -898,14 +898,14 @@ static const char* not_so_random_string_table[] = { "volatile", "while", "with", - 0 + nullptr }; - static void CheckInternalizedStrings(const char** strings) { Isolate* isolate = CcTest::i_isolate(); Factory* factory = isolate->factory(); - for (const char* string = *strings; *strings != 0; string = *strings++) { + for (const char* string = *strings; *strings != nullptr; + string = *strings++) { HandleScope scope(isolate); Handle<String> a = isolate->factory()->InternalizeUtf8String(CStrVector(string)); @@ -2192,9 +2192,9 @@ HEAP_TEST(GCFlags) { heap->set_current_gc_flags(Heap::kNoGCFlags); CHECK_EQ(Heap::kNoGCFlags, heap->current_gc_flags_); - // Set the flags to check whether we appropriately resets them after the GC. - heap->set_current_gc_flags(Heap::kAbortIncrementalMarkingMask); - CcTest::CollectAllGarbage(Heap::kReduceMemoryFootprintMask); + // Check whether we appropriately reset flags after GC. + CcTest::heap()->CollectAllGarbage(Heap::kReduceMemoryFootprintMask, + GarbageCollectionReason::kTesting); CHECK_EQ(Heap::kNoGCFlags, heap->current_gc_flags_); MarkCompactCollector* collector = heap->mark_compact_collector(); @@ -2212,7 +2212,7 @@ HEAP_TEST(GCFlags) { // NewSpace scavenges should not overwrite the flags. CHECK_NE(0, heap->current_gc_flags_ & Heap::kReduceMemoryFootprintMask); - CcTest::CollectAllGarbage(Heap::kAbortIncrementalMarkingMask); + CcTest::CollectAllGarbage(); CHECK_EQ(Heap::kNoGCFlags, heap->current_gc_flags_); } @@ -3097,14 +3097,14 @@ TEST(IncrementalMarkingPreservesMonomorphicCallIC) { CHECK_EQ(expected_slots, feedback_helper.slot_count()); int slot1 = 0; int slot2 = 1; - CHECK(feedback_vector->Get(feedback_helper.slot(slot1))->IsWeakHeapObject()); - CHECK(feedback_vector->Get(feedback_helper.slot(slot2))->IsWeakHeapObject()); + CHECK(feedback_vector->Get(feedback_helper.slot(slot1))->IsWeak()); + CHECK(feedback_vector->Get(feedback_helper.slot(slot2))->IsWeak()); heap::SimulateIncrementalMarking(CcTest::heap()); CcTest::CollectAllGarbage(); - feedback_vector->Get(feedback_helper.slot(slot1))->IsWeakHeapObject(); - feedback_vector->Get(feedback_helper.slot(slot2))->IsWeakHeapObject(); + CHECK(feedback_vector->Get(feedback_helper.slot(slot1))->IsWeak()); + CHECK(feedback_vector->Get(feedback_helper.slot(slot2))->IsWeak()); } @@ -3134,12 +3134,12 @@ TEST(IncrementalMarkingPreservesMonomorphicConstructor) { CcTest::global()->Get(ctx, v8_str("f")).ToLocalChecked()))); Handle<FeedbackVector> vector(f->feedback_vector(), f->GetIsolate()); - CHECK(vector->Get(FeedbackSlot(0))->IsWeakOrClearedHeapObject()); + CHECK(vector->Get(FeedbackSlot(0))->IsWeakOrCleared()); heap::SimulateIncrementalMarking(CcTest::heap()); CcTest::CollectAllGarbage(); - CHECK(vector->Get(FeedbackSlot(0))->IsWeakOrClearedHeapObject()); + CHECK(vector->Get(FeedbackSlot(0))->IsWeakOrCleared()); } TEST(IncrementalMarkingPreservesMonomorphicIC) { @@ -3247,14 +3247,14 @@ class SourceResource : public v8::String::ExternalOneByteStringResource { explicit SourceResource(const char* data) : data_(data), length_(strlen(data)) { } - virtual void Dispose() { + void Dispose() override { i::DeleteArray(data_); data_ = nullptr; } - const char* data() const { return data_; } + const char* data() const override { return data_; } - size_t length() const { return length_; } + size_t length() const override { return length_; } bool IsDisposed() { return data_ == nullptr; } @@ -3636,9 +3636,9 @@ TEST(EnsureAllocationSiteDependentCodesProcessed) { dependency->group() == DependentCode::kAllocationSiteTenuringChangedGroup); CHECK_EQ(1, dependency->count()); - CHECK(dependency->object_at(0)->IsWeakHeapObject()); + CHECK(dependency->object_at(0)->IsWeak()); Code* function_bar = - Code::cast(dependency->object_at(0)->ToWeakHeapObject()); + Code::cast(dependency->object_at(0)->GetHeapObjectAssumeWeak()); CHECK_EQ(bar_handle->code(), function_bar); dependency = dependency->next_link(); dependency_group_count++; @@ -3655,7 +3655,7 @@ TEST(EnsureAllocationSiteDependentCodesProcessed) { // The site still exists because of our global handle, but the code is no // longer referred to by dependent_code(). - CHECK(site->dependent_code()->object_at(0)->IsClearedWeakHeapObject()); + CHECK(site->dependent_code()->object_at(0)->IsCleared()); } void CheckNumberOfAllocations(Heap* heap, const char* source, @@ -4133,18 +4133,18 @@ TEST(WeakFunctionInConstructor) { Handle<FeedbackVector>(createObj->feedback_vector(), CcTest::i_isolate()); for (int i = 0; i < 20; i++) { MaybeObject* slot_value = feedback_vector->Get(FeedbackSlot(0)); - CHECK(slot_value->IsWeakOrClearedHeapObject()); - if (slot_value->IsClearedWeakHeapObject()) break; + CHECK(slot_value->IsWeakOrCleared()); + if (slot_value->IsCleared()) break; CcTest::CollectAllGarbage(); } MaybeObject* slot_value = feedback_vector->Get(FeedbackSlot(0)); - CHECK(slot_value->IsClearedWeakHeapObject()); + CHECK(slot_value->IsCleared()); CompileRun( "function coat() { this.x = 6; }" "createObj(coat);"); slot_value = feedback_vector->Get(FeedbackSlot(0)); - CHECK(slot_value->IsWeakHeapObject()); + CHECK(slot_value->IsWeak()); } @@ -4511,8 +4511,7 @@ HEAP_TEST(Regress538257) { heap::ForceEvacuationCandidate(Page::FromAddress(objects[i]->address())); } heap::SimulateFullSpace(old_space); - heap->CollectAllGarbage(i::Heap::kFinalizeIncrementalMarkingMask, - i::GarbageCollectionReason::kTesting); + CcTest::CollectAllGarbage(); // If we get this far, we've successfully aborted compaction. Any further // allocations might trigger OOM. } @@ -4704,7 +4703,7 @@ TEST(Regress3877) { v8::Utils::OpenHandle(*v8::Local<v8::Object>::Cast(result)); weak_prototype_holder->Set(0, HeapObjectReference::Weak(*proto)); } - CHECK(!weak_prototype_holder->Get(0)->IsClearedWeakHeapObject()); + CHECK(!weak_prototype_holder->Get(0)->IsCleared()); CompileRun( "var a = { };" "a.x = new cls();" @@ -4713,13 +4712,13 @@ TEST(Regress3877) { CcTest::CollectAllGarbage(); } // The map of a.x keeps prototype alive - CHECK(!weak_prototype_holder->Get(0)->IsClearedWeakHeapObject()); + CHECK(!weak_prototype_holder->Get(0)->IsCleared()); // Change the map of a.x and make the previous map garbage collectable. CompileRun("a.x.__proto__ = {};"); for (int i = 0; i < 4; i++) { CcTest::CollectAllGarbage(); } - CHECK(weak_prototype_holder->Get(0)->IsClearedWeakHeapObject()); + CHECK(weak_prototype_holder->Get(0)->IsCleared()); } Handle<WeakFixedArray> AddRetainedMap(Isolate* isolate, Heap* heap) { @@ -4742,15 +4741,15 @@ void CheckMapRetainingFor(int n) { Isolate* isolate = CcTest::i_isolate(); Heap* heap = isolate->heap(); Handle<WeakFixedArray> array_with_map = AddRetainedMap(isolate, heap); - CHECK(array_with_map->Get(0)->IsWeakHeapObject()); + CHECK(array_with_map->Get(0)->IsWeak()); for (int i = 0; i < n; i++) { heap::SimulateIncrementalMarking(heap); CcTest::CollectGarbage(OLD_SPACE); } - CHECK(array_with_map->Get(0)->IsWeakHeapObject()); + CHECK(array_with_map->Get(0)->IsWeak()); heap::SimulateIncrementalMarking(heap); CcTest::CollectGarbage(OLD_SPACE); - CHECK(array_with_map->Get(0)->IsClearedWeakHeapObject()); + CHECK(array_with_map->Get(0)->IsCleared()); } @@ -4766,8 +4765,8 @@ TEST(MapRetaining) { } TEST(WritableVsImmortalRoots) { - for (int i = 0; i < Heap::kStrongRootListLength; ++i) { - Heap::RootListIndex root_index = static_cast<Heap::RootListIndex>(i); + for (RootIndex root_index = RootIndex::kFirstRoot; + root_index <= RootIndex::kLastRoot; ++root_index) { bool writable = Heap::RootCanBeWrittenAfterInitialization(root_index); bool immortal = Heap::RootIsImmortalImmovable(root_index); // A root value can be writable, immortal, or neither, but not both. @@ -5427,11 +5426,11 @@ class StaticOneByteResource : public v8::String::ExternalOneByteStringResource { public: explicit StaticOneByteResource(const char* data) : data_(data) {} - ~StaticOneByteResource() {} + ~StaticOneByteResource() override = default; - const char* data() const { return data_; } + const char* data() const override { return data_; } - size_t length() const { return strlen(data_); } + size_t length() const override { return strlen(data_); } private: const char* data_; @@ -5676,6 +5675,7 @@ TEST(Regress618958) { } TEST(YoungGenerationLargeObjectAllocation) { + if (FLAG_minor_mc) return; FLAG_young_generation_large_objects = true; CcTest::InitializeVM(); v8::HandleScope scope(CcTest::isolate()); @@ -5684,13 +5684,26 @@ TEST(YoungGenerationLargeObjectAllocation) { Handle<FixedArray> array = isolate->factory()->NewFixedArray(200000); MemoryChunk* chunk = MemoryChunk::FromAddress(array->address()); - CHECK(chunk->owner()->identity() == LO_SPACE); + CHECK_EQ(LO_SPACE, chunk->owner()->identity()); CHECK(!chunk->IsFlagSet(MemoryChunk::IN_TO_SPACE)); Handle<FixedArray> array_small = isolate->factory()->NewFixedArray(20000); chunk = MemoryChunk::FromAddress(array_small->address()); - CHECK(chunk->owner()->identity() == NEW_LO_SPACE); + CHECK_EQ(NEW_LO_SPACE, chunk->owner()->identity()); CHECK(chunk->IsFlagSet(MemoryChunk::IN_TO_SPACE)); + + Handle<Object> number = isolate->factory()->NewHeapNumber(123.456); + array_small->set(0, *number); + + CcTest::CollectGarbage(NEW_SPACE); + + // After the first young generation GC array_small will be in the old + // generation large object space. + chunk = MemoryChunk::FromAddress(array_small->address()); + CHECK_EQ(LO_SPACE, chunk->owner()->identity()); + CHECK(!chunk->IsFlagSet(MemoryChunk::IN_TO_SPACE)); + + CcTest::CollectAllAvailableGarbage(); } TEST(UncommitUnusedLargeObjectMemory) { diff --git a/deps/v8/test/cctest/heap/test-incremental-marking.cc b/deps/v8/test/cctest/heap/test-incremental-marking.cc index bbf630f0ba..8213ea6080 100644 --- a/deps/v8/test/cctest/heap/test-incremental-marking.cc +++ b/deps/v8/test/cctest/heap/test-incremental-marking.cc @@ -33,12 +33,13 @@ namespace heap { class MockPlatform : public TestPlatform { public: - MockPlatform() : task_(nullptr), old_platform_(i::V8::GetCurrentPlatform()) { + MockPlatform() + : taskrunner_(new MockTaskRunner()), + old_platform_(i::V8::GetCurrentPlatform()) { // Now that it's completely constructed, make this the current platform. i::V8::SetPlatformForTesting(this); } - virtual ~MockPlatform() { - delete task_; + ~MockPlatform() override { i::V8::SetPlatformForTesting(old_platform_); for (auto& task : worker_tasks_) { old_platform_->CallOnWorkerThread(std::move(task)); @@ -46,8 +47,9 @@ class MockPlatform : public TestPlatform { worker_tasks_.clear(); } - void CallOnForegroundThread(v8::Isolate* isolate, Task* task) override { - task_ = task; + std::shared_ptr<v8::TaskRunner> GetForegroundTaskRunner( + v8::Isolate* isolate) override { + return taskrunner_; } void CallOnWorkerThread(std::unique_ptr<Task> task) override { @@ -56,17 +58,40 @@ class MockPlatform : public TestPlatform { bool IdleTasksEnabled(v8::Isolate* isolate) override { return false; } - bool PendingTask() { return task_ != nullptr; } + bool PendingTask() { return taskrunner_->PendingTask(); } - void PerformTask() { - Task* task = task_; - task_ = nullptr; - task->Run(); - delete task; - } + void PerformTask() { taskrunner_->PerformTask(); } private: - Task* task_; + class MockTaskRunner : public v8::TaskRunner { + public: + void PostTask(std::unique_ptr<v8::Task> task) override { + task_ = std::move(task); + } + + void PostDelayedTask(std::unique_ptr<Task> task, + double delay_in_seconds) override { + UNREACHABLE(); + }; + + void PostIdleTask(std::unique_ptr<IdleTask> task) override { + UNREACHABLE(); + } + + bool IdleTasksEnabled() override { return false; }; + + bool PendingTask() { return task_ != nullptr; } + + void PerformTask() { + std::unique_ptr<Task> task = std::move(task_); + task->Run(); + } + + private: + std::unique_ptr<Task> task_; + }; + + std::shared_ptr<MockTaskRunner> taskrunner_; std::vector<std::unique_ptr<Task>> worker_tasks_; v8::Platform* old_platform_; }; diff --git a/deps/v8/test/cctest/heap/test-lab.cc b/deps/v8/test/cctest/heap/test-lab.cc index 42a3eec04c..ae0bfd969a 100644 --- a/deps/v8/test/cctest/heap/test-lab.cc +++ b/deps/v8/test/cctest/heap/test-lab.cc @@ -63,7 +63,7 @@ TEST(InvalidLab) { TEST(UnusedLabImplicitClose) { CcTest::InitializeVM(); Heap* heap = CcTest::heap(); - heap->root(Heap::kOnePointerFillerMapRootIndex); + heap->root(RootIndex::kOnePointerFillerMap); const int kLabSize = 4 * KB; Address base = AllocateLabBackingStore(heap, kLabSize); Address limit = base + kLabSize; diff --git a/deps/v8/test/cctest/heap/test-spaces.cc b/deps/v8/test/cctest/heap/test-spaces.cc index b930361eb9..e03d8229b3 100644 --- a/deps/v8/test/cctest/heap/test-spaces.cc +++ b/deps/v8/test/cctest/heap/test-spaces.cc @@ -27,6 +27,7 @@ #include <stdlib.h> +#include "src/base/bounded-page-allocator.h" #include "src/base/platform/platform.h" #include "src/heap/factory.h" #include "src/heap/spaces-inl.h" @@ -59,36 +60,43 @@ class TestMemoryAllocatorScope { DISALLOW_COPY_AND_ASSIGN(TestMemoryAllocatorScope); }; - -// Temporarily sets a given code range in an isolate. -class TestCodeRangeScope { +// Temporarily sets a given code page allocator in an isolate. +class TestCodePageAllocatorScope { public: - TestCodeRangeScope(Isolate* isolate, CodeRange* code_range) + TestCodePageAllocatorScope(Isolate* isolate, + v8::PageAllocator* code_page_allocator) : isolate_(isolate), - old_code_range_(isolate->heap()->memory_allocator()->code_range()) { - isolate->heap()->memory_allocator()->code_range_ = code_range; + old_code_page_allocator_( + isolate->heap()->memory_allocator()->code_page_allocator()) { + isolate->heap()->memory_allocator()->code_page_allocator_ = + code_page_allocator; } - ~TestCodeRangeScope() { - isolate_->heap()->memory_allocator()->code_range_ = old_code_range_; + ~TestCodePageAllocatorScope() { + isolate_->heap()->memory_allocator()->code_page_allocator_ = + old_code_page_allocator_; } private: Isolate* isolate_; - CodeRange* old_code_range_; + v8::PageAllocator* old_code_page_allocator_; - DISALLOW_COPY_AND_ASSIGN(TestCodeRangeScope); + DISALLOW_COPY_AND_ASSIGN(TestCodePageAllocatorScope); }; static void VerifyMemoryChunk(Isolate* isolate, Heap* heap, - CodeRange* code_range, size_t reserve_area_size, - size_t commit_area_size, Executability executable, - Space* space) { + v8::PageAllocator* code_page_allocator, + size_t reserve_area_size, size_t commit_area_size, + Executability executable, Space* space) { MemoryAllocator* memory_allocator = new MemoryAllocator(isolate, heap->MaxReserved(), 0); { TestMemoryAllocatorScope test_allocator_scope(isolate, memory_allocator); - TestCodeRangeScope test_code_range_scope(isolate, code_range); + TestCodePageAllocatorScope test_code_page_allocator_scope( + isolate, code_page_allocator); + + v8::PageAllocator* page_allocator = + memory_allocator->page_allocator(executable); size_t header_size = (executable == EXECUTABLE) ? MemoryAllocator::CodePageGuardStartOffset() @@ -98,14 +106,12 @@ static void VerifyMemoryChunk(Isolate* isolate, Heap* heap, MemoryChunk* memory_chunk = memory_allocator->AllocateChunk( reserve_area_size, commit_area_size, executable, space); - size_t alignment = code_range != nullptr && code_range->valid() - ? MemoryChunk::kAlignment - : CommitPageSize(); size_t reserved_size = ((executable == EXECUTABLE)) ? RoundUp(header_size + guard_size + reserve_area_size + guard_size, - alignment) - : RoundUp(header_size + reserve_area_size, CommitPageSize()); + page_allocator->CommitPageSize()) + : RoundUp(header_size + reserve_area_size, + page_allocator->CommitPageSize()); CHECK(memory_chunk->size() == reserved_size); CHECK(memory_chunk->area_start() < memory_chunk->address() + memory_chunk->size()); @@ -119,38 +125,6 @@ static void VerifyMemoryChunk(Isolate* isolate, Heap* heap, delete memory_allocator; } -TEST(Regress3540) { - Isolate* isolate = CcTest::i_isolate(); - Heap* heap = isolate->heap(); - MemoryAllocator* memory_allocator = - new MemoryAllocator(isolate, heap->MaxReserved(), 0); - TestMemoryAllocatorScope test_allocator_scope(isolate, memory_allocator); - size_t code_range_size = - kMinimumCodeRangeSize > 0 ? kMinimumCodeRangeSize : 3 * Page::kPageSize; - CodeRange* code_range = new CodeRange(isolate, code_range_size); - - Address address; - size_t size; - size_t request_size = code_range_size - Page::kPageSize; - address = code_range->AllocateRawMemory( - request_size, request_size - (2 * MemoryAllocator::CodePageGuardSize()), - &size); - CHECK_NE(address, kNullAddress); - - Address null_address; - size_t null_size; - request_size = code_range_size - Page::kPageSize; - null_address = code_range->AllocateRawMemory( - request_size, request_size - (2 * MemoryAllocator::CodePageGuardSize()), - &null_size); - CHECK_EQ(null_address, kNullAddress); - - code_range->FreeRawMemory(address, size); - delete code_range; - memory_allocator->TearDown(); - delete memory_allocator; -} - static unsigned int PseudorandomAreaSize() { static uint32_t lo = 2345; lo = 18273 * (lo & 0xFFFFF) + (lo >> 16); @@ -162,24 +136,31 @@ TEST(MemoryChunk) { Isolate* isolate = CcTest::i_isolate(); Heap* heap = isolate->heap(); + v8::PageAllocator* page_allocator = GetPlatformPageAllocator(); + size_t reserve_area_size = 1 * MB; size_t initial_commit_area_size; for (int i = 0; i < 100; i++) { initial_commit_area_size = - RoundUp(PseudorandomAreaSize(), CommitPageSize()); + RoundUp(PseudorandomAreaSize(), page_allocator->CommitPageSize()); // With CodeRange. const size_t code_range_size = 32 * MB; - CodeRange* code_range = new CodeRange(isolate, code_range_size); + VirtualMemory code_range_reservation(page_allocator, code_range_size, + nullptr, MemoryChunk::kAlignment); + CHECK(code_range_reservation.IsReserved()); + + base::BoundedPageAllocator code_page_allocator( + page_allocator, code_range_reservation.address(), + code_range_reservation.size(), MemoryChunk::kAlignment); - VerifyMemoryChunk(isolate, heap, code_range, reserve_area_size, + VerifyMemoryChunk(isolate, heap, &code_page_allocator, reserve_area_size, initial_commit_area_size, EXECUTABLE, heap->code_space()); - VerifyMemoryChunk(isolate, heap, code_range, reserve_area_size, + VerifyMemoryChunk(isolate, heap, &code_page_allocator, reserve_area_size, initial_commit_area_size, NOT_EXECUTABLE, heap->old_space()); - delete code_range; } } @@ -240,7 +221,8 @@ TEST(NewSpace) { new MemoryAllocator(isolate, heap->MaxReserved(), 0); TestMemoryAllocatorScope test_scope(isolate, memory_allocator); - NewSpace new_space(heap, CcTest::heap()->InitialSemiSpaceSize(), + NewSpace new_space(heap, memory_allocator->data_page_allocator(), + CcTest::heap()->InitialSemiSpaceSize(), CcTest::heap()->InitialSemiSpaceSize()); CHECK(new_space.MaximumCapacity()); @@ -522,9 +504,7 @@ UNINITIALIZED_TEST(InlineAllocationObserverCadence) { // Clear out any pre-existing garbage to make the test consistent // across snapshot/no-snapshot builds. - i_isolate->heap()->CollectAllGarbage( - i::Heap::kFinalizeIncrementalMarkingMask, - i::GarbageCollectionReason::kTesting); + CcTest::CollectAllGarbage(i_isolate); NewSpace* new_space = i_isolate->heap()->new_space(); diff --git a/deps/v8/test/cctest/heap/test-unmapper.cc b/deps/v8/test/cctest/heap/test-unmapper.cc index 880c54457c..1fbe5c1f5c 100644 --- a/deps/v8/test/cctest/heap/test-unmapper.cc +++ b/deps/v8/test/cctest/heap/test-unmapper.cc @@ -23,7 +23,7 @@ class MockPlatformForUnmapper : public TestPlatform { // Now that it's completely constructed, make this the current platform. i::V8::SetPlatformForTesting(this); } - virtual ~MockPlatformForUnmapper() { + ~MockPlatformForUnmapper() override { delete task_; i::V8::SetPlatformForTesting(old_platform_); for (auto& task : worker_tasks_) { diff --git a/deps/v8/test/cctest/heap/test-weak-references.cc b/deps/v8/test/cctest/heap/test-weak-references.cc index a54b13afd2..bbe4776b93 100644 --- a/deps/v8/test/cctest/heap/test-weak-references.cc +++ b/deps/v8/test/cctest/heap/test-weak-references.cc @@ -62,19 +62,19 @@ TEST(WeakReferencesBasic) { fv->set_optimized_code_weak_or_smi(HeapObjectReference::Weak(*code)); HeapObject* code_heap_object; - CHECK( - fv->optimized_code_weak_or_smi()->ToWeakHeapObject(&code_heap_object)); + CHECK(fv->optimized_code_weak_or_smi()->GetHeapObjectIfWeak( + &code_heap_object)); CHECK_EQ(*code, code_heap_object); CcTest::CollectAllGarbage(); - CHECK( - fv->optimized_code_weak_or_smi()->ToWeakHeapObject(&code_heap_object)); + CHECK(fv->optimized_code_weak_or_smi()->GetHeapObjectIfWeak( + &code_heap_object)); CHECK_EQ(*code, code_heap_object); } // code will go out of scope. CcTest::CollectAllGarbage(); - CHECK(fv->optimized_code_weak_or_smi()->IsClearedWeakHeapObject()); + CHECK(fv->optimized_code_weak_or_smi()->IsCleared()); } TEST(WeakReferencesOldToOld) { @@ -103,7 +103,7 @@ TEST(WeakReferencesOldToOld) { CHECK(heap->InOldSpace(*fixed_array)); HeapObject* heap_object; - CHECK(fv->optimized_code_weak_or_smi()->ToWeakHeapObject(&heap_object)); + CHECK(fv->optimized_code_weak_or_smi()->GetHeapObjectIfWeak(&heap_object)); CHECK_EQ(heap_object, *fixed_array); } @@ -128,7 +128,7 @@ TEST(WeakReferencesOldToNew) { CcTest::CollectAllGarbage(); HeapObject* heap_object; - CHECK(fv->optimized_code_weak_or_smi()->ToWeakHeapObject(&heap_object)); + CHECK(fv->optimized_code_weak_or_smi()->GetHeapObjectIfWeak(&heap_object)); CHECK_EQ(heap_object, *fixed_array); } @@ -153,7 +153,7 @@ TEST(WeakReferencesOldToNewScavenged) { CcTest::CollectGarbage(NEW_SPACE); HeapObject* heap_object; - CHECK(fv->optimized_code_weak_or_smi()->ToWeakHeapObject(&heap_object)); + CHECK(fv->optimized_code_weak_or_smi()->GetHeapObjectIfWeak(&heap_object)); CHECK_EQ(heap_object, *fixed_array); } @@ -174,7 +174,7 @@ TEST(WeakReferencesOldToCleared) { fv->set_optimized_code_weak_or_smi(HeapObjectReference::ClearedValue()); CcTest::CollectAllGarbage(); - CHECK(fv->optimized_code_weak_or_smi()->IsClearedWeakHeapObject()); + CHECK(fv->optimized_code_weak_or_smi()->IsCleared()); } TEST(ObjectMovesBeforeClearingWeakField) { @@ -210,11 +210,11 @@ TEST(ObjectMovesBeforeClearingWeakField) { CcTest::CollectGarbage(NEW_SPACE); FeedbackVector* new_fv_location = *fv; CHECK_NE(fv_location, new_fv_location); - CHECK(fv->optimized_code_weak_or_smi()->IsWeakHeapObject()); + CHECK(fv->optimized_code_weak_or_smi()->IsWeak()); // Now we try to clear *fv. CcTest::CollectAllGarbage(); - CHECK(fv->optimized_code_weak_or_smi()->IsClearedWeakHeapObject()); + CHECK(fv->optimized_code_weak_or_smi()->IsCleared()); } TEST(ObjectWithWeakFieldDies) { @@ -277,7 +277,7 @@ TEST(ObjectWithWeakReferencePromoted) { CHECK(heap->InOldSpace(*fixed_array)); HeapObject* heap_object; - CHECK(fv->optimized_code_weak_or_smi()->ToWeakHeapObject(&heap_object)); + CHECK(fv->optimized_code_weak_or_smi()->GetHeapObjectIfWeak(&heap_object)); CHECK_EQ(heap_object, *fixed_array); } @@ -296,14 +296,14 @@ TEST(ObjectWithClearedWeakReferencePromoted) { CcTest::CollectGarbage(NEW_SPACE); CHECK(Heap::InNewSpace(*fv)); - CHECK(fv->optimized_code_weak_or_smi()->IsClearedWeakHeapObject()); + CHECK(fv->optimized_code_weak_or_smi()->IsCleared()); CcTest::CollectGarbage(NEW_SPACE); CHECK(heap->InOldSpace(*fv)); - CHECK(fv->optimized_code_weak_or_smi()->IsClearedWeakHeapObject()); + CHECK(fv->optimized_code_weak_or_smi()->IsCleared()); CcTest::CollectAllGarbage(); - CHECK(fv->optimized_code_weak_or_smi()->IsClearedWeakHeapObject()); + CHECK(fv->optimized_code_weak_or_smi()->IsCleared()); } TEST(WeakReferenceWriteBarrier) { @@ -343,7 +343,7 @@ TEST(WeakReferenceWriteBarrier) { CcTest::CollectAllGarbage(); // Check that the write barrier treated the weak reference as strong. - CHECK(fv->optimized_code_weak_or_smi()->IsWeakHeapObject()); + CHECK(fv->optimized_code_weak_or_smi()->IsWeak()); } TEST(EmptyWeakArray) { @@ -375,7 +375,7 @@ TEST(WeakArraysBasic) { for (int i = 0; i < length; ++i) { HeapObject* heap_object; - CHECK(array->Get(i)->ToStrongHeapObject(&heap_object)); + CHECK(array->Get(i)->GetHeapObjectIfStrong(&heap_object)); CHECK_EQ(heap_object, ReadOnlyRoots(heap).undefined_value()); } @@ -407,23 +407,23 @@ TEST(WeakArraysBasic) { // space. CcTest::CollectGarbage(NEW_SPACE); HeapObject* heap_object; - CHECK(array->Get(0)->ToWeakHeapObject(&heap_object)); + CHECK(array->Get(0)->GetHeapObjectIfWeak(&heap_object)); CHECK_EQ(Smi::cast(FixedArray::cast(heap_object)->get(0))->value(), 2016); - CHECK(array->Get(1)->ToWeakHeapObject(&heap_object)); + CHECK(array->Get(1)->GetHeapObjectIfWeak(&heap_object)); CHECK_EQ(Smi::cast(FixedArray::cast(heap_object)->get(0))->value(), 2017); - CHECK(array->Get(2)->ToStrongHeapObject(&heap_object)); + CHECK(array->Get(2)->GetHeapObjectIfStrong(&heap_object)); CHECK_EQ(Smi::cast(FixedArray::cast(heap_object)->get(0))->value(), 2018); - CHECK(array->Get(3)->ToWeakHeapObject(&heap_object)); + CHECK(array->Get(3)->GetHeapObjectIfWeak(&heap_object)); CHECK_EQ(Smi::cast(FixedArray::cast(heap_object)->get(0))->value(), 2019); CcTest::CollectAllGarbage(); CHECK(heap->InOldSpace(*array)); - CHECK(array->Get(0)->IsClearedWeakHeapObject()); - CHECK(array->Get(1)->ToWeakHeapObject(&heap_object)); + CHECK(array->Get(0)->IsCleared()); + CHECK(array->Get(1)->GetHeapObjectIfWeak(&heap_object)); CHECK_EQ(Smi::cast(FixedArray::cast(heap_object)->get(0))->value(), 2017); - CHECK(array->Get(2)->ToStrongHeapObject(&heap_object)); + CHECK(array->Get(2)->GetHeapObjectIfStrong(&heap_object)); CHECK_EQ(Smi::cast(FixedArray::cast(heap_object)->get(0))->value(), 2018); - CHECK(array->Get(3)->IsClearedWeakHeapObject()); + CHECK(array->Get(3)->IsCleared()); } TEST(WeakArrayListBasic) { @@ -481,13 +481,13 @@ TEST(WeakArrayListBasic) { CHECK(Heap::InNewSpace(*array)); CHECK_EQ(array->Get(0), HeapObjectReference::Weak(*index0)); - CHECK_EQ(Smi::ToInt(array->Get(1)->ToSmi()), 1); + CHECK_EQ(Smi::ToInt(array->Get(1)->cast<Smi>()), 1); CHECK_EQ(array->Get(2), HeapObjectReference::Weak(*index2)); - CHECK_EQ(Smi::ToInt(array->Get(3)->ToSmi()), 3); + CHECK_EQ(Smi::ToInt(array->Get(3)->cast<Smi>()), 3); CHECK_EQ(array->Get(4), HeapObjectReference::Weak(*index4)); - CHECK_EQ(Smi::ToInt(array->Get(5)->ToSmi()), 5); + CHECK_EQ(Smi::ToInt(array->Get(5)->cast<Smi>()), 5); CHECK_EQ(array->Get(6), HeapObjectReference::Weak(*index6)); array = inner_scope.CloseAndEscape(array); @@ -502,37 +502,37 @@ TEST(WeakArrayListBasic) { CcTest::CollectGarbage(NEW_SPACE); HeapObject* heap_object; CHECK_EQ(array->length(), 8); - CHECK(array->Get(0)->ToWeakHeapObject(&heap_object)); + CHECK(array->Get(0)->GetHeapObjectIfWeak(&heap_object)); CHECK_EQ(Smi::cast(FixedArray::cast(heap_object)->get(0))->value(), 2016); - CHECK_EQ(Smi::ToInt(array->Get(1)->ToSmi()), 1); + CHECK_EQ(Smi::ToInt(array->Get(1)->cast<Smi>()), 1); - CHECK(array->Get(2)->ToWeakHeapObject(&heap_object)); + CHECK(array->Get(2)->GetHeapObjectIfWeak(&heap_object)); CHECK_EQ(Smi::cast(FixedArray::cast(heap_object)->get(0))->value(), 2017); - CHECK_EQ(Smi::ToInt(array->Get(3)->ToSmi()), 3); + CHECK_EQ(Smi::ToInt(array->Get(3)->cast<Smi>()), 3); - CHECK(array->Get(4)->ToWeakHeapObject(&heap_object)); + CHECK(array->Get(4)->GetHeapObjectIfWeak(&heap_object)); CHECK_EQ(Smi::cast(FixedArray::cast(heap_object)->get(0))->value(), 2018); - CHECK_EQ(Smi::ToInt(array->Get(5)->ToSmi()), 5); + CHECK_EQ(Smi::ToInt(array->Get(5)->cast<Smi>()), 5); - CHECK(array->Get(6)->ToWeakHeapObject(&heap_object)); + CHECK(array->Get(6)->GetHeapObjectIfWeak(&heap_object)); CHECK_EQ(Smi::cast(FixedArray::cast(heap_object)->get(0))->value(), 2019); - CHECK_EQ(Smi::ToInt(array->Get(7)->ToSmi()), 7); + CHECK_EQ(Smi::ToInt(array->Get(7)->cast<Smi>()), 7); CcTest::CollectAllGarbage(); CHECK(heap->InOldSpace(*array)); CHECK_EQ(array->length(), 8); - CHECK(array->Get(0)->IsClearedWeakHeapObject()); - CHECK_EQ(Smi::ToInt(array->Get(1)->ToSmi()), 1); + CHECK(array->Get(0)->IsCleared()); + CHECK_EQ(Smi::ToInt(array->Get(1)->cast<Smi>()), 1); - CHECK(array->Get(2)->ToWeakHeapObject(&heap_object)); + CHECK(array->Get(2)->GetHeapObjectIfWeak(&heap_object)); CHECK_EQ(Smi::cast(FixedArray::cast(heap_object)->get(0))->value(), 2017); - CHECK_EQ(Smi::ToInt(array->Get(3)->ToSmi()), 3); + CHECK_EQ(Smi::ToInt(array->Get(3)->cast<Smi>()), 3); - CHECK(array->Get(4)->IsClearedWeakHeapObject()); - CHECK_EQ(Smi::ToInt(array->Get(5)->ToSmi()), 5); + CHECK(array->Get(4)->IsCleared()); + CHECK_EQ(Smi::ToInt(array->Get(5)->cast<Smi>()), 5); - CHECK(array->Get(6)->IsClearedWeakHeapObject()); - CHECK_EQ(Smi::ToInt(array->Get(7)->ToSmi()), 7); + CHECK(array->Get(6)->IsCleared()); + CHECK_EQ(Smi::ToInt(array->Get(7)->cast<Smi>()), 7); } TEST(WeakArrayListRemove) { @@ -753,7 +753,7 @@ TEST(PrototypeUsersCompacted) { PrototypeUsers::MarkSlotEmpty(*array, 1); CcTest::CollectAllGarbage(); - CHECK(array->Get(3)->IsClearedWeakHeapObject()); + CHECK(array->Get(3)->IsCleared()); CHECK_EQ(array->length(), 3 + PrototypeUsers::kFirstIndex); WeakArrayList* new_array = diff --git a/deps/v8/test/cctest/interpreter/bytecode_expectations/ArrayLiterals.golden b/deps/v8/test/cctest/interpreter/bytecode_expectations/ArrayLiterals.golden index ae8d050914..31272f1c29 100644 --- a/deps/v8/test/cctest/interpreter/bytecode_expectations/ArrayLiterals.golden +++ b/deps/v8/test/cctest/interpreter/bytecode_expectations/ArrayLiterals.golden @@ -35,17 +35,17 @@ bytecodes: [ /* 42 S> */ B(LdaSmi), I8(1), B(Star), R(0), /* 45 S> */ B(CreateArrayLiteral), U8(0), U8(0), U8(37), - B(Star), R(1), - B(LdaZero), B(Star), R(2), + B(LdaZero), + B(Star), R(1), B(Ldar), R(0), - /* 54 E> */ B(StaKeyedProperty), R(1), R(2), U8(1), + /* 54 E> */ B(StaInArrayLiteral), R(2), R(1), U8(1), B(LdaSmi), I8(1), - B(Star), R(2), + B(Star), R(1), B(Ldar), R(0), /* 59 E> */ B(AddSmi), I8(1), U8(3), - B(StaKeyedProperty), R(1), R(2), U8(1), - B(Ldar), R(1), + B(StaInArrayLiteral), R(2), R(1), U8(1), + B(Ldar), R(2), /* 65 S> */ B(Return), ] constant pool: [ @@ -84,29 +84,29 @@ bytecodes: [ /* 42 S> */ B(LdaSmi), I8(1), B(Star), R(0), /* 45 S> */ B(CreateArrayLiteral), U8(0), U8(0), U8(4), - B(Star), R(1), - B(LdaZero), B(Star), R(2), - B(CreateArrayLiteral), U8(1), U8(3), U8(37), - B(Star), R(3), B(LdaZero), + B(Star), R(1), + B(CreateArrayLiteral), U8(1), U8(1), U8(37), B(Star), R(4), + B(LdaZero), + B(Star), R(3), B(Ldar), R(0), - /* 56 E> */ B(StaKeyedProperty), R(3), R(4), U8(4), - B(Ldar), R(3), - B(StaKeyedProperty), R(1), R(2), U8(1), + /* 56 E> */ B(StaInArrayLiteral), R(4), R(3), U8(2), + B(Ldar), R(4), + B(StaInArrayLiteral), R(2), R(1), U8(4), B(LdaSmi), I8(1), - B(Star), R(2), + B(Star), R(1), B(CreateArrayLiteral), U8(2), U8(6), U8(37), - B(Star), R(3), - B(LdaZero), B(Star), R(4), + B(LdaZero), + B(Star), R(3), B(Ldar), R(0), - /* 68 E> */ B(AddSmi), I8(2), U8(9), - B(StaKeyedProperty), R(3), R(4), U8(7), - B(Ldar), R(3), - B(StaKeyedProperty), R(1), R(2), U8(1), - B(Ldar), R(1), + /* 68 E> */ B(AddSmi), I8(2), U8(7), + B(StaInArrayLiteral), R(4), R(3), U8(8), + B(Ldar), R(4), + B(StaInArrayLiteral), R(2), R(1), U8(4), + B(Ldar), R(2), /* 76 S> */ B(Return), ] constant pool: [ @@ -121,50 +121,18 @@ handlers: [ snippet: " var a = [ 1, 2 ]; return [ ...a ]; " -frame size: 8 +frame size: 1 parameter count: 1 -bytecode array length: 86 +bytecode array length: 9 bytecodes: [ /* 30 E> */ B(StackCheck), /* 42 S> */ B(CreateArrayLiteral), U8(0), U8(0), U8(37), B(Star), R(0), - /* 52 S> */ B(CreateArrayLiteral), U8(1), U8(1), U8(37), - B(Star), R(1), - B(LdaConstant), U8(2), - /* 64 S> */ B(Star), R(2), - B(LdaNamedProperty), R(0), U8(3), U8(7), - B(Star), R(7), - B(CallProperty0), R(7), R(0), U8(9), - B(Mov), R(0), R(6), - B(JumpIfJSReceiver), U8(7), - B(CallRuntime), U16(Runtime::kThrowSymbolIteratorInvalid), R(0), U8(0), - B(Star), R(5), - B(LdaNamedProperty), R(5), U8(4), U8(11), - B(Star), R(4), - B(CallProperty0), R(4), R(5), U8(13), - B(Star), R(3), - B(JumpIfJSReceiver), U8(7), - B(CallRuntime), U16(Runtime::kThrowIteratorResultNotAnObject), R(3), U8(1), - B(LdaNamedProperty), R(3), U8(5), U8(15), - B(JumpIfToBooleanTrue), U8(21), - B(LdaNamedProperty), R(3), U8(6), U8(17), - B(Star), R(3), - B(StaInArrayLiteral), R(1), R(2), U8(2), - B(Ldar), R(2), - B(Inc), U8(4), - B(Star), R(2), - B(JumpLoop), U8(35), I8(0), - B(Ldar), R(1), + /* 52 S> */ B(CreateArrayFromIterable), /* 68 S> */ B(Return), ] constant pool: [ ARRAY_BOILERPLATE_DESCRIPTION_TYPE, - ARRAY_BOILERPLATE_DESCRIPTION_TYPE, - Smi [0], - SYMBOL_TYPE, - ONE_BYTE_INTERNALIZED_STRING_TYPE ["next"], - ONE_BYTE_INTERNALIZED_STRING_TYPE ["done"], - ONE_BYTE_INTERNALIZED_STRING_TYPE ["value"], ] handlers: [ ] @@ -181,32 +149,32 @@ bytecodes: [ /* 42 S> */ B(CreateArrayLiteral), U8(0), U8(0), U8(37), B(Star), R(0), /* 52 S> */ B(CreateArrayLiteral), U8(1), U8(1), U8(37), - B(Star), R(1), + B(Star), R(2), B(LdaConstant), U8(2), - /* 67 S> */ B(Star), R(2), - B(LdaNamedProperty), R(0), U8(3), U8(7), + /* 67 S> */ B(Star), R(1), + B(LdaNamedProperty), R(0), U8(3), U8(5), B(Star), R(7), - B(CallProperty0), R(7), R(0), U8(9), + B(CallProperty0), R(7), R(0), U8(7), B(Mov), R(0), R(6), B(JumpIfJSReceiver), U8(7), B(CallRuntime), U16(Runtime::kThrowSymbolIteratorInvalid), R(0), U8(0), B(Star), R(5), - B(LdaNamedProperty), R(5), U8(4), U8(11), + B(LdaNamedProperty), R(5), U8(4), U8(9), B(Star), R(4), - B(CallProperty0), R(4), R(5), U8(13), + B(CallProperty0), R(4), R(5), U8(11), B(Star), R(3), B(JumpIfJSReceiver), U8(7), B(CallRuntime), U16(Runtime::kThrowIteratorResultNotAnObject), R(3), U8(1), - B(LdaNamedProperty), R(3), U8(5), U8(15), + B(LdaNamedProperty), R(3), U8(5), U8(13), B(JumpIfToBooleanTrue), U8(21), - B(LdaNamedProperty), R(3), U8(6), U8(17), + B(LdaNamedProperty), R(3), U8(6), U8(15), B(Star), R(3), - B(StaInArrayLiteral), R(1), R(2), U8(2), - B(Ldar), R(2), - B(Inc), U8(4), - B(Star), R(2), - B(JumpLoop), U8(35), I8(0), + B(StaInArrayLiteral), R(2), R(1), U8(3), B(Ldar), R(1), + B(Inc), U8(2), + B(Star), R(1), + B(JumpLoop), U8(35), I8(0), + B(Ldar), R(2), /* 71 S> */ B(Return), ] constant pool: [ @@ -225,55 +193,25 @@ handlers: [ snippet: " var a = [ 1, 2 ]; return [ ...a, 3 ]; " -frame size: 8 +frame size: 3 parameter count: 1 -bytecode array length: 98 +bytecode array length: 25 bytecodes: [ /* 30 E> */ B(StackCheck), /* 42 S> */ B(CreateArrayLiteral), U8(0), U8(0), U8(37), B(Star), R(0), - /* 52 S> */ B(CreateArrayLiteral), U8(1), U8(1), U8(37), - B(Star), R(1), - B(LdaConstant), U8(2), - /* 64 S> */ B(Star), R(2), - B(LdaNamedProperty), R(0), U8(3), U8(7), - B(Star), R(7), - B(CallProperty0), R(7), R(0), U8(9), - B(Mov), R(0), R(6), - B(JumpIfJSReceiver), U8(7), - B(CallRuntime), U16(Runtime::kThrowSymbolIteratorInvalid), R(0), U8(0), - B(Star), R(5), - B(LdaNamedProperty), R(5), U8(4), U8(11), - B(Star), R(4), - B(CallProperty0), R(4), R(5), U8(13), - B(Star), R(3), - B(JumpIfJSReceiver), U8(7), - B(CallRuntime), U16(Runtime::kThrowIteratorResultNotAnObject), R(3), U8(1), - B(LdaNamedProperty), R(3), U8(5), U8(15), - B(JumpIfToBooleanTrue), U8(21), - B(LdaNamedProperty), R(3), U8(6), U8(17), - B(Star), R(3), - B(StaInArrayLiteral), R(1), R(2), U8(2), - B(Ldar), R(2), - B(Inc), U8(4), + /* 52 S> */ B(CreateArrayFromIterable), B(Star), R(2), - B(JumpLoop), U8(35), I8(0), + B(LdaNamedProperty), R(2), U8(1), U8(1), + B(Star), R(1), B(LdaSmi), I8(3), - B(StaInArrayLiteral), R(1), R(2), U8(2), + B(StaInArrayLiteral), R(2), R(1), U8(3), B(Ldar), R(2), - B(Inc), U8(4), - B(Star), R(2), - B(Ldar), R(1), /* 71 S> */ B(Return), ] constant pool: [ ARRAY_BOILERPLATE_DESCRIPTION_TYPE, - ARRAY_BOILERPLATE_DESCRIPTION_TYPE, - Smi [0], - SYMBOL_TYPE, - ONE_BYTE_INTERNALIZED_STRING_TYPE ["next"], - ONE_BYTE_INTERNALIZED_STRING_TYPE ["done"], - ONE_BYTE_INTERNALIZED_STRING_TYPE ["value"], + ONE_BYTE_INTERNALIZED_STRING_TYPE ["length"], ] handlers: [ ] diff --git a/deps/v8/test/cctest/interpreter/bytecode_expectations/AsyncGenerators.golden b/deps/v8/test/cctest/interpreter/bytecode_expectations/AsyncGenerators.golden index f5cbed6a7a..f3ddec23a0 100644 --- a/deps/v8/test/cctest/interpreter/bytecode_expectations/AsyncGenerators.golden +++ b/deps/v8/test/cctest/interpreter/bytecode_expectations/AsyncGenerators.golden @@ -252,19 +252,19 @@ frame size: 22 parameter count: 1 bytecode array length: 490 bytecodes: [ - B(SwitchOnGeneratorState), R(2), U8(0), U8(3), + B(SwitchOnGeneratorState), R(0), U8(0), U8(3), B(Mov), R(closure), R(11), B(Mov), R(this), R(12), B(InvokeIntrinsic), U8(Runtime::k_CreateJSGeneratorObject), R(11), U8(2), - B(Star), R(2), + B(Star), R(0), /* 17 E> */ B(StackCheck), B(Mov), R(context), R(13), B(Mov), R(context), R(14), - B(Ldar), R(2), - /* 17 E> */ B(SuspendGenerator), R(2), R(0), U8(15), U8(0), - B(ResumeGenerator), R(2), R(0), U8(15), + B(Ldar), R(0), + /* 17 E> */ B(SuspendGenerator), R(0), R(0), U8(15), U8(0), + B(ResumeGenerator), R(0), R(0), U8(15), B(Star), R(15), - B(InvokeIntrinsic), U8(Runtime::k_GeneratorGetResumeMode), R(2), U8(1), + B(InvokeIntrinsic), U8(Runtime::k_GeneratorGetResumeMode), R(0), U8(1), B(SwitchOnSmiNoFeedback), U8(3), U8(2), I8(0), B(Ldar), R(15), /* 17 E> */ B(Throw), @@ -300,16 +300,16 @@ bytecodes: [ B(Star), R(7), B(Mov), R(8), R(3), /* 22 E> */ B(StackCheck), - B(Mov), R(3), R(0), + B(Mov), R(3), R(1), /* 42 S> */ B(LdaFalse), B(Star), R(21), - B(Mov), R(2), R(19), - B(Mov), R(0), R(20), + B(Mov), R(0), R(19), + B(Mov), R(1), R(20), B(InvokeIntrinsic), U8(Runtime::k_AsyncGeneratorYield), R(19), U8(3), - /* 42 E> */ B(SuspendGenerator), R(2), R(0), U8(19), U8(1), - B(ResumeGenerator), R(2), R(0), U8(19), + /* 42 E> */ B(SuspendGenerator), R(0), R(0), U8(19), U8(1), + B(ResumeGenerator), R(0), R(0), U8(19), B(Star), R(19), - B(InvokeIntrinsic), U8(Runtime::k_GeneratorGetResumeMode), R(2), U8(1), + B(InvokeIntrinsic), U8(Runtime::k_GeneratorGetResumeMode), R(0), U8(1), B(SwitchOnSmiNoFeedback), U8(10), U8(2), I8(0), B(Ldar), R(19), /* 42 E> */ B(Throw), @@ -362,7 +362,7 @@ bytecodes: [ B(TestTypeOf), U8(6), B(JumpIfFalse), U8(4), B(Jump), U8(18), - B(Wide), B(LdaSmi), I16(153), + B(Wide), B(LdaSmi), I16(154), B(Star), R(18), B(LdaConstant), U8(14), B(Star), R(19), @@ -398,12 +398,12 @@ bytecodes: [ B(ReThrow), B(LdaUndefined), B(Star), R(16), - B(Mov), R(2), R(15), + B(Mov), R(0), R(15), B(CallJSRuntime), U8(%async_generator_await_uncaught), R(15), U8(2), - B(SuspendGenerator), R(2), R(0), U8(15), U8(2), - B(ResumeGenerator), R(2), R(0), U8(15), + B(SuspendGenerator), R(0), R(0), U8(15), U8(2), + B(ResumeGenerator), R(0), R(0), U8(15), B(Star), R(15), - B(InvokeIntrinsic), U8(Runtime::k_GeneratorGetResumeMode), R(2), U8(1), + B(InvokeIntrinsic), U8(Runtime::k_GeneratorGetResumeMode), R(0), U8(1), B(Star), R(16), B(LdaZero), B(TestReferenceEqual), R(16), @@ -424,7 +424,7 @@ bytecodes: [ B(PushContext), R(15), B(LdaImmutableCurrentContextSlot), U8(4), B(Star), R(17), - B(Mov), R(2), R(16), + B(Mov), R(0), R(16), B(InvokeIntrinsic), U8(Runtime::k_AsyncGeneratorReject), R(16), U8(2), B(PopContext), R(15), B(Star), R(12), @@ -441,7 +441,7 @@ bytecodes: [ B(LdaTheHole), B(SetPendingMessage), B(Star), R(13), - B(InvokeIntrinsic), U8(Runtime::k_GeneratorClose), R(2), U8(1), + B(InvokeIntrinsic), U8(Runtime::k_GeneratorClose), R(0), U8(1), B(Ldar), R(13), B(SetPendingMessage), B(Ldar), R(11), @@ -449,7 +449,7 @@ bytecodes: [ B(Jump), U8(22), B(LdaTrue), B(Star), R(16), - B(Mov), R(2), R(14), + B(Mov), R(0), R(14), B(Mov), R(12), R(15), B(InvokeIntrinsic), U8(Runtime::k_AsyncGeneratorResolve), R(14), U8(3), /* 50 S> */ B(Return), diff --git a/deps/v8/test/cctest/interpreter/bytecode_expectations/CallAndSpread.golden b/deps/v8/test/cctest/interpreter/bytecode_expectations/CallAndSpread.golden index 779e12c4ec..4c27e3a8d4 100644 --- a/deps/v8/test/cctest/interpreter/bytecode_expectations/CallAndSpread.golden +++ b/deps/v8/test/cctest/interpreter/bytecode_expectations/CallAndSpread.golden @@ -67,7 +67,7 @@ snippet: " " frame size: 10 parameter count: 1 -bytecode array length: 112 +bytecode array length: 109 bytecodes: [ /* 30 E> */ B(StackCheck), /* 34 S> */ B(LdaGlobal), U8(0), U8(0), @@ -75,38 +75,36 @@ bytecodes: [ B(LdaNamedProperty), R(0), U8(1), U8(2), B(Star), R(1), B(CreateArrayLiteral), U8(2), U8(4), U8(37), - B(Star), R(3), - B(LdaConstant), U8(3), B(Star), R(4), - /* 49 S> */ B(CreateArrayLiteral), U8(4), U8(10), U8(37), + B(LdaConstant), U8(3), + B(Star), R(3), + /* 49 S> */ B(CreateArrayLiteral), U8(4), U8(8), U8(37), B(Star), R(8), - B(LdaNamedProperty), R(8), U8(5), U8(11), + B(LdaNamedProperty), R(8), U8(5), U8(9), B(Star), R(9), - B(CallProperty0), R(9), R(8), U8(13), + B(CallProperty0), R(9), R(8), U8(11), B(Mov), R(0), R(2), B(JumpIfJSReceiver), U8(7), B(CallRuntime), U16(Runtime::kThrowSymbolIteratorInvalid), R(0), U8(0), B(Star), R(7), - B(LdaNamedProperty), R(7), U8(6), U8(15), + B(LdaNamedProperty), R(7), U8(6), U8(13), B(Star), R(6), - B(CallProperty0), R(6), R(7), U8(17), + B(CallProperty0), R(6), R(7), U8(15), B(Star), R(5), B(JumpIfJSReceiver), U8(7), B(CallRuntime), U16(Runtime::kThrowIteratorResultNotAnObject), R(5), U8(1), - B(LdaNamedProperty), R(5), U8(7), U8(19), + B(LdaNamedProperty), R(5), U8(7), U8(17), B(JumpIfToBooleanTrue), U8(21), - B(LdaNamedProperty), R(5), U8(8), U8(21), + B(LdaNamedProperty), R(5), U8(8), U8(19), B(Star), R(5), - B(StaInArrayLiteral), R(3), R(4), U8(5), - B(Ldar), R(4), - B(Inc), U8(7), - B(Star), R(4), + B(StaInArrayLiteral), R(4), R(3), U8(6), + B(Ldar), R(3), + B(Inc), U8(5), + B(Star), R(3), B(JumpLoop), U8(35), I8(0), B(LdaSmi), I8(4), - B(StaInArrayLiteral), R(3), R(4), U8(5), - B(Ldar), R(4), - B(Inc), U8(7), - B(Star), R(4), + B(StaInArrayLiteral), R(4), R(3), U8(6), + B(Mov), R(4), R(3), B(CallJSRuntime), U8(%reflect_apply), R(1), U8(3), B(LdaUndefined), /* 64 S> */ B(Return), diff --git a/deps/v8/test/cctest/interpreter/bytecode_expectations/ClassDeclarations.golden b/deps/v8/test/cctest/interpreter/bytecode_expectations/ClassDeclarations.golden index 737d423fcb..c56e29436e 100644 --- a/deps/v8/test/cctest/interpreter/bytecode_expectations/ClassDeclarations.golden +++ b/deps/v8/test/cctest/interpreter/bytecode_expectations/ClassDeclarations.golden @@ -103,12 +103,12 @@ bytecodes: [ B(Star), R(3), B(LdaConstant), U8(3), B(Star), R(4), - B(LdaImmutableCurrentContextSlot), U8(4), - /* 75 E> */ B(ToName), R(7), + /* 75 S> */ B(LdaImmutableCurrentContextSlot), U8(4), + B(ToName), R(7), B(CreateClosure), U8(5), U8(1), U8(2), B(Star), R(8), - B(LdaImmutableCurrentContextSlot), U8(5), - /* 106 E> */ B(ToName), R(9), + /* 106 S> */ B(LdaImmutableCurrentContextSlot), U8(5), + B(ToName), R(9), B(LdaConstant), U8(6), B(TestEqualStrict), R(9), U8(2), B(Mov), R(3), R(5), diff --git a/deps/v8/test/cctest/interpreter/bytecode_expectations/ForAwaitOf.golden b/deps/v8/test/cctest/interpreter/bytecode_expectations/ForAwaitOf.golden index c5fae1f4f6..098130c480 100644 --- a/deps/v8/test/cctest/interpreter/bytecode_expectations/ForAwaitOf.golden +++ b/deps/v8/test/cctest/interpreter/bytecode_expectations/ForAwaitOf.golden @@ -16,20 +16,20 @@ snippet: " " frame size: 23 parameter count: 1 -bytecode array length: 514 +bytecode array length: 518 bytecodes: [ - B(SwitchOnGeneratorState), R(2), U8(0), U8(3), + B(SwitchOnGeneratorState), R(3), U8(0), U8(3), B(Mov), R(closure), R(12), B(Mov), R(this), R(13), B(InvokeIntrinsic), U8(Runtime::k_CreateJSGeneratorObject), R(12), U8(2), - B(Star), R(2), + B(Star), R(3), /* 16 E> */ B(StackCheck), B(CallJSRuntime), U8(%async_function_promise_create), R(0), U8(0), - B(Star), R(11), + B(Star), R(0), B(Mov), R(context), R(14), B(Mov), R(context), R(15), B(LdaZero), - B(Star), R(7), + B(Star), R(8), B(Mov), R(context), R(18), B(Mov), R(context), R(19), /* 43 S> */ B(CreateArrayLiteral), U8(3), U8(0), U8(37), @@ -46,40 +46,40 @@ bytecodes: [ B(CallProperty0), R(21), R(20), U8(7), B(Star), R(21), B(InvokeIntrinsic), U8(Runtime::k_CreateAsyncFromSyncIterator), R(21), U8(1), - B(Star), R(4), - /* 43 E> */ B(LdaNamedProperty), R(4), U8(6), U8(9), B(Star), R(5), - /* 40 S> */ B(CallProperty0), R(5), R(4), U8(11), + /* 43 E> */ B(LdaNamedProperty), R(5), U8(6), U8(9), + B(Star), R(6), + /* 40 S> */ B(CallProperty0), R(6), R(5), U8(11), B(Star), R(21), - B(Mov), R(2), R(20), - B(Mov), R(11), R(22), + B(Mov), R(3), R(20), + B(Mov), R(0), R(22), B(CallJSRuntime), U8(%async_function_await_uncaught), R(20), U8(3), - /* 40 E> */ B(SuspendGenerator), R(2), R(0), U8(20), U8(0), - B(ResumeGenerator), R(2), R(0), U8(20), + /* 40 E> */ B(SuspendGenerator), R(3), R(0), U8(20), U8(0), + B(ResumeGenerator), R(3), R(0), U8(20), B(Star), R(20), - B(InvokeIntrinsic), U8(Runtime::k_GeneratorGetResumeMode), R(2), U8(1), + B(InvokeIntrinsic), U8(Runtime::k_GeneratorGetResumeMode), R(3), U8(1), B(Star), R(21), B(LdaZero), B(TestReferenceEqual), R(21), B(JumpIfTrue), U8(5), B(Ldar), R(20), B(ReThrow), - B(Mov), R(20), R(6), + B(Mov), R(20), R(7), /* 40 E> */ B(InvokeIntrinsic), U8(Runtime::k_IsJSReceiver), R(20), U8(1), B(ToBooleanLogicalNot), B(JumpIfFalse), U8(7), - B(CallRuntime), U16(Runtime::kThrowIteratorResultNotAnObject), R(6), U8(1), - B(LdaNamedProperty), R(6), U8(7), U8(13), + B(CallRuntime), U16(Runtime::kThrowIteratorResultNotAnObject), R(7), U8(1), + B(LdaNamedProperty), R(7), U8(7), U8(13), B(JumpIfToBooleanTrue), U8(25), - B(LdaNamedProperty), R(6), U8(8), U8(15), - B(Star), R(8), + B(LdaNamedProperty), R(7), U8(8), U8(15), + B(Star), R(9), B(LdaSmi), I8(2), - B(Star), R(7), - B(Mov), R(8), R(3), + B(Star), R(8), + B(Mov), R(9), R(4), /* 23 E> */ B(StackCheck), - B(Mov), R(3), R(0), + B(Mov), R(4), R(1), B(LdaZero), - B(Star), R(7), + B(Star), R(8), B(JumpLoop), U8(82), I8(0), B(Jump), U8(37), B(Star), R(20), @@ -90,10 +90,10 @@ bytecodes: [ B(Ldar), R(19), B(PushContext), R(20), B(LdaSmi), I8(2), - B(TestEqualStrict), R(7), U8(17), + B(TestEqualStrict), R(8), U8(17), B(JumpIfFalse), U8(6), B(LdaSmi), I8(1), - B(Star), R(7), + B(Star), R(8), B(LdaImmutableCurrentContextSlot), U8(4), B(Star), R(21), B(CallRuntime), U16(Runtime::kReThrow), R(21), U8(1), @@ -109,38 +109,38 @@ bytecodes: [ B(SetPendingMessage), B(Star), R(18), B(LdaZero), - B(TestEqualStrict), R(7), U8(18), + B(TestEqualStrict), R(8), U8(18), B(JumpIfTrue), U8(167), - B(LdaNamedProperty), R(4), U8(10), U8(19), - B(Star), R(9), + B(LdaNamedProperty), R(5), U8(10), U8(19), + B(Star), R(10), B(TestUndetectable), B(JumpIfFalse), U8(4), B(Jump), U8(156), B(LdaSmi), I8(1), - B(TestEqualStrict), R(7), U8(21), + B(TestEqualStrict), R(8), U8(21), B(JumpIfFalse), U8(86), - B(Ldar), R(9), + B(Ldar), R(10), B(TestTypeOf), U8(6), B(JumpIfFalse), U8(4), B(Jump), U8(18), - B(Wide), B(LdaSmi), I16(153), + B(Wide), B(LdaSmi), I16(154), B(Star), R(19), B(LdaConstant), U8(11), B(Star), R(20), B(CallRuntime), U16(Runtime::kNewTypeError), R(19), U8(2), B(Throw), B(Mov), R(context), R(19), - B(Mov), R(9), R(20), - B(Mov), R(4), R(21), + B(Mov), R(10), R(20), + B(Mov), R(5), R(21), B(InvokeIntrinsic), U8(Runtime::k_Call), R(20), U8(2), B(Star), R(21), - B(Mov), R(2), R(20), - B(Mov), R(11), R(22), + B(Mov), R(3), R(20), + B(Mov), R(0), R(22), B(CallJSRuntime), U8(%async_function_await_caught), R(20), U8(3), - B(SuspendGenerator), R(2), R(0), U8(20), U8(1), - B(ResumeGenerator), R(2), R(0), U8(20), + B(SuspendGenerator), R(3), R(0), U8(20), U8(1), + B(ResumeGenerator), R(3), R(0), U8(20), B(Star), R(20), - B(InvokeIntrinsic), U8(Runtime::k_GeneratorGetResumeMode), R(2), U8(1), + B(InvokeIntrinsic), U8(Runtime::k_GeneratorGetResumeMode), R(3), U8(1), B(Star), R(21), B(LdaZero), B(TestReferenceEqual), R(21), @@ -153,28 +153,28 @@ bytecodes: [ B(SetPendingMessage), B(Ldar), R(19), B(Jump), U8(65), - B(Mov), R(9), R(19), - B(Mov), R(4), R(20), + B(Mov), R(10), R(19), + B(Mov), R(5), R(20), B(InvokeIntrinsic), U8(Runtime::k_Call), R(19), U8(2), B(Star), R(20), - B(Mov), R(2), R(19), - B(Mov), R(11), R(21), + B(Mov), R(3), R(19), + B(Mov), R(0), R(21), B(CallJSRuntime), U8(%async_function_await_uncaught), R(19), U8(3), - B(SuspendGenerator), R(2), R(0), U8(19), U8(2), - B(ResumeGenerator), R(2), R(0), U8(19), + B(SuspendGenerator), R(3), R(0), U8(19), U8(2), + B(ResumeGenerator), R(3), R(0), U8(19), B(Star), R(19), - B(InvokeIntrinsic), U8(Runtime::k_GeneratorGetResumeMode), R(2), U8(1), + B(InvokeIntrinsic), U8(Runtime::k_GeneratorGetResumeMode), R(3), U8(1), B(Star), R(20), B(LdaZero), B(TestReferenceEqual), R(20), B(JumpIfTrue), U8(5), B(Ldar), R(19), B(ReThrow), - B(Mov), R(19), R(10), + B(Mov), R(19), R(11), B(InvokeIntrinsic), U8(Runtime::k_IsJSReceiver), R(19), U8(1), B(JumpIfToBooleanFalse), U8(4), B(Jump), U8(7), - B(CallRuntime), U16(Runtime::kThrowIteratorResultNotAnObject), R(10), U8(1), + B(CallRuntime), U16(Runtime::kThrowIteratorResultNotAnObject), R(11), U8(1), B(Ldar), R(18), B(SetPendingMessage), B(LdaZero), @@ -183,14 +183,11 @@ bytecodes: [ B(Ldar), R(17), B(ReThrow), B(LdaUndefined), - B(Star), R(17), - B(Mov), R(11), R(16), - B(InvokeIntrinsic), U8(Runtime::k_ResolvePromise), R(16), U8(2), + B(Star), R(13), B(LdaZero), B(Star), R(12), - B(Mov), R(11), R(13), - B(Jump), U8(55), - B(Jump), U8(39), + B(Jump), U8(56), + B(Jump), U8(40), B(Star), R(16), B(CreateCatchContext), R(16), U8(12), B(Star), R(15), @@ -202,32 +199,37 @@ bytecodes: [ B(Star), R(18), B(LdaFalse), B(Star), R(19), - B(Mov), R(11), R(17), + B(Mov), R(0), R(17), B(InvokeIntrinsic), U8(Runtime::k_RejectPromise), R(17), U8(3), B(PopContext), R(16), - B(LdaZero), + B(LdaSmi), I8(1), B(Star), R(12), - B(Mov), R(11), R(13), + B(Mov), R(0), R(13), B(Jump), U8(16), B(LdaSmi), I8(-1), B(Star), R(13), B(Star), R(12), B(Jump), U8(8), B(Star), R(13), - B(LdaSmi), I8(1), + B(LdaSmi), I8(2), B(Star), R(12), B(LdaTheHole), B(SetPendingMessage), B(Star), R(14), B(LdaTrue), B(Star), R(16), - B(Mov), R(11), R(15), + B(Mov), R(0), R(15), B(CallJSRuntime), U8(%async_function_promise_release), R(15), U8(2), B(Ldar), R(14), B(SetPendingMessage), B(Ldar), R(12), - B(SwitchOnSmiNoFeedback), U8(13), U8(2), I8(0), - B(Jump), U8(8), + B(SwitchOnSmiNoFeedback), U8(13), U8(3), I8(0), + B(Jump), U8(21), + B(Mov), R(0), R(15), + B(Mov), R(13), R(16), + B(InvokeIntrinsic), U8(Runtime::k_ResolvePromise), R(15), U8(2), + B(Ldar), R(0), + /* 57 S> */ B(Return), B(Ldar), R(13), /* 57 S> */ B(Return), B(Ldar), R(13), @@ -250,11 +252,12 @@ constant pool: [ ONE_BYTE_INTERNALIZED_STRING_TYPE [""], SCOPE_INFO_TYPE, Smi [6], - Smi [9], + Smi [19], + Smi [22], ] handlers: [ - [26, 467, 475], - [29, 428, 430], + [26, 458, 466], + [29, 418, 420], [35, 211, 219], [38, 174, 176], [279, 328, 330], @@ -269,20 +272,20 @@ snippet: " " frame size: 23 parameter count: 1 -bytecode array length: 543 +bytecode array length: 532 bytecodes: [ - B(SwitchOnGeneratorState), R(2), U8(0), U8(3), + B(SwitchOnGeneratorState), R(3), U8(0), U8(3), B(Mov), R(closure), R(12), B(Mov), R(this), R(13), B(InvokeIntrinsic), U8(Runtime::k_CreateJSGeneratorObject), R(12), U8(2), - B(Star), R(2), + B(Star), R(3), /* 16 E> */ B(StackCheck), B(CallJSRuntime), U8(%async_function_promise_create), R(0), U8(0), - B(Star), R(11), + B(Star), R(0), B(Mov), R(context), R(14), B(Mov), R(context), R(15), B(LdaZero), - B(Star), R(7), + B(Star), R(8), B(Mov), R(context), R(18), B(Mov), R(context), R(19), /* 43 S> */ B(CreateArrayLiteral), U8(3), U8(0), U8(37), @@ -299,41 +302,41 @@ bytecodes: [ B(CallProperty0), R(21), R(20), U8(7), B(Star), R(21), B(InvokeIntrinsic), U8(Runtime::k_CreateAsyncFromSyncIterator), R(21), U8(1), - B(Star), R(4), - /* 43 E> */ B(LdaNamedProperty), R(4), U8(6), U8(9), B(Star), R(5), - /* 40 S> */ B(CallProperty0), R(5), R(4), U8(11), + /* 43 E> */ B(LdaNamedProperty), R(5), U8(6), U8(9), + B(Star), R(6), + /* 40 S> */ B(CallProperty0), R(6), R(5), U8(11), B(Star), R(21), - B(Mov), R(2), R(20), - B(Mov), R(11), R(22), + B(Mov), R(3), R(20), + B(Mov), R(0), R(22), B(CallJSRuntime), U8(%async_function_await_uncaught), R(20), U8(3), - /* 40 E> */ B(SuspendGenerator), R(2), R(0), U8(20), U8(0), - B(ResumeGenerator), R(2), R(0), U8(20), + /* 40 E> */ B(SuspendGenerator), R(3), R(0), U8(20), U8(0), + B(ResumeGenerator), R(3), R(0), U8(20), B(Star), R(20), - B(InvokeIntrinsic), U8(Runtime::k_GeneratorGetResumeMode), R(2), U8(1), + B(InvokeIntrinsic), U8(Runtime::k_GeneratorGetResumeMode), R(3), U8(1), B(Star), R(21), B(LdaZero), B(TestReferenceEqual), R(21), B(JumpIfTrue), U8(5), B(Ldar), R(20), B(ReThrow), - B(Mov), R(20), R(6), + B(Mov), R(20), R(7), /* 40 E> */ B(InvokeIntrinsic), U8(Runtime::k_IsJSReceiver), R(20), U8(1), B(ToBooleanLogicalNot), B(JumpIfFalse), U8(7), - B(CallRuntime), U16(Runtime::kThrowIteratorResultNotAnObject), R(6), U8(1), - B(LdaNamedProperty), R(6), U8(7), U8(13), + B(CallRuntime), U16(Runtime::kThrowIteratorResultNotAnObject), R(7), U8(1), + B(LdaNamedProperty), R(7), U8(7), U8(13), B(JumpIfToBooleanTrue), U8(27), - B(LdaNamedProperty), R(6), U8(8), U8(15), - B(Star), R(8), + B(LdaNamedProperty), R(7), U8(8), U8(15), + B(Star), R(9), B(LdaSmi), I8(2), - B(Star), R(7), - B(Mov), R(8), R(3), + B(Star), R(8), + B(Mov), R(9), R(4), /* 23 E> */ B(StackCheck), - B(Mov), R(3), R(0), + B(Mov), R(4), R(1), /* 56 S> */ B(LdaZero), B(Star), R(16), - B(Mov), R(8), R(17), + B(Mov), R(9), R(17), B(Jump), U8(53), B(Jump), U8(37), B(Star), R(20), @@ -344,10 +347,10 @@ bytecodes: [ B(Ldar), R(19), B(PushContext), R(20), B(LdaSmi), I8(2), - B(TestEqualStrict), R(7), U8(17), + B(TestEqualStrict), R(8), U8(17), B(JumpIfFalse), U8(6), B(LdaSmi), I8(1), - B(Star), R(7), + B(Star), R(8), B(LdaImmutableCurrentContextSlot), U8(4), B(Star), R(21), B(CallRuntime), U16(Runtime::kReThrow), R(21), U8(1), @@ -363,38 +366,38 @@ bytecodes: [ B(SetPendingMessage), B(Star), R(18), B(LdaZero), - B(TestEqualStrict), R(7), U8(18), + B(TestEqualStrict), R(8), U8(18), B(JumpIfTrue), U8(167), - B(LdaNamedProperty), R(4), U8(10), U8(19), - B(Star), R(9), + B(LdaNamedProperty), R(5), U8(10), U8(19), + B(Star), R(10), B(TestUndetectable), B(JumpIfFalse), U8(4), B(Jump), U8(156), B(LdaSmi), I8(1), - B(TestEqualStrict), R(7), U8(21), + B(TestEqualStrict), R(8), U8(21), B(JumpIfFalse), U8(86), - B(Ldar), R(9), + B(Ldar), R(10), B(TestTypeOf), U8(6), B(JumpIfFalse), U8(4), B(Jump), U8(18), - B(Wide), B(LdaSmi), I16(153), + B(Wide), B(LdaSmi), I16(154), B(Star), R(19), B(LdaConstant), U8(11), B(Star), R(20), B(CallRuntime), U16(Runtime::kNewTypeError), R(19), U8(2), B(Throw), B(Mov), R(context), R(19), - B(Mov), R(9), R(20), - B(Mov), R(4), R(21), + B(Mov), R(10), R(20), + B(Mov), R(5), R(21), B(InvokeIntrinsic), U8(Runtime::k_Call), R(20), U8(2), B(Star), R(21), - B(Mov), R(2), R(20), - B(Mov), R(11), R(22), + B(Mov), R(3), R(20), + B(Mov), R(0), R(22), B(CallJSRuntime), U8(%async_function_await_caught), R(20), U8(3), - B(SuspendGenerator), R(2), R(0), U8(20), U8(1), - B(ResumeGenerator), R(2), R(0), U8(20), + B(SuspendGenerator), R(3), R(0), U8(20), U8(1), + B(ResumeGenerator), R(3), R(0), U8(20), B(Star), R(20), - B(InvokeIntrinsic), U8(Runtime::k_GeneratorGetResumeMode), R(2), U8(1), + B(InvokeIntrinsic), U8(Runtime::k_GeneratorGetResumeMode), R(3), U8(1), B(Star), R(21), B(LdaZero), B(TestReferenceEqual), R(21), @@ -407,28 +410,28 @@ bytecodes: [ B(SetPendingMessage), B(Ldar), R(19), B(Jump), U8(65), - B(Mov), R(9), R(19), - B(Mov), R(4), R(20), + B(Mov), R(10), R(19), + B(Mov), R(5), R(20), B(InvokeIntrinsic), U8(Runtime::k_Call), R(19), U8(2), B(Star), R(20), - B(Mov), R(2), R(19), - B(Mov), R(11), R(21), + B(Mov), R(3), R(19), + B(Mov), R(0), R(21), B(CallJSRuntime), U8(%async_function_await_uncaught), R(19), U8(3), - B(SuspendGenerator), R(2), R(0), U8(19), U8(2), - B(ResumeGenerator), R(2), R(0), U8(19), + B(SuspendGenerator), R(3), R(0), U8(19), U8(2), + B(ResumeGenerator), R(3), R(0), U8(19), B(Star), R(19), - B(InvokeIntrinsic), U8(Runtime::k_GeneratorGetResumeMode), R(2), U8(1), + B(InvokeIntrinsic), U8(Runtime::k_GeneratorGetResumeMode), R(3), U8(1), B(Star), R(20), B(LdaZero), B(TestReferenceEqual), R(20), B(JumpIfTrue), U8(5), B(Ldar), R(19), B(ReThrow), - B(Mov), R(19), R(10), + B(Mov), R(19), R(11), B(InvokeIntrinsic), U8(Runtime::k_IsJSReceiver), R(19), U8(1), B(JumpIfToBooleanFalse), U8(4), B(Jump), U8(7), - B(CallRuntime), U16(Runtime::kThrowIteratorResultNotAnObject), R(10), U8(1), + B(CallRuntime), U16(Runtime::kThrowIteratorResultNotAnObject), R(11), U8(1), B(Ldar), R(18), B(SetPendingMessage), B(Ldar), R(16), @@ -437,16 +440,13 @@ bytecodes: [ B(LdaZero), B(Star), R(12), B(Mov), R(17), R(13), - B(Jump), U8(78), + B(Jump), U8(67), B(Ldar), R(17), B(ReThrow), B(LdaUndefined), - B(Star), R(17), - B(Mov), R(11), R(16), - B(InvokeIntrinsic), U8(Runtime::k_ResolvePromise), R(16), U8(2), - B(LdaSmi), I8(1), + B(Star), R(13), + B(LdaZero), B(Star), R(12), - B(Mov), R(11), R(13), B(Jump), U8(56), B(Jump), U8(40), B(Star), R(16), @@ -460,12 +460,12 @@ bytecodes: [ B(Star), R(18), B(LdaFalse), B(Star), R(19), - B(Mov), R(11), R(17), + B(Mov), R(0), R(17), B(InvokeIntrinsic), U8(Runtime::k_RejectPromise), R(17), U8(3), B(PopContext), R(16), B(LdaSmi), I8(1), B(Star), R(12), - B(Mov), R(11), R(13), + B(Mov), R(0), R(13), B(Jump), U8(16), B(LdaSmi), I8(-1), B(Star), R(13), @@ -479,17 +479,17 @@ bytecodes: [ B(Star), R(14), B(LdaTrue), B(Star), R(16), - B(Mov), R(11), R(15), + B(Mov), R(0), R(15), B(CallJSRuntime), U8(%async_function_promise_release), R(15), U8(2), B(Ldar), R(14), B(SetPendingMessage), B(Ldar), R(12), B(SwitchOnSmiNoFeedback), U8(15), U8(3), I8(0), B(Jump), U8(21), - B(Mov), R(11), R(15), + B(Mov), R(0), R(15), B(Mov), R(13), R(16), B(InvokeIntrinsic), U8(Runtime::k_ResolvePromise), R(15), U8(2), - B(Ldar), R(11), + B(Ldar), R(0), /* 68 S> */ B(Return), B(Ldar), R(13), /* 68 S> */ B(Return), @@ -519,8 +519,8 @@ constant pool: [ Smi [22], ] handlers: [ - [26, 483, 491], - [29, 443, 445], + [26, 472, 480], + [29, 432, 434], [35, 213, 221], [38, 176, 178], [282, 331, 333], @@ -538,20 +538,20 @@ snippet: " " frame size: 23 parameter count: 1 -bytecode array length: 532 +bytecode array length: 536 bytecodes: [ - B(SwitchOnGeneratorState), R(2), U8(0), U8(3), + B(SwitchOnGeneratorState), R(3), U8(0), U8(3), B(Mov), R(closure), R(12), B(Mov), R(this), R(13), B(InvokeIntrinsic), U8(Runtime::k_CreateJSGeneratorObject), R(12), U8(2), - B(Star), R(2), + B(Star), R(3), /* 16 E> */ B(StackCheck), B(CallJSRuntime), U8(%async_function_promise_create), R(0), U8(0), - B(Star), R(11), + B(Star), R(0), B(Mov), R(context), R(14), B(Mov), R(context), R(15), B(LdaZero), - B(Star), R(7), + B(Star), R(8), B(Mov), R(context), R(18), B(Mov), R(context), R(19), /* 43 S> */ B(CreateArrayLiteral), U8(3), U8(0), U8(37), @@ -568,48 +568,48 @@ bytecodes: [ B(CallProperty0), R(21), R(20), U8(7), B(Star), R(21), B(InvokeIntrinsic), U8(Runtime::k_CreateAsyncFromSyncIterator), R(21), U8(1), - B(Star), R(4), - /* 43 E> */ B(LdaNamedProperty), R(4), U8(6), U8(9), B(Star), R(5), - /* 40 S> */ B(CallProperty0), R(5), R(4), U8(11), + /* 43 E> */ B(LdaNamedProperty), R(5), U8(6), U8(9), + B(Star), R(6), + /* 40 S> */ B(CallProperty0), R(6), R(5), U8(11), B(Star), R(21), - B(Mov), R(2), R(20), - B(Mov), R(11), R(22), + B(Mov), R(3), R(20), + B(Mov), R(0), R(22), B(CallJSRuntime), U8(%async_function_await_uncaught), R(20), U8(3), - /* 40 E> */ B(SuspendGenerator), R(2), R(0), U8(20), U8(0), - B(ResumeGenerator), R(2), R(0), U8(20), + /* 40 E> */ B(SuspendGenerator), R(3), R(0), U8(20), U8(0), + B(ResumeGenerator), R(3), R(0), U8(20), B(Star), R(20), - B(InvokeIntrinsic), U8(Runtime::k_GeneratorGetResumeMode), R(2), U8(1), + B(InvokeIntrinsic), U8(Runtime::k_GeneratorGetResumeMode), R(3), U8(1), B(Star), R(21), B(LdaZero), B(TestReferenceEqual), R(21), B(JumpIfTrue), U8(5), B(Ldar), R(20), B(ReThrow), - B(Mov), R(20), R(6), + B(Mov), R(20), R(7), /* 40 E> */ B(InvokeIntrinsic), U8(Runtime::k_IsJSReceiver), R(20), U8(1), B(ToBooleanLogicalNot), B(JumpIfFalse), U8(7), - B(CallRuntime), U16(Runtime::kThrowIteratorResultNotAnObject), R(6), U8(1), - B(LdaNamedProperty), R(6), U8(7), U8(13), + B(CallRuntime), U16(Runtime::kThrowIteratorResultNotAnObject), R(7), U8(1), + B(LdaNamedProperty), R(7), U8(7), U8(13), B(JumpIfToBooleanTrue), U8(43), - B(LdaNamedProperty), R(6), U8(8), U8(15), - B(Star), R(8), + B(LdaNamedProperty), R(7), U8(8), U8(15), + B(Star), R(9), B(LdaSmi), I8(2), - B(Star), R(7), - B(Mov), R(8), R(3), + B(Star), R(8), + B(Mov), R(9), R(4), /* 23 E> */ B(StackCheck), - B(Mov), R(3), R(0), + B(Mov), R(4), R(1), /* 63 S> */ B(LdaSmi), I8(10), - /* 69 E> */ B(TestEqual), R(0), U8(17), + /* 69 E> */ B(TestEqual), R(1), U8(17), B(JumpIfFalse), U8(4), /* 76 S> */ B(Jump), U8(14), /* 90 S> */ B(LdaSmi), I8(20), - /* 96 E> */ B(TestEqual), R(0), U8(18), + /* 96 E> */ B(TestEqual), R(1), U8(18), B(JumpIfFalse), U8(4), /* 103 S> */ B(Jump), U8(8), B(LdaZero), - B(Star), R(7), + B(Star), R(8), B(JumpLoop), U8(100), I8(0), B(Jump), U8(37), B(Star), R(20), @@ -620,10 +620,10 @@ bytecodes: [ B(Ldar), R(19), B(PushContext), R(20), B(LdaSmi), I8(2), - B(TestEqualStrict), R(7), U8(19), + B(TestEqualStrict), R(8), U8(19), B(JumpIfFalse), U8(6), B(LdaSmi), I8(1), - B(Star), R(7), + B(Star), R(8), B(LdaImmutableCurrentContextSlot), U8(4), B(Star), R(21), B(CallRuntime), U16(Runtime::kReThrow), R(21), U8(1), @@ -639,38 +639,38 @@ bytecodes: [ B(SetPendingMessage), B(Star), R(18), B(LdaZero), - B(TestEqualStrict), R(7), U8(20), + B(TestEqualStrict), R(8), U8(20), B(JumpIfTrue), U8(167), - B(LdaNamedProperty), R(4), U8(10), U8(21), - B(Star), R(9), + B(LdaNamedProperty), R(5), U8(10), U8(21), + B(Star), R(10), B(TestUndetectable), B(JumpIfFalse), U8(4), B(Jump), U8(156), B(LdaSmi), I8(1), - B(TestEqualStrict), R(7), U8(23), + B(TestEqualStrict), R(8), U8(23), B(JumpIfFalse), U8(86), - B(Ldar), R(9), + B(Ldar), R(10), B(TestTypeOf), U8(6), B(JumpIfFalse), U8(4), B(Jump), U8(18), - B(Wide), B(LdaSmi), I16(153), + B(Wide), B(LdaSmi), I16(154), B(Star), R(19), B(LdaConstant), U8(11), B(Star), R(20), B(CallRuntime), U16(Runtime::kNewTypeError), R(19), U8(2), B(Throw), B(Mov), R(context), R(19), - B(Mov), R(9), R(20), - B(Mov), R(4), R(21), + B(Mov), R(10), R(20), + B(Mov), R(5), R(21), B(InvokeIntrinsic), U8(Runtime::k_Call), R(20), U8(2), B(Star), R(21), - B(Mov), R(2), R(20), - B(Mov), R(11), R(22), + B(Mov), R(3), R(20), + B(Mov), R(0), R(22), B(CallJSRuntime), U8(%async_function_await_caught), R(20), U8(3), - B(SuspendGenerator), R(2), R(0), U8(20), U8(1), - B(ResumeGenerator), R(2), R(0), U8(20), + B(SuspendGenerator), R(3), R(0), U8(20), U8(1), + B(ResumeGenerator), R(3), R(0), U8(20), B(Star), R(20), - B(InvokeIntrinsic), U8(Runtime::k_GeneratorGetResumeMode), R(2), U8(1), + B(InvokeIntrinsic), U8(Runtime::k_GeneratorGetResumeMode), R(3), U8(1), B(Star), R(21), B(LdaZero), B(TestReferenceEqual), R(21), @@ -683,28 +683,28 @@ bytecodes: [ B(SetPendingMessage), B(Ldar), R(19), B(Jump), U8(65), - B(Mov), R(9), R(19), - B(Mov), R(4), R(20), + B(Mov), R(10), R(19), + B(Mov), R(5), R(20), B(InvokeIntrinsic), U8(Runtime::k_Call), R(19), U8(2), B(Star), R(20), - B(Mov), R(2), R(19), - B(Mov), R(11), R(21), + B(Mov), R(3), R(19), + B(Mov), R(0), R(21), B(CallJSRuntime), U8(%async_function_await_uncaught), R(19), U8(3), - B(SuspendGenerator), R(2), R(0), U8(19), U8(2), - B(ResumeGenerator), R(2), R(0), U8(19), + B(SuspendGenerator), R(3), R(0), U8(19), U8(2), + B(ResumeGenerator), R(3), R(0), U8(19), B(Star), R(19), - B(InvokeIntrinsic), U8(Runtime::k_GeneratorGetResumeMode), R(2), U8(1), + B(InvokeIntrinsic), U8(Runtime::k_GeneratorGetResumeMode), R(3), U8(1), B(Star), R(20), B(LdaZero), B(TestReferenceEqual), R(20), B(JumpIfTrue), U8(5), B(Ldar), R(19), B(ReThrow), - B(Mov), R(19), R(10), + B(Mov), R(19), R(11), B(InvokeIntrinsic), U8(Runtime::k_IsJSReceiver), R(19), U8(1), B(JumpIfToBooleanFalse), U8(4), B(Jump), U8(7), - B(CallRuntime), U16(Runtime::kThrowIteratorResultNotAnObject), R(10), U8(1), + B(CallRuntime), U16(Runtime::kThrowIteratorResultNotAnObject), R(11), U8(1), B(Ldar), R(18), B(SetPendingMessage), B(LdaZero), @@ -713,14 +713,11 @@ bytecodes: [ B(Ldar), R(17), B(ReThrow), B(LdaUndefined), - B(Star), R(17), - B(Mov), R(11), R(16), - B(InvokeIntrinsic), U8(Runtime::k_ResolvePromise), R(16), U8(2), + B(Star), R(13), B(LdaZero), B(Star), R(12), - B(Mov), R(11), R(13), - B(Jump), U8(55), - B(Jump), U8(39), + B(Jump), U8(56), + B(Jump), U8(40), B(Star), R(16), B(CreateCatchContext), R(16), U8(12), B(Star), R(15), @@ -732,32 +729,37 @@ bytecodes: [ B(Star), R(18), B(LdaFalse), B(Star), R(19), - B(Mov), R(11), R(17), + B(Mov), R(0), R(17), B(InvokeIntrinsic), U8(Runtime::k_RejectPromise), R(17), U8(3), B(PopContext), R(16), - B(LdaZero), + B(LdaSmi), I8(1), B(Star), R(12), - B(Mov), R(11), R(13), + B(Mov), R(0), R(13), B(Jump), U8(16), B(LdaSmi), I8(-1), B(Star), R(13), B(Star), R(12), B(Jump), U8(8), B(Star), R(13), - B(LdaSmi), I8(1), + B(LdaSmi), I8(2), B(Star), R(12), B(LdaTheHole), B(SetPendingMessage), B(Star), R(14), B(LdaTrue), B(Star), R(16), - B(Mov), R(11), R(15), + B(Mov), R(0), R(15), B(CallJSRuntime), U8(%async_function_promise_release), R(15), U8(2), B(Ldar), R(14), B(SetPendingMessage), B(Ldar), R(12), - B(SwitchOnSmiNoFeedback), U8(13), U8(2), I8(0), - B(Jump), U8(8), + B(SwitchOnSmiNoFeedback), U8(13), U8(3), I8(0), + B(Jump), U8(21), + B(Mov), R(0), R(15), + B(Mov), R(13), R(16), + B(InvokeIntrinsic), U8(Runtime::k_ResolvePromise), R(15), U8(2), + B(Ldar), R(0), + /* 114 S> */ B(Return), B(Ldar), R(13), /* 114 S> */ B(Return), B(Ldar), R(13), @@ -780,11 +782,12 @@ constant pool: [ ONE_BYTE_INTERNALIZED_STRING_TYPE [""], SCOPE_INFO_TYPE, Smi [6], - Smi [9], + Smi [19], + Smi [22], ] handlers: [ - [26, 485, 493], - [29, 446, 448], + [26, 476, 484], + [29, 436, 438], [35, 229, 237], [38, 192, 194], [297, 346, 348], @@ -800,17 +803,17 @@ snippet: " " frame size: 20 parameter count: 1 -bytecode array length: 403 +bytecode array length: 392 bytecodes: [ /* 16 E> */ B(StackCheck), B(CallJSRuntime), U8(%async_function_promise_create), R(0), U8(0), - B(Star), R(9), + B(Star), R(0), B(Mov), R(context), R(12), B(Mov), R(context), R(13), /* 31 S> */ B(CreateObjectLiteral), U8(0), U8(0), U8(41), R(14), - B(Mov), R(14), R(1), + B(Mov), R(14), R(2), B(LdaZero), - B(Star), R(5), + B(Star), R(6), B(Mov), R(context), R(16), B(Mov), R(context), R(17), /* 68 S> */ B(CreateArrayLiteral), U8(1), U8(1), U8(37), @@ -820,25 +823,25 @@ bytecodes: [ B(CallProperty0), R(19), R(18), U8(4), B(JumpIfJSReceiver), U8(7), B(CallRuntime), U16(Runtime::kThrowSymbolIteratorInvalid), R(0), U8(0), - B(Star), R(2), - /* 68 E> */ B(LdaNamedProperty), R(2), U8(3), U8(6), B(Star), R(3), - /* 59 S> */ B(CallProperty0), R(3), R(2), U8(8), + /* 68 E> */ B(LdaNamedProperty), R(3), U8(3), U8(6), B(Star), R(4), - /* 59 E> */ B(InvokeIntrinsic), U8(Runtime::k_IsJSReceiver), R(4), U8(1), + /* 59 S> */ B(CallProperty0), R(4), R(3), U8(8), + B(Star), R(5), + /* 59 E> */ B(InvokeIntrinsic), U8(Runtime::k_IsJSReceiver), R(5), U8(1), B(ToBooleanLogicalNot), B(JumpIfFalse), U8(7), - B(CallRuntime), U16(Runtime::kThrowIteratorResultNotAnObject), R(4), U8(1), - B(LdaNamedProperty), R(4), U8(4), U8(10), + B(CallRuntime), U16(Runtime::kThrowIteratorResultNotAnObject), R(5), U8(1), + B(LdaNamedProperty), R(5), U8(4), U8(10), B(JumpIfToBooleanTrue), U8(30), - /* 58 E> */ B(LdaNamedProperty), R(4), U8(5), U8(12), - B(Star), R(6), + /* 58 E> */ B(LdaNamedProperty), R(5), U8(5), U8(12), + B(Star), R(7), B(LdaSmi), I8(2), - B(Star), R(5), - B(Ldar), R(6), - B(StaNamedProperty), R(1), U8(6), U8(14), + B(Star), R(6), + B(Ldar), R(7), + B(StaNamedProperty), R(2), U8(6), U8(14), /* 53 E> */ B(StackCheck), - /* 87 S> */ B(LdaNamedProperty), R(1), U8(6), U8(16), + /* 87 S> */ B(LdaNamedProperty), R(2), U8(6), U8(16), B(Star), R(15), B(LdaZero), B(Star), R(14), @@ -852,10 +855,10 @@ bytecodes: [ B(Ldar), R(17), B(PushContext), R(18), B(LdaSmi), I8(2), - B(TestEqualStrict), R(5), U8(18), + B(TestEqualStrict), R(6), U8(18), B(JumpIfFalse), U8(6), B(LdaSmi), I8(1), - B(Star), R(5), + B(Star), R(6), B(LdaImmutableCurrentContextSlot), U8(4), B(Star), R(19), B(CallRuntime), U16(Runtime::kReThrow), R(19), U8(1), @@ -871,43 +874,43 @@ bytecodes: [ B(SetPendingMessage), B(Star), R(16), B(LdaZero), - B(TestEqualStrict), R(5), U8(19), + B(TestEqualStrict), R(6), U8(19), B(JumpIfTrue), U8(90), - B(LdaNamedProperty), R(2), U8(8), U8(20), - B(Star), R(7), + B(LdaNamedProperty), R(3), U8(8), U8(20), + B(Star), R(8), B(TestUndetectable), B(JumpIfFalse), U8(4), B(Jump), U8(79), B(LdaSmi), I8(1), - B(TestEqualStrict), R(5), U8(22), + B(TestEqualStrict), R(6), U8(22), B(JumpIfFalse), U8(47), - B(Ldar), R(7), + B(Ldar), R(8), B(TestTypeOf), U8(6), B(JumpIfFalse), U8(4), B(Jump), U8(18), - B(Wide), B(LdaSmi), I16(153), + B(Wide), B(LdaSmi), I16(154), B(Star), R(17), B(LdaConstant), U8(9), B(Star), R(18), B(CallRuntime), U16(Runtime::kNewTypeError), R(17), U8(2), B(Throw), B(Mov), R(context), R(17), - B(Mov), R(7), R(18), - B(Mov), R(2), R(19), + B(Mov), R(8), R(18), + B(Mov), R(3), R(19), B(InvokeIntrinsic), U8(Runtime::k_Call), R(18), U8(2), B(Jump), U8(6), B(LdaTheHole), B(SetPendingMessage), B(Ldar), R(17), B(Jump), U8(27), - B(Mov), R(7), R(17), - B(Mov), R(2), R(18), + B(Mov), R(8), R(17), + B(Mov), R(3), R(18), B(InvokeIntrinsic), U8(Runtime::k_Call), R(17), U8(2), - B(Star), R(8), - B(InvokeIntrinsic), U8(Runtime::k_IsJSReceiver), R(8), U8(1), + B(Star), R(9), + B(InvokeIntrinsic), U8(Runtime::k_IsJSReceiver), R(9), U8(1), B(JumpIfToBooleanFalse), U8(4), B(Jump), U8(7), - B(CallRuntime), U16(Runtime::kThrowIteratorResultNotAnObject), R(8), U8(1), + B(CallRuntime), U16(Runtime::kThrowIteratorResultNotAnObject), R(9), U8(1), B(Ldar), R(16), B(SetPendingMessage), B(Ldar), R(14), @@ -916,16 +919,13 @@ bytecodes: [ B(LdaZero), B(Star), R(10), B(Mov), R(15), R(11), - B(Jump), U8(78), + B(Jump), U8(67), B(Ldar), R(15), B(ReThrow), B(LdaUndefined), - B(Star), R(15), - B(Mov), R(9), R(14), - B(InvokeIntrinsic), U8(Runtime::k_ResolvePromise), R(14), U8(2), - B(LdaSmi), I8(1), + B(Star), R(11), + B(LdaZero), B(Star), R(10), - B(Mov), R(9), R(11), B(Jump), U8(56), B(Jump), U8(40), B(Star), R(14), @@ -939,12 +939,12 @@ bytecodes: [ B(Star), R(16), B(LdaFalse), B(Star), R(17), - B(Mov), R(9), R(15), + B(Mov), R(0), R(15), B(InvokeIntrinsic), U8(Runtime::k_RejectPromise), R(15), U8(3), B(PopContext), R(14), B(LdaSmi), I8(1), B(Star), R(10), - B(Mov), R(9), R(11), + B(Mov), R(0), R(11), B(Jump), U8(16), B(LdaSmi), I8(-1), B(Star), R(11), @@ -958,17 +958,17 @@ bytecodes: [ B(Star), R(12), B(LdaFalse), B(Star), R(14), - B(Mov), R(9), R(13), + B(Mov), R(0), R(13), B(CallJSRuntime), U8(%async_function_promise_release), R(13), U8(2), B(Ldar), R(12), B(SetPendingMessage), B(Ldar), R(10), B(SwitchOnSmiNoFeedback), U8(13), U8(3), I8(0), B(Jump), U8(21), - B(Mov), R(9), R(13), + B(Mov), R(0), R(13), B(Mov), R(11), R(14), B(InvokeIntrinsic), U8(Runtime::k_ResolvePromise), R(13), U8(2), - B(Ldar), R(9), + B(Ldar), R(0), /* 96 S> */ B(Return), B(Ldar), R(11), /* 96 S> */ B(Return), @@ -996,8 +996,8 @@ constant pool: [ Smi [22], ] handlers: [ - [10, 343, 351], - [13, 303, 305], + [10, 332, 340], + [13, 292, 294], [27, 150, 158], [30, 113, 115], [219, 229, 231], diff --git a/deps/v8/test/cctest/interpreter/bytecode_expectations/ForOf.golden b/deps/v8/test/cctest/interpreter/bytecode_expectations/ForOf.golden index bcb462bc75..b43429e008 100644 --- a/deps/v8/test/cctest/interpreter/bytecode_expectations/ForOf.golden +++ b/deps/v8/test/cctest/interpreter/bytecode_expectations/ForOf.golden @@ -85,7 +85,7 @@ bytecodes: [ B(TestTypeOf), U8(6), B(JumpIfFalse), U8(4), B(Jump), U8(18), - B(Wide), B(LdaSmi), I16(153), + B(Wide), B(LdaSmi), I16(154), B(Star), R(12), B(LdaConstant), U8(7), B(Star), R(13), @@ -217,7 +217,7 @@ bytecodes: [ B(TestTypeOf), U8(6), B(JumpIfFalse), U8(4), B(Jump), U8(18), - B(Wide), B(LdaSmi), I16(153), + B(Wide), B(LdaSmi), I16(154), B(Star), R(13), B(LdaConstant), U8(7), B(Star), R(14), @@ -361,7 +361,7 @@ bytecodes: [ B(TestTypeOf), U8(6), B(JumpIfFalse), U8(4), B(Jump), U8(18), - B(Wide), B(LdaSmi), I16(153), + B(Wide), B(LdaSmi), I16(154), B(Star), R(12), B(LdaConstant), U8(7), B(Star), R(13), @@ -495,7 +495,7 @@ bytecodes: [ B(TestTypeOf), U8(6), B(JumpIfFalse), U8(4), B(Jump), U8(18), - B(Wide), B(LdaSmi), I16(153), + B(Wide), B(LdaSmi), I16(154), B(Star), R(11), B(LdaConstant), U8(9), B(Star), R(12), diff --git a/deps/v8/test/cctest/interpreter/bytecode_expectations/ForOfLoop.golden b/deps/v8/test/cctest/interpreter/bytecode_expectations/ForOfLoop.golden index d4fe1a091c..9755e0af17 100644 --- a/deps/v8/test/cctest/interpreter/bytecode_expectations/ForOfLoop.golden +++ b/deps/v8/test/cctest/interpreter/bytecode_expectations/ForOfLoop.golden @@ -89,7 +89,7 @@ bytecodes: [ B(TestTypeOf), U8(6), B(JumpIfFalse), U8(4), B(Jump), U8(18), - B(Wide), B(LdaSmi), I16(153), + B(Wide), B(LdaSmi), I16(154), B(Star), R(14), B(LdaConstant), U8(6), B(Star), R(15), @@ -256,7 +256,7 @@ bytecodes: [ B(TestTypeOf), U8(6), B(JumpIfFalse), U8(4), B(Jump), U8(18), - B(Wide), B(LdaSmi), I16(153), + B(Wide), B(LdaSmi), I16(154), B(Star), R(14), B(LdaConstant), U8(11), B(Star), R(15), @@ -401,7 +401,7 @@ bytecodes: [ B(TestTypeOf), U8(6), B(JumpIfFalse), U8(4), B(Jump), U8(18), - B(Wide), B(LdaSmi), I16(153), + B(Wide), B(LdaSmi), I16(154), B(Star), R(12), B(LdaConstant), U8(8), B(Star), R(13), @@ -550,7 +550,7 @@ bytecodes: [ B(TestTypeOf), U8(6), B(JumpIfFalse), U8(4), B(Jump), U8(18), - B(Wide), B(LdaSmi), I16(153), + B(Wide), B(LdaSmi), I16(154), B(Star), R(17), B(LdaConstant), U8(8), B(Star), R(18), @@ -697,7 +697,7 @@ bytecodes: [ B(TestTypeOf), U8(6), B(JumpIfFalse), U8(4), B(Jump), U8(18), - B(Wide), B(LdaSmi), I16(153), + B(Wide), B(LdaSmi), I16(154), B(Star), R(15), B(LdaConstant), U8(9), B(Star), R(16), @@ -859,7 +859,7 @@ bytecodes: [ B(TestTypeOf), U8(6), B(JumpIfFalse), U8(4), B(Jump), U8(18), - B(Wide), B(LdaSmi), I16(153), + B(Wide), B(LdaSmi), I16(154), B(Star), R(14), B(LdaConstant), U8(12), B(Star), R(15), @@ -926,15 +926,15 @@ snippet: " " frame size: 23 parameter count: 2 -bytecode array length: 363 +bytecode array length: 367 bytecodes: [ /* 16 E> */ B(StackCheck), B(CallJSRuntime), U8(%async_function_promise_create), R(0), U8(0), - B(Star), R(12), + B(Star), R(0), B(Mov), R(context), R(15), B(Mov), R(context), R(16), B(LdaZero), - B(Star), R(8), + B(Star), R(9), B(Mov), R(context), R(19), B(Mov), R(context), R(20), /* 40 S> */ B(LdaNamedProperty), R(arg0), U8(0), U8(0), @@ -943,27 +943,27 @@ bytecodes: [ B(Mov), R(arg0), R(21), B(JumpIfJSReceiver), U8(7), B(CallRuntime), U16(Runtime::kThrowSymbolIteratorInvalid), R(0), U8(0), - B(Star), R(5), - /* 40 E> */ B(LdaNamedProperty), R(5), U8(1), U8(4), B(Star), R(6), - /* 35 S> */ B(CallProperty0), R(6), R(5), U8(6), + /* 40 E> */ B(LdaNamedProperty), R(6), U8(1), U8(4), B(Star), R(7), - /* 35 E> */ B(InvokeIntrinsic), U8(Runtime::k_IsJSReceiver), R(7), U8(1), + /* 35 S> */ B(CallProperty0), R(7), R(6), U8(6), + B(Star), R(8), + /* 35 E> */ B(InvokeIntrinsic), U8(Runtime::k_IsJSReceiver), R(8), U8(1), B(ToBooleanLogicalNot), B(JumpIfFalse), U8(7), - B(CallRuntime), U16(Runtime::kThrowIteratorResultNotAnObject), R(7), U8(1), - B(LdaNamedProperty), R(7), U8(2), U8(8), + B(CallRuntime), U16(Runtime::kThrowIteratorResultNotAnObject), R(8), U8(1), + B(LdaNamedProperty), R(8), U8(2), U8(8), B(JumpIfToBooleanTrue), U8(28), - B(LdaNamedProperty), R(7), U8(3), U8(10), - B(Star), R(9), + B(LdaNamedProperty), R(8), U8(3), U8(10), + B(Star), R(10), B(LdaSmi), I8(2), - B(Star), R(8), - B(Mov), R(9), R(4), + B(Star), R(9), + B(Mov), R(10), R(5), /* 26 E> */ B(StackCheck), - B(Mov), R(4), R(1), - /* 55 S> */ B(Mov), R(1), R(0), + B(Mov), R(5), R(2), + /* 55 S> */ B(Mov), R(2), R(1), B(LdaZero), - B(Star), R(8), + B(Star), R(9), B(JumpLoop), U8(47), I8(0), B(Jump), U8(37), B(Star), R(21), @@ -974,10 +974,10 @@ bytecodes: [ B(Ldar), R(20), B(PushContext), R(21), B(LdaSmi), I8(2), - B(TestEqualStrict), R(8), U8(12), + B(TestEqualStrict), R(9), U8(12), B(JumpIfFalse), U8(6), B(LdaSmi), I8(1), - B(Star), R(8), + B(Star), R(9), B(LdaImmutableCurrentContextSlot), U8(4), B(Star), R(22), B(CallRuntime), U16(Runtime::kReThrow), R(22), U8(1), @@ -993,43 +993,43 @@ bytecodes: [ B(SetPendingMessage), B(Star), R(19), B(LdaZero), - B(TestEqualStrict), R(8), U8(13), + B(TestEqualStrict), R(9), U8(13), B(JumpIfTrue), U8(90), - B(LdaNamedProperty), R(5), U8(5), U8(14), - B(Star), R(10), + B(LdaNamedProperty), R(6), U8(5), U8(14), + B(Star), R(11), B(TestUndetectable), B(JumpIfFalse), U8(4), B(Jump), U8(79), B(LdaSmi), I8(1), - B(TestEqualStrict), R(8), U8(16), + B(TestEqualStrict), R(9), U8(16), B(JumpIfFalse), U8(47), - B(Ldar), R(10), + B(Ldar), R(11), B(TestTypeOf), U8(6), B(JumpIfFalse), U8(4), B(Jump), U8(18), - B(Wide), B(LdaSmi), I16(153), + B(Wide), B(LdaSmi), I16(154), B(Star), R(20), B(LdaConstant), U8(6), B(Star), R(21), B(CallRuntime), U16(Runtime::kNewTypeError), R(20), U8(2), B(Throw), B(Mov), R(context), R(20), - B(Mov), R(10), R(21), - B(Mov), R(5), R(22), + B(Mov), R(11), R(21), + B(Mov), R(6), R(22), B(InvokeIntrinsic), U8(Runtime::k_Call), R(21), U8(2), B(Jump), U8(6), B(LdaTheHole), B(SetPendingMessage), B(Ldar), R(20), B(Jump), U8(27), - B(Mov), R(10), R(20), - B(Mov), R(5), R(21), + B(Mov), R(11), R(20), + B(Mov), R(6), R(21), B(InvokeIntrinsic), U8(Runtime::k_Call), R(20), U8(2), - B(Star), R(11), - B(InvokeIntrinsic), U8(Runtime::k_IsJSReceiver), R(11), U8(1), + B(Star), R(12), + B(InvokeIntrinsic), U8(Runtime::k_IsJSReceiver), R(12), U8(1), B(JumpIfToBooleanFalse), U8(4), B(Jump), U8(7), - B(CallRuntime), U16(Runtime::kThrowIteratorResultNotAnObject), R(11), U8(1), + B(CallRuntime), U16(Runtime::kThrowIteratorResultNotAnObject), R(12), U8(1), B(Ldar), R(19), B(SetPendingMessage), B(LdaZero), @@ -1038,14 +1038,11 @@ bytecodes: [ B(Ldar), R(18), B(ReThrow), B(LdaUndefined), - B(Star), R(18), - B(Mov), R(12), R(17), - B(InvokeIntrinsic), U8(Runtime::k_ResolvePromise), R(17), U8(2), + B(Star), R(14), B(LdaZero), B(Star), R(13), - B(Mov), R(12), R(14), - B(Jump), U8(55), - B(Jump), U8(39), + B(Jump), U8(56), + B(Jump), U8(40), B(Star), R(17), B(CreateCatchContext), R(17), U8(7), B(Star), R(16), @@ -1057,32 +1054,37 @@ bytecodes: [ B(Star), R(19), B(LdaFalse), B(Star), R(20), - B(Mov), R(12), R(18), + B(Mov), R(0), R(18), B(InvokeIntrinsic), U8(Runtime::k_RejectPromise), R(18), U8(3), B(PopContext), R(17), - B(LdaZero), + B(LdaSmi), I8(1), B(Star), R(13), - B(Mov), R(12), R(14), + B(Mov), R(0), R(14), B(Jump), U8(16), B(LdaSmi), I8(-1), B(Star), R(14), B(Star), R(13), B(Jump), U8(8), B(Star), R(14), - B(LdaSmi), I8(1), + B(LdaSmi), I8(2), B(Star), R(13), B(LdaTheHole), B(SetPendingMessage), B(Star), R(15), B(LdaFalse), B(Star), R(17), - B(Mov), R(12), R(16), + B(Mov), R(0), R(16), B(CallJSRuntime), U8(%async_function_promise_release), R(16), U8(2), B(Ldar), R(15), B(SetPendingMessage), B(Ldar), R(13), - B(SwitchOnSmiNoFeedback), U8(8), U8(2), I8(0), - B(Jump), U8(8), + B(SwitchOnSmiNoFeedback), U8(8), U8(3), I8(0), + B(Jump), U8(21), + B(Mov), R(0), R(16), + B(Mov), R(14), R(17), + B(InvokeIntrinsic), U8(Runtime::k_ResolvePromise), R(16), U8(2), + B(Ldar), R(0), + /* 60 S> */ B(Return), B(Ldar), R(14), /* 60 S> */ B(Return), B(Ldar), R(14), @@ -1100,11 +1102,12 @@ constant pool: [ ONE_BYTE_INTERNALIZED_STRING_TYPE [""], SCOPE_INFO_TYPE, Smi [6], - Smi [9], + Smi [19], + Smi [22], ] handlers: [ - [10, 316, 324], - [13, 277, 279], + [10, 307, 315], + [13, 267, 269], [19, 137, 145], [22, 100, 102], [205, 215, 217], @@ -1119,20 +1122,20 @@ snippet: " " frame size: 23 parameter count: 2 -bytecode array length: 414 +bytecode array length: 418 bytecodes: [ - B(SwitchOnGeneratorState), R(2), U8(0), U8(1), + B(SwitchOnGeneratorState), R(3), U8(0), U8(1), B(Mov), R(closure), R(12), B(Mov), R(this), R(13), B(InvokeIntrinsic), U8(Runtime::k_CreateJSGeneratorObject), R(12), U8(2), - B(Star), R(2), + B(Star), R(3), /* 16 E> */ B(StackCheck), B(CallJSRuntime), U8(%async_function_promise_create), R(0), U8(0), - B(Star), R(11), + B(Star), R(0), B(Mov), R(context), R(14), B(Mov), R(context), R(15), B(LdaZero), - B(Star), R(7), + B(Star), R(8), B(Mov), R(context), R(18), B(Mov), R(context), R(19), /* 40 S> */ B(LdaNamedProperty), R(arg0), U8(1), U8(0), @@ -1141,32 +1144,32 @@ bytecodes: [ B(Mov), R(arg0), R(20), B(JumpIfJSReceiver), U8(7), B(CallRuntime), U16(Runtime::kThrowSymbolIteratorInvalid), R(0), U8(0), - B(Star), R(4), - /* 40 E> */ B(LdaNamedProperty), R(4), U8(2), U8(4), B(Star), R(5), - /* 35 S> */ B(CallProperty0), R(5), R(4), U8(6), + /* 40 E> */ B(LdaNamedProperty), R(5), U8(2), U8(4), B(Star), R(6), - /* 35 E> */ B(InvokeIntrinsic), U8(Runtime::k_IsJSReceiver), R(6), U8(1), + /* 35 S> */ B(CallProperty0), R(6), R(5), U8(6), + B(Star), R(7), + /* 35 E> */ B(InvokeIntrinsic), U8(Runtime::k_IsJSReceiver), R(7), U8(1), B(ToBooleanLogicalNot), B(JumpIfFalse), U8(7), - B(CallRuntime), U16(Runtime::kThrowIteratorResultNotAnObject), R(6), U8(1), - B(LdaNamedProperty), R(6), U8(3), U8(8), + B(CallRuntime), U16(Runtime::kThrowIteratorResultNotAnObject), R(7), U8(1), + B(LdaNamedProperty), R(7), U8(3), U8(8), B(JumpIfToBooleanTrue), U8(63), - B(LdaNamedProperty), R(6), U8(4), U8(10), - B(Star), R(8), + B(LdaNamedProperty), R(7), U8(4), U8(10), + B(Star), R(9), B(LdaSmi), I8(2), - B(Star), R(7), - B(Mov), R(8), R(3), + B(Star), R(8), + B(Mov), R(9), R(4), /* 26 E> */ B(StackCheck), - B(Mov), R(3), R(0), - /* 45 S> */ B(Mov), R(2), R(20), - B(Mov), R(0), R(21), - B(Mov), R(11), R(22), + B(Mov), R(4), R(1), + /* 45 S> */ B(Mov), R(3), R(20), + B(Mov), R(1), R(21), + B(Mov), R(0), R(22), B(CallJSRuntime), U8(%async_function_await_uncaught), R(20), U8(3), - /* 45 E> */ B(SuspendGenerator), R(2), R(0), U8(20), U8(0), - B(ResumeGenerator), R(2), R(0), U8(20), + /* 45 E> */ B(SuspendGenerator), R(3), R(0), U8(20), U8(0), + B(ResumeGenerator), R(3), R(0), U8(20), B(Star), R(20), - B(InvokeIntrinsic), U8(Runtime::k_GeneratorGetResumeMode), R(2), U8(1), + B(InvokeIntrinsic), U8(Runtime::k_GeneratorGetResumeMode), R(3), U8(1), B(Star), R(21), B(LdaZero), B(TestReferenceEqual), R(21), @@ -1174,7 +1177,7 @@ bytecodes: [ B(Ldar), R(20), B(ReThrow), B(LdaZero), - B(Star), R(7), + B(Star), R(8), B(JumpLoop), U8(82), I8(0), B(Jump), U8(37), B(Star), R(20), @@ -1185,10 +1188,10 @@ bytecodes: [ B(Ldar), R(19), B(PushContext), R(20), B(LdaSmi), I8(2), - B(TestEqualStrict), R(7), U8(12), + B(TestEqualStrict), R(8), U8(12), B(JumpIfFalse), U8(6), B(LdaSmi), I8(1), - B(Star), R(7), + B(Star), R(8), B(LdaImmutableCurrentContextSlot), U8(4), B(Star), R(21), B(CallRuntime), U16(Runtime::kReThrow), R(21), U8(1), @@ -1204,43 +1207,43 @@ bytecodes: [ B(SetPendingMessage), B(Star), R(18), B(LdaZero), - B(TestEqualStrict), R(7), U8(13), + B(TestEqualStrict), R(8), U8(13), B(JumpIfTrue), U8(90), - B(LdaNamedProperty), R(4), U8(6), U8(14), - B(Star), R(9), + B(LdaNamedProperty), R(5), U8(6), U8(14), + B(Star), R(10), B(TestUndetectable), B(JumpIfFalse), U8(4), B(Jump), U8(79), B(LdaSmi), I8(1), - B(TestEqualStrict), R(7), U8(16), + B(TestEqualStrict), R(8), U8(16), B(JumpIfFalse), U8(47), - B(Ldar), R(9), + B(Ldar), R(10), B(TestTypeOf), U8(6), B(JumpIfFalse), U8(4), B(Jump), U8(18), - B(Wide), B(LdaSmi), I16(153), + B(Wide), B(LdaSmi), I16(154), B(Star), R(19), B(LdaConstant), U8(7), B(Star), R(20), B(CallRuntime), U16(Runtime::kNewTypeError), R(19), U8(2), B(Throw), B(Mov), R(context), R(19), - B(Mov), R(9), R(20), - B(Mov), R(4), R(21), + B(Mov), R(10), R(20), + B(Mov), R(5), R(21), B(InvokeIntrinsic), U8(Runtime::k_Call), R(20), U8(2), B(Jump), U8(6), B(LdaTheHole), B(SetPendingMessage), B(Ldar), R(19), B(Jump), U8(27), - B(Mov), R(9), R(19), - B(Mov), R(4), R(20), + B(Mov), R(10), R(19), + B(Mov), R(5), R(20), B(InvokeIntrinsic), U8(Runtime::k_Call), R(19), U8(2), - B(Star), R(10), - B(InvokeIntrinsic), U8(Runtime::k_IsJSReceiver), R(10), U8(1), + B(Star), R(11), + B(InvokeIntrinsic), U8(Runtime::k_IsJSReceiver), R(11), U8(1), B(JumpIfToBooleanFalse), U8(4), B(Jump), U8(7), - B(CallRuntime), U16(Runtime::kThrowIteratorResultNotAnObject), R(10), U8(1), + B(CallRuntime), U16(Runtime::kThrowIteratorResultNotAnObject), R(11), U8(1), B(Ldar), R(18), B(SetPendingMessage), B(LdaZero), @@ -1249,14 +1252,11 @@ bytecodes: [ B(Ldar), R(17), B(ReThrow), B(LdaUndefined), - B(Star), R(17), - B(Mov), R(11), R(16), - B(InvokeIntrinsic), U8(Runtime::k_ResolvePromise), R(16), U8(2), + B(Star), R(13), B(LdaZero), B(Star), R(12), - B(Mov), R(11), R(13), - B(Jump), U8(55), - B(Jump), U8(39), + B(Jump), U8(56), + B(Jump), U8(40), B(Star), R(16), B(CreateCatchContext), R(16), U8(8), B(Star), R(15), @@ -1268,32 +1268,37 @@ bytecodes: [ B(Star), R(18), B(LdaFalse), B(Star), R(19), - B(Mov), R(11), R(17), + B(Mov), R(0), R(17), B(InvokeIntrinsic), U8(Runtime::k_RejectPromise), R(17), U8(3), B(PopContext), R(16), - B(LdaZero), + B(LdaSmi), I8(1), B(Star), R(12), - B(Mov), R(11), R(13), + B(Mov), R(0), R(13), B(Jump), U8(16), B(LdaSmi), I8(-1), B(Star), R(13), B(Star), R(12), B(Jump), U8(8), B(Star), R(13), - B(LdaSmi), I8(1), + B(LdaSmi), I8(2), B(Star), R(12), B(LdaTheHole), B(SetPendingMessage), B(Star), R(14), B(LdaTrue), B(Star), R(16), - B(Mov), R(11), R(15), + B(Mov), R(0), R(15), B(CallJSRuntime), U8(%async_function_promise_release), R(15), U8(2), B(Ldar), R(14), B(SetPendingMessage), B(Ldar), R(12), - B(SwitchOnSmiNoFeedback), U8(9), U8(2), I8(0), - B(Jump), U8(8), + B(SwitchOnSmiNoFeedback), U8(9), U8(3), I8(0), + B(Jump), U8(21), + B(Mov), R(0), R(15), + B(Mov), R(13), R(16), + B(InvokeIntrinsic), U8(Runtime::k_ResolvePromise), R(15), U8(2), + B(Ldar), R(0), + /* 54 S> */ B(Return), B(Ldar), R(13), /* 54 S> */ B(Return), B(Ldar), R(13), @@ -1312,11 +1317,12 @@ constant pool: [ ONE_BYTE_INTERNALIZED_STRING_TYPE [""], SCOPE_INFO_TYPE, Smi [6], - Smi [9], + Smi [19], + Smi [22], ] handlers: [ - [26, 367, 375], - [29, 328, 330], + [26, 358, 366], + [29, 318, 320], [35, 188, 196], [38, 151, 153], [256, 266, 268], diff --git a/deps/v8/test/cctest/interpreter/bytecode_expectations/Generators.golden b/deps/v8/test/cctest/interpreter/bytecode_expectations/Generators.golden index 641a2b2eb0..df054bd5b2 100644 --- a/deps/v8/test/cctest/interpreter/bytecode_expectations/Generators.golden +++ b/deps/v8/test/cctest/interpreter/bytecode_expectations/Generators.golden @@ -203,7 +203,7 @@ bytecodes: [ B(TestTypeOf), U8(6), B(JumpIfFalse), U8(4), B(Jump), U8(18), - B(Wide), B(LdaSmi), I16(153), + B(Wide), B(LdaSmi), I16(154), B(Star), R(14), B(LdaConstant), U8(13), B(Star), R(15), diff --git a/deps/v8/test/cctest/interpreter/bytecode_expectations/IIFEWithOneshotOpt.golden b/deps/v8/test/cctest/interpreter/bytecode_expectations/IIFEWithOneshotOpt.golden index f2653a6ed1..a9f03b2c28 100644 --- a/deps/v8/test/cctest/interpreter/bytecode_expectations/IIFEWithOneshotOpt.golden +++ b/deps/v8/test/cctest/interpreter/bytecode_expectations/IIFEWithOneshotOpt.golden @@ -19,9 +19,9 @@ snippet: " })(); " -frame size: 6 +frame size: 3 parameter count: 1 -bytecode array length: 82 +bytecode array length: 40 bytecodes: [ B(CreateMappedArguments), B(Star), R(0), @@ -31,32 +31,14 @@ bytecodes: [ /* 45 S> */ B(LdaGlobal), U8(0), U8(2), B(Star), R(1), B(LdaSmi), I8(2), - B(Star), R(4), - B(LdaConstant), U8(1), - B(Star), R(3), - B(LdaZero), - B(Star), R(5), - B(Mov), R(1), R(2), - /* 50 E> */ B(CallRuntime), U16(Runtime::kSetProperty), R(2), U8(4), + /* 50 E> */ B(StaNamedPropertyNoFeedback), R(1), U8(1), U8(0), /* 63 S> */ B(LdaGlobal), U8(0), U8(2), B(Star), R(1), /* 70 E> */ B(LdaGlobal), U8(0), U8(2), B(Star), R(2), - B(LdaConstant), U8(1), - B(Star), R(4), - B(Mov), R(2), R(3), - /* 72 E> */ B(InvokeIntrinsic), U8(Runtime::k_GetProperty), R(3), U8(2), - B(Star), R(4), - B(LdaConstant), U8(2), - B(Star), R(3), - B(LdaZero), - B(Star), R(5), - B(Mov), R(1), R(2), - /* 68 E> */ B(CallRuntime), U16(Runtime::kSetProperty), R(2), U8(4), - /* 84 S> */ B(LdaConstant), U8(3), - B(Star), R(3), - B(Mov), R(0), R(2), - /* 101 E> */ B(InvokeIntrinsic), U8(Runtime::k_GetProperty), R(2), U8(2), + /* 72 E> */ B(LdaNamedPropertyNoFeedback), R(2), U8(1), + /* 68 E> */ B(StaNamedPropertyNoFeedback), R(1), U8(2), U8(0), + /* 101 S> */ B(LdaNamedPropertyNoFeedback), R(0), U8(3), /* 108 S> */ B(Return), ] constant pool: [ @@ -81,9 +63,9 @@ snippet: " })(); " -frame size: 4 +frame size: 3 parameter count: 1 -bytecode array length: 77 +bytecode array length: 69 bytecodes: [ B(CreateMappedArguments), B(Star), R(0), @@ -112,10 +94,7 @@ bytecodes: [ B(Inc), U8(15), /* 66 E> */ B(StaGlobal), U8(1), U8(2), B(JumpLoop), U8(50), I8(0), - /* 132 S> */ B(LdaConstant), U8(4), - B(Star), R(3), - B(Mov), R(0), R(2), - /* 149 E> */ B(InvokeIntrinsic), U8(Runtime::k_GetProperty), R(2), U8(2), + /* 149 S> */ B(LdaNamedPropertyNoFeedback), R(0), U8(4), /* 156 S> */ B(Return), ] constant pool: [ @@ -143,9 +122,9 @@ snippet: " })(); " -frame size: 4 +frame size: 3 parameter count: 1 -bytecode array length: 78 +bytecode array length: 70 bytecodes: [ B(CreateMappedArguments), B(Star), R(0), @@ -174,10 +153,7 @@ bytecodes: [ B(Dec), U8(15), /* 129 E> */ B(StaGlobal), U8(1), U8(2), B(JumpLoop), U8(50), I8(0), - /* 151 S> */ B(LdaConstant), U8(4), - B(Star), R(3), - B(Mov), R(0), R(2), - /* 168 E> */ B(InvokeIntrinsic), U8(Runtime::k_GetProperty), R(2), U8(2), + /* 168 S> */ B(LdaNamedPropertyNoFeedback), R(0), U8(4), /* 175 S> */ B(Return), ] constant pool: [ @@ -205,9 +181,9 @@ snippet: " })(); " -frame size: 4 +frame size: 3 parameter count: 1 -bytecode array length: 78 +bytecode array length: 70 bytecodes: [ B(CreateMappedArguments), B(Star), R(0), @@ -236,10 +212,7 @@ bytecodes: [ /* 141 E> */ B(TestGreaterThan), R(1), U8(15), B(JumpIfFalse), U8(5), B(JumpLoop), U8(50), I8(0), - /* 154 S> */ B(LdaConstant), U8(4), - B(Star), R(3), - B(Mov), R(0), R(2), - /* 171 E> */ B(InvokeIntrinsic), U8(Runtime::k_GetProperty), R(2), U8(2), + /* 171 S> */ B(LdaNamedPropertyNoFeedback), R(0), U8(4), /* 178 S> */ B(Return), ] constant pool: [ @@ -269,9 +242,9 @@ snippet: " })(); " -frame size: 6 +frame size: 4 parameter count: 1 -bytecode array length: 121 +bytecode array length: 71 bytecodes: [ B(CreateMappedArguments), B(Star), R(0), @@ -284,44 +257,23 @@ bytecodes: [ /* 31 E> */ B(StaGlobal), U8(1), U8(0), /* 95 S> */ B(LdaGlobal), U8(1), U8(2), B(Star), R(1), - B(LdaConstant), U8(2), - B(Star), R(3), - B(Mov), R(1), R(2), - /* 101 E> */ B(InvokeIntrinsic), U8(Runtime::k_GetProperty), R(2), U8(2), + /* 101 E> */ B(LdaNamedPropertyNoFeedback), R(1), U8(2), B(Star), R(1), B(LdaSmi), I8(3), /* 104 E> */ B(TestLessThan), R(1), U8(4), - B(JumpIfFalse), U8(28), + B(JumpIfFalse), U8(15), /* 121 S> */ B(LdaGlobal), U8(1), U8(2), B(Star), R(1), B(LdaSmi), I8(3), - B(Star), R(4), - B(LdaConstant), U8(2), - B(Star), R(3), - B(LdaZero), - B(Star), R(5), - B(Mov), R(1), R(2), - /* 126 E> */ B(CallRuntime), U16(Runtime::kSetProperty), R(2), U8(4), - B(Jump), U8(40), + /* 126 E> */ B(StaNamedPropertyNoFeedback), R(1), U8(2), U8(0), + B(Jump), U8(19), /* 158 S> */ B(LdaGlobal), U8(1), U8(2), B(Star), R(1), /* 165 E> */ B(LdaGlobal), U8(1), U8(2), B(Star), R(2), - B(LdaConstant), U8(3), - B(Star), R(4), - B(Mov), R(2), R(3), - /* 167 E> */ B(InvokeIntrinsic), U8(Runtime::k_GetProperty), R(3), U8(2), - B(Star), R(4), - B(LdaConstant), U8(2), - B(Star), R(3), - B(LdaZero), - B(Star), R(5), - B(Mov), R(1), R(2), - /* 163 E> */ B(CallRuntime), U16(Runtime::kSetProperty), R(2), U8(4), - /* 189 S> */ B(LdaConstant), U8(4), - B(Star), R(3), - B(Mov), R(0), R(2), - /* 206 E> */ B(InvokeIntrinsic), U8(Runtime::k_GetProperty), R(2), U8(2), + /* 167 E> */ B(LdaNamedPropertyNoFeedback), R(2), U8(3), + /* 163 E> */ B(StaNamedPropertyNoFeedback), R(1), U8(2), U8(0), + /* 206 S> */ B(LdaNamedPropertyNoFeedback), R(0), U8(4), /* 213 S> */ B(Return), ] constant pool: [ @@ -343,23 +295,20 @@ snippet: " })(); " -frame size: 4 +frame size: 5 parameter count: 1 -bytecode array length: 32 +bytecode array length: 24 bytecodes: [ B(CreateMappedArguments), B(Star), R(0), /* 16 E> */ B(StackCheck), /* 29 S> */ B(LdaConstant), U8(0), - B(Star), R(1), + B(Star), R(3), B(LdaSmi), I8(4), - B(Star), R(2), - B(CallRuntime), U16(Runtime::kCreateArrayLiteralWithoutAllocationSite), R(1), U8(2), + B(Star), R(4), + B(CallRuntime), U16(Runtime::kCreateArrayLiteralWithoutAllocationSite), R(3), U8(2), /* 31 E> */ B(StaGlobal), U8(1), U8(0), - /* 60 S> */ B(LdaConstant), U8(2), - B(Star), R(3), - B(Mov), R(0), R(2), - /* 77 E> */ B(InvokeIntrinsic), U8(Runtime::k_GetProperty), R(2), U8(2), + /* 77 S> */ B(LdaNamedPropertyNoFeedback), R(0), U8(2), /* 84 S> */ B(Return), ] constant pool: [ @@ -379,23 +328,20 @@ snippet: " })(); " -frame size: 4 +frame size: 5 parameter count: 1 -bytecode array length: 32 +bytecode array length: 24 bytecodes: [ B(CreateMappedArguments), B(Star), R(0), /* 16 E> */ B(StackCheck), /* 29 S> */ B(LdaConstant), U8(0), - B(Star), R(1), + B(Star), R(3), B(LdaSmi), I8(37), - B(Star), R(2), - B(CallRuntime), U16(Runtime::kCreateArrayLiteralWithoutAllocationSite), R(1), U8(2), + B(Star), R(4), + B(CallRuntime), U16(Runtime::kCreateArrayLiteralWithoutAllocationSite), R(3), U8(2), /* 31 E> */ B(StaGlobal), U8(1), U8(0), - /* 45 S> */ B(LdaConstant), U8(2), - B(Star), R(3), - B(Mov), R(0), R(2), - /* 62 E> */ B(InvokeIntrinsic), U8(Runtime::k_GetProperty), R(2), U8(2), + /* 62 S> */ B(LdaNamedPropertyNoFeedback), R(0), U8(2), /* 69 S> */ B(Return), ] constant pool: [ @@ -406,3 +352,300 @@ constant pool: [ handlers: [ ] +--- +snippet: " + + this.f0 = function() {}; + this.f1 = function(a) {}; + this.f2 = function(a, b) {}; + this.f3 = function(a, b, c) {}; + this.f4 = function(a, b, c, d) {}; + this.f5 = function(a, b, c, d, e) {}; + (function() { + this.f0(); + this.f1(1); + this.f2(1, 2); + this.f3(1, 2, 3); + this.f4(1, 2, 3, 4); + this.f5(1, 2, 3, 4, 5); + return arguments.callee; + })(); + +" +frame size: 8 +parameter count: 1 +bytecode array length: 137 +bytecodes: [ + B(CreateMappedArguments), + B(Star), R(0), + /* 237 E> */ B(StackCheck), + /* 255 S> */ B(LdaNamedPropertyNoFeedback), R(this), U8(0), + B(Star), R(1), + /* 255 E> */ B(CallNoFeedback), R(1), R(this), U8(1), + /* 274 S> */ B(LdaNamedPropertyNoFeedback), R(this), U8(1), + B(Star), R(1), + B(LdaSmi), I8(1), + B(Star), R(3), + B(Mov), R(this), R(2), + /* 274 E> */ B(CallNoFeedback), R(1), R(2), U8(2), + /* 294 S> */ B(LdaNamedPropertyNoFeedback), R(this), U8(2), + B(Star), R(1), + B(LdaSmi), I8(1), + B(Star), R(3), + B(LdaSmi), I8(2), + B(Star), R(4), + B(Mov), R(this), R(2), + /* 294 E> */ B(CallNoFeedback), R(1), R(2), U8(3), + /* 317 S> */ B(LdaNamedPropertyNoFeedback), R(this), U8(3), + B(Star), R(1), + B(LdaSmi), I8(1), + B(Star), R(3), + B(LdaSmi), I8(2), + B(Star), R(4), + B(LdaSmi), I8(3), + B(Star), R(5), + B(Mov), R(this), R(2), + /* 317 E> */ B(CallNoFeedback), R(1), R(2), U8(4), + /* 343 S> */ B(LdaNamedPropertyNoFeedback), R(this), U8(4), + B(Star), R(1), + B(LdaSmi), I8(1), + B(Star), R(3), + B(LdaSmi), I8(2), + B(Star), R(4), + B(LdaSmi), I8(3), + B(Star), R(5), + B(LdaSmi), I8(4), + B(Star), R(6), + B(Mov), R(this), R(2), + /* 343 E> */ B(CallNoFeedback), R(1), R(2), U8(5), + /* 372 S> */ B(LdaNamedPropertyNoFeedback), R(this), U8(5), + B(Star), R(1), + B(LdaSmi), I8(1), + B(Star), R(3), + B(LdaSmi), I8(2), + B(Star), R(4), + B(LdaSmi), I8(3), + B(Star), R(5), + B(LdaSmi), I8(4), + B(Star), R(6), + B(LdaSmi), I8(5), + B(Star), R(7), + B(Mov), R(this), R(2), + /* 372 E> */ B(CallNoFeedback), R(1), R(2), U8(6), + /* 416 S> */ B(LdaNamedPropertyNoFeedback), R(0), U8(6), + /* 423 S> */ B(Return), +] +constant pool: [ + ONE_BYTE_INTERNALIZED_STRING_TYPE ["f0"], + ONE_BYTE_INTERNALIZED_STRING_TYPE ["f1"], + ONE_BYTE_INTERNALIZED_STRING_TYPE ["f2"], + ONE_BYTE_INTERNALIZED_STRING_TYPE ["f3"], + ONE_BYTE_INTERNALIZED_STRING_TYPE ["f4"], + ONE_BYTE_INTERNALIZED_STRING_TYPE ["f5"], + ONE_BYTE_INTERNALIZED_STRING_TYPE ["callee"], +] +handlers: [ +] + +--- +snippet: " + + function f0() {} + function f1(a) {} + function f2(a, b) {} + function f3(a, b, c) {} + function f4(a, b, c, d) {} + function f5(a, b, c, d, e) {} + (function() { + f0(); + f1(1); + f2(1, 2); + f3(1, 2, 3); + f4(1, 2, 3, 4); + f5(1, 2, 3, 4, 5); + return arguments.callee; + })(); + +" +frame size: 8 +parameter count: 1 +bytecode array length: 140 +bytecodes: [ + B(CreateMappedArguments), + B(Star), R(0), + /* 189 E> */ B(StackCheck), + /* 202 S> */ B(LdaUndefined), + B(Star), R(2), + B(LdaGlobal), U8(0), U8(0), + B(Star), R(1), + /* 202 E> */ B(CallNoFeedback), R(1), R(2), U8(1), + /* 216 S> */ B(LdaUndefined), + B(Star), R(2), + B(LdaGlobal), U8(1), U8(2), + B(Star), R(1), + B(LdaSmi), I8(1), + B(Star), R(3), + /* 216 E> */ B(CallNoFeedback), R(1), R(2), U8(2), + /* 231 S> */ B(LdaUndefined), + B(Star), R(2), + B(LdaGlobal), U8(2), U8(4), + B(Star), R(1), + B(LdaSmi), I8(1), + B(Star), R(3), + B(LdaSmi), I8(2), + B(Star), R(4), + /* 231 E> */ B(CallNoFeedback), R(1), R(2), U8(3), + /* 249 S> */ B(LdaUndefined), + B(Star), R(2), + B(LdaGlobal), U8(3), U8(6), + B(Star), R(1), + B(LdaSmi), I8(1), + B(Star), R(3), + B(LdaSmi), I8(2), + B(Star), R(4), + B(LdaSmi), I8(3), + B(Star), R(5), + /* 249 E> */ B(CallNoFeedback), R(1), R(2), U8(4), + /* 270 S> */ B(LdaUndefined), + B(Star), R(2), + B(LdaGlobal), U8(4), U8(8), + B(Star), R(1), + B(LdaSmi), I8(1), + B(Star), R(3), + B(LdaSmi), I8(2), + B(Star), R(4), + B(LdaSmi), I8(3), + B(Star), R(5), + B(LdaSmi), I8(4), + B(Star), R(6), + /* 270 E> */ B(CallNoFeedback), R(1), R(2), U8(5), + /* 294 S> */ B(LdaUndefined), + B(Star), R(2), + B(LdaGlobal), U8(5), U8(10), + B(Star), R(1), + B(LdaSmi), I8(1), + B(Star), R(3), + B(LdaSmi), I8(2), + B(Star), R(4), + B(LdaSmi), I8(3), + B(Star), R(5), + B(LdaSmi), I8(4), + B(Star), R(6), + B(LdaSmi), I8(5), + B(Star), R(7), + /* 294 E> */ B(CallNoFeedback), R(1), R(2), U8(6), + /* 338 S> */ B(LdaNamedPropertyNoFeedback), R(0), U8(6), + /* 345 S> */ B(Return), +] +constant pool: [ + ONE_BYTE_INTERNALIZED_STRING_TYPE ["f0"], + ONE_BYTE_INTERNALIZED_STRING_TYPE ["f1"], + ONE_BYTE_INTERNALIZED_STRING_TYPE ["f2"], + ONE_BYTE_INTERNALIZED_STRING_TYPE ["f3"], + ONE_BYTE_INTERNALIZED_STRING_TYPE ["f4"], + ONE_BYTE_INTERNALIZED_STRING_TYPE ["f5"], + ONE_BYTE_INTERNALIZED_STRING_TYPE ["callee"], +] +handlers: [ +] + +--- +snippet: " + + var t = 0; + function f2() {}; + if (t == 0) { + (function(){ + l = {}; + l.a = 3; + l.b = 4; + f2(); + return arguments.callee; + })(); + } + +" +frame size: 3 +parameter count: 1 +bytecode array length: 46 +bytecodes: [ + B(CreateMappedArguments), + B(Star), R(0), + /* 79 E> */ B(StackCheck), + /* 93 S> */ B(CreateEmptyObjectLiteral), + /* 95 E> */ B(StaGlobal), U8(0), U8(0), + /* 111 S> */ B(LdaGlobal), U8(0), U8(2), + B(Star), R(1), + B(LdaSmi), I8(3), + /* 115 E> */ B(StaNamedPropertyNoFeedback), R(1), U8(1), U8(0), + /* 130 S> */ B(LdaGlobal), U8(0), U8(2), + B(Star), R(1), + B(LdaSmi), I8(4), + /* 134 E> */ B(StaNamedPropertyNoFeedback), R(1), U8(2), U8(0), + /* 149 S> */ B(LdaUndefined), + B(Star), R(2), + B(LdaGlobal), U8(3), U8(4), + B(Star), R(1), + /* 149 E> */ B(CallNoFeedback), R(1), R(2), U8(1), + /* 182 S> */ B(LdaNamedPropertyNoFeedback), R(0), U8(4), + /* 189 S> */ B(Return), +] +constant pool: [ + ONE_BYTE_INTERNALIZED_STRING_TYPE ["l"], + ONE_BYTE_INTERNALIZED_STRING_TYPE ["a"], + ONE_BYTE_INTERNALIZED_STRING_TYPE ["b"], + ONE_BYTE_INTERNALIZED_STRING_TYPE ["f2"], + ONE_BYTE_INTERNALIZED_STRING_TYPE ["callee"], +] +handlers: [ +] + +--- +snippet: " + + function f2() {}; + function f() { + return (function(){ + l = {}; + l.a = 3; + l.b = 4; + f2(); + return arguments.callee; + })(); + } + f(); + +" +frame size: 2 +parameter count: 1 +bytecode array length: 43 +bytecodes: [ + B(CreateMappedArguments), + B(Star), R(0), + /* 76 E> */ B(StackCheck), + /* 92 S> */ B(CreateEmptyObjectLiteral), + /* 94 E> */ B(StaGlobal), U8(0), U8(0), + /* 112 S> */ B(LdaGlobal), U8(0), U8(2), + B(Star), R(1), + B(LdaSmi), I8(3), + /* 116 E> */ B(StaNamedProperty), R(1), U8(1), U8(4), + /* 133 S> */ B(LdaGlobal), U8(0), U8(2), + B(Star), R(1), + B(LdaSmi), I8(4), + /* 137 E> */ B(StaNamedProperty), R(1), U8(2), U8(6), + /* 154 S> */ B(LdaGlobal), U8(3), U8(8), + B(Star), R(1), + /* 154 E> */ B(CallUndefinedReceiver0), R(1), U8(10), + /* 189 S> */ B(LdaNamedProperty), R(0), U8(4), U8(12), + /* 196 S> */ B(Return), +] +constant pool: [ + ONE_BYTE_INTERNALIZED_STRING_TYPE ["l"], + ONE_BYTE_INTERNALIZED_STRING_TYPE ["a"], + ONE_BYTE_INTERNALIZED_STRING_TYPE ["b"], + ONE_BYTE_INTERNALIZED_STRING_TYPE ["f2"], + ONE_BYTE_INTERNALIZED_STRING_TYPE ["callee"], +] +handlers: [ +] + diff --git a/deps/v8/test/cctest/interpreter/bytecode_expectations/IIFEWithoutOneshotOpt.golden b/deps/v8/test/cctest/interpreter/bytecode_expectations/IIFEWithoutOneshotOpt.golden index f116bdc68f..efe9078eea 100644 --- a/deps/v8/test/cctest/interpreter/bytecode_expectations/IIFEWithoutOneshotOpt.golden +++ b/deps/v8/test/cctest/interpreter/bytecode_expectations/IIFEWithoutOneshotOpt.golden @@ -107,3 +107,186 @@ constant pool: [ handlers: [ ] +--- +snippet: " + + this.f0 = function() {}; + this.f1 = function(a) {}; + this.f2 = function(a, b) {}; + this.f3 = function(a, b, c) {}; + this.f4 = function(a, b, c, d) {}; + this.f5 = function(a, b, c, d, e) {}; + (function() { + this.f0(); + this.f1(1); + this.f2(1, 2); + this.f3(1, 2, 3); + this.f4(1, 2, 3, 4); + this.f5(1, 2, 3, 4, 5); + return arguments.callee; + })(); + +" +frame size: 8 +parameter count: 1 +bytecode array length: 144 +bytecodes: [ + B(CreateMappedArguments), + B(Star), R(0), + /* 237 E> */ B(StackCheck), + /* 255 S> */ B(LdaNamedProperty), R(this), U8(0), U8(0), + B(Star), R(1), + /* 255 E> */ B(CallProperty0), R(1), R(this), U8(2), + /* 274 S> */ B(LdaNamedProperty), R(this), U8(1), U8(4), + B(Star), R(1), + B(LdaSmi), I8(1), + B(Star), R(3), + /* 274 E> */ B(CallProperty1), R(1), R(this), R(3), U8(6), + /* 294 S> */ B(LdaNamedProperty), R(this), U8(2), U8(8), + B(Star), R(1), + B(LdaSmi), I8(1), + B(Star), R(3), + B(LdaSmi), I8(2), + B(Star), R(4), + /* 294 E> */ B(CallProperty2), R(1), R(this), R(3), R(4), U8(10), + /* 317 S> */ B(LdaNamedProperty), R(this), U8(3), U8(12), + B(Star), R(1), + B(LdaSmi), I8(1), + B(Star), R(3), + B(LdaSmi), I8(2), + B(Star), R(4), + B(LdaSmi), I8(3), + B(Star), R(5), + B(Mov), R(this), R(2), + /* 317 E> */ B(CallProperty), R(1), R(2), U8(4), U8(14), + /* 343 S> */ B(LdaNamedProperty), R(this), U8(4), U8(16), + B(Star), R(1), + B(LdaSmi), I8(1), + B(Star), R(3), + B(LdaSmi), I8(2), + B(Star), R(4), + B(LdaSmi), I8(3), + B(Star), R(5), + B(LdaSmi), I8(4), + B(Star), R(6), + B(Mov), R(this), R(2), + /* 343 E> */ B(CallProperty), R(1), R(2), U8(5), U8(18), + /* 372 S> */ B(LdaNamedProperty), R(this), U8(5), U8(20), + B(Star), R(1), + B(LdaSmi), I8(1), + B(Star), R(3), + B(LdaSmi), I8(2), + B(Star), R(4), + B(LdaSmi), I8(3), + B(Star), R(5), + B(LdaSmi), I8(4), + B(Star), R(6), + B(LdaSmi), I8(5), + B(Star), R(7), + B(Mov), R(this), R(2), + /* 372 E> */ B(CallProperty), R(1), R(2), U8(6), U8(22), + /* 416 S> */ B(LdaNamedProperty), R(0), U8(6), U8(24), + /* 423 S> */ B(Return), +] +constant pool: [ + ONE_BYTE_INTERNALIZED_STRING_TYPE ["f0"], + ONE_BYTE_INTERNALIZED_STRING_TYPE ["f1"], + ONE_BYTE_INTERNALIZED_STRING_TYPE ["f2"], + ONE_BYTE_INTERNALIZED_STRING_TYPE ["f3"], + ONE_BYTE_INTERNALIZED_STRING_TYPE ["f4"], + ONE_BYTE_INTERNALIZED_STRING_TYPE ["f5"], + ONE_BYTE_INTERNALIZED_STRING_TYPE ["callee"], +] +handlers: [ +] + +--- +snippet: " + + function f0() {} + function f1(a) {} + function f2(a, b) {} + function f3(a, b, c) {} + function f4(a, b, c, d) {} + function f5(a, b, c, d, e) {} + (function() { + f0(); + f1(1); + f2(1, 2); + f3(1, 2, 3); + f4(1, 2, 3, 4); + f5(1, 2, 3, 4, 5); + return arguments.callee; + })(); + +" +frame size: 7 +parameter count: 1 +bytecode array length: 126 +bytecodes: [ + B(CreateMappedArguments), + B(Star), R(0), + /* 189 E> */ B(StackCheck), + /* 202 S> */ B(LdaGlobal), U8(0), U8(0), + B(Star), R(1), + /* 202 E> */ B(CallUndefinedReceiver0), R(1), U8(2), + /* 216 S> */ B(LdaGlobal), U8(1), U8(4), + B(Star), R(1), + B(LdaSmi), I8(1), + B(Star), R(2), + /* 216 E> */ B(CallUndefinedReceiver1), R(1), R(2), U8(6), + /* 231 S> */ B(LdaGlobal), U8(2), U8(8), + B(Star), R(1), + B(LdaSmi), I8(1), + B(Star), R(2), + B(LdaSmi), I8(2), + B(Star), R(3), + /* 231 E> */ B(CallUndefinedReceiver2), R(1), R(2), R(3), U8(10), + /* 249 S> */ B(LdaGlobal), U8(3), U8(12), + B(Star), R(1), + B(LdaSmi), I8(1), + B(Star), R(2), + B(LdaSmi), I8(2), + B(Star), R(3), + B(LdaSmi), I8(3), + B(Star), R(4), + /* 249 E> */ B(CallUndefinedReceiver), R(1), R(2), U8(3), U8(14), + /* 270 S> */ B(LdaGlobal), U8(4), U8(16), + B(Star), R(1), + B(LdaSmi), I8(1), + B(Star), R(2), + B(LdaSmi), I8(2), + B(Star), R(3), + B(LdaSmi), I8(3), + B(Star), R(4), + B(LdaSmi), I8(4), + B(Star), R(5), + /* 270 E> */ B(CallUndefinedReceiver), R(1), R(2), U8(4), U8(18), + /* 294 S> */ B(LdaGlobal), U8(5), U8(20), + B(Star), R(1), + B(LdaSmi), I8(1), + B(Star), R(2), + B(LdaSmi), I8(2), + B(Star), R(3), + B(LdaSmi), I8(3), + B(Star), R(4), + B(LdaSmi), I8(4), + B(Star), R(5), + B(LdaSmi), I8(5), + B(Star), R(6), + /* 294 E> */ B(CallUndefinedReceiver), R(1), R(2), U8(5), U8(22), + /* 338 S> */ B(LdaNamedProperty), R(0), U8(6), U8(24), + /* 345 S> */ B(Return), +] +constant pool: [ + ONE_BYTE_INTERNALIZED_STRING_TYPE ["f0"], + ONE_BYTE_INTERNALIZED_STRING_TYPE ["f1"], + ONE_BYTE_INTERNALIZED_STRING_TYPE ["f2"], + ONE_BYTE_INTERNALIZED_STRING_TYPE ["f3"], + ONE_BYTE_INTERNALIZED_STRING_TYPE ["f4"], + ONE_BYTE_INTERNALIZED_STRING_TYPE ["f5"], + ONE_BYTE_INTERNALIZED_STRING_TYPE ["callee"], +] +handlers: [ +] + diff --git a/deps/v8/test/cctest/interpreter/bytecode_expectations/NewAndSpread.golden b/deps/v8/test/cctest/interpreter/bytecode_expectations/NewAndSpread.golden index bdfb35c70b..056f9d7b84 100644 --- a/deps/v8/test/cctest/interpreter/bytecode_expectations/NewAndSpread.golden +++ b/deps/v8/test/cctest/interpreter/bytecode_expectations/NewAndSpread.golden @@ -86,7 +86,7 @@ snippet: " " frame size: 10 parameter count: 1 -bytecode array length: 127 +bytecode array length: 124 bytecodes: [ /* 30 E> */ B(StackCheck), B(LdaTheHole), @@ -101,37 +101,35 @@ bytecodes: [ B(Mov), R(4), R(0), B(Mov), R(0), R(1), /* 89 S> */ B(CreateArrayLiteral), U8(2), U8(1), U8(37), - B(Star), R(3), - B(LdaConstant), U8(3), B(Star), R(4), - /* 101 S> */ B(CreateArrayLiteral), U8(4), U8(7), U8(37), + B(LdaConstant), U8(3), + B(Star), R(3), + /* 101 S> */ B(CreateArrayLiteral), U8(4), U8(5), U8(37), B(Star), R(8), - B(LdaNamedProperty), R(8), U8(5), U8(8), + B(LdaNamedProperty), R(8), U8(5), U8(6), B(Star), R(9), - B(CallProperty0), R(9), R(8), U8(10), + B(CallProperty0), R(9), R(8), U8(8), B(JumpIfJSReceiver), U8(7), B(CallRuntime), U16(Runtime::kThrowSymbolIteratorInvalid), R(0), U8(0), B(Star), R(7), - B(LdaNamedProperty), R(7), U8(6), U8(12), + B(LdaNamedProperty), R(7), U8(6), U8(10), B(Star), R(6), - B(CallProperty0), R(6), R(7), U8(14), + B(CallProperty0), R(6), R(7), U8(12), B(Star), R(5), B(JumpIfJSReceiver), U8(7), B(CallRuntime), U16(Runtime::kThrowIteratorResultNotAnObject), R(5), U8(1), - B(LdaNamedProperty), R(5), U8(7), U8(16), + B(LdaNamedProperty), R(5), U8(7), U8(14), B(JumpIfToBooleanTrue), U8(21), - B(LdaNamedProperty), R(5), U8(8), U8(18), + B(LdaNamedProperty), R(5), U8(8), U8(16), B(Star), R(5), - B(StaInArrayLiteral), R(3), R(4), U8(2), - B(Ldar), R(4), - B(Inc), U8(4), - B(Star), R(4), + B(StaInArrayLiteral), R(4), R(3), U8(3), + B(Ldar), R(3), + B(Inc), U8(2), + B(Star), R(3), B(JumpLoop), U8(35), I8(0), B(LdaSmi), I8(4), - B(StaInArrayLiteral), R(3), R(4), U8(2), - B(Ldar), R(4), - B(Inc), U8(4), - B(Star), R(4), + B(StaInArrayLiteral), R(4), R(3), U8(3), + B(Mov), R(4), R(3), B(CallJSRuntime), U8(%reflect_construct), R(2), U8(2), B(LdaUndefined), /* 116 S> */ B(Return), diff --git a/deps/v8/test/cctest/interpreter/bytecode_expectations/ObjectLiterals.golden b/deps/v8/test/cctest/interpreter/bytecode_expectations/ObjectLiterals.golden index fa64ffa2a4..a1f4d78f7c 100644 --- a/deps/v8/test/cctest/interpreter/bytecode_expectations/ObjectLiterals.golden +++ b/deps/v8/test/cctest/interpreter/bytecode_expectations/ObjectLiterals.golden @@ -246,7 +246,7 @@ bytecodes: [ B(Star), R(5), B(Mov), R(1), R(2), B(Mov), R(0), R(4), - /* 57 E> */ B(CallRuntime), U16(Runtime::kSetProperty), R(2), U8(4), + /* 57 E> */ B(CallRuntime), U16(Runtime::kSetKeyedProperty), R(2), U8(4), B(Ldar), R(2), /* 61 S> */ B(Return), ] diff --git a/deps/v8/test/cctest/interpreter/bytecode_expectations/PropertyLoadStoreOneShot.golden b/deps/v8/test/cctest/interpreter/bytecode_expectations/PropertyLoadStoreOneShot.golden index 3bc175b7da..e6eacf6fd6 100644 --- a/deps/v8/test/cctest/interpreter/bytecode_expectations/PropertyLoadStoreOneShot.golden +++ b/deps/v8/test/cctest/interpreter/bytecode_expectations/PropertyLoadStoreOneShot.golden @@ -20,9 +20,9 @@ snippet: " l['a'] = l['b']; " -frame size: 7 +frame size: 4 parameter count: 1 -bytecode array length: 128 +bytecode array length: 77 bytecodes: [ /* 0 E> */ B(StackCheck), /* 7 S> */ B(LdaConstant), U8(0), @@ -33,46 +33,25 @@ bytecodes: [ /* 9 E> */ B(StaGlobal), U8(1), U8(0), /* 60 S> */ B(LdaGlobal), U8(1), U8(3), B(Star), R(1), - B(LdaConstant), U8(2), - B(Star), R(3), - B(Mov), R(1), R(2), - /* 65 E> */ B(InvokeIntrinsic), U8(Runtime::k_GetProperty), R(2), U8(2), + /* 65 E> */ B(LdaNamedPropertyNoFeedback), R(1), U8(2), B(Star), R(1), /* 73 E> */ B(LdaGlobal), U8(1), U8(3), B(Star), R(2), - B(LdaConstant), U8(3), - B(Star), R(4), - B(Mov), R(2), R(3), - /* 74 E> */ B(InvokeIntrinsic), U8(Runtime::k_GetProperty), R(3), U8(2), + /* 74 E> */ B(LdaNamedPropertyNoFeedback), R(2), U8(3), /* 71 E> */ B(Add), R(1), U8(2), /* 62 E> */ B(StaGlobal), U8(4), U8(5), /* 87 S> */ B(LdaGlobal), U8(1), U8(3), B(Star), R(1), B(LdaSmi), I8(7), - B(Star), R(4), - B(LdaConstant), U8(3), - B(Star), R(3), - B(LdaZero), - B(Star), R(5), - B(Mov), R(1), R(2), - /* 94 E> */ B(CallRuntime), U16(Runtime::kSetProperty), R(2), U8(4), + /* 94 E> */ B(StaNamedPropertyNoFeedback), R(1), U8(3), U8(0), /* 105 S> */ B(LdaGlobal), U8(1), U8(3), B(Star), R(1), /* 114 E> */ B(LdaGlobal), U8(1), U8(3), B(Star), R(2), - B(LdaConstant), U8(3), - B(Star), R(4), - B(Mov), R(2), R(3), - /* 115 E> */ B(InvokeIntrinsic), U8(Runtime::k_GetProperty), R(3), U8(2), + /* 115 E> */ B(LdaNamedPropertyNoFeedback), R(2), U8(3), B(Star), R(2), - B(LdaConstant), U8(2), - B(Star), R(4), - B(LdaZero), - B(Star), R(6), - B(Mov), R(1), R(3), - B(Mov), R(2), R(5), - /* 112 E> */ B(CallRuntime), U16(Runtime::kSetProperty), R(3), U8(4), - B(Mov), R(5), R(0), + /* 112 E> */ B(StaNamedPropertyNoFeedback), R(1), U8(2), U8(0), + B(Mov), R(2), R(0), B(Ldar), R(0), /* 128 S> */ B(Return), ] @@ -307,9 +286,9 @@ snippet: " } " -frame size: 7 +frame size: 4 parameter count: 1 -bytecode array length: 111 +bytecode array length: 75 bytecodes: [ /* 0 E> */ B(StackCheck), /* 7 S> */ B(LdaConstant), U8(0), @@ -320,40 +299,25 @@ bytecodes: [ /* 9 E> */ B(StaGlobal), U8(1), U8(0), /* 63 S> */ B(LdaGlobal), U8(1), U8(2), B(Star), R(1), - B(LdaConstant), U8(2), - B(Star), R(3), - B(Mov), R(1), R(2), - /* 68 E> */ B(InvokeIntrinsic), U8(Runtime::k_GetProperty), R(2), U8(2), + /* 68 E> */ B(LdaNamedPropertyNoFeedback), R(1), U8(2), B(Star), R(1), B(LdaSmi), I8(3), /* 74 E> */ B(TestLessThan), R(1), U8(4), - B(JumpIfFalse), U8(36), + B(JumpIfFalse), U8(22), /* 89 S> */ B(LdaGlobal), U8(1), U8(2), B(Star), R(1), B(LdaSmi), I8(3), B(Star), R(2), - B(LdaConstant), U8(2), - B(Star), R(4), - B(LdaZero), - B(Star), R(6), - B(Mov), R(1), R(3), - B(Mov), R(2), R(5), - /* 96 E> */ B(CallRuntime), U16(Runtime::kSetProperty), R(3), U8(4), - B(Mov), R(5), R(0), + /* 96 E> */ B(StaNamedPropertyNoFeedback), R(1), U8(2), U8(0), + B(Mov), R(2), R(0), B(Ldar), R(2), - B(Jump), U8(34), + B(Jump), U8(20), /* 124 S> */ B(LdaGlobal), U8(1), U8(2), B(Star), R(1), B(LdaSmi), I8(3), B(Star), R(2), - B(LdaConstant), U8(3), - B(Star), R(4), - B(LdaZero), - B(Star), R(6), - B(Mov), R(1), R(3), - B(Mov), R(2), R(5), - /* 131 E> */ B(CallRuntime), U16(Runtime::kSetProperty), R(3), U8(4), - B(Mov), R(5), R(0), + /* 131 E> */ B(StaNamedPropertyNoFeedback), R(1), U8(3), U8(0), + B(Mov), R(2), R(0), B(Ldar), R(2), B(Ldar), R(0), /* 150 S> */ B(Return), @@ -373,16 +337,16 @@ snippet: " a = [1.1, [2.2, 4.5]]; " -frame size: 3 +frame size: 5 parameter count: 1 bytecode array length: 20 bytecodes: [ /* 0 E> */ B(StackCheck), /* 7 S> */ B(LdaConstant), U8(0), - B(Star), R(1), + B(Star), R(3), B(LdaSmi), I8(4), - B(Star), R(2), - B(CallRuntime), U16(Runtime::kCreateArrayLiteralWithoutAllocationSite), R(1), U8(2), + B(Star), R(4), + B(CallRuntime), U16(Runtime::kCreateArrayLiteralWithoutAllocationSite), R(3), U8(2), /* 9 E> */ B(StaGlobal), U8(1), U8(0), B(Star), R(0), /* 36 S> */ B(Return), @@ -400,16 +364,16 @@ snippet: " b = []; " -frame size: 3 +frame size: 5 parameter count: 1 bytecode array length: 20 bytecodes: [ /* 0 E> */ B(StackCheck), /* 7 S> */ B(LdaConstant), U8(0), - B(Star), R(1), + B(Star), R(3), B(LdaSmi), I8(37), - B(Star), R(2), - B(CallRuntime), U16(Runtime::kCreateArrayLiteralWithoutAllocationSite), R(1), U8(2), + B(Star), R(4), + B(CallRuntime), U16(Runtime::kCreateArrayLiteralWithoutAllocationSite), R(3), U8(2), /* 9 E> */ B(StaGlobal), U8(1), U8(0), B(Star), R(0), /* 21 S> */ B(Return), diff --git a/deps/v8/test/cctest/interpreter/bytecode_expectations/PublicClassFields.golden b/deps/v8/test/cctest/interpreter/bytecode_expectations/PublicClassFields.golden index 4607d37d4b..cb09c45b1a 100644 --- a/deps/v8/test/cctest/interpreter/bytecode_expectations/PublicClassFields.golden +++ b/deps/v8/test/cctest/interpreter/bytecode_expectations/PublicClassFields.golden @@ -37,7 +37,7 @@ bytecodes: [ B(Star), R(5), B(LdaConstant), U8(1), B(Star), R(6), - B(LdaConstant), U8(3), + /* 60 S> */ B(LdaConstant), U8(3), B(StaCurrentContextSlot), U8(4), B(Star), R(9), B(Mov), R(5), R(7), @@ -59,7 +59,7 @@ bytecodes: [ B(Star), R(5), B(LdaConstant), U8(7), B(Star), R(6), - B(LdaConstant), U8(3), + /* 99 S> */ B(LdaConstant), U8(3), B(StaCurrentContextSlot), U8(4), B(Star), R(9), B(Mov), R(5), R(7), @@ -145,7 +145,7 @@ bytecodes: [ B(Star), R(7), B(LdaConstant), U8(1), B(Star), R(8), - B(LdaConstant), U8(5), + /* 77 S> */ B(LdaConstant), U8(5), B(StaCurrentContextSlot), U8(4), B(Star), R(11), B(Mov), R(7), R(9), @@ -175,7 +175,7 @@ bytecodes: [ B(Star), R(7), B(LdaConstant), U8(9), B(Star), R(8), - B(LdaConstant), U8(5), + /* 133 S> */ B(LdaConstant), U8(5), B(StaCurrentContextSlot), U8(4), B(Star), R(11), B(CreateClosure), U8(13), U8(7), U8(2), @@ -198,7 +198,7 @@ bytecodes: [ B(Star), R(7), B(LdaConstant), U8(16), B(Star), R(8), - B(LdaConstant), U8(5), + /* 256 S> */ B(LdaConstant), U8(5), B(StaCurrentContextSlot), U8(4), B(Star), R(11), B(Mov), R(7), R(9), diff --git a/deps/v8/test/cctest/interpreter/bytecode_expectations/StandardForLoop.golden b/deps/v8/test/cctest/interpreter/bytecode_expectations/StandardForLoop.golden index d870c4362f..849f7beba3 100644 --- a/deps/v8/test/cctest/interpreter/bytecode_expectations/StandardForLoop.golden +++ b/deps/v8/test/cctest/interpreter/bytecode_expectations/StandardForLoop.golden @@ -381,35 +381,32 @@ snippet: " " frame size: 12 parameter count: 1 -bytecode array length: 140 +bytecode array length: 144 bytecodes: [ /* 16 E> */ B(StackCheck), B(CallJSRuntime), U8(%async_function_promise_create), R(0), U8(0), - B(Star), R(3), + B(Star), R(0), B(Mov), R(context), R(6), B(Mov), R(context), R(7), /* 36 S> */ B(LdaZero), - B(Star), R(1), + B(Star), R(2), /* 41 S> */ B(LdaSmi), I8(10), - /* 41 E> */ B(TestLessThan), R(1), U8(0), + /* 41 E> */ B(TestLessThan), R(2), U8(0), B(JumpIfFalse), U8(15), /* 23 E> */ B(StackCheck), - /* 62 S> */ B(Mov), R(1), R(0), - /* 49 S> */ B(Ldar), R(0), + /* 62 S> */ B(Mov), R(2), R(1), + /* 49 S> */ B(Ldar), R(1), B(Inc), U8(1), - B(Star), R(1), + B(Star), R(2), B(JumpLoop), U8(17), I8(0), B(LdaUndefined), - B(Star), R(9), - B(Mov), R(3), R(8), - /* 49 E> */ B(InvokeIntrinsic), U8(Runtime::k_ResolvePromise), R(8), U8(2), + B(Star), R(5), B(LdaZero), B(Star), R(4), - B(Mov), R(3), R(5), - B(Jump), U8(55), - B(Jump), U8(39), + B(Jump), U8(56), + B(Jump), U8(40), B(Star), R(8), - B(CreateCatchContext), R(8), U8(0), + /* 49 E> */ B(CreateCatchContext), R(8), U8(0), B(Star), R(7), B(LdaTheHole), B(SetPendingMessage), @@ -419,32 +416,37 @@ bytecodes: [ B(Star), R(10), B(LdaFalse), B(Star), R(11), - B(Mov), R(3), R(9), + B(Mov), R(0), R(9), B(InvokeIntrinsic), U8(Runtime::k_RejectPromise), R(9), U8(3), B(PopContext), R(8), - B(LdaZero), + B(LdaSmi), I8(1), B(Star), R(4), - B(Mov), R(3), R(5), + B(Mov), R(0), R(5), B(Jump), U8(16), B(LdaSmi), I8(-1), B(Star), R(5), B(Star), R(4), B(Jump), U8(8), B(Star), R(5), - B(LdaSmi), I8(1), + B(LdaSmi), I8(2), B(Star), R(4), B(LdaTheHole), B(SetPendingMessage), B(Star), R(6), B(LdaFalse), B(Star), R(8), - B(Mov), R(3), R(7), + B(Mov), R(0), R(7), B(CallJSRuntime), U8(%async_function_promise_release), R(7), U8(2), B(Ldar), R(6), B(SetPendingMessage), B(Ldar), R(4), - B(SwitchOnSmiNoFeedback), U8(1), U8(2), I8(0), - B(Jump), U8(8), + B(SwitchOnSmiNoFeedback), U8(1), U8(3), I8(0), + B(Jump), U8(21), + B(Mov), R(0), R(7), + B(Mov), R(5), R(8), + B(InvokeIntrinsic), U8(Runtime::k_ResolvePromise), R(7), U8(2), + B(Ldar), R(0), + /* 67 S> */ B(Return), B(Ldar), R(5), /* 67 S> */ B(Return), B(Ldar), R(5), @@ -455,11 +457,12 @@ bytecodes: [ constant pool: [ SCOPE_INFO_TYPE, Smi [6], - Smi [9], + Smi [19], + Smi [22], ] handlers: [ - [10, 93, 101], - [13, 54, 56], + [10, 84, 92], + [13, 44, 46], ] --- @@ -471,53 +474,50 @@ snippet: " " frame size: 11 parameter count: 1 -bytecode array length: 191 +bytecode array length: 195 bytecodes: [ - B(SwitchOnGeneratorState), R(1), U8(0), U8(1), + B(SwitchOnGeneratorState), R(2), U8(0), U8(1), B(Mov), R(closure), R(3), B(Mov), R(this), R(4), B(InvokeIntrinsic), U8(Runtime::k_CreateJSGeneratorObject), R(3), U8(2), - B(Star), R(1), + B(Star), R(2), /* 16 E> */ B(StackCheck), B(CallJSRuntime), U8(%async_function_promise_create), R(0), U8(0), - B(Star), R(2), + B(Star), R(0), B(Mov), R(context), R(5), B(Mov), R(context), R(6), /* 36 S> */ B(LdaZero), - B(Star), R(0), + B(Star), R(1), /* 41 S> */ B(LdaSmi), I8(10), - /* 41 E> */ B(TestLessThan), R(0), U8(0), + /* 41 E> */ B(TestLessThan), R(1), U8(0), B(JumpIfFalse), U8(50), /* 23 E> */ B(StackCheck), - /* 52 S> */ B(Mov), R(1), R(7), - B(Mov), R(0), R(8), - B(Mov), R(2), R(9), + /* 52 S> */ B(Mov), R(2), R(7), + B(Mov), R(1), R(8), + B(Mov), R(0), R(9), B(CallJSRuntime), U8(%async_function_await_uncaught), R(7), U8(3), - /* 52 E> */ B(SuspendGenerator), R(1), R(0), U8(7), U8(0), - B(ResumeGenerator), R(1), R(0), U8(7), + /* 52 E> */ B(SuspendGenerator), R(2), R(0), U8(7), U8(0), + B(ResumeGenerator), R(2), R(0), U8(7), B(Star), R(7), - B(InvokeIntrinsic), U8(Runtime::k_GeneratorGetResumeMode), R(1), U8(1), + B(InvokeIntrinsic), U8(Runtime::k_GeneratorGetResumeMode), R(2), U8(1), B(Star), R(8), B(LdaZero), B(TestReferenceEqual), R(8), B(JumpIfTrue), U8(5), B(Ldar), R(7), B(ReThrow), - /* 49 S> */ B(Ldar), R(0), + /* 49 S> */ B(Ldar), R(1), B(Inc), U8(1), - B(Star), R(0), + B(Star), R(1), B(JumpLoop), U8(52), I8(0), B(LdaUndefined), - B(Star), R(8), - B(Mov), R(2), R(7), - /* 49 E> */ B(InvokeIntrinsic), U8(Runtime::k_ResolvePromise), R(7), U8(2), + B(Star), R(4), B(LdaZero), B(Star), R(3), - B(Mov), R(2), R(4), - B(Jump), U8(55), - B(Jump), U8(39), + B(Jump), U8(56), + B(Jump), U8(40), B(Star), R(7), - B(CreateCatchContext), R(7), U8(1), + /* 49 E> */ B(CreateCatchContext), R(7), U8(1), B(Star), R(6), B(LdaTheHole), B(SetPendingMessage), @@ -527,32 +527,37 @@ bytecodes: [ B(Star), R(9), B(LdaFalse), B(Star), R(10), - B(Mov), R(2), R(8), + B(Mov), R(0), R(8), B(InvokeIntrinsic), U8(Runtime::k_RejectPromise), R(8), U8(3), B(PopContext), R(7), - B(LdaZero), + B(LdaSmi), I8(1), B(Star), R(3), - B(Mov), R(2), R(4), + B(Mov), R(0), R(4), B(Jump), U8(16), B(LdaSmi), I8(-1), B(Star), R(4), B(Star), R(3), B(Jump), U8(8), B(Star), R(4), - B(LdaSmi), I8(1), + B(LdaSmi), I8(2), B(Star), R(3), B(LdaTheHole), B(SetPendingMessage), B(Star), R(5), B(LdaTrue), B(Star), R(7), - B(Mov), R(2), R(6), + B(Mov), R(0), R(6), B(CallJSRuntime), U8(%async_function_promise_release), R(6), U8(2), B(Ldar), R(5), B(SetPendingMessage), B(Ldar), R(3), - B(SwitchOnSmiNoFeedback), U8(2), U8(2), I8(0), - B(Jump), U8(8), + B(SwitchOnSmiNoFeedback), U8(2), U8(3), I8(0), + B(Jump), U8(21), + B(Mov), R(0), R(6), + B(Mov), R(4), R(7), + B(InvokeIntrinsic), U8(Runtime::k_ResolvePromise), R(6), U8(2), + B(Ldar), R(0), + /* 61 S> */ B(Return), B(Ldar), R(4), /* 61 S> */ B(Return), B(Ldar), R(4), @@ -564,10 +569,11 @@ constant pool: [ Smi [58], SCOPE_INFO_TYPE, Smi [6], - Smi [9], + Smi [19], + Smi [22], ] handlers: [ - [26, 144, 152], - [29, 105, 107], + [26, 135, 143], + [29, 95, 97], ] diff --git a/deps/v8/test/cctest/interpreter/bytecode_expectations/StaticClassFields.golden b/deps/v8/test/cctest/interpreter/bytecode_expectations/StaticClassFields.golden index fcf5e9ae9a..da5c922456 100644 --- a/deps/v8/test/cctest/interpreter/bytecode_expectations/StaticClassFields.golden +++ b/deps/v8/test/cctest/interpreter/bytecode_expectations/StaticClassFields.golden @@ -44,10 +44,10 @@ bytecodes: [ B(Star), R(5), B(LdaConstant), U8(1), B(Star), R(6), - B(LdaConstant), U8(3), + /* 60 S> */ B(LdaConstant), U8(3), B(StaCurrentContextSlot), U8(4), B(Star), R(9), - B(LdaConstant), U8(4), + /* 92 S> */ B(LdaConstant), U8(4), B(Star), R(10), B(LdaConstant), U8(5), B(TestEqualStrict), R(10), U8(1), @@ -79,10 +79,10 @@ bytecodes: [ B(Star), R(5), B(LdaConstant), U8(10), B(Star), R(6), - B(LdaConstant), U8(3), + /* 131 S> */ B(LdaConstant), U8(3), B(StaCurrentContextSlot), U8(4), B(Star), R(9), - B(LdaConstant), U8(4), + /* 176 S> */ B(LdaConstant), U8(4), B(Star), R(10), B(LdaConstant), U8(5), B(TestEqualStrict), R(10), U8(1), @@ -188,10 +188,10 @@ bytecodes: [ B(Star), R(7), B(LdaConstant), U8(1), B(Star), R(8), - B(LdaConstant), U8(5), + /* 77 S> */ B(LdaConstant), U8(5), B(StaCurrentContextSlot), U8(4), B(Star), R(11), - B(LdaConstant), U8(6), + /* 109 S> */ B(LdaConstant), U8(6), B(Star), R(12), B(LdaConstant), U8(7), B(TestEqualStrict), R(12), U8(2), @@ -231,10 +231,10 @@ bytecodes: [ B(Star), R(7), B(LdaConstant), U8(12), B(Star), R(8), - B(LdaConstant), U8(5), + /* 165 S> */ B(LdaConstant), U8(5), B(StaCurrentContextSlot), U8(4), B(Star), R(11), - B(LdaConstant), U8(6), + /* 210 S> */ B(LdaConstant), U8(6), B(Star), R(12), B(LdaConstant), U8(7), B(TestEqualStrict), R(12), U8(2), @@ -267,10 +267,10 @@ bytecodes: [ B(Star), R(7), B(LdaConstant), U8(20), B(Star), R(8), - B(LdaConstant), U8(5), + /* 333 S> */ B(LdaConstant), U8(5), B(StaCurrentContextSlot), U8(4), B(Star), R(11), - B(LdaConstant), U8(6), + /* 378 S> */ B(LdaConstant), U8(6), B(Star), R(12), B(LdaConstant), U8(7), B(TestEqualStrict), R(12), U8(2), diff --git a/deps/v8/test/cctest/interpreter/bytecode_expectations/SuperCallAndSpread.golden b/deps/v8/test/cctest/interpreter/bytecode_expectations/SuperCallAndSpread.golden index 39e41739e1..42238ac049 100644 --- a/deps/v8/test/cctest/interpreter/bytecode_expectations/SuperCallAndSpread.golden +++ b/deps/v8/test/cctest/interpreter/bytecode_expectations/SuperCallAndSpread.golden @@ -93,7 +93,7 @@ snippet: " " frame size: 13 parameter count: 1 -bytecode array length: 137 +bytecode array length: 130 bytecodes: [ B(CreateRestParameter), B(Star), R(2), @@ -103,55 +103,51 @@ bytecodes: [ /* 140 S> */ B(Ldar), R(closure), B(GetSuperConstructor), R(5), B(CreateEmptyArrayLiteral), U8(0), - B(Star), R(6), - B(LdaZero), B(Star), R(7), + B(LdaZero), + B(Star), R(6), B(LdaSmi), I8(1), - B(StaKeyedProperty), R(6), R(7), U8(1), - B(LdaConstant), U8(0), - /* 152 S> */ B(Star), R(7), - B(LdaNamedProperty), R(2), U8(1), U8(8), + B(StaInArrayLiteral), R(7), R(6), U8(1), + B(Ldar), R(6), + B(Inc), U8(3), + /* 152 S> */ B(Star), R(6), + B(LdaNamedProperty), R(2), U8(0), U8(4), B(Star), R(12), - B(CallProperty0), R(12), R(2), U8(10), + B(CallProperty0), R(12), R(2), U8(6), B(Mov), R(2), R(11), B(Mov), R(1), R(4), B(JumpIfJSReceiver), U8(7), B(CallRuntime), U16(Runtime::kThrowSymbolIteratorInvalid), R(0), U8(0), B(Star), R(10), - B(LdaNamedProperty), R(10), U8(2), U8(12), + B(LdaNamedProperty), R(10), U8(1), U8(8), B(Star), R(9), - B(CallProperty0), R(9), R(10), U8(14), + B(CallProperty0), R(9), R(10), U8(10), B(Star), R(8), B(JumpIfJSReceiver), U8(7), B(CallRuntime), U16(Runtime::kThrowIteratorResultNotAnObject), R(8), U8(1), - B(LdaNamedProperty), R(8), U8(3), U8(16), + B(LdaNamedProperty), R(8), U8(2), U8(12), B(JumpIfToBooleanTrue), U8(21), - B(LdaNamedProperty), R(8), U8(4), U8(18), + B(LdaNamedProperty), R(8), U8(3), U8(14), B(Star), R(8), - B(StaInArrayLiteral), R(6), R(7), U8(3), - B(Ldar), R(7), - B(Inc), U8(5), - B(Star), R(7), + B(StaInArrayLiteral), R(7), R(6), U8(1), + B(Ldar), R(6), + B(Inc), U8(3), + B(Star), R(6), B(JumpLoop), U8(35), I8(0), B(LdaSmi), I8(1), - B(StaInArrayLiteral), R(6), R(7), U8(3), - B(Ldar), R(7), - B(Inc), U8(5), - B(Star), R(7), - B(Mov), R(5), R(8), - B(Mov), R(6), R(9), - B(Mov), R(0), R(10), - /* 140 E> */ B(CallJSRuntime), U8(%reflect_construct), R(8), U8(3), - B(Star), R(11), + B(StaInArrayLiteral), R(7), R(6), U8(1), + B(Mov), R(5), R(6), + B(Mov), R(0), R(8), + /* 140 E> */ B(CallJSRuntime), U8(%reflect_construct), R(6), U8(3), + B(Star), R(9), B(Ldar), R(this), B(ThrowSuperAlreadyCalledIfNotHole), - B(Mov), R(11), R(this), + B(Mov), R(9), R(this), B(Ldar), R(this), B(ThrowSuperNotCalledIfHole), /* 162 S> */ B(Return), ] constant pool: [ - Smi [1], SYMBOL_TYPE, ONE_BYTE_INTERNALIZED_STRING_TYPE ["next"], ONE_BYTE_INTERNALIZED_STRING_TYPE ["done"], diff --git a/deps/v8/test/cctest/interpreter/interpreter-tester.cc b/deps/v8/test/cctest/interpreter/interpreter-tester.cc index acb06f2d8a..855e01e786 100644 --- a/deps/v8/test/cctest/interpreter/interpreter-tester.cc +++ b/deps/v8/test/cctest/interpreter/interpreter-tester.cc @@ -38,7 +38,7 @@ InterpreterTester::InterpreterTester(Isolate* isolate, const char* source, : InterpreterTester(isolate, source, MaybeHandle<BytecodeArray>(), MaybeHandle<FeedbackMetadata>(), filter) {} -InterpreterTester::~InterpreterTester() {} +InterpreterTester::~InterpreterTester() = default; Local<Message> InterpreterTester::CheckThrowsReturnMessage() { TryCatch try_catch(reinterpret_cast<v8::Isolate*>(isolate_)); diff --git a/deps/v8/test/cctest/interpreter/interpreter-tester.h b/deps/v8/test/cctest/interpreter/interpreter-tester.h index d795b7ffcd..d670252242 100644 --- a/deps/v8/test/cctest/interpreter/interpreter-tester.h +++ b/deps/v8/test/cctest/interpreter/interpreter-tester.h @@ -36,7 +36,7 @@ class InterpreterCallable { public: InterpreterCallable(Isolate* isolate, Handle<JSFunction> function) : isolate_(isolate), function_(function) {} - virtual ~InterpreterCallable() {} + virtual ~InterpreterCallable() = default; MaybeHandle<Object> operator()(A... args) { return CallInterpreter(isolate_, function_, args...); diff --git a/deps/v8/test/cctest/interpreter/test-bytecode-generator.cc b/deps/v8/test/cctest/interpreter/test-bytecode-generator.cc index 0ec28d3653..e81b0cf981 100644 --- a/deps/v8/test/cctest/interpreter/test-bytecode-generator.cc +++ b/deps/v8/test/cctest/interpreter/test-bytecode-generator.cc @@ -627,6 +627,69 @@ TEST(IIFEWithOneshotOpt) { return arguments.callee; })(); )", + // CallNoFeedback instead of CallProperty + R"( + this.f0 = function() {}; + this.f1 = function(a) {}; + this.f2 = function(a, b) {}; + this.f3 = function(a, b, c) {}; + this.f4 = function(a, b, c, d) {}; + this.f5 = function(a, b, c, d, e) {}; + (function() { + this.f0(); + this.f1(1); + this.f2(1, 2); + this.f3(1, 2, 3); + this.f4(1, 2, 3, 4); + this.f5(1, 2, 3, 4, 5); + return arguments.callee; + })(); + )", + // CallNoFeedback instead of CallUndefinedReceiver + R"( + function f0() {} + function f1(a) {} + function f2(a, b) {} + function f3(a, b, c) {} + function f4(a, b, c, d) {} + function f5(a, b, c, d, e) {} + (function() { + f0(); + f1(1); + f2(1, 2); + f3(1, 2, 3); + f4(1, 2, 3, 4); + f5(1, 2, 3, 4, 5); + return arguments.callee; + })(); + )", + R"( + var t = 0; + function f2() {}; + if (t == 0) { + (function(){ + l = {}; + l.a = 3; + l.b = 4; + f2(); + return arguments.callee; + })(); + } + )", + // No one-shot opt for IIFE`s within a function + R"( + function f2() {}; + function f() { + return (function(){ + l = {}; + l.a = 3; + l.b = 4; + f2(); + return arguments.callee; + })(); + } + f(); + )", }; CHECK(CompareTexts(BuildActual(printer, snippets), LoadGolden("IIFEWithOneshotOpt.golden"))); @@ -663,6 +726,40 @@ TEST(IIFEWithoutOneshotOpt) { return arguments.callee; })(); )", + R"( + this.f0 = function() {}; + this.f1 = function(a) {}; + this.f2 = function(a, b) {}; + this.f3 = function(a, b, c) {}; + this.f4 = function(a, b, c, d) {}; + this.f5 = function(a, b, c, d, e) {}; + (function() { + this.f0(); + this.f1(1); + this.f2(1, 2); + this.f3(1, 2, 3); + this.f4(1, 2, 3, 4); + this.f5(1, 2, 3, 4, 5); + return arguments.callee; + })(); + )", + R"( + function f0() {} + function f1(a) {} + function f2(a, b) {} + function f3(a, b, c) {} + function f4(a, b, c, d) {} + function f5(a, b, c, d, e) {} + (function() { + f0(); + f1(1); + f2(1, 2); + f3(1, 2, 3); + f4(1, 2, 3, 4); + f5(1, 2, 3, 4, 5); + return arguments.callee; + })(); + )", }; CHECK(CompareTexts(BuildActual(printer, snippets), LoadGolden("IIFEWithoutOneshotOpt.golden"))); diff --git a/deps/v8/test/cctest/interpreter/test-interpreter-intrinsics.cc b/deps/v8/test/cctest/interpreter/test-interpreter-intrinsics.cc index 57d42e2a83..bfc42aa540 100644 --- a/deps/v8/test/cctest/interpreter/test-interpreter-intrinsics.cc +++ b/deps/v8/test/cctest/interpreter/test-interpreter-intrinsics.cc @@ -27,7 +27,7 @@ class InvokeIntrinsicHelper { template <class... A> Handle<Object> Invoke(A... args) { CHECK(IntrinsicsHelper::IsSupported(function_id_)); - BytecodeArrayBuilder builder(zone_, sizeof...(args), 0, 0); + BytecodeArrayBuilder builder(zone_, sizeof...(args), 0, nullptr); RegisterList reg_list = InterpreterTester::NewRegisterList( builder.Receiver().index(), sizeof...(args)); builder.CallRuntime(function_id_, reg_list).Return(); @@ -94,29 +94,6 @@ TEST(IsArray) { CHECK_EQ(*factory->false_value(), *helper.Invoke(helper.NewObject("42"))); } -TEST(IsJSProxy) { - HandleAndZoneScope handles; - - InvokeIntrinsicHelper helper(handles.main_isolate(), handles.main_zone(), - Runtime::kInlineIsJSProxy); - Factory* factory = handles.main_isolate()->factory(); - - CHECK_EQ(*factory->false_value(), - *helper.Invoke(helper.NewObject("new Date()"))); - CHECK_EQ(*factory->false_value(), - *helper.Invoke(helper.NewObject("(function() {})"))); - CHECK_EQ(*factory->false_value(), *helper.Invoke(helper.NewObject("([1])"))); - CHECK_EQ(*factory->false_value(), *helper.Invoke(helper.NewObject("({})"))); - CHECK_EQ(*factory->false_value(), *helper.Invoke(helper.NewObject("(/x/)"))); - CHECK_EQ(*factory->false_value(), *helper.Invoke(helper.Undefined())); - CHECK_EQ(*factory->false_value(), *helper.Invoke(helper.Null())); - CHECK_EQ(*factory->false_value(), - *helper.Invoke(helper.NewObject("'string'"))); - CHECK_EQ(*factory->false_value(), *helper.Invoke(helper.NewObject("42"))); - CHECK_EQ(*factory->true_value(), - *helper.Invoke(helper.NewObject("new Proxy({},{})"))); -} - TEST(IsTypedArray) { HandleAndZoneScope handles; @@ -198,15 +175,6 @@ TEST(IntrinsicAsStubCall) { HandleAndZoneScope handles; Isolate* isolate = handles.main_isolate(); Factory* factory = isolate->factory(); - InvokeIntrinsicHelper to_number_helper(isolate, handles.main_zone(), - Runtime::kInlineToNumber); - CHECK_EQ(Smi::FromInt(46), - *to_number_helper.Invoke(to_number_helper.NewObject("'46'"))); - - InvokeIntrinsicHelper to_integer_helper(isolate, handles.main_zone(), - Runtime::kInlineToInteger); - CHECK_EQ(Smi::FromInt(502), - *to_integer_helper.Invoke(to_integer_helper.NewObject("502.67"))); InvokeIntrinsicHelper has_property_helper(isolate, handles.main_zone(), Runtime::kInlineHasProperty); diff --git a/deps/v8/test/cctest/interpreter/test-interpreter.cc b/deps/v8/test/cctest/interpreter/test-interpreter.cc index c1898adf4e..65eee6f778 100644 --- a/deps/v8/test/cctest/interpreter/test-interpreter.cc +++ b/deps/v8/test/cctest/interpreter/test-interpreter.cc @@ -423,7 +423,8 @@ TEST(InterpreterBinaryOpsBigInt) { CHECK(return_value->IsBigInt()); MaybeObject* feedback = callable.vector()->Get(slot); CHECK(feedback->IsSmi()); - CHECK_EQ(BinaryOperationFeedback::kBigInt, feedback->ToSmi()->value()); + CHECK_EQ(BinaryOperationFeedback::kBigInt, + feedback->cast<Smi>()->value()); } } } @@ -543,7 +544,7 @@ TEST(InterpreterStringAdd) { MaybeObject* feedback = callable.vector()->Get(slot); CHECK(feedback->IsSmi()); - CHECK_EQ(test_cases[i].expected_feedback, feedback->ToSmi()->value()); + CHECK_EQ(test_cases[i].expected_feedback, feedback->cast<Smi>()->value()); } } @@ -748,7 +749,7 @@ TEST(InterpreterBinaryOpTypeFeedback) { Handle<Object> return_val = callable().ToHandleChecked(); MaybeObject* feedback0 = callable.vector()->Get(slot0); CHECK(feedback0->IsSmi()); - CHECK_EQ(test_case.feedback, feedback0->ToSmi()->value()); + CHECK_EQ(test_case.feedback, feedback0->cast<Smi>()->value()); CHECK(Object::Equals(isolate, test_case.result, return_val).ToChecked()); } } @@ -854,7 +855,7 @@ TEST(InterpreterBinaryOpSmiTypeFeedback) { Handle<Object> return_val = callable().ToHandleChecked(); MaybeObject* feedback0 = callable.vector()->Get(slot0); CHECK(feedback0->IsSmi()); - CHECK_EQ(test_case.feedback, feedback0->ToSmi()->value()); + CHECK_EQ(test_case.feedback, feedback0->cast<Smi>()->value()); CHECK(Object::Equals(isolate, test_case.result, return_val).ToChecked()); } } @@ -926,23 +927,23 @@ TEST(InterpreterUnaryOpFeedback) { MaybeObject* feedback0 = callable.vector()->Get(slot0); CHECK(feedback0->IsSmi()); CHECK_EQ(BinaryOperationFeedback::kSignedSmall, - feedback0->ToSmi()->value()); + feedback0->cast<Smi>()->value()); MaybeObject* feedback1 = callable.vector()->Get(slot1); CHECK(feedback1->IsSmi()); - CHECK_EQ(BinaryOperationFeedback::kNumber, feedback1->ToSmi()->value()); + CHECK_EQ(BinaryOperationFeedback::kNumber, feedback1->cast<Smi>()->value()); MaybeObject* feedback2 = callable.vector()->Get(slot2); CHECK(feedback2->IsSmi()); - CHECK_EQ(BinaryOperationFeedback::kNumber, feedback2->ToSmi()->value()); + CHECK_EQ(BinaryOperationFeedback::kNumber, feedback2->cast<Smi>()->value()); MaybeObject* feedback3 = callable.vector()->Get(slot3); CHECK(feedback3->IsSmi()); - CHECK_EQ(BinaryOperationFeedback::kBigInt, feedback3->ToSmi()->value()); + CHECK_EQ(BinaryOperationFeedback::kBigInt, feedback3->cast<Smi>()->value()); MaybeObject* feedback4 = callable.vector()->Get(slot4); CHECK(feedback4->IsSmi()); - CHECK_EQ(BinaryOperationFeedback::kAny, feedback4->ToSmi()->value()); + CHECK_EQ(BinaryOperationFeedback::kAny, feedback4->cast<Smi>()->value()); } } @@ -988,15 +989,15 @@ TEST(InterpreterBitwiseTypeFeedback) { MaybeObject* feedback0 = callable.vector()->Get(slot0); CHECK(feedback0->IsSmi()); CHECK_EQ(BinaryOperationFeedback::kSignedSmall, - feedback0->ToSmi()->value()); + feedback0->cast<Smi>()->value()); MaybeObject* feedback1 = callable.vector()->Get(slot1); CHECK(feedback1->IsSmi()); - CHECK_EQ(BinaryOperationFeedback::kNumber, feedback1->ToSmi()->value()); + CHECK_EQ(BinaryOperationFeedback::kNumber, feedback1->cast<Smi>()->value()); MaybeObject* feedback2 = callable.vector()->Get(slot2); CHECK(feedback2->IsSmi()); - CHECK_EQ(BinaryOperationFeedback::kAny, feedback2->ToSmi()->value()); + CHECK_EQ(BinaryOperationFeedback::kAny, feedback2->cast<Smi>()->value()); } } @@ -1818,7 +1819,7 @@ TEST(InterpreterSmiComparisons) { MaybeObject* feedback = callable.vector()->Get(slot); CHECK(feedback->IsSmi()); CHECK_EQ(CompareOperationFeedback::kSignedSmall, - feedback->ToSmi()->value()); + feedback->cast<Smi>()->value()); } } } @@ -1866,7 +1867,8 @@ TEST(InterpreterHeapNumberComparisons) { CompareC(comparison, inputs[i], inputs[j])); MaybeObject* feedback = callable.vector()->Get(slot); CHECK(feedback->IsSmi()); - CHECK_EQ(CompareOperationFeedback::kNumber, feedback->ToSmi()->value()); + CHECK_EQ(CompareOperationFeedback::kNumber, + feedback->cast<Smi>()->value()); } } } @@ -1908,7 +1910,8 @@ TEST(InterpreterBigIntComparisons) { CHECK(return_value->IsBoolean()); MaybeObject* feedback = callable.vector()->Get(slot); CHECK(feedback->IsSmi()); - CHECK_EQ(CompareOperationFeedback::kBigInt, feedback->ToSmi()->value()); + CHECK_EQ(CompareOperationFeedback::kBigInt, + feedback->cast<Smi>()->value()); } } } @@ -1959,7 +1962,7 @@ TEST(InterpreterStringComparisons) { Token::IsOrderedRelationalCompareOp(comparison) ? CompareOperationFeedback::kString : CompareOperationFeedback::kInternalizedString; - CHECK_EQ(expected_feedback, feedback->ToSmi()->value()); + CHECK_EQ(expected_feedback, feedback->cast<Smi>()->value()); } } } @@ -2072,7 +2075,7 @@ TEST(InterpreterMixedComparisons) { CHECK(feedback->IsSmi()); // Comparison with a number and string collects kAny feedback. CHECK_EQ(CompareOperationFeedback::kAny, - feedback->ToSmi()->value()); + feedback->cast<Smi>()->value()); } } } @@ -5046,6 +5049,35 @@ TEST(InterpreterWithNativeStack) { interpreter_entry_trampoline->InstructionStart()); } +TEST(InterpreterGetAndMaybeDeserializeBytecodeHandler) { + HandleAndZoneScope handles; + Isolate* isolate = handles.main_isolate(); + Interpreter* interpreter = isolate->interpreter(); + + // Test that single-width bytecode handlers deserializer correctly. + Code* wide_handler = interpreter->GetAndMaybeDeserializeBytecodeHandler( + Bytecode::kWide, OperandScale::kSingle); + + CHECK_EQ(wide_handler->builtin_index(), Builtins::kWideHandler); + + Code* add_handler = interpreter->GetAndMaybeDeserializeBytecodeHandler( + Bytecode::kAdd, OperandScale::kSingle); + + CHECK_EQ(add_handler->builtin_index(), Builtins::kAddHandler); + + // Test that double-width bytecode handlers deserializer correctly, including + // an illegal bytecode handler since there is no Wide.Wide handler. + Code* wide_wide_handler = interpreter->GetAndMaybeDeserializeBytecodeHandler( + Bytecode::kWide, OperandScale::kDouble); + + CHECK_EQ(wide_wide_handler->builtin_index(), Builtins::kIllegalHandler); + + Code* add_wide_handler = interpreter->GetAndMaybeDeserializeBytecodeHandler( + Bytecode::kAdd, OperandScale::kDouble); + + CHECK_EQ(add_wide_handler->builtin_index(), Builtins::kAddWideHandler); +} + } // namespace interpreter } // namespace internal } // namespace v8 diff --git a/deps/v8/test/cctest/interpreter/test-source-positions.cc b/deps/v8/test/cctest/interpreter/test-source-positions.cc index 8f2aae7e0b..2a8e354e54 100644 --- a/deps/v8/test/cctest/interpreter/test-source-positions.cc +++ b/deps/v8/test/cctest/interpreter/test-source-positions.cc @@ -49,7 +49,7 @@ struct TestCaseData { const char* arguments() const { return arguments_; } private: - TestCaseData(); + TestCaseData() = delete; const char* const script_; const char* const declaration_parameters_; diff --git a/deps/v8/test/cctest/libsampler/test-sampler.cc b/deps/v8/test/cctest/libsampler/test-sampler.cc index 2ec3b870df..462da988e4 100644 --- a/deps/v8/test/cctest/libsampler/test-sampler.cc +++ b/deps/v8/test/cctest/libsampler/test-sampler.cc @@ -55,7 +55,7 @@ class TestSampler : public Sampler { class TestApiCallbacks { public: - TestApiCallbacks() {} + TestApiCallbacks() = default; static void Getter(v8::Local<v8::String> name, const v8::PropertyCallbackInfo<v8::Value>& info) { diff --git a/deps/v8/test/cctest/parsing/test-preparser.cc b/deps/v8/test/cctest/parsing/test-preparser.cc index 473debec40..ecea6f6134 100644 --- a/deps/v8/test/cctest/parsing/test-preparser.cc +++ b/deps/v8/test/cctest/parsing/test-preparser.cc @@ -8,6 +8,7 @@ #include "src/objects-inl.h" #include "src/parsing/parse-info.h" #include "src/parsing/parsing.h" +#include "src/parsing/preparsed-scope-data-impl.h" #include "src/parsing/preparsed-scope-data.h" #include "test/cctest/cctest.h" @@ -747,8 +748,8 @@ TEST(PreParserScopeAnalysis) { // Parse the lazy function using the scope data. i::ParseInfo using_scope_data(isolate, shared); using_scope_data.set_lazy_compile(); - using_scope_data.consumed_preparsed_scope_data()->SetData( - isolate, produced_data_on_heap); + using_scope_data.set_consumed_preparsed_scope_data( + i::ConsumedPreParsedScopeData::For(isolate, produced_data_on_heap)); CHECK(i::parsing::ParseFunction(&using_scope_data, shared, isolate)); // Verify that we skipped at least one function inside that scope. @@ -814,7 +815,7 @@ TEST(ProducingAndConsumingByteData) { LocalContext env; i::Zone zone(isolate->allocator(), ZONE_NAME); - i::ProducedPreParsedScopeData::ByteData bytes(&zone); + i::PreParsedScopeDataBuilder::ByteData bytes(&zone); // Write some data. bytes.WriteUint32(1983); // This will be overwritten. bytes.WriteUint32(2147483647); @@ -841,32 +842,67 @@ TEST(ProducingAndConsumingByteData) { // End with a lonely quarter. bytes.WriteQuarter(2); - i::Handle<i::PodArray<uint8_t>> data_on_heap = bytes.Serialize(isolate); - i::ConsumedPreParsedScopeData::ByteData bytes_for_reading; - i::ConsumedPreParsedScopeData::ByteData::ReadingScope reading_scope( - &bytes_for_reading, *data_on_heap); + { + // Serialize as a ZoneConsumedPreParsedScopeData, and read back data. + i::ZonePreParsedScopeData zone_serialized(&zone, bytes.begin(), bytes.end(), + 0); + i::ZoneConsumedPreParsedScopeData::ByteData bytes_for_reading; + i::ZoneVectorWrapper wrapper(zone_serialized.byte_data()); + i::ZoneConsumedPreParsedScopeData::ByteData::ReadingScope reading_scope( + &bytes_for_reading, &wrapper); - // Read the data back. #ifdef DEBUG - CHECK_EQ(bytes_for_reading.ReadUint32(), 2017); + CHECK_EQ(bytes_for_reading.ReadUint32(), 2017); #else - CHECK_EQ(bytes_for_reading.ReadUint32(), 1983); + CHECK_EQ(bytes_for_reading.ReadUint32(), 1983); #endif - CHECK_EQ(bytes_for_reading.ReadUint32(), 2147483647); - CHECK_EQ(bytes_for_reading.ReadUint8(), 4); - CHECK_EQ(bytes_for_reading.ReadUint8(), 255); - CHECK_EQ(bytes_for_reading.ReadUint32(), 0); - CHECK_EQ(bytes_for_reading.ReadUint8(), 0); - CHECK_EQ(bytes_for_reading.ReadUint8(), 100); - CHECK_EQ(bytes_for_reading.ReadQuarter(), 3); - CHECK_EQ(bytes_for_reading.ReadQuarter(), 0); - CHECK_EQ(bytes_for_reading.ReadQuarter(), 2); - CHECK_EQ(bytes_for_reading.ReadQuarter(), 1); - CHECK_EQ(bytes_for_reading.ReadQuarter(), 0); - CHECK_EQ(bytes_for_reading.ReadUint8(), 50); - CHECK_EQ(bytes_for_reading.ReadQuarter(), 0); - CHECK_EQ(bytes_for_reading.ReadQuarter(), 1); - CHECK_EQ(bytes_for_reading.ReadQuarter(), 2); - CHECK_EQ(bytes_for_reading.ReadUint32(), 50); - CHECK_EQ(bytes_for_reading.ReadQuarter(), 2); + CHECK_EQ(bytes_for_reading.ReadUint32(), 2147483647); + CHECK_EQ(bytes_for_reading.ReadUint8(), 4); + CHECK_EQ(bytes_for_reading.ReadUint8(), 255); + CHECK_EQ(bytes_for_reading.ReadUint32(), 0); + CHECK_EQ(bytes_for_reading.ReadUint8(), 0); + CHECK_EQ(bytes_for_reading.ReadUint8(), 100); + CHECK_EQ(bytes_for_reading.ReadQuarter(), 3); + CHECK_EQ(bytes_for_reading.ReadQuarter(), 0); + CHECK_EQ(bytes_for_reading.ReadQuarter(), 2); + CHECK_EQ(bytes_for_reading.ReadQuarter(), 1); + CHECK_EQ(bytes_for_reading.ReadQuarter(), 0); + CHECK_EQ(bytes_for_reading.ReadUint8(), 50); + CHECK_EQ(bytes_for_reading.ReadQuarter(), 0); + CHECK_EQ(bytes_for_reading.ReadQuarter(), 1); + CHECK_EQ(bytes_for_reading.ReadQuarter(), 2); + CHECK_EQ(bytes_for_reading.ReadUint32(), 50); + CHECK_EQ(bytes_for_reading.ReadQuarter(), 2); + } + + { + // Serialize as an OnHeapConsumedPreParsedScopeData, and read back data. + i::Handle<i::PodArray<uint8_t>> data_on_heap = bytes.Serialize(isolate); + i::OnHeapConsumedPreParsedScopeData::ByteData bytes_for_reading; + i::OnHeapConsumedPreParsedScopeData::ByteData::ReadingScope reading_scope( + &bytes_for_reading, *data_on_heap); + +#ifdef DEBUG + CHECK_EQ(bytes_for_reading.ReadUint32(), 2017); +#else + CHECK_EQ(bytes_for_reading.ReadUint32(), 1983); +#endif + CHECK_EQ(bytes_for_reading.ReadUint32(), 2147483647); + CHECK_EQ(bytes_for_reading.ReadUint8(), 4); + CHECK_EQ(bytes_for_reading.ReadUint8(), 255); + CHECK_EQ(bytes_for_reading.ReadUint32(), 0); + CHECK_EQ(bytes_for_reading.ReadUint8(), 0); + CHECK_EQ(bytes_for_reading.ReadUint8(), 100); + CHECK_EQ(bytes_for_reading.ReadQuarter(), 3); + CHECK_EQ(bytes_for_reading.ReadQuarter(), 0); + CHECK_EQ(bytes_for_reading.ReadQuarter(), 2); + CHECK_EQ(bytes_for_reading.ReadQuarter(), 1); + CHECK_EQ(bytes_for_reading.ReadQuarter(), 0); + CHECK_EQ(bytes_for_reading.ReadUint8(), 50); + CHECK_EQ(bytes_for_reading.ReadQuarter(), 0); + CHECK_EQ(bytes_for_reading.ReadQuarter(), 1); + CHECK_EQ(bytes_for_reading.ReadQuarter(), 2); + CHECK_EQ(bytes_for_reading.ReadUint32(), 50); + CHECK_EQ(bytes_for_reading.ReadQuarter(), 2); + } } diff --git a/deps/v8/test/cctest/parsing/test-scanner-streams.cc b/deps/v8/test/cctest/parsing/test-scanner-streams.cc index a9dc4482ef..bb05231f08 100644 --- a/deps/v8/test/cctest/parsing/test-scanner-streams.cc +++ b/deps/v8/test/cctest/parsing/test-scanner-streams.cc @@ -40,7 +40,7 @@ class ChunkSource : public v8::ScriptCompiler::ExternalSourceStream { } chunks_.push_back({nullptr, 0}); } - ~ChunkSource() {} + ~ChunkSource() override = default; bool SetBookmark() override { return false; } void ResetToBookmark() override {} size_t GetMoreData(const uint8_t** src) override { @@ -61,15 +61,43 @@ class ChunkSource : public v8::ScriptCompiler::ExternalSourceStream { size_t current_; }; -class TestExternalResource : public v8::String::ExternalStringResource { +// Checks that Lock() / Unlock() pairs are balanced. Not thread-safe. +class LockChecker { + public: + LockChecker() : lock_depth_(0) {} + ~LockChecker() { CHECK_EQ(0, lock_depth_); } + + void Lock() const { lock_depth_++; } + + void Unlock() const { + CHECK_GT(lock_depth_, 0); + lock_depth_--; + } + + bool IsLocked() const { return lock_depth_ > 0; } + + int LockDepth() const { return lock_depth_; } + + protected: + mutable int lock_depth_; +}; + +class TestExternalResource : public v8::String::ExternalStringResource, + public LockChecker { public: explicit TestExternalResource(uint16_t* data, int length) - : data_(data), length_(static_cast<size_t>(length)) {} + : LockChecker(), data_(data), length_(static_cast<size_t>(length)) {} + + const uint16_t* data() const override { + CHECK(IsLocked()); + return data_; + } - ~TestExternalResource() {} + size_t length() const override { return length_; } - const uint16_t* data() const { return data_; } - size_t length() const { return length_; } + bool IsCacheable() const override { return false; } + void Lock() const override { LockChecker::Lock(); } + void Unlock() const override { LockChecker::Unlock(); } private: uint16_t* data_; @@ -77,13 +105,21 @@ class TestExternalResource : public v8::String::ExternalStringResource { }; class TestExternalOneByteResource - : public v8::String::ExternalOneByteStringResource { + : public v8::String::ExternalOneByteStringResource, + public LockChecker { public: TestExternalOneByteResource(const char* data, size_t length) : data_(data), length_(length) {} - const char* data() const { return data_; } - size_t length() const { return length_; } + const char* data() const override { + CHECK(IsLocked()); + return data_; + } + size_t length() const override { return length_; } + + bool IsCacheable() const override { return false; } + void Lock() const override { LockChecker::Lock(); } + void Unlock() const override { LockChecker::Unlock(); } private: const char* data_; @@ -101,6 +137,17 @@ const char unicode_utf8[] = const uint16_t unicode_ucs2[] = {97, 98, 99, 228, 10784, 55357, 56489, 100, 101, 102, 0}; +i::Handle<i::String> NewExternalTwoByteStringFromResource( + i::Isolate* isolate, TestExternalResource* resource) { + i::Factory* factory = isolate->factory(); + // String creation accesses the resource. + resource->Lock(); + i::Handle<i::String> uc16_string( + factory->NewExternalStringFromTwoByte(resource).ToHandleChecked()); + resource->Unlock(); + return uc16_string; +} + } // anonymous namespace TEST(Utf8StreamAsciiOnly) { @@ -108,7 +155,7 @@ TEST(Utf8StreamAsciiOnly) { ChunkSource chunk_source(chunks); std::unique_ptr<v8::internal::Utf16CharacterStream> stream( v8::internal::ScannerStream::For( - &chunk_source, v8::ScriptCompiler::StreamedSource::UTF8, nullptr)); + &chunk_source, v8::ScriptCompiler::StreamedSource::UTF8)); // Read the data without dying. v8::internal::uc32 c; @@ -126,7 +173,7 @@ TEST(Utf8StreamBOM) { ChunkSource chunk_source(chunks); std::unique_ptr<v8::internal::Utf16CharacterStream> stream( v8::internal::ScannerStream::For( - &chunk_source, v8::ScriptCompiler::StreamedSource::UTF8, nullptr)); + &chunk_source, v8::ScriptCompiler::StreamedSource::UTF8)); // Read the data without tripping over the BOM. for (size_t i = 0; unicode_ucs2[i]; i++) { @@ -160,7 +207,7 @@ TEST(Utf8SplitBOM) { ChunkSource chunk_source(chunks); std::unique_ptr<v8::internal::Utf16CharacterStream> stream( v8::internal::ScannerStream::For( - &chunk_source, v8::ScriptCompiler::StreamedSource::UTF8, nullptr)); + &chunk_source, v8::ScriptCompiler::StreamedSource::UTF8)); // Read the data without tripping over the BOM. for (size_t i = 0; unicode_ucs2[i]; i++) { @@ -176,7 +223,7 @@ TEST(Utf8SplitBOM) { ChunkSource chunk_source(chunks); std::unique_ptr<v8::internal::Utf16CharacterStream> stream( v8::internal::ScannerStream::For( - &chunk_source, v8::ScriptCompiler::StreamedSource::UTF8, nullptr)); + &chunk_source, v8::ScriptCompiler::StreamedSource::UTF8)); // Read the data without tripping over the BOM. for (size_t i = 0; unicode_ucs2[i]; i++) { @@ -191,7 +238,7 @@ TEST(Utf8SplitMultiBOM) { ChunkSource chunk_source(chunks); std::unique_ptr<i::Utf16CharacterStream> stream( v8::internal::ScannerStream::For( - &chunk_source, v8::ScriptCompiler::StreamedSource::UTF8, nullptr)); + &chunk_source, v8::ScriptCompiler::StreamedSource::UTF8)); // Read the data, ensuring we get exactly one of the two BOMs back. CHECK_EQ(0xFEFF, stream->Advance()); @@ -213,7 +260,7 @@ TEST(Utf8AdvanceUntil) { ChunkSource chunk_source(chunks); std::unique_ptr<v8::internal::Utf16CharacterStream> stream( v8::internal::ScannerStream::For( - &chunk_source, v8::ScriptCompiler::StreamedSource::UTF8, nullptr)); + &chunk_source, v8::ScriptCompiler::StreamedSource::UTF8)); int32_t res = stream->AdvanceUntil( [](int32_t c0_) { return unibrow::IsLineTerminator(c0_); }); @@ -232,14 +279,12 @@ TEST(AdvanceMatchAdvanceUntil) { std::unique_ptr<v8::internal::Utf16CharacterStream> stream_advance( v8::internal::ScannerStream::For( - &chunk_source_a, v8::ScriptCompiler::StreamedSource::UTF8, - nullptr)); + &chunk_source_a, v8::ScriptCompiler::StreamedSource::UTF8)); ChunkSource chunk_source_au(chunks); std::unique_ptr<v8::internal::Utf16CharacterStream> stream_advance_until( v8::internal::ScannerStream::For( - &chunk_source_au, v8::ScriptCompiler::StreamedSource::UTF8, - nullptr)); + &chunk_source_au, v8::ScriptCompiler::StreamedSource::UTF8)); int32_t au_c0_ = stream_advance_until->AdvanceUntil( [](int32_t c0_) { return unibrow::IsLineTerminator(c0_); }); @@ -281,7 +326,7 @@ TEST(Utf8AdvanceUntilOverChunkBoundaries) { ChunkSource chunk_source(chunks); std::unique_ptr<v8::internal::Utf16CharacterStream> stream( v8::internal::ScannerStream::For( - &chunk_source, v8::ScriptCompiler::StreamedSource::UTF8, nullptr)); + &chunk_source, v8::ScriptCompiler::StreamedSource::UTF8)); int32_t res = stream->AdvanceUntil( [](int32_t c0_) { return unibrow::IsLineTerminator(c0_); }); @@ -309,7 +354,7 @@ TEST(Utf8ChunkBoundaries) { ChunkSource chunk_source(chunks); std::unique_ptr<v8::internal::Utf16CharacterStream> stream( v8::internal::ScannerStream::For( - &chunk_source, v8::ScriptCompiler::StreamedSource::UTF8, nullptr)); + &chunk_source, v8::ScriptCompiler::StreamedSource::UTF8)); for (size_t i = 0; unicode_ucs2[i]; i++) { CHECK_EQ(unicode_ucs2[i], stream->Advance()); @@ -338,7 +383,7 @@ TEST(Utf8SingleByteChunks) { ChunkSource chunk_source(chunks); std::unique_ptr<v8::internal::Utf16CharacterStream> stream( v8::internal::ScannerStream::For( - &chunk_source, v8::ScriptCompiler::StreamedSource::UTF8, nullptr)); + &chunk_source, v8::ScriptCompiler::StreamedSource::UTF8)); for (size_t j = 0; unicode_ucs2[j]; j++) { CHECK_EQ(unicode_ucs2[j], stream->Advance()); @@ -400,6 +445,26 @@ void TestCharacterStream(const char* reference, i::Utf16CharacterStream* stream, CHECK_LT(stream->Advance(), 0); } +void TestCloneCharacterStream(const char* reference, + i::Utf16CharacterStream* stream, + unsigned length) { + std::unique_ptr<i::Utf16CharacterStream> clone = stream->Clone(); + + unsigned i; + unsigned halfway = length / 2; + // Advance original half way. + for (i = 0; i < halfway; i++) { + CHECK_EQU(i, stream->pos()); + CHECK_EQU(reference[i], stream->Advance()); + } + + // Test advancing original stream didn't affect the clone. + TestCharacterStream(reference, clone.get(), length, 0, length); + + // Test advancing clone didn't affect original stream. + TestCharacterStream(reference, stream, length, i, length); +} + #undef CHECK_EQU void TestCharacterStreams(const char* one_byte_source, unsigned length, @@ -419,7 +484,7 @@ void TestCharacterStreams(const char* one_byte_source, unsigned length, } TestExternalResource resource(uc16_buffer.get(), length); i::Handle<i::String> uc16_string( - factory->NewExternalStringFromTwoByte(&resource).ToHandleChecked()); + NewExternalTwoByteStringFromResource(isolate, &resource)); std::unique_ptr<i::Utf16CharacterStream> uc16_stream( i::ScannerStream::For(isolate, uc16_string, start, end)); TestCharacterStream(one_byte_source, uc16_stream.get(), length, start, end); @@ -480,14 +545,13 @@ void TestCharacterStreams(const char* one_byte_source, unsigned length, ChunkSource single_chunk(data, 1, data_end - data, false); std::unique_ptr<i::Utf16CharacterStream> one_byte_streaming_stream( i::ScannerStream::For(&single_chunk, - v8::ScriptCompiler::StreamedSource::ONE_BYTE, - nullptr)); + v8::ScriptCompiler::StreamedSource::ONE_BYTE)); TestCharacterStream(one_byte_source, one_byte_streaming_stream.get(), length, start, end); ChunkSource many_chunks(data, 1, data_end - data, true); one_byte_streaming_stream.reset(i::ScannerStream::For( - &many_chunks, v8::ScriptCompiler::StreamedSource::ONE_BYTE, nullptr)); + &many_chunks, v8::ScriptCompiler::StreamedSource::ONE_BYTE)); TestCharacterStream(one_byte_source, one_byte_streaming_stream.get(), length, start, end); } @@ -498,14 +562,14 @@ void TestCharacterStreams(const char* one_byte_source, unsigned length, const uint8_t* data_end = one_byte_vector.end(); ChunkSource chunks(data, 1, data_end - data, false); std::unique_ptr<i::Utf16CharacterStream> utf8_streaming_stream( - i::ScannerStream::For(&chunks, v8::ScriptCompiler::StreamedSource::UTF8, - nullptr)); + i::ScannerStream::For(&chunks, + v8::ScriptCompiler::StreamedSource::UTF8)); TestCharacterStream(one_byte_source, utf8_streaming_stream.get(), length, start, end); ChunkSource many_chunks(data, 1, data_end - data, true); utf8_streaming_stream.reset(i::ScannerStream::For( - &many_chunks, v8::ScriptCompiler::StreamedSource::UTF8, nullptr)); + &many_chunks, v8::ScriptCompiler::StreamedSource::UTF8)); TestCharacterStream(one_byte_source, utf8_streaming_stream.get(), length, start, end); } @@ -518,14 +582,14 @@ void TestCharacterStreams(const char* one_byte_source, unsigned length, reinterpret_cast<const uint8_t*>(two_byte_vector.end()); ChunkSource chunks(data, 2, data_end - data, false); std::unique_ptr<i::Utf16CharacterStream> two_byte_streaming_stream( - i::ScannerStream::For( - &chunks, v8::ScriptCompiler::StreamedSource::TWO_BYTE, nullptr)); + i::ScannerStream::For(&chunks, + v8::ScriptCompiler::StreamedSource::TWO_BYTE)); TestCharacterStream(one_byte_source, two_byte_streaming_stream.get(), length, start, end); ChunkSource many_chunks(data, 2, data_end - data, true); two_byte_streaming_stream.reset(i::ScannerStream::For( - &many_chunks, v8::ScriptCompiler::StreamedSource::TWO_BYTE, nullptr)); + &many_chunks, v8::ScriptCompiler::StreamedSource::TWO_BYTE)); TestCharacterStream(one_byte_source, two_byte_streaming_stream.get(), length, start, end); } @@ -567,7 +631,7 @@ TEST(Regress651333) { // 65533) instead of the incorrectly coded Latin1 char. ChunkSource chunks(bytes, 1, len, false); std::unique_ptr<i::Utf16CharacterStream> stream(i::ScannerStream::For( - &chunks, v8::ScriptCompiler::StreamedSource::UTF8, nullptr)); + &chunks, v8::ScriptCompiler::StreamedSource::UTF8)); for (size_t i = 0; i < len; i++) { CHECK_EQ(unicode[i], stream->Advance()); } @@ -581,7 +645,7 @@ void TestChunkStreamAgainstReference( for (size_t c = 0; c < unicode_expected.size(); ++c) { ChunkSource chunk_source(cases[c]); std::unique_ptr<i::Utf16CharacterStream> stream(i::ScannerStream::For( - &chunk_source, v8::ScriptCompiler::StreamedSource::UTF8, nullptr)); + &chunk_source, v8::ScriptCompiler::StreamedSource::UTF8)); for (size_t i = 0; i < unicode_expected[c].size(); i++) { CHECK_EQ(unicode_expected[c][i], stream->Advance()); } @@ -695,3 +759,98 @@ TEST(RelocatingCharacterStream) { CHECK_EQ('c', two_byte_string_stream->Advance()); CHECK_EQ('d', two_byte_string_stream->Advance()); } + +TEST(CloneCharacterStreams) { + v8::HandleScope handles(CcTest::isolate()); + v8::Local<v8::Context> context = v8::Context::New(CcTest::isolate()); + v8::Context::Scope context_scope(context); + + i::Isolate* isolate = CcTest::i_isolate(); + i::Factory* factory = isolate->factory(); + + const char* one_byte_source = "abcdefghi"; + unsigned length = static_cast<unsigned>(strlen(one_byte_source)); + + // Check that cloning a character stream does not update + + // 2-byte external string + std::unique_ptr<i::uc16[]> uc16_buffer(new i::uc16[length]); + i::Vector<const i::uc16> two_byte_vector(uc16_buffer.get(), + static_cast<int>(length)); + { + for (unsigned i = 0; i < length; i++) { + uc16_buffer[i] = static_cast<i::uc16>(one_byte_source[i]); + } + TestExternalResource resource(uc16_buffer.get(), length); + i::Handle<i::String> uc16_string( + NewExternalTwoByteStringFromResource(isolate, &resource)); + std::unique_ptr<i::Utf16CharacterStream> uc16_stream( + i::ScannerStream::For(isolate, uc16_string, 0, length)); + + CHECK(resource.IsLocked()); + CHECK_EQ(1, resource.LockDepth()); + std::unique_ptr<i::Utf16CharacterStream> cloned = uc16_stream->Clone(); + CHECK_EQ(2, resource.LockDepth()); + uc16_stream = std::move(cloned); + CHECK_EQ(1, resource.LockDepth()); + + TestCloneCharacterStream(one_byte_source, uc16_stream.get(), length); + + // This avoids the GC from trying to free a stack allocated resource. + if (uc16_string->IsExternalString()) + i::Handle<i::ExternalTwoByteString>::cast(uc16_string) + ->SetResource(isolate, nullptr); + } + + // 1-byte external string + i::Vector<const uint8_t> one_byte_vector = + i::OneByteVector(one_byte_source, static_cast<int>(length)); + i::Handle<i::String> one_byte_string = + factory->NewStringFromOneByte(one_byte_vector).ToHandleChecked(); + { + TestExternalOneByteResource one_byte_resource(one_byte_source, length); + i::Handle<i::String> ext_one_byte_string( + factory->NewExternalStringFromOneByte(&one_byte_resource) + .ToHandleChecked()); + std::unique_ptr<i::Utf16CharacterStream> one_byte_stream( + i::ScannerStream::For(isolate, ext_one_byte_string, 0, length)); + TestCloneCharacterStream(one_byte_source, one_byte_stream.get(), length); + // This avoids the GC from trying to free a stack allocated resource. + if (ext_one_byte_string->IsExternalString()) + i::Handle<i::ExternalOneByteString>::cast(ext_one_byte_string) + ->SetResource(isolate, nullptr); + } + + // Relocatinable streams aren't clonable. + { + std::unique_ptr<i::Utf16CharacterStream> string_stream( + i::ScannerStream::For(isolate, one_byte_string, 0, length)); + CHECK(!string_stream->can_be_cloned()); + + i::Handle<i::String> two_byte_string = + factory->NewStringFromTwoByte(two_byte_vector).ToHandleChecked(); + std::unique_ptr<i::Utf16CharacterStream> two_byte_string_stream( + i::ScannerStream::For(isolate, two_byte_string, 0, length)); + CHECK(!two_byte_string_stream->can_be_cloned()); + } + + // Chunk sources currently not cloneable. + { + const char* chunks[] = {"1234", "\0"}; + ChunkSource chunk_source(chunks); + std::unique_ptr<i::Utf16CharacterStream> one_byte_streaming_stream( + i::ScannerStream::For(&chunk_source, + v8::ScriptCompiler::StreamedSource::ONE_BYTE)); + CHECK(!one_byte_streaming_stream->can_be_cloned()); + + std::unique_ptr<i::Utf16CharacterStream> utf8_streaming_stream( + i::ScannerStream::For(&chunk_source, + v8::ScriptCompiler::StreamedSource::UTF8)); + CHECK(!utf8_streaming_stream->can_be_cloned()); + + std::unique_ptr<i::Utf16CharacterStream> two_byte_streaming_stream( + i::ScannerStream::For(&chunk_source, + v8::ScriptCompiler::StreamedSource::TWO_BYTE)); + CHECK(!two_byte_streaming_stream->can_be_cloned()); + } +} diff --git a/deps/v8/test/cctest/print-extension.h b/deps/v8/test/cctest/print-extension.h index 922d116efd..a2d237d667 100644 --- a/deps/v8/test/cctest/print-extension.h +++ b/deps/v8/test/cctest/print-extension.h @@ -36,8 +36,8 @@ namespace internal { class PrintExtension : public v8::Extension { public: PrintExtension() : v8::Extension("v8/print", "native function print();") { } - virtual v8::Local<v8::FunctionTemplate> GetNativeFunctionTemplate( - v8::Isolate* isolate, v8::Local<v8::String> name); + v8::Local<v8::FunctionTemplate> GetNativeFunctionTemplate( + v8::Isolate* isolate, v8::Local<v8::String> name) override; static void Print(const v8::FunctionCallbackInfo<v8::Value>& args); }; diff --git a/deps/v8/test/cctest/profiler-extension.h b/deps/v8/test/cctest/profiler-extension.h index dbc12f47a0..f2be3a1334 100644 --- a/deps/v8/test/cctest/profiler-extension.h +++ b/deps/v8/test/cctest/profiler-extension.h @@ -41,8 +41,8 @@ class ProfilerExtension : public v8::Extension { public: ProfilerExtension() : v8::Extension("v8/profiler", kSource) { } - virtual v8::Local<v8::FunctionTemplate> GetNativeFunctionTemplate( - v8::Isolate* isolate, v8::Local<v8::String> name); + v8::Local<v8::FunctionTemplate> GetNativeFunctionTemplate( + v8::Isolate* isolate, v8::Local<v8::String> name) override; static void set_profiler(v8::CpuProfiler* profiler) { profiler_ = profiler; } static void set_profiler(CpuProfiler* profiler) { diff --git a/deps/v8/test/cctest/scope-test-helper.h b/deps/v8/test/cctest/scope-test-helper.h index 8c69307d3e..8dd49970a1 100644 --- a/deps/v8/test/cctest/scope-test-helper.h +++ b/deps/v8/test/cctest/scope-test-helper.h @@ -24,7 +24,7 @@ class ScopeTestHelper { baseline->AsDeclarationScope()->function_kind() == scope->AsDeclarationScope()->function_kind()); - if (!ProducedPreParsedScopeData::ScopeNeedsData(baseline)) { + if (!PreParsedScopeDataBuilder::ScopeNeedsData(baseline)) { return; } diff --git a/deps/v8/test/cctest/setup-isolate-for-tests.cc b/deps/v8/test/cctest/setup-isolate-for-tests.cc index ba9c4fb488..8aae2de769 100644 --- a/deps/v8/test/cctest/setup-isolate-for-tests.cc +++ b/deps/v8/test/cctest/setup-isolate-for-tests.cc @@ -4,8 +4,6 @@ #include "test/cctest/setup-isolate-for-tests.h" -#include "src/interpreter/setup-interpreter.h" - namespace v8 { namespace internal { @@ -15,13 +13,6 @@ void SetupIsolateDelegateForTests::SetupBuiltins(Isolate* isolate) { } } -void SetupIsolateDelegateForTests::SetupInterpreter( - interpreter::Interpreter* interpreter) { - if (create_heap_objects_) { - interpreter::SetupInterpreter::InstallBytecodeHandlers(interpreter); - } -} - bool SetupIsolateDelegateForTests::SetupHeap(Heap* heap) { if (create_heap_objects_) { return SetupHeapInternal(heap); diff --git a/deps/v8/test/cctest/setup-isolate-for-tests.h b/deps/v8/test/cctest/setup-isolate-for-tests.h index e3d34725f0..c026c04afd 100644 --- a/deps/v8/test/cctest/setup-isolate-for-tests.h +++ b/deps/v8/test/cctest/setup-isolate-for-tests.h @@ -14,12 +14,10 @@ class SetupIsolateDelegateForTests : public SetupIsolateDelegate { public: explicit SetupIsolateDelegateForTests(bool create_heap_objects) : SetupIsolateDelegate(create_heap_objects) {} - virtual ~SetupIsolateDelegateForTests() {} + ~SetupIsolateDelegateForTests() override = default; void SetupBuiltins(Isolate* isolate) override; - void SetupInterpreter(interpreter::Interpreter* interpreter) override; - bool SetupHeap(Heap* heap) override; }; diff --git a/deps/v8/test/cctest/test-accessors.cc b/deps/v8/test/cctest/test-accessors.cc index de1901b6d3..a6a02ba762 100644 --- a/deps/v8/test/cctest/test-accessors.cc +++ b/deps/v8/test/cctest/test-accessors.cc @@ -181,7 +181,7 @@ THREADED_TEST(GlobalVariableAccess) { templ->InstanceTemplate()->SetAccessor( v8_str("baz"), GetIntValue, SetIntValue, v8::External::New(isolate, &baz)); - LocalContext env(0, templ->InstanceTemplate()); + LocalContext env(nullptr, templ->InstanceTemplate()); v8_compile("foo = (++bar) + baz")->Run(env.local()).ToLocalChecked(); CHECK_EQ(-3, bar); CHECK_EQ(7, foo); diff --git a/deps/v8/test/cctest/test-allocation.cc b/deps/v8/test/cctest/test-allocation.cc index 139829dd2b..d5ba49c537 100644 --- a/deps/v8/test/cctest/test-allocation.cc +++ b/deps/v8/test/cctest/test-allocation.cc @@ -37,7 +37,7 @@ class AllocationPlatform : public TestPlatform { // Now that it's completely constructed, make this the current platform. i::V8::SetPlatformForTesting(this); } - virtual ~AllocationPlatform() = default; + ~AllocationPlatform() override = default; void OnCriticalMemoryPressure() override { oom_callback_called = true; } @@ -141,24 +141,20 @@ TEST(AlignedAllocOOM) { TEST(AllocVirtualMemoryOOM) { AllocationPlatform platform; CHECK(!platform.oom_callback_called); - v8::internal::VirtualMemory result; - bool success = - v8::internal::AllocVirtualMemory(GetHugeMemoryAmount(), nullptr, &result); + v8::internal::VirtualMemory result(v8::internal::GetPlatformPageAllocator(), + GetHugeMemoryAmount(), nullptr); // On a few systems, allocation somehow succeeds. - CHECK_IMPLIES(success, result.IsReserved()); - CHECK_IMPLIES(!success, !result.IsReserved() && platform.oom_callback_called); + CHECK_IMPLIES(!result.IsReserved(), platform.oom_callback_called); } TEST(AlignedAllocVirtualMemoryOOM) { AllocationPlatform platform; CHECK(!platform.oom_callback_called); - v8::internal::VirtualMemory result; - bool success = v8::internal::AlignedAllocVirtualMemory( - GetHugeMemoryAmount(), v8::internal::AllocatePageSize(), nullptr, - &result); + v8::internal::VirtualMemory result(v8::internal::GetPlatformPageAllocator(), + GetHugeMemoryAmount(), nullptr, + v8::internal::AllocatePageSize()); // On a few systems, allocation somehow succeeds. - CHECK_IMPLIES(success, result.IsReserved()); - CHECK_IMPLIES(!success, !result.IsReserved() && platform.oom_callback_called); + CHECK_IMPLIES(!result.IsReserved(), platform.oom_callback_called); } #endif // !defined(V8_USE_ADDRESS_SANITIZER) && !defined(MEMORY_SANITIZER) && diff --git a/deps/v8/test/cctest/test-api-accessors.cc b/deps/v8/test/cctest/test-api-accessors.cc index 5bda0432ea..7c0a7ee8cb 100644 --- a/deps/v8/test/cctest/test-api-accessors.cc +++ b/deps/v8/test/cctest/test-api-accessors.cc @@ -240,8 +240,12 @@ static void Getter(v8::Local<v8::Name> name, static void StringGetter(v8::Local<v8::String> name, const v8::PropertyCallbackInfo<v8::Value>& info) {} -static void Setter(v8::Local<v8::String> name, v8::Local<v8::Value> value, - const v8::PropertyCallbackInfo<void>& info) {} +static int set_accessor_call_count = 0; + +static void Setter(v8::Local<v8::Name> name, v8::Local<v8::Value> value, + const v8::PropertyCallbackInfo<void>& info) { + set_accessor_call_count++; +} } // namespace // Re-declaration of non-configurable accessors should throw. @@ -281,7 +285,7 @@ TEST(AccessorSetHasNoSideEffect) { obj->SetAccessor(context, v8_str("foo"), Getter).ToChecked(); CHECK(v8::debug::EvaluateGlobal(isolate, v8_str("obj.foo"), true).IsEmpty()); - obj->SetAccessor(context, v8_str("foo"), Getter, 0, + obj->SetAccessor(context, v8_str("foo"), Getter, nullptr, v8::MaybeLocal<v8::Value>(), v8::AccessControl::DEFAULT, v8::PropertyAttribute::None, v8::SideEffectType::kHasNoSideEffect) @@ -297,6 +301,65 @@ TEST(AccessorSetHasNoSideEffect) { .ToLocalChecked() ->Int32Value(env.local()) .FromJust()); + CHECK_EQ(0, set_accessor_call_count); +} + +// Set accessors can be whitelisted as side-effect-free via SetAccessor. +TEST(SetAccessorSetSideEffectReceiverCheck1) { + LocalContext env; + v8::Isolate* isolate = env->GetIsolate(); + v8::HandleScope scope(isolate); + + v8::Local<v8::ObjectTemplate> templ = v8::ObjectTemplate::New(isolate); + v8::Local<v8::Object> obj = templ->NewInstance(env.local()).ToLocalChecked(); + CHECK(env->Global()->Set(env.local(), v8_str("obj"), obj).FromJust()); + obj->SetAccessor(env.local(), v8_str("foo"), Getter, Setter, + v8::MaybeLocal<v8::Value>(), v8::AccessControl::DEFAULT, + v8::PropertyAttribute::None, + v8::SideEffectType::kHasNoSideEffect, + v8::SideEffectType::kHasSideEffectToReceiver) + .ToChecked(); + CHECK(v8::debug::EvaluateGlobal(isolate, v8_str("obj.foo"), true) + .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) + .IsEmpty()); + CHECK(try_catch.HasCaught()); + CHECK_EQ(0, set_accessor_call_count); +} + +static void ConstructCallback(const v8::FunctionCallbackInfo<v8::Value>& info) { +} + +TEST(SetAccessorSetSideEffectReceiverCheck2) { + LocalContext env; + v8::Isolate* isolate = env->GetIsolate(); + v8::HandleScope scope(isolate); + i::FLAG_enable_one_shot_optimization = false; + + v8::Local<v8::FunctionTemplate> templ = v8::FunctionTemplate::New( + isolate, ConstructCallback, v8::Local<v8::Value>(), + v8::Local<v8::Signature>(), 0, v8::ConstructorBehavior::kAllow, + v8::SideEffectType::kHasNoSideEffect); + templ->InstanceTemplate()->SetAccessor( + v8_str("bar"), Getter, Setter, v8::Local<v8::Value>(), + v8::AccessControl::DEFAULT, v8::PropertyAttribute::None, + v8::Local<v8::AccessorSignature>(), + v8::SideEffectType::kHasSideEffectToReceiver, + v8::SideEffectType::kHasSideEffectToReceiver); + CHECK(env->Global() + ->Set(env.local(), v8_str("f"), + templ->GetFunction(env.local()).ToLocalChecked()) + .FromJust()); + CHECK(v8::debug::EvaluateGlobal(isolate, v8_str("new f().bar"), true) + .ToLocalChecked() + ->Equals(env.local(), v8_str("return value")) + .FromJust()); + v8::debug::EvaluateGlobal(isolate, v8_str("new f().bar = 1"), true) + .ToLocalChecked(); + CHECK_EQ(1, set_accessor_call_count); } // Accessors can be whitelisted as side-effect-free via SetNativeDataProperty. @@ -366,10 +429,10 @@ TEST(ObjectTemplateSetAccessorHasNoSideEffect) { v8::Local<v8::ObjectTemplate> templ = v8::ObjectTemplate::New(isolate); templ->SetAccessor(v8_str("foo"), StringGetter); - templ->SetAccessor(v8_str("foo2"), StringGetter, 0, v8::Local<v8::Value>(), - v8::AccessControl::DEFAULT, v8::PropertyAttribute::None, - v8::Local<v8::AccessorSignature>(), - v8::SideEffectType::kHasNoSideEffect); + templ->SetAccessor( + v8_str("foo2"), StringGetter, nullptr, v8::Local<v8::Value>(), + v8::AccessControl::DEFAULT, v8::PropertyAttribute::None, + v8::Local<v8::AccessorSignature>(), v8::SideEffectType::kHasNoSideEffect); v8::Local<v8::Object> obj = templ->NewInstance(env.local()).ToLocalChecked(); CHECK(env->Global()->Set(env.local(), v8_str("obj"), obj).FromJust()); @@ -395,7 +458,7 @@ TEST(ObjectTemplateSetNativePropertyHasNoSideEffect) { v8::Local<v8::ObjectTemplate> templ = v8::ObjectTemplate::New(isolate); templ->SetNativeDataProperty(v8_str("foo"), Getter); templ->SetNativeDataProperty( - v8_str("foo2"), Getter, 0, v8::Local<v8::Value>(), + v8_str("foo2"), Getter, nullptr, v8::Local<v8::Value>(), v8::PropertyAttribute::None, v8::Local<v8::AccessorSignature>(), v8::AccessControl::DEFAULT, v8::SideEffectType::kHasNoSideEffect); v8::Local<v8::Object> obj = templ->NewInstance(env.local()).ToLocalChecked(); diff --git a/deps/v8/test/cctest/test-api-interceptors.cc b/deps/v8/test/cctest/test-api-interceptors.cc index 9d9138670e..3604af020f 100644 --- a/deps/v8/test/cctest/test-api-interceptors.cc +++ b/deps/v8/test/cctest/test-api-interceptors.cc @@ -393,11 +393,11 @@ void QueryCallback(Local<Name> property, // Examples that show when the query callback is triggered. THREADED_TEST(QueryInterceptor) { - v8::HandleScope scope(CcTest::isolate()); - v8::Local<v8::FunctionTemplate> templ = - v8::FunctionTemplate::New(CcTest::isolate()); + v8::Isolate* isolate = CcTest::isolate(); + v8::HandleScope scope(isolate); + v8::Local<v8::FunctionTemplate> templ = v8::FunctionTemplate::New(isolate); templ->InstanceTemplate()->SetHandler( - v8::NamedPropertyHandlerConfiguration(0, 0, QueryCallback)); + v8::NamedPropertyHandlerConfiguration(nullptr, nullptr, QueryCallback)); LocalContext env; env->Global() ->Set(env.local(), v8_str("obj"), templ->GetFunction(env.local()) @@ -430,43 +430,37 @@ THREADED_TEST(QueryInterceptor) { CHECK(v8_compile("obj.propertyIsEnumerable('enum');") ->Run(env.local()) .ToLocalChecked() - ->BooleanValue(env.local()) - .FromJust()); + ->BooleanValue(isolate)); CHECK_EQ(4, query_counter_int); CHECK(!v8_compile("obj.propertyIsEnumerable('not_enum');") ->Run(env.local()) .ToLocalChecked() - ->BooleanValue(env.local()) - .FromJust()); + ->BooleanValue(isolate)); CHECK_EQ(5, query_counter_int); CHECK(v8_compile("obj.hasOwnProperty('enum');") ->Run(env.local()) .ToLocalChecked() - ->BooleanValue(env.local()) - .FromJust()); + ->BooleanValue(isolate)); CHECK_EQ(5, query_counter_int); CHECK(v8_compile("obj.hasOwnProperty('not_enum');") ->Run(env.local()) .ToLocalChecked() - ->BooleanValue(env.local()) - .FromJust()); + ->BooleanValue(isolate)); CHECK_EQ(5, query_counter_int); CHECK(!v8_compile("obj.hasOwnProperty('x');") ->Run(env.local()) .ToLocalChecked() - ->BooleanValue(env.local()) - .FromJust()); + ->BooleanValue(isolate)); CHECK_EQ(6, query_counter_int); CHECK(!v8_compile("obj.propertyIsEnumerable('undef');") ->Run(env.local()) .ToLocalChecked() - ->BooleanValue(env.local()) - .FromJust()); + ->BooleanValue(isolate)); CHECK_EQ(7, query_counter_int); v8_compile("Object.defineProperty(obj, 'enum', {value: 42});") @@ -737,7 +731,8 @@ THREADED_TEST(DefinerCallbackGetAndDefine) { v8::Local<v8::FunctionTemplate> templ = v8::FunctionTemplate::New(CcTest::isolate()); templ->InstanceTemplate()->SetHandler(v8::NamedPropertyHandlerConfiguration( - GetterCallbackOrder, SetterCallback, 0, 0, 0, DefinerCallbackOrder)); + GetterCallbackOrder, SetterCallback, nullptr, nullptr, nullptr, + DefinerCallbackOrder)); LocalContext env; env->Global() ->Set(env.local(), v8_str("obj"), templ->GetFunction(env.local()) @@ -834,15 +829,15 @@ THREADED_TEST(InterceptorHasOwnProperty) { v8::Local<Value> value = CompileRun( "var o = new constructor();" "o.hasOwnProperty('ostehaps');"); - CHECK(!value->BooleanValue(context.local()).FromJust()); + CHECK(!value->BooleanValue(isolate)); value = CompileRun( "o.ostehaps = 42;" "o.hasOwnProperty('ostehaps');"); - CHECK(value->BooleanValue(context.local()).FromJust()); + CHECK(value->BooleanValue(isolate)); value = CompileRun( "var p = new constructor();" "p.hasOwnProperty('ostehaps');"); - CHECK(!value->BooleanValue(context.local()).FromJust()); + CHECK(!value->BooleanValue(isolate)); } @@ -876,7 +871,7 @@ THREADED_TEST(InterceptorHasOwnPropertyCausingGC) { "var o = new constructor();" "o.__proto__ = new String(x);" "o.hasOwnProperty('ostehaps');"); - CHECK(!value->BooleanValue(context.local()).FromJust()); + CHECK(!value->BooleanValue(isolate)); } @@ -886,8 +881,8 @@ static void CheckInterceptorLoadIC( v8::Isolate* isolate = CcTest::isolate(); v8::HandleScope scope(isolate); v8::Local<v8::ObjectTemplate> templ = ObjectTemplate::New(isolate); - templ->SetHandler(v8::NamedPropertyHandlerConfiguration(getter, 0, 0, 0, 0, - v8_str("data"))); + templ->SetHandler(v8::NamedPropertyHandlerConfiguration( + getter, nullptr, nullptr, nullptr, nullptr, v8_str("data"))); LocalContext context; context->Global() ->Set(context.local(), v8_str("o"), @@ -1353,7 +1348,7 @@ THREADED_TEST(InterceptorLoadGlobalICGlobalWithInterceptor) { " f();" "};" "f();"); - CHECK(value->BooleanValue(context.local()).FromJust()); + CHECK(value->BooleanValue(isolate)); value = CompileRun( "var f = function() { " @@ -1368,7 +1363,7 @@ THREADED_TEST(InterceptorLoadGlobalICGlobalWithInterceptor) { " f();" "};" "f();"); - CHECK(value->BooleanValue(context.local()).FromJust()); + CHECK(value->BooleanValue(isolate)); value = CompileRun( "var f = function() { " @@ -1383,7 +1378,7 @@ THREADED_TEST(InterceptorLoadGlobalICGlobalWithInterceptor) { " f();" "};" "f();"); - CHECK(value->BooleanValue(context.local()).FromJust()); + CHECK(value->BooleanValue(isolate)); } // Test load of a non-existing global through prototype chain when a global @@ -1454,8 +1449,8 @@ THREADED_TEST(InterceptorStoreIC) { v8::HandleScope scope(isolate); v8::Local<v8::ObjectTemplate> templ = ObjectTemplate::New(isolate); templ->SetHandler(v8::NamedPropertyHandlerConfiguration( - InterceptorLoadICGetter, InterceptorStoreICSetter, 0, 0, 0, - v8_str("data"))); + InterceptorLoadICGetter, InterceptorStoreICSetter, nullptr, nullptr, + nullptr, v8_str("data"))); LocalContext context; context->Global() ->Set(context.local(), v8_str("o"), @@ -1574,11 +1569,11 @@ THREADED_TEST(GenericInterceptorDoesSeeSymbols) { THREADED_TEST(NamedPropertyHandlerGetter) { echo_named_call_count = 0; - v8::HandleScope scope(CcTest::isolate()); - v8::Local<v8::FunctionTemplate> templ = - v8::FunctionTemplate::New(CcTest::isolate()); + v8::Isolate* isolate = CcTest::isolate(); + v8::HandleScope scope(isolate); + v8::Local<v8::FunctionTemplate> templ = v8::FunctionTemplate::New(isolate); templ->InstanceTemplate()->SetHandler(v8::NamedPropertyHandlerConfiguration( - EchoNamedProperty, 0, 0, 0, 0, v8_str("data"))); + EchoNamedProperty, nullptr, nullptr, nullptr, nullptr, v8_str("data"))); LocalContext env; env->Global() ->Set(env.local(), v8_str("obj"), templ->GetFunction(env.local()) @@ -1591,7 +1586,7 @@ THREADED_TEST(NamedPropertyHandlerGetter) { CHECK_EQ(1, echo_named_call_count); const char* code = "var str = 'oddle'; obj[str] + obj.poddle;"; v8::Local<Value> str = CompileRun(code); - String::Utf8Value value(CcTest::isolate(), str); + String::Utf8Value value(isolate, str); CHECK_EQ(0, strcmp(*value, "oddlepoddle")); // Check default behavior CHECK_EQ(10, v8_compile("obj.flob = 10;") @@ -1602,13 +1597,11 @@ THREADED_TEST(NamedPropertyHandlerGetter) { CHECK(v8_compile("'myProperty' in obj") ->Run(env.local()) .ToLocalChecked() - ->BooleanValue(env.local()) - .FromJust()); + ->BooleanValue(isolate)); CHECK(v8_compile("delete obj.myProperty") ->Run(env.local()) .ToLocalChecked() - ->BooleanValue(env.local()) - .FromJust()); + ->BooleanValue(isolate)); } namespace { @@ -1650,7 +1643,8 @@ THREADED_TEST(PropertyDefinerCallback) { v8::Local<v8::FunctionTemplate> templ = v8::FunctionTemplate::New(CcTest::isolate()); templ->InstanceTemplate()->SetHandler(v8::NamedPropertyHandlerConfiguration( - 0, 0, 0, 0, 0, NotInterceptingPropertyDefineCallback)); + nullptr, nullptr, nullptr, nullptr, nullptr, + NotInterceptingPropertyDefineCallback)); env->Global() ->Set(env.local(), v8_str("obj"), templ->GetFunction(env.local()) .ToLocalChecked() @@ -1672,7 +1666,8 @@ THREADED_TEST(PropertyDefinerCallback) { v8::Local<v8::FunctionTemplate> templ = v8::FunctionTemplate::New(CcTest::isolate()); templ->InstanceTemplate()->SetHandler(v8::NamedPropertyHandlerConfiguration( - 0, 0, 0, 0, 0, CheckDescriptorInDefineCallback)); + nullptr, nullptr, nullptr, nullptr, nullptr, + CheckDescriptorInDefineCallback)); env->Global() ->Set(env.local(), v8_str("obj"), templ->GetFunction(env.local()) .ToLocalChecked() @@ -1699,7 +1694,8 @@ THREADED_TEST(PropertyDefinerCallback) { v8::FunctionTemplate::New(CcTest::isolate()); templ2->InstanceTemplate()->SetHandler( v8::NamedPropertyHandlerConfiguration( - 0, 0, 0, 0, 0, InterceptingPropertyDefineCallback)); + nullptr, nullptr, nullptr, nullptr, nullptr, + InterceptingPropertyDefineCallback)); env->Global() ->Set(env.local(), v8_str("obj"), templ2->GetFunction(env.local()) .ToLocalChecked() @@ -1759,7 +1755,8 @@ THREADED_TEST(PropertyDefinerCallbackIndexed) { v8::FunctionTemplate::New(CcTest::isolate()); templ->InstanceTemplate()->SetHandler( v8::IndexedPropertyHandlerConfiguration( - 0, 0, 0, 0, 0, NotInterceptingPropertyDefineCallbackIndexed)); + nullptr, nullptr, nullptr, nullptr, nullptr, + NotInterceptingPropertyDefineCallbackIndexed)); env->Global() ->Set(env.local(), v8_str("obj"), templ->GetFunction(env.local()) .ToLocalChecked() @@ -1782,7 +1779,8 @@ THREADED_TEST(PropertyDefinerCallbackIndexed) { v8::FunctionTemplate::New(CcTest::isolate()); templ->InstanceTemplate()->SetHandler( v8::IndexedPropertyHandlerConfiguration( - 0, 0, 0, 0, 0, CheckDescriptorInDefineCallbackIndexed)); + nullptr, nullptr, nullptr, nullptr, nullptr, + CheckDescriptorInDefineCallbackIndexed)); env->Global() ->Set(env.local(), v8_str("obj"), templ->GetFunction(env.local()) .ToLocalChecked() @@ -1809,7 +1807,8 @@ THREADED_TEST(PropertyDefinerCallbackIndexed) { v8::FunctionTemplate::New(CcTest::isolate()); templ2->InstanceTemplate()->SetHandler( v8::IndexedPropertyHandlerConfiguration( - 0, 0, 0, 0, 0, InterceptingPropertyDefineCallbackIndexed)); + nullptr, nullptr, nullptr, nullptr, nullptr, + InterceptingPropertyDefineCallbackIndexed)); env->Global() ->Set(env.local(), v8_str("obj"), templ2->GetFunction(env.local()) .ToLocalChecked() @@ -1831,12 +1830,13 @@ THREADED_TEST(PropertyDefinerCallbackIndexed) { // Test that freeze() is intercepted. THREADED_TEST(PropertyDefinerCallbackForFreeze) { - v8::HandleScope scope(CcTest::isolate()); + v8::Isolate* isolate = CcTest::isolate(); + v8::HandleScope scope(isolate); LocalContext env; - v8::Local<v8::FunctionTemplate> templ = - v8::FunctionTemplate::New(CcTest::isolate()); + v8::Local<v8::FunctionTemplate> templ = v8::FunctionTemplate::New(isolate); templ->InstanceTemplate()->SetHandler(v8::NamedPropertyHandlerConfiguration( - 0, 0, 0, 0, 0, InterceptingPropertyDefineCallback)); + nullptr, nullptr, nullptr, nullptr, nullptr, + InterceptingPropertyDefineCallback)); env->Global() ->Set(env.local(), v8_str("obj"), templ->GetFunction(env.local()) .ToLocalChecked() @@ -1851,8 +1851,7 @@ THREADED_TEST(PropertyDefinerCallbackForFreeze) { CHECK(v8_compile(code) ->Run(env.local()) .ToLocalChecked() - ->BooleanValue(env.local()) - .FromJust()); + ->BooleanValue(isolate)); } // Check that the descriptor passed to the callback is enumerable. @@ -1878,7 +1877,8 @@ THREADED_TEST(PropertyDefinerCallbackEnumerable) { v8::Local<v8::FunctionTemplate> templ = v8::FunctionTemplate::New(CcTest::isolate()); templ->InstanceTemplate()->SetHandler(v8::NamedPropertyHandlerConfiguration( - 0, 0, 0, 0, 0, CheckEnumerablePropertyDefineCallback)); + nullptr, nullptr, nullptr, nullptr, nullptr, + CheckEnumerablePropertyDefineCallback)); env->Global() ->Set(env.local(), v8_str("obj"), templ->GetFunction(env.local()) .ToLocalChecked() @@ -1918,7 +1918,8 @@ THREADED_TEST(PropertyDefinerCallbackConfigurable) { v8::Local<v8::FunctionTemplate> templ = v8::FunctionTemplate::New(CcTest::isolate()); templ->InstanceTemplate()->SetHandler(v8::NamedPropertyHandlerConfiguration( - 0, 0, 0, 0, 0, CheckConfigurablePropertyDefineCallback)); + nullptr, nullptr, nullptr, nullptr, nullptr, + CheckConfigurablePropertyDefineCallback)); env->Global() ->Set(env.local(), v8_str("obj"), templ->GetFunction(env.local()) .ToLocalChecked() @@ -1954,7 +1955,8 @@ THREADED_TEST(PropertyDefinerCallbackWritable) { v8::Local<v8::FunctionTemplate> templ = v8::FunctionTemplate::New(CcTest::isolate()); templ->InstanceTemplate()->SetHandler(v8::NamedPropertyHandlerConfiguration( - 0, 0, 0, 0, 0, CheckWritablePropertyDefineCallback)); + nullptr, nullptr, nullptr, nullptr, nullptr, + CheckWritablePropertyDefineCallback)); env->Global() ->Set(env.local(), v8_str("obj"), templ->GetFunction(env.local()) .ToLocalChecked() @@ -1989,7 +1991,8 @@ THREADED_TEST(PropertyDefinerCallbackWithGetter) { v8::Local<v8::FunctionTemplate> templ = v8::FunctionTemplate::New(CcTest::isolate()); templ->InstanceTemplate()->SetHandler(v8::NamedPropertyHandlerConfiguration( - 0, 0, 0, 0, 0, CheckGetterPropertyDefineCallback)); + nullptr, nullptr, nullptr, nullptr, nullptr, + CheckGetterPropertyDefineCallback)); env->Global() ->Set(env.local(), v8_str("obj"), templ->GetFunction(env.local()) .ToLocalChecked() @@ -2024,7 +2027,8 @@ THREADED_TEST(PropertyDefinerCallbackWithSetter) { v8::Local<v8::FunctionTemplate> templ = v8::FunctionTemplate::New(CcTest::isolate()); templ->InstanceTemplate()->SetHandler(v8::NamedPropertyHandlerConfiguration( - 0, 0, 0, 0, 0, CheckSetterPropertyDefineCallback)); + nullptr, nullptr, nullptr, nullptr, nullptr, + CheckSetterPropertyDefineCallback)); env->Global() ->Set(env.local(), v8_str("obj"), templ->GetFunction(env.local()) .ToLocalChecked() @@ -2068,7 +2072,8 @@ THREADED_TEST(PropertyDescriptorCallback) { v8::Local<v8::FunctionTemplate> templ = v8::FunctionTemplate::New(CcTest::isolate()); templ->InstanceTemplate()->SetHandler(v8::NamedPropertyHandlerConfiguration( - 0, 0, EmptyPropertyDescriptorCallback, 0, 0, 0)); + nullptr, nullptr, EmptyPropertyDescriptorCallback, nullptr, nullptr, + nullptr)); env->Global() ->Set(env.local(), v8_str("obj"), templ->GetFunction(env.local()) .ToLocalChecked() @@ -2090,7 +2095,8 @@ THREADED_TEST(PropertyDescriptorCallback) { v8::Local<v8::FunctionTemplate> templ = v8::FunctionTemplate::New(CcTest::isolate()); templ->InstanceTemplate()->SetHandler(v8::NamedPropertyHandlerConfiguration( - 0, 0, InterceptingPropertyDescriptorCallback, 0, 0, 0)); + nullptr, nullptr, InterceptingPropertyDescriptorCallback, nullptr, + nullptr, nullptr)); env->Global() ->Set(env.local(), v8_str("obj"), templ->GetFunction(env.local()) .ToLocalChecked() @@ -2129,7 +2135,7 @@ THREADED_TEST(IndexedPropertyHandlerGetter) { v8::HandleScope scope(isolate); v8::Local<v8::FunctionTemplate> templ = v8::FunctionTemplate::New(isolate); templ->InstanceTemplate()->SetHandler(v8::IndexedPropertyHandlerConfiguration( - EchoIndexedProperty, 0, 0, 0, 0, v8_num(637))); + EchoIndexedProperty, nullptr, nullptr, nullptr, nullptr, v8_num(637))); LocalContext env; env->Global() ->Set(env.local(), v8_str("obj"), templ->GetFunction(env.local()) @@ -2285,7 +2291,7 @@ THREADED_TEST(PrePropertyHandler) { v8::HandleScope scope(isolate); v8::Local<v8::FunctionTemplate> desc = v8::FunctionTemplate::New(isolate); desc->InstanceTemplate()->SetHandler(v8::NamedPropertyHandlerConfiguration( - PrePropertyHandlerGet, 0, PrePropertyHandlerQuery)); + PrePropertyHandlerGet, nullptr, PrePropertyHandlerQuery)); is_bootstrapping = true; LocalContext env(nullptr, desc->InstanceTemplate()); is_bootstrapping = false; @@ -2909,8 +2915,8 @@ THREADED_TEST(IndexedInterceptorUnboxedDoubleWithIndexedAccessor) { v8::HandleScope scope(isolate); Local<ObjectTemplate> templ = ObjectTemplate::New(isolate); templ->SetHandler(v8::IndexedPropertyHandlerConfiguration( - UnboxedDoubleIndexedPropertyGetter, UnboxedDoubleIndexedPropertySetter, 0, - 0, UnboxedDoubleIndexedPropertyEnumerator)); + UnboxedDoubleIndexedPropertyGetter, UnboxedDoubleIndexedPropertySetter, + nullptr, nullptr, UnboxedDoubleIndexedPropertyEnumerator)); LocalContext context; context->Global() ->Set(context.local(), v8_str("obj"), @@ -2971,7 +2977,7 @@ THREADED_TEST(IndexedInterceptorSloppyArgsWithIndexedAccessor) { v8::HandleScope scope(isolate); Local<ObjectTemplate> templ = ObjectTemplate::New(isolate); templ->SetHandler(v8::IndexedPropertyHandlerConfiguration( - SloppyIndexedPropertyGetter, 0, 0, 0, + SloppyIndexedPropertyGetter, nullptr, nullptr, nullptr, SloppyArgsIndexedPropertyEnumerator)); LocalContext context; context->Global() @@ -4113,7 +4119,7 @@ THREADED_TEST(InterceptorICReferenceErrors) { templ->SetHandler( v8::NamedPropertyHandlerConfiguration(InterceptorICRefErrorGetter)); is_bootstrapping = true; - LocalContext context(0, templ, v8::Local<Value>()); + LocalContext context(nullptr, templ, v8::Local<Value>()); is_bootstrapping = false; call_ic_function2 = v8_compile("function h(x) { return x; }; h") ->Run(context.local()) @@ -4126,7 +4132,7 @@ THREADED_TEST(InterceptorICReferenceErrors) { " return false;" "};" "f();"); - CHECK(value->BooleanValue(context.local()).FromJust()); + CHECK(value->BooleanValue(isolate)); interceptor_call_count = 0; value = CompileRun( "function g() {" @@ -4136,7 +4142,7 @@ THREADED_TEST(InterceptorICReferenceErrors) { " return false;" "};" "g();"); - CHECK(value->BooleanValue(context.local()).FromJust()); + CHECK(value->BooleanValue(isolate)); } @@ -4169,7 +4175,7 @@ THREADED_TEST(InterceptorICGetterExceptions) { templ->SetHandler( v8::NamedPropertyHandlerConfiguration(InterceptorICExceptionGetter)); is_bootstrapping = true; - LocalContext context(0, templ, v8::Local<Value>()); + LocalContext context(nullptr, templ, v8::Local<Value>()); is_bootstrapping = false; call_ic_function3 = v8_compile("function h(x) { return x; }; h") ->Run(context.local()) @@ -4182,7 +4188,7 @@ THREADED_TEST(InterceptorICGetterExceptions) { " return false;" "};" "f();"); - CHECK(value->BooleanValue(context.local()).FromJust()); + CHECK(value->BooleanValue(isolate)); interceptor_ic_exception_get_count = 0; value = CompileRun( "function f() {" @@ -4192,7 +4198,7 @@ THREADED_TEST(InterceptorICGetterExceptions) { " return false;" "};" "f();"); - CHECK(value->BooleanValue(context.local()).FromJust()); + CHECK(value->BooleanValue(isolate)); } @@ -4215,9 +4221,9 @@ THREADED_TEST(InterceptorICSetterExceptions) { v8::Isolate* isolate = CcTest::isolate(); v8::HandleScope scope(isolate); v8::Local<v8::ObjectTemplate> templ = ObjectTemplate::New(isolate); - templ->SetHandler( - v8::NamedPropertyHandlerConfiguration(0, InterceptorICExceptionSetter)); - LocalContext context(0, templ, v8::Local<Value>()); + templ->SetHandler(v8::NamedPropertyHandlerConfiguration( + nullptr, InterceptorICExceptionSetter)); + LocalContext context(nullptr, templ, v8::Local<Value>()); v8::Local<Value> value = CompileRun( "function f() {" " for (var i = 0; i < 100; i++) {" @@ -4226,7 +4232,7 @@ THREADED_TEST(InterceptorICSetterExceptions) { " return false;" "};" "f();"); - CHECK(value->BooleanValue(context.local()).FromJust()); + CHECK(value->BooleanValue(isolate)); } @@ -4236,7 +4242,7 @@ THREADED_TEST(NullNamedInterceptor) { v8::HandleScope scope(isolate); v8::Local<v8::ObjectTemplate> templ = ObjectTemplate::New(isolate); templ->SetHandler(v8::NamedPropertyHandlerConfiguration( - static_cast<v8::GenericNamedPropertyGetterCallback>(0))); + static_cast<v8::GenericNamedPropertyGetterCallback>(nullptr))); LocalContext context; templ->Set(CcTest::isolate(), "x", v8_num(42)); v8::Local<v8::Object> obj = @@ -4254,7 +4260,7 @@ THREADED_TEST(NullIndexedInterceptor) { v8::HandleScope scope(isolate); v8::Local<v8::ObjectTemplate> templ = ObjectTemplate::New(isolate); templ->SetHandler(v8::IndexedPropertyHandlerConfiguration( - static_cast<v8::IndexedPropertyGetterCallback>(0))); + static_cast<v8::IndexedPropertyGetterCallback>(nullptr))); LocalContext context; templ->Set(CcTest::isolate(), "42", v8_num(42)); v8::Local<v8::Object> obj = diff --git a/deps/v8/test/cctest/test-api.cc b/deps/v8/test/cctest/test-api.cc index 1b74ecfd70..9eb73fab7e 100644 --- a/deps/v8/test/cctest/test-api.cc +++ b/deps/v8/test/cctest/test-api.cc @@ -445,18 +445,14 @@ class TestResource: public String::ExternalStringResource { while (data[length_]) ++length_; } - ~TestResource() { + ~TestResource() override { if (owning_data_) i::DeleteArray(data_); if (counter_ != nullptr) ++*counter_; } - const uint16_t* data() const { - return data_; - } + const uint16_t* data() const override { return data_; } - size_t length() const { - return length_; - } + size_t length() const override { return length_; } private: uint16_t* data_; @@ -475,18 +471,14 @@ class TestOneByteResource : public String::ExternalOneByteStringResource { length_(strlen(data) - offset), counter_(counter) {} - ~TestOneByteResource() { + ~TestOneByteResource() override { i::DeleteArray(orig_data_); if (counter_ != nullptr) ++*counter_; } - const char* data() const { - return data_; - } + const char* data() const override { return data_; } - size_t length() const { - return length_; - } + size_t length() const override { return length_; } private: const char* orig_data_; @@ -692,10 +684,10 @@ TEST(MakingExternalUnalignedOneByteString) { // Trigger GCs and force evacuation. CcTest::CollectAllGarbage(); - CcTest::CollectAllGarbage(i::Heap::kReduceMemoryFootprintMask); + CcTest::heap()->CollectAllGarbage(i::Heap::kReduceMemoryFootprintMask, + i::GarbageCollectionReason::kTesting); } - THREADED_TEST(UsingExternalString) { i::Factory* factory = CcTest::i_isolate()->factory(); { @@ -744,8 +736,8 @@ THREADED_TEST(UsingExternalOneByteString) { class RandomLengthResource : public v8::String::ExternalStringResource { public: explicit RandomLengthResource(int length) : length_(length) {} - virtual const uint16_t* data() const { return string_; } - virtual size_t length() const { return length_; } + const uint16_t* data() const override { return string_; } + size_t length() const override { return length_; } private: uint16_t string_[10]; @@ -757,8 +749,8 @@ class RandomLengthOneByteResource : public v8::String::ExternalOneByteStringResource { public: explicit RandomLengthOneByteResource(int length) : length_(length) {} - virtual const char* data() const { return string_; } - virtual size_t length() const { return length_; } + const char* data() const override { return string_; } + size_t length() const override { return length_; } private: char string_[10]; @@ -847,7 +839,7 @@ class TestOneByteResourceWithDisposeControl : public TestOneByteResource { TestOneByteResourceWithDisposeControl(const char* data, bool dispose) : TestOneByteResource(data, &dispose_count), dispose_(dispose) {} - void Dispose() { + void Dispose() override { ++dispose_calls; if (dispose_) delete this; } @@ -1296,8 +1288,7 @@ THREADED_PROFILED_TEST(FastReturnValues) { fast_return_value_bool = i == 0; value = TestFastReturnValues<bool>(); CHECK(value->IsBoolean()); - CHECK_EQ(fast_return_value_bool, - value->ToBoolean(env.local()).ToLocalChecked()->Value()); + CHECK_EQ(fast_return_value_bool, value->BooleanValue(isolate)); } // check oddballs ReturnValueOddball oddballs[] = { @@ -1392,8 +1383,7 @@ static void TestExternalPointerWrapping() { " for (var i = 0; i < 13; i++) obj.func();\n" "}\n" "foo(), true") - ->BooleanValue(env.local()) - .FromJust()); + ->BooleanValue(isolate)); } @@ -1782,7 +1772,6 @@ THREADED_TEST(NumberObject) { } THREADED_TEST(BigIntObject) { - v8::internal::FLAG_harmony_bigint = true; LocalContext env; v8::Isolate* isolate = env->GetIsolate(); v8::HandleScope scope(isolate); @@ -1803,7 +1792,7 @@ THREADED_TEST(BigIntObject) { CHECK(new_unboxed_bigint->IsBigInt()); // Test functionality inherited from v8::Value. - CHECK(unboxed_bigint->BooleanValue(context).ToChecked()); + CHECK(unboxed_bigint->BooleanValue(isolate)); v8::Local<v8::String> string = unboxed_bigint->ToString(context).ToLocalChecked(); CHECK_EQ(0, strcmp("42", *v8::String::Utf8Value(isolate, string))); @@ -1840,48 +1829,49 @@ THREADED_TEST(BooleanObject) { THREADED_TEST(PrimitiveAndWrappedBooleans) { LocalContext env; - v8::HandleScope scope(env->GetIsolate()); + v8::Isolate* isolate = env->GetIsolate(); + v8::HandleScope scope(isolate); - Local<Value> primitive_false = Boolean::New(env->GetIsolate(), false); + Local<Value> primitive_false = Boolean::New(isolate, false); CHECK(primitive_false->IsBoolean()); CHECK(!primitive_false->IsBooleanObject()); - CHECK(!primitive_false->BooleanValue(env.local()).FromJust()); + CHECK(!primitive_false->BooleanValue(isolate)); CHECK(!primitive_false->IsTrue()); CHECK(primitive_false->IsFalse()); - Local<Value> false_value = BooleanObject::New(env->GetIsolate(), false); + Local<Value> false_value = BooleanObject::New(isolate, false); CHECK(!false_value->IsBoolean()); CHECK(false_value->IsBooleanObject()); - CHECK(false_value->BooleanValue(env.local()).FromJust()); + CHECK(false_value->BooleanValue(isolate)); CHECK(!false_value->IsTrue()); CHECK(!false_value->IsFalse()); Local<BooleanObject> false_boolean_object = false_value.As<BooleanObject>(); CHECK(!false_boolean_object->IsBoolean()); CHECK(false_boolean_object->IsBooleanObject()); - CHECK(false_boolean_object->BooleanValue(env.local()).FromJust()); + CHECK(false_boolean_object->BooleanValue(isolate)); CHECK(!false_boolean_object->ValueOf()); CHECK(!false_boolean_object->IsTrue()); CHECK(!false_boolean_object->IsFalse()); - Local<Value> primitive_true = Boolean::New(env->GetIsolate(), true); + Local<Value> primitive_true = Boolean::New(isolate, true); CHECK(primitive_true->IsBoolean()); CHECK(!primitive_true->IsBooleanObject()); - CHECK(primitive_true->BooleanValue(env.local()).FromJust()); + CHECK(primitive_true->BooleanValue(isolate)); CHECK(primitive_true->IsTrue()); CHECK(!primitive_true->IsFalse()); - Local<Value> true_value = BooleanObject::New(env->GetIsolate(), true); + Local<Value> true_value = BooleanObject::New(isolate, true); CHECK(!true_value->IsBoolean()); CHECK(true_value->IsBooleanObject()); - CHECK(true_value->BooleanValue(env.local()).FromJust()); + CHECK(true_value->BooleanValue(isolate)); CHECK(!true_value->IsTrue()); CHECK(!true_value->IsFalse()); Local<BooleanObject> true_boolean_object = true_value.As<BooleanObject>(); CHECK(!true_boolean_object->IsBoolean()); CHECK(true_boolean_object->IsBooleanObject()); - CHECK(true_boolean_object->BooleanValue(env.local()).FromJust()); + CHECK(true_boolean_object->BooleanValue(isolate)); CHECK(true_boolean_object->ValueOf()); CHECK(!true_boolean_object->IsTrue()); CHECK(!true_boolean_object->IsFalse()); @@ -1937,22 +1927,21 @@ THREADED_TEST(Boolean) { v8::Local<v8::Boolean> f = v8::False(isolate); CHECK(!f->Value()); v8::Local<v8::Primitive> u = v8::Undefined(isolate); - CHECK(!u->BooleanValue(env.local()).FromJust()); + CHECK(!u->BooleanValue(isolate)); v8::Local<v8::Primitive> n = v8::Null(isolate); - CHECK(!n->BooleanValue(env.local()).FromJust()); + CHECK(!n->BooleanValue(isolate)); v8::Local<String> str1 = v8_str(""); - CHECK(!str1->BooleanValue(env.local()).FromJust()); + CHECK(!str1->BooleanValue(isolate)); v8::Local<String> str2 = v8_str("x"); - CHECK(str2->BooleanValue(env.local()).FromJust()); - CHECK(!v8::Number::New(isolate, 0)->BooleanValue(env.local()).FromJust()); - CHECK(v8::Number::New(isolate, -1)->BooleanValue(env.local()).FromJust()); - CHECK(v8::Number::New(isolate, 1)->BooleanValue(env.local()).FromJust()); - CHECK(v8::Number::New(isolate, 42)->BooleanValue(env.local()).FromJust()); + CHECK(str2->BooleanValue(isolate)); + CHECK(!v8::Number::New(isolate, 0)->BooleanValue(isolate)); + CHECK(v8::Number::New(isolate, -1)->BooleanValue(isolate)); + CHECK(v8::Number::New(isolate, 1)->BooleanValue(isolate)); + CHECK(v8::Number::New(isolate, 42)->BooleanValue(isolate)); CHECK(!v8_compile("NaN") ->Run(env.local()) .ToLocalChecked() - ->BooleanValue(env.local()) - .FromJust()); + ->BooleanValue(isolate)); } @@ -1979,7 +1968,7 @@ THREADED_TEST(GlobalPrototype) { v8::Local<ObjectTemplate> templ = func_templ->InstanceTemplate(); templ->Set(isolate, "x", v8_num(200)); templ->SetAccessor(v8_str("m"), GetM); - LocalContext env(0, templ); + LocalContext env(nullptr, templ); v8::Local<Script> script(v8_compile("dummy()")); v8::Local<Value> result(script->Run(env.local()).ToLocalChecked()); CHECK_EQ(13.4, result->NumberValue(env.local()).FromJust()); @@ -2010,10 +1999,10 @@ THREADED_TEST(ObjectTemplate) { templ1->NewInstance(env.local()).ToLocalChecked(); CHECK(class_name->StrictEquals(instance1->GetConstructorName())); CHECK(env->Global()->Set(env.local(), v8_str("p"), instance1).FromJust()); - CHECK(CompileRun("(p.x == 10)")->BooleanValue(env.local()).FromJust()); - CHECK(CompileRun("(p.y == 13)")->BooleanValue(env.local()).FromJust()); - CHECK(CompileRun("(p.foo() == 42)")->BooleanValue(env.local()).FromJust()); - CHECK(CompileRun("(p.foo == acc)")->BooleanValue(env.local()).FromJust()); + CHECK(CompileRun("(p.x == 10)")->BooleanValue(isolate)); + CHECK(CompileRun("(p.y == 13)")->BooleanValue(isolate)); + CHECK(CompileRun("(p.foo() == 42)")->BooleanValue(isolate)); + CHECK(CompileRun("(p.foo == acc)")->BooleanValue(isolate)); // Ensure that foo become a data field. CompileRun("p.foo = function() {}"); Local<v8::FunctionTemplate> fun2 = v8::FunctionTemplate::New(isolate); @@ -2026,41 +2015,37 @@ THREADED_TEST(ObjectTemplate) { Local<v8::Object> instance2 = templ2->NewInstance(env.local()).ToLocalChecked(); CHECK(env->Global()->Set(env.local(), v8_str("q"), instance2).FromJust()); - CHECK(CompileRun("(q.nirk == 123)")->BooleanValue(env.local()).FromJust()); - CHECK(CompileRun("(q.a == 12)")->BooleanValue(env.local()).FromJust()); - CHECK(CompileRun("(q.b.x == 10)")->BooleanValue(env.local()).FromJust()); - CHECK(CompileRun("(q.b.y == 13)")->BooleanValue(env.local()).FromJust()); - CHECK(CompileRun("(q.b.foo() == 42)")->BooleanValue(env.local()).FromJust()); - CHECK(CompileRun("(q.b.foo === acc)")->BooleanValue(env.local()).FromJust()); - CHECK(CompileRun("(q.b !== p)")->BooleanValue(env.local()).FromJust()); - CHECK(CompileRun("(q.acc == 42)")->BooleanValue(env.local()).FromJust()); - CHECK(CompileRun("(q.bar() == 42)")->BooleanValue(env.local()).FromJust()); - CHECK(CompileRun("(q.bar == acc)")->BooleanValue(env.local()).FromJust()); + CHECK(CompileRun("(q.nirk == 123)")->BooleanValue(isolate)); + CHECK(CompileRun("(q.a == 12)")->BooleanValue(isolate)); + CHECK(CompileRun("(q.b.x == 10)")->BooleanValue(isolate)); + CHECK(CompileRun("(q.b.y == 13)")->BooleanValue(isolate)); + CHECK(CompileRun("(q.b.foo() == 42)")->BooleanValue(isolate)); + CHECK(CompileRun("(q.b.foo === acc)")->BooleanValue(isolate)); + CHECK(CompileRun("(q.b !== p)")->BooleanValue(isolate)); + CHECK(CompileRun("(q.acc == 42)")->BooleanValue(isolate)); + CHECK(CompileRun("(q.bar() == 42)")->BooleanValue(isolate)); + CHECK(CompileRun("(q.bar == acc)")->BooleanValue(isolate)); instance2 = templ2->NewInstance(env.local()).ToLocalChecked(); CHECK(env->Global()->Set(env.local(), v8_str("q2"), instance2).FromJust()); - CHECK(CompileRun("(q2.nirk == 123)")->BooleanValue(env.local()).FromJust()); - CHECK(CompileRun("(q2.a == 12)")->BooleanValue(env.local()).FromJust()); - CHECK(CompileRun("(q2.b.x == 10)")->BooleanValue(env.local()).FromJust()); - CHECK(CompileRun("(q2.b.y == 13)")->BooleanValue(env.local()).FromJust()); - CHECK(CompileRun("(q2.b.foo() == 42)")->BooleanValue(env.local()).FromJust()); - CHECK(CompileRun("(q2.b.foo === acc)")->BooleanValue(env.local()).FromJust()); - CHECK(CompileRun("(q2.acc == 42)")->BooleanValue(env.local()).FromJust()); - CHECK(CompileRun("(q2.bar() == 42)")->BooleanValue(env.local()).FromJust()); - CHECK(CompileRun("(q2.bar === acc)")->BooleanValue(env.local()).FromJust()); - - CHECK(CompileRun("(q.b !== q2.b)")->BooleanValue(env.local()).FromJust()); - CHECK(CompileRun("q.b.x = 17; (q2.b.x == 10)") - ->BooleanValue(env.local()) - .FromJust()); + CHECK(CompileRun("(q2.nirk == 123)")->BooleanValue(isolate)); + CHECK(CompileRun("(q2.a == 12)")->BooleanValue(isolate)); + CHECK(CompileRun("(q2.b.x == 10)")->BooleanValue(isolate)); + CHECK(CompileRun("(q2.b.y == 13)")->BooleanValue(isolate)); + CHECK(CompileRun("(q2.b.foo() == 42)")->BooleanValue(isolate)); + CHECK(CompileRun("(q2.b.foo === acc)")->BooleanValue(isolate)); + CHECK(CompileRun("(q2.acc == 42)")->BooleanValue(isolate)); + CHECK(CompileRun("(q2.bar() == 42)")->BooleanValue(isolate)); + CHECK(CompileRun("(q2.bar === acc)")->BooleanValue(isolate)); + + CHECK(CompileRun("(q.b !== q2.b)")->BooleanValue(isolate)); + CHECK(CompileRun("q.b.x = 17; (q2.b.x == 10)")->BooleanValue(isolate)); CHECK(CompileRun("desc1 = Object.getOwnPropertyDescriptor(q, 'acc');" "(desc1.get === acc)") - ->BooleanValue(env.local()) - .FromJust()); + ->BooleanValue(isolate)); CHECK(CompileRun("desc2 = Object.getOwnPropertyDescriptor(q2, 'acc');" "(desc2.get === acc)") - ->BooleanValue(env.local()) - .FromJust()); + ->BooleanValue(isolate)); } THREADED_TEST(IntegerValue) { @@ -2380,27 +2365,20 @@ THREADED_TEST(DescriptorInheritance) { // Checks right __proto__ chain. CHECK(CompileRun("base1.prototype.__proto__ == s.prototype") - ->BooleanValue(env.local()) - .FromJust()); + ->BooleanValue(isolate)); CHECK(CompileRun("base2.prototype.__proto__ == s.prototype") - ->BooleanValue(env.local()) - .FromJust()); + ->BooleanValue(isolate)); CHECK(v8_compile("s.prototype.PI == 3.14") ->Run(env.local()) .ToLocalChecked() - ->BooleanValue(env.local()) - .FromJust()); + ->BooleanValue(isolate)); // Instance accessor should not be visible on function object or its prototype + CHECK(CompileRun("s.knurd == undefined")->BooleanValue(isolate)); + CHECK(CompileRun("s.prototype.knurd == undefined")->BooleanValue(isolate)); CHECK( - CompileRun("s.knurd == undefined")->BooleanValue(env.local()).FromJust()); - CHECK(CompileRun("s.prototype.knurd == undefined") - ->BooleanValue(env.local()) - .FromJust()); - CHECK(CompileRun("base1.prototype.knurd == undefined") - ->BooleanValue(env.local()) - .FromJust()); + CompileRun("base1.prototype.knurd == undefined")->BooleanValue(isolate)); CHECK(env->Global() ->Set(env.local(), v8_str("obj"), base1->GetFunction(env.local()) @@ -2410,9 +2388,9 @@ THREADED_TEST(DescriptorInheritance) { .FromJust()); CHECK_EQ(17.2, CompileRun("obj.flabby()")->NumberValue(env.local()).FromJust()); - CHECK(CompileRun("'flabby' in obj")->BooleanValue(env.local()).FromJust()); + CHECK(CompileRun("'flabby' in obj")->BooleanValue(isolate)); CHECK_EQ(15.2, CompileRun("obj.knurd")->NumberValue(env.local()).FromJust()); - CHECK(CompileRun("'knurd' in obj")->BooleanValue(env.local()).FromJust()); + CHECK(CompileRun("'knurd' in obj")->BooleanValue(isolate)); CHECK_EQ(20.1, CompileRun("obj.v1")->NumberValue(env.local()).FromJust()); CHECK(env->Global() @@ -2423,9 +2401,9 @@ THREADED_TEST(DescriptorInheritance) { .FromJust()); CHECK_EQ(17.2, CompileRun("obj2.flabby()")->NumberValue(env.local()).FromJust()); - CHECK(CompileRun("'flabby' in obj2")->BooleanValue(env.local()).FromJust()); + CHECK(CompileRun("'flabby' in obj2")->BooleanValue(isolate)); CHECK_EQ(15.2, CompileRun("obj2.knurd")->NumberValue(env.local()).FromJust()); - CHECK(CompileRun("'knurd' in obj2")->BooleanValue(env.local()).FromJust()); + CHECK(CompileRun("'knurd' in obj2")->BooleanValue(isolate)); CHECK_EQ(10.1, CompileRun("obj2.v2")->NumberValue(env.local()).FromJust()); // base1 and base2 cannot cross reference to each's prototype @@ -4643,7 +4621,7 @@ void TestGlobalValueMap() { } CHECK_EQ(initial_handle_count + 1, global_handles->global_handles_count()); if (map.IsWeak()) { - CcTest::CollectAllGarbage(i::Heap::kAbortIncrementalMarkingMask); + CcTest::PreciseCollectAllGarbage(); } else { map.Clear(); } @@ -5247,22 +5225,6 @@ THREADED_TEST(Array) { CHECK_EQ(27u, array->Length()); array = v8::Array::New(context->GetIsolate(), -27); CHECK_EQ(0u, array->Length()); - - std::vector<Local<Value>> vector = {v8_num(1), v8_num(2), v8_num(3)}; - array = v8::Array::New(context->GetIsolate(), vector.data(), vector.size()); - CHECK_EQ(vector.size(), array->Length()); - CHECK_EQ(1, arr->Get(context.local(), 0) - .ToLocalChecked() - ->Int32Value(context.local()) - .FromJust()); - CHECK_EQ(2, arr->Get(context.local(), 1) - .ToLocalChecked() - ->Int32Value(context.local()) - .FromJust()); - CHECK_EQ(3, arr->Get(context.local(), 2) - .ToLocalChecked() - ->Int32Value(context.local()) - .FromJust()); } @@ -5283,7 +5245,7 @@ THREADED_TEST(Vector) { v8::HandleScope scope(isolate); Local<ObjectTemplate> global = ObjectTemplate::New(isolate); global->Set(v8_str("f"), v8::FunctionTemplate::New(isolate, HandleF)); - LocalContext context(0, global); + LocalContext context(nullptr, global); const char* fun = "f()"; Local<v8::Array> a0 = CompileRun(fun).As<v8::Array>(); @@ -5672,13 +5634,44 @@ THREADED_TEST(isNumberType) { obj = env->Global()->Get(env.local(), v8_str("obj")).ToLocalChecked(); CHECK(obj->IsInt32()); CHECK(obj->IsUint32()); - // Positive zero + // Negative zero CompileRun("var obj = -0.0;"); obj = env->Global()->Get(env.local(), v8_str("obj")).ToLocalChecked(); CHECK(!obj->IsInt32()); CHECK(!obj->IsUint32()); } +THREADED_TEST(IntegerType) { + LocalContext env; + v8::HandleScope scope(env->GetIsolate()); + Local<Value> result; + + // Small positive integer + result = CompileRun("42;"); + CHECK(result->IsNumber()); + CHECK_EQ(42, result.As<v8::Integer>()->Value()); + // Small negative integer + result = CompileRun("-42;"); + CHECK(result->IsNumber()); + CHECK_EQ(-42, result.As<v8::Integer>()->Value()); + // Positive non-int32 integer + result = CompileRun("1099511627776;"); + CHECK(result->IsNumber()); + CHECK_EQ(1099511627776, result.As<v8::Integer>()->Value()); + // Negative non-int32 integer + result = CompileRun("-1099511627776;"); + CHECK(result->IsNumber()); + CHECK_EQ(-1099511627776, result.As<v8::Integer>()->Value()); + // Positive non-integer + result = CompileRun("3.14;"); + CHECK(result->IsNumber()); + CHECK_EQ(3, result.As<v8::Integer>()->Value()); + // Negative non-integer + result = CompileRun("-3.14;"); + CHECK(result->IsNumber()); + CHECK_EQ(-3, result.As<v8::Integer>()->Value()); +} + static void CheckUncle(v8::Isolate* isolate, v8::TryCatch* try_catch) { CHECK(try_catch->HasCaught()); String::Utf8Value str_value(isolate, try_catch->Exception()); @@ -5760,7 +5753,7 @@ THREADED_TEST(APICatch) { Local<ObjectTemplate> templ = ObjectTemplate::New(isolate); templ->Set(v8_str("ThrowFromC"), v8::FunctionTemplate::New(isolate, ThrowFromC)); - LocalContext context(0, templ); + LocalContext context(nullptr, templ); CompileRun( "var thrown = false;" "try {" @@ -5771,7 +5764,7 @@ THREADED_TEST(APICatch) { Local<Value> thrown = context->Global() ->Get(context.local(), v8_str("thrown")) .ToLocalChecked(); - CHECK(thrown->BooleanValue(context.local()).FromJust()); + CHECK(thrown->BooleanValue(isolate)); } @@ -5781,7 +5774,7 @@ THREADED_TEST(APIThrowTryCatch) { Local<ObjectTemplate> templ = ObjectTemplate::New(isolate); templ->Set(v8_str("ThrowFromC"), v8::FunctionTemplate::New(isolate, ThrowFromC)); - LocalContext context(0, templ); + LocalContext context(nullptr, templ); v8::TryCatch try_catch(isolate); CompileRun("ThrowFromC();"); CHECK(try_catch.HasCaught()); @@ -5800,7 +5793,7 @@ TEST(TryCatchInTryFinally) { v8::HandleScope scope(isolate); Local<ObjectTemplate> templ = ObjectTemplate::New(isolate); templ->Set(v8_str("CCatcher"), v8::FunctionTemplate::New(isolate, CCatcher)); - LocalContext context(0, templ); + LocalContext context(nullptr, templ); Local<Value> result = CompileRun( "try {" " try {" @@ -5966,7 +5959,7 @@ TEST(APIThrowMessage) { Local<ObjectTemplate> templ = ObjectTemplate::New(isolate); templ->Set(v8_str("ThrowFromC"), v8::FunctionTemplate::New(isolate, ThrowFromC)); - LocalContext context(0, templ); + LocalContext context(nullptr, templ); CompileRun("ThrowFromC();"); CHECK(message_received); isolate->RemoveMessageListeners(receive_message); @@ -5981,7 +5974,7 @@ TEST(APIThrowMessageAndVerboseTryCatch) { Local<ObjectTemplate> templ = ObjectTemplate::New(isolate); templ->Set(v8_str("ThrowFromC"), v8::FunctionTemplate::New(isolate, ThrowFromC)); - LocalContext context(0, templ); + LocalContext context(nullptr, templ); v8::TryCatch try_catch(isolate); try_catch.SetVerbose(true); Local<Value> result = CompileRun("ThrowFromC();"); @@ -6013,7 +6006,7 @@ THREADED_TEST(ExternalScriptException) { Local<ObjectTemplate> templ = ObjectTemplate::New(isolate); templ->Set(v8_str("ThrowFromC"), v8::FunctionTemplate::New(isolate, ThrowFromC)); - LocalContext context(0, templ); + LocalContext context(nullptr, templ); v8::TryCatch try_catch(isolate); Local<Value> result = CompileRun("ThrowFromC(); throw 'panama';"); @@ -6066,8 +6059,9 @@ void CThrowCountDown(const v8::FunctionCallbackInfo<v8::Value>& args) { void JSCheck(const v8::FunctionCallbackInfo<v8::Value>& args) { ApiTestFuzzer::Fuzz(); CHECK_EQ(3, args.Length()); - v8::Local<v8::Context> context = args.GetIsolate()->GetCurrentContext(); - bool equality = args[0]->BooleanValue(context).FromJust(); + v8::Isolate* isolate = args.GetIsolate(); + v8::Local<v8::Context> context = isolate->GetCurrentContext(); + bool equality = args[0]->BooleanValue(isolate); int count = args[1]->Int32Value(context).FromJust(); int expected = args[2]->Int32Value(context).FromJust(); if (equality) { @@ -6121,7 +6115,7 @@ TEST(ExceptionOrder) { templ->Set(v8_str("check"), v8::FunctionTemplate::New(isolate, JSCheck)); templ->Set(v8_str("CThrowCountDown"), v8::FunctionTemplate::New(isolate, CThrowCountDown)); - LocalContext context(0, templ); + LocalContext context(nullptr, templ); CompileRun( "function JSThrowCountDown(count, jsInterval, cInterval, expected) {" " if (count == 0) throw 'FromJS';" @@ -6186,7 +6180,7 @@ THREADED_TEST(ThrowValues) { v8::HandleScope scope(isolate); Local<ObjectTemplate> templ = ObjectTemplate::New(isolate); templ->Set(v8_str("Throw"), v8::FunctionTemplate::New(isolate, ThrowValue)); - LocalContext context(0, templ); + LocalContext context(nullptr, templ); v8::Local<v8::Array> result = v8::Local<v8::Array>::Cast( CompileRun("function Run(obj) {" " try {" @@ -6380,7 +6374,7 @@ TEST(TryCatchMixedNesting) { Local<ObjectTemplate> templ = ObjectTemplate::New(isolate); templ->Set(v8_str("TryCatchMixedNestingHelper"), v8::FunctionTemplate::New(isolate, TryCatchMixedNestingHelper)); - LocalContext context(0, templ); + LocalContext context(nullptr, templ); CompileRunWithOrigin("TryCatchMixedNestingHelper();\n", "outer", 1, 1); TryCatchMixedNestingCheck(&try_catch); } @@ -6402,7 +6396,7 @@ TEST(TryCatchNative) { Local<ObjectTemplate> templ = ObjectTemplate::New(isolate); templ->Set(v8_str("TryCatchNativeHelper"), v8::FunctionTemplate::New(isolate, TryCatchNativeHelper)); - LocalContext context(0, templ); + LocalContext context(nullptr, templ); CompileRun("TryCatchNativeHelper();"); CHECK(!try_catch.HasCaught()); } @@ -6427,7 +6421,7 @@ TEST(TryCatchNativeReset) { Local<ObjectTemplate> templ = ObjectTemplate::New(isolate); templ->Set(v8_str("TryCatchNativeResetHelper"), v8::FunctionTemplate::New(isolate, TryCatchNativeResetHelper)); - LocalContext context(0, templ); + LocalContext context(nullptr, templ); CompileRun("TryCatchNativeResetHelper();"); CHECK(!try_catch.HasCaught()); } @@ -6630,7 +6624,7 @@ THREADED_TEST(DefinePropertyOnAPIAccessor) { "obj, 'x');" "prop.configurable;"); Local<Value> result = script_desc->Run(context.local()).ToLocalChecked(); - CHECK(result->BooleanValue(context.local()).FromJust()); + CHECK(result->BooleanValue(isolate)); // Redefine get - but still configurable Local<Script> script_define = v8_compile( @@ -6643,7 +6637,7 @@ THREADED_TEST(DefinePropertyOnAPIAccessor) { // Check that the accessor is still configurable result = script_desc->Run(context.local()).ToLocalChecked(); - CHECK(result->BooleanValue(context.local()).FromJust()); + CHECK(result->BooleanValue(isolate)); // Redefine to a non-configurable script_define = v8_compile( @@ -6654,7 +6648,7 @@ THREADED_TEST(DefinePropertyOnAPIAccessor) { result = script_define->Run(context.local()).ToLocalChecked(); CHECK(result->Equals(context.local(), v8_num(43)).FromJust()); result = script_desc->Run(context.local()).ToLocalChecked(); - CHECK(!result->BooleanValue(context.local()).FromJust()); + CHECK(!result->BooleanValue(isolate)); // Make sure that it is not possible to redefine again v8::TryCatch try_catch(isolate); @@ -6683,7 +6677,7 @@ THREADED_TEST(DefinePropertyOnDefineGetterSetter) { "obj, 'x');" "prop.configurable;"); Local<Value> result = script_desc->Run(context.local()).ToLocalChecked(); - CHECK(result->BooleanValue(context.local()).FromJust()); + CHECK(result->BooleanValue(isolate)); Local<Script> script_define = v8_compile( "var desc = {get: function(){return 42; }," @@ -6694,7 +6688,7 @@ THREADED_TEST(DefinePropertyOnDefineGetterSetter) { CHECK(result->Equals(context.local(), v8_num(42)).FromJust()); result = script_desc->Run(context.local()).ToLocalChecked(); - CHECK(result->BooleanValue(context.local()).FromJust()); + CHECK(result->BooleanValue(isolate)); script_define = v8_compile( "var desc = {get: function(){return 43; }," @@ -6705,7 +6699,7 @@ THREADED_TEST(DefinePropertyOnDefineGetterSetter) { CHECK(result->Equals(context.local(), v8_num(43)).FromJust()); result = script_desc->Run(context.local()).ToLocalChecked(); - CHECK(!result->BooleanValue(context.local()).FromJust()); + CHECK(!result->BooleanValue(isolate)); v8::TryCatch try_catch(isolate); CHECK(script_define->Run(context.local()).IsEmpty()); @@ -7007,7 +7001,7 @@ THREADED_TEST(MultiContexts) { Local<String> password = v8_str("Password"); // Create an environment - LocalContext context0(0, templ); + LocalContext context0(nullptr, templ); context0->SetSecurityToken(password); v8::Local<v8::Object> global0 = context0->Global(); CHECK(global0->Set(context0.local(), v8_str("custom"), v8_num(1234)) @@ -7018,7 +7012,7 @@ THREADED_TEST(MultiContexts) { .FromJust()); // Create an independent environment - LocalContext context1(0, templ); + LocalContext context1(nullptr, templ); context1->SetSecurityToken(password); v8::Local<v8::Object> global1 = context1->Global(); CHECK(global1->Set(context1.local(), v8_str("custom"), v8_num(1234)) @@ -7034,7 +7028,7 @@ THREADED_TEST(MultiContexts) { .FromJust()); // Now create a new context with the old global - LocalContext context2(0, templ, global1); + LocalContext context2(nullptr, templ, global1); context2->SetSecurityToken(password); v8::Local<v8::Object> global2 = context2->Global(); CHECK(global1->Equals(context2.local(), global2).FromJust()); @@ -7290,7 +7284,7 @@ THREADED_TEST(GlobalObjectTemplate) { Local<ObjectTemplate> global_template = ObjectTemplate::New(isolate); global_template->Set(v8_str("JSNI_Log"), v8::FunctionTemplate::New(isolate, HandleLogDelegator)); - v8::Local<Context> context = Context::New(isolate, 0, global_template); + v8::Local<Context> context = Context::New(isolate, nullptr, global_template); Context::Scope context_scope(context); CompileRun("JSNI_Log('LOG')"); } @@ -7377,8 +7371,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(new Extension( - extension_name.start(), kEmbeddedExtensionSource, 0, 0, source_len)); + v8::RegisterExtension(new Extension(extension_name.start(), + kEmbeddedExtensionSource, 0, nullptr, + source_len)); const char* extension_names[1] = {extension_name.start()}; v8::ExtensionConfiguration extensions(1, extension_names); v8::Local<Context> context = Context::New(CcTest::isolate(), &extensions); @@ -7537,8 +7532,8 @@ class NativeFunctionExtension : public Extension { v8::FunctionCallback fun = &Echo) : Extension(name, source), function_(fun) {} - virtual v8::Local<v8::FunctionTemplate> GetNativeFunctionTemplate( - v8::Isolate* isolate, v8::Local<v8::String> name) { + v8::Local<v8::FunctionTemplate> GetNativeFunctionTemplate( + v8::Isolate* isolate, v8::Local<v8::String> name) override { return v8::FunctionTemplate::New(isolate, function_); } @@ -7668,8 +7663,8 @@ static void CallFun(const v8::FunctionCallbackInfo<v8::Value>& args) { class FunctionExtension : public Extension { public: FunctionExtension() : Extension("functiontest", kExtensionTestScript) {} - virtual v8::Local<v8::FunctionTemplate> GetNativeFunctionTemplate( - v8::Isolate* isolate, v8::Local<String> name); + v8::Local<v8::FunctionTemplate> GetNativeFunctionTemplate( + v8::Isolate* isolate, v8::Local<String> name) override; }; @@ -8013,7 +8008,7 @@ void v8::internal::heap::HeapTester::ResetWeakHandle(bool global_gc) { object_a.handle.Reset(iso, a); object_b.handle.Reset(iso, b); if (global_gc) { - CcTest::CollectAllGarbage(Heap::kAbortIncrementalMarkingMask); + CcTest::PreciseCollectAllGarbage(); } else { CcTest::CollectGarbage(i::NEW_SPACE); } @@ -8039,7 +8034,7 @@ void v8::internal::heap::HeapTester::ResetWeakHandle(bool global_gc) { #endif } if (global_gc) { - CcTest::CollectAllGarbage(Heap::kAbortIncrementalMarkingMask); + CcTest::PreciseCollectAllGarbage(); } else { CcTest::CollectGarbage(i::NEW_SPACE); } @@ -8639,8 +8634,8 @@ THREADED_TEST(StringWrite) { CHECK_EQ(0, str->WriteOneByte(isolate, nullptr, 0, 0, String::NO_NULL_TERMINATION)); - CHECK_EQ(0, - str->WriteUtf8(isolate, nullptr, 0, 0, String::NO_NULL_TERMINATION)); + CHECK_EQ(0, str->WriteUtf8(isolate, nullptr, 0, nullptr, + String::NO_NULL_TERMINATION)); CHECK_EQ(0, str->Write(isolate, nullptr, 0, 0, String::NO_NULL_TERMINATION)); } @@ -8946,6 +8941,49 @@ THREADED_TEST(ToArrayIndex) { CHECK(index.IsEmpty()); } +static v8::MaybeLocal<Value> PrepareStackTrace42(v8::Local<Context> context, + v8::Local<Value> error, + v8::Local<StackTrace> trace) { + return v8::Number::New(context->GetIsolate(), 42); +} + +static v8::MaybeLocal<Value> PrepareStackTraceThrow( + v8::Local<Context> context, v8::Local<Value> error, + v8::Local<StackTrace> trace) { + v8::Isolate* isolate = context->GetIsolate(); + v8::Local<String> message = v8_str("42"); + isolate->ThrowException(v8::Exception::Error(message)); + return v8::MaybeLocal<Value>(); +} + +THREADED_TEST(IsolatePrepareStackTrace) { + LocalContext context; + v8::Isolate* isolate = context->GetIsolate(); + v8::HandleScope scope(isolate); + + isolate->SetPrepareStackTraceCallback(PrepareStackTrace42); + + v8::Local<Value> v = CompileRun("new Error().stack"); + + CHECK(v->IsNumber()); + CHECK_EQ(v.As<v8::Number>()->Int32Value(context.local()).FromJust(), 42); +} + +THREADED_TEST(IsolatePrepareStackTraceThrow) { + LocalContext context; + v8::Isolate* isolate = context->GetIsolate(); + v8::HandleScope scope(isolate); + + isolate->SetPrepareStackTraceCallback(PrepareStackTraceThrow); + + v8::Local<Value> v = CompileRun("try { new Error().stack } catch (e) { e }"); + + CHECK(v->IsNativeError()); + + v8::Local<String> message = v8::Exception::CreateMessage(isolate, v)->Get(); + + CHECK(message->StrictEquals(v8_str("Uncaught Error: 42"))); +} THREADED_TEST(ErrorConstruction) { LocalContext context; @@ -9297,7 +9335,7 @@ TEST(TryCatchFinallyStoresMessageUsingTryCatchHandler) { Local<ObjectTemplate> templ = ObjectTemplate::New(isolate); templ->Set(v8_str("CEvaluate"), v8::FunctionTemplate::New(isolate, CEvaluate)); - LocalContext context(0, templ); + LocalContext context(nullptr, templ); v8::TryCatch try_catch(isolate); CompileRun("try {" " CEvaluate('throw 1;');" @@ -9741,7 +9779,7 @@ TEST(ContextDetachGlobal) { env2->DetachGlobal(); v8::Local<Context> env3 = Context::New( - env1->GetIsolate(), 0, v8::Local<v8::ObjectTemplate>(), global2); + env1->GetIsolate(), nullptr, v8::Local<v8::ObjectTemplate>(), global2); env3->SetSecurityToken(v8_str("bar")); env3->Enter(); @@ -9821,7 +9859,7 @@ TEST(DetachGlobal) { // Reuse global2 for env3. v8::Local<Context> env3 = Context::New( - env1->GetIsolate(), 0, v8::Local<v8::ObjectTemplate>(), global2); + env1->GetIsolate(), nullptr, v8::Local<v8::ObjectTemplate>(), global2); CHECK(global2->Equals(env1.local(), env3->Global()).FromJust()); // Start by using the same security token for env3 as for env1 and env2. @@ -9907,8 +9945,8 @@ TEST(DetachedAccesses) { CHECK(v8_str("env2_x")->Equals(env1.local(), result).FromJust()); // Reattach env2's proxy - env2 = Context::New(env1->GetIsolate(), 0, v8::Local<v8::ObjectTemplate>(), - env2_global); + env2 = Context::New(env1->GetIsolate(), nullptr, + v8::Local<v8::ObjectTemplate>(), env2_global); env2->SetSecurityToken(foo); { v8::Context::Scope scope(env2); @@ -10259,12 +10297,9 @@ TEST(AccessControlES5) { CHECK(global1->Set(context1, v8_str("other"), global0).FromJust()); // Regression test for issue 1154. - CHECK(CompileRun("Object.keys(other).length == 1") - ->BooleanValue(context1) - .FromJust()); + CHECK(CompileRun("Object.keys(other).length == 1")->BooleanValue(isolate)); CHECK(CompileRun("Object.keys(other)[0] == 'accessible_prop'") - ->BooleanValue(context1) - .FromJust()); + ->BooleanValue(isolate)); CHECK(CompileRun("other.blocked_prop").IsEmpty()); // Regression test for issue 1027. @@ -10354,12 +10389,12 @@ THREADED_TEST(AccessControlGetOwnPropertyNames) { value = CompileRun( "var names = Object.getOwnPropertyNames(other);" "names.length == 1 && names[0] == 'accessible_prop';"); - CHECK(value->BooleanValue(context1).FromJust()); + CHECK(value->BooleanValue(isolate)); value = CompileRun( "var names = Object.getOwnPropertyNames(object);" "names.length == 1 && names[0] == 'accessible_prop';"); - CHECK(value->BooleanValue(context1).FromJust()); + CHECK(value->BooleanValue(isolate)); context1->Exit(); context0->Exit(); @@ -10412,12 +10447,12 @@ THREADED_TEST(CrossDomainAccessors) { func_template->PrototypeTemplate(); // Add an accessor to proto that's accessible by cross-domain JS code. - proto_template->SetAccessor(v8_str("accessible"), ConstTenGetter, 0, + proto_template->SetAccessor(v8_str("accessible"), ConstTenGetter, nullptr, v8::Local<Value>(), v8::ALL_CAN_READ); // Add an accessor that is not accessible by cross-domain JS code. - global_template->SetAccessor(v8_str("unreachable"), UnreachableGetter, 0, - v8::Local<Value>(), v8::DEFAULT); + global_template->SetAccessor(v8_str("unreachable"), UnreachableGetter, + nullptr, v8::Local<Value>(), v8::DEFAULT); v8::Local<Context> context0 = Context::New(isolate, nullptr, global_template); context0->Enter(); @@ -10555,7 +10590,7 @@ TEST(AccessControlIC) { // Force obj into slow case. value = CompileRun("delete obj.prop"); - CHECK(value->BooleanValue(context1).FromJust()); + CHECK(value->BooleanValue(isolate)); // Force inline caches into dictionary probing mode. CompileRun("var o = { x: 0 }; delete o.x; testProp(o);"); // Test that the named access check is called. @@ -10873,7 +10908,7 @@ THREADED_TEST(ShadowObject) { Local<Value> value = CompileRun("this.propertyIsEnumerable(0)"); CHECK(value->IsBoolean()); - CHECK(!value->BooleanValue(context.local()).FromJust()); + CHECK(!value->BooleanValue(isolate)); value = CompileRun("x"); CHECK_EQ(12, value->Int32Value(context.local()).FromJust()); @@ -11335,8 +11370,7 @@ THREADED_TEST(FunctionReadOnlyPrototype) { " descriptor = Object.getOwnPropertyDescriptor(func1, 'prototype');" " return (descriptor['writable'] == false);" "})()") - ->BooleanValue(context.local()) - .FromJust()); + ->BooleanValue(isolate)); CHECK_EQ( 42, CompileRun("func1.prototype.x")->Int32Value(context.local()).FromJust()); @@ -11357,8 +11391,7 @@ THREADED_TEST(FunctionReadOnlyPrototype) { " descriptor = Object.getOwnPropertyDescriptor(func2, 'prototype');" " return (descriptor['writable'] == true);" "})()") - ->BooleanValue(context.local()) - .FromJust()); + ->BooleanValue(isolate)); CHECK_EQ( 42, CompileRun("func2.prototype.x")->Int32Value(context.local()).FromJust()); @@ -11405,9 +11438,7 @@ THREADED_TEST(FunctionRemovePrototype) { Local<v8::Function> fun = t1->GetFunction(context.local()).ToLocalChecked(); CHECK(!fun->IsConstructor()); CHECK(context->Global()->Set(context.local(), v8_str("fun"), fun).FromJust()); - CHECK(!CompileRun("'prototype' in fun") - ->BooleanValue(context.local()) - .FromJust()); + CHECK(!CompileRun("'prototype' in fun")->BooleanValue(isolate)); v8::TryCatch try_catch(isolate); CompileRun("new fun()"); @@ -11460,7 +11491,7 @@ THREADED_TEST(Constructor) { i::Handle<i::JSReceiver> obj(v8::Utils::OpenHandle(*inst)); CHECK(obj->IsJSObject()); Local<Value> value = CompileRun("(new Fun()).constructor === Fun"); - CHECK(value->BooleanValue(context.local()).FromJust()); + CHECK(value->BooleanValue(isolate)); } @@ -13022,17 +13053,16 @@ THREADED_TEST(Overriding) { // Add 'h' as an accessor to the proto template with ReadOnly attributes // so 'h' can be shadowed on the instance object. Local<ObjectTemplate> child_proto_templ = child_templ->PrototypeTemplate(); - child_proto_templ->SetAccessor(v8_str("h"), ParentGetter, 0, + child_proto_templ->SetAccessor(v8_str("h"), ParentGetter, nullptr, v8::Local<Value>(), v8::DEFAULT, v8::ReadOnly); // Add 'i' as an accessor to the instance template with ReadOnly attributes // but the attribute does not have effect because it is duplicated with // nullptr setter. - child_instance_templ->SetAccessor(v8_str("i"), ChildGetter, 0, + child_instance_templ->SetAccessor(v8_str("i"), ChildGetter, nullptr, v8::Local<Value>(), v8::DEFAULT, v8::ReadOnly); - // Instantiate the child template. Local<v8::Object> instance = child_templ->GetFunction(context.local()) .ToLocalChecked() @@ -13475,9 +13505,9 @@ THREADED_TEST(IsConstructCall) { templ->GetFunction(context.local()).ToLocalChecked()) .FromJust()); Local<Value> value = v8_compile("f()")->Run(context.local()).ToLocalChecked(); - CHECK(!value->BooleanValue(context.local()).FromJust()); + CHECK(!value->BooleanValue(isolate)); value = v8_compile("new f()")->Run(context.local()).ToLocalChecked(); - CHECK(value->BooleanValue(context.local()).FromJust()); + CHECK(value->BooleanValue(isolate)); } static void NewTargetHandler(const v8::FunctionCallbackInfo<v8::Value>& args) { @@ -13625,7 +13655,7 @@ TEST(ObjectProtoToStringES6) { CHECK(value->IsString() && \ value->Equals(context.local(), v8_str("[object " #expected "]")) \ .FromJust()); \ - } while (0) + } while (false) TEST_TOSTRINGTAG(Array, Object, Object); TEST_TOSTRINGTAG(Object, Arguments, Arguments); @@ -13664,7 +13694,7 @@ TEST(ObjectProtoToStringES6) { CHECK(value->IsString() && \ value->Equals(context.local(), v8_str("[object " #expected "]")) \ .FromJust()); \ - } while (0) + } while (false) #define TEST_TOSTRINGTAG_TYPES(tagValue) \ TEST_TOSTRINGTAG(Array, tagValue, Array); \ @@ -13701,7 +13731,7 @@ TEST(ObjectProtoToStringES6) { obj = v8::Object::New(isolate); obj.As<v8::Object>() ->SetAccessor(context.local(), toStringTag, - SymbolAccessorGetterReturnsDefault, 0, v8_str("Test")) + SymbolAccessorGetterReturnsDefault, nullptr, v8_str("Test")) .FromJust(); { TryCatch try_catch(isolate); @@ -14163,7 +14193,7 @@ static void CheckSurvivingGlobalObjectsCount(int expected) { // been marked at that point. Therefore some of the maps are not // collected until the second garbage collection. CcTest::CollectAllGarbage(); - CcTest::CollectAllGarbage(i::Heap::kMakeHeapIterableMask); + CcTest::CollectAllGarbage(); int count = GetGlobalObjectsCount(); CHECK_EQ(expected, count); } @@ -14260,9 +14290,7 @@ TEST(WeakCallbackApi) { handle->SetWeak<v8::Persistent<v8::Object>>( handle, WeakApiCallback, v8::WeakCallbackType::kParameter); } - reinterpret_cast<i::Isolate*>(isolate)->heap()->CollectAllGarbage( - i::Heap::kAbortIncrementalMarkingMask, - i::GarbageCollectionReason::kTesting); + CcTest::PreciseCollectAllGarbage(); // Verify disposed. CHECK_EQ(initial_handles, globals->global_handles_count()); } @@ -15170,7 +15198,7 @@ THREADED_TEST(TryCatchSourceInfoForEOSError) { CHECK(v8::Script::Compile(context.local(), v8_str("!\n")).IsEmpty()); CHECK(try_catch.HasCaught()); v8::Local<v8::Message> message = try_catch.Message(); - CHECK_EQ(1, message->GetLineNumber(context.local()).FromJust()); + CHECK_EQ(2, message->GetLineNumber(context.local()).FromJust()); CHECK_EQ(0, message->GetStartColumn(context.local()).FromJust()); } @@ -15776,10 +15804,10 @@ class OneByteVectorResource : public v8::String::ExternalOneByteStringResource { public: explicit OneByteVectorResource(i::Vector<const char> vector) : data_(vector) {} - virtual ~OneByteVectorResource() {} - virtual size_t length() const { return data_.length(); } - virtual const char* data() const { return data_.start(); } - virtual void Dispose() {} + ~OneByteVectorResource() override = default; + size_t length() const override { return data_.length(); } + const char* data() const override { return data_.start(); } + void Dispose() override {} private: i::Vector<const char> data_; @@ -15790,10 +15818,10 @@ class UC16VectorResource : public v8::String::ExternalStringResource { public: explicit UC16VectorResource(i::Vector<const i::uc16> vector) : data_(vector) {} - virtual ~UC16VectorResource() {} - virtual size_t length() const { return data_.length(); } - virtual const i::uc16* data() const { return data_.start(); } - virtual void Dispose() {} + ~UC16VectorResource() override = default; + size_t length() const override { return data_.length(); } + const i::uc16* data() const override { return data_.start(); } + void Dispose() override {} private: i::Vector<const i::uc16> data_; @@ -15962,7 +15990,7 @@ class RegExpInterruptionThread : public v8::base::Thread { explicit RegExpInterruptionThread(v8::Isolate* isolate) : Thread(Options("TimeoutThread")), isolate_(isolate) {} - virtual void Run() { + void Run() override { for (v8::base::Relaxed_Store(®exp_interruption_data.loop_count, 0); v8::base::Relaxed_Load(®exp_interruption_data.loop_count) < 7; v8::base::Relaxed_AtomicIncrement(®exp_interruption_data.loop_count, @@ -16034,7 +16062,7 @@ TEST(ReadOnlyPropertyInGlobalProto) { v8::Isolate* isolate = CcTest::isolate(); v8::HandleScope scope(isolate); v8::Local<v8::ObjectTemplate> templ = v8::ObjectTemplate::New(isolate); - LocalContext context(0, templ); + LocalContext context(nullptr, templ); v8::Local<v8::Object> global = context->Global(); v8::Local<v8::Object> global_proto = v8::Local<v8::Object>::Cast( global->Get(context.local(), v8_str("__proto__")).ToLocalChecked()); @@ -16629,9 +16657,9 @@ static void ObjectWithExternalArrayTestHelper(Local<Context> context, i::ExternalArrayType array_type, int64_t low, int64_t high) { i::Handle<i::JSReceiver> jsobj = v8::Utils::OpenHandle(*obj); - i::Isolate* isolate = jsobj->GetIsolate(); - obj->Set(context, v8_str("field"), - v8::Int32::New(reinterpret_cast<v8::Isolate*>(isolate), 1503)) + v8::Isolate* v8_isolate = context->GetIsolate(); + i::Isolate* isolate = reinterpret_cast<i::Isolate*>(v8_isolate); + obj->Set(context, v8_str("field"), v8::Int32::New(v8_isolate, 1503)) .FromJust(); CHECK(context->Global()->Set(context, v8_str("ext_array"), obj).FromJust()); v8::Local<v8::Value> result = CompileRun("ext_array.field"); @@ -16751,7 +16779,7 @@ static void ObjectWithExternalArrayTestHelper(Local<Context> context, "caught_exception;", element_count); result = CompileRun(test_buf.start()); - CHECK(!result->BooleanValue(context).FromJust()); + CHECK(!result->BooleanValue(v8_isolate)); // Make sure out-of-range stores do not throw. i::SNPrintF(test_buf, @@ -16764,7 +16792,7 @@ static void ObjectWithExternalArrayTestHelper(Local<Context> context, "caught_exception;", element_count); result = CompileRun(test_buf.start()); - CHECK(!result->BooleanValue(context).FromJust()); + CHECK(!result->BooleanValue(v8_isolate)); // Check other boundary conditions, values and operations. result = CompileRun("for (var i = 0; i < 8; i++) {" @@ -16856,7 +16884,7 @@ static void ObjectWithExternalArrayTestHelper(Local<Context> context, unsigned_data : (is_pixel_data ? pixel_data : signed_data))); result = CompileRun(test_buf.start()); - CHECK(result->BooleanValue(context).FromJust()); + CHECK(result->BooleanValue(v8_isolate)); } i::Handle<ExternalArrayClass> array( @@ -17485,7 +17513,7 @@ TEST(CaptureStackTrace) { Local<ObjectTemplate> templ = ObjectTemplate::New(isolate); templ->Set(v8_str("AnalyzeStackInNativeCode"), v8::FunctionTemplate::New(isolate, AnalyzeStackInNativeCode)); - LocalContext context(0, templ); + LocalContext context(nullptr, templ); // Test getting OVERVIEW information. Should ignore information that is not // script name, function name, line number, and column offset. @@ -17899,6 +17927,7 @@ int promise_reject_msg_column_number = -1; int promise_reject_line_number = -1; int promise_reject_column_number = -1; int promise_reject_frame_count = -1; +bool promise_reject_is_shared_cross_origin = false; void PromiseRejectCallback(v8::PromiseRejectMessage reject_message) { v8::Local<v8::Object> global = CcTest::global(); @@ -17920,6 +17949,8 @@ void PromiseRejectCallback(v8::PromiseRejectMessage reject_message) { message->GetLineNumber(context).FromJust(); promise_reject_msg_column_number = message->GetStartColumn(context).FromJust() + 1; + promise_reject_is_shared_cross_origin = + message->IsSharedCrossOrigin(); if (!stack_trace.IsEmpty()) { promise_reject_frame_count = stack_trace->GetFrameCount(); @@ -18350,6 +18381,67 @@ TEST(PromiseRejectCallback) { CHECK_EQ(7, promise_reject_msg_column_number); } +TEST(PromiseRejectIsSharedCrossOrigin) { + LocalContext env; + v8::Isolate* isolate = env->GetIsolate(); + v8::HandleScope scope(isolate); + + isolate->SetPromiseRejectCallback(PromiseRejectCallback); + + ResetPromiseStates(); + + // Create promise p0. + CompileRun( + "var reject; \n" + "var p0 = new Promise( \n" + " function(res, rej) { \n" + " reject = rej; \n" + " } \n" + "); \n"); + CHECK(!GetPromise("p0")->HasHandler()); + CHECK_EQ(0, promise_reject_counter); + CHECK_EQ(0, promise_revoke_counter); + // Not set because it's not yet rejected. + CHECK(!promise_reject_is_shared_cross_origin); + + // Reject p0. + CompileRun("reject('ppp');"); + CHECK_EQ(1, promise_reject_counter); + CHECK_EQ(0, promise_revoke_counter); + // Not set because the ScriptOriginOptions is from the script. + CHECK(!promise_reject_is_shared_cross_origin); + + ResetPromiseStates(); + + // Create promise p1 + CompileRun( + "var reject; \n" + "var p1 = new Promise( \n" + " function(res, rej) { \n" + " reject = rej; \n" + " } \n" + "); \n"); + CHECK(!GetPromise("p1")->HasHandler()); + CHECK_EQ(0, promise_reject_counter); + CHECK_EQ(0, promise_revoke_counter); + // Not set because it's not yet rejected. + CHECK(!promise_reject_is_shared_cross_origin); + + // Add resolve handler (and default reject handler) to p1. + CompileRun("var p2 = p1.then(function(){});"); + CHECK(GetPromise("p1")->HasHandler()); + CHECK(!GetPromise("p2")->HasHandler()); + CHECK_EQ(0, promise_reject_counter); + CHECK_EQ(0, promise_revoke_counter); + + // Reject p1. + CompileRun("reject('ppp');"); + CHECK_EQ(1, promise_reject_counter); + CHECK_EQ(0, promise_revoke_counter); + // Set because the event is from an empty script. + CHECK(promise_reject_is_shared_cross_origin); +} + void PromiseRejectCallbackConstructError( v8::PromiseRejectMessage reject_message) { v8::Local<v8::Context> context = CcTest::isolate()->GetCurrentContext(); @@ -18403,7 +18495,7 @@ TEST(SourceURLInStackTrace) { templ->Set(v8_str("AnalyzeStackOfEvalWithSourceURL"), v8::FunctionTemplate::New(isolate, AnalyzeStackOfEvalWithSourceURL)); - LocalContext context(0, templ); + LocalContext context(nullptr, templ); const char *source = "function outer() {\n" @@ -18447,7 +18539,7 @@ TEST(ScriptIdInStackTrace) { Local<ObjectTemplate> templ = ObjectTemplate::New(isolate); templ->Set(v8_str("AnalyzeScriptIdInStack"), v8::FunctionTemplate::New(isolate, AnalyzeScriptIdInStack)); - LocalContext context(0, templ); + LocalContext context(nullptr, templ); v8::Local<v8::String> scriptSource = v8_str( "function foo() {\n" @@ -18486,7 +18578,7 @@ TEST(InlineScriptWithSourceURLInStackTrace) { templ->Set(v8_str("AnalyzeStackOfInlineScriptWithSourceURL"), v8::FunctionTemplate::New( CcTest::isolate(), AnalyzeStackOfInlineScriptWithSourceURL)); - LocalContext context(0, templ); + LocalContext context(nullptr, templ); const char *source = "function outer() {\n" @@ -18901,7 +18993,7 @@ TEST(DynamicWithSourceURLInStackTrace) { templ->Set(v8_str("AnalyzeStackOfDynamicScriptWithSourceURL"), v8::FunctionTemplate::New( CcTest::isolate(), AnalyzeStackOfDynamicScriptWithSourceURL)); - LocalContext context(0, templ); + LocalContext context(nullptr, templ); const char *source = "function outer() {\n" @@ -19202,7 +19294,7 @@ TEST(NumberOfNativeContexts) { } for (size_t i = 0; i < kNumTestContexts; i++) { context[i].Reset(); - CcTest::CollectAllGarbage(i::Heap::kAbortIncrementalMarkingMask); + CcTest::PreciseCollectAllGarbage(); CcTest::isolate()->GetHeapStatistics(&heap_statistics); CHECK_EQ(kNumTestContexts - i - 1u, heap_statistics.number_of_native_contexts()); @@ -19228,7 +19320,7 @@ TEST(NumberOfDetachedContexts) { } for (size_t i = 0; i < kNumTestContexts; i++) { context[i].Reset(); - CcTest::CollectAllGarbage(i::Heap::kAbortIncrementalMarkingMask); + CcTest::PreciseCollectAllGarbage(); CcTest::isolate()->GetHeapStatistics(&heap_statistics); CHECK_EQ(kNumTestContexts - i - 1u, heap_statistics.number_of_detached_contexts()); @@ -19243,8 +19335,8 @@ class VisitorImpl : public v8::ExternalResourceVisitor { found_resource_[i] = false; } } - virtual ~VisitorImpl() {} - virtual void VisitExternalString(v8::Local<v8::String> string) { + ~VisitorImpl() override = default; + void VisitExternalString(v8::Local<v8::String> string) override { if (!string->IsExternal()) { CHECK(string->IsExternalOneByte()); return; @@ -19772,7 +19864,8 @@ THREADED_TEST(FunctionGetInferredName) { THREADED_TEST(FunctionGetDebugName) { LocalContext env; - v8::HandleScope scope(env->GetIsolate()); + v8::Isolate* isolate = env->GetIsolate(); + v8::HandleScope scope(isolate); const char* code = "var error = false;" "function a() { this.x = 1; };" @@ -19823,7 +19916,7 @@ THREADED_TEST(FunctionGetDebugName) { .ToLocalChecked(); v8::Local<v8::Value> error = env->Global()->Get(env.local(), v8_str("error")).ToLocalChecked(); - CHECK(!error->BooleanValue(env.local()).FromJust()); + CHECK(!error->BooleanValue(isolate)); const char* functions[] = {"a", "display_a", "b", "display_b", "c", "c", @@ -19840,20 +19933,20 @@ THREADED_TEST(FunctionGetDebugName) { v8::Local<v8::Function> f = v8::Local<v8::Function>::Cast( env->Global() ->Get(env.local(), - v8::String::NewFromUtf8(env->GetIsolate(), functions[i * 2], + v8::String::NewFromUtf8(isolate, functions[i * 2], v8::NewStringType::kNormal) .ToLocalChecked()) .ToLocalChecked()); CHECK_EQ(0, strcmp(functions[i * 2 + 1], - *v8::String::Utf8Value(env->GetIsolate(), - f->GetDebugName()))); + *v8::String::Utf8Value(isolate, f->GetDebugName()))); } } THREADED_TEST(FunctionGetDisplayName) { LocalContext env; - v8::HandleScope scope(env->GetIsolate()); + v8::Isolate* isolate = env->GetIsolate(); + v8::HandleScope scope(isolate); const char* code = "var error = false;" "function a() { this.x = 1; };" "a.displayName = 'display_a';" @@ -19907,18 +20000,17 @@ THREADED_TEST(FunctionGetDisplayName) { env->Global()->Get(env.local(), v8_str("f")).ToLocalChecked()); v8::Local<v8::Function> g = v8::Local<v8::Function>::Cast( env->Global()->Get(env.local(), v8_str("g")).ToLocalChecked()); - CHECK(!error->BooleanValue(env.local()).FromJust()); - CHECK_EQ(0, strcmp("display_a", *v8::String::Utf8Value(env->GetIsolate(), - a->GetDisplayName()))); - CHECK_EQ(0, strcmp("display_b", *v8::String::Utf8Value(env->GetIsolate(), - b->GetDisplayName()))); + CHECK(!error->BooleanValue(isolate)); + CHECK_EQ(0, strcmp("display_a", + *v8::String::Utf8Value(isolate, a->GetDisplayName()))); + CHECK_EQ(0, strcmp("display_b", + *v8::String::Utf8Value(isolate, b->GetDisplayName()))); CHECK(c->GetDisplayName()->IsUndefined()); CHECK(d->GetDisplayName()->IsUndefined()); CHECK(e->GetDisplayName()->IsUndefined()); CHECK(f->GetDisplayName()->IsUndefined()); - CHECK_EQ( - 0, strcmp("set_in_runtime", *v8::String::Utf8Value(env->GetIsolate(), - g->GetDisplayName()))); + CHECK_EQ(0, strcmp("set_in_runtime", + *v8::String::Utf8Value(isolate, g->GetDisplayName()))); } @@ -20313,7 +20405,7 @@ void PrologueCallbackAlloc(v8::Isolate* isolate, Local<Object> obj = Object::New(isolate); CHECK(!obj.IsEmpty()); - CcTest::CollectAllGarbage(i::Heap::kAbortIncrementalMarkingMask); + CcTest::PreciseCollectAllGarbage(); } @@ -20332,7 +20424,7 @@ void EpilogueCallbackAlloc(v8::Isolate* isolate, Local<Object> obj = Object::New(isolate); CHECK(!obj.IsEmpty()); - CcTest::CollectAllGarbage(i::Heap::kAbortIncrementalMarkingMask); + CcTest::PreciseCollectAllGarbage(); } @@ -20455,7 +20547,7 @@ TEST(GCCallbacks) { CHECK_EQ(0, epilogue_call_count_alloc); isolate->AddGCPrologueCallback(PrologueCallbackAlloc); isolate->AddGCEpilogueCallback(EpilogueCallbackAlloc); - CcTest::CollectAllGarbage(i::Heap::kAbortIncrementalMarkingMask); + CcTest::PreciseCollectAllGarbage(); CHECK_EQ(1, prologue_call_count_alloc); CHECK_EQ(1, epilogue_call_count_alloc); isolate->RemoveGCPrologueCallback(PrologueCallbackAlloc); @@ -20998,7 +21090,7 @@ class IsolateThread : public v8::base::Thread { explicit IsolateThread(int fib_limit) : Thread(Options("IsolateThread")), fib_limit_(fib_limit), result_(0) {} - void Run() { + void Run() override { v8::Isolate::CreateParams create_params; create_params.array_buffer_allocator = CcTest::array_buffer_allocator(); v8::Isolate* isolate = v8::Isolate::New(create_params); @@ -21078,7 +21170,7 @@ class InitDefaultIsolateThread : public v8::base::Thread { testCase_(testCase), result_(false) {} - void Run() { + void Run() override { v8::Isolate::CreateParams create_params; create_params.array_buffer_allocator = CcTest::array_buffer_allocator(); switch (testCase_) { @@ -21268,8 +21360,8 @@ class Visitor42 : public v8::PersistentHandleVisitor { explicit Visitor42(v8::Persistent<v8::Object>* object) : counter_(0), object_(object) { } - virtual void VisitPersistentHandle(Persistent<Value>* value, - uint16_t class_id) { + void VisitPersistentHandle(Persistent<Value>* value, + uint16_t class_id) override { if (class_id != 42) return; CHECK_EQ(42, value->WrapperClassId()); v8::Isolate* isolate = CcTest::isolate(); @@ -21765,7 +21857,7 @@ TEST(HasOwnProperty) { { // Check named query interceptors. Local<ObjectTemplate> templ = ObjectTemplate::New(isolate); templ->SetHandler(v8::NamedPropertyHandlerConfiguration( - 0, 0, HasOwnPropertyNamedPropertyQuery)); + nullptr, nullptr, HasOwnPropertyNamedPropertyQuery)); Local<Object> instance = templ->NewInstance(env.local()).ToLocalChecked(); CHECK(instance->HasOwnProperty(env.local(), v8_str("foo")).FromJust()); CHECK(!instance->HasOwnProperty(env.local(), v8_str("bar")).FromJust()); @@ -21773,7 +21865,7 @@ TEST(HasOwnProperty) { { // Check indexed query interceptors. Local<ObjectTemplate> templ = ObjectTemplate::New(isolate); templ->SetHandler(v8::IndexedPropertyHandlerConfiguration( - 0, 0, HasOwnPropertyIndexedPropertyQuery)); + nullptr, nullptr, HasOwnPropertyIndexedPropertyQuery)); Local<Object> instance = templ->NewInstance(env.local()).ToLocalChecked(); CHECK(instance->HasOwnProperty(env.local(), v8_str("42")).FromJust()); CHECK(instance->HasOwnProperty(env.local(), 42).FromJust()); @@ -21790,7 +21882,7 @@ TEST(HasOwnProperty) { { // Check that query wins on disagreement. Local<ObjectTemplate> templ = ObjectTemplate::New(isolate); templ->SetHandler(v8::NamedPropertyHandlerConfiguration( - HasOwnPropertyNamedPropertyGetter, 0, + HasOwnPropertyNamedPropertyGetter, nullptr, HasOwnPropertyNamedPropertyQuery2)); Local<Object> instance = templ->NewInstance(env.local()).ToLocalChecked(); CHECK(!instance->HasOwnProperty(env.local(), v8_str("foo")).FromJust()); @@ -21806,7 +21898,7 @@ TEST(HasOwnProperty) { "var dyn_string = 'this string ';" "dyn_string += 'does not exist elsewhere';" "({}).hasOwnProperty.call(obj, dyn_string)"; - CHECK(CompileRun(src)->BooleanValue(env.local()).FromJust()); + CHECK(CompileRun(src)->BooleanValue(isolate)); } } @@ -21824,14 +21916,14 @@ TEST(IndexedInterceptorWithStringProto) { .FromJust()); CompileRun("var s = new String('foobar'); obj.__proto__ = s;"); // These should be intercepted. - CHECK(CompileRun("42 in obj")->BooleanValue(context.local()).FromJust()); - CHECK(CompileRun("'42' in obj")->BooleanValue(context.local()).FromJust()); + CHECK(CompileRun("42 in obj")->BooleanValue(isolate)); + CHECK(CompileRun("'42' in obj")->BooleanValue(isolate)); // These should fall through to the String prototype. - CHECK(CompileRun("0 in obj")->BooleanValue(context.local()).FromJust()); - CHECK(CompileRun("'0' in obj")->BooleanValue(context.local()).FromJust()); + CHECK(CompileRun("0 in obj")->BooleanValue(isolate)); + CHECK(CompileRun("'0' in obj")->BooleanValue(isolate)); // And these should both fail. - CHECK(!CompileRun("32 in obj")->BooleanValue(context.local()).FromJust()); - CHECK(!CompileRun("'32' in obj")->BooleanValue(context.local()).FromJust()); + CHECK(!CompileRun("32 in obj")->BooleanValue(isolate)); + CHECK(!CompileRun("'32' in obj")->BooleanValue(isolate)); } @@ -22008,7 +22100,7 @@ static int CountLiveMapsInMapCache(i::Context* context) { int length = map_cache->length(); int count = 0; for (int i = 0; i < length; i++) { - if (map_cache->Get(i)->IsWeakHeapObject()) count++; + if (map_cache->Get(i)->IsWeak()) count++; } return count; } @@ -22034,7 +22126,7 @@ THREADED_TEST(Regress1516) { CHECK_LE(1, elements); // We have to abort incremental marking here to abandon black pages. - CcTest::CollectAllGarbage(i::Heap::kAbortIncrementalMarkingMask); + CcTest::PreciseCollectAllGarbage(); CHECK_GT(elements, CountLiveMapsInMapCache(CcTest::i_isolate()->context())); } @@ -23585,7 +23677,7 @@ THREADED_TEST(JSONStringifyObjectWithGap) { class ThreadInterruptTest { public: ThreadInterruptTest() : sem_(0), sem_value_(0) { } - ~ThreadInterruptTest() {} + ~ThreadInterruptTest() = default; void RunTest() { InterruptThread i_thread(this); @@ -23603,7 +23695,7 @@ class ThreadInterruptTest { explicit InterruptThread(ThreadInterruptTest* test) : Thread(Options("InterruptThread")), test_(test) {} - virtual void Run() { + void Run() override { struct sigaction action; // Ensure that we'll enter waiting condition @@ -23798,8 +23890,9 @@ TEST(AccessCheckThrows) { CheckCorrectThrow("JSON.stringify(other)"); CheckCorrectThrow("has_own_property(other, 'x')"); CheckCorrectThrow("%GetProperty(other, 'x')"); - CheckCorrectThrow("%SetProperty(other, 'x', 'foo', 0)"); + CheckCorrectThrow("%SetKeyedProperty(other, 'x', 'foo', 0)"); CheckCorrectThrow("%AddNamedProperty(other, 'x', 'foo', 1)"); + CheckCorrectThrow("%SetNamedProperty(other, 'y', 'foo', 1)"); STATIC_ASSERT(static_cast<int>(i::LanguageMode::kSloppy) == 0); STATIC_ASSERT(static_cast<int>(i::LanguageMode::kStrict) == 1); CheckCorrectThrow("%DeleteProperty(other, 'x', 0)"); // 0 == SLOPPY @@ -23932,7 +24025,7 @@ class RequestInterruptTestBase { should_continue_(true) { } - virtual ~RequestInterruptTestBase() { } + virtual ~RequestInterruptTestBase() = default; virtual void StartInterruptThread() = 0; @@ -23987,9 +24080,7 @@ class RequestInterruptTestBaseWithSimpleInterrupt public: RequestInterruptTestBaseWithSimpleInterrupt() : i_thread(this) { } - virtual void StartInterruptThread() { - i_thread.Start(); - } + void StartInterruptThread() override { i_thread.Start(); } private: class InterruptThread : public v8::base::Thread { @@ -23997,7 +24088,7 @@ class RequestInterruptTestBaseWithSimpleInterrupt explicit InterruptThread(RequestInterruptTestBase* test) : Thread(Options("RequestInterruptTest")), test_(test) {} - virtual void Run() { + void Run() override { test_->sem_.Wait(); test_->isolate_->RequestInterrupt(&OnInterrupt, test_); } @@ -24018,7 +24109,7 @@ class RequestInterruptTestBaseWithSimpleInterrupt class RequestInterruptTestWithFunctionCall : public RequestInterruptTestBaseWithSimpleInterrupt { public: - virtual void TestBody() { + void TestBody() override { Local<Function> func = Function::New(env_.local(), ShouldContinueCallback, v8::External::New(isolate_, this)) .ToLocalChecked(); @@ -24034,7 +24125,7 @@ class RequestInterruptTestWithFunctionCall class RequestInterruptTestWithMethodCall : public RequestInterruptTestBaseWithSimpleInterrupt { public: - virtual void TestBody() { + void TestBody() override { v8::Local<v8::FunctionTemplate> t = v8::FunctionTemplate::New(isolate_); v8::Local<v8::Template> proto = t->PrototypeTemplate(); proto->Set(v8_str("shouldContinue"), @@ -24053,7 +24144,7 @@ class RequestInterruptTestWithMethodCall class RequestInterruptTestWithAccessor : public RequestInterruptTestBaseWithSimpleInterrupt { public: - virtual void TestBody() { + void TestBody() override { v8::Local<v8::FunctionTemplate> t = v8::FunctionTemplate::New(isolate_); v8::Local<v8::Template> proto = t->PrototypeTemplate(); proto->SetAccessorProperty(v8_str("shouldContinue"), FunctionTemplate::New( @@ -24071,7 +24162,7 @@ class RequestInterruptTestWithAccessor class RequestInterruptTestWithNativeAccessor : public RequestInterruptTestBaseWithSimpleInterrupt { public: - virtual void TestBody() { + void TestBody() override { v8::Local<v8::FunctionTemplate> t = v8::FunctionTemplate::New(isolate_); t->InstanceTemplate()->SetNativeDataProperty( v8_str("shouldContinue"), &ShouldContinueNativeGetter, nullptr, @@ -24099,7 +24190,7 @@ class RequestInterruptTestWithNativeAccessor class RequestInterruptTestWithMethodCallAndInterceptor : public RequestInterruptTestBaseWithSimpleInterrupt { public: - virtual void TestBody() { + void TestBody() override { v8::Local<v8::FunctionTemplate> t = v8::FunctionTemplate::New(isolate_); v8::Local<v8::Template> proto = t->PrototypeTemplate(); proto->Set(v8_str("shouldContinue"), @@ -24126,7 +24217,7 @@ class RequestInterruptTestWithMethodCallAndInterceptor class RequestInterruptTestWithMathAbs : public RequestInterruptTestBaseWithSimpleInterrupt { public: - virtual void TestBody() { + void TestBody() override { env_->Global() ->Set(env_.local(), v8_str("WakeUpInterruptor"), Function::New(env_.local(), WakeUpInterruptorCallback, @@ -24164,9 +24255,7 @@ class RequestInterruptTestWithMathAbs private: static void WakeUpInterruptorCallback( const v8::FunctionCallbackInfo<Value>& info) { - if (!info[0] - ->BooleanValue(info.GetIsolate()->GetCurrentContext()) - .FromJust()) { + if (!info[0]->BooleanValue(info.GetIsolate())) { return; } @@ -24220,11 +24309,9 @@ class RequestMultipleInterrupts : public RequestInterruptTestBase { public: RequestMultipleInterrupts() : i_thread(this), counter_(0) {} - virtual void StartInterruptThread() { - i_thread.Start(); - } + void StartInterruptThread() override { i_thread.Start(); } - virtual void TestBody() { + void TestBody() override { Local<Function> func = Function::New(env_.local(), ShouldContinueCallback, v8::External::New(isolate_, this)) .ToLocalChecked(); @@ -24242,7 +24329,7 @@ class RequestMultipleInterrupts : public RequestInterruptTestBase { explicit InterruptThread(RequestMultipleInterrupts* test) : Thread(Options("RequestInterruptTest")), test_(test) {} - virtual void Run() { + void Run() override { test_->sem_.Wait(); for (int i = 0; i < NUM_INTERRUPTS; i++) { test_->isolate_->RequestInterrupt(&OnInterrupt, test_); @@ -24369,7 +24456,8 @@ TEST(Regress239669) { v8::Isolate* isolate = context->GetIsolate(); v8::HandleScope scope(isolate); Local<ObjectTemplate> templ = ObjectTemplate::New(isolate); - templ->SetAccessor(v8_str("x"), 0, SetterWhichExpectsThisAndHolderToDiffer); + templ->SetAccessor(v8_str("x"), nullptr, + SetterWhichExpectsThisAndHolderToDiffer); CHECK(context->Global() ->Set(context.local(), v8_str("P"), templ->NewInstance(context.local()).ToLocalChecked()) @@ -25591,7 +25679,7 @@ class TestSourceStream : public v8::ScriptCompiler::ExternalSourceStream { public: explicit TestSourceStream(const char** chunks) : chunks_(chunks), index_(0) {} - virtual size_t GetMoreData(const uint8_t** src) { + size_t GetMoreData(const uint8_t** src) override { // Unlike in real use cases, this function will never block. if (chunks_[index_] == nullptr) { return 0; @@ -26466,58 +26554,6 @@ TEST(TurboAsmDisablesNeuter) { CHECK(!result->IsNeuterable()); } -TEST(GetPrototypeAccessControl) { - i::FLAG_allow_natives_syntax = true; - v8::Isolate* isolate = CcTest::isolate(); - v8::HandleScope handle_scope(isolate); - LocalContext env; - - v8::Local<v8::ObjectTemplate> obj_template = v8::ObjectTemplate::New(isolate); - obj_template->SetAccessCheckCallback(AccessAlwaysBlocked); - - CHECK(env->Global() - ->Set(env.local(), v8_str("prohibited"), - obj_template->NewInstance(env.local()).ToLocalChecked()) - .FromJust()); - - CHECK(CompileRun( - "function f() { return %_GetPrototype(prohibited); }" - "%OptimizeFunctionOnNextCall(f);" - "f();")->IsNull()); -} - - -TEST(GetPrototypeHidden) { - i::FLAG_allow_natives_syntax = true; - v8::Isolate* isolate = CcTest::isolate(); - v8::HandleScope handle_scope(isolate); - LocalContext env; - - Local<FunctionTemplate> t = FunctionTemplate::New(isolate); - t->SetHiddenPrototype(true); - Local<Object> proto = t->GetFunction(env.local()) - .ToLocalChecked() - ->NewInstance(env.local()) - .ToLocalChecked(); - Local<Object> object = Object::New(isolate); - Local<Object> proto2 = Object::New(isolate); - object->SetPrototype(env.local(), proto).FromJust(); - proto->SetPrototype(env.local(), proto2).FromJust(); - - CHECK(env->Global()->Set(env.local(), v8_str("object"), object).FromJust()); - CHECK(env->Global()->Set(env.local(), v8_str("proto"), proto).FromJust()); - CHECK(env->Global()->Set(env.local(), v8_str("proto2"), proto2).FromJust()); - - v8::Local<v8::Value> result = CompileRun("%_GetPrototype(object)"); - CHECK(result->Equals(env.local(), proto2).FromJust()); - - result = CompileRun( - "function f() { return %_GetPrototype(object); }" - "%OptimizeFunctionOnNextCall(f);" - "f()"); - CHECK(result->Equals(env.local(), proto2).FromJust()); -} - TEST(ClassPrototypeCreationContext) { v8::Isolate* isolate = CcTest::isolate(); @@ -27146,35 +27182,32 @@ THREADED_TEST(ReceiverConversionForAccessors) { Local<v8::Object> instance = templ->NewInstance(env.local()).ToLocalChecked(); CHECK(env->Global()->Set(env.local(), v8_str("p"), instance).FromJust()); - CHECK(CompileRun("(p.acc == 42)")->BooleanValue(env.local()).FromJust()); - CHECK(CompileRun("(p.acc = 7) == 7")->BooleanValue(env.local()).FromJust()); + CHECK(CompileRun("(p.acc == 42)")->BooleanValue(isolate)); + CHECK(CompileRun("(p.acc = 7) == 7")->BooleanValue(isolate)); CHECK(!CompileRun("Number.prototype.__proto__ = p;" "var a = 1;") .IsEmpty()); - CHECK(CompileRun("(a.acc == 42)")->BooleanValue(env.local()).FromJust()); - CHECK(CompileRun("(a.acc = 7) == 7")->BooleanValue(env.local()).FromJust()); + CHECK(CompileRun("(a.acc == 42)")->BooleanValue(isolate)); + CHECK(CompileRun("(a.acc = 7) == 7")->BooleanValue(isolate)); CHECK(!CompileRun("Boolean.prototype.__proto__ = p;" "var a = true;") .IsEmpty()); - CHECK(CompileRun("(a.acc == 42)")->BooleanValue(env.local()).FromJust()); - CHECK(CompileRun("(a.acc = 7) == 7")->BooleanValue(env.local()).FromJust()); + CHECK(CompileRun("(a.acc == 42)")->BooleanValue(isolate)); + CHECK(CompileRun("(a.acc = 7) == 7")->BooleanValue(isolate)); CHECK(!CompileRun("String.prototype.__proto__ = p;" "var a = 'foo';") .IsEmpty()); - CHECK(CompileRun("(a.acc == 42)")->BooleanValue(env.local()).FromJust()); - CHECK(CompileRun("(a.acc = 7) == 7")->BooleanValue(env.local()).FromJust()); + CHECK(CompileRun("(a.acc == 42)")->BooleanValue(isolate)); + CHECK(CompileRun("(a.acc = 7) == 7")->BooleanValue(isolate)); - CHECK(CompileRun("acc.call(1) == 42")->BooleanValue(env.local()).FromJust()); - CHECK(CompileRun("acc.call(true)==42")->BooleanValue(env.local()).FromJust()); - CHECK(CompileRun("acc.call('aa')==42")->BooleanValue(env.local()).FromJust()); - CHECK( - CompileRun("acc.call(null) == 42")->BooleanValue(env.local()).FromJust()); - CHECK(CompileRun("acc.call(undefined) == 42") - ->BooleanValue(env.local()) - .FromJust()); + CHECK(CompileRun("acc.call(1) == 42")->BooleanValue(isolate)); + CHECK(CompileRun("acc.call(true)==42")->BooleanValue(isolate)); + CHECK(CompileRun("acc.call('aa')==42")->BooleanValue(isolate)); + CHECK(CompileRun("acc.call(null) == 42")->BooleanValue(isolate)); + CHECK(CompileRun("acc.call(undefined) == 42")->BooleanValue(isolate)); } class FutexInterruptionThread : public v8::base::Thread { @@ -27182,7 +27215,7 @@ class FutexInterruptionThread : public v8::base::Thread { explicit FutexInterruptionThread(v8::Isolate* isolate) : Thread(Options("FutexInterruptionThread")), isolate_(isolate) {} - virtual void Run() { + void Run() override { // Wait a bit before terminating. v8::base::OS::Sleep(v8::base::TimeDelta::FromMilliseconds(100)); isolate_->TerminateExecution(); @@ -27622,7 +27655,7 @@ class MemoryPressureThread : public v8::base::Thread { isolate_(isolate), level_(level) {} - virtual void Run() { isolate_->MemoryPressureNotification(level_); } + void Run() override { isolate_->MemoryPressureNotification(level_); } private: v8::Isolate* isolate_; @@ -27679,13 +27712,13 @@ TEST(SetIntegrityLevel) { CHECK(context->Global()->Set(context.local(), v8_str("o"), obj).FromJust()); v8::Local<v8::Value> is_frozen = CompileRun("Object.isFrozen(o)"); - CHECK(!is_frozen->BooleanValue(context.local()).FromJust()); + CHECK(!is_frozen->BooleanValue(isolate)); CHECK(obj->SetIntegrityLevel(context.local(), v8::IntegrityLevel::kFrozen) .FromJust()); is_frozen = CompileRun("Object.isFrozen(o)"); - CHECK(is_frozen->BooleanValue(context.local()).FromJust()); + CHECK(is_frozen->BooleanValue(isolate)); } TEST(PrivateForApiIsNumber) { @@ -27851,7 +27884,7 @@ THREADED_TEST(ImmutableProtoGlobal) { v8::HandleScope handle_scope(isolate); Local<ObjectTemplate> global_template = ObjectTemplate::New(isolate); global_template->SetImmutableProto(); - v8::Local<Context> context = Context::New(isolate, 0, global_template); + v8::Local<Context> context = Context::New(isolate, nullptr, global_template); Context::Scope context_scope(context); v8::Local<Value> result = CompileRun( "global = this;" @@ -27871,7 +27904,7 @@ THREADED_TEST(MutableProtoGlobal) { v8::Isolate* isolate = CcTest::isolate(); v8::HandleScope handle_scope(isolate); Local<ObjectTemplate> global_template = ObjectTemplate::New(isolate); - v8::Local<Context> context = Context::New(isolate, 0, global_template); + v8::Local<Context> context = Context::New(isolate, nullptr, global_template); Context::Scope context_scope(context); v8::Local<Value> result = CompileRun( "global = this;" @@ -28445,7 +28478,7 @@ class StopAtomicsWaitThread : public v8::base::Thread { explicit StopAtomicsWaitThread(AtomicsWaitCallbackInfo* info) : Thread(Options("StopAtomicsWaitThread")), info_(info) {} - virtual void Run() { + void Run() override { CHECK_NOT_NULL(info_->wake_handle); info_->wake_handle->Wake(); } @@ -28778,216 +28811,28 @@ TEST(TestSetWasmThreadsEnabledCallback) { CHECK(i_isolate->AreWasmThreadsEnabled(i_context)); } -TEST(PreviewSetIteratorEntriesWithDeleted) { +TEST(TestGetEmbeddedCodeRange) { LocalContext env; - v8::HandleScope handle_scope(env->GetIsolate()); - v8::Local<v8::Context> context = env.local(); + v8::Isolate* isolate = env->GetIsolate(); + i::Isolate* i_isolate = reinterpret_cast<i::Isolate*>(isolate); - { - // Create set, delete entry, create iterator, preview. - v8::Local<v8::Object> iterator = - CompileRun("var set = new Set([1,2,3]); set.delete(1); set.keys()") - ->ToObject(context) - .ToLocalChecked(); - bool is_key; - v8::Local<v8::Array> entries = - iterator->PreviewEntries(&is_key).ToLocalChecked(); - CHECK(!is_key); - CHECK_EQ(2, entries->Length()); - CHECK_EQ(2, entries->Get(context, 0) - .ToLocalChecked() - ->Int32Value(context) - .FromJust()); - CHECK_EQ(3, entries->Get(context, 1) - .ToLocalChecked() - ->Int32Value(context) - .FromJust()); - } - { - // Create set, create iterator, delete entry, preview. - v8::Local<v8::Object> iterator = - CompileRun("var set = new Set([1,2,3]); set.keys()") - ->ToObject(context) - .ToLocalChecked(); - CompileRun("set.delete(1);"); - bool is_key; - v8::Local<v8::Array> entries = - iterator->PreviewEntries(&is_key).ToLocalChecked(); - CHECK(!is_key); - CHECK_EQ(2, entries->Length()); - CHECK_EQ(2, entries->Get(context, 0) - .ToLocalChecked() - ->Int32Value(context) - .FromJust()); - CHECK_EQ(3, entries->Get(context, 1) - .ToLocalChecked() - ->Int32Value(context) - .FromJust()); - } - { - // Create set, create iterator, delete entry, iterate, preview. - v8::Local<v8::Object> iterator = - CompileRun("var set = new Set([1,2,3]); var it = set.keys(); it") - ->ToObject(context) - .ToLocalChecked(); - CompileRun("set.delete(1); it.next();"); - bool is_key; - v8::Local<v8::Array> entries = - iterator->PreviewEntries(&is_key).ToLocalChecked(); - CHECK(!is_key); - CHECK_EQ(1, entries->Length()); - CHECK_EQ(3, entries->Get(context, 0) - .ToLocalChecked() - ->Int32Value(context) - .FromJust()); - } - { - // Create set, create iterator, delete entry, iterate until empty, preview. - v8::Local<v8::Object> iterator = - CompileRun("var set = new Set([1,2,3]); var it = set.keys(); it") - ->ToObject(context) - .ToLocalChecked(); - CompileRun("set.delete(1); it.next(); it.next();"); - bool is_key; - v8::Local<v8::Array> entries = - iterator->PreviewEntries(&is_key).ToLocalChecked(); - CHECK(!is_key); - CHECK_EQ(0, entries->Length()); - } - { - // Create set, create iterator, delete entry, iterate, trigger rehash, - // preview. - v8::Local<v8::Object> iterator = - CompileRun("var set = new Set([1,2,3]); var it = set.keys(); it") - ->ToObject(context) - .ToLocalChecked(); - CompileRun("set.delete(1); it.next();"); - CompileRun("for (var i = 4; i < 20; i++) set.add(i);"); - bool is_key; - v8::Local<v8::Array> entries = - iterator->PreviewEntries(&is_key).ToLocalChecked(); - CHECK(!is_key); - CHECK_EQ(17, entries->Length()); - for (uint32_t i = 0; i < 17; i++) { - CHECK_EQ(i + 3, entries->Get(context, i) - .ToLocalChecked() - ->Int32Value(context) - .FromJust()); - } - } -} + v8::MemoryRange builtins_range = isolate->GetEmbeddedCodeRange(); -TEST(PreviewMapIteratorEntriesWithDeleted) { - LocalContext env; - v8::HandleScope handle_scope(env->GetIsolate()); - v8::Local<v8::Context> context = env.local(); + // Check that each off-heap builtin is within the builtins code range. + if (i::FLAG_embedded_builtins) { + for (int id = 0; id < i::Builtins::builtin_count; id++) { + if (!i::Builtins::IsIsolateIndependent(id)) continue; + i::Code* builtin = i_isolate->builtins()->builtin(id); + i::Address start = builtin->InstructionStart(); + i::Address end = start + builtin->InstructionSize(); - { - // Create map, delete entry, create iterator, preview. - v8::Local<v8::Object> iterator = CompileRun( - "var map = new Map();" - "var key = {}; map.set(key, 1);" - "map.set({}, 2); map.set({}, 3);" - "map.delete(key);" - "map.values()") - ->ToObject(context) - .ToLocalChecked(); - bool is_key; - v8::Local<v8::Array> entries = - iterator->PreviewEntries(&is_key).ToLocalChecked(); - CHECK(!is_key); - CHECK_EQ(2, entries->Length()); - CHECK_EQ(2, entries->Get(context, 0) - .ToLocalChecked() - ->Int32Value(context) - .FromJust()); - CHECK_EQ(3, entries->Get(context, 1) - .ToLocalChecked() - ->Int32Value(context) - .FromJust()); - } - { - // Create map, create iterator, delete entry, preview. - v8::Local<v8::Object> iterator = CompileRun( - "var map = new Map();" - "var key = {}; map.set(key, 1);" - "map.set({}, 2); map.set({}, 3);" - "map.values()") - ->ToObject(context) - .ToLocalChecked(); - CompileRun("map.delete(key);"); - bool is_key; - v8::Local<v8::Array> entries = - iterator->PreviewEntries(&is_key).ToLocalChecked(); - CHECK(!is_key); - CHECK_EQ(2, entries->Length()); - CHECK_EQ(2, entries->Get(context, 0) - .ToLocalChecked() - ->Int32Value(context) - .FromJust()); - CHECK_EQ(3, entries->Get(context, 1) - .ToLocalChecked() - ->Int32Value(context) - .FromJust()); - } - { - // Create map, create iterator, delete entry, iterate, preview. - v8::Local<v8::Object> iterator = CompileRun( - "var map = new Map();" - "var key = {}; map.set(key, 1);" - "map.set({}, 2); map.set({}, 3);" - "var it = map.values(); it") - ->ToObject(context) - .ToLocalChecked(); - CompileRun("map.delete(key); it.next();"); - bool is_key; - v8::Local<v8::Array> entries = - iterator->PreviewEntries(&is_key).ToLocalChecked(); - CHECK(!is_key); - CHECK_EQ(1, entries->Length()); - CHECK_EQ(3, entries->Get(context, 0) - .ToLocalChecked() - ->Int32Value(context) - .FromJust()); - } - { - // Create map, create iterator, delete entry, iterate until empty, preview. - v8::Local<v8::Object> iterator = CompileRun( - "var map = new Map();" - "var key = {}; map.set(key, 1);" - "map.set({}, 2); map.set({}, 3);" - "var it = map.values(); it") - ->ToObject(context) - .ToLocalChecked(); - CompileRun("map.delete(key); it.next(); it.next();"); - bool is_key; - v8::Local<v8::Array> entries = - iterator->PreviewEntries(&is_key).ToLocalChecked(); - CHECK(!is_key); - CHECK_EQ(0, entries->Length()); - } - { - // Create map, create iterator, delete entry, iterate, trigger rehash, - // preview. - v8::Local<v8::Object> iterator = CompileRun( - "var map = new Map();" - "var key = {}; map.set(key, 1);" - "map.set({}, 2); map.set({}, 3);" - "var it = map.values(); it") - ->ToObject(context) - .ToLocalChecked(); - CompileRun("map.delete(key); it.next();"); - CompileRun("for (var i = 4; i < 20; i++) map.set({}, i);"); - bool is_key; - v8::Local<v8::Array> entries = - iterator->PreviewEntries(&is_key).ToLocalChecked(); - CHECK(!is_key); - CHECK_EQ(17, entries->Length()); - for (uint32_t i = 0; i < 17; i++) { - CHECK_EQ(i + 3, entries->Get(context, i) - .ToLocalChecked() - ->Int32Value(context) - .FromJust()); + i::Address builtins_start = + reinterpret_cast<i::Address>(builtins_range.start); + CHECK(start >= builtins_start && + end < builtins_start + builtins_range.length_in_bytes); } + } else { + CHECK_EQ(nullptr, builtins_range.start); + CHECK_EQ(0, builtins_range.length_in_bytes); } } diff --git a/deps/v8/test/cctest/test-assembler-arm64.cc b/deps/v8/test/cctest/test-assembler-arm64.cc index c0f8e171c7..f2ca5c01e5 100644 --- a/deps/v8/test/cctest/test-assembler-arm64.cc +++ b/deps/v8/test/cctest/test-assembler-arm64.cc @@ -209,7 +209,8 @@ static void InitializeVM() { __ Ret(); \ __ GetCode(masm.isolate(), nullptr); -#define TEARDOWN() CHECK(v8::internal::FreePages(buf, allocated)); +#define TEARDOWN() \ + CHECK(v8::internal::FreePages(GetPlatformPageAllocator(), buf, allocated)); #endif // ifdef USE_SIMULATOR. @@ -15068,9 +15069,6 @@ TEST(default_nan_double) { TEST(call_no_relocation) { - Address call_start; - Address return_address; - INIT_V8(); SETUP(); @@ -15091,9 +15089,7 @@ TEST(call_no_relocation) { __ Push(lr, xzr); { Assembler::BlockConstPoolScope scope(&masm); - call_start = buf_addr + __ pc_offset(); __ Call(buf_addr + function.pos(), RelocInfo::NONE); - return_address = buf_addr + __ pc_offset(); } __ Pop(xzr, lr); END(); diff --git a/deps/v8/test/cctest/test-assembler-mips64.cc b/deps/v8/test/cctest/test-assembler-mips64.cc index 785ffa2fa3..ebae2e9ed5 100644 --- a/deps/v8/test/cctest/test-assembler-mips64.cc +++ b/deps/v8/test/cctest/test-assembler-mips64.cc @@ -85,7 +85,7 @@ TEST(MIPS1) { Label L, C; __ mov(a1, a0); - __ li(v0, 0); + __ li(v0, 0l); __ b(&C); __ nop(); @@ -2316,7 +2316,7 @@ TEST(movt_movd) { __ Lw(t1, MemOperand(a0, offsetof(TestFloat, fcsr))); __ cfc1(t0, FCSR); __ ctc1(t1, FCSR); - __ li(t2, 0x0); + __ li(t2, 0x0l); __ mtc1(t2, f12); __ mtc1(t2, f10); __ Sdc1(f10, MemOperand(a0, offsetof(TestFloat, dstdold))); @@ -5421,7 +5421,7 @@ uint64_t run_jic(int16_t offset) { Label get_program_counter, stop_execution; __ push(ra); - __ li(v0, 0); + __ li(v0, 0l); __ li(t1, 0x66); __ addiu(v0, v0, 0x1); // <-- offset = -32 @@ -5496,7 +5496,7 @@ uint64_t run_beqzc(int32_t value, int32_t offset) { v8::internal::CodeObjectRequired::kYes); Label stop_execution; - __ li(v0, 0); + __ li(v0, 0l); __ li(t1, 0x66); __ addiu(v0, v0, 0x1); // <-- offset = -8 @@ -5755,7 +5755,7 @@ uint64_t run_jialc(int16_t offset) { Label main_block, get_program_counter; __ push(ra); - __ li(v0, 0); + __ li(v0, 0l); __ beq(v0, v0, &main_block); __ nop(); @@ -5980,8 +5980,8 @@ int64_t run_bc(int32_t offset) { Label continue_1, stop_execution; __ push(ra); - __ li(v0, 0); - __ li(t8, 0); + __ li(v0, 0l); + __ li(t8, 0l); __ li(t9, 2); // Condition for the stopping execution. for (int32_t i = -100; i <= -11; ++i) { @@ -6060,8 +6060,8 @@ int64_t run_balc(int32_t offset) { Label continue_1, stop_execution; __ push(ra); - __ li(v0, 0); - __ li(t8, 0); + __ li(v0, 0l); + __ li(t8, 0l); __ li(t9, 2); // Condition for stopping execution. __ beq(t8, t8, &continue_1); @@ -7072,7 +7072,7 @@ void run_msa_ctc_cfc(uint64_t value) { MSAControlRegister msareg = {kMSACSRRegister}; __ li(t0, value); - __ li(t2, 0); + __ li(t2, 0l); __ cfcmsa(t1, msareg); __ ctcmsa(msareg, t0); __ cfcmsa(t2, msareg); diff --git a/deps/v8/test/cctest/test-assembler-x64.cc b/deps/v8/test/cctest/test-assembler-x64.cc index 7ecef4429c..a340322bd6 100644 --- a/deps/v8/test/cctest/test-assembler-x64.cc +++ b/deps/v8/test/cctest/test-assembler-x64.cc @@ -1068,7 +1068,7 @@ TEST(AssemblerX64FMA_sd) { // - xmm0 * xmm1 + xmm2 __ movaps(xmm3, xmm0); __ mulsd(xmm3, xmm1); - __ Move(xmm4, (uint64_t)1 << 63); + __ Move(xmm4, static_cast<uint64_t>(1) << 63); __ xorpd(xmm3, xmm4); __ addsd(xmm3, xmm2); // Expected result in xmm3 @@ -1117,7 +1117,7 @@ TEST(AssemblerX64FMA_sd) { // - xmm0 * xmm1 - xmm2 __ movaps(xmm3, xmm0); __ mulsd(xmm3, xmm1); - __ Move(xmm4, (uint64_t)1 << 63); + __ Move(xmm4, static_cast<uint64_t>(1) << 63); __ xorpd(xmm3, xmm4); __ subsd(xmm3, xmm2); // Expected result in xmm3 @@ -1294,7 +1294,7 @@ TEST(AssemblerX64FMA_ss) { // - xmm0 * xmm1 + xmm2 __ movaps(xmm3, xmm0); __ mulss(xmm3, xmm1); - __ Move(xmm4, (uint32_t)1 << 31); + __ Move(xmm4, static_cast<uint32_t>(1) << 31); __ xorps(xmm3, xmm4); __ addss(xmm3, xmm2); // Expected result in xmm3 @@ -1343,7 +1343,7 @@ TEST(AssemblerX64FMA_ss) { // - xmm0 * xmm1 - xmm2 __ movaps(xmm3, xmm0); __ mulss(xmm3, xmm1); - __ Move(xmm4, (uint32_t)1 << 31); + __ Move(xmm4, static_cast<uint32_t>(1) << 31); __ xorps(xmm3, xmm4); __ subss(xmm3, xmm2); // Expected result in xmm3 diff --git a/deps/v8/test/cctest/test-circular-queue.cc b/deps/v8/test/cctest/test-circular-queue.cc index a5bcb486af..85ab4c4fad 100644 --- a/deps/v8/test/cctest/test-circular-queue.cc +++ b/deps/v8/test/cctest/test-circular-queue.cc @@ -113,7 +113,7 @@ class ProducerThread: public v8::base::Thread { value_(value), finished_(finished) {} - virtual void Run() { + void Run() override { for (Record i = value_; i < value_ + records_per_chunk_; ++i) { Record* rec = reinterpret_cast<Record*>(scq_->StartEnqueue()); CHECK(rec); diff --git a/deps/v8/test/cctest/test-code-stub-assembler.cc b/deps/v8/test/cctest/test-code-stub-assembler.cc index 2036e13450..ffe9200eee 100644 --- a/deps/v8/test/cctest/test-code-stub-assembler.cc +++ b/deps/v8/test/cctest/test-code-stub-assembler.cc @@ -907,9 +907,12 @@ TEST(TransitionLookup) { } } - CHECK(root_map->raw_transitions()->ToStrongHeapObject()->IsTransitionArray()); + CHECK(root_map->raw_transitions() + ->GetHeapObjectAssumeStrong() + ->IsTransitionArray()); Handle<TransitionArray> transitions( - TransitionArray::cast(root_map->raw_transitions()->ToStrongHeapObject()), + TransitionArray::cast( + root_map->raw_transitions()->GetHeapObjectAssumeStrong()), isolate); DCHECK(transitions->IsSortedNoDuplicates()); @@ -2495,7 +2498,7 @@ TEST(CreatePromiseGetCapabilitiesExecutorContext) { Node* const context = m.Parameter(kNumParams + 2); Node* const native_context = m.LoadNativeContext(context); - Node* const map = m.LoadRoot(Heap::kPromiseCapabilityMapRootIndex); + Node* const map = m.LoadRoot(RootIndex::kPromiseCapabilityMap); Node* const capability = m.AllocateStruct(map); m.StoreObjectFieldNoWriteBarrier( capability, PromiseCapability::kPromiseOffset, m.UndefinedConstant()); @@ -3495,6 +3498,37 @@ 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-code-stubs-ia32.cc b/deps/v8/test/cctest/test-code-stubs-ia32.cc index 54f53e57c3..d9bfe9bb17 100644 --- a/deps/v8/test/cctest/test-code-stubs-ia32.cc +++ b/deps/v8/test/cctest/test-code-stubs-ia32.cc @@ -67,7 +67,7 @@ ConvertDToIFunc MakeConvertDToIFuncTrampoline(Isolate* isolate, // Save registers make sure they don't get clobbered. int reg_num = 0; for (; reg_num < Register::kNumRegisters; ++reg_num) { - if (RegisterConfiguration::Default()->IsAllocatableGeneralCode(reg_num)) { + if (GetRegConfig()->IsAllocatableGeneralCode(reg_num)) { Register reg = Register::from_code(reg_num); if (reg != esp && reg != ebp && reg != destination_reg) { __ push(reg); @@ -88,7 +88,7 @@ ConvertDToIFunc MakeConvertDToIFuncTrampoline(Isolate* isolate, // Make sure no registers have been unexpectedly clobbered for (--reg_num; reg_num >= 0; --reg_num) { - if (RegisterConfiguration::Default()->IsAllocatableGeneralCode(reg_num)) { + if (GetRegConfig()->IsAllocatableGeneralCode(reg_num)) { Register reg = Register::from_code(reg_num); if (reg != esp && reg != ebp && reg != destination_reg) { __ cmp(reg, MemOperand(esp, 0)); diff --git a/deps/v8/test/cctest/test-compiler.cc b/deps/v8/test/cctest/test-compiler.cc index 63904e086f..76ce276c06 100644 --- a/deps/v8/test/cctest/test-compiler.cc +++ b/deps/v8/test/cctest/test-compiler.cc @@ -55,7 +55,7 @@ static void SetGlobalProperty(const char* name, Object* value) { isolate->factory()->InternalizeUtf8String(name); Handle<JSObject> global(isolate->context()->global_object(), isolate); Runtime::SetObjectProperty(isolate, global, internalized_name, object, - LanguageMode::kSloppy) + LanguageMode::kSloppy, StoreOrigin::kMaybeKeyed) .Check(); } @@ -318,7 +318,7 @@ TEST(FeedbackVectorPreservedAcrossRecompiles) { MaybeObject* object = feedback_vector->Get(slot_for_a); { HeapObject* heap_object; - CHECK(object->ToWeakHeapObject(&heap_object)); + CHECK(object->GetHeapObjectIfWeak(&heap_object)); CHECK(heap_object->IsJSFunction()); } @@ -330,7 +330,7 @@ TEST(FeedbackVectorPreservedAcrossRecompiles) { object = f->feedback_vector()->Get(slot_for_a); { HeapObject* heap_object; - CHECK(object->ToWeakHeapObject(&heap_object)); + CHECK(object->GetHeapObjectIfWeak(&heap_object)); CHECK(heap_object->IsJSFunction()); } } @@ -676,7 +676,7 @@ void TestCompileFunctionInContextToStringImpl() { V8_Fatal(__FILE__, __LINE__, \ "Unexpected exception thrown during %s:\n\t%s\n", op, *error); \ } \ - } while (0) + } while (false) { // NOLINT CcTest::InitializeVM(); @@ -766,11 +766,6 @@ void TestCompileFunctionInContextToStringImpl() { #undef CHECK_NOT_CAUGHT } -TEST(CompileFunctionInContextHarmonyFunctionToString) { - v8::internal::FLAG_harmony_function_tostring = true; - TestCompileFunctionInContextToStringImpl(); -} - TEST(CompileFunctionInContextFunctionToString) { TestCompileFunctionInContextToStringImpl(); } diff --git a/deps/v8/test/cctest/test-cpu-profiler.cc b/deps/v8/test/cctest/test-cpu-profiler.cc index e08bec375e..75af3f6d98 100644 --- a/deps/v8/test/cctest/test-cpu-profiler.cc +++ b/deps/v8/test/cctest/test-cpu-profiler.cc @@ -40,7 +40,6 @@ #include "src/objects-inl.h" #include "src/profiler/cpu-profiler-inl.h" #include "src/profiler/profiler-listener.h" -#include "src/source-position-table.h" #include "src/utils.h" #include "test/cctest/cctest.h" #include "test/cctest/profiler-extension.h" @@ -2545,61 +2544,6 @@ TEST(MultipleProfilers) { profiler2->StopProfiling("2"); } -int GetSourcePositionEntryCount(i::Isolate* isolate, const char* source) { - i::Handle<i::JSFunction> function = i::Handle<i::JSFunction>::cast( - v8::Utils::OpenHandle(*CompileRun(source))); - if (function->IsInterpreted()) return -1; - i::Handle<i::Code> code(function->code(), isolate); - i::SourcePositionTableIterator iterator( - ByteArray::cast(code->source_position_table())); - int count = 0; - while (!iterator.done()) { - count++; - iterator.Advance(); - } - return count; -} - -UNINITIALIZED_TEST(DetailedSourcePositionAPI) { - i::FLAG_detailed_line_info = false; - i::FLAG_allow_natives_syntax = true; - v8::Isolate::CreateParams create_params; - create_params.array_buffer_allocator = CcTest::array_buffer_allocator(); - v8::Isolate* isolate = v8::Isolate::New(create_params); - - const char* source = - "function fib(i) {" - " if (i <= 1) return 1; " - " return fib(i - 1) +" - " fib(i - 2);" - "}" - "fib(5);" - "%OptimizeFunctionOnNextCall(fib);" - "fib(5);" - "fib"; - { - v8::Isolate::Scope isolate_scope(isolate); - v8::HandleScope handle_scope(isolate); - v8::Local<v8::Context> context = v8::Context::New(isolate); - v8::Context::Scope context_scope(context); - i::Isolate* i_isolate = reinterpret_cast<i::Isolate*>(isolate); - - CHECK(!i_isolate->NeedsDetailedOptimizedCodeLineInfo()); - - int non_detailed_positions = GetSourcePositionEntryCount(i_isolate, source); - - v8::CpuProfiler::UseDetailedSourcePositionsForProfiling(isolate); - CHECK(i_isolate->NeedsDetailedOptimizedCodeLineInfo()); - - int detailed_positions = GetSourcePositionEntryCount(i_isolate, source); - - CHECK((non_detailed_positions == -1 && detailed_positions == -1) || - non_detailed_positions < detailed_positions); - } - - isolate->Dispose(); -} - } // namespace test_cpu_profiler } // namespace internal } // namespace v8 diff --git a/deps/v8/test/cctest/test-date.cc b/deps/v8/test/cctest/test-date.cc index 61545d7859..d1d8efe26c 100644 --- a/deps/v8/test/cctest/test-date.cc +++ b/deps/v8/test/cctest/test-date.cc @@ -44,7 +44,7 @@ class DateCacheMock: public DateCache { : local_offset_(local_offset), rules_(rules), rules_count_(rules_count) {} protected: - virtual int GetDaylightSavingsOffsetFromOS(int64_t time_sec) { + int GetDaylightSavingsOffsetFromOS(int64_t time_sec) override { int days = DaysFromTime(time_sec * 1000); int time_in_day_sec = TimeInDay(time_sec * 1000, days) / 1000; int year, month, day; @@ -53,7 +53,7 @@ class DateCacheMock: public DateCache { return rule == nullptr ? 0 : rule->offset_sec * 1000; } - virtual int GetLocalOffsetFromOS(int64_t time_sec, bool is_utc) { + int GetLocalOffsetFromOS(int64_t time_sec, bool is_utc) override { return local_offset_ + GetDaylightSavingsOffsetFromOS(time_sec); } diff --git a/deps/v8/test/cctest/test-debug.cc b/deps/v8/test/cctest/test-debug.cc index f678b8ca6f..2e2128e50b 100644 --- a/deps/v8/test/cctest/test-debug.cc +++ b/deps/v8/test/cctest/test-debug.cc @@ -161,7 +161,7 @@ void CheckDebuggerUnloaded() { // Collect garbage to ensure weak handles are cleared. CcTest::CollectAllGarbage(); - CcTest::CollectAllGarbage(Heap::kMakeHeapIterableMask); + CcTest::CollectAllGarbage(); // Iterate the heap and check that there are no debugger related objects left. HeapIterator iterator(CcTest::heap()); @@ -189,8 +189,9 @@ int break_point_hit_count = 0; int break_point_hit_count_deoptimize = 0; class DebugEventCounter : public v8::debug::DebugDelegate { public: - void BreakProgramRequested(v8::Local<v8::Context>, - const std::vector<v8::debug::BreakpointId>&) { + void BreakProgramRequested( + v8::Local<v8::Context>, + const std::vector<v8::debug::BreakpointId>&) override { break_point_hit_count++; // Perform a full deoptimization when the specified number of // breaks have been hit. @@ -211,8 +212,9 @@ class DebugEventCounter : public v8::debug::DebugDelegate { // Debug event handler which performs a garbage collection. class DebugEventBreakPointCollectGarbage : public v8::debug::DebugDelegate { public: - void BreakProgramRequested(v8::Local<v8::Context>, - const std::vector<v8::debug::BreakpointId>&) { + void BreakProgramRequested( + v8::Local<v8::Context>, + const std::vector<v8::debug::BreakpointId>&) override { // Perform a garbage collection when break point is hit and continue. Based // on the number of break points hit either scavenge or mark compact // collector is used. @@ -231,8 +233,9 @@ class DebugEventBreakPointCollectGarbage : public v8::debug::DebugDelegate { // collector to have the heap verified. class DebugEventBreak : public v8::debug::DebugDelegate { public: - void BreakProgramRequested(v8::Local<v8::Context>, - const std::vector<v8::debug::BreakpointId>&) { + void BreakProgramRequested( + v8::Local<v8::Context>, + const std::vector<v8::debug::BreakpointId>&) override { // Count the number of breaks. break_point_hit_count++; @@ -255,8 +258,9 @@ int max_break_point_hit_count = 0; bool terminate_after_max_break_point_hit = false; class DebugEventBreakMax : public v8::debug::DebugDelegate { public: - void BreakProgramRequested(v8::Local<v8::Context>, - const std::vector<v8::debug::BreakpointId>&) { + void BreakProgramRequested( + v8::Local<v8::Context>, + const std::vector<v8::debug::BreakpointId>&) override { v8::Isolate* v8_isolate = CcTest::isolate(); v8::internal::Isolate* isolate = CcTest::i_isolate(); if (break_point_hit_count < max_break_point_hit_count) { @@ -2999,9 +3003,9 @@ int event_listener_hit_count = 0; class EmptyExternalStringResource : public v8::String::ExternalStringResource { public: EmptyExternalStringResource() { empty_[0] = 0; } - virtual ~EmptyExternalStringResource() {} - virtual size_t length() const { return empty_.length(); } - virtual const uint16_t* data() const { return empty_.start(); } + ~EmptyExternalStringResource() override = default; + size_t length() const override { return empty_.length(); } + const uint16_t* data() const override { return empty_.start(); } private: ::v8::internal::EmbeddedVector<uint16_t, 1> empty_; @@ -3064,8 +3068,8 @@ class ContextCheckEventListener : public v8::debug::DebugDelegate { } void ExceptionThrown(v8::Local<v8::Context> paused_context, v8::Local<v8::Value> exception, - v8::Local<v8::Value> promise, - bool is_uncaught) override { + v8::Local<v8::Value> promise, bool is_uncaught, + v8::debug::ExceptionType) override { CheckContext(); } bool IsFunctionBlackboxed(v8::Local<v8::debug::Script> script, @@ -3677,7 +3681,7 @@ class TerminationThread : public v8::base::Thread { explicit TerminationThread(v8::Isolate* isolate) : Thread(Options("terminator")), isolate_(isolate) {} - virtual void Run() { + void Run() override { terminate_requested_semaphore.Wait(); isolate_->TerminateExecution(); terminate_fired_semaphore.Signal(); @@ -3712,7 +3716,7 @@ class ArchiveRestoreThread : public v8::base::Thread, spawn_count_(spawn_count), break_count_(0) {} - virtual void Run() { + void Run() override { v8::Locker locker(isolate_); isolate_->Enter(); @@ -3743,8 +3747,9 @@ class ArchiveRestoreThread : public v8::base::Thread, isolate_->Exit(); } - void BreakProgramRequested(v8::Local<v8::Context> context, - const std::vector<v8::debug::BreakpointId>&) { + void BreakProgramRequested( + v8::Local<v8::Context> context, + const std::vector<v8::debug::BreakpointId>&) override { auto stack_traces = v8::debug::StackTraceIterator::Create(isolate_); if (!stack_traces->Done()) { v8::debug::Location location = stack_traces->GetSourceLocation(); @@ -3833,8 +3838,8 @@ class DebugEventExpectNoException : public v8::debug::DebugDelegate { public: void ExceptionThrown(v8::Local<v8::Context> paused_context, v8::Local<v8::Value> exception, - v8::Local<v8::Value> promise, - bool is_uncaught) override { + v8::Local<v8::Value> promise, bool is_uncaught, + v8::debug::ExceptionType) override { CHECK(false); } }; diff --git a/deps/v8/test/cctest/test-decls.cc b/deps/v8/test/cctest/test-decls.cc index f0e8080275..8b59fe5960 100644 --- a/deps/v8/test/cctest/test-decls.cc +++ b/deps/v8/test/cctest/test-decls.cc @@ -123,11 +123,9 @@ void DeclarationContext::InitializeIfNeeded() { Local<FunctionTemplate> function = FunctionTemplate::New(isolate); Local<Value> data = External::New(CcTest::isolate(), this); GetHolder(function)->SetHandler(v8::NamedPropertyHandlerConfiguration( - &HandleGet, &HandleSet, &HandleQuery, 0, 0, data)); - Local<Context> context = Context::New(isolate, - 0, - function->InstanceTemplate(), - Local<Value>()); + &HandleGet, &HandleSet, &HandleQuery, nullptr, nullptr, data)); + Local<Context> context = Context::New( + isolate, nullptr, function->InstanceTemplate(), Local<Value>()); context_.Reset(isolate, context); context->Enter(); is_initialized_ = true; @@ -256,7 +254,7 @@ TEST(Unknown) { class AbsentPropertyContext: public DeclarationContext { protected: - virtual v8::Local<Integer> Query(Local<Name> key) { + v8::Local<Integer> Query(Local<Name> key) override { return v8::Local<Integer>(); } }; @@ -306,7 +304,7 @@ class AppearingPropertyContext: public DeclarationContext { AppearingPropertyContext() : state_(DECLARE) { } protected: - virtual v8::Local<Integer> Query(Local<Name> key) { + v8::Local<Integer> Query(Local<Name> key) override { switch (state_) { case DECLARE: // Force declaration by returning that the @@ -361,13 +359,13 @@ class ExistsInPrototypeContext: public DeclarationContext { public: ExistsInPrototypeContext() { InitializeIfNeeded(); } protected: - virtual v8::Local<Integer> Query(Local<Name> key) { + v8::Local<Integer> Query(Local<Name> key) override { // Let it seem that the property exists in the prototype object. return Integer::New(isolate(), v8::None); } // Use the prototype as the holder for the interceptors. - virtual Local<ObjectTemplate> GetHolder(Local<FunctionTemplate> function) { + Local<ObjectTemplate> GetHolder(Local<FunctionTemplate> function) override { return function->PrototypeTemplate(); } }; @@ -404,13 +402,13 @@ TEST(ExistsInPrototype) { class AbsentInPrototypeContext: public DeclarationContext { protected: - virtual v8::Local<Integer> Query(Local<Name> key) { + v8::Local<Integer> Query(Local<Name> key) override { // Let it seem that the property is absent in the prototype object. return Local<Integer>(); } // Use the prototype as the holder for the interceptors. - virtual Local<ObjectTemplate> GetHolder(Local<FunctionTemplate> function) { + Local<ObjectTemplate> GetHolder(Local<FunctionTemplate> function) override { return function->PrototypeTemplate(); } }; @@ -439,13 +437,13 @@ class ExistsInHiddenPrototypeContext: public DeclarationContext { } protected: - virtual v8::Local<Integer> Query(Local<Name> key) { + v8::Local<Integer> Query(Local<Name> key) override { // Let it seem that the property exists in the hidden prototype object. return Integer::New(isolate(), v8::None); } // Install the hidden prototype after the global object has been created. - virtual void PostInitializeContext(Local<Context> context) { + void PostInitializeContext(Local<Context> context) override { Local<Object> global_object = context->Global(); Local<Object> hidden_proto = hidden_proto_->GetFunction(context) .ToLocalChecked() @@ -457,7 +455,7 @@ class ExistsInHiddenPrototypeContext: public DeclarationContext { } // Use the hidden prototype as the holder for the interceptors. - virtual Local<ObjectTemplate> GetHolder(Local<FunctionTemplate> function) { + Local<ObjectTemplate> GetHolder(Local<FunctionTemplate> function) override { return hidden_proto_->InstanceTemplate(); } diff --git a/deps/v8/test/cctest/test-deoptimization.cc b/deps/v8/test/cctest/test-deoptimization.cc index 0d86f135ea..544a0f587d 100644 --- a/deps/v8/test/cctest/test-deoptimization.cc +++ b/deps/v8/test/cctest/test-deoptimization.cc @@ -95,15 +95,6 @@ class AllowNativesSyntaxNoInlining { bool turbo_inlining_; }; - -// Abort any ongoing incremental marking to make sure that all weak global -// handle callbacks are processed. -static void NonIncrementalGC(i::Isolate* isolate) { - isolate->heap()->CollectAllGarbage(i::Heap::kFinalizeIncrementalMarkingMask, - i::GarbageCollectionReason::kTesting); -} - - static Handle<JSFunction> GetJSFunction(v8::Local<v8::Context> context, const char* property_name) { v8::Local<v8::Function> fun = v8::Local<v8::Function>::Cast( @@ -127,7 +118,7 @@ TEST(DeoptimizeSimple) { "function f() { g(); };" "f();"); } - NonIncrementalGC(CcTest::i_isolate()); + CcTest::CollectAllGarbage(); CHECK_EQ(1, env->Global() ->Get(env.local(), v8_str("count")) @@ -147,7 +138,7 @@ TEST(DeoptimizeSimple) { "function f(x) { if (x) { g(); } else { return } };" "f(true);"); } - NonIncrementalGC(CcTest::i_isolate()); + CcTest::CollectAllGarbage(); CHECK_EQ(1, env->Global() ->Get(env.local(), v8_str("count")) @@ -174,7 +165,7 @@ TEST(DeoptimizeSimpleWithArguments) { "function f(x, y, z) { g(1,x); y+z; };" "f(1, \"2\", false);"); } - NonIncrementalGC(CcTest::i_isolate()); + CcTest::CollectAllGarbage(); CHECK_EQ(1, env->Global() ->Get(env.local(), v8_str("count")) @@ -195,7 +186,7 @@ TEST(DeoptimizeSimpleWithArguments) { "function f(x, y, z) { if (x) { g(x, y); } else { return y + z; } };" "f(true, 1, \"2\");"); } - NonIncrementalGC(CcTest::i_isolate()); + CcTest::CollectAllGarbage(); CHECK_EQ(1, env->Global() ->Get(env.local(), v8_str("count")) @@ -223,7 +214,7 @@ TEST(DeoptimizeSimpleNested) { "function g(z) { count++; %DeoptimizeFunction(f); return z;}" "function f(x,y,z) { return h(x, y, g(z)); };" "result = f(1, 2, 3);"); - NonIncrementalGC(CcTest::i_isolate()); + CcTest::CollectAllGarbage(); CHECK_EQ(1, env->Global() ->Get(env.local(), v8_str("count")) @@ -257,7 +248,7 @@ TEST(DeoptimizeRecursive) { "function f(x) { calls++; if (x > 0) { f(x - 1); } else { g(); } };" "f(10);"); } - NonIncrementalGC(CcTest::i_isolate()); + CcTest::CollectAllGarbage(); CHECK_EQ(1, env->Global() ->Get(env.local(), v8_str("count")) @@ -300,7 +291,7 @@ TEST(DeoptimizeMultiple) { "function f1(x) { return f2(x + 1, x + 1) + x; };" "result = f1(1);"); } - NonIncrementalGC(CcTest::i_isolate()); + CcTest::CollectAllGarbage(); CHECK_EQ(1, env->Global() ->Get(env.local(), v8_str("count")) @@ -330,7 +321,7 @@ TEST(DeoptimizeConstructor) { "function f() { g(); };" "result = new f() instanceof f;"); } - NonIncrementalGC(CcTest::i_isolate()); + CcTest::CollectAllGarbage(); CHECK_EQ(1, env->Global() ->Get(env.local(), v8_str("count")) @@ -354,7 +345,7 @@ TEST(DeoptimizeConstructor) { "result = new f(1, 2);" "result = result.x + result.y;"); } - NonIncrementalGC(CcTest::i_isolate()); + CcTest::CollectAllGarbage(); CHECK_EQ(1, env->Global() ->Get(env.local(), v8_str("count")) @@ -392,7 +383,7 @@ TEST(DeoptimizeConstructorMultiple) { "function f1(x) { this.result = new f2(x + 1, x + 1).result + x; };" "result = new f1(1).result;"); } - NonIncrementalGC(CcTest::i_isolate()); + CcTest::CollectAllGarbage(); CHECK_EQ(1, env->Global() ->Get(env.local(), v8_str("count")) @@ -453,7 +444,7 @@ UNINITIALIZED_TEST(DeoptimizeBinaryOperationADDString) { "deopt = true;" "var result = f('a+', new X());"); } - NonIncrementalGC(i_isolate); + CcTest::CollectAllGarbage(i_isolate); CHECK(!GetJSFunction(env.local(), "f")->IsOptimized()); CHECK_EQ(1, env->Global() @@ -513,7 +504,7 @@ static void TestDeoptimizeBinaryOpHelper(LocalContext* env, // Call f and force deoptimization while processing the binary operation. CompileRun("deopt = true;" "var result = f(7, new X());"); - NonIncrementalGC(i_isolate); + CcTest::CollectAllGarbage(i_isolate); CHECK(!GetJSFunction((*env).local(), "f")->IsOptimized()); } @@ -718,7 +709,7 @@ UNINITIALIZED_TEST(DeoptimizeCompare) { "deopt = true;" "var result = f('a', new X());"); } - NonIncrementalGC(i_isolate); + CcTest::CollectAllGarbage(i_isolate); CHECK(!GetJSFunction(env.local(), "f")->IsOptimized()); CHECK_EQ(1, env->Global() @@ -729,8 +720,7 @@ UNINITIALIZED_TEST(DeoptimizeCompare) { CHECK_EQ(true, env->Global() ->Get(env.local(), v8_str("result")) .ToLocalChecked() - ->BooleanValue(env.local()) - .FromJust()); + ->BooleanValue(isolate)); CHECK_EQ(0, Deoptimizer::GetDeoptimizedCodeCount(i_isolate)); } isolate->Exit(); @@ -817,7 +807,7 @@ UNINITIALIZED_TEST(DeoptimizeLoadICStoreIC) { "f2(new X(), 'z');" "g2(new X(), 'z');"); } - NonIncrementalGC(i_isolate); + CcTest::CollectAllGarbage(i_isolate); CHECK(!GetJSFunction(env.local(), "f1")->IsOptimized()); CHECK(!GetJSFunction(env.local(), "g1")->IsOptimized()); @@ -919,7 +909,7 @@ UNINITIALIZED_TEST(DeoptimizeLoadICStoreICNested) { "deopt = true;" "var result = f1(new X());"); } - NonIncrementalGC(i_isolate); + CcTest::CollectAllGarbage(i_isolate); CHECK(!GetJSFunction(env.local(), "f1")->IsOptimized()); CHECK(!GetJSFunction(env.local(), "g1")->IsOptimized()); diff --git a/deps/v8/test/cctest/test-disasm-mips64.cc b/deps/v8/test/cctest/test-disasm-mips64.cc index 29497fd9d6..1b0bdcc270 100644 --- a/deps/v8/test/cctest/test-disasm-mips64.cc +++ b/deps/v8/test/cctest/test-disasm-mips64.cc @@ -1177,19 +1177,6 @@ TEST(Type3) { COMPARE_PC_REL_COMPACT(bgtz(a0, 32767), "1c807fff bgtz a0, 32767", 32767); - int64_t pc_region; - GET_PC_REGION(pc_region); - - int64_t target = pc_region | 0x4; - COMPARE_PC_JUMP(j(target), "08000001 j ", target); - target = pc_region | 0xFFFFFFC; - COMPARE_PC_JUMP(j(target), "0bffffff j ", target); - - target = pc_region | 0x4; - COMPARE_PC_JUMP(jal(target), "0c000001 jal ", target); - target = pc_region | 0xFFFFFFC; - COMPARE_PC_JUMP(jal(target), "0fffffff jal ", target); - VERIFY_RUN(); } diff --git a/deps/v8/test/cctest/test-disasm-x64.cc b/deps/v8/test/cctest/test-disasm-x64.cc index c42606485c..1e530c3ce2 100644 --- a/deps/v8/test/cctest/test-disasm-x64.cc +++ b/deps/v8/test/cctest/test-disasm-x64.cc @@ -142,8 +142,11 @@ TEST(DisasmX64) { __ shll_cl(Operand(rdi, rax, times_4, 100)); __ shll(rdx, Immediate(1)); __ shll(rdx, Immediate(6)); - __ bts(Operand(rdx, 0), rcx); - __ bts(Operand(rbx, rcx, times_4, 0), rcx); + __ btq(Operand(rdx, 0), rcx); + __ btsq(Operand(rdx, 0), rcx); + __ btsq(Operand(rbx, rcx, times_4, 0), rcx); + __ btsq(rcx, Immediate(13)); + __ btrq(rcx, Immediate(13)); __ nop(); __ pushq(Immediate(12)); __ pushq(Immediate(23456)); @@ -267,7 +270,6 @@ TEST(DisasmX64) { __ xorq(rdx, Immediate(12345)); __ xorq(rdx, Operand(rbx, rcx, times_8, 10000)); - __ bts(Operand(rbx, rcx, times_8, 10000), rdx); __ pshufw(xmm5, xmm1, 3); __ hlt(); __ int3(); diff --git a/deps/v8/test/cctest/test-feedback-vector.cc b/deps/v8/test/cctest/test-feedback-vector.cc index b809854270..80ae82d799 100644 --- a/deps/v8/test/cctest/test-feedback-vector.cc +++ b/deps/v8/test/cctest/test-feedback-vector.cc @@ -96,7 +96,7 @@ TEST(VectorStructure) { FeedbackMetadata::GetSlotSize(FeedbackSlotKind::kCreateClosure)); FeedbackSlot slot = helper.slot(1); FeedbackCell* cell = - FeedbackCell::cast(vector->Get(slot)->ToStrongHeapObject()); + FeedbackCell::cast(vector->Get(slot)->GetHeapObjectAssumeStrong()); CHECK_EQ(cell->value(), *factory->undefined_value()); } } @@ -203,7 +203,7 @@ TEST(VectorCallFeedback) { CHECK_EQ(MONOMORPHIC, nexus.StateFromFeedback()); HeapObject* heap_object; - CHECK(nexus.GetFeedback()->ToWeakHeapObject(&heap_object)); + CHECK(nexus.GetFeedback()->GetHeapObjectIfWeak(&heap_object)); CHECK_EQ(*foo, heap_object); CcTest::CollectAllGarbage(); @@ -228,7 +228,7 @@ TEST(VectorCallFeedbackForArray) { CHECK_EQ(MONOMORPHIC, nexus.StateFromFeedback()); HeapObject* heap_object; - CHECK(nexus.GetFeedback()->ToWeakHeapObject(&heap_object)); + CHECK(nexus.GetFeedback()->GetHeapObjectIfWeak(&heap_object)); CHECK_EQ(*isolate->array_function(), heap_object); CcTest::CollectAllGarbage(); @@ -236,6 +236,68 @@ TEST(VectorCallFeedbackForArray) { CHECK_EQ(MONOMORPHIC, nexus.StateFromFeedback()); } +size_t GetFeedbackVectorLength(Isolate* isolate, const char* src, + bool with_oneshot_opt) { + i::FLAG_enable_one_shot_optimization = with_oneshot_opt; + i::Handle<i::Object> i_object = v8::Utils::OpenHandle(*CompileRun(src)); + i::Handle<i::JSFunction> f = i::Handle<i::JSFunction>::cast(i_object); + Handle<FeedbackVector> feedback_vector = + Handle<FeedbackVector>(f->feedback_vector(), isolate); + return feedback_vector->length(); +} + +TEST(OneShotCallICSlotCount) { + if (i::FLAG_always_opt) return; + CcTest::InitializeVM(); + LocalContext context; + v8::HandleScope scope(context->GetIsolate()); + Isolate* isolate = CcTest::i_isolate(); + i::FLAG_compilation_cache = false; + + const char* no_call = R"( + function f1() {}; + function f2() {}; + (function() { + return arguments.callee; + })(); + )"; + // len = 2 * 1 ldaNamed property + CHECK_EQ(GetFeedbackVectorLength(isolate, no_call, false), 2); + // no slots of named property loads/stores in one shot + CHECK_EQ(GetFeedbackVectorLength(isolate, no_call, true), 0); + + const char* single_call = R"( + function f1() {}; + function f2() {}; + (function() { + f1(); + return arguments.callee; + })(); + )"; + // len = 2 * 1 ldaNamed Slot + 2 * 1 CachedGlobalSlot + 2 * 1 CallICSlot + CHECK_EQ(GetFeedbackVectorLength(isolate, single_call, false), 6); + // len = 2 * 1 CachedGlobalSlot + CHECK_EQ(GetFeedbackVectorLength(isolate, single_call, true), 2); + + const char* multiple_calls = R"( + function f1() {}; + function f2() {}; + (function() { + f1(); + f2(); + f1(); + f2(); + return arguments.callee; + })(); + )"; + // len = 2 * 1 ldaNamedSlot + 2 * 2 CachedGlobalSlot (one for each unique + // function) + 2 * 4 CallICSlot (one for each function call) + CHECK_EQ(GetFeedbackVectorLength(isolate, multiple_calls, false), 14); + // CachedGlobalSlot (one for each unique function) + // len = 2 * 2 CachedGlobalSlot (one for each unique function) + CHECK_EQ(GetFeedbackVectorLength(isolate, multiple_calls, true), 4); +} + TEST(VectorCallCounts) { if (i::FLAG_always_opt) return; CcTest::InitializeVM(); @@ -284,7 +346,7 @@ TEST(VectorConstructCounts) { FeedbackNexus nexus(feedback_vector, slot); CHECK_EQ(MONOMORPHIC, nexus.StateFromFeedback()); - CHECK(feedback_vector->Get(slot)->IsWeakHeapObject()); + CHECK(feedback_vector->Get(slot)->IsWeak()); CompileRun("f(Foo); f(Foo);"); CHECK_EQ(MONOMORPHIC, nexus.StateFromFeedback()); diff --git a/deps/v8/test/cctest/test-field-type-tracking.cc b/deps/v8/test/cctest/test-field-type-tracking.cc index 4e37103558..f40dbe83bd 100644 --- a/deps/v8/test/cctest/test-field-type-tracking.cc +++ b/deps/v8/test/cctest/test-field-type-tracking.cc @@ -370,9 +370,8 @@ class Expectations { heap_type); Handle<String> name = MakeName("prop", property_index); - return Map::TransitionToDataProperty( - isolate_, map, name, value, attributes, constness, - Object::CERTAINLY_NOT_STORE_FROM_KEYED); + return Map::TransitionToDataProperty(isolate_, map, name, value, attributes, + constness, StoreOrigin::kNamed); } Handle<Map> TransitionToDataConstant(Handle<Map> map, @@ -383,9 +382,9 @@ class Expectations { SetDataConstant(property_index, attributes, value); Handle<String> name = MakeName("prop", property_index); - return Map::TransitionToDataProperty( - isolate_, map, name, value, attributes, PropertyConstness::kConst, - Object::CERTAINLY_NOT_STORE_FROM_KEYED); + return Map::TransitionToDataProperty(isolate_, map, name, value, attributes, + PropertyConstness::kConst, + StoreOrigin::kNamed); } Handle<Map> FollowDataTransition(Handle<Map> map, @@ -657,7 +656,9 @@ static void TestGeneralizeField(int detach_property_at_index, CanonicalHandleScope canonical(isolate); JSHeapBroker broker(isolate, &zone); CompilationDependencies dependencies(isolate, &zone); - dependencies.DependOnFieldType(MapRef(&broker, map), property_index); + MapRef map_ref(&broker, map); + map_ref.SerializeOwnDescriptors(); + dependencies.DependOnFieldType(map_ref, property_index); Handle<Map> field_owner(map->FindFieldOwner(isolate, property_index), isolate); @@ -1029,7 +1030,9 @@ static void TestReconfigureDataFieldAttribute_GeneralizeField( CanonicalHandleScope canonical(isolate); JSHeapBroker broker(isolate, &zone); CompilationDependencies dependencies(isolate, &zone); - dependencies.DependOnFieldType(MapRef(&broker, map), kSplitProp); + MapRef map_ref(&broker, map); + map_ref.SerializeOwnDescriptors(); + dependencies.DependOnFieldType(map_ref, kSplitProp); // Reconfigure attributes of property |kSplitProp| of |map2| to NONE, which // should generalize representations in |map1|. @@ -1113,7 +1116,9 @@ static void TestReconfigureDataFieldAttribute_GeneralizeFieldTrivial( CanonicalHandleScope canonical(isolate); JSHeapBroker broker(isolate, &zone); CompilationDependencies dependencies(isolate, &zone); - dependencies.DependOnFieldType(MapRef(&broker, map), kSplitProp); + MapRef map_ref(&broker, map); + map_ref.SerializeOwnDescriptors(); + dependencies.DependOnFieldType(map_ref, kSplitProp); // Reconfigure attributes of property |kSplitProp| of |map2| to NONE, which // should generalize representations in |map1|. @@ -1794,7 +1799,9 @@ static void TestReconfigureElementsKind_GeneralizeField( CanonicalHandleScope canonical(isolate); JSHeapBroker broker(isolate, &zone); CompilationDependencies dependencies(isolate, &zone); - dependencies.DependOnFieldType(MapRef(&broker, map), kDiffProp); + MapRef map_ref(&broker, map); + map_ref.SerializeOwnDescriptors(); + dependencies.DependOnFieldType(map_ref, kDiffProp); // Reconfigure elements kinds of |map2|, which should generalize // representations in |map|. @@ -1889,7 +1896,9 @@ static void TestReconfigureElementsKind_GeneralizeFieldTrivial( CanonicalHandleScope canonical(isolate); JSHeapBroker broker(isolate, &zone); CompilationDependencies dependencies(isolate, &zone); - dependencies.DependOnFieldType(MapRef(&broker, map), kDiffProp); + MapRef map_ref(&broker, map); + map_ref.SerializeOwnDescriptors(); + dependencies.DependOnFieldType(map_ref, kDiffProp); // Reconfigure elements kinds of |map2|, which should generalize // representations in |map|. diff --git a/deps/v8/test/cctest/test-heap-profiler.cc b/deps/v8/test/cctest/test-heap-profiler.cc index e4e5f4c8dc..257ef1c723 100644 --- a/deps/v8/test/cctest/test-heap-profiler.cc +++ b/deps/v8/test/cctest/test-heap-profiler.cc @@ -157,12 +157,9 @@ static Optional<SourceLocation> GetLocation(const v8::HeapSnapshot* s, const v8::HeapGraphNode* node) { const i::HeapSnapshot* snapshot = reinterpret_cast<const i::HeapSnapshot*>(s); const std::vector<SourceLocation>& locations = snapshot->locations(); - const int index = - const_cast<i::HeapEntry*>(reinterpret_cast<const i::HeapEntry*>(node)) - ->index(); - + const i::HeapEntry* entry = reinterpret_cast<const i::HeapEntry*>(node); for (const auto& loc : locations) { - if (loc.entry_index == index) { + if (loc.entry_index == entry->index()) { return Optional<SourceLocation>(loc); } } @@ -223,7 +220,7 @@ static bool ValidateSnapshot(const v8::HeapSnapshot* snapshot, int depth = 3) { entry->value = reinterpret_cast<void*>(ref_count + 1); } uint32_t unretained_entries_count = 0; - std::vector<i::HeapEntry>& entries = heap_snapshot->entries(); + std::deque<i::HeapEntry>& entries = heap_snapshot->entries(); for (i::HeapEntry& entry : entries) { v8::base::HashMap::Entry* map_entry = visited.Lookup( reinterpret_cast<void*>(&entry), @@ -506,9 +503,6 @@ TEST(HeapSnapshotHeapNumbers) { } TEST(HeapSnapshotHeapBigInts) { - // TODO(luoe): remove flag when it is on by default. - v8::internal::FLAG_harmony_bigint = true; - LocalContext env; v8::HandleScope scope(env->GetIsolate()); v8::HeapProfiler* heap_profiler = env->GetIsolate()->GetHeapProfiler(); @@ -686,7 +680,7 @@ TEST(HeapSnapshotWeakCollection) { ++weak_entries; } } - CHECK_EQ(1, weak_entries); // Key is the only weak. + CHECK_EQ(2, weak_entries); // Key and value are weak. const v8::HeapGraphNode* wm_s = GetProperty(env->GetIsolate(), wm, v8::HeapGraphEdge::kProperty, "str"); CHECK(wm_s); @@ -1003,21 +997,6 @@ TEST(HeapEntryIdsAndGC) { CHECK_EQ(b1->GetId(), b2->GetId()); } - -TEST(HeapSnapshotRootPreservedAfterSorting) { - LocalContext env; - v8::HandleScope scope(env->GetIsolate()); - v8::HeapProfiler* heap_profiler = env->GetIsolate()->GetHeapProfiler(); - const v8::HeapSnapshot* snapshot = heap_profiler->TakeHeapSnapshot(); - CHECK(ValidateSnapshot(snapshot)); - const v8::HeapGraphNode* root1 = snapshot->GetRoot(); - const_cast<i::HeapSnapshot*>(reinterpret_cast<const i::HeapSnapshot*>( - snapshot))->GetSortedEntriesList(); - const v8::HeapGraphNode* root2 = snapshot->GetRoot(); - CHECK_EQ(root1, root2); -} - - namespace { class TestJSONStream : public v8::OutputStream { @@ -1025,9 +1004,9 @@ class TestJSONStream : public v8::OutputStream { TestJSONStream() : eos_signaled_(0), abort_countdown_(-1) {} explicit TestJSONStream(int abort_countdown) : eos_signaled_(0), abort_countdown_(abort_countdown) {} - virtual ~TestJSONStream() {} - virtual void EndOfStream() { ++eos_signaled_; } - virtual WriteResult WriteAsciiChunk(char* buffer, int chars_written) { + ~TestJSONStream() override = default; + void EndOfStream() override { ++eos_signaled_; } + WriteResult WriteAsciiChunk(char* buffer, int chars_written) override { if (abort_countdown_ > 0) --abort_countdown_; if (abort_countdown_ == 0) return kAbort; CHECK_GT(chars_written, 0); @@ -1053,8 +1032,9 @@ class OneByteResource : public v8::String::ExternalOneByteStringResource { explicit OneByteResource(i::Vector<char> string) : data_(string.start()) { length_ = string.length(); } - virtual const char* data() const { return data_; } - virtual size_t length() const { return length_; } + const char* data() const override { return data_; } + size_t length() const override { return length_; } + private: const char* data_; size_t length_; @@ -1215,20 +1195,15 @@ class TestStatsStream : public v8::OutputStream { intervals_count_(0), first_interval_index_(-1) { } TestStatsStream(const TestStatsStream& stream) - : v8::OutputStream(stream), - eos_signaled_(stream.eos_signaled_), - updates_written_(stream.updates_written_), - entries_count_(stream.entries_count_), - entries_size_(stream.entries_size_), - intervals_count_(stream.intervals_count_), - first_interval_index_(stream.first_interval_index_) { } - virtual ~TestStatsStream() {} - virtual void EndOfStream() { ++eos_signaled_; } - virtual WriteResult WriteAsciiChunk(char* buffer, int chars_written) { + + = default; + ~TestStatsStream() override = default; + void EndOfStream() override { ++eos_signaled_; } + WriteResult WriteAsciiChunk(char* buffer, int chars_written) override { UNREACHABLE(); } - virtual WriteResult WriteHeapStatsChunk(v8::HeapStatsUpdate* buffer, - int updates_written) { + WriteResult WriteHeapStatsChunk(v8::HeapStatsUpdate* buffer, + int updates_written) override { ++intervals_count_; CHECK(updates_written); updates_written_ += updates_written; @@ -1533,7 +1508,7 @@ class TestActivityControl : public v8::ActivityControl { total_(0), abort_count_(abort_count), reported_finish_(false) {} - ControlOption ReportProgressValue(int done, int total) { + ControlOption ReportProgressValue(int done, int total) override { done_ = done; total_ = total; CHECK_LE(done_, total_); @@ -1610,7 +1585,7 @@ class EmbedderGraphBuilder : public v8::PersistentHandleVisitor { public: explicit Group(const char* name) : Node(name, 0) {} // v8::EmbedderGraph::EmbedderNode - bool IsRootNode() { return true; } + bool IsRootNode() override { return true; } }; EmbedderGraphBuilder(v8::Isolate* isolate, v8::EmbedderGraph* graph) @@ -1784,7 +1759,7 @@ TEST(DeleteHeapSnapshot) { class NameResolver : public v8::HeapProfiler::ObjectNameResolver { public: - virtual const char* GetName(v8::Local<v8::Object> object) { + const char* GetName(v8::Local<v8::Object> object) override { return "Global object name"; } }; @@ -3062,7 +3037,7 @@ class EmbedderRootNode : public EmbedderNode { public: explicit EmbedderRootNode(const char* name) : EmbedderNode(name, 0) {} // Graph::Node override. - bool IsRootNode() { return true; } + bool IsRootNode() override { return true; } }; // Used to pass the global object to the BuildEmbedderGraph callback. @@ -3900,45 +3875,3 @@ TEST(WeakReference) { const v8::HeapSnapshot* snapshot = heap_profiler->TakeHeapSnapshot(); CHECK(ValidateSnapshot(snapshot)); } - -TEST(Bug8373_1) { - LocalContext env; - v8::HandleScope scope(env->GetIsolate()); - v8::HeapProfiler* heap_profiler = env->GetIsolate()->GetHeapProfiler(); - - heap_profiler->StartSamplingHeapProfiler(100); - - heap_profiler->TakeHeapSnapshot(); - // Causes the StringsStorage to be deleted. - heap_profiler->DeleteAllHeapSnapshots(); - - // Triggers an allocation sample that tries to use the StringsStorage. - for (int i = 0; i < 2 * 1024; ++i) { - CompileRun( - "new Array(64);" - "new Uint8Array(16);"); - } - - heap_profiler->StopSamplingHeapProfiler(); -} - -TEST(Bug8373_2) { - LocalContext env; - v8::HandleScope scope(env->GetIsolate()); - v8::HeapProfiler* heap_profiler = env->GetIsolate()->GetHeapProfiler(); - - heap_profiler->StartTrackingHeapObjects(true); - - heap_profiler->TakeHeapSnapshot(); - // Causes the StringsStorage to be deleted. - heap_profiler->DeleteAllHeapSnapshots(); - - // Triggers an allocations that try to use the StringsStorage. - for (int i = 0; i < 2 * 1024; ++i) { - CompileRun( - "new Array(64);" - "new Uint8Array(16);"); - } - - heap_profiler->StopTrackingHeapObjects(); -} diff --git a/deps/v8/test/cctest/test-inobject-slack-tracking.cc b/deps/v8/test/cctest/test-inobject-slack-tracking.cc index 0e850b1682..9255dc04b0 100644 --- a/deps/v8/test/cctest/test-inobject-slack-tracking.cc +++ b/deps/v8/test/cctest/test-inobject-slack-tracking.cc @@ -1143,8 +1143,6 @@ TEST(SubclassArrayBuiltinNoInlineNew) { TEST(SubclassTypedArrayBuiltin) { // Avoid eventual completion of in-object slack tracking. FLAG_always_opt = false; - // Make BigInt64Array/BigUint64Array available for testing. - FLAG_harmony_bigint = true; CcTest::InitializeVM(); v8::HandleScope scope(CcTest::isolate()); diff --git a/deps/v8/test/cctest/test-inspector.cc b/deps/v8/test/cctest/test-inspector.cc index 8986c3c488..6dd2aefb9e 100644 --- a/deps/v8/test/cctest/test-inspector.cc +++ b/deps/v8/test/cctest/test-inspector.cc @@ -20,7 +20,7 @@ namespace { class NoopChannel : public V8Inspector::Channel { public: - virtual ~NoopChannel() {} + ~NoopChannel() override = default; void sendResponse(int callId, std::unique_ptr<StringBuffer> message) override {} void sendNotification(std::unique_ptr<StringBuffer> message) override {} diff --git a/deps/v8/test/cctest/test-intl.cc b/deps/v8/test/cctest/test-intl.cc index 950fbe3d30..3359a3878b 100644 --- a/deps/v8/test/cctest/test-intl.cc +++ b/deps/v8/test/cctest/test-intl.cc @@ -4,10 +4,10 @@ #ifdef V8_INTL_SUPPORT -#include "src/builtins/builtins-intl.h" #include "src/lookup.h" #include "src/objects-inl.h" #include "src/objects/intl-objects.h" +#include "src/objects/js-number-format.h" #include "test/cctest/cctest.h" namespace v8 { @@ -125,8 +125,7 @@ TEST(GetStringOption) { Handle<String> key = isolate->factory()->NewStringFromAsciiChecked("foo"); v8::internal::LookupIterator it(isolate, options, key); CHECK(Object::SetProperty(&it, Handle<Smi>(Smi::FromInt(42), isolate), - LanguageMode::kStrict, - AllocationMemento::MAY_BE_STORE_FROM_KEYED) + LanguageMode::kStrict, StoreOrigin::kMaybeKeyed) .FromJust()); { @@ -209,52 +208,26 @@ TEST(GetBoolOption) { } } -bool ScriptTagWasRemoved(std::string locale, std::string expected) { - std::string without_script_tag; - bool didShorten = Intl::RemoveLocaleScriptTag(locale, &without_script_tag); - return didShorten && expected == without_script_tag; -} - -bool ScriptTagWasNotRemoved(std::string locale) { - std::string without_script_tag; - bool didShorten = Intl::RemoveLocaleScriptTag(locale, &without_script_tag); - return !didShorten && without_script_tag.empty(); -} - -TEST(RemoveLocaleScriptTag) { - CHECK(ScriptTagWasRemoved("aa_Bbbb_CC", "aa_CC")); - CHECK(ScriptTagWasRemoved("aaa_Bbbb_CC", "aaa_CC")); - - CHECK(ScriptTagWasNotRemoved("aa")); - CHECK(ScriptTagWasNotRemoved("aaa")); - CHECK(ScriptTagWasNotRemoved("aa_CC")); - CHECK(ScriptTagWasNotRemoved("aa_Bbb_CC")); - CHECK(ScriptTagWasNotRemoved("aa_1bbb_CC")); -} - TEST(GetAvailableLocales) { std::set<std::string> locales; - locales = Intl::GetAvailableLocales(IcuService::kBreakIterator); + locales = Intl::GetAvailableLocales(ICUService::kBreakIterator); CHECK(locales.count("en-US")); CHECK(!locales.count("abcdefg")); - locales = Intl::GetAvailableLocales(IcuService::kCollator); - CHECK(locales.count("en-US")); - - locales = Intl::GetAvailableLocales(IcuService::kDateFormat); + locales = Intl::GetAvailableLocales(ICUService::kCollator); CHECK(locales.count("en-US")); - locales = Intl::GetAvailableLocales(IcuService::kNumberFormat); + locales = Intl::GetAvailableLocales(ICUService::kDateFormat); CHECK(locales.count("en-US")); - locales = Intl::GetAvailableLocales(IcuService::kPluralRules); + locales = Intl::GetAvailableLocales(ICUService::kNumberFormat); CHECK(locales.count("en-US")); - locales = Intl::GetAvailableLocales(IcuService::kResourceBundle); + locales = Intl::GetAvailableLocales(ICUService::kPluralRules); CHECK(locales.count("en-US")); - locales = Intl::GetAvailableLocales(IcuService::kRelativeDateTimeFormatter); + locales = Intl::GetAvailableLocales(ICUService::kRelativeDateTimeFormatter); CHECK(locales.count("en-US")); } diff --git a/deps/v8/test/cctest/test-javascript-arm64.cc b/deps/v8/test/cctest/test-javascript-arm64.cc index 3b1f1a1d12..428726fdc7 100644 --- a/deps/v8/test/cctest/test-javascript-arm64.cc +++ b/deps/v8/test/cctest/test-javascript-arm64.cc @@ -46,7 +46,7 @@ namespace test_javascript_arm64 { static void ExpectBoolean(Local<v8::Context> context, bool expected, Local<Value> result) { CHECK(result->IsBoolean()); - CHECK_EQ(expected, result->BooleanValue(context).FromJust()); + CHECK_EQ(expected, result->BooleanValue(context->GetIsolate())); } static void ExpectInt32(Local<v8::Context> context, int32_t expected, diff --git a/deps/v8/test/cctest/test-lockers.cc b/deps/v8/test/cctest/test-lockers.cc index dec279e781..5a4dcd588e 100644 --- a/deps/v8/test/cctest/test-lockers.cc +++ b/deps/v8/test/cctest/test-lockers.cc @@ -51,7 +51,7 @@ class DeoptimizeCodeThread : public v8::base::Thread { context_(isolate, context), source_(trigger) {} - void Run() { + void Run() override { v8::Locker locker(isolate_); isolate_->Enter(); v8::HandleScope handle_scope(isolate_); @@ -290,7 +290,7 @@ class KangarooThread : public v8::base::Thread { isolate_(isolate), context_(isolate, context) {} - void Run() { + void Run() override { { v8::Locker locker(isolate_); v8::Isolate::Scope isolate_scope(isolate_); @@ -362,7 +362,7 @@ class JoinableThread { thread_(this) { } - virtual ~JoinableThread() {} + virtual ~JoinableThread() = default; void Start() { thread_.Start(); @@ -382,7 +382,7 @@ class JoinableThread { : Thread(Options(joinable_thread->name_)), joinable_thread_(joinable_thread) {} - virtual void Run() { + void Run() override { joinable_thread_->Run(); joinable_thread_->semaphore_.Signal(); } @@ -408,7 +408,7 @@ class IsolateLockingThreadWithLocalContext : public JoinableThread { isolate_(isolate) { } - virtual void Run() { + void Run() override { v8::Locker locker(isolate_); v8::Isolate::Scope isolate_scope(isolate_); v8::HandleScope handle_scope(isolate_); @@ -460,7 +460,7 @@ class IsolateNestedLockingThread : public JoinableThread { explicit IsolateNestedLockingThread(v8::Isolate* isolate) : JoinableThread("IsolateNestedLocking"), isolate_(isolate) { } - virtual void Run() { + void Run() override { v8::Locker lock(isolate_); v8::Isolate::Scope isolate_scope(isolate_); v8::HandleScope handle_scope(isolate_); @@ -508,7 +508,7 @@ class SeparateIsolatesLocksNonexclusiveThread : public JoinableThread { isolate1_(isolate1), isolate2_(isolate2) { } - virtual void Run() { + void Run() override { v8::Locker lock(isolate1_); v8::Isolate::Scope isolate_scope(isolate1_); v8::HandleScope handle_scope(isolate1_); @@ -556,7 +556,7 @@ class LockIsolateAndCalculateFibSharedContextThread : public JoinableThread { isolate_(isolate), context_(isolate, context) {} - virtual void Run() { + void Run() override { v8::Locker lock(isolate_); v8::Isolate::Scope isolate_scope(isolate_); v8::HandleScope handle_scope(isolate_); @@ -577,7 +577,7 @@ class LockerUnlockerThread : public JoinableThread { isolate_(isolate) { } - virtual void Run() { + void Run() override { isolate_->DiscardThreadSpecificMetadata(); // No-op { v8::Locker lock(isolate_); @@ -637,7 +637,7 @@ class LockTwiceAndUnlockThread : public JoinableThread { isolate_(isolate) { } - virtual void Run() { + void Run() override { v8::Locker lock(isolate_); v8::Isolate::Scope isolate_scope(isolate_); v8::HandleScope handle_scope(isolate_); @@ -697,7 +697,7 @@ class LockAndUnlockDifferentIsolatesThread : public JoinableThread { isolate2_(isolate2) { } - virtual void Run() { + void Run() override { std::unique_ptr<LockIsolateAndCalculateFibSharedContextThread> thread; v8::Locker lock1(isolate1_); CHECK(v8::Locker::IsLocked(isolate1_)); @@ -760,7 +760,7 @@ class LockUnlockLockThread : public JoinableThread { isolate_(isolate), context_(isolate, context) {} - virtual void Run() { + void Run() override { v8::Locker lock1(isolate_); CHECK(v8::Locker::IsLocked(isolate_)); CHECK(!v8::Locker::IsLocked(CcTest::isolate())); @@ -827,7 +827,7 @@ class LockUnlockLockDefaultIsolateThread : public JoinableThread { : JoinableThread("LockUnlockLockDefaultIsolateThread"), context_(CcTest::isolate(), context) {} - virtual void Run() { + void Run() override { v8::Locker lock1(CcTest::isolate()); { v8::Isolate::Scope isolate_scope(CcTest::isolate()); @@ -914,7 +914,7 @@ class IsolateGenesisThread : public JoinableThread { extension_names_(extension_names) {} - virtual void Run() { + void Run() override { v8::Isolate::CreateParams create_params; create_params.array_buffer_allocator = CcTest::array_buffer_allocator(); v8::Isolate* isolate = v8::Isolate::New(create_params); diff --git a/deps/v8/test/cctest/test-log.cc b/deps/v8/test/cctest/test-log.cc index 9ac73af3e5..f7774b7bda 100644 --- a/deps/v8/test/cctest/test-log.cc +++ b/deps/v8/test/cctest/test-log.cc @@ -155,12 +155,16 @@ class ScopedLoggerInitializer { start = IndexOfLine({search_term}, start); if (start == std::string::npos) break; std::vector<std::string> columns = Split(log_.at(start), ','); - CHECK_LT(address_column, columns.size()); + ++start; // Skip the found line. + // TODO(crbug.com/v8/8084): These two continue lines should really be + // errors. But on Windows the log is sometimes mysteriously cut off at the + // end. If the cut-off point happens to fall in the address field, the + // conditions will be triggered. + if (address_column >= columns.size()) continue; uintptr_t address = strtoll(columns.at(address_column).c_str(), nullptr, 16); - CHECK_GT(address, 0); + if (address == 0) continue; result.insert(address); - ++start; // Skip the found line. } return result; } @@ -259,9 +263,9 @@ class SimpleExternalString : public v8::String::ExternalStringResource { for (int i = 0; i < utf_source_.length(); ++i) utf_source_[i] = source[i]; } - virtual ~SimpleExternalString() {} - virtual size_t length() const { return utf_source_.length(); } - virtual const uint16_t* data() const { return utf_source_.start(); } + ~SimpleExternalString() override = default; + size_t length() const override { return utf_source_.length(); } + const uint16_t* data() const override { return utf_source_.start(); } private: i::ScopedVector<uint16_t> utf_source_; }; @@ -428,8 +432,7 @@ TEST(EquivalenceOfLoggingAndTraversal) { " (function a(j) { return function b() { return j; } })(100);\n" "})(this);"); logger.logger()->StopProfiler(); - reinterpret_cast<i::Isolate*>(isolate)->heap()->CollectAllGarbage( - i::Heap::kMakeHeapIterableMask, i::GarbageCollectionReason::kTesting); + CcTest::PreciseCollectAllGarbage(); logger.StringEvent("test-logging-done", ""); // Iterate heap to find compiled functions, will write to log. @@ -555,6 +558,8 @@ TEST(Issue539892) { TEST(LogAll) { SETUP_FLAGS(); i::FLAG_log_all = true; + i::FLAG_turbo_inlining = false; + i::FLAG_enable_one_shot_optimization = false; v8::Isolate::CreateParams create_params; create_params.array_buffer_allocator = CcTest::array_buffer_allocator(); v8::Isolate* isolate = v8::Isolate::New(create_params); @@ -580,7 +585,9 @@ TEST(LogAll) { CHECK(logger.ContainsLine({"api,v8::Script::Run"})); CHECK(logger.ContainsLine({"code-creation,LazyCompile,", "testAddFn"})); if (i::FLAG_opt && !i::FLAG_always_opt) { - CHECK(logger.ContainsLine({"code-deopt,", "soft"})); + CHECK(logger.ContainsLine({"code-deopt,", "not a Smi"})); + if (i::FLAG_enable_one_shot_optimization) + CHECK(logger.ContainsLine({"code-deopt,", "DeoptimizeNow"})); CHECK(logger.ContainsLine({"timer-event-start", "V8.DeoptimizeCode"})); CHECK(logger.ContainsLine({"timer-event-end", "V8.DeoptimizeCode"})); } diff --git a/deps/v8/test/cctest/test-macro-assembler-mips.cc b/deps/v8/test/cctest/test-macro-assembler-mips.cc index 18404d6629..97ddda12c5 100644 --- a/deps/v8/test/cctest/test-macro-assembler-mips.cc +++ b/deps/v8/test/cctest/test-macro-assembler-mips.cc @@ -703,7 +703,7 @@ TEST(min_max_nan) { auto handle_dnan = [masm](FPURegister dst, Label* nan, Label* back) { __ bind(nan); - __ LoadRoot(t8, Heap::kNanValueRootIndex); + __ LoadRoot(t8, RootIndex::kNanValue); __ Ldc1(dst, FieldMemOperand(t8, HeapNumber::kValueOffset)); __ Branch(back); }; diff --git a/deps/v8/test/cctest/test-macro-assembler-mips64.cc b/deps/v8/test/cctest/test-macro-assembler-mips64.cc index 9a6e319363..b2aea23920 100644 --- a/deps/v8/test/cctest/test-macro-assembler-mips64.cc +++ b/deps/v8/test/cctest/test-macro-assembler-mips64.cc @@ -944,7 +944,7 @@ TEST(min_max_nan) { auto handle_dnan = [masm](FPURegister dst, Label* nan, Label* back) { __ bind(nan); - __ LoadRoot(t8, Heap::kNanValueRootIndex); + __ LoadRoot(t8, RootIndex::kNanValue); __ Ldc1(dst, FieldMemOperand(t8, HeapNumber::kValueOffset)); __ Branch(back); }; diff --git a/deps/v8/test/cctest/test-mementos.cc b/deps/v8/test/cctest/test-mementos.cc index 59653ccd73..3690752f13 100644 --- a/deps/v8/test/cctest/test-mementos.cc +++ b/deps/v8/test/cctest/test-mementos.cc @@ -67,7 +67,7 @@ TEST(Regress340063) { // Call GC to see if we can handle a poisonous memento right after the // current new space top pointer. - CcTest::CollectAllGarbage(Heap::kAbortIncrementalMarkingMask); + CcTest::PreciseCollectAllGarbage(); } @@ -84,7 +84,7 @@ TEST(Regress470390) { // Call GC to see if we can handle a poisonous memento right after the // current new space top pointer. - CcTest::CollectAllGarbage(Heap::kAbortIncrementalMarkingMask); + CcTest::PreciseCollectAllGarbage(); } diff --git a/deps/v8/test/cctest/test-parsing.cc b/deps/v8/test/cctest/test-parsing.cc index 72e3711405..942d597ccc 100644 --- a/deps/v8/test/cctest/test-parsing.cc +++ b/deps/v8/test/cctest/test-parsing.cc @@ -71,6 +71,326 @@ void MockUseCounterCallback(v8::Isolate* isolate, } // namespace +TEST(IsContextualKeyword) { + for (int i = 0; i < Token::NUM_TOKENS; i++) { + Token::Value token = static_cast<Token::Value>(i); + CHECK_EQ(Token::TypeForTesting(token) == 'C', + Token::IsContextualKeyword(token)); + } +} + +bool TokenIsAnyIdentifier(Token::Value token) { + switch (token) { + case Token::IDENTIFIER: + case Token::ASYNC: + case Token::AWAIT: + case Token::YIELD: + case Token::LET: + case Token::STATIC: + case Token::FUTURE_STRICT_RESERVED_WORD: + case Token::ESCAPED_STRICT_RESERVED_WORD: + case Token::ENUM: + return true; + default: + return false; + } +} + +TEST(AnyIdentifierToken) { + for (int i = 0; i < Token::NUM_TOKENS; i++) { + Token::Value token = static_cast<Token::Value>(i); + CHECK_EQ(TokenIsAnyIdentifier(token), Token::IsAnyIdentifier(token)); + } +} + +bool TokenIsIdentifier(Token::Value token, LanguageMode language_mode, + bool is_generator, bool disallow_await) { + switch (token) { + case Token::IDENTIFIER: + case Token::ASYNC: + return true; + case Token::YIELD: + return !is_generator && is_sloppy(language_mode); + case Token::AWAIT: + return !disallow_await; + case Token::LET: + case Token::STATIC: + case Token::FUTURE_STRICT_RESERVED_WORD: + case Token::ESCAPED_STRICT_RESERVED_WORD: + return is_sloppy(language_mode); + default: + return false; + } + UNREACHABLE(); +} + +TEST(IsIdentifierToken) { + for (int i = 0; i < Token::NUM_TOKENS; i++) { + Token::Value token = static_cast<Token::Value>(i); + for (size_t raw_language_mode = 0; raw_language_mode < LanguageModeSize; + raw_language_mode++) { + LanguageMode mode = static_cast<LanguageMode>(raw_language_mode); + for (int is_generator = 0; is_generator < 2; is_generator++) { + for (int disallow_await = 0; disallow_await < 2; disallow_await++) { + CHECK_EQ( + TokenIsIdentifier(token, mode, is_generator, disallow_await), + Token::IsIdentifier(token, mode, is_generator, disallow_await)); + } + } + } + } +} + +bool TokenIsStrictReservedWord(Token::Value token) { + switch (token) { + case Token::LET: + case Token::STATIC: + case Token::FUTURE_STRICT_RESERVED_WORD: + case Token::ESCAPED_STRICT_RESERVED_WORD: + return true; + default: + return false; + } + UNREACHABLE(); +} + +TEST(IsStrictReservedWord) { + for (int i = 0; i < Token::NUM_TOKENS; i++) { + Token::Value token = static_cast<Token::Value>(i); + CHECK_EQ(TokenIsStrictReservedWord(token), + Token::IsStrictReservedWord(token)); + } +} + +bool TokenIsLiteral(Token::Value token) { + switch (token) { + case Token::NULL_LITERAL: + case Token::TRUE_LITERAL: + case Token::FALSE_LITERAL: + case Token::NUMBER: + case Token::SMI: + case Token::BIGINT: + case Token::STRING: + return true; + default: + return false; + } + UNREACHABLE(); +} + +TEST(IsLiteralToken) { + for (int i = 0; i < Token::NUM_TOKENS; i++) { + Token::Value token = static_cast<Token::Value>(i); + CHECK_EQ(TokenIsLiteral(token), Token::IsLiteral(token)); + } +} +bool TokenIsAssignmentOp(Token::Value token) { + switch (token) { + case Token::INIT: + case Token::ASSIGN: +#define T(name, string, precedence) case Token::name: + BINARY_OP_TOKEN_LIST(T, EXPAND_BINOP_ASSIGN_TOKEN) +#undef T + return true; + default: + return false; + } +} + +TEST(AssignmentOp) { + for (int i = 0; i < Token::NUM_TOKENS; i++) { + Token::Value token = static_cast<Token::Value>(i); + CHECK_EQ(TokenIsAssignmentOp(token), Token::IsAssignmentOp(token)); + } +} + +bool TokenIsBinaryOp(Token::Value token) { + switch (token) { + case Token::COMMA: + case Token::OR: + case Token::AND: +#define T(name, string, precedence) case Token::name: + BINARY_OP_TOKEN_LIST(T, EXPAND_BINOP_TOKEN) +#undef T + return true; + default: + return false; + } +} + +TEST(BinaryOp) { + for (int i = 0; i < Token::NUM_TOKENS; i++) { + Token::Value token = static_cast<Token::Value>(i); + CHECK_EQ(TokenIsBinaryOp(token), Token::IsBinaryOp(token)); + } +} + +bool TokenIsCompareOp(Token::Value token) { + switch (token) { + case Token::EQ: + case Token::EQ_STRICT: + case Token::NE: + case Token::NE_STRICT: + case Token::LT: + case Token::GT: + case Token::LTE: + case Token::GTE: + case Token::INSTANCEOF: + case Token::IN: + return true; + default: + return false; + } +} + +TEST(CompareOp) { + for (int i = 0; i < Token::NUM_TOKENS; i++) { + Token::Value token = static_cast<Token::Value>(i); + CHECK_EQ(TokenIsCompareOp(token), Token::IsCompareOp(token)); + } +} + +bool TokenIsOrderedRelationalCompareOp(Token::Value token) { + switch (token) { + case Token::LT: + case Token::GT: + case Token::LTE: + case Token::GTE: + return true; + default: + return false; + } +} + +TEST(IsOrderedRelationalCompareOp) { + for (int i = 0; i < Token::NUM_TOKENS; i++) { + Token::Value token = static_cast<Token::Value>(i); + CHECK_EQ(TokenIsOrderedRelationalCompareOp(token), + Token::IsOrderedRelationalCompareOp(token)); + } +} + +bool TokenIsEqualityOp(Token::Value token) { + switch (token) { + case Token::EQ: + case Token::EQ_STRICT: + return true; + default: + return false; + } +} + +TEST(IsEqualityOp) { + for (int i = 0; i < Token::NUM_TOKENS; i++) { + Token::Value token = static_cast<Token::Value>(i); + CHECK_EQ(TokenIsEqualityOp(token), Token::IsEqualityOp(token)); + } +} + +bool TokenIsBitOp(Token::Value token) { + switch (token) { + case Token::BIT_OR: + case Token::BIT_XOR: + case Token::BIT_AND: + case Token::SHL: + case Token::SAR: + case Token::SHR: + case Token::BIT_NOT: + return true; + default: + return false; + } +} + +TEST(IsBitOp) { + for (int i = 0; i < Token::NUM_TOKENS; i++) { + Token::Value token = static_cast<Token::Value>(i); + CHECK_EQ(TokenIsBitOp(token), Token::IsBitOp(token)); + } +} + +bool TokenIsUnaryOp(Token::Value token) { + switch (token) { + case Token::NOT: + case Token::BIT_NOT: + case Token::DELETE: + case Token::TYPEOF: + case Token::VOID: + case Token::ADD: + case Token::SUB: + return true; + default: + return false; + } +} + +TEST(IsUnaryOp) { + for (int i = 0; i < Token::NUM_TOKENS; i++) { + Token::Value token = static_cast<Token::Value>(i); + CHECK_EQ(TokenIsUnaryOp(token), Token::IsUnaryOp(token)); + } +} + +bool TokenIsCountOp(Token::Value token) { + switch (token) { + case Token::INC: + case Token::DEC: + return true; + default: + return false; + } +} + +TEST(IsCountOp) { + for (int i = 0; i < Token::NUM_TOKENS; i++) { + Token::Value token = static_cast<Token::Value>(i); + CHECK_EQ(TokenIsCountOp(token), Token::IsCountOp(token)); + } +} + +bool TokenIsShiftOp(Token::Value token) { + switch (token) { + case Token::SHL: + case Token::SAR: + case Token::SHR: + return true; + default: + return false; + } +} + +TEST(IsShiftOp) { + for (int i = 0; i < Token::NUM_TOKENS; i++) { + Token::Value token = static_cast<Token::Value>(i); + CHECK_EQ(TokenIsShiftOp(token), Token::IsShiftOp(token)); + } +} + +bool TokenIsTrivialExpressionToken(Token::Value token) { + switch (token) { + case Token::SMI: + case Token::NUMBER: + case Token::BIGINT: + case Token::NULL_LITERAL: + case Token::TRUE_LITERAL: + case Token::FALSE_LITERAL: + case Token::STRING: + case Token::IDENTIFIER: + case Token::THIS: + return true; + default: + return false; + } +} + +TEST(IsTrivialExpressionToken) { + for (int i = 0; i < Token::NUM_TOKENS; i++) { + Token::Value token = static_cast<Token::Value>(i); + CHECK_EQ(TokenIsTrivialExpressionToken(token), + Token::IsTrivialExpressionToken(token)); + } +} + TEST(ScanKeywords) { struct KeywordToken { const char* keyword; @@ -253,8 +573,8 @@ class ScriptResource : public v8::String::ExternalOneByteStringResource { ScriptResource(const char* data, size_t length) : data_(data), length_(length) { } - const char* data() const { return data_; } - size_t length() const { return length_; } + const char* data() const override { return data_; } + size_t length() const override { return length_; } private: const char* data_; @@ -1230,8 +1550,10 @@ void TestParserSyncWithFlags(i::Handle<i::String> source, "However, the preparser succeeded", source->ToCString().get(), message_string->ToCString().get()); } - // Check that preparser and parser produce the same error. - if (test_preparser && !ignore_error_msg) { + // Check that preparser and parser produce the same error, except for cases + // where we do not track errors in the preparser. + if (test_preparser && !ignore_error_msg && + !pending_error_handler.ErrorUnidentifiableByPreParser()) { i::Handle<i::String> preparser_message = pending_error_handler.FormatErrorMessageForTest(CcTest::i_isolate()); if (!i::String::Equals(isolate, message_string, preparser_message)) { @@ -1721,7 +2043,7 @@ TEST(ErrorsFutureStrictReservedWords) { {"() => {", "}"}, {nullptr, nullptr}}; const char* invalid_statements[] = { - FUTURE_STRICT_RESERVED_LEX_BINDINGS("let") nullptr}; + FUTURE_STRICT_RESERVED_LEX_BINDINGS(let) nullptr}; RunParserSyncTest(non_strict_contexts, invalid_statements, kError); } @@ -2280,7 +2602,7 @@ TEST(OptionalCatchBinding) { {"try {", "} catch ({e}) { }"}, {"try {} catch ({e}) {", "}"}, {"function f() {", "}"}, - { NULL, NULL } + { nullptr, nullptr } }; const char* statement_data[] = { @@ -2288,7 +2610,7 @@ TEST(OptionalCatchBinding) { "try { } catch { } finally { }", "try { let e; } catch { let e; }", "try { let e; } catch { let e; } finally { let e; }", - NULL + nullptr }; // clang-format on @@ -2301,7 +2623,7 @@ TEST(OptionalCatchBindingInDoExpression) { // clang-format off const char* context_data[][2] = { {"((x = (eval(''), do {", "}))=>{})()"}, - { NULL, NULL } + { nullptr, nullptr } }; const char* statement_data[] = { @@ -2309,12 +2631,12 @@ TEST(OptionalCatchBindingInDoExpression) { "try { } catch { } finally { }", "try { let e; } catch { let e; }", "try { let e; } catch { let e; } finally { let e; }", - NULL + nullptr }; // clang-format on static const ParserFlag do_and_catch_flags[] = {kAllowHarmonyDoExpressions}; - RunParserSyncTest(context_data, statement_data, kSuccess, NULL, 0, + RunParserSyncTest(context_data, statement_data, kSuccess, nullptr, 0, do_and_catch_flags, arraysize(do_and_catch_flags)); } @@ -3240,272 +3562,276 @@ TEST(MaybeAssignedInsideLoop) { std::vector<unsigned> top; // Can't use {} in initializers below. Input module_and_script_tests[] = { - {1, "for (j=x; j<10; ++j) { foo = j }", top}, - {1, "for (j=x; j<10; ++j) { [foo] = [j] }", top}, - {1, "for (j=x; j<10; ++j) { var foo = j }", top}, - {1, "for (j=x; j<10; ++j) { var [foo] = [j] }", top}, - {0, "for (j=x; j<10; ++j) { let foo = j }", {0}}, - {0, "for (j=x; j<10; ++j) { let [foo] = [j] }", {0}}, - {0, "for (j=x; j<10; ++j) { const foo = j }", {0}}, - {0, "for (j=x; j<10; ++j) { const [foo] = [j] }", {0}}, - {0, "for (j=x; j<10; ++j) { function foo() {return j} }", {0}}, - - {1, "for ({j}=x; j<10; ++j) { foo = j }", top}, - {1, "for ({j}=x; j<10; ++j) { [foo] = [j] }", top}, - {1, "for ({j}=x; j<10; ++j) { var foo = j }", top}, - {1, "for ({j}=x; j<10; ++j) { var [foo] = [j] }", top}, - {0, "for ({j}=x; j<10; ++j) { let foo = j }", {0}}, - {0, "for ({j}=x; j<10; ++j) { let [foo] = [j] }", {0}}, - {0, "for ({j}=x; j<10; ++j) { const foo = j }", {0}}, - {0, "for ({j}=x; j<10; ++j) { const [foo] = [j] }", {0}}, - {0, "for ({j}=x; j<10; ++j) { function foo() {return j} }", {0}}, - - {1, "for (var j=x; j<10; ++j) { foo = j }", top}, - {1, "for (var j=x; j<10; ++j) { [foo] = [j] }", top}, - {1, "for (var j=x; j<10; ++j) { var foo = j }", top}, - {1, "for (var j=x; j<10; ++j) { var [foo] = [j] }", top}, - {0, "for (var j=x; j<10; ++j) { let foo = j }", {0}}, - {0, "for (var j=x; j<10; ++j) { let [foo] = [j] }", {0}}, - {0, "for (var j=x; j<10; ++j) { const foo = j }", {0}}, - {0, "for (var j=x; j<10; ++j) { const [foo] = [j] }", {0}}, - {0, "for (var j=x; j<10; ++j) { function foo() {return j} }", {0}}, - - {1, "for (var {j}=x; j<10; ++j) { foo = j }", top}, - {1, "for (var {j}=x; j<10; ++j) { [foo] = [j] }", top}, - {1, "for (var {j}=x; j<10; ++j) { var foo = j }", top}, - {1, "for (var {j}=x; j<10; ++j) { var [foo] = [j] }", top}, - {0, "for (var {j}=x; j<10; ++j) { let foo = j }", {0}}, - {0, "for (var {j}=x; j<10; ++j) { let [foo] = [j] }", {0}}, - {0, "for (var {j}=x; j<10; ++j) { const foo = j }", {0}}, - {0, "for (var {j}=x; j<10; ++j) { const [foo] = [j] }", {0}}, - {0, "for (var {j}=x; j<10; ++j) { function foo() {return j} }", {0}}, - - {1, "for (let j=x; j<10; ++j) { foo = j }", top}, - {1, "for (let j=x; j<10; ++j) { [foo] = [j] }", top}, - {1, "for (let j=x; j<10; ++j) { var foo = j }", top}, - {1, "for (let j=x; j<10; ++j) { var [foo] = [j] }", top}, - {0, "for (let j=x; j<10; ++j) { let foo = j }", {0, 0}}, - {0, "for (let j=x; j<10; ++j) { let [foo] = [j] }", {0, 0, 0}}, - {0, "for (let j=x; j<10; ++j) { const foo = j }", {0, 0}}, - {0, "for (let j=x; j<10; ++j) { const [foo] = [j] }", {0, 0, 0}}, - {0, "for (let j=x; j<10; ++j) { function foo() {return j} }", {0, 0, 0}}, - - {1, "for (let {j}=x; j<10; ++j) { foo = j }", top}, - {1, "for (let {j}=x; j<10; ++j) { [foo] = [j] }", top}, - {1, "for (let {j}=x; j<10; ++j) { var foo = j }", top}, - {1, "for (let {j}=x; j<10; ++j) { var [foo] = [j] }", top}, - {0, "for (let {j}=x; j<10; ++j) { let foo = j }", {0, 0}}, - {0, "for (let {j}=x; j<10; ++j) { let [foo] = [j] }", {0, 0, 0}}, - {0, "for (let {j}=x; j<10; ++j) { const foo = j }", {0, 0}}, - {0, "for (let {j}=x; j<10; ++j) { const [foo] = [j] }", {0, 0, 0}}, - {0, "for (let {j}=x; j<10; ++j) { function foo(){return j} }", {0, 0, 0}}, - - {1, "for (j of x) { foo = j }", top}, - {1, "for (j of x) { [foo] = [j] }", top}, - {1, "for (j of x) { var foo = j }", top}, - {1, "for (j of x) { var [foo] = [j] }", top}, - {0, "for (j of x) { let foo = j }", {1}}, - {0, "for (j of x) { let [foo] = [j] }", {1}}, - {0, "for (j of x) { const foo = j }", {1}}, - {0, "for (j of x) { const [foo] = [j] }", {1}}, - {0, "for (j of x) { function foo() {return j} }", {1}}, - - {1, "for ({j} of x) { foo = j }", top}, - {1, "for ({j} of x) { [foo] = [j] }", top}, - {1, "for ({j} of x) { var foo = j }", top}, - {1, "for ({j} of x) { var [foo] = [j] }", top}, - {0, "for ({j} of x) { let foo = j }", {1}}, - {0, "for ({j} of x) { let [foo] = [j] }", {1}}, - {0, "for ({j} of x) { const foo = j }", {1}}, - {0, "for ({j} of x) { const [foo] = [j] }", {1}}, - {0, "for ({j} of x) { function foo() {return j} }", {1}}, - - {1, "for (var j of x) { foo = j }", top}, - {1, "for (var j of x) { [foo] = [j] }", top}, - {1, "for (var j of x) { var foo = j }", top}, - {1, "for (var j of x) { var [foo] = [j] }", top}, - {0, "for (var j of x) { let foo = j }", {1}}, - {0, "for (var j of x) { let [foo] = [j] }", {1}}, - {0, "for (var j of x) { const foo = j }", {1}}, - {0, "for (var j of x) { const [foo] = [j] }", {1}}, - {0, "for (var j of x) { function foo() {return j} }", {1}}, - - {1, "for (var {j} of x) { foo = j }", top}, - {1, "for (var {j} of x) { [foo] = [j] }", top}, - {1, "for (var {j} of x) { var foo = j }", top}, - {1, "for (var {j} of x) { var [foo] = [j] }", top}, - {0, "for (var {j} of x) { let foo = j }", {1}}, - {0, "for (var {j} of x) { let [foo] = [j] }", {1}}, - {0, "for (var {j} of x) { const foo = j }", {1}}, - {0, "for (var {j} of x) { const [foo] = [j] }", {1}}, - {0, "for (var {j} of x) { function foo() {return j} }", {1}}, - - {1, "for (let j of x) { foo = j }", top}, - {1, "for (let j of x) { [foo] = [j] }", top}, - {1, "for (let j of x) { var foo = j }", top}, - {1, "for (let j of x) { var [foo] = [j] }", top}, - {0, "for (let j of x) { let foo = j }", {0, 1, 0}}, - {0, "for (let j of x) { let [foo] = [j] }", {0, 1, 0}}, - {0, "for (let j of x) { const foo = j }", {0, 1, 0}}, - {0, "for (let j of x) { const [foo] = [j] }", {0, 1, 0}}, - {0, "for (let j of x) { function foo() {return j} }", {0, 1, 0}}, - - {1, "for (let {j} of x) { foo = j }", top}, - {1, "for (let {j} of x) { [foo] = [j] }", top}, - {1, "for (let {j} of x) { var foo = j }", top}, - {1, "for (let {j} of x) { var [foo] = [j] }", top}, - {0, "for (let {j} of x) { let foo = j }", {0, 1, 0}}, - {0, "for (let {j} of x) { let [foo] = [j] }", {0, 1, 0}}, - {0, "for (let {j} of x) { const foo = j }", {0, 1, 0}}, - {0, "for (let {j} of x) { const [foo] = [j] }", {0, 1, 0}}, - {0, "for (let {j} of x) { function foo() {return j} }", {0, 1, 0}}, - - {1, "for (const j of x) { foo = j }", top}, - {1, "for (const j of x) { [foo] = [j] }", top}, - {1, "for (const j of x) { var foo = j }", top}, - {1, "for (const j of x) { var [foo] = [j] }", top}, - {0, "for (const j of x) { let foo = j }", {0, 1, 0}}, - {0, "for (const j of x) { let [foo] = [j] }", {0, 1, 0}}, - {0, "for (const j of x) { const foo = j }", {0, 1, 0}}, - {0, "for (const j of x) { const [foo] = [j] }", {0, 1, 0}}, - {0, "for (const j of x) { function foo() {return j} }", {0, 1, 0}}, - - {1, "for (const {j} of x) { foo = j }", top}, - {1, "for (const {j} of x) { [foo] = [j] }", top}, - {1, "for (const {j} of x) { var foo = j }", top}, - {1, "for (const {j} of x) { var [foo] = [j] }", top}, - {0, "for (const {j} of x) { let foo = j }", {0, 1, 0}}, - {0, "for (const {j} of x) { let [foo] = [j] }", {0, 1, 0}}, - {0, "for (const {j} of x) { const foo = j }", {0, 1, 0}}, - {0, "for (const {j} of x) { const [foo] = [j] }", {0, 1, 0}}, - {0, "for (const {j} of x) { function foo() {return j} }", {0, 1, 0}}, - - {1, "for (j in x) { foo = j }", top}, - {1, "for (j in x) { [foo] = [j] }", top}, - {1, "for (j in x) { var foo = j }", top}, - {1, "for (j in x) { var [foo] = [j] }", top}, - {0, "for (j in x) { let foo = j }", {0}}, - {0, "for (j in x) { let [foo] = [j] }", {0}}, - {0, "for (j in x) { const foo = j }", {0}}, - {0, "for (j in x) { const [foo] = [j] }", {0}}, - {0, "for (j in x) { function foo() {return j} }", {0}}, - - {1, "for ({j} in x) { foo = j }", top}, - {1, "for ({j} in x) { [foo] = [j] }", top}, - {1, "for ({j} in x) { var foo = j }", top}, - {1, "for ({j} in x) { var [foo] = [j] }", top}, - {0, "for ({j} in x) { let foo = j }", {0}}, - {0, "for ({j} in x) { let [foo] = [j] }", {0}}, - {0, "for ({j} in x) { const foo = j }", {0}}, - {0, "for ({j} in x) { const [foo] = [j] }", {0}}, - {0, "for ({j} in x) { function foo() {return j} }", {0}}, - - {1, "for (var j in x) { foo = j }", top}, - {1, "for (var j in x) { [foo] = [j] }", top}, - {1, "for (var j in x) { var foo = j }", top}, - {1, "for (var j in x) { var [foo] = [j] }", top}, - {0, "for (var j in x) { let foo = j }", {0}}, - {0, "for (var j in x) { let [foo] = [j] }", {0}}, - {0, "for (var j in x) { const foo = j }", {0}}, - {0, "for (var j in x) { const [foo] = [j] }", {0}}, - {0, "for (var j in x) { function foo() {return j} }", {0}}, - - {1, "for (var {j} in x) { foo = j }", top}, - {1, "for (var {j} in x) { [foo] = [j] }", top}, - {1, "for (var {j} in x) { var foo = j }", top}, - {1, "for (var {j} in x) { var [foo] = [j] }", top}, - {0, "for (var {j} in x) { let foo = j }", {0}}, - {0, "for (var {j} in x) { let [foo] = [j] }", {0}}, - {0, "for (var {j} in x) { const foo = j }", {0}}, - {0, "for (var {j} in x) { const [foo] = [j] }", {0}}, - {0, "for (var {j} in x) { function foo() {return j} }", {0}}, - - {1, "for (let j in x) { foo = j }", top}, - {1, "for (let j in x) { [foo] = [j] }", top}, - {1, "for (let j in x) { var foo = j }", top}, - {1, "for (let j in x) { var [foo] = [j] }", top}, - {0, "for (let j in x) { let foo = j }", {0, 0, 0}}, - {0, "for (let j in x) { let [foo] = [j] }", {0, 0, 0}}, - {0, "for (let j in x) { const foo = j }", {0, 0, 0}}, - {0, "for (let j in x) { const [foo] = [j] }", {0, 0, 0}}, - {0, "for (let j in x) { function foo() {return j} }", {0, 0, 0}}, - - {1, "for (let {j} in x) { foo = j }", top}, - {1, "for (let {j} in x) { [foo] = [j] }", top}, - {1, "for (let {j} in x) { var foo = j }", top}, - {1, "for (let {j} in x) { var [foo] = [j] }", top}, - {0, "for (let {j} in x) { let foo = j }", {0, 0, 0}}, - {0, "for (let {j} in x) { let [foo] = [j] }", {0, 0, 0}}, - {0, "for (let {j} in x) { const foo = j }", {0, 0, 0}}, - {0, "for (let {j} in x) { const [foo] = [j] }", {0, 0, 0}}, - {0, "for (let {j} in x) { function foo() {return j} }", {0, 0, 0}}, - - {1, "for (const j in x) { foo = j }", top}, - {1, "for (const j in x) { [foo] = [j] }", top}, - {1, "for (const j in x) { var foo = j }", top}, - {1, "for (const j in x) { var [foo] = [j] }", top}, - {0, "for (const j in x) { let foo = j }", {0, 0, 0}}, - {0, "for (const j in x) { let [foo] = [j] }", {0, 0, 0}}, - {0, "for (const j in x) { const foo = j }", {0, 0, 0}}, - {0, "for (const j in x) { const [foo] = [j] }", {0, 0, 0}}, - {0, "for (const j in x) { function foo() {return j} }", {0, 0, 0}}, - - {1, "for (const {j} in x) { foo = j }", top}, - {1, "for (const {j} in x) { [foo] = [j] }", top}, - {1, "for (const {j} in x) { var foo = j }", top}, - {1, "for (const {j} in x) { var [foo] = [j] }", top}, - {0, "for (const {j} in x) { let foo = j }", {0, 0, 0}}, - {0, "for (const {j} in x) { let [foo] = [j] }", {0, 0, 0}}, - {0, "for (const {j} in x) { const foo = j }", {0, 0, 0}}, - {0, "for (const {j} in x) { const [foo] = [j] }", {0, 0, 0}}, - {0, "for (const {j} in x) { function foo() {return j} }", {0, 0, 0}}, - - {1, "while (j) { foo = j }", top}, - {1, "while (j) { [foo] = [j] }", top}, - {1, "while (j) { var foo = j }", top}, - {1, "while (j) { var [foo] = [j] }", top}, - {0, "while (j) { let foo = j }", {0}}, - {0, "while (j) { let [foo] = [j] }", {0}}, - {0, "while (j) { const foo = j }", {0}}, - {0, "while (j) { const [foo] = [j] }", {0}}, - {0, "while (j) { function foo() {return j} }", {0}}, - - {1, "do { foo = j } while (j)", top}, - {1, "do { [foo] = [j] } while (j)", top}, - {1, "do { var foo = j } while (j)", top}, - {1, "do { var [foo] = [j] } while (j)", top}, - {0, "do { let foo = j } while (j)", {0}}, - {0, "do { let [foo] = [j] } while (j)", {0}}, - {0, "do { const foo = j } while (j)", {0}}, - {0, "do { const [foo] = [j] } while (j)", {0}}, - {0, "do { function foo() {return j} } while (j)", {0}}, + {true, "for (j=x; j<10; ++j) { foo = j }", top}, + {true, "for (j=x; j<10; ++j) { [foo] = [j] }", top}, + {true, "for (j=x; j<10; ++j) { var foo = j }", top}, + {true, "for (j=x; j<10; ++j) { var [foo] = [j] }", top}, + {false, "for (j=x; j<10; ++j) { let foo = j }", {0}}, + {false, "for (j=x; j<10; ++j) { let [foo] = [j] }", {0}}, + {false, "for (j=x; j<10; ++j) { const foo = j }", {0}}, + {false, "for (j=x; j<10; ++j) { const [foo] = [j] }", {0}}, + {false, "for (j=x; j<10; ++j) { function foo() {return j} }", {0}}, + + {true, "for ({j}=x; j<10; ++j) { foo = j }", top}, + {true, "for ({j}=x; j<10; ++j) { [foo] = [j] }", top}, + {true, "for ({j}=x; j<10; ++j) { var foo = j }", top}, + {true, "for ({j}=x; j<10; ++j) { var [foo] = [j] }", top}, + {false, "for ({j}=x; j<10; ++j) { let foo = j }", {0}}, + {false, "for ({j}=x; j<10; ++j) { let [foo] = [j] }", {0}}, + {false, "for ({j}=x; j<10; ++j) { const foo = j }", {0}}, + {false, "for ({j}=x; j<10; ++j) { const [foo] = [j] }", {0}}, + {false, "for ({j}=x; j<10; ++j) { function foo() {return j} }", {0}}, + + {true, "for (var j=x; j<10; ++j) { foo = j }", top}, + {true, "for (var j=x; j<10; ++j) { [foo] = [j] }", top}, + {true, "for (var j=x; j<10; ++j) { var foo = j }", top}, + {true, "for (var j=x; j<10; ++j) { var [foo] = [j] }", top}, + {false, "for (var j=x; j<10; ++j) { let foo = j }", {0}}, + {false, "for (var j=x; j<10; ++j) { let [foo] = [j] }", {0}}, + {false, "for (var j=x; j<10; ++j) { const foo = j }", {0}}, + {false, "for (var j=x; j<10; ++j) { const [foo] = [j] }", {0}}, + {false, "for (var j=x; j<10; ++j) { function foo() {return j} }", {0}}, + + {true, "for (var {j}=x; j<10; ++j) { foo = j }", top}, + {true, "for (var {j}=x; j<10; ++j) { [foo] = [j] }", top}, + {true, "for (var {j}=x; j<10; ++j) { var foo = j }", top}, + {true, "for (var {j}=x; j<10; ++j) { var [foo] = [j] }", top}, + {false, "for (var {j}=x; j<10; ++j) { let foo = j }", {0}}, + {false, "for (var {j}=x; j<10; ++j) { let [foo] = [j] }", {0}}, + {false, "for (var {j}=x; j<10; ++j) { const foo = j }", {0}}, + {false, "for (var {j}=x; j<10; ++j) { const [foo] = [j] }", {0}}, + {false, "for (var {j}=x; j<10; ++j) { function foo() {return j} }", {0}}, + + {true, "for (let j=x; j<10; ++j) { foo = j }", top}, + {true, "for (let j=x; j<10; ++j) { [foo] = [j] }", top}, + {true, "for (let j=x; j<10; ++j) { var foo = j }", top}, + {true, "for (let j=x; j<10; ++j) { var [foo] = [j] }", top}, + {false, "for (let j=x; j<10; ++j) { let foo = j }", {0, 0}}, + {false, "for (let j=x; j<10; ++j) { let [foo] = [j] }", {0, 0, 0}}, + {false, "for (let j=x; j<10; ++j) { const foo = j }", {0, 0}}, + {false, "for (let j=x; j<10; ++j) { const [foo] = [j] }", {0, 0, 0}}, + {false, + "for (let j=x; j<10; ++j) { function foo() {return j} }", + {0, 0, 0}}, + + {true, "for (let {j}=x; j<10; ++j) { foo = j }", top}, + {true, "for (let {j}=x; j<10; ++j) { [foo] = [j] }", top}, + {true, "for (let {j}=x; j<10; ++j) { var foo = j }", top}, + {true, "for (let {j}=x; j<10; ++j) { var [foo] = [j] }", top}, + {false, "for (let {j}=x; j<10; ++j) { let foo = j }", {0, 0}}, + {false, "for (let {j}=x; j<10; ++j) { let [foo] = [j] }", {0, 0, 0}}, + {false, "for (let {j}=x; j<10; ++j) { const foo = j }", {0, 0}}, + {false, "for (let {j}=x; j<10; ++j) { const [foo] = [j] }", {0, 0, 0}}, + {false, + "for (let {j}=x; j<10; ++j) { function foo(){return j} }", + {0, 0, 0}}, + + {true, "for (j of x) { foo = j }", top}, + {true, "for (j of x) { [foo] = [j] }", top}, + {true, "for (j of x) { var foo = j }", top}, + {true, "for (j of x) { var [foo] = [j] }", top}, + {false, "for (j of x) { let foo = j }", {1}}, + {false, "for (j of x) { let [foo] = [j] }", {1}}, + {false, "for (j of x) { const foo = j }", {1}}, + {false, "for (j of x) { const [foo] = [j] }", {1}}, + {false, "for (j of x) { function foo() {return j} }", {1}}, + + {true, "for ({j} of x) { foo = j }", top}, + {true, "for ({j} of x) { [foo] = [j] }", top}, + {true, "for ({j} of x) { var foo = j }", top}, + {true, "for ({j} of x) { var [foo] = [j] }", top}, + {false, "for ({j} of x) { let foo = j }", {1}}, + {false, "for ({j} of x) { let [foo] = [j] }", {1}}, + {false, "for ({j} of x) { const foo = j }", {1}}, + {false, "for ({j} of x) { const [foo] = [j] }", {1}}, + {false, "for ({j} of x) { function foo() {return j} }", {1}}, + + {true, "for (var j of x) { foo = j }", top}, + {true, "for (var j of x) { [foo] = [j] }", top}, + {true, "for (var j of x) { var foo = j }", top}, + {true, "for (var j of x) { var [foo] = [j] }", top}, + {false, "for (var j of x) { let foo = j }", {1}}, + {false, "for (var j of x) { let [foo] = [j] }", {1}}, + {false, "for (var j of x) { const foo = j }", {1}}, + {false, "for (var j of x) { const [foo] = [j] }", {1}}, + {false, "for (var j of x) { function foo() {return j} }", {1}}, + + {true, "for (var {j} of x) { foo = j }", top}, + {true, "for (var {j} of x) { [foo] = [j] }", top}, + {true, "for (var {j} of x) { var foo = j }", top}, + {true, "for (var {j} of x) { var [foo] = [j] }", top}, + {false, "for (var {j} of x) { let foo = j }", {1}}, + {false, "for (var {j} of x) { let [foo] = [j] }", {1}}, + {false, "for (var {j} of x) { const foo = j }", {1}}, + {false, "for (var {j} of x) { const [foo] = [j] }", {1}}, + {false, "for (var {j} of x) { function foo() {return j} }", {1}}, + + {true, "for (let j of x) { foo = j }", top}, + {true, "for (let j of x) { [foo] = [j] }", top}, + {true, "for (let j of x) { var foo = j }", top}, + {true, "for (let j of x) { var [foo] = [j] }", top}, + {false, "for (let j of x) { let foo = j }", {0, 1, 0}}, + {false, "for (let j of x) { let [foo] = [j] }", {0, 1, 0}}, + {false, "for (let j of x) { const foo = j }", {0, 1, 0}}, + {false, "for (let j of x) { const [foo] = [j] }", {0, 1, 0}}, + {false, "for (let j of x) { function foo() {return j} }", {0, 1, 0}}, + + {true, "for (let {j} of x) { foo = j }", top}, + {true, "for (let {j} of x) { [foo] = [j] }", top}, + {true, "for (let {j} of x) { var foo = j }", top}, + {true, "for (let {j} of x) { var [foo] = [j] }", top}, + {false, "for (let {j} of x) { let foo = j }", {0, 1, 0}}, + {false, "for (let {j} of x) { let [foo] = [j] }", {0, 1, 0}}, + {false, "for (let {j} of x) { const foo = j }", {0, 1, 0}}, + {false, "for (let {j} of x) { const [foo] = [j] }", {0, 1, 0}}, + {false, "for (let {j} of x) { function foo() {return j} }", {0, 1, 0}}, + + {true, "for (const j of x) { foo = j }", top}, + {true, "for (const j of x) { [foo] = [j] }", top}, + {true, "for (const j of x) { var foo = j }", top}, + {true, "for (const j of x) { var [foo] = [j] }", top}, + {false, "for (const j of x) { let foo = j }", {0, 1, 0}}, + {false, "for (const j of x) { let [foo] = [j] }", {0, 1, 0}}, + {false, "for (const j of x) { const foo = j }", {0, 1, 0}}, + {false, "for (const j of x) { const [foo] = [j] }", {0, 1, 0}}, + {false, "for (const j of x) { function foo() {return j} }", {0, 1, 0}}, + + {true, "for (const {j} of x) { foo = j }", top}, + {true, "for (const {j} of x) { [foo] = [j] }", top}, + {true, "for (const {j} of x) { var foo = j }", top}, + {true, "for (const {j} of x) { var [foo] = [j] }", top}, + {false, "for (const {j} of x) { let foo = j }", {0, 1, 0}}, + {false, "for (const {j} of x) { let [foo] = [j] }", {0, 1, 0}}, + {false, "for (const {j} of x) { const foo = j }", {0, 1, 0}}, + {false, "for (const {j} of x) { const [foo] = [j] }", {0, 1, 0}}, + {false, "for (const {j} of x) { function foo() {return j} }", {0, 1, 0}}, + + {true, "for (j in x) { foo = j }", top}, + {true, "for (j in x) { [foo] = [j] }", top}, + {true, "for (j in x) { var foo = j }", top}, + {true, "for (j in x) { var [foo] = [j] }", top}, + {false, "for (j in x) { let foo = j }", {0}}, + {false, "for (j in x) { let [foo] = [j] }", {0}}, + {false, "for (j in x) { const foo = j }", {0}}, + {false, "for (j in x) { const [foo] = [j] }", {0}}, + {false, "for (j in x) { function foo() {return j} }", {0}}, + + {true, "for ({j} in x) { foo = j }", top}, + {true, "for ({j} in x) { [foo] = [j] }", top}, + {true, "for ({j} in x) { var foo = j }", top}, + {true, "for ({j} in x) { var [foo] = [j] }", top}, + {false, "for ({j} in x) { let foo = j }", {0}}, + {false, "for ({j} in x) { let [foo] = [j] }", {0}}, + {false, "for ({j} in x) { const foo = j }", {0}}, + {false, "for ({j} in x) { const [foo] = [j] }", {0}}, + {false, "for ({j} in x) { function foo() {return j} }", {0}}, + + {true, "for (var j in x) { foo = j }", top}, + {true, "for (var j in x) { [foo] = [j] }", top}, + {true, "for (var j in x) { var foo = j }", top}, + {true, "for (var j in x) { var [foo] = [j] }", top}, + {false, "for (var j in x) { let foo = j }", {0}}, + {false, "for (var j in x) { let [foo] = [j] }", {0}}, + {false, "for (var j in x) { const foo = j }", {0}}, + {false, "for (var j in x) { const [foo] = [j] }", {0}}, + {false, "for (var j in x) { function foo() {return j} }", {0}}, + + {true, "for (var {j} in x) { foo = j }", top}, + {true, "for (var {j} in x) { [foo] = [j] }", top}, + {true, "for (var {j} in x) { var foo = j }", top}, + {true, "for (var {j} in x) { var [foo] = [j] }", top}, + {false, "for (var {j} in x) { let foo = j }", {0}}, + {false, "for (var {j} in x) { let [foo] = [j] }", {0}}, + {false, "for (var {j} in x) { const foo = j }", {0}}, + {false, "for (var {j} in x) { const [foo] = [j] }", {0}}, + {false, "for (var {j} in x) { function foo() {return j} }", {0}}, + + {true, "for (let j in x) { foo = j }", top}, + {true, "for (let j in x) { [foo] = [j] }", top}, + {true, "for (let j in x) { var foo = j }", top}, + {true, "for (let j in x) { var [foo] = [j] }", top}, + {false, "for (let j in x) { let foo = j }", {0, 0, 0}}, + {false, "for (let j in x) { let [foo] = [j] }", {0, 0, 0}}, + {false, "for (let j in x) { const foo = j }", {0, 0, 0}}, + {false, "for (let j in x) { const [foo] = [j] }", {0, 0, 0}}, + {false, "for (let j in x) { function foo() {return j} }", {0, 0, 0}}, + + {true, "for (let {j} in x) { foo = j }", top}, + {true, "for (let {j} in x) { [foo] = [j] }", top}, + {true, "for (let {j} in x) { var foo = j }", top}, + {true, "for (let {j} in x) { var [foo] = [j] }", top}, + {false, "for (let {j} in x) { let foo = j }", {0, 0, 0}}, + {false, "for (let {j} in x) { let [foo] = [j] }", {0, 0, 0}}, + {false, "for (let {j} in x) { const foo = j }", {0, 0, 0}}, + {false, "for (let {j} in x) { const [foo] = [j] }", {0, 0, 0}}, + {false, "for (let {j} in x) { function foo() {return j} }", {0, 0, 0}}, + + {true, "for (const j in x) { foo = j }", top}, + {true, "for (const j in x) { [foo] = [j] }", top}, + {true, "for (const j in x) { var foo = j }", top}, + {true, "for (const j in x) { var [foo] = [j] }", top}, + {false, "for (const j in x) { let foo = j }", {0, 0, 0}}, + {false, "for (const j in x) { let [foo] = [j] }", {0, 0, 0}}, + {false, "for (const j in x) { const foo = j }", {0, 0, 0}}, + {false, "for (const j in x) { const [foo] = [j] }", {0, 0, 0}}, + {false, "for (const j in x) { function foo() {return j} }", {0, 0, 0}}, + + {true, "for (const {j} in x) { foo = j }", top}, + {true, "for (const {j} in x) { [foo] = [j] }", top}, + {true, "for (const {j} in x) { var foo = j }", top}, + {true, "for (const {j} in x) { var [foo] = [j] }", top}, + {false, "for (const {j} in x) { let foo = j }", {0, 0, 0}}, + {false, "for (const {j} in x) { let [foo] = [j] }", {0, 0, 0}}, + {false, "for (const {j} in x) { const foo = j }", {0, 0, 0}}, + {false, "for (const {j} in x) { const [foo] = [j] }", {0, 0, 0}}, + {false, "for (const {j} in x) { function foo() {return j} }", {0, 0, 0}}, + + {true, "while (j) { foo = j }", top}, + {true, "while (j) { [foo] = [j] }", top}, + {true, "while (j) { var foo = j }", top}, + {true, "while (j) { var [foo] = [j] }", top}, + {false, "while (j) { let foo = j }", {0}}, + {false, "while (j) { let [foo] = [j] }", {0}}, + {false, "while (j) { const foo = j }", {0}}, + {false, "while (j) { const [foo] = [j] }", {0}}, + {false, "while (j) { function foo() {return j} }", {0}}, + + {true, "do { foo = j } while (j)", top}, + {true, "do { [foo] = [j] } while (j)", top}, + {true, "do { var foo = j } while (j)", top}, + {true, "do { var [foo] = [j] } while (j)", top}, + {false, "do { let foo = j } while (j)", {0}}, + {false, "do { let [foo] = [j] } while (j)", {0}}, + {false, "do { const foo = j } while (j)", {0}}, + {false, "do { const [foo] = [j] } while (j)", {0}}, + {false, "do { function foo() {return j} } while (j)", {0}}, }; Input script_only_tests[] = { - {1, "for (j=x; j<10; ++j) { function foo() {return j} }", top}, - {1, "for ({j}=x; j<10; ++j) { function foo() {return j} }", top}, - {1, "for (var j=x; j<10; ++j) { function foo() {return j} }", top}, - {1, "for (var {j}=x; j<10; ++j) { function foo() {return j} }", top}, - {1, "for (let j=x; j<10; ++j) { function foo() {return j} }", top}, - {1, "for (let {j}=x; j<10; ++j) { function foo() {return j} }", top}, - {1, "for (j of x) { function foo() {return j} }", top}, - {1, "for ({j} of x) { function foo() {return j} }", top}, - {1, "for (var j of x) { function foo() {return j} }", top}, - {1, "for (var {j} of x) { function foo() {return j} }", top}, - {1, "for (let j of x) { function foo() {return j} }", top}, - {1, "for (let {j} of x) { function foo() {return j} }", top}, - {1, "for (const j of x) { function foo() {return j} }", top}, - {1, "for (const {j} of x) { function foo() {return j} }", top}, - {1, "for (j in x) { function foo() {return j} }", top}, - {1, "for ({j} in x) { function foo() {return j} }", top}, - {1, "for (var j in x) { function foo() {return j} }", top}, - {1, "for (var {j} in x) { function foo() {return j} }", top}, - {1, "for (let j in x) { function foo() {return j} }", top}, - {1, "for (let {j} in x) { function foo() {return j} }", top}, - {1, "for (const j in x) { function foo() {return j} }", top}, - {1, "for (const {j} in x) { function foo() {return j} }", top}, - {1, "while (j) { function foo() {return j} }", top}, - {1, "do { function foo() {return j} } while (j)", top}, + {true, "for (j=x; j<10; ++j) { function foo() {return j} }", top}, + {true, "for ({j}=x; j<10; ++j) { function foo() {return j} }", top}, + {true, "for (var j=x; j<10; ++j) { function foo() {return j} }", top}, + {true, "for (var {j}=x; j<10; ++j) { function foo() {return j} }", top}, + {true, "for (let j=x; j<10; ++j) { function foo() {return j} }", top}, + {true, "for (let {j}=x; j<10; ++j) { function foo() {return j} }", top}, + {true, "for (j of x) { function foo() {return j} }", top}, + {true, "for ({j} of x) { function foo() {return j} }", top}, + {true, "for (var j of x) { function foo() {return j} }", top}, + {true, "for (var {j} of x) { function foo() {return j} }", top}, + {true, "for (let j of x) { function foo() {return j} }", top}, + {true, "for (let {j} of x) { function foo() {return j} }", top}, + {true, "for (const j of x) { function foo() {return j} }", top}, + {true, "for (const {j} of x) { function foo() {return j} }", top}, + {true, "for (j in x) { function foo() {return j} }", top}, + {true, "for ({j} in x) { function foo() {return j} }", top}, + {true, "for (var j in x) { function foo() {return j} }", top}, + {true, "for (var {j} in x) { function foo() {return j} }", top}, + {true, "for (let j in x) { function foo() {return j} }", top}, + {true, "for (let {j} in x) { function foo() {return j} }", top}, + {true, "for (const j in x) { function foo() {return j} }", top}, + {true, "for (const {j} in x) { function foo() {return j} }", top}, + {true, "while (j) { function foo() {return j} }", top}, + {true, "do { function foo() {return j} } while (j)", top}, }; for (unsigned i = 0; i < arraysize(module_and_script_tests); ++i) { diff --git a/deps/v8/test/cctest/test-platform.cc b/deps/v8/test/cctest/test-platform.cc index e7ad2d84f1..e4ab19f05f 100644 --- a/deps/v8/test/cctest/test-platform.cc +++ b/deps/v8/test/cctest/test-platform.cc @@ -29,7 +29,7 @@ void GetStackPointer(const v8::FunctionCallbackInfo<v8::Value>& args) { #elif V8_HOST_ARCH_MIPS64 __asm__ __volatile__("sd $sp, %0" : "=g"(sp_addr)); #elif defined(__s390x__) || defined(_ARCH_S390X) - __asm__ __volatile__("stg 15, %0" : "=m"(sp_addr)); + __asm__ __volatile__("stg %%r15, %0" : "=m"(sp_addr)); #elif defined(__s390__) || defined(_ARCH_S390) __asm__ __volatile__("st 15, %0" : "=m"(sp_addr)); #elif defined(__PPC64__) || defined(_ARCH_PPC64) diff --git a/deps/v8/test/cctest/test-poison-disasm-arm.cc b/deps/v8/test/cctest/test-poison-disasm-arm.cc new file mode 100644 index 0000000000..7a3238eea1 --- /dev/null +++ b/deps/v8/test/cctest/test-poison-disasm-arm.cc @@ -0,0 +1,123 @@ +// Copyright 2018 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 C++ style guide recommends using <re2> instead of <regex>. However, the +// former isn't available in V8. +#include <regex> // NOLINT(build/c++11) + +#include "src/api-inl.h" +#include "src/disassembler.h" +#include "src/objects-inl.h" +#include "test/cctest/cctest.h" + +namespace v8 { +namespace internal { + +std::string DisassembleFunction(const char* function) { + v8::Local<v8::Context> context = CcTest::isolate()->GetCurrentContext(); + Handle<JSFunction> f = Handle<JSFunction>::cast( + v8::Utils::OpenHandle(*v8::Local<v8::Function>::Cast( + CcTest::global()->Get(context, v8_str(function)).ToLocalChecked()))); + + Address begin = f->code()->raw_instruction_start(); + Address end = f->code()->raw_instruction_end(); + Isolate* isolate = CcTest::i_isolate(); + std::ostringstream os; + Disassembler::Decode(isolate, &os, reinterpret_cast<byte*>(begin), + reinterpret_cast<byte*>(end), + CodeReference(handle(f->code(), isolate))); + return os.str(); +} + +TEST(DisasmPoisonMonomorphicLoad) { +#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; };" + "mono({ x : 1 });" + "mono({ x : 1 });" + "%OptimizeFunctionOnNextCall(mono);" + "mono({ x : 1 });"); + + std::string start("0x[0-9a-f]+ +[0-9a-f]+ +[0-9a-f]+ +"); + std::regex map_load_re(start + "ldr r([0-9]+), \\[r([0-9]+), #-1\\]"); + std::regex load_const_re(start + "ldr r([0-9]+), \\[pc, .*"); + std::regex cmp_re(start + "cmp r([0-9]+), r([0-9]+)"); + std::regex bne_re(start + "bne(.*)"); + std::regex eorne_re(start + "eorne r([0-9]+), r([0-9]+), r([0-9]+)"); + std::regex csdb_re(start + "csdb"); + std::regex load_field_re(start + + "ldr r([0-9]+), \\[r([0-9]+), #\\+[0-9]+\\]"); + std::regex mask_re(start + "and r([0-9]+), r([0-9]+), r([0-9]+)"); + + std::string poison_reg = "9"; + + std::smatch match; + std::string line; + std::istringstream reader(DisassembleFunction("mono")); + bool poisoning_sequence_found = false; + while (std::getline(reader, line)) { + if (std::regex_match(line, match, map_load_re)) { + std::string map_reg = match[1]; + std::string object_reg = match[2]; + // Matches that the property access sequence is instrumented with + // poisoning. We match the following sequence: + // + // ldr r1, [r0, #-1] ; load map + // ldr r2, [pc, #+104] ; load expected map constant + // cmp r1, r2 ; compare maps + // bne ... ; deopt if different + // eorne r9, r9, r9 ; update the poison + // csdb ; speculation barrier + // ldr r0, [r0, #+11] ; load the field + // and r0, r0, r9 ; apply the poison + + CHECK(std::getline(reader, line)); + CHECK(std::regex_match(line, match, load_const_re)); + + CHECK(std::getline(reader, line)); + CHECK(std::regex_match(line, match, cmp_re)); + CHECK_EQ(match[1], map_reg); + + CHECK(std::getline(reader, line)); + CHECK(std::regex_match(line, match, bne_re)); + + CHECK(std::getline(reader, line)); + CHECK(std::regex_match(line, match, eorne_re)); + CHECK_EQ(match[1], poison_reg); + CHECK_EQ(match[2], poison_reg); + CHECK_EQ(match[3], poison_reg); + + CHECK(std::getline(reader, line)); + CHECK(std::regex_match(line, match, csdb_re)); + + CHECK(std::getline(reader, line)); + CHECK(std::regex_match(line, match, load_field_re)); + CHECK_EQ(match[2], object_reg); + std::string field_reg = match[1]; + + CHECK(std::getline(reader, line)); + CHECK(std::regex_match(line, match, mask_re)); + CHECK_EQ(match[1], field_reg); + CHECK_EQ(match[2], field_reg); + CHECK_EQ(match[3], poison_reg); + + poisoning_sequence_found = true; + break; + } + } + + CHECK(poisoning_sequence_found); +#endif // ENABLE_DISASSEMBLER +} + +} // namespace internal +} // namespace v8 diff --git a/deps/v8/test/cctest/test-regexp.cc b/deps/v8/test/cctest/test-regexp.cc index c65714a930..301aaf2968 100644 --- a/deps/v8/test/cctest/test-regexp.cc +++ b/deps/v8/test/cctest/test-regexp.cc @@ -1968,7 +1968,7 @@ class UncachedExternalString public: const char* data() const override { return "abcdefghijklmnopqrstuvwxyz"; } size_t length() const override { return 26; } - bool IsCompressible() const override { return true; } + bool IsCacheable() const override { return false; } }; TEST(UncachedExternalString) { @@ -1978,9 +1978,9 @@ TEST(UncachedExternalString) { v8::Local<v8::String> external = v8::String::NewExternalOneByte(isolate, new UncachedExternalString()) .ToLocalChecked(); - CHECK( - v8::Utils::OpenHandle(*external)->map() == - ReadOnlyRoots(CcTest::i_isolate()).short_external_one_byte_string_map()); + CHECK(v8::Utils::OpenHandle(*external)->map() == + ReadOnlyRoots(CcTest::i_isolate()) + .uncached_external_one_byte_string_map()); v8::Local<v8::Object> global = env->Global(); global->Set(env.local(), v8_str("external"), external).FromJust(); CompileRun("var re = /y(.)/; re.test('ab');"); diff --git a/deps/v8/test/cctest/test-roots.cc b/deps/v8/test/cctest/test-roots.cc index f99b9df399..7dcbe998cd 100644 --- a/deps/v8/test/cctest/test-roots.cc +++ b/deps/v8/test/cctest/test-roots.cc @@ -18,57 +18,16 @@ AllocationSpace GetSpaceFromObject(Object* object) { } } // namespace -#define CHECK_IN_RO_SPACE(name) \ - HeapObject* name = roots.name(); \ +#define CHECK_IN_RO_SPACE(type, name, CamelName) \ + HeapObject* name = roots.name(); \ CHECK_EQ(RO_SPACE, GetSpaceFromObject(name)); // The following tests check that all the roots accessible via ReadOnlyRoots are // in RO_SPACE. -TEST(TestStrongReadOnlyRoots) { +TEST(TestReadOnlyRoots) { ReadOnlyRoots roots(CcTest::i_isolate()); -#define TEST_ROOT(type, name, camel_name) CHECK_IN_RO_SPACE(name) - STRONG_READ_ONLY_ROOT_LIST(TEST_ROOT) -#undef TEST_ROOT -} - -TEST(TestInternalizedStrings) { - ReadOnlyRoots roots(CcTest::i_isolate()); - -#define TEST_ROOT(name, str) CHECK_IN_RO_SPACE(name) - INTERNALIZED_STRING_LIST(TEST_ROOT) -#undef TEST_ROOT -} - -TEST(TestPrivateSymbols) { - ReadOnlyRoots roots(CcTest::i_isolate()); - - PRIVATE_SYMBOL_LIST(CHECK_IN_RO_SPACE) -} - -TEST(TestPublicSymbols) { - ReadOnlyRoots roots(CcTest::i_isolate()); - -#define TEST_ROOT(name, description) CHECK_IN_RO_SPACE(name) - PUBLIC_SYMBOL_LIST(TEST_ROOT) - WELL_KNOWN_SYMBOL_LIST(TEST_ROOT) -#undef TEST_ROOT -} - -TEST(TestStructMaps) { - ReadOnlyRoots roots(CcTest::i_isolate()); - -#define TEST_ROOT(NAME, Name, name) CHECK_IN_RO_SPACE(name##_map) - STRUCT_LIST(TEST_ROOT) -#undef TEST_ROOT -} - -TEST(TestAllocationSiteMaps) { - ReadOnlyRoots roots(CcTest::i_isolate()); - -#define TEST_ROOT(NAME, Name, Size, name) CHECK_IN_RO_SPACE(name##_map) - ALLOCATION_SITE_LIST(TEST_ROOT) -#undef TEST_ROOT + READ_ONLY_ROOT_LIST(CHECK_IN_RO_SPACE) } #undef CHECK_IN_RO_SPACE @@ -82,7 +41,6 @@ bool IsInitiallyMutable(Factory* factory, Address object_address) { V(detached_contexts) \ V(feedback_vectors_for_profiling_tools) \ V(materialized_objects) \ - V(microtask_queue) \ V(noscript_shared_function_infos) \ V(retained_maps) \ V(retaining_path_targets) \ @@ -101,7 +59,7 @@ bool IsInitiallyMutable(Factory* factory, Address object_address) { // The CHECK_EQ line is there just to ensure that the root is publicly // accessible from Heap, but ultimately the factory is used as it provides // handles that have the address in the root table. -#define CHECK_NOT_IN_RO_SPACE(name) \ +#define CHECK_NOT_IN_RO_SPACE(type, name, CamelName) \ Handle<Object> name = factory->name(); \ CHECK_EQ(*name, heap->name()); \ if (name->IsHeapObject() && IsInitiallyMutable(factory, name.address())) \ @@ -115,18 +73,7 @@ TEST(TestHeapRootsNotReadOnly) { Factory* factory = CcTest::i_isolate()->factory(); Heap* heap = CcTest::i_isolate()->heap(); -#define TEST_ROOT(type, name, camel_name) CHECK_NOT_IN_RO_SPACE(name) - MUTABLE_ROOT_LIST(TEST_ROOT) -#undef TEST_ROOT -} - -TEST(TestAccessorInfosNotReadOnly) { - Factory* factory = CcTest::i_isolate()->factory(); - Heap* heap = CcTest::i_isolate()->heap(); - -#define TEST_ROOT(name, AccessorName) CHECK_NOT_IN_RO_SPACE(name##_accessor) - ACCESSOR_INFO_LIST(TEST_ROOT) -#undef TEST_ROOT + MUTABLE_ROOT_LIST(CHECK_NOT_IN_RO_SPACE) } #undef CHECK_NOT_IN_RO_SPACE diff --git a/deps/v8/test/cctest/test-sampler-api.cc b/deps/v8/test/cctest/test-sampler-api.cc index a73c9765df..eec773e0de 100644 --- a/deps/v8/test/cctest/test-sampler-api.cc +++ b/deps/v8/test/cctest/test-sampler-api.cc @@ -17,7 +17,7 @@ class Sample { public: enum { kFramesLimit = 255 }; - Sample() {} + Sample() = default; typedef const void* const* const_iterator; const_iterator begin() const { return data_.start(); } diff --git a/deps/v8/test/cctest/test-serialize.cc b/deps/v8/test/cctest/test-serialize.cc index d3fd665a66..848678d43f 100644 --- a/deps/v8/test/cctest/test-serialize.cc +++ b/deps/v8/test/cctest/test-serialize.cc @@ -785,6 +785,17 @@ TEST(CustomSnapshotDataBlob1) { delete[] data1.data; // We can dispose of the snapshot blob now. } +TEST(SnapshotChecksum) { + DisableAlwaysOpt(); + const char* source1 = "function f() { return 42; }"; + + v8::StartupData data1 = CreateSnapshotDataBlob(source1); + CHECK(i::Snapshot::VerifyChecksum(&data1)); + const_cast<char*>(data1.data)[142] = data1.data[142] ^ 4; // Flip a bit. + CHECK(!i::Snapshot::VerifyChecksum(&data1)); + delete[] data1.data; // We can dispose of the snapshot blob now. +} + struct InternalFieldData { uint32_t data; }; @@ -1301,7 +1312,7 @@ TEST(CustomSnapshotDataBlobWithWarmup) { CHECK(IsCompiled("Math.abs")); CHECK(!IsCompiled("g")); CHECK(IsCompiled("String.raw")); - CHECK(!IsCompiled("Array.prototype.lastIndexOf")); + CHECK(IsCompiled("Array.prototype.lastIndexOf")); CHECK_EQ(5, CompileRun("a")->Int32Value(context).FromJust()); } isolate->Dispose(); @@ -1821,9 +1832,9 @@ class SerializerOneByteResource public: SerializerOneByteResource(const char* data, size_t length) : data_(data), length_(length), dispose_count_(0) {} - virtual const char* data() const { return data_; } - virtual size_t length() const { return length_; } - virtual void Dispose() { dispose_count_++; } + const char* data() const override { return data_; } + size_t length() const override { return length_; } + void Dispose() override { dispose_count_++; } int dispose_count() { return dispose_count_; } private: @@ -1837,11 +1848,11 @@ class SerializerTwoByteResource : public v8::String::ExternalStringResource { public: SerializerTwoByteResource(const char* data, size_t length) : data_(AsciiToTwoByteString(data)), length_(length), dispose_count_(0) {} - ~SerializerTwoByteResource() { DeleteArray<const uint16_t>(data_); } + ~SerializerTwoByteResource() override { DeleteArray<const uint16_t>(data_); } - virtual const uint16_t* data() const { return data_; } - virtual size_t length() const { return length_; } - virtual void Dispose() { dispose_count_++; } + const uint16_t* data() const override { return data_; } + size_t length() const override { return length_; } + void Dispose() override { dispose_count_++; } int dispose_count() { return dispose_count_; } private: @@ -3582,11 +3593,10 @@ void CheckSFIsAreWeak(WeakFixedArray* sfis, Isolate* isolate) { for (int i = 0; i < sfis->length(); ++i) { MaybeObject* maybe_object = sfis->Get(i); HeapObject* heap_object; - CHECK(maybe_object->IsWeakHeapObject() || - maybe_object->IsClearedWeakHeapObject() || - (maybe_object->ToStrongHeapObject(&heap_object) && + CHECK(maybe_object->IsWeakOrCleared() || + (maybe_object->GetHeapObjectIfStrong(&heap_object) && heap_object->IsUndefined(isolate))); - if (maybe_object->IsWeakHeapObject()) { + if (maybe_object->IsWeak()) { ++no_of_weak; } } diff --git a/deps/v8/test/cctest/test-smi-lexicographic-compare.cc b/deps/v8/test/cctest/test-smi-lexicographic-compare.cc new file mode 100644 index 0000000000..58617fd5c2 --- /dev/null +++ b/deps/v8/test/cctest/test-smi-lexicographic-compare.cc @@ -0,0 +1,79 @@ +// Copyright 2018 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 <set> + +#include "src/objects-inl.h" +#include "src/v8.h" +#include "test/cctest/cctest.h" + +namespace v8 { +namespace internal { + +namespace { + +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))); +} + +// Uses std::lexicographical_compare twice to convert the result to -1, 0 or 1. +int ExpectedCompareResult(Smi* a, Smi* b) { + std::string str_a = std::to_string(a->value()); + std::string str_b = std::to_string(b->value()); + bool expected_a_lt_b = std::lexicographical_compare( + str_a.begin(), str_a.end(), str_b.begin(), str_b.end()); + bool expected_b_lt_a = std::lexicographical_compare( + str_b.begin(), str_b.end(), str_a.begin(), str_a.end()); + + if (!expected_a_lt_b && !expected_b_lt_a) { + return 0; + } else if (expected_a_lt_b) { + return -1; + } else { + CHECK(expected_b_lt_a); + return 1; + } +} + +bool Test(Isolate* isolate, Smi* a, Smi* b) { + int actual = Smi::LexicographicCompare(isolate, a, b)->value(); + int expected = ExpectedCompareResult(a, b); + + return actual == expected; +} + +} // namespace + +TEST(TestSmiLexicographicCompare) { + Isolate* isolate = CcTest::InitIsolateOnce(); + HandleScope scope(isolate); + + std::set<Smi*> smis; + + 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); + } + } + } + + for (int64_t yb = 1; yb <= Smi::kMaxValue; yb *= 2) { + for (int64_t yo = -2; yo <= 2; ++yo) { + AddSigned(smis, yb + yo); + } + } + + for (Smi* a : smis) { + for (Smi* b : smis) { + CHECK(Test(isolate, a, b)); + } + } +} + +} // namespace internal +} // namespace v8 diff --git a/deps/v8/test/cctest/test-strings.cc b/deps/v8/test/cctest/test-strings.cc index 2c66421831..9326c347ec 100644 --- a/deps/v8/test/cctest/test-strings.cc +++ b/deps/v8/test/cctest/test-strings.cc @@ -105,9 +105,9 @@ static const int SUPER_DEEP_DEPTH = 80 * 1024; class Resource: public v8::String::ExternalStringResource { public: Resource(const uc16* data, size_t length): data_(data), length_(length) {} - ~Resource() { i::DeleteArray(data_); } - virtual const uint16_t* data() const { return data_; } - virtual size_t length() const { return length_; } + ~Resource() override { i::DeleteArray(data_); } + const uint16_t* data() const override { return data_; } + size_t length() const override { return length_; } private: const uc16* data_; @@ -119,9 +119,9 @@ class OneByteResource : public v8::String::ExternalOneByteStringResource { public: OneByteResource(const char* data, size_t length) : data_(data), length_(length) {} - ~OneByteResource() { i::DeleteArray(data_); } - virtual const char* data() const { return data_; } - virtual size_t length() const { return length_; } + ~OneByteResource() override { i::DeleteArray(data_); } + const char* data() const override { return data_; } + size_t length() const override { return length_; } private: const char* data_; @@ -1108,6 +1108,98 @@ TEST(JSONStringifySliceMadeExternal) { CompileRun("JSON.stringify(slice)")))); } +TEST(JSONStringifyWellFormed) { + FLAG_harmony_json_stringify = true; + CcTest::InitializeVM(); + v8::HandleScope handle_scope(CcTest::isolate()); + v8::Local<v8::Context> context = CcTest::isolate()->GetCurrentContext(); + + // Test some leading surrogates (U+D800 to U+DBFF). + { // U+D800 + CHECK_EQ( + 0, strcmp("\"\\ud800\"", *v8::String::Utf8Value( + CcTest::isolate(), + CompileRun("JSON.stringify('\\uD800')")))); + v8::Local<v8::String> json = v8_str("\"\\ud800\""); + v8::Local<v8::Value> parsed = + v8::JSON::Parse(context, json).ToLocalChecked(); + CHECK(v8::JSON::Stringify(context, parsed) + .ToLocalChecked() + ->Equals(context, json) + .FromJust()); + } + + { // U+DAAA + CHECK_EQ( + 0, strcmp("\"\\udaaa\"", *v8::String::Utf8Value( + CcTest::isolate(), + CompileRun("JSON.stringify('\\uDAAA')")))); + v8::Local<v8::String> json = v8_str("\"\\udaaa\""); + v8::Local<v8::Value> parsed = + v8::JSON::Parse(context, json).ToLocalChecked(); + CHECK(v8::JSON::Stringify(context, parsed) + .ToLocalChecked() + ->Equals(context, json) + .FromJust()); + } + + { // U+DBFF + CHECK_EQ( + 0, strcmp("\"\\udbff\"", *v8::String::Utf8Value( + CcTest::isolate(), + CompileRun("JSON.stringify('\\uDBFF')")))); + v8::Local<v8::String> json = v8_str("\"\\udbff\""); + v8::Local<v8::Value> parsed = + v8::JSON::Parse(context, json).ToLocalChecked(); + CHECK(v8::JSON::Stringify(context, parsed) + .ToLocalChecked() + ->Equals(context, json) + .FromJust()); + } + + // Test some trailing surrogates (U+DC00 to U+DFFF). + { // U+DC00 + CHECK_EQ( + 0, strcmp("\"\\udc00\"", *v8::String::Utf8Value( + CcTest::isolate(), + CompileRun("JSON.stringify('\\uDC00')")))); + v8::Local<v8::String> json = v8_str("\"\\udc00\""); + v8::Local<v8::Value> parsed = + v8::JSON::Parse(context, json).ToLocalChecked(); + CHECK(v8::JSON::Stringify(context, parsed) + .ToLocalChecked() + ->Equals(context, json) + .FromJust()); + } + + { // U+DDDD + CHECK_EQ( + 0, strcmp("\"\\udddd\"", *v8::String::Utf8Value( + CcTest::isolate(), + CompileRun("JSON.stringify('\\uDDDD')")))); + v8::Local<v8::String> json = v8_str("\"\\udddd\""); + v8::Local<v8::Value> parsed = + v8::JSON::Parse(context, json).ToLocalChecked(); + CHECK(v8::JSON::Stringify(context, parsed) + .ToLocalChecked() + ->Equals(context, json) + .FromJust()); + } + + { // U+DFFF + CHECK_EQ( + 0, strcmp("\"\\udfff\"", *v8::String::Utf8Value( + CcTest::isolate(), + CompileRun("JSON.stringify('\\uDFFF')")))); + v8::Local<v8::String> json = v8_str("\"\\udfff\""); + v8::Local<v8::Value> parsed = + v8::JSON::Parse(context, json).ToLocalChecked(); + CHECK(v8::JSON::Stringify(context, parsed) + .ToLocalChecked() + ->Equals(context, json) + .FromJust()); + } +} TEST(CachedHashOverflow) { CcTest::InitializeVM(); @@ -1186,9 +1278,9 @@ class OneByteVectorResource : public v8::String::ExternalOneByteStringResource { public: explicit OneByteVectorResource(i::Vector<const char> vector) : data_(vector) {} - virtual ~OneByteVectorResource() {} - virtual size_t length() const { return data_.length(); } - virtual const char* data() const { return data_.start(); } + ~OneByteVectorResource() override = default; + size_t length() const override { return data_.length(); } + const char* data() const override { return data_.start(); } private: i::Vector<const char> data_; }; @@ -1464,15 +1556,15 @@ TEST(Latin1IgnoreCase) { class DummyResource: public v8::String::ExternalStringResource { public: - virtual const uint16_t* data() const { return nullptr; } - virtual size_t length() const { return 1 << 30; } + const uint16_t* data() const override { return nullptr; } + size_t length() const override { return 1 << 30; } }; class DummyOneByteResource: public v8::String::ExternalOneByteStringResource { public: - virtual const char* data() const { return nullptr; } - virtual size_t length() const { return 1 << 30; } + const char* data() const override { return nullptr; } + size_t length() const override { return 1 << 30; } }; diff --git a/deps/v8/test/cctest/test-thread-termination.cc b/deps/v8/test/cctest/test-thread-termination.cc index 902295447b..16a18c51d0 100644 --- a/deps/v8/test/cctest/test-thread-termination.cc +++ b/deps/v8/test/cctest/test-thread-termination.cc @@ -166,7 +166,7 @@ class TerminatorThread : public v8::base::Thread { explicit TerminatorThread(i::Isolate* isolate) : Thread(Options("TerminatorThread")), isolate_(reinterpret_cast<v8::Isolate*>(isolate)) {} - void Run() { + void Run() override { semaphore->Wait(); CHECK(!isolate_->IsExecutionTerminating()); isolate_->TerminateExecution(); @@ -800,7 +800,7 @@ class TerminatorSleeperThread : public v8::base::Thread { : Thread(Options("TerminatorSlepperThread")), isolate_(isolate), sleep_ms_(sleep_ms) {} - void Run() { + void Run() override { v8::base::OS::Sleep(v8::base::TimeDelta::FromMilliseconds(sleep_ms_)); CHECK(!isolate_->IsExecutionTerminating()); isolate_->TerminateExecution(); diff --git a/deps/v8/test/cctest/test-threads.cc b/deps/v8/test/cctest/test-threads.cc index d5c94eff0d..aaecababd2 100644 --- a/deps/v8/test/cctest/test-threads.cc +++ b/deps/v8/test/cctest/test-threads.cc @@ -43,7 +43,7 @@ class ThreadIdValidationThread : public v8::base::Thread { thread_to_start_(thread_to_start), semaphore_(semaphore) {} - void Run() { + void Run() override { i::ThreadId thread_id = i::ThreadId::Current(); for (int i = 0; i < thread_no_; i++) { CHECK(!(*refs_)[i].Equals(thread_id)); diff --git a/deps/v8/test/cctest/test-trace-event.cc b/deps/v8/test/cctest/test-trace-event.cc index 10b837aaed..f73641d9cf 100644 --- a/deps/v8/test/cctest/test-trace-event.cc +++ b/deps/v8/test/cctest/test-trace-event.cc @@ -39,7 +39,7 @@ typedef std::vector<MockTraceObject*> MockTraceObjectList; class MockTracingController : public v8::TracingController { public: MockTracingController() = default; - ~MockTracingController() { + ~MockTracingController() override { for (size_t i = 0; i < trace_object_list_.size(); ++i) { delete trace_object_list_[i]; } @@ -98,7 +98,7 @@ class MockTracingPlatform : public TestPlatform { // Now that it's completely constructed, make this the current platform. i::V8::SetPlatformForTesting(this); } - virtual ~MockTracingPlatform() {} + ~MockTracingPlatform() override = default; v8::TracingController* GetTracingController() override { return &tracing_controller_; @@ -289,7 +289,6 @@ TEST(BuiltinsIsTraceCategoryEnabled) { v8::Isolate* isolate = CcTest::isolate(); v8::HandleScope handle_scope(isolate); - v8::Local<v8::Context> context = isolate->GetCurrentContext(); LocalContext env; v8::Local<v8::Object> binding = env->GetExtrasBindingObject(); @@ -308,7 +307,7 @@ TEST(BuiltinsIsTraceCategoryEnabled) { .ToLocalChecked() .As<v8::Boolean>(); - CHECK(result->BooleanValue(context).ToChecked()); + CHECK(result->BooleanValue(isolate)); } { @@ -318,7 +317,7 @@ TEST(BuiltinsIsTraceCategoryEnabled) { .ToLocalChecked() .As<v8::Boolean>(); - CHECK(!result->BooleanValue(context).ToChecked()); + CHECK(!result->BooleanValue(isolate)); } { @@ -328,7 +327,7 @@ TEST(BuiltinsIsTraceCategoryEnabled) { .ToLocalChecked() .As<v8::Boolean>(); - CHECK(result->BooleanValue(context).ToChecked()); + CHECK(result->BooleanValue(isolate)); } } @@ -362,7 +361,7 @@ TEST(BuiltinsTrace) { .ToLocalChecked() .As<v8::Boolean>(); - CHECK(!result->BooleanValue(context).ToChecked()); + CHECK(!result->BooleanValue(isolate)); CHECK_EQ(0, GET_TRACE_OBJECTS_LIST->size()); } @@ -381,7 +380,7 @@ TEST(BuiltinsTrace) { .ToLocalChecked() .As<v8::Boolean>(); - CHECK(result->BooleanValue(context).ToChecked()); + CHECK(result->BooleanValue(isolate)); CHECK_EQ(1, GET_TRACE_OBJECTS_LIST->size()); CHECK_EQ(123, GET_TRACE_OBJECT(0)->id); @@ -405,7 +404,7 @@ TEST(BuiltinsTrace) { .ToLocalChecked() .As<v8::Boolean>(); - CHECK(result->BooleanValue(context).ToChecked()); + CHECK(result->BooleanValue(isolate)); CHECK_EQ(2, GET_TRACE_OBJECTS_LIST->size()); CHECK_EQ(123, GET_TRACE_OBJECT(1)->id); diff --git a/deps/v8/test/cctest/test-typedarrays.cc b/deps/v8/test/cctest/test-typedarrays.cc index b574fdd94a..a0f9385bf1 100644 --- a/deps/v8/test/cctest/test-typedarrays.cc +++ b/deps/v8/test/cctest/test-typedarrays.cc @@ -86,8 +86,6 @@ TEST(AllocateNotExternal) { void TestSpeciesProtector(char* code, bool invalidates_species_protector = true) { - // Make BigInt64Array/BigUint64Array available for testing. - FLAG_harmony_bigint = true; v8::Isolate::CreateParams create_params; create_params.array_buffer_allocator = CcTest::array_buffer_allocator(); std::string typed_array_constructors[] = { diff --git a/deps/v8/test/cctest/test-usecounters.cc b/deps/v8/test/cctest/test-usecounters.cc index 5e37991252..4c6c72a28d 100644 --- a/deps/v8/test/cctest/test-usecounters.cc +++ b/deps/v8/test/cctest/test-usecounters.cc @@ -60,6 +60,27 @@ TEST(AssigmentExpressionLHSIsCall) { use_counts[v8::Isolate::kAssigmentExpressionLHSIsCallInStrict] = 0; } +TEST(AtomicsWakeAndAtomicsNotify) { + v8::Isolate* isolate = CcTest::isolate(); + v8::HandleScope scope(isolate); + LocalContext env; + int use_counts[v8::Isolate::kUseCounterFeatureCount] = {}; + global_use_counts = use_counts; + i::FLAG_harmony_sharedarraybuffer = true; + CcTest::isolate()->SetUseCounterCallback(MockUseCounterCallback); + + CompileRun("Atomics.wake(new Int32Array(new SharedArrayBuffer(16)), 0);"); + CHECK_EQ(1, use_counts[v8::Isolate::kAtomicsWake]); + CHECK_EQ(0, use_counts[v8::Isolate::kAtomicsNotify]); + + use_counts[v8::Isolate::kAtomicsWake] = 0; + use_counts[v8::Isolate::kAtomicsNotify] = 0; + + CompileRun("Atomics.notify(new Int32Array(new SharedArrayBuffer(16)), 0);"); + CHECK_EQ(0, use_counts[v8::Isolate::kAtomicsWake]); + CHECK_EQ(1, use_counts[v8::Isolate::kAtomicsNotify]); +} + } // namespace test_usecounters } // namespace internal } // namespace v8 diff --git a/deps/v8/test/cctest/test-weakmaps.cc b/deps/v8/test/cctest/test-weakmaps.cc index 08d7bea874..b6fe4e7597 100644 --- a/deps/v8/test/cctest/test-weakmaps.cc +++ b/deps/v8/test/cctest/test-weakmaps.cc @@ -88,7 +88,7 @@ TEST(Weakness) { CHECK_EQ(2, EphemeronHashTable::cast(weakmap->table())->NumberOfElements()); // Force a full GC. - CcTest::CollectAllGarbage(Heap::kAbortIncrementalMarkingMask); + CcTest::PreciseCollectAllGarbage(); CHECK_EQ(0, NumberOfWeakCalls); CHECK_EQ(2, EphemeronHashTable::cast(weakmap->table())->NumberOfElements()); CHECK_EQ( @@ -101,7 +101,7 @@ TEST(Weakness) { &WeakPointerCallback, v8::WeakCallbackType::kParameter); CHECK(global_handles->IsWeak(key.location())); - CcTest::CollectAllGarbage(Heap::kAbortIncrementalMarkingMask); + CcTest::PreciseCollectAllGarbage(); CHECK_EQ(1, NumberOfWeakCalls); CHECK_EQ(0, EphemeronHashTable::cast(weakmap->table())->NumberOfElements()); CHECK_EQ( @@ -138,7 +138,7 @@ TEST(Shrinking) { CHECK_EQ(32, EphemeronHashTable::cast(weakmap->table())->NumberOfElements()); CHECK_EQ( 0, EphemeronHashTable::cast(weakmap->table())->NumberOfDeletedElements()); - CcTest::CollectAllGarbage(Heap::kAbortIncrementalMarkingMask); + CcTest::PreciseCollectAllGarbage(); CHECK_EQ(0, EphemeronHashTable::cast(weakmap->table())->NumberOfElements()); CHECK_EQ( 32, diff --git a/deps/v8/test/cctest/test-weaksets.cc b/deps/v8/test/cctest/test-weaksets.cc index 8a3c1323a3..763a809f87 100644 --- a/deps/v8/test/cctest/test-weaksets.cc +++ b/deps/v8/test/cctest/test-weaksets.cc @@ -99,7 +99,7 @@ TEST(WeakSet_Weakness) { CHECK_EQ(1, EphemeronHashTable::cast(weakset->table())->NumberOfElements()); // Force a full GC. - CcTest::CollectAllGarbage(Heap::kAbortIncrementalMarkingMask); + CcTest::PreciseCollectAllGarbage(); CHECK_EQ(0, NumberOfWeakCalls); CHECK_EQ(1, EphemeronHashTable::cast(weakset->table())->NumberOfElements()); CHECK_EQ( @@ -112,7 +112,7 @@ TEST(WeakSet_Weakness) { &WeakPointerCallback, v8::WeakCallbackType::kParameter); CHECK(global_handles->IsWeak(key.location())); - CcTest::CollectAllGarbage(Heap::kAbortIncrementalMarkingMask); + CcTest::PreciseCollectAllGarbage(); CHECK_EQ(1, NumberOfWeakCalls); CHECK_EQ(0, EphemeronHashTable::cast(weakset->table())->NumberOfElements()); CHECK_EQ( @@ -149,7 +149,7 @@ TEST(WeakSet_Shrinking) { CHECK_EQ(32, EphemeronHashTable::cast(weakset->table())->NumberOfElements()); CHECK_EQ( 0, EphemeronHashTable::cast(weakset->table())->NumberOfDeletedElements()); - CcTest::CollectAllGarbage(Heap::kAbortIncrementalMarkingMask); + CcTest::PreciseCollectAllGarbage(); CHECK_EQ(0, EphemeronHashTable::cast(weakset->table())->NumberOfElements()); CHECK_EQ( 32, diff --git a/deps/v8/test/cctest/testcfg.py b/deps/v8/test/cctest/testcfg.py index d79d6e4eb4..562f44098a 100644 --- a/deps/v8/test/cctest/testcfg.py +++ b/deps/v8/test/cctest/testcfg.py @@ -66,6 +66,18 @@ class TestCase(testcase.TestCase): def _get_files_params(self): return [self.path] + def _get_resources(self): + # Bytecode-generator tests are the only ones requiring extra files on + # Android. + parts = self.name.split('/') + if parts[0] == 'test-bytecode-generator': + expectation_file = os.path.join( + self.suite.root, 'interpreter', 'bytecode_expectations', + '%s.golden' % parts[1]) + if os.path.exists(expectation_file): + return [expectation_file] + return [] + def GetSuite(*args, **kwargs): return TestSuite(*args, **kwargs) diff --git a/deps/v8/test/cctest/torque/test-torque.cc b/deps/v8/test/cctest/torque/test-torque.cc index 439fe043b8..c339aa4134 100644 --- a/deps/v8/test/cctest/torque/test-torque.cc +++ b/deps/v8/test/cctest/torque/test-torque.cc @@ -259,6 +259,33 @@ TEST(TestGenericOverload) { ft.Call(); } +TEST(TestLogicalOperators) { + Isolate* isolate(CcTest::InitIsolateOnce()); + CodeAssemblerTester asm_tester(isolate, 0); + TestBuiltinsFromDSLAssembler m(asm_tester.state()); + { + m.TestLogicalOperators(); + m.Return(m.UndefinedConstant()); + } + FunctionTester ft(asm_tester.GenerateCode(), 0); + ft.Call(); +} + +TEST(TestOtherwiseAndLabels) { + Isolate* isolate(CcTest::InitIsolateOnce()); + CodeAssemblerTester asm_tester(isolate, 0); + TestBuiltinsFromDSLAssembler m(asm_tester.state()); + { + m.TestOtherwiseWithCode1(); + m.TestOtherwiseWithCode2(); + m.TestOtherwiseWithCode3(); + m.TestForwardLabel(); + m.Return(m.UndefinedConstant()); + } + FunctionTester ft(asm_tester.GenerateCode(), 0); + ft.Call(); +} + } // namespace compiler } // namespace internal } // namespace v8 diff --git a/deps/v8/test/cctest/trace-extension.h b/deps/v8/test/cctest/trace-extension.h index bfebd34c06..385f0c23c2 100644 --- a/deps/v8/test/cctest/trace-extension.h +++ b/deps/v8/test/cctest/trace-extension.h @@ -38,8 +38,8 @@ namespace internal { class TraceExtension : public v8::Extension { public: TraceExtension() : v8::Extension("v8/trace", kSource) { } - virtual v8::Local<v8::FunctionTemplate> GetNativeFunctionTemplate( - v8::Isolate* isolate, v8::Local<v8::String> name); + v8::Local<v8::FunctionTemplate> GetNativeFunctionTemplate( + v8::Isolate* isolate, v8::Local<v8::String> name) override; static void Trace(const v8::FunctionCallbackInfo<v8::Value>& args); static void JSTrace(const v8::FunctionCallbackInfo<v8::Value>& args); static void JSEntrySP(const v8::FunctionCallbackInfo<v8::Value>& args); diff --git a/deps/v8/test/cctest/unicode-helpers.cc b/deps/v8/test/cctest/unicode-helpers.cc new file mode 100644 index 0000000000..524e5936fc --- /dev/null +++ b/deps/v8/test/cctest/unicode-helpers.cc @@ -0,0 +1,31 @@ +// Copyright 2018 the V8 project authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "test/cctest/unicode-helpers.h" + +int Ucs2CharLength(unibrow::uchar c) { + if (c == unibrow::Utf8::kIncomplete || c == unibrow::Utf8::kBufferEmpty) { + return 0; + } else if (c < 0xFFFF) { + return 1; + } else { + return 2; + } +} + +int Utf8LengthHelper(const char* s) { + unibrow::Utf8::Utf8IncrementalBuffer buffer(unibrow::Utf8::kBufferEmpty); + unibrow::Utf8::State state = unibrow::Utf8::State::kAccept; + + int length = 0; + size_t i = 0; + while (s[i] != '\0') { + unibrow::uchar tmp = + unibrow::Utf8::ValueOfIncremental(s[i], &i, &state, &buffer); + length += Ucs2CharLength(tmp); + } + unibrow::uchar tmp = unibrow::Utf8::ValueOfIncrementalFinish(&state); + length += Ucs2CharLength(tmp); + return length; +} diff --git a/deps/v8/test/cctest/unicode-helpers.h b/deps/v8/test/cctest/unicode-helpers.h index ca75fb65d7..06c3fcd8ea 100644 --- a/deps/v8/test/cctest/unicode-helpers.h +++ b/deps/v8/test/cctest/unicode-helpers.h @@ -7,30 +7,7 @@ #include "src/unicode.h" -static int Ucs2CharLength(unibrow::uchar c) { - if (c == unibrow::Utf8::kIncomplete || c == unibrow::Utf8::kBufferEmpty) { - return 0; - } else if (c < 0xFFFF) { - return 1; - } else { - return 2; - } -} - -static int Utf8LengthHelper(const char* s) { - unibrow::Utf8::Utf8IncrementalBuffer buffer(unibrow::Utf8::kBufferEmpty); - unibrow::Utf8::State state = unibrow::Utf8::State::kAccept; - - int length = 0; - size_t i = 0; - while (s[i] != '\0') { - unibrow::uchar tmp = - unibrow::Utf8::ValueOfIncremental(s[i], &i, &state, &buffer); - length += Ucs2CharLength(tmp); - } - unibrow::uchar tmp = unibrow::Utf8::ValueOfIncrementalFinish(&state); - length += Ucs2CharLength(tmp); - return length; -} +int Ucs2CharLength(unibrow::uchar c); +int Utf8LengthHelper(const char* s); #endif // V8_CCTEST_UNICODE_HELPERS_H_ diff --git a/deps/v8/test/cctest/wasm/test-c-wasm-entry.cc b/deps/v8/test/cctest/wasm/test-c-wasm-entry.cc index e56060bdd9..ca6662c90c 100644 --- a/deps/v8/test/cctest/wasm/test-c-wasm-entry.cc +++ b/deps/v8/test/cctest/wasm/test-c-wasm-entry.cc @@ -62,10 +62,11 @@ class CWasmEntryArgTester { Handle<Object> buffer_obj(reinterpret_cast<Object*>(arg_buffer.data()), isolate_); CHECK(!buffer_obj->IsHeapObject()); - Handle<Object> call_args[]{ - Handle<Object>::cast(isolate_->factory()->NewForeign( - wasm_code_->instruction_start(), TENURED)), - runner_.builder().instance_object(), buffer_obj}; + Handle<Object> code_entry_obj( + reinterpret_cast<Object*>(wasm_code_->instruction_start()), isolate_); + CHECK(!code_entry_obj->IsHeapObject()); + Handle<Object> call_args[]{code_entry_obj, + runner_.builder().instance_object(), buffer_obj}; static_assert( arraysize(call_args) == compiler::CWasmEntryParameters::kNumParameters, "adapt this test"); diff --git a/deps/v8/test/cctest/wasm/test-run-wasm-atomics.cc b/deps/v8/test/cctest/wasm/test-run-wasm-atomics.cc index 96877fd571..8eddaa0224 100644 --- a/deps/v8/test/cctest/wasm/test-run-wasm-atomics.cc +++ b/deps/v8/test/cctest/wasm/test-run-wasm-atomics.cc @@ -32,24 +32,12 @@ void RunU32BinOp(ExecutionTier execution_tier, WasmOpcode wasm_op, } } -WASM_EXEC_TEST(I32AtomicAdd) { - RunU32BinOp(execution_tier, kExprI32AtomicAdd, Add); -} -WASM_EXEC_TEST(I32AtomicSub) { - RunU32BinOp(execution_tier, kExprI32AtomicSub, Sub); -} -WASM_EXEC_TEST(I32AtomicAnd) { - RunU32BinOp(execution_tier, kExprI32AtomicAnd, And); -} -WASM_EXEC_TEST(I32AtomicOr) { - RunU32BinOp(execution_tier, kExprI32AtomicOr, Or); -} -WASM_EXEC_TEST(I32AtomicXor) { - RunU32BinOp(execution_tier, kExprI32AtomicXor, Xor); -} -WASM_EXEC_TEST(I32AtomicExchange) { - RunU32BinOp(execution_tier, kExprI32AtomicExchange, Exchange); -} +#define TEST_OPERATION(Name) \ + WASM_EXEC_TEST(I32Atomic##Name) { \ + RunU32BinOp(execution_tier, kExprI32Atomic##Name, Name); \ + } +OPERATION_LIST(TEST_OPERATION) +#undef TEST_OPERATION void RunU16BinOp(ExecutionTier tier, WasmOpcode wasm_op, Uint16BinOp expected_op) { @@ -73,24 +61,12 @@ void RunU16BinOp(ExecutionTier tier, WasmOpcode wasm_op, } } -WASM_EXEC_TEST(I32AtomicAdd16U) { - RunU16BinOp(execution_tier, kExprI32AtomicAdd16U, Add); -} -WASM_EXEC_TEST(I32AtomicSub16U) { - RunU16BinOp(execution_tier, kExprI32AtomicSub16U, Sub); -} -WASM_EXEC_TEST(I32AtomicAnd16U) { - RunU16BinOp(execution_tier, kExprI32AtomicAnd16U, And); -} -WASM_EXEC_TEST(I32AtomicOr16U) { - RunU16BinOp(execution_tier, kExprI32AtomicOr16U, Or); -} -WASM_EXEC_TEST(I32AtomicXor16U) { - RunU16BinOp(execution_tier, kExprI32AtomicXor16U, Xor); -} -WASM_EXEC_TEST(I32AtomicExchange16U) { - RunU16BinOp(execution_tier, kExprI32AtomicExchange16U, Exchange); -} +#define TEST_OPERATION(Name) \ + WASM_EXEC_TEST(I32Atomic##Name##16U) { \ + RunU16BinOp(execution_tier, kExprI32Atomic##Name##16U, Name); \ + } +OPERATION_LIST(TEST_OPERATION) +#undef TEST_OPERATION void RunU8BinOp(ExecutionTier execution_tier, WasmOpcode wasm_op, Uint8BinOp expected_op) { @@ -113,24 +89,12 @@ void RunU8BinOp(ExecutionTier execution_tier, WasmOpcode wasm_op, } } -WASM_EXEC_TEST(I32AtomicAdd8U) { - RunU8BinOp(execution_tier, kExprI32AtomicAdd8U, Add); -} -WASM_EXEC_TEST(I32AtomicSub8U) { - RunU8BinOp(execution_tier, kExprI32AtomicSub8U, Sub); -} -WASM_EXEC_TEST(I32AtomicAnd8U) { - RunU8BinOp(execution_tier, kExprI32AtomicAnd8U, And); -} -WASM_EXEC_TEST(I32AtomicOr8U) { - RunU8BinOp(execution_tier, kExprI32AtomicOr8U, Or); -} -WASM_EXEC_TEST(I32AtomicXor8U) { - RunU8BinOp(execution_tier, kExprI32AtomicXor8U, Xor); -} -WASM_EXEC_TEST(I32AtomicExchange8U) { - RunU8BinOp(execution_tier, kExprI32AtomicExchange8U, Exchange); -} +#define TEST_OPERATION(Name) \ + WASM_EXEC_TEST(I32Atomic##Name##8U) { \ + RunU8BinOp(execution_tier, kExprI32Atomic##Name##8U, Name); \ + } +OPERATION_LIST(TEST_OPERATION) +#undef TEST_OPERATION WASM_EXEC_TEST(I32AtomicCompareExchange) { EXPERIMENTAL_FLAG_SCOPE(threads); diff --git a/deps/v8/test/cctest/wasm/test-run-wasm-atomics64.cc b/deps/v8/test/cctest/wasm/test-run-wasm-atomics64.cc index 21b943595a..570c48d240 100644 --- a/deps/v8/test/cctest/wasm/test-run-wasm-atomics64.cc +++ b/deps/v8/test/cctest/wasm/test-run-wasm-atomics64.cc @@ -32,24 +32,12 @@ void RunU64BinOp(ExecutionTier execution_tier, WasmOpcode wasm_op, } } -WASM_EXEC_TEST(I64AtomicAdd) { - RunU64BinOp(execution_tier, kExprI64AtomicAdd, Add); -} -WASM_EXEC_TEST(I64AtomicSub) { - RunU64BinOp(execution_tier, kExprI64AtomicSub, Sub); -} -WASM_EXEC_TEST(I64AtomicAnd) { - RunU64BinOp(execution_tier, kExprI64AtomicAnd, And); -} -WASM_EXEC_TEST(I64AtomicOr) { - RunU64BinOp(execution_tier, kExprI64AtomicOr, Or); -} -WASM_EXEC_TEST(I64AtomicXor) { - RunU64BinOp(execution_tier, kExprI64AtomicXor, Xor); -} -WASM_EXEC_TEST(I64AtomicExchange) { - RunU64BinOp(execution_tier, kExprI64AtomicExchange, Exchange); -} +#define TEST_OPERATION(Name) \ + WASM_EXEC_TEST(I64Atomic##Name) { \ + RunU64BinOp(execution_tier, kExprI64Atomic##Name, Name); \ + } +OPERATION_LIST(TEST_OPERATION) +#undef TEST_OPERATION void RunU32BinOp(ExecutionTier execution_tier, WasmOpcode wasm_op, Uint32BinOp expected_op) { @@ -73,24 +61,12 @@ void RunU32BinOp(ExecutionTier execution_tier, WasmOpcode wasm_op, } } -WASM_EXEC_TEST(I64AtomicAdd32U) { - RunU32BinOp(execution_tier, kExprI64AtomicAdd32U, Add); -} -WASM_EXEC_TEST(I64AtomicSub32U) { - RunU32BinOp(execution_tier, kExprI64AtomicSub32U, Sub); -} -WASM_EXEC_TEST(I64AtomicAnd32U) { - RunU32BinOp(execution_tier, kExprI64AtomicAnd32U, And); -} -WASM_EXEC_TEST(I64AtomicOr32U) { - RunU32BinOp(execution_tier, kExprI64AtomicOr32U, Or); -} -WASM_EXEC_TEST(I64AtomicXor32U) { - RunU32BinOp(execution_tier, kExprI64AtomicXor32U, Xor); -} -WASM_EXEC_TEST(I64AtomicExchange32U) { - RunU32BinOp(execution_tier, kExprI64AtomicExchange32U, Exchange); -} +#define TEST_OPERATION(Name) \ + WASM_EXEC_TEST(I64Atomic##Name##32U) { \ + RunU32BinOp(execution_tier, kExprI64Atomic##Name##32U, Name); \ + } +OPERATION_LIST(TEST_OPERATION) +#undef TEST_OPERATION void RunU16BinOp(ExecutionTier tier, WasmOpcode wasm_op, Uint16BinOp expected_op) { @@ -114,24 +90,12 @@ void RunU16BinOp(ExecutionTier tier, WasmOpcode wasm_op, } } -WASM_EXEC_TEST(I64AtomicAdd16U) { - RunU16BinOp(execution_tier, kExprI64AtomicAdd16U, Add); -} -WASM_EXEC_TEST(I64AtomicSub16U) { - RunU16BinOp(execution_tier, kExprI64AtomicSub16U, Sub); -} -WASM_EXEC_TEST(I64AtomicAnd16U) { - RunU16BinOp(execution_tier, kExprI64AtomicAnd16U, And); -} -WASM_EXEC_TEST(I64AtomicOr16U) { - RunU16BinOp(execution_tier, kExprI64AtomicOr16U, Or); -} -WASM_EXEC_TEST(I64AtomicXor16U) { - RunU16BinOp(execution_tier, kExprI64AtomicXor16U, Xor); -} -WASM_EXEC_TEST(I64AtomicExchange16U) { - RunU16BinOp(execution_tier, kExprI64AtomicExchange16U, Exchange); -} +#define TEST_OPERATION(Name) \ + WASM_EXEC_TEST(I64Atomic##Name##16U) { \ + RunU16BinOp(execution_tier, kExprI64Atomic##Name##16U, Name); \ + } +OPERATION_LIST(TEST_OPERATION) +#undef TEST_OPERATION void RunU8BinOp(ExecutionTier execution_tier, WasmOpcode wasm_op, Uint8BinOp expected_op) { @@ -154,24 +118,12 @@ void RunU8BinOp(ExecutionTier execution_tier, WasmOpcode wasm_op, } } -WASM_EXEC_TEST(I64AtomicAdd8U) { - RunU8BinOp(execution_tier, kExprI64AtomicAdd8U, Add); -} -WASM_EXEC_TEST(I64AtomicSub8U) { - RunU8BinOp(execution_tier, kExprI64AtomicSub8U, Sub); -} -WASM_EXEC_TEST(I64AtomicAnd8U) { - RunU8BinOp(execution_tier, kExprI64AtomicAnd8U, And); -} -WASM_EXEC_TEST(I64AtomicOr8U) { - RunU8BinOp(execution_tier, kExprI64AtomicOr8U, Or); -} -WASM_EXEC_TEST(I64AtomicXor8U) { - RunU8BinOp(execution_tier, kExprI64AtomicXor8U, Xor); -} -WASM_EXEC_TEST(I64AtomicExchange8U) { - RunU8BinOp(execution_tier, kExprI64AtomicExchange8U, Exchange); -} +#define TEST_OPERATION(Name) \ + WASM_EXEC_TEST(I64Atomic##Name##8U) { \ + RunU8BinOp(execution_tier, kExprI64Atomic##Name##8U, Name); \ + } +OPERATION_LIST(TEST_OPERATION) +#undef TEST_OPERATION WASM_EXEC_TEST(I64AtomicCompareExchange) { EXPERIMENTAL_FLAG_SCOPE(threads); @@ -402,6 +354,172 @@ WASM_EXEC_TEST(I64AtomicStoreLoad8U) { } } +// Drop tests verify atomic operations are run correctly when the +// entire 64-bit output is optimized out +void RunDropTest(ExecutionTier execution_tier, WasmOpcode wasm_op, + Uint64BinOp op) { + EXPERIMENTAL_FLAG_SCOPE(threads); + WasmRunner<uint64_t, uint64_t> r(execution_tier); + uint64_t* memory = + r.builder().AddMemoryElems<uint64_t>(kWasmPageSize / sizeof(uint64_t)); + r.builder().SetHasSharedMemory(); + + BUILD(r, + WASM_ATOMICS_BINOP(wasm_op, WASM_I32V_1(0), WASM_GET_LOCAL(0), + MachineRepresentation::kWord64), + WASM_DROP, WASM_GET_LOCAL(0)); + + uint64_t initial = 0x1111222233334444, local = 0x1111111111111111; + r.builder().WriteMemory(&memory[0], initial); + CHECK_EQ(local, r.Call(local)); + uint64_t expected = op(initial, local); + CHECK_EQ(expected, r.builder().ReadMemory(&memory[0])); +} + +#define TEST_OPERATION(Name) \ + WASM_EXEC_TEST(I64Atomic##Name##Drop) { \ + RunDropTest(execution_tier, kExprI64Atomic##Name, Name); \ + } +OPERATION_LIST(TEST_OPERATION) +#undef TEST_OPERATION + +WASM_EXEC_TEST(I64AtomicSub16UDrop) { + EXPERIMENTAL_FLAG_SCOPE(threads); + WasmRunner<uint64_t, uint64_t> r(execution_tier); + uint16_t* memory = + r.builder().AddMemoryElems<uint16_t>(kWasmPageSize / sizeof(uint16_t)); + r.builder().SetHasSharedMemory(); + + BUILD(r, + WASM_ATOMICS_BINOP(kExprI64AtomicSub16U, WASM_I32V_1(0), + WASM_GET_LOCAL(0), MachineRepresentation::kWord16), + WASM_DROP, WASM_GET_LOCAL(0)); + + uint16_t initial = 0x7, local = 0xffe0; + r.builder().WriteMemory(&memory[0], initial); + CHECK_EQ(local, r.Call(local)); + uint16_t expected = Sub(initial, local); + CHECK_EQ(expected, r.builder().ReadMemory(&memory[0])); +} + +WASM_EXEC_TEST(I64AtomicCompareExchangeDrop) { + EXPERIMENTAL_FLAG_SCOPE(threads); + WasmRunner<uint64_t, uint64_t, uint64_t> r(execution_tier); + r.builder().SetHasSharedMemory(); + uint64_t* memory = + r.builder().AddMemoryElems<uint64_t>(kWasmPageSize / sizeof(uint64_t)); + BUILD(r, + WASM_ATOMICS_TERNARY_OP(kExprI64AtomicCompareExchange, WASM_I32V_1(0), + WASM_GET_LOCAL(0), WASM_GET_LOCAL(1), + MachineRepresentation::kWord64), + WASM_DROP, WASM_GET_LOCAL(1)); + + uint64_t initial = 0x1111222233334444, local = 0x1111111111111111; + r.builder().WriteMemory(&memory[0], initial); + CHECK_EQ(local, r.Call(initial, local)); + uint64_t expected = CompareExchange(initial, initial, local); + CHECK_EQ(expected, r.builder().ReadMemory(&memory[0])); +} + +WASM_EXEC_TEST(I64AtomicStoreLoadDrop) { + EXPERIMENTAL_FLAG_SCOPE(threads); + WasmRunner<uint64_t, uint64_t, uint64_t> r(execution_tier); + r.builder().SetHasSharedMemory(); + uint64_t* memory = + r.builder().AddMemoryElems<uint64_t>(kWasmPageSize / sizeof(uint64_t)); + + BUILD(r, + WASM_ATOMICS_STORE_OP(kExprI64AtomicStore, WASM_ZERO, WASM_GET_LOCAL(0), + MachineRepresentation::kWord64), + WASM_ATOMICS_LOAD_OP(kExprI64AtomicLoad, WASM_ZERO, + MachineRepresentation::kWord64), + WASM_DROP, WASM_GET_LOCAL(1)); + + uint64_t store_value = 0x1111111111111111, expected = 0xC0DE; + CHECK_EQ(expected, r.Call(store_value, expected)); + CHECK_EQ(store_value, r.builder().ReadMemory(&memory[0])); +} + +WASM_EXEC_TEST(I64AtomicAddConvertDrop) { + EXPERIMENTAL_FLAG_SCOPE(threads); + WasmRunner<uint64_t, uint64_t> r(execution_tier); + uint64_t* memory = + r.builder().AddMemoryElems<uint64_t>(kWasmPageSize / sizeof(uint64_t)); + r.builder().SetHasSharedMemory(); + + BUILD(r, + WASM_ATOMICS_BINOP(kExprI64AtomicAdd, WASM_I32V_1(0), WASM_GET_LOCAL(0), + MachineRepresentation::kWord64), + kExprI32ConvertI64, WASM_DROP, WASM_GET_LOCAL(0)); + + uint64_t initial = 0x1111222233334444, local = 0x1111111111111111; + r.builder().WriteMemory(&memory[0], initial); + CHECK_EQ(local, r.Call(local)); + uint64_t expected = Add(initial, local); + CHECK_EQ(expected, r.builder().ReadMemory(&memory[0])); +} + +WASM_EXEC_TEST(I64AtomicLoadConvertDrop) { + EXPERIMENTAL_FLAG_SCOPE(threads); + WasmRunner<uint32_t, uint64_t> r(execution_tier); + uint64_t* memory = + r.builder().AddMemoryElems<uint64_t>(kWasmPageSize / sizeof(uint64_t)); + r.builder().SetHasSharedMemory(); + + BUILD(r, WASM_I32_CONVERT_I64(WASM_ATOMICS_LOAD_OP( + kExprI64AtomicLoad, WASM_ZERO, MachineRepresentation::kWord64))); + + uint64_t initial = 0x1111222233334444; + r.builder().WriteMemory(&memory[0], initial); + CHECK_EQ(static_cast<uint32_t>(initial), r.Call(initial)); +} + +// Convert tests verify atomic operations are run correctly when the +// upper half of the 64-bit output is optimized out +void RunConvertTest(ExecutionTier execution_tier, WasmOpcode wasm_op, + Uint64BinOp op) { + EXPERIMENTAL_FLAG_SCOPE(threads); + WasmRunner<uint32_t, uint64_t> r(execution_tier); + uint64_t* memory = + r.builder().AddMemoryElems<uint64_t>(kWasmPageSize / sizeof(uint64_t)); + r.builder().SetHasSharedMemory(); + + BUILD(r, WASM_I32_CONVERT_I64(WASM_ATOMICS_BINOP( + kExprI64AtomicAdd, WASM_ZERO, WASM_GET_LOCAL(0), + MachineRepresentation::kWord64))); + + uint64_t initial = 0x1111222233334444, local = 0x1111111111111111; + r.builder().WriteMemory(&memory[0], initial); + CHECK_EQ(static_cast<uint32_t>(initial), r.Call(local)); + uint64_t expected = Add(initial, local); + CHECK_EQ(expected, r.builder().ReadMemory(&memory[0])); +} + +#define TEST_OPERATION(Name) \ + WASM_EXEC_TEST(I64AtomicConvert##Name) { \ + RunConvertTest(execution_tier, kExprI64Atomic##Name, Name); \ + } +OPERATION_LIST(TEST_OPERATION) +#undef TEST_OPERATION + +WASM_EXEC_TEST(I64AtomicConvertCompareExchange) { + EXPERIMENTAL_FLAG_SCOPE(threads); + WasmRunner<uint32_t, uint64_t, uint64_t> r(execution_tier); + uint64_t* memory = + r.builder().AddMemoryElems<uint64_t>(kWasmPageSize / sizeof(uint64_t)); + r.builder().SetHasSharedMemory(); + + BUILD(r, WASM_I32_CONVERT_I64(WASM_ATOMICS_TERNARY_OP( + kExprI64AtomicCompareExchange, WASM_I32V_1(0), WASM_GET_LOCAL(0), + WASM_GET_LOCAL(1), MachineRepresentation::kWord64))); + + uint64_t initial = 0x1111222233334444, local = 0x1111111111111111; + r.builder().WriteMemory(&memory[0], initial); + CHECK_EQ(static_cast<uint32_t>(initial), r.Call(initial, local)); + uint64_t expected = CompareExchange(initial, initial, local); + CHECK_EQ(expected, r.builder().ReadMemory(&memory[0])); +} + } // namespace test_run_wasm_atomics_64 } // namespace wasm } // namespace internal 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 d25aeafa33..21d92cbada 100644 --- a/deps/v8/test/cctest/wasm/test-run-wasm-module.cc +++ b/deps/v8/test/cctest/wasm/test-run-wasm-module.cc @@ -198,8 +198,8 @@ TEST(Run_WasmModule_Global) { TestSignatures sigs; WasmModuleBuilder* builder = new (&zone) WasmModuleBuilder(&zone); - uint32_t global1 = builder->AddGlobal(kWasmI32, 0); - uint32_t global2 = builder->AddGlobal(kWasmI32, 0); + uint32_t global1 = builder->AddGlobal(kWasmI32, false); + uint32_t global2 = builder->AddGlobal(kWasmI32, false); WasmFunctionBuilder* f1 = builder->AddFunction(sigs.i_v()); byte code1[] = { WASM_I32_ADD(WASM_GET_GLOBAL(global1), WASM_GET_GLOBAL(global2))}; @@ -284,7 +284,7 @@ class InterruptThread : public v8::base::Thread { WriteLittleEndianValue<int32_t>(ptr, interrupt_value_); } - virtual void Run() { + void Run() override { // Wait for the main thread to write the signal value. int32_t val = 0; do { @@ -771,7 +771,7 @@ TEST(Run_WasmModule_Buffer_Externalized_GrowMem) { uint32_t result = WasmMemoryObject::Grow(isolate, memory_object, 4); CHECK_EQ(16, result); CHECK(buffer1.buffer_->was_neutered()); // growing always neuters - CHECK_EQ(0, buffer1.buffer_->byte_length()->Number()); + CHECK_EQ(0, buffer1.buffer_->byte_length()); CHECK_NE(*buffer1.buffer_, memory_object->array_buffer()); @@ -782,7 +782,7 @@ TEST(Run_WasmModule_Buffer_Externalized_GrowMem) { result = testing::RunWasmModuleForTesting(isolate, instance, 0, nullptr); CHECK_EQ(26, result); CHECK(buffer2.buffer_->was_neutered()); // growing always neuters - CHECK_EQ(0, buffer2.buffer_->byte_length()->Number()); + CHECK_EQ(0, buffer2.buffer_->byte_length()); CHECK_NE(*buffer2.buffer_, memory_object->array_buffer()); } 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 f60c65b727..b0f3dcf8ce 100644 --- a/deps/v8/test/cctest/wasm/test-run-wasm-simd.cc +++ b/deps/v8/test/cctest/wasm/test-run-wasm-simd.cc @@ -1080,8 +1080,6 @@ WASM_SIMD_TEST(I32x4ShrU) { LogicalShiftRight); } -#if V8_TARGET_ARCH_ARM || V8_TARGET_ARCH_ARM64 || V8_TARGET_ARCH_MIPS || \ - V8_TARGET_ARCH_MIPS64 || V8_TARGET_ARCH_IA32 // Tests both signed and unsigned conversion from I8x16 (unpacking). WASM_SIMD_TEST(I16x8ConvertI8x16) { WasmRunner<int32_t, int32_t, int32_t, int32_t, int32_t> r(execution_tier, @@ -1124,8 +1122,6 @@ WASM_SIMD_TEST(I16x8ConvertI8x16) { CHECK_EQ(1, r.Call(*i, unpacked_signed, unpacked_unsigned, 0)); } } -#endif // V8_TARGET_ARCH_ARM || V8_TARGET_ARCH_ARM64 || V8_TARGET_ARCH_MIPS || - // V8_TARGET_ARCH_MIPS64 || V8_TARGET_ARCH_IA32 void RunI16x8UnOpTest(ExecutionTier execution_tier, LowerSimd lower_simd, WasmOpcode simd_op, Int16UnOp expected_op) { @@ -1144,8 +1140,6 @@ WASM_SIMD_TEST(I16x8Neg) { RunI16x8UnOpTest(execution_tier, lower_simd, kExprI16x8Neg, Negate); } -#if V8_TARGET_ARCH_ARM || V8_TARGET_ARCH_ARM64 || V8_TARGET_ARCH_MIPS || \ - V8_TARGET_ARCH_MIPS64 || V8_TARGET_ARCH_IA32 // Tests both signed and unsigned conversion from I32x4 (packing). WASM_SIMD_TEST(I16x8ConvertI32x4) { WasmRunner<int32_t, int32_t, int32_t, int32_t, int32_t, int32_t, int32_t> r( @@ -1190,8 +1184,6 @@ WASM_SIMD_TEST(I16x8ConvertI32x4) { } } } -#endif // V8_TARGET_ARCH_ARM || V8_TARGET_ARCH_ARM64 || V8_TARGET_ARCH_MIPS || - // V8_TARGET_ARCH_MIPS64 || V8_TARGET_ARCH_IA32 void RunI16x8BinOpTest(ExecutionTier execution_tier, LowerSimd lower_simd, WasmOpcode simd_op, Int16BinOp expected_op) { @@ -1374,8 +1366,6 @@ WASM_SIMD_TEST(I8x16Neg) { RunI8x16UnOpTest(execution_tier, lower_simd, kExprI8x16Neg, Negate); } -#if V8_TARGET_ARCH_ARM || V8_TARGET_ARCH_ARM64 || V8_TARGET_ARCH_MIPS || \ - V8_TARGET_ARCH_MIPS64 || V8_TARGET_ARCH_IA32 // Tests both signed and unsigned conversion from I16x8 (packing). WASM_SIMD_TEST(I8x16ConvertI16x8) { WasmRunner<int32_t, int32_t, int32_t, int32_t, int32_t, int32_t, int32_t> r( @@ -1422,8 +1412,6 @@ WASM_SIMD_TEST(I8x16ConvertI16x8) { } } } -#endif // V8_TARGET_ARCH_ARM || V8_TARGET_ARCH_ARM64 || V8_TARGET_ARCH_MIPS || - // V8_TARGET_ARCH_MIPS64 || V8_TARGET_ARCH_IA32 void RunI8x16BinOpTest(ExecutionTier execution_tier, LowerSimd lower_simd, WasmOpcode simd_op, Int8BinOp expected_op) { @@ -2012,6 +2000,8 @@ WASM_SIMD_COMPILED_TEST(S8x16MultiShuffleFuzz) { } } } +#endif // V8_TARGET_ARCH_ARM || V8_TARGET_ARCH_ARM64 || V8_TARGET_ARCH_MIPS || + // V8_TARGET_ARCH_MIPS64 || V8_TARGET_ARCH_IA32 // Boolean unary operations are 'AllTrue' and 'AnyTrue', which return an integer // result. Use relational ops on numeric vectors to create the boolean vector @@ -2099,8 +2089,6 @@ WASM_SIMD_TEST(SimdI32x4ExtractWithF32x4) { WASM_I32V(1), WASM_I32V(0))); CHECK_EQ(1, r.Call()); } -#endif // V8_TARGET_ARCH_ARM || V8_TARGET_ARCH_ARM64 || V8_TARGET_ARCH_MIPS || - // V8_TARGET_ARCH_MIPS64 || V8_TARGET_ARCH_IA32 WASM_SIMD_TEST(SimdF32x4ExtractWithI32x4) { WasmRunner<int32_t> r(execution_tier, lower_simd); diff --git a/deps/v8/test/cctest/wasm/test-wasm-breakpoints.cc b/deps/v8/test/cctest/wasm/test-wasm-breakpoints.cc index ec93639e17..26e98a1ba4 100644 --- a/deps/v8/test/cctest/wasm/test-wasm-breakpoints.cc +++ b/deps/v8/test/cctest/wasm/test-wasm-breakpoints.cc @@ -72,7 +72,7 @@ class BreakHandler : public debug::DebugDelegate { : isolate_(isolate), expected_breaks_(expected_breaks) { v8::debug::SetDebugDelegate(reinterpret_cast<v8::Isolate*>(isolate_), this); } - ~BreakHandler() { + ~BreakHandler() override { // Check that all expected breakpoints have been hit. CHECK_EQ(count_, expected_breaks_.size()); v8::debug::SetDebugDelegate(reinterpret_cast<v8::Isolate*>(isolate_), @@ -181,7 +181,7 @@ class CollectValuesBreakHandler : public debug::DebugDelegate { : isolate_(isolate), expected_values_(expected_values) { v8::debug::SetDebugDelegate(reinterpret_cast<v8::Isolate*>(isolate_), this); } - ~CollectValuesBreakHandler() { + ~CollectValuesBreakHandler() override { v8::debug::SetDebugDelegate(reinterpret_cast<v8::Isolate*>(isolate_), nullptr); } 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 5e70edf830..5d383bb9c5 100644 --- a/deps/v8/test/cctest/wasm/test-wasm-shared-engine.cc +++ b/deps/v8/test/cctest/wasm/test-wasm-shared-engine.cc @@ -56,7 +56,7 @@ class SharedEngineIsolate { public: explicit SharedEngineIsolate(SharedEngine* engine) : isolate_(v8::Isolate::Allocate()) { - isolate()->set_wasm_engine(engine->ExportEngineForSharing()); + isolate()->SetWasmEngine(engine->ExportEngineForSharing()); v8::Isolate::CreateParams create_params; create_params.array_buffer_allocator = CcTest::array_buffer_allocator(); v8::Isolate::Initialize(isolate_, create_params); @@ -116,7 +116,7 @@ class SharedEngineThread : public v8::base::Thread { engine_(engine), callback_(callback) {} - virtual void Run() { + void Run() override { SharedEngineIsolate isolate(engine_); callback_(isolate); } @@ -145,10 +145,10 @@ class MockInstantiationResolver : public InstantiationResultResolver { public: explicit MockInstantiationResolver(Handle<Object>* out_instance) : out_instance_(out_instance) {} - virtual void OnInstantiationSucceeded(Handle<WasmInstanceObject> result) { + void OnInstantiationSucceeded(Handle<WasmInstanceObject> result) override { *out_instance_->location() = *result; } - virtual void OnInstantiationFailed(Handle<Object> error_reason) { + void OnInstantiationFailed(Handle<Object> error_reason) override { UNREACHABLE(); } @@ -161,13 +161,13 @@ class MockCompilationResolver : public CompilationResultResolver { MockCompilationResolver(SharedEngineIsolate& isolate, Handle<Object>* out_instance) : isolate_(isolate), out_instance_(out_instance) {} - virtual void OnCompilationSucceeded(Handle<WasmModuleObject> result) { + void OnCompilationSucceeded(Handle<WasmModuleObject> result) override { isolate_.isolate()->wasm_engine()->AsyncInstantiate( isolate_.isolate(), base::make_unique<MockInstantiationResolver>(out_instance_), result, {}); } - virtual void OnCompilationFailed(Handle<Object> error_reason) { + void OnCompilationFailed(Handle<Object> error_reason) override { UNREACHABLE(); } diff --git a/deps/v8/test/cctest/wasm/test-wasm-stack.cc b/deps/v8/test/cctest/wasm/test-wasm-stack.cc index 2bed7e64db..303fb75878 100644 --- a/deps/v8/test/cctest/wasm/test-wasm-stack.cc +++ b/deps/v8/test/cctest/wasm/test-wasm-stack.cc @@ -30,7 +30,7 @@ namespace { "Check failed: (%s) != (%s) ('%s' vs '%s').", #exp, #found, \ exp_, found_ ? found_ : "<null>"); \ } \ - } while (0) + } while (false) void PrintStackTrace(v8::Isolate* isolate, v8::Local<v8::StackTrace> stack) { printf("Stack Trace (length %d):\n", stack->GetFrameCount()); @@ -157,7 +157,8 @@ WASM_EXEC_TEST(CollectDetailedWasmStack_WasmError) { int unreachable_pos = 1 << (8 * pos_shift); TestSignatures sigs; // Create a WasmRunner with stack checks and traps enabled. - WasmRunner<int> r(execution_tier, 0, "main", kRuntimeExceptionSupport); + WasmRunner<int> r(execution_tier, nullptr, "main", + kRuntimeExceptionSupport); std::vector<byte> code(unreachable_pos + 1, kExprNop); code[unreachable_pos] = kExprUnreachable; diff --git a/deps/v8/test/cctest/wasm/test-wasm-trap-position.cc b/deps/v8/test/cctest/wasm/test-wasm-trap-position.cc index ad9b6d3b56..7b34ed824b 100644 --- a/deps/v8/test/cctest/wasm/test-wasm-trap-position.cc +++ b/deps/v8/test/cctest/wasm/test-wasm-trap-position.cc @@ -31,7 +31,7 @@ namespace { "Check failed: (%s) != (%s) ('%s' vs '%s').", #exp, #found, \ exp_, found_ ? found_ : "<null>"); \ } \ - } while (0) + } while (false) struct ExceptionInfo { const char* func_name; @@ -69,7 +69,7 @@ void CheckExceptionInfos(v8::internal::Isolate* i_isolate, Handle<Object> exc, // Trigger a trap for executing unreachable. WASM_EXEC_TEST(Unreachable) { // Create a WasmRunner with stack checks and traps enabled. - WasmRunner<void> r(execution_tier, 0, "main", kRuntimeExceptionSupport); + WasmRunner<void> r(execution_tier, nullptr, "main", kRuntimeExceptionSupport); TestSignatures sigs; BUILD(r, WASM_UNREACHABLE); @@ -103,7 +103,7 @@ WASM_EXEC_TEST(Unreachable) { // Trigger a trap for loading from out-of-bounds. WASM_EXEC_TEST(IllegalLoad) { - WasmRunner<void> r(execution_tier, 0, "main", kRuntimeExceptionSupport); + WasmRunner<void> r(execution_tier, nullptr, "main", kRuntimeExceptionSupport); TestSignatures sigs; r.builder().AddMemory(0L); diff --git a/deps/v8/test/cctest/wasm/wasm-atomics-utils.h b/deps/v8/test/cctest/wasm/wasm-atomics-utils.h index 1a0dd345b7..615deab208 100644 --- a/deps/v8/test/cctest/wasm/wasm-atomics-utils.h +++ b/deps/v8/test/cctest/wasm/wasm-atomics-utils.h @@ -13,6 +13,14 @@ namespace v8 { namespace internal { namespace wasm { +#define OPERATION_LIST(V) \ + V(Add) \ + V(Sub) \ + V(And) \ + V(Or) \ + V(Xor) \ + V(Exchange) + typedef uint64_t (*Uint64BinOp)(uint64_t, uint64_t); typedef uint32_t (*Uint32BinOp)(uint32_t, uint32_t); typedef uint16_t (*Uint16BinOp)(uint16_t, uint16_t); diff --git a/deps/v8/test/cctest/wasm/wasm-run-utils.cc b/deps/v8/test/cctest/wasm/wasm-run-utils.cc index 5f623a46cc..4ce07089e2 100644 --- a/deps/v8/test/cctest/wasm/wasm-run-utils.cc +++ b/deps/v8/test/cctest/wasm/wasm-run-utils.cc @@ -41,13 +41,15 @@ TestingModuleBuilder::TestingModuleBuilder( if (maybe_import) { // Manually compile a wasm to JS wrapper and insert it into the instance. CodeSpaceMemoryModificationScope modification_scope(isolate_->heap()); - MaybeHandle<Code> code = compiler::CompileWasmToJSWrapper( - isolate_, maybe_import->js_function, maybe_import->sig, - maybe_import_index, test_module_->origin, + auto kind = compiler::GetWasmImportCallKind(maybe_import->js_function, + maybe_import->sig); + MaybeHandle<Code> code = compiler::CompileWasmImportCallWrapper( + isolate_, kind, maybe_import->sig, maybe_import_index, + test_module_->origin, trap_handler::IsTrapHandlerEnabled() ? kUseTrapHandler : kNoTrapHandler); - auto wasm_to_js_wrapper = native_module_->AddCodeCopy( - code.ToHandleChecked(), WasmCode::kWasmToJsWrapper, maybe_import_index); + auto wasm_to_js_wrapper = native_module_->AddImportWrapper( + code.ToHandleChecked(), maybe_import_index); ImportedFunctionEntry(instance_object_, maybe_import_index) .set_wasm_to_js(*maybe_import->js_function, wasm_to_js_wrapper); @@ -123,9 +125,8 @@ Handle<JSFunction> TestingModuleBuilder::WrapCode(uint32_t index) { // Wrap the code so it can be called as a JS function. Link(); FunctionSig* sig = test_module_->functions[index].sig; - MaybeHandle<Code> maybe_ret_code = compiler::CompileJSToWasmWrapper( - isolate_, native_module_, sig, false, - trap_handler::IsTrapHandlerEnabled() ? kUseTrapHandler : kNoTrapHandler); + MaybeHandle<Code> maybe_ret_code = + compiler::CompileJSToWasmWrapper(isolate_, sig, false); Handle<Code> ret_code = maybe_ret_code.ToHandleChecked(); Handle<JSFunction> ret = WasmExportedFunction::New( isolate_, instance_object(), MaybeHandle<String>(), @@ -363,7 +364,7 @@ Handle<Code> WasmFunctionWrapper::GetWrapperCode() { Code::C_WASM_ENTRY); code_ = compiler::Pipeline::GenerateCodeForTesting( &info, isolate, call_descriptor, graph(), - AssemblerOptions::Default(isolate), nullptr); + AssemblerOptions::Default(isolate)); code = code_.ToHandleChecked(); #ifdef ENABLE_DISASSEMBLER if (FLAG_print_opt_code) { @@ -419,18 +420,13 @@ void WasmFunctionCompiler::Build(const byte* start, const byte* end) { ScopedVector<uint8_t> func_wire_bytes(function_->code.length()); memcpy(func_wire_bytes.start(), wire_bytes.start() + function_->code.offset(), func_wire_bytes.length()); - WireBytesRef func_name_ref = - module_env.module->LookupFunctionName(wire_bytes, function_->func_index); - ScopedVector<char> func_name(func_name_ref.length()); - memcpy(func_name.start(), wire_bytes.start() + func_name_ref.offset(), - func_name_ref.length()); FunctionBody func_body{function_->sig, function_->code.offset(), func_wire_bytes.start(), func_wire_bytes.end()}; NativeModule* native_module = builder_->instance_object()->module_object()->native_module(); WasmCompilationUnit unit(isolate()->wasm_engine(), &module_env, native_module, - func_body, func_name, function_->func_index, + func_body, function_->func_index, isolate()->counters(), tier); WasmFeatures unused_detected_features; unit.ExecuteCompilation(&unused_detected_features); @@ -458,7 +454,7 @@ WasmFunctionCompiler::WasmFunctionCompiler(Zone* zone, FunctionSig* sig, function_ = builder_->GetFunctionAt(index); } -WasmFunctionCompiler::~WasmFunctionCompiler() {} +WasmFunctionCompiler::~WasmFunctionCompiler() = default; FunctionSig* WasmRunnerBase::CreateSig(MachineType return_type, Vector<MachineType> param_types) { diff --git a/deps/v8/test/cctest/wasm/wasm-run-utils.h b/deps/v8/test/cctest/wasm/wasm-run-utils.h index 899dc06268..aba43f3a08 100644 --- a/deps/v8/test/cctest/wasm/wasm-run-utils.h +++ b/deps/v8/test/cctest/wasm/wasm-run-utils.h @@ -461,10 +461,12 @@ class WasmRunner : public WasmRunnerBase { wrapper_code, wrapper_.signature()); int32_t result; { - trap_handler::ThreadInWasmScope scope; + trap_handler::SetThreadInWasm(); result = runner.Call(static_cast<void*>(&p)..., static_cast<void*>(&return_value)); + + trap_handler::ClearThreadInWasm(); } CHECK_EQ(WASM_WRAPPER_RETURN_VALUE, result); return WasmRunnerBase::trap_happened diff --git a/deps/v8/test/common/assembler-tester.h b/deps/v8/test/common/assembler-tester.h index 0291e48efb..eca34c5521 100644 --- a/deps/v8/test/common/assembler-tester.h +++ b/deps/v8/test/common/assembler-tester.h @@ -17,7 +17,8 @@ static inline uint8_t* AllocateAssemblerBuffer( size_t page_size = v8::internal::AllocatePageSize(); size_t alloc_size = RoundUp(requested, page_size); void* result = v8::internal::AllocatePages( - address, alloc_size, page_size, v8::PageAllocator::kReadWriteExecute); + GetPlatformPageAllocator(), address, alloc_size, page_size, + v8::PageAllocator::kReadWriteExecute); CHECK(result); *allocated = alloc_size; return static_cast<uint8_t*>(result); @@ -25,18 +26,24 @@ static inline uint8_t* AllocateAssemblerBuffer( static inline void MakeAssemblerBufferExecutable(uint8_t* buffer, size_t allocated) { - bool result = v8::internal::SetPermissions(buffer, allocated, - v8::PageAllocator::kReadExecute); - CHECK(result); - // Flush the instruction cache as part of making the buffer executable. + // Note: we do this before setting permissions to ReadExecute because on + // some older Arm64 kernels there is a bug which causes an access error on + // cache flush instructions to trigger access error on non-writable memory. + // See https://bugs.chromium.org/p/v8/issues/detail?id=8157 Assembler::FlushICache(buffer, allocated); + + bool result = + v8::internal::SetPermissions(GetPlatformPageAllocator(), buffer, + allocated, v8::PageAllocator::kReadExecute); + CHECK(result); } static inline void MakeAssemblerBufferWritable(uint8_t* buffer, size_t allocated) { - bool result = v8::internal::SetPermissions(buffer, allocated, - v8::PageAllocator::kReadWrite); + bool result = + v8::internal::SetPermissions(GetPlatformPageAllocator(), buffer, + allocated, v8::PageAllocator::kReadWrite); CHECK(result); } diff --git a/deps/v8/test/common/wasm/wasm-macro-gen.h b/deps/v8/test/common/wasm/wasm-macro-gen.h index 1015701e3b..f722062662 100644 --- a/deps/v8/test/common/wasm/wasm-macro-gen.h +++ b/deps/v8/test/common/wasm/wasm-macro-gen.h @@ -20,6 +20,7 @@ #define IMPORT_SIG_INDEX(v) U32V_1(v) #define FUNC_INDEX(v) U32V_1(v) #define TABLE_INDEX(v) U32V_1(v) +#define EXCEPTION_INDEX(v) U32V_1(v) #define NO_NAME U32V_1(0) #define NAME_LENGTH(v) U32V_1(v) #define ENTRY_COUNT(v) U32V_1(v) diff --git a/deps/v8/test/debugger/debug/debug-bigint.js b/deps/v8/test/debugger/debug/debug-bigint.js index 2abdc928d9..0ed09b04e8 100644 --- a/deps/v8/test/debugger/debug/debug-bigint.js +++ b/deps/v8/test/debugger/debug/debug-bigint.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-bigint - Debug = debug.Debug let exceptionThrown = false; diff --git a/deps/v8/test/debugger/debug/debug-break-class-fields.js b/deps/v8/test/debugger/debug/debug-break-class-fields.js new file mode 100644 index 0000000000..b6b9c93235 --- /dev/null +++ b/deps/v8/test/debugger/debug/debug-break-class-fields.js @@ -0,0 +1,139 @@ +// Copyright 2018 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-public-fields --harmony-static-fields --allow-natives-syntax + +Debug = debug.Debug + +Debug.setListener(function() {}); + +class Y { + x = 1; + y = 2; + z = 3; +} + +var initializer = %GetInitializerFunction(Y); +var b1, b2, b3; + +// class Y { +// x = [B0]1; +// y = [B1]2; +// z = [B2]3; +// } +b1 = Debug.setBreakPoint(initializer, 0, 0); +assertTrue(Debug.showBreakPoints(initializer).indexOf("x = [B0]1;") === 0); +Debug.clearBreakPoint(b1); +assertTrue(Debug.showBreakPoints(initializer).indexOf("x = [B0]1;") === -1); + +b2 = Debug.setBreakPoint(initializer, 1, 0); +assertTrue(Debug.showBreakPoints(initializer).indexOf("y = [B0]2;") > 0); +Debug.clearBreakPoint(b2); +assertTrue(Debug.showBreakPoints(initializer).indexOf("y = [B0]2;") === -1); + +b3 = Debug.setBreakPoint(initializer, 2, 0); +assertTrue(Debug.showBreakPoints(initializer).indexOf("z = [B0]3") > 0); +Debug.clearBreakPoint(b3); +assertTrue(Debug.showBreakPoints(initializer).indexOf("z = [B0]3") === -1); + +b1 = Debug.setBreakPoint(initializer, 0, 0); +b2 = Debug.setBreakPoint(initializer, 1, 0); +assertTrue(Debug.showBreakPoints(initializer).indexOf("x = [B0]1;") === 0); +assertTrue(Debug.showBreakPoints(initializer).indexOf("y = [B1]2;") > 0); +Debug.clearBreakPoint(b1); +assertTrue(Debug.showBreakPoints(initializer).indexOf("x = [B0]1;") === -1); +Debug.clearBreakPoint(b2); +assertTrue(Debug.showBreakPoints(initializer).indexOf("y = [B1]2;") === -1); + +b1 = Debug.setBreakPoint(initializer, 0, 0); +b3 = Debug.setBreakPoint(initializer, 2, 0); +assertTrue(Debug.showBreakPoints(initializer).indexOf("x = [B0]1;") === 0); +assertTrue(Debug.showBreakPoints(initializer).indexOf("z = [B1]3") > 0); +Debug.clearBreakPoint(b1); +assertTrue(Debug.showBreakPoints(initializer).indexOf("x = [B0]1;") === -1); +Debug.clearBreakPoint(b3); +assertTrue(Debug.showBreakPoints(initializer).indexOf("z = [B1]3") === -1); + +b2 = Debug.setBreakPoint(initializer, 1, 0); +b3 = Debug.setBreakPoint(initializer, 2, 0); +assertTrue(Debug.showBreakPoints(initializer).indexOf("y = [B0]2;") > 0); +assertTrue(Debug.showBreakPoints(initializer).indexOf("z = [B1]3") > 0); +Debug.clearBreakPoint(b2); +assertTrue(Debug.showBreakPoints(initializer).indexOf("y = [B0]2;") === -1); +Debug.clearBreakPoint(b3); +assertTrue(Debug.showBreakPoints(initializer).indexOf("z = [B1]3") === -1); + +function foo() {} +var bar = "bar"; + +class X { + [foo()] = 1; + [bar] = 2; + baz = foo(); +} + +// The computed properties are evaluated during class construction, +// not as part of the initializer function. As a consequence of which, +// they aren't breakable here in the initializer function, but +// instead, are part of the enclosing function. +// +// class X { +// [foo()] = [B0]1; +// [bar] = [B1]2; +// [baz] = [B2]foo(); +// } + +initializer = %GetInitializerFunction(X); +b1 = Debug.setBreakPoint(initializer, 0, 0); +assertTrue(Debug.showBreakPoints(initializer).indexOf("[foo()] = [B0]1;") === 0); +Debug.clearBreakPoint(b1); +assertTrue(Debug.showBreakPoints(initializer).indexOf("[foo()] = [B0]1;") === -1); + +b2 = Debug.setBreakPoint(initializer, 1, 0); +assertTrue(Debug.showBreakPoints(initializer).indexOf("[bar] = [B0]2;") > 0); +Debug.clearBreakPoint(b2); +assertTrue(Debug.showBreakPoints(initializer).indexOf("[bar] = [B0]2;") === -1); + +b3 = Debug.setBreakPoint(initializer, 2, 0); +assertTrue(Debug.showBreakPoints(initializer).indexOf("baz = [B0]foo()") > 0); +Debug.clearBreakPoint(b3); +assertTrue(Debug.showBreakPoints(initializer).indexOf("baz = [B0]foo()") === -1); + +b1 = Debug.setBreakPoint(initializer, 0, 0); +b2 = Debug.setBreakPoint(initializer, 1, 0); +assertTrue(Debug.showBreakPoints(initializer).indexOf("[foo()] = [B0]1;") === 0); +assertTrue(Debug.showBreakPoints(initializer).indexOf("[bar] = [B1]2;") > 0); +Debug.clearBreakPoint(b1); +assertTrue(Debug.showBreakPoints(initializer).indexOf("[foo()] = [B0]1;") === -1); +Debug.clearBreakPoint(b2); +assertTrue(Debug.showBreakPoints(initializer).indexOf("[bar] = [B1]2;") === -1); + +b1 = Debug.setBreakPoint(initializer, 0, 0); +b3 = Debug.setBreakPoint(initializer, 2, 0); +assertTrue(Debug.showBreakPoints(initializer).indexOf("[foo()] = [B0]1;") === 0); +assertTrue(Debug.showBreakPoints(initializer).indexOf("baz = [B1]foo()") > 0); +Debug.clearBreakPoint(b1); +assertTrue(Debug.showBreakPoints(initializer).indexOf("[foo()] = [B0]1;") === -1); +Debug.clearBreakPoint(b3); +assertTrue(Debug.showBreakPoints(initializer).indexOf("baz = [B1]foo()") === -1); + +b2 = Debug.setBreakPoint(initializer, 1, 0); +b3 = Debug.setBreakPoint(initializer, 2, 0); +assertTrue(Debug.showBreakPoints(initializer).indexOf("[bar] = [B0]2;") > 0); +assertTrue(Debug.showBreakPoints(initializer).indexOf("baz = [B1]foo()") > 0); +Debug.clearBreakPoint(b2); +assertTrue(Debug.showBreakPoints(initializer).indexOf("[bar] = [B0]2;") === -1); +Debug.clearBreakPoint(b3); +assertTrue(Debug.showBreakPoints(initializer).indexOf("baz = [B1]foo()") === -1); + +function t() { + class X { + [foo()] = 1; + } +} + +b1 = Debug.setBreakPoint(t, 0, 0); +assertTrue(Debug.showBreakPoints(t).indexOf("[[B0]foo()] = 1;")> 0); +Debug.clearBreakPoint(b1); +assertTrue(Debug.showBreakPoints(initializer).indexOf("[[B0]foo()] = 1;") === -1); diff --git a/deps/v8/test/debugger/debug/debug-live-edit-recursion.js b/deps/v8/test/debugger/debug/debug-liveedit-recursion.js index 6328a9b6de..6328a9b6de 100644 --- a/deps/v8/test/debugger/debug/debug-live-edit-recursion.js +++ b/deps/v8/test/debugger/debug/debug-liveedit-recursion.js diff --git a/deps/v8/test/debugger/debug/es6/generators-debug-scopes.js b/deps/v8/test/debugger/debug/es6/generators-debug-scopes.js index a46dc8b22e..14752afc15 100644 --- a/deps/v8/test/debugger/debug/es6/generators-debug-scopes.js +++ b/deps/v8/test/debugger/debug/es6/generators-debug-scopes.js @@ -42,8 +42,7 @@ function RunTest(name, formals_and_body, args, handler, continuation) { run(function () { return fun.apply(null, args) }); run(function () { return gen.apply(null, args).next().value }); - // TODO(wingo): Uncomment after bug 2838 is fixed. - // Debug.setListener(null); + Debug.setListener(null); } // Check that two scope are the same. diff --git a/deps/v8/test/debugger/debug/side-effect/debug-evaluate-no-side-effect-builtins.js b/deps/v8/test/debugger/debug/side-effect/debug-evaluate-no-side-effect-builtins.js index 9a108be4a4..938461690e 100644 --- a/deps/v8/test/debugger/debug/side-effect/debug-evaluate-no-side-effect-builtins.js +++ b/deps/v8/test/debugger/debug/side-effect/debug-evaluate-no-side-effect-builtins.js @@ -2,6 +2,8 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. +// Flags: --no-enable-one-shot-optimization + Debug = debug.Debug var exception = null; diff --git a/deps/v8/test/debugger/debug/side-effect/debug-evaluate-no-side-effect-runtime-check.js b/deps/v8/test/debugger/debug/side-effect/debug-evaluate-no-side-effect-runtime-check.js index 7450cb2206..7a0f373be7 100644 --- a/deps/v8/test/debugger/debug/side-effect/debug-evaluate-no-side-effect-runtime-check.js +++ b/deps/v8/test/debugger/debug/side-effect/debug-evaluate-no-side-effect-runtime-check.js @@ -50,8 +50,7 @@ success([1], `return_array_use_spread([1])`); // CallAccessorSetter var array = [1,2,3]; fail(`array.length = 2`); -// TODO(7515): this one should be side effect free -fail(`[1,2,3].length = 2`); +success(2, `[1,2,3].length = 2`); // StaDataPropertyInLiteral function return_literal_with_data_property(a) { diff --git a/deps/v8/test/debugger/debug/side-effect/debug-evaluate-no-side-effect.js b/deps/v8/test/debugger/debug/side-effect/debug-evaluate-no-side-effect.js index fa14b4b862..5504cef16d 100644 --- a/deps/v8/test/debugger/debug/side-effect/debug-evaluate-no-side-effect.js +++ b/deps/v8/test/debugger/debug/side-effect/debug-evaluate-no-side-effect.js @@ -9,6 +9,7 @@ let a = 1; var object = { property : 2, get getter() { return 3; } }; +var string0 = new String("string"); var string1 = { toString() { return "x"; } }; var string2 = { toString() { print("x"); return "x"; } }; var array = [4, 5]; @@ -19,6 +20,9 @@ function set_a() { a = 2; } function get_a() { return a; } var bound = get_a.bind(0); +function return_arg0() { return return_arg0.arguments[0]; } +function return_caller_name() { return return_caller_name.caller.name; } + var global_eval = eval; function listener(event, exec_state, event_data, data) { @@ -32,6 +36,7 @@ function listener(event, exec_state, event_data, data) { assertThrows(() => exec_state.frame(0).evaluate(source, true), EvalError); } + // Simple test. success(3, "1 + 2"); // Dymanic load. @@ -62,8 +67,9 @@ function listener(event, exec_state, event_data, data) { success("set_a", "set_a.name"); success(0, "bound.length"); success("bound get_a", "bound.name"); + success(1, "return_arg0(1)"); + success("f", "(function f() { return return_caller_name() })()"); // Non-evaluated call. - success("abc", "['abc'].join('foo')"); // Constructed literals. success([1], "[1]"); success({x: 1}, "({x: 1})"); @@ -82,13 +88,25 @@ function listener(event, exec_state, event_data, data) { fail("try { set_a() } catch (e) {}"); // Test that call to set accessor fails. fail("array.length = 4"); - fail("'x'.length = 1"); fail("set_a.name = 'set_b'"); fail("set_a.length = 1"); fail("bound.name = 'bound'"); fail("bound.length = 1"); + fail("set_a.prototype = null"); // Test that call to non-whitelisted get accessor fails. fail("error.stack"); + // Call to set accessors with receiver check. + success(1, "[].length = 1"); + success(1, "'x'.length = 1"); + fail("string0.length = 1"); + success(1, "(new String('abc')).length = 1"); + success("g", "(function(){}).name = 'g'"); + success(1, "(function(){}).length = 1"); + success("g", "get_a.bind(0).name = 'g'"); + success(1, "get_a.bind(0).length = 1"); + success(null, "(function(){}).prototype = null"); + success(true, "(new Error()).stack.length > 1"); + success("a", "(new Error()).stack = 'a'"); // Eval is not allowed. fail("eval('Math.sin(1)')"); fail("eval('exception = 1')"); diff --git a/deps/v8/test/debugger/debugger.status b/deps/v8/test/debugger/debugger.status index 8500344fb5..e85f1bef03 100644 --- a/deps/v8/test/debugger/debugger.status +++ b/deps/v8/test/debugger/debugger.status @@ -70,9 +70,28 @@ 'debug/es8/async-debug-caught-exception-cases2': [SKIP], 'debug/es8/async-debug-caught-exception-cases3': [SKIP], 'debug/es8/async-function-debug-scopes': [SKIP], + + # https://crbug.com/v8/8141 + 'debug/debug-liveedit-1': [SKIP], + 'debug/debug-liveedit-double-call': [SKIP], + 'debug/es6/debug-liveedit-new-target-3': [SKIP], + 'debug/side-effect/debug-evaluate-no-side-effect-control': [SKIP], }], # 'gc_stress == True' ############################################################################## +['gc_fuzzer', { + # Slow tests. + 'regress/regress-2318': [SKIP], +}], # 'gc_fuzzer' + +############################################################################## +['predictable == True', { + # https://crbug.com/v8/8147 + 'debug/debug-liveedit-*': [SKIP], + 'debug/debug-set-variable-value': [SKIP], +}], # 'predictable == True' + +############################################################################## ['variant == no_wasm_traps', { '*': [SKIP], }], # variant == no_wasm_traps diff --git a/deps/v8/test/debugger/testcfg.py b/deps/v8/test/debugger/testcfg.py index da923ff63b..61893e9bbd 100644 --- a/deps/v8/test/debugger/testcfg.py +++ b/deps/v8/test/debugger/testcfg.py @@ -32,7 +32,7 @@ class TestSuite(testsuite.TestSuite): return TestCase -class TestCase(testcase.TestCase): +class TestCase(testcase.D8TestCase): def __init__(self, *args, **kwargs): super(TestCase, self).__init__(*args, **kwargs) diff --git a/deps/v8/test/fuzzer/multi-return.cc b/deps/v8/test/fuzzer/multi-return.cc index 0be812c8dd..a7f4ca06ca 100644 --- a/deps/v8/test/fuzzer/multi-return.cc +++ b/deps/v8/test/fuzzer/multi-return.cc @@ -83,21 +83,6 @@ MachineType RandomType(InputProvider* input) { return kTypes[input->NextInt8(kNumTypes)]; } -int num_registers(MachineType type) { - const RegisterConfiguration* config = RegisterConfiguration::Default(); - switch (type.representation()) { - case MachineRepresentation::kWord32: - case MachineRepresentation::kWord64: - return config->num_allocatable_general_registers(); - case MachineRepresentation::kFloat32: - return config->num_allocatable_float_registers(); - case MachineRepresentation::kFloat64: - return config->num_allocatable_double_registers(); - default: - UNREACHABLE(); - } -} - int index(MachineType type) { return static_cast<int>(type.representation()); } Node* Constant(RawMachineAssembler& m, MachineType type, int value) { @@ -264,9 +249,7 @@ extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) { std::unique_ptr<wasm::NativeModule> module = AllocateNativeModule(i_isolate, code->raw_instruction_size()); - byte* code_start = module->AddCodeCopy(code, wasm::WasmCode::kFunction, 0) - ->instructions() - .start(); + byte* code_start = module->AddCodeForTesting(code)->instructions().start(); // Generate wrapper. int expect = 0; diff --git a/deps/v8/test/fuzzer/wasm-fuzzer-common.h b/deps/v8/test/fuzzer/wasm-fuzzer-common.h index 4a86148ca7..17bc70e91c 100644 --- a/deps/v8/test/fuzzer/wasm-fuzzer-common.h +++ b/deps/v8/test/fuzzer/wasm-fuzzer-common.h @@ -31,7 +31,7 @@ void GenerateTestCase(Isolate* isolate, ModuleWireBytes wire_bytes, class WasmExecutionFuzzer { public: - virtual ~WasmExecutionFuzzer() {} + virtual ~WasmExecutionFuzzer() = default; int FuzzWasmModule(Vector<const uint8_t> data, bool require_valid = false); protected: diff --git a/deps/v8/test/inspector/debugger/break-on-exception-compiler-errors-expected.txt b/deps/v8/test/inspector/debugger/break-on-exception-compiler-errors-expected.txt index 467da2c2f8..43021bd29c 100644 --- a/deps/v8/test/inspector/debugger/break-on-exception-compiler-errors-expected.txt +++ b/deps/v8/test/inspector/debugger/break-on-exception-compiler-errors-expected.txt @@ -4,7 +4,7 @@ Running test: testUnexpectedEndOfInput Runs '+++' Runtime.evaluate exceptionDetails: { - columnNumber : 2 + columnNumber : 3 exception : { className : SyntaxError description : SyntaxError: Unexpected end of input @@ -49,7 +49,7 @@ paused on exception: } Runtime.evaluate exceptionDetails: { - columnNumber : 2 + columnNumber : 3 exception : { className : SyntaxError description : SyntaxError: Unexpected end of input at <anonymous>:1:1 diff --git a/deps/v8/test/inspector/debugger/es6-module-liveedit-expected.txt b/deps/v8/test/inspector/debugger/es6-module-liveedit-expected.txt new file mode 100644 index 0000000000..8ce34728a4 --- /dev/null +++ b/deps/v8/test/inspector/debugger/es6-module-liveedit-expected.txt @@ -0,0 +1,17 @@ +Checks liveedit with ES6 modules. +console.log message from function before patching: +{ + type : string + value : module1 +} +Debugger.setScriptSource result: +{ + callFrames : [ + ] + stackChanged : false +} +console.log message from function after patching: +{ + type : string + value : patched module1 +} diff --git a/deps/v8/test/inspector/debugger/es6-module-liveedit.js b/deps/v8/test/inspector/debugger/es6-module-liveedit.js new file mode 100644 index 0000000000..397a4303a7 --- /dev/null +++ b/deps/v8/test/inspector/debugger/es6-module-liveedit.js @@ -0,0 +1,50 @@ +// Copyright 2017 the V8 project authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +const {session, contextGroup, Protocol} = + InspectorTest.start('Checks liveedit with ES6 modules.'); + +const moduleSource = ` +export function foo() { + console.log('module1'); + return 42; +} +foo()`; + +const newModuleSource = ` +export function foo() { + console.log('patched module1'); + return 42; +} +foo()`; + +const callFooSource = ` +import { foo } from 'module'; +foo();`; + +(async function test() { + await Protocol.Runtime.enable(); + await Protocol.Debugger.enable(); + contextGroup.addModule(moduleSource, 'module'); + const [{ params: { scriptId } }, { params: { args }}] = [ + await Protocol.Debugger.onceScriptParsed(), + await Protocol.Runtime.onceConsoleAPICalled() + ]; + InspectorTest.log('console.log message from function before patching:') + InspectorTest.logMessage(args[0]); + + const {result} = await Protocol.Debugger.setScriptSource({ + scriptId, + scriptSource: newModuleSource + }); + InspectorTest.log('Debugger.setScriptSource result:'); + InspectorTest.logMessage(result); + + contextGroup.addModule(callFooSource, 'callFoo'); + const { params: {args: patchedArgs } } = + await Protocol.Runtime.onceConsoleAPICalled(); + InspectorTest.log('console.log message from function after patching:') + InspectorTest.logMessage(patchedArgs[0]); + InspectorTest.completeTest(); +})() diff --git a/deps/v8/test/inspector/debugger/es6-module-set-script-source-expected.txt b/deps/v8/test/inspector/debugger/es6-module-set-script-source-expected.txt deleted file mode 100644 index cd0ef1fa6e..0000000000 --- a/deps/v8/test/inspector/debugger/es6-module-set-script-source-expected.txt +++ /dev/null @@ -1,8 +0,0 @@ -Checks that Debugger.setScriptSource doesn't crash with modules -{ - error : { - code : -32000 - message : Editing module's script is not supported. - } - id : <messageId> -} diff --git a/deps/v8/test/inspector/debugger/es6-module-set-script-source.js b/deps/v8/test/inspector/debugger/es6-module-set-script-source.js deleted file mode 100644 index 81d97b6d78..0000000000 --- a/deps/v8/test/inspector/debugger/es6-module-set-script-source.js +++ /dev/null @@ -1,33 +0,0 @@ -// Copyright 2017 the V8 project authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -let {session, contextGroup, Protocol} = InspectorTest.start('Checks that Debugger.setScriptSource doesn\'t crash with modules'); - -var module1 = ` -export function foo() { - return 42; -}`; - -var editedModule1 = ` -export function foo() { - return 239; -}`; - -var module2 = ` -import { foo } from 'module1'; -console.log(foo()); -`; - -var module1Id; -Protocol.Debugger.onScriptParsed(message => { - if (message.params.url === 'module1') - module1Id = message.params.scriptId; -}); -Protocol.Debugger.enable() - .then(() => contextGroup.addModule(module1, 'module1')) - .then(() => contextGroup.addModule(module2, 'module2')) - .then(() => InspectorTest.waitForPendingTasks()) - .then(() => Protocol.Debugger.setScriptSource({ scriptId: module1Id, scriptSource: editedModule1 })) - .then(InspectorTest.logMessage) - .then(InspectorTest.completeTest); diff --git a/deps/v8/test/inspector/debugger/eval-scopes-expected.txt b/deps/v8/test/inspector/debugger/eval-scopes-expected.txt index 71d6618c8e..4c93498c68 100644 --- a/deps/v8/test/inspector/debugger/eval-scopes-expected.txt +++ b/deps/v8/test/inspector/debugger/eval-scopes-expected.txt @@ -2,6 +2,12 @@ Tests that variables introduced in eval scopes are accessible { id : <messageId> result : { + internalProperties : [ + [0] : { + name : [[StableObjectId]] + value : <StablectObjectId> + } + ] result : [ [0] : { configurable : true diff --git a/deps/v8/test/inspector/debugger/evaluate-at-first-module-line-expected.txt b/deps/v8/test/inspector/debugger/evaluate-at-first-module-line-expected.txt new file mode 100644 index 0000000000..fe6e253104 --- /dev/null +++ b/deps/v8/test/inspector/debugger/evaluate-at-first-module-line-expected.txt @@ -0,0 +1,11 @@ +Evaluate at first line of module should not crash +{ + id : <messageId> + result : { + result : { + description : 0 + type : number + value : 0 + } + } +} diff --git a/deps/v8/test/inspector/debugger/evaluate-at-first-module-line.js b/deps/v8/test/inspector/debugger/evaluate-at-first-module-line.js new file mode 100644 index 0000000000..9f21e9fc39 --- /dev/null +++ b/deps/v8/test/inspector/debugger/evaluate-at-first-module-line.js @@ -0,0 +1,31 @@ +// Copyright 2018 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 {session, contextGroup, Protocol} = + InspectorTest.start('Evaluate at first line of module should not crash'); + +const utilsModule = `export function identity(value) { + return value; +}`; + +const mainModule = `import {identity} from 'utils'; +console.log(identity(0));`; + +(async function test() { + Protocol.Debugger.enable(); + Protocol.Debugger.setBreakpointByUrl({ + lineNumber: 1, + url: 'main' + }); + + contextGroup.addModule(utilsModule, 'utils'); + contextGroup.addModule(mainModule, 'main'); + const { params: { callFrames } } = await Protocol.Debugger.oncePaused(); + const result = await Protocol.Debugger.evaluateOnCallFrame({ + callFrameId: callFrames[0].callFrameId, + expression: 'identity(0)' + }); + InspectorTest.logMessage(result); + InspectorTest.completeTest(); +})() diff --git a/deps/v8/test/inspector/debugger/get-possible-breakpoints-class-fields-expected.txt b/deps/v8/test/inspector/debugger/get-possible-breakpoints-class-fields-expected.txt new file mode 100644 index 0000000000..8b6ff0d324 --- /dev/null +++ b/deps/v8/test/inspector/debugger/get-possible-breakpoints-class-fields-expected.txt @@ -0,0 +1,206 @@ +Checks Debugger.getPossibleBreakpoints for class fields +// Copyright 2017 the V8 project authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +let x = |R|class {} + +|_|x = |R|class { + x = |_|1; + y = |_|2|R|; +} + +|_|x = |R|class { + x = |C|foo(); + y = |_|2; + z = |C|bar()|R|; +} + +|_|x = class { + x = |C|foo(); + y = |_|2; + z = |C|bar()|R|; + constructor() { + this.|_|x; + |R|} +} + +|_|x = class { + x = |C|foo(); + y = |_|2; + constructor() { + this.|_|x; + |R|} + z = |C|bar()|R|; +} + +|_|x = class { + x = |C|foo(); + y = |_|2; + constructor() { + this.|_|x; + |R|} + z = |C|bar()|R|; +} + +|_|x = |R|class { + x = |_|1; + foo() {|R|} + y = |_|2|R|; +} + +|_|x = |R|class { + x = (function() { + |C|foo(); + |R|})|C|(); + y = (() => { + |C|bar(); + |R|})|C|()|R|; +} + +|_|x = |R|class { + x = |_|function() { + |C|foo(); + |R|}|R|; +} + +|_|x = |R|class { + x = |_|async function() { + |_|await |C|foo(); + |R|}|R|; +} + +|_|x = |R|class { + x = |_|() => { + |C|foo(); + |R|}; + y = |_|() => |C|bar()|R|; +} + +|_|x = |R|class { + x = |_|async () => { + |_|await |C|foo(); + |R|}; + y = |_|async () => |_|await |C|bar()|R|; +} + +|_|x = |R|class { + [|_|x] = |_|1; + [|C|foo()] = |_|2|R|; +} + +|_|x = |R|class { + [|_|x] = |_|[...this]|R|; +} + +|_|x = |R|class { + x; + [|C|foo()]|R|; +} + +|_|x = |R|class { + x = |_|function*|_|() { + |_|yield 1; + |R|}|R|; +} + +|_|x = |R|class { + static x = |_|1; + static y = |_|2|R|; +} + +|_|x = |R|class { + static x = |C|foo(); + static y = |_|2; + static z = |C|bar()|R|; +} + +|_|x = class { + static x = |C|foo(); + static y = |_|2; + static z = |C|bar()|R|; + constructor() { + this.|_|x; + |R|} +} + +|_|x = class { + static x = |C|foo(); + static y = |_|2; + constructor() { + this.|_|x; + |R|} + static z = |C|bar()|R|; +} + +|_|x = |R|class { + static x = |_|1; + static foo() {|R|} + bar() {|R|} + static y = |_|2|R|; +} + +|_|x = |R|class { + static x = (function() { + |C|foo(); + |R|})|C|(); + static y = (() => { + |C|bar(); + |R|})|C|()|R|; +} + +|_|x = |R|class { + static x = |_|function() { + |C|foo(); + |R|}|R|; +} + +|_|x = |R|class { + static x = |_|async function() { + |_|await |C|foo(); + |R|}|R|; +} + +|_|x = |R|class { + static x = |_|() => { + |C|foo(); + |R|}; + static y = |_|() => |C|bar()|R|; +} + +|_|x = |R|class { + static x = |_|async () => { + |_|await |C|foo(); + |R|}; + static y = |_|async () => |_|await |C|bar()|R|; +} + +|_|x = |R|class { + static [|_|x] = |_|1; + static [|C|foo()] = |_|2|R|; +} + +|_|x = |R|class { + static [|_|x] = |_|[...this]|R|; +} + +|_|x = |R|class { + static x; + static [|C|foo()]|R|; +} + +|_|x = |R|class { + static x = |_|function*|_|() { + |_|yield 1; + |R|}|R|; +} + +|_|x = |R|class { + static x = |_|1; + y = |_|2; + static [|_|z] = |_|3; + [|_|p] = |_|4; + static [|C|foo()] = |_|5|R|; + [|C|bar()] = |_|6|R|; +} +|R| diff --git a/deps/v8/test/inspector/debugger/get-possible-breakpoints-class-fields.js b/deps/v8/test/inspector/debugger/get-possible-breakpoints-class-fields.js new file mode 100644 index 0000000000..068fce2557 --- /dev/null +++ b/deps/v8/test/inspector/debugger/get-possible-breakpoints-class-fields.js @@ -0,0 +1,37 @@ +// Copyright 2018 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-public-fields --harmony-static-fields + +let { session, contextGroup, Protocol } = InspectorTest.start( + "Checks Debugger.getPossibleBreakpoints for class fields" +); + +(async function() { + session.setupScriptMap(); + await Protocol.Debugger.enable(); + + const source = utils.read( + "test/inspector/debugger/resources/break-locations-class-fields.js" + ); + + contextGroup.addScript(source); + + const { + params: { scriptId } + } = await Protocol.Debugger.onceScriptParsed(); + + const { + result: { locations } + } = await Protocol.Debugger.getPossibleBreakpoints({ + start: { + lineNumber: 0, + columnNumber: 0, + scriptId + } + }); + + session.logBreakLocations(locations); + InspectorTest.completeTest(); +})(); diff --git a/deps/v8/test/inspector/debugger/object-preview-internal-properties.js b/deps/v8/test/inspector/debugger/object-preview-internal-properties.js index a8e6bef637..fc7dabac1a 100644 --- a/deps/v8/test/inspector/debugger/object-preview-internal-properties.js +++ b/deps/v8/test/inspector/debugger/object-preview-internal-properties.js @@ -1,8 +1,6 @@ // 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. -// TODO(luoe): remove flag when it is on by default. -// Flags: --harmony-bigint let {session, contextGroup, Protocol} = InspectorTest.start("Check internal properties reported in object preview."); diff --git a/deps/v8/test/inspector/debugger/pause-on-promise-rejections-expected.txt b/deps/v8/test/inspector/debugger/pause-on-promise-rejections-expected.txt new file mode 100644 index 0000000000..e046eb3147 --- /dev/null +++ b/deps/v8/test/inspector/debugger/pause-on-promise-rejections-expected.txt @@ -0,0 +1,22 @@ +Test Debugger.paused reason for promise rejections +Check Promise.reject in script: +promiseRejection + +Check Promise.reject in Runtime.evaluate: +promiseRejection + +Check Promise.reject in async function: +promiseRejection + +Check throw in async function: +promiseRejection + +Check reject from constructor: +promiseRejection + +Check reject from thenable job: +promiseRejection + +Check caught exception in async function (should be exception): +exception + diff --git a/deps/v8/test/inspector/debugger/pause-on-promise-rejections.js b/deps/v8/test/inspector/debugger/pause-on-promise-rejections.js new file mode 100644 index 0000000000..f5342db529 --- /dev/null +++ b/deps/v8/test/inspector/debugger/pause-on-promise-rejections.js @@ -0,0 +1,68 @@ +// Copyright 2018 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 {session, contextGroup, Protocol} = + InspectorTest.start('Test Debugger.paused reason for promise rejections'); + +(async function test() { + Protocol.Debugger.enable(); + Protocol.Debugger.setPauseOnExceptions({state: 'all'}); + InspectorTest.log('Check Promise.reject in script:'); + contextGroup.addScript(`Promise.reject(new Error())`); + await logPausedReason(); + await Protocol.Debugger.resume(); + + InspectorTest.log('Check Promise.reject in Runtime.evaluate:'); + Protocol.Runtime.evaluate({expression: `Promise.reject(new Error())`}); + await logPausedReason(); + await Protocol.Debugger.resume(); + + InspectorTest.log('Check Promise.reject in async function:'); + Protocol.Runtime.evaluate( + {expression: `(async function() { await Promise.reject(); })()`}); + await logPausedReason(); + await Protocol.Debugger.resume(); + + InspectorTest.log('Check throw in async function:'); + Protocol.Runtime.evaluate({ + expression: `(async function() { await Promise.resolve(); throw 42; })()` + }); + await logPausedReason(); + await Protocol.Debugger.resume(); + + InspectorTest.log('Check reject from constructor:'); + Protocol.Runtime.evaluate({ + expression: 'new Promise((_, reject) => reject(new Error())).catch(e => {})' + }); + await logPausedReason(); + await Protocol.Debugger.resume(); + + InspectorTest.log('Check reject from thenable job:'); + Protocol.Runtime.evaluate({ + expression: + `Promise.resolve().then(() => Promise.reject(new Error())).catch(e => 0)` + }); + await logPausedReason(); + await Protocol.Debugger.resume(); + + InspectorTest.log( + 'Check caught exception in async function (should be exception):'); + Protocol.Runtime.evaluate({ + expression: `(async function() { + await Promise.resolve(); + try { + throw 42; + } catch (e) {} + })()` + }); + await logPausedReason(); + await Protocol.Debugger.resume(); + + InspectorTest.completeTest(); +})(); + +async function logPausedReason() { + const {params: {reason}} = await Protocol.Debugger.oncePaused(); + InspectorTest.log(reason + '\n'); +} diff --git a/deps/v8/test/inspector/debugger/resources/break-locations-class-fields.js b/deps/v8/test/inspector/debugger/resources/break-locations-class-fields.js new file mode 100644 index 0000000000..c576c0ed6e --- /dev/null +++ b/deps/v8/test/inspector/debugger/resources/break-locations-class-fields.js @@ -0,0 +1,204 @@ +// Copyright 2017 the V8 project authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +let x = class {} + +x = class { + x = 1; + y = 2; +} + +x = class { + x = foo(); + y = 2; + z = bar(); +} + +x = class { + x = foo(); + y = 2; + z = bar(); + constructor() { + this.x; + } +} + +x = class { + x = foo(); + y = 2; + constructor() { + this.x; + } + z = bar(); +} + +x = class { + x = foo(); + y = 2; + constructor() { + this.x; + } + z = bar(); +} + +x = class { + x = 1; + foo() {} + y = 2; +} + +x = class { + x = (function() { + foo(); + })(); + y = (() => { + bar(); + })(); +} + +x = class { + x = function() { + foo(); + }; +} + +x = class { + x = async function() { + await foo(); + }; +} + +x = class { + x = () => { + foo(); + }; + y = () => bar(); +} + +x = class { + x = async () => { + await foo(); + }; + y = async () => await bar(); +} + +x = class { + [x] = 1; + [foo()] = 2; +} + +x = class { + [x] = [...this]; +} + +x = class { + x; + [foo()]; +} + +x = class { + x = function*() { + yield 1; + }; +} + +x = class { + static x = 1; + static y = 2; +} + +x = class { + static x = foo(); + static y = 2; + static z = bar(); +} + +x = class { + static x = foo(); + static y = 2; + static z = bar(); + constructor() { + this.x; + } +} + +x = class { + static x = foo(); + static y = 2; + constructor() { + this.x; + } + static z = bar(); +} + +x = class { + static x = 1; + static foo() {} + bar() {} + static y = 2; +} + +x = class { + static x = (function() { + foo(); + })(); + static y = (() => { + bar(); + })(); +} + +x = class { + static x = function() { + foo(); + }; +} + +x = class { + static x = async function() { + await foo(); + }; +} + +x = class { + static x = () => { + foo(); + }; + static y = () => bar(); +} + +x = class { + static x = async () => { + await foo(); + }; + static y = async () => await bar(); +} + +x = class { + static [x] = 1; + static [foo()] = 2; +} + +x = class { + static [x] = [...this]; +} + +x = class { + static x; + static [foo()]; +} + +x = class { + static x = function*() { + yield 1; + }; +} + +x = class { + static x = 1; + y = 2; + static [z] = 3; + [p] = 4; + static [foo()] = 5; + [bar()] = 6; +} diff --git a/deps/v8/test/inspector/debugger/scope-skip-variables-with-empty-name-expected.txt b/deps/v8/test/inspector/debugger/scope-skip-variables-with-empty-name-expected.txt index 626f9787c3..6fbe355eff 100644 --- a/deps/v8/test/inspector/debugger/scope-skip-variables-with-empty-name-expected.txt +++ b/deps/v8/test/inspector/debugger/scope-skip-variables-with-empty-name-expected.txt @@ -2,6 +2,12 @@ Tests that scopes do not report variables with empty names { id : <messageId> result : { + internalProperties : [ + [0] : { + name : [[StableObjectId]] + value : <StablectObjectId> + } + ] result : [ [0] : { configurable : true diff --git a/deps/v8/test/inspector/debugger/script-on-after-compile-expected.txt b/deps/v8/test/inspector/debugger/script-on-after-compile-expected.txt index 702026b2e0..2079518424 100644 --- a/deps/v8/test/inspector/debugger/script-on-after-compile-expected.txt +++ b/deps/v8/test/inspector/debugger/script-on-after-compile-expected.txt @@ -658,6 +658,24 @@ scriptParsed } scriptFailedToParse { + scriptSource : {a:2:<nl>//# sourceURL=http://a.js +} +{ + endColumn : 25 + endLine : 1 + executionContextId : <executionContextId> + hasSourceURL : true + hash : 33c5612558c02e5a3bfa0d098c82865f38f98df2 + isModule : false + length : 31 + scriptId : <scriptId> + sourceMapURL : + startColumn : 0 + startLine : 0 + url : http://a.js +} +scriptFailedToParse +{ scriptSource : }//# sourceURL=failed.js<nl>//# sourceMappingURL=failed-map } { diff --git a/deps/v8/test/inspector/debugger/script-on-after-compile.js b/deps/v8/test/inspector/debugger/script-on-after-compile.js index 544dbaaae2..b37bfddf44 100644 --- a/deps/v8/test/inspector/debugger/script-on-after-compile.js +++ b/deps/v8/test/inspector/debugger/script-on-after-compile.js @@ -33,6 +33,8 @@ function addScripts() { .then(() => addScript("function foo13(){}")) // script in eval .then(() => addScript("function foo15(){}; eval(\"function foo14(){}//# sourceURL=eval.js\")//# sourceURL=eval-wrapper.js")) + // // inside sourceURL + .then(() => addScript("{a:2:\n//# sourceURL=http://a.js")) // sourceURL and sourceMappingURL works even for script with syntax error .then(() => addScript("}//# sourceURL=failed.js\n//# sourceMappingURL=failed-map")) // empty lines at end diff --git a/deps/v8/test/inspector/debugger/this-in-arrow-function-expected.txt b/deps/v8/test/inspector/debugger/this-in-arrow-function-expected.txt index 3532183b66..69bc9dde41 100644 --- a/deps/v8/test/inspector/debugger/this-in-arrow-function-expected.txt +++ b/deps/v8/test/inspector/debugger/this-in-arrow-function-expected.txt @@ -98,10 +98,10 @@ This on callFrame: } This in evaluateOnCallFrame: { - className : Object - description : Object + className : global + description : global objectId : <objectId> type : object } -Values equal: false +Values equal: true 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 new file mode 100644 index 0000000000..34f9cf1df9 --- /dev/null +++ b/deps/v8/test/inspector/debugger/wasm-stepping-with-source-map-expected.txt @@ -0,0 +1,308 @@ +Tests stepping through wasm scripts with source maps +Installing code an global variable and instantiate. +Got wasm script: wasm-9b4bf87e +Script sourceMapURL: abc +Requesting source for wasm-9b4bf87e... +Source retrieved without error: true +Setting breakpoint on offset 54 (on the setlocal before the call), url wasm-9b4bf87e +{ + columnNumber : 54 + lineNumber : 0 + scriptId : <scriptId> +} +Paused at wasm-9b4bf87e:0:54 +at wasm_B (0:54): + - scope (global): + -- skipped + - scope (local): + locals: {"arg#0":4} + stack: {"0":3} +at (anonymous) (0:17): + - scope (global): + -- skipped +Debugger.stepInto called +Paused at wasm-9b4bf87e:0:56 +at wasm_B (0:56): + - scope (global): + -- skipped + - scope (local): + locals: {"arg#0":3} + stack: {} +at (anonymous) (0:17): + - scope (global): + -- skipped +Debugger.stepInto called +Paused at wasm-9b4bf87e:0:38 +at wasm_A (0:38): + - scope (global): + -- skipped + - scope (local): + stack: {} +at wasm_B (0:56): + - scope (global): + -- skipped + - scope (local): + locals: {"arg#0":3} + stack: {} +at (anonymous) (0:17): + - scope (global): + -- skipped +Debugger.stepOver called +Paused at wasm-9b4bf87e:0:39 +at wasm_A (0:39): + - scope (global): + -- skipped + - scope (local): + stack: {} +at wasm_B (0:56): + - scope (global): + -- skipped + - scope (local): + locals: {"arg#0":3} + stack: {} +at (anonymous) (0:17): + - scope (global): + -- skipped +Debugger.stepOut called +Paused at wasm-9b4bf87e:0:58 +at wasm_B (0:58): + - scope (global): + -- skipped + - scope (local): + locals: {"arg#0":3} + stack: {} +at (anonymous) (0:17): + - scope (global): + -- skipped +Debugger.stepOut called +Paused at wasm-9b4bf87e:0:54 +at wasm_B (0:54): + - scope (global): + -- skipped + - scope (local): + locals: {"arg#0":3} + stack: {"0":2} +at (anonymous) (0:17): + - scope (global): + -- skipped +Debugger.stepOver called +Paused at wasm-9b4bf87e:0:56 +at wasm_B (0:56): + - scope (global): + -- skipped + - scope (local): + locals: {"arg#0":2} + stack: {} +at (anonymous) (0:17): + - scope (global): + -- skipped +Debugger.stepOver called +Paused at wasm-9b4bf87e:0:58 +at wasm_B (0:58): + - scope (global): + -- skipped + - scope (local): + locals: {"arg#0":2} + stack: {} +at (anonymous) (0:17): + - scope (global): + -- skipped +Debugger.resume called +Paused at wasm-9b4bf87e:0:54 +at wasm_B (0:54): + - scope (global): + -- skipped + - scope (local): + locals: {"arg#0":2} + stack: {"0":1} +at (anonymous) (0:17): + - scope (global): + -- skipped +Debugger.stepInto called +Paused at wasm-9b4bf87e:0:56 +at wasm_B (0:56): + - scope (global): + -- skipped + - scope (local): + locals: {"arg#0":1} + stack: {} +at (anonymous) (0:17): + - scope (global): + -- skipped +Debugger.stepInto called +Paused at wasm-9b4bf87e:0:38 +at wasm_A (0:38): + - scope (global): + -- skipped + - scope (local): + stack: {} +at wasm_B (0:56): + - scope (global): + -- skipped + - scope (local): + locals: {"arg#0":1} + stack: {} +at (anonymous) (0:17): + - scope (global): + -- skipped +Debugger.stepOut called +Paused at wasm-9b4bf87e:0:58 +at wasm_B (0:58): + - scope (global): + -- skipped + - scope (local): + locals: {"arg#0":1} + stack: {} +at (anonymous) (0:17): + - scope (global): + -- skipped +Debugger.stepInto called +Paused at wasm-9b4bf87e:0:43 +at wasm_B (0:43): + - scope (global): + -- skipped + - scope (local): + locals: {"arg#0":1} + stack: {} +at (anonymous) (0:17): + - scope (global): + -- skipped +Debugger.stepInto called +Paused at wasm-9b4bf87e:0:45 +at wasm_B (0:45): + - scope (global): + -- skipped + - scope (local): + locals: {"arg#0":1} + stack: {} +at (anonymous) (0:17): + - scope (global): + -- skipped +Debugger.stepInto called +Paused at wasm-9b4bf87e:0:47 +at wasm_B (0:47): + - scope (global): + -- skipped + - scope (local): + locals: {"arg#0":1} + stack: {"0":1} +at (anonymous) (0:17): + - scope (global): + -- skipped +Debugger.stepInto called +Paused at wasm-9b4bf87e:0:49 +at wasm_B (0:49): + - scope (global): + -- skipped + - scope (local): + locals: {"arg#0":1} + stack: {} +at (anonymous) (0:17): + - scope (global): + -- skipped +Debugger.stepInto called +Paused at wasm-9b4bf87e:0:51 +at wasm_B (0:51): + - scope (global): + -- skipped + - scope (local): + locals: {"arg#0":1} + stack: {"0":1} +at (anonymous) (0:17): + - scope (global): + -- skipped +Debugger.stepInto called +Paused at wasm-9b4bf87e:0:53 +at wasm_B (0:53): + - scope (global): + -- skipped + - scope (local): + locals: {"arg#0":1} + stack: {"0":1,"1":1} +at (anonymous) (0:17): + - scope (global): + -- skipped +Debugger.stepInto called +Paused at wasm-9b4bf87e:0:54 +at wasm_B (0:54): + - scope (global): + -- skipped + - scope (local): + locals: {"arg#0":1} + stack: {"0":0} +at (anonymous) (0:17): + - scope (global): + -- skipped +Debugger.stepInto called +Paused at wasm-9b4bf87e:0:56 +at wasm_B (0:56): + - scope (global): + -- skipped + - scope (local): + locals: {"arg#0":0} + stack: {} +at (anonymous) (0:17): + - scope (global): + -- skipped +Debugger.stepInto called +Paused at wasm-9b4bf87e:0:38 +at wasm_A (0:38): + - scope (global): + -- skipped + - scope (local): + stack: {} +at wasm_B (0:56): + - scope (global): + -- skipped + - scope (local): + locals: {"arg#0":0} + stack: {} +at (anonymous) (0:17): + - scope (global): + -- skipped +Debugger.stepInto called +Paused at wasm-9b4bf87e:0:39 +at wasm_A (0:39): + - scope (global): + -- skipped + - scope (local): + stack: {} +at wasm_B (0:56): + - scope (global): + -- skipped + - scope (local): + locals: {"arg#0":0} + stack: {} +at (anonymous) (0:17): + - scope (global): + -- skipped +Debugger.stepInto called +Paused at wasm-9b4bf87e:0:40 +at wasm_A (0:40): + - scope (global): + -- skipped + - scope (local): + stack: {} +at wasm_B (0:56): + - scope (global): + -- skipped + - scope (local): + locals: {"arg#0":0} + stack: {} +at (anonymous) (0:17): + - scope (global): + -- skipped +Debugger.stepInto called +Paused at wasm-9b4bf87e:0:58 +at wasm_B (0:58): + - scope (global): + -- skipped + - scope (local): + locals: {"arg#0":0} + stack: {} +at (anonymous) (0:17): + - scope (global): + -- skipped +Debugger.resume called +exports.main returned! +Finished! 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 new file mode 100644 index 0000000000..7732e1396e --- /dev/null +++ b/deps/v8/test/inspector/debugger/wasm-stepping-with-source-map.js @@ -0,0 +1,123 @@ +// Copyright 2018 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 stepping through wasm scripts with source maps'); + +utils.load('test/mjsunit/wasm/wasm-constants.js'); +utils.load('test/mjsunit/wasm/wasm-module-builder.js'); + +var builder = new WasmModuleBuilder(); + +var func_a_idx = + builder.addFunction('wasm_A', kSig_v_v).addBody([kExprNop, kExprNop]).index; + +// wasm_B calls wasm_A <param0> times. +builder.addFunction('wasm_B', kSig_v_i) + .addBody([ + // clang-format off + kExprLoop, kWasmStmt, // while + kExprGetLocal, 0, // - + kExprIf, kWasmStmt, // if <param0> != 0 + kExprGetLocal, 0, // - + kExprI32Const, 1, // - + kExprI32Sub, // - + kExprSetLocal, 0, // decrease <param0> + kExprCallFunction, func_a_idx, // - + kExprBr, 1, // continue + kExprEnd, // - + kExprEnd, // break + // clang-format on + ]) + .exportAs('main'); + +builder.addCustomSection('sourceMappingURL', [3, 97, 98, 99]); + +var 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) { + view[i] = bytes[i] | 0; + } + + var module = new WebAssembly.Module(buffer); + // Set global variable. + instance = new WebAssembly.Instance(module); +} + +(async function test() { + for (const action of ['stepInto', 'stepOver', 'stepOut', 'resume']) + InspectorTest.logProtocolCommandCalls('Debugger.' + action); + + await Protocol.Debugger.enable(); + InspectorTest.log('Installing code an global variable and instantiate.'); + Protocol.Runtime.evaluate({ + expression: `var instance;(${instantiate.toString()})(${JSON.stringify(module_bytes)})`}); + const [, {params: wasmScript}] = await Protocol.Debugger.onceScriptParsed(2); + + InspectorTest.log('Got wasm script: ' + wasmScript.url); + InspectorTest.log('Script sourceMapURL: ' + wasmScript.sourceMapURL); + InspectorTest.log('Requesting source for ' + wasmScript.url + '...'); + const msg = + await Protocol.Debugger.getScriptSource({scriptId: wasmScript.scriptId}); + InspectorTest.log(`Source retrieved without error: ${!msg.error}`); + InspectorTest.log( + `Setting breakpoint on offset 54 (on the setlocal before the call), url ${wasmScript.url}`); + const {result: {actualLocation}} = await Protocol.Debugger.setBreakpoint({ + location:{scriptId: wasmScript.scriptId, lineNumber: 0, columnNumber: 54}}); + InspectorTest.logMessage(actualLocation); + Protocol.Runtime.evaluate({expression: 'instance.exports.main(4)'}); + await waitForPauseAndStep('stepInto'); // == stepOver, to call instruction + await waitForPauseAndStep('stepInto'); // into call to wasm_A + await waitForPauseAndStep('stepOver'); // over first nop + await waitForPauseAndStep('stepOut'); // out of wasm_A + await waitForPauseAndStep('stepOut'); // out of wasm_B, stop on breakpoint again + await waitForPauseAndStep('stepOver'); // to call + await waitForPauseAndStep('stepOver'); // over call + await waitForPauseAndStep('resume'); // to next breakpoint (third iteration) + await waitForPauseAndStep('stepInto'); // to call + await waitForPauseAndStep('stepInto'); // into wasm_A + await waitForPauseAndStep('stepOut'); // out to wasm_B + // now step 9 times, until we are in wasm_A again. + for (let i = 0; i < 9; ++i) await waitForPauseAndStep('stepInto'); + // 3 more times, back to wasm_B. + for (let i = 0; i < 3; ++i) await waitForPauseAndStep('stepInto'); + // then just resume. + await waitForPauseAndStep('resume'); + InspectorTest.log('exports.main returned!'); + InspectorTest.log('Finished!'); + InspectorTest.completeTest(); +})(); + +async function waitForPauseAndStep(stepAction) { + const {params: {callFrames}} = await Protocol.Debugger.oncePaused(); + const topFrame = callFrames[0]; + InspectorTest.log( + `Paused at ${topFrame.url}:${topFrame.location.lineNumber}:${topFrame.location.columnNumber}`); + for (var frame of callFrames) { + const functionName = frame.functionName || '(anonymous)'; + const lineNumber = frame.location.lineNumber; + const columnNumber = frame.location.columnNumber; + InspectorTest.log(`at ${functionName} (${lineNumber}:${columnNumber}):`); + for (var scope of frame.scopeChain) { + InspectorTest.logObject(' - scope (' + scope.type + '):'); + if (scope.type === 'global') { + InspectorTest.logObject(' -- skipped'); + } else { + const {result: {result: {value}}} = + await Protocol.Runtime.callFunctionOn({ + objectId: scope.object.objectId, + functionDeclaration: 'function() { return this; }', + returnByValue: true + }); + if (value.locals) + InspectorTest.log(` locals: ${JSON.stringify(value.locals)}`); + InspectorTest.log(` stack: ${JSON.stringify(value.stack)}`); + } + } + } + Protocol.Debugger[stepAction](); +} diff --git a/deps/v8/test/inspector/inspector-test.cc b/deps/v8/test/inspector/inspector-test.cc index dbb4493e66..d69ee6f4e2 100644 --- a/deps/v8/test/inspector/inspector-test.cc +++ b/deps/v8/test/inspector/inspector-test.cc @@ -86,7 +86,7 @@ class FrontendChannelImpl : public v8_inspector::V8Inspector::Channel { : task_runner_(task_runner), context_group_id_(context_group_id), function_(isolate, function) {} - virtual ~FrontendChannelImpl() = default; + ~FrontendChannelImpl() override = default; void set_session_id(int session_id) { session_id_ = session_id; } @@ -109,7 +109,7 @@ class FrontendChannelImpl : public v8_inspector::V8Inspector::Channel { SendMessageTask(FrontendChannelImpl* channel, const std::vector<uint16_t>& message) : channel_(channel), message_(message) {} - virtual ~SendMessageTask() {} + ~SendMessageTask() override = default; bool is_priority_task() final { return false; } private: @@ -142,7 +142,7 @@ void RunSyncTask(TaskRunner* task_runner, T callback) { public: SyncTask(v8::base::Semaphore* ready_semaphore, T callback) : ready_semaphore_(ready_semaphore), callback_(callback) {} - virtual ~SyncTask() = default; + ~SyncTask() override = default; bool is_priority_task() final { return true; } private: @@ -182,7 +182,7 @@ void RunAsyncTask(TaskRunner* task_runner, class AsyncTask : public TaskRunner::Task { public: explicit AsyncTask(TaskRunner::Task* inner) : inner_(inner) {} - virtual ~AsyncTask() = default; + ~AsyncTask() override = default; bool is_priority_task() override { return inner_->is_priority_task(); } void Run(IsolateData* data) override { data->AsyncTaskStarted(inner_.get()); @@ -216,8 +216,7 @@ class ExecuteStringTask : public TaskRunner::Task { ExecuteStringTask(const std::string& expression, int context_group_id) : expression_utf8_(expression), context_group_id_(context_group_id) {} - virtual ~ExecuteStringTask() { - } + ~ExecuteStringTask() override = default; bool is_priority_task() override { return false; } void Run(IsolateData* data) override { v8::MicrotasksScope microtasks_scope(data->isolate(), @@ -595,7 +594,7 @@ class SetTimeoutTask : public TaskRunner::Task { SetTimeoutTask(int context_group_id, v8::Isolate* isolate, v8::Local<v8::Function> function) : function_(isolate, function), context_group_id_(context_group_id) {} - virtual ~SetTimeoutTask() {} + ~SetTimeoutTask() override = default; bool is_priority_task() final { return false; } private: diff --git a/deps/v8/test/inspector/inspector.status b/deps/v8/test/inspector/inspector.status index 25ffec6180..56a92c0dfc 100644 --- a/deps/v8/test/inspector/inspector.status +++ b/deps/v8/test/inspector/inspector.status @@ -3,6 +3,21 @@ # found in the LICENSE file. [ +############################################################################## +[ALWAYS, { + # https://crbug.com/v8/7767 + 'debugger/wasm-imports': [SKIP], + # https://crbug.com/v8/7932 + 'runtime/command-line-api-without-side-effects': [SKIP], +}], # ALWAYS + +############################################################################## +['system == android', { + # https://crbug.com/v8/8160 + 'debugger/stepping-with-exposed-injected-script': [FAIL], + # https://crbug.com/v8/8197 + 'debugger/get-possible-breakpoints-class-fields': [SKIP], +}], # 'system == android' ############################################################################## ['variant != default', { @@ -24,10 +39,4 @@ # Stack manipulations in LiveEdit is not implemented for this arch. 'debugger/set-script-source-stack-padding': [SKIP], }], # 'arch == s390 or arch == s390x' - -############################################################################## -[ALWAYS, { - # https://crbug.com/v8/7767 - 'debugger/wasm-imports': [SKIP], -}], # ALWAYS ] diff --git a/deps/v8/test/inspector/isolate-data.cc b/deps/v8/test/inspector/isolate-data.cc index 57b9af57c2..15690370cc 100644 --- a/deps/v8/test/inspector/isolate-data.cc +++ b/deps/v8/test/inspector/isolate-data.cc @@ -44,7 +44,7 @@ class Inspectable : public v8_inspector::V8InspectorSession::Inspectable { public: Inspectable(v8::Isolate* isolate, v8::Local<v8::Value> object) : object_(isolate, object) {} - ~Inspectable() override {} + ~Inspectable() override = default; v8::Local<v8::Value> get(v8::Local<v8::Context> context) override { return object_.Get(context->GetIsolate()); } diff --git a/deps/v8/test/inspector/protocol-test.js b/deps/v8/test/inspector/protocol-test.js index a941280672..d395808b91 100644 --- a/deps/v8/test/inspector/protocol-test.js +++ b/deps/v8/test/inspector/protocol-test.js @@ -45,6 +45,8 @@ InspectorTest.logMessage = function(originalMessage) { var objects = [ message ]; while (objects.length) { var object = objects.shift(); + if (object && object.name === '[[StableObjectId]]') + object.value = '<StablectObjectId>'; for (var key in object) { if (nonStableFields.has(key)) object[key] = `<${key}>`; @@ -335,7 +337,8 @@ InspectorTest.Session = class { var eventName = match[2]; eventName = eventName.charAt(0).toLowerCase() + eventName.slice(1); if (match[1]) - return () => this._waitForEventPromise(`${agentName}.${eventName}`); + return numOfEvents => this._waitForEventPromise( + `${agentName}.${eventName}`, numOfEvents || 1); return listener => this._eventHandlers.set(`${agentName}.${eventName}`, listener); } })}); @@ -369,11 +372,16 @@ InspectorTest.Session = class { } }; - _waitForEventPromise(eventName) { + _waitForEventPromise(eventName, numOfEvents) { + let events = []; return new Promise(fulfill => { this._eventHandlers.set(eventName, result => { - delete this._eventHandlers.delete(eventName); - fulfill(result); + --numOfEvents; + events.push(result); + if (numOfEvents === 0) { + delete this._eventHandlers.delete(eventName); + fulfill(events.length > 1 ? events : events[0]); + } }); }); } diff --git a/deps/v8/test/inspector/runtime/call-function-on-async.js b/deps/v8/test/inspector/runtime/call-function-on-async.js index c5f1152979..ab146e1c4d 100644 --- a/deps/v8/test/inspector/runtime/call-function-on-async.js +++ b/deps/v8/test/inspector/runtime/call-function-on-async.js @@ -1,8 +1,6 @@ // 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. -// TODO(luoe): remove flag when it is on by default. -// Flags: --harmony-bigint let {session, contextGroup, Protocol} = InspectorTest.start('Tests that Runtime.callFunctionOn works with awaitPromise flag.'); let callFunctionOn = Protocol.Runtime.callFunctionOn.bind(Protocol.Runtime); diff --git a/deps/v8/test/inspector/runtime/compile-script-expected.txt b/deps/v8/test/inspector/runtime/compile-script-expected.txt index 23e6a64dc5..7058da9c75 100644 --- a/deps/v8/test/inspector/runtime/compile-script-expected.txt +++ b/deps/v8/test/inspector/runtime/compile-script-expected.txt @@ -6,7 +6,7 @@ compilation result: id : <messageId> result : { exceptionDetails : { - columnNumber : 2 + columnNumber : 3 exception : { className : SyntaxError description : SyntaxError: Unexpected end of input diff --git a/deps/v8/test/inspector/runtime/console-context-expected.txt b/deps/v8/test/inspector/runtime/console-context-expected.txt index f2d414bb49..658238aaa2 100644 --- a/deps/v8/test/inspector/runtime/console-context-expected.txt +++ b/deps/v8/test/inspector/runtime/console-context-expected.txt @@ -28,9 +28,10 @@ console.context() methods: [15] : assert [16] : profile [17] : profileEnd - [18] : time - [19] : timeEnd - [20] : timeStamp + [18] : timeLog + [19] : time + [20] : timeEnd + [21] : timeStamp ] Running test: testDefaultConsoleContext diff --git a/deps/v8/test/inspector/runtime/console-time-log-expected.txt b/deps/v8/test/inspector/runtime/console-time-log-expected.txt new file mode 100644 index 0000000000..4cf9e408a3 --- /dev/null +++ b/deps/v8/test/inspector/runtime/console-time-log-expected.txt @@ -0,0 +1,37 @@ +Test for console.timeLog +[ + [0] : { + type : string + value : 42: 1ms + } + [1] : { + type : string + value : a + } +] +[ + [0] : { + type : string + value : 42: 2ms + } + [1] : { + type : string + value : a + } + [2] : { + type : string + value : b + } +] +[ + [0] : { + type : string + value : 42: 3ms + } +] +[ + [0] : { + type : string + value : Timer '42' does not exist + } +] diff --git a/deps/v8/test/inspector/runtime/console-time-log.js b/deps/v8/test/inspector/runtime/console-time-log.js new file mode 100644 index 0000000000..83683ec26a --- /dev/null +++ b/deps/v8/test/inspector/runtime/console-time-log.js @@ -0,0 +1,29 @@ +// Copyright 2018 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 {session, contextGroup, Protocol} = + InspectorTest.start('Test for console.timeLog'); + +(async function test() { + Protocol.Runtime.enable(); + utils.setCurrentTimeMSForTest(0.0); + await Protocol.Runtime.evaluate({expression: `console.time('42')`}); + utils.setCurrentTimeMSForTest(1.0); + Protocol.Runtime.evaluate({expression: `console.timeLog('42', 'a')`}); + logArgs(await Protocol.Runtime.onceConsoleAPICalled()); + utils.setCurrentTimeMSForTest(2.0); + Protocol.Runtime.evaluate({expression: `console.timeLog('42', 'a', 'b')`}); + logArgs(await Protocol.Runtime.onceConsoleAPICalled()); + utils.setCurrentTimeMSForTest(3.0); + Protocol.Runtime.evaluate({expression: `console.timeEnd('42')`}); + logArgs(await Protocol.Runtime.onceConsoleAPICalled()); + utils.setCurrentTimeMSForTest(4.0); + Protocol.Runtime.evaluate({expression: `console.timeLog('42', 'text')`}); + logArgs(await Protocol.Runtime.onceConsoleAPICalled()); + InspectorTest.completeTest(); +})() + +function logArgs(message) { + InspectorTest.logMessage(message.params.args); +} diff --git a/deps/v8/test/inspector/runtime/error-preview-expected.txt b/deps/v8/test/inspector/runtime/error-preview-expected.txt new file mode 100644 index 0000000000..a3ebab2ff4 --- /dev/null +++ b/deps/v8/test/inspector/runtime/error-preview-expected.txt @@ -0,0 +1,8 @@ +Checks preview for Error object +{ + className : TypeError + description : TypeError: []. at is not a function at <anonymous>:1:15 + objectId : <objectId> + subtype : error + type : object +} diff --git a/deps/v8/test/inspector/runtime/error-preview.js b/deps/v8/test/inspector/runtime/error-preview.js new file mode 100644 index 0000000000..bb08edb687 --- /dev/null +++ b/deps/v8/test/inspector/runtime/error-preview.js @@ -0,0 +1,15 @@ +// Copyright 2018 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 {session, contextGroup, Protocol} = InspectorTest.start( + 'Checks preview for Error object'); + +(async function test() { + const { result: { result } } = await Protocol.Runtime.evaluate({ + expression: `[]['\\n at']()`, + generatePreview: true + }); + InspectorTest.logMessage(result); + InspectorTest.completeTest(); +})() diff --git a/deps/v8/test/inspector/runtime/es6-module-expected.txt b/deps/v8/test/inspector/runtime/es6-module-expected.txt index 25ba52e034..051ef6ceae 100644 --- a/deps/v8/test/inspector/runtime/es6-module-expected.txt +++ b/deps/v8/test/inspector/runtime/es6-module-expected.txt @@ -128,6 +128,12 @@ console.log(239) { id : <messageId> result : { + internalProperties : [ + [0] : { + name : [[StableObjectId]] + value : <StablectObjectId> + } + ] result : [ [0] : { configurable : true diff --git a/deps/v8/test/inspector/runtime/evaluate-unserializable.js b/deps/v8/test/inspector/runtime/evaluate-unserializable.js index 462af53f09..8876db5add 100644 --- a/deps/v8/test/inspector/runtime/evaluate-unserializable.js +++ b/deps/v8/test/inspector/runtime/evaluate-unserializable.js @@ -1,8 +1,6 @@ // Copyright 2018 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. -// TODO(luoe): remove flag when it is on by default. -// Flags: --harmony-bigint let {session, contextGroup, Protocol} = InspectorTest.start("Tests Runtime.evaluate with unserializable results."); diff --git a/deps/v8/test/inspector/runtime/evaluate-with-generate-preview.js b/deps/v8/test/inspector/runtime/evaluate-with-generate-preview.js index 081a93c64a..6d6787ab56 100644 --- a/deps/v8/test/inspector/runtime/evaluate-with-generate-preview.js +++ b/deps/v8/test/inspector/runtime/evaluate-with-generate-preview.js @@ -1,8 +1,6 @@ // 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. -// TODO(luoe): remove flag when it is on by default. -// Flags: --harmony-bigint let {session, contextGroup, Protocol} = InspectorTest.start("Tests that Runtime.evaluate will generate correct previews."); diff --git a/deps/v8/test/inspector/runtime/get-properties-expected.txt b/deps/v8/test/inspector/runtime/get-properties-expected.txt index 8b48e65c3b..5707ffc5af 100644 --- a/deps/v8/test/inspector/runtime/get-properties-expected.txt +++ b/deps/v8/test/inspector/runtime/get-properties-expected.txt @@ -5,6 +5,7 @@ Running test: testObject5 foo own string cat Internal properties [[PrimitiveValue]] number 5 + [[StableObjectId]]: <stableObjectId> Running test: testNotOwn __defineGetter__ inherited function undefined @@ -23,6 +24,8 @@ Running test: testNotOwn toLocaleString inherited function undefined toString inherited function undefined valueOf inherited function undefined +Internal properties + [[StableObjectId]]: <stableObjectId> Running test: testAccessorsOnly b own no value, getter, setter @@ -34,6 +37,8 @@ Running test: testArray 2 own string blue __proto__ own object undefined length own number 3 +Internal properties + [[StableObjectId]]: <stableObjectId> Running test: testBound __proto__ own function undefined @@ -42,14 +47,19 @@ Running test: testBound Internal properties [[BoundArgs]] object undefined [[BoundThis]] object undefined + [[StableObjectId]]: <stableObjectId> [[TargetFunction]] function undefined Running test: testObjectThrowsLength __proto__ own object undefined length own no value, getter +Internal properties + [[StableObjectId]]: <stableObjectId> Running test: testTypedArrayWithoutLength __proto__ own object undefined +Internal properties + [[StableObjectId]]: <stableObjectId> Running test: testArrayBuffer [[Int8Array]] @@ -62,6 +72,8 @@ Running test: testArrayBuffer 6 own number 1 7 own number 1 __proto__ own object undefined +Internal properties + [[StableObjectId]]: <stableObjectId> [[Uint8Array]] 0 own number 1 1 own number 1 @@ -72,18 +84,26 @@ Running test: testArrayBuffer 6 own number 1 7 own number 1 __proto__ own object undefined +Internal properties + [[StableObjectId]]: <stableObjectId> [[Int16Array]] 0 own number 257 1 own number 257 2 own number 257 3 own number 257 __proto__ own object undefined +Internal properties + [[StableObjectId]]: <stableObjectId> [[Int32Array]] 0 own number 16843009 1 own number 16843009 __proto__ own object undefined +Internal properties + [[StableObjectId]]: <stableObjectId> Running test: testArrayBufferWithBrokenUintCtor [[Int8Array]] own object undefined [[Uint8Array]] own object undefined __proto__ own object undefined +Internal properties + [[StableObjectId]]: <stableObjectId> diff --git a/deps/v8/test/inspector/runtime/get-properties-on-proxy-expected.txt b/deps/v8/test/inspector/runtime/get-properties-on-proxy-expected.txt index a0437f4af6..efde782ae3 100644 --- a/deps/v8/test/inspector/runtime/get-properties-on-proxy-expected.txt +++ b/deps/v8/test/inspector/runtime/get-properties-on-proxy-expected.txt @@ -54,6 +54,10 @@ Testing regular Proxy value : false } } + [3] : { + name : [[StableObjectId]] + value : <StablectObjectId> + } ] result : [ ] @@ -114,6 +118,10 @@ Testing revocable Proxy value : false } } + [3] : { + name : [[StableObjectId]] + value : <StablectObjectId> + } ] result : [ ] @@ -166,6 +174,10 @@ Testing revocable Proxy value : true } } + [3] : { + name : [[StableObjectId]] + value : <StablectObjectId> + } ] result : [ ] diff --git a/deps/v8/test/inspector/runtime/get-properties.js b/deps/v8/test/inspector/runtime/get-properties.js index d2b2c754a3..0386fdea6d 100644 --- a/deps/v8/test/inspector/runtime/get-properties.js +++ b/deps/v8/test/inspector/runtime/get-properties.js @@ -94,7 +94,10 @@ async function logGetPropertiesResult(objectId, flags = { ownProperties: true }) for (var i = 0; i < internalPropertyArray.length; i++) { var p = internalPropertyArray[i]; var v = p.value; - InspectorTest.log(" " + p.name + " " + v.type + " " + v.value); + if (p.name !== '[[StableObjectId]]') + InspectorTest.log(" " + p.name + " " + v.type + " " + v.value); + else + InspectorTest.log(" [[StableObjectId]]: <stableObjectId>"); } } diff --git a/deps/v8/test/inspector/runtime/internal-properties-entries-expected.txt b/deps/v8/test/inspector/runtime/internal-properties-entries-expected.txt index d395067efe..1d09e8dc1e 100644 --- a/deps/v8/test/inspector/runtime/internal-properties-entries-expected.txt +++ b/deps/v8/test/inspector/runtime/internal-properties-entries-expected.txt @@ -15,6 +15,12 @@ expression: new Map([[1,2],[3,4]]) { id : <messageId> result : { + internalProperties : [ + [0] : { + name : [[StableObjectId]] + value : <StablectObjectId> + } + ] result : [ [0] : { configurable : true @@ -65,6 +71,12 @@ expression: new Map() { id : <messageId> result : { + internalProperties : [ + [0] : { + name : [[StableObjectId]] + value : <StablectObjectId> + } + ] result : [ [0] : { configurable : false @@ -97,6 +109,12 @@ expression: new Map([[1,2],[3,4]]).entries() { id : <messageId> result : { + internalProperties : [ + [0] : { + name : [[StableObjectId]] + value : <StablectObjectId> + } + ] result : [ [0] : { configurable : true @@ -151,6 +169,12 @@ expression: it = new Map([[1,2],[3,4]]).entries(); it.next(); it { id : <messageId> result : { + internalProperties : [ + [0] : { + name : [[StableObjectId]] + value : <StablectObjectId> + } + ] result : [ [0] : { configurable : true @@ -190,6 +214,12 @@ expression: it = new Map([[1,2],[3,4]]).keys(); it.next(); it { id : <messageId> result : { + internalProperties : [ + [0] : { + name : [[StableObjectId]] + value : <StablectObjectId> + } + ] result : [ [0] : { configurable : true @@ -229,6 +259,12 @@ expression: it = new Map([[1,2],[3,4]]).values(); it.next(); it { id : <messageId> result : { + internalProperties : [ + [0] : { + name : [[StableObjectId]] + value : <StablectObjectId> + } + ] result : [ [0] : { configurable : true @@ -265,6 +301,12 @@ expression: it = new Map([[1,2],[3,4]]).entries(); it.next(); it.next(); it { id : <messageId> result : { + internalProperties : [ + [0] : { + name : [[StableObjectId]] + value : <StablectObjectId> + } + ] result : [ [0] : { configurable : false @@ -295,6 +337,12 @@ expression: new Set([1,2]) { id : <messageId> result : { + internalProperties : [ + [0] : { + name : [[StableObjectId]] + value : <StablectObjectId> + } + ] result : [ [0] : { configurable : true @@ -345,6 +393,12 @@ expression: new Set() { id : <messageId> result : { + internalProperties : [ + [0] : { + name : [[StableObjectId]] + value : <StablectObjectId> + } + ] result : [ [0] : { configurable : false @@ -375,6 +429,12 @@ expression: new Set([1,2]).values() { id : <messageId> result : { + internalProperties : [ + [0] : { + name : [[StableObjectId]] + value : <StablectObjectId> + } + ] result : [ [0] : { configurable : true @@ -428,6 +488,12 @@ expression: it = new Set([1,2]).values(); it.next(); it { id : <messageId> result : { + internalProperties : [ + [0] : { + name : [[StableObjectId]] + value : <StablectObjectId> + } + ] result : [ [0] : { configurable : true @@ -467,6 +533,12 @@ expression: it = new Set([1,2]).keys(); it.next(); it { id : <messageId> result : { + internalProperties : [ + [0] : { + name : [[StableObjectId]] + value : <StablectObjectId> + } + ] result : [ [0] : { configurable : true @@ -506,6 +578,12 @@ expression: it = new Set([1,2]).entries(); it.next(); it { id : <messageId> result : { + internalProperties : [ + [0] : { + name : [[StableObjectId]] + value : <StablectObjectId> + } + ] result : [ [0] : { configurable : true @@ -542,6 +620,12 @@ expression: it = new Set([1,2]).values(); it.next(); it.next(); it { id : <messageId> result : { + internalProperties : [ + [0] : { + name : [[StableObjectId]] + value : <StablectObjectId> + } + ] result : [ [0] : { configurable : false @@ -566,6 +650,12 @@ expression: new WeakMap() { id : <messageId> result : { + internalProperties : [ + [0] : { + name : [[StableObjectId]] + value : <StablectObjectId> + } + ] result : [ [0] : { configurable : false @@ -594,6 +684,12 @@ expression: new WeakMap([[{ a: 2 }, 42]]) { id : <messageId> result : { + internalProperties : [ + [0] : { + name : [[StableObjectId]] + value : <StablectObjectId> + } + ] result : [ [0] : { configurable : true @@ -632,6 +728,12 @@ expression: new WeakSet() { id : <messageId> result : { + internalProperties : [ + [0] : { + name : [[StableObjectId]] + value : <StablectObjectId> + } + ] result : [ [0] : { configurable : false @@ -659,6 +761,12 @@ expression: new WeakSet([{a:2}]) { id : <messageId> result : { + internalProperties : [ + [0] : { + name : [[StableObjectId]] + value : <StablectObjectId> + } + ] result : [ [0] : { configurable : true diff --git a/deps/v8/test/inspector/runtime/internal-properties-expected.txt b/deps/v8/test/inspector/runtime/internal-properties-expected.txt index a2e38ab013..c114696eb8 100644 --- a/deps/v8/test/inspector/runtime/internal-properties-expected.txt +++ b/deps/v8/test/inspector/runtime/internal-properties-expected.txt @@ -7,6 +7,10 @@ expression: (function* foo() { yield 1 }) result : { internalProperties : [ [0] : { + name : [[StableObjectId]] + value : <StablectObjectId> + } + [1] : { name : [[FunctionLocation]] value : { description : Object @@ -19,14 +23,14 @@ expression: (function* foo() { yield 1 }) } } } - [1] : { + [2] : { name : [[IsGenerator]] value : { type : boolean value : true } } - [2] : { + [3] : { name : [[Scopes]] value : { className : Array @@ -47,6 +51,10 @@ expression: (function foo() {}) result : { internalProperties : [ [0] : { + name : [[StableObjectId]] + value : <StablectObjectId> + } + [1] : { name : [[FunctionLocation]] value : { description : Object @@ -59,7 +67,7 @@ expression: (function foo() {}) } } } - [1] : { + [2] : { name : [[Scopes]] value : { className : Array @@ -87,6 +95,10 @@ expression: new Number(239) value : 239 } } + [1] : { + name : [[StableObjectId]] + value : <StablectObjectId> + } ] } } @@ -102,6 +114,10 @@ expression: new Boolean(false) value : false } } + [1] : { + name : [[StableObjectId]] + value : <StablectObjectId> + } ] } } @@ -117,6 +133,10 @@ expression: new String('abc') value : abc } } + [1] : { + name : [[StableObjectId]] + value : <StablectObjectId> + } ] } } @@ -133,6 +153,10 @@ expression: Object(Symbol(42)) type : symbol } } + [1] : { + name : [[StableObjectId]] + value : <StablectObjectId> + } ] } } @@ -149,6 +173,10 @@ expression: Object(BigInt(2)) unserializableValue : 2n } } + [1] : { + name : [[StableObjectId]] + value : <StablectObjectId> + } ] } } @@ -174,6 +202,10 @@ expression: Promise.resolve(42) value : 42 } } + [2] : { + name : [[StableObjectId]] + value : <StablectObjectId> + } ] } } @@ -195,6 +227,10 @@ expression: new Promise(() => undefined) type : undefined } } + [2] : { + name : [[StableObjectId]] + value : <StablectObjectId> + } ] } } @@ -231,6 +267,10 @@ expression: gen1 } } [3] : { + name : [[StableObjectId]] + value : <StablectObjectId> + } + [4] : { name : [[GeneratorLocation]] value : { description : Object @@ -243,7 +283,7 @@ expression: gen1 } } } - [4] : { + [5] : { name : [[Scopes]] value : { className : Array @@ -287,6 +327,10 @@ expression: gen1.next();gen1 } } [3] : { + name : [[StableObjectId]] + value : <StablectObjectId> + } + [4] : { name : [[GeneratorLocation]] value : { description : Object @@ -299,7 +343,7 @@ expression: gen1.next();gen1 } } } - [4] : { + [5] : { name : [[Scopes]] value : { className : Array @@ -343,6 +387,10 @@ expression: gen1.next();gen1 } } [3] : { + name : [[StableObjectId]] + value : <StablectObjectId> + } + [4] : { name : [[GeneratorLocation]] value : { description : Object @@ -391,6 +439,10 @@ expression: gen2 } } [3] : { + name : [[StableObjectId]] + value : <StablectObjectId> + } + [4] : { name : [[GeneratorLocation]] value : { description : Object @@ -403,7 +455,7 @@ expression: gen2 } } } - [4] : { + [5] : { name : [[Scopes]] value : { className : Array @@ -447,6 +499,10 @@ expression: gen2.next();gen2 } } [3] : { + name : [[StableObjectId]] + value : <StablectObjectId> + } + [4] : { name : [[GeneratorLocation]] value : { description : Object @@ -459,7 +515,7 @@ expression: gen2.next();gen2 } } } - [4] : { + [5] : { name : [[Scopes]] value : { className : Array @@ -503,6 +559,10 @@ expression: gen2.next();gen2 } } [3] : { + name : [[StableObjectId]] + value : <StablectObjectId> + } + [4] : { name : [[GeneratorLocation]] value : { description : Object @@ -548,6 +608,10 @@ expression: (new Map([[1,2]])).entries() } } [3] : { + name : [[StableObjectId]] + value : <StablectObjectId> + } + [4] : { name : [[Entries]] value : { className : Array @@ -588,6 +652,10 @@ expression: (new Set([[1,2]])).entries() } } [3] : { + name : [[StableObjectId]] + value : <StablectObjectId> + } + [4] : { name : [[Entries]] value : { className : Array diff --git a/deps/v8/test/inspector/runtime/internal-properties.js b/deps/v8/test/inspector/runtime/internal-properties.js index 470dfb5049..b4b0bc47fb 100644 --- a/deps/v8/test/inspector/runtime/internal-properties.js +++ b/deps/v8/test/inspector/runtime/internal-properties.js @@ -1,8 +1,6 @@ // Copyright 2017 the V8 project authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -// TODO(luoe): remove flag when it is on by default. -// Flags: --harmony-bigint let {session, contextGroup, Protocol} = InspectorTest.start('Checks internal properties in Runtime.getProperties output'); diff --git a/deps/v8/test/inspector/runtime/stable-object-id-expected.txt b/deps/v8/test/inspector/runtime/stable-object-id-expected.txt new file mode 100644 index 0000000000..d4e3fab7ee --- /dev/null +++ b/deps/v8/test/inspector/runtime/stable-object-id-expected.txt @@ -0,0 +1,15 @@ +Checks that protocol returns the same RemoteObjectId for the same object + +Running test: testGlobal +Compare global evaluated twice: true + +Running test: testObject +Compare object evaluated twice: true + +Running test: testObjectInArray +Compare first and second element: true + +Running test: testObjectOnPause +Compare global and this: true +Compare global and global on pause: true +Compare a and a on pause: true diff --git a/deps/v8/test/inspector/runtime/stable-object-id.js b/deps/v8/test/inspector/runtime/stable-object-id.js new file mode 100644 index 0000000000..944bae0d3a --- /dev/null +++ b/deps/v8/test/inspector/runtime/stable-object-id.js @@ -0,0 +1,87 @@ +// Copyright 2018 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( + 'Checks that protocol returns the same RemoteObjectId for the same object'); + +InspectorTest.runAsyncTestSuite([ + async function testGlobal() { + const {result:{result:{objectId:firstId}}} = + await Protocol.Runtime.evaluate({expression: 'this'}); + const firstStableId = await stableObjectId(firstId); + const {result:{result:{objectId:secondId}}} = + await Protocol.Runtime.evaluate({expression: 'this'}); + const secondStableId = await stableObjectId(secondId); + InspectorTest.log( + `Compare global evaluated twice: ${firstStableId === secondStableId}`); + }, + + async function testObject() { + const {result:{result:{objectId:firstId}}} = + await Protocol.Runtime.evaluate({expression: 'this.a = {}, this.a'}); + const firstStableId = await stableObjectId(firstId); + const {result:{result:{objectId:secondId}}} = + await Protocol.Runtime.evaluate({expression: 'this.a'}); + const secondStableId = await stableObjectId(secondId); + InspectorTest.log( + `Compare object evaluated twice: ${firstStableId === secondStableId}`); + }, + + async function testObjectInArray() { + await Protocol.Runtime.evaluate({expression: 'this.b = [this.a, this.a]'}); + const {result:{result:{objectId:firstId}}} = + await Protocol.Runtime.evaluate({expression: 'this.b[0]'}); + const firstStableId = await stableObjectId(firstId); + const {result:{result:{objectId:secondId}}} = + await Protocol.Runtime.evaluate({expression: 'this.b[1]'}); + const secondStableId = await stableObjectId(secondId); + InspectorTest.log( + `Compare first and second element: ${firstStableId === secondStableId}`); + }, + + async function testObjectOnPause() { + const {result:{result:{objectId:globalId}}} = + await Protocol.Runtime.evaluate({expression: 'this'}); + const globalStableId = await stableObjectId(globalId); + const {result:{result:{objectId:aId}}} = + await Protocol.Runtime.evaluate({expression: 'this.a'}); + const aStableId = await stableObjectId(aId); + await Protocol.Debugger.enable(); + Protocol.Runtime.evaluate({expression: 'debugger'}); + const {params:{callFrames:[topFrame]}} = + await Protocol.Debugger.oncePaused(); + const topFrameThisStableId = await stableObjectId(topFrame.this.objectId); + InspectorTest.log( + `Compare global and this: ${globalStableId === topFrameThisStableId}`); + + const {result:{result:{objectId:globalIdOnPause}}} = + await Protocol.Debugger.evaluateOnCallFrame({ + callFrameId: topFrame.callFrameId, + expression: 'this' + }); + const globalStableIdOnPause = await stableObjectId(globalIdOnPause); + InspectorTest.log( + `Compare global and global on pause: ${ + globalStableId === globalStableIdOnPause}`); + + const {result:{result: props}} = await Protocol.Runtime.getProperties({ + objectId: topFrame.scopeChain[0].object.objectId + }); + const {value:{objectId: aIdOnPause}} = props.find(prop => prop.name === 'a'); + const aStableIdOnPause = await stableObjectId(aIdOnPause); + InspectorTest.log(`Compare a and a on pause: ${ + aStableId === aStableIdOnPause}`); + } +]); + +async function stableObjectId(objectId) { + const {result:{ + internalProperties: props + }} = await Protocol.Runtime.getProperties({ + objectId, + ownProperties: true, + generatePreview: false + }); + return props.find(prop => prop.name === '[[StableObjectId]]').value.value; +} diff --git a/deps/v8/test/inspector/sessions/runtime-remote-object-expected.txt b/deps/v8/test/inspector/sessions/runtime-remote-object-expected.txt index a8d0ec0c20..7c6e69e05d 100644 --- a/deps/v8/test/inspector/sessions/runtime-remote-object-expected.txt +++ b/deps/v8/test/inspector/sessions/runtime-remote-object-expected.txt @@ -5,6 +5,12 @@ Retrieving properties in 2 { id : <messageId> result : { + internalProperties : [ + [0] : { + name : [[StableObjectId]] + value : <StablectObjectId> + } + ] result : [ [0] : { configurable : true @@ -38,6 +44,12 @@ Retrieving properties in 1 { id : <messageId> result : { + internalProperties : [ + [0] : { + name : [[StableObjectId]] + value : <StablectObjectId> + } + ] result : [ [0] : { configurable : true @@ -72,6 +84,12 @@ Retrieving properties in 1 { id : <messageId> result : { + internalProperties : [ + [0] : { + name : [[StableObjectId]] + value : <StablectObjectId> + } + ] result : [ [0] : { configurable : true diff --git a/deps/v8/test/inspector/task-runner.h b/deps/v8/test/inspector/task-runner.h index eea9f19e7c..8df1f394a5 100644 --- a/deps/v8/test/inspector/task-runner.h +++ b/deps/v8/test/inspector/task-runner.h @@ -20,7 +20,7 @@ class TaskRunner : public v8::base::Thread { public: class Task { public: - virtual ~Task() {} + virtual ~Task() = default; virtual bool is_priority_task() = 0; virtual void Run(IsolateData* data) = 0; }; @@ -28,7 +28,7 @@ class TaskRunner : public v8::base::Thread { TaskRunner(IsolateData::SetupGlobalTasks setup_global_tasks, bool catch_exceptions, v8::base::Semaphore* ready_semaphore, v8::StartupData* startup_data, bool with_inspector); - virtual ~TaskRunner(); + ~TaskRunner() override; IsolateData* data() const { return data_.get(); } // Thread implementation. diff --git a/deps/v8/test/inspector/testcfg.py b/deps/v8/test/inspector/testcfg.py index 66db34b562..50b7795dfc 100644 --- a/deps/v8/test/inspector/testcfg.py +++ b/deps/v8/test/inspector/testcfg.py @@ -58,6 +58,13 @@ class TestCase(testcase.TestCase): def get_shell(self): return 'inspector-test' + def _get_resources(self): + return [ + os.path.join('src', 'inspector', 'injected-script-source.js'), + os.path.join( + 'test', 'inspector', 'debugger', 'resources', 'break-locations.js'), + ] + @property def output_proc(self): return outproc.ExpectedOutProc( diff --git a/deps/v8/test/intl/break-iterator/options.js b/deps/v8/test/intl/break-iterator/options.js new file mode 100644 index 0000000000..e2feae22a7 --- /dev/null +++ b/deps/v8/test/intl/break-iterator/options.js @@ -0,0 +1,13 @@ +// Copyright 2018 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(() => new Intl.v8BreakIterator('en', null)); +assertDoesNotThrow(() => new Intl.v8BreakIterator('en', undefined)); + +for (let key of [false, true, "foo", Symbol, 1]) { + assertDoesNotThrow(() => new Intl.v8BreakIterator('en', key)); +} + +assertDoesNotThrow(() => new Intl.v8BreakIterator('en', {})); +assertDoesNotThrow(() => new Intl.v8BreakIterator('en', new Proxy({}, {}))); diff --git a/deps/v8/test/intl/break-iterator/subclass.js b/deps/v8/test/intl/break-iterator/subclass.js new file mode 100644 index 0000000000..b5ffe61a48 --- /dev/null +++ b/deps/v8/test/intl/break-iterator/subclass.js @@ -0,0 +1,29 @@ +// Copyright 2018 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-list-format + +var locales = ["tlh", "id", "en"]; +var input = "foo and bar"; +var refBreakIterator = new Intl.v8BreakIterator(locales); +refBreakIterator.adoptText(input); + +class MyBreakIterator extends Intl.v8BreakIterator { + constructor(locales, options) { + super(locales, options); + } +} + +var myBreakIterator = new MyBreakIterator(locales); +myBreakIterator.adoptText(input); + +let expectedPos = refBreakIterator.first(); +let actualPos = myBreakIterator.first(); +assertEquals(expectedPos, actualPos); + +while (expectedPos != -1) { + expectedPos = refBreakIterator.next(); + actualPos = myBreakIterator.next(); + assertEquals(expectedPos, actualPos); +} diff --git a/deps/v8/test/mjsunit/regress/regress-splice-large-index.js b/deps/v8/test/intl/break-iterator/supported-locales-is-method.js index 1f4eb9ce59..c5d00f54fa 100644 --- a/deps/v8/test/mjsunit/regress/regress-splice-large-index.js +++ b/deps/v8/test/intl/break-iterator/supported-locales-is-method.js @@ -1,4 +1,4 @@ -// Copyright 2013 the V8 project authors. All rights reserved. +// Copyright 2018 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: @@ -25,17 +25,8 @@ // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -var a = []; -a[0xfffffffe] = 10; -assertThrows("a.unshift(1);", RangeError); -assertEquals(0xffffffff, a.length); -assertEquals(10, a[0xffffffff]); -assertEquals(0xffffffff, a.length); -assertEquals(undefined, a[0xfffffffe]); +// Test that supportedLocalesOf is not a constructor. -a = [1,2,3]; -a[0xfffffffe] = 10; -assertThrows("a.splice(1,1,7,7,7,7,7);", RangeError); -assertEquals([1,7,7,7,7,7,3], a.slice(0, 7)); -assertEquals(0xffffffff, a.length); -assertEquals(10, a[0xfffffffe + 5 - 1]); +var iterator = new Intl.v8BreakIterator(); + +assertThrows(() => new Intl.v8BreakIterator.supportedLocalesOf(), TypeError); diff --git a/deps/v8/test/intl/collator/de-sort.js b/deps/v8/test/intl/collator/de-sort.js index 278b9492d3..005620c3be 100644 --- a/deps/v8/test/intl/collator/de-sort.js +++ b/deps/v8/test/intl/collator/de-sort.js @@ -42,3 +42,17 @@ assertEquals('flüße', result[5]); assertEquals('FUSSE', result[6]); assertEquals('Fuße', result[7]); assertEquals('März', result[8]); + +result = ["AE", "Ä"].sort(new Intl.Collator("de", {usage: "sort"}).compare) +assertEquals("Ä", result[0]); +assertEquals("AE", result[1]); +result = ["AE", "Ä"].sort(new Intl.Collator("de", {usage: "search"}).compare) +assertEquals("AE", result[0]); +assertEquals("Ä", result[1]); + + +var collator = new Intl.Collator("de", {usage: "search"}); +collator.resolvedOptions() // This triggers the code that removes the u-co-search keyword +result = ["AE", "Ä"].sort(collator.compare) +assertEquals("AE", result[0]); +assertEquals("Ä", result[1]); diff --git a/deps/v8/test/intl/collator/options.js b/deps/v8/test/intl/collator/options.js new file mode 100644 index 0000000000..f03ff2cafc --- /dev/null +++ b/deps/v8/test/intl/collator/options.js @@ -0,0 +1,121 @@ +// 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. + +// No locale +var collatorWithOptions = new Intl.Collator(undefined); +var { locale, usage, collation } = collatorWithOptions.resolvedOptions(); +assertLanguageTag(%GetDefaultICULocale(), locale); +assertEquals('sort', usage); +assertEquals('default', collation); +assertEquals(locale.indexOf('-co-search'), -1); + +collatorWithOptions = new Intl.Collator(undefined, {usage: 'sort'}); +var { locale, usage, collation } = collatorWithOptions.resolvedOptions(); +assertLanguageTag(%GetDefaultICULocale(), locale); +assertEquals('sort', usage); +assertEquals('default', collation); +assertEquals(locale.indexOf('-co-search'), -1); + +collatorWithOptions = new Intl.Collator(undefined, {usage: 'search'}); +var { locale, usage, collation } = collatorWithOptions.resolvedOptions(); +assertEquals('search', usage); +assertEquals('default', collation); +assertLanguageTag(%GetDefaultICULocale(), locale); +assertEquals(locale.indexOf('-co-search'), -1); + +collatorWithOptions = new Intl.Collator(locale); +var { locale, usage, collation } = collatorWithOptions.resolvedOptions(); +assertLanguageTag(%GetDefaultICULocale(), locale); +assertEquals('sort', usage); +assertEquals('default', collation); +assertEquals(locale.indexOf('-co-search'), -1); + +// With Locale +collatorWithOptions = new Intl.Collator('en-US'); +var { locale, usage, collation } = collatorWithOptions.resolvedOptions(); +assertLanguageTag('en-US', locale); +assertEquals('sort', usage); +assertEquals('default', collation); +assertEquals(locale.indexOf('-co-search'), -1); + +collatorWithOptions = new Intl.Collator('en-US', {usage: 'sort'}); +var { locale, usage, collation } = collatorWithOptions.resolvedOptions(); +assertLanguageTag('en-US', locale); +assertEquals('sort', usage); +assertEquals('default', collation); +assertEquals(locale.indexOf('-co-search'), -1); + +collatorWithOptions = new Intl.Collator('en-US', {usage: 'search'}); +var { locale, usage, collation } = collatorWithOptions.resolvedOptions(); +assertEquals('search', usage); +assertEquals('default', collation); +assertLanguageTag('en-US', locale); +assertEquals(locale.indexOf('-co-search'), -1); + +// With invalid collation value = 'search' +collatorWithOptions = new Intl.Collator('en-US-u-co-search'); +var { locale, usage, collation } = collatorWithOptions.resolvedOptions(); +assertLanguageTag('en-US', locale); +assertEquals('sort', usage); +assertEquals('default', collation); +assertEquals(locale.indexOf('-co-search'), -1); + +collatorWithOptions = new Intl.Collator('en-US-u-co-search', {usage: 'sort'}); +var { locale, usage, collation } = collatorWithOptions.resolvedOptions(); +assertLanguageTag('en-US', locale); +assertEquals('sort', usage); +assertEquals('default', collation); +assertEquals(locale.indexOf('-co-search'), -1); + +collatorWithOptions = new Intl.Collator('en-US-u-co-search', {usage: 'search'}); +var { locale, usage, collation } = collatorWithOptions.resolvedOptions(); +assertLanguageTag('en-US', locale); +assertEquals('search', usage); +assertEquals('default', collation); +assertEquals(locale.indexOf('-co-search'), -1); + +// With invalid collation value = 'standard' +collatorWithOptions = new Intl.Collator('en-US-u-co-standard'); +var { locale, usage, collation } = collatorWithOptions.resolvedOptions(); +assertLanguageTag('en-US', locale); +assertEquals('sort', usage); +assertEquals('default', collation); +assertEquals(locale.indexOf('-co-search'), -1); + +collatorWithOptions = new Intl.Collator('en-US-u-co-standard', {usage: 'sort'}); +var { locale, usage, collation } = collatorWithOptions.resolvedOptions(); +assertLanguageTag('en-US', locale); +assertEquals('sort', usage); +assertEquals('default', collation); +assertEquals(locale.indexOf('-co-search'), -1); + +collatorWithOptions = new Intl.Collator('en-US-u-co-standard', {usage: 'search'}); +var { locale, usage, collation } = collatorWithOptions.resolvedOptions(); +assertLanguageTag('en-US', locale); +assertEquals('search', usage); +assertEquals('default', collation); +assertEquals(locale.indexOf('-co-search'), -1); + +// With valid collation value = 'emoji' +collatorWithOptions = new Intl.Collator('en-US-u-co-emoji'); +var { locale, usage, collation } = collatorWithOptions.resolvedOptions(); +assertLanguageTag('en-US', locale); +assertEquals('sort', usage); +assertEquals('emoji', collation); +assertEquals(locale.indexOf('-co-search'), -1); + +collatorWithOptions = new Intl.Collator('en-US-u-co-emoji', {usage: 'sort'}); +var { locale, usage, collation } = collatorWithOptions.resolvedOptions(); +assertLanguageTag('en-US', locale); +assertEquals('sort', usage); +assertEquals('emoji', collation); +assertEquals(locale.indexOf('-co-search'), -1); + +collatorWithOptions = new Intl.Collator('en-US-u-co-emoji', {usage: 'search'}); +var { locale, usage, collation } = collatorWithOptions.resolvedOptions(); +assertLanguageTag('en-US', locale); +assertEquals('search', usage); +// usage = search overwrites emoji as a collation value. +assertEquals('default', collation); +assertEquals(locale.indexOf('-co-search'), -1); diff --git a/deps/v8/test/intl/date-format/constructor-order.js b/deps/v8/test/intl/date-format/constructor-order.js new file mode 100644 index 0000000000..54f3796629 --- /dev/null +++ b/deps/v8/test/intl/date-format/constructor-order.js @@ -0,0 +1,100 @@ +// Copyright 2018 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. + +// Throws only once during construction. +// Check for all getters to prevent regression. +// Preserve the order of getter initialization. +let getCount = 0; +let weekday = new Array(); +let year = new Array(); +let month = new Array(); +let day = new Array(); +let hour = new Array(); +let minute = new Array(); +let second = new Array(); +let localeMatcher = new Array(); +let hour12 = new Array(); +let hourCycle = new Array(); +let timeZone = new Array(); +let era = new Array(); +let timeZoneName = new Array(); +let formatMatcher = new Array(); + +new Intl.DateTimeFormat(['en-US'], { + get weekday() { + weekday.push(++getCount); + }, + get year() { + year.push(++getCount); + }, + get month() { + month.push(++getCount); + }, + get day() { + day.push(++getCount); + }, + get hour() { + hour.push(++getCount); + }, + get minute() { + minute.push(++getCount); + }, + get second() { + second.push(++getCount); + }, + get localeMatcher() { + localeMatcher.push(++getCount); + }, + get hour12() { + hour12.push(++getCount); + }, + get hourCycle() { + hourCycle.push(++getCount); + }, + get timeZone() { + timeZone.push(++getCount); + }, + get era() { + era.push(++getCount); + }, + get timeZoneName() { + timeZoneName.push(++getCount); + }, + get formatMatcher() { + formatMatcher.push(++getCount); + } +}); + +assertEquals(2, weekday.length); +assertEquals(1, weekday[0]); +assertEquals(1, year.length); +assertEquals(2, year[0]); +assertEquals(1, month.length); +assertEquals(3, month[0]); +assertEquals(1, day.length); +assertEquals(4, day[0]); +assertEquals(2, hour.length); +assertEquals(5, hour[0]); +assertEquals(2, minute.length); +assertEquals(6, minute[0]); +assertEquals(2, second.length); +assertEquals(7, second[0]); +assertEquals(1, localeMatcher.length); +assertEquals(8, localeMatcher[0]); +assertEquals(1, hour12.length); +assertEquals(9, hour12[0]); +assertEquals(1, hourCycle.length); +assertEquals(10, hourCycle[0]); +assertEquals(1, timeZone.length); +assertEquals(11, timeZone[0]); +assertEquals(12, weekday[1]); +assertEquals(1, era.length); +assertEquals(13, era[0]); +assertEquals(14, hour[1]); +assertEquals(15, minute[1]); +assertEquals(16, second[1]); +assertEquals(1, timeZoneName.length); +assertEquals(17, timeZoneName[0]); +assertEquals(1, formatMatcher.length); +assertEquals(18, formatMatcher[0]); diff --git a/deps/v8/test/intl/date-format/date-format-to-parts.js b/deps/v8/test/intl/date-format/date-format-to-parts.js index fd04dc5bd0..9b2e41bc96 100644 --- a/deps/v8/test/intl/date-format/date-format-to-parts.js +++ b/deps/v8/test/intl/date-format/date-format-to-parts.js @@ -5,14 +5,16 @@ var d = new Date(2016, 11, 15, 14, 10, 34); var df = Intl.DateTimeFormat("ja", {hour: 'numeric', minute: 'numeric', second: 'numeric', year: 'numeric', - month: 'numeric', day: 'numeric', timeZoneName: 'short', era: 'short'}); + month: 'numeric', day: 'numeric', timeZoneName: 'short', era: 'short', + hour12: true}); var formattedParts = df.formatToParts(d); var formattedReconstructedFromParts = formattedParts.map((part) => part.value) .reduce((accumulated, part) => accumulated + part); assertEquals(df.format(d), formattedReconstructedFromParts); -// 西暦2016年11月15日 14:10:34 GMT-7 +// 西暦2016年11月15日 午後02:10:34 GMT-7 assertEquals(["era", "year", "literal", "month", "literal", "day", "literal", - "hour", "literal", "minute", "literal", "second", "literal", - "timeZoneName"], formattedParts.map((part) => part.type)); + "dayPeriod", "hour", "literal", "minute", "literal", "second", + "literal", "timeZoneName" + ], formattedParts.map((part) => part.type)); diff --git a/deps/v8/test/intl/date-format/format-is-bound.js b/deps/v8/test/intl/date-format/format-is-bound.js index b744b65b91..fdec1eab01 100644 --- a/deps/v8/test/intl/date-format/format-is-bound.js +++ b/deps/v8/test/intl/date-format/format-is-bound.js @@ -37,3 +37,10 @@ dateArray.forEach(dtf.format); // Formatting a date should work in a direct call. dtf.format(); + +// format should be bound properly even if created from a non-instance +var legacy = Intl.DateTimeFormat.call( + Object.create(Intl.DateTimeFormat)); +var boundFormat = legacy.format; +assertEquals(dtf.format(12345), legacy.format(12345)); +assertEquals(dtf.format(54321), boundFormat(54321)); diff --git a/deps/v8/test/intl/date-format/resolved-options-unwrap.js b/deps/v8/test/intl/date-format/resolved-options-unwrap.js new file mode 100644 index 0000000000..2aa4064802 --- /dev/null +++ b/deps/v8/test/intl/date-format/resolved-options-unwrap.js @@ -0,0 +1,11 @@ +// Copyright 2018 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 Intl.DateTimeFormat.prototype.resolvedOptions will properly handle +// 3. Let dtf be ? UnwrapDateTimeFormat(dtf). +var x = Object.create(Intl.DateTimeFormat.prototype); +x = Intl.DateTimeFormat.call(x, 'en'); + +var resolvedOptions = Intl.DateTimeFormat.prototype.resolvedOptions.call(x); +assertEquals(resolvedOptions.locale, 'en') diff --git a/deps/v8/test/intl/date-format/timezone-conversion.js b/deps/v8/test/intl/date-format/timezone-conversion.js new file mode 100644 index 0000000000..1638346dee --- /dev/null +++ b/deps/v8/test/intl/date-format/timezone-conversion.js @@ -0,0 +1,17 @@ +// Copyright 2018 the V8 project authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. +// +// Tests time zone support with conversion. + +df = Intl.DateTimeFormat(undefined, {timeZone: 'America/Los_Angeles'}); +assertEquals('America/Los_Angeles', df.resolvedOptions().timeZone); + +df = Intl.DateTimeFormat(undefined, {timeZone: {toString() { return 'America/Los_Angeles'}}}); +assertEquals('America/Los_Angeles', df.resolvedOptions().timeZone); + +assertThrows(() => Intl.DateTimeFormat( + undefined, {timeZone: {toString() { throw new Error("should throw"); }}})); + +assertThrows(() => Intl.DateTimeFormat( + undefined, {get timeZone() { throw new Error("should throw"); }})); diff --git a/deps/v8/test/intl/general/getCanonicalLocales.js b/deps/v8/test/intl/general/getCanonicalLocales.js index 0df6846ce6..65c7fc6e3a 100644 --- a/deps/v8/test/intl/general/getCanonicalLocales.js +++ b/deps/v8/test/intl/general/getCanonicalLocales.js @@ -7,7 +7,10 @@ assertDoesNotThrow(() => Intl.getCanonicalLocales("foobar-foobar")); // Ignore duplicate subtags in different namespaces; eg, 'a' vs 'u'. assertDoesNotThrow(() => Intl.getCanonicalLocales("en-a-ca-Chinese-u-ca-Chinese")); +// Ignore duplicate subtags in U-extension as well. Only the first count. +// See RFC 6067 for details. +assertDoesNotThrow(() => Intl.getCanonicalLocales("en-u-ca-gregory-ca-chinese")); +assertEquals("en-u-ca-gregory", Intl.getCanonicalLocales("en-u-ca-gregory-ca-chinese")[0]); // Check duplicate subtags (after the first tag) are detected. assertThrows(() => Intl.getCanonicalLocales("en-foobar-foobar"), RangeError); -assertThrows(() => Intl.getCanonicalLocales("en-u-ca-gregory-ca-chinese"), RangeError); 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 b4d529652f..808e50d208 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 @@ -23,5 +23,5 @@ ].forEach(([inputLocale, expectedLocale]) => { const canonicalLocales = Intl.getCanonicalLocales(inputLocale); assertEquals(canonicalLocales.length, 1); - assertEquals(canonicalLocales[0], expectedLocale); + assertEquals(expectedLocale, canonicalLocales[0]); }) 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 073a6c9aff..4f2fbbfb2e 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 @@ -29,6 +29,6 @@ ["aam-u-ca-gregory", "aas-u-ca-gregory"], ].forEach(([inputLocale, expectedLocale]) => { const canonicalLocales = Intl.getCanonicalLocales(inputLocale); - assertEquals(canonicalLocales.length, 1); - assertEquals(canonicalLocales[0], expectedLocale); + assertEquals(1, canonicalLocales.length); + assertEquals(expectedLocale, canonicalLocales[0]); }) diff --git a/deps/v8/test/intl/general/supported-locales-of.js b/deps/v8/test/intl/general/supported-locales-of.js index e16bb6702f..556e525828 100644 --- a/deps/v8/test/intl/general/supported-locales-of.js +++ b/deps/v8/test/intl/general/supported-locales-of.js @@ -27,55 +27,67 @@ // Tests supportedLocalesOf method. -var undef = Intl.DateTimeFormat.supportedLocalesOf(); -assertEquals([], undef); +var services = [ + Intl.DateTimeFormat, + Intl.Collator, + Intl.NumberFormat, + Intl.PluralRules +]; -var empty = Intl.DateTimeFormat.supportedLocalesOf([]); -assertEquals([], empty); +for (const service of services) { + let undef = service.supportedLocalesOf(); + assertEquals([], undef); -var strLocale = Intl.DateTimeFormat.supportedLocalesOf('sr'); -assertEquals('sr', strLocale[0]); + let empty = service.supportedLocalesOf([]); + assertEquals([], empty); -var multiLocale = - Intl.DateTimeFormat.supportedLocalesOf(['sr-Thai-RS', 'de', 'zh-CN']); -assertEquals('sr-Thai-RS', multiLocale[0]); -assertEquals('de', multiLocale[1]); -assertEquals('zh-CN', multiLocale[2]); + let strLocale = service.supportedLocalesOf("sr"); + assertEquals("sr", strLocale[0]); -collatorUndef = Intl.Collator.supportedLocalesOf(); -assertEquals([], collatorUndef); + var locales = ["sr-Thai-RS", "de", "zh-CN"]; + let multiLocale = service.supportedLocalesOf(locales); + assertEquals("sr-Thai-RS", multiLocale[0]); + assertEquals("de", multiLocale[1]); + assertEquals("zh-CN", multiLocale[2]); -collatorEmpty = Intl.Collator.supportedLocalesOf([]); -assertEquals([], collatorEmpty); + let numLocale = service.supportedLocalesOf(1); + assertEquals([], numLocale); + assertThrows(function() { + numLocale = Intl.Collator.supportedLocalesOf([1]); + }, TypeError); -collatorStrLocale = Intl.Collator.supportedLocalesOf('sr'); -assertEquals('sr', collatorStrLocale[0]); + extensionLocale = service.supportedLocalesOf("id-u-co-pinyin"); + assertEquals("id-u-co-pinyin", extensionLocale[0]); -collatorMultiLocale = - Intl.Collator.supportedLocalesOf(['sr-Thai-RS', 'de', 'zh-CN']); -assertEquals('sr-Thai-RS', collatorMultiLocale[0]); -assertEquals('de', collatorMultiLocale[1]); -assertEquals('zh-CN', collatorMultiLocale[2]); + bestFitLocale = service.supportedLocalesOf("de", { + localeMatcher: "best fit" + }); + assertEquals("de", bestFitLocale[0]); -numLocale = Intl.Collator.supportedLocalesOf(1); -assertEquals([], numLocale); + // Need a better test for "lookup" once it differs from "best fit". + lookupLocale = service.supportedLocalesOf("zh-CN", { + localeMatcher: "lookup" + }); + assertEquals("zh-CN", lookupLocale[0]); -assertThrows(function() { - numLocale = Intl.Collator.supportedLocalesOf([1]); -}, TypeError); + assertThrows(function() { + service.supportedLocalesOf("id-u-co-pinyin", { localeMatcher: "xyz" }); + }, RangeError); -extensionLocale = Intl.Collator.supportedLocalesOf('id-u-co-pinyin'); -assertEquals('id-u-co-pinyin', extensionLocale[0]); + privateuseLocale = service.supportedLocalesOf("en-US-x-twain"); + assertEquals("en-US-x-twain", privateuseLocale[0]); -bestFitLocale = - Intl.Collator.supportedLocalesOf('de', {localeMatcher: 'best fit'}); -assertEquals('de', bestFitLocale[0]); + privateuseLocale2 = service.supportedLocalesOf("x-twain"); + assertEquals(undefined, privateuseLocale2[0]); -// Need a better test for "lookup" once it differs from "best fit". -lookupLocale = - Intl.Collator.supportedLocalesOf('zh-CN', {localeMatcher: 'lookup'}); -assertEquals('zh-CN', lookupLocale[0]); + grandfatheredLocale = service.supportedLocalesOf("art-lojban"); + assertEquals(undefined, grandfatheredLocale[0]); -assertThrows(function() { - Intl.Collator.supportedLocalesOf('id-u-co-pinyin', {localeMatcher: 'xyz'}); -}, RangeError); + grandfatheredLocale2 = service.supportedLocalesOf("i-pwn"); + assertEquals(undefined, grandfatheredLocale2[0]); + + unicodeInPrivateuseLocale = service.supportedLocalesOf( + "en-US-x-u-co-phonebk" + ); + assertEquals("en-US-x-u-co-phonebk", unicodeInPrivateuseLocale[0]); +} diff --git a/deps/v8/test/intl/intl.status b/deps/v8/test/intl/intl.status index b0e4340ece..42807597a0 100644 --- a/deps/v8/test/intl/intl.status +++ b/deps/v8/test/intl/intl.status @@ -29,6 +29,13 @@ [ALWAYS, { # TODO(jochen): The following test is flaky. 'overrides/caching': [PASS, FAIL], + + # https://bugs.chromium.org/p/v8/issues/detail?id=6891 + 'segmenter/segment': [FAIL], + 'segmenter/segment-iterator': [FAIL], + 'segmenter/segment-iterator-following': [FAIL], + 'segmenter/segment-iterator-next': [FAIL], + 'segmenter/segment-iterator-preceding': [FAIL], }], # ALWAYS ['variant == no_wasm_traps', { @@ -41,4 +48,12 @@ 'relative-time-format/default-locale-pt-BR': [SKIP], }], # system == windows' +['system == android', { + # Android's ICU data file does not have the Chinese/Japanese dictionary + # required for the test to pass. + 'break-iterator/zh-break': [FAIL], + # Unable to change locale on Android: + 'relative-time-format/default-locale-fr-CA': [FAIL], + 'relative-time-format/default-locale-pt-BR': [FAIL], +}], # 'system == android' ] diff --git a/deps/v8/test/intl/list-format/supported-locale.js b/deps/v8/test/intl/list-format/supported-locale.js new file mode 100644 index 0000000000..1eac25d618 --- /dev/null +++ b/deps/v8/test/intl/list-format/supported-locale.js @@ -0,0 +1,19 @@ +// Copyright 2018 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-list-format +assertEquals(typeof Intl.ListFormat.supportedLocalesOf, "function", + "Intl.ListFormat.supportedLocalesOf should be a function"); + +var undef = Intl.ListFormat.supportedLocalesOf(); +assertEquals([], undef); + +var empty = Intl.ListFormat.supportedLocalesOf([]); +assertEquals([], empty); + +var strLocale = Intl.ListFormat.supportedLocalesOf('sr'); +assertEquals('sr', strLocale[0]); + +var multiLocale = ['sr-Thai-RS', 'de', 'zh-CN']; +assertEquals(multiLocale, Intl.ListFormat.supportedLocalesOf(multiLocale)); diff --git a/deps/v8/test/intl/locale/locale-properties.js b/deps/v8/test/intl/locale/locale-properties.js index 9432cb8a77..9800e8d6cf 100644 --- a/deps/v8/test/intl/locale/locale-properties.js +++ b/deps/v8/test/intl/locale/locale-properties.js @@ -24,7 +24,7 @@ assertEquals('buddhist', locale.calendar); assertEquals('phonebk', locale.collation); assertEquals('h23', locale.hourCycle); assertEquals('upper', locale.caseFirst); -assertEquals('true', locale.numeric); +assertEquals(true, locale.numeric); assertEquals('roman', locale.numberingSystem); // Not defined, expected to undefined. assertEquals(undefined, locale.currency); diff --git a/deps/v8/test/intl/number-format/format-is-bound.js b/deps/v8/test/intl/number-format/format-is-bound.js index edb6a4b817..defb8982e2 100644 --- a/deps/v8/test/intl/number-format/format-is-bound.js +++ b/deps/v8/test/intl/number-format/format-is-bound.js @@ -42,3 +42,9 @@ nf.format(12345); // Reading the format doesn't add any additional property keys assertEquals(beforeCount, Object.getOwnPropertyNames(nf).length); + +// format should be bound properly even if created from a non-instance +var legacy = Intl.NumberFormat.call(Object.create(Intl.NumberFormat)); +var boundFormat = legacy.format; +assertEquals(nf.format(12345), legacy.format(12345)); +assertEquals(nf.format(54321), boundFormat(54321)); diff --git a/deps/v8/test/intl/number-format/resolved-options-unwrap.js b/deps/v8/test/intl/number-format/resolved-options-unwrap.js new file mode 100644 index 0000000000..70b40bbea4 --- /dev/null +++ b/deps/v8/test/intl/number-format/resolved-options-unwrap.js @@ -0,0 +1,11 @@ +// Copyright 2015 the V8 project authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +let nf = Object.create(Intl.NumberFormat.prototype); +nf = Intl.NumberFormat.call(nf); +const actual = Intl.NumberFormat.prototype.resolvedOptions.call(nf); + +const expected = new Intl.NumberFormat().resolvedOptions(); +Object.keys(expected).forEach(key => assertEquals(expected[key], actual[key])); +assertEquals(Object.keys(expected).length, Object.keys(actual).length); diff --git a/deps/v8/test/intl/number-format/wont-crash-by-1-or-false.js b/deps/v8/test/intl/number-format/wont-crash-by-1-or-false.js new file mode 100644 index 0000000000..518fe52bde --- /dev/null +++ b/deps/v8/test/intl/number-format/wont-crash-by-1-or-false.js @@ -0,0 +1,12 @@ +// Copyright 2018 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 passing 1 or false to patched construtor won't cause crash + +Object.defineProperty(Intl.NumberFormat, Symbol.hasInstance, { value: _ => true }); +assertThrows(() => + Intl.NumberFormat.call(1), TypeError); + +assertThrows(() => + Intl.NumberFormat.call(false), TypeError); diff --git a/deps/v8/test/intl/plural-rules/check-to-number.js b/deps/v8/test/intl/plural-rules/check-to-number.js new file mode 100644 index 0000000000..7d5396e634 --- /dev/null +++ b/deps/v8/test/intl/plural-rules/check-to-number.js @@ -0,0 +1,21 @@ +// Copyright 2018 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 pr = new Intl.PluralRules(); +const inputs = [undefined, null, true, false, 1, '', 'test', {}, { a: 1 }]; + +inputs.forEach(input => { + const number = Number(input); + const expected = pr.select(number); + const actual = pr.select(input); + assertEquals(actual, expected); +}); + +let count = 0; +const dummyObject = {}; +dummyObject[Symbol.toPrimitive] = () => ++count; +assertEquals(pr.select(dummyObject), pr.select(count)); +assertEquals(count, 1); + +assertEquals(pr.select(0), pr.select(-0)) diff --git a/deps/v8/test/intl/regress-7982.js b/deps/v8/test/intl/regress-7982.js new file mode 100644 index 0000000000..bd251c5939 --- /dev/null +++ b/deps/v8/test/intl/regress-7982.js @@ -0,0 +1,36 @@ +// Copyright 2018 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-locale + +// Make sure that maximize and minimize of locales work reasonbly. + +assertEquals("zh-Hans-CN-u-ca-chinese", new Intl.Locale("zh-u-ca-Chinese").maximize().toString()); +assertEquals("zh-u-ca-chinese", new Intl.Locale("zh-u-ca-Chinese").minimize().toString()); +assertEquals("th-Thai-TH-u-nu-thai", new Intl.Locale("th-Thai-TH-u-nu-Thai").maximize().toString()); +assertEquals("th-u-nu-thai", new Intl.Locale("th-Thai-TH-u-nu-Thai").minimize().toString()); +assertEquals("th-Thai-TH-u-nu-thai", new Intl.Locale("th-u-nu-Thai").maximize().toString()); +assertEquals("th-u-nu-thai", new Intl.Locale("th-u-nu-Thai").minimize().toString()); +assertEquals("zh-Hans-CN-u-ca-chinese", new Intl.Locale("zh-CN-u-ca-chinese").maximize().toString()); +assertEquals("zh-u-ca-chinese", new Intl.Locale("zh-CN-u-ca-chinese").minimize().toString()); +assertEquals("zh-Hant-TW-u-ca-chinese", new Intl.Locale("zh-TW-u-ca-chinese").maximize().toString()); +assertEquals("zh-TW-u-ca-chinese", new Intl.Locale("zh-TW-u-ca-chinese").minimize().toString()); +assertEquals("zh-Hant-HK-u-ca-chinese", new Intl.Locale("zh-HK-u-ca-chinese").maximize().toString()); +assertEquals("zh-HK-u-ca-chinese", new Intl.Locale("zh-HK-u-ca-chinese").minimize().toString()); +assertEquals("zh-Hant-TW-u-ca-chinese", new Intl.Locale("zh-Hant-u-ca-chinese").maximize().toString()); +assertEquals("zh-Hant-u-ca-chinese", new Intl.Locale("zh-Hant-u-ca-chinese").minimize().toString()); +assertEquals("zh-Hans-CN-u-ca-chinese", new Intl.Locale("zh-Hans-u-ca-chinese").maximize().toString()); +assertEquals("zh-u-ca-chinese", new Intl.Locale("zh-Hans-u-ca-chinese").minimize().toString()); +assertEquals("zh-Hant-CN-u-ca-chinese", new Intl.Locale("zh-Hant-CN-u-ca-chinese").maximize().toString()); +assertEquals("zh-Hant-CN-u-ca-chinese", new Intl.Locale("zh-Hant-CN-u-ca-chinese").minimize().toString()); +assertEquals("zh-Hans-CN-u-ca-chinese", new Intl.Locale("zh-Hans-CN-u-ca-chinese").maximize().toString()); +assertEquals("zh-u-ca-chinese", new Intl.Locale("zh-Hans-CN-u-ca-chinese").minimize().toString()); +assertEquals("zh-Hant-TW-u-ca-chinese", new Intl.Locale("zh-Hant-TW-u-ca-chinese").maximize().toString()); +assertEquals("zh-TW-u-ca-chinese", new Intl.Locale("zh-Hant-TW-u-ca-chinese").minimize().toString()); +assertEquals("zh-Hans-TW-u-ca-chinese", new Intl.Locale("zh-Hans-TW-u-ca-chinese").maximize().toString()); +assertEquals("zh-Hans-TW-u-ca-chinese", new Intl.Locale("zh-Hans-TW-u-ca-chinese").minimize().toString()); +assertEquals("zh-Hant-HK-u-ca-chinese", new Intl.Locale("zh-Hant-HK-u-ca-chinese").maximize().toString()); +assertEquals("zh-HK-u-ca-chinese", new Intl.Locale("zh-Hant-HK-u-ca-chinese").minimize().toString()); +assertEquals("zh-Hans-HK-u-ca-chinese", new Intl.Locale("zh-Hans-HK-u-ca-chinese").maximize().toString()); +assertEquals("zh-Hans-HK-u-ca-chinese", new Intl.Locale("zh-Hans-HK-u-ca-chinese").minimize().toString()); diff --git a/deps/v8/test/intl/regress-888299.js b/deps/v8/test/intl/regress-888299.js new file mode 100644 index 0000000000..abe9d1da34 --- /dev/null +++ b/deps/v8/test/intl/regress-888299.js @@ -0,0 +1,7 @@ +// 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. + +var i = 0; +new Intl.DateTimeFormat( + undefined, { get hour() { if (i == 0) { i = 1; return 'numeric'} } }); diff --git a/deps/v8/test/intl/relative-time-format/format-en.js b/deps/v8/test/intl/relative-time-format/format-en.js index cd58d65355..2af755dcbf 100644 --- a/deps/v8/test/intl/relative-time-format/format-en.js +++ b/deps/v8/test/intl/relative-time-format/format-en.js @@ -67,9 +67,6 @@ assertEquals('next month', longAuto.format(1, 'month')); assertEquals('in 2 months', longAuto.format(2, 'month')); assertEquals('in 345 months', longAuto.format(345, 'month')); -// "quarter" is not working in ICU now -// Tracked by ICU bug in http://bugs.icu-project.org/trac/ticket/12171 -/* assertEquals('3 quarters ago', longAuto.format(-3, 'quarter')); assertEquals('2 quarters ago', longAuto.format(-2, 'quarter')); assertEquals('last quarter', longAuto.format(-1, 'quarter')); @@ -78,7 +75,6 @@ assertEquals('this quarter', longAuto.format(-0, 'quarter')); assertEquals('next quarter', longAuto.format(1, 'quarter')); assertEquals('in 2 quarters', longAuto.format(2, 'quarter')); assertEquals('in 345 quarters', longAuto.format(345, 'quarter')); -*/ assertEquals('3 years ago', longAuto.format(-3, 'year')); assertEquals('2 years ago', longAuto.format(-2, 'year')); @@ -146,8 +142,6 @@ assertEquals('next mo.', shortAuto.format(1, 'month')); assertEquals('in 2 mo.', shortAuto.format(2, 'month')); assertEquals('in 345 mo.', shortAuto.format(345, 'month')); -// "quarter" is not working in ICU now -/* assertEquals('3 qtrs. ago', shortAuto.format(-3, 'quarter')); assertEquals('2 qtrs. ago', shortAuto.format(-2, 'quarter')); assertEquals('last qtr.', shortAuto.format(-1, 'quarter')); @@ -156,7 +150,6 @@ assertEquals('this qtr.', shortAuto.format(-0, 'quarter')); assertEquals('next qtr.', shortAuto.format(1, 'quarter')); assertEquals('in 2 qtrs.', shortAuto.format(2, 'quarter')); assertEquals('in 345 qtrs.', shortAuto.format(345, 'quarter')); -*/ assertEquals('3 yr. ago', shortAuto.format(-3, 'year')); assertEquals('2 yr. ago', shortAuto.format(-2, 'year')); @@ -225,8 +218,6 @@ assertEquals('next mo.', narrowAuto.format(1, 'month')); assertEquals('in 2 mo.', narrowAuto.format(2, 'month')); assertEquals('in 345 mo.', narrowAuto.format(345, 'month')); -// "quarter" is not working in ICU now -/* assertEquals('3 qtrs. ago', narrowAuto.format(-3, 'quarter')); assertEquals('2 qtrs. ago', narrowAuto.format(-2, 'quarter')); assertEquals('last qtr.', narrowAuto.format(-1, 'quarter')); @@ -235,7 +226,6 @@ assertEquals('this qtr.', narrowAuto.format(-0, 'quarter')); assertEquals('next qtr.', narrowAuto.format(1, 'quarter')); assertEquals('in 2 qtrs.', narrowAuto.format(2, 'quarter')); assertEquals('in 345 qtrs.', narrowAuto.format(345, 'quarter')); -*/ assertEquals('3 yr. ago', narrowAuto.format(-3, 'year')); assertEquals('2 yr. ago', narrowAuto.format(-2, 'year')); @@ -303,8 +293,6 @@ assertEquals('in 1 month', longAlways.format(1, 'month')); assertEquals('in 2 months', longAlways.format(2, 'month')); assertEquals('in 345 months', longAlways.format(345, 'month')); -// "quarter" is not working in ICU now -/* assertEquals('3 quarters ago', longAlways.format(-3, 'quarter')); assertEquals('2 quarters ago', longAlways.format(-2, 'quarter')); assertEquals('1 quarter ago', longAlways.format(-1, 'quarter')); @@ -313,7 +301,6 @@ assertEquals('0 quarters ago', longAlways.format(-0, 'quarter')); assertEquals('in 1 quarter', longAlways.format(1, 'quarter')); assertEquals('in 2 quarters', longAlways.format(2, 'quarter')); assertEquals('in 345 quarters', longAlways.format(345, 'quarter')); -*/ assertEquals('3 years ago', longAlways.format(-3, 'year')); assertEquals('2 years ago', longAlways.format(-2, 'year')); @@ -381,17 +368,14 @@ assertEquals('in 1 mo.', shortAlways.format(1, 'month')); assertEquals('in 2 mo.', shortAlways.format(2, 'month')); assertEquals('in 345 mo.', shortAlways.format(345, 'month')); -// "quarter" is not working in ICU now -/* assertEquals('3 qtrs. ago', shortAlways.format(-3, 'quarter')); assertEquals('2 qtrs. ago', shortAlways.format(-2, 'quarter')); assertEquals('1 qtr. ago', shortAlways.format(-1, 'quarter')); assertEquals('in 0 qtrs.', shortAlways.format(0, 'quarter')); -assertEquals('0 qtr. ago', shortAlways.format(-0, 'quarter')); +assertEquals('0 qtrs. ago', shortAlways.format(-0, 'quarter')); assertEquals('in 1 qtr.', shortAlways.format(1, 'quarter')); assertEquals('in 2 qtrs.', shortAlways.format(2, 'quarter')); assertEquals('in 345 qtrs.', shortAlways.format(345, 'quarter')); -*/ assertEquals('3 yr. ago', shortAlways.format(-3, 'year')); assertEquals('2 yr. ago', shortAlways.format(-2, 'year')); @@ -460,17 +444,14 @@ assertEquals('in 1 mo.', narrowAlways.format(1, 'month')); assertEquals('in 2 mo.', narrowAlways.format(2, 'month')); assertEquals('in 345 mo.', narrowAlways.format(345, 'month')); -// "quarter" is not working in ICU now -/* assertEquals('3 qtrs. ago', narrowAlways.format(-3, 'quarter')); assertEquals('2 qtrs. ago', narrowAlways.format(-2, 'quarter')); assertEquals('1 qtr. ago', narrowAlways.format(-1, 'quarter')); assertEquals('in 0 qtrs.', narrowAlways.format(0, 'quarter')); -assertEquals('0 qtr. ago', narrowAlways.format(-0, 'quarter')); +assertEquals('0 qtrs. ago', narrowAlways.format(-0, 'quarter')); assertEquals('in 1 qtr.', narrowAlways.format(1, 'quarter')); assertEquals('in 2 qtrs.', narrowAlways.format(2, 'quarter')); assertEquals('in 345 qtrs.', narrowAlways.format(345, 'quarter')); -*/ assertEquals('3 yr. ago', narrowAlways.format(-3, 'year')); assertEquals('2 yr. ago', narrowAlways.format(-2, 'year')); diff --git a/deps/v8/test/intl/relative-time-format/format-to-parts-plural.js b/deps/v8/test/intl/relative-time-format/format-to-parts-plural.js new file mode 100644 index 0000000000..7e5e1b79a6 --- /dev/null +++ b/deps/v8/test/intl/relative-time-format/format-to-parts-plural.js @@ -0,0 +1,28 @@ +// Copyright 2018 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-relative-time-format + +// Check plural w/ formatToParts +// http://tc39.github.io/proposal-intl-relative-time/ + +let rtf = new Intl.RelativeTimeFormat(); + +// Test 1.4.4 Intl.RelativeTimeFormat.prototype.formatToParts( value, unit ) +function verifyElement(part, expectedUnit) { + assertEquals(true, part.type == 'literal' || part.type == 'integer'); + assertEquals('string', typeof part.value); + if (part.type == 'integer') { + assertEquals('string', typeof part.unit); + assertEquals(expectedUnit, part.unit); + } +}; + +['year', 'quarter', 'month', 'week', 'day', 'hour', 'minute', 'second'].forEach( + function(unit) { + rtf.formatToParts(100, unit + 's').forEach( + function(part) { + verifyElement(part, unit); + }); + }); diff --git a/deps/v8/test/intl/relative-time-format/supported-locale.js b/deps/v8/test/intl/relative-time-format/supported-locale.js new file mode 100644 index 0000000000..b24cfb27af --- /dev/null +++ b/deps/v8/test/intl/relative-time-format/supported-locale.js @@ -0,0 +1,19 @@ +// Copyright 2018 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-relative-time-format +assertEquals(typeof Intl.RelativeTimeFormat.supportedLocalesOf, "function", + "Intl.RelativeTimeFormat.supportedLocalesOf should be a function"); + +var undef = Intl.RelativeTimeFormat.supportedLocalesOf(); +assertEquals([], undef); + +var empty = Intl.RelativeTimeFormat.supportedLocalesOf([]); +assertEquals([], empty); + +var strLocale = Intl.RelativeTimeFormat.supportedLocalesOf('sr'); +assertEquals('sr', strLocale[0]); + +var multiLocale = ['sr-Thai-RS', 'de', 'zh-CN']; +assertEquals(multiLocale, Intl.RelativeTimeFormat.supportedLocalesOf(multiLocale)); diff --git a/deps/v8/test/intl/segmenter/constructor.js b/deps/v8/test/intl/segmenter/constructor.js new file mode 100644 index 0000000000..655bb100df --- /dev/null +++ b/deps/v8/test/intl/segmenter/constructor.js @@ -0,0 +1,216 @@ +// Copyright 2018 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-segmenter + +// Segmenter constructor can't be called as function. +assertThrows(() => Intl.Segmenter(["sr"]), TypeError); + +// Invalid locale string. +assertThrows(() => new Intl.Segmenter(["abcdefghi"]), RangeError); + +assertDoesNotThrow(() => new Intl.Segmenter(["sr"], {}), TypeError); + +assertDoesNotThrow(() => new Intl.Segmenter([], {})); + +assertDoesNotThrow(() => new Intl.Segmenter(["fr", "ar"], {})); + +assertDoesNotThrow(() => new Intl.Segmenter({ 0: "ja", 1: "fr" }, {})); + +assertDoesNotThrow(() => new Intl.Segmenter({ 1: "ja", 2: "fr" }, {})); + +assertDoesNotThrow(() => new Intl.Segmenter(["sr"])); + +assertDoesNotThrow(() => new Intl.Segmenter()); + +assertDoesNotThrow( + () => + new Intl.Segmenter(["sr"], { + lineBreakStyle: "strict", + granularity: "grapheme" + }) +); + +assertDoesNotThrow( + () => new Intl.Segmenter(["sr"], { granularity: "sentence" }) +); + +assertDoesNotThrow(() => new Intl.Segmenter(["sr"], { granularity: "word" })); + +assertDoesNotThrow( + () => new Intl.Segmenter(["sr"], { granularity: "grapheme" }) +); + +assertDoesNotThrow(() => new Intl.Segmenter(["sr"], { granularity: "line" })); + +assertThrows( + () => new Intl.Segmenter(["sr"], { granularity: "standard" }), + RangeError +); + +assertDoesNotThrow( + () => new Intl.Segmenter(["sr"], { lineBreakStyle: "normal" }) +); + +assertDoesNotThrow( + () => new Intl.Segmenter(["sr"], { lineBreakStyle: "strict" }) +); + +assertDoesNotThrow( + () => new Intl.Segmenter(["sr"], { lineBreakStyle: "loose" }) +); + +assertThrows( + () => new Intl.Segmenter(["sr"], { lineBreakStyle: "giant" }), + RangeError +); + +assertDoesNotThrow( + () => + new Intl.Segmenter(["sr"], { + granularity: "sentence", + lineBreakStyle: "normal" + }) +); + +assertDoesNotThrow( + () => + new Intl.Segmenter(["sr"], { + granularity: "sentence", + lineBreakStyle: "strict" + }) +); + +assertDoesNotThrow( + () => + new Intl.Segmenter(["sr"], { + granularity: "sentence", + lineBreakStyle: "loose" + }) +); + +assertDoesNotThrow( + () => + new Intl.Segmenter(["sr"], { + granularity: "word", + lineBreakStyle: "normal" + }) +); + +assertDoesNotThrow( + () => + new Intl.Segmenter(["sr"], { + granularity: "word", + lineBreakStyle: "strict" + }) +); + +assertDoesNotThrow( + () => + new Intl.Segmenter(["sr"], { + granularity: "word", + lineBreakStyle: "loose" + }) +); + +assertDoesNotThrow( + () => + new Intl.Segmenter(["sr"], { + granularity: "grapheme", + lineBreakStyle: "normal" + }) +); + +assertDoesNotThrow( + () => + new Intl.Segmenter(["sr"], { + granularity: "grapheme", + lineBreakStyle: "strict" + }) +); + +assertDoesNotThrow( + () => + new Intl.Segmenter(["sr"], { + granularity: "grapheme", + lineBreakStyle: "loose" + }) +); + +assertDoesNotThrow( + () => + new Intl.Segmenter(["sr"], { + granularity: "line", + lineBreakStyle: "loose" + }) +); + +assertDoesNotThrow( + () => + new Intl.Segmenter(["sr"], { + granularity: "line", + lineBreakStyle: "normal" + }) +); + +assertDoesNotThrow( + () => + new Intl.Segmenter(["sr"], { + granularity: "line", + lineBreakStyle: "strict" + }) +); + +// propagate exception from getter +assertThrows( + () => + new Intl.Segmenter(undefined, { + get localeMatcher() { + throw new TypeError(""); + } + }), + TypeError +); +assertThrows( + () => + new Intl.Segmenter(undefined, { + get lineBreakStyle() { + throw new TypeError(""); + } + }), + TypeError +); +assertThrows( + () => + new Intl.Segmenter(undefined, { + get granularity() { + throw new TypeError(""); + } + }), + TypeError +); + +// Throws only once during construction. +// Check for all getters to prevent regression. +// Preserve the order of getter initialization. +let getCount = 0; +let localeMatcher = -1; +let lineBreakStyle = -1; +let granularity = -1; + +new Intl.Segmenter(["en-US"], { + get localeMatcher() { + localeMatcher = ++getCount; + }, + get lineBreakStyle() { + lineBreakStyle = ++getCount; + }, + get granularity() { + granularity = ++getCount; + } +}); + +assertEquals(1, localeMatcher); +assertEquals(2, lineBreakStyle); +assertEquals(3, granularity); diff --git a/deps/v8/test/intl/segmenter/resolved-options.js b/deps/v8/test/intl/segmenter/resolved-options.js new file mode 100644 index 0000000000..2e2a910ddb --- /dev/null +++ b/deps/v8/test/intl/segmenter/resolved-options.js @@ -0,0 +1,299 @@ +// Copyright 2018 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-segmenter + +let segmenter = new Intl.Segmenter([], { granularity: "line" }); +// The default lineBreakStyle is 'normal' +assertEquals("normal", segmenter.resolvedOptions().lineBreakStyle); + +segmenter = new Intl.Segmenter(); +assertEquals(undefined, segmenter.resolvedOptions().lineBreakStyle); + +// The default granularity is 'grapheme' +assertEquals("grapheme", segmenter.resolvedOptions().granularity); + +assertEquals( + undefined, + new Intl.Segmenter(["sr"], { lineBreakStyle: "strict" }).resolvedOptions() + .lineBreakStyle +); + +assertEquals( + "grapheme", + new Intl.Segmenter(["sr"], { lineBreakStyle: "strict" }).resolvedOptions() + .granularity +); + +assertEquals( + undefined, + new Intl.Segmenter(["sr"], { lineBreakStyle: "normal" }).resolvedOptions() + .lineBreakStyle +); + +assertEquals( + "grapheme", + new Intl.Segmenter(["sr"], { lineBreakStyle: "normal" }).resolvedOptions() + .granularity +); + +assertEquals( + undefined, + new Intl.Segmenter(["sr"], { lineBreakStyle: "loose" }).resolvedOptions() + .lineBreakStyle +); + +assertEquals( + "grapheme", + new Intl.Segmenter(["sr"], { lineBreakStyle: "loose" }).resolvedOptions() + .granularity +); + +assertEquals( + "word", + new Intl.Segmenter(["sr"], { granularity: "word" }).resolvedOptions() + .granularity +); + +assertEquals( + undefined, + new Intl.Segmenter(["sr"], { granularity: "word" }).resolvedOptions() + .lineBreakStyle +); + +assertEquals( + "grapheme", + new Intl.Segmenter(["sr"], { granularity: "grapheme" }).resolvedOptions() + .granularity +); + +assertEquals( + undefined, + new Intl.Segmenter(["sr"], { granularity: "grapheme" }).resolvedOptions() + .lineBreakStyle +); + +assertEquals( + "sentence", + new Intl.Segmenter(["sr"], { granularity: "sentence" }).resolvedOptions() + .granularity +); + +assertEquals( + undefined, + new Intl.Segmenter(["sr"], { granularity: "sentence" }).resolvedOptions() + .lineBreakStyle +); + +assertEquals( + "line", + new Intl.Segmenter(["sr"], { granularity: "line" }).resolvedOptions() + .granularity +); + +assertEquals( + "normal", + new Intl.Segmenter(["sr"], { granularity: "line" }).resolvedOptions() + .lineBreakStyle +); + +assertEquals( + "grapheme", + new Intl.Segmenter(["sr"], { + lineBreakStyle: "loose", + granularity: "grapheme" + }).resolvedOptions().granularity +); + +assertEquals( + undefined, + new Intl.Segmenter(["sr"], { + lineBreakStyle: "loose", + granularity: "grapheme" + }).resolvedOptions().lineBreakStyle +); + +assertEquals( + "grapheme", + new Intl.Segmenter(["sr"], { + lineBreakStyle: "strict", + granularity: "grapheme" + }).resolvedOptions().granularity +); + +assertEquals( + undefined, + new Intl.Segmenter(["sr"], { + lineBreakStyle: "strict", + granularity: "grapheme" + }).resolvedOptions().lineBreakStyle +); + +assertEquals( + "grapheme", + new Intl.Segmenter(["sr"], { + lineBreakStyle: "normal", + granularity: "grapheme" + }).resolvedOptions().granularity +); + +assertEquals( + undefined, + new Intl.Segmenter(["sr"], { + lineBreakStyle: "normal", + granularity: "grapheme" + }).resolvedOptions().lineBreakStyle +); + +assertEquals( + "word", + new Intl.Segmenter(["sr"], { + lineBreakStyle: "loose", + granularity: "word" + }).resolvedOptions().granularity +); + +assertEquals( + undefined, + new Intl.Segmenter(["sr"], { + lineBreakStyle: "loose", + granularity: "word" + }).resolvedOptions().lineBreakStyle +); + +assertEquals( + "word", + new Intl.Segmenter(["sr"], { + lineBreakStyle: "strict", + granularity: "word" + }).resolvedOptions().granularity +); + +assertEquals( + undefined, + new Intl.Segmenter(["sr"], { + lineBreakStyle: "strict", + granularity: "word" + }).resolvedOptions().lineBreakStyle +); + +assertEquals( + "word", + new Intl.Segmenter(["sr"], { + lineBreakStyle: "normal", + granularity: "word" + }).resolvedOptions().granularity +); + +assertEquals( + undefined, + new Intl.Segmenter(["sr"], { + lineBreakStyle: "normal", + granularity: "word" + }).resolvedOptions().lineBreakStyle +); + +assertEquals( + "sentence", + new Intl.Segmenter(["sr"], { + lineBreakStyle: "loose", + granularity: "sentence" + }).resolvedOptions().granularity +); + +assertEquals( + undefined, + new Intl.Segmenter(["sr"], { + lineBreakStyle: "loose", + granularity: "sentence" + }).resolvedOptions().lineBreakStyle +); + +assertEquals( + "sentence", + new Intl.Segmenter(["sr"], { + lineBreakStyle: "strict", + granularity: "sentence" + }).resolvedOptions().granularity +); + +assertEquals( + undefined, + new Intl.Segmenter(["sr"], { + lineBreakStyle: "strict", + granularity: "sentence" + }).resolvedOptions().lineBreakStyle +); + +assertEquals( + "sentence", + new Intl.Segmenter(["sr"], { + lineBreakStyle: "normal", + granularity: "sentence" + }).resolvedOptions().granularity +); + +assertEquals( + "normal", + new Intl.Segmenter(["sr"], { + lineBreakStyle: "normal", + granularity: "line" + }).resolvedOptions().lineBreakStyle +); + +assertEquals( + "line", + new Intl.Segmenter(["sr"], { + lineBreakStyle: "loose", + granularity: "line" + }).resolvedOptions().granularity +); + +assertEquals( + "loose", + new Intl.Segmenter(["sr"], { + lineBreakStyle: "loose", + granularity: "line" + }).resolvedOptions().lineBreakStyle +); + +assertEquals( + "line", + new Intl.Segmenter(["sr"], { + lineBreakStyle: "strict", + granularity: "line" + }).resolvedOptions().granularity +); + +assertEquals( + "strict", + new Intl.Segmenter(["sr"], { + lineBreakStyle: "strict", + granularity: "line" + }).resolvedOptions().lineBreakStyle +); + +assertEquals( + "line", + new Intl.Segmenter(["sr"], { + lineBreakStyle: "normal", + granularity: "line" + }).resolvedOptions().granularity +); + +assertEquals( + "normal", + new Intl.Segmenter(["sr"], { + lineBreakStyle: "normal", + granularity: "line" + }).resolvedOptions().lineBreakStyle +); + +assertEquals("ar", new Intl.Segmenter(["ar"]).resolvedOptions().locale); + +assertEquals("ar", new Intl.Segmenter(["ar", "en"]).resolvedOptions().locale); + +assertEquals("fr", new Intl.Segmenter(["fr", "en"]).resolvedOptions().locale); + +assertEquals("ar", new Intl.Segmenter(["xyz", "ar"]).resolvedOptions().locale); diff --git a/deps/v8/test/intl/segmenter/segment-iterator-following.js b/deps/v8/test/intl/segmenter/segment-iterator-following.js new file mode 100644 index 0000000000..a28d6c31d1 --- /dev/null +++ b/deps/v8/test/intl/segmenter/segment-iterator-following.js @@ -0,0 +1,17 @@ +// Copyright 2018 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-segmenter + +const segmenter = new Intl.Segmenter(); +const text = "Hello World, Test 123! Foo Bar. How are you?"; +const iter = segmenter.segment(text); + +assertEquals("function", typeof iter.following); + +// 1.5.3.2 %SegmentIteratorPrototype%.following( [ from ] ) +// 3.b If from >= iterator.[[SegmentIteratorString]], throw a RangeError exception. +assertDoesNotThrow(() => iter.following(text.length - 1)); +assertThrows(() => iter.following(text.length), RangeError); +assertThrows(() => iter.following(text.length + 1), RangeError); diff --git a/deps/v8/test/intl/segmenter/segment-iterator-next.js b/deps/v8/test/intl/segmenter/segment-iterator-next.js new file mode 100644 index 0000000000..9aa40494ca --- /dev/null +++ b/deps/v8/test/intl/segmenter/segment-iterator-next.js @@ -0,0 +1,11 @@ +// Copyright 2018 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-segmenter + +const segmenter = new Intl.Segmenter(); +const text = "Hello World, Test 123! Foo Bar. How are you?"; +const iter = segmenter.segment(text); + +assertEquals("function", typeof iter.next); diff --git a/deps/v8/test/intl/segmenter/segment-iterator-preceding.js b/deps/v8/test/intl/segmenter/segment-iterator-preceding.js new file mode 100644 index 0000000000..07d73376f2 --- /dev/null +++ b/deps/v8/test/intl/segmenter/segment-iterator-preceding.js @@ -0,0 +1,21 @@ +// Copyright 2018 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-segmenter + +const segmenter = new Intl.Segmenter(); +const text = "Hello World, Test 123! Foo Bar. How are you?"; +const iter = segmenter.segment(text); + +assertEquals("function", typeof iter.preceding); + +// 1.5.3.3 %SegmentIteratorPrototype%.preceding( [ from ] ) +// 3.b If ... from = 0, throw a RangeError exception. +assertThrows(() => iter.preceding(0), RangeError); + +// 1.5.3.3 %SegmentIteratorPrototype%.preceding( [ from ] ) +// 3.b If from > iterator.[[SegmentIteratorString]] ... , throw a RangeError exception. +assertDoesNotThrow(() => iter.preceding(text.length - 1)); +assertDoesNotThrow(() => iter.preceding(text.length)); +assertThrows(() => iter.preceding(text.length + 1), RangeError); diff --git a/deps/v8/test/intl/segmenter/segment-iterator.js b/deps/v8/test/intl/segmenter/segment-iterator.js new file mode 100644 index 0000000000..0d0c31b405 --- /dev/null +++ b/deps/v8/test/intl/segmenter/segment-iterator.js @@ -0,0 +1,13 @@ +// Copyright 2018 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-segmenter + +const segmenter = new Intl.Segmenter(); +const text = "Hello World, Test 123! Foo Bar. How are you?"; +const iter = segmenter.segment(text); + +assertEquals("number", typeof iter.position); +assertEquals(0, iter.position); +assertEquals("strig", typeof iter.breakType); diff --git a/deps/v8/test/intl/segmenter/segment.js b/deps/v8/test/intl/segmenter/segment.js new file mode 100644 index 0000000000..ca17c5040d --- /dev/null +++ b/deps/v8/test/intl/segmenter/segment.js @@ -0,0 +1,7 @@ +// Copyright 2018 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-segmenter + +assertEquals("function", typeof Intl.Segmenter.prototype.segment); diff --git a/deps/v8/test/intl/segmenter/supported-locale.js b/deps/v8/test/intl/segmenter/supported-locale.js new file mode 100644 index 0000000000..24825a2759 --- /dev/null +++ b/deps/v8/test/intl/segmenter/supported-locale.js @@ -0,0 +1,22 @@ +// Copyright 2018 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-segmenter +assertEquals( + typeof Intl.Segmenter.supportedLocalesOf, + "function", + "Intl.Segmenter.supportedLocalesOf should be a function" +); + +var undef = Intl.Segmenter.supportedLocalesOf(); +assertEquals([], undef); + +var empty = Intl.Segmenter.supportedLocalesOf([]); +assertEquals([], empty); + +var strLocale = Intl.Segmenter.supportedLocalesOf("sr"); +assertEquals("sr", strLocale[0]); + +var multiLocale = ["sr-Thai-RS", "de", "zh-CN"]; +assertEquals(multiLocale, Intl.Segmenter.supportedLocalesOf(multiLocale)); diff --git a/deps/v8/test/intl/testcfg.py b/deps/v8/test/intl/testcfg.py index 3d4eed4849..6c5660ea9d 100644 --- a/deps/v8/test/intl/testcfg.py +++ b/deps/v8/test/intl/testcfg.py @@ -56,7 +56,7 @@ class TestSuite(testsuite.TestSuite): return TestCase -class TestCase(testcase.TestCase): +class TestCase(testcase.D8TestCase): def __init__(self, *args, **kwargs): super(TestCase, self).__init__(*args, **kwargs) diff --git a/deps/v8/test/js-perf-test/ArrayLiteralInitialSpreadLargeHoley/run.js b/deps/v8/test/js-perf-test/ArrayLiteralInitialSpreadLargeHoley/run.js index b56efe9836..2a4aff2ee7 100644 --- a/deps/v8/test/js-perf-test/ArrayLiteralInitialSpreadLargeHoley/run.js +++ b/deps/v8/test/js-perf-test/ArrayLiteralInitialSpreadLargeHoley/run.js @@ -5,7 +5,7 @@ // Comparing different copy schemes against spread initial literals. // Benchmarks for large holey arrays. -const largeHoleyArray = new Array(100000); +const largeHoleyArray = new Array(1e5); for (var i = 0; i < 100; i++) { largeHoleyArray[i] = i; @@ -140,9 +140,9 @@ function PrintError(name, error) { success = false; } -// Run the benchmark (20 x 100) iterations instead of 1 second. +// Run the benchmark (5 x 100) iterations instead of 1 second. function CreateBenchmark(name, f) { - new BenchmarkSuite(name, [1000], [ new Benchmark(name, false, false, 20, f) ]); + new BenchmarkSuite(name, [1000], [ new Benchmark(name, false, false, 5, f) ]); } CreateBenchmark('Spread', SpreadLargeHoley); @@ -152,8 +152,9 @@ CreateBenchmark('Slice', SliceLargeHoley); CreateBenchmark('Slice0', Slice0LargeHoley); CreateBenchmark('ConcatReceive', ConcatReceiveLargeHoley); CreateBenchmark('ConcatArg', ConcatArgLargeHoley); -CreateBenchmark('ForOfPush', ForOfPushLargeHoley); -CreateBenchmark('MapId', MapIdLargeHoley); +// The following benchmarks are so slow that they will time out. +// CreateBenchmark('ForOfPush', ForOfPushLargeHoley); +// CreateBenchmark('MapId', MapIdLargeHoley); BenchmarkSuite.config.doWarmup = true; diff --git a/deps/v8/test/js-perf-test/ArrayLiteralInitialSpreadLarge/run.js b/deps/v8/test/js-perf-test/ArrayLiteralInitialSpreadLargePacked/run.js index a018735fc9..38643c6903 100644 --- a/deps/v8/test/js-perf-test/ArrayLiteralInitialSpreadLarge/run.js +++ b/deps/v8/test/js-perf-test/ArrayLiteralInitialSpreadLargePacked/run.js @@ -5,7 +5,7 @@ // Comparing different copy schemes against spread initial literals. // Benchmarks for large packed arrays. -const largeHoleyArray = new Array(100000); +const largeHoleyArray = new Array(1e5); const largeArray = Array.from(largeHoleyArray.keys()); // ---------------------------------------------------------------------------- @@ -125,7 +125,7 @@ load('../base.js'); var success = true; function PrintResult(name, result) { - print(name + '-ArrayLiteralInitialSpreadLarge(Score): ' + result); + print(name + '-ArrayLiteralInitialSpreadLargePacked(Score): ' + result); } function PrintError(name, error) { @@ -133,9 +133,9 @@ function PrintError(name, error) { success = false; } -// Run the benchmark (20 x 100) iterations instead of 1 second. +// Run the benchmark (5 x 100) iterations instead of 1 second. function CreateBenchmark(name, f) { - new BenchmarkSuite(name, [1000], [ new Benchmark(name, false, false, 20, f) ]); + new BenchmarkSuite(name, [1000], [ new Benchmark(name, false, false, 5, f) ]); } CreateBenchmark('Spread', SpreadLarge); @@ -145,8 +145,9 @@ CreateBenchmark('Slice', SliceLarge); CreateBenchmark('Slice0', Slice0Large); CreateBenchmark('ConcatReceive', ConcatReceiveLarge); CreateBenchmark('ConcatArg', ConcatArgLarge); -CreateBenchmark('ForOfPush', ForOfPushLarge); -CreateBenchmark('MapId', MapIdLarge); +// The following benchmarks are so slow that they will time out. +// CreateBenchmark('ForOfPush', ForOfPushLarge); +// CreateBenchmark('MapId', MapIdLarge); BenchmarkSuite.config.doWarmup = true; BenchmarkSuite.config.doDeterministic = true; diff --git a/deps/v8/test/js-perf-test/ArrayLiteralInitialSpreadSmall/run.js b/deps/v8/test/js-perf-test/ArrayLiteralInitialSpreadSmallPacked/run.js index 5c8b8d1ac4..9d29fa40b2 100644 --- a/deps/v8/test/js-perf-test/ArrayLiteralInitialSpreadSmall/run.js +++ b/deps/v8/test/js-perf-test/ArrayLiteralInitialSpreadSmallPacked/run.js @@ -126,7 +126,7 @@ load('../base.js'); var success = true; function PrintResult(name, result) { - print(name + '-ArrayLiteralInitialSpreadSmall(Score): ' + result); + print(name + '-ArrayLiteralInitialSpreadSmallPacked(Score): ' + result); } function PrintError(name, error) { diff --git a/deps/v8/test/js-perf-test/JSTests.json b/deps/v8/test/js-perf-test/JSTests.json index 3793e2c9a8..c2aacb452f 100644 --- a/deps/v8/test/js-perf-test/JSTests.json +++ b/deps/v8/test/js-perf-test/JSTests.json @@ -60,48 +60,71 @@ "results_regexp": "^Generators\\-Generators\\(Score\\): (.+)$" }, { - "name": "ArrayLiteralInitialSpread", - "path": ["ArrayLiteralInitialSpread"], + "name": "ArrayLiteralInitialSpreadSmallPacked", + "path": ["ArrayLiteralInitialSpreadSmallPacked"], "main": "run.js", "resources": [], - "results_regexp": "^%s\\-ArrayLiteralInitialSpread\\(Score\\): (.+)$", + "results_regexp": "^%s\\-ArrayLiteralInitialSpreadSmallPacked\\(Score\\): (.+)$", "tests": [ - {"name": "Spread-Small"}, - {"name": "ForLength-Small"}, - {"name": "ForLengthEmpty-Small"}, - {"name": "Slice-Small"}, - {"name": "Slice0-Small"}, - {"name": "ConcatReceive-Small"}, - {"name": "ConcatArg-Small"}, - {"name": "ForOfPush-Small"}, - {"name": "MapId-Small"}, - {"name": "Spread-Large"}, - {"name": "ForLength-Large"}, - {"name": "ForLengthEmpty-Large"}, - {"name": "Slice-Large"}, - {"name": "Slice0-Large"}, - {"name": "ConcatReceive-Large"}, - {"name": "ConcatArg-Large"}, - {"name": "ForOfPush-Large"}, - {"name": "MapId-Large"}, - {"name": "Spread-SmallHoley"}, - {"name": "ForLength-SmallHoley"}, - {"name": "ForLengthEmpty-SmallHoley"}, - {"name": "Slice-SmallHoley"}, - {"name": "Slice0-SmallHoley"}, - {"name": "ConcatReceive-SmallHoley"}, - {"name": "ConcatArg-SmallHoley"}, - {"name": "ForOfPush-SmallHoley"}, - {"name": "MapId-SmallHoley"}, - {"name": "Spread-LargeHoley"}, - {"name": "ForLength-LargeHoley"}, - {"name": "ForLengthEmpty-LargeHoley"}, - {"name": "Slice-LargeHoley"}, - {"name": "Slice0-LargeHoley"}, - {"name": "ConcatReceive-LargeHoley"}, - {"name": "ConcatArg-LargeHoley"}, - {"name": "ForOfPush-LargeHoley"}, - {"name": "MapId-LargeHoley"} + {"name": "Spread"}, + {"name": "ForLength"}, + {"name": "ForLengthEmpty"}, + {"name": "Slice"}, + {"name": "Slice0"}, + {"name": "ConcatReceive"}, + {"name": "ConcatArg"}, + {"name": "ForOfPush"}, + {"name": "MapId"} + ] + }, + { + "name": "ArrayLiteralInitialSpreadLargePacked", + "path": ["ArrayLiteralInitialSpreadLargePacked"], + "main": "run.js", + "resources": [], + "results_regexp": "^%s\\-ArrayLiteralInitialSpreadLargePacked\\(Score\\): (.+)$", + "tests": [ + {"name": "Spread"}, + {"name": "ForLength"}, + {"name": "ForLengthEmpty"}, + {"name": "Slice"}, + {"name": "Slice0"}, + {"name": "ConcatReceive"}, + {"name": "ConcatArg"} + ] + }, + { + "name": "ArrayLiteralInitialSpreadSmallHoley", + "path": ["ArrayLiteralInitialSpreadSmallHoley"], + "main": "run.js", + "resources": [], + "results_regexp": "^%s\\-ArrayLiteralInitialSpreadSmallHoley\\(Score\\): (.+)$", + "tests": [ + {"name": "Spread"}, + {"name": "ForLength"}, + {"name": "ForLengthEmpty"}, + {"name": "Slice"}, + {"name": "Slice0"}, + {"name": "ConcatReceive"}, + {"name": "ConcatArg"}, + {"name": "ForOfPush"}, + {"name": "MapId"} + ] + }, + { + "name": "ArrayLiteralInitialSpreadLargeHoley", + "path": ["ArrayLiteralInitialSpreadLargeHoley"], + "main": "run.js", + "resources": [], + "results_regexp": "^%s\\-ArrayLiteralInitialSpreadLargeHoley\\(Score\\): (.+)$", + "tests": [ + {"name": "Spread"}, + {"name": "ForLength"}, + {"name": "ForLengthEmpty"}, + {"name": "Slice"}, + {"name": "Slice0"}, + {"name": "ConcatReceive"}, + {"name": "ConcatArg"} ] }, { diff --git a/deps/v8/test/js-perf-test/Parsing/arrowfunctions.js b/deps/v8/test/js-perf-test/Parsing/arrowfunctions.js index bee4ef8b30..40955ea450 100644 --- a/deps/v8/test/js-perf-test/Parsing/arrowfunctions.js +++ b/deps/v8/test/js-perf-test/Parsing/arrowfunctions.js @@ -27,29 +27,29 @@ new BenchmarkSuite("FakeArrowFunction", [1000], [ ]); function ArrowFunctionShortSetup() { - code = "let a;\n" + "a = (a,b) => { return a+b; }\n".repeat(100) + code = "let a;\n" + "a = (a,b) => { return a+b; }\n".repeat(50) } function ArrowFunctionLongSetup() { - code = "let a;\n" + "a = (a,b,c,d,e,f,g,h,i,j) => { return a+b; }\n".repeat(100) + code = "let a;\n" + "a = (a,b,c,d,e,f,g,h,i,j) => { return a+b; }\n".repeat(50) } function CommaSepExpressionListShortSetup() { - code = "let a;\n" + "a = (a,1)\n".repeat(100) + code = "let a;\n" + "a = (a,1)\n".repeat(50) } function CommaSepExpressionListLongSetup() { - code = "let a; let b; let c;\n" + "a = (a,2,3,4,5,b,c,1,7,1)\n".repeat(100) + code = "let a; let b; let c;\n" + "a = (a,2,3,4,5,b,c,1,7,1)\n".repeat(50) } function CommaSepExpressionListLateSetup() { code = "let a; let b; let c; let d; let e; let f; let g; let h; let i;\n" - + "a = (a,b,c,d,e,f,g,h,i,1)\n".repeat(100) + + "a = (a,b,c,d,e,f,g,h,i,1)\n".repeat(50) } function FakeArrowFunctionSetup() { code = "let a; let b; let c; let d; let e; let f; let g; let h; let i; let j;\n" - + "a = (a,b,c,d,e,f,g,h,i,j)\n".repeat(100) + + "a = (a,b,c,d,e,f,g,h,i,j)\n".repeat(50) } function Run() { diff --git a/deps/v8/test/js-perf-test/SpreadCallsGeneral/run.js b/deps/v8/test/js-perf-test/SpreadCallsGeneral/run.js index fc4bf35a77..9f8db96447 100644 --- a/deps/v8/test/js-perf-test/SpreadCallsGeneral/run.js +++ b/deps/v8/test/js-perf-test/SpreadCallsGeneral/run.js @@ -64,6 +64,6 @@ CreateBenchmark('ApplySpreadLiteral', ApplySpreadLiteral); CreateBenchmark('SpreadCall', SpreadCall); CreateBenchmark('SpreadCallSpreadLiteral', SpreadCallSpreadLiteral); -BenchmarkSuite.config.doWarmup = undefined; +BenchmarkSuite.config.doWarmup = true; BenchmarkSuite.config.doDeterministic = undefined; BenchmarkSuite.RunSuites({NotifyResult: PrintResult, NotifyError: PrintError}); diff --git a/deps/v8/test/js-perf-test/TurboFan/typedLowering.js b/deps/v8/test/js-perf-test/TurboFan/typedLowering.js index d2ce15cc6e..663951f99c 100644 --- a/deps/v8/test/js-perf-test/TurboFan/typedLowering.js +++ b/deps/v8/test/js-perf-test/TurboFan/typedLowering.js @@ -7,7 +7,9 @@ function NumberToString() { var num = 10240; var obj = {}; - for ( var i = 0; i < num; i++ ) + for ( var i = 0; i < num; i++ ) { ret = obj["test" + num]; + } } + createSuite('NumberToString', 1000, NumberToString); diff --git a/deps/v8/test/message/README.md b/deps/v8/test/message/README.md index 270d583fcd..ba36b14bfe 100644 --- a/deps/v8/test/message/README.md +++ b/deps/v8/test/message/README.md @@ -1,7 +1,7 @@ # JavaScript tests with expected output -Tests in test/message pass if the output matches the expected output. Message -tests are particularly useful when checking for exact error messages. +Tests in `test/message` pass if the output matches the expected output. +Message tests are particularly useful when checking for exact error messages. Tests and their expected output must have the same filename, with the `.js` and `.out` extension. @@ -15,11 +15,13 @@ foo.out handle output from multiple runs, e.g., `--stress-opt`. Without an exception, the output will be generated several times and the comparison will fail. -You can use a regex in the expected output. Instead of the exact -path. use - ``` +You can use a regex in the expected output instead of the exact +path: + +``` *%(basename)s:7: SyntaxError: Detected cycle while resolving name 'a' ``` + Empty lines are ignored in the comparison, but whitespaces are not. Exact details of the test runner are in [testcfg.py](testcfg.py). diff --git a/deps/v8/test/message/fail/class-fields-computed.js b/deps/v8/test/message/fail/class-fields-computed.js new file mode 100644 index 0000000000..d9b41906ab --- /dev/null +++ b/deps/v8/test/message/fail/class-fields-computed.js @@ -0,0 +1,9 @@ +// Copyright 2018 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-public-fields + +class X { + [foo()] = 1; +} diff --git a/deps/v8/test/message/fail/class-fields-computed.out b/deps/v8/test/message/fail/class-fields-computed.out new file mode 100644 index 0000000000..214b273af5 --- /dev/null +++ b/deps/v8/test/message/fail/class-fields-computed.out @@ -0,0 +1,5 @@ +*%(basename)s:8: ReferenceError: foo is not defined + [foo()] = 1; + ^ +ReferenceError: foo is not defined + at *%(basename)s:8:4
\ No newline at end of file diff --git a/deps/v8/test/message/fail/class-fields-static-throw.js b/deps/v8/test/message/fail/class-fields-static-throw.js new file mode 100644 index 0000000000..e7c9fec1ba --- /dev/null +++ b/deps/v8/test/message/fail/class-fields-static-throw.js @@ -0,0 +1,11 @@ +// Copyright 2018 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-public-fields --harmony-static-fields +// +// TODO(gsathya): Remove 'Function' from stack trace. + +class X { + static x = foo(); +} diff --git a/deps/v8/test/message/fail/class-fields-static-throw.out b/deps/v8/test/message/fail/class-fields-static-throw.out new file mode 100644 index 0000000000..a16b050bbd --- /dev/null +++ b/deps/v8/test/message/fail/class-fields-static-throw.out @@ -0,0 +1,6 @@ +*%(basename)s:10: ReferenceError: foo is not defined + static x = foo(); + ^ +ReferenceError: foo is not defined + at Function.<static_fields_initializer> (*%(basename)s:10:14) + at *%(basename)s:1:1
\ No newline at end of file diff --git a/deps/v8/test/message/fail/class-fields-throw.js b/deps/v8/test/message/fail/class-fields-throw.js new file mode 100644 index 0000000000..235a964ae8 --- /dev/null +++ b/deps/v8/test/message/fail/class-fields-throw.js @@ -0,0 +1,11 @@ +// Copyright 2018 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-public-fields + +class X { + x = foo(); +} + +new X; diff --git a/deps/v8/test/message/fail/class-fields-throw.out b/deps/v8/test/message/fail/class-fields-throw.out new file mode 100644 index 0000000000..f1036fde86 --- /dev/null +++ b/deps/v8/test/message/fail/class-fields-throw.out @@ -0,0 +1,7 @@ +*%(basename)s:8: ReferenceError: foo is not defined + x = foo(); + ^ +ReferenceError: foo is not defined + at X.<instance_fields_initializer> (*%(basename)s:8:7) + at new X (*%(basename)s:7:1) + at *%(basename)s:11:1
\ No newline at end of file diff --git a/deps/v8/test/message/fail/map-arg-non-iterable.out b/deps/v8/test/message/fail/map-arg-non-iterable.out index 78aa8ef033..988a8f8b7e 100644 --- a/deps/v8/test/message/fail/map-arg-non-iterable.out +++ b/deps/v8/test/message/fail/map-arg-non-iterable.out @@ -1,6 +1,6 @@ -*%(basename)s:5: TypeError: 1 is not iterable +*%(basename)s:5: TypeError: number 1 is not iterable (cannot read property Symbol(Symbol.iterator)) new Map(1); ^ -TypeError: 1 is not iterable +TypeError: number 1 is not iterable (cannot read property Symbol(Symbol.iterator)) at new Map (<anonymous>) at *%(basename)s:5:1 diff --git a/deps/v8/test/message/fail/undefined-keyed-property.out b/deps/v8/test/message/fail/undefined-keyed-property.out index 84673252eb..94600196ca 100644 --- a/deps/v8/test/message/fail/undefined-keyed-property.out +++ b/deps/v8/test/message/fail/undefined-keyed-property.out @@ -2,8 +2,8 @@ # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. -*%(basename)s:6: TypeError: Cannot read property 'Symbol(Symbol.iterator)' of undefined +*%(basename)s:6: TypeError: undefined is not iterable (cannot read property Symbol(Symbol.iterator)) x[Symbol.iterator]; ^ -TypeError: Cannot read property 'Symbol(Symbol.iterator)' of undefined +TypeError: undefined is not iterable (cannot read property Symbol(Symbol.iterator)) at *%(basename)s:6:2 diff --git a/deps/v8/test/message/message.status b/deps/v8/test/message/message.status index 6aba054251..d106f51e27 100644 --- a/deps/v8/test/message/message.status +++ b/deps/v8/test/message/message.status @@ -43,4 +43,10 @@ 'wasm-trace-memory-liftoff': [SKIP], }], # arch != x64 and arch != ia32 +['variant == code_serializer', { + # TODO(yangguo): Code serializer output is incompatible with all message + # tests. + '*': [SKIP], +}], # variant == code_serializer + ] diff --git a/deps/v8/test/message/testcfg.py b/deps/v8/test/message/testcfg.py index b0f821f62f..e27a3ed2a2 100644 --- a/deps/v8/test/message/testcfg.py +++ b/deps/v8/test/message/testcfg.py @@ -59,7 +59,7 @@ class TestSuite(testsuite.TestSuite): return TestCase -class TestCase(testcase.TestCase): +class TestCase(testcase.D8TestCase): def __init__(self, *args, **kwargs): super(TestCase, self).__init__(*args, **kwargs) @@ -96,6 +96,11 @@ class TestCase(testcase.TestCase): def _get_source_path(self): return os.path.join(self.suite.root, self.path + self._get_suffix()) + def skip_predictable(self): + # Message tests expected to fail don't print allocation output for + # predictable testing. + return super(TestCase, self).skip_predictable() or self._expected_fail() + @property def output_proc(self): return message.OutProc(self.expected_outcomes, diff --git a/deps/v8/test/message/wasm-trace-memory-interpreted.js b/deps/v8/test/message/wasm-trace-memory-interpreted.js index 75f42e82e6..fdac585b39 100644 --- a/deps/v8/test/message/wasm-trace-memory-interpreted.js +++ b/deps/v8/test/message/wasm-trace-memory-interpreted.js @@ -2,6 +2,6 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -// Flags: --no-stress-opt --expose-wasm --wasm-trace-memory --wasm-interpret-all +// Flags: --no-stress-opt --expose-wasm --trace-wasm-memory --wasm-interpret-all load("test/message/wasm-trace-memory.js"); diff --git a/deps/v8/test/message/wasm-trace-memory-liftoff.js b/deps/v8/test/message/wasm-trace-memory-liftoff.js index b56d1d7978..a23eca4a0f 100644 --- a/deps/v8/test/message/wasm-trace-memory-liftoff.js +++ b/deps/v8/test/message/wasm-trace-memory-liftoff.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: --no-stress-opt --wasm-trace-memory --liftoff --no-future +// Flags: --no-stress-opt --trace-wasm-memory --liftoff --no-future // Flags: --no-wasm-tier-up load("test/message/wasm-trace-memory.js"); diff --git a/deps/v8/test/message/wasm-trace-memory.js b/deps/v8/test/message/wasm-trace-memory.js index adb1e2b7a7..53c46073ec 100644 --- a/deps/v8/test/message/wasm-trace-memory.js +++ b/deps/v8/test/message/wasm-trace-memory.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: --no-stress-opt --wasm-trace-memory --no-liftoff --no-future +// Flags: --no-stress-opt --trace-wasm-memory --no-liftoff --no-future // Flags: --no-wasm-tier-up load("test/mjsunit/wasm/wasm-constants.js"); diff --git a/deps/v8/test/mjsunit/array-functions-prototype-misc.js b/deps/v8/test/mjsunit/array-functions-prototype-misc.js index 7ff5d4f2f5..dd95e2d266 100644 --- a/deps/v8/test/mjsunit/array-functions-prototype-misc.js +++ b/deps/v8/test/mjsunit/array-functions-prototype-misc.js @@ -31,13 +31,8 @@ * should work on other objects too, so we test that too. */ -var LARGE = 400000; -var VERYLARGE = 4000000000; - -// Nicer for firefox 1.5. Unless you uncomment the following two lines, -// smjs will appear to hang on this file. -//var LARGE = 40000; -//var VERYLARGE = 40000; +var LARGE = 40000; +var VERYLARGE = 40000; var fourhundredth = LARGE/400; @@ -45,7 +40,7 @@ function PseudoArray() { }; for (var use_real_arrays = 0; use_real_arrays <= 1; use_real_arrays++) { - var poses = [0, 140, 20000, VERYLARGE]; + var poses = [0, 140, 20000]; var the_prototype; var new_function; var push_function; @@ -252,19 +247,22 @@ for (var use_real_arrays = 0; use_real_arrays <= 1; use_real_arrays++) { assertEquals("bar", a[2]); // Shift. - var baz = shift_function(a); - assertEquals("baz", baz); - assertEquals("boo", a[0]); - assertEquals(pos + 3, a.length); - assertEquals("foo", a[pos + 2]); - - // Slice. - var bar = slice_function(a, 1, 0); // don't throw an exception please. - bar = slice_function(a, 1, 2); - assertEquals("bar", bar[0]); - assertEquals(1, bar.length); - assertEquals("bar", a[1]); - + // Skip VERYLARGE arrays, as we removed sparse support for shift. + // Slice is also skipped, since it relies on the "shift" test to be run. + if (pos < VERYLARGE) { + var baz = shift_function(a); + assertEquals("baz", baz); + assertEquals("boo", a[0]); + assertEquals(pos + 3, a.length); + assertEquals("foo", a[pos + 2]); + + // Slice. + var bar = slice_function(a, 1, 0); // don't throw an exception please. + bar = slice_function(a, 1, 2); + assertEquals("bar", bar[0]); + assertEquals(1, bar.length); + assertEquals("bar", a[1]); + } } } diff --git a/deps/v8/test/mjsunit/array-splice.js b/deps/v8/test/mjsunit/array-splice.js index 75ff2d174b..460172edd7 100644 --- a/deps/v8/test/mjsunit/array-splice.js +++ b/deps/v8/test/mjsunit/array-splice.js @@ -445,3 +445,21 @@ "array.hasOwnProperty(Math.pow(2, 32) - 2)"); } })(); + +// Verify that fast implementations aren't confused by empty DOUBLE element arrays +(function() { + + function foo(dontAddAnything) { + let a = []; + if (dontAddAnything === undefined) { + a[1] = 0.5; + } + return a.splice(0, 0, 3.5); + } + + // Learn via allocation site tracking to create double arrays in foo(). + foo(); + foo(); + // force splice to copy the input array. + foo(true); +})(); diff --git a/deps/v8/test/mjsunit/array-unshift.js b/deps/v8/test/mjsunit/array-unshift.js index 50aab4f52a..cbc8d4091d 100644 --- a/deps/v8/test/mjsunit/array-unshift.js +++ b/deps/v8/test/mjsunit/array-unshift.js @@ -190,15 +190,12 @@ (function() { for (var i = 0; i < 7; i++) { try { - new Array(Math.pow(2, 32) - 3).unshift(1, 2, 3, 4, 5); - throw 'Should have thrown RangeError'; + let obj = { length: 2 ** 53 - 3}; + Array.prototype.unshift.call(obj, 1, 2, 3, 4, 5); + throw 'Should have thrown TypeError'; } catch (e) { - assertTrue(e instanceof RangeError); + assertTrue(e instanceof TypeError); } - - // Check smi boundary - var bigNum = (1 << 30) - 3; - assertEquals(bigNum + 7, new Array(bigNum).unshift(1, 2, 3, 4, 5, 6, 7)); } })(); diff --git a/deps/v8/test/mjsunit/async-stack-traces-prepare-stacktrace-1.js b/deps/v8/test/mjsunit/async-stack-traces-prepare-stacktrace-1.js new file mode 100644 index 0000000000..42482595cc --- /dev/null +++ b/deps/v8/test/mjsunit/async-stack-traces-prepare-stacktrace-1.js @@ -0,0 +1,31 @@ +// Copyright 2018 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: --async-stack-traces + +// Check that Error.prepareStackTrace doesn't expose strict +// mode closures, even in the presence of async frames. +Error.prepareStackTrace = (e, frames) => { + assertEquals(two, frames[0].getFunction()); + assertEquals(two.name, frames[0].getFunctionName()); + assertEquals(undefined, frames[1].getFunction()); + assertEquals(one.name, frames[1].getFunctionName()); + return frames; +}; + +async function one(x) { + "use strict"; + return await two(x); +} + +async function two(x) { + try { + x = await x; + throw new Error(); + } catch (e) { + return e.stack; + } +} + +one(1).catch(e => setTimeout(_ => {throw e}, 0)); diff --git a/deps/v8/test/mjsunit/async-stack-traces-prepare-stacktrace-2.js b/deps/v8/test/mjsunit/async-stack-traces-prepare-stacktrace-2.js new file mode 100644 index 0000000000..8126a83dc9 --- /dev/null +++ b/deps/v8/test/mjsunit/async-stack-traces-prepare-stacktrace-2.js @@ -0,0 +1,31 @@ +// Copyright 2018 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: --async-stack-traces + +// Check that Error.prepareStackTrace doesn't expose strict +// mode closures, even in the presence of async frames. +Error.prepareStackTrace = (e, frames) => { + assertEquals(undefined, frames[0].getFunction()); + assertEquals(two.name, frames[0].getFunctionName()); + assertEquals(undefined, frames[1].getFunction()); + assertEquals(one.name, frames[1].getFunctionName()); + return frames; +}; + +async function one(x) { + return await two(x); +} + +async function two(x) { + "use strict"; + try { + x = await x; + throw new Error(); + } catch (e) { + return e.stack; + } +} + +one(1).catch(e => setTimeout(_ => {throw e}, 0)); diff --git a/deps/v8/test/mjsunit/async-stack-traces-prepare-stacktrace-3.js b/deps/v8/test/mjsunit/async-stack-traces-prepare-stacktrace-3.js new file mode 100644 index 0000000000..429b0f64c3 --- /dev/null +++ b/deps/v8/test/mjsunit/async-stack-traces-prepare-stacktrace-3.js @@ -0,0 +1,31 @@ +// Copyright 2018 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: --async-stack-traces + +// Check that Error.prepareStackTrace properly marks async frames. +Error.prepareStackTrace = (e, frames) => { + assertEquals(two, frames[0].getFunction()); + assertEquals(two.name, frames[0].getFunctionName()); + assertFalse(frames[0].isAsync()); + assertEquals(two, frames[1].getFunction()); + assertEquals(one.name, frames[1].getFunctionName()); + assertTrue(frames[1].isAsync()); + return frames; +}; + +async function one(x) { + return await two(x); +} + +async function two(x) { + try { + x = await x; + throw new Error(); + } catch (e) { + return e.stack; + } +} + +one(1).catch(e => setTimeout(_ => {throw e}, 0)); diff --git a/deps/v8/test/mjsunit/async-stack-traces.js b/deps/v8/test/mjsunit/async-stack-traces.js new file mode 100644 index 0000000000..05cf8a095f --- /dev/null +++ b/deps/v8/test/mjsunit/async-stack-traces.js @@ -0,0 +1,270 @@ +// Copyright 2018 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 --async-stack-traces + +// Basic test with an explicit throw. +(function() { + async function one(x) { + await two(x); + } + + async function two(x) { + await x; + throw new Error(); + } + + async function test(f) { + try { + await f(1); + assertUnreachable(); + } catch (e) { + assertInstanceof(e, Error); + assertMatches(/Error.+at two.+at async one.+at async test/ms, e.stack); + } + } + + assertPromiseResult((async () => { + await test(one); + await test(one); + %OptimizeFunctionOnNextCall(two); + await test(one); + %OptimizeFunctionOnNextCall(one); + await test(one); + })()); +})(); + +// Basic test with an implicit throw (via ToNumber on Symbol). +(function() { + async function one(x) { + return await two(x); + } + + async function two(x) { + await x; + return +x; // This will raise a TypeError. + } + + async function test(f) { + try { + await f(Symbol()); + assertUnreachable(); + } catch (e) { + assertInstanceof(e, TypeError); + assertMatches(/TypeError.+at two.+at async one.+at async test/ms, e.stack); + } + } + + assertPromiseResult((async() => { + await test(one); + await test(one); + %OptimizeFunctionOnNextCall(two); + await test(one); + %OptimizeFunctionOnNextCall(one); + await test(one); + })()); +})(); + +// Basic test with throw in inlined function. +(function() { + function throwError() { + throw new Error(); + } + + async function one(x) { + return await two(x); + } + + async function two(x) { + await x; + return throwError(); + } + + async function test(f) { + try { + await f(1); + assertUnreachable(); + } catch (e) { + assertInstanceof(e, Error); + assertMatches(/Error.+at two.+at async one.+at async test/ms, e.stack); + } + } + + assertPromiseResult((async() => { + await test(one); + await test(one); + %OptimizeFunctionOnNextCall(two); + await test(one); + %OptimizeFunctionOnNextCall(one); + await test(one); + })()); +})(); + +// Basic test with async function inlined into sync function. +(function() { + function callOne(x) { + return one(x); + } + + function callTwo(x) { + return two(x); + } + + async function one(x) { + return await callTwo(x); + } + + async function two(x) { + await x; + throw new Error(); + } + + async function test(f) { + try { + await f(1); + assertUnreachable(); + } catch (e) { + assertInstanceof(e, Error); + assertMatches(/Error.+at two.+at async one.+at async test/ms, e.stack); + } + } + + assertPromiseResult((async() => { + await test(callOne); + await test(callOne); + %OptimizeFunctionOnNextCall(callTwo); + await test(callOne); + %OptimizeFunctionOnNextCall(callOne); + await test(callOne); + })()); +})(); + +// Basic test with async functions and promises chained via +// Promise.prototype.then(), which should still work following +// the generic chain upwards. +(function() { + async function one(x) { + return await two(x).then(x => x); + } + + async function two(x) { + await x.then(x => x); + throw new Error(); + } + + async function test(f) { + try { + await f(Promise.resolve(1)); + assertUnreachable(); + } catch (e) { + assertInstanceof(e, Error); + assertMatches(/Error.+at two.+at async one.+at async test/ms, e.stack); + } + } + + assertPromiseResult((async() => { + await test(one); + await test(one); + %OptimizeFunctionOnNextCall(two); + await test(one); + %OptimizeFunctionOnNextCall(one); + await test(one); + })()); +})(); + +// Basic test for async generators called from async +// functions with an explicit throw. +(function() { + async function one(x) { + for await (const y of two(x)) {} + } + + async function* two(x) { + await x; + throw new Error(); + } + + async function test(f) { + try { + await f(1); + assertUnreachable(); + } catch (e) { + assertInstanceof(e, Error); + assertMatches(/Error.+at two.+at async one.+at async test/ms, e.stack); + } + } + + assertPromiseResult((async () => { + await test(one); + await test(one); + %OptimizeFunctionOnNextCall(two); + await test(one); + %OptimizeFunctionOnNextCall(one); + await test(one); + })()); +})(); + +// Basic test for async functions called from async +// generators with an explicit throw. +(function() { + async function* one(x) { + await two(x); + } + + async function two(x) { + await x; + throw new Error(); + } + + async function test(f) { + try { + for await (const x of f(1)) {} + assertUnreachable(); + } catch (e) { + assertInstanceof(e, Error); + assertMatches(/Error.+at two.+at async one.+at async test/ms, e.stack); + } + } + + assertPromiseResult((async () => { + await test(one); + await test(one); + %OptimizeFunctionOnNextCall(two); + await test(one); + %OptimizeFunctionOnNextCall(one); + await test(one); + })()); +})(); + +// Basic test for async functions called from async +// generators with an explicit throw (with yield). +(function() { + async function* one(x) { + yield two(x); + } + + async function two(x) { + await x; + throw new Error(); + } + + async function test(f) { + try { + for await (const x of f(1)) {} + assertUnreachable(); + } catch (e) { + assertInstanceof(e, Error); + assertMatches(/Error.+at two.+at async one.+at async test/ms, e.stack); + } + } + + assertPromiseResult((async () => { + await test(one); + await test(one); + %OptimizeFunctionOnNextCall(two); + await test(one); + %OptimizeFunctionOnNextCall(one); + await test(one); + })()); +})(); diff --git a/deps/v8/test/mjsunit/code-coverage-block.js b/deps/v8/test/mjsunit/code-coverage-block.js index 8cbb2969f7..61ed87fc13 100644 --- a/deps/v8/test/mjsunit/code-coverage-block.js +++ b/deps/v8/test/mjsunit/code-coverage-block.js @@ -471,7 +471,7 @@ TestCoverage( {"start":472,"end":503,"count":0}, {"start":626,"end":653,"count":0}, {"start":768,"end":803,"count":0}, - {"start":867,"end":869,"count":0}] + {"start":867,"end":868,"count":0}] ); TestCoverage( @@ -850,46 +850,4 @@ Util.escape("foo.bar"); // 0400 {"start":268,"end":350,"count":0}] ); -TestCoverage( -"https://crbug.com/v8/8237", -` -!function() { // 0000 - if (true) // 0050 - while (false) return; else nop(); // 0100 -}(); // 0150 -!function() { // 0200 - if (true) l0: { break l0; } else // 0250 - if (nop()) { } // 0300 -}(); // 0350 -!function() { // 0400 - if (true) { if (false) { return; } // 0450 - } else if (nop()) { } }(); // 0500 -!function(){ // 0550 - if(true)while(false)return;else nop() // 0600 -}(); // 0650 -!function(){ // 0700 - if(true) l0:{break l0}else if (nop()){} // 0750 -}(); // 0800 -!function(){ // 0850 - if(true){if(false){return}}else // 0900 - if(nop()){} // 0950 -}(); // 1000 -`, -[{"start":0,"end":1049,"count":1}, - {"start":1,"end":151,"count":1}, - {"start":118,"end":137,"count":0}, - {"start":201,"end":351,"count":1}, - {"start":277,"end":318,"count":0}, - {"start":401,"end":525,"count":1}, - {"start":475,"end":486,"count":0}, - {"start":503,"end":523,"count":0}, - {"start":551,"end":651,"count":1}, - {"start":622,"end":639,"count":0}, - {"start":701,"end":801,"count":1}, - {"start":773,"end":791,"count":0}, - {"start":851,"end":1001,"count":1}, - {"start":920,"end":928,"count":0}, - {"start":929,"end":965,"count":0}] -); - %DebugToggleBlockCoverage(false); diff --git a/deps/v8/test/mjsunit/code-coverage-class-fields.js b/deps/v8/test/mjsunit/code-coverage-class-fields.js new file mode 100644 index 0000000000..a91c25824f --- /dev/null +++ b/deps/v8/test/mjsunit/code-coverage-class-fields.js @@ -0,0 +1,199 @@ +// Copyright 2017 the V8 project authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +// Flags: --allow-natives-syntax --no-always-opt --harmony-public-fields --harmony-static-fields +// Files: test/mjsunit/code-coverage-utils.js + +%DebugToggleBlockCoverage(true); + +TestCoverage( +"class with no fields", +`class X { // 000 +}; // 050 +`, + [ + { start: 0, end: 98, count: 1 }, + { start: 0, end: 0, count: 0 }, + ] +); + +TestCoverage( +"class that's not created", +`class X { // 000 + x = function() { } // 050 +}; // 100 +`, + [ + { start: 0, end: 148, count: 1 }, + { start: 0, end: 0, count: 0 }, + { start: 51, end: 69, count: 0 }, + ] +); + +TestCoverage( +"class with field thats not called", +`class X { // 000 + x = function() { } // 050 +}; // 100 +let x = new X(); // 150 +`, + [ + { start: 0, end: 198, count: 1 }, + { start: 0, end: 0, count: 1 }, + { start: 51, end: 69, count: 1 }, + { start: 55, end: 69, count: 0 } + ] +); + +TestCoverage( +"class field", +`class X { // 000 + x = function() { } // 050 +}; // 100 +let x = new X(); // 150 +x.x(); // 200 +`, + [ + { start: 0, end: 248, count: 1 }, + { start: 0, end: 0, count: 1 }, + { start: 51, end: 69, count: 1 }, + { start: 55, end: 69, count: 1 } + ] +); + +TestCoverage( +"non contiguous class field", +`class X { // 000 + x = function() { } // 050 + foo() { } // 100 + y = function() {} // 150 +}; // 200 +let x = new X(); // 250 +x.x(); // 300 +x.y(); // 350 +`, + [ + { start: 0, end: 398, count: 1 }, + { start: 0, end: 0, count: 1 }, + { start: 51, end: 168, count: 1 }, + { start: 55, end: 69, count: 1 }, + { start: 101, end: 110, count: 0 }, + { start: 155, end: 168, count: 1 }, + ] +); + +TestCoverage( +"non contiguous class field thats called", +`class X { // 000 + x = function() { } // 050 + foo() { } // 100 + y = function() {} // 150 +}; // 200 +let x = new X(); // 250 +x.x(); // 300 +x.y(); // 350 +x.foo(); // 400 +`, + [ + { start: 0, end: 448, count: 1 }, + { start: 0, end: 0, count: 1 }, + { start: 51, end: 168, count: 1 }, + { start: 55, end: 69, count: 1 }, + { start: 101, end: 110, count: 1 }, + { start: 155, end: 168, count: 1 }, + ] +); + +TestCoverage( +"class with initializer iife", +`class X { // 000 + x = (function() { })() // 050 +}; // 100 +let x = new X(); // 150 +`, + [ + { start: 0, end: 198, count: 1 }, + { start: 0, end: 0, count: 1 }, + { start: 51, end: 73, count: 1 }, + { start: 56, end: 70, count: 1 } + ] +); + +TestCoverage( +"class with computed field", +` +function f() {}; // 000 +class X { // 050 + [f()] = (function() { })() // 100 +}; // 150 +let x = new X(); // 200 +`, + [ + { start: 0, end: 249, count: 1 }, + { start: 0, end: 15, count: 1 }, + { start: 50, end: 50, count: 1 }, + { start: 102, end: 128, count: 1 }, + { start: 111, end: 125, count: 1 } + ] +); + +TestCoverage( +"static class field that's not called", +`class X { // 000 + static x = function() { } // 050 +}; // 100 +`, + [ + { start: 0, end: 148, count: 1 }, + { start: 0, end: 0, count: 0 }, + { start: 51, end: 76, count: 1 }, + { start: 62, end: 76, count: 0 } + ] +); + +TestCoverage( +"static class field", +`class X { // 000 + static x = function() { } // 050 +}; // 100 +X.x(); // 150 +`, + [ + { start: 0, end: 198, count: 1 }, + { start: 0, end: 0, count: 0 }, + { start: 51, end: 76, count: 1 }, + { start: 62, end: 76, count: 1 } + ] +); + +TestCoverage( +"static class field with iife", +`class X { // 000 + static x = (function() { })() // 050 +}; // 100 +`, + [ + { start: 0, end: 148, count: 1 }, + { start: 0, end: 0, count: 0 }, + { start: 51, end: 80, count: 1 }, + { start: 63, end: 77, count: 1 } + ] +); + +TestCoverage( +"computed static class field", +` +function f() {} // 000 +class X { // 050 + static [f()] = (function() { })() // 100 +}; // 150 +`, + [ + { start: 0, end: 199, count: 1 }, + { start: 0, end: 15, count: 1 }, + { start: 50, end: 50, count: 0 }, + { start: 102, end: 135, count: 1 }, + { start: 118, end: 132, count: 1 } + ] +); diff --git a/deps/v8/test/mjsunit/compiler/abstract-equal-symbol.js b/deps/v8/test/mjsunit/compiler/abstract-equal-symbol.js new file mode 100644 index 0000000000..c1057e1d1b --- /dev/null +++ b/deps/v8/test/mjsunit/compiler/abstract-equal-symbol.js @@ -0,0 +1,135 @@ +// Copyright 2018 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 --opt --noalways-opt + +// Known symbols abstract equality. +(function() { + const a = Symbol("a"); + const b = Symbol("b"); + + function foo() { return a == b; } + + assertFalse(foo()); + assertFalse(foo()); + %OptimizeFunctionOnNextCall(foo); + assertFalse(foo()); +})(); + +// Known symbols abstract in-equality. +(function() { + const a = Symbol("a"); + const b = Symbol("b"); + + function foo() { return a != b; } + + assertTrue(foo()); + assertTrue(foo()); + %OptimizeFunctionOnNextCall(foo); + assertTrue(foo()); +})(); + +// Known symbol on one side abstract equality. +(function() { + const a = Symbol("a"); + const b = Symbol("b"); + + function foo(a) { return a == b; } + + // Warmup + assertTrue(foo(b)); + assertFalse(foo(a)); + assertTrue(foo(b)); + assertFalse(foo(a)); + %OptimizeFunctionOnNextCall(foo); + assertTrue(foo(b)); + assertFalse(foo(a)); + assertOptimized(foo); + + // Make optimized code bail out + assertFalse(foo("a")); + assertUnoptimized(foo); + + // Make sure TurboFan learns the new feedback + %OptimizeFunctionOnNextCall(foo); + assertFalse(foo("a")); + assertOptimized(foo); +})(); + +// Known symbol on one side abstract in-equality. +(function() { + const a = Symbol("a"); + const b = Symbol("b"); + + function foo(a) { return a != b; } + + // Warmup + assertFalse(foo(b)); + assertTrue(foo(a)); + assertFalse(foo(b)); + assertTrue(foo(a)); + %OptimizeFunctionOnNextCall(foo); + assertFalse(foo(b)); + assertTrue(foo(a)); + + // Make optimized code bail out + assertTrue(foo("a")); + assertUnoptimized(foo); + + // Make sure TurboFan learns the new feedback + %OptimizeFunctionOnNextCall(foo); + assertTrue(foo("a")); + assertOptimized(foo); +})(); + +// Feedback based symbol abstract equality. +(function() { + const a = Symbol("a"); + const b = Symbol("b"); + + function foo(a, b) { return a == b; } + + // Warmup + assertTrue(foo(b, b)); + assertFalse(foo(a, b)); + assertTrue(foo(a, a)); + assertFalse(foo(b, a)); + %OptimizeFunctionOnNextCall(foo); + assertTrue(foo(a, a)); + assertFalse(foo(b, a)); + + // Make optimized code bail out + assertFalse(foo("a", b)); + assertUnoptimized(foo); + + // Make sure TurboFan learns the new feedback + %OptimizeFunctionOnNextCall(foo); + assertFalse(foo("a", b)); + assertOptimized(foo); +})(); + +// Feedback based symbol abstract in-equality. +(function() { + const a = Symbol("a"); + const b = Symbol("b"); + + function foo(a, b) { return a != b; } + + assertFalse(foo(b, b)); + assertTrue(foo(a, b)); + assertFalse(foo(a, a)); + assertTrue(foo(b, a)); + %OptimizeFunctionOnNextCall(foo); + assertFalse(foo(a, a)); + assertTrue(foo(b, a)); + + // Make optimized code bail out + assertTrue(foo("a", b)); + assertUnoptimized(foo); + + // Make sure TurboFan learns the new feedback + %OptimizeFunctionOnNextCall(foo); + assertTrue(foo("a", b)); + assertOptimized(foo); +})(); diff --git a/deps/v8/test/mjsunit/compiler/array-buffer-is-view.js b/deps/v8/test/mjsunit/compiler/array-buffer-is-view.js new file mode 100644 index 0000000000..b56763b5b2 --- /dev/null +++ b/deps/v8/test/mjsunit/compiler/array-buffer-is-view.js @@ -0,0 +1,64 @@ +// Copyright 2018 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 --opt + +// Test that ObjectIsArrayBufferView lowering works correctly +// in EffectControlLinearizer in the case that the input is +// known to be a HeapObject by TurboFan. For this we use the +// simple trick with an object literal whose field `x` will +// only ever contain HeapObjects and so the representation +// tracking is going to pick it up. +(function() { + function foo(x) { + return ArrayBuffer.isView({x}.x); + } + + assertFalse(foo(Symbol())); + assertFalse(foo("some string")); + assertFalse(foo(new Object())); + assertFalse(foo(new Array())); + assertFalse(foo(new ArrayBuffer(1))); + assertTrue(foo(new Int32Array(1))); + assertTrue(foo(new DataView(new ArrayBuffer(1)))); + %OptimizeFunctionOnNextCall(foo); + assertFalse(foo(Symbol())); + assertFalse(foo("some string")); + assertFalse(foo(new Object())); + assertFalse(foo(new Array())); + assertFalse(foo(new ArrayBuffer(1))); + assertTrue(foo(new Int32Array(1))); + assertTrue(foo(new DataView(new ArrayBuffer(1)))); + assertOptimized(foo); +})(); + +// Test that ObjectIsArrayBufferView lowering works correctly +// in EffectControlLinearizer in the case that the input is +// some arbitrary tagged value. +(function() { + function foo(x) { + return ArrayBuffer.isView(x); + } + + assertFalse(foo(1)); + assertFalse(foo(1.1)); + assertFalse(foo(Symbol())); + assertFalse(foo("some string")); + assertFalse(foo(new Object())); + assertFalse(foo(new Array())); + assertFalse(foo(new ArrayBuffer(1))); + assertTrue(foo(new Int32Array(1))); + assertTrue(foo(new DataView(new ArrayBuffer(1)))); + %OptimizeFunctionOnNextCall(foo); + assertFalse(foo(1)); + assertFalse(foo(1.1)); + assertFalse(foo(Symbol())); + assertFalse(foo("some string")); + assertFalse(foo(new Object())); + assertFalse(foo(new Array())); + assertFalse(foo(new ArrayBuffer(1))); + assertTrue(foo(new Int32Array(1))); + assertTrue(foo(new DataView(new ArrayBuffer(1)))); + assertOptimized(foo); +})(); diff --git a/deps/v8/test/mjsunit/compiler/array-is-array.js b/deps/v8/test/mjsunit/compiler/array-is-array.js new file mode 100644 index 0000000000..37c916ddac --- /dev/null +++ b/deps/v8/test/mjsunit/compiler/array-is-array.js @@ -0,0 +1,105 @@ +// Copyright 2018 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 + +// Test JSObjectIsArray in JSTypedLowering for the case that the +// input value is known to be an Array literal. +(function() { + function foo() { + return Array.isArray([]); + } + + assertTrue(foo()); + assertTrue(foo()); + %OptimizeFunctionOnNextCall(foo); + assertTrue(foo()); +})(); + +// Test JSObjectIsArray in JSTypedLowering for the case that the +// input value is known to be a Proxy for an Array literal. +(function() { + function foo() { + return Array.isArray(new Proxy([], {})); + } + + assertTrue(foo()); + assertTrue(foo()); + %OptimizeFunctionOnNextCall(foo); + assertTrue(foo()); +})(); + +// Test JSObjectIsArray in JSTypedLowering for the case that the +// input value is known to be an Object literal. +(function() { + function foo() { + return Array.isArray({}); + } + + assertFalse(foo()); + assertFalse(foo()); + %OptimizeFunctionOnNextCall(foo); + assertFalse(foo()); +})(); + +// Test JSObjectIsArray in JSTypedLowering for the case that the +// input value is known to be a Proxy for an Object literal. +(function() { + function foo() { + return Array.isArray(new Proxy({}, {})); + } + + assertFalse(foo()); + assertFalse(foo()); + %OptimizeFunctionOnNextCall(foo); + assertFalse(foo()); +})(); + +// Test JSObjectIsArray in JSTypedLowering for the case that +// TurboFan doesn't know anything about the input value. +(function() { + function foo(x) { + return Array.isArray(x); + } + + assertFalse(foo({})); + assertFalse(foo(new Proxy({}, {}))); + assertTrue(foo([])); + assertTrue(foo(new Proxy([], {}))); + assertThrows(() => { + const {proxy, revoke} = Proxy.revocable([], {}); + revoke(); + foo(proxy); + }, TypeError); + %OptimizeFunctionOnNextCall(foo); + assertFalse(foo({})); + assertFalse(foo(new Proxy({}, {}))); + assertTrue(foo([])); + assertTrue(foo(new Proxy([], {}))); + assertThrows(() => { + const {proxy, revoke} = Proxy.revocable([], {}); + revoke(); + foo(proxy); + }, TypeError); +})(); + +// Test JSObjectIsArray in JSTypedLowering for the case that +// we pass a revoked proxy and catch the exception locally. +(function() { + function foo(x) { + const {proxy, revoke} = Proxy.revocable(x, {}); + revoke(); + try { + return Array.isArray(proxy); + } catch (e) { + return e; + } + } + + assertInstanceof(foo([]), TypeError); + assertInstanceof(foo({}), TypeError); + %OptimizeFunctionOnNextCall(foo); + assertInstanceof(foo([]), TypeError); + assertInstanceof(foo({}), TypeError); +})(); diff --git a/deps/v8/test/mjsunit/compiler/context-sensitivity.js b/deps/v8/test/mjsunit/compiler/context-sensitivity.js new file mode 100644 index 0000000000..1f0f1f274a --- /dev/null +++ b/deps/v8/test/mjsunit/compiler/context-sensitivity.js @@ -0,0 +1,550 @@ +// Copyright 2018 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 object1 = {[Symbol.toPrimitive]() { return 1; }}; +const thrower = {[Symbol.toPrimitive]() { throw new Error(); }}; + +// Test that JSAdd is not context-sensitive. +(function() { + function bar(fn) { + return fn(1); + } + + function foo(x) { + return bar(y => y + x); + } + + assertEquals(1, foo(0)); + assertEquals(2, foo(object1)); + assertThrows(() => foo(thrower)); + %OptimizeFunctionOnNextCall(foo); + assertEquals(1, foo(0)); + assertEquals(2, foo(object1)); + assertThrows(() => foo(thrower)); +})(); + +// Test that JSSubtract is not context-sensitive. +(function() { + function bar(fn) { + return fn(1); + } + + function foo(x) { + return bar(y => y - x); + } + + assertEquals(1, foo(0)); + assertEquals(0, foo(object1)); + assertThrows(() => foo(thrower)); + %OptimizeFunctionOnNextCall(foo); + assertEquals(1, foo(0)); + assertEquals(0, foo(object1)); + assertThrows(() => foo(thrower)); +})(); + +// Test that JSMultiply is not context-sensitive. +(function() { + function bar(fn) { + return fn(1); + } + + function foo(x) { + return bar(y => y * x); + } + + assertEquals(1, foo(1)); + assertEquals(1, foo(object1)); + assertThrows(() => foo(thrower)); + %OptimizeFunctionOnNextCall(foo); + assertEquals(1, foo(1)); + assertEquals(1, foo(object1)); + assertThrows(() => foo(thrower)); +})(); + +// Test that JSDivide is not context-sensitive. +(function() { + function bar(fn) { + return fn(1); + } + + function foo(x) { + return bar(y => y / x); + } + + assertEquals(1, foo(1)); + assertEquals(1, foo(object1)); + assertThrows(() => foo(thrower)); + %OptimizeFunctionOnNextCall(foo); + assertEquals(1, foo(1)); + assertEquals(1, foo(object1)); + assertThrows(() => foo(thrower)); +})(); + +// Test that JSModulus is not context-sensitive. +(function() { + function bar(fn) { + return fn(1); + } + + function foo(x) { + return bar(y => y % x); + } + + assertEquals(0, foo(1)); + assertEquals(0, foo(object1)); + assertThrows(() => foo(thrower)); + %OptimizeFunctionOnNextCall(foo); + assertEquals(0, foo(1)); + assertEquals(0, foo(object1)); + assertThrows(() => foo(thrower)); +})(); + +// Test that JSExponentiate is not context-sensitive. +(function() { + function bar(fn) { + return fn(1); + } + + function foo(x) { + return bar(y => y ** x); + } + + assertEquals(1, foo(1)); + assertEquals(1, foo(object1)); + assertThrows(() => foo(thrower)); + %OptimizeFunctionOnNextCall(foo); + assertEquals(1, foo(1)); + assertEquals(1, foo(object1)); + assertThrows(() => foo(thrower)); +})(); + +// Test that JSBitwiseOr is not context-sensitive. +(function() { + function bar(fn) { + return fn(1); + } + + function foo(x) { + return bar(y => y | x); + } + + assertEquals(1, foo(1)); + assertEquals(1, foo(object1)); + assertThrows(() => foo(thrower)); + %OptimizeFunctionOnNextCall(foo); + assertEquals(1, foo(1)); + assertEquals(1, foo(object1)); + assertThrows(() => foo(thrower)); +})(); + +// Test that JSBitwiseAnd is not context-sensitive. +(function() { + function bar(fn) { + return fn(1); + } + + function foo(x) { + return bar(y => y & x); + } + + assertEquals(1, foo(1)); + assertEquals(1, foo(object1)); + assertThrows(() => foo(thrower)); + %OptimizeFunctionOnNextCall(foo); + assertEquals(1, foo(1)); + assertEquals(1, foo(object1)); + assertThrows(() => foo(thrower)); +})(); + +// Test that JSBitwiseXor is not context-sensitive. +(function() { + function bar(fn) { + return fn(1); + } + + function foo(x) { + return bar(y => y ^ x); + } + + assertEquals(0, foo(1)); + assertEquals(0, foo(object1)); + assertThrows(() => foo(thrower)); + %OptimizeFunctionOnNextCall(foo); + assertEquals(0, foo(1)); + assertEquals(0, foo(object1)); + assertThrows(() => foo(thrower)); +})(); + +// Test that JSShiftLeft is not context-sensitive. +(function() { + function bar(fn) { + return fn(1); + } + + function foo(x) { + return bar(y => y << x); + } + + assertEquals(2, foo(1)); + assertEquals(2, foo(object1)); + assertThrows(() => foo(thrower)); + %OptimizeFunctionOnNextCall(foo); + assertEquals(2, foo(1)); + assertEquals(2, foo(object1)); + assertThrows(() => foo(thrower)); +})(); + +// Test that JSShiftRight is not context-sensitive. +(function() { + function bar(fn) { + return fn(1); + } + + function foo(x) { + return bar(y => y >> x); + } + + assertEquals(0, foo(1)); + assertEquals(0, foo(object1)); + assertThrows(() => foo(thrower)); + %OptimizeFunctionOnNextCall(foo); + assertEquals(0, foo(1)); + assertEquals(0, foo(object1)); + assertThrows(() => foo(thrower)); +})(); + +// Test that JSShiftRightLogical is not context-sensitive. +(function() { + function bar(fn) { + return fn(1); + } + + function foo(x) { + return bar(y => y >>> x); + } + + assertEquals(0, foo(1)); + assertEquals(0, foo(object1)); + assertThrows(() => foo(thrower)); + %OptimizeFunctionOnNextCall(foo); + assertEquals(0, foo(1)); + assertEquals(0, foo(object1)); + assertThrows(() => foo(thrower)); +})(); + +// Test that JSEqual is not context-sensitive. +(function() { + function bar(fn) { + return fn(1); + } + + function foo(x) { + return bar(y => y == x); + } + + assertFalse(foo(0)); + assertTrue(foo(object1)); + assertThrows(() => foo(thrower)); + %OptimizeFunctionOnNextCall(foo); + assertFalse(foo(0)); + assertTrue(foo(object1)); + assertThrows(() => foo(thrower)); +})(); + +// Test that JSLessThan is not context-sensitive. +(function() { + function bar(fn) { + return fn(1); + } + + function foo(x) { + return bar(y => y < x); + } + + assertFalse(foo(0)); + assertFalse(foo(object1)); + assertThrows(() => foo(thrower)); + %OptimizeFunctionOnNextCall(foo); + assertFalse(foo(0)); + assertFalse(foo(object1)); + assertThrows(() => foo(thrower)); +})(); + +// Test that JSGreaterThan is not context-sensitive. +(function() { + function bar(fn) { + return fn(1); + } + + function foo(x) { + return bar(y => x > y); + } + + assertFalse(foo(0)); + assertFalse(foo(object1)); + assertThrows(() => foo(thrower)); + %OptimizeFunctionOnNextCall(foo); + assertFalse(foo(0)); + assertFalse(foo(object1)); + assertThrows(() => foo(thrower)); +})(); + +// Test that JSLessThanOrEqual is not context-sensitive. +(function() { + function bar(fn) { + return fn(1); + } + + function foo(x) { + return bar(y => y <= x); + } + + assertFalse(foo(0)); + assertTrue(foo(object1)); + assertThrows(() => foo(thrower)); + %OptimizeFunctionOnNextCall(foo); + assertFalse(foo(0)); + assertTrue(foo(object1)); + assertThrows(() => foo(thrower)); +})(); + +// Test that JSGreaterThanOrEqual is not context-sensitive. +(function() { + function bar(fn) { + return fn(1); + } + + function foo(x) { + return bar(y => x >= y); + } + + assertFalse(foo(0)); + assertTrue(foo(object1)); + assertThrows(() => foo(thrower)); + %OptimizeFunctionOnNextCall(foo); + assertFalse(foo(0)); + assertTrue(foo(object1)); + assertThrows(() => foo(thrower)); +})(); + +// Test that JSInstanceOf is not context-sensitive. +(function() { + function bar(fn) { + return fn({}); + } + + function foo(c) { + return bar(o => o instanceof c); + } + + assertTrue(foo(Object)); + assertFalse(foo(Array)); + assertThrows(() => foo({[Symbol.hasInstance]() { throw new Error(); }})); + %OptimizeFunctionOnNextCall(foo); + assertTrue(foo(Object)); + assertFalse(foo(Array)); + assertThrows(() => foo({[Symbol.hasInstance]() { throw new Error(); }})); +})(); + +// Test that JSBitwiseNot is not context-sensitive. +(function() { + function bar(fn) { + return fn(); + } + + function foo(x) { + return bar(() => ~x); + } + + assertEquals(0, foo(-1)); + assertEquals(~1, foo(object1)); + assertThrows(() => foo(thrower)); + %OptimizeFunctionOnNextCall(foo); + assertEquals(0, foo(-1)); + assertEquals(~1, foo(object1)); + assertThrows(() => foo(thrower)); +})(); + +// Test that JSNegate is not context-sensitive. +(function() { + function bar(fn) { + return fn(); + } + + function foo(x) { + return bar(() => -x); + } + + assertEquals(1, foo(-1)); + assertEquals(-1, foo(object1)); + assertThrows(() => foo(thrower)); + %OptimizeFunctionOnNextCall(foo); + assertEquals(1, foo(-1)); + assertEquals(-1, foo(object1)); + assertThrows(() => foo(thrower)); +})(); + +// Test that JSIncrement is not context-sensitive. +(function() { + function bar(fn) { + return fn(); + } + + function foo(x) { + return bar(() => ++x); + } + + assertEquals(1, foo(0)); + assertEquals(2, foo(object1)); + assertThrows(() => foo(thrower)); + %OptimizeFunctionOnNextCall(foo); + assertEquals(1, foo(0)); + assertEquals(2, foo(object1)); + assertThrows(() => foo(thrower)); +})(); + +// Test that JSDecrement is not context-sensitive. +(function() { + function bar(fn) { + return fn(); + } + + function foo(x) { + return bar(() => --x); + } + + assertEquals(1, foo(2)); + assertEquals(0, foo(object1)); + assertThrows(() => foo(thrower)); + %OptimizeFunctionOnNextCall(foo); + assertEquals(1, foo(2)); + assertEquals(0, foo(object1)); + assertThrows(() => foo(thrower)); +})(); + +// Test that JSCreateArguments[UnmappedArguments] is not context-sensitive. +(function() { + function bar(fn) { + return fn(); + } + + function foo() { + "use strict"; + return bar(() => arguments)[0]; + } + + assertEquals(0, foo(0, 1)); + assertEquals(1, foo(1, 2)); + assertEquals(undefined, foo()); + %OptimizeFunctionOnNextCall(foo); + assertEquals(0, foo(0, 1)); + assertEquals(1, foo(1, 2)); + assertEquals(undefined, foo()); +})(); + +// Test that JSCreateArguments[RestParameters] is not context-sensitive. +(function() { + function bar(fn) { + return fn(); + } + + function foo(...args) { + return bar(() => args)[0]; + } + + assertEquals(0, foo(0, 1)); + assertEquals(1, foo(1, 2)); + assertEquals(undefined, foo()); + %OptimizeFunctionOnNextCall(foo); + assertEquals(0, foo(0, 1)); + assertEquals(1, foo(1, 2)); + assertEquals(undefined, foo()); +})(); + +// Test that JSLoadGlobal/JSStoreGlobal are not context-sensitive. +(function(global) { + var actualValue = 'Some value'; + + Object.defineProperty(global, 'globalValue', { + configurable: true, + enumerable: true, + get: function() { + return actualValue; + }, + set: function(v) { + actualValue = v; + } + }); + + function bar(fn) { + return fn(); + } + + function foo(v) { + return bar(() => { + const o = globalValue; + globalValue = v; + return o; + }); + } + + assertEquals('Some value', foo('Another value')); + assertEquals('Another value', actualValue); + assertEquals('Another value', foo('Some value')); + assertEquals('Some value', actualValue); + %OptimizeFunctionOnNextCall(foo); + assertEquals('Some value', foo('Another value')); + assertEquals('Another value', actualValue); + assertEquals('Another value', foo('Some value')); + assertEquals('Some value', actualValue); +})(this); + +// Test that for..in is not context-sensitive. +(function() { + function bar(fn) { + return fn(); + } + + function foo(o) { + return bar(() => { + var s = ""; + for (var k in o) { s += k; } + return s; + }); + } + + assertEquals('abc', foo({a: 1, b: 2, c: 3})); + assertEquals('ab', foo(Object.create({a: 1, b: 2}))); + %OptimizeFunctionOnNextCall(foo); + assertEquals('abc', foo({a: 1, b: 2, c: 3})); + assertEquals("ab", foo(Object.create({a:1, b:2}))); +})(); + +// Test that most generator operations are not context-sensitive. +(function() { + function bar(fn) { + let s = undefined; + for (const x of fn()) { + if (s === undefined) s = x; + else s += x; + } + return s; + } + + function foo(x, y, z) { + return bar(function*() { + yield x; + yield y; + yield z; + }); + } + + assertEquals(6, foo(1, 2, 3)); + assertEquals("abc", foo("a", "b", "c")); + %OptimizeFunctionOnNextCall(foo); + assertEquals(6, foo(1, 2, 3)); + assertEquals("abc", foo("a", "b", "c")); +})(); diff --git a/deps/v8/test/mjsunit/compiler/dataview-constant.js b/deps/v8/test/mjsunit/compiler/dataview-constant.js new file mode 100644 index 0000000000..f5f0b5e955 --- /dev/null +++ b/deps/v8/test/mjsunit/compiler/dataview-constant.js @@ -0,0 +1,173 @@ +// Copyright 2018 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 + +// Test DataView.prototype.getInt8()/setInt8() for constant DataViews. +(function() { + const dv = new DataView(new ArrayBuffer(1024)); + dv.setInt8(0, 42); + dv.setInt8(1, 24); + + function foo(i) { + const x = dv.getInt8(i); + dv.setInt8(i, x+1); + return x; + } + + assertEquals(42, foo(0)); + assertEquals(24, foo(1)); + assertEquals(43, foo(0)); + assertEquals(25, foo(1)); + %OptimizeFunctionOnNextCall(foo); + assertEquals(44, foo(0)); + assertEquals(26, foo(1)); +})(); + +// Test DataView.prototype.getUint8()/setUint8() for constant DataViews. +(function() { + const dv = new DataView(new ArrayBuffer(1024)); + dv.setUint8(0, 42); + dv.setUint8(1, 24); + + function foo(i) { + const x = dv.getUint8(i); + dv.setUint8(i, x+1); + return x; + } + + assertEquals(42, foo(0)); + assertEquals(24, foo(1)); + assertEquals(43, foo(0)); + assertEquals(25, foo(1)); + %OptimizeFunctionOnNextCall(foo); + assertEquals(44, foo(0)); + assertEquals(26, foo(1)); +})(); + +// Test DataView.prototype.getInt16()/setInt16() for constant DataViews. +(function() { + const dv = new DataView(new ArrayBuffer(1024)); + dv.setInt16(0, 42, true); + dv.setInt16(2, 24, true); + + function foo(i) { + const x = dv.getInt16(i, true); + dv.setInt16(i, x+1, true); + return x; + } + + assertEquals(42, foo(0)); + assertEquals(24, foo(2)); + assertEquals(43, foo(0)); + assertEquals(25, foo(2)); + %OptimizeFunctionOnNextCall(foo); + assertEquals(44, foo(0)); + assertEquals(26, foo(2)); +})(); + +// Test DataView.prototype.getUint16()/setUint16() for constant DataViews. +(function() { + const dv = new DataView(new ArrayBuffer(1024)); + dv.setUint16(0, 42, true); + dv.setUint16(2, 24, true); + + function foo(i) { + const x = dv.getUint16(i, true); + dv.setUint16(i, x+1, true); + return x; + } + + assertEquals(42, foo(0)); + assertEquals(24, foo(2)); + assertEquals(43, foo(0)); + assertEquals(25, foo(2)); + %OptimizeFunctionOnNextCall(foo); + assertEquals(44, foo(0)); + assertEquals(26, foo(2)); +})(); + +// Test DataView.prototype.getInt32()/setInt32() for constant DataViews. +(function() { + const dv = new DataView(new ArrayBuffer(1024)); + dv.setInt32(0, 42, true); + dv.setInt32(4, 24, true); + + function foo(i) { + const x = dv.getInt32(i, true); + dv.setInt32(i, x+1, true); + return x; + } + + assertEquals(42, foo(0)); + assertEquals(24, foo(4)); + assertEquals(43, foo(0)); + assertEquals(25, foo(4)); + %OptimizeFunctionOnNextCall(foo); + assertEquals(44, foo(0)); + assertEquals(26, foo(4)); +})(); + +// Test DataView.prototype.getUint32()/setUint32() for constant DataViews. +(function() { + const dv = new DataView(new ArrayBuffer(1024)); + dv.setUint32(0, 42, true); + dv.setUint32(4, 24, true); + + function foo(i) { + const x = dv.getUint32(i, true); + dv.setUint32(i, x+1, true); + return x; + } + + assertEquals(42, foo(0)); + assertEquals(24, foo(4)); + assertEquals(43, foo(0)); + assertEquals(25, foo(4)); + %OptimizeFunctionOnNextCall(foo); + assertEquals(44, foo(0)); + assertEquals(26, foo(4)); +})(); + +// Test DataView.prototype.getFloat32()/setFloat32() for constant DataViews. +(function() { + const dv = new DataView(new ArrayBuffer(1024)); + dv.setFloat32(0, 42, true); + dv.setFloat32(4, 24, true); + + function foo(i) { + const x = dv.getFloat32(i, true); + dv.setFloat32(i, x+1, true); + return x; + } + + assertEquals(42, foo(0)); + assertEquals(24, foo(4)); + assertEquals(43, foo(0)); + assertEquals(25, foo(4)); + %OptimizeFunctionOnNextCall(foo); + assertEquals(44, foo(0)); + assertEquals(26, foo(4)); +})(); + +// Test DataView.prototype.getFloat64()/setFloat64() for constant DataViews. +(function() { + const dv = new DataView(new ArrayBuffer(1024)); + dv.setFloat64(0, 42, true); + dv.setFloat64(8, 24, true); + + function foo(i) { + const x = dv.getFloat64(i, true); + dv.setFloat64(i, x+1, true); + return x; + } + + assertEquals(42, foo(0)); + assertEquals(24, foo(8)); + assertEquals(43, foo(0)); + assertEquals(25, foo(8)); + %OptimizeFunctionOnNextCall(foo); + assertEquals(44, foo(0)); + assertEquals(26, foo(8)); +})(); diff --git a/deps/v8/test/mjsunit/compiler/dataview-neutered.js b/deps/v8/test/mjsunit/compiler/dataview-neutered.js new file mode 100644 index 0000000000..54b35f73c8 --- /dev/null +++ b/deps/v8/test/mjsunit/compiler/dataview-neutered.js @@ -0,0 +1,376 @@ +// Copyright 2018 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 --opt --noalways-opt + +// Invalidate the neutering protector. +%ArrayBufferNeuter(new ArrayBuffer(1)); + +// Check DataView.prototype.getInt8() optimization. +(function() { + const ab = new ArrayBuffer(1); + const dv = new DataView(ab); + + function foo(dv) { + return dv.getInt8(0); + } + + assertEquals(0, foo(dv)); + assertEquals(0, foo(dv)); + %OptimizeFunctionOnNextCall(foo); + assertEquals(0, foo(dv)); + assertOptimized(foo); + %ArrayBufferNeuter(ab); + assertThrows(() => foo(dv), TypeError); + assertUnoptimized(foo); + %OptimizeFunctionOnNextCall(foo); + assertThrows(() => foo(dv), TypeError); + assertOptimized(foo); +})(); + +// Check DataView.prototype.getUint8() optimization. +(function() { + const ab = new ArrayBuffer(1); + const dv = new DataView(ab); + + function foo(dv) { + return dv.getUint8(0); + } + + assertEquals(0, foo(dv)); + assertEquals(0, foo(dv)); + %OptimizeFunctionOnNextCall(foo); + assertEquals(0, foo(dv)); + assertOptimized(foo); + %ArrayBufferNeuter(ab); + assertThrows(() => foo(dv), TypeError); + assertUnoptimized(foo); + %OptimizeFunctionOnNextCall(foo); + assertThrows(() => foo(dv), TypeError); + assertOptimized(foo); +})(); + +// Check DataView.prototype.getInt16() optimization. +(function() { + const ab = new ArrayBuffer(2); + const dv = new DataView(ab); + + function foo(dv) { + return dv.getInt16(0, true); + } + + assertEquals(0, foo(dv)); + assertEquals(0, foo(dv)); + %OptimizeFunctionOnNextCall(foo); + assertEquals(0, foo(dv)); + assertOptimized(foo); + %ArrayBufferNeuter(ab); + assertThrows(() => foo(dv), TypeError); + assertUnoptimized(foo); + %OptimizeFunctionOnNextCall(foo); + assertThrows(() => foo(dv), TypeError); + assertOptimized(foo); +})(); + +// Check DataView.prototype.getUint16() optimization. +(function() { + const ab = new ArrayBuffer(2); + const dv = new DataView(ab); + + function foo(dv) { + return dv.getUint16(0, true); + } + + assertEquals(0, foo(dv)); + assertEquals(0, foo(dv)); + %OptimizeFunctionOnNextCall(foo); + assertEquals(0, foo(dv)); + assertOptimized(foo); + %ArrayBufferNeuter(ab); + assertThrows(() => foo(dv), TypeError); + assertUnoptimized(foo); + %OptimizeFunctionOnNextCall(foo); + assertThrows(() => foo(dv), TypeError); + assertOptimized(foo); +})(); + +// Check DataView.prototype.getInt32() optimization. +(function() { + const ab = new ArrayBuffer(4); + const dv = new DataView(ab); + + function foo(dv) { + return dv.getInt32(0, true); + } + + assertEquals(0, foo(dv)); + assertEquals(0, foo(dv)); + %OptimizeFunctionOnNextCall(foo); + assertEquals(0, foo(dv)); + assertOptimized(foo); + %ArrayBufferNeuter(ab); + assertThrows(() => foo(dv), TypeError); + assertUnoptimized(foo); + %OptimizeFunctionOnNextCall(foo); + assertThrows(() => foo(dv), TypeError); + assertOptimized(foo); +})(); + +// Check DataView.prototype.getUint32() optimization. +(function() { + const ab = new ArrayBuffer(4); + const dv = new DataView(ab); + + function foo(dv) { + return dv.getUint32(0, true); + } + + assertEquals(0, foo(dv)); + assertEquals(0, foo(dv)); + %OptimizeFunctionOnNextCall(foo); + assertEquals(0, foo(dv)); + assertOptimized(foo); + %ArrayBufferNeuter(ab); + assertThrows(() => foo(dv), TypeError); + assertUnoptimized(foo); + %OptimizeFunctionOnNextCall(foo); + assertThrows(() => foo(dv), TypeError); + assertOptimized(foo); +})(); + +// Check DataView.prototype.getFloat32() optimization. +(function() { + const ab = new ArrayBuffer(4); + const dv = new DataView(ab); + + function foo(dv) { + return dv.getFloat32(0, true); + } + + assertEquals(0, foo(dv)); + assertEquals(0, foo(dv)); + %OptimizeFunctionOnNextCall(foo); + assertEquals(0, foo(dv)); + assertOptimized(foo); + %ArrayBufferNeuter(ab); + assertThrows(() => foo(dv), TypeError); + assertUnoptimized(foo); + %OptimizeFunctionOnNextCall(foo); + assertThrows(() => foo(dv), TypeError); + assertOptimized(foo); +})(); + +// Check DataView.prototype.getFloat64() optimization. +(function() { + const ab = new ArrayBuffer(8); + const dv = new DataView(ab); + + function foo(dv) { + return dv.getFloat64(0, true); + } + + assertEquals(0, foo(dv)); + assertEquals(0, foo(dv)); + %OptimizeFunctionOnNextCall(foo); + assertEquals(0, foo(dv)); + assertOptimized(foo); + %ArrayBufferNeuter(ab); + assertThrows(() => foo(dv), TypeError); + assertUnoptimized(foo); + %OptimizeFunctionOnNextCall(foo); + assertThrows(() => foo(dv), TypeError); + assertOptimized(foo); +})(); + +// Check DataView.prototype.setInt8() optimization. +(function() { + const ab = new ArrayBuffer(1); + const dv = new DataView(ab); + + function foo(dv, x) { + return dv.setInt8(0, x); + } + + assertEquals(undefined, foo(dv, 1)); + assertEquals(1, dv.getInt8(0)); + assertEquals(undefined, foo(dv, 2)); + assertEquals(2, dv.getInt8(0)); + %OptimizeFunctionOnNextCall(foo); + assertEquals(undefined, foo(dv, 3)); + assertOptimized(foo); + %ArrayBufferNeuter(ab); + assertThrows(() => foo(dv, 4), TypeError); + assertUnoptimized(foo); + %OptimizeFunctionOnNextCall(foo); + assertThrows(() => foo(dv, 5), TypeError); + assertOptimized(foo); +})(); + +// Check DataView.prototype.setUint8() optimization. +(function() { + const ab = new ArrayBuffer(1); + const dv = new DataView(ab); + + function foo(dv, x) { + return dv.setUint8(0, x); + } + + assertEquals(undefined, foo(dv, 1)); + assertEquals(1, dv.getUint8(0)); + assertEquals(undefined, foo(dv, 2)); + assertEquals(2, dv.getUint8(0)); + %OptimizeFunctionOnNextCall(foo); + assertEquals(undefined, foo(dv, 3)); + assertOptimized(foo); + %ArrayBufferNeuter(ab); + assertThrows(() => foo(dv, 4), TypeError); + assertUnoptimized(foo); + %OptimizeFunctionOnNextCall(foo); + assertThrows(() => foo(dv, 5), TypeError); + assertOptimized(foo); +})(); + +// Check DataView.prototype.setInt16() optimization. +(function() { + const ab = new ArrayBuffer(2); + const dv = new DataView(ab); + + function foo(dv, x) { + return dv.setInt16(0, x, true); + } + + assertEquals(undefined, foo(dv, 1)); + assertEquals(1, dv.getInt16(0, true)); + assertEquals(undefined, foo(dv, 2)); + assertEquals(2, dv.getInt16(0, true)); + %OptimizeFunctionOnNextCall(foo); + assertEquals(undefined, foo(dv, 3)); + assertOptimized(foo); + %ArrayBufferNeuter(ab); + assertThrows(() => foo(dv, 4), TypeError); + assertUnoptimized(foo); + %OptimizeFunctionOnNextCall(foo); + assertThrows(() => foo(dv, 5), TypeError); + assertOptimized(foo); +})(); + +// Check DataView.prototype.setUint16() optimization. +(function() { + const ab = new ArrayBuffer(2); + const dv = new DataView(ab); + + function foo(dv, x) { + return dv.setUint16(0, x, true); + } + + assertEquals(undefined, foo(dv, 1)); + assertEquals(1, dv.getUint16(0, true)); + assertEquals(undefined, foo(dv, 2)); + assertEquals(2, dv.getUint16(0, true)); + %OptimizeFunctionOnNextCall(foo); + assertEquals(undefined, foo(dv, 3)); + assertOptimized(foo); + %ArrayBufferNeuter(ab); + assertThrows(() => foo(dv, 4), TypeError); + assertUnoptimized(foo); + %OptimizeFunctionOnNextCall(foo); + assertThrows(() => foo(dv, 5), TypeError); + assertOptimized(foo); +})(); + +// Check DataView.prototype.setInt32() optimization. +(function() { + const ab = new ArrayBuffer(4); + const dv = new DataView(ab); + + function foo(dv, x) { + return dv.setInt32(0, x, true); + } + + assertEquals(undefined, foo(dv, 1)); + assertEquals(1, dv.getInt32(0, true)); + assertEquals(undefined, foo(dv, 2)); + assertEquals(2, dv.getInt32(0, true)); + %OptimizeFunctionOnNextCall(foo); + assertEquals(undefined, foo(dv, 3)); + assertOptimized(foo); + %ArrayBufferNeuter(ab); + assertThrows(() => foo(dv, 4), TypeError); + assertUnoptimized(foo); + %OptimizeFunctionOnNextCall(foo); + assertThrows(() => foo(dv, 5), TypeError); + assertOptimized(foo); +})(); + +// Check DataView.prototype.setUint32() optimization. +(function() { + const ab = new ArrayBuffer(4); + const dv = new DataView(ab); + + function foo(dv, x) { + return dv.setUint32(0, x, true); + } + + assertEquals(undefined, foo(dv, 1)); + assertEquals(1, dv.getUint32(0, true)); + assertEquals(undefined, foo(dv, 2)); + assertEquals(2, dv.getUint32(0, true)); + %OptimizeFunctionOnNextCall(foo); + assertEquals(undefined, foo(dv, 3)); + assertOptimized(foo); + %ArrayBufferNeuter(ab); + assertThrows(() => foo(dv, 4), TypeError); + assertUnoptimized(foo); + %OptimizeFunctionOnNextCall(foo); + assertThrows(() => foo(dv, 5), TypeError); + assertOptimized(foo); +})(); + +// Check DataView.prototype.setFloat32() optimization. +(function() { + const ab = new ArrayBuffer(4); + const dv = new DataView(ab); + + function foo(dv, x) { + return dv.setFloat32(0, x, true); + } + + assertEquals(undefined, foo(dv, 1)); + assertEquals(1, dv.getFloat32(0, true)); + assertEquals(undefined, foo(dv, 2)); + assertEquals(2, dv.getFloat32(0, true)); + %OptimizeFunctionOnNextCall(foo); + assertEquals(undefined, foo(dv, 3)); + assertOptimized(foo); + %ArrayBufferNeuter(ab); + assertThrows(() => foo(dv, 4), TypeError); + assertUnoptimized(foo); + %OptimizeFunctionOnNextCall(foo); + assertThrows(() => foo(dv, 5), TypeError); + assertOptimized(foo); +})(); + +// Check DataView.prototype.setFloat64() optimization. +(function() { + const ab = new ArrayBuffer(8); + const dv = new DataView(ab); + + function foo(dv, x) { + return dv.setFloat64(0, x, true); + } + + assertEquals(undefined, foo(dv, 1)); + assertEquals(1, dv.getFloat64(0, true)); + assertEquals(undefined, foo(dv, 2)); + assertEquals(2, dv.getFloat64(0, true)); + %OptimizeFunctionOnNextCall(foo); + assertEquals(undefined, foo(dv, 3)); + assertOptimized(foo); + %ArrayBufferNeuter(ab); + assertThrows(() => foo(dv, 4), TypeError); + assertUnoptimized(foo); + %OptimizeFunctionOnNextCall(foo); + assertThrows(() => foo(dv, 5), TypeError); + assertOptimized(foo); +})(); diff --git a/deps/v8/test/mjsunit/compiler/dataview-nonconstant.js b/deps/v8/test/mjsunit/compiler/dataview-nonconstant.js new file mode 100644 index 0000000000..0420660c83 --- /dev/null +++ b/deps/v8/test/mjsunit/compiler/dataview-nonconstant.js @@ -0,0 +1,173 @@ +// Copyright 2018 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 + +// Test DataView.prototype.getInt8()/setInt8() for non-constant DataViews. +(function() { + const dv = new DataView(new ArrayBuffer(1024)); + dv.setInt8(0, 42); + dv.setInt8(1, 24); + + function foo(dv, i) { + const x = dv.getInt8(i); + dv.setInt8(i, x+1); + return x; + } + + assertEquals(42, foo(dv, 0)); + assertEquals(24, foo(dv, 1)); + assertEquals(43, foo(dv, 0)); + assertEquals(25, foo(dv, 1)); + %OptimizeFunctionOnNextCall(foo); + assertEquals(44, foo(dv, 0)); + assertEquals(26, foo(dv, 1)); +})(); + +// Test DataView.prototype.getUint8()/setUint8() for non-constant DataViews. +(function() { + const dv = new DataView(new ArrayBuffer(1024)); + dv.setUint8(0, 42); + dv.setUint8(1, 24); + + function foo(dv, i) { + const x = dv.getUint8(i); + dv.setUint8(i, x+1); + return x; + } + + assertEquals(42, foo(dv, 0)); + assertEquals(24, foo(dv, 1)); + assertEquals(43, foo(dv, 0)); + assertEquals(25, foo(dv, 1)); + %OptimizeFunctionOnNextCall(foo); + assertEquals(44, foo(dv, 0)); + assertEquals(26, foo(dv, 1)); +})(); + +// Test DataView.prototype.getInt16()/setInt16() for non-constant DataViews. +(function() { + const dv = new DataView(new ArrayBuffer(1024)); + dv.setInt16(0, 42, true); + dv.setInt16(2, 24, true); + + function foo(dv, i) { + const x = dv.getInt16(i, true); + dv.setInt16(i, x+1, true); + return x; + } + + assertEquals(42, foo(dv, 0)); + assertEquals(24, foo(dv, 2)); + assertEquals(43, foo(dv, 0)); + assertEquals(25, foo(dv, 2)); + %OptimizeFunctionOnNextCall(foo); + assertEquals(44, foo(dv, 0)); + assertEquals(26, foo(dv, 2)); +})(); + +// Test DataView.prototype.getUint16()/setUint16() for non-constant DataViews. +(function() { + const dv = new DataView(new ArrayBuffer(1024)); + dv.setUint16(0, 42, true); + dv.setUint16(2, 24, true); + + function foo(dv, i) { + const x = dv.getUint16(i, true); + dv.setUint16(i, x+1, true); + return x; + } + + assertEquals(42, foo(dv, 0)); + assertEquals(24, foo(dv, 2)); + assertEquals(43, foo(dv, 0)); + assertEquals(25, foo(dv, 2)); + %OptimizeFunctionOnNextCall(foo); + assertEquals(44, foo(dv, 0)); + assertEquals(26, foo(dv, 2)); +})(); + +// Test DataView.prototype.getInt32()/setInt32() for non-constant DataViews. +(function() { + const dv = new DataView(new ArrayBuffer(1024)); + dv.setInt32(0, 42, true); + dv.setInt32(4, 24, true); + + function foo(dv, i) { + const x = dv.getInt32(i, true); + dv.setInt32(i, x+1, true); + return x; + } + + assertEquals(42, foo(dv, 0)); + assertEquals(24, foo(dv, 4)); + assertEquals(43, foo(dv, 0)); + assertEquals(25, foo(dv, 4)); + %OptimizeFunctionOnNextCall(foo); + assertEquals(44, foo(dv, 0)); + assertEquals(26, foo(dv, 4)); +})(); + +// Test DataView.prototype.getUint32()/setUint32() for non-constant DataViews. +(function() { + const dv = new DataView(new ArrayBuffer(1024)); + dv.setUint32(0, 42, true); + dv.setUint32(4, 24, true); + + function foo(dv, i) { + const x = dv.getUint32(i, true); + dv.setUint32(i, x+1, true); + return x; + } + + assertEquals(42, foo(dv, 0)); + assertEquals(24, foo(dv, 4)); + assertEquals(43, foo(dv, 0)); + assertEquals(25, foo(dv, 4)); + %OptimizeFunctionOnNextCall(foo); + assertEquals(44, foo(dv, 0)); + assertEquals(26, foo(dv, 4)); +})(); + +// Test DataView.prototype.getFloat32()/setFloat32() for non-constant DataViews. +(function() { + const dv = new DataView(new ArrayBuffer(1024)); + dv.setFloat32(0, 42, true); + dv.setFloat32(4, 24, true); + + function foo(dv, i) { + const x = dv.getFloat32(i, true); + dv.setFloat32(i, x+1, true); + return x; + } + + assertEquals(42, foo(dv, 0)); + assertEquals(24, foo(dv, 4)); + assertEquals(43, foo(dv, 0)); + assertEquals(25, foo(dv, 4)); + %OptimizeFunctionOnNextCall(foo); + assertEquals(44, foo(dv, 0)); + assertEquals(26, foo(dv, 4)); +})(); + +// Test DataView.prototype.getFloat64()/setFloat64() for non-constant DataViews. +(function() { + const dv = new DataView(new ArrayBuffer(1024)); + dv.setFloat64(0, 42, true); + dv.setFloat64(8, 24, true); + + function foo(dv, i) { + const x = dv.getFloat64(i, true); + dv.setFloat64(i, x+1, true); + return x; + } + + assertEquals(42, foo(dv, 0)); + assertEquals(24, foo(dv, 8)); + assertEquals(43, foo(dv, 0)); + assertEquals(25, foo(dv, 8)); + %OptimizeFunctionOnNextCall(foo); + assertEquals(44, foo(dv, 0)); + assertEquals(26, foo(dv, 8)); +})(); diff --git a/deps/v8/test/mjsunit/compiler/escape-analysis-arguments.js b/deps/v8/test/mjsunit/compiler/escape-analysis-arguments.js index f520167e19..65e736c706 100644 --- a/deps/v8/test/mjsunit/compiler/escape-analysis-arguments.js +++ b/deps/v8/test/mjsunit/compiler/escape-analysis-arguments.js @@ -185,3 +185,56 @@ %OptimizeFunctionOnNextCall(f); f(); f(); })(); + +// Test variable index access to strict arguments +// with up to 2 elements. +(function testArgumentsVariableIndexStrict() { + function g() { + "use strict"; + var s = 0; + for (var i = 0; i < arguments.length; ++i) s += arguments[i]; + return s; + } + + function f(x, y) { + // (a) arguments[i] is dead code since arguments.length is 0. + const a = g(); + // (b) arguments[i] always yields the first element. + const b = g(x); + // (c) arguments[i] can yield either x or y. + const c = g(x, y); + return a + b + c; + } + + assertEquals(4, f(1, 2)); + assertEquals(5, f(2, 1)); + %OptimizeFunctionOnNextCall(f); + assertEquals(4, f(1, 2)); + assertEquals(5, f(2, 1)); +})(); + +// Test variable index access to sloppy arguments +// with up to 2 elements. +(function testArgumentsVariableIndexSloppy() { + function g() { + var s = 0; + for (var i = 0; i < arguments.length; ++i) s += arguments[i]; + return s; + } + + function f(x, y) { + // (a) arguments[i] is dead code since arguments.length is 0. + const a = g(); + // (b) arguments[i] always yields the first element. + const b = g(x); + // (c) arguments[i] can yield either x or y. + const c = g(x, y); + return a + b + c; + } + + assertEquals(4, f(1, 2)); + assertEquals(5, f(2, 1)); + %OptimizeFunctionOnNextCall(f); + assertEquals(4, f(1, 2)); + assertEquals(5, f(2, 1)); +})(); diff --git a/deps/v8/test/mjsunit/compiler/escape-analysis-array.js b/deps/v8/test/mjsunit/compiler/escape-analysis-array.js new file mode 100644 index 0000000000..2c44fa8c9b --- /dev/null +++ b/deps/v8/test/mjsunit/compiler/escape-analysis-array.js @@ -0,0 +1,32 @@ +// Copyright 2018 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 + +// Test variable index access to array with 1 element. +(function testOneElementArrayVariableIndex() { + function f(i) { + const a = new Array("first"); + return a[i]; + } + + assertEquals("first", f(0)); + assertEquals("first", f(0)); + %OptimizeFunctionOnNextCall(f); + assertEquals("first", f(0)); +})(); + +// Test variable index access to array with 2 elements. +(function testTwoElementArrayVariableIndex() { + function f(i) { + const a = new Array("first", "second"); + return a[i]; + } + + assertEquals("first", f(0)); + assertEquals("second", f(1)); + %OptimizeFunctionOnNextCall(f); + assertEquals("first", f(0)); + assertEquals("second", f(1)); +})(); diff --git a/deps/v8/test/mjsunit/compiler/escape-analysis-rest-parameters.js b/deps/v8/test/mjsunit/compiler/escape-analysis-rest-parameters.js new file mode 100644 index 0000000000..2ac1253a18 --- /dev/null +++ b/deps/v8/test/mjsunit/compiler/escape-analysis-rest-parameters.js @@ -0,0 +1,31 @@ +// Copyright 2018 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 + +// Test variable index access to rest parameters +// with up to 2 elements. +(function testRestParametersVariableIndex() { + function g(...args) { + let s = 0; + for (let i = 0; i < args.length; ++i) s += args[i]; + return s; + } + + function f(x, y) { + // (a) args[i] is dead code since args.length is 0. + const a = g(); + // (b) args[i] always yields the first element. + const b = g(x); + // (c) args[i] can yield either x or y. + const c = g(x, y); + return a + b + c; + } + + assertEquals(4, f(1, 2)); + assertEquals(5, f(2, 1)); + %OptimizeFunctionOnNextCall(f); + assertEquals(4, f(1, 2)); + assertEquals(5, f(2, 1)); +})(); diff --git a/deps/v8/test/mjsunit/compiler/instanceof2.js b/deps/v8/test/mjsunit/compiler/instanceof2.js new file mode 100644 index 0000000000..ca006e3046 --- /dev/null +++ b/deps/v8/test/mjsunit/compiler/instanceof2.js @@ -0,0 +1,233 @@ +// Copyright 2018 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 + + +// Without instance creation: + +(function() { + function Goo() {}; + const goo = {}; + + function IsGoo(x) { + return x instanceof Goo; + } + + assertFalse(IsGoo(goo)); + assertFalse(IsGoo(goo)); + %OptimizeFunctionOnNextCall(IsGoo); + assertFalse(IsGoo(goo)); +})(); + +(function() { + function Goo() {}; + const goo = {}; + Goo.prototype = Object.prototype; + + function IsGoo(x) { + return x instanceof Goo; + } + + assertTrue(IsGoo(goo)); + assertTrue(IsGoo(goo)); + %OptimizeFunctionOnNextCall(IsGoo); + assertTrue(IsGoo(goo)); +})(); + +(function() { + function Goo() {}; + const goo = {}; + Goo.prototype = 42 + + function IsGoo(x) { + return x instanceof Goo; + } + + assertThrows(_ => IsGoo(goo), TypeError); + assertThrows(_ => IsGoo(goo), TypeError); + %OptimizeFunctionOnNextCall(IsGoo); + assertThrows(_ => IsGoo(goo), TypeError); +})(); + +(function() { + function Goo() {}; + const goo = {}; + + function IsGoo(x) { + return x instanceof Goo; + } + + assertFalse(IsGoo(goo)); + assertFalse(IsGoo(goo)); + %OptimizeFunctionOnNextCall(IsGoo); + assertFalse(IsGoo(goo)); + Goo.prototype = Object.prototype; + assertTrue(IsGoo(goo)); +})(); + +(function() { + function Goo() {}; + const goo = {}; + + function IsGoo(x) { + return x instanceof Goo; + } + + assertFalse(IsGoo(goo)); + assertFalse(IsGoo(goo)); + %OptimizeFunctionOnNextCall(IsGoo); + assertFalse(IsGoo(goo)); + Goo.prototype = 42; + assertThrows(_ => IsGoo(goo), TypeError); +})(); + + +// With instance creation: + +(function() { + function Goo() {}; + const goo = new Goo(); + + function IsGoo(x) { + return x instanceof Goo; + } + + assertTrue(IsGoo(goo)); + assertTrue(IsGoo(goo)); + %OptimizeFunctionOnNextCall(IsGoo); + assertTrue(IsGoo(goo)); +})(); + +(function() { + function Goo() {}; + const goo = new Goo(); + Goo.prototype = {}; + + function IsGoo(x) { + return x instanceof Goo; + } + + assertFalse(IsGoo(goo)); + assertFalse(IsGoo(goo)); + %OptimizeFunctionOnNextCall(IsGoo); + assertFalse(IsGoo(goo)); +})(); + +(function() { + function Goo() {}; + const goo = new Goo(); + Goo.prototype = 42; + + function IsGoo(x) { + return x instanceof Goo; + } + + assertThrows(_ => IsGoo(goo), TypeError); + assertThrows(_ => IsGoo(goo), TypeError); + %OptimizeFunctionOnNextCall(IsGoo); + assertThrows(_ => IsGoo(goo), TypeError); +})(); + +(function() { + function Goo() {}; + const goo = new Goo(); + + function IsGoo(x) { + return x instanceof Goo; + } + + assertTrue(IsGoo(goo)); + assertTrue(IsGoo(goo)); + %OptimizeFunctionOnNextCall(IsGoo); + assertTrue(IsGoo(goo)); + Goo.prototype = {}; + assertFalse(IsGoo(goo)); +})(); + +(function() { + function Goo() {}; + const goo = new Goo(); + + function IsGoo(x) { + return x instanceof Goo; + } + + assertTrue(IsGoo(goo)); + assertTrue(IsGoo(goo)); + %OptimizeFunctionOnNextCall(IsGoo); + assertTrue(IsGoo(goo)); + Goo.prototype = 42 + assertThrows(_ => IsGoo(goo), TypeError); +})(); + +(function() { + function Goo() {}; + Goo.prototype = 42; + const goo = new Goo(); + + function IsGoo(x) { + return x instanceof Goo; + } + + assertThrows(_ => IsGoo(goo), TypeError); + assertThrows(_ => IsGoo(goo), TypeError); + %OptimizeFunctionOnNextCall(IsGoo); + assertThrows(_ => IsGoo(goo), TypeError); + Goo.prototype = {}; + assertFalse(IsGoo(goo)); +})(); + +(function() { + function Goo() {}; + Goo.prototype = 42; + const goo = new Goo(); + Goo.prototype = {}; + + function IsGoo(x) { + return x instanceof Goo; + } + + assertFalse(IsGoo(goo)); + assertFalse(IsGoo(goo)); + %OptimizeFunctionOnNextCall(IsGoo); + assertFalse(IsGoo(goo)); + Goo.prototype = Object.prototype; + assertTrue(IsGoo(goo)); +})(); + +(function() { + function Goo() {}; + Goo.prototype = {}; + const goo = new Goo(); + Goo.prototype = 42; + + function IsGoo(x) { + return x instanceof Goo; + } + + assertThrows(_ => IsGoo(goo), TypeError); + assertThrows(_ => IsGoo(goo), TypeError); + %OptimizeFunctionOnNextCall(IsGoo); + assertThrows(_ => IsGoo(goo), TypeError); + Goo.prototype = Object.prototype; + assertTrue(IsGoo(goo)); +})(); + +(function() { + function Goo() {}; + Goo.prototype = {}; + const goo = new Goo(); + Goo.prototype = {}; + + function IsGoo(x) { + return x instanceof Goo; + } + + assertFalse(IsGoo(goo)); + assertFalse(IsGoo(goo)); + %OptimizeFunctionOnNextCall(IsGoo); + Goo.prototype = Object.prototype; + assertTrue(IsGoo(goo)); +})(); diff --git a/deps/v8/test/mjsunit/compiler/instanceof3.js b/deps/v8/test/mjsunit/compiler/instanceof3.js new file mode 100644 index 0000000000..e390c42092 --- /dev/null +++ b/deps/v8/test/mjsunit/compiler/instanceof3.js @@ -0,0 +1,233 @@ +// Copyright 2018 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 + + +// Without instance creation: + +(function() { + function* Goo() {}; + const goo = {}; + + function IsGoo(x) { + return x instanceof Goo; + } + + assertFalse(IsGoo(goo)); + assertFalse(IsGoo(goo)); + %OptimizeFunctionOnNextCall(IsGoo); + assertFalse(IsGoo(goo)); +})(); + +(function() { + function* Goo() {}; + const goo = {}; + Goo.prototype = Object.prototype; + + function IsGoo(x) { + return x instanceof Goo; + } + + assertTrue(IsGoo(goo)); + assertTrue(IsGoo(goo)); + %OptimizeFunctionOnNextCall(IsGoo); + assertTrue(IsGoo(goo)); +})(); + +(function() { + function* Goo() {}; + const goo = {}; + Goo.prototype = 42 + + function IsGoo(x) { + return x instanceof Goo; + } + + assertThrows(_ => IsGoo(goo), TypeError); + assertThrows(_ => IsGoo(goo), TypeError); + %OptimizeFunctionOnNextCall(IsGoo); + assertThrows(_ => IsGoo(goo), TypeError); +})(); + +(function() { + function* Goo() {}; + const goo = {}; + + function IsGoo(x) { + return x instanceof Goo; + } + + assertFalse(IsGoo(goo)); + assertFalse(IsGoo(goo)); + %OptimizeFunctionOnNextCall(IsGoo); + assertFalse(IsGoo(goo)); + Goo.prototype = Object.prototype; + assertTrue(IsGoo(goo)); +})(); + +(function() { + function* Goo() {}; + const goo = {}; + + function IsGoo(x) { + return x instanceof Goo; + } + + assertFalse(IsGoo(goo)); + assertFalse(IsGoo(goo)); + %OptimizeFunctionOnNextCall(IsGoo); + assertFalse(IsGoo(goo)); + Goo.prototype = 42; + assertThrows(_ => IsGoo(goo), TypeError); +})(); + + +// With instance creation: + +(function() { + function* Goo() {}; + const goo = Goo(); + + function IsGoo(x) { + return x instanceof Goo; + } + + assertTrue(IsGoo(goo)); + assertTrue(IsGoo(goo)); + %OptimizeFunctionOnNextCall(IsGoo); + assertTrue(IsGoo(goo)); +})(); + +(function() { + function* Goo() {}; + const goo = Goo(); + Goo.prototype = {}; + + function IsGoo(x) { + return x instanceof Goo; + } + + assertFalse(IsGoo(goo)); + assertFalse(IsGoo(goo)); + %OptimizeFunctionOnNextCall(IsGoo); + assertFalse(IsGoo(goo)); +})(); + +(function() { + function* Goo() {}; + const goo = Goo(); + Goo.prototype = 42; + + function IsGoo(x) { + return x instanceof Goo; + } + + assertThrows(_ => IsGoo(goo), TypeError); + assertThrows(_ => IsGoo(goo), TypeError); + %OptimizeFunctionOnNextCall(IsGoo); + assertThrows(_ => IsGoo(goo), TypeError); +})(); + +(function() { + function* Goo() {}; + const goo = Goo(); + + function IsGoo(x) { + return x instanceof Goo; + } + + assertTrue(IsGoo(goo)); + assertTrue(IsGoo(goo)); + %OptimizeFunctionOnNextCall(IsGoo); + assertTrue(IsGoo(goo)); + Goo.prototype = {}; + assertFalse(IsGoo(goo)); +})(); + +(function() { + function* Goo() {}; + const goo = Goo(); + + function IsGoo(x) { + return x instanceof Goo; + } + + assertTrue(IsGoo(goo)); + assertTrue(IsGoo(goo)); + %OptimizeFunctionOnNextCall(IsGoo); + assertTrue(IsGoo(goo)); + Goo.prototype = 42 + assertThrows(_ => IsGoo(goo), TypeError); +})(); + +(function() { + function* Goo() {}; + Goo.prototype = 42; + const goo = Goo(); + + function IsGoo(x) { + return x instanceof Goo; + } + + assertThrows(_ => IsGoo(goo), TypeError); + assertThrows(_ => IsGoo(goo), TypeError); + %OptimizeFunctionOnNextCall(IsGoo); + assertThrows(_ => IsGoo(goo), TypeError); + Goo.prototype = {}; + assertFalse(IsGoo(goo)); +})(); + +(function() { + function* Goo() {}; + Goo.prototype = 42; + const goo = Goo(); + Goo.prototype = {}; + + function IsGoo(x) { + return x instanceof Goo; + } + + assertFalse(IsGoo(goo)); + assertFalse(IsGoo(goo)); + %OptimizeFunctionOnNextCall(IsGoo); + assertFalse(IsGoo(goo)); + Goo.prototype = Object.prototype; + assertTrue(IsGoo(goo)); +})(); + +(function() { + function* Goo() {}; + Goo.prototype = {}; + const goo = Goo(); + Goo.prototype = 42; + + function IsGoo(x) { + return x instanceof Goo; + } + + assertThrows(_ => IsGoo(goo), TypeError); + assertThrows(_ => IsGoo(goo), TypeError); + %OptimizeFunctionOnNextCall(IsGoo); + assertThrows(_ => IsGoo(goo), TypeError); + Goo.prototype = Object.prototype; + assertTrue(IsGoo(goo)); +})(); + +(function() { + function* Goo() {}; + Goo.prototype = {}; + const goo = Goo(); + Goo.prototype = {}; + + function IsGoo(x) { + return x instanceof Goo; + } + + assertFalse(IsGoo(goo)); + assertFalse(IsGoo(goo)); + %OptimizeFunctionOnNextCall(IsGoo); + Goo.prototype = Object.prototype; + assertTrue(IsGoo(goo)); +})(); diff --git a/deps/v8/test/mjsunit/compiler/int64.js b/deps/v8/test/mjsunit/compiler/int64.js new file mode 100644 index 0000000000..0a88a95895 --- /dev/null +++ b/deps/v8/test/mjsunit/compiler/int64.js @@ -0,0 +1,91 @@ +// Copyright 2018 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 + +// Test NumberAdd with PositiveSafeInteger -> PositiveSafeInteger (as Tagged). +(function() { + function foo(x) { + const i = x ? 0xFFFFFFFF : 0; + return i + 1; + } + + assertEquals(0x000000001, foo(false)); + assertEquals(0x000000001, foo(false)); + assertEquals(0x100000000, foo(true)); + assertEquals(0x100000000, foo(true)); + %OptimizeFunctionOnNextCall(foo); + assertEquals(0x000000001, foo(false)); + assertEquals(0x100000000, foo(true)); +})(); + +// Test NumberAdd with SafeInteger -> SafeInteger (as Tagged). +(function() { + function foo(x) { + const i = x ? 0xFFFFFFFF : -1; + return i + 1; + } + + assertEquals(0x000000000, foo(false)); + assertEquals(0x000000000, foo(false)); + assertEquals(0x100000000, foo(true)); + assertEquals(0x100000000, foo(true)); + %OptimizeFunctionOnNextCall(foo); + assertEquals(0x000000000, foo(false)); + assertEquals(0x100000000, foo(true)); +})(); + +// NumberAdd: Smi x Unsigned32 -> SafeInteger (as Float64). +(function() { + const a = new Float64Array(1); + + function foo(o) { + a[0] = o.x + 0xFFFFFFFF; + return a[0]; + } + + assertEquals(0x0FFFFFFFF, foo({x:0})); + assertEquals(0x100000000, foo({x:1})); + %OptimizeFunctionOnNextCall(foo); + assertEquals(0x100000000, foo({x:1})); +})(); + +// NumberAdd: Smi x Unsigned32 -> SafeInteger (as TaggedSigned). +(function() { + function foo(o) { + return {x: Math.floor((o.x + 11123456789) + -11123456788)}.x; + } + + assertEquals(1, foo({x:0})); + assertEquals(2, foo({x:1})); + %OptimizeFunctionOnNextCall(foo); + assertEquals(2, foo({x:1})); +})(); + +// NumberSubtract: Unsigned32 x Unsigned32 -> SafeInteger (as Word32). +(function() { + function foo(a, i) { + i = ((i >>> 0)) - 0xFFFFFFFF; + return a[i]; + } + + assertEquals(1, foo([1], 0xFFFFFFFF)); + assertEquals(2, foo([2], 0xFFFFFFFF)); + %OptimizeFunctionOnNextCall(foo); + assertEquals(3, foo([3], 0xFFFFFFFF)); +})(); + +// Test that the Deoptimizer can handle Word64 properly. +(function() { + function foo(b) { + const i = ((b >>> 0)) - 0xFFFFFFFF; + %DeoptimizeFunction(foo); + return i; + } + + assertEquals(0, foo(0xFFFFFFFF)); + assertEquals(0, foo(0xFFFFFFFF)); + %OptimizeFunctionOnNextCall(foo); + assertEquals(0, foo(0xFFFFFFFF)); +})(); diff --git a/deps/v8/test/mjsunit/compiler/math-imul.js b/deps/v8/test/mjsunit/compiler/math-imul.js new file mode 100644 index 0000000000..1de18a6a2d --- /dev/null +++ b/deps/v8/test/mjsunit/compiler/math-imul.js @@ -0,0 +1,76 @@ +// Copyright 2018 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 --opt + +// Test Math.imul() with no inputs. +(function() { + function foo() { return Math.imul(); } + + assertEquals(0, foo()); + assertEquals(0, foo()); + %OptimizeFunctionOnNextCall(foo); + assertEquals(0, foo()); +})(); + +// Test Math.imul() with only one input. +(function() { + function foo(x) { return Math.imul(x); } + + assertEquals(0, foo(1)); + assertEquals(0, foo(2)); + %OptimizeFunctionOnNextCall(foo); + assertEquals(0, foo(3)); +})(); + +// Test Math.imul() with wrong types. +(function() { + function foo(x, y) { return Math.imul(x, y); } + + assertEquals(0, foo(null, 1)); + assertEquals(0, foo(2, undefined)); + %OptimizeFunctionOnNextCall(foo); + assertEquals(0, foo(null, 1)); + assertEquals(0, foo(2, undefined)); + %OptimizeFunctionOnNextCall(foo); + assertEquals(0, foo(null, 1)); + assertEquals(0, foo(2, undefined)); + assertOptimized(foo); +})(); + +// Test Math.imul() with signed integers (statically known). +(function() { + function foo(x, y) { return Math.imul(x|0, y|0); } + + assertEquals(1, foo(1, 1)); + assertEquals(2, foo(2, 1)); + %OptimizeFunctionOnNextCall(foo); + assertEquals(1, foo(1, 1)); + assertEquals(2, foo(2, 1)); + assertOptimized(foo); +})(); + +// Test Math.imul() with unsigned integers (statically known). +(function() { + function foo(x, y) { return Math.imul(x>>>0, y>>>0); } + + assertEquals(1, foo(1, 1)); + assertEquals(2, foo(2, 1)); + %OptimizeFunctionOnNextCall(foo); + assertEquals(1, foo(1, 1)); + assertEquals(2, foo(2, 1)); + assertOptimized(foo); +})(); + +// Test Math.imul() with floating-point numbers. +(function() { + function foo(x, y) { return Math.imul(x, y); } + + assertEquals(1, foo(1.1, 1.1)); + assertEquals(2, foo(2.1, 1.1)); + %OptimizeFunctionOnNextCall(foo); + assertEquals(1, foo(1.1, 1.1)); + assertEquals(2, foo(2.1, 1.1)); + assertOptimized(foo); +})(); diff --git a/deps/v8/test/mjsunit/compiler/math-max.js b/deps/v8/test/mjsunit/compiler/math-max.js new file mode 100644 index 0000000000..350bdfba88 --- /dev/null +++ b/deps/v8/test/mjsunit/compiler/math-max.js @@ -0,0 +1,38 @@ +// Copyright 2018 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 + +// Test the case where TurboFan can statically rule out -0 from the +// Math.max type. +(function() { + function foo(x) { + // Arrange x such that TurboFan infers type [-inf, inf] \/ MinusZero. + x = +x; + x = Math.round(x); + return Object.is(-0, Math.max(1, x)) + } + + assertFalse(foo(-0)); + assertFalse(foo(-1)); + %OptimizeFunctionOnNextCall(foo); + assertFalse(foo(-0)); + assertFalse(foo(-1)); +})(); + +// Test the case where -0 is ruled out because it's strictly less than +0. +(function() { + function foo(x) { + // Arrange x such that TurboFan infers type [-inf, inf] \/ MinusZero. + x = +x; + x = Math.round(x); + return Object.is(-0, Math.max(0, x)) + } + + assertFalse(foo(-0)); + assertFalse(foo(-1)); + %OptimizeFunctionOnNextCall(foo); + assertFalse(foo(-0)); + assertFalse(foo(-1)); +})(); diff --git a/deps/v8/test/mjsunit/compiler/math-min.js b/deps/v8/test/mjsunit/compiler/math-min.js new file mode 100644 index 0000000000..882103984d --- /dev/null +++ b/deps/v8/test/mjsunit/compiler/math-min.js @@ -0,0 +1,38 @@ +// Copyright 2018 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 + +// Test the case where TurboFan can statically rule out -0 from the +// Math.min type. +(function() { + function foo(x) { + // Arrange x such that TurboFan infers type [-inf, inf] \/ MinusZero. + x = +x; + x = Math.round(x); + return Object.is(-0, Math.min(-1, x)) + } + + assertFalse(foo(-0)); + assertFalse(foo(-1)); + %OptimizeFunctionOnNextCall(foo); + assertFalse(foo(-0)); + assertFalse(foo(-1)); +})(); + +// Test the case where +0 is ruled out because it's strictly greater than -0. +(function() { + function foo(x) { + // Arrange x such that TurboFan infers type [-inf, inf] \/ MinusZero. + x = +x; + x = Math.round(x); + return Object.is(+0, Math.min(-0, x)) + } + + assertFalse(foo(-0)); + assertFalse(foo(-1)); + %OptimizeFunctionOnNextCall(foo); + assertFalse(foo(-0)); + assertFalse(foo(-1)); +})(); diff --git a/deps/v8/test/mjsunit/compiler/number-abs.js b/deps/v8/test/mjsunit/compiler/number-abs.js new file mode 100644 index 0000000000..9eb8ab5bb5 --- /dev/null +++ b/deps/v8/test/mjsunit/compiler/number-abs.js @@ -0,0 +1,76 @@ +// Copyright 2018 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 --opt + +// Test that NumberAbs correctly deals with PositiveInteger \/ MinusZero +// and turns the -0 into a 0. +(function() { + function foo(x) { + x = Math.floor(x); + x = Math.max(x, -0); + return 1 / Math.abs(x); + } + + assertEquals(Infinity, foo(-0)); + assertEquals(Infinity, foo(-0)); + %OptimizeFunctionOnNextCall(foo); + assertEquals(Infinity, foo(-0)); +})(); + +// Test that NumberAbs properly passes the kIdentifyZeros truncation +// for Signed32 \/ MinusZero inputs. +(function() { + function foo(x) { + return Math.abs(x * -2); + } + + assertEquals(2, foo(-1)); + assertEquals(4, foo(-2)); + %OptimizeFunctionOnNextCall(foo); + assertEquals(2, foo(-1)); + assertEquals(4, foo(-2)); + assertOptimized(foo); + // Now `foo` should stay optimized even if `x * -2` would produce `-0`. + assertEquals(0, foo(0)); + assertOptimized(foo); +})(); + +// Test that NumberAbs properly passes the kIdentifyZeros truncation +// for Unsigned32 \/ MinusZero inputs. +(function() { + function foo(x) { + x = x | 0; + return Math.abs(Math.max(x * -2, 0)); + } + + assertEquals(2, foo(-1)); + assertEquals(4, foo(-2)); + %OptimizeFunctionOnNextCall(foo); + assertEquals(2, foo(-1)); + assertEquals(4, foo(-2)); + assertOptimized(foo); + // Now `foo` should stay optimized even if `x * -2` would produce `-0`. + assertEquals(0, foo(0)); + assertOptimized(foo); +})(); + +// Test that NumberAbs properly passes the kIdentifyZeros truncation +// for OrderedNumber inputs. +(function() { + function foo(x) { + x = x | 0; + return Math.abs(Math.min(x * -2, 2 ** 32)); + } + + assertEquals(2, foo(-1)); + assertEquals(4, foo(-2)); + %OptimizeFunctionOnNextCall(foo); + assertEquals(2, foo(-1)); + assertEquals(4, foo(-2)); + assertOptimized(foo); + // Now `foo` should stay optimized even if `x * -2` would produce `-0`. + assertEquals(0, foo(0)); + assertOptimized(foo); +})(); diff --git a/deps/v8/test/mjsunit/compiler/number-add.js b/deps/v8/test/mjsunit/compiler/number-add.js new file mode 100644 index 0000000000..61e6495c52 --- /dev/null +++ b/deps/v8/test/mjsunit/compiler/number-add.js @@ -0,0 +1,62 @@ +// Copyright 2018 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 tests that NumberAdd passes on the right truncations +// even if it figures out during SimplifiedLowering that it +// can indeed do a Word32 operation (based on the feedback +// baked in for its inputs by other operators). +(function() { + // We need a + with Number feedback to get to a NumberAdd + // during the typed lowering pass of TurboFan's frontend. + function foo(x, y) { return x + y; } + foo(0.1, 0.2); + foo(0.1, 0.2); + + // Now we need to fool TurboFan to think that it has to + // perform the `foo(x,-1)` on Float64 values until the + // very last moment (after the RETYPE phase of the + // SimplifiedLowering) where it realizes that the inputs + // and outputs of the NumberAdd allow it perform the + // operation on Word32. + function bar(x) { + x = Math.trunc(foo(x - 1, 1)); + return foo(x, -1); + } + + assertEquals(0, bar(1)); + assertEquals(1, bar(2)); + %OptimizeFunctionOnNextCall(bar); + assertEquals(2, bar(3)); +})(); + +// This tests that SpeculativeNumberAdd can still lower to +// Int32Add in SimplifiedLowering, which requires some magic +// to make sure that SpeculativeNumberAdd survives to that +// point, especially the JSTypedLowering needs to be unable +// to tell that the inputs to SpeculativeNumberAdd are non +// String primitives. +(function() { + // We need a function that has a + with feedback Number or + // NumberOrOddball, but for whose inputs the JSTypedLowering + // cannot reduce it to NumberAdd (with SpeculativeToNumber + // conversions). We achieve this utilizing an object literal + // indirection here. + function baz(x) { + return {x}.x + x; + } + baz(null); + baz(undefined); + + // Now we just need to truncate the result. + function foo(x) { + return baz(1) | 0; + } + + assertEquals(2, foo()); + assertEquals(2, foo()); + %OptimizeFunctionOnNextCall(foo); + assertEquals(2, foo()); +})(); diff --git a/deps/v8/test/mjsunit/compiler/number-ceil.js b/deps/v8/test/mjsunit/compiler/number-ceil.js new file mode 100644 index 0000000000..ce87cd0fc0 --- /dev/null +++ b/deps/v8/test/mjsunit/compiler/number-ceil.js @@ -0,0 +1,22 @@ +// Copyright 2018 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 --opt + +// Test that NumberCeil propagates kIdentifyZeros truncations. +(function() { + function foo(x) { + return Math.abs(Math.ceil(x * -2)); + } + + assertEquals(2, foo(1)); + assertEquals(4, foo(2)); + %OptimizeFunctionOnNextCall(foo); + assertEquals(2, foo(1)); + assertEquals(4, foo(2)); + assertOptimized(foo); + // Now `foo` should stay optimized even if `x * -2` would produce `-0`. + assertEquals(0, foo(0)); + assertOptimized(foo); +})(); diff --git a/deps/v8/test/mjsunit/compiler/number-comparison-truncations.js b/deps/v8/test/mjsunit/compiler/number-comparison-truncations.js new file mode 100644 index 0000000000..33abf6b913 --- /dev/null +++ b/deps/v8/test/mjsunit/compiler/number-comparison-truncations.js @@ -0,0 +1,152 @@ +// Copyright 2018 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 --opt + +// Test that SpeculativeNumberEqual[SignedSmall] properly passes the +// kIdentifyZeros truncation. +(function() { + function foo(x, y) { + if (x * y === 0) return 0; + return 1; + } + + assertEquals(0, foo(0, 1)); + assertEquals(1, foo(1, 1)); + assertEquals(1, foo(1, 2)); + %OptimizeFunctionOnNextCall(foo); + assertEquals(0, foo(0, 1)); + assertEquals(1, foo(1, 1)); + assertEquals(1, foo(1, 2)); + assertOptimized(foo); + // Even if x*y produces -0 now, it should stay optimized. + assertEquals(0, foo(-3, 0)); + assertEquals(0, foo(0, -3)); + assertOptimized(foo); +})(); + +// Test that SpeculativeNumberEqual[Number] properly passes the +// kIdentifyZeros truncation. +(function() { + // Produce a SpeculativeNumberEqual with Number feedback. + function bar(x, y) { return x === y; } + bar(0.1, 0.5); + bar(-0, 100); + + function foo(x, y) { + if (bar(x * y, 0)) return 0; + return 1; + } + + assertEquals(0, foo(0, 1)); + assertEquals(1, foo(1, 1)); + assertEquals(1, foo(1, 2)); + %OptimizeFunctionOnNextCall(foo); + assertEquals(0, foo(0, 1)); + assertEquals(1, foo(1, 1)); + assertEquals(1, foo(1, 2)); + assertOptimized(foo); + // Even if x*y produces -0 now, it should stay optimized. + assertEquals(0, foo(-3, 0)); + assertEquals(0, foo(0, -3)); + assertOptimized(foo); +})(); + +// Test that SpeculativeNumberLessThan[SignedSmall] properly passes the +// kIdentifyZeros truncation. +(function() { + function foo(x, y) { + if (x * y < 0) return 0; + return 1; + } + + assertEquals(0, foo(1, -1)); + assertEquals(1, foo(1, 1)); + assertEquals(1, foo(1, 2)); + %OptimizeFunctionOnNextCall(foo); + assertEquals(0, foo(1, -1)); + assertEquals(1, foo(1, 1)); + assertEquals(1, foo(1, 2)); + assertOptimized(foo); + // Even if x*y produces -0 now, it should stay optimized. + assertEquals(1, foo(-3, 0)); + assertEquals(1, foo(0, -3)); + assertOptimized(foo); +})(); + +// Test that SpeculativeNumberLessThan[Number] properly passes the +// kIdentifyZeros truncation. +(function() { + // Produce a SpeculativeNumberLessThan with Number feedback. + function bar(x, y) { return x < y; } + bar(0.1, 0.5); + bar(-0, 100); + + function foo(x, y) { + if (bar(x * y, 0)) return 0; + return 1; + } + + assertEquals(0, foo(1, -1)); + assertEquals(1, foo(1, 1)); + assertEquals(1, foo(1, 2)); + %OptimizeFunctionOnNextCall(foo); + assertEquals(0, foo(1, -1)); + assertEquals(1, foo(1, 1)); + assertEquals(1, foo(1, 2)); + assertOptimized(foo); + // Even if x*y produces -0 now, it should stay optimized. + assertEquals(1, foo(-3, 0)); + assertEquals(1, foo(0, -3)); + assertOptimized(foo); +})(); + +// Test that SpeculativeNumberLessThanOrEqual[SignedSmall] properly passes the +// kIdentifyZeros truncation. +(function() { + function foo(x, y) { + if (x * y <= 0) return 0; + return 1; + } + + assertEquals(0, foo(0, 1)); + assertEquals(1, foo(1, 1)); + assertEquals(1, foo(1, 2)); + %OptimizeFunctionOnNextCall(foo); + assertEquals(0, foo(0, 1)); + assertEquals(1, foo(1, 1)); + assertEquals(1, foo(1, 2)); + assertOptimized(foo); + // Even if x*y produces -0 now, it should stay optimized. + assertEquals(0, foo(-3, 0)); + assertEquals(0, foo(0, -3)); + assertOptimized(foo); +})(); + +// Test that SpeculativeNumberLessThanOrEqual[Number] properly passes the +// kIdentifyZeros truncation. +(function() { + // Produce a SpeculativeNumberLessThanOrEqual with Number feedback. + function bar(x, y) { return x <= y; } + bar(0.1, 0.5); + bar(-0, 100); + + function foo(x, y) { + if (bar(x * y, 0)) return 0; + return 1; + } + + assertEquals(0, foo(0, 1)); + assertEquals(1, foo(1, 1)); + assertEquals(1, foo(1, 2)); + %OptimizeFunctionOnNextCall(foo); + assertEquals(0, foo(0, 1)); + assertEquals(1, foo(1, 1)); + assertEquals(1, foo(1, 2)); + assertOptimized(foo); + // Even if x*y produces -0 now, it should stay optimized. + assertEquals(0, foo(-3, 0)); + assertEquals(0, foo(0, -3)); + assertOptimized(foo); +})(); diff --git a/deps/v8/test/mjsunit/compiler/number-divide.js b/deps/v8/test/mjsunit/compiler/number-divide.js new file mode 100644 index 0000000000..c4cc8fa881 --- /dev/null +++ b/deps/v8/test/mjsunit/compiler/number-divide.js @@ -0,0 +1,207 @@ +// Copyright 2018 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 --opt --noalways-opt + +// Test that NumberDivide with Number feedback works if only in the +// end SimplifiedLowering figures out that the inputs to this operation +// are actually Unsigned32. +(function() { + // We need a separately polluted % with NumberOrOddball feedback. + function bar(x) { return x / 2; } + bar(undefined); // The % feedback is now NumberOrOddball. + + // Now just use the gadget above in a way that only after RETYPE + // in SimplifiedLowering we find out that the `x` is actually in + // Unsigned32 range (based on taking the SignedSmall feedback on + // the + operator). + function foo(x) { + x = (x >>> 0) + 1; + return bar(x) | 0; + } + + assertEquals(1, foo(1)); + assertEquals(1, foo(2)); + assertEquals(2, foo(3)); + assertEquals(2, foo(4)); + %OptimizeFunctionOnNextCall(foo); + assertEquals(1, foo(1)); + assertEquals(1, foo(2)); + assertEquals(2, foo(3)); + assertEquals(2, foo(4)); + assertOptimized(foo); +})(); + +// Test that NumberDivide with Number feedback works if only in the +// end SimplifiedLowering figures out that the inputs to this operation +// are actually Signed32. +(function() { + // We need a separately polluted % with NumberOrOddball feedback. + function bar(x) { return x / 2; } + bar(undefined); // The % feedback is now NumberOrOddball. + + // Now just use the gadget above in a way that only after RETYPE + // in SimplifiedLowering we find out that the `x` is actually in + // Signed32 range (based on taking the SignedSmall feedback on + // the + operator). + function foo(x) { + x = (x | 0) + 1; + return bar(x) | 0; + } + + assertEquals(1, foo(1)); + assertEquals(1, foo(2)); + assertEquals(2, foo(3)); + assertEquals(2, foo(4)); + %OptimizeFunctionOnNextCall(foo); + assertEquals(1, foo(1)); + assertEquals(1, foo(2)); + assertEquals(2, foo(3)); + assertEquals(2, foo(4)); + assertOptimized(foo); +})(); + +// Test that SpeculativeNumberDivide turns into CheckedInt32Div, and +// that the "known power of two divisor" optimization works correctly. +(function() { + function foo(x) { return (x | 0) / 2; } + + // Warmup with proper int32 divisions. + assertEquals(1, foo(2)); + assertEquals(2, foo(4)); + %OptimizeFunctionOnNextCall(foo); + assertEquals(3, foo(6)); + assertOptimized(foo); + + // Make optimized code fail. + assertEquals(0.5, foo(1)); + assertUnoptimized(foo); + + // Try again with the new feedback, and now it should stay optimized. + %OptimizeFunctionOnNextCall(foo); + assertEquals(4, foo(8)); + assertOptimized(foo); + assertEquals(0.5, foo(1)); + assertOptimized(foo); +})(); + +// Test that SpeculativeNumberDivide turns into CheckedInt32Div, and +// that the optimized code properly bails out on "division by zero". +(function() { + function foo(x, y) { return x / y; } + + // Warmup with proper int32 divisions. + assertEquals(2, foo(4, 2)); + assertEquals(2, foo(8, 4)); + %OptimizeFunctionOnNextCall(foo); + assertEquals(1, foo(2, 2)); + assertOptimized(foo); + + // Make optimized code fail. + assertEquals(Infinity, foo(1, 0)); + assertUnoptimized(foo); + + // Try again with the new feedback, and now it should stay optimized. + %OptimizeFunctionOnNextCall(foo); + assertEquals(2, foo(2, 1)); + assertOptimized(foo); + assertEquals(Infinity, foo(1, 0)); + assertOptimized(foo); +})(); + +// Test that SpeculativeNumberDivide turns into CheckedInt32Div, and +// that the optimized code properly bails out on minus zero. +(function() { + function foo(x, y) { return x / y; } + + // Warmup with proper int32 divisions. + assertEquals(2, foo(4, 2)); + assertEquals(2, foo(8, 4)); + %OptimizeFunctionOnNextCall(foo); + assertEquals(1, foo(2, 2)); + assertOptimized(foo); + + // Make optimized code fail. + assertEquals(-0, foo(0, -1)); + assertUnoptimized(foo); + + // Try again with the new feedback, and now it should stay optimized. + %OptimizeFunctionOnNextCall(foo); + assertEquals(2, foo(2, 1)); + assertOptimized(foo); + assertEquals(-0, foo(0, -1)); + assertOptimized(foo); +})(); + +// Test that SpeculativeNumberDivide turns into CheckedInt32Div, and +// that the optimized code properly bails out if result is -kMinInt. +(function() { + function foo(x, y) { return x / y; } + + // Warmup with proper int32 divisions. + assertEquals(2, foo(4, 2)); + assertEquals(2, foo(8, 4)); + %OptimizeFunctionOnNextCall(foo); + assertEquals(1, foo(2, 2)); + assertOptimized(foo); + + // Make optimized code fail. + assertEquals(2147483648, foo(-2147483648, -1)); + assertUnoptimized(foo); + + // Try again with the new feedback, and now it should stay optimized. + %OptimizeFunctionOnNextCall(foo); + assertEquals(2, foo(2, 1)); + assertOptimized(foo); + assertEquals(2147483648, foo(-2147483648, -1)); + assertOptimized(foo); +})(); + +// Test that SpeculativeNumberDivide turns into CheckedUint32Div, and +// that the "known power of two divisor" optimization works correctly. +(function() { + function foo(s) { return s.length / 2; } + + // Warmup with proper uint32 divisions. + assertEquals(1, foo("ab".repeat(1))); + assertEquals(2, foo("ab".repeat(2))); + %OptimizeFunctionOnNextCall(foo); + assertEquals(3, foo("ab".repeat(3))); + assertOptimized(foo); + + // Make optimized code fail. + assertEquals(0.5, foo("a")); + assertUnoptimized(foo); + + // Try again with the new feedback, and now it should stay optimized. + %OptimizeFunctionOnNextCall(foo); + assertEquals(4, foo("ab".repeat(4))); + assertOptimized(foo); + assertEquals(0.5, foo("a")); + assertOptimized(foo); +})(); + +// Test that SpeculativeNumberDivide turns into CheckedUint32Div, and +// that the optimized code properly bails out on "division by zero". +(function() { + function foo(x, y) { return (x >>> 0) / (y >>> 0); } + + // Warmup with proper uint32 divisions. + assertEquals(2, foo(4, 2)); + assertEquals(2, foo(8, 4)); + %OptimizeFunctionOnNextCall(foo); + assertEquals(1, foo(2, 2)); + assertOptimized(foo); + + // Make optimized code fail. + assertEquals(Infinity, foo(1, 0)); + assertUnoptimized(foo); + + // Try again with the new feedback, and now it should stay optimized. + %OptimizeFunctionOnNextCall(foo); + assertEquals(2, foo(2, 1)); + assertOptimized(foo); + assertEquals(Infinity, foo(1, 0)); + assertOptimized(foo); +})(); diff --git a/deps/v8/test/mjsunit/compiler/number-floor.js b/deps/v8/test/mjsunit/compiler/number-floor.js new file mode 100644 index 0000000000..180b89e559 --- /dev/null +++ b/deps/v8/test/mjsunit/compiler/number-floor.js @@ -0,0 +1,22 @@ +// Copyright 2018 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 --opt + +// Test that NumberFloor propagates kIdentifyZeros truncations. +(function() { + function foo(x) { + return Math.abs(Math.floor(x * -2)); + } + + assertEquals(2, foo(1)); + assertEquals(4, foo(2)); + %OptimizeFunctionOnNextCall(foo); + assertEquals(2, foo(1)); + assertEquals(4, foo(2)); + assertOptimized(foo); + // Now `foo` should stay optimized even if `x * -2` would produce `-0`. + assertEquals(0, foo(0)); + assertOptimized(foo); +})(); diff --git a/deps/v8/test/mjsunit/compiler/number-issafeinteger.js b/deps/v8/test/mjsunit/compiler/number-issafeinteger.js index 192fb6c124..b705e95ed5 100644 --- a/deps/v8/test/mjsunit/compiler/number-issafeinteger.js +++ b/deps/v8/test/mjsunit/compiler/number-issafeinteger.js @@ -40,11 +40,19 @@ function test(f) { assertFalse(f(2 * near_lower - 7)); } -function f(x) { - return Number.isSafeInteger(+x); -} +// Check that the NumberIsSafeInteger simplified operator in +// TurboFan does the right thing. +function NumberIsSafeInteger(x) { return Number.isSafeInteger(+x); } +test(NumberIsSafeInteger); +test(NumberIsSafeInteger); +%OptimizeFunctionOnNextCall(NumberIsSafeInteger); +test(NumberIsSafeInteger); -test(f); -test(f); -%OptimizeFunctionOnNextCall(f); -test(f); +// Check that the ObjectIsSafeInteger simplified operator in +// TurboFan does the right thing as well (i.e. when TurboFan +// is not able to tell statically that the inputs are numbers). +function ObjectIsSafeInteger(x) { return Number.isSafeInteger(x); } +test(ObjectIsSafeInteger); +test(ObjectIsSafeInteger); +%OptimizeFunctionOnNextCall(ObjectIsSafeInteger); +test(ObjectIsSafeInteger); diff --git a/deps/v8/test/mjsunit/compiler/number-max.js b/deps/v8/test/mjsunit/compiler/number-max.js new file mode 100644 index 0000000000..7e5a4a4ad1 --- /dev/null +++ b/deps/v8/test/mjsunit/compiler/number-max.js @@ -0,0 +1,23 @@ +// Copyright 2018 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 --opt + +// Test that NumberMax properly passes the kIdentifyZeros truncation. +(function() { + function foo(x) { + if (Math.max(x * -2, 1) == 1) return 0; + return 1; + } + + assertEquals(0, foo(2)); + assertEquals(1, foo(-1)); + %OptimizeFunctionOnNextCall(foo); + assertEquals(0, foo(2)); + assertEquals(1, foo(-1)); + assertOptimized(foo); + // Now `foo` should stay optimized even if `x * -2` would produce `-0`. + assertEquals(0, foo(0)); + assertOptimized(foo); +})(); diff --git a/deps/v8/test/mjsunit/compiler/number-min.js b/deps/v8/test/mjsunit/compiler/number-min.js new file mode 100644 index 0000000000..72bff78686 --- /dev/null +++ b/deps/v8/test/mjsunit/compiler/number-min.js @@ -0,0 +1,23 @@ +// Copyright 2018 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 --opt + +// Test that NumberMin properly passes the kIdentifyZeros truncation. +(function() { + function foo(x) { + if (Math.min(x * -2, -1) == -2) return 0; + return 1; + } + + assertEquals(0, foo(1)); + assertEquals(1, foo(2)); + %OptimizeFunctionOnNextCall(foo); + assertEquals(0, foo(1)); + assertEquals(1, foo(2)); + assertOptimized(foo); + // Now `foo` should stay optimized even if `x * -2` would produce `-0`. + assertEquals(1, foo(0)); + assertOptimized(foo); +})(); diff --git a/deps/v8/test/mjsunit/compiler/number-modulus.js b/deps/v8/test/mjsunit/compiler/number-modulus.js new file mode 100644 index 0000000000..5f695d1ee5 --- /dev/null +++ b/deps/v8/test/mjsunit/compiler/number-modulus.js @@ -0,0 +1,256 @@ +// Copyright 2018 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 --opt --noalways-opt + +// Test that NumberModulus with Number feedback works if only in the +// end SimplifiedLowering figures out that the inputs to this operation +// are actually Unsigned32. +(function() { + // We need a separately polluted % with NumberOrOddball feedback. + function bar(x) { return x % 2; } + bar(undefined); // The % feedback is now NumberOrOddball. + + // Now just use the gadget above in a way that only after RETYPE + // in SimplifiedLowering we find out that the `x` is actually in + // Unsigned32 range (based on taking the SignedSmall feedback on + // the + operator). + function foo(x) { + x = (x >>> 0) + 1; + return bar(x) | 0; + } + + assertEquals(0, foo(1)); + assertEquals(1, foo(2)); + assertEquals(0, foo(3)); + assertEquals(1, foo(4)); + %OptimizeFunctionOnNextCall(foo); + assertEquals(0, foo(1)); + assertEquals(1, foo(2)); + assertEquals(0, foo(3)); + assertEquals(1, foo(4)); + assertOptimized(foo); +})(); + +// Test that NumberModulus with Number feedback works if only in the +// end SimplifiedLowering figures out that the inputs to this operation +// are actually Signed32. +(function() { + // We need a separately polluted % with NumberOrOddball feedback. + function bar(x) { return x % 2; } + bar(undefined); // The % feedback is now NumberOrOddball. + + // Now just use the gadget above in a way that only after RETYPE + // in SimplifiedLowering we find out that the `x` is actually in + // Signed32 range (based on taking the SignedSmall feedback on + // the + operator). + function foo(x) { + x = (x | 0) + 1; + return bar(x) | 0; + } + + assertEquals(0, foo(1)); + assertEquals(1, foo(2)); + assertEquals(0, foo(3)); + assertEquals(1, foo(4)); + %OptimizeFunctionOnNextCall(foo); + assertEquals(0, foo(1)); + assertEquals(1, foo(2)); + assertEquals(0, foo(3)); + assertEquals(1, foo(4)); + assertOptimized(foo); +})(); + +// Test that SpeculativeNumberModulus with Number feedback works if +// only in the end SimplifiedLowering figures out that the inputs to +// this operation are actually Unsigned32. +(function() { + // We need to use an object literal here to make sure that the + // SpeculativeNumberModulus is not turned into a NumberModulus + // early during JSTypedLowering. + function bar(x) { return {x}.x % 2; } + bar(undefined); // The % feedback is now NumberOrOddball. + + // Now just use the gadget above in a way that only after RETYPE + // in SimplifiedLowering we find out that the `x` is actually in + // Unsigned32 range (based on taking the SignedSmall feedback on + // the + operator). + function foo(x) { + x = (x >>> 0) + 1; + return bar(x) | 0; + } + + assertEquals(0, foo(1)); + assertEquals(1, foo(2)); + assertEquals(0, foo(3)); + assertEquals(1, foo(4)); + %OptimizeFunctionOnNextCall(foo); + assertEquals(0, foo(1)); + assertEquals(1, foo(2)); + assertEquals(0, foo(3)); + assertEquals(1, foo(4)); + assertOptimized(foo); +})(); + +// Test that SpeculativeNumberModulus with Number feedback works if +// only in the end SimplifiedLowering figures out that the inputs to +// this operation are actually Signed32. +(function() { + // We need to use an object literal here to make sure that the + // SpeculativeNumberModulus is not turned into a NumberModulus + // early during JSTypedLowering. + function bar(x) { return {x}.x % 2; } + bar(undefined); // The % feedback is now NumberOrOddball. + + // Now just use the gadget above in a way that only after RETYPE + // in SimplifiedLowering we find out that the `x` is actually in + // Signed32 range (based on taking the SignedSmall feedback on + // the + operator). + function foo(x) { + x = (x | 0) + 1; + return bar(x) | 0; + } + + assertEquals(0, foo(1)); + assertEquals(1, foo(2)); + assertEquals(0, foo(3)); + assertEquals(1, foo(4)); + %OptimizeFunctionOnNextCall(foo); + assertEquals(0, foo(1)); + assertEquals(1, foo(2)); + assertEquals(0, foo(3)); + assertEquals(1, foo(4)); + assertOptimized(foo); +})(); + +// Test that NumberModulus works in the case where TurboFan +// can infer that the output is Signed32 \/ MinusZero, and +// there's a truncation on the result that identifies zeros +// (via the SpeculativeNumberEqual). +(function() { + // We need a separately polluted % with NumberOrOddball feedback. + function bar(x) { return x % 2; } + bar(undefined); // The % feedback is now NumberOrOddball. + + // Now we just use the gadget above on an `x` that is known + // to be in Signed32 range and compare it to 0, which passes + // a truncation that identifies zeros. + function foo(x) { + if (bar(x | 0) == 0) return 0; + return 1; + } + + assertEquals(0, foo(2)); + assertEquals(1, foo(1)); + %OptimizeFunctionOnNextCall(foo); + assertEquals(0, foo(2)); + assertEquals(1, foo(1)); + assertOptimized(foo); + + // Now `foo` should stay optimized even if `x % 2` would + // produce -0, aka when we pass a negative value for `x`. + assertEquals(0, foo(-2)); + assertEquals(1, foo(-1)); + assertOptimized(foo); +})(); + +// Test that CheckedInt32Mod handles the slow-path (when +// the left hand side is negative) correctly. +(function() { + // We need a SpeculativeNumberModulus with SignedSmall feedback. + function foo(x, y) { + return x % y; + } + + assertEquals(0, foo(2, 1)); + assertEquals(0, foo(2, 2)); + assertEquals(-1, foo(-3, 2)); + %OptimizeFunctionOnNextCall(foo); + assertEquals(0, foo(2, 1)); + assertEquals(0, foo(2, 2)); + assertEquals(-1, foo(-3, 2)); + assertOptimized(foo); + + // Now `foo` should deoptimize if the result is -0. + assertEquals(-0, foo(-2, 2)); + assertUnoptimized(foo); +})(); + +// Test that NumberModulus passes kIdentifiesZero to the +// left hand side input when the result doesn't care about +// 0 vs -0, even when the inputs are outside Signed32. +(function() { + function foo(x) { + return (x * -2) % (2 ** 32) === 0; + } + + assertFalse(foo(2)); + assertFalse(foo(1)); + %OptimizeFunctionOnNextCall(foo); + assertFalse(foo(2)); + assertFalse(foo(1)); + + // Now `foo` should stay optimized even if `x * -2` would + // produce -0, aka when we pass a zero value for `x`. + assertTrue(foo(0)); + assertOptimized(foo); +})(); + +// Test that NumberModulus passes kIdentifiesZero to the +// right hand side input, even when the inputs are outside +// the Signed32 range. +(function() { + function foo(x) { + return (2 ** 32) % (x * -2); + } + + assertEquals(0, foo(1)); + assertEquals(0, foo(1)); + %OptimizeFunctionOnNextCall(foo); + assertEquals(0, foo(1)); + + // Now `foo` should stay optimized even if `x * -2` would + // produce -0, aka when we pass a zero value for `x`. + assertEquals(NaN, foo(0)); + assertOptimized(foo); +})(); + +// Test that SpeculativeNumberModulus passes kIdentifiesZero +// to the right hand side input, even when feedback is consumed. +(function() { + function foo(x, y) { + return (x % (y * -2)) | 0; + } + + assertEquals(0, foo(2, 1)); + assertEquals(-1, foo(-3, 1)); + %OptimizeFunctionOnNextCall(foo); + assertEquals(0, foo(2, 1)); + assertEquals(-1, foo(-3, 1)); + assertOptimized(foo); + + // Now `foo` should stay optimized even if `y * -2` would + // produce -0, aka when we pass a zero value for `y`. + assertEquals(0, foo(2, 0)); + assertOptimized(foo); +})(); + +// Test that SpeculativeNumberModulus passes kIdentifiesZero +// to the left hand side input, even when feedback is consumed. +(function() { + function foo(x, y) { + return ((x * -2) % y) | 0; + } + + assertEquals(-2, foo(1, 3)); + assertEquals(-2, foo(1, 3)); + %OptimizeFunctionOnNextCall(foo); + assertEquals(-2, foo(1, 3)); + assertOptimized(foo); + + // Now `foo` should stay optimized even if `x * -2` would + // produce -0, aka when we pass a zero value for `x`. + assertEquals(0, foo(0, 2)); + assertOptimized(foo); +})(); diff --git a/deps/v8/test/mjsunit/compiler/number-round.js b/deps/v8/test/mjsunit/compiler/number-round.js new file mode 100644 index 0000000000..9aec7f7a12 --- /dev/null +++ b/deps/v8/test/mjsunit/compiler/number-round.js @@ -0,0 +1,22 @@ +// Copyright 2018 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 --opt + +// Test that NumberRound propagates kIdentifyZeros truncations. +(function() { + function foo(x) { + return Math.abs(Math.round(x * -2)); + } + + assertEquals(2, foo(1)); + assertEquals(4, foo(2)); + %OptimizeFunctionOnNextCall(foo); + assertEquals(2, foo(1)); + assertEquals(4, foo(2)); + assertOptimized(foo); + // Now `foo` should stay optimized even if `x * -2` would produce `-0`. + assertEquals(0, foo(0)); + assertOptimized(foo); +})(); diff --git a/deps/v8/test/mjsunit/compiler/number-subtract.js b/deps/v8/test/mjsunit/compiler/number-subtract.js new file mode 100644 index 0000000000..cb3e1c7e70 --- /dev/null +++ b/deps/v8/test/mjsunit/compiler/number-subtract.js @@ -0,0 +1,34 @@ +// Copyright 2018 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 tests that SpeculativeNumberSubtract can still lower to +// Int32Sub in SimplifiedLowering, which requires some magic +// to make sure that SpeculativeNumberSubtract survives to that +// point, especially the JSTypedLowering needs to be unable +// to tell that the inputs to SpeculativeNumberAdd are not +// Number, Undefined, Null or Boolean. +(function() { + // We need a function that has a - with feedback Number or + // NumberOrOddball, but for whose inputs the JSTypedLowering + // cannot reduce it to NumberSubtract (with SpeculativeToNumber + // conversions). We achieve this utilizing an object literal + // indirection here. + function baz(x) { + return {x}.x - x; + } + baz(null); + baz(undefined); + + // Now we just need to truncate the result. + function foo(x) { + return baz(42) | 0; + } + + assertEquals(0, foo()); + assertEquals(0, foo()); + %OptimizeFunctionOnNextCall(foo); + assertEquals(0, foo()); +})(); diff --git a/deps/v8/test/mjsunit/compiler/number-toboolean.js b/deps/v8/test/mjsunit/compiler/number-toboolean.js new file mode 100644 index 0000000000..02b30b3ed6 --- /dev/null +++ b/deps/v8/test/mjsunit/compiler/number-toboolean.js @@ -0,0 +1,45 @@ +// Copyright 2018 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 --opt + +// Test that NumberToBoolean properly passes the kIdentifyZeros truncation +// for Signed32 \/ MinusZero inputs. +(function() { + function foo(x) { + if (x * -2) return 1; + return 0; + } + + assertEquals(1, foo(1)); + assertEquals(1, foo(2)); + %OptimizeFunctionOnNextCall(foo); + assertEquals(1, foo(1)); + assertEquals(1, foo(2)); + assertOptimized(foo); + // Now `foo` should stay optimized even if `x * -2` would produce `-0`. + assertEquals(0, foo(0)); + assertOptimized(foo); +})(); + + +// Test that NumberToBoolean properly passes the kIdentifyZeros truncation +// for Unsigned32 \/ MinusZero inputs. +(function() { + function foo(x) { + x = x | 0; + if (Math.max(x * -2, 0)) return 1; + return 0; + } + + assertEquals(1, foo(-1)); + assertEquals(1, foo(-2)); + %OptimizeFunctionOnNextCall(foo); + assertEquals(1, foo(-1)); + assertEquals(1, foo(-2)); + assertOptimized(foo); + // Now `foo` should stay optimized even if `x * -2` would produce `-0`. + assertEquals(0, foo(0)); + assertOptimized(foo); +})(); diff --git a/deps/v8/test/mjsunit/compiler/number-trunc.js b/deps/v8/test/mjsunit/compiler/number-trunc.js new file mode 100644 index 0000000000..aa7d02c20f --- /dev/null +++ b/deps/v8/test/mjsunit/compiler/number-trunc.js @@ -0,0 +1,22 @@ +// Copyright 2018 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 --opt + +// Test that NumberTrunc propagates kIdentifyZeros truncations. +(function() { + function foo(x) { + return Math.abs(Math.trunc(x * -2)); + } + + assertEquals(2, foo(1)); + assertEquals(4, foo(2)); + %OptimizeFunctionOnNextCall(foo); + assertEquals(2, foo(1)); + assertEquals(4, foo(2)); + assertOptimized(foo); + // Now `foo` should stay optimized even if `x * -2` would produce `-0`. + assertEquals(0, foo(0)); + assertOptimized(foo); +})(); diff --git a/deps/v8/test/mjsunit/compiler/redundancy-elimination.js b/deps/v8/test/mjsunit/compiler/redundancy-elimination.js new file mode 100644 index 0000000000..1e5185adb7 --- /dev/null +++ b/deps/v8/test/mjsunit/compiler/redundancy-elimination.js @@ -0,0 +1,194 @@ +// Copyright 2018 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 --opt + +// Test the RedundancyElimination::ReduceSpeculativeNumberOperation() +// TurboFan optimization for the case of SpeculativeNumberAdd with +// Number feedback. +(function() { + function bar(i) { + return ++i; + } + bar(0.1); + + function foo(a, i) { + const x = a[i]; + const y = a[bar(i)]; + return x + y; + } + + assertEquals(3, foo([1, 2], 0)); + assertEquals(3, foo([1, 2], 0)); + %OptimizeFunctionOnNextCall(foo); + assertEquals(3, foo([1, 2], 0)); +})(); + +// Test the RedundancyElimination::ReduceSpeculativeNumberOperation() +// TurboFan optimization for the case of SpeculativeNumberAdd with +// NumberOrOddball feedback. +(function() { + function bar(i) { + return ++i; + } + assertEquals(NaN, bar(undefined)); + + function foo(a, i) { + const x = a[i]; + const y = a[bar(i)]; + return x + y; + } + + assertEquals(3, foo([1, 2], 0)); + assertEquals(3, foo([1, 2], 0)); + %OptimizeFunctionOnNextCall(foo); + assertEquals(3, foo([1, 2], 0)); +})(); + +// Test the RedundancyElimination::ReduceSpeculativeNumberOperation() +// TurboFan optimization for the case of SpeculativeNumberSubtract with +// Number feedback. +(function() { + function bar(i) { + return --i; + } + assertEquals(-0.9, bar(0.1)); + + function foo(a, i) { + const x = a[i]; + const y = a[bar(i)]; + return x + y; + } + + assertEquals(3, foo([1, 2], 1)); + assertEquals(3, foo([1, 2], 1)); + %OptimizeFunctionOnNextCall(foo); + assertEquals(3, foo([1, 2], 1)); +})(); + +// Test the RedundancyElimination::ReduceSpeculativeNumberOperation() +// TurboFan optimization for the case of SpeculativeNumberSubtract with +// NumberOrOddball feedback. +(function() { + function bar(i) { + return --i; + } + assertEquals(NaN, bar(undefined)); + + function foo(a, i) { + const x = a[i]; + const y = a[bar(i)]; + return x + y; + } + + assertEquals(3, foo([1, 2], 1)); + assertEquals(3, foo([1, 2], 1)); + %OptimizeFunctionOnNextCall(foo); + assertEquals(3, foo([1, 2], 1)); +})(); + +// Test the RedundancyElimination::ReduceSpeculativeNumberOperation() +// TurboFan optimization for the case of SpeculativeToNumber. +(function() { + function foo(a, i) { + const x = a[i]; + const y = i++; + return x + y; + } + + assertEquals(1, foo([1, 2], 0)); + assertEquals(1, foo([1, 2], 0)); + %OptimizeFunctionOnNextCall(foo); + assertEquals(1, foo([1, 2], 0)); +})(); + +// Test the RedundancyElimination::ReduceSpeculativeNumberOperation() +// TurboFan optimization for the case of SpeculativeSafeIntegerAdd. +(function() { + function foo(a, i) { + const x = a[i]; + const y = a[++i]; + return x + y; + } + + assertEquals(3, foo([1, 2], 0)); + assertEquals(3, foo([1, 2], 0)); + %OptimizeFunctionOnNextCall(foo); + assertEquals(3, foo([1, 2], 0)); +})(); + +// Test the RedundancyElimination::ReduceSpeculativeNumberOperation() +// TurboFan optimization for the case of SpeculativeSafeIntegerSubtract. +(function() { + function foo(a, i) { + const x = a[i]; + const y = a[--i]; + return x + y; + } + + assertEquals(3, foo([1, 2], 1)); + assertEquals(3, foo([1, 2], 1)); + %OptimizeFunctionOnNextCall(foo); + assertEquals(3, foo([1, 2], 1)); +})(); + +// Test the RedundancyElimination::ReduceSpeculativeNumberComparison() +// TurboFan optimization for the case of SpeculativeNumberEqual. +(function() { + function foo(a, i) { + const x = a[i]; + if (i === 0) return x; + return i; + } + + assertEquals(1, foo([1, 2], 0)); + assertEquals(1, foo([1, 2], 1)); + %OptimizeFunctionOnNextCall(foo); + assertEquals(1, foo([1, 2], 0)); + assertEquals(1, foo([1, 2], 1)); + // Even passing -0 should not deoptimize and + // of course still pass the equality test above. + assertEquals(9, foo([9, 2], -0)); + assertOptimized(foo); +})(); + +// Test the RedundancyElimination::ReduceSpeculativeNumberComparison() +// TurboFan optimization for the case of SpeculativeNumberLessThan. +(function() { + function foo(a, i) { + const x = a[i]; + if (i < 1) return x; + return i; + } + + assertEquals(1, foo([1, 2], 0)); + assertEquals(1, foo([1, 2], 1)); + %OptimizeFunctionOnNextCall(foo); + assertEquals(1, foo([1, 2], 0)); + assertEquals(1, foo([1, 2], 1)); + // Even passing -0 should not deoptimize and + // of course still pass the equality test above. + assertEquals(9, foo([9, 2], -0)); + assertOptimized(foo); +})(); + +// Test the RedundancyElimination::ReduceSpeculativeNumberComparison() +// TurboFan optimization for the case of SpeculativeNumberLessThanOrEqual. +(function() { + function foo(a, i) { + const x = a[i]; + if (i <= 0) return x; + return i; + } + + assertEquals(1, foo([1, 2], 0)); + assertEquals(1, foo([1, 2], 1)); + %OptimizeFunctionOnNextCall(foo); + assertEquals(1, foo([1, 2], 0)); + assertEquals(1, foo([1, 2], 1)); + // Even passing -0 should not deoptimize and + // of course still pass the equality test above. + assertEquals(9, foo([9, 2], -0)); + assertOptimized(foo); +})(); diff --git a/deps/v8/test/mjsunit/compiler/regress-7121.js b/deps/v8/test/mjsunit/compiler/regress-7121.js index 98c1a1ac19..bdf3133bb8 100644 --- a/deps/v8/test/mjsunit/compiler/regress-7121.js +++ b/deps/v8/test/mjsunit/compiler/regress-7121.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 --harmony-bigint +// Flags: --allow-natives-syntax function foo() { %_ToLength(42n) } assertThrows(foo, TypeError); diff --git a/deps/v8/test/mjsunit/compiler/regress-884052.js b/deps/v8/test/mjsunit/compiler/regress-884052.js new file mode 100644 index 0000000000..babfcc3cea --- /dev/null +++ b/deps/v8/test/mjsunit/compiler/regress-884052.js @@ -0,0 +1,16 @@ +// Copyright 2018 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 foo() { + var a = new Array(2); + for (var i = 1; i > -1; i = i - 2) { + if (i < a.length) a = new Array(i); + } +} + +foo(); +%OptimizeFunctionOnNextCall(foo); +foo(); diff --git a/deps/v8/test/mjsunit/compiler/regress-890057.js b/deps/v8/test/mjsunit/compiler/regress-890057.js new file mode 100644 index 0000000000..655c4431e9 --- /dev/null +++ b/deps/v8/test/mjsunit/compiler/regress-890057.js @@ -0,0 +1,16 @@ +// Copyright 2018 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() {} +function g() { + f.prototype = undefined; + f(); + new f(); +} + +// Do not use %OptimizeFunctionOnNextCall here, this particular bug needs +// to trigger truly concurrent compilation. +for (let i = 0; i < 10000; i++) g(); diff --git a/deps/v8/test/mjsunit/compiler/regress-890620.js b/deps/v8/test/mjsunit/compiler/regress-890620.js new file mode 100644 index 0000000000..f5fc7f4f65 --- /dev/null +++ b/deps/v8/test/mjsunit/compiler/regress-890620.js @@ -0,0 +1,25 @@ +// Copyright 2018 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 + +var a = 42; + +function g(n) { + while (n > 0) { + a = new Array(n); + n--; + } +} + +g(1); + +function f() { + g(); +} + +f(); +%OptimizeFunctionOnNextCall(f); +f(); +assertEquals(1, a.length); diff --git a/deps/v8/test/mjsunit/compiler/regress-895799.js b/deps/v8/test/mjsunit/compiler/regress-895799.js new file mode 100644 index 0000000000..4305b7427b --- /dev/null +++ b/deps/v8/test/mjsunit/compiler/regress-895799.js @@ -0,0 +1,26 @@ +// Copyright 2018 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 + +class C extends Object { + constructor() { + try { super(); } catch (e) { }; + return 1; + } +} + +class A extends C { + constructor() { + super(); + throw new Error(); + return { get: () => this }; + } +} + +var D = new Proxy(A, { get() { %DeoptimizeFunction(A); } }); + +try { Reflect.construct(A, [], D); } catch(e) {} +%OptimizeFunctionOnNextCall(A); +try { Reflect.construct(A, [], D); } catch(e) {} diff --git a/deps/v8/test/mjsunit/compiler/strict-equal-symbol.js b/deps/v8/test/mjsunit/compiler/strict-equal-symbol.js new file mode 100644 index 0000000000..aee1ecfa60 --- /dev/null +++ b/deps/v8/test/mjsunit/compiler/strict-equal-symbol.js @@ -0,0 +1,50 @@ +// Copyright 2018 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 + +// Known symbols strict equality. +(function() { + const a = Symbol("a"); + const b = Symbol("b"); + + function foo() { return a === b; } + + assertFalse(foo()); + assertFalse(foo()); + %OptimizeFunctionOnNextCall(foo); + assertFalse(foo()); +})(); + +// Known symbol on one side strict equality. +(function() { + const a = Symbol("a"); + const b = Symbol("b"); + + function foo(a) { return a === b; } + + assertTrue(foo(b)); + assertFalse(foo(a)); + assertTrue(foo(b)); + assertFalse(foo(a)); + %OptimizeFunctionOnNextCall(foo); + assertTrue(foo(b)); + assertFalse(foo(a)); +})(); + +// Feedback based symbol strict equality. +(function() { + const a = Symbol("a"); + const b = Symbol("b"); + + function foo(a, b) { return a === b; } + + assertTrue(foo(b, b)); + assertFalse(foo(a, b)); + assertTrue(foo(a, a)); + assertFalse(foo(b, a)); + %OptimizeFunctionOnNextCall(foo); + assertTrue(foo(a, a)); + assertFalse(foo(b, a)); +})(); diff --git a/deps/v8/test/mjsunit/compiler/string-add-try-catch.js b/deps/v8/test/mjsunit/compiler/string-add-try-catch.js index d7a3d2583c..5ae5b00d18 100644 --- a/deps/v8/test/mjsunit/compiler/string-add-try-catch.js +++ b/deps/v8/test/mjsunit/compiler/string-add-try-catch.js @@ -4,6 +4,9 @@ // Flags: --allow-natives-syntax +// Test that string concatenation overflow (going over string max length) +// is handled gracefully, i.e. an error is thrown + var a = "a".repeat(%StringMaxLength()); (function() { @@ -37,3 +40,57 @@ var a = "a".repeat(%StringMaxLength()); foo("a"); assertInstanceof(foo(a), RangeError); })(); + +(function() { + function foo(a, b) { + try { + return "0123456789012".concat(a); + } catch (e) { + return e; + } + } + + foo("a"); + foo("a"); + %OptimizeFunctionOnNextCall(foo); + foo("a"); + assertInstanceof(foo(a), RangeError); +})(); + +var obj = { + toString: function() { + throw new Error('toString has thrown'); + } +}; + +(function() { + function foo(a, b) { + try { + return "0123456789012" + obj; + } catch (e) { + return e; + } + } + + foo("a"); + foo("a"); + %OptimizeFunctionOnNextCall(foo); + foo("a"); + assertInstanceof(foo(a), Error); +})(); + +(function() { + function foo(a, b) { + try { + return a + 123; + } catch (e) { + return e; + } + } + + foo("a"); + foo("a"); + %OptimizeFunctionOnNextCall(foo); + foo("a"); + assertInstanceof(foo(a), RangeError); +})(); diff --git a/deps/v8/test/mjsunit/compiler/string-from-code-point.js b/deps/v8/test/mjsunit/compiler/string-from-code-point.js new file mode 100644 index 0000000000..165ea0c234 --- /dev/null +++ b/deps/v8/test/mjsunit/compiler/string-from-code-point.js @@ -0,0 +1,32 @@ +// Copyright 2018 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 --opt --noalways-opt + +// Test that String.fromCodePoint() properly identifies zeros. +(function() { + function foo(x) { + return String.fromCodePoint(x); + } + + assertEquals("\u0000", foo(0)); + assertEquals("\u0000", foo(-0)); + %OptimizeFunctionOnNextCall(foo); + assertEquals("\u0000", foo(0)); + assertEquals("\u0000", foo(-0)); + assertOptimized(foo); + + // Now passing anything outside the valid code point + // range should invalidate the optimized code. + assertThrows(_ => foo(-1)); + assertUnoptimized(foo); + + // And TurboFan should not inline the builtin anymore + // from now on (aka no deoptimization loop). + %OptimizeFunctionOnNextCall(foo); + assertEquals("\u0000", foo(0)); + assertEquals("\u0000", foo(-0)); + assertThrows(_ => foo(-1)); + assertOptimized(foo); +})(); diff --git a/deps/v8/test/mjsunit/compiler/typed-array-constructor.js b/deps/v8/test/mjsunit/compiler/typed-array-constructor.js index a785eadf37..07d6a7ca4e 100644 --- a/deps/v8/test/mjsunit/compiler/typed-array-constructor.js +++ b/deps/v8/test/mjsunit/compiler/typed-array-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 --harmony-bigint +// Flags: --allow-natives-syntax const limit = %MaxSmi() + 1; diff --git a/deps/v8/test/mjsunit/d8/d8-worker-script.js b/deps/v8/test/mjsunit/d8/d8-worker-script.js new file mode 100644 index 0000000000..7c5d595b2b --- /dev/null +++ b/deps/v8/test/mjsunit/d8/d8-worker-script.js @@ -0,0 +1,39 @@ +// Copyright 2015 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. + +// Verify that the Worker constrcutor by default treats its first argument +// as the filename of a script load and run. + +// Resources: test/mjsunit/d8/d8-worker-script.txt + +if (this.Worker) { + var w = new Worker('test/mjsunit/d8/d8-worker-script.txt'); + assertEquals("Starting worker", w.getMessage()); + w.postMessage(""); + assertEquals("DONE", w.getMessage()); + w.terminate(); +} diff --git a/deps/v8/test/mjsunit/d8/d8-worker-script.txt b/deps/v8/test/mjsunit/d8/d8-worker-script.txt new file mode 100644 index 0000000000..9254cea4f4 --- /dev/null +++ b/deps/v8/test/mjsunit/d8/d8-worker-script.txt @@ -0,0 +1,8 @@ +// Worker script used by d8-worker-script.js. +// This file is named `.txt` to prevent it being treated as a test itself. + +onmessage = function(m) { + postMessage('DONE'); +} + +postMessage('Starting worker'); diff --git a/deps/v8/test/mjsunit/d8/d8-worker-sharedarraybuffer.js b/deps/v8/test/mjsunit/d8/d8-worker-sharedarraybuffer.js index 0a15413ea3..f166ca2eb1 100644 --- a/deps/v8/test/mjsunit/d8/d8-worker-sharedarraybuffer.js +++ b/deps/v8/test/mjsunit/d8/d8-worker-sharedarraybuffer.js @@ -45,7 +45,7 @@ if (this.Worker) { Atomics.store(ta, 0, 100); };`; - var w = new Worker(workerScript); + var w = new Worker(workerScript, {type: 'string'}); var sab = new SharedArrayBuffer(16); var ta = new Uint32Array(sab); @@ -84,7 +84,7 @@ if (this.Worker) { var id; var workers = []; for (id = 0; id < 4; ++id) { - workers[id] = new Worker(workerScript); + workers[id] = new Worker(workerScript, {type: 'string'}); workers[id].postMessage({sab: sab, id: id}); } diff --git a/deps/v8/test/mjsunit/d8/d8-worker-spawn-worker.js b/deps/v8/test/mjsunit/d8/d8-worker-spawn-worker.js index a114d8587e..621ec253bc 100644 --- a/deps/v8/test/mjsunit/d8/d8-worker-spawn-worker.js +++ b/deps/v8/test/mjsunit/d8/d8-worker-spawn-worker.js @@ -27,14 +27,14 @@ if (this.Worker) { var workerScript = - `var w = new Worker('postMessage(42)'); + `var w = new Worker('postMessage(42)', {type: 'string'}); onmessage = function(parentMsg) { w.postMessage(parentMsg); var childMsg = w.getMessage(); postMessage(childMsg); };`; - var w = new Worker(workerScript); + var w = new Worker(workerScript, {type: 'string'}); w.postMessage(9); assertEquals(42, w.getMessage()); } diff --git a/deps/v8/test/mjsunit/d8/d8-worker.js b/deps/v8/test/mjsunit/d8/d8-worker.js index a73d7b1706..afc03f5c8b 100644 --- a/deps/v8/test/mjsunit/d8/d8-worker.js +++ b/deps/v8/test/mjsunit/d8/d8-worker.js @@ -97,7 +97,21 @@ if (this.Worker) { return ab; } - var w = new Worker(workerScript); + assertThrows(function() { + // Second arg must be 'options' object + new Worker(workerScript, 123); + }); + + assertThrows(function() { + new Worker('test/mjsunit/d8/d8-worker.js', {type: 'invalid'}); + }); + + assertThrows(function() { + // worker type defaults to 'classic' which tries to load from file + new Worker(workerScript); + }); + + var w = new Worker(workerScript, {type: 'string'}); assertEquals("Starting worker", w.getMessage()); @@ -140,6 +154,12 @@ if (this.Worker) { w.postMessage(ab2, [ab2]); assertEquals(0, ab2.byteLength); // ArrayBuffer should be neutered. + // Attempting to transfer the same ArrayBuffer twice should throw. + assertThrows(function() { + var ab3 = createArrayBuffer(4); + w.postMessage(ab3, [ab3, ab3]); + }); + assertEquals("undefined", typeof foo); // Read a message from the worker. @@ -150,7 +170,7 @@ if (this.Worker) { // Make sure that the main thread doesn't block forever in getMessage() if // the worker dies without posting a message. - var w2 = new Worker(''); + var w2 = new Worker('', {type: 'string'}); var msg = w2.getMessage(); assertEquals(undefined, msg); } diff --git a/deps/v8/test/mjsunit/es6/array-spread-holey.js b/deps/v8/test/mjsunit/es6/array-spread-holey.js new file mode 100644 index 0000000000..7d95e51b29 --- /dev/null +++ b/deps/v8/test/mjsunit/es6/array-spread-holey.js @@ -0,0 +1,52 @@ +// Copyright 2018 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 spreading of holey arrays. Holes should be replaced with undefined. + +var a = [, 2]; + +assertEquals([, 2], [...a]); +assertTrue([...a].hasOwnProperty(0)); +assertTrue([2, ...a].hasOwnProperty(1)); + + +class MyArray1 extends Array { + constructor(a) { + super(...a); + } +} +var myarr1 = new MyArray1(a); +assertEquals(undefined, myarr1[0]); +assertTrue(myarr1.hasOwnProperty(0)); + + +class MyArray2 extends Array { + constructor(a) { + super(2, ...a); + } +} +var myarr2 = new MyArray2(a); +assertEquals(undefined, myarr2[1]); +assertTrue(myarr2.hasOwnProperty(1)); + +function foo0() { return arguments.hasOwnProperty(0); } +assertTrue(foo0(...a)); + +function foo1() { return arguments.hasOwnProperty(1); } +assertTrue(foo1(2, ...a)); + +// This test pollutes the Array prototype. No more tests should be run in the +// same instance after this. +a.__proto__[0] = 1; +var arr2 = [...a]; +assertEquals([1,2], arr2); +assertTrue(arr2.hasOwnProperty(0)); + +myarr1 = new MyArray1(a); +assertEquals(1, myarr1[0]); +assertTrue(myarr1.hasOwnProperty(0)); + +var myarr2 = new MyArray2(a); +assertEquals(1, myarr2[1]); +assertTrue(myarr2.hasOwnProperty(1)); diff --git a/deps/v8/test/mjsunit/es6/proxy-function-tostring.js b/deps/v8/test/mjsunit/es6/proxy-function-tostring.js index d859822df0..e151bf65b1 100644 --- a/deps/v8/test/mjsunit/es6/proxy-function-tostring.js +++ b/deps/v8/test/mjsunit/es6/proxy-function-tostring.js @@ -1,7 +1,6 @@ // Copyright 2018 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: --noharmony-function-tostring -assertThrows(() => new Proxy(function() {}, {}).toString(), TypeError); +assertEquals(new Proxy(function() {}, {}).toString(), + 'function () { [native code] }'); diff --git a/deps/v8/test/mjsunit/es6/string-iterator2.js b/deps/v8/test/mjsunit/es6/string-iterator2.js new file mode 100644 index 0000000000..6bfd51a815 --- /dev/null +++ b/deps/v8/test/mjsunit/es6/string-iterator2.js @@ -0,0 +1,26 @@ +// Copyright 2018 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-stress-opt + +// Tests for spreading primitive strings. + +assertEquals([...''], []); + +var str = 'ott'; +assertEquals(['o', 't', 't'], [...str]); +assertTrue(%StringIteratorProtector()); + +str[Symbol.iterator] = {}; +// Symbol.iterator can't be set on primitive strings, so it shouldn't invalidate +// the protector. +assertTrue(%StringIteratorProtector()); + +// This changes the String Iterator prototype. No more tests should be run after +// this in the same instance. +var iterator = str[Symbol.iterator](); +iterator.__proto__.next = () => ({value : undefined, done : true}); + +assertFalse(%StringIteratorProtector()); +assertEquals([], [...str]); diff --git a/deps/v8/test/mjsunit/es6/string-iterator3.js b/deps/v8/test/mjsunit/es6/string-iterator3.js new file mode 100644 index 0000000000..1b0e0273e5 --- /dev/null +++ b/deps/v8/test/mjsunit/es6/string-iterator3.js @@ -0,0 +1,20 @@ +// Copyright 2018 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-stress-opt + +// Tests for primitive strings. + +var str = 'ott'; +assertTrue(%StringIteratorProtector()); +assertEquals(['o', 't', 't'], [...str]); + +// This changes the String prototype. No more tests should be run after this in +// the same instance. +str.__proto__[Symbol.iterator] = + function() { + return {next : () => ({value : undefined, done : true})}; + }; +assertFalse(%StringIteratorProtector()); +assertEquals([], [...str]); diff --git a/deps/v8/test/mjsunit/es6/string-iterator4.js b/deps/v8/test/mjsunit/es6/string-iterator4.js new file mode 100644 index 0000000000..48c6521d3b --- /dev/null +++ b/deps/v8/test/mjsunit/es6/string-iterator4.js @@ -0,0 +1,30 @@ +// Copyright 2018 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-stress-opt + +// Tests for wrapped strings. + +var str = new String('ott'); +assertTrue(%StringIteratorProtector()); +assertEquals(['o', 't', 't'], [...str]); + +function iterator_fn() { + return {next : () => ({value : undefined, done : true})}; +}; + +str[Symbol.iterator] = iterator_fn; +// This shouldn't invalidate the protector, because it doesn't support String +// objects. +assertTrue(%StringIteratorProtector()); +assertEquals([], [...str]); + + +var str2 = new String('ott'); +assertEquals(['o', 't', 't'], [...str2]); +// This changes the String prototype. No more tests should be run after this in +// the same instance. +str2.__proto__[Symbol.iterator] = iterator_fn; +assertFalse(%StringIteratorProtector()); +assertEquals([], [...str2]); diff --git a/deps/v8/test/mjsunit/es6/string-iterator5.js b/deps/v8/test/mjsunit/es6/string-iterator5.js new file mode 100644 index 0000000000..ec9754a4bd --- /dev/null +++ b/deps/v8/test/mjsunit/es6/string-iterator5.js @@ -0,0 +1,15 @@ +// Copyright 2018 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 + +// Tests for primitive strings. + +var iterator = 'ott'[Symbol.iterator](); + +// These modifications shouldn't invalidate the String iterator protector. +iterator.__proto__.fonts = {}; +assertTrue(%StringIteratorProtector()); +iterator.__proto__[0] = 0; +assertTrue(%StringIteratorProtector()); diff --git a/deps/v8/test/mjsunit/es6/string-iterator6.js b/deps/v8/test/mjsunit/es6/string-iterator6.js new file mode 100644 index 0000000000..d1cd1f31eb --- /dev/null +++ b/deps/v8/test/mjsunit/es6/string-iterator6.js @@ -0,0 +1,11 @@ +// Copyright 2018 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-stress-opt + +assertTrue(%StringIteratorProtector()); + +delete 'ott'.__proto__[Symbol.iterator]; + +assertFalse(%StringIteratorProtector()); diff --git a/deps/v8/test/mjsunit/es6/string-iterator7.js b/deps/v8/test/mjsunit/es6/string-iterator7.js new file mode 100644 index 0000000000..387c6e81fc --- /dev/null +++ b/deps/v8/test/mjsunit/es6/string-iterator7.js @@ -0,0 +1,13 @@ +// Copyright 2018 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 + +assertTrue(%StringIteratorProtector()); + +const p = ""[Symbol.iterator]().__proto__; +let x = Object.create(p); +x.next = 42; + +assertTrue(%StringIteratorProtector()); diff --git a/deps/v8/test/mjsunit/es6/string-iterator8.js b/deps/v8/test/mjsunit/es6/string-iterator8.js new file mode 100644 index 0000000000..dbd4b7c46a --- /dev/null +++ b/deps/v8/test/mjsunit/es6/string-iterator8.js @@ -0,0 +1,14 @@ +// Copyright 2018 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 + +assertTrue(%StringIteratorProtector()); + +var proto = String.prototype; + +String.prototype = {}; + +assertEquals(proto, String.prototype); +assertTrue(%StringIteratorProtector()); diff --git a/deps/v8/test/mjsunit/es6/typedarray-construct-by-array-like.js b/deps/v8/test/mjsunit/es6/typedarray-construct-by-array-like.js index 3b57f8f644..0a55fccf5c 100644 --- a/deps/v8/test/mjsunit/es6/typedarray-construct-by-array-like.js +++ b/deps/v8/test/mjsunit/es6/typedarray-construct-by-array-like.js @@ -212,7 +212,7 @@ tests.push(function TestFromTypedArraySpeciesNeutersBuffer(constr) { }); tests.push(function TestLengthIsMaxSmi(constr) { - var myObject = { 0: 5, 1: 6, length: %_MaxSmi() + 1 }; + var myObject = { 0: 5, 1: 6, length: %MaxSmi() + 1 }; assertThrows(function() { new constr(myObject); @@ -258,7 +258,7 @@ tests.push(function TestOffsetIsUsed(constr) { }); tests.push(function TestLengthIsNonSmiNegativeNumber(constr) { - var ta = new constr({length: -%_MaxSmi() - 2}); + var ta = new constr({length: -%MaxSmi() - 2}); assertEquals(0, ta.length); }); diff --git a/deps/v8/test/mjsunit/es6/typedarray-construct-offset-not-smi.js b/deps/v8/test/mjsunit/es6/typedarray-construct-offset-not-smi.js index 0a267bc64b..e6cbcc4201 100644 --- a/deps/v8/test/mjsunit/es6/typedarray-construct-offset-not-smi.js +++ b/deps/v8/test/mjsunit/es6/typedarray-construct-offset-not-smi.js @@ -5,7 +5,7 @@ // Flags: --allow-natives-syntax --mock-arraybuffer-allocator (function TestBufferByteLengthNonSmi() { - var non_smi_byte_length = %_MaxSmi() + 1; + var non_smi_byte_length = %MaxSmi() + 1; var buffer = new ArrayBuffer(non_smi_byte_length); @@ -20,7 +20,7 @@ })(); (function TestByteOffsetNonSmi() { - var non_smi_byte_length = %_MaxSmi() + 11; + var non_smi_byte_length = %MaxSmi() + 11; var buffer = new ArrayBuffer(non_smi_byte_length); diff --git a/deps/v8/test/mjsunit/es6/typedarray-set-bytelength-not-smi.js b/deps/v8/test/mjsunit/es6/typedarray-set-bytelength-not-smi.js index 1f842878dc..e4a8c2b626 100644 --- a/deps/v8/test/mjsunit/es6/typedarray-set-bytelength-not-smi.js +++ b/deps/v8/test/mjsunit/es6/typedarray-set-bytelength-not-smi.js @@ -5,13 +5,13 @@ // Flags: --allow-natives-syntax --mock-arraybuffer-allocator (function TestBufferByteLengthNonSmi() { - const source_buffer_length = %_MaxSmi() + 1; + const source_buffer_length = %MaxSmi() + 1; const source_buffer = new ArrayBuffer(source_buffer_length); const source = new Uint16Array(source_buffer); assertEquals(source_buffer_length, source_buffer.byteLength); assertEquals(source_buffer_length / 2, source.length); - const target_buffer_length = %_MaxSmi() - 1; + const target_buffer_length = %MaxSmi() - 1; const target_buffer = new ArrayBuffer(target_buffer_length); const target = new Uint16Array(target_buffer); assertEquals(target_buffer_length, target_buffer.byteLength); diff --git a/deps/v8/test/mjsunit/es9/object-spread-ic-dontenum-transition.js b/deps/v8/test/mjsunit/es9/object-spread-ic-dontenum-transition.js new file mode 100644 index 0000000000..c403566a38 --- /dev/null +++ b/deps/v8/test/mjsunit/es9/object-spread-ic-dontenum-transition.js @@ -0,0 +1,26 @@ +// Copyright 2018 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 testMegamorphicWithDontEnumTransition() { + function spread(o) { return { ...o }; } + + // Set up transition tree + let obj = { ...{}, a: 0, b: 1, c: 2, }; + Object.defineProperty(obj, "boom", { enumerable: false, configurable: true, + writable: true }); + + // make CloneObjectIC MEGAMORPHIC + spread(new Proxy({}, {})); + + // Ensure we don't crash, and create the correct object + let result = spread({ a: 0, b: 1, c: 2, boom: 3 }); + + assertEquals({ a: 0, b: 1, c: 2, boom: 3 }, result); + assertEquals({ + enumerable: true, + writable: true, + configurable: true, + value: 3, + }, Object.getOwnPropertyDescriptor(result, "boom")); +})(); diff --git a/deps/v8/test/mjsunit/es9/object-spread-ic-multiple-transitions.js b/deps/v8/test/mjsunit/es9/object-spread-ic-multiple-transitions.js new file mode 100644 index 0000000000..f31a6d90d6 --- /dev/null +++ b/deps/v8/test/mjsunit/es9/object-spread-ic-multiple-transitions.js @@ -0,0 +1,16 @@ +// Copyright 2018 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 testMegamorphicWithNonSimpleTransitionHandler() { + function spread(o) { return { ...o }; } + + // Set up transition tree + let obj = { ...{}, a: 0, b: 1, boom: 2}; + + // make CloneObjectIC MEGAMORPHIC + spread(new Proxy({}, {})); + + // Ensure we don't crash, and create the correct object + assertEquals({ a: 0, b: 1, c: 2 }, spread({ a: 0, b: 1, c: 2 })); +})(); diff --git a/deps/v8/test/mjsunit/external-backing-store-gc.js b/deps/v8/test/mjsunit/external-backing-store-gc.js new file mode 100644 index 0000000000..005ec15e59 --- /dev/null +++ b/deps/v8/test/mjsunit/external-backing-store-gc.js @@ -0,0 +1,13 @@ +// Copyright 2018 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: --mock-arraybuffer-allocator --mock-arraybuffer-allocator-limit=1300000000 + +// --mock-arraybuffer-allocator-limit should be above the hard limit external +// for memory. Below that limit anything is opportunistic and may be delayed, +// e.g., by tasks getting stalled and the event loop not being invoked. + +for (var i = 0; i < 1536; i++) { + let garbage = new ArrayBuffer(1024*1024); +} diff --git a/deps/v8/test/mjsunit/for-in-special-cases.js b/deps/v8/test/mjsunit/for-in-special-cases.js index b592ad259e..27129e1aac 100644 --- a/deps/v8/test/mjsunit/for-in-special-cases.js +++ b/deps/v8/test/mjsunit/for-in-special-cases.js @@ -64,21 +64,15 @@ assertEquals(10, j); function Accumulate(x) { - var accumulator = ""; + var accumulator = []; for (var i in x) { - accumulator += i; + accumulator.push(i); } return accumulator; } for (var i = 0; i < 3; ++i) { - var elements = Accumulate("abcd"); - // We do not assume that for-in enumerates elements in order. - assertTrue(-1 != elements.indexOf("0")); - assertTrue(-1 != elements.indexOf("1")); - assertTrue(-1 != elements.indexOf("2")); - assertTrue(-1 != elements.indexOf("3")); - assertEquals(4, elements.length); + assertEquals(Accumulate("abcd"), ['0', '1', '2', '3']); } function for_in_string_prototype() { @@ -99,23 +93,51 @@ function for_in_string_prototype() { // If for-in returns elements in a different order on multiple calls, this // assert will fail. If that happens, consider if that behavior is OK. assertEquals(elements, elements1, "For-in elements not the same both times."); - // We do not assume that for-in enumerates elements in order. - assertTrue(-1 != elements.indexOf("0")); - assertTrue(-1 != elements.indexOf("1")); - assertTrue(-1 != elements.indexOf("2")); - assertTrue(-1 != elements.indexOf("7")); - assertTrue(-1 != elements.indexOf("foo")); - assertTrue(-1 != elements.indexOf("bar")); - assertTrue(-1 != elements.indexOf("gub")); - assertEquals(13, elements.length); - - elements = Accumulate(x); - assertTrue(-1 != elements.indexOf("0")); - assertTrue(-1 != elements.indexOf("1")); - assertTrue(-1 != elements.indexOf("2")); - assertTrue(-1 != elements.indexOf("foo")); - assertEquals(6, elements.length); + assertEquals(["7","bar","gub","0","1","2","foo"], elements) + + assertEquals(['0', '1', '2', 'foo'], Accumulate(x)) } for_in_string_prototype(); for_in_string_prototype(); + + +(function for_in_dictionary_prototype_1() { + let prototype1 = {prop: 0, prop1: 1}; + let derived1 = Object.create(null, { + prop: {enumerable: false, configurable: true, value: 0}, + }); + Object.setPrototypeOf(derived1, prototype1); + + let prototype2 = {prop: 0, prop1: 1}; + let derived2 = Object.create(prototype2, { + prop: {enumerable: false, configurable: true, value: 0}, + }); + + for (let i = 0; i < 3; i++) { + assertEquals(['prop1'], Accumulate(derived1)); + assertEquals(['prop1'], Accumulate(derived2)); + } +})(); + +(function for_in_dictionary_prototype_2() { + let prototype1 = {prop: 0, prop1: 1}; + let derived1 = Object.create(null, { + prop: {enumerable: false, configurable: true, value: 1}, + prop2: {enumerable: true, configurable: true, value: 2}, + prop3: {enumerable: false, configurable: true, value: 3}, + }); + Object.setPrototypeOf(derived1, prototype1); + + let prototype2 = {prop: 0, prop1: 1}; + let derived2 = Object.create(prototype2, { + prop: {enumerable: false, configurable: true, value: 0}, + prop2: {enumerable: true, configurable: true, value: 2}, + prop3: {enumerable: false, configurable: true, value: 3}, + }); + + for (let i = 0; i < 3; i++) { + assertEquals(['prop2', 'prop1'], Accumulate(derived1)); + assertEquals(['prop2', 'prop1'], Accumulate(derived2)); + } +})(); diff --git a/deps/v8/test/mjsunit/harmony/async-await-optimization.js b/deps/v8/test/mjsunit/harmony/async-await-optimization.js new file mode 100644 index 0000000000..b24e541916 --- /dev/null +++ b/deps/v8/test/mjsunit/harmony/async-await-optimization.js @@ -0,0 +1,124 @@ +// Copyright 2018 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-await-optimization + +// test basic interleaving +(function () { + const actual = []; + const expected = [ 'await', 1, 'await', 2 ]; + const iterations = 2; + + async function pushAwait() { + actual.push('await'); + } + + async function callAsync() { + for (let i = 0; i < iterations; i++) { + await pushAwait(); + } + return 0; + } + + function checkAssertions() { + assertArrayEquals(expected, actual, + 'Async/await and promises should be interleaved.'); + } + + assertPromiseResult((async() => { + callAsync(); + + return new Promise(function (resolve) { + actual.push(1); + resolve(); + }).then(function () { + actual.push(2); + }).then(checkAssertions); + })()); +})(); + +// test async generators +(function () { + const actual = []; + const expected = [ 'await', 1, 'await', 2 ]; + const iterations = 2; + + async function pushAwait() { + actual.push('await'); + } + + async function* callAsync() { + for (let i = 0; i < iterations; i++) { + await pushAwait(); + } + return 0; + } + + function checkAssertions() { + assertArrayEquals(expected, actual, + 'Async/await and promises should be interleaved when using async generators.'); + } + + assertPromiseResult((async() => { + callAsync().next(); + + return new Promise(function (resolve) { + actual.push(1); + resolve(); + }).then(function () { + actual.push(2); + }).then(checkAssertions); + })()); +})(); + +// test yielding from async generators +(function () { + const actual = []; + const expected = [ + 'Promise: 6', + 'Promise: 5', + 'Await: 3', + 'Promise: 4', + 'Promise: 3', + 'Await: 2', + 'Promise: 2', + 'Promise: 1', + 'Await: 1', + 'Promise: 0' + ]; + const iterations = 3; + + async function* naturalNumbers(start) { + let current = start; + while (current > 0) { + yield Promise.resolve(current--); + } + } + + async function trigger() { + for await (const num of naturalNumbers(iterations)) { + actual.push('Await: ' + num); + } + } + + async function checkAssertions() { + assertArrayEquals(expected, actual, + 'Async/await and promises should be interleaved when yielding.'); + } + + async function countdown(counter) { + actual.push('Promise: ' + counter); + if (counter > 0) { + return Promise.resolve(counter - 1).then(countdown); + } else { + await checkAssertions(); + } + } + + assertPromiseResult((async() => { + trigger(); + + return countdown(iterations * 2); + })()); +})(); diff --git a/deps/v8/test/mjsunit/harmony/atomics-notify.js b/deps/v8/test/mjsunit/harmony/atomics-notify.js new file mode 100644 index 0000000000..cf18321786 --- /dev/null +++ b/deps/v8/test/mjsunit/harmony/atomics-notify.js @@ -0,0 +1,8 @@ +// Copyright 2018 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-sharedarraybuffer + +// This test needs to be killed if we remove Atomics.wake. +assertNotSame(Atomics.wake, Atomics.notify); diff --git a/deps/v8/test/mjsunit/harmony/atomics-value-check.js b/deps/v8/test/mjsunit/harmony/atomics-value-check.js index b953863daf..053bc6dfc5 100644 --- a/deps/v8/test/mjsunit/harmony/atomics-value-check.js +++ b/deps/v8/test/mjsunit/harmony/atomics-value-check.js @@ -12,7 +12,7 @@ var workerScript = `onmessage=function(msg) { postMessage(0); };`; -var worker = new Worker(workerScript); +var worker = new Worker(workerScript, {type: 'string'}); var value_obj = { valueOf: function() {worker.postMessage({sab:sab}, [sta.buffer]); diff --git a/deps/v8/test/mjsunit/harmony/bigint/add.js b/deps/v8/test/mjsunit/harmony/bigint/add.js index 5e986b3726..791db6a3b9 100644 --- a/deps/v8/test/mjsunit/harmony/bigint/add.js +++ b/deps/v8/test/mjsunit/harmony/bigint/add.js @@ -4,8 +4,6 @@ // Generated by tools/bigint-tester.py. -// Flags: --harmony-bigint - var data = [{ a: -0xc4043e2c4cc49e4d6870103ce7c2ff2d512bf4b1b67553ba410db514ee0af8888ad6cfn, b: 0x2aae86de73ff479133a657a40d26e8dcf192019c7421836615ec34978bad93n, diff --git a/deps/v8/test/mjsunit/harmony/bigint/and.js b/deps/v8/test/mjsunit/harmony/bigint/and.js index 7a68f8b3dc..a90ec22f51 100644 --- a/deps/v8/test/mjsunit/harmony/bigint/and.js +++ b/deps/v8/test/mjsunit/harmony/bigint/and.js @@ -4,8 +4,6 @@ // Generated by tools/bigint-tester.py. -// Flags: --harmony-bigint - var data = [{ a: 0x9252b94f220ded0c18706998886397699c5a25527575dn, b: -0x286817ba2e8fd8n, diff --git a/deps/v8/test/mjsunit/harmony/bigint/as-int-n.js b/deps/v8/test/mjsunit/harmony/bigint/as-int-n.js index 51b5073d24..154a0929e5 100644 --- a/deps/v8/test/mjsunit/harmony/bigint/as-int-n.js +++ b/deps/v8/test/mjsunit/harmony/bigint/as-int-n.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-bigint - // BigInt.asIntN { assertEquals(2, BigInt.asIntN.length); diff --git a/deps/v8/test/mjsunit/harmony/bigint/basics.js b/deps/v8/test/mjsunit/harmony/bigint/basics.js index b6318d5324..0368c69b52 100644 --- a/deps/v8/test/mjsunit/harmony/bigint/basics.js +++ b/deps/v8/test/mjsunit/harmony/bigint/basics.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 --harmony-bigint +// Flags: --allow-natives-syntax 'use strict' diff --git a/deps/v8/test/mjsunit/harmony/bigint/comparisons.js b/deps/v8/test/mjsunit/harmony/bigint/comparisons.js index 73eb24d687..abc7a8082a 100644 --- a/deps/v8/test/mjsunit/harmony/bigint/comparisons.js +++ b/deps/v8/test/mjsunit/harmony/bigint/comparisons.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 --harmony-bigint +// Flags: --allow-natives-syntax 'use strict' @@ -297,18 +297,6 @@ const six = BigInt(6); assertTrue(Reflect.defineProperty(obj, 'foo', {value: zero})); assertTrue(Reflect.defineProperty(obj, 'foo', {value: another_zero})); assertFalse(Reflect.defineProperty(obj, 'foo', {value: one})); -}{ - assertTrue(%SameValue(zero, zero)); - assertTrue(%SameValue(zero, another_zero)); - - assertFalse(%SameValue(zero, +0)); - assertFalse(%SameValue(zero, -0)); - - assertFalse(%SameValue(+0, zero)); - assertFalse(%SameValue(-0, zero)); - - assertTrue(%SameValue(one, one)); - assertTrue(%SameValue(one, another_one)); } // SameValueZero @@ -351,18 +339,6 @@ const six = BigInt(6); assertTrue(new Map([[one, 42]]).has(one)); assertTrue(new Map([[one, 42]]).has(another_one)); -}{ - assertTrue(%SameValueZero(zero, zero)); - assertTrue(%SameValueZero(zero, another_zero)); - - assertFalse(%SameValueZero(zero, +0)); - assertFalse(%SameValueZero(zero, -0)); - - assertFalse(%SameValueZero(+0, zero)); - assertFalse(%SameValueZero(-0, zero)); - - assertTrue(%SameValueZero(one, one)); - assertTrue(%SameValueZero(one, another_one)); } // Abstract comparison diff --git a/deps/v8/test/mjsunit/harmony/bigint/dataview.js b/deps/v8/test/mjsunit/harmony/bigint/dataview.js index 5ead649909..bad56d2b69 100644 --- a/deps/v8/test/mjsunit/harmony/bigint/dataview.js +++ b/deps/v8/test/mjsunit/harmony/bigint/dataview.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-bigint - var buffer = new ArrayBuffer(64); var dataview = new DataView(buffer, 8, 24); var bytes = new Uint8Array(buffer); diff --git a/deps/v8/test/mjsunit/harmony/bigint/dec.js b/deps/v8/test/mjsunit/harmony/bigint/dec.js index ddb0431cba..36ca2193de 100644 --- a/deps/v8/test/mjsunit/harmony/bigint/dec.js +++ b/deps/v8/test/mjsunit/harmony/bigint/dec.js @@ -4,8 +4,6 @@ // Generated by tools/bigint-tester.py. -// Flags: --harmony-bigint - var data = [{ a: 0x26ffcdbd233a53e7ca4612f2b02e1f2c1d885c3177e7n, r: 0x26ffcdbd233a53e7ca4612f2b02e1f2c1d885c3177e6n diff --git a/deps/v8/test/mjsunit/harmony/bigint/div.js b/deps/v8/test/mjsunit/harmony/bigint/div.js index 1eeea1184f..8b167140de 100644 --- a/deps/v8/test/mjsunit/harmony/bigint/div.js +++ b/deps/v8/test/mjsunit/harmony/bigint/div.js @@ -4,8 +4,6 @@ // Generated by tools/bigint-tester.py. -// Flags: --harmony-bigint - var data = [{ a: -0x1e0f357314bac34227333c0c2086430dae88cb538f161174888591n, b: 0x390n, diff --git a/deps/v8/test/mjsunit/harmony/bigint/exp.js b/deps/v8/test/mjsunit/harmony/bigint/exp.js index 54d5849373..7fbc2dc402 100644 --- a/deps/v8/test/mjsunit/harmony/bigint/exp.js +++ b/deps/v8/test/mjsunit/harmony/bigint/exp.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 --harmony-bigint +// Flags: --allow-natives-syntax assertEquals(1n, (-1n) ** 0n); assertEquals(-1n, (-1n) ** 1n); diff --git a/deps/v8/test/mjsunit/harmony/bigint/inc.js b/deps/v8/test/mjsunit/harmony/bigint/inc.js index 4ead89e1bf..7842600393 100644 --- a/deps/v8/test/mjsunit/harmony/bigint/inc.js +++ b/deps/v8/test/mjsunit/harmony/bigint/inc.js @@ -4,8 +4,6 @@ // Generated by tools/bigint-tester.py. -// Flags: --harmony-bigint - var data = [{ a: 0xb3df90n, r: 0xb3df91n diff --git a/deps/v8/test/mjsunit/harmony/bigint/json.js b/deps/v8/test/mjsunit/harmony/bigint/json.js index eb0eefc4bb..cf392234c5 100644 --- a/deps/v8/test/mjsunit/harmony/bigint/json.js +++ b/deps/v8/test/mjsunit/harmony/bigint/json.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 --harmony-bigint +// Flags: --allow-natives-syntax 'use strict' diff --git a/deps/v8/test/mjsunit/harmony/bigint/mod.js b/deps/v8/test/mjsunit/harmony/bigint/mod.js index c8cc7fa4fd..01f64ad4ca 100644 --- a/deps/v8/test/mjsunit/harmony/bigint/mod.js +++ b/deps/v8/test/mjsunit/harmony/bigint/mod.js @@ -4,8 +4,6 @@ // Generated by tools/bigint-tester.py. -// Flags: --harmony-bigint - var data = [{ a: 0xaed3c714bb42a73d708bcf1dc9a9deebadc913ef42bac6a6178a60n, b: -0xf3d6bd1c059b79n, diff --git a/deps/v8/test/mjsunit/harmony/bigint/mul.js b/deps/v8/test/mjsunit/harmony/bigint/mul.js index c6a9ae6148..77c3a1c9bb 100644 --- a/deps/v8/test/mjsunit/harmony/bigint/mul.js +++ b/deps/v8/test/mjsunit/harmony/bigint/mul.js @@ -4,8 +4,6 @@ // Generated by tools/bigint-tester.py. -// Flags: --harmony-bigint - var data = [{ a: 0x2bf1f236c2df29f7c99be052dfe1b69ae158d777fea487af889f6259f472c0n, b: -0xae0090dfn, diff --git a/deps/v8/test/mjsunit/harmony/bigint/neg.js b/deps/v8/test/mjsunit/harmony/bigint/neg.js index 2fedf297a5..15b2fb4ee0 100644 --- a/deps/v8/test/mjsunit/harmony/bigint/neg.js +++ b/deps/v8/test/mjsunit/harmony/bigint/neg.js @@ -4,8 +4,6 @@ // Generated by tools/bigint-tester.py. -// Flags: --harmony-bigint - var data = [{ a: 0xcn, r: -0xcn diff --git a/deps/v8/test/mjsunit/harmony/bigint/not.js b/deps/v8/test/mjsunit/harmony/bigint/not.js index 6b4b2eb713..27b6a78ba6 100644 --- a/deps/v8/test/mjsunit/harmony/bigint/not.js +++ b/deps/v8/test/mjsunit/harmony/bigint/not.js @@ -4,8 +4,6 @@ // Generated by tools/bigint-tester.py. -// Flags: --harmony-bigint - var data = [{ a: 0x9f0305cd75e4n, r: -0x9f0305cd75e5n diff --git a/deps/v8/test/mjsunit/harmony/bigint/or.js b/deps/v8/test/mjsunit/harmony/bigint/or.js index c378e141cd..3203258c21 100644 --- a/deps/v8/test/mjsunit/harmony/bigint/or.js +++ b/deps/v8/test/mjsunit/harmony/bigint/or.js @@ -4,8 +4,6 @@ // Generated by tools/bigint-tester.py. -// Flags: --harmony-bigint - var data = [{ a: 0x77a87n, b: 0xde08e7433fb9584911b8cb4bc7eed802299b4489fc635974d063847da4e8b461df5dn, diff --git a/deps/v8/test/mjsunit/harmony/bigint/regress-tonumbercode.js b/deps/v8/test/mjsunit/harmony/bigint/regress-tonumbercode.js index 4dedf4d27c..3bf0148c95 100644 --- a/deps/v8/test/mjsunit/harmony/bigint/regress-tonumbercode.js +++ b/deps/v8/test/mjsunit/harmony/bigint/regress-tonumbercode.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 --harmony-bigint +// Flags: --allow-natives-syntax function f(x, b) { if (b) return Math.trunc(+(x)) diff --git a/deps/v8/test/mjsunit/harmony/bigint/regressions.js b/deps/v8/test/mjsunit/harmony/bigint/regressions.js index c1df45a1b1..8e13622eab 100644 --- a/deps/v8/test/mjsunit/harmony/bigint/regressions.js +++ b/deps/v8/test/mjsunit/harmony/bigint/regressions.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-bigint - var a = 5n; var b = a / -1n; assertEquals(5n, a); diff --git a/deps/v8/test/mjsunit/harmony/bigint/sar.js b/deps/v8/test/mjsunit/harmony/bigint/sar.js index f66115dcb6..66d2f2d268 100644 --- a/deps/v8/test/mjsunit/harmony/bigint/sar.js +++ b/deps/v8/test/mjsunit/harmony/bigint/sar.js @@ -4,8 +4,6 @@ // Generated by tools/bigint-tester.py. -// Flags: --harmony-bigint - var data = [{ a: 0x211a34fn, b: 0xa6n, diff --git a/deps/v8/test/mjsunit/harmony/bigint/shl.js b/deps/v8/test/mjsunit/harmony/bigint/shl.js index bedd785b54..0e7b402bc1 100644 --- a/deps/v8/test/mjsunit/harmony/bigint/shl.js +++ b/deps/v8/test/mjsunit/harmony/bigint/shl.js @@ -4,8 +4,6 @@ // Generated by tools/bigint-tester.py. -// Flags: --harmony-bigint - var data = [{ a: -0xe813d76adc0a177778c0c232c595e8572b783210f4a7009d7c1787n, b: 0x9en, diff --git a/deps/v8/test/mjsunit/harmony/bigint/sub.js b/deps/v8/test/mjsunit/harmony/bigint/sub.js index a1ff9b4bb3..21613f768a 100644 --- a/deps/v8/test/mjsunit/harmony/bigint/sub.js +++ b/deps/v8/test/mjsunit/harmony/bigint/sub.js @@ -4,8 +4,6 @@ // Generated by tools/bigint-tester.py. -// Flags: --harmony-bigint - var data = [{ a: 0xc4fd438551d58edn, b: 0x91b42ee55a50d974an, diff --git a/deps/v8/test/mjsunit/harmony/bigint/tonumber.js b/deps/v8/test/mjsunit/harmony/bigint/tonumber.js index d59e8429b8..a6f7d13b7e 100644 --- a/deps/v8/test/mjsunit/harmony/bigint/tonumber.js +++ b/deps/v8/test/mjsunit/harmony/bigint/tonumber.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-bigint - function Check(bigint, number_string) { var number = Number(bigint); if (number_string.substring(0, 2) === "0x") { diff --git a/deps/v8/test/mjsunit/harmony/bigint/turbo.js b/deps/v8/test/mjsunit/harmony/bigint/turbo.js index 4ce4880f3d..d0f00050c8 100644 --- a/deps/v8/test/mjsunit/harmony/bigint/turbo.js +++ b/deps/v8/test/mjsunit/harmony/bigint/turbo.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 --harmony-bigint +// Flags: --allow-natives-syntax 'use strict' diff --git a/deps/v8/test/mjsunit/harmony/bigint/typedarray.js b/deps/v8/test/mjsunit/harmony/bigint/typedarray.js index 29713b8a20..e530441dd4 100644 --- a/deps/v8/test/mjsunit/harmony/bigint/typedarray.js +++ b/deps/v8/test/mjsunit/harmony/bigint/typedarray.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: --harmony-bigint --allow-natives-syntax +// Flags: --allow-natives-syntax var intarray = new BigInt64Array(8); var uintarray = new BigUint64Array(8); diff --git a/deps/v8/test/mjsunit/harmony/bigint/xor.js b/deps/v8/test/mjsunit/harmony/bigint/xor.js index a934825bd9..cf32b65603 100644 --- a/deps/v8/test/mjsunit/harmony/bigint/xor.js +++ b/deps/v8/test/mjsunit/harmony/bigint/xor.js @@ -4,8 +4,6 @@ // Generated by tools/bigint-tester.py. -// Flags: --harmony-bigint - var data = [{ a: -0x46505bec40d461c595b5e4be178b7d00n, b: -0x9170e5437d4e3ec7c0971e2c6d3bbbd2929ff108ea4ee64f7a91aa367fn, diff --git a/deps/v8/test/mjsunit/harmony/bigintarray-keyedstore-tobigint.js b/deps/v8/test/mjsunit/harmony/bigintarray-keyedstore-tobigint.js index 29b44472c9..18ba0ff171 100644 --- a/deps/v8/test/mjsunit/harmony/bigintarray-keyedstore-tobigint.js +++ b/deps/v8/test/mjsunit/harmony/bigintarray-keyedstore-tobigint.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-bigint - let TypedArrayConstructors = [ BigUint64Array, BigInt64Array, diff --git a/deps/v8/test/mjsunit/harmony/function-tostring.js b/deps/v8/test/mjsunit/harmony/function-tostring.js index 4a7e93cd3b..2af14f16cf 100644 --- a/deps/v8/test/mjsunit/harmony/function-tostring.js +++ b/deps/v8/test/mjsunit/harmony/function-tostring.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-function-tostring - var prefix = "/*before*/"; var suffix = "/*after*/"; diff --git a/deps/v8/test/mjsunit/harmony/futex.js b/deps/v8/test/mjsunit/harmony/futex.js index 394b4ddaf0..188832cf3c 100644 --- a/deps/v8/test/mjsunit/harmony/futex.js +++ b/deps/v8/test/mjsunit/harmony/futex.js @@ -133,7 +133,7 @@ if (this.Worker) { postMessage(result); };`; - var worker = new Worker(workerScript); + var worker = new Worker(workerScript, {type: 'string'}); worker.postMessage({sab: sab, offset: offset}); // Spin until the worker is waiting on the futex. @@ -143,7 +143,7 @@ if (this.Worker) { assertEquals("ok", worker.getMessage()); worker.terminate(); - var worker2 = new Worker(workerScript); + var worker2 = new Worker(workerScript, {type: 'string'}); var offset = 8; var i32a2 = new Int32Array(sab, offset); worker2.postMessage({sab: sab, offset: offset}); @@ -156,7 +156,7 @@ if (this.Worker) { // Futex should work when index and buffer views are different, but // the real address is the same. - var worker3 = new Worker(workerScript); + var worker3 = new Worker(workerScript, {type: 'string'}); i32a2 = new Int32Array(sab, 4); worker3.postMessage({sab: sab, offset: 8}); @@ -205,7 +205,7 @@ if (this.Worker) { var id; var workers = []; for (id = 0; id < 4; id++) { - workers[id] = new Worker(workerScript); + workers[id] = new Worker(workerScript, {type: 'string'}); workers[id].postMessage({sab: sab, id: id}); } diff --git a/deps/v8/test/mjsunit/harmony/global.js b/deps/v8/test/mjsunit/harmony/global.js index 733b95312b..3d43864c47 100644 --- a/deps/v8/test/mjsunit/harmony/global.js +++ b/deps/v8/test/mjsunit/harmony/global.js @@ -13,7 +13,7 @@ assertEquals(globalThis.globalThis.globalThis.globalThis, this); { const realm = Realm.create(); assertEquals(Realm.global(realm), Realm.eval(realm, 'globalThis')); - assertTrue(Realm.global(realm) !== globalThis); + assertNotEquals(Realm.global(realm), globalThis); } { diff --git a/deps/v8/test/mjsunit/harmony/modules-import-13.js b/deps/v8/test/mjsunit/harmony/modules-import-13.js index 40016246f0..1cec1cce61 100644 --- a/deps/v8/test/mjsunit/harmony/modules-import-13.js +++ b/deps/v8/test/mjsunit/harmony/modules-import-13.js @@ -3,6 +3,7 @@ // found in the LICENSE file. // Flags: --allow-natives-syntax --harmony-dynamic-import +// Resources: test/mjsunit/harmony/modules-skip-1.js ran = false; async function test1() { diff --git a/deps/v8/test/mjsunit/harmony/regexp-property-emoji-flag-sequence-generated.js b/deps/v8/test/mjsunit/harmony/regexp-property-emoji-flag-sequence-generated.js new file mode 100644 index 0000000000..e033c722c7 --- /dev/null +++ b/deps/v8/test/mjsunit/harmony/regexp-property-emoji-flag-sequence-generated.js @@ -0,0 +1,266 @@ +// Copyright 2018 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-sequence + +const re = /\p{Emoji_Flag_Sequence}/u; + +assertTrue(re.test('\u{1F1E6}\u{1F1E8}')); +assertTrue(re.test('\u{1F1FF}\u{1F1FC}')); +assertTrue(re.test('\u{1F1E6}\u{1F1EA}')); +assertTrue(re.test('\u{1F1E6}\u{1F1EB}')); +assertTrue(re.test('\u{1F1E6}\u{1F1EC}')); +assertTrue(re.test('\u{1F1E6}\u{1F1EE}')); +assertTrue(re.test('\u{1F1E6}\u{1F1F1}')); +assertTrue(re.test('\u{1F1E6}\u{1F1F2}')); +assertTrue(re.test('\u{1F1E6}\u{1F1F4}')); +assertTrue(re.test('\u{1F1E6}\u{1F1F6}')); +assertTrue(re.test('\u{1F1E6}\u{1F1F7}')); +assertTrue(re.test('\u{1F1E6}\u{1F1F8}')); +assertTrue(re.test('\u{1F1E6}\u{1F1F9}')); +assertTrue(re.test('\u{1F1E6}\u{1F1FA}')); +assertTrue(re.test('\u{1F1E6}\u{1F1FC}')); +assertTrue(re.test('\u{1F1E6}\u{1F1FD}')); +assertTrue(re.test('\u{1F1E6}\u{1F1FF}')); +assertTrue(re.test('\u{1F1E7}\u{1F1E6}')); +assertTrue(re.test('\u{1F1E7}\u{1F1E7}')); +assertTrue(re.test('\u{1F1E7}\u{1F1E9}')); +assertTrue(re.test('\u{1F1E7}\u{1F1EA}')); +assertTrue(re.test('\u{1F1E7}\u{1F1EB}')); +assertTrue(re.test('\u{1F1E7}\u{1F1EC}')); +assertTrue(re.test('\u{1F1E7}\u{1F1ED}')); +assertTrue(re.test('\u{1F1E7}\u{1F1EE}')); +assertTrue(re.test('\u{1F1E7}\u{1F1EF}')); +assertTrue(re.test('\u{1F1E7}\u{1F1F1}')); +assertTrue(re.test('\u{1F1E7}\u{1F1F2}')); +assertTrue(re.test('\u{1F1E7}\u{1F1F3}')); +assertTrue(re.test('\u{1F1E7}\u{1F1F4}')); +assertTrue(re.test('\u{1F1E7}\u{1F1F6}')); +assertTrue(re.test('\u{1F1E7}\u{1F1F7}')); +assertTrue(re.test('\u{1F1E7}\u{1F1F8}')); +assertTrue(re.test('\u{1F1E7}\u{1F1F9}')); +assertTrue(re.test('\u{1F1E7}\u{1F1FB}')); +assertTrue(re.test('\u{1F1E7}\u{1F1FC}')); +assertTrue(re.test('\u{1F1E7}\u{1F1FE}')); +assertTrue(re.test('\u{1F1E7}\u{1F1FF}')); +assertTrue(re.test('\u{1F1E8}\u{1F1E6}')); +assertTrue(re.test('\u{1F1E8}\u{1F1E8}')); +assertTrue(re.test('\u{1F1E8}\u{1F1E9}')); +assertTrue(re.test('\u{1F1E8}\u{1F1EB}')); +assertTrue(re.test('\u{1F1E8}\u{1F1EC}')); +assertTrue(re.test('\u{1F1E8}\u{1F1ED}')); +assertTrue(re.test('\u{1F1E8}\u{1F1EE}')); +assertTrue(re.test('\u{1F1E8}\u{1F1F0}')); +assertTrue(re.test('\u{1F1E8}\u{1F1F1}')); +assertTrue(re.test('\u{1F1E8}\u{1F1F2}')); +assertTrue(re.test('\u{1F1E8}\u{1F1F3}')); +assertTrue(re.test('\u{1F1E8}\u{1F1F4}')); +assertTrue(re.test('\u{1F1E8}\u{1F1F5}')); +assertTrue(re.test('\u{1F1E8}\u{1F1F7}')); +assertTrue(re.test('\u{1F1E8}\u{1F1FA}')); +assertTrue(re.test('\u{1F1E8}\u{1F1FB}')); +assertTrue(re.test('\u{1F1E8}\u{1F1FC}')); +assertTrue(re.test('\u{1F1E8}\u{1F1FD}')); +assertTrue(re.test('\u{1F1E8}\u{1F1FE}')); +assertTrue(re.test('\u{1F1E8}\u{1F1FF}')); +assertTrue(re.test('\u{1F1E9}\u{1F1EA}')); +assertTrue(re.test('\u{1F1E9}\u{1F1EC}')); +assertTrue(re.test('\u{1F1E9}\u{1F1EF}')); +assertTrue(re.test('\u{1F1E9}\u{1F1F0}')); +assertTrue(re.test('\u{1F1E9}\u{1F1F2}')); +assertTrue(re.test('\u{1F1E9}\u{1F1F4}')); +assertTrue(re.test('\u{1F1E9}\u{1F1FF}')); +assertTrue(re.test('\u{1F1EA}\u{1F1E6}')); +assertTrue(re.test('\u{1F1EA}\u{1F1E8}')); +assertTrue(re.test('\u{1F1EA}\u{1F1EA}')); +assertTrue(re.test('\u{1F1EA}\u{1F1EC}')); +assertTrue(re.test('\u{1F1EA}\u{1F1ED}')); +assertTrue(re.test('\u{1F1EA}\u{1F1F7}')); +assertTrue(re.test('\u{1F1EA}\u{1F1F8}')); +assertTrue(re.test('\u{1F1EA}\u{1F1F9}')); +assertTrue(re.test('\u{1F1EA}\u{1F1FA}')); +assertTrue(re.test('\u{1F1EB}\u{1F1EE}')); +assertTrue(re.test('\u{1F1EB}\u{1F1EF}')); +assertTrue(re.test('\u{1F1EB}\u{1F1F0}')); +assertTrue(re.test('\u{1F1EB}\u{1F1F2}')); +assertTrue(re.test('\u{1F1EB}\u{1F1F4}')); +assertTrue(re.test('\u{1F1EB}\u{1F1F7}')); +assertTrue(re.test('\u{1F1EC}\u{1F1E6}')); +assertTrue(re.test('\u{1F1EC}\u{1F1E7}')); +assertTrue(re.test('\u{1F1EC}\u{1F1E9}')); +assertTrue(re.test('\u{1F1EC}\u{1F1EA}')); +assertTrue(re.test('\u{1F1EC}\u{1F1EB}')); +assertTrue(re.test('\u{1F1EC}\u{1F1EC}')); +assertTrue(re.test('\u{1F1EC}\u{1F1ED}')); +assertTrue(re.test('\u{1F1EC}\u{1F1EE}')); +assertTrue(re.test('\u{1F1EC}\u{1F1F1}')); +assertTrue(re.test('\u{1F1EC}\u{1F1F2}')); +assertTrue(re.test('\u{1F1EC}\u{1F1F3}')); +assertTrue(re.test('\u{1F1EC}\u{1F1F5}')); +assertTrue(re.test('\u{1F1EC}\u{1F1F6}')); +assertTrue(re.test('\u{1F1EC}\u{1F1F7}')); +assertTrue(re.test('\u{1F1EC}\u{1F1F8}')); +assertTrue(re.test('\u{1F1EC}\u{1F1F9}')); +assertTrue(re.test('\u{1F1EC}\u{1F1FA}')); +assertTrue(re.test('\u{1F1EC}\u{1F1FC}')); +assertTrue(re.test('\u{1F1EC}\u{1F1FE}')); +assertTrue(re.test('\u{1F1ED}\u{1F1F0}')); +assertTrue(re.test('\u{1F1ED}\u{1F1F2}')); +assertTrue(re.test('\u{1F1ED}\u{1F1F3}')); +assertTrue(re.test('\u{1F1ED}\u{1F1F7}')); +assertTrue(re.test('\u{1F1ED}\u{1F1F9}')); +assertTrue(re.test('\u{1F1ED}\u{1F1FA}')); +assertTrue(re.test('\u{1F1EE}\u{1F1E8}')); +assertTrue(re.test('\u{1F1EE}\u{1F1E9}')); +assertTrue(re.test('\u{1F1EE}\u{1F1EA}')); +assertTrue(re.test('\u{1F1EE}\u{1F1F1}')); +assertTrue(re.test('\u{1F1EE}\u{1F1F2}')); +assertTrue(re.test('\u{1F1EE}\u{1F1F3}')); +assertTrue(re.test('\u{1F1EE}\u{1F1F4}')); +assertTrue(re.test('\u{1F1EE}\u{1F1F6}')); +assertTrue(re.test('\u{1F1EE}\u{1F1F7}')); +assertTrue(re.test('\u{1F1EE}\u{1F1F8}')); +assertTrue(re.test('\u{1F1EE}\u{1F1F9}')); +assertTrue(re.test('\u{1F1EF}\u{1F1EA}')); +assertTrue(re.test('\u{1F1EF}\u{1F1F2}')); +assertTrue(re.test('\u{1F1EF}\u{1F1F4}')); +assertTrue(re.test('\u{1F1EF}\u{1F1F5}')); +assertTrue(re.test('\u{1F1F0}\u{1F1EA}')); +assertTrue(re.test('\u{1F1F0}\u{1F1EC}')); +assertTrue(re.test('\u{1F1F0}\u{1F1ED}')); +assertTrue(re.test('\u{1F1F0}\u{1F1EE}')); +assertTrue(re.test('\u{1F1F0}\u{1F1F2}')); +assertTrue(re.test('\u{1F1F0}\u{1F1F3}')); +assertTrue(re.test('\u{1F1F0}\u{1F1F5}')); +assertTrue(re.test('\u{1F1F0}\u{1F1F7}')); +assertTrue(re.test('\u{1F1F0}\u{1F1FC}')); +assertTrue(re.test('\u{1F1E6}\u{1F1E9}')); +assertTrue(re.test('\u{1F1F0}\u{1F1FF}')); +assertTrue(re.test('\u{1F1F1}\u{1F1E6}')); +assertTrue(re.test('\u{1F1F1}\u{1F1E7}')); +assertTrue(re.test('\u{1F1F1}\u{1F1E8}')); +assertTrue(re.test('\u{1F1F1}\u{1F1EE}')); +assertTrue(re.test('\u{1F1F1}\u{1F1F0}')); +assertTrue(re.test('\u{1F1F1}\u{1F1F7}')); +assertTrue(re.test('\u{1F1F1}\u{1F1F8}')); +assertTrue(re.test('\u{1F1F1}\u{1F1F9}')); +assertTrue(re.test('\u{1F1F1}\u{1F1FA}')); +assertTrue(re.test('\u{1F1F1}\u{1F1FB}')); +assertTrue(re.test('\u{1F1F1}\u{1F1FE}')); +assertTrue(re.test('\u{1F1F2}\u{1F1E6}')); +assertTrue(re.test('\u{1F1F2}\u{1F1E8}')); +assertTrue(re.test('\u{1F1F2}\u{1F1E9}')); +assertTrue(re.test('\u{1F1F2}\u{1F1EA}')); +assertTrue(re.test('\u{1F1F2}\u{1F1EB}')); +assertTrue(re.test('\u{1F1F2}\u{1F1EC}')); +assertTrue(re.test('\u{1F1F2}\u{1F1ED}')); +assertTrue(re.test('\u{1F1F2}\u{1F1F0}')); +assertTrue(re.test('\u{1F1F2}\u{1F1F1}')); +assertTrue(re.test('\u{1F1F2}\u{1F1F2}')); +assertTrue(re.test('\u{1F1F2}\u{1F1F3}')); +assertTrue(re.test('\u{1F1F2}\u{1F1F4}')); +assertTrue(re.test('\u{1F1F2}\u{1F1F5}')); +assertTrue(re.test('\u{1F1F2}\u{1F1F6}')); +assertTrue(re.test('\u{1F1F2}\u{1F1F7}')); +assertTrue(re.test('\u{1F1F2}\u{1F1F8}')); +assertTrue(re.test('\u{1F1F2}\u{1F1F9}')); +assertTrue(re.test('\u{1F1F2}\u{1F1FA}')); +assertTrue(re.test('\u{1F1F2}\u{1F1FB}')); +assertTrue(re.test('\u{1F1F2}\u{1F1FC}')); +assertTrue(re.test('\u{1F1F2}\u{1F1FD}')); +assertTrue(re.test('\u{1F1F2}\u{1F1FE}')); +assertTrue(re.test('\u{1F1F2}\u{1F1FF}')); +assertTrue(re.test('\u{1F1F3}\u{1F1E6}')); +assertTrue(re.test('\u{1F1F3}\u{1F1E8}')); +assertTrue(re.test('\u{1F1F3}\u{1F1EA}')); +assertTrue(re.test('\u{1F1F3}\u{1F1EB}')); +assertTrue(re.test('\u{1F1F3}\u{1F1EC}')); +assertTrue(re.test('\u{1F1F3}\u{1F1EE}')); +assertTrue(re.test('\u{1F1F3}\u{1F1F1}')); +assertTrue(re.test('\u{1F1F3}\u{1F1F4}')); +assertTrue(re.test('\u{1F1F3}\u{1F1F5}')); +assertTrue(re.test('\u{1F1F3}\u{1F1F7}')); +assertTrue(re.test('\u{1F1F3}\u{1F1FA}')); +assertTrue(re.test('\u{1F1F3}\u{1F1FF}')); +assertTrue(re.test('\u{1F1F4}\u{1F1F2}')); +assertTrue(re.test('\u{1F1F5}\u{1F1E6}')); +assertTrue(re.test('\u{1F1F5}\u{1F1EA}')); +assertTrue(re.test('\u{1F1F5}\u{1F1EB}')); +assertTrue(re.test('\u{1F1F5}\u{1F1EC}')); +assertTrue(re.test('\u{1F1F5}\u{1F1ED}')); +assertTrue(re.test('\u{1F1F5}\u{1F1F0}')); +assertTrue(re.test('\u{1F1F5}\u{1F1F1}')); +assertTrue(re.test('\u{1F1F5}\u{1F1F2}')); +assertTrue(re.test('\u{1F1F5}\u{1F1F3}')); +assertTrue(re.test('\u{1F1F5}\u{1F1F7}')); +assertTrue(re.test('\u{1F1F5}\u{1F1F8}')); +assertTrue(re.test('\u{1F1F5}\u{1F1F9}')); +assertTrue(re.test('\u{1F1F5}\u{1F1FC}')); +assertTrue(re.test('\u{1F1F5}\u{1F1FE}')); +assertTrue(re.test('\u{1F1F6}\u{1F1E6}')); +assertTrue(re.test('\u{1F1F7}\u{1F1EA}')); +assertTrue(re.test('\u{1F1F7}\u{1F1F4}')); +assertTrue(re.test('\u{1F1F7}\u{1F1F8}')); +assertTrue(re.test('\u{1F1F7}\u{1F1FA}')); +assertTrue(re.test('\u{1F1F7}\u{1F1FC}')); +assertTrue(re.test('\u{1F1F8}\u{1F1E6}')); +assertTrue(re.test('\u{1F1F8}\u{1F1E7}')); +assertTrue(re.test('\u{1F1F8}\u{1F1E8}')); +assertTrue(re.test('\u{1F1F8}\u{1F1E9}')); +assertTrue(re.test('\u{1F1F8}\u{1F1EA}')); +assertTrue(re.test('\u{1F1F8}\u{1F1EC}')); +assertTrue(re.test('\u{1F1F8}\u{1F1ED}')); +assertTrue(re.test('\u{1F1F8}\u{1F1EE}')); +assertTrue(re.test('\u{1F1F8}\u{1F1EF}')); +assertTrue(re.test('\u{1F1F8}\u{1F1F0}')); +assertTrue(re.test('\u{1F1F8}\u{1F1F1}')); +assertTrue(re.test('\u{1F1F8}\u{1F1F2}')); +assertTrue(re.test('\u{1F1F8}\u{1F1F3}')); +assertTrue(re.test('\u{1F1F8}\u{1F1F4}')); +assertTrue(re.test('\u{1F1F8}\u{1F1F7}')); +assertTrue(re.test('\u{1F1F8}\u{1F1F8}')); +assertTrue(re.test('\u{1F1F8}\u{1F1F9}')); +assertTrue(re.test('\u{1F1F8}\u{1F1FB}')); +assertTrue(re.test('\u{1F1F8}\u{1F1FD}')); +assertTrue(re.test('\u{1F1F8}\u{1F1FE}')); +assertTrue(re.test('\u{1F1F8}\u{1F1FF}')); +assertTrue(re.test('\u{1F1F9}\u{1F1E6}')); +assertTrue(re.test('\u{1F1F9}\u{1F1E8}')); +assertTrue(re.test('\u{1F1F9}\u{1F1E9}')); +assertTrue(re.test('\u{1F1F9}\u{1F1EB}')); +assertTrue(re.test('\u{1F1F9}\u{1F1EC}')); +assertTrue(re.test('\u{1F1F9}\u{1F1ED}')); +assertTrue(re.test('\u{1F1F9}\u{1F1EF}')); +assertTrue(re.test('\u{1F1F9}\u{1F1F0}')); +assertTrue(re.test('\u{1F1F9}\u{1F1F1}')); +assertTrue(re.test('\u{1F1F9}\u{1F1F2}')); +assertTrue(re.test('\u{1F1F9}\u{1F1F3}')); +assertTrue(re.test('\u{1F1F9}\u{1F1F4}')); +assertTrue(re.test('\u{1F1F9}\u{1F1F7}')); +assertTrue(re.test('\u{1F1F9}\u{1F1F9}')); +assertTrue(re.test('\u{1F1F9}\u{1F1FB}')); +assertTrue(re.test('\u{1F1F9}\u{1F1FC}')); +assertTrue(re.test('\u{1F1F9}\u{1F1FF}')); +assertTrue(re.test('\u{1F1FA}\u{1F1E6}')); +assertTrue(re.test('\u{1F1FA}\u{1F1EC}')); +assertTrue(re.test('\u{1F1FA}\u{1F1F2}')); +assertTrue(re.test('\u{1F1FA}\u{1F1F3}')); +assertTrue(re.test('\u{1F1FA}\u{1F1F8}')); +assertTrue(re.test('\u{1F1FA}\u{1F1FE}')); +assertTrue(re.test('\u{1F1FA}\u{1F1FF}')); +assertTrue(re.test('\u{1F1FB}\u{1F1E6}')); +assertTrue(re.test('\u{1F1FB}\u{1F1E8}')); +assertTrue(re.test('\u{1F1FB}\u{1F1EA}')); +assertTrue(re.test('\u{1F1FB}\u{1F1EC}')); +assertTrue(re.test('\u{1F1FB}\u{1F1EE}')); +assertTrue(re.test('\u{1F1FB}\u{1F1F3}')); +assertTrue(re.test('\u{1F1FB}\u{1F1FA}')); +assertTrue(re.test('\u{1F1FC}\u{1F1EB}')); +assertTrue(re.test('\u{1F1FC}\u{1F1F8}')); +assertTrue(re.test('\u{1F1FD}\u{1F1F0}')); +assertTrue(re.test('\u{1F1FE}\u{1F1EA}')); +assertTrue(re.test('\u{1F1FE}\u{1F1F9}')); +assertTrue(re.test('\u{1F1FF}\u{1F1E6}')); +assertTrue(re.test('\u{1F1FF}\u{1F1F2}')); +assertTrue(re.test('\u{1F1F0}\u{1F1FE}')); diff --git a/deps/v8/test/mjsunit/harmony/regexp-property-emoji-keycap-sequence-generated.js b/deps/v8/test/mjsunit/harmony/regexp-property-emoji-keycap-sequence-generated.js new file mode 100644 index 0000000000..8366a395ec --- /dev/null +++ b/deps/v8/test/mjsunit/harmony/regexp-property-emoji-keycap-sequence-generated.js @@ -0,0 +1,20 @@ +// Copyright 2018 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-sequence + +const re = /\p{Emoji_Keycap_Sequence}/u; + +assertTrue(re.test('#\uFE0F\u20E3')); +assertTrue(re.test('9\uFE0F\u20E3')); +assertTrue(re.test('0\uFE0F\u20E3')); +assertTrue(re.test('1\uFE0F\u20E3')); +assertTrue(re.test('2\uFE0F\u20E3')); +assertTrue(re.test('3\uFE0F\u20E3')); +assertTrue(re.test('*\uFE0F\u20E3')); +assertTrue(re.test('5\uFE0F\u20E3')); +assertTrue(re.test('6\uFE0F\u20E3')); +assertTrue(re.test('7\uFE0F\u20E3')); +assertTrue(re.test('8\uFE0F\u20E3')); +assertTrue(re.test('4\uFE0F\u20E3')); diff --git a/deps/v8/test/mjsunit/harmony/regexp-property-emoji-modifier-sequence-generated.js b/deps/v8/test/mjsunit/harmony/regexp-property-emoji-modifier-sequence-generated.js new file mode 100644 index 0000000000..0e11d6c462 --- /dev/null +++ b/deps/v8/test/mjsunit/harmony/regexp-property-emoji-modifier-sequence-generated.js @@ -0,0 +1,538 @@ +// Copyright 2018 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-sequence + +const re = /\p{Emoji_Modifier_Sequence}/u; + +assertTrue(re.test('\u261D\u{1F3FB}')); +assertTrue(re.test('\u{1F9DD}\u{1F3FF}')); +assertTrue(re.test('\u261D\u{1F3FD}')); +assertTrue(re.test('\u261D\u{1F3FE}')); +assertTrue(re.test('\u261D\u{1F3FF}')); +assertTrue(re.test('\u26F9\u{1F3FB}')); +assertTrue(re.test('\u26F9\u{1F3FC}')); +assertTrue(re.test('\u26F9\u{1F3FD}')); +assertTrue(re.test('\u26F9\u{1F3FE}')); +assertTrue(re.test('\u26F9\u{1F3FF}')); +assertTrue(re.test('\u270A\u{1F3FB}')); +assertTrue(re.test('\u270A\u{1F3FC}')); +assertTrue(re.test('\u270A\u{1F3FD}')); +assertTrue(re.test('\u270A\u{1F3FE}')); +assertTrue(re.test('\u270A\u{1F3FF}')); +assertTrue(re.test('\u270B\u{1F3FB}')); +assertTrue(re.test('\u270B\u{1F3FC}')); +assertTrue(re.test('\u270B\u{1F3FD}')); +assertTrue(re.test('\u270B\u{1F3FE}')); +assertTrue(re.test('\u270B\u{1F3FF}')); +assertTrue(re.test('\u270C\u{1F3FB}')); +assertTrue(re.test('\u270C\u{1F3FC}')); +assertTrue(re.test('\u270C\u{1F3FD}')); +assertTrue(re.test('\u270C\u{1F3FE}')); +assertTrue(re.test('\u270C\u{1F3FF}')); +assertTrue(re.test('\u270D\u{1F3FB}')); +assertTrue(re.test('\u270D\u{1F3FC}')); +assertTrue(re.test('\u270D\u{1F3FD}')); +assertTrue(re.test('\u270D\u{1F3FE}')); +assertTrue(re.test('\u270D\u{1F3FF}')); +assertTrue(re.test('\u{1F385}\u{1F3FB}')); +assertTrue(re.test('\u{1F385}\u{1F3FC}')); +assertTrue(re.test('\u{1F385}\u{1F3FD}')); +assertTrue(re.test('\u{1F385}\u{1F3FE}')); +assertTrue(re.test('\u{1F385}\u{1F3FF}')); +assertTrue(re.test('\u{1F3C2}\u{1F3FB}')); +assertTrue(re.test('\u{1F3C2}\u{1F3FC}')); +assertTrue(re.test('\u{1F3C2}\u{1F3FD}')); +assertTrue(re.test('\u{1F3C2}\u{1F3FE}')); +assertTrue(re.test('\u{1F3C2}\u{1F3FF}')); +assertTrue(re.test('\u{1F3C3}\u{1F3FB}')); +assertTrue(re.test('\u{1F3C3}\u{1F3FC}')); +assertTrue(re.test('\u{1F3C3}\u{1F3FD}')); +assertTrue(re.test('\u{1F3C3}\u{1F3FE}')); +assertTrue(re.test('\u{1F3C3}\u{1F3FF}')); +assertTrue(re.test('\u{1F3C4}\u{1F3FB}')); +assertTrue(re.test('\u{1F3C4}\u{1F3FC}')); +assertTrue(re.test('\u{1F3C4}\u{1F3FD}')); +assertTrue(re.test('\u{1F3C4}\u{1F3FE}')); +assertTrue(re.test('\u{1F3C4}\u{1F3FF}')); +assertTrue(re.test('\u{1F3C7}\u{1F3FB}')); +assertTrue(re.test('\u{1F3C7}\u{1F3FC}')); +assertTrue(re.test('\u{1F3C7}\u{1F3FD}')); +assertTrue(re.test('\u{1F3C7}\u{1F3FE}')); +assertTrue(re.test('\u{1F3C7}\u{1F3FF}')); +assertTrue(re.test('\u{1F3CA}\u{1F3FB}')); +assertTrue(re.test('\u{1F3CA}\u{1F3FC}')); +assertTrue(re.test('\u{1F3CA}\u{1F3FD}')); +assertTrue(re.test('\u{1F3CA}\u{1F3FE}')); +assertTrue(re.test('\u{1F3CA}\u{1F3FF}')); +assertTrue(re.test('\u{1F3CB}\u{1F3FB}')); +assertTrue(re.test('\u{1F3CB}\u{1F3FC}')); +assertTrue(re.test('\u{1F3CB}\u{1F3FD}')); +assertTrue(re.test('\u{1F3CB}\u{1F3FE}')); +assertTrue(re.test('\u{1F3CB}\u{1F3FF}')); +assertTrue(re.test('\u{1F3CC}\u{1F3FB}')); +assertTrue(re.test('\u{1F3CC}\u{1F3FC}')); +assertTrue(re.test('\u{1F3CC}\u{1F3FD}')); +assertTrue(re.test('\u{1F3CC}\u{1F3FE}')); +assertTrue(re.test('\u{1F3CC}\u{1F3FF}')); +assertTrue(re.test('\u{1F442}\u{1F3FB}')); +assertTrue(re.test('\u{1F442}\u{1F3FC}')); +assertTrue(re.test('\u{1F442}\u{1F3FD}')); +assertTrue(re.test('\u{1F442}\u{1F3FE}')); +assertTrue(re.test('\u{1F442}\u{1F3FF}')); +assertTrue(re.test('\u{1F443}\u{1F3FB}')); +assertTrue(re.test('\u{1F443}\u{1F3FC}')); +assertTrue(re.test('\u{1F443}\u{1F3FD}')); +assertTrue(re.test('\u{1F443}\u{1F3FE}')); +assertTrue(re.test('\u{1F443}\u{1F3FF}')); +assertTrue(re.test('\u{1F446}\u{1F3FB}')); +assertTrue(re.test('\u{1F446}\u{1F3FC}')); +assertTrue(re.test('\u{1F446}\u{1F3FD}')); +assertTrue(re.test('\u{1F446}\u{1F3FE}')); +assertTrue(re.test('\u{1F446}\u{1F3FF}')); +assertTrue(re.test('\u{1F447}\u{1F3FB}')); +assertTrue(re.test('\u{1F447}\u{1F3FC}')); +assertTrue(re.test('\u{1F447}\u{1F3FD}')); +assertTrue(re.test('\u{1F447}\u{1F3FE}')); +assertTrue(re.test('\u{1F447}\u{1F3FF}')); +assertTrue(re.test('\u{1F448}\u{1F3FB}')); +assertTrue(re.test('\u{1F448}\u{1F3FC}')); +assertTrue(re.test('\u{1F448}\u{1F3FD}')); +assertTrue(re.test('\u{1F448}\u{1F3FE}')); +assertTrue(re.test('\u{1F448}\u{1F3FF}')); +assertTrue(re.test('\u{1F449}\u{1F3FB}')); +assertTrue(re.test('\u{1F449}\u{1F3FC}')); +assertTrue(re.test('\u{1F449}\u{1F3FD}')); +assertTrue(re.test('\u{1F449}\u{1F3FE}')); +assertTrue(re.test('\u{1F449}\u{1F3FF}')); +assertTrue(re.test('\u{1F44A}\u{1F3FB}')); +assertTrue(re.test('\u{1F44A}\u{1F3FC}')); +assertTrue(re.test('\u{1F44A}\u{1F3FD}')); +assertTrue(re.test('\u{1F44A}\u{1F3FE}')); +assertTrue(re.test('\u{1F44A}\u{1F3FF}')); +assertTrue(re.test('\u{1F44B}\u{1F3FB}')); +assertTrue(re.test('\u{1F44B}\u{1F3FC}')); +assertTrue(re.test('\u{1F44B}\u{1F3FD}')); +assertTrue(re.test('\u{1F44B}\u{1F3FE}')); +assertTrue(re.test('\u{1F44B}\u{1F3FF}')); +assertTrue(re.test('\u{1F44C}\u{1F3FB}')); +assertTrue(re.test('\u{1F44C}\u{1F3FC}')); +assertTrue(re.test('\u{1F44C}\u{1F3FD}')); +assertTrue(re.test('\u{1F44C}\u{1F3FE}')); +assertTrue(re.test('\u{1F44C}\u{1F3FF}')); +assertTrue(re.test('\u{1F44D}\u{1F3FB}')); +assertTrue(re.test('\u{1F44D}\u{1F3FC}')); +assertTrue(re.test('\u{1F44D}\u{1F3FD}')); +assertTrue(re.test('\u{1F44D}\u{1F3FE}')); +assertTrue(re.test('\u{1F44D}\u{1F3FF}')); +assertTrue(re.test('\u{1F44E}\u{1F3FB}')); +assertTrue(re.test('\u{1F44E}\u{1F3FC}')); +assertTrue(re.test('\u{1F44E}\u{1F3FD}')); +assertTrue(re.test('\u{1F44E}\u{1F3FE}')); +assertTrue(re.test('\u{1F44E}\u{1F3FF}')); +assertTrue(re.test('\u{1F44F}\u{1F3FB}')); +assertTrue(re.test('\u{1F44F}\u{1F3FC}')); +assertTrue(re.test('\u{1F44F}\u{1F3FD}')); +assertTrue(re.test('\u{1F44F}\u{1F3FE}')); +assertTrue(re.test('\u{1F44F}\u{1F3FF}')); +assertTrue(re.test('\u{1F450}\u{1F3FB}')); +assertTrue(re.test('\u{1F450}\u{1F3FC}')); +assertTrue(re.test('\u{1F450}\u{1F3FD}')); +assertTrue(re.test('\u{1F450}\u{1F3FE}')); +assertTrue(re.test('\u{1F450}\u{1F3FF}')); +assertTrue(re.test('\u{1F466}\u{1F3FB}')); +assertTrue(re.test('\u{1F466}\u{1F3FC}')); +assertTrue(re.test('\u{1F466}\u{1F3FD}')); +assertTrue(re.test('\u{1F466}\u{1F3FE}')); +assertTrue(re.test('\u{1F466}\u{1F3FF}')); +assertTrue(re.test('\u{1F467}\u{1F3FB}')); +assertTrue(re.test('\u{1F467}\u{1F3FC}')); +assertTrue(re.test('\u{1F467}\u{1F3FD}')); +assertTrue(re.test('\u{1F467}\u{1F3FE}')); +assertTrue(re.test('\u{1F467}\u{1F3FF}')); +assertTrue(re.test('\u{1F468}\u{1F3FB}')); +assertTrue(re.test('\u{1F468}\u{1F3FC}')); +assertTrue(re.test('\u{1F468}\u{1F3FD}')); +assertTrue(re.test('\u{1F468}\u{1F3FE}')); +assertTrue(re.test('\u{1F468}\u{1F3FF}')); +assertTrue(re.test('\u{1F469}\u{1F3FB}')); +assertTrue(re.test('\u{1F469}\u{1F3FC}')); +assertTrue(re.test('\u{1F469}\u{1F3FD}')); +assertTrue(re.test('\u{1F469}\u{1F3FE}')); +assertTrue(re.test('\u{1F469}\u{1F3FF}')); +assertTrue(re.test('\u{1F46E}\u{1F3FB}')); +assertTrue(re.test('\u{1F46E}\u{1F3FC}')); +assertTrue(re.test('\u{1F46E}\u{1F3FD}')); +assertTrue(re.test('\u{1F46E}\u{1F3FE}')); +assertTrue(re.test('\u{1F46E}\u{1F3FF}')); +assertTrue(re.test('\u{1F470}\u{1F3FB}')); +assertTrue(re.test('\u{1F470}\u{1F3FC}')); +assertTrue(re.test('\u{1F470}\u{1F3FD}')); +assertTrue(re.test('\u{1F470}\u{1F3FE}')); +assertTrue(re.test('\u{1F470}\u{1F3FF}')); +assertTrue(re.test('\u{1F471}\u{1F3FB}')); +assertTrue(re.test('\u{1F471}\u{1F3FC}')); +assertTrue(re.test('\u{1F471}\u{1F3FD}')); +assertTrue(re.test('\u{1F471}\u{1F3FE}')); +assertTrue(re.test('\u{1F471}\u{1F3FF}')); +assertTrue(re.test('\u{1F472}\u{1F3FB}')); +assertTrue(re.test('\u{1F472}\u{1F3FC}')); +assertTrue(re.test('\u{1F472}\u{1F3FD}')); +assertTrue(re.test('\u{1F472}\u{1F3FE}')); +assertTrue(re.test('\u{1F472}\u{1F3FF}')); +assertTrue(re.test('\u{1F473}\u{1F3FB}')); +assertTrue(re.test('\u{1F473}\u{1F3FC}')); +assertTrue(re.test('\u{1F473}\u{1F3FD}')); +assertTrue(re.test('\u{1F473}\u{1F3FE}')); +assertTrue(re.test('\u{1F473}\u{1F3FF}')); +assertTrue(re.test('\u{1F474}\u{1F3FB}')); +assertTrue(re.test('\u{1F474}\u{1F3FC}')); +assertTrue(re.test('\u{1F474}\u{1F3FD}')); +assertTrue(re.test('\u{1F474}\u{1F3FE}')); +assertTrue(re.test('\u{1F474}\u{1F3FF}')); +assertTrue(re.test('\u{1F475}\u{1F3FB}')); +assertTrue(re.test('\u{1F475}\u{1F3FC}')); +assertTrue(re.test('\u{1F475}\u{1F3FD}')); +assertTrue(re.test('\u{1F475}\u{1F3FE}')); +assertTrue(re.test('\u{1F475}\u{1F3FF}')); +assertTrue(re.test('\u{1F476}\u{1F3FB}')); +assertTrue(re.test('\u{1F476}\u{1F3FC}')); +assertTrue(re.test('\u{1F476}\u{1F3FD}')); +assertTrue(re.test('\u{1F476}\u{1F3FE}')); +assertTrue(re.test('\u{1F476}\u{1F3FF}')); +assertTrue(re.test('\u{1F477}\u{1F3FB}')); +assertTrue(re.test('\u{1F477}\u{1F3FC}')); +assertTrue(re.test('\u{1F477}\u{1F3FD}')); +assertTrue(re.test('\u{1F477}\u{1F3FE}')); +assertTrue(re.test('\u{1F477}\u{1F3FF}')); +assertTrue(re.test('\u{1F478}\u{1F3FB}')); +assertTrue(re.test('\u{1F478}\u{1F3FC}')); +assertTrue(re.test('\u{1F478}\u{1F3FD}')); +assertTrue(re.test('\u{1F478}\u{1F3FE}')); +assertTrue(re.test('\u{1F478}\u{1F3FF}')); +assertTrue(re.test('\u{1F47C}\u{1F3FB}')); +assertTrue(re.test('\u{1F47C}\u{1F3FC}')); +assertTrue(re.test('\u{1F47C}\u{1F3FD}')); +assertTrue(re.test('\u{1F47C}\u{1F3FE}')); +assertTrue(re.test('\u{1F47C}\u{1F3FF}')); +assertTrue(re.test('\u{1F481}\u{1F3FB}')); +assertTrue(re.test('\u{1F481}\u{1F3FC}')); +assertTrue(re.test('\u{1F481}\u{1F3FD}')); +assertTrue(re.test('\u{1F481}\u{1F3FE}')); +assertTrue(re.test('\u{1F481}\u{1F3FF}')); +assertTrue(re.test('\u{1F482}\u{1F3FB}')); +assertTrue(re.test('\u{1F482}\u{1F3FC}')); +assertTrue(re.test('\u{1F482}\u{1F3FD}')); +assertTrue(re.test('\u{1F482}\u{1F3FE}')); +assertTrue(re.test('\u{1F482}\u{1F3FF}')); +assertTrue(re.test('\u{1F483}\u{1F3FB}')); +assertTrue(re.test('\u{1F483}\u{1F3FC}')); +assertTrue(re.test('\u{1F483}\u{1F3FD}')); +assertTrue(re.test('\u{1F483}\u{1F3FE}')); +assertTrue(re.test('\u{1F483}\u{1F3FF}')); +assertTrue(re.test('\u{1F485}\u{1F3FB}')); +assertTrue(re.test('\u{1F485}\u{1F3FC}')); +assertTrue(re.test('\u{1F485}\u{1F3FD}')); +assertTrue(re.test('\u{1F485}\u{1F3FE}')); +assertTrue(re.test('\u{1F485}\u{1F3FF}')); +assertTrue(re.test('\u{1F486}\u{1F3FB}')); +assertTrue(re.test('\u{1F486}\u{1F3FC}')); +assertTrue(re.test('\u{1F486}\u{1F3FD}')); +assertTrue(re.test('\u{1F486}\u{1F3FE}')); +assertTrue(re.test('\u{1F486}\u{1F3FF}')); +assertTrue(re.test('\u{1F487}\u{1F3FB}')); +assertTrue(re.test('\u{1F487}\u{1F3FC}')); +assertTrue(re.test('\u{1F487}\u{1F3FD}')); +assertTrue(re.test('\u{1F487}\u{1F3FE}')); +assertTrue(re.test('\u{1F487}\u{1F3FF}')); +assertTrue(re.test('\u{1F4AA}\u{1F3FB}')); +assertTrue(re.test('\u{1F4AA}\u{1F3FC}')); +assertTrue(re.test('\u{1F4AA}\u{1F3FD}')); +assertTrue(re.test('\u{1F4AA}\u{1F3FE}')); +assertTrue(re.test('\u{1F4AA}\u{1F3FF}')); +assertTrue(re.test('\u{1F574}\u{1F3FB}')); +assertTrue(re.test('\u{1F574}\u{1F3FC}')); +assertTrue(re.test('\u{1F574}\u{1F3FD}')); +assertTrue(re.test('\u{1F574}\u{1F3FE}')); +assertTrue(re.test('\u{1F574}\u{1F3FF}')); +assertTrue(re.test('\u{1F575}\u{1F3FB}')); +assertTrue(re.test('\u{1F575}\u{1F3FC}')); +assertTrue(re.test('\u{1F575}\u{1F3FD}')); +assertTrue(re.test('\u{1F575}\u{1F3FE}')); +assertTrue(re.test('\u{1F575}\u{1F3FF}')); +assertTrue(re.test('\u{1F57A}\u{1F3FB}')); +assertTrue(re.test('\u{1F57A}\u{1F3FC}')); +assertTrue(re.test('\u{1F57A}\u{1F3FD}')); +assertTrue(re.test('\u{1F57A}\u{1F3FE}')); +assertTrue(re.test('\u{1F57A}\u{1F3FF}')); +assertTrue(re.test('\u{1F590}\u{1F3FB}')); +assertTrue(re.test('\u{1F590}\u{1F3FC}')); +assertTrue(re.test('\u{1F590}\u{1F3FD}')); +assertTrue(re.test('\u{1F590}\u{1F3FE}')); +assertTrue(re.test('\u{1F590}\u{1F3FF}')); +assertTrue(re.test('\u261D\u{1F3FC}')); +assertTrue(re.test('\u{1F595}\u{1F3FC}')); +assertTrue(re.test('\u{1F595}\u{1F3FD}')); +assertTrue(re.test('\u{1F595}\u{1F3FE}')); +assertTrue(re.test('\u{1F595}\u{1F3FF}')); +assertTrue(re.test('\u{1F596}\u{1F3FB}')); +assertTrue(re.test('\u{1F596}\u{1F3FC}')); +assertTrue(re.test('\u{1F596}\u{1F3FD}')); +assertTrue(re.test('\u{1F596}\u{1F3FE}')); +assertTrue(re.test('\u{1F596}\u{1F3FF}')); +assertTrue(re.test('\u{1F645}\u{1F3FB}')); +assertTrue(re.test('\u{1F645}\u{1F3FC}')); +assertTrue(re.test('\u{1F645}\u{1F3FD}')); +assertTrue(re.test('\u{1F645}\u{1F3FE}')); +assertTrue(re.test('\u{1F645}\u{1F3FF}')); +assertTrue(re.test('\u{1F646}\u{1F3FB}')); +assertTrue(re.test('\u{1F646}\u{1F3FC}')); +assertTrue(re.test('\u{1F646}\u{1F3FD}')); +assertTrue(re.test('\u{1F646}\u{1F3FE}')); +assertTrue(re.test('\u{1F646}\u{1F3FF}')); +assertTrue(re.test('\u{1F647}\u{1F3FB}')); +assertTrue(re.test('\u{1F647}\u{1F3FC}')); +assertTrue(re.test('\u{1F647}\u{1F3FD}')); +assertTrue(re.test('\u{1F647}\u{1F3FE}')); +assertTrue(re.test('\u{1F647}\u{1F3FF}')); +assertTrue(re.test('\u{1F64B}\u{1F3FB}')); +assertTrue(re.test('\u{1F64B}\u{1F3FC}')); +assertTrue(re.test('\u{1F64B}\u{1F3FD}')); +assertTrue(re.test('\u{1F64B}\u{1F3FE}')); +assertTrue(re.test('\u{1F64B}\u{1F3FF}')); +assertTrue(re.test('\u{1F64C}\u{1F3FB}')); +assertTrue(re.test('\u{1F64C}\u{1F3FC}')); +assertTrue(re.test('\u{1F64C}\u{1F3FD}')); +assertTrue(re.test('\u{1F64C}\u{1F3FE}')); +assertTrue(re.test('\u{1F64C}\u{1F3FF}')); +assertTrue(re.test('\u{1F64D}\u{1F3FB}')); +assertTrue(re.test('\u{1F64D}\u{1F3FC}')); +assertTrue(re.test('\u{1F64D}\u{1F3FD}')); +assertTrue(re.test('\u{1F64D}\u{1F3FE}')); +assertTrue(re.test('\u{1F64D}\u{1F3FF}')); +assertTrue(re.test('\u{1F64E}\u{1F3FB}')); +assertTrue(re.test('\u{1F64E}\u{1F3FC}')); +assertTrue(re.test('\u{1F64E}\u{1F3FD}')); +assertTrue(re.test('\u{1F64E}\u{1F3FE}')); +assertTrue(re.test('\u{1F64E}\u{1F3FF}')); +assertTrue(re.test('\u{1F64F}\u{1F3FB}')); +assertTrue(re.test('\u{1F64F}\u{1F3FC}')); +assertTrue(re.test('\u{1F64F}\u{1F3FD}')); +assertTrue(re.test('\u{1F64F}\u{1F3FE}')); +assertTrue(re.test('\u{1F64F}\u{1F3FF}')); +assertTrue(re.test('\u{1F6A3}\u{1F3FB}')); +assertTrue(re.test('\u{1F6A3}\u{1F3FC}')); +assertTrue(re.test('\u{1F6A3}\u{1F3FD}')); +assertTrue(re.test('\u{1F6A3}\u{1F3FE}')); +assertTrue(re.test('\u{1F6A3}\u{1F3FF}')); +assertTrue(re.test('\u{1F6B4}\u{1F3FB}')); +assertTrue(re.test('\u{1F6B4}\u{1F3FC}')); +assertTrue(re.test('\u{1F6B4}\u{1F3FD}')); +assertTrue(re.test('\u{1F6B4}\u{1F3FE}')); +assertTrue(re.test('\u{1F6B4}\u{1F3FF}')); +assertTrue(re.test('\u{1F6B5}\u{1F3FB}')); +assertTrue(re.test('\u{1F6B5}\u{1F3FC}')); +assertTrue(re.test('\u{1F6B5}\u{1F3FD}')); +assertTrue(re.test('\u{1F6B5}\u{1F3FE}')); +assertTrue(re.test('\u{1F6B5}\u{1F3FF}')); +assertTrue(re.test('\u{1F6B6}\u{1F3FB}')); +assertTrue(re.test('\u{1F6B6}\u{1F3FC}')); +assertTrue(re.test('\u{1F6B6}\u{1F3FD}')); +assertTrue(re.test('\u{1F6B6}\u{1F3FE}')); +assertTrue(re.test('\u{1F6B6}\u{1F3FF}')); +assertTrue(re.test('\u{1F6C0}\u{1F3FB}')); +assertTrue(re.test('\u{1F6C0}\u{1F3FC}')); +assertTrue(re.test('\u{1F6C0}\u{1F3FD}')); +assertTrue(re.test('\u{1F6C0}\u{1F3FE}')); +assertTrue(re.test('\u{1F6C0}\u{1F3FF}')); +assertTrue(re.test('\u{1F6CC}\u{1F3FB}')); +assertTrue(re.test('\u{1F6CC}\u{1F3FC}')); +assertTrue(re.test('\u{1F6CC}\u{1F3FD}')); +assertTrue(re.test('\u{1F6CC}\u{1F3FE}')); +assertTrue(re.test('\u{1F6CC}\u{1F3FF}')); +assertTrue(re.test('\u{1F918}\u{1F3FB}')); +assertTrue(re.test('\u{1F918}\u{1F3FC}')); +assertTrue(re.test('\u{1F918}\u{1F3FD}')); +assertTrue(re.test('\u{1F918}\u{1F3FE}')); +assertTrue(re.test('\u{1F918}\u{1F3FF}')); +assertTrue(re.test('\u{1F919}\u{1F3FB}')); +assertTrue(re.test('\u{1F919}\u{1F3FC}')); +assertTrue(re.test('\u{1F919}\u{1F3FD}')); +assertTrue(re.test('\u{1F919}\u{1F3FE}')); +assertTrue(re.test('\u{1F919}\u{1F3FF}')); +assertTrue(re.test('\u{1F91A}\u{1F3FB}')); +assertTrue(re.test('\u{1F91A}\u{1F3FC}')); +assertTrue(re.test('\u{1F91A}\u{1F3FD}')); +assertTrue(re.test('\u{1F91A}\u{1F3FE}')); +assertTrue(re.test('\u{1F91A}\u{1F3FF}')); +assertTrue(re.test('\u{1F91B}\u{1F3FB}')); +assertTrue(re.test('\u{1F91B}\u{1F3FC}')); +assertTrue(re.test('\u{1F91B}\u{1F3FD}')); +assertTrue(re.test('\u{1F91B}\u{1F3FE}')); +assertTrue(re.test('\u{1F91B}\u{1F3FF}')); +assertTrue(re.test('\u{1F91C}\u{1F3FB}')); +assertTrue(re.test('\u{1F91C}\u{1F3FC}')); +assertTrue(re.test('\u{1F91C}\u{1F3FD}')); +assertTrue(re.test('\u{1F91C}\u{1F3FE}')); +assertTrue(re.test('\u{1F91C}\u{1F3FF}')); +assertTrue(re.test('\u{1F91E}\u{1F3FB}')); +assertTrue(re.test('\u{1F91E}\u{1F3FC}')); +assertTrue(re.test('\u{1F91E}\u{1F3FD}')); +assertTrue(re.test('\u{1F91E}\u{1F3FE}')); +assertTrue(re.test('\u{1F91E}\u{1F3FF}')); +assertTrue(re.test('\u{1F91F}\u{1F3FB}')); +assertTrue(re.test('\u{1F91F}\u{1F3FC}')); +assertTrue(re.test('\u{1F91F}\u{1F3FD}')); +assertTrue(re.test('\u{1F91F}\u{1F3FE}')); +assertTrue(re.test('\u{1F91F}\u{1F3FF}')); +assertTrue(re.test('\u{1F926}\u{1F3FB}')); +assertTrue(re.test('\u{1F926}\u{1F3FC}')); +assertTrue(re.test('\u{1F926}\u{1F3FD}')); +assertTrue(re.test('\u{1F926}\u{1F3FE}')); +assertTrue(re.test('\u{1F926}\u{1F3FF}')); +assertTrue(re.test('\u{1F930}\u{1F3FB}')); +assertTrue(re.test('\u{1F930}\u{1F3FC}')); +assertTrue(re.test('\u{1F930}\u{1F3FD}')); +assertTrue(re.test('\u{1F930}\u{1F3FE}')); +assertTrue(re.test('\u{1F930}\u{1F3FF}')); +assertTrue(re.test('\u{1F931}\u{1F3FB}')); +assertTrue(re.test('\u{1F931}\u{1F3FC}')); +assertTrue(re.test('\u{1F931}\u{1F3FD}')); +assertTrue(re.test('\u{1F931}\u{1F3FE}')); +assertTrue(re.test('\u{1F931}\u{1F3FF}')); +assertTrue(re.test('\u{1F932}\u{1F3FB}')); +assertTrue(re.test('\u{1F932}\u{1F3FC}')); +assertTrue(re.test('\u{1F932}\u{1F3FD}')); +assertTrue(re.test('\u{1F932}\u{1F3FE}')); +assertTrue(re.test('\u{1F932}\u{1F3FF}')); +assertTrue(re.test('\u{1F933}\u{1F3FB}')); +assertTrue(re.test('\u{1F933}\u{1F3FC}')); +assertTrue(re.test('\u{1F933}\u{1F3FD}')); +assertTrue(re.test('\u{1F933}\u{1F3FE}')); +assertTrue(re.test('\u{1F933}\u{1F3FF}')); +assertTrue(re.test('\u{1F934}\u{1F3FB}')); +assertTrue(re.test('\u{1F934}\u{1F3FC}')); +assertTrue(re.test('\u{1F934}\u{1F3FD}')); +assertTrue(re.test('\u{1F934}\u{1F3FE}')); +assertTrue(re.test('\u{1F934}\u{1F3FF}')); +assertTrue(re.test('\u{1F935}\u{1F3FB}')); +assertTrue(re.test('\u{1F935}\u{1F3FC}')); +assertTrue(re.test('\u{1F935}\u{1F3FD}')); +assertTrue(re.test('\u{1F935}\u{1F3FE}')); +assertTrue(re.test('\u{1F935}\u{1F3FF}')); +assertTrue(re.test('\u{1F936}\u{1F3FB}')); +assertTrue(re.test('\u{1F936}\u{1F3FC}')); +assertTrue(re.test('\u{1F936}\u{1F3FD}')); +assertTrue(re.test('\u{1F936}\u{1F3FE}')); +assertTrue(re.test('\u{1F936}\u{1F3FF}')); +assertTrue(re.test('\u{1F937}\u{1F3FB}')); +assertTrue(re.test('\u{1F937}\u{1F3FC}')); +assertTrue(re.test('\u{1F937}\u{1F3FD}')); +assertTrue(re.test('\u{1F937}\u{1F3FE}')); +assertTrue(re.test('\u{1F937}\u{1F3FF}')); +assertTrue(re.test('\u{1F938}\u{1F3FB}')); +assertTrue(re.test('\u{1F938}\u{1F3FC}')); +assertTrue(re.test('\u{1F938}\u{1F3FD}')); +assertTrue(re.test('\u{1F938}\u{1F3FE}')); +assertTrue(re.test('\u{1F938}\u{1F3FF}')); +assertTrue(re.test('\u{1F939}\u{1F3FB}')); +assertTrue(re.test('\u{1F939}\u{1F3FC}')); +assertTrue(re.test('\u{1F939}\u{1F3FD}')); +assertTrue(re.test('\u{1F939}\u{1F3FE}')); +assertTrue(re.test('\u{1F939}\u{1F3FF}')); +assertTrue(re.test('\u{1F93D}\u{1F3FB}')); +assertTrue(re.test('\u{1F93D}\u{1F3FC}')); +assertTrue(re.test('\u{1F93D}\u{1F3FD}')); +assertTrue(re.test('\u{1F93D}\u{1F3FE}')); +assertTrue(re.test('\u{1F93D}\u{1F3FF}')); +assertTrue(re.test('\u{1F93E}\u{1F3FB}')); +assertTrue(re.test('\u{1F93E}\u{1F3FC}')); +assertTrue(re.test('\u{1F93E}\u{1F3FD}')); +assertTrue(re.test('\u{1F93E}\u{1F3FE}')); +assertTrue(re.test('\u{1F93E}\u{1F3FF}')); +assertTrue(re.test('\u{1F9B5}\u{1F3FB}')); +assertTrue(re.test('\u{1F9B5}\u{1F3FC}')); +assertTrue(re.test('\u{1F9B5}\u{1F3FD}')); +assertTrue(re.test('\u{1F9B5}\u{1F3FE}')); +assertTrue(re.test('\u{1F9B5}\u{1F3FF}')); +assertTrue(re.test('\u{1F9B6}\u{1F3FB}')); +assertTrue(re.test('\u{1F9B6}\u{1F3FC}')); +assertTrue(re.test('\u{1F9B6}\u{1F3FD}')); +assertTrue(re.test('\u{1F9B6}\u{1F3FE}')); +assertTrue(re.test('\u{1F9B6}\u{1F3FF}')); +assertTrue(re.test('\u{1F9B8}\u{1F3FB}')); +assertTrue(re.test('\u{1F9B8}\u{1F3FC}')); +assertTrue(re.test('\u{1F9B8}\u{1F3FD}')); +assertTrue(re.test('\u{1F9B8}\u{1F3FE}')); +assertTrue(re.test('\u{1F9B8}\u{1F3FF}')); +assertTrue(re.test('\u{1F9B9}\u{1F3FB}')); +assertTrue(re.test('\u{1F9B9}\u{1F3FC}')); +assertTrue(re.test('\u{1F9B9}\u{1F3FD}')); +assertTrue(re.test('\u{1F9B9}\u{1F3FE}')); +assertTrue(re.test('\u{1F9B9}\u{1F3FF}')); +assertTrue(re.test('\u{1F9D1}\u{1F3FB}')); +assertTrue(re.test('\u{1F9D1}\u{1F3FC}')); +assertTrue(re.test('\u{1F9D1}\u{1F3FD}')); +assertTrue(re.test('\u{1F9D1}\u{1F3FE}')); +assertTrue(re.test('\u{1F9D1}\u{1F3FF}')); +assertTrue(re.test('\u{1F9D2}\u{1F3FB}')); +assertTrue(re.test('\u{1F9D2}\u{1F3FC}')); +assertTrue(re.test('\u{1F9D2}\u{1F3FD}')); +assertTrue(re.test('\u{1F9D2}\u{1F3FE}')); +assertTrue(re.test('\u{1F9D2}\u{1F3FF}')); +assertTrue(re.test('\u{1F9D3}\u{1F3FB}')); +assertTrue(re.test('\u{1F9D3}\u{1F3FC}')); +assertTrue(re.test('\u{1F9D3}\u{1F3FD}')); +assertTrue(re.test('\u{1F9D3}\u{1F3FE}')); +assertTrue(re.test('\u{1F9D3}\u{1F3FF}')); +assertTrue(re.test('\u{1F9D4}\u{1F3FB}')); +assertTrue(re.test('\u{1F9D4}\u{1F3FC}')); +assertTrue(re.test('\u{1F9D4}\u{1F3FD}')); +assertTrue(re.test('\u{1F9D4}\u{1F3FE}')); +assertTrue(re.test('\u{1F9D4}\u{1F3FF}')); +assertTrue(re.test('\u{1F9D5}\u{1F3FB}')); +assertTrue(re.test('\u{1F9D5}\u{1F3FC}')); +assertTrue(re.test('\u{1F9D5}\u{1F3FD}')); +assertTrue(re.test('\u{1F9D5}\u{1F3FE}')); +assertTrue(re.test('\u{1F9D5}\u{1F3FF}')); +assertTrue(re.test('\u{1F9D6}\u{1F3FB}')); +assertTrue(re.test('\u{1F9D6}\u{1F3FC}')); +assertTrue(re.test('\u{1F9D6}\u{1F3FD}')); +assertTrue(re.test('\u{1F9D6}\u{1F3FE}')); +assertTrue(re.test('\u{1F9D6}\u{1F3FF}')); +assertTrue(re.test('\u{1F9D7}\u{1F3FB}')); +assertTrue(re.test('\u{1F9D7}\u{1F3FC}')); +assertTrue(re.test('\u{1F9D7}\u{1F3FD}')); +assertTrue(re.test('\u{1F9D7}\u{1F3FE}')); +assertTrue(re.test('\u{1F9D7}\u{1F3FF}')); +assertTrue(re.test('\u{1F9D8}\u{1F3FB}')); +assertTrue(re.test('\u{1F9D8}\u{1F3FC}')); +assertTrue(re.test('\u{1F9D8}\u{1F3FD}')); +assertTrue(re.test('\u{1F9D8}\u{1F3FE}')); +assertTrue(re.test('\u{1F9D8}\u{1F3FF}')); +assertTrue(re.test('\u{1F9D9}\u{1F3FB}')); +assertTrue(re.test('\u{1F9D9}\u{1F3FC}')); +assertTrue(re.test('\u{1F9D9}\u{1F3FD}')); +assertTrue(re.test('\u{1F9D9}\u{1F3FE}')); +assertTrue(re.test('\u{1F9D9}\u{1F3FF}')); +assertTrue(re.test('\u{1F9DA}\u{1F3FB}')); +assertTrue(re.test('\u{1F9DA}\u{1F3FC}')); +assertTrue(re.test('\u{1F9DA}\u{1F3FD}')); +assertTrue(re.test('\u{1F9DA}\u{1F3FE}')); +assertTrue(re.test('\u{1F9DA}\u{1F3FF}')); +assertTrue(re.test('\u{1F9DB}\u{1F3FB}')); +assertTrue(re.test('\u{1F9DB}\u{1F3FC}')); +assertTrue(re.test('\u{1F9DB}\u{1F3FD}')); +assertTrue(re.test('\u{1F9DB}\u{1F3FE}')); +assertTrue(re.test('\u{1F9DB}\u{1F3FF}')); +assertTrue(re.test('\u{1F9DC}\u{1F3FB}')); +assertTrue(re.test('\u{1F9DC}\u{1F3FC}')); +assertTrue(re.test('\u{1F9DC}\u{1F3FD}')); +assertTrue(re.test('\u{1F9DC}\u{1F3FE}')); +assertTrue(re.test('\u{1F9DC}\u{1F3FF}')); +assertTrue(re.test('\u{1F9DD}\u{1F3FB}')); +assertTrue(re.test('\u{1F9DD}\u{1F3FC}')); +assertTrue(re.test('\u{1F9DD}\u{1F3FD}')); +assertTrue(re.test('\u{1F9DD}\u{1F3FE}')); +assertTrue(re.test('\u{1F595}\u{1F3FB}')); diff --git a/deps/v8/test/mjsunit/harmony/regexp-property-emoji-tag-sequence-generated.js b/deps/v8/test/mjsunit/harmony/regexp-property-emoji-tag-sequence-generated.js new file mode 100644 index 0000000000..129e1c7777 --- /dev/null +++ b/deps/v8/test/mjsunit/harmony/regexp-property-emoji-tag-sequence-generated.js @@ -0,0 +1,11 @@ +// Copyright 2018 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-sequence + +const re = /\p{Emoji_Tag_Sequence}/u; + +assertTrue(re.test('\u{1F3F4}\u{E0067}\u{E0062}\u{E0065}\u{E006E}\u{E0067}\u{E007F}')); +assertTrue(re.test('\u{1F3F4}\u{E0067}\u{E0062}\u{E0073}\u{E0063}\u{E0074}\u{E007F}')); +assertTrue(re.test('\u{1F3F4}\u{E0067}\u{E0062}\u{E0077}\u{E006C}\u{E0073}\u{E007F}')); diff --git a/deps/v8/test/mjsunit/harmony/regexp-property-emoji-zwj-sequence-generated.js b/deps/v8/test/mjsunit/harmony/regexp-property-emoji-zwj-sequence-generated.js new file mode 100644 index 0000000000..619bf46175 --- /dev/null +++ b/deps/v8/test/mjsunit/harmony/regexp-property-emoji-zwj-sequence-generated.js @@ -0,0 +1,782 @@ +// Copyright 2018 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-sequence + +const re = /\p{Emoji_ZWJ_Sequence}/u; + +assertTrue(re.test('\u{1F468}\u200D\u2764\uFE0F\u200D\u{1F468}')); +assertTrue(re.test('\u{1F441}\uFE0F\u200D\u{1F5E8}\uFE0F')); +assertTrue(re.test('\u{1F468}\u200D\u{1F466}')); +assertTrue(re.test('\u{1F468}\u200D\u{1F466}\u200D\u{1F466}')); +assertTrue(re.test('\u{1F468}\u200D\u{1F467}')); +assertTrue(re.test('\u{1F468}\u200D\u{1F467}\u200D\u{1F466}')); +assertTrue(re.test('\u{1F468}\u200D\u{1F467}\u200D\u{1F467}')); +assertTrue(re.test('\u{1F468}\u200D\u{1F468}\u200D\u{1F466}')); +assertTrue(re.test('\u{1F468}\u200D\u{1F468}\u200D\u{1F466}\u200D\u{1F466}')); +assertTrue(re.test('\u{1F468}\u200D\u{1F468}\u200D\u{1F467}')); +assertTrue(re.test('\u{1F468}\u200D\u{1F468}\u200D\u{1F467}\u200D\u{1F466}')); +assertTrue(re.test('\u{1F468}\u200D\u{1F468}\u200D\u{1F467}\u200D\u{1F467}')); +assertTrue(re.test('\u{1F468}\u200D\u{1F469}\u200D\u{1F466}')); +assertTrue(re.test('\u{1F468}\u200D\u{1F469}\u200D\u{1F466}\u200D\u{1F466}')); +assertTrue(re.test('\u{1F468}\u200D\u{1F469}\u200D\u{1F467}')); +assertTrue(re.test('\u{1F468}\u200D\u{1F469}\u200D\u{1F467}\u200D\u{1F466}')); +assertTrue(re.test('\u{1F468}\u200D\u{1F469}\u200D\u{1F467}\u200D\u{1F467}')); +assertTrue(re.test('\u{1F469}\u200D\u2764\uFE0F\u200D\u{1F468}')); +assertTrue(re.test('\u{1F469}\u200D\u2764\uFE0F\u200D\u{1F469}')); +assertTrue(re.test('\u{1F469}\u200D\u2764\uFE0F\u200D\u{1F48B}\u200D\u{1F468}')); +assertTrue(re.test('\u{1F469}\u200D\u2764\uFE0F\u200D\u{1F48B}\u200D\u{1F469}')); +assertTrue(re.test('\u{1F469}\u200D\u{1F466}')); +assertTrue(re.test('\u{1F469}\u200D\u{1F466}\u200D\u{1F466}')); +assertTrue(re.test('\u{1F469}\u200D\u{1F467}')); +assertTrue(re.test('\u{1F469}\u200D\u{1F467}\u200D\u{1F466}')); +assertTrue(re.test('\u{1F469}\u200D\u{1F467}\u200D\u{1F467}')); +assertTrue(re.test('\u{1F469}\u200D\u{1F469}\u200D\u{1F466}')); +assertTrue(re.test('\u{1F469}\u200D\u{1F469}\u200D\u{1F466}\u200D\u{1F466}')); +assertTrue(re.test('\u{1F469}\u200D\u{1F469}\u200D\u{1F467}')); +assertTrue(re.test('\u{1F469}\u200D\u{1F469}\u200D\u{1F467}\u200D\u{1F466}')); +assertTrue(re.test('\u{1F469}\u200D\u{1F469}\u200D\u{1F467}\u200D\u{1F467}')); +assertTrue(re.test('\u{1F468}\u200D\u2695\uFE0F')); +assertTrue(re.test('\u{1F468}\u200D\u2696\uFE0F')); +assertTrue(re.test('\u{1F468}\u200D\u2708\uFE0F')); +assertTrue(re.test('\u{1F468}\u200D\u{1F33E}')); +assertTrue(re.test('\u{1F468}\u200D\u{1F373}')); +assertTrue(re.test('\u{1F468}\u200D\u{1F393}')); +assertTrue(re.test('\u{1F468}\u200D\u{1F3A4}')); +assertTrue(re.test('\u{1F468}\u200D\u{1F3A8}')); +assertTrue(re.test('\u{1F468}\u200D\u{1F3EB}')); +assertTrue(re.test('\u{1F468}\u200D\u{1F3ED}')); +assertTrue(re.test('\u{1F468}\u200D\u{1F4BB}')); +assertTrue(re.test('\u{1F468}\u200D\u{1F4BC}')); +assertTrue(re.test('\u{1F468}\u200D\u{1F527}')); +assertTrue(re.test('\u{1F468}\u200D\u{1F52C}')); +assertTrue(re.test('\u{1F468}\u200D\u{1F680}')); +assertTrue(re.test('\u{1F468}\u200D\u{1F692}')); +assertTrue(re.test('\u{1F468}\u200D\u{1F9B0}')); +assertTrue(re.test('\u{1F468}\u200D\u{1F9B1}')); +assertTrue(re.test('\u{1F468}\u200D\u{1F9B2}')); +assertTrue(re.test('\u{1F468}\u200D\u{1F9B3}')); +assertTrue(re.test('\u{1F468}\u{1F3FB}\u200D\u2695\uFE0F')); +assertTrue(re.test('\u{1F468}\u{1F3FB}\u200D\u2696\uFE0F')); +assertTrue(re.test('\u{1F468}\u{1F3FB}\u200D\u2708\uFE0F')); +assertTrue(re.test('\u{1F468}\u{1F3FB}\u200D\u{1F33E}')); +assertTrue(re.test('\u{1F468}\u{1F3FB}\u200D\u{1F373}')); +assertTrue(re.test('\u{1F468}\u{1F3FB}\u200D\u{1F393}')); +assertTrue(re.test('\u{1F468}\u{1F3FB}\u200D\u{1F3A4}')); +assertTrue(re.test('\u{1F468}\u{1F3FB}\u200D\u{1F3A8}')); +assertTrue(re.test('\u{1F468}\u{1F3FB}\u200D\u{1F3EB}')); +assertTrue(re.test('\u{1F468}\u{1F3FB}\u200D\u{1F3ED}')); +assertTrue(re.test('\u{1F468}\u{1F3FB}\u200D\u{1F4BB}')); +assertTrue(re.test('\u{1F468}\u{1F3FB}\u200D\u{1F4BC}')); +assertTrue(re.test('\u{1F468}\u{1F3FB}\u200D\u{1F527}')); +assertTrue(re.test('\u{1F468}\u{1F3FB}\u200D\u{1F52C}')); +assertTrue(re.test('\u{1F468}\u{1F3FB}\u200D\u{1F680}')); +assertTrue(re.test('\u{1F468}\u{1F3FB}\u200D\u{1F692}')); +assertTrue(re.test('\u{1F468}\u{1F3FB}\u200D\u{1F9B0}')); +assertTrue(re.test('\u{1F468}\u{1F3FB}\u200D\u{1F9B1}')); +assertTrue(re.test('\u{1F468}\u{1F3FB}\u200D\u{1F9B2}')); +assertTrue(re.test('\u{1F468}\u{1F3FB}\u200D\u{1F9B3}')); +assertTrue(re.test('\u{1F468}\u{1F3FC}\u200D\u2695\uFE0F')); +assertTrue(re.test('\u{1F468}\u{1F3FC}\u200D\u2696\uFE0F')); +assertTrue(re.test('\u{1F468}\u{1F3FC}\u200D\u2708\uFE0F')); +assertTrue(re.test('\u{1F468}\u{1F3FC}\u200D\u{1F33E}')); +assertTrue(re.test('\u{1F468}\u{1F3FC}\u200D\u{1F373}')); +assertTrue(re.test('\u{1F468}\u{1F3FC}\u200D\u{1F393}')); +assertTrue(re.test('\u{1F468}\u{1F3FC}\u200D\u{1F3A4}')); +assertTrue(re.test('\u{1F468}\u{1F3FC}\u200D\u{1F3A8}')); +assertTrue(re.test('\u{1F468}\u{1F3FC}\u200D\u{1F3EB}')); +assertTrue(re.test('\u{1F468}\u{1F3FC}\u200D\u{1F3ED}')); +assertTrue(re.test('\u{1F468}\u{1F3FC}\u200D\u{1F4BB}')); +assertTrue(re.test('\u{1F468}\u{1F3FC}\u200D\u{1F4BC}')); +assertTrue(re.test('\u{1F468}\u{1F3FC}\u200D\u{1F527}')); +assertTrue(re.test('\u{1F468}\u{1F3FC}\u200D\u{1F52C}')); +assertTrue(re.test('\u{1F468}\u{1F3FC}\u200D\u{1F680}')); +assertTrue(re.test('\u{1F468}\u{1F3FC}\u200D\u{1F692}')); +assertTrue(re.test('\u{1F468}\u{1F3FC}\u200D\u{1F9B0}')); +assertTrue(re.test('\u{1F468}\u{1F3FC}\u200D\u{1F9B1}')); +assertTrue(re.test('\u{1F468}\u{1F3FC}\u200D\u{1F9B2}')); +assertTrue(re.test('\u{1F468}\u{1F3FC}\u200D\u{1F9B3}')); +assertTrue(re.test('\u{1F468}\u{1F3FD}\u200D\u2695\uFE0F')); +assertTrue(re.test('\u{1F468}\u{1F3FD}\u200D\u2696\uFE0F')); +assertTrue(re.test('\u{1F468}\u{1F3FD}\u200D\u2708\uFE0F')); +assertTrue(re.test('\u{1F468}\u{1F3FD}\u200D\u{1F33E}')); +assertTrue(re.test('\u{1F468}\u{1F3FD}\u200D\u{1F373}')); +assertTrue(re.test('\u{1F468}\u{1F3FD}\u200D\u{1F393}')); +assertTrue(re.test('\u{1F468}\u{1F3FD}\u200D\u{1F3A4}')); +assertTrue(re.test('\u{1F468}\u{1F3FD}\u200D\u{1F3A8}')); +assertTrue(re.test('\u{1F468}\u{1F3FD}\u200D\u{1F3EB}')); +assertTrue(re.test('\u{1F468}\u{1F3FD}\u200D\u{1F3ED}')); +assertTrue(re.test('\u{1F468}\u{1F3FD}\u200D\u{1F4BB}')); +assertTrue(re.test('\u{1F468}\u{1F3FD}\u200D\u{1F4BC}')); +assertTrue(re.test('\u{1F468}\u{1F3FD}\u200D\u{1F527}')); +assertTrue(re.test('\u{1F468}\u{1F3FD}\u200D\u{1F52C}')); +assertTrue(re.test('\u{1F468}\u{1F3FD}\u200D\u{1F680}')); +assertTrue(re.test('\u{1F468}\u{1F3FD}\u200D\u{1F692}')); +assertTrue(re.test('\u{1F468}\u{1F3FD}\u200D\u{1F9B0}')); +assertTrue(re.test('\u{1F468}\u{1F3FD}\u200D\u{1F9B1}')); +assertTrue(re.test('\u{1F468}\u{1F3FD}\u200D\u{1F9B2}')); +assertTrue(re.test('\u{1F468}\u{1F3FD}\u200D\u{1F9B3}')); +assertTrue(re.test('\u{1F468}\u{1F3FE}\u200D\u2695\uFE0F')); +assertTrue(re.test('\u{1F468}\u{1F3FE}\u200D\u2696\uFE0F')); +assertTrue(re.test('\u{1F468}\u{1F3FE}\u200D\u2708\uFE0F')); +assertTrue(re.test('\u{1F468}\u{1F3FE}\u200D\u{1F33E}')); +assertTrue(re.test('\u{1F468}\u{1F3FE}\u200D\u{1F373}')); +assertTrue(re.test('\u{1F468}\u{1F3FE}\u200D\u{1F393}')); +assertTrue(re.test('\u{1F468}\u{1F3FE}\u200D\u{1F3A4}')); +assertTrue(re.test('\u{1F468}\u{1F3FE}\u200D\u{1F3A8}')); +assertTrue(re.test('\u{1F468}\u{1F3FE}\u200D\u{1F3EB}')); +assertTrue(re.test('\u{1F468}\u{1F3FE}\u200D\u{1F3ED}')); +assertTrue(re.test('\u{1F468}\u{1F3FE}\u200D\u{1F4BB}')); +assertTrue(re.test('\u{1F468}\u{1F3FE}\u200D\u{1F4BC}')); +assertTrue(re.test('\u{1F468}\u{1F3FE}\u200D\u{1F527}')); +assertTrue(re.test('\u{1F468}\u{1F3FE}\u200D\u{1F52C}')); +assertTrue(re.test('\u{1F468}\u{1F3FE}\u200D\u{1F680}')); +assertTrue(re.test('\u{1F468}\u{1F3FE}\u200D\u{1F692}')); +assertTrue(re.test('\u{1F468}\u{1F3FE}\u200D\u{1F9B0}')); +assertTrue(re.test('\u{1F468}\u{1F3FE}\u200D\u{1F9B1}')); +assertTrue(re.test('\u{1F468}\u{1F3FE}\u200D\u{1F9B2}')); +assertTrue(re.test('\u{1F468}\u{1F3FE}\u200D\u{1F9B3}')); +assertTrue(re.test('\u{1F468}\u{1F3FF}\u200D\u2695\uFE0F')); +assertTrue(re.test('\u{1F468}\u{1F3FF}\u200D\u2696\uFE0F')); +assertTrue(re.test('\u{1F468}\u{1F3FF}\u200D\u2708\uFE0F')); +assertTrue(re.test('\u{1F468}\u{1F3FF}\u200D\u{1F33E}')); +assertTrue(re.test('\u{1F468}\u{1F3FF}\u200D\u{1F373}')); +assertTrue(re.test('\u{1F468}\u{1F3FF}\u200D\u{1F393}')); +assertTrue(re.test('\u{1F468}\u{1F3FF}\u200D\u{1F3A4}')); +assertTrue(re.test('\u{1F468}\u{1F3FF}\u200D\u{1F3A8}')); +assertTrue(re.test('\u{1F468}\u{1F3FF}\u200D\u{1F3EB}')); +assertTrue(re.test('\u{1F468}\u{1F3FF}\u200D\u{1F3ED}')); +assertTrue(re.test('\u{1F468}\u{1F3FF}\u200D\u{1F4BB}')); +assertTrue(re.test('\u{1F468}\u{1F3FF}\u200D\u{1F4BC}')); +assertTrue(re.test('\u{1F468}\u{1F3FF}\u200D\u{1F527}')); +assertTrue(re.test('\u{1F468}\u{1F3FF}\u200D\u{1F52C}')); +assertTrue(re.test('\u{1F468}\u{1F3FF}\u200D\u{1F680}')); +assertTrue(re.test('\u{1F468}\u{1F3FF}\u200D\u{1F692}')); +assertTrue(re.test('\u{1F468}\u{1F3FF}\u200D\u{1F9B0}')); +assertTrue(re.test('\u{1F468}\u{1F3FF}\u200D\u{1F9B1}')); +assertTrue(re.test('\u{1F468}\u{1F3FF}\u200D\u{1F9B2}')); +assertTrue(re.test('\u{1F468}\u{1F3FF}\u200D\u{1F9B3}')); +assertTrue(re.test('\u{1F469}\u200D\u2695\uFE0F')); +assertTrue(re.test('\u{1F469}\u200D\u2696\uFE0F')); +assertTrue(re.test('\u{1F469}\u200D\u2708\uFE0F')); +assertTrue(re.test('\u{1F469}\u200D\u{1F33E}')); +assertTrue(re.test('\u{1F469}\u200D\u{1F373}')); +assertTrue(re.test('\u{1F469}\u200D\u{1F393}')); +assertTrue(re.test('\u{1F469}\u200D\u{1F3A4}')); +assertTrue(re.test('\u{1F469}\u200D\u{1F3A8}')); +assertTrue(re.test('\u{1F469}\u200D\u{1F3EB}')); +assertTrue(re.test('\u{1F469}\u200D\u{1F3ED}')); +assertTrue(re.test('\u{1F469}\u200D\u{1F4BB}')); +assertTrue(re.test('\u{1F469}\u200D\u{1F4BC}')); +assertTrue(re.test('\u{1F469}\u200D\u{1F527}')); +assertTrue(re.test('\u{1F469}\u200D\u{1F52C}')); +assertTrue(re.test('\u{1F469}\u200D\u{1F680}')); +assertTrue(re.test('\u{1F469}\u200D\u{1F692}')); +assertTrue(re.test('\u{1F469}\u200D\u{1F9B0}')); +assertTrue(re.test('\u{1F469}\u200D\u{1F9B1}')); +assertTrue(re.test('\u{1F469}\u200D\u{1F9B2}')); +assertTrue(re.test('\u{1F469}\u200D\u{1F9B3}')); +assertTrue(re.test('\u{1F469}\u{1F3FB}\u200D\u2695\uFE0F')); +assertTrue(re.test('\u{1F469}\u{1F3FB}\u200D\u2696\uFE0F')); +assertTrue(re.test('\u{1F469}\u{1F3FB}\u200D\u2708\uFE0F')); +assertTrue(re.test('\u{1F469}\u{1F3FB}\u200D\u{1F33E}')); +assertTrue(re.test('\u{1F469}\u{1F3FB}\u200D\u{1F373}')); +assertTrue(re.test('\u{1F469}\u{1F3FB}\u200D\u{1F393}')); +assertTrue(re.test('\u{1F469}\u{1F3FB}\u200D\u{1F3A4}')); +assertTrue(re.test('\u{1F469}\u{1F3FB}\u200D\u{1F3A8}')); +assertTrue(re.test('\u{1F469}\u{1F3FB}\u200D\u{1F3EB}')); +assertTrue(re.test('\u{1F469}\u{1F3FB}\u200D\u{1F3ED}')); +assertTrue(re.test('\u{1F469}\u{1F3FB}\u200D\u{1F4BB}')); +assertTrue(re.test('\u{1F469}\u{1F3FB}\u200D\u{1F4BC}')); +assertTrue(re.test('\u{1F469}\u{1F3FB}\u200D\u{1F527}')); +assertTrue(re.test('\u{1F469}\u{1F3FB}\u200D\u{1F52C}')); +assertTrue(re.test('\u{1F469}\u{1F3FB}\u200D\u{1F680}')); +assertTrue(re.test('\u{1F469}\u{1F3FB}\u200D\u{1F692}')); +assertTrue(re.test('\u{1F469}\u{1F3FB}\u200D\u{1F9B0}')); +assertTrue(re.test('\u{1F469}\u{1F3FB}\u200D\u{1F9B1}')); +assertTrue(re.test('\u{1F469}\u{1F3FB}\u200D\u{1F9B2}')); +assertTrue(re.test('\u{1F469}\u{1F3FB}\u200D\u{1F9B3}')); +assertTrue(re.test('\u{1F469}\u{1F3FC}\u200D\u2695\uFE0F')); +assertTrue(re.test('\u{1F469}\u{1F3FC}\u200D\u2696\uFE0F')); +assertTrue(re.test('\u{1F469}\u{1F3FC}\u200D\u2708\uFE0F')); +assertTrue(re.test('\u{1F469}\u{1F3FC}\u200D\u{1F33E}')); +assertTrue(re.test('\u{1F469}\u{1F3FC}\u200D\u{1F373}')); +assertTrue(re.test('\u{1F469}\u{1F3FC}\u200D\u{1F393}')); +assertTrue(re.test('\u{1F469}\u{1F3FC}\u200D\u{1F3A4}')); +assertTrue(re.test('\u{1F469}\u{1F3FC}\u200D\u{1F3A8}')); +assertTrue(re.test('\u{1F469}\u{1F3FC}\u200D\u{1F3EB}')); +assertTrue(re.test('\u{1F469}\u{1F3FC}\u200D\u{1F3ED}')); +assertTrue(re.test('\u{1F469}\u{1F3FC}\u200D\u{1F4BB}')); +assertTrue(re.test('\u{1F469}\u{1F3FC}\u200D\u{1F4BC}')); +assertTrue(re.test('\u{1F469}\u{1F3FC}\u200D\u{1F527}')); +assertTrue(re.test('\u{1F469}\u{1F3FC}\u200D\u{1F52C}')); +assertTrue(re.test('\u{1F469}\u{1F3FC}\u200D\u{1F680}')); +assertTrue(re.test('\u{1F469}\u{1F3FC}\u200D\u{1F692}')); +assertTrue(re.test('\u{1F469}\u{1F3FC}\u200D\u{1F9B0}')); +assertTrue(re.test('\u{1F469}\u{1F3FC}\u200D\u{1F9B1}')); +assertTrue(re.test('\u{1F469}\u{1F3FC}\u200D\u{1F9B2}')); +assertTrue(re.test('\u{1F469}\u{1F3FC}\u200D\u{1F9B3}')); +assertTrue(re.test('\u{1F469}\u{1F3FD}\u200D\u2695\uFE0F')); +assertTrue(re.test('\u{1F469}\u{1F3FD}\u200D\u2696\uFE0F')); +assertTrue(re.test('\u{1F469}\u{1F3FD}\u200D\u2708\uFE0F')); +assertTrue(re.test('\u{1F469}\u{1F3FD}\u200D\u{1F33E}')); +assertTrue(re.test('\u{1F469}\u{1F3FD}\u200D\u{1F373}')); +assertTrue(re.test('\u{1F469}\u{1F3FD}\u200D\u{1F393}')); +assertTrue(re.test('\u{1F469}\u{1F3FD}\u200D\u{1F3A4}')); +assertTrue(re.test('\u{1F469}\u{1F3FD}\u200D\u{1F3A8}')); +assertTrue(re.test('\u{1F469}\u{1F3FD}\u200D\u{1F3EB}')); +assertTrue(re.test('\u{1F469}\u{1F3FD}\u200D\u{1F3ED}')); +assertTrue(re.test('\u{1F469}\u{1F3FD}\u200D\u{1F4BB}')); +assertTrue(re.test('\u{1F469}\u{1F3FD}\u200D\u{1F4BC}')); +assertTrue(re.test('\u{1F469}\u{1F3FD}\u200D\u{1F527}')); +assertTrue(re.test('\u{1F469}\u{1F3FD}\u200D\u{1F52C}')); +assertTrue(re.test('\u{1F469}\u{1F3FD}\u200D\u{1F680}')); +assertTrue(re.test('\u{1F469}\u{1F3FD}\u200D\u{1F692}')); +assertTrue(re.test('\u{1F469}\u{1F3FD}\u200D\u{1F9B0}')); +assertTrue(re.test('\u{1F469}\u{1F3FD}\u200D\u{1F9B1}')); +assertTrue(re.test('\u{1F469}\u{1F3FD}\u200D\u{1F9B2}')); +assertTrue(re.test('\u{1F469}\u{1F3FD}\u200D\u{1F9B3}')); +assertTrue(re.test('\u{1F469}\u{1F3FE}\u200D\u2695\uFE0F')); +assertTrue(re.test('\u{1F469}\u{1F3FE}\u200D\u2696\uFE0F')); +assertTrue(re.test('\u{1F469}\u{1F3FE}\u200D\u2708\uFE0F')); +assertTrue(re.test('\u{1F469}\u{1F3FE}\u200D\u{1F33E}')); +assertTrue(re.test('\u{1F469}\u{1F3FE}\u200D\u{1F373}')); +assertTrue(re.test('\u{1F469}\u{1F3FE}\u200D\u{1F393}')); +assertTrue(re.test('\u{1F469}\u{1F3FE}\u200D\u{1F3A4}')); +assertTrue(re.test('\u{1F469}\u{1F3FE}\u200D\u{1F3A8}')); +assertTrue(re.test('\u{1F469}\u{1F3FE}\u200D\u{1F3EB}')); +assertTrue(re.test('\u{1F469}\u{1F3FE}\u200D\u{1F3ED}')); +assertTrue(re.test('\u{1F469}\u{1F3FE}\u200D\u{1F4BB}')); +assertTrue(re.test('\u{1F469}\u{1F3FE}\u200D\u{1F4BC}')); +assertTrue(re.test('\u{1F469}\u{1F3FE}\u200D\u{1F527}')); +assertTrue(re.test('\u{1F469}\u{1F3FE}\u200D\u{1F52C}')); +assertTrue(re.test('\u{1F469}\u{1F3FE}\u200D\u{1F680}')); +assertTrue(re.test('\u{1F469}\u{1F3FE}\u200D\u{1F692}')); +assertTrue(re.test('\u{1F469}\u{1F3FE}\u200D\u{1F9B0}')); +assertTrue(re.test('\u{1F469}\u{1F3FE}\u200D\u{1F9B1}')); +assertTrue(re.test('\u{1F469}\u{1F3FE}\u200D\u{1F9B2}')); +assertTrue(re.test('\u{1F469}\u{1F3FE}\u200D\u{1F9B3}')); +assertTrue(re.test('\u{1F469}\u{1F3FF}\u200D\u2695\uFE0F')); +assertTrue(re.test('\u{1F469}\u{1F3FF}\u200D\u2696\uFE0F')); +assertTrue(re.test('\u{1F469}\u{1F3FF}\u200D\u2708\uFE0F')); +assertTrue(re.test('\u{1F469}\u{1F3FF}\u200D\u{1F33E}')); +assertTrue(re.test('\u{1F469}\u{1F3FF}\u200D\u{1F373}')); +assertTrue(re.test('\u{1F469}\u{1F3FF}\u200D\u{1F393}')); +assertTrue(re.test('\u{1F469}\u{1F3FF}\u200D\u{1F3A4}')); +assertTrue(re.test('\u{1F469}\u{1F3FF}\u200D\u{1F3A8}')); +assertTrue(re.test('\u{1F469}\u{1F3FF}\u200D\u{1F3EB}')); +assertTrue(re.test('\u{1F469}\u{1F3FF}\u200D\u{1F3ED}')); +assertTrue(re.test('\u{1F469}\u{1F3FF}\u200D\u{1F4BB}')); +assertTrue(re.test('\u{1F469}\u{1F3FF}\u200D\u{1F4BC}')); +assertTrue(re.test('\u{1F469}\u{1F3FF}\u200D\u{1F527}')); +assertTrue(re.test('\u{1F469}\u{1F3FF}\u200D\u{1F52C}')); +assertTrue(re.test('\u{1F469}\u{1F3FF}\u200D\u{1F680}')); +assertTrue(re.test('\u{1F469}\u{1F3FF}\u200D\u{1F692}')); +assertTrue(re.test('\u{1F469}\u{1F3FF}\u200D\u{1F9B0}')); +assertTrue(re.test('\u{1F469}\u{1F3FF}\u200D\u{1F9B1}')); +assertTrue(re.test('\u{1F469}\u{1F3FF}\u200D\u{1F9B2}')); +assertTrue(re.test('\u{1F469}\u{1F3FF}\u200D\u{1F9B3}')); +assertTrue(re.test('\u{1F46E}\u200D\u2640\uFE0F')); +assertTrue(re.test('\u{1F46E}\u200D\u2642\uFE0F')); +assertTrue(re.test('\u{1F46E}\u{1F3FB}\u200D\u2640\uFE0F')); +assertTrue(re.test('\u{1F46E}\u{1F3FB}\u200D\u2642\uFE0F')); +assertTrue(re.test('\u{1F46E}\u{1F3FC}\u200D\u2640\uFE0F')); +assertTrue(re.test('\u{1F46E}\u{1F3FC}\u200D\u2642\uFE0F')); +assertTrue(re.test('\u{1F46E}\u{1F3FD}\u200D\u2640\uFE0F')); +assertTrue(re.test('\u{1F46E}\u{1F3FD}\u200D\u2642\uFE0F')); +assertTrue(re.test('\u{1F46E}\u{1F3FE}\u200D\u2640\uFE0F')); +assertTrue(re.test('\u{1F46E}\u{1F3FE}\u200D\u2642\uFE0F')); +assertTrue(re.test('\u{1F46E}\u{1F3FF}\u200D\u2640\uFE0F')); +assertTrue(re.test('\u{1F46E}\u{1F3FF}\u200D\u2642\uFE0F')); +assertTrue(re.test('\u{1F471}\u200D\u2640\uFE0F')); +assertTrue(re.test('\u{1F471}\u200D\u2642\uFE0F')); +assertTrue(re.test('\u{1F471}\u{1F3FB}\u200D\u2640\uFE0F')); +assertTrue(re.test('\u{1F471}\u{1F3FB}\u200D\u2642\uFE0F')); +assertTrue(re.test('\u{1F471}\u{1F3FC}\u200D\u2640\uFE0F')); +assertTrue(re.test('\u{1F471}\u{1F3FC}\u200D\u2642\uFE0F')); +assertTrue(re.test('\u{1F471}\u{1F3FD}\u200D\u2640\uFE0F')); +assertTrue(re.test('\u{1F471}\u{1F3FD}\u200D\u2642\uFE0F')); +assertTrue(re.test('\u{1F471}\u{1F3FE}\u200D\u2640\uFE0F')); +assertTrue(re.test('\u{1F471}\u{1F3FE}\u200D\u2642\uFE0F')); +assertTrue(re.test('\u{1F471}\u{1F3FF}\u200D\u2640\uFE0F')); +assertTrue(re.test('\u{1F471}\u{1F3FF}\u200D\u2642\uFE0F')); +assertTrue(re.test('\u{1F473}\u200D\u2640\uFE0F')); +assertTrue(re.test('\u{1F473}\u200D\u2642\uFE0F')); +assertTrue(re.test('\u{1F473}\u{1F3FB}\u200D\u2640\uFE0F')); +assertTrue(re.test('\u{1F473}\u{1F3FB}\u200D\u2642\uFE0F')); +assertTrue(re.test('\u{1F473}\u{1F3FC}\u200D\u2640\uFE0F')); +assertTrue(re.test('\u{1F473}\u{1F3FC}\u200D\u2642\uFE0F')); +assertTrue(re.test('\u{1F473}\u{1F3FD}\u200D\u2640\uFE0F')); +assertTrue(re.test('\u{1F473}\u{1F3FD}\u200D\u2642\uFE0F')); +assertTrue(re.test('\u{1F473}\u{1F3FE}\u200D\u2640\uFE0F')); +assertTrue(re.test('\u{1F473}\u{1F3FE}\u200D\u2642\uFE0F')); +assertTrue(re.test('\u{1F473}\u{1F3FF}\u200D\u2640\uFE0F')); +assertTrue(re.test('\u{1F473}\u{1F3FF}\u200D\u2642\uFE0F')); +assertTrue(re.test('\u{1F477}\u200D\u2640\uFE0F')); +assertTrue(re.test('\u{1F477}\u200D\u2642\uFE0F')); +assertTrue(re.test('\u{1F477}\u{1F3FB}\u200D\u2640\uFE0F')); +assertTrue(re.test('\u{1F477}\u{1F3FB}\u200D\u2642\uFE0F')); +assertTrue(re.test('\u{1F477}\u{1F3FC}\u200D\u2640\uFE0F')); +assertTrue(re.test('\u{1F477}\u{1F3FC}\u200D\u2642\uFE0F')); +assertTrue(re.test('\u{1F477}\u{1F3FD}\u200D\u2640\uFE0F')); +assertTrue(re.test('\u{1F477}\u{1F3FD}\u200D\u2642\uFE0F')); +assertTrue(re.test('\u{1F477}\u{1F3FE}\u200D\u2640\uFE0F')); +assertTrue(re.test('\u{1F477}\u{1F3FE}\u200D\u2642\uFE0F')); +assertTrue(re.test('\u{1F477}\u{1F3FF}\u200D\u2640\uFE0F')); +assertTrue(re.test('\u{1F477}\u{1F3FF}\u200D\u2642\uFE0F')); +assertTrue(re.test('\u{1F482}\u200D\u2640\uFE0F')); +assertTrue(re.test('\u{1F482}\u200D\u2642\uFE0F')); +assertTrue(re.test('\u{1F482}\u{1F3FB}\u200D\u2640\uFE0F')); +assertTrue(re.test('\u{1F482}\u{1F3FB}\u200D\u2642\uFE0F')); +assertTrue(re.test('\u{1F482}\u{1F3FC}\u200D\u2640\uFE0F')); +assertTrue(re.test('\u{1F482}\u{1F3FC}\u200D\u2642\uFE0F')); +assertTrue(re.test('\u{1F482}\u{1F3FD}\u200D\u2640\uFE0F')); +assertTrue(re.test('\u{1F482}\u{1F3FD}\u200D\u2642\uFE0F')); +assertTrue(re.test('\u{1F482}\u{1F3FE}\u200D\u2640\uFE0F')); +assertTrue(re.test('\u{1F482}\u{1F3FE}\u200D\u2642\uFE0F')); +assertTrue(re.test('\u{1F482}\u{1F3FF}\u200D\u2640\uFE0F')); +assertTrue(re.test('\u{1F482}\u{1F3FF}\u200D\u2642\uFE0F')); +assertTrue(re.test('\u{1F575}\u{1F3FB}\u200D\u2640\uFE0F')); +assertTrue(re.test('\u{1F575}\u{1F3FB}\u200D\u2642\uFE0F')); +assertTrue(re.test('\u{1F575}\u{1F3FC}\u200D\u2640\uFE0F')); +assertTrue(re.test('\u{1F575}\u{1F3FC}\u200D\u2642\uFE0F')); +assertTrue(re.test('\u{1F575}\u{1F3FD}\u200D\u2640\uFE0F')); +assertTrue(re.test('\u{1F575}\u{1F3FD}\u200D\u2642\uFE0F')); +assertTrue(re.test('\u{1F575}\u{1F3FE}\u200D\u2640\uFE0F')); +assertTrue(re.test('\u{1F575}\u{1F3FE}\u200D\u2642\uFE0F')); +assertTrue(re.test('\u{1F575}\u{1F3FF}\u200D\u2640\uFE0F')); +assertTrue(re.test('\u{1F575}\u{1F3FF}\u200D\u2642\uFE0F')); +assertTrue(re.test('\u{1F575}\uFE0F\u200D\u2640\uFE0F')); +assertTrue(re.test('\u{1F575}\uFE0F\u200D\u2642\uFE0F')); +assertTrue(re.test('\u{1F9D9}\u200D\u2640\uFE0F')); +assertTrue(re.test('\u{1F9D9}\u200D\u2642\uFE0F')); +assertTrue(re.test('\u{1F9D9}\u{1F3FB}\u200D\u2640\uFE0F')); +assertTrue(re.test('\u{1F9D9}\u{1F3FB}\u200D\u2642\uFE0F')); +assertTrue(re.test('\u{1F9D9}\u{1F3FC}\u200D\u2640\uFE0F')); +assertTrue(re.test('\u{1F9D9}\u{1F3FC}\u200D\u2642\uFE0F')); +assertTrue(re.test('\u{1F9D9}\u{1F3FD}\u200D\u2640\uFE0F')); +assertTrue(re.test('\u{1F9D9}\u{1F3FD}\u200D\u2642\uFE0F')); +assertTrue(re.test('\u{1F9D9}\u{1F3FE}\u200D\u2640\uFE0F')); +assertTrue(re.test('\u{1F9D9}\u{1F3FE}\u200D\u2642\uFE0F')); +assertTrue(re.test('\u{1F9D9}\u{1F3FF}\u200D\u2640\uFE0F')); +assertTrue(re.test('\u{1F9D9}\u{1F3FF}\u200D\u2642\uFE0F')); +assertTrue(re.test('\u{1F9DA}\u200D\u2640\uFE0F')); +assertTrue(re.test('\u{1F9DA}\u200D\u2642\uFE0F')); +assertTrue(re.test('\u{1F9DA}\u{1F3FB}\u200D\u2640\uFE0F')); +assertTrue(re.test('\u{1F9DA}\u{1F3FB}\u200D\u2642\uFE0F')); +assertTrue(re.test('\u{1F9DA}\u{1F3FC}\u200D\u2640\uFE0F')); +assertTrue(re.test('\u{1F9DA}\u{1F3FC}\u200D\u2642\uFE0F')); +assertTrue(re.test('\u{1F9DA}\u{1F3FD}\u200D\u2640\uFE0F')); +assertTrue(re.test('\u{1F9DA}\u{1F3FD}\u200D\u2642\uFE0F')); +assertTrue(re.test('\u{1F9DA}\u{1F3FE}\u200D\u2640\uFE0F')); +assertTrue(re.test('\u{1F9DA}\u{1F3FE}\u200D\u2642\uFE0F')); +assertTrue(re.test('\u{1F9DA}\u{1F3FF}\u200D\u2640\uFE0F')); +assertTrue(re.test('\u{1F9DA}\u{1F3FF}\u200D\u2642\uFE0F')); +assertTrue(re.test('\u{1F9DB}\u200D\u2640\uFE0F')); +assertTrue(re.test('\u{1F9DB}\u200D\u2642\uFE0F')); +assertTrue(re.test('\u{1F9DB}\u{1F3FB}\u200D\u2640\uFE0F')); +assertTrue(re.test('\u{1F9DB}\u{1F3FB}\u200D\u2642\uFE0F')); +assertTrue(re.test('\u{1F9DB}\u{1F3FC}\u200D\u2640\uFE0F')); +assertTrue(re.test('\u{1F9DB}\u{1F3FC}\u200D\u2642\uFE0F')); +assertTrue(re.test('\u{1F9DB}\u{1F3FD}\u200D\u2640\uFE0F')); +assertTrue(re.test('\u{1F9DB}\u{1F3FD}\u200D\u2642\uFE0F')); +assertTrue(re.test('\u{1F9DB}\u{1F3FE}\u200D\u2640\uFE0F')); +assertTrue(re.test('\u{1F9DB}\u{1F3FE}\u200D\u2642\uFE0F')); +assertTrue(re.test('\u{1F9DB}\u{1F3FF}\u200D\u2640\uFE0F')); +assertTrue(re.test('\u{1F9DB}\u{1F3FF}\u200D\u2642\uFE0F')); +assertTrue(re.test('\u{1F9DC}\u200D\u2640\uFE0F')); +assertTrue(re.test('\u{1F9DC}\u200D\u2642\uFE0F')); +assertTrue(re.test('\u{1F9DC}\u{1F3FB}\u200D\u2640\uFE0F')); +assertTrue(re.test('\u{1F9DC}\u{1F3FB}\u200D\u2642\uFE0F')); +assertTrue(re.test('\u{1F9DC}\u{1F3FC}\u200D\u2640\uFE0F')); +assertTrue(re.test('\u{1F9DC}\u{1F3FC}\u200D\u2642\uFE0F')); +assertTrue(re.test('\u{1F9DC}\u{1F3FD}\u200D\u2640\uFE0F')); +assertTrue(re.test('\u{1F9DC}\u{1F3FD}\u200D\u2642\uFE0F')); +assertTrue(re.test('\u{1F468}\u200D\u2764\uFE0F\u200D\u{1F48B}\u200D\u{1F468}')); +assertTrue(re.test('\u{1F9DC}\u{1F3FE}\u200D\u2642\uFE0F')); +assertTrue(re.test('\u{1F9DC}\u{1F3FF}\u200D\u2640\uFE0F')); +assertTrue(re.test('\u{1F9DC}\u{1F3FF}\u200D\u2642\uFE0F')); +assertTrue(re.test('\u{1F9DD}\u200D\u2640\uFE0F')); +assertTrue(re.test('\u{1F9DD}\u200D\u2642\uFE0F')); +assertTrue(re.test('\u{1F9DD}\u{1F3FB}\u200D\u2640\uFE0F')); +assertTrue(re.test('\u{1F9DD}\u{1F3FB}\u200D\u2642\uFE0F')); +assertTrue(re.test('\u{1F9DD}\u{1F3FC}\u200D\u2640\uFE0F')); +assertTrue(re.test('\u{1F9DD}\u{1F3FC}\u200D\u2642\uFE0F')); +assertTrue(re.test('\u{1F9DD}\u{1F3FD}\u200D\u2640\uFE0F')); +assertTrue(re.test('\u{1F9DD}\u{1F3FD}\u200D\u2642\uFE0F')); +assertTrue(re.test('\u{1F9DD}\u{1F3FE}\u200D\u2640\uFE0F')); +assertTrue(re.test('\u{1F9DD}\u{1F3FE}\u200D\u2642\uFE0F')); +assertTrue(re.test('\u{1F9DD}\u{1F3FF}\u200D\u2640\uFE0F')); +assertTrue(re.test('\u{1F9DD}\u{1F3FF}\u200D\u2642\uFE0F')); +assertTrue(re.test('\u{1F9DE}\u200D\u2640\uFE0F')); +assertTrue(re.test('\u{1F9DE}\u200D\u2642\uFE0F')); +assertTrue(re.test('\u{1F9DF}\u200D\u2640\uFE0F')); +assertTrue(re.test('\u{1F9DF}\u200D\u2642\uFE0F')); +assertTrue(re.test('\u26F9\u{1F3FB}\u200D\u2640\uFE0F')); +assertTrue(re.test('\u26F9\u{1F3FB}\u200D\u2642\uFE0F')); +assertTrue(re.test('\u26F9\u{1F3FC}\u200D\u2640\uFE0F')); +assertTrue(re.test('\u26F9\u{1F3FC}\u200D\u2642\uFE0F')); +assertTrue(re.test('\u26F9\u{1F3FD}\u200D\u2640\uFE0F')); +assertTrue(re.test('\u26F9\u{1F3FD}\u200D\u2642\uFE0F')); +assertTrue(re.test('\u26F9\u{1F3FE}\u200D\u2640\uFE0F')); +assertTrue(re.test('\u26F9\u{1F3FE}\u200D\u2642\uFE0F')); +assertTrue(re.test('\u26F9\u{1F3FF}\u200D\u2640\uFE0F')); +assertTrue(re.test('\u26F9\u{1F3FF}\u200D\u2642\uFE0F')); +assertTrue(re.test('\u26F9\uFE0F\u200D\u2640\uFE0F')); +assertTrue(re.test('\u26F9\uFE0F\u200D\u2642\uFE0F')); +assertTrue(re.test('\u{1F3C3}\u200D\u2640\uFE0F')); +assertTrue(re.test('\u{1F3C3}\u200D\u2642\uFE0F')); +assertTrue(re.test('\u{1F3C3}\u{1F3FB}\u200D\u2640\uFE0F')); +assertTrue(re.test('\u{1F3C3}\u{1F3FB}\u200D\u2642\uFE0F')); +assertTrue(re.test('\u{1F3C3}\u{1F3FC}\u200D\u2640\uFE0F')); +assertTrue(re.test('\u{1F3C3}\u{1F3FC}\u200D\u2642\uFE0F')); +assertTrue(re.test('\u{1F3C3}\u{1F3FD}\u200D\u2640\uFE0F')); +assertTrue(re.test('\u{1F3C3}\u{1F3FD}\u200D\u2642\uFE0F')); +assertTrue(re.test('\u{1F3C3}\u{1F3FE}\u200D\u2640\uFE0F')); +assertTrue(re.test('\u{1F3C3}\u{1F3FE}\u200D\u2642\uFE0F')); +assertTrue(re.test('\u{1F3C3}\u{1F3FF}\u200D\u2640\uFE0F')); +assertTrue(re.test('\u{1F3C3}\u{1F3FF}\u200D\u2642\uFE0F')); +assertTrue(re.test('\u{1F3C4}\u200D\u2640\uFE0F')); +assertTrue(re.test('\u{1F3C4}\u200D\u2642\uFE0F')); +assertTrue(re.test('\u{1F3C4}\u{1F3FB}\u200D\u2640\uFE0F')); +assertTrue(re.test('\u{1F3C4}\u{1F3FB}\u200D\u2642\uFE0F')); +assertTrue(re.test('\u{1F3C4}\u{1F3FC}\u200D\u2640\uFE0F')); +assertTrue(re.test('\u{1F3C4}\u{1F3FC}\u200D\u2642\uFE0F')); +assertTrue(re.test('\u{1F3C4}\u{1F3FD}\u200D\u2640\uFE0F')); +assertTrue(re.test('\u{1F3C4}\u{1F3FD}\u200D\u2642\uFE0F')); +assertTrue(re.test('\u{1F3C4}\u{1F3FE}\u200D\u2640\uFE0F')); +assertTrue(re.test('\u{1F3C4}\u{1F3FE}\u200D\u2642\uFE0F')); +assertTrue(re.test('\u{1F3C4}\u{1F3FF}\u200D\u2640\uFE0F')); +assertTrue(re.test('\u{1F3C4}\u{1F3FF}\u200D\u2642\uFE0F')); +assertTrue(re.test('\u{1F3CA}\u200D\u2640\uFE0F')); +assertTrue(re.test('\u{1F3CA}\u200D\u2642\uFE0F')); +assertTrue(re.test('\u{1F3CA}\u{1F3FB}\u200D\u2640\uFE0F')); +assertTrue(re.test('\u{1F3CA}\u{1F3FB}\u200D\u2642\uFE0F')); +assertTrue(re.test('\u{1F3CA}\u{1F3FC}\u200D\u2640\uFE0F')); +assertTrue(re.test('\u{1F3CA}\u{1F3FC}\u200D\u2642\uFE0F')); +assertTrue(re.test('\u{1F3CA}\u{1F3FD}\u200D\u2640\uFE0F')); +assertTrue(re.test('\u{1F3CA}\u{1F3FD}\u200D\u2642\uFE0F')); +assertTrue(re.test('\u{1F3CA}\u{1F3FE}\u200D\u2640\uFE0F')); +assertTrue(re.test('\u{1F3CA}\u{1F3FE}\u200D\u2642\uFE0F')); +assertTrue(re.test('\u{1F3CA}\u{1F3FF}\u200D\u2640\uFE0F')); +assertTrue(re.test('\u{1F3CA}\u{1F3FF}\u200D\u2642\uFE0F')); +assertTrue(re.test('\u{1F3CB}\u{1F3FB}\u200D\u2640\uFE0F')); +assertTrue(re.test('\u{1F3CB}\u{1F3FB}\u200D\u2642\uFE0F')); +assertTrue(re.test('\u{1F3CB}\u{1F3FC}\u200D\u2640\uFE0F')); +assertTrue(re.test('\u{1F3CB}\u{1F3FC}\u200D\u2642\uFE0F')); +assertTrue(re.test('\u{1F3CB}\u{1F3FD}\u200D\u2640\uFE0F')); +assertTrue(re.test('\u{1F3CB}\u{1F3FD}\u200D\u2642\uFE0F')); +assertTrue(re.test('\u{1F3CB}\u{1F3FE}\u200D\u2640\uFE0F')); +assertTrue(re.test('\u{1F3CB}\u{1F3FE}\u200D\u2642\uFE0F')); +assertTrue(re.test('\u{1F3CB}\u{1F3FF}\u200D\u2640\uFE0F')); +assertTrue(re.test('\u{1F3CB}\u{1F3FF}\u200D\u2642\uFE0F')); +assertTrue(re.test('\u{1F3CB}\uFE0F\u200D\u2640\uFE0F')); +assertTrue(re.test('\u{1F3CB}\uFE0F\u200D\u2642\uFE0F')); +assertTrue(re.test('\u{1F3CC}\u{1F3FB}\u200D\u2640\uFE0F')); +assertTrue(re.test('\u{1F3CC}\u{1F3FB}\u200D\u2642\uFE0F')); +assertTrue(re.test('\u{1F3CC}\u{1F3FC}\u200D\u2640\uFE0F')); +assertTrue(re.test('\u{1F3CC}\u{1F3FC}\u200D\u2642\uFE0F')); +assertTrue(re.test('\u{1F3CC}\u{1F3FD}\u200D\u2640\uFE0F')); +assertTrue(re.test('\u{1F3CC}\u{1F3FD}\u200D\u2642\uFE0F')); +assertTrue(re.test('\u{1F3CC}\u{1F3FE}\u200D\u2640\uFE0F')); +assertTrue(re.test('\u{1F3CC}\u{1F3FE}\u200D\u2642\uFE0F')); +assertTrue(re.test('\u{1F3CC}\u{1F3FF}\u200D\u2640\uFE0F')); +assertTrue(re.test('\u{1F3CC}\u{1F3FF}\u200D\u2642\uFE0F')); +assertTrue(re.test('\u{1F3CC}\uFE0F\u200D\u2640\uFE0F')); +assertTrue(re.test('\u{1F3CC}\uFE0F\u200D\u2642\uFE0F')); +assertTrue(re.test('\u{1F46F}\u200D\u2640\uFE0F')); +assertTrue(re.test('\u{1F46F}\u200D\u2642\uFE0F')); +assertTrue(re.test('\u{1F486}\u200D\u2640\uFE0F')); +assertTrue(re.test('\u{1F486}\u200D\u2642\uFE0F')); +assertTrue(re.test('\u{1F486}\u{1F3FB}\u200D\u2640\uFE0F')); +assertTrue(re.test('\u{1F486}\u{1F3FB}\u200D\u2642\uFE0F')); +assertTrue(re.test('\u{1F486}\u{1F3FC}\u200D\u2640\uFE0F')); +assertTrue(re.test('\u{1F486}\u{1F3FC}\u200D\u2642\uFE0F')); +assertTrue(re.test('\u{1F486}\u{1F3FD}\u200D\u2640\uFE0F')); +assertTrue(re.test('\u{1F486}\u{1F3FD}\u200D\u2642\uFE0F')); +assertTrue(re.test('\u{1F486}\u{1F3FE}\u200D\u2640\uFE0F')); +assertTrue(re.test('\u{1F486}\u{1F3FE}\u200D\u2642\uFE0F')); +assertTrue(re.test('\u{1F486}\u{1F3FF}\u200D\u2640\uFE0F')); +assertTrue(re.test('\u{1F486}\u{1F3FF}\u200D\u2642\uFE0F')); +assertTrue(re.test('\u{1F487}\u200D\u2640\uFE0F')); +assertTrue(re.test('\u{1F487}\u200D\u2642\uFE0F')); +assertTrue(re.test('\u{1F487}\u{1F3FB}\u200D\u2640\uFE0F')); +assertTrue(re.test('\u{1F487}\u{1F3FB}\u200D\u2642\uFE0F')); +assertTrue(re.test('\u{1F487}\u{1F3FC}\u200D\u2640\uFE0F')); +assertTrue(re.test('\u{1F487}\u{1F3FC}\u200D\u2642\uFE0F')); +assertTrue(re.test('\u{1F487}\u{1F3FD}\u200D\u2640\uFE0F')); +assertTrue(re.test('\u{1F487}\u{1F3FD}\u200D\u2642\uFE0F')); +assertTrue(re.test('\u{1F487}\u{1F3FE}\u200D\u2640\uFE0F')); +assertTrue(re.test('\u{1F487}\u{1F3FE}\u200D\u2642\uFE0F')); +assertTrue(re.test('\u{1F487}\u{1F3FF}\u200D\u2640\uFE0F')); +assertTrue(re.test('\u{1F487}\u{1F3FF}\u200D\u2642\uFE0F')); +assertTrue(re.test('\u{1F6A3}\u200D\u2640\uFE0F')); +assertTrue(re.test('\u{1F6A3}\u200D\u2642\uFE0F')); +assertTrue(re.test('\u{1F6A3}\u{1F3FB}\u200D\u2640\uFE0F')); +assertTrue(re.test('\u{1F6A3}\u{1F3FB}\u200D\u2642\uFE0F')); +assertTrue(re.test('\u{1F6A3}\u{1F3FC}\u200D\u2640\uFE0F')); +assertTrue(re.test('\u{1F6A3}\u{1F3FC}\u200D\u2642\uFE0F')); +assertTrue(re.test('\u{1F6A3}\u{1F3FD}\u200D\u2640\uFE0F')); +assertTrue(re.test('\u{1F6A3}\u{1F3FD}\u200D\u2642\uFE0F')); +assertTrue(re.test('\u{1F6A3}\u{1F3FE}\u200D\u2640\uFE0F')); +assertTrue(re.test('\u{1F6A3}\u{1F3FE}\u200D\u2642\uFE0F')); +assertTrue(re.test('\u{1F6A3}\u{1F3FF}\u200D\u2640\uFE0F')); +assertTrue(re.test('\u{1F6A3}\u{1F3FF}\u200D\u2642\uFE0F')); +assertTrue(re.test('\u{1F6B4}\u200D\u2640\uFE0F')); +assertTrue(re.test('\u{1F6B4}\u200D\u2642\uFE0F')); +assertTrue(re.test('\u{1F6B4}\u{1F3FB}\u200D\u2640\uFE0F')); +assertTrue(re.test('\u{1F6B4}\u{1F3FB}\u200D\u2642\uFE0F')); +assertTrue(re.test('\u{1F6B4}\u{1F3FC}\u200D\u2640\uFE0F')); +assertTrue(re.test('\u{1F6B4}\u{1F3FC}\u200D\u2642\uFE0F')); +assertTrue(re.test('\u{1F6B4}\u{1F3FD}\u200D\u2640\uFE0F')); +assertTrue(re.test('\u{1F6B4}\u{1F3FD}\u200D\u2642\uFE0F')); +assertTrue(re.test('\u{1F6B4}\u{1F3FE}\u200D\u2640\uFE0F')); +assertTrue(re.test('\u{1F6B4}\u{1F3FE}\u200D\u2642\uFE0F')); +assertTrue(re.test('\u{1F6B4}\u{1F3FF}\u200D\u2640\uFE0F')); +assertTrue(re.test('\u{1F6B4}\u{1F3FF}\u200D\u2642\uFE0F')); +assertTrue(re.test('\u{1F6B5}\u200D\u2640\uFE0F')); +assertTrue(re.test('\u{1F6B5}\u200D\u2642\uFE0F')); +assertTrue(re.test('\u{1F6B5}\u{1F3FB}\u200D\u2640\uFE0F')); +assertTrue(re.test('\u{1F6B5}\u{1F3FB}\u200D\u2642\uFE0F')); +assertTrue(re.test('\u{1F6B5}\u{1F3FC}\u200D\u2640\uFE0F')); +assertTrue(re.test('\u{1F6B5}\u{1F3FC}\u200D\u2642\uFE0F')); +assertTrue(re.test('\u{1F6B5}\u{1F3FD}\u200D\u2640\uFE0F')); +assertTrue(re.test('\u{1F6B5}\u{1F3FD}\u200D\u2642\uFE0F')); +assertTrue(re.test('\u{1F6B5}\u{1F3FE}\u200D\u2640\uFE0F')); +assertTrue(re.test('\u{1F6B5}\u{1F3FE}\u200D\u2642\uFE0F')); +assertTrue(re.test('\u{1F6B5}\u{1F3FF}\u200D\u2640\uFE0F')); +assertTrue(re.test('\u{1F6B5}\u{1F3FF}\u200D\u2642\uFE0F')); +assertTrue(re.test('\u{1F6B6}\u200D\u2640\uFE0F')); +assertTrue(re.test('\u{1F6B6}\u200D\u2642\uFE0F')); +assertTrue(re.test('\u{1F6B6}\u{1F3FB}\u200D\u2640\uFE0F')); +assertTrue(re.test('\u{1F6B6}\u{1F3FB}\u200D\u2642\uFE0F')); +assertTrue(re.test('\u{1F6B6}\u{1F3FC}\u200D\u2640\uFE0F')); +assertTrue(re.test('\u{1F6B6}\u{1F3FC}\u200D\u2642\uFE0F')); +assertTrue(re.test('\u{1F6B6}\u{1F3FD}\u200D\u2640\uFE0F')); +assertTrue(re.test('\u{1F6B6}\u{1F3FD}\u200D\u2642\uFE0F')); +assertTrue(re.test('\u{1F6B6}\u{1F3FE}\u200D\u2640\uFE0F')); +assertTrue(re.test('\u{1F6B6}\u{1F3FE}\u200D\u2642\uFE0F')); +assertTrue(re.test('\u{1F6B6}\u{1F3FF}\u200D\u2640\uFE0F')); +assertTrue(re.test('\u{1F6B6}\u{1F3FF}\u200D\u2642\uFE0F')); +assertTrue(re.test('\u{1F938}\u200D\u2640\uFE0F')); +assertTrue(re.test('\u{1F938}\u200D\u2642\uFE0F')); +assertTrue(re.test('\u{1F938}\u{1F3FB}\u200D\u2640\uFE0F')); +assertTrue(re.test('\u{1F938}\u{1F3FB}\u200D\u2642\uFE0F')); +assertTrue(re.test('\u{1F938}\u{1F3FC}\u200D\u2640\uFE0F')); +assertTrue(re.test('\u{1F938}\u{1F3FC}\u200D\u2642\uFE0F')); +assertTrue(re.test('\u{1F938}\u{1F3FD}\u200D\u2640\uFE0F')); +assertTrue(re.test('\u{1F938}\u{1F3FD}\u200D\u2642\uFE0F')); +assertTrue(re.test('\u{1F938}\u{1F3FE}\u200D\u2640\uFE0F')); +assertTrue(re.test('\u{1F938}\u{1F3FE}\u200D\u2642\uFE0F')); +assertTrue(re.test('\u{1F938}\u{1F3FF}\u200D\u2640\uFE0F')); +assertTrue(re.test('\u{1F938}\u{1F3FF}\u200D\u2642\uFE0F')); +assertTrue(re.test('\u{1F939}\u200D\u2640\uFE0F')); +assertTrue(re.test('\u{1F939}\u200D\u2642\uFE0F')); +assertTrue(re.test('\u{1F939}\u{1F3FB}\u200D\u2640\uFE0F')); +assertTrue(re.test('\u{1F939}\u{1F3FB}\u200D\u2642\uFE0F')); +assertTrue(re.test('\u{1F939}\u{1F3FC}\u200D\u2640\uFE0F')); +assertTrue(re.test('\u{1F939}\u{1F3FC}\u200D\u2642\uFE0F')); +assertTrue(re.test('\u{1F939}\u{1F3FD}\u200D\u2640\uFE0F')); +assertTrue(re.test('\u{1F939}\u{1F3FD}\u200D\u2642\uFE0F')); +assertTrue(re.test('\u{1F939}\u{1F3FE}\u200D\u2640\uFE0F')); +assertTrue(re.test('\u{1F939}\u{1F3FE}\u200D\u2642\uFE0F')); +assertTrue(re.test('\u{1F939}\u{1F3FF}\u200D\u2640\uFE0F')); +assertTrue(re.test('\u{1F939}\u{1F3FF}\u200D\u2642\uFE0F')); +assertTrue(re.test('\u{1F93C}\u200D\u2640\uFE0F')); +assertTrue(re.test('\u{1F93C}\u200D\u2642\uFE0F')); +assertTrue(re.test('\u{1F93D}\u200D\u2640\uFE0F')); +assertTrue(re.test('\u{1F93D}\u200D\u2642\uFE0F')); +assertTrue(re.test('\u{1F93D}\u{1F3FB}\u200D\u2640\uFE0F')); +assertTrue(re.test('\u{1F93D}\u{1F3FB}\u200D\u2642\uFE0F')); +assertTrue(re.test('\u{1F93D}\u{1F3FC}\u200D\u2640\uFE0F')); +assertTrue(re.test('\u{1F93D}\u{1F3FC}\u200D\u2642\uFE0F')); +assertTrue(re.test('\u{1F93D}\u{1F3FD}\u200D\u2640\uFE0F')); +assertTrue(re.test('\u{1F93D}\u{1F3FD}\u200D\u2642\uFE0F')); +assertTrue(re.test('\u{1F93D}\u{1F3FE}\u200D\u2640\uFE0F')); +assertTrue(re.test('\u{1F93D}\u{1F3FE}\u200D\u2642\uFE0F')); +assertTrue(re.test('\u{1F93D}\u{1F3FF}\u200D\u2640\uFE0F')); +assertTrue(re.test('\u{1F93D}\u{1F3FF}\u200D\u2642\uFE0F')); +assertTrue(re.test('\u{1F93E}\u200D\u2640\uFE0F')); +assertTrue(re.test('\u{1F93E}\u200D\u2642\uFE0F')); +assertTrue(re.test('\u{1F93E}\u{1F3FB}\u200D\u2640\uFE0F')); +assertTrue(re.test('\u{1F93E}\u{1F3FB}\u200D\u2642\uFE0F')); +assertTrue(re.test('\u{1F93E}\u{1F3FC}\u200D\u2640\uFE0F')); +assertTrue(re.test('\u{1F93E}\u{1F3FC}\u200D\u2642\uFE0F')); +assertTrue(re.test('\u{1F93E}\u{1F3FD}\u200D\u2640\uFE0F')); +assertTrue(re.test('\u{1F93E}\u{1F3FD}\u200D\u2642\uFE0F')); +assertTrue(re.test('\u{1F93E}\u{1F3FE}\u200D\u2640\uFE0F')); +assertTrue(re.test('\u{1F93E}\u{1F3FE}\u200D\u2642\uFE0F')); +assertTrue(re.test('\u{1F93E}\u{1F3FF}\u200D\u2640\uFE0F')); +assertTrue(re.test('\u{1F93E}\u{1F3FF}\u200D\u2642\uFE0F')); +assertTrue(re.test('\u{1F9D6}\u200D\u2640\uFE0F')); +assertTrue(re.test('\u{1F9D6}\u200D\u2642\uFE0F')); +assertTrue(re.test('\u{1F9D6}\u{1F3FB}\u200D\u2640\uFE0F')); +assertTrue(re.test('\u{1F9D6}\u{1F3FB}\u200D\u2642\uFE0F')); +assertTrue(re.test('\u{1F9D6}\u{1F3FC}\u200D\u2640\uFE0F')); +assertTrue(re.test('\u{1F9D6}\u{1F3FC}\u200D\u2642\uFE0F')); +assertTrue(re.test('\u{1F9D6}\u{1F3FD}\u200D\u2640\uFE0F')); +assertTrue(re.test('\u{1F9D6}\u{1F3FD}\u200D\u2642\uFE0F')); +assertTrue(re.test('\u{1F9D6}\u{1F3FE}\u200D\u2640\uFE0F')); +assertTrue(re.test('\u{1F9D6}\u{1F3FE}\u200D\u2642\uFE0F')); +assertTrue(re.test('\u{1F9D6}\u{1F3FF}\u200D\u2640\uFE0F')); +assertTrue(re.test('\u{1F9D6}\u{1F3FF}\u200D\u2642\uFE0F')); +assertTrue(re.test('\u{1F9D7}\u200D\u2640\uFE0F')); +assertTrue(re.test('\u{1F9D7}\u200D\u2642\uFE0F')); +assertTrue(re.test('\u{1F9D7}\u{1F3FB}\u200D\u2640\uFE0F')); +assertTrue(re.test('\u{1F9D7}\u{1F3FB}\u200D\u2642\uFE0F')); +assertTrue(re.test('\u{1F9D7}\u{1F3FC}\u200D\u2640\uFE0F')); +assertTrue(re.test('\u{1F9D7}\u{1F3FC}\u200D\u2642\uFE0F')); +assertTrue(re.test('\u{1F9D7}\u{1F3FD}\u200D\u2640\uFE0F')); +assertTrue(re.test('\u{1F9D7}\u{1F3FD}\u200D\u2642\uFE0F')); +assertTrue(re.test('\u{1F9D7}\u{1F3FE}\u200D\u2640\uFE0F')); +assertTrue(re.test('\u{1F9D7}\u{1F3FE}\u200D\u2642\uFE0F')); +assertTrue(re.test('\u{1F9D7}\u{1F3FF}\u200D\u2640\uFE0F')); +assertTrue(re.test('\u{1F9D7}\u{1F3FF}\u200D\u2642\uFE0F')); +assertTrue(re.test('\u{1F9D8}\u200D\u2640\uFE0F')); +assertTrue(re.test('\u{1F9D8}\u200D\u2642\uFE0F')); +assertTrue(re.test('\u{1F9D8}\u{1F3FB}\u200D\u2640\uFE0F')); +assertTrue(re.test('\u{1F9D8}\u{1F3FB}\u200D\u2642\uFE0F')); +assertTrue(re.test('\u{1F9D8}\u{1F3FC}\u200D\u2640\uFE0F')); +assertTrue(re.test('\u{1F9D8}\u{1F3FC}\u200D\u2642\uFE0F')); +assertTrue(re.test('\u{1F9D8}\u{1F3FD}\u200D\u2640\uFE0F')); +assertTrue(re.test('\u{1F9D8}\u{1F3FD}\u200D\u2642\uFE0F')); +assertTrue(re.test('\u{1F9D8}\u{1F3FE}\u200D\u2640\uFE0F')); +assertTrue(re.test('\u{1F9D8}\u{1F3FE}\u200D\u2642\uFE0F')); +assertTrue(re.test('\u{1F9D8}\u{1F3FF}\u200D\u2640\uFE0F')); +assertTrue(re.test('\u{1F9D8}\u{1F3FF}\u200D\u2642\uFE0F')); +assertTrue(re.test('\u{1F481}\u200D\u2640\uFE0F')); +assertTrue(re.test('\u{1F481}\u200D\u2642\uFE0F')); +assertTrue(re.test('\u{1F481}\u{1F3FB}\u200D\u2640\uFE0F')); +assertTrue(re.test('\u{1F481}\u{1F3FB}\u200D\u2642\uFE0F')); +assertTrue(re.test('\u{1F481}\u{1F3FC}\u200D\u2640\uFE0F')); +assertTrue(re.test('\u{1F481}\u{1F3FC}\u200D\u2642\uFE0F')); +assertTrue(re.test('\u{1F481}\u{1F3FD}\u200D\u2640\uFE0F')); +assertTrue(re.test('\u{1F481}\u{1F3FD}\u200D\u2642\uFE0F')); +assertTrue(re.test('\u{1F481}\u{1F3FE}\u200D\u2640\uFE0F')); +assertTrue(re.test('\u{1F481}\u{1F3FE}\u200D\u2642\uFE0F')); +assertTrue(re.test('\u{1F481}\u{1F3FF}\u200D\u2640\uFE0F')); +assertTrue(re.test('\u{1F481}\u{1F3FF}\u200D\u2642\uFE0F')); +assertTrue(re.test('\u{1F645}\u200D\u2640\uFE0F')); +assertTrue(re.test('\u{1F645}\u200D\u2642\uFE0F')); +assertTrue(re.test('\u{1F645}\u{1F3FB}\u200D\u2640\uFE0F')); +assertTrue(re.test('\u{1F645}\u{1F3FB}\u200D\u2642\uFE0F')); +assertTrue(re.test('\u{1F645}\u{1F3FC}\u200D\u2640\uFE0F')); +assertTrue(re.test('\u{1F645}\u{1F3FC}\u200D\u2642\uFE0F')); +assertTrue(re.test('\u{1F645}\u{1F3FD}\u200D\u2640\uFE0F')); +assertTrue(re.test('\u{1F645}\u{1F3FD}\u200D\u2642\uFE0F')); +assertTrue(re.test('\u{1F645}\u{1F3FE}\u200D\u2640\uFE0F')); +assertTrue(re.test('\u{1F645}\u{1F3FE}\u200D\u2642\uFE0F')); +assertTrue(re.test('\u{1F645}\u{1F3FF}\u200D\u2640\uFE0F')); +assertTrue(re.test('\u{1F645}\u{1F3FF}\u200D\u2642\uFE0F')); +assertTrue(re.test('\u{1F646}\u200D\u2640\uFE0F')); +assertTrue(re.test('\u{1F646}\u200D\u2642\uFE0F')); +assertTrue(re.test('\u{1F646}\u{1F3FB}\u200D\u2640\uFE0F')); +assertTrue(re.test('\u{1F646}\u{1F3FB}\u200D\u2642\uFE0F')); +assertTrue(re.test('\u{1F646}\u{1F3FC}\u200D\u2640\uFE0F')); +assertTrue(re.test('\u{1F646}\u{1F3FC}\u200D\u2642\uFE0F')); +assertTrue(re.test('\u{1F646}\u{1F3FD}\u200D\u2640\uFE0F')); +assertTrue(re.test('\u{1F646}\u{1F3FD}\u200D\u2642\uFE0F')); +assertTrue(re.test('\u{1F646}\u{1F3FE}\u200D\u2640\uFE0F')); +assertTrue(re.test('\u{1F646}\u{1F3FE}\u200D\u2642\uFE0F')); +assertTrue(re.test('\u{1F646}\u{1F3FF}\u200D\u2640\uFE0F')); +assertTrue(re.test('\u{1F646}\u{1F3FF}\u200D\u2642\uFE0F')); +assertTrue(re.test('\u{1F647}\u200D\u2640\uFE0F')); +assertTrue(re.test('\u{1F647}\u200D\u2642\uFE0F')); +assertTrue(re.test('\u{1F647}\u{1F3FB}\u200D\u2640\uFE0F')); +assertTrue(re.test('\u{1F647}\u{1F3FB}\u200D\u2642\uFE0F')); +assertTrue(re.test('\u{1F647}\u{1F3FC}\u200D\u2640\uFE0F')); +assertTrue(re.test('\u{1F647}\u{1F3FC}\u200D\u2642\uFE0F')); +assertTrue(re.test('\u{1F647}\u{1F3FD}\u200D\u2640\uFE0F')); +assertTrue(re.test('\u{1F647}\u{1F3FD}\u200D\u2642\uFE0F')); +assertTrue(re.test('\u{1F647}\u{1F3FE}\u200D\u2640\uFE0F')); +assertTrue(re.test('\u{1F647}\u{1F3FE}\u200D\u2642\uFE0F')); +assertTrue(re.test('\u{1F647}\u{1F3FF}\u200D\u2640\uFE0F')); +assertTrue(re.test('\u{1F647}\u{1F3FF}\u200D\u2642\uFE0F')); +assertTrue(re.test('\u{1F64B}\u200D\u2640\uFE0F')); +assertTrue(re.test('\u{1F64B}\u200D\u2642\uFE0F')); +assertTrue(re.test('\u{1F64B}\u{1F3FB}\u200D\u2640\uFE0F')); +assertTrue(re.test('\u{1F64B}\u{1F3FB}\u200D\u2642\uFE0F')); +assertTrue(re.test('\u{1F64B}\u{1F3FC}\u200D\u2640\uFE0F')); +assertTrue(re.test('\u{1F64B}\u{1F3FC}\u200D\u2642\uFE0F')); +assertTrue(re.test('\u{1F64B}\u{1F3FD}\u200D\u2640\uFE0F')); +assertTrue(re.test('\u{1F64B}\u{1F3FD}\u200D\u2642\uFE0F')); +assertTrue(re.test('\u{1F64B}\u{1F3FE}\u200D\u2640\uFE0F')); +assertTrue(re.test('\u{1F64B}\u{1F3FE}\u200D\u2642\uFE0F')); +assertTrue(re.test('\u{1F64B}\u{1F3FF}\u200D\u2640\uFE0F')); +assertTrue(re.test('\u{1F64B}\u{1F3FF}\u200D\u2642\uFE0F')); +assertTrue(re.test('\u{1F64D}\u200D\u2640\uFE0F')); +assertTrue(re.test('\u{1F64D}\u200D\u2642\uFE0F')); +assertTrue(re.test('\u{1F64D}\u{1F3FB}\u200D\u2640\uFE0F')); +assertTrue(re.test('\u{1F64D}\u{1F3FB}\u200D\u2642\uFE0F')); +assertTrue(re.test('\u{1F64D}\u{1F3FC}\u200D\u2640\uFE0F')); +assertTrue(re.test('\u{1F64D}\u{1F3FC}\u200D\u2642\uFE0F')); +assertTrue(re.test('\u{1F64D}\u{1F3FD}\u200D\u2640\uFE0F')); +assertTrue(re.test('\u{1F64D}\u{1F3FD}\u200D\u2642\uFE0F')); +assertTrue(re.test('\u{1F64D}\u{1F3FE}\u200D\u2640\uFE0F')); +assertTrue(re.test('\u{1F64D}\u{1F3FE}\u200D\u2642\uFE0F')); +assertTrue(re.test('\u{1F64D}\u{1F3FF}\u200D\u2640\uFE0F')); +assertTrue(re.test('\u{1F64D}\u{1F3FF}\u200D\u2642\uFE0F')); +assertTrue(re.test('\u{1F64E}\u200D\u2640\uFE0F')); +assertTrue(re.test('\u{1F64E}\u200D\u2642\uFE0F')); +assertTrue(re.test('\u{1F64E}\u{1F3FB}\u200D\u2640\uFE0F')); +assertTrue(re.test('\u{1F64E}\u{1F3FB}\u200D\u2642\uFE0F')); +assertTrue(re.test('\u{1F64E}\u{1F3FC}\u200D\u2640\uFE0F')); +assertTrue(re.test('\u{1F64E}\u{1F3FC}\u200D\u2642\uFE0F')); +assertTrue(re.test('\u{1F64E}\u{1F3FD}\u200D\u2640\uFE0F')); +assertTrue(re.test('\u{1F64E}\u{1F3FD}\u200D\u2642\uFE0F')); +assertTrue(re.test('\u{1F64E}\u{1F3FE}\u200D\u2640\uFE0F')); +assertTrue(re.test('\u{1F64E}\u{1F3FE}\u200D\u2642\uFE0F')); +assertTrue(re.test('\u{1F64E}\u{1F3FF}\u200D\u2640\uFE0F')); +assertTrue(re.test('\u{1F64E}\u{1F3FF}\u200D\u2642\uFE0F')); +assertTrue(re.test('\u{1F926}\u200D\u2640\uFE0F')); +assertTrue(re.test('\u{1F926}\u200D\u2642\uFE0F')); +assertTrue(re.test('\u{1F926}\u{1F3FB}\u200D\u2640\uFE0F')); +assertTrue(re.test('\u{1F926}\u{1F3FB}\u200D\u2642\uFE0F')); +assertTrue(re.test('\u{1F926}\u{1F3FC}\u200D\u2640\uFE0F')); +assertTrue(re.test('\u{1F926}\u{1F3FC}\u200D\u2642\uFE0F')); +assertTrue(re.test('\u{1F926}\u{1F3FD}\u200D\u2640\uFE0F')); +assertTrue(re.test('\u{1F926}\u{1F3FD}\u200D\u2642\uFE0F')); +assertTrue(re.test('\u{1F926}\u{1F3FE}\u200D\u2640\uFE0F')); +assertTrue(re.test('\u{1F926}\u{1F3FE}\u200D\u2642\uFE0F')); +assertTrue(re.test('\u{1F926}\u{1F3FF}\u200D\u2640\uFE0F')); +assertTrue(re.test('\u{1F926}\u{1F3FF}\u200D\u2642\uFE0F')); +assertTrue(re.test('\u{1F937}\u200D\u2640\uFE0F')); +assertTrue(re.test('\u{1F937}\u200D\u2642\uFE0F')); +assertTrue(re.test('\u{1F937}\u{1F3FB}\u200D\u2640\uFE0F')); +assertTrue(re.test('\u{1F937}\u{1F3FB}\u200D\u2642\uFE0F')); +assertTrue(re.test('\u{1F937}\u{1F3FC}\u200D\u2640\uFE0F')); +assertTrue(re.test('\u{1F937}\u{1F3FC}\u200D\u2642\uFE0F')); +assertTrue(re.test('\u{1F937}\u{1F3FD}\u200D\u2640\uFE0F')); +assertTrue(re.test('\u{1F937}\u{1F3FD}\u200D\u2642\uFE0F')); +assertTrue(re.test('\u{1F937}\u{1F3FE}\u200D\u2640\uFE0F')); +assertTrue(re.test('\u{1F937}\u{1F3FE}\u200D\u2642\uFE0F')); +assertTrue(re.test('\u{1F937}\u{1F3FF}\u200D\u2640\uFE0F')); +assertTrue(re.test('\u{1F937}\u{1F3FF}\u200D\u2642\uFE0F')); +assertTrue(re.test('\u{1F9B8}\u200D\u2640\uFE0F')); +assertTrue(re.test('\u{1F9B8}\u200D\u2642\uFE0F')); +assertTrue(re.test('\u{1F9B8}\u{1F3FB}\u200D\u2640\uFE0F')); +assertTrue(re.test('\u{1F9B8}\u{1F3FB}\u200D\u2642\uFE0F')); +assertTrue(re.test('\u{1F9B8}\u{1F3FC}\u200D\u2640\uFE0F')); +assertTrue(re.test('\u{1F9B8}\u{1F3FC}\u200D\u2642\uFE0F')); +assertTrue(re.test('\u{1F9B8}\u{1F3FD}\u200D\u2640\uFE0F')); +assertTrue(re.test('\u{1F9B8}\u{1F3FD}\u200D\u2642\uFE0F')); +assertTrue(re.test('\u{1F9B8}\u{1F3FE}\u200D\u2640\uFE0F')); +assertTrue(re.test('\u{1F9B8}\u{1F3FE}\u200D\u2642\uFE0F')); +assertTrue(re.test('\u{1F9B8}\u{1F3FF}\u200D\u2640\uFE0F')); +assertTrue(re.test('\u{1F9B8}\u{1F3FF}\u200D\u2642\uFE0F')); +assertTrue(re.test('\u{1F9B9}\u200D\u2640\uFE0F')); +assertTrue(re.test('\u{1F9B9}\u200D\u2642\uFE0F')); +assertTrue(re.test('\u{1F9B9}\u{1F3FB}\u200D\u2640\uFE0F')); +assertTrue(re.test('\u{1F9B9}\u{1F3FB}\u200D\u2642\uFE0F')); +assertTrue(re.test('\u{1F9B9}\u{1F3FC}\u200D\u2640\uFE0F')); +assertTrue(re.test('\u{1F9B9}\u{1F3FC}\u200D\u2642\uFE0F')); +assertTrue(re.test('\u{1F9B9}\u{1F3FD}\u200D\u2640\uFE0F')); +assertTrue(re.test('\u{1F9B9}\u{1F3FD}\u200D\u2642\uFE0F')); +assertTrue(re.test('\u{1F9B9}\u{1F3FE}\u200D\u2640\uFE0F')); +assertTrue(re.test('\u{1F9B9}\u{1F3FE}\u200D\u2642\uFE0F')); +assertTrue(re.test('\u{1F9B9}\u{1F3FF}\u200D\u2640\uFE0F')); +assertTrue(re.test('\u{1F9B9}\u{1F3FF}\u200D\u2642\uFE0F')); +assertTrue(re.test('\u{1F3F3}\uFE0F\u200D\u{1F308}')); +assertTrue(re.test('\u{1F3F4}\u200D\u2620\uFE0F')); +assertTrue(re.test('\u{1F9DC}\u{1F3FE}\u200D\u2640\uFE0F')); diff --git a/deps/v8/test/mjsunit/harmony/regexp-property-invalid.js b/deps/v8/test/mjsunit/harmony/regexp-property-invalid.js index 83c7b2e209..7fef5dfd0c 100644 --- a/deps/v8/test/mjsunit/harmony/regexp-property-invalid.js +++ b/deps/v8/test/mjsunit/harmony/regexp-property-invalid.js @@ -34,3 +34,5 @@ assertThrows("/\\p{In}/u"); assertThrows("/\\pI/u"); assertThrows("/\\p{I}/u"); assertThrows("/\\p{CJK}/u"); + +assertThrows("/\\p{}/u"); diff --git a/deps/v8/test/mjsunit/harmony/regexp-property-sequence.js b/deps/v8/test/mjsunit/harmony/regexp-property-sequence.js new file mode 100644 index 0000000000..4d43298016 --- /dev/null +++ b/deps/v8/test/mjsunit/harmony/regexp-property-sequence.js @@ -0,0 +1,88 @@ +// Copyright 2018 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-sequence + +// Normal usage. +assertDoesNotThrow("/\\p{Emoji_Flag_Sequence}/u"); +assertTrue(/\p{Emoji_Flag_Sequence}/u.test("\u{1F1E9}\u{1F1EA}")); + +assertDoesNotThrow("/\\p{Emoji_Keycap_Sequence}/u"); +assertTrue(/\p{Emoji_Keycap_Sequence}/u.test("\u0023\uFE0F\u20E3")); + +assertDoesNotThrow("/\\p{Emoji_Keycap_Sequence}/u"); +assertFalse(/\p{Emoji_Keycap_Sequence}/u.test("\u0022\uFE0F\u20E3")); + +assertDoesNotThrow("/\\p{Emoji_Modifier_Sequence}/u"); +assertTrue(/\p{Emoji_Modifier_Sequence}/u.test("\u26F9\u{1F3FF}")); + +assertDoesNotThrow("/\\p{Emoji_ZWJ_Sequence}/u"); +assertTrue(/\p{Emoji_ZWJ_Sequence}/u.test("\u{1F468}\u{200D}\u{1F467}")); + +// Without unicode flag. +assertDoesNotThrow("/\\p{Emoji_Flag_Sequence}/"); +assertFalse(/\p{Emoji_Flag_Sequence}/.test("\u{1F1E9}\u{1F1EA}")); +assertTrue(/\p{Emoji_Flag_Sequence}/.test("\\p{Emoji_Flag_Sequence}")); + +// Negated and/or inside a character class. +assertThrows("/\\P{Emoji_Flag_Sequence}/u"); +assertThrows("/\\P{Emoji_Keycap_Sequence}/u"); +assertThrows("/\\P{Emoji_Modifier_Sequence}/u"); +assertThrows("/\\P{Emoji_Tag_Sequence}/u"); +assertThrows("/\\P{Emoji_ZWJ_Sequence}/u"); + +assertThrows("/[\\p{Emoji_Flag_Sequence}]/u"); +assertThrows("/[\\p{Emoji_Keycap_Sequence}]/u"); +assertThrows("/[\\p{Emoji_Modifier_Sequence}]/u"); +assertThrows("/[\\p{Emoji_Tag_Sequence}]/u"); +assertThrows("/[\\p{Emoji_ZWJ_Sequence}]/u"); + +assertThrows("/[\\P{Emoji_Flag_Sequence}]/u"); +assertThrows("/[\\P{Emoji_Keycap_Sequence}]/u"); +assertThrows("/[\\P{Emoji_Modifier_Sequence}]/u"); +assertThrows("/[\\P{Emoji_Tag_Sequence}]/u"); +assertThrows("/[\\P{Emoji_ZWJ_Sequence}]/u"); + +assertThrows("/[\\w\\p{Emoji_Flag_Sequence}]/u"); +assertThrows("/[\\w\\p{Emoji_Keycap_Sequence}]/u"); +assertThrows("/[\\w\\p{Emoji_Modifier_Sequence}]/u"); +assertThrows("/[\\w\\p{Emoji_Tag_Sequence}]/u"); +assertThrows("/[\\w\\p{Emoji_ZWJ_Sequence}]/u"); + +assertThrows("/[\\w\\P{Emoji_Flag_Sequence}]/u"); +assertThrows("/[\\w\\P{Emoji_Keycap_Sequence}]/u"); +assertThrows("/[\\w\\P{Emoji_Modifier_Sequence}]/u"); +assertThrows("/[\\w\\P{Emoji_Tag_Sequence}]/u"); +assertThrows("/[\\w\\P{Emoji_ZWJ_Sequence}]/u"); + +// Two regional indicators, but not a country. +assertFalse(/\p{Emoji_Flag_Sequence}/u.test("\u{1F1E6}\u{1F1E6}")); + +// ZWJ sequence as in two ZWJ elements joined by a ZWJ, but not in the list. +assertFalse(/\p{Emoji_ZWJ_Sequence}/u.test("\u{1F467}\u{200D}\u{1F468}")); + +// More complex regexp +assertEquals( + ["country flag: \u{1F1E6}\u{1F1F9}"], + /Country Flag: \p{Emoji_Flag_Sequence}/iu.exec( + "this is an example of a country flag: \u{1F1E6}\u{1F1F9} is Austria")); +assertEquals( + ["country flag: \u{1F1E6}\u{1F1F9}", "\u{1F1E6}\u{1F1F9}"], + /Country Flag: (\p{Emoji_Flag_Sequence})/iu.exec( + "this is an example of a country flag: \u{1F1E6}\u{1F1F9} is Austria")); +assertEquals( + ["country flag: \u{1F1E6}\u{1F1F9}"], + /Country Flag: ..(?<=\p{Emoji_Flag_Sequence})/iu.exec( + "this is an example of a country flag: \u{1F1E6}\u{1F1F9} is Austria")); +assertEquals( + ["flag: \u{1F1E6}\u{1F1F9}", "\u{1F1E6}\u{1F1F9}"], + /Flag: ..(?<=(\p{Emoji_Flag_Sequence})|\p{Emoji_Keycap_Sequence})/iu.exec( + "this is an example of a country flag: \u{1F1E6}\u{1F1F9} is Austria")); + +// Partial sequences. +assertFalse(/\p{Emoji_Flag_Sequence}/u.test("\u{1F1E6}_")); +assertFalse(/\p{Emoji_Keycap_Sequence}/u.test("2\uFE0F_")); +assertFalse(/\p{Emoji_Modifier_Sequence}/u.test("\u261D_")); +assertFalse(/\p{Emoji_Tag_Sequence}/u.test("\u{1F3F4}\u{E0067}\u{E0062}\u{E0065}\u{E006E}\u{E0067}_")); +assertFalse(/\p{Emoji_ZWJ_Sequence}/u.test("\u{1F468}\u200D\u2764\uFE0F\u200D_")); diff --git a/deps/v8/test/mjsunit/harmony/to-number.js b/deps/v8/test/mjsunit/harmony/to-number.js index 6dc4db59a2..a48a7d83f8 100644 --- a/deps/v8/test/mjsunit/harmony/to-number.js +++ b/deps/v8/test/mjsunit/harmony/to-number.js @@ -5,47 +5,34 @@ // Flags: --allow-natives-syntax assertEquals(1, %ToNumber(1)); -assertEquals(1, %_ToNumber(1)); assertEquals(.5, %ToNumber(.5)); -assertEquals(.5, %_ToNumber(.5)); assertEquals(0, %ToNumber(null)); -assertEquals(0, %_ToNumber(null)); assertEquals(1, %ToNumber(true)); -assertEquals(1, %_ToNumber(true)); assertEquals(0, %ToNumber(false)); -assertEquals(0, %_ToNumber(false)); assertEquals(NaN, %ToNumber(undefined)); -assertEquals(NaN, %_ToNumber(undefined)); assertEquals(-1, %ToNumber("-1")); -assertEquals(-1, %_ToNumber("-1")); assertEquals(123, %ToNumber("123")); -assertEquals(123, %_ToNumber("123")); assertEquals(NaN, %ToNumber("random text")); -assertEquals(NaN, %_ToNumber("random text")); assertThrows(function() { %ToNumber(Symbol.toPrimitive) }, TypeError); -assertThrows(function() { %_ToNumber(Symbol.toPrimitive) }, TypeError); var a = { toString: function() { return 54321 }}; assertEquals(54321, %ToNumber(a)); -assertEquals(54321, %_ToNumber(a)); var b = { valueOf: function() { return 42 }}; assertEquals(42, %ToNumber(b)); -assertEquals(42, %_ToNumber(b)); var c = { toString: function() { return "x"}, valueOf: function() { return 123 } }; assertEquals(123, %ToNumber(c)); -assertEquals(123, %_ToNumber(c)); var d = { [Symbol.toPrimitive]: function(hint) { @@ -54,8 +41,6 @@ var d = { } }; assertEquals(987654321, %ToNumber(d)); -assertEquals(987654321, %_ToNumber(d)); var e = new Date(0); assertEquals(0, %ToNumber(e)); -assertEquals(0, %_ToNumber(e)); diff --git a/deps/v8/test/mjsunit/harmony/to-primitive.js b/deps/v8/test/mjsunit/harmony/to-primitive.js deleted file mode 100644 index 8decb04657..0000000000 --- a/deps/v8/test/mjsunit/harmony/to-primitive.js +++ /dev/null @@ -1,54 +0,0 @@ -// Copyright 2015 the V8 project authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -// Flags: --allow-natives-syntax - -assertEquals(1, %ToPrimitive(1)); -assertEquals(1, %ToPrimitive_Number(1)); - -assertEquals(.5, %ToPrimitive(.5)); -assertEquals(.5, %ToPrimitive_Number(.5)); - -assertEquals(null, %ToPrimitive(null)); -assertEquals(null, %ToPrimitive_Number(null)); - -assertEquals(true, %ToPrimitive(true)); -assertEquals(true, %ToPrimitive_Number(true)); - -assertEquals(false, %ToPrimitive(false)); -assertEquals(false, %ToPrimitive_Number(false)); - -assertEquals(undefined, %ToPrimitive(undefined)); -assertEquals(undefined, %ToPrimitive_Number(undefined)); - -assertEquals("random text", %ToPrimitive("random text")); -assertEquals("random text", %ToPrimitive_Number("random text")); - -assertEquals(Symbol.toPrimitive, %ToPrimitive(Symbol.toPrimitive)); -assertEquals(Symbol.toPrimitive, %ToPrimitive_Number(Symbol.toPrimitive)); - -var a = { toString: function() { return "xyz" }}; -assertEquals("xyz", %ToPrimitive(a)); -assertEquals("xyz", %ToPrimitive_Number(a)); - -var b = { valueOf: function() { return 42 }}; -assertEquals(42, %ToPrimitive(b)); -assertEquals(42, %ToPrimitive_Number(b)); - -var c = { - toString: function() { return "x"}, - valueOf: function() { return 123 } -}; -assertEquals(123, %ToPrimitive(c)); -assertEquals(123, %ToPrimitive_Number(c)); - -var d = { - [Symbol.toPrimitive]: function(hint) { return hint } -}; -assertEquals("default", %ToPrimitive(d)); -assertEquals("number", %ToPrimitive_Number(d)); - -var e = new Date(0); -assertEquals(e.toString(), %ToPrimitive(e)); -assertEquals(0, %ToPrimitive_Number(e)); diff --git a/deps/v8/test/mjsunit/harmony/well-formed-json-stringify-checked.js b/deps/v8/test/mjsunit/harmony/well-formed-json-stringify-checked.js new file mode 100644 index 0000000000..d1179d3855 --- /dev/null +++ b/deps/v8/test/mjsunit/harmony/well-formed-json-stringify-checked.js @@ -0,0 +1,2575 @@ +// Copyright 2018 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-json-stringify + +// Test JSON.stringify for cases that hit +// JsonStringifier::SerializeString_. + +// All code points from U+0000 to U+00FF. +assertEquals('"___\\u0000"', JSON.stringify('___\0')); +assertEquals('"___\\u0001"', JSON.stringify('___\x01')); +assertEquals('"___\\u0002"', JSON.stringify('___\x02')); +assertEquals('"___\\u0003"', JSON.stringify('___\x03')); +assertEquals('"___\\u0004"', JSON.stringify('___\x04')); +assertEquals('"___\\u0005"', JSON.stringify('___\x05')); +assertEquals('"___\\u0006"', JSON.stringify('___\x06')); +assertEquals('"___\\u0007"', JSON.stringify('___\x07')); +assertEquals('"___\\b"', JSON.stringify('___\b')); +assertEquals('"___\\t"', JSON.stringify('___\t')); +assertEquals('"___\\n"', JSON.stringify('___\n')); +assertEquals('"___\\u000b"', JSON.stringify('___\x0B')); +assertEquals('"___\\f"', JSON.stringify('___\f')); +assertEquals('"___\\r"', JSON.stringify('___\r')); +assertEquals('"___\\u000e"', JSON.stringify('___\x0E')); +assertEquals('"___\\u000f"', JSON.stringify('___\x0F')); +assertEquals('"___\\u0010"', JSON.stringify('___\x10')); +assertEquals('"___\\u0011"', JSON.stringify('___\x11')); +assertEquals('"___\\u0012"', JSON.stringify('___\x12')); +assertEquals('"___\\u0013"', JSON.stringify('___\x13')); +assertEquals('"___\\u0014"', JSON.stringify('___\x14')); +assertEquals('"___\\u0015"', JSON.stringify('___\x15')); +assertEquals('"___\\u0016"', JSON.stringify('___\x16')); +assertEquals('"___\\u0017"', JSON.stringify('___\x17')); +assertEquals('"___\\u0018"', JSON.stringify('___\x18')); +assertEquals('"___\\u0019"', JSON.stringify('___\x19')); +assertEquals('"___\\u001a"', JSON.stringify('___\x1A')); +assertEquals('"___\\u001b"', JSON.stringify('___\x1B')); +assertEquals('"___\\u001c"', JSON.stringify('___\x1C')); +assertEquals('"___\\u001d"', JSON.stringify('___\x1D')); +assertEquals('"___\\u001e"', JSON.stringify('___\x1E')); +assertEquals('"___\\u001f"', JSON.stringify('___\x1F')); +assertEquals('"___ "', JSON.stringify('___ ')); +assertEquals('"___!"', JSON.stringify('___!')); +assertEquals('"___\\""', JSON.stringify('___"')); +assertEquals('"___#"', JSON.stringify('___#')); +assertEquals('"___$"', JSON.stringify('___$')); +assertEquals('"___%"', JSON.stringify('___%')); +assertEquals('"___&"', JSON.stringify('___&')); +assertEquals('"___\'"', JSON.stringify('___\'')); +assertEquals('"___("', JSON.stringify('___(')); +assertEquals('"___)"', JSON.stringify('___)')); +assertEquals('"___*"', JSON.stringify('___*')); +assertEquals('"___+"', JSON.stringify('___+')); +assertEquals('"___,"', JSON.stringify('___,')); +assertEquals('"___-"', JSON.stringify('___-')); +assertEquals('"___."', JSON.stringify('___.')); +assertEquals('"___/"', JSON.stringify('___/')); +assertEquals('"___0"', JSON.stringify('___0')); +assertEquals('"___1"', JSON.stringify('___1')); +assertEquals('"___2"', JSON.stringify('___2')); +assertEquals('"___3"', JSON.stringify('___3')); +assertEquals('"___4"', JSON.stringify('___4')); +assertEquals('"___5"', JSON.stringify('___5')); +assertEquals('"___6"', JSON.stringify('___6')); +assertEquals('"___7"', JSON.stringify('___7')); +assertEquals('"___8"', JSON.stringify('___8')); +assertEquals('"___9"', JSON.stringify('___9')); +assertEquals('"___:"', JSON.stringify('___:')); +assertEquals('"___;"', JSON.stringify('___;')); +assertEquals('"___<"', JSON.stringify('___<')); +assertEquals('"___="', JSON.stringify('___=')); +assertEquals('"___>"', JSON.stringify('___>')); +assertEquals('"___?"', JSON.stringify('___?')); +assertEquals('"___@"', JSON.stringify('___@')); +assertEquals('"___A"', JSON.stringify('___A')); +assertEquals('"___B"', JSON.stringify('___B')); +assertEquals('"___C"', JSON.stringify('___C')); +assertEquals('"___D"', JSON.stringify('___D')); +assertEquals('"___E"', JSON.stringify('___E')); +assertEquals('"___F"', JSON.stringify('___F')); +assertEquals('"___G"', JSON.stringify('___G')); +assertEquals('"___H"', JSON.stringify('___H')); +assertEquals('"___I"', JSON.stringify('___I')); +assertEquals('"___J"', JSON.stringify('___J')); +assertEquals('"___K"', JSON.stringify('___K')); +assertEquals('"___L"', JSON.stringify('___L')); +assertEquals('"___M"', JSON.stringify('___M')); +assertEquals('"___N"', JSON.stringify('___N')); +assertEquals('"___O"', JSON.stringify('___O')); +assertEquals('"___P"', JSON.stringify('___P')); +assertEquals('"___Q"', JSON.stringify('___Q')); +assertEquals('"___R"', JSON.stringify('___R')); +assertEquals('"___S"', JSON.stringify('___S')); +assertEquals('"___T"', JSON.stringify('___T')); +assertEquals('"___U"', JSON.stringify('___U')); +assertEquals('"___V"', JSON.stringify('___V')); +assertEquals('"___W"', JSON.stringify('___W')); +assertEquals('"___X"', JSON.stringify('___X')); +assertEquals('"___Y"', JSON.stringify('___Y')); +assertEquals('"___Z"', JSON.stringify('___Z')); +assertEquals('"___["', JSON.stringify('___[')); +assertEquals('"___\\\\"', JSON.stringify('___\\')); +assertEquals('"___]"', JSON.stringify('___]')); +assertEquals('"___^"', JSON.stringify('___^')); +assertEquals('"____"', JSON.stringify('____')); +assertEquals('"___`"', JSON.stringify('___`')); +assertEquals('"___a"', JSON.stringify('___a')); +assertEquals('"___b"', JSON.stringify('___b')); +assertEquals('"___c"', JSON.stringify('___c')); +assertEquals('"___d"', JSON.stringify('___d')); +assertEquals('"___e"', JSON.stringify('___e')); +assertEquals('"___f"', JSON.stringify('___f')); +assertEquals('"___g"', JSON.stringify('___g')); +assertEquals('"___h"', JSON.stringify('___h')); +assertEquals('"___i"', JSON.stringify('___i')); +assertEquals('"___j"', JSON.stringify('___j')); +assertEquals('"___k"', JSON.stringify('___k')); +assertEquals('"___l"', JSON.stringify('___l')); +assertEquals('"___m"', JSON.stringify('___m')); +assertEquals('"___n"', JSON.stringify('___n')); +assertEquals('"___o"', JSON.stringify('___o')); +assertEquals('"___p"', JSON.stringify('___p')); +assertEquals('"___q"', JSON.stringify('___q')); +assertEquals('"___r"', JSON.stringify('___r')); +assertEquals('"___s"', JSON.stringify('___s')); +assertEquals('"___t"', JSON.stringify('___t')); +assertEquals('"___u"', JSON.stringify('___u')); +assertEquals('"___v"', JSON.stringify('___v')); +assertEquals('"___w"', JSON.stringify('___w')); +assertEquals('"___x"', JSON.stringify('___x')); +assertEquals('"___y"', JSON.stringify('___y')); +assertEquals('"___z"', JSON.stringify('___z')); +assertEquals('"___{"', JSON.stringify('___{')); +assertEquals('"___|"', JSON.stringify('___|')); +assertEquals('"___}"', JSON.stringify('___}')); +assertEquals('"___~"', JSON.stringify('___~')); +assertEquals('"___\x7F"', JSON.stringify('___\x7F')); +assertEquals('"___\x80"', JSON.stringify('___\x80')); +assertEquals('"___\x81"', JSON.stringify('___\x81')); +assertEquals('"___\x82"', JSON.stringify('___\x82')); +assertEquals('"___\x83"', JSON.stringify('___\x83')); +assertEquals('"___\x84"', JSON.stringify('___\x84')); +assertEquals('"___\x85"', JSON.stringify('___\x85')); +assertEquals('"___\x86"', JSON.stringify('___\x86')); +assertEquals('"___\x87"', JSON.stringify('___\x87')); +assertEquals('"___\x88"', JSON.stringify('___\x88')); +assertEquals('"___\x89"', JSON.stringify('___\x89')); +assertEquals('"___\x8A"', JSON.stringify('___\x8A')); +assertEquals('"___\x8B"', JSON.stringify('___\x8B')); +assertEquals('"___\x8C"', JSON.stringify('___\x8C')); +assertEquals('"___\x8D"', JSON.stringify('___\x8D')); +assertEquals('"___\x8E"', JSON.stringify('___\x8E')); +assertEquals('"___\x8F"', JSON.stringify('___\x8F')); +assertEquals('"___\x90"', JSON.stringify('___\x90')); +assertEquals('"___\x91"', JSON.stringify('___\x91')); +assertEquals('"___\x92"', JSON.stringify('___\x92')); +assertEquals('"___\x93"', JSON.stringify('___\x93')); +assertEquals('"___\x94"', JSON.stringify('___\x94')); +assertEquals('"___\x95"', JSON.stringify('___\x95')); +assertEquals('"___\x96"', JSON.stringify('___\x96')); +assertEquals('"___\x97"', JSON.stringify('___\x97')); +assertEquals('"___\x98"', JSON.stringify('___\x98')); +assertEquals('"___\x99"', JSON.stringify('___\x99')); +assertEquals('"___\x9A"', JSON.stringify('___\x9A')); +assertEquals('"___\x9B"', JSON.stringify('___\x9B')); +assertEquals('"___\x9C"', JSON.stringify('___\x9C')); +assertEquals('"___\x9D"', JSON.stringify('___\x9D')); +assertEquals('"___\x9E"', JSON.stringify('___\x9E')); +assertEquals('"___\x9F"', JSON.stringify('___\x9F')); +assertEquals('"___\xA0"', JSON.stringify('___\xA0')); +assertEquals('"___\xA1"', JSON.stringify('___\xA1')); +assertEquals('"___\xA2"', JSON.stringify('___\xA2')); +assertEquals('"___\xA3"', JSON.stringify('___\xA3')); +assertEquals('"___\xA4"', JSON.stringify('___\xA4')); +assertEquals('"___\xA5"', JSON.stringify('___\xA5')); +assertEquals('"___\xA6"', JSON.stringify('___\xA6')); +assertEquals('"___\xA7"', JSON.stringify('___\xA7')); +assertEquals('"___\xA8"', JSON.stringify('___\xA8')); +assertEquals('"___\xA9"', JSON.stringify('___\xA9')); +assertEquals('"___\xAA"', JSON.stringify('___\xAA')); +assertEquals('"___\xAB"', JSON.stringify('___\xAB')); +assertEquals('"___\xAC"', JSON.stringify('___\xAC')); +assertEquals('"___\xAD"', JSON.stringify('___\xAD')); +assertEquals('"___\xAE"', JSON.stringify('___\xAE')); +assertEquals('"___\xAF"', JSON.stringify('___\xAF')); +assertEquals('"___\xB0"', JSON.stringify('___\xB0')); +assertEquals('"___\xB1"', JSON.stringify('___\xB1')); +assertEquals('"___\xB2"', JSON.stringify('___\xB2')); +assertEquals('"___\xB3"', JSON.stringify('___\xB3')); +assertEquals('"___\xB4"', JSON.stringify('___\xB4')); +assertEquals('"___\xB5"', JSON.stringify('___\xB5')); +assertEquals('"___\xB6"', JSON.stringify('___\xB6')); +assertEquals('"___\xB7"', JSON.stringify('___\xB7')); +assertEquals('"___\xB8"', JSON.stringify('___\xB8')); +assertEquals('"___\xB9"', JSON.stringify('___\xB9')); +assertEquals('"___\xBA"', JSON.stringify('___\xBA')); +assertEquals('"___\xBB"', JSON.stringify('___\xBB')); +assertEquals('"___\xBC"', JSON.stringify('___\xBC')); +assertEquals('"___\xBD"', JSON.stringify('___\xBD')); +assertEquals('"___\xBE"', JSON.stringify('___\xBE')); +assertEquals('"___\xBF"', JSON.stringify('___\xBF')); +assertEquals('"___\xC0"', JSON.stringify('___\xC0')); +assertEquals('"___\xC1"', JSON.stringify('___\xC1')); +assertEquals('"___\xC2"', JSON.stringify('___\xC2')); +assertEquals('"___\xC3"', JSON.stringify('___\xC3')); +assertEquals('"___\xC4"', JSON.stringify('___\xC4')); +assertEquals('"___\xC5"', JSON.stringify('___\xC5')); +assertEquals('"___\xC6"', JSON.stringify('___\xC6')); +assertEquals('"___\xC7"', JSON.stringify('___\xC7')); +assertEquals('"___\xC8"', JSON.stringify('___\xC8')); +assertEquals('"___\xC9"', JSON.stringify('___\xC9')); +assertEquals('"___\xCA"', JSON.stringify('___\xCA')); +assertEquals('"___\xCB"', JSON.stringify('___\xCB')); +assertEquals('"___\xCC"', JSON.stringify('___\xCC')); +assertEquals('"___\xCD"', JSON.stringify('___\xCD')); +assertEquals('"___\xCE"', JSON.stringify('___\xCE')); +assertEquals('"___\xCF"', JSON.stringify('___\xCF')); +assertEquals('"___\xD0"', JSON.stringify('___\xD0')); +assertEquals('"___\xD1"', JSON.stringify('___\xD1')); +assertEquals('"___\xD2"', JSON.stringify('___\xD2')); +assertEquals('"___\xD3"', JSON.stringify('___\xD3')); +assertEquals('"___\xD4"', JSON.stringify('___\xD4')); +assertEquals('"___\xD5"', JSON.stringify('___\xD5')); +assertEquals('"___\xD6"', JSON.stringify('___\xD6')); +assertEquals('"___\xD7"', JSON.stringify('___\xD7')); +assertEquals('"___\xD8"', JSON.stringify('___\xD8')); +assertEquals('"___\xD9"', JSON.stringify('___\xD9')); +assertEquals('"___\xDA"', JSON.stringify('___\xDA')); +assertEquals('"___\xDB"', JSON.stringify('___\xDB')); +assertEquals('"___\xDC"', JSON.stringify('___\xDC')); +assertEquals('"___\xDD"', JSON.stringify('___\xDD')); +assertEquals('"___\xDE"', JSON.stringify('___\xDE')); +assertEquals('"___\xDF"', JSON.stringify('___\xDF')); +assertEquals('"___\xE0"', JSON.stringify('___\xE0')); +assertEquals('"___\xE1"', JSON.stringify('___\xE1')); +assertEquals('"___\xE2"', JSON.stringify('___\xE2')); +assertEquals('"___\xE3"', JSON.stringify('___\xE3')); +assertEquals('"___\xE4"', JSON.stringify('___\xE4')); +assertEquals('"___\xE5"', JSON.stringify('___\xE5')); +assertEquals('"___\xE6"', JSON.stringify('___\xE6')); +assertEquals('"___\xE7"', JSON.stringify('___\xE7')); +assertEquals('"___\xE8"', JSON.stringify('___\xE8')); +assertEquals('"___\xE9"', JSON.stringify('___\xE9')); +assertEquals('"___\xEA"', JSON.stringify('___\xEA')); +assertEquals('"___\xEB"', JSON.stringify('___\xEB')); +assertEquals('"___\xEC"', JSON.stringify('___\xEC')); +assertEquals('"___\xED"', JSON.stringify('___\xED')); +assertEquals('"___\xEE"', JSON.stringify('___\xEE')); +assertEquals('"___\xEF"', JSON.stringify('___\xEF')); +assertEquals('"___\xF0"', JSON.stringify('___\xF0')); +assertEquals('"___\xF1"', JSON.stringify('___\xF1')); +assertEquals('"___\xF2"', JSON.stringify('___\xF2')); +assertEquals('"___\xF3"', JSON.stringify('___\xF3')); +assertEquals('"___\xF4"', JSON.stringify('___\xF4')); +assertEquals('"___\xF5"', JSON.stringify('___\xF5')); +assertEquals('"___\xF6"', JSON.stringify('___\xF6')); +assertEquals('"___\xF7"', JSON.stringify('___\xF7')); +assertEquals('"___\xF8"', JSON.stringify('___\xF8')); +assertEquals('"___\xF9"', JSON.stringify('___\xF9')); +assertEquals('"___\xFA"', JSON.stringify('___\xFA')); +assertEquals('"___\xFB"', JSON.stringify('___\xFB')); +assertEquals('"___\xFC"', JSON.stringify('___\xFC')); +assertEquals('"___\xFD"', JSON.stringify('___\xFD')); +assertEquals('"___\xFE"', JSON.stringify('___\xFE')); +assertEquals('"___\xFF"', JSON.stringify('___\xFF')); + +// A random selection of code points from U+0100 to U+D7FF. +assertEquals('"___\u0100"', JSON.stringify('___\u0100')); +assertEquals('"___\u0120"', JSON.stringify('___\u0120')); +assertEquals('"___\u07D3"', JSON.stringify('___\u07D3')); +assertEquals('"___\u0B8B"', JSON.stringify('___\u0B8B')); +assertEquals('"___\u0C4C"', JSON.stringify('___\u0C4C')); +assertEquals('"___\u178D"', JSON.stringify('___\u178D')); +assertEquals('"___\u18B8"', JSON.stringify('___\u18B8')); +assertEquals('"___\u193E"', JSON.stringify('___\u193E')); +assertEquals('"___\u198A"', JSON.stringify('___\u198A')); +assertEquals('"___\u1AF5"', JSON.stringify('___\u1AF5')); +assertEquals('"___\u1D38"', JSON.stringify('___\u1D38')); +assertEquals('"___\u1E37"', JSON.stringify('___\u1E37')); +assertEquals('"___\u1FC2"', JSON.stringify('___\u1FC2')); +assertEquals('"___\u22C7"', JSON.stringify('___\u22C7')); +assertEquals('"___\u2619"', JSON.stringify('___\u2619')); +assertEquals('"___\u272A"', JSON.stringify('___\u272A')); +assertEquals('"___\u2B7F"', JSON.stringify('___\u2B7F')); +assertEquals('"___\u2DFF"', JSON.stringify('___\u2DFF')); +assertEquals('"___\u341B"', JSON.stringify('___\u341B')); +assertEquals('"___\u3A3C"', JSON.stringify('___\u3A3C')); +assertEquals('"___\u3E53"', JSON.stringify('___\u3E53')); +assertEquals('"___\u3EC2"', JSON.stringify('___\u3EC2')); +assertEquals('"___\u3F76"', JSON.stringify('___\u3F76')); +assertEquals('"___\u3F85"', JSON.stringify('___\u3F85')); +assertEquals('"___\u43C7"', JSON.stringify('___\u43C7')); +assertEquals('"___\u4A19"', JSON.stringify('___\u4A19')); +assertEquals('"___\u4A1C"', JSON.stringify('___\u4A1C')); +assertEquals('"___\u4F80"', JSON.stringify('___\u4F80')); +assertEquals('"___\u5A30"', JSON.stringify('___\u5A30')); +assertEquals('"___\u5B55"', JSON.stringify('___\u5B55')); +assertEquals('"___\u5C74"', JSON.stringify('___\u5C74')); +assertEquals('"___\u6006"', JSON.stringify('___\u6006')); +assertEquals('"___\u63CC"', JSON.stringify('___\u63CC')); +assertEquals('"___\u6608"', JSON.stringify('___\u6608')); +assertEquals('"___\u6ABF"', JSON.stringify('___\u6ABF')); +assertEquals('"___\u6AE9"', JSON.stringify('___\u6AE9')); +assertEquals('"___\u6C91"', JSON.stringify('___\u6C91')); +assertEquals('"___\u714B"', JSON.stringify('___\u714B')); +assertEquals('"___\u728A"', JSON.stringify('___\u728A')); +assertEquals('"___\u7485"', JSON.stringify('___\u7485')); +assertEquals('"___\u77C8"', JSON.stringify('___\u77C8')); +assertEquals('"___\u7BE9"', JSON.stringify('___\u7BE9')); +assertEquals('"___\u7CEF"', JSON.stringify('___\u7CEF')); +assertEquals('"___\u7DD5"', JSON.stringify('___\u7DD5')); +assertEquals('"___\u8DF1"', JSON.stringify('___\u8DF1')); +assertEquals('"___\u94A9"', JSON.stringify('___\u94A9')); +assertEquals('"___\u94F2"', JSON.stringify('___\u94F2')); +assertEquals('"___\u9A7A"', JSON.stringify('___\u9A7A')); +assertEquals('"___\u9AA6"', JSON.stringify('___\u9AA6')); +assertEquals('"___\uA2B0"', JSON.stringify('___\uA2B0')); +assertEquals('"___\uB711"', JSON.stringify('___\uB711')); +assertEquals('"___\uBC01"', JSON.stringify('___\uBC01')); +assertEquals('"___\uBCB6"', JSON.stringify('___\uBCB6')); +assertEquals('"___\uBD70"', JSON.stringify('___\uBD70')); +assertEquals('"___\uC3CD"', JSON.stringify('___\uC3CD')); +assertEquals('"___\uC451"', JSON.stringify('___\uC451')); +assertEquals('"___\uC677"', JSON.stringify('___\uC677')); +assertEquals('"___\uC89B"', JSON.stringify('___\uC89B')); +assertEquals('"___\uCBEF"', JSON.stringify('___\uCBEF')); +assertEquals('"___\uCEF8"', JSON.stringify('___\uCEF8')); +assertEquals('"___\uD089"', JSON.stringify('___\uD089')); +assertEquals('"___\uD24D"', JSON.stringify('___\uD24D')); +assertEquals('"___\uD3A7"', JSON.stringify('___\uD3A7')); +assertEquals('"___\uD7FF"', JSON.stringify('___\uD7FF')); + +// All lone surrogates, i.e. code points from U+D800 to U+DFFF. +assertEquals('"___\\ud800"', JSON.stringify('___\uD800')); +assertEquals('"___\\ud801"', JSON.stringify('___\uD801')); +assertEquals('"___\\ud802"', JSON.stringify('___\uD802')); +assertEquals('"___\\ud803"', JSON.stringify('___\uD803')); +assertEquals('"___\\ud804"', JSON.stringify('___\uD804')); +assertEquals('"___\\ud805"', JSON.stringify('___\uD805')); +assertEquals('"___\\ud806"', JSON.stringify('___\uD806')); +assertEquals('"___\\ud807"', JSON.stringify('___\uD807')); +assertEquals('"___\\ud808"', JSON.stringify('___\uD808')); +assertEquals('"___\\ud809"', JSON.stringify('___\uD809')); +assertEquals('"___\\ud80a"', JSON.stringify('___\uD80A')); +assertEquals('"___\\ud80b"', JSON.stringify('___\uD80B')); +assertEquals('"___\\ud80c"', JSON.stringify('___\uD80C')); +assertEquals('"___\\ud80d"', JSON.stringify('___\uD80D')); +assertEquals('"___\\ud80e"', JSON.stringify('___\uD80E')); +assertEquals('"___\\ud80f"', JSON.stringify('___\uD80F')); +assertEquals('"___\\ud810"', JSON.stringify('___\uD810')); +assertEquals('"___\\ud811"', JSON.stringify('___\uD811')); +assertEquals('"___\\ud812"', JSON.stringify('___\uD812')); +assertEquals('"___\\ud813"', JSON.stringify('___\uD813')); +assertEquals('"___\\ud814"', JSON.stringify('___\uD814')); +assertEquals('"___\\ud815"', JSON.stringify('___\uD815')); +assertEquals('"___\\ud816"', JSON.stringify('___\uD816')); +assertEquals('"___\\ud817"', JSON.stringify('___\uD817')); +assertEquals('"___\\ud818"', JSON.stringify('___\uD818')); +assertEquals('"___\\ud819"', JSON.stringify('___\uD819')); +assertEquals('"___\\ud81a"', JSON.stringify('___\uD81A')); +assertEquals('"___\\ud81b"', JSON.stringify('___\uD81B')); +assertEquals('"___\\ud81c"', JSON.stringify('___\uD81C')); +assertEquals('"___\\ud81d"', JSON.stringify('___\uD81D')); +assertEquals('"___\\ud81e"', JSON.stringify('___\uD81E')); +assertEquals('"___\\ud81f"', JSON.stringify('___\uD81F')); +assertEquals('"___\\ud820"', JSON.stringify('___\uD820')); +assertEquals('"___\\ud821"', JSON.stringify('___\uD821')); +assertEquals('"___\\ud822"', JSON.stringify('___\uD822')); +assertEquals('"___\\ud823"', JSON.stringify('___\uD823')); +assertEquals('"___\\ud824"', JSON.stringify('___\uD824')); +assertEquals('"___\\ud825"', JSON.stringify('___\uD825')); +assertEquals('"___\\ud826"', JSON.stringify('___\uD826')); +assertEquals('"___\\ud827"', JSON.stringify('___\uD827')); +assertEquals('"___\\ud828"', JSON.stringify('___\uD828')); +assertEquals('"___\\ud829"', JSON.stringify('___\uD829')); +assertEquals('"___\\ud82a"', JSON.stringify('___\uD82A')); +assertEquals('"___\\ud82b"', JSON.stringify('___\uD82B')); +assertEquals('"___\\ud82c"', JSON.stringify('___\uD82C')); +assertEquals('"___\\ud82d"', JSON.stringify('___\uD82D')); +assertEquals('"___\\ud82e"', JSON.stringify('___\uD82E')); +assertEquals('"___\\ud82f"', JSON.stringify('___\uD82F')); +assertEquals('"___\\ud830"', JSON.stringify('___\uD830')); +assertEquals('"___\\ud831"', JSON.stringify('___\uD831')); +assertEquals('"___\\ud832"', JSON.stringify('___\uD832')); +assertEquals('"___\\ud833"', JSON.stringify('___\uD833')); +assertEquals('"___\\ud834"', JSON.stringify('___\uD834')); +assertEquals('"___\\ud835"', JSON.stringify('___\uD835')); +assertEquals('"___\\ud836"', JSON.stringify('___\uD836')); +assertEquals('"___\\ud837"', JSON.stringify('___\uD837')); +assertEquals('"___\\ud838"', JSON.stringify('___\uD838')); +assertEquals('"___\\ud839"', JSON.stringify('___\uD839')); +assertEquals('"___\\ud83a"', JSON.stringify('___\uD83A')); +assertEquals('"___\\ud83b"', JSON.stringify('___\uD83B')); +assertEquals('"___\\ud83c"', JSON.stringify('___\uD83C')); +assertEquals('"___\\ud83d"', JSON.stringify('___\uD83D')); +assertEquals('"___\\ud83e"', JSON.stringify('___\uD83E')); +assertEquals('"___\\ud83f"', JSON.stringify('___\uD83F')); +assertEquals('"___\\ud840"', JSON.stringify('___\uD840')); +assertEquals('"___\\ud841"', JSON.stringify('___\uD841')); +assertEquals('"___\\ud842"', JSON.stringify('___\uD842')); +assertEquals('"___\\ud843"', JSON.stringify('___\uD843')); +assertEquals('"___\\ud844"', JSON.stringify('___\uD844')); +assertEquals('"___\\ud845"', JSON.stringify('___\uD845')); +assertEquals('"___\\ud846"', JSON.stringify('___\uD846')); +assertEquals('"___\\ud847"', JSON.stringify('___\uD847')); +assertEquals('"___\\ud848"', JSON.stringify('___\uD848')); +assertEquals('"___\\ud849"', JSON.stringify('___\uD849')); +assertEquals('"___\\ud84a"', JSON.stringify('___\uD84A')); +assertEquals('"___\\ud84b"', JSON.stringify('___\uD84B')); +assertEquals('"___\\ud84c"', JSON.stringify('___\uD84C')); +assertEquals('"___\\ud84d"', JSON.stringify('___\uD84D')); +assertEquals('"___\\ud84e"', JSON.stringify('___\uD84E')); +assertEquals('"___\\ud84f"', JSON.stringify('___\uD84F')); +assertEquals('"___\\ud850"', JSON.stringify('___\uD850')); +assertEquals('"___\\ud851"', JSON.stringify('___\uD851')); +assertEquals('"___\\ud852"', JSON.stringify('___\uD852')); +assertEquals('"___\\ud853"', JSON.stringify('___\uD853')); +assertEquals('"___\\ud854"', JSON.stringify('___\uD854')); +assertEquals('"___\\ud855"', JSON.stringify('___\uD855')); +assertEquals('"___\\ud856"', JSON.stringify('___\uD856')); +assertEquals('"___\\ud857"', JSON.stringify('___\uD857')); +assertEquals('"___\\ud858"', JSON.stringify('___\uD858')); +assertEquals('"___\\ud859"', JSON.stringify('___\uD859')); +assertEquals('"___\\ud85a"', JSON.stringify('___\uD85A')); +assertEquals('"___\\ud85b"', JSON.stringify('___\uD85B')); +assertEquals('"___\\ud85c"', JSON.stringify('___\uD85C')); +assertEquals('"___\\ud85d"', JSON.stringify('___\uD85D')); +assertEquals('"___\\ud85e"', JSON.stringify('___\uD85E')); +assertEquals('"___\\ud85f"', JSON.stringify('___\uD85F')); +assertEquals('"___\\ud860"', JSON.stringify('___\uD860')); +assertEquals('"___\\ud861"', JSON.stringify('___\uD861')); +assertEquals('"___\\ud862"', JSON.stringify('___\uD862')); +assertEquals('"___\\ud863"', JSON.stringify('___\uD863')); +assertEquals('"___\\ud864"', JSON.stringify('___\uD864')); +assertEquals('"___\\ud865"', JSON.stringify('___\uD865')); +assertEquals('"___\\ud866"', JSON.stringify('___\uD866')); +assertEquals('"___\\ud867"', JSON.stringify('___\uD867')); +assertEquals('"___\\ud868"', JSON.stringify('___\uD868')); +assertEquals('"___\\ud869"', JSON.stringify('___\uD869')); +assertEquals('"___\\ud86a"', JSON.stringify('___\uD86A')); +assertEquals('"___\\ud86b"', JSON.stringify('___\uD86B')); +assertEquals('"___\\ud86c"', JSON.stringify('___\uD86C')); +assertEquals('"___\\ud86d"', JSON.stringify('___\uD86D')); +assertEquals('"___\\ud86e"', JSON.stringify('___\uD86E')); +assertEquals('"___\\ud86f"', JSON.stringify('___\uD86F')); +assertEquals('"___\\ud870"', JSON.stringify('___\uD870')); +assertEquals('"___\\ud871"', JSON.stringify('___\uD871')); +assertEquals('"___\\ud872"', JSON.stringify('___\uD872')); +assertEquals('"___\\ud873"', JSON.stringify('___\uD873')); +assertEquals('"___\\ud874"', JSON.stringify('___\uD874')); +assertEquals('"___\\ud875"', JSON.stringify('___\uD875')); +assertEquals('"___\\ud876"', JSON.stringify('___\uD876')); +assertEquals('"___\\ud877"', JSON.stringify('___\uD877')); +assertEquals('"___\\ud878"', JSON.stringify('___\uD878')); +assertEquals('"___\\ud879"', JSON.stringify('___\uD879')); +assertEquals('"___\\ud87a"', JSON.stringify('___\uD87A')); +assertEquals('"___\\ud87b"', JSON.stringify('___\uD87B')); +assertEquals('"___\\ud87c"', JSON.stringify('___\uD87C')); +assertEquals('"___\\ud87d"', JSON.stringify('___\uD87D')); +assertEquals('"___\\ud87e"', JSON.stringify('___\uD87E')); +assertEquals('"___\\ud87f"', JSON.stringify('___\uD87F')); +assertEquals('"___\\ud880"', JSON.stringify('___\uD880')); +assertEquals('"___\\ud881"', JSON.stringify('___\uD881')); +assertEquals('"___\\ud882"', JSON.stringify('___\uD882')); +assertEquals('"___\\ud883"', JSON.stringify('___\uD883')); +assertEquals('"___\\ud884"', JSON.stringify('___\uD884')); +assertEquals('"___\\ud885"', JSON.stringify('___\uD885')); +assertEquals('"___\\ud886"', JSON.stringify('___\uD886')); +assertEquals('"___\\ud887"', JSON.stringify('___\uD887')); +assertEquals('"___\\ud888"', JSON.stringify('___\uD888')); +assertEquals('"___\\ud889"', JSON.stringify('___\uD889')); +assertEquals('"___\\ud88a"', JSON.stringify('___\uD88A')); +assertEquals('"___\\ud88b"', JSON.stringify('___\uD88B')); +assertEquals('"___\\ud88c"', JSON.stringify('___\uD88C')); +assertEquals('"___\\ud88d"', JSON.stringify('___\uD88D')); +assertEquals('"___\\ud88e"', JSON.stringify('___\uD88E')); +assertEquals('"___\\ud88f"', JSON.stringify('___\uD88F')); +assertEquals('"___\\ud890"', JSON.stringify('___\uD890')); +assertEquals('"___\\ud891"', JSON.stringify('___\uD891')); +assertEquals('"___\\ud892"', JSON.stringify('___\uD892')); +assertEquals('"___\\ud893"', JSON.stringify('___\uD893')); +assertEquals('"___\\ud894"', JSON.stringify('___\uD894')); +assertEquals('"___\\ud895"', JSON.stringify('___\uD895')); +assertEquals('"___\\ud896"', JSON.stringify('___\uD896')); +assertEquals('"___\\ud897"', JSON.stringify('___\uD897')); +assertEquals('"___\\ud898"', JSON.stringify('___\uD898')); +assertEquals('"___\\ud899"', JSON.stringify('___\uD899')); +assertEquals('"___\\ud89a"', JSON.stringify('___\uD89A')); +assertEquals('"___\\ud89b"', JSON.stringify('___\uD89B')); +assertEquals('"___\\ud89c"', JSON.stringify('___\uD89C')); +assertEquals('"___\\ud89d"', JSON.stringify('___\uD89D')); +assertEquals('"___\\ud89e"', JSON.stringify('___\uD89E')); +assertEquals('"___\\ud89f"', JSON.stringify('___\uD89F')); +assertEquals('"___\\ud8a0"', JSON.stringify('___\uD8A0')); +assertEquals('"___\\ud8a1"', JSON.stringify('___\uD8A1')); +assertEquals('"___\\ud8a2"', JSON.stringify('___\uD8A2')); +assertEquals('"___\\ud8a3"', JSON.stringify('___\uD8A3')); +assertEquals('"___\\ud8a4"', JSON.stringify('___\uD8A4')); +assertEquals('"___\\ud8a5"', JSON.stringify('___\uD8A5')); +assertEquals('"___\\ud8a6"', JSON.stringify('___\uD8A6')); +assertEquals('"___\\ud8a7"', JSON.stringify('___\uD8A7')); +assertEquals('"___\\ud8a8"', JSON.stringify('___\uD8A8')); +assertEquals('"___\\ud8a9"', JSON.stringify('___\uD8A9')); +assertEquals('"___\\ud8aa"', JSON.stringify('___\uD8AA')); +assertEquals('"___\\ud8ab"', JSON.stringify('___\uD8AB')); +assertEquals('"___\\ud8ac"', JSON.stringify('___\uD8AC')); +assertEquals('"___\\ud8ad"', JSON.stringify('___\uD8AD')); +assertEquals('"___\\ud8ae"', JSON.stringify('___\uD8AE')); +assertEquals('"___\\ud8af"', JSON.stringify('___\uD8AF')); +assertEquals('"___\\ud8b0"', JSON.stringify('___\uD8B0')); +assertEquals('"___\\ud8b1"', JSON.stringify('___\uD8B1')); +assertEquals('"___\\ud8b2"', JSON.stringify('___\uD8B2')); +assertEquals('"___\\ud8b3"', JSON.stringify('___\uD8B3')); +assertEquals('"___\\ud8b4"', JSON.stringify('___\uD8B4')); +assertEquals('"___\\ud8b5"', JSON.stringify('___\uD8B5')); +assertEquals('"___\\ud8b6"', JSON.stringify('___\uD8B6')); +assertEquals('"___\\ud8b7"', JSON.stringify('___\uD8B7')); +assertEquals('"___\\ud8b8"', JSON.stringify('___\uD8B8')); +assertEquals('"___\\ud8b9"', JSON.stringify('___\uD8B9')); +assertEquals('"___\\ud8ba"', JSON.stringify('___\uD8BA')); +assertEquals('"___\\ud8bb"', JSON.stringify('___\uD8BB')); +assertEquals('"___\\ud8bc"', JSON.stringify('___\uD8BC')); +assertEquals('"___\\ud8bd"', JSON.stringify('___\uD8BD')); +assertEquals('"___\\ud8be"', JSON.stringify('___\uD8BE')); +assertEquals('"___\\ud8bf"', JSON.stringify('___\uD8BF')); +assertEquals('"___\\ud8c0"', JSON.stringify('___\uD8C0')); +assertEquals('"___\\ud8c1"', JSON.stringify('___\uD8C1')); +assertEquals('"___\\ud8c2"', JSON.stringify('___\uD8C2')); +assertEquals('"___\\ud8c3"', JSON.stringify('___\uD8C3')); +assertEquals('"___\\ud8c4"', JSON.stringify('___\uD8C4')); +assertEquals('"___\\ud8c5"', JSON.stringify('___\uD8C5')); +assertEquals('"___\\ud8c6"', JSON.stringify('___\uD8C6')); +assertEquals('"___\\ud8c7"', JSON.stringify('___\uD8C7')); +assertEquals('"___\\ud8c8"', JSON.stringify('___\uD8C8')); +assertEquals('"___\\ud8c9"', JSON.stringify('___\uD8C9')); +assertEquals('"___\\ud8ca"', JSON.stringify('___\uD8CA')); +assertEquals('"___\\ud8cb"', JSON.stringify('___\uD8CB')); +assertEquals('"___\\ud8cc"', JSON.stringify('___\uD8CC')); +assertEquals('"___\\ud8cd"', JSON.stringify('___\uD8CD')); +assertEquals('"___\\ud8ce"', JSON.stringify('___\uD8CE')); +assertEquals('"___\\ud8cf"', JSON.stringify('___\uD8CF')); +assertEquals('"___\\ud8d0"', JSON.stringify('___\uD8D0')); +assertEquals('"___\\ud8d1"', JSON.stringify('___\uD8D1')); +assertEquals('"___\\ud8d2"', JSON.stringify('___\uD8D2')); +assertEquals('"___\\ud8d3"', JSON.stringify('___\uD8D3')); +assertEquals('"___\\ud8d4"', JSON.stringify('___\uD8D4')); +assertEquals('"___\\ud8d5"', JSON.stringify('___\uD8D5')); +assertEquals('"___\\ud8d6"', JSON.stringify('___\uD8D6')); +assertEquals('"___\\ud8d7"', JSON.stringify('___\uD8D7')); +assertEquals('"___\\ud8d8"', JSON.stringify('___\uD8D8')); +assertEquals('"___\\ud8d9"', JSON.stringify('___\uD8D9')); +assertEquals('"___\\ud8da"', JSON.stringify('___\uD8DA')); +assertEquals('"___\\ud8db"', JSON.stringify('___\uD8DB')); +assertEquals('"___\\ud8dc"', JSON.stringify('___\uD8DC')); +assertEquals('"___\\ud8dd"', JSON.stringify('___\uD8DD')); +assertEquals('"___\\ud8de"', JSON.stringify('___\uD8DE')); +assertEquals('"___\\ud8df"', JSON.stringify('___\uD8DF')); +assertEquals('"___\\ud8e0"', JSON.stringify('___\uD8E0')); +assertEquals('"___\\ud8e1"', JSON.stringify('___\uD8E1')); +assertEquals('"___\\ud8e2"', JSON.stringify('___\uD8E2')); +assertEquals('"___\\ud8e3"', JSON.stringify('___\uD8E3')); +assertEquals('"___\\ud8e4"', JSON.stringify('___\uD8E4')); +assertEquals('"___\\ud8e5"', JSON.stringify('___\uD8E5')); +assertEquals('"___\\ud8e6"', JSON.stringify('___\uD8E6')); +assertEquals('"___\\ud8e7"', JSON.stringify('___\uD8E7')); +assertEquals('"___\\ud8e8"', JSON.stringify('___\uD8E8')); +assertEquals('"___\\ud8e9"', JSON.stringify('___\uD8E9')); +assertEquals('"___\\ud8ea"', JSON.stringify('___\uD8EA')); +assertEquals('"___\\ud8eb"', JSON.stringify('___\uD8EB')); +assertEquals('"___\\ud8ec"', JSON.stringify('___\uD8EC')); +assertEquals('"___\\ud8ed"', JSON.stringify('___\uD8ED')); +assertEquals('"___\\ud8ee"', JSON.stringify('___\uD8EE')); +assertEquals('"___\\ud8ef"', JSON.stringify('___\uD8EF')); +assertEquals('"___\\ud8f0"', JSON.stringify('___\uD8F0')); +assertEquals('"___\\ud8f1"', JSON.stringify('___\uD8F1')); +assertEquals('"___\\ud8f2"', JSON.stringify('___\uD8F2')); +assertEquals('"___\\ud8f3"', JSON.stringify('___\uD8F3')); +assertEquals('"___\\ud8f4"', JSON.stringify('___\uD8F4')); +assertEquals('"___\\ud8f5"', JSON.stringify('___\uD8F5')); +assertEquals('"___\\ud8f6"', JSON.stringify('___\uD8F6')); +assertEquals('"___\\ud8f7"', JSON.stringify('___\uD8F7')); +assertEquals('"___\\ud8f8"', JSON.stringify('___\uD8F8')); +assertEquals('"___\\ud8f9"', JSON.stringify('___\uD8F9')); +assertEquals('"___\\ud8fa"', JSON.stringify('___\uD8FA')); +assertEquals('"___\\ud8fb"', JSON.stringify('___\uD8FB')); +assertEquals('"___\\ud8fc"', JSON.stringify('___\uD8FC')); +assertEquals('"___\\ud8fd"', JSON.stringify('___\uD8FD')); +assertEquals('"___\\ud8fe"', JSON.stringify('___\uD8FE')); +assertEquals('"___\\ud8ff"', JSON.stringify('___\uD8FF')); +assertEquals('"___\\ud900"', JSON.stringify('___\uD900')); +assertEquals('"___\\ud901"', JSON.stringify('___\uD901')); +assertEquals('"___\\ud902"', JSON.stringify('___\uD902')); +assertEquals('"___\\ud903"', JSON.stringify('___\uD903')); +assertEquals('"___\\ud904"', JSON.stringify('___\uD904')); +assertEquals('"___\\ud905"', JSON.stringify('___\uD905')); +assertEquals('"___\\ud906"', JSON.stringify('___\uD906')); +assertEquals('"___\\ud907"', JSON.stringify('___\uD907')); +assertEquals('"___\\ud908"', JSON.stringify('___\uD908')); +assertEquals('"___\\ud909"', JSON.stringify('___\uD909')); +assertEquals('"___\\ud90a"', JSON.stringify('___\uD90A')); +assertEquals('"___\\ud90b"', JSON.stringify('___\uD90B')); +assertEquals('"___\\ud90c"', JSON.stringify('___\uD90C')); +assertEquals('"___\\ud90d"', JSON.stringify('___\uD90D')); +assertEquals('"___\\ud90e"', JSON.stringify('___\uD90E')); +assertEquals('"___\\ud90f"', JSON.stringify('___\uD90F')); +assertEquals('"___\\ud910"', JSON.stringify('___\uD910')); +assertEquals('"___\\ud911"', JSON.stringify('___\uD911')); +assertEquals('"___\\ud912"', JSON.stringify('___\uD912')); +assertEquals('"___\\ud913"', JSON.stringify('___\uD913')); +assertEquals('"___\\ud914"', JSON.stringify('___\uD914')); +assertEquals('"___\\ud915"', JSON.stringify('___\uD915')); +assertEquals('"___\\ud916"', JSON.stringify('___\uD916')); +assertEquals('"___\\ud917"', JSON.stringify('___\uD917')); +assertEquals('"___\\ud918"', JSON.stringify('___\uD918')); +assertEquals('"___\\ud919"', JSON.stringify('___\uD919')); +assertEquals('"___\\ud91a"', JSON.stringify('___\uD91A')); +assertEquals('"___\\ud91b"', JSON.stringify('___\uD91B')); +assertEquals('"___\\ud91c"', JSON.stringify('___\uD91C')); +assertEquals('"___\\ud91d"', JSON.stringify('___\uD91D')); +assertEquals('"___\\ud91e"', JSON.stringify('___\uD91E')); +assertEquals('"___\\ud91f"', JSON.stringify('___\uD91F')); +assertEquals('"___\\ud920"', JSON.stringify('___\uD920')); +assertEquals('"___\\ud921"', JSON.stringify('___\uD921')); +assertEquals('"___\\ud922"', JSON.stringify('___\uD922')); +assertEquals('"___\\ud923"', JSON.stringify('___\uD923')); +assertEquals('"___\\ud924"', JSON.stringify('___\uD924')); +assertEquals('"___\\ud925"', JSON.stringify('___\uD925')); +assertEquals('"___\\ud926"', JSON.stringify('___\uD926')); +assertEquals('"___\\ud927"', JSON.stringify('___\uD927')); +assertEquals('"___\\ud928"', JSON.stringify('___\uD928')); +assertEquals('"___\\ud929"', JSON.stringify('___\uD929')); +assertEquals('"___\\ud92a"', JSON.stringify('___\uD92A')); +assertEquals('"___\\ud92b"', JSON.stringify('___\uD92B')); +assertEquals('"___\\ud92c"', JSON.stringify('___\uD92C')); +assertEquals('"___\\ud92d"', JSON.stringify('___\uD92D')); +assertEquals('"___\\ud92e"', JSON.stringify('___\uD92E')); +assertEquals('"___\\ud92f"', JSON.stringify('___\uD92F')); +assertEquals('"___\\ud930"', JSON.stringify('___\uD930')); +assertEquals('"___\\ud931"', JSON.stringify('___\uD931')); +assertEquals('"___\\ud932"', JSON.stringify('___\uD932')); +assertEquals('"___\\ud933"', JSON.stringify('___\uD933')); +assertEquals('"___\\ud934"', JSON.stringify('___\uD934')); +assertEquals('"___\\ud935"', JSON.stringify('___\uD935')); +assertEquals('"___\\ud936"', JSON.stringify('___\uD936')); +assertEquals('"___\\ud937"', JSON.stringify('___\uD937')); +assertEquals('"___\\ud938"', JSON.stringify('___\uD938')); +assertEquals('"___\\ud939"', JSON.stringify('___\uD939')); +assertEquals('"___\\ud93a"', JSON.stringify('___\uD93A')); +assertEquals('"___\\ud93b"', JSON.stringify('___\uD93B')); +assertEquals('"___\\ud93c"', JSON.stringify('___\uD93C')); +assertEquals('"___\\ud93d"', JSON.stringify('___\uD93D')); +assertEquals('"___\\ud93e"', JSON.stringify('___\uD93E')); +assertEquals('"___\\ud93f"', JSON.stringify('___\uD93F')); +assertEquals('"___\\ud940"', JSON.stringify('___\uD940')); +assertEquals('"___\\ud941"', JSON.stringify('___\uD941')); +assertEquals('"___\\ud942"', JSON.stringify('___\uD942')); +assertEquals('"___\\ud943"', JSON.stringify('___\uD943')); +assertEquals('"___\\ud944"', JSON.stringify('___\uD944')); +assertEquals('"___\\ud945"', JSON.stringify('___\uD945')); +assertEquals('"___\\ud946"', JSON.stringify('___\uD946')); +assertEquals('"___\\ud947"', JSON.stringify('___\uD947')); +assertEquals('"___\\ud948"', JSON.stringify('___\uD948')); +assertEquals('"___\\ud949"', JSON.stringify('___\uD949')); +assertEquals('"___\\ud94a"', JSON.stringify('___\uD94A')); +assertEquals('"___\\ud94b"', JSON.stringify('___\uD94B')); +assertEquals('"___\\ud94c"', JSON.stringify('___\uD94C')); +assertEquals('"___\\ud94d"', JSON.stringify('___\uD94D')); +assertEquals('"___\\ud94e"', JSON.stringify('___\uD94E')); +assertEquals('"___\\ud94f"', JSON.stringify('___\uD94F')); +assertEquals('"___\\ud950"', JSON.stringify('___\uD950')); +assertEquals('"___\\ud951"', JSON.stringify('___\uD951')); +assertEquals('"___\\ud952"', JSON.stringify('___\uD952')); +assertEquals('"___\\ud953"', JSON.stringify('___\uD953')); +assertEquals('"___\\ud954"', JSON.stringify('___\uD954')); +assertEquals('"___\\ud955"', JSON.stringify('___\uD955')); +assertEquals('"___\\ud956"', JSON.stringify('___\uD956')); +assertEquals('"___\\ud957"', JSON.stringify('___\uD957')); +assertEquals('"___\\ud958"', JSON.stringify('___\uD958')); +assertEquals('"___\\ud959"', JSON.stringify('___\uD959')); +assertEquals('"___\\ud95a"', JSON.stringify('___\uD95A')); +assertEquals('"___\\ud95b"', JSON.stringify('___\uD95B')); +assertEquals('"___\\ud95c"', JSON.stringify('___\uD95C')); +assertEquals('"___\\ud95d"', JSON.stringify('___\uD95D')); +assertEquals('"___\\ud95e"', JSON.stringify('___\uD95E')); +assertEquals('"___\\ud95f"', JSON.stringify('___\uD95F')); +assertEquals('"___\\ud960"', JSON.stringify('___\uD960')); +assertEquals('"___\\ud961"', JSON.stringify('___\uD961')); +assertEquals('"___\\ud962"', JSON.stringify('___\uD962')); +assertEquals('"___\\ud963"', JSON.stringify('___\uD963')); +assertEquals('"___\\ud964"', JSON.stringify('___\uD964')); +assertEquals('"___\\ud965"', JSON.stringify('___\uD965')); +assertEquals('"___\\ud966"', JSON.stringify('___\uD966')); +assertEquals('"___\\ud967"', JSON.stringify('___\uD967')); +assertEquals('"___\\ud968"', JSON.stringify('___\uD968')); +assertEquals('"___\\ud969"', JSON.stringify('___\uD969')); +assertEquals('"___\\ud96a"', JSON.stringify('___\uD96A')); +assertEquals('"___\\ud96b"', JSON.stringify('___\uD96B')); +assertEquals('"___\\ud96c"', JSON.stringify('___\uD96C')); +assertEquals('"___\\ud96d"', JSON.stringify('___\uD96D')); +assertEquals('"___\\ud96e"', JSON.stringify('___\uD96E')); +assertEquals('"___\\ud96f"', JSON.stringify('___\uD96F')); +assertEquals('"___\\ud970"', JSON.stringify('___\uD970')); +assertEquals('"___\\ud971"', JSON.stringify('___\uD971')); +assertEquals('"___\\ud972"', JSON.stringify('___\uD972')); +assertEquals('"___\\ud973"', JSON.stringify('___\uD973')); +assertEquals('"___\\ud974"', JSON.stringify('___\uD974')); +assertEquals('"___\\ud975"', JSON.stringify('___\uD975')); +assertEquals('"___\\ud976"', JSON.stringify('___\uD976')); +assertEquals('"___\\ud977"', JSON.stringify('___\uD977')); +assertEquals('"___\\ud978"', JSON.stringify('___\uD978')); +assertEquals('"___\\ud979"', JSON.stringify('___\uD979')); +assertEquals('"___\\ud97a"', JSON.stringify('___\uD97A')); +assertEquals('"___\\ud97b"', JSON.stringify('___\uD97B')); +assertEquals('"___\\ud97c"', JSON.stringify('___\uD97C')); +assertEquals('"___\\ud97d"', JSON.stringify('___\uD97D')); +assertEquals('"___\\ud97e"', JSON.stringify('___\uD97E')); +assertEquals('"___\\ud97f"', JSON.stringify('___\uD97F')); +assertEquals('"___\\ud980"', JSON.stringify('___\uD980')); +assertEquals('"___\\ud981"', JSON.stringify('___\uD981')); +assertEquals('"___\\ud982"', JSON.stringify('___\uD982')); +assertEquals('"___\\ud983"', JSON.stringify('___\uD983')); +assertEquals('"___\\ud984"', JSON.stringify('___\uD984')); +assertEquals('"___\\ud985"', JSON.stringify('___\uD985')); +assertEquals('"___\\ud986"', JSON.stringify('___\uD986')); +assertEquals('"___\\ud987"', JSON.stringify('___\uD987')); +assertEquals('"___\\ud988"', JSON.stringify('___\uD988')); +assertEquals('"___\\ud989"', JSON.stringify('___\uD989')); +assertEquals('"___\\ud98a"', JSON.stringify('___\uD98A')); +assertEquals('"___\\ud98b"', JSON.stringify('___\uD98B')); +assertEquals('"___\\ud98c"', JSON.stringify('___\uD98C')); +assertEquals('"___\\ud98d"', JSON.stringify('___\uD98D')); +assertEquals('"___\\ud98e"', JSON.stringify('___\uD98E')); +assertEquals('"___\\ud98f"', JSON.stringify('___\uD98F')); +assertEquals('"___\\ud990"', JSON.stringify('___\uD990')); +assertEquals('"___\\ud991"', JSON.stringify('___\uD991')); +assertEquals('"___\\ud992"', JSON.stringify('___\uD992')); +assertEquals('"___\\ud993"', JSON.stringify('___\uD993')); +assertEquals('"___\\ud994"', JSON.stringify('___\uD994')); +assertEquals('"___\\ud995"', JSON.stringify('___\uD995')); +assertEquals('"___\\ud996"', JSON.stringify('___\uD996')); +assertEquals('"___\\ud997"', JSON.stringify('___\uD997')); +assertEquals('"___\\ud998"', JSON.stringify('___\uD998')); +assertEquals('"___\\ud999"', JSON.stringify('___\uD999')); +assertEquals('"___\\ud99a"', JSON.stringify('___\uD99A')); +assertEquals('"___\\ud99b"', JSON.stringify('___\uD99B')); +assertEquals('"___\\ud99c"', JSON.stringify('___\uD99C')); +assertEquals('"___\\ud99d"', JSON.stringify('___\uD99D')); +assertEquals('"___\\ud99e"', JSON.stringify('___\uD99E')); +assertEquals('"___\\ud99f"', JSON.stringify('___\uD99F')); +assertEquals('"___\\ud9a0"', JSON.stringify('___\uD9A0')); +assertEquals('"___\\ud9a1"', JSON.stringify('___\uD9A1')); +assertEquals('"___\\ud9a2"', JSON.stringify('___\uD9A2')); +assertEquals('"___\\ud9a3"', JSON.stringify('___\uD9A3')); +assertEquals('"___\\ud9a4"', JSON.stringify('___\uD9A4')); +assertEquals('"___\\ud9a5"', JSON.stringify('___\uD9A5')); +assertEquals('"___\\ud9a6"', JSON.stringify('___\uD9A6')); +assertEquals('"___\\ud9a7"', JSON.stringify('___\uD9A7')); +assertEquals('"___\\ud9a8"', JSON.stringify('___\uD9A8')); +assertEquals('"___\\ud9a9"', JSON.stringify('___\uD9A9')); +assertEquals('"___\\ud9aa"', JSON.stringify('___\uD9AA')); +assertEquals('"___\\ud9ab"', JSON.stringify('___\uD9AB')); +assertEquals('"___\\ud9ac"', JSON.stringify('___\uD9AC')); +assertEquals('"___\\ud9ad"', JSON.stringify('___\uD9AD')); +assertEquals('"___\\ud9ae"', JSON.stringify('___\uD9AE')); +assertEquals('"___\\ud9af"', JSON.stringify('___\uD9AF')); +assertEquals('"___\\ud9b0"', JSON.stringify('___\uD9B0')); +assertEquals('"___\\ud9b1"', JSON.stringify('___\uD9B1')); +assertEquals('"___\\ud9b2"', JSON.stringify('___\uD9B2')); +assertEquals('"___\\ud9b3"', JSON.stringify('___\uD9B3')); +assertEquals('"___\\ud9b4"', JSON.stringify('___\uD9B4')); +assertEquals('"___\\ud9b5"', JSON.stringify('___\uD9B5')); +assertEquals('"___\\ud9b6"', JSON.stringify('___\uD9B6')); +assertEquals('"___\\ud9b7"', JSON.stringify('___\uD9B7')); +assertEquals('"___\\ud9b8"', JSON.stringify('___\uD9B8')); +assertEquals('"___\\ud9b9"', JSON.stringify('___\uD9B9')); +assertEquals('"___\\ud9ba"', JSON.stringify('___\uD9BA')); +assertEquals('"___\\ud9bb"', JSON.stringify('___\uD9BB')); +assertEquals('"___\\ud9bc"', JSON.stringify('___\uD9BC')); +assertEquals('"___\\ud9bd"', JSON.stringify('___\uD9BD')); +assertEquals('"___\\ud9be"', JSON.stringify('___\uD9BE')); +assertEquals('"___\\ud9bf"', JSON.stringify('___\uD9BF')); +assertEquals('"___\\ud9c0"', JSON.stringify('___\uD9C0')); +assertEquals('"___\\ud9c1"', JSON.stringify('___\uD9C1')); +assertEquals('"___\\ud9c2"', JSON.stringify('___\uD9C2')); +assertEquals('"___\\ud9c3"', JSON.stringify('___\uD9C3')); +assertEquals('"___\\ud9c4"', JSON.stringify('___\uD9C4')); +assertEquals('"___\\ud9c5"', JSON.stringify('___\uD9C5')); +assertEquals('"___\\ud9c6"', JSON.stringify('___\uD9C6')); +assertEquals('"___\\ud9c7"', JSON.stringify('___\uD9C7')); +assertEquals('"___\\ud9c8"', JSON.stringify('___\uD9C8')); +assertEquals('"___\\ud9c9"', JSON.stringify('___\uD9C9')); +assertEquals('"___\\ud9ca"', JSON.stringify('___\uD9CA')); +assertEquals('"___\\ud9cb"', JSON.stringify('___\uD9CB')); +assertEquals('"___\\ud9cc"', JSON.stringify('___\uD9CC')); +assertEquals('"___\\ud9cd"', JSON.stringify('___\uD9CD')); +assertEquals('"___\\ud9ce"', JSON.stringify('___\uD9CE')); +assertEquals('"___\\ud9cf"', JSON.stringify('___\uD9CF')); +assertEquals('"___\\ud9d0"', JSON.stringify('___\uD9D0')); +assertEquals('"___\\ud9d1"', JSON.stringify('___\uD9D1')); +assertEquals('"___\\ud9d2"', JSON.stringify('___\uD9D2')); +assertEquals('"___\\ud9d3"', JSON.stringify('___\uD9D3')); +assertEquals('"___\\ud9d4"', JSON.stringify('___\uD9D4')); +assertEquals('"___\\ud9d5"', JSON.stringify('___\uD9D5')); +assertEquals('"___\\ud9d6"', JSON.stringify('___\uD9D6')); +assertEquals('"___\\ud9d7"', JSON.stringify('___\uD9D7')); +assertEquals('"___\\ud9d8"', JSON.stringify('___\uD9D8')); +assertEquals('"___\\ud9d9"', JSON.stringify('___\uD9D9')); +assertEquals('"___\\ud9da"', JSON.stringify('___\uD9DA')); +assertEquals('"___\\ud9db"', JSON.stringify('___\uD9DB')); +assertEquals('"___\\ud9dc"', JSON.stringify('___\uD9DC')); +assertEquals('"___\\ud9dd"', JSON.stringify('___\uD9DD')); +assertEquals('"___\\ud9de"', JSON.stringify('___\uD9DE')); +assertEquals('"___\\ud9df"', JSON.stringify('___\uD9DF')); +assertEquals('"___\\ud9e0"', JSON.stringify('___\uD9E0')); +assertEquals('"___\\ud9e1"', JSON.stringify('___\uD9E1')); +assertEquals('"___\\ud9e2"', JSON.stringify('___\uD9E2')); +assertEquals('"___\\ud9e3"', JSON.stringify('___\uD9E3')); +assertEquals('"___\\ud9e4"', JSON.stringify('___\uD9E4')); +assertEquals('"___\\ud9e5"', JSON.stringify('___\uD9E5')); +assertEquals('"___\\ud9e6"', JSON.stringify('___\uD9E6')); +assertEquals('"___\\ud9e7"', JSON.stringify('___\uD9E7')); +assertEquals('"___\\ud9e8"', JSON.stringify('___\uD9E8')); +assertEquals('"___\\ud9e9"', JSON.stringify('___\uD9E9')); +assertEquals('"___\\ud9ea"', JSON.stringify('___\uD9EA')); +assertEquals('"___\\ud9eb"', JSON.stringify('___\uD9EB')); +assertEquals('"___\\ud9ec"', JSON.stringify('___\uD9EC')); +assertEquals('"___\\ud9ed"', JSON.stringify('___\uD9ED')); +assertEquals('"___\\ud9ee"', JSON.stringify('___\uD9EE')); +assertEquals('"___\\ud9ef"', JSON.stringify('___\uD9EF')); +assertEquals('"___\\ud9f0"', JSON.stringify('___\uD9F0')); +assertEquals('"___\\ud9f1"', JSON.stringify('___\uD9F1')); +assertEquals('"___\\ud9f2"', JSON.stringify('___\uD9F2')); +assertEquals('"___\\ud9f3"', JSON.stringify('___\uD9F3')); +assertEquals('"___\\ud9f4"', JSON.stringify('___\uD9F4')); +assertEquals('"___\\ud9f5"', JSON.stringify('___\uD9F5')); +assertEquals('"___\\ud9f6"', JSON.stringify('___\uD9F6')); +assertEquals('"___\\ud9f7"', JSON.stringify('___\uD9F7')); +assertEquals('"___\\ud9f8"', JSON.stringify('___\uD9F8')); +assertEquals('"___\\ud9f9"', JSON.stringify('___\uD9F9')); +assertEquals('"___\\ud9fa"', JSON.stringify('___\uD9FA')); +assertEquals('"___\\ud9fb"', JSON.stringify('___\uD9FB')); +assertEquals('"___\\ud9fc"', JSON.stringify('___\uD9FC')); +assertEquals('"___\\ud9fd"', JSON.stringify('___\uD9FD')); +assertEquals('"___\\ud9fe"', JSON.stringify('___\uD9FE')); +assertEquals('"___\\ud9ff"', JSON.stringify('___\uD9FF')); +assertEquals('"___\\uda00"', JSON.stringify('___\uDA00')); +assertEquals('"___\\uda01"', JSON.stringify('___\uDA01')); +assertEquals('"___\\uda02"', JSON.stringify('___\uDA02')); +assertEquals('"___\\uda03"', JSON.stringify('___\uDA03')); +assertEquals('"___\\uda04"', JSON.stringify('___\uDA04')); +assertEquals('"___\\uda05"', JSON.stringify('___\uDA05')); +assertEquals('"___\\uda06"', JSON.stringify('___\uDA06')); +assertEquals('"___\\uda07"', JSON.stringify('___\uDA07')); +assertEquals('"___\\uda08"', JSON.stringify('___\uDA08')); +assertEquals('"___\\uda09"', JSON.stringify('___\uDA09')); +assertEquals('"___\\uda0a"', JSON.stringify('___\uDA0A')); +assertEquals('"___\\uda0b"', JSON.stringify('___\uDA0B')); +assertEquals('"___\\uda0c"', JSON.stringify('___\uDA0C')); +assertEquals('"___\\uda0d"', JSON.stringify('___\uDA0D')); +assertEquals('"___\\uda0e"', JSON.stringify('___\uDA0E')); +assertEquals('"___\\uda0f"', JSON.stringify('___\uDA0F')); +assertEquals('"___\\uda10"', JSON.stringify('___\uDA10')); +assertEquals('"___\\uda11"', JSON.stringify('___\uDA11')); +assertEquals('"___\\uda12"', JSON.stringify('___\uDA12')); +assertEquals('"___\\uda13"', JSON.stringify('___\uDA13')); +assertEquals('"___\\uda14"', JSON.stringify('___\uDA14')); +assertEquals('"___\\uda15"', JSON.stringify('___\uDA15')); +assertEquals('"___\\uda16"', JSON.stringify('___\uDA16')); +assertEquals('"___\\uda17"', JSON.stringify('___\uDA17')); +assertEquals('"___\\uda18"', JSON.stringify('___\uDA18')); +assertEquals('"___\\uda19"', JSON.stringify('___\uDA19')); +assertEquals('"___\\uda1a"', JSON.stringify('___\uDA1A')); +assertEquals('"___\\uda1b"', JSON.stringify('___\uDA1B')); +assertEquals('"___\\uda1c"', JSON.stringify('___\uDA1C')); +assertEquals('"___\\uda1d"', JSON.stringify('___\uDA1D')); +assertEquals('"___\\uda1e"', JSON.stringify('___\uDA1E')); +assertEquals('"___\\uda1f"', JSON.stringify('___\uDA1F')); +assertEquals('"___\\uda20"', JSON.stringify('___\uDA20')); +assertEquals('"___\\uda21"', JSON.stringify('___\uDA21')); +assertEquals('"___\\uda22"', JSON.stringify('___\uDA22')); +assertEquals('"___\\uda23"', JSON.stringify('___\uDA23')); +assertEquals('"___\\uda24"', JSON.stringify('___\uDA24')); +assertEquals('"___\\uda25"', JSON.stringify('___\uDA25')); +assertEquals('"___\\uda26"', JSON.stringify('___\uDA26')); +assertEquals('"___\\uda27"', JSON.stringify('___\uDA27')); +assertEquals('"___\\uda28"', JSON.stringify('___\uDA28')); +assertEquals('"___\\uda29"', JSON.stringify('___\uDA29')); +assertEquals('"___\\uda2a"', JSON.stringify('___\uDA2A')); +assertEquals('"___\\uda2b"', JSON.stringify('___\uDA2B')); +assertEquals('"___\\uda2c"', JSON.stringify('___\uDA2C')); +assertEquals('"___\\uda2d"', JSON.stringify('___\uDA2D')); +assertEquals('"___\\uda2e"', JSON.stringify('___\uDA2E')); +assertEquals('"___\\uda2f"', JSON.stringify('___\uDA2F')); +assertEquals('"___\\uda30"', JSON.stringify('___\uDA30')); +assertEquals('"___\\uda31"', JSON.stringify('___\uDA31')); +assertEquals('"___\\uda32"', JSON.stringify('___\uDA32')); +assertEquals('"___\\uda33"', JSON.stringify('___\uDA33')); +assertEquals('"___\\uda34"', JSON.stringify('___\uDA34')); +assertEquals('"___\\uda35"', JSON.stringify('___\uDA35')); +assertEquals('"___\\uda36"', JSON.stringify('___\uDA36')); +assertEquals('"___\\uda37"', JSON.stringify('___\uDA37')); +assertEquals('"___\\uda38"', JSON.stringify('___\uDA38')); +assertEquals('"___\\uda39"', JSON.stringify('___\uDA39')); +assertEquals('"___\\uda3a"', JSON.stringify('___\uDA3A')); +assertEquals('"___\\uda3b"', JSON.stringify('___\uDA3B')); +assertEquals('"___\\uda3c"', JSON.stringify('___\uDA3C')); +assertEquals('"___\\uda3d"', JSON.stringify('___\uDA3D')); +assertEquals('"___\\uda3e"', JSON.stringify('___\uDA3E')); +assertEquals('"___\\uda3f"', JSON.stringify('___\uDA3F')); +assertEquals('"___\\uda40"', JSON.stringify('___\uDA40')); +assertEquals('"___\\uda41"', JSON.stringify('___\uDA41')); +assertEquals('"___\\uda42"', JSON.stringify('___\uDA42')); +assertEquals('"___\\uda43"', JSON.stringify('___\uDA43')); +assertEquals('"___\\uda44"', JSON.stringify('___\uDA44')); +assertEquals('"___\\uda45"', JSON.stringify('___\uDA45')); +assertEquals('"___\\uda46"', JSON.stringify('___\uDA46')); +assertEquals('"___\\uda47"', JSON.stringify('___\uDA47')); +assertEquals('"___\\uda48"', JSON.stringify('___\uDA48')); +assertEquals('"___\\uda49"', JSON.stringify('___\uDA49')); +assertEquals('"___\\uda4a"', JSON.stringify('___\uDA4A')); +assertEquals('"___\\uda4b"', JSON.stringify('___\uDA4B')); +assertEquals('"___\\uda4c"', JSON.stringify('___\uDA4C')); +assertEquals('"___\\uda4d"', JSON.stringify('___\uDA4D')); +assertEquals('"___\\uda4e"', JSON.stringify('___\uDA4E')); +assertEquals('"___\\uda4f"', JSON.stringify('___\uDA4F')); +assertEquals('"___\\uda50"', JSON.stringify('___\uDA50')); +assertEquals('"___\\uda51"', JSON.stringify('___\uDA51')); +assertEquals('"___\\uda52"', JSON.stringify('___\uDA52')); +assertEquals('"___\\uda53"', JSON.stringify('___\uDA53')); +assertEquals('"___\\uda54"', JSON.stringify('___\uDA54')); +assertEquals('"___\\uda55"', JSON.stringify('___\uDA55')); +assertEquals('"___\\uda56"', JSON.stringify('___\uDA56')); +assertEquals('"___\\uda57"', JSON.stringify('___\uDA57')); +assertEquals('"___\\uda58"', JSON.stringify('___\uDA58')); +assertEquals('"___\\uda59"', JSON.stringify('___\uDA59')); +assertEquals('"___\\uda5a"', JSON.stringify('___\uDA5A')); +assertEquals('"___\\uda5b"', JSON.stringify('___\uDA5B')); +assertEquals('"___\\uda5c"', JSON.stringify('___\uDA5C')); +assertEquals('"___\\uda5d"', JSON.stringify('___\uDA5D')); +assertEquals('"___\\uda5e"', JSON.stringify('___\uDA5E')); +assertEquals('"___\\uda5f"', JSON.stringify('___\uDA5F')); +assertEquals('"___\\uda60"', JSON.stringify('___\uDA60')); +assertEquals('"___\\uda61"', JSON.stringify('___\uDA61')); +assertEquals('"___\\uda62"', JSON.stringify('___\uDA62')); +assertEquals('"___\\uda63"', JSON.stringify('___\uDA63')); +assertEquals('"___\\uda64"', JSON.stringify('___\uDA64')); +assertEquals('"___\\uda65"', JSON.stringify('___\uDA65')); +assertEquals('"___\\uda66"', JSON.stringify('___\uDA66')); +assertEquals('"___\\uda67"', JSON.stringify('___\uDA67')); +assertEquals('"___\\uda68"', JSON.stringify('___\uDA68')); +assertEquals('"___\\uda69"', JSON.stringify('___\uDA69')); +assertEquals('"___\\uda6a"', JSON.stringify('___\uDA6A')); +assertEquals('"___\\uda6b"', JSON.stringify('___\uDA6B')); +assertEquals('"___\\uda6c"', JSON.stringify('___\uDA6C')); +assertEquals('"___\\uda6d"', JSON.stringify('___\uDA6D')); +assertEquals('"___\\uda6e"', JSON.stringify('___\uDA6E')); +assertEquals('"___\\uda6f"', JSON.stringify('___\uDA6F')); +assertEquals('"___\\uda70"', JSON.stringify('___\uDA70')); +assertEquals('"___\\uda71"', JSON.stringify('___\uDA71')); +assertEquals('"___\\uda72"', JSON.stringify('___\uDA72')); +assertEquals('"___\\uda73"', JSON.stringify('___\uDA73')); +assertEquals('"___\\uda74"', JSON.stringify('___\uDA74')); +assertEquals('"___\\uda75"', JSON.stringify('___\uDA75')); +assertEquals('"___\\uda76"', JSON.stringify('___\uDA76')); +assertEquals('"___\\uda77"', JSON.stringify('___\uDA77')); +assertEquals('"___\\uda78"', JSON.stringify('___\uDA78')); +assertEquals('"___\\uda79"', JSON.stringify('___\uDA79')); +assertEquals('"___\\uda7a"', JSON.stringify('___\uDA7A')); +assertEquals('"___\\uda7b"', JSON.stringify('___\uDA7B')); +assertEquals('"___\\uda7c"', JSON.stringify('___\uDA7C')); +assertEquals('"___\\uda7d"', JSON.stringify('___\uDA7D')); +assertEquals('"___\\uda7e"', JSON.stringify('___\uDA7E')); +assertEquals('"___\\uda7f"', JSON.stringify('___\uDA7F')); +assertEquals('"___\\uda80"', JSON.stringify('___\uDA80')); +assertEquals('"___\\uda81"', JSON.stringify('___\uDA81')); +assertEquals('"___\\uda82"', JSON.stringify('___\uDA82')); +assertEquals('"___\\uda83"', JSON.stringify('___\uDA83')); +assertEquals('"___\\uda84"', JSON.stringify('___\uDA84')); +assertEquals('"___\\uda85"', JSON.stringify('___\uDA85')); +assertEquals('"___\\uda86"', JSON.stringify('___\uDA86')); +assertEquals('"___\\uda87"', JSON.stringify('___\uDA87')); +assertEquals('"___\\uda88"', JSON.stringify('___\uDA88')); +assertEquals('"___\\uda89"', JSON.stringify('___\uDA89')); +assertEquals('"___\\uda8a"', JSON.stringify('___\uDA8A')); +assertEquals('"___\\uda8b"', JSON.stringify('___\uDA8B')); +assertEquals('"___\\uda8c"', JSON.stringify('___\uDA8C')); +assertEquals('"___\\uda8d"', JSON.stringify('___\uDA8D')); +assertEquals('"___\\uda8e"', JSON.stringify('___\uDA8E')); +assertEquals('"___\\uda8f"', JSON.stringify('___\uDA8F')); +assertEquals('"___\\uda90"', JSON.stringify('___\uDA90')); +assertEquals('"___\\uda91"', JSON.stringify('___\uDA91')); +assertEquals('"___\\uda92"', JSON.stringify('___\uDA92')); +assertEquals('"___\\uda93"', JSON.stringify('___\uDA93')); +assertEquals('"___\\uda94"', JSON.stringify('___\uDA94')); +assertEquals('"___\\uda95"', JSON.stringify('___\uDA95')); +assertEquals('"___\\uda96"', JSON.stringify('___\uDA96')); +assertEquals('"___\\uda97"', JSON.stringify('___\uDA97')); +assertEquals('"___\\uda98"', JSON.stringify('___\uDA98')); +assertEquals('"___\\uda99"', JSON.stringify('___\uDA99')); +assertEquals('"___\\uda9a"', JSON.stringify('___\uDA9A')); +assertEquals('"___\\uda9b"', JSON.stringify('___\uDA9B')); +assertEquals('"___\\uda9c"', JSON.stringify('___\uDA9C')); +assertEquals('"___\\uda9d"', JSON.stringify('___\uDA9D')); +assertEquals('"___\\uda9e"', JSON.stringify('___\uDA9E')); +assertEquals('"___\\uda9f"', JSON.stringify('___\uDA9F')); +assertEquals('"___\\udaa0"', JSON.stringify('___\uDAA0')); +assertEquals('"___\\udaa1"', JSON.stringify('___\uDAA1')); +assertEquals('"___\\udaa2"', JSON.stringify('___\uDAA2')); +assertEquals('"___\\udaa3"', JSON.stringify('___\uDAA3')); +assertEquals('"___\\udaa4"', JSON.stringify('___\uDAA4')); +assertEquals('"___\\udaa5"', JSON.stringify('___\uDAA5')); +assertEquals('"___\\udaa6"', JSON.stringify('___\uDAA6')); +assertEquals('"___\\udaa7"', JSON.stringify('___\uDAA7')); +assertEquals('"___\\udaa8"', JSON.stringify('___\uDAA8')); +assertEquals('"___\\udaa9"', JSON.stringify('___\uDAA9')); +assertEquals('"___\\udaaa"', JSON.stringify('___\uDAAA')); +assertEquals('"___\\udaab"', JSON.stringify('___\uDAAB')); +assertEquals('"___\\udaac"', JSON.stringify('___\uDAAC')); +assertEquals('"___\\udaad"', JSON.stringify('___\uDAAD')); +assertEquals('"___\\udaae"', JSON.stringify('___\uDAAE')); +assertEquals('"___\\udaaf"', JSON.stringify('___\uDAAF')); +assertEquals('"___\\udab0"', JSON.stringify('___\uDAB0')); +assertEquals('"___\\udab1"', JSON.stringify('___\uDAB1')); +assertEquals('"___\\udab2"', JSON.stringify('___\uDAB2')); +assertEquals('"___\\udab3"', JSON.stringify('___\uDAB3')); +assertEquals('"___\\udab4"', JSON.stringify('___\uDAB4')); +assertEquals('"___\\udab5"', JSON.stringify('___\uDAB5')); +assertEquals('"___\\udab6"', JSON.stringify('___\uDAB6')); +assertEquals('"___\\udab7"', JSON.stringify('___\uDAB7')); +assertEquals('"___\\udab8"', JSON.stringify('___\uDAB8')); +assertEquals('"___\\udab9"', JSON.stringify('___\uDAB9')); +assertEquals('"___\\udaba"', JSON.stringify('___\uDABA')); +assertEquals('"___\\udabb"', JSON.stringify('___\uDABB')); +assertEquals('"___\\udabc"', JSON.stringify('___\uDABC')); +assertEquals('"___\\udabd"', JSON.stringify('___\uDABD')); +assertEquals('"___\\udabe"', JSON.stringify('___\uDABE')); +assertEquals('"___\\udabf"', JSON.stringify('___\uDABF')); +assertEquals('"___\\udac0"', JSON.stringify('___\uDAC0')); +assertEquals('"___\\udac1"', JSON.stringify('___\uDAC1')); +assertEquals('"___\\udac2"', JSON.stringify('___\uDAC2')); +assertEquals('"___\\udac3"', JSON.stringify('___\uDAC3')); +assertEquals('"___\\udac4"', JSON.stringify('___\uDAC4')); +assertEquals('"___\\udac5"', JSON.stringify('___\uDAC5')); +assertEquals('"___\\udac6"', JSON.stringify('___\uDAC6')); +assertEquals('"___\\udac7"', JSON.stringify('___\uDAC7')); +assertEquals('"___\\udac8"', JSON.stringify('___\uDAC8')); +assertEquals('"___\\udac9"', JSON.stringify('___\uDAC9')); +assertEquals('"___\\udaca"', JSON.stringify('___\uDACA')); +assertEquals('"___\\udacb"', JSON.stringify('___\uDACB')); +assertEquals('"___\\udacc"', JSON.stringify('___\uDACC')); +assertEquals('"___\\udacd"', JSON.stringify('___\uDACD')); +assertEquals('"___\\udace"', JSON.stringify('___\uDACE')); +assertEquals('"___\\udacf"', JSON.stringify('___\uDACF')); +assertEquals('"___\\udad0"', JSON.stringify('___\uDAD0')); +assertEquals('"___\\udad1"', JSON.stringify('___\uDAD1')); +assertEquals('"___\\udad2"', JSON.stringify('___\uDAD2')); +assertEquals('"___\\udad3"', JSON.stringify('___\uDAD3')); +assertEquals('"___\\udad4"', JSON.stringify('___\uDAD4')); +assertEquals('"___\\udad5"', JSON.stringify('___\uDAD5')); +assertEquals('"___\\udad6"', JSON.stringify('___\uDAD6')); +assertEquals('"___\\udad7"', JSON.stringify('___\uDAD7')); +assertEquals('"___\\udad8"', JSON.stringify('___\uDAD8')); +assertEquals('"___\\udad9"', JSON.stringify('___\uDAD9')); +assertEquals('"___\\udada"', JSON.stringify('___\uDADA')); +assertEquals('"___\\udadb"', JSON.stringify('___\uDADB')); +assertEquals('"___\\udadc"', JSON.stringify('___\uDADC')); +assertEquals('"___\\udadd"', JSON.stringify('___\uDADD')); +assertEquals('"___\\udade"', JSON.stringify('___\uDADE')); +assertEquals('"___\\udadf"', JSON.stringify('___\uDADF')); +assertEquals('"___\\udae0"', JSON.stringify('___\uDAE0')); +assertEquals('"___\\udae1"', JSON.stringify('___\uDAE1')); +assertEquals('"___\\udae2"', JSON.stringify('___\uDAE2')); +assertEquals('"___\\udae3"', JSON.stringify('___\uDAE3')); +assertEquals('"___\\udae4"', JSON.stringify('___\uDAE4')); +assertEquals('"___\\udae5"', JSON.stringify('___\uDAE5')); +assertEquals('"___\\udae6"', JSON.stringify('___\uDAE6')); +assertEquals('"___\\udae7"', JSON.stringify('___\uDAE7')); +assertEquals('"___\\udae8"', JSON.stringify('___\uDAE8')); +assertEquals('"___\\udae9"', JSON.stringify('___\uDAE9')); +assertEquals('"___\\udaea"', JSON.stringify('___\uDAEA')); +assertEquals('"___\\udaeb"', JSON.stringify('___\uDAEB')); +assertEquals('"___\\udaec"', JSON.stringify('___\uDAEC')); +assertEquals('"___\\udaed"', JSON.stringify('___\uDAED')); +assertEquals('"___\\udaee"', JSON.stringify('___\uDAEE')); +assertEquals('"___\\udaef"', JSON.stringify('___\uDAEF')); +assertEquals('"___\\udaf0"', JSON.stringify('___\uDAF0')); +assertEquals('"___\\udaf1"', JSON.stringify('___\uDAF1')); +assertEquals('"___\\udaf2"', JSON.stringify('___\uDAF2')); +assertEquals('"___\\udaf3"', JSON.stringify('___\uDAF3')); +assertEquals('"___\\udaf4"', JSON.stringify('___\uDAF4')); +assertEquals('"___\\udaf5"', JSON.stringify('___\uDAF5')); +assertEquals('"___\\udaf6"', JSON.stringify('___\uDAF6')); +assertEquals('"___\\udaf7"', JSON.stringify('___\uDAF7')); +assertEquals('"___\\udaf8"', JSON.stringify('___\uDAF8')); +assertEquals('"___\\udaf9"', JSON.stringify('___\uDAF9')); +assertEquals('"___\\udafa"', JSON.stringify('___\uDAFA')); +assertEquals('"___\\udafb"', JSON.stringify('___\uDAFB')); +assertEquals('"___\\udafc"', JSON.stringify('___\uDAFC')); +assertEquals('"___\\udafd"', JSON.stringify('___\uDAFD')); +assertEquals('"___\\udafe"', JSON.stringify('___\uDAFE')); +assertEquals('"___\\udaff"', JSON.stringify('___\uDAFF')); +assertEquals('"___\\udb00"', JSON.stringify('___\uDB00')); +assertEquals('"___\\udb01"', JSON.stringify('___\uDB01')); +assertEquals('"___\\udb02"', JSON.stringify('___\uDB02')); +assertEquals('"___\\udb03"', JSON.stringify('___\uDB03')); +assertEquals('"___\\udb04"', JSON.stringify('___\uDB04')); +assertEquals('"___\\udb05"', JSON.stringify('___\uDB05')); +assertEquals('"___\\udb06"', JSON.stringify('___\uDB06')); +assertEquals('"___\\udb07"', JSON.stringify('___\uDB07')); +assertEquals('"___\\udb08"', JSON.stringify('___\uDB08')); +assertEquals('"___\\udb09"', JSON.stringify('___\uDB09')); +assertEquals('"___\\udb0a"', JSON.stringify('___\uDB0A')); +assertEquals('"___\\udb0b"', JSON.stringify('___\uDB0B')); +assertEquals('"___\\udb0c"', JSON.stringify('___\uDB0C')); +assertEquals('"___\\udb0d"', JSON.stringify('___\uDB0D')); +assertEquals('"___\\udb0e"', JSON.stringify('___\uDB0E')); +assertEquals('"___\\udb0f"', JSON.stringify('___\uDB0F')); +assertEquals('"___\\udb10"', JSON.stringify('___\uDB10')); +assertEquals('"___\\udb11"', JSON.stringify('___\uDB11')); +assertEquals('"___\\udb12"', JSON.stringify('___\uDB12')); +assertEquals('"___\\udb13"', JSON.stringify('___\uDB13')); +assertEquals('"___\\udb14"', JSON.stringify('___\uDB14')); +assertEquals('"___\\udb15"', JSON.stringify('___\uDB15')); +assertEquals('"___\\udb16"', JSON.stringify('___\uDB16')); +assertEquals('"___\\udb17"', JSON.stringify('___\uDB17')); +assertEquals('"___\\udb18"', JSON.stringify('___\uDB18')); +assertEquals('"___\\udb19"', JSON.stringify('___\uDB19')); +assertEquals('"___\\udb1a"', JSON.stringify('___\uDB1A')); +assertEquals('"___\\udb1b"', JSON.stringify('___\uDB1B')); +assertEquals('"___\\udb1c"', JSON.stringify('___\uDB1C')); +assertEquals('"___\\udb1d"', JSON.stringify('___\uDB1D')); +assertEquals('"___\\udb1e"', JSON.stringify('___\uDB1E')); +assertEquals('"___\\udb1f"', JSON.stringify('___\uDB1F')); +assertEquals('"___\\udb20"', JSON.stringify('___\uDB20')); +assertEquals('"___\\udb21"', JSON.stringify('___\uDB21')); +assertEquals('"___\\udb22"', JSON.stringify('___\uDB22')); +assertEquals('"___\\udb23"', JSON.stringify('___\uDB23')); +assertEquals('"___\\udb24"', JSON.stringify('___\uDB24')); +assertEquals('"___\\udb25"', JSON.stringify('___\uDB25')); +assertEquals('"___\\udb26"', JSON.stringify('___\uDB26')); +assertEquals('"___\\udb27"', JSON.stringify('___\uDB27')); +assertEquals('"___\\udb28"', JSON.stringify('___\uDB28')); +assertEquals('"___\\udb29"', JSON.stringify('___\uDB29')); +assertEquals('"___\\udb2a"', JSON.stringify('___\uDB2A')); +assertEquals('"___\\udb2b"', JSON.stringify('___\uDB2B')); +assertEquals('"___\\udb2c"', JSON.stringify('___\uDB2C')); +assertEquals('"___\\udb2d"', JSON.stringify('___\uDB2D')); +assertEquals('"___\\udb2e"', JSON.stringify('___\uDB2E')); +assertEquals('"___\\udb2f"', JSON.stringify('___\uDB2F')); +assertEquals('"___\\udb30"', JSON.stringify('___\uDB30')); +assertEquals('"___\\udb31"', JSON.stringify('___\uDB31')); +assertEquals('"___\\udb32"', JSON.stringify('___\uDB32')); +assertEquals('"___\\udb33"', JSON.stringify('___\uDB33')); +assertEquals('"___\\udb34"', JSON.stringify('___\uDB34')); +assertEquals('"___\\udb35"', JSON.stringify('___\uDB35')); +assertEquals('"___\\udb36"', JSON.stringify('___\uDB36')); +assertEquals('"___\\udb37"', JSON.stringify('___\uDB37')); +assertEquals('"___\\udb38"', JSON.stringify('___\uDB38')); +assertEquals('"___\\udb39"', JSON.stringify('___\uDB39')); +assertEquals('"___\\udb3a"', JSON.stringify('___\uDB3A')); +assertEquals('"___\\udb3b"', JSON.stringify('___\uDB3B')); +assertEquals('"___\\udb3c"', JSON.stringify('___\uDB3C')); +assertEquals('"___\\udb3d"', JSON.stringify('___\uDB3D')); +assertEquals('"___\\udb3e"', JSON.stringify('___\uDB3E')); +assertEquals('"___\\udb3f"', JSON.stringify('___\uDB3F')); +assertEquals('"___\\udb40"', JSON.stringify('___\uDB40')); +assertEquals('"___\\udb41"', JSON.stringify('___\uDB41')); +assertEquals('"___\\udb42"', JSON.stringify('___\uDB42')); +assertEquals('"___\\udb43"', JSON.stringify('___\uDB43')); +assertEquals('"___\\udb44"', JSON.stringify('___\uDB44')); +assertEquals('"___\\udb45"', JSON.stringify('___\uDB45')); +assertEquals('"___\\udb46"', JSON.stringify('___\uDB46')); +assertEquals('"___\\udb47"', JSON.stringify('___\uDB47')); +assertEquals('"___\\udb48"', JSON.stringify('___\uDB48')); +assertEquals('"___\\udb49"', JSON.stringify('___\uDB49')); +assertEquals('"___\\udb4a"', JSON.stringify('___\uDB4A')); +assertEquals('"___\\udb4b"', JSON.stringify('___\uDB4B')); +assertEquals('"___\\udb4c"', JSON.stringify('___\uDB4C')); +assertEquals('"___\\udb4d"', JSON.stringify('___\uDB4D')); +assertEquals('"___\\udb4e"', JSON.stringify('___\uDB4E')); +assertEquals('"___\\udb4f"', JSON.stringify('___\uDB4F')); +assertEquals('"___\\udb50"', JSON.stringify('___\uDB50')); +assertEquals('"___\\udb51"', JSON.stringify('___\uDB51')); +assertEquals('"___\\udb52"', JSON.stringify('___\uDB52')); +assertEquals('"___\\udb53"', JSON.stringify('___\uDB53')); +assertEquals('"___\\udb54"', JSON.stringify('___\uDB54')); +assertEquals('"___\\udb55"', JSON.stringify('___\uDB55')); +assertEquals('"___\\udb56"', JSON.stringify('___\uDB56')); +assertEquals('"___\\udb57"', JSON.stringify('___\uDB57')); +assertEquals('"___\\udb58"', JSON.stringify('___\uDB58')); +assertEquals('"___\\udb59"', JSON.stringify('___\uDB59')); +assertEquals('"___\\udb5a"', JSON.stringify('___\uDB5A')); +assertEquals('"___\\udb5b"', JSON.stringify('___\uDB5B')); +assertEquals('"___\\udb5c"', JSON.stringify('___\uDB5C')); +assertEquals('"___\\udb5d"', JSON.stringify('___\uDB5D')); +assertEquals('"___\\udb5e"', JSON.stringify('___\uDB5E')); +assertEquals('"___\\udb5f"', JSON.stringify('___\uDB5F')); +assertEquals('"___\\udb60"', JSON.stringify('___\uDB60')); +assertEquals('"___\\udb61"', JSON.stringify('___\uDB61')); +assertEquals('"___\\udb62"', JSON.stringify('___\uDB62')); +assertEquals('"___\\udb63"', JSON.stringify('___\uDB63')); +assertEquals('"___\\udb64"', JSON.stringify('___\uDB64')); +assertEquals('"___\\udb65"', JSON.stringify('___\uDB65')); +assertEquals('"___\\udb66"', JSON.stringify('___\uDB66')); +assertEquals('"___\\udb67"', JSON.stringify('___\uDB67')); +assertEquals('"___\\udb68"', JSON.stringify('___\uDB68')); +assertEquals('"___\\udb69"', JSON.stringify('___\uDB69')); +assertEquals('"___\\udb6a"', JSON.stringify('___\uDB6A')); +assertEquals('"___\\udb6b"', JSON.stringify('___\uDB6B')); +assertEquals('"___\\udb6c"', JSON.stringify('___\uDB6C')); +assertEquals('"___\\udb6d"', JSON.stringify('___\uDB6D')); +assertEquals('"___\\udb6e"', JSON.stringify('___\uDB6E')); +assertEquals('"___\\udb6f"', JSON.stringify('___\uDB6F')); +assertEquals('"___\\udb70"', JSON.stringify('___\uDB70')); +assertEquals('"___\\udb71"', JSON.stringify('___\uDB71')); +assertEquals('"___\\udb72"', JSON.stringify('___\uDB72')); +assertEquals('"___\\udb73"', JSON.stringify('___\uDB73')); +assertEquals('"___\\udb74"', JSON.stringify('___\uDB74')); +assertEquals('"___\\udb75"', JSON.stringify('___\uDB75')); +assertEquals('"___\\udb76"', JSON.stringify('___\uDB76')); +assertEquals('"___\\udb77"', JSON.stringify('___\uDB77')); +assertEquals('"___\\udb78"', JSON.stringify('___\uDB78')); +assertEquals('"___\\udb79"', JSON.stringify('___\uDB79')); +assertEquals('"___\\udb7a"', JSON.stringify('___\uDB7A')); +assertEquals('"___\\udb7b"', JSON.stringify('___\uDB7B')); +assertEquals('"___\\udb7c"', JSON.stringify('___\uDB7C')); +assertEquals('"___\\udb7d"', JSON.stringify('___\uDB7D')); +assertEquals('"___\\udb7e"', JSON.stringify('___\uDB7E')); +assertEquals('"___\\udb7f"', JSON.stringify('___\uDB7F')); +assertEquals('"___\\udb80"', JSON.stringify('___\uDB80')); +assertEquals('"___\\udb81"', JSON.stringify('___\uDB81')); +assertEquals('"___\\udb82"', JSON.stringify('___\uDB82')); +assertEquals('"___\\udb83"', JSON.stringify('___\uDB83')); +assertEquals('"___\\udb84"', JSON.stringify('___\uDB84')); +assertEquals('"___\\udb85"', JSON.stringify('___\uDB85')); +assertEquals('"___\\udb86"', JSON.stringify('___\uDB86')); +assertEquals('"___\\udb87"', JSON.stringify('___\uDB87')); +assertEquals('"___\\udb88"', JSON.stringify('___\uDB88')); +assertEquals('"___\\udb89"', JSON.stringify('___\uDB89')); +assertEquals('"___\\udb8a"', JSON.stringify('___\uDB8A')); +assertEquals('"___\\udb8b"', JSON.stringify('___\uDB8B')); +assertEquals('"___\\udb8c"', JSON.stringify('___\uDB8C')); +assertEquals('"___\\udb8d"', JSON.stringify('___\uDB8D')); +assertEquals('"___\\udb8e"', JSON.stringify('___\uDB8E')); +assertEquals('"___\\udb8f"', JSON.stringify('___\uDB8F')); +assertEquals('"___\\udb90"', JSON.stringify('___\uDB90')); +assertEquals('"___\\udb91"', JSON.stringify('___\uDB91')); +assertEquals('"___\\udb92"', JSON.stringify('___\uDB92')); +assertEquals('"___\\udb93"', JSON.stringify('___\uDB93')); +assertEquals('"___\\udb94"', JSON.stringify('___\uDB94')); +assertEquals('"___\\udb95"', JSON.stringify('___\uDB95')); +assertEquals('"___\\udb96"', JSON.stringify('___\uDB96')); +assertEquals('"___\\udb97"', JSON.stringify('___\uDB97')); +assertEquals('"___\\udb98"', JSON.stringify('___\uDB98')); +assertEquals('"___\\udb99"', JSON.stringify('___\uDB99')); +assertEquals('"___\\udb9a"', JSON.stringify('___\uDB9A')); +assertEquals('"___\\udb9b"', JSON.stringify('___\uDB9B')); +assertEquals('"___\\udb9c"', JSON.stringify('___\uDB9C')); +assertEquals('"___\\udb9d"', JSON.stringify('___\uDB9D')); +assertEquals('"___\\udb9e"', JSON.stringify('___\uDB9E')); +assertEquals('"___\\udb9f"', JSON.stringify('___\uDB9F')); +assertEquals('"___\\udba0"', JSON.stringify('___\uDBA0')); +assertEquals('"___\\udba1"', JSON.stringify('___\uDBA1')); +assertEquals('"___\\udba2"', JSON.stringify('___\uDBA2')); +assertEquals('"___\\udba3"', JSON.stringify('___\uDBA3')); +assertEquals('"___\\udba4"', JSON.stringify('___\uDBA4')); +assertEquals('"___\\udba5"', JSON.stringify('___\uDBA5')); +assertEquals('"___\\udba6"', JSON.stringify('___\uDBA6')); +assertEquals('"___\\udba7"', JSON.stringify('___\uDBA7')); +assertEquals('"___\\udba8"', JSON.stringify('___\uDBA8')); +assertEquals('"___\\udba9"', JSON.stringify('___\uDBA9')); +assertEquals('"___\\udbaa"', JSON.stringify('___\uDBAA')); +assertEquals('"___\\udbab"', JSON.stringify('___\uDBAB')); +assertEquals('"___\\udbac"', JSON.stringify('___\uDBAC')); +assertEquals('"___\\udbad"', JSON.stringify('___\uDBAD')); +assertEquals('"___\\udbae"', JSON.stringify('___\uDBAE')); +assertEquals('"___\\udbaf"', JSON.stringify('___\uDBAF')); +assertEquals('"___\\udbb0"', JSON.stringify('___\uDBB0')); +assertEquals('"___\\udbb1"', JSON.stringify('___\uDBB1')); +assertEquals('"___\\udbb2"', JSON.stringify('___\uDBB2')); +assertEquals('"___\\udbb3"', JSON.stringify('___\uDBB3')); +assertEquals('"___\\udbb4"', JSON.stringify('___\uDBB4')); +assertEquals('"___\\udbb5"', JSON.stringify('___\uDBB5')); +assertEquals('"___\\udbb6"', JSON.stringify('___\uDBB6')); +assertEquals('"___\\udbb7"', JSON.stringify('___\uDBB7')); +assertEquals('"___\\udbb8"', JSON.stringify('___\uDBB8')); +assertEquals('"___\\udbb9"', JSON.stringify('___\uDBB9')); +assertEquals('"___\\udbba"', JSON.stringify('___\uDBBA')); +assertEquals('"___\\udbbb"', JSON.stringify('___\uDBBB')); +assertEquals('"___\\udbbc"', JSON.stringify('___\uDBBC')); +assertEquals('"___\\udbbd"', JSON.stringify('___\uDBBD')); +assertEquals('"___\\udbbe"', JSON.stringify('___\uDBBE')); +assertEquals('"___\\udbbf"', JSON.stringify('___\uDBBF')); +assertEquals('"___\\udbc0"', JSON.stringify('___\uDBC0')); +assertEquals('"___\\udbc1"', JSON.stringify('___\uDBC1')); +assertEquals('"___\\udbc2"', JSON.stringify('___\uDBC2')); +assertEquals('"___\\udbc3"', JSON.stringify('___\uDBC3')); +assertEquals('"___\\udbc4"', JSON.stringify('___\uDBC4')); +assertEquals('"___\\udbc5"', JSON.stringify('___\uDBC5')); +assertEquals('"___\\udbc6"', JSON.stringify('___\uDBC6')); +assertEquals('"___\\udbc7"', JSON.stringify('___\uDBC7')); +assertEquals('"___\\udbc8"', JSON.stringify('___\uDBC8')); +assertEquals('"___\\udbc9"', JSON.stringify('___\uDBC9')); +assertEquals('"___\\udbca"', JSON.stringify('___\uDBCA')); +assertEquals('"___\\udbcb"', JSON.stringify('___\uDBCB')); +assertEquals('"___\\udbcc"', JSON.stringify('___\uDBCC')); +assertEquals('"___\\udbcd"', JSON.stringify('___\uDBCD')); +assertEquals('"___\\udbce"', JSON.stringify('___\uDBCE')); +assertEquals('"___\\udbcf"', JSON.stringify('___\uDBCF')); +assertEquals('"___\\udbd0"', JSON.stringify('___\uDBD0')); +assertEquals('"___\\udbd1"', JSON.stringify('___\uDBD1')); +assertEquals('"___\\udbd2"', JSON.stringify('___\uDBD2')); +assertEquals('"___\\udbd3"', JSON.stringify('___\uDBD3')); +assertEquals('"___\\udbd4"', JSON.stringify('___\uDBD4')); +assertEquals('"___\\udbd5"', JSON.stringify('___\uDBD5')); +assertEquals('"___\\udbd6"', JSON.stringify('___\uDBD6')); +assertEquals('"___\\udbd7"', JSON.stringify('___\uDBD7')); +assertEquals('"___\\udbd8"', JSON.stringify('___\uDBD8')); +assertEquals('"___\\udbd9"', JSON.stringify('___\uDBD9')); +assertEquals('"___\\udbda"', JSON.stringify('___\uDBDA')); +assertEquals('"___\\udbdb"', JSON.stringify('___\uDBDB')); +assertEquals('"___\\udbdc"', JSON.stringify('___\uDBDC')); +assertEquals('"___\\udbdd"', JSON.stringify('___\uDBDD')); +assertEquals('"___\\udbde"', JSON.stringify('___\uDBDE')); +assertEquals('"___\\udbdf"', JSON.stringify('___\uDBDF')); +assertEquals('"___\\udbe0"', JSON.stringify('___\uDBE0')); +assertEquals('"___\\udbe1"', JSON.stringify('___\uDBE1')); +assertEquals('"___\\udbe2"', JSON.stringify('___\uDBE2')); +assertEquals('"___\\udbe3"', JSON.stringify('___\uDBE3')); +assertEquals('"___\\udbe4"', JSON.stringify('___\uDBE4')); +assertEquals('"___\\udbe5"', JSON.stringify('___\uDBE5')); +assertEquals('"___\\udbe6"', JSON.stringify('___\uDBE6')); +assertEquals('"___\\udbe7"', JSON.stringify('___\uDBE7')); +assertEquals('"___\\udbe8"', JSON.stringify('___\uDBE8')); +assertEquals('"___\\udbe9"', JSON.stringify('___\uDBE9')); +assertEquals('"___\\udbea"', JSON.stringify('___\uDBEA')); +assertEquals('"___\\udbeb"', JSON.stringify('___\uDBEB')); +assertEquals('"___\\udbec"', JSON.stringify('___\uDBEC')); +assertEquals('"___\\udbed"', JSON.stringify('___\uDBED')); +assertEquals('"___\\udbee"', JSON.stringify('___\uDBEE')); +assertEquals('"___\\udbef"', JSON.stringify('___\uDBEF')); +assertEquals('"___\\udbf0"', JSON.stringify('___\uDBF0')); +assertEquals('"___\\udbf1"', JSON.stringify('___\uDBF1')); +assertEquals('"___\\udbf2"', JSON.stringify('___\uDBF2')); +assertEquals('"___\\udbf3"', JSON.stringify('___\uDBF3')); +assertEquals('"___\\udbf4"', JSON.stringify('___\uDBF4')); +assertEquals('"___\\udbf5"', JSON.stringify('___\uDBF5')); +assertEquals('"___\\udbf6"', JSON.stringify('___\uDBF6')); +assertEquals('"___\\udbf7"', JSON.stringify('___\uDBF7')); +assertEquals('"___\\udbf8"', JSON.stringify('___\uDBF8')); +assertEquals('"___\\udbf9"', JSON.stringify('___\uDBF9')); +assertEquals('"___\\udbfa"', JSON.stringify('___\uDBFA')); +assertEquals('"___\\udbfb"', JSON.stringify('___\uDBFB')); +assertEquals('"___\\udbfc"', JSON.stringify('___\uDBFC')); +assertEquals('"___\\udbfd"', JSON.stringify('___\uDBFD')); +assertEquals('"___\\udbfe"', JSON.stringify('___\uDBFE')); +assertEquals('"___\\udbff"', JSON.stringify('___\uDBFF')); +assertEquals('"___\\udc00"', JSON.stringify('___\uDC00')); +assertEquals('"___\\udc01"', JSON.stringify('___\uDC01')); +assertEquals('"___\\udc02"', JSON.stringify('___\uDC02')); +assertEquals('"___\\udc03"', JSON.stringify('___\uDC03')); +assertEquals('"___\\udc04"', JSON.stringify('___\uDC04')); +assertEquals('"___\\udc05"', JSON.stringify('___\uDC05')); +assertEquals('"___\\udc06"', JSON.stringify('___\uDC06')); +assertEquals('"___\\udc07"', JSON.stringify('___\uDC07')); +assertEquals('"___\\udc08"', JSON.stringify('___\uDC08')); +assertEquals('"___\\udc09"', JSON.stringify('___\uDC09')); +assertEquals('"___\\udc0a"', JSON.stringify('___\uDC0A')); +assertEquals('"___\\udc0b"', JSON.stringify('___\uDC0B')); +assertEquals('"___\\udc0c"', JSON.stringify('___\uDC0C')); +assertEquals('"___\\udc0d"', JSON.stringify('___\uDC0D')); +assertEquals('"___\\udc0e"', JSON.stringify('___\uDC0E')); +assertEquals('"___\\udc0f"', JSON.stringify('___\uDC0F')); +assertEquals('"___\\udc10"', JSON.stringify('___\uDC10')); +assertEquals('"___\\udc11"', JSON.stringify('___\uDC11')); +assertEquals('"___\\udc12"', JSON.stringify('___\uDC12')); +assertEquals('"___\\udc13"', JSON.stringify('___\uDC13')); +assertEquals('"___\\udc14"', JSON.stringify('___\uDC14')); +assertEquals('"___\\udc15"', JSON.stringify('___\uDC15')); +assertEquals('"___\\udc16"', JSON.stringify('___\uDC16')); +assertEquals('"___\\udc17"', JSON.stringify('___\uDC17')); +assertEquals('"___\\udc18"', JSON.stringify('___\uDC18')); +assertEquals('"___\\udc19"', JSON.stringify('___\uDC19')); +assertEquals('"___\\udc1a"', JSON.stringify('___\uDC1A')); +assertEquals('"___\\udc1b"', JSON.stringify('___\uDC1B')); +assertEquals('"___\\udc1c"', JSON.stringify('___\uDC1C')); +assertEquals('"___\\udc1d"', JSON.stringify('___\uDC1D')); +assertEquals('"___\\udc1e"', JSON.stringify('___\uDC1E')); +assertEquals('"___\\udc1f"', JSON.stringify('___\uDC1F')); +assertEquals('"___\\udc20"', JSON.stringify('___\uDC20')); +assertEquals('"___\\udc21"', JSON.stringify('___\uDC21')); +assertEquals('"___\\udc22"', JSON.stringify('___\uDC22')); +assertEquals('"___\\udc23"', JSON.stringify('___\uDC23')); +assertEquals('"___\\udc24"', JSON.stringify('___\uDC24')); +assertEquals('"___\\udc25"', JSON.stringify('___\uDC25')); +assertEquals('"___\\udc26"', JSON.stringify('___\uDC26')); +assertEquals('"___\\udc27"', JSON.stringify('___\uDC27')); +assertEquals('"___\\udc28"', JSON.stringify('___\uDC28')); +assertEquals('"___\\udc29"', JSON.stringify('___\uDC29')); +assertEquals('"___\\udc2a"', JSON.stringify('___\uDC2A')); +assertEquals('"___\\udc2b"', JSON.stringify('___\uDC2B')); +assertEquals('"___\\udc2c"', JSON.stringify('___\uDC2C')); +assertEquals('"___\\udc2d"', JSON.stringify('___\uDC2D')); +assertEquals('"___\\udc2e"', JSON.stringify('___\uDC2E')); +assertEquals('"___\\udc2f"', JSON.stringify('___\uDC2F')); +assertEquals('"___\\udc30"', JSON.stringify('___\uDC30')); +assertEquals('"___\\udc31"', JSON.stringify('___\uDC31')); +assertEquals('"___\\udc32"', JSON.stringify('___\uDC32')); +assertEquals('"___\\udc33"', JSON.stringify('___\uDC33')); +assertEquals('"___\\udc34"', JSON.stringify('___\uDC34')); +assertEquals('"___\\udc35"', JSON.stringify('___\uDC35')); +assertEquals('"___\\udc36"', JSON.stringify('___\uDC36')); +assertEquals('"___\\udc37"', JSON.stringify('___\uDC37')); +assertEquals('"___\\udc38"', JSON.stringify('___\uDC38')); +assertEquals('"___\\udc39"', JSON.stringify('___\uDC39')); +assertEquals('"___\\udc3a"', JSON.stringify('___\uDC3A')); +assertEquals('"___\\udc3b"', JSON.stringify('___\uDC3B')); +assertEquals('"___\\udc3c"', JSON.stringify('___\uDC3C')); +assertEquals('"___\\udc3d"', JSON.stringify('___\uDC3D')); +assertEquals('"___\\udc3e"', JSON.stringify('___\uDC3E')); +assertEquals('"___\\udc3f"', JSON.stringify('___\uDC3F')); +assertEquals('"___\\udc40"', JSON.stringify('___\uDC40')); +assertEquals('"___\\udc41"', JSON.stringify('___\uDC41')); +assertEquals('"___\\udc42"', JSON.stringify('___\uDC42')); +assertEquals('"___\\udc43"', JSON.stringify('___\uDC43')); +assertEquals('"___\\udc44"', JSON.stringify('___\uDC44')); +assertEquals('"___\\udc45"', JSON.stringify('___\uDC45')); +assertEquals('"___\\udc46"', JSON.stringify('___\uDC46')); +assertEquals('"___\\udc47"', JSON.stringify('___\uDC47')); +assertEquals('"___\\udc48"', JSON.stringify('___\uDC48')); +assertEquals('"___\\udc49"', JSON.stringify('___\uDC49')); +assertEquals('"___\\udc4a"', JSON.stringify('___\uDC4A')); +assertEquals('"___\\udc4b"', JSON.stringify('___\uDC4B')); +assertEquals('"___\\udc4c"', JSON.stringify('___\uDC4C')); +assertEquals('"___\\udc4d"', JSON.stringify('___\uDC4D')); +assertEquals('"___\\udc4e"', JSON.stringify('___\uDC4E')); +assertEquals('"___\\udc4f"', JSON.stringify('___\uDC4F')); +assertEquals('"___\\udc50"', JSON.stringify('___\uDC50')); +assertEquals('"___\\udc51"', JSON.stringify('___\uDC51')); +assertEquals('"___\\udc52"', JSON.stringify('___\uDC52')); +assertEquals('"___\\udc53"', JSON.stringify('___\uDC53')); +assertEquals('"___\\udc54"', JSON.stringify('___\uDC54')); +assertEquals('"___\\udc55"', JSON.stringify('___\uDC55')); +assertEquals('"___\\udc56"', JSON.stringify('___\uDC56')); +assertEquals('"___\\udc57"', JSON.stringify('___\uDC57')); +assertEquals('"___\\udc58"', JSON.stringify('___\uDC58')); +assertEquals('"___\\udc59"', JSON.stringify('___\uDC59')); +assertEquals('"___\\udc5a"', JSON.stringify('___\uDC5A')); +assertEquals('"___\\udc5b"', JSON.stringify('___\uDC5B')); +assertEquals('"___\\udc5c"', JSON.stringify('___\uDC5C')); +assertEquals('"___\\udc5d"', JSON.stringify('___\uDC5D')); +assertEquals('"___\\udc5e"', JSON.stringify('___\uDC5E')); +assertEquals('"___\\udc5f"', JSON.stringify('___\uDC5F')); +assertEquals('"___\\udc60"', JSON.stringify('___\uDC60')); +assertEquals('"___\\udc61"', JSON.stringify('___\uDC61')); +assertEquals('"___\\udc62"', JSON.stringify('___\uDC62')); +assertEquals('"___\\udc63"', JSON.stringify('___\uDC63')); +assertEquals('"___\\udc64"', JSON.stringify('___\uDC64')); +assertEquals('"___\\udc65"', JSON.stringify('___\uDC65')); +assertEquals('"___\\udc66"', JSON.stringify('___\uDC66')); +assertEquals('"___\\udc67"', JSON.stringify('___\uDC67')); +assertEquals('"___\\udc68"', JSON.stringify('___\uDC68')); +assertEquals('"___\\udc69"', JSON.stringify('___\uDC69')); +assertEquals('"___\\udc6a"', JSON.stringify('___\uDC6A')); +assertEquals('"___\\udc6b"', JSON.stringify('___\uDC6B')); +assertEquals('"___\\udc6c"', JSON.stringify('___\uDC6C')); +assertEquals('"___\\udc6d"', JSON.stringify('___\uDC6D')); +assertEquals('"___\\udc6e"', JSON.stringify('___\uDC6E')); +assertEquals('"___\\udc6f"', JSON.stringify('___\uDC6F')); +assertEquals('"___\\udc70"', JSON.stringify('___\uDC70')); +assertEquals('"___\\udc71"', JSON.stringify('___\uDC71')); +assertEquals('"___\\udc72"', JSON.stringify('___\uDC72')); +assertEquals('"___\\udc73"', JSON.stringify('___\uDC73')); +assertEquals('"___\\udc74"', JSON.stringify('___\uDC74')); +assertEquals('"___\\udc75"', JSON.stringify('___\uDC75')); +assertEquals('"___\\udc76"', JSON.stringify('___\uDC76')); +assertEquals('"___\\udc77"', JSON.stringify('___\uDC77')); +assertEquals('"___\\udc78"', JSON.stringify('___\uDC78')); +assertEquals('"___\\udc79"', JSON.stringify('___\uDC79')); +assertEquals('"___\\udc7a"', JSON.stringify('___\uDC7A')); +assertEquals('"___\\udc7b"', JSON.stringify('___\uDC7B')); +assertEquals('"___\\udc7c"', JSON.stringify('___\uDC7C')); +assertEquals('"___\\udc7d"', JSON.stringify('___\uDC7D')); +assertEquals('"___\\udc7e"', JSON.stringify('___\uDC7E')); +assertEquals('"___\\udc7f"', JSON.stringify('___\uDC7F')); +assertEquals('"___\\udc80"', JSON.stringify('___\uDC80')); +assertEquals('"___\\udc81"', JSON.stringify('___\uDC81')); +assertEquals('"___\\udc82"', JSON.stringify('___\uDC82')); +assertEquals('"___\\udc83"', JSON.stringify('___\uDC83')); +assertEquals('"___\\udc84"', JSON.stringify('___\uDC84')); +assertEquals('"___\\udc85"', JSON.stringify('___\uDC85')); +assertEquals('"___\\udc86"', JSON.stringify('___\uDC86')); +assertEquals('"___\\udc87"', JSON.stringify('___\uDC87')); +assertEquals('"___\\udc88"', JSON.stringify('___\uDC88')); +assertEquals('"___\\udc89"', JSON.stringify('___\uDC89')); +assertEquals('"___\\udc8a"', JSON.stringify('___\uDC8A')); +assertEquals('"___\\udc8b"', JSON.stringify('___\uDC8B')); +assertEquals('"___\\udc8c"', JSON.stringify('___\uDC8C')); +assertEquals('"___\\udc8d"', JSON.stringify('___\uDC8D')); +assertEquals('"___\\udc8e"', JSON.stringify('___\uDC8E')); +assertEquals('"___\\udc8f"', JSON.stringify('___\uDC8F')); +assertEquals('"___\\udc90"', JSON.stringify('___\uDC90')); +assertEquals('"___\\udc91"', JSON.stringify('___\uDC91')); +assertEquals('"___\\udc92"', JSON.stringify('___\uDC92')); +assertEquals('"___\\udc93"', JSON.stringify('___\uDC93')); +assertEquals('"___\\udc94"', JSON.stringify('___\uDC94')); +assertEquals('"___\\udc95"', JSON.stringify('___\uDC95')); +assertEquals('"___\\udc96"', JSON.stringify('___\uDC96')); +assertEquals('"___\\udc97"', JSON.stringify('___\uDC97')); +assertEquals('"___\\udc98"', JSON.stringify('___\uDC98')); +assertEquals('"___\\udc99"', JSON.stringify('___\uDC99')); +assertEquals('"___\\udc9a"', JSON.stringify('___\uDC9A')); +assertEquals('"___\\udc9b"', JSON.stringify('___\uDC9B')); +assertEquals('"___\\udc9c"', JSON.stringify('___\uDC9C')); +assertEquals('"___\\udc9d"', JSON.stringify('___\uDC9D')); +assertEquals('"___\\udc9e"', JSON.stringify('___\uDC9E')); +assertEquals('"___\\udc9f"', JSON.stringify('___\uDC9F')); +assertEquals('"___\\udca0"', JSON.stringify('___\uDCA0')); +assertEquals('"___\\udca1"', JSON.stringify('___\uDCA1')); +assertEquals('"___\\udca2"', JSON.stringify('___\uDCA2')); +assertEquals('"___\\udca3"', JSON.stringify('___\uDCA3')); +assertEquals('"___\\udca4"', JSON.stringify('___\uDCA4')); +assertEquals('"___\\udca5"', JSON.stringify('___\uDCA5')); +assertEquals('"___\\udca6"', JSON.stringify('___\uDCA6')); +assertEquals('"___\\udca7"', JSON.stringify('___\uDCA7')); +assertEquals('"___\\udca8"', JSON.stringify('___\uDCA8')); +assertEquals('"___\\udca9"', JSON.stringify('___\uDCA9')); +assertEquals('"___\\udcaa"', JSON.stringify('___\uDCAA')); +assertEquals('"___\\udcab"', JSON.stringify('___\uDCAB')); +assertEquals('"___\\udcac"', JSON.stringify('___\uDCAC')); +assertEquals('"___\\udcad"', JSON.stringify('___\uDCAD')); +assertEquals('"___\\udcae"', JSON.stringify('___\uDCAE')); +assertEquals('"___\\udcaf"', JSON.stringify('___\uDCAF')); +assertEquals('"___\\udcb0"', JSON.stringify('___\uDCB0')); +assertEquals('"___\\udcb1"', JSON.stringify('___\uDCB1')); +assertEquals('"___\\udcb2"', JSON.stringify('___\uDCB2')); +assertEquals('"___\\udcb3"', JSON.stringify('___\uDCB3')); +assertEquals('"___\\udcb4"', JSON.stringify('___\uDCB4')); +assertEquals('"___\\udcb5"', JSON.stringify('___\uDCB5')); +assertEquals('"___\\udcb6"', JSON.stringify('___\uDCB6')); +assertEquals('"___\\udcb7"', JSON.stringify('___\uDCB7')); +assertEquals('"___\\udcb8"', JSON.stringify('___\uDCB8')); +assertEquals('"___\\udcb9"', JSON.stringify('___\uDCB9')); +assertEquals('"___\\udcba"', JSON.stringify('___\uDCBA')); +assertEquals('"___\\udcbb"', JSON.stringify('___\uDCBB')); +assertEquals('"___\\udcbc"', JSON.stringify('___\uDCBC')); +assertEquals('"___\\udcbd"', JSON.stringify('___\uDCBD')); +assertEquals('"___\\udcbe"', JSON.stringify('___\uDCBE')); +assertEquals('"___\\udcbf"', JSON.stringify('___\uDCBF')); +assertEquals('"___\\udcc0"', JSON.stringify('___\uDCC0')); +assertEquals('"___\\udcc1"', JSON.stringify('___\uDCC1')); +assertEquals('"___\\udcc2"', JSON.stringify('___\uDCC2')); +assertEquals('"___\\udcc3"', JSON.stringify('___\uDCC3')); +assertEquals('"___\\udcc4"', JSON.stringify('___\uDCC4')); +assertEquals('"___\\udcc5"', JSON.stringify('___\uDCC5')); +assertEquals('"___\\udcc6"', JSON.stringify('___\uDCC6')); +assertEquals('"___\\udcc7"', JSON.stringify('___\uDCC7')); +assertEquals('"___\\udcc8"', JSON.stringify('___\uDCC8')); +assertEquals('"___\\udcc9"', JSON.stringify('___\uDCC9')); +assertEquals('"___\\udcca"', JSON.stringify('___\uDCCA')); +assertEquals('"___\\udccb"', JSON.stringify('___\uDCCB')); +assertEquals('"___\\udccc"', JSON.stringify('___\uDCCC')); +assertEquals('"___\\udccd"', JSON.stringify('___\uDCCD')); +assertEquals('"___\\udcce"', JSON.stringify('___\uDCCE')); +assertEquals('"___\\udccf"', JSON.stringify('___\uDCCF')); +assertEquals('"___\\udcd0"', JSON.stringify('___\uDCD0')); +assertEquals('"___\\udcd1"', JSON.stringify('___\uDCD1')); +assertEquals('"___\\udcd2"', JSON.stringify('___\uDCD2')); +assertEquals('"___\\udcd3"', JSON.stringify('___\uDCD3')); +assertEquals('"___\\udcd4"', JSON.stringify('___\uDCD4')); +assertEquals('"___\\udcd5"', JSON.stringify('___\uDCD5')); +assertEquals('"___\\udcd6"', JSON.stringify('___\uDCD6')); +assertEquals('"___\\udcd7"', JSON.stringify('___\uDCD7')); +assertEquals('"___\\udcd8"', JSON.stringify('___\uDCD8')); +assertEquals('"___\\udcd9"', JSON.stringify('___\uDCD9')); +assertEquals('"___\\udcda"', JSON.stringify('___\uDCDA')); +assertEquals('"___\\udcdb"', JSON.stringify('___\uDCDB')); +assertEquals('"___\\udcdc"', JSON.stringify('___\uDCDC')); +assertEquals('"___\\udcdd"', JSON.stringify('___\uDCDD')); +assertEquals('"___\\udcde"', JSON.stringify('___\uDCDE')); +assertEquals('"___\\udcdf"', JSON.stringify('___\uDCDF')); +assertEquals('"___\\udce0"', JSON.stringify('___\uDCE0')); +assertEquals('"___\\udce1"', JSON.stringify('___\uDCE1')); +assertEquals('"___\\udce2"', JSON.stringify('___\uDCE2')); +assertEquals('"___\\udce3"', JSON.stringify('___\uDCE3')); +assertEquals('"___\\udce4"', JSON.stringify('___\uDCE4')); +assertEquals('"___\\udce5"', JSON.stringify('___\uDCE5')); +assertEquals('"___\\udce6"', JSON.stringify('___\uDCE6')); +assertEquals('"___\\udce7"', JSON.stringify('___\uDCE7')); +assertEquals('"___\\udce8"', JSON.stringify('___\uDCE8')); +assertEquals('"___\\udce9"', JSON.stringify('___\uDCE9')); +assertEquals('"___\\udcea"', JSON.stringify('___\uDCEA')); +assertEquals('"___\\udceb"', JSON.stringify('___\uDCEB')); +assertEquals('"___\\udcec"', JSON.stringify('___\uDCEC')); +assertEquals('"___\\udced"', JSON.stringify('___\uDCED')); +assertEquals('"___\\udcee"', JSON.stringify('___\uDCEE')); +assertEquals('"___\\udcef"', JSON.stringify('___\uDCEF')); +assertEquals('"___\\udcf0"', JSON.stringify('___\uDCF0')); +assertEquals('"___\\udcf1"', JSON.stringify('___\uDCF1')); +assertEquals('"___\\udcf2"', JSON.stringify('___\uDCF2')); +assertEquals('"___\\udcf3"', JSON.stringify('___\uDCF3')); +assertEquals('"___\\udcf4"', JSON.stringify('___\uDCF4')); +assertEquals('"___\\udcf5"', JSON.stringify('___\uDCF5')); +assertEquals('"___\\udcf6"', JSON.stringify('___\uDCF6')); +assertEquals('"___\\udcf7"', JSON.stringify('___\uDCF7')); +assertEquals('"___\\udcf8"', JSON.stringify('___\uDCF8')); +assertEquals('"___\\udcf9"', JSON.stringify('___\uDCF9')); +assertEquals('"___\\udcfa"', JSON.stringify('___\uDCFA')); +assertEquals('"___\\udcfb"', JSON.stringify('___\uDCFB')); +assertEquals('"___\\udcfc"', JSON.stringify('___\uDCFC')); +assertEquals('"___\\udcfd"', JSON.stringify('___\uDCFD')); +assertEquals('"___\\udcfe"', JSON.stringify('___\uDCFE')); +assertEquals('"___\\udcff"', JSON.stringify('___\uDCFF')); +assertEquals('"___\\udd00"', JSON.stringify('___\uDD00')); +assertEquals('"___\\udd01"', JSON.stringify('___\uDD01')); +assertEquals('"___\\udd02"', JSON.stringify('___\uDD02')); +assertEquals('"___\\udd03"', JSON.stringify('___\uDD03')); +assertEquals('"___\\udd04"', JSON.stringify('___\uDD04')); +assertEquals('"___\\udd05"', JSON.stringify('___\uDD05')); +assertEquals('"___\\udd06"', JSON.stringify('___\uDD06')); +assertEquals('"___\\udd07"', JSON.stringify('___\uDD07')); +assertEquals('"___\\udd08"', JSON.stringify('___\uDD08')); +assertEquals('"___\\udd09"', JSON.stringify('___\uDD09')); +assertEquals('"___\\udd0a"', JSON.stringify('___\uDD0A')); +assertEquals('"___\\udd0b"', JSON.stringify('___\uDD0B')); +assertEquals('"___\\udd0c"', JSON.stringify('___\uDD0C')); +assertEquals('"___\\udd0d"', JSON.stringify('___\uDD0D')); +assertEquals('"___\\udd0e"', JSON.stringify('___\uDD0E')); +assertEquals('"___\\udd0f"', JSON.stringify('___\uDD0F')); +assertEquals('"___\\udd10"', JSON.stringify('___\uDD10')); +assertEquals('"___\\udd11"', JSON.stringify('___\uDD11')); +assertEquals('"___\\udd12"', JSON.stringify('___\uDD12')); +assertEquals('"___\\udd13"', JSON.stringify('___\uDD13')); +assertEquals('"___\\udd14"', JSON.stringify('___\uDD14')); +assertEquals('"___\\udd15"', JSON.stringify('___\uDD15')); +assertEquals('"___\\udd16"', JSON.stringify('___\uDD16')); +assertEquals('"___\\udd17"', JSON.stringify('___\uDD17')); +assertEquals('"___\\udd18"', JSON.stringify('___\uDD18')); +assertEquals('"___\\udd19"', JSON.stringify('___\uDD19')); +assertEquals('"___\\udd1a"', JSON.stringify('___\uDD1A')); +assertEquals('"___\\udd1b"', JSON.stringify('___\uDD1B')); +assertEquals('"___\\udd1c"', JSON.stringify('___\uDD1C')); +assertEquals('"___\\udd1d"', JSON.stringify('___\uDD1D')); +assertEquals('"___\\udd1e"', JSON.stringify('___\uDD1E')); +assertEquals('"___\\udd1f"', JSON.stringify('___\uDD1F')); +assertEquals('"___\\udd20"', JSON.stringify('___\uDD20')); +assertEquals('"___\\udd21"', JSON.stringify('___\uDD21')); +assertEquals('"___\\udd22"', JSON.stringify('___\uDD22')); +assertEquals('"___\\udd23"', JSON.stringify('___\uDD23')); +assertEquals('"___\\udd24"', JSON.stringify('___\uDD24')); +assertEquals('"___\\udd25"', JSON.stringify('___\uDD25')); +assertEquals('"___\\udd26"', JSON.stringify('___\uDD26')); +assertEquals('"___\\udd27"', JSON.stringify('___\uDD27')); +assertEquals('"___\\udd28"', JSON.stringify('___\uDD28')); +assertEquals('"___\\udd29"', JSON.stringify('___\uDD29')); +assertEquals('"___\\udd2a"', JSON.stringify('___\uDD2A')); +assertEquals('"___\\udd2b"', JSON.stringify('___\uDD2B')); +assertEquals('"___\\udd2c"', JSON.stringify('___\uDD2C')); +assertEquals('"___\\udd2d"', JSON.stringify('___\uDD2D')); +assertEquals('"___\\udd2e"', JSON.stringify('___\uDD2E')); +assertEquals('"___\\udd2f"', JSON.stringify('___\uDD2F')); +assertEquals('"___\\udd30"', JSON.stringify('___\uDD30')); +assertEquals('"___\\udd31"', JSON.stringify('___\uDD31')); +assertEquals('"___\\udd32"', JSON.stringify('___\uDD32')); +assertEquals('"___\\udd33"', JSON.stringify('___\uDD33')); +assertEquals('"___\\udd34"', JSON.stringify('___\uDD34')); +assertEquals('"___\\udd35"', JSON.stringify('___\uDD35')); +assertEquals('"___\\udd36"', JSON.stringify('___\uDD36')); +assertEquals('"___\\udd37"', JSON.stringify('___\uDD37')); +assertEquals('"___\\udd38"', JSON.stringify('___\uDD38')); +assertEquals('"___\\udd39"', JSON.stringify('___\uDD39')); +assertEquals('"___\\udd3a"', JSON.stringify('___\uDD3A')); +assertEquals('"___\\udd3b"', JSON.stringify('___\uDD3B')); +assertEquals('"___\\udd3c"', JSON.stringify('___\uDD3C')); +assertEquals('"___\\udd3d"', JSON.stringify('___\uDD3D')); +assertEquals('"___\\udd3e"', JSON.stringify('___\uDD3E')); +assertEquals('"___\\udd3f"', JSON.stringify('___\uDD3F')); +assertEquals('"___\\udd40"', JSON.stringify('___\uDD40')); +assertEquals('"___\\udd41"', JSON.stringify('___\uDD41')); +assertEquals('"___\\udd42"', JSON.stringify('___\uDD42')); +assertEquals('"___\\udd43"', JSON.stringify('___\uDD43')); +assertEquals('"___\\udd44"', JSON.stringify('___\uDD44')); +assertEquals('"___\\udd45"', JSON.stringify('___\uDD45')); +assertEquals('"___\\udd46"', JSON.stringify('___\uDD46')); +assertEquals('"___\\udd47"', JSON.stringify('___\uDD47')); +assertEquals('"___\\udd48"', JSON.stringify('___\uDD48')); +assertEquals('"___\\udd49"', JSON.stringify('___\uDD49')); +assertEquals('"___\\udd4a"', JSON.stringify('___\uDD4A')); +assertEquals('"___\\udd4b"', JSON.stringify('___\uDD4B')); +assertEquals('"___\\udd4c"', JSON.stringify('___\uDD4C')); +assertEquals('"___\\udd4d"', JSON.stringify('___\uDD4D')); +assertEquals('"___\\udd4e"', JSON.stringify('___\uDD4E')); +assertEquals('"___\\udd4f"', JSON.stringify('___\uDD4F')); +assertEquals('"___\\udd50"', JSON.stringify('___\uDD50')); +assertEquals('"___\\udd51"', JSON.stringify('___\uDD51')); +assertEquals('"___\\udd52"', JSON.stringify('___\uDD52')); +assertEquals('"___\\udd53"', JSON.stringify('___\uDD53')); +assertEquals('"___\\udd54"', JSON.stringify('___\uDD54')); +assertEquals('"___\\udd55"', JSON.stringify('___\uDD55')); +assertEquals('"___\\udd56"', JSON.stringify('___\uDD56')); +assertEquals('"___\\udd57"', JSON.stringify('___\uDD57')); +assertEquals('"___\\udd58"', JSON.stringify('___\uDD58')); +assertEquals('"___\\udd59"', JSON.stringify('___\uDD59')); +assertEquals('"___\\udd5a"', JSON.stringify('___\uDD5A')); +assertEquals('"___\\udd5b"', JSON.stringify('___\uDD5B')); +assertEquals('"___\\udd5c"', JSON.stringify('___\uDD5C')); +assertEquals('"___\\udd5d"', JSON.stringify('___\uDD5D')); +assertEquals('"___\\udd5e"', JSON.stringify('___\uDD5E')); +assertEquals('"___\\udd5f"', JSON.stringify('___\uDD5F')); +assertEquals('"___\\udd60"', JSON.stringify('___\uDD60')); +assertEquals('"___\\udd61"', JSON.stringify('___\uDD61')); +assertEquals('"___\\udd62"', JSON.stringify('___\uDD62')); +assertEquals('"___\\udd63"', JSON.stringify('___\uDD63')); +assertEquals('"___\\udd64"', JSON.stringify('___\uDD64')); +assertEquals('"___\\udd65"', JSON.stringify('___\uDD65')); +assertEquals('"___\\udd66"', JSON.stringify('___\uDD66')); +assertEquals('"___\\udd67"', JSON.stringify('___\uDD67')); +assertEquals('"___\\udd68"', JSON.stringify('___\uDD68')); +assertEquals('"___\\udd69"', JSON.stringify('___\uDD69')); +assertEquals('"___\\udd6a"', JSON.stringify('___\uDD6A')); +assertEquals('"___\\udd6b"', JSON.stringify('___\uDD6B')); +assertEquals('"___\\udd6c"', JSON.stringify('___\uDD6C')); +assertEquals('"___\\udd6d"', JSON.stringify('___\uDD6D')); +assertEquals('"___\\udd6e"', JSON.stringify('___\uDD6E')); +assertEquals('"___\\udd6f"', JSON.stringify('___\uDD6F')); +assertEquals('"___\\udd70"', JSON.stringify('___\uDD70')); +assertEquals('"___\\udd71"', JSON.stringify('___\uDD71')); +assertEquals('"___\\udd72"', JSON.stringify('___\uDD72')); +assertEquals('"___\\udd73"', JSON.stringify('___\uDD73')); +assertEquals('"___\\udd74"', JSON.stringify('___\uDD74')); +assertEquals('"___\\udd75"', JSON.stringify('___\uDD75')); +assertEquals('"___\\udd76"', JSON.stringify('___\uDD76')); +assertEquals('"___\\udd77"', JSON.stringify('___\uDD77')); +assertEquals('"___\\udd78"', JSON.stringify('___\uDD78')); +assertEquals('"___\\udd79"', JSON.stringify('___\uDD79')); +assertEquals('"___\\udd7a"', JSON.stringify('___\uDD7A')); +assertEquals('"___\\udd7b"', JSON.stringify('___\uDD7B')); +assertEquals('"___\\udd7c"', JSON.stringify('___\uDD7C')); +assertEquals('"___\\udd7d"', JSON.stringify('___\uDD7D')); +assertEquals('"___\\udd7e"', JSON.stringify('___\uDD7E')); +assertEquals('"___\\udd7f"', JSON.stringify('___\uDD7F')); +assertEquals('"___\\udd80"', JSON.stringify('___\uDD80')); +assertEquals('"___\\udd81"', JSON.stringify('___\uDD81')); +assertEquals('"___\\udd82"', JSON.stringify('___\uDD82')); +assertEquals('"___\\udd83"', JSON.stringify('___\uDD83')); +assertEquals('"___\\udd84"', JSON.stringify('___\uDD84')); +assertEquals('"___\\udd85"', JSON.stringify('___\uDD85')); +assertEquals('"___\\udd86"', JSON.stringify('___\uDD86')); +assertEquals('"___\\udd87"', JSON.stringify('___\uDD87')); +assertEquals('"___\\udd88"', JSON.stringify('___\uDD88')); +assertEquals('"___\\udd89"', JSON.stringify('___\uDD89')); +assertEquals('"___\\udd8a"', JSON.stringify('___\uDD8A')); +assertEquals('"___\\udd8b"', JSON.stringify('___\uDD8B')); +assertEquals('"___\\udd8c"', JSON.stringify('___\uDD8C')); +assertEquals('"___\\udd8d"', JSON.stringify('___\uDD8D')); +assertEquals('"___\\udd8e"', JSON.stringify('___\uDD8E')); +assertEquals('"___\\udd8f"', JSON.stringify('___\uDD8F')); +assertEquals('"___\\udd90"', JSON.stringify('___\uDD90')); +assertEquals('"___\\udd91"', JSON.stringify('___\uDD91')); +assertEquals('"___\\udd92"', JSON.stringify('___\uDD92')); +assertEquals('"___\\udd93"', JSON.stringify('___\uDD93')); +assertEquals('"___\\udd94"', JSON.stringify('___\uDD94')); +assertEquals('"___\\udd95"', JSON.stringify('___\uDD95')); +assertEquals('"___\\udd96"', JSON.stringify('___\uDD96')); +assertEquals('"___\\udd97"', JSON.stringify('___\uDD97')); +assertEquals('"___\\udd98"', JSON.stringify('___\uDD98')); +assertEquals('"___\\udd99"', JSON.stringify('___\uDD99')); +assertEquals('"___\\udd9a"', JSON.stringify('___\uDD9A')); +assertEquals('"___\\udd9b"', JSON.stringify('___\uDD9B')); +assertEquals('"___\\udd9c"', JSON.stringify('___\uDD9C')); +assertEquals('"___\\udd9d"', JSON.stringify('___\uDD9D')); +assertEquals('"___\\udd9e"', JSON.stringify('___\uDD9E')); +assertEquals('"___\\udd9f"', JSON.stringify('___\uDD9F')); +assertEquals('"___\\udda0"', JSON.stringify('___\uDDA0')); +assertEquals('"___\\udda1"', JSON.stringify('___\uDDA1')); +assertEquals('"___\\udda2"', JSON.stringify('___\uDDA2')); +assertEquals('"___\\udda3"', JSON.stringify('___\uDDA3')); +assertEquals('"___\\udda4"', JSON.stringify('___\uDDA4')); +assertEquals('"___\\udda5"', JSON.stringify('___\uDDA5')); +assertEquals('"___\\udda6"', JSON.stringify('___\uDDA6')); +assertEquals('"___\\udda7"', JSON.stringify('___\uDDA7')); +assertEquals('"___\\udda8"', JSON.stringify('___\uDDA8')); +assertEquals('"___\\udda9"', JSON.stringify('___\uDDA9')); +assertEquals('"___\\uddaa"', JSON.stringify('___\uDDAA')); +assertEquals('"___\\uddab"', JSON.stringify('___\uDDAB')); +assertEquals('"___\\uddac"', JSON.stringify('___\uDDAC')); +assertEquals('"___\\uddad"', JSON.stringify('___\uDDAD')); +assertEquals('"___\\uddae"', JSON.stringify('___\uDDAE')); +assertEquals('"___\\uddaf"', JSON.stringify('___\uDDAF')); +assertEquals('"___\\uddb0"', JSON.stringify('___\uDDB0')); +assertEquals('"___\\uddb1"', JSON.stringify('___\uDDB1')); +assertEquals('"___\\uddb2"', JSON.stringify('___\uDDB2')); +assertEquals('"___\\uddb3"', JSON.stringify('___\uDDB3')); +assertEquals('"___\\uddb4"', JSON.stringify('___\uDDB4')); +assertEquals('"___\\uddb5"', JSON.stringify('___\uDDB5')); +assertEquals('"___\\uddb6"', JSON.stringify('___\uDDB6')); +assertEquals('"___\\uddb7"', JSON.stringify('___\uDDB7')); +assertEquals('"___\\uddb8"', JSON.stringify('___\uDDB8')); +assertEquals('"___\\uddb9"', JSON.stringify('___\uDDB9')); +assertEquals('"___\\uddba"', JSON.stringify('___\uDDBA')); +assertEquals('"___\\uddbb"', JSON.stringify('___\uDDBB')); +assertEquals('"___\\uddbc"', JSON.stringify('___\uDDBC')); +assertEquals('"___\\uddbd"', JSON.stringify('___\uDDBD')); +assertEquals('"___\\uddbe"', JSON.stringify('___\uDDBE')); +assertEquals('"___\\uddbf"', JSON.stringify('___\uDDBF')); +assertEquals('"___\\uddc0"', JSON.stringify('___\uDDC0')); +assertEquals('"___\\uddc1"', JSON.stringify('___\uDDC1')); +assertEquals('"___\\uddc2"', JSON.stringify('___\uDDC2')); +assertEquals('"___\\uddc3"', JSON.stringify('___\uDDC3')); +assertEquals('"___\\uddc4"', JSON.stringify('___\uDDC4')); +assertEquals('"___\\uddc5"', JSON.stringify('___\uDDC5')); +assertEquals('"___\\uddc6"', JSON.stringify('___\uDDC6')); +assertEquals('"___\\uddc7"', JSON.stringify('___\uDDC7')); +assertEquals('"___\\uddc8"', JSON.stringify('___\uDDC8')); +assertEquals('"___\\uddc9"', JSON.stringify('___\uDDC9')); +assertEquals('"___\\uddca"', JSON.stringify('___\uDDCA')); +assertEquals('"___\\uddcb"', JSON.stringify('___\uDDCB')); +assertEquals('"___\\uddcc"', JSON.stringify('___\uDDCC')); +assertEquals('"___\\uddcd"', JSON.stringify('___\uDDCD')); +assertEquals('"___\\uddce"', JSON.stringify('___\uDDCE')); +assertEquals('"___\\uddcf"', JSON.stringify('___\uDDCF')); +assertEquals('"___\\uddd0"', JSON.stringify('___\uDDD0')); +assertEquals('"___\\uddd1"', JSON.stringify('___\uDDD1')); +assertEquals('"___\\uddd2"', JSON.stringify('___\uDDD2')); +assertEquals('"___\\uddd3"', JSON.stringify('___\uDDD3')); +assertEquals('"___\\uddd4"', JSON.stringify('___\uDDD4')); +assertEquals('"___\\uddd5"', JSON.stringify('___\uDDD5')); +assertEquals('"___\\uddd6"', JSON.stringify('___\uDDD6')); +assertEquals('"___\\uddd7"', JSON.stringify('___\uDDD7')); +assertEquals('"___\\uddd8"', JSON.stringify('___\uDDD8')); +assertEquals('"___\\uddd9"', JSON.stringify('___\uDDD9')); +assertEquals('"___\\uddda"', JSON.stringify('___\uDDDA')); +assertEquals('"___\\udddb"', JSON.stringify('___\uDDDB')); +assertEquals('"___\\udddc"', JSON.stringify('___\uDDDC')); +assertEquals('"___\\udddd"', JSON.stringify('___\uDDDD')); +assertEquals('"___\\uddde"', JSON.stringify('___\uDDDE')); +assertEquals('"___\\udddf"', JSON.stringify('___\uDDDF')); +assertEquals('"___\\udde0"', JSON.stringify('___\uDDE0')); +assertEquals('"___\\udde1"', JSON.stringify('___\uDDE1')); +assertEquals('"___\\udde2"', JSON.stringify('___\uDDE2')); +assertEquals('"___\\udde3"', JSON.stringify('___\uDDE3')); +assertEquals('"___\\udde4"', JSON.stringify('___\uDDE4')); +assertEquals('"___\\udde5"', JSON.stringify('___\uDDE5')); +assertEquals('"___\\udde6"', JSON.stringify('___\uDDE6')); +assertEquals('"___\\udde7"', JSON.stringify('___\uDDE7')); +assertEquals('"___\\udde8"', JSON.stringify('___\uDDE8')); +assertEquals('"___\\udde9"', JSON.stringify('___\uDDE9')); +assertEquals('"___\\uddea"', JSON.stringify('___\uDDEA')); +assertEquals('"___\\uddeb"', JSON.stringify('___\uDDEB')); +assertEquals('"___\\uddec"', JSON.stringify('___\uDDEC')); +assertEquals('"___\\udded"', JSON.stringify('___\uDDED')); +assertEquals('"___\\uddee"', JSON.stringify('___\uDDEE')); +assertEquals('"___\\uddef"', JSON.stringify('___\uDDEF')); +assertEquals('"___\\uddf0"', JSON.stringify('___\uDDF0')); +assertEquals('"___\\uddf1"', JSON.stringify('___\uDDF1')); +assertEquals('"___\\uddf2"', JSON.stringify('___\uDDF2')); +assertEquals('"___\\uddf3"', JSON.stringify('___\uDDF3')); +assertEquals('"___\\uddf4"', JSON.stringify('___\uDDF4')); +assertEquals('"___\\uddf5"', JSON.stringify('___\uDDF5')); +assertEquals('"___\\uddf6"', JSON.stringify('___\uDDF6')); +assertEquals('"___\\uddf7"', JSON.stringify('___\uDDF7')); +assertEquals('"___\\uddf8"', JSON.stringify('___\uDDF8')); +assertEquals('"___\\uddf9"', JSON.stringify('___\uDDF9')); +assertEquals('"___\\uddfa"', JSON.stringify('___\uDDFA')); +assertEquals('"___\\uddfb"', JSON.stringify('___\uDDFB')); +assertEquals('"___\\uddfc"', JSON.stringify('___\uDDFC')); +assertEquals('"___\\uddfd"', JSON.stringify('___\uDDFD')); +assertEquals('"___\\uddfe"', JSON.stringify('___\uDDFE')); +assertEquals('"___\\uddff"', JSON.stringify('___\uDDFF')); +assertEquals('"___\\ude00"', JSON.stringify('___\uDE00')); +assertEquals('"___\\ude01"', JSON.stringify('___\uDE01')); +assertEquals('"___\\ude02"', JSON.stringify('___\uDE02')); +assertEquals('"___\\ude03"', JSON.stringify('___\uDE03')); +assertEquals('"___\\ude04"', JSON.stringify('___\uDE04')); +assertEquals('"___\\ude05"', JSON.stringify('___\uDE05')); +assertEquals('"___\\ude06"', JSON.stringify('___\uDE06')); +assertEquals('"___\\ude07"', JSON.stringify('___\uDE07')); +assertEquals('"___\\ude08"', JSON.stringify('___\uDE08')); +assertEquals('"___\\ude09"', JSON.stringify('___\uDE09')); +assertEquals('"___\\ude0a"', JSON.stringify('___\uDE0A')); +assertEquals('"___\\ude0b"', JSON.stringify('___\uDE0B')); +assertEquals('"___\\ude0c"', JSON.stringify('___\uDE0C')); +assertEquals('"___\\ude0d"', JSON.stringify('___\uDE0D')); +assertEquals('"___\\ude0e"', JSON.stringify('___\uDE0E')); +assertEquals('"___\\ude0f"', JSON.stringify('___\uDE0F')); +assertEquals('"___\\ude10"', JSON.stringify('___\uDE10')); +assertEquals('"___\\ude11"', JSON.stringify('___\uDE11')); +assertEquals('"___\\ude12"', JSON.stringify('___\uDE12')); +assertEquals('"___\\ude13"', JSON.stringify('___\uDE13')); +assertEquals('"___\\ude14"', JSON.stringify('___\uDE14')); +assertEquals('"___\\ude15"', JSON.stringify('___\uDE15')); +assertEquals('"___\\ude16"', JSON.stringify('___\uDE16')); +assertEquals('"___\\ude17"', JSON.stringify('___\uDE17')); +assertEquals('"___\\ude18"', JSON.stringify('___\uDE18')); +assertEquals('"___\\ude19"', JSON.stringify('___\uDE19')); +assertEquals('"___\\ude1a"', JSON.stringify('___\uDE1A')); +assertEquals('"___\\ude1b"', JSON.stringify('___\uDE1B')); +assertEquals('"___\\ude1c"', JSON.stringify('___\uDE1C')); +assertEquals('"___\\ude1d"', JSON.stringify('___\uDE1D')); +assertEquals('"___\\ude1e"', JSON.stringify('___\uDE1E')); +assertEquals('"___\\ude1f"', JSON.stringify('___\uDE1F')); +assertEquals('"___\\ude20"', JSON.stringify('___\uDE20')); +assertEquals('"___\\ude21"', JSON.stringify('___\uDE21')); +assertEquals('"___\\ude22"', JSON.stringify('___\uDE22')); +assertEquals('"___\\ude23"', JSON.stringify('___\uDE23')); +assertEquals('"___\\ude24"', JSON.stringify('___\uDE24')); +assertEquals('"___\\ude25"', JSON.stringify('___\uDE25')); +assertEquals('"___\\ude26"', JSON.stringify('___\uDE26')); +assertEquals('"___\\ude27"', JSON.stringify('___\uDE27')); +assertEquals('"___\\ude28"', JSON.stringify('___\uDE28')); +assertEquals('"___\\ude29"', JSON.stringify('___\uDE29')); +assertEquals('"___\\ude2a"', JSON.stringify('___\uDE2A')); +assertEquals('"___\\ude2b"', JSON.stringify('___\uDE2B')); +assertEquals('"___\\ude2c"', JSON.stringify('___\uDE2C')); +assertEquals('"___\\ude2d"', JSON.stringify('___\uDE2D')); +assertEquals('"___\\ude2e"', JSON.stringify('___\uDE2E')); +assertEquals('"___\\ude2f"', JSON.stringify('___\uDE2F')); +assertEquals('"___\\ude30"', JSON.stringify('___\uDE30')); +assertEquals('"___\\ude31"', JSON.stringify('___\uDE31')); +assertEquals('"___\\ude32"', JSON.stringify('___\uDE32')); +assertEquals('"___\\ude33"', JSON.stringify('___\uDE33')); +assertEquals('"___\\ude34"', JSON.stringify('___\uDE34')); +assertEquals('"___\\ude35"', JSON.stringify('___\uDE35')); +assertEquals('"___\\ude36"', JSON.stringify('___\uDE36')); +assertEquals('"___\\ude37"', JSON.stringify('___\uDE37')); +assertEquals('"___\\ude38"', JSON.stringify('___\uDE38')); +assertEquals('"___\\ude39"', JSON.stringify('___\uDE39')); +assertEquals('"___\\ude3a"', JSON.stringify('___\uDE3A')); +assertEquals('"___\\ude3b"', JSON.stringify('___\uDE3B')); +assertEquals('"___\\ude3c"', JSON.stringify('___\uDE3C')); +assertEquals('"___\\ude3d"', JSON.stringify('___\uDE3D')); +assertEquals('"___\\ude3e"', JSON.stringify('___\uDE3E')); +assertEquals('"___\\ude3f"', JSON.stringify('___\uDE3F')); +assertEquals('"___\\ude40"', JSON.stringify('___\uDE40')); +assertEquals('"___\\ude41"', JSON.stringify('___\uDE41')); +assertEquals('"___\\ude42"', JSON.stringify('___\uDE42')); +assertEquals('"___\\ude43"', JSON.stringify('___\uDE43')); +assertEquals('"___\\ude44"', JSON.stringify('___\uDE44')); +assertEquals('"___\\ude45"', JSON.stringify('___\uDE45')); +assertEquals('"___\\ude46"', JSON.stringify('___\uDE46')); +assertEquals('"___\\ude47"', JSON.stringify('___\uDE47')); +assertEquals('"___\\ude48"', JSON.stringify('___\uDE48')); +assertEquals('"___\\ude49"', JSON.stringify('___\uDE49')); +assertEquals('"___\\ude4a"', JSON.stringify('___\uDE4A')); +assertEquals('"___\\ude4b"', JSON.stringify('___\uDE4B')); +assertEquals('"___\\ude4c"', JSON.stringify('___\uDE4C')); +assertEquals('"___\\ude4d"', JSON.stringify('___\uDE4D')); +assertEquals('"___\\ude4e"', JSON.stringify('___\uDE4E')); +assertEquals('"___\\ude4f"', JSON.stringify('___\uDE4F')); +assertEquals('"___\\ude50"', JSON.stringify('___\uDE50')); +assertEquals('"___\\ude51"', JSON.stringify('___\uDE51')); +assertEquals('"___\\ude52"', JSON.stringify('___\uDE52')); +assertEquals('"___\\ude53"', JSON.stringify('___\uDE53')); +assertEquals('"___\\ude54"', JSON.stringify('___\uDE54')); +assertEquals('"___\\ude55"', JSON.stringify('___\uDE55')); +assertEquals('"___\\ude56"', JSON.stringify('___\uDE56')); +assertEquals('"___\\ude57"', JSON.stringify('___\uDE57')); +assertEquals('"___\\ude58"', JSON.stringify('___\uDE58')); +assertEquals('"___\\ude59"', JSON.stringify('___\uDE59')); +assertEquals('"___\\ude5a"', JSON.stringify('___\uDE5A')); +assertEquals('"___\\ude5b"', JSON.stringify('___\uDE5B')); +assertEquals('"___\\ude5c"', JSON.stringify('___\uDE5C')); +assertEquals('"___\\ude5d"', JSON.stringify('___\uDE5D')); +assertEquals('"___\\ude5e"', JSON.stringify('___\uDE5E')); +assertEquals('"___\\ude5f"', JSON.stringify('___\uDE5F')); +assertEquals('"___\\ude60"', JSON.stringify('___\uDE60')); +assertEquals('"___\\ude61"', JSON.stringify('___\uDE61')); +assertEquals('"___\\ude62"', JSON.stringify('___\uDE62')); +assertEquals('"___\\ude63"', JSON.stringify('___\uDE63')); +assertEquals('"___\\ude64"', JSON.stringify('___\uDE64')); +assertEquals('"___\\ude65"', JSON.stringify('___\uDE65')); +assertEquals('"___\\ude66"', JSON.stringify('___\uDE66')); +assertEquals('"___\\ude67"', JSON.stringify('___\uDE67')); +assertEquals('"___\\ude68"', JSON.stringify('___\uDE68')); +assertEquals('"___\\ude69"', JSON.stringify('___\uDE69')); +assertEquals('"___\\ude6a"', JSON.stringify('___\uDE6A')); +assertEquals('"___\\ude6b"', JSON.stringify('___\uDE6B')); +assertEquals('"___\\ude6c"', JSON.stringify('___\uDE6C')); +assertEquals('"___\\ude6d"', JSON.stringify('___\uDE6D')); +assertEquals('"___\\ude6e"', JSON.stringify('___\uDE6E')); +assertEquals('"___\\ude6f"', JSON.stringify('___\uDE6F')); +assertEquals('"___\\ude70"', JSON.stringify('___\uDE70')); +assertEquals('"___\\ude71"', JSON.stringify('___\uDE71')); +assertEquals('"___\\ude72"', JSON.stringify('___\uDE72')); +assertEquals('"___\\ude73"', JSON.stringify('___\uDE73')); +assertEquals('"___\\ude74"', JSON.stringify('___\uDE74')); +assertEquals('"___\\ude75"', JSON.stringify('___\uDE75')); +assertEquals('"___\\ude76"', JSON.stringify('___\uDE76')); +assertEquals('"___\\ude77"', JSON.stringify('___\uDE77')); +assertEquals('"___\\ude78"', JSON.stringify('___\uDE78')); +assertEquals('"___\\ude79"', JSON.stringify('___\uDE79')); +assertEquals('"___\\ude7a"', JSON.stringify('___\uDE7A')); +assertEquals('"___\\ude7b"', JSON.stringify('___\uDE7B')); +assertEquals('"___\\ude7c"', JSON.stringify('___\uDE7C')); +assertEquals('"___\\ude7d"', JSON.stringify('___\uDE7D')); +assertEquals('"___\\ude7e"', JSON.stringify('___\uDE7E')); +assertEquals('"___\\ude7f"', JSON.stringify('___\uDE7F')); +assertEquals('"___\\ude80"', JSON.stringify('___\uDE80')); +assertEquals('"___\\ude81"', JSON.stringify('___\uDE81')); +assertEquals('"___\\ude82"', JSON.stringify('___\uDE82')); +assertEquals('"___\\ude83"', JSON.stringify('___\uDE83')); +assertEquals('"___\\ude84"', JSON.stringify('___\uDE84')); +assertEquals('"___\\ude85"', JSON.stringify('___\uDE85')); +assertEquals('"___\\ude86"', JSON.stringify('___\uDE86')); +assertEquals('"___\\ude87"', JSON.stringify('___\uDE87')); +assertEquals('"___\\ude88"', JSON.stringify('___\uDE88')); +assertEquals('"___\\ude89"', JSON.stringify('___\uDE89')); +assertEquals('"___\\ude8a"', JSON.stringify('___\uDE8A')); +assertEquals('"___\\ude8b"', JSON.stringify('___\uDE8B')); +assertEquals('"___\\ude8c"', JSON.stringify('___\uDE8C')); +assertEquals('"___\\ude8d"', JSON.stringify('___\uDE8D')); +assertEquals('"___\\ude8e"', JSON.stringify('___\uDE8E')); +assertEquals('"___\\ude8f"', JSON.stringify('___\uDE8F')); +assertEquals('"___\\ude90"', JSON.stringify('___\uDE90')); +assertEquals('"___\\ude91"', JSON.stringify('___\uDE91')); +assertEquals('"___\\ude92"', JSON.stringify('___\uDE92')); +assertEquals('"___\\ude93"', JSON.stringify('___\uDE93')); +assertEquals('"___\\ude94"', JSON.stringify('___\uDE94')); +assertEquals('"___\\ude95"', JSON.stringify('___\uDE95')); +assertEquals('"___\\ude96"', JSON.stringify('___\uDE96')); +assertEquals('"___\\ude97"', JSON.stringify('___\uDE97')); +assertEquals('"___\\ude98"', JSON.stringify('___\uDE98')); +assertEquals('"___\\ude99"', JSON.stringify('___\uDE99')); +assertEquals('"___\\ude9a"', JSON.stringify('___\uDE9A')); +assertEquals('"___\\ude9b"', JSON.stringify('___\uDE9B')); +assertEquals('"___\\ude9c"', JSON.stringify('___\uDE9C')); +assertEquals('"___\\ude9d"', JSON.stringify('___\uDE9D')); +assertEquals('"___\\ude9e"', JSON.stringify('___\uDE9E')); +assertEquals('"___\\ude9f"', JSON.stringify('___\uDE9F')); +assertEquals('"___\\udea0"', JSON.stringify('___\uDEA0')); +assertEquals('"___\\udea1"', JSON.stringify('___\uDEA1')); +assertEquals('"___\\udea2"', JSON.stringify('___\uDEA2')); +assertEquals('"___\\udea3"', JSON.stringify('___\uDEA3')); +assertEquals('"___\\udea4"', JSON.stringify('___\uDEA4')); +assertEquals('"___\\udea5"', JSON.stringify('___\uDEA5')); +assertEquals('"___\\udea6"', JSON.stringify('___\uDEA6')); +assertEquals('"___\\udea7"', JSON.stringify('___\uDEA7')); +assertEquals('"___\\udea8"', JSON.stringify('___\uDEA8')); +assertEquals('"___\\udea9"', JSON.stringify('___\uDEA9')); +assertEquals('"___\\udeaa"', JSON.stringify('___\uDEAA')); +assertEquals('"___\\udeab"', JSON.stringify('___\uDEAB')); +assertEquals('"___\\udeac"', JSON.stringify('___\uDEAC')); +assertEquals('"___\\udead"', JSON.stringify('___\uDEAD')); +assertEquals('"___\\udeae"', JSON.stringify('___\uDEAE')); +assertEquals('"___\\udeaf"', JSON.stringify('___\uDEAF')); +assertEquals('"___\\udeb0"', JSON.stringify('___\uDEB0')); +assertEquals('"___\\udeb1"', JSON.stringify('___\uDEB1')); +assertEquals('"___\\udeb2"', JSON.stringify('___\uDEB2')); +assertEquals('"___\\udeb3"', JSON.stringify('___\uDEB3')); +assertEquals('"___\\udeb4"', JSON.stringify('___\uDEB4')); +assertEquals('"___\\udeb5"', JSON.stringify('___\uDEB5')); +assertEquals('"___\\udeb6"', JSON.stringify('___\uDEB6')); +assertEquals('"___\\udeb7"', JSON.stringify('___\uDEB7')); +assertEquals('"___\\udeb8"', JSON.stringify('___\uDEB8')); +assertEquals('"___\\udeb9"', JSON.stringify('___\uDEB9')); +assertEquals('"___\\udeba"', JSON.stringify('___\uDEBA')); +assertEquals('"___\\udebb"', JSON.stringify('___\uDEBB')); +assertEquals('"___\\udebc"', JSON.stringify('___\uDEBC')); +assertEquals('"___\\udebd"', JSON.stringify('___\uDEBD')); +assertEquals('"___\\udebe"', JSON.stringify('___\uDEBE')); +assertEquals('"___\\udebf"', JSON.stringify('___\uDEBF')); +assertEquals('"___\\udec0"', JSON.stringify('___\uDEC0')); +assertEquals('"___\\udec1"', JSON.stringify('___\uDEC1')); +assertEquals('"___\\udec2"', JSON.stringify('___\uDEC2')); +assertEquals('"___\\udec3"', JSON.stringify('___\uDEC3')); +assertEquals('"___\\udec4"', JSON.stringify('___\uDEC4')); +assertEquals('"___\\udec5"', JSON.stringify('___\uDEC5')); +assertEquals('"___\\udec6"', JSON.stringify('___\uDEC6')); +assertEquals('"___\\udec7"', JSON.stringify('___\uDEC7')); +assertEquals('"___\\udec8"', JSON.stringify('___\uDEC8')); +assertEquals('"___\\udec9"', JSON.stringify('___\uDEC9')); +assertEquals('"___\\udeca"', JSON.stringify('___\uDECA')); +assertEquals('"___\\udecb"', JSON.stringify('___\uDECB')); +assertEquals('"___\\udecc"', JSON.stringify('___\uDECC')); +assertEquals('"___\\udecd"', JSON.stringify('___\uDECD')); +assertEquals('"___\\udece"', JSON.stringify('___\uDECE')); +assertEquals('"___\\udecf"', JSON.stringify('___\uDECF')); +assertEquals('"___\\uded0"', JSON.stringify('___\uDED0')); +assertEquals('"___\\uded1"', JSON.stringify('___\uDED1')); +assertEquals('"___\\uded2"', JSON.stringify('___\uDED2')); +assertEquals('"___\\uded3"', JSON.stringify('___\uDED3')); +assertEquals('"___\\uded4"', JSON.stringify('___\uDED4')); +assertEquals('"___\\uded5"', JSON.stringify('___\uDED5')); +assertEquals('"___\\uded6"', JSON.stringify('___\uDED6')); +assertEquals('"___\\uded7"', JSON.stringify('___\uDED7')); +assertEquals('"___\\uded8"', JSON.stringify('___\uDED8')); +assertEquals('"___\\uded9"', JSON.stringify('___\uDED9')); +assertEquals('"___\\udeda"', JSON.stringify('___\uDEDA')); +assertEquals('"___\\udedb"', JSON.stringify('___\uDEDB')); +assertEquals('"___\\udedc"', JSON.stringify('___\uDEDC')); +assertEquals('"___\\udedd"', JSON.stringify('___\uDEDD')); +assertEquals('"___\\udede"', JSON.stringify('___\uDEDE')); +assertEquals('"___\\udedf"', JSON.stringify('___\uDEDF')); +assertEquals('"___\\udee0"', JSON.stringify('___\uDEE0')); +assertEquals('"___\\udee1"', JSON.stringify('___\uDEE1')); +assertEquals('"___\\udee2"', JSON.stringify('___\uDEE2')); +assertEquals('"___\\udee3"', JSON.stringify('___\uDEE3')); +assertEquals('"___\\udee4"', JSON.stringify('___\uDEE4')); +assertEquals('"___\\udee5"', JSON.stringify('___\uDEE5')); +assertEquals('"___\\udee6"', JSON.stringify('___\uDEE6')); +assertEquals('"___\\udee7"', JSON.stringify('___\uDEE7')); +assertEquals('"___\\udee8"', JSON.stringify('___\uDEE8')); +assertEquals('"___\\udee9"', JSON.stringify('___\uDEE9')); +assertEquals('"___\\udeea"', JSON.stringify('___\uDEEA')); +assertEquals('"___\\udeeb"', JSON.stringify('___\uDEEB')); +assertEquals('"___\\udeec"', JSON.stringify('___\uDEEC')); +assertEquals('"___\\udeed"', JSON.stringify('___\uDEED')); +assertEquals('"___\\udeee"', JSON.stringify('___\uDEEE')); +assertEquals('"___\\udeef"', JSON.stringify('___\uDEEF')); +assertEquals('"___\\udef0"', JSON.stringify('___\uDEF0')); +assertEquals('"___\\udef1"', JSON.stringify('___\uDEF1')); +assertEquals('"___\\udef2"', JSON.stringify('___\uDEF2')); +assertEquals('"___\\udef3"', JSON.stringify('___\uDEF3')); +assertEquals('"___\\udef4"', JSON.stringify('___\uDEF4')); +assertEquals('"___\\udef5"', JSON.stringify('___\uDEF5')); +assertEquals('"___\\udef6"', JSON.stringify('___\uDEF6')); +assertEquals('"___\\udef7"', JSON.stringify('___\uDEF7')); +assertEquals('"___\\udef8"', JSON.stringify('___\uDEF8')); +assertEquals('"___\\udef9"', JSON.stringify('___\uDEF9')); +assertEquals('"___\\udefa"', JSON.stringify('___\uDEFA')); +assertEquals('"___\\udefb"', JSON.stringify('___\uDEFB')); +assertEquals('"___\\udefc"', JSON.stringify('___\uDEFC')); +assertEquals('"___\\udefd"', JSON.stringify('___\uDEFD')); +assertEquals('"___\\udefe"', JSON.stringify('___\uDEFE')); +assertEquals('"___\\udeff"', JSON.stringify('___\uDEFF')); +assertEquals('"___\\udf00"', JSON.stringify('___\uDF00')); +assertEquals('"___\\udf01"', JSON.stringify('___\uDF01')); +assertEquals('"___\\udf02"', JSON.stringify('___\uDF02')); +assertEquals('"___\\udf03"', JSON.stringify('___\uDF03')); +assertEquals('"___\\udf04"', JSON.stringify('___\uDF04')); +assertEquals('"___\\udf05"', JSON.stringify('___\uDF05')); +assertEquals('"___\\udf06"', JSON.stringify('___\uDF06')); +assertEquals('"___\\udf07"', JSON.stringify('___\uDF07')); +assertEquals('"___\\udf08"', JSON.stringify('___\uDF08')); +assertEquals('"___\\udf09"', JSON.stringify('___\uDF09')); +assertEquals('"___\\udf0a"', JSON.stringify('___\uDF0A')); +assertEquals('"___\\udf0b"', JSON.stringify('___\uDF0B')); +assertEquals('"___\\udf0c"', JSON.stringify('___\uDF0C')); +assertEquals('"___\\udf0d"', JSON.stringify('___\uDF0D')); +assertEquals('"___\\udf0e"', JSON.stringify('___\uDF0E')); +assertEquals('"___\\udf0f"', JSON.stringify('___\uDF0F')); +assertEquals('"___\\udf10"', JSON.stringify('___\uDF10')); +assertEquals('"___\\udf11"', JSON.stringify('___\uDF11')); +assertEquals('"___\\udf12"', JSON.stringify('___\uDF12')); +assertEquals('"___\\udf13"', JSON.stringify('___\uDF13')); +assertEquals('"___\\udf14"', JSON.stringify('___\uDF14')); +assertEquals('"___\\udf15"', JSON.stringify('___\uDF15')); +assertEquals('"___\\udf16"', JSON.stringify('___\uDF16')); +assertEquals('"___\\udf17"', JSON.stringify('___\uDF17')); +assertEquals('"___\\udf18"', JSON.stringify('___\uDF18')); +assertEquals('"___\\udf19"', JSON.stringify('___\uDF19')); +assertEquals('"___\\udf1a"', JSON.stringify('___\uDF1A')); +assertEquals('"___\\udf1b"', JSON.stringify('___\uDF1B')); +assertEquals('"___\\udf1c"', JSON.stringify('___\uDF1C')); +assertEquals('"___\\udf1d"', JSON.stringify('___\uDF1D')); +assertEquals('"___\\udf1e"', JSON.stringify('___\uDF1E')); +assertEquals('"___\\udf1f"', JSON.stringify('___\uDF1F')); +assertEquals('"___\\udf20"', JSON.stringify('___\uDF20')); +assertEquals('"___\\udf21"', JSON.stringify('___\uDF21')); +assertEquals('"___\\udf22"', JSON.stringify('___\uDF22')); +assertEquals('"___\\udf23"', JSON.stringify('___\uDF23')); +assertEquals('"___\\udf24"', JSON.stringify('___\uDF24')); +assertEquals('"___\\udf25"', JSON.stringify('___\uDF25')); +assertEquals('"___\\udf26"', JSON.stringify('___\uDF26')); +assertEquals('"___\\udf27"', JSON.stringify('___\uDF27')); +assertEquals('"___\\udf28"', JSON.stringify('___\uDF28')); +assertEquals('"___\\udf29"', JSON.stringify('___\uDF29')); +assertEquals('"___\\udf2a"', JSON.stringify('___\uDF2A')); +assertEquals('"___\\udf2b"', JSON.stringify('___\uDF2B')); +assertEquals('"___\\udf2c"', JSON.stringify('___\uDF2C')); +assertEquals('"___\\udf2d"', JSON.stringify('___\uDF2D')); +assertEquals('"___\\udf2e"', JSON.stringify('___\uDF2E')); +assertEquals('"___\\udf2f"', JSON.stringify('___\uDF2F')); +assertEquals('"___\\udf30"', JSON.stringify('___\uDF30')); +assertEquals('"___\\udf31"', JSON.stringify('___\uDF31')); +assertEquals('"___\\udf32"', JSON.stringify('___\uDF32')); +assertEquals('"___\\udf33"', JSON.stringify('___\uDF33')); +assertEquals('"___\\udf34"', JSON.stringify('___\uDF34')); +assertEquals('"___\\udf35"', JSON.stringify('___\uDF35')); +assertEquals('"___\\udf36"', JSON.stringify('___\uDF36')); +assertEquals('"___\\udf37"', JSON.stringify('___\uDF37')); +assertEquals('"___\\udf38"', JSON.stringify('___\uDF38')); +assertEquals('"___\\udf39"', JSON.stringify('___\uDF39')); +assertEquals('"___\\udf3a"', JSON.stringify('___\uDF3A')); +assertEquals('"___\\udf3b"', JSON.stringify('___\uDF3B')); +assertEquals('"___\\udf3c"', JSON.stringify('___\uDF3C')); +assertEquals('"___\\udf3d"', JSON.stringify('___\uDF3D')); +assertEquals('"___\\udf3e"', JSON.stringify('___\uDF3E')); +assertEquals('"___\\udf3f"', JSON.stringify('___\uDF3F')); +assertEquals('"___\\udf40"', JSON.stringify('___\uDF40')); +assertEquals('"___\\udf41"', JSON.stringify('___\uDF41')); +assertEquals('"___\\udf42"', JSON.stringify('___\uDF42')); +assertEquals('"___\\udf43"', JSON.stringify('___\uDF43')); +assertEquals('"___\\udf44"', JSON.stringify('___\uDF44')); +assertEquals('"___\\udf45"', JSON.stringify('___\uDF45')); +assertEquals('"___\\udf46"', JSON.stringify('___\uDF46')); +assertEquals('"___\\udf47"', JSON.stringify('___\uDF47')); +assertEquals('"___\\udf48"', JSON.stringify('___\uDF48')); +assertEquals('"___\\udf49"', JSON.stringify('___\uDF49')); +assertEquals('"___\\udf4a"', JSON.stringify('___\uDF4A')); +assertEquals('"___\\udf4b"', JSON.stringify('___\uDF4B')); +assertEquals('"___\\udf4c"', JSON.stringify('___\uDF4C')); +assertEquals('"___\\udf4d"', JSON.stringify('___\uDF4D')); +assertEquals('"___\\udf4e"', JSON.stringify('___\uDF4E')); +assertEquals('"___\\udf4f"', JSON.stringify('___\uDF4F')); +assertEquals('"___\\udf50"', JSON.stringify('___\uDF50')); +assertEquals('"___\\udf51"', JSON.stringify('___\uDF51')); +assertEquals('"___\\udf52"', JSON.stringify('___\uDF52')); +assertEquals('"___\\udf53"', JSON.stringify('___\uDF53')); +assertEquals('"___\\udf54"', JSON.stringify('___\uDF54')); +assertEquals('"___\\udf55"', JSON.stringify('___\uDF55')); +assertEquals('"___\\udf56"', JSON.stringify('___\uDF56')); +assertEquals('"___\\udf57"', JSON.stringify('___\uDF57')); +assertEquals('"___\\udf58"', JSON.stringify('___\uDF58')); +assertEquals('"___\\udf59"', JSON.stringify('___\uDF59')); +assertEquals('"___\\udf5a"', JSON.stringify('___\uDF5A')); +assertEquals('"___\\udf5b"', JSON.stringify('___\uDF5B')); +assertEquals('"___\\udf5c"', JSON.stringify('___\uDF5C')); +assertEquals('"___\\udf5d"', JSON.stringify('___\uDF5D')); +assertEquals('"___\\udf5e"', JSON.stringify('___\uDF5E')); +assertEquals('"___\\udf5f"', JSON.stringify('___\uDF5F')); +assertEquals('"___\\udf60"', JSON.stringify('___\uDF60')); +assertEquals('"___\\udf61"', JSON.stringify('___\uDF61')); +assertEquals('"___\\udf62"', JSON.stringify('___\uDF62')); +assertEquals('"___\\udf63"', JSON.stringify('___\uDF63')); +assertEquals('"___\\udf64"', JSON.stringify('___\uDF64')); +assertEquals('"___\\udf65"', JSON.stringify('___\uDF65')); +assertEquals('"___\\udf66"', JSON.stringify('___\uDF66')); +assertEquals('"___\\udf67"', JSON.stringify('___\uDF67')); +assertEquals('"___\\udf68"', JSON.stringify('___\uDF68')); +assertEquals('"___\\udf69"', JSON.stringify('___\uDF69')); +assertEquals('"___\\udf6a"', JSON.stringify('___\uDF6A')); +assertEquals('"___\\udf6b"', JSON.stringify('___\uDF6B')); +assertEquals('"___\\udf6c"', JSON.stringify('___\uDF6C')); +assertEquals('"___\\udf6d"', JSON.stringify('___\uDF6D')); +assertEquals('"___\\udf6e"', JSON.stringify('___\uDF6E')); +assertEquals('"___\\udf6f"', JSON.stringify('___\uDF6F')); +assertEquals('"___\\udf70"', JSON.stringify('___\uDF70')); +assertEquals('"___\\udf71"', JSON.stringify('___\uDF71')); +assertEquals('"___\\udf72"', JSON.stringify('___\uDF72')); +assertEquals('"___\\udf73"', JSON.stringify('___\uDF73')); +assertEquals('"___\\udf74"', JSON.stringify('___\uDF74')); +assertEquals('"___\\udf75"', JSON.stringify('___\uDF75')); +assertEquals('"___\\udf76"', JSON.stringify('___\uDF76')); +assertEquals('"___\\udf77"', JSON.stringify('___\uDF77')); +assertEquals('"___\\udf78"', JSON.stringify('___\uDF78')); +assertEquals('"___\\udf79"', JSON.stringify('___\uDF79')); +assertEquals('"___\\udf7a"', JSON.stringify('___\uDF7A')); +assertEquals('"___\\udf7b"', JSON.stringify('___\uDF7B')); +assertEquals('"___\\udf7c"', JSON.stringify('___\uDF7C')); +assertEquals('"___\\udf7d"', JSON.stringify('___\uDF7D')); +assertEquals('"___\\udf7e"', JSON.stringify('___\uDF7E')); +assertEquals('"___\\udf7f"', JSON.stringify('___\uDF7F')); +assertEquals('"___\\udf80"', JSON.stringify('___\uDF80')); +assertEquals('"___\\udf81"', JSON.stringify('___\uDF81')); +assertEquals('"___\\udf82"', JSON.stringify('___\uDF82')); +assertEquals('"___\\udf83"', JSON.stringify('___\uDF83')); +assertEquals('"___\\udf84"', JSON.stringify('___\uDF84')); +assertEquals('"___\\udf85"', JSON.stringify('___\uDF85')); +assertEquals('"___\\udf86"', JSON.stringify('___\uDF86')); +assertEquals('"___\\udf87"', JSON.stringify('___\uDF87')); +assertEquals('"___\\udf88"', JSON.stringify('___\uDF88')); +assertEquals('"___\\udf89"', JSON.stringify('___\uDF89')); +assertEquals('"___\\udf8a"', JSON.stringify('___\uDF8A')); +assertEquals('"___\\udf8b"', JSON.stringify('___\uDF8B')); +assertEquals('"___\\udf8c"', JSON.stringify('___\uDF8C')); +assertEquals('"___\\udf8d"', JSON.stringify('___\uDF8D')); +assertEquals('"___\\udf8e"', JSON.stringify('___\uDF8E')); +assertEquals('"___\\udf8f"', JSON.stringify('___\uDF8F')); +assertEquals('"___\\udf90"', JSON.stringify('___\uDF90')); +assertEquals('"___\\udf91"', JSON.stringify('___\uDF91')); +assertEquals('"___\\udf92"', JSON.stringify('___\uDF92')); +assertEquals('"___\\udf93"', JSON.stringify('___\uDF93')); +assertEquals('"___\\udf94"', JSON.stringify('___\uDF94')); +assertEquals('"___\\udf95"', JSON.stringify('___\uDF95')); +assertEquals('"___\\udf96"', JSON.stringify('___\uDF96')); +assertEquals('"___\\udf97"', JSON.stringify('___\uDF97')); +assertEquals('"___\\udf98"', JSON.stringify('___\uDF98')); +assertEquals('"___\\udf99"', JSON.stringify('___\uDF99')); +assertEquals('"___\\udf9a"', JSON.stringify('___\uDF9A')); +assertEquals('"___\\udf9b"', JSON.stringify('___\uDF9B')); +assertEquals('"___\\udf9c"', JSON.stringify('___\uDF9C')); +assertEquals('"___\\udf9d"', JSON.stringify('___\uDF9D')); +assertEquals('"___\\udf9e"', JSON.stringify('___\uDF9E')); +assertEquals('"___\\udf9f"', JSON.stringify('___\uDF9F')); +assertEquals('"___\\udfa0"', JSON.stringify('___\uDFA0')); +assertEquals('"___\\udfa1"', JSON.stringify('___\uDFA1')); +assertEquals('"___\\udfa2"', JSON.stringify('___\uDFA2')); +assertEquals('"___\\udfa3"', JSON.stringify('___\uDFA3')); +assertEquals('"___\\udfa4"', JSON.stringify('___\uDFA4')); +assertEquals('"___\\udfa5"', JSON.stringify('___\uDFA5')); +assertEquals('"___\\udfa6"', JSON.stringify('___\uDFA6')); +assertEquals('"___\\udfa7"', JSON.stringify('___\uDFA7')); +assertEquals('"___\\udfa8"', JSON.stringify('___\uDFA8')); +assertEquals('"___\\udfa9"', JSON.stringify('___\uDFA9')); +assertEquals('"___\\udfaa"', JSON.stringify('___\uDFAA')); +assertEquals('"___\\udfab"', JSON.stringify('___\uDFAB')); +assertEquals('"___\\udfac"', JSON.stringify('___\uDFAC')); +assertEquals('"___\\udfad"', JSON.stringify('___\uDFAD')); +assertEquals('"___\\udfae"', JSON.stringify('___\uDFAE')); +assertEquals('"___\\udfaf"', JSON.stringify('___\uDFAF')); +assertEquals('"___\\udfb0"', JSON.stringify('___\uDFB0')); +assertEquals('"___\\udfb1"', JSON.stringify('___\uDFB1')); +assertEquals('"___\\udfb2"', JSON.stringify('___\uDFB2')); +assertEquals('"___\\udfb3"', JSON.stringify('___\uDFB3')); +assertEquals('"___\\udfb4"', JSON.stringify('___\uDFB4')); +assertEquals('"___\\udfb5"', JSON.stringify('___\uDFB5')); +assertEquals('"___\\udfb6"', JSON.stringify('___\uDFB6')); +assertEquals('"___\\udfb7"', JSON.stringify('___\uDFB7')); +assertEquals('"___\\udfb8"', JSON.stringify('___\uDFB8')); +assertEquals('"___\\udfb9"', JSON.stringify('___\uDFB9')); +assertEquals('"___\\udfba"', JSON.stringify('___\uDFBA')); +assertEquals('"___\\udfbb"', JSON.stringify('___\uDFBB')); +assertEquals('"___\\udfbc"', JSON.stringify('___\uDFBC')); +assertEquals('"___\\udfbd"', JSON.stringify('___\uDFBD')); +assertEquals('"___\\udfbe"', JSON.stringify('___\uDFBE')); +assertEquals('"___\\udfbf"', JSON.stringify('___\uDFBF')); +assertEquals('"___\\udfc0"', JSON.stringify('___\uDFC0')); +assertEquals('"___\\udfc1"', JSON.stringify('___\uDFC1')); +assertEquals('"___\\udfc2"', JSON.stringify('___\uDFC2')); +assertEquals('"___\\udfc3"', JSON.stringify('___\uDFC3')); +assertEquals('"___\\udfc4"', JSON.stringify('___\uDFC4')); +assertEquals('"___\\udfc5"', JSON.stringify('___\uDFC5')); +assertEquals('"___\\udfc6"', JSON.stringify('___\uDFC6')); +assertEquals('"___\\udfc7"', JSON.stringify('___\uDFC7')); +assertEquals('"___\\udfc8"', JSON.stringify('___\uDFC8')); +assertEquals('"___\\udfc9"', JSON.stringify('___\uDFC9')); +assertEquals('"___\\udfca"', JSON.stringify('___\uDFCA')); +assertEquals('"___\\udfcb"', JSON.stringify('___\uDFCB')); +assertEquals('"___\\udfcc"', JSON.stringify('___\uDFCC')); +assertEquals('"___\\udfcd"', JSON.stringify('___\uDFCD')); +assertEquals('"___\\udfce"', JSON.stringify('___\uDFCE')); +assertEquals('"___\\udfcf"', JSON.stringify('___\uDFCF')); +assertEquals('"___\\udfd0"', JSON.stringify('___\uDFD0')); +assertEquals('"___\\udfd1"', JSON.stringify('___\uDFD1')); +assertEquals('"___\\udfd2"', JSON.stringify('___\uDFD2')); +assertEquals('"___\\udfd3"', JSON.stringify('___\uDFD3')); +assertEquals('"___\\udfd4"', JSON.stringify('___\uDFD4')); +assertEquals('"___\\udfd5"', JSON.stringify('___\uDFD5')); +assertEquals('"___\\udfd6"', JSON.stringify('___\uDFD6')); +assertEquals('"___\\udfd7"', JSON.stringify('___\uDFD7')); +assertEquals('"___\\udfd8"', JSON.stringify('___\uDFD8')); +assertEquals('"___\\udfd9"', JSON.stringify('___\uDFD9')); +assertEquals('"___\\udfda"', JSON.stringify('___\uDFDA')); +assertEquals('"___\\udfdb"', JSON.stringify('___\uDFDB')); +assertEquals('"___\\udfdc"', JSON.stringify('___\uDFDC')); +assertEquals('"___\\udfdd"', JSON.stringify('___\uDFDD')); +assertEquals('"___\\udfde"', JSON.stringify('___\uDFDE')); +assertEquals('"___\\udfdf"', JSON.stringify('___\uDFDF')); +assertEquals('"___\\udfe0"', JSON.stringify('___\uDFE0')); +assertEquals('"___\\udfe1"', JSON.stringify('___\uDFE1')); +assertEquals('"___\\udfe2"', JSON.stringify('___\uDFE2')); +assertEquals('"___\\udfe3"', JSON.stringify('___\uDFE3')); +assertEquals('"___\\udfe4"', JSON.stringify('___\uDFE4')); +assertEquals('"___\\udfe5"', JSON.stringify('___\uDFE5')); +assertEquals('"___\\udfe6"', JSON.stringify('___\uDFE6')); +assertEquals('"___\\udfe7"', JSON.stringify('___\uDFE7')); +assertEquals('"___\\udfe8"', JSON.stringify('___\uDFE8')); +assertEquals('"___\\udfe9"', JSON.stringify('___\uDFE9')); +assertEquals('"___\\udfea"', JSON.stringify('___\uDFEA')); +assertEquals('"___\\udfeb"', JSON.stringify('___\uDFEB')); +assertEquals('"___\\udfec"', JSON.stringify('___\uDFEC')); +assertEquals('"___\\udfed"', JSON.stringify('___\uDFED')); +assertEquals('"___\\udfee"', JSON.stringify('___\uDFEE')); +assertEquals('"___\\udfef"', JSON.stringify('___\uDFEF')); +assertEquals('"___\\udff0"', JSON.stringify('___\uDFF0')); +assertEquals('"___\\udff1"', JSON.stringify('___\uDFF1')); +assertEquals('"___\\udff2"', JSON.stringify('___\uDFF2')); +assertEquals('"___\\udff3"', JSON.stringify('___\uDFF3')); +assertEquals('"___\\udff4"', JSON.stringify('___\uDFF4')); +assertEquals('"___\\udff5"', JSON.stringify('___\uDFF5')); +assertEquals('"___\\udff6"', JSON.stringify('___\uDFF6')); +assertEquals('"___\\udff7"', JSON.stringify('___\uDFF7')); +assertEquals('"___\\udff8"', JSON.stringify('___\uDFF8')); +assertEquals('"___\\udff9"', JSON.stringify('___\uDFF9')); +assertEquals('"___\\udffa"', JSON.stringify('___\uDFFA')); +assertEquals('"___\\udffb"', JSON.stringify('___\uDFFB')); +assertEquals('"___\\udffc"', JSON.stringify('___\uDFFC')); +assertEquals('"___\\udffd"', JSON.stringify('___\uDFFD')); +assertEquals('"___\\udffe"', JSON.stringify('___\uDFFE')); +assertEquals('"___\\udfff"', JSON.stringify('___\uDFFF')); + +// A random selection of code points from U+E000 to U+FFFF. +assertEquals('"___\uE000"', JSON.stringify('___\uE000')); +assertEquals('"___\uE00B"', JSON.stringify('___\uE00B')); +assertEquals('"___\uE0CC"', JSON.stringify('___\uE0CC')); +assertEquals('"___\uE0FD"', JSON.stringify('___\uE0FD')); +assertEquals('"___\uE19E"', JSON.stringify('___\uE19E')); +assertEquals('"___\uE1B1"', JSON.stringify('___\uE1B1')); +assertEquals('"___\uE24F"', JSON.stringify('___\uE24F')); +assertEquals('"___\uE262"', JSON.stringify('___\uE262')); +assertEquals('"___\uE2C9"', JSON.stringify('___\uE2C9')); +assertEquals('"___\uE2DF"', JSON.stringify('___\uE2DF')); +assertEquals('"___\uE389"', JSON.stringify('___\uE389')); +assertEquals('"___\uE413"', JSON.stringify('___\uE413')); +assertEquals('"___\uE546"', JSON.stringify('___\uE546')); +assertEquals('"___\uE5E4"', JSON.stringify('___\uE5E4')); +assertEquals('"___\uE66B"', JSON.stringify('___\uE66B')); +assertEquals('"___\uE73D"', JSON.stringify('___\uE73D')); +assertEquals('"___\uE74F"', JSON.stringify('___\uE74F')); +assertEquals('"___\uE759"', JSON.stringify('___\uE759')); +assertEquals('"___\uE795"', JSON.stringify('___\uE795')); +assertEquals('"___\uE836"', JSON.stringify('___\uE836')); +assertEquals('"___\uE85D"', JSON.stringify('___\uE85D')); +assertEquals('"___\uE909"', JSON.stringify('___\uE909')); +assertEquals('"___\uE990"', JSON.stringify('___\uE990')); +assertEquals('"___\uE99F"', JSON.stringify('___\uE99F')); +assertEquals('"___\uE9AC"', JSON.stringify('___\uE9AC')); +assertEquals('"___\uE9C2"', JSON.stringify('___\uE9C2')); +assertEquals('"___\uEB11"', JSON.stringify('___\uEB11')); +assertEquals('"___\uED33"', JSON.stringify('___\uED33')); +assertEquals('"___\uED7D"', JSON.stringify('___\uED7D')); +assertEquals('"___\uEDA9"', JSON.stringify('___\uEDA9')); +assertEquals('"___\uEDFB"', JSON.stringify('___\uEDFB')); +assertEquals('"___\uEE09"', JSON.stringify('___\uEE09')); +assertEquals('"___\uEE0D"', JSON.stringify('___\uEE0D')); +assertEquals('"___\uEE34"', JSON.stringify('___\uEE34')); +assertEquals('"___\uEE37"', JSON.stringify('___\uEE37')); +assertEquals('"___\uEE38"', JSON.stringify('___\uEE38')); +assertEquals('"___\uEF80"', JSON.stringify('___\uEF80')); +assertEquals('"___\uEFE2"', JSON.stringify('___\uEFE2')); +assertEquals('"___\uF02C"', JSON.stringify('___\uF02C')); +assertEquals('"___\uF09A"', JSON.stringify('___\uF09A')); +assertEquals('"___\uF0C1"', JSON.stringify('___\uF0C1')); +assertEquals('"___\uF12C"', JSON.stringify('___\uF12C')); +assertEquals('"___\uF250"', JSON.stringify('___\uF250')); +assertEquals('"___\uF2A3"', JSON.stringify('___\uF2A3')); +assertEquals('"___\uF340"', JSON.stringify('___\uF340')); +assertEquals('"___\uF3C9"', JSON.stringify('___\uF3C9')); +assertEquals('"___\uF3F5"', JSON.stringify('___\uF3F5')); +assertEquals('"___\uF41B"', JSON.stringify('___\uF41B')); +assertEquals('"___\uF420"', JSON.stringify('___\uF420')); +assertEquals('"___\uF440"', JSON.stringify('___\uF440')); +assertEquals('"___\uF4AE"', JSON.stringify('___\uF4AE')); +assertEquals('"___\uF4B0"', JSON.stringify('___\uF4B0')); +assertEquals('"___\uF50D"', JSON.stringify('___\uF50D')); +assertEquals('"___\uF55D"', JSON.stringify('___\uF55D')); +assertEquals('"___\uF55E"', JSON.stringify('___\uF55E')); +assertEquals('"___\uF5CD"', JSON.stringify('___\uF5CD')); +assertEquals('"___\uF657"', JSON.stringify('___\uF657')); +assertEquals('"___\uF66D"', JSON.stringify('___\uF66D')); +assertEquals('"___\uF68F"', JSON.stringify('___\uF68F')); +assertEquals('"___\uF6A6"', JSON.stringify('___\uF6A6')); +assertEquals('"___\uF6AA"', JSON.stringify('___\uF6AA')); +assertEquals('"___\uF6EB"', JSON.stringify('___\uF6EB')); +assertEquals('"___\uF79A"', JSON.stringify('___\uF79A')); +assertEquals('"___\uF7E7"', JSON.stringify('___\uF7E7')); +assertEquals('"___\uF7E8"', JSON.stringify('___\uF7E8')); +assertEquals('"___\uF834"', JSON.stringify('___\uF834')); +assertEquals('"___\uF88B"', JSON.stringify('___\uF88B')); +assertEquals('"___\uF8D5"', JSON.stringify('___\uF8D5')); +assertEquals('"___\uF8F1"', JSON.stringify('___\uF8F1')); +assertEquals('"___\uF905"', JSON.stringify('___\uF905')); +assertEquals('"___\uF927"', JSON.stringify('___\uF927')); +assertEquals('"___\uF943"', JSON.stringify('___\uF943')); +assertEquals('"___\uF949"', JSON.stringify('___\uF949')); +assertEquals('"___\uF9A1"', JSON.stringify('___\uF9A1')); +assertEquals('"___\uF9C7"', JSON.stringify('___\uF9C7')); +assertEquals('"___\uFA0F"', JSON.stringify('___\uFA0F')); +assertEquals('"___\uFA20"', JSON.stringify('___\uFA20')); +assertEquals('"___\uFAA7"', JSON.stringify('___\uFAA7')); +assertEquals('"___\uFBCD"', JSON.stringify('___\uFBCD')); +assertEquals('"___\uFBF7"', JSON.stringify('___\uFBF7')); +assertEquals('"___\uFC40"', JSON.stringify('___\uFC40')); +assertEquals('"___\uFC4B"', JSON.stringify('___\uFC4B')); +assertEquals('"___\uFC51"', JSON.stringify('___\uFC51')); +assertEquals('"___\uFC5E"', JSON.stringify('___\uFC5E')); +assertEquals('"___\uFC67"', JSON.stringify('___\uFC67')); +assertEquals('"___\uFC8B"', JSON.stringify('___\uFC8B')); +assertEquals('"___\uFE32"', JSON.stringify('___\uFE32')); +assertEquals('"___\uFFC4"', JSON.stringify('___\uFFC4')); +assertEquals('"___\uFFFD"', JSON.stringify('___\uFFFD')); +assertEquals('"___\uFFFE"', JSON.stringify('___\uFFFE')); +assertEquals('"___\uFFFF"', JSON.stringify('___\uFFFF')); + +// A random selection of astral symbols, i.e. surrogate pairs, i.e. +// code points from U+010000 to U+10FFFF. +assertEquals('"___\u{10000}"', JSON.stringify('___\u{10000}')); +assertEquals('"___\u{11DE7}"', JSON.stringify('___\u{11DE7}')); +assertEquals('"___\u{15997}"', JSON.stringify('___\u{15997}')); +assertEquals('"___\u{187B0}"', JSON.stringify('___\u{187B0}')); +assertEquals('"___\u{190B2}"', JSON.stringify('___\u{190B2}')); +assertEquals('"___\u{1BF79}"', JSON.stringify('___\u{1BF79}')); +assertEquals('"___\u{1C624}"', JSON.stringify('___\u{1C624}')); +assertEquals('"___\u{1D9F4}"', JSON.stringify('___\u{1D9F4}')); +assertEquals('"___\u{24149}"', JSON.stringify('___\u{24149}')); +assertEquals('"___\u{2521C}"', JSON.stringify('___\u{2521C}')); +assertEquals('"___\u{2762D}"', JSON.stringify('___\u{2762D}')); +assertEquals('"___\u{2930B}"', JSON.stringify('___\u{2930B}')); +assertEquals('"___\u{29EC4}"', JSON.stringify('___\u{29EC4}')); +assertEquals('"___\u{29F9A}"', JSON.stringify('___\u{29F9A}')); +assertEquals('"___\u{2A27D}"', JSON.stringify('___\u{2A27D}')); +assertEquals('"___\u{2B363}"', JSON.stringify('___\u{2B363}')); +assertEquals('"___\u{2C037}"', JSON.stringify('___\u{2C037}')); +assertEquals('"___\u{2FAE0}"', JSON.stringify('___\u{2FAE0}')); +assertEquals('"___\u{2FFCF}"', JSON.stringify('___\u{2FFCF}')); +assertEquals('"___\u{32C1C}"', JSON.stringify('___\u{32C1C}')); +assertEquals('"___\u{33DA8}"', JSON.stringify('___\u{33DA8}')); +assertEquals('"___\u{3DCA4}"', JSON.stringify('___\u{3DCA4}')); +assertEquals('"___\u{44FA0}"', JSON.stringify('___\u{44FA0}')); +assertEquals('"___\u{45618}"', JSON.stringify('___\u{45618}')); +assertEquals('"___\u{47395}"', JSON.stringify('___\u{47395}')); +assertEquals('"___\u{4752C}"', JSON.stringify('___\u{4752C}')); +assertEquals('"___\u{483FE}"', JSON.stringify('___\u{483FE}')); +assertEquals('"___\u{49D35}"', JSON.stringify('___\u{49D35}')); +assertEquals('"___\u{4CE3B}"', JSON.stringify('___\u{4CE3B}')); +assertEquals('"___\u{55196}"', JSON.stringify('___\u{55196}')); +assertEquals('"___\u{58B3E}"', JSON.stringify('___\u{58B3E}')); +assertEquals('"___\u{5AA47}"', JSON.stringify('___\u{5AA47}')); +assertEquals('"___\u{5C4B8}"', JSON.stringify('___\u{5C4B8}')); +assertEquals('"___\u{5DD1B}"', JSON.stringify('___\u{5DD1B}')); +assertEquals('"___\u{5FDCB}"', JSON.stringify('___\u{5FDCB}')); +assertEquals('"___\u{611BA}"', JSON.stringify('___\u{611BA}')); +assertEquals('"___\u{66433}"', JSON.stringify('___\u{66433}')); +assertEquals('"___\u{690D7}"', JSON.stringify('___\u{690D7}')); +assertEquals('"___\u{6F617}"', JSON.stringify('___\u{6F617}')); +assertEquals('"___\u{711E4}"', JSON.stringify('___\u{711E4}')); +assertEquals('"___\u{758D2}"', JSON.stringify('___\u{758D2}')); +assertEquals('"___\u{780AC}"', JSON.stringify('___\u{780AC}')); +assertEquals('"___\u{7AE5F}"', JSON.stringify('___\u{7AE5F}')); +assertEquals('"___\u{7C2FB}"', JSON.stringify('___\u{7C2FB}')); +assertEquals('"___\u{7D25F}"', JSON.stringify('___\u{7D25F}')); +assertEquals('"___\u{8027A}"', JSON.stringify('___\u{8027A}')); +assertEquals('"___\u{84817}"', JSON.stringify('___\u{84817}')); +assertEquals('"___\u{8B070}"', JSON.stringify('___\u{8B070}')); +assertEquals('"___\u{8B390}"', JSON.stringify('___\u{8B390}')); +assertEquals('"___\u{8BC03}"', JSON.stringify('___\u{8BC03}')); +assertEquals('"___\u{8BE63}"', JSON.stringify('___\u{8BE63}')); +assertEquals('"___\u{8F12A}"', JSON.stringify('___\u{8F12A}')); +assertEquals('"___\u{9345D}"', JSON.stringify('___\u{9345D}')); +assertEquals('"___\u{937A9}"', JSON.stringify('___\u{937A9}')); +assertEquals('"___\u{94596}"', JSON.stringify('___\u{94596}')); +assertEquals('"___\u{967BB}"', JSON.stringify('___\u{967BB}')); +assertEquals('"___\u{A19D1}"', JSON.stringify('___\u{A19D1}')); +assertEquals('"___\u{A4FC5}"', JSON.stringify('___\u{A4FC5}')); +assertEquals('"___\u{AC9CF}"', JSON.stringify('___\u{AC9CF}')); +assertEquals('"___\u{B1366}"', JSON.stringify('___\u{B1366}')); +assertEquals('"___\u{B3D32}"', JSON.stringify('___\u{B3D32}')); +assertEquals('"___\u{B74BA}"', JSON.stringify('___\u{B74BA}')); +assertEquals('"___\u{B8FB0}"', JSON.stringify('___\u{B8FB0}')); +assertEquals('"___\u{BA0A5}"', JSON.stringify('___\u{BA0A5}')); +assertEquals('"___\u{BB48E}"', JSON.stringify('___\u{BB48E}')); +assertEquals('"___\u{C0B60}"', JSON.stringify('___\u{C0B60}')); +assertEquals('"___\u{C2D34}"', JSON.stringify('___\u{C2D34}')); +assertEquals('"___\u{C6C75}"', JSON.stringify('___\u{C6C75}')); +assertEquals('"___\u{C9F26}"', JSON.stringify('___\u{C9F26}')); +assertEquals('"___\u{CDBD0}"', JSON.stringify('___\u{CDBD0}')); +assertEquals('"___\u{D1E28}"', JSON.stringify('___\u{D1E28}')); +assertEquals('"___\u{D4A80}"', JSON.stringify('___\u{D4A80}')); +assertEquals('"___\u{D947F}"', JSON.stringify('___\u{D947F}')); +assertEquals('"___\u{D9B8A}"', JSON.stringify('___\u{D9B8A}')); +assertEquals('"___\u{DA203}"', JSON.stringify('___\u{DA203}')); +assertEquals('"___\u{DEFD3}"', JSON.stringify('___\u{DEFD3}')); +assertEquals('"___\u{E4F7C}"', JSON.stringify('___\u{E4F7C}')); +assertEquals('"___\u{E6BB3}"', JSON.stringify('___\u{E6BB3}')); +assertEquals('"___\u{E972D}"', JSON.stringify('___\u{E972D}')); +assertEquals('"___\u{EB335}"', JSON.stringify('___\u{EB335}')); +assertEquals('"___\u{ED3F8}"', JSON.stringify('___\u{ED3F8}')); +assertEquals('"___\u{ED940}"', JSON.stringify('___\u{ED940}')); +assertEquals('"___\u{EF6F8}"', JSON.stringify('___\u{EF6F8}')); +assertEquals('"___\u{F1F57}"', JSON.stringify('___\u{F1F57}')); +assertEquals('"___\u{F33B5}"', JSON.stringify('___\u{F33B5}')); +assertEquals('"___\u{F4D2A}"', JSON.stringify('___\u{F4D2A}')); +assertEquals('"___\u{F70BA}"', JSON.stringify('___\u{F70BA}')); +assertEquals('"___\u{F899F}"', JSON.stringify('___\u{F899F}')); +assertEquals('"___\u{1034BF}"', JSON.stringify('___\u{1034BF}')); +assertEquals('"___\u{107ACF}"', JSON.stringify('___\u{107ACF}')); +assertEquals('"___\u{10881F}"', JSON.stringify('___\u{10881F}')); +assertEquals('"___\u{1098A5}"', JSON.stringify('___\u{1098A5}')); +assertEquals('"___\u{10ABD1}"', JSON.stringify('___\u{10ABD1}')); +assertEquals('"___\u{10B5C5}"', JSON.stringify('___\u{10B5C5}')); +assertEquals('"___\u{10CC79}"', JSON.stringify('___\u{10CC79}')); +assertEquals('"___\u{10CD19}"', JSON.stringify('___\u{10CD19}')); +assertEquals('"___\u{10FFFF}"', JSON.stringify('___\u{10FFFF}')); diff --git a/deps/v8/test/mjsunit/harmony/well-formed-json-stringify-unchecked.js b/deps/v8/test/mjsunit/harmony/well-formed-json-stringify-unchecked.js new file mode 100644 index 0000000000..260d748ece --- /dev/null +++ b/deps/v8/test/mjsunit/harmony/well-formed-json-stringify-unchecked.js @@ -0,0 +1,2575 @@ +// Copyright 2018 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-json-stringify + +// Test JSON.stringify for cases that hit +// JsonStringifier::SerializeStringUnchecked_. + +// All code points from U+0000 to U+00FF. +assertEquals('"\\u0000"', JSON.stringify('\0')); +assertEquals('"\\u0001"', JSON.stringify('\x01')); +assertEquals('"\\u0002"', JSON.stringify('\x02')); +assertEquals('"\\u0003"', JSON.stringify('\x03')); +assertEquals('"\\u0004"', JSON.stringify('\x04')); +assertEquals('"\\u0005"', JSON.stringify('\x05')); +assertEquals('"\\u0006"', JSON.stringify('\x06')); +assertEquals('"\\u0007"', JSON.stringify('\x07')); +assertEquals('"\\b"', JSON.stringify('\b')); +assertEquals('"\\t"', JSON.stringify('\t')); +assertEquals('"\\n"', JSON.stringify('\n')); +assertEquals('"\\u000b"', JSON.stringify('\x0B')); +assertEquals('"\\f"', JSON.stringify('\f')); +assertEquals('"\\r"', JSON.stringify('\r')); +assertEquals('"\\u000e"', JSON.stringify('\x0E')); +assertEquals('"\\u000f"', JSON.stringify('\x0F')); +assertEquals('"\\u0010"', JSON.stringify('\x10')); +assertEquals('"\\u0011"', JSON.stringify('\x11')); +assertEquals('"\\u0012"', JSON.stringify('\x12')); +assertEquals('"\\u0013"', JSON.stringify('\x13')); +assertEquals('"\\u0014"', JSON.stringify('\x14')); +assertEquals('"\\u0015"', JSON.stringify('\x15')); +assertEquals('"\\u0016"', JSON.stringify('\x16')); +assertEquals('"\\u0017"', JSON.stringify('\x17')); +assertEquals('"\\u0018"', JSON.stringify('\x18')); +assertEquals('"\\u0019"', JSON.stringify('\x19')); +assertEquals('"\\u001a"', JSON.stringify('\x1A')); +assertEquals('"\\u001b"', JSON.stringify('\x1B')); +assertEquals('"\\u001c"', JSON.stringify('\x1C')); +assertEquals('"\\u001d"', JSON.stringify('\x1D')); +assertEquals('"\\u001e"', JSON.stringify('\x1E')); +assertEquals('"\\u001f"', JSON.stringify('\x1F')); +assertEquals('" "', JSON.stringify(' ')); +assertEquals('"!"', JSON.stringify('!')); +assertEquals('"\\""', JSON.stringify('"')); +assertEquals('"#"', JSON.stringify('#')); +assertEquals('"$"', JSON.stringify('$')); +assertEquals('"%"', JSON.stringify('%')); +assertEquals('"&"', JSON.stringify('&')); +assertEquals('"\'"', JSON.stringify('\'')); +assertEquals('"("', JSON.stringify('(')); +assertEquals('")"', JSON.stringify(')')); +assertEquals('"*"', JSON.stringify('*')); +assertEquals('"+"', JSON.stringify('+')); +assertEquals('","', JSON.stringify(',')); +assertEquals('"-"', JSON.stringify('-')); +assertEquals('"."', JSON.stringify('.')); +assertEquals('"/"', JSON.stringify('/')); +assertEquals('"0"', JSON.stringify('0')); +assertEquals('"1"', JSON.stringify('1')); +assertEquals('"2"', JSON.stringify('2')); +assertEquals('"3"', JSON.stringify('3')); +assertEquals('"4"', JSON.stringify('4')); +assertEquals('"5"', JSON.stringify('5')); +assertEquals('"6"', JSON.stringify('6')); +assertEquals('"7"', JSON.stringify('7')); +assertEquals('"8"', JSON.stringify('8')); +assertEquals('"9"', JSON.stringify('9')); +assertEquals('":"', JSON.stringify(':')); +assertEquals('";"', JSON.stringify(';')); +assertEquals('"<"', JSON.stringify('<')); +assertEquals('"="', JSON.stringify('=')); +assertEquals('">"', JSON.stringify('>')); +assertEquals('"?"', JSON.stringify('?')); +assertEquals('"@"', JSON.stringify('@')); +assertEquals('"A"', JSON.stringify('A')); +assertEquals('"B"', JSON.stringify('B')); +assertEquals('"C"', JSON.stringify('C')); +assertEquals('"D"', JSON.stringify('D')); +assertEquals('"E"', JSON.stringify('E')); +assertEquals('"F"', JSON.stringify('F')); +assertEquals('"G"', JSON.stringify('G')); +assertEquals('"H"', JSON.stringify('H')); +assertEquals('"I"', JSON.stringify('I')); +assertEquals('"J"', JSON.stringify('J')); +assertEquals('"K"', JSON.stringify('K')); +assertEquals('"L"', JSON.stringify('L')); +assertEquals('"M"', JSON.stringify('M')); +assertEquals('"N"', JSON.stringify('N')); +assertEquals('"O"', JSON.stringify('O')); +assertEquals('"P"', JSON.stringify('P')); +assertEquals('"Q"', JSON.stringify('Q')); +assertEquals('"R"', JSON.stringify('R')); +assertEquals('"S"', JSON.stringify('S')); +assertEquals('"T"', JSON.stringify('T')); +assertEquals('"U"', JSON.stringify('U')); +assertEquals('"V"', JSON.stringify('V')); +assertEquals('"W"', JSON.stringify('W')); +assertEquals('"X"', JSON.stringify('X')); +assertEquals('"Y"', JSON.stringify('Y')); +assertEquals('"Z"', JSON.stringify('Z')); +assertEquals('"["', JSON.stringify('[')); +assertEquals('"\\\\"', JSON.stringify('\\')); +assertEquals('"]"', JSON.stringify(']')); +assertEquals('"^"', JSON.stringify('^')); +assertEquals('"_"', JSON.stringify('_')); +assertEquals('"`"', JSON.stringify('`')); +assertEquals('"a"', JSON.stringify('a')); +assertEquals('"b"', JSON.stringify('b')); +assertEquals('"c"', JSON.stringify('c')); +assertEquals('"d"', JSON.stringify('d')); +assertEquals('"e"', JSON.stringify('e')); +assertEquals('"f"', JSON.stringify('f')); +assertEquals('"g"', JSON.stringify('g')); +assertEquals('"h"', JSON.stringify('h')); +assertEquals('"i"', JSON.stringify('i')); +assertEquals('"j"', JSON.stringify('j')); +assertEquals('"k"', JSON.stringify('k')); +assertEquals('"l"', JSON.stringify('l')); +assertEquals('"m"', JSON.stringify('m')); +assertEquals('"n"', JSON.stringify('n')); +assertEquals('"o"', JSON.stringify('o')); +assertEquals('"p"', JSON.stringify('p')); +assertEquals('"q"', JSON.stringify('q')); +assertEquals('"r"', JSON.stringify('r')); +assertEquals('"s"', JSON.stringify('s')); +assertEquals('"t"', JSON.stringify('t')); +assertEquals('"u"', JSON.stringify('u')); +assertEquals('"v"', JSON.stringify('v')); +assertEquals('"w"', JSON.stringify('w')); +assertEquals('"x"', JSON.stringify('x')); +assertEquals('"y"', JSON.stringify('y')); +assertEquals('"z"', JSON.stringify('z')); +assertEquals('"{"', JSON.stringify('{')); +assertEquals('"|"', JSON.stringify('|')); +assertEquals('"}"', JSON.stringify('}')); +assertEquals('"~"', JSON.stringify('~')); +assertEquals('"\x7F"', JSON.stringify('\x7F')); +assertEquals('"\x80"', JSON.stringify('\x80')); +assertEquals('"\x81"', JSON.stringify('\x81')); +assertEquals('"\x82"', JSON.stringify('\x82')); +assertEquals('"\x83"', JSON.stringify('\x83')); +assertEquals('"\x84"', JSON.stringify('\x84')); +assertEquals('"\x85"', JSON.stringify('\x85')); +assertEquals('"\x86"', JSON.stringify('\x86')); +assertEquals('"\x87"', JSON.stringify('\x87')); +assertEquals('"\x88"', JSON.stringify('\x88')); +assertEquals('"\x89"', JSON.stringify('\x89')); +assertEquals('"\x8A"', JSON.stringify('\x8A')); +assertEquals('"\x8B"', JSON.stringify('\x8B')); +assertEquals('"\x8C"', JSON.stringify('\x8C')); +assertEquals('"\x8D"', JSON.stringify('\x8D')); +assertEquals('"\x8E"', JSON.stringify('\x8E')); +assertEquals('"\x8F"', JSON.stringify('\x8F')); +assertEquals('"\x90"', JSON.stringify('\x90')); +assertEquals('"\x91"', JSON.stringify('\x91')); +assertEquals('"\x92"', JSON.stringify('\x92')); +assertEquals('"\x93"', JSON.stringify('\x93')); +assertEquals('"\x94"', JSON.stringify('\x94')); +assertEquals('"\x95"', JSON.stringify('\x95')); +assertEquals('"\x96"', JSON.stringify('\x96')); +assertEquals('"\x97"', JSON.stringify('\x97')); +assertEquals('"\x98"', JSON.stringify('\x98')); +assertEquals('"\x99"', JSON.stringify('\x99')); +assertEquals('"\x9A"', JSON.stringify('\x9A')); +assertEquals('"\x9B"', JSON.stringify('\x9B')); +assertEquals('"\x9C"', JSON.stringify('\x9C')); +assertEquals('"\x9D"', JSON.stringify('\x9D')); +assertEquals('"\x9E"', JSON.stringify('\x9E')); +assertEquals('"\x9F"', JSON.stringify('\x9F')); +assertEquals('"\xA0"', JSON.stringify('\xA0')); +assertEquals('"\xA1"', JSON.stringify('\xA1')); +assertEquals('"\xA2"', JSON.stringify('\xA2')); +assertEquals('"\xA3"', JSON.stringify('\xA3')); +assertEquals('"\xA4"', JSON.stringify('\xA4')); +assertEquals('"\xA5"', JSON.stringify('\xA5')); +assertEquals('"\xA6"', JSON.stringify('\xA6')); +assertEquals('"\xA7"', JSON.stringify('\xA7')); +assertEquals('"\xA8"', JSON.stringify('\xA8')); +assertEquals('"\xA9"', JSON.stringify('\xA9')); +assertEquals('"\xAA"', JSON.stringify('\xAA')); +assertEquals('"\xAB"', JSON.stringify('\xAB')); +assertEquals('"\xAC"', JSON.stringify('\xAC')); +assertEquals('"\xAD"', JSON.stringify('\xAD')); +assertEquals('"\xAE"', JSON.stringify('\xAE')); +assertEquals('"\xAF"', JSON.stringify('\xAF')); +assertEquals('"\xB0"', JSON.stringify('\xB0')); +assertEquals('"\xB1"', JSON.stringify('\xB1')); +assertEquals('"\xB2"', JSON.stringify('\xB2')); +assertEquals('"\xB3"', JSON.stringify('\xB3')); +assertEquals('"\xB4"', JSON.stringify('\xB4')); +assertEquals('"\xB5"', JSON.stringify('\xB5')); +assertEquals('"\xB6"', JSON.stringify('\xB6')); +assertEquals('"\xB7"', JSON.stringify('\xB7')); +assertEquals('"\xB8"', JSON.stringify('\xB8')); +assertEquals('"\xB9"', JSON.stringify('\xB9')); +assertEquals('"\xBA"', JSON.stringify('\xBA')); +assertEquals('"\xBB"', JSON.stringify('\xBB')); +assertEquals('"\xBC"', JSON.stringify('\xBC')); +assertEquals('"\xBD"', JSON.stringify('\xBD')); +assertEquals('"\xBE"', JSON.stringify('\xBE')); +assertEquals('"\xBF"', JSON.stringify('\xBF')); +assertEquals('"\xC0"', JSON.stringify('\xC0')); +assertEquals('"\xC1"', JSON.stringify('\xC1')); +assertEquals('"\xC2"', JSON.stringify('\xC2')); +assertEquals('"\xC3"', JSON.stringify('\xC3')); +assertEquals('"\xC4"', JSON.stringify('\xC4')); +assertEquals('"\xC5"', JSON.stringify('\xC5')); +assertEquals('"\xC6"', JSON.stringify('\xC6')); +assertEquals('"\xC7"', JSON.stringify('\xC7')); +assertEquals('"\xC8"', JSON.stringify('\xC8')); +assertEquals('"\xC9"', JSON.stringify('\xC9')); +assertEquals('"\xCA"', JSON.stringify('\xCA')); +assertEquals('"\xCB"', JSON.stringify('\xCB')); +assertEquals('"\xCC"', JSON.stringify('\xCC')); +assertEquals('"\xCD"', JSON.stringify('\xCD')); +assertEquals('"\xCE"', JSON.stringify('\xCE')); +assertEquals('"\xCF"', JSON.stringify('\xCF')); +assertEquals('"\xD0"', JSON.stringify('\xD0')); +assertEquals('"\xD1"', JSON.stringify('\xD1')); +assertEquals('"\xD2"', JSON.stringify('\xD2')); +assertEquals('"\xD3"', JSON.stringify('\xD3')); +assertEquals('"\xD4"', JSON.stringify('\xD4')); +assertEquals('"\xD5"', JSON.stringify('\xD5')); +assertEquals('"\xD6"', JSON.stringify('\xD6')); +assertEquals('"\xD7"', JSON.stringify('\xD7')); +assertEquals('"\xD8"', JSON.stringify('\xD8')); +assertEquals('"\xD9"', JSON.stringify('\xD9')); +assertEquals('"\xDA"', JSON.stringify('\xDA')); +assertEquals('"\xDB"', JSON.stringify('\xDB')); +assertEquals('"\xDC"', JSON.stringify('\xDC')); +assertEquals('"\xDD"', JSON.stringify('\xDD')); +assertEquals('"\xDE"', JSON.stringify('\xDE')); +assertEquals('"\xDF"', JSON.stringify('\xDF')); +assertEquals('"\xE0"', JSON.stringify('\xE0')); +assertEquals('"\xE1"', JSON.stringify('\xE1')); +assertEquals('"\xE2"', JSON.stringify('\xE2')); +assertEquals('"\xE3"', JSON.stringify('\xE3')); +assertEquals('"\xE4"', JSON.stringify('\xE4')); +assertEquals('"\xE5"', JSON.stringify('\xE5')); +assertEquals('"\xE6"', JSON.stringify('\xE6')); +assertEquals('"\xE7"', JSON.stringify('\xE7')); +assertEquals('"\xE8"', JSON.stringify('\xE8')); +assertEquals('"\xE9"', JSON.stringify('\xE9')); +assertEquals('"\xEA"', JSON.stringify('\xEA')); +assertEquals('"\xEB"', JSON.stringify('\xEB')); +assertEquals('"\xEC"', JSON.stringify('\xEC')); +assertEquals('"\xED"', JSON.stringify('\xED')); +assertEquals('"\xEE"', JSON.stringify('\xEE')); +assertEquals('"\xEF"', JSON.stringify('\xEF')); +assertEquals('"\xF0"', JSON.stringify('\xF0')); +assertEquals('"\xF1"', JSON.stringify('\xF1')); +assertEquals('"\xF2"', JSON.stringify('\xF2')); +assertEquals('"\xF3"', JSON.stringify('\xF3')); +assertEquals('"\xF4"', JSON.stringify('\xF4')); +assertEquals('"\xF5"', JSON.stringify('\xF5')); +assertEquals('"\xF6"', JSON.stringify('\xF6')); +assertEquals('"\xF7"', JSON.stringify('\xF7')); +assertEquals('"\xF8"', JSON.stringify('\xF8')); +assertEquals('"\xF9"', JSON.stringify('\xF9')); +assertEquals('"\xFA"', JSON.stringify('\xFA')); +assertEquals('"\xFB"', JSON.stringify('\xFB')); +assertEquals('"\xFC"', JSON.stringify('\xFC')); +assertEquals('"\xFD"', JSON.stringify('\xFD')); +assertEquals('"\xFE"', JSON.stringify('\xFE')); +assertEquals('"\xFF"', JSON.stringify('\xFF')); + +// A random selection of code points from U+0100 to U+D7FF. +assertEquals('"\u0100"', JSON.stringify('\u0100')); +assertEquals('"\u0120"', JSON.stringify('\u0120')); +assertEquals('"\u07D3"', JSON.stringify('\u07D3')); +assertEquals('"\u0B8B"', JSON.stringify('\u0B8B')); +assertEquals('"\u0C4C"', JSON.stringify('\u0C4C')); +assertEquals('"\u178D"', JSON.stringify('\u178D')); +assertEquals('"\u18B8"', JSON.stringify('\u18B8')); +assertEquals('"\u193E"', JSON.stringify('\u193E')); +assertEquals('"\u198A"', JSON.stringify('\u198A')); +assertEquals('"\u1AF5"', JSON.stringify('\u1AF5')); +assertEquals('"\u1D38"', JSON.stringify('\u1D38')); +assertEquals('"\u1E37"', JSON.stringify('\u1E37')); +assertEquals('"\u1FC2"', JSON.stringify('\u1FC2')); +assertEquals('"\u22C7"', JSON.stringify('\u22C7')); +assertEquals('"\u2619"', JSON.stringify('\u2619')); +assertEquals('"\u272A"', JSON.stringify('\u272A')); +assertEquals('"\u2B7F"', JSON.stringify('\u2B7F')); +assertEquals('"\u2DFF"', JSON.stringify('\u2DFF')); +assertEquals('"\u341B"', JSON.stringify('\u341B')); +assertEquals('"\u3A3C"', JSON.stringify('\u3A3C')); +assertEquals('"\u3E53"', JSON.stringify('\u3E53')); +assertEquals('"\u3EC2"', JSON.stringify('\u3EC2')); +assertEquals('"\u3F76"', JSON.stringify('\u3F76')); +assertEquals('"\u3F85"', JSON.stringify('\u3F85')); +assertEquals('"\u43C7"', JSON.stringify('\u43C7')); +assertEquals('"\u4A19"', JSON.stringify('\u4A19')); +assertEquals('"\u4A1C"', JSON.stringify('\u4A1C')); +assertEquals('"\u4F80"', JSON.stringify('\u4F80')); +assertEquals('"\u5A30"', JSON.stringify('\u5A30')); +assertEquals('"\u5B55"', JSON.stringify('\u5B55')); +assertEquals('"\u5C74"', JSON.stringify('\u5C74')); +assertEquals('"\u6006"', JSON.stringify('\u6006')); +assertEquals('"\u63CC"', JSON.stringify('\u63CC')); +assertEquals('"\u6608"', JSON.stringify('\u6608')); +assertEquals('"\u6ABF"', JSON.stringify('\u6ABF')); +assertEquals('"\u6AE9"', JSON.stringify('\u6AE9')); +assertEquals('"\u6C91"', JSON.stringify('\u6C91')); +assertEquals('"\u714B"', JSON.stringify('\u714B')); +assertEquals('"\u728A"', JSON.stringify('\u728A')); +assertEquals('"\u7485"', JSON.stringify('\u7485')); +assertEquals('"\u77C8"', JSON.stringify('\u77C8')); +assertEquals('"\u7BE9"', JSON.stringify('\u7BE9')); +assertEquals('"\u7CEF"', JSON.stringify('\u7CEF')); +assertEquals('"\u7DD5"', JSON.stringify('\u7DD5')); +assertEquals('"\u8DF1"', JSON.stringify('\u8DF1')); +assertEquals('"\u94A9"', JSON.stringify('\u94A9')); +assertEquals('"\u94F2"', JSON.stringify('\u94F2')); +assertEquals('"\u9A7A"', JSON.stringify('\u9A7A')); +assertEquals('"\u9AA6"', JSON.stringify('\u9AA6')); +assertEquals('"\uA2B0"', JSON.stringify('\uA2B0')); +assertEquals('"\uB711"', JSON.stringify('\uB711')); +assertEquals('"\uBC01"', JSON.stringify('\uBC01')); +assertEquals('"\uBCB6"', JSON.stringify('\uBCB6')); +assertEquals('"\uBD70"', JSON.stringify('\uBD70')); +assertEquals('"\uC3CD"', JSON.stringify('\uC3CD')); +assertEquals('"\uC451"', JSON.stringify('\uC451')); +assertEquals('"\uC677"', JSON.stringify('\uC677')); +assertEquals('"\uC89B"', JSON.stringify('\uC89B')); +assertEquals('"\uCBEF"', JSON.stringify('\uCBEF')); +assertEquals('"\uCEF8"', JSON.stringify('\uCEF8')); +assertEquals('"\uD089"', JSON.stringify('\uD089')); +assertEquals('"\uD24D"', JSON.stringify('\uD24D')); +assertEquals('"\uD3A7"', JSON.stringify('\uD3A7')); +assertEquals('"\uD7FF"', JSON.stringify('\uD7FF')); + +// All lone surrogates, i.e. code points from U+D800 to U+DFFF. +assertEquals('"\\ud800"', JSON.stringify('\uD800')); +assertEquals('"\\ud801"', JSON.stringify('\uD801')); +assertEquals('"\\ud802"', JSON.stringify('\uD802')); +assertEquals('"\\ud803"', JSON.stringify('\uD803')); +assertEquals('"\\ud804"', JSON.stringify('\uD804')); +assertEquals('"\\ud805"', JSON.stringify('\uD805')); +assertEquals('"\\ud806"', JSON.stringify('\uD806')); +assertEquals('"\\ud807"', JSON.stringify('\uD807')); +assertEquals('"\\ud808"', JSON.stringify('\uD808')); +assertEquals('"\\ud809"', JSON.stringify('\uD809')); +assertEquals('"\\ud80a"', JSON.stringify('\uD80A')); +assertEquals('"\\ud80b"', JSON.stringify('\uD80B')); +assertEquals('"\\ud80c"', JSON.stringify('\uD80C')); +assertEquals('"\\ud80d"', JSON.stringify('\uD80D')); +assertEquals('"\\ud80e"', JSON.stringify('\uD80E')); +assertEquals('"\\ud80f"', JSON.stringify('\uD80F')); +assertEquals('"\\ud810"', JSON.stringify('\uD810')); +assertEquals('"\\ud811"', JSON.stringify('\uD811')); +assertEquals('"\\ud812"', JSON.stringify('\uD812')); +assertEquals('"\\ud813"', JSON.stringify('\uD813')); +assertEquals('"\\ud814"', JSON.stringify('\uD814')); +assertEquals('"\\ud815"', JSON.stringify('\uD815')); +assertEquals('"\\ud816"', JSON.stringify('\uD816')); +assertEquals('"\\ud817"', JSON.stringify('\uD817')); +assertEquals('"\\ud818"', JSON.stringify('\uD818')); +assertEquals('"\\ud819"', JSON.stringify('\uD819')); +assertEquals('"\\ud81a"', JSON.stringify('\uD81A')); +assertEquals('"\\ud81b"', JSON.stringify('\uD81B')); +assertEquals('"\\ud81c"', JSON.stringify('\uD81C')); +assertEquals('"\\ud81d"', JSON.stringify('\uD81D')); +assertEquals('"\\ud81e"', JSON.stringify('\uD81E')); +assertEquals('"\\ud81f"', JSON.stringify('\uD81F')); +assertEquals('"\\ud820"', JSON.stringify('\uD820')); +assertEquals('"\\ud821"', JSON.stringify('\uD821')); +assertEquals('"\\ud822"', JSON.stringify('\uD822')); +assertEquals('"\\ud823"', JSON.stringify('\uD823')); +assertEquals('"\\ud824"', JSON.stringify('\uD824')); +assertEquals('"\\ud825"', JSON.stringify('\uD825')); +assertEquals('"\\ud826"', JSON.stringify('\uD826')); +assertEquals('"\\ud827"', JSON.stringify('\uD827')); +assertEquals('"\\ud828"', JSON.stringify('\uD828')); +assertEquals('"\\ud829"', JSON.stringify('\uD829')); +assertEquals('"\\ud82a"', JSON.stringify('\uD82A')); +assertEquals('"\\ud82b"', JSON.stringify('\uD82B')); +assertEquals('"\\ud82c"', JSON.stringify('\uD82C')); +assertEquals('"\\ud82d"', JSON.stringify('\uD82D')); +assertEquals('"\\ud82e"', JSON.stringify('\uD82E')); +assertEquals('"\\ud82f"', JSON.stringify('\uD82F')); +assertEquals('"\\ud830"', JSON.stringify('\uD830')); +assertEquals('"\\ud831"', JSON.stringify('\uD831')); +assertEquals('"\\ud832"', JSON.stringify('\uD832')); +assertEquals('"\\ud833"', JSON.stringify('\uD833')); +assertEquals('"\\ud834"', JSON.stringify('\uD834')); +assertEquals('"\\ud835"', JSON.stringify('\uD835')); +assertEquals('"\\ud836"', JSON.stringify('\uD836')); +assertEquals('"\\ud837"', JSON.stringify('\uD837')); +assertEquals('"\\ud838"', JSON.stringify('\uD838')); +assertEquals('"\\ud839"', JSON.stringify('\uD839')); +assertEquals('"\\ud83a"', JSON.stringify('\uD83A')); +assertEquals('"\\ud83b"', JSON.stringify('\uD83B')); +assertEquals('"\\ud83c"', JSON.stringify('\uD83C')); +assertEquals('"\\ud83d"', JSON.stringify('\uD83D')); +assertEquals('"\\ud83e"', JSON.stringify('\uD83E')); +assertEquals('"\\ud83f"', JSON.stringify('\uD83F')); +assertEquals('"\\ud840"', JSON.stringify('\uD840')); +assertEquals('"\\ud841"', JSON.stringify('\uD841')); +assertEquals('"\\ud842"', JSON.stringify('\uD842')); +assertEquals('"\\ud843"', JSON.stringify('\uD843')); +assertEquals('"\\ud844"', JSON.stringify('\uD844')); +assertEquals('"\\ud845"', JSON.stringify('\uD845')); +assertEquals('"\\ud846"', JSON.stringify('\uD846')); +assertEquals('"\\ud847"', JSON.stringify('\uD847')); +assertEquals('"\\ud848"', JSON.stringify('\uD848')); +assertEquals('"\\ud849"', JSON.stringify('\uD849')); +assertEquals('"\\ud84a"', JSON.stringify('\uD84A')); +assertEquals('"\\ud84b"', JSON.stringify('\uD84B')); +assertEquals('"\\ud84c"', JSON.stringify('\uD84C')); +assertEquals('"\\ud84d"', JSON.stringify('\uD84D')); +assertEquals('"\\ud84e"', JSON.stringify('\uD84E')); +assertEquals('"\\ud84f"', JSON.stringify('\uD84F')); +assertEquals('"\\ud850"', JSON.stringify('\uD850')); +assertEquals('"\\ud851"', JSON.stringify('\uD851')); +assertEquals('"\\ud852"', JSON.stringify('\uD852')); +assertEquals('"\\ud853"', JSON.stringify('\uD853')); +assertEquals('"\\ud854"', JSON.stringify('\uD854')); +assertEquals('"\\ud855"', JSON.stringify('\uD855')); +assertEquals('"\\ud856"', JSON.stringify('\uD856')); +assertEquals('"\\ud857"', JSON.stringify('\uD857')); +assertEquals('"\\ud858"', JSON.stringify('\uD858')); +assertEquals('"\\ud859"', JSON.stringify('\uD859')); +assertEquals('"\\ud85a"', JSON.stringify('\uD85A')); +assertEquals('"\\ud85b"', JSON.stringify('\uD85B')); +assertEquals('"\\ud85c"', JSON.stringify('\uD85C')); +assertEquals('"\\ud85d"', JSON.stringify('\uD85D')); +assertEquals('"\\ud85e"', JSON.stringify('\uD85E')); +assertEquals('"\\ud85f"', JSON.stringify('\uD85F')); +assertEquals('"\\ud860"', JSON.stringify('\uD860')); +assertEquals('"\\ud861"', JSON.stringify('\uD861')); +assertEquals('"\\ud862"', JSON.stringify('\uD862')); +assertEquals('"\\ud863"', JSON.stringify('\uD863')); +assertEquals('"\\ud864"', JSON.stringify('\uD864')); +assertEquals('"\\ud865"', JSON.stringify('\uD865')); +assertEquals('"\\ud866"', JSON.stringify('\uD866')); +assertEquals('"\\ud867"', JSON.stringify('\uD867')); +assertEquals('"\\ud868"', JSON.stringify('\uD868')); +assertEquals('"\\ud869"', JSON.stringify('\uD869')); +assertEquals('"\\ud86a"', JSON.stringify('\uD86A')); +assertEquals('"\\ud86b"', JSON.stringify('\uD86B')); +assertEquals('"\\ud86c"', JSON.stringify('\uD86C')); +assertEquals('"\\ud86d"', JSON.stringify('\uD86D')); +assertEquals('"\\ud86e"', JSON.stringify('\uD86E')); +assertEquals('"\\ud86f"', JSON.stringify('\uD86F')); +assertEquals('"\\ud870"', JSON.stringify('\uD870')); +assertEquals('"\\ud871"', JSON.stringify('\uD871')); +assertEquals('"\\ud872"', JSON.stringify('\uD872')); +assertEquals('"\\ud873"', JSON.stringify('\uD873')); +assertEquals('"\\ud874"', JSON.stringify('\uD874')); +assertEquals('"\\ud875"', JSON.stringify('\uD875')); +assertEquals('"\\ud876"', JSON.stringify('\uD876')); +assertEquals('"\\ud877"', JSON.stringify('\uD877')); +assertEquals('"\\ud878"', JSON.stringify('\uD878')); +assertEquals('"\\ud879"', JSON.stringify('\uD879')); +assertEquals('"\\ud87a"', JSON.stringify('\uD87A')); +assertEquals('"\\ud87b"', JSON.stringify('\uD87B')); +assertEquals('"\\ud87c"', JSON.stringify('\uD87C')); +assertEquals('"\\ud87d"', JSON.stringify('\uD87D')); +assertEquals('"\\ud87e"', JSON.stringify('\uD87E')); +assertEquals('"\\ud87f"', JSON.stringify('\uD87F')); +assertEquals('"\\ud880"', JSON.stringify('\uD880')); +assertEquals('"\\ud881"', JSON.stringify('\uD881')); +assertEquals('"\\ud882"', JSON.stringify('\uD882')); +assertEquals('"\\ud883"', JSON.stringify('\uD883')); +assertEquals('"\\ud884"', JSON.stringify('\uD884')); +assertEquals('"\\ud885"', JSON.stringify('\uD885')); +assertEquals('"\\ud886"', JSON.stringify('\uD886')); +assertEquals('"\\ud887"', JSON.stringify('\uD887')); +assertEquals('"\\ud888"', JSON.stringify('\uD888')); +assertEquals('"\\ud889"', JSON.stringify('\uD889')); +assertEquals('"\\ud88a"', JSON.stringify('\uD88A')); +assertEquals('"\\ud88b"', JSON.stringify('\uD88B')); +assertEquals('"\\ud88c"', JSON.stringify('\uD88C')); +assertEquals('"\\ud88d"', JSON.stringify('\uD88D')); +assertEquals('"\\ud88e"', JSON.stringify('\uD88E')); +assertEquals('"\\ud88f"', JSON.stringify('\uD88F')); +assertEquals('"\\ud890"', JSON.stringify('\uD890')); +assertEquals('"\\ud891"', JSON.stringify('\uD891')); +assertEquals('"\\ud892"', JSON.stringify('\uD892')); +assertEquals('"\\ud893"', JSON.stringify('\uD893')); +assertEquals('"\\ud894"', JSON.stringify('\uD894')); +assertEquals('"\\ud895"', JSON.stringify('\uD895')); +assertEquals('"\\ud896"', JSON.stringify('\uD896')); +assertEquals('"\\ud897"', JSON.stringify('\uD897')); +assertEquals('"\\ud898"', JSON.stringify('\uD898')); +assertEquals('"\\ud899"', JSON.stringify('\uD899')); +assertEquals('"\\ud89a"', JSON.stringify('\uD89A')); +assertEquals('"\\ud89b"', JSON.stringify('\uD89B')); +assertEquals('"\\ud89c"', JSON.stringify('\uD89C')); +assertEquals('"\\ud89d"', JSON.stringify('\uD89D')); +assertEquals('"\\ud89e"', JSON.stringify('\uD89E')); +assertEquals('"\\ud89f"', JSON.stringify('\uD89F')); +assertEquals('"\\ud8a0"', JSON.stringify('\uD8A0')); +assertEquals('"\\ud8a1"', JSON.stringify('\uD8A1')); +assertEquals('"\\ud8a2"', JSON.stringify('\uD8A2')); +assertEquals('"\\ud8a3"', JSON.stringify('\uD8A3')); +assertEquals('"\\ud8a4"', JSON.stringify('\uD8A4')); +assertEquals('"\\ud8a5"', JSON.stringify('\uD8A5')); +assertEquals('"\\ud8a6"', JSON.stringify('\uD8A6')); +assertEquals('"\\ud8a7"', JSON.stringify('\uD8A7')); +assertEquals('"\\ud8a8"', JSON.stringify('\uD8A8')); +assertEquals('"\\ud8a9"', JSON.stringify('\uD8A9')); +assertEquals('"\\ud8aa"', JSON.stringify('\uD8AA')); +assertEquals('"\\ud8ab"', JSON.stringify('\uD8AB')); +assertEquals('"\\ud8ac"', JSON.stringify('\uD8AC')); +assertEquals('"\\ud8ad"', JSON.stringify('\uD8AD')); +assertEquals('"\\ud8ae"', JSON.stringify('\uD8AE')); +assertEquals('"\\ud8af"', JSON.stringify('\uD8AF')); +assertEquals('"\\ud8b0"', JSON.stringify('\uD8B0')); +assertEquals('"\\ud8b1"', JSON.stringify('\uD8B1')); +assertEquals('"\\ud8b2"', JSON.stringify('\uD8B2')); +assertEquals('"\\ud8b3"', JSON.stringify('\uD8B3')); +assertEquals('"\\ud8b4"', JSON.stringify('\uD8B4')); +assertEquals('"\\ud8b5"', JSON.stringify('\uD8B5')); +assertEquals('"\\ud8b6"', JSON.stringify('\uD8B6')); +assertEquals('"\\ud8b7"', JSON.stringify('\uD8B7')); +assertEquals('"\\ud8b8"', JSON.stringify('\uD8B8')); +assertEquals('"\\ud8b9"', JSON.stringify('\uD8B9')); +assertEquals('"\\ud8ba"', JSON.stringify('\uD8BA')); +assertEquals('"\\ud8bb"', JSON.stringify('\uD8BB')); +assertEquals('"\\ud8bc"', JSON.stringify('\uD8BC')); +assertEquals('"\\ud8bd"', JSON.stringify('\uD8BD')); +assertEquals('"\\ud8be"', JSON.stringify('\uD8BE')); +assertEquals('"\\ud8bf"', JSON.stringify('\uD8BF')); +assertEquals('"\\ud8c0"', JSON.stringify('\uD8C0')); +assertEquals('"\\ud8c1"', JSON.stringify('\uD8C1')); +assertEquals('"\\ud8c2"', JSON.stringify('\uD8C2')); +assertEquals('"\\ud8c3"', JSON.stringify('\uD8C3')); +assertEquals('"\\ud8c4"', JSON.stringify('\uD8C4')); +assertEquals('"\\ud8c5"', JSON.stringify('\uD8C5')); +assertEquals('"\\ud8c6"', JSON.stringify('\uD8C6')); +assertEquals('"\\ud8c7"', JSON.stringify('\uD8C7')); +assertEquals('"\\ud8c8"', JSON.stringify('\uD8C8')); +assertEquals('"\\ud8c9"', JSON.stringify('\uD8C9')); +assertEquals('"\\ud8ca"', JSON.stringify('\uD8CA')); +assertEquals('"\\ud8cb"', JSON.stringify('\uD8CB')); +assertEquals('"\\ud8cc"', JSON.stringify('\uD8CC')); +assertEquals('"\\ud8cd"', JSON.stringify('\uD8CD')); +assertEquals('"\\ud8ce"', JSON.stringify('\uD8CE')); +assertEquals('"\\ud8cf"', JSON.stringify('\uD8CF')); +assertEquals('"\\ud8d0"', JSON.stringify('\uD8D0')); +assertEquals('"\\ud8d1"', JSON.stringify('\uD8D1')); +assertEquals('"\\ud8d2"', JSON.stringify('\uD8D2')); +assertEquals('"\\ud8d3"', JSON.stringify('\uD8D3')); +assertEquals('"\\ud8d4"', JSON.stringify('\uD8D4')); +assertEquals('"\\ud8d5"', JSON.stringify('\uD8D5')); +assertEquals('"\\ud8d6"', JSON.stringify('\uD8D6')); +assertEquals('"\\ud8d7"', JSON.stringify('\uD8D7')); +assertEquals('"\\ud8d8"', JSON.stringify('\uD8D8')); +assertEquals('"\\ud8d9"', JSON.stringify('\uD8D9')); +assertEquals('"\\ud8da"', JSON.stringify('\uD8DA')); +assertEquals('"\\ud8db"', JSON.stringify('\uD8DB')); +assertEquals('"\\ud8dc"', JSON.stringify('\uD8DC')); +assertEquals('"\\ud8dd"', JSON.stringify('\uD8DD')); +assertEquals('"\\ud8de"', JSON.stringify('\uD8DE')); +assertEquals('"\\ud8df"', JSON.stringify('\uD8DF')); +assertEquals('"\\ud8e0"', JSON.stringify('\uD8E0')); +assertEquals('"\\ud8e1"', JSON.stringify('\uD8E1')); +assertEquals('"\\ud8e2"', JSON.stringify('\uD8E2')); +assertEquals('"\\ud8e3"', JSON.stringify('\uD8E3')); +assertEquals('"\\ud8e4"', JSON.stringify('\uD8E4')); +assertEquals('"\\ud8e5"', JSON.stringify('\uD8E5')); +assertEquals('"\\ud8e6"', JSON.stringify('\uD8E6')); +assertEquals('"\\ud8e7"', JSON.stringify('\uD8E7')); +assertEquals('"\\ud8e8"', JSON.stringify('\uD8E8')); +assertEquals('"\\ud8e9"', JSON.stringify('\uD8E9')); +assertEquals('"\\ud8ea"', JSON.stringify('\uD8EA')); +assertEquals('"\\ud8eb"', JSON.stringify('\uD8EB')); +assertEquals('"\\ud8ec"', JSON.stringify('\uD8EC')); +assertEquals('"\\ud8ed"', JSON.stringify('\uD8ED')); +assertEquals('"\\ud8ee"', JSON.stringify('\uD8EE')); +assertEquals('"\\ud8ef"', JSON.stringify('\uD8EF')); +assertEquals('"\\ud8f0"', JSON.stringify('\uD8F0')); +assertEquals('"\\ud8f1"', JSON.stringify('\uD8F1')); +assertEquals('"\\ud8f2"', JSON.stringify('\uD8F2')); +assertEquals('"\\ud8f3"', JSON.stringify('\uD8F3')); +assertEquals('"\\ud8f4"', JSON.stringify('\uD8F4')); +assertEquals('"\\ud8f5"', JSON.stringify('\uD8F5')); +assertEquals('"\\ud8f6"', JSON.stringify('\uD8F6')); +assertEquals('"\\ud8f7"', JSON.stringify('\uD8F7')); +assertEquals('"\\ud8f8"', JSON.stringify('\uD8F8')); +assertEquals('"\\ud8f9"', JSON.stringify('\uD8F9')); +assertEquals('"\\ud8fa"', JSON.stringify('\uD8FA')); +assertEquals('"\\ud8fb"', JSON.stringify('\uD8FB')); +assertEquals('"\\ud8fc"', JSON.stringify('\uD8FC')); +assertEquals('"\\ud8fd"', JSON.stringify('\uD8FD')); +assertEquals('"\\ud8fe"', JSON.stringify('\uD8FE')); +assertEquals('"\\ud8ff"', JSON.stringify('\uD8FF')); +assertEquals('"\\ud900"', JSON.stringify('\uD900')); +assertEquals('"\\ud901"', JSON.stringify('\uD901')); +assertEquals('"\\ud902"', JSON.stringify('\uD902')); +assertEquals('"\\ud903"', JSON.stringify('\uD903')); +assertEquals('"\\ud904"', JSON.stringify('\uD904')); +assertEquals('"\\ud905"', JSON.stringify('\uD905')); +assertEquals('"\\ud906"', JSON.stringify('\uD906')); +assertEquals('"\\ud907"', JSON.stringify('\uD907')); +assertEquals('"\\ud908"', JSON.stringify('\uD908')); +assertEquals('"\\ud909"', JSON.stringify('\uD909')); +assertEquals('"\\ud90a"', JSON.stringify('\uD90A')); +assertEquals('"\\ud90b"', JSON.stringify('\uD90B')); +assertEquals('"\\ud90c"', JSON.stringify('\uD90C')); +assertEquals('"\\ud90d"', JSON.stringify('\uD90D')); +assertEquals('"\\ud90e"', JSON.stringify('\uD90E')); +assertEquals('"\\ud90f"', JSON.stringify('\uD90F')); +assertEquals('"\\ud910"', JSON.stringify('\uD910')); +assertEquals('"\\ud911"', JSON.stringify('\uD911')); +assertEquals('"\\ud912"', JSON.stringify('\uD912')); +assertEquals('"\\ud913"', JSON.stringify('\uD913')); +assertEquals('"\\ud914"', JSON.stringify('\uD914')); +assertEquals('"\\ud915"', JSON.stringify('\uD915')); +assertEquals('"\\ud916"', JSON.stringify('\uD916')); +assertEquals('"\\ud917"', JSON.stringify('\uD917')); +assertEquals('"\\ud918"', JSON.stringify('\uD918')); +assertEquals('"\\ud919"', JSON.stringify('\uD919')); +assertEquals('"\\ud91a"', JSON.stringify('\uD91A')); +assertEquals('"\\ud91b"', JSON.stringify('\uD91B')); +assertEquals('"\\ud91c"', JSON.stringify('\uD91C')); +assertEquals('"\\ud91d"', JSON.stringify('\uD91D')); +assertEquals('"\\ud91e"', JSON.stringify('\uD91E')); +assertEquals('"\\ud91f"', JSON.stringify('\uD91F')); +assertEquals('"\\ud920"', JSON.stringify('\uD920')); +assertEquals('"\\ud921"', JSON.stringify('\uD921')); +assertEquals('"\\ud922"', JSON.stringify('\uD922')); +assertEquals('"\\ud923"', JSON.stringify('\uD923')); +assertEquals('"\\ud924"', JSON.stringify('\uD924')); +assertEquals('"\\ud925"', JSON.stringify('\uD925')); +assertEquals('"\\ud926"', JSON.stringify('\uD926')); +assertEquals('"\\ud927"', JSON.stringify('\uD927')); +assertEquals('"\\ud928"', JSON.stringify('\uD928')); +assertEquals('"\\ud929"', JSON.stringify('\uD929')); +assertEquals('"\\ud92a"', JSON.stringify('\uD92A')); +assertEquals('"\\ud92b"', JSON.stringify('\uD92B')); +assertEquals('"\\ud92c"', JSON.stringify('\uD92C')); +assertEquals('"\\ud92d"', JSON.stringify('\uD92D')); +assertEquals('"\\ud92e"', JSON.stringify('\uD92E')); +assertEquals('"\\ud92f"', JSON.stringify('\uD92F')); +assertEquals('"\\ud930"', JSON.stringify('\uD930')); +assertEquals('"\\ud931"', JSON.stringify('\uD931')); +assertEquals('"\\ud932"', JSON.stringify('\uD932')); +assertEquals('"\\ud933"', JSON.stringify('\uD933')); +assertEquals('"\\ud934"', JSON.stringify('\uD934')); +assertEquals('"\\ud935"', JSON.stringify('\uD935')); +assertEquals('"\\ud936"', JSON.stringify('\uD936')); +assertEquals('"\\ud937"', JSON.stringify('\uD937')); +assertEquals('"\\ud938"', JSON.stringify('\uD938')); +assertEquals('"\\ud939"', JSON.stringify('\uD939')); +assertEquals('"\\ud93a"', JSON.stringify('\uD93A')); +assertEquals('"\\ud93b"', JSON.stringify('\uD93B')); +assertEquals('"\\ud93c"', JSON.stringify('\uD93C')); +assertEquals('"\\ud93d"', JSON.stringify('\uD93D')); +assertEquals('"\\ud93e"', JSON.stringify('\uD93E')); +assertEquals('"\\ud93f"', JSON.stringify('\uD93F')); +assertEquals('"\\ud940"', JSON.stringify('\uD940')); +assertEquals('"\\ud941"', JSON.stringify('\uD941')); +assertEquals('"\\ud942"', JSON.stringify('\uD942')); +assertEquals('"\\ud943"', JSON.stringify('\uD943')); +assertEquals('"\\ud944"', JSON.stringify('\uD944')); +assertEquals('"\\ud945"', JSON.stringify('\uD945')); +assertEquals('"\\ud946"', JSON.stringify('\uD946')); +assertEquals('"\\ud947"', JSON.stringify('\uD947')); +assertEquals('"\\ud948"', JSON.stringify('\uD948')); +assertEquals('"\\ud949"', JSON.stringify('\uD949')); +assertEquals('"\\ud94a"', JSON.stringify('\uD94A')); +assertEquals('"\\ud94b"', JSON.stringify('\uD94B')); +assertEquals('"\\ud94c"', JSON.stringify('\uD94C')); +assertEquals('"\\ud94d"', JSON.stringify('\uD94D')); +assertEquals('"\\ud94e"', JSON.stringify('\uD94E')); +assertEquals('"\\ud94f"', JSON.stringify('\uD94F')); +assertEquals('"\\ud950"', JSON.stringify('\uD950')); +assertEquals('"\\ud951"', JSON.stringify('\uD951')); +assertEquals('"\\ud952"', JSON.stringify('\uD952')); +assertEquals('"\\ud953"', JSON.stringify('\uD953')); +assertEquals('"\\ud954"', JSON.stringify('\uD954')); +assertEquals('"\\ud955"', JSON.stringify('\uD955')); +assertEquals('"\\ud956"', JSON.stringify('\uD956')); +assertEquals('"\\ud957"', JSON.stringify('\uD957')); +assertEquals('"\\ud958"', JSON.stringify('\uD958')); +assertEquals('"\\ud959"', JSON.stringify('\uD959')); +assertEquals('"\\ud95a"', JSON.stringify('\uD95A')); +assertEquals('"\\ud95b"', JSON.stringify('\uD95B')); +assertEquals('"\\ud95c"', JSON.stringify('\uD95C')); +assertEquals('"\\ud95d"', JSON.stringify('\uD95D')); +assertEquals('"\\ud95e"', JSON.stringify('\uD95E')); +assertEquals('"\\ud95f"', JSON.stringify('\uD95F')); +assertEquals('"\\ud960"', JSON.stringify('\uD960')); +assertEquals('"\\ud961"', JSON.stringify('\uD961')); +assertEquals('"\\ud962"', JSON.stringify('\uD962')); +assertEquals('"\\ud963"', JSON.stringify('\uD963')); +assertEquals('"\\ud964"', JSON.stringify('\uD964')); +assertEquals('"\\ud965"', JSON.stringify('\uD965')); +assertEquals('"\\ud966"', JSON.stringify('\uD966')); +assertEquals('"\\ud967"', JSON.stringify('\uD967')); +assertEquals('"\\ud968"', JSON.stringify('\uD968')); +assertEquals('"\\ud969"', JSON.stringify('\uD969')); +assertEquals('"\\ud96a"', JSON.stringify('\uD96A')); +assertEquals('"\\ud96b"', JSON.stringify('\uD96B')); +assertEquals('"\\ud96c"', JSON.stringify('\uD96C')); +assertEquals('"\\ud96d"', JSON.stringify('\uD96D')); +assertEquals('"\\ud96e"', JSON.stringify('\uD96E')); +assertEquals('"\\ud96f"', JSON.stringify('\uD96F')); +assertEquals('"\\ud970"', JSON.stringify('\uD970')); +assertEquals('"\\ud971"', JSON.stringify('\uD971')); +assertEquals('"\\ud972"', JSON.stringify('\uD972')); +assertEquals('"\\ud973"', JSON.stringify('\uD973')); +assertEquals('"\\ud974"', JSON.stringify('\uD974')); +assertEquals('"\\ud975"', JSON.stringify('\uD975')); +assertEquals('"\\ud976"', JSON.stringify('\uD976')); +assertEquals('"\\ud977"', JSON.stringify('\uD977')); +assertEquals('"\\ud978"', JSON.stringify('\uD978')); +assertEquals('"\\ud979"', JSON.stringify('\uD979')); +assertEquals('"\\ud97a"', JSON.stringify('\uD97A')); +assertEquals('"\\ud97b"', JSON.stringify('\uD97B')); +assertEquals('"\\ud97c"', JSON.stringify('\uD97C')); +assertEquals('"\\ud97d"', JSON.stringify('\uD97D')); +assertEquals('"\\ud97e"', JSON.stringify('\uD97E')); +assertEquals('"\\ud97f"', JSON.stringify('\uD97F')); +assertEquals('"\\ud980"', JSON.stringify('\uD980')); +assertEquals('"\\ud981"', JSON.stringify('\uD981')); +assertEquals('"\\ud982"', JSON.stringify('\uD982')); +assertEquals('"\\ud983"', JSON.stringify('\uD983')); +assertEquals('"\\ud984"', JSON.stringify('\uD984')); +assertEquals('"\\ud985"', JSON.stringify('\uD985')); +assertEquals('"\\ud986"', JSON.stringify('\uD986')); +assertEquals('"\\ud987"', JSON.stringify('\uD987')); +assertEquals('"\\ud988"', JSON.stringify('\uD988')); +assertEquals('"\\ud989"', JSON.stringify('\uD989')); +assertEquals('"\\ud98a"', JSON.stringify('\uD98A')); +assertEquals('"\\ud98b"', JSON.stringify('\uD98B')); +assertEquals('"\\ud98c"', JSON.stringify('\uD98C')); +assertEquals('"\\ud98d"', JSON.stringify('\uD98D')); +assertEquals('"\\ud98e"', JSON.stringify('\uD98E')); +assertEquals('"\\ud98f"', JSON.stringify('\uD98F')); +assertEquals('"\\ud990"', JSON.stringify('\uD990')); +assertEquals('"\\ud991"', JSON.stringify('\uD991')); +assertEquals('"\\ud992"', JSON.stringify('\uD992')); +assertEquals('"\\ud993"', JSON.stringify('\uD993')); +assertEquals('"\\ud994"', JSON.stringify('\uD994')); +assertEquals('"\\ud995"', JSON.stringify('\uD995')); +assertEquals('"\\ud996"', JSON.stringify('\uD996')); +assertEquals('"\\ud997"', JSON.stringify('\uD997')); +assertEquals('"\\ud998"', JSON.stringify('\uD998')); +assertEquals('"\\ud999"', JSON.stringify('\uD999')); +assertEquals('"\\ud99a"', JSON.stringify('\uD99A')); +assertEquals('"\\ud99b"', JSON.stringify('\uD99B')); +assertEquals('"\\ud99c"', JSON.stringify('\uD99C')); +assertEquals('"\\ud99d"', JSON.stringify('\uD99D')); +assertEquals('"\\ud99e"', JSON.stringify('\uD99E')); +assertEquals('"\\ud99f"', JSON.stringify('\uD99F')); +assertEquals('"\\ud9a0"', JSON.stringify('\uD9A0')); +assertEquals('"\\ud9a1"', JSON.stringify('\uD9A1')); +assertEquals('"\\ud9a2"', JSON.stringify('\uD9A2')); +assertEquals('"\\ud9a3"', JSON.stringify('\uD9A3')); +assertEquals('"\\ud9a4"', JSON.stringify('\uD9A4')); +assertEquals('"\\ud9a5"', JSON.stringify('\uD9A5')); +assertEquals('"\\ud9a6"', JSON.stringify('\uD9A6')); +assertEquals('"\\ud9a7"', JSON.stringify('\uD9A7')); +assertEquals('"\\ud9a8"', JSON.stringify('\uD9A8')); +assertEquals('"\\ud9a9"', JSON.stringify('\uD9A9')); +assertEquals('"\\ud9aa"', JSON.stringify('\uD9AA')); +assertEquals('"\\ud9ab"', JSON.stringify('\uD9AB')); +assertEquals('"\\ud9ac"', JSON.stringify('\uD9AC')); +assertEquals('"\\ud9ad"', JSON.stringify('\uD9AD')); +assertEquals('"\\ud9ae"', JSON.stringify('\uD9AE')); +assertEquals('"\\ud9af"', JSON.stringify('\uD9AF')); +assertEquals('"\\ud9b0"', JSON.stringify('\uD9B0')); +assertEquals('"\\ud9b1"', JSON.stringify('\uD9B1')); +assertEquals('"\\ud9b2"', JSON.stringify('\uD9B2')); +assertEquals('"\\ud9b3"', JSON.stringify('\uD9B3')); +assertEquals('"\\ud9b4"', JSON.stringify('\uD9B4')); +assertEquals('"\\ud9b5"', JSON.stringify('\uD9B5')); +assertEquals('"\\ud9b6"', JSON.stringify('\uD9B6')); +assertEquals('"\\ud9b7"', JSON.stringify('\uD9B7')); +assertEquals('"\\ud9b8"', JSON.stringify('\uD9B8')); +assertEquals('"\\ud9b9"', JSON.stringify('\uD9B9')); +assertEquals('"\\ud9ba"', JSON.stringify('\uD9BA')); +assertEquals('"\\ud9bb"', JSON.stringify('\uD9BB')); +assertEquals('"\\ud9bc"', JSON.stringify('\uD9BC')); +assertEquals('"\\ud9bd"', JSON.stringify('\uD9BD')); +assertEquals('"\\ud9be"', JSON.stringify('\uD9BE')); +assertEquals('"\\ud9bf"', JSON.stringify('\uD9BF')); +assertEquals('"\\ud9c0"', JSON.stringify('\uD9C0')); +assertEquals('"\\ud9c1"', JSON.stringify('\uD9C1')); +assertEquals('"\\ud9c2"', JSON.stringify('\uD9C2')); +assertEquals('"\\ud9c3"', JSON.stringify('\uD9C3')); +assertEquals('"\\ud9c4"', JSON.stringify('\uD9C4')); +assertEquals('"\\ud9c5"', JSON.stringify('\uD9C5')); +assertEquals('"\\ud9c6"', JSON.stringify('\uD9C6')); +assertEquals('"\\ud9c7"', JSON.stringify('\uD9C7')); +assertEquals('"\\ud9c8"', JSON.stringify('\uD9C8')); +assertEquals('"\\ud9c9"', JSON.stringify('\uD9C9')); +assertEquals('"\\ud9ca"', JSON.stringify('\uD9CA')); +assertEquals('"\\ud9cb"', JSON.stringify('\uD9CB')); +assertEquals('"\\ud9cc"', JSON.stringify('\uD9CC')); +assertEquals('"\\ud9cd"', JSON.stringify('\uD9CD')); +assertEquals('"\\ud9ce"', JSON.stringify('\uD9CE')); +assertEquals('"\\ud9cf"', JSON.stringify('\uD9CF')); +assertEquals('"\\ud9d0"', JSON.stringify('\uD9D0')); +assertEquals('"\\ud9d1"', JSON.stringify('\uD9D1')); +assertEquals('"\\ud9d2"', JSON.stringify('\uD9D2')); +assertEquals('"\\ud9d3"', JSON.stringify('\uD9D3')); +assertEquals('"\\ud9d4"', JSON.stringify('\uD9D4')); +assertEquals('"\\ud9d5"', JSON.stringify('\uD9D5')); +assertEquals('"\\ud9d6"', JSON.stringify('\uD9D6')); +assertEquals('"\\ud9d7"', JSON.stringify('\uD9D7')); +assertEquals('"\\ud9d8"', JSON.stringify('\uD9D8')); +assertEquals('"\\ud9d9"', JSON.stringify('\uD9D9')); +assertEquals('"\\ud9da"', JSON.stringify('\uD9DA')); +assertEquals('"\\ud9db"', JSON.stringify('\uD9DB')); +assertEquals('"\\ud9dc"', JSON.stringify('\uD9DC')); +assertEquals('"\\ud9dd"', JSON.stringify('\uD9DD')); +assertEquals('"\\ud9de"', JSON.stringify('\uD9DE')); +assertEquals('"\\ud9df"', JSON.stringify('\uD9DF')); +assertEquals('"\\ud9e0"', JSON.stringify('\uD9E0')); +assertEquals('"\\ud9e1"', JSON.stringify('\uD9E1')); +assertEquals('"\\ud9e2"', JSON.stringify('\uD9E2')); +assertEquals('"\\ud9e3"', JSON.stringify('\uD9E3')); +assertEquals('"\\ud9e4"', JSON.stringify('\uD9E4')); +assertEquals('"\\ud9e5"', JSON.stringify('\uD9E5')); +assertEquals('"\\ud9e6"', JSON.stringify('\uD9E6')); +assertEquals('"\\ud9e7"', JSON.stringify('\uD9E7')); +assertEquals('"\\ud9e8"', JSON.stringify('\uD9E8')); +assertEquals('"\\ud9e9"', JSON.stringify('\uD9E9')); +assertEquals('"\\ud9ea"', JSON.stringify('\uD9EA')); +assertEquals('"\\ud9eb"', JSON.stringify('\uD9EB')); +assertEquals('"\\ud9ec"', JSON.stringify('\uD9EC')); +assertEquals('"\\ud9ed"', JSON.stringify('\uD9ED')); +assertEquals('"\\ud9ee"', JSON.stringify('\uD9EE')); +assertEquals('"\\ud9ef"', JSON.stringify('\uD9EF')); +assertEquals('"\\ud9f0"', JSON.stringify('\uD9F0')); +assertEquals('"\\ud9f1"', JSON.stringify('\uD9F1')); +assertEquals('"\\ud9f2"', JSON.stringify('\uD9F2')); +assertEquals('"\\ud9f3"', JSON.stringify('\uD9F3')); +assertEquals('"\\ud9f4"', JSON.stringify('\uD9F4')); +assertEquals('"\\ud9f5"', JSON.stringify('\uD9F5')); +assertEquals('"\\ud9f6"', JSON.stringify('\uD9F6')); +assertEquals('"\\ud9f7"', JSON.stringify('\uD9F7')); +assertEquals('"\\ud9f8"', JSON.stringify('\uD9F8')); +assertEquals('"\\ud9f9"', JSON.stringify('\uD9F9')); +assertEquals('"\\ud9fa"', JSON.stringify('\uD9FA')); +assertEquals('"\\ud9fb"', JSON.stringify('\uD9FB')); +assertEquals('"\\ud9fc"', JSON.stringify('\uD9FC')); +assertEquals('"\\ud9fd"', JSON.stringify('\uD9FD')); +assertEquals('"\\ud9fe"', JSON.stringify('\uD9FE')); +assertEquals('"\\ud9ff"', JSON.stringify('\uD9FF')); +assertEquals('"\\uda00"', JSON.stringify('\uDA00')); +assertEquals('"\\uda01"', JSON.stringify('\uDA01')); +assertEquals('"\\uda02"', JSON.stringify('\uDA02')); +assertEquals('"\\uda03"', JSON.stringify('\uDA03')); +assertEquals('"\\uda04"', JSON.stringify('\uDA04')); +assertEquals('"\\uda05"', JSON.stringify('\uDA05')); +assertEquals('"\\uda06"', JSON.stringify('\uDA06')); +assertEquals('"\\uda07"', JSON.stringify('\uDA07')); +assertEquals('"\\uda08"', JSON.stringify('\uDA08')); +assertEquals('"\\uda09"', JSON.stringify('\uDA09')); +assertEquals('"\\uda0a"', JSON.stringify('\uDA0A')); +assertEquals('"\\uda0b"', JSON.stringify('\uDA0B')); +assertEquals('"\\uda0c"', JSON.stringify('\uDA0C')); +assertEquals('"\\uda0d"', JSON.stringify('\uDA0D')); +assertEquals('"\\uda0e"', JSON.stringify('\uDA0E')); +assertEquals('"\\uda0f"', JSON.stringify('\uDA0F')); +assertEquals('"\\uda10"', JSON.stringify('\uDA10')); +assertEquals('"\\uda11"', JSON.stringify('\uDA11')); +assertEquals('"\\uda12"', JSON.stringify('\uDA12')); +assertEquals('"\\uda13"', JSON.stringify('\uDA13')); +assertEquals('"\\uda14"', JSON.stringify('\uDA14')); +assertEquals('"\\uda15"', JSON.stringify('\uDA15')); +assertEquals('"\\uda16"', JSON.stringify('\uDA16')); +assertEquals('"\\uda17"', JSON.stringify('\uDA17')); +assertEquals('"\\uda18"', JSON.stringify('\uDA18')); +assertEquals('"\\uda19"', JSON.stringify('\uDA19')); +assertEquals('"\\uda1a"', JSON.stringify('\uDA1A')); +assertEquals('"\\uda1b"', JSON.stringify('\uDA1B')); +assertEquals('"\\uda1c"', JSON.stringify('\uDA1C')); +assertEquals('"\\uda1d"', JSON.stringify('\uDA1D')); +assertEquals('"\\uda1e"', JSON.stringify('\uDA1E')); +assertEquals('"\\uda1f"', JSON.stringify('\uDA1F')); +assertEquals('"\\uda20"', JSON.stringify('\uDA20')); +assertEquals('"\\uda21"', JSON.stringify('\uDA21')); +assertEquals('"\\uda22"', JSON.stringify('\uDA22')); +assertEquals('"\\uda23"', JSON.stringify('\uDA23')); +assertEquals('"\\uda24"', JSON.stringify('\uDA24')); +assertEquals('"\\uda25"', JSON.stringify('\uDA25')); +assertEquals('"\\uda26"', JSON.stringify('\uDA26')); +assertEquals('"\\uda27"', JSON.stringify('\uDA27')); +assertEquals('"\\uda28"', JSON.stringify('\uDA28')); +assertEquals('"\\uda29"', JSON.stringify('\uDA29')); +assertEquals('"\\uda2a"', JSON.stringify('\uDA2A')); +assertEquals('"\\uda2b"', JSON.stringify('\uDA2B')); +assertEquals('"\\uda2c"', JSON.stringify('\uDA2C')); +assertEquals('"\\uda2d"', JSON.stringify('\uDA2D')); +assertEquals('"\\uda2e"', JSON.stringify('\uDA2E')); +assertEquals('"\\uda2f"', JSON.stringify('\uDA2F')); +assertEquals('"\\uda30"', JSON.stringify('\uDA30')); +assertEquals('"\\uda31"', JSON.stringify('\uDA31')); +assertEquals('"\\uda32"', JSON.stringify('\uDA32')); +assertEquals('"\\uda33"', JSON.stringify('\uDA33')); +assertEquals('"\\uda34"', JSON.stringify('\uDA34')); +assertEquals('"\\uda35"', JSON.stringify('\uDA35')); +assertEquals('"\\uda36"', JSON.stringify('\uDA36')); +assertEquals('"\\uda37"', JSON.stringify('\uDA37')); +assertEquals('"\\uda38"', JSON.stringify('\uDA38')); +assertEquals('"\\uda39"', JSON.stringify('\uDA39')); +assertEquals('"\\uda3a"', JSON.stringify('\uDA3A')); +assertEquals('"\\uda3b"', JSON.stringify('\uDA3B')); +assertEquals('"\\uda3c"', JSON.stringify('\uDA3C')); +assertEquals('"\\uda3d"', JSON.stringify('\uDA3D')); +assertEquals('"\\uda3e"', JSON.stringify('\uDA3E')); +assertEquals('"\\uda3f"', JSON.stringify('\uDA3F')); +assertEquals('"\\uda40"', JSON.stringify('\uDA40')); +assertEquals('"\\uda41"', JSON.stringify('\uDA41')); +assertEquals('"\\uda42"', JSON.stringify('\uDA42')); +assertEquals('"\\uda43"', JSON.stringify('\uDA43')); +assertEquals('"\\uda44"', JSON.stringify('\uDA44')); +assertEquals('"\\uda45"', JSON.stringify('\uDA45')); +assertEquals('"\\uda46"', JSON.stringify('\uDA46')); +assertEquals('"\\uda47"', JSON.stringify('\uDA47')); +assertEquals('"\\uda48"', JSON.stringify('\uDA48')); +assertEquals('"\\uda49"', JSON.stringify('\uDA49')); +assertEquals('"\\uda4a"', JSON.stringify('\uDA4A')); +assertEquals('"\\uda4b"', JSON.stringify('\uDA4B')); +assertEquals('"\\uda4c"', JSON.stringify('\uDA4C')); +assertEquals('"\\uda4d"', JSON.stringify('\uDA4D')); +assertEquals('"\\uda4e"', JSON.stringify('\uDA4E')); +assertEquals('"\\uda4f"', JSON.stringify('\uDA4F')); +assertEquals('"\\uda50"', JSON.stringify('\uDA50')); +assertEquals('"\\uda51"', JSON.stringify('\uDA51')); +assertEquals('"\\uda52"', JSON.stringify('\uDA52')); +assertEquals('"\\uda53"', JSON.stringify('\uDA53')); +assertEquals('"\\uda54"', JSON.stringify('\uDA54')); +assertEquals('"\\uda55"', JSON.stringify('\uDA55')); +assertEquals('"\\uda56"', JSON.stringify('\uDA56')); +assertEquals('"\\uda57"', JSON.stringify('\uDA57')); +assertEquals('"\\uda58"', JSON.stringify('\uDA58')); +assertEquals('"\\uda59"', JSON.stringify('\uDA59')); +assertEquals('"\\uda5a"', JSON.stringify('\uDA5A')); +assertEquals('"\\uda5b"', JSON.stringify('\uDA5B')); +assertEquals('"\\uda5c"', JSON.stringify('\uDA5C')); +assertEquals('"\\uda5d"', JSON.stringify('\uDA5D')); +assertEquals('"\\uda5e"', JSON.stringify('\uDA5E')); +assertEquals('"\\uda5f"', JSON.stringify('\uDA5F')); +assertEquals('"\\uda60"', JSON.stringify('\uDA60')); +assertEquals('"\\uda61"', JSON.stringify('\uDA61')); +assertEquals('"\\uda62"', JSON.stringify('\uDA62')); +assertEquals('"\\uda63"', JSON.stringify('\uDA63')); +assertEquals('"\\uda64"', JSON.stringify('\uDA64')); +assertEquals('"\\uda65"', JSON.stringify('\uDA65')); +assertEquals('"\\uda66"', JSON.stringify('\uDA66')); +assertEquals('"\\uda67"', JSON.stringify('\uDA67')); +assertEquals('"\\uda68"', JSON.stringify('\uDA68')); +assertEquals('"\\uda69"', JSON.stringify('\uDA69')); +assertEquals('"\\uda6a"', JSON.stringify('\uDA6A')); +assertEquals('"\\uda6b"', JSON.stringify('\uDA6B')); +assertEquals('"\\uda6c"', JSON.stringify('\uDA6C')); +assertEquals('"\\uda6d"', JSON.stringify('\uDA6D')); +assertEquals('"\\uda6e"', JSON.stringify('\uDA6E')); +assertEquals('"\\uda6f"', JSON.stringify('\uDA6F')); +assertEquals('"\\uda70"', JSON.stringify('\uDA70')); +assertEquals('"\\uda71"', JSON.stringify('\uDA71')); +assertEquals('"\\uda72"', JSON.stringify('\uDA72')); +assertEquals('"\\uda73"', JSON.stringify('\uDA73')); +assertEquals('"\\uda74"', JSON.stringify('\uDA74')); +assertEquals('"\\uda75"', JSON.stringify('\uDA75')); +assertEquals('"\\uda76"', JSON.stringify('\uDA76')); +assertEquals('"\\uda77"', JSON.stringify('\uDA77')); +assertEquals('"\\uda78"', JSON.stringify('\uDA78')); +assertEquals('"\\uda79"', JSON.stringify('\uDA79')); +assertEquals('"\\uda7a"', JSON.stringify('\uDA7A')); +assertEquals('"\\uda7b"', JSON.stringify('\uDA7B')); +assertEquals('"\\uda7c"', JSON.stringify('\uDA7C')); +assertEquals('"\\uda7d"', JSON.stringify('\uDA7D')); +assertEquals('"\\uda7e"', JSON.stringify('\uDA7E')); +assertEquals('"\\uda7f"', JSON.stringify('\uDA7F')); +assertEquals('"\\uda80"', JSON.stringify('\uDA80')); +assertEquals('"\\uda81"', JSON.stringify('\uDA81')); +assertEquals('"\\uda82"', JSON.stringify('\uDA82')); +assertEquals('"\\uda83"', JSON.stringify('\uDA83')); +assertEquals('"\\uda84"', JSON.stringify('\uDA84')); +assertEquals('"\\uda85"', JSON.stringify('\uDA85')); +assertEquals('"\\uda86"', JSON.stringify('\uDA86')); +assertEquals('"\\uda87"', JSON.stringify('\uDA87')); +assertEquals('"\\uda88"', JSON.stringify('\uDA88')); +assertEquals('"\\uda89"', JSON.stringify('\uDA89')); +assertEquals('"\\uda8a"', JSON.stringify('\uDA8A')); +assertEquals('"\\uda8b"', JSON.stringify('\uDA8B')); +assertEquals('"\\uda8c"', JSON.stringify('\uDA8C')); +assertEquals('"\\uda8d"', JSON.stringify('\uDA8D')); +assertEquals('"\\uda8e"', JSON.stringify('\uDA8E')); +assertEquals('"\\uda8f"', JSON.stringify('\uDA8F')); +assertEquals('"\\uda90"', JSON.stringify('\uDA90')); +assertEquals('"\\uda91"', JSON.stringify('\uDA91')); +assertEquals('"\\uda92"', JSON.stringify('\uDA92')); +assertEquals('"\\uda93"', JSON.stringify('\uDA93')); +assertEquals('"\\uda94"', JSON.stringify('\uDA94')); +assertEquals('"\\uda95"', JSON.stringify('\uDA95')); +assertEquals('"\\uda96"', JSON.stringify('\uDA96')); +assertEquals('"\\uda97"', JSON.stringify('\uDA97')); +assertEquals('"\\uda98"', JSON.stringify('\uDA98')); +assertEquals('"\\uda99"', JSON.stringify('\uDA99')); +assertEquals('"\\uda9a"', JSON.stringify('\uDA9A')); +assertEquals('"\\uda9b"', JSON.stringify('\uDA9B')); +assertEquals('"\\uda9c"', JSON.stringify('\uDA9C')); +assertEquals('"\\uda9d"', JSON.stringify('\uDA9D')); +assertEquals('"\\uda9e"', JSON.stringify('\uDA9E')); +assertEquals('"\\uda9f"', JSON.stringify('\uDA9F')); +assertEquals('"\\udaa0"', JSON.stringify('\uDAA0')); +assertEquals('"\\udaa1"', JSON.stringify('\uDAA1')); +assertEquals('"\\udaa2"', JSON.stringify('\uDAA2')); +assertEquals('"\\udaa3"', JSON.stringify('\uDAA3')); +assertEquals('"\\udaa4"', JSON.stringify('\uDAA4')); +assertEquals('"\\udaa5"', JSON.stringify('\uDAA5')); +assertEquals('"\\udaa6"', JSON.stringify('\uDAA6')); +assertEquals('"\\udaa7"', JSON.stringify('\uDAA7')); +assertEquals('"\\udaa8"', JSON.stringify('\uDAA8')); +assertEquals('"\\udaa9"', JSON.stringify('\uDAA9')); +assertEquals('"\\udaaa"', JSON.stringify('\uDAAA')); +assertEquals('"\\udaab"', JSON.stringify('\uDAAB')); +assertEquals('"\\udaac"', JSON.stringify('\uDAAC')); +assertEquals('"\\udaad"', JSON.stringify('\uDAAD')); +assertEquals('"\\udaae"', JSON.stringify('\uDAAE')); +assertEquals('"\\udaaf"', JSON.stringify('\uDAAF')); +assertEquals('"\\udab0"', JSON.stringify('\uDAB0')); +assertEquals('"\\udab1"', JSON.stringify('\uDAB1')); +assertEquals('"\\udab2"', JSON.stringify('\uDAB2')); +assertEquals('"\\udab3"', JSON.stringify('\uDAB3')); +assertEquals('"\\udab4"', JSON.stringify('\uDAB4')); +assertEquals('"\\udab5"', JSON.stringify('\uDAB5')); +assertEquals('"\\udab6"', JSON.stringify('\uDAB6')); +assertEquals('"\\udab7"', JSON.stringify('\uDAB7')); +assertEquals('"\\udab8"', JSON.stringify('\uDAB8')); +assertEquals('"\\udab9"', JSON.stringify('\uDAB9')); +assertEquals('"\\udaba"', JSON.stringify('\uDABA')); +assertEquals('"\\udabb"', JSON.stringify('\uDABB')); +assertEquals('"\\udabc"', JSON.stringify('\uDABC')); +assertEquals('"\\udabd"', JSON.stringify('\uDABD')); +assertEquals('"\\udabe"', JSON.stringify('\uDABE')); +assertEquals('"\\udabf"', JSON.stringify('\uDABF')); +assertEquals('"\\udac0"', JSON.stringify('\uDAC0')); +assertEquals('"\\udac1"', JSON.stringify('\uDAC1')); +assertEquals('"\\udac2"', JSON.stringify('\uDAC2')); +assertEquals('"\\udac3"', JSON.stringify('\uDAC3')); +assertEquals('"\\udac4"', JSON.stringify('\uDAC4')); +assertEquals('"\\udac5"', JSON.stringify('\uDAC5')); +assertEquals('"\\udac6"', JSON.stringify('\uDAC6')); +assertEquals('"\\udac7"', JSON.stringify('\uDAC7')); +assertEquals('"\\udac8"', JSON.stringify('\uDAC8')); +assertEquals('"\\udac9"', JSON.stringify('\uDAC9')); +assertEquals('"\\udaca"', JSON.stringify('\uDACA')); +assertEquals('"\\udacb"', JSON.stringify('\uDACB')); +assertEquals('"\\udacc"', JSON.stringify('\uDACC')); +assertEquals('"\\udacd"', JSON.stringify('\uDACD')); +assertEquals('"\\udace"', JSON.stringify('\uDACE')); +assertEquals('"\\udacf"', JSON.stringify('\uDACF')); +assertEquals('"\\udad0"', JSON.stringify('\uDAD0')); +assertEquals('"\\udad1"', JSON.stringify('\uDAD1')); +assertEquals('"\\udad2"', JSON.stringify('\uDAD2')); +assertEquals('"\\udad3"', JSON.stringify('\uDAD3')); +assertEquals('"\\udad4"', JSON.stringify('\uDAD4')); +assertEquals('"\\udad5"', JSON.stringify('\uDAD5')); +assertEquals('"\\udad6"', JSON.stringify('\uDAD6')); +assertEquals('"\\udad7"', JSON.stringify('\uDAD7')); +assertEquals('"\\udad8"', JSON.stringify('\uDAD8')); +assertEquals('"\\udad9"', JSON.stringify('\uDAD9')); +assertEquals('"\\udada"', JSON.stringify('\uDADA')); +assertEquals('"\\udadb"', JSON.stringify('\uDADB')); +assertEquals('"\\udadc"', JSON.stringify('\uDADC')); +assertEquals('"\\udadd"', JSON.stringify('\uDADD')); +assertEquals('"\\udade"', JSON.stringify('\uDADE')); +assertEquals('"\\udadf"', JSON.stringify('\uDADF')); +assertEquals('"\\udae0"', JSON.stringify('\uDAE0')); +assertEquals('"\\udae1"', JSON.stringify('\uDAE1')); +assertEquals('"\\udae2"', JSON.stringify('\uDAE2')); +assertEquals('"\\udae3"', JSON.stringify('\uDAE3')); +assertEquals('"\\udae4"', JSON.stringify('\uDAE4')); +assertEquals('"\\udae5"', JSON.stringify('\uDAE5')); +assertEquals('"\\udae6"', JSON.stringify('\uDAE6')); +assertEquals('"\\udae7"', JSON.stringify('\uDAE7')); +assertEquals('"\\udae8"', JSON.stringify('\uDAE8')); +assertEquals('"\\udae9"', JSON.stringify('\uDAE9')); +assertEquals('"\\udaea"', JSON.stringify('\uDAEA')); +assertEquals('"\\udaeb"', JSON.stringify('\uDAEB')); +assertEquals('"\\udaec"', JSON.stringify('\uDAEC')); +assertEquals('"\\udaed"', JSON.stringify('\uDAED')); +assertEquals('"\\udaee"', JSON.stringify('\uDAEE')); +assertEquals('"\\udaef"', JSON.stringify('\uDAEF')); +assertEquals('"\\udaf0"', JSON.stringify('\uDAF0')); +assertEquals('"\\udaf1"', JSON.stringify('\uDAF1')); +assertEquals('"\\udaf2"', JSON.stringify('\uDAF2')); +assertEquals('"\\udaf3"', JSON.stringify('\uDAF3')); +assertEquals('"\\udaf4"', JSON.stringify('\uDAF4')); +assertEquals('"\\udaf5"', JSON.stringify('\uDAF5')); +assertEquals('"\\udaf6"', JSON.stringify('\uDAF6')); +assertEquals('"\\udaf7"', JSON.stringify('\uDAF7')); +assertEquals('"\\udaf8"', JSON.stringify('\uDAF8')); +assertEquals('"\\udaf9"', JSON.stringify('\uDAF9')); +assertEquals('"\\udafa"', JSON.stringify('\uDAFA')); +assertEquals('"\\udafb"', JSON.stringify('\uDAFB')); +assertEquals('"\\udafc"', JSON.stringify('\uDAFC')); +assertEquals('"\\udafd"', JSON.stringify('\uDAFD')); +assertEquals('"\\udafe"', JSON.stringify('\uDAFE')); +assertEquals('"\\udaff"', JSON.stringify('\uDAFF')); +assertEquals('"\\udb00"', JSON.stringify('\uDB00')); +assertEquals('"\\udb01"', JSON.stringify('\uDB01')); +assertEquals('"\\udb02"', JSON.stringify('\uDB02')); +assertEquals('"\\udb03"', JSON.stringify('\uDB03')); +assertEquals('"\\udb04"', JSON.stringify('\uDB04')); +assertEquals('"\\udb05"', JSON.stringify('\uDB05')); +assertEquals('"\\udb06"', JSON.stringify('\uDB06')); +assertEquals('"\\udb07"', JSON.stringify('\uDB07')); +assertEquals('"\\udb08"', JSON.stringify('\uDB08')); +assertEquals('"\\udb09"', JSON.stringify('\uDB09')); +assertEquals('"\\udb0a"', JSON.stringify('\uDB0A')); +assertEquals('"\\udb0b"', JSON.stringify('\uDB0B')); +assertEquals('"\\udb0c"', JSON.stringify('\uDB0C')); +assertEquals('"\\udb0d"', JSON.stringify('\uDB0D')); +assertEquals('"\\udb0e"', JSON.stringify('\uDB0E')); +assertEquals('"\\udb0f"', JSON.stringify('\uDB0F')); +assertEquals('"\\udb10"', JSON.stringify('\uDB10')); +assertEquals('"\\udb11"', JSON.stringify('\uDB11')); +assertEquals('"\\udb12"', JSON.stringify('\uDB12')); +assertEquals('"\\udb13"', JSON.stringify('\uDB13')); +assertEquals('"\\udb14"', JSON.stringify('\uDB14')); +assertEquals('"\\udb15"', JSON.stringify('\uDB15')); +assertEquals('"\\udb16"', JSON.stringify('\uDB16')); +assertEquals('"\\udb17"', JSON.stringify('\uDB17')); +assertEquals('"\\udb18"', JSON.stringify('\uDB18')); +assertEquals('"\\udb19"', JSON.stringify('\uDB19')); +assertEquals('"\\udb1a"', JSON.stringify('\uDB1A')); +assertEquals('"\\udb1b"', JSON.stringify('\uDB1B')); +assertEquals('"\\udb1c"', JSON.stringify('\uDB1C')); +assertEquals('"\\udb1d"', JSON.stringify('\uDB1D')); +assertEquals('"\\udb1e"', JSON.stringify('\uDB1E')); +assertEquals('"\\udb1f"', JSON.stringify('\uDB1F')); +assertEquals('"\\udb20"', JSON.stringify('\uDB20')); +assertEquals('"\\udb21"', JSON.stringify('\uDB21')); +assertEquals('"\\udb22"', JSON.stringify('\uDB22')); +assertEquals('"\\udb23"', JSON.stringify('\uDB23')); +assertEquals('"\\udb24"', JSON.stringify('\uDB24')); +assertEquals('"\\udb25"', JSON.stringify('\uDB25')); +assertEquals('"\\udb26"', JSON.stringify('\uDB26')); +assertEquals('"\\udb27"', JSON.stringify('\uDB27')); +assertEquals('"\\udb28"', JSON.stringify('\uDB28')); +assertEquals('"\\udb29"', JSON.stringify('\uDB29')); +assertEquals('"\\udb2a"', JSON.stringify('\uDB2A')); +assertEquals('"\\udb2b"', JSON.stringify('\uDB2B')); +assertEquals('"\\udb2c"', JSON.stringify('\uDB2C')); +assertEquals('"\\udb2d"', JSON.stringify('\uDB2D')); +assertEquals('"\\udb2e"', JSON.stringify('\uDB2E')); +assertEquals('"\\udb2f"', JSON.stringify('\uDB2F')); +assertEquals('"\\udb30"', JSON.stringify('\uDB30')); +assertEquals('"\\udb31"', JSON.stringify('\uDB31')); +assertEquals('"\\udb32"', JSON.stringify('\uDB32')); +assertEquals('"\\udb33"', JSON.stringify('\uDB33')); +assertEquals('"\\udb34"', JSON.stringify('\uDB34')); +assertEquals('"\\udb35"', JSON.stringify('\uDB35')); +assertEquals('"\\udb36"', JSON.stringify('\uDB36')); +assertEquals('"\\udb37"', JSON.stringify('\uDB37')); +assertEquals('"\\udb38"', JSON.stringify('\uDB38')); +assertEquals('"\\udb39"', JSON.stringify('\uDB39')); +assertEquals('"\\udb3a"', JSON.stringify('\uDB3A')); +assertEquals('"\\udb3b"', JSON.stringify('\uDB3B')); +assertEquals('"\\udb3c"', JSON.stringify('\uDB3C')); +assertEquals('"\\udb3d"', JSON.stringify('\uDB3D')); +assertEquals('"\\udb3e"', JSON.stringify('\uDB3E')); +assertEquals('"\\udb3f"', JSON.stringify('\uDB3F')); +assertEquals('"\\udb40"', JSON.stringify('\uDB40')); +assertEquals('"\\udb41"', JSON.stringify('\uDB41')); +assertEquals('"\\udb42"', JSON.stringify('\uDB42')); +assertEquals('"\\udb43"', JSON.stringify('\uDB43')); +assertEquals('"\\udb44"', JSON.stringify('\uDB44')); +assertEquals('"\\udb45"', JSON.stringify('\uDB45')); +assertEquals('"\\udb46"', JSON.stringify('\uDB46')); +assertEquals('"\\udb47"', JSON.stringify('\uDB47')); +assertEquals('"\\udb48"', JSON.stringify('\uDB48')); +assertEquals('"\\udb49"', JSON.stringify('\uDB49')); +assertEquals('"\\udb4a"', JSON.stringify('\uDB4A')); +assertEquals('"\\udb4b"', JSON.stringify('\uDB4B')); +assertEquals('"\\udb4c"', JSON.stringify('\uDB4C')); +assertEquals('"\\udb4d"', JSON.stringify('\uDB4D')); +assertEquals('"\\udb4e"', JSON.stringify('\uDB4E')); +assertEquals('"\\udb4f"', JSON.stringify('\uDB4F')); +assertEquals('"\\udb50"', JSON.stringify('\uDB50')); +assertEquals('"\\udb51"', JSON.stringify('\uDB51')); +assertEquals('"\\udb52"', JSON.stringify('\uDB52')); +assertEquals('"\\udb53"', JSON.stringify('\uDB53')); +assertEquals('"\\udb54"', JSON.stringify('\uDB54')); +assertEquals('"\\udb55"', JSON.stringify('\uDB55')); +assertEquals('"\\udb56"', JSON.stringify('\uDB56')); +assertEquals('"\\udb57"', JSON.stringify('\uDB57')); +assertEquals('"\\udb58"', JSON.stringify('\uDB58')); +assertEquals('"\\udb59"', JSON.stringify('\uDB59')); +assertEquals('"\\udb5a"', JSON.stringify('\uDB5A')); +assertEquals('"\\udb5b"', JSON.stringify('\uDB5B')); +assertEquals('"\\udb5c"', JSON.stringify('\uDB5C')); +assertEquals('"\\udb5d"', JSON.stringify('\uDB5D')); +assertEquals('"\\udb5e"', JSON.stringify('\uDB5E')); +assertEquals('"\\udb5f"', JSON.stringify('\uDB5F')); +assertEquals('"\\udb60"', JSON.stringify('\uDB60')); +assertEquals('"\\udb61"', JSON.stringify('\uDB61')); +assertEquals('"\\udb62"', JSON.stringify('\uDB62')); +assertEquals('"\\udb63"', JSON.stringify('\uDB63')); +assertEquals('"\\udb64"', JSON.stringify('\uDB64')); +assertEquals('"\\udb65"', JSON.stringify('\uDB65')); +assertEquals('"\\udb66"', JSON.stringify('\uDB66')); +assertEquals('"\\udb67"', JSON.stringify('\uDB67')); +assertEquals('"\\udb68"', JSON.stringify('\uDB68')); +assertEquals('"\\udb69"', JSON.stringify('\uDB69')); +assertEquals('"\\udb6a"', JSON.stringify('\uDB6A')); +assertEquals('"\\udb6b"', JSON.stringify('\uDB6B')); +assertEquals('"\\udb6c"', JSON.stringify('\uDB6C')); +assertEquals('"\\udb6d"', JSON.stringify('\uDB6D')); +assertEquals('"\\udb6e"', JSON.stringify('\uDB6E')); +assertEquals('"\\udb6f"', JSON.stringify('\uDB6F')); +assertEquals('"\\udb70"', JSON.stringify('\uDB70')); +assertEquals('"\\udb71"', JSON.stringify('\uDB71')); +assertEquals('"\\udb72"', JSON.stringify('\uDB72')); +assertEquals('"\\udb73"', JSON.stringify('\uDB73')); +assertEquals('"\\udb74"', JSON.stringify('\uDB74')); +assertEquals('"\\udb75"', JSON.stringify('\uDB75')); +assertEquals('"\\udb76"', JSON.stringify('\uDB76')); +assertEquals('"\\udb77"', JSON.stringify('\uDB77')); +assertEquals('"\\udb78"', JSON.stringify('\uDB78')); +assertEquals('"\\udb79"', JSON.stringify('\uDB79')); +assertEquals('"\\udb7a"', JSON.stringify('\uDB7A')); +assertEquals('"\\udb7b"', JSON.stringify('\uDB7B')); +assertEquals('"\\udb7c"', JSON.stringify('\uDB7C')); +assertEquals('"\\udb7d"', JSON.stringify('\uDB7D')); +assertEquals('"\\udb7e"', JSON.stringify('\uDB7E')); +assertEquals('"\\udb7f"', JSON.stringify('\uDB7F')); +assertEquals('"\\udb80"', JSON.stringify('\uDB80')); +assertEquals('"\\udb81"', JSON.stringify('\uDB81')); +assertEquals('"\\udb82"', JSON.stringify('\uDB82')); +assertEquals('"\\udb83"', JSON.stringify('\uDB83')); +assertEquals('"\\udb84"', JSON.stringify('\uDB84')); +assertEquals('"\\udb85"', JSON.stringify('\uDB85')); +assertEquals('"\\udb86"', JSON.stringify('\uDB86')); +assertEquals('"\\udb87"', JSON.stringify('\uDB87')); +assertEquals('"\\udb88"', JSON.stringify('\uDB88')); +assertEquals('"\\udb89"', JSON.stringify('\uDB89')); +assertEquals('"\\udb8a"', JSON.stringify('\uDB8A')); +assertEquals('"\\udb8b"', JSON.stringify('\uDB8B')); +assertEquals('"\\udb8c"', JSON.stringify('\uDB8C')); +assertEquals('"\\udb8d"', JSON.stringify('\uDB8D')); +assertEquals('"\\udb8e"', JSON.stringify('\uDB8E')); +assertEquals('"\\udb8f"', JSON.stringify('\uDB8F')); +assertEquals('"\\udb90"', JSON.stringify('\uDB90')); +assertEquals('"\\udb91"', JSON.stringify('\uDB91')); +assertEquals('"\\udb92"', JSON.stringify('\uDB92')); +assertEquals('"\\udb93"', JSON.stringify('\uDB93')); +assertEquals('"\\udb94"', JSON.stringify('\uDB94')); +assertEquals('"\\udb95"', JSON.stringify('\uDB95')); +assertEquals('"\\udb96"', JSON.stringify('\uDB96')); +assertEquals('"\\udb97"', JSON.stringify('\uDB97')); +assertEquals('"\\udb98"', JSON.stringify('\uDB98')); +assertEquals('"\\udb99"', JSON.stringify('\uDB99')); +assertEquals('"\\udb9a"', JSON.stringify('\uDB9A')); +assertEquals('"\\udb9b"', JSON.stringify('\uDB9B')); +assertEquals('"\\udb9c"', JSON.stringify('\uDB9C')); +assertEquals('"\\udb9d"', JSON.stringify('\uDB9D')); +assertEquals('"\\udb9e"', JSON.stringify('\uDB9E')); +assertEquals('"\\udb9f"', JSON.stringify('\uDB9F')); +assertEquals('"\\udba0"', JSON.stringify('\uDBA0')); +assertEquals('"\\udba1"', JSON.stringify('\uDBA1')); +assertEquals('"\\udba2"', JSON.stringify('\uDBA2')); +assertEquals('"\\udba3"', JSON.stringify('\uDBA3')); +assertEquals('"\\udba4"', JSON.stringify('\uDBA4')); +assertEquals('"\\udba5"', JSON.stringify('\uDBA5')); +assertEquals('"\\udba6"', JSON.stringify('\uDBA6')); +assertEquals('"\\udba7"', JSON.stringify('\uDBA7')); +assertEquals('"\\udba8"', JSON.stringify('\uDBA8')); +assertEquals('"\\udba9"', JSON.stringify('\uDBA9')); +assertEquals('"\\udbaa"', JSON.stringify('\uDBAA')); +assertEquals('"\\udbab"', JSON.stringify('\uDBAB')); +assertEquals('"\\udbac"', JSON.stringify('\uDBAC')); +assertEquals('"\\udbad"', JSON.stringify('\uDBAD')); +assertEquals('"\\udbae"', JSON.stringify('\uDBAE')); +assertEquals('"\\udbaf"', JSON.stringify('\uDBAF')); +assertEquals('"\\udbb0"', JSON.stringify('\uDBB0')); +assertEquals('"\\udbb1"', JSON.stringify('\uDBB1')); +assertEquals('"\\udbb2"', JSON.stringify('\uDBB2')); +assertEquals('"\\udbb3"', JSON.stringify('\uDBB3')); +assertEquals('"\\udbb4"', JSON.stringify('\uDBB4')); +assertEquals('"\\udbb5"', JSON.stringify('\uDBB5')); +assertEquals('"\\udbb6"', JSON.stringify('\uDBB6')); +assertEquals('"\\udbb7"', JSON.stringify('\uDBB7')); +assertEquals('"\\udbb8"', JSON.stringify('\uDBB8')); +assertEquals('"\\udbb9"', JSON.stringify('\uDBB9')); +assertEquals('"\\udbba"', JSON.stringify('\uDBBA')); +assertEquals('"\\udbbb"', JSON.stringify('\uDBBB')); +assertEquals('"\\udbbc"', JSON.stringify('\uDBBC')); +assertEquals('"\\udbbd"', JSON.stringify('\uDBBD')); +assertEquals('"\\udbbe"', JSON.stringify('\uDBBE')); +assertEquals('"\\udbbf"', JSON.stringify('\uDBBF')); +assertEquals('"\\udbc0"', JSON.stringify('\uDBC0')); +assertEquals('"\\udbc1"', JSON.stringify('\uDBC1')); +assertEquals('"\\udbc2"', JSON.stringify('\uDBC2')); +assertEquals('"\\udbc3"', JSON.stringify('\uDBC3')); +assertEquals('"\\udbc4"', JSON.stringify('\uDBC4')); +assertEquals('"\\udbc5"', JSON.stringify('\uDBC5')); +assertEquals('"\\udbc6"', JSON.stringify('\uDBC6')); +assertEquals('"\\udbc7"', JSON.stringify('\uDBC7')); +assertEquals('"\\udbc8"', JSON.stringify('\uDBC8')); +assertEquals('"\\udbc9"', JSON.stringify('\uDBC9')); +assertEquals('"\\udbca"', JSON.stringify('\uDBCA')); +assertEquals('"\\udbcb"', JSON.stringify('\uDBCB')); +assertEquals('"\\udbcc"', JSON.stringify('\uDBCC')); +assertEquals('"\\udbcd"', JSON.stringify('\uDBCD')); +assertEquals('"\\udbce"', JSON.stringify('\uDBCE')); +assertEquals('"\\udbcf"', JSON.stringify('\uDBCF')); +assertEquals('"\\udbd0"', JSON.stringify('\uDBD0')); +assertEquals('"\\udbd1"', JSON.stringify('\uDBD1')); +assertEquals('"\\udbd2"', JSON.stringify('\uDBD2')); +assertEquals('"\\udbd3"', JSON.stringify('\uDBD3')); +assertEquals('"\\udbd4"', JSON.stringify('\uDBD4')); +assertEquals('"\\udbd5"', JSON.stringify('\uDBD5')); +assertEquals('"\\udbd6"', JSON.stringify('\uDBD6')); +assertEquals('"\\udbd7"', JSON.stringify('\uDBD7')); +assertEquals('"\\udbd8"', JSON.stringify('\uDBD8')); +assertEquals('"\\udbd9"', JSON.stringify('\uDBD9')); +assertEquals('"\\udbda"', JSON.stringify('\uDBDA')); +assertEquals('"\\udbdb"', JSON.stringify('\uDBDB')); +assertEquals('"\\udbdc"', JSON.stringify('\uDBDC')); +assertEquals('"\\udbdd"', JSON.stringify('\uDBDD')); +assertEquals('"\\udbde"', JSON.stringify('\uDBDE')); +assertEquals('"\\udbdf"', JSON.stringify('\uDBDF')); +assertEquals('"\\udbe0"', JSON.stringify('\uDBE0')); +assertEquals('"\\udbe1"', JSON.stringify('\uDBE1')); +assertEquals('"\\udbe2"', JSON.stringify('\uDBE2')); +assertEquals('"\\udbe3"', JSON.stringify('\uDBE3')); +assertEquals('"\\udbe4"', JSON.stringify('\uDBE4')); +assertEquals('"\\udbe5"', JSON.stringify('\uDBE5')); +assertEquals('"\\udbe6"', JSON.stringify('\uDBE6')); +assertEquals('"\\udbe7"', JSON.stringify('\uDBE7')); +assertEquals('"\\udbe8"', JSON.stringify('\uDBE8')); +assertEquals('"\\udbe9"', JSON.stringify('\uDBE9')); +assertEquals('"\\udbea"', JSON.stringify('\uDBEA')); +assertEquals('"\\udbeb"', JSON.stringify('\uDBEB')); +assertEquals('"\\udbec"', JSON.stringify('\uDBEC')); +assertEquals('"\\udbed"', JSON.stringify('\uDBED')); +assertEquals('"\\udbee"', JSON.stringify('\uDBEE')); +assertEquals('"\\udbef"', JSON.stringify('\uDBEF')); +assertEquals('"\\udbf0"', JSON.stringify('\uDBF0')); +assertEquals('"\\udbf1"', JSON.stringify('\uDBF1')); +assertEquals('"\\udbf2"', JSON.stringify('\uDBF2')); +assertEquals('"\\udbf3"', JSON.stringify('\uDBF3')); +assertEquals('"\\udbf4"', JSON.stringify('\uDBF4')); +assertEquals('"\\udbf5"', JSON.stringify('\uDBF5')); +assertEquals('"\\udbf6"', JSON.stringify('\uDBF6')); +assertEquals('"\\udbf7"', JSON.stringify('\uDBF7')); +assertEquals('"\\udbf8"', JSON.stringify('\uDBF8')); +assertEquals('"\\udbf9"', JSON.stringify('\uDBF9')); +assertEquals('"\\udbfa"', JSON.stringify('\uDBFA')); +assertEquals('"\\udbfb"', JSON.stringify('\uDBFB')); +assertEquals('"\\udbfc"', JSON.stringify('\uDBFC')); +assertEquals('"\\udbfd"', JSON.stringify('\uDBFD')); +assertEquals('"\\udbfe"', JSON.stringify('\uDBFE')); +assertEquals('"\\udbff"', JSON.stringify('\uDBFF')); +assertEquals('"\\udc00"', JSON.stringify('\uDC00')); +assertEquals('"\\udc01"', JSON.stringify('\uDC01')); +assertEquals('"\\udc02"', JSON.stringify('\uDC02')); +assertEquals('"\\udc03"', JSON.stringify('\uDC03')); +assertEquals('"\\udc04"', JSON.stringify('\uDC04')); +assertEquals('"\\udc05"', JSON.stringify('\uDC05')); +assertEquals('"\\udc06"', JSON.stringify('\uDC06')); +assertEquals('"\\udc07"', JSON.stringify('\uDC07')); +assertEquals('"\\udc08"', JSON.stringify('\uDC08')); +assertEquals('"\\udc09"', JSON.stringify('\uDC09')); +assertEquals('"\\udc0a"', JSON.stringify('\uDC0A')); +assertEquals('"\\udc0b"', JSON.stringify('\uDC0B')); +assertEquals('"\\udc0c"', JSON.stringify('\uDC0C')); +assertEquals('"\\udc0d"', JSON.stringify('\uDC0D')); +assertEquals('"\\udc0e"', JSON.stringify('\uDC0E')); +assertEquals('"\\udc0f"', JSON.stringify('\uDC0F')); +assertEquals('"\\udc10"', JSON.stringify('\uDC10')); +assertEquals('"\\udc11"', JSON.stringify('\uDC11')); +assertEquals('"\\udc12"', JSON.stringify('\uDC12')); +assertEquals('"\\udc13"', JSON.stringify('\uDC13')); +assertEquals('"\\udc14"', JSON.stringify('\uDC14')); +assertEquals('"\\udc15"', JSON.stringify('\uDC15')); +assertEquals('"\\udc16"', JSON.stringify('\uDC16')); +assertEquals('"\\udc17"', JSON.stringify('\uDC17')); +assertEquals('"\\udc18"', JSON.stringify('\uDC18')); +assertEquals('"\\udc19"', JSON.stringify('\uDC19')); +assertEquals('"\\udc1a"', JSON.stringify('\uDC1A')); +assertEquals('"\\udc1b"', JSON.stringify('\uDC1B')); +assertEquals('"\\udc1c"', JSON.stringify('\uDC1C')); +assertEquals('"\\udc1d"', JSON.stringify('\uDC1D')); +assertEquals('"\\udc1e"', JSON.stringify('\uDC1E')); +assertEquals('"\\udc1f"', JSON.stringify('\uDC1F')); +assertEquals('"\\udc20"', JSON.stringify('\uDC20')); +assertEquals('"\\udc21"', JSON.stringify('\uDC21')); +assertEquals('"\\udc22"', JSON.stringify('\uDC22')); +assertEquals('"\\udc23"', JSON.stringify('\uDC23')); +assertEquals('"\\udc24"', JSON.stringify('\uDC24')); +assertEquals('"\\udc25"', JSON.stringify('\uDC25')); +assertEquals('"\\udc26"', JSON.stringify('\uDC26')); +assertEquals('"\\udc27"', JSON.stringify('\uDC27')); +assertEquals('"\\udc28"', JSON.stringify('\uDC28')); +assertEquals('"\\udc29"', JSON.stringify('\uDC29')); +assertEquals('"\\udc2a"', JSON.stringify('\uDC2A')); +assertEquals('"\\udc2b"', JSON.stringify('\uDC2B')); +assertEquals('"\\udc2c"', JSON.stringify('\uDC2C')); +assertEquals('"\\udc2d"', JSON.stringify('\uDC2D')); +assertEquals('"\\udc2e"', JSON.stringify('\uDC2E')); +assertEquals('"\\udc2f"', JSON.stringify('\uDC2F')); +assertEquals('"\\udc30"', JSON.stringify('\uDC30')); +assertEquals('"\\udc31"', JSON.stringify('\uDC31')); +assertEquals('"\\udc32"', JSON.stringify('\uDC32')); +assertEquals('"\\udc33"', JSON.stringify('\uDC33')); +assertEquals('"\\udc34"', JSON.stringify('\uDC34')); +assertEquals('"\\udc35"', JSON.stringify('\uDC35')); +assertEquals('"\\udc36"', JSON.stringify('\uDC36')); +assertEquals('"\\udc37"', JSON.stringify('\uDC37')); +assertEquals('"\\udc38"', JSON.stringify('\uDC38')); +assertEquals('"\\udc39"', JSON.stringify('\uDC39')); +assertEquals('"\\udc3a"', JSON.stringify('\uDC3A')); +assertEquals('"\\udc3b"', JSON.stringify('\uDC3B')); +assertEquals('"\\udc3c"', JSON.stringify('\uDC3C')); +assertEquals('"\\udc3d"', JSON.stringify('\uDC3D')); +assertEquals('"\\udc3e"', JSON.stringify('\uDC3E')); +assertEquals('"\\udc3f"', JSON.stringify('\uDC3F')); +assertEquals('"\\udc40"', JSON.stringify('\uDC40')); +assertEquals('"\\udc41"', JSON.stringify('\uDC41')); +assertEquals('"\\udc42"', JSON.stringify('\uDC42')); +assertEquals('"\\udc43"', JSON.stringify('\uDC43')); +assertEquals('"\\udc44"', JSON.stringify('\uDC44')); +assertEquals('"\\udc45"', JSON.stringify('\uDC45')); +assertEquals('"\\udc46"', JSON.stringify('\uDC46')); +assertEquals('"\\udc47"', JSON.stringify('\uDC47')); +assertEquals('"\\udc48"', JSON.stringify('\uDC48')); +assertEquals('"\\udc49"', JSON.stringify('\uDC49')); +assertEquals('"\\udc4a"', JSON.stringify('\uDC4A')); +assertEquals('"\\udc4b"', JSON.stringify('\uDC4B')); +assertEquals('"\\udc4c"', JSON.stringify('\uDC4C')); +assertEquals('"\\udc4d"', JSON.stringify('\uDC4D')); +assertEquals('"\\udc4e"', JSON.stringify('\uDC4E')); +assertEquals('"\\udc4f"', JSON.stringify('\uDC4F')); +assertEquals('"\\udc50"', JSON.stringify('\uDC50')); +assertEquals('"\\udc51"', JSON.stringify('\uDC51')); +assertEquals('"\\udc52"', JSON.stringify('\uDC52')); +assertEquals('"\\udc53"', JSON.stringify('\uDC53')); +assertEquals('"\\udc54"', JSON.stringify('\uDC54')); +assertEquals('"\\udc55"', JSON.stringify('\uDC55')); +assertEquals('"\\udc56"', JSON.stringify('\uDC56')); +assertEquals('"\\udc57"', JSON.stringify('\uDC57')); +assertEquals('"\\udc58"', JSON.stringify('\uDC58')); +assertEquals('"\\udc59"', JSON.stringify('\uDC59')); +assertEquals('"\\udc5a"', JSON.stringify('\uDC5A')); +assertEquals('"\\udc5b"', JSON.stringify('\uDC5B')); +assertEquals('"\\udc5c"', JSON.stringify('\uDC5C')); +assertEquals('"\\udc5d"', JSON.stringify('\uDC5D')); +assertEquals('"\\udc5e"', JSON.stringify('\uDC5E')); +assertEquals('"\\udc5f"', JSON.stringify('\uDC5F')); +assertEquals('"\\udc60"', JSON.stringify('\uDC60')); +assertEquals('"\\udc61"', JSON.stringify('\uDC61')); +assertEquals('"\\udc62"', JSON.stringify('\uDC62')); +assertEquals('"\\udc63"', JSON.stringify('\uDC63')); +assertEquals('"\\udc64"', JSON.stringify('\uDC64')); +assertEquals('"\\udc65"', JSON.stringify('\uDC65')); +assertEquals('"\\udc66"', JSON.stringify('\uDC66')); +assertEquals('"\\udc67"', JSON.stringify('\uDC67')); +assertEquals('"\\udc68"', JSON.stringify('\uDC68')); +assertEquals('"\\udc69"', JSON.stringify('\uDC69')); +assertEquals('"\\udc6a"', JSON.stringify('\uDC6A')); +assertEquals('"\\udc6b"', JSON.stringify('\uDC6B')); +assertEquals('"\\udc6c"', JSON.stringify('\uDC6C')); +assertEquals('"\\udc6d"', JSON.stringify('\uDC6D')); +assertEquals('"\\udc6e"', JSON.stringify('\uDC6E')); +assertEquals('"\\udc6f"', JSON.stringify('\uDC6F')); +assertEquals('"\\udc70"', JSON.stringify('\uDC70')); +assertEquals('"\\udc71"', JSON.stringify('\uDC71')); +assertEquals('"\\udc72"', JSON.stringify('\uDC72')); +assertEquals('"\\udc73"', JSON.stringify('\uDC73')); +assertEquals('"\\udc74"', JSON.stringify('\uDC74')); +assertEquals('"\\udc75"', JSON.stringify('\uDC75')); +assertEquals('"\\udc76"', JSON.stringify('\uDC76')); +assertEquals('"\\udc77"', JSON.stringify('\uDC77')); +assertEquals('"\\udc78"', JSON.stringify('\uDC78')); +assertEquals('"\\udc79"', JSON.stringify('\uDC79')); +assertEquals('"\\udc7a"', JSON.stringify('\uDC7A')); +assertEquals('"\\udc7b"', JSON.stringify('\uDC7B')); +assertEquals('"\\udc7c"', JSON.stringify('\uDC7C')); +assertEquals('"\\udc7d"', JSON.stringify('\uDC7D')); +assertEquals('"\\udc7e"', JSON.stringify('\uDC7E')); +assertEquals('"\\udc7f"', JSON.stringify('\uDC7F')); +assertEquals('"\\udc80"', JSON.stringify('\uDC80')); +assertEquals('"\\udc81"', JSON.stringify('\uDC81')); +assertEquals('"\\udc82"', JSON.stringify('\uDC82')); +assertEquals('"\\udc83"', JSON.stringify('\uDC83')); +assertEquals('"\\udc84"', JSON.stringify('\uDC84')); +assertEquals('"\\udc85"', JSON.stringify('\uDC85')); +assertEquals('"\\udc86"', JSON.stringify('\uDC86')); +assertEquals('"\\udc87"', JSON.stringify('\uDC87')); +assertEquals('"\\udc88"', JSON.stringify('\uDC88')); +assertEquals('"\\udc89"', JSON.stringify('\uDC89')); +assertEquals('"\\udc8a"', JSON.stringify('\uDC8A')); +assertEquals('"\\udc8b"', JSON.stringify('\uDC8B')); +assertEquals('"\\udc8c"', JSON.stringify('\uDC8C')); +assertEquals('"\\udc8d"', JSON.stringify('\uDC8D')); +assertEquals('"\\udc8e"', JSON.stringify('\uDC8E')); +assertEquals('"\\udc8f"', JSON.stringify('\uDC8F')); +assertEquals('"\\udc90"', JSON.stringify('\uDC90')); +assertEquals('"\\udc91"', JSON.stringify('\uDC91')); +assertEquals('"\\udc92"', JSON.stringify('\uDC92')); +assertEquals('"\\udc93"', JSON.stringify('\uDC93')); +assertEquals('"\\udc94"', JSON.stringify('\uDC94')); +assertEquals('"\\udc95"', JSON.stringify('\uDC95')); +assertEquals('"\\udc96"', JSON.stringify('\uDC96')); +assertEquals('"\\udc97"', JSON.stringify('\uDC97')); +assertEquals('"\\udc98"', JSON.stringify('\uDC98')); +assertEquals('"\\udc99"', JSON.stringify('\uDC99')); +assertEquals('"\\udc9a"', JSON.stringify('\uDC9A')); +assertEquals('"\\udc9b"', JSON.stringify('\uDC9B')); +assertEquals('"\\udc9c"', JSON.stringify('\uDC9C')); +assertEquals('"\\udc9d"', JSON.stringify('\uDC9D')); +assertEquals('"\\udc9e"', JSON.stringify('\uDC9E')); +assertEquals('"\\udc9f"', JSON.stringify('\uDC9F')); +assertEquals('"\\udca0"', JSON.stringify('\uDCA0')); +assertEquals('"\\udca1"', JSON.stringify('\uDCA1')); +assertEquals('"\\udca2"', JSON.stringify('\uDCA2')); +assertEquals('"\\udca3"', JSON.stringify('\uDCA3')); +assertEquals('"\\udca4"', JSON.stringify('\uDCA4')); +assertEquals('"\\udca5"', JSON.stringify('\uDCA5')); +assertEquals('"\\udca6"', JSON.stringify('\uDCA6')); +assertEquals('"\\udca7"', JSON.stringify('\uDCA7')); +assertEquals('"\\udca8"', JSON.stringify('\uDCA8')); +assertEquals('"\\udca9"', JSON.stringify('\uDCA9')); +assertEquals('"\\udcaa"', JSON.stringify('\uDCAA')); +assertEquals('"\\udcab"', JSON.stringify('\uDCAB')); +assertEquals('"\\udcac"', JSON.stringify('\uDCAC')); +assertEquals('"\\udcad"', JSON.stringify('\uDCAD')); +assertEquals('"\\udcae"', JSON.stringify('\uDCAE')); +assertEquals('"\\udcaf"', JSON.stringify('\uDCAF')); +assertEquals('"\\udcb0"', JSON.stringify('\uDCB0')); +assertEquals('"\\udcb1"', JSON.stringify('\uDCB1')); +assertEquals('"\\udcb2"', JSON.stringify('\uDCB2')); +assertEquals('"\\udcb3"', JSON.stringify('\uDCB3')); +assertEquals('"\\udcb4"', JSON.stringify('\uDCB4')); +assertEquals('"\\udcb5"', JSON.stringify('\uDCB5')); +assertEquals('"\\udcb6"', JSON.stringify('\uDCB6')); +assertEquals('"\\udcb7"', JSON.stringify('\uDCB7')); +assertEquals('"\\udcb8"', JSON.stringify('\uDCB8')); +assertEquals('"\\udcb9"', JSON.stringify('\uDCB9')); +assertEquals('"\\udcba"', JSON.stringify('\uDCBA')); +assertEquals('"\\udcbb"', JSON.stringify('\uDCBB')); +assertEquals('"\\udcbc"', JSON.stringify('\uDCBC')); +assertEquals('"\\udcbd"', JSON.stringify('\uDCBD')); +assertEquals('"\\udcbe"', JSON.stringify('\uDCBE')); +assertEquals('"\\udcbf"', JSON.stringify('\uDCBF')); +assertEquals('"\\udcc0"', JSON.stringify('\uDCC0')); +assertEquals('"\\udcc1"', JSON.stringify('\uDCC1')); +assertEquals('"\\udcc2"', JSON.stringify('\uDCC2')); +assertEquals('"\\udcc3"', JSON.stringify('\uDCC3')); +assertEquals('"\\udcc4"', JSON.stringify('\uDCC4')); +assertEquals('"\\udcc5"', JSON.stringify('\uDCC5')); +assertEquals('"\\udcc6"', JSON.stringify('\uDCC6')); +assertEquals('"\\udcc7"', JSON.stringify('\uDCC7')); +assertEquals('"\\udcc8"', JSON.stringify('\uDCC8')); +assertEquals('"\\udcc9"', JSON.stringify('\uDCC9')); +assertEquals('"\\udcca"', JSON.stringify('\uDCCA')); +assertEquals('"\\udccb"', JSON.stringify('\uDCCB')); +assertEquals('"\\udccc"', JSON.stringify('\uDCCC')); +assertEquals('"\\udccd"', JSON.stringify('\uDCCD')); +assertEquals('"\\udcce"', JSON.stringify('\uDCCE')); +assertEquals('"\\udccf"', JSON.stringify('\uDCCF')); +assertEquals('"\\udcd0"', JSON.stringify('\uDCD0')); +assertEquals('"\\udcd1"', JSON.stringify('\uDCD1')); +assertEquals('"\\udcd2"', JSON.stringify('\uDCD2')); +assertEquals('"\\udcd3"', JSON.stringify('\uDCD3')); +assertEquals('"\\udcd4"', JSON.stringify('\uDCD4')); +assertEquals('"\\udcd5"', JSON.stringify('\uDCD5')); +assertEquals('"\\udcd6"', JSON.stringify('\uDCD6')); +assertEquals('"\\udcd7"', JSON.stringify('\uDCD7')); +assertEquals('"\\udcd8"', JSON.stringify('\uDCD8')); +assertEquals('"\\udcd9"', JSON.stringify('\uDCD9')); +assertEquals('"\\udcda"', JSON.stringify('\uDCDA')); +assertEquals('"\\udcdb"', JSON.stringify('\uDCDB')); +assertEquals('"\\udcdc"', JSON.stringify('\uDCDC')); +assertEquals('"\\udcdd"', JSON.stringify('\uDCDD')); +assertEquals('"\\udcde"', JSON.stringify('\uDCDE')); +assertEquals('"\\udcdf"', JSON.stringify('\uDCDF')); +assertEquals('"\\udce0"', JSON.stringify('\uDCE0')); +assertEquals('"\\udce1"', JSON.stringify('\uDCE1')); +assertEquals('"\\udce2"', JSON.stringify('\uDCE2')); +assertEquals('"\\udce3"', JSON.stringify('\uDCE3')); +assertEquals('"\\udce4"', JSON.stringify('\uDCE4')); +assertEquals('"\\udce5"', JSON.stringify('\uDCE5')); +assertEquals('"\\udce6"', JSON.stringify('\uDCE6')); +assertEquals('"\\udce7"', JSON.stringify('\uDCE7')); +assertEquals('"\\udce8"', JSON.stringify('\uDCE8')); +assertEquals('"\\udce9"', JSON.stringify('\uDCE9')); +assertEquals('"\\udcea"', JSON.stringify('\uDCEA')); +assertEquals('"\\udceb"', JSON.stringify('\uDCEB')); +assertEquals('"\\udcec"', JSON.stringify('\uDCEC')); +assertEquals('"\\udced"', JSON.stringify('\uDCED')); +assertEquals('"\\udcee"', JSON.stringify('\uDCEE')); +assertEquals('"\\udcef"', JSON.stringify('\uDCEF')); +assertEquals('"\\udcf0"', JSON.stringify('\uDCF0')); +assertEquals('"\\udcf1"', JSON.stringify('\uDCF1')); +assertEquals('"\\udcf2"', JSON.stringify('\uDCF2')); +assertEquals('"\\udcf3"', JSON.stringify('\uDCF3')); +assertEquals('"\\udcf4"', JSON.stringify('\uDCF4')); +assertEquals('"\\udcf5"', JSON.stringify('\uDCF5')); +assertEquals('"\\udcf6"', JSON.stringify('\uDCF6')); +assertEquals('"\\udcf7"', JSON.stringify('\uDCF7')); +assertEquals('"\\udcf8"', JSON.stringify('\uDCF8')); +assertEquals('"\\udcf9"', JSON.stringify('\uDCF9')); +assertEquals('"\\udcfa"', JSON.stringify('\uDCFA')); +assertEquals('"\\udcfb"', JSON.stringify('\uDCFB')); +assertEquals('"\\udcfc"', JSON.stringify('\uDCFC')); +assertEquals('"\\udcfd"', JSON.stringify('\uDCFD')); +assertEquals('"\\udcfe"', JSON.stringify('\uDCFE')); +assertEquals('"\\udcff"', JSON.stringify('\uDCFF')); +assertEquals('"\\udd00"', JSON.stringify('\uDD00')); +assertEquals('"\\udd01"', JSON.stringify('\uDD01')); +assertEquals('"\\udd02"', JSON.stringify('\uDD02')); +assertEquals('"\\udd03"', JSON.stringify('\uDD03')); +assertEquals('"\\udd04"', JSON.stringify('\uDD04')); +assertEquals('"\\udd05"', JSON.stringify('\uDD05')); +assertEquals('"\\udd06"', JSON.stringify('\uDD06')); +assertEquals('"\\udd07"', JSON.stringify('\uDD07')); +assertEquals('"\\udd08"', JSON.stringify('\uDD08')); +assertEquals('"\\udd09"', JSON.stringify('\uDD09')); +assertEquals('"\\udd0a"', JSON.stringify('\uDD0A')); +assertEquals('"\\udd0b"', JSON.stringify('\uDD0B')); +assertEquals('"\\udd0c"', JSON.stringify('\uDD0C')); +assertEquals('"\\udd0d"', JSON.stringify('\uDD0D')); +assertEquals('"\\udd0e"', JSON.stringify('\uDD0E')); +assertEquals('"\\udd0f"', JSON.stringify('\uDD0F')); +assertEquals('"\\udd10"', JSON.stringify('\uDD10')); +assertEquals('"\\udd11"', JSON.stringify('\uDD11')); +assertEquals('"\\udd12"', JSON.stringify('\uDD12')); +assertEquals('"\\udd13"', JSON.stringify('\uDD13')); +assertEquals('"\\udd14"', JSON.stringify('\uDD14')); +assertEquals('"\\udd15"', JSON.stringify('\uDD15')); +assertEquals('"\\udd16"', JSON.stringify('\uDD16')); +assertEquals('"\\udd17"', JSON.stringify('\uDD17')); +assertEquals('"\\udd18"', JSON.stringify('\uDD18')); +assertEquals('"\\udd19"', JSON.stringify('\uDD19')); +assertEquals('"\\udd1a"', JSON.stringify('\uDD1A')); +assertEquals('"\\udd1b"', JSON.stringify('\uDD1B')); +assertEquals('"\\udd1c"', JSON.stringify('\uDD1C')); +assertEquals('"\\udd1d"', JSON.stringify('\uDD1D')); +assertEquals('"\\udd1e"', JSON.stringify('\uDD1E')); +assertEquals('"\\udd1f"', JSON.stringify('\uDD1F')); +assertEquals('"\\udd20"', JSON.stringify('\uDD20')); +assertEquals('"\\udd21"', JSON.stringify('\uDD21')); +assertEquals('"\\udd22"', JSON.stringify('\uDD22')); +assertEquals('"\\udd23"', JSON.stringify('\uDD23')); +assertEquals('"\\udd24"', JSON.stringify('\uDD24')); +assertEquals('"\\udd25"', JSON.stringify('\uDD25')); +assertEquals('"\\udd26"', JSON.stringify('\uDD26')); +assertEquals('"\\udd27"', JSON.stringify('\uDD27')); +assertEquals('"\\udd28"', JSON.stringify('\uDD28')); +assertEquals('"\\udd29"', JSON.stringify('\uDD29')); +assertEquals('"\\udd2a"', JSON.stringify('\uDD2A')); +assertEquals('"\\udd2b"', JSON.stringify('\uDD2B')); +assertEquals('"\\udd2c"', JSON.stringify('\uDD2C')); +assertEquals('"\\udd2d"', JSON.stringify('\uDD2D')); +assertEquals('"\\udd2e"', JSON.stringify('\uDD2E')); +assertEquals('"\\udd2f"', JSON.stringify('\uDD2F')); +assertEquals('"\\udd30"', JSON.stringify('\uDD30')); +assertEquals('"\\udd31"', JSON.stringify('\uDD31')); +assertEquals('"\\udd32"', JSON.stringify('\uDD32')); +assertEquals('"\\udd33"', JSON.stringify('\uDD33')); +assertEquals('"\\udd34"', JSON.stringify('\uDD34')); +assertEquals('"\\udd35"', JSON.stringify('\uDD35')); +assertEquals('"\\udd36"', JSON.stringify('\uDD36')); +assertEquals('"\\udd37"', JSON.stringify('\uDD37')); +assertEquals('"\\udd38"', JSON.stringify('\uDD38')); +assertEquals('"\\udd39"', JSON.stringify('\uDD39')); +assertEquals('"\\udd3a"', JSON.stringify('\uDD3A')); +assertEquals('"\\udd3b"', JSON.stringify('\uDD3B')); +assertEquals('"\\udd3c"', JSON.stringify('\uDD3C')); +assertEquals('"\\udd3d"', JSON.stringify('\uDD3D')); +assertEquals('"\\udd3e"', JSON.stringify('\uDD3E')); +assertEquals('"\\udd3f"', JSON.stringify('\uDD3F')); +assertEquals('"\\udd40"', JSON.stringify('\uDD40')); +assertEquals('"\\udd41"', JSON.stringify('\uDD41')); +assertEquals('"\\udd42"', JSON.stringify('\uDD42')); +assertEquals('"\\udd43"', JSON.stringify('\uDD43')); +assertEquals('"\\udd44"', JSON.stringify('\uDD44')); +assertEquals('"\\udd45"', JSON.stringify('\uDD45')); +assertEquals('"\\udd46"', JSON.stringify('\uDD46')); +assertEquals('"\\udd47"', JSON.stringify('\uDD47')); +assertEquals('"\\udd48"', JSON.stringify('\uDD48')); +assertEquals('"\\udd49"', JSON.stringify('\uDD49')); +assertEquals('"\\udd4a"', JSON.stringify('\uDD4A')); +assertEquals('"\\udd4b"', JSON.stringify('\uDD4B')); +assertEquals('"\\udd4c"', JSON.stringify('\uDD4C')); +assertEquals('"\\udd4d"', JSON.stringify('\uDD4D')); +assertEquals('"\\udd4e"', JSON.stringify('\uDD4E')); +assertEquals('"\\udd4f"', JSON.stringify('\uDD4F')); +assertEquals('"\\udd50"', JSON.stringify('\uDD50')); +assertEquals('"\\udd51"', JSON.stringify('\uDD51')); +assertEquals('"\\udd52"', JSON.stringify('\uDD52')); +assertEquals('"\\udd53"', JSON.stringify('\uDD53')); +assertEquals('"\\udd54"', JSON.stringify('\uDD54')); +assertEquals('"\\udd55"', JSON.stringify('\uDD55')); +assertEquals('"\\udd56"', JSON.stringify('\uDD56')); +assertEquals('"\\udd57"', JSON.stringify('\uDD57')); +assertEquals('"\\udd58"', JSON.stringify('\uDD58')); +assertEquals('"\\udd59"', JSON.stringify('\uDD59')); +assertEquals('"\\udd5a"', JSON.stringify('\uDD5A')); +assertEquals('"\\udd5b"', JSON.stringify('\uDD5B')); +assertEquals('"\\udd5c"', JSON.stringify('\uDD5C')); +assertEquals('"\\udd5d"', JSON.stringify('\uDD5D')); +assertEquals('"\\udd5e"', JSON.stringify('\uDD5E')); +assertEquals('"\\udd5f"', JSON.stringify('\uDD5F')); +assertEquals('"\\udd60"', JSON.stringify('\uDD60')); +assertEquals('"\\udd61"', JSON.stringify('\uDD61')); +assertEquals('"\\udd62"', JSON.stringify('\uDD62')); +assertEquals('"\\udd63"', JSON.stringify('\uDD63')); +assertEquals('"\\udd64"', JSON.stringify('\uDD64')); +assertEquals('"\\udd65"', JSON.stringify('\uDD65')); +assertEquals('"\\udd66"', JSON.stringify('\uDD66')); +assertEquals('"\\udd67"', JSON.stringify('\uDD67')); +assertEquals('"\\udd68"', JSON.stringify('\uDD68')); +assertEquals('"\\udd69"', JSON.stringify('\uDD69')); +assertEquals('"\\udd6a"', JSON.stringify('\uDD6A')); +assertEquals('"\\udd6b"', JSON.stringify('\uDD6B')); +assertEquals('"\\udd6c"', JSON.stringify('\uDD6C')); +assertEquals('"\\udd6d"', JSON.stringify('\uDD6D')); +assertEquals('"\\udd6e"', JSON.stringify('\uDD6E')); +assertEquals('"\\udd6f"', JSON.stringify('\uDD6F')); +assertEquals('"\\udd70"', JSON.stringify('\uDD70')); +assertEquals('"\\udd71"', JSON.stringify('\uDD71')); +assertEquals('"\\udd72"', JSON.stringify('\uDD72')); +assertEquals('"\\udd73"', JSON.stringify('\uDD73')); +assertEquals('"\\udd74"', JSON.stringify('\uDD74')); +assertEquals('"\\udd75"', JSON.stringify('\uDD75')); +assertEquals('"\\udd76"', JSON.stringify('\uDD76')); +assertEquals('"\\udd77"', JSON.stringify('\uDD77')); +assertEquals('"\\udd78"', JSON.stringify('\uDD78')); +assertEquals('"\\udd79"', JSON.stringify('\uDD79')); +assertEquals('"\\udd7a"', JSON.stringify('\uDD7A')); +assertEquals('"\\udd7b"', JSON.stringify('\uDD7B')); +assertEquals('"\\udd7c"', JSON.stringify('\uDD7C')); +assertEquals('"\\udd7d"', JSON.stringify('\uDD7D')); +assertEquals('"\\udd7e"', JSON.stringify('\uDD7E')); +assertEquals('"\\udd7f"', JSON.stringify('\uDD7F')); +assertEquals('"\\udd80"', JSON.stringify('\uDD80')); +assertEquals('"\\udd81"', JSON.stringify('\uDD81')); +assertEquals('"\\udd82"', JSON.stringify('\uDD82')); +assertEquals('"\\udd83"', JSON.stringify('\uDD83')); +assertEquals('"\\udd84"', JSON.stringify('\uDD84')); +assertEquals('"\\udd85"', JSON.stringify('\uDD85')); +assertEquals('"\\udd86"', JSON.stringify('\uDD86')); +assertEquals('"\\udd87"', JSON.stringify('\uDD87')); +assertEquals('"\\udd88"', JSON.stringify('\uDD88')); +assertEquals('"\\udd89"', JSON.stringify('\uDD89')); +assertEquals('"\\udd8a"', JSON.stringify('\uDD8A')); +assertEquals('"\\udd8b"', JSON.stringify('\uDD8B')); +assertEquals('"\\udd8c"', JSON.stringify('\uDD8C')); +assertEquals('"\\udd8d"', JSON.stringify('\uDD8D')); +assertEquals('"\\udd8e"', JSON.stringify('\uDD8E')); +assertEquals('"\\udd8f"', JSON.stringify('\uDD8F')); +assertEquals('"\\udd90"', JSON.stringify('\uDD90')); +assertEquals('"\\udd91"', JSON.stringify('\uDD91')); +assertEquals('"\\udd92"', JSON.stringify('\uDD92')); +assertEquals('"\\udd93"', JSON.stringify('\uDD93')); +assertEquals('"\\udd94"', JSON.stringify('\uDD94')); +assertEquals('"\\udd95"', JSON.stringify('\uDD95')); +assertEquals('"\\udd96"', JSON.stringify('\uDD96')); +assertEquals('"\\udd97"', JSON.stringify('\uDD97')); +assertEquals('"\\udd98"', JSON.stringify('\uDD98')); +assertEquals('"\\udd99"', JSON.stringify('\uDD99')); +assertEquals('"\\udd9a"', JSON.stringify('\uDD9A')); +assertEquals('"\\udd9b"', JSON.stringify('\uDD9B')); +assertEquals('"\\udd9c"', JSON.stringify('\uDD9C')); +assertEquals('"\\udd9d"', JSON.stringify('\uDD9D')); +assertEquals('"\\udd9e"', JSON.stringify('\uDD9E')); +assertEquals('"\\udd9f"', JSON.stringify('\uDD9F')); +assertEquals('"\\udda0"', JSON.stringify('\uDDA0')); +assertEquals('"\\udda1"', JSON.stringify('\uDDA1')); +assertEquals('"\\udda2"', JSON.stringify('\uDDA2')); +assertEquals('"\\udda3"', JSON.stringify('\uDDA3')); +assertEquals('"\\udda4"', JSON.stringify('\uDDA4')); +assertEquals('"\\udda5"', JSON.stringify('\uDDA5')); +assertEquals('"\\udda6"', JSON.stringify('\uDDA6')); +assertEquals('"\\udda7"', JSON.stringify('\uDDA7')); +assertEquals('"\\udda8"', JSON.stringify('\uDDA8')); +assertEquals('"\\udda9"', JSON.stringify('\uDDA9')); +assertEquals('"\\uddaa"', JSON.stringify('\uDDAA')); +assertEquals('"\\uddab"', JSON.stringify('\uDDAB')); +assertEquals('"\\uddac"', JSON.stringify('\uDDAC')); +assertEquals('"\\uddad"', JSON.stringify('\uDDAD')); +assertEquals('"\\uddae"', JSON.stringify('\uDDAE')); +assertEquals('"\\uddaf"', JSON.stringify('\uDDAF')); +assertEquals('"\\uddb0"', JSON.stringify('\uDDB0')); +assertEquals('"\\uddb1"', JSON.stringify('\uDDB1')); +assertEquals('"\\uddb2"', JSON.stringify('\uDDB2')); +assertEquals('"\\uddb3"', JSON.stringify('\uDDB3')); +assertEquals('"\\uddb4"', JSON.stringify('\uDDB4')); +assertEquals('"\\uddb5"', JSON.stringify('\uDDB5')); +assertEquals('"\\uddb6"', JSON.stringify('\uDDB6')); +assertEquals('"\\uddb7"', JSON.stringify('\uDDB7')); +assertEquals('"\\uddb8"', JSON.stringify('\uDDB8')); +assertEquals('"\\uddb9"', JSON.stringify('\uDDB9')); +assertEquals('"\\uddba"', JSON.stringify('\uDDBA')); +assertEquals('"\\uddbb"', JSON.stringify('\uDDBB')); +assertEquals('"\\uddbc"', JSON.stringify('\uDDBC')); +assertEquals('"\\uddbd"', JSON.stringify('\uDDBD')); +assertEquals('"\\uddbe"', JSON.stringify('\uDDBE')); +assertEquals('"\\uddbf"', JSON.stringify('\uDDBF')); +assertEquals('"\\uddc0"', JSON.stringify('\uDDC0')); +assertEquals('"\\uddc1"', JSON.stringify('\uDDC1')); +assertEquals('"\\uddc2"', JSON.stringify('\uDDC2')); +assertEquals('"\\uddc3"', JSON.stringify('\uDDC3')); +assertEquals('"\\uddc4"', JSON.stringify('\uDDC4')); +assertEquals('"\\uddc5"', JSON.stringify('\uDDC5')); +assertEquals('"\\uddc6"', JSON.stringify('\uDDC6')); +assertEquals('"\\uddc7"', JSON.stringify('\uDDC7')); +assertEquals('"\\uddc8"', JSON.stringify('\uDDC8')); +assertEquals('"\\uddc9"', JSON.stringify('\uDDC9')); +assertEquals('"\\uddca"', JSON.stringify('\uDDCA')); +assertEquals('"\\uddcb"', JSON.stringify('\uDDCB')); +assertEquals('"\\uddcc"', JSON.stringify('\uDDCC')); +assertEquals('"\\uddcd"', JSON.stringify('\uDDCD')); +assertEquals('"\\uddce"', JSON.stringify('\uDDCE')); +assertEquals('"\\uddcf"', JSON.stringify('\uDDCF')); +assertEquals('"\\uddd0"', JSON.stringify('\uDDD0')); +assertEquals('"\\uddd1"', JSON.stringify('\uDDD1')); +assertEquals('"\\uddd2"', JSON.stringify('\uDDD2')); +assertEquals('"\\uddd3"', JSON.stringify('\uDDD3')); +assertEquals('"\\uddd4"', JSON.stringify('\uDDD4')); +assertEquals('"\\uddd5"', JSON.stringify('\uDDD5')); +assertEquals('"\\uddd6"', JSON.stringify('\uDDD6')); +assertEquals('"\\uddd7"', JSON.stringify('\uDDD7')); +assertEquals('"\\uddd8"', JSON.stringify('\uDDD8')); +assertEquals('"\\uddd9"', JSON.stringify('\uDDD9')); +assertEquals('"\\uddda"', JSON.stringify('\uDDDA')); +assertEquals('"\\udddb"', JSON.stringify('\uDDDB')); +assertEquals('"\\udddc"', JSON.stringify('\uDDDC')); +assertEquals('"\\udddd"', JSON.stringify('\uDDDD')); +assertEquals('"\\uddde"', JSON.stringify('\uDDDE')); +assertEquals('"\\udddf"', JSON.stringify('\uDDDF')); +assertEquals('"\\udde0"', JSON.stringify('\uDDE0')); +assertEquals('"\\udde1"', JSON.stringify('\uDDE1')); +assertEquals('"\\udde2"', JSON.stringify('\uDDE2')); +assertEquals('"\\udde3"', JSON.stringify('\uDDE3')); +assertEquals('"\\udde4"', JSON.stringify('\uDDE4')); +assertEquals('"\\udde5"', JSON.stringify('\uDDE5')); +assertEquals('"\\udde6"', JSON.stringify('\uDDE6')); +assertEquals('"\\udde7"', JSON.stringify('\uDDE7')); +assertEquals('"\\udde8"', JSON.stringify('\uDDE8')); +assertEquals('"\\udde9"', JSON.stringify('\uDDE9')); +assertEquals('"\\uddea"', JSON.stringify('\uDDEA')); +assertEquals('"\\uddeb"', JSON.stringify('\uDDEB')); +assertEquals('"\\uddec"', JSON.stringify('\uDDEC')); +assertEquals('"\\udded"', JSON.stringify('\uDDED')); +assertEquals('"\\uddee"', JSON.stringify('\uDDEE')); +assertEquals('"\\uddef"', JSON.stringify('\uDDEF')); +assertEquals('"\\uddf0"', JSON.stringify('\uDDF0')); +assertEquals('"\\uddf1"', JSON.stringify('\uDDF1')); +assertEquals('"\\uddf2"', JSON.stringify('\uDDF2')); +assertEquals('"\\uddf3"', JSON.stringify('\uDDF3')); +assertEquals('"\\uddf4"', JSON.stringify('\uDDF4')); +assertEquals('"\\uddf5"', JSON.stringify('\uDDF5')); +assertEquals('"\\uddf6"', JSON.stringify('\uDDF6')); +assertEquals('"\\uddf7"', JSON.stringify('\uDDF7')); +assertEquals('"\\uddf8"', JSON.stringify('\uDDF8')); +assertEquals('"\\uddf9"', JSON.stringify('\uDDF9')); +assertEquals('"\\uddfa"', JSON.stringify('\uDDFA')); +assertEquals('"\\uddfb"', JSON.stringify('\uDDFB')); +assertEquals('"\\uddfc"', JSON.stringify('\uDDFC')); +assertEquals('"\\uddfd"', JSON.stringify('\uDDFD')); +assertEquals('"\\uddfe"', JSON.stringify('\uDDFE')); +assertEquals('"\\uddff"', JSON.stringify('\uDDFF')); +assertEquals('"\\ude00"', JSON.stringify('\uDE00')); +assertEquals('"\\ude01"', JSON.stringify('\uDE01')); +assertEquals('"\\ude02"', JSON.stringify('\uDE02')); +assertEquals('"\\ude03"', JSON.stringify('\uDE03')); +assertEquals('"\\ude04"', JSON.stringify('\uDE04')); +assertEquals('"\\ude05"', JSON.stringify('\uDE05')); +assertEquals('"\\ude06"', JSON.stringify('\uDE06')); +assertEquals('"\\ude07"', JSON.stringify('\uDE07')); +assertEquals('"\\ude08"', JSON.stringify('\uDE08')); +assertEquals('"\\ude09"', JSON.stringify('\uDE09')); +assertEquals('"\\ude0a"', JSON.stringify('\uDE0A')); +assertEquals('"\\ude0b"', JSON.stringify('\uDE0B')); +assertEquals('"\\ude0c"', JSON.stringify('\uDE0C')); +assertEquals('"\\ude0d"', JSON.stringify('\uDE0D')); +assertEquals('"\\ude0e"', JSON.stringify('\uDE0E')); +assertEquals('"\\ude0f"', JSON.stringify('\uDE0F')); +assertEquals('"\\ude10"', JSON.stringify('\uDE10')); +assertEquals('"\\ude11"', JSON.stringify('\uDE11')); +assertEquals('"\\ude12"', JSON.stringify('\uDE12')); +assertEquals('"\\ude13"', JSON.stringify('\uDE13')); +assertEquals('"\\ude14"', JSON.stringify('\uDE14')); +assertEquals('"\\ude15"', JSON.stringify('\uDE15')); +assertEquals('"\\ude16"', JSON.stringify('\uDE16')); +assertEquals('"\\ude17"', JSON.stringify('\uDE17')); +assertEquals('"\\ude18"', JSON.stringify('\uDE18')); +assertEquals('"\\ude19"', JSON.stringify('\uDE19')); +assertEquals('"\\ude1a"', JSON.stringify('\uDE1A')); +assertEquals('"\\ude1b"', JSON.stringify('\uDE1B')); +assertEquals('"\\ude1c"', JSON.stringify('\uDE1C')); +assertEquals('"\\ude1d"', JSON.stringify('\uDE1D')); +assertEquals('"\\ude1e"', JSON.stringify('\uDE1E')); +assertEquals('"\\ude1f"', JSON.stringify('\uDE1F')); +assertEquals('"\\ude20"', JSON.stringify('\uDE20')); +assertEquals('"\\ude21"', JSON.stringify('\uDE21')); +assertEquals('"\\ude22"', JSON.stringify('\uDE22')); +assertEquals('"\\ude23"', JSON.stringify('\uDE23')); +assertEquals('"\\ude24"', JSON.stringify('\uDE24')); +assertEquals('"\\ude25"', JSON.stringify('\uDE25')); +assertEquals('"\\ude26"', JSON.stringify('\uDE26')); +assertEquals('"\\ude27"', JSON.stringify('\uDE27')); +assertEquals('"\\ude28"', JSON.stringify('\uDE28')); +assertEquals('"\\ude29"', JSON.stringify('\uDE29')); +assertEquals('"\\ude2a"', JSON.stringify('\uDE2A')); +assertEquals('"\\ude2b"', JSON.stringify('\uDE2B')); +assertEquals('"\\ude2c"', JSON.stringify('\uDE2C')); +assertEquals('"\\ude2d"', JSON.stringify('\uDE2D')); +assertEquals('"\\ude2e"', JSON.stringify('\uDE2E')); +assertEquals('"\\ude2f"', JSON.stringify('\uDE2F')); +assertEquals('"\\ude30"', JSON.stringify('\uDE30')); +assertEquals('"\\ude31"', JSON.stringify('\uDE31')); +assertEquals('"\\ude32"', JSON.stringify('\uDE32')); +assertEquals('"\\ude33"', JSON.stringify('\uDE33')); +assertEquals('"\\ude34"', JSON.stringify('\uDE34')); +assertEquals('"\\ude35"', JSON.stringify('\uDE35')); +assertEquals('"\\ude36"', JSON.stringify('\uDE36')); +assertEquals('"\\ude37"', JSON.stringify('\uDE37')); +assertEquals('"\\ude38"', JSON.stringify('\uDE38')); +assertEquals('"\\ude39"', JSON.stringify('\uDE39')); +assertEquals('"\\ude3a"', JSON.stringify('\uDE3A')); +assertEquals('"\\ude3b"', JSON.stringify('\uDE3B')); +assertEquals('"\\ude3c"', JSON.stringify('\uDE3C')); +assertEquals('"\\ude3d"', JSON.stringify('\uDE3D')); +assertEquals('"\\ude3e"', JSON.stringify('\uDE3E')); +assertEquals('"\\ude3f"', JSON.stringify('\uDE3F')); +assertEquals('"\\ude40"', JSON.stringify('\uDE40')); +assertEquals('"\\ude41"', JSON.stringify('\uDE41')); +assertEquals('"\\ude42"', JSON.stringify('\uDE42')); +assertEquals('"\\ude43"', JSON.stringify('\uDE43')); +assertEquals('"\\ude44"', JSON.stringify('\uDE44')); +assertEquals('"\\ude45"', JSON.stringify('\uDE45')); +assertEquals('"\\ude46"', JSON.stringify('\uDE46')); +assertEquals('"\\ude47"', JSON.stringify('\uDE47')); +assertEquals('"\\ude48"', JSON.stringify('\uDE48')); +assertEquals('"\\ude49"', JSON.stringify('\uDE49')); +assertEquals('"\\ude4a"', JSON.stringify('\uDE4A')); +assertEquals('"\\ude4b"', JSON.stringify('\uDE4B')); +assertEquals('"\\ude4c"', JSON.stringify('\uDE4C')); +assertEquals('"\\ude4d"', JSON.stringify('\uDE4D')); +assertEquals('"\\ude4e"', JSON.stringify('\uDE4E')); +assertEquals('"\\ude4f"', JSON.stringify('\uDE4F')); +assertEquals('"\\ude50"', JSON.stringify('\uDE50')); +assertEquals('"\\ude51"', JSON.stringify('\uDE51')); +assertEquals('"\\ude52"', JSON.stringify('\uDE52')); +assertEquals('"\\ude53"', JSON.stringify('\uDE53')); +assertEquals('"\\ude54"', JSON.stringify('\uDE54')); +assertEquals('"\\ude55"', JSON.stringify('\uDE55')); +assertEquals('"\\ude56"', JSON.stringify('\uDE56')); +assertEquals('"\\ude57"', JSON.stringify('\uDE57')); +assertEquals('"\\ude58"', JSON.stringify('\uDE58')); +assertEquals('"\\ude59"', JSON.stringify('\uDE59')); +assertEquals('"\\ude5a"', JSON.stringify('\uDE5A')); +assertEquals('"\\ude5b"', JSON.stringify('\uDE5B')); +assertEquals('"\\ude5c"', JSON.stringify('\uDE5C')); +assertEquals('"\\ude5d"', JSON.stringify('\uDE5D')); +assertEquals('"\\ude5e"', JSON.stringify('\uDE5E')); +assertEquals('"\\ude5f"', JSON.stringify('\uDE5F')); +assertEquals('"\\ude60"', JSON.stringify('\uDE60')); +assertEquals('"\\ude61"', JSON.stringify('\uDE61')); +assertEquals('"\\ude62"', JSON.stringify('\uDE62')); +assertEquals('"\\ude63"', JSON.stringify('\uDE63')); +assertEquals('"\\ude64"', JSON.stringify('\uDE64')); +assertEquals('"\\ude65"', JSON.stringify('\uDE65')); +assertEquals('"\\ude66"', JSON.stringify('\uDE66')); +assertEquals('"\\ude67"', JSON.stringify('\uDE67')); +assertEquals('"\\ude68"', JSON.stringify('\uDE68')); +assertEquals('"\\ude69"', JSON.stringify('\uDE69')); +assertEquals('"\\ude6a"', JSON.stringify('\uDE6A')); +assertEquals('"\\ude6b"', JSON.stringify('\uDE6B')); +assertEquals('"\\ude6c"', JSON.stringify('\uDE6C')); +assertEquals('"\\ude6d"', JSON.stringify('\uDE6D')); +assertEquals('"\\ude6e"', JSON.stringify('\uDE6E')); +assertEquals('"\\ude6f"', JSON.stringify('\uDE6F')); +assertEquals('"\\ude70"', JSON.stringify('\uDE70')); +assertEquals('"\\ude71"', JSON.stringify('\uDE71')); +assertEquals('"\\ude72"', JSON.stringify('\uDE72')); +assertEquals('"\\ude73"', JSON.stringify('\uDE73')); +assertEquals('"\\ude74"', JSON.stringify('\uDE74')); +assertEquals('"\\ude75"', JSON.stringify('\uDE75')); +assertEquals('"\\ude76"', JSON.stringify('\uDE76')); +assertEquals('"\\ude77"', JSON.stringify('\uDE77')); +assertEquals('"\\ude78"', JSON.stringify('\uDE78')); +assertEquals('"\\ude79"', JSON.stringify('\uDE79')); +assertEquals('"\\ude7a"', JSON.stringify('\uDE7A')); +assertEquals('"\\ude7b"', JSON.stringify('\uDE7B')); +assertEquals('"\\ude7c"', JSON.stringify('\uDE7C')); +assertEquals('"\\ude7d"', JSON.stringify('\uDE7D')); +assertEquals('"\\ude7e"', JSON.stringify('\uDE7E')); +assertEquals('"\\ude7f"', JSON.stringify('\uDE7F')); +assertEquals('"\\ude80"', JSON.stringify('\uDE80')); +assertEquals('"\\ude81"', JSON.stringify('\uDE81')); +assertEquals('"\\ude82"', JSON.stringify('\uDE82')); +assertEquals('"\\ude83"', JSON.stringify('\uDE83')); +assertEquals('"\\ude84"', JSON.stringify('\uDE84')); +assertEquals('"\\ude85"', JSON.stringify('\uDE85')); +assertEquals('"\\ude86"', JSON.stringify('\uDE86')); +assertEquals('"\\ude87"', JSON.stringify('\uDE87')); +assertEquals('"\\ude88"', JSON.stringify('\uDE88')); +assertEquals('"\\ude89"', JSON.stringify('\uDE89')); +assertEquals('"\\ude8a"', JSON.stringify('\uDE8A')); +assertEquals('"\\ude8b"', JSON.stringify('\uDE8B')); +assertEquals('"\\ude8c"', JSON.stringify('\uDE8C')); +assertEquals('"\\ude8d"', JSON.stringify('\uDE8D')); +assertEquals('"\\ude8e"', JSON.stringify('\uDE8E')); +assertEquals('"\\ude8f"', JSON.stringify('\uDE8F')); +assertEquals('"\\ude90"', JSON.stringify('\uDE90')); +assertEquals('"\\ude91"', JSON.stringify('\uDE91')); +assertEquals('"\\ude92"', JSON.stringify('\uDE92')); +assertEquals('"\\ude93"', JSON.stringify('\uDE93')); +assertEquals('"\\ude94"', JSON.stringify('\uDE94')); +assertEquals('"\\ude95"', JSON.stringify('\uDE95')); +assertEquals('"\\ude96"', JSON.stringify('\uDE96')); +assertEquals('"\\ude97"', JSON.stringify('\uDE97')); +assertEquals('"\\ude98"', JSON.stringify('\uDE98')); +assertEquals('"\\ude99"', JSON.stringify('\uDE99')); +assertEquals('"\\ude9a"', JSON.stringify('\uDE9A')); +assertEquals('"\\ude9b"', JSON.stringify('\uDE9B')); +assertEquals('"\\ude9c"', JSON.stringify('\uDE9C')); +assertEquals('"\\ude9d"', JSON.stringify('\uDE9D')); +assertEquals('"\\ude9e"', JSON.stringify('\uDE9E')); +assertEquals('"\\ude9f"', JSON.stringify('\uDE9F')); +assertEquals('"\\udea0"', JSON.stringify('\uDEA0')); +assertEquals('"\\udea1"', JSON.stringify('\uDEA1')); +assertEquals('"\\udea2"', JSON.stringify('\uDEA2')); +assertEquals('"\\udea3"', JSON.stringify('\uDEA3')); +assertEquals('"\\udea4"', JSON.stringify('\uDEA4')); +assertEquals('"\\udea5"', JSON.stringify('\uDEA5')); +assertEquals('"\\udea6"', JSON.stringify('\uDEA6')); +assertEquals('"\\udea7"', JSON.stringify('\uDEA7')); +assertEquals('"\\udea8"', JSON.stringify('\uDEA8')); +assertEquals('"\\udea9"', JSON.stringify('\uDEA9')); +assertEquals('"\\udeaa"', JSON.stringify('\uDEAA')); +assertEquals('"\\udeab"', JSON.stringify('\uDEAB')); +assertEquals('"\\udeac"', JSON.stringify('\uDEAC')); +assertEquals('"\\udead"', JSON.stringify('\uDEAD')); +assertEquals('"\\udeae"', JSON.stringify('\uDEAE')); +assertEquals('"\\udeaf"', JSON.stringify('\uDEAF')); +assertEquals('"\\udeb0"', JSON.stringify('\uDEB0')); +assertEquals('"\\udeb1"', JSON.stringify('\uDEB1')); +assertEquals('"\\udeb2"', JSON.stringify('\uDEB2')); +assertEquals('"\\udeb3"', JSON.stringify('\uDEB3')); +assertEquals('"\\udeb4"', JSON.stringify('\uDEB4')); +assertEquals('"\\udeb5"', JSON.stringify('\uDEB5')); +assertEquals('"\\udeb6"', JSON.stringify('\uDEB6')); +assertEquals('"\\udeb7"', JSON.stringify('\uDEB7')); +assertEquals('"\\udeb8"', JSON.stringify('\uDEB8')); +assertEquals('"\\udeb9"', JSON.stringify('\uDEB9')); +assertEquals('"\\udeba"', JSON.stringify('\uDEBA')); +assertEquals('"\\udebb"', JSON.stringify('\uDEBB')); +assertEquals('"\\udebc"', JSON.stringify('\uDEBC')); +assertEquals('"\\udebd"', JSON.stringify('\uDEBD')); +assertEquals('"\\udebe"', JSON.stringify('\uDEBE')); +assertEquals('"\\udebf"', JSON.stringify('\uDEBF')); +assertEquals('"\\udec0"', JSON.stringify('\uDEC0')); +assertEquals('"\\udec1"', JSON.stringify('\uDEC1')); +assertEquals('"\\udec2"', JSON.stringify('\uDEC2')); +assertEquals('"\\udec3"', JSON.stringify('\uDEC3')); +assertEquals('"\\udec4"', JSON.stringify('\uDEC4')); +assertEquals('"\\udec5"', JSON.stringify('\uDEC5')); +assertEquals('"\\udec6"', JSON.stringify('\uDEC6')); +assertEquals('"\\udec7"', JSON.stringify('\uDEC7')); +assertEquals('"\\udec8"', JSON.stringify('\uDEC8')); +assertEquals('"\\udec9"', JSON.stringify('\uDEC9')); +assertEquals('"\\udeca"', JSON.stringify('\uDECA')); +assertEquals('"\\udecb"', JSON.stringify('\uDECB')); +assertEquals('"\\udecc"', JSON.stringify('\uDECC')); +assertEquals('"\\udecd"', JSON.stringify('\uDECD')); +assertEquals('"\\udece"', JSON.stringify('\uDECE')); +assertEquals('"\\udecf"', JSON.stringify('\uDECF')); +assertEquals('"\\uded0"', JSON.stringify('\uDED0')); +assertEquals('"\\uded1"', JSON.stringify('\uDED1')); +assertEquals('"\\uded2"', JSON.stringify('\uDED2')); +assertEquals('"\\uded3"', JSON.stringify('\uDED3')); +assertEquals('"\\uded4"', JSON.stringify('\uDED4')); +assertEquals('"\\uded5"', JSON.stringify('\uDED5')); +assertEquals('"\\uded6"', JSON.stringify('\uDED6')); +assertEquals('"\\uded7"', JSON.stringify('\uDED7')); +assertEquals('"\\uded8"', JSON.stringify('\uDED8')); +assertEquals('"\\uded9"', JSON.stringify('\uDED9')); +assertEquals('"\\udeda"', JSON.stringify('\uDEDA')); +assertEquals('"\\udedb"', JSON.stringify('\uDEDB')); +assertEquals('"\\udedc"', JSON.stringify('\uDEDC')); +assertEquals('"\\udedd"', JSON.stringify('\uDEDD')); +assertEquals('"\\udede"', JSON.stringify('\uDEDE')); +assertEquals('"\\udedf"', JSON.stringify('\uDEDF')); +assertEquals('"\\udee0"', JSON.stringify('\uDEE0')); +assertEquals('"\\udee1"', JSON.stringify('\uDEE1')); +assertEquals('"\\udee2"', JSON.stringify('\uDEE2')); +assertEquals('"\\udee3"', JSON.stringify('\uDEE3')); +assertEquals('"\\udee4"', JSON.stringify('\uDEE4')); +assertEquals('"\\udee5"', JSON.stringify('\uDEE5')); +assertEquals('"\\udee6"', JSON.stringify('\uDEE6')); +assertEquals('"\\udee7"', JSON.stringify('\uDEE7')); +assertEquals('"\\udee8"', JSON.stringify('\uDEE8')); +assertEquals('"\\udee9"', JSON.stringify('\uDEE9')); +assertEquals('"\\udeea"', JSON.stringify('\uDEEA')); +assertEquals('"\\udeeb"', JSON.stringify('\uDEEB')); +assertEquals('"\\udeec"', JSON.stringify('\uDEEC')); +assertEquals('"\\udeed"', JSON.stringify('\uDEED')); +assertEquals('"\\udeee"', JSON.stringify('\uDEEE')); +assertEquals('"\\udeef"', JSON.stringify('\uDEEF')); +assertEquals('"\\udef0"', JSON.stringify('\uDEF0')); +assertEquals('"\\udef1"', JSON.stringify('\uDEF1')); +assertEquals('"\\udef2"', JSON.stringify('\uDEF2')); +assertEquals('"\\udef3"', JSON.stringify('\uDEF3')); +assertEquals('"\\udef4"', JSON.stringify('\uDEF4')); +assertEquals('"\\udef5"', JSON.stringify('\uDEF5')); +assertEquals('"\\udef6"', JSON.stringify('\uDEF6')); +assertEquals('"\\udef7"', JSON.stringify('\uDEF7')); +assertEquals('"\\udef8"', JSON.stringify('\uDEF8')); +assertEquals('"\\udef9"', JSON.stringify('\uDEF9')); +assertEquals('"\\udefa"', JSON.stringify('\uDEFA')); +assertEquals('"\\udefb"', JSON.stringify('\uDEFB')); +assertEquals('"\\udefc"', JSON.stringify('\uDEFC')); +assertEquals('"\\udefd"', JSON.stringify('\uDEFD')); +assertEquals('"\\udefe"', JSON.stringify('\uDEFE')); +assertEquals('"\\udeff"', JSON.stringify('\uDEFF')); +assertEquals('"\\udf00"', JSON.stringify('\uDF00')); +assertEquals('"\\udf01"', JSON.stringify('\uDF01')); +assertEquals('"\\udf02"', JSON.stringify('\uDF02')); +assertEquals('"\\udf03"', JSON.stringify('\uDF03')); +assertEquals('"\\udf04"', JSON.stringify('\uDF04')); +assertEquals('"\\udf05"', JSON.stringify('\uDF05')); +assertEquals('"\\udf06"', JSON.stringify('\uDF06')); +assertEquals('"\\udf07"', JSON.stringify('\uDF07')); +assertEquals('"\\udf08"', JSON.stringify('\uDF08')); +assertEquals('"\\udf09"', JSON.stringify('\uDF09')); +assertEquals('"\\udf0a"', JSON.stringify('\uDF0A')); +assertEquals('"\\udf0b"', JSON.stringify('\uDF0B')); +assertEquals('"\\udf0c"', JSON.stringify('\uDF0C')); +assertEquals('"\\udf0d"', JSON.stringify('\uDF0D')); +assertEquals('"\\udf0e"', JSON.stringify('\uDF0E')); +assertEquals('"\\udf0f"', JSON.stringify('\uDF0F')); +assertEquals('"\\udf10"', JSON.stringify('\uDF10')); +assertEquals('"\\udf11"', JSON.stringify('\uDF11')); +assertEquals('"\\udf12"', JSON.stringify('\uDF12')); +assertEquals('"\\udf13"', JSON.stringify('\uDF13')); +assertEquals('"\\udf14"', JSON.stringify('\uDF14')); +assertEquals('"\\udf15"', JSON.stringify('\uDF15')); +assertEquals('"\\udf16"', JSON.stringify('\uDF16')); +assertEquals('"\\udf17"', JSON.stringify('\uDF17')); +assertEquals('"\\udf18"', JSON.stringify('\uDF18')); +assertEquals('"\\udf19"', JSON.stringify('\uDF19')); +assertEquals('"\\udf1a"', JSON.stringify('\uDF1A')); +assertEquals('"\\udf1b"', JSON.stringify('\uDF1B')); +assertEquals('"\\udf1c"', JSON.stringify('\uDF1C')); +assertEquals('"\\udf1d"', JSON.stringify('\uDF1D')); +assertEquals('"\\udf1e"', JSON.stringify('\uDF1E')); +assertEquals('"\\udf1f"', JSON.stringify('\uDF1F')); +assertEquals('"\\udf20"', JSON.stringify('\uDF20')); +assertEquals('"\\udf21"', JSON.stringify('\uDF21')); +assertEquals('"\\udf22"', JSON.stringify('\uDF22')); +assertEquals('"\\udf23"', JSON.stringify('\uDF23')); +assertEquals('"\\udf24"', JSON.stringify('\uDF24')); +assertEquals('"\\udf25"', JSON.stringify('\uDF25')); +assertEquals('"\\udf26"', JSON.stringify('\uDF26')); +assertEquals('"\\udf27"', JSON.stringify('\uDF27')); +assertEquals('"\\udf28"', JSON.stringify('\uDF28')); +assertEquals('"\\udf29"', JSON.stringify('\uDF29')); +assertEquals('"\\udf2a"', JSON.stringify('\uDF2A')); +assertEquals('"\\udf2b"', JSON.stringify('\uDF2B')); +assertEquals('"\\udf2c"', JSON.stringify('\uDF2C')); +assertEquals('"\\udf2d"', JSON.stringify('\uDF2D')); +assertEquals('"\\udf2e"', JSON.stringify('\uDF2E')); +assertEquals('"\\udf2f"', JSON.stringify('\uDF2F')); +assertEquals('"\\udf30"', JSON.stringify('\uDF30')); +assertEquals('"\\udf31"', JSON.stringify('\uDF31')); +assertEquals('"\\udf32"', JSON.stringify('\uDF32')); +assertEquals('"\\udf33"', JSON.stringify('\uDF33')); +assertEquals('"\\udf34"', JSON.stringify('\uDF34')); +assertEquals('"\\udf35"', JSON.stringify('\uDF35')); +assertEquals('"\\udf36"', JSON.stringify('\uDF36')); +assertEquals('"\\udf37"', JSON.stringify('\uDF37')); +assertEquals('"\\udf38"', JSON.stringify('\uDF38')); +assertEquals('"\\udf39"', JSON.stringify('\uDF39')); +assertEquals('"\\udf3a"', JSON.stringify('\uDF3A')); +assertEquals('"\\udf3b"', JSON.stringify('\uDF3B')); +assertEquals('"\\udf3c"', JSON.stringify('\uDF3C')); +assertEquals('"\\udf3d"', JSON.stringify('\uDF3D')); +assertEquals('"\\udf3e"', JSON.stringify('\uDF3E')); +assertEquals('"\\udf3f"', JSON.stringify('\uDF3F')); +assertEquals('"\\udf40"', JSON.stringify('\uDF40')); +assertEquals('"\\udf41"', JSON.stringify('\uDF41')); +assertEquals('"\\udf42"', JSON.stringify('\uDF42')); +assertEquals('"\\udf43"', JSON.stringify('\uDF43')); +assertEquals('"\\udf44"', JSON.stringify('\uDF44')); +assertEquals('"\\udf45"', JSON.stringify('\uDF45')); +assertEquals('"\\udf46"', JSON.stringify('\uDF46')); +assertEquals('"\\udf47"', JSON.stringify('\uDF47')); +assertEquals('"\\udf48"', JSON.stringify('\uDF48')); +assertEquals('"\\udf49"', JSON.stringify('\uDF49')); +assertEquals('"\\udf4a"', JSON.stringify('\uDF4A')); +assertEquals('"\\udf4b"', JSON.stringify('\uDF4B')); +assertEquals('"\\udf4c"', JSON.stringify('\uDF4C')); +assertEquals('"\\udf4d"', JSON.stringify('\uDF4D')); +assertEquals('"\\udf4e"', JSON.stringify('\uDF4E')); +assertEquals('"\\udf4f"', JSON.stringify('\uDF4F')); +assertEquals('"\\udf50"', JSON.stringify('\uDF50')); +assertEquals('"\\udf51"', JSON.stringify('\uDF51')); +assertEquals('"\\udf52"', JSON.stringify('\uDF52')); +assertEquals('"\\udf53"', JSON.stringify('\uDF53')); +assertEquals('"\\udf54"', JSON.stringify('\uDF54')); +assertEquals('"\\udf55"', JSON.stringify('\uDF55')); +assertEquals('"\\udf56"', JSON.stringify('\uDF56')); +assertEquals('"\\udf57"', JSON.stringify('\uDF57')); +assertEquals('"\\udf58"', JSON.stringify('\uDF58')); +assertEquals('"\\udf59"', JSON.stringify('\uDF59')); +assertEquals('"\\udf5a"', JSON.stringify('\uDF5A')); +assertEquals('"\\udf5b"', JSON.stringify('\uDF5B')); +assertEquals('"\\udf5c"', JSON.stringify('\uDF5C')); +assertEquals('"\\udf5d"', JSON.stringify('\uDF5D')); +assertEquals('"\\udf5e"', JSON.stringify('\uDF5E')); +assertEquals('"\\udf5f"', JSON.stringify('\uDF5F')); +assertEquals('"\\udf60"', JSON.stringify('\uDF60')); +assertEquals('"\\udf61"', JSON.stringify('\uDF61')); +assertEquals('"\\udf62"', JSON.stringify('\uDF62')); +assertEquals('"\\udf63"', JSON.stringify('\uDF63')); +assertEquals('"\\udf64"', JSON.stringify('\uDF64')); +assertEquals('"\\udf65"', JSON.stringify('\uDF65')); +assertEquals('"\\udf66"', JSON.stringify('\uDF66')); +assertEquals('"\\udf67"', JSON.stringify('\uDF67')); +assertEquals('"\\udf68"', JSON.stringify('\uDF68')); +assertEquals('"\\udf69"', JSON.stringify('\uDF69')); +assertEquals('"\\udf6a"', JSON.stringify('\uDF6A')); +assertEquals('"\\udf6b"', JSON.stringify('\uDF6B')); +assertEquals('"\\udf6c"', JSON.stringify('\uDF6C')); +assertEquals('"\\udf6d"', JSON.stringify('\uDF6D')); +assertEquals('"\\udf6e"', JSON.stringify('\uDF6E')); +assertEquals('"\\udf6f"', JSON.stringify('\uDF6F')); +assertEquals('"\\udf70"', JSON.stringify('\uDF70')); +assertEquals('"\\udf71"', JSON.stringify('\uDF71')); +assertEquals('"\\udf72"', JSON.stringify('\uDF72')); +assertEquals('"\\udf73"', JSON.stringify('\uDF73')); +assertEquals('"\\udf74"', JSON.stringify('\uDF74')); +assertEquals('"\\udf75"', JSON.stringify('\uDF75')); +assertEquals('"\\udf76"', JSON.stringify('\uDF76')); +assertEquals('"\\udf77"', JSON.stringify('\uDF77')); +assertEquals('"\\udf78"', JSON.stringify('\uDF78')); +assertEquals('"\\udf79"', JSON.stringify('\uDF79')); +assertEquals('"\\udf7a"', JSON.stringify('\uDF7A')); +assertEquals('"\\udf7b"', JSON.stringify('\uDF7B')); +assertEquals('"\\udf7c"', JSON.stringify('\uDF7C')); +assertEquals('"\\udf7d"', JSON.stringify('\uDF7D')); +assertEquals('"\\udf7e"', JSON.stringify('\uDF7E')); +assertEquals('"\\udf7f"', JSON.stringify('\uDF7F')); +assertEquals('"\\udf80"', JSON.stringify('\uDF80')); +assertEquals('"\\udf81"', JSON.stringify('\uDF81')); +assertEquals('"\\udf82"', JSON.stringify('\uDF82')); +assertEquals('"\\udf83"', JSON.stringify('\uDF83')); +assertEquals('"\\udf84"', JSON.stringify('\uDF84')); +assertEquals('"\\udf85"', JSON.stringify('\uDF85')); +assertEquals('"\\udf86"', JSON.stringify('\uDF86')); +assertEquals('"\\udf87"', JSON.stringify('\uDF87')); +assertEquals('"\\udf88"', JSON.stringify('\uDF88')); +assertEquals('"\\udf89"', JSON.stringify('\uDF89')); +assertEquals('"\\udf8a"', JSON.stringify('\uDF8A')); +assertEquals('"\\udf8b"', JSON.stringify('\uDF8B')); +assertEquals('"\\udf8c"', JSON.stringify('\uDF8C')); +assertEquals('"\\udf8d"', JSON.stringify('\uDF8D')); +assertEquals('"\\udf8e"', JSON.stringify('\uDF8E')); +assertEquals('"\\udf8f"', JSON.stringify('\uDF8F')); +assertEquals('"\\udf90"', JSON.stringify('\uDF90')); +assertEquals('"\\udf91"', JSON.stringify('\uDF91')); +assertEquals('"\\udf92"', JSON.stringify('\uDF92')); +assertEquals('"\\udf93"', JSON.stringify('\uDF93')); +assertEquals('"\\udf94"', JSON.stringify('\uDF94')); +assertEquals('"\\udf95"', JSON.stringify('\uDF95')); +assertEquals('"\\udf96"', JSON.stringify('\uDF96')); +assertEquals('"\\udf97"', JSON.stringify('\uDF97')); +assertEquals('"\\udf98"', JSON.stringify('\uDF98')); +assertEquals('"\\udf99"', JSON.stringify('\uDF99')); +assertEquals('"\\udf9a"', JSON.stringify('\uDF9A')); +assertEquals('"\\udf9b"', JSON.stringify('\uDF9B')); +assertEquals('"\\udf9c"', JSON.stringify('\uDF9C')); +assertEquals('"\\udf9d"', JSON.stringify('\uDF9D')); +assertEquals('"\\udf9e"', JSON.stringify('\uDF9E')); +assertEquals('"\\udf9f"', JSON.stringify('\uDF9F')); +assertEquals('"\\udfa0"', JSON.stringify('\uDFA0')); +assertEquals('"\\udfa1"', JSON.stringify('\uDFA1')); +assertEquals('"\\udfa2"', JSON.stringify('\uDFA2')); +assertEquals('"\\udfa3"', JSON.stringify('\uDFA3')); +assertEquals('"\\udfa4"', JSON.stringify('\uDFA4')); +assertEquals('"\\udfa5"', JSON.stringify('\uDFA5')); +assertEquals('"\\udfa6"', JSON.stringify('\uDFA6')); +assertEquals('"\\udfa7"', JSON.stringify('\uDFA7')); +assertEquals('"\\udfa8"', JSON.stringify('\uDFA8')); +assertEquals('"\\udfa9"', JSON.stringify('\uDFA9')); +assertEquals('"\\udfaa"', JSON.stringify('\uDFAA')); +assertEquals('"\\udfab"', JSON.stringify('\uDFAB')); +assertEquals('"\\udfac"', JSON.stringify('\uDFAC')); +assertEquals('"\\udfad"', JSON.stringify('\uDFAD')); +assertEquals('"\\udfae"', JSON.stringify('\uDFAE')); +assertEquals('"\\udfaf"', JSON.stringify('\uDFAF')); +assertEquals('"\\udfb0"', JSON.stringify('\uDFB0')); +assertEquals('"\\udfb1"', JSON.stringify('\uDFB1')); +assertEquals('"\\udfb2"', JSON.stringify('\uDFB2')); +assertEquals('"\\udfb3"', JSON.stringify('\uDFB3')); +assertEquals('"\\udfb4"', JSON.stringify('\uDFB4')); +assertEquals('"\\udfb5"', JSON.stringify('\uDFB5')); +assertEquals('"\\udfb6"', JSON.stringify('\uDFB6')); +assertEquals('"\\udfb7"', JSON.stringify('\uDFB7')); +assertEquals('"\\udfb8"', JSON.stringify('\uDFB8')); +assertEquals('"\\udfb9"', JSON.stringify('\uDFB9')); +assertEquals('"\\udfba"', JSON.stringify('\uDFBA')); +assertEquals('"\\udfbb"', JSON.stringify('\uDFBB')); +assertEquals('"\\udfbc"', JSON.stringify('\uDFBC')); +assertEquals('"\\udfbd"', JSON.stringify('\uDFBD')); +assertEquals('"\\udfbe"', JSON.stringify('\uDFBE')); +assertEquals('"\\udfbf"', JSON.stringify('\uDFBF')); +assertEquals('"\\udfc0"', JSON.stringify('\uDFC0')); +assertEquals('"\\udfc1"', JSON.stringify('\uDFC1')); +assertEquals('"\\udfc2"', JSON.stringify('\uDFC2')); +assertEquals('"\\udfc3"', JSON.stringify('\uDFC3')); +assertEquals('"\\udfc4"', JSON.stringify('\uDFC4')); +assertEquals('"\\udfc5"', JSON.stringify('\uDFC5')); +assertEquals('"\\udfc6"', JSON.stringify('\uDFC6')); +assertEquals('"\\udfc7"', JSON.stringify('\uDFC7')); +assertEquals('"\\udfc8"', JSON.stringify('\uDFC8')); +assertEquals('"\\udfc9"', JSON.stringify('\uDFC9')); +assertEquals('"\\udfca"', JSON.stringify('\uDFCA')); +assertEquals('"\\udfcb"', JSON.stringify('\uDFCB')); +assertEquals('"\\udfcc"', JSON.stringify('\uDFCC')); +assertEquals('"\\udfcd"', JSON.stringify('\uDFCD')); +assertEquals('"\\udfce"', JSON.stringify('\uDFCE')); +assertEquals('"\\udfcf"', JSON.stringify('\uDFCF')); +assertEquals('"\\udfd0"', JSON.stringify('\uDFD0')); +assertEquals('"\\udfd1"', JSON.stringify('\uDFD1')); +assertEquals('"\\udfd2"', JSON.stringify('\uDFD2')); +assertEquals('"\\udfd3"', JSON.stringify('\uDFD3')); +assertEquals('"\\udfd4"', JSON.stringify('\uDFD4')); +assertEquals('"\\udfd5"', JSON.stringify('\uDFD5')); +assertEquals('"\\udfd6"', JSON.stringify('\uDFD6')); +assertEquals('"\\udfd7"', JSON.stringify('\uDFD7')); +assertEquals('"\\udfd8"', JSON.stringify('\uDFD8')); +assertEquals('"\\udfd9"', JSON.stringify('\uDFD9')); +assertEquals('"\\udfda"', JSON.stringify('\uDFDA')); +assertEquals('"\\udfdb"', JSON.stringify('\uDFDB')); +assertEquals('"\\udfdc"', JSON.stringify('\uDFDC')); +assertEquals('"\\udfdd"', JSON.stringify('\uDFDD')); +assertEquals('"\\udfde"', JSON.stringify('\uDFDE')); +assertEquals('"\\udfdf"', JSON.stringify('\uDFDF')); +assertEquals('"\\udfe0"', JSON.stringify('\uDFE0')); +assertEquals('"\\udfe1"', JSON.stringify('\uDFE1')); +assertEquals('"\\udfe2"', JSON.stringify('\uDFE2')); +assertEquals('"\\udfe3"', JSON.stringify('\uDFE3')); +assertEquals('"\\udfe4"', JSON.stringify('\uDFE4')); +assertEquals('"\\udfe5"', JSON.stringify('\uDFE5')); +assertEquals('"\\udfe6"', JSON.stringify('\uDFE6')); +assertEquals('"\\udfe7"', JSON.stringify('\uDFE7')); +assertEquals('"\\udfe8"', JSON.stringify('\uDFE8')); +assertEquals('"\\udfe9"', JSON.stringify('\uDFE9')); +assertEquals('"\\udfea"', JSON.stringify('\uDFEA')); +assertEquals('"\\udfeb"', JSON.stringify('\uDFEB')); +assertEquals('"\\udfec"', JSON.stringify('\uDFEC')); +assertEquals('"\\udfed"', JSON.stringify('\uDFED')); +assertEquals('"\\udfee"', JSON.stringify('\uDFEE')); +assertEquals('"\\udfef"', JSON.stringify('\uDFEF')); +assertEquals('"\\udff0"', JSON.stringify('\uDFF0')); +assertEquals('"\\udff1"', JSON.stringify('\uDFF1')); +assertEquals('"\\udff2"', JSON.stringify('\uDFF2')); +assertEquals('"\\udff3"', JSON.stringify('\uDFF3')); +assertEquals('"\\udff4"', JSON.stringify('\uDFF4')); +assertEquals('"\\udff5"', JSON.stringify('\uDFF5')); +assertEquals('"\\udff6"', JSON.stringify('\uDFF6')); +assertEquals('"\\udff7"', JSON.stringify('\uDFF7')); +assertEquals('"\\udff8"', JSON.stringify('\uDFF8')); +assertEquals('"\\udff9"', JSON.stringify('\uDFF9')); +assertEquals('"\\udffa"', JSON.stringify('\uDFFA')); +assertEquals('"\\udffb"', JSON.stringify('\uDFFB')); +assertEquals('"\\udffc"', JSON.stringify('\uDFFC')); +assertEquals('"\\udffd"', JSON.stringify('\uDFFD')); +assertEquals('"\\udffe"', JSON.stringify('\uDFFE')); +assertEquals('"\\udfff"', JSON.stringify('\uDFFF')); + +// A random selection of code points from U+E000 to U+FFFF. +assertEquals('"\uE000"', JSON.stringify('\uE000')); +assertEquals('"\uE00B"', JSON.stringify('\uE00B')); +assertEquals('"\uE0CC"', JSON.stringify('\uE0CC')); +assertEquals('"\uE0FD"', JSON.stringify('\uE0FD')); +assertEquals('"\uE19E"', JSON.stringify('\uE19E')); +assertEquals('"\uE1B1"', JSON.stringify('\uE1B1')); +assertEquals('"\uE24F"', JSON.stringify('\uE24F')); +assertEquals('"\uE262"', JSON.stringify('\uE262')); +assertEquals('"\uE2C9"', JSON.stringify('\uE2C9')); +assertEquals('"\uE2DF"', JSON.stringify('\uE2DF')); +assertEquals('"\uE389"', JSON.stringify('\uE389')); +assertEquals('"\uE413"', JSON.stringify('\uE413')); +assertEquals('"\uE546"', JSON.stringify('\uE546')); +assertEquals('"\uE5E4"', JSON.stringify('\uE5E4')); +assertEquals('"\uE66B"', JSON.stringify('\uE66B')); +assertEquals('"\uE73D"', JSON.stringify('\uE73D')); +assertEquals('"\uE74F"', JSON.stringify('\uE74F')); +assertEquals('"\uE759"', JSON.stringify('\uE759')); +assertEquals('"\uE795"', JSON.stringify('\uE795')); +assertEquals('"\uE836"', JSON.stringify('\uE836')); +assertEquals('"\uE85D"', JSON.stringify('\uE85D')); +assertEquals('"\uE909"', JSON.stringify('\uE909')); +assertEquals('"\uE990"', JSON.stringify('\uE990')); +assertEquals('"\uE99F"', JSON.stringify('\uE99F')); +assertEquals('"\uE9AC"', JSON.stringify('\uE9AC')); +assertEquals('"\uE9C2"', JSON.stringify('\uE9C2')); +assertEquals('"\uEB11"', JSON.stringify('\uEB11')); +assertEquals('"\uED33"', JSON.stringify('\uED33')); +assertEquals('"\uED7D"', JSON.stringify('\uED7D')); +assertEquals('"\uEDA9"', JSON.stringify('\uEDA9')); +assertEquals('"\uEDFB"', JSON.stringify('\uEDFB')); +assertEquals('"\uEE09"', JSON.stringify('\uEE09')); +assertEquals('"\uEE0D"', JSON.stringify('\uEE0D')); +assertEquals('"\uEE34"', JSON.stringify('\uEE34')); +assertEquals('"\uEE37"', JSON.stringify('\uEE37')); +assertEquals('"\uEE38"', JSON.stringify('\uEE38')); +assertEquals('"\uEF80"', JSON.stringify('\uEF80')); +assertEquals('"\uEFE2"', JSON.stringify('\uEFE2')); +assertEquals('"\uF02C"', JSON.stringify('\uF02C')); +assertEquals('"\uF09A"', JSON.stringify('\uF09A')); +assertEquals('"\uF0C1"', JSON.stringify('\uF0C1')); +assertEquals('"\uF12C"', JSON.stringify('\uF12C')); +assertEquals('"\uF250"', JSON.stringify('\uF250')); +assertEquals('"\uF2A3"', JSON.stringify('\uF2A3')); +assertEquals('"\uF340"', JSON.stringify('\uF340')); +assertEquals('"\uF3C9"', JSON.stringify('\uF3C9')); +assertEquals('"\uF3F5"', JSON.stringify('\uF3F5')); +assertEquals('"\uF41B"', JSON.stringify('\uF41B')); +assertEquals('"\uF420"', JSON.stringify('\uF420')); +assertEquals('"\uF440"', JSON.stringify('\uF440')); +assertEquals('"\uF4AE"', JSON.stringify('\uF4AE')); +assertEquals('"\uF4B0"', JSON.stringify('\uF4B0')); +assertEquals('"\uF50D"', JSON.stringify('\uF50D')); +assertEquals('"\uF55D"', JSON.stringify('\uF55D')); +assertEquals('"\uF55E"', JSON.stringify('\uF55E')); +assertEquals('"\uF5CD"', JSON.stringify('\uF5CD')); +assertEquals('"\uF657"', JSON.stringify('\uF657')); +assertEquals('"\uF66D"', JSON.stringify('\uF66D')); +assertEquals('"\uF68F"', JSON.stringify('\uF68F')); +assertEquals('"\uF6A6"', JSON.stringify('\uF6A6')); +assertEquals('"\uF6AA"', JSON.stringify('\uF6AA')); +assertEquals('"\uF6EB"', JSON.stringify('\uF6EB')); +assertEquals('"\uF79A"', JSON.stringify('\uF79A')); +assertEquals('"\uF7E7"', JSON.stringify('\uF7E7')); +assertEquals('"\uF7E8"', JSON.stringify('\uF7E8')); +assertEquals('"\uF834"', JSON.stringify('\uF834')); +assertEquals('"\uF88B"', JSON.stringify('\uF88B')); +assertEquals('"\uF8D5"', JSON.stringify('\uF8D5')); +assertEquals('"\uF8F1"', JSON.stringify('\uF8F1')); +assertEquals('"\uF905"', JSON.stringify('\uF905')); +assertEquals('"\uF927"', JSON.stringify('\uF927')); +assertEquals('"\uF943"', JSON.stringify('\uF943')); +assertEquals('"\uF949"', JSON.stringify('\uF949')); +assertEquals('"\uF9A1"', JSON.stringify('\uF9A1')); +assertEquals('"\uF9C7"', JSON.stringify('\uF9C7')); +assertEquals('"\uFA0F"', JSON.stringify('\uFA0F')); +assertEquals('"\uFA20"', JSON.stringify('\uFA20')); +assertEquals('"\uFAA7"', JSON.stringify('\uFAA7')); +assertEquals('"\uFBCD"', JSON.stringify('\uFBCD')); +assertEquals('"\uFBF7"', JSON.stringify('\uFBF7')); +assertEquals('"\uFC40"', JSON.stringify('\uFC40')); +assertEquals('"\uFC4B"', JSON.stringify('\uFC4B')); +assertEquals('"\uFC51"', JSON.stringify('\uFC51')); +assertEquals('"\uFC5E"', JSON.stringify('\uFC5E')); +assertEquals('"\uFC67"', JSON.stringify('\uFC67')); +assertEquals('"\uFC8B"', JSON.stringify('\uFC8B')); +assertEquals('"\uFE32"', JSON.stringify('\uFE32')); +assertEquals('"\uFFC4"', JSON.stringify('\uFFC4')); +assertEquals('"\uFFFD"', JSON.stringify('\uFFFD')); +assertEquals('"\uFFFE"', JSON.stringify('\uFFFE')); +assertEquals('"\uFFFF"', JSON.stringify('\uFFFF')); + +// A random selection of astral symbols, i.e. surrogate pairs, i.e. +// code points from U+010000 to U+10FFFF. +assertEquals('"\u{10000}"', JSON.stringify('\u{10000}')); +assertEquals('"\u{11DE7}"', JSON.stringify('\u{11DE7}')); +assertEquals('"\u{15997}"', JSON.stringify('\u{15997}')); +assertEquals('"\u{187B0}"', JSON.stringify('\u{187B0}')); +assertEquals('"\u{190B2}"', JSON.stringify('\u{190B2}')); +assertEquals('"\u{1BF79}"', JSON.stringify('\u{1BF79}')); +assertEquals('"\u{1C624}"', JSON.stringify('\u{1C624}')); +assertEquals('"\u{1D9F4}"', JSON.stringify('\u{1D9F4}')); +assertEquals('"\u{24149}"', JSON.stringify('\u{24149}')); +assertEquals('"\u{2521C}"', JSON.stringify('\u{2521C}')); +assertEquals('"\u{2762D}"', JSON.stringify('\u{2762D}')); +assertEquals('"\u{2930B}"', JSON.stringify('\u{2930B}')); +assertEquals('"\u{29EC4}"', JSON.stringify('\u{29EC4}')); +assertEquals('"\u{29F9A}"', JSON.stringify('\u{29F9A}')); +assertEquals('"\u{2A27D}"', JSON.stringify('\u{2A27D}')); +assertEquals('"\u{2B363}"', JSON.stringify('\u{2B363}')); +assertEquals('"\u{2C037}"', JSON.stringify('\u{2C037}')); +assertEquals('"\u{2FAE0}"', JSON.stringify('\u{2FAE0}')); +assertEquals('"\u{2FFCF}"', JSON.stringify('\u{2FFCF}')); +assertEquals('"\u{32C1C}"', JSON.stringify('\u{32C1C}')); +assertEquals('"\u{33DA8}"', JSON.stringify('\u{33DA8}')); +assertEquals('"\u{3DCA4}"', JSON.stringify('\u{3DCA4}')); +assertEquals('"\u{44FA0}"', JSON.stringify('\u{44FA0}')); +assertEquals('"\u{45618}"', JSON.stringify('\u{45618}')); +assertEquals('"\u{47395}"', JSON.stringify('\u{47395}')); +assertEquals('"\u{4752C}"', JSON.stringify('\u{4752C}')); +assertEquals('"\u{483FE}"', JSON.stringify('\u{483FE}')); +assertEquals('"\u{49D35}"', JSON.stringify('\u{49D35}')); +assertEquals('"\u{4CE3B}"', JSON.stringify('\u{4CE3B}')); +assertEquals('"\u{55196}"', JSON.stringify('\u{55196}')); +assertEquals('"\u{58B3E}"', JSON.stringify('\u{58B3E}')); +assertEquals('"\u{5AA47}"', JSON.stringify('\u{5AA47}')); +assertEquals('"\u{5C4B8}"', JSON.stringify('\u{5C4B8}')); +assertEquals('"\u{5DD1B}"', JSON.stringify('\u{5DD1B}')); +assertEquals('"\u{5FDCB}"', JSON.stringify('\u{5FDCB}')); +assertEquals('"\u{611BA}"', JSON.stringify('\u{611BA}')); +assertEquals('"\u{66433}"', JSON.stringify('\u{66433}')); +assertEquals('"\u{690D7}"', JSON.stringify('\u{690D7}')); +assertEquals('"\u{6F617}"', JSON.stringify('\u{6F617}')); +assertEquals('"\u{711E4}"', JSON.stringify('\u{711E4}')); +assertEquals('"\u{758D2}"', JSON.stringify('\u{758D2}')); +assertEquals('"\u{780AC}"', JSON.stringify('\u{780AC}')); +assertEquals('"\u{7AE5F}"', JSON.stringify('\u{7AE5F}')); +assertEquals('"\u{7C2FB}"', JSON.stringify('\u{7C2FB}')); +assertEquals('"\u{7D25F}"', JSON.stringify('\u{7D25F}')); +assertEquals('"\u{8027A}"', JSON.stringify('\u{8027A}')); +assertEquals('"\u{84817}"', JSON.stringify('\u{84817}')); +assertEquals('"\u{8B070}"', JSON.stringify('\u{8B070}')); +assertEquals('"\u{8B390}"', JSON.stringify('\u{8B390}')); +assertEquals('"\u{8BC03}"', JSON.stringify('\u{8BC03}')); +assertEquals('"\u{8BE63}"', JSON.stringify('\u{8BE63}')); +assertEquals('"\u{8F12A}"', JSON.stringify('\u{8F12A}')); +assertEquals('"\u{9345D}"', JSON.stringify('\u{9345D}')); +assertEquals('"\u{937A9}"', JSON.stringify('\u{937A9}')); +assertEquals('"\u{94596}"', JSON.stringify('\u{94596}')); +assertEquals('"\u{967BB}"', JSON.stringify('\u{967BB}')); +assertEquals('"\u{A19D1}"', JSON.stringify('\u{A19D1}')); +assertEquals('"\u{A4FC5}"', JSON.stringify('\u{A4FC5}')); +assertEquals('"\u{AC9CF}"', JSON.stringify('\u{AC9CF}')); +assertEquals('"\u{B1366}"', JSON.stringify('\u{B1366}')); +assertEquals('"\u{B3D32}"', JSON.stringify('\u{B3D32}')); +assertEquals('"\u{B74BA}"', JSON.stringify('\u{B74BA}')); +assertEquals('"\u{B8FB0}"', JSON.stringify('\u{B8FB0}')); +assertEquals('"\u{BA0A5}"', JSON.stringify('\u{BA0A5}')); +assertEquals('"\u{BB48E}"', JSON.stringify('\u{BB48E}')); +assertEquals('"\u{C0B60}"', JSON.stringify('\u{C0B60}')); +assertEquals('"\u{C2D34}"', JSON.stringify('\u{C2D34}')); +assertEquals('"\u{C6C75}"', JSON.stringify('\u{C6C75}')); +assertEquals('"\u{C9F26}"', JSON.stringify('\u{C9F26}')); +assertEquals('"\u{CDBD0}"', JSON.stringify('\u{CDBD0}')); +assertEquals('"\u{D1E28}"', JSON.stringify('\u{D1E28}')); +assertEquals('"\u{D4A80}"', JSON.stringify('\u{D4A80}')); +assertEquals('"\u{D947F}"', JSON.stringify('\u{D947F}')); +assertEquals('"\u{D9B8A}"', JSON.stringify('\u{D9B8A}')); +assertEquals('"\u{DA203}"', JSON.stringify('\u{DA203}')); +assertEquals('"\u{DEFD3}"', JSON.stringify('\u{DEFD3}')); +assertEquals('"\u{E4F7C}"', JSON.stringify('\u{E4F7C}')); +assertEquals('"\u{E6BB3}"', JSON.stringify('\u{E6BB3}')); +assertEquals('"\u{E972D}"', JSON.stringify('\u{E972D}')); +assertEquals('"\u{EB335}"', JSON.stringify('\u{EB335}')); +assertEquals('"\u{ED3F8}"', JSON.stringify('\u{ED3F8}')); +assertEquals('"\u{ED940}"', JSON.stringify('\u{ED940}')); +assertEquals('"\u{EF6F8}"', JSON.stringify('\u{EF6F8}')); +assertEquals('"\u{F1F57}"', JSON.stringify('\u{F1F57}')); +assertEquals('"\u{F33B5}"', JSON.stringify('\u{F33B5}')); +assertEquals('"\u{F4D2A}"', JSON.stringify('\u{F4D2A}')); +assertEquals('"\u{F70BA}"', JSON.stringify('\u{F70BA}')); +assertEquals('"\u{F899F}"', JSON.stringify('\u{F899F}')); +assertEquals('"\u{1034BF}"', JSON.stringify('\u{1034BF}')); +assertEquals('"\u{107ACF}"', JSON.stringify('\u{107ACF}')); +assertEquals('"\u{10881F}"', JSON.stringify('\u{10881F}')); +assertEquals('"\u{1098A5}"', JSON.stringify('\u{1098A5}')); +assertEquals('"\u{10ABD1}"', JSON.stringify('\u{10ABD1}')); +assertEquals('"\u{10B5C5}"', JSON.stringify('\u{10B5C5}')); +assertEquals('"\u{10CC79}"', JSON.stringify('\u{10CC79}')); +assertEquals('"\u{10CD19}"', JSON.stringify('\u{10CD19}')); +assertEquals('"\u{10FFFF}"', JSON.stringify('\u{10FFFF}')); diff --git a/deps/v8/test/mjsunit/ignition/regress-616064.js b/deps/v8/test/mjsunit/ignition/regress-616064.js index 805de41ac5..f14679a422 100644 --- a/deps/v8/test/mjsunit/ignition/regress-616064.js +++ b/deps/v8/test/mjsunit/ignition/regress-616064.js @@ -13,7 +13,7 @@ function foo() { return Worker.__f_0(-2147483648, __f_0); }; - var __v_9 = new Worker(''); + var __v_9 = new Worker('', {type: 'string'}); __f_1 = {s: Math.s, __f_1: true}; } } diff --git a/deps/v8/test/mjsunit/json.js b/deps/v8/test/mjsunit/json.js index 102f777c74..04754577ff 100644 --- a/deps/v8/test/mjsunit/json.js +++ b/deps/v8/test/mjsunit/json.js @@ -375,32 +375,30 @@ var o = { toString: function() { return "42"; } }; assertEquals(42, JSON.parse(o)); -for (var i = 0; i < 65536; i++) { +for (var i = 0x0000; i <= 0xFFFF; i++) { var string = String.fromCharCode(i); var encoded = JSON.stringify(string); - var expected = "uninitialized"; + var expected = 'uninitialized'; // Following the ES5 specification of the abstraction function Quote. if (string == '"' || string == '\\') { // Step 2.a expected = '\\' + string; - } else if ("\b\t\n\r\f".indexOf(string) >= 0) { + } else if ("\b\t\n\r\f".includes(string)) { // Step 2.b if (string == '\b') expected = '\\b'; else if (string == '\t') expected = '\\t'; else if (string == '\n') expected = '\\n'; else if (string == '\f') expected = '\\f'; else if (string == '\r') expected = '\\r'; - } else if (i < 32) { + } else if (i < 0x20) { // Step 2.c - if (i < 16) { - expected = "\\u000" + i.toString(16); - } else { - expected = "\\u00" + i.toString(16); - } + expected = '\\u' + i.toString(16).padStart(4, '0'); + // TODO(mathias): Add i >= 0xD800 && i <= 0xDFFF case once + // --harmony-json-stringify is enabled by default. } else { expected = string; } - assertEquals('"' + expected + '"', encoded, "Codepoint " + i); + assertEquals('"' + expected + '"', encoded, "code point " + i); } diff --git a/deps/v8/test/mjsunit/lexicographic-compare.js b/deps/v8/test/mjsunit/lexicographic-compare.js deleted file mode 100644 index b87dd1c1ef..0000000000 --- a/deps/v8/test/mjsunit/lexicographic-compare.js +++ /dev/null @@ -1,62 +0,0 @@ -// Copyright 2018 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 () { - - assertFalse(%IsSmi(2147483648), 'Update test for >32 bit Smi'); - - // Collect a list of interesting Smis. - const seen = {}; - const smis = []; - function add(x) { - if (x | 0 == x) { - x = x | 0; // Canonicalizes to Smi if 32-bit signed and fits in Smi. - } - if (%_IsSmi(x) && !seen[x]) { - seen[x] = 1; - smis.push(x); - } - } - function addSigned(x) { - add(x); - add(-x); - } - - var BIGGER_THAN_ANY_SMI = 10 * 1000 * 1000 * 1000; - for (var xb = 1; xb <= BIGGER_THAN_ANY_SMI; xb *= 10) { - for (var xf = 0; xf <= 9; xf++) { - for (var xo = -1; xo <= 1; xo++) { - addSigned(xb * xf + xo); - } - } - } - - console.log("A") - - for (var yb = 1; yb <= BIGGER_THAN_ANY_SMI; yb *= 2) { - for (var yo = -2; yo <= 2; yo++) { - addSigned(yb + yo); - } - } - - function test(x,y) { - const lex = %SmiLexicographicCompare(x, y); - const expected = (x == y) ? 0 : (("" + x) < ("" + y) ? -1 : 1); - return lex == expected; - } - - console.log(smis.length); - - for (var i = 0; i < smis.length; i++) { - for (var j = 0; j < smis.length; j++) { - const x = smis[i]; - const y = smis[j]; - assertTrue(test(x, y), x + " < " + y);; - } - } - - console.log("C") -})(); diff --git a/deps/v8/test/mjsunit/mjsunit.js b/deps/v8/test/mjsunit/mjsunit.js index a458e0cd10..59923a4247 100644 --- a/deps/v8/test/mjsunit/mjsunit.js +++ b/deps/v8/test/mjsunit/mjsunit.js @@ -64,6 +64,9 @@ var assertNotSame; // and the properties of non-Array objects). var assertEquals; +// Deep equality predicate used by assertEquals. +var deepEquals; + // Expected and found values are not identical primitive values or functions // or similarly structured objects (checking internal properties // of, e.g., Number and Date objects, the elements of arrays @@ -183,6 +186,9 @@ var isTurboFanned; // Monkey-patchable all-purpose failure handler. var failWithMessage; +// Returns the formatted failure text. Used by test-async.js. +var formatFailureText; + // Returns a pretty-printed string representation of the passed value. var prettyPrinted; @@ -297,7 +303,7 @@ var prettyPrinted; throw new MjsUnitAssertionError(message); } - function formatFailureText(expectedText, found, name_opt) { + formatFailureText = function(expectedText, found, name_opt) { var message = "Fail" + "ure"; if (name_opt) { // Fix this when we ditch the old test runner. @@ -335,7 +341,7 @@ var prettyPrinted; } - function deepEquals(a, b) { + deepEquals = function deepEquals(a, b) { if (a === b) { // Check for -0. if (a === 0) return (1 / a) === (1 / b); diff --git a/deps/v8/test/mjsunit/mjsunit.status b/deps/v8/test/mjsunit/mjsunit.status index 4d54808b46..16a17189e0 100644 --- a/deps/v8/test/mjsunit/mjsunit.status +++ b/deps/v8/test/mjsunit/mjsunit.status @@ -55,8 +55,6 @@ # Issue 5495: enable the test when the constant field tracking in enabled. 'const-field-tracking': [SKIP], - # Issue 7872: flaky OOM - 'regress/wasm/regress-827806': [SKIP], ############################################################################## # Too slow in debug mode with --stress-opt mode. 'regress/regress-create-exception': [PASS, ['mode == debug', SKIP]], @@ -168,12 +166,15 @@ 'regress/regress-605470': [PASS, SLOW], 'regress/regress-655573': [PASS, SLOW], 'regress/regress-1200351': [PASS, SLOW], + 'regress/wasm/regress-810973': [PASS, SLOW], 'string-replace-gc': [PASS, SLOW], 'wasm/asm-wasm-f32': [PASS, SLOW], 'wasm/asm-wasm-f64': [PASS, SLOW], 'wasm/embenchen/*': [PASS, SLOW], 'wasm/grow-memory': [PASS, SLOW], 'wasm/unreachable-validation': [PASS, SLOW], + 'wasm/compare-exchange-stress': [PASS, SLOW, NO_VARIANTS], + 'wasm/compare-exchange64-stress': [PASS, SLOW, NO_VARIANTS], # case-insensitive unicode regexp relies on case mapping provided by ICU. 'es6/unicode-regexp-ignore-case': [PASS, ['no_i18n == True', FAIL]], @@ -215,14 +216,14 @@ # Allocates a huge string and then flattens it, very slow in debug mode. 'regress/regress-752764': [PASS, ['mode == debug', SLOW]], - # https://crbug.com/v8/7682 - 'regress/regress-v8-7682': [FAIL], - # https://crbug.com/v8/7697 'array-literal-feedback': [PASS, FAIL], # https://crbug.com/v8/7775 'allocation-site-info': [SKIP], + + # BUG(v8:8169) + 'external-backing-store-gc': [SKIP], }], # ALWAYS ['novfp3 == True', { @@ -277,7 +278,6 @@ # TODO(mstarzinger): Takes too long with TF. 'array-sort': [PASS, NO_VARIANTS], - 'lexicographic-compare': [PASS, NO_VARIANTS], 'regress/regress-91008': [PASS, NO_VARIANTS], 'regress/regress-transcendental': [PASS, ['arch == arm64', NO_VARIANTS]], 'compiler/osr-regress-max-locals': [PASS, NO_VARIANTS], @@ -320,9 +320,6 @@ 'asm/sqlite3/*': [SKIP], # TODO(mips-team): Fix Wasm for big-endian. 'wasm/*': [SKIP], - # TODO(mips-team): Fix SEGV on regress-864509.js on big endian - # (https://crbug.com/v8/7953). - 'regress/wasm/regress-864509': [SKIP], }], # 'byteorder == big' ############################################################################## @@ -370,12 +367,10 @@ 'compiler/osr-with-args': [PASS, SLOW], 'generated-transition-stub': [PASS, SLOW], 'json2': [PASS, SLOW], - 'lexicographic-compare': [PASS, SLOW], 'math-floor-of-div-nosudiv': [PASS, SLOW], 'math-floor-of-div': [PASS, SLOW], 'messages': [PASS, SLOW], 'packed-elements': [PASS, SLOW], - 'regress/regress-2185': [PASS, SLOW], 'regress/regress-2790': [PASS, SLOW], 'regress/regress-331444': [PASS, SLOW], 'regress/regress-490': [PASS, SLOW], @@ -397,7 +392,6 @@ # Pass but take too long with the simulator in debug mode. 'array-sort': [PASS, SLOW], - 'lexicographic-compare': [PASS, SLOW], 'packed-elements': [SKIP], 'regexp-global': [SKIP], 'math-floor-of-div': [PASS, SLOW], @@ -466,6 +460,9 @@ # BUG(v8:7042). Uses a lot of memory. 'regress/regress-678917': [SKIP], + # BUG(v8:8103). Uses a lot of memory. + 'regress/regress-852258': [SKIP], + # BUG(v8:6924). The test uses a lot of memory. 'regress/wasm/regress-694433': [SKIP], 'es6/typedarray': [PASS, NO_VARIANTS], @@ -506,7 +503,6 @@ # Slow tests. 'array-sort': [PASS, SLOW], 'compiler/osr-with-args': [PASS, SLOW], - 'lexicographic-compare': [PASS, SLOW], 'packed-elements': [PASS, SLOW], 'regress/regress-2790': [PASS, SLOW], 'regress/regress-91008': [PASS, SLOW], @@ -651,6 +647,8 @@ 'regress/regress-748069': [FAIL], 'regress/regress-752764': [FAIL], 'regress/regress-779407': [FAIL], + # Flaky OOM: + 'regress/regress-852258': [SKIP], }], # 'system == android' ############################################################################## @@ -660,6 +658,13 @@ }], # 'system == macos' ############################################################################## +['isolates', { + # Slow tests. + 'es6/typedarray-of': [PASS, SLOW], + 'regress/regress-crbug-854299': [PASS, SLOW], +}], # 'isolates' + +############################################################################## ['deopt_fuzzer == True', { # Skip tests that are not suitable for deoptimization fuzzing. @@ -708,6 +713,7 @@ 'keyed-load-with-symbol-key': [PASS, FAIL], 'object-seal': [PASS, FAIL], 'regress/regress-3709': [PASS, FAIL], + 'regress/regress-6948': [PASS, FAIL], 'regress/regress-7510': [PASS, FAIL], 'regress/regress-trap-allocation-memento': [PASS, FAIL], 'regress/regress-unlink-closures-on-deopt': [PASS, FAIL], @@ -792,26 +798,32 @@ # Slow on arm64 simulator: https://crbug.com/v8/7783 'string-replace-gc': [PASS, ['arch == arm64 and simulator_run', SKIP]], + + # Too memory hungry on Odroid devices. + 'regress/regress-678917': [PASS, ['arch == arm and not simulator_run', SKIP]], + + # https://crbug.com/v8/8164 + 'wasm/compare-exchange-stress': [SKIP], }], # variant == stress ############################################################################## +['variant == stress and (arch == arm or arch == arm64) and simulator_run', { + # Slow tests: https://crbug.com/v8/7783 + 'generated-transition-stub': [SKIP], + 'wasm/grow-memory': [SKIP], +}], # variant == stress and (arch == arm or arch == arm64) and simulator_run + +############################################################################## ['variant == nooptimization and (arch == arm or arch == arm64) and simulator_run', { # Slow tests: https://crbug.com/v8/7783 - 'lexicographic-compare': [SKIP], 'md5': [SKIP], - 'regress/regress-2185': [SKIP], + 'packed-elements': [SKIP], 'wasm/asm-wasm-f32': [SKIP], 'wasm/asm-wasm-f64': [SKIP], 'wasm/grow-memory': [SKIP], }], # variant == nooptimization and (arch == arm or arch == arm64) and simulator_run ############################################################################## -['(arch == arm or arch == arm64) and simulator_run', { - # Slow tests: https://crbug.com/v8/7783 - 'regress/regress-2185': [SKIP], -}], # (arch == arm or arch == arm64) and simulator_run - -############################################################################## ['(arch == arm or arch == arm64)', { # Flaky tests: https://crbug.com/v8/8090 'regress/regress-752764': [SKIP], diff --git a/deps/v8/test/mjsunit/regress/regress-319722-ArrayBuffer.js b/deps/v8/test/mjsunit/regress/regress-319722-ArrayBuffer.js index 9a24fc5c7c..4a48a61ab3 100644 --- a/deps/v8/test/mjsunit/regress/regress-319722-ArrayBuffer.js +++ b/deps/v8/test/mjsunit/regress/regress-319722-ArrayBuffer.js @@ -26,7 +26,7 @@ // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. // Flags: --nostress-opt --allow-natives-syntax --mock-arraybuffer-allocator -var maxSize = %_MaxSmi() + 1; +var maxSize = %MaxSmi() + 1; var ab; // Allocate the largest ArrayBuffer we can on this architecture. diff --git a/deps/v8/test/mjsunit/regress/regress-319722-TypedArrays.js b/deps/v8/test/mjsunit/regress/regress-319722-TypedArrays.js index e497aecbe0..0445e2d2cf 100644 --- a/deps/v8/test/mjsunit/regress/regress-319722-TypedArrays.js +++ b/deps/v8/test/mjsunit/regress/regress-319722-TypedArrays.js @@ -27,7 +27,7 @@ // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. // Flags: --nostress-opt --allow-natives-syntax -var maxSize = %_MaxSmi() + 1; +var maxSize = %MaxSmi() + 1; function TestArray(constr) { assertThrows(function() { new constr(maxSize); diff --git a/deps/v8/test/mjsunit/regress/regress-3255.js b/deps/v8/test/mjsunit/regress/regress-3255.js index 0e77435374..0c5ee4ff00 100644 --- a/deps/v8/test/mjsunit/regress/regress-3255.js +++ b/deps/v8/test/mjsunit/regress/regress-3255.js @@ -16,4 +16,4 @@ f(str, 0); f(str, 0); // This is just to trigger elements validation, object already broken. -%SetProperty(str, 1, 'y', 0); +%SetKeyedProperty(str, 1, 'y', 0); diff --git a/deps/v8/test/mjsunit/regress/regress-4271.js b/deps/v8/test/mjsunit/regress/regress-4271.js index bc18771e72..5b724b01b6 100644 --- a/deps/v8/test/mjsunit/regress/regress-4271.js +++ b/deps/v8/test/mjsunit/regress/regress-4271.js @@ -17,7 +17,7 @@ if (this.Worker) { }); // Don't throw for real worker - var worker = new Worker(''); + var worker = new Worker('', {type: 'string'}); worker.getMessage(); worker.postMessage({}); worker.terminate(); diff --git a/deps/v8/test/mjsunit/regress/regress-4279.js b/deps/v8/test/mjsunit/regress/regress-4279.js index 64ef967d89..ddc272793e 100644 --- a/deps/v8/test/mjsunit/regress/regress-4279.js +++ b/deps/v8/test/mjsunit/regress/regress-4279.js @@ -4,7 +4,7 @@ if (this.Worker && this.quit) { try { - new Function(new Worker("55")); + new Function(new Worker("55"), {type: 'string'}); } catch(err) {} quit(); diff --git a/deps/v8/test/mjsunit/regress/regress-707066.js b/deps/v8/test/mjsunit/regress/regress-707066.js index b33b585ebd..b5d70c2e6b 100644 --- a/deps/v8/test/mjsunit/regress/regress-707066.js +++ b/deps/v8/test/mjsunit/regress/regress-707066.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-function-tostring - // There was a bug in CreateDynamicFunction where a stack overflow // situation caused an assertion failure. diff --git a/deps/v8/test/mjsunit/regress/regress-8133-1.js b/deps/v8/test/mjsunit/regress/regress-8133-1.js new file mode 100644 index 0000000000..8f3cc734a6 --- /dev/null +++ b/deps/v8/test/mjsunit/regress/regress-8133-1.js @@ -0,0 +1,16 @@ +// Copyright 2018 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 arr = [1, , 3]; + +function mapper(x) { + Array.prototype[1] = 2; + return x + 1; +} + +// This iterates over arr using the iterator protocol, which turns the hole into +// undefined. The mapper function then gets called in a separate iteration over +// the acquired elements, where it increments undefined, which produces NaN and +// gets converted to 0. +assertArrayEquals([2, 0, 4], Uint16Array.from(arr, mapper)); diff --git a/deps/v8/test/mjsunit/regress/regress-8133-2.js b/deps/v8/test/mjsunit/regress/regress-8133-2.js new file mode 100644 index 0000000000..e163e3c784 --- /dev/null +++ b/deps/v8/test/mjsunit/regress/regress-8133-2.js @@ -0,0 +1,17 @@ +// Copyright 2018 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 arr = [1, , 3]; + +function mapper(x) { + Array.prototype[1] = 2; + return x + 1; +} + +// We force a direct iteration (using the array length, not the iterator +// protocol). The mapper function gets called during this iteration, not in a +// separate one. Hence when index 1 is read, 2 is retrieved from the prototype +// and incremented to 3. +Array.prototype[Symbol.iterator] = undefined; +assertArrayEquals([2, 3, 4], Uint16Array.from(arr, mapper)); diff --git a/deps/v8/test/mjsunit/regress/regress-821368.js b/deps/v8/test/mjsunit/regress/regress-821368.js index b41261d7c9..8f8a01b3f7 100644 --- a/deps/v8/test/mjsunit/regress/regress-821368.js +++ b/deps/v8/test/mjsunit/regress/regress-821368.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. -const worker = new Worker("onmessage = function(){}"); +const worker = new Worker("onmessage = function(){}", {type: 'string'}); const buffer = new ArrayBuffer(); worker.postMessage(buffer, [buffer]); try { diff --git a/deps/v8/test/mjsunit/regress/regress-8237.js b/deps/v8/test/mjsunit/regress/regress-8237.js new file mode 100644 index 0000000000..c3abd17e8a --- /dev/null +++ b/deps/v8/test/mjsunit/regress/regress-8237.js @@ -0,0 +1,57 @@ +// Copyright 2018 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 +// Files: test/mjsunit/code-coverage-utils.js + +%DebugToggleBlockCoverage(true); + +TestCoverage( +"Repro for the bug", +` +function lib (n) { // 0000 + if (n >= 0) { // 0050 + if (n < 0) { // 0100 + return; // 0150 + } // 0200 + } else if (foo()) { // 0250 + } // 0300 +} // 0350 +function foo () { // 0400 + console.log('foo') // 0450 + return false // 0500 +} // 0550 +lib(1) // 0600 +`, +[{"start":0,"end":649,"count":1}, +{"start":0,"end":351,"count":1}, +{"start":115,"end":205,"count":0}, +{"start":253,"end":303,"count":0}, +{"start":400,"end":551,"count":0}] +); + +TestCoverage( +"Variant with omitted brackets", +` +function lib (n) { // 0000 + if (n >= 0) { // 0050 + if (n < 0) // 0100 + return; // 0150 + } // 0200 + else if (foo()); // 0250 +} // 0300 +function foo () { // 0350 + console.log('foo') // 0400 + return false // 0450 +} // 0500 +lib(1) // 0550 +`, +[{"start":0,"end":599,"count":1}, +{"start":0,"end":301,"count":1}, +{"start":156,"end":163,"count":0}, +{"start":203,"end":268,"count":0}, +{"start":350,"end":501,"count":0}] +); + +%DebugToggleBlockCoverage(false); diff --git a/deps/v8/test/mjsunit/regress/regress-8265.js b/deps/v8/test/mjsunit/regress/regress-8265.js new file mode 100644 index 0000000000..ffe6191c9f --- /dev/null +++ b/deps/v8/test/mjsunit/regress/regress-8265.js @@ -0,0 +1,12 @@ +// Copyright 2018 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: --random-seed=1 + +for (let i = 0; i < 54; ++i) Math.random(); +let sum = 0; +for (let i = 0; i < 10; ++i) + sum += Math.floor(Math.random() * 50); + +assertNotEquals(0, sum); diff --git a/deps/v8/test/mjsunit/regress/regress-8449.js b/deps/v8/test/mjsunit/regress/regress-8449.js new file mode 100644 index 0000000000..32fa82aa6e --- /dev/null +++ b/deps/v8/test/mjsunit/regress/regress-8449.js @@ -0,0 +1,25 @@ +// Copyright 2018 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 x = [, 1]; + x.__proto__ = [42]; + const y = [...x]; + assertEquals([42, 1], y); + assertTrue(y.hasOwnProperty(0)); +} + +{ + const x = [, 1]; + x.__proto__ = [42]; + assertEquals(42, x[Symbol.iterator]().next().value); +} + +{ + const array_prototype = [].__proto__; + array_prototype[0] = 42; + const x = [, 1]; + assertEquals(42, x[Symbol.iterator]().next().value); + delete array_prototype[0]; +} diff --git a/deps/v8/test/mjsunit/regress/regress-883059.js b/deps/v8/test/mjsunit/regress/regress-883059.js new file mode 100644 index 0000000000..ed70feddb4 --- /dev/null +++ b/deps/v8/test/mjsunit/regress/regress-883059.js @@ -0,0 +1,7 @@ +// Copyright 2018 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: --random-seed=-1595876594 --disable-in-process-stack-traces --no-lazy + +var __v_47 = ({[__v_46]: __f_52}) => { var __v_46 = 'b'; return __f_52; }; diff --git a/deps/v8/test/mjsunit/regress/regress-889722.js b/deps/v8/test/mjsunit/regress/regress-889722.js new file mode 100644 index 0000000000..c883dbe489 --- /dev/null +++ b/deps/v8/test/mjsunit/regress/regress-889722.js @@ -0,0 +1,11 @@ +// Copyright 2018 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 getRandomProperty(v, rand) { + var properties = Object.getOwnPropertyNames(v); + return properties[rand % properties.length]; +} +r = Realm.create(); +o = Realm.eval(r, "() => { return Realm.global(-10) instanceof Object }"); +o.__p_211203344 = o[getRandomProperty(o, 211203344)]; diff --git a/deps/v8/test/mjsunit/regress/regress-890553.js b/deps/v8/test/mjsunit/regress/regress-890553.js new file mode 100644 index 0000000000..33f13e8f26 --- /dev/null +++ b/deps/v8/test/mjsunit/regress/regress-890553.js @@ -0,0 +1,11 @@ +// Copyright 2018 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. + +"use strict"; +var s = "function __f_9(func, testName) {" + + "var __v_0 = function __f_10(__v_14, __v_14) {" + + " return __v_16;" + + "}; " + +"}" +assertThrows(function() { eval(s); }); diff --git a/deps/v8/test/mjsunit/regress/regress-2185.js b/deps/v8/test/mjsunit/regress/regress-892858.js index 9b91066f33..ec921e3d43 100644 --- a/deps/v8/test/mjsunit/regress/regress-2185.js +++ b/deps/v8/test/mjsunit/regress/regress-892858.js @@ -1,4 +1,4 @@ -// Copyright 2012 the V8 project authors. All rights reserved. +// Copyright 2018 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: @@ -25,14 +25,8 @@ // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// Flags: --noenable-slow-asserts - -var a = []; - -for (var i = 0; i < 2; i++) { - for (var j = 0; j < 30000; j++) { - a.push(j); - } +async function foo() { + await Promise.resolve(42); } -a.sort(function(a, b) { return a - b; } ); +foo(); diff --git a/deps/v8/test/mjsunit/regress/regress-arrow-single-expression-eval.js b/deps/v8/test/mjsunit/regress/regress-arrow-single-expression-eval.js new file mode 100644 index 0000000000..83a9ca1a56 --- /dev/null +++ b/deps/v8/test/mjsunit/regress/regress-arrow-single-expression-eval.js @@ -0,0 +1,5 @@ +// Copyright 2018 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. + +((x=1) => eval("var x = 10"))(); diff --git a/deps/v8/test/mjsunit/regress/regress-crbug-380671.js b/deps/v8/test/mjsunit/regress/regress-crbug-380671.js deleted file mode 100644 index e2909e0a43..0000000000 --- a/deps/v8/test/mjsunit/regress/regress-crbug-380671.js +++ /dev/null @@ -1,14 +0,0 @@ -// Copyright 2015 the V8 project authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -// Flags: --mock-arraybuffer-allocator --expose-gc - -var buffer = new ArrayBuffer(0xc0000000); -assertEquals(0xc0000000, buffer.byteLength); -// We call the GC here to free up the large array buffer. Otherwise, the -// mock allocator would allow us to allocate more than the physical memory -// available on 32bit platforms, leaving the internal counters in an invalid -// state. -buffer = null; -gc(); diff --git a/deps/v8/test/mjsunit/regress/regress-crbug-503578.js b/deps/v8/test/mjsunit/regress/regress-crbug-503578.js index 1274d91ffe..59c33da20e 100644 --- a/deps/v8/test/mjsunit/regress/regress-crbug-503578.js +++ b/deps/v8/test/mjsunit/regress/regress-crbug-503578.js @@ -8,7 +8,7 @@ if (this.Worker) { var __v_5 = new Uint32Array(__v_1); return __v_5; } - var __v_6 = new Worker('onmessage = function() {}'); + var __v_6 = new Worker('onmessage = function() {}', {type: 'string'}); var __v_3 = __f_0(16); __v_6.postMessage(__v_3); } diff --git a/deps/v8/test/mjsunit/regress/regress-crbug-503698.js b/deps/v8/test/mjsunit/regress/regress-crbug-503698.js index 415d1bc81b..c817bede29 100644 --- a/deps/v8/test/mjsunit/regress/regress-crbug-503698.js +++ b/deps/v8/test/mjsunit/regress/regress-crbug-503698.js @@ -5,5 +5,5 @@ // Flags: --invoke-weak-callbacks if (this.Worker) { - var __v_6 = new Worker(''); + var __v_6 = new Worker('', {type: 'string'}); } diff --git a/deps/v8/test/mjsunit/regress/regress-crbug-503968.js b/deps/v8/test/mjsunit/regress/regress-crbug-503968.js index 78d1c7b98a..0552163144 100644 --- a/deps/v8/test/mjsunit/regress/regress-crbug-503968.js +++ b/deps/v8/test/mjsunit/regress/regress-crbug-503968.js @@ -8,6 +8,6 @@ if (this.Worker) { this.l = [new __f_0, new __f_0]; } __v_6 = new __f_1; - var __v_9 = new Worker(''); + var __v_9 = new Worker('', {type: 'string'}); __v_9.postMessage(__v_6); } diff --git a/deps/v8/test/mjsunit/regress/regress-crbug-503991.js b/deps/v8/test/mjsunit/regress/regress-crbug-503991.js index 6a3b0de759..7b96e92677 100644 --- a/deps/v8/test/mjsunit/regress/regress-crbug-503991.js +++ b/deps/v8/test/mjsunit/regress/regress-crbug-503991.js @@ -4,6 +4,6 @@ if (this.Worker) { __v_3 = ""; - var __v_6 = new Worker(''); + var __v_6 = new Worker('', {type: 'string'}); __v_6.postMessage(__v_3); } diff --git a/deps/v8/test/mjsunit/regress/regress-crbug-504136.js b/deps/v8/test/mjsunit/regress/regress-crbug-504136.js index 4ed6843544..25b11e0fec 100644 --- a/deps/v8/test/mjsunit/regress/regress-crbug-504136.js +++ b/deps/v8/test/mjsunit/regress/regress-crbug-504136.js @@ -3,7 +3,7 @@ // found in the LICENSE file. if (this.Worker) { - var __v_10 = new Worker(''); + var __v_10 = new Worker('', {type: 'string'}); __v_10.terminate(); __v_10.getMessage(); } diff --git a/deps/v8/test/mjsunit/regress/regress-crbug-504727.js b/deps/v8/test/mjsunit/regress/regress-crbug-504727.js index 16d8ff16cd..a295a1bd35 100644 --- a/deps/v8/test/mjsunit/regress/regress-crbug-504727.js +++ b/deps/v8/test/mjsunit/regress/regress-crbug-504727.js @@ -5,5 +5,5 @@ // Flags: --no-test if (this.Worker) { - var __v_2 = new Worker(''); + var __v_2 = new Worker('', {type: 'string'}); } diff --git a/deps/v8/test/mjsunit/regress/regress-crbug-504729.js b/deps/v8/test/mjsunit/regress/regress-crbug-504729.js index 435cafee87..8b1f8b0899 100644 --- a/deps/v8/test/mjsunit/regress/regress-crbug-504729.js +++ b/deps/v8/test/mjsunit/regress/regress-crbug-504729.js @@ -5,5 +5,5 @@ if (this.Worker) { Function.prototype.toString = "foo"; function __f_7() {} - assertThrows(function() { var __v_5 = new Worker(__f_7.toString()); }); + assertThrows(function() { var __v_5 = new Worker(__f_7.toString(), {type: 'string'}) }); } diff --git a/deps/v8/test/mjsunit/regress/regress-crbug-505778.js b/deps/v8/test/mjsunit/regress/regress-crbug-505778.js index 74d96ab094..3d87ba6982 100644 --- a/deps/v8/test/mjsunit/regress/regress-crbug-505778.js +++ b/deps/v8/test/mjsunit/regress/regress-crbug-505778.js @@ -3,6 +3,6 @@ // found in the LICENSE file. if (this.Worker) { - var __v_7 = new Worker('onmessage = function() {}'); + var __v_7 = new Worker('onmessage = function() {}', {type: 'string'}); __v_7.postMessage(""); } diff --git a/deps/v8/test/mjsunit/regress/regress-crbug-506549.js b/deps/v8/test/mjsunit/regress/regress-crbug-506549.js index 40e162caf5..219fd10cb7 100644 --- a/deps/v8/test/mjsunit/regress/regress-crbug-506549.js +++ b/deps/v8/test/mjsunit/regress/regress-crbug-506549.js @@ -5,6 +5,6 @@ if (this.Worker) { var __v_5 = {}; __v_5.__defineGetter__('byteLength', function() {foo();}); - var __v_8 = new Worker('onmessage = function() {};'); + var __v_8 = new Worker('onmessage = function() {};', {type: 'string'}); assertThrows(function() { __v_8.postMessage(__v_5); }); } diff --git a/deps/v8/test/mjsunit/regress/regress-crbug-511880.js b/deps/v8/test/mjsunit/regress/regress-crbug-511880.js index f9b05ff7bc..5dceb2a733 100644 --- a/deps/v8/test/mjsunit/regress/regress-crbug-511880.js +++ b/deps/v8/test/mjsunit/regress/regress-crbug-511880.js @@ -4,10 +4,10 @@ if (this.Worker) { var __v_8 = - `var __v_9 = new Worker('postMessage(42)'); + `var __v_9 = new Worker('postMessage(42)', {type: 'string'}); onmessage = function(parentMsg) { __v_9.postMessage(parentMsg); };`; - var __v_9 = new Worker(__v_8); + var __v_9 = new Worker(__v_8, {type: 'string'}); __v_9.postMessage(9); } diff --git a/deps/v8/test/mjsunit/regress/regress-crbug-514081.js b/deps/v8/test/mjsunit/regress/regress-crbug-514081.js index ee3ed81300..3d99b4586b 100644 --- a/deps/v8/test/mjsunit/regress/regress-crbug-514081.js +++ b/deps/v8/test/mjsunit/regress/regress-crbug-514081.js @@ -3,7 +3,7 @@ // found in the LICENSE file. if (this.Worker) { - var __v_7 = new Worker('onmessage = function() {};'); + var __v_7 = new Worker('onmessage = function() {};', {type: 'string'}); var e; var ab = new ArrayBuffer(2 * 1000 * 1000); try { diff --git a/deps/v8/test/mjsunit/regress/regress-crbug-518747.js b/deps/v8/test/mjsunit/regress/regress-crbug-518747.js index f1787c4c4b..2a4058d401 100644 --- a/deps/v8/test/mjsunit/regress/regress-crbug-518747.js +++ b/deps/v8/test/mjsunit/regress/regress-crbug-518747.js @@ -4,6 +4,6 @@ if (this.Worker) { Worker.prototype = 12; - var __v_6 = new Worker(''); + var __v_6 = new Worker('', {type: 'string'}); __v_6.postMessage([]); } diff --git a/deps/v8/test/mjsunit/regress/regress-crbug-522496.js b/deps/v8/test/mjsunit/regress/regress-crbug-522496.js index e47e0a0677..4dea5a89ac 100644 --- a/deps/v8/test/mjsunit/regress/regress-crbug-522496.js +++ b/deps/v8/test/mjsunit/regress/regress-crbug-522496.js @@ -3,7 +3,7 @@ // found in the LICENSE file. if (this.Worker) { - var worker = new Worker("onmessage = function(){}"); + var worker = new Worker("onmessage = function(){}", {type: 'string'}); var buf = new ArrayBuffer(); worker.postMessage(buf, [buf]); } diff --git a/deps/v8/test/mjsunit/regress/regress-crbug-687063.js b/deps/v8/test/mjsunit/regress/regress-crbug-687063.js new file mode 100644 index 0000000000..8c579331fb --- /dev/null +++ b/deps/v8/test/mjsunit/regress/regress-crbug-687063.js @@ -0,0 +1,31 @@ +// Copyright 2018 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 + +// Collect the actual properties looked up on the Proxy. +const actual = []; + +// Perform a relational comparison with a Proxy on the right hand +// side and a Symbol which cannot be turned into a Number on the +// left hand side. +function foo() { + actual.length = 0; + const lhs = Symbol(); + const rhs = new Proxy({}, { + get: function(target, property, receiver) { + actual.push(property); + return undefined; + } + }); + return lhs < rhs; +} + +assertThrows(foo, TypeError); +assertEquals([Symbol.toPrimitive, 'valueOf', 'toString'], actual); +assertThrows(foo, TypeError); +assertEquals([Symbol.toPrimitive, 'valueOf', 'toString'], actual); +%OptimizeFunctionOnNextCall(foo); +assertThrows(foo, TypeError); +assertEquals([Symbol.toPrimitive, 'valueOf', 'toString'], actual); diff --git a/deps/v8/test/mjsunit/regress/regress-crbug-722871.js b/deps/v8/test/mjsunit/regress/regress-crbug-722871.js index c5b7958f49..e71f083be6 100644 --- a/deps/v8/test/mjsunit/regress/regress-crbug-722871.js +++ b/deps/v8/test/mjsunit/regress/regress-crbug-722871.js @@ -7,7 +7,7 @@ let workers = []; let runningWorkers = 0; function startWorker(script) { - let worker = new Worker(script); + let worker = new Worker(script, {type: 'string'}); worker.done = false; worker.idx = workers.length; workers.push(worker); diff --git a/deps/v8/test/mjsunit/regress/regress-crbug-876443.js b/deps/v8/test/mjsunit/regress/regress-crbug-876443.js new file mode 100644 index 0000000000..33ffa020f3 --- /dev/null +++ b/deps/v8/test/mjsunit/regress/regress-crbug-876443.js @@ -0,0 +1,9 @@ +// Copyright 2018 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: + +var a = [5.65]; +a.splice(0); +var b = a.splice(-4, 9, 10); diff --git a/deps/v8/test/mjsunit/regress/regress-crbug-878845.js b/deps/v8/test/mjsunit/regress/regress-crbug-878845.js new file mode 100644 index 0000000000..2913f9e849 --- /dev/null +++ b/deps/v8/test/mjsunit/regress/regress-crbug-878845.js @@ -0,0 +1,11 @@ +// Copyright 2018 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 arr = [, 0.1]; + +Array.prototype.lastIndexOf.call(arr, 100, { + valueOf() { + arr.length = 0; + } +}); diff --git a/deps/v8/test/mjsunit/regress/regress-crbug-879560.js b/deps/v8/test/mjsunit/regress/regress-crbug-879560.js new file mode 100644 index 0000000000..a17deadfcd --- /dev/null +++ b/deps/v8/test/mjsunit/regress/regress-crbug-879560.js @@ -0,0 +1,14 @@ +// Copyright 2018 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 foo() { + var x = 1; + x = undefined; + while (x--) ; +} +foo(); +%OptimizeFunctionOnNextCall(foo); +foo(); diff --git a/deps/v8/test/mjsunit/regress/regress-crbug-879898.js b/deps/v8/test/mjsunit/regress/regress-crbug-879898.js new file mode 100644 index 0000000000..c97001ae5c --- /dev/null +++ b/deps/v8/test/mjsunit/regress/regress-crbug-879898.js @@ -0,0 +1,12 @@ +// Copyright 2018 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 foo() { + return Symbol.toPrimitive++; +} +assertThrows(foo); +%OptimizeFunctionOnNextCall(foo); +assertThrows(foo); diff --git a/deps/v8/test/mjsunit/regress/regress-crbug-880207.js b/deps/v8/test/mjsunit/regress/regress-crbug-880207.js new file mode 100644 index 0000000000..09796a9ff4 --- /dev/null +++ b/deps/v8/test/mjsunit/regress/regress-crbug-880207.js @@ -0,0 +1,37 @@ +// Copyright 2018 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 TestOptimizedFastExpm1MinusZero() { + function foo() { + return Object.is(Math.expm1(-0), -0); + } + + assertTrue(foo()); + %OptimizeFunctionOnNextCall(foo); + assertTrue(foo()); +})(); + +(function TestOptimizedExpm1MinusZeroSlowPath() { + function f(x) { + return Object.is(Math.expm1(x), -0); + } + + function g() { + return f(-0); + } + + f(0); + // Compile function optimistically for numbers (with fast inlined + // path for Math.expm1). + %OptimizeFunctionOnNextCall(f); + // Invalidate the optimistic assumption, deopting and marking non-number + // input feedback in the call IC. + f("0"); + // Optimize again, now with non-lowered call to Math.expm1. + assertTrue(g()); + %OptimizeFunctionOnNextCall(g); + assertTrue(g()); +})(); diff --git a/deps/v8/test/mjsunit/regress/regress-crbug-882233-1.js b/deps/v8/test/mjsunit/regress/regress-crbug-882233-1.js new file mode 100644 index 0000000000..197660a683 --- /dev/null +++ b/deps/v8/test/mjsunit/regress/regress-crbug-882233-1.js @@ -0,0 +1,17 @@ +// Copyright 2018 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. + +// Intended to test bug [882233] on CSA fast-path. + +let array = []; +Object.defineProperty(array, 'length', {writable: false}); + +assertEquals(array.length, 0); +assertThrows(() => array.shift(), TypeError); + +let object = { length: 0 }; +Object.defineProperty(object, 'length', {writable: false}); + +assertEquals(object.length, 0); +assertThrows(() => Array.prototype.shift.call(object)); diff --git a/deps/v8/test/mjsunit/regress/regress-crbug-882233-2.js b/deps/v8/test/mjsunit/regress/regress-crbug-882233-2.js new file mode 100644 index 0000000000..565e5fbc23 --- /dev/null +++ b/deps/v8/test/mjsunit/regress/regress-crbug-882233-2.js @@ -0,0 +1,32 @@ +// Copyright 2018 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 --opt + +// Intended to test bug [882233] on TF inlined (js-call-reducer) path. + +function shift_array() { + let array = []; + Object.defineProperty(array, 'length', {writable : false}); + return array.shift(); +} + +assertThrows(shift_array); +assertThrows(shift_array); +%OptimizeFunctionOnNextCall(shift_array); +assertThrows(shift_array); +assertOptimized(shift_array); + + +function shift_object() { + let object = { length: 0 }; + Object.defineProperty(object, 'length', {writable : false}); + return object.shift(); +} + +assertThrows(shift_object); +assertThrows(shift_object); +%OptimizeFunctionOnNextCall(shift_object); +assertThrows(shift_object); +assertOptimized(shift_object); diff --git a/deps/v8/test/mjsunit/regress/regress-crbug-884933.js b/deps/v8/test/mjsunit/regress/regress-crbug-884933.js new file mode 100644 index 0000000000..447d303bbf --- /dev/null +++ b/deps/v8/test/mjsunit/regress/regress-crbug-884933.js @@ -0,0 +1,85 @@ +// Copyright 2018 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 + +// Test Uint8 -> Word64 conversions. +(function() { + function bar(x, y) { + return x + y; + } + + bar(0.1, 0.2); + bar(0.1, 0.2); + + function foo(dv) { + return bar(dv.getUint8(0, true), 0xFFFFFFFF); + } + + const dv = new DataView(new ArrayBuffer(8)); + assertEquals(0xFFFFFFFF, foo(dv)); + assertEquals(0xFFFFFFFF, foo(dv)); + %OptimizeFunctionOnNextCall(foo); + assertEquals(0xFFFFFFFF, foo(dv)); +})(); + +// Test Int8 -> Word64 conversions. +(function() { + function bar(x, y) { + return x + y; + } + + bar(0.1, 0.2); + bar(0.1, 0.2); + + function foo(dv) { + return bar(dv.getInt8(0, true), 0xFFFFFFFF); + } + + const dv = new DataView(new ArrayBuffer(8)); + assertEquals(0xFFFFFFFF, foo(dv)); + assertEquals(0xFFFFFFFF, foo(dv)); + %OptimizeFunctionOnNextCall(foo); + assertEquals(0xFFFFFFFF, foo(dv)); +})(); + +// Test Uint16 -> Word64 conversions. +(function() { + function bar(x, y) { + return x + y; + } + + bar(0.1, 0.2); + bar(0.1, 0.2); + + function foo(dv) { + return bar(dv.getUint16(0, true), 0xFFFFFFFF); + } + + const dv = new DataView(new ArrayBuffer(8)); + assertEquals(0xFFFFFFFF, foo(dv)); + assertEquals(0xFFFFFFFF, foo(dv)); + %OptimizeFunctionOnNextCall(foo); + assertEquals(0xFFFFFFFF, foo(dv)); +})(); + +// Test Int16 -> Word64 conversions. +(function() { + function bar(x, y) { + return x + y; + } + + bar(0.1, 0.2); + bar(0.1, 0.2); + + function foo(dv) { + return bar(dv.getInt16(0, true), 0xFFFFFFFF); + } + + const dv = new DataView(new ArrayBuffer(8)); + assertEquals(0xFFFFFFFF, foo(dv)); + assertEquals(0xFFFFFFFF, foo(dv)); + %OptimizeFunctionOnNextCall(foo); + assertEquals(0xFFFFFFFF, foo(dv)); +})(); diff --git a/deps/v8/test/mjsunit/regress/regress-crbug-885404.js b/deps/v8/test/mjsunit/regress/regress-crbug-885404.js new file mode 100644 index 0000000000..534b883a01 --- /dev/null +++ b/deps/v8/test/mjsunit/regress/regress-crbug-885404.js @@ -0,0 +1,11 @@ +// Copyright 2018 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: --verify-heap --expose-gc + +var ab = new ArrayBuffer(2); +try { new Int32Array(ab); } catch (e) { } +assertEquals(2, ab.byteLength); +gc(); +assertEquals(2, ab.byteLength); diff --git a/deps/v8/test/mjsunit/regress/regress-crbug-887891.js b/deps/v8/test/mjsunit/regress/regress-crbug-887891.js new file mode 100644 index 0000000000..0e72ab263a --- /dev/null +++ b/deps/v8/test/mjsunit/regress/regress-crbug-887891.js @@ -0,0 +1,10 @@ +// Copyright 2018 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 --verify-heap + +const l = 1000000000; +const a = []; +function foo() { var x = new Int32Array(l); } +try { foo(); } catch (e) { } diff --git a/deps/v8/test/mjsunit/regress/regress-crbug-888825.js b/deps/v8/test/mjsunit/regress/regress-crbug-888825.js new file mode 100644 index 0000000000..9aa52d62e1 --- /dev/null +++ b/deps/v8/test/mjsunit/regress/regress-crbug-888825.js @@ -0,0 +1,5 @@ +// Copyright 2018 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. + +eval("((a=function g() { function g() {}}) => {})();"); diff --git a/deps/v8/test/mjsunit/regress/regress-crbug-890243.js b/deps/v8/test/mjsunit/regress/regress-crbug-890243.js new file mode 100644 index 0000000000..0d889b2787 --- /dev/null +++ b/deps/v8/test/mjsunit/regress/regress-crbug-890243.js @@ -0,0 +1,27 @@ +// Copyright 2018 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 + +// We need a SpeculativeNumberAdd with Number feedback. +function bar(x) { return x + x; } +bar(0.1); + +// We also need an indirection via an object field such +// that only after escape analysis TurboFan can figure +// out that the value `y` is actually a Number in the +// safe integer range. +function baz(y) { return {y}; } +baz(null); baz(0); + +// Now we can put all of that together to get a kRepBit +// use of a kWord64 value (on 64-bit architectures). +function foo(o) { + return !baz(bar(o.x)).y; +} + +assertFalse(foo({x:1})); +assertFalse(foo({x:1})); +%OptimizeFunctionOnNextCall(foo); +assertFalse(foo({x:1})); diff --git a/deps/v8/test/mjsunit/regress/regress-crbug-891627.js b/deps/v8/test/mjsunit/regress/regress-crbug-891627.js new file mode 100644 index 0000000000..afe4093c96 --- /dev/null +++ b/deps/v8/test/mjsunit/regress/regress-crbug-891627.js @@ -0,0 +1,43 @@ +// Copyright 2018 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 + +// We need a NumberModulus, so we make sure that we have a +// SpeculativeNumberModulus with Number feedback, and later +// on use it with known Number inputs (via the bitwise or), +// such that JSTypedLowering turns it into the NumberModulus. +function bar(x) { return x % 2; } +bar(0.1); + +// Check that the Word32->Float64 conversion works properly. +(function() { + function foo(x) { + // The NumberEqual identifies 0 and -0. + return bar(x | -1) == 4294967295; + } + + assertFalse(foo(1)); + assertFalse(foo(0)); + %OptimizeFunctionOnNextCall(foo); + assertFalse(foo(1)); + assertFalse(foo(0)); +})(); + +// Check that the Word32->Word32 conversion works properly. +(function() { + function makeFoo(y) { + return function foo(x) { + return bar(x | -1) == y; + } + } + makeFoo(0); // Defeat the function context specialization. + const foo = makeFoo(1); + + assertFalse(foo(1)); + assertFalse(foo(0)); + %OptimizeFunctionOnNextCall(foo); + assertFalse(foo(1)); + assertFalse(foo(0)); +})(); diff --git a/deps/v8/test/mjsunit/regress/regress-crbug-892472-1.js b/deps/v8/test/mjsunit/regress/regress-crbug-892472-1.js new file mode 100644 index 0000000000..d6332fd399 --- /dev/null +++ b/deps/v8/test/mjsunit/regress/regress-crbug-892472-1.js @@ -0,0 +1,9 @@ +// Copyright 2018 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: --async-stack-traces + +const a = /x/; +a.exec = RegExp.prototype.test; +assertThrows(() => RegExp.prototype.test.call(a)); diff --git a/deps/v8/test/mjsunit/regress/regress-crbug-892472-2.js b/deps/v8/test/mjsunit/regress/regress-crbug-892472-2.js new file mode 100644 index 0000000000..0f9a2c1816 --- /dev/null +++ b/deps/v8/test/mjsunit/regress/regress-crbug-892472-2.js @@ -0,0 +1,7 @@ +// Copyright 2018 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: --async-stack-traces + +assertThrows(_ => '' + {toString: Object.prototype.toLocaleString}); diff --git a/deps/v8/test/mjsunit/regress/regress-crbug-897514.js b/deps/v8/test/mjsunit/regress/regress-crbug-897514.js new file mode 100644 index 0000000000..822a6bcf5e --- /dev/null +++ b/deps/v8/test/mjsunit/regress/regress-crbug-897514.js @@ -0,0 +1,26 @@ +// Copyright 2018 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 + +// Create transtion => 'get a'. +let o = {}; +Object.defineProperty(o, 'a', { + enumerable: true, + configurable: true, + get: function() { return 7 } +}); + +function spread(o) { + let result = { ...o }; + %HeapObjectVerify(result); + return result; +} + +for (let i = 0; i<3; i++) { + spread([]); + // Use different transition => 'a'. + spread({ a:0 }); + spread("abc"); +} diff --git a/deps/v8/test/mjsunit/regress/regress-crbug-899524.js b/deps/v8/test/mjsunit/regress/regress-crbug-899524.js new file mode 100644 index 0000000000..32d28c9b09 --- /dev/null +++ b/deps/v8/test/mjsunit/regress/regress-crbug-899524.js @@ -0,0 +1,33 @@ +// Copyright 2018 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 empty() { } + +function baz(expected, found) { + var start = ""; + found.length, start + 'x'; + if (expected.length === found.length) { + for (var i = 0; i < expected.length; ++i) { + empty(found[i]); + } + } +} + +baz([1], new (class A extends Array {})); + +(function () { + "use strict"; + function bar() { + baz([1,2], arguments); + } + function foo() { + bar(2147483648,-[]); + } + foo(); + foo(); + %OptimizeFunctionOnNextCall(foo); + foo(); +})(); diff --git a/deps/v8/test/mjsunit/regress/regress-crbug-90771.js b/deps/v8/test/mjsunit/regress/regress-crbug-90771.js new file mode 100644 index 0000000000..b541ff8cc2 --- /dev/null +++ b/deps/v8/test/mjsunit/regress/regress-crbug-90771.js @@ -0,0 +1,15 @@ +// Copyright 2018 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 target() {}; + +for (let key of Object.getOwnPropertyNames(this)) { + try { + let newTarget = this[key]; + let arg = target; + Reflect.construct(target, arg, newTarget); + } catch {} +} diff --git a/deps/v8/test/mjsunit/regress/regress-v8-7682.js b/deps/v8/test/mjsunit/regress/regress-v8-7682.js index 4f9b2e7d60..86f12f5b74 100644 --- a/deps/v8/test/mjsunit/regress/regress-v8-7682.js +++ b/deps/v8/test/mjsunit/regress/regress-v8-7682.js @@ -18,5 +18,9 @@ class MyArrayLike { const xs = new MyArrayLike(); Array.prototype.sort.call(xs); -assertEquals(1, xs[0]); -assertEquals(2, xs[1]); +// Sort-order is implementation-defined as we actually hit two conditions from +// the spec: +// - "xs" is sparse and IsExtensible(xs) is false (its frozen). +// - "xs" is sparse and the prototype has properties in the sort range. +assertEquals(2, xs[0]); +assertEquals(1, xs[1]); diff --git a/deps/v8/test/mjsunit/regress/wasm/regress-801850.js b/deps/v8/test/mjsunit/regress/wasm/regress-801850.js index ad6ff4c432..b56af694a9 100644 --- a/deps/v8/test/mjsunit/regress/wasm/regress-801850.js +++ b/deps/v8/test/mjsunit/regress/wasm/regress-801850.js @@ -7,5 +7,5 @@ load('test/mjsunit/wasm/wasm-module-builder.js'); var builder = new WasmModuleBuilder(); let module = new WebAssembly.Module(builder.toBuffer()); -var worker = new Worker('onmessage = function() {};'); +var worker = new Worker('onmessage = function() {};', {type: 'string'}); worker.postMessage(module) diff --git a/deps/v8/test/mjsunit/regress/wasm/regress-803427.js b/deps/v8/test/mjsunit/regress/wasm/regress-803427.js index 833b140fd4..d3ab31b4c9 100644 --- a/deps/v8/test/mjsunit/regress/wasm/regress-803427.js +++ b/deps/v8/test/mjsunit/regress/wasm/regress-803427.js @@ -9,5 +9,5 @@ load('test/mjsunit/wasm/wasm-module-builder.js'); var builder = new WasmModuleBuilder(); let module = new WebAssembly.Module(builder.toBuffer()); -var worker = new Worker('onmessage = function() {};'); +var worker = new Worker('onmessage = function() {};', {type: 'string'}); worker.postMessage(module) diff --git a/deps/v8/test/mjsunit/regress/wasm/regress-8059.js b/deps/v8/test/mjsunit/regress/wasm/regress-8059.js index 5c421c4ee4..c30ed152f8 100644 --- a/deps/v8/test/mjsunit/regress/wasm/regress-8059.js +++ b/deps/v8/test/mjsunit/regress/wasm/regress-8059.js @@ -31,7 +31,7 @@ load("test/mjsunit/wasm/wasm-module-builder.js"); Realm.shared = { m:module, s:workerScript }; let realmScript = ` - let worker = new Worker(Realm.shared.s); + let worker = new Worker(Realm.shared.s, {type: 'string'}); worker.postMessage(Realm.shared.m); let message = worker.getMessage(); worker.terminate(); diff --git a/deps/v8/test/mjsunit/regress/wasm/regress-808012.js b/deps/v8/test/mjsunit/regress/wasm/regress-808012.js index 1b91f226a8..ae613ceb54 100644 --- a/deps/v8/test/mjsunit/regress/wasm/regress-808012.js +++ b/deps/v8/test/mjsunit/regress/wasm/regress-808012.js @@ -10,5 +10,5 @@ load('test/mjsunit/wasm/wasm-module-builder.js'); const builder = new WasmModuleBuilder(); builder.addFunction('test', kSig_i_i).addBody([kExprUnreachable]); let module = new WebAssembly.Module(builder.toBuffer()); -var worker = new Worker('onmessage = function() {};'); +var worker = new Worker('onmessage = function() {};', {type: 'string'}); worker.postMessage(module); diff --git a/deps/v8/test/mjsunit/regress/wasm/regress-808848.js b/deps/v8/test/mjsunit/regress/wasm/regress-808848.js index 69423b954d..bcf8469a14 100644 --- a/deps/v8/test/mjsunit/regress/wasm/regress-808848.js +++ b/deps/v8/test/mjsunit/regress/wasm/regress-808848.js @@ -60,7 +60,7 @@ let worker_onmessage = function(msg) { } let workerScript = "onmessage = " + worker_onmessage.toString(); -let worker = new Worker(workerScript); +let worker = new Worker(workerScript, {type: 'string'}); worker.postMessage({serialized_m1, m1_bytes}); // Wait for worker to finish. diff --git a/deps/v8/test/mjsunit/regress/wasm/regress-8094.js b/deps/v8/test/mjsunit/regress/wasm/regress-8094.js new file mode 100644 index 0000000000..a35d583a4a --- /dev/null +++ b/deps/v8/test/mjsunit/regress/wasm/regress-8094.js @@ -0,0 +1,30 @@ +// Copyright 2018 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-wasm --experimental-wasm-eh + +load("test/mjsunit/wasm/wasm-constants.js"); +load("test/mjsunit/wasm/wasm-module-builder.js"); + +// Instantiate a throwing module. +var builder = new WasmModuleBuilder(); +builder.addException(kSig_v_v); +builder.addFunction("propel", kSig_v_v) + .addBody([kExprThrow, 0]) + .exportFunc(); +var instance = builder.instantiate(); + +// Catch the exception. +var exception; +try { + instance.exports.propel(); +} catch (e) { + exception = e; +} + +// Check that the exception is an instance of the correct error function and +// that no extraneous properties exist. Setting such properties could be +// observable by JavaScript and could break compatibility. +assertInstanceof(exception, WebAssembly.RuntimeError); +assertArrayEquals(["stack", "message"], Object.getOwnPropertyNames(exception)); diff --git a/deps/v8/test/mjsunit/regress/wasm/regress-8095.js b/deps/v8/test/mjsunit/regress/wasm/regress-8095.js new file mode 100644 index 0000000000..66ffc0d4b7 --- /dev/null +++ b/deps/v8/test/mjsunit/regress/wasm/regress-8095.js @@ -0,0 +1,25 @@ +// Copyright 2018 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-wasm --experimental-wasm-eh + +load("test/mjsunit/wasm/wasm-constants.js"); +load("test/mjsunit/wasm/wasm-module-builder.js"); + +// Prepare a special error object to throw. +var error = new Error("my error"); +error.__proto__ = new Proxy(new Error(), { + has(target, property, receiver) { + assertUnreachable(); + } +}); + +// Throw it through a WebAssembly module. +var builder = new WasmModuleBuilder(); +builder.addImport('mod', 'fun', kSig_v_v); +builder.addFunction("funnel", kSig_v_v) + .addBody([kExprCallFunction, 0]) + .exportFunc(); +var instance = builder.instantiate({ mod: {fun: function() { throw error }}}); +assertThrows(instance.exports.funnel, Error); diff --git a/deps/v8/test/mjsunit/regress/wasm/regress-810973.js b/deps/v8/test/mjsunit/regress/wasm/regress-810973.js index 5a776884ee..bd3d902772 100644 --- a/deps/v8/test/mjsunit/regress/wasm/regress-810973.js +++ b/deps/v8/test/mjsunit/regress/wasm/regress-810973.js @@ -12,7 +12,7 @@ function MjsUnitAssertionError() { }; let __v_692 = `(function module() { "use asm";function foo(`; const __v_693 = -3695; +1005; for (let __v_695 = 0; __v_695 < __v_693; ++__v_695) { __v_692 += `arg${__v_695},`; } @@ -28,5 +28,6 @@ for (let __v_697 = 0; __v_697 < __v_693; ++__v_697) { } __v_692 += "1.0)|0;}"; - __v_692 += "return bar})()()"; +__v_692 += "return bar})()()"; + const __v_694 = eval(__v_692); diff --git a/deps/v8/test/mjsunit/regress/wasm/regress-810973b.js b/deps/v8/test/mjsunit/regress/wasm/regress-810973b.js new file mode 100644 index 0000000000..227bf55fc0 --- /dev/null +++ b/deps/v8/test/mjsunit/regress/wasm/regress-810973b.js @@ -0,0 +1,1209 @@ +// Copyright 2018 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 module() { + "use asm"; + function foo( + a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, + a12, a13, a14, a15, a16, a17, a18, a19, a20, a21, + a22, a23, a24, a25, a26, a27, a28, a29, a30, a31, + a32, a33, a34, a35, a36, a37, a38, a39, a40, a41, + a42, a43, a44, a45, a46, a47, a48, a49, a50, a51, + a52, a53, a54, a55, a56, a57, a58, a59, a60, a61, + a62, a63, a64, a65, a66, a67, a68, a69, a70, a71, + a72, a73, a74, a75, a76, a77, a78, a79, a80, a81, + a82, a83, a84, a85, a86, a87, a88, a89, a90, a91, + a92, a93, a94, a95, a96, a97, a98, a99, a100, a101, + a102, a103, a104, a105, a106, a107, a108, a109, a110, + a111, a112, a113, a114, a115, a116, a117, a118, a119, + a120, a121, a122, a123, a124, a125, a126, a127, a128, + a129, a130, a131, a132, a133, a134, a135, a136, a137, + a138, a139, a140, a141, a142, a143, a144, a145, a146, + a147, a148, a149, a150, a151, a152, a153, a154, a155, + a156, a157, a158, a159, a160, a161, a162, a163, a164, + a165, a166, a167, a168, a169, a170, a171, a172, a173, + a174, a175, a176, a177, a178, a179, a180, a181, a182, + a183, a184, a185, a186, a187, a188, a189, a190, a191, + a192, a193, a194, a195, a196, a197, a198, a199, a200, + a201, a202, a203, a204, a205, a206, a207, a208, a209, + a210, a211, a212, a213, a214, a215, a216, a217, a218, + a219, a220, a221, a222, a223, a224, a225, a226, a227, + a228, a229, a230, a231, a232, a233, a234, a235, a236, + a237, a238, a239, a240, a241, a242, a243, a244, a245, + a246, a247, a248, a249, a250, a251, a252, a253, a254, + a255, a256, a257, a258, a259, a260, a261, a262, a263, + a264, a265, a266, a267, a268, a269, a270, a271, a272, + a273, a274, a275, a276, a277, a278, a279, a280, a281, + a282, a283, a284, a285, a286, a287, a288, a289, a290, + a291, a292, a293, a294, a295, a296, a297, a298, a299, + a300, a301, a302, a303, a304, a305, a306, a307, a308, + a309, a310, a311, a312, a313, a314, a315, a316, a317, + a318, a319, a320, a321, a322, a323, a324, a325, a326, + a327, a328, a329, a330, a331, a332, a333, a334, a335, + a336, a337, a338, a339, a340, a341, a342, a343, a344, + a345, a346, a347, a348, a349, a350, a351, a352, a353, + a354, a355, a356, a357, a358, a359, a360, a361, a362, + a363, a364, a365, a366, a367, a368, a369, a370, a371, + a372, a373, a374, a375, a376, a377, a378, a379, a380, + a381, a382, a383, a384, a385, a386, a387, a388, a389, + a390, a391, a392, a393, a394, a395, a396, a397, a398, + a399, a400, a401, a402, a403, a404, a405, a406, a407, + a408, a409, a410, a411, a412, a413, a414, a415, a416, + a417, a418, a419, a420, a421, a422, a423, a424, a425, + a426, a427, a428, a429, a430, a431, a432, a433, a434, + a435, a436, a437, a438, a439, a440, a441, a442, a443, + a444, a445, a446, a447, a448, a449, a450, a451, a452, + a453, a454, a455, a456, a457, a458, a459, a460, a461, + a462, a463, a464, a465, a466, a467, a468, a469, a470, + a471, a472, a473, a474, a475, a476, a477, a478, a479, + a480, a481, a482, a483, a484, a485, a486, a487, a488, + a489, a490, a491, a492, a493, a494, a495, a496, a497, + a498, a499, a500, a501, a502, a503, a504, a505, a506, + a507, a508, a509, a510, a511, a512, a513, a514, a515, + a516, a517, a518, a519, a520, a521, a522, a523, a524, + a525, a526, a527, a528, a529, a530, a531, a532, a533, + a534, a535, a536, a537, a538, a539, a540, a541, a542, + a543, a544, a545, a546, a547, a548, a549, a550, a551, + a552, a553, a554, a555, a556, a557, a558, a559, a560, + a561, a562, a563, a564, a565, a566, a567, a568, a569, + a570, a571, a572, a573, a574, a575, a576, a577, a578, + a579, a580, a581, a582, a583, a584, a585, a586, a587, + a588, a589, a590, a591, a592, a593, a594, a595, a596, + a597, a598, a599, a600, a601, a602, a603, a604, a605, + a606, a607, a608, a609, a610, a611, a612, a613, a614, + a615, a616, a617, a618, a619, a620, a621, a622, a623, + a624, a625, a626, a627, a628, a629, a630, a631, a632, + a633, a634, a635, a636, a637, a638, a639, a640, a641, + a642, a643, a644, a645, a646, a647, a648, a649, a650, + a651, a652, a653, a654, a655, a656, a657, a658, a659, + a660, a661, a662, a663, a664, a665, a666, a667, a668, + a669, a670, a671, a672, a673, a674, a675, a676, a677, + a678, a679, a680, a681, a682, a683, a684, a685, a686, + a687, a688, a689, a690, a691, a692, a693, a694, a695, + a696, a697, a698, a699, a700, a701, a702, a703, a704, + a705, a706, a707, a708, a709, a710, a711, a712, a713, + a714, a715, a716, a717, a718, a719, a720, a721, a722, + a723, a724, a725, a726, a727, a728, a729, a730, a731, + a732, a733, a734, a735, a736, a737, a738, a739, a740, + a741, a742, a743, a744, a745, a746, a747, a748, a749, + a750, a751, a752, a753, a754, a755, a756, a757, a758, + a759, a760, a761, a762, a763, a764, a765, a766, a767, + a768, a769, a770, a771, a772, a773, a774, a775, a776, + a777, a778, a779, a780, a781, a782, a783, a784, a785, + a786, a787, a788, a789, a790, a791, a792, a793, a794, + a795, a796, a797, a798, a799, a800, a801, a802, a803, + a804, a805, a806, a807, a808, a809, a810, a811, a812, + a813, a814, a815, a816, a817, a818, a819, a820, a821, + a822, a823, a824, a825, a826, a827, a828, a829, a830, + a831, a832, a833, a834, a835, a836, a837, a838, a839, + a840, a841, a842, a843, a844, a845, a846, a847, a848, + a849, a850, a851, a852, a853, a854, a855, a856, a857, + a858, a859, a860, a861, a862, a863, a864, a865, a866, + a867, a868, a869, a870, a871, a872, a873, a874, a875, + a876, a877, a878, a879, a880, a881, a882, a883, a884, + a885, a886, a887, a888, a889, a890, a891, a892, a893, + a894, a895, a896, a897, a898, a899, a900, a901, a902, + a903, a904, a905, a906, a907, a908, a909, a910, a911, + a912, a913, a914, a915, a916, a917, a918, a919, a920, + a921, a922, a923, a924, a925, a926, a927, a928, a929, + a930, a931, a932, a933, a934, a935, a936, a937, a938, + a939, a940, a941, a942, a943, a944, a945, a946, a947, + a948, a949, a950, a951, a952, a953, a954, a955, a956, + a957, a958, a959, a960, a961, a962, a963, a964, a965, + a966, a967, a968, a969, a970, a971, a972, a973, a974, + a975, a976, a977, a978, a979, a980, a981, a982, a983, + a984, a985, a986, a987, a988, a989, a990, a991, a992, + a993, a994, a995, a996, a997, a998, a999, a1000, a1001, + a1002, a1003, a1004, a1005) { + a0 = +a0; + a1 = +a1; + a2 = +a2; + a3 = +a3; + a4 = +a4; + a5 = +a5; + a6 = +a6; + a7 = +a7; + a8 = +a8; + a9 = +a9; + a10 = +a10; + a11 = +a11; + a12 = +a12; + a13 = +a13; + a14 = +a14; + a15 = +a15; + a16 = +a16; + a17 = +a17; + a18 = +a18; + a19 = +a19; + a20 = +a20; + a21 = +a21; + a22 = +a22; + a23 = +a23; + a24 = +a24; + a25 = +a25; + a26 = +a26; + a27 = +a27; + a28 = +a28; + a29 = +a29; + a30 = +a30; + a31 = +a31; + a32 = +a32; + a33 = +a33; + a34 = +a34; + a35 = +a35; + a36 = +a36; + a37 = +a37; + a38 = +a38; + a39 = +a39; + a40 = +a40; + a41 = +a41; + a42 = +a42; + a43 = +a43; + a44 = +a44; + a45 = +a45; + a46 = +a46; + a47 = +a47; + a48 = +a48; + a49 = +a49; + a50 = +a50; + a51 = +a51; + a52 = +a52; + a53 = +a53; + a54 = +a54; + a55 = +a55; + a56 = +a56; + a57 = +a57; + a58 = +a58; + a59 = +a59; + a60 = +a60; + a61 = +a61; + a62 = +a62; + a63 = +a63; + a64 = +a64; + a65 = +a65; + a66 = +a66; + a67 = +a67; + a68 = +a68; + a69 = +a69; + a70 = +a70; + a71 = +a71; + a72 = +a72; + a73 = +a73; + a74 = +a74; + a75 = +a75; + a76 = +a76; + a77 = +a77; + a78 = +a78; + a79 = +a79; + a80 = +a80; + a81 = +a81; + a82 = +a82; + a83 = +a83; + a84 = +a84; + a85 = +a85; + a86 = +a86; + a87 = +a87; + a88 = +a88; + a89 = +a89; + a90 = +a90; + a91 = +a91; + a92 = +a92; + a93 = +a93; + a94 = +a94; + a95 = +a95; + a96 = +a96; + a97 = +a97; + a98 = +a98; + a99 = +a99; + a100 = +a100; + a101 = +a101; + a102 = +a102; + a103 = +a103; + a104 = +a104; + a105 = +a105; + a106 = +a106; + a107 = +a107; + a108 = +a108; + a109 = +a109; + a110 = +a110; + a111 = +a111; + a112 = +a112; + a113 = +a113; + a114 = +a114; + a115 = +a115; + a116 = +a116; + a117 = +a117; + a118 = +a118; + a119 = +a119; + a120 = +a120; + a121 = +a121; + a122 = +a122; + a123 = +a123; + a124 = +a124; + a125 = +a125; + a126 = +a126; + a127 = +a127; + a128 = +a128; + a129 = +a129; + a130 = +a130; + a131 = +a131; + a132 = +a132; + a133 = +a133; + a134 = +a134; + a135 = +a135; + a136 = +a136; + a137 = +a137; + a138 = +a138; + a139 = +a139; + a140 = +a140; + a141 = +a141; + a142 = +a142; + a143 = +a143; + a144 = +a144; + a145 = +a145; + a146 = +a146; + a147 = +a147; + a148 = +a148; + a149 = +a149; + a150 = +a150; + a151 = +a151; + a152 = +a152; + a153 = +a153; + a154 = +a154; + a155 = +a155; + a156 = +a156; + a157 = +a157; + a158 = +a158; + a159 = +a159; + a160 = +a160; + a161 = +a161; + a162 = +a162; + a163 = +a163; + a164 = +a164; + a165 = +a165; + a166 = +a166; + a167 = +a167; + a168 = +a168; + a169 = +a169; + a170 = +a170; + a171 = +a171; + a172 = +a172; + a173 = +a173; + a174 = +a174; + a175 = +a175; + a176 = +a176; + a177 = +a177; + a178 = +a178; + a179 = +a179; + a180 = +a180; + a181 = +a181; + a182 = +a182; + a183 = +a183; + a184 = +a184; + a185 = +a185; + a186 = +a186; + a187 = +a187; + a188 = +a188; + a189 = +a189; + a190 = +a190; + a191 = +a191; + a192 = +a192; + a193 = +a193; + a194 = +a194; + a195 = +a195; + a196 = +a196; + a197 = +a197; + a198 = +a198; + a199 = +a199; + a200 = +a200; + a201 = +a201; + a202 = +a202; + a203 = +a203; + a204 = +a204; + a205 = +a205; + a206 = +a206; + a207 = +a207; + a208 = +a208; + a209 = +a209; + a210 = +a210; + a211 = +a211; + a212 = +a212; + a213 = +a213; + a214 = +a214; + a215 = +a215; + a216 = +a216; + a217 = +a217; + a218 = +a218; + a219 = +a219; + a220 = +a220; + a221 = +a221; + a222 = +a222; + a223 = +a223; + a224 = +a224; + a225 = +a225; + a226 = +a226; + a227 = +a227; + a228 = +a228; + a229 = +a229; + a230 = +a230; + a231 = +a231; + a232 = +a232; + a233 = +a233; + a234 = +a234; + a235 = +a235; + a236 = +a236; + a237 = +a237; + a238 = +a238; + a239 = +a239; + a240 = +a240; + a241 = +a241; + a242 = +a242; + a243 = +a243; + a244 = +a244; + a245 = +a245; + a246 = +a246; + a247 = +a247; + a248 = +a248; + a249 = +a249; + a250 = +a250; + a251 = +a251; + a252 = +a252; + a253 = +a253; + a254 = +a254; + a255 = +a255; + a256 = +a256; + a257 = +a257; + a258 = +a258; + a259 = +a259; + a260 = +a260; + a261 = +a261; + a262 = +a262; + a263 = +a263; + a264 = +a264; + a265 = +a265; + a266 = +a266; + a267 = +a267; + a268 = +a268; + a269 = +a269; + a270 = +a270; + a271 = +a271; + a272 = +a272; + a273 = +a273; + a274 = +a274; + a275 = +a275; + a276 = +a276; + a277 = +a277; + a278 = +a278; + a279 = +a279; + a280 = +a280; + a281 = +a281; + a282 = +a282; + a283 = +a283; + a284 = +a284; + a285 = +a285; + a286 = +a286; + a287 = +a287; + a288 = +a288; + a289 = +a289; + a290 = +a290; + a291 = +a291; + a292 = +a292; + a293 = +a293; + a294 = +a294; + a295 = +a295; + a296 = +a296; + a297 = +a297; + a298 = +a298; + a299 = +a299; + a300 = +a300; + a301 = +a301; + a302 = +a302; + a303 = +a303; + a304 = +a304; + a305 = +a305; + a306 = +a306; + a307 = +a307; + a308 = +a308; + a309 = +a309; + a310 = +a310; + a311 = +a311; + a312 = +a312; + a313 = +a313; + a314 = +a314; + a315 = +a315; + a316 = +a316; + a317 = +a317; + a318 = +a318; + a319 = +a319; + a320 = +a320; + a321 = +a321; + a322 = +a322; + a323 = +a323; + a324 = +a324; + a325 = +a325; + a326 = +a326; + a327 = +a327; + a328 = +a328; + a329 = +a329; + a330 = +a330; + a331 = +a331; + a332 = +a332; + a333 = +a333; + a334 = +a334; + a335 = +a335; + a336 = +a336; + a337 = +a337; + a338 = +a338; + a339 = +a339; + a340 = +a340; + a341 = +a341; + a342 = +a342; + a343 = +a343; + a344 = +a344; + a345 = +a345; + a346 = +a346; + a347 = +a347; + a348 = +a348; + a349 = +a349; + a350 = +a350; + a351 = +a351; + a352 = +a352; + a353 = +a353; + a354 = +a354; + a355 = +a355; + a356 = +a356; + a357 = +a357; + a358 = +a358; + a359 = +a359; + a360 = +a360; + a361 = +a361; + a362 = +a362; + a363 = +a363; + a364 = +a364; + a365 = +a365; + a366 = +a366; + a367 = +a367; + a368 = +a368; + a369 = +a369; + a370 = +a370; + a371 = +a371; + a372 = +a372; + a373 = +a373; + a374 = +a374; + a375 = +a375; + a376 = +a376; + a377 = +a377; + a378 = +a378; + a379 = +a379; + a380 = +a380; + a381 = +a381; + a382 = +a382; + a383 = +a383; + a384 = +a384; + a385 = +a385; + a386 = +a386; + a387 = +a387; + a388 = +a388; + a389 = +a389; + a390 = +a390; + a391 = +a391; + a392 = +a392; + a393 = +a393; + a394 = +a394; + a395 = +a395; + a396 = +a396; + a397 = +a397; + a398 = +a398; + a399 = +a399; + a400 = +a400; + a401 = +a401; + a402 = +a402; + a403 = +a403; + a404 = +a404; + a405 = +a405; + a406 = +a406; + a407 = +a407; + a408 = +a408; + a409 = +a409; + a410 = +a410; + a411 = +a411; + a412 = +a412; + a413 = +a413; + a414 = +a414; + a415 = +a415; + a416 = +a416; + a417 = +a417; + a418 = +a418; + a419 = +a419; + a420 = +a420; + a421 = +a421; + a422 = +a422; + a423 = +a423; + a424 = +a424; + a425 = +a425; + a426 = +a426; + a427 = +a427; + a428 = +a428; + a429 = +a429; + a430 = +a430; + a431 = +a431; + a432 = +a432; + a433 = +a433; + a434 = +a434; + a435 = +a435; + a436 = +a436; + a437 = +a437; + a438 = +a438; + a439 = +a439; + a440 = +a440; + a441 = +a441; + a442 = +a442; + a443 = +a443; + a444 = +a444; + a445 = +a445; + a446 = +a446; + a447 = +a447; + a448 = +a448; + a449 = +a449; + a450 = +a450; + a451 = +a451; + a452 = +a452; + a453 = +a453; + a454 = +a454; + a455 = +a455; + a456 = +a456; + a457 = +a457; + a458 = +a458; + a459 = +a459; + a460 = +a460; + a461 = +a461; + a462 = +a462; + a463 = +a463; + a464 = +a464; + a465 = +a465; + a466 = +a466; + a467 = +a467; + a468 = +a468; + a469 = +a469; + a470 = +a470; + a471 = +a471; + a472 = +a472; + a473 = +a473; + a474 = +a474; + a475 = +a475; + a476 = +a476; + a477 = +a477; + a478 = +a478; + a479 = +a479; + a480 = +a480; + a481 = +a481; + a482 = +a482; + a483 = +a483; + a484 = +a484; + a485 = +a485; + a486 = +a486; + a487 = +a487; + a488 = +a488; + a489 = +a489; + a490 = +a490; + a491 = +a491; + a492 = +a492; + a493 = +a493; + a494 = +a494; + a495 = +a495; + a496 = +a496; + a497 = +a497; + a498 = +a498; + a499 = +a499; + a500 = +a500; + a501 = +a501; + a502 = +a502; + a503 = +a503; + a504 = +a504; + a505 = +a505; + a506 = +a506; + a507 = +a507; + a508 = +a508; + a509 = +a509; + a510 = +a510; + a511 = +a511; + a512 = +a512; + a513 = +a513; + a514 = +a514; + a515 = +a515; + a516 = +a516; + a517 = +a517; + a518 = +a518; + a519 = +a519; + a520 = +a520; + a521 = +a521; + a522 = +a522; + a523 = +a523; + a524 = +a524; + a525 = +a525; + a526 = +a526; + a527 = +a527; + a528 = +a528; + a529 = +a529; + a530 = +a530; + a531 = +a531; + a532 = +a532; + a533 = +a533; + a534 = +a534; + a535 = +a535; + a536 = +a536; + a537 = +a537; + a538 = +a538; + a539 = +a539; + a540 = +a540; + a541 = +a541; + a542 = +a542; + a543 = +a543; + a544 = +a544; + a545 = +a545; + a546 = +a546; + a547 = +a547; + a548 = +a548; + a549 = +a549; + a550 = +a550; + a551 = +a551; + a552 = +a552; + a553 = +a553; + a554 = +a554; + a555 = +a555; + a556 = +a556; + a557 = +a557; + a558 = +a558; + a559 = +a559; + a560 = +a560; + a561 = +a561; + a562 = +a562; + a563 = +a563; + a564 = +a564; + a565 = +a565; + a566 = +a566; + a567 = +a567; + a568 = +a568; + a569 = +a569; + a570 = +a570; + a571 = +a571; + a572 = +a572; + a573 = +a573; + a574 = +a574; + a575 = +a575; + a576 = +a576; + a577 = +a577; + a578 = +a578; + a579 = +a579; + a580 = +a580; + a581 = +a581; + a582 = +a582; + a583 = +a583; + a584 = +a584; + a585 = +a585; + a586 = +a586; + a587 = +a587; + a588 = +a588; + a589 = +a589; + a590 = +a590; + a591 = +a591; + a592 = +a592; + a593 = +a593; + a594 = +a594; + a595 = +a595; + a596 = +a596; + a597 = +a597; + a598 = +a598; + a599 = +a599; + a600 = +a600; + a601 = +a601; + a602 = +a602; + a603 = +a603; + a604 = +a604; + a605 = +a605; + a606 = +a606; + a607 = +a607; + a608 = +a608; + a609 = +a609; + a610 = +a610; + a611 = +a611; + a612 = +a612; + a613 = +a613; + a614 = +a614; + a615 = +a615; + a616 = +a616; + a617 = +a617; + a618 = +a618; + a619 = +a619; + a620 = +a620; + a621 = +a621; + a622 = +a622; + a623 = +a623; + a624 = +a624; + a625 = +a625; + a626 = +a626; + a627 = +a627; + a628 = +a628; + a629 = +a629; + a630 = +a630; + a631 = +a631; + a632 = +a632; + a633 = +a633; + a634 = +a634; + a635 = +a635; + a636 = +a636; + a637 = +a637; + a638 = +a638; + a639 = +a639; + a640 = +a640; + a641 = +a641; + a642 = +a642; + a643 = +a643; + a644 = +a644; + a645 = +a645; + a646 = +a646; + a647 = +a647; + a648 = +a648; + a649 = +a649; + a650 = +a650; + a651 = +a651; + a652 = +a652; + a653 = +a653; + a654 = +a654; + a655 = +a655; + a656 = +a656; + a657 = +a657; + a658 = +a658; + a659 = +a659; + a660 = +a660; + a661 = +a661; + a662 = +a662; + a663 = +a663; + a664 = +a664; + a665 = +a665; + a666 = +a666; + a667 = +a667; + a668 = +a668; + a669 = +a669; + a670 = +a670; + a671 = +a671; + a672 = +a672; + a673 = +a673; + a674 = +a674; + a675 = +a675; + a676 = +a676; + a677 = +a677; + a678 = +a678; + a679 = +a679; + a680 = +a680; + a681 = +a681; + a682 = +a682; + a683 = +a683; + a684 = +a684; + a685 = +a685; + a686 = +a686; + a687 = +a687; + a688 = +a688; + a689 = +a689; + a690 = +a690; + a691 = +a691; + a692 = +a692; + a693 = +a693; + a694 = +a694; + a695 = +a695; + a696 = +a696; + a697 = +a697; + a698 = +a698; + a699 = +a699; + a700 = +a700; + a701 = +a701; + a702 = +a702; + a703 = +a703; + a704 = +a704; + a705 = +a705; + a706 = +a706; + a707 = +a707; + a708 = +a708; + a709 = +a709; + a710 = +a710; + a711 = +a711; + a712 = +a712; + a713 = +a713; + a714 = +a714; + a715 = +a715; + a716 = +a716; + a717 = +a717; + a718 = +a718; + a719 = +a719; + a720 = +a720; + a721 = +a721; + a722 = +a722; + a723 = +a723; + a724 = +a724; + a725 = +a725; + a726 = +a726; + a727 = +a727; + a728 = +a728; + a729 = +a729; + a730 = +a730; + a731 = +a731; + a732 = +a732; + a733 = +a733; + a734 = +a734; + a735 = +a735; + a736 = +a736; + a737 = +a737; + a738 = +a738; + a739 = +a739; + a740 = +a740; + a741 = +a741; + a742 = +a742; + a743 = +a743; + a744 = +a744; + a745 = +a745; + a746 = +a746; + a747 = +a747; + a748 = +a748; + a749 = +a749; + a750 = +a750; + a751 = +a751; + a752 = +a752; + a753 = +a753; + a754 = +a754; + a755 = +a755; + a756 = +a756; + a757 = +a757; + a758 = +a758; + a759 = +a759; + a760 = +a760; + a761 = +a761; + a762 = +a762; + a763 = +a763; + a764 = +a764; + a765 = +a765; + a766 = +a766; + a767 = +a767; + a768 = +a768; + a769 = +a769; + a770 = +a770; + a771 = +a771; + a772 = +a772; + a773 = +a773; + a774 = +a774; + a775 = +a775; + a776 = +a776; + a777 = +a777; + a778 = +a778; + a779 = +a779; + a780 = +a780; + a781 = +a781; + a782 = +a782; + a783 = +a783; + a784 = +a784; + a785 = +a785; + a786 = +a786; + a787 = +a787; + a788 = +a788; + a789 = +a789; + a790 = +a790; + a791 = +a791; + a792 = +a792; + a793 = +a793; + a794 = +a794; + a795 = +a795; + a796 = +a796; + a797 = +a797; + a798 = +a798; + a799 = +a799; + a800 = +a800; + a801 = +a801; + a802 = +a802; + a803 = +a803; + a804 = +a804; + a805 = +a805; + a806 = +a806; + a807 = +a807; + a808 = +a808; + a809 = +a809; + a810 = +a810; + a811 = +a811; + a812 = +a812; + a813 = +a813; + a814 = +a814; + a815 = +a815; + a816 = +a816; + a817 = +a817; + a818 = +a818; + a819 = +a819; + a820 = +a820; + a821 = +a821; + a822 = +a822; + a823 = +a823; + a824 = +a824; + a825 = +a825; + a826 = +a826; + a827 = +a827; + a828 = +a828; + a829 = +a829; + a830 = +a830; + a831 = +a831; + a832 = +a832; + a833 = +a833; + a834 = +a834; + a835 = +a835; + a836 = +a836; + a837 = +a837; + a838 = +a838; + a839 = +a839; + a840 = +a840; + a841 = +a841; + a842 = +a842; + a843 = +a843; + a844 = +a844; + a845 = +a845; + a846 = +a846; + a847 = +a847; + a848 = +a848; + a849 = +a849; + a850 = +a850; + a851 = +a851; + a852 = +a852; + a853 = +a853; + a854 = +a854; + a855 = +a855; + a856 = +a856; + a857 = +a857; + a858 = +a858; + a859 = +a859; + a860 = +a860; + a861 = +a861; + a862 = +a862; + a863 = +a863; + a864 = +a864; + a865 = +a865; + a866 = +a866; + a867 = +a867; + a868 = +a868; + a869 = +a869; + a870 = +a870; + a871 = +a871; + a872 = +a872; + a873 = +a873; + a874 = +a874; + a875 = +a875; + a876 = +a876; + a877 = +a877; + a878 = +a878; + a879 = +a879; + a880 = +a880; + a881 = +a881; + a882 = +a882; + a883 = +a883; + a884 = +a884; + a885 = +a885; + a886 = +a886; + a887 = +a887; + a888 = +a888; + a889 = +a889; + a890 = +a890; + a891 = +a891; + a892 = +a892; + a893 = +a893; + a894 = +a894; + a895 = +a895; + a896 = +a896; + a897 = +a897; + a898 = +a898; + a899 = +a899; + a900 = +a900; + a901 = +a901; + a902 = +a902; + a903 = +a903; + a904 = +a904; + a905 = +a905; + a906 = +a906; + a907 = +a907; + a908 = +a908; + a909 = +a909; + a910 = +a910; + a911 = +a911; + a912 = +a912; + a913 = +a913; + a914 = +a914; + a915 = +a915; + a916 = +a916; + a917 = +a917; + a918 = +a918; + a919 = +a919; + a920 = +a920; + a921 = +a921; + a922 = +a922; + a923 = +a923; + a924 = +a924; + a925 = +a925; + a926 = +a926; + a927 = +a927; + a928 = +a928; + a929 = +a929; + a930 = +a930; + a931 = +a931; + a932 = +a932; + a933 = +a933; + a934 = +a934; + a935 = +a935; + a936 = +a936; + a937 = +a937; + a938 = +a938; + a939 = +a939; + a940 = +a940; + a941 = +a941; + a942 = +a942; + a943 = +a943; + a944 = +a944; + a945 = +a945; + a946 = +a946; + a947 = +a947; + a948 = +a948; + a949 = +a949; + a950 = +a950; + a951 = +a951; + a952 = +a952; + a953 = +a953; + a954 = +a954; + a955 = +a955; + a956 = +a956; + a957 = +a957; + a958 = +a958; + a959 = +a959; + a960 = +a960; + a961 = +a961; + a962 = +a962; + a963 = +a963; + a964 = +a964; + a965 = +a965; + a966 = +a966; + a967 = +a967; + a968 = +a968; + a969 = +a969; + a970 = +a970; + a971 = +a971; + a972 = +a972; + a973 = +a973; + a974 = +a974; + a975 = +a975; + a976 = +a976; + a977 = +a977; + a978 = +a978; + a979 = +a979; + a980 = +a980; + a981 = +a981; + a982 = +a982; + a983 = +a983; + a984 = +a984; + a985 = +a985; + a986 = +a986; + a987 = +a987; + a988 = +a988; + a989 = +a989; + a990 = +a990; + a991 = +a991; + a992 = +a992; + a993 = +a993; + a994 = +a994; + a995 = +a995; + a996 = +a996; + a997 = +a997; + a998 = +a998; + a999 = +a999; + a1000 = +a1000; + a1001 = +a1001; + a1002 = +a1002; + a1003 = +a1003; + a1004 = +a1004; + a1005 = +a1005; + return 10; + } + function bar() { + return foo(0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, + 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, + 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, + 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, + 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, + 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, + 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, + 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, + 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, + 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, + 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, + 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, + 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, + 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, + 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, + 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, + 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, + 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, + 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, + 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, + 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, + 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, + 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, + 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, + 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, + 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, + 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, + 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, + 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, + 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, + 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, + 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, + 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, + 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, + 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, + 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, + 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, + 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, + 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, + 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, + 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, + 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, + 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, + 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, + 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, + 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, + 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, + 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, + 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, + 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, + 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, + 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, + 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, + 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, + 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, + 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, + 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, + 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, + 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, + 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, + 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, + 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, + 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, + 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, + 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, + 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, + 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, + 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, + 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, + 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, + 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, + 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, + 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, + 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, + 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, + 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, + 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, + 0.0, 0.0, 0.0, 0.0, 1.0) | + 0; + } + return bar +})()(); diff --git a/deps/v8/test/mjsunit/samevalue.js b/deps/v8/test/mjsunit/samevalue.js index 356e888016..1e5384d73d 100644 --- a/deps/v8/test/mjsunit/samevalue.js +++ b/deps/v8/test/mjsunit/samevalue.js @@ -32,8 +32,11 @@ var obj1 = {x: 10, y: 11, z: "test"}; var obj2 = {x: 10, y: 11, z: "test"}; +// Object.is() uses the SameValue algorithm. var sameValue = Object.is; -var sameValueZero = function(x, y) { return %SameValueZero(x, y); } + +// Set#has() uses the SameValueZero algorithm. +var sameValueZero = (x, y) => new Set([x]).has(y); // Calls SameValue and SameValueZero and checks that their results match. function sameValueBoth(a, b) { diff --git a/deps/v8/test/mjsunit/stack-traces-class-fields.js b/deps/v8/test/mjsunit/stack-traces-class-fields.js new file mode 100644 index 0000000000..84d7e8a843 --- /dev/null +++ b/deps/v8/test/mjsunit/stack-traces-class-fields.js @@ -0,0 +1,246 @@ +// Copyright 2018 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-class-fields + +// Utility function for testing that the expected strings occur +// in the stack trace produced when running the given function. +function testTrace(name, fun, expected, unexpected) { + var threw = false; + try { + fun(); + } catch (e) { + for (var i = 0; i < expected.length; i++) { + assertTrue( + e.stack.indexOf(expected[i]) != -1, + name + " doesn't contain expected[" + i + "] stack = " + e.stack + ); + } + if (unexpected) { + for (var i = 0; i < unexpected.length; i++) { + assertEquals( + e.stack.indexOf(unexpected[i]), + -1, + name + " contains unexpected[" + i + "]" + ); + } + } + threw = true; + } + assertTrue(threw, name + " didn't throw"); +} + +function thrower() { + FAIL; +} + +function testClassConstruction() { + class X { + static x = thrower(); + } +} + +// ReferenceError: FAIL is not defined +// at thrower +// at <static_fields_initializer> +// at testClassConstruction +// at testTrace +testTrace( + "during class construction", + testClassConstruction, + ["thrower", "<static_fields_initializer>"], + ["anonymous"] +); + +function testClassConstruction2() { + class X { + [thrower()]; + } +} + +// ReferenceError: FAIL is not defined +// at thrower +// at testClassConstruction2 +// at testTrace +testTrace("during class construction2", testClassConstruction2, ["thrower"]); + +function testClassInstantiation() { + class X { + x = thrower(); + } + + new X(); +} + +// ReferenceError: FAIL is not defined +// at thrower +// at X.<instance_fields_initializer> +// at new X +// at testClassInstantiation +// at testTrace +testTrace( + "during class instantiation", + testClassInstantiation, + ["thrower", "X.<instance_fields_initializer>", "new X"], + ["anonymous"] +); + +function testClassInstantiationWithSuper() { + class Base {} + + class X extends Base { + x = thrower(); + } + + new X(); +} + +// ReferenceError: FAIL is not defined +// at thrower +// at X.<instance_fields_initializer> +// at new X +// at testClassInstantiation +// at testTrace +testTrace( + "during class instantiation with super", + testClassInstantiationWithSuper, + ["thrower", "X.<instance_fields_initializer>", "new X"], + ["Base", "anonymous"] +); + +function testClassInstantiationWithSuper2() { + class Base {} + + class X extends Base { + constructor() { + super(); + } + x = thrower(); + } + + new X(); +} + +// ReferenceError: FAIL is not defined +// at thrower +// at X.<instance_fields_initializer> +// at new X +// at testClassInstantiation +// at testTrace +testTrace( + "during class instantiation with super2", + testClassInstantiationWithSuper2, + ["thrower", "X.<instance_fields_initializer>", "new X"], + ["Base", "anonymous"] +); + +function testClassInstantiationWithSuper3() { + class Base { + x = thrower(); + } + + class X extends Base { + constructor() { + super(); + } + } + + new X(); +} + +// ReferenceError: FAIL is not defined +// at thrower +// at X.<instance_fields_initializer> +// at new Base +// at new X +// at testClassInstantiationWithSuper3 +// at testTrace +testTrace( + "during class instantiation with super3", + testClassInstantiationWithSuper3, + ["thrower", "X.<instance_fields_initializer>", "new Base", "new X"], + ["anonymous"] +); + +function testClassFieldCall() { + class X { + x = thrower; + } + + let x = new X(); + x.x(); +} + +// ReferenceError: FAIL is not defined +// at X.thrower [as x] +// at testClassFieldCall +// at testTrace +testTrace( + "during class field call", + testClassFieldCall, + ["X.thrower"], + ["anonymous"] +); + +function testStaticClassFieldCall() { + class X { + static x = thrower; + } + + X.x(); +} + +// ReferenceError: FAIL is not defined +// at Function.thrower [as x] +// at testStaticClassFieldCall +// at testTrace +testTrace( + "during static class field call", + testStaticClassFieldCall, + ["Function.thrower"], + ["anonymous"] +); + +function testClassFieldCallWithFNI() { + class X { + x = function() { + FAIL; + }; + } + + let x = new X(); + x.x(); +} + +// ReferenceError: FAIL is not defined +// at X.x +// at testClassFieldCallWithFNI +// at testTrace +testTrace( + "during class field call with FNI", + testClassFieldCallWithFNI, + ["X.x"], + ["anonymous"] +); + +function testStaticClassFieldCallWithFNI() { + class X { + static x = function() { + FAIL; + }; + } + + X.x(); +} + +// ReferenceError: FAIL is not defined +// at Function.x +// at testStaticClassFieldCallWithFNI +// at testTrace +testTrace( + "during static class field call with FNI", + testStaticClassFieldCallWithFNI, + ["Function.x"], + ["anonymous"] +); diff --git a/deps/v8/test/mjsunit/string-trim.js b/deps/v8/test/mjsunit/string-trim.js index 201a34f1c9..587e7db5db 100644 --- a/deps/v8/test/mjsunit/string-trim.js +++ b/deps/v8/test/mjsunit/string-trim.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-string-trimming - assertEquals('trim', String.prototype.trim.name); assertEquals('trimStart', String.prototype.trimStart.name); assertEquals('trimStart', String.prototype.trimLeft.name); diff --git a/deps/v8/test/mjsunit/test-async.js b/deps/v8/test/mjsunit/test-async.js index f8a11c5238..d4fee9bfb9 100644 --- a/deps/v8/test/mjsunit/test-async.js +++ b/deps/v8/test/mjsunit/test-async.js @@ -53,7 +53,7 @@ var testAsync; equals(expected, found, name_opt) { this.actualAsserts_++; - if (expected !== found) { + if (!deepEquals(expected, found)) { this.fail(prettyPrinted(expected), found, name_opt); } } diff --git a/deps/v8/test/mjsunit/testcfg.py b/deps/v8/test/mjsunit/testcfg.py index d843cfaf02..422210365e 100644 --- a/deps/v8/test/mjsunit/testcfg.py +++ b/deps/v8/test/mjsunit/testcfg.py @@ -41,21 +41,6 @@ SELF_SCRIPT_PATTERN = re.compile(r"//\s+Env: TEST_FILE_NAME") MODULE_PATTERN = re.compile(r"^// MODULE$", flags=re.MULTILINE) NO_HARNESS_PATTERN = re.compile(r"^// NO HARNESS$", flags=re.MULTILINE) -# Patterns for additional resource files on Android. Files that are not covered -# by one of the other patterns below will be specified in the resources section. -RESOURCES_PATTERN = re.compile(r"//\s+Resources:(.*)") -# Pattern to auto-detect files to push on Android for statements like: -# load("path/to/file.js") -LOAD_PATTERN = re.compile( - r"(?:load|readbuffer|read)\((?:'|\")([^'\"]*)(?:'|\")\)") -# Pattern to auto-detect files to push on Android for statements like: -# import "path/to/file.js" -MODULE_RESOURCES_PATTERN_1 = re.compile( - r"(?:import|export)(?:\(| )(?:'|\")([^'\"]*)(?:'|\")") -# Pattern to auto-detect files to push on Android for statements like: -# import foobar from "path/to/file.js" -MODULE_RESOURCES_PATTERN_2 = re.compile( - r"(?:import|export).*from (?:'|\")([^'\"]*)(?:'|\")") # Flags known to misbehave when combining arbitrary mjsunit tests. Can also # be compiled regular expressions. @@ -100,7 +85,7 @@ class TestSuite(testsuite.TestSuite): return SuppressedTestCase -class TestCase(testcase.TestCase): +class TestCase(testcase.D8TestCase): def __init__(self, *args, **kwargs): super(TestCase, self).__init__(*args, **kwargs) @@ -140,47 +125,6 @@ class TestCase(testcase.TestCase): self._files_suffix = files_suffix self._env = self._parse_source_env(source) - def _get_resources_for_file(self, file): - """Returns for a given file a list of absolute paths of files needed by the - given file. - """ - with open(file) as f: - source = f.read() - result = [] - def add_path(path): - result.append(os.path.abspath(path.replace('/', os.path.sep))) - for match in RESOURCES_PATTERN.finditer(source): - # There are several resources per line. Relative to base dir. - for path in match.group(1).strip().split(): - add_path(path) - for match in LOAD_PATTERN.finditer(source): - # Files in load statements are relative to base dir. - add_path(match.group(1)) - for match in MODULE_RESOURCES_PATTERN_1.finditer(source): - # Imported files are side by side with the test case. - add_path(os.path.join( - self.suite.root, os.path.dirname(self.path), match.group(1))) - for match in MODULE_RESOURCES_PATTERN_2.finditer(source): - # Imported files are side by side with the test case. - add_path(os.path.join( - self.suite.root, os.path.dirname(self.path), match.group(1))) - return result - - def _get_resources(self): - """Returns the list of files needed by a test case.""" - result = set() - to_check = [self._get_source_path()] - # Recurse over all files until reaching a fixpoint. - while to_check: - next_resource = to_check.pop() - result.add(next_resource) - for resource in self._get_resources_for_file(next_resource): - # Only add files that exist on disc. The pattens we check for give some - # false positives otherwise. - if resource not in result and os.path.exists(resource): - to_check.append(resource) - return sorted(list(result)) - def _parse_source_env(self, source): env_match = ENV_PATTERN.search(source) env = {} @@ -244,7 +188,7 @@ class TestCombiner(testsuite.TestCombiner): return CombinedTest -class CombinedTest(testcase.TestCase): +class CombinedTest(testcase.D8TestCase): """Behaves like normal mjsunit tests except: 1. Expected outcome is always PASS 2. Instead of one file there is a try-catch wrapper with all combined tests @@ -259,7 +203,7 @@ class CombinedTest(testcase.TestCase): self._statusfile_outcomes = outproc.OUTCOMES_PASS_OR_TIMEOUT self.expected_outcomes = outproc.OUTCOMES_PASS_OR_TIMEOUT - def _get_shell_with_flags(self): + def _get_shell_flags(self): """In addition to standard set of shell flags it appends: --disable-abortjs: %AbortJS can abort the test even inside trycatch-wrapper, so we disable it. @@ -269,15 +213,13 @@ class CombinedTest(testcase.TestCase): --quiet-load: suppress any stdout from load() function used by trycatch-wrapper. """ - shell = 'd8' - shell_flags = [ + return [ '--test', '--disable-abortjs', '--es-staging', '--omit-quit', '--quiet-load', ] - return shell, shell_flags def _get_cmd_params(self): return ( diff --git a/deps/v8/test/mjsunit/typeof.js b/deps/v8/test/mjsunit/typeof.js index 864f1cfdb6..f6c47f8e2e 100644 --- a/deps/v8/test/mjsunit/typeof.js +++ b/deps/v8/test/mjsunit/typeof.js @@ -1,39 +1,42 @@ // Copyright 2008 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. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +'use strict'; // The type of a regular expression should be 'object', including in // the context of string equality comparisons. +{ + const r = new RegExp; -var r = new RegExp; -assertEquals('object', typeof r); -assertTrue(typeof r == 'object'); -assertFalse(typeof r == 'function'); + assertEquals('object', typeof r); + assertTrue(typeof r == 'object'); + assertFalse(typeof r == 'function'); -function test(x, y) { return x == y; } -assertTrue(test('object', typeof r)); + function equals(x, y) { return x == y; } + assertTrue(equals('object', typeof r)); +} assertFalse(typeof null == "undefined"); + +assertEquals('undefined', typeof undefined); +assertEquals('object', typeof null); +assertEquals('boolean', typeof true); +assertEquals('boolean', typeof false); +assertEquals('number', typeof 42.42); +assertEquals('number', typeof 42); +assertEquals('bigint', typeof 42n); +assertEquals('string', typeof '42'); +assertEquals('symbol', typeof Symbol(42)); +assertEquals('object', typeof {}); +assertEquals('object', typeof []); +assertEquals('object', typeof new Proxy({}, {})); +assertEquals('object', typeof new Proxy([], {})); +assertEquals('function', typeof (_ => 42)); +assertEquals('function', typeof function() {}); +assertEquals('function', typeof function*() {}); +assertEquals('function', typeof async function() {}); +assertEquals('function', typeof async function*() {}); +assertEquals('function', typeof new Proxy(_ => 42, {})); +assertEquals('function', typeof class {}); +assertEquals('function', typeof Object); diff --git a/deps/v8/test/mjsunit/wasm/anyref.js b/deps/v8/test/mjsunit/wasm/anyref.js index 6282b588ac..e6306b6a9e 100644 --- a/deps/v8/test/mjsunit/wasm/anyref.js +++ b/deps/v8/test/mjsunit/wasm/anyref.js @@ -76,7 +76,6 @@ load("test/mjsunit/wasm/wasm-module-builder.js"); .addBody([kExprRefNull]) .exportFunc(); - const instance = builder.instantiate(); assertEquals(null, instance.exports.main()); @@ -98,5 +97,17 @@ load("test/mjsunit/wasm/wasm-module-builder.js"); assertEquals(0, instance.exports.main(undefined)); assertEquals(1, instance.exports.main(null)); assertEquals(0, instance.exports.main(print)); +})(); +(function testAnyRefLocalDefaultValue() { + print(arguments.callee.name); + const builder = new WasmModuleBuilder(); + builder.addFunction('main', kSig_r_v) + .addBody([kExprGetLocal, 0]) + .addLocals({anyref_count: 1}) + .exportFunc(); + + const instance = builder.instantiate(); + + assertEquals(null, instance.exports.main()); })(); diff --git a/deps/v8/test/mjsunit/wasm/atomics.js b/deps/v8/test/mjsunit/wasm/atomics.js index 58d3d950d5..371839ae24 100644 --- a/deps/v8/test/mjsunit/wasm/atomics.js +++ b/deps/v8/test/mjsunit/wasm/atomics.js @@ -432,3 +432,33 @@ function TestStore(func, buffer, value, size) { assertThrows(() => GetAtomicBinOpFunction(kExprI32AtomicSub16U, 3, 0), WebAssembly.CompileError); })(); + +function CmpExchgLoop(opcode, alignment) { + print("TestI64AtomicCompareExchangeLoop" + alignment); + let builder = new WasmModuleBuilder(); + builder.addImportedMemory("m", "imported_mem", 0, 2, "shared"); + builder.addFunction("main", makeSig([kWasmI32], [])) + .addLocals({i64_count: 2}) + .addBody([ + kExprLoop, kWasmStmt, + kExprGetLocal, 0, + kExprGetLocal, 1, + kExprGetLocal, 2, + kAtomicPrefix, opcode, alignment, 0, + kExprGetLocal, 1, + kExprI64Ne, + kExprBrIf, 0, + kExprEnd + ]) + .exportFunc(); + let mem = new WebAssembly.Memory({initial: 2, maximum: 2, shared: true}); + let module = new WebAssembly.Module(builder.toBuffer()); + let instance = new WebAssembly.Instance(module, {m: {imported_mem: mem}}); +} + +(function TestAtomicCompareExchgLoop() { + CmpExchgLoop(kExprI64AtomicCompareExchange, 3); + CmpExchgLoop(kExprI64AtomicCompareExchange32U, 2); + CmpExchgLoop(kExprI64AtomicCompareExchange16U, 1); + CmpExchgLoop(kExprI64AtomicCompareExchange8U, 0); +})(); diff --git a/deps/v8/test/mjsunit/wasm/bounds-check-64bit.js b/deps/v8/test/mjsunit/wasm/bounds-check-64bit.js index 9308393da4..d909bcc542 100644 --- a/deps/v8/test/mjsunit/wasm/bounds-check-64bit.js +++ b/deps/v8/test/mjsunit/wasm/bounds-check-64bit.js @@ -6,7 +6,7 @@ load("test/mjsunit/wasm/wasm-constants.js"); load("test/mjsunit/wasm/wasm-module-builder.js"); const builder = new WasmModuleBuilder(); -builder.addMemory(1, kV8MaxPages, false); +builder.addMemory(1, undefined, false); builder.addFunction('load', kSig_i_ii) .addBody([ kExprGetLocal, 0, diff --git a/deps/v8/test/mjsunit/wasm/compare-exchange-stress.js b/deps/v8/test/mjsunit/wasm/compare-exchange-stress.js new file mode 100644 index 0000000000..d308919088 --- /dev/null +++ b/deps/v8/test/mjsunit/wasm/compare-exchange-stress.js @@ -0,0 +1,207 @@ +// Copyright 2018 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 + +load("test/mjsunit/wasm/wasm-constants.js"); +load("test/mjsunit/wasm/wasm-module-builder.js"); + +const kSequenceLength = 8192; +const kNumberOfWorkers = 4; +const kBitMask = kNumberOfWorkers - 1; +const kSequenceStartAddress = 32; + +function makeWorkerCodeForOpcode(compareExchangeOpcode, size, functionName, + builder) { + let loadMemOpcode = kTrapUnreachable; + switch (size) { + case 32: + loadMemOpcode = kExprI32LoadMem; + break; + case 16: + loadMemOpcode = kExprI32LoadMem16U; + break; + case 8: + loadMemOpcode = kExprI32LoadMem8U; + break; + default: + throw "!"; + } + const kArgMemoryCell = 0; // target for atomic ops + const kArgSequencePtr = 1; // address of sequence + const kArgSeqenceLength = 2; // lenght of sequence + const kArgWorkerId = 3; // id of this worker + const kArgBitMask = 4; // mask to extract worker id from value + const kLocalCurrentOffset = 5; // current position in sequence in bytes + const kLocalExpectedValue = 6; // the value we are waiting for + const kLocalNextValue = 7; // the value to write in the update + let body = [ + // Turn sequence length to equivalent in bytes. + kExprGetLocal, kArgSeqenceLength, + kExprI32Const, size / 8, + kExprI32Mul, + kExprSetLocal, kArgSeqenceLength, + // Outer block so we have something to jump for return. + ...[kExprBlock, kWasmStmt, + // Set counter to 0. + kExprI32Const, 0, + kExprSetLocal, kLocalCurrentOffset, + // Outer loop until maxcount. + ...[kExprLoop, kWasmStmt, + // Find the next value to wait for. + ...[kExprLoop, kWasmStmt, + // Check end of sequence. + kExprGetLocal, kLocalCurrentOffset, + kExprGetLocal, kArgSeqenceLength, + kExprI32Eq, + kExprBrIf, 2, // return + ...[kExprBlock, kWasmStmt, + // Load next value. + kExprGetLocal, kArgSequencePtr, + kExprGetLocal, kLocalCurrentOffset, + kExprI32Add, + loadMemOpcode, 0, 0, + // Mask off bits. + kExprGetLocal, kArgBitMask, + kExprI32And, + // Compare with worker id. + kExprGetLocal, kArgWorkerId, + kExprI32Eq, + kExprBrIf, 0, + // Not found, increment position. + kExprGetLocal, kLocalCurrentOffset, + kExprI32Const, size / 8, + kExprI32Add, + kExprSetLocal, kLocalCurrentOffset, + kExprBr, 1, + kExprEnd + ], + // Found, end loop. + kExprEnd + ], + // Load expected value to local. + kExprGetLocal, kArgSequencePtr, + kExprGetLocal, kLocalCurrentOffset, + kExprI32Add, + loadMemOpcode, 0, 0, + kExprSetLocal, kLocalExpectedValue, + // Load value after expected one. + kExprGetLocal, kArgSequencePtr, + kExprGetLocal, kLocalCurrentOffset, + kExprI32Add, + kExprI32Const, size / 8, + kExprI32Add, + loadMemOpcode, 0, 0, + kExprSetLocal, kLocalNextValue, + // Hammer on memory until value found. + ...[kExprLoop, kWasmStmt, + // Load address. + kExprGetLocal, kArgMemoryCell, + // Load expected value. + kExprGetLocal, kLocalExpectedValue, + // Load updated value. + kExprGetLocal, kLocalNextValue, + // Try update. + kAtomicPrefix, compareExchangeOpcode, 0, 0, + // Load expected value. + kExprGetLocal, kLocalExpectedValue, + // Spin if not what expected. + kExprI32Ne, + kExprBrIf, 0, + kExprEnd + ], + // Next iteration of loop. + kExprGetLocal, kLocalCurrentOffset, + kExprI32Const, size / 8, + kExprI32Add, + kExprSetLocal, kLocalCurrentOffset, + kExprBr, 0, + kExprEnd + ], // outer loop + kExprEnd + ], // the block + kExprReturn + ]; + builder.addFunction(functionName, makeSig([kWasmI32, kWasmI32, kWasmI32, + kWasmI32, kWasmI32 + ], [])) + .addLocals({ + i32_count: 3 + }) + .addBody(body) + .exportAs(functionName); +} + +function generateSequence(typedarray, start, count) { + let end = count + start; + for (let i = start; i < end; i++) { + typedarray[i] = Math.floor(Math.random() * 256); + } +} + +function spawnWorker(module, memory, address, sequence) { + let workers = []; + for (let i = 0; i < kNumberOfWorkers; i++) { + let worker = new Worker( + `onmessage = function(msg) { + this.instance = new WebAssembly.Instance(msg.module, + {m: {imported_mem: msg.memory}}); + instance.exports.worker(msg.address, msg.sequence, msg.sequenceLength, msg.workerId, + msg.bitMask); + postMessage({workerId: msg.workerId}); + }`, + {type: 'string'} + ); + workers.push(worker); + worker.postMessage({ + module: module, + memory: memory, + address: address, + sequence: sequence, + sequenceLength: kSequenceLength, + workerId: i, + bitMask: kBitMask + }); + } + return workers; +} + +function waitForWorkers(workers) { + for (let worker of workers) { + worker.getMessage(); + worker.terminate(); + } +} + +function testOpcode(opcode, opcodeSize) { + print("Testing I32AtomicCompareExchange" + opcodeSize); + let builder = new WasmModuleBuilder(); + builder.addImportedMemory("m", "imported_mem", 0, 1, "shared"); + + makeWorkerCodeForOpcode(opcode, opcodeSize, "worker", builder); + + let memory = new WebAssembly.Memory({ + initial: 1, + maximum: 1, + shared: true + }); + let memoryView = new Uint8Array(memory.buffer); + generateSequence(memoryView, kSequenceStartAddress, kSequenceLength * (opcodeSize / 8)); + + let module = new WebAssembly.Module(builder.toBuffer()); + let workers = spawnWorker(module, memory, 0, kSequenceStartAddress); + + // Fire the workers off + for (let i = opcodeSize / 8 - 1; i >= 0; i--) { + memoryView[i] = memoryView[kSequenceStartAddress + i]; + } + + waitForWorkers(workers); + + print("DONE"); +} + +testOpcode(kExprI32AtomicCompareExchange, 32); +testOpcode(kExprI32AtomicCompareExchange16U, 16); +testOpcode(kExprI32AtomicCompareExchange8U, 8); diff --git a/deps/v8/test/mjsunit/wasm/compare-exchange64-stress.js b/deps/v8/test/mjsunit/wasm/compare-exchange64-stress.js new file mode 100644 index 0000000000..89cc7ecb34 --- /dev/null +++ b/deps/v8/test/mjsunit/wasm/compare-exchange64-stress.js @@ -0,0 +1,213 @@ +// Copyright 2018 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 + +load("test/mjsunit/wasm/wasm-constants.js"); +load("test/mjsunit/wasm/wasm-module-builder.js"); + +const kSequenceLength = 8192; +const kNumberOfWorkers = 4; +const kBitMask = kNumberOfWorkers - 1; +const kSequenceStartAddress = 32; + +function makeWorkerCodeForOpcode(compareExchangeOpcode, size, functionName, + builder) { + let loadMemOpcode = kTrapUnreachable; + switch (size) { + case 64: + loadMemOpcode = kExprI64LoadMem; + break; + case 32: + loadMemOpcode = kExprI64LoadMem32U; + break; + case 16: + loadMemOpcode = kExprI64LoadMem16U; + break; + case 8: + loadMemOpcode = kExprI64LoadMem8U; + break; + default: + throw "!"; + } + const kArgMemoryCell = 0; // target for atomic ops + const kArgSequencePtr = 1; // address of sequence + const kArgSeqenceLength = 2; // lenght of sequence + const kArgWorkerId = 3; // id of this worker + const kArgBitMask = 4; // mask to extract worker id from value + const kLocalCurrentOffset = 5; // current position in sequence in bytes + const kLocalExpectedValue = 6; // the value we are waiting for + const kLocalNextValue = 7; // the value to write in the update + let body = [ + // Turn sequence length to equivalent in bytes. + kExprGetLocal, kArgSeqenceLength, + kExprI32Const, size / 8, + kExprI32Mul, + kExprSetLocal, kArgSeqenceLength, + // Outer block so we have something to jump for return. + ...[kExprBlock, kWasmStmt, + // Set counter to 0. + kExprI32Const, 0, + kExprSetLocal, kLocalCurrentOffset, + // Outer loop until maxcount. + ...[kExprLoop, kWasmStmt, + // Find the next value to wait for. + ...[kExprLoop, kWasmStmt, + // Check end of sequence. + kExprGetLocal, kLocalCurrentOffset, + kExprGetLocal, kArgSeqenceLength, + kExprI32Eq, + kExprBrIf, 2, // return + ...[kExprBlock, kWasmStmt, + // Load next value. + kExprGetLocal, kArgSequencePtr, + kExprGetLocal, kLocalCurrentOffset, + kExprI32Add, + loadMemOpcode, 0, 0, + // Mask off bits. + kExprGetLocal, kArgBitMask, + kExprI64UConvertI32, + kExprI64And, + // Compare with worker id. + kExprGetLocal, kArgWorkerId, + kExprI64UConvertI32, + kExprI64Eq, + kExprBrIf, 0, + // Not found, increment position. + kExprGetLocal, kLocalCurrentOffset, + kExprI32Const, size / 8, + kExprI32Add, + kExprSetLocal, kLocalCurrentOffset, + kExprBr, 1, + kExprEnd + ], + // Found, end loop. + kExprEnd + ], + // Load expected value to local. + kExprGetLocal, kArgSequencePtr, + kExprGetLocal, kLocalCurrentOffset, + kExprI32Add, + loadMemOpcode, 0, 0, + kExprSetLocal, kLocalExpectedValue, + // Load value after expected one. + kExprGetLocal, kArgSequencePtr, + kExprGetLocal, kLocalCurrentOffset, + kExprI32Add, + kExprI32Const, size / 8, + kExprI32Add, + loadMemOpcode, 0, 0, + kExprSetLocal, kLocalNextValue, + // Hammer on memory until value found. + ...[kExprLoop, kWasmStmt, + // Load address. + kExprGetLocal, kArgMemoryCell, + // Load expected value. + kExprGetLocal, kLocalExpectedValue, + // Load updated value. + kExprGetLocal, kLocalNextValue, + // Try update. + kAtomicPrefix, compareExchangeOpcode, 0, 0, + // Load expected value. + kExprGetLocal, kLocalExpectedValue, + // Spin if not what expected. + kExprI64Ne, + kExprBrIf, 0, + kExprEnd + ], + // Next iteration of loop. + kExprGetLocal, kLocalCurrentOffset, + kExprI32Const, size / 8, + kExprI32Add, + kExprSetLocal, kLocalCurrentOffset, + kExprBr, 0, + kExprEnd + ], // outer loop + kExprEnd + ], // the block + kExprReturn + ]; + builder.addFunction(functionName, makeSig([kWasmI32, kWasmI32, kWasmI32, + kWasmI32, kWasmI32 + ], [])) + .addLocals({ + i32_count: 1, i64_count: 2 + }) + .addBody(body) + .exportAs(functionName); +} + +function generateSequence(typedarray, start, count) { + let end = count + start; + for (let i = start; i < end; i++) { + typedarray[i] = Math.floor(Math.random() * 256); + } +} + +function spawnWorker(module, memory, address, sequence) { + let workers = []; + for (let i = 0; i < kNumberOfWorkers; i++) { + let worker = new Worker( + `onmessage = function(msg) { + this.instance = new WebAssembly.Instance(msg.module, + {m: {imported_mem: msg.memory}}); + instance.exports.worker(msg.address, msg.sequence, msg.sequenceLength, msg.workerId, + msg.bitMask); + postMessage({workerId: msg.workerId}); + }`, + {type: 'string'} + ); + workers.push(worker); + worker.postMessage({ + module: module, + memory: memory, + address: address, + sequence: sequence, + sequenceLength: kSequenceLength, + workerId: i, + bitMask: kBitMask + }); + } + return workers; +} + +function waitForWorkers(workers) { + for (let worker of workers) { + worker.getMessage(); + worker.terminate(); + } +} + +function testOpcode(opcode, opcodeSize) { + print("Testing I64AtomicCompareExchange" + opcodeSize); + let builder = new WasmModuleBuilder(); + builder.addImportedMemory("m", "imported_mem", 0, 2, "shared"); + + makeWorkerCodeForOpcode(opcode, opcodeSize, "worker", builder); + + let memory = new WebAssembly.Memory({ + initial: 2, + maximum: 2, + shared: true + }); + let memoryView = new Uint8Array(memory.buffer); + generateSequence(memoryView, kSequenceStartAddress, kSequenceLength * (opcodeSize / 8)); + + let module = new WebAssembly.Module(builder.toBuffer()); + let workers = spawnWorker(module, memory, 0, kSequenceStartAddress); + + // Fire the workers off + for (let i = opcodeSize / 8 - 1; i >= 0; i--) { + memoryView[i] = memoryView[kSequenceStartAddress + i]; + } + + waitForWorkers(workers); + + print("DONE"); +} + +testOpcode(kExprI64AtomicCompareExchange, 64); +testOpcode(kExprI64AtomicCompareExchange32U, 32); +testOpcode(kExprI64AtomicCompareExchange16U, 16); +testOpcode(kExprI64AtomicCompareExchange8U, 8); diff --git a/deps/v8/test/mjsunit/wasm/data-segments.js b/deps/v8/test/mjsunit/wasm/data-segments.js index 571995931a..e73e3fb3a7 100644 --- a/deps/v8/test/mjsunit/wasm/data-segments.js +++ b/deps/v8/test/mjsunit/wasm/data-segments.js @@ -37,8 +37,6 @@ function GlobalImportedInitTest(pad) { var builder = new WasmModuleBuilder(); builder.addMemory(1, 1, false); - while (pad-- > 0) builder.addGlobal(kWasmI32); // pad - var g = builder.addImportedGlobal("mod", "offset", kWasmI32); while (pad-- > 0) builder.addGlobal(kWasmI32); // pad diff --git a/deps/v8/test/mjsunit/wasm/exceptions-export.js b/deps/v8/test/mjsunit/wasm/exceptions-export.js new file mode 100644 index 0000000000..72ec02dec3 --- /dev/null +++ b/deps/v8/test/mjsunit/wasm/exceptions-export.js @@ -0,0 +1,81 @@ +// Copyright 2018 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-wasm --experimental-wasm-eh + +load("test/mjsunit/wasm/wasm-constants.js"); +load("test/mjsunit/wasm/wasm-module-builder.js"); + +(function TestExportSimple() { + print(arguments.callee.name); + let builder = new WasmModuleBuilder(); + let except = builder.addException(kSig_v_v); + builder.addExportOfKind("ex", kExternalException, except); + let instance = builder.instantiate(); + + assertTrue(Object.prototype.hasOwnProperty.call(instance.exports, 'ex')); + assertEquals("object", typeof instance.exports.ex); + assertInstanceof(instance.exports.ex, WebAssembly.Exception); + assertSame(instance.exports.ex.constructor, WebAssembly.Exception); +})(); + +(function TestExportMultiple() { + print(arguments.callee.name); + let builder = new WasmModuleBuilder(); + let except1 = builder.addException(kSig_v_v); + let except2 = builder.addException(kSig_v_i); + builder.addExportOfKind("ex1a", kExternalException, except1); + builder.addExportOfKind("ex1b", kExternalException, except1); + builder.addExportOfKind("ex2", kExternalException, except2); + let instance = builder.instantiate(); + + assertTrue(Object.prototype.hasOwnProperty.call(instance.exports, 'ex1a')); + assertTrue(Object.prototype.hasOwnProperty.call(instance.exports, 'ex1b')); + assertTrue(Object.prototype.hasOwnProperty.call(instance.exports, 'ex2')); + assertSame(instance.exports.ex1a, instance.exports.ex1b); + assertNotSame(instance.exports.ex1a, instance.exports.ex2); +})(); + +(function TestExportOutOfBounds() { + print(arguments.callee.name); + let builder = new WasmModuleBuilder(); + let except = builder.addException(kSig_v_v); + builder.addExportOfKind("ex_oob", kExternalException, except + 1); + assertThrows( + () => builder.instantiate(), WebAssembly.CompileError, + /Wasm decoding failed: exception index 1 out of bounds/); +})(); + +(function TestExportSameNameTwice() { + print(arguments.callee.name); + let builder = new WasmModuleBuilder(); + let except = builder.addException(kSig_v_v); + builder.addExportOfKind("ex", kExternalException, except); + builder.addExportOfKind("ex", kExternalException, except); + assertThrows( + () => builder.instantiate(), WebAssembly.CompileError, + /Duplicate export name 'ex' for exception 0 and exception 0/); +})(); + +(function TestExportModuleGetExports() { + print(arguments.callee.name); + let builder = new WasmModuleBuilder(); + let except = builder.addException(kSig_v_v); + builder.addExportOfKind("ex", kExternalException, except); + let module = new WebAssembly.Module(builder.toBuffer()); + + let exports = WebAssembly.Module.exports(module); + assertArrayEquals([{ name: "ex", kind: "exception" }], exports); +})(); + +(function TestConstructorNonCallable() { + print(arguments.callee.name); + // TODO(wasm): Currently the constructor function of an exported exception is + // not callable. This can/will change once the proposal matures, at which + // point we should add a full exceptions-api.js test suite for the API and + // remove this test case from this file. + assertThrows( + () => WebAssembly.Exception(), TypeError, + /WebAssembly.Exception cannot be called/); +})(); diff --git a/deps/v8/test/mjsunit/wasm/exceptions-import.js b/deps/v8/test/mjsunit/wasm/exceptions-import.js new file mode 100644 index 0000000000..b5276727ba --- /dev/null +++ b/deps/v8/test/mjsunit/wasm/exceptions-import.js @@ -0,0 +1,96 @@ +// Copyright 2018 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-wasm --experimental-wasm-eh + +load("test/mjsunit/wasm/wasm-constants.js"); +load("test/mjsunit/wasm/wasm-module-builder.js"); + +// Helper function to return a new exported exception with the {kSig_v_v} type +// signature from an anonymous module. The underlying module is thrown away. +// This allows tests to reason solely about importing exceptions. +function NewExportedException() { + let builder = new WasmModuleBuilder(); + let except = builder.addException(kSig_v_v); + builder.addExportOfKind("ex", kExternalException, except); + let instance = builder.instantiate(); + return instance.exports.ex; +} + +(function TestImportSimple() { + print(arguments.callee.name); + let exported = NewExportedException(); + let builder = new WasmModuleBuilder(); + let except = builder.addImportedException("m", "ex", kSig_v_v); + + assertDoesNotThrow(() => builder.instantiate({ m: { ex: exported }})); +})(); + +(function TestImportMultiple() { + print(arguments.callee.name); + let exported = NewExportedException(); + let builder = new WasmModuleBuilder(); + let except1 = builder.addImportedException("m", "ex1", kSig_v_v); + let except2 = builder.addImportedException("m", "ex2", kSig_v_v); + let except3 = builder.addException(kSig_v_v); + builder.addExportOfKind("ex2", kExternalException, except2); + builder.addExportOfKind("ex3", kExternalException, except3); + let instance = builder.instantiate({ m: { ex1: exported, ex2: exported }}); + + assertTrue(except1 < except3 && except2 < except3); + assertEquals(undefined, instance.exports.ex1); + assertSame(exported, instance.exports.ex2); + assertNotSame(exported, instance.exports.ex3); +})(); + +(function TestImportMissing() { + print(arguments.callee.name); + let builder = new WasmModuleBuilder(); + let except = builder.addImportedException("m", "ex", kSig_v_v); + + assertThrows( + () => builder.instantiate({}), TypeError, + /module is not an object or function/); + assertThrows( + () => builder.instantiate({ m: {}}), WebAssembly.LinkError, + /exception import requires a WebAssembly.Exception/); +})(); + +(function TestImportValueMismatch() { + print(arguments.callee.name); + let builder = new WasmModuleBuilder(); + let except = builder.addImportedException("m", "ex", kSig_v_v); + + assertThrows( + () => builder.instantiate({ m: { ex: 23 }}), WebAssembly.LinkError, + /exception import requires a WebAssembly.Exception/); + assertThrows( + () => builder.instantiate({ m: { ex: {} }}), WebAssembly.LinkError, + /exception import requires a WebAssembly.Exception/); + var monkey = Object.create(NewExportedException()); + assertThrows( + () => builder.instantiate({ m: { ex: monkey }}), WebAssembly.LinkError, + /exception import requires a WebAssembly.Exception/); +})(); + +(function TestImportSignatureMismatch() { + print(arguments.callee.name); + let exported = NewExportedException(); + let builder = new WasmModuleBuilder(); + let except = builder.addImportedException("m", "ex", kSig_v_i); + + assertThrows( + () => builder.instantiate({ m: { ex: exported }}), WebAssembly.LinkError, + /imported exception does not match the expected type/); +})(); + +(function TestImportModuleGetImports() { + print(arguments.callee.name); + let builder = new WasmModuleBuilder(); + let except = builder.addImportedException("m", "ex", kSig_v_v); + let module = new WebAssembly.Module(builder.toBuffer()); + + let imports = WebAssembly.Module.imports(module); + assertArrayEquals([{ module: "m", name: "ex", kind: "exception" }], imports); +})(); diff --git a/deps/v8/test/mjsunit/wasm/exceptions-shared.js b/deps/v8/test/mjsunit/wasm/exceptions-shared.js new file mode 100644 index 0000000000..f2a5b56e9a --- /dev/null +++ b/deps/v8/test/mjsunit/wasm/exceptions-shared.js @@ -0,0 +1,158 @@ +// Copyright 2018 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-wasm --experimental-wasm-eh + +load("test/mjsunit/wasm/wasm-constants.js"); +load("test/mjsunit/wasm/wasm-module-builder.js"); + +// Helper function to return a new exported exception with the {kSig_v_v} type +// signature from an anonymous module. The underlying module is thrown away. +function NewExportedException() { + let builder = new WasmModuleBuilder(); + let except = builder.addException(kSig_v_v); + builder.addExportOfKind("ex", kExternalException, except); + let instance = builder.instantiate(); + return instance.exports.ex; +} + +// Check that an instance matches an exception thrown by itself, even when the +// exception is re-thrown by a regular JavaScript function. +(function TestSingleInstance() { + print(arguments.callee.name); + let builder = new WasmModuleBuilder(); + let sig_index = builder.addType(kSig_v_v); + let fun = builder.addImport("m", "f", sig_index); + let except = builder.addException(kSig_v_v); + builder.addFunction("throw", kSig_v_v) + .addBody([ + kExprThrow, except + ]).exportFunc(); + builder.addFunction("catch", kSig_v_v) + .addBody([ + kExprTry, kWasmStmt, + kExprCallFunction, fun, + kExprCatch, except, + kExprEnd, + ]).exportFunc(); + let ex_obj = new Error("my exception"); + let instance = builder.instantiate({ m: { f: function() { throw ex_obj }}}); + + assertThrows(() => instance.exports.throw(), WebAssembly.RuntimeError); + assertThrowsEquals(() => instance.exports.catch(), ex_obj); + try { + instance.exports.throw(); + } catch (e) { + ex_obj = e; + } + assertDoesNotThrow(() => instance.exports.catch()); +})(); + +// Check that two instances distinguish their individual exceptions if they are +// not shared, even when declared by the same underlying module. +(function TestMultiInstanceNonShared() { + print(arguments.callee.name); + let builder = new WasmModuleBuilder(); + let sig_index = builder.addType(kSig_v_v); + let fun = builder.addImport("m", "f", sig_index); + let except = builder.addException(kSig_v_v); + builder.addFunction("throw", kSig_v_v) + .addBody([ + kExprThrow, except + ]).exportFunc(); + builder.addFunction("catch", kSig_v_v) + .addBody([ + kExprTry, kWasmStmt, + kExprCallFunction, fun, + kExprCatch, except, + kExprEnd, + ]).exportFunc(); + let ex_obj = new Error("my exception"); + let instance1 = builder.instantiate({ m: { f: assertUnreachable }}); + let instance2 = builder.instantiate({ m: { f: function() { throw ex_obj }}}); + + assertThrows(() => instance1.exports.throw(), WebAssembly.RuntimeError); + assertThrowsEquals(() => instance2.exports.catch(), ex_obj); + try { + instance1.exports.throw(); + } catch (e) { + ex_obj = e; + } + assertThrowsEquals(() => instance2.exports.catch(), ex_obj); +})(); + +// Check that two instances match their exceptions if they are shared properly, +// even if the local exception index of export and import is different. +(function TestMultiInstanceShared() { + print(arguments.callee.name); + let builder = new WasmModuleBuilder(); + let sig_index = builder.addType(kSig_v_v); + let fun = builder.addImport("m", "f", sig_index); + let except1 = builder.addImportedException("m", "ex1", kSig_v_v); + let except2 = builder.addException(kSig_v_v); + builder.addExportOfKind("ex2", kExternalException, except2); + builder.addFunction("throw", kSig_v_v) + .addBody([ + kExprThrow, except2 + ]).exportFunc(); + builder.addFunction("catch", kSig_v_v) + .addBody([ + kExprTry, kWasmStmt, + kExprCallFunction, fun, + kExprCatch, except1, + kExprEnd, + ]).exportFunc(); + let ex_obj = new Error("my exception"); + let instance1 = builder.instantiate({ m: { f: assertUnreachable, + ex1: NewExportedException() }}); + let instance2 = builder.instantiate({ m: { f: function() { throw ex_obj }, + ex1: instance1.exports.ex2 }}); + + assertThrows(() => instance1.exports.throw(), WebAssembly.RuntimeError); + assertThrowsEquals(() => instance2.exports.catch(), ex_obj); + try { + instance1.exports.throw(); + } catch (e) { + ex_obj = e; + } + assertDoesNotThrow(() => instance2.exports.catch()); +})(); + +// Check that two instances based on different modules match their exceptions if +// they are shared properly, even if the local exception index is different. +(function TestMultiModuleShared() { + print(arguments.callee.name); + let builder1 = new WasmModuleBuilder(); + let except1 = builder1.addException(kSig_v_v); + let except2 = builder1.addException(kSig_v_v); + builder1.addExportOfKind("ex", kExternalException, except2); + builder1.addFunction("throw", kSig_v_v) + .addBody([ + kExprThrow, except2 + ]).exportFunc(); + let builder2 = new WasmModuleBuilder(); + let sig_index = builder2.addType(kSig_v_v); + let fun = builder2.addImport("m", "f", sig_index); + let except = builder2.addImportedException("m", "ex", kSig_v_v); + builder2.addFunction("catch", kSig_v_v) + .addBody([ + kExprTry, kWasmStmt, + kExprCallFunction, fun, + kExprCatch, except, + kExprEnd, + ]).exportFunc(); + let ex_obj = new Error("my exception"); + let instance1 = builder1.instantiate(); + let instance2 = builder2.instantiate({ m: { f: function() { throw ex_obj }, + ex: instance1.exports.ex }}); + + assertThrows(() => instance1.exports.throw(), WebAssembly.RuntimeError); + assertThrowsEquals(() => instance2.exports.catch(), ex_obj); + try { + instance1.exports.throw(); + } catch (e) { + ex_obj = e; + } + assertDoesNotThrow(() => instance2.exports.catch()); +})(); diff --git a/deps/v8/test/mjsunit/wasm/exceptions.js b/deps/v8/test/mjsunit/wasm/exceptions.js index 74d8e7dfb5..d165c8742d 100644 --- a/deps/v8/test/mjsunit/wasm/exceptions.js +++ b/deps/v8/test/mjsunit/wasm/exceptions.js @@ -1,84 +1,110 @@ -// Copyright 2015 the V8 project authors. All rights reserved. +// Copyright 2018 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-wasm --experimental-wasm-eh +// Flags: --expose-wasm --experimental-wasm-eh --allow-natives-syntax load("test/mjsunit/wasm/wasm-constants.js"); load("test/mjsunit/wasm/wasm-module-builder.js"); -// The following method doesn't attempt to catch an raised exception. -var test_throw = (function () { - var builder = new WasmModuleBuilder(); +function assertWasmThrows(instance, runtime_id, values, code) { + try { + if (typeof code === 'function') { + code(); + } else { + eval(code); + } + } catch (e) { + assertInstanceof(e, WebAssembly.RuntimeError); + var e_runtime_id = %GetWasmExceptionId(e, instance); + assertTrue(Number.isInteger(e_runtime_id)); + assertEquals(e_runtime_id, runtime_id); + var e_values = %GetWasmExceptionValues(e); + assertArrayEquals(values, e_values); + return; // Success. + } + throw new MjsUnitAssertionError('Did not throw expected <' + runtime_id + + '> with values: ' + values); +} + +// First we just test that "except_ref" local variables are allowed. +(function TestLocalExceptRef() { + let builder = new WasmModuleBuilder(); + builder.addFunction("push_and_drop_except_ref", kSig_v_v) + .addBody([ + kExprGetLocal, 0, + kExprDrop, + ]).addLocals({except_count: 1}).exportFunc(); + let instance = builder.instantiate(); - builder.addException(kSig_v_v); + assertDoesNotThrow(instance.exports.push_and_drop_except_ref); +})(); +// The following method doesn't attempt to catch an raised exception. +(function TestThrowSimple() { + let builder = new WasmModuleBuilder(); + let except = builder.addException(kSig_v_v); builder.addFunction("throw_if_param_not_zero", kSig_i_i) .addBody([ kExprGetLocal, 0, kExprI32Const, 0, kExprI32Ne, kExprIf, kWasmStmt, - kExprThrow, 0, + kExprThrow, except, kExprEnd, kExprI32Const, 1 ]).exportFunc(); + let instance = builder.instantiate(); - return builder.instantiate(); + assertEquals(1, instance.exports.throw_if_param_not_zero(0)); + assertWasmThrows(instance, except, [], () => instance.exports.throw_if_param_not_zero(10)); + assertWasmThrows(instance, except, [], () => instance.exports.throw_if_param_not_zero(-1)); })(); -// Check the test_throw exists. -assertFalse(test_throw === undefined); -assertFalse(test_throw === null); -assertFalse(test_throw === 0); -assertEquals("object", typeof test_throw.exports); -assertEquals("function", typeof test_throw.exports.throw_if_param_not_zero); +// Test that empty try/catch blocks work. +(function TestCatchEmptyBlocks() { + let builder = new WasmModuleBuilder(); + let except = builder.addException(kSig_v_v); + builder.addFunction("catch_empty_try", kSig_v_v) + .addBody([ + kExprTry, kWasmStmt, + kExprCatch, except, + kExprEnd, + ]).exportFunc(); + let instance = builder.instantiate(); -// Test expected behavior of throws -assertEquals(1, test_throw.exports.throw_if_param_not_zero(0)); -assertWasmThrows(0, [], function() { test_throw.exports.throw_if_param_not_zero(10) }); -assertWasmThrows(0, [], function() { test_throw.exports.throw_if_param_not_zero(-1) }); + assertDoesNotThrow(instance.exports.catch_empty_try); +})(); // Now that we know throwing works, we test catching the exceptions we raise. -var test_catch = (function () { - var builder = new WasmModuleBuilder(); - - builder.addException(kSig_v_v); +(function TestCatchSimple() { + let builder = new WasmModuleBuilder(); + let except = builder.addException(kSig_v_v); builder.addFunction("simple_throw_catch_to_0_1", kSig_i_i) .addBody([ kExprTry, kWasmI32, kExprGetLocal, 0, kExprI32Eqz, kExprIf, kWasmStmt, - kExprThrow, 0, + kExprThrow, except, kExprEnd, - kExprI32Const, 1, - kExprCatch, 0, - kExprI32Const, 0, + kExprI32Const, 42, + kExprCatch, except, + kExprI32Const, 23, kExprEnd ]).exportFunc(); + let instance = builder.instantiate(); - return builder.instantiate(); + assertEquals(23, instance.exports.simple_throw_catch_to_0_1(0)); + assertEquals(42, instance.exports.simple_throw_catch_to_0_1(1)); })(); -// Check the test_catch exists. -assertFalse(test_catch === undefined); -assertFalse(test_catch === null); -assertFalse(test_catch === 0); -assertEquals("object", typeof test_catch.exports); -assertEquals("function", typeof test_catch.exports.simple_throw_catch_to_0_1); - -// Test expected behavior of simple catch. -assertEquals(0, test_catch.exports.simple_throw_catch_to_0_1(0)); -assertEquals(1, test_catch.exports.simple_throw_catch_to_0_1(1)); - // Test that we can distinguish which exception was thrown. -var test_catch_2 = (function () { - var builder = new WasmModuleBuilder(); - - builder.addException(kSig_v_v); - builder.addException(kSig_v_v); - builder.addException(kSig_v_v); +(function TestCatchComplex() { + let builder = new WasmModuleBuilder(); + let except1 = builder.addException(kSig_v_v); + let except2 = builder.addException(kSig_v_v); + let except3 = builder.addException(kSig_v_v); builder.addFunction("catch_different_exceptions", kSig_i_i) .addBody([ kExprTry, kWasmI32, @@ -86,172 +112,122 @@ var test_catch_2 = (function () { kExprGetLocal, 0, kExprI32Eqz, kExprIf, kWasmStmt, - kExprThrow, 0, + kExprThrow, except1, kExprElse, kExprGetLocal, 0, kExprI32Const, 1, kExprI32Eq, kExprIf, kWasmStmt, - kExprThrow, 1, + kExprThrow, except2, kExprElse, - kExprThrow, 2, + kExprThrow, except3, kExprEnd, kExprEnd, kExprI32Const, 2, - kExprCatch, 0, + kExprCatch, except1, kExprI32Const, 3, kExprEnd, - kExprCatch, 1, + kExprCatch, except2, kExprI32Const, 4, kExprEnd ]).exportFunc(); - return builder.instantiate(); -})(); - -assertFalse(test_catch_2 === undefined); -assertFalse(test_catch_2 === null); -assertFalse(test_catch_2 === 0); -assertEquals("object", typeof test_catch_2.exports); -assertEquals("function", typeof test_catch_2.exports.catch_different_exceptions); + let instance = builder.instantiate(); -assertEquals(3, test_catch_2.exports.catch_different_exceptions(0)); -assertEquals(4, test_catch_2.exports.catch_different_exceptions(1)); -assertWasmThrows(2, [], function() { test_catch_2.exports.catch_different_exceptions(2) }); + assertEquals(3, instance.exports.catch_different_exceptions(0)); + assertEquals(4, instance.exports.catch_different_exceptions(1)); + assertWasmThrows(instance, except3, [], () => instance.exports.catch_different_exceptions(2)); +})(); // Test throwing an exception with multiple values. -var test_throw_1_2 = (function() { - var builder = new WasmModuleBuilder(); - builder.addException(kSig_v_ii); +(function TestThrowMultipleValues() { + let builder = new WasmModuleBuilder(); + let except = builder.addException(kSig_v_ii); builder.addFunction("throw_1_2", kSig_v_v) .addBody([ kExprI32Const, 1, kExprI32Const, 2, - kExprThrow, 0, + kExprThrow, except, ]).exportFunc(); + let instance = builder.instantiate(); - return builder.instantiate(); + assertWasmThrows(instance, except, [0, 1, 0, 2], () => instance.exports.throw_1_2()); })(); -assertFalse(test_throw_1_2 === undefined); -assertFalse(test_throw_1_2 === null); -assertFalse(test_throw_1_2 === 0); -assertEquals("object", typeof test_throw_1_2.exports); -assertEquals("function", typeof test_throw_1_2.exports.throw_1_2); - -assertWasmThrows(0, [0, 1, 0, 2], function() { test_throw_1_2.exports.throw_1_2(); }); - // Test throwing/catching the i32 parameter value. -var test_throw_catch_param_i = (function () { - var builder = new WasmModuleBuilder(); - builder.addException(kSig_v_i); +(function TestThrowCatchParamI() { + let builder = new WasmModuleBuilder(); + let except = builder.addException(kSig_v_i); builder.addFunction("throw_catch_param", kSig_i_i) .addBody([ kExprTry, kWasmI32, kExprGetLocal, 0, - kExprThrow, 0, + kExprThrow, except, kExprI32Const, 2, - kExprCatch, 0, + kExprCatch, except, kExprReturn, kExprEnd, ]).exportFunc(); + let instance = builder.instantiate(); - return builder.instantiate(); + assertEquals(0, instance.exports.throw_catch_param(0)); + assertEquals(1, instance.exports.throw_catch_param(1)); + assertEquals(10, instance.exports.throw_catch_param(10)); })(); -assertFalse(test_throw_catch_param_i === undefined); -assertFalse(test_throw_catch_param_i === null); -assertFalse(test_throw_catch_param_i === 0); -assertEquals("object", typeof test_throw_catch_param_i.exports); -assertEquals("function", - typeof test_throw_catch_param_i.exports.throw_catch_param); - -assertEquals(0, test_throw_catch_param_i.exports.throw_catch_param(0)); -assertEquals(1, test_throw_catch_param_i.exports.throw_catch_param(1)); -assertEquals(10, test_throw_catch_param_i.exports.throw_catch_param(10)); - // Test the encoding of a thrown exception with an integer exception. - -var test_throw_param_i = (function () { - var builder = new WasmModuleBuilder(); - builder.addException(kSig_v_i); +(function TestThrowParamI() { + let builder = new WasmModuleBuilder(); + let except = builder.addException(kSig_v_i); builder.addFunction("throw_param", kSig_v_i) .addBody([ kExprGetLocal, 0, - kExprThrow, 0, + kExprThrow, except, ]).exportFunc(); + let instance = builder.instantiate(); - return builder.instantiate(); + assertWasmThrows(instance, except, [0, 5], () => instance.exports.throw_param(5)); + assertWasmThrows(instance, except, [6, 31026], () => instance.exports.throw_param(424242)); })(); -assertFalse(test_throw_param_i === undefined); -assertFalse(test_throw_param_i === null); -assertFalse(test_throw_param_i === 0); -assertEquals("object", typeof test_throw_param_i.exports); -assertEquals("function", - typeof test_throw_param_i.exports.throw_param); - -assertWasmThrows(0, [0, 5], function() { test_throw_param_i.exports.throw_param(5); }); -assertWasmThrows(0, [6, 31026], - function() { test_throw_param_i.exports.throw_param(424242); }); - // Test throwing/catching the f32 parameter value. -var test_throw_catch_param_f = (function () { - var builder = new WasmModuleBuilder(); - builder.addException(kSig_v_f); +(function TestThrowCatchParamF() { + let builder = new WasmModuleBuilder(); + let except = builder.addException(kSig_v_f); builder.addFunction("throw_catch_param", kSig_f_f) .addBody([ kExprTry, kWasmF32, kExprGetLocal, 0, - kExprThrow, 0, + kExprThrow, except, kExprF32Const, 0, 0, 0, 0, - kExprCatch, 0, + kExprCatch, except, kExprReturn, kExprEnd, ]).exportFunc(); + let instance = builder.instantiate(); - return builder.instantiate(); + assertEquals(5.0, instance.exports.throw_catch_param(5.0)); + assertEquals(10.5, instance.exports.throw_catch_param(10.5)); })(); -assertFalse(test_throw_catch_param_f === undefined); -assertFalse(test_throw_catch_param_f === null); -assertFalse(test_throw_catch_param_f === 0); -assertEquals("object", typeof test_throw_catch_param_f.exports); -assertEquals("function", - typeof test_throw_catch_param_f.exports.throw_catch_param); - -assertEquals(5.0, test_throw_catch_param_f.exports.throw_catch_param(5.0)); -assertEquals(10.5, test_throw_catch_param_f.exports.throw_catch_param(10.5)); - // Test the encoding of a thrown exception with a float value. - -var test_throw_param_f = (function () { - var builder = new WasmModuleBuilder(); - builder.addException(kSig_v_f); +(function TestThrowParamF() { + let builder = new WasmModuleBuilder(); + let except = builder.addException(kSig_v_f); builder.addFunction("throw_param", kSig_v_f) .addBody([ kExprGetLocal, 0, - kExprThrow, 0, + kExprThrow, except, ]).exportFunc(); + let instance = builder.instantiate(); - return builder.instantiate(); + assertWasmThrows(instance, except, [16544, 0], () => instance.exports.throw_param(5.0)); + assertWasmThrows(instance, except, [16680, 0], () => instance.exports.throw_param(10.5)); })(); -assertFalse(test_throw_param_f === undefined); -assertFalse(test_throw_param_f === null); -assertFalse(test_throw_param_f === 0); -assertEquals("object", typeof test_throw_param_f.exports); -assertEquals("function", - typeof test_throw_param_f.exports.throw_param); - -assertWasmThrows(0, [16544, 0], - function() { test_throw_param_f.exports.throw_param(5.0); }); -assertWasmThrows(0, [16680, 0], - function() { test_throw_param_f.exports.throw_param(10.5); }); - // Test throwing/catching an I64 value -var test_throw_catch_param_l = (function () { - var builder = new WasmModuleBuilder(); - builder.addException(kSig_v_l); +(function TestThrowCatchParamL() { + let builder = new WasmModuleBuilder(); + let except = builder.addException(kSig_v_l); builder.addFunction("throw_catch_param", kSig_i_i) .addBody([ kExprGetLocal, 0, @@ -259,9 +235,9 @@ var test_throw_catch_param_l = (function () { kExprSetLocal, 1, kExprTry, kWasmI32, kExprGetLocal, 1, - kExprThrow, 0, + kExprThrow, except, kExprI32Const, 2, - kExprCatch, 0, + kExprCatch, except, kExprGetLocal, 1, kExprI64Eq, kExprIf, kWasmI32, @@ -273,26 +249,17 @@ var test_throw_catch_param_l = (function () { kExprReturn, kExprEnd, ]).addLocals({i64_count: 1}).exportFunc(); + let instance = builder.instantiate(); - return builder.instantiate(); + assertEquals(1, instance.exports.throw_catch_param(5)); + assertEquals(1, instance.exports.throw_catch_param(0)); + assertEquals(1, instance.exports.throw_catch_param(-1)); })(); -assertFalse(test_throw_catch_param_l === undefined); -assertFalse(test_throw_catch_param_l === null); -assertFalse(test_throw_catch_param_l === 0); -assertEquals("object", typeof test_throw_catch_param_l.exports); -assertEquals("function", - typeof test_throw_catch_param_l.exports.throw_catch_param); - -assertEquals(1, test_throw_catch_param_l.exports.throw_catch_param(5)); -assertEquals(1, test_throw_catch_param_l.exports.throw_catch_param(0)); -assertEquals(1, test_throw_catch_param_l.exports.throw_catch_param(-1)); - // Test the encoding of a thrown exception with an I64 value. - -var test_throw_param_l = (function () { - var builder = new WasmModuleBuilder(); - builder.addException(kSig_v_l); +(function TestThrowParamL() { + let builder = new WasmModuleBuilder(); + let except = builder.addException(kSig_v_l); builder.addFunction("throw_param", kSig_v_ii) .addBody([ kExprGetLocal, 0, @@ -302,428 +269,357 @@ var test_throw_param_l = (function () { kExprGetLocal, 1, kExprI64UConvertI32, kExprI64Ior, - kExprThrow, 0 + kExprThrow, except, ]).exportFunc(); + let instance = builder.instantiate(); - return builder.instantiate(); + assertWasmThrows(instance, except, [0, 10, 0, 5], () => instance.exports.throw_param(10, 5)); + assertWasmThrows(instance, except, [65535, 65535, 0, 13], () => instance.exports.throw_param(-1, 13)); })(); -assertFalse(test_throw_param_l === undefined); -assertFalse(test_throw_param_l === null); -assertFalse(test_throw_param_l === 0); -assertEquals("object", typeof test_throw_param_l.exports); -assertEquals("function", - typeof test_throw_param_l.exports.throw_param); - -assertWasmThrows(0, [0, 10, 0, 5], - function() { test_throw_param_l.exports.throw_param(10, 5); }); -assertWasmThrows(0, [65535, 65535, 0, 13], - function() { test_throw_param_l.exports.throw_param(-1, 13); }); - // Test throwing/catching the F64 parameter value -var test_throw_catch_param_d = (function () { - var builder = new WasmModuleBuilder(); - builder.addException(kSig_v_d); +(function TestThrowCatchParamD() { + let builder = new WasmModuleBuilder(); + let except = builder.addException(kSig_v_d); builder.addFunction("throw_catch_param", kSig_d_d) .addBody([ kExprTry, kWasmF64, kExprGetLocal, 0, - kExprThrow, 0, + kExprThrow, except, kExprF64Const, 0, 0, 0, 0, 0, 0, 0, 0, - kExprCatch, 0, + kExprCatch, except, kExprReturn, kExprEnd, ]).exportFunc(); + let instance = builder.instantiate(); - return builder.instantiate(); + assertEquals(5.0, instance.exports.throw_catch_param(5.0)); + assertEquals(10.5, instance.exports.throw_catch_param(10.5)); })(); -assertFalse(test_throw_catch_param_d === undefined); -assertFalse(test_throw_catch_param_d === null); -assertFalse(test_throw_catch_param_d === 0); -assertEquals("object", typeof test_throw_catch_param_d.exports); -assertEquals("function", - typeof test_throw_catch_param_d.exports.throw_catch_param); - -assertEquals(5.0, test_throw_catch_param_d.exports.throw_catch_param(5.0)); -assertEquals(10.5, test_throw_catch_param_d.exports.throw_catch_param(10.5)); - // Test the encoding of a thrown exception with an f64 value. - -var test_throw_param_d = (function () { - var builder = new WasmModuleBuilder(); - builder.addException(kSig_v_d); +(function TestThrowParamD() { + let builder = new WasmModuleBuilder(); + let except = builder.addException(kSig_v_d); builder.addFunction("throw_param", kSig_v_f) .addBody([ kExprGetLocal, 0, kExprF64ConvertF32, - kExprThrow, 0 + kExprThrow, except, ]).exportFunc(); + let instance = builder.instantiate(); - return builder.instantiate(); + assertWasmThrows(instance, except, [16404, 0, 0, 0], () => instance.exports.throw_param(5.0)); + assertWasmThrows(instance, except, [16739, 4816, 0, 0], () => instance.exports.throw_param(10000000.5)); })(); -assertFalse(test_throw_param_d === undefined); -assertFalse(test_throw_param_d === null); -assertFalse(test_throw_param_d === 0); -assertEquals("object", typeof test_throw_param_d.exports); -assertEquals("function", - typeof test_throw_param_d.exports.throw_param); - -assertWasmThrows(0, [16404, 0, 0, 0], - function() { test_throw_param_d.exports.throw_param(5.0); }); -assertWasmThrows(0, [16739, 4816, 0, 0], - function() { test_throw_param_d.exports.throw_param(10000000.5); }); - -/* TODO(kschimpf) Convert these tests to work for the proposed exceptions. - -// The following methods do not attempt to catch the exception they raise. -var test_throw = (function () { - var builder = new WasmModuleBuilder(); - +// Test the encoding of a computed parameter value. +(function TestThrowParamComputed() { + let builder = new WasmModuleBuilder(); + let except = builder.addException(kSig_v_i); 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, - kExprF64Min, - kExprF64Add, - kExprI32SConvertF64, - kExprI32Mul, - kExprI32Const, 20, - kExprI32Sub, - kExprThrow, - ]) - .exportFunc() - - return builder.instantiate(); + .addBody([ + // p2 * (p0 + min(p0, p1))|0 - 20 + kExprGetLocal, 2, + kExprGetLocal, 0, + kExprGetLocal, 0, + kExprGetLocal, 1, + kExprF64Min, + kExprF64Add, + kExprI32SConvertF64, + kExprI32Mul, + kExprI32Const, 20, + kExprI32Sub, + kExprThrow, except, + ]).exportFunc() + let instance = builder.instantiate(); + + assertWasmThrows(instance, except, [65535, 65536-8], () => instance.exports.throw_expr_with_params(1.5, 2.5, 4)); + assertWasmThrows(instance, except, [0, 12], () => instance.exports.throw_expr_with_params(5.7, 2.5, 4)); })(); -// Check the test_throw exists. -assertFalse(test_throw === undefined); -assertFalse(test_throw === null); -assertFalse(test_throw === 0); -assertEquals("object", typeof test_throw.exports); -assertEquals("function", typeof test_throw.exports.throw_expr_with_params); - -assertEquals(1, test_throw.exports.throw_param_if_not_zero(0)); -assertWasmThrows( - -8, function() { test_throw.exports.throw_expr_with_params(1.5, 2.5, 4); }); -assertWasmThrows( - 12, function() { test_throw.exports.throw_expr_with_params(5.7, 2.5, 4); }); - -// Now that we know throwing works, we test catching the exceptions we raise. -var test_catch = (function () { - var builder = new WasmModuleBuilder(); - - // Helper function for throwing from js. It is imported by the Wasm module - // as throw_i. - function throw_value(value) { - throw value; - } - var sig_index = builder.addType(kSig_v_i); - var kJSThrowI = builder.addImport("", "throw_i", sig_index); - - // Helper function that throws a string. Wasm should not catch it. - function throw_string() { - throw "use wasm;"; - } - sig_index = builder.addType(kSig_v_v); - var kJSThrowString = builder.addImport("", "throw_string", sig_index); - - // Helper function that throws undefined. Wasm should not catch it. - function throw_undefined() { - throw undefined; - } - var kJSThrowUndefined = builder.addImport("", "throw_undefined", sig_index); - - // Helper function that throws an fp. Wasm should not catch it. - function throw_fp() { - throw 10.5; - } - var kJSThrowFP = builder.addImport("", "throw_fp", sig_index); - - // Helper function that throws a large number. Wasm should not catch it. - function throw_large() { - throw 1e+28; - } - var kJSThrowLarge = builder.addImport("", "throw_large", sig_index); +// Now that we know catching works locally, we test catching exceptions that +// cross function boundaries and/or raised by JavaScript. +(function TestCatchCrossFunctions() { + let builder = new WasmModuleBuilder(); + let except = builder.addException(kSig_v_i); + + // Helper function for throwing from JS. It is imported by the Wasm module + // as throw_i. + function throw_value(value) { + throw value; + } + let sig_index = builder.addType(kSig_v_i); + let kJSThrowI = builder.addImport("", "throw_i", sig_index); + + // Helper function that throws a string. Wasm should not catch it. + function throw_string() { + throw "use wasm"; + } + sig_index = builder.addType(kSig_v_v); + let kJSThrowString = builder.addImport("", "throw_string", sig_index); + + // Helper function that throws undefined. Wasm should not catch it. + function throw_undefined() { + throw undefined; + } + let kJSThrowUndefined = builder.addImport("", "throw_undefined", sig_index); + + // Helper function that throws an fp. Wasm should not catch it. + function throw_fp() { + throw 10.5; + } + let kJSThrowFP = builder.addImport("", "throw_fp", sig_index); + + // Helper function that throws a large number. Wasm should not catch it. + function throw_large() { + throw 1e+28; + } + let kJSThrowLarge = builder.addImport("", "throw_large", sig_index); + + // Helper function for throwing from WebAssembly. + let kWasmThrowFunction = + builder.addFunction("throw", kSig_v_i) + .addBody([ + kExprGetLocal, 0, + kExprThrow, except, + ]) + .index; - // Helper function for throwing from WebAssembly. - var kWasmThrowFunction = - builder.addFunction("throw", kSig_v_i) - .addBody([ + // Scenario 1: Throw and catch appear on the same function. This should + // happen in case of inlining, for example. + builder.addFunction("same_scope", kSig_i_i) + .addBody([ + kExprTry, kWasmI32, + kExprGetLocal, 0, + kExprI32Const, 0, + kExprI32Ne, + kExprIf, kWasmStmt, kExprGetLocal, 0, - kExprThrow - ]) - .index; + kExprThrow, except, + kExprUnreachable, + kExprEnd, + kExprI32Const, 63, + kExprCatch, except, + kExprEnd + ]) + .exportFunc(); - // Scenario 1: Throw and catch appear on the same function. This should - // happen in case of inlining, for example. - builder.addFunction("same_scope", kSig_i_i) - .addBody([ + builder.addFunction("same_scope_ignore", kSig_i_i) + .addBody([ kExprTry, kWasmI32, kExprGetLocal, 0, - kExprI32Const, 0, - kExprI32Ne, - kExprIf, kWasmStmt, - kExprGetLocal, 0, - kExprThrow, - kExprUnreachable, - kExprEnd, - kExprI32Const, 63, - kExprCatch, 1, - kExprGetLocal, 1, - kExprEnd - ]) - .addLocals({i32_count: 1}) - .exportFunc() - .index; - - builder.addFunction("same_scope_ignore", kSig_i_i) - .addBody([ - kExprTry, kWasmI32, - kExprGetLocal, 0, - kExprThrow, - kExprUnreachable, - kExprCatch, 1, - kExprGetLocal, 0, - kExprEnd, - ]) - .addLocals({i32_count: 1}) - .exportFunc(); - - builder.addFunction("same_scope_multiple", kSig_i_i) - // path = 0; - // - // try { - // try { - // try { - // if (p == 1) - // throw 1; - // path |= 2 - // } catch (v) { - // path |= v | 4; - // throw path; - // } - // if (p == 2) - // throw path|8; - // path |= 16; - // } catch (v) { - // path |= v | 32; - // throw path; - // } - // if (p == 3) - // throw path|64; - // path |= 128 - // } catch (v) { - // path |= v | 256; - // } - // - // return path; - // - // p == 1 -> path == 293 - // p == 2 -> path == 298 - // p == 3 -> path == 338 - // else -> path == 146 - .addBody([ + kExprThrow, except, + kExprUnreachable, + kExprCatch, except, + kExprEnd, + ]) + .exportFunc(); + + builder.addFunction("same_scope_multiple", kSig_i_i) + // path = 0; + // + // try { + // try { + // try { + // if (p == 1) + // throw 1; + // path |= 2 + // } catch (v) { + // path |= v | 4; + // throw path; + // } + // if (p == 2) + // throw path|8; + // path |= 16; + // } catch (v) { + // path |= v | 32; + // throw path; + // } + // if (p == 3) + // throw path|64; + // path |= 128 + // } catch (v) { + // path |= v | 256; + // } + // + // return path; + // + // p == 1 -> path == 293 + // p == 2 -> path == 298 + // p == 3 -> path == 338 + // else -> path == 146 + .addBody([ + kExprTry, kWasmI32, kExprTry, kWasmI32, kExprTry, kWasmI32, - kExprTry, kWasmI32, - kExprGetLocal, 0, - kExprI32Const, 1, - kExprI32Eq, - kExprIf, kWasmStmt, - kExprI32Const, 1, - kExprThrow, - kExprUnreachable, - kExprEnd, - kExprI32Const, 2, - kExprCatch, 1, - kExprGetLocal, 1, - kExprI32Const, 4, - kExprI32Ior, - kExprThrow, - kExprUnreachable, - kExprEnd, - kExprTeeLocal, 2, kExprGetLocal, 0, - kExprI32Const, 2, + kExprI32Const, 1, kExprI32Eq, kExprIf, kWasmStmt, - kExprGetLocal, 2, - kExprI32Const, 8, - kExprI32Ior, - kExprThrow, + kExprI32Const, 1, + kExprThrow, except, kExprUnreachable, kExprEnd, - kExprI32Const, 16, - kExprI32Ior, - kExprCatch, 1, - kExprGetLocal, 1, - kExprI32Const, 32, + kExprI32Const, 2, + kExprCatch, except, + kExprI32Const, 4, kExprI32Ior, - kExprThrow, + kExprThrow, except, kExprUnreachable, kExprEnd, - kExprTeeLocal, 2, + kExprTeeLocal, 1, kExprGetLocal, 0, - kExprI32Const, 3, + kExprI32Const, 2, kExprI32Eq, kExprIf, kWasmStmt, - kExprGetLocal, 2, - kExprI32Const, / *64=* / 192, 0, + kExprGetLocal, 1, + kExprI32Const, 8, kExprI32Ior, - kExprThrow, + kExprThrow, except, kExprUnreachable, kExprEnd, - kExprI32Const, / *128=* / 128, 1, + kExprI32Const, 16, kExprI32Ior, - kExprCatch, 1, + kExprCatch, except, + kExprI32Const, 32, + kExprI32Ior, + kExprThrow, except, + kExprUnreachable, + kExprEnd, + kExprTeeLocal, 1, + kExprGetLocal, 0, + kExprI32Const, 3, + kExprI32Eq, + kExprIf, kWasmStmt, kExprGetLocal, 1, - kExprI32Const, / *256=* / 128, 2, + kExprI32Const, /*64=*/ 192, 0, kExprI32Ior, + kExprThrow, except, + kExprUnreachable, kExprEnd, - ]) - .addLocals({i32_count: 2}) - .exportFunc(); + kExprI32Const, /*128=*/ 128, 1, + kExprI32Ior, + kExprCatch, except, + kExprI32Const, /*256=*/ 128, 2, + kExprI32Ior, + kExprEnd, + ]) + .addLocals({i32_count: 1}) + .exportFunc(); - // Scenario 2: Catches an exception raised from the direct callee. - var kFromDirectCallee = - builder.addFunction("from_direct_callee", kSig_i_i) - .addBody([ - kExprTry, kWasmI32, - kExprGetLocal, 0, - kExprCallFunction, kWasmThrowFunction, - kExprI32Const, / *-1=* / 127, - kExprCatch, 1, - kExprGetLocal, 1, - kExprEnd - ]) - .addLocals({i32_count: 1}) - .exportFunc() - .index; - - // Scenario 3: Catches an exception raised from an indirect callee. - var kFromIndirectCalleeHelper = kFromDirectCallee + 1; - builder.addFunction("from_indirect_callee_helper", kSig_v_ii) - .addBody([ + // Scenario 2: Catches an exception raised from the direct callee. + builder.addFunction("from_direct_callee", kSig_i_i) + .addBody([ + kExprTry, kWasmI32, kExprGetLocal, 0, - kExprI32Const, 0, - kExprI32GtS, - kExprIf, kWasmStmt, - kExprGetLocal, 0, - kExprI32Const, 1, - kExprI32Sub, - kExprGetLocal, 1, - kExprI32Const, 1, - kExprI32Sub, - kExprCallFunction, kFromIndirectCalleeHelper, - kExprEnd, - kExprGetLocal, 1, kExprCallFunction, kWasmThrowFunction, - ]); + kExprUnreachable, + kExprCatch, except, + kExprEnd, + ]) + .exportFunc(); - builder.addFunction("from_indirect_callee", kSig_i_i) - .addBody([ - kExprTry, kWasmI32, - kExprGetLocal, 0, - kExprI32Const, 0, - kExprCallFunction, kFromIndirectCalleeHelper, - kExprI32Const, / *-1=* / 127, - kExprCatch, 1, - kExprGetLocal, 1, - kExprEnd - ]) - .addLocals({i32_count: 1}) - .exportFunc(); + // Scenario 3: Catches an exception raised from an indirect callee. + let sig_v_i = builder.addType(kSig_v_i); + builder.appendToTable([kWasmThrowFunction, kWasmThrowFunction]); + builder.addFunction("from_indirect_callee", kSig_i_ii) + .addBody([ + kExprTry, kWasmI32, + kExprGetLocal, 0, + kExprGetLocal, 1, + kExprCallIndirect, sig_v_i, kTableZero, + kExprUnreachable, + kExprCatch, except, + kExprEnd + ]) + .exportFunc(); - // Scenario 4: Catches an exception raised in JS. - builder.addFunction("from_js", kSig_i_i) - .addBody([ - kExprTry, kWasmI32, - kExprGetLocal, 0, - kExprCallFunction, kJSThrowI, - kExprI32Const, / *-1=* / 127, - kExprCatch, 1, - kExprGetLocal, 1, - kExprEnd, - ]) - .addLocals({i32_count: 1}) - .exportFunc(); + // Scenario 4: Does not catch an exception raised in JS, even if primitive + // values are being used as exceptions. + builder.addFunction("i_from_js", kSig_i_i) + .addBody([ + kExprTry, kWasmI32, + kExprGetLocal, 0, + kExprCallFunction, kJSThrowI, + kExprUnreachable, + kExprCatch, except, + kExprUnreachable, + kExprEnd, + ]) + .exportFunc(); - // Scenario 5: Does not catch an exception raised in JS if it is not a - // number. - builder.addFunction("string_from_js", kSig_v_v) - .addBody([ - kExprCallFunction, kJSThrowString - ]) - .exportFunc(); + builder.addFunction("string_from_js", kSig_v_v) + .addBody([ + kExprTry, kWasmStmt, + kExprCallFunction, kJSThrowString, + kExprCatch, except, + kExprUnreachable, + kExprEnd, + ]) + .exportFunc(); - builder.addFunction("fp_from_js", kSig_v_v) - .addBody([ - kExprCallFunction, kJSThrowFP - ]) - .exportFunc(); + builder.addFunction("fp_from_js", kSig_v_v) + .addBody([ + kExprTry, kWasmStmt, + kExprCallFunction, kJSThrowFP, + kExprCatch, except, + kExprUnreachable, + kExprEnd, + ]) + .exportFunc(); - builder.addFunction("large_from_js", kSig_v_v) - .addBody([ - kExprCallFunction, kJSThrowLarge - ]) - .exportFunc(); + builder.addFunction("large_from_js", kSig_v_v) + .addBody([ + kExprTry, kWasmStmt, + kExprCallFunction, kJSThrowLarge, + kExprCatch, except, + kExprUnreachable, + kExprEnd, + ]) + .exportFunc(); - builder.addFunction("undefined_from_js", kSig_v_v) - .addBody([ - kExprCallFunction, kJSThrowUndefined - ]) - .exportFunc(); + builder.addFunction("undefined_from_js", kSig_v_v) + .addBody([ + kExprTry, kWasmStmt, + kExprCallFunction, kJSThrowUndefined, + kExprCatch, except, + kExprUnreachable, + kExprEnd, + ]) + .exportFunc(); - return builder.instantiate({"": { + let instance = builder.instantiate({"": { throw_i: throw_value, throw_string: throw_string, throw_fp: throw_fp, throw_large, throw_large, throw_undefined: throw_undefined }}); -})(); -// Check the test_catch exists. -assertFalse(test_catch === undefined); -assertFalse(test_catch === null); -assertFalse(test_catch === 0); -assertEquals("object", typeof test_catch.exports); -assertEquals("function", typeof test_catch.exports.same_scope); -assertEquals("function", typeof test_catch.exports.same_scope_ignore); -assertEquals("function", typeof test_catch.exports.same_scope_multiple); -assertEquals("function", typeof test_catch.exports.from_direct_callee); -assertEquals("function", typeof test_catch.exports.from_indirect_callee); -assertEquals("function", typeof test_catch.exports.from_js); -assertEquals("function", typeof test_catch.exports.string_from_js); - -assertEquals(63, test_catch.exports.same_scope(0)); -assertEquals(1024, test_catch.exports.same_scope(1024)); -assertEquals(-3, test_catch.exports.same_scope(-3)); -assertEquals(-1, test_catch.exports.same_scope_ignore(-1)); -assertEquals(1, test_catch.exports.same_scope_ignore(1)); -assertEquals(0x7FFFFFFF, test_catch.exports.same_scope_ignore(0x7FFFFFFF)); -assertEquals(1024, test_catch.exports.same_scope_ignore(1024)); -assertEquals(-1, test_catch.exports.same_scope_ignore(-1)); -assertEquals(293, test_catch.exports.same_scope_multiple(1)); -assertEquals(298, test_catch.exports.same_scope_multiple(2)); -assertEquals(338, test_catch.exports.same_scope_multiple(3)); -assertEquals(146, test_catch.exports.same_scope_multiple(0)); -assertEquals(-10024, test_catch.exports.from_direct_callee(-10024)); -assertEquals(3334333, test_catch.exports.from_direct_callee(3334333)); -assertEquals(-1, test_catch.exports.from_direct_callee(0xFFFFFFFF)); -assertEquals(0x7FFFFFFF, test_catch.exports.from_direct_callee(0x7FFFFFFF)); -assertEquals(-10, test_catch.exports.from_indirect_callee(10)); -assertEquals(-77, test_catch.exports.from_indirect_callee(77)); -assertEquals(10, test_catch.exports.from_js(10)); -assertEquals(-10, test_catch.exports.from_js(-10)); - -assertThrowsEquals(test_catch.exports.string_from_js, "use wasm;"); -assertThrowsEquals(test_catch.exports.large_from_js, 1e+28); -assertThrowsEquals(test_catch.exports.undefined_from_js, undefined); -*/ + assertEquals(63, instance.exports.same_scope(0)); + assertEquals(1024, instance.exports.same_scope(1024)); + assertEquals(-3, instance.exports.same_scope(-3)); + assertEquals(-1, instance.exports.same_scope_ignore(-1)); + assertEquals(1, instance.exports.same_scope_ignore(1)); + assertEquals(0x7FFFFFFF, instance.exports.same_scope_ignore(0x7FFFFFFF)); + assertEquals(1024, instance.exports.same_scope_ignore(1024)); + assertEquals(-1, instance.exports.same_scope_ignore(-1)); + assertEquals(293, instance.exports.same_scope_multiple(1)); + assertEquals(298, instance.exports.same_scope_multiple(2)); + assertEquals(338, instance.exports.same_scope_multiple(3)); + assertEquals(146, instance.exports.same_scope_multiple(0)); + assertEquals(-10024, instance.exports.from_direct_callee(-10024)); + assertEquals(3334333, instance.exports.from_direct_callee(3334333)); + assertEquals(-1, instance.exports.from_direct_callee(0xFFFFFFFF)); + assertEquals(0x7FFFFFFF, instance.exports.from_direct_callee(0x7FFFFFFF)); + assertEquals(10, instance.exports.from_indirect_callee(10, 0)); + assertEquals(77, instance.exports.from_indirect_callee(77, 1)); + + assertThrowsEquals(() => instance.exports.i_from_js(10), 10); + assertThrowsEquals(() => instance.exports.i_from_js(-10), -10); + assertThrowsEquals(instance.exports.string_from_js, "use wasm"); + assertThrowsEquals(instance.exports.fp_from_js, 10.5); + assertThrowsEquals(instance.exports.large_from_js, 1e+28); + assertThrowsEquals(instance.exports.undefined_from_js, undefined); +})(); diff --git a/deps/v8/test/mjsunit/wasm/grow-memory-detaching.js b/deps/v8/test/mjsunit/wasm/grow-memory-detaching.js index da6516afd7..69273d9184 100644 --- a/deps/v8/test/mjsunit/wasm/grow-memory-detaching.js +++ b/deps/v8/test/mjsunit/wasm/grow-memory-detaching.js @@ -9,7 +9,7 @@ load("test/mjsunit/wasm/wasm-module-builder.js"); let module = (() => { let builder = new WasmModuleBuilder(); - builder.addMemory(1, kV8MaxPages, false); + builder.addMemory(1, undefined, false); builder.addFunction("grow_memory", kSig_i_i) .addBody([kExprGetLocal, 0, kExprGrowMemory, kMemoryZero]) .exportFunc(); diff --git a/deps/v8/test/mjsunit/wasm/grow-memory.js b/deps/v8/test/mjsunit/wasm/grow-memory.js index fc82dc6004..48e3252d08 100644 --- a/deps/v8/test/mjsunit/wasm/grow-memory.js +++ b/deps/v8/test/mjsunit/wasm/grow-memory.js @@ -37,11 +37,15 @@ function genGrowMemoryBuilder() { return builder; } +// V8 internal memory size limit. +var kV8MaxPages = 32767; + + // TODO(gdeepti): Generate tests programatically for all the sizes instead of // current implementation. function testGrowMemoryReadWrite32() { var builder = genGrowMemoryBuilder(); - builder.addMemory(1, kV8MaxPages, false); + builder.addMemory(1, undefined, false); var module = builder.instantiate(); var offset; function peek() { return module.exports.load(offset); } @@ -88,7 +92,7 @@ testGrowMemoryReadWrite32(); function testGrowMemoryReadWrite16() { var builder = genGrowMemoryBuilder(); - builder.addMemory(1, kV8MaxPages, false); + builder.addMemory(1, undefined, false); var module = builder.instantiate(); var offset; function peek() { return module.exports.load16(offset); } @@ -135,7 +139,7 @@ testGrowMemoryReadWrite16(); function testGrowMemoryReadWrite8() { var builder = genGrowMemoryBuilder(); - builder.addMemory(1, kV8MaxPages, false); + builder.addMemory(1, undefined, false); var module = builder.instantiate(); var offset; function peek() { return module.exports.load8(offset); } @@ -182,7 +186,7 @@ testGrowMemoryReadWrite8(); function testGrowMemoryZeroInitialSize() { var builder = genGrowMemoryBuilder(); - builder.addMemory(0, kV8MaxPages, false); + builder.addMemory(0, undefined, false); var module = builder.instantiate(); var offset; function peek() { return module.exports.load(offset); } @@ -216,7 +220,7 @@ testGrowMemoryZeroInitialSize(); function testGrowMemoryZeroInitialSize32() { var builder = genGrowMemoryBuilder(); - builder.addMemory(0, kV8MaxPages, false); + builder.addMemory(0, undefined, false); var module = builder.instantiate(); var offset; function peek() { return module.exports.load(offset); } @@ -242,7 +246,7 @@ testGrowMemoryZeroInitialSize32(); function testGrowMemoryZeroInitialSize16() { var builder = genGrowMemoryBuilder(); - builder.addMemory(0, kV8MaxPages, false); + builder.addMemory(0, undefined, false); var module = builder.instantiate(); var offset; function peek() { return module.exports.load16(offset); } @@ -268,7 +272,7 @@ testGrowMemoryZeroInitialSize16(); function testGrowMemoryZeroInitialSize8() { var builder = genGrowMemoryBuilder(); - builder.addMemory(0, kV8MaxPages, false); + builder.addMemory(0, undefined, false); var module = builder.instantiate(); var offset; function peek() { return module.exports.load8(offset); } @@ -294,7 +298,7 @@ testGrowMemoryZeroInitialSize8(); function testGrowMemoryTrapMaxPagesZeroInitialMemory() { var builder = genGrowMemoryBuilder(); - builder.addMemory(0, kV8MaxPages, false); + builder.addMemory(0, undefined, false); var module = builder.instantiate(); function growMem(pages) { return module.exports.grow_memory(pages); } assertEquals(-1, growMem(kV8MaxPages + 1)); @@ -314,7 +318,7 @@ testGrowMemoryTrapMaxPages(); function testGrowMemoryTrapsWithNonSmiInput() { var builder = genGrowMemoryBuilder(); - builder.addMemory(0, kV8MaxPages, false); + builder.addMemory(0, undefined, false); var module = builder.instantiate(); function growMem(pages) { return module.exports.grow_memory(pages); } // The parameter of grow_memory is unsigned. Therefore -1 stands for @@ -326,7 +330,7 @@ testGrowMemoryTrapsWithNonSmiInput(); function testGrowMemoryCurrentMemory() { var builder = genGrowMemoryBuilder(); - builder.addMemory(1, kV8MaxPages, false); + builder.addMemory(1, undefined, false); builder.addFunction("memory_size", kSig_i_v) .addBody([kExprMemorySize, kMemoryZero]) .exportFunc(); @@ -342,7 +346,7 @@ testGrowMemoryCurrentMemory(); function testGrowMemoryPreservesDataMemOp32() { var builder = genGrowMemoryBuilder(); - builder.addMemory(1, kV8MaxPages, false); + builder.addMemory(1, undefined, false); var module = builder.instantiate(); var offset, val; function peek() { return module.exports.load(offset); } @@ -365,7 +369,7 @@ testGrowMemoryPreservesDataMemOp32(); function testGrowMemoryPreservesDataMemOp16() { var builder = genGrowMemoryBuilder(); - builder.addMemory(1, kV8MaxPages, false); + builder.addMemory(1, undefined, false); var module = builder.instantiate(); var offset, val; function peek() { return module.exports.load16(offset); } @@ -388,7 +392,7 @@ testGrowMemoryPreservesDataMemOp16(); function testGrowMemoryPreservesDataMemOp8() { var builder = genGrowMemoryBuilder(); - builder.addMemory(1, kV8MaxPages, false); + builder.addMemory(1, undefined, false); var module = builder.instantiate(); var offset, val = 0; function peek() { return module.exports.load8(offset); } @@ -415,7 +419,7 @@ testGrowMemoryPreservesDataMemOp8(); function testGrowMemoryOutOfBoundsOffset() { var builder = genGrowMemoryBuilder(); - builder.addMemory(1, kV8MaxPages, false); + builder.addMemory(1, undefined, false); var module = builder.instantiate(); var offset, val; function peek() { return module.exports.load(offset); } @@ -492,7 +496,7 @@ testGrowMemoryDeclaredSpecMaxTraps(); function testGrowMemory2Gb() { print("testGrowMemory2Gb"); var builder = genGrowMemoryBuilder(); - builder.addMemory(1, kV8MaxPages, false); + builder.addMemory(1, undefined, false); var module = builder.instantiate(); var offset, val; function peek() { return module.exports.load(offset); } diff --git a/deps/v8/test/mjsunit/wasm/import-memory.js b/deps/v8/test/mjsunit/wasm/import-memory.js index df4f0d3fe8..ca91c698c8 100644 --- a/deps/v8/test/mjsunit/wasm/import-memory.js +++ b/deps/v8/test/mjsunit/wasm/import-memory.js @@ -7,6 +7,9 @@ load("test/mjsunit/wasm/wasm-constants.js"); load("test/mjsunit/wasm/wasm-module-builder.js"); +// V8 internal memory size limit. +var kV8MaxPages = 32767; + (function TestOne() { print("TestOne"); let memory = new WebAssembly.Memory({initial: 1}); diff --git a/deps/v8/test/mjsunit/wasm/import-mutable-global.js b/deps/v8/test/mjsunit/wasm/import-mutable-global.js index 4985d99211..46b9ca5f5a 100644 --- a/deps/v8/test/mjsunit/wasm/import-mutable-global.js +++ b/deps/v8/test/mjsunit/wasm/import-mutable-global.js @@ -195,7 +195,7 @@ function addGlobalGetterAndSetter(builder, index, name, type) { (function TestImportedAndNonImportedMutableGlobal() { let global = new WebAssembly.Global({value: 'i32', mutable: true}, 1); let builder = new WasmModuleBuilder(); - builder.addGlobal(kWasmI32, true).exportAs('i32'); builder.addImportedGlobal("mod", "g", kWasmI32, true); + builder.addGlobal(kWasmI32, true).exportAs('i32'); builder.instantiate({mod: {g: global}}); })(); diff --git a/deps/v8/test/mjsunit/wasm/table.js b/deps/v8/test/mjsunit/wasm/table.js index 4724561670..32bdecad66 100644 --- a/deps/v8/test/mjsunit/wasm/table.js +++ b/deps/v8/test/mjsunit/wasm/table.js @@ -159,8 +159,8 @@ function assertTableIsValid(table, length) { (function TestSet() { let builder = new WasmModuleBuilder; - builder.addExport("wasm", builder.addFunction("", kSig_v_v).addBody([])); builder.addExport("host", builder.addImport("test", "f", kSig_v_v)); + builder.addExport("wasm", builder.addFunction("", kSig_v_v).addBody([])); let {wasm, host} = builder.instantiate({test: {f() {}}}).exports; let table = new WebAssembly.Table({element: "anyfunc", initial: 10}); @@ -207,8 +207,8 @@ function assertTableIsValid(table, length) { (function TestIndexing() { let builder = new WasmModuleBuilder; - builder.addExport("wasm", builder.addFunction("", kSig_v_v).addBody([])); builder.addExport("host", builder.addImport("test", "f", kSig_v_v)); + builder.addExport("wasm", builder.addFunction("", kSig_v_v).addBody([])); let {wasm, host} = builder.instantiate({test: {f() {}}}).exports; let table = new WebAssembly.Table({element: "anyfunc", initial: 10}); @@ -230,8 +230,8 @@ function assertTableIsValid(table, length) { (function TestGrow() { let builder = new WasmModuleBuilder; - builder.addExport("wasm", builder.addFunction("", kSig_v_v).addBody([])); builder.addExport("host", builder.addImport("test", "f", kSig_v_v)); + builder.addExport("wasm", builder.addFunction("", kSig_v_v).addBody([])); let {wasm, host} = builder.instantiate({test: {f() {}}}).exports; function init(table) { diff --git a/deps/v8/test/mjsunit/wasm/trap-handler-fallback.js b/deps/v8/test/mjsunit/wasm/trap-handler-fallback.js index 26296696c5..465ca449cc 100644 --- a/deps/v8/test/mjsunit/wasm/trap-handler-fallback.js +++ b/deps/v8/test/mjsunit/wasm/trap-handler-fallback.js @@ -33,17 +33,14 @@ load("test/mjsunit/wasm/wasm-module-builder.js"); // space per isolate (see kAddressSpaceLimit in wasm-memory.cc), which allows // up to 128 fast memories. As long as we create more than that, we should // trigger the fallback behavior. - for (var i = 0; i < 135; i++) { + for (var i = 0; i < 135 && !fallback_occurred; i++) { memory = new WebAssembly.Memory({initial: 1}); instance = builder.instantiate({mod: {imported_mem: memory}}); instances.push(instance); assertTraps(kTrapMemOutOfBounds, () => instance.exports.load(1 << 20)); - fallback_occurred = fallback_occurred || !%WasmMemoryHasFullGuardRegion(memory); - if (fallback_occurred) { - break; - } + fallback_occurred = !%WasmMemoryHasFullGuardRegion(memory); } assertTrue(fallback_occurred); })(); @@ -63,17 +60,14 @@ load("test/mjsunit/wasm/wasm-module-builder.js"); // space per isolate (see kAddressSpaceLimit in wasm-memory.cc), which allows // up to 128 fast memories. As long as we create more than that, we should // trigger the fallback behavior. - for (var i = 0; i < 135; i++) { + for (var i = 0; i < 135 && !fallback_occurred; i++) { memory = new WebAssembly.Memory({initial: 1}); instance = builder.instantiate({mod: {imported_mem: memory}}); instances.push(instance); assertTraps(kTrapMemOutOfBounds, () => instance.exports.load(1 << 20)); - fallback_occurred = fallback_occurred || !%WasmMemoryHasFullGuardRegion(memory); - if (fallback_occurred) { - break; - } + fallback_occurred = !%WasmMemoryHasFullGuardRegion(memory); } assertTrue(fallback_occurred); })(); @@ -132,17 +126,14 @@ load("test/mjsunit/wasm/wasm-module-builder.js"); // up to 128 fast memories. As long as we create more than that, we should // trigger the fallback behavior. const module = builder.toModule(); - for (var i = 0; i < 135; i++) { + for (var i = 0; i < 135 && !fallback_occurred; i++) { memory = new WebAssembly.Memory({initial: 1}); instance = new WebAssembly.Instance(module, {mod: {imported_mem: memory}}); instances.push(instance); assertTraps(kTrapMemOutOfBounds, () => instance.exports.load(1 << 20)); - fallback_occurred = fallback_occurred || !%WasmMemoryHasFullGuardRegion(memory); - if (fallback_occurred) { - break; - } + fallback_occurred = !%WasmMemoryHasFullGuardRegion(memory); } assertTrue(fallback_occurred); })(); diff --git a/deps/v8/test/mjsunit/wasm/unicode.js b/deps/v8/test/mjsunit/wasm/unicode.js index 49c95da030..7e29c00f33 100644 --- a/deps/v8/test/mjsunit/wasm/unicode.js +++ b/deps/v8/test/mjsunit/wasm/unicode.js @@ -52,7 +52,7 @@ checkExports('☺☺mul☺☺', '☺☺mul☺☺', '☺☺add☺☺', '☺☺add builder.addFunction('three snowmen: ☃☃☃', kSig_i_v).addBody([]).exportFunc(); assertThrows( () => builder.instantiate(), WebAssembly.CompileError, - /Compiling wasm function #0:three snowmen: ☃☃☃ failed: /); + /Compiling wasm function "three snowmen: ☃☃☃" failed: /); })(); (function errorMessageUnicodeInImportModuleName() { diff --git a/deps/v8/test/mjsunit/wasm/wasm-constants.js b/deps/v8/test/mjsunit/wasm/wasm-constants.js index f5aead9fb6..cc10e9953c 100644 --- a/deps/v8/test/mjsunit/wasm/wasm-constants.js +++ b/deps/v8/test/mjsunit/wasm/wasm-constants.js @@ -15,9 +15,6 @@ function bytes() { return buffer; } -// V8 internal constants -var kV8MaxPages = 32767; - // Header declaration constants var kWasmH0 = 0; var kWasmH1 = 0x61; @@ -94,11 +91,13 @@ let kWasmF32 = 0x7d; let kWasmF64 = 0x7c; let kWasmS128 = 0x7b; let kWasmAnyRef = 0x6f; +let kWasmExceptRef = 0x68; let kExternalFunction = 0; let kExternalTable = 1; let kExternalMemory = 2; let kExternalGlobal = 3; +let kExternalException = 4; let kTableZero = 0; let kMemoryZero = 0; @@ -373,6 +372,43 @@ let kExprI32AtomicCompareExchange = 0x48 let kExprI32AtomicCompareExchange8U = 0x4a let kExprI32AtomicCompareExchange16U = 0x4b +let kExprI64AtomicLoad = 0x11; +let kExprI64AtomicLoad8U = 0x14; +let kExprI64AtomicLoad16U = 0x15; +let kExprI64AtomicLoad32U = 0x16; +let kExprI64AtomicStore = 0x18; +let kExprI64AtomicStore8U = 0x1b; +let kExprI64AtomicStore16U = 0x1c; +let kExprI64AtomicStore32U = 0x1d; +let kExprI64AtomicAdd = 0x1f; +let kExprI64AtomicAdd8U = 0x22; +let kExprI64AtomicAdd16U = 0x23; +let kExprI64AtomicAdd32U = 0x24; +let kExprI64AtomicSub = 0x26; +let kExprI64AtomicSub8U = 0x29; +let kExprI64AtomicSub16U = 0x2a; +let kExprI64AtomicSub32U = 0x2b; +let kExprI64AtomicAnd = 0x2d; +let kExprI64AtomicAnd8U = 0x30; +let kExprI64AtomicAnd16U = 0x31; +let kExprI64AtomicAnd32U = 0x32; +let kExprI64AtomicOr = 0x34; +let kExprI64AtomicOr8U = 0x37; +let kExprI64AtomicOr16U = 0x38; +let kExprI64AtomicOr32U = 0x39; +let kExprI64AtomicXor = 0x3b; +let kExprI64AtomicXor8U = 0x3e; +let kExprI64AtomicXor16U = 0x3f; +let kExprI64AtomicXor32U = 0x40; +let kExprI64AtomicExchange = 0x42; +let kExprI64AtomicExchange8U = 0x45; +let kExprI64AtomicExchange16U = 0x46; +let kExprI64AtomicExchange32U = 0x47; +let kExprI64AtomicCompareExchange = 0x49 +let kExprI64AtomicCompareExchange8U = 0x4c; +let kExprI64AtomicCompareExchange16U = 0x4d; +let kExprI64AtomicCompareExchange32U = 0x4e; + let kTrapUnreachable = 0; let kTrapMemOutOfBounds = 1; let kTrapDivByZero = 2; @@ -413,29 +449,6 @@ function assertTraps(trap, code) { throw new MjsUnitAssertionError('Did not trap, expected: ' + kTrapMsgs[trap]); } -function assertWasmThrows(runtime_id, values, code) { - try { - if (typeof code === 'function') { - code(); - } else { - eval(code); - } - } catch (e) { - assertTrue(e instanceof WebAssembly.RuntimeError); - var e_runtime_id = e['WasmExceptionRuntimeId']; - assertEquals(e_runtime_id, runtime_id); - assertTrue(Number.isInteger(e_runtime_id)); - var e_values = e['WasmExceptionValues']; - assertEquals(values.length, e_values.length); - for (i = 0; i < values.length; ++i) { - assertEquals(values[i], e_values[i]); - } - // Success. - return; - } - throw new MjsUnitAssertionError('Did not throw expected: ' + runtime_id + values); -} - function wasmI32Const(val) { let bytes = [kExprI32Const]; for (let i = 0; i < 4; ++i) { diff --git a/deps/v8/test/mjsunit/wasm/wasm-module-builder.js b/deps/v8/test/mjsunit/wasm/wasm-module-builder.js index 98a3c6d4e0..38b4a0e308 100644 --- a/deps/v8/test/mjsunit/wasm/wasm-module-builder.js +++ b/deps/v8/test/mjsunit/wasm/wasm-module-builder.js @@ -179,6 +179,7 @@ class WasmModuleBuilder { this.explicit = []; this.num_imported_funcs = 0; this.num_imported_globals = 0; + this.num_imported_exceptions = 0; return this; } @@ -228,10 +229,12 @@ class WasmModuleBuilder { } addException(type) { - if (type.results.length != 0) - throw new Error('Invalid exception signature: ' + type); + if (type.results.length != 0) { + throw new Error('Exception signature must have void result: ' + type); + } + let except_index = this.exceptions.length + this.num_imported_exceptions; this.exceptions.push(type); - return this.exceptions.length - 1; + return except_index; } addFunction(name, type) { @@ -243,6 +246,9 @@ class WasmModuleBuilder { } addImport(module = "", name, type) { + if (this.functions.length != 0) { + throw new Error('Imported functions must be declared before local ones'); + } let type_index = (typeof type) == "number" ? type : this.addType(type); this.imports.push({module: module, name: name, kind: kExternalFunction, type: type_index}); @@ -250,6 +256,9 @@ class WasmModuleBuilder { } addImportedGlobal(module = "", name, type, mutable = false) { + if (this.globals.length != 0) { + throw new Error('Imported globals must be declared before local ones'); + } let o = {module: module, name: name, kind: kExternalGlobal, type: type, mutable: mutable}; this.imports.push(o); @@ -269,6 +278,18 @@ class WasmModuleBuilder { this.imports.push(o); } + addImportedException(module = "", name, type) { + if (type.results.length != 0) { + throw new Error('Exception signature must have void result: ' + type); + } + if (this.exceptions.length != 0) { + throw new Error('Imported exceptions must be declared before local ones'); + } + let o = {module: module, name: name, kind: kExternalException, type: type}; + this.imports.push(o); + return this.num_imported_exceptions++; + } + addExport(name, index) { this.exports.push({name: name, kind: kExternalFunction, index: index}); return this; @@ -378,6 +399,11 @@ class WasmModuleBuilder { section.emit_u8(has_max ? 1 : 0); // flags section.emit_u32v(imp.initial); // initial if (has_max) section.emit_u32v(imp.maximum); // maximum + } else if (imp.kind == kExternalException) { + section.emit_u32v(imp.type.params.length); + for (let param of imp.type.params) { + section.emit_u8(param); + } } else { throw new Error("unknown/unsupported import kind " + imp.kind); } @@ -478,6 +504,20 @@ class WasmModuleBuilder { }); } + // Add exceptions. + if (wasm.exceptions.length > 0) { + if (debug) print("emitting exceptions @ " + binary.length); + binary.emit_section(kExceptionSectionCode, section => { + section.emit_u32v(wasm.exceptions.length); + for (let type of wasm.exceptions) { + section.emit_u32v(type.params.length); + for (let param of type.params) { + section.emit_u8(param); + } + } + }); + } + // Add export table. var mem_export = (wasm.memory !== undefined && wasm.memory.exp); var exports_count = wasm.exports.length + (mem_export ? 1 : 0); @@ -530,20 +570,6 @@ class WasmModuleBuilder { }); } - // Add exceptions. - if (wasm.exceptions.length > 0) { - if (debug) print("emitting exceptions @ " + binary.length); - binary.emit_section(kExceptionSectionCode, section => { - section.emit_u32v(wasm.exceptions.length); - for (let type of wasm.exceptions) { - section.emit_u32v(type.params.length); - for (let param of type.params) { - section.emit_u8(param); - } - } - }); - } - // Add function bodies. if (wasm.functions.length > 0) { // emit function bodies @@ -569,6 +595,12 @@ class WasmModuleBuilder { if (l.s128_count > 0) { local_decls.push({count: l.s128_count, type: kWasmS128}); } + if (l.anyref_count > 0) { + local_decls.push({count: l.anyref_count, type: kWasmAnyRef}); + } + if (l.except_count > 0) { + local_decls.push({count: l.except_count, type: kWasmExceptRef}); + } } let header = new Binary; diff --git a/deps/v8/test/mjsunit/wasm/worker-interpreter.js b/deps/v8/test/mjsunit/wasm/worker-interpreter.js index d730ed7a74..9bc1e1e11c 100644 --- a/deps/v8/test/mjsunit/wasm/worker-interpreter.js +++ b/deps/v8/test/mjsunit/wasm/worker-interpreter.js @@ -34,7 +34,7 @@ load("test/mjsunit/wasm/wasm-module-builder.js"); } } `; - let worker = new Worker(workerScript); + let worker = new Worker(workerScript, {type: 'string'}); // Call method without using the interpreter. var initial_interpreted = %WasmNumInterpretedCalls(instance); diff --git a/deps/v8/test/mjsunit/wasm/worker-memory.js b/deps/v8/test/mjsunit/wasm/worker-memory.js index e2a8cf8857..c5b99ede7e 100644 --- a/deps/v8/test/mjsunit/wasm/worker-memory.js +++ b/deps/v8/test/mjsunit/wasm/worker-memory.js @@ -5,7 +5,7 @@ // Flags: --experimental-wasm-threads (function TestPostMessageUnsharedMemory() { - let worker = new Worker(''); + let worker = new Worker('', {type: 'string'}); let memory = new WebAssembly.Memory({initial: 1, maximum: 2}); assertThrows(() => worker.postMessage(memory), Error); @@ -39,7 +39,7 @@ let workerHelpers = postMessage("OK"); };`; - let worker = new Worker(workerScript); + let worker = new Worker(workerScript, {type: 'string'}); let memory = new WebAssembly.Memory({initial: 1, maximum: 2, shared: true}); worker.postMessage(memory); assertEquals("OK", worker.getMessage()); @@ -60,7 +60,7 @@ let workerHelpers = postMessage("OK"); };`; - let worker = new Worker(workerScript); + let worker = new Worker(workerScript, {type: 'string'}); let memory = new WebAssembly.Memory({initial: 1, maximum: 2, shared: true}); let obj = {memories: [memory, memory], buffer: memory.buffer, foo: 1}; worker.postMessage(obj); @@ -75,7 +75,8 @@ let workerHelpers = postMessage("OK"); };`; - let workers = [new Worker(workerScript), new Worker(workerScript)]; + let workers = [new Worker(workerScript, {type: 'string'}), + new Worker(workerScript, {type: 'string'})]; let memory = new WebAssembly.Memory({initial: 1, maximum: 2, shared: true}); for (let worker of workers) { worker.postMessage(memory); diff --git a/deps/v8/test/mjsunit/wasm/worker-module.js b/deps/v8/test/mjsunit/wasm/worker-module.js index 72645f8dbf..b60b19571b 100644 --- a/deps/v8/test/mjsunit/wasm/worker-module.js +++ b/deps/v8/test/mjsunit/wasm/worker-module.js @@ -27,7 +27,7 @@ load("test/mjsunit/wasm/wasm-module-builder.js"); } `; - let worker = new Worker(workerScript); + let worker = new Worker(workerScript, {type: 'string'}); worker.postMessage(module); assertEquals(42, worker.getMessage()); worker.terminate(); diff --git a/deps/v8/test/mkgrokdump/mkgrokdump.cc b/deps/v8/test/mkgrokdump/mkgrokdump.cc index 713e952378..387d064974 100644 --- a/deps/v8/test/mkgrokdump/mkgrokdump.cc +++ b/deps/v8/test/mkgrokdump/mkgrokdump.cc @@ -41,36 +41,28 @@ class MockArrayBufferAllocator : public v8::ArrayBuffer::Allocator { void Free(void* p, size_t) override {} }; -#define RO_ROOT_LIST_CASE(type, name, camel_name) \ - if (n == NULL && o == roots.name()) n = #camel_name; -#define ROOT_LIST_CASE(type, name, camel_name) \ - if (n == NULL && o == space->heap()->name()) n = #camel_name; -#define STRUCT_LIST_CASE(upper_name, camel_name, name) \ - if (n == NULL && o == roots.name##_map()) n = #camel_name "Map"; -#define ALLOCATION_SITE_LIST_CASE(upper_name, camel_name, size, name) \ - if (n == NULL && o == roots.name##_map()) n = #camel_name "Map"; +#define RO_ROOT_LIST_CASE(type, name, CamelName) \ + if (n == NULL && o == roots.name()) n = #CamelName; +#define MUTABLE_ROOT_LIST_CASE(type, name, CamelName) \ + if (n == NULL && o == space->heap()->name()) n = #CamelName; static void DumpMaps(i::PagedSpace* space) { i::HeapObjectIterator it(space); i::ReadOnlyRoots roots(space->heap()); - for (i::Object* o = it.Next(); o != NULL; o = it.Next()) { + for (i::Object* o = it.Next(); o != nullptr; o = it.Next()) { if (!o->IsMap()) continue; i::Map* m = i::Map::cast(o); - const char* n = NULL; + const char* n = nullptr; intptr_t p = reinterpret_cast<intptr_t>(m) & 0x7FFFF; int t = m->instance_type(); - STRONG_READ_ONLY_ROOT_LIST(RO_ROOT_LIST_CASE) - MUTABLE_ROOT_LIST(ROOT_LIST_CASE) - STRUCT_LIST(STRUCT_LIST_CASE) - ALLOCATION_SITE_LIST(ALLOCATION_SITE_LIST_CASE) - if (n == NULL) continue; + READ_ONLY_ROOT_LIST(RO_ROOT_LIST_CASE) + MUTABLE_ROOT_LIST(MUTABLE_ROOT_LIST_CASE) + if (n == nullptr) continue; const char* sname = space->name(); i::PrintF(" (\"%s\", 0x%05" V8PRIxPTR "): (%d, \"%s\"),\n", sname, p, t, n); } } -#undef ALLOCATION_SITE_LIST_CASE -#undef STRUCT_LIST_CASE -#undef ROOT_LIST_CASE +#undef MUTABLE_ROOT_LIST_CASE #undef RO_ROOT_LIST_CASE static int DumpHeapConstants(const char* argv0) { @@ -103,33 +95,33 @@ static int DumpHeapConstants(const char* argv0) { // Dump the KNOWN_OBJECTS table to the console. i::PrintF("\n# List of known V8 objects.\n"); -#define RO_ROOT_LIST_CASE(type, name, camel_name) \ - if (n == NULL && o == roots.name()) { \ - n = #camel_name; \ - i = i::Heap::k##camel_name##RootIndex; \ +#define RO_ROOT_LIST_CASE(type, name, CamelName) \ + if (n == NULL && o == roots.name()) { \ + n = #CamelName; \ + i = i::RootIndex::k##CamelName; \ } -#define ROOT_LIST_CASE(type, name, camel_name) \ - if (n == NULL && o == heap->name()) { \ - n = #camel_name; \ - i = i::Heap::k##camel_name##RootIndex; \ +#define ROOT_LIST_CASE(type, name, CamelName) \ + if (n == NULL && o == heap->name()) { \ + n = #CamelName; \ + i = i::RootIndex::k##CamelName; \ } i::PagedSpaces spit(heap, i::PagedSpaces::SpacesSpecifier::kAllPagedSpaces); i::PrintF("KNOWN_OBJECTS = {\n"); - for (i::PagedSpace* s = spit.next(); s != NULL; s = spit.next()) { + for (i::PagedSpace* s = spit.next(); s != nullptr; s = spit.next()) { i::HeapObjectIterator it(s); // Code objects are generally platform-dependent. if (s->identity() == i::CODE_SPACE || s->identity() == i::MAP_SPACE) continue; const char* sname = s->name(); - for (i::Object* o = it.Next(); o != NULL; o = it.Next()) { + for (i::Object* o = it.Next(); o != nullptr; o = it.Next()) { // Skip maps in RO_SPACE since they will be reported elsewhere. if (o->IsMap()) continue; - const char* n = NULL; - i::Heap::RootListIndex i = i::Heap::kStrongRootListLength; + const char* n = nullptr; + i::RootIndex i = i::RootIndex::kFirstSmiRoot; intptr_t p = reinterpret_cast<intptr_t>(o) & 0x7FFFF; STRONG_READ_ONLY_ROOT_LIST(RO_ROOT_LIST_CASE) MUTABLE_ROOT_LIST(ROOT_LIST_CASE) - if (n == NULL) continue; + if (n == nullptr) continue; if (!i::Heap::RootIsImmortalImmovable(i)) continue; i::PrintF(" (\"%s\", 0x%05" V8PRIxPTR "): \"%s\",\n", sname, p, n); } diff --git a/deps/v8/test/mozilla/mozilla.status b/deps/v8/test/mozilla/mozilla.status index 8e7a4a6490..c7dd68db3b 100644 --- a/deps/v8/test/mozilla/mozilla.status +++ b/deps/v8/test/mozilla/mozilla.status @@ -158,6 +158,11 @@ 'js1_5/Regress/regress-462292': [SKIP], 'js1_5/decompilation/regress-443071-01': [SKIP], + # This test checks that 'unshift' doesn't cause a OOM. Since the range error + # will get thrown at the end of the operation, this test runs for a long time. + # https://crbug.com/v8/8120 + 'ecma_3/Array/regress-322135-04': [SKIP], + ##################### SLOW TESTS ##################### # Compiles a long chain of && or || operations, can time out under slower @@ -184,6 +189,11 @@ # characters. This takes a long time to run (~32 seconds). 'js1_5/GC/regress-348532': [SKIP], + # Takes a really long time to run, creating an Array of length + # 2^32 - 1. Related to removal of "sparse" array support for + # splice and friends: + # https://bugs.chromium.org/p/v8/issues/detail?id=8131. + 'ecma_3/Array/regress-322135-03': [SKIP], # Runs for too long: huge array with getters and setters. As it says # in the test: "This test will probably run out of memory". @@ -1013,6 +1023,11 @@ 'js1_5/extensions/regress-355497': [FAIL_OK, '--sim-stack-size=512'], }], # 'arch == arm64 and simulator_run' +['system == android', { + # https://crbug.com/v8/8146 + 'ecma/Array/15.4.4.5-3': [FAIL], +}], # 'system == android' + ['tsan', { # https://crbug.com/v8/7632 'ecma_3/RegExp/regress-85721': [SKIP], diff --git a/deps/v8/test/mozilla/testcfg.py b/deps/v8/test/mozilla/testcfg.py index 52ba9dcbcb..3727fccef3 100644 --- a/deps/v8/test/mozilla/testcfg.py +++ b/deps/v8/test/mozilla/testcfg.py @@ -85,7 +85,7 @@ class TestSuite(testsuite.TestSuite): return TestCase -class TestCase(testcase.TestCase): +class TestCase(testcase.D8TestCase): def _get_files_params(self): files = [os.path.join(self.suite.root, "mozilla-shell-emulation.js")] testfilename = self.path + ".js" diff --git a/deps/v8/test/preparser/testcfg.py b/deps/v8/test/preparser/testcfg.py index 0ffde419d4..11e6135444 100644 --- a/deps/v8/test/preparser/testcfg.py +++ b/deps/v8/test/preparser/testcfg.py @@ -81,7 +81,7 @@ class TestSuite(testsuite.TestSuite): return VariantsGenerator -class TestCase(testcase.TestCase): +class TestCase(testcase.D8TestCase): def __init__(self, suite, path, name, test_config, source, template_flags): super(TestCase, self).__init__(suite, path, name, test_config) diff --git a/deps/v8/test/test262/harness-agent.js b/deps/v8/test/test262/harness-agent.js index 83f688cf07..254df2469f 100644 --- a/deps/v8/test/test262/harness-agent.js +++ b/deps/v8/test/test262/harness-agent.js @@ -76,7 +76,7 @@ var agent = { if (i32a === null) { i32a = new Int32Array(new SharedArrayBuffer(256)); } - var w = new Worker(workerScript(script)); + var w = new Worker(workerScript(script), {type: 'string'}); w.index = workers.length; w.postMessage({kind: 'start', i32a: i32a, index: w.index}); workers.push(w); diff --git a/deps/v8/test/test262/test262.status b/deps/v8/test/test262/test262.status index c581a9806c..4210263d40 100644 --- a/deps/v8/test/test262/test262.status +++ b/deps/v8/test/test262/test262.status @@ -178,15 +178,148 @@ 'language/expressions/assignment/destructuring/keyed-destructuring-property-reference-target-evaluation-order': [FAIL], # https://bugs.chromium.org/p/v8/issues/detail?id=896 - 'built-ins/RegExp/property-escapes/binary-properties-with-value': [FAIL], - 'built-ins/RegExp/property-escapes/character-class': [FAIL], - 'built-ins/RegExp/property-escapes/grammar-extensions': [FAIL], - 'built-ins/RegExp/property-escapes/loose-matching': [FAIL], - 'built-ins/RegExp/property-escapes/non-binary-properties-without-value': [FAIL], - 'built-ins/RegExp/property-escapes/non-existent-properties': [FAIL], - 'built-ins/RegExp/property-escapes/non-existent-property-values': [FAIL], - 'built-ins/RegExp/property-escapes/unsupported-binary-properties': [FAIL], - 'built-ins/RegExp/property-escapes/unsupported-properties': [FAIL], + 'built-ins/RegExp/property-escapes/binary-property-with-value-ASCII_-_F': [FAIL], + 'built-ins/RegExp/property-escapes/binary-property-with-value-ASCII_-_F-negated': [FAIL], + 'built-ins/RegExp/property-escapes/binary-property-with-value-ASCII_-_Invalid': [FAIL], + 'built-ins/RegExp/property-escapes/binary-property-with-value-ASCII_-_Invalid-negated': [FAIL], + 'built-ins/RegExp/property-escapes/binary-property-with-value-ASCII_-_N': [FAIL], + 'built-ins/RegExp/property-escapes/binary-property-with-value-ASCII_-_N-negated': [FAIL], + 'built-ins/RegExp/property-escapes/binary-property-with-value-ASCII_-_No': [FAIL], + 'built-ins/RegExp/property-escapes/binary-property-with-value-ASCII_-_No-negated': [FAIL], + 'built-ins/RegExp/property-escapes/binary-property-with-value-ASCII_-_T': [FAIL], + 'built-ins/RegExp/property-escapes/binary-property-with-value-ASCII_-_T-negated': [FAIL], + 'built-ins/RegExp/property-escapes/binary-property-with-value-ASCII_-_Y': [FAIL], + 'built-ins/RegExp/property-escapes/binary-property-with-value-ASCII_-_Y-negated': [FAIL], + 'built-ins/RegExp/property-escapes/binary-property-with-value-ASCII_-_Yes': [FAIL], + 'built-ins/RegExp/property-escapes/binary-property-with-value-ASCII_-_Yes-negated': [FAIL], + 'built-ins/RegExp/property-escapes/character-class-range-end': [FAIL], + 'built-ins/RegExp/property-escapes/character-class-range-no-dash-end': [FAIL], + 'built-ins/RegExp/property-escapes/character-class-range-no-dash-start': [FAIL], + 'built-ins/RegExp/property-escapes/character-class-range-start': [FAIL], + 'built-ins/RegExp/property-escapes/grammar-extension-In-prefix-Block-implicit': [FAIL], + 'built-ins/RegExp/property-escapes/grammar-extension-In-prefix-Block-implicit-negated': [FAIL], + 'built-ins/RegExp/property-escapes/grammar-extension-In-prefix-Script': [FAIL], + 'built-ins/RegExp/property-escapes/grammar-extension-In-prefix-Script-implicit': [FAIL], + 'built-ins/RegExp/property-escapes/grammar-extension-In-prefix-Script-implicit-negated': [FAIL], + 'built-ins/RegExp/property-escapes/grammar-extension-In-prefix-Script-negated': [FAIL], + 'built-ins/RegExp/property-escapes/grammar-extension-Is-prefix-Script': [FAIL], + 'built-ins/RegExp/property-escapes/grammar-extension-Is-prefix-Script-negated': [FAIL], + 'built-ins/RegExp/property-escapes/grammar-extension-circumflex-negation': [FAIL], + 'built-ins/RegExp/property-escapes/grammar-extension-circumflex-negation-negated': [FAIL], + 'built-ins/RegExp/property-escapes/grammar-extension-empty': [FAIL], + 'built-ins/RegExp/property-escapes/grammar-extension-empty-negated': [FAIL], + 'built-ins/RegExp/property-escapes/grammar-extension-invalid': [FAIL], + 'built-ins/RegExp/property-escapes/grammar-extension-invalid-negated': [FAIL], + 'built-ins/RegExp/property-escapes/grammar-extension-no-braces': [FAIL], + 'built-ins/RegExp/property-escapes/grammar-extension-no-braces-negated': [FAIL], + 'built-ins/RegExp/property-escapes/grammar-extension-no-braces-value': [FAIL], + 'built-ins/RegExp/property-escapes/grammar-extension-no-braces-value-negated': [FAIL], + 'built-ins/RegExp/property-escapes/grammar-extension-separator': [FAIL], + 'built-ins/RegExp/property-escapes/grammar-extension-separator-and-value-only': [FAIL], + 'built-ins/RegExp/property-escapes/grammar-extension-separator-and-value-only-negated': [FAIL], + 'built-ins/RegExp/property-escapes/grammar-extension-separator-negated': [FAIL], + 'built-ins/RegExp/property-escapes/grammar-extension-separator-only': [FAIL], + 'built-ins/RegExp/property-escapes/grammar-extension-separator-only-negated': [FAIL], + 'built-ins/RegExp/property-escapes/grammar-extension-unclosed': [FAIL], + 'built-ins/RegExp/property-escapes/grammar-extension-unclosed-negated': [FAIL], + 'built-ins/RegExp/property-escapes/grammar-extension-unopened': [FAIL], + 'built-ins/RegExp/property-escapes/grammar-extension-unopened-negated': [FAIL], + 'built-ins/RegExp/property-escapes/loose-matching-01': [FAIL], + 'built-ins/RegExp/property-escapes/loose-matching-01-negated': [FAIL], + 'built-ins/RegExp/property-escapes/loose-matching-02': [FAIL], + 'built-ins/RegExp/property-escapes/loose-matching-02-negated': [FAIL], + 'built-ins/RegExp/property-escapes/loose-matching-03': [FAIL], + 'built-ins/RegExp/property-escapes/loose-matching-03-negated': [FAIL], + 'built-ins/RegExp/property-escapes/loose-matching-04': [FAIL], + 'built-ins/RegExp/property-escapes/loose-matching-04-negated': [FAIL], + 'built-ins/RegExp/property-escapes/loose-matching-05': [FAIL], + 'built-ins/RegExp/property-escapes/loose-matching-05-negated': [FAIL], + 'built-ins/RegExp/property-escapes/loose-matching-06': [FAIL], + 'built-ins/RegExp/property-escapes/loose-matching-06-negated': [FAIL], + 'built-ins/RegExp/property-escapes/loose-matching-07': [FAIL], + 'built-ins/RegExp/property-escapes/loose-matching-07-negated': [FAIL], + 'built-ins/RegExp/property-escapes/loose-matching-08': [FAIL], + 'built-ins/RegExp/property-escapes/loose-matching-08-negated': [FAIL], + 'built-ins/RegExp/property-escapes/loose-matching-09': [FAIL], + 'built-ins/RegExp/property-escapes/loose-matching-09-negated': [FAIL], + 'built-ins/RegExp/property-escapes/loose-matching-10': [FAIL], + 'built-ins/RegExp/property-escapes/loose-matching-10-negated': [FAIL], + 'built-ins/RegExp/property-escapes/loose-matching-11': [FAIL], + 'built-ins/RegExp/property-escapes/loose-matching-11-negated': [FAIL], + 'built-ins/RegExp/property-escapes/loose-matching-12': [FAIL], + 'built-ins/RegExp/property-escapes/loose-matching-12-negated': [FAIL], + 'built-ins/RegExp/property-escapes/loose-matching-13': [FAIL], + 'built-ins/RegExp/property-escapes/loose-matching-13-negated': [FAIL], + 'built-ins/RegExp/property-escapes/loose-matching-14': [FAIL], + 'built-ins/RegExp/property-escapes/loose-matching-14-negated': [FAIL], + 'built-ins/RegExp/property-escapes/non-binary-property-without-value-General_Category': [FAIL], + 'built-ins/RegExp/property-escapes/non-binary-property-without-value-General_Category-equals': [FAIL], + 'built-ins/RegExp/property-escapes/non-binary-property-without-value-General_Category-equals-negated': [FAIL], + 'built-ins/RegExp/property-escapes/non-binary-property-without-value-General_Category-negated': [FAIL], + 'built-ins/RegExp/property-escapes/non-binary-property-without-value-Script': [FAIL], + 'built-ins/RegExp/property-escapes/non-binary-property-without-value-Script-equals': [FAIL], + 'built-ins/RegExp/property-escapes/non-binary-property-without-value-Script-equals-negated': [FAIL], + 'built-ins/RegExp/property-escapes/non-binary-property-without-value-Script-negated': [FAIL], + 'built-ins/RegExp/property-escapes/non-binary-property-without-value-Script_Extensions': [FAIL], + 'built-ins/RegExp/property-escapes/non-binary-property-without-value-Script_Extensions-equals': [FAIL], + 'built-ins/RegExp/property-escapes/non-binary-property-without-value-Script_Extensions-equals-negated': [FAIL], + 'built-ins/RegExp/property-escapes/non-binary-property-without-value-Script_Extensions-negated': [FAIL], + 'built-ins/RegExp/property-escapes/non-existent-binary-property': [FAIL], + 'built-ins/RegExp/property-escapes/non-existent-binary-property-negated': [FAIL], + 'built-ins/RegExp/property-escapes/non-existent-property-and-value': [FAIL], + 'built-ins/RegExp/property-escapes/non-existent-property-and-value-negated': [FAIL], + 'built-ins/RegExp/property-escapes/non-existent-property-existing-value': [FAIL], + 'built-ins/RegExp/property-escapes/non-existent-property-existing-value-negated': [FAIL], + 'built-ins/RegExp/property-escapes/non-existent-property-value-General_Category-negated': [FAIL], + 'built-ins/RegExp/property-escapes/non-existent-property-value-Script': [FAIL], + 'built-ins/RegExp/property-escapes/non-existent-property-value-Script-negated': [FAIL], + 'built-ins/RegExp/property-escapes/non-existent-property-value-Script_Extensions': [FAIL], + 'built-ins/RegExp/property-escapes/non-existent-property-value-Script_Extensions-negated': [FAIL], + 'built-ins/RegExp/property-escapes/non-existent-property-value-general-category': [FAIL], + 'built-ins/RegExp/property-escapes/unsupported-binary-property-Composition_Exclusion': [FAIL], + 'built-ins/RegExp/property-escapes/unsupported-binary-property-Composition_Exclusion-negated': [FAIL], + 'built-ins/RegExp/property-escapes/unsupported-binary-property-Expands_On_NFC': [FAIL], + 'built-ins/RegExp/property-escapes/unsupported-binary-property-Expands_On_NFC-negated': [FAIL], + 'built-ins/RegExp/property-escapes/unsupported-binary-property-Expands_On_NFD': [FAIL], + 'built-ins/RegExp/property-escapes/unsupported-binary-property-Expands_On_NFD-negated': [FAIL], + 'built-ins/RegExp/property-escapes/unsupported-binary-property-Expands_On_NFKC': [FAIL], + 'built-ins/RegExp/property-escapes/unsupported-binary-property-Expands_On_NFKC-negated': [FAIL], + 'built-ins/RegExp/property-escapes/unsupported-binary-property-Expands_On_NFKD': [FAIL], + 'built-ins/RegExp/property-escapes/unsupported-binary-property-Expands_On_NFKD-negated': [FAIL], + 'built-ins/RegExp/property-escapes/unsupported-binary-property-FC_NFKC_Closure': [FAIL], + 'built-ins/RegExp/property-escapes/unsupported-binary-property-FC_NFKC_Closure-negated': [FAIL], + 'built-ins/RegExp/property-escapes/unsupported-binary-property-Full_Composition_Exclusion': [FAIL], + 'built-ins/RegExp/property-escapes/unsupported-binary-property-Full_Composition_Exclusion-negated': [FAIL], + 'built-ins/RegExp/property-escapes/unsupported-binary-property-Grapheme_Link': [FAIL], + 'built-ins/RegExp/property-escapes/unsupported-binary-property-Grapheme_Link-negated': [FAIL], + 'built-ins/RegExp/property-escapes/unsupported-binary-property-Hyphen': [FAIL], + 'built-ins/RegExp/property-escapes/unsupported-binary-property-Hyphen-negated': [FAIL], + 'built-ins/RegExp/property-escapes/unsupported-binary-property-Other_Alphabetic': [FAIL], + 'built-ins/RegExp/property-escapes/unsupported-binary-property-Other_Alphabetic-negated': [FAIL], + 'built-ins/RegExp/property-escapes/unsupported-binary-property-Other_Default_Ignorable_Code_Point': [FAIL], + 'built-ins/RegExp/property-escapes/unsupported-binary-property-Other_Default_Ignorable_Code_Point-negated': [FAIL], + 'built-ins/RegExp/property-escapes/unsupported-binary-property-Other_Grapheme_Extend': [FAIL], + 'built-ins/RegExp/property-escapes/unsupported-binary-property-Other_Grapheme_Extend-negated': [FAIL], + 'built-ins/RegExp/property-escapes/unsupported-binary-property-Other_ID_Continue': [FAIL], + 'built-ins/RegExp/property-escapes/unsupported-binary-property-Other_ID_Continue-negated': [FAIL], + 'built-ins/RegExp/property-escapes/unsupported-binary-property-Other_ID_Start': [FAIL], + 'built-ins/RegExp/property-escapes/unsupported-binary-property-Other_ID_Start-negated': [FAIL], + 'built-ins/RegExp/property-escapes/unsupported-binary-property-Other_Lowercase': [FAIL], + 'built-ins/RegExp/property-escapes/unsupported-binary-property-Other_Lowercase-negated': [FAIL], + 'built-ins/RegExp/property-escapes/unsupported-binary-property-Other_Math': [FAIL], + 'built-ins/RegExp/property-escapes/unsupported-binary-property-Other_Math-negated': [FAIL], + 'built-ins/RegExp/property-escapes/unsupported-binary-property-Other_Uppercase': [FAIL], + 'built-ins/RegExp/property-escapes/unsupported-binary-property-Other_Uppercase-negated': [FAIL], + 'built-ins/RegExp/property-escapes/unsupported-binary-property-Prepended_Concatenation_Mark': [FAIL], + 'built-ins/RegExp/property-escapes/unsupported-binary-property-Prepended_Concatenation_Mark-negated': [FAIL], + 'built-ins/RegExp/property-escapes/unsupported-property-Block-with-value': [FAIL], + 'built-ins/RegExp/property-escapes/unsupported-property-Block-with-value-negated': [FAIL], + 'built-ins/RegExp/property-escapes/unsupported-property-FC_NFKC_Closure': [FAIL], + 'built-ins/RegExp/property-escapes/unsupported-property-FC_NFKC_Closure-negated': [FAIL], + 'built-ins/RegExp/property-escapes/unsupported-property-Line_Break': [FAIL], + 'built-ins/RegExp/property-escapes/unsupported-property-Line_Break-negated': [FAIL], + 'built-ins/RegExp/property-escapes/unsupported-property-Line_Break-with-value': [FAIL], + 'built-ins/RegExp/property-escapes/unsupported-property-Line_Break-with-value-negated': [FAIL], 'language/literals/regexp/early-err-pattern': [FAIL], 'language/literals/regexp/invalid-braced-quantifier-exact': [FAIL], 'language/literals/regexp/invalid-braced-quantifier-lower': [FAIL], @@ -231,9 +364,6 @@ 'language/global-code/script-decl-func-err-non-configurable': [FAIL], 'language/global-code/script-decl-var-collision': [FAIL], - # https://bugs.chromium.org/p/v8/issues/detail?id=4958 - 'built-ins/Function/prototype/toString/*': ['--harmony-function-tostring'], - # https://bugs.chromium.org/p/v8/issues/detail?id=5116 'built-ins/TypedArray/prototype/fill/fill-values-conversion-operations-consistent-nan': [PASS, FAIL], @@ -313,9 +443,6 @@ 'annexB/language/eval-code/direct/func-switch-case-eval-func-no-skip-try': [FAIL], 'annexB/language/eval-code/direct/func-switch-dflt-eval-func-no-skip-try': [FAIL], - # https://bugs.chromium.org/p/v8/issues/detail?id=5537 - 'built-ins/global/*': [SKIP], - # PreParser doesn't produce early errors # https://bugs.chromium.org/p/v8/issues/detail?id=2728 'language/expressions/async-arrow-function/early-errors-arrow-formals-body-duplicate': [FAIL], @@ -371,18 +498,9 @@ 'built-ins/TypedArray/prototype/set/typedarray-arg-set-values-diff-buffer-same-type-sab': ['--harmony-sharedarraybuffer'], 'built-ins/TypedArray/prototype/set/typedarray-arg-set-values-same-buffer-same-type-sab': ['--harmony-sharedarraybuffer'], - # 64-bit Atomics are not implemented yet. - 'built-ins/Atomics/wake/bad-range': ['--noharmony-bigint'], - 'built-ins/Atomics/xor/bad-range': ['--noharmony-bigint'], - 'built-ins/Atomics/load/bad-range': ['--noharmony-bigint'], - 'built-ins/Atomics/compareExchange/bad-range': ['--noharmony-bigint'], - 'built-ins/Atomics/wait/bad-range': ['--noharmony-bigint'], - 'built-ins/Atomics/exchange/bad-range': ['--noharmony-bigint'], - 'built-ins/Atomics/sub/bad-range': ['--noharmony-bigint'], - 'built-ins/Atomics/store/bad-range': ['--noharmony-bigint'], - 'built-ins/Atomics/or/bad-range': ['--noharmony-bigint'], - 'built-ins/Atomics/and/bad-range': ['--noharmony-bigint'], - 'built-ins/Atomics/add/bad-range': ['--noharmony-bigint'], + # https://bugs.chromium.org/p/v8/issues/detail?id=8100 + 'built-ins/Atomics/notify/bigint/*': [SKIP], + 'built-ins/Atomics/wait/bigint/*': [SKIP], # https://bugs.chromium.org/p/v8/issues/detail?id=6049 'built-ins/Object/internals/DefineOwnProperty/consistent-value-function-caller': [FAIL_SLOPPY], @@ -432,6 +550,9 @@ # https://bugs.chromium.org/p/v8/issues/detail?id=7669 'intl402/Intl/getCanonicalLocales/canonicalized-tags': [FAIL], + # https://bugs.chromium.org/p/v8/issues/detail?id=8051 + 'intl402/Collator/unicode-ext-seq-in-private-tag': [FAIL], + # Tests assume that the sort order of "same elements" (comparator returns 0) # is deterministic. # https://crbug.com/v8/7808 @@ -439,43 +560,43 @@ 'intl402/Collator/prototype/compare/bound-to-collator-instance': [SKIP], 'intl402/Collator/ignore-invalid-unicode-ext-values': [SKIP], - # https://bugs.chromium.org/p/v8/issues/detail?id=7684 + # https://bugs.chromium.org/p/v8/issues/detail?id=8260 + 'intl402/Locale/constructor-non-iana-canon': [FAIL], + + # https://bugs.chromium.org/p/v8/issues/detail?id=8261 + 'intl402/Locale/constructor-options-language-valid': [FAIL], + + # https://bugs.chromium.org/p/v8/issues/detail?id=8262 + 'intl402/Locale/constructor-parse-twice': [FAIL], + + # https://bugs.chromium.org/p/v8/issues/detail?id=8246 + 'intl402/Locale/constructor-tag': [FAIL], + + # https://bugs.chromium.org/p/v8/issues/detail?id=8244 'intl402/Locale/constructor-getter-order': [FAIL], 'intl402/Locale/constructor-locale-object': [FAIL], - 'intl402/Locale/constructor-non-iana-canon': [FAIL], 'intl402/Locale/constructor-options-language-grandfathered': [FAIL], 'intl402/Locale/constructor-options-language-invalid': [FAIL], - 'intl402/Locale/constructor-options-language-valid': [FAIL], 'intl402/Locale/constructor-options-region-invalid': [FAIL], 'intl402/Locale/constructor-options-region-valid': [FAIL], 'intl402/Locale/constructor-options-script-invalid': [FAIL], 'intl402/Locale/constructor-options-script-valid': [FAIL], - 'intl402/Locale/constructor-parse-twice': [FAIL], - 'intl402/Locale/constructor-tag': [FAIL], - 'intl402/Locale/constructor-unicode-ext-invalid': [FAIL], - 'intl402/Locale/constructor-unicode-ext-valid': [FAIL], - 'intl402/Locale/extensions-grandfathered': [FAIL], - 'intl402/Locale/extensions-private': [FAIL], 'intl402/Locale/getters': [FAIL], - 'intl402/Locale/getters-grandfathered': [FAIL], + + # https://bugs.chromium.org/p/v8/issues/detail?id=8243 + 'intl402/Locale/extensions-private': [FAIL], 'intl402/Locale/getters-privateuse': [FAIL], - 'intl402/Locale/invalid-tag-throws': [FAIL], - 'intl402/Locale/likely-subtags': [FAIL], - 'intl402/Locale/likely-subtags-grandfathered': [FAIL], - 'intl402/Locale/prototype/toStringTag/toStringTag': [FAIL], - 'intl402/Locale/prototype/toStringTag/toString': [FAIL], - # https://bugs.chromium.org/p/v8/issues/detail?id=7869 - 'intl402/RelativeTimeFormat/constructor/supportedLocalesOf/branding': [FAIL], - 'intl402/RelativeTimeFormat/constructor/supportedLocalesOf/length': [FAIL], - 'intl402/RelativeTimeFormat/constructor/supportedLocalesOf/name': [FAIL], - 'intl402/RelativeTimeFormat/constructor/supportedLocalesOf/prop-desc': [FAIL], + # https://bugs.chromium.org/p/v8/issues/detail?id=8236 + 'intl402/Locale/likely-subtags': [FAIL], - # https://bugs.chromium.org/p/v8/issues/detail?id=7993 - 'intl402/RelativeTimeFormat/prototype/toStringTag/toStringTag': [FAIL], + # https://bugs.chromium.org/p/v8/issues/detail?id=8242 + 'intl402/Locale/extensions-grandfathered': [FAIL], + 'intl402/Locale/getters-grandfathered': [FAIL], + 'intl402/Locale/likely-subtags-grandfathered': [FAIL], - # https://bugs.chromium.org/p/v8/issues/detail?id=7814 - 'built-ins/Array/prototype/splice/property-traps-order-with-species': [FAIL], + # Wrong test see https://github.com/tc39/test262/pull/1835 + 'intl402/Locale/constructor-options-numeric-valid': [FAIL], # https://bugs.chromium.org/p/v8/issues/detail?id=6705 'built-ins/Object/assign/strings-and-symbol-order': [FAIL], @@ -489,6 +610,12 @@ '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=8099 + 'intl402/NumberFormat/prototype/format/format-negative-numbers': [FAIL], + + # https://bugs.chromium.org/p/v8/issues/detail?id=7871 + 'intl402/ListFormat/prototype/formatToParts/en-us-disjunction': [FAIL], + ######################## NEEDS INVESTIGATION ########################### # These test failures are specific to the intl402 suite and need investigation @@ -500,15 +627,21 @@ # https://bugs.chromium.org/p/v8/issues/detail?id=7833 'built-ins/Atomics/wait/cannot-suspend-throws': [SKIP], 'built-ins/Atomics/wait/undefined-index-defaults-to-zero': [SKIP], - 'built-ins/Atomics/wait/waiterlist-order-of-operations-is-fifo': [SKIP], - 'built-ins/Atomics/wake/count-defaults-to-infinity-missing': [SKIP], - 'built-ins/Atomics/wake/count-defaults-to-infinity-undefined': [SKIP], - 'built-ins/Atomics/wake/undefined-index-defaults-to-zero': [SKIP], - # Flaky failure - # https://bugs.chromium.org/p/v8/issues/detail?id=7876 - 'built-ins/Atomics/wait/waiterlist-block-indexedposition-wake': [SKIP], - 'built-ins/Atomics/wake/wake-in-order': [SKIP], + # https://bugs.chromium.org/p/v8/issues/detail?id=6890#c12 + 'built-ins/RegExp/prototype/Symbol.matchAll/isregexp-called-once': [FAIL], + 'built-ins/RegExp/prototype/Symbol.matchAll/species-constructor': [FAIL], + 'built-ins/RegExp/prototype/Symbol.matchAll/species-regexp-get-global-throws': [FAIL], + 'built-ins/RegExp/prototype/Symbol.matchAll/species-regexp-get-unicode-throws': [FAIL], + 'built-ins/String/prototype/matchAll/regexp-prototype-has-no-matchAll': [FAIL], + + # https://bugs.chromium.org/p/v8/issues/detail?id=8258 + 'intl402/Locale/constructor-options-language-valid-undefined': [FAIL], + 'intl402/Locale/constructor-options-throwing-getters': [FAIL], + 'intl402/Locale/constructor-tag-tostring': [FAIL], + 'intl402/NumberFormat/prototype/format/format-fraction-digits-precision': [FAIL], + 'intl402/NumberFormat/prototype/format/format-significant-digits-precision': [FAIL], + 'intl402/NumberFormat/prototype/formatToParts/value-tonumber': [FAIL], ##################### DELIBERATE INCOMPATIBILITIES ##################### @@ -516,9 +649,6 @@ 'annexB/language/function-code/block-decl-func-skip-arguments': [FAIL], # https://bugs.chromium.org/p/v8/issues/detail?id=6538 - 'built-ins/Array/prototype/unshift/throws-if-integer-limit-exceeded': [SKIP], - 'built-ins/Array/prototype/splice/create-species-length-exceeding-integer-limit': [FAIL], - 'built-ins/Array/prototype/splice/throws-if-integer-limit-exceeded': [SKIP], # https://bugs.chromium.org/p/v8/issues/detail?id=6541 'language/export/escaped-as-export-specifier': [FAIL], @@ -568,7 +698,6 @@ 'built-ins/decodeURIComponent/S15.1.3.2_A1.11_T1': [SKIP], 'built-ins/decodeURIComponent/S15.1.3.2_A1.12_T1': [SKIP], 'built-ins/decodeURIComponent/S15.1.3.2_A2.5_T1': [SKIP], - 'built-ins/RegExp/S15.10.2.12_A3_T1': [SKIP], 'language/literals/regexp/S7.8.5_A1.1_T2': [SKIP], 'language/literals/regexp/S7.8.5_A1.4_T2': [SKIP], 'language/literals/regexp/S7.8.5_A2.1_T2': [SKIP], @@ -578,6 +707,18 @@ # https://bugs.chromium.org/p/v8/issues/detail?id=7187 'built-ins/Function/prototype/toString/line-terminator-normalisation-CR': [SKIP], + 'language/expressions/class/fields-private-derived-cls-direct-eval-err-contains-supercall': [FAIL], + 'language/expressions/class/fields-private-derived-cls-direct-eval-err-contains-supercall-1': [FAIL], + 'language/expressions/class/fields-private-derived-cls-direct-eval-err-contains-supercall-2': [FAIL], + 'language/expressions/class/fields-private-derived-cls-indirect-eval-err-contains-supercall': [FAIL], + 'language/expressions/class/fields-private-derived-cls-indirect-eval-err-contains-supercall-1': [FAIL], + 'language/expressions/class/fields-private-derived-cls-indirect-eval-err-contains-supercall-2': [FAIL], + 'language/statements/class/fields-private-derived-cls-direct-eval-err-contains-supercall': [FAIL], + 'language/statements/class/fields-private-derived-cls-direct-eval-err-contains-supercall-1': [FAIL], + 'language/statements/class/fields-private-derived-cls-direct-eval-err-contains-supercall-2': [FAIL], + 'language/statements/class/fields-private-derived-cls-indirect-eval-err-contains-supercall': [FAIL], + 'language/statements/class/fields-private-derived-cls-indirect-eval-err-contains-supercall-1': [FAIL], + 'language/statements/class/fields-private-derived-cls-indirect-eval-err-contains-supercall-2': [FAIL], ############################ SLOW TESTS ############################# @@ -586,8 +727,6 @@ 'language/comments/S7.4_A5': [PASS, SLOW], 'language/comments/S7.4_A6': [PASS, SLOW], - # https://crbug.com/v8/7841 - 'built-ins/Atomics/wake/wake-rewake-noop': [SKIP], }], # ALWAYS ['no_i18n == True', { @@ -652,6 +791,59 @@ # 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/module-code/dynamic-import/eval-export-dflt-cls-anon': [SKIP], + 'language/module-code/dynamic-import/eval-export-dflt-cls-named': [SKIP], + 'language/module-code/dynamic-import/eval-export-dflt-cls-name-meth': [SKIP], + 'language/module-code/dynamic-import/eval-export-dflt-expr-cls-anon': [SKIP], + 'language/module-code/dynamic-import/eval-export-dflt-expr-cls-named': [SKIP], + 'language/module-code/dynamic-import/eval-export-dflt-expr-cls-name-meth': [SKIP], + 'language/module-code/dynamic-import/eval-export-dflt-expr-fn-anon': [SKIP], + 'language/module-code/dynamic-import/eval-export-dflt-expr-fn-named': [SKIP], + 'language/module-code/dynamic-import/eval-export-dflt-expr-gen-anon': [SKIP], + 'language/module-code/dynamic-import/eval-export-dflt-expr-gen-named': [SKIP], + 'language/module-code/dynamic-import/eval-export-dflt-expr-in': [SKIP], + 'language/module-code/dynamic-import/usage/nested-arrow-assignment-expression-eval-gtbndng-indirect-update-dflt': [SKIP], + 'language/module-code/dynamic-import/usage/nested-arrow-assignment-expression-eval-gtbndng-indirect-update': [SKIP], + 'language/module-code/dynamic-import/usage/nested-arrow-assignment-expression-returns-promise': [SKIP], + 'language/module-code/dynamic-import/usage/nested-arrow-import-then-eval-gtbndng-indirect-update-dflt': [SKIP], + 'language/module-code/dynamic-import/usage/nested-arrow-import-then-eval-gtbndng-indirect-update': [SKIP], + 'language/module-code/dynamic-import/usage/nested-arrow-import-then-returns-promise': [SKIP], + 'language/module-code/dynamic-import/usage/nested-async-function-await-eval-gtbndng-indirect-update-dflt': [SKIP], + 'language/module-code/dynamic-import/usage/nested-async-function-await-eval-gtbndng-indirect-update': [SKIP], + 'language/module-code/dynamic-import/usage/nested-async-function-await-returns-promise': [SKIP], + 'language/module-code/dynamic-import/usage/nested-async-function-eval-gtbndng-indirect-update-dflt': [SKIP], + 'language/module-code/dynamic-import/usage/nested-async-function-eval-gtbndng-indirect-update': [SKIP], + 'language/module-code/dynamic-import/usage/nested-async-function-return-await-eval-gtbndng-indirect-update-dflt': [SKIP], + 'language/module-code/dynamic-import/usage/nested-async-function-return-await-eval-gtbndng-indirect-update': [SKIP], + 'language/module-code/dynamic-import/usage/nested-async-function-return-await-returns-promise': [SKIP], + 'language/module-code/dynamic-import/usage/nested-async-function-returns-promise': [SKIP], + 'language/module-code/dynamic-import/usage/nested-block-import-then-eval-gtbndng-indirect-update-dflt': [SKIP], + 'language/module-code/dynamic-import/usage/nested-block-import-then-eval-gtbndng-indirect-update': [SKIP], + 'language/module-code/dynamic-import/usage/nested-block-import-then-returns-promise': [SKIP], + 'language/module-code/dynamic-import/usage/nested-do-while-eval-gtbndng-indirect-update-dflt': [SKIP], + 'language/module-code/dynamic-import/usage/nested-do-while-eval-gtbndng-indirect-update': [SKIP], + 'language/module-code/dynamic-import/usage/nested-do-while-returns-promise': [SKIP], + 'language/module-code/dynamic-import/usage/nested-else-import-then-eval-gtbndng-indirect-update-dflt': [SKIP], + 'language/module-code/dynamic-import/usage/nested-else-import-then-eval-gtbndng-indirect-update': [SKIP], + 'language/module-code/dynamic-import/usage/nested-else-import-then-returns-promise': [SKIP], + 'language/module-code/dynamic-import/usage/nested-function-import-then-eval-gtbndng-indirect-update-dflt': [SKIP], + 'language/module-code/dynamic-import/usage/nested-function-import-then-eval-gtbndng-indirect-update': [SKIP], + 'language/module-code/dynamic-import/usage/nested-function-import-then-returns-promise': [SKIP], + 'language/module-code/dynamic-import/usage/nested-if-braceless-eval-gtbndng-indirect-update-dflt': [SKIP], + 'language/module-code/dynamic-import/usage/nested-if-braceless-eval-gtbndng-indirect-update': [SKIP], + 'language/module-code/dynamic-import/usage/nested-if-braceless-returns-promise': [SKIP], + 'language/module-code/dynamic-import/usage/nested-if-import-then-eval-gtbndng-indirect-update-dflt': [SKIP], + 'language/module-code/dynamic-import/usage/nested-if-import-then-eval-gtbndng-indirect-update': [SKIP], + 'language/module-code/dynamic-import/usage/nested-if-import-then-returns-promise': [SKIP], + 'language/module-code/dynamic-import/usage/nested-while-import-then-eval-gtbndng-indirect-update-dflt': [SKIP], + 'language/module-code/dynamic-import/usage/nested-while-import-then-eval-gtbndng-indirect-update': [SKIP], + 'language/module-code/dynamic-import/usage/nested-while-import-then-returns-promise': [SKIP], + 'language/module-code/dynamic-import/usage/syntax-nested-block-labeled-eval-gtbndng-indirect-update-dflt': [SKIP], + 'language/module-code/dynamic-import/usage/syntax-nested-block-labeled-eval-gtbndng-indirect-update': [SKIP], + 'language/module-code/dynamic-import/usage/syntax-nested-block-labeled-returns-promise': [SKIP], + 'language/module-code/dynamic-import/usage/top-level-import-then-eval-gtbndng-indirect-update-dflt': [SKIP], + 'language/module-code/dynamic-import/usage/top-level-import-then-eval-gtbndng-indirect-update': [SKIP], + 'language/module-code/dynamic-import/usage/top-level-import-then-returns-promise': [SKIP], }], # asan == True ['asan == True or msan == True or tsan == True', { diff --git a/deps/v8/test/test262/testcfg.py b/deps/v8/test/test262/testcfg.py index 7a1de38ce1..105f6713f2 100644 --- a/deps/v8/test/test262/testcfg.py +++ b/deps/v8/test/test262/testcfg.py @@ -42,9 +42,8 @@ from testrunner.outproc import test262 # TODO(littledan): move the flag mapping into the status file FEATURE_FLAGS = { - 'BigInt': '--harmony-bigint', 'class-fields-public': '--harmony-public-fields', - 'class-fields-private': '--harmony-private-fields', + 'class-static-fields-public': '--harmony-class-fields', 'Array.prototype.flat': '--harmony-array-flat', 'Array.prototype.flatMap': '--harmony-array-flat', 'String.prototype.matchAll': '--harmony-string-matchall', @@ -53,10 +52,18 @@ FEATURE_FLAGS = { 'Intl.ListFormat': '--harmony-intl-list-format', 'Intl.Locale': '--harmony-locale', 'Intl.RelativeTimeFormat': '--harmony-intl-relative-time-format', + 'Intl.Segmenter': '--harmony-intl-segmenter', 'Symbol.prototype.description': '--harmony-symbol-description', + 'globalThis': '--harmony-global', + 'well-formed-json-stringify': '--harmony-json-stringify', } -SKIPPED_FEATURES = set([]) +SKIPPED_FEATURES = set(['Object.fromEntries', + 'export-star-as-namespace-from-module', + 'class-fields-private', + 'class-static-fields-private', + 'class-methods-private', + 'class-static-methods-private']) DATA = os.path.join(os.path.dirname(os.path.abspath(__file__)), "data") @@ -149,7 +156,7 @@ class TestSuite(testsuite.TestSuite): return VariantsGenerator -class TestCase(testcase.TestCase): +class TestCase(testcase.D8TestCase): def __init__(self, *args, **kwargs): super(TestCase, self).__init__(*args, **kwargs) diff --git a/deps/v8/test/torque/test-torque.tq b/deps/v8/test/torque/test-torque.tq index 3c258607fc..ee0cba9c5a 100644 --- a/deps/v8/test/torque/test-torque.tq +++ b/deps/v8/test/torque/test-torque.tq @@ -4,10 +4,9 @@ module test { macro ElementsKindTestHelper1(kind: constexpr ElementsKind): bool { - if constexpr((kind == UINT8_ELEMENTS) || (kind == UINT16_ELEMENTS)) { - return true; - } - else { + if constexpr ((kind == UINT8_ELEMENTS) || (kind == UINT16_ELEMENTS)) { + return true; + } else { return false; } } @@ -21,22 +20,22 @@ module test { } macro LabelTestHelper1(): never - labels Label1 { + labels Label1 { goto Label1; } macro LabelTestHelper2(): never - labels Label2(Smi) { + labels Label2(Smi) { goto Label2(42); } macro LabelTestHelper3(): never - labels Label3(String, Smi) { + labels Label3(String, Smi) { goto Label3('foo', 7); } macro TestConstexpr1() { - check(from_constexpr<bool>(IsFastElementsKind(PACKED_SMI_ELEMENTS))); + check(FromConstexpr<bool>(IsFastElementsKind(PACKED_SMI_ELEMENTS))); } macro TestConstexprIf() { @@ -46,10 +45,10 @@ module test { } macro TestConstexprReturn() { - check(from_constexpr<bool>(ElementsKindTestHelper3(UINT8_ELEMENTS))); - check(from_constexpr<bool>(ElementsKindTestHelper3(UINT16_ELEMENTS))); - check(!from_constexpr<bool>(ElementsKindTestHelper3(UINT32_ELEMENTS))); - check(from_constexpr<bool>(!ElementsKindTestHelper3(UINT32_ELEMENTS))); + check(FromConstexpr<bool>(ElementsKindTestHelper3(UINT8_ELEMENTS))); + check(FromConstexpr<bool>(ElementsKindTestHelper3(UINT16_ELEMENTS))); + check(!FromConstexpr<bool>(ElementsKindTestHelper3(UINT32_ELEMENTS))); + check(FromConstexpr<bool>(!ElementsKindTestHelper3(UINT32_ELEMENTS))); } macro TestGotoLabel(): Boolean { @@ -82,7 +81,7 @@ module test { } } - builtin GenericBuiltinTest<T : type>(c: Context, param: T): Object { + builtin GenericBuiltinTest<T: type>(c: Context, param: T): Object { return Null; } @@ -97,8 +96,9 @@ module test { check(GenericBuiltinTest<Object>(c, Undefined) == Undefined); } - macro LabelTestHelper4(flag: constexpr bool): never labels Label4, Label5 { - if constexpr(flag) { + macro LabelTestHelper4(flag: constexpr bool): never + labels Label4, Label5 { + if constexpr (flag) { goto Label4; } else { goto Label5; @@ -128,7 +128,7 @@ module test { } } - macro GenericMacroTest<T : type>(param: T): Object { + macro GenericMacroTest<T: type>(param: T): Object { return Undefined; } @@ -136,25 +136,31 @@ module test { return param2; } - macro GenericMacroTestWithLabels<T : type>(param: T): Object labels X { + macro GenericMacroTestWithLabels<T: type>(param: T): Object + labels X { return Undefined; } - GenericMacroTestWithLabels<Object>(param2: Object): Object labels Y { - return param2; + GenericMacroTestWithLabels<Object>(param2: Object): Object + labels Y { + return Cast<Smi>(param2) otherwise Y; } macro TestMacroSpecialization() { try { + const smi0: Smi = 0; check(GenericMacroTest<Smi>(0) == Undefined); check(GenericMacroTest<Smi>(1) == Undefined); check(GenericMacroTest<Object>(Null) == Null); check(GenericMacroTest<Object>(False) == False); check(GenericMacroTest<Object>(True) == True); - check(GenericMacroTestWithLabels<Smi>(0) otherwise Fail == Undefined); - check(GenericMacroTestWithLabels<Smi>(0) otherwise Fail == Undefined); - check(GenericMacroTestWithLabels<Object>(Null) otherwise Fail == Null); - check(GenericMacroTestWithLabels<Object>(False) otherwise Fail == False); + check((GenericMacroTestWithLabels<Smi>(0) otherwise Fail) == Undefined); + check((GenericMacroTestWithLabels<Smi>(0) otherwise Fail) == Undefined); + check((GenericMacroTestWithLabels<Object>(smi0) otherwise Fail) == smi0); + try { + GenericMacroTestWithLabels<Object>(False) otherwise Expected; + } + label Expected {} } label Fail { unreachable; @@ -177,8 +183,8 @@ module test { } macro TestVariableRedeclaration(context: Context): Boolean { - let var1: int31 = from_constexpr<bool>(42 == 0) ? 0 : 1; - let var2: int31 = from_constexpr<bool>(42 == 0) ? 1 : 0; + let var1: int31 = FromConstexpr<bool>(42 == 0) ? 0 : 1; + let var2: int31 = FromConstexpr<bool>(42 == 0) ? 1 : 0; return True; } @@ -204,7 +210,7 @@ module test { macro TestUnsafeCast(c: Context, n: Number): Boolean { if (TaggedIsSmi(n)) { - let m: Smi = unsafe_cast<Smi>(n); + let m: Smi = UnsafeCast<Smi>(n); check(TestHelperPlus1(c, m) == 11); return True; @@ -213,8 +219,8 @@ module test { } macro TestHexLiteral() { - check(convert<intptr>(0xffff) + 1 == 0x10000); - check(convert<intptr>(-0xffff) == -65535); + check(Convert<intptr>(0xffff) + 1 == 0x10000); + check(Convert<intptr>(-0xffff) == -65535); } macro TestLargeIntegerLiterals(c: Context) { @@ -244,17 +250,17 @@ module test { } macro TestLocalConstBindings() { - const x : constexpr int31 = 3; - const x_smi : Smi = x; + const x: constexpr int31 = 3; + const xSmi: Smi = x; { - const x : Smi = x + from_constexpr<Smi>(1); - check(x == x_smi + 1); - const x_smi : Smi = x; - check(x == x_smi); + const x: Smi = x + FromConstexpr<Smi>(1); + check(x == xSmi + 1); + const xSmi: Smi = x; + check(x == xSmi); check(x == 4); } - check(x_smi == 3); - check(x == x_smi); + check(xSmi == 3); + check(x == xSmi); } struct TestStructA { @@ -273,12 +279,12 @@ module test { } macro TestStruct2(): TestStructA { - return TestStructA{unsafe_cast<FixedArray>(kEmptyFixedArray), 27, 31}; + return TestStructA{UnsafeCast<FixedArray>(kEmptyFixedArray), 27, 31}; } macro TestStruct3(): TestStructA { let a: TestStructA = - TestStructA{unsafe_cast<FixedArray>(kEmptyFixedArray), 13, 5}; + TestStructA{UnsafeCast<FixedArray>(kEmptyFixedArray), 13, 5}; let b: TestStructA = a; let c: TestStructA = TestStruct2(); a.i = TestStruct1(c); @@ -287,14 +293,15 @@ module test { d.x = a; d = TestStructB{a, 7}; let e: TestStructA = d.x; - let f: Smi = TestStructA{unsafe_cast<FixedArray>(kEmptyFixedArray), 27, 31}.i; + let f: Smi = + TestStructA{UnsafeCast<FixedArray>(kEmptyFixedArray), 27, 31}.i; f = TestStruct2().i; return a; } struct TestStructC { - x : TestStructA; - y : TestStructA; + x: TestStructA; + y: TestStructA; } macro TestStruct4(): TestStructC { @@ -387,38 +394,42 @@ module test { check(sum == 7); } - macro TestSubtyping(x : Smi) { - const foo : Object = x; + macro TestSubtyping(x: Smi) { + const foo: Object = x; } - macro IncrementIfSmi<A : type>(x : A) : A { + macro IncrementIfSmi<A: type>(x: A): A { typeswitch (x) { - case (x : Smi) { + case (x: Smi): { return x + 1; - } case (o : A) { + } + case (o: A): { return o; } } } - macro TypeswitchExample(x : Number | FixedArray) : int32 { - let result : int32 = 0; - typeswitch (IncrementIfSmi<(Number|FixedArray)>(x)) { - case (x : FixedArray) { + macro TypeswitchExample(x: Number | FixedArray): int32 { + let result: int32 = 0; + typeswitch (IncrementIfSmi<(Number | FixedArray)>(x)) { + case (x: FixedArray): { result = result + 1; - } case (Number) { + } + case (Number): { result = result + 2; } } result = result * 10; - typeswitch (IncrementIfSmi<(Number|FixedArray)>(x)) { - case (x : Smi) { - result = result + convert<int32>(x); - } case (a : FixedArray) { - result = result + convert<int32>(a.length); - } case (x : HeapNumber) { + typeswitch (IncrementIfSmi<(Number | FixedArray)>(x)) { + case (x: Smi): { + result = result + Convert<int32>(x); + } + case (a: FixedArray): { + result = result + Convert<int32>(a.length); + } + case (x: HeapNumber): { result = result + 7; } } @@ -427,23 +438,154 @@ module test { } macro TestTypeswitch() { - check(TypeswitchExample(from_constexpr<Smi>(5)) == 26); - const a : FixedArray = AllocateZeroedFixedArray(3); + check(TypeswitchExample(FromConstexpr<Smi>(5)) == 26); + const a: FixedArray = AllocateZeroedFixedArray(3); check(TypeswitchExample(a) == 13); - check(TypeswitchExample(from_constexpr<Number>(0.5)) == 27); + check(TypeswitchExample(FromConstexpr<Number>(0.5)) == 27); } - macro ExampleGenericOverload<A: type>(o : Object) : A { + macro ExampleGenericOverload<A: type>(o: Object): A { return o; } - macro ExampleGenericOverload<A: type>(o : Smi) : A { + macro ExampleGenericOverload<A: type>(o: Smi): A { return o + 1; } macro TestGenericOverload() { - const x_smi : Smi = 5; - const x_object : Object = x_smi; - check(ExampleGenericOverload<Smi>(x_smi) == 6); - check(unsafe_cast<Smi>(ExampleGenericOverload<Object>(x_object)) == 5); + const xSmi: Smi = 5; + const xObject: Object = xSmi; + check(ExampleGenericOverload<Smi>(xSmi) == 6); + check(UnsafeCast<Smi>(ExampleGenericOverload<Object>(xObject)) == 5); + } + + macro BoolToBranch(x: bool): never + labels Taken, NotTaken { + if (x) { + goto Taken; + } else { + goto NotTaken; + } + } + + macro TestOrAnd1(x: bool, y: bool, z: bool): bool { + return BoolToBranch(x) || y && z ? true : false; + } + + macro TestOrAnd2(x: bool, y: bool, z: bool): bool { + return x || BoolToBranch(y) && z ? true : false; + } + + macro TestOrAnd3(x: bool, y: bool, z: bool): bool { + return x || y && BoolToBranch(z) ? true : false; + } + + macro TestAndOr1(x: bool, y: bool, z: bool): bool { + return BoolToBranch(x) && y || z ? true : false; + } + + macro TestAndOr2(x: bool, y: bool, z: bool): bool { + return x && BoolToBranch(y) || z ? true : false; + } + + macro TestAndOr3(x: bool, y: bool, z: bool): bool { + return x && y || BoolToBranch(z) ? true : false; + } + + macro TestLogicalOperators() { + check(TestAndOr1(true, true, true)); + check(TestAndOr2(true, true, true)); + check(TestAndOr3(true, true, true)); + check(TestAndOr1(true, true, false)); + check(TestAndOr2(true, true, false)); + check(TestAndOr3(true, true, false)); + check(TestAndOr1(true, false, true)); + check(TestAndOr2(true, false, true)); + check(TestAndOr3(true, false, true)); + check(!TestAndOr1(true, false, false)); + check(!TestAndOr2(true, false, false)); + check(!TestAndOr3(true, false, false)); + check(TestAndOr1(false, true, true)); + check(TestAndOr2(false, true, true)); + check(TestAndOr3(false, true, true)); + check(!TestAndOr1(false, true, false)); + check(!TestAndOr2(false, true, false)); + check(!TestAndOr3(false, true, false)); + check(TestAndOr1(false, false, true)); + check(TestAndOr2(false, false, true)); + check(TestAndOr3(false, false, true)); + check(!TestAndOr1(false, false, false)); + check(!TestAndOr2(false, false, false)); + check(!TestAndOr3(false, false, false)); + check(TestOrAnd1(true, true, true)); + check(TestOrAnd2(true, true, true)); + check(TestOrAnd3(true, true, true)); + check(TestOrAnd1(true, true, false)); + check(TestOrAnd2(true, true, false)); + check(TestOrAnd3(true, true, false)); + check(TestOrAnd1(true, false, true)); + check(TestOrAnd2(true, false, true)); + check(TestOrAnd3(true, false, true)); + check(TestOrAnd1(true, false, false)); + check(TestOrAnd2(true, false, false)); + check(TestOrAnd3(true, false, false)); + check(TestOrAnd1(false, true, true)); + check(TestOrAnd2(false, true, true)); + check(TestOrAnd3(false, true, true)); + check(!TestOrAnd1(false, true, false)); + check(!TestOrAnd2(false, true, false)); + check(!TestOrAnd3(false, true, false)); + check(!TestOrAnd1(false, false, true)); + check(!TestOrAnd2(false, false, true)); + check(!TestOrAnd3(false, false, true)); + check(!TestOrAnd1(false, false, false)); + check(!TestOrAnd2(false, false, false)); + check(!TestOrAnd3(false, false, false)); + } + + macro TestCall(i: Smi): Smi + labels A { + if (i < 5) return i; + goto A; + } + + macro TestOtherwiseWithCode1() { + let v: Smi = 0; + let s: Smi = 1; + try { + TestCall(10) otherwise goto B(++s); + } + label B(v1: Smi) { + v = v1; + } + assert(v == 2); + } + + macro TestOtherwiseWithCode2() { + let s: Smi = 0; + for (let i: Smi = 0; i < 10; ++i) { + TestCall(i) otherwise break; + ++s; + } + assert(s == 5); + } + + macro TestOtherwiseWithCode3() { + let s: Smi = 0; + for (let i: Smi = 0; i < 10; ++i) { + s += TestCall(i) otherwise break; + } + assert(s == 10); + } + + macro TestForwardLabel() { + try { + goto A; + } + label A { + goto B(5); + } + label B(b: Smi) { + assert(b == 5); + } } } diff --git a/deps/v8/test/unittests/BUILD.gn b/deps/v8/test/unittests/BUILD.gn index 606fe9c343..f63e2af197 100644 --- a/deps/v8/test/unittests/BUILD.gn +++ b/deps/v8/test/unittests/BUILD.gn @@ -55,6 +55,7 @@ v8_source_set("unittests_sources") { "asmjs/asm-scanner-unittest.cc", "asmjs/asm-types-unittest.cc", "asmjs/switch-logic-unittest.cc", + "base/address-region-unittest.cc", "base/atomic-utils-unittest.cc", "base/bits-unittest.cc", "base/cpu-unittest.cc", @@ -72,8 +73,10 @@ v8_source_set("unittests_sources") { "base/platform/platform-unittest.cc", "base/platform/semaphore-unittest.cc", "base/platform/time-unittest.cc", + "base/region-allocator-unittest.cc", "base/sys-info-unittest.cc", "base/template-utils-unittest.cc", + "base/threaded-list-unittest.cc", "base/utils/random-number-generator-unittest.cc", "bigint-unittest.cc", "cancelable-tasks-unittest.cc", @@ -112,6 +115,7 @@ v8_source_set("unittests_sources") { "compiler/js-call-reducer-unittest.cc", "compiler/js-create-lowering-unittest.cc", "compiler/js-intrinsic-lowering-unittest.cc", + "compiler/js-native-context-specialization-unittest.cc", "compiler/js-operator-unittest.cc", "compiler/js-typed-lowering-unittest.cc", "compiler/linkage-tail-call-unittest.cc", @@ -128,6 +132,7 @@ v8_source_set("unittests_sources") { "compiler/node-unittest.cc", "compiler/opcodes-unittest.cc", "compiler/persistent-unittest.cc", + "compiler/redundancy-elimination-unittest.cc", "compiler/regalloc/live-range-unittest.cc", "compiler/regalloc/move-optimizer-unittest.cc", "compiler/regalloc/register-allocator-unittest.cc", @@ -182,6 +187,7 @@ v8_source_set("unittests_sources") { "libplatform/worker-thread-unittest.cc", "locked-queue-unittest.cc", "object-unittest.cc", + "objects/microtask-queue-unittest.cc", "parser/ast-value-unittest.cc", "parser/preparser-unittest.cc", "register-configuration-unittest.cc", diff --git a/deps/v8/test/unittests/allocation-unittest.cc b/deps/v8/test/unittests/allocation-unittest.cc index 3e43cdd4ea..7b543ece24 100644 --- a/deps/v8/test/unittests/allocation-unittest.cc +++ b/deps/v8/test/unittests/allocation-unittest.cc @@ -40,7 +40,7 @@ class MemoryAllocationPermissionsTest : public ::testing::Test { #endif protected: - virtual void SetUp() { + void SetUp() override { struct sigaction action; action.sa_sigaction = SignalHandler; sigemptyset(&action.sa_mask); @@ -51,7 +51,7 @@ class MemoryAllocationPermissionsTest : public ::testing::Test { #endif } - virtual void TearDown() { + void TearDown() override { // Be a good citizen and restore the old signal handler. sigaction(SIGSEGV, &old_action_, nullptr); #if V8_OS_MACOSX @@ -95,12 +95,14 @@ class MemoryAllocationPermissionsTest : public ::testing::Test { void TestPermissions(PageAllocator::Permission permission, bool can_read, bool can_write) { - const size_t page_size = AllocatePageSize(); - int* buffer = static_cast<int*>( - AllocatePages(nullptr, page_size, page_size, permission)); + v8::PageAllocator* page_allocator = + v8::internal::GetPlatformPageAllocator(); + const size_t page_size = page_allocator->AllocatePageSize(); + int* buffer = static_cast<int*>(AllocatePages( + page_allocator, nullptr, page_size, page_size, permission)); ProbeMemory(buffer, MemoryAction::kRead, can_read); ProbeMemory(buffer, MemoryAction::kWrite, can_write); - CHECK(FreePages(buffer, page_size)); + CHECK(FreePages(page_allocator, buffer, page_size)); } }; @@ -125,41 +127,46 @@ TEST(AllocationTest, AllocateAndFree) { size_t page_size = v8::internal::AllocatePageSize(); CHECK_NE(0, page_size); + v8::PageAllocator* page_allocator = v8::internal::GetPlatformPageAllocator(); + // A large allocation, aligned at native allocation granularity. const size_t kAllocationSize = 1 * v8::internal::MB; void* mem_addr = v8::internal::AllocatePages( - v8::internal::GetRandomMmapAddr(), kAllocationSize, page_size, - PageAllocator::Permission::kReadWrite); + page_allocator, page_allocator->GetRandomMmapAddr(), kAllocationSize, + page_size, PageAllocator::Permission::kReadWrite); CHECK_NOT_NULL(mem_addr); - CHECK(v8::internal::FreePages(mem_addr, kAllocationSize)); + CHECK(v8::internal::FreePages(page_allocator, mem_addr, kAllocationSize)); // A large allocation, aligned significantly beyond native granularity. const size_t kBigAlignment = 64 * v8::internal::MB; void* aligned_mem_addr = v8::internal::AllocatePages( - AlignedAddress(v8::internal::GetRandomMmapAddr(), kBigAlignment), + page_allocator, + AlignedAddress(page_allocator->GetRandomMmapAddr(), kBigAlignment), kAllocationSize, kBigAlignment, PageAllocator::Permission::kReadWrite); CHECK_NOT_NULL(aligned_mem_addr); CHECK_EQ(aligned_mem_addr, AlignedAddress(aligned_mem_addr, kBigAlignment)); - CHECK(v8::internal::FreePages(aligned_mem_addr, kAllocationSize)); + CHECK(v8::internal::FreePages(page_allocator, aligned_mem_addr, + kAllocationSize)); } TEST(AllocationTest, ReserveMemory) { + v8::PageAllocator* page_allocator = v8::internal::GetPlatformPageAllocator(); size_t page_size = v8::internal::AllocatePageSize(); const size_t kAllocationSize = 1 * v8::internal::MB; void* mem_addr = v8::internal::AllocatePages( - v8::internal::GetRandomMmapAddr(), kAllocationSize, page_size, - PageAllocator::Permission::kReadWrite); + page_allocator, page_allocator->GetRandomMmapAddr(), kAllocationSize, + page_size, PageAllocator::Permission::kReadWrite); CHECK_NE(0, page_size); CHECK_NOT_NULL(mem_addr); - size_t commit_size = v8::internal::CommitPageSize(); - CHECK(v8::internal::SetPermissions(mem_addr, commit_size, + size_t commit_size = page_allocator->CommitPageSize(); + CHECK(v8::internal::SetPermissions(page_allocator, mem_addr, commit_size, PageAllocator::Permission::kReadWrite)); // Check whether we can write to memory. int* addr = static_cast<int*>(mem_addr); addr[v8::internal::KB - 1] = 2; - CHECK(v8::internal::SetPermissions(mem_addr, commit_size, + CHECK(v8::internal::SetPermissions(page_allocator, mem_addr, commit_size, PageAllocator::Permission::kNoAccess)); - CHECK(v8::internal::FreePages(mem_addr, kAllocationSize)); + CHECK(v8::internal::FreePages(page_allocator, mem_addr, kAllocationSize)); } } // namespace internal diff --git a/deps/v8/test/unittests/api/interceptor-unittest.cc b/deps/v8/test/unittests/api/interceptor-unittest.cc index b13384f18a..8a1db3f823 100644 --- a/deps/v8/test/unittests/api/interceptor-unittest.cc +++ b/deps/v8/test/unittests/api/interceptor-unittest.cc @@ -35,7 +35,7 @@ namespace { class InterceptorLoggingTest : public TestWithNativeContext { public: - InterceptorLoggingTest() {} + InterceptorLoggingTest() = default; static const int kTestIndex = 0; diff --git a/deps/v8/test/unittests/api/isolate-unittest.cc b/deps/v8/test/unittests/api/isolate-unittest.cc index 377ad83187..8ddf8a29c8 100644 --- a/deps/v8/test/unittests/api/isolate-unittest.cc +++ b/deps/v8/test/unittests/api/isolate-unittest.cc @@ -70,4 +70,73 @@ TEST_F(IsolateTest, MemoryPressureNotificationBackground) { v8::platform::PumpMessageLoop(internal::V8::GetCurrentPlatform(), isolate()); } +using IncumbentContextTest = TestWithIsolate; + +// Check that Isolate::GetIncumbentContext() returns the correct one in basic +// scenarios. +#if !defined(V8_USE_ADDRESS_SANITIZER) +TEST_F(IncumbentContextTest, MAYBE_Basic) { + auto Str = [&](const char* s) { + return String::NewFromUtf8(isolate(), s, NewStringType::kNormal) + .ToLocalChecked(); + }; + auto Run = [&](Local<Context> context, const char* script) { + Context::Scope scope(context); + return Script::Compile(context, Str(script)) + .ToLocalChecked() + ->Run(context) + .ToLocalChecked(); + }; + + // Set up the test environment; three contexts with getIncumbentGlobal() + // function. + Local<FunctionTemplate> get_incumbent_global = FunctionTemplate::New( + isolate(), [](const FunctionCallbackInfo<Value>& info) { + Local<Context> incumbent_context = + info.GetIsolate()->GetIncumbentContext(); + info.GetReturnValue().Set(incumbent_context->Global()); + }); + Local<ObjectTemplate> global_template = ObjectTemplate::New(isolate()); + global_template->Set(Str("getIncumbentGlobal"), get_incumbent_global); + + Local<Context> context_a = Context::New(isolate(), nullptr, global_template); + Local<Context> context_b = Context::New(isolate(), nullptr, global_template); + Local<Context> context_c = Context::New(isolate(), nullptr, global_template); + Local<Object> global_a = context_a->Global(); + Local<Object> global_b = context_b->Global(); + Local<Object> global_c = context_c->Global(); + + Local<String> security_token = Str("security_token"); + context_a->SetSecurityToken(security_token); + context_b->SetSecurityToken(security_token); + context_c->SetSecurityToken(security_token); + + global_a->Set(context_a, Str("b"), global_b).ToChecked(); + global_b->Set(context_b, Str("c"), global_c).ToChecked(); + + // Test scenario 2: A -> B -> C, then the incumbent is C. + Run(context_a, "funcA = function() { return b.funcB(); }"); + Run(context_b, "funcB = function() { return c.getIncumbentGlobal(); }"); + // Without BackupIncumbentScope. + EXPECT_EQ(global_b, Run(context_a, "funcA()")); + { + // With BackupIncumbentScope. + Context::BackupIncumbentScope backup_incumbent(context_a); + EXPECT_EQ(global_b, Run(context_a, "funcA()")); + } + + // Test scenario 2: A -> B -> C -> C, then the incumbent is C. + Run(context_a, "funcA = function() { return b.funcB(); }"); + Run(context_b, "funcB = function() { return c.funcC(); }"); + Run(context_c, "funcC = function() { return getIncumbentGlobal(); }"); + // Without BackupIncumbentScope. + EXPECT_EQ(global_c, Run(context_a, "funcA()")); + { + // With BackupIncumbentScope. + Context::BackupIncumbentScope backup_incumbent(context_a); + EXPECT_EQ(global_c, Run(context_a, "funcA()")); + } +} +#endif // !defined(V8_USE_ADDRESS_SANITIZER) + } // namespace v8 diff --git a/deps/v8/test/unittests/asmjs/asm-types-unittest.cc b/deps/v8/test/unittests/asmjs/asm-types-unittest.cc index f17528977c..db5ed2ba52 100644 --- a/deps/v8/test/unittests/asmjs/asm-types-unittest.cc +++ b/deps/v8/test/unittests/asmjs/asm-types-unittest.cc @@ -203,7 +203,7 @@ TEST_F(AsmTypeTest, SaneParentsMap) { << Type::CamelName()->Name() << ", parents " \ << reinterpret_cast<void*>(parents) << ", type " \ << static_cast<void*>(Type::CamelName()); \ - } while (0); + } while (false); FOR_EACH_ASM_VALUE_TYPE_LIST(V) #undef V } @@ -212,7 +212,7 @@ TEST_F(AsmTypeTest, Names) { #define V(CamelName, string_name, number, parent_types) \ do { \ EXPECT_THAT(Type::CamelName()->Name(), StrEq(string_name)); \ - } while (0); + } while (false); FOR_EACH_ASM_VALUE_TYPE_LIST(V) #undef V diff --git a/deps/v8/test/unittests/base/address-region-unittest.cc b/deps/v8/test/unittests/base/address-region-unittest.cc new file mode 100644 index 0000000000..8dffc10247 --- /dev/null +++ b/deps/v8/test/unittests/base/address-region-unittest.cc @@ -0,0 +1,66 @@ +// Copyright 2018 the V8 project authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "src/base/address-region.h" + +#include "testing/gtest/include/gtest/gtest.h" + +namespace v8 { +namespace base { + +using Address = AddressRegion::Address; + +TEST(AddressRegionTest, Contains) { + struct { + Address start; + size_t size; + } test_cases[] = {{153, 771}, {0, 227}, {-447, 447}}; + + for (size_t i = 0; i < arraysize(test_cases); i++) { + Address start = test_cases[i].start; + size_t size = test_cases[i].size; + Address end = start + size; // exclusive + + AddressRegion region(start, size); + + // Test single-argument contains(). + CHECK(!region.contains(start - 1041)); + CHECK(!region.contains(start - 1)); + CHECK(!region.contains(end)); + CHECK(!region.contains(end + 1)); + CHECK(!region.contains(end + 113)); + + CHECK(region.contains(start)); + CHECK(region.contains(start + 1)); + CHECK(region.contains(start + size / 2)); + CHECK(region.contains(end - 1)); + + // Test two-arguments contains(). + CHECK(!region.contains(start - 1, size)); + CHECK(!region.contains(start, size + 1)); + CHECK(!region.contains(start - 17, 17)); + CHECK(!region.contains(start - 17, size * 2)); + CHECK(!region.contains(end, 1)); + CHECK(!region.contains(end, static_cast<size_t>(0 - end))); + + CHECK(region.contains(start, size)); + CHECK(region.contains(start, 10)); + CHECK(region.contains(start + 11, 120)); + CHECK(region.contains(end - 13, 13)); + CHECK(!region.contains(end, 0)); + + // Zero-size queries. + CHECK(!region.contains(start - 10, 0)); + CHECK(!region.contains(start - 1, 0)); + CHECK(!region.contains(end, 0)); + CHECK(!region.contains(end + 10, 0)); + + CHECK(region.contains(start, 0)); + CHECK(region.contains(start + 10, 0)); + CHECK(region.contains(end - 1, 0)); + } +} + +} // namespace base +} // namespace v8 diff --git a/deps/v8/test/unittests/base/functional-unittest.cc b/deps/v8/test/unittests/base/functional-unittest.cc index b9295d49a0..207d5cbdd7 100644 --- a/deps/v8/test/unittests/base/functional-unittest.cc +++ b/deps/v8/test/unittests/base/functional-unittest.cc @@ -44,7 +44,7 @@ class FunctionalTest : public ::testing::Test { public: FunctionalTest() : rng_(GetRandomSeedFromFlag(::v8::internal::FLAG_random_seed)) {} - virtual ~FunctionalTest() {} + ~FunctionalTest() override = default; RandomNumberGenerator* rng() { return &rng_; } diff --git a/deps/v8/test/unittests/base/platform/condition-variable-unittest.cc b/deps/v8/test/unittests/base/platform/condition-variable-unittest.cc index 43fd335270..b32863f4b2 100644 --- a/deps/v8/test/unittests/base/platform/condition-variable-unittest.cc +++ b/deps/v8/test/unittests/base/platform/condition-variable-unittest.cc @@ -113,8 +113,8 @@ class ThreadWithSharedMutexAndConditionVariable final : public Thread { : Thread(Options("ThreadWithSharedMutexAndConditionVariable")), running_(false), finished_(false), - cv_(NULL), - mutex_(NULL) {} + cv_(nullptr), + mutex_(nullptr) {} void Run() override { LockGuard<Mutex> lock_guard(mutex_); diff --git a/deps/v8/test/unittests/base/platform/platform-unittest.cc b/deps/v8/test/unittests/base/platform/platform-unittest.cc index f9fc26a2df..d31d85447c 100644 --- a/deps/v8/test/unittests/base/platform/platform-unittest.cc +++ b/deps/v8/test/unittests/base/platform/platform-unittest.cc @@ -30,7 +30,7 @@ class ThreadLocalStorageTest : public Thread, public ::testing::Test { keys_[i] = Thread::CreateThreadLocalKey(); } } - ~ThreadLocalStorageTest() { + ~ThreadLocalStorageTest() override { for (size_t i = 0; i < arraysize(keys_); ++i) { Thread::DeleteThreadLocalKey(keys_[i]); } diff --git a/deps/v8/test/unittests/base/region-allocator-unittest.cc b/deps/v8/test/unittests/base/region-allocator-unittest.cc new file mode 100644 index 0000000000..5024ac85eb --- /dev/null +++ b/deps/v8/test/unittests/base/region-allocator-unittest.cc @@ -0,0 +1,356 @@ +// Copyright 2018 the V8 project authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "src/base/region-allocator.h" +#include "test/unittests/test-utils.h" + +#include "testing/gtest/include/gtest/gtest.h" + +namespace v8 { +namespace base { + +using Address = RegionAllocator::Address; +using v8::internal::KB; +using v8::internal::MB; + +class RegionAllocatorTest : public ::testing::TestWithParam<int> {}; + +TEST(RegionAllocatorTest, SimpleAllocateRegionAt) { + const size_t kPageSize = 4 * KB; + const size_t kPageCount = 16; + const size_t kSize = kPageSize * kPageCount; + const Address kBegin = static_cast<Address>(kPageSize * 153); + const Address kEnd = kBegin + kSize; + + RegionAllocator ra(kBegin, kSize, kPageSize); + + // Allocate the whole region. + for (Address address = kBegin; address < kEnd; address += kPageSize) { + CHECK_EQ(ra.free_size(), kEnd - address); + CHECK(ra.AllocateRegionAt(address, kPageSize)); + } + + // No free regions left, the allocation should fail. + CHECK_EQ(ra.free_size(), 0); + CHECK_EQ(ra.AllocateRegion(kPageSize), RegionAllocator::kAllocationFailure); + + // Free one region and then the allocation should succeed. + CHECK_EQ(ra.FreeRegion(kBegin), kPageSize); + CHECK_EQ(ra.free_size(), kPageSize); + CHECK(ra.AllocateRegionAt(kBegin, kPageSize)); + + // Free all the pages. + for (Address address = kBegin; address < kEnd; address += kPageSize) { + CHECK_EQ(ra.FreeRegion(address), kPageSize); + } + + // Check that the whole region is free and can be fully allocated. + CHECK_EQ(ra.free_size(), kSize); + CHECK_EQ(ra.AllocateRegion(kSize), kBegin); +} + +TEST(RegionAllocatorTest, SimpleAllocateRegion) { + const size_t kPageSize = 4 * KB; + const size_t kPageCount = 16; + const size_t kSize = kPageSize * kPageCount; + const Address kBegin = static_cast<Address>(kPageSize * 153); + const Address kEnd = kBegin + kSize; + + RegionAllocator ra(kBegin, kSize, kPageSize); + + // Allocate the whole region. + for (size_t i = 0; i < kPageCount; i++) { + CHECK_EQ(ra.free_size(), kSize - kPageSize * i); + Address address = ra.AllocateRegion(kPageSize); + CHECK_NE(address, RegionAllocator::kAllocationFailure); + CHECK_EQ(address, kBegin + kPageSize * i); + } + + // No free regions left, the allocation should fail. + CHECK_EQ(ra.free_size(), 0); + CHECK_EQ(ra.AllocateRegion(kPageSize), RegionAllocator::kAllocationFailure); + + // Try to free one page and ensure that we are able to allocate it again. + for (Address address = kBegin; address < kEnd; address += kPageSize) { + CHECK_EQ(ra.FreeRegion(address), kPageSize); + CHECK_EQ(ra.AllocateRegion(kPageSize), address); + } + CHECK_EQ(ra.free_size(), 0); +} + +TEST_P(RegionAllocatorTest, AllocateRegionRandom) { + const size_t kPageSize = 8 * KB; + const size_t kPageCountLog = 16; + const size_t kPageCount = (size_t{1} << kPageCountLog); + const size_t kSize = kPageSize * kPageCount; + const Address kBegin = static_cast<Address>(153 * MB); + const Address kEnd = kBegin + kSize; + + base::RandomNumberGenerator rng(GetParam()); + RegionAllocator ra(kBegin, kSize, kPageSize); + + std::set<Address> allocated_pages; + // The page addresses must be randomized this number of allocated pages. + const size_t kRandomizationLimit = ra.max_load_for_randomization_ / kPageSize; + CHECK_LT(kRandomizationLimit, kPageCount); + + Address last_address = kBegin; + bool saw_randomized_pages = false; + + for (size_t i = 0; i < kPageCount; i++) { + Address address = ra.AllocateRegion(&rng, kPageSize); + CHECK_NE(address, RegionAllocator::kAllocationFailure); + CHECK(IsAligned(address, kPageSize)); + CHECK_LE(kBegin, address); + CHECK_LT(address, kEnd); + CHECK_EQ(allocated_pages.find(address), allocated_pages.end()); + allocated_pages.insert(address); + + saw_randomized_pages |= (address < last_address); + last_address = address; + + if (i == kRandomizationLimit) { + // We must evidence allocation randomization till this point. + // The rest of the allocations may still be randomized depending on + // the free ranges distribution, however it is not guaranteed. + CHECK(saw_randomized_pages); + } + } + + // No free regions left, the allocation should fail. + CHECK_EQ(ra.free_size(), 0); + CHECK_EQ(ra.AllocateRegion(kPageSize), RegionAllocator::kAllocationFailure); +} + +TEST(RegionAllocatorTest, AllocateBigRegions) { + const size_t kPageSize = 4 * KB; + const size_t kPageCountLog = 10; + const size_t kPageCount = (size_t{1} << kPageCountLog) - 1; + const size_t kSize = kPageSize * kPageCount; + const Address kBegin = static_cast<Address>(kPageSize * 153); + + RegionAllocator ra(kBegin, kSize, kPageSize); + + // Allocate the whole region. + for (size_t i = 0; i < kPageCountLog; i++) { + Address address = ra.AllocateRegion(kPageSize * (size_t{1} << i)); + CHECK_NE(address, RegionAllocator::kAllocationFailure); + CHECK_EQ(address, kBegin + kPageSize * ((size_t{1} << i) - 1)); + } + + // No free regions left, the allocation should fail. + CHECK_EQ(ra.free_size(), 0); + CHECK_EQ(ra.AllocateRegion(kPageSize), RegionAllocator::kAllocationFailure); + + // Try to free one page and ensure that we are able to allocate it again. + for (size_t i = 0; i < kPageCountLog; i++) { + const size_t size = kPageSize * (size_t{1} << i); + Address address = kBegin + kPageSize * ((size_t{1} << i) - 1); + CHECK_EQ(ra.FreeRegion(address), size); + CHECK_EQ(ra.AllocateRegion(size), address); + } + CHECK_EQ(ra.free_size(), 0); +} + +TEST(RegionAllocatorTest, MergeLeftToRightCoalecsingRegions) { + const size_t kPageSize = 4 * KB; + const size_t kPageCountLog = 10; + const size_t kPageCount = (size_t{1} << kPageCountLog); + const size_t kSize = kPageSize * kPageCount; + const Address kBegin = static_cast<Address>(kPageSize * 153); + + RegionAllocator ra(kBegin, kSize, kPageSize); + + // Allocate the whole region using the following page size pattern: + // |0|1|22|3333|... + CHECK_EQ(ra.AllocateRegion(kPageSize), kBegin); + for (size_t i = 0; i < kPageCountLog; i++) { + Address address = ra.AllocateRegion(kPageSize * (size_t{1} << i)); + CHECK_NE(address, RegionAllocator::kAllocationFailure); + CHECK_EQ(address, kBegin + kPageSize * (size_t{1} << i)); + } + + // No free regions left, the allocation should fail. + CHECK_EQ(ra.free_size(), 0); + CHECK_EQ(ra.AllocateRegion(kPageSize), RegionAllocator::kAllocationFailure); + + // Try to free two coalescing regions and ensure the new page of bigger size + // can be allocated. + size_t current_size = kPageSize; + for (size_t i = 0; i < kPageCountLog; i++) { + CHECK_EQ(ra.FreeRegion(kBegin), current_size); + CHECK_EQ(ra.FreeRegion(kBegin + current_size), current_size); + current_size += current_size; + CHECK_EQ(ra.AllocateRegion(current_size), kBegin); + } + CHECK_EQ(ra.free_size(), 0); +} + +TEST_P(RegionAllocatorTest, MergeRightToLeftCoalecsingRegions) { + base::RandomNumberGenerator rng(GetParam()); + const size_t kPageSize = 4 * KB; + const size_t kPageCountLog = 10; + const size_t kPageCount = (size_t{1} << kPageCountLog); + const size_t kSize = kPageSize * kPageCount; + const Address kBegin = static_cast<Address>(kPageSize * 153); + + RegionAllocator ra(kBegin, kSize, kPageSize); + + // Allocate the whole region. + for (size_t i = 0; i < kPageCount; i++) { + Address address = ra.AllocateRegion(kPageSize); + CHECK_NE(address, RegionAllocator::kAllocationFailure); + CHECK_EQ(address, kBegin + kPageSize * i); + } + + // No free regions left, the allocation should fail. + CHECK_EQ(ra.free_size(), 0); + CHECK_EQ(ra.AllocateRegion(kPageSize), RegionAllocator::kAllocationFailure); + + // Free pages with even indices left-to-right. + for (size_t i = 0; i < kPageCount; i += 2) { + Address address = kBegin + kPageSize * i; + CHECK_EQ(ra.FreeRegion(address), kPageSize); + } + + // Free pages with odd indices right-to-left. + for (size_t i = 1; i < kPageCount; i += 2) { + Address address = kBegin + kPageSize * (kPageCount - i); + CHECK_EQ(ra.FreeRegion(address), kPageSize); + // Now we should be able to allocate a double-sized page. + CHECK_EQ(ra.AllocateRegion(kPageSize * 2), address - kPageSize); + // .. but there's a window for only one such page. + CHECK_EQ(ra.AllocateRegion(kPageSize * 2), + RegionAllocator::kAllocationFailure); + } + + // Free all the double-sized pages. + for (size_t i = 0; i < kPageCount; i += 2) { + Address address = kBegin + kPageSize * i; + CHECK_EQ(ra.FreeRegion(address), kPageSize * 2); + } + + // Check that the whole region is free and can be fully allocated. + CHECK_EQ(ra.free_size(), kSize); + CHECK_EQ(ra.AllocateRegion(kSize), kBegin); +} + +TEST(RegionAllocatorTest, Fragmentation) { + const size_t kPageSize = 64 * KB; + const size_t kPageCount = 9; + const size_t kSize = kPageSize * kPageCount; + const Address kBegin = static_cast<Address>(kPageSize * 153); + + RegionAllocator ra(kBegin, kSize, kPageSize); + + // Allocate the whole region. + for (size_t i = 0; i < kPageCount; i++) { + Address address = ra.AllocateRegion(kPageSize); + CHECK_NE(address, RegionAllocator::kAllocationFailure); + CHECK_EQ(address, kBegin + kPageSize * i); + } + + // No free regions left, the allocation should fail. + CHECK_EQ(ra.free_size(), 0); + CHECK_EQ(ra.AllocateRegion(kPageSize), RegionAllocator::kAllocationFailure); + + // Free pages in the following order and check the freed size. + struct { + size_t page_index_to_free; + size_t expected_page_count; + } testcase[] = { // ......... + {0, 9}, // x........ + {2, 9}, // x.x...... + {4, 9}, // x.x.x.... + {6, 9}, // x.x.x.x.. + {8, 9}, // x.x.x.x.x + {1, 7}, // xxx.x.x.x + {7, 5}, // xxx.x.xxx + {3, 3}, // xxxxx.xxx + {5, 1}}; // xxxxxxxxx + CHECK_EQ(kPageCount, arraysize(testcase)); + + CHECK_EQ(ra.all_regions_.size(), kPageCount); + for (size_t i = 0; i < kPageCount; i++) { + Address address = kBegin + kPageSize * testcase[i].page_index_to_free; + CHECK_EQ(ra.FreeRegion(address), kPageSize); + CHECK_EQ(ra.all_regions_.size(), testcase[i].expected_page_count); + } + + // Check that the whole region is free and can be fully allocated. + CHECK_EQ(ra.free_size(), kSize); + CHECK_EQ(ra.AllocateRegion(kSize), kBegin); +} + +TEST(RegionAllocatorTest, FindRegion) { + const size_t kPageSize = 4 * KB; + const size_t kPageCount = 16; + const size_t kSize = kPageSize * kPageCount; + const Address kBegin = static_cast<Address>(kPageSize * 153); + const Address kEnd = kBegin + kSize; + + RegionAllocator ra(kBegin, kSize, kPageSize); + + // Allocate the whole region. + for (Address address = kBegin; address < kEnd; address += kPageSize) { + CHECK_EQ(ra.free_size(), kEnd - address); + CHECK(ra.AllocateRegionAt(address, kPageSize)); + } + + // No free regions left, the allocation should fail. + CHECK_EQ(ra.free_size(), 0); + CHECK_EQ(ra.AllocateRegion(kPageSize), RegionAllocator::kAllocationFailure); + + // The out-of region requests must return end iterator. + CHECK_EQ(ra.FindRegion(kBegin - 1), ra.all_regions_.end()); + CHECK_EQ(ra.FindRegion(kBegin - kPageSize), ra.all_regions_.end()); + CHECK_EQ(ra.FindRegion(kBegin / 2), ra.all_regions_.end()); + CHECK_EQ(ra.FindRegion(kEnd), ra.all_regions_.end()); + CHECK_EQ(ra.FindRegion(kEnd + kPageSize), ra.all_regions_.end()); + CHECK_EQ(ra.FindRegion(kEnd * 2), ra.all_regions_.end()); + + for (Address address = kBegin; address < kEnd; address += kPageSize / 4) { + RegionAllocator::AllRegionsSet::iterator region_iter = + ra.FindRegion(address); + CHECK_NE(region_iter, ra.all_regions_.end()); + RegionAllocator::Region* region = *region_iter; + Address region_start = RoundDown(address, kPageSize); + CHECK_EQ(region->begin(), region_start); + CHECK_LE(region->begin(), address); + CHECK_LT(address, region->end()); + } +} + +TEST(RegionAllocatorTest, TrimRegion) { + const size_t kPageSize = 4 * KB; + const size_t kPageCount = 64; + const size_t kSize = kPageSize * kPageCount; + const Address kBegin = static_cast<Address>(kPageSize * 153); + + RegionAllocator ra(kBegin, kSize, kPageSize); + + Address address = kBegin + 13 * kPageSize; + size_t size = 37 * kPageSize; + size_t free_size = kSize - size; + CHECK(ra.AllocateRegionAt(address, size)); + + size_t trim_size = kPageSize; + do { + CHECK_EQ(ra.CheckRegion(address), size); + CHECK_EQ(ra.free_size(), free_size); + + trim_size = std::min(size, trim_size); + size -= trim_size; + free_size += trim_size; + CHECK_EQ(ra.TrimRegion(address, size), trim_size); + trim_size *= 2; + } while (size != 0); + + // Check that the whole region is free and can be fully allocated. + CHECK_EQ(ra.free_size(), kSize); + CHECK_EQ(ra.AllocateRegion(kSize), kBegin); +} + +} // namespace base +} // namespace v8 diff --git a/deps/v8/test/unittests/base/threaded-list-unittest.cc b/deps/v8/test/unittests/base/threaded-list-unittest.cc new file mode 100644 index 0000000000..96a730370b --- /dev/null +++ b/deps/v8/test/unittests/base/threaded-list-unittest.cc @@ -0,0 +1,309 @@ +// Copyright 2018 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 <iterator> + +#include "src/v8.h" + +#include "src/base/threaded-list.h" +#include "testing/gtest-support.h" + +namespace v8 { +namespace base { + +struct ThreadedListTestNode { + ThreadedListTestNode() : next_(nullptr), other_next_(nullptr) {} + + ThreadedListTestNode** next() { return &next_; } + + ThreadedListTestNode* next_; + + struct OtherTraits { + static ThreadedListTestNode** next(ThreadedListTestNode* t) { + return t->other_next(); + } + }; + + ThreadedListTestNode** other_next() { return &other_next_; } + + ThreadedListTestNode* other_next_; +}; + +struct ThreadedListTest : public ::testing::Test { + static const size_t INIT_NODES = 5; + ThreadedListTest() {} + + void SetUp() override { + for (size_t i = 0; i < INIT_NODES; i++) { + nodes[i] = ThreadedListTestNode(); + } + + for (size_t i = 0; i < INIT_NODES; i++) { + list.Add(&nodes[i]); + normal_next_list.Add(&nodes[i]); + } + + // Verify if setup worked + CHECK(list.Verify()); + CHECK_EQ(list.LengthForTest(), INIT_NODES); + CHECK(normal_next_list.Verify()); + CHECK_EQ(normal_next_list.LengthForTest(), INIT_NODES); + + extra_test_node_0 = ThreadedListTestNode(); + extra_test_node_1 = ThreadedListTestNode(); + extra_test_node_2 = ThreadedListTestNode(); + + extra_test_list.Add(&extra_test_node_0); + extra_test_list.Add(&extra_test_node_1); + extra_test_list.Add(&extra_test_node_2); + CHECK_EQ(extra_test_list.LengthForTest(), 3); + CHECK(extra_test_list.Verify()); + + normal_extra_test_list.Add(&extra_test_node_0); + normal_extra_test_list.Add(&extra_test_node_1); + normal_extra_test_list.Add(&extra_test_node_2); + CHECK_EQ(normal_extra_test_list.LengthForTest(), 3); + CHECK(normal_extra_test_list.Verify()); + } + + void TearDown() override { + // Check if the normal list threaded through next is still untouched. + CHECK(normal_next_list.Verify()); + CHECK_EQ(normal_next_list.LengthForTest(), INIT_NODES); + CHECK_EQ(normal_next_list.AtForTest(0), &nodes[0]); + CHECK_EQ(normal_next_list.AtForTest(4), &nodes[4]); + CHECK(normal_extra_test_list.Verify()); + CHECK_EQ(normal_extra_test_list.LengthForTest(), 3); + CHECK_EQ(normal_extra_test_list.AtForTest(0), &extra_test_node_0); + CHECK_EQ(normal_extra_test_list.AtForTest(2), &extra_test_node_2); + + list.Clear(); + extra_test_list.Clear(); + } + + ThreadedListTestNode nodes[INIT_NODES]; + ThreadedList<ThreadedListTestNode, ThreadedListTestNode::OtherTraits> list; + ThreadedList<ThreadedListTestNode> normal_next_list; + + ThreadedList<ThreadedListTestNode, ThreadedListTestNode::OtherTraits> + extra_test_list; + ThreadedList<ThreadedListTestNode> normal_extra_test_list; + ThreadedListTestNode extra_test_node_0; + ThreadedListTestNode extra_test_node_1; + ThreadedListTestNode extra_test_node_2; +}; + +TEST_F(ThreadedListTest, Add) { + CHECK_EQ(list.LengthForTest(), 5); + ThreadedListTestNode new_node; + // Add to existing list + list.Add(&new_node); + list.Verify(); + CHECK_EQ(list.LengthForTest(), 6); + CHECK_EQ(list.AtForTest(5), &new_node); + + list.Clear(); + CHECK_EQ(list.LengthForTest(), 0); + + new_node = ThreadedListTestNode(); + // Add to empty list + list.Add(&new_node); + list.Verify(); + CHECK_EQ(list.LengthForTest(), 1); + CHECK_EQ(list.AtForTest(0), &new_node); +} + +TEST_F(ThreadedListTest, AddFront) { + CHECK_EQ(list.LengthForTest(), 5); + ThreadedListTestNode new_node; + // AddFront to existing list + list.AddFront(&new_node); + list.Verify(); + CHECK_EQ(list.LengthForTest(), 6); + CHECK_EQ(list.first(), &new_node); + + list.Clear(); + CHECK_EQ(list.LengthForTest(), 0); + + new_node = ThreadedListTestNode(); + // AddFront to empty list + list.AddFront(&new_node); + list.Verify(); + CHECK_EQ(list.LengthForTest(), 1); + CHECK_EQ(list.first(), &new_node); +} + +TEST_F(ThreadedListTest, ReinitializeHead) { + CHECK_EQ(list.LengthForTest(), 5); + CHECK_NE(extra_test_list.first(), list.first()); + list.ReinitializeHead(&extra_test_node_0); + list.Verify(); + CHECK_EQ(extra_test_list.first(), list.first()); + CHECK_EQ(extra_test_list.end(), list.end()); + CHECK_EQ(extra_test_list.LengthForTest(), 3); +} + +TEST_F(ThreadedListTest, DropHead) { + CHECK_EQ(extra_test_list.LengthForTest(), 3); + CHECK_EQ(extra_test_list.first(), &extra_test_node_0); + extra_test_list.DropHead(); + extra_test_list.Verify(); + CHECK_EQ(extra_test_list.first(), &extra_test_node_1); + CHECK_EQ(extra_test_list.LengthForTest(), 2); +} + +TEST_F(ThreadedListTest, Append) { + auto initial_extra_list_end = extra_test_list.end(); + CHECK_EQ(list.LengthForTest(), 5); + list.Append(std::move(extra_test_list)); + list.Verify(); + extra_test_list.Verify(); + CHECK(extra_test_list.is_empty()); + CHECK_EQ(list.LengthForTest(), 8); + CHECK_EQ(list.AtForTest(4), &nodes[4]); + CHECK_EQ(list.AtForTest(5), &extra_test_node_0); + CHECK_EQ(list.end(), initial_extra_list_end); +} + +TEST_F(ThreadedListTest, Prepend) { + CHECK_EQ(list.LengthForTest(), 5); + list.Prepend(std::move(extra_test_list)); + list.Verify(); + extra_test_list.Verify(); + CHECK(extra_test_list.is_empty()); + CHECK_EQ(list.LengthForTest(), 8); + CHECK_EQ(list.first(), &extra_test_node_0); + CHECK_EQ(list.AtForTest(2), &extra_test_node_2); + CHECK_EQ(list.AtForTest(3), &nodes[0]); +} + +TEST_F(ThreadedListTest, Clear) { + CHECK_NE(list.LengthForTest(), 0); + list.Clear(); + CHECK_EQ(list.LengthForTest(), 0); + CHECK_NULL(list.first()); +} + +TEST_F(ThreadedListTest, MoveAssign) { + ThreadedList<ThreadedListTestNode, ThreadedListTestNode::OtherTraits> m_list; + CHECK_EQ(extra_test_list.LengthForTest(), 3); + m_list = std::move(extra_test_list); + + m_list.Verify(); + CHECK_EQ(m_list.first(), &extra_test_node_0); + CHECK_EQ(m_list.LengthForTest(), 3); + + // move assign from empty list + extra_test_list.Clear(); + CHECK_EQ(extra_test_list.LengthForTest(), 0); + m_list = std::move(extra_test_list); + CHECK_EQ(m_list.LengthForTest(), 0); + + m_list.Verify(); + CHECK_NULL(m_list.first()); +} + +TEST_F(ThreadedListTest, MoveCtor) { + CHECK_EQ(extra_test_list.LengthForTest(), 3); + ThreadedList<ThreadedListTestNode, ThreadedListTestNode::OtherTraits> m_list( + std::move(extra_test_list)); + + m_list.Verify(); + CHECK_EQ(m_list.LengthForTest(), 3); + CHECK_EQ(m_list.first(), &extra_test_node_0); + + // move construct from empty list + extra_test_list.Clear(); + CHECK_EQ(extra_test_list.LengthForTest(), 0); + ThreadedList<ThreadedListTestNode, ThreadedListTestNode::OtherTraits> m_list2( + std::move(extra_test_list)); + CHECK_EQ(m_list2.LengthForTest(), 0); + + m_list2.Verify(); + CHECK_NULL(m_list2.first()); +} + +TEST_F(ThreadedListTest, Remove) { + CHECK_EQ(list.LengthForTest(), 5); + + // Remove first + CHECK_EQ(list.first(), &nodes[0]); + list.Remove(&nodes[0]); + list.Verify(); + CHECK_EQ(list.first(), &nodes[1]); + CHECK_EQ(list.LengthForTest(), 4); + + // Remove middle + list.Remove(&nodes[2]); + list.Verify(); + CHECK_EQ(list.LengthForTest(), 3); + CHECK_EQ(list.first(), &nodes[1]); + CHECK_EQ(list.AtForTest(1), &nodes[3]); + + // Remove last + list.Remove(&nodes[4]); + list.Verify(); + CHECK_EQ(list.LengthForTest(), 2); + CHECK_EQ(list.first(), &nodes[1]); + CHECK_EQ(list.AtForTest(1), &nodes[3]); + + // Remove rest + list.Remove(&nodes[1]); + list.Remove(&nodes[3]); + list.Verify(); + CHECK_EQ(list.LengthForTest(), 0); + + // Remove not found + list.Remove(&nodes[4]); + list.Verify(); + CHECK_EQ(list.LengthForTest(), 0); +} + +TEST_F(ThreadedListTest, Rewind) { + CHECK_EQ(extra_test_list.LengthForTest(), 3); + for (auto iter = extra_test_list.begin(); iter != extra_test_list.end(); + ++iter) { + if (*iter == &extra_test_node_2) { + extra_test_list.Rewind(iter); + break; + } + } + CHECK_EQ(extra_test_list.LengthForTest(), 2); + auto iter = extra_test_list.begin(); + CHECK_EQ(*iter, &extra_test_node_0); + std::advance(iter, 1); + CHECK_EQ(*iter, &extra_test_node_1); + + extra_test_list.Rewind(extra_test_list.begin()); + CHECK_EQ(extra_test_list.LengthForTest(), 0); +} + +TEST_F(ThreadedListTest, IterComp) { + ThreadedList<ThreadedListTestNode, ThreadedListTestNode::OtherTraits> c_list = + std::move(extra_test_list); + bool found_first; + for (auto iter = c_list.begin(); iter != c_list.end(); ++iter) { + // This triggers the operator== on the iterator + if (iter == c_list.begin()) { + found_first = true; + } + } + CHECK(found_first); +} + +TEST_F(ThreadedListTest, ConstIterComp) { + const ThreadedList<ThreadedListTestNode, ThreadedListTestNode::OtherTraits> + c_list = std::move(extra_test_list); + bool found_first; + for (auto iter = c_list.begin(); iter != c_list.end(); ++iter) { + // This triggers the operator== on the iterator + if (iter == c_list.begin()) { + found_first = true; + } + } + CHECK(found_first); +} + +} // namespace base +} // namespace v8 diff --git a/deps/v8/test/unittests/cancelable-tasks-unittest.cc b/deps/v8/test/unittests/cancelable-tasks-unittest.cc index d0462877f5..97ac4d4b7d 100644 --- a/deps/v8/test/unittests/cancelable-tasks-unittest.cc +++ b/deps/v8/test/unittests/cancelable-tasks-unittest.cc @@ -71,7 +71,7 @@ class ThreadedRunner final : public base::Thread { explicit ThreadedRunner(TestTask* task) : Thread(Options("runner thread")), task_(task) {} - virtual void Run() { + void Run() override { task_->Run(); delete task_; } diff --git a/deps/v8/test/unittests/code-stub-assembler-unittest.h b/deps/v8/test/unittests/code-stub-assembler-unittest.h index 2c32e0f9b7..c48eb772c0 100644 --- a/deps/v8/test/unittests/code-stub-assembler-unittest.h +++ b/deps/v8/test/unittests/code-stub-assembler-unittest.h @@ -14,8 +14,8 @@ namespace internal { class CodeStubAssemblerTest : public TestWithIsolateAndZone { public: - CodeStubAssemblerTest() {} - ~CodeStubAssemblerTest() override {} + CodeStubAssemblerTest() = default; + ~CodeStubAssemblerTest() override = default; }; class CodeStubAssemblerTestState : public compiler::CodeAssemblerState { 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 45121aedb3..bfc111aed5 100644 --- a/deps/v8/test/unittests/compiler-dispatcher/compiler-dispatcher-unittest.cc +++ b/deps/v8/test/unittests/compiler-dispatcher/compiler-dispatcher-unittest.cc @@ -9,6 +9,8 @@ #include "include/v8-platform.h" #include "src/api-inl.h" #include "src/ast/ast-value-factory.h" +#include "src/ast/ast.h" +#include "src/ast/scopes.h" #include "src/base/platform/semaphore.h" #include "src/base/template-utils.h" #include "src/compiler-dispatcher/compiler-dispatcher-job.h" @@ -25,16 +27,6 @@ #include "test/unittests/test-utils.h" #include "testing/gtest/include/gtest/gtest.h" -// V8 is smart enough to know something was already compiled and return compiled -// code straight away. We need a unique name for each test function so that V8 -// returns an empty SharedFunctionInfo. -#define _STR(x) #x -#define STR(x) _STR(x) -#define _SCRIPT(fn, a, b, c) a fn b fn c -#define SCRIPT(a, b, c) _SCRIPT("f" STR(__LINE__), a, b, c) -#define TEST_SCRIPT() \ - "function f" STR(__LINE__) "(x, y) { return x * y }; f" STR(__LINE__) ";" - namespace v8 { namespace internal { @@ -77,6 +69,37 @@ class CompilerDispatcherTest : public TestWithNativeContext { CompilerDispatcherTestFlags::RestoreFlags(); } + static base::Optional<CompilerDispatcher::JobId> EnqueueUnoptimizedCompileJob( + CompilerDispatcher* dispatcher, Isolate* isolate, + Handle<SharedFunctionInfo> shared) { + std::unique_ptr<ParseInfo> outer_parse_info = + test::OuterParseInfoForShared(isolate, shared); + AstValueFactory* ast_value_factory = + outer_parse_info->GetOrCreateAstValueFactory(); + AstNodeFactory ast_node_factory(ast_value_factory, + outer_parse_info->zone()); + + const AstRawString* function_name = + ast_value_factory->GetOneByteString("f"); + DeclarationScope* script_scope = new (outer_parse_info->zone()) + DeclarationScope(outer_parse_info->zone(), ast_value_factory); + DeclarationScope* function_scope = + new (outer_parse_info->zone()) DeclarationScope( + outer_parse_info->zone(), script_scope, FUNCTION_SCOPE); + function_scope->set_start_position(shared->StartPosition()); + function_scope->set_end_position(shared->EndPosition()); + const FunctionLiteral* function_literal = + ast_node_factory.NewFunctionLiteral( + function_name, function_scope, nullptr, -1, -1, -1, + FunctionLiteral::kNoDuplicateParameters, + FunctionLiteral::kAnonymousExpression, + FunctionLiteral::kShouldEagerCompile, shared->StartPosition(), true, + shared->FunctionLiteralId(isolate), nullptr); + + return dispatcher->Enqueue(outer_parse_info.get(), function_name, + function_literal); + } + private: DISALLOW_COPY_AND_ASSIGN(CompilerDispatcherTest); }; @@ -238,7 +261,7 @@ class MockPlatform : public v8::Platform { TaskWrapper(MockPlatform* platform, std::vector<std::unique_ptr<Task>> tasks, bool signal) : platform_(platform), tasks_(std::move(tasks)), signal_(signal) {} - ~TaskWrapper() = default; + ~TaskWrapper() override = default; void Run() override { for (auto& task : tasks_) { @@ -313,17 +336,27 @@ TEST_F(CompilerDispatcherTest, IsEnqueued) { MockPlatform platform; CompilerDispatcher dispatcher(i_isolate(), &platform, FLAG_stack_size); - const char script[] = TEST_SCRIPT(); - Handle<JSFunction> f = RunJS<JSFunction>(script); + Handle<SharedFunctionInfo> shared = + test::CreateSharedFunctionInfo(i_isolate(), nullptr); + ASSERT_FALSE(shared->is_compiled()); + ASSERT_FALSE(dispatcher.IsEnqueued(shared)); - Handle<SharedFunctionInfo> shared(f->shared(), i_isolate()); + base::Optional<CompilerDispatcher::JobId> job_id = + EnqueueUnoptimizedCompileJob(&dispatcher, i_isolate(), shared); - ASSERT_FALSE(dispatcher.IsEnqueued(shared)); - ASSERT_TRUE(dispatcher.Enqueue(shared)); + ASSERT_TRUE(job_id); + ASSERT_TRUE(dispatcher.IsEnqueued(*job_id)); + ASSERT_FALSE(dispatcher.IsEnqueued(shared)); // SFI not yet registered. + + dispatcher.RegisterSharedFunctionInfo(*job_id, *shared); + ASSERT_TRUE(dispatcher.IsEnqueued(*job_id)); ASSERT_TRUE(dispatcher.IsEnqueued(shared)); + dispatcher.AbortAll(BlockingBehavior::kBlock); + ASSERT_FALSE(dispatcher.IsEnqueued(*job_id)); ASSERT_FALSE(dispatcher.IsEnqueued(shared)); ASSERT_TRUE(platform.IdleTaskPending()); + platform.ClearWorkerTasks(); platform.ClearIdleTask(); } @@ -331,79 +364,71 @@ TEST_F(CompilerDispatcherTest, FinishNow) { MockPlatform platform; CompilerDispatcher dispatcher(i_isolate(), &platform, FLAG_stack_size); - const char script[] = TEST_SCRIPT(); - Handle<JSFunction> f = RunJS<JSFunction>(script); - Handle<SharedFunctionInfo> shared(f->shared(), i_isolate()); - + Handle<SharedFunctionInfo> shared = + test::CreateSharedFunctionInfo(i_isolate(), nullptr); ASSERT_FALSE(shared->is_compiled()); - ASSERT_TRUE(dispatcher.Enqueue(shared)); + + base::Optional<CompilerDispatcher::JobId> job_id = + EnqueueUnoptimizedCompileJob(&dispatcher, i_isolate(), shared); + dispatcher.RegisterSharedFunctionInfo(*job_id, *shared); + ASSERT_TRUE(dispatcher.FinishNow(shared)); // Finishing removes the SFI from the queue. + ASSERT_FALSE(dispatcher.IsEnqueued(*job_id)); ASSERT_FALSE(dispatcher.IsEnqueued(shared)); ASSERT_TRUE(shared->is_compiled()); ASSERT_TRUE(platform.IdleTaskPending()); - platform.ClearIdleTask(); -} - -TEST_F(CompilerDispatcherTest, FinishAllNow) { - MockPlatform platform; - CompilerDispatcher dispatcher(i_isolate(), &platform, FLAG_stack_size); - - constexpr int num_funcs = 2; - Handle<JSFunction> f[num_funcs]; - Handle<SharedFunctionInfo> shared[num_funcs]; - - for (int i = 0; i < num_funcs; ++i) { - std::stringstream ss; - ss << 'f' << STR(__LINE__) << '_' << i; - std::string func_name = ss.str(); - std::string script("function f" + func_name + "(x, y) { return x * y }; f" + - func_name + ";"); - f[i] = RunJS<JSFunction>(script.c_str()); - shared[i] = Handle<SharedFunctionInfo>(f[i]->shared(), i_isolate()); - ASSERT_FALSE(shared[i]->is_compiled()); - ASSERT_TRUE(dispatcher.Enqueue(shared[i])); - } - dispatcher.FinishAllNow(); - for (int i = 0; i < num_funcs; ++i) { - // Finishing removes the SFI from the queue. - ASSERT_FALSE(dispatcher.IsEnqueued(shared[i])); - ASSERT_TRUE(shared[i]->is_compiled()); - } - platform.ClearIdleTask(); platform.ClearWorkerTasks(); + platform.ClearIdleTask(); } TEST_F(CompilerDispatcherTest, IdleTask) { MockPlatform platform; CompilerDispatcher dispatcher(i_isolate(), &platform, FLAG_stack_size); - const char script[] = TEST_SCRIPT(); - Handle<JSFunction> f = RunJS<JSFunction>(script); - Handle<SharedFunctionInfo> shared(f->shared(), i_isolate()); - + Handle<SharedFunctionInfo> shared = + test::CreateSharedFunctionInfo(i_isolate(), nullptr); + ASSERT_FALSE(shared->is_compiled()); ASSERT_FALSE(platform.IdleTaskPending()); - ASSERT_TRUE(dispatcher.Enqueue(shared)); + + base::Optional<CompilerDispatcher::JobId> job_id = + EnqueueUnoptimizedCompileJob(&dispatcher, i_isolate(), shared); ASSERT_TRUE(platform.IdleTaskPending()); // Since time doesn't progress on the MockPlatform, this is enough idle time // to finish compiling the function. platform.RunIdleTask(1000.0, 0.0); + // Since we haven't yet registered the SFI for the job, it should still be + // enqueued and waiting. + ASSERT_TRUE(dispatcher.IsEnqueued(*job_id)); + ASSERT_FALSE(shared->is_compiled()); + ASSERT_FALSE(platform.IdleTaskPending()); + + // Register SFI, which should schedule another idle task to complete the + // compilation. + dispatcher.RegisterSharedFunctionInfo(*job_id, *shared); + ASSERT_TRUE(platform.IdleTaskPending()); + platform.RunIdleTask(1000.0, 0.0); + ASSERT_FALSE(dispatcher.IsEnqueued(shared)); ASSERT_TRUE(shared->is_compiled()); + platform.ClearWorkerTasks(); } TEST_F(CompilerDispatcherTest, IdleTaskSmallIdleTime) { MockPlatform platform; CompilerDispatcher dispatcher(i_isolate(), &platform, FLAG_stack_size); - const char script[] = TEST_SCRIPT(); - Handle<JSFunction> f = RunJS<JSFunction>(script); - Handle<SharedFunctionInfo> shared(f->shared(), i_isolate()); - + Handle<SharedFunctionInfo> shared = + test::CreateSharedFunctionInfo(i_isolate(), nullptr); + ASSERT_FALSE(shared->is_compiled()); ASSERT_FALSE(platform.IdleTaskPending()); - ASSERT_TRUE(dispatcher.Enqueue(shared)); + + base::Optional<CompilerDispatcher::JobId> job_id = + EnqueueUnoptimizedCompileJob(&dispatcher, i_isolate(), shared); + dispatcher.RegisterSharedFunctionInfo(*job_id, *shared); + ASSERT_TRUE(platform.IdleTaskPending()); // The job should be scheduled for the main thread. @@ -419,9 +444,9 @@ TEST_F(CompilerDispatcherTest, IdleTaskSmallIdleTime) { ASSERT_TRUE(platform.IdleTaskPending()); // The job should be still scheduled for the main thread, but ready for - // parsing. + // finalization. ASSERT_EQ(dispatcher.jobs_.size(), 1u); - ASSERT_EQ(UnoptimizedCompileJob::Status::kPrepared, + ASSERT_EQ(UnoptimizedCompileJob::Status::kReadyToFinalize, dispatcher.jobs_.begin()->second->status()); // Now grant a lot of idle time and freeze time. @@ -430,25 +455,28 @@ TEST_F(CompilerDispatcherTest, IdleTaskSmallIdleTime) { ASSERT_FALSE(dispatcher.IsEnqueued(shared)); ASSERT_TRUE(shared->is_compiled()); ASSERT_FALSE(platform.IdleTaskPending()); + platform.ClearWorkerTasks(); } TEST_F(CompilerDispatcherTest, IdleTaskException) { MockPlatform platform; CompilerDispatcher dispatcher(i_isolate(), &platform, 50); - std::string func_name("f" STR(__LINE__)); - std::string script("function " + func_name + "(x) { var a = "); - for (int i = 0; i < 500; i++) { + std::string raw_script("(x) { var a = "); + for (int i = 0; i < 1000; i++) { // Alternate + and - to avoid n-ary operation nodes. - script += "'x' + 'x' - "; + raw_script += "'x' + 'x' - "; } - script += " 'x'; }; " + func_name + ";"; - Handle<JSFunction> f = RunJS<JSFunction>(script.c_str()); - Handle<SharedFunctionInfo> shared(f->shared(), i_isolate()); + raw_script += " 'x'; };"; + test::ScriptResource* script = + new test::ScriptResource(raw_script.c_str(), strlen(raw_script.c_str())); + Handle<SharedFunctionInfo> shared = + test::CreateSharedFunctionInfo(i_isolate(), script); + ASSERT_FALSE(shared->is_compiled()); - ASSERT_FALSE(platform.IdleTaskPending()); - ASSERT_TRUE(dispatcher.Enqueue(shared)); - ASSERT_TRUE(platform.IdleTaskPending()); + base::Optional<CompilerDispatcher::JobId> job_id = + EnqueueUnoptimizedCompileJob(&dispatcher, i_isolate(), shared); + dispatcher.RegisterSharedFunctionInfo(*job_id, *shared); // Since time doesn't progress on the MockPlatform, this is enough idle time // to finish compiling the function. @@ -457,41 +485,33 @@ TEST_F(CompilerDispatcherTest, IdleTaskException) { ASSERT_FALSE(dispatcher.IsEnqueued(shared)); ASSERT_FALSE(shared->is_compiled()); ASSERT_FALSE(i_isolate()->has_pending_exception()); + platform.ClearWorkerTasks(); } TEST_F(CompilerDispatcherTest, CompileOnBackgroundThread) { MockPlatform platform; CompilerDispatcher dispatcher(i_isolate(), &platform, FLAG_stack_size); - const char script[] = TEST_SCRIPT(); - Handle<JSFunction> f = RunJS<JSFunction>(script); - Handle<SharedFunctionInfo> shared(f->shared(), i_isolate()); + Handle<SharedFunctionInfo> shared = + test::CreateSharedFunctionInfo(i_isolate(), nullptr); + ASSERT_FALSE(shared->is_compiled()); - ASSERT_FALSE(platform.IdleTaskPending()); - ASSERT_TRUE(dispatcher.Enqueue(shared)); - ASSERT_TRUE(platform.IdleTaskPending()); + base::Optional<CompilerDispatcher::JobId> job_id = + EnqueueUnoptimizedCompileJob(&dispatcher, i_isolate(), shared); + dispatcher.RegisterSharedFunctionInfo(*job_id, *shared); + ASSERT_TRUE(dispatcher.IsEnqueued(shared)); + ASSERT_FALSE(shared->is_compiled()); ASSERT_EQ(dispatcher.jobs_.size(), 1u); ASSERT_EQ(UnoptimizedCompileJob::Status::kInitial, dispatcher.jobs_.begin()->second->status()); - - // Make compiling super expensive, and advance job as much as possible on the - // foreground thread. - dispatcher.tracer_->RecordCompile(50000.0, 1); - platform.RunIdleTask(10.0, 0.0); - ASSERT_EQ(UnoptimizedCompileJob::Status::kPrepared, - dispatcher.jobs_.begin()->second->status()); - - ASSERT_TRUE(dispatcher.IsEnqueued(shared)); - ASSERT_FALSE(shared->is_compiled()); - ASSERT_FALSE(platform.IdleTaskPending()); ASSERT_TRUE(platform.WorkerTasksPending()); platform.RunWorkerTasksAndBlock(V8::GetCurrentPlatform()); ASSERT_TRUE(platform.IdleTaskPending()); ASSERT_FALSE(platform.WorkerTasksPending()); - ASSERT_EQ(UnoptimizedCompileJob::Status::kCompiled, + ASSERT_EQ(UnoptimizedCompileJob::Status::kReadyToFinalize, dispatcher.jobs_.begin()->second->status()); // Now grant a lot of idle time and freeze time. @@ -500,34 +520,30 @@ TEST_F(CompilerDispatcherTest, CompileOnBackgroundThread) { ASSERT_FALSE(dispatcher.IsEnqueued(shared)); ASSERT_TRUE(shared->is_compiled()); ASSERT_FALSE(platform.IdleTaskPending()); + ASSERT_FALSE(platform.WorkerTasksPending()); } TEST_F(CompilerDispatcherTest, FinishNowWithWorkerTask) { MockPlatform platform; CompilerDispatcher dispatcher(i_isolate(), &platform, FLAG_stack_size); - const char script[] = TEST_SCRIPT(); - Handle<JSFunction> f = RunJS<JSFunction>(script); - Handle<SharedFunctionInfo> shared(f->shared(), i_isolate()); + Handle<SharedFunctionInfo> shared = + test::CreateSharedFunctionInfo(i_isolate(), nullptr); + ASSERT_FALSE(shared->is_compiled()); - ASSERT_FALSE(platform.IdleTaskPending()); - ASSERT_TRUE(dispatcher.Enqueue(shared)); - ASSERT_TRUE(platform.IdleTaskPending()); + base::Optional<CompilerDispatcher::JobId> job_id = + EnqueueUnoptimizedCompileJob(&dispatcher, i_isolate(), shared); + dispatcher.RegisterSharedFunctionInfo(*job_id, *shared); ASSERT_EQ(dispatcher.jobs_.size(), 1u); ASSERT_EQ(UnoptimizedCompileJob::Status::kInitial, dispatcher.jobs_.begin()->second->status()); - // Make compiling super expensive, and advance job as much as possible on the - // foreground thread. - dispatcher.tracer_->RecordCompile(50000.0, 1); - platform.RunIdleTask(10.0, 0.0); - ASSERT_EQ(UnoptimizedCompileJob::Status::kPrepared, - dispatcher.jobs_.begin()->second->status()); - ASSERT_TRUE(dispatcher.IsEnqueued(shared)); ASSERT_FALSE(shared->is_compiled()); - ASSERT_FALSE(platform.IdleTaskPending()); + ASSERT_EQ(dispatcher.jobs_.size(), 1u); + ASSERT_EQ(UnoptimizedCompileJob::Status::kInitial, + dispatcher.jobs_.begin()->second->status()); ASSERT_TRUE(platform.WorkerTasksPending()); // This does not block, but races with the FinishNow() call below. @@ -545,46 +561,54 @@ TEST_F(CompilerDispatcherTest, IdleTaskMultipleJobs) { MockPlatform platform; CompilerDispatcher dispatcher(i_isolate(), &platform, FLAG_stack_size); - const char script1[] = TEST_SCRIPT(); - Handle<JSFunction> f1 = RunJS<JSFunction>(script1); - Handle<SharedFunctionInfo> shared1(f1->shared(), i_isolate()); + Handle<SharedFunctionInfo> shared_1 = + test::CreateSharedFunctionInfo(i_isolate(), nullptr); + ASSERT_FALSE(shared_1->is_compiled()); + Handle<SharedFunctionInfo> shared_2 = + test::CreateSharedFunctionInfo(i_isolate(), nullptr); + ASSERT_FALSE(shared_2->is_compiled()); - const char script2[] = TEST_SCRIPT(); - Handle<JSFunction> f2 = RunJS<JSFunction>(script2); - Handle<SharedFunctionInfo> shared2(f2->shared(), i_isolate()); + base::Optional<CompilerDispatcher::JobId> job_id_1 = + EnqueueUnoptimizedCompileJob(&dispatcher, i_isolate(), shared_1); + base::Optional<CompilerDispatcher::JobId> job_id_2 = + EnqueueUnoptimizedCompileJob(&dispatcher, i_isolate(), shared_2); - ASSERT_FALSE(platform.IdleTaskPending()); - ASSERT_TRUE(dispatcher.Enqueue(shared1)); - ASSERT_TRUE(dispatcher.Enqueue(shared2)); - ASSERT_TRUE(platform.IdleTaskPending()); + dispatcher.RegisterSharedFunctionInfo(*job_id_1, *shared_1); + dispatcher.RegisterSharedFunctionInfo(*job_id_2, *shared_2); + + ASSERT_TRUE(dispatcher.IsEnqueued(shared_1)); + ASSERT_TRUE(dispatcher.IsEnqueued(shared_2)); // Since time doesn't progress on the MockPlatform, this is enough idle time // to finish compiling the function. platform.RunIdleTask(1000.0, 0.0); - ASSERT_FALSE(dispatcher.IsEnqueued(shared1)); - ASSERT_FALSE(dispatcher.IsEnqueued(shared2)); - ASSERT_TRUE(shared1->is_compiled()); - ASSERT_TRUE(shared2->is_compiled()); + ASSERT_FALSE(dispatcher.IsEnqueued(shared_1)); + ASSERT_FALSE(dispatcher.IsEnqueued(shared_2)); + ASSERT_TRUE(shared_1->is_compiled()); + ASSERT_TRUE(shared_2->is_compiled()); + platform.ClearWorkerTasks(); } TEST_F(CompilerDispatcherTest, FinishNowException) { MockPlatform platform; CompilerDispatcher dispatcher(i_isolate(), &platform, 50); - std::string func_name("f" STR(__LINE__)); - std::string script("function " + func_name + "(x) { var a = "); - for (int i = 0; i < 500; i++) { + std::string raw_script("(x) { var a = "); + for (int i = 0; i < 1000; i++) { // Alternate + and - to avoid n-ary operation nodes. - script += "'x' + 'x' - "; + raw_script += "'x' + 'x' - "; } - script += " 'x'; }; " + func_name + ";"; - Handle<JSFunction> f = RunJS<JSFunction>(script.c_str()); - Handle<SharedFunctionInfo> shared(f->shared(), i_isolate()); + raw_script += " 'x'; };"; + test::ScriptResource* script = + new test::ScriptResource(raw_script.c_str(), strlen(raw_script.c_str())); + Handle<SharedFunctionInfo> shared = + test::CreateSharedFunctionInfo(i_isolate(), script); + ASSERT_FALSE(shared->is_compiled()); - ASSERT_FALSE(platform.IdleTaskPending()); - ASSERT_TRUE(dispatcher.Enqueue(shared)); - ASSERT_TRUE(platform.IdleTaskPending()); + base::Optional<CompilerDispatcher::JobId> job_id = + EnqueueUnoptimizedCompileJob(&dispatcher, i_isolate(), shared); + dispatcher.RegisterSharedFunctionInfo(*job_id, *shared); ASSERT_FALSE(dispatcher.FinishNow(shared)); @@ -594,34 +618,26 @@ TEST_F(CompilerDispatcherTest, FinishNowException) { i_isolate()->clear_pending_exception(); platform.ClearIdleTask(); + platform.ClearWorkerTasks(); } TEST_F(CompilerDispatcherTest, AsyncAbortAllPendingWorkerTask) { MockPlatform platform; CompilerDispatcher dispatcher(i_isolate(), &platform, FLAG_stack_size); - const char script[] = TEST_SCRIPT(); - Handle<JSFunction> f = RunJS<JSFunction>(script); - Handle<SharedFunctionInfo> shared(f->shared(), i_isolate()); + Handle<SharedFunctionInfo> shared = + test::CreateSharedFunctionInfo(i_isolate(), nullptr); + ASSERT_FALSE(shared->is_compiled()); - ASSERT_FALSE(platform.IdleTaskPending()); - ASSERT_TRUE(dispatcher.Enqueue(shared)); - ASSERT_TRUE(platform.IdleTaskPending()); + base::Optional<CompilerDispatcher::JobId> job_id = + EnqueueUnoptimizedCompileJob(&dispatcher, i_isolate(), shared); + dispatcher.RegisterSharedFunctionInfo(*job_id, *shared); ASSERT_EQ(dispatcher.jobs_.size(), 1u); ASSERT_EQ(UnoptimizedCompileJob::Status::kInitial, dispatcher.jobs_.begin()->second->status()); - - // Make compiling super expensive, and advance job as much as possible on the - // foreground thread. - dispatcher.tracer_->RecordCompile(50000.0, 1); - platform.RunIdleTask(10.0, 0.0); - ASSERT_EQ(UnoptimizedCompileJob::Status::kPrepared, - dispatcher.jobs_.begin()->second->status()); - ASSERT_TRUE(dispatcher.IsEnqueued(shared)); ASSERT_FALSE(shared->is_compiled()); - ASSERT_FALSE(platform.IdleTaskPending()); ASSERT_TRUE(platform.WorkerTasksPending()); // The background task hasn't yet started, so we can just cancel it. @@ -642,32 +658,23 @@ TEST_F(CompilerDispatcherTest, AsyncAbortAllRunningWorkerTask) { MockPlatform platform; CompilerDispatcher dispatcher(i_isolate(), &platform, FLAG_stack_size); - const char script1[] = TEST_SCRIPT(); - Handle<JSFunction> f1 = RunJS<JSFunction>(script1); - Handle<SharedFunctionInfo> shared1(f1->shared(), i_isolate()); + Handle<SharedFunctionInfo> shared_1 = + test::CreateSharedFunctionInfo(i_isolate(), nullptr); + ASSERT_FALSE(shared_1->is_compiled()); + Handle<SharedFunctionInfo> shared_2 = + test::CreateSharedFunctionInfo(i_isolate(), nullptr); + ASSERT_FALSE(shared_2->is_compiled()); - const char script2[] = TEST_SCRIPT(); - Handle<JSFunction> f2 = RunJS<JSFunction>(script2); - Handle<SharedFunctionInfo> shared2(f2->shared(), i_isolate()); - - ASSERT_FALSE(platform.IdleTaskPending()); - ASSERT_TRUE(dispatcher.Enqueue(shared1)); - ASSERT_TRUE(platform.IdleTaskPending()); + base::Optional<CompilerDispatcher::JobId> job_id_1 = + EnqueueUnoptimizedCompileJob(&dispatcher, i_isolate(), shared_1); + dispatcher.RegisterSharedFunctionInfo(*job_id_1, *shared_1); ASSERT_EQ(dispatcher.jobs_.size(), 1u); ASSERT_EQ(UnoptimizedCompileJob::Status::kInitial, dispatcher.jobs_.begin()->second->status()); - - // Make compiling super expensive, and advance job as much as possible on the - // foreground thread. - dispatcher.tracer_->RecordCompile(50000.0, 1); - platform.RunIdleTask(10.0, 0.0); - ASSERT_EQ(UnoptimizedCompileJob::Status::kPrepared, - dispatcher.jobs_.begin()->second->status()); - - ASSERT_TRUE(dispatcher.IsEnqueued(shared1)); - ASSERT_FALSE(shared1->is_compiled()); - ASSERT_FALSE(platform.IdleTaskPending()); + ASSERT_TRUE(dispatcher.IsEnqueued(shared_1)); + ASSERT_FALSE(shared_1->is_compiled()); + ASSERT_TRUE(platform.IdleTaskPending()); ASSERT_TRUE(platform.WorkerTasksPending()); // Kick off background tasks and freeze them. @@ -681,7 +688,9 @@ TEST_F(CompilerDispatcherTest, AsyncAbortAllRunningWorkerTask) { ASSERT_TRUE(platform.ForegroundTasksPending()); // We can't schedule new tasks while we're aborting. - ASSERT_FALSE(dispatcher.Enqueue(shared2)); + base::Optional<CompilerDispatcher::JobId> job_id_2 = + EnqueueUnoptimizedCompileJob(&dispatcher, i_isolate(), shared_2); + ASSERT_FALSE(job_id_2); // Run the first AbortTask. Since the background job is still pending, it // can't do anything. @@ -711,10 +720,14 @@ TEST_F(CompilerDispatcherTest, AsyncAbortAllRunningWorkerTask) { ASSERT_FALSE(platform.ForegroundTasksPending()); // Now it's possible to enqueue new functions again. - ASSERT_TRUE(dispatcher.Enqueue(shared2)); + job_id_2 = EnqueueUnoptimizedCompileJob(&dispatcher, i_isolate(), shared_2); + ASSERT_TRUE(job_id_2); ASSERT_TRUE(platform.IdleTaskPending()); - ASSERT_FALSE(platform.WorkerTasksPending()); + ASSERT_TRUE(platform.WorkerTasksPending()); ASSERT_FALSE(platform.ForegroundTasksPending()); + + dispatcher.AbortAll(BlockingBehavior::kBlock); + platform.ClearWorkerTasks(); platform.ClearIdleTask(); } @@ -722,28 +735,20 @@ TEST_F(CompilerDispatcherTest, FinishNowDuringAbortAll) { MockPlatform platform; CompilerDispatcher dispatcher(i_isolate(), &platform, FLAG_stack_size); - const char script[] = TEST_SCRIPT(); - Handle<JSFunction> f = RunJS<JSFunction>(script); - Handle<SharedFunctionInfo> shared(f->shared(), i_isolate()); + Handle<SharedFunctionInfo> shared = + test::CreateSharedFunctionInfo(i_isolate(), nullptr); + ASSERT_FALSE(shared->is_compiled()); - ASSERT_FALSE(platform.IdleTaskPending()); - ASSERT_TRUE(dispatcher.Enqueue(shared)); - ASSERT_TRUE(platform.IdleTaskPending()); + base::Optional<CompilerDispatcher::JobId> job_id = + EnqueueUnoptimizedCompileJob(&dispatcher, i_isolate(), shared); + dispatcher.RegisterSharedFunctionInfo(*job_id, *shared); + ASSERT_TRUE(dispatcher.IsEnqueued(shared)); + ASSERT_FALSE(shared->is_compiled()); ASSERT_EQ(dispatcher.jobs_.size(), 1u); ASSERT_EQ(UnoptimizedCompileJob::Status::kInitial, dispatcher.jobs_.begin()->second->status()); - - // Make compiling super expensive, and advance job as much as possible on the - // foreground thread. - dispatcher.tracer_->RecordCompile(50000.0, 1); - platform.RunIdleTask(10.0, 0.0); - ASSERT_EQ(UnoptimizedCompileJob::Status::kPrepared, - dispatcher.jobs_.begin()->second->status()); - - ASSERT_TRUE(dispatcher.IsEnqueued(shared)); - ASSERT_FALSE(shared->is_compiled()); - ASSERT_FALSE(platform.IdleTaskPending()); + ASSERT_TRUE(platform.IdleTaskPending()); ASSERT_TRUE(platform.WorkerTasksPending()); // Kick off background tasks and freeze them. @@ -764,7 +769,12 @@ TEST_F(CompilerDispatcherTest, FinishNowDuringAbortAll) { ASSERT_TRUE(dispatcher.abort_); } - // While the background thread holds on to a job, it is still enqueud. + // Run the idle task, which should have already been canceled and won't do + // anything. + ASSERT_TRUE(platform.IdleTaskPending()); + platform.RunIdleTask(5.0, 1.0); + + // While the background thread holds on to a job, it is still enqueued. ASSERT_TRUE(dispatcher.IsEnqueued(shared)); // Release background task. @@ -783,7 +793,7 @@ TEST_F(CompilerDispatcherTest, FinishNowDuringAbortAll) { } ASSERT_TRUE(platform.ForegroundTasksPending()); - ASSERT_TRUE(platform.IdleTaskPending()); + ASSERT_FALSE(platform.IdleTaskPending()); ASSERT_FALSE(platform.WorkerTasksPending()); platform.RunForegroundTasks(); @@ -791,32 +801,34 @@ TEST_F(CompilerDispatcherTest, FinishNowDuringAbortAll) { base::LockGuard<base::Mutex> lock(&dispatcher.mutex_); ASSERT_FALSE(dispatcher.abort_); } - - platform.ClearForegroundTasks(); - platform.ClearIdleTask(); } TEST_F(CompilerDispatcherTest, MemoryPressure) { MockPlatform platform; CompilerDispatcher dispatcher(i_isolate(), &platform, FLAG_stack_size); - const char script[] = TEST_SCRIPT(); - Handle<JSFunction> f = RunJS<JSFunction>(script); - Handle<SharedFunctionInfo> shared(f->shared(), i_isolate()); + Handle<SharedFunctionInfo> shared = + test::CreateSharedFunctionInfo(i_isolate(), nullptr); + ASSERT_FALSE(shared->is_compiled()); // Can't enqueue tasks under memory pressure. dispatcher.MemoryPressureNotification(v8::MemoryPressureLevel::kCritical, true); - ASSERT_FALSE(dispatcher.Enqueue(shared)); + base::Optional<CompilerDispatcher::JobId> job_id = + EnqueueUnoptimizedCompileJob(&dispatcher, i_isolate(), shared); + ASSERT_FALSE(job_id); dispatcher.MemoryPressureNotification(v8::MemoryPressureLevel::kNone, true); - ASSERT_TRUE(dispatcher.Enqueue(shared)); + + job_id = EnqueueUnoptimizedCompileJob(&dispatcher, i_isolate(), shared); + ASSERT_TRUE(job_id); // Memory pressure cancels current jobs. dispatcher.MemoryPressureNotification(v8::MemoryPressureLevel::kCritical, true); - ASSERT_FALSE(dispatcher.IsEnqueued(shared)); + ASSERT_FALSE(dispatcher.IsEnqueued(*job_id)); platform.ClearIdleTask(); + platform.ClearWorkerTasks(); } namespace { @@ -826,7 +838,7 @@ class PressureNotificationTask : public CancelableTask { PressureNotificationTask(Isolate* isolate, CompilerDispatcher* dispatcher, base::Semaphore* sem) : CancelableTask(isolate), dispatcher_(dispatcher), sem_(sem) {} - ~PressureNotificationTask() override {} + ~PressureNotificationTask() override = default; void RunInternal() override { dispatcher_->MemoryPressureNotification(v8::MemoryPressureLevel::kCritical, @@ -847,11 +859,14 @@ TEST_F(CompilerDispatcherTest, MemoryPressureFromBackground) { MockPlatform platform; CompilerDispatcher dispatcher(i_isolate(), &platform, FLAG_stack_size); - const char script[] = TEST_SCRIPT(); - Handle<JSFunction> f = RunJS<JSFunction>(script); - Handle<SharedFunctionInfo> shared(f->shared(), i_isolate()); + Handle<SharedFunctionInfo> shared = + test::CreateSharedFunctionInfo(i_isolate(), nullptr); + ASSERT_FALSE(shared->is_compiled()); + + base::Optional<CompilerDispatcher::JobId> job_id = + EnqueueUnoptimizedCompileJob(&dispatcher, i_isolate(), shared); + dispatcher.RegisterSharedFunctionInfo(*job_id, *shared); - ASSERT_TRUE(dispatcher.Enqueue(shared)); base::Semaphore sem(0); V8::GetCurrentPlatform()->CallOnWorkerThread( base::make_unique<PressureNotificationTask>(i_isolate(), &dispatcher, @@ -873,44 +888,6 @@ TEST_F(CompilerDispatcherTest, MemoryPressureFromBackground) { ASSERT_FALSE(platform.ForegroundTasksPending()); platform.ClearIdleTask(); -} - -TEST_F(CompilerDispatcherTest, EnqueueJob) { - MockPlatform platform; - CompilerDispatcher dispatcher(i_isolate(), &platform, FLAG_stack_size); - const char script[] = TEST_SCRIPT(); - Handle<JSFunction> f = RunJS<JSFunction>(script); - Handle<SharedFunctionInfo> shared(f->shared(), i_isolate()); - std::unique_ptr<CompilerDispatcherJob> job( - new UnoptimizedCompileJob(i_isolate(), dispatcher.tracer_.get(), shared, - dispatcher.max_stack_size_)); - ASSERT_FALSE(dispatcher.IsEnqueued(shared)); - dispatcher.Enqueue(std::move(job)); - ASSERT_TRUE(dispatcher.IsEnqueued(shared)); - - ASSERT_TRUE(platform.IdleTaskPending()); - platform.ClearIdleTask(); - ASSERT_FALSE(platform.WorkerTasksPending()); -} - -TEST_F(CompilerDispatcherTest, EnqueueAndStep) { - MockPlatform platform; - CompilerDispatcher dispatcher(i_isolate(), &platform, FLAG_stack_size); - - const char script[] = TEST_SCRIPT(); - Handle<JSFunction> f = RunJS<JSFunction>(script); - Handle<SharedFunctionInfo> shared(f->shared(), i_isolate()); - - ASSERT_FALSE(dispatcher.IsEnqueued(shared)); - ASSERT_TRUE(dispatcher.EnqueueAndStep(shared)); - ASSERT_TRUE(dispatcher.IsEnqueued(shared)); - - ASSERT_EQ(UnoptimizedCompileJob::Status::kPrepared, - dispatcher.jobs_.begin()->second->status()); - - ASSERT_TRUE(platform.IdleTaskPending()); - platform.ClearIdleTask(); - ASSERT_TRUE(platform.WorkerTasksPending()); platform.ClearWorkerTasks(); } @@ -919,14 +896,16 @@ TEST_F(CompilerDispatcherTest, CompileLazyFinishesDispatcherJob) { // enqueued functions. CompilerDispatcher* dispatcher = i_isolate()->compiler_dispatcher(); - const char script[] = "function lazy() { return 42; }; lazy;"; + const char raw_script[] = "function lazy() { return 42; }; lazy;"; + test::ScriptResource* script = + new test::ScriptResource(raw_script, strlen(raw_script)); Handle<JSFunction> f = RunJS<JSFunction>(script); Handle<SharedFunctionInfo> shared(f->shared(), i_isolate()); - ASSERT_FALSE(shared->is_compiled()); - ASSERT_FALSE(dispatcher->IsEnqueued(shared)); - ASSERT_TRUE(dispatcher->Enqueue(shared)); - ASSERT_TRUE(dispatcher->IsEnqueued(shared)); + + base::Optional<CompilerDispatcher::JobId> job_id = + EnqueueUnoptimizedCompileJob(dispatcher, i_isolate(), shared); + dispatcher->RegisterSharedFunctionInfo(*job_id, *shared); // Now force the function to run and ensure CompileLazy finished and dequeues // it from the dispatcher. @@ -940,66 +919,57 @@ TEST_F(CompilerDispatcherTest, CompileLazy2FinishesDispatcherJob) { // enqueued functions. CompilerDispatcher* dispatcher = i_isolate()->compiler_dispatcher(); - const char source2[] = "function lazy2() { return 42; }; lazy2;"; - Handle<JSFunction> lazy2 = RunJS<JSFunction>(source2); - Handle<SharedFunctionInfo> shared2(lazy2->shared(), i_isolate()); - ASSERT_FALSE(shared2->is_compiled()); + const char raw_source_2[] = "function lazy2() { return 42; }; lazy2;"; + test::ScriptResource* source_2 = + new test::ScriptResource(raw_source_2, strlen(raw_source_2)); + Handle<JSFunction> lazy2 = RunJS<JSFunction>(source_2); + Handle<SharedFunctionInfo> shared_2(lazy2->shared(), i_isolate()); + ASSERT_FALSE(shared_2->is_compiled()); - const char source1[] = "function lazy1() { return lazy2(); }; lazy1;"; - Handle<JSFunction> lazy1 = RunJS<JSFunction>(source1); - Handle<SharedFunctionInfo> shared1(lazy1->shared(), i_isolate()); - ASSERT_FALSE(shared1->is_compiled()); + const char raw_source_1[] = "function lazy1() { return lazy2(); }; lazy1;"; + test::ScriptResource* source_1 = + new test::ScriptResource(raw_source_1, strlen(raw_source_1)); + Handle<JSFunction> lazy1 = RunJS<JSFunction>(source_1); + Handle<SharedFunctionInfo> shared_1(lazy1->shared(), i_isolate()); + ASSERT_FALSE(shared_1->is_compiled()); - ASSERT_TRUE(dispatcher->Enqueue(shared1)); - ASSERT_TRUE(dispatcher->Enqueue(shared2)); + base::Optional<CompilerDispatcher::JobId> job_id_1 = + EnqueueUnoptimizedCompileJob(dispatcher, i_isolate(), shared_1); + dispatcher->RegisterSharedFunctionInfo(*job_id_1, *shared_1); - RunJS("lazy1();"); - ASSERT_TRUE(shared1->is_compiled()); - ASSERT_TRUE(shared2->is_compiled()); - ASSERT_FALSE(dispatcher->IsEnqueued(shared1)); - ASSERT_FALSE(dispatcher->IsEnqueued(shared2)); -} + base::Optional<CompilerDispatcher::JobId> job_id_2 = + EnqueueUnoptimizedCompileJob(dispatcher, i_isolate(), shared_2); + dispatcher->RegisterSharedFunctionInfo(*job_id_2, *shared_2); -TEST_F(CompilerDispatcherTest, EnqueueAndStepTwice) { - MockPlatform platform; - CompilerDispatcher dispatcher(i_isolate(), &platform, FLAG_stack_size); + ASSERT_TRUE(dispatcher->IsEnqueued(shared_1)); + ASSERT_TRUE(dispatcher->IsEnqueued(shared_2)); - const char script[] = TEST_SCRIPT(); - Handle<JSFunction> f = RunJS<JSFunction>(script); - Handle<SharedFunctionInfo> shared(f->shared(), i_isolate()); - - ASSERT_FALSE(dispatcher.IsEnqueued(shared)); - ASSERT_TRUE(dispatcher.EnqueueAndStep(shared)); - ASSERT_TRUE(dispatcher.IsEnqueued(shared)); - ASSERT_EQ(UnoptimizedCompileJob::Status::kPrepared, - dispatcher.jobs_.begin()->second->status()); - - // EnqueueAndStep of the same function again (shouldn't step the job. - ASSERT_TRUE(dispatcher.EnqueueAndStep(shared)); - ASSERT_EQ(UnoptimizedCompileJob::Status::kPrepared, - dispatcher.jobs_.begin()->second->status()); - - ASSERT_TRUE(platform.IdleTaskPending()); - ASSERT_TRUE(platform.WorkerTasksPending()); - platform.ClearIdleTask(); - platform.ClearWorkerTasks(); + RunJS("lazy1();"); + ASSERT_TRUE(shared_1->is_compiled()); + ASSERT_TRUE(shared_2->is_compiled()); + ASSERT_FALSE(dispatcher->IsEnqueued(shared_1)); + ASSERT_FALSE(dispatcher->IsEnqueued(shared_2)); } TEST_F(CompilerDispatcherTest, CompileMultipleOnBackgroundThread) { MockPlatform platform; CompilerDispatcher dispatcher(i_isolate(), &platform, FLAG_stack_size); - const char script1[] = TEST_SCRIPT(); - Handle<JSFunction> f1 = RunJS<JSFunction>(script1); - Handle<SharedFunctionInfo> shared1(f1->shared(), i_isolate()); - const char script2[] = TEST_SCRIPT(); - Handle<JSFunction> f2 = RunJS<JSFunction>(script2); - Handle<SharedFunctionInfo> shared2(f2->shared(), i_isolate()); + Handle<SharedFunctionInfo> shared_1 = + test::CreateSharedFunctionInfo(i_isolate(), nullptr); + ASSERT_FALSE(shared_1->is_compiled()); - ASSERT_FALSE(platform.IdleTaskPending()); - ASSERT_TRUE(dispatcher.Enqueue(shared1)); - ASSERT_TRUE(dispatcher.Enqueue(shared2)); - ASSERT_TRUE(platform.IdleTaskPending()); + Handle<SharedFunctionInfo> shared_2 = + test::CreateSharedFunctionInfo(i_isolate(), nullptr); + ASSERT_FALSE(shared_2->is_compiled()); + + base::Optional<CompilerDispatcher::JobId> job_id_1 = + EnqueueUnoptimizedCompileJob(&dispatcher, i_isolate(), shared_1); + dispatcher.RegisterSharedFunctionInfo(*job_id_1, *shared_1); + + base::Optional<CompilerDispatcher::JobId> job_id_2 = + EnqueueUnoptimizedCompileJob(&dispatcher, i_isolate(), shared_2); + dispatcher.RegisterSharedFunctionInfo(*job_id_2, *shared_2); ASSERT_EQ(dispatcher.jobs_.size(), 2u); ASSERT_EQ(UnoptimizedCompileJob::Status::kInitial, @@ -1007,21 +977,11 @@ TEST_F(CompilerDispatcherTest, CompileMultipleOnBackgroundThread) { ASSERT_EQ(UnoptimizedCompileJob::Status::kInitial, (++dispatcher.jobs_.begin())->second->status()); - // Make compiling super expensive, and advance job as much as possible on the - // foreground thread. - dispatcher.tracer_->RecordCompile(50000.0, 1); - platform.RunIdleTask(10.0, 0.0); - ASSERT_EQ(dispatcher.jobs_.size(), 2u); - ASSERT_EQ(UnoptimizedCompileJob::Status::kPrepared, - dispatcher.jobs_.begin()->second->status()); - ASSERT_EQ(UnoptimizedCompileJob::Status::kPrepared, - (++dispatcher.jobs_.begin())->second->status()); - - ASSERT_TRUE(dispatcher.IsEnqueued(shared1)); - ASSERT_TRUE(dispatcher.IsEnqueued(shared2)); - ASSERT_FALSE(shared1->is_compiled()); - ASSERT_FALSE(shared2->is_compiled()); - ASSERT_FALSE(platform.IdleTaskPending()); + ASSERT_TRUE(dispatcher.IsEnqueued(shared_1)); + ASSERT_TRUE(dispatcher.IsEnqueued(shared_2)); + ASSERT_FALSE(shared_1->is_compiled()); + ASSERT_FALSE(shared_2->is_compiled()); + ASSERT_TRUE(platform.IdleTaskPending()); ASSERT_TRUE(platform.WorkerTasksPending()); platform.RunWorkerTasksAndBlock(V8::GetCurrentPlatform()); @@ -1029,26 +989,20 @@ TEST_F(CompilerDispatcherTest, CompileMultipleOnBackgroundThread) { ASSERT_TRUE(platform.IdleTaskPending()); ASSERT_FALSE(platform.WorkerTasksPending()); ASSERT_EQ(dispatcher.jobs_.size(), 2u); - ASSERT_EQ(UnoptimizedCompileJob::Status::kCompiled, + ASSERT_EQ(UnoptimizedCompileJob::Status::kReadyToFinalize, dispatcher.jobs_.begin()->second->status()); - ASSERT_EQ(UnoptimizedCompileJob::Status::kCompiled, + ASSERT_EQ(UnoptimizedCompileJob::Status::kReadyToFinalize, (++dispatcher.jobs_.begin())->second->status()); // Now grant a lot of idle time and freeze time. platform.RunIdleTask(1000.0, 0.0); - ASSERT_FALSE(dispatcher.IsEnqueued(shared1)); - ASSERT_FALSE(dispatcher.IsEnqueued(shared2)); - ASSERT_TRUE(shared1->is_compiled()); - ASSERT_TRUE(shared2->is_compiled()); + ASSERT_FALSE(dispatcher.IsEnqueued(shared_1)); + ASSERT_FALSE(dispatcher.IsEnqueued(shared_2)); + ASSERT_TRUE(shared_1->is_compiled()); + ASSERT_TRUE(shared_2->is_compiled()); ASSERT_FALSE(platform.IdleTaskPending()); } -#undef _STR -#undef STR -#undef _SCRIPT -#undef SCRIPT -#undef TEST_SCRIPT - } // namespace internal } // namespace v8 diff --git a/deps/v8/test/unittests/compiler-dispatcher/unoptimized-compile-job-unittest.cc b/deps/v8/test/unittests/compiler-dispatcher/unoptimized-compile-job-unittest.cc index 5a0e89326b..e3d4ae078b 100644 --- a/deps/v8/test/unittests/compiler-dispatcher/unoptimized-compile-job-unittest.cc +++ b/deps/v8/test/unittests/compiler-dispatcher/unoptimized-compile-job-unittest.cc @@ -16,6 +16,7 @@ #include "src/flags.h" #include "src/isolate-inl.h" #include "src/parsing/parse-info.h" +#include "src/parsing/preparsed-scope-data.h" #include "src/v8.h" #include "test/unittests/test-helpers.h" #include "test/unittests/test-utils.h" @@ -26,9 +27,11 @@ namespace internal { class UnoptimizedCompileJobTest : public TestWithNativeContext { public: - UnoptimizedCompileJobTest() : tracer_(isolate()) {} - ~UnoptimizedCompileJobTest() override {} + UnoptimizedCompileJobTest() + : tracer_(isolate()), allocator_(isolate()->allocator()) {} + ~UnoptimizedCompileJobTest() override = default; + AccountingAllocator* allocator() { return allocator_; } CompilerDispatcherTracer* tracer() { return &tracer_; } static void SetUpTestCase() { @@ -44,15 +47,43 @@ class UnoptimizedCompileJobTest : public TestWithNativeContext { save_flags_ = nullptr; } - static Variable* LookupVariableByName(UnoptimizedCompileJob* job, - const char* name) { - const AstRawString* name_raw_string = - job->parse_info_->ast_value_factory()->GetOneByteString(name); - return job->parse_info_->literal()->scope()->Lookup(name_raw_string); + UnoptimizedCompileJob* NewUnoptimizedCompileJob( + Isolate* isolate, Handle<SharedFunctionInfo> shared, + size_t stack_size = FLAG_stack_size) { + std::unique_ptr<ParseInfo> outer_parse_info = + test::OuterParseInfoForShared(isolate, shared); + AstValueFactory* ast_value_factory = + outer_parse_info->GetOrCreateAstValueFactory(); + AstNodeFactory ast_node_factory(ast_value_factory, + outer_parse_info->zone()); + + const AstRawString* function_name = + ast_value_factory->GetOneByteString("f"); + DeclarationScope* script_scope = new (outer_parse_info->zone()) + DeclarationScope(outer_parse_info->zone(), ast_value_factory); + DeclarationScope* function_scope = + new (outer_parse_info->zone()) DeclarationScope( + outer_parse_info->zone(), script_scope, FUNCTION_SCOPE); + function_scope->set_start_position(shared->StartPosition()); + function_scope->set_end_position(shared->EndPosition()); + const FunctionLiteral* function_literal = + ast_node_factory.NewFunctionLiteral( + function_name, function_scope, nullptr, -1, -1, -1, + FunctionLiteral::kNoDuplicateParameters, + FunctionLiteral::kAnonymousExpression, + FunctionLiteral::kShouldEagerCompile, shared->StartPosition(), true, + shared->FunctionLiteralId(isolate), nullptr); + + return new UnoptimizedCompileJob( + tracer(), allocator(), outer_parse_info.get(), function_name, + function_literal, + isolate->counters()->worker_thread_runtime_call_stats(), + isolate->counters()->compile_function_on_background(), FLAG_stack_size); } private: CompilerDispatcherTracer tracer_; + AccountingAllocator* allocator_; static SaveFlags* save_flags_; DISALLOW_COPY_AND_ASSIGN(UnoptimizedCompileJobTest); @@ -63,24 +94,25 @@ SaveFlags* UnoptimizedCompileJobTest::save_flags_ = nullptr; #define ASSERT_JOB_STATUS(STATUS, JOB) ASSERT_EQ(STATUS, JOB->status()) TEST_F(UnoptimizedCompileJobTest, Construct) { - std::unique_ptr<UnoptimizedCompileJob> job(new UnoptimizedCompileJob( - isolate(), tracer(), test::CreateSharedFunctionInfo(isolate(), nullptr), - FLAG_stack_size)); + Handle<SharedFunctionInfo> shared = + test::CreateSharedFunctionInfo(isolate(), nullptr); + ASSERT_FALSE(shared->is_compiled()); + std::unique_ptr<UnoptimizedCompileJob> job( + NewUnoptimizedCompileJob(isolate(), shared)); } TEST_F(UnoptimizedCompileJobTest, StateTransitions) { - std::unique_ptr<UnoptimizedCompileJob> job(new UnoptimizedCompileJob( - isolate(), tracer(), test::CreateSharedFunctionInfo(isolate(), nullptr), - FLAG_stack_size)); + Handle<SharedFunctionInfo> shared = + test::CreateSharedFunctionInfo(isolate(), nullptr); + ASSERT_FALSE(shared->is_compiled()); + std::unique_ptr<UnoptimizedCompileJob> job( + NewUnoptimizedCompileJob(isolate(), shared)); ASSERT_JOB_STATUS(CompilerDispatcherJob::Status::kInitial, job); - job->PrepareOnMainThread(isolate()); - ASSERT_FALSE(job->IsFailed()); - ASSERT_JOB_STATUS(CompilerDispatcherJob::Status::kPrepared, job); job->Compile(false); ASSERT_FALSE(job->IsFailed()); - ASSERT_JOB_STATUS(CompilerDispatcherJob::Status::kCompiled, job); - job->FinalizeOnMainThread(isolate()); + ASSERT_JOB_STATUS(CompilerDispatcherJob::Status::kReadyToFinalize, job); + job->FinalizeOnMainThread(isolate(), shared); ASSERT_FALSE(job->IsFailed()); ASSERT_JOB_STATUS(CompilerDispatcherJob::Status::kDone, job); job->ResetOnMainThread(isolate()); @@ -89,15 +121,16 @@ TEST_F(UnoptimizedCompileJobTest, StateTransitions) { TEST_F(UnoptimizedCompileJobTest, SyntaxError) { test::ScriptResource* script = new test::ScriptResource("^^^", strlen("^^^")); - std::unique_ptr<UnoptimizedCompileJob> job(new UnoptimizedCompileJob( - isolate(), tracer(), test::CreateSharedFunctionInfo(isolate(), script), - FLAG_stack_size)); + Handle<SharedFunctionInfo> shared = + test::CreateSharedFunctionInfo(isolate(), script); + std::unique_ptr<UnoptimizedCompileJob> job( + NewUnoptimizedCompileJob(isolate(), shared)); - job->PrepareOnMainThread(isolate()); - ASSERT_FALSE(job->IsFailed()); job->Compile(false); ASSERT_FALSE(job->IsFailed()); - job->ReportErrorsOnMainThread(isolate()); + ASSERT_JOB_STATUS(CompilerDispatcherJob::Status::kReadyToFinalize, job); + + job->FinalizeOnMainThread(isolate(), shared); ASSERT_TRUE(job->IsFailed()); ASSERT_JOB_STATUS(CompilerDispatcherJob::Status::kFailed, job); ASSERT_TRUE(isolate()->has_pending_exception()); @@ -109,7 +142,7 @@ TEST_F(UnoptimizedCompileJobTest, SyntaxError) { } TEST_F(UnoptimizedCompileJobTest, CompileAndRun) { - const char script[] = + const char raw_script[] = "function g() {\n" " f = function(a) {\n" " for (var i = 0; i < 3; i++) { a += 20; }\n" @@ -118,29 +151,28 @@ TEST_F(UnoptimizedCompileJobTest, CompileAndRun) { " return f;\n" "}\n" "g();"; + test::ScriptResource* script = + new test::ScriptResource(raw_script, strlen(raw_script)); Handle<JSFunction> f = RunJS<JSFunction>(script); - std::unique_ptr<UnoptimizedCompileJob> job(new UnoptimizedCompileJob( - isolate(), tracer(), handle(f->shared(), f->GetIsolate()), - FLAG_stack_size)); + Handle<SharedFunctionInfo> shared = handle(f->shared(), isolate()); + ASSERT_FALSE(shared->is_compiled()); + std::unique_ptr<UnoptimizedCompileJob> job( + NewUnoptimizedCompileJob(isolate(), shared)); - job->PrepareOnMainThread(isolate()); - ASSERT_FALSE(job->IsFailed()); job->Compile(false); - ASSERT_FALSE(job->IsFailed()); - job->FinalizeOnMainThread(isolate()); - ASSERT_FALSE(job->IsFailed()); + job->FinalizeOnMainThread(isolate(), shared); ASSERT_JOB_STATUS(CompilerDispatcherJob::Status::kDone, job); + ASSERT_TRUE(shared->is_compiled()); + job->ResetOnMainThread(isolate()); + ASSERT_JOB_STATUS(CompilerDispatcherJob::Status::kInitial, job); Smi* value = Smi::cast(*RunJS("f(100);")); ASSERT_TRUE(value == Smi::FromInt(160)); - - job->ResetOnMainThread(isolate()); - ASSERT_JOB_STATUS(CompilerDispatcherJob::Status::kInitial, job); } -TEST_F(UnoptimizedCompileJobTest, CompileFailureToAnalyse) { +TEST_F(UnoptimizedCompileJobTest, CompileFailure) { std::string raw_script("() { var a = "); - for (int i = 0; i < 500000; i++) { + for (int i = 0; i < 10000; i++) { // TODO(leszeks): Figure out a more "unit-test-y" way of forcing an analysis // failure than a binop stack overflow. @@ -150,42 +182,16 @@ TEST_F(UnoptimizedCompileJobTest, CompileFailureToAnalyse) { raw_script += " 'x'; }"; test::ScriptResource* script = new test::ScriptResource(raw_script.c_str(), strlen(raw_script.c_str())); - std::unique_ptr<UnoptimizedCompileJob> job(new UnoptimizedCompileJob( - isolate(), tracer(), test::CreateSharedFunctionInfo(isolate(), script), - 100)); + Handle<SharedFunctionInfo> shared = + test::CreateSharedFunctionInfo(isolate(), script); + std::unique_ptr<UnoptimizedCompileJob> job( + NewUnoptimizedCompileJob(isolate(), shared, 100)); - job->PrepareOnMainThread(isolate()); - ASSERT_FALSE(job->IsFailed()); job->Compile(false); ASSERT_FALSE(job->IsFailed()); - job->ReportErrorsOnMainThread(isolate()); - ASSERT_TRUE(job->IsFailed()); - ASSERT_JOB_STATUS(CompilerDispatcherJob::Status::kFailed, job); - ASSERT_TRUE(isolate()->has_pending_exception()); + ASSERT_JOB_STATUS(CompilerDispatcherJob::Status::kReadyToFinalize, job); - isolate()->clear_pending_exception(); - job->ResetOnMainThread(isolate()); - ASSERT_JOB_STATUS(CompilerDispatcherJob::Status::kInitial, job); -} - -TEST_F(UnoptimizedCompileJobTest, CompileFailureToFinalize) { - std::string raw_script("() { var a = "); - for (int i = 0; i < 500; i++) { - // Alternate + and - to avoid n-ary operation nodes. - raw_script += "'x' + 'x' - "; - } - raw_script += " 'x'; }"; - test::ScriptResource* script = - new test::ScriptResource(raw_script.c_str(), strlen(raw_script.c_str())); - std::unique_ptr<UnoptimizedCompileJob> job(new UnoptimizedCompileJob( - isolate(), tracer(), test::CreateSharedFunctionInfo(isolate(), script), - 50)); - - job->PrepareOnMainThread(isolate()); - ASSERT_FALSE(job->IsFailed()); - job->Compile(false); - ASSERT_FALSE(job->IsFailed()); - job->ReportErrorsOnMainThread(isolate()); + job->FinalizeOnMainThread(isolate(), shared); ASSERT_TRUE(job->IsFailed()); ASSERT_JOB_STATUS(CompilerDispatcherJob::Status::kFailed, job); ASSERT_TRUE(isolate()->has_pending_exception()); @@ -199,7 +205,7 @@ class CompileTask : public Task { public: CompileTask(UnoptimizedCompileJob* job, base::Semaphore* semaphore) : job_(job), semaphore_(semaphore) {} - ~CompileTask() override {} + ~CompileTask() override = default; void Run() override { job_->Compile(true); @@ -223,19 +229,18 @@ TEST_F(UnoptimizedCompileJobTest, CompileOnBackgroundThread) { "}"; test::ScriptResource* script = new test::ScriptResource(raw_script, strlen(raw_script)); - std::unique_ptr<UnoptimizedCompileJob> job(new UnoptimizedCompileJob( - isolate(), tracer(), test::CreateSharedFunctionInfo(isolate(), script), - 100)); - - job->PrepareOnMainThread(isolate()); - ASSERT_FALSE(job->IsFailed()); + Handle<SharedFunctionInfo> shared = + test::CreateSharedFunctionInfo(isolate(), script); + std::unique_ptr<UnoptimizedCompileJob> job( + NewUnoptimizedCompileJob(isolate(), shared)); base::Semaphore semaphore(0); auto background_task = base::make_unique<CompileTask>(job.get(), &semaphore); - ASSERT_JOB_STATUS(CompilerDispatcherJob::Status::kPrepared, job); + ASSERT_JOB_STATUS(CompilerDispatcherJob::Status::kInitial, job); + V8::GetCurrentPlatform()->CallOnWorkerThread(std::move(background_task)); semaphore.Wait(); - job->FinalizeOnMainThread(isolate()); + job->FinalizeOnMainThread(isolate(), shared); ASSERT_FALSE(job->IsFailed()); ASSERT_JOB_STATUS(CompilerDispatcherJob::Status::kDone, job); @@ -243,26 +248,64 @@ TEST_F(UnoptimizedCompileJobTest, CompileOnBackgroundThread) { ASSERT_JOB_STATUS(CompilerDispatcherJob::Status::kInitial, job); } -TEST_F(UnoptimizedCompileJobTest, LazyInnerFunctions) { - const char script[] = - "f = function() {\n" - " e = (function() { return 42; });\n" - " return e;\n" - "};\n" - "f;"; +TEST_F(UnoptimizedCompileJobTest, EagerInnerFunctions) { + const char raw_script[] = + "function g() {\n" + " f = function() {\n" + " // Simulate an eager IIFE with brackets.\n " + " var e = (function () { return 42; });\n" + " return e;\n" + " }\n" + " return f;\n" + "}\n" + "g();"; + test::ScriptResource* script = + new test::ScriptResource(raw_script, strlen(raw_script)); Handle<JSFunction> f = RunJS<JSFunction>(script); + Handle<SharedFunctionInfo> shared = handle(f->shared(), isolate()); + ASSERT_FALSE(shared->is_compiled()); + std::unique_ptr<UnoptimizedCompileJob> job( + NewUnoptimizedCompileJob(isolate(), shared)); - std::unique_ptr<UnoptimizedCompileJob> job(new UnoptimizedCompileJob( - isolate(), tracer(), handle(f->shared(), f->GetIsolate()), - FLAG_stack_size)); - - job->PrepareOnMainThread(isolate()); + job->Compile(false); + ASSERT_FALSE(job->IsFailed()); + job->FinalizeOnMainThread(isolate(), shared); ASSERT_FALSE(job->IsFailed()); + ASSERT_JOB_STATUS(CompilerDispatcherJob::Status::kDone, job); + ASSERT_TRUE(shared->is_compiled()); + + Handle<JSFunction> e = RunJS<JSFunction>("f();"); + + ASSERT_TRUE(e->shared()->is_compiled()); + + job->ResetOnMainThread(isolate()); + ASSERT_JOB_STATUS(CompilerDispatcherJob::Status::kInitial, job); +} + +TEST_F(UnoptimizedCompileJobTest, LazyInnerFunctions) { + const char raw_script[] = + "function g() {\n" + " f = function() {\n" + " function e() { return 42; };\n" + " return e;\n" + " }\n" + " return f;\n" + "}\n" + "g();"; + test::ScriptResource* script = + new test::ScriptResource(raw_script, strlen(raw_script)); + Handle<JSFunction> f = RunJS<JSFunction>(script); + Handle<SharedFunctionInfo> shared = handle(f->shared(), isolate()); + ASSERT_FALSE(shared->is_compiled()); + std::unique_ptr<UnoptimizedCompileJob> job( + NewUnoptimizedCompileJob(isolate(), shared)); + job->Compile(false); ASSERT_FALSE(job->IsFailed()); - job->FinalizeOnMainThread(isolate()); + job->FinalizeOnMainThread(isolate(), shared); ASSERT_FALSE(job->IsFailed()); ASSERT_JOB_STATUS(CompilerDispatcherJob::Status::kDone, job); + ASSERT_TRUE(shared->is_compiled()); Handle<JSFunction> e = RunJS<JSFunction>("f();"); diff --git a/deps/v8/test/unittests/compiler/bytecode-analysis-unittest.cc b/deps/v8/test/unittests/compiler/bytecode-analysis-unittest.cc index 48c15934df..53b9c6a241 100644 --- a/deps/v8/test/unittests/compiler/bytecode-analysis-unittest.cc +++ b/deps/v8/test/unittests/compiler/bytecode-analysis-unittest.cc @@ -22,8 +22,8 @@ using ToBooleanMode = interpreter::BytecodeArrayBuilder::ToBooleanMode; class BytecodeAnalysisTest : public TestWithIsolateAndZone { public: - BytecodeAnalysisTest() {} - ~BytecodeAnalysisTest() override {} + BytecodeAnalysisTest() = default; + ~BytecodeAnalysisTest() override = default; static void SetUpTestCase() { CHECK_NULL(save_flags_); diff --git a/deps/v8/test/unittests/compiler/checkpoint-elimination-unittest.cc b/deps/v8/test/unittests/compiler/checkpoint-elimination-unittest.cc index a201fc9a55..22ed2abf9b 100644 --- a/deps/v8/test/unittests/compiler/checkpoint-elimination-unittest.cc +++ b/deps/v8/test/unittests/compiler/checkpoint-elimination-unittest.cc @@ -18,7 +18,7 @@ namespace compiler { class CheckpointEliminationTest : public GraphTest { public: CheckpointEliminationTest() : GraphTest() {} - ~CheckpointEliminationTest() override {} + ~CheckpointEliminationTest() override = default; protected: Reduction Reduce(AdvancedReducer::Editor* editor, Node* node) { diff --git a/deps/v8/test/unittests/compiler/code-assembler-unittest.h b/deps/v8/test/unittests/compiler/code-assembler-unittest.h index 21f3df5f4b..56f1959765 100644 --- a/deps/v8/test/unittests/compiler/code-assembler-unittest.h +++ b/deps/v8/test/unittests/compiler/code-assembler-unittest.h @@ -15,8 +15,8 @@ namespace compiler { class CodeAssemblerTest : public TestWithIsolateAndZone { public: - CodeAssemblerTest() {} - ~CodeAssemblerTest() override {} + CodeAssemblerTest() = default; + ~CodeAssemblerTest() override = default; }; class CodeAssemblerTestState : public CodeAssemblerState { diff --git a/deps/v8/test/unittests/compiler/common-operator-reducer-unittest.cc b/deps/v8/test/unittests/compiler/common-operator-reducer-unittest.cc index cb5b5fd806..f40cab2758 100644 --- a/deps/v8/test/unittests/compiler/common-operator-reducer-unittest.cc +++ b/deps/v8/test/unittests/compiler/common-operator-reducer-unittest.cc @@ -23,7 +23,7 @@ class CommonOperatorReducerTest : public GraphTest { public: explicit CommonOperatorReducerTest(int num_parameters = 1) : GraphTest(num_parameters), machine_(zone()), simplified_(zone()) {} - ~CommonOperatorReducerTest() override {} + ~CommonOperatorReducerTest() override = default; protected: Reduction Reduce( diff --git a/deps/v8/test/unittests/compiler/common-operator-unittest.cc b/deps/v8/test/unittests/compiler/common-operator-unittest.cc index 2ee0dbb382..4d66ded5f1 100644 --- a/deps/v8/test/unittests/compiler/common-operator-unittest.cc +++ b/deps/v8/test/unittests/compiler/common-operator-unittest.cc @@ -120,7 +120,7 @@ namespace { class CommonOperatorTest : public TestWithZone { public: CommonOperatorTest() : common_(zone()) {} - ~CommonOperatorTest() override {} + ~CommonOperatorTest() override = default; CommonOperatorBuilder* common() { return &common_; } diff --git a/deps/v8/test/unittests/compiler/constant-folding-reducer-unittest.cc b/deps/v8/test/unittests/compiler/constant-folding-reducer-unittest.cc index 464ee3a971..fd0845159f 100644 --- a/deps/v8/test/unittests/compiler/constant-folding-reducer-unittest.cc +++ b/deps/v8/test/unittests/compiler/constant-folding-reducer-unittest.cc @@ -66,7 +66,7 @@ class ConstantFoldingReducerTest : public TypedGraphTest { js_heap_broker_(isolate(), zone()), simplified_(zone()), deps_(isolate(), zone()) {} - ~ConstantFoldingReducerTest() override {} + ~ConstantFoldingReducerTest() override = default; protected: Reduction Reduce(Node* node) { diff --git a/deps/v8/test/unittests/compiler/control-flow-optimizer-unittest.cc b/deps/v8/test/unittests/compiler/control-flow-optimizer-unittest.cc index 607df1fafb..992ddcc55b 100644 --- a/deps/v8/test/unittests/compiler/control-flow-optimizer-unittest.cc +++ b/deps/v8/test/unittests/compiler/control-flow-optimizer-unittest.cc @@ -21,7 +21,7 @@ class ControlFlowOptimizerTest : public GraphTest { public: explicit ControlFlowOptimizerTest(int num_parameters = 3) : GraphTest(num_parameters), machine_(zone()), javascript_(zone()) {} - ~ControlFlowOptimizerTest() override {} + ~ControlFlowOptimizerTest() override = default; protected: void Optimize() { diff --git a/deps/v8/test/unittests/compiler/dead-code-elimination-unittest.cc b/deps/v8/test/unittests/compiler/dead-code-elimination-unittest.cc index 4444ed0ca5..72e02e1416 100644 --- a/deps/v8/test/unittests/compiler/dead-code-elimination-unittest.cc +++ b/deps/v8/test/unittests/compiler/dead-code-elimination-unittest.cc @@ -20,7 +20,7 @@ class DeadCodeEliminationTest : public GraphTest { public: explicit DeadCodeEliminationTest(int num_parameters = 4) : GraphTest(num_parameters) {} - ~DeadCodeEliminationTest() override {} + ~DeadCodeEliminationTest() override = default; protected: Reduction Reduce(AdvancedReducer::Editor* editor, Node* node) { diff --git a/deps/v8/test/unittests/compiler/graph-reducer-unittest.cc b/deps/v8/test/unittests/compiler/graph-reducer-unittest.cc index dc2f2189d1..f506502610 100644 --- a/deps/v8/test/unittests/compiler/graph-reducer-unittest.cc +++ b/deps/v8/test/unittests/compiler/graph-reducer-unittest.cc @@ -751,7 +751,7 @@ TEST_F(GraphReducerTest, Sorter1) { Node* n1 = graph()->NewNode(&kOpA0); Node* n2 = graph()->NewNode(&kOpA1, n1); Node* n3 = graph()->NewNode(&kOpA1, n1); - Node* end = NULL; // Initialize to please the compiler. + Node* end = nullptr; // Initialize to please the compiler. if (i == 0) end = graph()->NewNode(&kOpA2, n2, n3); if (i == 1) end = graph()->NewNode(&kOpA2, n3, n2); diff --git a/deps/v8/test/unittests/compiler/graph-unittest.cc b/deps/v8/test/unittests/compiler/graph-unittest.cc index af2c382f5b..4736ddefa2 100644 --- a/deps/v8/test/unittests/compiler/graph-unittest.cc +++ b/deps/v8/test/unittests/compiler/graph-unittest.cc @@ -4,6 +4,7 @@ #include "test/unittests/compiler/graph-unittest.h" +#include "src/compiler/js-heap-copy-reducer.h" #include "src/compiler/node-properties.h" #include "src/heap/factory.h" #include "src/objects-inl.h" // TODO(everyone): Make typer.h IWYU compliant. @@ -24,16 +25,22 @@ GraphTest::GraphTest(int num_parameters) node_origins_(&graph_) { graph()->SetStart(graph()->NewNode(common()->Start(num_parameters))); graph()->SetEnd(graph()->NewNode(common()->End(1), graph()->start())); + js_heap_broker()->SetNativeContextRef(); } -GraphTest::~GraphTest() {} +GraphTest::~GraphTest() = default; Node* GraphTest::Parameter(int32_t index) { return graph()->NewNode(common()->Parameter(index), graph()->start()); } +Node* GraphTest::Parameter(Type type, int32_t index) { + Node* node = GraphTest::Parameter(index); + NodeProperties::SetType(node, type); + return node; +} Node* GraphTest::Float32Constant(volatile float value) { return graph()->NewNode(common()->Float32Constant(value)); @@ -113,15 +120,9 @@ Matcher<Node*> GraphTest::IsUndefinedConstant() { TypedGraphTest::TypedGraphTest(int num_parameters) : GraphTest(num_parameters), - typer_(isolate(), js_heap_broker(), Typer::kNoFlags, graph()) {} - -TypedGraphTest::~TypedGraphTest() {} + typer_(js_heap_broker(), Typer::kNoFlags, graph()) {} -Node* TypedGraphTest::Parameter(Type type, int32_t index) { - Node* node = GraphTest::Parameter(index); - NodeProperties::SetType(node, type); - return node; -} +TypedGraphTest::~TypedGraphTest() = default; namespace graph_unittest { diff --git a/deps/v8/test/unittests/compiler/graph-unittest.h b/deps/v8/test/unittests/compiler/graph-unittest.h index d9b9934770..8317ebf279 100644 --- a/deps/v8/test/unittests/compiler/graph-unittest.h +++ b/deps/v8/test/unittests/compiler/graph-unittest.h @@ -34,6 +34,7 @@ class GraphTest : public virtual TestWithNativeContext, Node* end() { return graph()->end(); } Node* Parameter(int32_t index = 0); + Node* Parameter(Type type, int32_t index = 0); Node* Float32Constant(volatile float value); Node* Float64Constant(volatile double value); Node* Int32Constant(int32_t value); @@ -79,9 +80,6 @@ class TypedGraphTest : public GraphTest { ~TypedGraphTest() override; protected: - Node* Parameter(int32_t index = 0) { return GraphTest::Parameter(index); } - Node* Parameter(Type type, int32_t index = 0); - Typer* typer() { return &typer_; } private: diff --git a/deps/v8/test/unittests/compiler/instruction-selector-unittest.cc b/deps/v8/test/unittests/compiler/instruction-selector-unittest.cc index ed4a1c648a..2d59393f9d 100644 --- a/deps/v8/test/unittests/compiler/instruction-selector-unittest.cc +++ b/deps/v8/test/unittests/compiler/instruction-selector-unittest.cc @@ -20,7 +20,7 @@ namespace compiler { InstructionSelectorTest::InstructionSelectorTest() : rng_(FLAG_random_seed) {} -InstructionSelectorTest::~InstructionSelectorTest() {} +InstructionSelectorTest::~InstructionSelectorTest() = default; InstructionSelectorTest::Stream InstructionSelectorTest::StreamBuilder::Build( @@ -365,7 +365,8 @@ TARGET_TEST_F(InstructionSelectorTest, CallJSFunctionWithDeopt) { ZoneVector<MachineType> empty_types(zone()); auto call_descriptor = Linkage::GetJSCallDescriptor( - zone(), false, 1, CallDescriptor::kNeedsFrameState); + zone(), false, 1, + CallDescriptor::kNeedsFrameState | CallDescriptor::kCanUseRoots); // Build frame state for the state before the call. Node* parameters = m.AddNode( diff --git a/deps/v8/test/unittests/compiler/instruction-unittest.cc b/deps/v8/test/unittests/compiler/instruction-unittest.cc index 96add7fdd8..72deb12d02 100644 --- a/deps/v8/test/unittests/compiler/instruction-unittest.cc +++ b/deps/v8/test/unittests/compiler/instruction-unittest.cc @@ -38,8 +38,8 @@ bool Contains(const ZoneVector<MoveOperands*>* moves, class InstructionTest : public TestWithZone { public: - InstructionTest() {} - virtual ~InstructionTest() {} + InstructionTest() = default; + ~InstructionTest() override = default; ParallelMove* CreateParallelMove( const std::vector<InstructionOperand>& operand_pairs) { 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 53e3b48762..7660f5851e 100644 --- a/deps/v8/test/unittests/compiler/js-call-reducer-unittest.cc +++ b/deps/v8/test/unittests/compiler/js-call-reducer-unittest.cc @@ -21,11 +21,12 @@ namespace compiler { class JSCallReducerTest : public TypedGraphTest { public: JSCallReducerTest() - : TypedGraphTest(3), - javascript_(zone()), - deps_(isolate(), zone()), - js_heap_broker(isolate(), zone()) {} - ~JSCallReducerTest() override {} + : TypedGraphTest(3), javascript_(zone()), deps_(isolate(), zone()) { + if (FLAG_concurrent_compiler_frontend) { + js_heap_broker()->SerializeStandardObjects(); + } + } + ~JSCallReducerTest() override = default; protected: Reduction Reduce(Node* node) { @@ -36,7 +37,7 @@ class JSCallReducerTest : public TypedGraphTest { // TODO(titzer): mock the GraphReducer here for better unit testing. GraphReducer graph_reducer(zone(), graph()); - JSCallReducer reducer(&graph_reducer, &jsgraph, &js_heap_broker, + JSCallReducer reducer(&graph_reducer, &jsgraph, js_heap_broker(), JSCallReducer::kNoFlags, native_context(), &deps_); return reducer.Reduce(node); } @@ -45,16 +46,13 @@ class JSCallReducerTest : public TypedGraphTest { static void SetUpTestCase() { old_flag_lazy_ = i::FLAG_lazy_deserialization; - old_flag_lazy_handler_ = i::FLAG_lazy_handler_deserialization; i::FLAG_lazy_deserialization = false; - i::FLAG_lazy_handler_deserialization = false; TypedGraphTest::SetUpTestCase(); } static void TearDownTestCase() { TypedGraphTest::TearDownTestCase(); i::FLAG_lazy_deserialization = old_flag_lazy_; - i::FLAG_lazy_handler_deserialization = old_flag_lazy_handler_; } Node* GlobalFunction(const char* name) { @@ -124,7 +122,7 @@ class JSCallReducerTest : public TypedGraphTest { // overwriting existing metadata. shared->set_raw_outer_scope_info_or_feedback_metadata(*metadata); Handle<FeedbackVector> vector = FeedbackVector::New(isolate(), shared); - VectorSlotPair feedback(vector, FeedbackSlot(0)); + VectorSlotPair feedback(vector, FeedbackSlot(0), UNINITIALIZED); return javascript()->Call(arity, CallFrequency(), feedback, ConvertReceiverMode::kAny, SpeculationMode::kAllowSpeculation); @@ -133,7 +131,6 @@ class JSCallReducerTest : public TypedGraphTest { private: JSOperatorBuilder javascript_; CompilationDependencies deps_; - JSHeapBroker js_heap_broker; static bool old_flag_lazy_; static bool old_flag_lazy_handler_; diff --git a/deps/v8/test/unittests/compiler/js-create-lowering-unittest.cc b/deps/v8/test/unittests/compiler/js-create-lowering-unittest.cc index 2db241aaa9..eafd7fa35e 100644 --- a/deps/v8/test/unittests/compiler/js-create-lowering-unittest.cc +++ b/deps/v8/test/unittests/compiler/js-create-lowering-unittest.cc @@ -33,8 +33,9 @@ class JSCreateLoweringTest : public TypedGraphTest { : TypedGraphTest(3), javascript_(zone()), deps_(isolate(), zone()), - handle_scope_(isolate()) {} - ~JSCreateLoweringTest() override {} + handle_scope_(isolate()) { + } + ~JSCreateLoweringTest() override = default; protected: Reduction Reduce(Node* node) { @@ -45,7 +46,7 @@ class JSCreateLoweringTest : public TypedGraphTest { // TODO(titzer): mock the GraphReducer here for better unit testing. GraphReducer graph_reducer(zone(), graph()); JSCreateLowering reducer(&graph_reducer, &deps_, &jsgraph, js_heap_broker(), - native_context(), zone()); + zone()); return reducer.Reduce(node); } @@ -172,7 +173,7 @@ TEST_F(JSCreateLoweringTest, JSCreateFunctionContextViaInlinedAllocation) { // JSCreateWithContext TEST_F(JSCreateLoweringTest, JSCreateWithContext) { - Handle<ScopeInfo> scope_info(factory()->NewScopeInfo(1)); + Handle<ScopeInfo> scope_info = ScopeInfo::CreateForEmptyFunction(isolate()); Node* const object = Parameter(Type::Receiver()); Node* const context = Parameter(Type::Any()); Node* const effect = graph()->start(); @@ -192,7 +193,7 @@ TEST_F(JSCreateLoweringTest, JSCreateWithContext) { // JSCreateCatchContext TEST_F(JSCreateLoweringTest, JSCreateCatchContext) { - Handle<ScopeInfo> scope_info(factory()->NewScopeInfo(1)); + Handle<ScopeInfo> scope_info = ScopeInfo::CreateForEmptyFunction(isolate()); Node* const exception = Parameter(Type::Receiver()); Node* const context = Parameter(Type::Any()); Node* const effect = graph()->start(); diff --git a/deps/v8/test/unittests/compiler/js-intrinsic-lowering-unittest.cc b/deps/v8/test/unittests/compiler/js-intrinsic-lowering-unittest.cc index 2b0ccaed24..234fe940eb 100644 --- a/deps/v8/test/unittests/compiler/js-intrinsic-lowering-unittest.cc +++ b/deps/v8/test/unittests/compiler/js-intrinsic-lowering-unittest.cc @@ -26,7 +26,7 @@ namespace compiler { class JSIntrinsicLoweringTest : public GraphTest { public: JSIntrinsicLoweringTest() : GraphTest(3), javascript_(zone()) {} - ~JSIntrinsicLoweringTest() override {} + ~JSIntrinsicLoweringTest() override = default; protected: Reduction Reduce(Node* node) { diff --git a/deps/v8/test/unittests/compiler/js-native-context-specialization-unittest.cc b/deps/v8/test/unittests/compiler/js-native-context-specialization-unittest.cc new file mode 100644 index 0000000000..fdc87904c4 --- /dev/null +++ b/deps/v8/test/unittests/compiler/js-native-context-specialization-unittest.cc @@ -0,0 +1,50 @@ +// Copyright 2014 the V8 project authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "test/unittests/compiler/graph-unittest.h" + +#include "src/compiler/js-native-context-specialization.h" +#include "src/compiler/js-operator.h" +#include "src/compiler/machine-operator.h" +#include "src/compiler/simplified-operator.h" +#include "src/dtoa.h" + +namespace v8 { +namespace internal { +namespace compiler { +namespace js_native_context_specialization_unittest { + +class JSNativeContextSpecializationTest : public GraphTest { + public: + explicit JSNativeContextSpecializationTest(int num_parameters = 1) + : GraphTest(num_parameters), javascript_(zone()) {} + ~JSNativeContextSpecializationTest() override {} + + protected: + JSOperatorBuilder* javascript() { return &javascript_; } + + private: + JSOperatorBuilder javascript_; +}; + +TEST_F(JSNativeContextSpecializationTest, GetMaxStringLengthOfString) { + const size_t str_len = 3; + const size_t num_len = kBase10MaximalLength + 1; + + Node* const str_node = graph()->NewNode( + common()->HeapConstant(factory()->InternalizeUtf8String("str"))); + EXPECT_EQ(JSNativeContextSpecialization::GetMaxStringLength(js_heap_broker(), + str_node), + str_len); + + Node* const num_node = graph()->NewNode(common()->NumberConstant(10.0 / 3)); + EXPECT_EQ(JSNativeContextSpecialization::GetMaxStringLength(js_heap_broker(), + num_node), + num_len); +} + +} // namespace js_native_context_specialization_unittest +} // namespace compiler +} // namespace internal +} // namespace v8 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 9ce837cd8c..43998824d2 100644 --- a/deps/v8/test/unittests/compiler/js-typed-lowering-unittest.cc +++ b/deps/v8/test/unittests/compiler/js-typed-lowering-unittest.cc @@ -38,7 +38,7 @@ Type const kJSTypes[] = {Type::Undefined(), Type::Null(), Type::Boolean(), class JSTypedLoweringTest : public TypedGraphTest { public: JSTypedLoweringTest() : TypedGraphTest(3), javascript_(zone()) {} - ~JSTypedLoweringTest() override {} + ~JSTypedLoweringTest() override = default; protected: Reduction Reduce(Node* node) { @@ -401,12 +401,7 @@ TEST_F(JSTypedLoweringTest, JSAddWithString) { Reduction r = Reduce(graph()->NewNode(javascript()->Add(hint), lhs, rhs, context, frame_state, effect, control)); ASSERT_TRUE(r.Changed()); - EXPECT_THAT(r.replacement(), - IsCall(_, IsHeapConstant( - CodeFactory::StringAdd( - isolate(), STRING_ADD_CHECK_NONE, NOT_TENURED) - .code()), - lhs, rhs, context, frame_state, effect, control)); + EXPECT_THAT(r.replacement(), IsStringConcat(_, lhs, rhs)); } } // namespace compiler diff --git a/deps/v8/test/unittests/compiler/load-elimination-unittest.cc b/deps/v8/test/unittests/compiler/load-elimination-unittest.cc index 5c49468991..042e7e6bbc 100644 --- a/deps/v8/test/unittests/compiler/load-elimination-unittest.cc +++ b/deps/v8/test/unittests/compiler/load-elimination-unittest.cc @@ -26,7 +26,7 @@ class LoadEliminationTest : public TypedGraphTest { simplified_(zone()), jsgraph_(isolate(), graph(), common(), nullptr, simplified(), nullptr) { } - ~LoadEliminationTest() override {} + ~LoadEliminationTest() override = default; protected: JSGraph* jsgraph() { return &jsgraph_; } diff --git a/deps/v8/test/unittests/compiler/loop-peeling-unittest.cc b/deps/v8/test/unittests/compiler/loop-peeling-unittest.cc index d39336dfa5..07013aa52c 100644 --- a/deps/v8/test/unittests/compiler/loop-peeling-unittest.cc +++ b/deps/v8/test/unittests/compiler/loop-peeling-unittest.cc @@ -54,7 +54,7 @@ struct Counter { class LoopPeelingTest : public GraphTest { public: LoopPeelingTest() : GraphTest(1), machine_(zone()) {} - ~LoopPeelingTest() override {} + ~LoopPeelingTest() override = default; protected: MachineOperatorBuilder machine_; diff --git a/deps/v8/test/unittests/compiler/machine-operator-reducer-unittest.cc b/deps/v8/test/unittests/compiler/machine-operator-reducer-unittest.cc index f47e780426..b8b0c9004f 100644 --- a/deps/v8/test/unittests/compiler/machine-operator-reducer-unittest.cc +++ b/deps/v8/test/unittests/compiler/machine-operator-reducer-unittest.cc @@ -71,7 +71,7 @@ class MachineOperatorReducerTestWithParam public: explicit MachineOperatorReducerTestWithParam(int num_parameters = 2) : MachineOperatorReducerTest(num_parameters) {} - ~MachineOperatorReducerTestWithParam() override {} + ~MachineOperatorReducerTestWithParam() override = default; }; @@ -344,6 +344,27 @@ TEST_F(MachineOperatorReducerTest, ChangeFloat64ToInt32WithConstant) { } } +// ----------------------------------------------------------------------------- +// ChangeFloat64ToInt64 + +TEST_F(MachineOperatorReducerTest, + ChangeFloat64ToInt64WithChangeInt64ToFloat64) { + Node* value = Parameter(0); + Reduction reduction = Reduce(graph()->NewNode( + machine()->ChangeFloat64ToInt64(), + graph()->NewNode(machine()->ChangeInt64ToFloat64(), value))); + ASSERT_TRUE(reduction.Changed()); + EXPECT_EQ(value, reduction.replacement()); +} + +TEST_F(MachineOperatorReducerTest, ChangeFloat64ToInt64WithConstant) { + TRACED_FOREACH(int32_t, x, kInt32Values) { + Reduction reduction = Reduce(graph()->NewNode( + machine()->ChangeFloat64ToInt64(), Float64Constant(FastI2D(x)))); + ASSERT_TRUE(reduction.Changed()); + EXPECT_THAT(reduction.replacement(), IsInt64Constant(x)); + } +} // ----------------------------------------------------------------------------- // ChangeFloat64ToUint32 @@ -397,6 +418,27 @@ TEST_F(MachineOperatorReducerTest, ChangeInt32ToInt64WithConstant) { } } +// ----------------------------------------------------------------------------- +// ChangeInt64ToFloat64 + +TEST_F(MachineOperatorReducerTest, + ChangeInt64ToFloat64WithChangeFloat64ToInt64) { + Node* value = Parameter(0); + Reduction reduction = Reduce(graph()->NewNode( + machine()->ChangeInt64ToFloat64(), + graph()->NewNode(machine()->ChangeFloat64ToInt64(), value))); + ASSERT_TRUE(reduction.Changed()); + EXPECT_EQ(value, reduction.replacement()); +} + +TEST_F(MachineOperatorReducerTest, ChangeInt64ToFloat64WithConstant) { + TRACED_FOREACH(int32_t, x, kInt32Values) { + Reduction reduction = Reduce( + graph()->NewNode(machine()->ChangeInt64ToFloat64(), Int64Constant(x))); + ASSERT_TRUE(reduction.Changed()); + EXPECT_THAT(reduction.replacement(), IsFloat64Constant(BitEq(FastI2D(x)))); + } +} // ----------------------------------------------------------------------------- // ChangeUint32ToFloat64 @@ -2020,6 +2062,16 @@ TEST_F(MachineOperatorReducerTest, Float64InsertHighWord32WithConstant) { // ----------------------------------------------------------------------------- // Float64Equal +TEST_F(MachineOperatorReducerTest, Float64EqualWithConstant) { + TRACED_FOREACH(double, x, kFloat64Values) { + TRACED_FOREACH(double, y, kFloat64Values) { + Reduction const r = Reduce(graph()->NewNode( + machine()->Float64Equal(), Float64Constant(x), Float64Constant(y))); + ASSERT_TRUE(r.Changed()); + EXPECT_THAT(r.replacement(), IsInt32Constant(x == y)); + } + } +} TEST_F(MachineOperatorReducerTest, Float64EqualWithFloat32Conversions) { Node* const p0 = Parameter(0); @@ -2049,6 +2101,17 @@ TEST_F(MachineOperatorReducerTest, Float64EqualWithFloat32Constant) { // ----------------------------------------------------------------------------- // Float64LessThan +TEST_F(MachineOperatorReducerTest, Float64LessThanWithConstant) { + TRACED_FOREACH(double, x, kFloat64Values) { + TRACED_FOREACH(double, y, kFloat64Values) { + Reduction const r = + Reduce(graph()->NewNode(machine()->Float64LessThan(), + Float64Constant(x), Float64Constant(y))); + ASSERT_TRUE(r.Changed()); + EXPECT_THAT(r.replacement(), IsInt32Constant(x < y)); + } + } +} TEST_F(MachineOperatorReducerTest, Float64LessThanWithFloat32Conversions) { Node* const p0 = Parameter(0); @@ -2089,6 +2152,17 @@ TEST_F(MachineOperatorReducerTest, Float64LessThanWithFloat32Constant) { // ----------------------------------------------------------------------------- // Float64LessThanOrEqual +TEST_F(MachineOperatorReducerTest, Float64LessThanOrEqualWithConstant) { + TRACED_FOREACH(double, x, kFloat64Values) { + TRACED_FOREACH(double, y, kFloat64Values) { + Reduction const r = + Reduce(graph()->NewNode(machine()->Float64LessThanOrEqual(), + Float64Constant(x), Float64Constant(y))); + ASSERT_TRUE(r.Changed()); + EXPECT_THAT(r.replacement(), IsInt32Constant(x <= y)); + } + } +} TEST_F(MachineOperatorReducerTest, Float64LessThanOrEqualWithFloat32Conversions) { diff --git a/deps/v8/test/unittests/compiler/node-cache-unittest.cc b/deps/v8/test/unittests/compiler/node-cache-unittest.cc index f77377deda..b699fb38ca 100644 --- a/deps/v8/test/unittests/compiler/node-cache-unittest.cc +++ b/deps/v8/test/unittests/compiler/node-cache-unittest.cc @@ -63,7 +63,7 @@ TEST_F(NodeCacheTest, Int32Constant_hits) { for (int i = 0; i < kSize; i++) { int32_t v = i * -55; Node** pos = cache.Find(zone(), v); - if (*pos != NULL) { + if (*pos != nullptr) { EXPECT_EQ(nodes[i], *pos); hits++; } @@ -101,7 +101,7 @@ TEST_F(NodeCacheTest, Int64Constant_hits) { for (int i = 0; i < kSize; i++) { int64_t v = static_cast<int64_t>(i) * static_cast<int64_t>(5003001); Node** pos = cache.Find(zone(), v); - if (*pos != NULL) { + if (*pos != nullptr) { EXPECT_EQ(nodes[i], *pos); hits++; } @@ -118,7 +118,7 @@ TEST_F(NodeCacheTest, GetCachedNodes_int32) { for (size_t i = 0; i < arraysize(constants); i++) { int32_t k = constants[i]; Node** pos = cache.Find(zone(), k); - if (*pos != NULL) { + if (*pos != nullptr) { ZoneVector<Node*> nodes(zone()); cache.GetCachedNodes(&nodes); EXPECT_THAT(nodes, Contains(*pos)); @@ -141,7 +141,7 @@ TEST_F(NodeCacheTest, GetCachedNodes_int64) { for (size_t i = 0; i < arraysize(constants); i++) { int64_t k = constants[i]; Node** pos = cache.Find(zone(), k); - if (*pos != NULL) { + if (*pos != nullptr) { ZoneVector<Node*> nodes(zone()); cache.GetCachedNodes(&nodes); EXPECT_THAT(nodes, Contains(*pos)); diff --git a/deps/v8/test/unittests/compiler/node-matchers-unittest.cc b/deps/v8/test/unittests/compiler/node-matchers-unittest.cc index 7f043049f0..2663e3abb8 100644 --- a/deps/v8/test/unittests/compiler/node-matchers-unittest.cc +++ b/deps/v8/test/unittests/compiler/node-matchers-unittest.cc @@ -19,7 +19,7 @@ namespace compiler { class NodeMatcherTest : public GraphTest { public: NodeMatcherTest() : machine_(zone()) {} - ~NodeMatcherTest() override {} + ~NodeMatcherTest() override = default; MachineOperatorBuilder* machine() { return &machine_; } @@ -150,191 +150,191 @@ TEST_F(NodeMatcherTest, ScaledWithOffset32Matcher) { // (B0 + B1) -> [B0, 0, B1, NULL] BaseWithIndexAndDisplacement32Matcher match1(graph()->NewNode(a_op, b0, b1)); - CheckBaseWithIndexAndDisplacement(&match1, b1, 0, b0, NULL); + CheckBaseWithIndexAndDisplacement(&match1, b1, 0, b0, nullptr); // (B0 + D15) -> [NULL, 0, B0, D15] BaseWithIndexAndDisplacement32Matcher match2(graph()->NewNode(a_op, b0, d15)); - CheckBaseWithIndexAndDisplacement(&match2, NULL, 0, b0, d15); + CheckBaseWithIndexAndDisplacement(&match2, nullptr, 0, b0, d15); // (D15 + B0) -> [NULL, 0, B0, D15] BaseWithIndexAndDisplacement32Matcher match3(graph()->NewNode(a_op, d15, b0)); - CheckBaseWithIndexAndDisplacement(&match3, NULL, 0, b0, d15); + CheckBaseWithIndexAndDisplacement(&match3, nullptr, 0, b0, d15); // (B0 + M1) -> [p1, 0, B0, NULL] BaseWithIndexAndDisplacement32Matcher match4(graph()->NewNode(a_op, b0, m1)); - CheckBaseWithIndexAndDisplacement(&match4, p1, 0, b0, NULL); + CheckBaseWithIndexAndDisplacement(&match4, p1, 0, b0, nullptr); // (M1 + B0) -> [p1, 0, B0, NULL] m1 = graph()->NewNode(m_op, p1, d1); BaseWithIndexAndDisplacement32Matcher match5(graph()->NewNode(a_op, m1, b0)); - CheckBaseWithIndexAndDisplacement(&match5, p1, 0, b0, NULL); + CheckBaseWithIndexAndDisplacement(&match5, p1, 0, b0, nullptr); // (D15 + M1) -> [P1, 0, NULL, D15] m1 = graph()->NewNode(m_op, p1, d1); BaseWithIndexAndDisplacement32Matcher match6(graph()->NewNode(a_op, d15, m1)); - CheckBaseWithIndexAndDisplacement(&match6, p1, 0, NULL, d15); + CheckBaseWithIndexAndDisplacement(&match6, p1, 0, nullptr, d15); // (M1 + D15) -> [P1, 0, NULL, D15] m1 = graph()->NewNode(m_op, p1, d1); BaseWithIndexAndDisplacement32Matcher match7(graph()->NewNode(a_op, m1, d15)); - CheckBaseWithIndexAndDisplacement(&match7, p1, 0, NULL, d15); + CheckBaseWithIndexAndDisplacement(&match7, p1, 0, nullptr, d15); // (B0 + S0) -> [p1, 0, B0, NULL] BaseWithIndexAndDisplacement32Matcher match8(graph()->NewNode(a_op, b0, s0)); - CheckBaseWithIndexAndDisplacement(&match8, p1, 0, b0, NULL); + CheckBaseWithIndexAndDisplacement(&match8, p1, 0, b0, nullptr); // (S0 + B0) -> [p1, 0, B0, NULL] s0 = graph()->NewNode(s_op, p1, d0); BaseWithIndexAndDisplacement32Matcher match9(graph()->NewNode(a_op, s0, b0)); - CheckBaseWithIndexAndDisplacement(&match9, p1, 0, b0, NULL); + CheckBaseWithIndexAndDisplacement(&match9, p1, 0, b0, nullptr); // (D15 + S0) -> [P1, 0, NULL, D15] s0 = graph()->NewNode(s_op, p1, d0); BaseWithIndexAndDisplacement32Matcher match10( graph()->NewNode(a_op, d15, s0)); - CheckBaseWithIndexAndDisplacement(&match10, p1, 0, NULL, d15); + CheckBaseWithIndexAndDisplacement(&match10, p1, 0, nullptr, d15); // (S0 + D15) -> [P1, 0, NULL, D15] s0 = graph()->NewNode(s_op, p1, d0); BaseWithIndexAndDisplacement32Matcher match11( graph()->NewNode(a_op, s0, d15)); - CheckBaseWithIndexAndDisplacement(&match11, p1, 0, NULL, d15); + CheckBaseWithIndexAndDisplacement(&match11, p1, 0, nullptr, d15); // (B0 + M2) -> [p1, 1, B0, NULL] BaseWithIndexAndDisplacement32Matcher match12(graph()->NewNode(a_op, b0, m2)); - CheckBaseWithIndexAndDisplacement(&match12, p1, 1, b0, NULL); + CheckBaseWithIndexAndDisplacement(&match12, p1, 1, b0, nullptr); // (M2 + B0) -> [p1, 1, B0, NULL] m2 = graph()->NewNode(m_op, p1, d2); BaseWithIndexAndDisplacement32Matcher match13(graph()->NewNode(a_op, m2, b0)); - CheckBaseWithIndexAndDisplacement(&match13, p1, 1, b0, NULL); + CheckBaseWithIndexAndDisplacement(&match13, p1, 1, b0, nullptr); // (D15 + M2) -> [P1, 1, NULL, D15] m2 = graph()->NewNode(m_op, p1, d2); BaseWithIndexAndDisplacement32Matcher match14( graph()->NewNode(a_op, d15, m2)); - CheckBaseWithIndexAndDisplacement(&match14, p1, 1, NULL, d15); + CheckBaseWithIndexAndDisplacement(&match14, p1, 1, nullptr, d15); // (M2 + D15) -> [P1, 1, NULL, D15] m2 = graph()->NewNode(m_op, p1, d2); BaseWithIndexAndDisplacement32Matcher match15( graph()->NewNode(a_op, m2, d15)); - CheckBaseWithIndexAndDisplacement(&match15, p1, 1, NULL, d15); + CheckBaseWithIndexAndDisplacement(&match15, p1, 1, nullptr, d15); // (B0 + S1) -> [p1, 1, B0, NULL] BaseWithIndexAndDisplacement32Matcher match16(graph()->NewNode(a_op, b0, s1)); - CheckBaseWithIndexAndDisplacement(&match16, p1, 1, b0, NULL); + CheckBaseWithIndexAndDisplacement(&match16, p1, 1, b0, nullptr); // (S1 + B0) -> [p1, 1, B0, NULL] s1 = graph()->NewNode(s_op, p1, d1); BaseWithIndexAndDisplacement32Matcher match17(graph()->NewNode(a_op, s1, b0)); - CheckBaseWithIndexAndDisplacement(&match17, p1, 1, b0, NULL); + CheckBaseWithIndexAndDisplacement(&match17, p1, 1, b0, nullptr); // (D15 + S1) -> [P1, 1, NULL, D15] s1 = graph()->NewNode(s_op, p1, d1); BaseWithIndexAndDisplacement32Matcher match18( graph()->NewNode(a_op, d15, s1)); - CheckBaseWithIndexAndDisplacement(&match18, p1, 1, NULL, d15); + CheckBaseWithIndexAndDisplacement(&match18, p1, 1, nullptr, d15); // (S1 + D15) -> [P1, 1, NULL, D15] s1 = graph()->NewNode(s_op, p1, d1); BaseWithIndexAndDisplacement32Matcher match19( graph()->NewNode(a_op, s1, d15)); - CheckBaseWithIndexAndDisplacement(&match19, p1, 1, NULL, d15); + CheckBaseWithIndexAndDisplacement(&match19, p1, 1, nullptr, d15); // (B0 + M4) -> [p1, 2, B0, NULL] BaseWithIndexAndDisplacement32Matcher match20(graph()->NewNode(a_op, b0, m4)); - CheckBaseWithIndexAndDisplacement(&match20, p1, 2, b0, NULL); + CheckBaseWithIndexAndDisplacement(&match20, p1, 2, b0, nullptr); // (M4 + B0) -> [p1, 2, B0, NULL] m4 = graph()->NewNode(m_op, p1, d4); BaseWithIndexAndDisplacement32Matcher match21(graph()->NewNode(a_op, m4, b0)); - CheckBaseWithIndexAndDisplacement(&match21, p1, 2, b0, NULL); + CheckBaseWithIndexAndDisplacement(&match21, p1, 2, b0, nullptr); // (D15 + M4) -> [p1, 2, NULL, D15] m4 = graph()->NewNode(m_op, p1, d4); BaseWithIndexAndDisplacement32Matcher match22( graph()->NewNode(a_op, d15, m4)); - CheckBaseWithIndexAndDisplacement(&match22, p1, 2, NULL, d15); + CheckBaseWithIndexAndDisplacement(&match22, p1, 2, nullptr, d15); // (M4 + D15) -> [p1, 2, NULL, D15] m4 = graph()->NewNode(m_op, p1, d4); BaseWithIndexAndDisplacement32Matcher match23( graph()->NewNode(a_op, m4, d15)); - CheckBaseWithIndexAndDisplacement(&match23, p1, 2, NULL, d15); + CheckBaseWithIndexAndDisplacement(&match23, p1, 2, nullptr, d15); // (B0 + S2) -> [p1, 2, B0, NULL] BaseWithIndexAndDisplacement32Matcher match24(graph()->NewNode(a_op, b0, s2)); - CheckBaseWithIndexAndDisplacement(&match24, p1, 2, b0, NULL); + CheckBaseWithIndexAndDisplacement(&match24, p1, 2, b0, nullptr); // (S2 + B0) -> [p1, 2, B0, NULL] s2 = graph()->NewNode(s_op, p1, d2); BaseWithIndexAndDisplacement32Matcher match25(graph()->NewNode(a_op, s2, b0)); - CheckBaseWithIndexAndDisplacement(&match25, p1, 2, b0, NULL); + CheckBaseWithIndexAndDisplacement(&match25, p1, 2, b0, nullptr); // (D15 + S2) -> [p1, 2, NULL, D15] s2 = graph()->NewNode(s_op, p1, d2); BaseWithIndexAndDisplacement32Matcher match26( graph()->NewNode(a_op, d15, s2)); - CheckBaseWithIndexAndDisplacement(&match26, p1, 2, NULL, d15); + CheckBaseWithIndexAndDisplacement(&match26, p1, 2, nullptr, d15); // (S2 + D15) -> [p1, 2, NULL, D15] s2 = graph()->NewNode(s_op, p1, d2); BaseWithIndexAndDisplacement32Matcher match27( graph()->NewNode(a_op, s2, d15)); - CheckBaseWithIndexAndDisplacement(&match27, p1, 2, NULL, d15); + CheckBaseWithIndexAndDisplacement(&match27, p1, 2, nullptr, d15); // (B0 + M8) -> [p1, 2, B0, NULL] BaseWithIndexAndDisplacement32Matcher match28(graph()->NewNode(a_op, b0, m8)); - CheckBaseWithIndexAndDisplacement(&match28, p1, 3, b0, NULL); + CheckBaseWithIndexAndDisplacement(&match28, p1, 3, b0, nullptr); // (M8 + B0) -> [p1, 2, B0, NULL] m8 = graph()->NewNode(m_op, p1, d8); BaseWithIndexAndDisplacement32Matcher match29(graph()->NewNode(a_op, m8, b0)); - CheckBaseWithIndexAndDisplacement(&match29, p1, 3, b0, NULL); + CheckBaseWithIndexAndDisplacement(&match29, p1, 3, b0, nullptr); // (D15 + M8) -> [p1, 2, NULL, D15] m8 = graph()->NewNode(m_op, p1, d8); BaseWithIndexAndDisplacement32Matcher match30( graph()->NewNode(a_op, d15, m8)); - CheckBaseWithIndexAndDisplacement(&match30, p1, 3, NULL, d15); + CheckBaseWithIndexAndDisplacement(&match30, p1, 3, nullptr, d15); // (M8 + D15) -> [p1, 2, NULL, D15] m8 = graph()->NewNode(m_op, p1, d8); BaseWithIndexAndDisplacement32Matcher match31( graph()->NewNode(a_op, m8, d15)); - CheckBaseWithIndexAndDisplacement(&match31, p1, 3, NULL, d15); + CheckBaseWithIndexAndDisplacement(&match31, p1, 3, nullptr, d15); // (B0 + S3) -> [p1, 2, B0, NULL] BaseWithIndexAndDisplacement32Matcher match32(graph()->NewNode(a_op, b0, s3)); - CheckBaseWithIndexAndDisplacement(&match32, p1, 3, b0, NULL); + CheckBaseWithIndexAndDisplacement(&match32, p1, 3, b0, nullptr); // (S3 + B0) -> [p1, 2, B0, NULL] s3 = graph()->NewNode(s_op, p1, d3); BaseWithIndexAndDisplacement32Matcher match33(graph()->NewNode(a_op, s3, b0)); - CheckBaseWithIndexAndDisplacement(&match33, p1, 3, b0, NULL); + CheckBaseWithIndexAndDisplacement(&match33, p1, 3, b0, nullptr); // (D15 + S3) -> [p1, 2, NULL, D15] s3 = graph()->NewNode(s_op, p1, d3); BaseWithIndexAndDisplacement32Matcher match34( graph()->NewNode(a_op, d15, s3)); - CheckBaseWithIndexAndDisplacement(&match34, p1, 3, NULL, d15); + CheckBaseWithIndexAndDisplacement(&match34, p1, 3, nullptr, d15); // (S3 + D15) -> [p1, 2, NULL, D15] s3 = graph()->NewNode(s_op, p1, d3); BaseWithIndexAndDisplacement32Matcher match35( graph()->NewNode(a_op, s3, d15)); - CheckBaseWithIndexAndDisplacement(&match35, p1, 3, NULL, d15); + CheckBaseWithIndexAndDisplacement(&match35, p1, 3, nullptr, d15); // 2 INPUT - NEGATIVE CASES // (M3 + B1) -> [B0, 0, M3, NULL] BaseWithIndexAndDisplacement32Matcher match36(graph()->NewNode(a_op, b1, m3)); - CheckBaseWithIndexAndDisplacement(&match36, m3, 0, b1, NULL); + CheckBaseWithIndexAndDisplacement(&match36, m3, 0, b1, nullptr); // (S4 + B1) -> [B0, 0, S4, NULL] BaseWithIndexAndDisplacement32Matcher match37(graph()->NewNode(a_op, b1, s4)); - CheckBaseWithIndexAndDisplacement(&match37, s4, 0, b1, NULL); + CheckBaseWithIndexAndDisplacement(&match37, s4, 0, b1, nullptr); // 3 INPUT @@ -400,209 +400,209 @@ TEST_F(NodeMatcherTest, ScaledWithOffset32Matcher) { m1 = graph()->NewNode(m_op, p1, d1); ADD_ADDRESSING_OPERAND_USES(m1); BaseWithIndexAndDisplacement32Matcher match47(graph()->NewNode(a_op, b0, m1)); - CheckBaseWithIndexAndDisplacement(&match47, p1, 0, b0, NULL); + CheckBaseWithIndexAndDisplacement(&match47, p1, 0, b0, nullptr); // (M1 + B0) -> [p1, 0, B0, NULL] m1 = graph()->NewNode(m_op, p1, d1); ADD_ADDRESSING_OPERAND_USES(m1); BaseWithIndexAndDisplacement32Matcher match48(graph()->NewNode(a_op, m1, b0)); - CheckBaseWithIndexAndDisplacement(&match48, p1, 0, b0, NULL); + CheckBaseWithIndexAndDisplacement(&match48, p1, 0, b0, nullptr); // (D15 + M1) -> [P1, 0, NULL, D15] m1 = graph()->NewNode(m_op, p1, d1); ADD_ADDRESSING_OPERAND_USES(m1); BaseWithIndexAndDisplacement32Matcher match49( graph()->NewNode(a_op, d15, m1)); - CheckBaseWithIndexAndDisplacement(&match49, p1, 0, NULL, d15); + CheckBaseWithIndexAndDisplacement(&match49, p1, 0, nullptr, d15); // (M1 + D15) -> [P1, 0, NULL, D15] m1 = graph()->NewNode(m_op, p1, d1); ADD_ADDRESSING_OPERAND_USES(m1); BaseWithIndexAndDisplacement32Matcher match50( graph()->NewNode(a_op, m1, d15)); - CheckBaseWithIndexAndDisplacement(&match50, p1, 0, NULL, d15); + CheckBaseWithIndexAndDisplacement(&match50, p1, 0, nullptr, d15); // (B0 + S0) -> [p1, 0, B0, NULL] s0 = graph()->NewNode(s_op, p1, d0); ADD_ADDRESSING_OPERAND_USES(s0); BaseWithIndexAndDisplacement32Matcher match51(graph()->NewNode(a_op, b0, s0)); - CheckBaseWithIndexAndDisplacement(&match51, p1, 0, b0, NULL); + CheckBaseWithIndexAndDisplacement(&match51, p1, 0, b0, nullptr); // (S0 + B0) -> [p1, 0, B0, NULL] s0 = graph()->NewNode(s_op, p1, d0); ADD_ADDRESSING_OPERAND_USES(s0); BaseWithIndexAndDisplacement32Matcher match52(graph()->NewNode(a_op, s0, b0)); - CheckBaseWithIndexAndDisplacement(&match52, p1, 0, b0, NULL); + CheckBaseWithIndexAndDisplacement(&match52, p1, 0, b0, nullptr); // (D15 + S0) -> [P1, 0, NULL, D15] s0 = graph()->NewNode(s_op, p1, d0); ADD_ADDRESSING_OPERAND_USES(s0); BaseWithIndexAndDisplacement32Matcher match53( graph()->NewNode(a_op, d15, s0)); - CheckBaseWithIndexAndDisplacement(&match53, p1, 0, NULL, d15); + CheckBaseWithIndexAndDisplacement(&match53, p1, 0, nullptr, d15); // (S0 + D15) -> [P1, 0, NULL, D15] s0 = graph()->NewNode(s_op, p1, d0); ADD_ADDRESSING_OPERAND_USES(s0); BaseWithIndexAndDisplacement32Matcher match54( graph()->NewNode(a_op, s0, d15)); - CheckBaseWithIndexAndDisplacement(&match54, p1, 0, NULL, d15); + CheckBaseWithIndexAndDisplacement(&match54, p1, 0, nullptr, d15); // (B0 + M2) -> [p1, 1, B0, NULL] m2 = graph()->NewNode(m_op, p1, d2); ADD_ADDRESSING_OPERAND_USES(m2); BaseWithIndexAndDisplacement32Matcher match55(graph()->NewNode(a_op, b0, m2)); - CheckBaseWithIndexAndDisplacement(&match55, p1, 1, b0, NULL); + CheckBaseWithIndexAndDisplacement(&match55, p1, 1, b0, nullptr); // (M2 + B0) -> [p1, 1, B0, NULL] m2 = graph()->NewNode(m_op, p1, d2); ADD_ADDRESSING_OPERAND_USES(m2); BaseWithIndexAndDisplacement32Matcher match56(graph()->NewNode(a_op, m2, b0)); - CheckBaseWithIndexAndDisplacement(&match56, p1, 1, b0, NULL); + CheckBaseWithIndexAndDisplacement(&match56, p1, 1, b0, nullptr); // (D15 + M2) -> [P1, 1, NULL, D15] m2 = graph()->NewNode(m_op, p1, d2); ADD_ADDRESSING_OPERAND_USES(m2); BaseWithIndexAndDisplacement32Matcher match57( graph()->NewNode(a_op, d15, m2)); - CheckBaseWithIndexAndDisplacement(&match57, p1, 1, NULL, d15); + CheckBaseWithIndexAndDisplacement(&match57, p1, 1, nullptr, d15); // (M2 + D15) -> [P1, 1, NULL, D15] m2 = graph()->NewNode(m_op, p1, d2); ADD_ADDRESSING_OPERAND_USES(m2); BaseWithIndexAndDisplacement32Matcher match58( graph()->NewNode(a_op, m2, d15)); - CheckBaseWithIndexAndDisplacement(&match58, p1, 1, NULL, d15); + CheckBaseWithIndexAndDisplacement(&match58, p1, 1, nullptr, d15); // (B0 + S1) -> [p1, 1, B0, NULL] s1 = graph()->NewNode(s_op, p1, d1); ADD_ADDRESSING_OPERAND_USES(s1); BaseWithIndexAndDisplacement32Matcher match59(graph()->NewNode(a_op, b0, s1)); - CheckBaseWithIndexAndDisplacement(&match59, p1, 1, b0, NULL); + CheckBaseWithIndexAndDisplacement(&match59, p1, 1, b0, nullptr); // (S1 + B0) -> [p1, 1, B0, NULL] s1 = graph()->NewNode(s_op, p1, d1); ADD_ADDRESSING_OPERAND_USES(s1); BaseWithIndexAndDisplacement32Matcher match60(graph()->NewNode(a_op, s1, b0)); - CheckBaseWithIndexAndDisplacement(&match60, p1, 1, b0, NULL); + CheckBaseWithIndexAndDisplacement(&match60, p1, 1, b0, nullptr); // (D15 + S1) -> [P1, 1, NULL, D15] s1 = graph()->NewNode(s_op, p1, d1); ADD_ADDRESSING_OPERAND_USES(s1); BaseWithIndexAndDisplacement32Matcher match61( graph()->NewNode(a_op, d15, s1)); - CheckBaseWithIndexAndDisplacement(&match61, p1, 1, NULL, d15); + CheckBaseWithIndexAndDisplacement(&match61, p1, 1, nullptr, d15); // (S1 + D15) -> [P1, 1, NULL, D15] s1 = graph()->NewNode(s_op, p1, d1); ADD_ADDRESSING_OPERAND_USES(s1); BaseWithIndexAndDisplacement32Matcher match62( graph()->NewNode(a_op, s1, d15)); - CheckBaseWithIndexAndDisplacement(&match62, p1, 1, NULL, d15); + CheckBaseWithIndexAndDisplacement(&match62, p1, 1, nullptr, d15); // (B0 + M4) -> [p1, 2, B0, NULL] m4 = graph()->NewNode(m_op, p1, d4); ADD_ADDRESSING_OPERAND_USES(m4); BaseWithIndexAndDisplacement32Matcher match63(graph()->NewNode(a_op, b0, m4)); - CheckBaseWithIndexAndDisplacement(&match63, p1, 2, b0, NULL); + CheckBaseWithIndexAndDisplacement(&match63, p1, 2, b0, nullptr); // (M4 + B0) -> [p1, 2, B0, NULL] m4 = graph()->NewNode(m_op, p1, d4); ADD_ADDRESSING_OPERAND_USES(m4); BaseWithIndexAndDisplacement32Matcher match64(graph()->NewNode(a_op, m4, b0)); - CheckBaseWithIndexAndDisplacement(&match64, p1, 2, b0, NULL); + CheckBaseWithIndexAndDisplacement(&match64, p1, 2, b0, nullptr); // (D15 + M4) -> [p1, 2, NULL, D15] m4 = graph()->NewNode(m_op, p1, d4); ADD_ADDRESSING_OPERAND_USES(m4); BaseWithIndexAndDisplacement32Matcher match65( graph()->NewNode(a_op, d15, m4)); - CheckBaseWithIndexAndDisplacement(&match65, p1, 2, NULL, d15); + CheckBaseWithIndexAndDisplacement(&match65, p1, 2, nullptr, d15); // (M4 + D15) -> [p1, 2, NULL, D15] m4 = graph()->NewNode(m_op, p1, d4); ADD_ADDRESSING_OPERAND_USES(m4); BaseWithIndexAndDisplacement32Matcher match66( graph()->NewNode(a_op, m4, d15)); - CheckBaseWithIndexAndDisplacement(&match66, p1, 2, NULL, d15); + CheckBaseWithIndexAndDisplacement(&match66, p1, 2, nullptr, d15); // (B0 + S2) -> [p1, 2, B0, NULL] s2 = graph()->NewNode(s_op, p1, d2); ADD_ADDRESSING_OPERAND_USES(s2); BaseWithIndexAndDisplacement32Matcher match67(graph()->NewNode(a_op, b0, s2)); - CheckBaseWithIndexAndDisplacement(&match67, p1, 2, b0, NULL); + CheckBaseWithIndexAndDisplacement(&match67, p1, 2, b0, nullptr); // (S2 + B0) -> [p1, 2, B0, NULL] s2 = graph()->NewNode(s_op, p1, d2); ADD_ADDRESSING_OPERAND_USES(s2); BaseWithIndexAndDisplacement32Matcher match68(graph()->NewNode(a_op, s2, b0)); - CheckBaseWithIndexAndDisplacement(&match68, p1, 2, b0, NULL); + CheckBaseWithIndexAndDisplacement(&match68, p1, 2, b0, nullptr); // (D15 + S2) -> [p1, 2, NULL, D15] s2 = graph()->NewNode(s_op, p1, d2); ADD_ADDRESSING_OPERAND_USES(s2); BaseWithIndexAndDisplacement32Matcher match69( graph()->NewNode(a_op, d15, s2)); - CheckBaseWithIndexAndDisplacement(&match69, p1, 2, NULL, d15); + CheckBaseWithIndexAndDisplacement(&match69, p1, 2, nullptr, d15); // (S2 + D15) -> [p1, 2, NULL, D15] s2 = graph()->NewNode(s_op, p1, d2); ADD_ADDRESSING_OPERAND_USES(s2); BaseWithIndexAndDisplacement32Matcher match70( graph()->NewNode(a_op, s2, d15)); - CheckBaseWithIndexAndDisplacement(&match70, p1, 2, NULL, d15); + CheckBaseWithIndexAndDisplacement(&match70, p1, 2, nullptr, d15); // (B0 + M8) -> [p1, 2, B0, NULL] m8 = graph()->NewNode(m_op, p1, d8); ADD_ADDRESSING_OPERAND_USES(m8); BaseWithIndexAndDisplacement32Matcher match71(graph()->NewNode(a_op, b0, m8)); - CheckBaseWithIndexAndDisplacement(&match71, p1, 3, b0, NULL); + CheckBaseWithIndexAndDisplacement(&match71, p1, 3, b0, nullptr); // (M8 + B0) -> [p1, 2, B0, NULL] m8 = graph()->NewNode(m_op, p1, d8); ADD_ADDRESSING_OPERAND_USES(m8); BaseWithIndexAndDisplacement32Matcher match72(graph()->NewNode(a_op, m8, b0)); - CheckBaseWithIndexAndDisplacement(&match72, p1, 3, b0, NULL); + CheckBaseWithIndexAndDisplacement(&match72, p1, 3, b0, nullptr); // (D15 + M8) -> [p1, 2, NULL, D15] m8 = graph()->NewNode(m_op, p1, d8); ADD_ADDRESSING_OPERAND_USES(m8); BaseWithIndexAndDisplacement32Matcher match73( graph()->NewNode(a_op, d15, m8)); - CheckBaseWithIndexAndDisplacement(&match73, p1, 3, NULL, d15); + CheckBaseWithIndexAndDisplacement(&match73, p1, 3, nullptr, d15); // (M8 + D15) -> [p1, 2, NULL, D15] m8 = graph()->NewNode(m_op, p1, d8); ADD_ADDRESSING_OPERAND_USES(m8); BaseWithIndexAndDisplacement32Matcher match74( graph()->NewNode(a_op, m8, d15)); - CheckBaseWithIndexAndDisplacement(&match74, p1, 3, NULL, d15); + CheckBaseWithIndexAndDisplacement(&match74, p1, 3, nullptr, d15); // (B0 + S3) -> [p1, 2, B0, NULL] s3 = graph()->NewNode(s_op, p1, d3); ADD_ADDRESSING_OPERAND_USES(s3); BaseWithIndexAndDisplacement32Matcher match75(graph()->NewNode(a_op, b0, s3)); - CheckBaseWithIndexAndDisplacement(&match75, p1, 3, b0, NULL); + CheckBaseWithIndexAndDisplacement(&match75, p1, 3, b0, nullptr); // (S3 + B0) -> [p1, 2, B0, NULL] s3 = graph()->NewNode(s_op, p1, d3); ADD_ADDRESSING_OPERAND_USES(s3); BaseWithIndexAndDisplacement32Matcher match76(graph()->NewNode(a_op, s3, b0)); - CheckBaseWithIndexAndDisplacement(&match76, p1, 3, b0, NULL); + CheckBaseWithIndexAndDisplacement(&match76, p1, 3, b0, nullptr); // (D15 + S3) -> [p1, 2, NULL, D15] s3 = graph()->NewNode(s_op, p1, d3); ADD_ADDRESSING_OPERAND_USES(s3); BaseWithIndexAndDisplacement32Matcher match77( graph()->NewNode(a_op, d15, s3)); - CheckBaseWithIndexAndDisplacement(&match77, p1, 3, NULL, d15); + CheckBaseWithIndexAndDisplacement(&match77, p1, 3, nullptr, d15); // (S3 + D15) -> [p1, 2, NULL, D15] s3 = graph()->NewNode(s_op, p1, d3); ADD_ADDRESSING_OPERAND_USES(s3); BaseWithIndexAndDisplacement32Matcher match78( graph()->NewNode(a_op, s3, d15)); - CheckBaseWithIndexAndDisplacement(&match78, p1, 3, NULL, d15); + CheckBaseWithIndexAndDisplacement(&match78, p1, 3, nullptr, d15); // (D15 + S3) + B0 -> [p1, 2, b0, d15] s3 = graph()->NewNode(s_op, p1, d3); @@ -627,7 +627,7 @@ TEST_F(NodeMatcherTest, ScaledWithOffset32Matcher) { ADD_ADDRESSING_OPERAND_USES(temp); BaseWithIndexAndDisplacement32Matcher match81( graph()->NewNode(a_op, temp, d15)); - CheckBaseWithIndexAndDisplacement(&match81, NULL, 0, temp, d15); + CheckBaseWithIndexAndDisplacement(&match81, nullptr, 0, temp, d15); // D15 + (S3 + B0) -> [NULL, 0, (s3 + b0), d15] // Avoid changing simple addressing to complex addressing @@ -636,7 +636,7 @@ TEST_F(NodeMatcherTest, ScaledWithOffset32Matcher) { ADD_ADDRESSING_OPERAND_USES(temp); BaseWithIndexAndDisplacement32Matcher match82( graph()->NewNode(a_op, d15, temp)); - CheckBaseWithIndexAndDisplacement(&match82, NULL, 0, temp, d15); + CheckBaseWithIndexAndDisplacement(&match82, nullptr, 0, temp, d15); // B0 + (D15 + S3) -> [p1, 2, b0, d15] s3 = graph()->NewNode(s_op, p1, d3); @@ -686,7 +686,7 @@ TEST_F(NodeMatcherTest, ScaledWithOffset32Matcher) { ADD_ADDRESSING_OPERAND_USES(temp); BaseWithIndexAndDisplacement32Matcher match88( graph()->NewNode(a_op, temp, d15)); - CheckBaseWithIndexAndDisplacement(&match88, NULL, 0, temp, d15); + CheckBaseWithIndexAndDisplacement(&match88, nullptr, 0, temp, d15); // D15 + (B0 + B1) -> [NULL, 0, (b0 + b1), d15] // Avoid changing simple addressing to complex addressing @@ -694,7 +694,7 @@ TEST_F(NodeMatcherTest, ScaledWithOffset32Matcher) { ADD_ADDRESSING_OPERAND_USES(temp); BaseWithIndexAndDisplacement32Matcher match89( graph()->NewNode(a_op, d15, temp)); - CheckBaseWithIndexAndDisplacement(&match89, NULL, 0, temp, d15); + CheckBaseWithIndexAndDisplacement(&match89, nullptr, 0, temp, d15); // 5 INPUT - with none-addressing operand uses @@ -702,219 +702,219 @@ TEST_F(NodeMatcherTest, ScaledWithOffset32Matcher) { m1 = graph()->NewNode(m_op, p1, d1); ADD_NONE_ADDRESSING_OPERAND_USES(m1); BaseWithIndexAndDisplacement32Matcher match90(graph()->NewNode(a_op, b0, m1)); - CheckBaseWithIndexAndDisplacement(&match90, b0, 0, m1, NULL); + CheckBaseWithIndexAndDisplacement(&match90, b0, 0, m1, nullptr); // (M1 + B0) -> [b0, 0, m1, NULL] m1 = graph()->NewNode(m_op, p1, d1); ADD_NONE_ADDRESSING_OPERAND_USES(m1); BaseWithIndexAndDisplacement32Matcher match91(graph()->NewNode(a_op, m1, b0)); - CheckBaseWithIndexAndDisplacement(&match91, b0, 0, m1, NULL); + CheckBaseWithIndexAndDisplacement(&match91, b0, 0, m1, nullptr); // (D15 + M1) -> [NULL, 0, m1, d15] m1 = graph()->NewNode(m_op, p1, d1); ADD_NONE_ADDRESSING_OPERAND_USES(m1); BaseWithIndexAndDisplacement32Matcher match92( graph()->NewNode(a_op, d15, m1)); - CheckBaseWithIndexAndDisplacement(&match92, NULL, 0, m1, d15); + CheckBaseWithIndexAndDisplacement(&match92, nullptr, 0, m1, d15); // (M1 + D15) -> [NULL, 0, m1, d15] m1 = graph()->NewNode(m_op, p1, d1); ADD_NONE_ADDRESSING_OPERAND_USES(m1); BaseWithIndexAndDisplacement32Matcher match93( graph()->NewNode(a_op, m1, d15)); - CheckBaseWithIndexAndDisplacement(&match93, NULL, 0, m1, d15); + CheckBaseWithIndexAndDisplacement(&match93, nullptr, 0, m1, d15); // (B0 + S0) -> [b0, 0, s0, NULL] s0 = graph()->NewNode(s_op, p1, d0); ADD_NONE_ADDRESSING_OPERAND_USES(s0); BaseWithIndexAndDisplacement32Matcher match94(graph()->NewNode(a_op, b0, s0)); - CheckBaseWithIndexAndDisplacement(&match94, b0, 0, s0, NULL); + CheckBaseWithIndexAndDisplacement(&match94, b0, 0, s0, nullptr); // (S0 + B0) -> [b0, 0, s0, NULL] s0 = graph()->NewNode(s_op, p1, d0); ADD_NONE_ADDRESSING_OPERAND_USES(s0); BaseWithIndexAndDisplacement32Matcher match95(graph()->NewNode(a_op, s0, b0)); - CheckBaseWithIndexAndDisplacement(&match95, b0, 0, s0, NULL); + CheckBaseWithIndexAndDisplacement(&match95, b0, 0, s0, nullptr); // (D15 + S0) -> [NULL, 0, s0, d15] s0 = graph()->NewNode(s_op, p1, d0); ADD_NONE_ADDRESSING_OPERAND_USES(s0); BaseWithIndexAndDisplacement32Matcher match96( graph()->NewNode(a_op, d15, s0)); - CheckBaseWithIndexAndDisplacement(&match96, NULL, 0, s0, d15); + CheckBaseWithIndexAndDisplacement(&match96, nullptr, 0, s0, d15); // (S0 + D15) -> [NULL, 0, s0, d15] s0 = graph()->NewNode(s_op, p1, d0); ADD_NONE_ADDRESSING_OPERAND_USES(s0); BaseWithIndexAndDisplacement32Matcher match97( graph()->NewNode(a_op, s0, d15)); - CheckBaseWithIndexAndDisplacement(&match97, NULL, 0, s0, d15); + CheckBaseWithIndexAndDisplacement(&match97, nullptr, 0, s0, d15); // (B0 + M2) -> [b0, 0, m2, NULL] m2 = graph()->NewNode(m_op, p1, d2); ADD_NONE_ADDRESSING_OPERAND_USES(m2); BaseWithIndexAndDisplacement32Matcher match98(graph()->NewNode(a_op, b0, m2)); - CheckBaseWithIndexAndDisplacement(&match98, b0, 0, m2, NULL); + CheckBaseWithIndexAndDisplacement(&match98, b0, 0, m2, nullptr); // (M2 + B0) -> [b0, 0, m2, NULL] m2 = graph()->NewNode(m_op, p1, d2); ADD_NONE_ADDRESSING_OPERAND_USES(m2); BaseWithIndexAndDisplacement32Matcher match99(graph()->NewNode(a_op, m2, b0)); - CheckBaseWithIndexAndDisplacement(&match99, b0, 0, m2, NULL); + CheckBaseWithIndexAndDisplacement(&match99, b0, 0, m2, nullptr); // (D15 + M2) -> [NULL, 0, m2, d15] m2 = graph()->NewNode(m_op, p1, d2); ADD_NONE_ADDRESSING_OPERAND_USES(m2); BaseWithIndexAndDisplacement32Matcher match100( graph()->NewNode(a_op, d15, m2)); - CheckBaseWithIndexAndDisplacement(&match100, NULL, 0, m2, d15); + CheckBaseWithIndexAndDisplacement(&match100, nullptr, 0, m2, d15); // (M2 + D15) -> [NULL, 0, m2, d15] m2 = graph()->NewNode(m_op, p1, d2); ADD_NONE_ADDRESSING_OPERAND_USES(m2); BaseWithIndexAndDisplacement32Matcher match101( graph()->NewNode(a_op, m2, d15)); - CheckBaseWithIndexAndDisplacement(&match101, NULL, 0, m2, d15); + CheckBaseWithIndexAndDisplacement(&match101, nullptr, 0, m2, d15); // (B0 + S1) -> [b0, 0, s1, NULL] s1 = graph()->NewNode(s_op, p1, d1); ADD_NONE_ADDRESSING_OPERAND_USES(s1); BaseWithIndexAndDisplacement32Matcher match102( graph()->NewNode(a_op, b0, s1)); - CheckBaseWithIndexAndDisplacement(&match102, b0, 0, s1, NULL); + CheckBaseWithIndexAndDisplacement(&match102, b0, 0, s1, nullptr); // (S1 + B0) -> [b0, 0, s1, NULL] s1 = graph()->NewNode(s_op, p1, d1); ADD_NONE_ADDRESSING_OPERAND_USES(s1); BaseWithIndexAndDisplacement32Matcher match103( graph()->NewNode(a_op, s1, b0)); - CheckBaseWithIndexAndDisplacement(&match103, b0, 0, s1, NULL); + CheckBaseWithIndexAndDisplacement(&match103, b0, 0, s1, nullptr); // (D15 + S1) -> [NULL, 0, s1, d15] s1 = graph()->NewNode(s_op, p1, d1); ADD_NONE_ADDRESSING_OPERAND_USES(s1); BaseWithIndexAndDisplacement32Matcher match104( graph()->NewNode(a_op, d15, s1)); - CheckBaseWithIndexAndDisplacement(&match104, NULL, 0, s1, d15); + CheckBaseWithIndexAndDisplacement(&match104, nullptr, 0, s1, d15); // (S1 + D15) -> [NULL, 0, s1, d15] s1 = graph()->NewNode(s_op, p1, d1); ADD_NONE_ADDRESSING_OPERAND_USES(s1); BaseWithIndexAndDisplacement32Matcher match105( graph()->NewNode(a_op, s1, d15)); - CheckBaseWithIndexAndDisplacement(&match105, NULL, 0, s1, d15); + CheckBaseWithIndexAndDisplacement(&match105, nullptr, 0, s1, d15); // (B0 + M4) -> [b0, 0, m4, NULL] m4 = graph()->NewNode(m_op, p1, d4); ADD_NONE_ADDRESSING_OPERAND_USES(m4); BaseWithIndexAndDisplacement32Matcher match106( graph()->NewNode(a_op, b0, m4)); - CheckBaseWithIndexAndDisplacement(&match106, b0, 0, m4, NULL); + CheckBaseWithIndexAndDisplacement(&match106, b0, 0, m4, nullptr); // (M4 + B0) -> [b0, 0, m4, NULL] m4 = graph()->NewNode(m_op, p1, d4); ADD_NONE_ADDRESSING_OPERAND_USES(m4); BaseWithIndexAndDisplacement32Matcher match107( graph()->NewNode(a_op, m4, b0)); - CheckBaseWithIndexAndDisplacement(&match107, b0, 0, m4, NULL); + CheckBaseWithIndexAndDisplacement(&match107, b0, 0, m4, nullptr); // (D15 + M4) -> [NULL, 0, m4, d15] m4 = graph()->NewNode(m_op, p1, d4); ADD_NONE_ADDRESSING_OPERAND_USES(m4); BaseWithIndexAndDisplacement32Matcher match108( graph()->NewNode(a_op, d15, m4)); - CheckBaseWithIndexAndDisplacement(&match108, NULL, 0, m4, d15); + CheckBaseWithIndexAndDisplacement(&match108, nullptr, 0, m4, d15); // (M4 + D15) -> [NULL, 0, m4, d15] m4 = graph()->NewNode(m_op, p1, d4); ADD_NONE_ADDRESSING_OPERAND_USES(m4); BaseWithIndexAndDisplacement32Matcher match109( graph()->NewNode(a_op, m4, d15)); - CheckBaseWithIndexAndDisplacement(&match109, NULL, 0, m4, d15); + CheckBaseWithIndexAndDisplacement(&match109, nullptr, 0, m4, d15); // (B0 + S2) -> [b0, 0, s2, NULL] s2 = graph()->NewNode(s_op, p1, d2); ADD_NONE_ADDRESSING_OPERAND_USES(s2); BaseWithIndexAndDisplacement32Matcher match110( graph()->NewNode(a_op, b0, s2)); - CheckBaseWithIndexAndDisplacement(&match110, b0, 0, s2, NULL); + CheckBaseWithIndexAndDisplacement(&match110, b0, 0, s2, nullptr); // (S2 + B0) -> [b0, 0, s2, NULL] s2 = graph()->NewNode(s_op, p1, d2); ADD_NONE_ADDRESSING_OPERAND_USES(s2); BaseWithIndexAndDisplacement32Matcher match111( graph()->NewNode(a_op, s2, b0)); - CheckBaseWithIndexAndDisplacement(&match111, b0, 0, s2, NULL); + CheckBaseWithIndexAndDisplacement(&match111, b0, 0, s2, nullptr); // (D15 + S2) -> [NULL, 0, s2, d15] s2 = graph()->NewNode(s_op, p1, d2); ADD_NONE_ADDRESSING_OPERAND_USES(s2); BaseWithIndexAndDisplacement32Matcher match112( graph()->NewNode(a_op, d15, s2)); - CheckBaseWithIndexAndDisplacement(&match112, NULL, 0, s2, d15); + CheckBaseWithIndexAndDisplacement(&match112, nullptr, 0, s2, d15); // (S2 + D15) -> [NULL, 0, s2, d15] s2 = graph()->NewNode(s_op, p1, d2); ADD_NONE_ADDRESSING_OPERAND_USES(s2); BaseWithIndexAndDisplacement32Matcher match113( graph()->NewNode(a_op, s2, d15)); - CheckBaseWithIndexAndDisplacement(&match113, NULL, 0, s2, d15); + CheckBaseWithIndexAndDisplacement(&match113, nullptr, 0, s2, d15); // (B0 + M8) -> [b0, 0, m8, NULL] m8 = graph()->NewNode(m_op, p1, d8); ADD_NONE_ADDRESSING_OPERAND_USES(m8); BaseWithIndexAndDisplacement32Matcher match114( graph()->NewNode(a_op, b0, m8)); - CheckBaseWithIndexAndDisplacement(&match114, b0, 0, m8, NULL); + CheckBaseWithIndexAndDisplacement(&match114, b0, 0, m8, nullptr); // (M8 + B0) -> [b0, 0, m8, NULL] m8 = graph()->NewNode(m_op, p1, d8); ADD_NONE_ADDRESSING_OPERAND_USES(m8); BaseWithIndexAndDisplacement32Matcher match115( graph()->NewNode(a_op, m8, b0)); - CheckBaseWithIndexAndDisplacement(&match115, b0, 0, m8, NULL); + CheckBaseWithIndexAndDisplacement(&match115, b0, 0, m8, nullptr); // (D15 + M8) -> [NULL, 0, m8, d15] m8 = graph()->NewNode(m_op, p1, d8); ADD_NONE_ADDRESSING_OPERAND_USES(m8); BaseWithIndexAndDisplacement32Matcher match116( graph()->NewNode(a_op, d15, m8)); - CheckBaseWithIndexAndDisplacement(&match116, NULL, 0, m8, d15); + CheckBaseWithIndexAndDisplacement(&match116, nullptr, 0, m8, d15); // (M8 + D15) -> [NULL, 0, m8, d15] m8 = graph()->NewNode(m_op, p1, d8); ADD_NONE_ADDRESSING_OPERAND_USES(m8); BaseWithIndexAndDisplacement32Matcher match117( graph()->NewNode(a_op, m8, d15)); - CheckBaseWithIndexAndDisplacement(&match117, NULL, 0, m8, d15); + CheckBaseWithIndexAndDisplacement(&match117, nullptr, 0, m8, d15); // (B0 + S3) -> [b0, 0, s3, NULL] s3 = graph()->NewNode(s_op, p1, d3); ADD_NONE_ADDRESSING_OPERAND_USES(s3); BaseWithIndexAndDisplacement32Matcher match118( graph()->NewNode(a_op, b0, s3)); - CheckBaseWithIndexAndDisplacement(&match118, b0, 0, s3, NULL); + CheckBaseWithIndexAndDisplacement(&match118, b0, 0, s3, nullptr); // (S3 + B0) -> [b0, 0, s3, NULL] s3 = graph()->NewNode(s_op, p1, d3); ADD_NONE_ADDRESSING_OPERAND_USES(s3); BaseWithIndexAndDisplacement32Matcher match119( graph()->NewNode(a_op, s3, b0)); - CheckBaseWithIndexAndDisplacement(&match119, b0, 0, s3, NULL); + CheckBaseWithIndexAndDisplacement(&match119, b0, 0, s3, nullptr); // (D15 + S3) -> [NULL, 0, s3, d15] s3 = graph()->NewNode(s_op, p1, d3); ADD_NONE_ADDRESSING_OPERAND_USES(s3); BaseWithIndexAndDisplacement32Matcher match120( graph()->NewNode(a_op, d15, s3)); - CheckBaseWithIndexAndDisplacement(&match120, NULL, 0, s3, d15); + CheckBaseWithIndexAndDisplacement(&match120, nullptr, 0, s3, d15); // (S3 + D15) -> [NULL, 0, s3, d15] s3 = graph()->NewNode(s_op, p1, d3); ADD_NONE_ADDRESSING_OPERAND_USES(s3); BaseWithIndexAndDisplacement32Matcher match121( graph()->NewNode(a_op, s3, d15)); - CheckBaseWithIndexAndDisplacement(&match121, NULL, 0, s3, d15); + CheckBaseWithIndexAndDisplacement(&match121, nullptr, 0, s3, d15); // (D15 + S3) + B0 -> [b0, 0, (D15 + S3), NULL] s3 = graph()->NewNode(s_op, p1, d3); @@ -922,7 +922,7 @@ TEST_F(NodeMatcherTest, ScaledWithOffset32Matcher) { ADD_NONE_ADDRESSING_OPERAND_USES(temp); BaseWithIndexAndDisplacement32Matcher match122( graph()->NewNode(a_op, temp, b0)); - CheckBaseWithIndexAndDisplacement(&match122, b0, 0, temp, NULL); + CheckBaseWithIndexAndDisplacement(&match122, b0, 0, temp, nullptr); // (B0 + D15) + S3 -> [p1, 3, (B0 + D15), NULL] s3 = graph()->NewNode(s_op, p1, d3); @@ -930,7 +930,7 @@ TEST_F(NodeMatcherTest, ScaledWithOffset32Matcher) { ADD_NONE_ADDRESSING_OPERAND_USES(temp); BaseWithIndexAndDisplacement32Matcher match123( graph()->NewNode(a_op, temp, s3)); - CheckBaseWithIndexAndDisplacement(&match123, p1, 3, temp, NULL); + CheckBaseWithIndexAndDisplacement(&match123, p1, 3, temp, nullptr); // (S3 + B0) + D15 -> [NULL, 0, (S3 + B0), d15] s3 = graph()->NewNode(s_op, p1, d3); @@ -938,7 +938,7 @@ TEST_F(NodeMatcherTest, ScaledWithOffset32Matcher) { ADD_NONE_ADDRESSING_OPERAND_USES(temp); BaseWithIndexAndDisplacement32Matcher match124( graph()->NewNode(a_op, temp, d15)); - CheckBaseWithIndexAndDisplacement(&match124, NULL, 0, temp, d15); + CheckBaseWithIndexAndDisplacement(&match124, nullptr, 0, temp, d15); // D15 + (S3 + B0) -> [NULL, 0, (S3 + B0), d15] s3 = graph()->NewNode(s_op, p1, d3); @@ -946,7 +946,7 @@ TEST_F(NodeMatcherTest, ScaledWithOffset32Matcher) { ADD_NONE_ADDRESSING_OPERAND_USES(temp); BaseWithIndexAndDisplacement32Matcher match125( graph()->NewNode(a_op, d15, temp)); - CheckBaseWithIndexAndDisplacement(&match125, NULL, 0, temp, d15); + CheckBaseWithIndexAndDisplacement(&match125, nullptr, 0, temp, d15); // B0 + (D15 + S3) -> [b0, 0, (D15 + S3), NULL] s3 = graph()->NewNode(s_op, p1, d3); @@ -954,7 +954,7 @@ TEST_F(NodeMatcherTest, ScaledWithOffset32Matcher) { ADD_NONE_ADDRESSING_OPERAND_USES(temp); BaseWithIndexAndDisplacement32Matcher match126( graph()->NewNode(a_op, b0, temp)); - CheckBaseWithIndexAndDisplacement(&match126, b0, 0, temp, NULL); + CheckBaseWithIndexAndDisplacement(&match126, b0, 0, temp, nullptr); // S3 + (B0 + D15) -> [p1, 3, (B0 + D15), NULL] s3 = graph()->NewNode(s_op, p1, d3); @@ -962,7 +962,7 @@ TEST_F(NodeMatcherTest, ScaledWithOffset32Matcher) { ADD_NONE_ADDRESSING_OPERAND_USES(temp); BaseWithIndexAndDisplacement32Matcher match127( graph()->NewNode(a_op, s3, temp)); - CheckBaseWithIndexAndDisplacement(&match127, p1, 3, temp, NULL); + CheckBaseWithIndexAndDisplacement(&match127, p1, 3, temp, nullptr); // S3 + (B0 - D15) -> [p1, 3, (B0 - D15), NULL] s3 = graph()->NewNode(s_op, p1, d3); @@ -970,14 +970,14 @@ TEST_F(NodeMatcherTest, ScaledWithOffset32Matcher) { ADD_NONE_ADDRESSING_OPERAND_USES(temp); BaseWithIndexAndDisplacement32Matcher match128( graph()->NewNode(a_op, s3, temp)); - CheckBaseWithIndexAndDisplacement(&match128, p1, 3, temp, NULL); + CheckBaseWithIndexAndDisplacement(&match128, p1, 3, temp, nullptr); // B0 + (B1 - D15) -> [b0, 0, (B1 - D15), NULL] temp = graph()->NewNode(sub_op, b1, d15); ADD_NONE_ADDRESSING_OPERAND_USES(temp); BaseWithIndexAndDisplacement32Matcher match129( graph()->NewNode(a_op, b0, temp)); - CheckBaseWithIndexAndDisplacement(&match129, b0, 0, temp, NULL); + CheckBaseWithIndexAndDisplacement(&match129, b0, 0, temp, nullptr); // (B0 - D15) + S3 -> [p1, 3, temp, NULL] s3 = graph()->NewNode(s_op, p1, d3); @@ -985,21 +985,21 @@ TEST_F(NodeMatcherTest, ScaledWithOffset32Matcher) { ADD_NONE_ADDRESSING_OPERAND_USES(temp); BaseWithIndexAndDisplacement32Matcher match130( graph()->NewNode(a_op, temp, s3)); - CheckBaseWithIndexAndDisplacement(&match130, p1, 3, temp, NULL); + CheckBaseWithIndexAndDisplacement(&match130, p1, 3, temp, nullptr); // (B0 + B1) + D15 -> [NULL, 0, (B0 + B1), d15] temp = graph()->NewNode(a_op, b0, b1); ADD_NONE_ADDRESSING_OPERAND_USES(temp); BaseWithIndexAndDisplacement32Matcher match131( graph()->NewNode(a_op, temp, d15)); - CheckBaseWithIndexAndDisplacement(&match131, NULL, 0, temp, d15); + CheckBaseWithIndexAndDisplacement(&match131, nullptr, 0, temp, d15); // D15 + (B0 + B1) -> [NULL, 0, (B0 + B1), d15] temp = graph()->NewNode(a_op, b0, b1); ADD_NONE_ADDRESSING_OPERAND_USES(temp); BaseWithIndexAndDisplacement32Matcher match132( graph()->NewNode(a_op, d15, temp)); - CheckBaseWithIndexAndDisplacement(&match132, NULL, 0, temp, d15); + CheckBaseWithIndexAndDisplacement(&match132, nullptr, 0, temp, d15); } @@ -1101,195 +1101,195 @@ TEST_F(NodeMatcherTest, ScaledWithOffset64Matcher) { // (B0 + B1) -> [B0, 0, B1, NULL] BaseWithIndexAndDisplacement64Matcher match1(graph()->NewNode(a_op, b0, b1)); - CheckBaseWithIndexAndDisplacement(&match1, b1, 0, b0, NULL); + CheckBaseWithIndexAndDisplacement(&match1, b1, 0, b0, nullptr); // (B0 + D15) -> [NULL, 0, B0, D15] BaseWithIndexAndDisplacement64Matcher match2(graph()->NewNode(a_op, b0, d15)); - CheckBaseWithIndexAndDisplacement(&match2, NULL, 0, b0, d15); + CheckBaseWithIndexAndDisplacement(&match2, nullptr, 0, b0, d15); BaseWithIndexAndDisplacement64Matcher match2_32( graph()->NewNode(a_op, b0, d15_32)); - CheckBaseWithIndexAndDisplacement(&match2_32, NULL, 0, b0, d15_32); + CheckBaseWithIndexAndDisplacement(&match2_32, nullptr, 0, b0, d15_32); // (D15 + B0) -> [NULL, 0, B0, D15] BaseWithIndexAndDisplacement64Matcher match3(graph()->NewNode(a_op, d15, b0)); - CheckBaseWithIndexAndDisplacement(&match3, NULL, 0, b0, d15); + CheckBaseWithIndexAndDisplacement(&match3, nullptr, 0, b0, d15); // (B0 + M1) -> [p1, 0, B0, NULL] BaseWithIndexAndDisplacement64Matcher match4(graph()->NewNode(a_op, b0, m1)); - CheckBaseWithIndexAndDisplacement(&match4, p1, 0, b0, NULL); + CheckBaseWithIndexAndDisplacement(&match4, p1, 0, b0, nullptr); // (M1 + B0) -> [p1, 0, B0, NULL] m1 = graph()->NewNode(m_op, p1, d1); BaseWithIndexAndDisplacement64Matcher match5(graph()->NewNode(a_op, m1, b0)); - CheckBaseWithIndexAndDisplacement(&match5, p1, 0, b0, NULL); + CheckBaseWithIndexAndDisplacement(&match5, p1, 0, b0, nullptr); // (D15 + M1) -> [P1, 0, NULL, D15] m1 = graph()->NewNode(m_op, p1, d1); BaseWithIndexAndDisplacement64Matcher match6(graph()->NewNode(a_op, d15, m1)); - CheckBaseWithIndexAndDisplacement(&match6, p1, 0, NULL, d15); + CheckBaseWithIndexAndDisplacement(&match6, p1, 0, nullptr, d15); // (M1 + D15) -> [P1, 0, NULL, D15] m1 = graph()->NewNode(m_op, p1, d1); BaseWithIndexAndDisplacement64Matcher match7(graph()->NewNode(a_op, m1, d15)); - CheckBaseWithIndexAndDisplacement(&match7, p1, 0, NULL, d15); + CheckBaseWithIndexAndDisplacement(&match7, p1, 0, nullptr, d15); // (B0 + S0) -> [p1, 0, B0, NULL] BaseWithIndexAndDisplacement64Matcher match8(graph()->NewNode(a_op, b0, s0)); - CheckBaseWithIndexAndDisplacement(&match8, p1, 0, b0, NULL); + CheckBaseWithIndexAndDisplacement(&match8, p1, 0, b0, nullptr); // (S0 + B0) -> [p1, 0, B0, NULL] s0 = graph()->NewNode(s_op, p1, d0); BaseWithIndexAndDisplacement64Matcher match9(graph()->NewNode(a_op, s0, b0)); - CheckBaseWithIndexAndDisplacement(&match9, p1, 0, b0, NULL); + CheckBaseWithIndexAndDisplacement(&match9, p1, 0, b0, nullptr); // (D15 + S0) -> [P1, 0, NULL, D15] s0 = graph()->NewNode(s_op, p1, d0); BaseWithIndexAndDisplacement64Matcher match10( graph()->NewNode(a_op, d15, s0)); - CheckBaseWithIndexAndDisplacement(&match10, p1, 0, NULL, d15); + CheckBaseWithIndexAndDisplacement(&match10, p1, 0, nullptr, d15); // (S0 + D15) -> [P1, 0, NULL, D15] s0 = graph()->NewNode(s_op, p1, d0); BaseWithIndexAndDisplacement64Matcher match11( graph()->NewNode(a_op, s0, d15)); - CheckBaseWithIndexAndDisplacement(&match11, p1, 0, NULL, d15); + CheckBaseWithIndexAndDisplacement(&match11, p1, 0, nullptr, d15); // (B0 + M2) -> [p1, 1, B0, NULL] BaseWithIndexAndDisplacement64Matcher match12(graph()->NewNode(a_op, b0, m2)); - CheckBaseWithIndexAndDisplacement(&match12, p1, 1, b0, NULL); + CheckBaseWithIndexAndDisplacement(&match12, p1, 1, b0, nullptr); // (M2 + B0) -> [p1, 1, B0, NULL] m2 = graph()->NewNode(m_op, p1, d2); BaseWithIndexAndDisplacement64Matcher match13(graph()->NewNode(a_op, m2, b0)); - CheckBaseWithIndexAndDisplacement(&match13, p1, 1, b0, NULL); + CheckBaseWithIndexAndDisplacement(&match13, p1, 1, b0, nullptr); // (D15 + M2) -> [P1, 1, NULL, D15] m2 = graph()->NewNode(m_op, p1, d2); BaseWithIndexAndDisplacement64Matcher match14( graph()->NewNode(a_op, d15, m2)); - CheckBaseWithIndexAndDisplacement(&match14, p1, 1, NULL, d15); + CheckBaseWithIndexAndDisplacement(&match14, p1, 1, nullptr, d15); // (M2 + D15) -> [P1, 1, NULL, D15] m2 = graph()->NewNode(m_op, p1, d2); BaseWithIndexAndDisplacement64Matcher match15( graph()->NewNode(a_op, m2, d15)); - CheckBaseWithIndexAndDisplacement(&match15, p1, 1, NULL, d15); + CheckBaseWithIndexAndDisplacement(&match15, p1, 1, nullptr, d15); // (B0 + S1) -> [p1, 1, B0, NULL] BaseWithIndexAndDisplacement64Matcher match16(graph()->NewNode(a_op, b0, s1)); - CheckBaseWithIndexAndDisplacement(&match16, p1, 1, b0, NULL); + CheckBaseWithIndexAndDisplacement(&match16, p1, 1, b0, nullptr); // (S1 + B0) -> [p1, 1, B0, NULL] s1 = graph()->NewNode(s_op, p1, d1); BaseWithIndexAndDisplacement64Matcher match17(graph()->NewNode(a_op, s1, b0)); - CheckBaseWithIndexAndDisplacement(&match17, p1, 1, b0, NULL); + CheckBaseWithIndexAndDisplacement(&match17, p1, 1, b0, nullptr); // (D15 + S1) -> [P1, 1, NULL, D15] s1 = graph()->NewNode(s_op, p1, d1); BaseWithIndexAndDisplacement64Matcher match18( graph()->NewNode(a_op, d15, s1)); - CheckBaseWithIndexAndDisplacement(&match18, p1, 1, NULL, d15); + CheckBaseWithIndexAndDisplacement(&match18, p1, 1, nullptr, d15); // (S1 + D15) -> [P1, 1, NULL, D15] s1 = graph()->NewNode(s_op, p1, d1); BaseWithIndexAndDisplacement64Matcher match19( graph()->NewNode(a_op, s1, d15)); - CheckBaseWithIndexAndDisplacement(&match19, p1, 1, NULL, d15); + CheckBaseWithIndexAndDisplacement(&match19, p1, 1, nullptr, d15); // (B0 + M4) -> [p1, 2, B0, NULL] BaseWithIndexAndDisplacement64Matcher match20(graph()->NewNode(a_op, b0, m4)); - CheckBaseWithIndexAndDisplacement(&match20, p1, 2, b0, NULL); + CheckBaseWithIndexAndDisplacement(&match20, p1, 2, b0, nullptr); // (M4 + B0) -> [p1, 2, B0, NULL] m4 = graph()->NewNode(m_op, p1, d4); BaseWithIndexAndDisplacement64Matcher match21(graph()->NewNode(a_op, m4, b0)); - CheckBaseWithIndexAndDisplacement(&match21, p1, 2, b0, NULL); + CheckBaseWithIndexAndDisplacement(&match21, p1, 2, b0, nullptr); // (D15 + M4) -> [p1, 2, NULL, D15] m4 = graph()->NewNode(m_op, p1, d4); BaseWithIndexAndDisplacement64Matcher match22( graph()->NewNode(a_op, d15, m4)); - CheckBaseWithIndexAndDisplacement(&match22, p1, 2, NULL, d15); + CheckBaseWithIndexAndDisplacement(&match22, p1, 2, nullptr, d15); // (M4 + D15) -> [p1, 2, NULL, D15] m4 = graph()->NewNode(m_op, p1, d4); BaseWithIndexAndDisplacement64Matcher match23( graph()->NewNode(a_op, m4, d15)); - CheckBaseWithIndexAndDisplacement(&match23, p1, 2, NULL, d15); + CheckBaseWithIndexAndDisplacement(&match23, p1, 2, nullptr, d15); // (B0 + S2) -> [p1, 2, B0, NULL] BaseWithIndexAndDisplacement64Matcher match24(graph()->NewNode(a_op, b0, s2)); - CheckBaseWithIndexAndDisplacement(&match24, p1, 2, b0, NULL); + CheckBaseWithIndexAndDisplacement(&match24, p1, 2, b0, nullptr); // (S2 + B0) -> [p1, 2, B0, NULL] s2 = graph()->NewNode(s_op, p1, d2); BaseWithIndexAndDisplacement64Matcher match25(graph()->NewNode(a_op, s2, b0)); - CheckBaseWithIndexAndDisplacement(&match25, p1, 2, b0, NULL); + CheckBaseWithIndexAndDisplacement(&match25, p1, 2, b0, nullptr); // (D15 + S2) -> [p1, 2, NULL, D15] s2 = graph()->NewNode(s_op, p1, d2); BaseWithIndexAndDisplacement64Matcher match26( graph()->NewNode(a_op, d15, s2)); - CheckBaseWithIndexAndDisplacement(&match26, p1, 2, NULL, d15); + CheckBaseWithIndexAndDisplacement(&match26, p1, 2, nullptr, d15); // (S2 + D15) -> [p1, 2, NULL, D15] s2 = graph()->NewNode(s_op, p1, d2); BaseWithIndexAndDisplacement64Matcher match27( graph()->NewNode(a_op, s2, d15)); - CheckBaseWithIndexAndDisplacement(&match27, p1, 2, NULL, d15); + CheckBaseWithIndexAndDisplacement(&match27, p1, 2, nullptr, d15); // (B0 + M8) -> [p1, 2, B0, NULL] BaseWithIndexAndDisplacement64Matcher match28(graph()->NewNode(a_op, b0, m8)); - CheckBaseWithIndexAndDisplacement(&match28, p1, 3, b0, NULL); + CheckBaseWithIndexAndDisplacement(&match28, p1, 3, b0, nullptr); // (M8 + B0) -> [p1, 2, B0, NULL] m8 = graph()->NewNode(m_op, p1, d8); BaseWithIndexAndDisplacement64Matcher match29(graph()->NewNode(a_op, m8, b0)); - CheckBaseWithIndexAndDisplacement(&match29, p1, 3, b0, NULL); + CheckBaseWithIndexAndDisplacement(&match29, p1, 3, b0, nullptr); // (D15 + M8) -> [p1, 2, NULL, D15] m8 = graph()->NewNode(m_op, p1, d8); BaseWithIndexAndDisplacement64Matcher match30( graph()->NewNode(a_op, d15, m8)); - CheckBaseWithIndexAndDisplacement(&match30, p1, 3, NULL, d15); + CheckBaseWithIndexAndDisplacement(&match30, p1, 3, nullptr, d15); // (M8 + D15) -> [p1, 2, NULL, D15] m8 = graph()->NewNode(m_op, p1, d8); BaseWithIndexAndDisplacement64Matcher match31( graph()->NewNode(a_op, m8, d15)); - CheckBaseWithIndexAndDisplacement(&match31, p1, 3, NULL, d15); + CheckBaseWithIndexAndDisplacement(&match31, p1, 3, nullptr, d15); // (B0 + S3) -> [p1, 2, B0, NULL] BaseWithIndexAndDisplacement64Matcher match32(graph()->NewNode(a_op, b0, s3)); - CheckBaseWithIndexAndDisplacement(&match32, p1, 3, b0, NULL); + CheckBaseWithIndexAndDisplacement(&match32, p1, 3, b0, nullptr); // (S3 + B0) -> [p1, 2, B0, NULL] s3 = graph()->NewNode(s_op, p1, d3); BaseWithIndexAndDisplacement64Matcher match33(graph()->NewNode(a_op, s3, b0)); - CheckBaseWithIndexAndDisplacement(&match33, p1, 3, b0, NULL); + CheckBaseWithIndexAndDisplacement(&match33, p1, 3, b0, nullptr); // (D15 + S3) -> [p1, 2, NULL, D15] s3 = graph()->NewNode(s_op, p1, d3); BaseWithIndexAndDisplacement64Matcher match34( graph()->NewNode(a_op, d15, s3)); - CheckBaseWithIndexAndDisplacement(&match34, p1, 3, NULL, d15); + CheckBaseWithIndexAndDisplacement(&match34, p1, 3, nullptr, d15); // (S3 + D15) -> [p1, 2, NULL, D15] s3 = graph()->NewNode(s_op, p1, d3); BaseWithIndexAndDisplacement64Matcher match35( graph()->NewNode(a_op, s3, d15)); - CheckBaseWithIndexAndDisplacement(&match35, p1, 3, NULL, d15); + CheckBaseWithIndexAndDisplacement(&match35, p1, 3, nullptr, d15); // 2 INPUT - NEGATIVE CASES // (M3 + B1) -> [B0, 0, M3, NULL] BaseWithIndexAndDisplacement64Matcher match36(graph()->NewNode(a_op, b1, m3)); - CheckBaseWithIndexAndDisplacement(&match36, m3, 0, b1, NULL); + CheckBaseWithIndexAndDisplacement(&match36, m3, 0, b1, nullptr); // (S4 + B1) -> [B0, 0, S4, NULL] BaseWithIndexAndDisplacement64Matcher match37(graph()->NewNode(a_op, b1, s4)); - CheckBaseWithIndexAndDisplacement(&match37, s4, 0, b1, NULL); + CheckBaseWithIndexAndDisplacement(&match37, s4, 0, b1, nullptr); // 3 INPUT @@ -1405,209 +1405,209 @@ TEST_F(NodeMatcherTest, ScaledWithOffset64Matcher) { m1 = graph()->NewNode(m_op, p1, d1); ADD_ADDRESSING_OPERAND_USES(m1); BaseWithIndexAndDisplacement64Matcher match54(graph()->NewNode(a_op, b0, m1)); - CheckBaseWithIndexAndDisplacement(&match54, p1, 0, b0, NULL); + CheckBaseWithIndexAndDisplacement(&match54, p1, 0, b0, nullptr); // (M1 + B0) -> [p1, 0, B0, NULL] m1 = graph()->NewNode(m_op, p1, d1); ADD_ADDRESSING_OPERAND_USES(m1); BaseWithIndexAndDisplacement64Matcher match55(graph()->NewNode(a_op, m1, b0)); - CheckBaseWithIndexAndDisplacement(&match55, p1, 0, b0, NULL); + CheckBaseWithIndexAndDisplacement(&match55, p1, 0, b0, nullptr); // (D15 + M1) -> [P1, 0, NULL, D15] m1 = graph()->NewNode(m_op, p1, d1); ADD_ADDRESSING_OPERAND_USES(m1); BaseWithIndexAndDisplacement64Matcher match56( graph()->NewNode(a_op, d15, m1)); - CheckBaseWithIndexAndDisplacement(&match56, p1, 0, NULL, d15); + CheckBaseWithIndexAndDisplacement(&match56, p1, 0, nullptr, d15); // (M1 + D15) -> [P1, 0, NULL, D15] m1 = graph()->NewNode(m_op, p1, d1); ADD_ADDRESSING_OPERAND_USES(m1); BaseWithIndexAndDisplacement64Matcher match57( graph()->NewNode(a_op, m1, d15)); - CheckBaseWithIndexAndDisplacement(&match57, p1, 0, NULL, d15); + CheckBaseWithIndexAndDisplacement(&match57, p1, 0, nullptr, d15); // (B0 + S0) -> [p1, 0, B0, NULL] s0 = graph()->NewNode(s_op, p1, d0); ADD_ADDRESSING_OPERAND_USES(s0); BaseWithIndexAndDisplacement64Matcher match58(graph()->NewNode(a_op, b0, s0)); - CheckBaseWithIndexAndDisplacement(&match58, p1, 0, b0, NULL); + CheckBaseWithIndexAndDisplacement(&match58, p1, 0, b0, nullptr); // (S0 + B0) -> [p1, 0, B0, NULL] s0 = graph()->NewNode(s_op, p1, d0); ADD_ADDRESSING_OPERAND_USES(s0); BaseWithIndexAndDisplacement64Matcher match59(graph()->NewNode(a_op, s0, b0)); - CheckBaseWithIndexAndDisplacement(&match59, p1, 0, b0, NULL); + CheckBaseWithIndexAndDisplacement(&match59, p1, 0, b0, nullptr); // (D15 + S0) -> [P1, 0, NULL, D15] s0 = graph()->NewNode(s_op, p1, d0); ADD_ADDRESSING_OPERAND_USES(s0); BaseWithIndexAndDisplacement64Matcher match60( graph()->NewNode(a_op, d15, s0)); - CheckBaseWithIndexAndDisplacement(&match60, p1, 0, NULL, d15); + CheckBaseWithIndexAndDisplacement(&match60, p1, 0, nullptr, d15); // (S0 + D15) -> [P1, 0, NULL, D15] s0 = graph()->NewNode(s_op, p1, d0); ADD_ADDRESSING_OPERAND_USES(s0); BaseWithIndexAndDisplacement64Matcher match61( graph()->NewNode(a_op, s0, d15)); - CheckBaseWithIndexAndDisplacement(&match61, p1, 0, NULL, d15); + CheckBaseWithIndexAndDisplacement(&match61, p1, 0, nullptr, d15); // (B0 + M2) -> [p1, 1, B0, NULL] m2 = graph()->NewNode(m_op, p1, d2); ADD_ADDRESSING_OPERAND_USES(m2); BaseWithIndexAndDisplacement64Matcher match62(graph()->NewNode(a_op, b0, m2)); - CheckBaseWithIndexAndDisplacement(&match62, p1, 1, b0, NULL); + CheckBaseWithIndexAndDisplacement(&match62, p1, 1, b0, nullptr); // (M2 + B0) -> [p1, 1, B0, NULL] m2 = graph()->NewNode(m_op, p1, d2); ADD_ADDRESSING_OPERAND_USES(m2); BaseWithIndexAndDisplacement64Matcher match63(graph()->NewNode(a_op, m2, b0)); - CheckBaseWithIndexAndDisplacement(&match63, p1, 1, b0, NULL); + CheckBaseWithIndexAndDisplacement(&match63, p1, 1, b0, nullptr); // (D15 + M2) -> [P1, 1, NULL, D15] m2 = graph()->NewNode(m_op, p1, d2); ADD_ADDRESSING_OPERAND_USES(m2); BaseWithIndexAndDisplacement64Matcher match64( graph()->NewNode(a_op, d15, m2)); - CheckBaseWithIndexAndDisplacement(&match64, p1, 1, NULL, d15); + CheckBaseWithIndexAndDisplacement(&match64, p1, 1, nullptr, d15); // (M2 + D15) -> [P1, 1, NULL, D15] m2 = graph()->NewNode(m_op, p1, d2); ADD_ADDRESSING_OPERAND_USES(m2); BaseWithIndexAndDisplacement64Matcher match65( graph()->NewNode(a_op, m2, d15)); - CheckBaseWithIndexAndDisplacement(&match65, p1, 1, NULL, d15); + CheckBaseWithIndexAndDisplacement(&match65, p1, 1, nullptr, d15); // (B0 + S1) -> [p1, 1, B0, NULL] s1 = graph()->NewNode(s_op, p1, d1); ADD_ADDRESSING_OPERAND_USES(s1); BaseWithIndexAndDisplacement64Matcher match66(graph()->NewNode(a_op, b0, s1)); - CheckBaseWithIndexAndDisplacement(&match66, p1, 1, b0, NULL); + CheckBaseWithIndexAndDisplacement(&match66, p1, 1, b0, nullptr); // (S1 + B0) -> [p1, 1, B0, NULL] s1 = graph()->NewNode(s_op, p1, d1); ADD_ADDRESSING_OPERAND_USES(s1); BaseWithIndexAndDisplacement64Matcher match67(graph()->NewNode(a_op, s1, b0)); - CheckBaseWithIndexAndDisplacement(&match67, p1, 1, b0, NULL); + CheckBaseWithIndexAndDisplacement(&match67, p1, 1, b0, nullptr); // (D15 + S1) -> [P1, 1, NULL, D15] s1 = graph()->NewNode(s_op, p1, d1); ADD_ADDRESSING_OPERAND_USES(s1); BaseWithIndexAndDisplacement64Matcher match68( graph()->NewNode(a_op, d15, s1)); - CheckBaseWithIndexAndDisplacement(&match68, p1, 1, NULL, d15); + CheckBaseWithIndexAndDisplacement(&match68, p1, 1, nullptr, d15); // (S1 + D15) -> [P1, 1, NULL, D15] s1 = graph()->NewNode(s_op, p1, d1); ADD_ADDRESSING_OPERAND_USES(s1); BaseWithIndexAndDisplacement64Matcher match69( graph()->NewNode(a_op, s1, d15)); - CheckBaseWithIndexAndDisplacement(&match69, p1, 1, NULL, d15); + CheckBaseWithIndexAndDisplacement(&match69, p1, 1, nullptr, d15); // (B0 + M4) -> [p1, 2, B0, NULL] m4 = graph()->NewNode(m_op, p1, d4); ADD_ADDRESSING_OPERAND_USES(m4); BaseWithIndexAndDisplacement64Matcher match70(graph()->NewNode(a_op, b0, m4)); - CheckBaseWithIndexAndDisplacement(&match70, p1, 2, b0, NULL); + CheckBaseWithIndexAndDisplacement(&match70, p1, 2, b0, nullptr); // (M4 + B0) -> [p1, 2, B0, NULL] m4 = graph()->NewNode(m_op, p1, d4); ADD_ADDRESSING_OPERAND_USES(m4); BaseWithIndexAndDisplacement64Matcher match71(graph()->NewNode(a_op, m4, b0)); - CheckBaseWithIndexAndDisplacement(&match71, p1, 2, b0, NULL); + CheckBaseWithIndexAndDisplacement(&match71, p1, 2, b0, nullptr); // (D15 + M4) -> [p1, 2, NULL, D15] m4 = graph()->NewNode(m_op, p1, d4); ADD_ADDRESSING_OPERAND_USES(m4); BaseWithIndexAndDisplacement64Matcher match72( graph()->NewNode(a_op, d15, m4)); - CheckBaseWithIndexAndDisplacement(&match72, p1, 2, NULL, d15); + CheckBaseWithIndexAndDisplacement(&match72, p1, 2, nullptr, d15); // (M4 + D15) -> [p1, 2, NULL, D15] m4 = graph()->NewNode(m_op, p1, d4); ADD_ADDRESSING_OPERAND_USES(m4); BaseWithIndexAndDisplacement64Matcher match73( graph()->NewNode(a_op, m4, d15)); - CheckBaseWithIndexAndDisplacement(&match73, p1, 2, NULL, d15); + CheckBaseWithIndexAndDisplacement(&match73, p1, 2, nullptr, d15); // (B0 + S2) -> [p1, 2, B0, NULL] s2 = graph()->NewNode(s_op, p1, d2); ADD_ADDRESSING_OPERAND_USES(s2); BaseWithIndexAndDisplacement64Matcher match74(graph()->NewNode(a_op, b0, s2)); - CheckBaseWithIndexAndDisplacement(&match74, p1, 2, b0, NULL); + CheckBaseWithIndexAndDisplacement(&match74, p1, 2, b0, nullptr); // (S2 + B0) -> [p1, 2, B0, NULL] s2 = graph()->NewNode(s_op, p1, d2); ADD_ADDRESSING_OPERAND_USES(s2); BaseWithIndexAndDisplacement64Matcher match75(graph()->NewNode(a_op, s2, b0)); - CheckBaseWithIndexAndDisplacement(&match75, p1, 2, b0, NULL); + CheckBaseWithIndexAndDisplacement(&match75, p1, 2, b0, nullptr); // (D15 + S2) -> [p1, 2, NULL, D15] s2 = graph()->NewNode(s_op, p1, d2); ADD_ADDRESSING_OPERAND_USES(s2); BaseWithIndexAndDisplacement64Matcher match76( graph()->NewNode(a_op, d15, s2)); - CheckBaseWithIndexAndDisplacement(&match76, p1, 2, NULL, d15); + CheckBaseWithIndexAndDisplacement(&match76, p1, 2, nullptr, d15); // (S2 + D15) -> [p1, 2, NULL, D15] s2 = graph()->NewNode(s_op, p1, d2); ADD_ADDRESSING_OPERAND_USES(s2); BaseWithIndexAndDisplacement64Matcher match77( graph()->NewNode(a_op, s2, d15)); - CheckBaseWithIndexAndDisplacement(&match77, p1, 2, NULL, d15); + CheckBaseWithIndexAndDisplacement(&match77, p1, 2, nullptr, d15); // (B0 + M8) -> [p1, 2, B0, NULL] m8 = graph()->NewNode(m_op, p1, d8); ADD_ADDRESSING_OPERAND_USES(m8); BaseWithIndexAndDisplacement64Matcher match78(graph()->NewNode(a_op, b0, m8)); - CheckBaseWithIndexAndDisplacement(&match78, p1, 3, b0, NULL); + CheckBaseWithIndexAndDisplacement(&match78, p1, 3, b0, nullptr); // (M8 + B0) -> [p1, 2, B0, NULL] m8 = graph()->NewNode(m_op, p1, d8); ADD_ADDRESSING_OPERAND_USES(m8); BaseWithIndexAndDisplacement64Matcher match79(graph()->NewNode(a_op, m8, b0)); - CheckBaseWithIndexAndDisplacement(&match79, p1, 3, b0, NULL); + CheckBaseWithIndexAndDisplacement(&match79, p1, 3, b0, nullptr); // (D15 + M8) -> [p1, 2, NULL, D15] m8 = graph()->NewNode(m_op, p1, d8); ADD_ADDRESSING_OPERAND_USES(m8); BaseWithIndexAndDisplacement64Matcher match80( graph()->NewNode(a_op, d15, m8)); - CheckBaseWithIndexAndDisplacement(&match80, p1, 3, NULL, d15); + CheckBaseWithIndexAndDisplacement(&match80, p1, 3, nullptr, d15); // (M8 + D15) -> [p1, 2, NULL, D15] m8 = graph()->NewNode(m_op, p1, d8); ADD_ADDRESSING_OPERAND_USES(m8); BaseWithIndexAndDisplacement64Matcher match81( graph()->NewNode(a_op, m8, d15)); - CheckBaseWithIndexAndDisplacement(&match81, p1, 3, NULL, d15); + CheckBaseWithIndexAndDisplacement(&match81, p1, 3, nullptr, d15); // (B0 + S3) -> [p1, 2, B0, NULL] s3 = graph()->NewNode(s_op, p1, d3); ADD_ADDRESSING_OPERAND_USES(s3); BaseWithIndexAndDisplacement64Matcher match82(graph()->NewNode(a_op, b0, s3)); - CheckBaseWithIndexAndDisplacement(&match82, p1, 3, b0, NULL); + CheckBaseWithIndexAndDisplacement(&match82, p1, 3, b0, nullptr); // (S3 + B0) -> [p1, 2, B0, NULL] s3 = graph()->NewNode(s_op, p1, d3); ADD_ADDRESSING_OPERAND_USES(s3); BaseWithIndexAndDisplacement64Matcher match83(graph()->NewNode(a_op, s3, b0)); - CheckBaseWithIndexAndDisplacement(&match83, p1, 3, b0, NULL); + CheckBaseWithIndexAndDisplacement(&match83, p1, 3, b0, nullptr); // (D15 + S3) -> [p1, 2, NULL, D15] s3 = graph()->NewNode(s_op, p1, d3); ADD_ADDRESSING_OPERAND_USES(s3); BaseWithIndexAndDisplacement64Matcher match84( graph()->NewNode(a_op, d15, s3)); - CheckBaseWithIndexAndDisplacement(&match84, p1, 3, NULL, d15); + CheckBaseWithIndexAndDisplacement(&match84, p1, 3, nullptr, d15); // (S3 + D15) -> [p1, 2, NULL, D15] s3 = graph()->NewNode(s_op, p1, d3); ADD_ADDRESSING_OPERAND_USES(s3); BaseWithIndexAndDisplacement64Matcher match85( graph()->NewNode(a_op, s3, d15)); - CheckBaseWithIndexAndDisplacement(&match85, p1, 3, NULL, d15); + CheckBaseWithIndexAndDisplacement(&match85, p1, 3, nullptr, d15); // (D15 + S3) + B0 -> [p1, 2, b0, d15] s3 = graph()->NewNode(s_op, p1, d3); @@ -1632,7 +1632,7 @@ TEST_F(NodeMatcherTest, ScaledWithOffset64Matcher) { ADD_ADDRESSING_OPERAND_USES(temp); BaseWithIndexAndDisplacement64Matcher match88( graph()->NewNode(a_op, temp, d15)); - CheckBaseWithIndexAndDisplacement(&match88, NULL, 0, temp, d15); + CheckBaseWithIndexAndDisplacement(&match88, nullptr, 0, temp, d15); // D15 + (S3 + B0) -> [NULL, 0, (s3 + b0), d15] // Avoid changing simple addressing to complex addressing @@ -1641,7 +1641,7 @@ TEST_F(NodeMatcherTest, ScaledWithOffset64Matcher) { ADD_ADDRESSING_OPERAND_USES(temp); BaseWithIndexAndDisplacement64Matcher match89( graph()->NewNode(a_op, d15, temp)); - CheckBaseWithIndexAndDisplacement(&match89, NULL, 0, temp, d15); + CheckBaseWithIndexAndDisplacement(&match89, nullptr, 0, temp, d15); // B0 + (D15 + S3) -> [p1, 2, b0, d15] s3 = graph()->NewNode(s_op, p1, d3); @@ -1691,7 +1691,7 @@ TEST_F(NodeMatcherTest, ScaledWithOffset64Matcher) { ADD_ADDRESSING_OPERAND_USES(temp); BaseWithIndexAndDisplacement64Matcher match95( graph()->NewNode(a_op, temp, d15)); - CheckBaseWithIndexAndDisplacement(&match95, NULL, 0, temp, d15); + CheckBaseWithIndexAndDisplacement(&match95, nullptr, 0, temp, d15); // D15 + (B0 + B1) -> [NULL, 0, (b0 + b1), d15] // Avoid changing simple addressing to complex addressing @@ -1699,7 +1699,7 @@ TEST_F(NodeMatcherTest, ScaledWithOffset64Matcher) { ADD_ADDRESSING_OPERAND_USES(temp); BaseWithIndexAndDisplacement64Matcher match96( graph()->NewNode(a_op, d15, temp)); - CheckBaseWithIndexAndDisplacement(&match96, NULL, 0, temp, d15); + CheckBaseWithIndexAndDisplacement(&match96, nullptr, 0, temp, d15); // 5 INPUT - with none-addressing operand uses @@ -1707,223 +1707,223 @@ TEST_F(NodeMatcherTest, ScaledWithOffset64Matcher) { m1 = graph()->NewNode(m_op, p1, d1); ADD_NONE_ADDRESSING_OPERAND_USES(m1); BaseWithIndexAndDisplacement64Matcher match97(graph()->NewNode(a_op, b0, m1)); - CheckBaseWithIndexAndDisplacement(&match97, b0, 0, m1, NULL); + CheckBaseWithIndexAndDisplacement(&match97, b0, 0, m1, nullptr); // (M1 + B0) -> [b0, 0, m1, NULL] m1 = graph()->NewNode(m_op, p1, d1); ADD_NONE_ADDRESSING_OPERAND_USES(m1); BaseWithIndexAndDisplacement64Matcher match98(graph()->NewNode(a_op, m1, b0)); - CheckBaseWithIndexAndDisplacement(&match98, b0, 0, m1, NULL); + CheckBaseWithIndexAndDisplacement(&match98, b0, 0, m1, nullptr); // (D15 + M1) -> [NULL, 0, m1, d15] m1 = graph()->NewNode(m_op, p1, d1); ADD_NONE_ADDRESSING_OPERAND_USES(m1); BaseWithIndexAndDisplacement64Matcher match99( graph()->NewNode(a_op, d15, m1)); - CheckBaseWithIndexAndDisplacement(&match99, NULL, 0, m1, d15); + CheckBaseWithIndexAndDisplacement(&match99, nullptr, 0, m1, d15); // (M1 + D15) -> [NULL, 0, m1, d15] m1 = graph()->NewNode(m_op, p1, d1); ADD_NONE_ADDRESSING_OPERAND_USES(m1); BaseWithIndexAndDisplacement64Matcher match100( graph()->NewNode(a_op, m1, d15)); - CheckBaseWithIndexAndDisplacement(&match100, NULL, 0, m1, d15); + CheckBaseWithIndexAndDisplacement(&match100, nullptr, 0, m1, d15); // (B0 + S0) -> [b0, 0, s0, NULL] s0 = graph()->NewNode(s_op, p1, d0); ADD_NONE_ADDRESSING_OPERAND_USES(s0); BaseWithIndexAndDisplacement64Matcher match101( graph()->NewNode(a_op, b0, s0)); - CheckBaseWithIndexAndDisplacement(&match101, b0, 0, s0, NULL); + CheckBaseWithIndexAndDisplacement(&match101, b0, 0, s0, nullptr); // (S0 + B0) -> [b0, 0, s0, NULL] s0 = graph()->NewNode(s_op, p1, d0); ADD_NONE_ADDRESSING_OPERAND_USES(s0); BaseWithIndexAndDisplacement64Matcher match102( graph()->NewNode(a_op, s0, b0)); - CheckBaseWithIndexAndDisplacement(&match102, b0, 0, s0, NULL); + CheckBaseWithIndexAndDisplacement(&match102, b0, 0, s0, nullptr); // (D15 + S0) -> [NULL, 0, s0, d15] s0 = graph()->NewNode(s_op, p1, d0); ADD_NONE_ADDRESSING_OPERAND_USES(s0); BaseWithIndexAndDisplacement64Matcher match103( graph()->NewNode(a_op, d15, s0)); - CheckBaseWithIndexAndDisplacement(&match103, NULL, 0, s0, d15); + CheckBaseWithIndexAndDisplacement(&match103, nullptr, 0, s0, d15); // (S0 + D15) -> [NULL, 0, s0, d15] s0 = graph()->NewNode(s_op, p1, d0); ADD_NONE_ADDRESSING_OPERAND_USES(s0); BaseWithIndexAndDisplacement64Matcher match104( graph()->NewNode(a_op, s0, d15)); - CheckBaseWithIndexAndDisplacement(&match104, NULL, 0, s0, d15); + CheckBaseWithIndexAndDisplacement(&match104, nullptr, 0, s0, d15); // (B0 + M2) -> [b0, 0, m2, NULL] m2 = graph()->NewNode(m_op, p1, d2); ADD_NONE_ADDRESSING_OPERAND_USES(m2); BaseWithIndexAndDisplacement64Matcher match105( graph()->NewNode(a_op, b0, m2)); - CheckBaseWithIndexAndDisplacement(&match105, b0, 0, m2, NULL); + CheckBaseWithIndexAndDisplacement(&match105, b0, 0, m2, nullptr); // (M2 + B0) -> [b0, 0, m2, NULL] m2 = graph()->NewNode(m_op, p1, d2); ADD_NONE_ADDRESSING_OPERAND_USES(m2); BaseWithIndexAndDisplacement64Matcher match106( graph()->NewNode(a_op, m2, b0)); - CheckBaseWithIndexAndDisplacement(&match106, b0, 0, m2, NULL); + CheckBaseWithIndexAndDisplacement(&match106, b0, 0, m2, nullptr); // (D15 + M2) -> [NULL, 0, m2, d15] m2 = graph()->NewNode(m_op, p1, d2); ADD_NONE_ADDRESSING_OPERAND_USES(m2); BaseWithIndexAndDisplacement64Matcher match107( graph()->NewNode(a_op, d15, m2)); - CheckBaseWithIndexAndDisplacement(&match107, NULL, 0, m2, d15); + CheckBaseWithIndexAndDisplacement(&match107, nullptr, 0, m2, d15); // (M2 + D15) -> [NULL, 0, m2, d15] m2 = graph()->NewNode(m_op, p1, d2); ADD_NONE_ADDRESSING_OPERAND_USES(m2); BaseWithIndexAndDisplacement64Matcher match108( graph()->NewNode(a_op, m2, d15)); - CheckBaseWithIndexAndDisplacement(&match108, NULL, 0, m2, d15); + CheckBaseWithIndexAndDisplacement(&match108, nullptr, 0, m2, d15); // (B0 + S1) -> [b0, 0, s1, NULL] s1 = graph()->NewNode(s_op, p1, d1); ADD_NONE_ADDRESSING_OPERAND_USES(s1); BaseWithIndexAndDisplacement64Matcher match109( graph()->NewNode(a_op, b0, s1)); - CheckBaseWithIndexAndDisplacement(&match109, b0, 0, s1, NULL); + CheckBaseWithIndexAndDisplacement(&match109, b0, 0, s1, nullptr); // (S1 + B0) -> [b0, 0, s1, NULL] s1 = graph()->NewNode(s_op, p1, d1); ADD_NONE_ADDRESSING_OPERAND_USES(s1); BaseWithIndexAndDisplacement64Matcher match110( graph()->NewNode(a_op, s1, b0)); - CheckBaseWithIndexAndDisplacement(&match110, b0, 0, s1, NULL); + CheckBaseWithIndexAndDisplacement(&match110, b0, 0, s1, nullptr); // (D15 + S1) -> [NULL, 0, s1, d15] s1 = graph()->NewNode(s_op, p1, d1); ADD_NONE_ADDRESSING_OPERAND_USES(s1); BaseWithIndexAndDisplacement64Matcher match111( graph()->NewNode(a_op, d15, s1)); - CheckBaseWithIndexAndDisplacement(&match111, NULL, 0, s1, d15); + CheckBaseWithIndexAndDisplacement(&match111, nullptr, 0, s1, d15); // (S1 + D15) -> [NULL, 0, s1, d15] s1 = graph()->NewNode(s_op, p1, d1); ADD_NONE_ADDRESSING_OPERAND_USES(s1); BaseWithIndexAndDisplacement64Matcher match112( graph()->NewNode(a_op, s1, d15)); - CheckBaseWithIndexAndDisplacement(&match112, NULL, 0, s1, d15); + CheckBaseWithIndexAndDisplacement(&match112, nullptr, 0, s1, d15); // (B0 + M4) -> [b0, 0, m4, NULL] m4 = graph()->NewNode(m_op, p1, d4); ADD_NONE_ADDRESSING_OPERAND_USES(m4); BaseWithIndexAndDisplacement64Matcher match113( graph()->NewNode(a_op, b0, m4)); - CheckBaseWithIndexAndDisplacement(&match113, b0, 0, m4, NULL); + CheckBaseWithIndexAndDisplacement(&match113, b0, 0, m4, nullptr); // (M4 + B0) -> [b0, 0, m4, NULL] m4 = graph()->NewNode(m_op, p1, d4); ADD_NONE_ADDRESSING_OPERAND_USES(m4); BaseWithIndexAndDisplacement64Matcher match114( graph()->NewNode(a_op, m4, b0)); - CheckBaseWithIndexAndDisplacement(&match114, b0, 0, m4, NULL); + CheckBaseWithIndexAndDisplacement(&match114, b0, 0, m4, nullptr); // (D15 + M4) -> [NULL, 0, m4, d15] m4 = graph()->NewNode(m_op, p1, d4); ADD_NONE_ADDRESSING_OPERAND_USES(m4); BaseWithIndexAndDisplacement64Matcher match115( graph()->NewNode(a_op, d15, m4)); - CheckBaseWithIndexAndDisplacement(&match115, NULL, 0, m4, d15); + CheckBaseWithIndexAndDisplacement(&match115, nullptr, 0, m4, d15); // (M4 + D15) -> [NULL, 0, m4, d15] m4 = graph()->NewNode(m_op, p1, d4); ADD_NONE_ADDRESSING_OPERAND_USES(m4); BaseWithIndexAndDisplacement64Matcher match116( graph()->NewNode(a_op, m4, d15)); - CheckBaseWithIndexAndDisplacement(&match116, NULL, 0, m4, d15); + CheckBaseWithIndexAndDisplacement(&match116, nullptr, 0, m4, d15); // (B0 + S2) -> [b0, 0, s2, NULL] s2 = graph()->NewNode(s_op, p1, d2); ADD_NONE_ADDRESSING_OPERAND_USES(s2); BaseWithIndexAndDisplacement64Matcher match117( graph()->NewNode(a_op, b0, s2)); - CheckBaseWithIndexAndDisplacement(&match117, b0, 0, s2, NULL); + CheckBaseWithIndexAndDisplacement(&match117, b0, 0, s2, nullptr); // (S2 + B0) -> [b0, 0, s2, NULL] s2 = graph()->NewNode(s_op, p1, d2); ADD_NONE_ADDRESSING_OPERAND_USES(s2); BaseWithIndexAndDisplacement64Matcher match118( graph()->NewNode(a_op, s2, b0)); - CheckBaseWithIndexAndDisplacement(&match118, b0, 0, s2, NULL); + CheckBaseWithIndexAndDisplacement(&match118, b0, 0, s2, nullptr); // (D15 + S2) -> [NULL, 0, s2, d15] s2 = graph()->NewNode(s_op, p1, d2); ADD_NONE_ADDRESSING_OPERAND_USES(s2); BaseWithIndexAndDisplacement64Matcher match119( graph()->NewNode(a_op, d15, s2)); - CheckBaseWithIndexAndDisplacement(&match119, NULL, 0, s2, d15); + CheckBaseWithIndexAndDisplacement(&match119, nullptr, 0, s2, d15); // (S2 + D15) -> [NULL, 0, s2, d15] s2 = graph()->NewNode(s_op, p1, d2); ADD_NONE_ADDRESSING_OPERAND_USES(s2); BaseWithIndexAndDisplacement64Matcher match120( graph()->NewNode(a_op, s2, d15)); - CheckBaseWithIndexAndDisplacement(&match120, NULL, 0, s2, d15); + CheckBaseWithIndexAndDisplacement(&match120, nullptr, 0, s2, d15); // (B0 + M8) -> [b0, 0, m8, NULL] m8 = graph()->NewNode(m_op, p1, d8); ADD_NONE_ADDRESSING_OPERAND_USES(m8); BaseWithIndexAndDisplacement64Matcher match121( graph()->NewNode(a_op, b0, m8)); - CheckBaseWithIndexAndDisplacement(&match121, b0, 0, m8, NULL); + CheckBaseWithIndexAndDisplacement(&match121, b0, 0, m8, nullptr); // (M8 + B0) -> [b0, 0, m8, NULL] m8 = graph()->NewNode(m_op, p1, d8); ADD_NONE_ADDRESSING_OPERAND_USES(m8); BaseWithIndexAndDisplacement64Matcher match122( graph()->NewNode(a_op, m8, b0)); - CheckBaseWithIndexAndDisplacement(&match122, b0, 0, m8, NULL); + CheckBaseWithIndexAndDisplacement(&match122, b0, 0, m8, nullptr); // (D15 + M8) -> [NULL, 0, m8, d15] m8 = graph()->NewNode(m_op, p1, d8); ADD_NONE_ADDRESSING_OPERAND_USES(m8); BaseWithIndexAndDisplacement64Matcher match123( graph()->NewNode(a_op, d15, m8)); - CheckBaseWithIndexAndDisplacement(&match123, NULL, 0, m8, d15); + CheckBaseWithIndexAndDisplacement(&match123, nullptr, 0, m8, d15); // (M8 + D15) -> [NULL, 0, m8, d15] m8 = graph()->NewNode(m_op, p1, d8); ADD_NONE_ADDRESSING_OPERAND_USES(m8); BaseWithIndexAndDisplacement64Matcher match124( graph()->NewNode(a_op, m8, d15)); - CheckBaseWithIndexAndDisplacement(&match124, NULL, 0, m8, d15); + CheckBaseWithIndexAndDisplacement(&match124, nullptr, 0, m8, d15); // (B0 + S3) -> [b0, 0, s3, NULL] s3 = graph()->NewNode(s_op, p1, d3); ADD_NONE_ADDRESSING_OPERAND_USES(s3); BaseWithIndexAndDisplacement64Matcher match125( graph()->NewNode(a_op, b0, s3)); - CheckBaseWithIndexAndDisplacement(&match125, b0, 0, s3, NULL); + CheckBaseWithIndexAndDisplacement(&match125, b0, 0, s3, nullptr); // (S3 + B0) -> [b0, 0, s3, NULL] s3 = graph()->NewNode(s_op, p1, d3); ADD_NONE_ADDRESSING_OPERAND_USES(s3); BaseWithIndexAndDisplacement64Matcher match126( graph()->NewNode(a_op, s3, b0)); - CheckBaseWithIndexAndDisplacement(&match126, b0, 0, s3, NULL); + CheckBaseWithIndexAndDisplacement(&match126, b0, 0, s3, nullptr); // (D15 + S3) -> [NULL, 0, s3, d15] s3 = graph()->NewNode(s_op, p1, d3); ADD_NONE_ADDRESSING_OPERAND_USES(s3); BaseWithIndexAndDisplacement64Matcher match127( graph()->NewNode(a_op, d15, s3)); - CheckBaseWithIndexAndDisplacement(&match127, NULL, 0, s3, d15); + CheckBaseWithIndexAndDisplacement(&match127, nullptr, 0, s3, d15); // (S3 + D15) -> [NULL, 0, s3, d15] s3 = graph()->NewNode(s_op, p1, d3); ADD_NONE_ADDRESSING_OPERAND_USES(s3); BaseWithIndexAndDisplacement64Matcher match128( graph()->NewNode(a_op, s3, d15)); - CheckBaseWithIndexAndDisplacement(&match128, NULL, 0, s3, d15); + CheckBaseWithIndexAndDisplacement(&match128, nullptr, 0, s3, d15); // (D15 + S3) + B0 -> [b0, 0, (D15 + S3), NULL] s3 = graph()->NewNode(s_op, p1, d3); @@ -1931,7 +1931,7 @@ TEST_F(NodeMatcherTest, ScaledWithOffset64Matcher) { ADD_NONE_ADDRESSING_OPERAND_USES(temp); BaseWithIndexAndDisplacement64Matcher match129( graph()->NewNode(a_op, temp, b0)); - CheckBaseWithIndexAndDisplacement(&match129, b0, 0, temp, NULL); + CheckBaseWithIndexAndDisplacement(&match129, b0, 0, temp, nullptr); // (B0 + D15) + S3 -> [p1, 3, (B0 + D15), NULL] s3 = graph()->NewNode(s_op, p1, d3); @@ -1939,7 +1939,7 @@ TEST_F(NodeMatcherTest, ScaledWithOffset64Matcher) { ADD_NONE_ADDRESSING_OPERAND_USES(temp); BaseWithIndexAndDisplacement64Matcher match130( graph()->NewNode(a_op, temp, s3)); - CheckBaseWithIndexAndDisplacement(&match130, p1, 3, temp, NULL); + CheckBaseWithIndexAndDisplacement(&match130, p1, 3, temp, nullptr); // (S3 + B0) + D15 -> [NULL, 0, (S3 + B0), d15] s3 = graph()->NewNode(s_op, p1, d3); @@ -1947,7 +1947,7 @@ TEST_F(NodeMatcherTest, ScaledWithOffset64Matcher) { ADD_NONE_ADDRESSING_OPERAND_USES(temp); BaseWithIndexAndDisplacement64Matcher match131( graph()->NewNode(a_op, temp, d15)); - CheckBaseWithIndexAndDisplacement(&match131, NULL, 0, temp, d15); + CheckBaseWithIndexAndDisplacement(&match131, nullptr, 0, temp, d15); // D15 + (S3 + B0) -> [NULL, 0, (S3 + B0), d15] s3 = graph()->NewNode(s_op, p1, d3); @@ -1955,7 +1955,7 @@ TEST_F(NodeMatcherTest, ScaledWithOffset64Matcher) { ADD_NONE_ADDRESSING_OPERAND_USES(temp); BaseWithIndexAndDisplacement64Matcher match132( graph()->NewNode(a_op, d15, temp)); - CheckBaseWithIndexAndDisplacement(&match132, NULL, 0, temp, d15); + CheckBaseWithIndexAndDisplacement(&match132, nullptr, 0, temp, d15); // B0 + (D15 + S3) -> [b0, 0, (D15 + S3), NULL] s3 = graph()->NewNode(s_op, p1, d3); @@ -1963,7 +1963,7 @@ TEST_F(NodeMatcherTest, ScaledWithOffset64Matcher) { ADD_NONE_ADDRESSING_OPERAND_USES(temp); BaseWithIndexAndDisplacement64Matcher match133( graph()->NewNode(a_op, b0, temp)); - CheckBaseWithIndexAndDisplacement(&match133, b0, 0, temp, NULL); + CheckBaseWithIndexAndDisplacement(&match133, b0, 0, temp, nullptr); // S3 + (B0 + D15) -> [p1, 3, (B0 + D15), NULL] s3 = graph()->NewNode(s_op, p1, d3); @@ -1971,7 +1971,7 @@ TEST_F(NodeMatcherTest, ScaledWithOffset64Matcher) { ADD_NONE_ADDRESSING_OPERAND_USES(temp); BaseWithIndexAndDisplacement64Matcher match134( graph()->NewNode(a_op, s3, temp)); - CheckBaseWithIndexAndDisplacement(&match134, p1, 3, temp, NULL); + CheckBaseWithIndexAndDisplacement(&match134, p1, 3, temp, nullptr); // S3 + (B0 - D15) -> [p1, 3, (B0 - D15), NULL] s3 = graph()->NewNode(s_op, p1, d3); @@ -1979,14 +1979,14 @@ TEST_F(NodeMatcherTest, ScaledWithOffset64Matcher) { ADD_NONE_ADDRESSING_OPERAND_USES(temp); BaseWithIndexAndDisplacement64Matcher match135( graph()->NewNode(a_op, s3, temp)); - CheckBaseWithIndexAndDisplacement(&match135, p1, 3, temp, NULL); + CheckBaseWithIndexAndDisplacement(&match135, p1, 3, temp, nullptr); // B0 + (B1 - D15) -> [b0, 0, (B1 - D15), NULL] temp = graph()->NewNode(sub_op, b1, d15); ADD_NONE_ADDRESSING_OPERAND_USES(temp); BaseWithIndexAndDisplacement64Matcher match136( graph()->NewNode(a_op, b0, temp)); - CheckBaseWithIndexAndDisplacement(&match136, b0, 0, temp, NULL); + CheckBaseWithIndexAndDisplacement(&match136, b0, 0, temp, nullptr); // (B0 - D15) + S3 -> [p1, 3, temp, NULL] s3 = graph()->NewNode(s_op, p1, d3); @@ -1994,21 +1994,21 @@ TEST_F(NodeMatcherTest, ScaledWithOffset64Matcher) { ADD_NONE_ADDRESSING_OPERAND_USES(temp); BaseWithIndexAndDisplacement64Matcher match137( graph()->NewNode(a_op, temp, s3)); - CheckBaseWithIndexAndDisplacement(&match137, p1, 3, temp, NULL); + CheckBaseWithIndexAndDisplacement(&match137, p1, 3, temp, nullptr); // (B0 + B1) + D15 -> [NULL, 0, (B0 + B1), d15] temp = graph()->NewNode(a_op, b0, b1); ADD_NONE_ADDRESSING_OPERAND_USES(temp); BaseWithIndexAndDisplacement64Matcher match138( graph()->NewNode(a_op, temp, d15)); - CheckBaseWithIndexAndDisplacement(&match138, NULL, 0, temp, d15); + CheckBaseWithIndexAndDisplacement(&match138, nullptr, 0, temp, d15); // D15 + (B0 + B1) -> [NULL, 0, (B0 + B1), d15] temp = graph()->NewNode(a_op, b0, b1); ADD_NONE_ADDRESSING_OPERAND_USES(temp); BaseWithIndexAndDisplacement64Matcher match139( graph()->NewNode(a_op, d15, temp)); - CheckBaseWithIndexAndDisplacement(&match139, NULL, 0, temp, d15); + CheckBaseWithIndexAndDisplacement(&match139, nullptr, 0, temp, d15); } TEST_F(NodeMatcherTest, BranchMatcher_match) { diff --git a/deps/v8/test/unittests/compiler/node-test-utils.cc b/deps/v8/test/unittests/compiler/node-test-utils.cc index 56f18931b4..0b3d8786f8 100644 --- a/deps/v8/test/unittests/compiler/node-test-utils.cc +++ b/deps/v8/test/unittests/compiler/node-test-utils.cc @@ -57,7 +57,7 @@ class TestNodeMatcher : public MatcherInterface<Node*> { bool MatchAndExplain(Node* node, MatchResultListener* listener) const override { - if (node == NULL) { + if (node == nullptr) { *listener << "which is NULL"; return false; } @@ -1401,6 +1401,43 @@ class IsBinopMatcher final : public TestNodeMatcher { const Matcher<Node*> rhs_matcher_; }; +class IsStringConcatMatcher final : public TestNodeMatcher { + public: + IsStringConcatMatcher(const Matcher<Node*>& length_matcher, + const Matcher<Node*>& lhs_matcher, + const Matcher<Node*>& rhs_matcher) + : TestNodeMatcher(IrOpcode::kStringConcat), + length_matcher_(length_matcher), + lhs_matcher_(lhs_matcher), + rhs_matcher_(rhs_matcher) {} + + void DescribeTo(std::ostream* os) const final { + TestNodeMatcher::DescribeTo(os); + *os << " whose length ("; + length_matcher_.DescribeTo(os); + *os << ") and lhs ("; + lhs_matcher_.DescribeTo(os); + *os << ") and rhs ("; + rhs_matcher_.DescribeTo(os); + *os << ")"; + } + + bool MatchAndExplain(Node* node, MatchResultListener* listener) const final { + return (TestNodeMatcher::MatchAndExplain(node, listener) && + PrintMatchAndExplain(NodeProperties::GetValueInput(node, 0), + "length", length_matcher_, listener) && + PrintMatchAndExplain(NodeProperties::GetValueInput(node, 1), "lhs", + lhs_matcher_, listener) && + PrintMatchAndExplain(NodeProperties::GetValueInput(node, 2), "rhs", + rhs_matcher_, listener)); + } + + private: + const Matcher<Node*> length_matcher_; + const Matcher<Node*> lhs_matcher_; + const Matcher<Node*> rhs_matcher_; +}; + class IsUnopMatcher final : public TestNodeMatcher { public: IsUnopMatcher(IrOpcode::Value opcode, const Matcher<Node*>& input_matcher) @@ -1910,9 +1947,19 @@ Matcher<Node*> IsTailCall( IrOpcode::k##opcode, hint_matcher, lhs_matcher, rhs_matcher, \ effect_matcher, control_matcher)); \ } -SPECULATIVE_BINOPS(DEFINE_SPECULATIVE_BINOP_MATCHER); +SIMPLIFIED_SPECULATIVE_NUMBER_BINOP_LIST(DEFINE_SPECULATIVE_BINOP_MATCHER); +DEFINE_SPECULATIVE_BINOP_MATCHER(SpeculativeNumberEqual) +DEFINE_SPECULATIVE_BINOP_MATCHER(SpeculativeNumberLessThan) +DEFINE_SPECULATIVE_BINOP_MATCHER(SpeculativeNumberLessThanOrEqual) #undef DEFINE_SPECULATIVE_BINOP_MATCHER +Matcher<Node*> IsStringConcat(const Matcher<Node*>& length_matcher, + const Matcher<Node*>& lhs_matcher, + const Matcher<Node*>& rhs_matcher) { + return MakeMatcher( + new IsStringConcatMatcher(length_matcher, lhs_matcher, rhs_matcher)); +} + Matcher<Node*> IsAllocate(const Matcher<Node*>& size_matcher, const Matcher<Node*>& effect_matcher, const Matcher<Node*>& control_matcher) { diff --git a/deps/v8/test/unittests/compiler/node-test-utils.h b/deps/v8/test/unittests/compiler/node-test-utils.h index 30ac330f7f..4e9c32e6d6 100644 --- a/deps/v8/test/unittests/compiler/node-test-utils.h +++ b/deps/v8/test/unittests/compiler/node-test-utils.h @@ -7,6 +7,7 @@ #include "src/compiler/common-operator.h" #include "src/compiler/machine-operator.h" +#include "src/compiler/opcodes.h" #include "src/compiler/simplified-operator.h" #include "src/machine-type.h" #include "testing/gmock/include/gmock/gmock.h" @@ -35,16 +36,6 @@ class Node; using ::testing::Matcher; -#define SPECULATIVE_BINOPS(V) \ - V(SpeculativeNumberAdd) \ - V(SpeculativeNumberSubtract) \ - V(SpeculativeNumberShiftLeft) \ - V(SpeculativeNumberShiftRight) \ - V(SpeculativeNumberShiftRightLogical) \ - V(SpeculativeNumberBitwiseAnd) \ - V(SpeculativeNumberBitwiseOr) \ - V(SpeculativeNumberBitwiseXor) - Matcher<Node*> IsDead(); Matcher<Node*> IsEnd(const Matcher<Node*>& control0_matcher); Matcher<Node*> IsEnd(const Matcher<Node*>& control0_matcher, @@ -221,7 +212,10 @@ Matcher<Node*> IsNumberAdd(const Matcher<Node*>& lhs_matcher, const Matcher<Node*>& rhs_matcher, \ const Matcher<Node*>& effect_matcher, \ const Matcher<Node*>& control_matcher); -SPECULATIVE_BINOPS(DECLARE_SPECULATIVE_BINOP_MATCHER); +SIMPLIFIED_SPECULATIVE_NUMBER_BINOP_LIST(DECLARE_SPECULATIVE_BINOP_MATCHER); +DECLARE_SPECULATIVE_BINOP_MATCHER(SpeculativeNumberEqual) +DECLARE_SPECULATIVE_BINOP_MATCHER(SpeculativeNumberLessThan) +DECLARE_SPECULATIVE_BINOP_MATCHER(SpeculativeNumberLessThanOrEqual) #undef DECLARE_SPECULATIVE_BINOP_MATCHER Matcher<Node*> IsNumberSubtract(const Matcher<Node*>& lhs_matcher, @@ -272,6 +266,9 @@ Matcher<Node*> IsNumberSqrt(const Matcher<Node*>& value_matcher); Matcher<Node*> IsNumberTan(const Matcher<Node*>& value_matcher); Matcher<Node*> IsNumberTanh(const Matcher<Node*>& value_matcher); Matcher<Node*> IsNumberTrunc(const Matcher<Node*>& value_matcher); +Matcher<Node*> IsStringConcat(const Matcher<Node*>& length_matcher, + const Matcher<Node*>& lhs_matcher, + const Matcher<Node*>& rhs_matcher); Matcher<Node*> IsStringFromSingleCharCode(const Matcher<Node*>& value_matcher); Matcher<Node*> IsStringLength(const Matcher<Node*>& value_matcher); Matcher<Node*> IsAllocate(const Matcher<Node*>& size_matcher, diff --git a/deps/v8/test/unittests/compiler/redundancy-elimination-unittest.cc b/deps/v8/test/unittests/compiler/redundancy-elimination-unittest.cc new file mode 100644 index 0000000000..f3ecd228a5 --- /dev/null +++ b/deps/v8/test/unittests/compiler/redundancy-elimination-unittest.cc @@ -0,0 +1,1170 @@ +// Copyright 2018 the V8 project authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "src/compiler/redundancy-elimination.h" +#include "src/compiler/common-operator.h" +#include "test/unittests/compiler/graph-reducer-unittest.h" +#include "test/unittests/compiler/graph-unittest.h" +#include "test/unittests/compiler/node-test-utils.h" +#include "testing/gmock-support.h" + +using testing::_; +using testing::NiceMock; + +namespace v8 { +namespace internal { +namespace compiler { +namespace redundancy_elimination_unittest { + +class RedundancyEliminationTest : public GraphTest { + public: + explicit RedundancyEliminationTest(int num_parameters = 4) + : GraphTest(num_parameters), + reducer_(&editor_, zone()), + simplified_(zone()) { + // Initialize the {reducer_} state for the Start node. + reducer_.Reduce(graph()->start()); + + // Create a feedback vector with two CALL_IC slots. + FeedbackVectorSpec spec(zone()); + FeedbackSlot slot1 = spec.AddCallICSlot(); + FeedbackSlot slot2 = spec.AddCallICSlot(); + Handle<FeedbackMetadata> metadata = FeedbackMetadata::New(isolate(), &spec); + Handle<SharedFunctionInfo> shared = + isolate()->factory()->NewSharedFunctionInfoForBuiltin( + isolate()->factory()->empty_string(), Builtins::kIllegal); + shared->set_raw_outer_scope_info_or_feedback_metadata(*metadata); + Handle<FeedbackVector> feedback_vector = + FeedbackVector::New(isolate(), shared); + vector_slot_pairs_.push_back(VectorSlotPair()); + vector_slot_pairs_.push_back( + VectorSlotPair(feedback_vector, slot1, UNINITIALIZED)); + vector_slot_pairs_.push_back( + VectorSlotPair(feedback_vector, slot2, UNINITIALIZED)); + } + ~RedundancyEliminationTest() override = default; + + protected: + Reduction Reduce(Node* node) { return reducer_.Reduce(node); } + + std::vector<VectorSlotPair> const& vector_slot_pairs() const { + return vector_slot_pairs_; + } + SimplifiedOperatorBuilder* simplified() { return &simplified_; } + + private: + NiceMock<MockAdvancedReducerEditor> editor_; + std::vector<VectorSlotPair> vector_slot_pairs_; + VectorSlotPair feedback2_; + RedundancyElimination reducer_; + SimplifiedOperatorBuilder simplified_; +}; + +namespace { + +const CheckForMinusZeroMode kCheckForMinusZeroModes[] = { + CheckForMinusZeroMode::kCheckForMinusZero, + CheckForMinusZeroMode::kDontCheckForMinusZero, +}; + +const CheckTaggedInputMode kCheckTaggedInputModes[] = { + CheckTaggedInputMode::kNumber, CheckTaggedInputMode::kNumberOrOddball}; + +const NumberOperationHint kNumberOperationHints[] = { + NumberOperationHint::kSignedSmall, + NumberOperationHint::kSignedSmallInputs, + NumberOperationHint::kSigned32, + NumberOperationHint::kNumber, + NumberOperationHint::kNumberOrOddball, +}; + +} // namespace + +// ----------------------------------------------------------------------------- +// CheckBounds + +TEST_F(RedundancyEliminationTest, CheckBounds) { + TRACED_FOREACH(VectorSlotPair, feedback1, vector_slot_pairs()) { + TRACED_FOREACH(VectorSlotPair, feedback2, vector_slot_pairs()) { + Node* index = Parameter(0); + Node* length = Parameter(1); + Node* effect = graph()->start(); + Node* control = graph()->start(); + + Node* check1 = effect = graph()->NewNode( + simplified()->CheckBounds(feedback1), index, length, effect, control); + Reduction r1 = Reduce(check1); + ASSERT_TRUE(r1.Changed()); + EXPECT_EQ(r1.replacement(), check1); + + Node* check2 = effect = graph()->NewNode( + simplified()->CheckBounds(feedback2), index, length, effect, control); + Reduction r2 = Reduce(check2); + ASSERT_TRUE(r2.Changed()); + EXPECT_EQ(r2.replacement(), check1); + } + } +} + +// ----------------------------------------------------------------------------- +// CheckNumber + +TEST_F(RedundancyEliminationTest, CheckNumberSubsumedByCheckSmi) { + TRACED_FOREACH(VectorSlotPair, feedback1, vector_slot_pairs()) { + TRACED_FOREACH(VectorSlotPair, feedback2, vector_slot_pairs()) { + Node* value = Parameter(0); + Node* effect = graph()->start(); + Node* control = graph()->start(); + + Node* check1 = effect = graph()->NewNode( + simplified()->CheckSmi(feedback1), value, effect, control); + Reduction r1 = Reduce(check1); + ASSERT_TRUE(r1.Changed()); + EXPECT_EQ(r1.replacement(), check1); + + Node* check2 = effect = graph()->NewNode( + simplified()->CheckNumber(feedback2), value, effect, control); + Reduction r2 = Reduce(check2); + ASSERT_TRUE(r2.Changed()); + EXPECT_EQ(r2.replacement(), check1); + } + } +} + +// ----------------------------------------------------------------------------- +// CheckString + +TEST_F(RedundancyEliminationTest, + CheckStringSubsumedByCheckInternalizedString) { + TRACED_FOREACH(VectorSlotPair, feedback, vector_slot_pairs()) { + Node* value = Parameter(0); + Node* effect = graph()->start(); + Node* control = graph()->start(); + + Node* check1 = effect = graph()->NewNode( + simplified()->CheckInternalizedString(), value, effect, control); + Reduction r1 = Reduce(check1); + ASSERT_TRUE(r1.Changed()); + EXPECT_EQ(r1.replacement(), check1); + + Node* check2 = effect = graph()->NewNode( + simplified()->CheckString(feedback), value, effect, control); + Reduction r2 = Reduce(check2); + ASSERT_TRUE(r2.Changed()); + EXPECT_EQ(r2.replacement(), check1); + } +} + +// ----------------------------------------------------------------------------- +// CheckSymbol + +TEST_F(RedundancyEliminationTest, CheckSymbol) { + Node* value = Parameter(0); + Node* effect = graph()->start(); + Node* control = graph()->start(); + + Node* check1 = effect = + graph()->NewNode(simplified()->CheckSymbol(), value, effect, control); + Reduction r1 = Reduce(check1); + ASSERT_TRUE(r1.Changed()); + EXPECT_EQ(r1.replacement(), check1); + + Node* check2 = effect = + graph()->NewNode(simplified()->CheckSymbol(), value, effect, control); + Reduction r2 = Reduce(check2); + ASSERT_TRUE(r2.Changed()); + EXPECT_EQ(r2.replacement(), check1); +} + +// ----------------------------------------------------------------------------- +// CheckedFloat64ToInt32 + +TEST_F(RedundancyEliminationTest, CheckedFloat64ToInt32) { + TRACED_FOREACH(VectorSlotPair, feedback1, vector_slot_pairs()) { + TRACED_FOREACH(VectorSlotPair, feedback2, vector_slot_pairs()) { + TRACED_FOREACH(CheckForMinusZeroMode, mode, kCheckForMinusZeroModes) { + Node* value = Parameter(0); + Node* effect = graph()->start(); + Node* control = graph()->start(); + + Node* check1 = effect = graph()->NewNode( + simplified()->CheckedFloat64ToInt32(mode, feedback1), value, effect, + control); + Reduction r1 = Reduce(check1); + ASSERT_TRUE(r1.Changed()); + EXPECT_EQ(r1.replacement(), check1); + + Node* check2 = effect = graph()->NewNode( + simplified()->CheckedFloat64ToInt32(mode, feedback2), value, effect, + control); + Reduction r2 = Reduce(check2); + ASSERT_TRUE(r2.Changed()); + EXPECT_EQ(r2.replacement(), check1); + } + } + } +} + +// ----------------------------------------------------------------------------- +// CheckedInt32ToTaggedSigned + +TEST_F(RedundancyEliminationTest, CheckedInt32ToTaggedSigned) { + TRACED_FOREACH(VectorSlotPair, feedback1, vector_slot_pairs()) { + TRACED_FOREACH(VectorSlotPair, feedback2, vector_slot_pairs()) { + Node* value = Parameter(0); + Node* effect = graph()->start(); + Node* control = graph()->start(); + + Node* check1 = effect = + graph()->NewNode(simplified()->CheckedInt32ToTaggedSigned(feedback1), + value, effect, control); + Reduction r1 = Reduce(check1); + ASSERT_TRUE(r1.Changed()); + EXPECT_EQ(r1.replacement(), check1); + + Node* check2 = effect = + graph()->NewNode(simplified()->CheckedInt32ToTaggedSigned(feedback2), + value, effect, control); + Reduction r2 = Reduce(check2); + ASSERT_TRUE(r2.Changed()); + EXPECT_EQ(r2.replacement(), check1); + } + } +} + +// ----------------------------------------------------------------------------- +// CheckedInt64ToInt32 + +TEST_F(RedundancyEliminationTest, CheckedInt64ToInt32) { + TRACED_FOREACH(VectorSlotPair, feedback1, vector_slot_pairs()) { + TRACED_FOREACH(VectorSlotPair, feedback2, vector_slot_pairs()) { + Node* value = Parameter(0); + Node* effect = graph()->start(); + Node* control = graph()->start(); + + Node* check1 = effect = graph()->NewNode( + simplified()->CheckedInt64ToInt32(feedback1), value, effect, control); + Reduction r1 = Reduce(check1); + ASSERT_TRUE(r1.Changed()); + EXPECT_EQ(r1.replacement(), check1); + + Node* check2 = effect = graph()->NewNode( + simplified()->CheckedInt64ToInt32(feedback2), value, effect, control); + Reduction r2 = Reduce(check2); + ASSERT_TRUE(r2.Changed()); + EXPECT_EQ(r2.replacement(), check1); + } + } +} + +// ----------------------------------------------------------------------------- +// CheckedInt64ToTaggedSigned + +TEST_F(RedundancyEliminationTest, CheckedInt64ToTaggedSigned) { + TRACED_FOREACH(VectorSlotPair, feedback1, vector_slot_pairs()) { + TRACED_FOREACH(VectorSlotPair, feedback2, vector_slot_pairs()) { + Node* value = Parameter(0); + Node* effect = graph()->start(); + Node* control = graph()->start(); + + Node* check1 = effect = + graph()->NewNode(simplified()->CheckedInt64ToTaggedSigned(feedback1), + value, effect, control); + Reduction r1 = Reduce(check1); + ASSERT_TRUE(r1.Changed()); + EXPECT_EQ(r1.replacement(), check1); + + Node* check2 = effect = + graph()->NewNode(simplified()->CheckedInt64ToTaggedSigned(feedback2), + value, effect, control); + Reduction r2 = Reduce(check2); + ASSERT_TRUE(r2.Changed()); + EXPECT_EQ(r2.replacement(), check1); + } + } +} + +// ----------------------------------------------------------------------------- +// CheckedTaggedSignedToInt32 + +TEST_F(RedundancyEliminationTest, CheckedTaggedSignedToInt32) { + TRACED_FOREACH(VectorSlotPair, feedback1, vector_slot_pairs()) { + TRACED_FOREACH(VectorSlotPair, feedback2, vector_slot_pairs()) { + Node* value = Parameter(0); + Node* effect = graph()->start(); + Node* control = graph()->start(); + + Node* check1 = effect = + graph()->NewNode(simplified()->CheckedTaggedSignedToInt32(feedback1), + value, effect, control); + Reduction r1 = Reduce(check1); + ASSERT_TRUE(r1.Changed()); + EXPECT_EQ(r1.replacement(), check1); + + Node* check2 = effect = + graph()->NewNode(simplified()->CheckedTaggedSignedToInt32(feedback2), + value, effect, control); + Reduction r2 = Reduce(check2); + ASSERT_TRUE(r2.Changed()); + EXPECT_EQ(r2.replacement(), check1); + } + } +} + +// ----------------------------------------------------------------------------- +// CheckedTaggedToFloat64 + +TEST_F(RedundancyEliminationTest, CheckedTaggedToFloat64) { + TRACED_FOREACH(VectorSlotPair, feedback1, vector_slot_pairs()) { + TRACED_FOREACH(VectorSlotPair, feedback2, vector_slot_pairs()) { + TRACED_FOREACH(CheckTaggedInputMode, mode, kCheckTaggedInputModes) { + Node* value = Parameter(0); + Node* effect = graph()->start(); + Node* control = graph()->start(); + + Node* check1 = effect = graph()->NewNode( + simplified()->CheckedTaggedToFloat64(mode, feedback1), value, + effect, control); + Reduction r1 = Reduce(check1); + ASSERT_TRUE(r1.Changed()); + EXPECT_EQ(r1.replacement(), check1); + + Node* check2 = effect = graph()->NewNode( + simplified()->CheckedTaggedToFloat64(mode, feedback2), value, + effect, control); + Reduction r2 = Reduce(check2); + ASSERT_TRUE(r2.Changed()); + EXPECT_EQ(r2.replacement(), check1); + } + } + } +} + +TEST_F(RedundancyEliminationTest, + CheckedTaggedToFloat64SubsubmedByCheckedTaggedToFloat64) { + TRACED_FOREACH(VectorSlotPair, feedback1, vector_slot_pairs()) { + TRACED_FOREACH(VectorSlotPair, feedback2, vector_slot_pairs()) { + Node* value = Parameter(0); + Node* effect = graph()->start(); + Node* control = graph()->start(); + + // If the check passed for CheckTaggedInputMode::kNumber, it'll + // also pass later for CheckTaggedInputMode::kNumberOrOddball. + Node* check1 = effect = + graph()->NewNode(simplified()->CheckedTaggedToFloat64( + CheckTaggedInputMode::kNumber, feedback1), + value, effect, control); + Reduction r1 = Reduce(check1); + ASSERT_TRUE(r1.Changed()); + EXPECT_EQ(r1.replacement(), check1); + + Node* check2 = effect = graph()->NewNode( + simplified()->CheckedTaggedToFloat64( + CheckTaggedInputMode::kNumberOrOddball, feedback2), + value, effect, control); + Reduction r2 = Reduce(check2); + ASSERT_TRUE(r2.Changed()); + EXPECT_EQ(r2.replacement(), check1); + } + } +} + +// ----------------------------------------------------------------------------- +// CheckedTaggedToInt32 + +TEST_F(RedundancyEliminationTest, CheckedTaggedToInt32) { + TRACED_FOREACH(VectorSlotPair, feedback1, vector_slot_pairs()) { + TRACED_FOREACH(VectorSlotPair, feedback2, vector_slot_pairs()) { + TRACED_FOREACH(CheckForMinusZeroMode, mode, kCheckForMinusZeroModes) { + Node* value = Parameter(0); + Node* effect = graph()->start(); + Node* control = graph()->start(); + + Node* check1 = effect = graph()->NewNode( + simplified()->CheckedTaggedToInt32(mode, feedback1), value, effect, + control); + Reduction r1 = Reduce(check1); + ASSERT_TRUE(r1.Changed()); + EXPECT_EQ(r1.replacement(), check1); + + Node* check2 = effect = graph()->NewNode( + simplified()->CheckedTaggedToInt32(mode, feedback2), value, effect, + control); + Reduction r2 = Reduce(check2); + ASSERT_TRUE(r2.Changed()); + EXPECT_EQ(r2.replacement(), check1); + } + } + } +} + +TEST_F(RedundancyEliminationTest, + CheckedTaggedToInt32SubsumedByCheckedTaggedSignedToInt32) { + TRACED_FOREACH(VectorSlotPair, feedback1, vector_slot_pairs()) { + TRACED_FOREACH(VectorSlotPair, feedback2, vector_slot_pairs()) { + TRACED_FOREACH(CheckForMinusZeroMode, mode, kCheckForMinusZeroModes) { + Node* value = Parameter(0); + Node* effect = graph()->start(); + Node* control = graph()->start(); + + Node* check1 = effect = graph()->NewNode( + simplified()->CheckedTaggedSignedToInt32(feedback1), value, effect, + control); + Reduction r1 = Reduce(check1); + ASSERT_TRUE(r1.Changed()); + EXPECT_EQ(r1.replacement(), check1); + + Node* check2 = effect = graph()->NewNode( + simplified()->CheckedTaggedToInt32(mode, feedback2), value, effect, + control); + Reduction r2 = Reduce(check2); + ASSERT_TRUE(r2.Changed()); + EXPECT_EQ(r2.replacement(), check1); + } + } + } +} + +// ----------------------------------------------------------------------------- +// CheckedTaggedToTaggedPointer + +TEST_F(RedundancyEliminationTest, CheckedTaggedToTaggedPointer) { + TRACED_FOREACH(VectorSlotPair, feedback1, vector_slot_pairs()) { + TRACED_FOREACH(VectorSlotPair, feedback2, vector_slot_pairs()) { + Node* value = Parameter(0); + Node* effect = graph()->start(); + Node* control = graph()->start(); + + Node* check1 = effect = graph()->NewNode( + simplified()->CheckedTaggedToTaggedPointer(feedback1), value, effect, + control); + Reduction r1 = Reduce(check1); + ASSERT_TRUE(r1.Changed()); + EXPECT_EQ(r1.replacement(), check1); + + Node* check2 = effect = graph()->NewNode( + simplified()->CheckedTaggedToTaggedPointer(feedback2), value, effect, + control); + Reduction r2 = Reduce(check2); + ASSERT_TRUE(r2.Changed()); + EXPECT_EQ(r2.replacement(), check1); + } + } +} + +// ----------------------------------------------------------------------------- +// CheckedTaggedToTaggedSigned + +TEST_F(RedundancyEliminationTest, CheckedTaggedToTaggedSigned) { + TRACED_FOREACH(VectorSlotPair, feedback1, vector_slot_pairs()) { + TRACED_FOREACH(VectorSlotPair, feedback2, vector_slot_pairs()) { + Node* value = Parameter(0); + Node* effect = graph()->start(); + Node* control = graph()->start(); + + Node* check1 = effect = + graph()->NewNode(simplified()->CheckedTaggedToTaggedSigned(feedback1), + value, effect, control); + Reduction r1 = Reduce(check1); + ASSERT_TRUE(r1.Changed()); + EXPECT_EQ(r1.replacement(), check1); + + Node* check2 = effect = + graph()->NewNode(simplified()->CheckedTaggedToTaggedSigned(feedback2), + value, effect, control); + Reduction r2 = Reduce(check2); + ASSERT_TRUE(r2.Changed()); + EXPECT_EQ(r2.replacement(), check1); + } + } +} + +// ----------------------------------------------------------------------------- +// CheckedTruncateTaggedToWord32 + +TEST_F(RedundancyEliminationTest, CheckedTruncateTaggedToWord32) { + TRACED_FOREACH(VectorSlotPair, feedback1, vector_slot_pairs()) { + TRACED_FOREACH(VectorSlotPair, feedback2, vector_slot_pairs()) { + TRACED_FOREACH(CheckTaggedInputMode, mode, kCheckTaggedInputModes) { + Node* value = Parameter(0); + Node* effect = graph()->start(); + Node* control = graph()->start(); + + Node* check1 = effect = graph()->NewNode( + simplified()->CheckedTruncateTaggedToWord32(mode, feedback1), value, + effect, control); + Reduction r1 = Reduce(check1); + ASSERT_TRUE(r1.Changed()); + EXPECT_EQ(r1.replacement(), check1); + + Node* check2 = effect = graph()->NewNode( + simplified()->CheckedTruncateTaggedToWord32(mode, feedback2), value, + effect, control); + Reduction r2 = Reduce(check2); + ASSERT_TRUE(r2.Changed()); + EXPECT_EQ(r2.replacement(), check1); + } + } + } +} + +TEST_F(RedundancyEliminationTest, + CheckedTruncateTaggedToWord32SubsumedByCheckedTruncateTaggedToWord32) { + TRACED_FOREACH(VectorSlotPair, feedback1, vector_slot_pairs()) { + TRACED_FOREACH(VectorSlotPair, feedback2, vector_slot_pairs()) { + Node* value = Parameter(0); + Node* effect = graph()->start(); + Node* control = graph()->start(); + + // If the check passed for CheckTaggedInputMode::kNumber, it'll + // also pass later for CheckTaggedInputMode::kNumberOrOddball. + Node* check1 = effect = + graph()->NewNode(simplified()->CheckedTruncateTaggedToWord32( + CheckTaggedInputMode::kNumber, feedback1), + value, effect, control); + Reduction r1 = Reduce(check1); + ASSERT_TRUE(r1.Changed()); + EXPECT_EQ(r1.replacement(), check1); + + Node* check2 = effect = graph()->NewNode( + simplified()->CheckedTruncateTaggedToWord32( + CheckTaggedInputMode::kNumberOrOddball, feedback2), + value, effect, control); + Reduction r2 = Reduce(check2); + ASSERT_TRUE(r2.Changed()); + EXPECT_EQ(r2.replacement(), check1); + } + } +} + +// ----------------------------------------------------------------------------- +// CheckedUint32ToInt32 + +TEST_F(RedundancyEliminationTest, CheckedUint32ToInt32) { + TRACED_FOREACH(VectorSlotPair, feedback1, vector_slot_pairs()) { + TRACED_FOREACH(VectorSlotPair, feedback2, vector_slot_pairs()) { + Node* value = Parameter(0); + Node* effect = graph()->start(); + Node* control = graph()->start(); + + Node* check1 = effect = + graph()->NewNode(simplified()->CheckedUint32ToInt32(feedback1), value, + effect, control); + Reduction r1 = Reduce(check1); + ASSERT_TRUE(r1.Changed()); + EXPECT_EQ(r1.replacement(), check1); + + Node* check2 = effect = + graph()->NewNode(simplified()->CheckedUint32ToInt32(feedback2), value, + effect, control); + Reduction r2 = Reduce(check2); + ASSERT_TRUE(r2.Changed()); + EXPECT_EQ(r2.replacement(), check1); + } + } +} + +// ----------------------------------------------------------------------------- +// CheckedUint32ToTaggedSigned + +TEST_F(RedundancyEliminationTest, CheckedUint32ToTaggedSigned) { + TRACED_FOREACH(VectorSlotPair, feedback1, vector_slot_pairs()) { + TRACED_FOREACH(VectorSlotPair, feedback2, vector_slot_pairs()) { + Node* value = Parameter(0); + Node* effect = graph()->start(); + Node* control = graph()->start(); + + Node* check1 = effect = + graph()->NewNode(simplified()->CheckedUint32ToTaggedSigned(feedback1), + value, effect, control); + Reduction r1 = Reduce(check1); + ASSERT_TRUE(r1.Changed()); + EXPECT_EQ(r1.replacement(), check1); + + Node* check2 = effect = + graph()->NewNode(simplified()->CheckedUint32ToTaggedSigned(feedback2), + value, effect, control); + Reduction r2 = Reduce(check2); + ASSERT_TRUE(r2.Changed()); + EXPECT_EQ(r2.replacement(), check1); + } + } +} + +// ----------------------------------------------------------------------------- +// CheckedUint64ToInt32 + +TEST_F(RedundancyEliminationTest, CheckedUint64ToInt32) { + TRACED_FOREACH(VectorSlotPair, feedback1, vector_slot_pairs()) { + TRACED_FOREACH(VectorSlotPair, feedback2, vector_slot_pairs()) { + Node* value = Parameter(0); + Node* effect = graph()->start(); + Node* control = graph()->start(); + + Node* check1 = effect = + graph()->NewNode(simplified()->CheckedUint64ToInt32(feedback1), value, + effect, control); + Reduction r1 = Reduce(check1); + ASSERT_TRUE(r1.Changed()); + EXPECT_EQ(r1.replacement(), check1); + + Node* check2 = effect = + graph()->NewNode(simplified()->CheckedUint64ToInt32(feedback2), value, + effect, control); + Reduction r2 = Reduce(check2); + ASSERT_TRUE(r2.Changed()); + EXPECT_EQ(r2.replacement(), check1); + } + } +} + +// ----------------------------------------------------------------------------- +// CheckedUint64ToTaggedSigned + +TEST_F(RedundancyEliminationTest, CheckedUint64ToTaggedSigned) { + TRACED_FOREACH(VectorSlotPair, feedback1, vector_slot_pairs()) { + TRACED_FOREACH(VectorSlotPair, feedback2, vector_slot_pairs()) { + Node* value = Parameter(0); + Node* effect = graph()->start(); + Node* control = graph()->start(); + + Node* check1 = effect = + graph()->NewNode(simplified()->CheckedUint64ToTaggedSigned(feedback1), + value, effect, control); + Reduction r1 = Reduce(check1); + ASSERT_TRUE(r1.Changed()); + EXPECT_EQ(r1.replacement(), check1); + + Node* check2 = effect = + graph()->NewNode(simplified()->CheckedUint64ToTaggedSigned(feedback2), + value, effect, control); + Reduction r2 = Reduce(check2); + ASSERT_TRUE(r2.Changed()); + EXPECT_EQ(r2.replacement(), check1); + } + } +} + +// ----------------------------------------------------------------------------- +// SpeculativeNumberEqual + +TEST_F(RedundancyEliminationTest, + SpeculativeNumberEqualWithCheckBoundsBetterType) { + Typer typer(js_heap_broker(), Typer::kNoFlags, graph()); + TRACED_FOREACH(VectorSlotPair, feedback1, vector_slot_pairs()) { + TRACED_FOREACH(VectorSlotPair, feedback2, vector_slot_pairs()) { + Node* lhs = Parameter(Type::Any(), 0); + Node* rhs = Parameter(Type::Any(), 1); + Node* length = Parameter(Type::Unsigned31(), 2); + Node* effect = graph()->start(); + Node* control = graph()->start(); + + Node* check1 = effect = graph()->NewNode( + simplified()->CheckBounds(feedback1), lhs, length, effect, control); + Reduction r1 = Reduce(check1); + ASSERT_TRUE(r1.Changed()); + EXPECT_EQ(r1.replacement(), check1); + + Node* check2 = effect = graph()->NewNode( + simplified()->CheckBounds(feedback2), rhs, length, effect, control); + Reduction r2 = Reduce(check2); + ASSERT_TRUE(r2.Changed()); + EXPECT_EQ(r2.replacement(), check2); + + Node* cmp3 = effect = + graph()->NewNode(simplified()->SpeculativeNumberEqual( + NumberOperationHint::kSignedSmall), + lhs, rhs, effect, control); + Reduction r3 = Reduce(cmp3); + ASSERT_TRUE(r3.Changed()); + EXPECT_THAT(r3.replacement(), + IsSpeculativeNumberEqual(NumberOperationHint::kSignedSmall, + check1, check2, _, _)); + } + } +} + +TEST_F(RedundancyEliminationTest, + SpeculativeNumberEqualWithCheckBoundsSameType) { + Typer typer(js_heap_broker(), Typer::kNoFlags, graph()); + TRACED_FOREACH(VectorSlotPair, feedback1, vector_slot_pairs()) { + TRACED_FOREACH(VectorSlotPair, feedback2, vector_slot_pairs()) { + Node* lhs = Parameter(Type::UnsignedSmall(), 0); + Node* rhs = Parameter(Type::UnsignedSmall(), 1); + Node* length = Parameter(Type::Unsigned31(), 2); + Node* effect = graph()->start(); + Node* control = graph()->start(); + + Node* check1 = effect = graph()->NewNode( + simplified()->CheckBounds(feedback1), lhs, length, effect, control); + Reduction r1 = Reduce(check1); + ASSERT_TRUE(r1.Changed()); + EXPECT_EQ(r1.replacement(), check1); + + Node* check2 = effect = graph()->NewNode( + simplified()->CheckBounds(feedback2), rhs, length, effect, control); + Reduction r2 = Reduce(check2); + ASSERT_TRUE(r2.Changed()); + EXPECT_EQ(r2.replacement(), check2); + + Node* cmp3 = effect = + graph()->NewNode(simplified()->SpeculativeNumberEqual( + NumberOperationHint::kSignedSmall), + lhs, rhs, effect, control); + Reduction r3 = Reduce(cmp3); + ASSERT_TRUE(r3.Changed()); + EXPECT_THAT(r3.replacement(), + IsSpeculativeNumberEqual(NumberOperationHint::kSignedSmall, + lhs, rhs, _, _)); + } + } +} + +// ----------------------------------------------------------------------------- +// SpeculativeNumberLessThan + +TEST_F(RedundancyEliminationTest, + SpeculativeNumberLessThanWithCheckBoundsBetterType) { + Typer typer(js_heap_broker(), Typer::kNoFlags, graph()); + TRACED_FOREACH(VectorSlotPair, feedback1, vector_slot_pairs()) { + TRACED_FOREACH(VectorSlotPair, feedback2, vector_slot_pairs()) { + Node* lhs = Parameter(Type::Any(), 0); + Node* rhs = Parameter(Type::Any(), 1); + Node* length = Parameter(Type::Unsigned31(), 2); + Node* effect = graph()->start(); + Node* control = graph()->start(); + + Node* check1 = effect = graph()->NewNode( + simplified()->CheckBounds(feedback1), lhs, length, effect, control); + Reduction r1 = Reduce(check1); + ASSERT_TRUE(r1.Changed()); + EXPECT_EQ(r1.replacement(), check1); + + Node* check2 = effect = graph()->NewNode( + simplified()->CheckBounds(feedback2), rhs, length, effect, control); + Reduction r2 = Reduce(check2); + ASSERT_TRUE(r2.Changed()); + EXPECT_EQ(r2.replacement(), check2); + + Node* cmp3 = effect = + graph()->NewNode(simplified()->SpeculativeNumberLessThan( + NumberOperationHint::kSignedSmall), + lhs, rhs, effect, control); + Reduction r3 = Reduce(cmp3); + ASSERT_TRUE(r3.Changed()); + EXPECT_THAT(r3.replacement(), + IsSpeculativeNumberLessThan(NumberOperationHint::kSignedSmall, + check1, check2, _, _)); + } + } +} + +TEST_F(RedundancyEliminationTest, + SpeculativeNumberLessThanWithCheckBoundsSameType) { + Typer typer(js_heap_broker(), Typer::kNoFlags, graph()); + TRACED_FOREACH(VectorSlotPair, feedback1, vector_slot_pairs()) { + TRACED_FOREACH(VectorSlotPair, feedback2, vector_slot_pairs()) { + Node* lhs = Parameter(Type::UnsignedSmall(), 0); + Node* rhs = Parameter(Type::UnsignedSmall(), 1); + Node* length = Parameter(Type::Unsigned31(), 2); + Node* effect = graph()->start(); + Node* control = graph()->start(); + + Node* check1 = effect = graph()->NewNode( + simplified()->CheckBounds(feedback1), lhs, length, effect, control); + Reduction r1 = Reduce(check1); + ASSERT_TRUE(r1.Changed()); + EXPECT_EQ(r1.replacement(), check1); + + Node* check2 = effect = graph()->NewNode( + simplified()->CheckBounds(feedback2), rhs, length, effect, control); + Reduction r2 = Reduce(check2); + ASSERT_TRUE(r2.Changed()); + EXPECT_EQ(r2.replacement(), check2); + + Node* cmp3 = effect = + graph()->NewNode(simplified()->SpeculativeNumberLessThan( + NumberOperationHint::kSignedSmall), + lhs, rhs, effect, control); + Reduction r3 = Reduce(cmp3); + ASSERT_TRUE(r3.Changed()); + EXPECT_THAT(r3.replacement(), + IsSpeculativeNumberLessThan(NumberOperationHint::kSignedSmall, + lhs, rhs, _, _)); + } + } +} + +// ----------------------------------------------------------------------------- +// SpeculativeNumberLessThanOrEqual + +TEST_F(RedundancyEliminationTest, + SpeculativeNumberLessThanOrEqualWithCheckBoundsBetterType) { + Typer typer(js_heap_broker(), Typer::kNoFlags, graph()); + TRACED_FOREACH(VectorSlotPair, feedback1, vector_slot_pairs()) { + TRACED_FOREACH(VectorSlotPair, feedback2, vector_slot_pairs()) { + Node* lhs = Parameter(Type::Any(), 0); + Node* rhs = Parameter(Type::Any(), 1); + Node* length = Parameter(Type::Unsigned31(), 2); + Node* effect = graph()->start(); + Node* control = graph()->start(); + + Node* check1 = effect = graph()->NewNode( + simplified()->CheckBounds(feedback1), lhs, length, effect, control); + Reduction r1 = Reduce(check1); + ASSERT_TRUE(r1.Changed()); + EXPECT_EQ(r1.replacement(), check1); + + Node* check2 = effect = graph()->NewNode( + simplified()->CheckBounds(feedback2), rhs, length, effect, control); + Reduction r2 = Reduce(check2); + ASSERT_TRUE(r2.Changed()); + EXPECT_EQ(r2.replacement(), check2); + + Node* cmp3 = effect = + graph()->NewNode(simplified()->SpeculativeNumberLessThanOrEqual( + NumberOperationHint::kSignedSmall), + lhs, rhs, effect, control); + Reduction r3 = Reduce(cmp3); + ASSERT_TRUE(r3.Changed()); + EXPECT_THAT(r3.replacement(), + IsSpeculativeNumberLessThanOrEqual( + NumberOperationHint::kSignedSmall, check1, check2, _, _)); + } + } +} + +TEST_F(RedundancyEliminationTest, + SpeculativeNumberLessThanOrEqualWithCheckBoundsSameType) { + Typer typer(js_heap_broker(), Typer::kNoFlags, graph()); + TRACED_FOREACH(VectorSlotPair, feedback1, vector_slot_pairs()) { + TRACED_FOREACH(VectorSlotPair, feedback2, vector_slot_pairs()) { + Node* lhs = Parameter(Type::UnsignedSmall(), 0); + Node* rhs = Parameter(Type::UnsignedSmall(), 1); + Node* length = Parameter(Type::Unsigned31(), 2); + Node* effect = graph()->start(); + Node* control = graph()->start(); + + Node* check1 = effect = graph()->NewNode( + simplified()->CheckBounds(feedback1), lhs, length, effect, control); + Reduction r1 = Reduce(check1); + ASSERT_TRUE(r1.Changed()); + EXPECT_EQ(r1.replacement(), check1); + + Node* check2 = effect = graph()->NewNode( + simplified()->CheckBounds(feedback2), rhs, length, effect, control); + Reduction r2 = Reduce(check2); + ASSERT_TRUE(r2.Changed()); + EXPECT_EQ(r2.replacement(), check2); + + Node* cmp3 = effect = + graph()->NewNode(simplified()->SpeculativeNumberLessThanOrEqual( + NumberOperationHint::kSignedSmall), + lhs, rhs, effect, control); + Reduction r3 = Reduce(cmp3); + ASSERT_TRUE(r3.Changed()); + EXPECT_THAT(r3.replacement(), + IsSpeculativeNumberLessThanOrEqual( + NumberOperationHint::kSignedSmall, lhs, rhs, _, _)); + } + } +} + +// ----------------------------------------------------------------------------- +// SpeculativeNumberAdd + +TEST_F(RedundancyEliminationTest, + SpeculativeNumberAddWithCheckBoundsBetterType) { + Typer typer(js_heap_broker(), Typer::kNoFlags, graph()); + TRACED_FOREACH(VectorSlotPair, feedback, vector_slot_pairs()) { + TRACED_FOREACH(NumberOperationHint, hint, kNumberOperationHints) { + Node* lhs = Parameter(Type::Any(), 0); + Node* rhs = Parameter(Type::Any(), 1); + Node* length = Parameter(Type::Unsigned31(), 2); + Node* effect = graph()->start(); + Node* control = graph()->start(); + + Node* check1 = effect = graph()->NewNode( + simplified()->CheckBounds(feedback), lhs, length, effect, control); + Reduction r1 = Reduce(check1); + ASSERT_TRUE(r1.Changed()); + EXPECT_EQ(r1.replacement(), check1); + + Node* add2 = effect = graph()->NewNode( + simplified()->SpeculativeNumberAdd(hint), lhs, rhs, effect, control); + Reduction r2 = Reduce(add2); + ASSERT_TRUE(r2.Changed()); + EXPECT_THAT(r2.replacement(), + IsSpeculativeNumberAdd(hint, check1, rhs, _, _)); + } + } +} + +TEST_F(RedundancyEliminationTest, SpeculativeNumberAddWithCheckBoundsSameType) { + Typer typer(js_heap_broker(), Typer::kNoFlags, graph()); + TRACED_FOREACH(VectorSlotPair, feedback, vector_slot_pairs()) { + TRACED_FOREACH(NumberOperationHint, hint, kNumberOperationHints) { + Node* lhs = Parameter(Type::Range(42.0, 42.0, zone()), 0); + Node* rhs = Parameter(Type::Any(), 0); + Node* length = Parameter(Type::Unsigned31(), 1); + Node* effect = graph()->start(); + Node* control = graph()->start(); + + Node* check1 = effect = graph()->NewNode( + simplified()->CheckBounds(feedback), lhs, length, effect, control); + Reduction r1 = Reduce(check1); + ASSERT_TRUE(r1.Changed()); + EXPECT_EQ(r1.replacement(), check1); + + Node* add2 = effect = graph()->NewNode( + simplified()->SpeculativeNumberAdd(hint), lhs, rhs, effect, control); + Reduction r2 = Reduce(add2); + ASSERT_TRUE(r2.Changed()); + EXPECT_THAT(r2.replacement(), + IsSpeculativeNumberAdd(hint, lhs, rhs, _, _)); + } + } +} + +// ----------------------------------------------------------------------------- +// SpeculativeNumberSubtract + +TEST_F(RedundancyEliminationTest, + SpeculativeNumberSubtractWithCheckBoundsBetterType) { + Typer typer(js_heap_broker(), Typer::kNoFlags, graph()); + TRACED_FOREACH(VectorSlotPair, feedback, vector_slot_pairs()) { + TRACED_FOREACH(NumberOperationHint, hint, kNumberOperationHints) { + Node* lhs = Parameter(Type::Any(), 0); + Node* rhs = Parameter(Type::Any(), 1); + Node* length = Parameter(Type::Unsigned31(), 2); + Node* effect = graph()->start(); + Node* control = graph()->start(); + + Node* check1 = effect = graph()->NewNode( + simplified()->CheckBounds(feedback), lhs, length, effect, control); + Reduction r1 = Reduce(check1); + ASSERT_TRUE(r1.Changed()); + EXPECT_EQ(r1.replacement(), check1); + + Node* subtract2 = effect = + graph()->NewNode(simplified()->SpeculativeNumberSubtract(hint), lhs, + rhs, effect, control); + Reduction r2 = Reduce(subtract2); + ASSERT_TRUE(r2.Changed()); + EXPECT_THAT(r2.replacement(), + IsSpeculativeNumberSubtract(hint, check1, rhs, _, _)); + } + } +} + +TEST_F(RedundancyEliminationTest, + SpeculativeNumberSubtractWithCheckBoundsSameType) { + Typer typer(js_heap_broker(), Typer::kNoFlags, graph()); + TRACED_FOREACH(VectorSlotPair, feedback, vector_slot_pairs()) { + TRACED_FOREACH(NumberOperationHint, hint, kNumberOperationHints) { + Node* lhs = Parameter(Type::Range(42.0, 42.0, zone()), 0); + Node* rhs = Parameter(Type::Any(), 0); + Node* length = Parameter(Type::Unsigned31(), 1); + Node* effect = graph()->start(); + Node* control = graph()->start(); + + Node* check1 = effect = graph()->NewNode( + simplified()->CheckBounds(feedback), lhs, length, effect, control); + Reduction r1 = Reduce(check1); + ASSERT_TRUE(r1.Changed()); + EXPECT_EQ(r1.replacement(), check1); + + Node* subtract2 = effect = + graph()->NewNode(simplified()->SpeculativeNumberSubtract(hint), lhs, + rhs, effect, control); + Reduction r2 = Reduce(subtract2); + ASSERT_TRUE(r2.Changed()); + EXPECT_THAT(r2.replacement(), + IsSpeculativeNumberSubtract(hint, lhs, rhs, _, _)); + } + } +} + +// ----------------------------------------------------------------------------- +// SpeculativeSafeIntegerAdd + +TEST_F(RedundancyEliminationTest, + SpeculativeSafeIntegerAddWithCheckBoundsBetterType) { + Typer typer(js_heap_broker(), Typer::kNoFlags, graph()); + TRACED_FOREACH(VectorSlotPair, feedback, vector_slot_pairs()) { + TRACED_FOREACH(NumberOperationHint, hint, kNumberOperationHints) { + Node* lhs = Parameter(Type::Any(), 0); + Node* rhs = Parameter(Type::Any(), 1); + Node* length = Parameter(Type::Unsigned31(), 2); + Node* effect = graph()->start(); + Node* control = graph()->start(); + + Node* check1 = effect = graph()->NewNode( + simplified()->CheckBounds(feedback), lhs, length, effect, control); + Reduction r1 = Reduce(check1); + ASSERT_TRUE(r1.Changed()); + EXPECT_EQ(r1.replacement(), check1); + + Node* add2 = effect = + graph()->NewNode(simplified()->SpeculativeSafeIntegerAdd(hint), lhs, + rhs, effect, control); + Reduction r2 = Reduce(add2); + ASSERT_TRUE(r2.Changed()); + EXPECT_THAT(r2.replacement(), + IsSpeculativeSafeIntegerAdd(hint, check1, rhs, _, _)); + } + } +} + +TEST_F(RedundancyEliminationTest, + SpeculativeSafeIntegerAddWithCheckBoundsSameType) { + Typer typer(js_heap_broker(), Typer::kNoFlags, graph()); + TRACED_FOREACH(VectorSlotPair, feedback, vector_slot_pairs()) { + TRACED_FOREACH(NumberOperationHint, hint, kNumberOperationHints) { + Node* lhs = Parameter(Type::Range(42.0, 42.0, zone()), 0); + Node* rhs = Parameter(Type::Any(), 0); + Node* length = Parameter(Type::Unsigned31(), 1); + Node* effect = graph()->start(); + Node* control = graph()->start(); + + Node* check1 = effect = graph()->NewNode( + simplified()->CheckBounds(feedback), lhs, length, effect, control); + Reduction r1 = Reduce(check1); + ASSERT_TRUE(r1.Changed()); + EXPECT_EQ(r1.replacement(), check1); + + Node* add2 = effect = + graph()->NewNode(simplified()->SpeculativeSafeIntegerAdd(hint), lhs, + rhs, effect, control); + Reduction r2 = Reduce(add2); + ASSERT_TRUE(r2.Changed()); + EXPECT_THAT(r2.replacement(), + IsSpeculativeSafeIntegerAdd(hint, lhs, rhs, _, _)); + } + } +} + +// ----------------------------------------------------------------------------- +// SpeculativeSafeIntegerSubtract + +TEST_F(RedundancyEliminationTest, + SpeculativeSafeIntegerSubtractWithCheckBoundsBetterType) { + Typer typer(js_heap_broker(), Typer::kNoFlags, graph()); + TRACED_FOREACH(VectorSlotPair, feedback, vector_slot_pairs()) { + TRACED_FOREACH(NumberOperationHint, hint, kNumberOperationHints) { + Node* lhs = Parameter(Type::Any(), 0); + Node* rhs = Parameter(Type::Any(), 1); + Node* length = Parameter(Type::Unsigned31(), 2); + Node* effect = graph()->start(); + Node* control = graph()->start(); + + Node* check1 = effect = graph()->NewNode( + simplified()->CheckBounds(feedback), lhs, length, effect, control); + Reduction r1 = Reduce(check1); + ASSERT_TRUE(r1.Changed()); + EXPECT_EQ(r1.replacement(), check1); + + Node* subtract2 = effect = + graph()->NewNode(simplified()->SpeculativeSafeIntegerSubtract(hint), + lhs, rhs, effect, control); + Reduction r2 = Reduce(subtract2); + ASSERT_TRUE(r2.Changed()); + EXPECT_THAT(r2.replacement(), + IsSpeculativeSafeIntegerSubtract(hint, check1, rhs, _, _)); + } + } +} + +TEST_F(RedundancyEliminationTest, + SpeculativeSafeIntegerSubtractWithCheckBoundsSameType) { + Typer typer(js_heap_broker(), Typer::kNoFlags, graph()); + TRACED_FOREACH(VectorSlotPair, feedback, vector_slot_pairs()) { + TRACED_FOREACH(NumberOperationHint, hint, kNumberOperationHints) { + Node* lhs = Parameter(Type::Range(42.0, 42.0, zone()), 0); + Node* rhs = Parameter(Type::Any(), 0); + Node* length = Parameter(Type::Unsigned31(), 1); + Node* effect = graph()->start(); + Node* control = graph()->start(); + + Node* check1 = effect = graph()->NewNode( + simplified()->CheckBounds(feedback), lhs, length, effect, control); + Reduction r1 = Reduce(check1); + ASSERT_TRUE(r1.Changed()); + EXPECT_EQ(r1.replacement(), check1); + + Node* subtract2 = effect = + graph()->NewNode(simplified()->SpeculativeSafeIntegerSubtract(hint), + lhs, rhs, effect, control); + Reduction r2 = Reduce(subtract2); + ASSERT_TRUE(r2.Changed()); + EXPECT_THAT(r2.replacement(), + IsSpeculativeSafeIntegerSubtract(hint, lhs, rhs, _, _)); + } + } +} + +// ----------------------------------------------------------------------------- +// SpeculativeToNumber + +TEST_F(RedundancyEliminationTest, + SpeculativeToNumberWithCheckBoundsBetterType) { + Typer typer(js_heap_broker(), Typer::kNoFlags, graph()); + TRACED_FOREACH(VectorSlotPair, feedback1, vector_slot_pairs()) { + TRACED_FOREACH(VectorSlotPair, feedback2, vector_slot_pairs()) { + TRACED_FOREACH(NumberOperationHint, hint, kNumberOperationHints) { + Node* index = Parameter(Type::Any(), 0); + Node* length = Parameter(Type::Unsigned31(), 1); + Node* effect = graph()->start(); + Node* control = graph()->start(); + + Node* check1 = effect = + graph()->NewNode(simplified()->CheckBounds(feedback1), index, + length, effect, control); + Reduction r1 = Reduce(check1); + ASSERT_TRUE(r1.Changed()); + EXPECT_EQ(r1.replacement(), check1); + + Node* to_number2 = effect = + graph()->NewNode(simplified()->SpeculativeToNumber(hint, feedback2), + index, effect, control); + Reduction r2 = Reduce(to_number2); + ASSERT_TRUE(r2.Changed()); + EXPECT_THAT(r2.replacement(), IsSpeculativeToNumber(check1)); + } + } + } +} + +TEST_F(RedundancyEliminationTest, SpeculativeToNumberWithCheckBoundsSameType) { + Typer typer(js_heap_broker(), Typer::kNoFlags, graph()); + TRACED_FOREACH(VectorSlotPair, feedback1, vector_slot_pairs()) { + TRACED_FOREACH(VectorSlotPair, feedback2, vector_slot_pairs()) { + TRACED_FOREACH(NumberOperationHint, hint, kNumberOperationHints) { + Node* index = Parameter(Type::Range(42.0, 42.0, zone()), 0); + Node* length = Parameter(Type::Unsigned31(), 1); + Node* effect = graph()->start(); + Node* control = graph()->start(); + + Node* check1 = effect = + graph()->NewNode(simplified()->CheckBounds(feedback1), index, + length, effect, control); + Reduction r1 = Reduce(check1); + ASSERT_TRUE(r1.Changed()); + EXPECT_EQ(r1.replacement(), check1); + + Node* to_number2 = effect = + graph()->NewNode(simplified()->SpeculativeToNumber(hint, feedback2), + index, effect, control); + Reduction r2 = Reduce(to_number2); + ASSERT_TRUE(r2.Changed()); + EXPECT_THAT(r2.replacement(), IsSpeculativeToNumber(index)); + } + } + } +} + +} // namespace redundancy_elimination_unittest +} // namespace compiler +} // namespace internal +} // namespace v8 diff --git a/deps/v8/test/unittests/compiler/scheduler-rpo-unittest.cc b/deps/v8/test/unittests/compiler/scheduler-rpo-unittest.cc index 97cafdb6e6..68a7ffea4a 100644 --- a/deps/v8/test/unittests/compiler/scheduler-rpo-unittest.cc +++ b/deps/v8/test/unittests/compiler/scheduler-rpo-unittest.cc @@ -18,7 +18,7 @@ namespace compiler { class SchedulerRPOTest : public TestWithZone { public: - SchedulerRPOTest() {} + SchedulerRPOTest() = default; void CheckRPONumbers(BasicBlockVector* order, size_t expected, bool loops_allowed) { diff --git a/deps/v8/test/unittests/compiler/simplified-lowering-unittest.cc b/deps/v8/test/unittests/compiler/simplified-lowering-unittest.cc index 51e954f799..82bcda6e9f 100644 --- a/deps/v8/test/unittests/compiler/simplified-lowering-unittest.cc +++ b/deps/v8/test/unittests/compiler/simplified-lowering-unittest.cc @@ -25,7 +25,7 @@ class SimplifiedLoweringTest : public GraphTest { simplified_(zone()), jsgraph_(isolate(), graph(), common(), &javascript_, &simplified_, &machine_) {} - ~SimplifiedLoweringTest() override {} + ~SimplifiedLoweringTest() override = default; void LowerGraph(Node* node) { // Make sure we always start with an empty graph. @@ -42,7 +42,7 @@ class SimplifiedLoweringTest : public GraphTest { { // Simplified lowering needs to run w/o the typer decorator so make sure // the object is not live at the same time. - Typer typer(isolate(), js_heap_broker(), Typer::kNoFlags, graph()); + Typer typer(js_heap_broker(), Typer::kNoFlags, graph()); typer.Run(); } diff --git a/deps/v8/test/unittests/compiler/simplified-operator-reducer-unittest.cc b/deps/v8/test/unittests/compiler/simplified-operator-reducer-unittest.cc index 7913d6398c..5e2f8f15cc 100644 --- a/deps/v8/test/unittests/compiler/simplified-operator-reducer-unittest.cc +++ b/deps/v8/test/unittests/compiler/simplified-operator-reducer-unittest.cc @@ -25,7 +25,7 @@ class SimplifiedOperatorReducerTest : public GraphTest { public: explicit SimplifiedOperatorReducerTest(int num_parameters = 1) : GraphTest(num_parameters), simplified_(zone()) {} - ~SimplifiedOperatorReducerTest() override {} + ~SimplifiedOperatorReducerTest() override = default; protected: Reduction Reduce(Node* node) { @@ -54,7 +54,7 @@ class SimplifiedOperatorReducerTestWithParam public: explicit SimplifiedOperatorReducerTestWithParam(int num_parameters = 1) : SimplifiedOperatorReducerTest(num_parameters) {} - ~SimplifiedOperatorReducerTestWithParam() override {} + ~SimplifiedOperatorReducerTestWithParam() override = default; }; diff --git a/deps/v8/test/unittests/compiler/typed-optimization-unittest.cc b/deps/v8/test/unittests/compiler/typed-optimization-unittest.cc index 86600aeffe..51426a5f85 100644 --- a/deps/v8/test/unittests/compiler/typed-optimization-unittest.cc +++ b/deps/v8/test/unittests/compiler/typed-optimization-unittest.cc @@ -28,7 +28,7 @@ class TypedOptimizationTest : public TypedGraphTest { public: TypedOptimizationTest() : TypedGraphTest(3), simplified_(zone()), deps_(isolate(), zone()) {} - ~TypedOptimizationTest() override {} + ~TypedOptimizationTest() override = default; protected: Reduction Reduce(Node* node) { diff --git a/deps/v8/test/unittests/compiler/typer-unittest.cc b/deps/v8/test/unittests/compiler/typer-unittest.cc index 53459c314a..b827088336 100644 --- a/deps/v8/test/unittests/compiler/typer-unittest.cc +++ b/deps/v8/test/unittests/compiler/typer-unittest.cc @@ -23,7 +23,7 @@ class TyperTest : public TypedGraphTest { TyperTest() : TypedGraphTest(3), js_heap_broker_(isolate(), zone()), - operation_typer_(isolate(), &js_heap_broker_, zone()), + operation_typer_(&js_heap_broker_, zone()), types_(zone(), isolate(), random_number_generator()), javascript_(zone()), simplified_(zone()) { @@ -434,7 +434,6 @@ TEST_F(TyperTest, TypeJSStrictEqual) { TEST_F(TyperTest, Monotonicity_##name) { \ TestUnaryMonotonicity(javascript_.name()); \ } -TEST_MONOTONICITY(ToInteger) TEST_MONOTONICITY(ToLength) TEST_MONOTONICITY(ToName) TEST_MONOTONICITY(ToNumber) diff --git a/deps/v8/test/unittests/counters-unittest.cc b/deps/v8/test/unittests/counters-unittest.cc index d137d68ee9..c4d46b2e7a 100644 --- a/deps/v8/test/unittests/counters-unittest.cc +++ b/deps/v8/test/unittests/counters-unittest.cc @@ -34,7 +34,7 @@ class MockHistogram : public Histogram { class AggregatedMemoryHistogramTest : public ::testing::Test { public: AggregatedMemoryHistogramTest() : aggregated_(&mock_) {} - virtual ~AggregatedMemoryHistogramTest() {} + ~AggregatedMemoryHistogramTest() override = default; void AddSample(double current_ms, double current_value) { aggregated_.AddSample(current_ms, current_value); @@ -66,7 +66,7 @@ class RuntimeCallStatsTest : public TestWithNativeContext { stats()->Reset(); } - ~RuntimeCallStatsTest() { + ~RuntimeCallStatsTest() override { // Disable RuntimeCallStats before tearing down the isolate to prevent // printing the tests table. Comment the following line for debugging // purposes. diff --git a/deps/v8/test/unittests/heap/bitmap-unittest.cc b/deps/v8/test/unittests/heap/bitmap-unittest.cc index a84437d534..1ecab4dd72 100644 --- a/deps/v8/test/unittests/heap/bitmap-unittest.cc +++ b/deps/v8/test/unittests/heap/bitmap-unittest.cc @@ -20,7 +20,7 @@ class BitmapTest : public ::testing::Test { memset(memory_, 0, Bitmap::kSize); } - virtual ~BitmapTest() { delete[] memory_; } + ~BitmapTest() override { delete[] memory_; } Bitmap* bitmap() { return reinterpret_cast<Bitmap*>(memory_); } uint8_t* raw_bitmap() { return memory_; } diff --git a/deps/v8/test/unittests/heap/embedder-tracing-unittest.cc b/deps/v8/test/unittests/heap/embedder-tracing-unittest.cc index ac2cb3e2ee..33cc05e692 100644 --- a/deps/v8/test/unittests/heap/embedder-tracing-unittest.cc +++ b/deps/v8/test/unittests/heap/embedder-tracing-unittest.cc @@ -33,7 +33,6 @@ class MockEmbedderHeapTracer : public EmbedderHeapTracer { public: MOCK_METHOD0(TracePrologue, void()); MOCK_METHOD0(TraceEpilogue, void()); - MOCK_METHOD0(AbortTracing, void()); MOCK_METHOD1(EnterFinalPause, void(EmbedderHeapTracer::EmbedderStackState)); MOCK_METHOD0(IsTracingDone, bool()); MOCK_METHOD1(RegisterV8References, @@ -76,24 +75,6 @@ TEST(LocalEmbedderHeapTracer, TraceEpilogueForwards) { local_tracer.TraceEpilogue(); } -TEST(LocalEmbedderHeapTracer, AbortTracingForwards) { - StrictMock<MockEmbedderHeapTracer> remote_tracer; - LocalEmbedderHeapTracer local_tracer(nullptr); - local_tracer.SetRemoteTracer(&remote_tracer); - EXPECT_CALL(remote_tracer, AbortTracing()); - local_tracer.AbortTracing(); -} - -TEST(LocalEmbedderHeapTracer, AbortTracingClearsCachedWrappers) { - StrictMock<MockEmbedderHeapTracer> remote_tracer; - LocalEmbedderHeapTracer local_tracer(nullptr); - local_tracer.SetRemoteTracer(&remote_tracer); - local_tracer.AddWrapperToTrace(CreateWrapperInfo()); - EXPECT_CALL(remote_tracer, AbortTracing()); - local_tracer.AbortTracing(); - EXPECT_EQ(0u, local_tracer.NumberOfCachedWrappersToTrace()); -} - TEST(LocalEmbedderHeapTracer, EnterFinalPauseForwards) { StrictMock<MockEmbedderHeapTracer> remote_tracer; LocalEmbedderHeapTracer local_tracer(nullptr); diff --git a/deps/v8/test/unittests/heap/gc-idle-time-handler-unittest.cc b/deps/v8/test/unittests/heap/gc-idle-time-handler-unittest.cc index 573be833af..7063b2a280 100644 --- a/deps/v8/test/unittests/heap/gc-idle-time-handler-unittest.cc +++ b/deps/v8/test/unittests/heap/gc-idle-time-handler-unittest.cc @@ -14,8 +14,8 @@ namespace { class GCIdleTimeHandlerTest : public ::testing::Test { public: - GCIdleTimeHandlerTest() {} - virtual ~GCIdleTimeHandlerTest() {} + GCIdleTimeHandlerTest() = default; + ~GCIdleTimeHandlerTest() override = default; GCIdleTimeHandler* handler() { return &handler_; } diff --git a/deps/v8/test/unittests/heap/gc-tracer-unittest.cc b/deps/v8/test/unittests/heap/gc-tracer-unittest.cc index 4ac80ab6fe..ac18e1817b 100644 --- a/deps/v8/test/unittests/heap/gc-tracer-unittest.cc +++ b/deps/v8/test/unittests/heap/gc-tracer-unittest.cc @@ -499,7 +499,7 @@ TEST_F(GCTracerTest, RecordMarkCompactHistograms) { tracer->current_.scopes[GCTracer::Scope::MC_MARK] = 5; tracer->current_.scopes[GCTracer::Scope::MC_PROLOGUE] = 6; tracer->current_.scopes[GCTracer::Scope::MC_SWEEP] = 7; - tracer->RecordMarkCompactHistograms(i_isolate()->counters()->gc_finalize()); + tracer->RecordGCPhasesHistograms(i_isolate()->counters()->gc_finalize()); EXPECT_EQ(1, GcHistogram::Get("V8.GCFinalizeMC.Clear")->Total()); EXPECT_EQ(2, GcHistogram::Get("V8.GCFinalizeMC.Epilogue")->Total()); EXPECT_EQ(3, GcHistogram::Get("V8.GCFinalizeMC.Evacuate")->Total()); @@ -510,5 +510,19 @@ TEST_F(GCTracerTest, RecordMarkCompactHistograms) { GcHistogram::CleanUp(); } +TEST_F(GCTracerTest, RecordScavengerHistograms) { + if (FLAG_stress_incremental_marking) return; + isolate()->SetCreateHistogramFunction(&GcHistogram::CreateHistogram); + isolate()->SetAddHistogramSampleFunction(&GcHistogram::AddHistogramSample); + GCTracer* tracer = i_isolate()->heap()->tracer(); + tracer->ResetForTesting(); + tracer->current_.scopes[GCTracer::Scope::SCAVENGER_SCAVENGE_ROOTS] = 1; + tracer->current_.scopes[GCTracer::Scope::SCAVENGER_SCAVENGE_PARALLEL] = 2; + tracer->RecordGCPhasesHistograms(i_isolate()->counters()->gc_scavenger()); + EXPECT_EQ(1, GcHistogram::Get("V8.GCScavenger.ScavengeRoots")->Total()); + EXPECT_EQ(2, GcHistogram::Get("V8.GCScavenger.ScavengeMain")->Total()); + GcHistogram::CleanUp(); +} + } // namespace internal } // namespace v8 diff --git a/deps/v8/test/unittests/heap/heap-controller-unittest.cc b/deps/v8/test/unittests/heap/heap-controller-unittest.cc index b2446afa84..42db9c4ba0 100644 --- a/deps/v8/test/unittests/heap/heap-controller-unittest.cc +++ b/deps/v8/test/unittests/heap/heap-controller-unittest.cc @@ -34,8 +34,8 @@ void CheckEqualRounded(double expected, double actual) { TEST_F(HeapControllerTest, HeapGrowingFactor) { HeapController heap_controller(i_isolate()->heap()); - double min_factor = heap_controller.kMinGrowingFactor; - double max_factor = heap_controller.kMaxGrowingFactor; + double min_factor = heap_controller.min_growing_factor_; + double max_factor = heap_controller.max_growing_factor_; CheckEqualRounded(max_factor, heap_controller.GrowingFactor(34, 1, 4.0)); CheckEqualRounded(3.553, heap_controller.GrowingFactor(45, 1, 4.0)); @@ -51,15 +51,15 @@ TEST_F(HeapControllerTest, HeapGrowingFactor) { TEST_F(HeapControllerTest, MaxHeapGrowingFactor) { HeapController heap_controller(i_isolate()->heap()); CheckEqualRounded( - 1.3, heap_controller.MaxGrowingFactor(heap_controller.kMinSize * MB)); + 1.3, heap_controller.MaxGrowingFactor(HeapController::kMinSize * MB)); CheckEqualRounded(1.600, heap_controller.MaxGrowingFactor( - heap_controller.kMaxSize / 2 * MB)); + HeapController::kMaxSize / 2 * MB)); CheckEqualRounded( 1.999, heap_controller.MaxGrowingFactor( - (heap_controller.kMaxSize - Heap::kPointerMultiplier) * MB)); + (HeapController::kMaxSize - Heap::kPointerMultiplier) * MB)); CheckEqualRounded(4.0, heap_controller.MaxGrowingFactor( - static_cast<size_t>(heap_controller.kMaxSize) * MB)); + static_cast<size_t>(HeapController::kMaxSize) * MB)); } TEST_F(HeapControllerTest, OldGenerationAllocationLimit) { @@ -75,39 +75,43 @@ TEST_F(HeapControllerTest, OldGenerationAllocationLimit) { double factor = heap_controller.GrowingFactor(gc_speed, mutator_speed, max_factor); - EXPECT_EQ(static_cast<size_t>(old_gen_size * factor + new_space_capacity), - heap->heap_controller()->CalculateAllocationLimit( - old_gen_size, max_old_generation_size, gc_speed, mutator_speed, - new_space_capacity, Heap::HeapGrowingMode::kDefault)); + EXPECT_EQ( + static_cast<size_t>(old_gen_size * factor + new_space_capacity), + heap->heap_controller()->CalculateAllocationLimit( + old_gen_size, max_old_generation_size, max_factor, gc_speed, + mutator_speed, new_space_capacity, Heap::HeapGrowingMode::kDefault)); - factor = Min(factor, heap_controller.kConservativeGrowingFactor); - EXPECT_EQ(static_cast<size_t>(old_gen_size * factor + new_space_capacity), - heap->heap_controller()->CalculateAllocationLimit( - old_gen_size, max_old_generation_size, gc_speed, mutator_speed, - new_space_capacity, Heap::HeapGrowingMode::kSlow)); - - factor = Min(factor, heap_controller.kConservativeGrowingFactor); - EXPECT_EQ(static_cast<size_t>(old_gen_size * factor + new_space_capacity), - heap->heap_controller()->CalculateAllocationLimit( - old_gen_size, max_old_generation_size, gc_speed, mutator_speed, - new_space_capacity, Heap::HeapGrowingMode::kConservative)); + factor = Min(factor, heap_controller.conservative_growing_factor_); + EXPECT_EQ( + static_cast<size_t>(old_gen_size * factor + new_space_capacity), + heap->heap_controller()->CalculateAllocationLimit( + old_gen_size, max_old_generation_size, max_factor, gc_speed, + mutator_speed, new_space_capacity, Heap::HeapGrowingMode::kSlow)); - factor = heap_controller.kMinGrowingFactor; + factor = Min(factor, heap_controller.conservative_growing_factor_); EXPECT_EQ(static_cast<size_t>(old_gen_size * factor + new_space_capacity), heap->heap_controller()->CalculateAllocationLimit( - old_gen_size, max_old_generation_size, gc_speed, mutator_speed, - new_space_capacity, Heap::HeapGrowingMode::kMinimal)); + old_gen_size, max_old_generation_size, max_factor, gc_speed, + mutator_speed, new_space_capacity, + Heap::HeapGrowingMode::kConservative)); + + factor = heap_controller.min_growing_factor_; + EXPECT_EQ( + static_cast<size_t>(old_gen_size * factor + new_space_capacity), + heap->heap_controller()->CalculateAllocationLimit( + old_gen_size, max_old_generation_size, max_factor, gc_speed, + mutator_speed, new_space_capacity, Heap::HeapGrowingMode::kMinimal)); } TEST_F(HeapControllerTest, MaxOldGenerationSize) { HeapController heap_controller(i_isolate()->heap()); uint64_t configurations[][2] = { - {0, heap_controller.kMinSize}, - {512, heap_controller.kMinSize}, + {0, HeapController::kMinSize}, + {512, HeapController::kMinSize}, {1 * GB, 256 * Heap::kPointerMultiplier}, {2 * static_cast<uint64_t>(GB), 512 * Heap::kPointerMultiplier}, - {4 * static_cast<uint64_t>(GB), heap_controller.kMaxSize}, - {8 * static_cast<uint64_t>(GB), heap_controller.kMaxSize}}; + {4 * static_cast<uint64_t>(GB), HeapController::kMaxSize}, + {8 * static_cast<uint64_t>(GB), HeapController::kMaxSize}}; for (auto configuration : configurations) { ASSERT_EQ(configuration[1], diff --git a/deps/v8/test/unittests/heap/heap-unittest.cc b/deps/v8/test/unittests/heap/heap-unittest.cc index 3f08278d13..dd14e22d54 100644 --- a/deps/v8/test/unittests/heap/heap-unittest.cc +++ b/deps/v8/test/unittests/heap/heap-unittest.cc @@ -59,5 +59,17 @@ TEST_F(HeapTest, ASLR) { #endif // V8_TARGET_ARCH_X64 } +TEST_F(HeapTest, ExternalLimitDefault) { + Heap* heap = i_isolate()->heap(); + EXPECT_EQ(kExternalAllocationSoftLimit, heap->external_memory_limit_); +} + +TEST_F(HeapTest, ExternalLimitStaysAboveDefaultForExplicitHandling) { + v8_isolate()->AdjustAmountOfExternalAllocatedMemory(+10 * MB); + v8_isolate()->AdjustAmountOfExternalAllocatedMemory(-10 * MB); + Heap* heap = i_isolate()->heap(); + EXPECT_GE(heap->external_memory_limit_, kExternalAllocationSoftLimit); +} + } // namespace internal } // namespace v8 diff --git a/deps/v8/test/unittests/heap/item-parallel-job-unittest.cc b/deps/v8/test/unittests/heap/item-parallel-job-unittest.cc index adeae2b593..36d99a31ba 100644 --- a/deps/v8/test/unittests/heap/item-parallel-job-unittest.cc +++ b/deps/v8/test/unittests/heap/item-parallel-job-unittest.cc @@ -151,7 +151,7 @@ class TaskForDifferentItems; class BaseItem : public ItemParallelJob::Item { public: - virtual ~BaseItem() {} + ~BaseItem() override = default; virtual void ProcessItem(TaskForDifferentItems* task) = 0; }; @@ -162,7 +162,7 @@ class TaskForDifferentItems : public ItemParallelJob::Task { : ItemParallelJob::Task(isolate), processed_a_(processed_a), processed_b_(processed_b) {} - virtual ~TaskForDifferentItems() {} + ~TaskForDifferentItems() override = default; void RunInParallel() override { BaseItem* item = nullptr; @@ -182,13 +182,13 @@ class TaskForDifferentItems : public ItemParallelJob::Task { class ItemA : public BaseItem { public: - virtual ~ItemA() {} + ~ItemA() override = default; void ProcessItem(TaskForDifferentItems* task) override { task->ProcessA(); } }; class ItemB : public BaseItem { public: - virtual ~ItemB() {} + ~ItemB() override = default; void ProcessItem(TaskForDifferentItems* task) override { task->ProcessB(); } }; diff --git a/deps/v8/test/unittests/heap/spaces-unittest.cc b/deps/v8/test/unittests/heap/spaces-unittest.cc index d81b7e1413..5266e54e09 100644 --- a/deps/v8/test/unittests/heap/spaces-unittest.cc +++ b/deps/v8/test/unittests/heap/spaces-unittest.cc @@ -16,11 +16,11 @@ typedef TestWithIsolate SpacesTest; TEST_F(SpacesTest, CompactionSpaceMerge) { Heap* heap = i_isolate()->heap(); OldSpace* old_space = heap->old_space(); - EXPECT_TRUE(old_space != NULL); + EXPECT_TRUE(old_space != nullptr); CompactionSpace* compaction_space = new CompactionSpace(heap, OLD_SPACE, NOT_EXECUTABLE); - EXPECT_TRUE(compaction_space != NULL); + EXPECT_TRUE(compaction_space != nullptr); for (Page* p : *old_space) { // Unlink free lists from the main space to avoid reusing the memory for @@ -118,9 +118,9 @@ TEST_F(SpacesTest, WriteBarrierInNewSpaceFromSpace) { TEST_F(SpacesTest, CodeRangeAddressReuse) { CodeRangeAddressHint hint; // Create code ranges. - void* code_range1 = hint.GetAddressHint(100); - void* code_range2 = hint.GetAddressHint(200); - void* code_range3 = hint.GetAddressHint(100); + Address code_range1 = hint.GetAddressHint(100); + Address code_range2 = hint.GetAddressHint(200); + Address code_range3 = hint.GetAddressHint(100); // Since the addresses are random, we cannot check that they are different. @@ -129,14 +129,14 @@ TEST_F(SpacesTest, CodeRangeAddressReuse) { hint.NotifyFreedCodeRange(code_range2, 200); // The next two code ranges should reuse the freed addresses. - void* code_range4 = hint.GetAddressHint(100); + Address code_range4 = hint.GetAddressHint(100); EXPECT_EQ(code_range4, code_range1); - void* code_range5 = hint.GetAddressHint(200); + Address code_range5 = hint.GetAddressHint(200); EXPECT_EQ(code_range5, code_range2); // Free the third code range and check address reuse. hint.NotifyFreedCodeRange(code_range3, 100); - void* code_range6 = hint.GetAddressHint(100); + Address code_range6 = hint.GetAddressHint(100); EXPECT_EQ(code_range6, code_range3); } 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 5030d3897d..a2c8d94793 100644 --- a/deps/v8/test/unittests/interpreter/bytecode-array-builder-unittest.cc +++ b/deps/v8/test/unittests/interpreter/bytecode-array-builder-unittest.cc @@ -22,8 +22,8 @@ namespace interpreter { class BytecodeArrayBuilderTest : public TestWithIsolateAndZone { public: - BytecodeArrayBuilderTest() {} - ~BytecodeArrayBuilderTest() override {} + BytecodeArrayBuilderTest() = default; + ~BytecodeArrayBuilderTest() override = default; }; using ToBooleanMode = BytecodeArrayBuilder::ToBooleanMode; @@ -134,9 +134,12 @@ TEST_F(BytecodeArrayBuilderTest, AllBytecodesGenerated) { // Emit load / store property operations. builder.LoadNamedProperty(reg, name, load_slot.ToInt()) + .LoadNamedPropertyNoFeedback(reg, name) .LoadKeyedProperty(reg, keyed_load_slot.ToInt()) .StoreNamedProperty(reg, name, sloppy_store_slot.ToInt(), LanguageMode::kSloppy) + .StoreNamedPropertyNoFeedback(reg, name, LanguageMode::kStrict) + .StoreNamedPropertyNoFeedback(reg, name, LanguageMode::kSloppy) .StoreKeyedProperty(reg, reg, sloppy_keyed_store_slot.ToInt(), LanguageMode::kSloppy) .StoreNamedProperty(reg, name, strict_store_slot.ToInt(), @@ -194,7 +197,8 @@ TEST_F(BytecodeArrayBuilderTest, AllBytecodesGenerated) { .CallRuntime(Runtime::kIsArray, reg) .CallRuntimeForPair(Runtime::kLoadLookupSlotForCall, reg_list, pair) .CallJSRuntime(Context::OBJECT_CREATE, reg_list) - .CallWithSpread(reg, reg_list, 1); + .CallWithSpread(reg, reg_list, 1) + .CallNoFeedback(reg, reg_list); // Emit binary operator invocations. builder.BinaryOperation(Token::Value::ADD, reg, 1) @@ -375,6 +379,7 @@ TEST_F(BytecodeArrayBuilderTest, AllBytecodesGenerated) { .CreateRegExpLiteral(ast_factory.GetOneByteString("wide_literal"), 0, 0) .CreateArrayLiteral(0, 0, 0) .CreateEmptyArrayLiteral(0) + .CreateArrayFromIterable() .CreateObjectLiteral(0, 0, 0, reg) .CreateEmptyObjectLiteral() .CloneObject(reg, 0, 0); diff --git a/deps/v8/test/unittests/interpreter/bytecode-array-iterator-unittest.cc b/deps/v8/test/unittests/interpreter/bytecode-array-iterator-unittest.cc index f7c89e2869..69d0e96507 100644 --- a/deps/v8/test/unittests/interpreter/bytecode-array-iterator-unittest.cc +++ b/deps/v8/test/unittests/interpreter/bytecode-array-iterator-unittest.cc @@ -16,8 +16,8 @@ namespace interpreter { class BytecodeArrayIteratorTest : public TestWithIsolateAndZone { public: - BytecodeArrayIteratorTest() {} - ~BytecodeArrayIteratorTest() override {} + BytecodeArrayIteratorTest() = default; + ~BytecodeArrayIteratorTest() override = default; }; TEST_F(BytecodeArrayIteratorTest, IteratesBytecodeArray) { diff --git a/deps/v8/test/unittests/interpreter/bytecode-array-random-iterator-unittest.cc b/deps/v8/test/unittests/interpreter/bytecode-array-random-iterator-unittest.cc index 8d2cd4c501..71c79300f3 100644 --- a/deps/v8/test/unittests/interpreter/bytecode-array-random-iterator-unittest.cc +++ b/deps/v8/test/unittests/interpreter/bytecode-array-random-iterator-unittest.cc @@ -16,8 +16,8 @@ namespace interpreter { class BytecodeArrayRandomIteratorTest : public TestWithIsolateAndZone { public: - BytecodeArrayRandomIteratorTest() {} - ~BytecodeArrayRandomIteratorTest() override {} + BytecodeArrayRandomIteratorTest() = default; + ~BytecodeArrayRandomIteratorTest() override = default; }; TEST_F(BytecodeArrayRandomIteratorTest, InvalidBeforeStart) { diff --git a/deps/v8/test/unittests/interpreter/bytecode-array-writer-unittest.cc b/deps/v8/test/unittests/interpreter/bytecode-array-writer-unittest.cc index 5eb4d3be9a..7c01228936 100644 --- a/deps/v8/test/unittests/interpreter/bytecode-array-writer-unittest.cc +++ b/deps/v8/test/unittests/interpreter/bytecode-array-writer-unittest.cc @@ -34,7 +34,7 @@ class BytecodeArrayWriterUnittest : public TestWithIsolateAndZone { bytecode_array_writer_( zone(), &constant_array_builder_, SourcePositionTableBuilder::RECORD_SOURCE_POSITIONS) {} - ~BytecodeArrayWriterUnittest() override {} + ~BytecodeArrayWriterUnittest() override = default; void Write(Bytecode bytecode, BytecodeSourceInfo info = BytecodeSourceInfo()); void Write(Bytecode bytecode, uint32_t operand0, diff --git a/deps/v8/test/unittests/interpreter/bytecode-decoder-unittest.cc b/deps/v8/test/unittests/interpreter/bytecode-decoder-unittest.cc index 018263f06b..eb4fdbb745 100644 --- a/deps/v8/test/unittests/interpreter/bytecode-decoder-unittest.cc +++ b/deps/v8/test/unittests/interpreter/bytecode-decoder-unittest.cc @@ -49,10 +49,10 @@ TEST(BytecodeDecoder, DecodeBytecodeAndOperands) { 3, 0, " ForInPrepare r10-r12, [11]"}, - {{B(CallRuntime), U16(Runtime::FunctionId::kIsDate), R8(0), U8(0)}, + {{B(CallRuntime), U16(Runtime::FunctionId::kIsSmi), R8(0), U8(0)}, 5, 0, - " CallRuntime [IsDate], r0-r0"}, + " CallRuntime [IsSmi], r0-r0"}, {{B(Ldar), static_cast<uint8_t>(Register::FromParameterIndex(2, 3).ToOperand())}, 2, diff --git a/deps/v8/test/unittests/interpreter/bytecode-register-allocator-unittest.cc b/deps/v8/test/unittests/interpreter/bytecode-register-allocator-unittest.cc index b2c8b47c79..2ba28b2306 100644 --- a/deps/v8/test/unittests/interpreter/bytecode-register-allocator-unittest.cc +++ b/deps/v8/test/unittests/interpreter/bytecode-register-allocator-unittest.cc @@ -16,7 +16,7 @@ namespace interpreter { class BytecodeRegisterAllocatorTest : public TestWithIsolateAndZone { public: BytecodeRegisterAllocatorTest() : allocator_(0) {} - ~BytecodeRegisterAllocatorTest() override {} + ~BytecodeRegisterAllocatorTest() override = default; BytecodeRegisterAllocator* allocator() { return &allocator_; } diff --git a/deps/v8/test/unittests/interpreter/bytecode-register-optimizer-unittest.cc b/deps/v8/test/unittests/interpreter/bytecode-register-optimizer-unittest.cc index 9e3ceb140f..9879b2a84a 100644 --- a/deps/v8/test/unittests/interpreter/bytecode-register-optimizer-unittest.cc +++ b/deps/v8/test/unittests/interpreter/bytecode-register-optimizer-unittest.cc @@ -23,7 +23,7 @@ class BytecodeRegisterOptimizerTest Register output; }; - BytecodeRegisterOptimizerTest() {} + BytecodeRegisterOptimizerTest() = default; ~BytecodeRegisterOptimizerTest() override { delete register_allocator_; } void Initialize(int number_of_parameters, int number_of_locals) { diff --git a/deps/v8/test/unittests/interpreter/constant-array-builder-unittest.cc b/deps/v8/test/unittests/interpreter/constant-array-builder-unittest.cc index 59e228a29c..46bbb900c0 100644 --- a/deps/v8/test/unittests/interpreter/constant-array-builder-unittest.cc +++ b/deps/v8/test/unittests/interpreter/constant-array-builder-unittest.cc @@ -18,8 +18,8 @@ namespace interpreter { class ConstantArrayBuilderTest : public TestWithIsolateAndZone { public: - ConstantArrayBuilderTest() {} - ~ConstantArrayBuilderTest() override {} + ConstantArrayBuilderTest() = default; + ~ConstantArrayBuilderTest() override = default; static const size_t k8BitCapacity = ConstantArrayBuilder::k8BitCapacity; static const size_t k16BitCapacity = ConstantArrayBuilder::k16BitCapacity; diff --git a/deps/v8/test/unittests/interpreter/interpreter-assembler-unittest.h b/deps/v8/test/unittests/interpreter/interpreter-assembler-unittest.h index 669db93040..cec661b468 100644 --- a/deps/v8/test/unittests/interpreter/interpreter-assembler-unittest.h +++ b/deps/v8/test/unittests/interpreter/interpreter-assembler-unittest.h @@ -28,8 +28,8 @@ class InterpreterAssemblerTestState : public compiler::CodeAssemblerState { class InterpreterAssemblerTest : public TestWithIsolateAndZone { public: - InterpreterAssemblerTest() {} - ~InterpreterAssemblerTest() override {} + InterpreterAssemblerTest() = default; + ~InterpreterAssemblerTest() override = default; class InterpreterAssemblerForTest final : public InterpreterAssembler { public: diff --git a/deps/v8/test/unittests/libplatform/default-platform-unittest.cc b/deps/v8/test/unittests/libplatform/default-platform-unittest.cc index 031eb9efbd..cb219a4737 100644 --- a/deps/v8/test/unittests/libplatform/default-platform-unittest.cc +++ b/deps/v8/test/unittests/libplatform/default-platform-unittest.cc @@ -17,13 +17,15 @@ namespace default_platform_unittest { namespace { struct MockTask : public Task { - virtual ~MockTask() { Die(); } + // See issue v8:8185 + ~MockTask() /* override */ { Die(); } MOCK_METHOD0(Run, void()); MOCK_METHOD0(Die, void()); }; struct MockIdleTask : public IdleTask { - virtual ~MockIdleTask() { Die(); } + // See issue v8:8185 + ~MockIdleTask() /* override */ { Die(); } MOCK_METHOD1(Run, void(double deadline_in_seconds)); MOCK_METHOD0(Die, void()); }; @@ -242,10 +244,10 @@ class TestBackgroundTask : public Task { explicit TestBackgroundTask(base::Semaphore* sem, bool* executed) : sem_(sem), executed_(executed) {} - virtual ~TestBackgroundTask() { Die(); } + ~TestBackgroundTask() override { Die(); } MOCK_METHOD0(Die, void()); - void Run() { + void Run() override { *executed_ = true; sem_->Signal(); } diff --git a/deps/v8/test/unittests/libplatform/worker-thread-unittest.cc b/deps/v8/test/unittests/libplatform/worker-thread-unittest.cc index a42b37aa7c..0caad1ef22 100644 --- a/deps/v8/test/unittests/libplatform/worker-thread-unittest.cc +++ b/deps/v8/test/unittests/libplatform/worker-thread-unittest.cc @@ -17,7 +17,8 @@ namespace platform { namespace { struct MockTask : public Task { - virtual ~MockTask() { Die(); } + // See issue v8:8185 + ~MockTask() /* override */ { Die(); } MOCK_METHOD0(Run, void()); MOCK_METHOD0(Die, void()); }; diff --git a/deps/v8/test/unittests/object-unittest.cc b/deps/v8/test/unittests/object-unittest.cc index ad8d631961..505d76df8b 100644 --- a/deps/v8/test/unittests/object-unittest.cc +++ b/deps/v8/test/unittests/object-unittest.cc @@ -81,8 +81,8 @@ TEST(Object, StructListOrder) { 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##_TYPE; \ +#define TEST_STRUCT(TYPE, class, name) \ + current_type = InstanceType::TYPE; \ current = static_cast<int>(current_type); \ EXPECT_EQ(last + 1, current) \ << " STRUCT_LIST is not ordered: " \ diff --git a/deps/v8/test/unittests/objects/microtask-queue-unittest.cc b/deps/v8/test/unittests/objects/microtask-queue-unittest.cc new file mode 100644 index 0000000000..2b237ebc50 --- /dev/null +++ b/deps/v8/test/unittests/objects/microtask-queue-unittest.cc @@ -0,0 +1,55 @@ +// Copyright 2018 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/microtask-queue-inl.h" + +#include "test/unittests/test-utils.h" + +namespace v8 { +namespace internal { + +void NoopCallback(void*) {} + +class MicrotaskQueueTest : public TestWithIsolate { + public: + Handle<Microtask> NewMicrotask() { + MicrotaskCallback callback = &NoopCallback; + void* data = nullptr; + return factory()->NewCallbackTask( + factory()->NewForeign(reinterpret_cast<Address>(callback)), + factory()->NewForeign(reinterpret_cast<Address>(data))); + } +}; + +TEST_F(MicrotaskQueueTest, EnqueueMicrotask) { + Handle<MicrotaskQueue> microtask_queue = factory()->NewMicrotaskQueue(); + Handle<Microtask> microtask = NewMicrotask(); + + EXPECT_EQ(0, microtask_queue->pending_microtask_count()); + MicrotaskQueue::EnqueueMicrotask(isolate(), microtask_queue, microtask); + EXPECT_EQ(1, microtask_queue->pending_microtask_count()); + ASSERT_LE(1, microtask_queue->queue()->length()); + EXPECT_EQ(*microtask, microtask_queue->queue()->get(0)); + + std::vector<Handle<Microtask>> microtasks; + microtasks.push_back(microtask); + + // Queue microtasks until the reallocation happens. + int queue_capacity = microtask_queue->queue()->length(); + for (int i = 0; i < queue_capacity; ++i) { + microtask = NewMicrotask(); + MicrotaskQueue::EnqueueMicrotask(isolate(), microtask_queue, microtask); + microtasks.push_back(microtask); + } + + int num_tasks = static_cast<int>(microtasks.size()); + EXPECT_EQ(num_tasks, microtask_queue->pending_microtask_count()); + ASSERT_LE(num_tasks, microtask_queue->queue()->length()); + for (int i = 0; i < num_tasks; ++i) { + EXPECT_EQ(*microtasks[i], microtask_queue->queue()->get(i)); + } +} + +} // namespace internal +} // namespace v8 diff --git a/deps/v8/test/unittests/parser/preparser-unittest.cc b/deps/v8/test/unittests/parser/preparser-unittest.cc index f20fbb2cee..ee5590e3f1 100644 --- a/deps/v8/test/unittests/parser/preparser-unittest.cc +++ b/deps/v8/test/unittests/parser/preparser-unittest.cc @@ -13,7 +13,7 @@ namespace internal { class PreParserTest : public TestWithNativeContext { public: - PreParserTest() {} + PreParserTest() = default; private: DISALLOW_COPY_AND_ASSIGN(PreParserTest); diff --git a/deps/v8/test/unittests/register-configuration-unittest.cc b/deps/v8/test/unittests/register-configuration-unittest.cc index 0688a5e54e..f0da8a5b93 100644 --- a/deps/v8/test/unittests/register-configuration-unittest.cc +++ b/deps/v8/test/unittests/register-configuration-unittest.cc @@ -14,8 +14,8 @@ const MachineRepresentation kSimd128 = MachineRepresentation::kSimd128; class RegisterConfigurationUnitTest : public ::testing::Test { public: - RegisterConfigurationUnitTest() {} - virtual ~RegisterConfigurationUnitTest() {} + RegisterConfigurationUnitTest() = default; + ~RegisterConfigurationUnitTest() override = default; }; TEST_F(RegisterConfigurationUnitTest, BasicProperties) { diff --git a/deps/v8/test/unittests/run-all-unittests.cc b/deps/v8/test/unittests/run-all-unittests.cc index f353e83ecf..712770e9dc 100644 --- a/deps/v8/test/unittests/run-all-unittests.cc +++ b/deps/v8/test/unittests/run-all-unittests.cc @@ -11,18 +11,18 @@ namespace { class DefaultPlatformEnvironment final : public ::testing::Environment { public: - DefaultPlatformEnvironment() {} + DefaultPlatformEnvironment() = default; void SetUp() override { platform_ = v8::platform::NewDefaultPlatform( 0, v8::platform::IdleTaskSupport::kEnabled); - ASSERT_TRUE(platform_.get() != NULL); + ASSERT_TRUE(platform_.get() != nullptr); v8::V8::InitializePlatform(platform_.get()); ASSERT_TRUE(v8::V8::Initialize()); } void TearDown() override { - ASSERT_TRUE(platform_.get() != NULL); + ASSERT_TRUE(platform_.get() != nullptr); v8::V8::Dispose(); v8::V8::ShutdownPlatform(); } diff --git a/deps/v8/test/unittests/source-position-table-unittest.cc b/deps/v8/test/unittests/source-position-table-unittest.cc index 1ad6dec006..23fd1a95d2 100644 --- a/deps/v8/test/unittests/source-position-table-unittest.cc +++ b/deps/v8/test/unittests/source-position-table-unittest.cc @@ -14,8 +14,8 @@ namespace interpreter { class SourcePositionTableTest : public TestWithIsolate { public: - SourcePositionTableTest() {} - ~SourcePositionTableTest() override {} + SourcePositionTableTest() = default; + ~SourcePositionTableTest() override = default; SourcePosition toPos(int offset) { return SourcePosition(offset, offset % 10 - 1); diff --git a/deps/v8/test/unittests/test-helpers.cc b/deps/v8/test/unittests/test-helpers.cc index c771906dc2..1ff25337e4 100644 --- a/deps/v8/test/unittests/test-helpers.cc +++ b/deps/v8/test/unittests/test-helpers.cc @@ -6,10 +6,13 @@ #include "include/v8.h" #include "src/api.h" +#include "src/base/template-utils.h" #include "src/handles.h" #include "src/isolate.h" #include "src/objects-inl.h" #include "src/objects.h" +#include "src/parsing/scanner-character-streams.h" +#include "src/parsing/scanner.h" namespace v8 { namespace internal { @@ -17,13 +20,13 @@ namespace test { Handle<String> CreateSource(Isolate* isolate, ExternalOneByteString::Resource* maybe_resource) { - static const char test_script[] = "(x) { x*x; }"; - if (maybe_resource) { - return isolate->factory() - ->NewExternalStringFromOneByte(maybe_resource) - .ToHandleChecked(); + if (!maybe_resource) { + static const char test_script[] = "(x) { x*x; }"; + maybe_resource = new test::ScriptResource(test_script, strlen(test_script)); } - return isolate->factory()->NewStringFromAsciiChecked(test_script); + return isolate->factory() + ->NewExternalStringFromOneByte(maybe_resource) + .ToHandleChecked(); } Handle<SharedFunctionInfo> CreateSharedFunctionInfo( @@ -51,6 +54,23 @@ Handle<SharedFunctionInfo> CreateSharedFunctionInfo( return scope.CloseAndEscape(shared); } +std::unique_ptr<ParseInfo> OuterParseInfoForShared( + Isolate* isolate, Handle<SharedFunctionInfo> shared) { + Handle<Script> script = + Handle<Script>::cast(handle(shared->script(), isolate)); + std::unique_ptr<ParseInfo> result = + base::make_unique<ParseInfo>(isolate, script); + + // Create a character stream to simulate the parser having done so for the + // to-level ParseProgram. + Handle<String> source(String::cast(script->source()), isolate); + std::unique_ptr<Utf16CharacterStream> stream( + ScannerStream::For(isolate, source)); + result->set_character_stream(std::move(stream)); + + return result; +} + } // namespace test } // namespace internal } // namespace v8 diff --git a/deps/v8/test/unittests/test-helpers.h b/deps/v8/test/unittests/test-helpers.h index 223b22e38e..fadc0c3e2b 100644 --- a/deps/v8/test/unittests/test-helpers.h +++ b/deps/v8/test/unittests/test-helpers.h @@ -46,6 +46,8 @@ Handle<String> CreateSource( Handle<SharedFunctionInfo> CreateSharedFunctionInfo( Isolate* isolate, v8::String::ExternalOneByteStringResource* maybe_resource); +std::unique_ptr<ParseInfo> OuterParseInfoForShared( + Isolate* isolate, Handle<SharedFunctionInfo> shared); } // namespace test } // namespace internal diff --git a/deps/v8/test/unittests/test-utils.cc b/deps/v8/test/unittests/test-utils.cc index 2b099e0ea5..32f405764d 100644 --- a/deps/v8/test/unittests/test-utils.cc +++ b/deps/v8/test/unittests/test-utils.cc @@ -24,32 +24,28 @@ Isolate* TestWithIsolate::isolate_ = nullptr; TestWithIsolate::TestWithIsolate() : isolate_scope_(isolate()), handle_scope_(isolate()) {} - -TestWithIsolate::~TestWithIsolate() {} - +TestWithIsolate::~TestWithIsolate() = default; // static void TestWithIsolate::SetUpTestCase() { Test::SetUpTestCase(); - EXPECT_EQ(NULL, isolate_); - // Make BigInt64Array / BigUint64Array available for testing. - i::FLAG_harmony_bigint = true; + EXPECT_EQ(nullptr, isolate_); v8::Isolate::CreateParams create_params; array_buffer_allocator_ = v8::ArrayBuffer::Allocator::NewDefaultAllocator(); create_params.array_buffer_allocator = array_buffer_allocator_; isolate_ = v8::Isolate::New(create_params); - EXPECT_TRUE(isolate_ != NULL); + EXPECT_TRUE(isolate_ != nullptr); } // static void TestWithIsolate::TearDownTestCase() { - ASSERT_TRUE(isolate_ != NULL); + ASSERT_TRUE(isolate_ != nullptr); v8::Platform* platform = internal::V8::GetCurrentPlatform(); - ASSERT_TRUE(platform != NULL); + ASSERT_TRUE(platform != nullptr); while (platform::PumpMessageLoop(platform, isolate_)) continue; isolate_->Dispose(); - isolate_ = NULL; + isolate_ = nullptr; delete array_buffer_allocator_; Test::TearDownTestCase(); } @@ -64,10 +60,20 @@ Local<Value> TestWithIsolate::RunJS(const char* source) { return script->Run(isolate()->GetCurrentContext()).ToLocalChecked(); } +Local<Value> TestWithIsolate::RunJS( + String::ExternalOneByteStringResource* source) { + Local<Script> script = + v8::Script::Compile( + isolate()->GetCurrentContext(), + v8::String::NewExternalOneByte(isolate(), source).ToLocalChecked()) + .ToLocalChecked(); + return script->Run(isolate()->GetCurrentContext()).ToLocalChecked(); +} + TestWithContext::TestWithContext() : context_(Context::New(isolate())), context_scope_(context_) {} -TestWithContext::~TestWithContext() {} +TestWithContext::~TestWithContext() = default; v8::Local<v8::String> TestWithContext::NewString(const char* string) { return v8::String::NewFromUtf8(v8_isolate(), string, @@ -85,9 +91,9 @@ void TestWithContext::SetGlobalProperty(const char* name, namespace internal { -TestWithIsolate::~TestWithIsolate() {} +TestWithIsolate::~TestWithIsolate() = default; -TestWithIsolateAndZone::~TestWithIsolateAndZone() {} +TestWithIsolateAndZone::~TestWithIsolateAndZone() = default; Factory* TestWithIsolate::factory() const { return isolate()->factory(); } @@ -95,13 +101,18 @@ Handle<Object> TestWithIsolate::RunJSInternal(const char* source) { return Utils::OpenHandle(*::v8::TestWithIsolate::RunJS(source)); } +Handle<Object> TestWithIsolate::RunJSInternal( + ::v8::String::ExternalOneByteStringResource* source) { + return Utils::OpenHandle(*::v8::TestWithIsolate::RunJS(source)); +} + base::RandomNumberGenerator* TestWithIsolate::random_number_generator() const { return isolate()->random_number_generator(); } -TestWithZone::~TestWithZone() {} +TestWithZone::~TestWithZone() = default; -TestWithNativeContext::~TestWithNativeContext() {} +TestWithNativeContext::~TestWithNativeContext() = default; Handle<Context> TestWithNativeContext::native_context() const { return isolate()->native_context(); diff --git a/deps/v8/test/unittests/test-utils.h b/deps/v8/test/unittests/test-utils.h index c361810219..289ef5edf2 100644 --- a/deps/v8/test/unittests/test-utils.h +++ b/deps/v8/test/unittests/test-utils.h @@ -26,7 +26,7 @@ class ArrayBufferAllocator; class TestWithIsolate : public virtual ::testing::Test { public: TestWithIsolate(); - virtual ~TestWithIsolate(); + ~TestWithIsolate() override; v8::Isolate* isolate() const { return v8_isolate(); } @@ -37,6 +37,7 @@ class TestWithIsolate : public virtual ::testing::Test { } Local<Value> RunJS(const char* source); + Local<Value> RunJS(String::ExternalOneByteStringResource* source); static void SetUpTestCase(); static void TearDownTestCase(); @@ -55,7 +56,7 @@ class TestWithIsolate : public virtual ::testing::Test { class TestWithContext : public virtual v8::TestWithIsolate { public: TestWithContext(); - virtual ~TestWithContext(); + ~TestWithContext() override; const Local<Context>& context() const { return v8_context(); } const Local<Context>& v8_context() const { return context_; } @@ -78,8 +79,8 @@ class Factory; class TestWithIsolate : public virtual ::v8::TestWithIsolate { public: - TestWithIsolate() {} - virtual ~TestWithIsolate(); + TestWithIsolate() = default; + ~TestWithIsolate() override; Factory* factory() const; Isolate* isolate() const { return i_isolate(); } @@ -88,6 +89,13 @@ class TestWithIsolate : public virtual ::v8::TestWithIsolate { return Handle<T>::cast(RunJSInternal(source)); } Handle<Object> RunJSInternal(const char* source); + template <typename T = Object> + Handle<T> RunJS(::v8::String::ExternalOneByteStringResource* source) { + return Handle<T>::cast(RunJSInternal(source)); + } + Handle<Object> RunJSInternal( + ::v8::String::ExternalOneByteStringResource* source); + base::RandomNumberGenerator* random_number_generator() const; private: @@ -97,7 +105,7 @@ class TestWithIsolate : public virtual ::v8::TestWithIsolate { class TestWithZone : public virtual ::testing::Test { public: TestWithZone() : zone_(&allocator_, ZONE_NAME) {} - virtual ~TestWithZone(); + ~TestWithZone() override; Zone* zone() { return &zone_; } @@ -111,7 +119,7 @@ class TestWithZone : public virtual ::testing::Test { class TestWithIsolateAndZone : public virtual TestWithIsolate { public: TestWithIsolateAndZone() : zone_(&allocator_, ZONE_NAME) {} - virtual ~TestWithIsolateAndZone(); + ~TestWithIsolateAndZone() override; Zone* zone() { return &zone_; } @@ -125,8 +133,8 @@ class TestWithIsolateAndZone : public virtual TestWithIsolate { class TestWithNativeContext : public virtual ::v8::TestWithContext, public virtual TestWithIsolate { public: - TestWithNativeContext() {} - virtual ~TestWithNativeContext(); + TestWithNativeContext() = default; + ~TestWithNativeContext() override; Handle<Context> native_context() const; diff --git a/deps/v8/test/unittests/unittests.status b/deps/v8/test/unittests/unittests.status index d44d4b4e33..f0eef446d1 100644 --- a/deps/v8/test/unittests/unittests.status +++ b/deps/v8/test/unittests/unittests.status @@ -15,4 +15,9 @@ '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' ] diff --git a/deps/v8/test/unittests/value-serializer-unittest.cc b/deps/v8/test/unittests/value-serializer-unittest.cc index 77f609052a..2cc0bdc8a6 100644 --- a/deps/v8/test/unittests/value-serializer-unittest.cc +++ b/deps/v8/test/unittests/value-serializer-unittest.cc @@ -58,7 +58,7 @@ class ValueSerializerTest : public TestWithIsolate { isolate_ = reinterpret_cast<i::Isolate*>(isolate()); } - ~ValueSerializerTest() { + ~ValueSerializerTest() override { // In some cases unhandled scheduled exceptions from current test produce // that Context::New(isolate()) from next test's constructor returns NULL. // In order to prevent that, we added destructor which will clear scheduled @@ -228,7 +228,7 @@ class ValueSerializerTest : public TestWithIsolate { Local<Script> script = Script::Compile(deserialization_context_, source).ToLocalChecked(); Local<Value> value = script->Run(deserialization_context_).ToLocalChecked(); - EXPECT_TRUE(value->BooleanValue(deserialization_context_).FromJust()); + EXPECT_TRUE(value->BooleanValue(isolate())); } Local<String> StringFromUtf8(const char* source) { @@ -1870,6 +1870,22 @@ TEST_F(ValueSerializerTest, DecodeDataView) { ExpectScriptTrue("Object.getPrototypeOf(result) === DataView.prototype"); } +TEST_F(ValueSerializerTest, DecodeArrayWithLengthProperty1) { + ASSERT_DEATH_IF_SUPPORTED( + DecodeTest({0xff, 0x0d, 0x41, 0x03, 0x49, 0x02, 0x49, 0x04, + 0x49, 0x06, 0x22, 0x06, 0x6c, 0x65, 0x6e, 0x67, + 0x74, 0x68, 0x49, 0x02, 0x24, 0x01, 0x03}), + ".*LookupIterator::NOT_FOUND == it.state\\(\\).*"); +} + +TEST_F(ValueSerializerTest, DecodeArrayWithLengthProperty2) { + ASSERT_DEATH_IF_SUPPORTED( + DecodeTest({0xff, 0x0d, 0x41, 0x03, 0x49, 0x02, 0x49, 0x04, + 0x49, 0x06, 0x22, 0x06, 0x6c, 0x65, 0x6e, 0x67, + 0x74, 0x68, 0x6f, 0x7b, 0x00, 0x24, 0x01, 0x03}), + ".*LookupIterator::NOT_FOUND == it.state\\(\\).*"); +} + TEST_F(ValueSerializerTest, DecodeInvalidDataView) { // Byte offset out of range. InvalidDecodeTest( diff --git a/deps/v8/test/unittests/wasm/decoder-unittest.cc b/deps/v8/test/unittests/wasm/decoder-unittest.cc index 627a9da3ee..e2a7bcc388 100644 --- a/deps/v8/test/unittests/wasm/decoder-unittest.cc +++ b/deps/v8/test/unittests/wasm/decoder-unittest.cc @@ -674,7 +674,7 @@ TEST_F(DecoderTest, ReadI64v_extra_bits_positive) { } TEST_F(DecoderTest, FailOnNullData) { - decoder.Reset(nullptr, 0); + decoder.Reset(nullptr, nullptr); decoder.checkAvailable(1); EXPECT_FALSE(decoder.ok()); EXPECT_FALSE(decoder.toResult(nullptr).ok()); 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 771c61e237..31e4a12ae7 100644 --- a/deps/v8/test/unittests/wasm/function-body-decoder-unittest.cc +++ b/deps/v8/test/unittests/wasm/function-body-decoder-unittest.cc @@ -2403,34 +2403,29 @@ TEST_F(FunctionBodyDecoderTest, Throw) { WASM_FEATURE_SCOPE(eh); TestModuleBuilder builder; module = builder.module(); - - builder.AddException(sigs.v_v()); - builder.AddException(sigs.v_i()); - AddLocals(kWasmI32, 1); - - EXPECT_VERIFIES(v_v, kExprThrow, 0); - - // exception index out of range. - EXPECT_FAILURE(v_v, kExprThrow, 2); - - EXPECT_VERIFIES(v_v, WASM_I32V(0), kExprThrow, 1); - - // TODO(kschimpf): Add more tests. + byte ex1 = builder.AddException(sigs.v_v()); + byte ex2 = builder.AddException(sigs.v_i()); + byte ex3 = builder.AddException(sigs.v_ii()); + EXPECT_VERIFIES(v_v, kExprThrow, ex1); + EXPECT_VERIFIES(v_v, WASM_I32V(0), kExprThrow, ex2); + EXPECT_FAILURE(v_v, WASM_F32(0.0), kExprThrow, ex2); + EXPECT_VERIFIES(v_v, WASM_I32V(0), WASM_I32V(0), kExprThrow, ex3); + EXPECT_FAILURE(v_v, WASM_F32(0.0), WASM_I32V(0), kExprThrow, ex3); + EXPECT_FAILURE(v_v, kExprThrow, 99); } TEST_F(FunctionBodyDecoderTest, ThrowUnreachable) { - // TODO(titzer): unreachable code after throw should validate. WASM_FEATURE_SCOPE(eh); TestModuleBuilder builder; module = builder.module(); - - builder.AddException(sigs.v_v()); - builder.AddException(sigs.v_i()); - AddLocals(kWasmI32, 1); - EXPECT_VERIFIES(i_i, kExprThrow, 0, WASM_GET_LOCAL(0)); - - // TODO(kschimpf): Add more (block-level) tests of unreachable to see - // if they validate. + byte ex1 = builder.AddException(sigs.v_v()); + byte ex2 = builder.AddException(sigs.v_i()); + EXPECT_VERIFIES(i_i, WASM_GET_LOCAL(0), kExprThrow, ex1, WASM_NOP); + EXPECT_VERIFIES(v_i, WASM_GET_LOCAL(0), kExprThrow, ex2, WASM_NOP); + EXPECT_VERIFIES(i_i, WASM_GET_LOCAL(0), kExprThrow, ex1, WASM_ZERO); + EXPECT_FAILURE(v_i, WASM_GET_LOCAL(0), kExprThrow, ex2, WASM_ZERO); + EXPECT_FAILURE(i_i, WASM_GET_LOCAL(0), kExprThrow, ex1, WASM_F32(0.0)); + EXPECT_FAILURE(v_i, WASM_GET_LOCAL(0), kExprThrow, ex2, WASM_F32(0.0)); } #define WASM_TRY_OP kExprTry, kLocalVoid @@ -2438,24 +2433,30 @@ TEST_F(FunctionBodyDecoderTest, ThrowUnreachable) { TEST_F(FunctionBodyDecoderTest, TryCatch) { WASM_FEATURE_SCOPE(eh); - TestModuleBuilder builder; module = builder.module(); - builder.AddException(sigs.v_v()); - builder.AddException(sigs.v_v()); - - // TODO(kschimpf): Need to fix catch to use declared exception. - EXPECT_VERIFIES(v_v, WASM_TRY_OP, WASM_CATCH(0), kExprEnd); - - // Missing catch. - EXPECT_FAILURE(v_v, WASM_TRY_OP, kExprEnd); + byte ex1 = builder.AddException(sigs.v_v()); + byte ex2 = builder.AddException(sigs.v_v()); + EXPECT_VERIFIES(v_v, WASM_TRY_OP, WASM_CATCH(ex1), kExprEnd); + EXPECT_FAILURE(v_v, WASM_TRY_OP, kExprEnd); // Missing catch. + EXPECT_FAILURE(v_v, WASM_TRY_OP, WASM_CATCH(ex1)); // Missing end. + EXPECT_FAILURE(v_v, WASM_CATCH(ex1), kExprEnd); // Missing try. - // Missing end. - EXPECT_FAILURE(v_i, WASM_TRY_OP, WASM_CATCH(0)); + // TODO(mstarzinger): Double catch. Fix this to verify. + EXPECT_FAILURE(v_v, WASM_TRY_OP, WASM_CATCH(ex1), WASM_CATCH(ex2), kExprEnd); +} - // Double catch. - // TODO(kschimpf): Fix this to verify. - EXPECT_FAILURE(v_i, WASM_TRY_OP, WASM_CATCH(0), WASM_CATCH(1), kExprEnd); +TEST_F(FunctionBodyDecoderTest, TryCatchAll) { + WASM_FEATURE_SCOPE(eh); + TestModuleBuilder builder; + module = builder.module(); + byte ex1 = builder.AddException(sigs.v_v()); + EXPECT_VERIFIES(v_v, WASM_TRY_OP, kExprCatchAll, kExprEnd); + EXPECT_VERIFIES(v_v, WASM_TRY_OP, WASM_CATCH(ex1), kExprCatchAll, kExprEnd); + EXPECT_FAILURE(v_v, WASM_TRY_OP, kExprCatchAll, kExprCatchAll, kExprEnd); + EXPECT_FAILURE(v_v, WASM_TRY_OP, kExprCatchAll, WASM_CATCH(ex1), kExprEnd); + EXPECT_FAILURE(v_v, WASM_TRY_OP, kExprCatchAll); // Missing end. + EXPECT_FAILURE(v_v, kExprCatchAll, kExprEnd); // Missing try. } #undef WASM_TRY_OP @@ -3132,6 +3133,20 @@ TEST_F(LocalDeclDecoderTest, UseEncoder) { pos = ExpectRun(map, pos, kWasmI64, 212); } +TEST_F(LocalDeclDecoderTest, ExceptRef) { + WASM_FEATURE_SCOPE(eh); + ValueType type = kWasmExceptRef; + const byte data[] = {1, 1, + static_cast<byte>(ValueTypes::ValueTypeCodeFor(type))}; + BodyLocalDecls decls(zone()); + bool result = DecodeLocalDecls(&decls, data, data + sizeof(data)); + EXPECT_TRUE(result); + EXPECT_EQ(1u, decls.type_list.size()); + + TypesOfLocals map = decls.type_list; + EXPECT_EQ(type, map[0]); +} + class BytecodeIteratorTest : public TestWithZone {}; TEST_F(BytecodeIteratorTest, SimpleForeach) { diff --git a/deps/v8/test/unittests/wasm/module-decoder-unittest.cc b/deps/v8/test/unittests/wasm/module-decoder-unittest.cc index 3507f897f9..83876b3e0f 100644 --- a/deps/v8/test/unittests/wasm/module-decoder-unittest.cc +++ b/deps/v8/test/unittests/wasm/module-decoder-unittest.cc @@ -61,7 +61,7 @@ namespace module_decoder_unittest { ModuleResult result = DecodeModule((data), (data) + sizeof((data))); \ EXPECT_FALSE(result.ok()); \ EXPECT_EQ(0u, result.val->exceptions.size()); \ - } while (0) + } while (false) #define X1(...) __VA_ARGS__ #define X2(...) __VA_ARGS__, __VA_ARGS__ @@ -207,7 +207,7 @@ TEST_F(WasmModuleVerifyTest, WrongVersion) { } TEST_F(WasmModuleVerifyTest, DecodeEmpty) { - ModuleResult result = DecodeModule(nullptr, 0); + ModuleResult result = DecodeModule(nullptr, nullptr); EXPECT_TRUE(result.ok()); } @@ -476,11 +476,9 @@ TEST_F(WasmModuleVerifyTest, ZeroExceptions) { } TEST_F(WasmModuleVerifyTest, OneI32Exception) { - static const byte data[] = { - SECTION_EXCEPTIONS(3), 1, - // except[0] (i32) - 1, kLocalI32, - }; + static const byte data[] = {SECTION_EXCEPTIONS(3), 1, + // except[0] (i32) + 1, kLocalI32}; FAIL_IF_NO_EXPERIMENTAL_EH(data); WASM_FEATURE_SCOPE(eh); @@ -525,6 +523,70 @@ TEST_F(WasmModuleVerifyTest, Exception_invalid_type) { EXPECT_FALSE(result.ok()); } +TEST_F(WasmModuleVerifyTest, ExceptionSectionCorrectPlacement) { + static const byte data[] = {SECTION(Import, 1), 0, SECTION_EXCEPTIONS(1), 0, + SECTION(Export, 1), 0}; + FAIL_IF_NO_EXPERIMENTAL_EH(data); + + WASM_FEATURE_SCOPE(eh); + ModuleResult result = DecodeModule(data, data + sizeof(data)); + EXPECT_OK(result); +} + +TEST_F(WasmModuleVerifyTest, ExceptionSectionAfterExport) { + static const byte data[] = {SECTION(Export, 1), 0, SECTION_EXCEPTIONS(1), 0}; + FAIL_IF_NO_EXPERIMENTAL_EH(data); + + WASM_FEATURE_SCOPE(eh); + ModuleResult result = DecodeModule(data, data + sizeof(data)); + EXPECT_FALSE(result.ok()); +} + +TEST_F(WasmModuleVerifyTest, ExceptionSectionBeforeImport) { + static const byte data[] = {SECTION_EXCEPTIONS(1), 0, SECTION(Import, 1), 0}; + FAIL_IF_NO_EXPERIMENTAL_EH(data); + + WASM_FEATURE_SCOPE(eh); + ModuleResult result = DecodeModule(data, data + sizeof(data)); + EXPECT_FALSE(result.ok()); +} + +TEST_F(WasmModuleVerifyTest, ExceptionImport) { + static const byte data[] = {SECTION(Import, 9), // section header + 1, // number of imports + NAME_LENGTH(1), // -- + 'm', // module name + NAME_LENGTH(2), // -- + 'e', 'x', // exception name + kExternalException, // import kind + // except[0] (i32) + 1, kLocalI32}; + FAIL_IF_NO_EXPERIMENTAL_EH(data); + + WASM_FEATURE_SCOPE(eh); + ModuleResult result = DecodeModule(data, data + sizeof(data)); + EXPECT_OK(result); + EXPECT_EQ(1u, result.val->exceptions.size()); + EXPECT_EQ(1u, result.val->import_table.size()); +} + +TEST_F(WasmModuleVerifyTest, ExceptionExport) { + static const byte data[] = {SECTION_EXCEPTIONS(3), 1, + // except[0] (i32) + 1, kLocalI32, SECTION(Export, 4), + 1, // exports + NO_NAME, // -- + kExternalException, // -- + EXCEPTION_INDEX(0)}; + FAIL_IF_NO_EXPERIMENTAL_EH(data); + + WASM_FEATURE_SCOPE(eh); + ModuleResult result = DecodeModule(data, data + sizeof(data)); + EXPECT_OK(result); + EXPECT_EQ(1u, result.val->exceptions.size()); + EXPECT_EQ(1u, result.val->export_table.size()); +} + TEST_F(WasmModuleVerifyTest, OneSignature) { { static const byte data[] = {SIGNATURES_SECTION_VOID_VOID}; @@ -2068,7 +2130,7 @@ TEST_F(WasmModuleVerifyTest, Regression684855) { class WasmInitExprDecodeTest : public TestWithZone { public: - WasmInitExprDecodeTest() {} + WasmInitExprDecodeTest() = default; WasmFeatures enabled_features_; @@ -2223,6 +2285,81 @@ TEST_F(WasmModuleCustomSectionTest, TwoKnownTwoUnknownSections) { CheckSections(data, data + sizeof(data), expected, arraysize(expected)); } +#define SRC_MAP \ + 16, 's', 'o', 'u', 'r', 'c', 'e', 'M', 'a', 'p', 'p', 'i', 'n', 'g', 'U', \ + 'R', 'L' +TEST_F(WasmModuleVerifyTest, SourceMappingURLSection) { +#define SRC 's', 'r', 'c', '/', 'x', 'y', 'z', '.', 'c' + static const byte data[] = {SECTION(Unknown, 27), SRC_MAP, 9, SRC}; + ModuleResult result = DecodeModule(data, data + sizeof(data)); + EXPECT_TRUE(result.ok()); + EXPECT_EQ(9u, result.val->source_map_url.size()); + const char src[] = {SRC}; + EXPECT_EQ( + 0, + strncmp(reinterpret_cast<const char*>(result.val->source_map_url.data()), + src, 9)); +#undef SRC +} + +TEST_F(WasmModuleVerifyTest, BadSourceMappingURLSection) { +#define BAD_SRC 's', 'r', 'c', '/', 'x', 0xff, 'z', '.', 'c' + static const byte data[] = {SECTION(Unknown, 27), SRC_MAP, 9, BAD_SRC}; + ModuleResult result = DecodeModule(data, data + sizeof(data)); + EXPECT_TRUE(result.ok()); + EXPECT_EQ(0u, result.val->source_map_url.size()); +#undef BAD_SRC +} + +TEST_F(WasmModuleVerifyTest, MultipleSourceMappingURLSections) { +#define SRC 'a', 'b', 'c' + static const byte data[] = {SECTION(Unknown, 21), + SRC_MAP, + 3, + SRC, + SECTION(Unknown, 21), + SRC_MAP, + 3, + 'p', + 'q', + 'r'}; + ModuleResult result = DecodeModule(data, data + sizeof(data)); + EXPECT_TRUE(result.ok()); + EXPECT_EQ(3u, result.val->source_map_url.size()); + const char src[] = {SRC}; + EXPECT_EQ( + 0, + strncmp(reinterpret_cast<const char*>(result.val->source_map_url.data()), + src, 3)); +#undef SRC +} +#undef SRC_MAP + +TEST_F(WasmModuleVerifyTest, MultipleNameSections) { +#define NAME_SECTION 4, 'n', 'a', 'm', 'e' + static const byte data[] = {SECTION(Unknown, 11), + NAME_SECTION, + 0, + 4, + 3, + 'a', + 'b', + 'c', + SECTION(Unknown, 12), + NAME_SECTION, + 0, + 5, + 4, + 'p', + 'q', + 'r', + 's'}; + ModuleResult result = DecodeModule(data, data + sizeof(data)); + EXPECT_TRUE(result.ok()); + EXPECT_EQ(3u, result.val->name.length()); +#undef NAME_SECTION +} + #undef WASM_FEATURE_SCOPE #undef WASM_FEATURE_SCOPE_VAL #undef EXPECT_INIT_EXPR diff --git a/deps/v8/test/unittests/wasm/trap-handler-unittest.cc b/deps/v8/test/unittests/wasm/trap-handler-unittest.cc index 1b4ddf5bb0..07e3ca888d 100644 --- a/deps/v8/test/unittests/wasm/trap-handler-unittest.cc +++ b/deps/v8/test/unittests/wasm/trap-handler-unittest.cc @@ -23,7 +23,7 @@ void CrashOnPurpose() { *reinterpret_cast<volatile int*>(42); } // on failures. class SignalHandlerFallbackTest : public ::testing::Test { protected: - virtual void SetUp() { + void SetUp() override { struct sigaction action; action.sa_sigaction = SignalHandler; sigemptyset(&action.sa_mask); @@ -32,7 +32,7 @@ class SignalHandlerFallbackTest : public ::testing::Test { sigaction(SIGBUS, &action, &old_bus_action_); } - virtual void TearDown() { + void TearDown() override { // be a good citizen and restore the old signal handler. sigaction(SIGSEGV, &old_segv_action_, nullptr); sigaction(SIGBUS, &old_bus_action_, nullptr); 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 cc66f14d9c..5d695c8275 100644 --- a/deps/v8/test/unittests/wasm/wasm-code-manager-unittest.cc +++ b/deps/v8/test/unittests/wasm/wasm-code-manager-unittest.cc @@ -17,36 +17,34 @@ namespace wasm_heap_unittest { class DisjointAllocationPoolTest : public ::testing::Test { public: - Address A(size_t n) { return static_cast<Address>(n); } - void CheckLooksLike(const DisjointAllocationPool& mem, - std::vector<std::pair<size_t, size_t>> expectation); - void CheckLooksLike(AddressRange range, - std::pair<size_t, size_t> expectation); - DisjointAllocationPool Make(std::vector<std::pair<size_t, size_t>> model); + void CheckPool(const DisjointAllocationPool& mem, + std::initializer_list<base::AddressRegion> expected_regions); + void CheckRange(base::AddressRegion region1, base::AddressRegion region2); + DisjointAllocationPool Make( + std::initializer_list<base::AddressRegion> regions); }; -void DisjointAllocationPoolTest::CheckLooksLike( +void DisjointAllocationPoolTest::CheckPool( const DisjointAllocationPool& mem, - std::vector<std::pair<size_t, size_t>> expectation) { - const auto& ranges = mem.ranges(); - CHECK_EQ(ranges.size(), expectation.size()); - auto iter = expectation.begin(); - for (auto it = ranges.begin(), e = ranges.end(); it != e; ++it, ++iter) { - CheckLooksLike(*it, *iter); + std::initializer_list<base::AddressRegion> expected_regions) { + const auto& regions = mem.regions(); + CHECK_EQ(regions.size(), expected_regions.size()); + auto iter = expected_regions.begin(); + for (auto it = regions.begin(), e = regions.end(); it != e; ++it, ++iter) { + CHECK_EQ(*it, *iter); } } -void DisjointAllocationPoolTest::CheckLooksLike( - AddressRange range, std::pair<size_t, size_t> expectation) { - CHECK_EQ(range.start, A(expectation.first)); - CHECK_EQ(range.end, A(expectation.second)); +void DisjointAllocationPoolTest::CheckRange(base::AddressRegion region1, + base::AddressRegion region2) { + CHECK_EQ(region1, region2); } DisjointAllocationPool DisjointAllocationPoolTest::Make( - std::vector<std::pair<size_t, size_t>> model) { + std::initializer_list<base::AddressRegion> regions) { DisjointAllocationPool ret; - for (auto& pair : model) { - ret.Merge({A(pair.first), A(pair.second)}); + for (auto& region : regions) { + ret.Merge(region); } return ret; } @@ -54,90 +52,90 @@ DisjointAllocationPool DisjointAllocationPoolTest::Make( TEST_F(DisjointAllocationPoolTest, ConstructEmpty) { DisjointAllocationPool a; CHECK(a.IsEmpty()); - CheckLooksLike(a, {}); - a.Merge({1, 5}); - CheckLooksLike(a, {{1, 5}}); + CheckPool(a, {}); + a.Merge({1, 4}); + CheckPool(a, {{1, 4}}); } TEST_F(DisjointAllocationPoolTest, ConstructWithRange) { - DisjointAllocationPool a({1, 5}); + DisjointAllocationPool a({1, 4}); CHECK(!a.IsEmpty()); - CheckLooksLike(a, {{1, 5}}); + CheckPool(a, {{1, 4}}); } TEST_F(DisjointAllocationPoolTest, SimpleExtract) { - DisjointAllocationPool a = Make({{1, 5}}); - AddressRange b = a.Allocate(2); - CheckLooksLike(a, {{3, 5}}); - CheckLooksLike(b, {1, 3}); + DisjointAllocationPool a = Make({{1, 4}}); + base::AddressRegion b = a.Allocate(2); + CheckPool(a, {{3, 2}}); + CheckRange(b, {1, 2}); a.Merge(b); - CheckLooksLike(a, {{1, 5}}); - CHECK_EQ(a.ranges().size(), 1); - CHECK_EQ(a.ranges().front().start, A(1)); - CHECK_EQ(a.ranges().front().end, A(5)); + CheckPool(a, {{1, 4}}); + CHECK_EQ(a.regions().size(), 1); + CHECK_EQ(a.regions().front().begin(), 1); + CHECK_EQ(a.regions().front().end(), 5); } TEST_F(DisjointAllocationPoolTest, ExtractAll) { - DisjointAllocationPool a({A(1), A(5)}); - AddressRange b = a.Allocate(4); - CheckLooksLike(b, {1, 5}); + DisjointAllocationPool a({1, 4}); + base::AddressRegion b = a.Allocate(4); + CheckRange(b, {1, 4}); CHECK(a.IsEmpty()); a.Merge(b); - CheckLooksLike(a, {{1, 5}}); + CheckPool(a, {{1, 4}}); } TEST_F(DisjointAllocationPoolTest, FailToExtract) { - DisjointAllocationPool a = Make({{1, 5}}); - AddressRange b = a.Allocate(5); - CheckLooksLike(a, {{1, 5}}); + DisjointAllocationPool a = Make({{1, 4}}); + base::AddressRegion b = a.Allocate(5); + CheckPool(a, {{1, 4}}); CHECK(b.is_empty()); } TEST_F(DisjointAllocationPoolTest, FailToExtractExact) { - DisjointAllocationPool a = Make({{1, 5}, {10, 14}}); - AddressRange b = a.Allocate(5); - CheckLooksLike(a, {{1, 5}, {10, 14}}); + DisjointAllocationPool a = Make({{1, 4}, {10, 4}}); + base::AddressRegion b = a.Allocate(5); + CheckPool(a, {{1, 4}, {10, 4}}); CHECK(b.is_empty()); } TEST_F(DisjointAllocationPoolTest, ExtractExact) { - DisjointAllocationPool a = Make({{1, 5}, {10, 15}}); - AddressRange b = a.Allocate(5); - CheckLooksLike(a, {{1, 5}}); - CheckLooksLike(b, {10, 15}); + DisjointAllocationPool a = Make({{1, 4}, {10, 5}}); + base::AddressRegion b = a.Allocate(5); + CheckPool(a, {{1, 4}}); + CheckRange(b, {10, 5}); } TEST_F(DisjointAllocationPoolTest, Merging) { - DisjointAllocationPool a = Make({{10, 15}, {20, 25}}); - a.Merge({15, 20}); - CheckLooksLike(a, {{10, 25}}); + DisjointAllocationPool a = Make({{10, 5}, {20, 5}}); + a.Merge({15, 5}); + CheckPool(a, {{10, 15}}); } TEST_F(DisjointAllocationPoolTest, MergingMore) { - DisjointAllocationPool a = Make({{10, 15}, {20, 25}, {30, 35}}); - a.Merge({15, 20}); - a.Merge({25, 30}); - CheckLooksLike(a, {{10, 35}}); + DisjointAllocationPool a = Make({{10, 5}, {20, 5}, {30, 5}}); + a.Merge({15, 5}); + a.Merge({25, 5}); + CheckPool(a, {{10, 25}}); } TEST_F(DisjointAllocationPoolTest, MergingSkip) { - DisjointAllocationPool a = Make({{10, 15}, {20, 25}, {30, 35}}); - a.Merge({25, 30}); - CheckLooksLike(a, {{10, 15}, {20, 35}}); + DisjointAllocationPool a = Make({{10, 5}, {20, 5}, {30, 5}}); + a.Merge({25, 5}); + CheckPool(a, {{10, 5}, {20, 15}}); } TEST_F(DisjointAllocationPoolTest, MergingSkipLargerSrc) { - DisjointAllocationPool a = Make({{10, 15}, {20, 25}, {30, 35}}); - a.Merge({25, 30}); - a.Merge({35, 40}); - CheckLooksLike(a, {{10, 15}, {20, 40}}); + DisjointAllocationPool a = Make({{10, 5}, {20, 5}, {30, 5}}); + a.Merge({25, 5}); + a.Merge({35, 5}); + CheckPool(a, {{10, 5}, {20, 20}}); } TEST_F(DisjointAllocationPoolTest, MergingSkipLargerSrcWithGap) { - DisjointAllocationPool a = Make({{10, 15}, {20, 25}, {30, 35}}); - a.Merge({25, 30}); - a.Merge({36, 40}); - CheckLooksLike(a, {{10, 15}, {20, 35}, {36, 40}}); + DisjointAllocationPool a = Make({{10, 5}, {20, 5}, {30, 5}}); + a.Merge({25, 5}); + a.Merge({36, 4}); + CheckPool(a, {{10, 5}, {20, 15}, {36, 4}}); } enum ModuleStyle : int { Fixed = 0, Growable = 1 }; @@ -200,7 +198,7 @@ TEST_P(WasmCodeManagerTest, EmptyCase) { CHECK_EQ(0, manager.remaining_uncommitted_code_space()); ASSERT_DEATH_IF_SUPPORTED(AllocModule(&manager, 1 * page(), GetParam()), - "OOM in NativeModule::AddOwnedCode"); + "OOM in NativeModule::AllocateForCode commit"); } TEST_P(WasmCodeManagerTest, AllocateAndGoOverLimit) { @@ -223,9 +221,12 @@ TEST_P(WasmCodeManagerTest, AllocateAndGoOverLimit) { CHECK_NOT_NULL(code); CHECK_EQ(0, manager.remaining_uncommitted_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 NativeModule::AddOwnedCode"); + "OOM in NativeModule::AllocateForCode"); } TEST_P(WasmCodeManagerTest, TotalLimitIrrespectiveOfModuleCount) { @@ -237,7 +238,7 @@ TEST_P(WasmCodeManagerTest, TotalLimitIrrespectiveOfModuleCount) { WasmCode* code = AddCode(nm1.get(), 0, 2 * page() - kJumpTableSize); CHECK_NOT_NULL(code); ASSERT_DEATH_IF_SUPPORTED(AddCode(nm2.get(), 0, 2 * page() - kJumpTableSize), - "OOM in NativeModule::AddOwnedCode"); + "OOM in NativeModule::AllocateForCode commit"); } TEST_P(WasmCodeManagerTest, DifferentHeapsApplyLimitsIndependently) { @@ -264,7 +265,7 @@ TEST_P(WasmCodeManagerTest, GrowingVsFixedModule) { // grow. ASSERT_DEATH_IF_SUPPORTED( AddCode(nm.get(), 0, remaining_space_in_module + kCodeAlignment), - "OOM in NativeModule::AddOwnedCode"); + "OOM in NativeModule::AllocateForCode"); } else { // The module grows by one page. One page remains uncommitted. CHECK_NOT_NULL( diff --git a/deps/v8/test/unittests/wasm/wasm-module-builder-unittest.cc b/deps/v8/test/unittests/wasm/wasm-module-builder-unittest.cc index 28b35793f7..807fc40959 100644 --- a/deps/v8/test/unittests/wasm/wasm-module-builder-unittest.cc +++ b/deps/v8/test/unittests/wasm/wasm-module-builder-unittest.cc @@ -28,7 +28,7 @@ TEST_F(WasmModuleBuilderTest, Regression_647329) { // Test crashed with asan. ZoneBuffer buffer(zone()); const size_t kSize = ZoneBuffer::kInitialSize * 3 + 4096 + 100; - byte data[kSize]; + byte data[kSize] = {0}; buffer.write(data, kSize); } diff --git a/deps/v8/test/wasm-spec-tests/testcfg.py b/deps/v8/test/wasm-spec-tests/testcfg.py index 3571b62807..b8d8ed8bd8 100644 --- a/deps/v8/test/wasm-spec-tests/testcfg.py +++ b/deps/v8/test/wasm-spec-tests/testcfg.py @@ -26,7 +26,7 @@ class TestSuite(testsuite.TestSuite): return TestCase -class TestCase(testcase.TestCase): +class TestCase(testcase.D8TestCase): def _get_files_params(self): return [os.path.join(self.suite.root, self.path + self._get_suffix())] 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 1dd1c7217b..6bf33e90fb 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 @@ -7e2cdbd60dd1d10db95fb61b491ebf7b9f2c69e6
\ No newline at end of file +0df32ecb1ad4141cc082f2b5575d8f88f3ae8c53
\ No newline at end of file diff --git a/deps/v8/test/webkit/array-splice.js b/deps/v8/test/webkit/array-splice.js index 045e39e379..208847eaf9 100644 --- a/deps/v8/test/webkit/array-splice.js +++ b/deps/v8/test/webkit/array-splice.js @@ -54,8 +54,3 @@ shouldBe("arr.splice(2, -1)", "[]") shouldBe("arr", "['a','b','c']"); shouldBe("arr.splice(2, 100)", "['c']") shouldBe("arr", "['a','b']"); - -// Check this doesn't crash. -try { - String(Array(0xFFFFFFFD).splice(0)); -} catch (e) { } diff --git a/deps/v8/test/webkit/fast/js/toString-overrides-expected.txt b/deps/v8/test/webkit/fast/js/toString-overrides-expected.txt index 44bd2e7c36..16706e43dd 100644 --- a/deps/v8/test/webkit/fast/js/toString-overrides-expected.txt +++ b/deps/v8/test/webkit/fast/js/toString-overrides-expected.txt @@ -28,10 +28,10 @@ On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE PASS [1].toString() is '1' PASS [1].toLocaleString() is 'toLocaleString' -FAIL [1].toLocaleString() should be 1. Threw exception TypeError: string is not a function +FAIL [1].toLocaleString() should be 1. Threw exception TypeError: string "invalid" is not a function PASS [/r/].toString() is 'toString2' PASS [/r/].toLocaleString() is 'toLocaleString2' -FAIL [/r/].toLocaleString() should be toString2. Threw exception TypeError: string is not a function +FAIL [/r/].toLocaleString() should be toString2. Threw exception TypeError: string "invalid" is not a function PASS caught is true PASS successfullyParsed is true diff --git a/deps/v8/test/webkit/string-trim.js b/deps/v8/test/webkit/string-trim.js index fd9c1d1557..a6c08070cf 100644 --- a/deps/v8/test/webkit/string-trim.js +++ b/deps/v8/test/webkit/string-trim.js @@ -21,8 +21,6 @@ // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS // SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// Flags: --harmony-string-trimming - description("This test checks the `trim`, `trimStart`/`trimLeft`, and `trimEnd`/`trimRight` methods on `String.prototype`."); // References to trim(), trimLeft() and trimRight() functions for testing Function's *.call() and *.apply() methods diff --git a/deps/v8/test/webkit/testcfg.py b/deps/v8/test/webkit/testcfg.py index d76527276a..5d564b69bc 100644 --- a/deps/v8/test/webkit/testcfg.py +++ b/deps/v8/test/webkit/testcfg.py @@ -61,7 +61,7 @@ class TestSuite(testsuite.TestSuite): return TestCase -class TestCase(testcase.TestCase): +class TestCase(testcase.D8TestCase): def __init__(self, *args, **kwargs): super(TestCase, self).__init__(*args, **kwargs) diff --git a/deps/v8/test/webkit/webkit.status b/deps/v8/test/webkit/webkit.status index 412784d252..cc856007e2 100644 --- a/deps/v8/test/webkit/webkit.status +++ b/deps/v8/test/webkit/webkit.status @@ -116,10 +116,10 @@ }], # arch == arm64 and msan ############################################################################## -['(variant == nooptimization or variant == stress or variant == no_liftoff) and (arch == arm or arch == arm64) and simulator_run', { +['variant in [no_liftoff, nooptimization, stress, stress_background_compile] and (arch == arm or arch == arm64) and simulator_run', { # Slow tests: https://crbug.com/v8/7783 'dfg-double-vote-fuzz': [SKIP], -}], # (variant == nooptimization or variant == stress or variant == no_liftoff) and (arch == arm or arch == arm64) and simulator_run +}], # variant in [no_liftoff, nooptimization, stress, stress_background_compile] and (arch == arm or arch == arm64) and simulator_run ############################################################################## ['gcov_coverage', { |