diff options
author | Michaël Zasso <targos@protonmail.com> | 2018-03-07 08:54:53 +0100 |
---|---|---|
committer | Michaël Zasso <targos@protonmail.com> | 2018-03-07 16:48:52 +0100 |
commit | 88786fecff336342a56e6f2e7ff3b286be716e47 (patch) | |
tree | 92e6ba5b8ac8dae1a058988d20c9d27bfa654390 /deps/v8/test | |
parent | 4e86f9b5ab83cbabf43839385bf383e6a7ef7d19 (diff) | |
download | android-node-v8-88786fecff336342a56e6f2e7ff3b286be716e47.tar.gz android-node-v8-88786fecff336342a56e6f2e7ff3b286be716e47.tar.bz2 android-node-v8-88786fecff336342a56e6f2e7ff3b286be716e47.zip |
deps: update V8 to 6.5.254.31
PR-URL: https://github.com/nodejs/node/pull/18453
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Yang Guo <yangguo@chromium.org>
Reviewed-By: Ali Ijaz Sheikh <ofrobots@google.com>
Reviewed-By: Michael Dawson <michael_dawson@ca.ibm.com>
Diffstat (limited to 'deps/v8/test')
467 files changed, 23773 insertions, 14303 deletions
diff --git a/deps/v8/test/BUILD.gn b/deps/v8/test/BUILD.gn index 14fa27bffd..532a3ddaa2 100644 --- a/deps/v8/test/BUILD.gn +++ b/deps/v8/test/BUILD.gn @@ -28,6 +28,7 @@ group("gn_all") { ":benchmarks_run", ":bot_default_run", ":default_run", + ":d8_default_run", ":mozilla_run", "test262:test262_run", ] @@ -44,6 +45,7 @@ group("default_tests") { if (v8_test_isolation_mode != "noop") { deps = [ ":cctest_run", + ":debugger_run", ":fuzzer_run", ":inspector-test_run", ":intl_run", @@ -74,6 +76,19 @@ v8_isolate_run("default") { isolate = "default.isolate" } +v8_isolate_run("d8_default") { + deps = [ + ":debugger_run", + ":intl_run", + ":message_run", + ":mjsunit_run", + ":preparser_run", + ":webkit_run", + ] + + isolate = "d8_default.isolate" +} + v8_isolate_run("optimize_for_size") { deps = [ ":cctest_run", @@ -123,6 +138,14 @@ v8_isolate_run("cctest_exe") { isolate = "cctest/cctest_exe.isolate" } +v8_isolate_run("debugger") { + deps = [ + "..:d8_run", + ] + + isolate = "debugger/debugger.isolate" +} + v8_isolate_run("fuzzer") { deps = [ "..:v8_simple_json_fuzzer", diff --git a/deps/v8/test/benchmarks/testcfg.py b/deps/v8/test/benchmarks/testcfg.py index 63c0f9f1f8..fd956aa765 100644 --- a/deps/v8/test/benchmarks/testcfg.py +++ b/deps/v8/test/benchmarks/testcfg.py @@ -34,29 +34,18 @@ from testrunner.local import testsuite from testrunner.objects import testcase -class BenchmarksVariantGenerator(testsuite.VariantGenerator): - # Both --noopt and --stressopt are very slow. Add TF but without - # always opt to match the way the benchmarks are run for performance - # testing. - def FilterVariantsByTest(self, testcase): - outcomes = self.suite.GetStatusFileOutcomes(testcase) - if statusfile.OnlyStandardVariant(outcomes): - return self.standard_variant - return self.fast_variants +class VariantsGenerator(testsuite.VariantsGenerator): + def _get_variants(self, test): + return self._standard_variant - def GetFlagSets(self, testcase, variant): - return testsuite.FAST_VARIANT_FLAGS[variant] - - -class BenchmarksTestSuite(testsuite.TestSuite): +class TestSuite(testsuite.TestSuite): def __init__(self, name, root): - super(BenchmarksTestSuite, self).__init__(name, root) + super(TestSuite, self).__init__(name, root) self.testroot = os.path.join(root, "data") def ListTests(self, context): - tests = [] - for test in [ + tests = map(self._create_test, [ "kraken/ai-astar", "kraken/audio-beat-detection", "kraken/audio-dft", @@ -113,40 +102,47 @@ class BenchmarksTestSuite(testsuite.TestSuite): "sunspider/string-fasta", "sunspider/string-tagcloud", "sunspider/string-unpack-code", - "sunspider/string-validate-input"]: - tests.append(testcase.TestCase(self, test)) + "sunspider/string-validate-input", + ]) return tests - def GetParametersForTestCase(self, testcase, context): + def _test_class(self): + return TestCase + + def _variants_gen_class(self): + return VariantsGenerator + + def _LegacyVariantsGeneratorFactory(self): + return testsuite.StandardLegacyVariantsGenerator + + +class TestCase(testcase.TestCase): + def _get_files_params(self, ctx): + path = self.path + testroot = self.suite.testroot files = [] - if testcase.path.startswith("kraken"): - files.append(os.path.join(self.testroot, "%s-data.js" % testcase.path)) - files.append(os.path.join(self.testroot, "%s.js" % testcase.path)) - elif testcase.path.startswith("octane"): - files.append(os.path.join(self.testroot, "octane/base.js")) - files.append(os.path.join(self.testroot, "%s.js" % testcase.path)) - if testcase.path.startswith("octane/gbemu"): - files.append(os.path.join(self.testroot, "octane/gbemu-part2.js")) - elif testcase.path.startswith("octane/typescript"): - files.append(os.path.join(self.testroot, + if path.startswith("kraken"): + files.append(os.path.join(testroot, "%s-data.js" % path)) + files.append(os.path.join(testroot, "%s.js" % path)) + elif path.startswith("octane"): + files.append(os.path.join(testroot, "octane/base.js")) + files.append(os.path.join(testroot, "%s.js" % path)) + if path.startswith("octane/gbemu"): + files.append(os.path.join(testroot, "octane/gbemu-part2.js")) + elif path.startswith("octane/typescript"): + files.append(os.path.join(testroot, "octane/typescript-compiler.js")) - files.append(os.path.join(self.testroot, "octane/typescript-input.js")) - elif testcase.path.startswith("octane/zlib"): - files.append(os.path.join(self.testroot, "octane/zlib-data.js")) + files.append(os.path.join(testroot, "octane/typescript-input.js")) + elif path.startswith("octane/zlib"): + files.append(os.path.join(testroot, "octane/zlib-data.js")) files += ["-e", "BenchmarkSuite.RunSuites({});"] - elif testcase.path.startswith("sunspider"): - files.append(os.path.join(self.testroot, "%s.js" % testcase.path)) - - return files, testcase.flags + context.mode_flags, {} - - def GetSourceForTest(self, testcase): - filename = os.path.join(self.testroot, testcase.path + ".js") - with open(filename) as f: - return f.read() + elif path.startswith("sunspider"): + files.append(os.path.join(testroot, "%s.js" % path)) + return files - def _VariantGeneratorFactory(self): - return BenchmarksVariantGenerator + def _get_source_path(self): + return os.path.join(self.suite.testroot, self.path + self._get_suffix()) def GetSuite(name, root): - return BenchmarksTestSuite(name, root) + return TestSuite(name, root) diff --git a/deps/v8/test/bot_default.gyp b/deps/v8/test/bot_default.gyp index 13c77e2d03..11223e068f 100644 --- a/deps/v8/test/bot_default.gyp +++ b/deps/v8/test/bot_default.gyp @@ -11,6 +11,7 @@ 'type': 'none', 'dependencies': [ 'cctest/cctest.gyp:cctest_run', + 'debugger/debugger.gyp:debugger_run', 'fuzzer/fuzzer.gyp:fuzzer_run', 'inspector/inspector.gyp:inspector-test_run', 'intl/intl.gyp:intl_run', diff --git a/deps/v8/test/cctest/BUILD.gn b/deps/v8/test/cctest/BUILD.gn index ca81ef1f0d..b6c9109d75 100644 --- a/deps/v8/test/cctest/BUILD.gn +++ b/deps/v8/test/cctest/BUILD.gn @@ -82,8 +82,10 @@ v8_source_set("cctest_sources") { "compiler/test-run-load-store.cc", "compiler/test-run-machops.cc", "compiler/test-run-native-calls.cc", + "compiler/test-run-retpoline.cc", "compiler/test-run-stackcheck.cc", "compiler/test-run-stubs.cc", + "compiler/test-run-tail-calls.cc", "compiler/test-run-unwinding-info.cc", "compiler/test-run-variables.cc", "compiler/test-run-wasm-machops.cc", @@ -103,6 +105,7 @@ v8_source_set("cctest_sources") { "heap/test-array-buffer-tracker.cc", "heap/test-compaction.cc", "heap/test-concurrent-marking.cc", + "heap/test-embedder-tracing.cc", "heap/test-heap.cc", "heap/test-incremental-marking.cc", "heap/test-invalidated-slots.cc", diff --git a/deps/v8/test/cctest/assembler-helper-arm.cc b/deps/v8/test/cctest/assembler-helper-arm.cc index 73079ed701..3ba5f6018e 100644 --- a/deps/v8/test/cctest/assembler-helper-arm.cc +++ b/deps/v8/test/cctest/assembler-helper-arm.cc @@ -4,15 +4,15 @@ #include "test/cctest/assembler-helper-arm.h" +#include "src/assembler-inl.h" +#include "src/isolate-inl.h" #include "src/v8.h" #include "test/cctest/cctest.h" -#include "src/isolate-inl.h" - namespace v8 { namespace internal { -Address AssembleCode(std::function<void(Assembler&)> assemble) { +Handle<Code> AssembleCodeImpl(std::function<void(Assembler&)> assemble) { Isolate* isolate = CcTest::i_isolate(); Assembler assm(isolate, nullptr, 0); @@ -26,7 +26,7 @@ Address AssembleCode(std::function<void(Assembler&)> assemble) { if (FLAG_print_code) { code->Print(); } - return code->entry(); + return code; } } // namespace internal diff --git a/deps/v8/test/cctest/assembler-helper-arm.h b/deps/v8/test/cctest/assembler-helper-arm.h index dd24087bda..c0b0cf8255 100644 --- a/deps/v8/test/cctest/assembler-helper-arm.h +++ b/deps/v8/test/cctest/assembler-helper-arm.h @@ -7,20 +7,27 @@ #include <functional> -#include "src/macro-assembler.h" +#include "src/handles.h" +#include "src/simulator.h" namespace v8 { namespace internal { -// These function prototypes have 5 arguments since they are used with the -// CALL_GENERATED_CODE macro. -typedef Object* (*F_iiiii)(int x, int p1, int p2, int p3, int p4); -typedef Object* (*F_piiii)(void* p0, int p1, int p2, int p3, int p4); -typedef Object* (*F_ppiii)(void* p0, void* p1, int p2, int p3, int p4); -typedef Object* (*F_pppii)(void* p0, void* p1, void* p2, int p3, int p4); -typedef Object* (*F_ippii)(int p0, void* p1, void* p2, int p3, int p4); - -Address AssembleCode(std::function<void(Assembler&)> assemble); +// TODO(arm): Refine these signatures per test case, they can have arbitrary +// return and argument types and arbitrary number of arguments. +using F_iiiii = Object*(int x, int p1, int p2, int p3, int p4); +using F_piiii = Object*(void* p0, int p1, int p2, int p3, int p4); +using F_ppiii = Object*(void* p0, void* p1, int p2, int p3, int p4); +using F_pppii = Object*(void* p0, void* p1, void* p2, int p3, int p4); +using F_ippii = Object*(int p0, void* p1, void* p2, int p3, int p4); + +Handle<Code> AssembleCodeImpl(std::function<void(Assembler&)> assemble); + +template <typename Signature> +GeneratedCode<Signature> AssembleCode( + std::function<void(Assembler&)> assemble) { + return GeneratedCode<Signature>::FromCode(*AssembleCodeImpl(assemble)); +} } // namespace internal } // namespace v8 diff --git a/deps/v8/test/cctest/cctest.cc b/deps/v8/test/cctest/cctest.cc index 8d33884b5b..5daef0425b 100644 --- a/deps/v8/test/cctest/cctest.cc +++ b/deps/v8/test/cctest/cctest.cc @@ -269,7 +269,7 @@ int main(int argc, char* argv[]) { v8::V8::Initialize(); v8::V8::InitializeExternalStartupData(argv[0]); - if (i::trap_handler::UseTrapHandler()) { + if (i::trap_handler::IsTrapHandlerEnabled()) { v8::V8::RegisterDefaultSignalHandler(); } diff --git a/deps/v8/test/cctest/cctest.gyp b/deps/v8/test/cctest/cctest.gyp index 92c64b8c87..5124495ee8 100644 --- a/deps/v8/test/cctest/cctest.gyp +++ b/deps/v8/test/cctest/cctest.gyp @@ -71,8 +71,10 @@ 'compiler/test-run-load-store.cc', 'compiler/test-run-machops.cc', 'compiler/test-run-native-calls.cc', + 'compiler/test-run-retpoline.cc', 'compiler/test-run-stackcheck.cc', 'compiler/test-run-stubs.cc', + 'compiler/test-run-tail-calls.cc', 'compiler/test-run-variables.cc', 'compiler/test-run-wasm-machops.cc', 'compiler/value-helper.cc', @@ -93,6 +95,7 @@ 'heap/test-array-buffer-tracker.cc', 'heap/test-compaction.cc', 'heap/test-concurrent-marking.cc', + 'heap/test-embedder-tracing.cc', 'heap/test-heap.cc', 'heap/test-incremental-marking.cc', 'heap/test-invalidated-slots.cc', diff --git a/deps/v8/test/cctest/cctest.h b/deps/v8/test/cctest/cctest.h index 8a7b6d1462..37c4c0cfac 100644 --- a/deps/v8/test/cctest/cctest.h +++ b/deps/v8/test/cctest/cctest.h @@ -571,16 +571,22 @@ static inline void CheckDoubleEquals(double expected, double actual) { static inline uint8_t* AllocateAssemblerBuffer( size_t* allocated, size_t requested = v8::internal::AssemblerBase::kMinimalBufferSize) { - size_t page_size = v8::base::OS::AllocatePageSize(); + size_t page_size = v8::internal::AllocatePageSize(); size_t alloc_size = RoundUp(requested, page_size); - void* result = - v8::base::OS::Allocate(nullptr, alloc_size, page_size, - v8::base::OS::MemoryPermission::kReadWriteExecute); + void* result = v8::internal::AllocatePages( + nullptr, alloc_size, page_size, v8::PageAllocator::kReadWriteExecute); CHECK(result); *allocated = alloc_size; return static_cast<uint8_t*>(result); } +static inline void MakeAssemblerBufferExecutable(uint8_t* buffer, + size_t allocated) { + bool result = v8::internal::SetPermissions(buffer, allocated, + v8::PageAllocator::kReadExecute); + CHECK(result); +} + static v8::debug::DebugDelegate dummy_delegate; static inline void EnableDebugger(v8::Isolate* isolate) { @@ -674,10 +680,18 @@ class ManualGCScope { class TestPlatform : public v8::Platform { public: // v8::Platform implementation. + v8::PageAllocator* GetPageAllocator() override { + return old_platform_->GetPageAllocator(); + } + void OnCriticalMemoryPressure() override { old_platform_->OnCriticalMemoryPressure(); } + bool OnCriticalMemoryPressure(size_t length) override { + return old_platform_->OnCriticalMemoryPressure(length); + } + std::shared_ptr<v8::TaskRunner> GetForegroundTaskRunner( v8::Isolate* isolate) override { return old_platform_->GetForegroundTaskRunner(isolate); diff --git a/deps/v8/test/cctest/cctest.status b/deps/v8/test/cctest/cctest.status index d3c8a8d393..2840bccf8c 100644 --- a/deps/v8/test/cctest/cctest.status +++ b/deps/v8/test/cctest/cctest.status @@ -71,17 +71,25 @@ # BUG(5193). The cpu profiler tests are notoriously flaky. 'test-cpu-profiler/CollectCpuProfile': [SKIP], + 'test-cpu-profiler/CollectCpuProfileSamples': [SKIP], 'test-cpu-profiler/CollectDeoptEvents': [SKIP], 'test-cpu-profiler/CpuProfileDeepStack': [SKIP], + 'test-cpu-profiler/DeoptAtFirstLevelInlinedSource': [SKIP], + 'test-cpu-profiler/DeoptAtSecondLevelInlinedSource': [SKIP], + 'test-cpu-profiler/DeoptUntrackedFunction': [SKIP], 'test-cpu-profiler/FunctionApplySample': [SKIP], 'test-cpu-profiler/HotDeoptNoFrameEntry': [SKIP], 'test-cpu-profiler/JsNative1JsNative2JsSample': [SKIP], 'test-cpu-profiler/JsNativeJsRuntimeJsSample': [SKIP], 'test-cpu-profiler/JsNativeJsRuntimeJsSampleMultiple': [SKIP], 'test-cpu-profiler/JsNativeJsSample': [SKIP], + 'test-cpu-profiler/NativeAccessorUninitializedIC': [SKIP], 'test-cpu-profiler/SampleWhenFrameIsNotSetup': [SKIP], 'test-sampler/LibSamplerCollectSample': [SKIP], + # BUG(7202). The test is flaky. + 'test-cpu-profiler/NativeFrameStackTrace': [SKIP], + # BUG(7054) 'test-cpu-profiler/StaticCollectSampleAPI': [SKIP], @@ -104,6 +112,7 @@ # Test that serialization with unknown external reference fails. 'test-serialize/SnapshotCreatorUnknownExternalReferences': [FAIL], + 'test-serialize/SnapshotCreatorUnknownHandles': [FAIL], 'test-serialize/SnapshotCreatorNoExternalReferencesCustomFail1': [FAIL], 'test-serialize/SnapshotCreatorNoExternalReferencesCustomFail2': [FAIL], @@ -113,6 +122,7 @@ 'test-strings/StringOOM*': [PASS, ['mode == debug', SKIP]], 'test-serialize/CustomSnapshotDataBlobImmortalImmovableRoots': [PASS, ['mode == debug', SKIP]], 'test-parsing/ObjectRestNegativeTestSlow': [PASS, ['mode == debug', SKIP]], + }], # ALWAYS ############################################################################## @@ -158,6 +168,15 @@ }], # 'arch == arm64 and mode == debug and simulator_run' ############################################################################## +# TODO(ahaas): Port multiple return values to ARM, MIPS, S390 and PPC +['arch == s390 or arch == s390x or arch == ppc or arch == ppc64', { + 'test-multiple-return/*': [SKIP], +}], +# TODO(ahaas): Port multiple return values to ARM, MIPS, S390 and PPC +['arch == mips or arch == mips64 or arch == mipsel or arch == mips64el or arch == s390 or arch == s390x or arch == ppc or arch == ppc64', { + 'test-multiple-return/ReturnLastValue*': [SKIP], +}], +############################################################################## ['asan == True', { # Skip tests not suitable for ASAN. 'test-assembler-x64/AssemblerX64XchglOperations': [SKIP], @@ -178,6 +197,9 @@ 'test-cpu-profiler/TickEvents': [SKIP], # BUG(v8:6924). The test allocates a lot of memory. 'test-api/NewStringRangeError': [PASS, NO_VARIANTS], + + # BUG(chromium:794911). + 'test-cpu-profiler/TracingCpuProfiler': [SKIP], }], # 'tsan == True' ############################################################################## @@ -385,10 +407,4 @@ 'test-dtoa/*': [SKIP], }], # variant == wasm_traps -############################################################################## -# BUG(v8:7138). -['arch == arm and not simulator_run and variant == wasm_traps', { - '*': [SKIP], -}], # arch == arm and not simulator_run and variant == wasm_traps - ] diff --git a/deps/v8/test/cctest/compiler/c-signature.h b/deps/v8/test/cctest/compiler/c-signature.h index 1c2f9638f4..0aea6e938b 100644 --- a/deps/v8/test/cctest/compiler/c-signature.h +++ b/deps/v8/test/cctest/compiler/c-signature.h @@ -28,18 +28,16 @@ namespace compiler { V(int*, MachineType::Pointer()) template <typename T> -inline MachineType MachineTypeForC() { - while (false) { - // All other types T must be assignable to Object* - *(static_cast<Object* volatile*>(0)) = static_cast<T>(0); - } +inline constexpr MachineType MachineTypeForC() { + static_assert(std::is_convertible<T, Object*>::value, + "all non-specialized types must be convertible to Object*"); return MachineType::AnyTagged(); } -#define DECLARE_TEMPLATE_SPECIALIZATION(ctype, mtype) \ - template <> \ - inline MachineType MachineTypeForC<ctype>() { \ - return mtype; \ +#define DECLARE_TEMPLATE_SPECIALIZATION(ctype, mtype) \ + template <> \ + inline MachineType constexpr MachineTypeForC<ctype>() { \ + return mtype; \ } FOREACH_CTYPE_MACHINE_TYPE_MAPPING(DECLARE_TEMPLATE_SPECIALIZATION) #undef DECLARE_TEMPLATE_SPECIALIZATION @@ -51,21 +49,13 @@ class CSignature : public MachineSignature { : MachineSignature(return_count, parameter_count, reps) {} public: - template <typename P1 = void, typename P2 = void, typename P3 = void, - typename P4 = void, typename P5 = void> + template <typename... Params> static void VerifyParams(MachineSignature* sig) { - // Verifies the C signature against the machine types. Maximum {5} params. - CHECK_LT(sig->parameter_count(), 6u); - const int kMax = 5; - MachineType params[] = {MachineTypeForC<P1>(), MachineTypeForC<P2>(), - MachineTypeForC<P3>(), MachineTypeForC<P4>(), - MachineTypeForC<P5>()}; - for (int p = kMax - 1; p >= 0; p--) { - if (p < static_cast<int>(sig->parameter_count())) { - CHECK_EQ(sig->GetParam(p), params[p]); - } else { - CHECK_EQ(MachineType::None(), params[p]); - } + // Verifies the C signature against the machine types. + std::array<MachineType, sizeof...(Params)> params{ + {MachineTypeForC<Params>()...}}; + for (size_t p = 0; p < params.size(); ++p) { + CHECK_EQ(sig->GetParam(p), params[p]); } } @@ -73,96 +63,59 @@ class CSignature : public MachineSignature { return reinterpret_cast<CSignature*>(msig); } + template <typename... ParamMachineTypes> static CSignature* New(Zone* zone, MachineType ret, - MachineType p1 = MachineType::None(), - MachineType p2 = MachineType::None(), - MachineType p3 = MachineType::None(), - MachineType p4 = MachineType::None(), - MachineType p5 = MachineType::None()) { - MachineType* buffer = zone->NewArray<MachineType>(6); - int pos = 0; + ParamMachineTypes... params) { + constexpr size_t param_count = sizeof...(params); + std::array<MachineType, param_count> param_arr{{params...}}; + const size_t buffer_size = + param_count + (ret == MachineType::None() ? 0 : 1); + MachineType* buffer = zone->NewArray<MachineType>(buffer_size); + size_t pos = 0; size_t return_count = 0; if (ret != MachineType::None()) { buffer[pos++] = ret; return_count++; } - buffer[pos++] = p1; - buffer[pos++] = p2; - buffer[pos++] = p3; - buffer[pos++] = p4; - buffer[pos++] = p5; - size_t param_count = 5; - if (p5 == MachineType::None()) param_count--; - if (p4 == MachineType::None()) param_count--; - if (p3 == MachineType::None()) param_count--; - if (p2 == MachineType::None()) param_count--; - if (p1 == MachineType::None()) param_count--; - for (size_t i = 0; i < param_count; i++) { - // Check that there are no MachineType::None()'s in the middle of - // parameters. - CHECK_NE(MachineType::None(), buffer[return_count + i]); + for (MachineType p : param_arr) { + // Check that there are no MachineType::None()'s in the parameters. + CHECK_NE(MachineType::None(), p); + buffer[pos++] = p; } + DCHECK_EQ(buffer_size, pos); return new (zone) CSignature(return_count, param_count, buffer); } }; - -template <typename Ret, uint16_t kParamCount> -class CSignatureOf : public CSignature { - protected: - MachineType storage_[1 + kParamCount]; - - CSignatureOf() - : CSignature(MachineTypeForC<Ret>() != MachineType::None() ? 1 : 0, - kParamCount, reinterpret_cast<MachineType*>(&storage_)) { - if (return_count_ == 1) storage_[0] = MachineTypeForC<Ret>(); - } - void Set(int index, MachineType type) { - CHECK_LE(0, index); - CHECK_LT(index, kParamCount); - reps_[return_count_ + index] = type; - } -}; - // Helper classes for instantiating Signature objects to be callable from C. -template <typename Ret> -class CSignature0 : public CSignatureOf<Ret, 0> { - public: - CSignature0() : CSignatureOf<Ret, 0>() {} -}; - -template <typename Ret, typename P1> -class CSignature1 : public CSignatureOf<Ret, 1> { +template <typename Ret, typename... Params> +class CSignatureOf : public CSignature { public: - CSignature1() : CSignatureOf<Ret, 1>() { - this->Set(0, MachineTypeForC<P1>()); + CSignatureOf() : CSignature(kReturnCount, kParamCount, storage_) { + constexpr std::array<MachineType, kParamCount> param_types{ + MachineTypeForC<Params>()...}; + if (kReturnCount == 1) storage_[0] = MachineTypeForC<Ret>(); + static_assert( + std::is_same<decltype(*reps_), decltype(*param_types.data())>::value, + "type mismatch, cannot memcpy"); + memcpy(storage_ + kReturnCount, param_types.data(), + sizeof(*storage_) * kParamCount); } -}; -template <typename Ret, typename P1, typename P2> -class CSignature2 : public CSignatureOf<Ret, 2> { - public: - CSignature2() : CSignatureOf<Ret, 2>() { - this->Set(0, MachineTypeForC<P1>()); - this->Set(1, MachineTypeForC<P2>()); - } -}; + private: + static constexpr size_t kReturnCount = + MachineTypeForC<Ret>() == MachineType::None() ? 0 : 1; + static constexpr size_t kParamCount = sizeof...(Params); -template <typename Ret, typename P1, typename P2, typename P3> -class CSignature3 : public CSignatureOf<Ret, 3> { - public: - CSignature3() : CSignatureOf<Ret, 3>() { - this->Set(0, MachineTypeForC<P1>()); - this->Set(1, MachineTypeForC<P2>()); - this->Set(2, MachineTypeForC<P3>()); - } + MachineType storage_[kReturnCount + kParamCount]; }; -typedef CSignature2<int32_t, int32_t, int32_t> CSignature_i_ii; -typedef CSignature2<uint32_t, uint32_t, uint32_t> CSignature_u_uu; -typedef CSignature2<float, float, float> CSignature_f_ff; -typedef CSignature2<double, double, double> CSignature_d_dd; -typedef CSignature2<Object*, Object*, Object*> CSignature_o_oo; +typedef CSignatureOf<int32_t, int32_t, int32_t> CSignature_i_ii; +typedef CSignatureOf<uint32_t, uint32_t, uint32_t> CSignature_u_uu; +typedef CSignatureOf<float, float, float> CSignature_f_ff; +typedef CSignatureOf<double, double, double> CSignature_d_dd; +typedef CSignatureOf<Object*, Object*, Object*> CSignature_o_oo; + } // namespace compiler } // namespace internal } // namespace v8 diff --git a/deps/v8/test/cctest/compiler/call-tester.h b/deps/v8/test/cctest/compiler/call-tester.h index 20dc3c8b2d..2907d4d246 100644 --- a/deps/v8/test/cctest/compiler/call-tester.h +++ b/deps/v8/test/cctest/compiler/call-tester.h @@ -6,119 +6,15 @@ #define V8_CCTEST_COMPILER_CALL_TESTER_H_ #include "src/handles.h" +#include "src/objects/code.h" #include "src/simulator.h" #include "test/cctest/compiler/c-signature.h" -#if V8_TARGET_ARCH_IA32 -#if __GNUC__ -#define V8_CDECL __attribute__((cdecl)) -#else -#define V8_CDECL __cdecl -#endif -#else -#define V8_CDECL -#endif - namespace v8 { namespace internal { namespace compiler { template <typename R> -inline R CastReturnValue(uintptr_t r) { - return reinterpret_cast<R>(r); -} - -template <> -inline void CastReturnValue(uintptr_t r) {} - -template <> -inline bool CastReturnValue(uintptr_t r) { - return static_cast<bool>(r); -} - -template <> -inline int32_t CastReturnValue(uintptr_t r) { - return static_cast<int32_t>(r); -} - -template <> -inline uint32_t CastReturnValue(uintptr_t r) { - return static_cast<uint32_t>(r); -} - -template <> -inline int64_t CastReturnValue(uintptr_t r) { - return static_cast<int64_t>(r); -} - -template <> -inline uint64_t CastReturnValue(uintptr_t r) { - return static_cast<uint64_t>(r); -} - -template <> -inline int16_t CastReturnValue(uintptr_t r) { - return static_cast<int16_t>(r); -} - -template <> -inline uint16_t CastReturnValue(uintptr_t r) { - return static_cast<uint16_t>(r); -} - -template <> -inline int8_t CastReturnValue(uintptr_t r) { - return static_cast<int8_t>(r); -} - -template <> -inline uint8_t CastReturnValue(uintptr_t r) { - return static_cast<uint8_t>(r); -} - -template <> -inline double CastReturnValue(uintptr_t r) { - UNREACHABLE(); -} - -template <typename R> -struct ParameterTraits { - static uintptr_t Cast(R r) { return static_cast<uintptr_t>(r); } -}; - -template <> -struct ParameterTraits<int*> { - static uintptr_t Cast(int* r) { return reinterpret_cast<uintptr_t>(r); } -}; - -template <typename T> -struct ParameterTraits<T*> { - static uintptr_t Cast(void* r) { return reinterpret_cast<uintptr_t>(r); } -}; - - -#if !V8_TARGET_ARCH_32_BIT - -// Additional template specialization required for mips64 to sign-extend -// parameters defined by calling convention. -template <> -struct ParameterTraits<int32_t> { - static int64_t Cast(int32_t r) { return static_cast<int64_t>(r); } -}; - -#if !V8_TARGET_ARCH_PPC64 -template <> -struct ParameterTraits<uint32_t> { - static int64_t Cast(uint32_t r) { - return static_cast<int64_t>(static_cast<int32_t>(r)); - } -}; -#endif - -#endif // !V8_TARGET_ARCH_64_BIT - - -template <typename R> class CallHelper { public: explicit CallHelper(Isolate* isolate, MachineSignature* csig) @@ -129,9 +25,10 @@ class CallHelper { template <typename... Params> R Call(Params... args) { - using FType = R(V8_CDECL*)(Params...); CSignature::VerifyParams<Params...>(csig_); - return DoCall(FUNCTION_CAST<FType>(Generate()), args...); + byte* entry = Generate(); + auto fn = GeneratedCode<R, Params...>::FromAddress(isolate_, entry); + return fn.Call(args...); } protected: @@ -140,51 +37,6 @@ class CallHelper { virtual byte* Generate() = 0; private: -#if USE_SIMULATOR && V8_TARGET_ARCH_ARM64 - uintptr_t CallSimulator(byte* f, Simulator::CallArgument* args) { - Simulator* simulator = Simulator::current(isolate_); - return static_cast<uintptr_t>(simulator->CallInt64(f, args)); - } - - template <typename F, typename... Params> - R DoCall(F* f, Params... args) { - Simulator::CallArgument args_arr[] = {Simulator::CallArgument(args)..., - Simulator::CallArgument::End()}; - return CastReturnValue<R>(CallSimulator(FUNCTION_ADDR(f), args_arr)); - } -#elif USE_SIMULATOR && \ - (V8_TARGET_ARCH_MIPS64 || V8_TARGET_ARCH_PPC64 || V8_TARGET_ARCH_S390X) - uintptr_t CallSimulator(byte* f, int64_t p1 = 0, int64_t p2 = 0, - int64_t p3 = 0, int64_t p4 = 0, int64_t p5 = 0) { - Simulator* simulator = Simulator::current(isolate_); - return static_cast<uintptr_t>(simulator->Call(f, 5, p1, p2, p3, p4, p5)); - } - - template <typename F, typename... Params> - R DoCall(F* f, Params... args) { - return CastReturnValue<R>(CallSimulator( - FUNCTION_ADDR(f), ParameterTraits<Params>::Cast(args)...)); - } -#elif USE_SIMULATOR && (V8_TARGET_ARCH_ARM || V8_TARGET_ARCH_MIPS || \ - V8_TARGET_ARCH_PPC || V8_TARGET_ARCH_S390) - uintptr_t CallSimulator(byte* f, int32_t p1 = 0, int32_t p2 = 0, - int32_t p3 = 0, int32_t p4 = 0, int32_t p5 = 0) { - Simulator* simulator = Simulator::current(isolate_); - return static_cast<uintptr_t>(simulator->Call(f, 5, p1, p2, p3, p4, p5)); - } - - template <typename F, typename... Params> - R DoCall(F* f, Params... args) { - return CastReturnValue<R>(CallSimulator( - FUNCTION_ADDR(f), ParameterTraits<Params>::Cast(args)...)); - } -#else - template <typename F, typename... Params> - R DoCall(F* f, Params... args) { - return f(args...); - } -#endif - Isolate* isolate_; }; diff --git a/deps/v8/test/cctest/compiler/code-assembler-tester.h b/deps/v8/test/cctest/compiler/code-assembler-tester.h index 7a75441ad0..20029809b4 100644 --- a/deps/v8/test/cctest/compiler/code-assembler-tester.h +++ b/deps/v8/test/cctest/compiler/code-assembler-tester.h @@ -36,10 +36,11 @@ class CodeAssemblerTester { scope_(isolate), state_(isolate, &zone_, 0, kind, "test") {} - CodeAssemblerTester(Isolate* isolate, CallDescriptor* call_descriptor) + CodeAssemblerTester(Isolate* isolate, CallDescriptor* call_descriptor, + const char* name = "test") : zone_(isolate->allocator(), ZONE_NAME), scope_(isolate), - state_(isolate, &zone_, call_descriptor, Code::STUB, "test", 0, -1) {} + state_(isolate, &zone_, call_descriptor, Code::STUB, name, 0, -1) {} CodeAssemblerState* state() { return &state_; } diff --git a/deps/v8/test/cctest/compiler/codegen-tester.cc b/deps/v8/test/cctest/compiler/codegen-tester.cc index a3548fe8d0..f66385a92e 100644 --- a/deps/v8/test/cctest/compiler/codegen-tester.cc +++ b/deps/v8/test/cctest/compiler/codegen-tester.cc @@ -48,92 +48,92 @@ TEST(CompareWrapper) { CHECK_EQ(true, wWord32Equal.Int32Compare(257, 257)); CHECK_EQ(true, wWord32Equal.Int32Compare(65539, 65539)); CHECK_EQ(true, wWord32Equal.Int32Compare(-1, -1)); - CHECK_EQ(true, wWord32Equal.Int32Compare(0xffffffff, 0xffffffff)); + CHECK_EQ(true, wWord32Equal.Int32Compare(0xFFFFFFFF, 0xFFFFFFFF)); CHECK_EQ(false, wWord32Equal.Int32Compare(0, 1)); CHECK_EQ(false, wWord32Equal.Int32Compare(257, 256)); CHECK_EQ(false, wWord32Equal.Int32Compare(65539, 65537)); CHECK_EQ(false, wWord32Equal.Int32Compare(-1, -2)); - CHECK_EQ(false, wWord32Equal.Int32Compare(0xffffffff, 0xfffffffe)); + CHECK_EQ(false, wWord32Equal.Int32Compare(0xFFFFFFFF, 0xFFFFFFFE)); CHECK_EQ(false, wInt32LessThan.Int32Compare(0, 0)); CHECK_EQ(false, wInt32LessThan.Int32Compare(357, 357)); CHECK_EQ(false, wInt32LessThan.Int32Compare(75539, 75539)); CHECK_EQ(false, wInt32LessThan.Int32Compare(-1, -1)); - CHECK_EQ(false, wInt32LessThan.Int32Compare(0xffffffff, 0xffffffff)); + CHECK_EQ(false, wInt32LessThan.Int32Compare(0xFFFFFFFF, 0xFFFFFFFF)); CHECK_EQ(true, wInt32LessThan.Int32Compare(0, 1)); CHECK_EQ(true, wInt32LessThan.Int32Compare(456, 457)); CHECK_EQ(true, wInt32LessThan.Int32Compare(85537, 85539)); CHECK_EQ(true, wInt32LessThan.Int32Compare(-2, -1)); - CHECK_EQ(true, wInt32LessThan.Int32Compare(0xfffffffe, 0xffffffff)); + CHECK_EQ(true, wInt32LessThan.Int32Compare(0xFFFFFFFE, 0xFFFFFFFF)); CHECK_EQ(false, wInt32LessThan.Int32Compare(1, 0)); CHECK_EQ(false, wInt32LessThan.Int32Compare(457, 456)); CHECK_EQ(false, wInt32LessThan.Int32Compare(85539, 85537)); CHECK_EQ(false, wInt32LessThan.Int32Compare(-1, -2)); - CHECK_EQ(false, wInt32LessThan.Int32Compare(0xffffffff, 0xfffffffe)); + CHECK_EQ(false, wInt32LessThan.Int32Compare(0xFFFFFFFF, 0xFFFFFFFE)); CHECK_EQ(true, wInt32LessThanOrEqual.Int32Compare(0, 0)); CHECK_EQ(true, wInt32LessThanOrEqual.Int32Compare(357, 357)); CHECK_EQ(true, wInt32LessThanOrEqual.Int32Compare(75539, 75539)); CHECK_EQ(true, wInt32LessThanOrEqual.Int32Compare(-1, -1)); - CHECK_EQ(true, wInt32LessThanOrEqual.Int32Compare(0xffffffff, 0xffffffff)); + CHECK_EQ(true, wInt32LessThanOrEqual.Int32Compare(0xFFFFFFFF, 0xFFFFFFFF)); CHECK_EQ(true, wInt32LessThanOrEqual.Int32Compare(0, 1)); CHECK_EQ(true, wInt32LessThanOrEqual.Int32Compare(456, 457)); CHECK_EQ(true, wInt32LessThanOrEqual.Int32Compare(85537, 85539)); CHECK_EQ(true, wInt32LessThanOrEqual.Int32Compare(-2, -1)); - CHECK_EQ(true, wInt32LessThanOrEqual.Int32Compare(0xfffffffe, 0xffffffff)); + CHECK_EQ(true, wInt32LessThanOrEqual.Int32Compare(0xFFFFFFFE, 0xFFFFFFFF)); CHECK_EQ(false, wInt32LessThanOrEqual.Int32Compare(1, 0)); CHECK_EQ(false, wInt32LessThanOrEqual.Int32Compare(457, 456)); CHECK_EQ(false, wInt32LessThanOrEqual.Int32Compare(85539, 85537)); CHECK_EQ(false, wInt32LessThanOrEqual.Int32Compare(-1, -2)); - CHECK_EQ(false, wInt32LessThanOrEqual.Int32Compare(0xffffffff, 0xfffffffe)); + CHECK_EQ(false, wInt32LessThanOrEqual.Int32Compare(0xFFFFFFFF, 0xFFFFFFFE)); // Unsigned comparisons. CHECK_EQ(false, wUint32LessThan.Int32Compare(0, 0)); CHECK_EQ(false, wUint32LessThan.Int32Compare(357, 357)); CHECK_EQ(false, wUint32LessThan.Int32Compare(75539, 75539)); CHECK_EQ(false, wUint32LessThan.Int32Compare(-1, -1)); - CHECK_EQ(false, wUint32LessThan.Int32Compare(0xffffffff, 0xffffffff)); - CHECK_EQ(false, wUint32LessThan.Int32Compare(0xffffffff, 0)); + CHECK_EQ(false, wUint32LessThan.Int32Compare(0xFFFFFFFF, 0xFFFFFFFF)); + CHECK_EQ(false, wUint32LessThan.Int32Compare(0xFFFFFFFF, 0)); CHECK_EQ(false, wUint32LessThan.Int32Compare(-2999, 0)); CHECK_EQ(true, wUint32LessThan.Int32Compare(0, 1)); CHECK_EQ(true, wUint32LessThan.Int32Compare(456, 457)); CHECK_EQ(true, wUint32LessThan.Int32Compare(85537, 85539)); CHECK_EQ(true, wUint32LessThan.Int32Compare(-11, -10)); - CHECK_EQ(true, wUint32LessThan.Int32Compare(0xfffffffe, 0xffffffff)); - CHECK_EQ(true, wUint32LessThan.Int32Compare(0, 0xffffffff)); + CHECK_EQ(true, wUint32LessThan.Int32Compare(0xFFFFFFFE, 0xFFFFFFFF)); + CHECK_EQ(true, wUint32LessThan.Int32Compare(0, 0xFFFFFFFF)); CHECK_EQ(true, wUint32LessThan.Int32Compare(0, -2996)); CHECK_EQ(false, wUint32LessThan.Int32Compare(1, 0)); CHECK_EQ(false, wUint32LessThan.Int32Compare(457, 456)); CHECK_EQ(false, wUint32LessThan.Int32Compare(85539, 85537)); CHECK_EQ(false, wUint32LessThan.Int32Compare(-10, -21)); - CHECK_EQ(false, wUint32LessThan.Int32Compare(0xffffffff, 0xfffffffe)); + CHECK_EQ(false, wUint32LessThan.Int32Compare(0xFFFFFFFF, 0xFFFFFFFE)); CHECK_EQ(true, wUint32LessThanOrEqual.Int32Compare(0, 0)); CHECK_EQ(true, wUint32LessThanOrEqual.Int32Compare(357, 357)); CHECK_EQ(true, wUint32LessThanOrEqual.Int32Compare(75539, 75539)); CHECK_EQ(true, wUint32LessThanOrEqual.Int32Compare(-1, -1)); - CHECK_EQ(true, wUint32LessThanOrEqual.Int32Compare(0xffffffff, 0xffffffff)); + CHECK_EQ(true, wUint32LessThanOrEqual.Int32Compare(0xFFFFFFFF, 0xFFFFFFFF)); CHECK_EQ(true, wUint32LessThanOrEqual.Int32Compare(0, 1)); CHECK_EQ(true, wUint32LessThanOrEqual.Int32Compare(456, 457)); CHECK_EQ(true, wUint32LessThanOrEqual.Int32Compare(85537, 85539)); CHECK_EQ(true, wUint32LessThanOrEqual.Int32Compare(-300, -299)); CHECK_EQ(true, wUint32LessThanOrEqual.Int32Compare(-300, -300)); - CHECK_EQ(true, wUint32LessThanOrEqual.Int32Compare(0xfffffffe, 0xffffffff)); + CHECK_EQ(true, wUint32LessThanOrEqual.Int32Compare(0xFFFFFFFE, 0xFFFFFFFF)); CHECK_EQ(true, wUint32LessThanOrEqual.Int32Compare(0, -2995)); CHECK_EQ(false, wUint32LessThanOrEqual.Int32Compare(1, 0)); CHECK_EQ(false, wUint32LessThanOrEqual.Int32Compare(457, 456)); CHECK_EQ(false, wUint32LessThanOrEqual.Int32Compare(85539, 85537)); CHECK_EQ(false, wUint32LessThanOrEqual.Int32Compare(-130, -170)); - CHECK_EQ(false, wUint32LessThanOrEqual.Int32Compare(0xffffffff, 0xfffffffe)); + CHECK_EQ(false, wUint32LessThanOrEqual.Int32Compare(0xFFFFFFFF, 0xFFFFFFFE)); CHECK_EQ(false, wUint32LessThanOrEqual.Int32Compare(-2997, 0)); CompareWrapper wFloat64Equal(IrOpcode::kFloat64Equal); @@ -319,7 +319,6 @@ void Int32BinopInputShapeTester::TestAllInputShapes() { gen->gen(&m, n0, n1); - if (false) printf("Int32BinopInputShapeTester i=%d, j=%d\n", i, j); if (i >= 0) { input_a = inputs[i]; RunRight(&m); @@ -340,7 +339,6 @@ void Int32BinopInputShapeTester::Run(RawMachineAssemblerTester<int32_t>* m) { input_a = *pl; input_b = *pr; int32_t expect = gen->expected(input_a, input_b); - if (false) printf(" cmp(a=%d, b=%d) ?== %d\n", input_a, input_b, expect); CHECK_EQ(expect, m->Call(input_a, input_b)); } } @@ -352,7 +350,6 @@ void Int32BinopInputShapeTester::RunLeft( FOR_UINT32_INPUTS(i) { input_a = *i; int32_t expect = gen->expected(input_a, input_b); - if (false) printf(" cmp(a=%d, b=%d) ?== %d\n", input_a, input_b, expect); CHECK_EQ(expect, m->Call(input_a, input_b)); } } @@ -363,7 +360,6 @@ void Int32BinopInputShapeTester::RunRight( FOR_UINT32_INPUTS(i) { input_b = *i; int32_t expect = gen->expected(input_a, input_b); - if (false) printf(" cmp(a=%d, b=%d) ?== %d\n", input_a, input_b, expect); CHECK_EQ(expect, m->Call(input_a, input_b)); } } diff --git a/deps/v8/test/cctest/compiler/codegen-tester.h b/deps/v8/test/cctest/compiler/codegen-tester.h index c33e7d1ca9..7e7e4be0b1 100644 --- a/deps/v8/test/cctest/compiler/codegen-tester.h +++ b/deps/v8/test/cctest/compiler/codegen-tester.h @@ -22,22 +22,18 @@ class RawMachineAssemblerTester : public HandleAndZoneScope, public CallHelper<ReturnType>, public RawMachineAssembler { public: - RawMachineAssemblerTester(MachineType p0 = MachineType::None(), - MachineType p1 = MachineType::None(), - MachineType p2 = MachineType::None(), - MachineType p3 = MachineType::None(), - MachineType p4 = MachineType::None()) + template <typename... ParamMachTypes> + explicit RawMachineAssemblerTester(ParamMachTypes... p) : HandleAndZoneScope(), CallHelper<ReturnType>( main_isolate(), - CSignature::New(main_zone(), MachineTypeForC<ReturnType>(), p0, p1, - p2, p3, p4)), + 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>(), p0, - p1, p2, p3, p4), + CSignature::New(main_zone(), MachineTypeForC<ReturnType>(), + p...), true), MachineType::PointerRepresentation(), InstructionSelector::SupportedMachineOperatorFlags(), @@ -79,17 +75,24 @@ class RawMachineAssemblerTester : public HandleAndZoneScope, MaybeHandle<Code> code_; }; - template <typename ReturnType> class BufferedRawMachineAssemblerTester : public RawMachineAssemblerTester<int32_t> { public: - BufferedRawMachineAssemblerTester(MachineType p0 = MachineType::None(), - MachineType p1 = MachineType::None(), - MachineType p2 = MachineType::None(), - MachineType p3 = MachineType::None()) - : BufferedRawMachineAssemblerTester(ComputeParameterCount(p0, p1, p2, p3), - p0, p1, p2, p3) {} + template <typename... ParamMachTypes> + explicit BufferedRawMachineAssemblerTester(ParamMachTypes... p) + : RawMachineAssemblerTester<int32_t>( + MachineType::Pointer(), ((void)p, MachineType::Pointer())...), + test_graph_signature_( + CSignature::New(this->main_zone(), MachineType::Int32(), p...)), + return_parameter_index_(sizeof...(p)) { + static_assert(sizeof...(p) <= arraysize(parameter_nodes_), + "increase parameter_nodes_ array"); + std::array<MachineType, sizeof...(p)> p_arr{{p...}}; + for (size_t i = 0; i < p_arr.size(); ++i) { + parameter_nodes_[i] = Load(p_arr[i], RawMachineAssembler::Parameter(i)); + } + } virtual byte* Generate() { return RawMachineAssemblerTester::Generate(); } @@ -99,7 +102,7 @@ class BufferedRawMachineAssemblerTester // parameters from memory. Thereby it is possible to pass 64 bit parameters // to the IR graph. Node* Parameter(size_t index) { - CHECK_GT(4, index); + CHECK_GT(arraysize(parameter_nodes_), index); return parameter_nodes_[index]; } @@ -114,141 +117,37 @@ class BufferedRawMachineAssemblerTester RawMachineAssembler::Return(Int32Constant(1234)); } - ReturnType Call() { - ReturnType return_value; - CSignature::VerifyParams(test_graph_signature_); - CallHelper<int32_t>::Call(reinterpret_cast<void*>(&return_value)); - return return_value; - } - - template <typename P0> - ReturnType Call(P0 p0) { + template <typename... Params> + ReturnType Call(Params... p) { ReturnType return_value; - CSignature::VerifyParams<P0>(test_graph_signature_); - CallHelper<int32_t>::Call(reinterpret_cast<void*>(&p0), + CSignature::VerifyParams<Params...>(test_graph_signature_); + CallHelper<int32_t>::Call(reinterpret_cast<void*>(&p)..., reinterpret_cast<void*>(&return_value)); return return_value; } - template <typename P0, typename P1> - ReturnType Call(P0 p0, P1 p1) { - ReturnType return_value; - CSignature::VerifyParams<P0, P1>(test_graph_signature_); - CallHelper<int32_t>::Call(reinterpret_cast<void*>(&p0), - reinterpret_cast<void*>(&p1), - reinterpret_cast<void*>(&return_value)); - return return_value; - } - - template <typename P0, typename P1, typename P2> - ReturnType Call(P0 p0, P1 p1, P2 p2) { - ReturnType return_value; - CSignature::VerifyParams<P0, P1, P2>(test_graph_signature_); - CallHelper<int32_t>::Call( - reinterpret_cast<void*>(&p0), reinterpret_cast<void*>(&p1), - reinterpret_cast<void*>(&p2), reinterpret_cast<void*>(&return_value)); - return return_value; - } - - template <typename P0, typename P1, typename P2, typename P3> - ReturnType Call(P0 p0, P1 p1, P2 p2, P3 p3) { - ReturnType return_value; - CSignature::VerifyParams<P0, P1, P2, P3>(test_graph_signature_); - CallHelper<int32_t>::Call( - reinterpret_cast<void*>(&p0), reinterpret_cast<void*>(&p1), - reinterpret_cast<void*>(&p2), reinterpret_cast<void*>(&p3), - reinterpret_cast<void*>(&return_value)); - return return_value; - } - private: - BufferedRawMachineAssemblerTester(uint32_t return_parameter_index, - MachineType p0, MachineType p1, - MachineType p2, MachineType p3) - : RawMachineAssemblerTester<int32_t>( - MachineType::Pointer(), - p0 == MachineType::None() ? MachineType::None() - : MachineType::Pointer(), - p1 == MachineType::None() ? MachineType::None() - : MachineType::Pointer(), - p2 == MachineType::None() ? MachineType::None() - : MachineType::Pointer(), - p3 == MachineType::None() ? MachineType::None() - : MachineType::Pointer()), - test_graph_signature_( - CSignature::New(main_zone(), MachineType::Int32(), p0, p1, p2, p3)), - return_parameter_index_(return_parameter_index) { - parameter_nodes_[0] = p0 == MachineType::None() - ? nullptr - : Load(p0, RawMachineAssembler::Parameter(0)); - parameter_nodes_[1] = p1 == MachineType::None() - ? nullptr - : Load(p1, RawMachineAssembler::Parameter(1)); - parameter_nodes_[2] = p2 == MachineType::None() - ? nullptr - : Load(p2, RawMachineAssembler::Parameter(2)); - parameter_nodes_[3] = p3 == MachineType::None() - ? nullptr - : Load(p3, RawMachineAssembler::Parameter(3)); - } - - - static uint32_t ComputeParameterCount(MachineType p0, MachineType p1, - MachineType p2, MachineType p3) { - if (p0 == MachineType::None()) { - return 0; - } - if (p1 == MachineType::None()) { - return 1; - } - if (p2 == MachineType::None()) { - return 2; - } - if (p3 == MachineType::None()) { - return 3; - } - return 4; - } - - CSignature* test_graph_signature_; Node* parameter_nodes_[4]; uint32_t return_parameter_index_; }; - template <> class BufferedRawMachineAssemblerTester<void> : public RawMachineAssemblerTester<void> { public: - BufferedRawMachineAssemblerTester(MachineType p0 = MachineType::None(), - MachineType p1 = MachineType::None(), - MachineType p2 = MachineType::None(), - MachineType p3 = MachineType::None()) - : RawMachineAssemblerTester<void>( - p0 == MachineType::None() ? MachineType::None() - : MachineType::Pointer(), - p1 == MachineType::None() ? MachineType::None() - : MachineType::Pointer(), - p2 == MachineType::None() ? MachineType::None() - : MachineType::Pointer(), - p3 == MachineType::None() ? MachineType::None() - : MachineType::Pointer()), + template <typename... ParamMachTypes> + explicit BufferedRawMachineAssemblerTester(ParamMachTypes... p) + : RawMachineAssemblerTester<void>(((void)p, MachineType::Pointer())...), test_graph_signature_( CSignature::New(RawMachineAssemblerTester<void>::main_zone(), - MachineType::None(), p0, p1, p2, p3)) { - parameter_nodes_[0] = p0 == MachineType::None() - ? nullptr - : Load(p0, RawMachineAssembler::Parameter(0)); - parameter_nodes_[1] = p1 == MachineType::None() - ? nullptr - : Load(p1, RawMachineAssembler::Parameter(1)); - parameter_nodes_[2] = p2 == MachineType::None() - ? nullptr - : Load(p2, RawMachineAssembler::Parameter(2)); - parameter_nodes_[3] = p3 == MachineType::None() - ? nullptr - : Load(p3, RawMachineAssembler::Parameter(3)); + MachineType::None(), p...)) { + static_assert(sizeof...(p) <= arraysize(parameter_nodes_), + "increase parameter_nodes_ array"); + std::array<MachineType, sizeof...(p)> p_arr{{p...}}; + for (size_t i = 0; i < p_arr.size(); ++i) { + parameter_nodes_[i] = Load(p_arr[i], RawMachineAssembler::Parameter(i)); + } } virtual byte* Generate() { return RawMachineAssemblerTester::Generate(); } @@ -259,49 +158,21 @@ class BufferedRawMachineAssemblerTester<void> // parameters from memory. Thereby it is possible to pass 64 bit parameters // to the IR graph. Node* Parameter(size_t index) { - CHECK_GT(4, index); + CHECK_GT(arraysize(parameter_nodes_), index); return parameter_nodes_[index]; } - - void Call() { - CSignature::VerifyParams(test_graph_signature_); - CallHelper<void>::Call(); - } - - template <typename P0> - void Call(P0 p0) { - CSignature::VerifyParams<P0>(test_graph_signature_); - CallHelper<void>::Call(reinterpret_cast<void*>(&p0)); - } - - template <typename P0, typename P1> - void Call(P0 p0, P1 p1) { - CSignature::VerifyParams<P0, P1>(test_graph_signature_); - CallHelper<void>::Call(reinterpret_cast<void*>(&p0), - reinterpret_cast<void*>(&p1)); - } - - template <typename P0, typename P1, typename P2> - void Call(P0 p0, P1 p1, P2 p2) { - CSignature::VerifyParams<P0, P1, P2>(test_graph_signature_); - CallHelper<void>::Call(reinterpret_cast<void*>(&p0), - reinterpret_cast<void*>(&p1), - reinterpret_cast<void*>(&p2)); - } - - template <typename P0, typename P1, typename P2, typename P3> - void Call(P0 p0, P1 p1, P2 p2, P3 p3) { - CSignature::VerifyParams<P0, P1, P2, P3>(test_graph_signature_); - CallHelper<void>::Call( - reinterpret_cast<void*>(&p0), reinterpret_cast<void*>(&p1), - reinterpret_cast<void*>(&p2), reinterpret_cast<void*>(&p3)); + template <typename... Params> + void Call(Params... p) { + CSignature::VerifyParams<Params...>(test_graph_signature_); + CallHelper<void>::Call(reinterpret_cast<void*>(&p)...); } private: CSignature* test_graph_signature_; Node* parameter_nodes_[4]; }; + static const bool USE_RESULT_BUFFER = true; static const bool USE_RETURN_REGISTER = false; static const int32_t CHECK_VALUE = 0x99BEEDCE; diff --git a/deps/v8/test/cctest/compiler/graph-builder-tester.h b/deps/v8/test/cctest/compiler/graph-builder-tester.h index 1bf1d40587..24c2877938 100644 --- a/deps/v8/test/cctest/compiler/graph-builder-tester.h +++ b/deps/v8/test/cctest/compiler/graph-builder-tester.h @@ -50,16 +50,12 @@ class GraphBuilderTester : public HandleAndZoneScope, public GraphAndBuilders, public CallHelper<ReturnType> { public: - explicit GraphBuilderTester(MachineType p0 = MachineType::None(), - MachineType p1 = MachineType::None(), - MachineType p2 = MachineType::None(), - MachineType p3 = MachineType::None(), - MachineType p4 = MachineType::None()) + template <typename... ParamMachTypes> + explicit GraphBuilderTester(ParamMachTypes... p) : GraphAndBuilders(main_zone()), CallHelper<ReturnType>( main_isolate(), - CSignature::New(main_zone(), MachineTypeForC<ReturnType>(), p0, p1, - p2, p3, p4)), + CSignature::New(main_zone(), MachineTypeForC<ReturnType>(), p...)), effect_(nullptr), return_(nullptr), parameters_(main_zone()->template NewArray<Node*>(parameter_count())) { @@ -192,37 +188,10 @@ class GraphBuilderTester : public HandleAndZoneScope, return NewNode(simplified()->StoreElement(access), object, index, value); } - Node* NewNode(const Operator* op) { - return MakeNode(op, 0, static_cast<Node**>(nullptr)); - } - - Node* NewNode(const Operator* op, Node* n1) { return MakeNode(op, 1, &n1); } - - Node* NewNode(const Operator* op, Node* n1, Node* n2) { - Node* buffer[] = {n1, n2}; - return MakeNode(op, arraysize(buffer), buffer); - } - - Node* NewNode(const Operator* op, Node* n1, Node* n2, Node* n3) { - Node* buffer[] = {n1, n2, n3}; - return MakeNode(op, arraysize(buffer), buffer); - } - - Node* NewNode(const Operator* op, Node* n1, Node* n2, Node* n3, Node* n4) { - Node* buffer[] = {n1, n2, n3, n4}; - return MakeNode(op, arraysize(buffer), buffer); - } - - Node* NewNode(const Operator* op, Node* n1, Node* n2, Node* n3, Node* n4, - Node* n5) { - Node* buffer[] = {n1, n2, n3, n4, n5}; - return MakeNode(op, arraysize(buffer), buffer); - } - - Node* NewNode(const Operator* op, Node* n1, Node* n2, Node* n3, Node* n4, - Node* n5, Node* n6) { - Node* nodes[] = {n1, n2, n3, n4, n5, n6}; - return MakeNode(op, arraysize(nodes), nodes); + template <typename... NodePtrs> + Node* NewNode(const Operator* op, NodePtrs... n) { + std::array<Node*, sizeof...(n)> inputs{{n...}}; + return MakeNode(op, inputs.size(), inputs.data()); } Node* NewNode(const Operator* op, int value_input_count, diff --git a/deps/v8/test/cctest/compiler/test-code-generator.cc b/deps/v8/test/cctest/compiler/test-code-generator.cc index a131d861f7..10158c2741 100644 --- a/deps/v8/test/cctest/compiler/test-code-generator.cc +++ b/deps/v8/test/cctest/compiler/test-code-generator.cc @@ -49,8 +49,10 @@ Handle<Code> BuildTeardownFunction(Isolate* isolate, CallDescriptor* descriptor, // arguments: // ~~~ // FixedArray setup(CodeObject* test, FixedArray state_in) { +// FixedArray state_out = AllocateFixedArray(state_in.length()); // // `test` will tail-call to its first parameter which will be `teardown`. -// return test(teardown, state_in[0], state_in[1], state_in[2], ...); +// return test(teardown, state_out, state_in[0], state_in[1], +// state_in[2], ...); // } // ~~~ // @@ -58,11 +60,14 @@ Handle<Code> BuildTeardownFunction(Isolate* isolate, CallDescriptor* descriptor, // values to pass to the `test` function. The array will have been created using // `GenerateInitialState()` and needs to be converted in the following way: // -// | Parameter type | FixedArray element | Conversion | -// |----------------+--------------------+------------------------------------| -// | kTagged | Smi | None. | -// | kFloat32 | HeapNumber | Load value and convert to Float32. | -// | kFloat64 | HeapNumber | Load value. | +// | Parameter type | FixedArray element | Conversion | +// |----------------+---------------------+------------------------------------| +// | kTagged | Smi | None. | +// | kFloat32 | HeapNumber | Load value and convert to Float32. | +// | kFloat64 | HeapNumber | Load value. | +// | kSimd128 | FixedArray<Smi>[4] | Untag each Smi and write the | +// | | | results into lanes of a new | +// | | | 128-bit vector. | // Handle<Code> BuildSetupFunction(Isolate* isolate, CallDescriptor* descriptor, std::vector<AllocatedOperand> parameters) { @@ -73,6 +78,32 @@ Handle<Code> BuildSetupFunction(Isolate* isolate, CallDescriptor* descriptor, params.push_back(__ Parameter(0)); params.push_back( __ HeapConstant(BuildTeardownFunction(isolate, descriptor, parameters))); + // 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. + Node* state_out = __ AllocateFixedArray(PACKED_ELEMENTS, + __ IntPtrConstant(parameters.size())); + for (int i = 0; i < static_cast<int>(parameters.size()); i++) { + switch (parameters[i].representation()) { + case MachineRepresentation::kTagged: + break; + case MachineRepresentation::kFloat32: + case MachineRepresentation::kFloat64: + __ StoreFixedArrayElement(state_out, i, __ AllocateHeapNumber()); + break; + case MachineRepresentation::kSimd128: { + __ StoreFixedArrayElement( + state_out, i, + __ AllocateFixedArray(PACKED_SMI_ELEMENTS, __ IntPtrConstant(4))); + break; + } + default: + UNREACHABLE(); + break; + } + } + params.push_back(state_out); + // Then take each element of the initial state and pass them as arguments. Node* state_in = __ Parameter(1); for (int i = 0; i < static_cast<int>(parameters.size()); i++) { Node* element = __ LoadFixedArrayElement(state_in, __ IntPtrConstant(i)); @@ -87,6 +118,21 @@ Handle<Code> BuildSetupFunction(Isolate* isolate, CallDescriptor* descriptor, case MachineRepresentation::kFloat64: element = __ LoadHeapNumberValue(element); break; + case MachineRepresentation::kSimd128: { + Node* vector = tester.raw_assembler_for_testing()->AddNode( + tester.raw_assembler_for_testing()->machine()->I32x4Splat(), + __ Int32Constant(0)); + for (int lane = 0; lane < 4; lane++) { + Node* lane_value = __ SmiToWord32( + __ LoadFixedArrayElement(element, __ IntPtrConstant(lane))); + vector = tester.raw_assembler_for_testing()->AddNode( + tester.raw_assembler_for_testing()->machine()->I32x4ReplaceLane( + lane), + vector, lane_value); + } + element = vector; + break; + } default: UNREACHABLE(); break; @@ -99,45 +145,59 @@ Handle<Code> BuildSetupFunction(Isolate* isolate, CallDescriptor* descriptor, return tester.GenerateCodeCloseAndEscape(); } -// Build the `teardown` function. It allocates and fills a FixedArray with all -// its parameters. The parameters need to be consistent with `parameters`. +// Build the `teardown` function. It takes a FixedArray as argument, fills it +// with the rest of its parameters and returns it. The parameters need to be +// consistent with `parameters`. // ~~~ -// FixedArray teardown(CodeObject* /* unused */, +// FixedArray teardown(CodeObject* /* unused */, FixedArray result, // // Tagged registers. // Object* r0, Object* r1, ..., // // FP registers. // Float32 s0, Float64 d1, ..., // // Mixed stack slots. // Float64 mem0, Object* mem1, Float32 mem2, ...) { -// return new FixedArray(r0, r1, ..., s0, d1, ..., mem0, mem1, mem2, ...); +// result[0] = r0; +// result[1] = r1; +// ... +// result[..] = s0; +// ... +// result[..] = mem0; +// ... +// return result; // } // ~~~ // // This function needs to convert its parameters into values fit for a // FixedArray, essentially reverting what the `setup` function did: // -// | Parameter type | Parameter value | Conversion | -// |----------------+-------------------+----------------------------| -// | kTagged | Smi or HeapNumber | None. | -// | kFloat32 | Raw Float32 | Convert to Float64 and | -// | | | allocate a new HeapNumber. | -// | kFloat64 | Raw Float64 | Allocate a new HeapNumber. | +// | Parameter type | Parameter value | Conversion | +// |----------------+-------------------+--------------------------------------| +// | kTagged | Smi or HeapNumber | None. | +// | kFloat32 | Raw Float32 | Convert to Float64. | +// | kFloat64 | Raw Float64 | None. | +// | kSimd128 | Raw Simd128 | Split into 4 Word32 values and tag | +// | | | them. | // // Note that it is possible for a `kTagged` value to go from a Smi to a // HeapNumber. This is because `AssembleMove` will allocate a new HeapNumber if // it is asked to move a FP constant to a tagged register or slot. // +// Finally, it is important that this function does not call `RecordWrite` which +// is why "setup" is in charge of all allocations and we are using +// SKIP_WRITE_BARRIER. The reason for this is that `RecordWrite` may clobber the +// top 64 bits of Simd128 registers. This is the case on x64, ia32 and Arm64 for +// example. Handle<Code> BuildTeardownFunction(Isolate* isolate, CallDescriptor* descriptor, std::vector<AllocatedOperand> parameters) { CodeAssemblerTester tester(isolate, descriptor); CodeStubAssembler assembler(tester.state()); - Node* result_array = __ AllocateFixedArray( - PACKED_ELEMENTS, __ IntPtrConstant(parameters.size())); + Node* result_array = __ Parameter(1); for (int i = 0; i < static_cast<int>(parameters.size()); i++) { - // The first argument is not used. - Node* param = __ Parameter(i + 1); + // The first argument is not used and the second is "result_array". + Node* param = __ Parameter(i + 2); switch (parameters[i].representation()) { case MachineRepresentation::kTagged: + __ StoreFixedArrayElement(result_array, i, param, SKIP_WRITE_BARRIER); break; // Box FP values into HeapNumbers. case MachineRepresentation::kFloat32: @@ -145,13 +205,28 @@ Handle<Code> BuildTeardownFunction(Isolate* isolate, CallDescriptor* descriptor, tester.raw_assembler_for_testing()->ChangeFloat32ToFloat64(param); // Fallthrough case MachineRepresentation::kFloat64: - param = __ AllocateHeapNumberWithValue(param); + __ StoreObjectFieldNoWriteBarrier( + __ LoadFixedArrayElement(result_array, i), HeapNumber::kValueOffset, + param, MachineRepresentation::kFloat64); break; + case MachineRepresentation::kSimd128: { + Node* vector = __ LoadFixedArrayElement(result_array, i); + for (int lane = 0; lane < 4; lane++) { + Node* lane_value = + __ SmiFromWord32(tester.raw_assembler_for_testing()->AddNode( + tester.raw_assembler_for_testing() + ->machine() + ->I32x4ExtractLane(lane), + param)); + __ StoreFixedArrayElement(vector, lane, lane_value, + SKIP_WRITE_BARRIER); + } + break; + } default: UNREACHABLE(); break; } - __ StoreFixedArrayElement(result_array, i, param); } __ Return(result_array); return tester.GenerateCodeCloseAndEscape(); @@ -159,7 +234,7 @@ Handle<Code> BuildTeardownFunction(Isolate* isolate, CallDescriptor* descriptor, // Print the content of `value`, representing the register or stack slot // described by `operand`. -void PrintStateValue(std::ostream& os, Handle<Object> value, +void PrintStateValue(std::ostream& os, Isolate* isolate, Handle<Object> value, AllocatedOperand operand) { switch (operand.representation()) { case MachineRepresentation::kTagged: @@ -173,6 +248,18 @@ void PrintStateValue(std::ostream& os, Handle<Object> value, case MachineRepresentation::kFloat64: os << value->Number(); break; + case MachineRepresentation::kSimd128: { + FixedArray* vector = FixedArray::cast(*value); + os << "["; + for (int lane = 0; lane < 4; lane++) { + os << Smi::cast(*vector->GetValueChecked<Smi>(isolate, lane))->value(); + if (lane < 3) { + os << ", "; + } + } + os << "]"; + break; + } default: UNREACHABLE(); break; @@ -187,6 +274,16 @@ void PrintStateValue(std::ostream& os, Handle<Object> value, os << ")"; } +bool TestSimd128Moves() { +#if defined(V8_TARGET_ARCH_MIPS) || defined(V8_TARGET_ARCH_MIPS64) + // TODO(mips): Implement support for the kSimd128 representation in + // AssembleMove and AssembleSwap on MIPS. + return false; +#else + return CpuFeatures::SupportsWasmSimd128(); +#endif +} + } // namespace #undef __ @@ -196,11 +293,11 @@ void PrintStateValue(std::ostream& os, Handle<Object> value, // with. It has the ability to randomly generate lists of moves and run the code // generated by the CodeGeneratorTester. // -// At the moment, only the following representations are tested: +// The following representations are tested: // - kTagged // - kFloat32 // - kFloat64 -// - TODO(planglois): Add support for kSimd128. +// - kSimd128 (if supported) // There is no need to test using Word32 or Word64 as they are the same as // Tagged as far as the code generator is concerned. // @@ -215,43 +312,49 @@ void PrintStateValue(std::ostream& os, Handle<Object> value, // // - The `setup` function receives a FixedArray as the initial state. It // unpacks it and passes each element as arguments to the generated code -// `test`. We also pass the `teardown` function as a first argument. Thanks -// to the custom CallDescriptor, registers and stack slots get initialised -// according to the content of the FixedArray. +// `test`. We also pass the `teardown` function as a first argument as well +// as a newly allocated FixedArray as a second argument which will hold the +// final results. Thanks to the custom CallDescriptor, registers and stack +// slots get initialised according to the content of the initial FixedArray. // // - The `test` function performs the list of moves on its parameters and // eventually tail-calls to its first parameter, which is the `teardown` // function. // -// - The `teardown` function allocates a new FixedArray and fills it with all -// its parameters. Thanks to the tail-call, this is as if the `setup` -// function called `teardown` directly, except now moves were performed! +// - The `teardown` function receives the final results as a FixedArray, fills +// it with the rest of its arguments and returns it. Thanks to the +// tail-call, this is as if the `setup` function called `teardown` directly, +// except now moves were performed! // // .----------------setup--------------------------. // | Take a FixedArray as parameters with | // | all the initial values of registers | // | and stack slots. | <- CodeStubAssembler // | | -// | Call test(teardown, state[0], state[1], ...); | +// | Allocate a new FixedArray `result` with | +// | initial values. | +// | | +// | Call test(teardown, result, state[0], | +// | state[1], state[2], ...); | // '-----------------------------------------------' // | // V -// .----------------test-----------------------------. -// | - Move(param3, param42); | -// | - Swap(param64, param1); | -// | - Move(param2, param6); | <- CodeGeneratorTester -// | ... | -// | | -// | // "teardown" is the first parameter as well as | -// | // the callee. | -// | TailCall param0(param0, param1, param2, ...); | -// '-------------------------------------------------' +// .----------------test-------------------------------. +// | - Move(param3, param42); | +// | - Swap(param64, param4); | +// | - Move(param2, param6); | <- CodeGeneratorTester +// | ... | +// | | +// | // "teardown" is the first parameter as well as | +// | // the callee. | +// | TailCall teardown(teardown, result, param2, ...); | +// '---------------------------------------------------' // | // V -// .----------------teardown--------------. -// | Create a FixedArray with all | -// | parameters and return it. | <- CodeStubAssembler -// '--------------------------------------' +// .----------------teardown---------------------------. +// | Fill in the incoming `result` FixedArray with all | +// | parameters and return it. | <- CodeStubAssembler +// '---------------------------------------------------' class TestEnvironment : public HandleAndZoneScope { public: @@ -263,8 +366,7 @@ class TestEnvironment : public HandleAndZoneScope { static constexpr int kTaggedSlotCount = 64; static constexpr int kFloat32SlotCount = 64; static constexpr int kFloat64SlotCount = 64; - static constexpr int kStackParameterCount = - kTaggedSlotCount + kFloat32SlotCount + kFloat64SlotCount; + static constexpr int kSimd128SlotCount = 16; // TODO(all): Test all types of constants (e.g. ExternalReference and // HeapObject). @@ -273,79 +375,138 @@ class TestEnvironment : public HandleAndZoneScope { static constexpr int kDoubleConstantCount = 4; TestEnvironment() - : blocks_(main_zone()), + : blocks_(1, main_zone()), code_(main_isolate(), main_zone(), &blocks_), rng_(CcTest::random_number_generator()), - // TODO(planglois): Support kSimd128. supported_reps_({MachineRepresentation::kTagged, MachineRepresentation::kFloat32, MachineRepresentation::kFloat64}) { + // Create and initialize a single empty block in blocks_. + InstructionBlock* block = new (main_zone()) InstructionBlock( + main_zone(), RpoNumber::FromInt(0), RpoNumber::Invalid(), + RpoNumber::Invalid(), false, false); + block->set_ao_number(RpoNumber::FromInt(0)); + blocks_[0] = block; + + int stack_slot_count = + kTaggedSlotCount + kFloat32SlotCount + kFloat64SlotCount; + if (TestSimd128Moves()) { + stack_slot_count += kSimd128SlotCount; + supported_reps_.push_back(MachineRepresentation::kSimd128); + } // The "teardown" and "test" functions share the same descriptor with the // following signature: // ~~~ - // FixedArray f(CodeObject* teardown, + // FixedArray f(CodeObject* teardown, FixedArray preallocated_result, // // Tagged registers. // Object*, Object*, ..., // // FP registers. - // Float32, Float64, ..., + // Float32, Float64, Simd128, ..., // // Mixed stack slots. - // Float64, Object*, Float32, ...); + // Float64, Object*, Float32, Simd128, ...); // ~~~ - LocationSignature::Builder test_signature(main_zone(), 1, - 1 + kGeneralRegisterCount + - kDoubleRegisterCount + - kStackParameterCount); + LocationSignature::Builder test_signature( + main_zone(), 1, + 2 + kGeneralRegisterCount + kDoubleRegisterCount + stack_slot_count); // The first parameter will be the code object of the "teardown" // function. This way, the "test" function can tail-call to it. test_signature.AddParam(LinkageLocation::ForRegister( kReturnRegister0.code(), MachineType::AnyTagged())); + // The second parameter will be a pre-allocated FixedArray that the + // "teardown" function will fill with result and then return. We place this + // parameter on the first stack argument slot which is always -1. And + // therefore slots to perform moves on start at -2. + test_signature.AddParam( + LinkageLocation::ForCallerFrameSlot(-1, MachineType::AnyTagged())); + int slot_parameter_n = -2; + const int kTotalStackParameterCount = stack_slot_count + 1; + // Initialise registers. + // Make sure that the target has enough general purpose registers to + // generate a call to a CodeObject using this descriptor. We have reserved + // 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); + int32_t general_mask = RegisterConfiguration::Default()->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( RegisterConfiguration::RestrictGeneralRegisters( - general_mask & ~(1 << kReturnRegister0.code()))); + general_mask & ~kReturnRegister0.bit())); for (int i = 0; i < kGeneralRegisterCount; i++) { int code = registers->GetAllocatableGeneralCode(i); AddRegister(&test_signature, MachineRepresentation::kTagged, code); } - // We assume that Double and Float registers alias, depending on - // kSimpleFPAliasing. For this reason, we allocate a Float and a Double in - // pairs. - static_assert((kDoubleRegisterCount % 2) == 0, - "kDoubleRegisterCount should be a multiple of two."); + // We assume that Double, Float and Simd128 registers alias, depending on + // kSimpleFPAliasing. For this reason, we allocate a Float, Double and + // Simd128 together, hence the reason why `kDoubleRegisterCount` should be a + // multiple of 3 and 2 in case Simd128 is not supported. + static_assert( + ((kDoubleRegisterCount % 2) == 0) && ((kDoubleRegisterCount % 3) == 0), + "kDoubleRegisterCount should be a multiple of two and three."); for (int i = 0; i < kDoubleRegisterCount; i += 2) { - // Make sure we do not allocate FP registers which alias. We double the - // index for Float registers if the aliasing is not "Simple": - // Simple -> s0, d1, s2, d3, s4, d5, ... - // Arm32-style -> s0, d1, s4, d3, s8, d5, ... - // This isn't space-efficient at all but suits our need. - static_assert(kDoubleRegisterCount < 16, - "Arm has a d16 register but no overlapping s32 register."); - int float_code = - registers->GetAllocatableFloatCode(kSimpleFPAliasing ? i : i * 2); - int double_code = registers->GetAllocatableDoubleCode(i + 1); - AddRegister(&test_signature, MachineRepresentation::kFloat32, float_code); - AddRegister(&test_signature, MachineRepresentation::kFloat64, - double_code); + if (kSimpleFPAliasing) { + // Allocate three registers at once if kSimd128 is supported, else + // allocate in pairs. + AddRegister(&test_signature, MachineRepresentation::kFloat32, + registers->GetAllocatableFloatCode(i)); + AddRegister(&test_signature, MachineRepresentation::kFloat64, + registers->GetAllocatableDoubleCode(i + 1)); + if (TestSimd128Moves()) { + AddRegister(&test_signature, MachineRepresentation::kSimd128, + registers->GetAllocatableSimd128Code(i + 2)); + i++; + } + } else { + // Make sure we do not allocate FP registers which alias. To do this, we + // allocate three 128-bit registers and then convert two of them to a + // float and a double. With this aliasing scheme, a Simd128 register + // aliases two Double registers and four Float registers, so we need to + // scale indexes accordingly: + // + // Simd128 register: q0, q1, q2, q3, q4, q5 + // | | | | + // V V V V + // Aliases: s0, d2, q2, s12, d8, q5 + // + // This isn't space efficient at all but suits our need. + static_assert( + kDoubleRegisterCount < 8, + "Arm has a q8 and a d16 register but no overlapping s32 register."); + int first_simd128 = registers->GetAllocatableSimd128Code(i); + int second_simd128 = registers->GetAllocatableSimd128Code(i + 1); + AddRegister(&test_signature, MachineRepresentation::kFloat32, + first_simd128 * 4); + AddRegister(&test_signature, MachineRepresentation::kFloat64, + second_simd128 * 2); + if (TestSimd128Moves()) { + int third_simd128 = registers->GetAllocatableSimd128Code(i + 2); + AddRegister(&test_signature, MachineRepresentation::kSimd128, + third_simd128); + i++; + } + } } // Initialise stack slots. - // Stack parameters start at -1. - int slot_parameter_n = -1; - - // TODO(planglois): Support kSimd128 stack slots. std::map<MachineRepresentation, int> slots = { {MachineRepresentation::kTagged, kTaggedSlotCount}, {MachineRepresentation::kFloat32, kFloat32SlotCount}, {MachineRepresentation::kFloat64, kFloat64SlotCount}}; + if (TestSimd128Moves()) { + slots.emplace(MachineRepresentation::kSimd128, kSimd128SlotCount); + } // Allocate new slots until we run out of them. while (std::any_of(slots.cbegin(), slots.cend(), @@ -408,7 +569,7 @@ class TestEnvironment : public HandleAndZoneScope { LinkageLocation::ForAnyRegister( MachineType::AnyTagged()), // target location test_signature.Build(), // location_sig - kStackParameterCount, // stack_parameter_count + kTotalStackParameterCount, // stack_parameter_count Operator::kNoProperties, // properties kNoCalleeSaved, // callee-saved registers kNoCalleeSaved, // callee-saved fp @@ -489,6 +650,15 @@ class TestEnvironment : public HandleAndZoneScope { state->set( i, *main_isolate()->factory()->NewHeapNumber(rng_->NextDouble())); break; + case MachineRepresentation::kSimd128: { + Handle<FixedArray> vector = + main_isolate()->factory()->NewFixedArray(4); + for (int lane = 0; lane < 4; lane++) { + vector->set(lane, Smi::FromInt(rng_->NextInt(Smi::kMaxValue))); + } + state->set(i, *vector); + break; + } default: UNREACHABLE(); break; @@ -611,17 +781,45 @@ class TestEnvironment : public HandleAndZoneScope { actual->GetValueChecked<Object>(main_isolate(), i); Handle<Object> expected_value = expected->GetValueChecked<Object>(main_isolate(), i); - if (!actual_value->StrictEquals(*expected_value)) { + if (!CompareValues(actual_value, expected_value, + layout_[i].representation())) { std::ostringstream expected_str; - PrintStateValue(expected_str, expected_value, layout_[i]); + PrintStateValue(expected_str, main_isolate(), expected_value, + layout_[i]); std::ostringstream actual_str; - PrintStateValue(actual_str, actual_value, layout_[i]); + PrintStateValue(actual_str, main_isolate(), actual_value, layout_[i]); V8_Fatal(__FILE__, __LINE__, "Expected: '%s' but got '%s'", expected_str.str().c_str(), actual_str.str().c_str()); } } } + bool CompareValues(Handle<Object> actual, Handle<Object> expected, + MachineRepresentation rep) { + switch (rep) { + case MachineRepresentation::kTagged: + case MachineRepresentation::kFloat32: + case MachineRepresentation::kFloat64: + return actual->StrictEquals(*expected); + case MachineRepresentation::kSimd128: + for (int lane = 0; lane < 4; lane++) { + Handle<Smi> actual_lane = + FixedArray::cast(*actual)->GetValueChecked<Smi>(main_isolate(), + lane); + Handle<Smi> expected_lane = + FixedArray::cast(*expected)->GetValueChecked<Smi>(main_isolate(), + lane); + if (!actual_lane->StrictEquals(*expected_lane)) { + return false; + } + } + return true; + default: + UNREACHABLE(); + break; + } + } + enum OperandConstraint { kNone, // Restrict operands to non-constants. This is useful when generating a @@ -741,7 +939,7 @@ constexpr int TestEnvironment::kDoubleRegisterCount; constexpr int TestEnvironment::kTaggedSlotCount; constexpr int TestEnvironment::kFloat32SlotCount; constexpr int TestEnvironment::kFloat64SlotCount; -constexpr int TestEnvironment::kStackParameterCount; +constexpr int TestEnvironment::kSimd128SlotCount; constexpr int TestEnvironment::kSmiConstantCount; constexpr int TestEnvironment::kFloatConstantCount; constexpr int TestEnvironment::kDoubleConstantCount; @@ -772,6 +970,16 @@ class CodeGeneratorTester { // frame is too big. } + Instruction* CreateTailCall(int stack_slot_delta) { + int optional_padding_slot = stack_slot_delta; + InstructionOperand callee[] = { + ImmediateOperand(ImmediateOperand::INLINE, optional_padding_slot), + ImmediateOperand(ImmediateOperand::INLINE, stack_slot_delta)}; + Instruction* tail_call = Instruction::New(zone_, kArchTailCallCodeObject, 0, + nullptr, 2, callee, 0, nullptr); + return tail_call; + } + enum PushTypeFlag { kRegisterPush = CodeGenerator::kRegisterPush, kStackSlotPush = CodeGenerator::kStackSlotPush, @@ -819,32 +1027,39 @@ class CodeGeneratorTester { } Handle<Code> Finalize() { + generator_.FinishCode(); + generator_.safepoints()->Emit(generator_.tasm(), + frame_.GetTotalFrameSlotCount()); + return generator_.FinalizeCode(); + } + + Handle<Code> FinalizeForExecuting() { + InstructionSequence* sequence = generator_.code(); + + sequence->StartBlock(RpoNumber::FromInt(0)); // The environment expects this code to tail-call to it's first parameter // placed in `kReturnRegister0`. - generator_.AssembleArchInstruction( - Instruction::New(zone_, kArchPrepareTailCall)); + sequence->AddInstruction(Instruction::New(zone_, kArchPrepareTailCall)); + // We use either zero or one slots. + int first_unused_stack_slot = + V8_TARGET_ARCH_STORES_RETURN_ADDRESS_ON_STACK ? 1 : 0; + int optional_padding_slot = first_unused_stack_slot; InstructionOperand callee[] = { AllocatedOperand(LocationOperand::REGISTER, MachineRepresentation::kTagged, kReturnRegister0.code()), - ImmediateOperand( - ImmediateOperand::INLINE, - V8_TARGET_ARCH_STORES_RETURN_ADDRESS_ON_STACK ? 1 : 0)}; + ImmediateOperand(ImmediateOperand::INLINE, optional_padding_slot), + ImmediateOperand(ImmediateOperand::INLINE, first_unused_stack_slot)}; Instruction* tail_call = Instruction::New(zone_, kArchTailCallCodeObject, 0, - nullptr, 2, callee, 0, nullptr); - int first_unused_stack_slot; - if (generator_.GetSlotAboveSPBeforeTailCall(tail_call, - &first_unused_stack_slot)) { - generator_.AssembleTailCallBeforeGap(tail_call, first_unused_stack_slot); - generator_.AssembleTailCallAfterGap(tail_call, first_unused_stack_slot); - } - generator_.AssembleArchInstruction(tail_call); + nullptr, 3, callee, 0, nullptr); + sequence->AddInstruction(tail_call); + sequence->EndBlock(RpoNumber::FromInt(0)); - generator_.FinishCode(); - generator_.safepoints()->Emit(generator_.tasm(), - frame_.GetTotalFrameSlotCount()); - return generator_.FinalizeCode(); + generator_.AssembleBlock( + sequence->InstructionBlockAt(RpoNumber::FromInt(0))); + + return Finalize(); } private: @@ -890,7 +1105,7 @@ TEST(FuzzAssembleMove) { c.CheckAssembleMove(&m->source(), &m->destination()); } - Handle<Code> test = c.Finalize(); + Handle<Code> test = c.FinalizeForExecuting(); if (FLAG_print_code) { test->Print(); } @@ -911,7 +1126,7 @@ TEST(FuzzAssembleSwap) { c.CheckAssembleSwap(&s->source(), &s->destination()); } - Handle<Code> test = c.Finalize(); + Handle<Code> test = c.FinalizeForExecuting(); if (FLAG_print_code) { test->Print(); } @@ -943,7 +1158,7 @@ TEST(FuzzAssembleMoveAndSwap) { } } - Handle<Code> test = c.Finalize(); + Handle<Code> test = c.FinalizeForExecuting(); if (FLAG_print_code) { test->Print(); } @@ -1003,7 +1218,7 @@ TEST(AssembleTailCallGap) { { // Generate a series of register pushes only. CodeGeneratorTester c(&env); - Instruction* instr = Instruction::New(env.main_zone(), kArchNop); + Instruction* instr = c.CreateTailCall(first_slot + 4); instr ->GetOrCreateParallelMove(Instruction::FIRST_GAP_POSITION, env.main_zone()) @@ -1032,7 +1247,7 @@ TEST(AssembleTailCallGap) { { // Generate a series of stack pushes only. CodeGeneratorTester c(&env); - Instruction* instr = Instruction::New(env.main_zone(), kArchNop); + Instruction* instr = c.CreateTailCall(first_slot + 4); instr ->GetOrCreateParallelMove(Instruction::FIRST_GAP_POSITION, env.main_zone()) @@ -1061,7 +1276,7 @@ TEST(AssembleTailCallGap) { { // Generate a mix of stack and register pushes. CodeGeneratorTester c(&env); - Instruction* instr = Instruction::New(env.main_zone(), kArchNop); + Instruction* instr = c.CreateTailCall(first_slot + 4); instr ->GetOrCreateParallelMove(Instruction::FIRST_GAP_POSITION, env.main_zone()) 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 9d9d634e33..3ae652e869 100644 --- a/deps/v8/test/cctest/compiler/test-js-typed-lowering.cc +++ b/deps/v8/test/cctest/compiler/test-js-typed-lowering.cc @@ -520,7 +520,7 @@ TEST(JSToString1) { { // ToString(number) Node* r = R.ReduceUnop(op, Type::Number()); - CHECK_EQ(IrOpcode::kJSToString, r->opcode()); + CHECK_EQ(IrOpcode::kNumberToString, r->opcode()); } { // ToString(string) diff --git a/deps/v8/test/cctest/compiler/test-loop-analysis.cc b/deps/v8/test/cctest/compiler/test-loop-analysis.cc index 29e0c2f444..734fa4bea3 100644 --- a/deps/v8/test/cctest/compiler/test-loop-analysis.cc +++ b/deps/v8/test/cctest/compiler/test-loop-analysis.cc @@ -45,7 +45,7 @@ class LoopFinderTester : HandleAndZoneScope { zero(jsgraph.Int32Constant(0)), one(jsgraph.OneConstant()), half(jsgraph.Constant(0.5)), - self(graph.NewNode(common.Int32Constant(0xaabbccdd))), + self(graph.NewNode(common.Int32Constant(0xAABBCCDD))), dead(graph.NewNode(common.Dead())), loop_tree(nullptr) { graph.SetEnd(end); diff --git a/deps/v8/test/cctest/compiler/test-machine-operator-reducer.cc b/deps/v8/test/cctest/compiler/test-machine-operator-reducer.cc index b41fe5184b..df18062acf 100644 --- a/deps/v8/test/cctest/compiler/test-machine-operator-reducer.cc +++ b/deps/v8/test/cctest/compiler/test-machine-operator-reducer.cc @@ -447,12 +447,12 @@ static void CheckJsShift(ReducerTester* R) { Node* x = R->Parameter(0); Node* y = R->Parameter(1); - Node* thirty_one = R->Constant<int32_t>(0x1f); + Node* thirty_one = R->Constant<int32_t>(0x1F); Node* y_and_thirty_one = R->graph.NewNode(R->machine.Word32And(), y, thirty_one); // If the underlying machine shift instructions 'and' their right operand - // with 0x1f then: x << (y & 0x1f) => x << y + // with 0x1F then: x << (y & 0x1F) => x << y R->CheckFoldBinop(x, y, x, y_and_thirty_one); } diff --git a/deps/v8/test/cctest/compiler/test-multiple-return.cc b/deps/v8/test/cctest/compiler/test-multiple-return.cc index 6be7814756..1f46e87077 100644 --- a/deps/v8/test/cctest/compiler/test-multiple-return.cc +++ b/deps/v8/test/cctest/compiler/test-multiple-return.cc @@ -5,13 +5,14 @@ #include <cmath> #include <functional> #include <limits> +#include <memory> #include "src/assembler.h" #include "src/base/bits.h" -#include "src/base/utils/random-number-generator.h" #include "src/codegen.h" #include "src/compiler.h" #include "src/compiler/linkage.h" +#include "src/machine-type.h" #include "src/macro-assembler.h" #include "src/objects-inl.h" #include "test/cctest/cctest.h" @@ -24,92 +25,360 @@ namespace compiler { namespace { -CallDescriptor* GetCallDescriptor(Zone* zone, int return_count, - int param_count) { - LocationSignature::Builder locations(zone, return_count, param_count); +int size(MachineType type) { + return 1 << ElementSizeLog2Of(type.representation()); +} + +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(); + } +} - // Add return location(s). - CHECK(return_count <= config->num_allocatable_general_registers()); - for (int i = 0; i < return_count; i++) { - locations.AddReturn(LinkageLocation::ForRegister( - config->allocatable_general_codes()[i], MachineType::AnyTagged())); +const int* codes(MachineType type) { + const RegisterConfiguration* config = RegisterConfiguration::Default(); + switch (type.representation()) { + case MachineRepresentation::kWord32: + case MachineRepresentation::kWord64: + return config->allocatable_general_codes(); + case MachineRepresentation::kFloat32: + return config->allocatable_float_codes(); + case MachineRepresentation::kFloat64: + return config->allocatable_double_codes(); + default: + UNREACHABLE(); } +} - // Add register and/or stack parameter(s). - CHECK(param_count <= config->num_allocatable_general_registers()); +CallDescriptor* CreateMonoCallDescriptor(Zone* zone, int return_count, + int param_count, MachineType type) { + LocationSignature::Builder locations(zone, return_count, param_count); + + int span = std::max(1, size(type) / kPointerSize); + int stack_params = 0; for (int i = 0; i < param_count; i++) { - locations.AddParam(LinkageLocation::ForRegister( - config->allocatable_general_codes()[i], MachineType::AnyTagged())); + LinkageLocation location = LinkageLocation::ForAnyRegister(); + if (i < num_registers(type)) { + location = LinkageLocation::ForRegister(codes(type)[i], type); + } else { + int slot = span * (i - param_count); + location = LinkageLocation::ForCallerFrameSlot(slot, type); + stack_params += span; + } + locations.AddParam(location); + } + + int stack_returns = 0; + for (int i = 0; i < return_count; i++) { + LinkageLocation location = LinkageLocation::ForAnyRegister(); + if (i < num_registers(type)) { + location = LinkageLocation::ForRegister(codes(type)[i], type); + } else { + int slot = span * (num_registers(type) - i) - stack_params - 1; + location = LinkageLocation::ForCallerFrameSlot(slot, type); + stack_returns += span; + } + locations.AddReturn(location); } const RegList kCalleeSaveRegisters = 0; const RegList kCalleeSaveFPRegisters = 0; - // The target for wasm calls is always a code object. MachineType target_type = MachineType::AnyTagged(); - LinkageLocation target_loc = LinkageLocation::ForAnyRegister(); + LinkageLocation target_loc = LinkageLocation::ForAnyRegister(target_type); return new (zone) CallDescriptor( // -- CallDescriptor::kCallCodeObject, // kind target_type, // target MachineType target_loc, // target location locations.Build(), // location_sig - 0, // js_parameter_count + stack_params, // on-stack parameter count compiler::Operator::kNoProperties, // properties kCalleeSaveRegisters, // callee-saved registers kCalleeSaveFPRegisters, // callee-saved fp regs CallDescriptor::kNoFlags, // flags - "c-call"); + "c-call", // debug name + 0, // allocatable registers + stack_returns); // on-stack return count } + } // namespace +Node* Constant(RawMachineAssembler& m, MachineType type, int value) { + switch (type.representation()) { + case MachineRepresentation::kWord32: + return m.Int32Constant(static_cast<int32_t>(value)); + case MachineRepresentation::kWord64: + return m.Int64Constant(static_cast<int64_t>(value)); + case MachineRepresentation::kFloat32: + return m.Float32Constant(static_cast<float>(value)); + case MachineRepresentation::kFloat64: + return m.Float64Constant(static_cast<double>(value)); + default: + UNREACHABLE(); + } +} -TEST(ReturnThreeValues) { - v8::internal::AccountingAllocator allocator; - Zone zone(&allocator, ZONE_NAME); - CallDescriptor* desc = GetCallDescriptor(&zone, 3, 2); - HandleAndZoneScope handles; - RawMachineAssembler m(handles.main_isolate(), - new (handles.main_zone()) Graph(handles.main_zone()), - desc, MachineType::PointerRepresentation(), - InstructionSelector::SupportedMachineOperatorFlags()); - - Node* p0 = m.Parameter(0); - Node* p1 = m.Parameter(1); - Node* add = m.Int32Add(p0, p1); - Node* sub = m.Int32Sub(p0, p1); - Node* mul = m.Int32Mul(p0, p1); - m.Return(add, sub, mul); - - CompilationInfo info(ArrayVector("testing"), handles.main_zone(), Code::STUB); - Handle<Code> code = Pipeline::GenerateCodeForTesting( - &info, handles.main_isolate(), desc, m.graph(), m.Export()); -#ifdef ENABLE_DISASSEMBLER - if (FLAG_print_code) { - OFStream os(stdout); - code->Disassemble("three_value", os); +Node* Add(RawMachineAssembler& m, MachineType type, Node* a, Node* b) { + switch (type.representation()) { + case MachineRepresentation::kWord32: + return m.Int32Add(a, b); + case MachineRepresentation::kWord64: + return m.Int64Add(a, b); + case MachineRepresentation::kFloat32: + return m.Float32Add(a, b); + case MachineRepresentation::kFloat64: + return m.Float64Add(a, b); + default: + UNREACHABLE(); } +} + +Node* Sub(RawMachineAssembler& m, MachineType type, Node* a, Node* b) { + switch (type.representation()) { + case MachineRepresentation::kWord32: + return m.Int32Sub(a, b); + case MachineRepresentation::kWord64: + return m.Int64Sub(a, b); + case MachineRepresentation::kFloat32: + return m.Float32Sub(a, b); + case MachineRepresentation::kFloat64: + return m.Float64Sub(a, b); + default: + UNREACHABLE(); + } +} + +Node* Mul(RawMachineAssembler& m, MachineType type, Node* a, Node* b) { + switch (type.representation()) { + case MachineRepresentation::kWord32: + return m.Int32Mul(a, b); + case MachineRepresentation::kWord64: + return m.Int64Mul(a, b); + case MachineRepresentation::kFloat32: + return m.Float32Mul(a, b); + case MachineRepresentation::kFloat64: + return m.Float64Mul(a, b); + default: + UNREACHABLE(); + } +} + +Node* ToInt32(RawMachineAssembler& m, MachineType type, Node* a) { + switch (type.representation()) { + case MachineRepresentation::kWord32: + return a; + case MachineRepresentation::kWord64: + return m.TruncateInt64ToInt32(a); + case MachineRepresentation::kFloat32: + return m.TruncateFloat32ToInt32(a); + case MachineRepresentation::kFloat64: + return m.RoundFloat64ToInt32(a); + default: + UNREACHABLE(); + } +} + +void TestReturnMultipleValues(MachineType type) { + const int kMaxCount = 20; + for (int count = 0; count < kMaxCount; ++count) { + printf("\n==== type = %s, count = %d ====\n\n\n", + MachineReprToString(type.representation()), count); + v8::internal::AccountingAllocator allocator; + Zone zone(&allocator, ZONE_NAME); + CallDescriptor* desc = CreateMonoCallDescriptor(&zone, count, 2, type); + HandleAndZoneScope handles; + RawMachineAssembler m(handles.main_isolate(), + new (handles.main_zone()) Graph(handles.main_zone()), + desc, MachineType::PointerRepresentation(), + InstructionSelector::SupportedMachineOperatorFlags()); + + Node* p0 = m.Parameter(0); + Node* p1 = m.Parameter(1); + typedef Node* Node_ptr; + std::unique_ptr<Node_ptr[]> returns(new Node_ptr[count]); + for (int i = 0; i < count; ++i) { + if (i % 3 == 0) returns[i] = Add(m, type, p0, p1); + if (i % 3 == 1) returns[i] = Sub(m, type, p0, p1); + if (i % 3 == 2) returns[i] = Mul(m, type, p0, p1); + } + m.Return(count, returns.get()); + + CompilationInfo info(ArrayVector("testing"), handles.main_zone(), + Code::STUB); + Handle<Code> code = Pipeline::GenerateCodeForTesting( + &info, handles.main_isolate(), desc, m.graph(), m.Export()); +#ifdef ENABLE_DISASSEMBLER + if (FLAG_print_code) { + OFStream os(stdout); + code->Disassemble("multi_value", os); + } #endif - RawMachineAssemblerTester<int32_t> mt; - Node* a = mt.Int32Constant(123); - Node* b = mt.Int32Constant(456); - Node* ret3 = mt.AddNode(mt.common()->Call(desc), mt.HeapConstant(code), a, b); - Node* x = mt.AddNode(mt.common()->Projection(0), ret3); - Node* y = mt.AddNode(mt.common()->Projection(1), ret3); - Node* z = mt.AddNode(mt.common()->Projection(2), ret3); - Node* ret = mt.Int32Add(mt.Int32Add(x, y), z); - mt.Return(ret); + const int a = 47, b = 12; + int expect = 0; + for (int i = 0, sign = +1; i < count; ++i) { + if (i % 3 == 0) expect += sign * (a + b); + if (i % 3 == 1) expect += sign * (a - b); + if (i % 3 == 2) expect += sign * (a * b); + if (i % 4 == 0) sign = -sign; + } + + RawMachineAssemblerTester<int32_t> mt; + Node* na = Constant(mt, type, a); + Node* nb = Constant(mt, type, b); + Node* ret_multi = + mt.AddNode(mt.common()->Call(desc), mt.HeapConstant(code), na, nb); + Node* ret = Constant(mt, type, 0); + bool sign = false; + for (int i = 0; i < count; ++i) { + Node* x = (count == 1) + ? ret_multi + : mt.AddNode(mt.common()->Projection(i), ret_multi); + ret = sign ? Sub(mt, type, ret, x) : Add(mt, type, ret, x); + if (i % 4 == 0) sign = !sign; + } + mt.Return(ToInt32(mt, type, ret)); #ifdef ENABLE_DISASSEMBLER - Handle<Code> code2 = mt.GetCode(); - if (FLAG_print_code) { - OFStream os(stdout); - code2->Disassemble("three_value_call", os); + Handle<Code> code2 = mt.GetCode(); + if (FLAG_print_code) { + OFStream os(stdout); + code2->Disassemble("multi_value_call", os); + } +#endif + CHECK_EQ(expect, mt.Call()); + } +} + +#define TEST_MULTI(Type, type) \ + TEST(ReturnMultiple##Type) { TestReturnMultipleValues(type); } + +TEST_MULTI(Int32, MachineType::Int32()) +#if (!V8_TARGET_ARCH_32_BIT) +TEST_MULTI(Int64, MachineType::Int64()) +#endif +TEST_MULTI(Float32, MachineType::Float32()) +TEST_MULTI(Float64, MachineType::Float64()) + +#undef TEST_MULTI + +void ReturnLastValue(MachineType type) { + int slot_counts[] = {1, 2, 3, 600}; + for (auto slot_count : slot_counts) { + v8::internal::AccountingAllocator allocator; + Zone zone(&allocator, ZONE_NAME); + const int return_count = num_registers(type) + slot_count; + + CallDescriptor* desc = + CreateMonoCallDescriptor(&zone, return_count, 0, type); + + HandleAndZoneScope handles; + RawMachineAssembler m(handles.main_isolate(), + new (handles.main_zone()) Graph(handles.main_zone()), + desc, MachineType::PointerRepresentation(), + InstructionSelector::SupportedMachineOperatorFlags()); + + std::unique_ptr<Node* []> returns(new Node*[return_count]); + + for (int i = 0; i < return_count; ++i) { + returns[i] = Constant(m, type, i); + } + + m.Return(return_count, returns.get()); + + CompilationInfo info(ArrayVector("testing"), handles.main_zone(), + Code::STUB); + Handle<Code> code = Pipeline::GenerateCodeForTesting( + &info, handles.main_isolate(), desc, m.graph(), m.Export()); + + // Generate caller. + int expect = return_count - 1; + RawMachineAssemblerTester<int32_t> mt; + Node* code_node = mt.HeapConstant(code); + + Node* call = mt.AddNode(mt.common()->Call(desc), 1, &code_node); + + mt.Return(ToInt32( + mt, type, mt.AddNode(mt.common()->Projection(return_count - 1), call))); + + CHECK_EQ(expect, mt.Call()); } +} + +TEST(ReturnLastValueInt32) { ReturnLastValue(MachineType::Int32()); } +#if (!V8_TARGET_ARCH_32_BIT) +TEST(ReturnLastValueInt64) { ReturnLastValue(MachineType::Int64()); } #endif - CHECK_EQ((123 + 456) + (123 - 456) + (123 * 456), mt.Call()); +TEST(ReturnLastValueFloat32) { ReturnLastValue(MachineType::Float32()); } +TEST(ReturnLastValueFloat64) { ReturnLastValue(MachineType::Float64()); } + +void ReturnSumOfReturns(MachineType type) { + for (int unused_stack_slots = 0; unused_stack_slots <= 2; + ++unused_stack_slots) { + v8::internal::AccountingAllocator allocator; + Zone zone(&allocator, ZONE_NAME); + // Let {unused_stack_slots + 1} returns be on the stack. + const int return_count = num_registers(type) + unused_stack_slots + 1; + + CallDescriptor* desc = + CreateMonoCallDescriptor(&zone, return_count, 0, type); + + HandleAndZoneScope handles; + RawMachineAssembler m(handles.main_isolate(), + new (handles.main_zone()) Graph(handles.main_zone()), + desc, MachineType::PointerRepresentation(), + InstructionSelector::SupportedMachineOperatorFlags()); + + std::unique_ptr<Node* []> returns(new Node*[return_count]); + + for (int i = 0; i < return_count; ++i) { + returns[i] = Constant(m, type, i); + } + + m.Return(return_count, returns.get()); + + CompilationInfo info(ArrayVector("testing"), handles.main_zone(), + Code::STUB); + Handle<Code> code = Pipeline::GenerateCodeForTesting( + &info, handles.main_isolate(), desc, m.graph(), m.Export()); + + // Generate caller. + RawMachineAssemblerTester<int32_t> mt; + Node* code_node = mt.HeapConstant(code); + + Node* call = mt.AddNode(mt.common()->Call(desc), 1, &code_node); + + uint32_t expect = 0; + Node* result = mt.Int32Constant(0); + + for (int i = 0; i < return_count; ++i) { + expect += i; + result = mt.Int32Add( + result, + ToInt32(mt, type, mt.AddNode(mt.common()->Projection(i), call))); + } + + mt.Return(result); + + CHECK_EQ(expect, mt.Call()); + } } +TEST(ReturnSumOfReturnsInt32) { ReturnSumOfReturns(MachineType::Int32()); } +#if (!V8_TARGET_ARCH_32_BIT) +TEST(ReturnSumOfReturnsInt64) { ReturnSumOfReturns(MachineType::Int64()); } +#endif +TEST(ReturnSumOfReturnsFloat32) { ReturnSumOfReturns(MachineType::Float32()); } +TEST(ReturnSumOfReturnsFloat64) { ReturnSumOfReturns(MachineType::Float64()); } + } // namespace compiler } // namespace internal } // namespace v8 diff --git a/deps/v8/test/cctest/compiler/test-operator.cc b/deps/v8/test/cctest/compiler/test-operator.cc index 10dad490b8..7428359223 100644 --- a/deps/v8/test/cctest/compiler/test-operator.cc +++ b/deps/v8/test/cctest/compiler/test-operator.cc @@ -261,7 +261,7 @@ TEST(TestOpParameter_Operator1float) { TEST(TestOpParameter_Operator1int) { - int values[] = {7777, -66, 0, 11, 1, 0x666aff}; + int values[] = {7777, -66, 0, 11, 1, 0x666AFF}; for (size_t i = 0; i < arraysize(values); i++) { Operator1<int> op(33, NONE, "Scurvy", 0, 0, 0, 0, 0, 0, values[i]); diff --git a/deps/v8/test/cctest/compiler/test-representation-change.cc b/deps/v8/test/cctest/compiler/test-representation-change.cc index e61713f836..08cd73f4ce 100644 --- a/deps/v8/test/cctest/compiler/test-representation-change.cc +++ b/deps/v8/test/cctest/compiler/test-representation-change.cc @@ -285,7 +285,7 @@ static void CheckChange(IrOpcode::Value expected, MachineRepresentation from, from_type->Maybe(Type::MinusZero()) ? use_info.minus_zero_check() : CheckForMinusZeroMode::kDontCheckForMinusZero; - CHECK_EQ(mode, CheckMinusZeroModeOf(c->op())); + CHECK_EQ(mode, CheckMinusZeroParametersOf(c->op()).mode()); } } @@ -444,11 +444,13 @@ TEST(SignednessInWord32) { static void TestMinusZeroCheck(IrOpcode::Value expected, Type* from_type) { RepresentationChangerTester r; - CheckChange(expected, MachineRepresentation::kFloat64, from_type, - UseInfo::CheckedSignedSmallAsWord32(kDistinguishZeros)); + CheckChange( + expected, MachineRepresentation::kFloat64, from_type, + UseInfo::CheckedSignedSmallAsWord32(kDistinguishZeros, VectorSlotPair())); - CheckChange(expected, MachineRepresentation::kFloat64, from_type, - UseInfo::CheckedSignedSmallAsWord32(kIdentifyZeros)); + CheckChange( + expected, MachineRepresentation::kFloat64, from_type, + UseInfo::CheckedSignedSmallAsWord32(kIdentifyZeros, VectorSlotPair())); CheckChange(expected, MachineRepresentation::kFloat64, from_type, UseInfo::CheckedSigned32AsWord32(kDistinguishZeros)); diff --git a/deps/v8/test/cctest/compiler/test-run-jsops.cc b/deps/v8/test/cctest/compiler/test-run-jsops.cc index 49033f7995..dfa2299cff 100644 --- a/deps/v8/test/cctest/compiler/test-run-jsops.cc +++ b/deps/v8/test/cctest/compiler/test-run-jsops.cc @@ -104,7 +104,7 @@ TEST(BinopShiftRightLogical) { FunctionTester T("(function(a,b) { return a >>> b; })"); T.CheckCall(4, 8, 1); - T.CheckCall(0x7ffffffc, -8, 1); + T.CheckCall(0x7FFFFFFC, -8, 1); T.CheckCall(T.Val(4), T.Val("8"), T.Val(1)); T.CheckCall(T.Val(4), T.Val(8), T.Val("1")); } diff --git a/deps/v8/test/cctest/compiler/test-run-load-store.cc b/deps/v8/test/cctest/compiler/test-run-load-store.cc index 2774bbe814..8014d5bffc 100644 --- a/deps/v8/test/cctest/compiler/test-run-load-store.cc +++ b/deps/v8/test/cctest/compiler/test-run-load-store.cc @@ -16,33 +16,6 @@ #include "test/cctest/compiler/value-helper.h" -namespace { -template <typename Type> -void CheckOobValue(Type val) { - UNREACHABLE(); -} - -template <> -void CheckOobValue(int32_t val) { - CHECK_EQ(0, val); -} - -template <> -void CheckOobValue(int64_t val) { - CHECK_EQ(0, val); -} - -template <> -void CheckOobValue(float val) { - CHECK(std::isnan(val)); -} - -template <> -void CheckOobValue(double val) { - CHECK(std::isnan(val)); -} -} // namespace - namespace v8 { namespace internal { namespace compiler { @@ -80,7 +53,7 @@ void RunLoadInt32Offset(TestAlignment t) { int32_t p1 = 0; // loads directly from this location. int32_t offsets[] = {-2000000, -100, -101, 1, 3, - 7, 120, 2000, 2000000000, 0xff}; + 7, 120, 2000, 2000000000, 0xFF}; for (size_t i = 0; i < arraysize(offsets); i++) { RawMachineAssemblerTester<int32_t> m; @@ -109,7 +82,7 @@ void RunLoadStoreFloat32Offset(TestAlignment t) { float p2 = 0.0f; // and stores directly into this location. FOR_INT32_INPUTS(i) { - int32_t magic = 0x2342aabb + *i * 3; + int32_t magic = 0x2342AABB + *i * 3; RawMachineAssemblerTester<int32_t> m; int32_t offset = *i; byte* from = reinterpret_cast<byte*>(&p1) - offset; @@ -146,7 +119,7 @@ void RunLoadStoreFloat64Offset(TestAlignment t) { double p2 = 0; // and stores directly into this location. FOR_INT32_INPUTS(i) { - int32_t magic = 0x2342aabb + *i * 3; + int32_t magic = 0x2342AABB + *i * 3; RawMachineAssemblerTester<int32_t> m; int32_t offset = *i; byte* from = reinterpret_cast<byte*>(&p1) - offset; @@ -418,9 +391,9 @@ void RunLoadStoreSignExtend32(TestAlignment t) { FOR_INT32_INPUTS(i) { buffer[0] = *i; - CHECK_EQ(static_cast<int8_t>(*i & 0xff), m.Call()); - CHECK_EQ(static_cast<int8_t>(*i & 0xff), buffer[1]); - CHECK_EQ(static_cast<int16_t>(*i & 0xffff), buffer[2]); + CHECK_EQ(static_cast<int8_t>(*i & 0xFF), m.Call()); + CHECK_EQ(static_cast<int8_t>(*i & 0xFF), buffer[1]); + CHECK_EQ(static_cast<int16_t>(*i & 0xFFFF), buffer[2]); CHECK_EQ(*i, buffer[3]); } } @@ -451,9 +424,9 @@ void RunLoadStoreZeroExtend32(TestAlignment t) { FOR_UINT32_INPUTS(i) { buffer[0] = *i; - CHECK_EQ((*i & 0xff), m.Call()); - CHECK_EQ((*i & 0xff), buffer[1]); - CHECK_EQ((*i & 0xffff), buffer[2]); + CHECK_EQ((*i & 0xFF), m.Call()); + CHECK_EQ((*i & 0xFF), buffer[1]); + CHECK_EQ((*i & 0xFFFF), buffer[2]); CHECK_EQ(*i, buffer[3]); } } @@ -479,7 +452,7 @@ TEST(RunUnalignedLoadStoreZeroExtend32) { namespace { void RunLoadStoreSignExtend64(TestAlignment t) { - if (true) return; // TODO(titzer): sign extension of loads to 64-bit. + if ((true)) return; // TODO(titzer): sign extension of loads to 64-bit. int64_t buffer[5]; RawMachineAssemblerTester<int64_t> m; Node* load8 = m.LoadFromPointer(LSB(&buffer[0], 1), MachineType::Int8()); @@ -512,10 +485,10 @@ void RunLoadStoreSignExtend64(TestAlignment t) { FOR_INT64_INPUTS(i) { buffer[0] = *i; - CHECK_EQ(static_cast<int8_t>(*i & 0xff), m.Call()); - CHECK_EQ(static_cast<int8_t>(*i & 0xff), buffer[1]); - CHECK_EQ(static_cast<int16_t>(*i & 0xffff), buffer[2]); - CHECK_EQ(static_cast<int32_t>(*i & 0xffffffff), buffer[3]); + CHECK_EQ(static_cast<int8_t>(*i & 0xFF), m.Call()); + CHECK_EQ(static_cast<int8_t>(*i & 0xFF), buffer[1]); + CHECK_EQ(static_cast<int16_t>(*i & 0xFFFF), buffer[2]); + CHECK_EQ(static_cast<int32_t>(*i & 0xFFFFFFFF), buffer[3]); CHECK_EQ(*i, buffer[4]); } } @@ -555,31 +528,16 @@ void RunLoadStoreZeroExtend64(TestAlignment t) { FOR_UINT64_INPUTS(i) { buffer[0] = *i; - CHECK_EQ((*i & 0xff), m.Call()); - CHECK_EQ((*i & 0xff), buffer[1]); - CHECK_EQ((*i & 0xffff), buffer[2]); - CHECK_EQ((*i & 0xffffffff), buffer[3]); + CHECK_EQ((*i & 0xFF), m.Call()); + CHECK_EQ((*i & 0xFF), buffer[1]); + CHECK_EQ((*i & 0xFFFF), buffer[2]); + CHECK_EQ((*i & 0xFFFFFFFF), buffer[3]); CHECK_EQ(*i, buffer[4]); } } } // namespace -TEST(RunCheckedLoadInt64) { - int64_t buffer[] = {0x66bbccddeeff0011LL, 0x1122334455667788LL}; - RawMachineAssemblerTester<int64_t> m(MachineType::Int32()); - Node* base = m.PointerConstant(buffer); - Node* index = m.Parameter(0); - Node* length = m.Int32Constant(16); - Node* load = m.AddNode(m.machine()->CheckedLoad(MachineType::Int64()), base, - index, length); - m.Return(load); - - CHECK_EQ(buffer[0], m.Call(0)); - CHECK_EQ(buffer[1], m.Call(8)); - CheckOobValue(m.Call(16)); -} - TEST(RunLoadStoreSignExtend64) { RunLoadStoreSignExtend64(TestAlignment::kAligned); } @@ -596,33 +554,6 @@ TEST(RunUnalignedLoadStoreZeroExtend64) { RunLoadStoreZeroExtend64(TestAlignment::kUnaligned); } -TEST(RunCheckedStoreInt64) { - const int64_t write = 0x5566778899aabbLL; - const int64_t before = 0x33bbccddeeff0011LL; - int64_t buffer[] = {before, before}; - RawMachineAssemblerTester<int32_t> m(MachineType::Int32()); - Node* base = m.PointerConstant(buffer); - Node* index = m.Parameter(0); - Node* length = m.Int32Constant(16); - Node* value = m.Int64Constant(write); - Node* store = - m.AddNode(m.machine()->CheckedStore(MachineRepresentation::kWord64), base, - index, length, value); - USE(store); - m.Return(m.Int32Constant(11)); - - CHECK_EQ(11, m.Call(16)); - CHECK_EQ(before, buffer[0]); - CHECK_EQ(before, buffer[1]); - - CHECK_EQ(11, m.Call(0)); - CHECK_EQ(write, buffer[0]); - CHECK_EQ(before, buffer[1]); - - CHECK_EQ(11, m.Call(8)); - CHECK_EQ(write, buffer[0]); - CHECK_EQ(write, buffer[1]); -} #endif namespace { @@ -677,515 +608,6 @@ TEST(RunUnalignedLoadStoreTruncation) { LoadStoreTruncation<int16_t>(MachineType::Int16(), TestAlignment::kUnaligned); } -void TestRunOobCheckedLoad(bool length_is_immediate) { - USE(CheckOobValue<int32_t>); - USE(CheckOobValue<int64_t>); - USE(CheckOobValue<float>); - USE(CheckOobValue<double>); - - RawMachineAssemblerTester<int32_t> m(MachineType::Int32(), - MachineType::Int32()); - MachineOperatorBuilder machine(m.zone()); - const int32_t kNumElems = 27; - const int32_t kLength = kNumElems * 4; - - int32_t buffer[kNumElems]; - Node* base = m.PointerConstant(buffer); - Node* offset = m.Parameter(0); - Node* len = length_is_immediate ? m.Int32Constant(kLength) : m.Parameter(1); - Node* node = - m.AddNode(machine.CheckedLoad(MachineType::Int32()), base, offset, len); - m.Return(node); - - { - // randomize memory. - v8::base::RandomNumberGenerator rng; - rng.SetSeed(100); - rng.NextBytes(&buffer[0], sizeof(buffer)); - } - - // in-bounds accesses. - for (int32_t i = 0; i < kNumElems; i++) { - int32_t offset = static_cast<int32_t>(i * sizeof(int32_t)); - int32_t expected = buffer[i]; - CHECK_EQ(expected, m.Call(offset, kLength)); - } - - // slightly out-of-bounds accesses. - for (int32_t i = kLength; i < kNumElems + 30; i++) { - int32_t offset = static_cast<int32_t>(i * sizeof(int32_t)); - CheckOobValue(m.Call(offset, kLength)); - } - - // way out-of-bounds accesses. - for (int32_t offset = -2000000000; offset <= 2000000000; - offset += 100000000) { - if (offset == 0) continue; - CheckOobValue(m.Call(offset, kLength)); - } -} - -TEST(RunOobCheckedLoad) { TestRunOobCheckedLoad(false); } - -TEST(RunOobCheckedLoadImm) { TestRunOobCheckedLoad(true); } - -void TestRunOobCheckedStore(bool length_is_immediate) { - RawMachineAssemblerTester<int32_t> m(MachineType::Int32(), - MachineType::Int32()); - MachineOperatorBuilder machine(m.zone()); - const int32_t kNumElems = 29; - const int32_t kValue = -78227234; - const int32_t kLength = kNumElems * 4; - - int32_t buffer[kNumElems + kNumElems]; - Node* base = m.PointerConstant(buffer); - Node* offset = m.Parameter(0); - Node* len = length_is_immediate ? m.Int32Constant(kLength) : m.Parameter(1); - Node* val = m.Int32Constant(kValue); - m.AddNode(machine.CheckedStore(MachineRepresentation::kWord32), base, offset, - len, val); - m.Return(val); - - // in-bounds accesses. - for (int32_t i = 0; i < kNumElems; i++) { - memset(buffer, 0, sizeof(buffer)); - int32_t offset = static_cast<int32_t>(i * sizeof(int32_t)); - CHECK_EQ(kValue, m.Call(offset, kLength)); - for (int32_t j = 0; j < kNumElems + kNumElems; j++) { - if (i == j) { - CHECK_EQ(kValue, buffer[j]); - } else { - CHECK_EQ(0, buffer[j]); - } - } - } - - memset(buffer, 0, sizeof(buffer)); - - // slightly out-of-bounds accesses. - for (int32_t i = kLength; i < kNumElems + 30; i++) { - int32_t offset = static_cast<int32_t>(i * sizeof(int32_t)); - CHECK_EQ(kValue, m.Call(offset, kLength)); - for (int32_t j = 0; j < kNumElems + kNumElems; j++) { - CHECK_EQ(0, buffer[j]); - } - } - - // way out-of-bounds accesses. - for (int32_t offset = -2000000000; offset <= 2000000000; - offset += 100000000) { - if (offset == 0) continue; - CHECK_EQ(kValue, m.Call(offset, kLength)); - for (int32_t j = 0; j < kNumElems + kNumElems; j++) { - CHECK_EQ(0, buffer[j]); - } - } -} - -TEST(RunOobCheckedStore) { TestRunOobCheckedStore(false); } - -TEST(RunOobCheckedStoreImm) { TestRunOobCheckedStore(true); } - -// TODO(titzer): CheckedLoad/CheckedStore don't support 64-bit offsets. -#define ALLOW_64_BIT_OFFSETS 0 - -#if V8_TARGET_ARCH_64_BIT && ALLOW_64_BIT_OFFSETS - -void TestRunOobCheckedLoad64(uint32_t pseudo_base, bool length_is_immediate) { - RawMachineAssemblerTester<int32_t> m(MachineType::Uint64(), - MachineType::Uint64()); - MachineOperatorBuilder machine(m.zone()); - const uint32_t kNumElems = 25; - const uint32_t kLength = kNumElems * 4; - int32_t real_buffer[kNumElems]; - - // Simulate the end of a large buffer. - int32_t* buffer = real_buffer - (pseudo_base / 4); - uint64_t length = kLength + pseudo_base; - - Node* base = m.PointerConstant(buffer); - Node* offset = m.Parameter(0); - Node* len = length_is_immediate ? m.Int64Constant(length) : m.Parameter(1); - Node* node = - m.AddNode(machine.CheckedLoad(MachineType::Int32()), base, offset, len); - m.Return(node); - - { - // randomize memory. - v8::base::RandomNumberGenerator rng; - rng.SetSeed(100); - rng.NextBytes(&real_buffer[0], sizeof(real_buffer)); - } - - // in-bounds accesses. - for (uint32_t i = 0; i < kNumElems; i++) { - uint64_t offset = pseudo_base + i * 4; - int32_t expected = real_buffer[i]; - CHECK_EQ(expected, m.Call(offset, length)); - } - - // in-bounds accesses w.r.t lower 32-bits, but upper bits set. - for (uint64_t i = 0x100000000ULL; i != 0; i <<= 1) { - uint64_t offset = pseudo_base + i; - CheckOobValue(m.Call(offset, length)); - } - - // slightly out-of-bounds accesses. - for (uint32_t i = kLength; i < kNumElems + 30; i++) { - uint64_t offset = pseudo_base + i * 4; - CheckOobValue(0, m.Call(offset, length)); - } - - // way out-of-bounds accesses. - for (uint64_t offset = length; offset < 100 * A_BILLION; offset += A_GIG) { - if (offset < length) continue; - CheckOobValue(0, m.Call(offset, length)); - } -} - -TEST(RunOobCheckedLoad64_0) { - TestRunOobCheckedLoad64(0, false); - TestRunOobCheckedLoad64(0, true); -} - -TEST(RunOobCheckedLoad64_1) { - TestRunOobCheckedLoad64(1 * A_BILLION, false); - TestRunOobCheckedLoad64(1 * A_BILLION, true); -} - -TEST(RunOobCheckedLoad64_2) { - TestRunOobCheckedLoad64(2 * A_BILLION, false); - TestRunOobCheckedLoad64(2 * A_BILLION, true); -} - -TEST(RunOobCheckedLoad64_3) { - TestRunOobCheckedLoad64(3 * A_BILLION, false); - TestRunOobCheckedLoad64(3 * A_BILLION, true); -} - -TEST(RunOobCheckedLoad64_4) { - TestRunOobCheckedLoad64(4 * A_BILLION, false); - TestRunOobCheckedLoad64(4 * A_BILLION, true); -} - -void TestRunOobCheckedStore64(uint32_t pseudo_base, bool length_is_immediate) { - RawMachineAssemblerTester<int32_t> m(MachineType::Uint64(), - MachineType::Uint64()); - MachineOperatorBuilder machine(m.zone()); - const uint32_t kNumElems = 21; - const uint32_t kLength = kNumElems * 4; - const uint32_t kValue = 897234987; - int32_t real_buffer[kNumElems + kNumElems]; - - // Simulate the end of a large buffer. - int32_t* buffer = real_buffer - (pseudo_base / 4); - uint64_t length = kLength + pseudo_base; - - Node* base = m.PointerConstant(buffer); - Node* offset = m.Parameter(0); - Node* len = length_is_immediate ? m.Int64Constant(length) : m.Parameter(1); - Node* val = m.Int32Constant(kValue); - m.AddNode(machine.CheckedStore(MachineRepresentation::kWord32), base, offset, - len, val); - m.Return(val); - - // in-bounds accesses. - for (uint32_t i = 0; i < kNumElems; i++) { - memset(real_buffer, 0, sizeof(real_buffer)); - uint64_t offset = pseudo_base + i * 4; - CHECK_EQ(kValue, m.Call(offset, length)); - for (uint32_t j = 0; j < kNumElems + kNumElems; j++) { - if (i == j) { - CHECK_EQ(kValue, real_buffer[j]); - } else { - CHECK_EQ(0, real_buffer[j]); - } - } - } - - memset(real_buffer, 0, sizeof(real_buffer)); - - // in-bounds accesses w.r.t lower 32-bits, but upper bits set. - for (uint64_t i = 0x100000000ULL; i != 0; i <<= 1) { - uint64_t offset = pseudo_base + i; - CHECK_EQ(kValue, m.Call(offset, length)); - for (int32_t j = 0; j < kNumElems + kNumElems; j++) { - CHECK_EQ(0, real_buffer[j]); - } - } - - // slightly out-of-bounds accesses. - for (uint32_t i = kLength; i < kNumElems + 30; i++) { - uint64_t offset = pseudo_base + i * 4; - CHECK_EQ(kValue, m.Call(offset, length)); - for (int32_t j = 0; j < kNumElems + kNumElems; j++) { - CHECK_EQ(0, real_buffer[j]); - } - } - - // way out-of-bounds accesses. - for (uint64_t offset = length; offset < 100 * A_BILLION; offset += A_GIG) { - if (offset < length) continue; - CHECK_EQ(kValue, m.Call(offset, length)); - for (int32_t j = 0; j < kNumElems + kNumElems; j++) { - CHECK_EQ(0, real_buffer[j]); - } - } -} - -TEST(RunOobCheckedStore64_0) { - TestRunOobCheckedStore64(0, false); - TestRunOobCheckedStore64(0, true); -} - -TEST(RunOobCheckedStore64_1) { - TestRunOobCheckedStore64(1 * A_BILLION, false); - TestRunOobCheckedStore64(1 * A_BILLION, true); -} - -TEST(RunOobCheckedStore64_2) { - TestRunOobCheckedStore64(2 * A_BILLION, false); - TestRunOobCheckedStore64(2 * A_BILLION, true); -} - -TEST(RunOobCheckedStore64_3) { - TestRunOobCheckedStore64(3 * A_BILLION, false); - TestRunOobCheckedStore64(3 * A_BILLION, true); -} - -TEST(RunOobCheckedStore64_4) { - TestRunOobCheckedStore64(4 * A_BILLION, false); - TestRunOobCheckedStore64(4 * A_BILLION, true); -} - -#endif - -void TestRunOobCheckedLoad_pseudo(uint64_t x, bool length_is_immediate) { - RawMachineAssemblerTester<int32_t> m(MachineType::Uint32(), - MachineType::Uint32()); - - uint32_t pseudo_base = static_cast<uint32_t>(x); - MachineOperatorBuilder machine(m.zone()); - const uint32_t kNumElems = 29; - const uint32_t kLength = pseudo_base + kNumElems * 4; - - int32_t buffer[kNumElems]; - Node* base = m.PointerConstant(reinterpret_cast<byte*>(buffer) - pseudo_base); - Node* offset = m.Parameter(0); - Node* len = length_is_immediate ? m.Int32Constant(kLength) : m.Parameter(1); - Node* node = - m.AddNode(machine.CheckedLoad(MachineType::Int32()), base, offset, len); - m.Return(node); - - { - // randomize memory. - v8::base::RandomNumberGenerator rng; - rng.SetSeed(100); - rng.NextBytes(&buffer[0], sizeof(buffer)); - } - - // in-bounds accesses. - for (uint32_t i = 0; i < kNumElems; i++) { - uint32_t offset = static_cast<uint32_t>(i * sizeof(int32_t)); - uint32_t expected = buffer[i]; - CHECK_EQ(expected, - static_cast<uint32_t>(m.Call(offset + pseudo_base, kLength))); - } - - // slightly out-of-bounds accesses. - for (uint32_t i = kNumElems; i < kNumElems + 30; i++) { - uint32_t offset = i * sizeof(int32_t); - CheckOobValue(m.Call(offset + pseudo_base, kLength)); - } - - // way out-of-bounds accesses. - for (uint64_t i = pseudo_base + sizeof(buffer); i < 0xFFFFFFFF; - i += A_BILLION) { - uint32_t offset = static_cast<uint32_t>(i); - CheckOobValue(m.Call(offset, kLength)); - } -} - -TEST(RunOobCheckedLoad_pseudo0) { - TestRunOobCheckedLoad_pseudo(0, false); - TestRunOobCheckedLoad_pseudo(0, true); -} - -TEST(RunOobCheckedLoad_pseudo1) { - TestRunOobCheckedLoad_pseudo(100000, false); - TestRunOobCheckedLoad_pseudo(100000, true); -} - -TEST(RunOobCheckedLoad_pseudo2) { - TestRunOobCheckedLoad_pseudo(A_BILLION, false); - TestRunOobCheckedLoad_pseudo(A_BILLION, true); -} - -TEST(RunOobCheckedLoad_pseudo3) { - TestRunOobCheckedLoad_pseudo(A_GIG, false); - TestRunOobCheckedLoad_pseudo(A_GIG, true); -} - -TEST(RunOobCheckedLoad_pseudo4) { - TestRunOobCheckedLoad_pseudo(2 * A_BILLION, false); - TestRunOobCheckedLoad_pseudo(2 * A_BILLION, true); -} - -TEST(RunOobCheckedLoad_pseudo5) { - TestRunOobCheckedLoad_pseudo(2 * A_GIG, false); - TestRunOobCheckedLoad_pseudo(2 * A_GIG, true); -} - -TEST(RunOobCheckedLoad_pseudo6) { - TestRunOobCheckedLoad_pseudo(3 * A_BILLION, false); - TestRunOobCheckedLoad_pseudo(3 * A_BILLION, true); -} - -TEST(RunOobCheckedLoad_pseudo7) { - TestRunOobCheckedLoad_pseudo(3 * A_GIG, false); - TestRunOobCheckedLoad_pseudo(3 * A_GIG, true); -} - -TEST(RunOobCheckedLoad_pseudo8) { - TestRunOobCheckedLoad_pseudo(4 * A_BILLION, false); - TestRunOobCheckedLoad_pseudo(4 * A_BILLION, true); -} - -template <typename MemType> -void TestRunOobCheckedLoadT_pseudo(uint64_t x, bool length_is_immediate) { - const int32_t kReturn = 11999; - const uint32_t kNumElems = 29; - MemType buffer[kNumElems]; - uint32_t pseudo_base = static_cast<uint32_t>(x); - const uint32_t kLength = static_cast<uint32_t>(pseudo_base + sizeof(buffer)); - - MemType result; - - RawMachineAssemblerTester<int32_t> m(MachineType::Uint32(), - MachineType::Uint32()); - MachineOperatorBuilder machine(m.zone()); - Node* base = m.PointerConstant(reinterpret_cast<byte*>(buffer) - pseudo_base); - Node* offset = m.Parameter(0); - Node* len = length_is_immediate ? m.Int32Constant(kLength) : m.Parameter(1); - Node* node = m.AddNode(machine.CheckedLoad(MachineTypeForC<MemType>()), base, - offset, len); - Node* store = m.StoreToPointer( - &result, MachineTypeForC<MemType>().representation(), node); - USE(store); - m.Return(m.Int32Constant(kReturn)); - - { - // randomize memory. - v8::base::RandomNumberGenerator rng; - rng.SetSeed(103); - rng.NextBytes(&buffer[0], sizeof(buffer)); - } - - // in-bounds accesses. - for (uint32_t i = 0; i < kNumElems; i++) { - uint32_t offset = static_cast<uint32_t>(i * sizeof(MemType)); - MemType expected = buffer[i]; - CHECK_EQ(kReturn, m.Call(offset + pseudo_base, kLength)); - CHECK_EQ(expected, result); - } - - // slightly out-of-bounds accesses. - for (uint32_t i = kNumElems; i < kNumElems + 30; i++) { - uint32_t offset = static_cast<uint32_t>(i * sizeof(MemType)); - CHECK_EQ(kReturn, m.Call(offset + pseudo_base, kLength)); - CheckOobValue(result); - } - - // way out-of-bounds accesses. - for (uint64_t i = pseudo_base + sizeof(buffer); i < 0xFFFFFFFF; - i += A_BILLION) { - uint32_t offset = static_cast<uint32_t>(i); - CHECK_EQ(kReturn, m.Call(offset, kLength)); - CheckOobValue(result); - } -} - -TEST(RunOobCheckedLoadT_pseudo0) { - TestRunOobCheckedLoadT_pseudo<int32_t>(0, false); - TestRunOobCheckedLoadT_pseudo<int32_t>(0, true); - TestRunOobCheckedLoadT_pseudo<float>(0, false); - TestRunOobCheckedLoadT_pseudo<float>(0, true); - TestRunOobCheckedLoadT_pseudo<double>(0, false); - TestRunOobCheckedLoadT_pseudo<double>(0, true); -} - -TEST(RunOobCheckedLoadT_pseudo1) { - TestRunOobCheckedLoadT_pseudo<int32_t>(100000, false); - TestRunOobCheckedLoadT_pseudo<int32_t>(100000, true); - TestRunOobCheckedLoadT_pseudo<float>(100000, false); - TestRunOobCheckedLoadT_pseudo<float>(100000, true); - TestRunOobCheckedLoadT_pseudo<double>(100000, false); - TestRunOobCheckedLoadT_pseudo<double>(100000, true); -} - -TEST(RunOobCheckedLoadT_pseudo2) { - TestRunOobCheckedLoadT_pseudo<int32_t>(A_BILLION, false); - TestRunOobCheckedLoadT_pseudo<int32_t>(A_BILLION, true); - TestRunOobCheckedLoadT_pseudo<float>(A_BILLION, false); - TestRunOobCheckedLoadT_pseudo<float>(A_BILLION, true); - TestRunOobCheckedLoadT_pseudo<double>(A_BILLION, false); - TestRunOobCheckedLoadT_pseudo<double>(A_BILLION, true); -} - -TEST(RunOobCheckedLoadT_pseudo3) { - TestRunOobCheckedLoadT_pseudo<int32_t>(A_GIG, false); - TestRunOobCheckedLoadT_pseudo<int32_t>(A_GIG, true); - TestRunOobCheckedLoadT_pseudo<float>(A_GIG, false); - TestRunOobCheckedLoadT_pseudo<float>(A_GIG, true); - TestRunOobCheckedLoadT_pseudo<double>(A_GIG, false); - TestRunOobCheckedLoadT_pseudo<double>(A_GIG, true); -} - -TEST(RunOobCheckedLoadT_pseudo4) { - TestRunOobCheckedLoadT_pseudo<int32_t>(2 * A_BILLION, false); - TestRunOobCheckedLoadT_pseudo<int32_t>(2 * A_BILLION, true); - TestRunOobCheckedLoadT_pseudo<float>(2 * A_BILLION, false); - TestRunOobCheckedLoadT_pseudo<float>(2 * A_BILLION, true); - TestRunOobCheckedLoadT_pseudo<double>(2 * A_BILLION, false); - TestRunOobCheckedLoadT_pseudo<double>(2 * A_BILLION, true); -} - -TEST(RunOobCheckedLoadT_pseudo5) { - TestRunOobCheckedLoadT_pseudo<int32_t>(2 * A_GIG, false); - TestRunOobCheckedLoadT_pseudo<int32_t>(2 * A_GIG, true); - TestRunOobCheckedLoadT_pseudo<float>(2 * A_GIG, false); - TestRunOobCheckedLoadT_pseudo<float>(2 * A_GIG, true); - TestRunOobCheckedLoadT_pseudo<double>(2 * A_GIG, false); - TestRunOobCheckedLoadT_pseudo<double>(2 * A_GIG, true); -} - -TEST(RunOobCheckedLoadT_pseudo6) { - TestRunOobCheckedLoadT_pseudo<int32_t>(3 * A_BILLION, false); - TestRunOobCheckedLoadT_pseudo<int32_t>(3 * A_BILLION, true); - TestRunOobCheckedLoadT_pseudo<float>(3 * A_BILLION, false); - TestRunOobCheckedLoadT_pseudo<float>(3 * A_BILLION, true); - TestRunOobCheckedLoadT_pseudo<double>(3 * A_BILLION, false); - TestRunOobCheckedLoadT_pseudo<double>(3 * A_BILLION, true); -} - -TEST(RunOobCheckedLoadT_pseudo7) { - TestRunOobCheckedLoadT_pseudo<int32_t>(3 * A_GIG, false); - TestRunOobCheckedLoadT_pseudo<int32_t>(3 * A_GIG, true); - TestRunOobCheckedLoadT_pseudo<float>(3 * A_GIG, false); - TestRunOobCheckedLoadT_pseudo<float>(3 * A_GIG, true); - TestRunOobCheckedLoadT_pseudo<double>(3 * A_GIG, false); - TestRunOobCheckedLoadT_pseudo<double>(3 * A_GIG, true); -} - -TEST(RunOobCheckedLoadT_pseudo8) { - TestRunOobCheckedLoadT_pseudo<int32_t>(4 * A_BILLION, false); - TestRunOobCheckedLoadT_pseudo<int32_t>(4 * A_BILLION, true); - TestRunOobCheckedLoadT_pseudo<float>(4 * A_BILLION, false); - TestRunOobCheckedLoadT_pseudo<float>(4 * A_BILLION, true); - TestRunOobCheckedLoadT_pseudo<double>(4 * A_BILLION, false); - TestRunOobCheckedLoadT_pseudo<double>(4 * A_BILLION, true); -} - } // namespace compiler } // namespace internal } // namespace v8 diff --git a/deps/v8/test/cctest/compiler/test-run-machops.cc b/deps/v8/test/cctest/compiler/test-run-machops.cc index ff8c83536b..7f752b8872 100644 --- a/deps/v8/test/cctest/compiler/test-run-machops.cc +++ b/deps/v8/test/cctest/compiler/test-run-machops.cc @@ -74,13 +74,13 @@ TEST(RunWord32ReverseBits) { m.Return(m.AddNode(m.machine()->Word32ReverseBits().op(), m.Parameter(0))); CHECK_EQ(uint32_t(0x00000000), m.Call(uint32_t(0x00000000))); - CHECK_EQ(uint32_t(0x12345678), m.Call(uint32_t(0x1e6a2c48))); - CHECK_EQ(uint32_t(0xfedcba09), m.Call(uint32_t(0x905d3b7f))); + CHECK_EQ(uint32_t(0x12345678), m.Call(uint32_t(0x1E6A2C48))); + CHECK_EQ(uint32_t(0xFEDCBA09), m.Call(uint32_t(0x905D3B7F))); CHECK_EQ(uint32_t(0x01010101), m.Call(uint32_t(0x80808080))); CHECK_EQ(uint32_t(0x01020408), m.Call(uint32_t(0x10204080))); - CHECK_EQ(uint32_t(0xf0703010), m.Call(uint32_t(0x080c0e0f))); - CHECK_EQ(uint32_t(0x1f8d0a3a), m.Call(uint32_t(0x5c50b1f8))); - CHECK_EQ(uint32_t(0xffffffff), m.Call(uint32_t(0xffffffff))); + CHECK_EQ(uint32_t(0xF0703010), m.Call(uint32_t(0x080C0E0F))); + CHECK_EQ(uint32_t(0x1F8D0A3A), m.Call(uint32_t(0x5C50B1F8))); + CHECK_EQ(uint32_t(0xFFFFFFFF), m.Call(uint32_t(0xFFFFFFFF))); } TEST(RunWord32ReverseBytes) { @@ -93,12 +93,12 @@ TEST(RunWord32ReverseBytes) { CHECK_EQ(uint32_t(0x00000000), m.Call(uint32_t(0x00000000))); CHECK_EQ(uint32_t(0x12345678), m.Call(uint32_t(0x78563412))); - CHECK_EQ(uint32_t(0xfedcba09), m.Call(uint32_t(0x09badcfe))); + CHECK_EQ(uint32_t(0xFEDCBA09), m.Call(uint32_t(0x09BADCFE))); CHECK_EQ(uint32_t(0x01010101), m.Call(uint32_t(0x01010101))); CHECK_EQ(uint32_t(0x01020408), m.Call(uint32_t(0x08040201))); - CHECK_EQ(uint32_t(0xf0703010), m.Call(uint32_t(0x103070f0))); - CHECK_EQ(uint32_t(0x1f8d0a3a), m.Call(uint32_t(0x3a0a8d1f))); - CHECK_EQ(uint32_t(0xffffffff), m.Call(uint32_t(0xffffffff))); + CHECK_EQ(uint32_t(0xF0703010), m.Call(uint32_t(0x103070F0))); + CHECK_EQ(uint32_t(0x1F8D0A3A), m.Call(uint32_t(0x3A0A8D1F))); + CHECK_EQ(uint32_t(0xFFFFFFFF), m.Call(uint32_t(0xFFFFFFFF))); } TEST(RunWord32Ctz) { @@ -114,34 +114,34 @@ TEST(RunWord32Ctz) { CHECK_EQ(30, m.Call(uint32_t(0x40000000))); CHECK_EQ(29, m.Call(uint32_t(0x20000000))); CHECK_EQ(28, m.Call(uint32_t(0x10000000))); - CHECK_EQ(27, m.Call(uint32_t(0xa8000000))); - CHECK_EQ(26, m.Call(uint32_t(0xf4000000))); + CHECK_EQ(27, m.Call(uint32_t(0xA8000000))); + CHECK_EQ(26, m.Call(uint32_t(0xF4000000))); CHECK_EQ(25, m.Call(uint32_t(0x62000000))); CHECK_EQ(24, m.Call(uint32_t(0x91000000))); - CHECK_EQ(23, m.Call(uint32_t(0xcd800000))); + CHECK_EQ(23, m.Call(uint32_t(0xCD800000))); CHECK_EQ(22, m.Call(uint32_t(0x09400000))); - CHECK_EQ(21, m.Call(uint32_t(0xaf200000))); - CHECK_EQ(20, m.Call(uint32_t(0xac100000))); - CHECK_EQ(19, m.Call(uint32_t(0xe0b80000))); - CHECK_EQ(18, m.Call(uint32_t(0x9ce40000))); - CHECK_EQ(17, m.Call(uint32_t(0xc7920000))); - CHECK_EQ(16, m.Call(uint32_t(0xb8f10000))); - CHECK_EQ(15, m.Call(uint32_t(0x3b9f8000))); - CHECK_EQ(14, m.Call(uint32_t(0xdb4c4000))); - CHECK_EQ(13, m.Call(uint32_t(0xe9a32000))); - CHECK_EQ(12, m.Call(uint32_t(0xfca61000))); - CHECK_EQ(11, m.Call(uint32_t(0x6c8a7800))); - CHECK_EQ(10, m.Call(uint32_t(0x8ce5a400))); - CHECK_EQ(9, m.Call(uint32_t(0xcb7d0200))); - CHECK_EQ(8, m.Call(uint32_t(0xcb4dc100))); - CHECK_EQ(7, m.Call(uint32_t(0xdfbec580))); - CHECK_EQ(6, m.Call(uint32_t(0x27a9db40))); - CHECK_EQ(5, m.Call(uint32_t(0xde3bcb20))); - CHECK_EQ(4, m.Call(uint32_t(0xd7e8a610))); - CHECK_EQ(3, m.Call(uint32_t(0x9afdbc88))); - CHECK_EQ(2, m.Call(uint32_t(0x9afdbc84))); - CHECK_EQ(1, m.Call(uint32_t(0x9afdbc82))); - CHECK_EQ(0, m.Call(uint32_t(0x9afdbc81))); + CHECK_EQ(21, m.Call(uint32_t(0xAF200000))); + CHECK_EQ(20, m.Call(uint32_t(0xAC100000))); + CHECK_EQ(19, m.Call(uint32_t(0xE0B80000))); + CHECK_EQ(18, m.Call(uint32_t(0x9CE40000))); + CHECK_EQ(17, m.Call(uint32_t(0xC7920000))); + CHECK_EQ(16, m.Call(uint32_t(0xB8F10000))); + CHECK_EQ(15, m.Call(uint32_t(0x3B9F8000))); + CHECK_EQ(14, m.Call(uint32_t(0xDB4C4000))); + CHECK_EQ(13, m.Call(uint32_t(0xE9A32000))); + CHECK_EQ(12, m.Call(uint32_t(0xFCA61000))); + CHECK_EQ(11, m.Call(uint32_t(0x6C8A7800))); + CHECK_EQ(10, m.Call(uint32_t(0x8CE5A400))); + CHECK_EQ(9, m.Call(uint32_t(0xCB7D0200))); + CHECK_EQ(8, m.Call(uint32_t(0xCB4DC100))); + CHECK_EQ(7, m.Call(uint32_t(0xDFBEC580))); + CHECK_EQ(6, m.Call(uint32_t(0x27A9DB40))); + CHECK_EQ(5, m.Call(uint32_t(0xDE3BCB20))); + CHECK_EQ(4, m.Call(uint32_t(0xD7E8A610))); + CHECK_EQ(3, m.Call(uint32_t(0x9AFDBC88))); + CHECK_EQ(2, m.Call(uint32_t(0x9AFDBC84))); + CHECK_EQ(1, m.Call(uint32_t(0x9AFDBC82))); + CHECK_EQ(0, m.Call(uint32_t(0x9AFDBC81))); } TEST(RunWord32Clz) { @@ -155,11 +155,11 @@ TEST(RunWord32Clz) { CHECK_EQ(4, m.Call(uint32_t(0x08050000))); CHECK_EQ(5, m.Call(uint32_t(0x04006000))); CHECK_EQ(6, m.Call(uint32_t(0x02000000))); - CHECK_EQ(7, m.Call(uint32_t(0x010000a0))); - CHECK_EQ(8, m.Call(uint32_t(0x00800c00))); + CHECK_EQ(7, m.Call(uint32_t(0x010000A0))); + CHECK_EQ(8, m.Call(uint32_t(0x00800C00))); CHECK_EQ(9, m.Call(uint32_t(0x00400000))); - CHECK_EQ(10, m.Call(uint32_t(0x0020000d))); - CHECK_EQ(11, m.Call(uint32_t(0x00100f00))); + CHECK_EQ(10, m.Call(uint32_t(0x0020000D))); + CHECK_EQ(11, m.Call(uint32_t(0x00100F00))); CHECK_EQ(12, m.Call(uint32_t(0x00080000))); CHECK_EQ(13, m.Call(uint32_t(0x00041000))); CHECK_EQ(14, m.Call(uint32_t(0x00020020))); @@ -195,11 +195,11 @@ TEST(RunWord32Popcnt) { CHECK_EQ(0, m.Call(uint32_t(0x00000000))); CHECK_EQ(1, m.Call(uint32_t(0x00000001))); CHECK_EQ(1, m.Call(uint32_t(0x80000000))); - CHECK_EQ(32, m.Call(uint32_t(0xffffffff))); - CHECK_EQ(6, m.Call(uint32_t(0x000dc100))); - CHECK_EQ(9, m.Call(uint32_t(0xe00dc100))); - CHECK_EQ(11, m.Call(uint32_t(0xe00dc103))); - CHECK_EQ(9, m.Call(uint32_t(0x000dc107))); + CHECK_EQ(32, m.Call(uint32_t(0xFFFFFFFF))); + CHECK_EQ(6, m.Call(uint32_t(0x000DC100))); + CHECK_EQ(9, m.Call(uint32_t(0xE00DC100))); + CHECK_EQ(11, m.Call(uint32_t(0xE00DC103))); + CHECK_EQ(9, m.Call(uint32_t(0x000DC107))); } @@ -213,13 +213,13 @@ TEST(RunWord64ReverseBits) { m.Return(m.AddNode(m.machine()->Word64ReverseBits().op(), m.Parameter(0))); CHECK_EQ(uint64_t(0x0000000000000000), m.Call(uint64_t(0x0000000000000000))); - CHECK_EQ(uint64_t(0x1234567890abcdef), m.Call(uint64_t(0xf7b3d5091e6a2c48))); - CHECK_EQ(uint64_t(0xfedcba0987654321), m.Call(uint64_t(0x84c2a6e1905d3b7f))); + CHECK_EQ(uint64_t(0x1234567890ABCDEF), m.Call(uint64_t(0xF7B3D5091E6A2C48))); + CHECK_EQ(uint64_t(0xFEDCBA0987654321), m.Call(uint64_t(0x84C2A6E1905D3B7F))); CHECK_EQ(uint64_t(0x0101010101010101), m.Call(uint64_t(0x8080808080808080))); - CHECK_EQ(uint64_t(0x0102040803060c01), m.Call(uint64_t(0x803060c010204080))); - CHECK_EQ(uint64_t(0xf0703010e060200f), m.Call(uint64_t(0xf0040607080c0e0f))); - CHECK_EQ(uint64_t(0x2f8a6df01c21fa3b), m.Call(uint64_t(0xdc5f84380fb651f4))); - CHECK_EQ(uint64_t(0xffffffffffffffff), m.Call(uint64_t(0xffffffffffffffff))); + CHECK_EQ(uint64_t(0x0102040803060C01), m.Call(uint64_t(0x803060C010204080))); + CHECK_EQ(uint64_t(0xF0703010E060200F), m.Call(uint64_t(0xF0040607080C0E0F))); + CHECK_EQ(uint64_t(0x2F8A6DF01C21FA3B), m.Call(uint64_t(0xDC5F84380FB651F4))); + CHECK_EQ(uint64_t(0xFFFFFFFFFFFFFFFF), m.Call(uint64_t(0xFFFFFFFFFFFFFFFF))); } TEST(RunWord64ReverseBytes) { @@ -231,13 +231,13 @@ TEST(RunWord64ReverseBytes) { m.Return(m.AddNode(m.machine()->Word64ReverseBytes().op(), m.Parameter(0))); CHECK_EQ(uint64_t(0x0000000000000000), m.Call(uint64_t(0x0000000000000000))); - CHECK_EQ(uint64_t(0x1234567890abcdef), m.Call(uint64_t(0xefcdab9078563412))); - CHECK_EQ(uint64_t(0xfedcba0987654321), m.Call(uint64_t(0x2143658709badcfe))); + CHECK_EQ(uint64_t(0x1234567890ABCDEF), m.Call(uint64_t(0xEFCDAB9078563412))); + CHECK_EQ(uint64_t(0xFEDCBA0987654321), m.Call(uint64_t(0x2143658709BADCFE))); CHECK_EQ(uint64_t(0x0101010101010101), m.Call(uint64_t(0x0101010101010101))); - CHECK_EQ(uint64_t(0x0102040803060c01), m.Call(uint64_t(0x010c060308040201))); - CHECK_EQ(uint64_t(0xf0703010e060200f), m.Call(uint64_t(0x0f2060e0103070f0))); - CHECK_EQ(uint64_t(0x2f8a6df01c21fa3b), m.Call(uint64_t(0x3bfa211cf06d8a2f))); - CHECK_EQ(uint64_t(0xffffffffffffffff), m.Call(uint64_t(0xffffffffffffffff))); + CHECK_EQ(uint64_t(0x0102040803060C01), m.Call(uint64_t(0x010C060308040201))); + CHECK_EQ(uint64_t(0xF0703010E060200F), m.Call(uint64_t(0x0F2060E0103070F0))); + CHECK_EQ(uint64_t(0x2F8A6DF01C21FA3B), m.Call(uint64_t(0x3BFA211CF06D8A2F))); + CHECK_EQ(uint64_t(0xFFFFFFFFFFFFFFFF), m.Call(uint64_t(0xFFFFFFFFFFFFFFFF))); } TEST(RunWord64Clz) { @@ -251,11 +251,11 @@ TEST(RunWord64Clz) { CHECK_EQ(4, m.Call(uint64_t(0x0805000000000000))); CHECK_EQ(5, m.Call(uint64_t(0x0400600000000000))); CHECK_EQ(6, m.Call(uint64_t(0x0200000000000000))); - CHECK_EQ(7, m.Call(uint64_t(0x010000a000000000))); - CHECK_EQ(8, m.Call(uint64_t(0x00800c0000000000))); + CHECK_EQ(7, m.Call(uint64_t(0x010000A000000000))); + CHECK_EQ(8, m.Call(uint64_t(0x00800C0000000000))); CHECK_EQ(9, m.Call(uint64_t(0x0040000000000000))); - CHECK_EQ(10, m.Call(uint64_t(0x0020000d00000000))); - CHECK_EQ(11, m.Call(uint64_t(0x00100f0000000000))); + CHECK_EQ(10, m.Call(uint64_t(0x0020000D00000000))); + CHECK_EQ(11, m.Call(uint64_t(0x00100F0000000000))); CHECK_EQ(12, m.Call(uint64_t(0x0008000000000000))); CHECK_EQ(13, m.Call(uint64_t(0x0004100000000000))); CHECK_EQ(14, m.Call(uint64_t(0x0002002000000000))); @@ -283,11 +283,11 @@ TEST(RunWord64Clz) { CHECK_EQ(36, m.Call(uint64_t(0x0000000008050000))); CHECK_EQ(37, m.Call(uint64_t(0x0000000004006000))); CHECK_EQ(38, m.Call(uint64_t(0x0000000002000000))); - CHECK_EQ(39, m.Call(uint64_t(0x00000000010000a0))); - CHECK_EQ(40, m.Call(uint64_t(0x0000000000800c00))); + CHECK_EQ(39, m.Call(uint64_t(0x00000000010000A0))); + CHECK_EQ(40, m.Call(uint64_t(0x0000000000800C00))); CHECK_EQ(41, m.Call(uint64_t(0x0000000000400000))); - CHECK_EQ(42, m.Call(uint64_t(0x000000000020000d))); - CHECK_EQ(43, m.Call(uint64_t(0x0000000000100f00))); + CHECK_EQ(42, m.Call(uint64_t(0x000000000020000D))); + CHECK_EQ(43, m.Call(uint64_t(0x0000000000100F00))); CHECK_EQ(44, m.Call(uint64_t(0x0000000000080000))); CHECK_EQ(45, m.Call(uint64_t(0x0000000000041000))); CHECK_EQ(46, m.Call(uint64_t(0x0000000000020020))); @@ -325,66 +325,66 @@ TEST(RunWord64Ctz) { CHECK_EQ(62, m.Call(uint64_t(0x4000000000000000))); CHECK_EQ(61, m.Call(uint64_t(0x2000000000000000))); CHECK_EQ(60, m.Call(uint64_t(0x1000000000000000))); - CHECK_EQ(59, m.Call(uint64_t(0xa800000000000000))); - CHECK_EQ(58, m.Call(uint64_t(0xf400000000000000))); + CHECK_EQ(59, m.Call(uint64_t(0xA800000000000000))); + CHECK_EQ(58, m.Call(uint64_t(0xF400000000000000))); CHECK_EQ(57, m.Call(uint64_t(0x6200000000000000))); CHECK_EQ(56, m.Call(uint64_t(0x9100000000000000))); - CHECK_EQ(55, m.Call(uint64_t(0xcd80000000000000))); + CHECK_EQ(55, m.Call(uint64_t(0xCD80000000000000))); CHECK_EQ(54, m.Call(uint64_t(0x0940000000000000))); - CHECK_EQ(53, m.Call(uint64_t(0xaf20000000000000))); - CHECK_EQ(52, m.Call(uint64_t(0xac10000000000000))); - CHECK_EQ(51, m.Call(uint64_t(0xe0b8000000000000))); - CHECK_EQ(50, m.Call(uint64_t(0x9ce4000000000000))); - CHECK_EQ(49, m.Call(uint64_t(0xc792000000000000))); - CHECK_EQ(48, m.Call(uint64_t(0xb8f1000000000000))); - CHECK_EQ(47, m.Call(uint64_t(0x3b9f800000000000))); - CHECK_EQ(46, m.Call(uint64_t(0xdb4c400000000000))); - CHECK_EQ(45, m.Call(uint64_t(0xe9a3200000000000))); - CHECK_EQ(44, m.Call(uint64_t(0xfca6100000000000))); - CHECK_EQ(43, m.Call(uint64_t(0x6c8a780000000000))); - CHECK_EQ(42, m.Call(uint64_t(0x8ce5a40000000000))); - CHECK_EQ(41, m.Call(uint64_t(0xcb7d020000000000))); - CHECK_EQ(40, m.Call(uint64_t(0xcb4dc10000000000))); - CHECK_EQ(39, m.Call(uint64_t(0xdfbec58000000000))); - CHECK_EQ(38, m.Call(uint64_t(0x27a9db4000000000))); - CHECK_EQ(37, m.Call(uint64_t(0xde3bcb2000000000))); - CHECK_EQ(36, m.Call(uint64_t(0xd7e8a61000000000))); - CHECK_EQ(35, m.Call(uint64_t(0x9afdbc8800000000))); - CHECK_EQ(34, m.Call(uint64_t(0x9afdbc8400000000))); - CHECK_EQ(33, m.Call(uint64_t(0x9afdbc8200000000))); - CHECK_EQ(32, m.Call(uint64_t(0x9afdbc8100000000))); + CHECK_EQ(53, m.Call(uint64_t(0xAF20000000000000))); + CHECK_EQ(52, m.Call(uint64_t(0xAC10000000000000))); + CHECK_EQ(51, m.Call(uint64_t(0xE0B8000000000000))); + CHECK_EQ(50, m.Call(uint64_t(0x9CE4000000000000))); + CHECK_EQ(49, m.Call(uint64_t(0xC792000000000000))); + CHECK_EQ(48, m.Call(uint64_t(0xB8F1000000000000))); + CHECK_EQ(47, m.Call(uint64_t(0x3B9F800000000000))); + CHECK_EQ(46, m.Call(uint64_t(0xDB4C400000000000))); + CHECK_EQ(45, m.Call(uint64_t(0xE9A3200000000000))); + CHECK_EQ(44, m.Call(uint64_t(0xFCA6100000000000))); + CHECK_EQ(43, m.Call(uint64_t(0x6C8A780000000000))); + CHECK_EQ(42, m.Call(uint64_t(0x8CE5A40000000000))); + CHECK_EQ(41, m.Call(uint64_t(0xCB7D020000000000))); + CHECK_EQ(40, m.Call(uint64_t(0xCB4DC10000000000))); + CHECK_EQ(39, m.Call(uint64_t(0xDFBEC58000000000))); + CHECK_EQ(38, m.Call(uint64_t(0x27A9DB4000000000))); + CHECK_EQ(37, m.Call(uint64_t(0xDE3BCB2000000000))); + CHECK_EQ(36, m.Call(uint64_t(0xD7E8A61000000000))); + CHECK_EQ(35, m.Call(uint64_t(0x9AFDBC8800000000))); + CHECK_EQ(34, m.Call(uint64_t(0x9AFDBC8400000000))); + CHECK_EQ(33, m.Call(uint64_t(0x9AFDBC8200000000))); + CHECK_EQ(32, m.Call(uint64_t(0x9AFDBC8100000000))); CHECK_EQ(31, m.Call(uint64_t(0x0000000080000000))); CHECK_EQ(30, m.Call(uint64_t(0x0000000040000000))); CHECK_EQ(29, m.Call(uint64_t(0x0000000020000000))); CHECK_EQ(28, m.Call(uint64_t(0x0000000010000000))); - CHECK_EQ(27, m.Call(uint64_t(0x00000000a8000000))); - CHECK_EQ(26, m.Call(uint64_t(0x00000000f4000000))); + CHECK_EQ(27, m.Call(uint64_t(0x00000000A8000000))); + CHECK_EQ(26, m.Call(uint64_t(0x00000000F4000000))); CHECK_EQ(25, m.Call(uint64_t(0x0000000062000000))); CHECK_EQ(24, m.Call(uint64_t(0x0000000091000000))); - CHECK_EQ(23, m.Call(uint64_t(0x00000000cd800000))); + CHECK_EQ(23, m.Call(uint64_t(0x00000000CD800000))); CHECK_EQ(22, m.Call(uint64_t(0x0000000009400000))); - CHECK_EQ(21, m.Call(uint64_t(0x00000000af200000))); - CHECK_EQ(20, m.Call(uint64_t(0x00000000ac100000))); - CHECK_EQ(19, m.Call(uint64_t(0x00000000e0b80000))); - CHECK_EQ(18, m.Call(uint64_t(0x000000009ce40000))); - CHECK_EQ(17, m.Call(uint64_t(0x00000000c7920000))); - CHECK_EQ(16, m.Call(uint64_t(0x00000000b8f10000))); - CHECK_EQ(15, m.Call(uint64_t(0x000000003b9f8000))); - CHECK_EQ(14, m.Call(uint64_t(0x00000000db4c4000))); - CHECK_EQ(13, m.Call(uint64_t(0x00000000e9a32000))); - CHECK_EQ(12, m.Call(uint64_t(0x00000000fca61000))); - CHECK_EQ(11, m.Call(uint64_t(0x000000006c8a7800))); - CHECK_EQ(10, m.Call(uint64_t(0x000000008ce5a400))); - CHECK_EQ(9, m.Call(uint64_t(0x00000000cb7d0200))); - CHECK_EQ(8, m.Call(uint64_t(0x00000000cb4dc100))); - CHECK_EQ(7, m.Call(uint64_t(0x00000000dfbec580))); - CHECK_EQ(6, m.Call(uint64_t(0x0000000027a9db40))); - CHECK_EQ(5, m.Call(uint64_t(0x00000000de3bcb20))); - CHECK_EQ(4, m.Call(uint64_t(0x00000000d7e8a610))); - CHECK_EQ(3, m.Call(uint64_t(0x000000009afdbc88))); - CHECK_EQ(2, m.Call(uint64_t(0x000000009afdbc84))); - CHECK_EQ(1, m.Call(uint64_t(0x000000009afdbc82))); - CHECK_EQ(0, m.Call(uint64_t(0x000000009afdbc81))); + CHECK_EQ(21, m.Call(uint64_t(0x00000000AF200000))); + CHECK_EQ(20, m.Call(uint64_t(0x00000000AC100000))); + CHECK_EQ(19, m.Call(uint64_t(0x00000000E0B80000))); + CHECK_EQ(18, m.Call(uint64_t(0x000000009CE40000))); + CHECK_EQ(17, m.Call(uint64_t(0x00000000C7920000))); + CHECK_EQ(16, m.Call(uint64_t(0x00000000B8F10000))); + CHECK_EQ(15, m.Call(uint64_t(0x000000003B9F8000))); + CHECK_EQ(14, m.Call(uint64_t(0x00000000DB4C4000))); + CHECK_EQ(13, m.Call(uint64_t(0x00000000E9A32000))); + CHECK_EQ(12, m.Call(uint64_t(0x00000000FCA61000))); + CHECK_EQ(11, m.Call(uint64_t(0x000000006C8A7800))); + CHECK_EQ(10, m.Call(uint64_t(0x000000008CE5A400))); + CHECK_EQ(9, m.Call(uint64_t(0x00000000CB7D0200))); + CHECK_EQ(8, m.Call(uint64_t(0x00000000CB4DC100))); + CHECK_EQ(7, m.Call(uint64_t(0x00000000DFBEC580))); + CHECK_EQ(6, m.Call(uint64_t(0x0000000027A9DB40))); + CHECK_EQ(5, m.Call(uint64_t(0x00000000DE3BCB20))); + CHECK_EQ(4, m.Call(uint64_t(0x00000000D7E8A610))); + CHECK_EQ(3, m.Call(uint64_t(0x000000009AFDBC88))); + CHECK_EQ(2, m.Call(uint64_t(0x000000009AFDBC84))); + CHECK_EQ(1, m.Call(uint64_t(0x000000009AFDBC82))); + CHECK_EQ(0, m.Call(uint64_t(0x000000009AFDBC81))); } @@ -399,11 +399,11 @@ TEST(RunWord64Popcnt) { CHECK_EQ(0, m.Call(uint64_t(0x0000000000000000))); CHECK_EQ(1, m.Call(uint64_t(0x0000000000000001))); CHECK_EQ(1, m.Call(uint64_t(0x8000000000000000))); - CHECK_EQ(64, m.Call(uint64_t(0xffffffffffffffff))); - CHECK_EQ(12, m.Call(uint64_t(0x000dc100000dc100))); - CHECK_EQ(18, m.Call(uint64_t(0xe00dc100e00dc100))); - CHECK_EQ(22, m.Call(uint64_t(0xe00dc103e00dc103))); - CHECK_EQ(18, m.Call(uint64_t(0x000dc107000dc107))); + CHECK_EQ(64, m.Call(uint64_t(0xFFFFFFFFFFFFFFFF))); + CHECK_EQ(12, m.Call(uint64_t(0x000DC100000DC100))); + CHECK_EQ(18, m.Call(uint64_t(0xE00DC100E00DC100))); + CHECK_EQ(22, m.Call(uint64_t(0xE00DC103E00DC103))); + CHECK_EQ(18, m.Call(uint64_t(0x000DC107000DC107))); } #endif // V8_TARGET_ARCH_64_BIT @@ -421,7 +421,7 @@ static Node* Int32Input(RawMachineAssemblerTester<int32_t>* m, int index) { case 4: return m->Int32Constant(-1); case 5: - return m->Int32Constant(0xff); + return m->Int32Constant(0xFF); case 6: return m->Int32Constant(0x01234567); case 7: @@ -483,9 +483,9 @@ static Node* Int64Input(RawMachineAssemblerTester<int64_t>* m, int index) { case 4: return m->Int64Constant(-1); case 5: - return m->Int64Constant(0xff); + return m->Int64Constant(0xFF); case 6: - return m->Int64Constant(0x0123456789abcdefLL); + return m->Int64Constant(0x0123456789ABCDEFLL); case 7: return m->Load(MachineType::Int64(), m->PointerConstant(nullptr)); default: @@ -886,8 +886,8 @@ TEST(RunDiamondPhiParam) { MachineType::Int32(), MachineType::Int32(), MachineType::Int32()); BuildDiamondPhi(&m, m.Parameter(0), MachineRepresentation::kWord32, m.Parameter(1), m.Parameter(2)); - int32_t c1 = 0x260cb75a; - int32_t c2 = 0xcd3e9c8b; + int32_t c1 = 0x260CB75A; + int32_t c2 = 0xCD3E9C8B; int result = m.Call(0, c1, c2); CHECK_EQ(c2, result); result = m.Call(1, c1, c2); @@ -941,8 +941,8 @@ TEST(RunLoopPhiParam) { m.Bind(&end); m.Return(phi); - int32_t c1 = 0xa81903b4; - int32_t c2 = 0x5a1207da; + int32_t c1 = 0xA81903B4; + int32_t c2 = 0x5A1207DA; int result = m.Call(0, c1, c2); CHECK_EQ(c1, result); result = m.Call(1, c1, c2); @@ -2422,10 +2422,10 @@ TEST(RunWord32AndAndWord32ShlP) { RawMachineAssemblerTester<int32_t> m; Uint32BinopTester bt(&m); bt.AddReturn( - m.Word32Shl(bt.param0, m.Word32And(bt.param1, m.Int32Constant(0x1f)))); + m.Word32Shl(bt.param0, m.Word32And(bt.param1, m.Int32Constant(0x1F)))); FOR_UINT32_INPUTS(i) { FOR_UINT32_INPUTS(j) { - uint32_t expected = *i << (*j & 0x1f); + uint32_t expected = *i << (*j & 0x1F); CHECK_EQ(expected, bt.call(*i, *j)); } } @@ -2434,10 +2434,10 @@ TEST(RunWord32AndAndWord32ShlP) { RawMachineAssemblerTester<int32_t> m; Uint32BinopTester bt(&m); bt.AddReturn( - m.Word32Shl(bt.param0, m.Word32And(m.Int32Constant(0x1f), bt.param1))); + m.Word32Shl(bt.param0, m.Word32And(m.Int32Constant(0x1F), bt.param1))); FOR_UINT32_INPUTS(i) { FOR_UINT32_INPUTS(j) { - uint32_t expected = *i << (0x1f & *j); + uint32_t expected = *i << (0x1F & *j); CHECK_EQ(expected, bt.call(*i, *j)); } } @@ -2450,10 +2450,10 @@ TEST(RunWord32AndAndWord32ShrP) { RawMachineAssemblerTester<int32_t> m; Uint32BinopTester bt(&m); bt.AddReturn( - m.Word32Shr(bt.param0, m.Word32And(bt.param1, m.Int32Constant(0x1f)))); + m.Word32Shr(bt.param0, m.Word32And(bt.param1, m.Int32Constant(0x1F)))); FOR_UINT32_INPUTS(i) { FOR_UINT32_INPUTS(j) { - uint32_t expected = *i >> (*j & 0x1f); + uint32_t expected = *i >> (*j & 0x1F); CHECK_EQ(expected, bt.call(*i, *j)); } } @@ -2462,10 +2462,10 @@ TEST(RunWord32AndAndWord32ShrP) { RawMachineAssemblerTester<int32_t> m; Uint32BinopTester bt(&m); bt.AddReturn( - m.Word32Shr(bt.param0, m.Word32And(m.Int32Constant(0x1f), bt.param1))); + m.Word32Shr(bt.param0, m.Word32And(m.Int32Constant(0x1F), bt.param1))); FOR_UINT32_INPUTS(i) { FOR_UINT32_INPUTS(j) { - uint32_t expected = *i >> (0x1f & *j); + uint32_t expected = *i >> (0x1F & *j); CHECK_EQ(expected, bt.call(*i, *j)); } } @@ -2478,10 +2478,10 @@ TEST(RunWord32AndAndWord32SarP) { RawMachineAssemblerTester<int32_t> m; Int32BinopTester bt(&m); bt.AddReturn( - m.Word32Sar(bt.param0, m.Word32And(bt.param1, m.Int32Constant(0x1f)))); + m.Word32Sar(bt.param0, m.Word32And(bt.param1, m.Int32Constant(0x1F)))); FOR_INT32_INPUTS(i) { FOR_INT32_INPUTS(j) { - int32_t expected = *i >> (*j & 0x1f); + int32_t expected = *i >> (*j & 0x1F); CHECK_EQ(expected, bt.call(*i, *j)); } } @@ -2490,10 +2490,10 @@ TEST(RunWord32AndAndWord32SarP) { RawMachineAssemblerTester<int32_t> m; Int32BinopTester bt(&m); bt.AddReturn( - m.Word32Sar(bt.param0, m.Word32And(m.Int32Constant(0x1f), bt.param1))); + m.Word32Sar(bt.param0, m.Word32And(m.Int32Constant(0x1F), bt.param1))); FOR_INT32_INPUTS(i) { FOR_INT32_INPUTS(j) { - int32_t expected = *i >> (0x1f & *j); + int32_t expected = *i >> (0x1F & *j); CHECK_EQ(expected, bt.call(*i, *j)); } } @@ -3524,8 +3524,10 @@ TEST(RunWord32EqualAndWord32ShrP) { TEST(RunDeadNodes) { for (int i = 0; true; i++) { - RawMachineAssemblerTester<int32_t> m(i == 5 ? MachineType::Int32() - : MachineType::None()); + RawMachineAssemblerTester<int32_t> m_v; + RawMachineAssemblerTester<int32_t> m_i(MachineType::Int32()); + RawMachineAssemblerTester<int32_t>& m = i == 5 ? m_i : m_v; + int constant = 0x55 + i; switch (i) { case 0: @@ -4181,9 +4183,9 @@ TEST(RunInt32PairAdd) { FOR_UINT64_INPUTS(i) { FOR_UINT64_INPUTS(j) { - m.Call(static_cast<uint32_t>(*i & 0xffffffff), + m.Call(static_cast<uint32_t>(*i & 0xFFFFFFFF), static_cast<uint32_t>(*i >> 32), - static_cast<uint32_t>(*j & 0xffffffff), + static_cast<uint32_t>(*j & 0xFFFFFFFF), static_cast<uint32_t>(*j >> 32)); CHECK_EQ(*i + *j, ToInt64(low, high)); } @@ -4202,9 +4204,9 @@ TEST(RunInt32PairAddUseOnlyHighWord) { FOR_UINT64_INPUTS(j) { CHECK_EQ( static_cast<uint32_t>((*i + *j) >> 32), - static_cast<uint32_t>(m.Call(static_cast<uint32_t>(*i & 0xffffffff), + static_cast<uint32_t>(m.Call(static_cast<uint32_t>(*i & 0xFFFFFFFF), static_cast<uint32_t>(*i >> 32), - static_cast<uint32_t>(*j & 0xffffffff), + static_cast<uint32_t>(*j & 0xFFFFFFFF), static_cast<uint32_t>(*j >> 32)))); } } @@ -4264,9 +4266,9 @@ TEST(RunInt32PairSub) { FOR_UINT64_INPUTS(i) { FOR_UINT64_INPUTS(j) { - m.Call(static_cast<uint32_t>(*i & 0xffffffff), + m.Call(static_cast<uint32_t>(*i & 0xFFFFFFFF), static_cast<uint32_t>(*i >> 32), - static_cast<uint32_t>(*j & 0xffffffff), + static_cast<uint32_t>(*j & 0xFFFFFFFF), static_cast<uint32_t>(*j >> 32)); CHECK_EQ(*i - *j, ToInt64(low, high)); } @@ -4285,9 +4287,9 @@ TEST(RunInt32PairSubUseOnlyHighWord) { FOR_UINT64_INPUTS(j) { CHECK_EQ( static_cast<uint32_t>((*i - *j) >> 32), - static_cast<uint32_t>(m.Call(static_cast<uint32_t>(*i & 0xffffffff), + static_cast<uint32_t>(m.Call(static_cast<uint32_t>(*i & 0xFFFFFFFF), static_cast<uint32_t>(*i >> 32), - static_cast<uint32_t>(*j & 0xffffffff), + static_cast<uint32_t>(*j & 0xFFFFFFFF), static_cast<uint32_t>(*j >> 32)))); } } @@ -4347,9 +4349,9 @@ TEST(RunInt32PairMul) { FOR_UINT64_INPUTS(i) { FOR_UINT64_INPUTS(j) { - m.Call(static_cast<uint32_t>(*i & 0xffffffff), + m.Call(static_cast<uint32_t>(*i & 0xFFFFFFFF), static_cast<uint32_t>(*i >> 32), - static_cast<uint32_t>(*j & 0xffffffff), + static_cast<uint32_t>(*j & 0xFFFFFFFF), static_cast<uint32_t>(*j >> 32)); CHECK_EQ(*i * *j, ToInt64(low, high)); } @@ -4368,9 +4370,9 @@ TEST(RunInt32PairMulUseOnlyHighWord) { FOR_UINT64_INPUTS(j) { CHECK_EQ( static_cast<uint32_t>((*i * *j) >> 32), - static_cast<uint32_t>(m.Call(static_cast<uint32_t>(*i & 0xffffffff), + static_cast<uint32_t>(m.Call(static_cast<uint32_t>(*i & 0xFFFFFFFF), static_cast<uint32_t>(*i >> 32), - static_cast<uint32_t>(*j & 0xffffffff), + static_cast<uint32_t>(*j & 0xFFFFFFFF), static_cast<uint32_t>(*j >> 32)))); } } @@ -4430,7 +4432,7 @@ TEST(RunWord32PairShl) { FOR_UINT64_INPUTS(i) { for (uint32_t j = 0; j < 64; j++) { - m.Call(static_cast<uint32_t>(*i & 0xffffffff), + m.Call(static_cast<uint32_t>(*i & 0xFFFFFFFF), static_cast<uint32_t>(*i >> 32), j); CHECK_EQ(*i << j, ToInt64(low, high)); } @@ -4448,7 +4450,7 @@ TEST(RunWord32PairShlUseOnlyHighWord) { for (uint32_t j = 0; j < 64; j++) { CHECK_EQ( static_cast<uint32_t>((*i << j) >> 32), - static_cast<uint32_t>(m.Call(static_cast<uint32_t>(*i & 0xffffffff), + static_cast<uint32_t>(m.Call(static_cast<uint32_t>(*i & 0xFFFFFFFF), static_cast<uint32_t>(*i >> 32), j))); } } @@ -4504,7 +4506,7 @@ TEST(RunWord32PairShr) { FOR_UINT64_INPUTS(i) { for (uint32_t j = 0; j < 64; j++) { - m.Call(static_cast<uint32_t>(*i & 0xffffffff), + m.Call(static_cast<uint32_t>(*i & 0xFFFFFFFF), static_cast<uint32_t>(*i >> 32), j); CHECK_EQ(*i >> j, ToInt64(low, high)); } @@ -4522,7 +4524,7 @@ TEST(RunWord32PairShrUseOnlyHighWord) { for (uint32_t j = 0; j < 64; j++) { CHECK_EQ( static_cast<uint32_t>((*i >> j) >> 32), - static_cast<uint32_t>(m.Call(static_cast<uint32_t>(*i & 0xffffffff), + static_cast<uint32_t>(m.Call(static_cast<uint32_t>(*i & 0xFFFFFFFF), static_cast<uint32_t>(*i >> 32), j))); } } @@ -4546,7 +4548,7 @@ TEST(RunWord32PairSar) { FOR_INT64_INPUTS(i) { for (uint32_t j = 0; j < 64; j++) { - m.Call(static_cast<uint32_t>(*i & 0xffffffff), + m.Call(static_cast<uint32_t>(*i & 0xFFFFFFFF), static_cast<uint32_t>(*i >> 32), j); CHECK_EQ(*i >> j, static_cast<int64_t>(ToInt64(low, high))); } @@ -4564,7 +4566,7 @@ TEST(RunWord32PairSarUseOnlyHighWord) { for (uint32_t j = 0; j < 64; j++) { CHECK_EQ( static_cast<uint32_t>((*i >> j) >> 32), - static_cast<uint32_t>(m.Call(static_cast<uint32_t>(*i & 0xffffffff), + static_cast<uint32_t>(m.Call(static_cast<uint32_t>(*i & 0xFFFFFFFF), static_cast<uint32_t>(*i >> 32), j))); } } @@ -4573,7 +4575,7 @@ TEST(RunWord32PairSarUseOnlyHighWord) { TEST(RunDeadChangeFloat64ToInt32) { RawMachineAssemblerTester<int32_t> m; - const int magic = 0x88abcda4; + const int magic = 0x88ABCDA4; m.ChangeFloat64ToInt32(m.Float64Constant(999.78)); m.Return(m.Int32Constant(magic)); CHECK_EQ(magic, m.Call()); @@ -4582,7 +4584,7 @@ TEST(RunDeadChangeFloat64ToInt32) { TEST(RunDeadChangeInt32ToFloat64) { RawMachineAssemblerTester<int32_t> m; - const int magic = 0x8834abcd; + const int magic = 0x8834ABCD; m.ChangeInt32ToFloat64(m.Int32Constant(magic - 6888)); m.Return(m.Int32Constant(magic)); CHECK_EQ(magic, m.Call()); @@ -5538,7 +5540,7 @@ TEST(RunInt32MulWithOverflowInBranchP) { TEST(RunWord64EqualInBranchP) { int64_t input; RawMachineLabel blocka, blockb; - RawMachineAssemblerTester<int64_t> m; + RawMachineAssemblerTester<int32_t> m; if (!m.machine()->Is64()) return; Node* value = m.LoadFromPointer(&input, MachineType::Int64()); m.Branch(m.Word64Equal(value, m.Int64Constant(0)), &blocka, &blockb); @@ -5546,11 +5548,11 @@ TEST(RunWord64EqualInBranchP) { m.Return(m.Int32Constant(1)); m.Bind(&blockb); m.Return(m.Int32Constant(2)); - input = V8_INT64_C(0); + input = int64_t{0}; CHECK_EQ(1, m.Call()); - input = V8_INT64_C(1); + input = int64_t{1}; CHECK_EQ(2, m.Call()); - input = V8_INT64_C(0x100000000); + input = int64_t{0x100000000}; CHECK_EQ(2, m.Call()); } @@ -5722,9 +5724,9 @@ TEST(RunFloat64InsertLowWord32) { m.Return(m.Float64InsertLowWord32(m.Parameter(0), m.Parameter(1))); FOR_FLOAT64_INPUTS(i) { FOR_INT32_INPUTS(j) { - double expected = bit_cast<double>( - (bit_cast<uint64_t>(*i) & ~(V8_UINT64_C(0xFFFFFFFF))) | - (static_cast<uint64_t>(bit_cast<uint32_t>(*j)))); + double expected = + bit_cast<double>((bit_cast<uint64_t>(*i) & ~(uint64_t{0xFFFFFFFF})) | + (static_cast<uint64_t>(bit_cast<uint32_t>(*j)))); CHECK_DOUBLE_EQ(expected, m.Call(*i, *j)); } } @@ -6187,8 +6189,7 @@ TEST(RunFloat64RoundTiesAway) { namespace { -int32_t const kMagicFoo0 = 0xdeadbeef; - +int32_t const kMagicFoo0 = 0xDEADBEEF; int32_t foo0() { return kMagicFoo0; } @@ -6483,80 +6484,80 @@ TEST(RunRoundUint64ToFloat64) { uint64_t input; uint64_t expected; } values[] = {{0x0, 0x0}, - {0x1, 0x3ff0000000000000}, - {0xffffffff, 0x41efffffffe00000}, - {0x1b09788b, 0x41bb09788b000000}, - {0x4c5fce8, 0x419317f3a0000000}, - {0xcc0de5bf, 0x41e981bcb7e00000}, + {0x1, 0x3FF0000000000000}, + {0xFFFFFFFF, 0x41EFFFFFFFE00000}, + {0x1B09788B, 0x41BB09788B000000}, + {0x4C5FCE8, 0x419317F3A0000000}, + {0xCC0DE5BF, 0x41E981BCB7E00000}, {0x2, 0x4000000000000000}, {0x3, 0x4008000000000000}, {0x4, 0x4010000000000000}, {0x5, 0x4014000000000000}, {0x8, 0x4020000000000000}, {0x9, 0x4022000000000000}, - {0xffffffffffffffff, 0x43f0000000000000}, - {0xfffffffffffffffe, 0x43f0000000000000}, - {0xfffffffffffffffd, 0x43f0000000000000}, - {0x100000000, 0x41f0000000000000}, - {0xffffffff00000000, 0x43efffffffe00000}, - {0x1b09788b00000000, 0x43bb09788b000000}, - {0x4c5fce800000000, 0x439317f3a0000000}, - {0xcc0de5bf00000000, 0x43e981bcb7e00000}, + {0xFFFFFFFFFFFFFFFF, 0x43F0000000000000}, + {0xFFFFFFFFFFFFFFFE, 0x43F0000000000000}, + {0xFFFFFFFFFFFFFFFD, 0x43F0000000000000}, + {0x100000000, 0x41F0000000000000}, + {0xFFFFFFFF00000000, 0x43EFFFFFFFE00000}, + {0x1B09788B00000000, 0x43BB09788B000000}, + {0x4C5FCE800000000, 0x439317F3A0000000}, + {0xCC0DE5BF00000000, 0x43E981BCB7E00000}, {0x200000000, 0x4200000000000000}, {0x300000000, 0x4208000000000000}, {0x400000000, 0x4210000000000000}, {0x500000000, 0x4214000000000000}, {0x800000000, 0x4220000000000000}, {0x900000000, 0x4222000000000000}, - {0x273a798e187937a3, 0x43c39d3cc70c3c9c}, - {0xece3af835495a16b, 0x43ed9c75f06a92b4}, - {0xb668ecc11223344, 0x43a6cd1d98224467}, - {0x9e, 0x4063c00000000000}, - {0x43, 0x4050c00000000000}, - {0xaf73, 0x40e5ee6000000000}, - {0x116b, 0x40b16b0000000000}, - {0x658ecc, 0x415963b300000000}, - {0x2b3b4c, 0x41459da600000000}, - {0x88776655, 0x41e10eeccaa00000}, - {0x70000000, 0x41dc000000000000}, - {0x7200000, 0x419c800000000000}, - {0x7fffffff, 0x41dfffffffc00000}, - {0x56123761, 0x41d5848dd8400000}, - {0x7fffff00, 0x41dfffffc0000000}, - {0x761c4761eeeeeeee, 0x43dd8711d87bbbbc}, - {0x80000000eeeeeeee, 0x43e00000001dddde}, - {0x88888888dddddddd, 0x43e11111111bbbbc}, - {0xa0000000dddddddd, 0x43e40000001bbbbc}, - {0xddddddddaaaaaaaa, 0x43ebbbbbbbb55555}, - {0xe0000000aaaaaaaa, 0x43ec000000155555}, - {0xeeeeeeeeeeeeeeee, 0x43edddddddddddde}, - {0xfffffffdeeeeeeee, 0x43efffffffbdddde}, - {0xf0000000dddddddd, 0x43ee0000001bbbbc}, - {0x7fffffdddddddd, 0x435ffffff7777777}, - {0x3fffffaaaaaaaa, 0x434fffffd5555555}, - {0x1fffffaaaaaaaa, 0x433fffffaaaaaaaa}, - {0xfffff, 0x412ffffe00000000}, - {0x7ffff, 0x411ffffc00000000}, - {0x3ffff, 0x410ffff800000000}, - {0x1ffff, 0x40fffff000000000}, - {0xffff, 0x40efffe000000000}, - {0x7fff, 0x40dfffc000000000}, - {0x3fff, 0x40cfff8000000000}, - {0x1fff, 0x40bfff0000000000}, - {0xfff, 0x40affe0000000000}, - {0x7ff, 0x409ffc0000000000}, - {0x3ff, 0x408ff80000000000}, - {0x1ff, 0x407ff00000000000}, - {0x3fffffffffff, 0x42cfffffffffff80}, - {0x1fffffffffff, 0x42bfffffffffff00}, - {0xfffffffffff, 0x42affffffffffe00}, - {0x7ffffffffff, 0x429ffffffffffc00}, - {0x3ffffffffff, 0x428ffffffffff800}, - {0x1ffffffffff, 0x427ffffffffff000}, - {0x8000008000000000, 0x43e0000010000000}, - {0x8000008000000001, 0x43e0000010000000}, - {0x8000000000000400, 0x43e0000000000000}, - {0x8000000000000401, 0x43e0000000000001}}; + {0x273A798E187937A3, 0x43C39D3CC70C3C9C}, + {0xECE3AF835495A16B, 0x43ED9C75F06A92B4}, + {0xB668ECC11223344, 0x43A6CD1D98224467}, + {0x9E, 0x4063C00000000000}, + {0x43, 0x4050C00000000000}, + {0xAF73, 0x40E5EE6000000000}, + {0x116B, 0x40B16B0000000000}, + {0x658ECC, 0x415963B300000000}, + {0x2B3B4C, 0x41459DA600000000}, + {0x88776655, 0x41E10EECCAA00000}, + {0x70000000, 0x41DC000000000000}, + {0x7200000, 0x419C800000000000}, + {0x7FFFFFFF, 0x41DFFFFFFFC00000}, + {0x56123761, 0x41D5848DD8400000}, + {0x7FFFFF00, 0x41DFFFFFC0000000}, + {0x761C4761EEEEEEEE, 0x43DD8711D87BBBBC}, + {0x80000000EEEEEEEE, 0x43E00000001DDDDE}, + {0x88888888DDDDDDDD, 0x43E11111111BBBBC}, + {0xA0000000DDDDDDDD, 0x43E40000001BBBBC}, + {0xDDDDDDDDAAAAAAAA, 0x43EBBBBBBBB55555}, + {0xE0000000AAAAAAAA, 0x43EC000000155555}, + {0xEEEEEEEEEEEEEEEE, 0x43EDDDDDDDDDDDDE}, + {0xFFFFFFFDEEEEEEEE, 0x43EFFFFFFFBDDDDE}, + {0xF0000000DDDDDDDD, 0x43EE0000001BBBBC}, + {0x7FFFFFDDDDDDDD, 0x435FFFFFF7777777}, + {0x3FFFFFAAAAAAAA, 0x434FFFFFD5555555}, + {0x1FFFFFAAAAAAAA, 0x433FFFFFAAAAAAAA}, + {0xFFFFF, 0x412FFFFE00000000}, + {0x7FFFF, 0x411FFFFC00000000}, + {0x3FFFF, 0x410FFFF800000000}, + {0x1FFFF, 0x40FFFFF000000000}, + {0xFFFF, 0x40EFFFE000000000}, + {0x7FFF, 0x40DFFFC000000000}, + {0x3FFF, 0x40CFFF8000000000}, + {0x1FFF, 0x40BFFF0000000000}, + {0xFFF, 0x40AFFE0000000000}, + {0x7FF, 0x409FFC0000000000}, + {0x3FF, 0x408FF80000000000}, + {0x1FF, 0x407FF00000000000}, + {0x3FFFFFFFFFFF, 0x42CFFFFFFFFFFF80}, + {0x1FFFFFFFFFFF, 0x42BFFFFFFFFFFF00}, + {0xFFFFFFFFFFF, 0x42AFFFFFFFFFFE00}, + {0x7FFFFFFFFFF, 0x429FFFFFFFFFFC00}, + {0x3FFFFFFFFFF, 0x428FFFFFFFFFF800}, + {0x1FFFFFFFFFF, 0x427FFFFFFFFFF000}, + {0x8000008000000000, 0x43E0000010000000}, + {0x8000008000000001, 0x43E0000010000000}, + {0x8000000000000400, 0x43E0000000000000}, + {0x8000000000000401, 0x43E0000000000001}}; BufferedRawMachineAssemblerTester<double> m(MachineType::Uint64()); m.Return(m.RoundUint64ToFloat64(m.Parameter(0))); @@ -6572,81 +6573,81 @@ TEST(RunRoundUint64ToFloat32) { uint64_t input; uint32_t expected; } values[] = {{0x0, 0x0}, - {0x1, 0x3f800000}, - {0xffffffff, 0x4f800000}, - {0x1b09788b, 0x4dd84bc4}, - {0x4c5fce8, 0x4c98bf9d}, - {0xcc0de5bf, 0x4f4c0de6}, + {0x1, 0x3F800000}, + {0xFFFFFFFF, 0x4F800000}, + {0x1B09788B, 0x4DD84BC4}, + {0x4C5FCE8, 0x4C98BF9D}, + {0xCC0DE5BF, 0x4F4C0DE6}, {0x2, 0x40000000}, {0x3, 0x40400000}, {0x4, 0x40800000}, - {0x5, 0x40a00000}, + {0x5, 0x40A00000}, {0x8, 0x41000000}, {0x9, 0x41100000}, - {0xffffffffffffffff, 0x5f800000}, - {0xfffffffffffffffe, 0x5f800000}, - {0xfffffffffffffffd, 0x5f800000}, + {0xFFFFFFFFFFFFFFFF, 0x5F800000}, + {0xFFFFFFFFFFFFFFFE, 0x5F800000}, + {0xFFFFFFFFFFFFFFFD, 0x5F800000}, {0x0, 0x0}, - {0x100000000, 0x4f800000}, - {0xffffffff00000000, 0x5f800000}, - {0x1b09788b00000000, 0x5dd84bc4}, - {0x4c5fce800000000, 0x5c98bf9d}, - {0xcc0de5bf00000000, 0x5f4c0de6}, + {0x100000000, 0x4F800000}, + {0xFFFFFFFF00000000, 0x5F800000}, + {0x1B09788B00000000, 0x5DD84BC4}, + {0x4C5FCE800000000, 0x5C98BF9D}, + {0xCC0DE5BF00000000, 0x5F4C0DE6}, {0x200000000, 0x50000000}, {0x300000000, 0x50400000}, {0x400000000, 0x50800000}, - {0x500000000, 0x50a00000}, + {0x500000000, 0x50A00000}, {0x800000000, 0x51000000}, {0x900000000, 0x51100000}, - {0x273a798e187937a3, 0x5e1ce9e6}, - {0xece3af835495a16b, 0x5f6ce3b0}, - {0xb668ecc11223344, 0x5d3668ed}, - {0x9e, 0x431e0000}, + {0x273A798E187937A3, 0x5E1CE9E6}, + {0xECE3AF835495A16B, 0x5F6CE3B0}, + {0xB668ECC11223344, 0x5D3668ED}, + {0x9E, 0x431E0000}, {0x43, 0x42860000}, - {0xaf73, 0x472f7300}, - {0x116b, 0x458b5800}, - {0x658ecc, 0x4acb1d98}, - {0x2b3b4c, 0x4a2ced30}, - {0x88776655, 0x4f087766}, - {0x70000000, 0x4ee00000}, - {0x7200000, 0x4ce40000}, - {0x7fffffff, 0x4f000000}, - {0x56123761, 0x4eac246f}, - {0x7fffff00, 0x4efffffe}, - {0x761c4761eeeeeeee, 0x5eec388f}, - {0x80000000eeeeeeee, 0x5f000000}, - {0x88888888dddddddd, 0x5f088889}, - {0xa0000000dddddddd, 0x5f200000}, - {0xddddddddaaaaaaaa, 0x5f5dddde}, - {0xe0000000aaaaaaaa, 0x5f600000}, - {0xeeeeeeeeeeeeeeee, 0x5f6eeeef}, - {0xfffffffdeeeeeeee, 0x5f800000}, - {0xf0000000dddddddd, 0x5f700000}, - {0x7fffffdddddddd, 0x5b000000}, - {0x3fffffaaaaaaaa, 0x5a7fffff}, - {0x1fffffaaaaaaaa, 0x59fffffd}, - {0xfffff, 0x497ffff0}, - {0x7ffff, 0x48ffffe0}, - {0x3ffff, 0x487fffc0}, - {0x1ffff, 0x47ffff80}, - {0xffff, 0x477fff00}, - {0x7fff, 0x46fffe00}, - {0x3fff, 0x467ffc00}, - {0x1fff, 0x45fff800}, - {0xfff, 0x457ff000}, - {0x7ff, 0x44ffe000}, - {0x3ff, 0x447fc000}, - {0x1ff, 0x43ff8000}, - {0x3fffffffffff, 0x56800000}, - {0x1fffffffffff, 0x56000000}, - {0xfffffffffff, 0x55800000}, - {0x7ffffffffff, 0x55000000}, - {0x3ffffffffff, 0x54800000}, - {0x1ffffffffff, 0x54000000}, - {0x8000008000000000, 0x5f000000}, - {0x8000008000000001, 0x5f000001}, - {0x8000000000000400, 0x5f000000}, - {0x8000000000000401, 0x5f000000}}; + {0xAF73, 0x472F7300}, + {0x116B, 0x458B5800}, + {0x658ECC, 0x4ACB1D98}, + {0x2B3B4C, 0x4A2CED30}, + {0x88776655, 0x4F087766}, + {0x70000000, 0x4EE00000}, + {0x7200000, 0x4CE40000}, + {0x7FFFFFFF, 0x4F000000}, + {0x56123761, 0x4EAC246F}, + {0x7FFFFF00, 0x4EFFFFFE}, + {0x761C4761EEEEEEEE, 0x5EEC388F}, + {0x80000000EEEEEEEE, 0x5F000000}, + {0x88888888DDDDDDDD, 0x5F088889}, + {0xA0000000DDDDDDDD, 0x5F200000}, + {0xDDDDDDDDAAAAAAAA, 0x5F5DDDDE}, + {0xE0000000AAAAAAAA, 0x5F600000}, + {0xEEEEEEEEEEEEEEEE, 0x5F6EEEEF}, + {0xFFFFFFFDEEEEEEEE, 0x5F800000}, + {0xF0000000DDDDDDDD, 0x5F700000}, + {0x7FFFFFDDDDDDDD, 0x5B000000}, + {0x3FFFFFAAAAAAAA, 0x5A7FFFFF}, + {0x1FFFFFAAAAAAAA, 0x59FFFFFD}, + {0xFFFFF, 0x497FFFF0}, + {0x7FFFF, 0x48FFFFE0}, + {0x3FFFF, 0x487FFFC0}, + {0x1FFFF, 0x47FFFF80}, + {0xFFFF, 0x477FFF00}, + {0x7FFF, 0x46FFFE00}, + {0x3FFF, 0x467FFC00}, + {0x1FFF, 0x45FFF800}, + {0xFFF, 0x457FF000}, + {0x7FF, 0x44FFE000}, + {0x3FF, 0x447FC000}, + {0x1FF, 0x43FF8000}, + {0x3FFFFFFFFFFF, 0x56800000}, + {0x1FFFFFFFFFFF, 0x56000000}, + {0xFFFFFFFFFFF, 0x55800000}, + {0x7FFFFFFFFFF, 0x55000000}, + {0x3FFFFFFFFFF, 0x54800000}, + {0x1FFFFFFFFFF, 0x54000000}, + {0x8000008000000000, 0x5F000000}, + {0x8000008000000001, 0x5F000001}, + {0x8000000000000400, 0x5F000000}, + {0x8000000000000401, 0x5F000000}}; BufferedRawMachineAssemblerTester<float> m(MachineType::Uint64()); m.Return(m.RoundUint64ToFloat32(m.Parameter(0))); @@ -6737,7 +6738,7 @@ TEST(RunComputedCodeObject) { // TODO(titzer): all this descriptor hackery is just to call the above // functions as code objects instead of direct addresses. - CSignature0<int32_t> sig; + CSignatureOf<int32_t> sig; CallDescriptor* c = Linkage::GetSimplifiedCDescriptor(r.zone(), &sig); LinkageLocation ret[] = {c->GetReturnLocation(0)}; Signature<LinkageLocation> loc(1, 0, ret); @@ -6832,7 +6833,7 @@ TEST(Regression5923) { TEST(Regression5951) { BufferedRawMachineAssemblerTester<int64_t> m(MachineType::Int64()); m.Return(m.Word64And(m.Word64Shr(m.Parameter(0), m.Int64Constant(0)), - m.Int64Constant(0xffffffffffffffffl))); + m.Int64Constant(0xFFFFFFFFFFFFFFFFl))); int64_t input = 1234; CHECK_EQ(input, m.Call(input)); } @@ -6879,7 +6880,7 @@ TEST(Regression6028) { TEST(Regression5951_32bit) { BufferedRawMachineAssemblerTester<int32_t> m(MachineType::Int32()); m.Return(m.Word32And(m.Word32Shr(m.Parameter(0), m.Int32Constant(0)), - m.Int32Constant(0xffffffff))); + m.Int32Constant(0xFFFFFFFF))); int32_t input = 1234; CHECK_EQ(input, m.Call(input)); } 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 8472c1e70e..42196e6454 100644 --- a/deps/v8/test/cctest/compiler/test-run-native-calls.cc +++ b/deps/v8/test/cctest/compiler/test-run-native-calls.cc @@ -207,7 +207,7 @@ class RegisterConfig { compiler::Operator::kNoProperties, // properties kCalleeSaveRegisters, // callee-saved registers kCalleeSaveFPRegisters, // callee-saved fp regs - CallDescriptor::kUseNativeStack, // flags + CallDescriptor::kNoFlags, // flags "c-call"); } @@ -446,7 +446,7 @@ class Computer { inner = CompileGraph("Compute", desc, &graph, raw.Export()); } - CSignature0<int32_t> csig; + CSignatureOf<int32_t> csig; ArgsBuffer<CType> io(num_params, seed); { @@ -583,7 +583,7 @@ static void CopyTwentyInt32(CallDescriptor* desc) { inner = CompileGraph("CopyTwentyInt32", desc, &graph, raw.Export()); } - CSignature0<int32_t> csig; + CSignatureOf<int32_t> csig; Handle<Code> wrapper = Handle<Code>::null(); { // Loads parameters from the input buffer and calls the above code. @@ -1076,7 +1076,7 @@ void MixedParamTest(int start) { char bytes[kDoubleSize]; V8_ALIGNED(8) char output[kDoubleSize]; int expected_size = 0; - CSignature0<int32_t> csig; + CSignatureOf<int32_t> csig; { // Wrap the select code with a callable function that passes constants. Zone zone(&allocator, ZONE_NAME); @@ -1211,7 +1211,7 @@ TEST(RunStackSlotInt32) { #if !V8_TARGET_ARCH_32_BIT TEST(RunStackSlotInt64) { - int64_t magic = 0x123456789abcdef0; + int64_t magic = 0x123456789ABCDEF0; TestStackSlot(MachineType::Int64(), magic); } #endif diff --git a/deps/v8/test/cctest/compiler/test-run-retpoline.cc b/deps/v8/test/cctest/compiler/test-run-retpoline.cc new file mode 100644 index 0000000000..152ed448ef --- /dev/null +++ b/deps/v8/test/cctest/compiler/test-run-retpoline.cc @@ -0,0 +1,208 @@ +// 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/assembler-inl.h" +#include "src/code-stub-assembler.h" + +#include "test/cctest/cctest.h" +#include "test/cctest/compiler/code-assembler-tester.h" +#include "test/cctest/compiler/function-tester.h" + +namespace v8 { +namespace internal { +namespace compiler { +namespace test_run_retpoline { + +#define __ assembler. + +namespace { + +// Function that takes a number of pointer-sized integer arguments, calculates a +// weighted sum of them and returns it. +Handle<Code> BuildCallee(Isolate* isolate, CallDescriptor* descriptor) { + CodeAssemblerTester tester(isolate, descriptor, "callee"); + CodeStubAssembler assembler(tester.state()); + int param_count = static_cast<int>(descriptor->StackParameterCount()); + Node* sum = __ IntPtrConstant(0); + for (int i = 0; i < param_count; ++i) { + Node* product = __ IntPtrMul(__ Parameter(i), __ IntPtrConstant(i + 1)); + sum = __ IntPtrAdd(sum, product); + } + __ Return(sum); + return tester.GenerateCodeCloseAndEscape(); +} + +// Function that tail-calls another function with a number of pointer-sized +// integer arguments. +Handle<Code> BuildCaller(Isolate* isolate, CallDescriptor* descriptor, + CallDescriptor* callee_descriptor, bool tail) { + CodeAssemblerTester tester(isolate, descriptor, "caller"); + CodeStubAssembler assembler(tester.state()); + std::vector<Node*> params; + // The first parameter is always the callee. + Handle<Code> callee = BuildCallee(isolate, callee_descriptor); + // defeat the instruction selector. + CodeStubAssembler::Variable target_var(&assembler, + MachineRepresentation::kTagged); + CodeStubAssembler::Label t(&assembler), f(&assembler), + end(&assembler, &target_var); + __ Branch(__ Int32Constant(0), &t, &f); + __ BIND(&t); + target_var.Bind(__ HeapConstant(callee)); + __ Goto(&end); + __ BIND(&f); + target_var.Bind(__ HeapConstant(callee)); + __ Goto(&end); + __ BIND(&end); + params.push_back(target_var.value()); + + int param_count = static_cast<int>(callee_descriptor->StackParameterCount()); + for (int i = 0; i < param_count; ++i) { + params.push_back(__ IntPtrConstant(i)); + } + DCHECK_EQ(param_count + 1, params.size()); + if (tail) { + tester.raw_assembler_for_testing()->TailCallN( + callee_descriptor, param_count + 1, params.data()); + } else { + Node* result = tester.raw_assembler_for_testing()->CallN( + callee_descriptor, param_count + 1, params.data()); + __ Return(result); + } + return tester.GenerateCodeCloseAndEscape(); +} + +// Setup function, which calls "caller". +Handle<Code> BuildSetupFunction(Isolate* isolate, + CallDescriptor* caller_descriptor, + CallDescriptor* callee_descriptor, bool tail) { + CodeAssemblerTester tester(isolate, 0); + CodeStubAssembler assembler(tester.state()); + std::vector<Node*> params; + // The first parameter is always the callee. + params.push_back(__ HeapConstant( + BuildCaller(isolate, caller_descriptor, callee_descriptor, tail))); + // Set up arguments for "Caller". + int param_count = static_cast<int>(caller_descriptor->StackParameterCount()); + for (int i = 0; i < param_count; ++i) { + // Use values that are different from the ones we will pass to this + // function's callee later. + params.push_back(__ IntPtrConstant(i + 42)); + } + DCHECK_EQ(param_count + 1, params.size()); + Node* raw_result = tester.raw_assembler_for_testing()->CallN( + caller_descriptor, param_count + 1, params.data()); + __ Return(__ SmiTag(raw_result)); + return tester.GenerateCodeCloseAndEscape(); +} + +CallDescriptor* CreateDescriptorForStackArguments(Zone* zone, + int stack_param_count) { + LocationSignature::Builder locations(zone, 1, + static_cast<size_t>(stack_param_count)); + + locations.AddReturn(LinkageLocation::ForRegister(kReturnRegister0.code(), + MachineType::IntPtr())); + + for (int i = 0; i < stack_param_count; ++i) { + locations.AddParam(LinkageLocation::ForCallerFrameSlot( + i - stack_param_count, MachineType::IntPtr())); + } + + return new (zone) + CallDescriptor(CallDescriptor::kCallCodeObject, // kind + MachineType::AnyTagged(), // target MachineType + LinkageLocation::ForAnyRegister( + MachineType::AnyTagged()), // target location + locations.Build(), // location_sig + stack_param_count, // stack_parameter_count + Operator::kNoProperties, // properties + kNoCalleeSaved, // callee-saved registers + kNoCalleeSaved, // callee-saved fp + CallDescriptor::kRetpoline); // flags +} + +// Test a tail call from a caller with n parameters to a callee with m +// parameters. All parameters are pointer-sized. +void TestHelper(int n, int m, bool tail) { + HandleAndZoneScope scope; + Isolate* isolate = scope.main_isolate(); + Zone* zone = scope.main_zone(); + CallDescriptor* caller_descriptor = + CreateDescriptorForStackArguments(zone, n); + CallDescriptor* callee_descriptor = + CreateDescriptorForStackArguments(zone, m); + Handle<Code> setup = + BuildSetupFunction(isolate, caller_descriptor, callee_descriptor, tail); + FunctionTester ft(setup, 0); + Handle<Object> result = ft.Call().ToHandleChecked(); + int expected = 0; + for (int i = 0; i < m; ++i) expected += (i + 1) * i; + CHECK_EQ(expected, Handle<Smi>::cast(result)->value()); +} + +} // namespace + +#undef __ + +TEST(RetpolineOddEven) { + TestHelper(1, 0, false); + TestHelper(1, 2, false); + TestHelper(3, 2, false); + TestHelper(3, 4, false); +} + +TEST(RetpolineOddEvenTail) { + TestHelper(1, 0, true); + TestHelper(1, 2, true); + TestHelper(3, 2, true); + TestHelper(3, 4, true); +} + +TEST(RetpolineOddOdd) { + TestHelper(1, 1, false); + TestHelper(1, 3, false); + TestHelper(3, 1, false); + TestHelper(3, 3, false); +} + +TEST(RetpolineOddOddTail) { + TestHelper(1, 1, true); + TestHelper(1, 3, true); + TestHelper(3, 1, true); + TestHelper(3, 3, true); +} + +TEST(RetpolineEvenEven) { + TestHelper(0, 0, false); + TestHelper(0, 2, false); + TestHelper(2, 0, false); + TestHelper(2, 2, false); +} + +TEST(RetpolineEvenEvenTail) { + TestHelper(0, 0, true); + TestHelper(0, 2, true); + TestHelper(2, 0, true); + TestHelper(2, 2, true); +} + +TEST(RetpolineEvenOdd) { + TestHelper(0, 1, false); + TestHelper(0, 3, false); + TestHelper(2, 1, false); + TestHelper(2, 3, false); +} + +TEST(RetpolineEvenOddTail) { + TestHelper(0, 1, true); + TestHelper(0, 3, true); + TestHelper(2, 1, true); + TestHelper(2, 3, true); +} + +} // namespace test_run_retpoline +} // namespace compiler +} // namespace internal +} // namespace v8 diff --git a/deps/v8/test/cctest/compiler/test-run-tail-calls.cc b/deps/v8/test/cctest/compiler/test-run-tail-calls.cc new file mode 100644 index 0000000000..2fbc90d46d --- /dev/null +++ b/deps/v8/test/cctest/compiler/test-run-tail-calls.cc @@ -0,0 +1,171 @@ +// Copyright 2017 the V8 project authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "src/assembler-inl.h" +#include "src/base/utils/random-number-generator.h" +#include "src/code-stub-assembler.h" + +#include "test/cctest/cctest.h" +#include "test/cctest/compiler/code-assembler-tester.h" +#include "test/cctest/compiler/function-tester.h" + +namespace v8 { +namespace internal { +namespace compiler { +namespace test_run_tail_calls { + +#define __ assembler. + +namespace { + +// Function that takes a number of pointer-sized integer arguments, calculates a +// weighted sum of them and returns it. +Handle<Code> BuildCallee(Isolate* isolate, CallDescriptor* descriptor) { + CodeAssemblerTester tester(isolate, descriptor, "callee"); + CodeStubAssembler assembler(tester.state()); + int param_count = static_cast<int>(descriptor->StackParameterCount()); + Node* sum = __ IntPtrConstant(0); + for (int i = 0; i < param_count; ++i) { + Node* product = __ IntPtrMul(__ Parameter(i), __ IntPtrConstant(i + 1)); + sum = __ IntPtrAdd(sum, product); + } + __ Return(sum); + return tester.GenerateCodeCloseAndEscape(); +} + +// Function that tail-calls another function with a number of pointer-sized +// integer arguments. +Handle<Code> BuildCaller(Isolate* isolate, CallDescriptor* descriptor, + CallDescriptor* callee_descriptor) { + CodeAssemblerTester tester(isolate, descriptor, "caller"); + CodeStubAssembler assembler(tester.state()); + std::vector<Node*> params; + // The first parameter is always the callee. + params.push_back(__ HeapConstant(BuildCallee(isolate, callee_descriptor))); + int param_count = static_cast<int>(callee_descriptor->StackParameterCount()); + for (int i = 0; i < param_count; ++i) { + params.push_back(__ IntPtrConstant(i)); + } + DCHECK_EQ(param_count + 1, params.size()); + tester.raw_assembler_for_testing()->TailCallN(callee_descriptor, + param_count + 1, params.data()); + return tester.GenerateCodeCloseAndEscape(); +} + +// Setup function, which calls "caller". +Handle<Code> BuildSetupFunction(Isolate* isolate, + CallDescriptor* caller_descriptor, + CallDescriptor* callee_descriptor) { + CodeAssemblerTester tester(isolate, 0); + CodeStubAssembler assembler(tester.state()); + std::vector<Node*> params; + // The first parameter is always the callee. + params.push_back(__ HeapConstant( + BuildCaller(isolate, caller_descriptor, callee_descriptor))); + // Set up arguments for "Caller". + int param_count = static_cast<int>(caller_descriptor->StackParameterCount()); + for (int i = 0; i < param_count; ++i) { + // Use values that are different from the ones we will pass to this + // function's callee later. + params.push_back(__ IntPtrConstant(i + 42)); + } + DCHECK_EQ(param_count + 1, params.size()); + Node* raw_result = tester.raw_assembler_for_testing()->CallN( + caller_descriptor, param_count + 1, params.data()); + __ Return(__ SmiTag(raw_result)); + return tester.GenerateCodeCloseAndEscape(); +} + +CallDescriptor* CreateDescriptorForStackArguments(Zone* zone, + int stack_param_count) { + LocationSignature::Builder locations(zone, 1, + static_cast<size_t>(stack_param_count)); + + locations.AddReturn(LinkageLocation::ForRegister(kReturnRegister0.code(), + MachineType::IntPtr())); + + for (int i = 0; i < stack_param_count; ++i) { + locations.AddParam(LinkageLocation::ForCallerFrameSlot( + i - stack_param_count, MachineType::IntPtr())); + } + + return new (zone) + CallDescriptor(CallDescriptor::kCallCodeObject, // kind + MachineType::AnyTagged(), // target MachineType + LinkageLocation::ForAnyRegister( + MachineType::AnyTagged()), // target location + locations.Build(), // location_sig + stack_param_count, // stack_parameter_count + Operator::kNoProperties, // properties + kNoCalleeSaved, // callee-saved registers + kNoCalleeSaved, // callee-saved fp + CallDescriptor::kNoFlags); // flags +} + +// Test a tail call from a caller with n parameters to a callee with m +// parameters. All parameters are pointer-sized. +void TestHelper(int n, int m) { + HandleAndZoneScope scope; + Isolate* isolate = scope.main_isolate(); + Zone* zone = scope.main_zone(); + CallDescriptor* caller_descriptor = + CreateDescriptorForStackArguments(zone, n); + CallDescriptor* callee_descriptor = + CreateDescriptorForStackArguments(zone, m); + Handle<Code> setup = + BuildSetupFunction(isolate, caller_descriptor, callee_descriptor); + FunctionTester ft(setup, 0); + Handle<Object> result = ft.Call().ToHandleChecked(); + int expected = 0; + for (int i = 0; i < m; ++i) expected += (i + 1) * i; + CHECK_EQ(expected, Handle<Smi>::cast(result)->value()); +} + +} // namespace + +#undef __ + +TEST(CallerOddCalleeEven) { + TestHelper(1, 0); + TestHelper(1, 2); + TestHelper(3, 2); + TestHelper(3, 4); +} + +TEST(CallerOddCalleeOdd) { + TestHelper(1, 1); + TestHelper(1, 3); + TestHelper(3, 1); + TestHelper(3, 3); +} + +TEST(CallerEvenCalleeEven) { + TestHelper(0, 0); + TestHelper(0, 2); + TestHelper(2, 0); + TestHelper(2, 2); +} + +TEST(CallerEvenCalleeOdd) { + TestHelper(0, 1); + TestHelper(0, 3); + TestHelper(2, 1); + TestHelper(2, 3); +} + +TEST(FuzzStackParamCount) { + const int kNumTests = 20; + const int kMaxSlots = 30; + base::RandomNumberGenerator* const rng = CcTest::random_number_generator(); + for (int i = 0; i < kNumTests; ++i) { + int n = rng->NextInt(kMaxSlots); + int m = rng->NextInt(kMaxSlots); + TestHelper(n, m); + } +} + +} // namespace test_run_tail_calls +} // namespace compiler +} // namespace internal +} // namespace v8 diff --git a/deps/v8/test/cctest/compiler/test-run-wasm-machops.cc b/deps/v8/test/cctest/compiler/test-run-wasm-machops.cc index b451b73e0d..2f1536433f 100644 --- a/deps/v8/test/cctest/compiler/test-run-wasm-machops.cc +++ b/deps/v8/test/cctest/compiler/test-run-wasm-machops.cc @@ -164,14 +164,14 @@ TEST(Uint32LessThanMemoryRelocation) { Node* cond = m.AddNode(m.machine()->Uint32LessThan(), index, limit); m.Branch(cond, &within_bounds, &out_of_bounds); m.Bind(&within_bounds); - m.Return(m.Int32Constant(0xaced)); + m.Return(m.Int32Constant(0xACED)); m.Bind(&out_of_bounds); - m.Return(m.Int32Constant(0xdeadbeef)); + m.Return(m.Int32Constant(0xDEADBEEF)); // Check that index is out of bounds with current size - CHECK_EQ(0xdeadbeef, m.Call()); + CHECK_EQ(0xDEADBEEF, m.Call()); wasm_context.SetRawMemory(wasm_context.mem_start, 0x400); // Check that after limit is increased, index is within bounds. - CHECK_EQ(0xacedu, m.Call()); + CHECK_EQ(0xACEDu, m.Call()); } TEST(Uint32LessThanFunctionTableRelocation) { @@ -183,17 +183,17 @@ TEST(Uint32LessThanFunctionTableRelocation) { Node* cond = m.AddNode(m.machine()->Uint32LessThan(), index, limit); m.Branch(cond, &within_bounds, &out_of_bounds); m.Bind(&within_bounds); - m.Return(m.Int32Constant(0xaced)); + m.Return(m.Int32Constant(0xACED)); m.Bind(&out_of_bounds); - m.Return(m.Int32Constant(0xdeadbeef)); + m.Return(m.Int32Constant(0xDEADBEEF)); // Check that index is out of bounds with current size - CHECK_EQ(0xdeadbeef, m.Call()); + CHECK_EQ(0xDEADBEEF, m.Call()); m.GenerateCode(); Handle<Code> code = m.GetCode(); UpdateFunctionTableSizeReferences(code, 0x200, 0x400); // Check that after limit is increased, index is within bounds. - CHECK_EQ(0xaced, m.Call()); + CHECK_EQ(0xACED, m.Call()); } } // namespace compiler diff --git a/deps/v8/test/cctest/compiler/value-helper.h b/deps/v8/test/cctest/compiler/value-helper.h index 28e64c703e..a69a371e36 100644 --- a/deps/v8/test/cctest/compiler/value-helper.h +++ b/deps/v8/test/cctest/compiler/value-helper.h @@ -239,19 +239,19 @@ class ValueHelper { } static constexpr uint32_t uint32_array[] = { - 0x00000000, 0x00000001, 0xffffffff, 0x1b09788b, 0x04c5fce8, 0xcc0de5bf, + 0x00000000, 0x00000001, 0xFFFFFFFF, 0x1B09788B, 0x04C5FCE8, 0xCC0DE5BF, // This row is useful for testing lea optimizations on intel. 0x00000002, 0x00000003, 0x00000004, 0x00000005, 0x00000008, 0x00000009, - 0x273a798e, 0x187937a3, 0xece3af83, 0x5495a16b, 0x0b668ecc, 0x11223344, - 0x0000009e, 0x00000043, 0x0000af73, 0x0000116b, 0x00658ecc, 0x002b3b4c, - 0x88776655, 0x70000000, 0x07200000, 0x7fffffff, 0x56123761, 0x7fffff00, - 0x761c4761, 0x80000000, 0x88888888, 0xa0000000, 0xdddddddd, 0xe0000000, - 0xeeeeeeee, 0xfffffffd, 0xf0000000, 0x007fffff, 0x003fffff, 0x001fffff, - 0x000fffff, 0x0007ffff, 0x0003ffff, 0x0001ffff, 0x0000ffff, 0x00007fff, - 0x00003fff, 0x00001fff, 0x00000fff, 0x000007ff, 0x000003ff, 0x000001ff, + 0x273A798E, 0x187937A3, 0xECE3AF83, 0x5495A16B, 0x0B668ECC, 0x11223344, + 0x0000009E, 0x00000043, 0x0000AF73, 0x0000116B, 0x00658ECC, 0x002B3B4C, + 0x88776655, 0x70000000, 0x07200000, 0x7FFFFFFF, 0x56123761, 0x7FFFFF00, + 0x761C4761, 0x80000000, 0x88888888, 0xA0000000, 0xDDDDDDDD, 0xE0000000, + 0xEEEEEEEE, 0xFFFFFFFD, 0xF0000000, 0x007FFFFF, 0x003FFFFF, 0x001FFFFF, + 0x000FFFFF, 0x0007FFFF, 0x0003FFFF, 0x0001FFFF, 0x0000FFFF, 0x00007FFF, + 0x00003FFF, 0x00001FFF, 0x00000FFF, 0x000007FF, 0x000003FF, 0x000001FF, // Bit pattern of a quiet NaN and signaling NaN, with or without // additional payload. - 0x7fc00000, 0x7f800000, 0x7fffffff, 0x7f876543}; + 0x7FC00000, 0x7F800000, 0x7FFFFFFF, 0x7F876543}; static constexpr Vector<const uint32_t> uint32_vector() { return ArrayVector(uint32_array); @@ -262,30 +262,30 @@ class ValueHelper { } static constexpr uint64_t uint64_array[] = { - 0x00000000, 0x00000001, 0xffffffff, 0x1b09788b, 0x04c5fce8, 0xcc0de5bf, + 0x00000000, 0x00000001, 0xFFFFFFFF, 0x1B09788B, 0x04C5FCE8, 0xCC0DE5BF, 0x00000002, 0x00000003, 0x00000004, 0x00000005, 0x00000008, 0x00000009, - 0xffffffffffffffff, 0xfffffffffffffffe, 0xfffffffffffffffd, - 0x0000000000000000, 0x0000000100000000, 0xffffffff00000000, - 0x1b09788b00000000, 0x04c5fce800000000, 0xcc0de5bf00000000, + 0xFFFFFFFFFFFFFFFF, 0xFFFFFFFFFFFFFFFE, 0xFFFFFFFFFFFFFFFD, + 0x0000000000000000, 0x0000000100000000, 0xFFFFFFFF00000000, + 0x1B09788B00000000, 0x04C5FCE800000000, 0xCC0DE5BF00000000, 0x0000000200000000, 0x0000000300000000, 0x0000000400000000, 0x0000000500000000, 0x0000000800000000, 0x0000000900000000, - 0x273a798e187937a3, 0xece3af835495a16b, 0x0b668ecc11223344, 0x0000009e, - 0x00000043, 0x0000af73, 0x0000116b, 0x00658ecc, 0x002b3b4c, 0x88776655, - 0x70000000, 0x07200000, 0x7fffffff, 0x56123761, 0x7fffff00, - 0x761c4761eeeeeeee, 0x80000000eeeeeeee, 0x88888888dddddddd, - 0xa0000000dddddddd, 0xddddddddaaaaaaaa, 0xe0000000aaaaaaaa, - 0xeeeeeeeeeeeeeeee, 0xfffffffdeeeeeeee, 0xf0000000dddddddd, - 0x007fffffdddddddd, 0x003fffffaaaaaaaa, 0x001fffffaaaaaaaa, 0x000fffff, - 0x0007ffff, 0x0003ffff, 0x0001ffff, 0x0000ffff, 0x00007fff, 0x00003fff, - 0x00001fff, 0x00000fff, 0x000007ff, 0x000003ff, 0x000001ff, - 0x00003fffffffffff, 0x00001fffffffffff, 0x00000fffffffffff, - 0x000007ffffffffff, 0x000003ffffffffff, 0x000001ffffffffff, + 0x273A798E187937A3, 0xECE3AF835495A16B, 0x0B668ECC11223344, 0x0000009E, + 0x00000043, 0x0000AF73, 0x0000116B, 0x00658ECC, 0x002B3B4C, 0x88776655, + 0x70000000, 0x07200000, 0x7FFFFFFF, 0x56123761, 0x7FFFFF00, + 0x761C4761EEEEEEEE, 0x80000000EEEEEEEE, 0x88888888DDDDDDDD, + 0xA0000000DDDDDDDD, 0xDDDDDDDDAAAAAAAA, 0xE0000000AAAAAAAA, + 0xEEEEEEEEEEEEEEEE, 0xFFFFFFFDEEEEEEEE, 0xF0000000DDDDDDDD, + 0x007FFFFFDDDDDDDD, 0x003FFFFFAAAAAAAA, 0x001FFFFFAAAAAAAA, 0x000FFFFF, + 0x0007FFFF, 0x0003FFFF, 0x0001FFFF, 0x0000FFFF, 0x00007FFF, 0x00003FFF, + 0x00001FFF, 0x00000FFF, 0x000007FF, 0x000003FF, 0x000001FF, + 0x00003FFFFFFFFFFF, 0x00001FFFFFFFFFFF, 0x00000FFFFFFFFFFF, + 0x000007FFFFFFFFFF, 0x000003FFFFFFFFFF, 0x000001FFFFFFFFFF, 0x8000008000000000, 0x8000008000000001, 0x8000000000000400, 0x8000000000000401, 0x0000000000000020, // Bit pattern of a quiet NaN and signaling NaN, with or without // additional payload. - 0x7ff8000000000000, 0x7ff0000000000000, 0x7ff8123456789abc, - 0x7ff7654321fedcba}; + 0x7FF8000000000000, 0x7FF0000000000000, 0x7FF8123456789ABC, + 0x7FF7654321FEDCBA}; static constexpr Vector<const uint64_t> uint64_vector() { return ArrayVector(uint64_array); diff --git a/deps/v8/test/cctest/heap/heap-tester.h b/deps/v8/test/cctest/heap/heap-tester.h index 692514d854..b7cab9e16f 100644 --- a/deps/v8/test/cctest/heap/heap-tester.h +++ b/deps/v8/test/cctest/heap/heap-tester.h @@ -41,6 +41,7 @@ V(Regress670675) \ V(Regress5831) \ V(Regress777177) \ + V(Regress791582) \ V(Regress779503) \ V(RegressMissingWriteBarrierInAllocate) \ V(WriteBarriersInCopyJSObject) diff --git a/deps/v8/test/cctest/heap/heap-utils.cc b/deps/v8/test/cctest/heap/heap-utils.cc index 30bbde2c76..433097e359 100644 --- a/deps/v8/test/cctest/heap/heap-utils.cc +++ b/deps/v8/test/cctest/heap/heap-utils.cc @@ -20,7 +20,7 @@ void SealCurrentObjects(Heap* heap) { heap->CollectAllGarbage(Heap::kFinalizeIncrementalMarkingMask, GarbageCollectionReason::kTesting); heap->mark_compact_collector()->EnsureSweepingCompleted(); - heap->old_space()->EmptyAllocationInfo(); + heap->old_space()->FreeLinearAllocationArea(); for (Page* page : *heap->old_space()) { page->MarkNeverAllocateForTesting(); } @@ -68,11 +68,10 @@ std::vector<Handle<FixedArray>> CreatePadding(Heap* heap, int padding_size, int length; int free_memory = padding_size; if (tenure == i::TENURED) { - heap->old_space()->EmptyAllocationInfo(); + heap->old_space()->FreeLinearAllocationArea(); int overall_free_memory = static_cast<int>(heap->old_space()->Available()); CHECK(padding_size <= overall_free_memory || overall_free_memory == 0); } else { - heap->new_space()->DisableInlineAllocationSteps(); int overall_free_memory = static_cast<int>(*heap->new_space()->allocation_limit_address() - *heap->new_space()->allocation_top_address()); @@ -105,7 +104,7 @@ std::vector<Handle<FixedArray>> CreatePadding(Heap* heap, int padding_size, void AllocateAllButNBytes(v8::internal::NewSpace* space, int extra_bytes, std::vector<Handle<FixedArray>>* out_handles) { - space->DisableInlineAllocationSteps(); + PauseAllocationObserversScope pause_observers(space->heap()); int space_remaining = static_cast<int>(*space->allocation_limit_address() - *space->allocation_top_address()); CHECK(space_remaining >= extra_bytes); @@ -124,7 +123,7 @@ void FillCurrentPage(v8::internal::NewSpace* space, bool FillUpOnePage(v8::internal::NewSpace* space, std::vector<Handle<FixedArray>>* out_handles) { - space->DisableInlineAllocationSteps(); + PauseAllocationObserversScope pause_observers(space->heap()); int space_remaining = static_cast<int>(*space->allocation_limit_address() - *space->allocation_top_address()); if (space_remaining == 0) return false; @@ -176,12 +175,12 @@ void SimulateFullSpace(v8::internal::PagedSpace* space) { if (collector->sweeping_in_progress()) { collector->EnsureSweepingCompleted(); } - space->EmptyAllocationInfo(); + space->FreeLinearAllocationArea(); space->ResetFreeList(); } void AbandonCurrentlyFreeMemory(PagedSpace* space) { - space->EmptyAllocationInfo(); + space->FreeLinearAllocationArea(); for (Page* page : *space) { page->MarkNeverAllocateForTesting(); } @@ -205,7 +204,7 @@ void ForceEvacuationCandidate(Page* page) { int remaining = static_cast<int>(limit - top); space->heap()->CreateFillerObjectAt(top, remaining, ClearRecordedSlots::kNo); - space->EmptyAllocationInfo(); + space->FreeLinearAllocationArea(); } } diff --git a/deps/v8/test/cctest/heap/test-embedder-tracing.cc b/deps/v8/test/cctest/heap/test-embedder-tracing.cc new file mode 100644 index 0000000000..82e4e3ddf8 --- /dev/null +++ b/deps/v8/test/cctest/heap/test-embedder-tracing.cc @@ -0,0 +1,197 @@ +// Copyright 2017 the V8 project authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "include/v8.h" +#include "src/api.h" +#include "src/objects-inl.h" +#include "src/objects/module.h" +#include "src/objects/script.h" +#include "src/objects/shared-function-info.h" +#include "test/cctest/cctest.h" + +namespace v8 { +namespace internal { +namespace heap { + +namespace { + +v8::Local<v8::Object> ConstructTraceableJSApiObject( + v8::Local<v8::Context> context, void* first_field, void* second_field) { + v8::EscapableHandleScope scope(context->GetIsolate()); + v8::Local<v8::FunctionTemplate> function_t = + v8::FunctionTemplate::New(context->GetIsolate()); + v8::Local<v8::ObjectTemplate> instance_t = function_t->InstanceTemplate(); + instance_t->SetInternalFieldCount(2); + v8::Local<v8::Function> function = + function_t->GetFunction(context).ToLocalChecked(); + v8::Local<v8::Object> instance = + function->NewInstance(context).ToLocalChecked(); + instance->SetAlignedPointerInInternalField(0, first_field); + instance->SetAlignedPointerInInternalField(1, second_field); + CHECK(!instance.IsEmpty()); + i::Handle<i::JSReceiver> js_obj = v8::Utils::OpenHandle(*instance); + CHECK_EQ(i::JS_API_OBJECT_TYPE, js_obj->map()->instance_type()); + return scope.Escape(instance); +} + +class TestEmbedderHeapTracer final : public v8::EmbedderHeapTracer { + public: + explicit TestEmbedderHeapTracer(v8::Isolate* isolate) : isolate_(isolate) {} + + void RegisterV8References( + const std::vector<std::pair<void*, void*>>& embedder_fields) final { + registered_from_v8_.insert(registered_from_v8_.end(), + embedder_fields.begin(), embedder_fields.end()); + } + + void AddReferenceForTracing(v8::Persistent<v8::Object>* persistent) { + to_register_with_v8_.push_back(persistent); + } + + bool AdvanceTracing(double deadline_in_ms, + AdvanceTracingActions actions) final { + for (auto persistent : to_register_with_v8_) { + persistent->RegisterExternalReference(isolate_); + } + to_register_with_v8_.clear(); + return false; + } + + void TracePrologue() final {} + void TraceEpilogue() final {} + void AbortTracing() final {} + void EnterFinalPause() final {} + + bool IsRegisteredFromV8(void* first_field) const { + for (auto pair : registered_from_v8_) { + if (pair.first == first_field) return true; + } + return false; + } + + private: + v8::Isolate* const isolate_; + std::vector<std::pair<void*, void*>> registered_from_v8_; + std::vector<v8::Persistent<v8::Object>*> to_register_with_v8_; +}; + +} // namespace + +TEST(V8RegisteringEmbedderReference) { + // Tests that wrappers are properly registered with the embedder heap + // tracer. + ManualGCScope manual_gc; + CcTest::InitializeVM(); + v8::Isolate* isolate = CcTest::isolate(); + TestEmbedderHeapTracer tracer(isolate); + isolate->SetEmbedderHeapTracer(&tracer); + v8::HandleScope scope(isolate); + v8::Local<v8::Context> context = v8::Context::New(isolate); + v8::Context::Scope context_scope(context); + + void* first_field = reinterpret_cast<void*>(0x2); + v8::Local<v8::Object> api_object = + ConstructTraceableJSApiObject(context, first_field, nullptr); + CHECK(!api_object.IsEmpty()); + CcTest::CollectGarbage(i::OLD_SPACE); + CHECK(tracer.IsRegisteredFromV8(first_field)); +} + +TEST(EmbedderRegisteringV8Reference) { + // Tests that references that are registered by the embedder heap tracer are + // considered live by V8. + ManualGCScope manual_gc; + CcTest::InitializeVM(); + v8::Isolate* isolate = CcTest::isolate(); + TestEmbedderHeapTracer tracer(isolate); + isolate->SetEmbedderHeapTracer(&tracer); + v8::HandleScope scope(isolate); + v8::Local<v8::Context> context = v8::Context::New(isolate); + v8::Context::Scope context_scope(context); + + v8::Persistent<v8::Object> g; + { + v8::HandleScope inner_scope(isolate); + v8::Local<v8::Object> o = + v8::Local<v8::Object>::New(isolate, v8::Object::New(isolate)); + g.Reset(isolate, o); + g.SetWeak(); + } + tracer.AddReferenceForTracing(&g); + CcTest::CollectGarbage(i::OLD_SPACE); + CHECK(!g.IsEmpty()); +} + +namespace { + +void ResurrectingFinalizer( + const v8::WeakCallbackInfo<v8::Global<v8::Object>>& data) { + data.GetParameter()->ClearWeak(); +} + +} // namespace + +TEST(TracingInRevivedSubgraph) { + // Tests that wrappers are traced when they are contained with in a subgraph + // that is revived by a finalizer. + ManualGCScope manual_gc; + CcTest::InitializeVM(); + v8::Isolate* isolate = CcTest::isolate(); + TestEmbedderHeapTracer tracer(isolate); + isolate->SetEmbedderHeapTracer(&tracer); + v8::HandleScope scope(isolate); + v8::Local<v8::Context> context = v8::Context::New(isolate); + v8::Context::Scope context_scope(context); + + v8::Global<v8::Object> g; + void* first_field = reinterpret_cast<void*>(0x4); + { + v8::HandleScope inner_scope(isolate); + v8::Local<v8::Object> api_object = + ConstructTraceableJSApiObject(context, first_field, nullptr); + CHECK(!api_object.IsEmpty()); + v8::Local<v8::Object> o = + v8::Local<v8::Object>::New(isolate, v8::Object::New(isolate)); + o->Set(context, v8_str("link"), api_object).FromJust(); + g.Reset(isolate, o); + g.SetWeak(&g, ResurrectingFinalizer, v8::WeakCallbackType::kFinalizer); + } + CcTest::CollectGarbage(i::OLD_SPACE); + CHECK(tracer.IsRegisteredFromV8(first_field)); +} + +TEST(TracingInEphemerons) { + // Tests that wrappers that are part of ephemerons are traced. + ManualGCScope manual_gc; + CcTest::InitializeVM(); + v8::Isolate* isolate = CcTest::isolate(); + TestEmbedderHeapTracer tracer(isolate); + isolate->SetEmbedderHeapTracer(&tracer); + v8::HandleScope scope(isolate); + v8::Local<v8::Context> context = v8::Context::New(isolate); + v8::Context::Scope context_scope(context); + + v8::Local<v8::Object> key = + v8::Local<v8::Object>::New(isolate, v8::Object::New(isolate)); + void* first_field = reinterpret_cast<void*>(0x8); + i::Isolate* i_isolate = reinterpret_cast<i::Isolate*>(isolate); + Handle<JSWeakMap> weak_map = i_isolate->factory()->NewJSWeakMap(); + { + v8::HandleScope inner_scope(isolate); + v8::Local<v8::Object> api_object = + ConstructTraceableJSApiObject(context, first_field, nullptr); + CHECK(!api_object.IsEmpty()); + Handle<JSObject> js_key = + handle(JSObject::cast(*v8::Utils::OpenHandle(*key))); + Handle<JSReceiver> js_api_object = v8::Utils::OpenHandle(*api_object); + int32_t hash = js_key->GetOrCreateHash(i_isolate)->value(); + JSWeakCollection::Set(weak_map, js_key, js_api_object, hash); + } + CcTest::CollectGarbage(i::OLD_SPACE); + CHECK(tracer.IsRegisteredFromV8(first_field)); +} + +} // namespace heap +} // namespace internal +} // namespace v8 diff --git a/deps/v8/test/cctest/heap/test-heap.cc b/deps/v8/test/cctest/heap/test-heap.cc index d70c1e502c..d14d39b9ee 100644 --- a/deps/v8/test/cctest/heap/test-heap.cc +++ b/deps/v8/test/cctest/heap/test-heap.cc @@ -751,7 +751,7 @@ TEST(DeleteWeakGlobalHandle) { TEST(BytecodeArray) { if (FLAG_never_compact) return; - static const uint8_t kRawBytes[] = {0xc3, 0x7e, 0xa5, 0x5a}; + static const uint8_t kRawBytes[] = {0xC3, 0x7E, 0xA5, 0x5A}; static const int kRawBytesSize = sizeof(kRawBytes); static const int kFrameSize = 32; static const int kParameterCount = 2; @@ -810,7 +810,7 @@ TEST(BytecodeArray) { } TEST(BytecodeArrayAging) { - static const uint8_t kRawBytes[] = {0xc3, 0x7e, 0xa5, 0x5a}; + static const uint8_t kRawBytes[] = {0xC3, 0x7E, 0xA5, 0x5A}; static const int kRawBytesSize = sizeof(kRawBytes); static const int kFrameSize = 32; static const int kParameterCount = 2; @@ -1176,7 +1176,7 @@ TEST(StringAllocation) { Isolate* isolate = CcTest::i_isolate(); Factory* factory = isolate->factory(); - const unsigned char chars[] = { 0xe5, 0xa4, 0xa7 }; + const unsigned char chars[] = {0xE5, 0xA4, 0xA7}; for (int length = 0; length < 100; length++) { v8::HandleScope scope(CcTest::isolate()); char* non_one_byte = NewArray<char>(3 * length + 1); @@ -1704,7 +1704,7 @@ static Address AlignOldSpace(AllocationAlignment alignment, int offset) { } Address top = *top_addr; // Now force the remaining allocation onto the free list. - CcTest::heap()->old_space()->EmptyAllocationInfo(); + CcTest::heap()->old_space()->FreeLinearAllocationArea(); return top; } @@ -3943,7 +3943,8 @@ static Handle<Code> DummyOptimizedCode(Isolate* isolate) { v8::internal::CodeObjectRequired::kYes); CodeDesc desc; masm.Push(isolate->factory()->undefined_value()); - masm.Drop(1); + masm.Push(isolate->factory()->undefined_value()); + masm.Drop(2); masm.GetCode(isolate, &desc); Handle<Object> undefined(isolate->heap()->undefined_value(), isolate); Handle<Code> code = @@ -5175,7 +5176,7 @@ HEAP_TEST(Regress589413) { // Make sure the byte arrays will be promoted on the next GC. CcTest::CollectGarbage(NEW_SPACE); // This number is close to large free list category threshold. - const int N = 0x3eee; + const int N = 0x3EEE; { std::vector<FixedArray*> arrays; std::set<Page*> pages; @@ -5676,9 +5677,8 @@ TEST(UncommitUnusedLargeObjectMemory) { CcTest::CollectAllGarbage(); CHECK(chunk->CommittedPhysicalMemory() < committed_memory_before); - size_t shrinked_size = - RoundUp((array->address() - chunk->address()) + array->Size(), - base::OS::CommitPageSize()); + size_t shrinked_size = RoundUp( + (array->address() - chunk->address()) + array->Size(), CommitPageSize()); CHECK_EQ(shrinked_size, chunk->CommittedPhysicalMemory()); } diff --git a/deps/v8/test/cctest/heap/test-incremental-marking.cc b/deps/v8/test/cctest/heap/test-incremental-marking.cc index a28f9a1ad7..0548ba4ba4 100644 --- a/deps/v8/test/cctest/heap/test-incremental-marking.cc +++ b/deps/v8/test/cctest/heap/test-incremental-marking.cc @@ -33,11 +33,14 @@ namespace heap { class MockPlatform : public TestPlatform { public: - MockPlatform() : task_(nullptr) { + MockPlatform() : task_(nullptr), old_platform_(i::V8::GetCurrentPlatform()) { // Now that it's completely constructed, make this the current platform. i::V8::SetPlatformForTesting(this); } - virtual ~MockPlatform() { delete task_; } + virtual ~MockPlatform() { + delete task_; + i::V8::SetPlatformForTesting(old_platform_); + } void CallOnForegroundThread(v8::Isolate* isolate, Task* task) override { task_ = task; @@ -56,6 +59,7 @@ class MockPlatform : public TestPlatform { private: Task* task_; + v8::Platform* old_platform_; }; TEST(IncrementalMarkingUsingTasks) { diff --git a/deps/v8/test/cctest/heap/test-mark-compact.cc b/deps/v8/test/cctest/heap/test-mark-compact.cc index e7f3e93160..2eb5c567c6 100644 --- a/deps/v8/test/cctest/heap/test-mark-compact.cc +++ b/deps/v8/test/cctest/heap/test-mark-compact.cc @@ -331,7 +331,7 @@ TEST(Regress5829) { array->set_length(9); heap->CreateFillerObjectAt(old_end - kPointerSize, kPointerSize, ClearRecordedSlots::kNo); - heap->old_space()->EmptyAllocationInfo(); + heap->old_space()->FreeLinearAllocationArea(); Page* page = Page::FromAddress(array->address()); IncrementalMarking::MarkingState* marking_state = marking->marking_state(); for (auto object_and_size : diff --git a/deps/v8/test/cctest/heap/test-spaces.cc b/deps/v8/test/cctest/heap/test-spaces.cc index d9deb10475..bec9f978e8 100644 --- a/deps/v8/test/cctest/heap/test-spaces.cc +++ b/deps/v8/test/cctest/heap/test-spaces.cc @@ -102,13 +102,12 @@ static void VerifyMemoryChunk(Isolate* isolate, reserve_area_size, commit_area_size, executable, nullptr); size_t alignment = code_range != nullptr && code_range->valid() ? MemoryChunk::kAlignment - : base::OS::CommitPageSize(); + : CommitPageSize(); size_t reserved_size = ((executable == EXECUTABLE)) ? RoundUp(header_size + guard_size + reserve_area_size + guard_size, alignment) - : RoundUp(header_size + reserve_area_size, - base::OS::CommitPageSize()); + : RoundUp(header_size + reserve_area_size, CommitPageSize()); CHECK(memory_chunk->size() == reserved_size); CHECK(memory_chunk->area_start() < memory_chunk->address() + memory_chunk->size()); @@ -231,7 +230,6 @@ TEST(MemoryAllocator) { NOT_EXECUTABLE); first_page->InsertAfter(faked_space.anchor()->prev_page()); - CHECK(Page::IsValid(first_page)); CHECK(first_page->next_page() == faked_space.anchor()); total_pages++; @@ -243,7 +241,6 @@ TEST(MemoryAllocator) { Page* other = memory_allocator->AllocatePage( faked_space.AreaSize(), static_cast<PagedSpace*>(&faked_space), NOT_EXECUTABLE); - CHECK(Page::IsValid(other)); total_pages++; other->InsertAfter(first_page); int page_count = 0; @@ -254,7 +251,7 @@ TEST(MemoryAllocator) { CHECK(total_pages == page_count); Page* second_page = first_page->next_page(); - CHECK(Page::IsValid(second_page)); + CHECK_NOT_NULL(second_page); // OldSpace's destructor will tear down the space and free up all pages. } @@ -442,7 +439,7 @@ class Observer : public AllocationObserver { explicit Observer(intptr_t step_size) : AllocationObserver(step_size), count_(0) {} - void Step(int bytes_allocated, Address, size_t) override { count_++; } + void Step(int bytes_allocated, Address addr, size_t) override { count_++; } int count() const { return count_; } @@ -621,6 +618,47 @@ HEAP_TEST(Regress777177) { old_space->RemoveAllocationObserver(&observer); } +HEAP_TEST(Regress791582) { + CcTest::InitializeVM(); + Isolate* isolate = CcTest::i_isolate(); + Heap* heap = isolate->heap(); + HandleScope scope(isolate); + NewSpace* new_space = heap->new_space(); + if (new_space->TotalCapacity() < new_space->MaximumCapacity()) { + new_space->Grow(); + } + + int until_page_end = static_cast<int>(new_space->limit() - new_space->top()); + + if (until_page_end % kPointerSize != 0) { + // The test works if the size of allocation area size is a multiple of + // pointer size. This is usually the case unless some allocation observer + // is already active (e.g. incremental marking observer). + return; + } + + Observer observer(128); + new_space->AddAllocationObserver(&observer); + + { + AllocationResult result = + new_space->AllocateRaw(until_page_end, kWordAligned); + HeapObject* obj = result.ToObjectChecked(); + heap->CreateFillerObjectAt(obj->address(), until_page_end, + ClearRecordedSlots::kNo); + // Simulate allocation folding moving the top pointer back. + *new_space->allocation_top_address() = obj->address(); + } + + { + // This triggers assert in crbug.com/791582 + AllocationResult result = new_space->AllocateRaw(256, kWordAligned); + HeapObject* obj = result.ToObjectChecked(); + heap->CreateFillerObjectAt(obj->address(), 256, ClearRecordedSlots::kNo); + } + new_space->RemoveAllocationObserver(&observer); +} + TEST(ShrinkPageToHighWaterMarkFreeSpaceEnd) { FLAG_stress_incremental_marking = false; CcTest::InitializeVM(); @@ -636,8 +674,8 @@ TEST(ShrinkPageToHighWaterMarkFreeSpaceEnd) { // Reset space so high water mark is consistent. PagedSpace* old_space = CcTest::heap()->old_space(); + old_space->FreeLinearAllocationArea(); old_space->ResetFreeList(); - old_space->EmptyAllocationInfo(); HeapObject* filler = HeapObject::FromAddress(array->address() + array->Size()); @@ -645,7 +683,7 @@ TEST(ShrinkPageToHighWaterMarkFreeSpaceEnd) { size_t shrunk = old_space->ShrinkPageToHighWaterMark(page); size_t should_have_shrunk = RoundDown(static_cast<size_t>(Page::kAllocatableMemory - array->Size()), - base::OS::CommitPageSize()); + CommitPageSize()); CHECK_EQ(should_have_shrunk, shrunk); } @@ -665,7 +703,7 @@ TEST(ShrinkPageToHighWaterMarkNoFiller) { // Reset space so high water mark and fillers are consistent. PagedSpace* old_space = CcTest::heap()->old_space(); old_space->ResetFreeList(); - old_space->EmptyAllocationInfo(); + old_space->FreeLinearAllocationArea(); size_t shrunk = old_space->ShrinkPageToHighWaterMark(page); CHECK_EQ(0u, shrunk); @@ -687,8 +725,8 @@ TEST(ShrinkPageToHighWaterMarkOneWordFiller) { // Reset space so high water mark and fillers are consistent. PagedSpace* old_space = CcTest::heap()->old_space(); + old_space->FreeLinearAllocationArea(); old_space->ResetFreeList(); - old_space->EmptyAllocationInfo(); HeapObject* filler = HeapObject::FromAddress(array->address() + array->Size()); @@ -714,8 +752,8 @@ TEST(ShrinkPageToHighWaterMarkTwoWordFiller) { // Reset space so high water mark and fillers are consistent. PagedSpace* old_space = CcTest::heap()->old_space(); + old_space->FreeLinearAllocationArea(); old_space->ResetFreeList(); - old_space->EmptyAllocationInfo(); HeapObject* filler = HeapObject::FromAddress(array->address() + array->Size()); diff --git a/deps/v8/test/cctest/interpreter/bytecode_expectations/AsyncGenerators.golden b/deps/v8/test/cctest/interpreter/bytecode_expectations/AsyncGenerators.golden index 312316c9b7..50d084fbc1 100644 --- a/deps/v8/test/cctest/interpreter/bytecode_expectations/AsyncGenerators.golden +++ b/deps/v8/test/cctest/interpreter/bytecode_expectations/AsyncGenerators.golden @@ -14,7 +14,7 @@ snippet: " " frame size: 9 parameter count: 1 -bytecode array length: 230 +bytecode array length: 216 bytecodes: [ B(Ldar), R(0), B(JumpIfUndefined), U8(18), @@ -23,7 +23,7 @@ bytecodes: [ B(RestoreGeneratorState), R(0), B(Star), R(1), B(SwitchOnSmiNoFeedback), U8(0), U8(2), I8(0), - B(Abort), U8(42), + B(Abort), U8(15), B(LdaSmi), I8(-2), B(Star), R(1), B(Mov), R(closure), R(2), @@ -36,10 +36,7 @@ bytecodes: [ B(Ldar), R(0), /* 17 E> */ B(SuspendGenerator), R(0), R(0), U8(6), U8(0), /* 22 S> */ B(Return), - B(RestoreGeneratorRegisters), R(0), R(0), U8(6), - B(LdaSmi), I8(-2), - B(Star), R(1), - B(InvokeIntrinsic), U8(Runtime::k_GeneratorGetInputOrDebugPos), R(0), U8(1), + B(ResumeGenerator), R(0), R(1), R(0), U8(6), B(Star), R(6), B(InvokeIntrinsic), U8(Runtime::k_GeneratorGetResumeMode), R(0), U8(1), B(SwitchOnSmiNoFeedback), U8(2), U8(2), I8(0), @@ -48,17 +45,14 @@ bytecodes: [ B(LdaZero), B(Star), R(2), B(Mov), R(6), R(3), - B(Jump), U8(107), + B(Jump), U8(100), B(LdaUndefined), B(Star), R(7), B(Mov), R(0), R(6), B(CallJSRuntime), U8(%async_generator_await_uncaught), R(6), U8(2), B(SuspendGenerator), R(0), R(0), U8(6), U8(1), /* 22 S> */ B(Return), - B(RestoreGeneratorRegisters), R(0), R(0), U8(6), - B(LdaSmi), I8(-2), - B(Star), R(1), - B(InvokeIntrinsic), U8(Runtime::k_GeneratorGetInputOrDebugPos), R(0), U8(1), + B(ResumeGenerator), R(0), R(1), R(0), U8(6), B(Star), R(6), B(InvokeIntrinsic), U8(Runtime::k_GeneratorGetResumeMode), R(0), U8(1), B(Star), R(7), @@ -120,7 +114,7 @@ bytecodes: [ ] constant pool: [ Smi [37], - Smi [86], + Smi [79], Smi [15], Smi [7], ONE_BYTE_INTERNALIZED_STRING_TYPE [".catch"], @@ -130,8 +124,8 @@ constant pool: [ Smi [23], ] handlers: [ - [40, 175, 183], - [43, 136, 138], + [40, 161, 169], + [43, 122, 124], ] --- @@ -141,7 +135,7 @@ snippet: " " frame size: 9 parameter count: 1 -bytecode array length: 283 +bytecode array length: 262 bytecodes: [ B(Ldar), R(0), B(JumpIfUndefined), U8(18), @@ -150,7 +144,7 @@ bytecodes: [ B(RestoreGeneratorState), R(0), B(Star), R(1), B(SwitchOnSmiNoFeedback), U8(0), U8(3), I8(0), - B(Abort), U8(42), + B(Abort), U8(15), B(LdaSmi), I8(-2), B(Star), R(1), B(Mov), R(closure), R(2), @@ -163,10 +157,7 @@ bytecodes: [ B(Ldar), R(0), /* 17 E> */ B(SuspendGenerator), R(0), R(0), U8(6), U8(0), /* 31 S> */ B(Return), - B(RestoreGeneratorRegisters), R(0), R(0), U8(6), - B(LdaSmi), I8(-2), - B(Star), R(1), - B(InvokeIntrinsic), U8(Runtime::k_GeneratorGetInputOrDebugPos), R(0), U8(1), + B(ResumeGenerator), R(0), R(1), R(0), U8(6), B(Star), R(6), B(InvokeIntrinsic), U8(Runtime::k_GeneratorGetResumeMode), R(0), U8(1), B(SwitchOnSmiNoFeedback), U8(3), U8(2), I8(0), @@ -175,7 +166,7 @@ bytecodes: [ B(LdaZero), B(Star), R(2), B(Mov), R(6), R(3), - B(Jump), U8(160), + B(Jump), U8(146), /* 22 S> */ B(LdaSmi), I8(42), B(Star), R(7), B(LdaFalse), @@ -184,10 +175,7 @@ bytecodes: [ B(InvokeIntrinsic), U8(Runtime::k_AsyncGeneratorYield), R(6), U8(3), B(SuspendGenerator), R(0), R(0), U8(6), U8(1), /* 31 S> */ B(Return), - B(RestoreGeneratorRegisters), R(0), R(0), U8(6), - B(LdaSmi), I8(-2), - B(Star), R(1), - B(InvokeIntrinsic), U8(Runtime::k_GeneratorGetInputOrDebugPos), R(0), U8(1), + B(ResumeGenerator), R(0), R(1), R(0), U8(6), B(Star), R(6), B(InvokeIntrinsic), U8(Runtime::k_GeneratorGetResumeMode), R(0), U8(1), B(SwitchOnSmiNoFeedback), U8(5), U8(2), I8(0), @@ -196,17 +184,14 @@ bytecodes: [ B(LdaZero), B(Star), R(2), B(Mov), R(6), R(3), - B(Jump), U8(107), + B(Jump), U8(100), B(LdaUndefined), B(Star), R(7), B(Mov), R(0), R(6), B(CallJSRuntime), U8(%async_generator_await_uncaught), R(6), U8(2), B(SuspendGenerator), R(0), R(0), U8(6), U8(2), /* 31 S> */ B(Return), - B(RestoreGeneratorRegisters), R(0), R(0), U8(6), - B(LdaSmi), I8(-2), - B(Star), R(1), - B(InvokeIntrinsic), U8(Runtime::k_GeneratorGetInputOrDebugPos), R(0), U8(1), + B(ResumeGenerator), R(0), R(1), R(0), U8(6), B(Star), R(6), B(InvokeIntrinsic), U8(Runtime::k_GeneratorGetResumeMode), R(0), U8(1), B(Star), R(7), @@ -268,8 +253,8 @@ bytecodes: [ ] constant pool: [ Smi [37], - Smi [90], - Smi [139], + Smi [83], + Smi [125], Smi [15], Smi [7], Smi [15], @@ -281,8 +266,8 @@ constant pool: [ Smi [23], ] handlers: [ - [40, 228, 236], - [43, 189, 191], + [40, 207, 215], + [43, 168, 170], ] --- @@ -290,263 +275,248 @@ snippet: " async function* f() { for (let x of [42]) yield x } f(); " -frame size: 22 +frame size: 23 parameter count: 1 -bytecode array length: 571 +bytecode array length: 536 bytecodes: [ B(Ldar), R(2), B(JumpIfUndefined), U8(18), B(InvokeIntrinsic), U8(Runtime::k_GeneratorGetContext), R(2), U8(1), - B(PushContext), R(11), + B(PushContext), R(12), B(RestoreGeneratorState), R(2), - B(Star), R(10), + B(Star), R(11), B(SwitchOnSmiNoFeedback), U8(0), U8(3), I8(0), - B(Abort), U8(42), + B(Abort), U8(15), B(LdaSmi), I8(-2), - B(Star), R(10), - 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(11), + 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), /* 17 E> */ B(StackCheck), - B(Mov), R(context), R(13), B(Mov), R(context), R(14), + B(Mov), R(context), R(15), B(Ldar), R(2), - /* 17 E> */ B(SuspendGenerator), R(2), R(0), U8(15), U8(0), + /* 17 E> */ B(SuspendGenerator), R(2), R(0), U8(16), U8(0), /* 50 S> */ B(Return), - B(RestoreGeneratorRegisters), R(2), R(0), U8(15), - B(LdaSmi), I8(-2), - B(Star), R(10), - B(InvokeIntrinsic), U8(Runtime::k_GeneratorGetInputOrDebugPos), R(2), U8(1), - B(Star), R(15), + B(ResumeGenerator), R(2), R(11), R(0), U8(16), + B(Star), R(16), B(InvokeIntrinsic), U8(Runtime::k_GeneratorGetResumeMode), R(2), U8(1), B(SwitchOnSmiNoFeedback), U8(3), U8(2), I8(0), - B(Ldar), R(15), + B(Ldar), R(16), /* 17 E> */ B(Throw), B(LdaZero), - B(Star), R(11), - B(Mov), R(15), R(12), - B(JumpConstant), U8(21), + B(Star), R(12), + B(Mov), R(16), R(13), + B(JumpConstant), U8(20), B(LdaZero), - B(Star), R(6), - B(Mov), R(context), R(17), + B(Star), R(7), B(Mov), R(context), R(18), + B(Mov), R(context), R(19), /* 36 S> */ B(CreateArrayLiteral), U8(5), U8(0), U8(37), - B(Star), R(19), - B(LdaNamedProperty), R(19), U8(6), U8(1), B(Star), R(20), - B(CallProperty0), R(20), R(19), U8(3), + B(LdaNamedProperty), R(20), U8(6), U8(1), + B(Star), R(21), + B(CallProperty0), R(21), R(20), U8(3), B(JumpIfJSReceiver), U8(7), B(CallRuntime), U16(Runtime::kThrowSymbolIteratorInvalid), R(0), U8(0), B(Star), R(4), - B(Ldar), R(10), - B(SwitchOnSmiNoFeedback), U8(7), U8(1), I8(1), + /* 36 E> */ B(LdaNamedProperty), R(4), U8(7), U8(5), + B(Star), R(5), + B(Ldar), R(11), + B(SwitchOnSmiNoFeedback), U8(8), U8(1), I8(1), B(LdaSmi), I8(-2), - /* 36 E> */ B(TestEqualStrictNoFeedback), R(10), + B(TestEqualStrictNoFeedback), R(11), B(JumpIfTrue), U8(4), - B(Abort), U8(42), - /* 31 S> */ B(LdaNamedProperty), R(4), U8(8), U8(5), - B(Star), R(19), - B(CallProperty0), R(19), R(4), U8(7), - B(Star), R(5), - /* 31 E> */ B(InvokeIntrinsic), U8(Runtime::k_IsJSReceiver), R(5), U8(1), + B(Abort), U8(15), + /* 31 S> */ B(CallProperty0), R(5), R(4), U8(7), + B(Star), R(6), + /* 31 E> */ B(InvokeIntrinsic), U8(Runtime::k_IsJSReceiver), R(6), U8(1), B(ToBooleanLogicalNot), B(JumpIfFalse), U8(7), - B(CallRuntime), U16(Runtime::kThrowIteratorResultNotAnObject), R(5), U8(1), - B(LdaNamedProperty), R(5), U8(9), U8(9), - B(JumpIfToBooleanTrue), U8(77), - B(LdaNamedProperty), R(5), U8(10), U8(11), - B(Star), R(7), + B(CallRuntime), U16(Runtime::kThrowIteratorResultNotAnObject), R(6), U8(1), + B(LdaNamedProperty), R(6), U8(9), U8(9), + B(JumpIfToBooleanTrue), U8(70), + B(LdaNamedProperty), R(6), U8(10), U8(11), + B(Star), R(8), B(LdaSmi), I8(2), - B(Star), R(6), - B(Mov), R(7), R(3), + B(Star), R(7), + B(Mov), R(8), R(3), /* 22 E> */ B(StackCheck), B(Mov), R(3), R(0), /* 42 S> */ B(LdaFalse), - B(Star), R(21), - B(Mov), R(2), R(19), - B(Mov), R(0), R(20), - B(InvokeIntrinsic), U8(Runtime::k_AsyncGeneratorYield), R(19), U8(3), - B(SuspendGenerator), R(2), R(0), U8(19), U8(1), + B(Star), R(22), + B(Mov), R(2), R(20), + B(Mov), R(0), R(21), + B(InvokeIntrinsic), U8(Runtime::k_AsyncGeneratorYield), R(20), U8(3), + B(SuspendGenerator), R(2), R(0), U8(20), U8(1), /* 50 S> */ B(Return), - B(RestoreGeneratorRegisters), R(2), R(0), U8(19), - B(LdaSmi), I8(-2), - B(Star), R(10), - B(InvokeIntrinsic), U8(Runtime::k_GeneratorGetInputOrDebugPos), R(2), U8(1), - B(Star), R(19), + B(ResumeGenerator), R(2), R(11), R(0), U8(20), + B(Star), R(20), B(InvokeIntrinsic), U8(Runtime::k_GeneratorGetResumeMode), R(2), U8(1), B(SwitchOnSmiNoFeedback), U8(11), U8(2), I8(0), - B(Ldar), R(19), + B(Ldar), R(20), /* 42 E> */ B(Throw), B(LdaZero), - B(Star), R(15), - B(Mov), R(19), R(16), + B(Star), R(16), + B(Mov), R(20), R(17), B(Jump), U8(62), B(LdaZero), - B(Star), R(6), - B(JumpLoop), U8(116), I8(0), + B(Star), R(7), + B(JumpLoop), U8(103), I8(0), B(Jump), U8(40), - B(Star), R(19), + B(Star), R(20), B(Ldar), R(closure), - B(CreateCatchContext), R(19), U8(13), U8(14), - B(Star), R(18), + B(CreateCatchContext), R(20), U8(13), U8(14), + B(Star), R(19), B(LdaTheHole), B(SetPendingMessage), - B(Ldar), R(18), - B(PushContext), R(19), + B(Ldar), R(19), + B(PushContext), R(20), B(LdaSmi), I8(2), - B(TestEqualStrict), R(6), U8(13), + B(TestEqualStrict), R(7), U8(13), B(JumpIfFalse), U8(6), B(LdaSmi), I8(1), - B(Star), R(6), + B(Star), R(7), B(LdaImmutableCurrentContextSlot), U8(4), - B(Star), R(20), - B(CallRuntime), U16(Runtime::kReThrow), R(20), U8(1), - B(PopContext), R(19), + B(Star), R(21), + B(CallRuntime), U16(Runtime::kReThrow), R(21), U8(1), + B(PopContext), R(20), B(LdaSmi), I8(-1), + B(Star), R(17), B(Star), R(16), - B(Star), R(15), B(Jump), U8(8), - B(Star), R(16), + B(Star), R(17), B(LdaSmi), I8(1), - B(Star), R(15), + B(Star), R(16), B(LdaTheHole), B(SetPendingMessage), - B(Star), R(17), + B(Star), R(18), B(LdaZero), - B(TestEqualStrict), R(6), U8(14), - B(JumpIfTrue), U8(104), + B(TestEqualStrict), R(7), U8(14), + B(JumpIfTrue), U8(90), B(LdaNamedProperty), R(4), U8(15), U8(15), - B(Star), R(8), + B(Star), R(9), B(TestUndetectable), B(JumpIfFalse), U8(4), - B(Jump), U8(93), + B(Jump), U8(79), B(LdaSmi), I8(1), - B(TestEqualStrict), R(6), U8(17), - B(JumpIfFalse), U8(61), - B(Ldar), R(8), + B(TestEqualStrict), R(7), U8(17), + B(JumpIfFalse), U8(47), + B(Ldar), R(9), B(TestTypeOf), U8(6), B(JumpIfFalse), U8(4), B(Jump), U8(18), - B(Wide), B(LdaSmi), I16(143), - B(Star), R(18), - B(LdaConstant), U8(16), + B(Wide), B(LdaSmi), I16(144), B(Star), R(19), - B(CallRuntime), U16(Runtime::kNewTypeError), R(18), U8(2), + B(LdaConstant), U8(16), + B(Star), R(20), + B(CallRuntime), U16(Runtime::kNewTypeError), R(19), U8(2), B(Throw), - B(Mov), R(context), R(18), - B(Mov), R(8), R(19), - B(Mov), R(4), R(20), - B(InvokeIntrinsic), U8(Runtime::k_Call), R(19), U8(2), - B(Jump), U8(20), - B(Star), R(19), - B(Ldar), R(closure), - B(CreateCatchContext), R(19), U8(13), U8(17), - B(Star), R(18), + B(Mov), R(context), R(19), + B(Mov), R(9), R(20), + B(Mov), R(4), R(21), + B(InvokeIntrinsic), U8(Runtime::k_Call), R(20), U8(2), + B(Jump), U8(6), B(LdaTheHole), B(SetPendingMessage), - B(Ldar), R(18), - B(PushContext), R(19), - B(PopContext), R(19), + B(Ldar), R(19), B(Jump), U8(27), - B(Mov), R(8), R(18), - B(Mov), R(4), R(19), - B(InvokeIntrinsic), U8(Runtime::k_Call), R(18), U8(2), - B(Star), R(9), - B(InvokeIntrinsic), U8(Runtime::k_IsJSReceiver), R(9), U8(1), + B(Mov), R(9), R(19), + B(Mov), R(4), 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(JumpIfToBooleanFalse), U8(4), B(Jump), U8(7), - B(CallRuntime), U16(Runtime::kThrowIteratorResultNotAnObject), R(9), U8(1), - B(Ldar), R(17), + B(CallRuntime), U16(Runtime::kThrowIteratorResultNotAnObject), R(10), U8(1), + B(Ldar), R(18), B(SetPendingMessage), - B(Ldar), R(15), - B(SwitchOnSmiNoFeedback), U8(18), U8(2), I8(0), + B(Ldar), R(16), + B(SwitchOnSmiNoFeedback), U8(17), U8(2), I8(0), B(Jump), U8(13), B(LdaZero), - B(Star), R(11), - B(Mov), R(16), R(12), - B(Jump), U8(110), - B(Ldar), R(16), + B(Star), R(12), + B(Mov), R(17), R(13), + B(Jump), U8(103), + B(Ldar), R(17), B(ReThrow), B(LdaUndefined), - B(Star), R(16), - B(Mov), R(2), R(15), - B(CallJSRuntime), U8(%async_generator_await_uncaught), R(15), U8(2), - B(SuspendGenerator), R(2), R(0), U8(15), U8(2), + B(Star), R(17), + B(Mov), R(2), R(16), + B(CallJSRuntime), U8(%async_generator_await_uncaught), R(16), U8(2), + B(SuspendGenerator), R(2), R(0), U8(16), U8(2), /* 50 S> */ B(Return), - B(RestoreGeneratorRegisters), R(2), R(0), U8(15), - B(LdaSmi), I8(-2), - B(Star), R(10), - B(InvokeIntrinsic), U8(Runtime::k_GeneratorGetInputOrDebugPos), R(2), U8(1), - B(Star), R(15), - B(InvokeIntrinsic), U8(Runtime::k_GeneratorGetResumeMode), R(2), U8(1), + B(ResumeGenerator), R(2), R(11), R(0), U8(16), B(Star), R(16), + B(InvokeIntrinsic), U8(Runtime::k_GeneratorGetResumeMode), R(2), U8(1), + B(Star), R(17), B(LdaZero), - B(TestEqualStrictNoFeedback), R(16), + B(TestEqualStrictNoFeedback), R(17), B(JumpIfTrue), U8(5), - B(Ldar), R(15), + B(Ldar), R(16), B(ReThrow), B(LdaZero), - B(Star), R(11), - B(Mov), R(15), R(12), + B(Star), R(12), + B(Mov), R(16), R(13), B(Jump), U8(55), B(Jump), U8(39), - B(Star), R(15), + B(Star), R(16), B(Ldar), R(closure), - B(CreateCatchContext), R(15), U8(13), U8(20), - B(Star), R(14), + B(CreateCatchContext), R(16), U8(13), U8(19), + B(Star), R(15), B(LdaTheHole), B(SetPendingMessage), - B(Ldar), R(14), - B(PushContext), R(15), + B(Ldar), R(15), + B(PushContext), R(16), B(LdaImmutableCurrentContextSlot), U8(4), - B(Star), R(17), - B(Mov), R(2), R(16), - B(InvokeIntrinsic), U8(Runtime::k_AsyncGeneratorReject), R(16), U8(2), - B(PopContext), R(15), - B(Star), R(12), + B(Star), R(18), + B(Mov), R(2), R(17), + B(InvokeIntrinsic), U8(Runtime::k_AsyncGeneratorReject), R(17), U8(2), + B(PopContext), R(16), + B(Star), R(13), B(LdaSmi), I8(1), - B(Star), R(11), + B(Star), R(12), B(Jump), U8(16), B(LdaSmi), I8(-1), + B(Star), R(13), B(Star), R(12), - B(Star), R(11), B(Jump), U8(8), - B(Star), R(12), + B(Star), R(13), B(LdaSmi), I8(2), - B(Star), R(11), + B(Star), R(12), B(LdaTheHole), B(SetPendingMessage), - B(Star), R(13), + B(Star), R(14), B(InvokeIntrinsic), U8(Runtime::k_GeneratorClose), R(2), U8(1), - B(Ldar), R(13), + B(Ldar), R(14), B(SetPendingMessage), - B(Ldar), R(11), - B(SwitchOnSmiNoFeedback), U8(22), U8(3), I8(0), + B(Ldar), R(12), + B(SwitchOnSmiNoFeedback), U8(21), U8(3), I8(0), B(Jump), U8(22), B(LdaTrue), - B(Star), R(16), - B(Mov), R(2), R(14), - B(Mov), R(12), R(15), - B(InvokeIntrinsic), U8(Runtime::k_AsyncGeneratorResolve), R(14), U8(3), + B(Star), R(17), + B(Mov), R(2), R(15), + B(Mov), R(13), R(16), + B(InvokeIntrinsic), U8(Runtime::k_AsyncGeneratorResolve), R(15), U8(3), /* 50 S> */ B(Return), - B(Ldar), R(12), + B(Ldar), R(13), /* 50 S> */ B(Return), - B(Ldar), R(12), + B(Ldar), R(13), B(ReThrow), B(LdaUndefined), /* 50 S> */ B(Return), ] constant pool: [ Smi [37], - Smi [104], - Smi [427], + Smi [103], + Smi [399], Smi [15], Smi [7], TUPLE2_TYPE, SYMBOL_TYPE, - Smi [78], ONE_BYTE_INTERNALIZED_STRING_TYPE ["next"], + Smi [72], ONE_BYTE_INTERNALIZED_STRING_TYPE ["done"], ONE_BYTE_INTERNALIZED_STRING_TYPE ["value"], Smi [15], @@ -555,21 +525,20 @@ constant pool: [ FIXED_ARRAY_TYPE, ONE_BYTE_INTERNALIZED_STRING_TYPE ["return"], ONE_BYTE_INTERNALIZED_STRING_TYPE [""], - FIXED_ARRAY_TYPE, Smi [6], Smi [14], FIXED_ARRAY_TYPE, - Smi [448], + Smi [420], Smi [6], Smi [20], Smi [23], ] handlers: [ - [40, 516, 524], - [43, 477, 479], - [90, 277, 285], - [93, 237, 239], - [346, 356, 358], + [40, 481, 489], + [43, 442, 444], + [83, 263, 271], + [86, 223, 225], + [332, 342, 344], ] --- @@ -578,9 +547,9 @@ snippet: " async function* f() { yield* g() } f(); " -frame size: 17 +frame size: 18 parameter count: 1 -bytecode array length: 560 +bytecode array length: 526 bytecodes: [ B(Ldar), R(0), B(JumpIfUndefined), U8(18), @@ -589,7 +558,7 @@ bytecodes: [ B(RestoreGeneratorState), R(0), B(Star), R(1), B(SwitchOnSmiNoFeedback), U8(0), U8(5), I8(0), - B(Abort), U8(42), + B(Abort), U8(15), B(LdaSmi), I8(-2), B(Star), R(1), B(Mov), R(closure), R(2), @@ -602,10 +571,7 @@ bytecodes: [ B(Ldar), R(0), /* 44 E> */ B(SuspendGenerator), R(0), R(0), U8(6), U8(0), /* 60 S> */ B(Return), - B(RestoreGeneratorRegisters), R(0), R(0), U8(6), - B(LdaSmi), I8(-2), - B(Star), R(1), - B(InvokeIntrinsic), U8(Runtime::k_GeneratorGetInputOrDebugPos), R(0), U8(1), + B(ResumeGenerator), R(0), R(1), R(0), U8(6), B(Star), R(6), B(InvokeIntrinsic), U8(Runtime::k_GeneratorGetResumeMode), R(0), U8(1), B(SwitchOnSmiNoFeedback), U8(5), U8(2), I8(0), @@ -616,44 +582,44 @@ bytecodes: [ B(Mov), R(6), R(3), B(JumpConstant), U8(22), /* 49 S> */ B(LdaGlobal), U8(7), U8(0), - B(Star), R(12), - /* 56 E> */ B(CallUndefinedReceiver0), R(12), U8(2), - B(Star), R(10), - B(LdaNamedProperty), R(10), U8(8), U8(4), + B(Star), R(13), + /* 56 E> */ B(CallUndefinedReceiver0), R(13), U8(2), + B(Star), R(11), + B(LdaNamedProperty), R(11), U8(8), U8(4), B(JumpIfUndefined), U8(17), B(JumpIfNull), U8(15), - B(Star), R(11), - B(CallProperty0), R(11), R(10), U8(6), + B(Star), R(12), + B(CallProperty0), R(12), R(11), U8(6), B(JumpIfJSReceiver), U8(23), B(CallRuntime), U16(Runtime::kThrowSymbolAsyncIteratorInvalid), R(0), U8(0), - B(LdaNamedProperty), R(10), U8(9), U8(8), - B(Star), R(11), - B(CallProperty0), R(11), R(10), U8(10), - B(Star), R(11), - B(InvokeIntrinsic), U8(Runtime::k_CreateAsyncFromSyncIterator), R(11), U8(1), + B(LdaNamedProperty), R(11), U8(9), U8(8), + B(Star), R(12), + B(CallProperty0), R(12), R(11), U8(10), + B(Star), R(12), + B(InvokeIntrinsic), U8(Runtime::k_CreateAsyncFromSyncIterator), R(12), U8(1), B(Star), R(8), + B(LdaNamedProperty), R(8), U8(10), U8(12), + B(Star), R(10), B(LdaUndefined), B(Star), R(9), B(LdaZero), B(Star), R(7), B(Ldar), R(1), - B(SwitchOnSmiNoFeedback), U8(10), U8(3), I8(1), + B(SwitchOnSmiNoFeedback), U8(11), U8(3), I8(1), B(LdaSmi), I8(-2), B(TestEqualStrictNoFeedback), R(1), B(JumpIfTrue), U8(4), - B(Abort), U8(42), + B(Abort), U8(15), B(Ldar), R(7), - B(SwitchOnSmiNoFeedback), U8(13), U8(2), I8(1), - B(LdaNamedProperty), R(8), U8(15), U8(12), - B(Star), R(12), - B(CallProperty1), R(12), R(8), R(9), U8(14), - B(Jump), U8(118), + B(SwitchOnSmiNoFeedback), U8(14), U8(2), I8(1), + B(CallProperty1), R(10), R(8), R(9), U8(14), + B(Jump), U8(112), B(LdaNamedProperty), R(8), U8(16), U8(16), B(JumpIfUndefined), U8(13), B(JumpIfNull), U8(11), - B(Star), R(12), - B(CallProperty1), R(12), R(8), R(9), U8(18), - B(Jump), U8(101), + B(Star), R(13), + B(CallProperty1), R(13), R(8), R(9), U8(18), + B(Jump), U8(95), B(LdaZero), B(Star), R(2), B(Mov), R(9), R(3), @@ -661,23 +627,21 @@ bytecodes: [ B(LdaNamedProperty), R(8), U8(17), U8(20), B(JumpIfUndefined), U8(13), B(JumpIfNull), U8(11), - B(Star), R(12), - B(CallProperty1), R(12), R(8), R(9), U8(22), - B(Jump), U8(76), + B(Star), R(13), + B(CallProperty1), R(13), R(8), R(9), U8(22), + B(Jump), U8(70), B(LdaNamedProperty), R(8), U8(16), U8(24), - B(Star), R(12), - B(JumpIfUndefined), U8(63), - B(JumpIfNull), U8(61), - B(CallProperty0), R(12), R(8), U8(26), + B(JumpIfUndefined), U8(59), + B(JumpIfNull), U8(57), + B(Star), R(13), + B(CallProperty0), R(13), R(8), U8(26), + B(Jump), U8(2), B(Star), R(14), B(Mov), R(0), R(13), B(CallJSRuntime), U8(%async_generator_await_uncaught), R(13), U8(2), B(SuspendGenerator), R(0), R(0), U8(13), U8(2), /* 60 S> */ B(Return), - B(RestoreGeneratorRegisters), R(0), R(0), U8(13), - B(LdaSmi), I8(-2), - B(Star), R(1), - B(InvokeIntrinsic), U8(Runtime::k_GeneratorGetInputOrDebugPos), R(0), U8(1), + B(ResumeGenerator), R(0), R(1), R(0), U8(13), B(Star), R(13), B(InvokeIntrinsic), U8(Runtime::k_GeneratorGetResumeMode), R(0), U8(1), B(Star), R(14), @@ -687,49 +651,43 @@ bytecodes: [ B(Ldar), R(13), B(ReThrow), B(Ldar), R(13), - B(Mov), R(13), R(6), - B(JumpIfJSReceiver), U8(7), - B(CallRuntime), U16(Runtime::kThrowIteratorResultNotAnObject), R(6), U8(1), + B(JumpIfJSReceiver), U8(9), + B(Star), R(15), + B(CallRuntime), U16(Runtime::kThrowIteratorResultNotAnObject), R(15), U8(1), B(CallRuntime), U16(Runtime::kThrowThrowMethodMissing), R(0), U8(0), - B(Star), R(13), - B(Mov), R(0), R(12), - B(CallJSRuntime), U8(%async_generator_await_uncaught), R(12), U8(2), - B(SuspendGenerator), R(0), R(0), U8(12), U8(3), + B(Star), R(14), + B(Mov), R(0), R(13), + B(CallJSRuntime), U8(%async_generator_await_uncaught), R(13), U8(2), + B(SuspendGenerator), R(0), R(0), U8(13), U8(3), /* 60 S> */ B(Return), - B(RestoreGeneratorRegisters), R(0), R(0), U8(12), - B(LdaSmi), I8(-2), - B(Star), R(1), - B(InvokeIntrinsic), U8(Runtime::k_GeneratorGetInputOrDebugPos), R(0), U8(1), - B(Star), R(12), - B(InvokeIntrinsic), U8(Runtime::k_GeneratorGetResumeMode), R(0), U8(1), + B(ResumeGenerator), R(0), R(1), R(0), U8(13), B(Star), R(13), + B(InvokeIntrinsic), U8(Runtime::k_GeneratorGetResumeMode), R(0), U8(1), + B(Star), R(14), B(LdaZero), - B(TestEqualStrictNoFeedback), R(13), + B(TestEqualStrictNoFeedback), R(14), B(JumpIfTrue), U8(5), - B(Ldar), R(12), + B(Ldar), R(13), B(ReThrow), - B(Ldar), R(12), - B(Mov), R(12), R(6), + B(Ldar), R(13), + B(Mov), R(13), R(6), B(JumpIfJSReceiver), U8(7), B(CallRuntime), U16(Runtime::kThrowIteratorResultNotAnObject), R(6), U8(1), B(LdaNamedProperty), R(6), U8(18), U8(28), - B(JumpIfToBooleanTrue), U8(47), + B(JumpIfToBooleanTrue), U8(40), B(LdaNamedProperty), R(6), U8(19), U8(30), - B(Star), R(15), - B(LdaFalse), B(Star), R(16), - B(Mov), R(0), R(14), - B(InvokeIntrinsic), U8(Runtime::k_AsyncGeneratorYield), R(14), U8(3), - B(SuspendGenerator), R(0), R(0), U8(14), U8(1), + B(LdaFalse), + B(Star), R(17), + B(Mov), R(0), R(15), + B(InvokeIntrinsic), U8(Runtime::k_AsyncGeneratorYield), R(15), U8(3), + B(SuspendGenerator), R(0), R(0), U8(15), U8(1), /* 60 S> */ B(Return), - B(RestoreGeneratorRegisters), R(0), R(0), U8(14), - B(LdaSmi), I8(-2), - B(Star), R(1), - B(InvokeIntrinsic), U8(Runtime::k_GeneratorGetInputOrDebugPos), R(0), U8(1), + B(ResumeGenerator), R(0), R(1), R(0), U8(15), B(Star), R(9), B(InvokeIntrinsic), U8(Runtime::k_GeneratorGetResumeMode), R(0), U8(1), B(Star), R(7), - B(JumpLoop), U8(252), I8(0), + B(JumpLoop), U8(226), I8(0), B(LdaNamedProperty), R(6), U8(19), U8(32), B(Star), R(8), B(LdaSmi), I8(1), @@ -738,17 +696,14 @@ bytecodes: [ B(LdaZero), B(Star), R(2), B(Mov), R(8), R(3), - B(Jump), U8(107), + B(Jump), U8(100), B(LdaUndefined), B(Star), R(7), B(Mov), R(0), R(6), B(CallJSRuntime), U8(%async_generator_await_uncaught), R(6), U8(2), B(SuspendGenerator), R(0), R(0), U8(6), U8(4), /* 60 S> */ B(Return), - B(RestoreGeneratorRegisters), R(0), R(0), U8(6), - B(LdaSmi), I8(-2), - B(Star), R(1), - B(InvokeIntrinsic), U8(Runtime::k_GeneratorGetInputOrDebugPos), R(0), U8(1), + B(ResumeGenerator), R(0), R(1), R(0), U8(6), B(Star), R(6), B(InvokeIntrinsic), U8(Runtime::k_GeneratorGetResumeMode), R(0), U8(1), B(Star), R(7), @@ -810,35 +765,35 @@ bytecodes: [ ] constant pool: [ Smi [37], - Smi [125], - Smi [125], - Smi [125], - Smi [416], + Smi [124], + Smi [124], + Smi [124], + Smi [389], Smi [15], Smi [7], ONE_BYTE_INTERNALIZED_STRING_TYPE ["g"], SYMBOL_TYPE, SYMBOL_TYPE, - Smi [230], - Smi [102], - Smi [162], - Smi [17], - Smi [42], ONE_BYTE_INTERNALIZED_STRING_TYPE ["next"], + Smi [211], + Smi [98], + Smi [150], + Smi [11], + Smi [36], ONE_BYTE_INTERNALIZED_STRING_TYPE ["return"], ONE_BYTE_INTERNALIZED_STRING_TYPE ["throw"], ONE_BYTE_INTERNALIZED_STRING_TYPE ["done"], ONE_BYTE_INTERNALIZED_STRING_TYPE ["value"], ONE_BYTE_INTERNALIZED_STRING_TYPE [".catch"], FIXED_ARRAY_TYPE, - Smi [437], - Smi [324], + Smi [410], + Smi [297], Smi [6], Smi [20], Smi [23], ] handlers: [ - [40, 505, 513], - [43, 466, 468], + [40, 471, 479], + [43, 432, 434], ] diff --git a/deps/v8/test/cctest/interpreter/bytecode_expectations/ClassFields.golden b/deps/v8/test/cctest/interpreter/bytecode_expectations/ClassFields.golden index afb3d3e8de..b8b77107a7 100644 --- a/deps/v8/test/cctest/interpreter/bytecode_expectations/ClassFields.golden +++ b/deps/v8/test/cctest/interpreter/bytecode_expectations/ClassFields.golden @@ -12,23 +12,19 @@ snippet: " class A { a; ['b']; - static c; - static ['d']; } class B { a = 1; ['b'] = this.a; - static c = 3; - static ['d'] = this.c; } new A; new B; } " -frame size: 11 +frame size: 10 parameter count: 1 -bytecode array length: 193 +bytecode array length: 129 bytecodes: [ /* 30 E> */ B(StackCheck), B(Ldar), R(closure), @@ -37,8 +33,6 @@ bytecodes: [ B(LdaTheHole), B(StaCurrentContextSlot), U8(4), B(LdaTheHole), - B(StaCurrentContextSlot), U8(5), - B(LdaTheHole), B(Star), R(8), B(CreateClosure), U8(2), U8(0), U8(2), B(Star), R(5), @@ -47,84 +41,56 @@ bytecodes: [ B(LdaConstant), U8(3), B(StaCurrentContextSlot), U8(4), B(Star), R(9), - B(LdaConstant), U8(4), - B(Star), R(10), - B(LdaConstant), U8(5), - B(TestEqualStrictNoFeedback), R(10), B(Mov), R(5), R(7), - B(JumpIfFalse), U8(7), - B(CallRuntime), U16(Runtime::kThrowStaticPrototypeError), R(0), U8(0), - B(Ldar), R(10), - B(StaCurrentContextSlot), U8(5), - B(CallRuntime), U16(Runtime::kDefineClass), R(6), U8(5), + B(CallRuntime), U16(Runtime::kDefineClass), R(6), U8(4), B(Star), R(6), - B(Mov), R(5), R(1), - B(CreateClosure), U8(6), U8(1), U8(2), + B(Mov), R(7), R(1), + B(CreateClosure), U8(4), U8(1), U8(2), B(Star), R(7), - B(StaNamedProperty), R(5), U8(7), U8(2), - B(CreateClosure), U8(8), U8(4), U8(2), - B(Star), R(9), - B(CallProperty0), R(9), R(1), U8(5), + B(StaNamedProperty), R(5), U8(5), U8(2), B(PopContext), R(4), B(Mov), R(1), R(2), B(Ldar), R(closure), - /* 38 E> */ B(CreateBlockContext), U8(9), + /* 38 E> */ B(CreateBlockContext), U8(6), B(PushContext), R(4), B(LdaTheHole), B(StaCurrentContextSlot), U8(4), B(LdaTheHole), - B(StaCurrentContextSlot), U8(5), - B(LdaTheHole), B(Star), R(8), - B(CreateClosure), U8(11), U8(7), U8(2), + B(CreateClosure), U8(8), U8(4), U8(2), B(Star), R(5), - B(LdaConstant), U8(10), + B(LdaConstant), U8(7), B(Star), R(6), B(LdaConstant), U8(3), B(StaCurrentContextSlot), U8(4), B(Star), R(9), - B(LdaConstant), U8(4), - B(Star), R(10), - B(LdaConstant), U8(5), - B(TestEqualStrictNoFeedback), R(10), B(Mov), R(5), R(7), - B(JumpIfFalse), U8(7), - B(CallRuntime), U16(Runtime::kThrowStaticPrototypeError), R(0), U8(0), - B(Ldar), R(10), - B(StaCurrentContextSlot), U8(5), - B(CallRuntime), U16(Runtime::kDefineClass), R(6), U8(5), + B(CallRuntime), U16(Runtime::kDefineClass), R(6), U8(4), B(Star), R(6), - B(Mov), R(5), R(0), - B(CreateClosure), U8(12), U8(8), U8(2), + B(Mov), R(7), R(0), + B(CreateClosure), U8(9), U8(5), U8(2), B(Star), R(7), - B(StaNamedProperty), R(5), U8(7), U8(9), - B(CreateClosure), U8(13), U8(11), U8(2), - B(Star), R(9), - B(CallProperty0), R(9), R(0), U8(12), + B(StaNamedProperty), R(5), U8(5), U8(6), B(PopContext), R(4), B(Mov), R(0), R(3), - /* 197 S> */ B(Ldar), R(2), - /* 197 E> */ B(Construct), R(2), R(0), U8(0), U8(14), - /* 206 S> */ B(Ldar), R(0), - /* 206 E> */ B(Construct), R(0), R(0), U8(0), U8(16), + /* 120 S> */ B(Ldar), R(1), + /* 120 E> */ B(Construct), R(1), R(0), U8(0), U8(8), + /* 129 S> */ B(Ldar), R(0), + /* 129 E> */ B(Construct), R(0), R(0), U8(0), U8(10), B(LdaUndefined), - /* 215 S> */ B(Return), + /* 138 S> */ B(Return), ] constant pool: [ FIXED_ARRAY_TYPE, FIXED_ARRAY_TYPE, SHARED_FUNCTION_INFO_TYPE, ONE_BYTE_INTERNALIZED_STRING_TYPE ["b"], - ONE_BYTE_INTERNALIZED_STRING_TYPE ["d"], - ONE_BYTE_INTERNALIZED_STRING_TYPE ["prototype"], SHARED_FUNCTION_INFO_TYPE, SYMBOL_TYPE, - SHARED_FUNCTION_INFO_TYPE, FIXED_ARRAY_TYPE, FIXED_ARRAY_TYPE, SHARED_FUNCTION_INFO_TYPE, SHARED_FUNCTION_INFO_TYPE, - SHARED_FUNCTION_INFO_TYPE, ] handlers: [ ] @@ -135,15 +101,11 @@ snippet: " class A extends class {} { a; ['b']; - static c; - static ['d']; } class B extends class {} { a = 1; ['b'] = this.a; - static c = 3; - static ['d'] = this.c; foo() { return 1; } constructor() { super(); @@ -153,8 +115,6 @@ snippet: " class C extends B { a = 1; ['b'] = this.a; - static c = 3; - static ['d'] = super.foo(); constructor() { (() => super())(); } @@ -167,7 +127,7 @@ snippet: " " frame size: 15 parameter count: 1 -bytecode array length: 346 +bytecode array length: 244 bytecodes: [ /* 30 E> */ B(StackCheck), B(Ldar), R(closure), @@ -176,8 +136,6 @@ bytecodes: [ B(LdaTheHole), B(StaCurrentContextSlot), U8(4), B(LdaTheHole), - B(StaCurrentContextSlot), U8(5), - B(LdaTheHole), B(Star), R(14), B(CreateClosure), U8(3), U8(0), U8(2), B(Star), R(11), @@ -193,118 +151,79 @@ bytecodes: [ B(LdaConstant), U8(5), B(StaCurrentContextSlot), U8(4), B(Star), R(11), - B(LdaConstant), U8(6), - B(Star), R(12), - B(LdaConstant), U8(7), - B(TestEqualStrictNoFeedback), R(12), - B(Mov), R(13), R(10), B(Mov), R(7), R(9), - B(JumpIfFalse), U8(7), - B(CallRuntime), U16(Runtime::kThrowStaticPrototypeError), R(0), U8(0), - B(Ldar), R(12), - B(StaCurrentContextSlot), U8(5), - B(CallRuntime), U16(Runtime::kDefineClass), R(8), U8(5), + B(Mov), R(13), R(10), + B(CallRuntime), U16(Runtime::kDefineClass), R(8), U8(4), B(Star), R(8), - B(Mov), R(7), R(2), - B(CreateClosure), U8(8), U8(2), U8(2), + B(Mov), R(9), R(2), + B(CreateClosure), U8(6), U8(2), U8(2), B(Star), R(9), - B(StaNamedProperty), R(7), U8(9), U8(3), - B(CreateClosure), U8(10), U8(5), U8(2), - B(Star), R(11), - B(CallProperty0), R(11), R(2), U8(6), + B(StaNamedProperty), R(7), U8(7), U8(3), B(PopContext), R(6), B(Mov), R(2), R(3), B(Ldar), R(closure), - /* 38 E> */ B(CreateBlockContext), U8(11), + /* 38 E> */ B(CreateBlockContext), U8(8), B(PushContext), R(6), B(LdaTheHole), B(StaCurrentContextSlot), U8(4), B(LdaTheHole), - B(StaCurrentContextSlot), U8(5), - B(LdaTheHole), B(Star), R(14), - B(CreateClosure), U8(14), U8(8), U8(2), + B(CreateClosure), U8(11), U8(5), U8(2), B(Star), R(11), - B(LdaConstant), U8(13), + B(LdaConstant), U8(10), B(Star), R(12), B(Mov), R(11), R(13), B(CallRuntime), U16(Runtime::kDefineClass), R(12), U8(3), B(Star), R(12), - B(CreateClosure), U8(15), U8(9), U8(2), + B(CreateClosure), U8(12), U8(6), U8(2), B(Star), R(7), - B(LdaConstant), U8(12), + B(LdaConstant), U8(9), B(Star), R(8), B(LdaConstant), U8(5), B(StaCurrentContextSlot), U8(4), B(Star), R(11), - B(LdaConstant), U8(6), + B(CreateClosure), U8(13), U8(7), U8(2), B(Star), R(12), - B(LdaConstant), U8(7), - B(TestEqualStrictNoFeedback), R(12), B(Mov), R(7), R(9), B(Mov), R(13), R(10), - B(JumpIfFalse), U8(7), - B(CallRuntime), U16(Runtime::kThrowStaticPrototypeError), R(0), U8(0), - B(Ldar), R(12), - B(StaCurrentContextSlot), U8(5), - B(CreateClosure), U8(16), U8(10), U8(2), - B(Star), R(13), - B(CallRuntime), U16(Runtime::kDefineClass), R(8), U8(6), + B(CallRuntime), U16(Runtime::kDefineClass), R(8), U8(5), B(Star), R(8), - B(Mov), R(7), R(1), - B(CreateClosure), U8(17), U8(11), U8(2), + B(Mov), R(9), R(1), + B(CreateClosure), U8(14), U8(8), U8(2), B(Star), R(9), - B(StaNamedProperty), R(7), U8(9), U8(12), - B(CreateClosure), U8(18), U8(14), U8(2), - B(Star), R(11), - B(CallProperty0), R(11), R(1), U8(15), + B(StaNamedProperty), R(7), U8(7), U8(9), B(PopContext), R(6), B(Mov), R(1), R(4), B(Ldar), R(closure), - /* 122 E> */ B(CreateBlockContext), U8(19), + /* 90 E> */ B(CreateBlockContext), U8(15), B(PushContext), R(6), B(LdaTheHole), B(StaCurrentContextSlot), U8(4), - B(LdaTheHole), - B(StaCurrentContextSlot), U8(5), - /* 313 E> */ B(CreateClosure), U8(21), U8(17), U8(2), + /* 236 E> */ B(CreateClosure), U8(17), U8(11), U8(2), B(Star), R(7), - B(LdaConstant), U8(20), + B(LdaConstant), U8(16), B(Star), R(8), B(LdaConstant), U8(5), B(StaCurrentContextSlot), U8(4), B(Star), R(11), - B(LdaConstant), U8(6), - B(Star), R(12), - B(LdaConstant), U8(7), - B(TestEqualStrictNoFeedback), R(12), - B(Mov), R(1), R(10), B(Mov), R(7), R(9), - B(JumpIfFalse), U8(7), - B(CallRuntime), U16(Runtime::kThrowStaticPrototypeError), R(0), U8(0), - B(Ldar), R(12), - B(StaCurrentContextSlot), U8(5), - B(CallRuntime), U16(Runtime::kDefineClass), R(8), U8(5), + B(Mov), R(1), R(10), + B(CallRuntime), U16(Runtime::kDefineClass), R(8), U8(4), B(Star), R(8), - B(Mov), R(7), R(0), - B(CreateClosure), U8(22), U8(18), U8(2), + B(Mov), R(9), R(0), + B(CreateClosure), U8(18), U8(12), U8(2), B(Star), R(9), - B(StaNamedProperty), R(7), U8(9), U8(19), - B(CreateClosure), U8(23), U8(21), U8(2), - B(Star), R(11), - B(Ldar), R(0), - B(StaNamedProperty), R(11), U8(24), U8(22), - B(CallProperty0), R(11), R(0), U8(24), + B(StaNamedProperty), R(7), U8(7), U8(13), B(PopContext), R(6), B(Mov), R(0), R(5), - /* 456 S> */ B(Ldar), R(3), - /* 456 E> */ B(Construct), R(3), R(0), U8(0), U8(26), - /* 465 S> */ B(Ldar), R(4), - /* 465 E> */ B(Construct), R(4), R(0), U8(0), U8(28), - /* 474 S> */ B(Ldar), R(0), - /* 474 E> */ B(Construct), R(0), R(0), U8(0), U8(30), + /* 329 S> */ B(Ldar), R(2), + /* 329 E> */ B(Construct), R(2), R(0), U8(0), U8(15), + /* 338 S> */ B(Ldar), R(1), + /* 338 E> */ B(Construct), R(1), R(0), U8(0), U8(17), + /* 347 S> */ B(Ldar), R(0), + /* 347 E> */ B(Construct), R(0), R(0), U8(0), U8(19), B(LdaUndefined), - /* 483 S> */ B(Return), + /* 356 S> */ B(Return), ] constant pool: [ FIXED_ARRAY_TYPE, @@ -313,11 +232,8 @@ constant pool: [ SHARED_FUNCTION_INFO_TYPE, SHARED_FUNCTION_INFO_TYPE, ONE_BYTE_INTERNALIZED_STRING_TYPE ["b"], - ONE_BYTE_INTERNALIZED_STRING_TYPE ["d"], - ONE_BYTE_INTERNALIZED_STRING_TYPE ["prototype"], SHARED_FUNCTION_INFO_TYPE, SYMBOL_TYPE, - SHARED_FUNCTION_INFO_TYPE, FIXED_ARRAY_TYPE, FIXED_ARRAY_TYPE, FIXED_ARRAY_TYPE, @@ -325,13 +241,10 @@ constant pool: [ SHARED_FUNCTION_INFO_TYPE, SHARED_FUNCTION_INFO_TYPE, SHARED_FUNCTION_INFO_TYPE, - SHARED_FUNCTION_INFO_TYPE, FIXED_ARRAY_TYPE, FIXED_ARRAY_TYPE, SHARED_FUNCTION_INFO_TYPE, SHARED_FUNCTION_INFO_TYPE, - SHARED_FUNCTION_INFO_TYPE, - SYMBOL_TYPE, ] handlers: [ ] diff --git a/deps/v8/test/cctest/interpreter/bytecode_expectations/DeclareGlobals.golden b/deps/v8/test/cctest/interpreter/bytecode_expectations/DeclareGlobals.golden index cec1c48f32..0d1edb6424 100644 --- a/deps/v8/test/cctest/interpreter/bytecode_expectations/DeclareGlobals.golden +++ b/deps/v8/test/cctest/interpreter/bytecode_expectations/DeclareGlobals.golden @@ -22,7 +22,7 @@ bytecodes: [ B(CallRuntime), U16(Runtime::kDeclareGlobalsForInterpreter), R(1), U8(3), /* 0 E> */ B(StackCheck), /* 8 S> */ B(LdaSmi), I8(1), - /* 8 E> */ B(StaGlobalSloppy), U8(1), U8(2), + /* 8 E> */ B(StaGlobal), U8(1), U8(2), B(LdaUndefined), /* 10 S> */ B(Return), ] @@ -74,9 +74,9 @@ bytecodes: [ B(CallRuntime), U16(Runtime::kDeclareGlobalsForInterpreter), R(1), U8(3), /* 0 E> */ B(StackCheck), /* 8 S> */ B(LdaSmi), I8(1), - /* 8 E> */ B(StaGlobalSloppy), U8(1), U8(2), + /* 8 E> */ B(StaGlobal), U8(1), U8(2), /* 11 S> */ B(LdaSmi), I8(2), - /* 12 E> */ B(StaGlobalSloppy), U8(1), U8(4), + /* 12 E> */ B(StaGlobal), U8(1), U8(4), B(Star), R(0), /* 15 S> */ B(Return), ] diff --git a/deps/v8/test/cctest/interpreter/bytecode_expectations/ForAwaitOf.golden b/deps/v8/test/cctest/interpreter/bytecode_expectations/ForAwaitOf.golden index 16e36dd707..fd83a29fd9 100644 --- a/deps/v8/test/cctest/interpreter/bytecode_expectations/ForAwaitOf.golden +++ b/deps/v8/test/cctest/interpreter/bytecode_expectations/ForAwaitOf.golden @@ -14,155 +14,173 @@ snippet: " } f(); " -frame size: 23 +frame size: 24 parameter count: 1 -bytecode array length: 589 +bytecode array length: 554 bytecodes: [ B(Ldar), R(2), B(JumpIfUndefined), U8(18), B(InvokeIntrinsic), U8(Runtime::k_GeneratorGetContext), R(2), U8(1), - B(PushContext), R(12), + B(PushContext), R(13), B(RestoreGeneratorState), R(2), - B(Star), R(11), + B(Star), R(12), B(SwitchOnSmiNoFeedback), U8(0), U8(3), I8(0), - B(Abort), U8(42), + B(Abort), U8(15), B(LdaSmi), I8(-2), - B(Star), R(11), - 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(12), + B(Mov), R(closure), R(13), + B(Mov), R(this), R(14), + B(InvokeIntrinsic), U8(Runtime::k_CreateJSGeneratorObject), R(13), U8(2), B(Star), R(2), /* 16 E> */ B(StackCheck), B(CallJSRuntime), U8(%async_function_promise_create), R(0), U8(0), - B(Star), R(10), - B(Mov), R(context), R(14), + B(Star), R(11), B(Mov), R(context), R(15), + B(Mov), R(context), R(16), B(LdaZero), - B(Star), R(6), - B(Mov), R(context), R(18), + B(Star), R(7), B(Mov), R(context), R(19), + B(Mov), R(context), R(20), /* 43 S> */ B(CreateArrayLiteral), U8(3), U8(0), U8(37), - B(Star), R(20), - B(LdaNamedProperty), R(20), U8(4), U8(1), + B(Star), R(21), + B(LdaNamedProperty), R(21), U8(4), U8(1), B(JumpIfUndefined), U8(17), B(JumpIfNull), U8(15), - B(Star), R(21), - B(CallProperty0), R(21), R(20), U8(3), + B(Star), R(22), + B(CallProperty0), R(22), R(21), U8(3), B(JumpIfJSReceiver), U8(23), B(CallRuntime), U16(Runtime::kThrowSymbolAsyncIteratorInvalid), R(0), U8(0), - B(LdaNamedProperty), R(20), U8(5), U8(5), - B(Star), R(21), - B(CallProperty0), R(21), R(20), U8(7), - B(Star), R(21), - B(InvokeIntrinsic), U8(Runtime::k_CreateAsyncFromSyncIterator), R(21), U8(1), + B(LdaNamedProperty), R(21), U8(5), U8(5), + B(Star), R(22), + B(CallProperty0), R(22), R(21), U8(7), + B(Star), R(22), + B(InvokeIntrinsic), U8(Runtime::k_CreateAsyncFromSyncIterator), R(22), U8(1), B(Star), R(4), - B(Ldar), R(11), - B(SwitchOnSmiNoFeedback), U8(6), U8(1), I8(0), + /* 43 E> */ B(LdaNamedProperty), R(4), U8(6), U8(9), + B(Star), R(5), + B(Ldar), R(12), + B(SwitchOnSmiNoFeedback), U8(7), U8(1), I8(0), B(LdaSmi), I8(-2), - /* 43 E> */ B(TestEqualStrictNoFeedback), R(11), + B(TestEqualStrictNoFeedback), R(12), B(JumpIfTrue), U8(4), - B(Abort), U8(42), - /* 40 S> */ B(LdaNamedProperty), R(4), U8(7), U8(9), - B(Star), R(20), - B(CallProperty0), R(20), R(4), U8(11), - B(Star), R(21), - B(Mov), R(2), R(20), - B(Mov), R(10), R(22), - B(CallJSRuntime), U8(%async_function_await_uncaught), R(20), U8(3), - B(SuspendGenerator), R(2), R(0), U8(20), U8(0), + B(Abort), U8(15), + /* 40 S> */ B(CallProperty0), R(5), R(4), U8(11), + B(Star), R(22), + B(Mov), R(2), R(21), + B(Mov), R(11), R(23), + B(CallJSRuntime), U8(%async_function_await_uncaught), R(21), U8(3), + B(SuspendGenerator), R(2), R(0), U8(21), U8(0), /* 57 S> */ B(Return), - B(RestoreGeneratorRegisters), R(2), R(0), U8(20), - B(LdaSmi), I8(-2), - B(Star), R(11), - B(InvokeIntrinsic), U8(Runtime::k_GeneratorGetInputOrDebugPos), R(2), U8(1), - B(Star), R(20), - B(InvokeIntrinsic), U8(Runtime::k_GeneratorGetResumeMode), R(2), U8(1), + B(ResumeGenerator), R(2), R(12), R(0), U8(21), B(Star), R(21), + B(InvokeIntrinsic), U8(Runtime::k_GeneratorGetResumeMode), R(2), U8(1), + B(Star), R(22), B(LdaZero), - B(TestEqualStrictNoFeedback), R(21), + B(TestEqualStrictNoFeedback), R(22), B(JumpIfTrue), U8(5), - B(Ldar), R(20), + B(Ldar), R(21), B(ReThrow), - B(Mov), R(20), R(5), - /* 40 E> */ B(InvokeIntrinsic), U8(Runtime::k_IsJSReceiver), R(20), U8(1), + B(Mov), R(21), R(6), + /* 40 E> */ B(InvokeIntrinsic), U8(Runtime::k_IsJSReceiver), R(21), U8(1), B(ToBooleanLogicalNot), B(JumpIfFalse), U8(7), - B(CallRuntime), U16(Runtime::kThrowIteratorResultNotAnObject), R(5), U8(1), - B(LdaNamedProperty), R(5), U8(8), U8(13), + B(CallRuntime), U16(Runtime::kThrowIteratorResultNotAnObject), R(6), U8(1), + B(LdaNamedProperty), R(6), U8(8), U8(13), B(JumpIfToBooleanTrue), U8(25), - B(LdaNamedProperty), R(5), U8(9), U8(15), - B(Star), R(7), + B(LdaNamedProperty), R(6), U8(9), U8(15), + B(Star), R(8), B(LdaSmi), I8(2), - B(Star), R(6), - B(Mov), R(7), R(3), + B(Star), R(7), + B(Mov), R(8), R(3), /* 23 E> */ B(StackCheck), B(Mov), R(3), R(0), B(LdaZero), - B(Star), R(6), - B(JumpLoop), U8(111), I8(0), + B(Star), R(7), + B(JumpLoop), U8(98), I8(0), B(Jump), U8(40), - B(Star), R(20), + B(Star), R(21), B(Ldar), R(closure), - B(CreateCatchContext), R(20), U8(10), U8(11), - B(Star), R(19), + B(CreateCatchContext), R(21), U8(10), U8(11), + B(Star), R(20), B(LdaTheHole), B(SetPendingMessage), - B(Ldar), R(19), - B(PushContext), R(20), + B(Ldar), R(20), + B(PushContext), R(21), B(LdaSmi), I8(2), - B(TestEqualStrict), R(6), U8(17), + B(TestEqualStrict), R(7), U8(17), B(JumpIfFalse), U8(6), B(LdaSmi), I8(1), - B(Star), R(6), + B(Star), R(7), B(LdaImmutableCurrentContextSlot), U8(4), - B(Star), R(21), - B(CallRuntime), U16(Runtime::kReThrow), R(21), U8(1), - B(PopContext), R(20), + B(Star), R(22), + B(CallRuntime), U16(Runtime::kReThrow), R(22), U8(1), + B(PopContext), R(21), B(LdaSmi), I8(-1), + B(Star), R(18), B(Star), R(17), - B(Star), R(16), B(Jump), U8(7), - B(Star), R(17), + B(Star), R(18), B(LdaZero), - B(Star), R(16), + B(Star), R(17), B(LdaTheHole), B(SetPendingMessage), - B(Star), R(18), + B(Star), R(19), B(LdaZero), - B(TestEqualStrict), R(6), U8(18), - B(JumpIfTrue), U8(199), + B(TestEqualStrict), R(7), U8(18), + B(JumpIfTrue), U8(171), B(LdaNamedProperty), R(4), U8(12), U8(19), - B(Star), R(8), + B(Star), R(9), B(TestUndetectable), B(JumpIfFalse), U8(4), - B(Jump), U8(188), + B(Jump), U8(160), B(LdaSmi), I8(1), - B(TestEqualStrict), R(6), U8(21), - B(JumpIfFalse), U8(109), - B(Ldar), R(8), + B(TestEqualStrict), R(7), U8(21), + B(JumpIfFalse), U8(88), + B(Ldar), R(9), B(TestTypeOf), U8(6), B(JumpIfFalse), U8(4), B(Jump), U8(18), - B(Wide), B(LdaSmi), I16(143), - B(Star), R(19), - B(LdaConstant), U8(13), + B(Wide), B(LdaSmi), I16(144), B(Star), R(20), - B(CallRuntime), U16(Runtime::kNewTypeError), R(19), U8(2), + B(LdaConstant), U8(13), + B(Star), R(21), + B(CallRuntime), U16(Runtime::kNewTypeError), R(20), U8(2), B(Throw), - B(Mov), R(context), R(19), - B(Mov), R(8), R(20), + B(Mov), R(context), R(20), + B(Mov), R(9), R(21), + B(Mov), R(4), R(22), + B(InvokeIntrinsic), U8(Runtime::k_Call), R(21), U8(2), + B(Star), R(22), + B(Mov), R(2), R(21), + B(Mov), R(11), R(23), + B(CallJSRuntime), U8(%async_function_await_caught), R(21), U8(3), + B(SuspendGenerator), R(2), R(0), U8(21), U8(1), + /* 57 S> */ B(Return), + B(ResumeGenerator), R(2), R(12), R(0), U8(21), + B(Star), R(21), + B(InvokeIntrinsic), U8(Runtime::k_GeneratorGetResumeMode), R(2), U8(1), + B(Star), R(22), + B(LdaZero), + B(TestEqualStrictNoFeedback), R(22), + B(JumpIfTrue), U8(5), + B(Ldar), R(21), + B(ReThrow), + B(Ldar), R(21), + B(Jump), U8(6), + B(LdaTheHole), + B(SetPendingMessage), + B(Ldar), R(20), + B(Jump), U8(67), + B(Mov), R(9), R(20), B(Mov), R(4), 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(10), R(22), - B(CallJSRuntime), U8(%async_function_await_caught), R(20), U8(3), - B(SuspendGenerator), R(2), R(0), U8(20), U8(1), + B(Mov), R(11), R(22), + B(CallJSRuntime), U8(%async_function_await_uncaught), R(20), U8(3), + B(SuspendGenerator), R(2), R(0), U8(20), U8(2), /* 57 S> */ B(Return), - B(RestoreGeneratorRegisters), R(2), R(0), U8(20), - B(LdaSmi), I8(-2), - B(Star), R(11), - B(InvokeIntrinsic), U8(Runtime::k_GeneratorGetInputOrDebugPos), R(2), U8(1), + B(ResumeGenerator), R(2), R(12), R(0), U8(20), B(Star), R(20), B(InvokeIntrinsic), U8(Runtime::k_GeneratorGetResumeMode), R(2), U8(1), B(Star), R(21), @@ -171,111 +189,78 @@ bytecodes: [ B(JumpIfTrue), U8(5), B(Ldar), R(20), B(ReThrow), - B(Ldar), R(20), - B(Jump), U8(20), - B(Star), R(20), - B(Ldar), R(closure), - B(CreateCatchContext), R(20), U8(10), U8(14), - B(Star), R(19), - B(LdaTheHole), - B(SetPendingMessage), - B(Ldar), R(19), - B(PushContext), R(20), - B(PopContext), R(20), - B(Jump), U8(74), - B(Mov), R(8), R(19), - B(Mov), R(4), 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(10), R(21), - B(CallJSRuntime), U8(%async_function_await_uncaught), R(19), U8(3), - B(SuspendGenerator), R(2), R(0), U8(19), U8(2), - /* 57 S> */ B(Return), - B(RestoreGeneratorRegisters), R(2), R(0), U8(19), - B(LdaSmi), I8(-2), - B(Star), R(11), - B(InvokeIntrinsic), U8(Runtime::k_GeneratorGetInputOrDebugPos), R(2), U8(1), - B(Star), R(19), - B(InvokeIntrinsic), U8(Runtime::k_GeneratorGetResumeMode), R(2), U8(1), - B(Star), R(20), - B(LdaZero), - B(TestEqualStrictNoFeedback), R(20), - B(JumpIfTrue), U8(5), - B(Ldar), R(19), - B(ReThrow), - B(Mov), R(19), R(9), - B(InvokeIntrinsic), U8(Runtime::k_IsJSReceiver), R(19), U8(1), + B(Mov), R(20), R(10), + B(InvokeIntrinsic), U8(Runtime::k_IsJSReceiver), R(20), U8(1), B(JumpIfToBooleanFalse), U8(4), B(Jump), U8(7), - B(CallRuntime), U16(Runtime::kThrowIteratorResultNotAnObject), R(9), U8(1), - B(Ldar), R(18), + B(CallRuntime), U16(Runtime::kThrowIteratorResultNotAnObject), R(10), U8(1), + B(Ldar), R(19), B(SetPendingMessage), B(LdaZero), - B(TestEqualStrictNoFeedback), R(16), + B(TestEqualStrictNoFeedback), R(17), B(JumpIfFalse), U8(5), - B(Ldar), R(17), + B(Ldar), R(18), B(ReThrow), B(LdaUndefined), - B(Star), R(17), - B(Mov), R(10), R(16), - B(CallJSRuntime), U8(%promise_resolve), R(16), U8(2), + B(Star), R(18), + B(Mov), R(11), R(17), + B(CallJSRuntime), U8(%promise_resolve), R(17), U8(2), B(LdaZero), - B(Star), R(12), - B(Mov), R(10), R(13), + B(Star), R(13), + B(Mov), R(11), R(14), B(Jump), U8(58), B(Jump), U8(42), - B(Star), R(16), + B(Star), R(17), B(Ldar), R(closure), - B(CreateCatchContext), R(16), U8(10), U8(15), - B(Star), R(15), + B(CreateCatchContext), R(17), U8(10), U8(14), + B(Star), R(16), B(LdaTheHole), B(SetPendingMessage), - B(Ldar), R(15), - B(PushContext), R(16), + B(Ldar), R(16), + B(PushContext), R(17), B(LdaImmutableCurrentContextSlot), U8(4), - B(Star), R(18), - B(LdaFalse), B(Star), R(19), - B(Mov), R(10), R(17), - B(CallJSRuntime), U8(%promise_internal_reject), R(17), U8(3), - B(PopContext), R(16), + B(LdaFalse), + B(Star), R(20), + B(Mov), R(11), R(18), + B(CallJSRuntime), U8(%promise_internal_reject), R(18), U8(3), + B(PopContext), R(17), B(LdaZero), - B(Star), R(12), - B(Mov), R(10), R(13), + B(Star), R(13), + B(Mov), R(11), R(14), B(Jump), U8(16), B(LdaSmi), I8(-1), + B(Star), R(14), B(Star), R(13), - B(Star), R(12), B(Jump), U8(8), - B(Star), R(13), + B(Star), R(14), B(LdaSmi), I8(1), - B(Star), R(12), + B(Star), R(13), B(LdaTheHole), B(SetPendingMessage), - B(Star), R(14), - B(CallJSRuntime), U8(%async_function_promise_release), R(10), U8(1), - B(Ldar), R(14), + B(Star), R(15), + B(CallJSRuntime), U8(%async_function_promise_release), R(11), U8(1), + B(Ldar), R(15), B(SetPendingMessage), - B(Ldar), R(12), - B(SwitchOnSmiNoFeedback), U8(16), U8(2), I8(0), - B(Jump), U8(8), B(Ldar), R(13), + B(SwitchOnSmiNoFeedback), U8(15), U8(2), I8(0), + B(Jump), U8(8), + B(Ldar), R(14), /* 57 S> */ B(Return), - B(Ldar), R(13), + B(Ldar), R(14), B(ReThrow), B(LdaUndefined), /* 57 S> */ B(Return), ] constant pool: [ - Smi [89], - Smi [339], - Smi [419], + Smi [95], + Smi [332], + Smi [391], TUPLE2_TYPE, SYMBOL_TYPE, SYMBOL_TYPE, - Smi [40], ONE_BYTE_INTERNALIZED_STRING_TYPE ["next"], + Smi [34], ONE_BYTE_INTERNALIZED_STRING_TYPE ["done"], ONE_BYTE_INTERNALIZED_STRING_TYPE ["value"], ONE_BYTE_INTERNALIZED_STRING_TYPE [".catch"], @@ -283,16 +268,15 @@ constant pool: [ ONE_BYTE_INTERNALIZED_STRING_TYPE ["return"], ONE_BYTE_INTERNALIZED_STRING_TYPE [""], FIXED_ARRAY_TYPE, - FIXED_ARRAY_TYPE, Smi [6], Smi [9], ] handlers: [ - [46, 548, 556], - [49, 506, 508], - [55, 257, 265], - [58, 217, 219], - [325, 383, 385], + [46, 513, 521], + [49, 471, 473], + [55, 250, 258], + [58, 210, 212], + [318, 369, 371], ] --- @@ -302,156 +286,174 @@ snippet: " } f(); " -frame size: 23 +frame size: 24 parameter count: 1 -bytecode array length: 618 +bytecode array length: 583 bytecodes: [ B(Ldar), R(2), B(JumpIfUndefined), U8(18), B(InvokeIntrinsic), U8(Runtime::k_GeneratorGetContext), R(2), U8(1), - B(PushContext), R(12), + B(PushContext), R(13), B(RestoreGeneratorState), R(2), - B(Star), R(11), + B(Star), R(12), B(SwitchOnSmiNoFeedback), U8(0), U8(3), I8(0), - B(Abort), U8(42), + B(Abort), U8(15), B(LdaSmi), I8(-2), - B(Star), R(11), - 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(12), + B(Mov), R(closure), R(13), + B(Mov), R(this), R(14), + B(InvokeIntrinsic), U8(Runtime::k_CreateJSGeneratorObject), R(13), U8(2), B(Star), R(2), /* 16 E> */ B(StackCheck), B(CallJSRuntime), U8(%async_function_promise_create), R(0), U8(0), - B(Star), R(10), - B(Mov), R(context), R(14), + B(Star), R(11), B(Mov), R(context), R(15), + B(Mov), R(context), R(16), B(LdaZero), - B(Star), R(6), - B(Mov), R(context), R(18), + B(Star), R(7), B(Mov), R(context), R(19), + B(Mov), R(context), R(20), /* 43 S> */ B(CreateArrayLiteral), U8(3), U8(0), U8(37), - B(Star), R(20), - B(LdaNamedProperty), R(20), U8(4), U8(1), + B(Star), R(21), + B(LdaNamedProperty), R(21), U8(4), U8(1), B(JumpIfUndefined), U8(17), B(JumpIfNull), U8(15), - B(Star), R(21), - B(CallProperty0), R(21), R(20), U8(3), + B(Star), R(22), + B(CallProperty0), R(22), R(21), U8(3), B(JumpIfJSReceiver), U8(23), B(CallRuntime), U16(Runtime::kThrowSymbolAsyncIteratorInvalid), R(0), U8(0), - B(LdaNamedProperty), R(20), U8(5), U8(5), - B(Star), R(21), - B(CallProperty0), R(21), R(20), U8(7), - B(Star), R(21), - B(InvokeIntrinsic), U8(Runtime::k_CreateAsyncFromSyncIterator), R(21), U8(1), + B(LdaNamedProperty), R(21), U8(5), U8(5), + B(Star), R(22), + B(CallProperty0), R(22), R(21), U8(7), + B(Star), R(22), + B(InvokeIntrinsic), U8(Runtime::k_CreateAsyncFromSyncIterator), R(22), U8(1), B(Star), R(4), - B(Ldar), R(11), - B(SwitchOnSmiNoFeedback), U8(6), U8(1), I8(0), + /* 43 E> */ B(LdaNamedProperty), R(4), U8(6), U8(9), + B(Star), R(5), + B(Ldar), R(12), + B(SwitchOnSmiNoFeedback), U8(7), U8(1), I8(0), B(LdaSmi), I8(-2), - /* 43 E> */ B(TestEqualStrictNoFeedback), R(11), + B(TestEqualStrictNoFeedback), R(12), B(JumpIfTrue), U8(4), - B(Abort), U8(42), - /* 40 S> */ B(LdaNamedProperty), R(4), U8(7), U8(9), - B(Star), R(20), - B(CallProperty0), R(20), R(4), U8(11), - B(Star), R(21), - B(Mov), R(2), R(20), - B(Mov), R(10), R(22), - B(CallJSRuntime), U8(%async_function_await_uncaught), R(20), U8(3), - B(SuspendGenerator), R(2), R(0), U8(20), U8(0), + B(Abort), U8(15), + /* 40 S> */ B(CallProperty0), R(5), R(4), U8(11), + B(Star), R(22), + B(Mov), R(2), R(21), + B(Mov), R(11), R(23), + B(CallJSRuntime), U8(%async_function_await_uncaught), R(21), U8(3), + B(SuspendGenerator), R(2), R(0), U8(21), U8(0), /* 68 S> */ B(Return), - B(RestoreGeneratorRegisters), R(2), R(0), U8(20), - B(LdaSmi), I8(-2), - B(Star), R(11), - B(InvokeIntrinsic), U8(Runtime::k_GeneratorGetInputOrDebugPos), R(2), U8(1), - B(Star), R(20), - B(InvokeIntrinsic), U8(Runtime::k_GeneratorGetResumeMode), R(2), U8(1), + B(ResumeGenerator), R(2), R(12), R(0), U8(21), B(Star), R(21), + B(InvokeIntrinsic), U8(Runtime::k_GeneratorGetResumeMode), R(2), U8(1), + B(Star), R(22), B(LdaZero), - B(TestEqualStrictNoFeedback), R(21), + B(TestEqualStrictNoFeedback), R(22), B(JumpIfTrue), U8(5), - B(Ldar), R(20), + B(Ldar), R(21), B(ReThrow), - B(Mov), R(20), R(5), - /* 40 E> */ B(InvokeIntrinsic), U8(Runtime::k_IsJSReceiver), R(20), U8(1), + B(Mov), R(21), R(6), + /* 40 E> */ B(InvokeIntrinsic), U8(Runtime::k_IsJSReceiver), R(21), U8(1), B(ToBooleanLogicalNot), B(JumpIfFalse), U8(7), - B(CallRuntime), U16(Runtime::kThrowIteratorResultNotAnObject), R(5), U8(1), - B(LdaNamedProperty), R(5), U8(8), U8(13), + B(CallRuntime), U16(Runtime::kThrowIteratorResultNotAnObject), R(6), U8(1), + B(LdaNamedProperty), R(6), U8(8), U8(13), B(JumpIfToBooleanTrue), U8(27), - B(LdaNamedProperty), R(5), U8(9), U8(15), - B(Star), R(7), + B(LdaNamedProperty), R(6), U8(9), U8(15), + B(Star), R(8), B(LdaSmi), I8(2), - B(Star), R(6), - B(Mov), R(7), R(3), + B(Star), R(7), + B(Mov), R(8), R(3), /* 23 E> */ B(StackCheck), B(Mov), R(3), R(0), /* 56 S> */ B(LdaZero), - B(Star), R(16), - B(Mov), R(7), R(17), + B(Star), R(17), + B(Mov), R(8), R(18), B(Jump), U8(56), B(Jump), U8(40), - B(Star), R(20), + B(Star), R(21), B(Ldar), R(closure), - B(CreateCatchContext), R(20), U8(10), U8(11), - B(Star), R(19), + B(CreateCatchContext), R(21), U8(10), U8(11), + B(Star), R(20), B(LdaTheHole), B(SetPendingMessage), - B(Ldar), R(19), - B(PushContext), R(20), + B(Ldar), R(20), + B(PushContext), R(21), B(LdaSmi), I8(2), - B(TestEqualStrict), R(6), U8(17), + B(TestEqualStrict), R(7), U8(17), B(JumpIfFalse), U8(6), B(LdaSmi), I8(1), - B(Star), R(6), + B(Star), R(7), B(LdaImmutableCurrentContextSlot), U8(4), - B(Star), R(21), - B(CallRuntime), U16(Runtime::kReThrow), R(21), U8(1), - B(PopContext), R(20), + B(Star), R(22), + B(CallRuntime), U16(Runtime::kReThrow), R(22), U8(1), + B(PopContext), R(21), B(LdaSmi), I8(-1), + B(Star), R(18), B(Star), R(17), - B(Star), R(16), B(Jump), U8(8), - B(Star), R(17), + B(Star), R(18), B(LdaSmi), I8(1), - B(Star), R(16), + B(Star), R(17), B(LdaTheHole), B(SetPendingMessage), - B(Star), R(18), + B(Star), R(19), B(LdaZero), - B(TestEqualStrict), R(6), U8(18), - B(JumpIfTrue), U8(199), + B(TestEqualStrict), R(7), U8(18), + B(JumpIfTrue), U8(171), B(LdaNamedProperty), R(4), U8(12), U8(19), - B(Star), R(8), + B(Star), R(9), B(TestUndetectable), B(JumpIfFalse), U8(4), - B(Jump), U8(188), + B(Jump), U8(160), B(LdaSmi), I8(1), - B(TestEqualStrict), R(6), U8(21), - B(JumpIfFalse), U8(109), - B(Ldar), R(8), + B(TestEqualStrict), R(7), U8(21), + B(JumpIfFalse), U8(88), + B(Ldar), R(9), B(TestTypeOf), U8(6), B(JumpIfFalse), U8(4), B(Jump), U8(18), - B(Wide), B(LdaSmi), I16(143), - B(Star), R(19), - B(LdaConstant), U8(13), + B(Wide), B(LdaSmi), I16(144), B(Star), R(20), - B(CallRuntime), U16(Runtime::kNewTypeError), R(19), U8(2), + B(LdaConstant), U8(13), + B(Star), R(21), + B(CallRuntime), U16(Runtime::kNewTypeError), R(20), U8(2), B(Throw), - B(Mov), R(context), R(19), - B(Mov), R(8), R(20), + B(Mov), R(context), R(20), + B(Mov), R(9), R(21), + B(Mov), R(4), R(22), + B(InvokeIntrinsic), U8(Runtime::k_Call), R(21), U8(2), + B(Star), R(22), + B(Mov), R(2), R(21), + B(Mov), R(11), R(23), + B(CallJSRuntime), U8(%async_function_await_caught), R(21), U8(3), + B(SuspendGenerator), R(2), R(0), U8(21), U8(1), + /* 68 S> */ B(Return), + B(ResumeGenerator), R(2), R(12), R(0), U8(21), + B(Star), R(21), + B(InvokeIntrinsic), U8(Runtime::k_GeneratorGetResumeMode), R(2), U8(1), + B(Star), R(22), + B(LdaZero), + B(TestEqualStrictNoFeedback), R(22), + B(JumpIfTrue), U8(5), + B(Ldar), R(21), + B(ReThrow), + B(Ldar), R(21), + B(Jump), U8(6), + B(LdaTheHole), + B(SetPendingMessage), + B(Ldar), R(20), + B(Jump), U8(67), + B(Mov), R(9), R(20), B(Mov), R(4), 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(10), R(22), - B(CallJSRuntime), U8(%async_function_await_caught), R(20), U8(3), - B(SuspendGenerator), R(2), R(0), U8(20), U8(1), + B(Mov), R(11), R(22), + B(CallJSRuntime), U8(%async_function_await_uncaught), R(20), U8(3), + B(SuspendGenerator), R(2), R(0), U8(20), U8(2), /* 68 S> */ B(Return), - B(RestoreGeneratorRegisters), R(2), R(0), U8(20), - B(LdaSmi), I8(-2), - B(Star), R(11), - B(InvokeIntrinsic), U8(Runtime::k_GeneratorGetInputOrDebugPos), R(2), U8(1), + B(ResumeGenerator), R(2), R(12), R(0), U8(20), B(Star), R(20), B(InvokeIntrinsic), U8(Runtime::k_GeneratorGetResumeMode), R(2), U8(1), B(Star), R(21), @@ -460,127 +462,93 @@ bytecodes: [ B(JumpIfTrue), U8(5), B(Ldar), R(20), B(ReThrow), - B(Ldar), R(20), - B(Jump), U8(20), - B(Star), R(20), - B(Ldar), R(closure), - B(CreateCatchContext), R(20), U8(10), U8(14), - B(Star), R(19), - B(LdaTheHole), - B(SetPendingMessage), - B(Ldar), R(19), - B(PushContext), R(20), - B(PopContext), R(20), - B(Jump), U8(74), - B(Mov), R(8), R(19), - B(Mov), R(4), 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(10), R(21), - B(CallJSRuntime), U8(%async_function_await_uncaught), R(19), U8(3), - B(SuspendGenerator), R(2), R(0), U8(19), U8(2), - /* 68 S> */ B(Return), - B(RestoreGeneratorRegisters), R(2), R(0), U8(19), - B(LdaSmi), I8(-2), - B(Star), R(11), - B(InvokeIntrinsic), U8(Runtime::k_GeneratorGetInputOrDebugPos), R(2), U8(1), - B(Star), R(19), - B(InvokeIntrinsic), U8(Runtime::k_GeneratorGetResumeMode), R(2), U8(1), - B(Star), R(20), - B(LdaZero), - B(TestEqualStrictNoFeedback), R(20), - B(JumpIfTrue), U8(5), - B(Ldar), R(19), - B(ReThrow), - B(Mov), R(19), R(9), - B(InvokeIntrinsic), U8(Runtime::k_IsJSReceiver), R(19), U8(1), + B(Mov), R(20), R(10), + B(InvokeIntrinsic), U8(Runtime::k_IsJSReceiver), R(20), U8(1), B(JumpIfToBooleanFalse), U8(4), B(Jump), U8(7), - B(CallRuntime), U16(Runtime::kThrowIteratorResultNotAnObject), R(9), U8(1), - B(Ldar), R(18), + B(CallRuntime), U16(Runtime::kThrowIteratorResultNotAnObject), R(10), U8(1), + B(Ldar), R(19), B(SetPendingMessage), - B(Ldar), R(16), - B(SwitchOnSmiNoFeedback), U8(15), U8(2), I8(0), + B(Ldar), R(17), + B(SwitchOnSmiNoFeedback), U8(14), U8(2), I8(0), B(Jump), U8(13), B(LdaZero), - B(Star), R(12), - B(Mov), R(17), R(13), + B(Star), R(13), + B(Mov), R(18), R(14), B(Jump), U8(81), - B(Ldar), R(17), + B(Ldar), R(18), B(ReThrow), B(LdaUndefined), - B(Star), R(17), - B(Mov), R(10), R(16), - B(CallJSRuntime), U8(%promise_resolve), R(16), U8(2), + B(Star), R(18), + B(Mov), R(11), R(17), + B(CallJSRuntime), U8(%promise_resolve), R(17), U8(2), B(LdaSmi), I8(1), - B(Star), R(12), - B(Mov), R(10), R(13), + B(Star), R(13), + B(Mov), R(11), R(14), B(Jump), U8(59), B(Jump), U8(43), - B(Star), R(16), + B(Star), R(17), B(Ldar), R(closure), - B(CreateCatchContext), R(16), U8(10), U8(17), - B(Star), R(15), + B(CreateCatchContext), R(17), U8(10), U8(16), + B(Star), R(16), B(LdaTheHole), B(SetPendingMessage), - B(Ldar), R(15), - B(PushContext), R(16), + B(Ldar), R(16), + B(PushContext), R(17), B(LdaImmutableCurrentContextSlot), U8(4), - B(Star), R(18), - B(LdaFalse), B(Star), R(19), - B(Mov), R(10), R(17), - B(CallJSRuntime), U8(%promise_internal_reject), R(17), U8(3), - B(PopContext), R(16), + B(LdaFalse), + B(Star), R(20), + B(Mov), R(11), R(18), + B(CallJSRuntime), U8(%promise_internal_reject), R(18), U8(3), + B(PopContext), R(17), B(LdaSmi), I8(1), - B(Star), R(12), - B(Mov), R(10), R(13), + B(Star), R(13), + B(Mov), R(11), R(14), B(Jump), U8(16), B(LdaSmi), I8(-1), + B(Star), R(14), B(Star), R(13), - B(Star), R(12), B(Jump), U8(8), - B(Star), R(13), + B(Star), R(14), B(LdaSmi), I8(2), - B(Star), R(12), + B(Star), R(13), B(LdaTheHole), B(SetPendingMessage), - B(Star), R(14), - B(CallJSRuntime), U8(%async_function_promise_release), R(10), U8(1), - B(Ldar), R(14), + B(Star), R(15), + B(CallJSRuntime), U8(%async_function_promise_release), R(11), U8(1), + B(Ldar), R(15), B(SetPendingMessage), - B(Ldar), R(12), - B(SwitchOnSmiNoFeedback), U8(18), U8(3), I8(0), + B(Ldar), R(13), + B(SwitchOnSmiNoFeedback), U8(17), U8(3), I8(0), B(Jump), U8(21), - B(Mov), R(10), R(15), - B(Mov), R(13), R(16), - B(CallJSRuntime), U8(%promise_resolve), R(15), U8(2), - B(Ldar), R(10), + B(Mov), R(11), R(16), + B(Mov), R(14), R(17), + B(CallJSRuntime), U8(%promise_resolve), R(16), U8(2), + B(Ldar), R(11), /* 68 S> */ B(Return), - B(Ldar), R(13), + B(Ldar), R(14), /* 68 S> */ B(Return), - B(Ldar), R(13), + B(Ldar), R(14), B(ReThrow), B(LdaUndefined), /* 68 S> */ B(Return), ] constant pool: [ - Smi [89], - Smi [342], - Smi [422], + Smi [95], + Smi [335], + Smi [394], TUPLE2_TYPE, SYMBOL_TYPE, SYMBOL_TYPE, - Smi [40], ONE_BYTE_INTERNALIZED_STRING_TYPE ["next"], + Smi [34], ONE_BYTE_INTERNALIZED_STRING_TYPE ["done"], ONE_BYTE_INTERNALIZED_STRING_TYPE ["value"], ONE_BYTE_INTERNALIZED_STRING_TYPE [".catch"], FIXED_ARRAY_TYPE, ONE_BYTE_INTERNALIZED_STRING_TYPE ["return"], ONE_BYTE_INTERNALIZED_STRING_TYPE [""], - FIXED_ARRAY_TYPE, Smi [6], Smi [14], FIXED_ARRAY_TYPE, @@ -589,11 +557,11 @@ constant pool: [ Smi [22], ] handlers: [ - [46, 564, 572], - [49, 521, 523], - [55, 259, 267], - [58, 219, 221], - [328, 386, 388], + [46, 529, 537], + [49, 486, 488], + [55, 252, 260], + [58, 212, 214], + [321, 372, 374], ] --- @@ -606,87 +574,84 @@ snippet: " } f(); " -frame size: 23 +frame size: 24 parameter count: 1 -bytecode array length: 607 +bytecode array length: 572 bytecodes: [ B(Ldar), R(2), B(JumpIfUndefined), U8(18), B(InvokeIntrinsic), U8(Runtime::k_GeneratorGetContext), R(2), U8(1), - B(PushContext), R(12), + B(PushContext), R(13), B(RestoreGeneratorState), R(2), - B(Star), R(11), + B(Star), R(12), B(SwitchOnSmiNoFeedback), U8(0), U8(3), I8(0), - B(Abort), U8(42), + B(Abort), U8(15), B(LdaSmi), I8(-2), - B(Star), R(11), - 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(12), + B(Mov), R(closure), R(13), + B(Mov), R(this), R(14), + B(InvokeIntrinsic), U8(Runtime::k_CreateJSGeneratorObject), R(13), U8(2), B(Star), R(2), /* 16 E> */ B(StackCheck), B(CallJSRuntime), U8(%async_function_promise_create), R(0), U8(0), - B(Star), R(10), - B(Mov), R(context), R(14), + B(Star), R(11), B(Mov), R(context), R(15), + B(Mov), R(context), R(16), B(LdaZero), - B(Star), R(6), - B(Mov), R(context), R(18), + B(Star), R(7), B(Mov), R(context), R(19), + B(Mov), R(context), R(20), /* 43 S> */ B(CreateArrayLiteral), U8(3), U8(0), U8(37), - B(Star), R(20), - B(LdaNamedProperty), R(20), U8(4), U8(1), + B(Star), R(21), + B(LdaNamedProperty), R(21), U8(4), U8(1), B(JumpIfUndefined), U8(17), B(JumpIfNull), U8(15), - B(Star), R(21), - B(CallProperty0), R(21), R(20), U8(3), + B(Star), R(22), + B(CallProperty0), R(22), R(21), U8(3), B(JumpIfJSReceiver), U8(23), B(CallRuntime), U16(Runtime::kThrowSymbolAsyncIteratorInvalid), R(0), U8(0), - B(LdaNamedProperty), R(20), U8(5), U8(5), - B(Star), R(21), - B(CallProperty0), R(21), R(20), U8(7), - B(Star), R(21), - B(InvokeIntrinsic), U8(Runtime::k_CreateAsyncFromSyncIterator), R(21), U8(1), + B(LdaNamedProperty), R(21), U8(5), U8(5), + B(Star), R(22), + B(CallProperty0), R(22), R(21), U8(7), + B(Star), R(22), + B(InvokeIntrinsic), U8(Runtime::k_CreateAsyncFromSyncIterator), R(22), U8(1), B(Star), R(4), - B(Ldar), R(11), - B(SwitchOnSmiNoFeedback), U8(6), U8(1), I8(0), + /* 43 E> */ B(LdaNamedProperty), R(4), U8(6), U8(9), + B(Star), R(5), + B(Ldar), R(12), + B(SwitchOnSmiNoFeedback), U8(7), U8(1), I8(0), B(LdaSmi), I8(-2), - /* 43 E> */ B(TestEqualStrictNoFeedback), R(11), + B(TestEqualStrictNoFeedback), R(12), B(JumpIfTrue), U8(4), - B(Abort), U8(42), - /* 40 S> */ B(LdaNamedProperty), R(4), U8(7), U8(9), - B(Star), R(20), - B(CallProperty0), R(20), R(4), U8(11), - B(Star), R(21), - B(Mov), R(2), R(20), - B(Mov), R(10), R(22), - B(CallJSRuntime), U8(%async_function_await_uncaught), R(20), U8(3), - B(SuspendGenerator), R(2), R(0), U8(20), U8(0), + B(Abort), U8(15), + /* 40 S> */ B(CallProperty0), R(5), R(4), U8(11), + B(Star), R(22), + B(Mov), R(2), R(21), + B(Mov), R(11), R(23), + B(CallJSRuntime), U8(%async_function_await_uncaught), R(21), U8(3), + B(SuspendGenerator), R(2), R(0), U8(21), U8(0), /* 114 S> */ B(Return), - B(RestoreGeneratorRegisters), R(2), R(0), U8(20), - B(LdaSmi), I8(-2), - B(Star), R(11), - B(InvokeIntrinsic), U8(Runtime::k_GeneratorGetInputOrDebugPos), R(2), U8(1), - B(Star), R(20), - B(InvokeIntrinsic), U8(Runtime::k_GeneratorGetResumeMode), R(2), U8(1), + B(ResumeGenerator), R(2), R(12), R(0), U8(21), B(Star), R(21), + B(InvokeIntrinsic), U8(Runtime::k_GeneratorGetResumeMode), R(2), U8(1), + B(Star), R(22), B(LdaZero), - B(TestEqualStrictNoFeedback), R(21), + B(TestEqualStrictNoFeedback), R(22), B(JumpIfTrue), U8(5), - B(Ldar), R(20), + B(Ldar), R(21), B(ReThrow), - B(Mov), R(20), R(5), - /* 40 E> */ B(InvokeIntrinsic), U8(Runtime::k_IsJSReceiver), R(20), U8(1), + B(Mov), R(21), R(6), + /* 40 E> */ B(InvokeIntrinsic), U8(Runtime::k_IsJSReceiver), R(21), U8(1), B(ToBooleanLogicalNot), B(JumpIfFalse), U8(7), - B(CallRuntime), U16(Runtime::kThrowIteratorResultNotAnObject), R(5), U8(1), - B(LdaNamedProperty), R(5), U8(8), U8(13), + B(CallRuntime), U16(Runtime::kThrowIteratorResultNotAnObject), R(6), U8(1), + B(LdaNamedProperty), R(6), U8(8), U8(13), B(JumpIfToBooleanTrue), U8(43), - B(LdaNamedProperty), R(5), U8(9), U8(15), - B(Star), R(7), + B(LdaNamedProperty), R(6), U8(9), U8(15), + B(Star), R(8), B(LdaSmi), I8(2), - B(Star), R(6), - B(Mov), R(7), R(3), + B(Star), R(7), + B(Mov), R(8), R(3), /* 23 E> */ B(StackCheck), B(Mov), R(3), R(0), /* 63 S> */ B(LdaSmi), I8(10), @@ -698,71 +663,92 @@ bytecodes: [ B(JumpIfFalse), U8(4), /* 103 S> */ B(Jump), U8(8), B(LdaZero), - B(Star), R(6), - B(JumpLoop), U8(129), I8(0), + B(Star), R(7), + B(JumpLoop), U8(116), I8(0), B(Jump), U8(40), - B(Star), R(20), + B(Star), R(21), B(Ldar), R(closure), - B(CreateCatchContext), R(20), U8(10), U8(11), - B(Star), R(19), + B(CreateCatchContext), R(21), U8(10), U8(11), + B(Star), R(20), B(LdaTheHole), B(SetPendingMessage), - B(Ldar), R(19), - B(PushContext), R(20), + B(Ldar), R(20), + B(PushContext), R(21), B(LdaSmi), I8(2), - B(TestEqualStrict), R(6), U8(19), + B(TestEqualStrict), R(7), U8(19), B(JumpIfFalse), U8(6), B(LdaSmi), I8(1), - B(Star), R(6), + B(Star), R(7), B(LdaImmutableCurrentContextSlot), U8(4), - B(Star), R(21), - B(CallRuntime), U16(Runtime::kReThrow), R(21), U8(1), - B(PopContext), R(20), + B(Star), R(22), + B(CallRuntime), U16(Runtime::kReThrow), R(22), U8(1), + B(PopContext), R(21), B(LdaSmi), I8(-1), + B(Star), R(18), B(Star), R(17), - B(Star), R(16), B(Jump), U8(7), - B(Star), R(17), + B(Star), R(18), B(LdaZero), - B(Star), R(16), + B(Star), R(17), B(LdaTheHole), B(SetPendingMessage), - B(Star), R(18), + B(Star), R(19), B(LdaZero), - B(TestEqualStrict), R(6), U8(20), - B(JumpIfTrue), U8(199), + B(TestEqualStrict), R(7), U8(20), + B(JumpIfTrue), U8(171), B(LdaNamedProperty), R(4), U8(12), U8(21), - B(Star), R(8), + B(Star), R(9), B(TestUndetectable), B(JumpIfFalse), U8(4), - B(Jump), U8(188), + B(Jump), U8(160), B(LdaSmi), I8(1), - B(TestEqualStrict), R(6), U8(23), - B(JumpIfFalse), U8(109), - B(Ldar), R(8), + B(TestEqualStrict), R(7), U8(23), + B(JumpIfFalse), U8(88), + B(Ldar), R(9), B(TestTypeOf), U8(6), B(JumpIfFalse), U8(4), B(Jump), U8(18), - B(Wide), B(LdaSmi), I16(143), - B(Star), R(19), - B(LdaConstant), U8(13), + B(Wide), B(LdaSmi), I16(144), B(Star), R(20), - B(CallRuntime), U16(Runtime::kNewTypeError), R(19), U8(2), + B(LdaConstant), U8(13), + B(Star), R(21), + B(CallRuntime), U16(Runtime::kNewTypeError), R(20), U8(2), B(Throw), - B(Mov), R(context), R(19), - B(Mov), R(8), R(20), + B(Mov), R(context), R(20), + B(Mov), R(9), R(21), + B(Mov), R(4), R(22), + B(InvokeIntrinsic), U8(Runtime::k_Call), R(21), U8(2), + B(Star), R(22), + B(Mov), R(2), R(21), + B(Mov), R(11), R(23), + B(CallJSRuntime), U8(%async_function_await_caught), R(21), U8(3), + B(SuspendGenerator), R(2), R(0), U8(21), U8(1), + /* 114 S> */ B(Return), + B(ResumeGenerator), R(2), R(12), R(0), U8(21), + B(Star), R(21), + B(InvokeIntrinsic), U8(Runtime::k_GeneratorGetResumeMode), R(2), U8(1), + B(Star), R(22), + B(LdaZero), + B(TestEqualStrictNoFeedback), R(22), + B(JumpIfTrue), U8(5), + B(Ldar), R(21), + B(ReThrow), + B(Ldar), R(21), + B(Jump), U8(6), + B(LdaTheHole), + B(SetPendingMessage), + B(Ldar), R(20), + B(Jump), U8(67), + B(Mov), R(9), R(20), B(Mov), R(4), 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(10), R(22), - B(CallJSRuntime), U8(%async_function_await_caught), R(20), U8(3), - B(SuspendGenerator), R(2), R(0), U8(20), U8(1), + B(Mov), R(11), R(22), + B(CallJSRuntime), U8(%async_function_await_uncaught), R(20), U8(3), + B(SuspendGenerator), R(2), R(0), U8(20), U8(2), /* 114 S> */ B(Return), - B(RestoreGeneratorRegisters), R(2), R(0), U8(20), - B(LdaSmi), I8(-2), - B(Star), R(11), - B(InvokeIntrinsic), U8(Runtime::k_GeneratorGetInputOrDebugPos), R(2), U8(1), + B(ResumeGenerator), R(2), R(12), R(0), U8(20), B(Star), R(20), B(InvokeIntrinsic), U8(Runtime::k_GeneratorGetResumeMode), R(2), U8(1), B(Star), R(21), @@ -771,111 +757,78 @@ bytecodes: [ B(JumpIfTrue), U8(5), B(Ldar), R(20), B(ReThrow), - B(Ldar), R(20), - B(Jump), U8(20), - B(Star), R(20), - B(Ldar), R(closure), - B(CreateCatchContext), R(20), U8(10), U8(14), - B(Star), R(19), - B(LdaTheHole), - B(SetPendingMessage), - B(Ldar), R(19), - B(PushContext), R(20), - B(PopContext), R(20), - B(Jump), U8(74), - B(Mov), R(8), R(19), - B(Mov), R(4), 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(10), R(21), - B(CallJSRuntime), U8(%async_function_await_uncaught), R(19), U8(3), - B(SuspendGenerator), R(2), R(0), U8(19), U8(2), - /* 114 S> */ B(Return), - B(RestoreGeneratorRegisters), R(2), R(0), U8(19), - B(LdaSmi), I8(-2), - B(Star), R(11), - B(InvokeIntrinsic), U8(Runtime::k_GeneratorGetInputOrDebugPos), R(2), U8(1), - B(Star), R(19), - B(InvokeIntrinsic), U8(Runtime::k_GeneratorGetResumeMode), R(2), U8(1), - B(Star), R(20), - B(LdaZero), - B(TestEqualStrictNoFeedback), R(20), - B(JumpIfTrue), U8(5), - B(Ldar), R(19), - B(ReThrow), - B(Mov), R(19), R(9), - B(InvokeIntrinsic), U8(Runtime::k_IsJSReceiver), R(19), U8(1), + B(Mov), R(20), R(10), + B(InvokeIntrinsic), U8(Runtime::k_IsJSReceiver), R(20), U8(1), B(JumpIfToBooleanFalse), U8(4), B(Jump), U8(7), - B(CallRuntime), U16(Runtime::kThrowIteratorResultNotAnObject), R(9), U8(1), - B(Ldar), R(18), + B(CallRuntime), U16(Runtime::kThrowIteratorResultNotAnObject), R(10), U8(1), + B(Ldar), R(19), B(SetPendingMessage), B(LdaZero), - B(TestEqualStrictNoFeedback), R(16), + B(TestEqualStrictNoFeedback), R(17), B(JumpIfFalse), U8(5), - B(Ldar), R(17), + B(Ldar), R(18), B(ReThrow), B(LdaUndefined), - B(Star), R(17), - B(Mov), R(10), R(16), - B(CallJSRuntime), U8(%promise_resolve), R(16), U8(2), + B(Star), R(18), + B(Mov), R(11), R(17), + B(CallJSRuntime), U8(%promise_resolve), R(17), U8(2), B(LdaZero), - B(Star), R(12), - B(Mov), R(10), R(13), + B(Star), R(13), + B(Mov), R(11), R(14), B(Jump), U8(58), B(Jump), U8(42), - B(Star), R(16), + B(Star), R(17), B(Ldar), R(closure), - B(CreateCatchContext), R(16), U8(10), U8(15), - B(Star), R(15), + B(CreateCatchContext), R(17), U8(10), U8(14), + B(Star), R(16), B(LdaTheHole), B(SetPendingMessage), - B(Ldar), R(15), - B(PushContext), R(16), + B(Ldar), R(16), + B(PushContext), R(17), B(LdaImmutableCurrentContextSlot), U8(4), - B(Star), R(18), - B(LdaFalse), B(Star), R(19), - B(Mov), R(10), R(17), - B(CallJSRuntime), U8(%promise_internal_reject), R(17), U8(3), - B(PopContext), R(16), + B(LdaFalse), + B(Star), R(20), + B(Mov), R(11), R(18), + B(CallJSRuntime), U8(%promise_internal_reject), R(18), U8(3), + B(PopContext), R(17), B(LdaZero), - B(Star), R(12), - B(Mov), R(10), R(13), + B(Star), R(13), + B(Mov), R(11), R(14), B(Jump), U8(16), B(LdaSmi), I8(-1), + B(Star), R(14), B(Star), R(13), - B(Star), R(12), B(Jump), U8(8), - B(Star), R(13), + B(Star), R(14), B(LdaSmi), I8(1), - B(Star), R(12), + B(Star), R(13), B(LdaTheHole), B(SetPendingMessage), - B(Star), R(14), - B(CallJSRuntime), U8(%async_function_promise_release), R(10), U8(1), - B(Ldar), R(14), + B(Star), R(15), + B(CallJSRuntime), U8(%async_function_promise_release), R(11), U8(1), + B(Ldar), R(15), B(SetPendingMessage), - B(Ldar), R(12), - B(SwitchOnSmiNoFeedback), U8(16), U8(2), I8(0), - B(Jump), U8(8), B(Ldar), R(13), + B(SwitchOnSmiNoFeedback), U8(15), U8(2), I8(0), + B(Jump), U8(8), + B(Ldar), R(14), /* 114 S> */ B(Return), - B(Ldar), R(13), + B(Ldar), R(14), B(ReThrow), B(LdaUndefined), /* 114 S> */ B(Return), ] constant pool: [ - Smi [89], - Smi [357], - Smi [437], + Smi [95], + Smi [350], + Smi [409], TUPLE2_TYPE, SYMBOL_TYPE, SYMBOL_TYPE, - Smi [40], ONE_BYTE_INTERNALIZED_STRING_TYPE ["next"], + Smi [34], ONE_BYTE_INTERNALIZED_STRING_TYPE ["done"], ONE_BYTE_INTERNALIZED_STRING_TYPE ["value"], ONE_BYTE_INTERNALIZED_STRING_TYPE [".catch"], @@ -883,16 +836,15 @@ constant pool: [ ONE_BYTE_INTERNALIZED_STRING_TYPE ["return"], ONE_BYTE_INTERNALIZED_STRING_TYPE [""], FIXED_ARRAY_TYPE, - FIXED_ARRAY_TYPE, Smi [6], Smi [9], ] handlers: [ - [46, 566, 574], - [49, 524, 526], - [55, 275, 283], - [58, 235, 237], - [343, 401, 403], + [46, 531, 539], + [49, 489, 491], + [55, 268, 276], + [58, 228, 230], + [336, 387, 389], ] --- @@ -903,186 +855,180 @@ snippet: " } f(); " -frame size: 19 +frame size: 20 parameter count: 1 -bytecode array length: 417 +bytecode array length: 403 bytecodes: [ /* 16 E> */ B(StackCheck), B(CallJSRuntime), U8(%async_function_promise_create), R(0), U8(0), - B(Star), R(8), - B(Mov), R(context), R(11), + B(Star), R(9), B(Mov), R(context), R(12), - /* 31 S> */ B(CreateObjectLiteral), U8(0), U8(0), U8(41), R(13), - B(Mov), R(13), R(1), + 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(LdaZero), - B(Star), R(4), - B(Mov), R(context), R(15), + B(Star), R(5), B(Mov), R(context), R(16), + B(Mov), R(context), R(17), /* 68 S> */ B(CreateArrayLiteral), U8(1), U8(1), U8(37), - B(Star), R(17), - B(LdaNamedProperty), R(17), U8(2), U8(2), B(Star), R(18), - B(CallProperty0), R(18), R(17), U8(4), + B(LdaNamedProperty), R(18), U8(2), U8(2), + B(Star), R(19), + 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), - /* 59 S> */ B(LdaNamedProperty), R(2), U8(3), U8(6), - B(Star), R(17), - B(CallProperty0), R(17), R(2), U8(8), + /* 68 E> */ B(LdaNamedProperty), R(2), U8(3), U8(6), B(Star), R(3), - /* 59 E> */ B(InvokeIntrinsic), U8(Runtime::k_IsJSReceiver), R(3), U8(1), + /* 59 S> */ B(CallProperty0), R(3), R(2), U8(8), + B(Star), R(4), + /* 59 E> */ B(InvokeIntrinsic), U8(Runtime::k_IsJSReceiver), R(4), U8(1), B(ToBooleanLogicalNot), B(JumpIfFalse), U8(7), - B(CallRuntime), U16(Runtime::kThrowIteratorResultNotAnObject), R(3), U8(1), - B(LdaNamedProperty), R(3), U8(4), U8(10), + B(CallRuntime), U16(Runtime::kThrowIteratorResultNotAnObject), R(4), U8(1), + B(LdaNamedProperty), R(4), U8(4), U8(10), B(JumpIfToBooleanTrue), U8(30), - /* 58 E> */ B(LdaNamedProperty), R(3), U8(5), U8(12), - B(Star), R(5), + /* 58 E> */ B(LdaNamedProperty), R(4), U8(5), U8(12), + B(Star), R(6), B(LdaSmi), I8(2), - B(Star), R(4), - B(Ldar), R(5), + B(Star), R(5), + B(Ldar), R(6), B(StaNamedProperty), R(1), U8(6), U8(14), /* 53 E> */ B(StackCheck), /* 87 S> */ B(LdaNamedProperty), R(1), U8(6), U8(16), - B(Star), R(14), + B(Star), R(15), B(LdaZero), - B(Star), R(13), + B(Star), R(14), B(Jump), U8(56), B(Jump), U8(40), - B(Star), R(17), + B(Star), R(18), B(Ldar), R(closure), - B(CreateCatchContext), R(17), U8(7), U8(8), - B(Star), R(16), + B(CreateCatchContext), R(18), U8(7), U8(8), + B(Star), R(17), B(LdaTheHole), B(SetPendingMessage), - B(Ldar), R(16), - B(PushContext), R(17), + B(Ldar), R(17), + B(PushContext), R(18), B(LdaSmi), I8(2), - B(TestEqualStrict), R(4), U8(18), + B(TestEqualStrict), R(5), U8(18), B(JumpIfFalse), U8(6), B(LdaSmi), I8(1), - B(Star), R(4), + B(Star), R(5), B(LdaImmutableCurrentContextSlot), U8(4), - B(Star), R(18), - B(CallRuntime), U16(Runtime::kReThrow), R(18), U8(1), - B(PopContext), R(17), + B(Star), R(19), + B(CallRuntime), U16(Runtime::kReThrow), R(19), U8(1), + B(PopContext), R(18), B(LdaSmi), I8(-1), + B(Star), R(15), B(Star), R(14), - B(Star), R(13), B(Jump), U8(8), - B(Star), R(14), + B(Star), R(15), B(LdaSmi), I8(1), - B(Star), R(13), + B(Star), R(14), B(LdaTheHole), B(SetPendingMessage), - B(Star), R(15), + B(Star), R(16), B(LdaZero), - B(TestEqualStrict), R(4), U8(19), - B(JumpIfTrue), U8(104), + B(TestEqualStrict), R(5), U8(19), + B(JumpIfTrue), U8(90), B(LdaNamedProperty), R(2), U8(9), U8(20), - B(Star), R(6), + B(Star), R(7), B(TestUndetectable), B(JumpIfFalse), U8(4), - B(Jump), U8(93), + B(Jump), U8(79), B(LdaSmi), I8(1), - B(TestEqualStrict), R(4), U8(22), - B(JumpIfFalse), U8(61), - B(Ldar), R(6), + B(TestEqualStrict), R(5), U8(22), + B(JumpIfFalse), U8(47), + B(Ldar), R(7), B(TestTypeOf), U8(6), B(JumpIfFalse), U8(4), B(Jump), U8(18), - B(Wide), B(LdaSmi), I16(143), - B(Star), R(16), - B(LdaConstant), U8(10), + B(Wide), B(LdaSmi), I16(144), B(Star), R(17), - B(CallRuntime), U16(Runtime::kNewTypeError), R(16), U8(2), + B(LdaConstant), U8(10), + B(Star), R(18), + B(CallRuntime), U16(Runtime::kNewTypeError), R(17), U8(2), B(Throw), - B(Mov), R(context), R(16), - B(Mov), R(6), R(17), - B(Mov), R(2), R(18), - B(InvokeIntrinsic), U8(Runtime::k_Call), R(17), U8(2), - B(Jump), U8(20), - B(Star), R(17), - B(Ldar), R(closure), - B(CreateCatchContext), R(17), U8(7), U8(11), - B(Star), R(16), + B(Mov), R(context), R(17), + B(Mov), R(7), R(18), + B(Mov), R(2), R(19), + B(InvokeIntrinsic), U8(Runtime::k_Call), R(18), U8(2), + B(Jump), U8(6), B(LdaTheHole), B(SetPendingMessage), - B(Ldar), R(16), - B(PushContext), R(17), - B(PopContext), R(17), + B(Ldar), R(17), B(Jump), U8(27), - B(Mov), R(6), R(16), - B(Mov), R(2), R(17), - B(InvokeIntrinsic), U8(Runtime::k_Call), R(16), U8(2), - B(Star), R(7), - B(InvokeIntrinsic), U8(Runtime::k_IsJSReceiver), R(7), U8(1), + B(Mov), R(7), R(17), + B(Mov), R(2), 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(JumpIfToBooleanFalse), U8(4), B(Jump), U8(7), - B(CallRuntime), U16(Runtime::kThrowIteratorResultNotAnObject), R(7), U8(1), - B(Ldar), R(15), + B(CallRuntime), U16(Runtime::kThrowIteratorResultNotAnObject), R(8), U8(1), + B(Ldar), R(16), B(SetPendingMessage), - B(Ldar), R(13), - B(SwitchOnSmiNoFeedback), U8(12), U8(2), I8(0), + B(Ldar), R(14), + B(SwitchOnSmiNoFeedback), U8(11), U8(2), I8(0), B(Jump), U8(13), B(LdaZero), - B(Star), R(9), - B(Mov), R(14), R(10), + B(Star), R(10), + B(Mov), R(15), R(11), B(Jump), U8(81), - B(Ldar), R(14), + B(Ldar), R(15), B(ReThrow), B(LdaUndefined), - B(Star), R(14), - B(Mov), R(8), R(13), - B(CallJSRuntime), U8(%promise_resolve), R(13), U8(2), + B(Star), R(15), + B(Mov), R(9), R(14), + B(CallJSRuntime), U8(%promise_resolve), R(14), U8(2), B(LdaSmi), I8(1), - B(Star), R(9), - B(Mov), R(8), R(10), + B(Star), R(10), + B(Mov), R(9), R(11), B(Jump), U8(59), B(Jump), U8(43), - B(Star), R(13), + B(Star), R(14), B(Ldar), R(closure), - B(CreateCatchContext), R(13), U8(7), U8(14), - B(Star), R(12), + B(CreateCatchContext), R(14), U8(7), U8(13), + B(Star), R(13), B(LdaTheHole), B(SetPendingMessage), - B(Ldar), R(12), - B(PushContext), R(13), + B(Ldar), R(13), + B(PushContext), R(14), B(LdaImmutableCurrentContextSlot), U8(4), - B(Star), R(15), - B(LdaFalse), B(Star), R(16), - B(Mov), R(8), R(14), - B(CallJSRuntime), U8(%promise_internal_reject), R(14), U8(3), - B(PopContext), R(13), + B(LdaFalse), + B(Star), R(17), + B(Mov), R(9), R(15), + B(CallJSRuntime), U8(%promise_internal_reject), R(15), U8(3), + B(PopContext), R(14), B(LdaSmi), I8(1), - B(Star), R(9), - B(Mov), R(8), R(10), + B(Star), R(10), + B(Mov), R(9), R(11), B(Jump), U8(16), B(LdaSmi), I8(-1), + B(Star), R(11), B(Star), R(10), - B(Star), R(9), B(Jump), U8(8), - B(Star), R(10), + B(Star), R(11), B(LdaSmi), I8(2), - B(Star), R(9), + B(Star), R(10), B(LdaTheHole), B(SetPendingMessage), - B(Star), R(11), - B(CallJSRuntime), U8(%async_function_promise_release), R(8), U8(1), - B(Ldar), R(11), + B(Star), R(12), + B(CallJSRuntime), U8(%async_function_promise_release), R(9), U8(1), + B(Ldar), R(12), B(SetPendingMessage), - B(Ldar), R(9), - B(SwitchOnSmiNoFeedback), U8(15), U8(3), I8(0), + B(Ldar), R(10), + B(SwitchOnSmiNoFeedback), U8(14), U8(3), I8(0), B(Jump), U8(21), - B(Mov), R(8), R(12), - B(Mov), R(10), R(13), - B(CallJSRuntime), U8(%promise_resolve), R(12), U8(2), - B(Ldar), R(8), + B(Mov), R(9), R(13), + B(Mov), R(11), R(14), + B(CallJSRuntime), U8(%promise_resolve), R(13), U8(2), + B(Ldar), R(9), /* 96 S> */ B(Return), - B(Ldar), R(10), + B(Ldar), R(11), /* 96 S> */ B(Return), - B(Ldar), R(10), + B(Ldar), R(11), B(ReThrow), B(LdaUndefined), /* 96 S> */ B(Return), @@ -1099,7 +1045,6 @@ constant pool: [ FIXED_ARRAY_TYPE, ONE_BYTE_INTERNALIZED_STRING_TYPE ["return"], ONE_BYTE_INTERNALIZED_STRING_TYPE [""], - FIXED_ARRAY_TYPE, Smi [6], Smi [14], FIXED_ARRAY_TYPE, @@ -1108,8 +1053,8 @@ constant pool: [ Smi [22], ] handlers: [ - [10, 363, 371], - [13, 320, 322], + [10, 349, 357], + [13, 306, 308], [27, 153, 161], [30, 113, 115], [222, 232, 234], diff --git a/deps/v8/test/cctest/interpreter/bytecode_expectations/ForOf.golden b/deps/v8/test/cctest/interpreter/bytecode_expectations/ForOf.golden index caf3e26cf7..46e62ed891 100644 --- a/deps/v8/test/cctest/interpreter/bytecode_expectations/ForOf.golden +++ b/deps/v8/test/cctest/interpreter/bytecode_expectations/ForOf.golden @@ -9,118 +9,112 @@ wrap: yes snippet: " for (var p of [0, 1, 2]) {} " -frame size: 14 +frame size: 15 parameter count: 1 -bytecode array length: 262 +bytecode array length: 248 bytecodes: [ /* 30 E> */ B(StackCheck), B(LdaZero), - B(Star), R(4), - B(Mov), R(context), R(10), + B(Star), R(5), B(Mov), R(context), R(11), + B(Mov), R(context), R(12), /* 48 S> */ B(CreateArrayLiteral), U8(0), U8(0), U8(37), - B(Star), R(12), - B(LdaNamedProperty), R(12), U8(1), U8(1), B(Star), R(13), - B(CallProperty0), R(13), R(12), U8(3), + B(LdaNamedProperty), R(13), U8(1), U8(1), + B(Star), R(14), + B(CallProperty0), R(14), R(13), U8(3), B(JumpIfJSReceiver), U8(7), B(CallRuntime), U16(Runtime::kThrowSymbolIteratorInvalid), R(0), U8(0), B(Star), R(2), - /* 43 S> */ B(LdaNamedProperty), R(2), U8(2), U8(5), - B(Star), R(12), - B(CallProperty0), R(12), R(2), U8(7), + /* 48 E> */ B(LdaNamedProperty), R(2), U8(2), U8(5), B(Star), R(3), - /* 43 E> */ B(InvokeIntrinsic), U8(Runtime::k_IsJSReceiver), R(3), U8(1), + /* 43 S> */ B(CallProperty0), R(3), R(2), U8(7), + B(Star), R(4), + /* 43 E> */ B(InvokeIntrinsic), U8(Runtime::k_IsJSReceiver), R(4), U8(1), B(ToBooleanLogicalNot), B(JumpIfFalse), U8(7), - B(CallRuntime), U16(Runtime::kThrowIteratorResultNotAnObject), R(3), U8(1), - B(LdaNamedProperty), R(3), U8(3), U8(9), + B(CallRuntime), U16(Runtime::kThrowIteratorResultNotAnObject), R(4), U8(1), + B(LdaNamedProperty), R(4), U8(3), U8(9), B(JumpIfToBooleanTrue), U8(25), - B(LdaNamedProperty), R(3), U8(4), U8(11), - B(Star), R(5), + B(LdaNamedProperty), R(4), U8(4), U8(11), + B(Star), R(6), B(LdaSmi), I8(2), - B(Star), R(4), - B(Mov), R(5), R(0), + B(Star), R(5), + B(Mov), R(6), R(0), /* 34 E> */ B(StackCheck), B(Mov), R(0), R(1), B(LdaZero), - B(Star), R(4), - B(JumpLoop), U8(50), I8(0), + B(Star), R(5), + B(JumpLoop), U8(44), I8(0), B(Jump), U8(36), - B(Star), R(12), + B(Star), R(13), B(Ldar), R(closure), - B(CreateCatchContext), R(12), U8(5), U8(6), - B(PushContext), R(12), - B(Star), R(11), + B(CreateCatchContext), R(13), U8(5), U8(6), + B(PushContext), R(13), + B(Star), R(12), B(LdaSmi), I8(2), - B(TestEqualStrict), R(4), U8(13), + B(TestEqualStrict), R(5), U8(13), B(JumpIfFalse), U8(6), B(LdaSmi), I8(1), - B(Star), R(4), + B(Star), R(5), B(LdaImmutableCurrentContextSlot), U8(4), - B(Star), R(13), - B(CallRuntime), U16(Runtime::kReThrow), R(13), U8(1), - B(PopContext), R(12), + B(Star), R(14), + B(CallRuntime), U16(Runtime::kReThrow), R(14), U8(1), + B(PopContext), R(13), B(LdaSmi), I8(-1), + B(Star), R(10), B(Star), R(9), - B(Star), R(8), B(Jump), U8(7), - B(Star), R(9), + B(Star), R(10), B(LdaZero), - B(Star), R(8), + B(Star), R(9), B(LdaTheHole), B(SetPendingMessage), - B(Star), R(10), + B(Star), R(11), B(LdaZero), - B(TestEqualStrict), R(4), U8(14), - B(JumpIfTrue), U8(104), + B(TestEqualStrict), R(5), U8(14), + B(JumpIfTrue), U8(90), B(LdaNamedProperty), R(2), U8(7), U8(15), - B(Star), R(6), + B(Star), R(7), B(TestUndetectable), B(JumpIfFalse), U8(4), - B(Jump), U8(93), + B(Jump), U8(79), B(LdaSmi), I8(1), - B(TestEqualStrict), R(4), U8(17), - B(JumpIfFalse), U8(61), - B(Ldar), R(6), + B(TestEqualStrict), R(5), U8(17), + B(JumpIfFalse), U8(47), + B(Ldar), R(7), B(TestTypeOf), U8(6), B(JumpIfFalse), U8(4), B(Jump), U8(18), - B(Wide), B(LdaSmi), I16(143), - B(Star), R(11), - B(LdaConstant), U8(8), + B(Wide), B(LdaSmi), I16(144), B(Star), R(12), - B(CallRuntime), U16(Runtime::kNewTypeError), R(11), U8(2), + B(LdaConstant), U8(8), + B(Star), R(13), + B(CallRuntime), U16(Runtime::kNewTypeError), R(12), U8(2), B(Throw), - B(Mov), R(context), R(11), - B(Mov), R(6), R(12), - B(Mov), R(2), R(13), - B(InvokeIntrinsic), U8(Runtime::k_Call), R(12), U8(2), - B(Jump), U8(20), - B(Star), R(12), - B(Ldar), R(closure), - B(CreateCatchContext), R(12), U8(5), U8(9), - B(Star), R(11), + B(Mov), R(context), R(12), + B(Mov), R(7), R(13), + B(Mov), R(2), R(14), + B(InvokeIntrinsic), U8(Runtime::k_Call), R(13), U8(2), + B(Jump), U8(6), B(LdaTheHole), B(SetPendingMessage), - B(Ldar), R(11), - B(PushContext), R(12), - B(PopContext), R(12), + B(Ldar), R(12), B(Jump), U8(27), - B(Mov), R(6), R(11), - B(Mov), R(2), R(12), - B(InvokeIntrinsic), U8(Runtime::k_Call), R(11), U8(2), - B(Star), R(7), - B(InvokeIntrinsic), U8(Runtime::k_IsJSReceiver), R(7), U8(1), + B(Mov), R(7), R(12), + B(Mov), R(2), R(13), + B(InvokeIntrinsic), U8(Runtime::k_Call), R(12), U8(2), + B(Star), R(8), + B(InvokeIntrinsic), U8(Runtime::k_IsJSReceiver), R(8), U8(1), B(JumpIfToBooleanFalse), U8(4), B(Jump), U8(7), - B(CallRuntime), U16(Runtime::kThrowIteratorResultNotAnObject), R(7), U8(1), - B(Ldar), R(10), + B(CallRuntime), U16(Runtime::kThrowIteratorResultNotAnObject), R(8), U8(1), + B(Ldar), R(11), B(SetPendingMessage), B(LdaZero), - B(TestEqualStrictNoFeedback), R(8), + B(TestEqualStrictNoFeedback), R(9), B(JumpIfFalse), U8(5), - B(Ldar), R(9), + B(Ldar), R(10), B(ReThrow), B(LdaUndefined), /* 62 S> */ B(Return), @@ -135,7 +129,6 @@ constant pool: [ FIXED_ARRAY_TYPE, ONE_BYTE_INTERNALIZED_STRING_TYPE ["return"], ONE_BYTE_INTERNALIZED_STRING_TYPE [""], - FIXED_ARRAY_TYPE, ] handlers: [ [7, 124, 132], @@ -148,122 +141,116 @@ snippet: " var x = 'potatoes'; for (var p of x) { return p; } " -frame size: 15 +frame size: 16 parameter count: 1 -bytecode array length: 272 +bytecode array length: 258 bytecodes: [ /* 30 E> */ B(StackCheck), /* 42 S> */ B(LdaConstant), U8(0), B(Star), R(0), B(LdaZero), - B(Star), R(5), - B(Mov), R(context), R(11), + B(Star), R(6), B(Mov), R(context), R(12), + B(Mov), R(context), R(13), /* 68 S> */ B(LdaNamedProperty), R(0), U8(1), U8(0), - B(Star), R(14), - B(CallProperty0), R(14), R(0), U8(2), - B(Mov), R(0), R(13), + B(Star), R(15), + B(CallProperty0), R(15), R(0), U8(2), + B(Mov), R(0), R(14), B(JumpIfJSReceiver), U8(7), B(CallRuntime), U16(Runtime::kThrowSymbolIteratorInvalid), R(0), U8(0), B(Star), R(3), - /* 63 S> */ B(LdaNamedProperty), R(3), U8(2), U8(4), - B(Star), R(13), - B(CallProperty0), R(13), R(3), U8(6), + /* 68 E> */ B(LdaNamedProperty), R(3), U8(2), U8(4), B(Star), R(4), - /* 63 E> */ B(InvokeIntrinsic), U8(Runtime::k_IsJSReceiver), R(4), U8(1), + /* 63 S> */ B(CallProperty0), R(4), R(3), U8(6), + B(Star), R(5), + /* 63 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(3), U8(8), + B(CallRuntime), U16(Runtime::kThrowIteratorResultNotAnObject), R(5), U8(1), + B(LdaNamedProperty), R(5), U8(3), U8(8), B(JumpIfToBooleanTrue), U8(27), - B(LdaNamedProperty), R(4), U8(4), U8(10), - B(Star), R(6), + B(LdaNamedProperty), R(5), U8(4), U8(10), + B(Star), R(7), B(LdaSmi), I8(2), - B(Star), R(5), - B(Mov), R(6), R(1), + B(Star), R(6), + B(Mov), R(7), R(1), /* 54 E> */ B(StackCheck), B(Mov), R(1), R(2), /* 73 S> */ B(LdaZero), - B(Star), R(9), - B(Mov), R(6), R(10), + B(Star), R(10), + B(Mov), R(7), R(11), B(Jump), U8(52), B(Jump), U8(36), - B(Star), R(13), + B(Star), R(14), B(Ldar), R(closure), - B(CreateCatchContext), R(13), U8(5), U8(6), - B(PushContext), R(13), - B(Star), R(12), + B(CreateCatchContext), R(14), U8(5), U8(6), + B(PushContext), R(14), + B(Star), R(13), B(LdaSmi), I8(2), - B(TestEqualStrict), R(5), U8(12), + B(TestEqualStrict), R(6), U8(12), B(JumpIfFalse), U8(6), B(LdaSmi), I8(1), - B(Star), R(5), + B(Star), R(6), B(LdaImmutableCurrentContextSlot), U8(4), - B(Star), R(14), - B(CallRuntime), U16(Runtime::kReThrow), R(14), U8(1), - B(PopContext), R(13), + B(Star), R(15), + B(CallRuntime), U16(Runtime::kReThrow), R(15), U8(1), + B(PopContext), R(14), B(LdaSmi), I8(-1), + B(Star), R(11), B(Star), R(10), - B(Star), R(9), B(Jump), U8(8), - B(Star), R(10), + B(Star), R(11), B(LdaSmi), I8(1), - B(Star), R(9), + B(Star), R(10), B(LdaTheHole), B(SetPendingMessage), - B(Star), R(11), + B(Star), R(12), B(LdaZero), - B(TestEqualStrict), R(5), U8(13), - B(JumpIfTrue), U8(104), + B(TestEqualStrict), R(6), U8(13), + B(JumpIfTrue), U8(90), B(LdaNamedProperty), R(3), U8(7), U8(14), - B(Star), R(7), + B(Star), R(8), B(TestUndetectable), B(JumpIfFalse), U8(4), - B(Jump), U8(93), + B(Jump), U8(79), B(LdaSmi), I8(1), - B(TestEqualStrict), R(5), U8(16), - B(JumpIfFalse), U8(61), - B(Ldar), R(7), + B(TestEqualStrict), R(6), U8(16), + B(JumpIfFalse), U8(47), + B(Ldar), R(8), B(TestTypeOf), U8(6), B(JumpIfFalse), U8(4), B(Jump), U8(18), - B(Wide), B(LdaSmi), I16(143), - B(Star), R(12), - B(LdaConstant), U8(8), + B(Wide), B(LdaSmi), I16(144), B(Star), R(13), - B(CallRuntime), U16(Runtime::kNewTypeError), R(12), U8(2), + B(LdaConstant), U8(8), + B(Star), R(14), + B(CallRuntime), U16(Runtime::kNewTypeError), R(13), U8(2), B(Throw), - B(Mov), R(context), R(12), - B(Mov), R(7), R(13), - B(Mov), R(3), R(14), - B(InvokeIntrinsic), U8(Runtime::k_Call), R(13), U8(2), - B(Jump), U8(20), - B(Star), R(13), - B(Ldar), R(closure), - B(CreateCatchContext), R(13), U8(5), U8(9), - B(Star), R(12), + B(Mov), R(context), R(13), + B(Mov), R(8), R(14), + B(Mov), R(3), R(15), + B(InvokeIntrinsic), U8(Runtime::k_Call), R(14), U8(2), + B(Jump), U8(6), B(LdaTheHole), B(SetPendingMessage), - B(Ldar), R(12), - B(PushContext), R(13), - B(PopContext), R(13), + B(Ldar), R(13), B(Jump), U8(27), - B(Mov), R(7), R(12), - B(Mov), R(3), R(13), - B(InvokeIntrinsic), U8(Runtime::k_Call), R(12), U8(2), - B(Star), R(8), - B(InvokeIntrinsic), U8(Runtime::k_IsJSReceiver), R(8), U8(1), + B(Mov), R(8), R(13), + B(Mov), R(3), R(14), + B(InvokeIntrinsic), U8(Runtime::k_Call), R(13), U8(2), + 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(Ldar), R(11), + B(CallRuntime), U16(Runtime::kThrowIteratorResultNotAnObject), R(9), U8(1), + B(Ldar), R(12), B(SetPendingMessage), - B(Ldar), R(9), - B(SwitchOnSmiNoFeedback), U8(10), U8(2), I8(0), - B(Jump), U8(8), B(Ldar), R(10), + B(SwitchOnSmiNoFeedback), U8(9), U8(2), I8(0), + B(Jump), U8(8), + B(Ldar), R(11), /* 85 S> */ B(Return), - B(Ldar), R(10), + B(Ldar), R(11), B(ReThrow), B(LdaUndefined), /* 85 S> */ B(Return), @@ -278,7 +265,6 @@ constant pool: [ FIXED_ARRAY_TYPE, ONE_BYTE_INTERNALIZED_STRING_TYPE ["return"], ONE_BYTE_INTERNALIZED_STRING_TYPE [""], - FIXED_ARRAY_TYPE, Smi [6], Smi [9], ] @@ -295,38 +281,38 @@ snippet: " if (x == 20) break; } " -frame size: 14 +frame size: 15 parameter count: 1 -bytecode array length: 280 +bytecode array length: 266 bytecodes: [ /* 30 E> */ B(StackCheck), B(LdaZero), - B(Star), R(4), - B(Mov), R(context), R(10), + B(Star), R(5), B(Mov), R(context), R(11), + B(Mov), R(context), R(12), /* 48 S> */ B(CreateArrayLiteral), U8(0), U8(0), U8(37), - B(Star), R(12), - B(LdaNamedProperty), R(12), U8(1), U8(1), B(Star), R(13), - B(CallProperty0), R(13), R(12), U8(3), + B(LdaNamedProperty), R(13), U8(1), U8(1), + B(Star), R(14), + B(CallProperty0), R(14), R(13), U8(3), B(JumpIfJSReceiver), U8(7), B(CallRuntime), U16(Runtime::kThrowSymbolIteratorInvalid), R(0), U8(0), B(Star), R(2), - /* 43 S> */ B(LdaNamedProperty), R(2), U8(2), U8(5), - B(Star), R(12), - B(CallProperty0), R(12), R(2), U8(7), + /* 48 E> */ B(LdaNamedProperty), R(2), U8(2), U8(5), B(Star), R(3), - /* 43 E> */ B(InvokeIntrinsic), U8(Runtime::k_IsJSReceiver), R(3), U8(1), + /* 43 S> */ B(CallProperty0), R(3), R(2), U8(7), + B(Star), R(4), + /* 43 E> */ B(InvokeIntrinsic), U8(Runtime::k_IsJSReceiver), R(4), U8(1), B(ToBooleanLogicalNot), B(JumpIfFalse), U8(7), - B(CallRuntime), U16(Runtime::kThrowIteratorResultNotAnObject), R(3), U8(1), - B(LdaNamedProperty), R(3), U8(3), U8(9), + B(CallRuntime), U16(Runtime::kThrowIteratorResultNotAnObject), R(4), U8(1), + B(LdaNamedProperty), R(4), U8(3), U8(9), B(JumpIfToBooleanTrue), U8(43), - B(LdaNamedProperty), R(3), U8(4), U8(11), - B(Star), R(5), + B(LdaNamedProperty), R(4), U8(4), U8(11), + B(Star), R(6), B(LdaSmi), I8(2), - B(Star), R(4), - B(Mov), R(5), R(0), + B(Star), R(5), + B(Mov), R(6), R(0), /* 34 E> */ B(StackCheck), B(Mov), R(0), R(1), /* 66 S> */ B(LdaSmi), I8(10), @@ -338,83 +324,77 @@ bytecodes: [ B(JumpIfFalse), U8(4), /* 104 S> */ B(Jump), U8(8), B(LdaZero), - B(Star), R(4), - B(JumpLoop), U8(68), I8(0), + B(Star), R(5), + B(JumpLoop), U8(62), I8(0), B(Jump), U8(36), - B(Star), R(12), + B(Star), R(13), B(Ldar), R(closure), - B(CreateCatchContext), R(12), U8(5), U8(6), - B(PushContext), R(12), - B(Star), R(11), + B(CreateCatchContext), R(13), U8(5), U8(6), + B(PushContext), R(13), + B(Star), R(12), B(LdaSmi), I8(2), - B(TestEqualStrict), R(4), U8(15), + B(TestEqualStrict), R(5), U8(15), B(JumpIfFalse), U8(6), B(LdaSmi), I8(1), - B(Star), R(4), + B(Star), R(5), B(LdaImmutableCurrentContextSlot), U8(4), - B(Star), R(13), - B(CallRuntime), U16(Runtime::kReThrow), R(13), U8(1), - B(PopContext), R(12), + B(Star), R(14), + B(CallRuntime), U16(Runtime::kReThrow), R(14), U8(1), + B(PopContext), R(13), B(LdaSmi), I8(-1), + B(Star), R(10), B(Star), R(9), - B(Star), R(8), B(Jump), U8(7), - B(Star), R(9), + B(Star), R(10), B(LdaZero), - B(Star), R(8), + B(Star), R(9), B(LdaTheHole), B(SetPendingMessage), - B(Star), R(10), + B(Star), R(11), B(LdaZero), - B(TestEqualStrict), R(4), U8(16), - B(JumpIfTrue), U8(104), + B(TestEqualStrict), R(5), U8(16), + B(JumpIfTrue), U8(90), B(LdaNamedProperty), R(2), U8(7), U8(17), - B(Star), R(6), + B(Star), R(7), B(TestUndetectable), B(JumpIfFalse), U8(4), - B(Jump), U8(93), + B(Jump), U8(79), B(LdaSmi), I8(1), - B(TestEqualStrict), R(4), U8(19), - B(JumpIfFalse), U8(61), - B(Ldar), R(6), + B(TestEqualStrict), R(5), U8(19), + B(JumpIfFalse), U8(47), + B(Ldar), R(7), B(TestTypeOf), U8(6), B(JumpIfFalse), U8(4), B(Jump), U8(18), - B(Wide), B(LdaSmi), I16(143), - B(Star), R(11), - B(LdaConstant), U8(8), + B(Wide), B(LdaSmi), I16(144), B(Star), R(12), - B(CallRuntime), U16(Runtime::kNewTypeError), R(11), U8(2), + B(LdaConstant), U8(8), + B(Star), R(13), + B(CallRuntime), U16(Runtime::kNewTypeError), R(12), U8(2), B(Throw), - B(Mov), R(context), R(11), - B(Mov), R(6), R(12), - B(Mov), R(2), R(13), - B(InvokeIntrinsic), U8(Runtime::k_Call), R(12), U8(2), - B(Jump), U8(20), - B(Star), R(12), - B(Ldar), R(closure), - B(CreateCatchContext), R(12), U8(5), U8(9), - B(Star), R(11), + B(Mov), R(context), R(12), + B(Mov), R(7), R(13), + B(Mov), R(2), R(14), + B(InvokeIntrinsic), U8(Runtime::k_Call), R(13), U8(2), + B(Jump), U8(6), B(LdaTheHole), B(SetPendingMessage), - B(Ldar), R(11), - B(PushContext), R(12), - B(PopContext), R(12), + B(Ldar), R(12), B(Jump), U8(27), - B(Mov), R(6), R(11), - B(Mov), R(2), R(12), - B(InvokeIntrinsic), U8(Runtime::k_Call), R(11), U8(2), - B(Star), R(7), - B(InvokeIntrinsic), U8(Runtime::k_IsJSReceiver), R(7), U8(1), + B(Mov), R(7), R(12), + B(Mov), R(2), R(13), + B(InvokeIntrinsic), U8(Runtime::k_Call), R(12), U8(2), + B(Star), R(8), + B(InvokeIntrinsic), U8(Runtime::k_IsJSReceiver), R(8), U8(1), B(JumpIfToBooleanFalse), U8(4), B(Jump), U8(7), - B(CallRuntime), U16(Runtime::kThrowIteratorResultNotAnObject), R(7), U8(1), - B(Ldar), R(10), + B(CallRuntime), U16(Runtime::kThrowIteratorResultNotAnObject), R(8), U8(1), + B(Ldar), R(11), B(SetPendingMessage), B(LdaZero), - B(TestEqualStrictNoFeedback), R(8), + B(TestEqualStrictNoFeedback), R(9), B(JumpIfFalse), U8(5), - B(Ldar), R(9), + B(Ldar), R(10), B(ReThrow), B(LdaUndefined), /* 113 S> */ B(Return), @@ -429,7 +409,6 @@ constant pool: [ FIXED_ARRAY_TYPE, ONE_BYTE_INTERNALIZED_STRING_TYPE ["return"], ONE_BYTE_INTERNALIZED_STRING_TYPE [""], - FIXED_ARRAY_TYPE, ] handlers: [ [7, 142, 150], @@ -442,124 +421,118 @@ snippet: " var x = { 'a': 1, 'b': 2 }; for (x['a'] of [1,2,3]) { return x['a']; } " -frame size: 13 +frame size: 14 parameter count: 1 -bytecode array length: 282 +bytecode array length: 268 bytecodes: [ /* 30 E> */ B(StackCheck), - /* 42 S> */ B(CreateObjectLiteral), U8(0), U8(0), U8(41), R(7), - B(Mov), R(7), R(0), + /* 42 S> */ B(CreateObjectLiteral), U8(0), U8(0), U8(41), R(8), + B(Mov), R(8), R(0), B(LdaZero), - B(Star), R(3), - B(Mov), R(context), R(9), + B(Star), R(4), B(Mov), R(context), R(10), + B(Mov), R(context), R(11), /* 77 S> */ B(CreateArrayLiteral), U8(1), U8(1), U8(37), - B(Star), R(11), - B(LdaNamedProperty), R(11), U8(2), U8(2), B(Star), R(12), - B(CallProperty0), R(12), R(11), U8(4), + B(LdaNamedProperty), R(12), U8(2), U8(2), + B(Star), R(13), + B(CallProperty0), R(13), R(12), U8(4), B(JumpIfJSReceiver), U8(7), B(CallRuntime), U16(Runtime::kThrowSymbolIteratorInvalid), R(0), U8(0), B(Star), R(1), - /* 68 S> */ B(LdaNamedProperty), R(1), U8(3), U8(6), - B(Star), R(11), - B(CallProperty0), R(11), R(1), U8(8), + /* 77 E> */ B(LdaNamedProperty), R(1), U8(3), U8(6), B(Star), R(2), - /* 68 E> */ B(InvokeIntrinsic), U8(Runtime::k_IsJSReceiver), R(2), U8(1), + /* 68 S> */ B(CallProperty0), R(2), R(1), U8(8), + B(Star), R(3), + /* 68 E> */ B(InvokeIntrinsic), U8(Runtime::k_IsJSReceiver), R(3), U8(1), B(ToBooleanLogicalNot), B(JumpIfFalse), U8(7), - B(CallRuntime), U16(Runtime::kThrowIteratorResultNotAnObject), R(2), U8(1), - B(LdaNamedProperty), R(2), U8(4), U8(10), + B(CallRuntime), U16(Runtime::kThrowIteratorResultNotAnObject), R(3), U8(1), + B(LdaNamedProperty), R(3), U8(4), U8(10), B(JumpIfToBooleanTrue), U8(30), - /* 67 E> */ B(LdaNamedProperty), R(2), U8(5), U8(12), - B(Star), R(4), + /* 67 E> */ B(LdaNamedProperty), R(3), U8(5), U8(12), + B(Star), R(5), B(LdaSmi), I8(2), - B(Star), R(3), - B(Ldar), R(4), + B(Star), R(4), + B(Ldar), R(5), B(StaNamedProperty), R(0), U8(6), U8(14), /* 62 E> */ B(StackCheck), /* 96 S> */ B(LdaNamedProperty), R(0), U8(6), U8(16), - B(Star), R(8), + B(Star), R(9), B(LdaZero), - B(Star), R(7), + B(Star), R(8), B(Jump), U8(52), B(Jump), U8(36), - B(Star), R(11), + B(Star), R(12), B(Ldar), R(closure), - B(CreateCatchContext), R(11), U8(7), U8(8), - B(PushContext), R(11), - B(Star), R(10), + B(CreateCatchContext), R(12), U8(7), U8(8), + B(PushContext), R(12), + B(Star), R(11), B(LdaSmi), I8(2), - B(TestEqualStrict), R(3), U8(18), + B(TestEqualStrict), R(4), U8(18), B(JumpIfFalse), U8(6), B(LdaSmi), I8(1), - B(Star), R(3), + B(Star), R(4), B(LdaImmutableCurrentContextSlot), U8(4), - B(Star), R(12), - B(CallRuntime), U16(Runtime::kReThrow), R(12), U8(1), - B(PopContext), R(11), + B(Star), R(13), + B(CallRuntime), U16(Runtime::kReThrow), R(13), U8(1), + B(PopContext), R(12), B(LdaSmi), I8(-1), + B(Star), R(9), B(Star), R(8), - B(Star), R(7), B(Jump), U8(8), - B(Star), R(8), + B(Star), R(9), B(LdaSmi), I8(1), - B(Star), R(7), + B(Star), R(8), B(LdaTheHole), B(SetPendingMessage), - B(Star), R(9), + B(Star), R(10), B(LdaZero), - B(TestEqualStrict), R(3), U8(19), - B(JumpIfTrue), U8(104), + B(TestEqualStrict), R(4), U8(19), + B(JumpIfTrue), U8(90), B(LdaNamedProperty), R(1), U8(9), U8(20), - B(Star), R(5), + B(Star), R(6), B(TestUndetectable), B(JumpIfFalse), U8(4), - B(Jump), U8(93), + B(Jump), U8(79), B(LdaSmi), I8(1), - B(TestEqualStrict), R(3), U8(22), - B(JumpIfFalse), U8(61), - B(Ldar), R(5), + B(TestEqualStrict), R(4), U8(22), + B(JumpIfFalse), U8(47), + B(Ldar), R(6), B(TestTypeOf), U8(6), B(JumpIfFalse), U8(4), B(Jump), U8(18), - B(Wide), B(LdaSmi), I16(143), - B(Star), R(10), - B(LdaConstant), U8(10), + B(Wide), B(LdaSmi), I16(144), B(Star), R(11), - B(CallRuntime), U16(Runtime::kNewTypeError), R(10), U8(2), + B(LdaConstant), U8(10), + B(Star), R(12), + B(CallRuntime), U16(Runtime::kNewTypeError), R(11), U8(2), B(Throw), - B(Mov), R(context), R(10), - B(Mov), R(5), R(11), - B(Mov), R(1), R(12), - B(InvokeIntrinsic), U8(Runtime::k_Call), R(11), U8(2), - B(Jump), U8(20), - B(Star), R(11), - B(Ldar), R(closure), - B(CreateCatchContext), R(11), U8(7), U8(11), - B(Star), R(10), + B(Mov), R(context), R(11), + B(Mov), R(6), R(12), + B(Mov), R(1), R(13), + B(InvokeIntrinsic), U8(Runtime::k_Call), R(12), U8(2), + B(Jump), U8(6), B(LdaTheHole), B(SetPendingMessage), - B(Ldar), R(10), - B(PushContext), R(11), - B(PopContext), R(11), + B(Ldar), R(11), B(Jump), U8(27), - B(Mov), R(5), R(10), - B(Mov), R(1), R(11), - B(InvokeIntrinsic), U8(Runtime::k_Call), R(10), U8(2), - B(Star), R(6), - B(InvokeIntrinsic), U8(Runtime::k_IsJSReceiver), R(6), U8(1), + B(Mov), R(6), R(11), + B(Mov), R(1), R(12), + B(InvokeIntrinsic), U8(Runtime::k_Call), R(11), U8(2), + B(Star), R(7), + B(InvokeIntrinsic), U8(Runtime::k_IsJSReceiver), R(7), U8(1), B(JumpIfToBooleanFalse), U8(4), B(Jump), U8(7), - B(CallRuntime), U16(Runtime::kThrowIteratorResultNotAnObject), R(6), U8(1), - B(Ldar), R(9), + B(CallRuntime), U16(Runtime::kThrowIteratorResultNotAnObject), R(7), U8(1), + B(Ldar), R(10), B(SetPendingMessage), - B(Ldar), R(7), - B(SwitchOnSmiNoFeedback), U8(12), U8(2), I8(0), - B(Jump), U8(8), B(Ldar), R(8), + B(SwitchOnSmiNoFeedback), U8(11), U8(2), I8(0), + B(Jump), U8(8), + B(Ldar), R(9), /* 105 S> */ B(Return), - B(Ldar), R(8), + B(Ldar), R(9), B(ReThrow), B(LdaUndefined), /* 105 S> */ B(Return), @@ -576,7 +549,6 @@ constant pool: [ FIXED_ARRAY_TYPE, ONE_BYTE_INTERNALIZED_STRING_TYPE ["return"], ONE_BYTE_INTERNALIZED_STRING_TYPE [""], - FIXED_ARRAY_TYPE, Smi [6], Smi [9], ] diff --git a/deps/v8/test/cctest/interpreter/bytecode_expectations/ForOfLoop.golden b/deps/v8/test/cctest/interpreter/bytecode_expectations/ForOfLoop.golden index 57b2b27ea1..1ea568ac21 100644 --- a/deps/v8/test/cctest/interpreter/bytecode_expectations/ForOfLoop.golden +++ b/deps/v8/test/cctest/interpreter/bytecode_expectations/ForOfLoop.golden @@ -13,118 +13,112 @@ snippet: " } f([1, 2, 3]); " -frame size: 16 +frame size: 17 parameter count: 2 -bytecode array length: 262 +bytecode array length: 248 bytecodes: [ /* 10 E> */ B(StackCheck), B(LdaZero), - B(Star), R(6), - B(Mov), R(context), R(12), + B(Star), R(7), B(Mov), R(context), R(13), + B(Mov), R(context), R(14), /* 34 S> */ B(LdaNamedProperty), R(arg0), U8(0), U8(0), - B(Star), R(15), - B(CallProperty0), R(15), R(arg0), U8(2), - B(Mov), R(arg0), R(14), + B(Star), R(16), + B(CallProperty0), R(16), R(arg0), U8(2), + B(Mov), R(arg0), R(15), B(JumpIfJSReceiver), U8(7), B(CallRuntime), U16(Runtime::kThrowSymbolIteratorInvalid), R(0), U8(0), B(Star), R(4), - /* 29 S> */ B(LdaNamedProperty), R(4), U8(1), U8(4), - B(Star), R(14), - B(CallProperty0), R(14), R(4), U8(6), + /* 34 E> */ B(LdaNamedProperty), R(4), U8(1), U8(4), B(Star), R(5), - /* 29 E> */ B(InvokeIntrinsic), U8(Runtime::k_IsJSReceiver), R(5), U8(1), + /* 29 S> */ B(CallProperty0), R(5), R(4), U8(6), + B(Star), R(6), + /* 29 E> */ B(InvokeIntrinsic), U8(Runtime::k_IsJSReceiver), R(6), U8(1), B(ToBooleanLogicalNot), B(JumpIfFalse), U8(7), - B(CallRuntime), U16(Runtime::kThrowIteratorResultNotAnObject), R(5), U8(1), - B(LdaNamedProperty), R(5), U8(2), U8(8), + B(CallRuntime), U16(Runtime::kThrowIteratorResultNotAnObject), R(6), U8(1), + B(LdaNamedProperty), R(6), U8(2), U8(8), B(JumpIfToBooleanTrue), U8(28), - B(LdaNamedProperty), R(5), U8(3), U8(10), - B(Star), R(7), + B(LdaNamedProperty), R(6), U8(3), U8(10), + B(Star), R(8), B(LdaSmi), I8(2), - B(Star), R(6), - B(Mov), R(7), R(3), + B(Star), R(7), + B(Mov), R(8), R(3), /* 20 E> */ B(StackCheck), B(Mov), R(3), R(1), /* 49 S> */ B(Mov), R(1), R(0), B(LdaZero), - B(Star), R(6), - B(JumpLoop), U8(53), I8(0), + B(Star), R(7), + B(JumpLoop), U8(47), I8(0), B(Jump), U8(36), - B(Star), R(14), + B(Star), R(15), B(Ldar), R(closure), - /* 49 E> */ B(CreateCatchContext), R(14), U8(4), U8(5), - B(PushContext), R(14), - B(Star), R(13), + /* 49 E> */ B(CreateCatchContext), R(15), U8(4), U8(5), + B(PushContext), R(15), + B(Star), R(14), B(LdaSmi), I8(2), - B(TestEqualStrict), R(6), U8(12), + B(TestEqualStrict), R(7), U8(12), B(JumpIfFalse), U8(6), B(LdaSmi), I8(1), - B(Star), R(6), + B(Star), R(7), B(LdaImmutableCurrentContextSlot), U8(4), - B(Star), R(15), - B(CallRuntime), U16(Runtime::kReThrow), R(15), U8(1), - B(PopContext), R(14), + B(Star), R(16), + B(CallRuntime), U16(Runtime::kReThrow), R(16), U8(1), + B(PopContext), R(15), B(LdaSmi), I8(-1), + B(Star), R(12), B(Star), R(11), - B(Star), R(10), B(Jump), U8(7), - B(Star), R(11), + B(Star), R(12), B(LdaZero), - B(Star), R(10), + B(Star), R(11), B(LdaTheHole), B(SetPendingMessage), - B(Star), R(12), + B(Star), R(13), B(LdaZero), - B(TestEqualStrict), R(6), U8(13), - B(JumpIfTrue), U8(104), + B(TestEqualStrict), R(7), U8(13), + B(JumpIfTrue), U8(90), B(LdaNamedProperty), R(4), U8(6), U8(14), - B(Star), R(8), + B(Star), R(9), B(TestUndetectable), B(JumpIfFalse), U8(4), - B(Jump), U8(93), + B(Jump), U8(79), B(LdaSmi), I8(1), - B(TestEqualStrict), R(6), U8(16), - B(JumpIfFalse), U8(61), - B(Ldar), R(8), + B(TestEqualStrict), R(7), U8(16), + B(JumpIfFalse), U8(47), + B(Ldar), R(9), B(TestTypeOf), U8(6), B(JumpIfFalse), U8(4), B(Jump), U8(18), - B(Wide), B(LdaSmi), I16(143), - B(Star), R(13), - B(LdaConstant), U8(7), + B(Wide), B(LdaSmi), I16(144), B(Star), R(14), - B(CallRuntime), U16(Runtime::kNewTypeError), R(13), U8(2), + B(LdaConstant), U8(7), + B(Star), R(15), + B(CallRuntime), U16(Runtime::kNewTypeError), R(14), U8(2), B(Throw), - B(Mov), R(context), R(13), - B(Mov), R(8), R(14), - B(Mov), R(4), R(15), - B(InvokeIntrinsic), U8(Runtime::k_Call), R(14), U8(2), - B(Jump), U8(20), - B(Star), R(14), - B(Ldar), R(closure), - B(CreateCatchContext), R(14), U8(4), U8(8), - B(Star), R(13), + B(Mov), R(context), R(14), + B(Mov), R(9), R(15), + B(Mov), R(4), R(16), + B(InvokeIntrinsic), U8(Runtime::k_Call), R(15), U8(2), + B(Jump), U8(6), B(LdaTheHole), B(SetPendingMessage), - B(Ldar), R(13), - B(PushContext), R(14), - B(PopContext), R(14), + B(Ldar), R(14), B(Jump), U8(27), - B(Mov), R(8), R(13), - B(Mov), R(4), R(14), - B(InvokeIntrinsic), U8(Runtime::k_Call), R(13), U8(2), - B(Star), R(9), - B(InvokeIntrinsic), U8(Runtime::k_IsJSReceiver), R(9), U8(1), + B(Mov), R(9), R(14), + B(Mov), R(4), R(15), + B(InvokeIntrinsic), U8(Runtime::k_Call), R(14), U8(2), + B(Star), R(10), + B(InvokeIntrinsic), U8(Runtime::k_IsJSReceiver), R(10), U8(1), B(JumpIfToBooleanFalse), U8(4), B(Jump), U8(7), - B(CallRuntime), U16(Runtime::kThrowIteratorResultNotAnObject), R(9), U8(1), - B(Ldar), R(12), + B(CallRuntime), U16(Runtime::kThrowIteratorResultNotAnObject), R(10), U8(1), + B(Ldar), R(13), B(SetPendingMessage), B(LdaZero), - B(TestEqualStrictNoFeedback), R(10), + B(TestEqualStrictNoFeedback), R(11), B(JumpIfFalse), U8(5), - B(Ldar), R(11), + B(Ldar), R(12), B(ReThrow), B(LdaUndefined), /* 54 S> */ B(Return), @@ -138,7 +132,6 @@ constant pool: [ FIXED_ARRAY_TYPE, ONE_BYTE_INTERNALIZED_STRING_TYPE ["return"], ONE_BYTE_INTERNALIZED_STRING_TYPE [""], - FIXED_ARRAY_TYPE, ] handlers: [ [7, 124, 132], @@ -153,158 +146,152 @@ snippet: " } f([1, 2, 3]); " -frame size: 23 +frame size: 24 parameter count: 2 -bytecode array length: 345 +bytecode array length: 331 bytecodes: [ B(CreateFunctionContext), U8(4), - B(PushContext), R(8), + B(PushContext), R(9), B(Ldar), R(this), B(StaCurrentContextSlot), U8(5), B(Ldar), R(arg0), B(StaCurrentContextSlot), U8(4), B(CreateMappedArguments), B(StaCurrentContextSlot), U8(7), - B(Ldar), R(7), + B(Ldar), R(8), B(StaCurrentContextSlot), U8(6), /* 10 E> */ B(StackCheck), B(Ldar), R(closure), B(CreateBlockContext), U8(0), - B(PushContext), R(9), + B(PushContext), R(10), B(LdaTheHole), B(StaCurrentContextSlot), U8(4), B(LdaZero), - B(Star), R(3), - B(Mov), R(context), R(12), + B(Star), R(4), B(Mov), R(context), R(13), - /* 34 S> */ B(LdaContextSlot), R(9), U8(4), U8(0), - B(Star), R(14), - B(LdaNamedProperty), R(14), U8(1), U8(0), + B(Mov), R(context), R(14), + /* 34 S> */ B(LdaContextSlot), R(10), U8(4), U8(0), B(Star), R(15), - B(CallProperty0), R(15), R(14), U8(2), + B(LdaNamedProperty), R(15), U8(1), U8(0), + B(Star), R(16), + B(CallProperty0), R(16), R(15), U8(2), B(JumpIfJSReceiver), U8(7), B(CallRuntime), U16(Runtime::kThrowSymbolIteratorInvalid), R(0), U8(0), B(Star), R(1), - /* 29 S> */ B(LdaNamedProperty), R(1), U8(2), U8(4), - B(Star), R(14), - B(CallProperty0), R(14), R(1), U8(6), + /* 34 E> */ B(LdaNamedProperty), R(1), U8(2), U8(4), B(Star), R(2), - /* 29 E> */ B(InvokeIntrinsic), U8(Runtime::k_IsJSReceiver), R(2), U8(1), + /* 29 S> */ B(CallProperty0), R(2), R(1), U8(6), + B(Star), R(3), + /* 29 E> */ B(InvokeIntrinsic), U8(Runtime::k_IsJSReceiver), R(3), U8(1), B(ToBooleanLogicalNot), B(JumpIfFalse), U8(7), - B(CallRuntime), U16(Runtime::kThrowIteratorResultNotAnObject), R(2), U8(1), - B(LdaNamedProperty), R(2), U8(3), U8(8), + B(CallRuntime), U16(Runtime::kThrowIteratorResultNotAnObject), R(3), U8(1), + B(LdaNamedProperty), R(3), U8(3), U8(8), B(JumpIfToBooleanTrue), U8(78), - B(LdaNamedProperty), R(2), U8(4), U8(10), - B(Star), R(4), + B(LdaNamedProperty), R(3), U8(4), U8(10), + B(Star), R(5), B(LdaSmi), I8(2), - B(Star), R(3), - B(Mov), R(4), R(0), + B(Star), R(4), + B(Mov), R(5), R(0), /* 20 E> */ B(StackCheck), B(Ldar), R(closure), B(CreateBlockContext), U8(5), - B(PushContext), R(14), + B(PushContext), R(15), B(LdaTheHole), B(StaCurrentContextSlot), U8(4), - B(Ldar), R(4), + B(Ldar), R(5), B(StaCurrentContextSlot), U8(4), /* 41 S> */ B(LdaLookupGlobalSlot), U8(6), U8(12), U8(3), - B(Star), R(15), - B(LdaConstant), U8(7), B(Star), R(16), + B(LdaConstant), U8(7), + B(Star), R(17), B(LdaZero), - B(Star), R(20), - B(LdaSmi), I8(37), B(Star), R(21), - B(LdaSmi), I8(41), + B(LdaSmi), I8(37), B(Star), R(22), - B(Mov), R(15), R(17), + B(LdaSmi), I8(41), + B(Star), R(23), B(Mov), R(16), R(18), - B(Mov), R(closure), R(19), - B(CallRuntime), U16(Runtime::kResolvePossiblyDirectEval), R(17), U8(6), - B(Star), R(15), - /* 41 E> */ B(CallUndefinedReceiver1), R(15), R(16), U8(14), - B(PopContext), R(14), + B(Mov), R(17), R(19), + B(Mov), R(closure), R(20), + B(CallRuntime), U16(Runtime::kResolvePossiblyDirectEval), R(18), U8(6), + B(Star), R(16), + /* 41 E> */ B(CallUndefinedReceiver1), R(16), R(17), U8(14), + B(PopContext), R(15), B(LdaZero), - B(Star), R(3), - B(JumpLoop), U8(103), I8(0), + B(Star), R(4), + B(JumpLoop), U8(97), I8(0), B(Jump), U8(36), - B(Star), R(14), + B(Star), R(15), B(Ldar), R(closure), - B(CreateCatchContext), R(14), U8(8), U8(9), - B(PushContext), R(14), - B(Star), R(13), + B(CreateCatchContext), R(15), U8(8), U8(9), + B(PushContext), R(15), + B(Star), R(14), B(LdaSmi), I8(2), - B(TestEqualStrict), R(3), U8(16), + B(TestEqualStrict), R(4), U8(16), B(JumpIfFalse), U8(6), B(LdaSmi), I8(1), - B(Star), R(3), + B(Star), R(4), B(LdaImmutableCurrentContextSlot), U8(4), - B(Star), R(15), - B(CallRuntime), U16(Runtime::kReThrow), R(15), U8(1), - B(PopContext), R(14), + B(Star), R(16), + B(CallRuntime), U16(Runtime::kReThrow), R(16), U8(1), + B(PopContext), R(15), B(LdaSmi), I8(-1), + B(Star), R(12), B(Star), R(11), - B(Star), R(10), B(Jump), U8(7), - B(Star), R(11), + B(Star), R(12), B(LdaZero), - B(Star), R(10), + B(Star), R(11), B(LdaTheHole), B(SetPendingMessage), - B(Star), R(12), + B(Star), R(13), B(LdaZero), - B(TestEqualStrict), R(3), U8(17), - B(JumpIfTrue), U8(104), + B(TestEqualStrict), R(4), U8(17), + B(JumpIfTrue), U8(90), B(LdaNamedProperty), R(1), U8(10), U8(18), - B(Star), R(5), + B(Star), R(6), B(TestUndetectable), B(JumpIfFalse), U8(4), - B(Jump), U8(93), + B(Jump), U8(79), B(LdaSmi), I8(1), - B(TestEqualStrict), R(3), U8(20), - B(JumpIfFalse), U8(61), - B(Ldar), R(5), + B(TestEqualStrict), R(4), U8(20), + B(JumpIfFalse), U8(47), + B(Ldar), R(6), B(TestTypeOf), U8(6), B(JumpIfFalse), U8(4), B(Jump), U8(18), - B(Wide), B(LdaSmi), I16(143), - B(Star), R(13), - B(LdaConstant), U8(11), + B(Wide), B(LdaSmi), I16(144), B(Star), R(14), - B(CallRuntime), U16(Runtime::kNewTypeError), R(13), U8(2), + B(LdaConstant), U8(11), + B(Star), R(15), + B(CallRuntime), U16(Runtime::kNewTypeError), R(14), U8(2), B(Throw), - B(Mov), R(context), R(13), - B(Mov), R(5), R(14), - B(Mov), R(1), R(15), - B(InvokeIntrinsic), U8(Runtime::k_Call), R(14), U8(2), - B(Jump), U8(20), - B(Star), R(14), - B(Ldar), R(closure), - B(CreateCatchContext), R(14), U8(8), U8(12), - B(Star), R(13), + B(Mov), R(context), R(14), + B(Mov), R(6), R(15), + B(Mov), R(1), R(16), + B(InvokeIntrinsic), U8(Runtime::k_Call), R(15), U8(2), + B(Jump), U8(6), B(LdaTheHole), B(SetPendingMessage), - B(Ldar), R(13), - B(PushContext), R(14), - B(PopContext), R(14), + B(Ldar), R(14), B(Jump), U8(27), - B(Mov), R(5), R(13), - B(Mov), R(1), R(14), - B(InvokeIntrinsic), U8(Runtime::k_Call), R(13), U8(2), - B(Star), R(6), - B(InvokeIntrinsic), U8(Runtime::k_IsJSReceiver), R(6), U8(1), + B(Mov), R(6), R(14), + B(Mov), R(1), R(15), + B(InvokeIntrinsic), U8(Runtime::k_Call), R(14), U8(2), + B(Star), R(7), + B(InvokeIntrinsic), U8(Runtime::k_IsJSReceiver), R(7), U8(1), B(JumpIfToBooleanFalse), U8(4), B(Jump), U8(7), - B(CallRuntime), U16(Runtime::kThrowIteratorResultNotAnObject), R(6), U8(1), - B(Ldar), R(12), + B(CallRuntime), U16(Runtime::kThrowIteratorResultNotAnObject), R(7), U8(1), + B(Ldar), R(13), B(SetPendingMessage), B(LdaZero), - B(TestEqualStrictNoFeedback), R(10), + B(TestEqualStrictNoFeedback), R(11), B(JumpIfFalse), U8(5), - B(Ldar), R(11), + B(Ldar), R(12), B(ReThrow), - B(PopContext), R(9), + B(PopContext), R(10), B(LdaUndefined), /* 54 S> */ B(Return), ] @@ -321,7 +308,6 @@ constant pool: [ FIXED_ARRAY_TYPE, ONE_BYTE_INTERNALIZED_STRING_TYPE ["return"], ONE_BYTE_INTERNALIZED_STRING_TYPE [""], - FIXED_ARRAY_TYPE, ] handlers: [ [35, 205, 213], @@ -336,127 +322,121 @@ snippet: " } f([1, 2, 3]); " -frame size: 14 +frame size: 15 parameter count: 2 -bytecode array length: 280 +bytecode array length: 266 bytecodes: [ /* 10 E> */ B(StackCheck), B(LdaZero), - B(Star), R(4), - B(Mov), R(context), R(10), + B(Star), R(5), B(Mov), R(context), R(11), + B(Mov), R(context), R(12), /* 34 S> */ B(LdaNamedProperty), R(arg0), U8(0), U8(0), - B(Star), R(13), - B(CallProperty0), R(13), R(arg0), U8(2), - B(Mov), R(arg0), R(12), + B(Star), R(14), + B(CallProperty0), R(14), R(arg0), U8(2), + B(Mov), R(arg0), R(13), B(JumpIfJSReceiver), U8(7), B(CallRuntime), U16(Runtime::kThrowSymbolIteratorInvalid), R(0), U8(0), B(Star), R(2), - /* 29 S> */ B(LdaNamedProperty), R(2), U8(1), U8(4), - B(Star), R(12), - B(CallProperty0), R(12), R(2), U8(6), + /* 34 E> */ B(LdaNamedProperty), R(2), U8(1), U8(4), B(Star), R(3), - /* 29 E> */ B(InvokeIntrinsic), U8(Runtime::k_IsJSReceiver), R(3), U8(1), + /* 29 S> */ B(CallProperty0), R(3), R(2), U8(6), + B(Star), R(4), + /* 29 E> */ B(InvokeIntrinsic), U8(Runtime::k_IsJSReceiver), R(4), U8(1), B(ToBooleanLogicalNot), B(JumpIfFalse), U8(7), - B(CallRuntime), U16(Runtime::kThrowIteratorResultNotAnObject), R(3), U8(1), - B(LdaNamedProperty), R(3), U8(2), U8(8), + B(CallRuntime), U16(Runtime::kThrowIteratorResultNotAnObject), R(4), U8(1), + B(LdaNamedProperty), R(4), U8(2), U8(8), B(JumpIfToBooleanTrue), U8(46), - B(LdaNamedProperty), R(3), U8(3), U8(10), - B(Star), R(5), + B(LdaNamedProperty), R(4), U8(3), U8(10), + B(Star), R(6), B(LdaSmi), I8(2), - B(Star), R(4), - B(Mov), R(5), R(1), + B(Star), R(5), + B(Mov), R(6), R(1), /* 20 E> */ B(StackCheck), B(Ldar), R(closure), B(CreateBlockContext), U8(4), - B(PushContext), R(12), + B(PushContext), R(13), B(LdaTheHole), B(StaCurrentContextSlot), U8(4), - B(Ldar), R(5), + B(Ldar), R(6), B(StaCurrentContextSlot), U8(4), /* 41 S> */ B(CreateClosure), U8(5), U8(12), U8(2), - B(Star), R(13), - /* 67 E> */ B(CallUndefinedReceiver0), R(13), U8(13), - B(PopContext), R(12), + B(Star), R(14), + /* 67 E> */ B(CallUndefinedReceiver0), R(14), U8(13), + B(PopContext), R(13), B(LdaZero), - B(Star), R(4), - B(JumpLoop), U8(71), I8(0), + B(Star), R(5), + B(JumpLoop), U8(65), I8(0), B(Jump), U8(36), - B(Star), R(12), + B(Star), R(13), B(Ldar), R(closure), - B(CreateCatchContext), R(12), U8(6), U8(7), - B(PushContext), R(12), - B(Star), R(11), + B(CreateCatchContext), R(13), U8(6), U8(7), + B(PushContext), R(13), + B(Star), R(12), B(LdaSmi), I8(2), - B(TestEqualStrict), R(4), U8(15), + B(TestEqualStrict), R(5), U8(15), B(JumpIfFalse), U8(6), B(LdaSmi), I8(1), - B(Star), R(4), + B(Star), R(5), B(LdaImmutableCurrentContextSlot), U8(4), - B(Star), R(13), - B(CallRuntime), U16(Runtime::kReThrow), R(13), U8(1), - B(PopContext), R(12), + B(Star), R(14), + B(CallRuntime), U16(Runtime::kReThrow), R(14), U8(1), + B(PopContext), R(13), B(LdaSmi), I8(-1), + B(Star), R(10), B(Star), R(9), - B(Star), R(8), B(Jump), U8(7), - B(Star), R(9), + B(Star), R(10), B(LdaZero), - B(Star), R(8), + B(Star), R(9), B(LdaTheHole), B(SetPendingMessage), - B(Star), R(10), + B(Star), R(11), B(LdaZero), - B(TestEqualStrict), R(4), U8(16), - B(JumpIfTrue), U8(104), + B(TestEqualStrict), R(5), U8(16), + B(JumpIfTrue), U8(90), B(LdaNamedProperty), R(2), U8(8), U8(17), - B(Star), R(6), + B(Star), R(7), B(TestUndetectable), B(JumpIfFalse), U8(4), - B(Jump), U8(93), + B(Jump), U8(79), B(LdaSmi), I8(1), - B(TestEqualStrict), R(4), U8(19), - B(JumpIfFalse), U8(61), - B(Ldar), R(6), + B(TestEqualStrict), R(5), U8(19), + B(JumpIfFalse), U8(47), + B(Ldar), R(7), B(TestTypeOf), U8(6), B(JumpIfFalse), U8(4), B(Jump), U8(18), - B(Wide), B(LdaSmi), I16(143), - B(Star), R(11), - B(LdaConstant), U8(9), + B(Wide), B(LdaSmi), I16(144), B(Star), R(12), - B(CallRuntime), U16(Runtime::kNewTypeError), R(11), U8(2), + B(LdaConstant), U8(9), + B(Star), R(13), + B(CallRuntime), U16(Runtime::kNewTypeError), R(12), U8(2), B(Throw), - B(Mov), R(context), R(11), - B(Mov), R(6), R(12), - B(Mov), R(2), R(13), - B(InvokeIntrinsic), U8(Runtime::k_Call), R(12), U8(2), - B(Jump), U8(20), - B(Star), R(12), - B(Ldar), R(closure), - B(CreateCatchContext), R(12), U8(6), U8(10), - B(Star), R(11), + B(Mov), R(context), R(12), + B(Mov), R(7), R(13), + B(Mov), R(2), R(14), + B(InvokeIntrinsic), U8(Runtime::k_Call), R(13), U8(2), + B(Jump), U8(6), B(LdaTheHole), B(SetPendingMessage), - B(Ldar), R(11), - B(PushContext), R(12), - B(PopContext), R(12), + B(Ldar), R(12), B(Jump), U8(27), - B(Mov), R(6), R(11), - B(Mov), R(2), R(12), - B(InvokeIntrinsic), U8(Runtime::k_Call), R(11), U8(2), - B(Star), R(7), - B(InvokeIntrinsic), U8(Runtime::k_IsJSReceiver), R(7), U8(1), + B(Mov), R(7), R(12), + B(Mov), R(2), R(13), + B(InvokeIntrinsic), U8(Runtime::k_Call), R(12), U8(2), + B(Star), R(8), + B(InvokeIntrinsic), U8(Runtime::k_IsJSReceiver), R(8), U8(1), B(JumpIfToBooleanFalse), U8(4), B(Jump), U8(7), - B(CallRuntime), U16(Runtime::kThrowIteratorResultNotAnObject), R(7), U8(1), - B(Ldar), R(10), + B(CallRuntime), U16(Runtime::kThrowIteratorResultNotAnObject), R(8), U8(1), + B(Ldar), R(11), B(SetPendingMessage), B(LdaZero), - B(TestEqualStrictNoFeedback), R(8), + B(TestEqualStrictNoFeedback), R(9), B(JumpIfFalse), U8(5), - B(Ldar), R(9), + B(Ldar), R(10), B(ReThrow), B(LdaUndefined), /* 73 S> */ B(Return), @@ -472,7 +452,6 @@ constant pool: [ FIXED_ARRAY_TYPE, ONE_BYTE_INTERNALIZED_STRING_TYPE ["return"], ONE_BYTE_INTERNALIZED_STRING_TYPE [""], - FIXED_ARRAY_TYPE, ] handlers: [ [7, 142, 150], @@ -487,48 +466,48 @@ snippet: " } f([{ x: 0, y: 3 }, { x: 1, y: 9 }, { x: -12, y: 17 }]); " -frame size: 19 +frame size: 20 parameter count: 2 -bytecode array length: 300 +bytecode array length: 286 bytecodes: [ /* 10 E> */ B(StackCheck), B(LdaZero), - B(Star), R(9), - B(Mov), R(context), R(15), + B(Star), R(10), B(Mov), R(context), R(16), + B(Mov), R(context), R(17), /* 41 S> */ B(LdaNamedProperty), R(arg0), U8(0), U8(0), - B(Star), R(18), - B(CallProperty0), R(18), R(arg0), U8(2), - B(Mov), R(arg0), R(17), + B(Star), R(19), + B(CallProperty0), R(19), R(arg0), U8(2), + B(Mov), R(arg0), R(18), B(JumpIfJSReceiver), U8(7), B(CallRuntime), U16(Runtime::kThrowSymbolIteratorInvalid), R(0), U8(0), B(Star), R(7), - /* 36 S> */ B(LdaNamedProperty), R(7), U8(1), U8(4), - B(Star), R(17), - B(CallProperty0), R(17), R(7), U8(6), + /* 41 E> */ B(LdaNamedProperty), R(7), U8(1), U8(4), B(Star), R(8), - /* 36 E> */ B(InvokeIntrinsic), U8(Runtime::k_IsJSReceiver), R(8), U8(1), + /* 36 S> */ B(CallProperty0), R(8), R(7), U8(6), + B(Star), R(9), + /* 36 E> */ B(InvokeIntrinsic), U8(Runtime::k_IsJSReceiver), R(9), U8(1), B(ToBooleanLogicalNot), B(JumpIfFalse), U8(7), - B(CallRuntime), U16(Runtime::kThrowIteratorResultNotAnObject), R(8), U8(1), - B(LdaNamedProperty), R(8), U8(2), U8(8), + B(CallRuntime), U16(Runtime::kThrowIteratorResultNotAnObject), R(9), U8(1), + B(LdaNamedProperty), R(9), U8(2), U8(8), B(JumpIfToBooleanTrue), U8(66), - B(LdaNamedProperty), R(8), U8(3), U8(10), - B(Star), R(10), + B(LdaNamedProperty), R(9), U8(3), U8(10), + B(Star), R(11), B(LdaSmi), I8(2), - B(Star), R(9), - B(Mov), R(10), R(5), + B(Star), R(10), + B(Mov), R(11), R(5), /* 20 E> */ B(StackCheck), B(Mov), R(5), R(6), B(Ldar), R(6), B(JumpIfUndefined), U8(6), B(Ldar), R(6), B(JumpIfNotNull), U8(16), - B(LdaSmi), I8(73), - B(Star), R(17), - B(LdaConstant), U8(4), + B(LdaSmi), I8(74), B(Star), R(18), - B(CallRuntime), U16(Runtime::kNewTypeError), R(17), U8(2), + B(LdaConstant), U8(4), + B(Star), R(19), + B(CallRuntime), U16(Runtime::kNewTypeError), R(18), U8(2), /* 31 E> */ B(Throw), /* 31 S> */ B(LdaNamedProperty), R(6), U8(4), U8(12), B(Star), R(1), @@ -538,83 +517,77 @@ bytecodes: [ /* 58 E> */ B(Add), R(1), U8(16), B(Star), R(0), B(LdaZero), - B(Star), R(9), - B(JumpLoop), U8(91), I8(0), + B(Star), R(10), + B(JumpLoop), U8(85), I8(0), B(Jump), U8(36), - B(Star), R(17), + B(Star), R(18), B(Ldar), R(closure), - /* 56 E> */ B(CreateCatchContext), R(17), U8(6), U8(7), - B(PushContext), R(17), - B(Star), R(16), + /* 56 E> */ B(CreateCatchContext), R(18), U8(6), U8(7), + B(PushContext), R(18), + B(Star), R(17), B(LdaSmi), I8(2), - B(TestEqualStrict), R(9), U8(17), + B(TestEqualStrict), R(10), U8(17), B(JumpIfFalse), U8(6), B(LdaSmi), I8(1), - B(Star), R(9), + B(Star), R(10), B(LdaImmutableCurrentContextSlot), U8(4), - B(Star), R(18), - B(CallRuntime), U16(Runtime::kReThrow), R(18), U8(1), - B(PopContext), R(17), + B(Star), R(19), + B(CallRuntime), U16(Runtime::kReThrow), R(19), U8(1), + B(PopContext), R(18), B(LdaSmi), I8(-1), + B(Star), R(15), B(Star), R(14), - B(Star), R(13), B(Jump), U8(7), - B(Star), R(14), + B(Star), R(15), B(LdaZero), - B(Star), R(13), + B(Star), R(14), B(LdaTheHole), B(SetPendingMessage), - B(Star), R(15), + B(Star), R(16), B(LdaZero), - B(TestEqualStrict), R(9), U8(18), - B(JumpIfTrue), U8(104), + B(TestEqualStrict), R(10), U8(18), + B(JumpIfTrue), U8(90), B(LdaNamedProperty), R(7), U8(8), U8(19), - B(Star), R(11), + B(Star), R(12), B(TestUndetectable), B(JumpIfFalse), U8(4), - B(Jump), U8(93), + B(Jump), U8(79), B(LdaSmi), I8(1), - B(TestEqualStrict), R(9), U8(21), - B(JumpIfFalse), U8(61), - B(Ldar), R(11), + B(TestEqualStrict), R(10), U8(21), + B(JumpIfFalse), U8(47), + B(Ldar), R(12), B(TestTypeOf), U8(6), B(JumpIfFalse), U8(4), B(Jump), U8(18), - B(Wide), B(LdaSmi), I16(143), - B(Star), R(16), - B(LdaConstant), U8(9), + B(Wide), B(LdaSmi), I16(144), B(Star), R(17), - B(CallRuntime), U16(Runtime::kNewTypeError), R(16), U8(2), + B(LdaConstant), U8(9), + B(Star), R(18), + B(CallRuntime), U16(Runtime::kNewTypeError), R(17), U8(2), B(Throw), - B(Mov), R(context), R(16), - B(Mov), R(11), R(17), - B(Mov), R(7), R(18), - B(InvokeIntrinsic), U8(Runtime::k_Call), R(17), U8(2), - B(Jump), U8(20), - B(Star), R(17), - B(Ldar), R(closure), - B(CreateCatchContext), R(17), U8(6), U8(10), - B(Star), R(16), + B(Mov), R(context), R(17), + B(Mov), R(12), R(18), + B(Mov), R(7), R(19), + B(InvokeIntrinsic), U8(Runtime::k_Call), R(18), U8(2), + B(Jump), U8(6), B(LdaTheHole), B(SetPendingMessage), - B(Ldar), R(16), - B(PushContext), R(17), - B(PopContext), R(17), + B(Ldar), R(17), B(Jump), U8(27), - B(Mov), R(11), R(16), - B(Mov), R(7), R(17), - B(InvokeIntrinsic), U8(Runtime::k_Call), R(16), U8(2), - B(Star), R(12), - B(InvokeIntrinsic), U8(Runtime::k_IsJSReceiver), R(12), U8(1), + B(Mov), R(12), R(17), + B(Mov), R(7), R(18), + B(InvokeIntrinsic), U8(Runtime::k_Call), R(17), U8(2), + B(Star), R(13), + B(InvokeIntrinsic), U8(Runtime::k_IsJSReceiver), R(13), U8(1), B(JumpIfToBooleanFalse), U8(4), B(Jump), U8(7), - B(CallRuntime), U16(Runtime::kThrowIteratorResultNotAnObject), R(12), U8(1), - B(Ldar), R(15), + B(CallRuntime), U16(Runtime::kThrowIteratorResultNotAnObject), R(13), U8(1), + B(Ldar), R(16), B(SetPendingMessage), B(LdaZero), - B(TestEqualStrictNoFeedback), R(13), + B(TestEqualStrictNoFeedback), R(14), B(JumpIfFalse), U8(5), - B(Ldar), R(14), + B(Ldar), R(15), B(ReThrow), B(LdaUndefined), /* 65 S> */ B(Return), @@ -630,7 +603,6 @@ constant pool: [ FIXED_ARRAY_TYPE, ONE_BYTE_INTERNALIZED_STRING_TYPE ["return"], ONE_BYTE_INTERNALIZED_STRING_TYPE [""], - FIXED_ARRAY_TYPE, ] handlers: [ [7, 162, 170], @@ -645,150 +617,141 @@ snippet: " } f([1, 2, 3]); " -frame size: 19 +frame size: 20 parameter count: 2 -bytecode array length: 341 +bytecode array length: 320 bytecodes: [ B(Ldar), R(3), B(JumpIfUndefined), U8(18), B(InvokeIntrinsic), U8(Runtime::k_GeneratorGetContext), R(3), U8(1), - B(PushContext), R(12), + B(PushContext), R(13), B(RestoreGeneratorState), R(3), - B(Star), R(11), + B(Star), R(12), B(SwitchOnSmiNoFeedback), U8(0), U8(1), I8(0), - B(Abort), U8(42), + B(Abort), U8(15), B(LdaSmi), I8(-2), - B(Star), R(11), + B(Star), R(12), B(CreateFunctionContext), U8(1), - B(PushContext), R(12), + B(PushContext), R(13), B(Ldar), R(arg0), B(StaCurrentContextSlot), U8(4), - B(Mov), R(closure), R(13), - B(Mov), R(this), R(14), - B(InvokeIntrinsic), U8(Runtime::k_CreateJSGeneratorObject), R(13), U8(2), + B(Mov), R(closure), R(14), + B(Mov), R(this), R(15), + B(InvokeIntrinsic), U8(Runtime::k_CreateJSGeneratorObject), R(14), U8(2), B(Star), R(3), /* 11 E> */ B(StackCheck), - /* 11 E> */ B(SuspendGenerator), R(3), R(0), U8(13), U8(0), + /* 11 E> */ B(SuspendGenerator), R(3), R(0), U8(14), U8(0), /* 55 S> */ B(Return), - B(RestoreGeneratorRegisters), R(3), R(0), U8(13), - B(LdaSmi), I8(-2), - B(Star), R(11), - B(InvokeIntrinsic), U8(Runtime::k_GeneratorGetInputOrDebugPos), R(3), U8(1), - B(Star), R(13), + B(ResumeGenerator), R(3), R(12), R(0), U8(14), + B(Star), R(14), B(InvokeIntrinsic), U8(Runtime::k_GeneratorGetResumeMode), R(3), U8(1), B(SwitchOnSmiNoFeedback), U8(1), U8(2), I8(0), - B(Ldar), R(13), + B(Ldar), R(14), /* 11 E> */ B(Throw), - B(Ldar), R(13), + B(Ldar), R(14), /* 55 S> */ B(Return), B(LdaZero), - B(Star), R(7), - B(Mov), R(context), R(15), + B(Star), R(8), B(Mov), R(context), R(16), + B(Mov), R(context), R(17), /* 35 S> */ B(LdaImmutableCurrentContextSlot), U8(4), - B(Star), R(17), - B(LdaNamedProperty), R(17), U8(3), U8(0), B(Star), R(18), - B(CallProperty0), R(18), R(17), U8(2), + B(LdaNamedProperty), R(18), U8(3), U8(0), + B(Star), R(19), + B(CallProperty0), R(19), R(18), U8(2), B(JumpIfJSReceiver), U8(7), B(CallRuntime), U16(Runtime::kThrowSymbolIteratorInvalid), R(0), U8(0), B(Star), R(5), - /* 30 S> */ B(LdaNamedProperty), R(5), U8(4), U8(4), - B(Star), R(17), - B(CallProperty0), R(17), R(5), U8(6), + /* 35 E> */ B(LdaNamedProperty), R(5), U8(4), U8(4), B(Star), R(6), - /* 30 E> */ B(InvokeIntrinsic), U8(Runtime::k_IsJSReceiver), R(6), U8(1), + /* 30 S> */ B(CallProperty0), R(6), R(5), U8(6), + B(Star), R(7), + /* 30 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(5), U8(8), + B(CallRuntime), U16(Runtime::kThrowIteratorResultNotAnObject), R(7), U8(1), + B(LdaNamedProperty), R(7), U8(5), U8(8), B(JumpIfToBooleanTrue), U8(28), - B(LdaNamedProperty), R(6), U8(6), U8(10), - B(Star), R(8), + B(LdaNamedProperty), R(7), U8(6), U8(10), + B(Star), R(9), B(LdaSmi), I8(2), - B(Star), R(7), - B(Mov), R(8), R(4), + B(Star), R(8), + B(Mov), R(9), R(4), /* 21 E> */ B(StackCheck), B(Mov), R(4), R(1), /* 50 S> */ B(Mov), R(1), R(0), B(LdaZero), - B(Star), R(7), - B(JumpLoop), U8(53), I8(0), + B(Star), R(8), + B(JumpLoop), U8(47), I8(0), B(Jump), U8(36), - B(Star), R(17), + B(Star), R(18), B(Ldar), R(closure), - /* 50 E> */ B(CreateCatchContext), R(17), U8(7), U8(8), - B(PushContext), R(17), - B(Star), R(16), + /* 50 E> */ B(CreateCatchContext), R(18), U8(7), U8(8), + B(PushContext), R(18), + B(Star), R(17), 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(18), - B(CallRuntime), U16(Runtime::kReThrow), R(18), U8(1), - B(PopContext), R(17), + B(Star), R(19), + B(CallRuntime), U16(Runtime::kReThrow), R(19), U8(1), + B(PopContext), R(18), B(LdaSmi), I8(-1), + B(Star), R(15), B(Star), R(14), - B(Star), R(13), B(Jump), U8(7), - B(Star), R(14), + B(Star), R(15), B(LdaZero), - B(Star), R(13), + B(Star), R(14), B(LdaTheHole), B(SetPendingMessage), - B(Star), R(15), + B(Star), R(16), B(LdaZero), - B(TestEqualStrict), R(7), U8(13), - B(JumpIfTrue), U8(104), + B(TestEqualStrict), R(8), U8(13), + B(JumpIfTrue), U8(90), B(LdaNamedProperty), R(5), U8(9), U8(14), - B(Star), R(9), + B(Star), R(10), B(TestUndetectable), B(JumpIfFalse), U8(4), - B(Jump), U8(93), + B(Jump), U8(79), B(LdaSmi), I8(1), - B(TestEqualStrict), R(7), U8(16), - B(JumpIfFalse), U8(61), - B(Ldar), R(9), + B(TestEqualStrict), R(8), U8(16), + B(JumpIfFalse), U8(47), + B(Ldar), R(10), B(TestTypeOf), U8(6), B(JumpIfFalse), U8(4), B(Jump), U8(18), - B(Wide), B(LdaSmi), I16(143), - B(Star), R(16), - B(LdaConstant), U8(10), + B(Wide), B(LdaSmi), I16(144), B(Star), R(17), - B(CallRuntime), U16(Runtime::kNewTypeError), R(16), U8(2), + B(LdaConstant), U8(10), + B(Star), R(18), + B(CallRuntime), U16(Runtime::kNewTypeError), R(17), U8(2), B(Throw), - B(Mov), R(context), R(16), - B(Mov), R(9), R(17), - B(Mov), R(5), R(18), - B(InvokeIntrinsic), U8(Runtime::k_Call), R(17), U8(2), - B(Jump), U8(20), - B(Star), R(17), - B(Ldar), R(closure), - B(CreateCatchContext), R(17), U8(7), U8(11), - B(Star), R(16), + B(Mov), R(context), R(17), + B(Mov), R(10), R(18), + B(Mov), R(5), R(19), + B(InvokeIntrinsic), U8(Runtime::k_Call), R(18), U8(2), + B(Jump), U8(6), B(LdaTheHole), B(SetPendingMessage), - B(Ldar), R(16), - B(PushContext), R(17), - B(PopContext), R(17), + B(Ldar), R(17), B(Jump), U8(27), - B(Mov), R(9), R(16), - B(Mov), R(5), R(17), - B(InvokeIntrinsic), U8(Runtime::k_Call), R(16), U8(2), - B(Star), R(10), - B(InvokeIntrinsic), U8(Runtime::k_IsJSReceiver), R(10), U8(1), + B(Mov), R(10), R(17), + B(Mov), R(5), R(18), + B(InvokeIntrinsic), U8(Runtime::k_Call), R(17), U8(2), + 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(Ldar), R(15), + B(CallRuntime), U16(Runtime::kThrowIteratorResultNotAnObject), R(11), U8(1), + B(Ldar), R(16), B(SetPendingMessage), B(LdaZero), - B(TestEqualStrictNoFeedback), R(13), + B(TestEqualStrictNoFeedback), R(14), B(JumpIfFalse), U8(5), - B(Ldar), R(14), + B(Ldar), R(15), B(ReThrow), B(LdaUndefined), /* 55 S> */ B(Return), @@ -805,12 +768,11 @@ constant pool: [ FIXED_ARRAY_TYPE, ONE_BYTE_INTERNALIZED_STRING_TYPE ["return"], ONE_BYTE_INTERNALIZED_STRING_TYPE [""], - FIXED_ARRAY_TYPE, ] handlers: [ - [85, 203, 211], - [88, 167, 169], - [271, 281, 283], + [78, 196, 204], + [81, 160, 162], + [264, 274, 276], ] --- @@ -820,188 +782,176 @@ snippet: " } f([1, 2, 3]); " -frame size: 18 +frame size: 19 parameter count: 2 -bytecode array length: 408 +bytecode array length: 380 bytecodes: [ B(Ldar), R(2), B(JumpIfUndefined), U8(18), B(InvokeIntrinsic), U8(Runtime::k_GeneratorGetContext), R(2), U8(1), - B(PushContext), R(11), + B(PushContext), R(12), B(RestoreGeneratorState), R(2), - B(Star), R(10), + B(Star), R(11), B(SwitchOnSmiNoFeedback), U8(0), U8(2), I8(0), - B(Abort), U8(42), + B(Abort), U8(15), B(LdaSmi), I8(-2), - B(Star), R(10), + B(Star), R(11), B(CreateFunctionContext), U8(1), - B(PushContext), R(11), + B(PushContext), R(12), B(Ldar), R(arg0), B(StaCurrentContextSlot), U8(4), - B(Mov), R(closure), R(12), - B(Mov), R(this), R(13), - B(InvokeIntrinsic), U8(Runtime::k_CreateJSGeneratorObject), R(12), U8(2), + B(Mov), R(closure), R(13), + B(Mov), R(this), R(14), + B(InvokeIntrinsic), U8(Runtime::k_CreateJSGeneratorObject), R(13), U8(2), B(Star), R(2), /* 11 E> */ B(StackCheck), - /* 11 E> */ B(SuspendGenerator), R(2), R(0), U8(12), U8(0), + /* 11 E> */ B(SuspendGenerator), R(2), R(0), U8(13), U8(0), /* 49 S> */ B(Return), - B(RestoreGeneratorRegisters), R(2), R(0), U8(12), - B(LdaSmi), I8(-2), - B(Star), R(10), - B(InvokeIntrinsic), U8(Runtime::k_GeneratorGetInputOrDebugPos), R(2), U8(1), - B(Star), R(12), + B(ResumeGenerator), R(2), R(11), R(0), U8(13), + B(Star), R(13), B(InvokeIntrinsic), U8(Runtime::k_GeneratorGetResumeMode), R(2), U8(1), B(SwitchOnSmiNoFeedback), U8(2), U8(2), I8(0), - B(Ldar), R(12), + B(Ldar), R(13), /* 11 E> */ B(Throw), - B(Ldar), R(12), + B(Ldar), R(13), /* 49 S> */ B(Return), B(LdaZero), - B(Star), R(6), - B(Mov), R(context), R(14), + B(Star), R(7), B(Mov), R(context), R(15), + B(Mov), R(context), R(16), /* 35 S> */ B(LdaImmutableCurrentContextSlot), U8(4), - B(Star), R(16), - B(LdaNamedProperty), R(16), U8(4), U8(0), B(Star), R(17), - B(CallProperty0), R(17), R(16), U8(2), + B(LdaNamedProperty), R(17), U8(4), U8(0), + B(Star), R(18), + B(CallProperty0), R(18), R(17), U8(2), B(JumpIfJSReceiver), U8(7), B(CallRuntime), U16(Runtime::kThrowSymbolIteratorInvalid), R(0), U8(0), B(Star), R(4), - B(Ldar), R(10), - B(SwitchOnSmiNoFeedback), U8(5), U8(1), I8(1), + /* 35 E> */ B(LdaNamedProperty), R(4), U8(5), U8(4), + B(Star), R(5), + B(Ldar), R(11), + B(SwitchOnSmiNoFeedback), U8(6), U8(1), I8(1), B(LdaSmi), I8(-2), - /* 35 E> */ B(TestEqualStrictNoFeedback), R(10), + B(TestEqualStrictNoFeedback), R(11), B(JumpIfTrue), U8(4), - B(Abort), U8(42), - /* 30 S> */ B(LdaNamedProperty), R(4), U8(6), U8(4), - B(Star), R(16), - B(CallProperty0), R(16), R(4), U8(6), - B(Star), R(5), - /* 30 E> */ B(InvokeIntrinsic), U8(Runtime::k_IsJSReceiver), R(5), U8(1), + B(Abort), U8(15), + /* 30 S> */ B(CallProperty0), R(5), R(4), U8(6), + B(Star), R(6), + /* 30 E> */ B(InvokeIntrinsic), U8(Runtime::k_IsJSReceiver), R(6), U8(1), B(ToBooleanLogicalNot), B(JumpIfFalse), U8(7), - B(CallRuntime), U16(Runtime::kThrowIteratorResultNotAnObject), R(5), U8(1), - B(LdaNamedProperty), R(5), U8(7), U8(8), - B(JumpIfToBooleanTrue), U8(74), - B(LdaNamedProperty), R(5), U8(8), U8(10), - B(Star), R(7), + B(CallRuntime), U16(Runtime::kThrowIteratorResultNotAnObject), R(6), U8(1), + B(LdaNamedProperty), R(6), U8(7), U8(8), + B(JumpIfToBooleanTrue), U8(67), + B(LdaNamedProperty), R(6), U8(8), U8(10), + B(Star), R(8), B(LdaSmi), I8(2), - B(Star), R(6), - B(Mov), R(7), R(3), + B(Star), R(7), + B(Mov), R(8), R(3), /* 21 E> */ B(StackCheck), B(Mov), R(3), R(0), /* 40 S> */ B(LdaFalse), - B(Star), R(17), - B(Mov), R(0), R(16), - B(InvokeIntrinsic), U8(Runtime::k_CreateIterResultObject), R(16), U8(2), - B(SuspendGenerator), R(2), R(0), U8(16), U8(1), + B(Star), R(18), + B(Mov), R(0), R(17), + B(InvokeIntrinsic), U8(Runtime::k_CreateIterResultObject), R(17), U8(2), + B(SuspendGenerator), R(2), R(0), U8(17), U8(1), /* 49 S> */ B(Return), - B(RestoreGeneratorRegisters), R(2), R(0), U8(16), - B(LdaSmi), I8(-2), - B(Star), R(10), - B(InvokeIntrinsic), U8(Runtime::k_GeneratorGetInputOrDebugPos), R(2), U8(1), - B(Star), R(16), + B(ResumeGenerator), R(2), R(11), R(0), U8(17), + B(Star), R(17), B(InvokeIntrinsic), U8(Runtime::k_GeneratorGetResumeMode), R(2), U8(1), B(SwitchOnSmiNoFeedback), U8(9), U8(2), I8(0), - B(Ldar), R(16), + B(Ldar), R(17), /* 40 E> */ B(Throw), B(LdaZero), - B(Star), R(12), - B(Mov), R(16), R(13), + B(Star), R(13), + B(Mov), R(17), R(14), B(Jump), U8(58), B(LdaZero), - B(Star), R(6), - B(JumpLoop), U8(113), I8(0), + B(Star), R(7), + B(JumpLoop), U8(100), I8(0), B(Jump), U8(36), - B(Star), R(16), + B(Star), R(17), B(Ldar), R(closure), - B(CreateCatchContext), R(16), U8(11), U8(12), - B(PushContext), R(16), - B(Star), R(15), + B(CreateCatchContext), R(17), U8(11), U8(12), + B(PushContext), R(17), + B(Star), R(16), B(LdaSmi), I8(2), - B(TestEqualStrict), R(6), U8(12), + B(TestEqualStrict), R(7), U8(12), B(JumpIfFalse), U8(6), B(LdaSmi), I8(1), - B(Star), R(6), + B(Star), R(7), B(LdaImmutableCurrentContextSlot), U8(4), - B(Star), R(17), - B(CallRuntime), U16(Runtime::kReThrow), R(17), U8(1), - B(PopContext), R(16), + B(Star), R(18), + B(CallRuntime), U16(Runtime::kReThrow), R(18), U8(1), + B(PopContext), R(17), B(LdaSmi), I8(-1), + B(Star), R(14), B(Star), R(13), - B(Star), R(12), B(Jump), U8(8), - B(Star), R(13), + B(Star), R(14), B(LdaSmi), I8(1), - B(Star), R(12), + B(Star), R(13), B(LdaTheHole), B(SetPendingMessage), - B(Star), R(14), + B(Star), R(15), B(LdaZero), - B(TestEqualStrict), R(6), U8(13), - B(JumpIfTrue), U8(104), + B(TestEqualStrict), R(7), U8(13), + B(JumpIfTrue), U8(90), B(LdaNamedProperty), R(4), U8(13), U8(14), - B(Star), R(8), + B(Star), R(9), B(TestUndetectable), B(JumpIfFalse), U8(4), - B(Jump), U8(93), + B(Jump), U8(79), B(LdaSmi), I8(1), - B(TestEqualStrict), R(6), U8(16), - B(JumpIfFalse), U8(61), - B(Ldar), R(8), + B(TestEqualStrict), R(7), U8(16), + B(JumpIfFalse), U8(47), + B(Ldar), R(9), B(TestTypeOf), U8(6), B(JumpIfFalse), U8(4), B(Jump), U8(18), - B(Wide), B(LdaSmi), I16(143), - B(Star), R(15), - B(LdaConstant), U8(14), + B(Wide), B(LdaSmi), I16(144), B(Star), R(16), - B(CallRuntime), U16(Runtime::kNewTypeError), R(15), U8(2), + B(LdaConstant), U8(14), + B(Star), R(17), + B(CallRuntime), U16(Runtime::kNewTypeError), R(16), U8(2), B(Throw), - B(Mov), R(context), R(15), - B(Mov), R(8), R(16), - B(Mov), R(4), R(17), - B(InvokeIntrinsic), U8(Runtime::k_Call), R(16), U8(2), - B(Jump), U8(20), - B(Star), R(16), - B(Ldar), R(closure), - B(CreateCatchContext), R(16), U8(11), U8(15), - B(Star), R(15), + B(Mov), R(context), R(16), + B(Mov), R(9), R(17), + B(Mov), R(4), R(18), + B(InvokeIntrinsic), U8(Runtime::k_Call), R(17), U8(2), + B(Jump), U8(6), B(LdaTheHole), B(SetPendingMessage), - B(Ldar), R(15), - B(PushContext), R(16), - B(PopContext), R(16), + B(Ldar), R(16), B(Jump), U8(27), - B(Mov), R(8), R(15), - B(Mov), R(4), R(16), - B(InvokeIntrinsic), U8(Runtime::k_Call), R(15), U8(2), - B(Star), R(9), - B(InvokeIntrinsic), U8(Runtime::k_IsJSReceiver), R(9), U8(1), + B(Mov), R(9), R(16), + B(Mov), R(4), R(17), + B(InvokeIntrinsic), U8(Runtime::k_Call), R(16), U8(2), + B(Star), R(10), + B(InvokeIntrinsic), U8(Runtime::k_IsJSReceiver), R(10), U8(1), B(JumpIfToBooleanFalse), U8(4), B(Jump), U8(7), - B(CallRuntime), U16(Runtime::kThrowIteratorResultNotAnObject), R(9), U8(1), - B(Ldar), R(14), + B(CallRuntime), U16(Runtime::kThrowIteratorResultNotAnObject), R(10), U8(1), + B(Ldar), R(15), B(SetPendingMessage), - B(Ldar), R(12), - B(SwitchOnSmiNoFeedback), U8(16), U8(2), I8(0), - B(Jump), U8(8), B(Ldar), R(13), + B(SwitchOnSmiNoFeedback), U8(15), U8(2), I8(0), + B(Jump), U8(8), + B(Ldar), R(14), /* 49 S> */ B(Return), - B(Ldar), R(13), + B(Ldar), R(14), B(ReThrow), B(LdaUndefined), /* 49 S> */ B(Return), ] constant pool: [ Smi [37], - Smi [97], + Smi [96], Smi [10], Smi [7], SYMBOL_TYPE, - Smi [75], ONE_BYTE_INTERNALIZED_STRING_TYPE ["next"], + Smi [69], ONE_BYTE_INTERNALIZED_STRING_TYPE ["done"], ONE_BYTE_INTERNALIZED_STRING_TYPE ["value"], Smi [15], @@ -1010,14 +960,13 @@ constant pool: [ FIXED_ARRAY_TYPE, ONE_BYTE_INTERNALIZED_STRING_TYPE ["return"], ONE_BYTE_INTERNALIZED_STRING_TYPE [""], - FIXED_ARRAY_TYPE, Smi [6], Smi [9], ] handlers: [ - [85, 263, 271], - [88, 227, 229], - [332, 342, 344], + [78, 249, 257], + [81, 213, 215], + [318, 328, 330], ] --- @@ -1027,178 +976,172 @@ snippet: " } f([1, 2, 3]); " -frame size: 23 +frame size: 24 parameter count: 2 -bytecode array length: 386 +bytecode array length: 372 bytecodes: [ B(CreateFunctionContext), U8(1), - B(PushContext), R(12), + B(PushContext), R(13), B(Ldar), R(arg0), B(StaCurrentContextSlot), U8(4), /* 16 E> */ B(StackCheck), B(CallJSRuntime), U8(%async_function_promise_create), R(0), U8(0), - B(Star), R(11), - B(Mov), R(context), R(15), + B(Star), R(12), B(Mov), R(context), R(16), + B(Mov), R(context), R(17), B(LdaZero), - B(Star), R(7), - B(Mov), R(context), R(19), + B(Star), R(8), B(Mov), R(context), R(20), + B(Mov), R(context), R(21), /* 40 S> */ B(LdaImmutableCurrentContextSlot), U8(4), - B(Star), R(21), - B(LdaNamedProperty), R(21), U8(0), U8(0), B(Star), R(22), - B(CallProperty0), R(22), R(21), U8(2), + B(LdaNamedProperty), R(22), U8(0), U8(0), + B(Star), R(23), + B(CallProperty0), R(23), R(22), U8(2), B(JumpIfJSReceiver), U8(7), B(CallRuntime), U16(Runtime::kThrowSymbolIteratorInvalid), R(0), U8(0), B(Star), R(5), - /* 35 S> */ B(LdaNamedProperty), R(5), U8(1), U8(4), - B(Star), R(21), - B(CallProperty0), R(21), R(5), U8(6), + /* 40 E> */ B(LdaNamedProperty), R(5), U8(1), 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(2), U8(8), + B(CallRuntime), U16(Runtime::kThrowIteratorResultNotAnObject), R(7), U8(1), + B(LdaNamedProperty), R(7), U8(2), U8(8), B(JumpIfToBooleanTrue), U8(28), - B(LdaNamedProperty), R(6), U8(3), U8(10), - B(Star), R(8), + B(LdaNamedProperty), R(7), U8(3), U8(10), + B(Star), R(9), B(LdaSmi), I8(2), - B(Star), R(7), - B(Mov), R(8), R(4), + B(Star), R(8), + B(Mov), R(9), R(4), /* 26 E> */ B(StackCheck), B(Mov), R(4), R(1), /* 55 S> */ B(Mov), R(1), R(0), B(LdaZero), - B(Star), R(7), - B(JumpLoop), U8(53), I8(0), + B(Star), R(8), + B(JumpLoop), U8(47), I8(0), B(Jump), U8(40), - B(Star), R(21), + B(Star), R(22), B(Ldar), R(closure), - /* 55 E> */ B(CreateCatchContext), R(21), U8(4), U8(5), - B(Star), R(20), + /* 55 E> */ B(CreateCatchContext), R(22), U8(4), U8(5), + B(Star), R(21), B(LdaTheHole), B(SetPendingMessage), - B(Ldar), R(20), - B(PushContext), R(21), + B(Ldar), R(21), + B(PushContext), R(22), 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(22), - B(CallRuntime), U16(Runtime::kReThrow), R(22), U8(1), - B(PopContext), R(21), + B(Star), R(23), + B(CallRuntime), U16(Runtime::kReThrow), R(23), U8(1), + B(PopContext), R(22), B(LdaSmi), I8(-1), + B(Star), R(19), B(Star), R(18), - B(Star), R(17), B(Jump), U8(7), - B(Star), R(18), + B(Star), R(19), B(LdaZero), - B(Star), R(17), + B(Star), R(18), B(LdaTheHole), B(SetPendingMessage), - B(Star), R(19), + B(Star), R(20), B(LdaZero), - B(TestEqualStrict), R(7), U8(13), - B(JumpIfTrue), U8(104), + B(TestEqualStrict), R(8), U8(13), + B(JumpIfTrue), U8(90), B(LdaNamedProperty), R(5), U8(6), U8(14), - B(Star), R(9), + B(Star), R(10), B(TestUndetectable), B(JumpIfFalse), U8(4), - B(Jump), U8(93), + B(Jump), U8(79), B(LdaSmi), I8(1), - B(TestEqualStrict), R(7), U8(16), - B(JumpIfFalse), U8(61), - B(Ldar), R(9), + B(TestEqualStrict), R(8), U8(16), + B(JumpIfFalse), U8(47), + B(Ldar), R(10), B(TestTypeOf), U8(6), B(JumpIfFalse), U8(4), B(Jump), U8(18), - B(Wide), B(LdaSmi), I16(143), - B(Star), R(20), - B(LdaConstant), U8(7), + B(Wide), B(LdaSmi), I16(144), B(Star), R(21), - B(CallRuntime), U16(Runtime::kNewTypeError), R(20), U8(2), + B(LdaConstant), U8(7), + B(Star), R(22), + B(CallRuntime), U16(Runtime::kNewTypeError), R(21), U8(2), B(Throw), - B(Mov), R(context), R(20), - B(Mov), R(9), R(21), - B(Mov), R(5), R(22), - B(InvokeIntrinsic), U8(Runtime::k_Call), R(21), U8(2), - B(Jump), U8(20), - B(Star), R(21), - B(Ldar), R(closure), - B(CreateCatchContext), R(21), U8(4), U8(8), - B(Star), R(20), + B(Mov), R(context), R(21), + B(Mov), R(10), R(22), + B(Mov), R(5), R(23), + B(InvokeIntrinsic), U8(Runtime::k_Call), R(22), U8(2), + B(Jump), U8(6), B(LdaTheHole), B(SetPendingMessage), - B(Ldar), R(20), - B(PushContext), R(21), - B(PopContext), R(21), + B(Ldar), R(21), B(Jump), U8(27), - B(Mov), R(9), R(20), - B(Mov), R(5), R(21), - B(InvokeIntrinsic), U8(Runtime::k_Call), R(20), U8(2), - B(Star), R(10), - B(InvokeIntrinsic), U8(Runtime::k_IsJSReceiver), R(10), U8(1), + B(Mov), R(10), R(21), + B(Mov), R(5), R(22), + B(InvokeIntrinsic), U8(Runtime::k_Call), R(21), U8(2), + 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(Ldar), R(19), + B(CallRuntime), U16(Runtime::kThrowIteratorResultNotAnObject), R(11), U8(1), + B(Ldar), R(20), B(SetPendingMessage), B(LdaZero), - B(TestEqualStrictNoFeedback), R(17), + B(TestEqualStrictNoFeedback), R(18), B(JumpIfFalse), U8(5), - B(Ldar), R(18), + B(Ldar), R(19), B(ReThrow), B(LdaUndefined), - B(Star), R(18), - B(Mov), R(11), R(17), - B(CallJSRuntime), U8(%promise_resolve), R(17), U8(2), + B(Star), R(19), + B(Mov), R(12), R(18), + B(CallJSRuntime), U8(%promise_resolve), R(18), U8(2), B(LdaZero), - B(Star), R(13), - B(Mov), R(11), R(14), + B(Star), R(14), + B(Mov), R(12), R(15), B(Jump), U8(58), B(Jump), U8(42), - B(Star), R(17), + B(Star), R(18), B(Ldar), R(closure), - B(CreateCatchContext), R(17), U8(4), U8(9), - B(Star), R(16), + B(CreateCatchContext), R(18), U8(4), U8(8), + B(Star), R(17), B(LdaTheHole), B(SetPendingMessage), - B(Ldar), R(16), - B(PushContext), R(17), + B(Ldar), R(17), + B(PushContext), R(18), B(LdaImmutableCurrentContextSlot), U8(4), - B(Star), R(19), - B(LdaFalse), B(Star), R(20), - B(Mov), R(11), R(18), - B(CallJSRuntime), U8(%promise_internal_reject), R(18), U8(3), - B(PopContext), R(17), + B(LdaFalse), + B(Star), R(21), + B(Mov), R(12), R(19), + B(CallJSRuntime), U8(%promise_internal_reject), R(19), U8(3), + B(PopContext), R(18), B(LdaZero), - B(Star), R(13), - B(Mov), R(11), R(14), + B(Star), R(14), + B(Mov), R(12), R(15), B(Jump), U8(16), B(LdaSmi), I8(-1), + B(Star), R(15), B(Star), R(14), - B(Star), R(13), B(Jump), U8(8), - B(Star), R(14), + B(Star), R(15), B(LdaSmi), I8(1), - B(Star), R(13), + B(Star), R(14), B(LdaTheHole), B(SetPendingMessage), - B(Star), R(15), - B(CallJSRuntime), U8(%async_function_promise_release), R(11), U8(1), - B(Ldar), R(15), + B(Star), R(16), + B(CallJSRuntime), U8(%async_function_promise_release), R(12), U8(1), + B(Ldar), R(16), B(SetPendingMessage), - B(Ldar), R(13), - B(SwitchOnSmiNoFeedback), U8(10), U8(2), I8(0), - B(Jump), U8(8), B(Ldar), R(14), + B(SwitchOnSmiNoFeedback), U8(9), U8(2), I8(0), + B(Jump), U8(8), + B(Ldar), R(15), /* 60 S> */ B(Return), - B(Ldar), R(14), + B(Ldar), R(15), B(ReThrow), B(LdaUndefined), /* 60 S> */ B(Return), @@ -1213,13 +1156,12 @@ constant pool: [ ONE_BYTE_INTERNALIZED_STRING_TYPE ["return"], ONE_BYTE_INTERNALIZED_STRING_TYPE [""], FIXED_ARRAY_TYPE, - FIXED_ARRAY_TYPE, Smi [6], Smi [9], ] handlers: [ - [18, 345, 353], - [21, 303, 305], + [18, 331, 339], + [21, 289, 291], [27, 149, 157], [30, 109, 111], [217, 227, 229], @@ -1232,224 +1174,215 @@ snippet: " } f([1, 2, 3]); " -frame size: 24 +frame size: 25 parameter count: 2 -bytecode array length: 480 +bytecode array length: 459 bytecodes: [ B(Ldar), R(2), B(JumpIfUndefined), U8(18), B(InvokeIntrinsic), U8(Runtime::k_GeneratorGetContext), R(2), U8(1), - B(PushContext), R(12), + B(PushContext), R(13), B(RestoreGeneratorState), R(2), - B(Star), R(11), + B(Star), R(12), B(SwitchOnSmiNoFeedback), U8(0), U8(1), I8(0), - B(Abort), U8(42), + B(Abort), U8(15), B(LdaSmi), I8(-2), - B(Star), R(11), + B(Star), R(12), B(CreateFunctionContext), U8(1), - B(PushContext), R(12), + B(PushContext), R(13), B(Ldar), R(arg0), B(StaCurrentContextSlot), U8(4), - B(Mov), R(closure), R(13), - B(Mov), R(this), R(14), - B(InvokeIntrinsic), U8(Runtime::k_CreateJSGeneratorObject), R(13), U8(2), + B(Mov), R(closure), R(14), + B(Mov), R(this), R(15), + B(InvokeIntrinsic), U8(Runtime::k_CreateJSGeneratorObject), R(14), U8(2), B(Star), R(2), /* 16 E> */ B(StackCheck), B(CallJSRuntime), U8(%async_function_promise_create), R(0), U8(0), - B(Star), R(10), - B(Mov), R(context), R(15), + B(Star), R(11), B(Mov), R(context), R(16), + B(Mov), R(context), R(17), B(LdaZero), - B(Star), R(6), - B(Mov), R(context), R(19), + B(Star), R(7), B(Mov), R(context), R(20), + B(Mov), R(context), R(21), /* 40 S> */ B(LdaImmutableCurrentContextSlot), U8(4), - B(Star), R(21), - B(LdaNamedProperty), R(21), U8(1), U8(0), B(Star), R(22), - B(CallProperty0), R(22), R(21), U8(2), + B(LdaNamedProperty), R(22), U8(1), U8(0), + B(Star), R(23), + B(CallProperty0), R(23), R(22), U8(2), B(JumpIfJSReceiver), U8(7), B(CallRuntime), U16(Runtime::kThrowSymbolIteratorInvalid), R(0), U8(0), B(Star), R(4), - B(Ldar), R(11), - B(SwitchOnSmiNoFeedback), U8(2), U8(1), I8(0), + /* 40 E> */ B(LdaNamedProperty), R(4), U8(2), U8(4), + B(Star), R(5), + B(Ldar), R(12), + B(SwitchOnSmiNoFeedback), U8(3), U8(1), I8(0), B(LdaSmi), I8(-2), - /* 40 E> */ B(TestEqualStrictNoFeedback), R(11), + B(TestEqualStrictNoFeedback), R(12), B(JumpIfTrue), U8(4), - B(Abort), U8(42), - /* 35 S> */ B(LdaNamedProperty), R(4), U8(3), U8(4), - B(Star), R(21), - B(CallProperty0), R(21), R(4), U8(6), - B(Star), R(5), - /* 35 E> */ B(InvokeIntrinsic), U8(Runtime::k_IsJSReceiver), R(5), U8(1), + B(Abort), U8(15), + /* 35 S> */ B(CallProperty0), R(5), R(4), U8(6), + B(Star), R(6), + /* 35 E> */ B(InvokeIntrinsic), U8(Runtime::k_IsJSReceiver), R(6), U8(1), B(ToBooleanLogicalNot), B(JumpIfFalse), U8(7), - B(CallRuntime), U16(Runtime::kThrowIteratorResultNotAnObject), R(5), U8(1), - B(LdaNamedProperty), R(5), U8(4), U8(8), - B(JumpIfToBooleanTrue), U8(72), - B(LdaNamedProperty), R(5), U8(5), U8(10), - B(Star), R(7), + B(CallRuntime), U16(Runtime::kThrowIteratorResultNotAnObject), R(6), U8(1), + B(LdaNamedProperty), R(6), U8(4), U8(8), + B(JumpIfToBooleanTrue), U8(65), + B(LdaNamedProperty), R(6), U8(5), U8(10), + B(Star), R(8), B(LdaSmi), I8(2), - B(Star), R(6), - B(Mov), R(7), R(3), + B(Star), R(7), + B(Mov), R(8), R(3), /* 26 E> */ B(StackCheck), B(Mov), R(3), R(0), - /* 45 S> */ B(Mov), R(2), R(21), - B(Mov), R(0), R(22), - B(Mov), R(10), R(23), - B(CallJSRuntime), U8(%async_function_await_uncaught), R(21), U8(3), - B(SuspendGenerator), R(2), R(0), U8(21), U8(0), + /* 45 S> */ B(Mov), R(2), R(22), + B(Mov), R(0), R(23), + B(Mov), R(11), R(24), + B(CallJSRuntime), U8(%async_function_await_uncaught), R(22), U8(3), + B(SuspendGenerator), R(2), R(0), U8(22), U8(0), /* 54 S> */ B(Return), - B(RestoreGeneratorRegisters), R(2), R(0), U8(21), - B(LdaSmi), I8(-2), - B(Star), R(11), - B(InvokeIntrinsic), U8(Runtime::k_GeneratorGetInputOrDebugPos), R(2), U8(1), - B(Star), R(21), - B(InvokeIntrinsic), U8(Runtime::k_GeneratorGetResumeMode), R(2), U8(1), + B(ResumeGenerator), R(2), R(12), R(0), U8(22), B(Star), R(22), + B(InvokeIntrinsic), U8(Runtime::k_GeneratorGetResumeMode), R(2), U8(1), + B(Star), R(23), B(LdaZero), - B(TestEqualStrictNoFeedback), R(22), + B(TestEqualStrictNoFeedback), R(23), B(JumpIfTrue), U8(5), - B(Ldar), R(21), + B(Ldar), R(22), B(ReThrow), B(LdaZero), - B(Star), R(6), - B(JumpLoop), U8(111), I8(0), + B(Star), R(7), + B(JumpLoop), U8(98), I8(0), B(Jump), U8(40), - B(Star), R(21), + B(Star), R(22), B(Ldar), R(closure), - B(CreateCatchContext), R(21), U8(6), U8(7), - B(Star), R(20), + B(CreateCatchContext), R(22), U8(6), U8(7), + B(Star), R(21), B(LdaTheHole), B(SetPendingMessage), - B(Ldar), R(20), - B(PushContext), R(21), + B(Ldar), R(21), + B(PushContext), R(22), B(LdaSmi), I8(2), - B(TestEqualStrict), R(6), U8(12), + B(TestEqualStrict), R(7), U8(12), B(JumpIfFalse), U8(6), B(LdaSmi), I8(1), - B(Star), R(6), + B(Star), R(7), B(LdaImmutableCurrentContextSlot), U8(4), - B(Star), R(22), - B(CallRuntime), U16(Runtime::kReThrow), R(22), U8(1), - B(PopContext), R(21), + B(Star), R(23), + B(CallRuntime), U16(Runtime::kReThrow), R(23), U8(1), + B(PopContext), R(22), B(LdaSmi), I8(-1), + B(Star), R(19), B(Star), R(18), - B(Star), R(17), B(Jump), U8(7), - B(Star), R(18), + B(Star), R(19), B(LdaZero), - B(Star), R(17), + B(Star), R(18), B(LdaTheHole), B(SetPendingMessage), - B(Star), R(19), + B(Star), R(20), B(LdaZero), - B(TestEqualStrict), R(6), U8(13), - B(JumpIfTrue), U8(104), + B(TestEqualStrict), R(7), U8(13), + B(JumpIfTrue), U8(90), B(LdaNamedProperty), R(4), U8(8), U8(14), - B(Star), R(8), + B(Star), R(9), B(TestUndetectable), B(JumpIfFalse), U8(4), - B(Jump), U8(93), + B(Jump), U8(79), B(LdaSmi), I8(1), - B(TestEqualStrict), R(6), U8(16), - B(JumpIfFalse), U8(61), - B(Ldar), R(8), + B(TestEqualStrict), R(7), U8(16), + B(JumpIfFalse), U8(47), + B(Ldar), R(9), B(TestTypeOf), U8(6), B(JumpIfFalse), U8(4), B(Jump), U8(18), - B(Wide), B(LdaSmi), I16(143), - B(Star), R(20), - B(LdaConstant), U8(9), + B(Wide), B(LdaSmi), I16(144), B(Star), R(21), - B(CallRuntime), U16(Runtime::kNewTypeError), R(20), U8(2), + B(LdaConstant), U8(9), + B(Star), R(22), + B(CallRuntime), U16(Runtime::kNewTypeError), R(21), U8(2), B(Throw), - B(Mov), R(context), R(20), - B(Mov), R(8), R(21), - B(Mov), R(4), R(22), - B(InvokeIntrinsic), U8(Runtime::k_Call), R(21), U8(2), - B(Jump), U8(20), - B(Star), R(21), - B(Ldar), R(closure), - B(CreateCatchContext), R(21), U8(6), U8(10), - B(Star), R(20), + B(Mov), R(context), R(21), + B(Mov), R(9), R(22), + B(Mov), R(4), R(23), + B(InvokeIntrinsic), U8(Runtime::k_Call), R(22), U8(2), + B(Jump), U8(6), B(LdaTheHole), B(SetPendingMessage), - B(Ldar), R(20), - B(PushContext), R(21), - B(PopContext), R(21), + B(Ldar), R(21), B(Jump), U8(27), - B(Mov), R(8), R(20), - B(Mov), R(4), R(21), - B(InvokeIntrinsic), U8(Runtime::k_Call), R(20), U8(2), - B(Star), R(9), - B(InvokeIntrinsic), U8(Runtime::k_IsJSReceiver), R(9), U8(1), + B(Mov), R(9), R(21), + B(Mov), R(4), R(22), + B(InvokeIntrinsic), U8(Runtime::k_Call), R(21), U8(2), + B(Star), R(10), + B(InvokeIntrinsic), U8(Runtime::k_IsJSReceiver), R(10), U8(1), B(JumpIfToBooleanFalse), U8(4), B(Jump), U8(7), - B(CallRuntime), U16(Runtime::kThrowIteratorResultNotAnObject), R(9), U8(1), - B(Ldar), R(19), + B(CallRuntime), U16(Runtime::kThrowIteratorResultNotAnObject), R(10), U8(1), + B(Ldar), R(20), B(SetPendingMessage), B(LdaZero), - B(TestEqualStrictNoFeedback), R(17), + B(TestEqualStrictNoFeedback), R(18), B(JumpIfFalse), U8(5), - B(Ldar), R(18), + B(Ldar), R(19), B(ReThrow), B(LdaUndefined), - B(Star), R(18), - B(Mov), R(10), R(17), - B(CallJSRuntime), U8(%promise_resolve), R(17), U8(2), + B(Star), R(19), + B(Mov), R(11), R(18), + B(CallJSRuntime), U8(%promise_resolve), R(18), U8(2), B(LdaZero), - B(Star), R(13), - B(Mov), R(10), R(14), + B(Star), R(14), + B(Mov), R(11), R(15), B(Jump), U8(58), B(Jump), U8(42), - B(Star), R(17), + B(Star), R(18), B(Ldar), R(closure), - B(CreateCatchContext), R(17), U8(6), U8(11), - B(Star), R(16), + B(CreateCatchContext), R(18), U8(6), U8(10), + B(Star), R(17), B(LdaTheHole), B(SetPendingMessage), - B(Ldar), R(16), - B(PushContext), R(17), + B(Ldar), R(17), + B(PushContext), R(18), B(LdaImmutableCurrentContextSlot), U8(4), - B(Star), R(19), - B(LdaFalse), B(Star), R(20), - B(Mov), R(10), R(18), - B(CallJSRuntime), U8(%promise_internal_reject), R(18), U8(3), - B(PopContext), R(17), + B(LdaFalse), + B(Star), R(21), + B(Mov), R(11), R(19), + B(CallJSRuntime), U8(%promise_internal_reject), R(19), U8(3), + B(PopContext), R(18), B(LdaZero), - B(Star), R(13), - B(Mov), R(10), R(14), + B(Star), R(14), + B(Mov), R(11), R(15), B(Jump), U8(16), B(LdaSmi), I8(-1), + B(Star), R(15), B(Star), R(14), - B(Star), R(13), B(Jump), U8(8), - B(Star), R(14), + B(Star), R(15), B(LdaSmi), I8(1), - B(Star), R(13), + B(Star), R(14), B(LdaTheHole), B(SetPendingMessage), - B(Star), R(15), - B(CallJSRuntime), U8(%async_function_promise_release), R(10), U8(1), - B(Ldar), R(15), + B(Star), R(16), + B(CallJSRuntime), U8(%async_function_promise_release), R(11), U8(1), + B(Ldar), R(16), B(SetPendingMessage), - B(Ldar), R(13), - B(SwitchOnSmiNoFeedback), U8(12), U8(2), I8(0), - B(Jump), U8(8), B(Ldar), R(14), + B(SwitchOnSmiNoFeedback), U8(11), U8(2), I8(0), + B(Jump), U8(8), + B(Ldar), R(15), /* 54 S> */ B(Return), - B(Ldar), R(14), + B(Ldar), R(15), B(ReThrow), B(LdaUndefined), /* 54 S> */ B(Return), ] constant pool: [ - Smi [75], + Smi [81], SYMBOL_TYPE, - Smi [78], ONE_BYTE_INTERNALIZED_STRING_TYPE ["next"], + Smi [72], ONE_BYTE_INTERNALIZED_STRING_TYPE ["done"], ONE_BYTE_INTERNALIZED_STRING_TYPE ["value"], ONE_BYTE_INTERNALIZED_STRING_TYPE [".catch"], @@ -1457,15 +1390,14 @@ constant pool: [ ONE_BYTE_INTERNALIZED_STRING_TYPE ["return"], ONE_BYTE_INTERNALIZED_STRING_TYPE [""], FIXED_ARRAY_TYPE, - FIXED_ARRAY_TYPE, Smi [6], Smi [9], ] handlers: [ - [54, 439, 447], - [57, 397, 399], - [63, 243, 251], - [66, 203, 205], - [311, 321, 323], + [54, 418, 426], + [57, 376, 378], + [63, 236, 244], + [66, 196, 198], + [304, 314, 316], ] diff --git a/deps/v8/test/cctest/interpreter/bytecode_expectations/Generators.golden b/deps/v8/test/cctest/interpreter/bytecode_expectations/Generators.golden index 8068bc1fe8..f09cd9fd00 100644 --- a/deps/v8/test/cctest/interpreter/bytecode_expectations/Generators.golden +++ b/deps/v8/test/cctest/interpreter/bytecode_expectations/Generators.golden @@ -13,7 +13,7 @@ snippet: " " frame size: 4 parameter count: 1 -bytecode array length: 73 +bytecode array length: 66 bytecodes: [ B(Ldar), R(0), B(JumpIfUndefined), U8(18), @@ -22,7 +22,7 @@ bytecodes: [ B(RestoreGeneratorState), R(0), B(Star), R(1), B(SwitchOnSmiNoFeedback), U8(0), U8(1), I8(0), - B(Abort), U8(42), + B(Abort), U8(15), B(LdaSmi), I8(-2), B(Star), R(1), B(Mov), R(closure), R(2), @@ -32,10 +32,7 @@ bytecodes: [ /* 11 E> */ B(StackCheck), /* 11 E> */ B(SuspendGenerator), R(0), R(0), U8(2), U8(0), /* 16 S> */ B(Return), - B(RestoreGeneratorRegisters), R(0), R(0), U8(2), - B(LdaSmi), I8(-2), - B(Star), R(1), - B(InvokeIntrinsic), U8(Runtime::k_GeneratorGetInputOrDebugPos), R(0), U8(1), + B(ResumeGenerator), R(0), R(1), R(0), U8(2), B(Star), R(2), B(InvokeIntrinsic), U8(Runtime::k_GeneratorGetResumeMode), R(0), U8(1), B(SwitchOnSmiNoFeedback), U8(1), U8(2), I8(0), @@ -61,7 +58,7 @@ snippet: " " frame size: 4 parameter count: 1 -bytecode array length: 118 +bytecode array length: 104 bytecodes: [ B(Ldar), R(0), B(JumpIfUndefined), U8(18), @@ -70,7 +67,7 @@ bytecodes: [ B(RestoreGeneratorState), R(0), B(Star), R(1), B(SwitchOnSmiNoFeedback), U8(0), U8(2), I8(0), - B(Abort), U8(42), + B(Abort), U8(15), B(LdaSmi), I8(-2), B(Star), R(1), B(Mov), R(closure), R(2), @@ -80,10 +77,7 @@ bytecodes: [ /* 11 E> */ B(StackCheck), /* 11 E> */ B(SuspendGenerator), R(0), R(0), U8(2), U8(0), /* 25 S> */ B(Return), - B(RestoreGeneratorRegisters), R(0), R(0), U8(2), - B(LdaSmi), I8(-2), - B(Star), R(1), - B(InvokeIntrinsic), U8(Runtime::k_GeneratorGetInputOrDebugPos), R(0), U8(1), + B(ResumeGenerator), R(0), R(1), R(0), U8(2), B(Star), R(2), B(InvokeIntrinsic), U8(Runtime::k_GeneratorGetResumeMode), R(0), U8(1), B(SwitchOnSmiNoFeedback), U8(2), U8(2), I8(0), @@ -98,10 +92,7 @@ bytecodes: [ B(InvokeIntrinsic), U8(Runtime::k_CreateIterResultObject), R(2), U8(2), B(SuspendGenerator), R(0), R(0), U8(2), U8(1), /* 25 S> */ B(Return), - B(RestoreGeneratorRegisters), R(0), R(0), U8(2), - B(LdaSmi), I8(-2), - B(Star), R(1), - B(InvokeIntrinsic), U8(Runtime::k_GeneratorGetInputOrDebugPos), R(0), U8(1), + B(ResumeGenerator), R(0), R(1), R(0), U8(2), B(Star), R(2), B(InvokeIntrinsic), U8(Runtime::k_GeneratorGetResumeMode), R(0), U8(1), B(SwitchOnSmiNoFeedback), U8(4), U8(2), I8(0), @@ -114,7 +105,7 @@ bytecodes: [ ] constant pool: [ Smi [29], - Smi [74], + Smi [67], Smi [10], Smi [7], Smi [10], @@ -128,185 +119,173 @@ snippet: " function* f() { for (let x of [42]) yield x } f(); " -frame size: 17 +frame size: 18 parameter count: 1 -bytecode array length: 402 +bytecode array length: 374 bytecodes: [ B(Ldar), R(2), B(JumpIfUndefined), U8(18), B(InvokeIntrinsic), U8(Runtime::k_GeneratorGetContext), R(2), U8(1), - B(PushContext), R(11), + B(PushContext), R(12), B(RestoreGeneratorState), R(2), - B(Star), R(10), + B(Star), R(11), B(SwitchOnSmiNoFeedback), U8(0), U8(2), I8(0), - B(Abort), U8(42), + B(Abort), U8(15), B(LdaSmi), I8(-2), - B(Star), R(10), - 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(11), + 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), /* 11 E> */ B(StackCheck), - /* 11 E> */ B(SuspendGenerator), R(2), R(0), U8(11), U8(0), + /* 11 E> */ B(SuspendGenerator), R(2), R(0), U8(12), U8(0), /* 44 S> */ B(Return), - B(RestoreGeneratorRegisters), R(2), R(0), U8(11), - B(LdaSmi), I8(-2), - B(Star), R(10), - B(InvokeIntrinsic), U8(Runtime::k_GeneratorGetInputOrDebugPos), R(2), U8(1), - B(Star), R(11), + B(ResumeGenerator), R(2), R(11), R(0), U8(12), + B(Star), R(12), B(InvokeIntrinsic), U8(Runtime::k_GeneratorGetResumeMode), R(2), U8(1), B(SwitchOnSmiNoFeedback), U8(2), U8(2), I8(0), - B(Ldar), R(11), + B(Ldar), R(12), /* 11 E> */ B(Throw), - B(Ldar), R(11), + B(Ldar), R(12), /* 44 S> */ B(Return), B(LdaZero), - B(Star), R(6), - B(Mov), R(context), R(13), + B(Star), R(7), B(Mov), R(context), R(14), + B(Mov), R(context), R(15), /* 30 S> */ B(CreateArrayLiteral), U8(4), U8(0), U8(37), - B(Star), R(15), - B(LdaNamedProperty), R(15), U8(5), U8(1), B(Star), R(16), - B(CallProperty0), R(16), R(15), U8(3), + B(LdaNamedProperty), R(16), U8(5), U8(1), + B(Star), R(17), + B(CallProperty0), R(17), R(16), U8(3), B(JumpIfJSReceiver), U8(7), B(CallRuntime), U16(Runtime::kThrowSymbolIteratorInvalid), R(0), U8(0), B(Star), R(4), - B(Ldar), R(10), - B(SwitchOnSmiNoFeedback), U8(6), U8(1), I8(1), + /* 30 E> */ B(LdaNamedProperty), R(4), U8(6), U8(5), + B(Star), R(5), + B(Ldar), R(11), + B(SwitchOnSmiNoFeedback), U8(7), U8(1), I8(1), B(LdaSmi), I8(-2), - /* 30 E> */ B(TestEqualStrictNoFeedback), R(10), + B(TestEqualStrictNoFeedback), R(11), B(JumpIfTrue), U8(4), - B(Abort), U8(42), - /* 25 S> */ B(LdaNamedProperty), R(4), U8(7), U8(5), - B(Star), R(15), - B(CallProperty0), R(15), R(4), U8(7), - B(Star), R(5), - /* 25 E> */ B(InvokeIntrinsic), U8(Runtime::k_IsJSReceiver), R(5), U8(1), + B(Abort), U8(15), + /* 25 S> */ B(CallProperty0), R(5), R(4), U8(7), + B(Star), R(6), + /* 25 E> */ B(InvokeIntrinsic), U8(Runtime::k_IsJSReceiver), R(6), U8(1), B(ToBooleanLogicalNot), B(JumpIfFalse), U8(7), - B(CallRuntime), U16(Runtime::kThrowIteratorResultNotAnObject), R(5), U8(1), - B(LdaNamedProperty), R(5), U8(8), U8(9), - B(JumpIfToBooleanTrue), U8(74), - B(LdaNamedProperty), R(5), U8(9), U8(11), - B(Star), R(7), + B(CallRuntime), U16(Runtime::kThrowIteratorResultNotAnObject), R(6), U8(1), + B(LdaNamedProperty), R(6), U8(8), U8(9), + B(JumpIfToBooleanTrue), U8(67), + B(LdaNamedProperty), R(6), U8(9), U8(11), + B(Star), R(8), B(LdaSmi), I8(2), - B(Star), R(6), - B(Mov), R(7), R(3), + B(Star), R(7), + B(Mov), R(8), R(3), /* 16 E> */ B(StackCheck), B(Mov), R(3), R(0), /* 36 S> */ B(LdaFalse), - B(Star), R(16), - B(Mov), R(0), R(15), - B(InvokeIntrinsic), U8(Runtime::k_CreateIterResultObject), R(15), U8(2), - B(SuspendGenerator), R(2), R(0), U8(15), U8(1), + B(Star), R(17), + B(Mov), R(0), R(16), + B(InvokeIntrinsic), U8(Runtime::k_CreateIterResultObject), R(16), U8(2), + B(SuspendGenerator), R(2), R(0), U8(16), U8(1), /* 44 S> */ B(Return), - B(RestoreGeneratorRegisters), R(2), R(0), U8(15), - B(LdaSmi), I8(-2), - B(Star), R(10), - B(InvokeIntrinsic), U8(Runtime::k_GeneratorGetInputOrDebugPos), R(2), U8(1), - B(Star), R(15), + B(ResumeGenerator), R(2), R(11), R(0), U8(16), + B(Star), R(16), B(InvokeIntrinsic), U8(Runtime::k_GeneratorGetResumeMode), R(2), U8(1), B(SwitchOnSmiNoFeedback), U8(10), U8(2), I8(0), - B(Ldar), R(15), + B(Ldar), R(16), /* 36 E> */ B(Throw), B(LdaZero), - B(Star), R(11), - B(Mov), R(15), R(12), + B(Star), R(12), + B(Mov), R(16), R(13), B(Jump), U8(58), B(LdaZero), - B(Star), R(6), - B(JumpLoop), U8(113), I8(0), + B(Star), R(7), + B(JumpLoop), U8(100), I8(0), B(Jump), U8(36), - B(Star), R(15), + B(Star), R(16), B(Ldar), R(closure), - B(CreateCatchContext), R(15), U8(12), U8(13), - B(PushContext), R(15), - B(Star), R(14), + B(CreateCatchContext), R(16), U8(12), U8(13), + B(PushContext), R(16), + B(Star), R(15), B(LdaSmi), I8(2), - B(TestEqualStrict), R(6), U8(13), + B(TestEqualStrict), R(7), U8(13), B(JumpIfFalse), U8(6), B(LdaSmi), I8(1), - B(Star), R(6), + B(Star), R(7), B(LdaImmutableCurrentContextSlot), U8(4), - B(Star), R(16), - B(CallRuntime), U16(Runtime::kReThrow), R(16), U8(1), - B(PopContext), R(15), + B(Star), R(17), + B(CallRuntime), U16(Runtime::kReThrow), R(17), U8(1), + B(PopContext), R(16), B(LdaSmi), I8(-1), + B(Star), R(13), B(Star), R(12), - B(Star), R(11), B(Jump), U8(8), - B(Star), R(12), + B(Star), R(13), B(LdaSmi), I8(1), - B(Star), R(11), + B(Star), R(12), B(LdaTheHole), B(SetPendingMessage), - B(Star), R(13), + B(Star), R(14), B(LdaZero), - B(TestEqualStrict), R(6), U8(14), - B(JumpIfTrue), U8(104), + B(TestEqualStrict), R(7), U8(14), + B(JumpIfTrue), U8(90), B(LdaNamedProperty), R(4), U8(14), U8(15), - B(Star), R(8), + B(Star), R(9), B(TestUndetectable), B(JumpIfFalse), U8(4), - B(Jump), U8(93), + B(Jump), U8(79), B(LdaSmi), I8(1), - B(TestEqualStrict), R(6), U8(17), - B(JumpIfFalse), U8(61), - B(Ldar), R(8), + B(TestEqualStrict), R(7), U8(17), + B(JumpIfFalse), U8(47), + B(Ldar), R(9), B(TestTypeOf), U8(6), B(JumpIfFalse), U8(4), B(Jump), U8(18), - B(Wide), B(LdaSmi), I16(143), - B(Star), R(14), - B(LdaConstant), U8(15), + B(Wide), B(LdaSmi), I16(144), B(Star), R(15), - B(CallRuntime), U16(Runtime::kNewTypeError), R(14), U8(2), + B(LdaConstant), U8(15), + B(Star), R(16), + B(CallRuntime), U16(Runtime::kNewTypeError), R(15), U8(2), B(Throw), - B(Mov), R(context), R(14), - B(Mov), R(8), R(15), - B(Mov), R(4), R(16), - B(InvokeIntrinsic), U8(Runtime::k_Call), R(15), U8(2), - B(Jump), U8(20), - B(Star), R(15), - B(Ldar), R(closure), - B(CreateCatchContext), R(15), U8(12), U8(16), - B(Star), R(14), + B(Mov), R(context), R(15), + B(Mov), R(9), R(16), + B(Mov), R(4), R(17), + B(InvokeIntrinsic), U8(Runtime::k_Call), R(16), U8(2), + B(Jump), U8(6), B(LdaTheHole), B(SetPendingMessage), - B(Ldar), R(14), - B(PushContext), R(15), - B(PopContext), R(15), + B(Ldar), R(15), B(Jump), U8(27), - B(Mov), R(8), R(14), - B(Mov), R(4), R(15), - B(InvokeIntrinsic), U8(Runtime::k_Call), R(14), U8(2), - B(Star), R(9), - B(InvokeIntrinsic), U8(Runtime::k_IsJSReceiver), R(9), U8(1), + B(Mov), R(9), R(15), + B(Mov), R(4), R(16), + B(InvokeIntrinsic), U8(Runtime::k_Call), R(15), U8(2), + B(Star), R(10), + B(InvokeIntrinsic), U8(Runtime::k_IsJSReceiver), R(10), U8(1), B(JumpIfToBooleanFalse), U8(4), B(Jump), U8(7), - B(CallRuntime), U16(Runtime::kThrowIteratorResultNotAnObject), R(9), U8(1), - B(Ldar), R(13), + B(CallRuntime), U16(Runtime::kThrowIteratorResultNotAnObject), R(10), U8(1), + B(Ldar), R(14), B(SetPendingMessage), - B(Ldar), R(11), - B(SwitchOnSmiNoFeedback), U8(17), U8(2), I8(0), - B(Jump), U8(8), B(Ldar), R(12), + B(SwitchOnSmiNoFeedback), U8(16), U8(2), I8(0), + B(Jump), U8(8), + B(Ldar), R(13), /* 44 S> */ B(Return), - B(Ldar), R(12), + B(Ldar), R(13), B(ReThrow), B(LdaUndefined), /* 44 S> */ B(Return), ] constant pool: [ Smi [29], - Smi [91], + Smi [90], Smi [10], Smi [7], TUPLE2_TYPE, SYMBOL_TYPE, - Smi [75], ONE_BYTE_INTERNALIZED_STRING_TYPE ["next"], + Smi [69], ONE_BYTE_INTERNALIZED_STRING_TYPE ["done"], ONE_BYTE_INTERNALIZED_STRING_TYPE ["value"], Smi [15], @@ -315,14 +294,13 @@ constant pool: [ FIXED_ARRAY_TYPE, ONE_BYTE_INTERNALIZED_STRING_TYPE ["return"], ONE_BYTE_INTERNALIZED_STRING_TYPE [""], - FIXED_ARRAY_TYPE, Smi [6], Smi [9], ] handlers: [ - [77, 257, 265], - [80, 221, 223], - [326, 336, 338], + [70, 243, 251], + [73, 207, 209], + [312, 322, 324], ] --- @@ -331,9 +309,9 @@ snippet: " function* f() { yield* g() } f(); " -frame size: 9 +frame size: 10 parameter count: 1 -bytecode array length: 265 +bytecode array length: 255 bytecodes: [ B(Ldar), R(0), B(JumpIfUndefined), U8(18), @@ -342,7 +320,7 @@ bytecodes: [ B(RestoreGeneratorState), R(0), B(Star), R(1), B(SwitchOnSmiNoFeedback), U8(0), U8(2), I8(0), - B(Abort), U8(42), + B(Abort), U8(15), B(LdaSmi), I8(-2), B(Star), R(1), B(Mov), R(closure), R(2), @@ -352,10 +330,7 @@ bytecodes: [ /* 38 E> */ B(StackCheck), /* 38 E> */ B(SuspendGenerator), R(0), R(0), U8(2), U8(0), /* 54 S> */ B(Return), - B(RestoreGeneratorRegisters), R(0), R(0), U8(2), - B(LdaSmi), I8(-2), - B(Star), R(1), - B(InvokeIntrinsic), U8(Runtime::k_GeneratorGetInputOrDebugPos), R(0), U8(1), + B(ResumeGenerator), R(0), R(1), R(0), U8(2), B(Star), R(2), B(InvokeIntrinsic), U8(Runtime::k_GeneratorGetResumeMode), R(0), U8(1), B(SwitchOnSmiNoFeedback), U8(2), U8(2), I8(0), @@ -364,69 +339,68 @@ bytecodes: [ B(Ldar), R(2), /* 54 S> */ B(Return), /* 43 S> */ B(LdaGlobal), U8(4), U8(0), - B(Star), R(8), - /* 50 E> */ B(CallUndefinedReceiver0), R(8), U8(2), - B(Star), R(6), - B(LdaNamedProperty), R(6), U8(5), U8(4), + B(Star), R(9), + /* 50 E> */ B(CallUndefinedReceiver0), R(9), U8(2), B(Star), R(7), - B(CallProperty0), R(7), R(6), U8(6), + B(LdaNamedProperty), R(7), U8(5), U8(4), + B(Star), R(8), + B(CallProperty0), R(8), R(7), U8(6), B(JumpIfJSReceiver), U8(7), B(CallRuntime), U16(Runtime::kThrowSymbolIteratorInvalid), R(0), U8(0), B(Star), R(4), + B(LdaNamedProperty), R(4), U8(6), U8(8), + B(Star), R(6), B(LdaUndefined), B(Star), R(5), B(LdaZero), B(Star), R(3), B(Ldar), R(1), - B(SwitchOnSmiNoFeedback), U8(6), U8(1), I8(1), + B(SwitchOnSmiNoFeedback), U8(7), U8(1), I8(1), B(LdaSmi), I8(-2), B(TestEqualStrictNoFeedback), R(1), B(JumpIfTrue), U8(4), - B(Abort), U8(42), + B(Abort), U8(15), B(Ldar), R(3), - B(SwitchOnSmiNoFeedback), U8(7), U8(2), I8(1), - B(LdaNamedProperty), R(4), U8(9), U8(8), - B(Star), R(8), - B(CallProperty1), R(8), R(4), R(5), U8(10), - B(Jump), U8(65), + B(SwitchOnSmiNoFeedback), U8(8), U8(2), I8(1), + B(CallProperty1), R(6), R(4), R(5), U8(10), + B(Jump), U8(69), B(LdaNamedProperty), R(4), U8(10), U8(12), B(JumpIfUndefined), U8(13), B(JumpIfNull), U8(11), - B(Star), R(8), - B(CallProperty1), R(8), R(4), R(5), U8(14), - B(Jump), U8(48), + B(Star), R(9), + B(CallProperty1), R(9), R(4), R(5), U8(14), + B(Jump), U8(52), B(Ldar), R(5), /* 54 S> */ B(Return), B(LdaNamedProperty), R(4), U8(11), U8(16), B(JumpIfUndefined), U8(13), B(JumpIfNull), U8(11), - B(Star), R(8), - B(CallProperty1), R(8), R(4), R(5), U8(18), - B(Jump), U8(28), + B(Star), R(9), + B(CallProperty1), R(9), R(4), R(5), U8(18), + B(Jump), U8(32), B(LdaNamedProperty), R(4), U8(10), U8(20), - B(Star), R(8), - B(JumpIfUndefined), U8(15), - B(JumpIfNull), U8(13), - B(CallProperty0), R(8), R(4), U8(22), - B(JumpIfJSReceiver), U8(7), - B(CallRuntime), U16(Runtime::kThrowIteratorResultNotAnObject), R(2), U8(1), + B(JumpIfUndefined), U8(21), + B(JumpIfNull), U8(19), + B(Star), R(9), + B(CallProperty0), R(9), R(4), U8(22), + B(Jump), U8(2), + B(JumpIfJSReceiver), U8(9), + B(Star), R(9), + B(CallRuntime), U16(Runtime::kThrowIteratorResultNotAnObject), R(9), U8(1), B(CallRuntime), U16(Runtime::kThrowThrowMethodMissing), R(0), U8(0), B(Star), R(2), B(JumpIfJSReceiver), U8(7), B(CallRuntime), U16(Runtime::kThrowIteratorResultNotAnObject), R(2), U8(1), B(LdaNamedProperty), R(2), U8(12), U8(24), - B(JumpIfToBooleanTrue), U8(33), + B(JumpIfToBooleanTrue), U8(26), B(Ldar), R(2), - B(SuspendGenerator), R(0), R(0), U8(8), U8(1), + B(SuspendGenerator), R(0), R(0), U8(9), U8(1), /* 54 S> */ B(Return), - B(RestoreGeneratorRegisters), R(0), R(0), U8(8), - B(LdaSmi), I8(-2), - B(Star), R(1), - B(InvokeIntrinsic), U8(Runtime::k_GeneratorGetInputOrDebugPos), R(0), U8(1), + B(ResumeGenerator), R(0), R(1), R(0), U8(9), B(Star), R(5), B(InvokeIntrinsic), U8(Runtime::k_GeneratorGetResumeMode), R(0), U8(1), B(Star), R(3), - B(JumpLoop), U8(139), I8(0), + B(JumpLoop), U8(130), I8(0), B(LdaNamedProperty), R(2), U8(13), U8(26), B(Star), R(4), B(LdaSmi), I8(1), @@ -439,15 +413,15 @@ bytecodes: [ ] constant pool: [ Smi [29], - Smi [92], + Smi [91], Smi [10], Smi [7], ONE_BYTE_INTERNALIZED_STRING_TYPE ["g"], SYMBOL_TYPE, - Smi [117], - Smi [17], - Smi [37], ONE_BYTE_INTERNALIZED_STRING_TYPE ["next"], + Smi [115], + Smi [11], + Smi [31], ONE_BYTE_INTERNALIZED_STRING_TYPE ["return"], ONE_BYTE_INTERNALIZED_STRING_TYPE ["throw"], ONE_BYTE_INTERNALIZED_STRING_TYPE ["done"], diff --git a/deps/v8/test/cctest/interpreter/bytecode_expectations/GlobalCompoundExpressions.golden b/deps/v8/test/cctest/interpreter/bytecode_expectations/GlobalCompoundExpressions.golden index 53ae78acb7..b24e5d0aa1 100644 --- a/deps/v8/test/cctest/interpreter/bytecode_expectations/GlobalCompoundExpressions.golden +++ b/deps/v8/test/cctest/interpreter/bytecode_expectations/GlobalCompoundExpressions.golden @@ -19,7 +19,7 @@ bytecodes: [ /* 26 E> */ B(StackCheck), /* 31 S> */ B(LdaGlobal), U8(0), U8(0), B(BitwiseAndSmi), I8(1), U8(2), - /* 45 E> */ B(StaGlobalSloppy), U8(0), U8(3), + /* 45 E> */ B(StaGlobal), U8(0), U8(3), /* 50 S> */ B(Return), ] constant pool: [ @@ -41,7 +41,7 @@ bytecodes: [ /* 27 E> */ B(StackCheck), /* 32 S> */ B(LdaGlobal), U8(0), U8(0), B(AddSmi), I8(1), U8(2), - /* 51 E> */ B(StaGlobalSloppy), U8(0), U8(3), + /* 51 E> */ B(StaGlobal), U8(0), U8(3), /* 56 S> */ B(Return), ] constant pool: [ diff --git a/deps/v8/test/cctest/interpreter/bytecode_expectations/GlobalCountOperators.golden b/deps/v8/test/cctest/interpreter/bytecode_expectations/GlobalCountOperators.golden index 302f883cfb..f0479d594d 100644 --- a/deps/v8/test/cctest/interpreter/bytecode_expectations/GlobalCountOperators.golden +++ b/deps/v8/test/cctest/interpreter/bytecode_expectations/GlobalCountOperators.golden @@ -19,7 +19,7 @@ bytecodes: [ /* 26 E> */ B(StackCheck), /* 31 S> */ B(LdaGlobal), U8(0), U8(0), B(Inc), U8(2), - /* 40 E> */ B(StaGlobalSloppy), U8(0), U8(3), + /* 40 E> */ B(StaGlobal), U8(0), U8(3), /* 47 S> */ B(Return), ] constant pool: [ @@ -43,7 +43,7 @@ bytecodes: [ B(ToNumeric), U8(2), B(Star), R(0), B(Dec), U8(2), - /* 44 E> */ B(StaGlobalSloppy), U8(0), U8(3), + /* 44 E> */ B(StaGlobal), U8(0), U8(3), B(Ldar), R(0), /* 47 S> */ B(Return), ] @@ -66,7 +66,7 @@ bytecodes: [ /* 27 E> */ B(StackCheck), /* 46 S> */ B(LdaGlobal), U8(0), U8(0), B(Dec), U8(2), - /* 55 E> */ B(StaGlobalStrict), U8(0), U8(3), + /* 55 E> */ B(StaGlobal), U8(0), U8(3), /* 67 S> */ B(Return), ] constant pool: [ @@ -90,7 +90,7 @@ bytecodes: [ B(ToNumeric), U8(2), B(Star), R(0), B(Inc), U8(2), - /* 50 E> */ B(StaGlobalSloppy), U8(0), U8(3), + /* 50 E> */ B(StaGlobal), U8(0), U8(3), B(Ldar), R(0), /* 53 S> */ B(Return), ] diff --git a/deps/v8/test/cctest/interpreter/bytecode_expectations/Modules.golden b/deps/v8/test/cctest/interpreter/bytecode_expectations/Modules.golden index 3be8bc5158..9c876157ad 100644 --- a/deps/v8/test/cctest/interpreter/bytecode_expectations/Modules.golden +++ b/deps/v8/test/cctest/interpreter/bytecode_expectations/Modules.golden @@ -11,52 +11,46 @@ top level: yes snippet: " import \"bar\"; " -frame size: 5 +frame size: 6 parameter count: 2 -bytecode array length: 96 +bytecode array length: 84 bytecodes: [ - B(Ldar), R(1), + B(Ldar), R(0), B(JumpIfUndefined), U8(18), - B(InvokeIntrinsic), U8(Runtime::k_GeneratorGetContext), R(1), U8(1), - B(PushContext), R(2), - B(RestoreGeneratorState), R(1), - B(Star), R(0), + B(InvokeIntrinsic), U8(Runtime::k_GeneratorGetContext), R(0), U8(1), + B(PushContext), R(3), + B(RestoreGeneratorState), R(0), + B(Star), R(2), B(SwitchOnSmiNoFeedback), U8(0), U8(1), I8(0), - B(Abort), U8(42), + B(Abort), U8(15), B(LdaSmi), I8(-2), - B(Star), R(0), + B(Star), R(2), B(LdaConstant), U8(1), - B(Star), R(4), - B(Mov), R(arg0), R(2), - B(Mov), R(closure), R(3), - B(CallRuntime), U16(Runtime::kPushModuleContext), R(2), U8(3), - B(PushContext), R(2), - B(Mov), R(this), R(4), - B(InvokeIntrinsic), U8(Runtime::k_CreateJSGeneratorObject), R(3), U8(2), - B(StaCurrentContextSlot), U8(4), + B(Star), R(5), + B(Mov), R(arg0), R(3), + B(Mov), R(closure), R(4), + B(CallRuntime), U16(Runtime::kPushModuleContext), R(3), U8(3), + B(PushContext), R(3), + B(Mov), R(this), R(5), + B(InvokeIntrinsic), U8(Runtime::k_CreateJSGeneratorObject), R(4), U8(2), + B(Star), R(0), /* 0 E> */ B(StackCheck), - B(Star), R(1), - B(LdaImmutableCurrentContextSlot), U8(4), - /* 0 E> */ B(SuspendGenerator), R(1), R(0), U8(3), U8(0), + /* 0 E> */ B(SuspendGenerator), R(0), R(0), U8(4), U8(0), /* 13 S> */ B(Return), - B(RestoreGeneratorRegisters), R(1), R(0), U8(3), - B(LdaSmi), I8(-2), - B(Star), R(0), - B(InvokeIntrinsic), U8(Runtime::k_GeneratorGetInputOrDebugPos), R(1), U8(1), - B(Star), R(3), - B(InvokeIntrinsic), U8(Runtime::k_GeneratorGetResumeMode), R(1), U8(1), + B(ResumeGenerator), R(0), R(2), R(0), U8(4), + B(Star), R(4), + B(InvokeIntrinsic), U8(Runtime::k_GeneratorGetResumeMode), R(0), U8(1), B(SwitchOnSmiNoFeedback), U8(2), U8(2), I8(0), - B(Ldar), R(3), + B(Ldar), R(4), /* 0 E> */ B(Throw), - B(Ldar), R(3), + B(Ldar), R(4), /* 13 S> */ B(Return), - B(Ldar), R(3), - B(StaCurrentContextSlot), U8(5), - B(LdaCurrentContextSlot), U8(5), + B(Mov), R(4), R(1), + B(Ldar), R(1), /* 13 S> */ B(Return), ] constant pool: [ - Smi [47], + Smi [43], FIXED_ARRAY_TYPE, Smi [10], Smi [7], @@ -68,52 +62,46 @@ handlers: [ snippet: " import {foo} from \"bar\"; " -frame size: 5 +frame size: 6 parameter count: 2 -bytecode array length: 96 +bytecode array length: 84 bytecodes: [ - B(Ldar), R(1), + B(Ldar), R(0), B(JumpIfUndefined), U8(18), - B(InvokeIntrinsic), U8(Runtime::k_GeneratorGetContext), R(1), U8(1), - B(PushContext), R(2), - B(RestoreGeneratorState), R(1), - B(Star), R(0), + B(InvokeIntrinsic), U8(Runtime::k_GeneratorGetContext), R(0), U8(1), + B(PushContext), R(3), + B(RestoreGeneratorState), R(0), + B(Star), R(2), B(SwitchOnSmiNoFeedback), U8(0), U8(1), I8(0), - B(Abort), U8(42), + B(Abort), U8(15), B(LdaSmi), I8(-2), - B(Star), R(0), + B(Star), R(2), B(LdaConstant), U8(1), - B(Star), R(4), - B(Mov), R(arg0), R(2), - B(Mov), R(closure), R(3), - B(CallRuntime), U16(Runtime::kPushModuleContext), R(2), U8(3), - B(PushContext), R(2), - B(Mov), R(this), R(4), - B(InvokeIntrinsic), U8(Runtime::k_CreateJSGeneratorObject), R(3), U8(2), - B(StaCurrentContextSlot), U8(4), + B(Star), R(5), + B(Mov), R(arg0), R(3), + B(Mov), R(closure), R(4), + B(CallRuntime), U16(Runtime::kPushModuleContext), R(3), U8(3), + B(PushContext), R(3), + B(Mov), R(this), R(5), + B(InvokeIntrinsic), U8(Runtime::k_CreateJSGeneratorObject), R(4), U8(2), + B(Star), R(0), /* 0 E> */ B(StackCheck), - B(Star), R(1), - B(LdaImmutableCurrentContextSlot), U8(4), - /* 0 E> */ B(SuspendGenerator), R(1), R(0), U8(3), U8(0), + /* 0 E> */ B(SuspendGenerator), R(0), R(0), U8(4), U8(0), /* 24 S> */ B(Return), - B(RestoreGeneratorRegisters), R(1), R(0), U8(3), - B(LdaSmi), I8(-2), - B(Star), R(0), - B(InvokeIntrinsic), U8(Runtime::k_GeneratorGetInputOrDebugPos), R(1), U8(1), - B(Star), R(3), - B(InvokeIntrinsic), U8(Runtime::k_GeneratorGetResumeMode), R(1), U8(1), + B(ResumeGenerator), R(0), R(2), R(0), U8(4), + B(Star), R(4), + B(InvokeIntrinsic), U8(Runtime::k_GeneratorGetResumeMode), R(0), U8(1), B(SwitchOnSmiNoFeedback), U8(2), U8(2), I8(0), - B(Ldar), R(3), + B(Ldar), R(4), /* 0 E> */ B(Throw), - B(Ldar), R(3), + B(Ldar), R(4), /* 24 S> */ B(Return), - B(Ldar), R(3), - B(StaCurrentContextSlot), U8(5), - B(LdaCurrentContextSlot), U8(5), + B(Mov), R(4), R(1), + B(Ldar), R(1), /* 24 S> */ B(Return), ] constant pool: [ - Smi [47], + Smi [43], FIXED_ARRAY_TYPE, Smi [10], Smi [7], @@ -127,76 +115,63 @@ snippet: " goo(42); { let x; { goo(42) } }; " -frame size: 6 +frame size: 7 parameter count: 2 -bytecode array length: 140 +bytecode array length: 114 bytecodes: [ B(Ldar), R(1), B(JumpIfUndefined), U8(18), B(InvokeIntrinsic), U8(Runtime::k_GeneratorGetContext), R(1), U8(1), - B(PushContext), R(2), + B(PushContext), R(4), B(RestoreGeneratorState), R(1), - B(Star), R(0), + B(Star), R(3), B(SwitchOnSmiNoFeedback), U8(0), U8(1), I8(0), - B(Abort), U8(42), + B(Abort), U8(15), B(LdaSmi), I8(-2), - B(Star), R(0), + B(Star), R(3), B(LdaConstant), U8(1), - B(Star), R(4), - B(Mov), R(arg0), R(2), - B(Mov), R(closure), R(3), - B(CallRuntime), U16(Runtime::kPushModuleContext), R(2), U8(3), - B(PushContext), R(2), - B(Mov), R(this), R(4), - B(InvokeIntrinsic), U8(Runtime::k_CreateJSGeneratorObject), R(3), U8(2), - B(StaCurrentContextSlot), U8(4), - /* 0 E> */ B(StackCheck), + B(Star), R(6), + B(Mov), R(arg0), R(4), + B(Mov), R(closure), R(5), + B(CallRuntime), U16(Runtime::kPushModuleContext), R(4), U8(3), + B(PushContext), R(4), + B(Mov), R(this), R(6), + B(InvokeIntrinsic), U8(Runtime::k_CreateJSGeneratorObject), R(5), U8(2), B(Star), R(1), - B(LdaImmutableCurrentContextSlot), U8(4), - /* 0 E> */ B(SuspendGenerator), R(1), R(0), U8(3), U8(0), + /* 0 E> */ B(StackCheck), + /* 0 E> */ B(SuspendGenerator), R(1), R(0), U8(5), U8(0), /* 64 S> */ B(Return), - B(RestoreGeneratorRegisters), R(1), R(0), U8(3), - B(LdaSmi), I8(-2), - B(Star), R(0), - B(InvokeIntrinsic), U8(Runtime::k_GeneratorGetInputOrDebugPos), R(1), U8(1), - B(Star), R(3), + B(ResumeGenerator), R(1), R(3), R(0), U8(5), + B(Star), R(5), B(InvokeIntrinsic), U8(Runtime::k_GeneratorGetResumeMode), R(1), U8(1), B(SwitchOnSmiNoFeedback), U8(2), U8(2), I8(0), - B(Ldar), R(3), + B(Ldar), R(5), /* 0 E> */ B(Throw), - B(Ldar), R(3), + B(Ldar), R(5), /* 64 S> */ B(Return), /* 32 S> */ B(LdaModuleVariable), I8(-1), U8(0), B(ThrowReferenceErrorIfHole), U8(4), - B(Star), R(3), + B(Star), R(5), B(LdaSmi), I8(42), - B(Star), R(4), - /* 32 E> */ B(CallUndefinedReceiver1), R(3), R(4), U8(0), - B(Ldar), R(closure), - B(CreateBlockContext), U8(5), - B(PushContext), R(3), - B(LdaTheHole), - B(StaCurrentContextSlot), U8(4), + B(Star), R(6), + /* 32 E> */ B(CallUndefinedReceiver1), R(5), R(6), U8(0), /* 47 S> */ B(LdaUndefined), - /* 47 E> */ B(StaCurrentContextSlot), U8(4), - /* 52 S> */ B(LdaModuleVariable), I8(-1), U8(1), + B(Star), R(0), + /* 52 S> */ B(LdaModuleVariable), I8(-1), U8(0), B(ThrowReferenceErrorIfHole), U8(4), - B(Star), R(4), - B(LdaSmi), I8(42), B(Star), R(5), - /* 52 E> */ B(CallUndefinedReceiver1), R(4), R(5), U8(2), - B(StaContextSlot), R(3), U8(5), U8(0), - B(PopContext), R(3), - B(LdaCurrentContextSlot), U8(5), + B(LdaSmi), I8(42), + B(Star), R(6), + /* 52 E> */ B(CallUndefinedReceiver1), R(5), R(6), U8(2), + B(Star), R(2), /* 64 S> */ B(Return), ] constant pool: [ - Smi [47], + Smi [43], FIXED_ARRAY_TYPE, Smi [10], Smi [7], ONE_BYTE_INTERNALIZED_STRING_TYPE ["goo"], - FIXED_ARRAY_TYPE, ] handlers: [ ] @@ -207,74 +182,61 @@ snippet: " foo++; { let x; { foo++ } }; " -frame size: 5 +frame size: 7 parameter count: 2 -bytecode array length: 137 +bytecode array length: 112 bytecodes: [ B(Ldar), R(1), B(JumpIfUndefined), U8(18), B(InvokeIntrinsic), U8(Runtime::k_GeneratorGetContext), R(1), U8(1), - B(PushContext), R(2), + B(PushContext), R(4), B(RestoreGeneratorState), R(1), - B(Star), R(0), + B(Star), R(3), B(SwitchOnSmiNoFeedback), U8(0), U8(1), I8(0), - B(Abort), U8(42), + B(Abort), U8(15), B(LdaSmi), I8(-2), - B(Star), R(0), + B(Star), R(3), B(LdaConstant), U8(1), - B(Star), R(4), - B(Mov), R(arg0), R(2), - B(Mov), R(closure), R(3), - B(CallRuntime), U16(Runtime::kPushModuleContext), R(2), U8(3), - B(PushContext), R(2), - B(Mov), R(this), R(4), - B(InvokeIntrinsic), U8(Runtime::k_CreateJSGeneratorObject), R(3), U8(2), - B(StaCurrentContextSlot), U8(4), - /* 0 E> */ B(StackCheck), + B(Star), R(6), + B(Mov), R(arg0), R(4), + B(Mov), R(closure), R(5), + B(CallRuntime), U16(Runtime::kPushModuleContext), R(4), U8(3), + B(PushContext), R(4), + B(Mov), R(this), R(6), + B(InvokeIntrinsic), U8(Runtime::k_CreateJSGeneratorObject), R(5), U8(2), B(Star), R(1), - B(LdaImmutableCurrentContextSlot), U8(4), - /* 0 E> */ B(SuspendGenerator), R(1), R(0), U8(3), U8(0), + /* 0 E> */ B(StackCheck), + /* 0 E> */ B(SuspendGenerator), R(1), R(0), U8(5), U8(0), /* 49 S> */ B(Return), - B(RestoreGeneratorRegisters), R(1), R(0), U8(3), - B(LdaSmi), I8(-2), - B(Star), R(0), - B(InvokeIntrinsic), U8(Runtime::k_GeneratorGetInputOrDebugPos), R(1), U8(1), - B(Star), R(3), + B(ResumeGenerator), R(1), R(3), R(0), U8(5), + B(Star), R(5), B(InvokeIntrinsic), U8(Runtime::k_GeneratorGetResumeMode), R(1), U8(1), B(SwitchOnSmiNoFeedback), U8(2), U8(2), I8(0), - B(Ldar), R(3), + B(Ldar), R(5), /* 0 E> */ B(Throw), - B(Ldar), R(3), + B(Ldar), R(5), /* 49 S> */ B(Return), /* 17 S> */ B(LdaSmi), I8(42), /* 17 E> */ B(StaModuleVariable), I8(1), U8(0), /* 21 S> */ B(LdaModuleVariable), I8(1), U8(0), B(Inc), U8(0), /* 24 E> */ B(StaModuleVariable), I8(1), U8(0), - B(Ldar), R(closure), - B(CreateBlockContext), U8(4), - B(PushContext), R(3), - B(LdaTheHole), - B(StaCurrentContextSlot), U8(4), /* 34 S> */ B(LdaUndefined), - /* 34 E> */ B(StaCurrentContextSlot), U8(4), - /* 39 S> */ B(LdaModuleVariable), I8(1), U8(1), + B(Star), R(0), + /* 39 S> */ B(LdaModuleVariable), I8(1), U8(0), B(ToNumeric), U8(1), - B(Star), R(4), + B(Star), R(5), B(Inc), U8(1), - /* 42 E> */ B(StaModuleVariable), I8(1), U8(1), - B(Ldar), R(4), - B(StaContextSlot), R(3), U8(5), U8(0), - B(PopContext), R(3), - B(LdaCurrentContextSlot), U8(5), + /* 42 E> */ B(StaModuleVariable), I8(1), U8(0), + B(Mov), R(5), R(2), + B(Ldar), R(2), /* 49 S> */ B(Return), ] constant pool: [ - Smi [47], + Smi [43], FIXED_ARRAY_TYPE, Smi [10], Smi [7], - FIXED_ARRAY_TYPE, ] handlers: [ ] @@ -285,76 +247,64 @@ snippet: " foo++; { let x; { foo++ } }; " -frame size: 5 +frame size: 7 parameter count: 2 -bytecode array length: 141 +bytecode array length: 118 bytecodes: [ B(Ldar), R(1), B(JumpIfUndefined), U8(18), B(InvokeIntrinsic), U8(Runtime::k_GeneratorGetContext), R(1), U8(1), - B(PushContext), R(2), + B(PushContext), R(4), B(RestoreGeneratorState), R(1), - B(Star), R(0), + B(Star), R(3), B(SwitchOnSmiNoFeedback), U8(0), U8(1), I8(0), - B(Abort), U8(42), + B(Abort), U8(15), B(LdaSmi), I8(-2), - B(Star), R(0), + B(Star), R(3), B(LdaConstant), U8(1), - B(Star), R(4), - B(Mov), R(arg0), R(2), - B(Mov), R(closure), R(3), - B(CallRuntime), U16(Runtime::kPushModuleContext), R(2), U8(3), - B(PushContext), R(2), - B(Mov), R(this), R(4), - B(InvokeIntrinsic), U8(Runtime::k_CreateJSGeneratorObject), R(3), U8(2), - B(StaCurrentContextSlot), U8(4), + B(Star), R(6), + B(Mov), R(arg0), R(4), + B(Mov), R(closure), R(5), + B(CallRuntime), U16(Runtime::kPushModuleContext), R(4), U8(3), + B(PushContext), R(4), + B(Mov), R(this), R(6), + B(InvokeIntrinsic), U8(Runtime::k_CreateJSGeneratorObject), R(5), U8(2), B(Star), R(1), B(LdaTheHole), B(StaModuleVariable), I8(1), U8(0), /* 0 E> */ B(StackCheck), - B(LdaImmutableCurrentContextSlot), U8(4), - /* 0 E> */ B(SuspendGenerator), R(1), R(0), U8(3), U8(0), + B(Ldar), R(1), + /* 0 E> */ B(SuspendGenerator), R(1), R(0), U8(5), U8(0), /* 49 S> */ B(Return), - B(RestoreGeneratorRegisters), R(1), R(0), U8(3), - B(LdaSmi), I8(-2), - B(Star), R(0), - B(InvokeIntrinsic), U8(Runtime::k_GeneratorGetInputOrDebugPos), R(1), U8(1), - B(Star), R(3), + B(ResumeGenerator), R(1), R(3), R(0), U8(5), + B(Star), R(5), B(InvokeIntrinsic), U8(Runtime::k_GeneratorGetResumeMode), R(1), U8(1), B(SwitchOnSmiNoFeedback), U8(2), U8(2), I8(0), - B(Ldar), R(3), + B(Ldar), R(5), /* 0 E> */ B(Throw), - B(Ldar), R(3), + B(Ldar), R(5), /* 49 S> */ B(Return), /* 17 S> */ B(LdaSmi), I8(42), /* 17 E> */ B(StaModuleVariable), I8(1), U8(0), /* 21 S> */ B(LdaModuleVariable), I8(1), U8(0), B(Inc), U8(0), /* 24 E> */ B(StaModuleVariable), I8(1), U8(0), - B(Ldar), R(closure), - B(CreateBlockContext), U8(4), - B(PushContext), R(3), - B(LdaTheHole), - B(StaCurrentContextSlot), U8(4), /* 34 S> */ B(LdaUndefined), - /* 34 E> */ B(StaCurrentContextSlot), U8(4), - /* 39 S> */ B(LdaModuleVariable), I8(1), U8(1), + B(Star), R(0), + /* 39 S> */ B(LdaModuleVariable), I8(1), U8(0), B(ToNumeric), U8(1), - B(Star), R(4), + B(Star), R(5), B(Inc), U8(1), - /* 42 E> */ B(StaModuleVariable), I8(1), U8(1), - B(Ldar), R(4), - B(StaContextSlot), R(3), U8(5), U8(0), - B(PopContext), R(3), - B(LdaCurrentContextSlot), U8(5), + /* 42 E> */ B(StaModuleVariable), I8(1), U8(0), + B(Mov), R(5), R(2), + B(Ldar), R(2), /* 49 S> */ B(Return), ] constant pool: [ - Smi [51], + Smi [49], FIXED_ARRAY_TYPE, Smi [10], Smi [7], - FIXED_ARRAY_TYPE, ] handlers: [ ] @@ -365,76 +315,64 @@ snippet: " foo++; { let x; { foo++ } }; " -frame size: 5 +frame size: 7 parameter count: 2 -bytecode array length: 145 +bytecode array length: 122 bytecodes: [ B(Ldar), R(1), B(JumpIfUndefined), U8(18), B(InvokeIntrinsic), U8(Runtime::k_GeneratorGetContext), R(1), U8(1), - B(PushContext), R(2), + B(PushContext), R(4), B(RestoreGeneratorState), R(1), - B(Star), R(0), + B(Star), R(3), B(SwitchOnSmiNoFeedback), U8(0), U8(1), I8(0), - B(Abort), U8(42), + B(Abort), U8(15), B(LdaSmi), I8(-2), - B(Star), R(0), + B(Star), R(3), B(LdaConstant), U8(1), - B(Star), R(4), - B(Mov), R(arg0), R(2), - B(Mov), R(closure), R(3), - B(CallRuntime), U16(Runtime::kPushModuleContext), R(2), U8(3), - B(PushContext), R(2), - B(Mov), R(this), R(4), - B(InvokeIntrinsic), U8(Runtime::k_CreateJSGeneratorObject), R(3), U8(2), - B(StaCurrentContextSlot), U8(4), + B(Star), R(6), + B(Mov), R(arg0), R(4), + B(Mov), R(closure), R(5), + B(CallRuntime), U16(Runtime::kPushModuleContext), R(4), U8(3), + B(PushContext), R(4), + B(Mov), R(this), R(6), + B(InvokeIntrinsic), U8(Runtime::k_CreateJSGeneratorObject), R(5), U8(2), B(Star), R(1), B(LdaTheHole), B(StaModuleVariable), I8(1), U8(0), /* 0 E> */ B(StackCheck), - B(LdaImmutableCurrentContextSlot), U8(4), - /* 0 E> */ B(SuspendGenerator), R(1), R(0), U8(3), U8(0), + B(Ldar), R(1), + /* 0 E> */ B(SuspendGenerator), R(1), R(0), U8(5), U8(0), /* 51 S> */ B(Return), - B(RestoreGeneratorRegisters), R(1), R(0), U8(3), - B(LdaSmi), I8(-2), - B(Star), R(0), - B(InvokeIntrinsic), U8(Runtime::k_GeneratorGetInputOrDebugPos), R(1), U8(1), - B(Star), R(3), + B(ResumeGenerator), R(1), R(3), R(0), U8(5), + B(Star), R(5), B(InvokeIntrinsic), U8(Runtime::k_GeneratorGetResumeMode), R(1), U8(1), B(SwitchOnSmiNoFeedback), U8(2), U8(2), I8(0), - B(Ldar), R(3), + B(Ldar), R(5), /* 0 E> */ B(Throw), - B(Ldar), R(3), + B(Ldar), R(5), /* 51 S> */ B(Return), /* 19 S> */ B(LdaSmi), I8(42), /* 19 E> */ B(StaModuleVariable), I8(1), U8(0), /* 23 S> */ B(LdaModuleVariable), I8(1), U8(0), B(Inc), U8(0), /* 26 E> */ B(CallRuntime), U16(Runtime::kThrowConstAssignError), R(0), U8(0), - B(Ldar), R(closure), - B(CreateBlockContext), U8(4), - B(PushContext), R(3), - B(LdaTheHole), - B(StaCurrentContextSlot), U8(4), /* 36 S> */ B(LdaUndefined), - /* 36 E> */ B(StaCurrentContextSlot), U8(4), - /* 41 S> */ B(LdaModuleVariable), I8(1), U8(1), + B(Star), R(0), + /* 41 S> */ B(LdaModuleVariable), I8(1), U8(0), B(ToNumeric), U8(1), - B(Star), R(4), + B(Star), R(5), B(Inc), U8(1), /* 44 E> */ B(CallRuntime), U16(Runtime::kThrowConstAssignError), R(0), U8(0), - B(Ldar), R(4), - B(StaContextSlot), R(3), U8(5), U8(0), - B(PopContext), R(3), - B(LdaCurrentContextSlot), U8(5), + B(Mov), R(5), R(2), + B(Ldar), R(2), /* 51 S> */ B(Return), ] constant pool: [ - Smi [51], + Smi [49], FIXED_ARRAY_TYPE, Smi [10], Smi [7], - FIXED_ARRAY_TYPE, ] handlers: [ ] @@ -443,56 +381,51 @@ handlers: [ snippet: " export default (function () {}); " -frame size: 5 +frame size: 6 parameter count: 2 -bytecode array length: 107 +bytecode array length: 97 bytecodes: [ - B(Ldar), R(1), + B(Ldar), R(0), B(JumpIfUndefined), U8(18), - B(InvokeIntrinsic), U8(Runtime::k_GeneratorGetContext), R(1), U8(1), - B(PushContext), R(2), - B(RestoreGeneratorState), R(1), - B(Star), R(0), + B(InvokeIntrinsic), U8(Runtime::k_GeneratorGetContext), R(0), U8(1), + B(PushContext), R(3), + B(RestoreGeneratorState), R(0), + B(Star), R(2), B(SwitchOnSmiNoFeedback), U8(0), U8(1), I8(0), - B(Abort), U8(42), + B(Abort), U8(15), B(LdaSmi), I8(-2), - B(Star), R(0), + B(Star), R(2), B(LdaConstant), U8(1), - B(Star), R(4), - B(Mov), R(arg0), R(2), - B(Mov), R(closure), R(3), - B(CallRuntime), U16(Runtime::kPushModuleContext), R(2), U8(3), - B(PushContext), R(2), - B(Mov), R(this), R(4), - B(InvokeIntrinsic), U8(Runtime::k_CreateJSGeneratorObject), R(3), U8(2), - B(StaCurrentContextSlot), U8(4), - B(Star), R(1), + B(Star), R(5), + B(Mov), R(arg0), R(3), + B(Mov), R(closure), R(4), + B(CallRuntime), U16(Runtime::kPushModuleContext), R(3), U8(3), + B(PushContext), R(3), + B(Mov), R(this), R(5), + B(InvokeIntrinsic), U8(Runtime::k_CreateJSGeneratorObject), R(4), U8(2), + B(Star), R(0), B(LdaTheHole), B(StaModuleVariable), I8(1), U8(0), /* 0 E> */ B(StackCheck), - B(LdaImmutableCurrentContextSlot), U8(4), - /* 0 E> */ B(SuspendGenerator), R(1), R(0), U8(3), U8(0), + B(Ldar), R(0), + /* 0 E> */ B(SuspendGenerator), R(0), R(0), U8(4), U8(0), /* 32 S> */ B(Return), - B(RestoreGeneratorRegisters), R(1), R(0), U8(3), - B(LdaSmi), I8(-2), - B(Star), R(0), - B(InvokeIntrinsic), U8(Runtime::k_GeneratorGetInputOrDebugPos), R(1), U8(1), - B(Star), R(3), - B(InvokeIntrinsic), U8(Runtime::k_GeneratorGetResumeMode), R(1), U8(1), + B(ResumeGenerator), R(0), R(2), R(0), U8(4), + B(Star), R(4), + B(InvokeIntrinsic), U8(Runtime::k_GeneratorGetResumeMode), R(0), U8(1), B(SwitchOnSmiNoFeedback), U8(2), U8(2), I8(0), - B(Ldar), R(3), + B(Ldar), R(4), /* 0 E> */ B(Throw), - B(Ldar), R(3), + B(Ldar), R(4), /* 32 S> */ B(Return), - B(Ldar), R(3), - B(StaCurrentContextSlot), U8(5), + B(Mov), R(4), R(1), B(CreateClosure), U8(4), U8(0), U8(0), B(StaModuleVariable), I8(1), U8(0), - B(LdaCurrentContextSlot), U8(5), + B(Ldar), R(1), /* 32 S> */ B(Return), ] constant pool: [ - Smi [51], + Smi [49], FIXED_ARRAY_TYPE, Smi [10], Smi [7], @@ -505,65 +438,60 @@ handlers: [ snippet: " export default (class {}); " -frame size: 7 +frame size: 8 parameter count: 2 -bytecode array length: 128 +bytecode array length: 118 bytecodes: [ - B(Ldar), R(1), + B(Ldar), R(0), B(JumpIfUndefined), U8(18), - B(InvokeIntrinsic), U8(Runtime::k_GeneratorGetContext), R(1), U8(1), - B(PushContext), R(2), - B(RestoreGeneratorState), R(1), - B(Star), R(0), + B(InvokeIntrinsic), U8(Runtime::k_GeneratorGetContext), R(0), U8(1), + B(PushContext), R(3), + B(RestoreGeneratorState), R(0), + B(Star), R(2), B(SwitchOnSmiNoFeedback), U8(0), U8(1), I8(0), - B(Abort), U8(42), + B(Abort), U8(15), B(LdaSmi), I8(-2), - B(Star), R(0), + B(Star), R(2), B(LdaConstant), U8(1), - B(Star), R(4), - B(Mov), R(arg0), R(2), - B(Mov), R(closure), R(3), - B(CallRuntime), U16(Runtime::kPushModuleContext), R(2), U8(3), - B(PushContext), R(2), - B(Mov), R(this), R(4), - B(InvokeIntrinsic), U8(Runtime::k_CreateJSGeneratorObject), R(3), U8(2), - B(StaCurrentContextSlot), U8(4), - B(Star), R(1), + B(Star), R(5), + B(Mov), R(arg0), R(3), + B(Mov), R(closure), R(4), + B(CallRuntime), U16(Runtime::kPushModuleContext), R(3), U8(3), + B(PushContext), R(3), + B(Mov), R(this), R(5), + B(InvokeIntrinsic), U8(Runtime::k_CreateJSGeneratorObject), R(4), U8(2), + B(Star), R(0), B(LdaTheHole), B(StaModuleVariable), I8(1), U8(0), /* 0 E> */ B(StackCheck), - B(LdaImmutableCurrentContextSlot), U8(4), - /* 0 E> */ B(SuspendGenerator), R(1), R(0), U8(3), U8(0), + B(Ldar), R(0), + /* 0 E> */ B(SuspendGenerator), R(0), R(0), U8(4), U8(0), /* 26 S> */ B(Return), - B(RestoreGeneratorRegisters), R(1), R(0), U8(3), - B(LdaSmi), I8(-2), - B(Star), R(0), - B(InvokeIntrinsic), U8(Runtime::k_GeneratorGetInputOrDebugPos), R(1), U8(1), - B(Star), R(3), - B(InvokeIntrinsic), U8(Runtime::k_GeneratorGetResumeMode), R(1), U8(1), + B(ResumeGenerator), R(0), R(2), R(0), U8(4), + B(Star), R(4), + B(InvokeIntrinsic), U8(Runtime::k_GeneratorGetResumeMode), R(0), U8(1), B(SwitchOnSmiNoFeedback), U8(2), U8(2), I8(0), - B(Ldar), R(3), + B(Ldar), R(4), /* 0 E> */ B(Throw), - B(Ldar), R(3), + B(Ldar), R(4), /* 26 S> */ B(Return), - B(Ldar), R(3), - B(StaCurrentContextSlot), U8(5), + B(Mov), R(4), R(1), B(LdaTheHole), - B(Star), R(6), + B(Star), R(7), B(CreateClosure), U8(5), U8(0), U8(0), - B(Star), R(3), - B(LdaConstant), U8(4), B(Star), R(4), - B(Mov), R(3), R(5), - B(CallRuntime), U16(Runtime::kDefineClass), R(4), U8(3), - B(Star), R(4), - B(Ldar), R(5), + B(LdaConstant), U8(4), + B(Star), R(5), + B(Mov), R(4), R(6), + B(CallRuntime), U16(Runtime::kDefineClass), R(5), U8(3), + B(Star), R(5), + B(Ldar), R(6), B(StaModuleVariable), I8(1), U8(0), - B(LdaCurrentContextSlot), U8(5), + B(Ldar), R(1), /* 26 S> */ B(Return), ] constant pool: [ - Smi [51], + Smi [49], FIXED_ARRAY_TYPE, Smi [10], Smi [7], @@ -577,52 +505,46 @@ handlers: [ snippet: " export {foo as goo} from \"bar\" " -frame size: 5 +frame size: 6 parameter count: 2 -bytecode array length: 96 +bytecode array length: 84 bytecodes: [ - B(Ldar), R(1), + B(Ldar), R(0), B(JumpIfUndefined), U8(18), - B(InvokeIntrinsic), U8(Runtime::k_GeneratorGetContext), R(1), U8(1), - B(PushContext), R(2), - B(RestoreGeneratorState), R(1), - B(Star), R(0), + B(InvokeIntrinsic), U8(Runtime::k_GeneratorGetContext), R(0), U8(1), + B(PushContext), R(3), + B(RestoreGeneratorState), R(0), + B(Star), R(2), B(SwitchOnSmiNoFeedback), U8(0), U8(1), I8(0), - B(Abort), U8(42), + B(Abort), U8(15), B(LdaSmi), I8(-2), - B(Star), R(0), + B(Star), R(2), B(LdaConstant), U8(1), - B(Star), R(4), - B(Mov), R(arg0), R(2), - B(Mov), R(closure), R(3), - B(CallRuntime), U16(Runtime::kPushModuleContext), R(2), U8(3), - B(PushContext), R(2), - B(Mov), R(this), R(4), - B(InvokeIntrinsic), U8(Runtime::k_CreateJSGeneratorObject), R(3), U8(2), - B(StaCurrentContextSlot), U8(4), + B(Star), R(5), + B(Mov), R(arg0), R(3), + B(Mov), R(closure), R(4), + B(CallRuntime), U16(Runtime::kPushModuleContext), R(3), U8(3), + B(PushContext), R(3), + B(Mov), R(this), R(5), + B(InvokeIntrinsic), U8(Runtime::k_CreateJSGeneratorObject), R(4), U8(2), + B(Star), R(0), /* 0 E> */ B(StackCheck), - B(Star), R(1), - B(LdaImmutableCurrentContextSlot), U8(4), - /* 0 E> */ B(SuspendGenerator), R(1), R(0), U8(3), U8(0), + /* 0 E> */ B(SuspendGenerator), R(0), R(0), U8(4), U8(0), /* 30 S> */ B(Return), - B(RestoreGeneratorRegisters), R(1), R(0), U8(3), - B(LdaSmi), I8(-2), - B(Star), R(0), - B(InvokeIntrinsic), U8(Runtime::k_GeneratorGetInputOrDebugPos), R(1), U8(1), - B(Star), R(3), - B(InvokeIntrinsic), U8(Runtime::k_GeneratorGetResumeMode), R(1), U8(1), + B(ResumeGenerator), R(0), R(2), R(0), U8(4), + B(Star), R(4), + B(InvokeIntrinsic), U8(Runtime::k_GeneratorGetResumeMode), R(0), U8(1), B(SwitchOnSmiNoFeedback), U8(2), U8(2), I8(0), - B(Ldar), R(3), + B(Ldar), R(4), /* 0 E> */ B(Throw), - B(Ldar), R(3), + B(Ldar), R(4), /* 30 S> */ B(Return), - B(Ldar), R(3), - B(StaCurrentContextSlot), U8(5), - B(LdaCurrentContextSlot), U8(5), + B(Mov), R(4), R(1), + B(Ldar), R(1), /* 30 S> */ B(Return), ] constant pool: [ - Smi [47], + Smi [43], FIXED_ARRAY_TYPE, Smi [10], Smi [7], @@ -634,52 +556,46 @@ handlers: [ snippet: " export * from \"bar\" " -frame size: 5 +frame size: 6 parameter count: 2 -bytecode array length: 96 +bytecode array length: 84 bytecodes: [ - B(Ldar), R(1), + B(Ldar), R(0), B(JumpIfUndefined), U8(18), - B(InvokeIntrinsic), U8(Runtime::k_GeneratorGetContext), R(1), U8(1), - B(PushContext), R(2), - B(RestoreGeneratorState), R(1), - B(Star), R(0), + B(InvokeIntrinsic), U8(Runtime::k_GeneratorGetContext), R(0), U8(1), + B(PushContext), R(3), + B(RestoreGeneratorState), R(0), + B(Star), R(2), B(SwitchOnSmiNoFeedback), U8(0), U8(1), I8(0), - B(Abort), U8(42), + B(Abort), U8(15), B(LdaSmi), I8(-2), - B(Star), R(0), + B(Star), R(2), B(LdaConstant), U8(1), - B(Star), R(4), - B(Mov), R(arg0), R(2), - B(Mov), R(closure), R(3), - B(CallRuntime), U16(Runtime::kPushModuleContext), R(2), U8(3), - B(PushContext), R(2), - B(Mov), R(this), R(4), - B(InvokeIntrinsic), U8(Runtime::k_CreateJSGeneratorObject), R(3), U8(2), - B(StaCurrentContextSlot), U8(4), + B(Star), R(5), + B(Mov), R(arg0), R(3), + B(Mov), R(closure), R(4), + B(CallRuntime), U16(Runtime::kPushModuleContext), R(3), U8(3), + B(PushContext), R(3), + B(Mov), R(this), R(5), + B(InvokeIntrinsic), U8(Runtime::k_CreateJSGeneratorObject), R(4), U8(2), + B(Star), R(0), /* 0 E> */ B(StackCheck), - B(Star), R(1), - B(LdaImmutableCurrentContextSlot), U8(4), - /* 0 E> */ B(SuspendGenerator), R(1), R(0), U8(3), U8(0), + /* 0 E> */ B(SuspendGenerator), R(0), R(0), U8(4), U8(0), /* 19 S> */ B(Return), - B(RestoreGeneratorRegisters), R(1), R(0), U8(3), - B(LdaSmi), I8(-2), - B(Star), R(0), - B(InvokeIntrinsic), U8(Runtime::k_GeneratorGetInputOrDebugPos), R(1), U8(1), - B(Star), R(3), - B(InvokeIntrinsic), U8(Runtime::k_GeneratorGetResumeMode), R(1), U8(1), + B(ResumeGenerator), R(0), R(2), R(0), U8(4), + B(Star), R(4), + B(InvokeIntrinsic), U8(Runtime::k_GeneratorGetResumeMode), R(0), U8(1), B(SwitchOnSmiNoFeedback), U8(2), U8(2), I8(0), - B(Ldar), R(3), + B(Ldar), R(4), /* 0 E> */ B(Throw), - B(Ldar), R(3), + B(Ldar), R(4), /* 19 S> */ B(Return), - B(Ldar), R(3), - B(StaCurrentContextSlot), U8(5), - B(LdaCurrentContextSlot), U8(5), + B(Mov), R(4), R(1), + B(Ldar), R(1), /* 19 S> */ B(Return), ] constant pool: [ - Smi [47], + Smi [43], FIXED_ARRAY_TYPE, Smi [10], Smi [7], @@ -692,66 +608,55 @@ snippet: " import * as foo from \"bar\" foo.f(foo, foo.x); " -frame size: 7 +frame size: 9 parameter count: 2 -bytecode array length: 134 +bytecode array length: 111 bytecodes: [ - B(Ldar), R(1), + B(Ldar), R(0), B(JumpIfUndefined), U8(18), - B(InvokeIntrinsic), U8(Runtime::k_GeneratorGetContext), R(1), U8(1), - B(PushContext), R(2), - B(RestoreGeneratorState), R(1), - B(Star), R(0), + B(InvokeIntrinsic), U8(Runtime::k_GeneratorGetContext), R(0), U8(1), + B(PushContext), R(4), + B(RestoreGeneratorState), R(0), + B(Star), R(3), B(SwitchOnSmiNoFeedback), U8(0), U8(1), I8(0), - B(Abort), U8(42), + B(Abort), U8(15), B(LdaSmi), I8(-2), - B(Star), R(0), + B(Star), R(3), B(LdaConstant), U8(1), - B(Star), R(4), - B(Mov), R(arg0), R(2), - B(Mov), R(closure), R(3), - B(CallRuntime), U16(Runtime::kPushModuleContext), R(2), U8(3), - B(PushContext), R(2), - B(Mov), R(this), R(4), - B(InvokeIntrinsic), U8(Runtime::k_CreateJSGeneratorObject), R(3), U8(2), - B(StaCurrentContextSlot), U8(4), - B(Star), R(1), + B(Star), R(6), + B(Mov), R(arg0), R(4), + B(Mov), R(closure), R(5), + B(CallRuntime), U16(Runtime::kPushModuleContext), R(4), U8(3), + B(PushContext), R(4), + B(Mov), R(this), R(6), + B(InvokeIntrinsic), U8(Runtime::k_CreateJSGeneratorObject), R(5), U8(2), + B(Star), R(0), B(LdaZero), - B(Star), R(3), - B(CallRuntime), U16(Runtime::kGetModuleNamespace), R(3), U8(1), - B(StaCurrentContextSlot), U8(5), + B(Star), R(5), + B(CallRuntime), U16(Runtime::kGetModuleNamespace), R(5), U8(1), + B(Star), R(1), /* 0 E> */ B(StackCheck), - B(LdaImmutableCurrentContextSlot), U8(4), - /* 0 E> */ B(SuspendGenerator), R(1), R(0), U8(3), U8(0), + B(Ldar), R(0), + /* 0 E> */ B(SuspendGenerator), R(0), R(0), U8(5), U8(0), /* 45 S> */ B(Return), - B(RestoreGeneratorRegisters), R(1), R(0), U8(3), - B(LdaSmi), I8(-2), - B(Star), R(0), - B(InvokeIntrinsic), U8(Runtime::k_GeneratorGetInputOrDebugPos), R(1), U8(1), - B(Star), R(3), - B(InvokeIntrinsic), U8(Runtime::k_GeneratorGetResumeMode), R(1), U8(1), + B(ResumeGenerator), R(0), R(3), R(0), U8(5), + B(Star), R(5), + B(InvokeIntrinsic), U8(Runtime::k_GeneratorGetResumeMode), R(0), U8(1), B(SwitchOnSmiNoFeedback), U8(2), U8(2), I8(0), - B(Ldar), R(3), + B(Ldar), R(5), /* 0 E> */ B(Throw), - B(Ldar), R(3), + B(Ldar), R(5), /* 45 S> */ B(Return), - /* 27 S> */ B(LdaImmutableCurrentContextSlot), U8(5), - B(Star), R(4), - /* 31 E> */ B(LdaNamedProperty), R(4), U8(4), U8(0), - B(Star), R(3), - B(LdaImmutableCurrentContextSlot), U8(5), + /* 31 S> */ B(LdaNamedProperty), R(1), U8(4), U8(0), B(Star), R(5), - B(LdaImmutableCurrentContextSlot), U8(5), - B(Star), R(6), - /* 42 E> */ B(LdaNamedProperty), R(6), U8(5), U8(2), - B(Star), R(6), - /* 31 E> */ B(CallProperty2), R(3), R(4), R(5), R(6), U8(4), - B(StaCurrentContextSlot), U8(6), - B(LdaCurrentContextSlot), U8(6), + /* 42 E> */ B(LdaNamedProperty), R(1), U8(5), U8(2), + B(Star), R(8), + /* 31 E> */ B(CallProperty2), R(5), R(1), R(1), R(8), U8(4), + B(Star), R(2), /* 45 S> */ B(Return), ] constant pool: [ - Smi [57], + Smi [55], FIXED_ARRAY_TYPE, Smi [10], Smi [7], diff --git a/deps/v8/test/cctest/interpreter/bytecode_expectations/StandardForLoop.golden b/deps/v8/test/cctest/interpreter/bytecode_expectations/StandardForLoop.golden index ec2d310302..e0567143b5 100644 --- a/deps/v8/test/cctest/interpreter/bytecode_expectations/StandardForLoop.golden +++ b/deps/v8/test/cctest/interpreter/bytecode_expectations/StandardForLoop.golden @@ -231,7 +231,7 @@ bytecodes: [ B(JumpIfUndefined), U8(6), B(Ldar), R(3), B(JumpIfNotNull), U8(16), - B(LdaSmi), I8(73), + B(LdaSmi), I8(74), B(Star), R(4), B(LdaConstant), U8(1), B(Star), R(5), @@ -272,7 +272,7 @@ snippet: " " frame size: 6 parameter count: 1 -bytecode array length: 96 +bytecode array length: 89 bytecodes: [ B(Ldar), R(2), B(JumpIfUndefined), U8(18), @@ -281,7 +281,7 @@ bytecodes: [ B(RestoreGeneratorState), R(2), B(Star), R(3), B(SwitchOnSmiNoFeedback), U8(0), U8(1), I8(0), - B(Abort), U8(42), + B(Abort), U8(15), B(LdaSmi), I8(-2), B(Star), R(3), B(Mov), R(closure), R(4), @@ -291,10 +291,7 @@ bytecodes: [ /* 11 E> */ B(StackCheck), /* 11 E> */ B(SuspendGenerator), R(2), R(0), U8(4), U8(0), /* 62 S> */ B(Return), - B(RestoreGeneratorRegisters), R(2), R(0), U8(4), - B(LdaSmi), I8(-2), - B(Star), R(3), - B(InvokeIntrinsic), U8(Runtime::k_GeneratorGetInputOrDebugPos), R(2), U8(1), + B(ResumeGenerator), R(2), R(3), R(0), U8(4), B(Star), R(4), B(InvokeIntrinsic), U8(Runtime::k_GeneratorGetResumeMode), R(2), U8(1), B(SwitchOnSmiNoFeedback), U8(1), U8(2), I8(0), @@ -333,7 +330,7 @@ snippet: " " frame size: 5 parameter count: 1 -bytecode array length: 151 +bytecode array length: 137 bytecodes: [ B(Ldar), R(1), B(JumpIfUndefined), U8(18), @@ -342,7 +339,7 @@ bytecodes: [ B(RestoreGeneratorState), R(1), B(Star), R(2), B(SwitchOnSmiNoFeedback), U8(0), U8(2), I8(0), - B(Abort), U8(42), + B(Abort), U8(15), B(LdaSmi), I8(-2), B(Star), R(2), B(Mov), R(closure), R(3), @@ -352,10 +349,7 @@ bytecodes: [ /* 11 E> */ B(StackCheck), /* 11 E> */ B(SuspendGenerator), R(1), R(0), U8(3), U8(0), /* 56 S> */ B(Return), - B(RestoreGeneratorRegisters), R(1), R(0), U8(3), - B(LdaSmi), I8(-2), - B(Star), R(2), - B(InvokeIntrinsic), U8(Runtime::k_GeneratorGetInputOrDebugPos), R(1), U8(1), + B(ResumeGenerator), R(1), R(2), R(0), U8(3), B(Star), R(3), B(InvokeIntrinsic), U8(Runtime::k_GeneratorGetResumeMode), R(1), U8(1), B(SwitchOnSmiNoFeedback), U8(2), U8(2), I8(0), @@ -370,10 +364,10 @@ bytecodes: [ B(LdaSmi), I8(-2), /* 31 E> */ B(TestEqualStrictNoFeedback), R(2), B(JumpIfTrue), U8(4), - B(Abort), U8(42), + B(Abort), U8(15), /* 36 S> */ B(LdaSmi), I8(10), /* 36 E> */ B(TestLessThan), R(0), U8(0), - B(JumpIfFalse), U8(56), + B(JumpIfFalse), U8(49), /* 18 E> */ B(StackCheck), /* 47 S> */ B(LdaFalse), B(Star), R(4), @@ -381,10 +375,7 @@ bytecodes: [ B(InvokeIntrinsic), U8(Runtime::k_CreateIterResultObject), R(3), U8(2), B(SuspendGenerator), R(1), R(0), U8(3), U8(1), /* 56 S> */ B(Return), - B(RestoreGeneratorRegisters), R(1), R(0), U8(3), - B(LdaSmi), I8(-2), - B(Star), R(2), - B(InvokeIntrinsic), U8(Runtime::k_GeneratorGetInputOrDebugPos), R(1), U8(1), + B(ResumeGenerator), R(1), R(2), R(0), U8(3), B(Star), R(3), B(InvokeIntrinsic), U8(Runtime::k_GeneratorGetResumeMode), R(1), U8(1), B(SwitchOnSmiNoFeedback), U8(5), U8(2), I8(0), @@ -395,13 +386,13 @@ bytecodes: [ /* 44 S> */ B(Ldar), R(0), B(Inc), U8(1), B(Star), R(0), - B(JumpLoop), U8(72), I8(0), + B(JumpLoop), U8(65), I8(0), B(LdaUndefined), /* 56 S> */ B(Return), ] constant pool: [ Smi [29], - Smi [60], + Smi [53], Smi [10], Smi [7], Smi [36], @@ -509,7 +500,7 @@ snippet: " " frame size: 12 parameter count: 1 -bytecode array length: 231 +bytecode array length: 224 bytecodes: [ B(Ldar), R(1), B(JumpIfUndefined), U8(18), @@ -518,7 +509,7 @@ bytecodes: [ B(RestoreGeneratorState), R(1), B(Star), R(3), B(SwitchOnSmiNoFeedback), U8(0), U8(1), I8(0), - B(Abort), U8(42), + B(Abort), U8(15), B(LdaSmi), I8(-2), B(Star), R(3), B(Mov), R(closure), R(4), @@ -537,10 +528,10 @@ bytecodes: [ B(LdaSmi), I8(-2), /* 36 E> */ B(TestEqualStrictNoFeedback), R(3), B(JumpIfTrue), U8(4), - B(Abort), U8(42), + B(Abort), U8(15), /* 41 S> */ B(LdaSmi), I8(10), /* 41 E> */ B(TestLessThan), R(0), U8(0), - B(JumpIfFalse), U8(59), + B(JumpIfFalse), U8(52), /* 23 E> */ B(StackCheck), /* 52 S> */ B(Mov), R(1), R(8), B(Mov), R(0), R(9), @@ -548,10 +539,7 @@ bytecodes: [ B(CallJSRuntime), U8(%async_function_await_uncaught), R(8), U8(3), B(SuspendGenerator), R(1), R(0), U8(8), U8(0), /* 61 S> */ B(Return), - B(RestoreGeneratorRegisters), R(1), R(0), U8(8), - B(LdaSmi), I8(-2), - B(Star), R(3), - B(InvokeIntrinsic), U8(Runtime::k_GeneratorGetInputOrDebugPos), R(1), U8(1), + B(ResumeGenerator), R(1), R(3), R(0), U8(8), B(Star), R(8), B(InvokeIntrinsic), U8(Runtime::k_GeneratorGetResumeMode), R(1), U8(1), B(Star), R(9), @@ -563,7 +551,7 @@ bytecodes: [ /* 49 S> */ B(Ldar), R(0), B(Inc), U8(1), B(Star), R(0), - B(JumpLoop), U8(75), I8(0), + B(JumpLoop), U8(68), I8(0), B(LdaUndefined), B(Star), R(9), B(Mov), R(2), R(8), @@ -624,7 +612,7 @@ constant pool: [ Smi [9], ] handlers: [ - [46, 190, 198], - [49, 148, 150], + [46, 183, 191], + [49, 141, 143], ] diff --git a/deps/v8/test/cctest/interpreter/bytecode_expectations/StaticClassFields.golden b/deps/v8/test/cctest/interpreter/bytecode_expectations/StaticClassFields.golden new file mode 100644 index 0000000000..80a2e4fd49 --- /dev/null +++ b/deps/v8/test/cctest/interpreter/bytecode_expectations/StaticClassFields.golden @@ -0,0 +1,339 @@ +# +# Autogenerated by generate-bytecode-expectations. +# + +--- +wrap: yes +public fields: yes +static fields: yes + +--- +snippet: " + { + class A { + a; + ['b']; + static c; + static ['d']; + } + + class B { + a = 1; + ['b'] = this.a; + static c = 3; + static ['d'] = this.c; + } + new A; + new B; + } +" +frame size: 11 +parameter count: 1 +bytecode array length: 193 +bytecodes: [ + /* 30 E> */ B(StackCheck), + B(Ldar), R(closure), + B(CreateBlockContext), U8(0), + B(PushContext), R(4), + B(LdaTheHole), + B(StaCurrentContextSlot), U8(4), + B(LdaTheHole), + B(StaCurrentContextSlot), U8(5), + B(LdaTheHole), + B(Star), R(8), + B(CreateClosure), U8(2), U8(0), U8(2), + B(Star), R(5), + B(LdaConstant), U8(1), + B(Star), R(6), + B(LdaConstant), U8(3), + B(StaCurrentContextSlot), U8(4), + B(Star), R(9), + B(LdaConstant), U8(4), + B(Star), R(10), + B(LdaConstant), U8(5), + B(TestEqualStrictNoFeedback), R(10), + B(Mov), R(5), R(7), + B(JumpIfFalse), U8(7), + B(CallRuntime), U16(Runtime::kThrowStaticPrototypeError), R(0), U8(0), + B(Ldar), R(10), + B(StaCurrentContextSlot), U8(5), + B(CallRuntime), U16(Runtime::kDefineClass), R(6), U8(5), + B(Star), R(6), + B(Mov), R(5), R(1), + B(CreateClosure), U8(6), U8(1), U8(2), + B(Star), R(7), + B(StaNamedProperty), R(5), U8(7), U8(2), + B(CreateClosure), U8(8), U8(4), U8(2), + B(Star), R(9), + B(CallProperty0), R(9), R(1), U8(5), + B(PopContext), R(4), + B(Mov), R(1), R(2), + B(Ldar), R(closure), + /* 38 E> */ B(CreateBlockContext), U8(9), + B(PushContext), R(4), + B(LdaTheHole), + B(StaCurrentContextSlot), U8(4), + B(LdaTheHole), + B(StaCurrentContextSlot), U8(5), + B(LdaTheHole), + B(Star), R(8), + B(CreateClosure), U8(11), U8(7), U8(2), + B(Star), R(5), + B(LdaConstant), U8(10), + B(Star), R(6), + B(LdaConstant), U8(3), + B(StaCurrentContextSlot), U8(4), + B(Star), R(9), + B(LdaConstant), U8(4), + B(Star), R(10), + B(LdaConstant), U8(5), + B(TestEqualStrictNoFeedback), R(10), + B(Mov), R(5), R(7), + B(JumpIfFalse), U8(7), + B(CallRuntime), U16(Runtime::kThrowStaticPrototypeError), R(0), U8(0), + B(Ldar), R(10), + B(StaCurrentContextSlot), U8(5), + B(CallRuntime), U16(Runtime::kDefineClass), R(6), U8(5), + B(Star), R(6), + B(Mov), R(5), R(0), + B(CreateClosure), U8(12), U8(8), U8(2), + B(Star), R(7), + B(StaNamedProperty), R(5), U8(7), U8(9), + B(CreateClosure), U8(13), U8(11), U8(2), + B(Star), R(9), + B(CallProperty0), R(9), R(0), U8(12), + B(PopContext), R(4), + B(Mov), R(0), R(3), + /* 197 S> */ B(Ldar), R(2), + /* 197 E> */ B(Construct), R(2), R(0), U8(0), U8(14), + /* 206 S> */ B(Ldar), R(0), + /* 206 E> */ B(Construct), R(0), R(0), U8(0), U8(16), + B(LdaUndefined), + /* 215 S> */ B(Return), +] +constant pool: [ + FIXED_ARRAY_TYPE, + FIXED_ARRAY_TYPE, + SHARED_FUNCTION_INFO_TYPE, + ONE_BYTE_INTERNALIZED_STRING_TYPE ["b"], + ONE_BYTE_INTERNALIZED_STRING_TYPE ["d"], + ONE_BYTE_INTERNALIZED_STRING_TYPE ["prototype"], + SHARED_FUNCTION_INFO_TYPE, + SYMBOL_TYPE, + SHARED_FUNCTION_INFO_TYPE, + FIXED_ARRAY_TYPE, + FIXED_ARRAY_TYPE, + SHARED_FUNCTION_INFO_TYPE, + SHARED_FUNCTION_INFO_TYPE, + SHARED_FUNCTION_INFO_TYPE, +] +handlers: [ +] + +--- +snippet: " + { + class A extends class {} { + a; + ['b']; + static c; + static ['d']; + } + + class B extends class {} { + a = 1; + ['b'] = this.a; + static c = 3; + static ['d'] = this.c; + foo() { return 1; } + constructor() { + super(); + } + } + + class C extends B { + a = 1; + ['b'] = this.a; + static c = 3; + static ['d'] = super.foo(); + constructor() { + (() => super())(); + } + } + + new A; + new B; + new C; + } +" +frame size: 15 +parameter count: 1 +bytecode array length: 346 +bytecodes: [ + /* 30 E> */ B(StackCheck), + B(Ldar), R(closure), + B(CreateBlockContext), U8(0), + B(PushContext), R(6), + B(LdaTheHole), + B(StaCurrentContextSlot), U8(4), + B(LdaTheHole), + B(StaCurrentContextSlot), U8(5), + B(LdaTheHole), + B(Star), R(14), + B(CreateClosure), U8(3), U8(0), U8(2), + B(Star), R(11), + B(LdaConstant), U8(2), + B(Star), R(12), + B(Mov), R(11), R(13), + B(CallRuntime), U16(Runtime::kDefineClass), R(12), U8(3), + B(Star), R(12), + B(CreateClosure), U8(4), U8(1), U8(2), + B(Star), R(7), + B(LdaConstant), U8(1), + B(Star), R(8), + B(LdaConstant), U8(5), + B(StaCurrentContextSlot), U8(4), + B(Star), R(11), + B(LdaConstant), U8(6), + B(Star), R(12), + B(LdaConstant), U8(7), + B(TestEqualStrictNoFeedback), R(12), + B(Mov), R(13), R(10), + B(Mov), R(7), R(9), + B(JumpIfFalse), U8(7), + B(CallRuntime), U16(Runtime::kThrowStaticPrototypeError), R(0), U8(0), + B(Ldar), R(12), + B(StaCurrentContextSlot), U8(5), + B(CallRuntime), U16(Runtime::kDefineClass), R(8), U8(5), + B(Star), R(8), + B(Mov), R(7), R(2), + B(CreateClosure), U8(8), U8(2), U8(2), + B(Star), R(9), + B(StaNamedProperty), R(7), U8(9), U8(3), + B(CreateClosure), U8(10), U8(5), U8(2), + B(Star), R(11), + B(CallProperty0), R(11), R(2), U8(6), + B(PopContext), R(6), + B(Mov), R(2), R(3), + B(Ldar), R(closure), + /* 38 E> */ B(CreateBlockContext), U8(11), + B(PushContext), R(6), + B(LdaTheHole), + B(StaCurrentContextSlot), U8(4), + B(LdaTheHole), + B(StaCurrentContextSlot), U8(5), + B(LdaTheHole), + B(Star), R(14), + B(CreateClosure), U8(14), U8(8), U8(2), + B(Star), R(11), + B(LdaConstant), U8(13), + B(Star), R(12), + B(Mov), R(11), R(13), + B(CallRuntime), U16(Runtime::kDefineClass), R(12), U8(3), + B(Star), R(12), + B(CreateClosure), U8(15), U8(9), U8(2), + B(Star), R(7), + B(LdaConstant), U8(12), + B(Star), R(8), + B(LdaConstant), U8(5), + B(StaCurrentContextSlot), U8(4), + B(Star), R(11), + B(LdaConstant), U8(6), + B(Star), R(12), + B(LdaConstant), U8(7), + B(TestEqualStrictNoFeedback), R(12), + B(Mov), R(7), R(9), + B(Mov), R(13), R(10), + B(JumpIfFalse), U8(7), + B(CallRuntime), U16(Runtime::kThrowStaticPrototypeError), R(0), U8(0), + B(Ldar), R(12), + B(StaCurrentContextSlot), U8(5), + B(CreateClosure), U8(16), U8(10), U8(2), + B(Star), R(13), + B(CallRuntime), U16(Runtime::kDefineClass), R(8), U8(6), + B(Star), R(8), + B(Mov), R(7), R(1), + B(CreateClosure), U8(17), U8(11), U8(2), + B(Star), R(9), + B(StaNamedProperty), R(7), U8(9), U8(12), + B(CreateClosure), U8(18), U8(14), U8(2), + B(Star), R(11), + B(CallProperty0), R(11), R(1), U8(15), + B(PopContext), R(6), + B(Mov), R(1), R(4), + B(Ldar), R(closure), + /* 122 E> */ B(CreateBlockContext), U8(19), + B(PushContext), R(6), + B(LdaTheHole), + B(StaCurrentContextSlot), U8(4), + B(LdaTheHole), + B(StaCurrentContextSlot), U8(5), + /* 313 E> */ B(CreateClosure), U8(21), U8(17), U8(2), + B(Star), R(7), + B(LdaConstant), U8(20), + B(Star), R(8), + B(LdaConstant), U8(5), + B(StaCurrentContextSlot), U8(4), + B(Star), R(11), + B(LdaConstant), U8(6), + B(Star), R(12), + B(LdaConstant), U8(7), + B(TestEqualStrictNoFeedback), R(12), + B(Mov), R(1), R(10), + B(Mov), R(7), R(9), + B(JumpIfFalse), U8(7), + B(CallRuntime), U16(Runtime::kThrowStaticPrototypeError), R(0), U8(0), + B(Ldar), R(12), + B(StaCurrentContextSlot), U8(5), + B(CallRuntime), U16(Runtime::kDefineClass), R(8), U8(5), + B(Star), R(8), + B(Mov), R(7), R(0), + B(CreateClosure), U8(22), U8(18), U8(2), + B(Star), R(9), + B(StaNamedProperty), R(7), U8(9), U8(19), + B(CreateClosure), U8(23), U8(21), U8(2), + B(Star), R(11), + B(Ldar), R(0), + B(StaNamedProperty), R(11), U8(24), U8(22), + B(CallProperty0), R(11), R(0), U8(24), + B(PopContext), R(6), + B(Mov), R(0), R(5), + /* 456 S> */ B(Ldar), R(3), + /* 456 E> */ B(Construct), R(3), R(0), U8(0), U8(26), + /* 465 S> */ B(Ldar), R(4), + /* 465 E> */ B(Construct), R(4), R(0), U8(0), U8(28), + /* 474 S> */ B(Ldar), R(0), + /* 474 E> */ B(Construct), R(0), R(0), U8(0), U8(30), + B(LdaUndefined), + /* 483 S> */ B(Return), +] +constant pool: [ + FIXED_ARRAY_TYPE, + FIXED_ARRAY_TYPE, + FIXED_ARRAY_TYPE, + SHARED_FUNCTION_INFO_TYPE, + SHARED_FUNCTION_INFO_TYPE, + ONE_BYTE_INTERNALIZED_STRING_TYPE ["b"], + ONE_BYTE_INTERNALIZED_STRING_TYPE ["d"], + ONE_BYTE_INTERNALIZED_STRING_TYPE ["prototype"], + SHARED_FUNCTION_INFO_TYPE, + SYMBOL_TYPE, + SHARED_FUNCTION_INFO_TYPE, + FIXED_ARRAY_TYPE, + FIXED_ARRAY_TYPE, + FIXED_ARRAY_TYPE, + SHARED_FUNCTION_INFO_TYPE, + SHARED_FUNCTION_INFO_TYPE, + SHARED_FUNCTION_INFO_TYPE, + SHARED_FUNCTION_INFO_TYPE, + SHARED_FUNCTION_INFO_TYPE, + FIXED_ARRAY_TYPE, + FIXED_ARRAY_TYPE, + SHARED_FUNCTION_INFO_TYPE, + SHARED_FUNCTION_INFO_TYPE, + SHARED_FUNCTION_INFO_TYPE, + SYMBOL_TYPE, +] +handlers: [ +] + diff --git a/deps/v8/test/cctest/interpreter/bytecode_expectations/StoreGlobal.golden b/deps/v8/test/cctest/interpreter/bytecode_expectations/StoreGlobal.golden index 8a24433be3..927b9f3307 100644 --- a/deps/v8/test/cctest/interpreter/bytecode_expectations/StoreGlobal.golden +++ b/deps/v8/test/cctest/interpreter/bytecode_expectations/StoreGlobal.golden @@ -18,7 +18,7 @@ bytecode array length: 8 bytecodes: [ /* 21 E> */ B(StackCheck), /* 26 S> */ B(LdaSmi), I8(2), - /* 28 E> */ B(StaGlobalSloppy), U8(0), U8(0), + /* 28 E> */ B(StaGlobal), U8(0), U8(0), B(LdaUndefined), /* 33 S> */ B(Return), ] @@ -39,7 +39,7 @@ bytecode array length: 8 bytecodes: [ /* 26 E> */ B(StackCheck), /* 32 S> */ B(Ldar), R(arg0), - /* 34 E> */ B(StaGlobalSloppy), U8(0), U8(0), + /* 34 E> */ B(StaGlobal), U8(0), U8(0), B(LdaUndefined), /* 39 S> */ B(Return), ] @@ -61,7 +61,7 @@ bytecode array length: 8 bytecodes: [ /* 35 E> */ B(StackCheck), /* 40 S> */ B(LdaSmi), I8(2), - /* 42 E> */ B(StaGlobalStrict), U8(0), U8(0), + /* 42 E> */ B(StaGlobal), U8(0), U8(0), B(LdaUndefined), /* 47 S> */ B(Return), ] @@ -83,7 +83,7 @@ bytecode array length: 8 bytecodes: [ /* 17 E> */ B(StackCheck), /* 22 S> */ B(LdaSmi), I8(2), - /* 24 E> */ B(StaGlobalSloppy), U8(0), U8(0), + /* 24 E> */ B(StaGlobal), U8(0), U8(0), B(LdaUndefined), /* 29 S> */ B(Return), ] @@ -363,7 +363,7 @@ bytecodes: [ /* 1287 S> */ B(LdaNamedProperty), R(arg0), U8(0), U8(252), /* 1297 S> */ B(LdaNamedProperty), R(arg0), U8(0), U8(254), /* 1305 S> */ B(LdaSmi), I8(2), - /* 1307 E> */ B(Wide), B(StaGlobalSloppy), U16(1), U16(256), + /* 1307 E> */ B(Wide), B(StaGlobal), U16(1), U16(256), B(LdaUndefined), /* 1312 S> */ B(Return), ] @@ -645,7 +645,7 @@ bytecodes: [ /* 1303 S> */ B(LdaNamedProperty), R(arg0), U8(0), U8(252), /* 1313 S> */ B(LdaNamedProperty), R(arg0), U8(0), U8(254), /* 1321 S> */ B(LdaSmi), I8(2), - /* 1323 E> */ B(Wide), B(StaGlobalStrict), U16(1), U16(256), + /* 1323 E> */ B(Wide), B(StaGlobal), U16(1), U16(256), B(LdaUndefined), /* 1328 S> */ B(Return), ] diff --git a/deps/v8/test/cctest/interpreter/bytecode_expectations/TopLevelObjectLiterals.golden b/deps/v8/test/cctest/interpreter/bytecode_expectations/TopLevelObjectLiterals.golden index 4b56b6302b..0747228933 100644 --- a/deps/v8/test/cctest/interpreter/bytecode_expectations/TopLevelObjectLiterals.golden +++ b/deps/v8/test/cctest/interpreter/bytecode_expectations/TopLevelObjectLiterals.golden @@ -25,7 +25,7 @@ bytecodes: [ B(CreateClosure), U8(2), U8(3), U8(0), B(StaNamedOwnProperty), R(1), U8(3), U8(4), B(Ldar), R(1), - /* 8 E> */ B(StaGlobalSloppy), U8(4), U8(6), + /* 8 E> */ B(StaGlobal), U8(4), U8(6), B(LdaUndefined), /* 33 S> */ B(Return), ] diff --git a/deps/v8/test/cctest/interpreter/generate-bytecode-expectations.cc b/deps/v8/test/cctest/interpreter/generate-bytecode-expectations.cc index c6b1a01ff7..4064ea1d8b 100644 --- a/deps/v8/test/cctest/interpreter/generate-bytecode-expectations.cc +++ b/deps/v8/test/cctest/interpreter/generate-bytecode-expectations.cc @@ -45,6 +45,7 @@ class ProgramOptions final { do_expressions_(false), async_iteration_(false), public_fields_(false), + static_fields_(false), verbose_(false) {} bool Validate() const; @@ -65,6 +66,7 @@ class ProgramOptions final { bool do_expressions() const { return do_expressions_; } bool async_iteration() const { return async_iteration_; } bool public_fields() const { return public_fields_; } + bool static_fields() const { return static_fields_; } bool verbose() const { return verbose_; } bool suppress_runtime_errors() const { return rebaseline_ && !verbose_; } std::vector<std::string> input_filenames() const { return input_filenames_; } @@ -83,6 +85,7 @@ class ProgramOptions final { bool do_expressions_; bool async_iteration_; bool public_fields_; + bool static_fields_; bool verbose_; std::vector<std::string> input_filenames_; std::string output_filename_; @@ -174,6 +177,8 @@ ProgramOptions ProgramOptions::FromCommandLine(int argc, char** argv) { options.async_iteration_ = true; } else if (strcmp(argv[i], "--public-fields") == 0) { options.public_fields_ = true; + } else if (strcmp(argv[i], "--static-fields") == 0) { + options.static_fields_ = true; } else if (strcmp(argv[i], "--verbose") == 0) { options.verbose_ = true; } else if (strncmp(argv[i], "--output=", 9) == 0) { @@ -280,6 +285,8 @@ void ProgramOptions::UpdateFromHeader(std::istream& stream) { async_iteration_ = ParseBoolean(line.c_str() + 17); } else if (line.compare(0, 15, "public fields: ") == 0) { public_fields_ = ParseBoolean(line.c_str() + 15); + } else if (line.compare(0, 15, "static fields: ") == 0) { + static_fields_ = ParseBoolean(line.c_str() + 15); } else if (line == "---") { break; } else if (line.empty()) { @@ -304,6 +311,7 @@ void ProgramOptions::PrintHeader(std::ostream& stream) const { // NOLINT if (do_expressions_) stream << "\ndo expressions: yes"; if (async_iteration_) stream << "\nasync iteration: yes"; if (public_fields_) stream << "\npublic fields: yes"; + if (static_fields_) stream << "\nstatic fields: yes"; stream << "\n\n"; } @@ -407,8 +415,8 @@ void GenerateExpectationsFile(std::ostream& stream, // NOLINT } if (options.do_expressions()) i::FLAG_harmony_do_expressions = true; - if (options.async_iteration()) i::FLAG_harmony_async_iteration = true; if (options.public_fields()) i::FLAG_harmony_public_fields = true; + if (options.static_fields()) i::FLAG_harmony_static_fields = true; stream << "#\n# Autogenerated by generate-bytecode-expectations.\n#\n\n"; options.PrintHeader(stream); @@ -417,8 +425,8 @@ void GenerateExpectationsFile(std::ostream& stream, // NOLINT } i::FLAG_harmony_do_expressions = false; - i::FLAG_harmony_async_iteration = false; i::FLAG_harmony_public_fields = false; + i::FLAG_harmony_static_fields = false; } bool WriteExpectationsFile(const std::vector<std::string>& snippet_list, @@ -465,8 +473,8 @@ void PrintUsage(const char* exec_path) { "Specify the name of the test function.\n" " --top-level Process top level code, not the top-level function.\n" " --do-expressions Enable harmony_do_expressions flag.\n" - " --async-iteration Enable harmony_async_iteration flag.\n" " --public-fields Enable harmony_public_fields flag.\n" + " --static-fields Enable harmony_static_fields flag.\n" " --output=file.name\n" " Specify the output file. If not specified, output goes to " "stdout.\n" diff --git a/deps/v8/test/cctest/interpreter/interpreter-tester.h b/deps/v8/test/cctest/interpreter/interpreter-tester.h index 8bc6e67a32..93e1d930ac 100644 --- a/deps/v8/test/cctest/interpreter/interpreter-tester.h +++ b/deps/v8/test/cctest/interpreter/interpreter-tester.h @@ -83,6 +83,11 @@ class InterpreterTester { static const char kFunctionName[]; + // Expose raw RegisterList construction to tests. + static RegisterList NewRegisterList(int first_reg_index, int register_count) { + return RegisterList(first_reg_index, register_count); + } + private: Isolate* isolate_; const char* source_; diff --git a/deps/v8/test/cctest/interpreter/test-bytecode-generator.cc b/deps/v8/test/cctest/interpreter/test-bytecode-generator.cc index ed8098ddab..1db0f70ad7 100644 --- a/deps/v8/test/cctest/interpreter/test-bytecode-generator.cc +++ b/deps/v8/test/cctest/interpreter/test-bytecode-generator.cc @@ -2244,6 +2244,62 @@ TEST(ClassFields) { " class A {\n" " a;\n" " ['b'];\n" + " }\n" + "\n" + " class B {\n" + " a = 1;\n" + " ['b'] = this.a;\n" + " }\n" + " new A;\n" + " new B;\n" + "}\n", + + "{\n" + " class A extends class {} {\n" + " a;\n" + " ['b'];\n" + " }\n" + "\n" + " class B extends class {} {\n" + " a = 1;\n" + " ['b'] = this.a;\n" + " foo() { return 1; }\n" + " constructor() {\n" + " super();\n" + " }\n" + " }\n" + "\n" + " class C extends B {\n" + " a = 1;\n" + " ['b'] = this.a;\n" + " constructor() {\n" + " (() => super())();\n" + " }\n" + " }\n" + "\n" + " new A;\n" + " new B;\n" + " new C;\n" + "}\n"}; + + CHECK(CompareTexts(BuildActual(printer, snippets), + LoadGolden("ClassFields.golden"))); + i::FLAG_harmony_public_fields = old_flag; +} + +TEST(StaticClassFields) { + bool old_flag = i::FLAG_harmony_public_fields; + bool old_static_flag = i::FLAG_harmony_static_fields; + i::FLAG_harmony_public_fields = true; + i::FLAG_harmony_static_fields = true; + InitializedIgnitionHandleScope scope; + BytecodeExpectationsPrinter printer(CcTest::isolate()); + + const char* snippets[] = { + "{\n" + " class A {\n" + " a;\n" + " ['b'];\n" " static c;\n" " static ['d'];\n" " }\n" @@ -2293,8 +2349,9 @@ TEST(ClassFields) { "}\n"}; CHECK(CompareTexts(BuildActual(printer, snippets), - LoadGolden("ClassFields.golden"))); + LoadGolden("StaticClassFields.golden"))); i::FLAG_harmony_public_fields = old_flag; + i::FLAG_harmony_static_fields = old_static_flag; } TEST(Generators) { @@ -2323,8 +2380,6 @@ TEST(Generators) { } TEST(AsyncGenerators) { - bool old_flag = i::FLAG_harmony_async_iteration; - i::FLAG_harmony_async_iteration = true; InitializedIgnitionHandleScope scope; BytecodeExpectationsPrinter printer(CcTest::isolate()); printer.set_wrap(false); @@ -2347,7 +2402,6 @@ TEST(AsyncGenerators) { CHECK(CompareTexts(BuildActual(printer, snippets), LoadGolden("AsyncGenerators.golden"))); - i::FLAG_harmony_async_iteration = old_flag; } TEST(Modules) { @@ -2465,8 +2519,6 @@ TEST(NewAndSpread) { } TEST(ForAwaitOf) { - bool old_flag = i::FLAG_harmony_async_iteration; - i::FLAG_harmony_async_iteration = true; InitializedIgnitionHandleScope scope; BytecodeExpectationsPrinter printer(CcTest::isolate()); printer.set_wrap(false); @@ -2499,8 +2551,6 @@ TEST(ForAwaitOf) { CHECK(CompareTexts(BuildActual(printer, snippets), LoadGolden("ForAwaitOf.golden"))); - - i::FLAG_harmony_async_iteration = old_flag; } TEST(StandardForLoop) { diff --git a/deps/v8/test/cctest/interpreter/test-interpreter-intrinsics.cc b/deps/v8/test/cctest/interpreter/test-interpreter-intrinsics.cc index b706b7c480..b8ebef3b28 100644 --- a/deps/v8/test/cctest/interpreter/test-interpreter-intrinsics.cc +++ b/deps/v8/test/cctest/interpreter/test-interpreter-intrinsics.cc @@ -27,7 +27,8 @@ class InvokeIntrinsicHelper { Handle<Object> Invoke(A... args) { CHECK(IntrinsicsHelper::IsSupported(function_id_)); BytecodeArrayBuilder builder(zone_, sizeof...(args), 0, 0); - RegisterList reg_list(builder.Receiver().index(), sizeof...(args)); + RegisterList reg_list = InterpreterTester::NewRegisterList( + builder.Receiver().index(), sizeof...(args)); builder.CallRuntime(function_id_, reg_list).Return(); InterpreterTester tester(isolate_, builder.ToBytecodeArray(isolate_)); auto callable = tester.GetCallable<A...>(); diff --git a/deps/v8/test/cctest/interpreter/test-interpreter.cc b/deps/v8/test/cctest/interpreter/test-interpreter.cc index 6185925ab4..cd77fd43a1 100644 --- a/deps/v8/test/cctest/interpreter/test-interpreter.cc +++ b/deps/v8/test/cctest/interpreter/test-interpreter.cc @@ -387,6 +387,48 @@ TEST(InterpreterBinaryOpsHeapNumber) { } } +TEST(InterpreterBinaryOpsBigInt) { + // This test only checks that the recorded type feedback is kBigInt. + AstBigInt inputs[] = {AstBigInt("1"), AstBigInt("-42"), AstBigInt("0xFFFF")}; + for (size_t l = 0; l < arraysize(inputs); l++) { + for (size_t r = 0; r < arraysize(inputs); r++) { + for (size_t o = 0; o < arraysize(kArithmeticOperators); o++) { + // Skip over unsigned right shift. + if (kArithmeticOperators[o] == Token::Value::SHR) continue; + + HandleAndZoneScope handles; + Isolate* isolate = handles.main_isolate(); + Zone* zone = handles.main_zone(); + FeedbackVectorSpec feedback_spec(zone); + BytecodeArrayBuilder builder(zone, 1, 1, &feedback_spec); + + FeedbackSlot slot = feedback_spec.AddBinaryOpICSlot(); + Handle<i::FeedbackMetadata> metadata = + NewFeedbackMetadata(isolate, &feedback_spec); + + Register reg(0); + auto lhs = inputs[l]; + auto rhs = inputs[r]; + builder.LoadLiteral(lhs) + .StoreAccumulatorInRegister(reg) + .LoadLiteral(rhs) + .BinaryOperation(kArithmeticOperators[o], reg, GetIndex(slot)) + .Return(); + Handle<BytecodeArray> bytecode_array = builder.ToBytecodeArray(isolate); + + InterpreterTester tester(isolate, bytecode_array, metadata); + auto callable = tester.GetCallable<>(); + Handle<Object> return_value = callable().ToHandleChecked(); + CHECK(return_value->IsBigInt()); + Object* feedback = callable.vector()->Get(slot); + CHECK(feedback->IsSmi()); + CHECK_EQ(BinaryOperationFeedback::kBigInt, + static_cast<Smi*>(feedback)->value()); + } + } + } +} + namespace { struct LiteralForTest { @@ -827,6 +869,8 @@ TEST(InterpreterUnaryOpFeedback) { Handle<Smi> smi_max = Handle<Smi>(Smi::FromInt(Smi::kMaxValue), isolate); Handle<Smi> smi_min = Handle<Smi>(Smi::FromInt(Smi::kMinValue), isolate); Handle<HeapNumber> number = isolate->factory()->NewHeapNumber(2.1); + Handle<BigInt> bigint = + BigInt::FromNumber(isolate, smi_max).ToHandleChecked(); Handle<String> str = isolate->factory()->NewStringFromAsciiChecked("42"); struct TestCase { @@ -834,19 +878,23 @@ TEST(InterpreterUnaryOpFeedback) { Handle<Smi> smi_feedback_value; Handle<Smi> smi_to_number_feedback_value; Handle<HeapNumber> number_feedback_value; + Handle<BigInt> bigint_feedback_value; Handle<Object> any_feedback_value; }; TestCase const kTestCases[] = { - {Token::Value::INC, smi_one, smi_max, number, str}, - {Token::Value::DEC, smi_one, smi_min, number, str}}; + // Testing ADD and BIT_NOT would require generalizing the test setup. + {Token::Value::SUB, smi_one, smi_min, number, bigint, str}, + {Token::Value::INC, smi_one, smi_max, number, bigint, str}, + {Token::Value::DEC, smi_one, smi_min, number, bigint, str}}; for (TestCase const& test_case : kTestCases) { i::FeedbackVectorSpec feedback_spec(zone); - BytecodeArrayBuilder builder(zone, 4, 0, &feedback_spec); + BytecodeArrayBuilder builder(zone, 5, 0, &feedback_spec); i::FeedbackSlot slot0 = feedback_spec.AddBinaryOpICSlot(); i::FeedbackSlot slot1 = feedback_spec.AddBinaryOpICSlot(); i::FeedbackSlot slot2 = feedback_spec.AddBinaryOpICSlot(); i::FeedbackSlot slot3 = feedback_spec.AddBinaryOpICSlot(); + i::FeedbackSlot slot4 = feedback_spec.AddBinaryOpICSlot(); Handle<i::FeedbackMetadata> metadata = i::NewFeedbackMetadata(isolate, &feedback_spec); @@ -859,18 +907,21 @@ TEST(InterpreterUnaryOpFeedback) { .UnaryOperation(test_case.op, GetIndex(slot2)) .LoadAccumulatorWithRegister(builder.Parameter(2)) .UnaryOperation(test_case.op, GetIndex(slot3)) + .LoadAccumulatorWithRegister(builder.Parameter(3)) + .UnaryOperation(test_case.op, GetIndex(slot4)) .Return(); Handle<BytecodeArray> bytecode_array = builder.ToBytecodeArray(isolate); InterpreterTester tester(isolate, bytecode_array, metadata); typedef Handle<Object> H; - auto callable = tester.GetCallable<H, H, H, H>(); + auto callable = tester.GetCallable<H, H, H, H, H>(); Handle<Object> return_val = callable(test_case.smi_feedback_value, test_case.smi_to_number_feedback_value, - test_case.number_feedback_value, test_case.any_feedback_value) + test_case.number_feedback_value, + test_case.bigint_feedback_value, test_case.any_feedback_value) .ToHandleChecked(); USE(return_val); Object* feedback0 = callable.vector()->Get(slot0); @@ -890,8 +941,13 @@ TEST(InterpreterUnaryOpFeedback) { Object* feedback3 = callable.vector()->Get(slot3); CHECK(feedback3->IsSmi()); - CHECK_EQ(BinaryOperationFeedback::kAny, + CHECK_EQ(BinaryOperationFeedback::kBigInt, static_cast<Smi*>(feedback3)->value()); + + Object* feedback4 = callable.vector()->Get(slot4); + CHECK(feedback4->IsSmi()); + CHECK_EQ(BinaryOperationFeedback::kAny, + static_cast<Smi*>(feedback4)->value()); } } @@ -1822,6 +1878,49 @@ TEST(InterpreterHeapNumberComparisons) { } } +TEST(InterpreterBigIntComparisons) { + // This test only checks that the recorded type feedback is kBigInt. + AstBigInt inputs[] = {AstBigInt("0"), AstBigInt("-42"), + AstBigInt("0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF")}; + for (size_t c = 0; c < arraysize(kComparisonTypes); c++) { + Token::Value comparison = kComparisonTypes[c]; + for (size_t i = 0; i < arraysize(inputs); i++) { + for (size_t j = 0; j < arraysize(inputs); j++) { + HandleAndZoneScope handles; + Isolate* isolate = handles.main_isolate(); + Zone* zone = handles.main_zone(); + AstValueFactory ast_factory(zone, isolate->ast_string_constants(), + isolate->heap()->HashSeed()); + + FeedbackVectorSpec feedback_spec(zone); + BytecodeArrayBuilder builder(zone, 1, 1, &feedback_spec); + + FeedbackSlot slot = feedback_spec.AddCompareICSlot(); + Handle<i::FeedbackMetadata> metadata = + NewFeedbackMetadata(isolate, &feedback_spec); + + Register r0(0); + builder.LoadLiteral(inputs[i]) + .StoreAccumulatorInRegister(r0) + .LoadLiteral(inputs[j]) + .CompareOperation(comparison, r0, GetIndex(slot)) + .Return(); + + ast_factory.Internalize(isolate); + Handle<BytecodeArray> bytecode_array = builder.ToBytecodeArray(isolate); + InterpreterTester tester(isolate, bytecode_array, metadata); + auto callable = tester.GetCallable<>(); + Handle<Object> return_value = callable().ToHandleChecked(); + CHECK(return_value->IsBoolean()); + Object* feedback = callable.vector()->Get(slot); + CHECK(feedback->IsSmi()); + CHECK_EQ(CompareOperationFeedback::kBigInt, + static_cast<Smi*>(feedback)->value()); + } + } + } +} + TEST(InterpreterStringComparisons) { HandleAndZoneScope handles; Isolate* isolate = handles.main_isolate(); @@ -3314,17 +3413,17 @@ TEST(InterpreterForIn) { {"var r = 0;\n" "for (var a in [0,6,7,9]) { r = r + (1 << a); }\n" "return r;\n", - 0xf}, + 0xF}, {"var r = 0;\n" "for (var a in [0,6,7,9]) { r = r + (1 << a); }\n" "var r = 0;\n" "for (var a in [0,6,7,9]) { r = r + (1 << a); }\n" "return r;\n", - 0xf}, + 0xF}, {"var r = 0;\n" "for (var a in 'foobar') { r = r + (1 << a); }\n" "return r;\n", - 0x3f}, + 0x3F}, {"var r = 0;\n" "for (var a in {1:0, 10:1, 100:2, 1000:3}) {\n" " r = r + Number(a);\n" @@ -4491,7 +4590,7 @@ TEST(InterpreterWideParametersPickOne) { std::string source = os.str(); InterpreterTester tester(isolate, source.c_str(), "*"); auto callable = tester.GetCallable<Handle<Object>>(); - Handle<Object> arg = handle(Smi::FromInt(0xaa55), isolate); + Handle<Object> arg = handle(Smi::FromInt(0xAA55), isolate); Handle<Object> return_value = callable(arg).ToHandleChecked(); Handle<Smi> actual = Handle<Smi>::cast(return_value); CHECK_EQ(actual->value(), parameter); diff --git a/deps/v8/test/cctest/parsing/test-preparser.cc b/deps/v8/test/cctest/parsing/test-preparser.cc index 74630c6c7e..48aa4826c9 100644 --- a/deps/v8/test/cctest/parsing/test-preparser.cc +++ b/deps/v8/test/cctest/parsing/test-preparser.cc @@ -660,11 +660,23 @@ TEST(PreParserScopeAnalysis) { [] { i::FLAG_harmony_public_fields = true; }, [] { i::FLAG_harmony_public_fields = false; }}, {"class X { static ['foo'] = 2; }; new X;", - [] { i::FLAG_harmony_public_fields = true; }, - [] { i::FLAG_harmony_public_fields = false; }}, + [] { + i::FLAG_harmony_public_fields = true; + i::FLAG_harmony_static_fields = true; + }, + [] { + i::FLAG_harmony_public_fields = false; + i::FLAG_harmony_static_fields = false; + }}, {"class X { ['bar'] = 1; static ['foo'] = 2; }; new X;", - [] { i::FLAG_harmony_public_fields = true; }, - [] { i::FLAG_harmony_public_fields = false; }}, + [] { + i::FLAG_harmony_public_fields = true; + i::FLAG_harmony_static_fields = true; + }, + [] { + i::FLAG_harmony_public_fields = false; + i::FLAG_harmony_static_fields = false; + }}, }; for (unsigned outer_ix = 0; outer_ix < arraysize(outers); ++outer_ix) { diff --git a/deps/v8/test/cctest/parsing/test-scanner-streams.cc b/deps/v8/test/cctest/parsing/test-scanner-streams.cc index 27fc086487..ab207e5813 100644 --- a/deps/v8/test/cctest/parsing/test-scanner-streams.cc +++ b/deps/v8/test/cctest/parsing/test-scanner-streams.cc @@ -500,7 +500,7 @@ TEST(Regress6377) { "\xbf\0", // third chunk - end of 2-byte seq }; const std::vector<std::vector<uint16_t>> unicode_expected = { - {0xd800, 0xdc00, 97}, {0xfff, 97}, {0xff, 97}, {0xd800, 0xdc00, 97, 0xff}, + {0xD800, 0xDC00, 97}, {0xFFF, 97}, {0xFF, 97}, {0xD800, 0xDC00, 97, 0xFF}, }; CHECK_EQ(unicode_expected.size(), arraysize(cases)); TestChunkStreamAgainstReference(cases, unicode_expected); @@ -508,7 +508,7 @@ TEST(Regress6377) { TEST(Regress6836) { const char* cases[] = { - // 0xc2 is a lead byte, but there's no continuation. The bug occurs when + // 0xC2 is a lead byte, but there's no continuation. The bug occurs when // this happens near the chunk end. "X\xc2Y\0", // Last chunk ends with a 2-byte char lead. @@ -518,7 +518,7 @@ TEST(Regress6836) { "X\xe0\xbf\0", }; const std::vector<std::vector<uint16_t>> unicode_expected = { - {0x58, 0xfffd, 0x59}, {0x58, 0xfffd}, {0x58, 0xfffd}, + {0x58, 0xFFFD, 0x59}, {0x58, 0xFFFD}, {0x58, 0xFFFD}, }; CHECK_EQ(unicode_expected.size(), arraysize(cases)); TestChunkStreamAgainstReference(cases, unicode_expected); @@ -540,12 +540,12 @@ TEST(TestOverlongAndInvalidSequences) { "X\xf4\x90\x80\x80Y\0", }; const std::vector<std::vector<uint16_t>> unicode_expected = { - {0x58, 0xfffd, 0xfffd, 0x59}, - {0x58, 0xfffd, 0xfffd, 0x59}, - {0x58, 0xfffd, 0xfffd, 0xfffd, 0x59}, - {0x58, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0x59}, - {0x58, 0xfffd, 0xfffd, 0xfffd, 0x59}, - {0x58, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0x59}, + {0x58, 0xFFFD, 0xFFFD, 0x59}, + {0x58, 0xFFFD, 0xFFFD, 0x59}, + {0x58, 0xFFFD, 0xFFFD, 0xFFFD, 0x59}, + {0x58, 0xFFFD, 0xFFFD, 0xFFFD, 0xFFFD, 0x59}, + {0x58, 0xFFFD, 0xFFFD, 0xFFFD, 0x59}, + {0x58, 0xFFFD, 0xFFFD, 0xFFFD, 0xFFFD, 0x59}, }; CHECK_EQ(unicode_expected.size(), arraysize(cases)); TestChunkStreamAgainstReference(cases, unicode_expected); diff --git a/deps/v8/test/cctest/parsing/test-scanner.cc b/deps/v8/test/cctest/parsing/test-scanner.cc index 9c18bfb1ae..ea7a8fbaa2 100644 --- a/deps/v8/test/cctest/parsing/test-scanner.cc +++ b/deps/v8/test/cctest/parsing/test-scanner.cc @@ -29,7 +29,6 @@ struct ScannerTestHelper { std::unique_ptr<UnicodeCache> unicode_cache; std::unique_ptr<Utf16CharacterStream> stream; std::unique_ptr<Scanner> scanner; - int use_counts[v8::Isolate::kUseCounterFeatureCount]; Scanner* operator->() const { return scanner.get(); } Scanner* get() const { return scanner.get(); } @@ -39,11 +38,8 @@ ScannerTestHelper make_scanner(const char* src) { ScannerTestHelper helper; helper.unicode_cache = std::unique_ptr<UnicodeCache>(new UnicodeCache); helper.stream = ScannerStream::ForTesting(src); - for (int i = 0; i < v8::Isolate::kUseCounterFeatureCount; i++) { - helper.use_counts[i] = 0; - } - helper.scanner = std::unique_ptr<Scanner>( - new Scanner(helper.unicode_cache.get(), helper.use_counts)); + helper.scanner = + std::unique_ptr<Scanner>(new Scanner(helper.unicode_cache.get())); helper.scanner->Initialize(helper.stream.get(), false); return helper; } diff --git a/deps/v8/test/cctest/profiler-extension.cc b/deps/v8/test/cctest/profiler-extension.cc index aa75a481f5..28fb146036 100644 --- a/deps/v8/test/cctest/profiler-extension.cc +++ b/deps/v8/test/cctest/profiler-extension.cc @@ -53,8 +53,7 @@ v8::Local<v8::FunctionTemplate> ProfilerExtension::GetNativeFunctionTemplate( if (name->Equals(context, v8_str(isolate, "collectSample")).FromJust()) { return v8::FunctionTemplate::New(isolate, ProfilerExtension::CollectSample); } - CHECK(false); - return v8::Local<v8::FunctionTemplate>(); + UNREACHABLE(); } void ProfilerExtension::StartProfiling( diff --git a/deps/v8/test/cctest/test-access-checks.cc b/deps/v8/test/cctest/test-access-checks.cc index f260a15c6e..acea843c14 100644 --- a/deps/v8/test/cctest/test-access-checks.cc +++ b/deps/v8/test/cctest/test-access-checks.cc @@ -348,7 +348,7 @@ TEST(AccessCheckWithExceptionThrowingInterceptor) { isolate->SetFailedAccessCheckCallbackFunction([](v8::Local<v8::Object> target, v8::AccessType type, v8::Local<v8::Value> data) { - CHECK(false); // This should never be called. + UNREACHABLE(); // This should never be called. }); v8::HandleScope scope(isolate); diff --git a/deps/v8/test/cctest/test-accessors.cc b/deps/v8/test/cctest/test-accessors.cc index 07da7a55a0..24c10a0f6e 100644 --- a/deps/v8/test/cctest/test-accessors.cc +++ b/deps/v8/test/cctest/test-accessors.cc @@ -84,36 +84,65 @@ THREADED_TEST(PropertyHandler) { Local<Script> setter; // check function instance accessors getter = v8_compile("var obj = new Fun(); obj.instance_foo;"); - CHECK_EQ(900, getter->Run(env.local()) - .ToLocalChecked() - ->Int32Value(env.local()) - .FromJust()); + for (int i = 0; i < 4; i++) { + CHECK_EQ(900, getter->Run(env.local()) + .ToLocalChecked() + ->Int32Value(env.local()) + .FromJust()); + } setter = v8_compile("obj.instance_foo = 901;"); - CHECK_EQ(901, setter->Run(env.local()) - .ToLocalChecked() - ->Int32Value(env.local()) - .FromJust()); + for (int i = 0; i < 4; i++) { + CHECK_EQ(901, setter->Run(env.local()) + .ToLocalChecked() + ->Int32Value(env.local()) + .FromJust()); + } getter = v8_compile("obj.bar;"); - CHECK_EQ(907, getter->Run(env.local()) - .ToLocalChecked() - ->Int32Value(env.local()) - .FromJust()); + for (int i = 0; i < 4; i++) { + CHECK_EQ(907, getter->Run(env.local()) + .ToLocalChecked() + ->Int32Value(env.local()) + .FromJust()); + } setter = v8_compile("obj.bar = 908;"); - CHECK_EQ(908, setter->Run(env.local()) - .ToLocalChecked() - ->Int32Value(env.local()) - .FromJust()); + for (int i = 0; i < 4; i++) { + CHECK_EQ(908, setter->Run(env.local()) + .ToLocalChecked() + ->Int32Value(env.local()) + .FromJust()); + } // check function static accessors getter = v8_compile("Fun.object_foo;"); - CHECK_EQ(902, getter->Run(env.local()) - .ToLocalChecked() - ->Int32Value(env.local()) - .FromJust()); + for (int i = 0; i < 4; i++) { + CHECK_EQ(902, getter->Run(env.local()) + .ToLocalChecked() + ->Int32Value(env.local()) + .FromJust()); + } setter = v8_compile("Fun.object_foo = 903;"); - CHECK_EQ(903, setter->Run(env.local()) - .ToLocalChecked() - ->Int32Value(env.local()) - .FromJust()); + for (int i = 0; i < 4; i++) { + CHECK_EQ(903, setter->Run(env.local()) + .ToLocalChecked() + ->Int32Value(env.local()) + .FromJust()); + } + + // And now with null prototype. + CompileRun(env.local(), "obj.__proto__ = null;"); + getter = v8_compile("obj.bar;"); + for (int i = 0; i < 4; i++) { + CHECK_EQ(907, getter->Run(env.local()) + .ToLocalChecked() + ->Int32Value(env.local()) + .FromJust()); + } + setter = v8_compile("obj.bar = 908;"); + for (int i = 0; i < 4; i++) { + CHECK_EQ(908, setter->Run(env.local()) + .ToLocalChecked() + ->Int32Value(env.local()) + .FromJust()); + } } @@ -647,10 +676,32 @@ THREADED_TEST(GlobalObjectAccessor) { " set : function() { set_value = this; }" "});" "function getter() { return x; }" - "function setter() { x = 1; }" - "for (var i = 0; i < 4; i++) { getter(); setter(); }"); - CHECK(v8::Utils::OpenHandle(*CompileRun("getter()"))->IsJSGlobalProxy()); - CHECK(v8::Utils::OpenHandle(*CompileRun("set_value"))->IsJSGlobalProxy()); + "function setter() { x = 1; }"); + + Local<Script> check_getter = v8_compile("getter()"); + Local<Script> check_setter = v8_compile("setter(); set_value"); + + // Ensure that LoadGlobalICs in getter and StoreGlobalICs setter get + // JSGlobalProxy as a receiver regardless of the current IC state and + // the order in which ICs are executed. + for (int i = 0; i < 10; i++) { + CHECK( + v8::Utils::OpenHandle(*check_getter->Run(env.local()).ToLocalChecked()) + ->IsJSGlobalProxy()); + } + for (int i = 0; i < 10; i++) { + CHECK( + v8::Utils::OpenHandle(*check_setter->Run(env.local()).ToLocalChecked()) + ->IsJSGlobalProxy()); + } + for (int i = 0; i < 10; i++) { + CHECK( + v8::Utils::OpenHandle(*check_getter->Run(env.local()).ToLocalChecked()) + ->IsJSGlobalProxy()); + CHECK( + v8::Utils::OpenHandle(*check_setter->Run(env.local()).ToLocalChecked()) + ->IsJSGlobalProxy()); + } } diff --git a/deps/v8/test/cctest/test-allocation.cc b/deps/v8/test/cctest/test-allocation.cc index b1a3bef421..139829dd2b 100644 --- a/deps/v8/test/cctest/test-allocation.cc +++ b/deps/v8/test/cctest/test-allocation.cc @@ -4,6 +4,12 @@ #include <stdlib.h> #include <string.h> +#if V8_OS_POSIX +#include <setjmp.h> +#include <signal.h> +#include <unistd.h> // NOLINT +#endif + #include "src/v8.h" #include "test/cctest/cctest.h" @@ -35,6 +41,11 @@ class AllocationPlatform : public TestPlatform { void OnCriticalMemoryPressure() override { oom_callback_called = true; } + bool OnCriticalMemoryPressure(size_t length) override { + oom_callback_called = true; + return true; + } + static AllocationPlatform* current_platform; bool oom_callback_called = false; }; @@ -54,7 +65,7 @@ size_t GetHugeMemoryAmount() { static size_t huge_memory = 0; if (!huge_memory) { for (int i = 0; i < 100; i++) { - huge_memory |= bit_cast<size_t>(v8::base::OS::GetRandomMmapAddr()); + huge_memory |= bit_cast<size_t>(v8::internal::GetRandomMmapAddr()); } // Make it larger than the available address space. huge_memory *= 2; @@ -122,7 +133,7 @@ TEST(AlignedAllocOOM) { // On failure, this won't return, since an AlignedAlloc failure is fatal. // In that case, behavior is checked in OnAlignedAllocOOM before exit. void* result = v8::internal::AlignedAlloc(GetHugeMemoryAmount(), - v8::base::OS::AllocatePageSize()); + v8::internal::AllocatePageSize()); // On a few systems, allocation somehow succeeds. CHECK_EQ(result == nullptr, platform.oom_callback_called); } @@ -143,7 +154,7 @@ TEST(AlignedAllocVirtualMemoryOOM) { CHECK(!platform.oom_callback_called); v8::internal::VirtualMemory result; bool success = v8::internal::AlignedAllocVirtualMemory( - GetHugeMemoryAmount(), v8::base::OS::AllocatePageSize(), nullptr, + GetHugeMemoryAmount(), v8::internal::AllocatePageSize(), nullptr, &result); // On a few systems, allocation somehow succeeds. CHECK_IMPLIES(success, result.IsReserved()); diff --git a/deps/v8/test/cctest/test-api-interceptors.cc b/deps/v8/test/cctest/test-api-interceptors.cc index 63f3bc42fb..fd811abffe 100644 --- a/deps/v8/test/cctest/test-api-interceptors.cc +++ b/deps/v8/test/cctest/test-api-interceptors.cc @@ -98,10 +98,10 @@ void SymbolAccessorSetter(Local<Name> name, Local<Value> value, SimpleAccessorSetter(Local<String>::Cast(sym->Name()), value, info); } -void StringInterceptorGetter( - Local<String> name, - const v8::PropertyCallbackInfo<v8::Value>& - info) { // Intercept names that start with 'interceptor_'. +void InterceptorGetter(Local<Name> generic_name, + const v8::PropertyCallbackInfo<v8::Value>& info) { + if (generic_name->IsSymbol()) return; + Local<String> name = Local<String>::Cast(generic_name); String::Utf8Value utf8(info.GetIsolate(), name); char* name_str = *utf8; char prefix[] = "interceptor_"; @@ -117,9 +117,10 @@ void StringInterceptorGetter( .ToLocalChecked()); } - -void StringInterceptorSetter(Local<String> name, Local<Value> value, - const v8::PropertyCallbackInfo<v8::Value>& info) { +void InterceptorSetter(Local<Name> generic_name, Local<Value> value, + const v8::PropertyCallbackInfo<v8::Value>& info) { + if (generic_name->IsSymbol()) return; + Local<String> name = Local<String>::Cast(generic_name); // Intercept accesses that set certain integer values, for which the name does // not start with 'accessor_'. String::Utf8Value utf8(info.GetIsolate(), name); @@ -140,18 +141,6 @@ void StringInterceptorSetter(Local<String> name, Local<Value> value, } } -void InterceptorGetter(Local<Name> generic_name, - const v8::PropertyCallbackInfo<v8::Value>& info) { - if (generic_name->IsSymbol()) return; - StringInterceptorGetter(Local<String>::Cast(generic_name), info); -} - -void InterceptorSetter(Local<Name> generic_name, Local<Value> value, - const v8::PropertyCallbackInfo<v8::Value>& info) { - if (generic_name->IsSymbol()) return; - StringInterceptorSetter(Local<String>::Cast(generic_name), value, info); -} - void GenericInterceptorGetter(Local<Name> generic_name, const v8::PropertyCallbackInfo<v8::Value>& info) { Local<String> str; @@ -198,19 +187,20 @@ void AddAccessor(Local<FunctionTemplate> templ, Local<String> name, templ->PrototypeTemplate()->SetAccessor(name, getter, setter); } -void AddInterceptor(Local<FunctionTemplate> templ, - v8::NamedPropertyGetterCallback getter, - v8::NamedPropertySetterCallback setter) { - templ->InstanceTemplate()->SetNamedPropertyHandler(getter, setter); -} - - void AddAccessor(Local<FunctionTemplate> templ, Local<Name> name, v8::AccessorNameGetterCallback getter, v8::AccessorNameSetterCallback setter) { templ->PrototypeTemplate()->SetAccessor(name, getter, setter); } +void AddStringOnlyInterceptor(Local<FunctionTemplate> templ, + v8::GenericNamedPropertyGetterCallback getter, + v8::GenericNamedPropertySetterCallback setter) { + templ->InstanceTemplate()->SetHandler(v8::NamedPropertyHandlerConfiguration( + getter, setter, nullptr, nullptr, nullptr, Local<v8::Value>(), + v8::PropertyHandlerFlags::kOnlyInterceptStrings)); +} + void AddInterceptor(Local<FunctionTemplate> templ, v8::GenericNamedPropertyGetterCallback getter, v8::GenericNamedPropertySetterCallback setter) { @@ -1517,7 +1507,7 @@ THREADED_TEST(LegacyInterceptorDoesNotSeeSymbols) { child->Inherit(parent); AddAccessor(parent, age, SymbolAccessorGetter, SymbolAccessorSetter); - AddInterceptor(child, StringInterceptorGetter, StringInterceptorSetter); + AddStringOnlyInterceptor(child, InterceptorGetter, InterceptorSetter); env->Global() ->Set(env.local(), v8_str("Child"), @@ -4387,7 +4377,7 @@ THREADED_TEST(Regress625155) { CompileRun( "Number.prototype.__proto__ = new Bug;" "var x;" - "x = 0xdead;" + "x = 0xDEAD;" "x.boom = 0;" "x = 's';" "x.boom = 0;" diff --git a/deps/v8/test/cctest/test-api.cc b/deps/v8/test/cctest/test-api.cc index a12a00da35..73dc19aa66 100644 --- a/deps/v8/test/cctest/test-api.cc +++ b/deps/v8/test/cctest/test-api.cc @@ -1390,10 +1390,10 @@ THREADED_TEST(ExternalWrap) { expected_ptr = reinterpret_cast<void*>(1); TestExternalPointerWrapping(); - expected_ptr = reinterpret_cast<void*>(0xdeadbeef); + expected_ptr = reinterpret_cast<void*>(0xDEADBEEF); TestExternalPointerWrapping(); - expected_ptr = reinterpret_cast<void*>(0xdeadbeef + 1); + expected_ptr = reinterpret_cast<void*>(0xDEADBEEF + 1); TestExternalPointerWrapping(); #if defined(V8_HOST_ARCH_X64) @@ -1401,10 +1401,10 @@ THREADED_TEST(ExternalWrap) { expected_ptr = reinterpret_cast<void*>(0x400000000); TestExternalPointerWrapping(); - expected_ptr = reinterpret_cast<void*>(0xdeadbeefdeadbeef); + expected_ptr = reinterpret_cast<void*>(0xDEADBEEFDEADBEEF); TestExternalPointerWrapping(); - expected_ptr = reinterpret_cast<void*>(0xdeadbeefdeadbeef + 1); + expected_ptr = reinterpret_cast<void*>(0xDEADBEEFDEADBEEF + 1); TestExternalPointerWrapping(); #endif } @@ -7916,31 +7916,31 @@ THREADED_TEST(StringWrite) { v8::HandleScope scope(context->GetIsolate()); v8::Local<String> str = v8_str("abcde"); // abc<Icelandic eth><Unicode snowman>. - v8::Local<String> str2 = v8_str("abc\303\260\342\230\203"); + v8::Local<String> str2 = v8_str("abc\xC3\xB0\xE2\x98\x83"); v8::Local<String> str3 = v8::String::NewFromUtf8(context->GetIsolate(), "abc\0def", v8::NewStringType::kNormal, 7) .ToLocalChecked(); - // "ab" + lead surrogate + "cd" + trail surrogate + "ef" - uint16_t orphans[8] = { 0x61, 0x62, 0xd800, 0x63, 0x64, 0xdc00, 0x65, 0x66 }; + // "ab" + lead surrogate + "wx" + trail surrogate + "yz" + uint16_t orphans[8] = {0x61, 0x62, 0xD800, 0x77, 0x78, 0xDC00, 0x79, 0x7A}; v8::Local<String> orphans_str = v8::String::NewFromTwoByte(context->GetIsolate(), orphans, v8::NewStringType::kNormal, 8) .ToLocalChecked(); // single lead surrogate - uint16_t lead[1] = { 0xd800 }; + uint16_t lead[1] = {0xD800}; v8::Local<String> lead_str = v8::String::NewFromTwoByte(context->GetIsolate(), lead, v8::NewStringType::kNormal, 1) .ToLocalChecked(); // single trail surrogate - uint16_t trail[1] = { 0xdc00 }; + uint16_t trail[1] = {0xDC00}; v8::Local<String> trail_str = v8::String::NewFromTwoByte(context->GetIsolate(), trail, v8::NewStringType::kNormal, 1) .ToLocalChecked(); // surrogate pair - uint16_t pair[2] = { 0xd800, 0xdc00 }; + uint16_t pair[2] = {0xD800, 0xDC00}; v8::Local<String> pair_str = v8::String::NewFromTwoByte(context->GetIsolate(), pair, v8::NewStringType::kNormal, 2) @@ -7948,12 +7948,12 @@ THREADED_TEST(StringWrite) { const int kStride = 4; // Must match stride in for loops in JS below. CompileRun( "var left = '';" - "for (var i = 0; i < 0xd800; i += 4) {" + "for (var i = 0; i < 0xD800; i += 4) {" " left = left + String.fromCharCode(i);" "}"); CompileRun( "var right = '';" - "for (var i = 0; i < 0xd800; i += 4) {" + "for (var i = 0; i < 0xD800; i += 4) {" " right = String.fromCharCode(i) + right;" "}"); v8::Local<v8::Object> global = context->Global(); @@ -7965,11 +7965,11 @@ THREADED_TEST(StringWrite) { .As<String>(); CHECK_EQ(5, str2->Length()); - CHECK_EQ(0xd800 / kStride, left_tree->Length()); - CHECK_EQ(0xd800 / kStride, right_tree->Length()); + CHECK_EQ(0xD800 / kStride, left_tree->Length()); + CHECK_EQ(0xD800 / kStride, right_tree->Length()); char buf[100]; - char utf8buf[0xd800 * 3]; + char utf8buf[0xD800 * 3]; uint16_t wbuf[100]; int len; int charlen; @@ -7978,58 +7978,58 @@ THREADED_TEST(StringWrite) { len = str2->WriteUtf8(utf8buf, sizeof(utf8buf), &charlen); CHECK_EQ(9, len); CHECK_EQ(5, charlen); - CHECK_EQ(0, strcmp(utf8buf, "abc\303\260\342\230\203")); + CHECK_EQ(0, strcmp(utf8buf, "abc\xC3\xB0\xE2\x98\x83")); memset(utf8buf, 0x1, 1000); len = str2->WriteUtf8(utf8buf, 8, &charlen); CHECK_EQ(8, len); CHECK_EQ(5, charlen); - CHECK_EQ(0, strncmp(utf8buf, "abc\303\260\342\230\203\1", 9)); + CHECK_EQ(0, strncmp(utf8buf, "abc\xC3\xB0\xE2\x98\x83\x01", 9)); memset(utf8buf, 0x1, 1000); len = str2->WriteUtf8(utf8buf, 7, &charlen); CHECK_EQ(5, len); CHECK_EQ(4, charlen); - CHECK_EQ(0, strncmp(utf8buf, "abc\303\260\1", 5)); + CHECK_EQ(0, strncmp(utf8buf, "abc\xC3\xB0\x01", 5)); memset(utf8buf, 0x1, 1000); len = str2->WriteUtf8(utf8buf, 6, &charlen); CHECK_EQ(5, len); CHECK_EQ(4, charlen); - CHECK_EQ(0, strncmp(utf8buf, "abc\303\260\1", 5)); + CHECK_EQ(0, strncmp(utf8buf, "abc\xC3\xB0\x01", 5)); memset(utf8buf, 0x1, 1000); len = str2->WriteUtf8(utf8buf, 5, &charlen); CHECK_EQ(5, len); CHECK_EQ(4, charlen); - CHECK_EQ(0, strncmp(utf8buf, "abc\303\260\1", 5)); + CHECK_EQ(0, strncmp(utf8buf, "abc\xC3\xB0\x01", 5)); memset(utf8buf, 0x1, 1000); len = str2->WriteUtf8(utf8buf, 4, &charlen); CHECK_EQ(3, len); CHECK_EQ(3, charlen); - CHECK_EQ(0, strncmp(utf8buf, "abc\1", 4)); + CHECK_EQ(0, strncmp(utf8buf, "abc\x01", 4)); memset(utf8buf, 0x1, 1000); len = str2->WriteUtf8(utf8buf, 3, &charlen); CHECK_EQ(3, len); CHECK_EQ(3, charlen); - CHECK_EQ(0, strncmp(utf8buf, "abc\1", 4)); + CHECK_EQ(0, strncmp(utf8buf, "abc\x01", 4)); memset(utf8buf, 0x1, 1000); len = str2->WriteUtf8(utf8buf, 2, &charlen); CHECK_EQ(2, len); CHECK_EQ(2, charlen); - CHECK_EQ(0, strncmp(utf8buf, "ab\1", 3)); + CHECK_EQ(0, strncmp(utf8buf, "ab\x01", 3)); // allow orphan surrogates by default memset(utf8buf, 0x1, 1000); len = orphans_str->WriteUtf8(utf8buf, sizeof(utf8buf), &charlen); CHECK_EQ(13, len); CHECK_EQ(8, charlen); - CHECK_EQ(0, strcmp(utf8buf, "ab\355\240\200cd\355\260\200ef")); + CHECK_EQ(0, strcmp(utf8buf, "ab\xED\xA0\x80wx\xED\xB0\x80yz")); - // replace orphan surrogates with unicode replacement character + // replace orphan surrogates with Unicode replacement character memset(utf8buf, 0x1, 1000); len = orphans_str->WriteUtf8(utf8buf, sizeof(utf8buf), @@ -8037,9 +8037,9 @@ THREADED_TEST(StringWrite) { String::REPLACE_INVALID_UTF8); CHECK_EQ(13, len); CHECK_EQ(8, charlen); - CHECK_EQ(0, strcmp(utf8buf, "ab\357\277\275cd\357\277\275ef")); + CHECK_EQ(0, strcmp(utf8buf, "ab\xEF\xBF\xBDwx\xEF\xBF\xBDyz")); - // replace single lead surrogate with unicode replacement character + // replace single lead surrogate with Unicode replacement character memset(utf8buf, 0x1, 1000); len = lead_str->WriteUtf8(utf8buf, sizeof(utf8buf), @@ -8047,9 +8047,9 @@ THREADED_TEST(StringWrite) { String::REPLACE_INVALID_UTF8); CHECK_EQ(4, len); CHECK_EQ(1, charlen); - CHECK_EQ(0, strcmp(utf8buf, "\357\277\275")); + CHECK_EQ(0, strcmp(utf8buf, "\xEF\xBF\xBD")); - // replace single trail surrogate with unicode replacement character + // replace single trail surrogate with Unicode replacement character memset(utf8buf, 0x1, 1000); len = trail_str->WriteUtf8(utf8buf, sizeof(utf8buf), @@ -8057,7 +8057,7 @@ THREADED_TEST(StringWrite) { String::REPLACE_INVALID_UTF8); CHECK_EQ(4, len); CHECK_EQ(1, charlen); - CHECK_EQ(0, strcmp(utf8buf, "\357\277\275")); + CHECK_EQ(0, strcmp(utf8buf, "\xEF\xBF\xBD")); // do not replace / write anything if surrogate pair does not fit the buffer // space @@ -8072,14 +8072,14 @@ THREADED_TEST(StringWrite) { memset(utf8buf, 0x1, sizeof(utf8buf)); len = GetUtf8Length(left_tree); int utf8_expected = - (0x80 + (0x800 - 0x80) * 2 + (0xd800 - 0x800) * 3) / kStride; + (0x80 + (0x800 - 0x80) * 2 + (0xD800 - 0x800) * 3) / kStride; CHECK_EQ(utf8_expected, len); len = left_tree->WriteUtf8(utf8buf, utf8_expected, &charlen); CHECK_EQ(utf8_expected, len); - CHECK_EQ(0xd800 / kStride, charlen); - CHECK_EQ(0xed, static_cast<unsigned char>(utf8buf[utf8_expected - 3])); - CHECK_EQ(0x9f, static_cast<unsigned char>(utf8buf[utf8_expected - 2])); - CHECK_EQ(0xc0 - kStride, + CHECK_EQ(0xD800 / kStride, charlen); + CHECK_EQ(0xED, static_cast<unsigned char>(utf8buf[utf8_expected - 3])); + CHECK_EQ(0x9F, static_cast<unsigned char>(utf8buf[utf8_expected - 2])); + CHECK_EQ(0xC0 - kStride, static_cast<unsigned char>(utf8buf[utf8_expected - 1])); CHECK_EQ(1, utf8buf[utf8_expected]); @@ -8088,10 +8088,10 @@ THREADED_TEST(StringWrite) { CHECK_EQ(utf8_expected, len); len = right_tree->WriteUtf8(utf8buf, utf8_expected, &charlen); CHECK_EQ(utf8_expected, len); - CHECK_EQ(0xd800 / kStride, charlen); - CHECK_EQ(0xed, static_cast<unsigned char>(utf8buf[0])); - CHECK_EQ(0x9f, static_cast<unsigned char>(utf8buf[1])); - CHECK_EQ(0xc0 - kStride, static_cast<unsigned char>(utf8buf[2])); + CHECK_EQ(0xD800 / kStride, charlen); + CHECK_EQ(0xED, static_cast<unsigned char>(utf8buf[0])); + CHECK_EQ(0x9F, static_cast<unsigned char>(utf8buf[1])); + CHECK_EQ(0xC0 - kStride, static_cast<unsigned char>(utf8buf[2])); CHECK_EQ(1, utf8buf[utf8_expected]); memset(buf, 0x1, sizeof(buf)); @@ -8110,7 +8110,7 @@ THREADED_TEST(StringWrite) { CHECK_EQ(4, len); len = str->Write(wbuf, 0, 4); CHECK_EQ(4, len); - CHECK_EQ(0, strncmp("abcd\1", buf, 5)); + CHECK_EQ(0, strncmp("abcd\x01", buf, 5)); uint16_t answer2[] = {'a', 'b', 'c', 'd', 0x101}; CHECK_EQ(0, StrNCmp16(answer2, wbuf, 5)); @@ -8120,7 +8120,7 @@ THREADED_TEST(StringWrite) { CHECK_EQ(5, len); len = str->Write(wbuf, 0, 5); CHECK_EQ(5, len); - CHECK_EQ(0, strncmp("abcde\1", buf, 6)); + CHECK_EQ(0, strncmp("abcde\x01", buf, 6)); uint16_t answer3[] = {'a', 'b', 'c', 'd', 'e', 0x101}; CHECK_EQ(0, StrNCmp16(answer3, wbuf, 6)); @@ -8159,7 +8159,7 @@ THREADED_TEST(StringWrite) { CHECK_EQ(1, len); len = str->Write(wbuf, 4, 1); CHECK_EQ(1, len); - CHECK_EQ(0, strncmp("e\1", buf, 2)); + CHECK_EQ(0, strncmp("e\x01", buf, 2)); uint16_t answer6[] = {'e', 0x101}; CHECK_EQ(0, StrNCmp16(answer6, wbuf, 2)); @@ -8169,7 +8169,7 @@ THREADED_TEST(StringWrite) { CHECK_EQ(1, len); len = str->Write(wbuf, 3, 1); CHECK_EQ(1, len); - CHECK_EQ(0, strncmp("d\1", buf, 2)); + CHECK_EQ(0, strncmp("d\x01", buf, 2)); uint16_t answer7[] = {'d', 0x101}; CHECK_EQ(0, StrNCmp16(answer7, wbuf, 2)); @@ -8205,10 +8205,10 @@ THREADED_TEST(StringWrite) { CHECK_EQ(8, len); CHECK_EQ('X', utf8buf[8]); CHECK_EQ(5, charlen); - CHECK_EQ(0, strncmp(utf8buf, "abc\303\260\342\230\203", 8)); - CHECK_NE(0, strcmp(utf8buf, "abc\303\260\342\230\203")); + CHECK_EQ(0, strncmp(utf8buf, "abc\xC3\xB0\xE2\x98\x83", 8)); + CHECK_NE(0, strcmp(utf8buf, "abc\xC3\xB0\xE2\x98\x83")); utf8buf[8] = '\0'; - CHECK_EQ(0, strcmp(utf8buf, "abc\303\260\342\230\203")); + CHECK_EQ(0, strcmp(utf8buf, "abc\xC3\xB0\xE2\x98\x83")); memset(utf8buf, 0x1, sizeof(utf8buf)); utf8buf[5] = 'X'; @@ -8300,16 +8300,16 @@ THREADED_TEST(OverlongSequencesAndSurrogates) { "X\xf4\x90\x80Y\0", }; const std::vector<std::vector<uint16_t>> unicode_expected = { - {0x58, 0xfffd, 0xfffd, 0x59}, - {0x58, 0xfffd, 0xfffd, 0x59}, - {0x58, 0xfffd, 0xfffd, 0xfffd, 0x59}, - {0x58, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0x59}, - {0x58, 0xfffd, 0xfffd, 0xfffd, 0x59}, - {0x58, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0x59}, - {0x58, 0xfffd, 0xfffd, 0x59}, - {0x58, 0xfffd, 0xfffd, 0xfffd, 0x59}, - {0x58, 0xfffd, 0xfffd, 0x59}, - {0x58, 0xfffd, 0xfffd, 0xfffd, 0x59}, + {0x58, 0xFFFD, 0xFFFD, 0x59}, + {0x58, 0xFFFD, 0xFFFD, 0x59}, + {0x58, 0xFFFD, 0xFFFD, 0xFFFD, 0x59}, + {0x58, 0xFFFD, 0xFFFD, 0xFFFD, 0xFFFD, 0x59}, + {0x58, 0xFFFD, 0xFFFD, 0xFFFD, 0x59}, + {0x58, 0xFFFD, 0xFFFD, 0xFFFD, 0xFFFD, 0x59}, + {0x58, 0xFFFD, 0xFFFD, 0x59}, + {0x58, 0xFFFD, 0xFFFD, 0xFFFD, 0x59}, + {0x58, 0xFFFD, 0xFFFD, 0x59}, + {0x58, 0xFFFD, 0xFFFD, 0xFFFD, 0x59}, }; CHECK_EQ(unicode_expected.size(), arraysize(cases)); TestUtf8DecodingAgainstReference(cases, unicode_expected); @@ -8323,10 +8323,10 @@ THREADED_TEST(Utf16) { "var p = [];" "var plens = [20, 3, 3];" "p.push('01234567890123456789');" - "var lead = 0xd800;" - "var trail = 0xdc00;" - "p.push(String.fromCharCode(0xd800));" - "p.push(String.fromCharCode(0xdc00));" + "var lead = 0xD800;" + "var trail = 0xDC00;" + "p.push(String.fromCharCode(0xD800));" + "p.push(String.fromCharCode(0xDC00));" "var a = [];" "var b = [];" "var c = [];" @@ -8353,8 +8353,9 @@ THREADED_TEST(Utf16) { " var newc = 'x' + c[m] + c[n] + 'y';" " c2.push(newc.substring(1, newc.length - 1));" " var utf = alens[m] + alens[n];" // And here. - // The 'n's that start with 0xdc.. are 6-8 - // The 'm's that end with 0xd8.. are 1, 4 and 7 + // The 'n's that start with 0xDC.. + // are 6-8 The 'm's that end with + // 0xD8.. are 1, 4 and 7 " if ((m % 3) == 1 && n >= 6) utf -= 2;" " a2lens.push(utf);" " }" @@ -8387,41 +8388,41 @@ THREADED_TEST(Utf16Symbol) { CompileRun( "var sym0 = 'benedictus';" - "var sym0b = 'S\303\270ren';" - "var sym1 = '\355\240\201\355\260\207';" - "var sym2 = '\360\220\220\210';" - "var sym3 = 'x\355\240\201\355\260\207';" - "var sym4 = 'x\360\220\220\210';" + "var sym0b = 'S\xC3\xB8ren';" + "var sym1 = '\xED\xA0\x81\xED\xB0\x87';" + "var sym2 = '\xF0\x90\x90\x88';" + "var sym3 = 'x\xED\xA0\x81\xED\xB0\x87';" + "var sym4 = 'x\xF0\x90\x90\x88';" "if (sym1.length != 2) throw sym1;" - "if (sym1.charCodeAt(1) != 0xdc07) throw sym1.charCodeAt(1);" + "if (sym1.charCodeAt(1) != 0xDC07) throw sym1.charCodeAt(1);" "if (sym2.length != 2) throw sym2;" - "if (sym2.charCodeAt(1) != 0xdc08) throw sym2.charCodeAt(2);" + "if (sym2.charCodeAt(1) != 0xDC08) throw sym2.charCodeAt(2);" "if (sym3.length != 3) throw sym3;" - "if (sym3.charCodeAt(2) != 0xdc07) throw sym1.charCodeAt(2);" + "if (sym3.charCodeAt(2) != 0xDC07) throw sym1.charCodeAt(2);" "if (sym4.length != 3) throw sym4;" - "if (sym4.charCodeAt(2) != 0xdc08) throw sym2.charCodeAt(2);"); + "if (sym4.charCodeAt(2) != 0xDC08) throw sym2.charCodeAt(2);"); Local<String> sym0 = v8::String::NewFromUtf8(context->GetIsolate(), "benedictus", v8::NewStringType::kInternalized) .ToLocalChecked(); Local<String> sym0b = - v8::String::NewFromUtf8(context->GetIsolate(), "S\303\270ren", + v8::String::NewFromUtf8(context->GetIsolate(), "S\xC3\xB8ren", v8::NewStringType::kInternalized) .ToLocalChecked(); Local<String> sym1 = - v8::String::NewFromUtf8(context->GetIsolate(), "\355\240\201\355\260\207", + v8::String::NewFromUtf8(context->GetIsolate(), "\xED\xA0\x81\xED\xB0\x87", v8::NewStringType::kInternalized) .ToLocalChecked(); Local<String> sym2 = - v8::String::NewFromUtf8(context->GetIsolate(), "\360\220\220\210", + v8::String::NewFromUtf8(context->GetIsolate(), "\xF0\x90\x90\x88", v8::NewStringType::kInternalized) .ToLocalChecked(); Local<String> sym3 = v8::String::NewFromUtf8(context->GetIsolate(), - "x\355\240\201\355\260\207", + "x\xED\xA0\x81\xED\xB0\x87", v8::NewStringType::kInternalized) .ToLocalChecked(); Local<String> sym4 = - v8::String::NewFromUtf8(context->GetIsolate(), "x\360\220\220\210", + v8::String::NewFromUtf8(context->GetIsolate(), "x\xF0\x90\x90\x88", v8::NewStringType::kInternalized) .ToLocalChecked(); v8::Local<v8::Object> global = context->Global(); @@ -8454,10 +8455,10 @@ THREADED_TEST(Utf16MissingTrailing) { int size = 1024 * 64; uint8_t* buffer = new uint8_t[size]; for (int i = 0; i < size; i += 4) { - buffer[i] = 0xf0; - buffer[i + 1] = 0x9d; + buffer[i] = 0xF0; + buffer[i + 1] = 0x9D; buffer[i + 2] = 0x80; - buffer[i + 3] = 0x9e; + buffer[i + 3] = 0x9E; } // Now invoke the decoder without last 3 bytes @@ -8479,9 +8480,9 @@ THREADED_TEST(Utf16Trailing3Byte) { int size = 1024 * 63; uint8_t* buffer = new uint8_t[size]; for (int i = 0; i < size; i += 3) { - buffer[i] = 0xe2; + buffer[i] = 0xE2; buffer[i + 1] = 0x80; - buffer[i + 2] = 0xa6; + buffer[i + 2] = 0xA6; } // Now invoke the decoder without last 3 bytes @@ -9620,20 +9621,20 @@ static void EchoSetter(Local<String> name, Local<Value> value, static void UnreachableGetter( Local<String> name, const v8::PropertyCallbackInfo<v8::Value>& info) { - CHECK(false); // This function should not be called.. + UNREACHABLE(); // This function should not be called.. } static void UnreachableSetter(Local<String>, Local<Value>, const v8::PropertyCallbackInfo<void>&) { - CHECK(false); // This function should not be called. + UNREACHABLE(); // This function should not be called. } static void UnreachableFunction( const v8::FunctionCallbackInfo<v8::Value>& info) { - CHECK(false); // This function should not be called.. + UNREACHABLE(); // This function should not be called.. } @@ -14462,8 +14463,7 @@ static void event_handler(const v8::JitCodeEvent* event) { case v8::JitCodeEvent::CODE_REMOVED: // Object/code removal events are currently not dispatched from the GC. - CHECK(false); - break; + UNREACHABLE(); // For CODE_START_LINE_INFO_RECORDING event, we will create one // DummyJitCodeLineInfo data structure pointed by event->user_dat. We @@ -14501,8 +14501,7 @@ static void event_handler(const v8::JitCodeEvent* event) { default: // Impossible event. - CHECK(false); - break; + UNREACHABLE(); } } @@ -18466,7 +18465,6 @@ TEST(SetStackLimitInThread) { } } - THREADED_TEST(GetHeapStatistics) { LocalContext c1; v8::HandleScope scope(c1->GetIsolate()); @@ -18478,6 +18476,55 @@ THREADED_TEST(GetHeapStatistics) { CHECK_NE(static_cast<int>(heap_statistics.used_heap_size()), 0); } +TEST(NumberOfNativeContexts) { + static const size_t kNumTestContexts = 10; + i::Isolate* isolate = CcTest::i_isolate(); + i::HandleScope scope(isolate); + v8::Global<v8::Context> context[kNumTestContexts]; + v8::HeapStatistics heap_statistics; + CHECK_EQ(0u, heap_statistics.number_of_native_contexts()); + CcTest::isolate()->GetHeapStatistics(&heap_statistics); + CHECK_EQ(0u, heap_statistics.number_of_native_contexts()); + for (size_t i = 0; i < kNumTestContexts; i++) { + i::HandleScope inner(isolate); + context[i].Reset(CcTest::isolate(), v8::Context::New(CcTest::isolate())); + CcTest::isolate()->GetHeapStatistics(&heap_statistics); + CHECK_EQ(i + 1, heap_statistics.number_of_native_contexts()); + } + for (size_t i = 0; i < kNumTestContexts; i++) { + context[i].Reset(); + CcTest::CollectAllGarbage(i::Heap::kAbortIncrementalMarkingMask); + CcTest::isolate()->GetHeapStatistics(&heap_statistics); + CHECK_EQ(kNumTestContexts - i - 1u, + heap_statistics.number_of_native_contexts()); + } +} + +TEST(NumberOfDetachedContexts) { + static const size_t kNumTestContexts = 10; + i::Isolate* isolate = CcTest::i_isolate(); + i::HandleScope scope(isolate); + v8::Global<v8::Context> context[kNumTestContexts]; + v8::HeapStatistics heap_statistics; + CHECK_EQ(0u, heap_statistics.number_of_detached_contexts()); + CcTest::isolate()->GetHeapStatistics(&heap_statistics); + CHECK_EQ(0u, heap_statistics.number_of_detached_contexts()); + for (size_t i = 0; i < kNumTestContexts; i++) { + i::HandleScope inner(isolate); + v8::Local<v8::Context> local = v8::Context::New(CcTest::isolate()); + context[i].Reset(CcTest::isolate(), local); + local->DetachGlobal(); + CcTest::isolate()->GetHeapStatistics(&heap_statistics); + CHECK_EQ(i + 1, heap_statistics.number_of_detached_contexts()); + } + for (size_t i = 0; i < kNumTestContexts; i++) { + context[i].Reset(); + CcTest::CollectAllGarbage(i::Heap::kAbortIncrementalMarkingMask); + CcTest::isolate()->GetHeapStatistics(&heap_statistics); + CHECK_EQ(kNumTestContexts - i - 1u, + heap_statistics.number_of_detached_contexts()); + } +} class VisitorImpl : public v8::ExternalResourceVisitor { public: @@ -18723,12 +18770,12 @@ THREADED_TEST(QuietSignalingNaNs) { v8::TryCatch try_catch(isolate); // Special double values. - double snan = DoubleFromBits(0x7ff00000, 0x00000001); - double qnan = DoubleFromBits(0x7ff80000, 0x00000000); - double infinity = DoubleFromBits(0x7ff00000, 0x00000000); - double max_normal = DoubleFromBits(0x7fefffff, 0xffffffffu); + double snan = DoubleFromBits(0x7FF00000, 0x00000001); + double qnan = DoubleFromBits(0x7FF80000, 0x00000000); + double infinity = DoubleFromBits(0x7FF00000, 0x00000000); + double max_normal = DoubleFromBits(0x7FEFFFFF, 0xFFFFFFFFu); double min_normal = DoubleFromBits(0x00100000, 0x00000000); - double max_denormal = DoubleFromBits(0x000fffff, 0xffffffffu); + double max_denormal = DoubleFromBits(0x000FFFFF, 0xFFFFFFFFu); double min_denormal = DoubleFromBits(0x00000000, 0x00000001); // Date values are capped at +/-100000000 days (times 864e5 ms per day) @@ -18775,9 +18822,9 @@ THREADED_TEST(QuietSignalingNaNs) { !defined(USE_SIMULATOR) // Most significant fraction bit for quiet nan is set to 0 // on MIPS architecture. Allowed by IEEE-754. - CHECK_EQ(0xffe, static_cast<int>((stored_bits >> 51) & 0xfff)); + CHECK_EQ(0xFFE, static_cast<int>((stored_bits >> 51) & 0xFFF)); #else - CHECK_EQ(0xfff, static_cast<int>((stored_bits >> 51) & 0xfff)); + CHECK_EQ(0xFFF, static_cast<int>((stored_bits >> 51) & 0xFFF)); #endif } @@ -18797,9 +18844,9 @@ THREADED_TEST(QuietSignalingNaNs) { !defined(USE_SIMULATOR) // Most significant fraction bit for quiet nan is set to 0 // on MIPS architecture. Allowed by IEEE-754. - CHECK_EQ(0xffe, static_cast<int>((stored_bits >> 51) & 0xfff)); + CHECK_EQ(0xFFE, static_cast<int>((stored_bits >> 51) & 0xFFF)); #else - CHECK_EQ(0xfff, static_cast<int>((stored_bits >> 51) & 0xfff)); + CHECK_EQ(0xFFF, static_cast<int>((stored_bits >> 51) & 0xFFF)); #endif } } @@ -22172,20 +22219,20 @@ UNINITIALIZED_TEST(IsolateEmbedderData) { CHECK(!i_isolate->GetData(slot)); } for (uint32_t slot = 0; slot < v8::Isolate::GetNumberOfDataSlots(); ++slot) { - void* data = reinterpret_cast<void*>(0xacce55ed + slot); + void* data = reinterpret_cast<void*>(0xACCE55ED + slot); isolate->SetData(slot, data); } for (uint32_t slot = 0; slot < v8::Isolate::GetNumberOfDataSlots(); ++slot) { - void* data = reinterpret_cast<void*>(0xacce55ed + slot); + void* data = reinterpret_cast<void*>(0xACCE55ED + slot); CHECK_EQ(data, isolate->GetData(slot)); CHECK_EQ(data, i_isolate->GetData(slot)); } for (uint32_t slot = 0; slot < v8::Isolate::GetNumberOfDataSlots(); ++slot) { - void* data = reinterpret_cast<void*>(0xdecea5ed + slot); + void* data = reinterpret_cast<void*>(0xDECEA5ED + slot); isolate->SetData(slot, data); } for (uint32_t slot = 0; slot < v8::Isolate::GetNumberOfDataSlots(); ++slot) { - void* data = reinterpret_cast<void*>(0xdecea5ed + slot); + void* data = reinterpret_cast<void*>(0xDECEA5ED + slot); CHECK_EQ(data, isolate->GetData(slot)); CHECK_EQ(data, i_isolate->GetData(slot)); } @@ -22316,16 +22363,13 @@ THREADED_TEST(InstanceCheckOnInstanceAccessor) { CheckInstanceCheckedAccessors(false); } - static void EmptyInterceptorGetter( - Local<String> name, const v8::PropertyCallbackInfo<v8::Value>& info) {} - + Local<Name> name, const v8::PropertyCallbackInfo<v8::Value>& info) {} static void EmptyInterceptorSetter( - Local<String> name, Local<Value> value, + Local<Name> name, Local<Value> value, const v8::PropertyCallbackInfo<v8::Value>& info) {} - THREADED_TEST(InstanceCheckOnInstanceAccessorWithInterceptor) { v8::internal::FLAG_allow_natives_syntax = true; LocalContext context; @@ -22333,8 +22377,8 @@ THREADED_TEST(InstanceCheckOnInstanceAccessorWithInterceptor) { Local<FunctionTemplate> templ = FunctionTemplate::New(context->GetIsolate()); Local<ObjectTemplate> inst = templ->InstanceTemplate(); - templ->InstanceTemplate()->SetNamedPropertyHandler(EmptyInterceptorGetter, - EmptyInterceptorSetter); + templ->InstanceTemplate()->SetHandler(v8::NamedPropertyHandlerConfiguration( + EmptyInterceptorGetter, EmptyInterceptorSetter)); inst->SetAccessor(v8_str("foo"), InstanceCheckedGetter, InstanceCheckedSetter, Local<Value>(), v8::DEFAULT, v8::None, v8::AccessorSignature::New(context->GetIsolate(), templ)); @@ -22835,7 +22879,7 @@ THREADED_TEST(SemaphoreInterruption) { void UnreachableCallback(const v8::FunctionCallbackInfo<v8::Value>& args) { - CHECK(false); + UNREACHABLE(); } @@ -26412,7 +26456,7 @@ TEST(Proxy) { CHECK(proxy->IsProxy()); CHECK(!target->IsProxy()); CHECK(proxy->IsRevoked()); - CHECK(proxy->GetTarget()->SameValue(target)); + CHECK(proxy->GetTarget()->IsNull()); CHECK(proxy->GetHandler()->IsNull()); } diff --git a/deps/v8/test/cctest/test-assembler-arm.cc b/deps/v8/test/cctest/test-assembler-arm.cc index 169f927f74..10a111c8df 100644 --- a/deps/v8/test/cctest/test-assembler-arm.cc +++ b/deps/v8/test/cctest/test-assembler-arm.cc @@ -27,7 +27,6 @@ #include <iostream> // NOLINT(readability/streams) -#include "src/arm/simulator-arm.h" #include "src/assembler-inl.h" #include "src/base/utils/random-number-generator.h" #include "src/disassembler.h" @@ -35,6 +34,7 @@ #include "src/factory.h" #include "src/macro-assembler.h" #include "src/ostreams.h" +#include "src/simulator.h" #include "src/v8.h" #include "test/cctest/assembler-helper-arm.h" #include "test/cctest/cctest.h" @@ -66,9 +66,8 @@ TEST(0) { OFStream os(stdout); code->Print(os); #endif - F_iiiii f = FUNCTION_CAST<F_iiiii>(code->entry()); - int res = - reinterpret_cast<int>(CALL_GENERATED_CODE(isolate, f, 3, 4, 0, 0, 0)); + auto f = GeneratedCode<F_iiiii>::FromCode(*code); + int res = reinterpret_cast<int>(f.Call(3, 4, 0, 0, 0)); ::printf("f() = %d\n", res); CHECK_EQ(7, res); } @@ -103,9 +102,8 @@ TEST(1) { OFStream os(stdout); code->Print(os); #endif - F_iiiii f = FUNCTION_CAST<F_iiiii>(code->entry()); - int res = - reinterpret_cast<int>(CALL_GENERATED_CODE(isolate, f, 100, 0, 0, 0, 0)); + auto f = GeneratedCode<F_iiiii>::FromCode(*code); + int res = reinterpret_cast<int>(f.Call(100, 0, 0, 0, 0)); ::printf("f() = %d\n", res); CHECK_EQ(5050, res); } @@ -149,9 +147,8 @@ TEST(2) { OFStream os(stdout); code->Print(os); #endif - F_iiiii f = FUNCTION_CAST<F_iiiii>(code->entry()); - int res = - reinterpret_cast<int>(CALL_GENERATED_CODE(isolate, f, 10, 0, 0, 0, 0)); + auto f = GeneratedCode<F_iiiii>::FromCode(*code); + int res = reinterpret_cast<int>(f.Call(10, 0, 0, 0, 0)); ::printf("f() = %d\n", res); CHECK_EQ(3628800, res); } @@ -197,12 +194,11 @@ TEST(3) { OFStream os(stdout); code->Print(os); #endif - F_piiii f = FUNCTION_CAST<F_piiii>(code->entry()); + auto f = GeneratedCode<F_piiii>::FromCode(*code); t.i = 100000; t.c = 10; t.s = 1000; - int res = - reinterpret_cast<int>(CALL_GENERATED_CODE(isolate, f, &t, 0, 0, 0, 0)); + int res = reinterpret_cast<int>(f.Call(&t, 0, 0, 0, 0)); ::printf("f() = %d\n", res); CHECK_EQ(101010, res); CHECK_EQ(100000/2, t.i); @@ -276,7 +272,7 @@ TEST(4) { __ vstr(d4, r4, offsetof(T, e)); // Move a literal into a register that requires 64 bits to encode. - // 0x3ff0000010000000 = 1.000000059604644775390625 + // 0x3FF0000010000000 = 1.000000059604644775390625 __ vmov(d4, Double(1.000000059604644775390625)); __ vstr(d4, r4, offsetof(T, d)); @@ -329,7 +325,7 @@ TEST(4) { OFStream os(stdout); code->Print(os); #endif - F_piiii f = FUNCTION_CAST<F_piiii>(code->entry()); + auto f = GeneratedCode<F_piiii>::FromCode(*code); t.a = 1.5; t.b = 2.75; t.c = 17.17; @@ -344,8 +340,7 @@ TEST(4) { t.n = 123.456; t.x = 4.5; t.y = 9.0; - Object* dummy = CALL_GENERATED_CODE(isolate, f, &t, 0, 0, 0, 0); - USE(dummy); + f.Call(&t, 0, 0, 0, 0); CHECK_EQ(-16.0f, t.p); CHECK_EQ(0.25f, t.o); CHECK_EQ(-123.456, t.n); @@ -392,9 +387,8 @@ TEST(5) { OFStream os(stdout); code->Print(os); #endif - F_iiiii f = FUNCTION_CAST<F_iiiii>(code->entry()); - int res = reinterpret_cast<int>( - CALL_GENERATED_CODE(isolate, f, 0xAAAAAAAA, 0, 0, 0, 0)); + auto f = GeneratedCode<F_iiiii>::FromCode(*code); + int res = reinterpret_cast<int>(f.Call(0xAAAAAAAA, 0, 0, 0, 0)); ::printf("f() = %d\n", res); CHECK_EQ(-7, res); } @@ -424,9 +418,8 @@ TEST(6) { OFStream os(stdout); code->Print(os); #endif - F_iiiii f = FUNCTION_CAST<F_iiiii>(code->entry()); - int res = reinterpret_cast<int>( - CALL_GENERATED_CODE(isolate, f, 0xFFFF, 0, 0, 0, 0)); + auto f = GeneratedCode<F_iiiii>::FromCode(*code); + int res = reinterpret_cast<int>(f.Call(0xFFFF, 0, 0, 0, 0)); ::printf("f() = %d\n", res); CHECK_EQ(382, res); } @@ -493,9 +486,8 @@ static void TestRoundingMode(VCVTTypes types, OFStream os(stdout); code->Print(os); #endif - F_iiiii f = FUNCTION_CAST<F_iiiii>(code->entry()); - int res = - reinterpret_cast<int>(CALL_GENERATED_CODE(isolate, f, 0, 0, 0, 0, 0)); + auto f = GeneratedCode<F_iiiii>::FromCode(*code); + int res = reinterpret_cast<int>(f.Call(0, 0, 0, 0, 0)); ::printf("res = %d\n", res); CHECK_EQ(expected, res); } @@ -573,8 +565,8 @@ TEST(7) { TestRoundingMode(u32_f64, RZ, kMinInt - 1.0, 0, true); // Positive values. - // kMaxInt is the maximum *signed* integer: 0x7fffffff. - static const uint32_t kMaxUInt = 0xffffffffu; + // kMaxInt is the maximum *signed* integer: 0x7FFFFFFF. + static const uint32_t kMaxUInt = 0xFFFFFFFFu; TestRoundingMode(u32_f64, RZ, 0, 0); TestRoundingMode(u32_f64, RZ, 0.5, 0); TestRoundingMode(u32_f64, RZ, 123.7, 123); @@ -676,7 +668,7 @@ TEST(8) { OFStream os(stdout); code->Print(os); #endif - F_ppiii fn = FUNCTION_CAST<F_ppiii>(code->entry()); + auto fn = GeneratedCode<F_ppiii>::FromCode(*code); d.a = 1.1; d.b = 2.2; d.c = 3.3; @@ -695,8 +687,7 @@ TEST(8) { f.g = 7.0; f.h = 8.0; - Object* dummy = CALL_GENERATED_CODE(isolate, fn, &d, &f, 0, 0, 0); - USE(dummy); + fn.Call(&d, &f, 0, 0, 0); CHECK_EQ(7.7, d.a); CHECK_EQ(8.8, d.b); @@ -786,7 +777,7 @@ TEST(9) { OFStream os(stdout); code->Print(os); #endif - F_ppiii fn = FUNCTION_CAST<F_ppiii>(code->entry()); + auto fn = GeneratedCode<F_ppiii>::FromCode(*code); d.a = 1.1; d.b = 2.2; d.c = 3.3; @@ -805,8 +796,7 @@ TEST(9) { f.g = 7.0; f.h = 8.0; - Object* dummy = CALL_GENERATED_CODE(isolate, fn, &d, &f, 0, 0, 0); - USE(dummy); + fn.Call(&d, &f, 0, 0, 0); CHECK_EQ(7.7, d.a); CHECK_EQ(8.8, d.b); @@ -892,7 +882,7 @@ TEST(10) { OFStream os(stdout); code->Print(os); #endif - F_ppiii fn = FUNCTION_CAST<F_ppiii>(code->entry()); + auto fn = GeneratedCode<F_ppiii>::FromCode(*code); d.a = 1.1; d.b = 2.2; d.c = 3.3; @@ -911,8 +901,7 @@ TEST(10) { f.g = 7.0; f.h = 8.0; - Object* dummy = CALL_GENERATED_CODE(isolate, fn, &d, &f, 0, 0, 0); - USE(dummy); + fn.Call(&d, &f, 0, 0, 0); CHECK_EQ(7.7, d.a); CHECK_EQ(8.8, d.b); @@ -948,8 +937,8 @@ TEST(11) { } I; I i; - i.a = 0xabcd0001; - i.b = 0xabcd0000; + i.a = 0xABCD0001; + i.b = 0xABCD0000; Assembler assm(isolate, nullptr, 0); @@ -965,13 +954,13 @@ TEST(11) { __ str(r2, MemOperand(r0, offsetof(I, b))); // Test corner cases. - __ mov(r1, Operand(0xffffffff)); + __ mov(r1, Operand(0xFFFFFFFF)); __ mov(r2, Operand::Zero()); __ mov(r3, Operand(r1, ASR, 1), SetCC); // Set the carry. __ adc(r3, r1, Operand(r2)); __ str(r3, MemOperand(r0, offsetof(I, c))); - __ mov(r1, Operand(0xffffffff)); + __ mov(r1, Operand(0xFFFFFFFF)); __ mov(r2, Operand::Zero()); __ mov(r3, Operand(r2, ASR, 1), SetCC); // Unset the carry. __ adc(r3, r1, Operand(r2)); @@ -987,14 +976,13 @@ TEST(11) { OFStream os(stdout); code->Print(os); #endif - F_piiii f = FUNCTION_CAST<F_piiii>(code->entry()); - Object* dummy = CALL_GENERATED_CODE(isolate, f, &i, 0, 0, 0, 0); - USE(dummy); + auto f = GeneratedCode<F_piiii>::FromCode(*code); + f.Call(&i, 0, 0, 0, 0); - CHECK_EQ(static_cast<int32_t>(0xabcd0001), i.a); - CHECK_EQ(static_cast<int32_t>(0xabcd0000) >> 1, i.b); + CHECK_EQ(static_cast<int32_t>(0xABCD0001), i.a); + CHECK_EQ(static_cast<int32_t>(0xABCD0000) >> 1, i.b); CHECK_EQ(0x00000000, i.c); - CHECK_EQ(static_cast<int32_t>(0xffffffff), i.d); + CHECK_EQ(static_cast<int32_t>(0xFFFFFFFF), i.d); } @@ -1114,15 +1102,14 @@ TEST(13) { OFStream os(stdout); code->Print(os); #endif - F_piiii f = FUNCTION_CAST<F_piiii>(code->entry()); + auto f = GeneratedCode<F_piiii>::FromCode(*code); t.a = 1.5; t.b = 2.75; t.c = 17.17; t.x = 1.5; t.y = 2.75; t.z = 17.17; - Object* dummy = CALL_GENERATED_CODE(isolate, f, &t, 0, 0, 0, 0); - USE(dummy); + f.Call(&t, 0, 0, 0, 0); CHECK_EQ(14.7610017472335499, t.a); CHECK_EQ(3.84200491244266251, t.b); CHECK_EQ(73.8818412254460241, t.c); @@ -1187,16 +1174,15 @@ TEST(14) { OFStream os(stdout); code->Print(os); #endif - F_piiii f = FUNCTION_CAST<F_piiii>(code->entry()); + auto f = GeneratedCode<F_piiii>::FromCode(*code); t.left = bit_cast<double>(kHoleNanInt64); t.right = 1; t.add_result = 0; t.sub_result = 0; t.mul_result = 0; t.div_result = 0; - Object* dummy = CALL_GENERATED_CODE(isolate, f, &t, 0, 0, 0, 0); - USE(dummy); - const uint32_t kArmNanUpper32 = 0x7ff80000; + f.Call(&t, 0, 0, 0, 0); + const uint32_t kArmNanUpper32 = 0x7FF80000; const uint32_t kArmNanLower32 = 0x00000000; #ifdef DEBUG const uint64_t kArmNanInt64 = @@ -1206,17 +1192,17 @@ TEST(14) { // With VFP2 the sign of the canonicalized Nan is undefined. So // we remove the sign bit for the upper tests. CHECK_EQ(kArmNanUpper32, - (bit_cast<int64_t>(t.add_result) >> 32) & 0x7fffffff); - CHECK_EQ(kArmNanLower32, bit_cast<int64_t>(t.add_result) & 0xffffffffu); + (bit_cast<int64_t>(t.add_result) >> 32) & 0x7FFFFFFF); + CHECK_EQ(kArmNanLower32, bit_cast<int64_t>(t.add_result) & 0xFFFFFFFFu); CHECK_EQ(kArmNanUpper32, - (bit_cast<int64_t>(t.sub_result) >> 32) & 0x7fffffff); - CHECK_EQ(kArmNanLower32, bit_cast<int64_t>(t.sub_result) & 0xffffffffu); + (bit_cast<int64_t>(t.sub_result) >> 32) & 0x7FFFFFFF); + CHECK_EQ(kArmNanLower32, bit_cast<int64_t>(t.sub_result) & 0xFFFFFFFFu); CHECK_EQ(kArmNanUpper32, - (bit_cast<int64_t>(t.mul_result) >> 32) & 0x7fffffff); - CHECK_EQ(kArmNanLower32, bit_cast<int64_t>(t.mul_result) & 0xffffffffu); + (bit_cast<int64_t>(t.mul_result) >> 32) & 0x7FFFFFFF); + CHECK_EQ(kArmNanLower32, bit_cast<int64_t>(t.mul_result) & 0xFFFFFFFFu); CHECK_EQ(kArmNanUpper32, - (bit_cast<int64_t>(t.div_result) >> 32) & 0x7fffffff); - CHECK_EQ(kArmNanLower32, bit_cast<int64_t>(t.div_result) & 0xffffffffu); + (bit_cast<int64_t>(t.div_result) >> 32) & 0x7FFFFFFF); + CHECK_EQ(kArmNanLower32, bit_cast<int64_t>(t.div_result) & 0xFFFFFFFFu); } #define CHECK_EQ_SPLAT(field, ex) \ @@ -1376,7 +1362,7 @@ TEST(15) { __ vstr(d4, r0, offsetof(T, vqmovn_s32)); // ARM core register to scalar. - __ mov(r4, Operand(0xfffffff8)); + __ mov(r4, Operand(0xFFFFFFF8)); __ vmov(d0, Double(0.0)); __ vmov(NeonS8, d0, 1, r4); __ vmov(NeonS16, d0, 1, r4); @@ -1388,8 +1374,8 @@ TEST(15) { __ vstr(d0, r0, offsetof(T, vmov_to_scalar2)); // Scalar to ARM core register. - __ mov(r4, Operand(0xffffff00)); - __ mov(r5, Operand(0xffffffff)); + __ mov(r4, Operand(0xFFFFFF00)); + __ mov(r5, Operand(0xFFFFFFFF)); __ vmov(d0, r4, r5); __ vmov(NeonS8, r4, d0, 1); __ str(r4, MemOperand(r0, offsetof(T, vmov_from_scalar_s8))); @@ -1441,7 +1427,7 @@ TEST(15) { __ vst1(Neon8, NeonListOperand(q1), NeonMemOperand(r4)); // vdup (from register). - __ mov(r4, Operand(0xa)); + __ mov(r4, Operand(0xA)); __ vdup(Neon8, q0, r4); __ vdup(Neon16, q1, r4); __ vdup(Neon32, q2, r4); @@ -1477,10 +1463,10 @@ TEST(15) { __ vst1(Neon8, NeonListOperand(q1), NeonMemOperand(r4)); // vabs (integer). - __ mov(r4, Operand(0x7f7f7f7f)); + __ mov(r4, Operand(0x7F7F7F7F)); __ mov(r5, Operand(0x01010101)); __ vmov(d0, r4, r5); - __ mov(r4, Operand(0xffffffff)); + __ mov(r4, Operand(0xFFFFFFFF)); __ mov(r5, Operand(0x80808080)); __ vmov(d1, r4, r5); __ vabs(Neon8, q1, q0); @@ -1504,7 +1490,7 @@ TEST(15) { __ vst1(Neon8, NeonListOperand(q1), NeonMemOperand(r4)); // veor. - __ mov(r4, Operand(0xaa)); + __ mov(r4, Operand(0xAA)); __ vdup(Neon16, q0, r4); __ mov(r4, Operand(0x55)); __ vdup(Neon16, q1, r4); @@ -1512,15 +1498,15 @@ TEST(15) { __ add(r4, r0, Operand(static_cast<int32_t>(offsetof(T, veor)))); __ vst1(Neon8, NeonListOperand(q1), NeonMemOperand(r4)); // vand. - __ mov(r4, Operand(0xff)); + __ mov(r4, Operand(0xFF)); __ vdup(Neon16, q0, r4); - __ mov(r4, Operand(0xfe)); + __ mov(r4, Operand(0xFE)); __ vdup(Neon16, q1, r4); __ vand(q1, q1, q0); __ add(r4, r0, Operand(static_cast<int32_t>(offsetof(T, vand)))); __ vst1(Neon8, NeonListOperand(q1), NeonMemOperand(r4)); // vorr. - __ mov(r4, Operand(0xaa)); + __ mov(r4, Operand(0xAA)); __ vdup(Neon16, q0, r4); __ mov(r4, Operand(0x55)); __ vdup(Neon16, q1, r4); @@ -1631,7 +1617,7 @@ TEST(15) { __ vmax(NeonS8, q2, q0, q1); __ add(r4, r0, Operand(static_cast<int32_t>(offsetof(T, vmax_s8)))); __ vst1(Neon8, NeonListOperand(q2), NeonMemOperand(r4)); - __ mov(r4, Operand(0xff)); + __ mov(r4, Operand(0xFF)); __ vdup(Neon16, q0, r4); __ vdup(Neon8, q1, r4); __ vmin(NeonU16, q2, q0, q1); @@ -1640,7 +1626,7 @@ TEST(15) { __ vmax(NeonU16, q2, q0, q1); __ add(r4, r0, Operand(static_cast<int32_t>(offsetof(T, vmax_u16)))); __ vst1(Neon8, NeonListOperand(q2), NeonMemOperand(r4)); - __ mov(r4, Operand(0xff)); + __ mov(r4, Operand(0xFF)); __ vdup(Neon32, q0, r4); __ vdup(Neon8, q1, r4); __ vmin(NeonS32, q2, q0, q1); @@ -1669,14 +1655,14 @@ TEST(15) { __ vstr(d4, r0, offsetof(T, vpmin_s8)); __ vpmax(NeonS8, d4, d0, d2); __ vstr(d4, r0, offsetof(T, vpmax_s8)); - __ mov(r4, Operand(0xffff)); + __ mov(r4, Operand(0xFFFF)); __ vdup(Neon32, q0, r4); __ vdup(Neon16, q1, r4); __ vpmin(NeonU16, d4, d0, d2); __ vstr(d4, r0, offsetof(T, vpmin_u16)); __ vpmax(NeonU16, d4, d0, d2); __ vstr(d4, r0, offsetof(T, vpmax_u16)); - __ mov(r4, Operand(0xff)); + __ mov(r4, Operand(0xFF)); __ veor(q0, q0, q0); __ vmov(s0, r4); __ vdup(Neon8, q1, r4); @@ -1754,16 +1740,16 @@ TEST(15) { __ vst1(Neon8, NeonListOperand(q1), NeonMemOperand(r4)); // vqsub. - __ mov(r4, Operand(0x7f)); + __ mov(r4, Operand(0x7F)); __ vdup(Neon8, q0, r4); - __ mov(r4, Operand(0x3f)); + __ mov(r4, Operand(0x3F)); __ vdup(Neon8, q1, r4); __ vqsub(NeonU8, q1, q1, q0); __ add(r4, r0, Operand(static_cast<int32_t>(offsetof(T, vqsub_u8)))); __ vst1(Neon8, NeonListOperand(q1), NeonMemOperand(r4)); __ mov(r4, Operand(0x8000)); __ vdup(Neon16, q0, r4); - __ mov(r4, Operand(0x7fff)); + __ mov(r4, Operand(0x7FFF)); __ vdup(Neon16, q1, r4); __ vqsub(NeonS16, q1, q1, q0); __ add(r4, r0, Operand(static_cast<int32_t>(offsetof(T, vqsub_s16)))); @@ -1820,7 +1806,7 @@ TEST(15) { __ vst1(Neon8, NeonListOperand(q1), NeonMemOperand(r4)); // vsli, vsri. - __ mov(r4, Operand(0xffffffff)); + __ mov(r4, Operand(0xFFFFFFFF)); __ mov(r5, Operand(0x1)); __ vmov(d0, r4, r5); __ vmov(d1, r5, r5); @@ -1857,7 +1843,7 @@ TEST(15) { __ vcgt(NeonS8, q2, q0, q1); __ add(r4, r0, Operand(static_cast<int32_t>(offsetof(T, vcgt_s8)))); __ vst1(Neon8, NeonListOperand(q2), NeonMemOperand(r4)); - __ mov(r4, Operand(0xff)); + __ mov(r4, Operand(0xFF)); __ vdup(Neon16, q0, r4); __ vdup(Neon8, q1, r4); __ vcge(NeonU16, q2, q0, q1); @@ -1866,7 +1852,7 @@ TEST(15) { __ vcgt(NeonU16, q2, q0, q1); __ add(r4, r0, Operand(static_cast<int32_t>(offsetof(T, vcgt_u16)))); __ vst1(Neon8, NeonListOperand(q2), NeonMemOperand(r4)); - __ mov(r4, Operand(0xff)); + __ mov(r4, Operand(0xFF)); __ vdup(Neon32, q0, r4); __ vdup(Neon8, q1, r4); __ vcge(NeonS32, q2, q0, q1); @@ -1886,7 +1872,7 @@ TEST(15) { __ vst1(Neon8, NeonListOperand(q1), NeonMemOperand(r4)); // vbsl. - __ mov(r4, Operand(0x00ff)); + __ mov(r4, Operand(0x00FF)); __ vdup(Neon16, q0, r4); __ mov(r4, Operand(0x01)); __ vdup(Neon8, q1, r4); @@ -2050,7 +2036,7 @@ TEST(15) { // vtb[l/x]. __ mov(r4, Operand(0x06040200)); - __ mov(r5, Operand(0xff050301)); + __ mov(r5, Operand(0xFF050301)); __ vmov(d2, r4, r5); // d2 = ff05030106040200 __ vtbl(d0, NeonListOperand(d2, 1), d2); __ vstr(d0, r0, offsetof(T, vtbl)); @@ -2068,7 +2054,7 @@ TEST(15) { OFStream os(stdout); code->Print(os); #endif - F_piiii f = FUNCTION_CAST<F_piiii>(code->entry()); + auto f = GeneratedCode<F_piiii>::FromCode(*code); t.src0 = 0x01020304; t.src1 = 0x11121314; t.src2 = 0x21222324; @@ -2093,10 +2079,9 @@ TEST(15) { t.dstA3 = 0; t.lane_test[0] = 0x03020100; t.lane_test[1] = 0x07060504; - t.lane_test[2] = 0x0b0a0908; - t.lane_test[3] = 0x0f0e0d0c; - Object* dummy = CALL_GENERATED_CODE(isolate, f, &t, 0, 0, 0, 0); - USE(dummy); + t.lane_test[2] = 0x0B0A0908; + t.lane_test[3] = 0x0F0E0D0C; + f.Call(&t, 0, 0, 0, 0); CHECK_EQ(0x01020304u, t.dst0); CHECK_EQ(0x11121314u, t.dst1); @@ -2111,30 +2096,30 @@ TEST(15) { CHECK_EQ(0x00830084u, t.dstA2); CHECK_EQ(0x00810082u, t.dstA3); - CHECK_EQ_32X4(vmovl_s8, 0x00430044u, 0x00410042u, 0xff83ff84u, 0xff81ff82u); - CHECK_EQ_32X4(vmovl_u16, 0xff84u, 0xff83u, 0xff82u, 0xff81u); - CHECK_EQ_32X4(vmovl_s32, 0xff84u, 0x0u, 0xff83u, 0x0u); - CHECK_EQ_32X2(vqmovn_u16, 0xff83ff84u, 0xff81ff82u); + CHECK_EQ_32X4(vmovl_s8, 0x00430044u, 0x00410042u, 0xFF83FF84u, 0xFF81FF82u); + CHECK_EQ_32X4(vmovl_u16, 0xFF84u, 0xFF83u, 0xFF82u, 0xFF81u); + CHECK_EQ_32X4(vmovl_s32, 0xFF84u, 0x0u, 0xFF83u, 0x0u); + CHECK_EQ_32X2(vqmovn_u16, 0xFF83FF84u, 0xFF81FF82u); CHECK_EQ_32X2(vqmovn_s8, 0x81828384u, 0x81828384u); - CHECK_EQ_32X2(vqmovn_s32, 0xff84u, 0xff83u); + CHECK_EQ_32X2(vqmovn_s32, 0xFF84u, 0xFF83u); - CHECK_EQ(0xfffffff8fff8f800u, t.vmov_to_scalar1); - CHECK_EQ(0xfff80000f8000000u, t.vmov_to_scalar2); + CHECK_EQ(0xFFFFFFF8FFF8F800u, t.vmov_to_scalar1); + CHECK_EQ(0xFFF80000F8000000u, t.vmov_to_scalar2); CHECK_EQ(0xFFFFFFFFu, t.vmov_from_scalar_s8); CHECK_EQ(0xFFu, t.vmov_from_scalar_u8); CHECK_EQ(0xFFFFFFFFu, t.vmov_from_scalar_s16); CHECK_EQ(0xFFFFu, t.vmov_from_scalar_u16); CHECK_EQ(0xFFFFFFFFu, t.vmov_from_scalar_32); - CHECK_EQ_32X4(vmov, 0x03020100u, 0x07060504u, 0x0b0a0908u, 0x0f0e0d0cu); - CHECK_EQ_32X4(vmvn, 0xfcfdfeffu, 0xf8f9fafbu, 0xf4f5f6f7u, 0xf0f1f2f3u); + CHECK_EQ_32X4(vmov, 0x03020100u, 0x07060504u, 0x0B0A0908u, 0x0F0E0D0Cu); + CHECK_EQ_32X4(vmvn, 0xFCFDFEFFu, 0xF8F9FAFBu, 0xF4F5F6F7u, 0xF0F1F2F3u); - CHECK_EQ_SPLAT(vdup8, 0x0a0a0a0au); - CHECK_EQ_SPLAT(vdup16, 0x000a000au); - CHECK_EQ_SPLAT(vdup32, 0x0000000au); - CHECK_EQ_SPLAT(vdupf, -1.0); // bit pattern is 0xbf800000. - CHECK_EQ_32X2(vdupf_16, 0xbf80bf80u, 0xbf80bf80u); - CHECK_EQ_SPLAT(vdupf_8, 0xbfbfbfbfu); + CHECK_EQ_SPLAT(vdup8, 0x0A0A0A0Au); + CHECK_EQ_SPLAT(vdup16, 0x000A000Au); + CHECK_EQ_SPLAT(vdup32, 0x0000000Au); + CHECK_EQ_SPLAT(vdupf, -1.0); // bit pattern is 0xBF800000. + CHECK_EQ_32X2(vdupf_16, 0xBF80BF80u, 0xBF80BF80u); + CHECK_EQ_SPLAT(vdupf_8, 0xBFBFBFBFu); // src: [-1, -1, 1, 1] CHECK_EQ_32X4(vcvt_s32_f32, -1, -1, 1, 1); @@ -2149,17 +2134,17 @@ TEST(15) { CHECK_EQ_32X4(vabsf, 1.0, 0.0, 0.0, 1.0); CHECK_EQ_32X4(vnegf, 1.0, 0.0, -0.0, -1.0); - // src: [0x7f7f7f7f, 0x01010101, 0xffffffff, 0x80808080] - CHECK_EQ_32X4(vabs_s8, 0x7f7f7f7fu, 0x01010101u, 0x01010101u, 0x80808080u); - CHECK_EQ_32X4(vabs_s16, 0x7f7f7f7fu, 0x01010101u, 0x00010001u, 0x7f807f80u); - CHECK_EQ_32X4(vabs_s32, 0x7f7f7f7fu, 0x01010101u, 0x00000001u, 0x7f7f7f80u); - CHECK_EQ_32X4(vneg_s8, 0x81818181u, 0xffffffffu, 0x01010101u, 0x80808080u); - CHECK_EQ_32X4(vneg_s16, 0x80818081u, 0xfefffeffu, 0x00010001u, 0x7f807f80u); - CHECK_EQ_32X4(vneg_s32, 0x80808081u, 0xfefefeffu, 0x00000001u, 0x7f7f7f80u); - - CHECK_EQ_SPLAT(veor, 0x00ff00ffu); - CHECK_EQ_SPLAT(vand, 0x00fe00feu); - CHECK_EQ_SPLAT(vorr, 0x00ff00ffu); + // src: [0x7F7F7F7F, 0x01010101, 0xFFFFFFFF, 0x80808080] + CHECK_EQ_32X4(vabs_s8, 0x7F7F7F7Fu, 0x01010101u, 0x01010101u, 0x80808080u); + CHECK_EQ_32X4(vabs_s16, 0x7F7F7F7Fu, 0x01010101u, 0x00010001u, 0x7F807F80u); + CHECK_EQ_32X4(vabs_s32, 0x7F7F7F7Fu, 0x01010101u, 0x00000001u, 0x7F7F7F80u); + CHECK_EQ_32X4(vneg_s8, 0x81818181u, 0xFFFFFFFFu, 0x01010101u, 0x80808080u); + CHECK_EQ_32X4(vneg_s16, 0x80818081u, 0xFEFFFEFFu, 0x00010001u, 0x7F807F80u); + CHECK_EQ_32X4(vneg_s32, 0x80808081u, 0xFEFEFEFFu, 0x00000001u, 0x7F7F7F80u); + + CHECK_EQ_SPLAT(veor, 0x00FF00FFu); + CHECK_EQ_SPLAT(vand, 0x00FE00FEu); + CHECK_EQ_SPLAT(vorr, 0x00FF00FFu); CHECK_EQ_SPLAT(vaddf, 2.0); CHECK_EQ_32X2(vpaddf, 3.0, 7.0); CHECK_EQ_SPLAT(vminf, 1.0); @@ -2170,101 +2155,101 @@ TEST(15) { CHECK_EQ_SPLAT(vrecps, -1.0f); // 2 - (2 * 1.5) CHECK_ESTIMATE_SPLAT(vrsqrte, 0.5f, 0.1f); // 1 / sqrt(4) CHECK_EQ_SPLAT(vrsqrts, -1.0f); // (3 - (2 * 2.5)) / 2 - CHECK_EQ_SPLAT(vceqf, 0xffffffffu); + CHECK_EQ_SPLAT(vceqf, 0xFFFFFFFFu); // [0] >= [-1, 1, -0, 0] - CHECK_EQ_32X4(vcgef, 0u, 0xffffffffu, 0xffffffffu, 0xffffffffu); - CHECK_EQ_32X4(vcgtf, 0u, 0xffffffffu, 0u, 0u); + CHECK_EQ_32X4(vcgef, 0u, 0xFFFFFFFFu, 0xFFFFFFFFu, 0xFFFFFFFFu); + CHECK_EQ_32X4(vcgtf, 0u, 0xFFFFFFFFu, 0u, 0u); // [0, 3, 0, 3, ...] and [3, 3, 3, 3, ...] CHECK_EQ_SPLAT(vmin_s8, 0x00030003u); CHECK_EQ_SPLAT(vmax_s8, 0x03030303u); - // [0x00ff, 0x00ff, ...] and [0xffff, 0xffff, ...] - CHECK_EQ_SPLAT(vmin_u16, 0x00ff00ffu); - CHECK_EQ_SPLAT(vmax_u16, 0xffffffffu); - // [0x000000ff, 0x000000ff, ...] and [0xffffffff, 0xffffffff, ...] - CHECK_EQ_SPLAT(vmin_s32, 0xffffffffu); - CHECK_EQ_SPLAT(vmax_s32, 0xffu); + // [0x00FF, 0x00FF, ...] and [0xFFFF, 0xFFFF, ...] + CHECK_EQ_SPLAT(vmin_u16, 0x00FF00FFu); + CHECK_EQ_SPLAT(vmax_u16, 0xFFFFFFFFu); + // [0x000000FF, 0x000000FF, ...] and [0xFFFFFFFF, 0xFFFFFFFF, ...] + CHECK_EQ_SPLAT(vmin_s32, 0xFFFFFFFFu); + CHECK_EQ_SPLAT(vmax_s32, 0xFFu); // [0, 3, 0, 3, ...] and [3, 3, 3, 3, ...] CHECK_EQ_32X2(vpadd_i8, 0x03030303u, 0x06060606u); - CHECK_EQ_32X2(vpadd_i16, 0x0c0c0606u, 0x06060606u); - CHECK_EQ_32X2(vpadd_i32, 0x12120c0cu, 0x06060606u); + CHECK_EQ_32X2(vpadd_i16, 0x0C0C0606u, 0x06060606u); + CHECK_EQ_32X2(vpadd_i32, 0x12120C0Cu, 0x06060606u); CHECK_EQ_32X2(vpmin_s8, 0x00000000u, 0x03030303u); CHECK_EQ_32X2(vpmax_s8, 0x03030303u, 0x03030303u); // [0, ffff, 0, ffff] and [ffff, ffff] - CHECK_EQ_32X2(vpmin_u16, 0x00000000u, 0xffffffffu); - CHECK_EQ_32X2(vpmax_u16, 0xffffffffu, 0xffffffffu); - // [0x000000ff, 0x00000000u] and [0xffffffff, 0xffffffff, ...] - CHECK_EQ_32X2(vpmin_s32, 0x00u, 0xffffffffu); - CHECK_EQ_32X2(vpmax_s32, 0xffu, 0xffffffffu); + CHECK_EQ_32X2(vpmin_u16, 0x00000000u, 0xFFFFFFFFu); + CHECK_EQ_32X2(vpmax_u16, 0xFFFFFFFFu, 0xFFFFFFFFu); + // [0x000000FF, 0x00000000u] and [0xFFFFFFFF, 0xFFFFFFFF, ...] + CHECK_EQ_32X2(vpmin_s32, 0x00u, 0xFFFFFFFFu); + CHECK_EQ_32X2(vpmax_s32, 0xFFu, 0xFFFFFFFFu); CHECK_EQ_SPLAT(vadd8, 0x03030303u); CHECK_EQ_SPLAT(vadd16, 0x00030003u); CHECK_EQ_SPLAT(vadd32, 0x00000003u); CHECK_EQ_SPLAT(vqadd_s8, 0x80808080u); - CHECK_EQ_SPLAT(vqadd_u16, 0xffffffffu); + CHECK_EQ_SPLAT(vqadd_u16, 0xFFFFFFFFu); CHECK_EQ_SPLAT(vqadd_s32, 0x80000000u); CHECK_EQ_SPLAT(vqsub_u8, 0x00000000u); - CHECK_EQ_SPLAT(vqsub_s16, 0x7fff7fffu); + CHECK_EQ_SPLAT(vqsub_s16, 0x7FFF7FFFu); CHECK_EQ_SPLAT(vqsub_u32, 0x00000000u); - CHECK_EQ_SPLAT(vsub8, 0xfefefefeu); - CHECK_EQ_SPLAT(vsub16, 0xfffefffeu); - CHECK_EQ_SPLAT(vsub32, 0xfffffffeu); + CHECK_EQ_SPLAT(vsub8, 0xFEFEFEFEu); + CHECK_EQ_SPLAT(vsub16, 0xFFFEFFFEu); + CHECK_EQ_SPLAT(vsub32, 0xFFFFFFFEu); CHECK_EQ_SPLAT(vmul8, 0x04040404u); CHECK_EQ_SPLAT(vmul16, 0x00040004u); CHECK_EQ_SPLAT(vmul32, 0x00000004u); - CHECK_EQ_SPLAT(vshl8, 0xaaaaaaaau); - CHECK_EQ_SPLAT(vshl16, 0xaa00aa00u); - CHECK_EQ_SPLAT(vshl32, 0xaaaa0000u); - CHECK_EQ_SPLAT(vshr_s8, 0xc0c0c0c0u); + CHECK_EQ_SPLAT(vshl8, 0xAAAAAAAAu); + CHECK_EQ_SPLAT(vshl16, 0xAA00AA00u); + CHECK_EQ_SPLAT(vshl32, 0xAAAA0000u); + CHECK_EQ_SPLAT(vshr_s8, 0xC0C0C0C0u); CHECK_EQ_SPLAT(vshr_u16, 0x00400040u); - CHECK_EQ_SPLAT(vshr_s32, 0xffffc040u); - CHECK_EQ_32X2(vsli_64, 0x01u, 0xffffffffu); - CHECK_EQ_32X2(vsri_64, 0xffffffffu, 0x01u); - CHECK_EQ_32X2(vsli_32, 0xffff0001u, 0x00010001u); - CHECK_EQ_32X2(vsri_32, 0x00000000u, 0x0000ffffu); - CHECK_EQ_SPLAT(vceq, 0x00ff00ffu); + CHECK_EQ_SPLAT(vshr_s32, 0xFFFFC040u); + CHECK_EQ_32X2(vsli_64, 0x01u, 0xFFFFFFFFu); + CHECK_EQ_32X2(vsri_64, 0xFFFFFFFFu, 0x01u); + CHECK_EQ_32X2(vsli_32, 0xFFFF0001u, 0x00010001u); + CHECK_EQ_32X2(vsri_32, 0x00000000u, 0x0000FFFFu); + CHECK_EQ_SPLAT(vceq, 0x00FF00FFu); // [0, 3, 0, 3, ...] >= [3, 3, 3, 3, ...] - CHECK_EQ_SPLAT(vcge_s8, 0x00ff00ffu); + CHECK_EQ_SPLAT(vcge_s8, 0x00FF00FFu); CHECK_EQ_SPLAT(vcgt_s8, 0u); - // [0x00ff, 0x00ff, ...] >= [0xffff, 0xffff, ...] + // [0x00FF, 0x00FF, ...] >= [0xFFFF, 0xFFFF, ...] CHECK_EQ_SPLAT(vcge_u16, 0u); CHECK_EQ_SPLAT(vcgt_u16, 0u); - // [0x000000ff, 0x000000ff, ...] >= [0xffffffff, 0xffffffff, ...] - CHECK_EQ_SPLAT(vcge_s32, 0xffffffffu); - CHECK_EQ_SPLAT(vcgt_s32, 0xffffffffu); - CHECK_EQ_SPLAT(vtst, 0x00ff00ffu); + // [0x000000FF, 0x000000FF, ...] >= [0xFFFFFFFF, 0xFFFFFFFF, ...] + CHECK_EQ_SPLAT(vcge_s32, 0xFFFFFFFFu); + CHECK_EQ_SPLAT(vcgt_s32, 0xFFFFFFFFu); + CHECK_EQ_SPLAT(vtst, 0x00FF00FFu); CHECK_EQ_SPLAT(vbsl, 0x02010201u); - CHECK_EQ_32X4(vext, 0x06050403u, 0x0a090807u, 0x0e0d0c0bu, 0x0201000fu); + CHECK_EQ_32X4(vext, 0x06050403u, 0x0A090807u, 0x0E0D0C0Bu, 0x0201000Fu); CHECK_EQ_32X4(vzip8a, 0x01010000u, 0x03030202u, 0x05050404u, 0x07070606u); - CHECK_EQ_32X4(vzip8b, 0x09090808u, 0x0b0b0a0au, 0x0d0d0c0cu, 0x0f0f0e0eu); + CHECK_EQ_32X4(vzip8b, 0x09090808u, 0x0B0B0A0Au, 0x0D0D0C0Cu, 0x0F0F0E0Eu); CHECK_EQ_32X4(vzip16a, 0x01000100u, 0x03020302u, 0x05040504u, 0x07060706u); - CHECK_EQ_32X4(vzip16b, 0x09080908u, 0x0b0a0b0au, 0x0d0c0d0cu, 0x0f0e0f0eu); + CHECK_EQ_32X4(vzip16b, 0x09080908u, 0x0B0A0B0Au, 0x0D0C0D0Cu, 0x0F0E0F0Eu); CHECK_EQ_32X4(vzip32a, 0x03020100u, 0x03020100u, 0x07060504u, 0x07060504u); - CHECK_EQ_32X4(vzip32b, 0x0b0a0908u, 0x0b0a0908u, 0x0f0e0d0cu, 0x0f0e0d0cu); + CHECK_EQ_32X4(vzip32b, 0x0B0A0908u, 0x0B0A0908u, 0x0F0E0D0Cu, 0x0F0E0D0Cu); CHECK_EQ_32X2(vzipd8a, 0x01010000u, 0x03030202u); CHECK_EQ_32X2(vzipd8b, 0x05050404u, 0x07070606u); CHECK_EQ_32X2(vzipd16a, 0x01000100u, 0x03020302u); CHECK_EQ_32X2(vzipd16b, 0x05040504u, 0x07060706u); - CHECK_EQ_32X4(vuzp8a, 0x06040200u, 0x0e0c0a08u, 0x06040200u, 0x0e0c0a08u); - CHECK_EQ_32X4(vuzp8b, 0x07050301u, 0x0f0d0b09u, 0x07050301u, 0x0f0d0b09u); - CHECK_EQ_32X4(vuzp16a, 0x05040100u, 0x0d0c0908u, 0x05040100u, 0x0d0c0908u); - CHECK_EQ_32X4(vuzp16b, 0x07060302u, 0x0f0e0b0au, 0x07060302u, 0x0f0e0b0au); - CHECK_EQ_32X4(vuzp32a, 0x03020100u, 0x0b0a0908u, 0x03020100u, 0x0b0a0908u); - CHECK_EQ_32X4(vuzp32b, 0x07060504u, 0x0f0e0d0cu, 0x07060504u, 0x0f0e0d0cu); + CHECK_EQ_32X4(vuzp8a, 0x06040200u, 0x0E0C0A08u, 0x06040200u, 0x0E0C0A08u); + CHECK_EQ_32X4(vuzp8b, 0x07050301u, 0x0F0D0B09u, 0x07050301u, 0x0F0D0B09u); + CHECK_EQ_32X4(vuzp16a, 0x05040100u, 0x0D0C0908u, 0x05040100u, 0x0D0C0908u); + CHECK_EQ_32X4(vuzp16b, 0x07060302u, 0x0F0E0B0Au, 0x07060302u, 0x0F0E0B0Au); + CHECK_EQ_32X4(vuzp32a, 0x03020100u, 0x0B0A0908u, 0x03020100u, 0x0B0A0908u); + CHECK_EQ_32X4(vuzp32b, 0x07060504u, 0x0F0E0D0Cu, 0x07060504u, 0x0F0E0D0Cu); CHECK_EQ_32X2(vuzpd8a, 0x06040200u, 0x06040200u); CHECK_EQ_32X2(vuzpd8b, 0x07050301u, 0x07050301u); CHECK_EQ_32X2(vuzpd16a, 0x05040100u, 0x05040100u); CHECK_EQ_32X2(vuzpd16b, 0x07060302u, 0x07060302u); - CHECK_EQ_32X4(vtrn8a, 0x02020000u, 0x06060404u, 0x0a0a0808u, 0x0e0e0c0cu); - CHECK_EQ_32X4(vtrn8b, 0x03030101u, 0x07070505u, 0x0b0b0909u, 0x0f0f0d0du); - CHECK_EQ_32X4(vtrn16a, 0x01000100u, 0x05040504u, 0x09080908u, 0x0d0c0d0cu); - CHECK_EQ_32X4(vtrn16b, 0x03020302u, 0x07060706u, 0x0b0a0b0au, 0x0f0e0f0eu); - CHECK_EQ_32X4(vtrn32a, 0x03020100u, 0x03020100u, 0x0b0a0908u, 0x0b0a0908u); - CHECK_EQ_32X4(vtrn32b, 0x07060504u, 0x07060504u, 0x0f0e0d0cu, 0x0f0e0d0cu); + CHECK_EQ_32X4(vtrn8a, 0x02020000u, 0x06060404u, 0x0A0A0808u, 0x0E0E0C0Cu); + CHECK_EQ_32X4(vtrn8b, 0x03030101u, 0x07070505u, 0x0B0B0909u, 0x0F0F0D0Du); + CHECK_EQ_32X4(vtrn16a, 0x01000100u, 0x05040504u, 0x09080908u, 0x0D0C0D0Cu); + CHECK_EQ_32X4(vtrn16b, 0x03020302u, 0x07060706u, 0x0B0A0B0Au, 0x0F0E0F0Eu); + CHECK_EQ_32X4(vtrn32a, 0x03020100u, 0x03020100u, 0x0B0A0908u, 0x0B0A0908u); + CHECK_EQ_32X4(vtrn32b, 0x07060504u, 0x07060504u, 0x0F0E0D0Cu, 0x0F0E0D0Cu); CHECK_EQ_32X2(vtrnd8a, 0x02020000u, 0x06060404u); CHECK_EQ_32X2(vtrnd8b, 0x03030101u, 0x07070505u); @@ -2274,20 +2259,20 @@ TEST(15) { CHECK_EQ_32X2(vtrnd32b, 0x07060504u, 0x07060504u); // src: 0 1 2 3 4 5 6 7 8 9 a b c d e f (little endian) - CHECK_EQ_32X4(vrev64_32, 0x07060504u, 0x03020100u, 0x0f0e0d0cu, - 0x0b0a0908u); - CHECK_EQ_32X4(vrev64_16, 0x05040706u, 0x01000302u, 0x0d0c0f0eu, - 0x09080b0au); - CHECK_EQ_32X4(vrev64_8, 0x04050607u, 0x00010203u, 0x0c0d0e0fu, 0x08090a0bu); - CHECK_EQ_32X4(vrev32_16, 0x01000302u, 0x05040706u, 0x09080b0au, - 0x0d0c0f0eu); - CHECK_EQ_32X4(vrev32_8, 0x00010203u, 0x04050607u, 0x08090a0bu, 0x0c0d0e0fu); - CHECK_EQ_32X4(vrev16_8, 0x02030001u, 0x06070405u, 0x0a0b0809u, 0x0e0f0c0du); + CHECK_EQ_32X4(vrev64_32, 0x07060504u, 0x03020100u, 0x0F0E0D0Cu, + 0x0B0A0908u); + CHECK_EQ_32X4(vrev64_16, 0x05040706u, 0x01000302u, 0x0D0C0F0Eu, + 0x09080B0Au); + CHECK_EQ_32X4(vrev64_8, 0x04050607u, 0x00010203u, 0x0C0D0E0Fu, 0x08090A0Bu); + CHECK_EQ_32X4(vrev32_16, 0x01000302u, 0x05040706u, 0x09080B0Au, + 0x0D0C0F0Eu); + CHECK_EQ_32X4(vrev32_8, 0x00010203u, 0x04050607u, 0x08090A0Bu, 0x0C0D0E0Fu); + CHECK_EQ_32X4(vrev16_8, 0x02030001u, 0x06070405u, 0x0A0B0809u, 0x0E0F0C0Du); CHECK_EQ(0x05010400u, t.vtbl[0]); CHECK_EQ(0x00030602u, t.vtbl[1]); CHECK_EQ(0x05010400u, t.vtbx[0]); - CHECK_EQ(0xff030602u, t.vtbx[1]); + CHECK_EQ(0xFF030602u, t.vtbx[1]); } } @@ -2345,7 +2330,7 @@ TEST(16) { OFStream os(stdout); code->Print(os); #endif - F_piiii f = FUNCTION_CAST<F_piiii>(code->entry()); + auto f = GeneratedCode<F_piiii>::FromCode(*code); t.src0 = 0x01020304; t.src1 = 0x11121314; t.src2 = 0x11121300; @@ -2354,8 +2339,7 @@ TEST(16) { t.dst2 = 0; t.dst3 = 0; t.dst4 = 0; - Object* dummy = CALL_GENERATED_CODE(isolate, f, &t, 0, 0, 0, 0); - USE(dummy); + f.Call(&t, 0, 0, 0, 0); CHECK_EQ(0x12130304u, t.dst0); CHECK_EQ(0x01021213u, t.dst1); CHECK_EQ(0x00010003u, t.dst2); @@ -2383,15 +2367,13 @@ TEST(17) { __ nop(); } - -#define TEST_SDIV(expected_, dividend_, divisor_) \ - t.dividend = dividend_; \ - t.divisor = divisor_; \ - t.result = 0; \ - dummy = CALL_GENERATED_CODE(isolate, f, &t, 0, 0, 0, 0); \ +#define TEST_SDIV(expected_, dividend_, divisor_) \ + t.dividend = dividend_; \ + t.divisor = divisor_; \ + t.result = 0; \ + f.Call(&t, 0, 0, 0, 0); \ CHECK_EQ(expected_, t.result); - TEST(sdiv) { // Test the sdiv. CcTest::InitializeVM(); @@ -2426,8 +2408,7 @@ TEST(sdiv) { OFStream os(stdout); code->Print(os); #endif - F_piiii f = FUNCTION_CAST<F_piiii>(code->entry()); - Object* dummy; + auto f = GeneratedCode<F_piiii>::FromCode(*code); TEST_SDIV(0, kMinInt, 0); TEST_SDIV(0, 1024, 0); TEST_SDIV(1073741824, kMinInt, -2); @@ -2440,22 +2421,19 @@ TEST(sdiv) { TEST_SDIV(-3, -10, 3); TEST_SDIV(5, -10, -2); TEST_SDIV(3, -10, -3); - USE(dummy); } } #undef TEST_SDIV - -#define TEST_UDIV(expected_, dividend_, divisor_) \ - t.dividend = dividend_; \ - t.divisor = divisor_; \ - t.result = 0; \ - dummy = CALL_GENERATED_CODE(isolate, f, &t, 0, 0, 0, 0); \ +#define TEST_UDIV(expected_, dividend_, divisor_) \ + t.dividend = dividend_; \ + t.divisor = divisor_; \ + t.result = 0; \ + f.Call(&t, 0, 0, 0, 0); \ CHECK_EQ(expected_, t.result); - TEST(udiv) { // Test the udiv. CcTest::InitializeVM(); @@ -2490,13 +2468,11 @@ TEST(udiv) { OFStream os(stdout); code->Print(os); #endif - F_piiii f = FUNCTION_CAST<F_piiii>(code->entry()); - Object* dummy; + auto f = GeneratedCode<F_piiii>::FromCode(*code); TEST_UDIV(0u, 0, 0); TEST_UDIV(0u, 1024, 0); TEST_UDIV(5u, 10, 2); TEST_UDIV(3u, 10, 3); - USE(dummy); } } @@ -2520,12 +2496,11 @@ TEST(smmla) { #ifdef OBJECT_PRINT code->Print(std::cout); #endif - F_piiii f = FUNCTION_CAST<F_piiii>(code->entry()); + auto f = GeneratedCode<F_piiii>::FromCode(*code); for (size_t i = 0; i < 128; ++i) { int32_t r, x = rng->NextInt(), y = rng->NextInt(), z = rng->NextInt(); - Object* dummy = CALL_GENERATED_CODE(isolate, f, &r, x, y, z, 0); + f.Call(&r, x, y, z, 0); CHECK_EQ(base::bits::SignedMulHighAndAdd32(x, y, z), r); - USE(dummy); } } @@ -2546,12 +2521,11 @@ TEST(smmul) { #ifdef OBJECT_PRINT code->Print(std::cout); #endif - F_piiii f = FUNCTION_CAST<F_piiii>(code->entry()); + auto f = GeneratedCode<F_piiii>::FromCode(*code); for (size_t i = 0; i < 128; ++i) { int32_t r, x = rng->NextInt(), y = rng->NextInt(); - Object* dummy = CALL_GENERATED_CODE(isolate, f, &r, x, y, 0, 0); + f.Call(&r, x, y, 0, 0); CHECK_EQ(base::bits::SignedMulHigh32(x, y), r); - USE(dummy); } } @@ -2572,12 +2546,11 @@ TEST(sxtb) { #ifdef OBJECT_PRINT code->Print(std::cout); #endif - F_piiii f = FUNCTION_CAST<F_piiii>(code->entry()); + auto f = GeneratedCode<F_piiii>::FromCode(*code); for (size_t i = 0; i < 128; ++i) { int32_t r, x = rng->NextInt(); - Object* dummy = CALL_GENERATED_CODE(isolate, f, &r, x, 0, 0, 0); + f.Call(&r, x, 0, 0, 0); CHECK_EQ(static_cast<int32_t>(static_cast<int8_t>(x)), r); - USE(dummy); } } @@ -2598,12 +2571,11 @@ TEST(sxtab) { #ifdef OBJECT_PRINT code->Print(std::cout); #endif - F_piiii f = FUNCTION_CAST<F_piiii>(code->entry()); + auto f = GeneratedCode<F_piiii>::FromCode(*code); for (size_t i = 0; i < 128; ++i) { int32_t r, x = rng->NextInt(), y = rng->NextInt(); - Object* dummy = CALL_GENERATED_CODE(isolate, f, &r, x, y, 0, 0); + f.Call(&r, x, y, 0, 0); CHECK_EQ(static_cast<int32_t>(static_cast<int8_t>(x)) + y, r); - USE(dummy); } } @@ -2624,12 +2596,11 @@ TEST(sxth) { #ifdef OBJECT_PRINT code->Print(std::cout); #endif - F_piiii f = FUNCTION_CAST<F_piiii>(code->entry()); + auto f = GeneratedCode<F_piiii>::FromCode(*code); for (size_t i = 0; i < 128; ++i) { int32_t r, x = rng->NextInt(); - Object* dummy = CALL_GENERATED_CODE(isolate, f, &r, x, 0, 0, 0); + f.Call(&r, x, 0, 0, 0); CHECK_EQ(static_cast<int32_t>(static_cast<int16_t>(x)), r); - USE(dummy); } } @@ -2650,12 +2621,11 @@ TEST(sxtah) { #ifdef OBJECT_PRINT code->Print(std::cout); #endif - F_piiii f = FUNCTION_CAST<F_piiii>(code->entry()); + auto f = GeneratedCode<F_piiii>::FromCode(*code); for (size_t i = 0; i < 128; ++i) { int32_t r, x = rng->NextInt(), y = rng->NextInt(); - Object* dummy = CALL_GENERATED_CODE(isolate, f, &r, x, y, 0, 0); + f.Call(&r, x, y, 0, 0); CHECK_EQ(static_cast<int32_t>(static_cast<int16_t>(x)) + y, r); - USE(dummy); } } @@ -2676,12 +2646,11 @@ TEST(uxtb) { #ifdef OBJECT_PRINT code->Print(std::cout); #endif - F_piiii f = FUNCTION_CAST<F_piiii>(code->entry()); + auto f = GeneratedCode<F_piiii>::FromCode(*code); for (size_t i = 0; i < 128; ++i) { int32_t r, x = rng->NextInt(); - Object* dummy = CALL_GENERATED_CODE(isolate, f, &r, x, 0, 0, 0); + f.Call(&r, x, 0, 0, 0); CHECK_EQ(static_cast<int32_t>(static_cast<uint8_t>(x)), r); - USE(dummy); } } @@ -2702,12 +2671,11 @@ TEST(uxtab) { #ifdef OBJECT_PRINT code->Print(std::cout); #endif - F_piiii f = FUNCTION_CAST<F_piiii>(code->entry()); + auto f = GeneratedCode<F_piiii>::FromCode(*code); for (size_t i = 0; i < 128; ++i) { int32_t r, x = rng->NextInt(), y = rng->NextInt(); - Object* dummy = CALL_GENERATED_CODE(isolate, f, &r, x, y, 0, 0); + f.Call(&r, x, y, 0, 0); CHECK_EQ(static_cast<int32_t>(static_cast<uint8_t>(x)) + y, r); - USE(dummy); } } @@ -2728,12 +2696,11 @@ TEST(uxth) { #ifdef OBJECT_PRINT code->Print(std::cout); #endif - F_piiii f = FUNCTION_CAST<F_piiii>(code->entry()); + auto f = GeneratedCode<F_piiii>::FromCode(*code); for (size_t i = 0; i < 128; ++i) { int32_t r, x = rng->NextInt(); - Object* dummy = CALL_GENERATED_CODE(isolate, f, &r, x, 0, 0, 0); + f.Call(&r, x, 0, 0, 0); CHECK_EQ(static_cast<int32_t>(static_cast<uint16_t>(x)), r); - USE(dummy); } } @@ -2754,19 +2721,18 @@ TEST(uxtah) { #ifdef OBJECT_PRINT code->Print(std::cout); #endif - F_piiii f = FUNCTION_CAST<F_piiii>(code->entry()); + auto f = GeneratedCode<F_piiii>::FromCode(*code); for (size_t i = 0; i < 128; ++i) { int32_t r, x = rng->NextInt(), y = rng->NextInt(); - Object* dummy = CALL_GENERATED_CODE(isolate, f, &r, x, y, 0, 0); + f.Call(&r, x, y, 0, 0); CHECK_EQ(static_cast<int32_t>(static_cast<uint16_t>(x)) + y, r); - USE(dummy); } } -#define TEST_RBIT(expected_, input_) \ - t.input = input_; \ - t.result = 0; \ - dummy = CALL_GENERATED_CODE(isolate, f, &t, 0, 0, 0, 0); \ +#define TEST_RBIT(expected_, input_) \ + t.input = input_; \ + t.result = 0; \ + f.Call(&t, 0, 0, 0, 0); \ CHECK_EQ(static_cast<uint32_t>(expected_), t.result); TEST(rbit) { @@ -2798,15 +2764,13 @@ TEST(rbit) { code->Print(std::cout); #endif - F_piiii f = FUNCTION_CAST<F_piiii>(code->entry()); - Object* dummy = nullptr; - TEST_RBIT(0xffffffff, 0xffffffff); + auto f = GeneratedCode<F_piiii>::FromCode(*code); + TEST_RBIT(0xFFFFFFFF, 0xFFFFFFFF); TEST_RBIT(0x00000000, 0x00000000); - TEST_RBIT(0xffff0000, 0x0000ffff); - TEST_RBIT(0xff00ff00, 0x00ff00ff); - TEST_RBIT(0xf0f0f0f0, 0x0f0f0f0f); - TEST_RBIT(0x1e6a2c48, 0x12345678); - USE(dummy); + TEST_RBIT(0xFFFF0000, 0x0000FFFF); + TEST_RBIT(0xFF00FF00, 0x00FF00FF); + TEST_RBIT(0xF0F0F0F0, 0x0F0F0F0F); + TEST_RBIT(0x1E6A2C48, 0x12345678); } } @@ -2875,9 +2839,8 @@ TEST(code_relative_offset) { assm.GetCode(isolate, &desc); Handle<Code> code = isolate->factory()->NewCode(desc, Code::STUB, code_object); - F_iiiii f = FUNCTION_CAST<F_iiiii>(code->entry()); - int res = - reinterpret_cast<int>(CALL_GENERATED_CODE(isolate, f, 21, 0, 0, 0, 0)); + auto f = GeneratedCode<F_iiiii>::FromCode(*code); + int res = reinterpret_cast<int>(f.Call(21, 0, 0, 0, 0)); ::printf("f() = %d\n", res); CHECK_EQ(42, res); } @@ -2919,19 +2882,16 @@ TEST(msr_mrs) { OFStream os(stdout); code->Print(os); #endif - F_ippii f = FUNCTION_CAST<F_ippii>(code->entry()); - Object* dummy = nullptr; - USE(dummy); - -#define CHECK_MSR_MRS(n, z, c, v) \ - do { \ - uint32_t nzcv = (n << 31) | (z << 30) | (c << 29) | (v << 28); \ - uint32_t result_conditionals = -1; \ - uint32_t result_mrs = -1; \ - dummy = CALL_GENERATED_CODE(isolate, f, nzcv, &result_conditionals, \ - &result_mrs, 0, 0); \ - CHECK_EQ(nzcv, result_conditionals); \ - CHECK_EQ(nzcv, result_mrs); \ + auto f = GeneratedCode<F_ippii>::FromCode(*code); + +#define CHECK_MSR_MRS(n, z, c, v) \ + do { \ + uint32_t nzcv = (n << 31) | (z << 30) | (c << 29) | (v << 28); \ + uint32_t result_conditionals = -1; \ + uint32_t result_mrs = -1; \ + f.Call(nzcv, &result_conditionals, &result_mrs, 0, 0); \ + CHECK_EQ(nzcv, result_conditionals); \ + CHECK_EQ(nzcv, result_mrs); \ } while (0); // N Z C V @@ -3020,14 +2980,11 @@ TEST(ARMv8_float32_vrintX) { OFStream os(stdout); code->Print(os); #endif - F_piiii f = FUNCTION_CAST<F_piiii>(code->entry()); - - Object* dummy = nullptr; - USE(dummy); + auto f = GeneratedCode<F_piiii>::FromCode(*code); #define CHECK_VRINT(input_val, ares, nres, mres, pres, zres) \ t.input = input_val; \ - dummy = CALL_GENERATED_CODE(isolate, f, &t, 0, 0, 0, 0); \ + f.Call(&t, 0, 0, 0, 0); \ CHECK_EQ(ares, t.ar); \ CHECK_EQ(nres, t.nr); \ CHECK_EQ(mres, t.mr); \ @@ -3048,7 +3005,7 @@ TEST(ARMv8_float32_vrintX) { // Check NaN propagation. float nan = std::numeric_limits<float>::quiet_NaN(); t.input = nan; - dummy = CALL_GENERATED_CODE(isolate, f, &t, 0, 0, 0, 0); + f.Call(&t, 0, 0, 0, 0); CHECK_EQ(bit_cast<int32_t>(nan), bit_cast<int32_t>(t.ar)); CHECK_EQ(bit_cast<int32_t>(nan), bit_cast<int32_t>(t.nr)); CHECK_EQ(bit_cast<int32_t>(nan), bit_cast<int32_t>(t.mr)); @@ -3125,14 +3082,11 @@ TEST(ARMv8_vrintX) { OFStream os(stdout); code->Print(os); #endif - F_piiii f = FUNCTION_CAST<F_piiii>(code->entry()); - - Object* dummy = nullptr; - USE(dummy); + auto f = GeneratedCode<F_piiii>::FromCode(*code); #define CHECK_VRINT(input_val, ares, nres, mres, pres, zres) \ t.input = input_val; \ - dummy = CALL_GENERATED_CODE(isolate, f, &t, 0, 0, 0, 0); \ + f.Call(&t, 0, 0, 0, 0); \ CHECK_EQ(ares, t.ar); \ CHECK_EQ(nres, t.nr); \ CHECK_EQ(mres, t.mr); \ @@ -3153,7 +3107,7 @@ TEST(ARMv8_vrintX) { // Check NaN propagation. double nan = std::numeric_limits<double>::quiet_NaN(); t.input = nan; - dummy = CALL_GENERATED_CODE(isolate, f, &t, 0, 0, 0, 0); + f.Call(&t, 0, 0, 0, 0); CHECK_EQ(bit_cast<int64_t>(nan), bit_cast<int64_t>(t.ar)); CHECK_EQ(bit_cast<int64_t>(nan), bit_cast<int64_t>(t.nr)); CHECK_EQ(bit_cast<int64_t>(nan), bit_cast<int64_t>(t.mr)); @@ -3265,34 +3219,31 @@ TEST(ARMv8_vsel) { OFStream os(stdout); code->Print(os); #endif - F_ippii f = FUNCTION_CAST<F_ippii>(code->entry()); - Object* dummy = nullptr; - USE(dummy); + auto f = GeneratedCode<F_ippii>::FromCode(*code); STATIC_ASSERT(kResultPass == -kResultFail); -#define CHECK_VSEL(n, z, c, v, vseleq, vselge, vselgt, vselvs) \ - do { \ - ResultsF32 results_f32; \ - ResultsF64 results_f64; \ - uint32_t nzcv = (n << 31) | (z << 30) | (c << 29) | (v << 28); \ - dummy = CALL_GENERATED_CODE(isolate, f, nzcv, &results_f32, &results_f64, \ - 0, 0); \ - CHECK_EQ(vseleq, results_f32.vseleq_); \ - CHECK_EQ(vselge, results_f32.vselge_); \ - CHECK_EQ(vselgt, results_f32.vselgt_); \ - CHECK_EQ(vselvs, results_f32.vselvs_); \ - CHECK_EQ(-vseleq, results_f32.vselne_); \ - CHECK_EQ(-vselge, results_f32.vsellt_); \ - CHECK_EQ(-vselgt, results_f32.vselle_); \ - CHECK_EQ(-vselvs, results_f32.vselvc_); \ - CHECK_EQ(vseleq, results_f64.vseleq_); \ - CHECK_EQ(vselge, results_f64.vselge_); \ - CHECK_EQ(vselgt, results_f64.vselgt_); \ - CHECK_EQ(vselvs, results_f64.vselvs_); \ - CHECK_EQ(-vseleq, results_f64.vselne_); \ - CHECK_EQ(-vselge, results_f64.vsellt_); \ - CHECK_EQ(-vselgt, results_f64.vselle_); \ - CHECK_EQ(-vselvs, results_f64.vselvc_); \ +#define CHECK_VSEL(n, z, c, v, vseleq, vselge, vselgt, vselvs) \ + do { \ + ResultsF32 results_f32; \ + ResultsF64 results_f64; \ + uint32_t nzcv = (n << 31) | (z << 30) | (c << 29) | (v << 28); \ + f.Call(nzcv, &results_f32, &results_f64, 0, 0); \ + CHECK_EQ(vseleq, results_f32.vseleq_); \ + CHECK_EQ(vselge, results_f32.vselge_); \ + CHECK_EQ(vselgt, results_f32.vselgt_); \ + CHECK_EQ(vselvs, results_f32.vselvs_); \ + CHECK_EQ(-vseleq, results_f32.vselne_); \ + CHECK_EQ(-vselge, results_f32.vsellt_); \ + CHECK_EQ(-vselgt, results_f32.vselle_); \ + CHECK_EQ(-vselvs, results_f32.vselvc_); \ + CHECK_EQ(vseleq, results_f64.vseleq_); \ + CHECK_EQ(vselge, results_f64.vselge_); \ + CHECK_EQ(vselgt, results_f64.vselgt_); \ + CHECK_EQ(vselvs, results_f64.vselvs_); \ + CHECK_EQ(-vseleq, results_f64.vselne_); \ + CHECK_EQ(-vselge, results_f64.vsellt_); \ + CHECK_EQ(-vselgt, results_f64.vselle_); \ + CHECK_EQ(-vselvs, results_f64.vselvc_); \ } while (0); // N Z C V vseleq vselge vselgt vselvs @@ -3359,22 +3310,20 @@ TEST(ARMv8_vminmax_f64) { OFStream os(stdout); code->Print(os); #endif - F_ppiii f = FUNCTION_CAST<F_ppiii>(code->entry()); - Object* dummy = nullptr; - USE(dummy); + auto f = GeneratedCode<F_ppiii>::FromCode(*code); #define CHECK_VMINMAX(left, right, vminnm, vmaxnm) \ do { \ Inputs inputs = {left, right}; \ Results results; \ - dummy = CALL_GENERATED_CODE(isolate, f, &inputs, &results, 0, 0, 0); \ + f.Call(&inputs, &results, 0, 0, 0); \ /* Use a bit_cast to correctly identify -0.0 and NaNs. */ \ CHECK_EQ(bit_cast<uint64_t>(vminnm), bit_cast<uint64_t>(results.vminnm_)); \ CHECK_EQ(bit_cast<uint64_t>(vmaxnm), bit_cast<uint64_t>(results.vmaxnm_)); \ } while (0); - double nan_a = bit_cast<double>(UINT64_C(0x7ff8000000000001)); - double nan_b = bit_cast<double>(UINT64_C(0x7ff8000000000002)); + double nan_a = bit_cast<double>(UINT64_C(0x7FF8000000000001)); + double nan_b = bit_cast<double>(UINT64_C(0x7FF8000000000002)); CHECK_VMINMAX(1.0, -1.0, -1.0, 1.0); CHECK_VMINMAX(-1.0, 1.0, -1.0, 1.0); @@ -3441,22 +3390,20 @@ TEST(ARMv8_vminmax_f32) { OFStream os(stdout); code->Print(os); #endif - F_ppiii f = FUNCTION_CAST<F_ppiii>(code->entry()); - Object* dummy = nullptr; - USE(dummy); + auto f = GeneratedCode<F_ppiii>::FromCode(*code); #define CHECK_VMINMAX(left, right, vminnm, vmaxnm) \ do { \ Inputs inputs = {left, right}; \ Results results; \ - dummy = CALL_GENERATED_CODE(isolate, f, &inputs, &results, 0, 0, 0); \ + f.Call(&inputs, &results, 0, 0, 0); \ /* Use a bit_cast to correctly identify -0.0 and NaNs. */ \ CHECK_EQ(bit_cast<uint32_t>(vminnm), bit_cast<uint32_t>(results.vminnm_)); \ CHECK_EQ(bit_cast<uint32_t>(vmaxnm), bit_cast<uint32_t>(results.vmaxnm_)); \ } while (0); - float nan_a = bit_cast<float>(UINT32_C(0x7fc00001)); - float nan_b = bit_cast<float>(UINT32_C(0x7fc00002)); + float nan_a = bit_cast<float>(UINT32_C(0x7FC00001)); + float nan_b = bit_cast<float>(UINT32_C(0x7FC00002)); CHECK_VMINMAX(1.0f, -1.0f, -1.0f, 1.0f); CHECK_VMINMAX(-1.0f, 1.0f, -1.0f, 1.0f); @@ -3482,7 +3429,7 @@ TEST(ARMv8_vminmax_f32) { } template <typename T, typename Inputs, typename Results> -static F_ppiii GenerateMacroFloatMinMax(MacroAssembler& assm) { +static GeneratedCode<F_ppiii> GenerateMacroFloatMinMax(MacroAssembler& assm) { T a = T::from_code(0); // d0/s0 T b = T::from_code(1); // d1/s1 T c = T::from_code(2); // d2/s2 @@ -3573,7 +3520,7 @@ static F_ppiii GenerateMacroFloatMinMax(MacroAssembler& assm) { OFStream os(stdout); code->Print(os); #endif - return FUNCTION_CAST<F_ppiii>(code->entry()); + return GeneratedCode<F_ppiii>::FromCode(*code); } TEST(macro_float_minmax_f64) { @@ -3600,16 +3547,13 @@ TEST(macro_float_minmax_f64) { double max_aba_; }; - F_ppiii f = GenerateMacroFloatMinMax<DwVfpRegister, Inputs, Results>(assm); - - Object* dummy = nullptr; - USE(dummy); + auto f = GenerateMacroFloatMinMax<DwVfpRegister, Inputs, Results>(assm); #define CHECK_MINMAX(left, right, min, max) \ do { \ Inputs inputs = {left, right}; \ Results results; \ - dummy = CALL_GENERATED_CODE(isolate, f, &inputs, &results, 0, 0, 0); \ + f.Call(&inputs, &results, 0, 0, 0); \ /* Use a bit_cast to correctly identify -0.0 and NaNs. */ \ CHECK_EQ(bit_cast<uint64_t>(min), bit_cast<uint64_t>(results.min_abc_)); \ CHECK_EQ(bit_cast<uint64_t>(min), bit_cast<uint64_t>(results.min_aab_)); \ @@ -3619,8 +3563,8 @@ TEST(macro_float_minmax_f64) { CHECK_EQ(bit_cast<uint64_t>(max), bit_cast<uint64_t>(results.max_aba_)); \ } while (0) - double nan_a = bit_cast<double>(UINT64_C(0x7ff8000000000001)); - double nan_b = bit_cast<double>(UINT64_C(0x7ff8000000000002)); + double nan_a = bit_cast<double>(UINT64_C(0x7FF8000000000001)); + double nan_b = bit_cast<double>(UINT64_C(0x7FF8000000000002)); CHECK_MINMAX(1.0, -1.0, -1.0, 1.0); CHECK_MINMAX(-1.0, 1.0, -1.0, 1.0); @@ -3668,15 +3612,13 @@ TEST(macro_float_minmax_f32) { float max_aba_; }; - F_ppiii f = GenerateMacroFloatMinMax<SwVfpRegister, Inputs, Results>(assm); - Object* dummy = nullptr; - USE(dummy); + auto f = GenerateMacroFloatMinMax<SwVfpRegister, Inputs, Results>(assm); #define CHECK_MINMAX(left, right, min, max) \ do { \ Inputs inputs = {left, right}; \ Results results; \ - dummy = CALL_GENERATED_CODE(isolate, f, &inputs, &results, 0, 0, 0); \ + f.Call(&inputs, &results, 0, 0, 0); \ /* Use a bit_cast to correctly identify -0.0 and NaNs. */ \ CHECK_EQ(bit_cast<uint32_t>(min), bit_cast<uint32_t>(results.min_abc_)); \ CHECK_EQ(bit_cast<uint32_t>(min), bit_cast<uint32_t>(results.min_aab_)); \ @@ -3686,8 +3628,8 @@ TEST(macro_float_minmax_f32) { CHECK_EQ(bit_cast<uint32_t>(max), bit_cast<uint32_t>(results.max_aba_)); \ } while (0) - float nan_a = bit_cast<float>(UINT32_C(0x7fc00001)); - float nan_b = bit_cast<float>(UINT32_C(0x7fc00002)); + float nan_a = bit_cast<float>(UINT32_C(0x7FC00001)); + float nan_b = bit_cast<float>(UINT32_C(0x7FC00002)); CHECK_MINMAX(1.0f, -1.0f, -1.0f, 1.0f); CHECK_MINMAX(-1.0f, 1.0f, -1.0f, 1.0f); @@ -3741,30 +3683,27 @@ TEST(unaligned_loads) { OFStream os(stdout); code->Print(os); #endif - F_ppiii f = FUNCTION_CAST<F_ppiii>(code->entry()); - - Object* dummy = nullptr; - USE(dummy); + auto f = GeneratedCode<F_ppiii>::FromCode(*code); #ifndef V8_TARGET_LITTLE_ENDIAN #error This test assumes a little-endian layout. #endif - uint64_t data = UINT64_C(0x84838281807f7e7d); - dummy = CALL_GENERATED_CODE(isolate, f, &t, &data, 0, 0, 0); - CHECK_EQ(0x00007e7du, t.ldrh); - CHECK_EQ(0x00007e7du, t.ldrsh); - CHECK_EQ(0x807f7e7du, t.ldr); - dummy = CALL_GENERATED_CODE(isolate, f, &t, &data, 1, 0, 0); - CHECK_EQ(0x00007f7eu, t.ldrh); - CHECK_EQ(0x00007f7eu, t.ldrsh); - CHECK_EQ(0x81807f7eu, t.ldr); - dummy = CALL_GENERATED_CODE(isolate, f, &t, &data, 2, 0, 0); - CHECK_EQ(0x0000807fu, t.ldrh); - CHECK_EQ(0xffff807fu, t.ldrsh); - CHECK_EQ(0x8281807fu, t.ldr); - dummy = CALL_GENERATED_CODE(isolate, f, &t, &data, 3, 0, 0); + uint64_t data = UINT64_C(0x84838281807F7E7D); + f.Call(&t, &data, 0, 0, 0); + CHECK_EQ(0x00007E7Du, t.ldrh); + CHECK_EQ(0x00007E7Du, t.ldrsh); + CHECK_EQ(0x807F7E7Du, t.ldr); + f.Call(&t, &data, 1, 0, 0); + CHECK_EQ(0x00007F7Eu, t.ldrh); + CHECK_EQ(0x00007F7Eu, t.ldrsh); + CHECK_EQ(0x81807F7Eu, t.ldr); + f.Call(&t, &data, 2, 0, 0); + CHECK_EQ(0x0000807Fu, t.ldrh); + CHECK_EQ(0xFFFF807Fu, t.ldrsh); + CHECK_EQ(0x8281807Fu, t.ldr); + f.Call(&t, &data, 3, 0, 0); CHECK_EQ(0x00008180u, t.ldrh); - CHECK_EQ(0xffff8180u, t.ldrsh); + CHECK_EQ(0xFFFF8180u, t.ldrsh); CHECK_EQ(0x83828180u, t.ldr); } @@ -3787,10 +3726,7 @@ TEST(unaligned_stores) { OFStream os(stdout); code->Print(os); #endif - F_ppiii f = FUNCTION_CAST<F_ppiii>(code->entry()); - - Object* dummy = nullptr; - USE(dummy); + auto f = GeneratedCode<F_ppiii>::FromCode(*code); #ifndef V8_TARGET_LITTLE_ENDIAN #error This test assumes a little-endian layout. @@ -3798,30 +3734,30 @@ TEST(unaligned_stores) { { uint64_t strh = 0; uint64_t str = 0; - dummy = CALL_GENERATED_CODE(isolate, f, &strh, &str, 0, 0xfedcba98, 0); - CHECK_EQ(UINT64_C(0x000000000000ba98), strh); - CHECK_EQ(UINT64_C(0x00000000fedcba98), str); + f.Call(&strh, &str, 0, 0xFEDCBA98, 0); + CHECK_EQ(UINT64_C(0x000000000000BA98), strh); + CHECK_EQ(UINT64_C(0x00000000FEDCBA98), str); } { uint64_t strh = 0; uint64_t str = 0; - dummy = CALL_GENERATED_CODE(isolate, f, &strh, &str, 1, 0xfedcba98, 0); - CHECK_EQ(UINT64_C(0x0000000000ba9800), strh); - CHECK_EQ(UINT64_C(0x000000fedcba9800), str); + f.Call(&strh, &str, 1, 0xFEDCBA98, 0); + CHECK_EQ(UINT64_C(0x0000000000BA9800), strh); + CHECK_EQ(UINT64_C(0x000000FEDCBA9800), str); } { uint64_t strh = 0; uint64_t str = 0; - dummy = CALL_GENERATED_CODE(isolate, f, &strh, &str, 2, 0xfedcba98, 0); - CHECK_EQ(UINT64_C(0x00000000ba980000), strh); - CHECK_EQ(UINT64_C(0x0000fedcba980000), str); + f.Call(&strh, &str, 2, 0xFEDCBA98, 0); + CHECK_EQ(UINT64_C(0x00000000BA980000), strh); + CHECK_EQ(UINT64_C(0x0000FEDCBA980000), str); } { uint64_t strh = 0; uint64_t str = 0; - dummy = CALL_GENERATED_CODE(isolate, f, &strh, &str, 3, 0xfedcba98, 0); - CHECK_EQ(UINT64_C(0x000000ba98000000), strh); - CHECK_EQ(UINT64_C(0x00fedcba98000000), str); + f.Call(&strh, &str, 3, 0xFEDCBA98, 0); + CHECK_EQ(UINT64_C(0x000000BA98000000), strh); + CHECK_EQ(UINT64_C(0x00FEDCBA98000000), str); } } @@ -3847,10 +3783,10 @@ TEST(vswp) { uint64_t one = bit_cast<uint64_t>(1.0); __ mov(r5, Operand(one >> 32)); - __ mov(r4, Operand(one & 0xffffffff)); + __ mov(r4, Operand(one & 0xFFFFFFFF)); uint64_t minus_one = bit_cast<uint64_t>(-1.0); __ mov(r7, Operand(minus_one >> 32)); - __ mov(r6, Operand(minus_one & 0xffffffff)); + __ mov(r6, Operand(minus_one & 0xFFFFFFFF)); __ vmov(d0, r4, r5); // d0 = 1.0 __ vmov(d1, r6, r7); // d1 = -1.0 @@ -3868,7 +3804,7 @@ TEST(vswp) { // q-register swap. const uint32_t test_1 = 0x01234567; - const uint32_t test_2 = 0x89abcdef; + const uint32_t test_2 = 0x89ABCDEF; __ mov(r4, Operand(test_1)); __ mov(r5, Operand(test_2)); __ vdup(Neon32, q4, r4); @@ -3890,9 +3826,8 @@ TEST(vswp) { OFStream os(stdout); code->Print(os); #endif - F_piiii f = FUNCTION_CAST<F_piiii>(code->entry()); - Object* dummy = CALL_GENERATED_CODE(isolate, f, &t, 0, 0, 0, 0); - USE(dummy); + auto f = GeneratedCode<F_piiii>::FromCode(*code); + f.Call(&t, 0, 0, 0, 0); CHECK_EQ(minus_one, t.vswp_d0); CHECK_EQ(one, t.vswp_d1); if (CpuFeatures::IsSupported(VFP32DREGS)) { @@ -4008,9 +3943,8 @@ TEST(split_add_immediate) { OFStream os(stdout); code->Print(os); #endif - F_iiiii f = FUNCTION_CAST<F_iiiii>(code->entry()); - uint32_t res = - reinterpret_cast<int>(CALL_GENERATED_CODE(isolate, f, 0, 0, 0, 0, 0)); + auto f = GeneratedCode<F_iiiii>::FromCode(*code); + uint32_t res = reinterpret_cast<int>(f.Call(0, 0, 0, 0, 0)); ::printf("f() = 0x%x\n", res); CHECK_EQ(0x12345678, res); } @@ -4029,9 +3963,8 @@ TEST(split_add_immediate) { OFStream os(stdout); code->Print(os); #endif - F_iiiii f = FUNCTION_CAST<F_iiiii>(code->entry()); - uint32_t res = - reinterpret_cast<int>(CALL_GENERATED_CODE(isolate, f, 0, 0, 0, 0, 0)); + auto f = GeneratedCode<F_iiiii>::FromCode(*code); + uint32_t res = reinterpret_cast<int>(f.Call(0, 0, 0, 0, 0)); ::printf("f() = 0x%x\n", res); CHECK_EQ(0x12345678, res); } @@ -4053,9 +3986,8 @@ TEST(split_add_immediate) { OFStream os(stdout); code->Print(os); #endif - F_iiiii f = FUNCTION_CAST<F_iiiii>(code->entry()); - uint32_t res = - reinterpret_cast<int>(CALL_GENERATED_CODE(isolate, f, 0, 0, 0, 0, 0)); + auto f = GeneratedCode<F_iiiii>::FromCode(*code); + uint32_t res = reinterpret_cast<int>(f.Call(0, 0, 0, 0, 0)); ::printf("f() = 0x%x\n", res); CHECK_EQ(0x12345678, res); } @@ -4087,15 +4019,15 @@ TEST(vabs_32) { Isolate* isolate = CcTest::i_isolate(); HandleScope scope(isolate); - F_iiiii f = FUNCTION_CAST<F_iiiii>(AssembleCode([](Assembler& assm) { + auto f = AssembleCode<F_iiiii>([](Assembler& assm) { __ vmov(s0, r0); __ vabs(s0, s0); __ vmov(r0, s0); - })); + }); for (Float32 f32 : Float32Inputs()) { - Float32 res = Float32::FromBits(reinterpret_cast<uint32_t>( - CALL_GENERATED_CODE(isolate, f, f32.get_bits(), 0, 0, 0, 0))); + Float32 res = Float32::FromBits( + reinterpret_cast<uint32_t>(f.Call(f32.get_bits(), 0, 0, 0, 0))); Float32 exp = Float32::FromBits(f32.get_bits() & ~(1 << 31)); CHECK_EQ(exp.get_bits(), res.get_bits()); } @@ -4105,17 +4037,16 @@ TEST(vabs_64) { Isolate* isolate = CcTest::i_isolate(); HandleScope scope(isolate); - F_iiiii f = FUNCTION_CAST<F_iiiii>(AssembleCode([](Assembler& assm) { + auto f = AssembleCode<F_iiiii>([](Assembler& assm) { __ vmov(d0, r0, r1); __ vabs(d0, d0); __ vmov(r1, r0, d0); - })); + }); for (Float64 f64 : Float64Inputs()) { uint32_t p0 = static_cast<uint32_t>(f64.get_bits()); uint32_t p1 = static_cast<uint32_t>(f64.get_bits() >> 32); - uint32_t res = reinterpret_cast<uint32_t>( - CALL_GENERATED_CODE(isolate, f, p0, p1, 0, 0, 0)); + uint32_t res = reinterpret_cast<uint32_t>(f.Call(p0, p1, 0, 0, 0)); Float64 exp = Float64::FromBits(f64.get_bits() & ~(1ull << 63)); // We just get back the top word, so only compare that one. CHECK_EQ(exp.get_bits() >> 32, res); @@ -4126,15 +4057,15 @@ TEST(vneg_32) { Isolate* isolate = CcTest::i_isolate(); HandleScope scope(isolate); - F_iiiii f = FUNCTION_CAST<F_iiiii>(AssembleCode([](Assembler& assm) { + auto f = AssembleCode<F_iiiii>([](Assembler& assm) { __ vmov(s0, r0); __ vneg(s0, s0); __ vmov(r0, s0); - })); + }); for (Float32 f32 : Float32Inputs()) { - Float32 res = Float32::FromBits(reinterpret_cast<uint32_t>( - CALL_GENERATED_CODE(isolate, f, f32.get_bits(), 0, 0, 0, 0))); + Float32 res = Float32::FromBits( + reinterpret_cast<uint32_t>(f.Call(f32.get_bits(), 0, 0, 0, 0))); Float32 exp = Float32::FromBits(f32.get_bits() ^ (1 << 31)); CHECK_EQ(exp.get_bits(), res.get_bits()); } @@ -4144,17 +4075,16 @@ TEST(vneg_64) { Isolate* isolate = CcTest::i_isolate(); HandleScope scope(isolate); - F_iiiii f = FUNCTION_CAST<F_iiiii>(AssembleCode([](Assembler& assm) { + auto f = AssembleCode<F_iiiii>([](Assembler& assm) { __ vmov(d0, r0, r1); __ vneg(d0, d0); __ vmov(r1, r0, d0); - })); + }); for (Float64 f64 : Float64Inputs()) { uint32_t p0 = static_cast<uint32_t>(f64.get_bits()); uint32_t p1 = static_cast<uint32_t>(f64.get_bits() >> 32); - uint32_t res = reinterpret_cast<uint32_t>( - CALL_GENERATED_CODE(isolate, f, p0, p1, 0, 0, 0)); + uint32_t res = reinterpret_cast<uint32_t>(f.Call(p0, p1, 0, 0, 0)); Float64 exp = Float64::FromBits(f64.get_bits() ^ (1ull << 63)); // We just get back the top word, so only compare that one. CHECK_EQ(exp.get_bits() >> 32, res); diff --git a/deps/v8/test/cctest/test-assembler-arm64.cc b/deps/v8/test/cctest/test-assembler-arm64.cc index 62f7ccf2c6..4fc80201d2 100644 --- a/deps/v8/test/cctest/test-assembler-arm64.cc +++ b/deps/v8/test/cctest/test-assembler-arm64.cc @@ -95,8 +95,7 @@ namespace internal { // If more advance computation is required before the assert then access the // RegisterDump named core directly: // -// CHECK_EQUAL_64(0x1234, core.xreg(0) & 0xffff); - +// CHECK_EQUAL_64(0x1234, core.xreg(0) & 0xFFFF); #if 0 // TODO(all): enable. static v8::Persistent<v8::Context> env; @@ -150,7 +149,6 @@ static void InitializeVM() { simulator.ResetState(); #define START_AFTER_RESET() \ - __ SetStackPointer(csp); \ __ PushCalleeSavedRegisters(); \ __ Debug("Start test.", __LINE__, TRACE_ENABLE | LOG_ALL); @@ -192,7 +190,6 @@ static void InitializeVM() { #define START_AFTER_RESET() \ - __ SetStackPointer(csp); \ __ PushCalleeSavedRegisters(); #define START() \ @@ -200,6 +197,7 @@ static void InitializeVM() { START_AFTER_RESET(); #define RUN() \ + MakeAssemblerBufferExecutable(buf, allocated); \ Assembler::FlushICache(isolate, buf, masm.SizeOfGeneratedCode()); \ { \ void (*test_function)(void); \ @@ -213,7 +211,7 @@ static void InitializeVM() { __ Ret(); \ __ GetCode(masm.isolate(), nullptr); -#define TEARDOWN() CHECK(v8::base::OS::Free(buf, allocated)); +#define TEARDOWN() CHECK(v8::internal::FreePages(buf, allocated)); #endif // ifdef USE_SIMULATOR. @@ -266,20 +264,20 @@ TEST(stack_ops) { __ Mov(x1, csp); // Add extended to the csp, and move the result to a normal register. - __ Mov(x17, 0xfff); + __ Mov(x17, 0xFFF); __ Add(csp, csp, Operand(x17, SXTB)); __ Mov(x2, csp); // Create an csp using a logical instruction, and move to normal register. - __ Orr(csp, xzr, Operand(0x1fff)); + __ Orr(csp, xzr, Operand(0x1FFF)); __ Mov(x3, csp); // Write wcsp using a logical instruction. - __ Orr(wcsp, wzr, Operand(0xfffffff8L)); + __ Orr(wcsp, wzr, Operand(0xFFFFFFF8L)); __ Mov(x4, csp); // Write csp, and read back wcsp. - __ Orr(csp, xzr, Operand(0xfffffff8L)); + __ Orr(csp, xzr, Operand(0xFFFFFFF8L)); __ Mov(w5, wcsp); // restore csp. @@ -290,10 +288,10 @@ TEST(stack_ops) { CHECK_EQUAL_64(0x1000, x0); CHECK_EQUAL_64(0x1050, x1); - CHECK_EQUAL_64(0x104f, x2); - CHECK_EQUAL_64(0x1fff, x3); - CHECK_EQUAL_64(0xfffffff8, x4); - CHECK_EQUAL_64(0xfffffff8, x5); + CHECK_EQUAL_64(0x104F, x2); + CHECK_EQUAL_64(0x1FFF, x3); + CHECK_EQUAL_64(0xFFFFFFF8, x4); + CHECK_EQUAL_64(0xFFFFFFF8, x5); TEARDOWN(); } @@ -304,8 +302,8 @@ TEST(mvn) { SETUP(); START(); - __ Mvn(w0, 0xfff); - __ Mvn(x1, 0xfff); + __ Mvn(w0, 0xFFF); + __ Mvn(x1, 0xFFF); __ Mvn(w2, Operand(w0, LSL, 1)); __ Mvn(x3, Operand(x1, LSL, 2)); __ Mvn(w4, Operand(w0, LSR, 3)); @@ -324,22 +322,22 @@ TEST(mvn) { RUN(); - CHECK_EQUAL_64(0xfffff000, x0); - CHECK_EQUAL_64(0xfffffffffffff000UL, x1); - CHECK_EQUAL_64(0x00001fff, x2); - CHECK_EQUAL_64(0x0000000000003fffUL, x3); - CHECK_EQUAL_64(0xe00001ff, x4); - CHECK_EQUAL_64(0xf0000000000000ffUL, x5); + CHECK_EQUAL_64(0xFFFFF000, x0); + CHECK_EQUAL_64(0xFFFFFFFFFFFFF000UL, x1); + CHECK_EQUAL_64(0x00001FFF, x2); + CHECK_EQUAL_64(0x0000000000003FFFUL, x3); + CHECK_EQUAL_64(0xE00001FF, x4); + CHECK_EQUAL_64(0xF0000000000000FFUL, x5); CHECK_EQUAL_64(0x00000001, x6); CHECK_EQUAL_64(0x0, x7); - CHECK_EQUAL_64(0x7ff80000, x8); - CHECK_EQUAL_64(0x3ffc000000000000UL, x9); - CHECK_EQUAL_64(0xffffff00, x10); + CHECK_EQUAL_64(0x7FF80000, x8); + CHECK_EQUAL_64(0x3FFC000000000000UL, x9); + CHECK_EQUAL_64(0xFFFFFF00, x10); CHECK_EQUAL_64(0x0000000000000001UL, x11); - CHECK_EQUAL_64(0xffff8003, x12); - CHECK_EQUAL_64(0xffffffffffff0007UL, x13); - CHECK_EQUAL_64(0xfffffffffffe000fUL, x14); - CHECK_EQUAL_64(0xfffffffffffe000fUL, x15); + CHECK_EQUAL_64(0xFFFF8003, x12); + CHECK_EQUAL_64(0xFFFFFFFFFFFF0007UL, x13); + CHECK_EQUAL_64(0xFFFFFFFFFFFE000FUL, x14); + CHECK_EQUAL_64(0xFFFFFFFFFFFE000FUL, x15); TEARDOWN(); } @@ -350,35 +348,35 @@ TEST(mov) { SETUP(); START(); - __ Mov(x0, 0xffffffffffffffffL); - __ Mov(x1, 0xffffffffffffffffL); - __ Mov(x2, 0xffffffffffffffffL); - __ Mov(x3, 0xffffffffffffffffL); + __ Mov(x0, 0xFFFFFFFFFFFFFFFFL); + __ Mov(x1, 0xFFFFFFFFFFFFFFFFL); + __ Mov(x2, 0xFFFFFFFFFFFFFFFFL); + __ Mov(x3, 0xFFFFFFFFFFFFFFFFL); - __ Mov(x0, 0x0123456789abcdefL); + __ Mov(x0, 0x0123456789ABCDEFL); - __ movz(x1, 0xabcdL << 16); - __ movk(x2, 0xabcdL << 32); - __ movn(x3, 0xabcdL << 48); + __ movz(x1, 0xABCDL << 16); + __ movk(x2, 0xABCDL << 32); + __ movn(x3, 0xABCDL << 48); - __ Mov(x4, 0x0123456789abcdefL); + __ Mov(x4, 0x0123456789ABCDEFL); __ Mov(x5, x4); __ Mov(w6, -1); // Test that moves back to the same register have the desired effect. This // is a no-op for X registers, and a truncation for W registers. - __ Mov(x7, 0x0123456789abcdefL); + __ Mov(x7, 0x0123456789ABCDEFL); __ Mov(x7, x7); - __ Mov(x8, 0x0123456789abcdefL); + __ Mov(x8, 0x0123456789ABCDEFL); __ Mov(w8, w8); - __ Mov(x9, 0x0123456789abcdefL); + __ Mov(x9, 0x0123456789ABCDEFL); __ Mov(x9, Operand(x9)); - __ Mov(x10, 0x0123456789abcdefL); + __ Mov(x10, 0x0123456789ABCDEFL); __ Mov(w10, Operand(w10)); - __ Mov(w11, 0xfff); - __ Mov(x12, 0xfff); + __ Mov(w11, 0xFFF); + __ Mov(x12, 0xFFF); __ Mov(w13, Operand(w11, LSL, 1)); __ Mov(x14, Operand(x12, LSL, 2)); __ Mov(w15, Operand(w11, LSR, 3)); @@ -396,31 +394,31 @@ TEST(mov) { RUN(); - CHECK_EQUAL_64(0x0123456789abcdefL, x0); - CHECK_EQUAL_64(0x00000000abcd0000L, x1); - CHECK_EQUAL_64(0xffffabcdffffffffL, x2); - CHECK_EQUAL_64(0x5432ffffffffffffL, x3); + CHECK_EQUAL_64(0x0123456789ABCDEFL, x0); + CHECK_EQUAL_64(0x00000000ABCD0000L, x1); + CHECK_EQUAL_64(0xFFFFABCDFFFFFFFFL, x2); + CHECK_EQUAL_64(0x5432FFFFFFFFFFFFL, x3); CHECK_EQUAL_64(x4, x5); CHECK_EQUAL_32(-1, w6); - CHECK_EQUAL_64(0x0123456789abcdefL, x7); - CHECK_EQUAL_32(0x89abcdefL, w8); - CHECK_EQUAL_64(0x0123456789abcdefL, x9); - CHECK_EQUAL_32(0x89abcdefL, w10); - CHECK_EQUAL_64(0x00000fff, x11); - CHECK_EQUAL_64(0x0000000000000fffUL, x12); - CHECK_EQUAL_64(0x00001ffe, x13); - CHECK_EQUAL_64(0x0000000000003ffcUL, x14); - CHECK_EQUAL_64(0x000001ff, x15); - CHECK_EQUAL_64(0x00000000000000ffUL, x18); + CHECK_EQUAL_64(0x0123456789ABCDEFL, x7); + CHECK_EQUAL_32(0x89ABCDEFL, w8); + CHECK_EQUAL_64(0x0123456789ABCDEFL, x9); + CHECK_EQUAL_32(0x89ABCDEFL, w10); + CHECK_EQUAL_64(0x00000FFF, x11); + CHECK_EQUAL_64(0x0000000000000FFFUL, x12); + CHECK_EQUAL_64(0x00001FFE, x13); + CHECK_EQUAL_64(0x0000000000003FFCUL, x14); + CHECK_EQUAL_64(0x000001FF, x15); + CHECK_EQUAL_64(0x00000000000000FFUL, x18); CHECK_EQUAL_64(0x00000001, x19); CHECK_EQUAL_64(0x0, x20); - CHECK_EQUAL_64(0x7ff80000, x21); - CHECK_EQUAL_64(0x3ffc000000000000UL, x22); - CHECK_EQUAL_64(0x000000fe, x23); - CHECK_EQUAL_64(0xfffffffffffffffcUL, x24); - CHECK_EQUAL_64(0x00007ff8, x25); - CHECK_EQUAL_64(0x000000000000fff0UL, x26); - CHECK_EQUAL_64(0x000000000001ffe0UL, x27); + CHECK_EQUAL_64(0x7FF80000, x21); + CHECK_EQUAL_64(0x3FFC000000000000UL, x22); + CHECK_EQUAL_64(0x000000FE, x23); + CHECK_EQUAL_64(0xFFFFFFFFFFFFFFFCUL, x24); + CHECK_EQUAL_64(0x00007FF8, x25); + CHECK_EQUAL_64(0x000000000000FFF0UL, x26); + CHECK_EQUAL_64(0x000000000001FFE0UL, x27); TEARDOWN(); } @@ -431,29 +429,29 @@ TEST(mov_imm_w) { SETUP(); START(); - __ Mov(w0, 0xffffffffL); - __ Mov(w1, 0xffff1234L); - __ Mov(w2, 0x1234ffffL); + __ Mov(w0, 0xFFFFFFFFL); + __ Mov(w1, 0xFFFF1234L); + __ Mov(w2, 0x1234FFFFL); __ Mov(w3, 0x00000000L); __ Mov(w4, 0x00001234L); __ Mov(w5, 0x12340000L); __ Mov(w6, 0x12345678L); __ Mov(w7, (int32_t)0x80000000); - __ Mov(w8, (int32_t)0xffff0000); + __ Mov(w8, (int32_t)0xFFFF0000); __ Mov(w9, kWMinInt); END(); RUN(); - CHECK_EQUAL_64(0xffffffffL, x0); - CHECK_EQUAL_64(0xffff1234L, x1); - CHECK_EQUAL_64(0x1234ffffL, x2); + CHECK_EQUAL_64(0xFFFFFFFFL, x0); + CHECK_EQUAL_64(0xFFFF1234L, x1); + CHECK_EQUAL_64(0x1234FFFFL, x2); CHECK_EQUAL_64(0x00000000L, x3); CHECK_EQUAL_64(0x00001234L, x4); CHECK_EQUAL_64(0x12340000L, x5); CHECK_EQUAL_64(0x12345678L, x6); CHECK_EQUAL_64(0x80000000L, x7); - CHECK_EQUAL_64(0xffff0000L, x8); + CHECK_EQUAL_64(0xFFFF0000L, x8); CHECK_EQUAL_32(kWMinInt, w9); TEARDOWN(); @@ -465,18 +463,18 @@ TEST(mov_imm_x) { SETUP(); START(); - __ Mov(x0, 0xffffffffffffffffL); - __ Mov(x1, 0xffffffffffff1234L); - __ Mov(x2, 0xffffffff12345678L); - __ Mov(x3, 0xffff1234ffff5678L); - __ Mov(x4, 0x1234ffffffff5678L); - __ Mov(x5, 0x1234ffff5678ffffL); - __ Mov(x6, 0x12345678ffffffffL); - __ Mov(x7, 0x1234ffffffffffffL); - __ Mov(x8, 0x123456789abcffffL); - __ Mov(x9, 0x12345678ffff9abcL); - __ Mov(x10, 0x1234ffff56789abcL); - __ Mov(x11, 0xffff123456789abcL); + __ Mov(x0, 0xFFFFFFFFFFFFFFFFL); + __ Mov(x1, 0xFFFFFFFFFFFF1234L); + __ Mov(x2, 0xFFFFFFFF12345678L); + __ Mov(x3, 0xFFFF1234FFFF5678L); + __ Mov(x4, 0x1234FFFFFFFF5678L); + __ Mov(x5, 0x1234FFFF5678FFFFL); + __ Mov(x6, 0x12345678FFFFFFFFL); + __ Mov(x7, 0x1234FFFFFFFFFFFFL); + __ Mov(x8, 0x123456789ABCFFFFL); + __ Mov(x9, 0x12345678FFFF9ABCL); + __ Mov(x10, 0x1234FFFF56789ABCL); + __ Mov(x11, 0xFFFF123456789ABCL); __ Mov(x12, 0x0000000000000000L); __ Mov(x13, 0x0000000000001234L); __ Mov(x14, 0x0000000012345678L); @@ -485,28 +483,28 @@ TEST(mov_imm_x) { __ Mov(x19, 0x1234000056780000L); __ Mov(x20, 0x1234567800000000L); __ Mov(x21, 0x1234000000000000L); - __ Mov(x22, 0x123456789abc0000L); - __ Mov(x23, 0x1234567800009abcL); - __ Mov(x24, 0x1234000056789abcL); - __ Mov(x25, 0x0000123456789abcL); - __ Mov(x26, 0x123456789abcdef0L); - __ Mov(x27, 0xffff000000000001L); - __ Mov(x28, 0x8000ffff00000000L); - END(); - - RUN(); - - CHECK_EQUAL_64(0xffffffffffff1234L, x1); - CHECK_EQUAL_64(0xffffffff12345678L, x2); - CHECK_EQUAL_64(0xffff1234ffff5678L, x3); - CHECK_EQUAL_64(0x1234ffffffff5678L, x4); - CHECK_EQUAL_64(0x1234ffff5678ffffL, x5); - CHECK_EQUAL_64(0x12345678ffffffffL, x6); - CHECK_EQUAL_64(0x1234ffffffffffffL, x7); - CHECK_EQUAL_64(0x123456789abcffffL, x8); - CHECK_EQUAL_64(0x12345678ffff9abcL, x9); - CHECK_EQUAL_64(0x1234ffff56789abcL, x10); - CHECK_EQUAL_64(0xffff123456789abcL, x11); + __ Mov(x22, 0x123456789ABC0000L); + __ Mov(x23, 0x1234567800009ABCL); + __ Mov(x24, 0x1234000056789ABCL); + __ Mov(x25, 0x0000123456789ABCL); + __ Mov(x26, 0x123456789ABCDEF0L); + __ Mov(x27, 0xFFFF000000000001L); + __ Mov(x28, 0x8000FFFF00000000L); + END(); + + RUN(); + + CHECK_EQUAL_64(0xFFFFFFFFFFFF1234L, x1); + CHECK_EQUAL_64(0xFFFFFFFF12345678L, x2); + CHECK_EQUAL_64(0xFFFF1234FFFF5678L, x3); + CHECK_EQUAL_64(0x1234FFFFFFFF5678L, x4); + CHECK_EQUAL_64(0x1234FFFF5678FFFFL, x5); + CHECK_EQUAL_64(0x12345678FFFFFFFFL, x6); + CHECK_EQUAL_64(0x1234FFFFFFFFFFFFL, x7); + CHECK_EQUAL_64(0x123456789ABCFFFFL, x8); + CHECK_EQUAL_64(0x12345678FFFF9ABCL, x9); + CHECK_EQUAL_64(0x1234FFFF56789ABCL, x10); + CHECK_EQUAL_64(0xFFFF123456789ABCL, x11); CHECK_EQUAL_64(0x0000000000000000L, x12); CHECK_EQUAL_64(0x0000000000001234L, x13); CHECK_EQUAL_64(0x0000000012345678L, x14); @@ -515,13 +513,13 @@ TEST(mov_imm_x) { CHECK_EQUAL_64(0x1234000056780000L, x19); CHECK_EQUAL_64(0x1234567800000000L, x20); CHECK_EQUAL_64(0x1234000000000000L, x21); - CHECK_EQUAL_64(0x123456789abc0000L, x22); - CHECK_EQUAL_64(0x1234567800009abcL, x23); - CHECK_EQUAL_64(0x1234000056789abcL, x24); - CHECK_EQUAL_64(0x0000123456789abcL, x25); - CHECK_EQUAL_64(0x123456789abcdef0L, x26); - CHECK_EQUAL_64(0xffff000000000001L, x27); - CHECK_EQUAL_64(0x8000ffff00000000L, x28); + CHECK_EQUAL_64(0x123456789ABC0000L, x22); + CHECK_EQUAL_64(0x1234567800009ABCL, x23); + CHECK_EQUAL_64(0x1234000056789ABCL, x24); + CHECK_EQUAL_64(0x0000123456789ABCL, x25); + CHECK_EQUAL_64(0x123456789ABCDEF0L, x26); + CHECK_EQUAL_64(0xFFFF000000000001L, x27); + CHECK_EQUAL_64(0x8000FFFF00000000L, x28); TEARDOWN(); } @@ -532,8 +530,8 @@ TEST(orr) { SETUP(); START(); - __ Mov(x0, 0xf0f0); - __ Mov(x1, 0xf00000ff); + __ Mov(x0, 0xF0F0); + __ Mov(x1, 0xF00000FF); __ Orr(x2, x0, Operand(x1)); __ Orr(w3, w0, Operand(w1, LSL, 28)); @@ -543,22 +541,22 @@ TEST(orr) { __ Orr(x7, x0, Operand(x1, ASR, 4)); __ Orr(w8, w0, Operand(w1, ROR, 12)); __ Orr(x9, x0, Operand(x1, ROR, 12)); - __ Orr(w10, w0, Operand(0xf)); - __ Orr(x11, x0, Operand(0xf0000000f0000000L)); + __ Orr(w10, w0, Operand(0xF)); + __ Orr(x11, x0, Operand(0xF0000000F0000000L)); END(); RUN(); - CHECK_EQUAL_64(0xf000f0ff, x2); - CHECK_EQUAL_64(0xf000f0f0, x3); - CHECK_EQUAL_64(0xf00000ff0000f0f0L, x4); - CHECK_EQUAL_64(0x0f00f0ff, x5); - CHECK_EQUAL_64(0xff00f0ff, x6); - CHECK_EQUAL_64(0x0f00f0ff, x7); - CHECK_EQUAL_64(0x0ffff0f0, x8); - CHECK_EQUAL_64(0x0ff00000000ff0f0L, x9); - CHECK_EQUAL_64(0xf0ff, x10); - CHECK_EQUAL_64(0xf0000000f000f0f0L, x11); + CHECK_EQUAL_64(0xF000F0FF, x2); + CHECK_EQUAL_64(0xF000F0F0, x3); + CHECK_EQUAL_64(0xF00000FF0000F0F0L, x4); + CHECK_EQUAL_64(0x0F00F0FF, x5); + CHECK_EQUAL_64(0xFF00F0FF, x6); + CHECK_EQUAL_64(0x0F00F0FF, x7); + CHECK_EQUAL_64(0x0FFFF0F0, x8); + CHECK_EQUAL_64(0x0FF00000000FF0F0L, x9); + CHECK_EQUAL_64(0xF0FF, x10); + CHECK_EQUAL_64(0xF0000000F000F0F0L, x11); TEARDOWN(); } @@ -587,9 +585,9 @@ TEST(orr_extend) { CHECK_EQUAL_64(0x00010101, x7); CHECK_EQUAL_64(0x00020201, x8); CHECK_EQUAL_64(0x0000000400040401UL, x9); - CHECK_EQUAL_64(0x00000000ffffff81UL, x10); - CHECK_EQUAL_64(0xffffffffffff0101UL, x11); - CHECK_EQUAL_64(0xfffffffe00020201UL, x12); + CHECK_EQUAL_64(0x00000000FFFFFF81UL, x10); + CHECK_EQUAL_64(0xFFFFFFFFFFFF0101UL, x11); + CHECK_EQUAL_64(0xFFFFFFFE00020201UL, x12); CHECK_EQUAL_64(0x0000000400040401UL, x13); TEARDOWN(); @@ -602,10 +600,10 @@ TEST(bitwise_wide_imm) { START(); __ Mov(x0, 0); - __ Mov(x1, 0xf0f0f0f0f0f0f0f0UL); + __ Mov(x1, 0xF0F0F0F0F0F0F0F0UL); - __ Orr(x10, x0, Operand(0x1234567890abcdefUL)); - __ Orr(w11, w1, Operand(0x90abcdef)); + __ Orr(x10, x0, Operand(0x1234567890ABCDEFUL)); + __ Orr(w11, w1, Operand(0x90ABCDEF)); __ Orr(w12, w0, kWMinInt); __ Eor(w13, w0, kWMinInt); @@ -614,9 +612,9 @@ TEST(bitwise_wide_imm) { RUN(); CHECK_EQUAL_64(0, x0); - CHECK_EQUAL_64(0xf0f0f0f0f0f0f0f0UL, x1); - CHECK_EQUAL_64(0x1234567890abcdefUL, x10); - CHECK_EQUAL_64(0xf0fbfdffUL, x11); + CHECK_EQUAL_64(0xF0F0F0F0F0F0F0F0UL, x1); + CHECK_EQUAL_64(0x1234567890ABCDEFUL, x10); + CHECK_EQUAL_64(0xF0FBFDFFUL, x11); CHECK_EQUAL_32(kWMinInt, w12); CHECK_EQUAL_32(kWMinInt, w13); @@ -629,8 +627,8 @@ TEST(orn) { SETUP(); START(); - __ Mov(x0, 0xf0f0); - __ Mov(x1, 0xf00000ff); + __ Mov(x0, 0xF0F0); + __ Mov(x1, 0xF00000FF); __ Orn(x2, x0, Operand(x1)); __ Orn(w3, w0, Operand(w1, LSL, 4)); @@ -640,22 +638,22 @@ TEST(orn) { __ Orn(x7, x0, Operand(x1, ASR, 1)); __ Orn(w8, w0, Operand(w1, ROR, 16)); __ Orn(x9, x0, Operand(x1, ROR, 16)); - __ Orn(w10, w0, Operand(0xffff)); - __ Orn(x11, x0, Operand(0xffff0000ffffL)); + __ Orn(w10, w0, Operand(0xFFFF)); + __ Orn(x11, x0, Operand(0xFFFF0000FFFFL)); END(); RUN(); - CHECK_EQUAL_64(0xffffffff0ffffff0L, x2); - CHECK_EQUAL_64(0xfffff0ff, x3); - CHECK_EQUAL_64(0xfffffff0fffff0ffL, x4); - CHECK_EQUAL_64(0xffffffff87fffff0L, x5); - CHECK_EQUAL_64(0x07fffff0, x6); - CHECK_EQUAL_64(0xffffffff87fffff0L, x7); - CHECK_EQUAL_64(0xff00ffff, x8); - CHECK_EQUAL_64(0xff00ffffffffffffL, x9); - CHECK_EQUAL_64(0xfffff0f0, x10); - CHECK_EQUAL_64(0xffff0000fffff0f0L, x11); + CHECK_EQUAL_64(0xFFFFFFFF0FFFFFF0L, x2); + CHECK_EQUAL_64(0xFFFFF0FF, x3); + CHECK_EQUAL_64(0xFFFFFFF0FFFFF0FFL, x4); + CHECK_EQUAL_64(0xFFFFFFFF87FFFFF0L, x5); + CHECK_EQUAL_64(0x07FFFFF0, x6); + CHECK_EQUAL_64(0xFFFFFFFF87FFFFF0L, x7); + CHECK_EQUAL_64(0xFF00FFFF, x8); + CHECK_EQUAL_64(0xFF00FFFFFFFFFFFFL, x9); + CHECK_EQUAL_64(0xFFFFF0F0, x10); + CHECK_EQUAL_64(0xFFFF0000FFFFF0F0L, x11); TEARDOWN(); } @@ -680,14 +678,14 @@ TEST(orn_extend) { RUN(); - CHECK_EQUAL_64(0xffffff7f, x6); - CHECK_EQUAL_64(0xfffffffffffefefdUL, x7); - CHECK_EQUAL_64(0xfffdfdfb, x8); - CHECK_EQUAL_64(0xfffffffbfffbfbf7UL, x9); - CHECK_EQUAL_64(0x0000007f, x10); - CHECK_EQUAL_64(0x0000fefd, x11); - CHECK_EQUAL_64(0x00000001fffdfdfbUL, x12); - CHECK_EQUAL_64(0xfffffffbfffbfbf7UL, x13); + CHECK_EQUAL_64(0xFFFFFF7F, x6); + CHECK_EQUAL_64(0xFFFFFFFFFFFEFEFDUL, x7); + CHECK_EQUAL_64(0xFFFDFDFB, x8); + CHECK_EQUAL_64(0xFFFFFFFBFFFBFBF7UL, x9); + CHECK_EQUAL_64(0x0000007F, x10); + CHECK_EQUAL_64(0x0000FEFD, x11); + CHECK_EQUAL_64(0x00000001FFFDFDFBUL, x12); + CHECK_EQUAL_64(0xFFFFFFFBFFFBFBF7UL, x13); TEARDOWN(); } @@ -698,8 +696,8 @@ TEST(and_) { SETUP(); START(); - __ Mov(x0, 0xfff0); - __ Mov(x1, 0xf00000ff); + __ Mov(x0, 0xFFF0); + __ Mov(x1, 0xF00000FF); __ And(x2, x0, Operand(x1)); __ And(w3, w0, Operand(w1, LSL, 4)); @@ -709,22 +707,22 @@ TEST(and_) { __ And(x7, x0, Operand(x1, ASR, 20)); __ And(w8, w0, Operand(w1, ROR, 28)); __ And(x9, x0, Operand(x1, ROR, 28)); - __ And(w10, w0, Operand(0xff00)); - __ And(x11, x0, Operand(0xff)); + __ And(w10, w0, Operand(0xFF00)); + __ And(x11, x0, Operand(0xFF)); END(); RUN(); - CHECK_EQUAL_64(0x000000f0, x2); - CHECK_EQUAL_64(0x00000ff0, x3); - CHECK_EQUAL_64(0x00000ff0, x4); + CHECK_EQUAL_64(0x000000F0, x2); + CHECK_EQUAL_64(0x00000FF0, x3); + CHECK_EQUAL_64(0x00000FF0, x4); CHECK_EQUAL_64(0x00000070, x5); - CHECK_EQUAL_64(0x0000ff00, x6); - CHECK_EQUAL_64(0x00000f00, x7); - CHECK_EQUAL_64(0x00000ff0, x8); + CHECK_EQUAL_64(0x0000FF00, x6); + CHECK_EQUAL_64(0x00000F00, x7); + CHECK_EQUAL_64(0x00000FF0, x8); CHECK_EQUAL_64(0x00000000, x9); - CHECK_EQUAL_64(0x0000ff00, x10); - CHECK_EQUAL_64(0x000000f0, x11); + CHECK_EQUAL_64(0x0000FF00, x10); + CHECK_EQUAL_64(0x000000F0, x11); TEARDOWN(); } @@ -735,7 +733,7 @@ TEST(and_extend) { SETUP(); START(); - __ Mov(x0, 0xffffffffffffffffUL); + __ Mov(x0, 0xFFFFFFFFFFFFFFFFUL); __ Mov(x1, 0x8000000080008081UL); __ And(w6, w0, Operand(w1, UXTB)); __ And(x7, x0, Operand(x1, UXTH, 1)); @@ -753,9 +751,9 @@ TEST(and_extend) { CHECK_EQUAL_64(0x00010102, x7); CHECK_EQUAL_64(0x00020204, x8); CHECK_EQUAL_64(0x0000000400040408UL, x9); - CHECK_EQUAL_64(0xffffff81, x10); - CHECK_EQUAL_64(0xffffffffffff0102UL, x11); - CHECK_EQUAL_64(0xfffffffe00020204UL, x12); + CHECK_EQUAL_64(0xFFFFFF81, x10); + CHECK_EQUAL_64(0xFFFFFFFFFFFF0102UL, x11); + CHECK_EQUAL_64(0xFFFFFFFE00020204UL, x12); CHECK_EQUAL_64(0x0000000400040408UL, x13); TEARDOWN(); @@ -767,18 +765,18 @@ TEST(ands) { SETUP(); START(); - __ Mov(x1, 0xf00000ff); + __ Mov(x1, 0xF00000FF); __ Ands(w0, w1, Operand(w1)); END(); RUN(); CHECK_EQUAL_NZCV(NFlag); - CHECK_EQUAL_64(0xf00000ff, x0); + CHECK_EQUAL_64(0xF00000FF, x0); START(); - __ Mov(x0, 0xfff0); - __ Mov(x1, 0xf00000ff); + __ Mov(x0, 0xFFF0); + __ Mov(x1, 0xF00000FF); __ Ands(w0, w0, Operand(w1, LSR, 4)); END(); @@ -799,8 +797,8 @@ TEST(ands) { CHECK_EQUAL_64(0x8000000000000000L, x0); START(); - __ Mov(x0, 0xfff0); - __ Ands(w0, w0, Operand(0xf)); + __ Mov(x0, 0xFFF0); + __ Ands(w0, w0, Operand(0xF)); END(); RUN(); @@ -809,7 +807,7 @@ TEST(ands) { CHECK_EQUAL_64(0x00000000, x0); START(); - __ Mov(x0, 0xff000000); + __ Mov(x0, 0xFF000000); __ Ands(w0, w0, Operand(0x80000000)); END(); @@ -827,8 +825,8 @@ TEST(bic) { SETUP(); START(); - __ Mov(x0, 0xfff0); - __ Mov(x1, 0xf00000ff); + __ Mov(x0, 0xFFF0); + __ Mov(x1, 0xF00000FF); __ Bic(x2, x0, Operand(x1)); __ Bic(w3, w0, Operand(w1, LSL, 4)); @@ -838,34 +836,32 @@ TEST(bic) { __ Bic(x7, x0, Operand(x1, ASR, 20)); __ Bic(w8, w0, Operand(w1, ROR, 28)); __ Bic(x9, x0, Operand(x1, ROR, 24)); - __ Bic(x10, x0, Operand(0x1f)); + __ Bic(x10, x0, Operand(0x1F)); __ Bic(x11, x0, Operand(0x100)); // Test bic into csp when the constant cannot be encoded in the immediate // field. // Use x20 to preserve csp. We check for the result via x21 because the // test infrastructure requires that csp be restored to its original value. - __ SetStackPointer(jssp); // Change stack pointer to avoid consistency check. __ Mov(x20, csp); - __ Mov(x0, 0xffffff); - __ Bic(csp, x0, Operand(0xabcdef)); + __ Mov(x0, 0xFFFFFF); + __ Bic(csp, x0, Operand(0xABCDEF)); __ Mov(x21, csp); __ Mov(csp, x20); - __ SetStackPointer(csp); // Restore stack pointer. END(); RUN(); - CHECK_EQUAL_64(0x0000ff00, x2); - CHECK_EQUAL_64(0x0000f000, x3); - CHECK_EQUAL_64(0x0000f000, x4); - CHECK_EQUAL_64(0x0000ff80, x5); - CHECK_EQUAL_64(0x000000f0, x6); - CHECK_EQUAL_64(0x0000f0f0, x7); - CHECK_EQUAL_64(0x0000f000, x8); - CHECK_EQUAL_64(0x0000ff00, x9); - CHECK_EQUAL_64(0x0000ffe0, x10); - CHECK_EQUAL_64(0x0000fef0, x11); + CHECK_EQUAL_64(0x0000FF00, x2); + CHECK_EQUAL_64(0x0000F000, x3); + CHECK_EQUAL_64(0x0000F000, x4); + CHECK_EQUAL_64(0x0000FF80, x5); + CHECK_EQUAL_64(0x000000F0, x6); + CHECK_EQUAL_64(0x0000F0F0, x7); + CHECK_EQUAL_64(0x0000F000, x8); + CHECK_EQUAL_64(0x0000FF00, x9); + CHECK_EQUAL_64(0x0000FFE0, x10); + CHECK_EQUAL_64(0x0000FEF0, x11); CHECK_EQUAL_64(0x543210, x21); @@ -878,7 +874,7 @@ TEST(bic_extend) { SETUP(); START(); - __ Mov(x0, 0xffffffffffffffffUL); + __ Mov(x0, 0xFFFFFFFFFFFFFFFFUL); __ Mov(x1, 0x8000000080008081UL); __ Bic(w6, w0, Operand(w1, UXTB)); __ Bic(x7, x0, Operand(x1, UXTH, 1)); @@ -892,14 +888,14 @@ TEST(bic_extend) { RUN(); - CHECK_EQUAL_64(0xffffff7e, x6); - CHECK_EQUAL_64(0xfffffffffffefefdUL, x7); - CHECK_EQUAL_64(0xfffdfdfb, x8); - CHECK_EQUAL_64(0xfffffffbfffbfbf7UL, x9); - CHECK_EQUAL_64(0x0000007e, x10); - CHECK_EQUAL_64(0x0000fefd, x11); - CHECK_EQUAL_64(0x00000001fffdfdfbUL, x12); - CHECK_EQUAL_64(0xfffffffbfffbfbf7UL, x13); + CHECK_EQUAL_64(0xFFFFFF7E, x6); + CHECK_EQUAL_64(0xFFFFFFFFFFFEFEFDUL, x7); + CHECK_EQUAL_64(0xFFFDFDFB, x8); + CHECK_EQUAL_64(0xFFFFFFFBFFFBFBF7UL, x9); + CHECK_EQUAL_64(0x0000007E, x10); + CHECK_EQUAL_64(0x0000FEFD, x11); + CHECK_EQUAL_64(0x00000001FFFDFDFBUL, x12); + CHECK_EQUAL_64(0xFFFFFFFBFFFBFBF7UL, x13); TEARDOWN(); } @@ -910,7 +906,7 @@ TEST(bics) { SETUP(); START(); - __ Mov(x1, 0xffff); + __ Mov(x1, 0xFFFF); __ Bics(w0, w1, Operand(w1)); END(); @@ -920,7 +916,7 @@ TEST(bics) { CHECK_EQUAL_64(0x00000000, x0); START(); - __ Mov(x0, 0xffffffff); + __ Mov(x0, 0xFFFFFFFF); __ Bics(w0, w0, Operand(w0, LSR, 1)); END(); @@ -941,8 +937,8 @@ TEST(bics) { CHECK_EQUAL_64(0x00000000, x0); START(); - __ Mov(x0, 0xffffffffffffffffL); - __ Bics(x0, x0, Operand(0x7fffffffffffffffL)); + __ Mov(x0, 0xFFFFFFFFFFFFFFFFL); + __ Bics(x0, x0, Operand(0x7FFFFFFFFFFFFFFFL)); END(); RUN(); @@ -951,8 +947,8 @@ TEST(bics) { CHECK_EQUAL_64(0x8000000000000000L, x0); START(); - __ Mov(w0, 0xffff0000); - __ Bics(w0, w0, Operand(0xfffffff0)); + __ Mov(w0, 0xFFFF0000); + __ Bics(w0, w0, Operand(0xFFFFFFF0)); END(); RUN(); @@ -969,8 +965,8 @@ TEST(eor) { SETUP(); START(); - __ Mov(x0, 0xfff0); - __ Mov(x1, 0xf00000ff); + __ Mov(x0, 0xFFF0); + __ Mov(x1, 0xF00000FF); __ Eor(x2, x0, Operand(x1)); __ Eor(w3, w0, Operand(w1, LSL, 4)); @@ -980,22 +976,22 @@ TEST(eor) { __ Eor(x7, x0, Operand(x1, ASR, 20)); __ Eor(w8, w0, Operand(w1, ROR, 28)); __ Eor(x9, x0, Operand(x1, ROR, 28)); - __ Eor(w10, w0, Operand(0xff00ff00)); - __ Eor(x11, x0, Operand(0xff00ff00ff00ff00L)); + __ Eor(w10, w0, Operand(0xFF00FF00)); + __ Eor(x11, x0, Operand(0xFF00FF00FF00FF00L)); END(); RUN(); - CHECK_EQUAL_64(0xf000ff0f, x2); - CHECK_EQUAL_64(0x0000f000, x3); - CHECK_EQUAL_64(0x0000000f0000f000L, x4); - CHECK_EQUAL_64(0x7800ff8f, x5); - CHECK_EQUAL_64(0xffff00f0, x6); - CHECK_EQUAL_64(0x0000f0f0, x7); - CHECK_EQUAL_64(0x0000f00f, x8); - CHECK_EQUAL_64(0x00000ff00000ffffL, x9); - CHECK_EQUAL_64(0xff0000f0, x10); - CHECK_EQUAL_64(0xff00ff00ff0000f0L, x11); + CHECK_EQUAL_64(0xF000FF0F, x2); + CHECK_EQUAL_64(0x0000F000, x3); + CHECK_EQUAL_64(0x0000000F0000F000L, x4); + CHECK_EQUAL_64(0x7800FF8F, x5); + CHECK_EQUAL_64(0xFFFF00F0, x6); + CHECK_EQUAL_64(0x0000F0F0, x7); + CHECK_EQUAL_64(0x0000F00F, x8); + CHECK_EQUAL_64(0x00000FF00000FFFFL, x9); + CHECK_EQUAL_64(0xFF0000F0, x10); + CHECK_EQUAL_64(0xFF00FF00FF0000F0L, x11); TEARDOWN(); } @@ -1024,9 +1020,9 @@ TEST(eor_extend) { CHECK_EQUAL_64(0x1111111111101013UL, x7); CHECK_EQUAL_64(0x11131315, x8); CHECK_EQUAL_64(0x1111111511151519UL, x9); - CHECK_EQUAL_64(0xeeeeee90, x10); - CHECK_EQUAL_64(0xeeeeeeeeeeee1013UL, x11); - CHECK_EQUAL_64(0xeeeeeeef11131315UL, x12); + CHECK_EQUAL_64(0xEEEEEE90, x10); + CHECK_EQUAL_64(0xEEEEEEEEEEEE1013UL, x11); + CHECK_EQUAL_64(0xEEEEEEEF11131315UL, x12); CHECK_EQUAL_64(0x1111111511151519UL, x13); TEARDOWN(); @@ -1038,8 +1034,8 @@ TEST(eon) { SETUP(); START(); - __ Mov(x0, 0xfff0); - __ Mov(x1, 0xf00000ff); + __ Mov(x0, 0xFFF0); + __ Mov(x1, 0xF00000FF); __ Eon(x2, x0, Operand(x1)); __ Eon(w3, w0, Operand(w1, LSL, 4)); @@ -1049,22 +1045,22 @@ TEST(eon) { __ Eon(x7, x0, Operand(x1, ASR, 20)); __ Eon(w8, w0, Operand(w1, ROR, 28)); __ Eon(x9, x0, Operand(x1, ROR, 28)); - __ Eon(w10, w0, Operand(0x03c003c0)); + __ Eon(w10, w0, Operand(0x03C003C0)); __ Eon(x11, x0, Operand(0x0000100000001000L)); END(); RUN(); - CHECK_EQUAL_64(0xffffffff0fff00f0L, x2); - CHECK_EQUAL_64(0xffff0fff, x3); - CHECK_EQUAL_64(0xfffffff0ffff0fffL, x4); - CHECK_EQUAL_64(0xffffffff87ff0070L, x5); - CHECK_EQUAL_64(0x0000ff0f, x6); - CHECK_EQUAL_64(0xffffffffffff0f0fL, x7); - CHECK_EQUAL_64(0xffff0ff0, x8); - CHECK_EQUAL_64(0xfffff00fffff0000L, x9); - CHECK_EQUAL_64(0xfc3f03cf, x10); - CHECK_EQUAL_64(0xffffefffffff100fL, x11); + CHECK_EQUAL_64(0xFFFFFFFF0FFF00F0L, x2); + CHECK_EQUAL_64(0xFFFF0FFF, x3); + CHECK_EQUAL_64(0xFFFFFFF0FFFF0FFFL, x4); + CHECK_EQUAL_64(0xFFFFFFFF87FF0070L, x5); + CHECK_EQUAL_64(0x0000FF0F, x6); + CHECK_EQUAL_64(0xFFFFFFFFFFFF0F0FL, x7); + CHECK_EQUAL_64(0xFFFF0FF0, x8); + CHECK_EQUAL_64(0xFFFFF00FFFFF0000L, x9); + CHECK_EQUAL_64(0xFC3F03CF, x10); + CHECK_EQUAL_64(0xFFFFEFFFFFFF100FL, x11); TEARDOWN(); } @@ -1089,14 +1085,14 @@ TEST(eon_extend) { RUN(); - CHECK_EQUAL_64(0xeeeeee6f, x6); - CHECK_EQUAL_64(0xeeeeeeeeeeefefecUL, x7); - CHECK_EQUAL_64(0xeeececea, x8); - CHECK_EQUAL_64(0xeeeeeeeaeeeaeae6UL, x9); - CHECK_EQUAL_64(0x1111116f, x10); - CHECK_EQUAL_64(0x111111111111efecUL, x11); - CHECK_EQUAL_64(0x11111110eeececeaUL, x12); - CHECK_EQUAL_64(0xeeeeeeeaeeeaeae6UL, x13); + CHECK_EQUAL_64(0xEEEEEE6F, x6); + CHECK_EQUAL_64(0xEEEEEEEEEEEFEFECUL, x7); + CHECK_EQUAL_64(0xEEECECEA, x8); + CHECK_EQUAL_64(0xEEEEEEEAEEEAEAE6UL, x9); + CHECK_EQUAL_64(0x1111116F, x10); + CHECK_EQUAL_64(0x111111111111EFECUL, x11); + CHECK_EQUAL_64(0x11111110EEECECEAUL, x12); + CHECK_EQUAL_64(0xEEEEEEEAEEEAEAE6UL, x13); TEARDOWN(); } @@ -1109,8 +1105,8 @@ TEST(mul) { START(); __ Mov(x16, 0); __ Mov(x17, 1); - __ Mov(x18, 0xffffffff); - __ Mov(x19, 0xffffffffffffffffUL); + __ Mov(x18, 0xFFFFFFFF); + __ Mov(x19, 0xFFFFFFFFFFFFFFFFUL); __ Mul(w0, w16, w16); __ Mul(w1, w16, w17); @@ -1137,23 +1133,23 @@ TEST(mul) { CHECK_EQUAL_64(0, x0); CHECK_EQUAL_64(0, x1); - CHECK_EQUAL_64(0xffffffff, x2); + CHECK_EQUAL_64(0xFFFFFFFF, x2); CHECK_EQUAL_64(1, x3); CHECK_EQUAL_64(0, x4); - CHECK_EQUAL_64(0xffffffff, x5); - CHECK_EQUAL_64(0xffffffff00000001UL, x6); + CHECK_EQUAL_64(0xFFFFFFFF, x5); + CHECK_EQUAL_64(0xFFFFFFFF00000001UL, x6); CHECK_EQUAL_64(1, x7); - CHECK_EQUAL_64(0xffffffffffffffffUL, x8); + CHECK_EQUAL_64(0xFFFFFFFFFFFFFFFFUL, x8); CHECK_EQUAL_64(1, x9); CHECK_EQUAL_64(1, x10); CHECK_EQUAL_64(0, x11); CHECK_EQUAL_64(0, x12); CHECK_EQUAL_64(1, x13); - CHECK_EQUAL_64(0xffffffff, x14); + CHECK_EQUAL_64(0xFFFFFFFF, x14); CHECK_EQUAL_64(0, x20); - CHECK_EQUAL_64(0xffffffff00000001UL, x21); - CHECK_EQUAL_64(0xffffffff, x22); - CHECK_EQUAL_64(0xffffffffffffffffUL, x23); + CHECK_EQUAL_64(0xFFFFFFFF00000001UL, x21); + CHECK_EQUAL_64(0xFFFFFFFF, x22); + CHECK_EQUAL_64(0xFFFFFFFFFFFFFFFFUL, x23); TEARDOWN(); } @@ -1178,7 +1174,7 @@ TEST(smull) { SmullHelper(1, 1, 1); SmullHelper(-1, -1, 1); SmullHelper(1, -1, -1); - SmullHelper(0xffffffff80000000, 0x80000000, 1); + SmullHelper(0xFFFFFFFF80000000, 0x80000000, 1); SmullHelper(0x0000000080000000, 0x00010000, 0x00008000); } @@ -1190,8 +1186,8 @@ TEST(madd) { START(); __ Mov(x16, 0); __ Mov(x17, 1); - __ Mov(x18, 0xffffffff); - __ Mov(x19, 0xffffffffffffffffUL); + __ Mov(x18, 0xFFFFFFFF); + __ Mov(x19, 0xFFFFFFFFFFFFFFFFUL); __ Madd(w0, w16, w16, w16); __ Madd(w1, w16, w16, w17); @@ -1225,27 +1221,27 @@ TEST(madd) { CHECK_EQUAL_64(0, x0); CHECK_EQUAL_64(1, x1); - CHECK_EQUAL_64(0xffffffff, x2); - CHECK_EQUAL_64(0xffffffff, x3); + CHECK_EQUAL_64(0xFFFFFFFF, x2); + CHECK_EQUAL_64(0xFFFFFFFF, x3); CHECK_EQUAL_64(1, x4); CHECK_EQUAL_64(0, x5); CHECK_EQUAL_64(0, x6); - CHECK_EQUAL_64(0xffffffff, x7); - CHECK_EQUAL_64(0xfffffffe, x8); + CHECK_EQUAL_64(0xFFFFFFFF, x7); + CHECK_EQUAL_64(0xFFFFFFFE, x8); CHECK_EQUAL_64(2, x9); CHECK_EQUAL_64(0, x10); CHECK_EQUAL_64(0, x11); CHECK_EQUAL_64(0, x12); CHECK_EQUAL_64(1, x13); - CHECK_EQUAL_64(0xffffffff, x14); - CHECK_EQUAL_64(0xffffffffffffffff, x15); + CHECK_EQUAL_64(0xFFFFFFFF, x14); + CHECK_EQUAL_64(0xFFFFFFFFFFFFFFFF, x15); CHECK_EQUAL_64(1, x20); CHECK_EQUAL_64(0x100000000UL, x21); CHECK_EQUAL_64(0, x22); - CHECK_EQUAL_64(0xffffffff, x23); - CHECK_EQUAL_64(0x1fffffffe, x24); - CHECK_EQUAL_64(0xfffffffe00000002UL, x25); + CHECK_EQUAL_64(0xFFFFFFFF, x23); + CHECK_EQUAL_64(0x1FFFFFFFE, x24); + CHECK_EQUAL_64(0xFFFFFFFE00000002UL, x25); CHECK_EQUAL_64(0, x26); CHECK_EQUAL_64(0, x27); @@ -1260,8 +1256,8 @@ TEST(msub) { START(); __ Mov(x16, 0); __ Mov(x17, 1); - __ Mov(x18, 0xffffffff); - __ Mov(x19, 0xffffffffffffffffUL); + __ Mov(x18, 0xFFFFFFFF); + __ Mov(x19, 0xFFFFFFFFFFFFFFFFUL); __ Msub(w0, w16, w16, w16); __ Msub(w1, w16, w16, w17); @@ -1295,29 +1291,29 @@ TEST(msub) { CHECK_EQUAL_64(0, x0); CHECK_EQUAL_64(1, x1); - CHECK_EQUAL_64(0xffffffff, x2); - CHECK_EQUAL_64(0xffffffff, x3); + CHECK_EQUAL_64(0xFFFFFFFF, x2); + CHECK_EQUAL_64(0xFFFFFFFF, x3); CHECK_EQUAL_64(1, x4); - CHECK_EQUAL_64(0xfffffffe, x5); - CHECK_EQUAL_64(0xfffffffe, x6); + CHECK_EQUAL_64(0xFFFFFFFE, x5); + CHECK_EQUAL_64(0xFFFFFFFE, x6); CHECK_EQUAL_64(1, x7); CHECK_EQUAL_64(0, x8); CHECK_EQUAL_64(0, x9); - CHECK_EQUAL_64(0xfffffffe, x10); - CHECK_EQUAL_64(0xfffffffe, x11); + CHECK_EQUAL_64(0xFFFFFFFE, x10); + CHECK_EQUAL_64(0xFFFFFFFE, x11); CHECK_EQUAL_64(0, x12); CHECK_EQUAL_64(1, x13); - CHECK_EQUAL_64(0xffffffff, x14); - CHECK_EQUAL_64(0xffffffffffffffffUL, x15); + CHECK_EQUAL_64(0xFFFFFFFF, x14); + CHECK_EQUAL_64(0xFFFFFFFFFFFFFFFFUL, x15); CHECK_EQUAL_64(1, x20); - CHECK_EQUAL_64(0xfffffffeUL, x21); - CHECK_EQUAL_64(0xfffffffffffffffeUL, x22); - CHECK_EQUAL_64(0xffffffff00000001UL, x23); + CHECK_EQUAL_64(0xFFFFFFFEUL, x21); + CHECK_EQUAL_64(0xFFFFFFFFFFFFFFFEUL, x22); + CHECK_EQUAL_64(0xFFFFFFFF00000001UL, x23); CHECK_EQUAL_64(0, x24); CHECK_EQUAL_64(0x200000000UL, x25); - CHECK_EQUAL_64(0x1fffffffeUL, x26); - CHECK_EQUAL_64(0xfffffffffffffffeUL, x27); + CHECK_EQUAL_64(0x1FFFFFFFEUL, x26); + CHECK_EQUAL_64(0xFFFFFFFFFFFFFFFEUL, x27); TEARDOWN(); } @@ -1332,12 +1328,12 @@ TEST(smulh) { __ Mov(x21, 1); __ Mov(x22, 0x0000000100000000L); __ Mov(x23, 0x12345678); - __ Mov(x24, 0x0123456789abcdefL); + __ Mov(x24, 0x0123456789ABCDEFL); __ Mov(x25, 0x0000000200000000L); __ Mov(x26, 0x8000000000000000UL); - __ Mov(x27, 0xffffffffffffffffUL); + __ Mov(x27, 0xFFFFFFFFFFFFFFFFUL); __ Mov(x28, 0x5555555555555555UL); - __ Mov(x29, 0xaaaaaaaaaaaaaaaaUL); + __ Mov(x29, 0xAAAAAAAAAAAAAAAAUL); __ Smulh(x0, x20, x24); __ Smulh(x1, x21, x24); @@ -1359,14 +1355,14 @@ TEST(smulh) { CHECK_EQUAL_64(0, x1); CHECK_EQUAL_64(0, x2); CHECK_EQUAL_64(0x01234567, x3); - CHECK_EQUAL_64(0x02468acf, x4); - CHECK_EQUAL_64(0xffffffffffffffffUL, x5); + CHECK_EQUAL_64(0x02468ACF, x4); + CHECK_EQUAL_64(0xFFFFFFFFFFFFFFFFUL, x5); CHECK_EQUAL_64(0x4000000000000000UL, x6); CHECK_EQUAL_64(0, x7); CHECK_EQUAL_64(0, x8); - CHECK_EQUAL_64(0x1c71c71c71c71c71UL, x9); - CHECK_EQUAL_64(0xe38e38e38e38e38eUL, x10); - CHECK_EQUAL_64(0x1c71c71c71c71c72UL, x11); + CHECK_EQUAL_64(0x1C71C71C71C71C71UL, x9); + CHECK_EQUAL_64(0xE38E38E38E38E38EUL, x10); + CHECK_EQUAL_64(0x1C71C71C71C71C72UL, x11); TEARDOWN(); } @@ -1378,8 +1374,8 @@ TEST(smaddl_umaddl) { START(); __ Mov(x17, 1); - __ Mov(x18, 0xffffffff); - __ Mov(x19, 0xffffffffffffffffUL); + __ Mov(x18, 0xFFFFFFFF); + __ Mov(x19, 0xFFFFFFFFFFFFFFFFUL); __ Mov(x20, 4); __ Mov(x21, 0x200000000UL); @@ -1400,8 +1396,8 @@ TEST(smaddl_umaddl) { CHECK_EQUAL_64(5, x11); CHECK_EQUAL_64(0x200000001UL, x12); CHECK_EQUAL_64(0x100000003UL, x13); - CHECK_EQUAL_64(0xfffffffe00000005UL, x14); - CHECK_EQUAL_64(0xfffffffe00000005UL, x15); + CHECK_EQUAL_64(0xFFFFFFFE00000005UL, x14); + CHECK_EQUAL_64(0xFFFFFFFE00000005UL, x15); CHECK_EQUAL_64(0x1, x22); TEARDOWN(); @@ -1414,8 +1410,8 @@ TEST(smsubl_umsubl) { START(); __ Mov(x17, 1); - __ Mov(x18, 0xffffffff); - __ Mov(x19, 0xffffffffffffffffUL); + __ Mov(x18, 0xFFFFFFFF); + __ Mov(x19, 0xFFFFFFFFFFFFFFFFUL); __ Mov(x20, 4); __ Mov(x21, 0x200000000UL); @@ -1434,11 +1430,11 @@ TEST(smsubl_umsubl) { CHECK_EQUAL_64(5, x9); CHECK_EQUAL_64(3, x10); CHECK_EQUAL_64(3, x11); - CHECK_EQUAL_64(0x1ffffffffUL, x12); - CHECK_EQUAL_64(0xffffffff00000005UL, x13); + CHECK_EQUAL_64(0x1FFFFFFFFUL, x12); + CHECK_EQUAL_64(0xFFFFFFFF00000005UL, x13); CHECK_EQUAL_64(0x200000003UL, x14); CHECK_EQUAL_64(0x200000003UL, x15); - CHECK_EQUAL_64(0x3ffffffffUL, x22); + CHECK_EQUAL_64(0x3FFFFFFFFUL, x22); TEARDOWN(); } @@ -1450,8 +1446,8 @@ TEST(div) { START(); __ Mov(x16, 1); - __ Mov(x17, 0xffffffff); - __ Mov(x18, 0xffffffffffffffffUL); + __ Mov(x17, 0xFFFFFFFF); + __ Mov(x18, 0xFFFFFFFFFFFFFFFFUL); __ Mov(x19, 0x80000000); __ Mov(x20, 0x8000000000000000UL); __ Mov(x21, 2); @@ -1495,15 +1491,15 @@ TEST(div) { RUN(); CHECK_EQUAL_64(1, x0); - CHECK_EQUAL_64(0xffffffff, x1); + CHECK_EQUAL_64(0xFFFFFFFF, x1); CHECK_EQUAL_64(1, x2); - CHECK_EQUAL_64(0xffffffff, x3); + CHECK_EQUAL_64(0xFFFFFFFF, x3); CHECK_EQUAL_64(1, x4); CHECK_EQUAL_64(1, x5); CHECK_EQUAL_64(0, x6); CHECK_EQUAL_64(1, x7); CHECK_EQUAL_64(0, x8); - CHECK_EQUAL_64(0xffffffff00000001UL, x9); + CHECK_EQUAL_64(0xFFFFFFFF00000001UL, x9); CHECK_EQUAL_64(0x40000000, x10); CHECK_EQUAL_64(0xC0000000, x11); CHECK_EQUAL_64(0x40000000, x12); @@ -1516,7 +1512,7 @@ TEST(div) { CHECK_EQUAL_64(0x8000000000000000UL, x25); CHECK_EQUAL_64(0, x26); CHECK_EQUAL_64(0, x27); - CHECK_EQUAL_64(0x7fffffffffffffffUL, x28); + CHECK_EQUAL_64(0x7FFFFFFFFFFFFFFFUL, x28); CHECK_EQUAL_64(0, x29); CHECK_EQUAL_64(0, x18); CHECK_EQUAL_64(0, x19); @@ -1532,7 +1528,7 @@ TEST(rbit_rev) { SETUP(); START(); - __ Mov(x24, 0xfedcba9876543210UL); + __ Mov(x24, 0xFEDCBA9876543210UL); __ Rbit(w0, w24); __ Rbit(x1, x24); __ Rev16(w2, w24); @@ -1544,13 +1540,13 @@ TEST(rbit_rev) { RUN(); - CHECK_EQUAL_64(0x084c2a6e, x0); - CHECK_EQUAL_64(0x084c2a6e195d3b7fUL, x1); + CHECK_EQUAL_64(0x084C2A6E, x0); + CHECK_EQUAL_64(0x084C2A6E195D3B7FUL, x1); CHECK_EQUAL_64(0x54761032, x2); - CHECK_EQUAL_64(0xdcfe98ba54761032UL, x3); + CHECK_EQUAL_64(0xDCFE98BA54761032UL, x3); CHECK_EQUAL_64(0x10325476, x4); - CHECK_EQUAL_64(0x98badcfe10325476UL, x5); - CHECK_EQUAL_64(0x1032547698badcfeUL, x6); + CHECK_EQUAL_64(0x98BADCFE10325476UL, x5); + CHECK_EQUAL_64(0x1032547698BADCFEUL, x6); TEARDOWN(); } @@ -1562,7 +1558,7 @@ TEST(clz_cls) { START(); __ Mov(x24, 0x0008000000800000UL); - __ Mov(x25, 0xff800000fff80000UL); + __ Mov(x25, 0xFF800000FFF80000UL); __ Mov(x26, 0); __ Clz(w0, w24); __ Clz(x1, x24); @@ -1773,7 +1769,7 @@ TEST(adr_far) { RUN(); - CHECK_EQUAL_64(0xf, x0); + CHECK_EQUAL_64(0xF, x0); TEARDOWN(); } @@ -1960,7 +1956,7 @@ TEST(compare_branch) { __ Mov(x3, 1); __ Bind(&nzf_end); - __ Mov(x18, 0xffffffff00000000UL); + __ Mov(x18, 0xFFFFFFFF00000000UL); Label a, a_end; __ Cbz(w18, &a); @@ -2000,7 +1996,7 @@ TEST(test_branch) { __ Mov(x1, 0); __ Mov(x2, 0); __ Mov(x3, 0); - __ Mov(x16, 0xaaaaaaaaaaaaaaaaUL); + __ Mov(x16, 0xAAAAAAAAAAAAAAAAUL); Label bz, bz_end; __ Tbz(w16, 0, &bz); @@ -2432,7 +2428,7 @@ TEST(ldr_str_offset) { INIT_V8(); SETUP(); - uint64_t src[2] = {0xfedcba9876543210UL, 0x0123456789abcdefUL}; + uint64_t src[2] = {0xFEDCBA9876543210UL, 0x0123456789ABCDEFUL}; uint64_t dst[5] = {0, 0, 0, 0, 0}; uintptr_t src_base = reinterpret_cast<uintptr_t>(src); uintptr_t dst_base = reinterpret_cast<uintptr_t>(dst); @@ -2456,10 +2452,10 @@ TEST(ldr_str_offset) { CHECK_EQUAL_64(0x76543210, x0); CHECK_EQUAL_64(0x76543210, dst[0]); - CHECK_EQUAL_64(0xfedcba98, x1); - CHECK_EQUAL_64(0xfedcba9800000000UL, dst[1]); - CHECK_EQUAL_64(0x0123456789abcdefUL, x2); - CHECK_EQUAL_64(0x0123456789abcdefUL, dst[2]); + CHECK_EQUAL_64(0xFEDCBA98, x1); + CHECK_EQUAL_64(0xFEDCBA9800000000UL, dst[1]); + CHECK_EQUAL_64(0x0123456789ABCDEFUL, x2); + CHECK_EQUAL_64(0x0123456789ABCDEFUL, dst[2]); CHECK_EQUAL_64(0x32, x3); CHECK_EQUAL_64(0x3200, dst[3]); CHECK_EQUAL_64(0x7654, x4); @@ -2479,8 +2475,8 @@ TEST(ldr_str_wide) { uint32_t dst[8192]; uintptr_t src_base = reinterpret_cast<uintptr_t>(src); uintptr_t dst_base = reinterpret_cast<uintptr_t>(dst); - memset(src, 0xaa, 8192 * sizeof(src[0])); - memset(dst, 0xaa, 8192 * sizeof(dst[0])); + memset(src, 0xAA, 8192 * sizeof(src[0])); + memset(dst, 0xAA, 8192 * sizeof(dst[0])); src[0] = 0; src[6144] = 6144; src[8191] = 8191; @@ -2523,7 +2519,7 @@ TEST(ldr_str_preindex) { INIT_V8(); SETUP(); - uint64_t src[2] = {0xfedcba9876543210UL, 0x0123456789abcdefUL}; + uint64_t src[2] = {0xFEDCBA9876543210UL, 0x0123456789ABCDEFUL}; uint64_t dst[6] = {0, 0, 0, 0, 0, 0}; uintptr_t src_base = reinterpret_cast<uintptr_t>(src); uintptr_t dst_base = reinterpret_cast<uintptr_t>(dst); @@ -2553,10 +2549,10 @@ TEST(ldr_str_preindex) { RUN(); - CHECK_EQUAL_64(0xfedcba98, x0); - CHECK_EQUAL_64(0xfedcba9800000000UL, dst[1]); - CHECK_EQUAL_64(0x0123456789abcdefUL, x1); - CHECK_EQUAL_64(0x0123456789abcdefUL, dst[2]); + CHECK_EQUAL_64(0xFEDCBA98, x0); + CHECK_EQUAL_64(0xFEDCBA9800000000UL, dst[1]); + CHECK_EQUAL_64(0x0123456789ABCDEFUL, x1); + CHECK_EQUAL_64(0x0123456789ABCDEFUL, dst[2]); CHECK_EQUAL_64(0x01234567, x2); CHECK_EQUAL_64(0x0123456700000000UL, dst[4]); CHECK_EQUAL_64(0x32, x3); @@ -2581,7 +2577,7 @@ TEST(ldr_str_postindex) { INIT_V8(); SETUP(); - uint64_t src[2] = {0xfedcba9876543210UL, 0x0123456789abcdefUL}; + uint64_t src[2] = {0xFEDCBA9876543210UL, 0x0123456789ABCDEFUL}; uint64_t dst[6] = {0, 0, 0, 0, 0, 0}; uintptr_t src_base = reinterpret_cast<uintptr_t>(src); uintptr_t dst_base = reinterpret_cast<uintptr_t>(dst); @@ -2611,12 +2607,12 @@ TEST(ldr_str_postindex) { RUN(); - CHECK_EQUAL_64(0xfedcba98, x0); - CHECK_EQUAL_64(0xfedcba9800000000UL, dst[1]); - CHECK_EQUAL_64(0x0123456789abcdefUL, x1); - CHECK_EQUAL_64(0x0123456789abcdefUL, dst[2]); - CHECK_EQUAL_64(0x0123456789abcdefUL, x2); - CHECK_EQUAL_64(0x0123456789abcdefUL, dst[4]); + CHECK_EQUAL_64(0xFEDCBA98, x0); + CHECK_EQUAL_64(0xFEDCBA9800000000UL, dst[1]); + CHECK_EQUAL_64(0x0123456789ABCDEFUL, x1); + CHECK_EQUAL_64(0x0123456789ABCDEFUL, dst[2]); + CHECK_EQUAL_64(0x0123456789ABCDEFUL, x2); + CHECK_EQUAL_64(0x0123456789ABCDEFUL, dst[4]); CHECK_EQUAL_64(0x32, x3); CHECK_EQUAL_64(0x3200, dst[3]); CHECK_EQUAL_64(0x9876, x4); @@ -2639,7 +2635,7 @@ TEST(load_signed) { INIT_V8(); SETUP(); - uint32_t src[2] = {0x80008080, 0x7fff7f7f}; + uint32_t src[2] = {0x80008080, 0x7FFF7F7F}; uintptr_t src_base = reinterpret_cast<uintptr_t>(src); START(); @@ -2658,16 +2654,16 @@ TEST(load_signed) { RUN(); - CHECK_EQUAL_64(0xffffff80, x0); - CHECK_EQUAL_64(0x0000007f, x1); - CHECK_EQUAL_64(0xffff8080, x2); - CHECK_EQUAL_64(0x00007f7f, x3); - CHECK_EQUAL_64(0xffffffffffffff80UL, x4); - CHECK_EQUAL_64(0x000000000000007fUL, x5); - CHECK_EQUAL_64(0xffffffffffff8080UL, x6); - CHECK_EQUAL_64(0x0000000000007f7fUL, x7); - CHECK_EQUAL_64(0xffffffff80008080UL, x8); - CHECK_EQUAL_64(0x000000007fff7f7fUL, x9); + CHECK_EQUAL_64(0xFFFFFF80, x0); + CHECK_EQUAL_64(0x0000007F, x1); + CHECK_EQUAL_64(0xFFFF8080, x2); + CHECK_EQUAL_64(0x00007F7F, x3); + CHECK_EQUAL_64(0xFFFFFFFFFFFFFF80UL, x4); + CHECK_EQUAL_64(0x000000000000007FUL, x5); + CHECK_EQUAL_64(0xFFFFFFFFFFFF8080UL, x6); + CHECK_EQUAL_64(0x0000000000007F7FUL, x7); + CHECK_EQUAL_64(0xFFFFFFFF80008080UL, x8); + CHECK_EQUAL_64(0x000000007FFF7F7FUL, x9); TEARDOWN(); } @@ -2690,9 +2686,9 @@ TEST(load_store_regoffset) { __ Mov(x24, 0); __ Mov(x25, 4); __ Mov(x26, -4); - __ Mov(x27, 0xfffffffc); // 32-bit -4. - __ Mov(x28, 0xfffffffe); // 32-bit -2. - __ Mov(x29, 0xffffffff); // 32-bit -1. + __ Mov(x27, 0xFFFFFFFC); // 32-bit -4. + __ Mov(x28, 0xFFFFFFFE); // 32-bit -2. + __ Mov(x29, 0xFFFFFFFF); // 32-bit -1. __ Ldr(w0, MemOperand(x16, x24)); __ Ldr(x1, MemOperand(x16, x25)); @@ -2891,11 +2887,11 @@ TEST(load_store_q) { INIT_V8(); SETUP(); - uint8_t src[48] = {0x10, 0x32, 0x54, 0x76, 0x98, 0xba, 0xdc, 0xfe, 0x01, 0x23, - 0x45, 0x67, 0x89, 0xab, 0xcd, 0xef, 0x21, 0x43, 0x65, 0x87, - 0xa9, 0xcb, 0xed, 0x0f, 0x12, 0x34, 0x56, 0x78, 0x9a, 0xbc, - 0xde, 0xf0, 0x24, 0x46, 0x68, 0x8a, 0xac, 0xce, 0xe0, 0x02, - 0x42, 0x64, 0x86, 0xa8, 0xca, 0xec, 0x0e, 0x20}; + uint8_t src[48] = {0x10, 0x32, 0x54, 0x76, 0x98, 0xBA, 0xDC, 0xFE, 0x01, 0x23, + 0x45, 0x67, 0x89, 0xAB, 0xCD, 0xEF, 0x21, 0x43, 0x65, 0x87, + 0xA9, 0xCB, 0xED, 0x0F, 0x12, 0x34, 0x56, 0x78, 0x9A, 0xBC, + 0xDE, 0xF0, 0x24, 0x46, 0x68, 0x8A, 0xAC, 0xCE, 0xE0, 0x02, + 0x42, 0x64, 0x86, 0xA8, 0xCA, 0xEC, 0x0E, 0x20}; uint64_t dst[6] = {0, 0, 0, 0, 0, 0}; uintptr_t src_base = reinterpret_cast<uintptr_t>(src); @@ -2918,15 +2914,15 @@ TEST(load_store_q) { RUN(); - CHECK_EQUAL_128(0xf0debc9a78563412, 0x0fedcba987654321, q0); - CHECK_EQUAL_64(0x0fedcba987654321, dst[0]); - CHECK_EQUAL_64(0xf0debc9a78563412, dst[1]); - CHECK_EQUAL_128(0xefcdab8967452301, 0xfedcba9876543210, q1); - CHECK_EQUAL_64(0xfedcba9876543210, dst[4]); - CHECK_EQUAL_64(0xefcdab8967452301, dst[5]); - CHECK_EQUAL_128(0x200eeccaa8866442, 0x02e0ceac8a684624, q2); - CHECK_EQUAL_64(0x02e0ceac8a684624, dst[2]); - CHECK_EQUAL_64(0x200eeccaa8866442, dst[3]); + CHECK_EQUAL_128(0xF0DEBC9A78563412, 0x0FEDCBA987654321, q0); + CHECK_EQUAL_64(0x0FEDCBA987654321, dst[0]); + CHECK_EQUAL_64(0xF0DEBC9A78563412, dst[1]); + CHECK_EQUAL_128(0xEFCDAB8967452301, 0xFEDCBA9876543210, q1); + CHECK_EQUAL_64(0xFEDCBA9876543210, dst[4]); + CHECK_EQUAL_64(0xEFCDAB8967452301, dst[5]); + CHECK_EQUAL_128(0x200EECCAA8866442, 0x02E0CEAC8A684624, q2); + CHECK_EQUAL_64(0x02E0CEAC8A684624, dst[2]); + CHECK_EQUAL_64(0x200EECCAA8866442, dst[3]); CHECK_EQUAL_64(src_base, x17); CHECK_EQUAL_64(dst_base + 16, x18); CHECK_EQUAL_64(src_base + 16, x19); @@ -2967,22 +2963,22 @@ TEST(neon_ld1_d) { CHECK_EQUAL_128(0, 0x0706050403020100, q2); CHECK_EQUAL_128(0, 0x0807060504030201, q3); - CHECK_EQUAL_128(0, 0x100f0e0d0c0b0a09, q4); + CHECK_EQUAL_128(0, 0x100F0E0D0C0B0A09, q4); CHECK_EQUAL_128(0, 0x0908070605040302, q5); - CHECK_EQUAL_128(0, 0x11100f0e0d0c0b0a, q6); + CHECK_EQUAL_128(0, 0x11100F0E0D0C0B0A, q6); CHECK_EQUAL_128(0, 0x1918171615141312, q7); - CHECK_EQUAL_128(0, 0x0a09080706050403, q16); - CHECK_EQUAL_128(0, 0x1211100f0e0d0c0b, q17); - CHECK_EQUAL_128(0, 0x1a19181716151413, q18); - CHECK_EQUAL_128(0, 0x2221201f1e1d1c1b, q19); - CHECK_EQUAL_128(0, 0x0b0a090807060504, q30); - CHECK_EQUAL_128(0, 0x131211100f0e0d0c, q31); - CHECK_EQUAL_128(0, 0x1b1a191817161514, q0); - CHECK_EQUAL_128(0, 0x232221201f1e1d1c, q1); - CHECK_EQUAL_128(0, 0x0c0b0a0908070605, q20); - CHECK_EQUAL_128(0, 0x14131211100f0e0d, q21); - CHECK_EQUAL_128(0, 0x1c1b1a1918171615, q22); - CHECK_EQUAL_128(0, 0x24232221201f1e1d, q23); + CHECK_EQUAL_128(0, 0x0A09080706050403, q16); + CHECK_EQUAL_128(0, 0x1211100F0E0D0C0B, q17); + CHECK_EQUAL_128(0, 0x1A19181716151413, q18); + CHECK_EQUAL_128(0, 0x2221201F1E1D1C1B, q19); + CHECK_EQUAL_128(0, 0x0B0A090807060504, q30); + CHECK_EQUAL_128(0, 0x131211100F0E0D0C, q31); + CHECK_EQUAL_128(0, 0x1B1A191817161514, q0); + CHECK_EQUAL_128(0, 0x232221201F1E1D1C, q1); + CHECK_EQUAL_128(0, 0x0C0B0A0908070605, q20); + CHECK_EQUAL_128(0, 0x14131211100F0E0D, q21); + CHECK_EQUAL_128(0, 0x1C1B1A1918171615, q22); + CHECK_EQUAL_128(0, 0x24232221201F1E1D, q23); TEARDOWN(); } @@ -3021,22 +3017,22 @@ TEST(neon_ld1_d_postindex) { CHECK_EQUAL_128(0, 0x0706050403020100, q2); CHECK_EQUAL_128(0, 0x0807060504030201, q3); - CHECK_EQUAL_128(0, 0x100f0e0d0c0b0a09, q4); + CHECK_EQUAL_128(0, 0x100F0E0D0C0B0A09, q4); CHECK_EQUAL_128(0, 0x0908070605040302, q5); - CHECK_EQUAL_128(0, 0x11100f0e0d0c0b0a, q6); + CHECK_EQUAL_128(0, 0x11100F0E0D0C0B0A, q6); CHECK_EQUAL_128(0, 0x1918171615141312, q7); - CHECK_EQUAL_128(0, 0x0a09080706050403, q16); - CHECK_EQUAL_128(0, 0x1211100f0e0d0c0b, q17); - CHECK_EQUAL_128(0, 0x1a19181716151413, q18); - CHECK_EQUAL_128(0, 0x2221201f1e1d1c1b, q19); - CHECK_EQUAL_128(0, 0x0b0a090807060504, q30); - CHECK_EQUAL_128(0, 0x131211100f0e0d0c, q31); - CHECK_EQUAL_128(0, 0x1b1a191817161514, q0); - CHECK_EQUAL_128(0, 0x232221201f1e1d1c, q1); - CHECK_EQUAL_128(0, 0x0c0b0a0908070605, q20); - CHECK_EQUAL_128(0, 0x14131211100f0e0d, q21); - CHECK_EQUAL_128(0, 0x1c1b1a1918171615, q22); - CHECK_EQUAL_128(0, 0x24232221201f1e1d, q23); + CHECK_EQUAL_128(0, 0x0A09080706050403, q16); + CHECK_EQUAL_128(0, 0x1211100F0E0D0C0B, q17); + CHECK_EQUAL_128(0, 0x1A19181716151413, q18); + CHECK_EQUAL_128(0, 0x2221201F1E1D1C1B, q19); + CHECK_EQUAL_128(0, 0x0B0A090807060504, q30); + CHECK_EQUAL_128(0, 0x131211100F0E0D0C, q31); + CHECK_EQUAL_128(0, 0x1B1A191817161514, q0); + CHECK_EQUAL_128(0, 0x232221201F1E1D1C, q1); + CHECK_EQUAL_128(0, 0x0C0B0A0908070605, q20); + CHECK_EQUAL_128(0, 0x14131211100F0E0D, q21); + CHECK_EQUAL_128(0, 0x1C1B1A1918171615, q22); + CHECK_EQUAL_128(0, 0x24232221201F1E1D, q23); CHECK_EQUAL_64(src_base + 1, x17); CHECK_EQUAL_64(src_base + 1 + 16, x18); CHECK_EQUAL_64(src_base + 2 + 24, x19); @@ -3072,20 +3068,20 @@ TEST(neon_ld1_q) { RUN(); - CHECK_EQUAL_128(0x0f0e0d0c0b0a0908, 0x0706050403020100, q2); - CHECK_EQUAL_128(0x100f0e0d0c0b0a09, 0x0807060504030201, q3); - CHECK_EQUAL_128(0x201f1e1d1c1b1a19, 0x1817161514131211, q4); - CHECK_EQUAL_128(0x11100f0e0d0c0b0a, 0x0908070605040302, q5); - CHECK_EQUAL_128(0x21201f1e1d1c1b1a, 0x1918171615141312, q6); - CHECK_EQUAL_128(0x31302f2e2d2c2b2a, 0x2928272625242322, q7); - CHECK_EQUAL_128(0x1211100f0e0d0c0b, 0x0a09080706050403, q16); - CHECK_EQUAL_128(0x2221201f1e1d1c1b, 0x1a19181716151413, q17); - CHECK_EQUAL_128(0x3231302f2e2d2c2b, 0x2a29282726252423, q18); - CHECK_EQUAL_128(0x4241403f3e3d3c3b, 0x3a39383736353433, q19); - CHECK_EQUAL_128(0x131211100f0e0d0c, 0x0b0a090807060504, q30); - CHECK_EQUAL_128(0x232221201f1e1d1c, 0x1b1a191817161514, q31); - CHECK_EQUAL_128(0x333231302f2e2d2c, 0x2b2a292827262524, q0); - CHECK_EQUAL_128(0x434241403f3e3d3c, 0x3b3a393837363534, q1); + CHECK_EQUAL_128(0x0F0E0D0C0B0A0908, 0x0706050403020100, q2); + CHECK_EQUAL_128(0x100F0E0D0C0B0A09, 0x0807060504030201, q3); + CHECK_EQUAL_128(0x201F1E1D1C1B1A19, 0x1817161514131211, q4); + CHECK_EQUAL_128(0x11100F0E0D0C0B0A, 0x0908070605040302, q5); + CHECK_EQUAL_128(0x21201F1E1D1C1B1A, 0x1918171615141312, q6); + CHECK_EQUAL_128(0x31302F2E2D2C2B2A, 0x2928272625242322, q7); + CHECK_EQUAL_128(0x1211100F0E0D0C0B, 0x0A09080706050403, q16); + CHECK_EQUAL_128(0x2221201F1E1D1C1B, 0x1A19181716151413, q17); + CHECK_EQUAL_128(0x3231302F2E2D2C2B, 0x2A29282726252423, q18); + CHECK_EQUAL_128(0x4241403F3E3D3C3B, 0x3A39383736353433, q19); + CHECK_EQUAL_128(0x131211100F0E0D0C, 0x0B0A090807060504, q30); + CHECK_EQUAL_128(0x232221201F1E1D1C, 0x1B1A191817161514, q31); + CHECK_EQUAL_128(0x333231302F2E2D2C, 0x2B2A292827262524, q0); + CHECK_EQUAL_128(0x434241403F3E3D3C, 0x3B3A393837363534, q1); TEARDOWN(); } @@ -3118,20 +3114,20 @@ TEST(neon_ld1_q_postindex) { RUN(); - CHECK_EQUAL_128(0x0f0e0d0c0b0a0908, 0x0706050403020100, q2); - CHECK_EQUAL_128(0x100f0e0d0c0b0a09, 0x0807060504030201, q3); - CHECK_EQUAL_128(0x201f1e1d1c1b1a19, 0x1817161514131211, q4); - CHECK_EQUAL_128(0x11100f0e0d0c0b0a, 0x0908070605040302, q5); - CHECK_EQUAL_128(0x21201f1e1d1c1b1a, 0x1918171615141312, q6); - CHECK_EQUAL_128(0x31302f2e2d2c2b2a, 0x2928272625242322, q7); - CHECK_EQUAL_128(0x1211100f0e0d0c0b, 0x0a09080706050403, q16); - CHECK_EQUAL_128(0x2221201f1e1d1c1b, 0x1a19181716151413, q17); - CHECK_EQUAL_128(0x3231302f2e2d2c2b, 0x2a29282726252423, q18); - CHECK_EQUAL_128(0x4241403f3e3d3c3b, 0x3a39383736353433, q19); - CHECK_EQUAL_128(0x131211100f0e0d0c, 0x0b0a090807060504, q30); - CHECK_EQUAL_128(0x232221201f1e1d1c, 0x1b1a191817161514, q31); - CHECK_EQUAL_128(0x333231302f2e2d2c, 0x2b2a292827262524, q0); - CHECK_EQUAL_128(0x434241403f3e3d3c, 0x3b3a393837363534, q1); + CHECK_EQUAL_128(0x0F0E0D0C0B0A0908, 0x0706050403020100, q2); + CHECK_EQUAL_128(0x100F0E0D0C0B0A09, 0x0807060504030201, q3); + CHECK_EQUAL_128(0x201F1E1D1C1B1A19, 0x1817161514131211, q4); + CHECK_EQUAL_128(0x11100F0E0D0C0B0A, 0x0908070605040302, q5); + CHECK_EQUAL_128(0x21201F1E1D1C1B1A, 0x1918171615141312, q6); + CHECK_EQUAL_128(0x31302F2E2D2C2B2A, 0x2928272625242322, q7); + CHECK_EQUAL_128(0x1211100F0E0D0C0B, 0x0A09080706050403, q16); + CHECK_EQUAL_128(0x2221201F1E1D1C1B, 0x1A19181716151413, q17); + CHECK_EQUAL_128(0x3231302F2E2D2C2B, 0x2A29282726252423, q18); + CHECK_EQUAL_128(0x4241403F3E3D3C3B, 0x3A39383736353433, q19); + CHECK_EQUAL_128(0x131211100F0E0D0C, 0x0B0A090807060504, q30); + CHECK_EQUAL_128(0x232221201F1E1D1C, 0x1B1A191817161514, q31); + CHECK_EQUAL_128(0x333231302F2E2D2C, 0x2B2A292827262524, q0); + CHECK_EQUAL_128(0x434241403F3E3D3C, 0x3B3A393837363534, q1); CHECK_EQUAL_64(src_base + 1, x17); CHECK_EQUAL_64(src_base + 1 + 32, x18); CHECK_EQUAL_64(src_base + 2 + 48, x19); @@ -3193,13 +3189,13 @@ TEST(neon_ld1_lane) { RUN(); - CHECK_EQUAL_128(0x0001020304050607, 0x08090a0b0c0d0e0f, q0); + CHECK_EQUAL_128(0x0001020304050607, 0x08090A0B0C0D0E0F, q0); CHECK_EQUAL_128(0x0100020103020403, 0x0504060507060807, q1); CHECK_EQUAL_128(0x0302010004030201, 0x0504030206050403, q2); CHECK_EQUAL_128(0x0706050403020100, 0x0807060504030201, q3); - CHECK_EQUAL_128(0x0f0e0d0c0b0a0908, 0x0706050003020100, q4); - CHECK_EQUAL_128(0x0f0e0d0c0b0a0908, 0x0100050403020100, q5); - CHECK_EQUAL_128(0x0f0e0d0c03020100, 0x0706050403020100, q6); + CHECK_EQUAL_128(0x0F0E0D0C0B0A0908, 0x0706050003020100, q4); + CHECK_EQUAL_128(0x0F0E0D0C0B0A0908, 0x0100050403020100, q5); + CHECK_EQUAL_128(0x0F0E0D0C03020100, 0x0706050403020100, q6); CHECK_EQUAL_128(0x0706050403020100, 0x0706050403020100, q7); TEARDOWN(); @@ -3228,14 +3224,14 @@ TEST(neon_ld2_d) { RUN(); - CHECK_EQUAL_128(0, 0x0e0c0a0806040200, q2); - CHECK_EQUAL_128(0, 0x0f0d0b0907050301, q3); - CHECK_EQUAL_128(0, 0x0f0d0b0907050301, q4); - CHECK_EQUAL_128(0, 0x100e0c0a08060402, q5); - CHECK_EQUAL_128(0, 0x0f0e0b0a07060302, q6); - CHECK_EQUAL_128(0, 0x11100d0c09080504, q7); - CHECK_EQUAL_128(0, 0x0e0d0c0b06050403, q31); - CHECK_EQUAL_128(0, 0x1211100f0a090807, q0); + CHECK_EQUAL_128(0, 0x0E0C0A0806040200, q2); + CHECK_EQUAL_128(0, 0x0F0D0B0907050301, q3); + CHECK_EQUAL_128(0, 0x0F0D0B0907050301, q4); + CHECK_EQUAL_128(0, 0x100E0C0A08060402, q5); + CHECK_EQUAL_128(0, 0x0F0E0B0A07060302, q6); + CHECK_EQUAL_128(0, 0x11100D0C09080504, q7); + CHECK_EQUAL_128(0, 0x0E0D0C0B06050403, q31); + CHECK_EQUAL_128(0, 0x1211100F0A090807, q0); TEARDOWN(); } @@ -3266,15 +3262,15 @@ TEST(neon_ld2_d_postindex) { RUN(); - CHECK_EQUAL_128(0, 0x0e0c0a0806040200, q2); - CHECK_EQUAL_128(0, 0x0f0d0b0907050301, q3); - CHECK_EQUAL_128(0, 0x0f0d0b0907050301, q4); - CHECK_EQUAL_128(0, 0x0f0e0b0a07060302, q5); - CHECK_EQUAL_128(0, 0x11100d0c09080504, q6); - CHECK_EQUAL_128(0, 0x0e0d0c0b06050403, q16); - CHECK_EQUAL_128(0, 0x1211100f0a090807, q17); - CHECK_EQUAL_128(0, 0x0f0e0d0c07060504, q31); - CHECK_EQUAL_128(0, 0x131211100b0a0908, q0); + CHECK_EQUAL_128(0, 0x0E0C0A0806040200, q2); + CHECK_EQUAL_128(0, 0x0F0D0B0907050301, q3); + CHECK_EQUAL_128(0, 0x0F0D0B0907050301, q4); + CHECK_EQUAL_128(0, 0x0F0E0B0A07060302, q5); + CHECK_EQUAL_128(0, 0x11100D0C09080504, q6); + CHECK_EQUAL_128(0, 0x0E0D0C0B06050403, q16); + CHECK_EQUAL_128(0, 0x1211100F0A090807, q17); + CHECK_EQUAL_128(0, 0x0F0E0D0C07060504, q31); + CHECK_EQUAL_128(0, 0x131211100B0A0908, q0); CHECK_EQUAL_64(src_base + 1, x17); CHECK_EQUAL_64(src_base + 1 + 16, x18); @@ -3310,16 +3306,16 @@ TEST(neon_ld2_q) { RUN(); - CHECK_EQUAL_128(0x1e1c1a1816141210, 0x0e0c0a0806040200, q2); - CHECK_EQUAL_128(0x1f1d1b1917151311, 0x0f0d0b0907050301, q3); - CHECK_EQUAL_128(0x1f1d1b1917151311, 0x0f0d0b0907050301, q4); - CHECK_EQUAL_128(0x201e1c1a18161412, 0x100e0c0a08060402, q5); - CHECK_EQUAL_128(0x1f1e1b1a17161312, 0x0f0e0b0a07060302, q6); - CHECK_EQUAL_128(0x21201d1c19181514, 0x11100d0c09080504, q7); - CHECK_EQUAL_128(0x1e1d1c1b16151413, 0x0e0d0c0b06050403, q16); - CHECK_EQUAL_128(0x2221201f1a191817, 0x1211100f0a090807, q17); - CHECK_EQUAL_128(0x1b1a191817161514, 0x0b0a090807060504, q31); - CHECK_EQUAL_128(0x232221201f1e1d1c, 0x131211100f0e0d0c, q0); + CHECK_EQUAL_128(0x1E1C1A1816141210, 0x0E0C0A0806040200, q2); + CHECK_EQUAL_128(0x1F1D1B1917151311, 0x0F0D0B0907050301, q3); + CHECK_EQUAL_128(0x1F1D1B1917151311, 0x0F0D0B0907050301, q4); + CHECK_EQUAL_128(0x201E1C1A18161412, 0x100E0C0A08060402, q5); + CHECK_EQUAL_128(0x1F1E1B1A17161312, 0x0F0E0B0A07060302, q6); + CHECK_EQUAL_128(0x21201D1C19181514, 0x11100D0C09080504, q7); + CHECK_EQUAL_128(0x1E1D1C1B16151413, 0x0E0D0C0B06050403, q16); + CHECK_EQUAL_128(0x2221201F1A191817, 0x1211100F0A090807, q17); + CHECK_EQUAL_128(0x1B1A191817161514, 0x0B0A090807060504, q31); + CHECK_EQUAL_128(0x232221201F1E1D1C, 0x131211100F0E0D0C, q0); TEARDOWN(); } @@ -3350,16 +3346,16 @@ TEST(neon_ld2_q_postindex) { RUN(); - CHECK_EQUAL_128(0x1e1c1a1816141210, 0x0e0c0a0806040200, q2); - CHECK_EQUAL_128(0x1f1d1b1917151311, 0x0f0d0b0907050301, q3); - CHECK_EQUAL_128(0x1f1d1b1917151311, 0x0f0d0b0907050301, q4); - CHECK_EQUAL_128(0x201e1c1a18161412, 0x100e0c0a08060402, q5); - CHECK_EQUAL_128(0x1f1e1b1a17161312, 0x0f0e0b0a07060302, q6); - CHECK_EQUAL_128(0x21201d1c19181514, 0x11100d0c09080504, q7); - CHECK_EQUAL_128(0x1e1d1c1b16151413, 0x0e0d0c0b06050403, q16); - CHECK_EQUAL_128(0x2221201f1a191817, 0x1211100f0a090807, q17); - CHECK_EQUAL_128(0x1b1a191817161514, 0x0b0a090807060504, q31); - CHECK_EQUAL_128(0x232221201f1e1d1c, 0x131211100f0e0d0c, q0); + CHECK_EQUAL_128(0x1E1C1A1816141210, 0x0E0C0A0806040200, q2); + CHECK_EQUAL_128(0x1F1D1B1917151311, 0x0F0D0B0907050301, q3); + CHECK_EQUAL_128(0x1F1D1B1917151311, 0x0F0D0B0907050301, q4); + CHECK_EQUAL_128(0x201E1C1A18161412, 0x100E0C0A08060402, q5); + CHECK_EQUAL_128(0x1F1E1B1A17161312, 0x0F0E0B0A07060302, q6); + CHECK_EQUAL_128(0x21201D1C19181514, 0x11100D0C09080504, q7); + CHECK_EQUAL_128(0x1E1D1C1B16151413, 0x0E0D0C0B06050403, q16); + CHECK_EQUAL_128(0x2221201F1A191817, 0x1211100F0A090807, q17); + CHECK_EQUAL_128(0x1B1A191817161514, 0x0B0A090807060504, q31); + CHECK_EQUAL_128(0x232221201F1E1D1C, 0x131211100F0E0D0C, q0); CHECK_EQUAL_64(src_base + 1, x17); CHECK_EQUAL_64(src_base + 1 + 32, x18); @@ -3430,22 +3426,22 @@ TEST(neon_ld2_lane) { RUN(); - CHECK_EQUAL_128(0x0001020304050607, 0x08090a0b0c0d0e0f, q0); - CHECK_EQUAL_128(0x0102030405060708, 0x090a0b0c0d0e0f10, q1); + CHECK_EQUAL_128(0x0001020304050607, 0x08090A0B0C0D0E0F, q0); + CHECK_EQUAL_128(0x0102030405060708, 0x090A0B0C0D0E0F10, q1); CHECK_EQUAL_128(0x0100020103020403, 0x0504060507060807, q2); - CHECK_EQUAL_128(0x0302040305040605, 0x0706080709080a09, q3); + CHECK_EQUAL_128(0x0302040305040605, 0x0706080709080A09, q3); CHECK_EQUAL_128(0x0302010004030201, 0x0504030206050403, q4); - CHECK_EQUAL_128(0x0706050408070605, 0x090807060a090807, q5); + CHECK_EQUAL_128(0x0706050408070605, 0x090807060A090807, q5); CHECK_EQUAL_128(0x0706050403020100, 0x0807060504030201, q6); - CHECK_EQUAL_128(0x0f0e0d0c0b0a0908, 0x100f0e0d0c0b0a09, q7); - CHECK_EQUAL_128(0x0f0e0d0c0b0a0908, 0x0706050003020100, q8); - CHECK_EQUAL_128(0x1f1e1d1c1b1a1918, 0x1716150113121110, q9); - CHECK_EQUAL_128(0x0f0e0d0c0b0a0908, 0x0100050403020100, q10); - CHECK_EQUAL_128(0x1f1e1d1c1b1a1918, 0x0302151413121110, q11); - CHECK_EQUAL_128(0x0f0e0d0c03020100, 0x0706050403020100, q12); - CHECK_EQUAL_128(0x1f1e1d1c07060504, 0x1716151413121110, q13); + CHECK_EQUAL_128(0x0F0E0D0C0B0A0908, 0x100F0E0D0C0B0A09, q7); + CHECK_EQUAL_128(0x0F0E0D0C0B0A0908, 0x0706050003020100, q8); + CHECK_EQUAL_128(0x1F1E1D1C1B1A1918, 0x1716150113121110, q9); + CHECK_EQUAL_128(0x0F0E0D0C0B0A0908, 0x0100050403020100, q10); + CHECK_EQUAL_128(0x1F1E1D1C1B1A1918, 0x0302151413121110, q11); + CHECK_EQUAL_128(0x0F0E0D0C03020100, 0x0706050403020100, q12); + CHECK_EQUAL_128(0x1F1E1D1C07060504, 0x1716151413121110, q13); CHECK_EQUAL_128(0x0706050403020100, 0x0706050403020100, q14); - CHECK_EQUAL_128(0x0f0e0d0c0b0a0908, 0x1716151413121110, q15); + CHECK_EQUAL_128(0x0F0E0D0C0B0A0908, 0x1716151413121110, q15); TEARDOWN(); } @@ -3516,22 +3512,22 @@ TEST(neon_ld2_lane_postindex) { RUN(); - CHECK_EQUAL_128(0x00020406080a0c0e, 0x10121416181a1c1e, q0); - CHECK_EQUAL_128(0x01030507090b0d0f, 0x11131517191b1d1f, q1); - CHECK_EQUAL_128(0x0100050409080d0c, 0x1110151419181d1c, q2); - CHECK_EQUAL_128(0x030207060b0a0f0e, 0x131217161b1a1f1e, q3); - CHECK_EQUAL_128(0x030201000b0a0908, 0x131211101b1a1918, q4); - CHECK_EQUAL_128(0x070605040f0e0d0c, 0x171615141f1e1d1c, q5); + CHECK_EQUAL_128(0x00020406080A0C0E, 0x10121416181A1C1E, q0); + CHECK_EQUAL_128(0x01030507090B0D0F, 0x11131517191B1D1F, q1); + CHECK_EQUAL_128(0x0100050409080D0C, 0x1110151419181D1C, q2); + CHECK_EQUAL_128(0x030207060B0A0F0E, 0x131217161B1A1F1E, q3); + CHECK_EQUAL_128(0x030201000B0A0908, 0x131211101B1A1918, q4); + CHECK_EQUAL_128(0x070605040F0E0D0C, 0x171615141F1E1D1C, q5); CHECK_EQUAL_128(0x0706050403020100, 0x1716151413121110, q6); - CHECK_EQUAL_128(0x0f0e0d0c0b0a0908, 0x1f1e1d1c1b1a1918, q7); - CHECK_EQUAL_128(0x0f0e0d0c0b0a0908, 0x0706050003020100, q8); - CHECK_EQUAL_128(0x1f1e1d1c1b1a1918, 0x1716150113121110, q9); - CHECK_EQUAL_128(0x0f0e0d0c0b0a0908, 0x0100050403020100, q10); - CHECK_EQUAL_128(0x1f1e1d1c1b1a1918, 0x0302151413121110, q11); - CHECK_EQUAL_128(0x0f0e0d0c03020100, 0x0706050403020100, q12); - CHECK_EQUAL_128(0x1f1e1d1c07060504, 0x1716151413121110, q13); + CHECK_EQUAL_128(0x0F0E0D0C0B0A0908, 0x1F1E1D1C1B1A1918, q7); + CHECK_EQUAL_128(0x0F0E0D0C0B0A0908, 0x0706050003020100, q8); + CHECK_EQUAL_128(0x1F1E1D1C1B1A1918, 0x1716150113121110, q9); + CHECK_EQUAL_128(0x0F0E0D0C0B0A0908, 0x0100050403020100, q10); + CHECK_EQUAL_128(0x1F1E1D1C1B1A1918, 0x0302151413121110, q11); + CHECK_EQUAL_128(0x0F0E0D0C03020100, 0x0706050403020100, q12); + CHECK_EQUAL_128(0x1F1E1D1C07060504, 0x1716151413121110, q13); CHECK_EQUAL_128(0x0706050403020100, 0x0706050403020100, q14); - CHECK_EQUAL_128(0x0f0e0d0c0b0a0908, 0x1716151413121110, q15); + CHECK_EQUAL_128(0x0F0E0D0C0B0A0908, 0x1716151413121110, q15); CHECK_EQUAL_64(src_base + 32, x17); CHECK_EQUAL_64(src_base + 32, x18); @@ -3583,12 +3579,12 @@ TEST(neon_ld2_alllanes) { CHECK_EQUAL_128(0x0000000000000000, 0x0706070607060706, q5); CHECK_EQUAL_128(0x0605060506050605, 0x0605060506050605, q6); CHECK_EQUAL_128(0x0807080708070807, 0x0807080708070807, q7); - CHECK_EQUAL_128(0x0000000000000000, 0x0c0b0a090c0b0a09, q8); - CHECK_EQUAL_128(0x0000000000000000, 0x100f0e0d100f0e0d, q9); - CHECK_EQUAL_128(0x0d0c0b0a0d0c0b0a, 0x0d0c0b0a0d0c0b0a, q10); - CHECK_EQUAL_128(0x11100f0e11100f0e, 0x11100f0e11100f0e, q11); + CHECK_EQUAL_128(0x0000000000000000, 0x0C0B0A090C0B0A09, q8); + CHECK_EQUAL_128(0x0000000000000000, 0x100F0E0D100F0E0D, q9); + CHECK_EQUAL_128(0x0D0C0B0A0D0C0B0A, 0x0D0C0B0A0D0C0B0A, q10); + CHECK_EQUAL_128(0x11100F0E11100F0E, 0x11100F0E11100F0E, q11); CHECK_EQUAL_128(0x1918171615141312, 0x1918171615141312, q12); - CHECK_EQUAL_128(0x21201f1e1d1c1b1a, 0x21201f1e1d1c1b1a, q13); + CHECK_EQUAL_128(0x21201F1E1D1C1B1A, 0x21201F1E1D1C1B1A, q13); TEARDOWN(); } @@ -3625,12 +3621,12 @@ TEST(neon_ld2_alllanes_postindex) { CHECK_EQUAL_128(0x0000000000000000, 0x0706070607060706, q5); CHECK_EQUAL_128(0x0605060506050605, 0x0605060506050605, q6); CHECK_EQUAL_128(0x0807080708070807, 0x0807080708070807, q7); - CHECK_EQUAL_128(0x0000000000000000, 0x0c0b0a090c0b0a09, q8); - CHECK_EQUAL_128(0x0000000000000000, 0x100f0e0d100f0e0d, q9); - CHECK_EQUAL_128(0x0d0c0b0a0d0c0b0a, 0x0d0c0b0a0d0c0b0a, q10); - CHECK_EQUAL_128(0x11100f0e11100f0e, 0x11100f0e11100f0e, q11); + CHECK_EQUAL_128(0x0000000000000000, 0x0C0B0A090C0B0A09, q8); + CHECK_EQUAL_128(0x0000000000000000, 0x100F0E0D100F0E0D, q9); + CHECK_EQUAL_128(0x0D0C0B0A0D0C0B0A, 0x0D0C0B0A0D0C0B0A, q10); + CHECK_EQUAL_128(0x11100F0E11100F0E, 0x11100F0E11100F0E, q11); CHECK_EQUAL_128(0x1918171615141312, 0x1918171615141312, q12); - CHECK_EQUAL_128(0x21201f1e1d1c1b1a, 0x21201f1e1d1c1b1a, q13); + CHECK_EQUAL_128(0x21201F1E1D1C1B1A, 0x21201F1E1D1C1B1A, q13); CHECK_EQUAL_64(src_base + 34, x17); TEARDOWN(); @@ -3659,18 +3655,18 @@ TEST(neon_ld3_d) { RUN(); - CHECK_EQUAL_128(0, 0x15120f0c09060300, q2); - CHECK_EQUAL_128(0, 0x1613100d0a070401, q3); - CHECK_EQUAL_128(0, 0x1714110e0b080502, q4); - CHECK_EQUAL_128(0, 0x1613100d0a070401, q5); - CHECK_EQUAL_128(0, 0x1714110e0b080502, q6); - CHECK_EQUAL_128(0, 0x1815120f0c090603, q7); - CHECK_EQUAL_128(0, 0x15140f0e09080302, q8); - CHECK_EQUAL_128(0, 0x171611100b0a0504, q9); - CHECK_EQUAL_128(0, 0x191813120d0c0706, q10); - CHECK_EQUAL_128(0, 0x1211100f06050403, q31); - CHECK_EQUAL_128(0, 0x161514130a090807, q0); - CHECK_EQUAL_128(0, 0x1a1918170e0d0c0b, q1); + CHECK_EQUAL_128(0, 0x15120F0C09060300, q2); + CHECK_EQUAL_128(0, 0x1613100D0A070401, q3); + CHECK_EQUAL_128(0, 0x1714110E0B080502, q4); + CHECK_EQUAL_128(0, 0x1613100D0A070401, q5); + CHECK_EQUAL_128(0, 0x1714110E0B080502, q6); + CHECK_EQUAL_128(0, 0x1815120F0C090603, q7); + CHECK_EQUAL_128(0, 0x15140F0E09080302, q8); + CHECK_EQUAL_128(0, 0x171611100B0A0504, q9); + CHECK_EQUAL_128(0, 0x191813120D0C0706, q10); + CHECK_EQUAL_128(0, 0x1211100F06050403, q31); + CHECK_EQUAL_128(0, 0x161514130A090807, q0); + CHECK_EQUAL_128(0, 0x1A1918170E0D0C0B, q1); TEARDOWN(); } @@ -3701,21 +3697,21 @@ TEST(neon_ld3_d_postindex) { RUN(); - CHECK_EQUAL_128(0, 0x15120f0c09060300, q2); - CHECK_EQUAL_128(0, 0x1613100d0a070401, q3); - CHECK_EQUAL_128(0, 0x1714110e0b080502, q4); - CHECK_EQUAL_128(0, 0x1613100d0a070401, q5); - CHECK_EQUAL_128(0, 0x1714110e0b080502, q6); - CHECK_EQUAL_128(0, 0x1815120f0c090603, q7); - CHECK_EQUAL_128(0, 0x15140f0e09080302, q8); - CHECK_EQUAL_128(0, 0x171611100b0a0504, q9); - CHECK_EQUAL_128(0, 0x191813120d0c0706, q10); - CHECK_EQUAL_128(0, 0x1211100f06050403, q11); - CHECK_EQUAL_128(0, 0x161514130a090807, q12); - CHECK_EQUAL_128(0, 0x1a1918170e0d0c0b, q13); + CHECK_EQUAL_128(0, 0x15120F0C09060300, q2); + CHECK_EQUAL_128(0, 0x1613100D0A070401, q3); + CHECK_EQUAL_128(0, 0x1714110E0B080502, q4); + CHECK_EQUAL_128(0, 0x1613100D0A070401, q5); + CHECK_EQUAL_128(0, 0x1714110E0B080502, q6); + CHECK_EQUAL_128(0, 0x1815120F0C090603, q7); + CHECK_EQUAL_128(0, 0x15140F0E09080302, q8); + CHECK_EQUAL_128(0, 0x171611100B0A0504, q9); + CHECK_EQUAL_128(0, 0x191813120D0C0706, q10); + CHECK_EQUAL_128(0, 0x1211100F06050403, q11); + CHECK_EQUAL_128(0, 0x161514130A090807, q12); + CHECK_EQUAL_128(0, 0x1A1918170E0D0C0B, q13); CHECK_EQUAL_128(0, 0x1312111007060504, q31); - CHECK_EQUAL_128(0, 0x171615140b0a0908, q0); - CHECK_EQUAL_128(0, 0x1b1a19180f0e0d0c, q1); + CHECK_EQUAL_128(0, 0x171615140B0A0908, q0); + CHECK_EQUAL_128(0, 0x1B1A19180F0E0D0C, q1); CHECK_EQUAL_64(src_base + 1, x17); CHECK_EQUAL_64(src_base + 1 + 24, x18); @@ -3751,21 +3747,21 @@ TEST(neon_ld3_q) { RUN(); - CHECK_EQUAL_128(0x2d2a2724211e1b18, 0x15120f0c09060300, q2); - CHECK_EQUAL_128(0x2e2b2825221f1c19, 0x1613100d0a070401, q3); - CHECK_EQUAL_128(0x2f2c292623201d1a, 0x1714110e0b080502, q4); - CHECK_EQUAL_128(0x2e2b2825221f1c19, 0x1613100d0a070401, q5); - CHECK_EQUAL_128(0x2f2c292623201d1a, 0x1714110e0b080502, q6); - CHECK_EQUAL_128(0x302d2a2724211e1b, 0x1815120f0c090603, q7); - CHECK_EQUAL_128(0x2d2c272621201b1a, 0x15140f0e09080302, q8); - CHECK_EQUAL_128(0x2f2e292823221d1c, 0x171611100b0a0504, q9); - CHECK_EQUAL_128(0x31302b2a25241f1e, 0x191813120d0c0706, q10); - CHECK_EQUAL_128(0x2a2928271e1d1c1b, 0x1211100f06050403, q11); - CHECK_EQUAL_128(0x2e2d2c2b2221201f, 0x161514130a090807, q12); - CHECK_EQUAL_128(0x3231302f26252423, 0x1a1918170e0d0c0b, q13); - CHECK_EQUAL_128(0x232221201f1e1d1c, 0x0b0a090807060504, q31); - CHECK_EQUAL_128(0x2b2a292827262524, 0x131211100f0e0d0c, q0); - CHECK_EQUAL_128(0x333231302f2e2d2c, 0x1b1a191817161514, q1); + CHECK_EQUAL_128(0x2D2A2724211E1B18, 0x15120F0C09060300, q2); + CHECK_EQUAL_128(0x2E2B2825221F1C19, 0x1613100D0A070401, q3); + CHECK_EQUAL_128(0x2F2C292623201D1A, 0x1714110E0B080502, q4); + CHECK_EQUAL_128(0x2E2B2825221F1C19, 0x1613100D0A070401, q5); + CHECK_EQUAL_128(0x2F2C292623201D1A, 0x1714110E0B080502, q6); + CHECK_EQUAL_128(0x302D2A2724211E1B, 0x1815120F0C090603, q7); + CHECK_EQUAL_128(0x2D2C272621201B1A, 0x15140F0E09080302, q8); + CHECK_EQUAL_128(0x2F2E292823221D1C, 0x171611100B0A0504, q9); + CHECK_EQUAL_128(0x31302B2A25241F1E, 0x191813120D0C0706, q10); + CHECK_EQUAL_128(0x2A2928271E1D1C1B, 0x1211100F06050403, q11); + CHECK_EQUAL_128(0x2E2D2C2B2221201F, 0x161514130A090807, q12); + CHECK_EQUAL_128(0x3231302F26252423, 0x1A1918170E0D0C0B, q13); + CHECK_EQUAL_128(0x232221201F1E1D1C, 0x0B0A090807060504, q31); + CHECK_EQUAL_128(0x2B2A292827262524, 0x131211100F0E0D0C, q0); + CHECK_EQUAL_128(0x333231302F2E2D2C, 0x1B1A191817161514, q1); TEARDOWN(); } @@ -3797,21 +3793,21 @@ TEST(neon_ld3_q_postindex) { RUN(); - CHECK_EQUAL_128(0x2d2a2724211e1b18, 0x15120f0c09060300, q2); - CHECK_EQUAL_128(0x2e2b2825221f1c19, 0x1613100d0a070401, q3); - CHECK_EQUAL_128(0x2f2c292623201d1a, 0x1714110e0b080502, q4); - CHECK_EQUAL_128(0x2e2b2825221f1c19, 0x1613100d0a070401, q5); - CHECK_EQUAL_128(0x2f2c292623201d1a, 0x1714110e0b080502, q6); - CHECK_EQUAL_128(0x302d2a2724211e1b, 0x1815120f0c090603, q7); - CHECK_EQUAL_128(0x2d2c272621201b1a, 0x15140f0e09080302, q8); - CHECK_EQUAL_128(0x2f2e292823221d1c, 0x171611100b0a0504, q9); - CHECK_EQUAL_128(0x31302b2a25241f1e, 0x191813120d0c0706, q10); - CHECK_EQUAL_128(0x2a2928271e1d1c1b, 0x1211100f06050403, q11); - CHECK_EQUAL_128(0x2e2d2c2b2221201f, 0x161514130a090807, q12); - CHECK_EQUAL_128(0x3231302f26252423, 0x1a1918170e0d0c0b, q13); - CHECK_EQUAL_128(0x232221201f1e1d1c, 0x0b0a090807060504, q31); - CHECK_EQUAL_128(0x2b2a292827262524, 0x131211100f0e0d0c, q0); - CHECK_EQUAL_128(0x333231302f2e2d2c, 0x1b1a191817161514, q1); + CHECK_EQUAL_128(0x2D2A2724211E1B18, 0x15120F0C09060300, q2); + CHECK_EQUAL_128(0x2E2B2825221F1C19, 0x1613100D0A070401, q3); + CHECK_EQUAL_128(0x2F2C292623201D1A, 0x1714110E0B080502, q4); + CHECK_EQUAL_128(0x2E2B2825221F1C19, 0x1613100D0A070401, q5); + CHECK_EQUAL_128(0x2F2C292623201D1A, 0x1714110E0B080502, q6); + CHECK_EQUAL_128(0x302D2A2724211E1B, 0x1815120F0C090603, q7); + CHECK_EQUAL_128(0x2D2C272621201B1A, 0x15140F0E09080302, q8); + CHECK_EQUAL_128(0x2F2E292823221D1C, 0x171611100B0A0504, q9); + CHECK_EQUAL_128(0x31302B2A25241F1E, 0x191813120D0C0706, q10); + CHECK_EQUAL_128(0x2A2928271E1D1C1B, 0x1211100F06050403, q11); + CHECK_EQUAL_128(0x2E2D2C2B2221201F, 0x161514130A090807, q12); + CHECK_EQUAL_128(0x3231302F26252423, 0x1A1918170E0D0C0B, q13); + CHECK_EQUAL_128(0x232221201F1E1D1C, 0x0B0A090807060504, q31); + CHECK_EQUAL_128(0x2B2A292827262524, 0x131211100F0E0D0C, q0); + CHECK_EQUAL_128(0x333231302F2E2D2C, 0x1B1A191817161514, q1); CHECK_EQUAL_64(src_base + 1, x17); CHECK_EQUAL_64(src_base + 1 + 48, x18); @@ -3886,24 +3882,24 @@ TEST(neon_ld3_lane) { RUN(); - CHECK_EQUAL_128(0x0001020304050607, 0x08090a0b0c0d0e0f, q0); - CHECK_EQUAL_128(0x0102030405060708, 0x090a0b0c0d0e0f10, q1); - CHECK_EQUAL_128(0x0203040506070809, 0x0a0b0c0d0e0f1011, q2); + CHECK_EQUAL_128(0x0001020304050607, 0x08090A0B0C0D0E0F, q0); + CHECK_EQUAL_128(0x0102030405060708, 0x090A0B0C0D0E0F10, q1); + CHECK_EQUAL_128(0x0203040506070809, 0x0A0B0C0D0E0F1011, q2); CHECK_EQUAL_128(0x0100020103020403, 0x0504060507060807, q3); - CHECK_EQUAL_128(0x0302040305040605, 0x0706080709080a09, q4); - CHECK_EQUAL_128(0x0504060507060807, 0x09080a090b0a0c0b, q5); + CHECK_EQUAL_128(0x0302040305040605, 0x0706080709080A09, q4); + CHECK_EQUAL_128(0x0504060507060807, 0x09080A090B0A0C0B, q5); CHECK_EQUAL_128(0x0302010004030201, 0x0504030206050403, q6); - CHECK_EQUAL_128(0x0706050408070605, 0x090807060a090807, q7); - CHECK_EQUAL_128(0x0b0a09080c0b0a09, 0x0d0c0b0a0e0d0c0b, q8); + CHECK_EQUAL_128(0x0706050408070605, 0x090807060A090807, q7); + CHECK_EQUAL_128(0x0B0A09080C0B0A09, 0x0D0C0B0A0E0D0C0B, q8); CHECK_EQUAL_128(0x0706050403020100, 0x0807060504030201, q9); - CHECK_EQUAL_128(0x0f0e0d0c0b0a0908, 0x100f0e0d0c0b0a09, q10); + CHECK_EQUAL_128(0x0F0E0D0C0B0A0908, 0x100F0E0D0C0B0A09, q10); CHECK_EQUAL_128(0x1716151413121110, 0x1817161514131211, q11); - CHECK_EQUAL_128(0x0f0e0d0c0b0a0908, 0x0706050003020100, q12); - CHECK_EQUAL_128(0x1f1e1d1c1b1a1918, 0x1716150113121110, q13); - CHECK_EQUAL_128(0x2f2e2d2c2b2a2928, 0x2726250223222120, q14); - CHECK_EQUAL_128(0x0f0e0d0c0b0a0908, 0x0100050403020100, q15); - CHECK_EQUAL_128(0x1f1e1d1c1b1a1918, 0x0302151413121110, q16); - CHECK_EQUAL_128(0x2f2e2d2c2b2a2928, 0x0504252423222120, q17); + CHECK_EQUAL_128(0x0F0E0D0C0B0A0908, 0x0706050003020100, q12); + CHECK_EQUAL_128(0x1F1E1D1C1B1A1918, 0x1716150113121110, q13); + CHECK_EQUAL_128(0x2F2E2D2C2B2A2928, 0x2726250223222120, q14); + CHECK_EQUAL_128(0x0F0E0D0C0B0A0908, 0x0100050403020100, q15); + CHECK_EQUAL_128(0x1F1E1D1C1B1A1918, 0x0302151413121110, q16); + CHECK_EQUAL_128(0x2F2E2D2C2B2A2928, 0x0504252423222120, q17); TEARDOWN(); } @@ -3978,29 +3974,29 @@ TEST(neon_ld3_lane_postindex) { RUN(); - CHECK_EQUAL_128(0x000306090c0f1215, 0x181b1e2124272a2d, q0); - CHECK_EQUAL_128(0x0104070a0d101316, 0x191c1f2225282b2e, q1); - CHECK_EQUAL_128(0x0205080b0e111417, 0x1a1d202326292c2f, q2); - CHECK_EQUAL_128(0x010007060d0c1312, 0x19181f1e25242b2a, q3); - CHECK_EQUAL_128(0x030209080f0e1514, 0x1b1a212027262d2c, q4); - CHECK_EQUAL_128(0x05040b0a11101716, 0x1d1c232229282f2e, q5); - CHECK_EQUAL_128(0x030201000f0e0d0c, 0x1b1a191827262524, q6); - CHECK_EQUAL_128(0x0706050413121110, 0x1f1e1d1c2b2a2928, q7); - CHECK_EQUAL_128(0x0b0a090817161514, 0x232221202f2e2d2c, q8); - CHECK_EQUAL_128(0x0706050403020100, 0x1f1e1d1c1b1a1918, q9); - CHECK_EQUAL_128(0x0f0e0d0c0b0a0908, 0x2726252423222120, q10); - CHECK_EQUAL_128(0x1716151413121110, 0x2f2e2d2c2b2a2928, q11); - CHECK_EQUAL_128(0x0f0e0d0c0b0a0908, 0x0706050003020100, q12); - CHECK_EQUAL_128(0x1f1e1d1c1b1a1918, 0x1716150113121110, q13); - CHECK_EQUAL_128(0x2f2e2d2c2b2a2928, 0x2726250223222120, q14); - CHECK_EQUAL_128(0x0f0e0d0c0b0a0908, 0x0100050403020100, q15); - CHECK_EQUAL_128(0x1f1e1d1c1b1a1918, 0x0302151413121110, q16); - CHECK_EQUAL_128(0x2f2e2d2c2b2a2928, 0x0504252423222120, q17); - CHECK_EQUAL_128(0x0f0e0d0c03020100, 0x0706050403020100, q18); - CHECK_EQUAL_128(0x1f1e1d1c07060504, 0x1716151413121110, q19); - CHECK_EQUAL_128(0x2f2e2d2c0b0a0908, 0x2726252423222120, q20); + CHECK_EQUAL_128(0x000306090C0F1215, 0x181B1E2124272A2D, q0); + CHECK_EQUAL_128(0x0104070A0D101316, 0x191C1F2225282B2E, q1); + CHECK_EQUAL_128(0x0205080B0E111417, 0x1A1D202326292C2F, q2); + CHECK_EQUAL_128(0x010007060D0C1312, 0x19181F1E25242B2A, q3); + CHECK_EQUAL_128(0x030209080F0E1514, 0x1B1A212027262D2C, q4); + CHECK_EQUAL_128(0x05040B0A11101716, 0x1D1C232229282F2E, q5); + CHECK_EQUAL_128(0x030201000F0E0D0C, 0x1B1A191827262524, q6); + CHECK_EQUAL_128(0x0706050413121110, 0x1F1E1D1C2B2A2928, q7); + CHECK_EQUAL_128(0x0B0A090817161514, 0x232221202F2E2D2C, q8); + CHECK_EQUAL_128(0x0706050403020100, 0x1F1E1D1C1B1A1918, q9); + CHECK_EQUAL_128(0x0F0E0D0C0B0A0908, 0x2726252423222120, q10); + CHECK_EQUAL_128(0x1716151413121110, 0x2F2E2D2C2B2A2928, q11); + CHECK_EQUAL_128(0x0F0E0D0C0B0A0908, 0x0706050003020100, q12); + CHECK_EQUAL_128(0x1F1E1D1C1B1A1918, 0x1716150113121110, q13); + CHECK_EQUAL_128(0x2F2E2D2C2B2A2928, 0x2726250223222120, q14); + CHECK_EQUAL_128(0x0F0E0D0C0B0A0908, 0x0100050403020100, q15); + CHECK_EQUAL_128(0x1F1E1D1C1B1A1918, 0x0302151413121110, q16); + CHECK_EQUAL_128(0x2F2E2D2C2B2A2928, 0x0504252423222120, q17); + CHECK_EQUAL_128(0x0F0E0D0C03020100, 0x0706050403020100, q18); + CHECK_EQUAL_128(0x1F1E1D1C07060504, 0x1716151413121110, q19); + CHECK_EQUAL_128(0x2F2E2D2C0B0A0908, 0x2726252423222120, q20); CHECK_EQUAL_128(0x0706050403020100, 0x0706050403020100, q21); - CHECK_EQUAL_128(0x0f0e0d0c0b0a0908, 0x1716151413121110, q22); + CHECK_EQUAL_128(0x0F0E0D0C0B0A0908, 0x1716151413121110, q22); CHECK_EQUAL_128(0x1716151413121110, 0x2726252423222120, q23); CHECK_EQUAL_64(src_base + 48, x17); @@ -4053,19 +4049,19 @@ TEST(neon_ld3_alllanes) { CHECK_EQUAL_128(0x0606060606060606, 0x0606060606060606, q5); CHECK_EQUAL_128(0x0000000000000000, 0x0605060506050605, q6); CHECK_EQUAL_128(0x0000000000000000, 0x0807080708070807, q7); - CHECK_EQUAL_128(0x0000000000000000, 0x0a090a090a090a09, q8); + CHECK_EQUAL_128(0x0000000000000000, 0x0A090A090A090A09, q8); CHECK_EQUAL_128(0x0706070607060706, 0x0706070607060706, q9); CHECK_EQUAL_128(0x0908090809080908, 0x0908090809080908, q10); - CHECK_EQUAL_128(0x0b0a0b0a0b0a0b0a, 0x0b0a0b0a0b0a0b0a, q11); - CHECK_EQUAL_128(0x0000000000000000, 0x0f0e0d0c0f0e0d0c, q12); + CHECK_EQUAL_128(0x0B0A0B0A0B0A0B0A, 0x0B0A0B0A0B0A0B0A, q11); + CHECK_EQUAL_128(0x0000000000000000, 0x0F0E0D0C0F0E0D0C, q12); CHECK_EQUAL_128(0x0000000000000000, 0x1312111013121110, q13); CHECK_EQUAL_128(0x0000000000000000, 0x1716151417161514, q14); - CHECK_EQUAL_128(0x100f0e0d100f0e0d, 0x100f0e0d100f0e0d, q15); + CHECK_EQUAL_128(0x100F0E0D100F0E0D, 0x100F0E0D100F0E0D, q15); CHECK_EQUAL_128(0x1413121114131211, 0x1413121114131211, q16); CHECK_EQUAL_128(0x1817161518171615, 0x1817161518171615, q17); - CHECK_EQUAL_128(0x201f1e1d1c1b1a19, 0x201f1e1d1c1b1a19, q18); + CHECK_EQUAL_128(0x201F1E1D1C1B1A19, 0x201F1E1D1C1B1A19, q18); CHECK_EQUAL_128(0x2827262524232221, 0x2827262524232221, q19); - CHECK_EQUAL_128(0x302f2e2d2c2b2a29, 0x302f2e2d2c2b2a29, q20); + CHECK_EQUAL_128(0x302F2E2D2C2B2A29, 0x302F2E2D2C2B2A29, q20); TEARDOWN(); } @@ -4104,19 +4100,19 @@ TEST(neon_ld3_alllanes_postindex) { CHECK_EQUAL_128(0x0606060606060606, 0x0606060606060606, q5); CHECK_EQUAL_128(0x0000000000000000, 0x0605060506050605, q6); CHECK_EQUAL_128(0x0000000000000000, 0x0807080708070807, q7); - CHECK_EQUAL_128(0x0000000000000000, 0x0a090a090a090a09, q8); + CHECK_EQUAL_128(0x0000000000000000, 0x0A090A090A090A09, q8); CHECK_EQUAL_128(0x0706070607060706, 0x0706070607060706, q9); CHECK_EQUAL_128(0x0908090809080908, 0x0908090809080908, q10); - CHECK_EQUAL_128(0x0b0a0b0a0b0a0b0a, 0x0b0a0b0a0b0a0b0a, q11); - CHECK_EQUAL_128(0x0000000000000000, 0x0f0e0d0c0f0e0d0c, q12); + CHECK_EQUAL_128(0x0B0A0B0A0B0A0B0A, 0x0B0A0B0A0B0A0B0A, q11); + CHECK_EQUAL_128(0x0000000000000000, 0x0F0E0D0C0F0E0D0C, q12); CHECK_EQUAL_128(0x0000000000000000, 0x1312111013121110, q13); CHECK_EQUAL_128(0x0000000000000000, 0x1716151417161514, q14); - CHECK_EQUAL_128(0x100f0e0d100f0e0d, 0x100f0e0d100f0e0d, q15); + CHECK_EQUAL_128(0x100F0E0D100F0E0D, 0x100F0E0D100F0E0D, q15); CHECK_EQUAL_128(0x1413121114131211, 0x1413121114131211, q16); CHECK_EQUAL_128(0x1817161518171615, 0x1817161518171615, q17); - CHECK_EQUAL_128(0x201f1e1d1c1b1a19, 0x201f1e1d1c1b1a19, q18); + CHECK_EQUAL_128(0x201F1E1D1C1B1A19, 0x201F1E1D1C1B1A19, q18); CHECK_EQUAL_128(0x2827262524232221, 0x2827262524232221, q19); - CHECK_EQUAL_128(0x302f2e2d2c2b2a29, 0x302f2e2d2c2b2a29, q20); + CHECK_EQUAL_128(0x302F2E2D2C2B2A29, 0x302F2E2D2C2B2A29, q20); TEARDOWN(); } @@ -4144,22 +4140,22 @@ TEST(neon_ld4_d) { RUN(); - CHECK_EQUAL_128(0, 0x1c1814100c080400, q2); - CHECK_EQUAL_128(0, 0x1d1915110d090501, q3); - CHECK_EQUAL_128(0, 0x1e1a16120e0a0602, q4); - CHECK_EQUAL_128(0, 0x1f1b17130f0b0703, q5); - CHECK_EQUAL_128(0, 0x1d1915110d090501, q6); - CHECK_EQUAL_128(0, 0x1e1a16120e0a0602, q7); - CHECK_EQUAL_128(0, 0x1f1b17130f0b0703, q8); - CHECK_EQUAL_128(0, 0x201c1814100c0804, q9); - CHECK_EQUAL_128(0, 0x1b1a13120b0a0302, q10); - CHECK_EQUAL_128(0, 0x1d1c15140d0c0504, q11); - CHECK_EQUAL_128(0, 0x1f1e17160f0e0706, q12); + CHECK_EQUAL_128(0, 0x1C1814100C080400, q2); + CHECK_EQUAL_128(0, 0x1D1915110D090501, q3); + CHECK_EQUAL_128(0, 0x1E1A16120E0A0602, q4); + CHECK_EQUAL_128(0, 0x1F1B17130F0B0703, q5); + CHECK_EQUAL_128(0, 0x1D1915110D090501, q6); + CHECK_EQUAL_128(0, 0x1E1A16120E0A0602, q7); + CHECK_EQUAL_128(0, 0x1F1B17130F0B0703, q8); + CHECK_EQUAL_128(0, 0x201C1814100C0804, q9); + CHECK_EQUAL_128(0, 0x1B1A13120B0A0302, q10); + CHECK_EQUAL_128(0, 0x1D1C15140D0C0504, q11); + CHECK_EQUAL_128(0, 0x1F1E17160F0E0706, q12); CHECK_EQUAL_128(0, 0x2120191811100908, q13); CHECK_EQUAL_128(0, 0x1615141306050403, q30); - CHECK_EQUAL_128(0, 0x1a1918170a090807, q31); - CHECK_EQUAL_128(0, 0x1e1d1c1b0e0d0c0b, q0); - CHECK_EQUAL_128(0, 0x2221201f1211100f, q1); + CHECK_EQUAL_128(0, 0x1A1918170A090807, q31); + CHECK_EQUAL_128(0, 0x1E1D1C1B0E0D0C0B, q0); + CHECK_EQUAL_128(0, 0x2221201F1211100F, q1); TEARDOWN(); } @@ -4195,25 +4191,25 @@ TEST(neon_ld4_d_postindex) { RUN(); - CHECK_EQUAL_128(0, 0x1c1814100c080400, q2); - CHECK_EQUAL_128(0, 0x1d1915110d090501, q3); - CHECK_EQUAL_128(0, 0x1e1a16120e0a0602, q4); - CHECK_EQUAL_128(0, 0x1f1b17130f0b0703, q5); - CHECK_EQUAL_128(0, 0x1d1915110d090501, q6); - CHECK_EQUAL_128(0, 0x1e1a16120e0a0602, q7); - CHECK_EQUAL_128(0, 0x1f1b17130f0b0703, q8); - CHECK_EQUAL_128(0, 0x201c1814100c0804, q9); - CHECK_EQUAL_128(0, 0x1b1a13120b0a0302, q10); - CHECK_EQUAL_128(0, 0x1d1c15140d0c0504, q11); - CHECK_EQUAL_128(0, 0x1f1e17160f0e0706, q12); + CHECK_EQUAL_128(0, 0x1C1814100C080400, q2); + CHECK_EQUAL_128(0, 0x1D1915110D090501, q3); + CHECK_EQUAL_128(0, 0x1E1A16120E0A0602, q4); + CHECK_EQUAL_128(0, 0x1F1B17130F0B0703, q5); + CHECK_EQUAL_128(0, 0x1D1915110D090501, q6); + CHECK_EQUAL_128(0, 0x1E1A16120E0A0602, q7); + CHECK_EQUAL_128(0, 0x1F1B17130F0B0703, q8); + CHECK_EQUAL_128(0, 0x201C1814100C0804, q9); + CHECK_EQUAL_128(0, 0x1B1A13120B0A0302, q10); + CHECK_EQUAL_128(0, 0x1D1C15140D0C0504, q11); + CHECK_EQUAL_128(0, 0x1F1E17160F0E0706, q12); CHECK_EQUAL_128(0, 0x2120191811100908, q13); CHECK_EQUAL_128(0, 0x1615141306050403, q14); - CHECK_EQUAL_128(0, 0x1a1918170a090807, q15); - CHECK_EQUAL_128(0, 0x1e1d1c1b0e0d0c0b, q16); - CHECK_EQUAL_128(0, 0x2221201f1211100f, q17); + CHECK_EQUAL_128(0, 0x1A1918170A090807, q15); + CHECK_EQUAL_128(0, 0x1E1D1C1B0E0D0C0B, q16); + CHECK_EQUAL_128(0, 0x2221201F1211100F, q17); CHECK_EQUAL_128(0, 0x1716151407060504, q30); - CHECK_EQUAL_128(0, 0x1b1a19180b0a0908, q31); - CHECK_EQUAL_128(0, 0x1f1e1d1c0f0e0d0c, q0); + CHECK_EQUAL_128(0, 0x1B1A19180B0A0908, q31); + CHECK_EQUAL_128(0, 0x1F1E1D1C0F0E0D0C, q0); CHECK_EQUAL_128(0, 0x2322212013121110, q1); CHECK_EQUAL_64(src_base + 1, x17); @@ -4249,26 +4245,26 @@ TEST(neon_ld4_q) { RUN(); - CHECK_EQUAL_128(0x3c3834302c282420, 0x1c1814100c080400, q2); - CHECK_EQUAL_128(0x3d3935312d292521, 0x1d1915110d090501, q3); - CHECK_EQUAL_128(0x3e3a36322e2a2622, 0x1e1a16120e0a0602, q4); - CHECK_EQUAL_128(0x3f3b37332f2b2723, 0x1f1b17130f0b0703, q5); - CHECK_EQUAL_128(0x3d3935312d292521, 0x1d1915110d090501, q6); - CHECK_EQUAL_128(0x3e3a36322e2a2622, 0x1e1a16120e0a0602, q7); - CHECK_EQUAL_128(0x3f3b37332f2b2723, 0x1f1b17130f0b0703, q8); - CHECK_EQUAL_128(0x403c3834302c2824, 0x201c1814100c0804, q9); - CHECK_EQUAL_128(0x3b3a33322b2a2322, 0x1b1a13120b0a0302, q10); - CHECK_EQUAL_128(0x3d3c35342d2c2524, 0x1d1c15140d0c0504, q11); - CHECK_EQUAL_128(0x3f3e37362f2e2726, 0x1f1e17160f0e0706, q12); + CHECK_EQUAL_128(0x3C3834302C282420, 0x1C1814100C080400, q2); + CHECK_EQUAL_128(0x3D3935312D292521, 0x1D1915110D090501, q3); + CHECK_EQUAL_128(0x3E3A36322E2A2622, 0x1E1A16120E0A0602, q4); + CHECK_EQUAL_128(0x3F3B37332F2B2723, 0x1F1B17130F0B0703, q5); + CHECK_EQUAL_128(0x3D3935312D292521, 0x1D1915110D090501, q6); + CHECK_EQUAL_128(0x3E3A36322E2A2622, 0x1E1A16120E0A0602, q7); + CHECK_EQUAL_128(0x3F3B37332F2B2723, 0x1F1B17130F0B0703, q8); + CHECK_EQUAL_128(0x403C3834302C2824, 0x201C1814100C0804, q9); + CHECK_EQUAL_128(0x3B3A33322B2A2322, 0x1B1A13120B0A0302, q10); + CHECK_EQUAL_128(0x3D3C35342D2C2524, 0x1D1C15140D0C0504, q11); + CHECK_EQUAL_128(0x3F3E37362F2E2726, 0x1F1E17160F0E0706, q12); CHECK_EQUAL_128(0x4140393831302928, 0x2120191811100908, q13); CHECK_EQUAL_128(0x3635343326252423, 0x1615141306050403, q14); - CHECK_EQUAL_128(0x3a3938372a292827, 0x1a1918170a090807, q15); - CHECK_EQUAL_128(0x3e3d3c3b2e2d2c2b, 0x1e1d1c1b0e0d0c0b, q16); - CHECK_EQUAL_128(0x4241403f3231302f, 0x2221201f1211100f, q17); - CHECK_EQUAL_128(0x2b2a292827262524, 0x0b0a090807060504, q18); - CHECK_EQUAL_128(0x333231302f2e2d2c, 0x131211100f0e0d0c, q19); - CHECK_EQUAL_128(0x3b3a393837363534, 0x1b1a191817161514, q20); - CHECK_EQUAL_128(0x434241403f3e3d3c, 0x232221201f1e1d1c, q21); + CHECK_EQUAL_128(0x3A3938372A292827, 0x1A1918170A090807, q15); + CHECK_EQUAL_128(0x3E3D3C3B2E2D2C2B, 0x1E1D1C1B0E0D0C0B, q16); + CHECK_EQUAL_128(0x4241403F3231302F, 0x2221201F1211100F, q17); + CHECK_EQUAL_128(0x2B2A292827262524, 0x0B0A090807060504, q18); + CHECK_EQUAL_128(0x333231302F2E2D2C, 0x131211100F0E0D0C, q19); + CHECK_EQUAL_128(0x3B3A393837363534, 0x1B1A191817161514, q20); + CHECK_EQUAL_128(0x434241403F3E3D3C, 0x232221201F1E1D1C, q21); TEARDOWN(); } @@ -4304,26 +4300,26 @@ TEST(neon_ld4_q_postindex) { RUN(); - CHECK_EQUAL_128(0x3c3834302c282420, 0x1c1814100c080400, q2); - CHECK_EQUAL_128(0x3d3935312d292521, 0x1d1915110d090501, q3); - CHECK_EQUAL_128(0x3e3a36322e2a2622, 0x1e1a16120e0a0602, q4); - CHECK_EQUAL_128(0x3f3b37332f2b2723, 0x1f1b17130f0b0703, q5); - CHECK_EQUAL_128(0x3d3935312d292521, 0x1d1915110d090501, q6); - CHECK_EQUAL_128(0x3e3a36322e2a2622, 0x1e1a16120e0a0602, q7); - CHECK_EQUAL_128(0x3f3b37332f2b2723, 0x1f1b17130f0b0703, q8); - CHECK_EQUAL_128(0x403c3834302c2824, 0x201c1814100c0804, q9); - CHECK_EQUAL_128(0x3b3a33322b2a2322, 0x1b1a13120b0a0302, q10); - CHECK_EQUAL_128(0x3d3c35342d2c2524, 0x1d1c15140d0c0504, q11); - CHECK_EQUAL_128(0x3f3e37362f2e2726, 0x1f1e17160f0e0706, q12); + CHECK_EQUAL_128(0x3C3834302C282420, 0x1C1814100C080400, q2); + CHECK_EQUAL_128(0x3D3935312D292521, 0x1D1915110D090501, q3); + CHECK_EQUAL_128(0x3E3A36322E2A2622, 0x1E1A16120E0A0602, q4); + CHECK_EQUAL_128(0x3F3B37332F2B2723, 0x1F1B17130F0B0703, q5); + CHECK_EQUAL_128(0x3D3935312D292521, 0x1D1915110D090501, q6); + CHECK_EQUAL_128(0x3E3A36322E2A2622, 0x1E1A16120E0A0602, q7); + CHECK_EQUAL_128(0x3F3B37332F2B2723, 0x1F1B17130F0B0703, q8); + CHECK_EQUAL_128(0x403C3834302C2824, 0x201C1814100C0804, q9); + CHECK_EQUAL_128(0x3B3A33322B2A2322, 0x1B1A13120B0A0302, q10); + CHECK_EQUAL_128(0x3D3C35342D2C2524, 0x1D1C15140D0C0504, q11); + CHECK_EQUAL_128(0x3F3E37362F2E2726, 0x1F1E17160F0E0706, q12); CHECK_EQUAL_128(0x4140393831302928, 0x2120191811100908, q13); CHECK_EQUAL_128(0x3635343326252423, 0x1615141306050403, q14); - CHECK_EQUAL_128(0x3a3938372a292827, 0x1a1918170a090807, q15); - CHECK_EQUAL_128(0x3e3d3c3b2e2d2c2b, 0x1e1d1c1b0e0d0c0b, q16); - CHECK_EQUAL_128(0x4241403f3231302f, 0x2221201f1211100f, q17); - CHECK_EQUAL_128(0x2b2a292827262524, 0x0b0a090807060504, q30); - CHECK_EQUAL_128(0x333231302f2e2d2c, 0x131211100f0e0d0c, q31); - CHECK_EQUAL_128(0x3b3a393837363534, 0x1b1a191817161514, q0); - CHECK_EQUAL_128(0x434241403f3e3d3c, 0x232221201f1e1d1c, q1); + CHECK_EQUAL_128(0x3A3938372A292827, 0x1A1918170A090807, q15); + CHECK_EQUAL_128(0x3E3D3C3B2E2D2C2B, 0x1E1D1C1B0E0D0C0B, q16); + CHECK_EQUAL_128(0x4241403F3231302F, 0x2221201F1211100F, q17); + CHECK_EQUAL_128(0x2B2A292827262524, 0x0B0A090807060504, q30); + CHECK_EQUAL_128(0x333231302F2E2D2C, 0x131211100F0E0D0C, q31); + CHECK_EQUAL_128(0x3B3A393837363534, 0x1B1A191817161514, q0); + CHECK_EQUAL_128(0x434241403F3E3D3C, 0x232221201F1E1D1C, q1); CHECK_EQUAL_64(src_base + 1, x17); CHECK_EQUAL_64(src_base + 1 + 64, x18); @@ -4405,38 +4401,38 @@ TEST(neon_ld4_lane) { RUN(); - CHECK_EQUAL_128(0x0001020304050607, 0x08090a0b0c0d0e0f, q0); - CHECK_EQUAL_128(0x0102030405060708, 0x090a0b0c0d0e0f10, q1); - CHECK_EQUAL_128(0x0203040506070809, 0x0a0b0c0d0e0f1011, q2); - CHECK_EQUAL_128(0x030405060708090a, 0x0b0c0d0e0f101112, q3); + CHECK_EQUAL_128(0x0001020304050607, 0x08090A0B0C0D0E0F, q0); + CHECK_EQUAL_128(0x0102030405060708, 0x090A0B0C0D0E0F10, q1); + CHECK_EQUAL_128(0x0203040506070809, 0x0A0B0C0D0E0F1011, q2); + CHECK_EQUAL_128(0x030405060708090A, 0x0B0C0D0E0F101112, q3); CHECK_EQUAL_128(0x0100020103020403, 0x0504060507060807, q4); - CHECK_EQUAL_128(0x0302040305040605, 0x0706080709080a09, q5); - CHECK_EQUAL_128(0x0504060507060807, 0x09080a090b0a0c0b, q6); - CHECK_EQUAL_128(0x0706080709080a09, 0x0b0a0c0b0d0c0e0d, q7); + CHECK_EQUAL_128(0x0302040305040605, 0x0706080709080A09, q5); + CHECK_EQUAL_128(0x0504060507060807, 0x09080A090B0A0C0B, q6); + CHECK_EQUAL_128(0x0706080709080A09, 0x0B0A0C0B0D0C0E0D, q7); CHECK_EQUAL_128(0x0302010004030201, 0x0504030206050403, q8); - CHECK_EQUAL_128(0x0706050408070605, 0x090807060a090807, q9); - CHECK_EQUAL_128(0x0b0a09080c0b0a09, 0x0d0c0b0a0e0d0c0b, q10); - CHECK_EQUAL_128(0x0f0e0d0c100f0e0d, 0x11100f0e1211100f, q11); + CHECK_EQUAL_128(0x0706050408070605, 0x090807060A090807, q9); + CHECK_EQUAL_128(0x0B0A09080C0B0A09, 0x0D0C0B0A0E0D0C0B, q10); + CHECK_EQUAL_128(0x0F0E0D0C100F0E0D, 0x11100F0E1211100F, q11); CHECK_EQUAL_128(0x0706050403020100, 0x0807060504030201, q12); - CHECK_EQUAL_128(0x0f0e0d0c0b0a0908, 0x100f0e0d0c0b0a09, q13); + CHECK_EQUAL_128(0x0F0E0D0C0B0A0908, 0x100F0E0D0C0B0A09, q13); CHECK_EQUAL_128(0x1716151413121110, 0x1817161514131211, q14); - CHECK_EQUAL_128(0x1f1e1d1c1b1a1918, 0x201f1e1d1c1b1a19, q15); - CHECK_EQUAL_128(0x0f0e0d0c0b0a0908, 0x0706050003020100, q16); - CHECK_EQUAL_128(0x1f1e1d1c1b1a1918, 0x1716150113121110, q17); - CHECK_EQUAL_128(0x2f2e2d2c2b2a2928, 0x2726250223222120, q18); - CHECK_EQUAL_128(0x3f3e3d3c3b3a3938, 0x3736350333323130, q19); - CHECK_EQUAL_128(0x0f0e0d0c0b0a0908, 0x0100050403020100, q20); - CHECK_EQUAL_128(0x1f1e1d1c1b1a1918, 0x0302151413121110, q21); - CHECK_EQUAL_128(0x2f2e2d2c2b2a2928, 0x0504252423222120, q22); - CHECK_EQUAL_128(0x3f3e3d3c3b3a3938, 0x0706353433323130, q23); - CHECK_EQUAL_128(0x0f0e0d0c03020100, 0x0706050403020100, q24); - CHECK_EQUAL_128(0x1f1e1d1c07060504, 0x1716151413121110, q25); - CHECK_EQUAL_128(0x2f2e2d2c0b0a0908, 0x2726252423222120, q26); - CHECK_EQUAL_128(0x3f3e3d3c0f0e0d0c, 0x3736353433323130, q27); + CHECK_EQUAL_128(0x1F1E1D1C1B1A1918, 0x201F1E1D1C1B1A19, q15); + CHECK_EQUAL_128(0x0F0E0D0C0B0A0908, 0x0706050003020100, q16); + CHECK_EQUAL_128(0x1F1E1D1C1B1A1918, 0x1716150113121110, q17); + CHECK_EQUAL_128(0x2F2E2D2C2B2A2928, 0x2726250223222120, q18); + CHECK_EQUAL_128(0x3F3E3D3C3B3A3938, 0x3736350333323130, q19); + CHECK_EQUAL_128(0x0F0E0D0C0B0A0908, 0x0100050403020100, q20); + CHECK_EQUAL_128(0x1F1E1D1C1B1A1918, 0x0302151413121110, q21); + CHECK_EQUAL_128(0x2F2E2D2C2B2A2928, 0x0504252423222120, q22); + CHECK_EQUAL_128(0x3F3E3D3C3B3A3938, 0x0706353433323130, q23); + CHECK_EQUAL_128(0x0F0E0D0C03020100, 0x0706050403020100, q24); + CHECK_EQUAL_128(0x1F1E1D1C07060504, 0x1716151413121110, q25); + CHECK_EQUAL_128(0x2F2E2D2C0B0A0908, 0x2726252423222120, q26); + CHECK_EQUAL_128(0x3F3E3D3C0F0E0D0C, 0x3736353433323130, q27); CHECK_EQUAL_128(0x0706050403020100, 0x0706050403020100, q28); - CHECK_EQUAL_128(0x0f0e0d0c0b0a0908, 0x1716151413121110, q29); + CHECK_EQUAL_128(0x0F0E0D0C0B0A0908, 0x1716151413121110, q29); CHECK_EQUAL_128(0x1716151413121110, 0x2726252423222120, q30); - CHECK_EQUAL_128(0x1f1e1d1c1b1a1918, 0x3736353433323130, q31); + CHECK_EQUAL_128(0x1F1E1D1C1B1A1918, 0x3736353433323130, q31); TEARDOWN(); } @@ -4522,38 +4518,38 @@ TEST(neon_ld4_lane_postindex) { RUN(); - CHECK_EQUAL_128(0x0004080c1014181c, 0x2024282c3034383c, q0); - CHECK_EQUAL_128(0x0105090d1115191d, 0x2125292d3135393d, q1); - CHECK_EQUAL_128(0x02060a0e12161a1e, 0x22262a2e32363a3e, q2); - CHECK_EQUAL_128(0x03070b0f13171b1f, 0x23272b2f33373b3f, q3); + CHECK_EQUAL_128(0x0004080C1014181C, 0x2024282C3034383C, q0); + CHECK_EQUAL_128(0x0105090D1115191D, 0x2125292D3135393D, q1); + CHECK_EQUAL_128(0x02060A0E12161A1E, 0x22262A2E32363A3E, q2); + CHECK_EQUAL_128(0x03070B0F13171B1F, 0x23272B2F33373B3F, q3); CHECK_EQUAL_128(0x0100090811101918, 0x2120292831303938, q4); - CHECK_EQUAL_128(0x03020b0a13121b1a, 0x23222b2a33323b3a, q5); - CHECK_EQUAL_128(0x05040d0c15141d1c, 0x25242d2c35343d3c, q6); - CHECK_EQUAL_128(0x07060f0e17161f1e, 0x27262f2e37363f3e, q7); + CHECK_EQUAL_128(0x03020B0A13121B1A, 0x23222B2A33323B3A, q5); + CHECK_EQUAL_128(0x05040D0C15141D1C, 0x25242D2C35343D3C, q6); + CHECK_EQUAL_128(0x07060F0E17161F1E, 0x27262F2E37363F3E, q7); CHECK_EQUAL_128(0x0302010013121110, 0x2322212033323130, q8); CHECK_EQUAL_128(0x0706050417161514, 0x2726252437363534, q9); - CHECK_EQUAL_128(0x0b0a09081b1a1918, 0x2b2a29283b3a3938, q10); - CHECK_EQUAL_128(0x0f0e0d0c1f1e1d1c, 0x2f2e2d2c3f3e3d3c, q11); + CHECK_EQUAL_128(0x0B0A09081B1A1918, 0x2B2A29283B3A3938, q10); + CHECK_EQUAL_128(0x0F0E0D0C1F1E1D1C, 0x2F2E2D2C3F3E3D3C, q11); CHECK_EQUAL_128(0x0706050403020100, 0x2726252423222120, q12); - CHECK_EQUAL_128(0x0f0e0d0c0b0a0908, 0x2f2e2d2c2b2a2928, q13); + CHECK_EQUAL_128(0x0F0E0D0C0B0A0908, 0x2F2E2D2C2B2A2928, q13); CHECK_EQUAL_128(0x1716151413121110, 0x3736353433323130, q14); - CHECK_EQUAL_128(0x1f1e1d1c1b1a1918, 0x3f3e3d3c3b3a3938, q15); - CHECK_EQUAL_128(0x0f0e0d0c0b0a0908, 0x0706050003020100, q16); - CHECK_EQUAL_128(0x1f1e1d1c1b1a1918, 0x1716150113121110, q17); - CHECK_EQUAL_128(0x2f2e2d2c2b2a2928, 0x2726250223222120, q18); - CHECK_EQUAL_128(0x3f3e3d3c3b3a3938, 0x3736350333323130, q19); - CHECK_EQUAL_128(0x0f0e0d0c0b0a0908, 0x0100050403020100, q20); - CHECK_EQUAL_128(0x1f1e1d1c1b1a1918, 0x0302151413121110, q21); - CHECK_EQUAL_128(0x2f2e2d2c2b2a2928, 0x0504252423222120, q22); - CHECK_EQUAL_128(0x3f3e3d3c3b3a3938, 0x0706353433323130, q23); - CHECK_EQUAL_128(0x0f0e0d0c03020100, 0x0706050403020100, q24); - CHECK_EQUAL_128(0x1f1e1d1c07060504, 0x1716151413121110, q25); - CHECK_EQUAL_128(0x2f2e2d2c0b0a0908, 0x2726252423222120, q26); - CHECK_EQUAL_128(0x3f3e3d3c0f0e0d0c, 0x3736353433323130, q27); + CHECK_EQUAL_128(0x1F1E1D1C1B1A1918, 0x3F3E3D3C3B3A3938, q15); + CHECK_EQUAL_128(0x0F0E0D0C0B0A0908, 0x0706050003020100, q16); + CHECK_EQUAL_128(0x1F1E1D1C1B1A1918, 0x1716150113121110, q17); + CHECK_EQUAL_128(0x2F2E2D2C2B2A2928, 0x2726250223222120, q18); + CHECK_EQUAL_128(0x3F3E3D3C3B3A3938, 0x3736350333323130, q19); + CHECK_EQUAL_128(0x0F0E0D0C0B0A0908, 0x0100050403020100, q20); + CHECK_EQUAL_128(0x1F1E1D1C1B1A1918, 0x0302151413121110, q21); + CHECK_EQUAL_128(0x2F2E2D2C2B2A2928, 0x0504252423222120, q22); + CHECK_EQUAL_128(0x3F3E3D3C3B3A3938, 0x0706353433323130, q23); + CHECK_EQUAL_128(0x0F0E0D0C03020100, 0x0706050403020100, q24); + CHECK_EQUAL_128(0x1F1E1D1C07060504, 0x1716151413121110, q25); + CHECK_EQUAL_128(0x2F2E2D2C0B0A0908, 0x2726252423222120, q26); + CHECK_EQUAL_128(0x3F3E3D3C0F0E0D0C, 0x3736353433323130, q27); CHECK_EQUAL_128(0x0706050403020100, 0x0706050403020100, q28); - CHECK_EQUAL_128(0x0f0e0d0c0b0a0908, 0x1716151413121110, q29); + CHECK_EQUAL_128(0x0F0E0D0C0B0A0908, 0x1716151413121110, q29); CHECK_EQUAL_128(0x1716151413121110, 0x2726252423222120, q30); - CHECK_EQUAL_128(0x1f1e1d1c1b1a1918, 0x3736353433323130, q31); + CHECK_EQUAL_128(0x1F1E1D1C1B1A1918, 0x3736353433323130, q31); CHECK_EQUAL_64(src_base + 64, x17); CHECK_EQUAL_64(src_base + 64, x18); @@ -4608,24 +4604,24 @@ TEST(neon_ld4_alllanes) { CHECK_EQUAL_128(0x0808080808080808, 0x0808080808080808, q7); CHECK_EQUAL_128(0x0000000000000000, 0x0706070607060706, q8); CHECK_EQUAL_128(0x0000000000000000, 0x0908090809080908, q9); - CHECK_EQUAL_128(0x0000000000000000, 0x0b0a0b0a0b0a0b0a, q10); - CHECK_EQUAL_128(0x0000000000000000, 0x0d0c0d0c0d0c0d0c, q11); + CHECK_EQUAL_128(0x0000000000000000, 0x0B0A0B0A0B0A0B0A, q10); + CHECK_EQUAL_128(0x0000000000000000, 0x0D0C0D0C0D0C0D0C, q11); CHECK_EQUAL_128(0x0807080708070807, 0x0807080708070807, q12); - CHECK_EQUAL_128(0x0a090a090a090a09, 0x0a090a090a090a09, q13); - CHECK_EQUAL_128(0x0c0b0c0b0c0b0c0b, 0x0c0b0c0b0c0b0c0b, q14); - CHECK_EQUAL_128(0x0e0d0e0d0e0d0e0d, 0x0e0d0e0d0e0d0e0d, q15); - CHECK_EQUAL_128(0x0000000000000000, 0x1211100f1211100f, q16); + CHECK_EQUAL_128(0x0A090A090A090A09, 0x0A090A090A090A09, q13); + CHECK_EQUAL_128(0x0C0B0C0B0C0B0C0B, 0x0C0B0C0B0C0B0C0B, q14); + CHECK_EQUAL_128(0x0E0D0E0D0E0D0E0D, 0x0E0D0E0D0E0D0E0D, q15); + CHECK_EQUAL_128(0x0000000000000000, 0x1211100F1211100F, q16); CHECK_EQUAL_128(0x0000000000000000, 0x1615141316151413, q17); - CHECK_EQUAL_128(0x0000000000000000, 0x1a1918171a191817, q18); - CHECK_EQUAL_128(0x0000000000000000, 0x1e1d1c1b1e1d1c1b, q19); + CHECK_EQUAL_128(0x0000000000000000, 0x1A1918171A191817, q18); + CHECK_EQUAL_128(0x0000000000000000, 0x1E1D1C1B1E1D1C1B, q19); CHECK_EQUAL_128(0x1312111013121110, 0x1312111013121110, q20); CHECK_EQUAL_128(0x1716151417161514, 0x1716151417161514, q21); - CHECK_EQUAL_128(0x1b1a19181b1a1918, 0x1b1a19181b1a1918, q22); - CHECK_EQUAL_128(0x1f1e1d1c1f1e1d1c, 0x1f1e1d1c1f1e1d1c, q23); + CHECK_EQUAL_128(0x1B1A19181B1A1918, 0x1B1A19181B1A1918, q22); + CHECK_EQUAL_128(0x1F1E1D1C1F1E1D1C, 0x1F1E1D1C1F1E1D1C, q23); CHECK_EQUAL_128(0x2726252423222120, 0x2726252423222120, q24); - CHECK_EQUAL_128(0x2f2e2d2c2b2a2928, 0x2f2e2d2c2b2a2928, q25); + CHECK_EQUAL_128(0x2F2E2D2C2B2A2928, 0x2F2E2D2C2B2A2928, q25); CHECK_EQUAL_128(0x3736353433323130, 0x3736353433323130, q26); - CHECK_EQUAL_128(0x3f3e3d3c3b3a3938, 0x3f3e3d3c3b3a3938, q27); + CHECK_EQUAL_128(0x3F3E3D3C3B3A3938, 0x3F3E3D3C3B3A3938, q27); TEARDOWN(); } @@ -4673,24 +4669,24 @@ TEST(neon_ld4_alllanes_postindex) { CHECK_EQUAL_128(0x0808080808080808, 0x0808080808080808, q7); CHECK_EQUAL_128(0x0000000000000000, 0x0706070607060706, q8); CHECK_EQUAL_128(0x0000000000000000, 0x0908090809080908, q9); - CHECK_EQUAL_128(0x0000000000000000, 0x0b0a0b0a0b0a0b0a, q10); - CHECK_EQUAL_128(0x0000000000000000, 0x0d0c0d0c0d0c0d0c, q11); + CHECK_EQUAL_128(0x0000000000000000, 0x0B0A0B0A0B0A0B0A, q10); + CHECK_EQUAL_128(0x0000000000000000, 0x0D0C0D0C0D0C0D0C, q11); CHECK_EQUAL_128(0x0807080708070807, 0x0807080708070807, q12); - CHECK_EQUAL_128(0x0a090a090a090a09, 0x0a090a090a090a09, q13); - CHECK_EQUAL_128(0x0c0b0c0b0c0b0c0b, 0x0c0b0c0b0c0b0c0b, q14); - CHECK_EQUAL_128(0x0e0d0e0d0e0d0e0d, 0x0e0d0e0d0e0d0e0d, q15); - CHECK_EQUAL_128(0x0000000000000000, 0x1211100f1211100f, q16); + CHECK_EQUAL_128(0x0A090A090A090A09, 0x0A090A090A090A09, q13); + CHECK_EQUAL_128(0x0C0B0C0B0C0B0C0B, 0x0C0B0C0B0C0B0C0B, q14); + CHECK_EQUAL_128(0x0E0D0E0D0E0D0E0D, 0x0E0D0E0D0E0D0E0D, q15); + CHECK_EQUAL_128(0x0000000000000000, 0x1211100F1211100F, q16); CHECK_EQUAL_128(0x0000000000000000, 0x1615141316151413, q17); - CHECK_EQUAL_128(0x0000000000000000, 0x1a1918171a191817, q18); - CHECK_EQUAL_128(0x0000000000000000, 0x1e1d1c1b1e1d1c1b, q19); + CHECK_EQUAL_128(0x0000000000000000, 0x1A1918171A191817, q18); + CHECK_EQUAL_128(0x0000000000000000, 0x1E1D1C1B1E1D1C1B, q19); CHECK_EQUAL_128(0x1312111013121110, 0x1312111013121110, q20); CHECK_EQUAL_128(0x1716151417161514, 0x1716151417161514, q21); - CHECK_EQUAL_128(0x1b1a19181b1a1918, 0x1b1a19181b1a1918, q22); - CHECK_EQUAL_128(0x1f1e1d1c1f1e1d1c, 0x1f1e1d1c1f1e1d1c, q23); + CHECK_EQUAL_128(0x1B1A19181B1A1918, 0x1B1A19181B1A1918, q22); + CHECK_EQUAL_128(0x1F1E1D1C1F1E1D1C, 0x1F1E1D1C1F1E1D1C, q23); CHECK_EQUAL_128(0x2726252423222120, 0x2726252423222120, q24); - CHECK_EQUAL_128(0x2f2e2d2c2b2a2928, 0x2f2e2d2c2b2a2928, q25); + CHECK_EQUAL_128(0x2F2E2D2C2B2A2928, 0x2F2E2D2C2B2A2928, q25); CHECK_EQUAL_128(0x3736353433323130, 0x3736353433323130, q26); - CHECK_EQUAL_128(0x3f3e3d3c3b3a3938, 0x3f3e3d3c3b3a3938, q27); + CHECK_EQUAL_128(0x3F3E3D3C3B3A3938, 0x3F3E3D3C3B3A3938, q27); CHECK_EQUAL_64(src_base + 64, x17); TEARDOWN(); @@ -4739,10 +4735,10 @@ TEST(neon_st1_lane) { RUN(); - CHECK_EQUAL_128(0x0001020304050607, 0x08090a0b0c0d0e0f, q1); - CHECK_EQUAL_128(0x0100030205040706, 0x09080b0a0d0c0f0e, q2); - CHECK_EQUAL_128(0x0302010007060504, 0x0b0a09080f0e0d0c, q3); - CHECK_EQUAL_128(0x0706050403020100, 0x0f0e0d0c0b0a0908, q4); + CHECK_EQUAL_128(0x0001020304050607, 0x08090A0B0C0D0E0F, q1); + CHECK_EQUAL_128(0x0100030205040706, 0x09080B0A0D0C0F0E, q2); + CHECK_EQUAL_128(0x0302010007060504, 0x0B0A09080F0E0D0C, q3); + CHECK_EQUAL_128(0x0706050403020100, 0x0F0E0D0C0B0A0908, q4); TEARDOWN(); } @@ -4759,8 +4755,8 @@ TEST(neon_st2_lane) { START(); __ Mov(x17, dst_base); __ Mov(x18, dst_base); - __ Movi(v0.V2D(), 0x0001020304050607, 0x08090a0b0c0d0e0f); - __ Movi(v1.V2D(), 0x1011121314151617, 0x18191a1b1c1d1e1f); + __ Movi(v0.V2D(), 0x0001020304050607, 0x08090A0B0C0D0E0F); + __ Movi(v1.V2D(), 0x1011121314151617, 0x18191A1B1C1D1E1F); // Test B stores with and without post index. for (int i = 15; i >= 0; i--) { @@ -4818,24 +4814,24 @@ TEST(neon_st2_lane) { RUN(); CHECK_EQUAL_128(0x1707160615051404, 0x1303120211011000, q2); - CHECK_EQUAL_128(0x1f0f1e0e1d0d1c0c, 0x1b0b1a0a19091808, q3); + CHECK_EQUAL_128(0x1F0F1E0E1D0D1C0C, 0x1B0B1A0A19091808, q3); CHECK_EQUAL_128(0x1707160615051404, 0x1303120211011000, q4); - CHECK_EQUAL_128(0x1f0f1e0e1d0d1c0c, 0x1b0b1a0a19091808, q5); + CHECK_EQUAL_128(0x1F0F1E0E1D0D1C0C, 0x1B0B1A0A19091808, q5); CHECK_EQUAL_128(0x1617060714150405, 0x1213020310110001, q6); - CHECK_EQUAL_128(0x1e1f0e0f1c1d0c0d, 0x1a1b0a0b18190809, q7); + CHECK_EQUAL_128(0x1E1F0E0F1C1D0C0D, 0x1A1B0A0B18190809, q7); CHECK_EQUAL_128(0x1617060714150405, 0x1213020310110001, q16); - CHECK_EQUAL_128(0x1e1f0e0f1c1d0c0d, 0x1a1b0a0b18190809, q17); + CHECK_EQUAL_128(0x1E1F0E0F1C1D0C0D, 0x1A1B0A0B18190809, q17); CHECK_EQUAL_128(0x1415161704050607, 0x1011121300010203, q18); - CHECK_EQUAL_128(0x1c1d1e1f0c0d0e0f, 0x18191a1b08090a0b, q19); + CHECK_EQUAL_128(0x1C1D1E1F0C0D0E0F, 0x18191A1B08090A0B, q19); CHECK_EQUAL_128(0x1415161704050607, 0x1011121300010203, q20); - CHECK_EQUAL_128(0x1c1d1e1f0c0d0e0f, 0x18191a1b08090a0b, q21); + CHECK_EQUAL_128(0x1C1D1E1F0C0D0E0F, 0x18191A1B08090A0B, q21); CHECK_EQUAL_128(0x1011121314151617, 0x0001020304050607, q22); - CHECK_EQUAL_128(0x18191a1b1c1d1e1f, 0x08090a0b0c0d0e0f, q23); + CHECK_EQUAL_128(0x18191A1B1C1D1E1F, 0x08090A0B0C0D0E0F, q23); CHECK_EQUAL_128(0x1011121314151617, 0x0001020304050607, q22); - CHECK_EQUAL_128(0x18191a1b1c1d1e1f, 0x08090a0b0c0d0e0f, q23); + CHECK_EQUAL_128(0x18191A1B1C1D1E1F, 0x08090A0B0C0D0E0F, q23); TEARDOWN(); } @@ -4852,9 +4848,9 @@ TEST(neon_st3_lane) { START(); __ Mov(x17, dst_base); __ Mov(x18, dst_base); - __ Movi(v0.V2D(), 0x0001020304050607, 0x08090a0b0c0d0e0f); - __ Movi(v1.V2D(), 0x1011121314151617, 0x18191a1b1c1d1e1f); - __ Movi(v2.V2D(), 0x2021222324252627, 0x28292a2b2c2d2e2f); + __ Movi(v0.V2D(), 0x0001020304050607, 0x08090A0B0C0D0E0F); + __ Movi(v1.V2D(), 0x1011121314151617, 0x18191A1B1C1D1E1F); + __ Movi(v2.V2D(), 0x2021222324252627, 0x28292A2B2C2D2E2F); // Test B stores with and without post index. for (int i = 15; i >= 0; i--) { @@ -4916,25 +4912,25 @@ TEST(neon_st3_lane) { RUN(); CHECK_EQUAL_128(0x0524140423130322, 0x1202211101201000, q3); - CHECK_EQUAL_128(0x1a0a291909281808, 0x2717072616062515, q4); - CHECK_EQUAL_128(0x2f1f0f2e1e0e2d1d, 0x0d2c1c0c2b1b0b2a, q5); + CHECK_EQUAL_128(0x1A0A291909281808, 0x2717072616062515, q4); + CHECK_EQUAL_128(0x2F1F0F2E1E0E2D1D, 0x0D2C1C0C2B1B0B2A, q5); CHECK_EQUAL_128(0x0524140423130322, 0x1202211101201000, q6); - CHECK_EQUAL_128(0x1a0a291909281808, 0x2717072616062515, q7); - CHECK_EQUAL_128(0x2f1f0f2e1e0e2d1d, 0x0d2c1c0c2b1b0b2a, q16); + CHECK_EQUAL_128(0x1A0A291909281808, 0x2717072616062515, q7); + CHECK_EQUAL_128(0x2F1F0F2E1E0E2D1D, 0x0D2C1C0C2B1B0B2A, q16); CHECK_EQUAL_128(0x1415040522231213, 0x0203202110110001, q17); - CHECK_EQUAL_128(0x0a0b282918190809, 0x2627161706072425, q18); - CHECK_EQUAL_128(0x2e2f1e1f0e0f2c2d, 0x1c1d0c0d2a2b1a1b, q19); + CHECK_EQUAL_128(0x0A0B282918190809, 0x2627161706072425, q18); + CHECK_EQUAL_128(0x2E2F1E1F0E0F2C2D, 0x1C1D0C0D2A2B1A1B, q19); CHECK_EQUAL_128(0x1415040522231213, 0x0203202110110001, q20); - CHECK_EQUAL_128(0x0a0b282918190809, 0x2627161706072425, q21); - CHECK_EQUAL_128(0x2e2f1e1f0e0f2c2d, 0x1c1d0c0d2a2b1a1b, q22); + CHECK_EQUAL_128(0x0A0B282918190809, 0x2627161706072425, q21); + CHECK_EQUAL_128(0x2E2F1E1F0E0F2C2D, 0x1C1D0C0D2A2B1A1B, q22); CHECK_EQUAL_128(0x0405060720212223, 0x1011121300010203, q23); - CHECK_EQUAL_128(0x18191a1b08090a0b, 0x2425262714151617, q24); - CHECK_EQUAL_128(0x2c2d2e2f1c1d1e1f, 0x0c0d0e0f28292a2b, q25); + CHECK_EQUAL_128(0x18191A1B08090A0B, 0x2425262714151617, q24); + CHECK_EQUAL_128(0x2C2D2E2F1C1D1E1F, 0x0C0D0E0F28292A2B, q25); CHECK_EQUAL_128(0x0405060720212223, 0x1011121300010203, q26); - CHECK_EQUAL_128(0x18191a1b08090a0b, 0x2425262714151617, q27); - CHECK_EQUAL_128(0x2c2d2e2f1c1d1e1f, 0x0c0d0e0f28292a2b, q28); + CHECK_EQUAL_128(0x18191A1B08090A0B, 0x2425262714151617, q27); + CHECK_EQUAL_128(0x2C2D2E2F1C1D1E1F, 0x0C0D0E0F28292A2B, q28); TEARDOWN(); } @@ -4951,10 +4947,10 @@ TEST(neon_st4_lane) { START(); __ Mov(x17, dst_base); __ Mov(x18, dst_base); - __ Movi(v0.V2D(), 0x0001020304050607, 0x08090a0b0c0d0e0f); - __ Movi(v1.V2D(), 0x1011121314151617, 0x18191a1b1c1d1e1f); - __ Movi(v2.V2D(), 0x2021222324252627, 0x28292a2b2c2d2e2f); - __ Movi(v3.V2D(), 0x2021222324252627, 0x28292a2b2c2d2e2f); + __ Movi(v0.V2D(), 0x0001020304050607, 0x08090A0B0C0D0E0F); + __ Movi(v1.V2D(), 0x1011121314151617, 0x18191A1B1C1D1E1F); + __ Movi(v2.V2D(), 0x2021222324252627, 0x28292A2B2C2D2E2F); + __ Movi(v3.V2D(), 0x2021222324252627, 0x28292A2B2C2D2E2F); // Test B stores without post index. for (int i = 15; i >= 0; i--) { @@ -5001,21 +4997,21 @@ TEST(neon_st4_lane) { CHECK_EQUAL_128(0x2323130322221202, 0x2121110120201000, q4); CHECK_EQUAL_128(0x2727170726261606, 0x2525150524241404, q5); - CHECK_EQUAL_128(0x2b2b1b0b2a2a1a0a, 0x2929190928281808, q6); - CHECK_EQUAL_128(0x2f2f1f0f2e2e1e0e, 0x2d2d1d0d2c2c1c0c, q7); + CHECK_EQUAL_128(0x2B2B1B0B2A2A1A0A, 0x2929190928281808, q6); + CHECK_EQUAL_128(0x2F2F1F0F2E2E1E0E, 0x2D2D1D0D2C2C1C0C, q7); CHECK_EQUAL_128(0x2223222312130203, 0x2021202110110001, q16); CHECK_EQUAL_128(0x2627262716170607, 0x2425242514150405, q17); - CHECK_EQUAL_128(0x2a2b2a2b1a1b0a0b, 0x2829282918190809, q18); - CHECK_EQUAL_128(0x2e2f2e2f1e1f0e0f, 0x2c2d2c2d1c1d0c0d, q19); + CHECK_EQUAL_128(0x2A2B2A2B1A1B0A0B, 0x2829282918190809, q18); + CHECK_EQUAL_128(0x2E2F2E2F1E1F0E0F, 0x2C2D2C2D1C1D0C0D, q19); CHECK_EQUAL_128(0x2021222320212223, 0x1011121300010203, q20); CHECK_EQUAL_128(0x2425262724252627, 0x1415161704050607, q21); - CHECK_EQUAL_128(0x28292a2b28292a2b, 0x18191a1b08090a0b, q22); - CHECK_EQUAL_128(0x2c2d2e2f2c2d2e2f, 0x1c1d1e1f0c0d0e0f, q23); + CHECK_EQUAL_128(0x28292A2B28292A2B, 0x18191A1B08090A0B, q22); + CHECK_EQUAL_128(0x2C2D2E2F2C2D2E2F, 0x1C1D1E1F0C0D0E0F, q23); - CHECK_EQUAL_128(0x18191a1b1c1d1e1f, 0x08090a0b0c0d0e0f, q24); - CHECK_EQUAL_128(0x28292a2b2c2d2e2f, 0x28292a2b2c2d2e2f, q25); + CHECK_EQUAL_128(0x18191A1B1C1D1E1F, 0x08090A0B0C0D0E0F, q24); + CHECK_EQUAL_128(0x28292A2B2C2D2E2F, 0x28292A2B2C2D2E2F, q25); CHECK_EQUAL_128(0x1011121314151617, 0x0001020304050607, q26); CHECK_EQUAL_128(0x2021222324252627, 0x2021222324252627, q27); @@ -5080,13 +5076,13 @@ TEST(neon_ld1_lane_postindex) { RUN(); - CHECK_EQUAL_128(0x0001020304050607, 0x08090a0b0c0d0e0f, q0); - CHECK_EQUAL_128(0x0100030205040706, 0x09080b0a0d0c0f0e, q1); - CHECK_EQUAL_128(0x0302010007060504, 0x0b0a09080f0e0d0c, q2); - CHECK_EQUAL_128(0x0706050403020100, 0x0f0e0d0c0b0a0908, q3); - CHECK_EQUAL_128(0x0f0e0d0c0b0a0908, 0x0706050003020100, q4); - CHECK_EQUAL_128(0x0f0e0d0c0b0a0908, 0x0100050403020100, q5); - CHECK_EQUAL_128(0x0f0e0d0c03020100, 0x0706050403020100, q6); + CHECK_EQUAL_128(0x0001020304050607, 0x08090A0B0C0D0E0F, q0); + CHECK_EQUAL_128(0x0100030205040706, 0x09080B0A0D0C0F0E, q1); + CHECK_EQUAL_128(0x0302010007060504, 0x0B0A09080F0E0D0C, q2); + CHECK_EQUAL_128(0x0706050403020100, 0x0F0E0D0C0B0A0908, q3); + CHECK_EQUAL_128(0x0F0E0D0C0B0A0908, 0x0706050003020100, q4); + CHECK_EQUAL_128(0x0F0E0D0C0B0A0908, 0x0100050403020100, q5); + CHECK_EQUAL_128(0x0F0E0D0C03020100, 0x0706050403020100, q6); CHECK_EQUAL_128(0x0706050403020100, 0x0706050403020100, q7); CHECK_EQUAL_64(src_base + 16, x17); CHECK_EQUAL_64(src_base + 16, x18); @@ -5139,10 +5135,10 @@ TEST(neon_st1_lane_postindex) { RUN(); - CHECK_EQUAL_128(0x0001020304050607, 0x08090a0b0c0d0e0f, q1); - CHECK_EQUAL_128(0x0100030205040706, 0x09080b0a0d0c0f0e, q2); - CHECK_EQUAL_128(0x0302010007060504, 0x0b0a09080f0e0d0c, q3); - CHECK_EQUAL_128(0x0706050403020100, 0x0f0e0d0c0b0a0908, q4); + CHECK_EQUAL_128(0x0001020304050607, 0x08090A0B0C0D0E0F, q1); + CHECK_EQUAL_128(0x0100030205040706, 0x09080B0A0D0C0F0E, q2); + CHECK_EQUAL_128(0x0302010007060504, 0x0B0A09080F0E0D0C, q3); + CHECK_EQUAL_128(0x0706050403020100, 0x0F0E0D0C0B0A0908, q4); TEARDOWN(); } @@ -5184,8 +5180,8 @@ TEST(neon_ld1_alllanes) { CHECK_EQUAL_128(0x0504050405040504, 0x0504050405040504, q3); CHECK_EQUAL_128(0, 0x0807060508070605, q4); CHECK_EQUAL_128(0x0908070609080706, 0x0908070609080706, q5); - CHECK_EQUAL_128(0, 0x0e0d0c0b0a090807, q6); - CHECK_EQUAL_128(0x0f0e0d0c0b0a0908, 0x0f0e0d0c0b0a0908, q7); + CHECK_EQUAL_128(0, 0x0E0D0C0B0A090807, q6); + CHECK_EQUAL_128(0x0F0E0D0C0B0A0908, 0x0F0E0D0C0B0A0908, q7); TEARDOWN(); } @@ -5219,8 +5215,8 @@ TEST(neon_ld1_alllanes_postindex) { CHECK_EQUAL_128(0, 0x0403040304030403, q2); CHECK_EQUAL_128(0x0504050405040504, 0x0504050405040504, q3); CHECK_EQUAL_128(0, 0x0908070609080706, q4); - CHECK_EQUAL_128(0x0a0908070a090807, 0x0a0908070a090807, q5); - CHECK_EQUAL_128(0x1211100f0e0d0c0b, 0x1211100f0e0d0c0b, q6); + CHECK_EQUAL_128(0x0A0908070A090807, 0x0A0908070A090807, q5); + CHECK_EQUAL_128(0x1211100F0E0D0C0B, 0x1211100F0E0D0C0B, q6); CHECK_EQUAL_64(src_base + 19, x17); TEARDOWN(); @@ -5266,10 +5262,10 @@ TEST(neon_st1_d) { RUN(); - CHECK_EQUAL_128(0x0f0e0d0c0b0a0908, 0x0706050403020100, q0); - CHECK_EQUAL_128(0x1f1e1d1c1b1a1918, 0x1716151413121110, q1); - CHECK_EQUAL_128(0x2f2e2d2c2b2a2928, 0x2726252423222120, q2); - CHECK_EQUAL_128(0x3f3e3d3c3b3a3938, 0x3736353433323130, q3); + CHECK_EQUAL_128(0x0F0E0D0C0B0A0908, 0x0706050403020100, q0); + CHECK_EQUAL_128(0x1F1E1D1C1B1A1918, 0x1716151413121110, q1); + CHECK_EQUAL_128(0x2F2E2D2C2B2A2928, 0x2726252423222120, q2); + CHECK_EQUAL_128(0x3F3E3D3C3B3A3938, 0x3736353433323130, q3); CHECK_EQUAL_128(0, 0x0706050403020100, q16); CHECK_EQUAL_128(0x1716151413121110, 0x0706050403020100, q17); CHECK_EQUAL_128(0, 0x0706050403020100, q18); @@ -5380,16 +5376,16 @@ TEST(neon_st1_q) { RUN(); - CHECK_EQUAL_128(0x0f0e0d0c0b0a0908, 0x0706050403020100, q16); - CHECK_EQUAL_128(0x0f0e0d0c0b0a0908, 0x0706050403020100, q17); - CHECK_EQUAL_128(0x1f1e1d1c1b1a1918, 0x1716151413121110, q18); - CHECK_EQUAL_128(0x0f0e0d0c0b0a0908, 0x0706050403020100, q19); - CHECK_EQUAL_128(0x1f1e1d1c1b1a1918, 0x1716151413121110, q20); - CHECK_EQUAL_128(0x2f2e2d2c2b2a2928, 0x2726252423222120, q21); - CHECK_EQUAL_128(0x0f0e0d0c0b0a0908, 0x0706050403020100, q22); - CHECK_EQUAL_128(0x1f1e1d1c1b1a1918, 0x1716151413121110, q23); - CHECK_EQUAL_128(0x2f2e2d2c2b2a2928, 0x2726252423222120, q24); - CHECK_EQUAL_128(0x3f3e3d3c3b3a3938, 0x3736353433323130, q25); + CHECK_EQUAL_128(0x0F0E0D0C0B0A0908, 0x0706050403020100, q16); + CHECK_EQUAL_128(0x0F0E0D0C0B0A0908, 0x0706050403020100, q17); + CHECK_EQUAL_128(0x1F1E1D1C1B1A1918, 0x1716151413121110, q18); + CHECK_EQUAL_128(0x0F0E0D0C0B0A0908, 0x0706050403020100, q19); + CHECK_EQUAL_128(0x1F1E1D1C1B1A1918, 0x1716151413121110, q20); + CHECK_EQUAL_128(0x2F2E2D2C2B2A2928, 0x2726252423222120, q21); + CHECK_EQUAL_128(0x0F0E0D0C0B0A0908, 0x0706050403020100, q22); + CHECK_EQUAL_128(0x1F1E1D1C1B1A1918, 0x1716151413121110, q23); + CHECK_EQUAL_128(0x2F2E2D2C2B2A2928, 0x2726252423222120, q24); + CHECK_EQUAL_128(0x3F3E3D3C3B3A3938, 0x3736353433323130, q25); TEARDOWN(); } @@ -5438,16 +5434,16 @@ TEST(neon_st1_q_postindex) { RUN(); - CHECK_EQUAL_128(0x0f0e0d0c0b0a0908, 0x0706050403020100, q16); - CHECK_EQUAL_128(0x0f0e0d0c0b0a0908, 0x0706050403020100, q17); - CHECK_EQUAL_128(0x1f1e1d1c1b1a1918, 0x1716151413121110, q18); - CHECK_EQUAL_128(0x0f0e0d0c0b0a0908, 0x0706050403020100, q19); - CHECK_EQUAL_128(0x1f1e1d1c1b1a1918, 0x1716151413121110, q20); - CHECK_EQUAL_128(0x2f2e2d2c2b2a2928, 0x2726252423222120, q21); - CHECK_EQUAL_128(0x0f0e0d0c0b0a0908, 0x0706050403020100, q22); - CHECK_EQUAL_128(0x1f1e1d1c1b1a1918, 0x1716151413121110, q23); - CHECK_EQUAL_128(0x2f2e2d2c2b2a2928, 0x2726252423222120, q24); - CHECK_EQUAL_128(0x3f3e3d3c3b3a3938, 0x3736353433323130, q25); + CHECK_EQUAL_128(0x0F0E0D0C0B0A0908, 0x0706050403020100, q16); + CHECK_EQUAL_128(0x0F0E0D0C0B0A0908, 0x0706050403020100, q17); + CHECK_EQUAL_128(0x1F1E1D1C1B1A1918, 0x1716151413121110, q18); + CHECK_EQUAL_128(0x0F0E0D0C0B0A0908, 0x0706050403020100, q19); + CHECK_EQUAL_128(0x1F1E1D1C1B1A1918, 0x1716151413121110, q20); + CHECK_EQUAL_128(0x2F2E2D2C2B2A2928, 0x2726252423222120, q21); + CHECK_EQUAL_128(0x0F0E0D0C0B0A0908, 0x0706050403020100, q22); + CHECK_EQUAL_128(0x1F1E1D1C1B1A1918, 0x1716151413121110, q23); + CHECK_EQUAL_128(0x2F2E2D2C2B2A2928, 0x2726252423222120, q24); + CHECK_EQUAL_128(0x3F3E3D3C3B3A3938, 0x3736353433323130, q25); TEARDOWN(); } @@ -5487,7 +5483,7 @@ TEST(neon_st2_d) { CHECK_EQUAL_128(0x1707160615051404, 0x1303120211011000, q0); CHECK_EQUAL_128(0x0504131203021110, 0x0100151413121110, q1); CHECK_EQUAL_128(0x1615140706050413, 0x1211100302010014, q2); - CHECK_EQUAL_128(0x3f3e3d3c3b3a3938, 0x3736353433323117, q3); + CHECK_EQUAL_128(0x3F3E3D3C3B3A3938, 0x3736353433323117, q3); TEARDOWN(); } @@ -5524,7 +5520,7 @@ TEST(neon_st2_d_postindex) { CHECK_EQUAL_128(0x1405041312030211, 0x1001000211011000, q0); CHECK_EQUAL_128(0x0605041312111003, 0x0201001716070615, q1); - CHECK_EQUAL_128(0x2f2e2d2c2b2a2928, 0x2726251716151407, q2); + CHECK_EQUAL_128(0x2F2E2D2C2B2A2928, 0x2726251716151407, q2); TEARDOWN(); } @@ -5564,9 +5560,9 @@ TEST(neon_st2_q) { RUN(); CHECK_EQUAL_128(0x1312030211100100, 0x1303120211011000, q0); - CHECK_EQUAL_128(0x01000b0a19180908, 0x1716070615140504, q1); + CHECK_EQUAL_128(0x01000B0A19180908, 0x1716070615140504, q1); CHECK_EQUAL_128(0x1716151413121110, 0x0706050403020100, q2); - CHECK_EQUAL_128(0x1f1e1d1c1b1a1918, 0x0f0e0d0c0b0a0908, q3); + CHECK_EQUAL_128(0x1F1E1D1C1B1A1918, 0x0F0E0D0C0B0A0908, q3); TEARDOWN(); } @@ -5604,10 +5600,10 @@ TEST(neon_st2_q_postindex) { RUN(); CHECK_EQUAL_128(0x1405041312030211, 0x1001000211011000, q0); - CHECK_EQUAL_128(0x1c0d0c1b1a0b0a19, 0x1809081716070615, q1); - CHECK_EQUAL_128(0x0504030201001003, 0x0201001f1e0f0e1d, q2); - CHECK_EQUAL_128(0x0d0c0b0a09081716, 0x1514131211100706, q3); - CHECK_EQUAL_128(0x4f4e4d4c4b4a1f1e, 0x1d1c1b1a19180f0e, q4); + CHECK_EQUAL_128(0x1C0D0C1B1A0B0A19, 0x1809081716070615, q1); + CHECK_EQUAL_128(0x0504030201001003, 0x0201001F1E0F0E1D, q2); + CHECK_EQUAL_128(0x0D0C0B0A09081716, 0x1514131211100706, q3); + CHECK_EQUAL_128(0x4F4E4D4C4B4A1F1E, 0x1D1C1B1A19180F0E, q4); TEARDOWN(); } @@ -5644,7 +5640,7 @@ TEST(neon_st3_d) { RUN(); CHECK_EQUAL_128(0x2221201312111003, 0x0201000100201000, q0); - CHECK_EQUAL_128(0x1f1e1d2726252417, 0x1615140706050423, q1); + CHECK_EQUAL_128(0x1F1E1D2726252417, 0x1615140706050423, q1); TEARDOWN(); } @@ -5684,7 +5680,7 @@ TEST(neon_st3_d_postindex) { CHECK_EQUAL_128(0x2213120302212011, 0x1001001101201000, q0); CHECK_EQUAL_128(0x0201002726171607, 0x0625241514050423, q1); CHECK_EQUAL_128(0x1615140706050423, 0x2221201312111003, q2); - CHECK_EQUAL_128(0x3f3e3d3c3b3a3938, 0x3736352726252417, q3); + CHECK_EQUAL_128(0x3F3E3D3C3B3A3938, 0x3736352726252417, q3); TEARDOWN(); } @@ -5730,8 +5726,8 @@ TEST(neon_st3_q) { CHECK_EQUAL_128(0x0605042322212013, 0x1211100302010023, q1); CHECK_EQUAL_128(0x1007060504030201, 0x0025241716151407, q2); CHECK_EQUAL_128(0x0827262524232221, 0x2017161514131211, q3); - CHECK_EQUAL_128(0x281f1e1d1c1b1a19, 0x180f0e0d0c0b0a09, q4); - CHECK_EQUAL_128(0x5f5e5d5c5b5a5958, 0x572f2e2d2c2b2a29, q5); + CHECK_EQUAL_128(0x281F1E1D1C1B1A19, 0x180F0E0D0C0B0A09, q4); + CHECK_EQUAL_128(0x5F5E5D5C5B5A5958, 0x572F2E2D2C2B2A29, q5); TEARDOWN(); } @@ -5774,11 +5770,11 @@ TEST(neon_st3_q_postindex) { CHECK_EQUAL_128(0x2213120302212011, 0x1001001101201000, q0); CHECK_EQUAL_128(0x1809082726171607, 0x0625241514050423, q1); - CHECK_EQUAL_128(0x0e2d2c1d1c0d0c2b, 0x2a1b1a0b0a292819, q2); - CHECK_EQUAL_128(0x0504030201001003, 0x0201002f2e1f1e0f, q3); + CHECK_EQUAL_128(0x0E2D2C1D1C0D0C2B, 0x2A1B1A0B0A292819, q2); + CHECK_EQUAL_128(0x0504030201001003, 0x0201002F2E1F1E0F, q3); CHECK_EQUAL_128(0x2524232221201716, 0x1514131211100706, q4); - CHECK_EQUAL_128(0x1d1c1b1a19180f0e, 0x0d0c0b0a09082726, q5); - CHECK_EQUAL_128(0x6f6e6d6c6b6a2f2e, 0x2d2c2b2a29281f1e, q6); + CHECK_EQUAL_128(0x1D1C1B1A19180F0E, 0x0D0C0B0A09082726, q5); + CHECK_EQUAL_128(0x6F6E6D6C6B6A2F2E, 0x2D2C2B2A29281F1E, q6); TEARDOWN(); } @@ -5820,7 +5816,7 @@ TEST(neon_st4_d) { CHECK_EQUAL_128(0x1110010032221202, 0X3121110130201000, q0); CHECK_EQUAL_128(0x1003020100322322, 0X1312030231302120, q1); CHECK_EQUAL_128(0x1407060504333231, 0X3023222120131211, q2); - CHECK_EQUAL_128(0x3f3e3d3c3b373635, 0x3427262524171615, q3); + CHECK_EQUAL_128(0x3F3E3D3C3B373635, 0x3427262524171615, q3); TEARDOWN(); } @@ -5865,7 +5861,7 @@ TEST(neon_st4_d_postindex) { CHECK_EQUAL_128(0x1607063534252415, 0x1405043332232213, q1); CHECK_EQUAL_128(0x2221201312111003, 0x0201003736272617, q2); CHECK_EQUAL_128(0x2625241716151407, 0x0605043332313023, q3); - CHECK_EQUAL_128(0x4f4e4d4c4b4a4948, 0x4746453736353427, q4); + CHECK_EQUAL_128(0x4F4E4D4C4B4A4948, 0x4746453736353427, q4); TEARDOWN(); } @@ -5914,9 +5910,9 @@ TEST(neon_st4_q) { CHECK_EQUAL_128(0x3231302322212013, 0x1211100302010013, q1); CHECK_EQUAL_128(0x1007060504030201, 0x0015140706050433, q2); CHECK_EQUAL_128(0x3027262524232221, 0x2017161514131211, q3); - CHECK_EQUAL_128(0x180f0e0d0c0b0a09, 0x0837363534333231, q4); - CHECK_EQUAL_128(0x382f2e2d2c2b2a29, 0x281f1e1d1c1b1a19, q5); - CHECK_EQUAL_128(0x6f6e6d6c6b6a6968, 0x673f3e3d3c3b3a39, q6); + CHECK_EQUAL_128(0x180F0E0D0C0B0A09, 0x0837363534333231, q4); + CHECK_EQUAL_128(0x382F2E2D2C2B2A29, 0x281F1E1D1C1B1A19, q5); + CHECK_EQUAL_128(0x6F6E6D6C6B6A6968, 0x673F3E3D3C3B3A39, q6); TEARDOWN(); } @@ -5965,13 +5961,13 @@ TEST(neon_st4_q_postindex) { CHECK_EQUAL_128(0x1203023130212011, 0x1001000130201000, q0); CHECK_EQUAL_128(0x1607063534252415, 0x1405043332232213, q1); - CHECK_EQUAL_128(0x1a0b0a3938292819, 0x1809083736272617, q2); - CHECK_EQUAL_128(0x1e0f0e3d3c2d2c1d, 0x1c0d0c3b3a2b2a1b, q3); - CHECK_EQUAL_128(0x0504030201001003, 0x0201003f3e2f2e1f, q4); + CHECK_EQUAL_128(0x1A0B0A3938292819, 0x1809083736272617, q2); + CHECK_EQUAL_128(0x1E0F0E3D3C2D2C1D, 0x1C0D0C3B3A2B2A1B, q3); + CHECK_EQUAL_128(0x0504030201001003, 0x0201003F3E2F2E1F, q4); CHECK_EQUAL_128(0x2524232221201716, 0x1514131211100706, q5); - CHECK_EQUAL_128(0x0d0c0b0a09083736, 0x3534333231302726, q6); - CHECK_EQUAL_128(0x2d2c2b2a29281f1e, 0x1d1c1b1a19180f0e, q7); - CHECK_EQUAL_128(0x8f8e8d8c8b8a3f3e, 0x3d3c3b3a39382f2e, q8); + CHECK_EQUAL_128(0x0D0C0B0A09083736, 0x3534333231302726, q6); + CHECK_EQUAL_128(0x2D2C2B2A29281F1E, 0x1D1C1B1A19180F0E, q7); + CHECK_EQUAL_128(0x8F8E8D8C8B8A3F3E, 0x3D3C3B3A39382F2E, q8); TEARDOWN(); } @@ -6047,11 +6043,11 @@ TEST(neon_destructive_tbl) { SETUP(); START(); - __ Movi(v0.V2D(), 0x0041424334353627, 0x28291a1b1c0d0e0f); - __ Movi(v1.V2D(), 0xafaeadacabaaa9a8, 0xa7a6a5a4a3a2a1a0); - __ Movi(v2.V2D(), 0xbfbebdbcbbbab9b8, 0xb7b6b5b4b3b2b1b0); - __ Movi(v3.V2D(), 0xcfcecdcccbcac9c8, 0xc7c6c5c4c3c2c1c0); - __ Movi(v4.V2D(), 0xdfdedddcdbdad9d8, 0xd7d6d5d4d3d2d1d0); + __ Movi(v0.V2D(), 0x0041424334353627, 0x28291A1B1C0D0E0F); + __ Movi(v1.V2D(), 0xAFAEADACABAAA9A8, 0xA7A6A5A4A3A2A1A0); + __ Movi(v2.V2D(), 0xBFBEBDBCBBBAB9B8, 0xB7B6B5B4B3B2B1B0); + __ Movi(v3.V2D(), 0xCFCECDCCCBCAC9C8, 0xC7C6C5C4C3C2C1C0); + __ Movi(v4.V2D(), 0xDFDEDDDCDBDAD9D8, 0xD7D6D5D4D3D2D1D0); __ Movi(v16.V2D(), 0x5555555555555555, 0x5555555555555555); __ Tbl(v16.V16B(), v1.V16B(), v0.V16B()); @@ -6081,15 +6077,15 @@ TEST(neon_destructive_tbl) { RUN(); - CHECK_EQUAL_128(0xa000000000000000, 0x0000000000adaeaf, q16); - CHECK_EQUAL_128(0xa000000000000000, 0x0000000000adaeaf, q17); - CHECK_EQUAL_128(0xa000000000000000, 0x0000000000adaeaf, q18); - CHECK_EQUAL_128(0x0f00000000000000, 0x0000000000424100, q19); + CHECK_EQUAL_128(0xA000000000000000, 0x0000000000ADAEAF, q16); + CHECK_EQUAL_128(0xA000000000000000, 0x0000000000ADAEAF, q17); + CHECK_EQUAL_128(0xA000000000000000, 0x0000000000ADAEAF, q18); + CHECK_EQUAL_128(0x0F00000000000000, 0x0000000000424100, q19); - CHECK_EQUAL_128(0xa0000000d4d5d6c7, 0xc8c9babbbcadaeaf, q20); - CHECK_EQUAL_128(0xa0000000d4d5d6c7, 0xc8c9babbbcadaeaf, q21); - CHECK_EQUAL_128(0xa0000000d4d5d6c7, 0xc8c9babbbcadaeaf, q22); - CHECK_EQUAL_128(0x0f000000c4c5c6b7, 0xb8b9aaabac424100, q26); + CHECK_EQUAL_128(0xA0000000D4D5D6C7, 0xC8C9BABBBCADAEAF, q20); + CHECK_EQUAL_128(0xA0000000D4D5D6C7, 0xC8C9BABBBCADAEAF, q21); + CHECK_EQUAL_128(0xA0000000D4D5D6C7, 0xC8C9BABBBCADAEAF, q22); + CHECK_EQUAL_128(0x0F000000C4C5C6B7, 0xB8B9AAABAC424100, q26); TEARDOWN(); } @@ -6099,11 +6095,11 @@ TEST(neon_destructive_tbx) { SETUP(); START(); - __ Movi(v0.V2D(), 0x0041424334353627, 0x28291a1b1c0d0e0f); - __ Movi(v1.V2D(), 0xafaeadacabaaa9a8, 0xa7a6a5a4a3a2a1a0); - __ Movi(v2.V2D(), 0xbfbebdbcbbbab9b8, 0xb7b6b5b4b3b2b1b0); - __ Movi(v3.V2D(), 0xcfcecdcccbcac9c8, 0xc7c6c5c4c3c2c1c0); - __ Movi(v4.V2D(), 0xdfdedddcdbdad9d8, 0xd7d6d5d4d3d2d1d0); + __ Movi(v0.V2D(), 0x0041424334353627, 0x28291A1B1C0D0E0F); + __ Movi(v1.V2D(), 0xAFAEADACABAAA9A8, 0xA7A6A5A4A3A2A1A0); + __ Movi(v2.V2D(), 0xBFBEBDBCBBBAB9B8, 0xB7B6B5B4B3B2B1B0); + __ Movi(v3.V2D(), 0xCFCECDCCCBCAC9C8, 0xC7C6C5C4C3C2C1C0); + __ Movi(v4.V2D(), 0xDFDEDDDCDBDAD9D8, 0xD7D6D5D4D3D2D1D0); __ Movi(v16.V2D(), 0x5555555555555555, 0x5555555555555555); __ Tbx(v16.V16B(), v1.V16B(), v0.V16B()); @@ -6133,15 +6129,15 @@ TEST(neon_destructive_tbx) { RUN(); - CHECK_EQUAL_128(0xa055555555555555, 0x5555555555adaeaf, q16); - CHECK_EQUAL_128(0xa041424334353627, 0x28291a1b1cadaeaf, q17); - CHECK_EQUAL_128(0xa0aeadacabaaa9a8, 0xa7a6a5a4a3adaeaf, q18); - CHECK_EQUAL_128(0x0f41424334353627, 0x28291a1b1c424100, q19); + CHECK_EQUAL_128(0xA055555555555555, 0x5555555555ADAEAF, q16); + CHECK_EQUAL_128(0xA041424334353627, 0x28291A1B1CADAEAF, q17); + CHECK_EQUAL_128(0xA0AEADACABAAA9A8, 0xA7A6A5A4A3ADAEAF, q18); + CHECK_EQUAL_128(0x0F41424334353627, 0x28291A1B1C424100, q19); - CHECK_EQUAL_128(0xa0555555d4d5d6c7, 0xc8c9babbbcadaeaf, q20); - CHECK_EQUAL_128(0xa0414243d4d5d6c7, 0xc8c9babbbcadaeaf, q21); - CHECK_EQUAL_128(0xa0aeadacd4d5d6c7, 0xc8c9babbbcadaeaf, q22); - CHECK_EQUAL_128(0x0f414243c4c5c6b7, 0xb8b9aaabac424100, q26); + CHECK_EQUAL_128(0xA0555555D4D5D6C7, 0xC8C9BABBBCADAEAF, q20); + CHECK_EQUAL_128(0xA0414243D4D5D6C7, 0xC8C9BABBBCADAEAF, q21); + CHECK_EQUAL_128(0xA0AEADACD4D5D6C7, 0xC8C9BABBBCADAEAF, q22); + CHECK_EQUAL_128(0x0F414243C4C5C6B7, 0xB8B9AAABAC424100, q26); TEARDOWN(); } @@ -6151,7 +6147,7 @@ TEST(neon_destructive_fcvtl) { SETUP(); START(); - __ Movi(v0.V2D(), 0x400000003f800000, 0xbf800000c0000000); + __ Movi(v0.V2D(), 0x400000003F800000, 0xBF800000C0000000); __ Fcvtl(v16.V2D(), v0.V2S()); __ Fcvtl2(v17.V2D(), v0.V4S()); __ Mov(v18, v0); @@ -6159,7 +6155,7 @@ TEST(neon_destructive_fcvtl) { __ Fcvtl(v18.V2D(), v18.V2S()); __ Fcvtl2(v19.V2D(), v19.V4S()); - __ Movi(v1.V2D(), 0x40003c003c004000, 0xc000bc00bc00c000); + __ Movi(v1.V2D(), 0x40003C003C004000, 0xC000BC00BC00C000); __ Fcvtl(v20.V4S(), v1.V4H()); __ Fcvtl2(v21.V4S(), v1.V8H()); __ Mov(v22, v1); @@ -6171,15 +6167,15 @@ TEST(neon_destructive_fcvtl) { RUN(); - CHECK_EQUAL_128(0xbff0000000000000, 0xc000000000000000, q16); - CHECK_EQUAL_128(0x4000000000000000, 0x3ff0000000000000, q17); - CHECK_EQUAL_128(0xbff0000000000000, 0xc000000000000000, q18); - CHECK_EQUAL_128(0x4000000000000000, 0x3ff0000000000000, q19); + CHECK_EQUAL_128(0xBFF0000000000000, 0xC000000000000000, q16); + CHECK_EQUAL_128(0x4000000000000000, 0x3FF0000000000000, q17); + CHECK_EQUAL_128(0xBFF0000000000000, 0xC000000000000000, q18); + CHECK_EQUAL_128(0x4000000000000000, 0x3FF0000000000000, q19); - CHECK_EQUAL_128(0xc0000000bf800000, 0xbf800000c0000000, q20); - CHECK_EQUAL_128(0x400000003f800000, 0x3f80000040000000, q21); - CHECK_EQUAL_128(0xc0000000bf800000, 0xbf800000c0000000, q22); - CHECK_EQUAL_128(0x400000003f800000, 0x3f80000040000000, q23); + CHECK_EQUAL_128(0xC0000000BF800000, 0xBF800000C0000000, q20); + CHECK_EQUAL_128(0x400000003F800000, 0x3F80000040000000, q21); + CHECK_EQUAL_128(0xC0000000BF800000, 0xBF800000C0000000, q22); + CHECK_EQUAL_128(0x400000003F800000, 0x3F80000040000000, q23); TEARDOWN(); } @@ -6247,8 +6243,8 @@ TEST(ldp_stp_double) { TEST(ldp_stp_quad) { SETUP(); - uint64_t src[4] = {0x0123456789abcdef, 0xaaaaaaaa55555555, 0xfedcba9876543210, - 0x55555555aaaaaaaa}; + uint64_t src[4] = {0x0123456789ABCDEF, 0xAAAAAAAA55555555, 0xFEDCBA9876543210, + 0x55555555AAAAAAAA}; uint64_t dst[6] = {0, 0, 0, 0, 0, 0}; uintptr_t src_base = reinterpret_cast<uintptr_t>(src); uintptr_t dst_base = reinterpret_cast<uintptr_t>(dst); @@ -6262,14 +6258,14 @@ TEST(ldp_stp_quad) { RUN(); - CHECK_EQUAL_128(0xaaaaaaaa55555555, 0x0123456789abcdef, q31); - CHECK_EQUAL_128(0x55555555aaaaaaaa, 0xfedcba9876543210, q0); + CHECK_EQUAL_128(0xAAAAAAAA55555555, 0x0123456789ABCDEF, q31); + CHECK_EQUAL_128(0x55555555AAAAAAAA, 0xFEDCBA9876543210, q0); CHECK_EQUAL_64(0, dst[0]); CHECK_EQUAL_64(0, dst[1]); - CHECK_EQUAL_64(0xfedcba9876543210, dst[2]); - CHECK_EQUAL_64(0x55555555aaaaaaaa, dst[3]); - CHECK_EQUAL_64(0x0123456789abcdef, dst[4]); - CHECK_EQUAL_64(0xaaaaaaaa55555555, dst[5]); + CHECK_EQUAL_64(0xFEDCBA9876543210, dst[2]); + CHECK_EQUAL_64(0x55555555AAAAAAAA, dst[3]); + CHECK_EQUAL_64(0x0123456789ABCDEF, dst[4]); + CHECK_EQUAL_64(0xAAAAAAAA55555555, dst[5]); CHECK_EQUAL_64(src_base + 4 * sizeof(src[0]), x16); CHECK_EQUAL_64(dst_base + 2 * sizeof(dst[1]), x17); @@ -6280,8 +6276,8 @@ TEST(ldp_stp_offset) { INIT_V8(); SETUP(); - uint64_t src[3] = {0x0011223344556677UL, 0x8899aabbccddeeffUL, - 0xffeeddccbbaa9988UL}; + uint64_t src[3] = {0x0011223344556677UL, 0x8899AABBCCDDEEFFUL, + 0xFFEEDDCCBBAA9988UL}; uint64_t dst[7] = {0, 0, 0, 0, 0, 0, 0}; uintptr_t src_base = reinterpret_cast<uintptr_t>(src); uintptr_t dst_base = reinterpret_cast<uintptr_t>(dst); @@ -6309,19 +6305,19 @@ TEST(ldp_stp_offset) { CHECK_EQUAL_64(0x00112233, x1); CHECK_EQUAL_64(0x0011223344556677UL, dst[0]); CHECK_EQUAL_64(0x00112233, x2); - CHECK_EQUAL_64(0xccddeeff, x3); - CHECK_EQUAL_64(0xccddeeff00112233UL, dst[1]); - CHECK_EQUAL_64(0x8899aabbccddeeffUL, x4); - CHECK_EQUAL_64(0x8899aabbccddeeffUL, dst[2]); - CHECK_EQUAL_64(0xffeeddccbbaa9988UL, x5); - CHECK_EQUAL_64(0xffeeddccbbaa9988UL, dst[3]); - CHECK_EQUAL_64(0x8899aabb, x6); - CHECK_EQUAL_64(0xbbaa9988, x7); - CHECK_EQUAL_64(0xbbaa99888899aabbUL, dst[4]); - CHECK_EQUAL_64(0x8899aabbccddeeffUL, x8); - CHECK_EQUAL_64(0x8899aabbccddeeffUL, dst[5]); - CHECK_EQUAL_64(0xffeeddccbbaa9988UL, x9); - CHECK_EQUAL_64(0xffeeddccbbaa9988UL, dst[6]); + CHECK_EQUAL_64(0xCCDDEEFF, x3); + CHECK_EQUAL_64(0xCCDDEEFF00112233UL, dst[1]); + CHECK_EQUAL_64(0x8899AABBCCDDEEFFUL, x4); + CHECK_EQUAL_64(0x8899AABBCCDDEEFFUL, dst[2]); + CHECK_EQUAL_64(0xFFEEDDCCBBAA9988UL, x5); + CHECK_EQUAL_64(0xFFEEDDCCBBAA9988UL, dst[3]); + CHECK_EQUAL_64(0x8899AABB, x6); + CHECK_EQUAL_64(0xBBAA9988, x7); + CHECK_EQUAL_64(0xBBAA99888899AABBUL, dst[4]); + CHECK_EQUAL_64(0x8899AABBCCDDEEFFUL, x8); + CHECK_EQUAL_64(0x8899AABBCCDDEEFFUL, dst[5]); + CHECK_EQUAL_64(0xFFEEDDCCBBAA9988UL, x9); + CHECK_EQUAL_64(0xFFEEDDCCBBAA9988UL, dst[6]); CHECK_EQUAL_64(src_base, x16); CHECK_EQUAL_64(dst_base, x17); CHECK_EQUAL_64(src_base + 24, x18); @@ -6335,8 +6331,8 @@ TEST(ldp_stp_offset_wide) { INIT_V8(); SETUP(); - uint64_t src[3] = {0x0011223344556677, 0x8899aabbccddeeff, - 0xffeeddccbbaa9988}; + uint64_t src[3] = {0x0011223344556677, 0x8899AABBCCDDEEFF, + 0xFFEEDDCCBBAA9988}; uint64_t dst[7] = {0, 0, 0, 0, 0, 0, 0}; uintptr_t src_base = reinterpret_cast<uintptr_t>(src); uintptr_t dst_base = reinterpret_cast<uintptr_t>(dst); @@ -6367,19 +6363,19 @@ TEST(ldp_stp_offset_wide) { CHECK_EQUAL_64(0x00112233, x1); CHECK_EQUAL_64(0x0011223344556677UL, dst[0]); CHECK_EQUAL_64(0x00112233, x2); - CHECK_EQUAL_64(0xccddeeff, x3); - CHECK_EQUAL_64(0xccddeeff00112233UL, dst[1]); - CHECK_EQUAL_64(0x8899aabbccddeeffUL, x4); - CHECK_EQUAL_64(0x8899aabbccddeeffUL, dst[2]); - CHECK_EQUAL_64(0xffeeddccbbaa9988UL, x5); - CHECK_EQUAL_64(0xffeeddccbbaa9988UL, dst[3]); - CHECK_EQUAL_64(0x8899aabb, x6); - CHECK_EQUAL_64(0xbbaa9988, x7); - CHECK_EQUAL_64(0xbbaa99888899aabbUL, dst[4]); - CHECK_EQUAL_64(0x8899aabbccddeeffUL, x8); - CHECK_EQUAL_64(0x8899aabbccddeeffUL, dst[5]); - CHECK_EQUAL_64(0xffeeddccbbaa9988UL, x9); - CHECK_EQUAL_64(0xffeeddccbbaa9988UL, dst[6]); + CHECK_EQUAL_64(0xCCDDEEFF, x3); + CHECK_EQUAL_64(0xCCDDEEFF00112233UL, dst[1]); + CHECK_EQUAL_64(0x8899AABBCCDDEEFFUL, x4); + CHECK_EQUAL_64(0x8899AABBCCDDEEFFUL, dst[2]); + CHECK_EQUAL_64(0xFFEEDDCCBBAA9988UL, x5); + CHECK_EQUAL_64(0xFFEEDDCCBBAA9988UL, dst[3]); + CHECK_EQUAL_64(0x8899AABB, x6); + CHECK_EQUAL_64(0xBBAA9988, x7); + CHECK_EQUAL_64(0xBBAA99888899AABBUL, dst[4]); + CHECK_EQUAL_64(0x8899AABBCCDDEEFFUL, x8); + CHECK_EQUAL_64(0x8899AABBCCDDEEFFUL, dst[5]); + CHECK_EQUAL_64(0xFFEEDDCCBBAA9988UL, x9); + CHECK_EQUAL_64(0xFFEEDDCCBBAA9988UL, dst[6]); CHECK_EQUAL_64(src_base - base_offset, x20); CHECK_EQUAL_64(dst_base - base_offset, x21); CHECK_EQUAL_64(src_base + base_offset + 24, x18); @@ -6393,8 +6389,8 @@ TEST(ldp_stp_preindex) { INIT_V8(); SETUP(); - uint64_t src[3] = {0x0011223344556677UL, 0x8899aabbccddeeffUL, - 0xffeeddccbbaa9988UL}; + uint64_t src[3] = {0x0011223344556677UL, 0x8899AABBCCDDEEFFUL, + 0xFFEEDDCCBBAA9988UL}; uint64_t dst[5] = {0, 0, 0, 0, 0}; uintptr_t src_base = reinterpret_cast<uintptr_t>(src); uintptr_t dst_base = reinterpret_cast<uintptr_t>(dst); @@ -6420,17 +6416,17 @@ TEST(ldp_stp_preindex) { RUN(); CHECK_EQUAL_64(0x00112233, x0); - CHECK_EQUAL_64(0xccddeeff, x1); + CHECK_EQUAL_64(0xCCDDEEFF, x1); CHECK_EQUAL_64(0x44556677, x2); CHECK_EQUAL_64(0x00112233, x3); - CHECK_EQUAL_64(0xccddeeff00112233UL, dst[0]); + CHECK_EQUAL_64(0xCCDDEEFF00112233UL, dst[0]); CHECK_EQUAL_64(0x0000000000112233UL, dst[1]); - CHECK_EQUAL_64(0x8899aabbccddeeffUL, x4); - CHECK_EQUAL_64(0xffeeddccbbaa9988UL, x5); + CHECK_EQUAL_64(0x8899AABBCCDDEEFFUL, x4); + CHECK_EQUAL_64(0xFFEEDDCCBBAA9988UL, x5); CHECK_EQUAL_64(0x0011223344556677UL, x6); - CHECK_EQUAL_64(0x8899aabbccddeeffUL, x7); - CHECK_EQUAL_64(0xffeeddccbbaa9988UL, dst[2]); - CHECK_EQUAL_64(0x8899aabbccddeeffUL, dst[3]); + CHECK_EQUAL_64(0x8899AABBCCDDEEFFUL, x7); + CHECK_EQUAL_64(0xFFEEDDCCBBAA9988UL, dst[2]); + CHECK_EQUAL_64(0x8899AABBCCDDEEFFUL, dst[3]); CHECK_EQUAL_64(0x0011223344556677UL, dst[4]); CHECK_EQUAL_64(src_base, x16); CHECK_EQUAL_64(dst_base, x17); @@ -6448,8 +6444,8 @@ TEST(ldp_stp_preindex_wide) { INIT_V8(); SETUP(); - uint64_t src[3] = {0x0011223344556677, 0x8899aabbccddeeff, - 0xffeeddccbbaa9988}; + uint64_t src[3] = {0x0011223344556677, 0x8899AABBCCDDEEFF, + 0xFFEEDDCCBBAA9988}; uint64_t dst[5] = {0, 0, 0, 0, 0}; uintptr_t src_base = reinterpret_cast<uintptr_t>(src); uintptr_t dst_base = reinterpret_cast<uintptr_t>(dst); @@ -6483,17 +6479,17 @@ TEST(ldp_stp_preindex_wide) { RUN(); CHECK_EQUAL_64(0x00112233, x0); - CHECK_EQUAL_64(0xccddeeff, x1); + CHECK_EQUAL_64(0xCCDDEEFF, x1); CHECK_EQUAL_64(0x44556677, x2); CHECK_EQUAL_64(0x00112233, x3); - CHECK_EQUAL_64(0xccddeeff00112233UL, dst[0]); + CHECK_EQUAL_64(0xCCDDEEFF00112233UL, dst[0]); CHECK_EQUAL_64(0x0000000000112233UL, dst[1]); - CHECK_EQUAL_64(0x8899aabbccddeeffUL, x4); - CHECK_EQUAL_64(0xffeeddccbbaa9988UL, x5); + CHECK_EQUAL_64(0x8899AABBCCDDEEFFUL, x4); + CHECK_EQUAL_64(0xFFEEDDCCBBAA9988UL, x5); CHECK_EQUAL_64(0x0011223344556677UL, x6); - CHECK_EQUAL_64(0x8899aabbccddeeffUL, x7); - CHECK_EQUAL_64(0xffeeddccbbaa9988UL, dst[2]); - CHECK_EQUAL_64(0x8899aabbccddeeffUL, dst[3]); + CHECK_EQUAL_64(0x8899AABBCCDDEEFFUL, x7); + CHECK_EQUAL_64(0xFFEEDDCCBBAA9988UL, dst[2]); + CHECK_EQUAL_64(0x8899AABBCCDDEEFFUL, dst[3]); CHECK_EQUAL_64(0x0011223344556677UL, dst[4]); CHECK_EQUAL_64(src_base, x24); CHECK_EQUAL_64(dst_base, x25); @@ -6511,8 +6507,8 @@ TEST(ldp_stp_postindex) { INIT_V8(); SETUP(); - uint64_t src[4] = {0x0011223344556677UL, 0x8899aabbccddeeffUL, - 0xffeeddccbbaa9988UL, 0x7766554433221100UL}; + uint64_t src[4] = {0x0011223344556677UL, 0x8899AABBCCDDEEFFUL, + 0xFFEEDDCCBBAA9988UL, 0x7766554433221100UL}; uint64_t dst[5] = {0, 0, 0, 0, 0}; uintptr_t src_base = reinterpret_cast<uintptr_t>(src); uintptr_t dst_base = reinterpret_cast<uintptr_t>(dst); @@ -6540,15 +6536,15 @@ TEST(ldp_stp_postindex) { CHECK_EQUAL_64(0x44556677, x0); CHECK_EQUAL_64(0x00112233, x1); CHECK_EQUAL_64(0x00112233, x2); - CHECK_EQUAL_64(0xccddeeff, x3); + CHECK_EQUAL_64(0xCCDDEEFF, x3); CHECK_EQUAL_64(0x4455667700112233UL, dst[0]); CHECK_EQUAL_64(0x0000000000112233UL, dst[1]); CHECK_EQUAL_64(0x0011223344556677UL, x4); - CHECK_EQUAL_64(0x8899aabbccddeeffUL, x5); - CHECK_EQUAL_64(0x8899aabbccddeeffUL, x6); - CHECK_EQUAL_64(0xffeeddccbbaa9988UL, x7); - CHECK_EQUAL_64(0xffeeddccbbaa9988UL, dst[2]); - CHECK_EQUAL_64(0x8899aabbccddeeffUL, dst[3]); + CHECK_EQUAL_64(0x8899AABBCCDDEEFFUL, x5); + CHECK_EQUAL_64(0x8899AABBCCDDEEFFUL, x6); + CHECK_EQUAL_64(0xFFEEDDCCBBAA9988UL, x7); + CHECK_EQUAL_64(0xFFEEDDCCBBAA9988UL, dst[2]); + CHECK_EQUAL_64(0x8899AABBCCDDEEFFUL, dst[3]); CHECK_EQUAL_64(0x0011223344556677UL, dst[4]); CHECK_EQUAL_64(src_base, x16); CHECK_EQUAL_64(dst_base, x17); @@ -6566,7 +6562,7 @@ TEST(ldp_stp_postindex_wide) { INIT_V8(); SETUP(); - uint64_t src[4] = {0x0011223344556677, 0x8899aabbccddeeff, 0xffeeddccbbaa9988, + uint64_t src[4] = {0x0011223344556677, 0x8899AABBCCDDEEFF, 0xFFEEDDCCBBAA9988, 0x7766554433221100}; uint64_t dst[5] = {0, 0, 0, 0, 0}; uintptr_t src_base = reinterpret_cast<uintptr_t>(src); @@ -6603,15 +6599,15 @@ TEST(ldp_stp_postindex_wide) { CHECK_EQUAL_64(0x44556677, x0); CHECK_EQUAL_64(0x00112233, x1); CHECK_EQUAL_64(0x00112233, x2); - CHECK_EQUAL_64(0xccddeeff, x3); + CHECK_EQUAL_64(0xCCDDEEFF, x3); CHECK_EQUAL_64(0x4455667700112233UL, dst[0]); CHECK_EQUAL_64(0x0000000000112233UL, dst[1]); CHECK_EQUAL_64(0x0011223344556677UL, x4); - CHECK_EQUAL_64(0x8899aabbccddeeffUL, x5); - CHECK_EQUAL_64(0x8899aabbccddeeffUL, x6); - CHECK_EQUAL_64(0xffeeddccbbaa9988UL, x7); - CHECK_EQUAL_64(0xffeeddccbbaa9988UL, dst[2]); - CHECK_EQUAL_64(0x8899aabbccddeeffUL, dst[3]); + CHECK_EQUAL_64(0x8899AABBCCDDEEFFUL, x5); + CHECK_EQUAL_64(0x8899AABBCCDDEEFFUL, x6); + CHECK_EQUAL_64(0xFFEEDDCCBBAA9988UL, x7); + CHECK_EQUAL_64(0xFFEEDDCCBBAA9988UL, dst[2]); + CHECK_EQUAL_64(0x8899AABBCCDDEEFFUL, dst[3]); CHECK_EQUAL_64(0x0011223344556677UL, dst[4]); CHECK_EQUAL_64(src_base + base_offset, x24); CHECK_EQUAL_64(dst_base - base_offset, x25); @@ -6629,7 +6625,7 @@ TEST(ldp_sign_extend) { INIT_V8(); SETUP(); - uint32_t src[2] = {0x80000000, 0x7fffffff}; + uint32_t src[2] = {0x80000000, 0x7FFFFFFF}; uintptr_t src_base = reinterpret_cast<uintptr_t>(src); START(); @@ -6639,8 +6635,8 @@ TEST(ldp_sign_extend) { RUN(); - CHECK_EQUAL_64(0xffffffff80000000UL, x0); - CHECK_EQUAL_64(0x000000007fffffffUL, x1); + CHECK_EQUAL_64(0xFFFFFFFF80000000UL, x0); + CHECK_EQUAL_64(0x000000007FFFFFFFUL, x1); TEARDOWN(); } @@ -6650,7 +6646,7 @@ TEST(ldur_stur) { INIT_V8(); SETUP(); - int64_t src[2] = {0x0123456789abcdefUL, 0x0123456789abcdefUL}; + int64_t src[2] = {0x0123456789ABCDEFUL, 0x0123456789ABCDEFUL}; int64_t dst[5] = {0, 0, 0, 0, 0}; uintptr_t src_base = reinterpret_cast<uintptr_t>(src); uintptr_t dst_base = reinterpret_cast<uintptr_t>(dst); @@ -6673,13 +6669,13 @@ TEST(ldur_stur) { RUN(); - CHECK_EQUAL_64(0x6789abcd, x0); - CHECK_EQUAL_64(0x6789abcd0000L, dst[0]); - CHECK_EQUAL_64(0xabcdef0123456789L, x1); - CHECK_EQUAL_64(0xcdef012345678900L, dst[1]); - CHECK_EQUAL_64(0x000000ab, dst[2]); - CHECK_EQUAL_64(0xabcdef01, x2); - CHECK_EQUAL_64(0x00abcdef01000000L, dst[3]); + CHECK_EQUAL_64(0x6789ABCD, x0); + CHECK_EQUAL_64(0x6789ABCD0000L, dst[0]); + CHECK_EQUAL_64(0xABCDEF0123456789L, x1); + CHECK_EQUAL_64(0xCDEF012345678900L, dst[1]); + CHECK_EQUAL_64(0x000000AB, dst[2]); + CHECK_EQUAL_64(0xABCDEF01, x2); + CHECK_EQUAL_64(0x00ABCDEF01000000L, dst[3]); CHECK_EQUAL_64(0x00000001, x3); CHECK_EQUAL_64(0x0100000000000000L, dst[4]); CHECK_EQUAL_64(src_base, x17); @@ -6696,7 +6692,7 @@ TEST(ldr_pcrel_large_offset) { START(); - __ Ldr(x1, Immediate(0x1234567890abcdefUL)); + __ Ldr(x1, Immediate(0x1234567890ABCDEFUL)); { v8::internal::PatchingAssembler::BlockPoolsScope scope(&masm); @@ -6706,14 +6702,14 @@ TEST(ldr_pcrel_large_offset) { } } - __ Ldr(x2, Immediate(0x1234567890abcdefUL)); + __ Ldr(x2, Immediate(0x1234567890ABCDEFUL)); END(); RUN(); - CHECK_EQUAL_64(0x1234567890abcdefUL, x1); - CHECK_EQUAL_64(0x1234567890abcdefUL, x2); + CHECK_EQUAL_64(0x1234567890ABCDEFUL, x1); + CHECK_EQUAL_64(0x1234567890ABCDEFUL, x2); TEARDOWN(); } @@ -6723,13 +6719,13 @@ TEST(ldr_literal) { SETUP(); START(); - __ Ldr(x2, Immediate(0x1234567890abcdefUL)); + __ Ldr(x2, Immediate(0x1234567890ABCDEFUL)); __ Ldr(d13, 1.234); END(); RUN(); - CHECK_EQUAL_64(0x1234567890abcdefUL, x2); + CHECK_EQUAL_64(0x1234567890ABCDEFUL, x2); CHECK_EQUAL_FP64(1.234, d13); TEARDOWN(); @@ -6762,7 +6758,7 @@ static void LdrLiteralRangeHelper(int range_, LiteralPoolEmitOption option, __ CheckConstPool(true, true); CHECK_CONSTANT_POOL_SIZE(0); - __ Ldr(x0, Immediate(0x1234567890abcdefUL)); + __ Ldr(x0, Immediate(0x1234567890ABCDEFUL)); __ Ldr(d0, 1.234); CHECK_CONSTANT_POOL_SIZE(16); @@ -6803,7 +6799,7 @@ static void LdrLiteralRangeHelper(int range_, LiteralPoolEmitOption option, CHECK_CONSTANT_POOL_SIZE(0); // These loads should be after the pool (and will require a new one). - __ Ldr(x4, Immediate(0x34567890abcdef12UL)); + __ Ldr(x4, Immediate(0x34567890ABCDEF12UL)); __ Ldr(d4, 123.4); CHECK_CONSTANT_POOL_SIZE(16); END(); @@ -6811,9 +6807,9 @@ static void LdrLiteralRangeHelper(int range_, LiteralPoolEmitOption option, RUN(); // Check that the literals loaded correctly. - CHECK_EQUAL_64(0x1234567890abcdefUL, x0); + CHECK_EQUAL_64(0x1234567890ABCDEFUL, x0); CHECK_EQUAL_FP64(1.234, d0); - CHECK_EQUAL_64(0x34567890abcdef12UL, x4); + CHECK_EQUAL_64(0x34567890ABCDEF12UL, x4); CHECK_EQUAL_FP64(123.4, d4); TEARDOWN(); @@ -6857,17 +6853,17 @@ TEST(add_sub_imm) { START(); __ Mov(x0, 0x0); __ Mov(x1, 0x1111); - __ Mov(x2, 0xffffffffffffffffL); + __ Mov(x2, 0xFFFFFFFFFFFFFFFFL); __ Mov(x3, 0x8000000000000000L); __ Add(x10, x0, Operand(0x123)); __ Add(x11, x1, Operand(0x122000)); - __ Add(x12, x0, Operand(0xabc << 12)); + __ Add(x12, x0, Operand(0xABC << 12)); __ Add(x13, x2, Operand(1)); __ Add(w14, w0, Operand(0x123)); __ Add(w15, w1, Operand(0x122000)); - __ Add(w16, w0, Operand(0xabc << 12)); + __ Add(w16, w0, Operand(0xABC << 12)); __ Add(w17, w2, Operand(1)); __ Sub(x20, x0, Operand(0x1)); @@ -6885,23 +6881,23 @@ TEST(add_sub_imm) { CHECK_EQUAL_64(0x123, x10); CHECK_EQUAL_64(0x123111, x11); - CHECK_EQUAL_64(0xabc000, x12); + CHECK_EQUAL_64(0xABC000, x12); CHECK_EQUAL_64(0x0, x13); CHECK_EQUAL_32(0x123, w14); CHECK_EQUAL_32(0x123111, w15); - CHECK_EQUAL_32(0xabc000, w16); + CHECK_EQUAL_32(0xABC000, w16); CHECK_EQUAL_32(0x0, w17); - CHECK_EQUAL_64(0xffffffffffffffffL, x20); + CHECK_EQUAL_64(0xFFFFFFFFFFFFFFFFL, x20); CHECK_EQUAL_64(0x1000, x21); CHECK_EQUAL_64(0x111, x22); - CHECK_EQUAL_64(0x7fffffffffffffffL, x23); + CHECK_EQUAL_64(0x7FFFFFFFFFFFFFFFL, x23); - CHECK_EQUAL_32(0xffffffff, w24); + CHECK_EQUAL_32(0xFFFFFFFF, w24); CHECK_EQUAL_32(0x1000, w25); CHECK_EQUAL_32(0x111, w26); - CHECK_EQUAL_32(0xffffffff, w27); + CHECK_EQUAL_32(0xFFFFFFFF, w27); TEARDOWN(); } @@ -6915,22 +6911,22 @@ TEST(add_sub_wide_imm) { __ Mov(x0, 0x0); __ Mov(x1, 0x1); - __ Add(x10, x0, Operand(0x1234567890abcdefUL)); - __ Add(x11, x1, Operand(0xffffffff)); + __ Add(x10, x0, Operand(0x1234567890ABCDEFUL)); + __ Add(x11, x1, Operand(0xFFFFFFFF)); __ Add(w12, w0, Operand(0x12345678)); - __ Add(w13, w1, Operand(0xffffffff)); + __ Add(w13, w1, Operand(0xFFFFFFFF)); __ Add(w18, w0, Operand(kWMinInt)); __ Sub(w19, w0, Operand(kWMinInt)); - __ Sub(x20, x0, Operand(0x1234567890abcdefUL)); + __ Sub(x20, x0, Operand(0x1234567890ABCDEFUL)); __ Sub(w21, w0, Operand(0x12345678)); END(); RUN(); - CHECK_EQUAL_64(0x1234567890abcdefUL, x10); + CHECK_EQUAL_64(0x1234567890ABCDEFUL, x10); CHECK_EQUAL_64(0x100000000UL, x11); CHECK_EQUAL_32(0x12345678, w12); @@ -6939,7 +6935,7 @@ TEST(add_sub_wide_imm) { CHECK_EQUAL_32(kWMinInt, w18); CHECK_EQUAL_32(kWMinInt, w19); - CHECK_EQUAL_64(-0x1234567890abcdefUL, x20); + CHECK_EQUAL_64(-0x1234567890ABCDEFUL, x20); CHECK_EQUAL_32(-0x12345678, w21); TEARDOWN(); @@ -6952,9 +6948,9 @@ TEST(add_sub_shifted) { START(); __ Mov(x0, 0); - __ Mov(x1, 0x0123456789abcdefL); - __ Mov(x2, 0xfedcba9876543210L); - __ Mov(x3, 0xffffffffffffffffL); + __ Mov(x1, 0x0123456789ABCDEFL); + __ Mov(x2, 0xFEDCBA9876543210L); + __ Mov(x3, 0xFFFFFFFFFFFFFFFFL); __ Add(x10, x1, Operand(x2)); __ Add(x11, x0, Operand(x1, LSL, 8)); @@ -6977,23 +6973,23 @@ TEST(add_sub_shifted) { RUN(); - CHECK_EQUAL_64(0xffffffffffffffffL, x10); - CHECK_EQUAL_64(0x23456789abcdef00L, x11); - CHECK_EQUAL_64(0x000123456789abcdL, x12); - CHECK_EQUAL_64(0x000123456789abcdL, x13); - CHECK_EQUAL_64(0xfffedcba98765432L, x14); - CHECK_EQUAL_64(0xff89abcd, x15); - CHECK_EQUAL_64(0xef89abcc, x18); - CHECK_EQUAL_64(0xef0123456789abccL, x19); + CHECK_EQUAL_64(0xFFFFFFFFFFFFFFFFL, x10); + CHECK_EQUAL_64(0x23456789ABCDEF00L, x11); + CHECK_EQUAL_64(0x000123456789ABCDL, x12); + CHECK_EQUAL_64(0x000123456789ABCDL, x13); + CHECK_EQUAL_64(0xFFFEDCBA98765432L, x14); + CHECK_EQUAL_64(0xFF89ABCD, x15); + CHECK_EQUAL_64(0xEF89ABCC, x18); + CHECK_EQUAL_64(0xEF0123456789ABCCL, x19); - CHECK_EQUAL_64(0x0123456789abcdefL, x20); - CHECK_EQUAL_64(0xdcba9876543210ffL, x21); - CHECK_EQUAL_64(0xfffedcba98765432L, x22); - CHECK_EQUAL_64(0xfffedcba98765432L, x23); - CHECK_EQUAL_64(0x000123456789abcdL, x24); + CHECK_EQUAL_64(0x0123456789ABCDEFL, x20); + CHECK_EQUAL_64(0xDCBA9876543210FFL, x21); + CHECK_EQUAL_64(0xFFFEDCBA98765432L, x22); + CHECK_EQUAL_64(0xFFFEDCBA98765432L, x23); + CHECK_EQUAL_64(0x000123456789ABCDL, x24); CHECK_EQUAL_64(0x00765432, x25); CHECK_EQUAL_64(0x10765432, x26); - CHECK_EQUAL_64(0x10fedcba98765432L, x27); + CHECK_EQUAL_64(0x10FEDCBA98765432L, x27); TEARDOWN(); } @@ -7005,8 +7001,8 @@ TEST(add_sub_extended) { START(); __ Mov(x0, 0); - __ Mov(x1, 0x0123456789abcdefL); - __ Mov(x2, 0xfedcba9876543210L); + __ Mov(x1, 0x0123456789ABCDEFL); + __ Mov(x2, 0xFEDCBA9876543210L); __ Mov(w3, 0x80); __ Add(x10, x0, Operand(x1, UXTB, 0)); @@ -7039,30 +7035,30 @@ TEST(add_sub_extended) { RUN(); - CHECK_EQUAL_64(0xefL, x10); - CHECK_EQUAL_64(0x1deL, x11); - CHECK_EQUAL_64(0x337bcL, x12); - CHECK_EQUAL_64(0x89abcdef0L, x13); + CHECK_EQUAL_64(0xEFL, x10); + CHECK_EQUAL_64(0x1DEL, x11); + CHECK_EQUAL_64(0x337BCL, x12); + CHECK_EQUAL_64(0x89ABCDEF0L, x13); - CHECK_EQUAL_64(0xffffffffffffffefL, x14); - CHECK_EQUAL_64(0xffffffffffffffdeL, x15); - CHECK_EQUAL_64(0xffffffffffff37bcL, x16); - CHECK_EQUAL_64(0xfffffffc4d5e6f78L, x17); + CHECK_EQUAL_64(0xFFFFFFFFFFFFFFEFL, x14); + CHECK_EQUAL_64(0xFFFFFFFFFFFFFFDEL, x15); + CHECK_EQUAL_64(0xFFFFFFFFFFFF37BCL, x16); + CHECK_EQUAL_64(0xFFFFFFFC4D5E6F78L, x17); CHECK_EQUAL_64(0x10L, x18); CHECK_EQUAL_64(0x20L, x19); - CHECK_EQUAL_64(0xc840L, x20); - CHECK_EQUAL_64(0x3b2a19080L, x21); + CHECK_EQUAL_64(0xC840L, x20); + CHECK_EQUAL_64(0x3B2A19080L, x21); - CHECK_EQUAL_64(0x0123456789abce0fL, x22); - CHECK_EQUAL_64(0x0123456789abcdcfL, x23); + CHECK_EQUAL_64(0x0123456789ABCE0FL, x22); + CHECK_EQUAL_64(0x0123456789ABCDCFL, x23); - CHECK_EQUAL_32(0x89abce2f, w24); - CHECK_EQUAL_32(0xffffffef, w25); - CHECK_EQUAL_32(0xffffffde, w26); - CHECK_EQUAL_32(0xc3b2a188, w27); + CHECK_EQUAL_32(0x89ABCE2F, w24); + CHECK_EQUAL_32(0xFFFFFFEF, w25); + CHECK_EQUAL_32(0xFFFFFFDE, w26); + CHECK_EQUAL_32(0xC3B2A188, w27); - CHECK_EQUAL_32(0x4d5e6f78, w28); - CHECK_EQUAL_64(0xfffffffc4d5e6f78L, x29); + CHECK_EQUAL_32(0x4D5E6F78, w28); + CHECK_EQUAL_64(0xFFFFFFFC4D5E6F78L, x29); CHECK_EQUAL_64(256, x30); @@ -7092,7 +7088,7 @@ TEST(add_sub_negative) { __ Add(w19, w3, -0x344); __ Add(w20, w4, -2000); - __ Sub(w21, w3, -0xbc); + __ Sub(w21, w3, -0xBC); __ Sub(w22, w4, -2000); END(); @@ -7104,7 +7100,7 @@ TEST(add_sub_negative) { CHECK_EQUAL_64(600, x13); CHECK_EQUAL_64(5000, x14); - CHECK_EQUAL_64(0x1122334455667cdd, x15); + CHECK_EQUAL_64(0x1122334455667CDD, x15); CHECK_EQUAL_32(0x11223000, w19); CHECK_EQUAL_32(398000, w20); @@ -7162,8 +7158,7 @@ TEST(preshift_immediates) { // pre-shifted encodable immediate followed by a post-shift applied to // the arithmetic or logical operation. - // Save csp and change stack pointer to avoid consistency check. - __ SetStackPointer(jssp); + // Save csp. __ Mov(x29, csp); // Set the registers to known values. @@ -7171,28 +7166,28 @@ TEST(preshift_immediates) { __ Mov(csp, 0x1000); // Arithmetic ops. - __ Add(x1, x0, 0x1f7de); - __ Add(w2, w0, 0xffffff1); + __ Add(x1, x0, 0x1F7DE); + __ Add(w2, w0, 0xFFFFFF1); __ Adds(x3, x0, 0x18001); - __ Adds(w4, w0, 0xffffff1); + __ Adds(w4, w0, 0xFFFFFF1); __ Add(x5, x0, 0x10100); - __ Sub(w6, w0, 0xffffff1); + __ Sub(w6, w0, 0xFFFFFF1); __ Subs(x7, x0, 0x18001); - __ Subs(w8, w0, 0xffffff1); + __ Subs(w8, w0, 0xFFFFFF1); // Logical ops. - __ And(x9, x0, 0x1f7de); - __ Orr(w10, w0, 0xffffff1); + __ And(x9, x0, 0x1F7DE); + __ Orr(w10, w0, 0xFFFFFF1); __ Eor(x11, x0, 0x18001); // Ops using the stack pointer. - __ Add(csp, csp, 0x1f7f0); + __ Add(csp, csp, 0x1F7F0); __ Mov(x12, csp); __ Mov(csp, 0x1000); - __ Adds(x13, csp, 0x1f7f0); + __ Adds(x13, csp, 0x1F7F0); - __ Orr(csp, x0, 0x1f7f0); + __ Orr(csp, x0, 0x1F7F0); __ Mov(x14, csp); __ Mov(csp, 0x1000); @@ -7201,25 +7196,24 @@ TEST(preshift_immediates) { // Restore csp. __ Mov(csp, x29); - __ SetStackPointer(csp); END(); RUN(); CHECK_EQUAL_64(0x1000, x0); - CHECK_EQUAL_64(0x207de, x1); - CHECK_EQUAL_64(0x10000ff1, x2); + CHECK_EQUAL_64(0x207DE, x1); + CHECK_EQUAL_64(0x10000FF1, x2); CHECK_EQUAL_64(0x19001, x3); - CHECK_EQUAL_64(0x10000ff1, x4); + CHECK_EQUAL_64(0x10000FF1, x4); CHECK_EQUAL_64(0x11100, x5); - CHECK_EQUAL_64(0xf000100f, x6); - CHECK_EQUAL_64(0xfffffffffffe8fff, x7); - CHECK_EQUAL_64(0xf000100f, x8); + CHECK_EQUAL_64(0xF000100F, x6); + CHECK_EQUAL_64(0xFFFFFFFFFFFE8FFF, x7); + CHECK_EQUAL_64(0xF000100F, x8); CHECK_EQUAL_64(0x1000, x9); - CHECK_EQUAL_64(0xffffff1, x10); - CHECK_EQUAL_64(0x207f0, x12); - CHECK_EQUAL_64(0x207f0, x13); - CHECK_EQUAL_64(0x1f7f0, x14); + CHECK_EQUAL_64(0xFFFFFF1, x10); + CHECK_EQUAL_64(0x207F0, x12); + CHECK_EQUAL_64(0x207F0, x13); + CHECK_EQUAL_64(0x1F7F0, x14); CHECK_EQUAL_64(0x11100, x15); TEARDOWN(); @@ -7260,7 +7254,7 @@ TEST(neg) { SETUP(); START(); - __ Mov(x0, 0xf123456789abcdefL); + __ Mov(x0, 0xF123456789ABCDEFL); // Immediate. __ Neg(x1, 0x123); @@ -7285,17 +7279,17 @@ TEST(neg) { RUN(); - CHECK_EQUAL_64(0xfffffffffffffeddUL, x1); - CHECK_EQUAL_64(0xfffffedd, x2); - CHECK_EQUAL_64(0x1db97530eca86422UL, x3); - CHECK_EQUAL_64(0xd950c844, x4); - CHECK_EQUAL_64(0xe1db97530eca8643UL, x5); - CHECK_EQUAL_64(0xf7654322, x6); - CHECK_EQUAL_64(0x0076e5d4c3b2a191UL, x7); - CHECK_EQUAL_64(0x01d950c9, x8); - CHECK_EQUAL_64(0xffffff11, x9); + CHECK_EQUAL_64(0xFFFFFFFFFFFFFEDDUL, x1); + CHECK_EQUAL_64(0xFFFFFEDD, x2); + CHECK_EQUAL_64(0x1DB97530ECA86422UL, x3); + CHECK_EQUAL_64(0xD950C844, x4); + CHECK_EQUAL_64(0xE1DB97530ECA8643UL, x5); + CHECK_EQUAL_64(0xF7654322, x6); + CHECK_EQUAL_64(0x0076E5D4C3B2A191UL, x7); + CHECK_EQUAL_64(0x01D950C9, x8); + CHECK_EQUAL_64(0xFFFFFF11, x9); CHECK_EQUAL_64(0x0000000000000022UL, x10); - CHECK_EQUAL_64(0xfffcc844, x11); + CHECK_EQUAL_64(0xFFFCC844, x11); CHECK_EQUAL_64(0x0000000000019088UL, x12); CHECK_EQUAL_64(0x65432110, x13); CHECK_EQUAL_64(0x0000000765432110UL, x14); @@ -7337,9 +7331,9 @@ static void AdcsSbcsHelper(Op op, T left, T right, int carry, T expected, TEST(adcs_sbcs_x) { INIT_V8(); uint64_t inputs[] = { - 0x0000000000000000, 0x0000000000000001, 0x7ffffffffffffffe, - 0x7fffffffffffffff, 0x8000000000000000, 0x8000000000000001, - 0xfffffffffffffffe, 0xffffffffffffffff, + 0x0000000000000000, 0x0000000000000001, 0x7FFFFFFFFFFFFFFE, + 0x7FFFFFFFFFFFFFFF, 0x8000000000000000, 0x8000000000000001, + 0xFFFFFFFFFFFFFFFE, 0xFFFFFFFFFFFFFFFF, }; static const size_t input_count = sizeof(inputs) / sizeof(inputs[0]); @@ -7353,134 +7347,134 @@ TEST(adcs_sbcs_x) { static const Expected expected_adcs_x[input_count][input_count] = { {{0x0000000000000000, ZFlag, 0x0000000000000001, NoFlag}, {0x0000000000000001, NoFlag, 0x0000000000000002, NoFlag}, - {0x7ffffffffffffffe, NoFlag, 0x7fffffffffffffff, NoFlag}, - {0x7fffffffffffffff, NoFlag, 0x8000000000000000, NVFlag}, + {0x7FFFFFFFFFFFFFFE, NoFlag, 0x7FFFFFFFFFFFFFFF, NoFlag}, + {0x7FFFFFFFFFFFFFFF, NoFlag, 0x8000000000000000, NVFlag}, {0x8000000000000000, NFlag, 0x8000000000000001, NFlag}, {0x8000000000000001, NFlag, 0x8000000000000002, NFlag}, - {0xfffffffffffffffe, NFlag, 0xffffffffffffffff, NFlag}, - {0xffffffffffffffff, NFlag, 0x0000000000000000, ZCFlag}}, + {0xFFFFFFFFFFFFFFFE, NFlag, 0xFFFFFFFFFFFFFFFF, NFlag}, + {0xFFFFFFFFFFFFFFFF, NFlag, 0x0000000000000000, ZCFlag}}, {{0x0000000000000001, NoFlag, 0x0000000000000002, NoFlag}, {0x0000000000000002, NoFlag, 0x0000000000000003, NoFlag}, - {0x7fffffffffffffff, NoFlag, 0x8000000000000000, NVFlag}, + {0x7FFFFFFFFFFFFFFF, NoFlag, 0x8000000000000000, NVFlag}, {0x8000000000000000, NVFlag, 0x8000000000000001, NVFlag}, {0x8000000000000001, NFlag, 0x8000000000000002, NFlag}, {0x8000000000000002, NFlag, 0x8000000000000003, NFlag}, - {0xffffffffffffffff, NFlag, 0x0000000000000000, ZCFlag}, + {0xFFFFFFFFFFFFFFFF, NFlag, 0x0000000000000000, ZCFlag}, {0x0000000000000000, ZCFlag, 0x0000000000000001, CFlag}}, - {{0x7ffffffffffffffe, NoFlag, 0x7fffffffffffffff, NoFlag}, - {0x7fffffffffffffff, NoFlag, 0x8000000000000000, NVFlag}, - {0xfffffffffffffffc, NVFlag, 0xfffffffffffffffd, NVFlag}, - {0xfffffffffffffffd, NVFlag, 0xfffffffffffffffe, NVFlag}, - {0xfffffffffffffffe, NFlag, 0xffffffffffffffff, NFlag}, - {0xffffffffffffffff, NFlag, 0x0000000000000000, ZCFlag}, - {0x7ffffffffffffffc, CFlag, 0x7ffffffffffffffd, CFlag}, - {0x7ffffffffffffffd, CFlag, 0x7ffffffffffffffe, CFlag}}, - {{0x7fffffffffffffff, NoFlag, 0x8000000000000000, NVFlag}, + {{0x7FFFFFFFFFFFFFFE, NoFlag, 0x7FFFFFFFFFFFFFFF, NoFlag}, + {0x7FFFFFFFFFFFFFFF, NoFlag, 0x8000000000000000, NVFlag}, + {0xFFFFFFFFFFFFFFFC, NVFlag, 0xFFFFFFFFFFFFFFFD, NVFlag}, + {0xFFFFFFFFFFFFFFFD, NVFlag, 0xFFFFFFFFFFFFFFFE, NVFlag}, + {0xFFFFFFFFFFFFFFFE, NFlag, 0xFFFFFFFFFFFFFFFF, NFlag}, + {0xFFFFFFFFFFFFFFFF, NFlag, 0x0000000000000000, ZCFlag}, + {0x7FFFFFFFFFFFFFFC, CFlag, 0x7FFFFFFFFFFFFFFD, CFlag}, + {0x7FFFFFFFFFFFFFFD, CFlag, 0x7FFFFFFFFFFFFFFE, CFlag}}, + {{0x7FFFFFFFFFFFFFFF, NoFlag, 0x8000000000000000, NVFlag}, {0x8000000000000000, NVFlag, 0x8000000000000001, NVFlag}, - {0xfffffffffffffffd, NVFlag, 0xfffffffffffffffe, NVFlag}, - {0xfffffffffffffffe, NVFlag, 0xffffffffffffffff, NVFlag}, - {0xffffffffffffffff, NFlag, 0x0000000000000000, ZCFlag}, + {0xFFFFFFFFFFFFFFFD, NVFlag, 0xFFFFFFFFFFFFFFFE, NVFlag}, + {0xFFFFFFFFFFFFFFFE, NVFlag, 0xFFFFFFFFFFFFFFFF, NVFlag}, + {0xFFFFFFFFFFFFFFFF, NFlag, 0x0000000000000000, ZCFlag}, {0x0000000000000000, ZCFlag, 0x0000000000000001, CFlag}, - {0x7ffffffffffffffd, CFlag, 0x7ffffffffffffffe, CFlag}, - {0x7ffffffffffffffe, CFlag, 0x7fffffffffffffff, CFlag}}, + {0x7FFFFFFFFFFFFFFD, CFlag, 0x7FFFFFFFFFFFFFFE, CFlag}, + {0x7FFFFFFFFFFFFFFE, CFlag, 0x7FFFFFFFFFFFFFFF, CFlag}}, {{0x8000000000000000, NFlag, 0x8000000000000001, NFlag}, {0x8000000000000001, NFlag, 0x8000000000000002, NFlag}, - {0xfffffffffffffffe, NFlag, 0xffffffffffffffff, NFlag}, - {0xffffffffffffffff, NFlag, 0x0000000000000000, ZCFlag}, + {0xFFFFFFFFFFFFFFFE, NFlag, 0xFFFFFFFFFFFFFFFF, NFlag}, + {0xFFFFFFFFFFFFFFFF, NFlag, 0x0000000000000000, ZCFlag}, {0x0000000000000000, ZCVFlag, 0x0000000000000001, CVFlag}, {0x0000000000000001, CVFlag, 0x0000000000000002, CVFlag}, - {0x7ffffffffffffffe, CVFlag, 0x7fffffffffffffff, CVFlag}, - {0x7fffffffffffffff, CVFlag, 0x8000000000000000, NCFlag}}, + {0x7FFFFFFFFFFFFFFE, CVFlag, 0x7FFFFFFFFFFFFFFF, CVFlag}, + {0x7FFFFFFFFFFFFFFF, CVFlag, 0x8000000000000000, NCFlag}}, {{0x8000000000000001, NFlag, 0x8000000000000002, NFlag}, {0x8000000000000002, NFlag, 0x8000000000000003, NFlag}, - {0xffffffffffffffff, NFlag, 0x0000000000000000, ZCFlag}, + {0xFFFFFFFFFFFFFFFF, NFlag, 0x0000000000000000, ZCFlag}, {0x0000000000000000, ZCFlag, 0x0000000000000001, CFlag}, {0x0000000000000001, CVFlag, 0x0000000000000002, CVFlag}, {0x0000000000000002, CVFlag, 0x0000000000000003, CVFlag}, - {0x7fffffffffffffff, CVFlag, 0x8000000000000000, NCFlag}, + {0x7FFFFFFFFFFFFFFF, CVFlag, 0x8000000000000000, NCFlag}, {0x8000000000000000, NCFlag, 0x8000000000000001, NCFlag}}, - {{0xfffffffffffffffe, NFlag, 0xffffffffffffffff, NFlag}, - {0xffffffffffffffff, NFlag, 0x0000000000000000, ZCFlag}, - {0x7ffffffffffffffc, CFlag, 0x7ffffffffffffffd, CFlag}, - {0x7ffffffffffffffd, CFlag, 0x7ffffffffffffffe, CFlag}, - {0x7ffffffffffffffe, CVFlag, 0x7fffffffffffffff, CVFlag}, - {0x7fffffffffffffff, CVFlag, 0x8000000000000000, NCFlag}, - {0xfffffffffffffffc, NCFlag, 0xfffffffffffffffd, NCFlag}, - {0xfffffffffffffffd, NCFlag, 0xfffffffffffffffe, NCFlag}}, - {{0xffffffffffffffff, NFlag, 0x0000000000000000, ZCFlag}, + {{0xFFFFFFFFFFFFFFFE, NFlag, 0xFFFFFFFFFFFFFFFF, NFlag}, + {0xFFFFFFFFFFFFFFFF, NFlag, 0x0000000000000000, ZCFlag}, + {0x7FFFFFFFFFFFFFFC, CFlag, 0x7FFFFFFFFFFFFFFD, CFlag}, + {0x7FFFFFFFFFFFFFFD, CFlag, 0x7FFFFFFFFFFFFFFE, CFlag}, + {0x7FFFFFFFFFFFFFFE, CVFlag, 0x7FFFFFFFFFFFFFFF, CVFlag}, + {0x7FFFFFFFFFFFFFFF, CVFlag, 0x8000000000000000, NCFlag}, + {0xFFFFFFFFFFFFFFFC, NCFlag, 0xFFFFFFFFFFFFFFFD, NCFlag}, + {0xFFFFFFFFFFFFFFFD, NCFlag, 0xFFFFFFFFFFFFFFFE, NCFlag}}, + {{0xFFFFFFFFFFFFFFFF, NFlag, 0x0000000000000000, ZCFlag}, {0x0000000000000000, ZCFlag, 0x0000000000000001, CFlag}, - {0x7ffffffffffffffd, CFlag, 0x7ffffffffffffffe, CFlag}, - {0x7ffffffffffffffe, CFlag, 0x7fffffffffffffff, CFlag}, - {0x7fffffffffffffff, CVFlag, 0x8000000000000000, NCFlag}, + {0x7FFFFFFFFFFFFFFD, CFlag, 0x7FFFFFFFFFFFFFFE, CFlag}, + {0x7FFFFFFFFFFFFFFE, CFlag, 0x7FFFFFFFFFFFFFFF, CFlag}, + {0x7FFFFFFFFFFFFFFF, CVFlag, 0x8000000000000000, NCFlag}, {0x8000000000000000, NCFlag, 0x8000000000000001, NCFlag}, - {0xfffffffffffffffd, NCFlag, 0xfffffffffffffffe, NCFlag}, - {0xfffffffffffffffe, NCFlag, 0xffffffffffffffff, NCFlag}}}; + {0xFFFFFFFFFFFFFFFD, NCFlag, 0xFFFFFFFFFFFFFFFE, NCFlag}, + {0xFFFFFFFFFFFFFFFE, NCFlag, 0xFFFFFFFFFFFFFFFF, NCFlag}}}; static const Expected expected_sbcs_x[input_count][input_count] = { - {{0xffffffffffffffff, NFlag, 0x0000000000000000, ZCFlag}, - {0xfffffffffffffffe, NFlag, 0xffffffffffffffff, NFlag}, + {{0xFFFFFFFFFFFFFFFF, NFlag, 0x0000000000000000, ZCFlag}, + {0xFFFFFFFFFFFFFFFE, NFlag, 0xFFFFFFFFFFFFFFFF, NFlag}, {0x8000000000000001, NFlag, 0x8000000000000002, NFlag}, {0x8000000000000000, NFlag, 0x8000000000000001, NFlag}, - {0x7fffffffffffffff, NoFlag, 0x8000000000000000, NVFlag}, - {0x7ffffffffffffffe, NoFlag, 0x7fffffffffffffff, NoFlag}, + {0x7FFFFFFFFFFFFFFF, NoFlag, 0x8000000000000000, NVFlag}, + {0x7FFFFFFFFFFFFFFE, NoFlag, 0x7FFFFFFFFFFFFFFF, NoFlag}, {0x0000000000000001, NoFlag, 0x0000000000000002, NoFlag}, {0x0000000000000000, ZFlag, 0x0000000000000001, NoFlag}}, {{0x0000000000000000, ZCFlag, 0x0000000000000001, CFlag}, - {0xffffffffffffffff, NFlag, 0x0000000000000000, ZCFlag}, + {0xFFFFFFFFFFFFFFFF, NFlag, 0x0000000000000000, ZCFlag}, {0x8000000000000002, NFlag, 0x8000000000000003, NFlag}, {0x8000000000000001, NFlag, 0x8000000000000002, NFlag}, {0x8000000000000000, NVFlag, 0x8000000000000001, NVFlag}, - {0x7fffffffffffffff, NoFlag, 0x8000000000000000, NVFlag}, + {0x7FFFFFFFFFFFFFFF, NoFlag, 0x8000000000000000, NVFlag}, {0x0000000000000002, NoFlag, 0x0000000000000003, NoFlag}, {0x0000000000000001, NoFlag, 0x0000000000000002, NoFlag}}, - {{0x7ffffffffffffffd, CFlag, 0x7ffffffffffffffe, CFlag}, - {0x7ffffffffffffffc, CFlag, 0x7ffffffffffffffd, CFlag}, - {0xffffffffffffffff, NFlag, 0x0000000000000000, ZCFlag}, - {0xfffffffffffffffe, NFlag, 0xffffffffffffffff, NFlag}, - {0xfffffffffffffffd, NVFlag, 0xfffffffffffffffe, NVFlag}, - {0xfffffffffffffffc, NVFlag, 0xfffffffffffffffd, NVFlag}, - {0x7fffffffffffffff, NoFlag, 0x8000000000000000, NVFlag}, - {0x7ffffffffffffffe, NoFlag, 0x7fffffffffffffff, NoFlag}}, - {{0x7ffffffffffffffe, CFlag, 0x7fffffffffffffff, CFlag}, - {0x7ffffffffffffffd, CFlag, 0x7ffffffffffffffe, CFlag}, + {{0x7FFFFFFFFFFFFFFD, CFlag, 0x7FFFFFFFFFFFFFFE, CFlag}, + {0x7FFFFFFFFFFFFFFC, CFlag, 0x7FFFFFFFFFFFFFFD, CFlag}, + {0xFFFFFFFFFFFFFFFF, NFlag, 0x0000000000000000, ZCFlag}, + {0xFFFFFFFFFFFFFFFE, NFlag, 0xFFFFFFFFFFFFFFFF, NFlag}, + {0xFFFFFFFFFFFFFFFD, NVFlag, 0xFFFFFFFFFFFFFFFE, NVFlag}, + {0xFFFFFFFFFFFFFFFC, NVFlag, 0xFFFFFFFFFFFFFFFD, NVFlag}, + {0x7FFFFFFFFFFFFFFF, NoFlag, 0x8000000000000000, NVFlag}, + {0x7FFFFFFFFFFFFFFE, NoFlag, 0x7FFFFFFFFFFFFFFF, NoFlag}}, + {{0x7FFFFFFFFFFFFFFE, CFlag, 0x7FFFFFFFFFFFFFFF, CFlag}, + {0x7FFFFFFFFFFFFFFD, CFlag, 0x7FFFFFFFFFFFFFFE, CFlag}, {0x0000000000000000, ZCFlag, 0x0000000000000001, CFlag}, - {0xffffffffffffffff, NFlag, 0x0000000000000000, ZCFlag}, - {0xfffffffffffffffe, NVFlag, 0xffffffffffffffff, NVFlag}, - {0xfffffffffffffffd, NVFlag, 0xfffffffffffffffe, NVFlag}, + {0xFFFFFFFFFFFFFFFF, NFlag, 0x0000000000000000, ZCFlag}, + {0xFFFFFFFFFFFFFFFE, NVFlag, 0xFFFFFFFFFFFFFFFF, NVFlag}, + {0xFFFFFFFFFFFFFFFD, NVFlag, 0xFFFFFFFFFFFFFFFE, NVFlag}, {0x8000000000000000, NVFlag, 0x8000000000000001, NVFlag}, - {0x7fffffffffffffff, NoFlag, 0x8000000000000000, NVFlag}}, - {{0x7fffffffffffffff, CVFlag, 0x8000000000000000, NCFlag}, - {0x7ffffffffffffffe, CVFlag, 0x7fffffffffffffff, CVFlag}, + {0x7FFFFFFFFFFFFFFF, NoFlag, 0x8000000000000000, NVFlag}}, + {{0x7FFFFFFFFFFFFFFF, CVFlag, 0x8000000000000000, NCFlag}, + {0x7FFFFFFFFFFFFFFE, CVFlag, 0x7FFFFFFFFFFFFFFF, CVFlag}, {0x0000000000000001, CVFlag, 0x0000000000000002, CVFlag}, {0x0000000000000000, ZCVFlag, 0x0000000000000001, CVFlag}, - {0xffffffffffffffff, NFlag, 0x0000000000000000, ZCFlag}, - {0xfffffffffffffffe, NFlag, 0xffffffffffffffff, NFlag}, + {0xFFFFFFFFFFFFFFFF, NFlag, 0x0000000000000000, ZCFlag}, + {0xFFFFFFFFFFFFFFFE, NFlag, 0xFFFFFFFFFFFFFFFF, NFlag}, {0x8000000000000001, NFlag, 0x8000000000000002, NFlag}, {0x8000000000000000, NFlag, 0x8000000000000001, NFlag}}, {{0x8000000000000000, NCFlag, 0x8000000000000001, NCFlag}, - {0x7fffffffffffffff, CVFlag, 0x8000000000000000, NCFlag}, + {0x7FFFFFFFFFFFFFFF, CVFlag, 0x8000000000000000, NCFlag}, {0x0000000000000002, CVFlag, 0x0000000000000003, CVFlag}, {0x0000000000000001, CVFlag, 0x0000000000000002, CVFlag}, {0x0000000000000000, ZCFlag, 0x0000000000000001, CFlag}, - {0xffffffffffffffff, NFlag, 0x0000000000000000, ZCFlag}, + {0xFFFFFFFFFFFFFFFF, NFlag, 0x0000000000000000, ZCFlag}, {0x8000000000000002, NFlag, 0x8000000000000003, NFlag}, {0x8000000000000001, NFlag, 0x8000000000000002, NFlag}}, - {{0xfffffffffffffffd, NCFlag, 0xfffffffffffffffe, NCFlag}, - {0xfffffffffffffffc, NCFlag, 0xfffffffffffffffd, NCFlag}, - {0x7fffffffffffffff, CVFlag, 0x8000000000000000, NCFlag}, - {0x7ffffffffffffffe, CVFlag, 0x7fffffffffffffff, CVFlag}, - {0x7ffffffffffffffd, CFlag, 0x7ffffffffffffffe, CFlag}, - {0x7ffffffffffffffc, CFlag, 0x7ffffffffffffffd, CFlag}, - {0xffffffffffffffff, NFlag, 0x0000000000000000, ZCFlag}, - {0xfffffffffffffffe, NFlag, 0xffffffffffffffff, NFlag}}, - {{0xfffffffffffffffe, NCFlag, 0xffffffffffffffff, NCFlag}, - {0xfffffffffffffffd, NCFlag, 0xfffffffffffffffe, NCFlag}, + {{0xFFFFFFFFFFFFFFFD, NCFlag, 0xFFFFFFFFFFFFFFFE, NCFlag}, + {0xFFFFFFFFFFFFFFFC, NCFlag, 0xFFFFFFFFFFFFFFFD, NCFlag}, + {0x7FFFFFFFFFFFFFFF, CVFlag, 0x8000000000000000, NCFlag}, + {0x7FFFFFFFFFFFFFFE, CVFlag, 0x7FFFFFFFFFFFFFFF, CVFlag}, + {0x7FFFFFFFFFFFFFFD, CFlag, 0x7FFFFFFFFFFFFFFE, CFlag}, + {0x7FFFFFFFFFFFFFFC, CFlag, 0x7FFFFFFFFFFFFFFD, CFlag}, + {0xFFFFFFFFFFFFFFFF, NFlag, 0x0000000000000000, ZCFlag}, + {0xFFFFFFFFFFFFFFFE, NFlag, 0xFFFFFFFFFFFFFFFF, NFlag}}, + {{0xFFFFFFFFFFFFFFFE, NCFlag, 0xFFFFFFFFFFFFFFFF, NCFlag}, + {0xFFFFFFFFFFFFFFFD, NCFlag, 0xFFFFFFFFFFFFFFFE, NCFlag}, {0x8000000000000000, NCFlag, 0x8000000000000001, NCFlag}, - {0x7fffffffffffffff, CVFlag, 0x8000000000000000, NCFlag}, - {0x7ffffffffffffffe, CFlag, 0x7fffffffffffffff, CFlag}, - {0x7ffffffffffffffd, CFlag, 0x7ffffffffffffffe, CFlag}, + {0x7FFFFFFFFFFFFFFF, CVFlag, 0x8000000000000000, NCFlag}, + {0x7FFFFFFFFFFFFFFE, CFlag, 0x7FFFFFFFFFFFFFFF, CFlag}, + {0x7FFFFFFFFFFFFFFD, CFlag, 0x7FFFFFFFFFFFFFFE, CFlag}, {0x0000000000000000, ZCFlag, 0x0000000000000001, CFlag}, - {0xffffffffffffffff, NFlag, 0x0000000000000000, ZCFlag}}}; + {0xFFFFFFFFFFFFFFFF, NFlag, 0x0000000000000000, ZCFlag}}}; for (size_t left = 0; left < input_count; left++) { for (size_t right = 0; right < input_count; right++) { @@ -7507,8 +7501,8 @@ TEST(adcs_sbcs_x) { TEST(adcs_sbcs_w) { INIT_V8(); uint32_t inputs[] = { - 0x00000000, 0x00000001, 0x7ffffffe, 0x7fffffff, - 0x80000000, 0x80000001, 0xfffffffe, 0xffffffff, + 0x00000000, 0x00000001, 0x7FFFFFFE, 0x7FFFFFFF, + 0x80000000, 0x80000001, 0xFFFFFFFE, 0xFFFFFFFF, }; static const size_t input_count = sizeof(inputs) / sizeof(inputs[0]); @@ -7522,134 +7516,134 @@ TEST(adcs_sbcs_w) { static const Expected expected_adcs_w[input_count][input_count] = { {{0x00000000, ZFlag, 0x00000001, NoFlag}, {0x00000001, NoFlag, 0x00000002, NoFlag}, - {0x7ffffffe, NoFlag, 0x7fffffff, NoFlag}, - {0x7fffffff, NoFlag, 0x80000000, NVFlag}, + {0x7FFFFFFE, NoFlag, 0x7FFFFFFF, NoFlag}, + {0x7FFFFFFF, NoFlag, 0x80000000, NVFlag}, {0x80000000, NFlag, 0x80000001, NFlag}, {0x80000001, NFlag, 0x80000002, NFlag}, - {0xfffffffe, NFlag, 0xffffffff, NFlag}, - {0xffffffff, NFlag, 0x00000000, ZCFlag}}, + {0xFFFFFFFE, NFlag, 0xFFFFFFFF, NFlag}, + {0xFFFFFFFF, NFlag, 0x00000000, ZCFlag}}, {{0x00000001, NoFlag, 0x00000002, NoFlag}, {0x00000002, NoFlag, 0x00000003, NoFlag}, - {0x7fffffff, NoFlag, 0x80000000, NVFlag}, + {0x7FFFFFFF, NoFlag, 0x80000000, NVFlag}, {0x80000000, NVFlag, 0x80000001, NVFlag}, {0x80000001, NFlag, 0x80000002, NFlag}, {0x80000002, NFlag, 0x80000003, NFlag}, - {0xffffffff, NFlag, 0x00000000, ZCFlag}, + {0xFFFFFFFF, NFlag, 0x00000000, ZCFlag}, {0x00000000, ZCFlag, 0x00000001, CFlag}}, - {{0x7ffffffe, NoFlag, 0x7fffffff, NoFlag}, - {0x7fffffff, NoFlag, 0x80000000, NVFlag}, - {0xfffffffc, NVFlag, 0xfffffffd, NVFlag}, - {0xfffffffd, NVFlag, 0xfffffffe, NVFlag}, - {0xfffffffe, NFlag, 0xffffffff, NFlag}, - {0xffffffff, NFlag, 0x00000000, ZCFlag}, - {0x7ffffffc, CFlag, 0x7ffffffd, CFlag}, - {0x7ffffffd, CFlag, 0x7ffffffe, CFlag}}, - {{0x7fffffff, NoFlag, 0x80000000, NVFlag}, + {{0x7FFFFFFE, NoFlag, 0x7FFFFFFF, NoFlag}, + {0x7FFFFFFF, NoFlag, 0x80000000, NVFlag}, + {0xFFFFFFFC, NVFlag, 0xFFFFFFFD, NVFlag}, + {0xFFFFFFFD, NVFlag, 0xFFFFFFFE, NVFlag}, + {0xFFFFFFFE, NFlag, 0xFFFFFFFF, NFlag}, + {0xFFFFFFFF, NFlag, 0x00000000, ZCFlag}, + {0x7FFFFFFC, CFlag, 0x7FFFFFFD, CFlag}, + {0x7FFFFFFD, CFlag, 0x7FFFFFFE, CFlag}}, + {{0x7FFFFFFF, NoFlag, 0x80000000, NVFlag}, {0x80000000, NVFlag, 0x80000001, NVFlag}, - {0xfffffffd, NVFlag, 0xfffffffe, NVFlag}, - {0xfffffffe, NVFlag, 0xffffffff, NVFlag}, - {0xffffffff, NFlag, 0x00000000, ZCFlag}, + {0xFFFFFFFD, NVFlag, 0xFFFFFFFE, NVFlag}, + {0xFFFFFFFE, NVFlag, 0xFFFFFFFF, NVFlag}, + {0xFFFFFFFF, NFlag, 0x00000000, ZCFlag}, {0x00000000, ZCFlag, 0x00000001, CFlag}, - {0x7ffffffd, CFlag, 0x7ffffffe, CFlag}, - {0x7ffffffe, CFlag, 0x7fffffff, CFlag}}, + {0x7FFFFFFD, CFlag, 0x7FFFFFFE, CFlag}, + {0x7FFFFFFE, CFlag, 0x7FFFFFFF, CFlag}}, {{0x80000000, NFlag, 0x80000001, NFlag}, {0x80000001, NFlag, 0x80000002, NFlag}, - {0xfffffffe, NFlag, 0xffffffff, NFlag}, - {0xffffffff, NFlag, 0x00000000, ZCFlag}, + {0xFFFFFFFE, NFlag, 0xFFFFFFFF, NFlag}, + {0xFFFFFFFF, NFlag, 0x00000000, ZCFlag}, {0x00000000, ZCVFlag, 0x00000001, CVFlag}, {0x00000001, CVFlag, 0x00000002, CVFlag}, - {0x7ffffffe, CVFlag, 0x7fffffff, CVFlag}, - {0x7fffffff, CVFlag, 0x80000000, NCFlag}}, + {0x7FFFFFFE, CVFlag, 0x7FFFFFFF, CVFlag}, + {0x7FFFFFFF, CVFlag, 0x80000000, NCFlag}}, {{0x80000001, NFlag, 0x80000002, NFlag}, {0x80000002, NFlag, 0x80000003, NFlag}, - {0xffffffff, NFlag, 0x00000000, ZCFlag}, + {0xFFFFFFFF, NFlag, 0x00000000, ZCFlag}, {0x00000000, ZCFlag, 0x00000001, CFlag}, {0x00000001, CVFlag, 0x00000002, CVFlag}, {0x00000002, CVFlag, 0x00000003, CVFlag}, - {0x7fffffff, CVFlag, 0x80000000, NCFlag}, + {0x7FFFFFFF, CVFlag, 0x80000000, NCFlag}, {0x80000000, NCFlag, 0x80000001, NCFlag}}, - {{0xfffffffe, NFlag, 0xffffffff, NFlag}, - {0xffffffff, NFlag, 0x00000000, ZCFlag}, - {0x7ffffffc, CFlag, 0x7ffffffd, CFlag}, - {0x7ffffffd, CFlag, 0x7ffffffe, CFlag}, - {0x7ffffffe, CVFlag, 0x7fffffff, CVFlag}, - {0x7fffffff, CVFlag, 0x80000000, NCFlag}, - {0xfffffffc, NCFlag, 0xfffffffd, NCFlag}, - {0xfffffffd, NCFlag, 0xfffffffe, NCFlag}}, - {{0xffffffff, NFlag, 0x00000000, ZCFlag}, + {{0xFFFFFFFE, NFlag, 0xFFFFFFFF, NFlag}, + {0xFFFFFFFF, NFlag, 0x00000000, ZCFlag}, + {0x7FFFFFFC, CFlag, 0x7FFFFFFD, CFlag}, + {0x7FFFFFFD, CFlag, 0x7FFFFFFE, CFlag}, + {0x7FFFFFFE, CVFlag, 0x7FFFFFFF, CVFlag}, + {0x7FFFFFFF, CVFlag, 0x80000000, NCFlag}, + {0xFFFFFFFC, NCFlag, 0xFFFFFFFD, NCFlag}, + {0xFFFFFFFD, NCFlag, 0xFFFFFFFE, NCFlag}}, + {{0xFFFFFFFF, NFlag, 0x00000000, ZCFlag}, {0x00000000, ZCFlag, 0x00000001, CFlag}, - {0x7ffffffd, CFlag, 0x7ffffffe, CFlag}, - {0x7ffffffe, CFlag, 0x7fffffff, CFlag}, - {0x7fffffff, CVFlag, 0x80000000, NCFlag}, + {0x7FFFFFFD, CFlag, 0x7FFFFFFE, CFlag}, + {0x7FFFFFFE, CFlag, 0x7FFFFFFF, CFlag}, + {0x7FFFFFFF, CVFlag, 0x80000000, NCFlag}, {0x80000000, NCFlag, 0x80000001, NCFlag}, - {0xfffffffd, NCFlag, 0xfffffffe, NCFlag}, - {0xfffffffe, NCFlag, 0xffffffff, NCFlag}}}; + {0xFFFFFFFD, NCFlag, 0xFFFFFFFE, NCFlag}, + {0xFFFFFFFE, NCFlag, 0xFFFFFFFF, NCFlag}}}; static const Expected expected_sbcs_w[input_count][input_count] = { - {{0xffffffff, NFlag, 0x00000000, ZCFlag}, - {0xfffffffe, NFlag, 0xffffffff, NFlag}, + {{0xFFFFFFFF, NFlag, 0x00000000, ZCFlag}, + {0xFFFFFFFE, NFlag, 0xFFFFFFFF, NFlag}, {0x80000001, NFlag, 0x80000002, NFlag}, {0x80000000, NFlag, 0x80000001, NFlag}, - {0x7fffffff, NoFlag, 0x80000000, NVFlag}, - {0x7ffffffe, NoFlag, 0x7fffffff, NoFlag}, + {0x7FFFFFFF, NoFlag, 0x80000000, NVFlag}, + {0x7FFFFFFE, NoFlag, 0x7FFFFFFF, NoFlag}, {0x00000001, NoFlag, 0x00000002, NoFlag}, {0x00000000, ZFlag, 0x00000001, NoFlag}}, {{0x00000000, ZCFlag, 0x00000001, CFlag}, - {0xffffffff, NFlag, 0x00000000, ZCFlag}, + {0xFFFFFFFF, NFlag, 0x00000000, ZCFlag}, {0x80000002, NFlag, 0x80000003, NFlag}, {0x80000001, NFlag, 0x80000002, NFlag}, {0x80000000, NVFlag, 0x80000001, NVFlag}, - {0x7fffffff, NoFlag, 0x80000000, NVFlag}, + {0x7FFFFFFF, NoFlag, 0x80000000, NVFlag}, {0x00000002, NoFlag, 0x00000003, NoFlag}, {0x00000001, NoFlag, 0x00000002, NoFlag}}, - {{0x7ffffffd, CFlag, 0x7ffffffe, CFlag}, - {0x7ffffffc, CFlag, 0x7ffffffd, CFlag}, - {0xffffffff, NFlag, 0x00000000, ZCFlag}, - {0xfffffffe, NFlag, 0xffffffff, NFlag}, - {0xfffffffd, NVFlag, 0xfffffffe, NVFlag}, - {0xfffffffc, NVFlag, 0xfffffffd, NVFlag}, - {0x7fffffff, NoFlag, 0x80000000, NVFlag}, - {0x7ffffffe, NoFlag, 0x7fffffff, NoFlag}}, - {{0x7ffffffe, CFlag, 0x7fffffff, CFlag}, - {0x7ffffffd, CFlag, 0x7ffffffe, CFlag}, + {{0x7FFFFFFD, CFlag, 0x7FFFFFFE, CFlag}, + {0x7FFFFFFC, CFlag, 0x7FFFFFFD, CFlag}, + {0xFFFFFFFF, NFlag, 0x00000000, ZCFlag}, + {0xFFFFFFFE, NFlag, 0xFFFFFFFF, NFlag}, + {0xFFFFFFFD, NVFlag, 0xFFFFFFFE, NVFlag}, + {0xFFFFFFFC, NVFlag, 0xFFFFFFFD, NVFlag}, + {0x7FFFFFFF, NoFlag, 0x80000000, NVFlag}, + {0x7FFFFFFE, NoFlag, 0x7FFFFFFF, NoFlag}}, + {{0x7FFFFFFE, CFlag, 0x7FFFFFFF, CFlag}, + {0x7FFFFFFD, CFlag, 0x7FFFFFFE, CFlag}, {0x00000000, ZCFlag, 0x00000001, CFlag}, - {0xffffffff, NFlag, 0x00000000, ZCFlag}, - {0xfffffffe, NVFlag, 0xffffffff, NVFlag}, - {0xfffffffd, NVFlag, 0xfffffffe, NVFlag}, + {0xFFFFFFFF, NFlag, 0x00000000, ZCFlag}, + {0xFFFFFFFE, NVFlag, 0xFFFFFFFF, NVFlag}, + {0xFFFFFFFD, NVFlag, 0xFFFFFFFE, NVFlag}, {0x80000000, NVFlag, 0x80000001, NVFlag}, - {0x7fffffff, NoFlag, 0x80000000, NVFlag}}, - {{0x7fffffff, CVFlag, 0x80000000, NCFlag}, - {0x7ffffffe, CVFlag, 0x7fffffff, CVFlag}, + {0x7FFFFFFF, NoFlag, 0x80000000, NVFlag}}, + {{0x7FFFFFFF, CVFlag, 0x80000000, NCFlag}, + {0x7FFFFFFE, CVFlag, 0x7FFFFFFF, CVFlag}, {0x00000001, CVFlag, 0x00000002, CVFlag}, {0x00000000, ZCVFlag, 0x00000001, CVFlag}, - {0xffffffff, NFlag, 0x00000000, ZCFlag}, - {0xfffffffe, NFlag, 0xffffffff, NFlag}, + {0xFFFFFFFF, NFlag, 0x00000000, ZCFlag}, + {0xFFFFFFFE, NFlag, 0xFFFFFFFF, NFlag}, {0x80000001, NFlag, 0x80000002, NFlag}, {0x80000000, NFlag, 0x80000001, NFlag}}, {{0x80000000, NCFlag, 0x80000001, NCFlag}, - {0x7fffffff, CVFlag, 0x80000000, NCFlag}, + {0x7FFFFFFF, CVFlag, 0x80000000, NCFlag}, {0x00000002, CVFlag, 0x00000003, CVFlag}, {0x00000001, CVFlag, 0x00000002, CVFlag}, {0x00000000, ZCFlag, 0x00000001, CFlag}, - {0xffffffff, NFlag, 0x00000000, ZCFlag}, + {0xFFFFFFFF, NFlag, 0x00000000, ZCFlag}, {0x80000002, NFlag, 0x80000003, NFlag}, {0x80000001, NFlag, 0x80000002, NFlag}}, - {{0xfffffffd, NCFlag, 0xfffffffe, NCFlag}, - {0xfffffffc, NCFlag, 0xfffffffd, NCFlag}, - {0x7fffffff, CVFlag, 0x80000000, NCFlag}, - {0x7ffffffe, CVFlag, 0x7fffffff, CVFlag}, - {0x7ffffffd, CFlag, 0x7ffffffe, CFlag}, - {0x7ffffffc, CFlag, 0x7ffffffd, CFlag}, - {0xffffffff, NFlag, 0x00000000, ZCFlag}, - {0xfffffffe, NFlag, 0xffffffff, NFlag}}, - {{0xfffffffe, NCFlag, 0xffffffff, NCFlag}, - {0xfffffffd, NCFlag, 0xfffffffe, NCFlag}, + {{0xFFFFFFFD, NCFlag, 0xFFFFFFFE, NCFlag}, + {0xFFFFFFFC, NCFlag, 0xFFFFFFFD, NCFlag}, + {0x7FFFFFFF, CVFlag, 0x80000000, NCFlag}, + {0x7FFFFFFE, CVFlag, 0x7FFFFFFF, CVFlag}, + {0x7FFFFFFD, CFlag, 0x7FFFFFFE, CFlag}, + {0x7FFFFFFC, CFlag, 0x7FFFFFFD, CFlag}, + {0xFFFFFFFF, NFlag, 0x00000000, ZCFlag}, + {0xFFFFFFFE, NFlag, 0xFFFFFFFF, NFlag}}, + {{0xFFFFFFFE, NCFlag, 0xFFFFFFFF, NCFlag}, + {0xFFFFFFFD, NCFlag, 0xFFFFFFFE, NCFlag}, {0x80000000, NCFlag, 0x80000001, NCFlag}, - {0x7fffffff, CVFlag, 0x80000000, NCFlag}, - {0x7ffffffe, CFlag, 0x7fffffff, CFlag}, - {0x7ffffffd, CFlag, 0x7ffffffe, CFlag}, + {0x7FFFFFFF, CVFlag, 0x80000000, NCFlag}, + {0x7FFFFFFE, CFlag, 0x7FFFFFFF, CFlag}, + {0x7FFFFFFD, CFlag, 0x7FFFFFFE, CFlag}, {0x00000000, ZCFlag, 0x00000001, CFlag}, - {0xffffffff, NFlag, 0x00000000, ZCFlag}}}; + {0xFFFFFFFF, NFlag, 0x00000000, ZCFlag}}}; for (size_t left = 0; left < input_count; left++) { for (size_t right = 0; right < input_count; right++) { @@ -7680,9 +7674,9 @@ TEST(adc_sbc_shift) { START(); __ Mov(x0, 0); __ Mov(x1, 1); - __ Mov(x2, 0x0123456789abcdefL); - __ Mov(x3, 0xfedcba9876543210L); - __ Mov(x4, 0xffffffffffffffffL); + __ Mov(x2, 0x0123456789ABCDEFL); + __ Mov(x3, 0xFEDCBA9876543210L); + __ Mov(x4, 0xFFFFFFFFFFFFFFFFL); // Clear the C flag. __ Adds(x0, x0, Operand(0)); @@ -7717,29 +7711,29 @@ TEST(adc_sbc_shift) { RUN(); - CHECK_EQUAL_64(0xffffffffffffffffL, x5); + CHECK_EQUAL_64(0xFFFFFFFFFFFFFFFFL, x5); CHECK_EQUAL_64(1L << 60, x6); - CHECK_EQUAL_64(0xf0123456789abcddL, x7); + CHECK_EQUAL_64(0xF0123456789ABCDDL, x7); CHECK_EQUAL_64(0x0111111111111110L, x8); CHECK_EQUAL_64(0x1222222222222221L, x9); - CHECK_EQUAL_32(0xffffffff, w10); + CHECK_EQUAL_32(0xFFFFFFFF, w10); CHECK_EQUAL_32(1 << 30, w11); - CHECK_EQUAL_32(0xf89abcdd, w12); + CHECK_EQUAL_32(0xF89ABCDD, w12); CHECK_EQUAL_32(0x91111110, w13); - CHECK_EQUAL_32(0x9a222221, w14); + CHECK_EQUAL_32(0x9A222221, w14); - CHECK_EQUAL_64(0xffffffffffffffffL + 1, x18); + CHECK_EQUAL_64(0xFFFFFFFFFFFFFFFFL + 1, x18); CHECK_EQUAL_64((1L << 60) + 1, x19); - CHECK_EQUAL_64(0xf0123456789abcddL + 1, x20); + CHECK_EQUAL_64(0xF0123456789ABCDDL + 1, x20); CHECK_EQUAL_64(0x0111111111111110L + 1, x21); CHECK_EQUAL_64(0x1222222222222221L + 1, x22); - CHECK_EQUAL_32(0xffffffff + 1, w23); + CHECK_EQUAL_32(0xFFFFFFFF + 1, w23); CHECK_EQUAL_32((1 << 30) + 1, w24); - CHECK_EQUAL_32(0xf89abcdd + 1, w25); + CHECK_EQUAL_32(0xF89ABCDD + 1, w25); CHECK_EQUAL_32(0x91111110 + 1, w26); - CHECK_EQUAL_32(0x9a222221 + 1, w27); + CHECK_EQUAL_32(0x9A222221 + 1, w27); TEARDOWN(); } @@ -7755,7 +7749,7 @@ TEST(adc_sbc_extend) { __ Mov(x0, 0); __ Mov(x1, 1); - __ Mov(x2, 0x0123456789abcdefL); + __ Mov(x2, 0x0123456789ABCDEFL); __ Adc(x10, x1, Operand(w2, UXTB, 1)); __ Adc(x11, x1, Operand(x2, SXTH, 2)); @@ -7781,28 +7775,28 @@ TEST(adc_sbc_extend) { RUN(); - CHECK_EQUAL_64(0x1df, x10); - CHECK_EQUAL_64(0xffffffffffff37bdL, x11); - CHECK_EQUAL_64(0xfffffff765432110L, x12); - CHECK_EQUAL_64(0x123456789abcdef1L, x13); + CHECK_EQUAL_64(0x1DF, x10); + CHECK_EQUAL_64(0xFFFFFFFFFFFF37BDL, x11); + CHECK_EQUAL_64(0xFFFFFFF765432110L, x12); + CHECK_EQUAL_64(0x123456789ABCDEF1L, x13); - CHECK_EQUAL_32(0x1df, w14); - CHECK_EQUAL_32(0xffff37bd, w15); - CHECK_EQUAL_32(0x9abcdef1, w9); + CHECK_EQUAL_32(0x1DF, w14); + CHECK_EQUAL_32(0xFFFF37BD, w15); + CHECK_EQUAL_32(0x9ABCDEF1, w9); - CHECK_EQUAL_64(0x1df + 1, x20); - CHECK_EQUAL_64(0xffffffffffff37bdL + 1, x21); - CHECK_EQUAL_64(0xfffffff765432110L + 1, x22); - CHECK_EQUAL_64(0x123456789abcdef1L + 1, x23); + CHECK_EQUAL_64(0x1DF + 1, x20); + CHECK_EQUAL_64(0xFFFFFFFFFFFF37BDL + 1, x21); + CHECK_EQUAL_64(0xFFFFFFF765432110L + 1, x22); + CHECK_EQUAL_64(0x123456789ABCDEF1L + 1, x23); - CHECK_EQUAL_32(0x1df + 1, w24); - CHECK_EQUAL_32(0xffff37bd + 1, w25); - CHECK_EQUAL_32(0x9abcdef1 + 1, w26); + CHECK_EQUAL_32(0x1DF + 1, w24); + CHECK_EQUAL_32(0xFFFF37BD + 1, w25); + CHECK_EQUAL_32(0x9ABCDEF1 + 1, w26); // Check that adc correctly sets the condition flags. START(); - __ Mov(x0, 0xff); - __ Mov(x1, 0xffffffffffffffffL); + __ Mov(x0, 0xFF); + __ Mov(x1, 0xFFFFFFFFFFFFFFFFL); // Clear the C flag. __ Adds(x0, x0, Operand(0)); __ Adcs(x10, x0, Operand(x1, SXTX, 1)); @@ -7813,7 +7807,7 @@ TEST(adc_sbc_extend) { CHECK_EQUAL_NZCV(CFlag); START(); - __ Mov(x0, 0x7fffffffffffffffL); + __ Mov(x0, 0x7FFFFFFFFFFFFFFFL); __ Mov(x1, 1); // Clear the C flag. __ Adds(x0, x0, Operand(0)); @@ -7825,7 +7819,7 @@ TEST(adc_sbc_extend) { CHECK_EQUAL_NZCV(NVFlag); START(); - __ Mov(x0, 0x7fffffffffffffffL); + __ Mov(x0, 0x7FFFFFFFFFFFFFFFL); // Clear the C flag. __ Adds(x0, x0, Operand(0)); __ Adcs(x10, x0, Operand(1)); @@ -7849,36 +7843,36 @@ TEST(adc_sbc_wide_imm) { // Clear the C flag. __ Adds(x0, x0, Operand(0)); - __ Adc(x7, x0, Operand(0x1234567890abcdefUL)); - __ Adc(w8, w0, Operand(0xffffffff)); - __ Sbc(x9, x0, Operand(0x1234567890abcdefUL)); - __ Sbc(w10, w0, Operand(0xffffffff)); - __ Ngc(x11, Operand(0xffffffff00000000UL)); - __ Ngc(w12, Operand(0xffff0000)); + __ Adc(x7, x0, Operand(0x1234567890ABCDEFUL)); + __ Adc(w8, w0, Operand(0xFFFFFFFF)); + __ Sbc(x9, x0, Operand(0x1234567890ABCDEFUL)); + __ Sbc(w10, w0, Operand(0xFFFFFFFF)); + __ Ngc(x11, Operand(0xFFFFFFFF00000000UL)); + __ Ngc(w12, Operand(0xFFFF0000)); // Set the C flag. __ Cmp(w0, Operand(w0)); - __ Adc(x18, x0, Operand(0x1234567890abcdefUL)); - __ Adc(w19, w0, Operand(0xffffffff)); - __ Sbc(x20, x0, Operand(0x1234567890abcdefUL)); - __ Sbc(w21, w0, Operand(0xffffffff)); - __ Ngc(x22, Operand(0xffffffff00000000UL)); - __ Ngc(w23, Operand(0xffff0000)); + __ Adc(x18, x0, Operand(0x1234567890ABCDEFUL)); + __ Adc(w19, w0, Operand(0xFFFFFFFF)); + __ Sbc(x20, x0, Operand(0x1234567890ABCDEFUL)); + __ Sbc(w21, w0, Operand(0xFFFFFFFF)); + __ Ngc(x22, Operand(0xFFFFFFFF00000000UL)); + __ Ngc(w23, Operand(0xFFFF0000)); END(); RUN(); - CHECK_EQUAL_64(0x1234567890abcdefUL, x7); - CHECK_EQUAL_64(0xffffffff, x8); - CHECK_EQUAL_64(0xedcba9876f543210UL, x9); + CHECK_EQUAL_64(0x1234567890ABCDEFUL, x7); + CHECK_EQUAL_64(0xFFFFFFFF, x8); + CHECK_EQUAL_64(0xEDCBA9876F543210UL, x9); CHECK_EQUAL_64(0, x10); - CHECK_EQUAL_64(0xffffffff, x11); - CHECK_EQUAL_64(0xffff, x12); + CHECK_EQUAL_64(0xFFFFFFFF, x11); + CHECK_EQUAL_64(0xFFFF, x12); - CHECK_EQUAL_64(0x1234567890abcdefUL + 1, x18); + CHECK_EQUAL_64(0x1234567890ABCDEFUL + 1, x18); CHECK_EQUAL_64(0, x19); - CHECK_EQUAL_64(0xedcba9876f543211UL, x20); + CHECK_EQUAL_64(0xEDCBA9876F543211UL, x20); CHECK_EQUAL_64(1, x21); CHECK_EQUAL_64(0x100000000UL, x22); CHECK_EQUAL_64(0x10000, x23); @@ -7971,7 +7965,7 @@ TEST(flags) { START(); __ Mov(x0, 1); - __ Mov(x1, 0x7fffffffffffffffL); + __ Mov(x1, 0x7FFFFFFFFFFFFFFFL); __ Cmn(x1, Operand(x0)); END(); @@ -7981,7 +7975,7 @@ TEST(flags) { START(); __ Mov(w0, 1); - __ Mov(w1, 0x7fffffff); + __ Mov(w1, 0x7FFFFFFF); __ Cmn(w1, Operand(w0)); END(); @@ -7991,7 +7985,7 @@ TEST(flags) { START(); __ Mov(x0, 1); - __ Mov(x1, 0xffffffffffffffffL); + __ Mov(x1, 0xFFFFFFFFFFFFFFFFL); __ Cmn(x1, Operand(x0)); END(); @@ -8001,7 +7995,7 @@ TEST(flags) { START(); __ Mov(w0, 1); - __ Mov(w1, 0xffffffff); + __ Mov(w1, 0xFFFFFFFF); __ Cmn(w1, Operand(w0)); END(); @@ -8042,16 +8036,16 @@ TEST(cmp_shift) { SETUP(); START(); - __ Mov(x18, 0xf0000000); - __ Mov(x19, 0xf000000010000000UL); - __ Mov(x20, 0xf0000000f0000000UL); + __ Mov(x18, 0xF0000000); + __ Mov(x19, 0xF000000010000000UL); + __ Mov(x20, 0xF0000000F0000000UL); __ Mov(x21, 0x7800000078000000UL); - __ Mov(x22, 0x3c0000003c000000UL); + __ Mov(x22, 0x3C0000003C000000UL); __ Mov(x23, 0x8000000780000000UL); - __ Mov(x24, 0x0000000f00000000UL); - __ Mov(x25, 0x00000003c0000000UL); + __ Mov(x24, 0x0000000F00000000UL); + __ Mov(x25, 0x00000003C0000000UL); __ Mov(x26, 0x8000000780000000UL); - __ Mov(x27, 0xc0000003); + __ Mov(x27, 0xC0000003); __ Cmp(w20, Operand(w21, LSL, 1)); __ Mrs(x0, NZCV); @@ -8100,11 +8094,11 @@ TEST(cmp_extend) { START(); __ Mov(w20, 0x2); __ Mov(w21, 0x1); - __ Mov(x22, 0xffffffffffffffffUL); - __ Mov(x23, 0xff); - __ Mov(x24, 0xfffffffffffffffeUL); - __ Mov(x25, 0xffff); - __ Mov(x26, 0xffffffff); + __ Mov(x22, 0xFFFFFFFFFFFFFFFFUL); + __ Mov(x23, 0xFF); + __ Mov(x24, 0xFFFFFFFFFFFFFFFEUL); + __ Mov(x25, 0xFFFF); + __ Mov(x26, 0xFFFFFFFF); __ Cmp(w20, Operand(w21, LSL, 1)); __ Mrs(x0, NZCV); @@ -8202,7 +8196,7 @@ TEST(ccmp_wide_imm) { __ Mrs(x0, NZCV); __ Cmp(w20, Operand(w20)); - __ Ccmp(x20, Operand(0xffffffffffffffffUL), NZCVFlag, eq); + __ Ccmp(x20, Operand(0xFFFFFFFFFFFFFFFFUL), NZCVFlag, eq); __ Mrs(x1, NZCV); END(); @@ -8222,9 +8216,9 @@ TEST(ccmp_shift_extend) { START(); __ Mov(w20, 0x2); __ Mov(w21, 0x1); - __ Mov(x22, 0xffffffffffffffffUL); - __ Mov(x23, 0xff); - __ Mov(x24, 0xfffffffffffffffeUL); + __ Mov(x22, 0xFFFFFFFFFFFFFFFFUL); + __ Mov(x23, 0xFF); + __ Mov(x24, 0xFFFFFFFFFFFFFFFEUL); __ Cmp(w20, Operand(w20)); __ Ccmp(w20, Operand(w21, LSL, 1), NZCVFlag, eq); @@ -8265,8 +8259,8 @@ TEST(csel) { START(); __ Mov(x16, 0); - __ Mov(x24, 0x0000000f0000000fUL); - __ Mov(x25, 0x0000001f0000001fUL); + __ Mov(x24, 0x0000000F0000000FUL); + __ Mov(x25, 0x0000001F0000001FUL); __ Mov(x26, 0); __ Mov(x27, 0); @@ -8303,26 +8297,26 @@ TEST(csel) { RUN(); - CHECK_EQUAL_64(0x0000000f, x0); - CHECK_EQUAL_64(0x0000001f, x1); + CHECK_EQUAL_64(0x0000000F, x0); + CHECK_EQUAL_64(0x0000001F, x1); CHECK_EQUAL_64(0x00000020, x2); - CHECK_EQUAL_64(0x0000000f, x3); - CHECK_EQUAL_64(0xffffffe0ffffffe0UL, x4); - CHECK_EQUAL_64(0x0000000f0000000fUL, x5); - CHECK_EQUAL_64(0xffffffe0ffffffe1UL, x6); - CHECK_EQUAL_64(0x0000000f0000000fUL, x7); + CHECK_EQUAL_64(0x0000000F, x3); + CHECK_EQUAL_64(0xFFFFFFE0FFFFFFE0UL, x4); + CHECK_EQUAL_64(0x0000000F0000000FUL, x5); + CHECK_EQUAL_64(0xFFFFFFE0FFFFFFE1UL, x6); + CHECK_EQUAL_64(0x0000000F0000000FUL, x7); CHECK_EQUAL_64(0x00000001, x8); - CHECK_EQUAL_64(0xffffffff, x9); - CHECK_EQUAL_64(0x0000001f00000020UL, x10); - CHECK_EQUAL_64(0xfffffff0fffffff0UL, x11); - CHECK_EQUAL_64(0xfffffff0fffffff1UL, x12); - CHECK_EQUAL_64(0x0000000f, x13); - CHECK_EQUAL_64(0x0000000f0000000fUL, x14); - CHECK_EQUAL_64(0x0000000f, x15); - CHECK_EQUAL_64(0x0000000f0000000fUL, x18); + CHECK_EQUAL_64(0xFFFFFFFF, x9); + CHECK_EQUAL_64(0x0000001F00000020UL, x10); + CHECK_EQUAL_64(0xFFFFFFF0FFFFFFF0UL, x11); + CHECK_EQUAL_64(0xFFFFFFF0FFFFFFF1UL, x12); + CHECK_EQUAL_64(0x0000000F, x13); + CHECK_EQUAL_64(0x0000000F0000000FUL, x14); + CHECK_EQUAL_64(0x0000000F, x15); + CHECK_EQUAL_64(0x0000000F0000000FUL, x18); CHECK_EQUAL_64(0, x24); - CHECK_EQUAL_64(0x0000001f0000001fUL, x25); - CHECK_EQUAL_64(0x0000001f0000001fUL, x26); + CHECK_EQUAL_64(0x0000001F0000001FUL, x25); + CHECK_EQUAL_64(0x0000001F0000001FUL, x26); CHECK_EQUAL_64(0, x27); TEARDOWN(); @@ -8387,7 +8381,7 @@ TEST(lslv) { INIT_V8(); SETUP(); - uint64_t value = 0x0123456789abcdefUL; + uint64_t value = 0x0123456789ABCDEFUL; int shift[] = {1, 3, 5, 9, 17, 33}; START(); @@ -8440,7 +8434,7 @@ TEST(lsrv) { INIT_V8(); SETUP(); - uint64_t value = 0x0123456789abcdefUL; + uint64_t value = 0x0123456789ABCDEFUL; int shift[] = {1, 3, 5, 9, 17, 33}; START(); @@ -8479,7 +8473,7 @@ TEST(lsrv) { CHECK_EQUAL_64(value >> (shift[4] & 63), x20); CHECK_EQUAL_64(value >> (shift[5] & 63), x21); - value &= 0xffffffffUL; + value &= 0xFFFFFFFFUL; CHECK_EQUAL_32(value >> (shift[0] & 31), w22); CHECK_EQUAL_32(value >> (shift[1] & 31), w23); CHECK_EQUAL_32(value >> (shift[2] & 31), w24); @@ -8495,7 +8489,7 @@ TEST(asrv) { INIT_V8(); SETUP(); - int64_t value = 0xfedcba98fedcba98UL; + int64_t value = 0xFEDCBA98FEDCBA98UL; int shift[] = {1, 3, 5, 9, 17, 33}; START(); @@ -8534,7 +8528,7 @@ TEST(asrv) { CHECK_EQUAL_64(value >> (shift[4] & 63), x20); CHECK_EQUAL_64(value >> (shift[5] & 63), x21); - int32_t value32 = static_cast<int32_t>(value & 0xffffffffUL); + int32_t value32 = static_cast<int32_t>(value & 0xFFFFFFFFUL); CHECK_EQUAL_32(value32 >> (shift[0] & 31), w22); CHECK_EQUAL_32(value32 >> (shift[1] & 31), w23); CHECK_EQUAL_32(value32 >> (shift[2] & 31), w24); @@ -8550,7 +8544,7 @@ TEST(rorv) { INIT_V8(); SETUP(); - uint64_t value = 0x0123456789abcdefUL; + uint64_t value = 0x0123456789ABCDEFUL; int shift[] = {4, 8, 12, 16, 24, 36}; START(); @@ -8582,18 +8576,18 @@ TEST(rorv) { RUN(); CHECK_EQUAL_64(value, x0); - CHECK_EQUAL_64(0xf0123456789abcdeUL, x16); - CHECK_EQUAL_64(0xef0123456789abcdUL, x17); - CHECK_EQUAL_64(0xdef0123456789abcUL, x18); - CHECK_EQUAL_64(0xcdef0123456789abUL, x19); - CHECK_EQUAL_64(0xabcdef0123456789UL, x20); - CHECK_EQUAL_64(0x789abcdef0123456UL, x21); - CHECK_EQUAL_32(0xf89abcde, w22); - CHECK_EQUAL_32(0xef89abcd, w23); - CHECK_EQUAL_32(0xdef89abc, w24); - CHECK_EQUAL_32(0xcdef89ab, w25); - CHECK_EQUAL_32(0xabcdef89, w26); - CHECK_EQUAL_32(0xf89abcde, w27); + CHECK_EQUAL_64(0xF0123456789ABCDEUL, x16); + CHECK_EQUAL_64(0xEF0123456789ABCDUL, x17); + CHECK_EQUAL_64(0xDEF0123456789ABCUL, x18); + CHECK_EQUAL_64(0xCDEF0123456789ABUL, x19); + CHECK_EQUAL_64(0xABCDEF0123456789UL, x20); + CHECK_EQUAL_64(0x789ABCDEF0123456UL, x21); + CHECK_EQUAL_32(0xF89ABCDE, w22); + CHECK_EQUAL_32(0xEF89ABCD, w23); + CHECK_EQUAL_32(0xDEF89ABC, w24); + CHECK_EQUAL_32(0xCDEF89AB, w25); + CHECK_EQUAL_32(0xABCDEF89, w26); + CHECK_EQUAL_32(0xF89ABCDE, w27); TEARDOWN(); } @@ -8604,7 +8598,7 @@ TEST(bfm) { SETUP(); START(); - __ Mov(x1, 0x0123456789abcdefL); + __ Mov(x1, 0x0123456789ABCDEFL); __ Mov(x10, 0x8888888888888888L); __ Mov(x11, 0x8888888888888888L); @@ -8626,15 +8620,14 @@ TEST(bfm) { RUN(); + CHECK_EQUAL_64(0x88888888888889ABL, x10); + CHECK_EQUAL_64(0x8888CDEF88888888L, x11); - CHECK_EQUAL_64(0x88888888888889abL, x10); - CHECK_EQUAL_64(0x8888cdef88888888L, x11); - - CHECK_EQUAL_32(0x888888ab, w20); - CHECK_EQUAL_32(0x88cdef88, w21); + CHECK_EQUAL_32(0x888888AB, w20); + CHECK_EQUAL_32(0x88CDEF88, w21); - CHECK_EQUAL_64(0x8888888888ef8888L, x12); - CHECK_EQUAL_64(0x88888888888888abL, x13); + CHECK_EQUAL_64(0x8888888888EF8888L, x12); + CHECK_EQUAL_64(0x88888888888888ABL, x13); TEARDOWN(); } @@ -8645,8 +8638,8 @@ TEST(sbfm) { SETUP(); START(); - __ Mov(x1, 0x0123456789abcdefL); - __ Mov(x2, 0xfedcba9876543210L); + __ Mov(x1, 0x0123456789ABCDEFL); + __ Mov(x2, 0xFEDCBA9876543210L); __ sbfm(x10, x1, 16, 31); __ sbfm(x11, x1, 32, 15); @@ -8675,28 +8668,27 @@ TEST(sbfm) { RUN(); - - CHECK_EQUAL_64(0xffffffffffff89abL, x10); - CHECK_EQUAL_64(0xffffcdef00000000L, x11); + CHECK_EQUAL_64(0xFFFFFFFFFFFF89ABL, x10); + CHECK_EQUAL_64(0xFFFFCDEF00000000L, x11); CHECK_EQUAL_64(0x4567L, x12); - CHECK_EQUAL_64(0x789abcdef0000L, x13); + CHECK_EQUAL_64(0x789ABCDEF0000L, x13); - CHECK_EQUAL_32(0xffffffab, w14); - CHECK_EQUAL_32(0xffcdef00, w15); + CHECK_EQUAL_32(0xFFFFFFAB, w14); + CHECK_EQUAL_32(0xFFCDEF00, w15); CHECK_EQUAL_32(0x54, w16); CHECK_EQUAL_32(0x00321000, w17); CHECK_EQUAL_64(0x01234567L, x18); - CHECK_EQUAL_64(0xfffffffffedcba98L, x19); - CHECK_EQUAL_64(0xffffffffffcdef00L, x20); + CHECK_EQUAL_64(0xFFFFFFFFFEDCBA98L, x19); + CHECK_EQUAL_64(0xFFFFFFFFFFCDEF00L, x20); CHECK_EQUAL_64(0x321000L, x21); - CHECK_EQUAL_64(0xffffffffffffabcdL, x22); + CHECK_EQUAL_64(0xFFFFFFFFFFFFABCDL, x22); CHECK_EQUAL_64(0x5432L, x23); - CHECK_EQUAL_64(0xffffffffffffffefL, x24); + CHECK_EQUAL_64(0xFFFFFFFFFFFFFFEFL, x24); CHECK_EQUAL_64(0x10, x25); - CHECK_EQUAL_64(0xffffffffffffcdefL, x26); + CHECK_EQUAL_64(0xFFFFFFFFFFFFCDEFL, x26); CHECK_EQUAL_64(0x3210, x27); - CHECK_EQUAL_64(0xffffffff89abcdefL, x28); + CHECK_EQUAL_64(0xFFFFFFFF89ABCDEFL, x28); CHECK_EQUAL_64(0x76543210, x29); TEARDOWN(); @@ -8708,8 +8700,8 @@ TEST(ubfm) { SETUP(); START(); - __ Mov(x1, 0x0123456789abcdefL); - __ Mov(x2, 0xfedcba9876543210L); + __ Mov(x1, 0x0123456789ABCDEFL); + __ Mov(x2, 0xFEDCBA9876543210L); __ Mov(x10, 0x8888888888888888L); __ Mov(x11, 0x8888888888888888L); @@ -8737,24 +8729,24 @@ TEST(ubfm) { RUN(); - CHECK_EQUAL_64(0x00000000000089abL, x10); - CHECK_EQUAL_64(0x0000cdef00000000L, x11); + CHECK_EQUAL_64(0x00000000000089ABL, x10); + CHECK_EQUAL_64(0x0000CDEF00000000L, x11); CHECK_EQUAL_64(0x4567L, x12); - CHECK_EQUAL_64(0x789abcdef0000L, x13); + CHECK_EQUAL_64(0x789ABCDEF0000L, x13); - CHECK_EQUAL_32(0x000000ab, w25); - CHECK_EQUAL_32(0x00cdef00, w26); + CHECK_EQUAL_32(0x000000AB, w25); + CHECK_EQUAL_32(0x00CDEF00, w26); CHECK_EQUAL_32(0x54, w27); CHECK_EQUAL_32(0x00321000, w28); CHECK_EQUAL_64(0x8000000000000000L, x15); - CHECK_EQUAL_64(0x0123456789abcdefL, x16); + CHECK_EQUAL_64(0x0123456789ABCDEFL, x16); CHECK_EQUAL_64(0x01234567L, x17); - CHECK_EQUAL_64(0xcdef00L, x18); - CHECK_EQUAL_64(0xabcdL, x19); - CHECK_EQUAL_64(0xefL, x20); - CHECK_EQUAL_64(0xcdefL, x21); - CHECK_EQUAL_64(0x89abcdefL, x22); + CHECK_EQUAL_64(0xCDEF00L, x18); + CHECK_EQUAL_64(0xABCDL, x19); + CHECK_EQUAL_64(0xEFL, x20); + CHECK_EQUAL_64(0xCDEFL, x21); + CHECK_EQUAL_64(0x89ABCDEFL, x22); TEARDOWN(); } @@ -8765,8 +8757,8 @@ TEST(extr) { SETUP(); START(); - __ Mov(x1, 0x0123456789abcdefL); - __ Mov(x2, 0xfedcba9876543210L); + __ Mov(x1, 0x0123456789ABCDEFL); + __ Mov(x2, 0xFEDCBA9876543210L); __ Extr(w10, w1, w2, 0); __ Extr(x11, x1, x2, 0); @@ -8784,15 +8776,15 @@ TEST(extr) { RUN(); CHECK_EQUAL_64(0x76543210, x10); - CHECK_EQUAL_64(0xfedcba9876543210L, x11); - CHECK_EQUAL_64(0xbb2a1908, x12); - CHECK_EQUAL_64(0x0048d159e26af37bUL, x13); - CHECK_EQUAL_64(0x89abcdef, x20); - CHECK_EQUAL_64(0x0123456789abcdefL, x21); - CHECK_EQUAL_64(0x19083b2a, x22); - CHECK_EQUAL_64(0x13579bdf, x23); - CHECK_EQUAL_64(0x7f6e5d4c3b2a1908UL, x24); - CHECK_EQUAL_64(0x02468acf13579bdeUL, x25); + CHECK_EQUAL_64(0xFEDCBA9876543210L, x11); + CHECK_EQUAL_64(0xBB2A1908, x12); + CHECK_EQUAL_64(0x0048D159E26AF37BUL, x13); + CHECK_EQUAL_64(0x89ABCDEF, x20); + CHECK_EQUAL_64(0x0123456789ABCDEFL, x21); + CHECK_EQUAL_64(0x19083B2A, x22); + CHECK_EQUAL_64(0x13579BDF, x23); + CHECK_EQUAL_64(0x7F6E5D4C3B2A1908UL, x24); + CHECK_EQUAL_64(0x02468ACF13579BDEUL, x25); TEARDOWN(); } @@ -8841,7 +8833,7 @@ TEST(fmov_reg) { __ Fmov(x1, d1); __ Fmov(d2, x1); __ Fmov(d4, d1); - __ Fmov(d6, bit_cast<double>(0x0123456789abcdefL)); + __ Fmov(d6, bit_cast<double>(0x0123456789ABCDEFL)); __ Fmov(s6, s6); END(); @@ -8853,7 +8845,7 @@ TEST(fmov_reg) { CHECK_EQUAL_64(bit_cast<uint64_t>(-13.0), x1); CHECK_EQUAL_FP64(-13.0, d2); CHECK_EQUAL_FP64(-13.0, d4); - CHECK_EQUAL_FP32(bit_cast<float>(0x89abcdef), s6); + CHECK_EQUAL_FP32(bit_cast<float>(0x89ABCDEF), s6); TEARDOWN(); } @@ -9169,12 +9161,12 @@ TEST(fmadd_fmsub_float) { TEST(fmadd_fmsub_double_nans) { INIT_V8(); // Make sure that NaN propagation works correctly. - double s1 = bit_cast<double>(0x7ff5555511111111); - double s2 = bit_cast<double>(0x7ff5555522222222); - double sa = bit_cast<double>(0x7ff55555aaaaaaaa); - double q1 = bit_cast<double>(0x7ffaaaaa11111111); - double q2 = bit_cast<double>(0x7ffaaaaa22222222); - double qa = bit_cast<double>(0x7ffaaaaaaaaaaaaa); + double s1 = bit_cast<double>(0x7FF5555511111111); + double s2 = bit_cast<double>(0x7FF5555522222222); + double sa = bit_cast<double>(0x7FF55555AAAAAAAA); + double q1 = bit_cast<double>(0x7FFAAAAA11111111); + double q2 = bit_cast<double>(0x7FFAAAAA22222222); + double qa = bit_cast<double>(0x7FFAAAAAAAAAAAAA); CHECK(IsSignallingNaN(s1)); CHECK(IsSignallingNaN(s2)); CHECK(IsSignallingNaN(sa)); @@ -9183,9 +9175,9 @@ TEST(fmadd_fmsub_double_nans) { CHECK(IsQuietNaN(qa)); // The input NaNs after passing through ProcessNaN. - double s1_proc = bit_cast<double>(0x7ffd555511111111); - double s2_proc = bit_cast<double>(0x7ffd555522222222); - double sa_proc = bit_cast<double>(0x7ffd5555aaaaaaaa); + double s1_proc = bit_cast<double>(0x7FFD555511111111); + double s2_proc = bit_cast<double>(0x7FFD555522222222); + double sa_proc = bit_cast<double>(0x7FFD5555AAAAAAAA); double q1_proc = q1; double q2_proc = q2; double qa_proc = qa; @@ -9197,10 +9189,10 @@ TEST(fmadd_fmsub_double_nans) { CHECK(IsQuietNaN(qa_proc)); // Negated NaNs as it would be done on ARMv8 hardware. - double s1_proc_neg = bit_cast<double>(0xfffd555511111111); - double sa_proc_neg = bit_cast<double>(0xfffd5555aaaaaaaa); - double q1_proc_neg = bit_cast<double>(0xfffaaaaa11111111); - double qa_proc_neg = bit_cast<double>(0xfffaaaaaaaaaaaaa); + double s1_proc_neg = bit_cast<double>(0xFFFD555511111111); + double sa_proc_neg = bit_cast<double>(0xFFFD5555AAAAAAAA); + double q1_proc_neg = bit_cast<double>(0xFFFAAAAA11111111); + double qa_proc_neg = bit_cast<double>(0xFFFAAAAAAAAAAAAA); CHECK(IsQuietNaN(s1_proc_neg)); CHECK(IsQuietNaN(sa_proc_neg)); CHECK(IsQuietNaN(q1_proc_neg)); @@ -9252,12 +9244,12 @@ TEST(fmadd_fmsub_double_nans) { TEST(fmadd_fmsub_float_nans) { INIT_V8(); // Make sure that NaN propagation works correctly. - float s1 = bit_cast<float>(0x7f951111); - float s2 = bit_cast<float>(0x7f952222); - float sa = bit_cast<float>(0x7f95aaaa); - float q1 = bit_cast<float>(0x7fea1111); - float q2 = bit_cast<float>(0x7fea2222); - float qa = bit_cast<float>(0x7feaaaaa); + float s1 = bit_cast<float>(0x7F951111); + float s2 = bit_cast<float>(0x7F952222); + float sa = bit_cast<float>(0x7F95AAAA); + float q1 = bit_cast<float>(0x7FEA1111); + float q2 = bit_cast<float>(0x7FEA2222); + float qa = bit_cast<float>(0x7FEAAAAA); CHECK(IsSignallingNaN(s1)); CHECK(IsSignallingNaN(s2)); CHECK(IsSignallingNaN(sa)); @@ -9266,9 +9258,9 @@ TEST(fmadd_fmsub_float_nans) { CHECK(IsQuietNaN(qa)); // The input NaNs after passing through ProcessNaN. - float s1_proc = bit_cast<float>(0x7fd51111); - float s2_proc = bit_cast<float>(0x7fd52222); - float sa_proc = bit_cast<float>(0x7fd5aaaa); + float s1_proc = bit_cast<float>(0x7FD51111); + float s2_proc = bit_cast<float>(0x7FD52222); + float sa_proc = bit_cast<float>(0x7FD5AAAA); float q1_proc = q1; float q2_proc = q2; float qa_proc = qa; @@ -9280,10 +9272,10 @@ TEST(fmadd_fmsub_float_nans) { CHECK(IsQuietNaN(qa_proc)); // Negated NaNs as it would be done on ARMv8 hardware. - float s1_proc_neg = bit_cast<float>(0xffd51111); - float sa_proc_neg = bit_cast<float>(0xffd5aaaa); - float q1_proc_neg = bit_cast<float>(0xffea1111); - float qa_proc_neg = bit_cast<float>(0xffeaaaaa); + float s1_proc_neg = bit_cast<float>(0xFFD51111); + float sa_proc_neg = bit_cast<float>(0xFFD5AAAA); + float q1_proc_neg = bit_cast<float>(0xFFEA1111); + float qa_proc_neg = bit_cast<float>(0xFFEAAAAA); CHECK(IsQuietNaN(s1_proc_neg)); CHECK(IsQuietNaN(sa_proc_neg)); CHECK(IsQuietNaN(q1_proc_neg)); @@ -9499,10 +9491,10 @@ static void FminFmaxDoubleHelper(double n, double m, double min, double max, TEST(fmax_fmin_d) { INIT_V8(); // Use non-standard NaNs to check that the payload bits are preserved. - double snan = bit_cast<double>(0x7ff5555512345678); - double qnan = bit_cast<double>(0x7ffaaaaa87654321); + double snan = bit_cast<double>(0x7FF5555512345678); + double qnan = bit_cast<double>(0x7FFAAAAA87654321); - double snan_processed = bit_cast<double>(0x7ffd555512345678); + double snan_processed = bit_cast<double>(0x7FFD555512345678); double qnan_processed = qnan; CHECK(IsSignallingNaN(snan)); @@ -9584,10 +9576,10 @@ static void FminFmaxFloatHelper(float n, float m, float min, float max, TEST(fmax_fmin_s) { INIT_V8(); // Use non-standard NaNs to check that the payload bits are preserved. - float snan = bit_cast<float>(0x7f951234); - float qnan = bit_cast<float>(0x7fea8765); + float snan = bit_cast<float>(0x7F951234); + float qnan = bit_cast<float>(0x7FEA8765); - float snan_processed = bit_cast<float>(0x7fd51234); + float snan_processed = bit_cast<float>(0x7FD51234); float qnan_processed = qnan; CHECK(IsSignallingNaN(snan)); @@ -9727,7 +9719,7 @@ TEST(fcmp) { __ Fmov(s8, 0.0); __ Fmov(s9, 0.5); - __ Mov(w18, 0x7f800001); // Single precision NaN. + __ Mov(w18, 0x7F800001); // Single precision NaN. __ Fmov(s18, w18); __ Fcmp(s8, s8); @@ -9749,7 +9741,7 @@ TEST(fcmp) { __ Fmov(d19, 0.0); __ Fmov(d20, 0.5); - __ Mov(x21, 0x7ff0000000000001UL); // Double precision NaN. + __ Mov(x21, 0x7FF0000000000001UL); // Double precision NaN. __ Fmov(d21, x21); __ Fcmp(d19, d19); @@ -10422,8 +10414,8 @@ TEST(fcvt_ds) { __ Fmov(s26, -0.0); __ Fmov(s27, FLT_MAX); __ Fmov(s28, FLT_MIN); - __ Fmov(s29, bit_cast<float>(0x7fc12345)); // Quiet NaN. - __ Fmov(s30, bit_cast<float>(0x7f812345)); // Signalling NaN. + __ Fmov(s29, bit_cast<float>(0x7FC12345)); // Quiet NaN. + __ Fmov(s30, bit_cast<float>(0x7F812345)); // Signalling NaN. __ Fcvt(d0, s16); __ Fcvt(d1, s17); @@ -10464,8 +10456,8 @@ TEST(fcvt_ds) { // - The top bit of the mantissa is forced to 1 (making it a quiet NaN). // - The remaining mantissa bits are copied until they run out. // - The low-order bits that haven't already been assigned are set to 0. - CHECK_EQUAL_FP64(bit_cast<double>(0x7ff82468a0000000), d13); - CHECK_EQUAL_FP64(bit_cast<double>(0x7ff82468a0000000), d14); + CHECK_EQUAL_FP64(bit_cast<double>(0x7FF82468A0000000), d13); + CHECK_EQUAL_FP64(bit_cast<double>(0x7FF82468A0000000), d14); TEARDOWN(); } @@ -10496,23 +10488,23 @@ TEST(fcvt_sd) { // For normalized numbers: // bit 29 (0x0000000020000000) is the lowest-order bit which will // fit in the float's mantissa. - {bit_cast<double>(0x3ff0000000000000), bit_cast<float>(0x3f800000)}, - {bit_cast<double>(0x3ff0000000000001), bit_cast<float>(0x3f800000)}, - {bit_cast<double>(0x3ff0000010000000), bit_cast<float>(0x3f800000)}, - {bit_cast<double>(0x3ff0000010000001), bit_cast<float>(0x3f800001)}, - {bit_cast<double>(0x3ff0000020000000), bit_cast<float>(0x3f800001)}, - {bit_cast<double>(0x3ff0000020000001), bit_cast<float>(0x3f800001)}, - {bit_cast<double>(0x3ff0000030000000), bit_cast<float>(0x3f800002)}, - {bit_cast<double>(0x3ff0000030000001), bit_cast<float>(0x3f800002)}, - {bit_cast<double>(0x3ff0000040000000), bit_cast<float>(0x3f800002)}, - {bit_cast<double>(0x3ff0000040000001), bit_cast<float>(0x3f800002)}, - {bit_cast<double>(0x3ff0000050000000), bit_cast<float>(0x3f800002)}, - {bit_cast<double>(0x3ff0000050000001), bit_cast<float>(0x3f800003)}, - {bit_cast<double>(0x3ff0000060000000), bit_cast<float>(0x3f800003)}, + {bit_cast<double>(0x3FF0000000000000), bit_cast<float>(0x3F800000)}, + {bit_cast<double>(0x3FF0000000000001), bit_cast<float>(0x3F800000)}, + {bit_cast<double>(0x3FF0000010000000), bit_cast<float>(0x3F800000)}, + {bit_cast<double>(0x3FF0000010000001), bit_cast<float>(0x3F800001)}, + {bit_cast<double>(0x3FF0000020000000), bit_cast<float>(0x3F800001)}, + {bit_cast<double>(0x3FF0000020000001), bit_cast<float>(0x3F800001)}, + {bit_cast<double>(0x3FF0000030000000), bit_cast<float>(0x3F800002)}, + {bit_cast<double>(0x3FF0000030000001), bit_cast<float>(0x3F800002)}, + {bit_cast<double>(0x3FF0000040000000), bit_cast<float>(0x3F800002)}, + {bit_cast<double>(0x3FF0000040000001), bit_cast<float>(0x3F800002)}, + {bit_cast<double>(0x3FF0000050000000), bit_cast<float>(0x3F800002)}, + {bit_cast<double>(0x3FF0000050000001), bit_cast<float>(0x3F800003)}, + {bit_cast<double>(0x3FF0000060000000), bit_cast<float>(0x3F800003)}, // - A mantissa that overflows into the exponent during rounding. - {bit_cast<double>(0x3feffffff0000000), bit_cast<float>(0x3f800000)}, + {bit_cast<double>(0x3FEFFFFFF0000000), bit_cast<float>(0x3F800000)}, // - The largest double that rounds to a normal float. - {bit_cast<double>(0x47efffffefffffff), bit_cast<float>(0x7f7fffff)}, + {bit_cast<double>(0x47EFFFFFEFFFFFFF), bit_cast<float>(0x7F7FFFFF)}, // Doubles that are too big for a float. {kFP64PositiveInfinity, kFP32PositiveInfinity}, @@ -10520,7 +10512,7 @@ TEST(fcvt_sd) { // - The smallest exponent that's too big for a float. {pow(2.0, 128), kFP32PositiveInfinity}, // - This exponent is in range, but the value rounds to infinity. - {bit_cast<double>(0x47effffff0000000), kFP32PositiveInfinity}, + {bit_cast<double>(0x47EFFFFFF0000000), kFP32PositiveInfinity}, // Doubles that are too small for a float. // - The smallest (subnormal) double. @@ -10530,36 +10522,36 @@ TEST(fcvt_sd) { // Normal doubles that become subnormal floats. // - The largest subnormal float. - {bit_cast<double>(0x380fffffc0000000), bit_cast<float>(0x007fffff)}, + {bit_cast<double>(0x380FFFFFC0000000), bit_cast<float>(0x007FFFFF)}, // - The smallest subnormal float. - {bit_cast<double>(0x36a0000000000000), bit_cast<float>(0x00000001)}, + {bit_cast<double>(0x36A0000000000000), bit_cast<float>(0x00000001)}, // - Subnormal floats that need (ties-to-even) rounding. // For these subnormals: // bit 34 (0x0000000400000000) is the lowest-order bit which will // fit in the float's mantissa. - {bit_cast<double>(0x37c159e000000000), bit_cast<float>(0x00045678)}, - {bit_cast<double>(0x37c159e000000001), bit_cast<float>(0x00045678)}, - {bit_cast<double>(0x37c159e200000000), bit_cast<float>(0x00045678)}, - {bit_cast<double>(0x37c159e200000001), bit_cast<float>(0x00045679)}, - {bit_cast<double>(0x37c159e400000000), bit_cast<float>(0x00045679)}, - {bit_cast<double>(0x37c159e400000001), bit_cast<float>(0x00045679)}, - {bit_cast<double>(0x37c159e600000000), bit_cast<float>(0x0004567a)}, - {bit_cast<double>(0x37c159e600000001), bit_cast<float>(0x0004567a)}, - {bit_cast<double>(0x37c159e800000000), bit_cast<float>(0x0004567a)}, - {bit_cast<double>(0x37c159e800000001), bit_cast<float>(0x0004567a)}, - {bit_cast<double>(0x37c159ea00000000), bit_cast<float>(0x0004567a)}, - {bit_cast<double>(0x37c159ea00000001), bit_cast<float>(0x0004567b)}, - {bit_cast<double>(0x37c159ec00000000), bit_cast<float>(0x0004567b)}, + {bit_cast<double>(0x37C159E000000000), bit_cast<float>(0x00045678)}, + {bit_cast<double>(0x37C159E000000001), bit_cast<float>(0x00045678)}, + {bit_cast<double>(0x37C159E200000000), bit_cast<float>(0x00045678)}, + {bit_cast<double>(0x37C159E200000001), bit_cast<float>(0x00045679)}, + {bit_cast<double>(0x37C159E400000000), bit_cast<float>(0x00045679)}, + {bit_cast<double>(0x37C159E400000001), bit_cast<float>(0x00045679)}, + {bit_cast<double>(0x37C159E600000000), bit_cast<float>(0x0004567A)}, + {bit_cast<double>(0x37C159E600000001), bit_cast<float>(0x0004567A)}, + {bit_cast<double>(0x37C159E800000000), bit_cast<float>(0x0004567A)}, + {bit_cast<double>(0x37C159E800000001), bit_cast<float>(0x0004567A)}, + {bit_cast<double>(0x37C159EA00000000), bit_cast<float>(0x0004567A)}, + {bit_cast<double>(0x37C159EA00000001), bit_cast<float>(0x0004567B)}, + {bit_cast<double>(0x37C159EC00000000), bit_cast<float>(0x0004567B)}, // - The smallest double which rounds up to become a subnormal float. {bit_cast<double>(0x3690000000000001), bit_cast<float>(0x00000001)}, // Check NaN payload preservation. - {bit_cast<double>(0x7ff82468a0000000), bit_cast<float>(0x7fc12345)}, - {bit_cast<double>(0x7ff82468bfffffff), bit_cast<float>(0x7fc12345)}, + {bit_cast<double>(0x7FF82468A0000000), bit_cast<float>(0x7FC12345)}, + {bit_cast<double>(0x7FF82468BFFFFFFF), bit_cast<float>(0x7FC12345)}, // - Signalling NaNs become quiet NaNs. - {bit_cast<double>(0x7ff02468a0000000), bit_cast<float>(0x7fc12345)}, - {bit_cast<double>(0x7ff02468bfffffff), bit_cast<float>(0x7fc12345)}, - {bit_cast<double>(0x7ff000001fffffff), bit_cast<float>(0x7fc00000)}, + {bit_cast<double>(0x7FF02468A0000000), bit_cast<float>(0x7FC12345)}, + {bit_cast<double>(0x7FF02468BFFFFFFF), bit_cast<float>(0x7FC12345)}, + {bit_cast<double>(0x7FF000001FFFFFFF), bit_cast<float>(0x7FC00000)}, }; int count = sizeof(test) / sizeof(test[0]); @@ -10600,7 +10592,7 @@ TEST(fcvtas) { __ Fmov(s3, -2.5); __ Fmov(s4, kFP32PositiveInfinity); __ Fmov(s5, kFP32NegativeInfinity); - __ Fmov(s6, 0x7fffff80); // Largest float < INT32_MAX. + __ Fmov(s6, 0x7FFFFF80); // Largest float < INT32_MAX. __ Fneg(s7, s6); // Smallest float > INT32_MIN. __ Fmov(d8, 1.0); __ Fmov(d9, 1.1); @@ -10615,14 +10607,14 @@ TEST(fcvtas) { __ Fmov(s19, -2.5); __ Fmov(s20, kFP32PositiveInfinity); __ Fmov(s21, kFP32NegativeInfinity); - __ Fmov(s22, 0x7fffff8000000000UL); // Largest float < INT64_MAX. + __ Fmov(s22, 0x7FFFFF8000000000UL); // Largest float < INT64_MAX. __ Fneg(s23, s22); // Smallest float > INT64_MIN. __ Fmov(d24, 1.1); __ Fmov(d25, 2.5); __ Fmov(d26, -2.5); __ Fmov(d27, kFP64PositiveInfinity); __ Fmov(d28, kFP64NegativeInfinity); - __ Fmov(d29, 0x7ffffffffffffc00UL); // Largest double < INT64_MAX. + __ Fmov(d29, 0x7FFFFFFFFFFFFC00UL); // Largest double < INT64_MAX. __ Fneg(d30, d29); // Smallest double > INT64_MIN. __ Fcvtas(w0, s0); @@ -10662,32 +10654,32 @@ TEST(fcvtas) { CHECK_EQUAL_64(1, x0); CHECK_EQUAL_64(1, x1); CHECK_EQUAL_64(3, x2); - CHECK_EQUAL_64(0xfffffffd, x3); - CHECK_EQUAL_64(0x7fffffff, x4); + CHECK_EQUAL_64(0xFFFFFFFD, x3); + CHECK_EQUAL_64(0x7FFFFFFF, x4); CHECK_EQUAL_64(0x80000000, x5); - CHECK_EQUAL_64(0x7fffff80, x6); + CHECK_EQUAL_64(0x7FFFFF80, x6); CHECK_EQUAL_64(0x80000080, x7); CHECK_EQUAL_64(1, x8); CHECK_EQUAL_64(1, x9); CHECK_EQUAL_64(3, x10); - CHECK_EQUAL_64(0xfffffffd, x11); - CHECK_EQUAL_64(0x7fffffff, x12); + CHECK_EQUAL_64(0xFFFFFFFD, x11); + CHECK_EQUAL_64(0x7FFFFFFF, x12); CHECK_EQUAL_64(0x80000000, x13); - CHECK_EQUAL_64(0x7ffffffe, x14); + CHECK_EQUAL_64(0x7FFFFFFE, x14); CHECK_EQUAL_64(0x80000001, x15); CHECK_EQUAL_64(1, x17); CHECK_EQUAL_64(3, x18); - CHECK_EQUAL_64(0xfffffffffffffffdUL, x19); - CHECK_EQUAL_64(0x7fffffffffffffffUL, x20); + CHECK_EQUAL_64(0xFFFFFFFFFFFFFFFDUL, x19); + CHECK_EQUAL_64(0x7FFFFFFFFFFFFFFFUL, x20); CHECK_EQUAL_64(0x8000000000000000UL, x21); - CHECK_EQUAL_64(0x7fffff8000000000UL, x22); + CHECK_EQUAL_64(0x7FFFFF8000000000UL, x22); CHECK_EQUAL_64(0x8000008000000000UL, x23); CHECK_EQUAL_64(1, x24); CHECK_EQUAL_64(3, x25); - CHECK_EQUAL_64(0xfffffffffffffffdUL, x26); - CHECK_EQUAL_64(0x7fffffffffffffffUL, x27); + CHECK_EQUAL_64(0xFFFFFFFFFFFFFFFDUL, x26); + CHECK_EQUAL_64(0x7FFFFFFFFFFFFFFFUL, x27); CHECK_EQUAL_64(0x8000000000000000UL, x28); - CHECK_EQUAL_64(0x7ffffffffffffc00UL, x29); + CHECK_EQUAL_64(0x7FFFFFFFFFFFFC00UL, x29); CHECK_EQUAL_64(0x8000000000000400UL, x30); TEARDOWN(); @@ -10705,27 +10697,27 @@ TEST(fcvtau) { __ Fmov(s3, -2.5); __ Fmov(s4, kFP32PositiveInfinity); __ Fmov(s5, kFP32NegativeInfinity); - __ Fmov(s6, 0xffffff00); // Largest float < UINT32_MAX. + __ Fmov(s6, 0xFFFFFF00); // Largest float < UINT32_MAX. __ Fmov(d8, 1.0); __ Fmov(d9, 1.1); __ Fmov(d10, 2.5); __ Fmov(d11, -2.5); __ Fmov(d12, kFP64PositiveInfinity); __ Fmov(d13, kFP64NegativeInfinity); - __ Fmov(d14, 0xfffffffe); + __ Fmov(d14, 0xFFFFFFFE); __ Fmov(s16, 1.0); __ Fmov(s17, 1.1); __ Fmov(s18, 2.5); __ Fmov(s19, -2.5); __ Fmov(s20, kFP32PositiveInfinity); __ Fmov(s21, kFP32NegativeInfinity); - __ Fmov(s22, 0xffffff0000000000UL); // Largest float < UINT64_MAX. + __ Fmov(s22, 0xFFFFFF0000000000UL); // Largest float < UINT64_MAX. __ Fmov(d24, 1.1); __ Fmov(d25, 2.5); __ Fmov(d26, -2.5); __ Fmov(d27, kFP64PositiveInfinity); __ Fmov(d28, kFP64NegativeInfinity); - __ Fmov(d29, 0xfffffffffffff800UL); // Largest double < UINT64_MAX. + __ Fmov(d29, 0xFFFFFFFFFFFFF800UL); // Largest double < UINT64_MAX. __ Fmov(s30, 0x100000000UL); __ Fcvtau(w0, s0); @@ -10765,30 +10757,30 @@ TEST(fcvtau) { CHECK_EQUAL_64(1, x1); CHECK_EQUAL_64(3, x2); CHECK_EQUAL_64(0, x3); - CHECK_EQUAL_64(0xffffffff, x4); + CHECK_EQUAL_64(0xFFFFFFFF, x4); CHECK_EQUAL_64(0, x5); - CHECK_EQUAL_64(0xffffff00, x6); + CHECK_EQUAL_64(0xFFFFFF00, x6); CHECK_EQUAL_64(1, x8); CHECK_EQUAL_64(1, x9); CHECK_EQUAL_64(3, x10); CHECK_EQUAL_64(0, x11); - CHECK_EQUAL_64(0xffffffff, x12); + CHECK_EQUAL_64(0xFFFFFFFF, x12); CHECK_EQUAL_64(0, x13); - CHECK_EQUAL_64(0xfffffffe, x14); + CHECK_EQUAL_64(0xFFFFFFFE, x14); CHECK_EQUAL_64(1, x16); CHECK_EQUAL_64(1, x17); CHECK_EQUAL_64(3, x18); CHECK_EQUAL_64(0, x19); - CHECK_EQUAL_64(0xffffffffffffffffUL, x20); + CHECK_EQUAL_64(0xFFFFFFFFFFFFFFFFUL, x20); CHECK_EQUAL_64(0, x21); - CHECK_EQUAL_64(0xffffff0000000000UL, x22); + CHECK_EQUAL_64(0xFFFFFF0000000000UL, x22); CHECK_EQUAL_64(1, x24); CHECK_EQUAL_64(3, x25); CHECK_EQUAL_64(0, x26); - CHECK_EQUAL_64(0xffffffffffffffffUL, x27); + CHECK_EQUAL_64(0xFFFFFFFFFFFFFFFFUL, x27); CHECK_EQUAL_64(0, x28); - CHECK_EQUAL_64(0xfffffffffffff800UL, x29); - CHECK_EQUAL_64(0xffffffff, x30); + CHECK_EQUAL_64(0xFFFFFFFFFFFFF800UL, x29); + CHECK_EQUAL_64(0xFFFFFFFF, x30); TEARDOWN(); } @@ -10805,7 +10797,7 @@ TEST(fcvtms) { __ Fmov(s3, -1.5); __ Fmov(s4, kFP32PositiveInfinity); __ Fmov(s5, kFP32NegativeInfinity); - __ Fmov(s6, 0x7fffff80); // Largest float < INT32_MAX. + __ Fmov(s6, 0x7FFFFF80); // Largest float < INT32_MAX. __ Fneg(s7, s6); // Smallest float > INT32_MIN. __ Fmov(d8, 1.0); __ Fmov(d9, 1.1); @@ -10820,14 +10812,14 @@ TEST(fcvtms) { __ Fmov(s19, -1.5); __ Fmov(s20, kFP32PositiveInfinity); __ Fmov(s21, kFP32NegativeInfinity); - __ Fmov(s22, 0x7fffff8000000000UL); // Largest float < INT64_MAX. + __ Fmov(s22, 0x7FFFFF8000000000UL); // Largest float < INT64_MAX. __ Fneg(s23, s22); // Smallest float > INT64_MIN. __ Fmov(d24, 1.1); __ Fmov(d25, 1.5); __ Fmov(d26, -1.5); __ Fmov(d27, kFP64PositiveInfinity); __ Fmov(d28, kFP64NegativeInfinity); - __ Fmov(d29, 0x7ffffffffffffc00UL); // Largest double < INT64_MAX. + __ Fmov(d29, 0x7FFFFFFFFFFFFC00UL); // Largest double < INT64_MAX. __ Fneg(d30, d29); // Smallest double > INT64_MIN. __ Fcvtms(w0, s0); @@ -10867,32 +10859,32 @@ TEST(fcvtms) { CHECK_EQUAL_64(1, x0); CHECK_EQUAL_64(1, x1); CHECK_EQUAL_64(1, x2); - CHECK_EQUAL_64(0xfffffffe, x3); - CHECK_EQUAL_64(0x7fffffff, x4); + CHECK_EQUAL_64(0xFFFFFFFE, x3); + CHECK_EQUAL_64(0x7FFFFFFF, x4); CHECK_EQUAL_64(0x80000000, x5); - CHECK_EQUAL_64(0x7fffff80, x6); + CHECK_EQUAL_64(0x7FFFFF80, x6); CHECK_EQUAL_64(0x80000080, x7); CHECK_EQUAL_64(1, x8); CHECK_EQUAL_64(1, x9); CHECK_EQUAL_64(1, x10); - CHECK_EQUAL_64(0xfffffffe, x11); - CHECK_EQUAL_64(0x7fffffff, x12); + CHECK_EQUAL_64(0xFFFFFFFE, x11); + CHECK_EQUAL_64(0x7FFFFFFF, x12); CHECK_EQUAL_64(0x80000000, x13); - CHECK_EQUAL_64(0x7ffffffe, x14); + CHECK_EQUAL_64(0x7FFFFFFE, x14); CHECK_EQUAL_64(0x80000001, x15); CHECK_EQUAL_64(1, x17); CHECK_EQUAL_64(1, x18); - CHECK_EQUAL_64(0xfffffffffffffffeUL, x19); - CHECK_EQUAL_64(0x7fffffffffffffffUL, x20); + CHECK_EQUAL_64(0xFFFFFFFFFFFFFFFEUL, x19); + CHECK_EQUAL_64(0x7FFFFFFFFFFFFFFFUL, x20); CHECK_EQUAL_64(0x8000000000000000UL, x21); - CHECK_EQUAL_64(0x7fffff8000000000UL, x22); + CHECK_EQUAL_64(0x7FFFFF8000000000UL, x22); CHECK_EQUAL_64(0x8000008000000000UL, x23); CHECK_EQUAL_64(1, x24); CHECK_EQUAL_64(1, x25); - CHECK_EQUAL_64(0xfffffffffffffffeUL, x26); - CHECK_EQUAL_64(0x7fffffffffffffffUL, x27); + CHECK_EQUAL_64(0xFFFFFFFFFFFFFFFEUL, x26); + CHECK_EQUAL_64(0x7FFFFFFFFFFFFFFFUL, x27); CHECK_EQUAL_64(0x8000000000000000UL, x28); - CHECK_EQUAL_64(0x7ffffffffffffc00UL, x29); + CHECK_EQUAL_64(0x7FFFFFFFFFFFFC00UL, x29); CHECK_EQUAL_64(0x8000000000000400UL, x30); TEARDOWN(); @@ -10910,7 +10902,7 @@ TEST(fcvtmu) { __ Fmov(s3, -1.5); __ Fmov(s4, kFP32PositiveInfinity); __ Fmov(s5, kFP32NegativeInfinity); - __ Fmov(s6, 0x7fffff80); // Largest float < INT32_MAX. + __ Fmov(s6, 0x7FFFFF80); // Largest float < INT32_MAX. __ Fneg(s7, s6); // Smallest float > INT32_MIN. __ Fmov(d8, 1.0); __ Fmov(d9, 1.1); @@ -10925,14 +10917,14 @@ TEST(fcvtmu) { __ Fmov(s19, -1.5); __ Fmov(s20, kFP32PositiveInfinity); __ Fmov(s21, kFP32NegativeInfinity); - __ Fmov(s22, 0x7fffff8000000000UL); // Largest float < INT64_MAX. + __ Fmov(s22, 0x7FFFFF8000000000UL); // Largest float < INT64_MAX. __ Fneg(s23, s22); // Smallest float > INT64_MIN. __ Fmov(d24, 1.1); __ Fmov(d25, 1.5); __ Fmov(d26, -1.5); __ Fmov(d27, kFP64PositiveInfinity); __ Fmov(d28, kFP64NegativeInfinity); - __ Fmov(d29, 0x7ffffffffffffc00UL); // Largest double < INT64_MAX. + __ Fmov(d29, 0x7FFFFFFFFFFFFC00UL); // Largest double < INT64_MAX. __ Fneg(d30, d29); // Smallest double > INT64_MIN. __ Fcvtmu(w0, s0); @@ -10972,30 +10964,30 @@ TEST(fcvtmu) { CHECK_EQUAL_64(1, x1); CHECK_EQUAL_64(1, x2); CHECK_EQUAL_64(0, x3); - CHECK_EQUAL_64(0xffffffff, x4); + CHECK_EQUAL_64(0xFFFFFFFF, x4); CHECK_EQUAL_64(0, x5); - CHECK_EQUAL_64(0x7fffff80, x6); + CHECK_EQUAL_64(0x7FFFFF80, x6); CHECK_EQUAL_64(0, x7); CHECK_EQUAL_64(1, x8); CHECK_EQUAL_64(1, x9); CHECK_EQUAL_64(1, x10); CHECK_EQUAL_64(0, x11); - CHECK_EQUAL_64(0xffffffff, x12); + CHECK_EQUAL_64(0xFFFFFFFF, x12); CHECK_EQUAL_64(0, x13); - CHECK_EQUAL_64(0x7ffffffe, x14); + CHECK_EQUAL_64(0x7FFFFFFE, x14); CHECK_EQUAL_64(1, x17); CHECK_EQUAL_64(1, x18); CHECK_EQUAL_64(0x0UL, x19); - CHECK_EQUAL_64(0xffffffffffffffffUL, x20); + CHECK_EQUAL_64(0xFFFFFFFFFFFFFFFFUL, x20); CHECK_EQUAL_64(0x0UL, x21); - CHECK_EQUAL_64(0x7fffff8000000000UL, x22); + CHECK_EQUAL_64(0x7FFFFF8000000000UL, x22); CHECK_EQUAL_64(0x0UL, x23); CHECK_EQUAL_64(1, x24); CHECK_EQUAL_64(1, x25); CHECK_EQUAL_64(0x0UL, x26); - CHECK_EQUAL_64(0xffffffffffffffffUL, x27); + CHECK_EQUAL_64(0xFFFFFFFFFFFFFFFFUL, x27); CHECK_EQUAL_64(0x0UL, x28); - CHECK_EQUAL_64(0x7ffffffffffffc00UL, x29); + CHECK_EQUAL_64(0x7FFFFFFFFFFFFC00UL, x29); CHECK_EQUAL_64(0x0UL, x30); TEARDOWN(); @@ -11013,7 +11005,7 @@ TEST(fcvtns) { __ Fmov(s3, -1.5); __ Fmov(s4, kFP32PositiveInfinity); __ Fmov(s5, kFP32NegativeInfinity); - __ Fmov(s6, 0x7fffff80); // Largest float < INT32_MAX. + __ Fmov(s6, 0x7FFFFF80); // Largest float < INT32_MAX. __ Fneg(s7, s6); // Smallest float > INT32_MIN. __ Fmov(d8, 1.0); __ Fmov(d9, 1.1); @@ -11028,14 +11020,14 @@ TEST(fcvtns) { __ Fmov(s19, -1.5); __ Fmov(s20, kFP32PositiveInfinity); __ Fmov(s21, kFP32NegativeInfinity); - __ Fmov(s22, 0x7fffff8000000000UL); // Largest float < INT64_MAX. + __ Fmov(s22, 0x7FFFFF8000000000UL); // Largest float < INT64_MAX. __ Fneg(s23, s22); // Smallest float > INT64_MIN. __ Fmov(d24, 1.1); __ Fmov(d25, 1.5); __ Fmov(d26, -1.5); __ Fmov(d27, kFP64PositiveInfinity); __ Fmov(d28, kFP64NegativeInfinity); - __ Fmov(d29, 0x7ffffffffffffc00UL); // Largest double < INT64_MAX. + __ Fmov(d29, 0x7FFFFFFFFFFFFC00UL); // Largest double < INT64_MAX. __ Fneg(d30, d29); // Smallest double > INT64_MIN. __ Fcvtns(w0, s0); @@ -11075,32 +11067,32 @@ TEST(fcvtns) { CHECK_EQUAL_64(1, x0); CHECK_EQUAL_64(1, x1); CHECK_EQUAL_64(2, x2); - CHECK_EQUAL_64(0xfffffffe, x3); - CHECK_EQUAL_64(0x7fffffff, x4); + CHECK_EQUAL_64(0xFFFFFFFE, x3); + CHECK_EQUAL_64(0x7FFFFFFF, x4); CHECK_EQUAL_64(0x80000000, x5); - CHECK_EQUAL_64(0x7fffff80, x6); + CHECK_EQUAL_64(0x7FFFFF80, x6); CHECK_EQUAL_64(0x80000080, x7); CHECK_EQUAL_64(1, x8); CHECK_EQUAL_64(1, x9); CHECK_EQUAL_64(2, x10); - CHECK_EQUAL_64(0xfffffffe, x11); - CHECK_EQUAL_64(0x7fffffff, x12); + CHECK_EQUAL_64(0xFFFFFFFE, x11); + CHECK_EQUAL_64(0x7FFFFFFF, x12); CHECK_EQUAL_64(0x80000000, x13); - CHECK_EQUAL_64(0x7ffffffe, x14); + CHECK_EQUAL_64(0x7FFFFFFE, x14); CHECK_EQUAL_64(0x80000001, x15); CHECK_EQUAL_64(1, x17); CHECK_EQUAL_64(2, x18); - CHECK_EQUAL_64(0xfffffffffffffffeUL, x19); - CHECK_EQUAL_64(0x7fffffffffffffffUL, x20); + CHECK_EQUAL_64(0xFFFFFFFFFFFFFFFEUL, x19); + CHECK_EQUAL_64(0x7FFFFFFFFFFFFFFFUL, x20); CHECK_EQUAL_64(0x8000000000000000UL, x21); - CHECK_EQUAL_64(0x7fffff8000000000UL, x22); + CHECK_EQUAL_64(0x7FFFFF8000000000UL, x22); CHECK_EQUAL_64(0x8000008000000000UL, x23); CHECK_EQUAL_64(1, x24); CHECK_EQUAL_64(2, x25); - CHECK_EQUAL_64(0xfffffffffffffffeUL, x26); - CHECK_EQUAL_64(0x7fffffffffffffffUL, x27); -// CHECK_EQUAL_64(0x8000000000000000UL, x28); - CHECK_EQUAL_64(0x7ffffffffffffc00UL, x29); + CHECK_EQUAL_64(0xFFFFFFFFFFFFFFFEUL, x26); + CHECK_EQUAL_64(0x7FFFFFFFFFFFFFFFUL, x27); + // CHECK_EQUAL_64(0x8000000000000000UL, x28); + CHECK_EQUAL_64(0x7FFFFFFFFFFFFC00UL, x29); CHECK_EQUAL_64(0x8000000000000400UL, x30); TEARDOWN(); @@ -11118,27 +11110,27 @@ TEST(fcvtnu) { __ Fmov(s3, -1.5); __ Fmov(s4, kFP32PositiveInfinity); __ Fmov(s5, kFP32NegativeInfinity); - __ Fmov(s6, 0xffffff00); // Largest float < UINT32_MAX. + __ Fmov(s6, 0xFFFFFF00); // Largest float < UINT32_MAX. __ Fmov(d8, 1.0); __ Fmov(d9, 1.1); __ Fmov(d10, 1.5); __ Fmov(d11, -1.5); __ Fmov(d12, kFP64PositiveInfinity); __ Fmov(d13, kFP64NegativeInfinity); - __ Fmov(d14, 0xfffffffe); + __ Fmov(d14, 0xFFFFFFFE); __ Fmov(s16, 1.0); __ Fmov(s17, 1.1); __ Fmov(s18, 1.5); __ Fmov(s19, -1.5); __ Fmov(s20, kFP32PositiveInfinity); __ Fmov(s21, kFP32NegativeInfinity); - __ Fmov(s22, 0xffffff0000000000UL); // Largest float < UINT64_MAX. + __ Fmov(s22, 0xFFFFFF0000000000UL); // Largest float < UINT64_MAX. __ Fmov(d24, 1.1); __ Fmov(d25, 1.5); __ Fmov(d26, -1.5); __ Fmov(d27, kFP64PositiveInfinity); __ Fmov(d28, kFP64NegativeInfinity); - __ Fmov(d29, 0xfffffffffffff800UL); // Largest double < UINT64_MAX. + __ Fmov(d29, 0xFFFFFFFFFFFFF800UL); // Largest double < UINT64_MAX. __ Fmov(s30, 0x100000000UL); __ Fcvtnu(w0, s0); @@ -11178,30 +11170,30 @@ TEST(fcvtnu) { CHECK_EQUAL_64(1, x1); CHECK_EQUAL_64(2, x2); CHECK_EQUAL_64(0, x3); - CHECK_EQUAL_64(0xffffffff, x4); + CHECK_EQUAL_64(0xFFFFFFFF, x4); CHECK_EQUAL_64(0, x5); - CHECK_EQUAL_64(0xffffff00, x6); + CHECK_EQUAL_64(0xFFFFFF00, x6); CHECK_EQUAL_64(1, x8); CHECK_EQUAL_64(1, x9); CHECK_EQUAL_64(2, x10); CHECK_EQUAL_64(0, x11); - CHECK_EQUAL_64(0xffffffff, x12); + CHECK_EQUAL_64(0xFFFFFFFF, x12); CHECK_EQUAL_64(0, x13); - CHECK_EQUAL_64(0xfffffffe, x14); + CHECK_EQUAL_64(0xFFFFFFFE, x14); CHECK_EQUAL_64(1, x16); CHECK_EQUAL_64(1, x17); CHECK_EQUAL_64(2, x18); CHECK_EQUAL_64(0, x19); - CHECK_EQUAL_64(0xffffffffffffffffUL, x20); + CHECK_EQUAL_64(0xFFFFFFFFFFFFFFFFUL, x20); CHECK_EQUAL_64(0, x21); - CHECK_EQUAL_64(0xffffff0000000000UL, x22); + CHECK_EQUAL_64(0xFFFFFF0000000000UL, x22); CHECK_EQUAL_64(1, x24); CHECK_EQUAL_64(2, x25); CHECK_EQUAL_64(0, x26); - CHECK_EQUAL_64(0xffffffffffffffffUL, x27); -// CHECK_EQUAL_64(0, x28); - CHECK_EQUAL_64(0xfffffffffffff800UL, x29); - CHECK_EQUAL_64(0xffffffff, x30); + CHECK_EQUAL_64(0xFFFFFFFFFFFFFFFFUL, x27); + // CHECK_EQUAL_64(0, x28); + CHECK_EQUAL_64(0xFFFFFFFFFFFFF800UL, x29); + CHECK_EQUAL_64(0xFFFFFFFF, x30); TEARDOWN(); } @@ -11218,7 +11210,7 @@ TEST(fcvtzs) { __ Fmov(s3, -1.5); __ Fmov(s4, kFP32PositiveInfinity); __ Fmov(s5, kFP32NegativeInfinity); - __ Fmov(s6, 0x7fffff80); // Largest float < INT32_MAX. + __ Fmov(s6, 0x7FFFFF80); // Largest float < INT32_MAX. __ Fneg(s7, s6); // Smallest float > INT32_MIN. __ Fmov(d8, 1.0); __ Fmov(d9, 1.1); @@ -11233,14 +11225,14 @@ TEST(fcvtzs) { __ Fmov(s19, -1.5); __ Fmov(s20, kFP32PositiveInfinity); __ Fmov(s21, kFP32NegativeInfinity); - __ Fmov(s22, 0x7fffff8000000000UL); // Largest float < INT64_MAX. + __ Fmov(s22, 0x7FFFFF8000000000UL); // Largest float < INT64_MAX. __ Fneg(s23, s22); // Smallest float > INT64_MIN. __ Fmov(d24, 1.1); __ Fmov(d25, 1.5); __ Fmov(d26, -1.5); __ Fmov(d27, kFP64PositiveInfinity); __ Fmov(d28, kFP64NegativeInfinity); - __ Fmov(d29, 0x7ffffffffffffc00UL); // Largest double < INT64_MAX. + __ Fmov(d29, 0x7FFFFFFFFFFFFC00UL); // Largest double < INT64_MAX. __ Fneg(d30, d29); // Smallest double > INT64_MIN. __ Fcvtzs(w0, s0); @@ -11280,32 +11272,32 @@ TEST(fcvtzs) { CHECK_EQUAL_64(1, x0); CHECK_EQUAL_64(1, x1); CHECK_EQUAL_64(1, x2); - CHECK_EQUAL_64(0xffffffff, x3); - CHECK_EQUAL_64(0x7fffffff, x4); + CHECK_EQUAL_64(0xFFFFFFFF, x3); + CHECK_EQUAL_64(0x7FFFFFFF, x4); CHECK_EQUAL_64(0x80000000, x5); - CHECK_EQUAL_64(0x7fffff80, x6); + CHECK_EQUAL_64(0x7FFFFF80, x6); CHECK_EQUAL_64(0x80000080, x7); CHECK_EQUAL_64(1, x8); CHECK_EQUAL_64(1, x9); CHECK_EQUAL_64(1, x10); - CHECK_EQUAL_64(0xffffffff, x11); - CHECK_EQUAL_64(0x7fffffff, x12); + CHECK_EQUAL_64(0xFFFFFFFF, x11); + CHECK_EQUAL_64(0x7FFFFFFF, x12); CHECK_EQUAL_64(0x80000000, x13); - CHECK_EQUAL_64(0x7ffffffe, x14); + CHECK_EQUAL_64(0x7FFFFFFE, x14); CHECK_EQUAL_64(0x80000001, x15); CHECK_EQUAL_64(1, x17); CHECK_EQUAL_64(1, x18); - CHECK_EQUAL_64(0xffffffffffffffffUL, x19); - CHECK_EQUAL_64(0x7fffffffffffffffUL, x20); + CHECK_EQUAL_64(0xFFFFFFFFFFFFFFFFUL, x19); + CHECK_EQUAL_64(0x7FFFFFFFFFFFFFFFUL, x20); CHECK_EQUAL_64(0x8000000000000000UL, x21); - CHECK_EQUAL_64(0x7fffff8000000000UL, x22); + CHECK_EQUAL_64(0x7FFFFF8000000000UL, x22); CHECK_EQUAL_64(0x8000008000000000UL, x23); CHECK_EQUAL_64(1, x24); CHECK_EQUAL_64(1, x25); - CHECK_EQUAL_64(0xffffffffffffffffUL, x26); - CHECK_EQUAL_64(0x7fffffffffffffffUL, x27); + CHECK_EQUAL_64(0xFFFFFFFFFFFFFFFFUL, x26); + CHECK_EQUAL_64(0x7FFFFFFFFFFFFFFFUL, x27); CHECK_EQUAL_64(0x8000000000000000UL, x28); - CHECK_EQUAL_64(0x7ffffffffffffc00UL, x29); + CHECK_EQUAL_64(0x7FFFFFFFFFFFFC00UL, x29); CHECK_EQUAL_64(0x8000000000000400UL, x30); TEARDOWN(); @@ -11323,7 +11315,7 @@ TEST(fcvtzu) { __ Fmov(s3, -1.5); __ Fmov(s4, kFP32PositiveInfinity); __ Fmov(s5, kFP32NegativeInfinity); - __ Fmov(s6, 0x7fffff80); // Largest float < INT32_MAX. + __ Fmov(s6, 0x7FFFFF80); // Largest float < INT32_MAX. __ Fneg(s7, s6); // Smallest float > INT32_MIN. __ Fmov(d8, 1.0); __ Fmov(d9, 1.1); @@ -11338,14 +11330,14 @@ TEST(fcvtzu) { __ Fmov(s19, -1.5); __ Fmov(s20, kFP32PositiveInfinity); __ Fmov(s21, kFP32NegativeInfinity); - __ Fmov(s22, 0x7fffff8000000000UL); // Largest float < INT64_MAX. + __ Fmov(s22, 0x7FFFFF8000000000UL); // Largest float < INT64_MAX. __ Fneg(s23, s22); // Smallest float > INT64_MIN. __ Fmov(d24, 1.1); __ Fmov(d25, 1.5); __ Fmov(d26, -1.5); __ Fmov(d27, kFP64PositiveInfinity); __ Fmov(d28, kFP64NegativeInfinity); - __ Fmov(d29, 0x7ffffffffffffc00UL); // Largest double < INT64_MAX. + __ Fmov(d29, 0x7FFFFFFFFFFFFC00UL); // Largest double < INT64_MAX. __ Fneg(d30, d29); // Smallest double > INT64_MIN. __ Fcvtzu(w0, s0); @@ -11385,30 +11377,30 @@ TEST(fcvtzu) { CHECK_EQUAL_64(1, x1); CHECK_EQUAL_64(1, x2); CHECK_EQUAL_64(0, x3); - CHECK_EQUAL_64(0xffffffff, x4); + CHECK_EQUAL_64(0xFFFFFFFF, x4); CHECK_EQUAL_64(0, x5); - CHECK_EQUAL_64(0x7fffff80, x6); + CHECK_EQUAL_64(0x7FFFFF80, x6); CHECK_EQUAL_64(0, x7); CHECK_EQUAL_64(1, x8); CHECK_EQUAL_64(1, x9); CHECK_EQUAL_64(1, x10); CHECK_EQUAL_64(0, x11); - CHECK_EQUAL_64(0xffffffff, x12); + CHECK_EQUAL_64(0xFFFFFFFF, x12); CHECK_EQUAL_64(0, x13); - CHECK_EQUAL_64(0x7ffffffe, x14); + CHECK_EQUAL_64(0x7FFFFFFE, x14); CHECK_EQUAL_64(1, x17); CHECK_EQUAL_64(1, x18); CHECK_EQUAL_64(0x0UL, x19); - CHECK_EQUAL_64(0xffffffffffffffffUL, x20); + CHECK_EQUAL_64(0xFFFFFFFFFFFFFFFFUL, x20); CHECK_EQUAL_64(0x0UL, x21); - CHECK_EQUAL_64(0x7fffff8000000000UL, x22); + CHECK_EQUAL_64(0x7FFFFF8000000000UL, x22); CHECK_EQUAL_64(0x0UL, x23); CHECK_EQUAL_64(1, x24); CHECK_EQUAL_64(1, x25); CHECK_EQUAL_64(0x0UL, x26); - CHECK_EQUAL_64(0xffffffffffffffffUL, x27); + CHECK_EQUAL_64(0xFFFFFFFFFFFFFFFFUL, x27); CHECK_EQUAL_64(0x0UL, x28); - CHECK_EQUAL_64(0x7ffffffffffffc00UL, x29); + CHECK_EQUAL_64(0x7FFFFFFFFFFFFC00UL, x29); CHECK_EQUAL_64(0x0UL, x30); TEARDOWN(); @@ -11429,9 +11421,9 @@ static void TestUScvtfHelper(uint64_t in, uint64_t expected_scvtf_bits, uint64_t expected_ucvtf_bits) { uint64_t u64 = in; - uint32_t u32 = u64 & 0xffffffff; + uint32_t u32 = u64 & 0xFFFFFFFF; int64_t s64 = static_cast<int64_t>(in); - int32_t s32 = s64 & 0x7fffffff; + int32_t s32 = s64 & 0x7FFFFFFF; bool cvtf_s32 = (s64 == s32); bool cvtf_u32 = (u64 == u32); @@ -11519,63 +11511,63 @@ TEST(scvtf_ucvtf_double) { // results should not depened on the rounding mode, and ucvtf and scvtf should // produce the same result. TestUScvtfHelper(0x0000000000000000, 0x0000000000000000, 0x0000000000000000); - TestUScvtfHelper(0x0000000000000001, 0x3ff0000000000000, 0x3ff0000000000000); - TestUScvtfHelper(0x0000000040000000, 0x41d0000000000000, 0x41d0000000000000); - TestUScvtfHelper(0x0000000100000000, 0x41f0000000000000, 0x41f0000000000000); - TestUScvtfHelper(0x4000000000000000, 0x43d0000000000000, 0x43d0000000000000); + TestUScvtfHelper(0x0000000000000001, 0x3FF0000000000000, 0x3FF0000000000000); + TestUScvtfHelper(0x0000000040000000, 0x41D0000000000000, 0x41D0000000000000); + TestUScvtfHelper(0x0000000100000000, 0x41F0000000000000, 0x41F0000000000000); + TestUScvtfHelper(0x4000000000000000, 0x43D0000000000000, 0x43D0000000000000); // Test mantissa extremities. - TestUScvtfHelper(0x4000000000000400, 0x43d0000000000001, 0x43d0000000000001); + TestUScvtfHelper(0x4000000000000400, 0x43D0000000000001, 0x43D0000000000001); // The largest int32_t that fits in a double. - TestUScvtfHelper(0x000000007fffffff, 0x41dfffffffc00000, 0x41dfffffffc00000); + TestUScvtfHelper(0x000000007FFFFFFF, 0x41DFFFFFFFC00000, 0x41DFFFFFFFC00000); // Values that would be negative if treated as an int32_t. - TestUScvtfHelper(0x00000000ffffffff, 0x41efffffffe00000, 0x41efffffffe00000); - TestUScvtfHelper(0x0000000080000000, 0x41e0000000000000, 0x41e0000000000000); - TestUScvtfHelper(0x0000000080000001, 0x41e0000000200000, 0x41e0000000200000); + TestUScvtfHelper(0x00000000FFFFFFFF, 0x41EFFFFFFFE00000, 0x41EFFFFFFFE00000); + TestUScvtfHelper(0x0000000080000000, 0x41E0000000000000, 0x41E0000000000000); + TestUScvtfHelper(0x0000000080000001, 0x41E0000000200000, 0x41E0000000200000); // The largest int64_t that fits in a double. - TestUScvtfHelper(0x7ffffffffffffc00, 0x43dfffffffffffff, 0x43dfffffffffffff); + TestUScvtfHelper(0x7FFFFFFFFFFFFC00, 0x43DFFFFFFFFFFFFF, 0x43DFFFFFFFFFFFFF); // Check for bit pattern reproduction. - TestUScvtfHelper(0x0123456789abcde0, 0x43723456789abcde, 0x43723456789abcde); - TestUScvtfHelper(0x0000000012345678, 0x41b2345678000000, 0x41b2345678000000); + TestUScvtfHelper(0x0123456789ABCDE0, 0x43723456789ABCDE, 0x43723456789ABCDE); + TestUScvtfHelper(0x0000000012345678, 0x41B2345678000000, 0x41B2345678000000); // Simple conversions of negative int64_t values. These require no rounding, // and the results should not depend on the rounding mode. - TestUScvtfHelper(0xffffffffc0000000, 0xc1d0000000000000, 0x43effffffff80000); - TestUScvtfHelper(0xffffffff00000000, 0xc1f0000000000000, 0x43efffffffe00000); - TestUScvtfHelper(0xc000000000000000, 0xc3d0000000000000, 0x43e8000000000000); + TestUScvtfHelper(0xFFFFFFFFC0000000, 0xC1D0000000000000, 0x43EFFFFFFFF80000); + TestUScvtfHelper(0xFFFFFFFF00000000, 0xC1F0000000000000, 0x43EFFFFFFFE00000); + TestUScvtfHelper(0xC000000000000000, 0xC3D0000000000000, 0x43E8000000000000); // Conversions which require rounding. - TestUScvtfHelper(0x1000000000000000, 0x43b0000000000000, 0x43b0000000000000); - TestUScvtfHelper(0x1000000000000001, 0x43b0000000000000, 0x43b0000000000000); - TestUScvtfHelper(0x1000000000000080, 0x43b0000000000000, 0x43b0000000000000); - TestUScvtfHelper(0x1000000000000081, 0x43b0000000000001, 0x43b0000000000001); - TestUScvtfHelper(0x1000000000000100, 0x43b0000000000001, 0x43b0000000000001); - TestUScvtfHelper(0x1000000000000101, 0x43b0000000000001, 0x43b0000000000001); - TestUScvtfHelper(0x1000000000000180, 0x43b0000000000002, 0x43b0000000000002); - TestUScvtfHelper(0x1000000000000181, 0x43b0000000000002, 0x43b0000000000002); - TestUScvtfHelper(0x1000000000000200, 0x43b0000000000002, 0x43b0000000000002); - TestUScvtfHelper(0x1000000000000201, 0x43b0000000000002, 0x43b0000000000002); - TestUScvtfHelper(0x1000000000000280, 0x43b0000000000002, 0x43b0000000000002); - TestUScvtfHelper(0x1000000000000281, 0x43b0000000000003, 0x43b0000000000003); - TestUScvtfHelper(0x1000000000000300, 0x43b0000000000003, 0x43b0000000000003); + TestUScvtfHelper(0x1000000000000000, 0x43B0000000000000, 0x43B0000000000000); + TestUScvtfHelper(0x1000000000000001, 0x43B0000000000000, 0x43B0000000000000); + TestUScvtfHelper(0x1000000000000080, 0x43B0000000000000, 0x43B0000000000000); + TestUScvtfHelper(0x1000000000000081, 0x43B0000000000001, 0x43B0000000000001); + TestUScvtfHelper(0x1000000000000100, 0x43B0000000000001, 0x43B0000000000001); + TestUScvtfHelper(0x1000000000000101, 0x43B0000000000001, 0x43B0000000000001); + TestUScvtfHelper(0x1000000000000180, 0x43B0000000000002, 0x43B0000000000002); + TestUScvtfHelper(0x1000000000000181, 0x43B0000000000002, 0x43B0000000000002); + TestUScvtfHelper(0x1000000000000200, 0x43B0000000000002, 0x43B0000000000002); + TestUScvtfHelper(0x1000000000000201, 0x43B0000000000002, 0x43B0000000000002); + TestUScvtfHelper(0x1000000000000280, 0x43B0000000000002, 0x43B0000000000002); + TestUScvtfHelper(0x1000000000000281, 0x43B0000000000003, 0x43B0000000000003); + TestUScvtfHelper(0x1000000000000300, 0x43B0000000000003, 0x43B0000000000003); // Check rounding of negative int64_t values (and large uint64_t values). - TestUScvtfHelper(0x8000000000000000, 0xc3e0000000000000, 0x43e0000000000000); - TestUScvtfHelper(0x8000000000000001, 0xc3e0000000000000, 0x43e0000000000000); - TestUScvtfHelper(0x8000000000000200, 0xc3e0000000000000, 0x43e0000000000000); - TestUScvtfHelper(0x8000000000000201, 0xc3dfffffffffffff, 0x43e0000000000000); - TestUScvtfHelper(0x8000000000000400, 0xc3dfffffffffffff, 0x43e0000000000000); - TestUScvtfHelper(0x8000000000000401, 0xc3dfffffffffffff, 0x43e0000000000001); - TestUScvtfHelper(0x8000000000000600, 0xc3dffffffffffffe, 0x43e0000000000001); - TestUScvtfHelper(0x8000000000000601, 0xc3dffffffffffffe, 0x43e0000000000001); - TestUScvtfHelper(0x8000000000000800, 0xc3dffffffffffffe, 0x43e0000000000001); - TestUScvtfHelper(0x8000000000000801, 0xc3dffffffffffffe, 0x43e0000000000001); - TestUScvtfHelper(0x8000000000000a00, 0xc3dffffffffffffe, 0x43e0000000000001); - TestUScvtfHelper(0x8000000000000a01, 0xc3dffffffffffffd, 0x43e0000000000001); - TestUScvtfHelper(0x8000000000000c00, 0xc3dffffffffffffd, 0x43e0000000000002); + TestUScvtfHelper(0x8000000000000000, 0xC3E0000000000000, 0x43E0000000000000); + TestUScvtfHelper(0x8000000000000001, 0xC3E0000000000000, 0x43E0000000000000); + TestUScvtfHelper(0x8000000000000200, 0xC3E0000000000000, 0x43E0000000000000); + TestUScvtfHelper(0x8000000000000201, 0xC3DFFFFFFFFFFFFF, 0x43E0000000000000); + TestUScvtfHelper(0x8000000000000400, 0xC3DFFFFFFFFFFFFF, 0x43E0000000000000); + TestUScvtfHelper(0x8000000000000401, 0xC3DFFFFFFFFFFFFF, 0x43E0000000000001); + TestUScvtfHelper(0x8000000000000600, 0xC3DFFFFFFFFFFFFE, 0x43E0000000000001); + TestUScvtfHelper(0x8000000000000601, 0xC3DFFFFFFFFFFFFE, 0x43E0000000000001); + TestUScvtfHelper(0x8000000000000800, 0xC3DFFFFFFFFFFFFE, 0x43E0000000000001); + TestUScvtfHelper(0x8000000000000801, 0xC3DFFFFFFFFFFFFE, 0x43E0000000000001); + TestUScvtfHelper(0x8000000000000A00, 0xC3DFFFFFFFFFFFFE, 0x43E0000000000001); + TestUScvtfHelper(0x8000000000000A01, 0xC3DFFFFFFFFFFFFD, 0x43E0000000000001); + TestUScvtfHelper(0x8000000000000C00, 0xC3DFFFFFFFFFFFFD, 0x43E0000000000002); // Round up to produce a result that's too big for the input to represent. - TestUScvtfHelper(0x7ffffffffffffe00, 0x43e0000000000000, 0x43e0000000000000); - TestUScvtfHelper(0x7fffffffffffffff, 0x43e0000000000000, 0x43e0000000000000); - TestUScvtfHelper(0xfffffffffffffc00, 0xc090000000000000, 0x43f0000000000000); - TestUScvtfHelper(0xffffffffffffffff, 0xbff0000000000000, 0x43f0000000000000); + TestUScvtfHelper(0x7FFFFFFFFFFFFE00, 0x43E0000000000000, 0x43E0000000000000); + TestUScvtfHelper(0x7FFFFFFFFFFFFFFF, 0x43E0000000000000, 0x43E0000000000000); + TestUScvtfHelper(0xFFFFFFFFFFFFFC00, 0xC090000000000000, 0x43F0000000000000); + TestUScvtfHelper(0xFFFFFFFFFFFFFFFF, 0xBFF0000000000000, 0x43F0000000000000); } @@ -11584,9 +11576,9 @@ static void TestUScvtf32Helper(uint64_t in, uint32_t expected_scvtf_bits, uint32_t expected_ucvtf_bits) { uint64_t u64 = in; - uint32_t u32 = u64 & 0xffffffff; + uint32_t u32 = u64 & 0xFFFFFFFF; int64_t s64 = static_cast<int64_t>(in); - int32_t s32 = s64 & 0x7fffffff; + int32_t s32 = s64 & 0x7FFFFFFF; bool cvtf_s32 = (s64 == s32); bool cvtf_u32 = (u64 == u32); @@ -11656,10 +11648,8 @@ static void TestUScvtf32Helper(uint64_t in, CHECK_EQUAL_FP32(expected_ucvtf, results_ucvtf_x[fbits]); if (cvtf_s32) CHECK_EQUAL_FP32(expected_scvtf, results_scvtf_w[fbits]); if (cvtf_u32) CHECK_EQUAL_FP32(expected_ucvtf, results_ucvtf_w[fbits]); - break; } for (int fbits = 33; fbits <= 64; fbits++) { - break; float expected_scvtf = expected_scvtf_base / powf(2, fbits); float expected_ucvtf = expected_ucvtf_base / powf(2, fbits); CHECK_EQUAL_FP32(expected_scvtf, results_scvtf_x[fbits]); @@ -11676,28 +11666,28 @@ TEST(scvtf_ucvtf_float) { // results should not depened on the rounding mode, and ucvtf and scvtf should // produce the same result. TestUScvtf32Helper(0x0000000000000000, 0x00000000, 0x00000000); - TestUScvtf32Helper(0x0000000000000001, 0x3f800000, 0x3f800000); - TestUScvtf32Helper(0x0000000040000000, 0x4e800000, 0x4e800000); - TestUScvtf32Helper(0x0000000100000000, 0x4f800000, 0x4f800000); - TestUScvtf32Helper(0x4000000000000000, 0x5e800000, 0x5e800000); + TestUScvtf32Helper(0x0000000000000001, 0x3F800000, 0x3F800000); + TestUScvtf32Helper(0x0000000040000000, 0x4E800000, 0x4E800000); + TestUScvtf32Helper(0x0000000100000000, 0x4F800000, 0x4F800000); + TestUScvtf32Helper(0x4000000000000000, 0x5E800000, 0x5E800000); // Test mantissa extremities. - TestUScvtf32Helper(0x0000000000800001, 0x4b000001, 0x4b000001); - TestUScvtf32Helper(0x4000008000000000, 0x5e800001, 0x5e800001); + TestUScvtf32Helper(0x0000000000800001, 0x4B000001, 0x4B000001); + TestUScvtf32Helper(0x4000008000000000, 0x5E800001, 0x5E800001); // The largest int32_t that fits in a float. - TestUScvtf32Helper(0x000000007fffff80, 0x4effffff, 0x4effffff); + TestUScvtf32Helper(0x000000007FFFFF80, 0x4EFFFFFF, 0x4EFFFFFF); // Values that would be negative if treated as an int32_t. - TestUScvtf32Helper(0x00000000ffffff00, 0x4f7fffff, 0x4f7fffff); - TestUScvtf32Helper(0x0000000080000000, 0x4f000000, 0x4f000000); - TestUScvtf32Helper(0x0000000080000100, 0x4f000001, 0x4f000001); + TestUScvtf32Helper(0x00000000FFFFFF00, 0x4F7FFFFF, 0x4F7FFFFF); + TestUScvtf32Helper(0x0000000080000000, 0x4F000000, 0x4F000000); + TestUScvtf32Helper(0x0000000080000100, 0x4F000001, 0x4F000001); // The largest int64_t that fits in a float. - TestUScvtf32Helper(0x7fffff8000000000, 0x5effffff, 0x5effffff); + TestUScvtf32Helper(0x7FFFFF8000000000, 0x5EFFFFFF, 0x5EFFFFFF); // Check for bit pattern reproduction. - TestUScvtf32Helper(0x0000000000876543, 0x4b076543, 0x4b076543); + TestUScvtf32Helper(0x0000000000876543, 0x4B076543, 0x4B076543); // Simple conversions of negative int64_t values. These require no rounding, // and the results should not depend on the rounding mode. - TestUScvtf32Helper(0xfffffc0000000000, 0xd4800000, 0x5f7ffffc); - TestUScvtf32Helper(0xc000000000000000, 0xde800000, 0x5f400000); + TestUScvtf32Helper(0xFFFFFC0000000000, 0xD4800000, 0x5F7FFFFC); + TestUScvtf32Helper(0xC000000000000000, 0xDE800000, 0x5F400000); // Conversions which require rounding. TestUScvtf32Helper(0x0000800000000000, 0x57000000, 0x57000000); @@ -11714,28 +11704,28 @@ TEST(scvtf_ucvtf_float) { TestUScvtf32Helper(0x0000800002800001, 0x57000003, 0x57000003); TestUScvtf32Helper(0x0000800003000000, 0x57000003, 0x57000003); // Check rounding of negative int64_t values (and large uint64_t values). - TestUScvtf32Helper(0x8000000000000000, 0xdf000000, 0x5f000000); - TestUScvtf32Helper(0x8000000000000001, 0xdf000000, 0x5f000000); - TestUScvtf32Helper(0x8000004000000000, 0xdf000000, 0x5f000000); - TestUScvtf32Helper(0x8000004000000001, 0xdeffffff, 0x5f000000); - TestUScvtf32Helper(0x8000008000000000, 0xdeffffff, 0x5f000000); - TestUScvtf32Helper(0x8000008000000001, 0xdeffffff, 0x5f000001); - TestUScvtf32Helper(0x800000c000000000, 0xdefffffe, 0x5f000001); - TestUScvtf32Helper(0x800000c000000001, 0xdefffffe, 0x5f000001); - TestUScvtf32Helper(0x8000010000000000, 0xdefffffe, 0x5f000001); - TestUScvtf32Helper(0x8000010000000001, 0xdefffffe, 0x5f000001); - TestUScvtf32Helper(0x8000014000000000, 0xdefffffe, 0x5f000001); - TestUScvtf32Helper(0x8000014000000001, 0xdefffffd, 0x5f000001); - TestUScvtf32Helper(0x8000018000000000, 0xdefffffd, 0x5f000002); + TestUScvtf32Helper(0x8000000000000000, 0xDF000000, 0x5F000000); + TestUScvtf32Helper(0x8000000000000001, 0xDF000000, 0x5F000000); + TestUScvtf32Helper(0x8000004000000000, 0xDF000000, 0x5F000000); + TestUScvtf32Helper(0x8000004000000001, 0xDEFFFFFF, 0x5F000000); + TestUScvtf32Helper(0x8000008000000000, 0xDEFFFFFF, 0x5F000000); + TestUScvtf32Helper(0x8000008000000001, 0xDEFFFFFF, 0x5F000001); + TestUScvtf32Helper(0x800000C000000000, 0xDEFFFFFE, 0x5F000001); + TestUScvtf32Helper(0x800000C000000001, 0xDEFFFFFE, 0x5F000001); + TestUScvtf32Helper(0x8000010000000000, 0xDEFFFFFE, 0x5F000001); + TestUScvtf32Helper(0x8000010000000001, 0xDEFFFFFE, 0x5F000001); + TestUScvtf32Helper(0x8000014000000000, 0xDEFFFFFE, 0x5F000001); + TestUScvtf32Helper(0x8000014000000001, 0xDEFFFFFD, 0x5F000001); + TestUScvtf32Helper(0x8000018000000000, 0xDEFFFFFD, 0x5F000002); // Round up to produce a result that's too big for the input to represent. - TestUScvtf32Helper(0x000000007fffffc0, 0x4f000000, 0x4f000000); - TestUScvtf32Helper(0x000000007fffffff, 0x4f000000, 0x4f000000); - TestUScvtf32Helper(0x00000000ffffff80, 0x4f800000, 0x4f800000); - TestUScvtf32Helper(0x00000000ffffffff, 0x4f800000, 0x4f800000); - TestUScvtf32Helper(0x7fffffc000000000, 0x5f000000, 0x5f000000); - TestUScvtf32Helper(0x7fffffffffffffff, 0x5f000000, 0x5f000000); - TestUScvtf32Helper(0xffffff8000000000, 0xd3000000, 0x5f800000); - TestUScvtf32Helper(0xffffffffffffffff, 0xbf800000, 0x5f800000); + TestUScvtf32Helper(0x000000007FFFFFC0, 0x4F000000, 0x4F000000); + TestUScvtf32Helper(0x000000007FFFFFFF, 0x4F000000, 0x4F000000); + TestUScvtf32Helper(0x00000000FFFFFF80, 0x4F800000, 0x4F800000); + TestUScvtf32Helper(0x00000000FFFFFFFF, 0x4F800000, 0x4F800000); + TestUScvtf32Helper(0x7FFFFFC000000000, 0x5F000000, 0x5F000000); + TestUScvtf32Helper(0x7FFFFFFFFFFFFFFF, 0x5F000000, 0x5F000000); + TestUScvtf32Helper(0xFFFFFF8000000000, 0xD3000000, 0x5F800000); + TestUScvtf32Helper(0xFFFFFFFFFFFFFFFF, 0xBF800000, 0x5F800000); } @@ -11782,18 +11772,18 @@ TEST(system_mrs) { TEST(system_msr) { INIT_V8(); // All FPCR fields that must be implemented: AHP, DN, FZ, RMode - const uint64_t fpcr_core = 0x07c00000; + const uint64_t fpcr_core = 0x07C00000; // All FPCR fields (including fields which may be read-as-zero): // Stride, Len // IDE, IXE, UFE, OFE, DZE, IOE - const uint64_t fpcr_all = fpcr_core | 0x00379f00; + const uint64_t fpcr_all = fpcr_core | 0x00379F00; SETUP(); START(); __ Mov(w0, 0); - __ Mov(w1, 0x7fffffff); + __ Mov(w1, 0x7FFFFFFF); __ Mov(x7, 0); @@ -11963,14 +11953,14 @@ TEST(zero_dest_setflags) { __ adds(xzr, x1, xzr); __ adds(xzr, xzr, x1); - __ ands(xzr, x2, ~0xf); - __ ands(xzr, xzr, ~0xf); + __ ands(xzr, x2, ~0xF); + __ ands(xzr, xzr, ~0xF); __ ands(xzr, x0, x2); __ ands(xzr, x2, xzr); __ ands(xzr, xzr, x2); - __ bics(xzr, x3, ~0xf); - __ bics(xzr, xzr, ~0xf); + __ bics(xzr, x3, ~0xF); + __ bics(xzr, xzr, ~0xF); __ bics(xzr, x0, x3); __ bics(xzr, x3, xzr); __ bics(xzr, xzr, x3); @@ -12018,7 +12008,6 @@ TEST(register_bit) { CHECK(xzr.bit() == (1UL << kZeroRegCode)); // Internal ABI definitions. - CHECK(jssp.bit() == (1UL << kJSSPCode)); CHECK(csp.bit() == (1UL << kSPRegInternalCode)); CHECK(csp.bit() != xzr.bit()); @@ -12026,35 +12015,11 @@ TEST(register_bit) { CHECK(x0.bit() == w0.bit()); CHECK(x1.bit() == w1.bit()); CHECK(x10.bit() == w10.bit()); - CHECK(jssp.bit() == wjssp.bit()); CHECK(xzr.bit() == wzr.bit()); CHECK(csp.bit() == wcsp.bit()); } -TEST(stack_pointer_override) { - // This test generates some stack maintenance code, but the test only checks - // the reported state. - INIT_V8(); - SETUP(); - START(); - - // The default stack pointer in V8 is jssp, but for compatibility with W16, - // the test framework sets it to csp before calling the test. - CHECK(csp.Is(__ StackPointer())); - __ SetStackPointer(x0); - CHECK(x0.Is(__ StackPointer())); - __ SetStackPointer(jssp); - CHECK(jssp.Is(__ StackPointer())); - __ SetStackPointer(csp); - CHECK(csp.Is(__ StackPointer())); - - END(); - RUN(); - TEARDOWN(); -} - - TEST(peek_poke_simple) { INIT_V8(); SETUP(); @@ -12113,10 +12078,10 @@ TEST(peek_poke_simple) { CHECK_EQUAL_64(literal_base * 3, x2); CHECK_EQUAL_64(literal_base * 4, x3); - CHECK_EQUAL_64((literal_base * 1) & 0xffffffff, x10); - CHECK_EQUAL_64((literal_base * 2) & 0xffffffff, x11); - CHECK_EQUAL_64((literal_base * 3) & 0xffffffff, x12); - CHECK_EQUAL_64((literal_base * 4) & 0xffffffff, x13); + CHECK_EQUAL_64((literal_base * 1) & 0xFFFFFFFF, x10); + CHECK_EQUAL_64((literal_base * 2) & 0xFFFFFFFF, x11); + CHECK_EQUAL_64((literal_base * 3) & 0xFFFFFFFF, x12); + CHECK_EQUAL_64((literal_base * 4) & 0xFFFFFFFF, x13); TEARDOWN(); } @@ -12194,9 +12159,9 @@ TEST(peek_poke_unaligned) { CHECK_EQUAL_64(literal_base * 6, x5); CHECK_EQUAL_64(literal_base * 7, x6); - CHECK_EQUAL_64((literal_base * 1) & 0xffffffff, x10); - CHECK_EQUAL_64((literal_base * 2) & 0xffffffff, x11); - CHECK_EQUAL_64((literal_base * 3) & 0xffffffff, x12); + CHECK_EQUAL_64((literal_base * 1) & 0xFFFFFFFF, x10); + CHECK_EQUAL_64((literal_base * 2) & 0xFFFFFFFF, x11); + CHECK_EQUAL_64((literal_base * 3) & 0xFFFFFFFF, x12); TEARDOWN(); } @@ -12240,8 +12205,8 @@ TEST(peek_poke_endianness) { uint64_t x0_expected = literal_base * 1; uint64_t x1_expected = literal_base * 2; uint64_t x4_expected = (x0_expected << 32) | (x0_expected >> 32); - uint64_t x5_expected = ((x1_expected << 16) & 0xffff0000) | - ((x1_expected >> 16) & 0x0000ffff); + uint64_t x5_expected = + ((x1_expected << 16) & 0xFFFF0000) | ((x1_expected >> 16) & 0x0000FFFF); CHECK_EQUAL_64(x0_expected, x0); CHECK_EQUAL_64(x1_expected, x1); @@ -12280,23 +12245,16 @@ TEST(peek_poke_mixed) { __ Poke(x1, 8); __ Poke(x0, 0); { - CHECK(__ StackPointer().Is(csp)); - __ Mov(x4, __ StackPointer()); - __ SetStackPointer(x4); - - __ Poke(wzr, 0); // Clobber the space we're about to drop. - __ Drop(1, kWRegSize); - __ Peek(x6, 0); - __ Claim(1); - __ Peek(w7, 10); - __ Poke(x3, 28); + __ Peek(x6, 4); + __ Peek(w7, 6); __ Poke(xzr, 0); // Clobber the space we're about to drop. - __ Drop(1); - __ Poke(x2, 12); - __ Push(w0); - - __ Mov(csp, __ StackPointer()); - __ SetStackPointer(csp); + __ Poke(xzr, 8); // Clobber the space we're about to drop. + __ Drop(2); + __ Poke(x3, 8); + __ Poke(x2, 0); + __ Claim(2); + __ Poke(x0, 0); + __ Poke(x1, 8); } __ Pop(x0, x1, x2, x3); @@ -12309,8 +12267,8 @@ TEST(peek_poke_mixed) { uint64_t x2_expected = literal_base * 3; uint64_t x3_expected = literal_base * 4; uint64_t x6_expected = (x1_expected << 32) | (x0_expected >> 32); - uint64_t x7_expected = ((x1_expected << 16) & 0xffff0000) | - ((x0_expected >> 48) & 0x0000ffff); + uint64_t x7_expected = + ((x1_expected << 16) & 0xFFFF0000) | ((x0_expected >> 48) & 0x0000FFFF); CHECK_EQUAL_64(x0_expected, x0); CHECK_EQUAL_64(x1_expected, x1); @@ -12333,34 +12291,28 @@ enum PushPopMethod { PushPopRegList }; - -// The maximum number of registers that can be used by the PushPopJssp* tests, +// The maximum number of registers that can be used by the PushPop* tests, // where a reg_count field is provided. -static int const kPushPopJsspMaxRegCount = -1; +static int const kPushPopMaxRegCount = -1; // Test a simple push-pop pattern: -// * Claim <claim> bytes to set the stack alignment. // * Push <reg_count> registers with size <reg_size>. // * Clobber the register contents. // * Pop <reg_count> registers to restore the original contents. -// * Drop <claim> bytes to restore the original stack pointer. // // Different push and pop methods can be specified independently to test for // proper word-endian behaviour. -static void PushPopJsspSimpleHelper(int reg_count, - int claim, - int reg_size, - PushPopMethod push_method, - PushPopMethod pop_method) { +static void PushPopSimpleHelper(int reg_count, int reg_size, + PushPopMethod push_method, + PushPopMethod pop_method) { SETUP(); START(); // Registers in the TmpList can be used by the macro assembler for debug code - // (for example in 'Pop'), so we can't use them here. We can't use jssp - // because it will be the stack pointer for this test. - static RegList const allowed = ~(masm.TmpList()->list() | jssp.bit()); - if (reg_count == kPushPopJsspMaxRegCount) { + // (for example in 'Pop'), so we can't use them here. + static RegList const allowed = ~(masm.TmpList()->list()); + if (reg_count == kPushPopMaxRegCount) { reg_count = CountSetBits(allowed, kNumberOfRegisters); } // Work out which registers to use, based on reg_size. @@ -12377,10 +12329,6 @@ static void PushPopJsspSimpleHelper(int reg_count, uint64_t literal_base = 0x0100001000100101UL; { - CHECK(__ StackPointer().Is(csp)); - __ Mov(jssp, __ StackPointer()); - __ SetStackPointer(jssp); - int i; // Initialize the registers. @@ -12392,9 +12340,6 @@ static void PushPopJsspSimpleHelper(int reg_count, } } - // Claim memory first, as requested. - __ Claim(claim, kByteSizeInBytes); - switch (push_method) { case PushPopByFour: // Push high-numbered registers first (to the highest addresses). @@ -12439,12 +12384,6 @@ static void PushPopJsspSimpleHelper(int reg_count, __ PopSizeRegList(list, reg_size); break; } - - // Drop memory to restore jssp. - __ Drop(claim, kByteSizeInBytes); - - __ Mov(csp, __ StackPointer()); - __ SetStackPointer(csp); } END(); @@ -12454,7 +12393,7 @@ static void PushPopJsspSimpleHelper(int reg_count, // Check that the register contents were preserved. // Always use CHECK_EQUAL_64, even when testing W registers, so we can test // that the upper word was properly cleared by Pop. - literal_base &= (0xffffffffffffffffUL >> (64-reg_size)); + literal_base &= (0xFFFFFFFFFFFFFFFFUL >> (64 - reg_size)); for (int i = 0; i < reg_count; i++) { if (x[i].IsZero()) { CHECK_EQUAL_64(0, x[i]); @@ -12466,77 +12405,53 @@ static void PushPopJsspSimpleHelper(int reg_count, TEARDOWN(); } - -TEST(push_pop_jssp_simple_32) { +TEST(push_pop_simple_32) { INIT_V8(); - for (int claim = 0; claim <= 8; claim++) { - for (int count = 0; count <= 8; count++) { - PushPopJsspSimpleHelper(count, claim, kWRegSizeInBits, - PushPopByFour, PushPopByFour); - PushPopJsspSimpleHelper(count, claim, kWRegSizeInBits, - PushPopByFour, PushPopRegList); - PushPopJsspSimpleHelper(count, claim, kWRegSizeInBits, - PushPopRegList, PushPopByFour); - PushPopJsspSimpleHelper(count, claim, kWRegSizeInBits, - PushPopRegList, PushPopRegList); - } - // Test with the maximum number of registers. - PushPopJsspSimpleHelper(kPushPopJsspMaxRegCount, claim, kWRegSizeInBits, - PushPopByFour, PushPopByFour); - PushPopJsspSimpleHelper(kPushPopJsspMaxRegCount, claim, kWRegSizeInBits, - PushPopByFour, PushPopRegList); - PushPopJsspSimpleHelper(kPushPopJsspMaxRegCount, claim, kWRegSizeInBits, - PushPopRegList, PushPopByFour); - PushPopJsspSimpleHelper(kPushPopJsspMaxRegCount, claim, kWRegSizeInBits, - PushPopRegList, PushPopRegList); - } -} - - -TEST(push_pop_jssp_simple_64) { - INIT_V8(); - for (int claim = 0; claim <= 8; claim++) { - for (int count = 0; count <= 8; count++) { - PushPopJsspSimpleHelper(count, claim, kXRegSizeInBits, - PushPopByFour, PushPopByFour); - PushPopJsspSimpleHelper(count, claim, kXRegSizeInBits, - PushPopByFour, PushPopRegList); - PushPopJsspSimpleHelper(count, claim, kXRegSizeInBits, - PushPopRegList, PushPopByFour); - PushPopJsspSimpleHelper(count, claim, kXRegSizeInBits, - PushPopRegList, PushPopRegList); - } - // Test with the maximum number of registers. - PushPopJsspSimpleHelper(kPushPopJsspMaxRegCount, claim, kXRegSizeInBits, - PushPopByFour, PushPopByFour); - PushPopJsspSimpleHelper(kPushPopJsspMaxRegCount, claim, kXRegSizeInBits, - PushPopByFour, PushPopRegList); - PushPopJsspSimpleHelper(kPushPopJsspMaxRegCount, claim, kXRegSizeInBits, - PushPopRegList, PushPopByFour); - PushPopJsspSimpleHelper(kPushPopJsspMaxRegCount, claim, kXRegSizeInBits, - PushPopRegList, PushPopRegList); + + for (int count = 0; count < kPushPopMaxRegCount; count += 4) { + PushPopSimpleHelper(count, kWRegSizeInBits, PushPopByFour, PushPopByFour); + PushPopSimpleHelper(count, kWRegSizeInBits, PushPopByFour, PushPopRegList); + PushPopSimpleHelper(count, kWRegSizeInBits, PushPopRegList, PushPopByFour); + PushPopSimpleHelper(count, kWRegSizeInBits, PushPopRegList, PushPopRegList); } + // Skip testing kPushPopMaxRegCount, as we exclude the temporary registers + // and we end up with a number of registers that is not a multiple of four and + // is not supported for pushing. } +TEST(push_pop_simple_64) { + INIT_V8(); + for (int count = 0; count <= 8; count += 2) { + PushPopSimpleHelper(count, kXRegSizeInBits, PushPopByFour, PushPopByFour); + PushPopSimpleHelper(count, kXRegSizeInBits, PushPopByFour, PushPopRegList); + PushPopSimpleHelper(count, kXRegSizeInBits, PushPopRegList, PushPopByFour); + PushPopSimpleHelper(count, kXRegSizeInBits, PushPopRegList, PushPopRegList); + } + // Test with the maximum number of registers. + PushPopSimpleHelper(kPushPopMaxRegCount, kXRegSizeInBits, PushPopByFour, + PushPopByFour); + PushPopSimpleHelper(kPushPopMaxRegCount, kXRegSizeInBits, PushPopByFour, + PushPopRegList); + PushPopSimpleHelper(kPushPopMaxRegCount, kXRegSizeInBits, PushPopRegList, + PushPopByFour); + PushPopSimpleHelper(kPushPopMaxRegCount, kXRegSizeInBits, PushPopRegList, + PushPopRegList); +} -// The maximum number of registers that can be used by the PushPopFPJssp* tests, +// The maximum number of registers that can be used by the PushPopFP* tests, // where a reg_count field is provided. -static int const kPushPopFPJsspMaxRegCount = -1; +static int const kPushPopFPMaxRegCount = -1; // Test a simple push-pop pattern: -// * Claim <claim> bytes to set the stack alignment. // * Push <reg_count> FP registers with size <reg_size>. // * Clobber the register contents. // * Pop <reg_count> FP registers to restore the original contents. -// * Drop <claim> bytes to restore the original stack pointer. // // Different push and pop methods can be specified independently to test for // proper word-endian behaviour. -static void PushPopFPJsspSimpleHelper(int reg_count, - int claim, - int reg_size, - PushPopMethod push_method, - PushPopMethod pop_method) { +static void PushPopFPSimpleHelper(int reg_count, int reg_size, + PushPopMethod push_method, + PushPopMethod pop_method) { SETUP(); START(); @@ -12544,7 +12459,7 @@ static void PushPopFPJsspSimpleHelper(int reg_count, // We can use any floating-point register. None of them are reserved for // debug code, for example. static RegList const allowed = ~0; - if (reg_count == kPushPopFPJsspMaxRegCount) { + if (reg_count == kPushPopFPMaxRegCount) { reg_count = CountSetBits(allowed, kNumberOfVRegisters); } // Work out which registers to use, based on reg_size. @@ -12564,9 +12479,6 @@ static void PushPopFPJsspSimpleHelper(int reg_count, { CHECK(__ StackPointer().Is(csp)); - __ Mov(jssp, __ StackPointer()); - __ SetStackPointer(jssp); - int i; // Initialize the registers, using X registers to load the literal. @@ -12580,9 +12492,6 @@ static void PushPopFPJsspSimpleHelper(int reg_count, __ Add(x0, x0, x1); } - // Claim memory first, as requested. - __ Claim(claim, kByteSizeInBytes); - switch (push_method) { case PushPopByFour: // Push high-numbered registers first (to the highest addresses). @@ -12627,12 +12536,6 @@ static void PushPopFPJsspSimpleHelper(int reg_count, __ PopSizeRegList(list, reg_size, CPURegister::kVRegister); break; } - - // Drop memory to restore jssp. - __ Drop(claim, kByteSizeInBytes); - - __ Mov(csp, __ StackPointer()); - __ SetStackPointer(csp); } END(); @@ -12642,7 +12545,7 @@ static void PushPopFPJsspSimpleHelper(int reg_count, // Check that the register contents were preserved. // Always use CHECK_EQUAL_FP64, even when testing S registers, so we can // test that the upper word was properly cleared by Pop. - literal_base &= (0xffffffffffffffffUL >> (64-reg_size)); + literal_base &= (0xFFFFFFFFFFFFFFFFUL >> (64 - reg_size)); for (int i = 0; i < reg_count; i++) { uint64_t literal = literal_base * i; double expected; @@ -12653,69 +12556,59 @@ static void PushPopFPJsspSimpleHelper(int reg_count, TEARDOWN(); } +TEST(push_pop_fp_simple_32) { + INIT_V8(); + for (int count = 0; count <= 8; count += 4) { + PushPopFPSimpleHelper(count, kSRegSizeInBits, PushPopByFour, PushPopByFour); + PushPopFPSimpleHelper(count, kSRegSizeInBits, PushPopByFour, + PushPopRegList); + PushPopFPSimpleHelper(count, kSRegSizeInBits, PushPopRegList, + PushPopByFour); + PushPopFPSimpleHelper(count, kSRegSizeInBits, PushPopRegList, + PushPopRegList); + } + // Test with the maximum number of registers. + PushPopFPSimpleHelper(kPushPopFPMaxRegCount, kSRegSizeInBits, PushPopByFour, + PushPopByFour); + PushPopFPSimpleHelper(kPushPopFPMaxRegCount, kSRegSizeInBits, PushPopByFour, + PushPopRegList); + PushPopFPSimpleHelper(kPushPopFPMaxRegCount, kSRegSizeInBits, PushPopRegList, + PushPopByFour); + PushPopFPSimpleHelper(kPushPopFPMaxRegCount, kSRegSizeInBits, PushPopRegList, + PushPopRegList); +} -TEST(push_pop_fp_jssp_simple_32) { +TEST(push_pop_fp_simple_64) { INIT_V8(); - for (int claim = 0; claim <= 8; claim++) { - for (int count = 0; count <= 8; count++) { - PushPopFPJsspSimpleHelper(count, claim, kSRegSizeInBits, - PushPopByFour, PushPopByFour); - PushPopFPJsspSimpleHelper(count, claim, kSRegSizeInBits, - PushPopByFour, PushPopRegList); - PushPopFPJsspSimpleHelper(count, claim, kSRegSizeInBits, - PushPopRegList, PushPopByFour); - PushPopFPJsspSimpleHelper(count, claim, kSRegSizeInBits, - PushPopRegList, PushPopRegList); - } - // Test with the maximum number of registers. - PushPopFPJsspSimpleHelper(kPushPopFPJsspMaxRegCount, claim, kSRegSizeInBits, - PushPopByFour, PushPopByFour); - PushPopFPJsspSimpleHelper(kPushPopFPJsspMaxRegCount, claim, kSRegSizeInBits, - PushPopByFour, PushPopRegList); - PushPopFPJsspSimpleHelper(kPushPopFPJsspMaxRegCount, claim, kSRegSizeInBits, - PushPopRegList, PushPopByFour); - PushPopFPJsspSimpleHelper(kPushPopFPJsspMaxRegCount, claim, kSRegSizeInBits, - PushPopRegList, PushPopRegList); - } -} - - -TEST(push_pop_fp_jssp_simple_64) { - INIT_V8(); - for (int claim = 0; claim <= 8; claim++) { - for (int count = 0; count <= 8; count++) { - PushPopFPJsspSimpleHelper(count, claim, kDRegSizeInBits, - PushPopByFour, PushPopByFour); - PushPopFPJsspSimpleHelper(count, claim, kDRegSizeInBits, - PushPopByFour, PushPopRegList); - PushPopFPJsspSimpleHelper(count, claim, kDRegSizeInBits, - PushPopRegList, PushPopByFour); - PushPopFPJsspSimpleHelper(count, claim, kDRegSizeInBits, - PushPopRegList, PushPopRegList); - } - // Test with the maximum number of registers. - PushPopFPJsspSimpleHelper(kPushPopFPJsspMaxRegCount, claim, kDRegSizeInBits, - PushPopByFour, PushPopByFour); - PushPopFPJsspSimpleHelper(kPushPopFPJsspMaxRegCount, claim, kDRegSizeInBits, - PushPopByFour, PushPopRegList); - PushPopFPJsspSimpleHelper(kPushPopFPJsspMaxRegCount, claim, kDRegSizeInBits, - PushPopRegList, PushPopByFour); - PushPopFPJsspSimpleHelper(kPushPopFPJsspMaxRegCount, claim, kDRegSizeInBits, - PushPopRegList, PushPopRegList); + for (int count = 0; count <= 8; count += 2) { + PushPopFPSimpleHelper(count, kDRegSizeInBits, PushPopByFour, PushPopByFour); + PushPopFPSimpleHelper(count, kDRegSizeInBits, PushPopByFour, + PushPopRegList); + PushPopFPSimpleHelper(count, kDRegSizeInBits, PushPopRegList, + PushPopByFour); + PushPopFPSimpleHelper(count, kDRegSizeInBits, PushPopRegList, + PushPopRegList); } + // Test with the maximum number of registers. + PushPopFPSimpleHelper(kPushPopFPMaxRegCount, kDRegSizeInBits, PushPopByFour, + PushPopByFour); + PushPopFPSimpleHelper(kPushPopFPMaxRegCount, kDRegSizeInBits, PushPopByFour, + PushPopRegList); + PushPopFPSimpleHelper(kPushPopFPMaxRegCount, kDRegSizeInBits, PushPopRegList, + PushPopByFour); + PushPopFPSimpleHelper(kPushPopFPMaxRegCount, kDRegSizeInBits, PushPopRegList, + PushPopRegList); } // Push and pop data using an overlapping combination of Push/Pop and // RegList-based methods. -static void PushPopJsspMixedMethodsHelper(int claim, int reg_size) { +static void PushPopMixedMethodsHelper(int reg_size) { SETUP(); - // Registers x8 and x9 are used by the macro assembler for debug code (for - // example in 'Pop'), so we can't use them here. We can't use jssp because it - // will be the stack pointer for this test. - static RegList const allowed = - ~(x8.bit() | x9.bit() | jssp.bit() | xzr.bit()); + // Registers in the TmpList can be used by the macro assembler for debug code + // (for example in 'Pop'), so we can't use them here. + static RegList const allowed = ~(masm.TmpList()->list()); // Work out which registers to use, based on reg_size. auto r = CreateRegisterArray<Register, 10>(); auto x = CreateRegisterArray<Register, 10>(); @@ -12745,11 +12638,6 @@ static void PushPopJsspMixedMethodsHelper(int claim, int reg_size) { START(); { CHECK(__ StackPointer().Is(csp)); - __ Mov(jssp, __ StackPointer()); - __ SetStackPointer(jssp); - - // Claim memory first, as requested. - __ Claim(claim, kByteSizeInBytes); __ Mov(x[3], literal_base * 3); __ Mov(x[2], literal_base * 2); @@ -12768,12 +12656,6 @@ static void PushPopJsspMixedMethodsHelper(int claim, int reg_size) { __ Pop(r[4], r[5]); Clobber(&masm, r6_to_r9); __ Pop(r[6], r[7], r[8], r[9]); - - // Drop memory to restore jssp. - __ Drop(claim, kByteSizeInBytes); - - __ Mov(csp, __ StackPointer()); - __ SetStackPointer(csp); } END(); @@ -12782,7 +12664,7 @@ static void PushPopJsspMixedMethodsHelper(int claim, int reg_size) { // Always use CHECK_EQUAL_64, even when testing W registers, so we can test // that the upper word was properly cleared by Pop. - literal_base &= (0xffffffffffffffffUL >> (64-reg_size)); + literal_base &= (0xFFFFFFFFFFFFFFFFUL >> (64 - reg_size)); CHECK_EQUAL_64(literal_base * 3, x[9]); CHECK_EQUAL_64(literal_base * 2, x[8]); @@ -12794,232 +12676,9 @@ static void PushPopJsspMixedMethodsHelper(int claim, int reg_size) { TEARDOWN(); } - -TEST(push_pop_jssp_mixed_methods_64) { - INIT_V8(); - for (int claim = 0; claim <= 8; claim++) { - PushPopJsspMixedMethodsHelper(claim, kXRegSizeInBits); - } -} - - -TEST(push_pop_jssp_mixed_methods_32) { - INIT_V8(); - for (int claim = 0; claim <= 8; claim++) { - PushPopJsspMixedMethodsHelper(claim, kWRegSizeInBits); - } -} - - -// Push and pop data using overlapping X- and W-sized quantities. -static void PushPopJsspWXOverlapHelper(int reg_count, int claim) { - // This test emits rather a lot of code. - SETUP_SIZE(BUF_SIZE * 2); - - // Work out which registers to use, based on reg_size. - Register tmp = x8; - static RegList const allowed = ~(tmp.bit() | jssp.bit()); - if (reg_count == kPushPopJsspMaxRegCount) { - reg_count = CountSetBits(allowed, kNumberOfRegisters); - } - auto w = CreateRegisterArray<Register, kNumberOfRegisters>(); - auto x = CreateRegisterArray<Register, kNumberOfRegisters>(); - RegList list = - PopulateRegisterArray(w.data(), x.data(), nullptr, 0, reg_count, allowed); - - // The number of W-sized slots we expect to pop. When we pop, we alternate - // between W and X registers, so we need reg_count*1.5 W-sized slots. - int const requested_w_slots = reg_count + reg_count / 2; - - // Track what _should_ be on the stack, using W-sized slots. - static int const kMaxWSlots = kNumberOfRegisters + kNumberOfRegisters / 2; - uint32_t stack[kMaxWSlots]; - for (int i = 0; i < kMaxWSlots; i++) { - stack[i] = 0xdeadbeef; - } - - // The literal base is chosen to have two useful properties: - // * When multiplied by small values (such as a register index), this value - // is clearly readable in the result. - // * The value is not formed from repeating fixed-size smaller values, so it - // can be used to detect endianness-related errors. - static uint64_t const literal_base = 0x0100001000100101UL; - static uint64_t const literal_base_hi = literal_base >> 32; - static uint64_t const literal_base_lo = literal_base & 0xffffffff; - static uint64_t const literal_base_w = literal_base & 0xffffffff; - - START(); - { - CHECK(__ StackPointer().Is(csp)); - __ Mov(jssp, __ StackPointer()); - __ SetStackPointer(jssp); - - // Initialize the registers. - for (int i = 0; i < reg_count; i++) { - // Always write into the X register, to ensure that the upper word is - // properly ignored by Push when testing W registers. - if (!x[i].IsZero()) { - __ Mov(x[i], literal_base * i); - } - } - - // Claim memory first, as requested. - __ Claim(claim, kByteSizeInBytes); - - // The push-pop pattern is as follows: - // Push: Pop: - // x[0](hi) -> w[0] - // x[0](lo) -> x[1](hi) - // w[1] -> x[1](lo) - // w[1] -> w[2] - // x[2](hi) -> x[2](hi) - // x[2](lo) -> x[2](lo) - // x[2](hi) -> w[3] - // x[2](lo) -> x[4](hi) - // x[2](hi) -> x[4](lo) - // x[2](lo) -> w[5] - // w[3] -> x[5](hi) - // w[3] -> x[6](lo) - // w[3] -> w[7] - // w[3] -> x[8](hi) - // x[4](hi) -> x[8](lo) - // x[4](lo) -> w[9] - // ... pattern continues ... - // - // That is, registers are pushed starting with the lower numbers, - // alternating between x and w registers, and pushing i%4+1 copies of each, - // where i is the register number. - // Registers are popped starting with the higher numbers one-by-one, - // alternating between x and w registers, but only popping one at a time. - // - // This pattern provides a wide variety of alignment effects and overlaps. - - // ---- Push ---- - - int active_w_slots = 0; - for (int i = 0; active_w_slots < requested_w_slots; i++) { - CHECK(i < reg_count); - // In order to test various arguments to PushMultipleTimes, and to try to - // exercise different alignment and overlap effects, we push each - // register a different number of times. - int times = i % 4 + 1; - if (i & 1) { - // Push odd-numbered registers as W registers. - __ Mov(tmp.W(), times); - __ PushMultipleTimes(w[i], tmp.W()); - - // Fill in the expected stack slots. - for (int j = 0; j < times; j++) { - if (w[i].Is(wzr)) { - // The zero register always writes zeroes. - stack[active_w_slots++] = 0; - } else { - stack[active_w_slots++] = literal_base_w * i; - } - } - } else { - // Push even-numbered registers as X registers. - __ Mov(tmp, times); - __ PushMultipleTimes(x[i], tmp); - - // Fill in the expected stack slots. - for (int j = 0; j < times; j++) { - if (x[i].IsZero()) { - // The zero register always writes zeroes. - stack[active_w_slots++] = 0; - stack[active_w_slots++] = 0; - } else { - stack[active_w_slots++] = literal_base_hi * i; - stack[active_w_slots++] = literal_base_lo * i; - } - } - } - } - // Because we were pushing several registers at a time, we probably pushed - // more than we needed to. - if (active_w_slots > requested_w_slots) { - __ Drop(active_w_slots - requested_w_slots, kWRegSize); - // Bump the number of active W-sized slots back to where it should be, - // and fill the empty space with a dummy value. - do { - stack[active_w_slots--] = 0xdeadbeef; - } while (active_w_slots > requested_w_slots); - } - - // ---- Pop ---- - - Clobber(&masm, list); - - // If popping an even number of registers, the first one will be X-sized. - // Otherwise, the first one will be W-sized. - bool next_is_64 = !(reg_count & 1); - for (int i = reg_count-1; i >= 0; i--) { - if (next_is_64) { - __ Pop(x[i]); - active_w_slots -= 2; - } else { - __ Pop(w[i]); - active_w_slots -= 1; - } - next_is_64 = !next_is_64; - } - CHECK_EQ(active_w_slots, 0); - - // Drop memory to restore jssp. - __ Drop(claim, kByteSizeInBytes); - - __ Mov(csp, __ StackPointer()); - __ SetStackPointer(csp); - } - - END(); - - RUN(); - - int slot = 0; - for (int i = 0; i < reg_count; i++) { - // Even-numbered registers were written as W registers. - // Odd-numbered registers were written as X registers. - bool expect_64 = (i & 1); - uint64_t expected; - - if (expect_64) { - uint64_t hi = stack[slot++]; - uint64_t lo = stack[slot++]; - expected = (hi << 32) | lo; - } else { - expected = stack[slot++]; - } - - // Always use CHECK_EQUAL_64, even when testing W registers, so we can - // test that the upper word was properly cleared by Pop. - if (x[i].IsZero()) { - CHECK_EQUAL_64(0, x[i]); - } else { - CHECK_EQUAL_64(expected, x[i]); - } - } - CHECK(slot == requested_w_slots); - - TEARDOWN(); -} - - -TEST(push_pop_jssp_wx_overlap) { +TEST(push_pop_mixed_methods_64) { INIT_V8(); - for (int claim = 0; claim <= 8; claim++) { - for (int count = 1; count <= 8; count++) { - PushPopJsspWXOverlapHelper(count, claim); - PushPopJsspWXOverlapHelper(count, claim); - PushPopJsspWXOverlapHelper(count, claim); - PushPopJsspWXOverlapHelper(count, claim); - } - // Test with the maximum number of registers. - PushPopJsspWXOverlapHelper(kPushPopJsspMaxRegCount, claim); - PushPopJsspWXOverlapHelper(kPushPopJsspMaxRegCount, claim); - PushPopJsspWXOverlapHelper(kPushPopJsspMaxRegCount, claim); - PushPopJsspWXOverlapHelper(kPushPopJsspMaxRegCount, claim); - } + PushPopMixedMethodsHelper(kXRegSizeInBits); } @@ -13066,8 +12725,8 @@ TEST(push_pop_csp) { __ Claim(2); __ PushXRegList(0); __ PopXRegList(0); - __ PushXRegList(0xffffffff); - __ PopXRegList(0xffffffff); + __ PushXRegList(0xFFFFFFFF); + __ PopXRegList(0xFFFFFFFF); __ Drop(12); END(); @@ -13118,10 +12777,6 @@ TEST(push_queued) { START(); - CHECK(__ StackPointer().Is(csp)); - __ Mov(jssp, __ StackPointer()); - __ SetStackPointer(jssp); - MacroAssembler::PushPopQueue queue(&masm); // Queue up registers. @@ -13133,11 +12788,15 @@ TEST(push_queued) { queue.Queue(w4); queue.Queue(w5); queue.Queue(w6); + queue.Queue(w7); queue.Queue(d0); queue.Queue(d1); queue.Queue(s2); + queue.Queue(s3); + queue.Queue(s4); + queue.Queue(s5); __ Mov(x0, 0x1234000000000000); __ Mov(x1, 0x1234000100010001); @@ -13146,25 +12805,26 @@ TEST(push_queued) { __ Mov(w4, 0x12340004); __ Mov(w5, 0x12340005); __ Mov(w6, 0x12340006); + __ Mov(w7, 0x12340007); __ Fmov(d0, 123400.0); __ Fmov(d1, 123401.0); __ Fmov(s2, 123402.0); + __ Fmov(s3, 123403.0); + __ Fmov(s4, 123404.0); + __ Fmov(s5, 123405.0); // Actually push them. queue.PushQueued(); - Clobber(&masm, CPURegList(CPURegister::kRegister, kXRegSizeInBits, 0, 6)); - Clobber(&masm, CPURegList(CPURegister::kVRegister, kDRegSizeInBits, 0, 2)); + Clobber(&masm, CPURegList(CPURegister::kRegister, kXRegSizeInBits, 0, 8)); + Clobber(&masm, CPURegList(CPURegister::kVRegister, kDRegSizeInBits, 0, 6)); // Pop them conventionally. - __ Pop(s2); + __ Pop(s5, s4, s3, s2); __ Pop(d1, d0); - __ Pop(w6, w5, w4); + __ Pop(w7, w6, w5, w4); __ Pop(x3, x2, x1, x0); - __ Mov(csp, __ StackPointer()); - __ SetStackPointer(csp); - END(); RUN(); @@ -13174,14 +12834,18 @@ TEST(push_queued) { CHECK_EQUAL_64(0x1234000200020002, x2); CHECK_EQUAL_64(0x1234000300030003, x3); - CHECK_EQUAL_32(0x12340004, w4); - CHECK_EQUAL_32(0x12340005, w5); - CHECK_EQUAL_32(0x12340006, w6); + CHECK_EQUAL_64(0x0000000012340004, x4); + CHECK_EQUAL_64(0x0000000012340005, x5); + CHECK_EQUAL_64(0x0000000012340006, x6); + CHECK_EQUAL_64(0x0000000012340007, x7); CHECK_EQUAL_FP64(123400.0, d0); CHECK_EQUAL_FP64(123401.0, d1); CHECK_EQUAL_FP32(123402.0, s2); + CHECK_EQUAL_FP32(123403.0, s3); + CHECK_EQUAL_FP32(123404.0, s4); + CHECK_EQUAL_FP32(123405.0, s5); TEARDOWN(); } @@ -13193,10 +12857,6 @@ TEST(pop_queued) { START(); - CHECK(__ StackPointer().Is(csp)); - __ Mov(jssp, __ StackPointer()); - __ SetStackPointer(jssp); - MacroAssembler::PushPopQueue queue(&masm); __ Mov(x0, 0x1234000000000000); @@ -13206,22 +12866,30 @@ TEST(pop_queued) { __ Mov(w4, 0x12340004); __ Mov(w5, 0x12340005); __ Mov(w6, 0x12340006); + __ Mov(w7, 0x12340007); __ Fmov(d0, 123400.0); __ Fmov(d1, 123401.0); __ Fmov(s2, 123402.0); + __ Fmov(s3, 123403.0); + __ Fmov(s4, 123404.0); + __ Fmov(s5, 123405.0); // Push registers conventionally. __ Push(x0, x1, x2, x3); - __ Push(w4, w5, w6); + __ Push(w4, w5, w6, w7); __ Push(d0, d1); - __ Push(s2); + __ Push(s2, s3, s4, s5); // Queue up a pop. + queue.Queue(s5); + queue.Queue(s4); + queue.Queue(s3); queue.Queue(s2); queue.Queue(d1); queue.Queue(d0); + queue.Queue(w7); queue.Queue(w6); queue.Queue(w5); queue.Queue(w4); @@ -13231,15 +12899,12 @@ TEST(pop_queued) { queue.Queue(x1); queue.Queue(x0); - Clobber(&masm, CPURegList(CPURegister::kRegister, kXRegSizeInBits, 0, 6)); - Clobber(&masm, CPURegList(CPURegister::kVRegister, kDRegSizeInBits, 0, 2)); + Clobber(&masm, CPURegList(CPURegister::kRegister, kXRegSizeInBits, 0, 8)); + Clobber(&masm, CPURegList(CPURegister::kVRegister, kDRegSizeInBits, 0, 6)); // Actually pop them. queue.PopQueued(); - __ Mov(csp, __ StackPointer()); - __ SetStackPointer(csp); - END(); RUN(); @@ -13252,11 +12917,15 @@ TEST(pop_queued) { CHECK_EQUAL_64(0x0000000012340004, x4); CHECK_EQUAL_64(0x0000000012340005, x5); CHECK_EQUAL_64(0x0000000012340006, x6); + CHECK_EQUAL_64(0x0000000012340007, x7); CHECK_EQUAL_FP64(123400.0, d0); CHECK_EQUAL_FP64(123401.0, d1); CHECK_EQUAL_FP32(123402.0, s2); + CHECK_EQUAL_FP32(123403.0, s3); + CHECK_EQUAL_FP32(123404.0, s4); + CHECK_EQUAL_FP32(123405.0, s5); TEARDOWN(); } @@ -13273,9 +12942,6 @@ TEST(copy_slots_down) { START(); // Test copying 12 slots down one slot. - __ Mov(jssp, __ StackPointer()); - __ SetStackPointer(jssp); - __ Mov(x1, ones); __ Mov(x2, twos); __ Mov(x3, threes); @@ -13284,32 +12950,28 @@ TEST(copy_slots_down) { __ Push(x1, x2, x3, x4); __ Push(x1, x2, x1, x2); __ Push(x3, x4, x3, x4); - __ Push(xzr); + __ Push(xzr, xzr); - __ Mov(x5, 0); - __ Mov(x6, 1); + __ Mov(x5, 1); + __ Mov(x6, 2); __ Mov(x7, 12); __ CopySlots(x5, x6, x7); - __ Pop(x4, x5, x6, x7); - __ Pop(x8, x9, x10, x11); - __ Pop(x12, x13, x14, x15); - __ Drop(1); + __ Pop(xzr, x4, x5, x6); + __ Pop(x7, x8, x9, x10); + __ Pop(x11, x12, x13, x14); + __ Pop(x15, xzr); // Test copying one slot down one slot. - __ Push(x1, xzr, xzr); + __ Push(x1, xzr, xzr, xzr); - __ Mov(x1, 1); - __ Mov(x2, 2); + __ Mov(x1, 2); + __ Mov(x2, 3); __ Mov(x3, 1); __ CopySlots(x1, x2, x3); - __ Drop(1); - __ Pop(x0); - __ Drop(1); - - __ Mov(csp, jssp); - __ SetStackPointer(csp); + __ Drop(2); + __ Pop(x0, xzr); END(); @@ -13345,9 +13007,6 @@ TEST(copy_slots_up) { START(); - __ Mov(jssp, __ StackPointer()); - __ SetStackPointer(jssp); - __ Mov(x1, ones); __ Mov(x2, twos); __ Mov(x3, threes); @@ -13360,8 +13019,7 @@ TEST(copy_slots_up) { __ Mov(x7, 1); __ CopySlots(x5, x6, x7); - __ Drop(1); - __ Pop(x10); + __ Pop(xzr, x10); // Test copying two slots to the next two slots higher in memory. __ Push(xzr, xzr); @@ -13376,19 +13034,16 @@ TEST(copy_slots_up) { __ Pop(x11, x12); // Test copying three slots to the next three slots higher in memory. - __ Push(xzr, xzr, xzr); - __ Push(x1, x2, x3); + __ Push(xzr, xzr, xzr, x1); + __ Push(x2, x3); __ Mov(x5, 3); __ Mov(x6, 0); __ Mov(x7, 3); __ CopySlots(x5, x6, x7); - __ Drop(3); - __ Pop(x0, x1, x2); - - __ Mov(csp, jssp); - __ SetStackPointer(csp); + __ Drop(2); + __ Pop(xzr, x0, x1, x2); END(); @@ -13415,16 +13070,13 @@ TEST(copy_double_words_downwards_even) { START(); - __ Mov(jssp, __ StackPointer()); - __ SetStackPointer(jssp); - // Test copying 12 slots up one slot. __ Mov(x1, ones); __ Mov(x2, twos); __ Mov(x3, threes); __ Mov(x4, fours); - __ Push(xzr); + __ Push(xzr, xzr); __ Push(x1, x2, x3, x4); __ Push(x1, x2, x1, x2); __ Push(x3, x4, x3, x4); @@ -13434,13 +13086,10 @@ TEST(copy_double_words_downwards_even) { __ Mov(x7, 12); __ CopyDoubleWords(x5, x6, x7, TurboAssembler::kSrcLessThanDst); - __ Drop(1); - __ Pop(x4, x5, x6, x7); - __ Pop(x8, x9, x10, x11); - __ Pop(x12, x13, x14, x15); - - __ Mov(csp, jssp); - __ SetStackPointer(csp); + __ Pop(xzr, x4, x5, x6); + __ Pop(x7, x8, x9, x10); + __ Pop(x11, x12, x13, x14); + __ Pop(x15, xzr); END(); @@ -13476,9 +13125,6 @@ TEST(copy_double_words_downwards_odd) { START(); - __ Mov(jssp, __ StackPointer()); - __ SetStackPointer(jssp); - // Test copying 13 slots up one slot. __ Mov(x1, ones); __ Mov(x2, twos); @@ -13496,15 +13142,11 @@ TEST(copy_double_words_downwards_odd) { __ Mov(x7, 13); __ CopyDoubleWords(x5, x6, x7, TurboAssembler::kSrcLessThanDst); - __ Drop(1); - __ Pop(x4); + __ Pop(xzr, x4); __ Pop(x5, x6, x7, x8); __ Pop(x9, x10, x11, x12); __ Pop(x13, x14, x15, x16); - __ Mov(csp, jssp); - __ SetStackPointer(csp); - END(); RUN(); @@ -13541,9 +13183,6 @@ TEST(copy_noop) { START(); - __ Mov(jssp, __ StackPointer()); - __ SetStackPointer(jssp); - __ Mov(x1, ones); __ Mov(x2, twos); __ Mov(x3, threes); @@ -13572,9 +13211,6 @@ TEST(copy_noop) { __ Pop(x9, x10, x11, x12); __ Pop(x13, x14, x15, x16); - __ Mov(csp, jssp); - __ SetStackPointer(csp); - END(); RUN(); @@ -13613,13 +13249,13 @@ TEST(jump_both_smi) { START(); __ Mov(x0, 0x5555555500000001UL); // A pointer. - __ Mov(x1, 0xaaaaaaaa00000001UL); // A pointer. + __ Mov(x1, 0xAAAAAAAA00000001UL); // A pointer. __ Mov(x2, 0x1234567800000000UL); // A smi. __ Mov(x3, 0x8765432100000000UL); // A smi. - __ Mov(x4, 0xdead); - __ Mov(x5, 0xdead); - __ Mov(x6, 0xdead); - __ Mov(x7, 0xdead); + __ Mov(x4, 0xDEAD); + __ Mov(x5, 0xDEAD); + __ Mov(x6, 0xDEAD); + __ Mov(x7, 0xDEAD); __ JumpIfBothSmi(x0, x1, &cond_pass_00, &cond_fail_00); __ Bind(&return1); @@ -13663,7 +13299,7 @@ TEST(jump_both_smi) { RUN(); CHECK_EQUAL_64(0x5555555500000001UL, x0); - CHECK_EQUAL_64(0xaaaaaaaa00000001UL, x1); + CHECK_EQUAL_64(0xAAAAAAAA00000001UL, x1); CHECK_EQUAL_64(0x1234567800000000UL, x2); CHECK_EQUAL_64(0x8765432100000000UL, x3); CHECK_EQUAL_64(0, x4); @@ -13686,13 +13322,13 @@ TEST(jump_either_smi) { START(); __ Mov(x0, 0x5555555500000001UL); // A pointer. - __ Mov(x1, 0xaaaaaaaa00000001UL); // A pointer. + __ Mov(x1, 0xAAAAAAAA00000001UL); // A pointer. __ Mov(x2, 0x1234567800000000UL); // A smi. __ Mov(x3, 0x8765432100000000UL); // A smi. - __ Mov(x4, 0xdead); - __ Mov(x5, 0xdead); - __ Mov(x6, 0xdead); - __ Mov(x7, 0xdead); + __ Mov(x4, 0xDEAD); + __ Mov(x5, 0xDEAD); + __ Mov(x6, 0xDEAD); + __ Mov(x7, 0xDEAD); __ JumpIfEitherSmi(x0, x1, &cond_pass_00, &cond_fail_00); __ Bind(&return1); @@ -13736,7 +13372,7 @@ TEST(jump_either_smi) { RUN(); CHECK_EQUAL_64(0x5555555500000001UL, x0); - CHECK_EQUAL_64(0xaaaaaaaa00000001UL, x1); + CHECK_EQUAL_64(0xAAAAAAAA00000001UL, x1); CHECK_EQUAL_64(0x1234567800000000UL, x2); CHECK_EQUAL_64(0x8765432100000000UL, x3); CHECK_EQUAL_64(0, x4); @@ -14615,17 +14251,17 @@ TEST(printf) { __ Mov(x2, reinterpret_cast<uintptr_t>(test_substring)); // Test the maximum number of arguments, and sign extension. - __ Mov(w3, 0xffffffff); - __ Mov(w4, 0xffffffff); - __ Mov(x5, 0xffffffffffffffff); - __ Mov(x6, 0xffffffffffffffff); + __ Mov(w3, 0xFFFFFFFF); + __ Mov(w4, 0xFFFFFFFF); + __ Mov(x5, 0xFFFFFFFFFFFFFFFF); + __ Mov(x6, 0xFFFFFFFFFFFFFFFF); __ Fmov(s1, 1.234); __ Fmov(s2, 2.345); __ Fmov(d3, 3.456); __ Fmov(d4, 4.567); // Test printing callee-saved registers. - __ Mov(x28, 0x123456789abcdef); + __ Mov(x28, 0x123456789ABCDEF); __ Fmov(d10, 42.0); // Test with three arguments. @@ -14657,16 +14293,6 @@ TEST(printf) { __ Printf("StackPointer(csp): 0x%016" PRIx64 ", 0x%08" PRIx32 "\n", __ StackPointer(), __ StackPointer().W()); - // Test with a different stack pointer. - const Register old_stack_pointer = __ StackPointer(); - __ Mov(x29, old_stack_pointer); - __ SetStackPointer(x29); - // Print the stack pointer (not csp). - __ Printf("StackPointer(not csp): 0x%016" PRIx64 ", 0x%08" PRIx32 "\n", - __ StackPointer(), __ StackPointer().W()); - __ Mov(old_stack_pointer, __ StackPointer()); - __ SetStackPointer(old_stack_pointer); - // Test with three arguments. __ Printf("3=%u, 4=%u, 5=%u\n", x10, x11, x12); @@ -14717,10 +14343,10 @@ TEST(printf_no_preserve) { __ Mov(x22, x0); // Test the maximum number of arguments, and sign extension. - __ Mov(w3, 0xffffffff); - __ Mov(w4, 0xffffffff); - __ Mov(x5, 0xffffffffffffffff); - __ Mov(x6, 0xffffffffffffffff); + __ Mov(w3, 0xFFFFFFFF); + __ Mov(w4, 0xFFFFFFFF); + __ Mov(x5, 0xFFFFFFFFFFFFFFFF); + __ Mov(x6, 0xFFFFFFFFFFFFFFFF); __ PrintfNoPreserve("w3(uint32): %" PRIu32 "\nw4(int32): %" PRId32 "\n" "x5(uint64): %" PRIu64 "\nx6(int64): %" PRId64 "\n", w3, w4, x5, x6); @@ -14734,7 +14360,7 @@ TEST(printf_no_preserve) { __ Mov(x24, x0); // Test printing callee-saved registers. - __ Mov(x28, 0x123456789abcdef); + __ Mov(x28, 0x123456789ABCDEF); __ PrintfNoPreserve("0x%" PRIx32 ", 0x%" PRIx64 "\n", w28, x28); __ Mov(x25, x0); @@ -14742,33 +14368,21 @@ TEST(printf_no_preserve) { __ PrintfNoPreserve("%g\n", d10); __ Mov(x26, x0); - // Test with a different stack pointer. - const Register old_stack_pointer = __ StackPointer(); - __ Mov(x29, old_stack_pointer); - __ SetStackPointer(x29); - // Print the stack pointer (not csp). - __ PrintfNoPreserve( - "StackPointer(not csp): 0x%016" PRIx64 ", 0x%08" PRIx32 "\n", - __ StackPointer(), __ StackPointer().W()); - __ Mov(x27, x0); - __ Mov(old_stack_pointer, __ StackPointer()); - __ SetStackPointer(old_stack_pointer); - // Test with three arguments. __ Mov(x3, 3); __ Mov(x4, 40); __ Mov(x5, 500); __ PrintfNoPreserve("3=%u, 4=%u, 5=%u\n", x3, x4, x5); - __ Mov(x28, x0); + __ Mov(x27, x0); // Mixed argument types. - __ Mov(w3, 0xffffffff); + __ Mov(w3, 0xFFFFFFFF); __ Fmov(s1, 1.234); - __ Mov(x5, 0xffffffffffffffff); + __ Mov(x5, 0xFFFFFFFFFFFFFFFF); __ Fmov(d3, 3.456); __ PrintfNoPreserve("w3: %" PRIu32 ", s1: %f, x5: %" PRIu64 ", d3: %f\n", w3, s1, x5, d3); - __ Mov(x29, x0); + __ Mov(x28, x0); END(); RUN(); @@ -14794,18 +14408,14 @@ TEST(printf_no_preserve) { // %e: 3.456000e+00 // %E: 4.567000E+00 CHECK_EQUAL_64(13 + 10 + 17 + 17, x24); - // 0x89abcdef, 0x123456789abcdef + // 0x89ABCDEF, 0x123456789ABCDEF CHECK_EQUAL_64(30, x25); // 42 CHECK_EQUAL_64(3, x26); - // StackPointer(not csp): 0x00007fb037ae2370, 0x37ae2370 - // Note: This is an example value, but the field width is fixed here so the - // string length is still predictable. - CHECK_EQUAL_64(54, x27); // 3=3, 4=40, 5=500 - CHECK_EQUAL_64(17, x28); + CHECK_EQUAL_64(17, x27); // w3: 4294967295, s1: 1.234000, x5: 18446744073709551615, d3: 3.456000 - CHECK_EQUAL_64(69, x29); + CHECK_EQUAL_64(69, x28); TEARDOWN(); } @@ -14824,18 +14434,18 @@ TEST(blr_lr) { __ Adr(lr, &target); __ Blr(lr); - __ Mov(x0, 0xdeadbeef); + __ Mov(x0, 0xDEADBEEF); __ B(&end); __ Bind(&target); - __ Mov(x0, 0xc001c0de); + __ Mov(x0, 0xC001C0DE); __ Bind(&end); END(); RUN(); - CHECK_EQUAL_64(0xc001c0de, x0); + CHECK_EQUAL_64(0xC001C0DE, x0); TEARDOWN(); } @@ -14904,13 +14514,13 @@ TEST(barriers) { TEST(process_nan_double) { INIT_V8(); // Make sure that NaN propagation works correctly. - double sn = bit_cast<double>(0x7ff5555511111111); - double qn = bit_cast<double>(0x7ffaaaaa11111111); + double sn = bit_cast<double>(0x7FF5555511111111); + double qn = bit_cast<double>(0x7FFAAAAA11111111); CHECK(IsSignallingNaN(sn)); CHECK(IsQuietNaN(qn)); // The input NaNs after passing through ProcessNaN. - double sn_proc = bit_cast<double>(0x7ffd555511111111); + double sn_proc = bit_cast<double>(0x7FFD555511111111); double qn_proc = qn; CHECK(IsQuietNaN(sn_proc)); CHECK(IsQuietNaN(qn_proc)); @@ -14980,13 +14590,13 @@ TEST(process_nan_double) { TEST(process_nan_float) { INIT_V8(); // Make sure that NaN propagation works correctly. - float sn = bit_cast<float>(0x7f951111); - float qn = bit_cast<float>(0x7fea1111); + float sn = bit_cast<float>(0x7F951111); + float qn = bit_cast<float>(0x7FEA1111); CHECK(IsSignallingNaN(sn)); CHECK(IsQuietNaN(qn)); // The input NaNs after passing through ProcessNaN. - float sn_proc = bit_cast<float>(0x7fd51111); + float sn_proc = bit_cast<float>(0x7FD51111); float qn_proc = qn; CHECK(IsQuietNaN(sn_proc)); CHECK(IsQuietNaN(qn_proc)); @@ -15090,18 +14700,18 @@ static void ProcessNaNsHelper(double n, double m, double expected) { TEST(process_nans_double) { INIT_V8(); // Make sure that NaN propagation works correctly. - double sn = bit_cast<double>(0x7ff5555511111111); - double sm = bit_cast<double>(0x7ff5555522222222); - double qn = bit_cast<double>(0x7ffaaaaa11111111); - double qm = bit_cast<double>(0x7ffaaaaa22222222); + double sn = bit_cast<double>(0x7FF5555511111111); + double sm = bit_cast<double>(0x7FF5555522222222); + double qn = bit_cast<double>(0x7FFAAAAA11111111); + double qm = bit_cast<double>(0x7FFAAAAA22222222); CHECK(IsSignallingNaN(sn)); CHECK(IsSignallingNaN(sm)); CHECK(IsQuietNaN(qn)); CHECK(IsQuietNaN(qm)); // The input NaNs after passing through ProcessNaN. - double sn_proc = bit_cast<double>(0x7ffd555511111111); - double sm_proc = bit_cast<double>(0x7ffd555522222222); + double sn_proc = bit_cast<double>(0x7FFD555511111111); + double sm_proc = bit_cast<double>(0x7FFD555522222222); double qn_proc = qn; double qm_proc = qm; CHECK(IsQuietNaN(sn_proc)); @@ -15162,18 +14772,18 @@ static void ProcessNaNsHelper(float n, float m, float expected) { TEST(process_nans_float) { INIT_V8(); // Make sure that NaN propagation works correctly. - float sn = bit_cast<float>(0x7f951111); - float sm = bit_cast<float>(0x7f952222); - float qn = bit_cast<float>(0x7fea1111); - float qm = bit_cast<float>(0x7fea2222); + float sn = bit_cast<float>(0x7F951111); + float sm = bit_cast<float>(0x7F952222); + float qn = bit_cast<float>(0x7FEA1111); + float qm = bit_cast<float>(0x7FEA2222); CHECK(IsSignallingNaN(sn)); CHECK(IsSignallingNaN(sm)); CHECK(IsQuietNaN(qn)); CHECK(IsQuietNaN(qm)); // The input NaNs after passing through ProcessNaN. - float sn_proc = bit_cast<float>(0x7fd51111); - float sm_proc = bit_cast<float>(0x7fd52222); + float sn_proc = bit_cast<float>(0x7FD51111); + float sm_proc = bit_cast<float>(0x7FD52222); float qn_proc = qn; float qm_proc = qm; CHECK(IsQuietNaN(sn_proc)); @@ -15287,12 +14897,12 @@ static void DefaultNaNHelper(float n, float m, float a) { TEST(default_nan_float) { INIT_V8(); - float sn = bit_cast<float>(0x7f951111); - float sm = bit_cast<float>(0x7f952222); - float sa = bit_cast<float>(0x7f95aaaa); - float qn = bit_cast<float>(0x7fea1111); - float qm = bit_cast<float>(0x7fea2222); - float qa = bit_cast<float>(0x7feaaaaa); + float sn = bit_cast<float>(0x7F951111); + float sm = bit_cast<float>(0x7F952222); + float sa = bit_cast<float>(0x7F95AAAA); + float qn = bit_cast<float>(0x7FEA1111); + float qm = bit_cast<float>(0x7FEA2222); + float qa = bit_cast<float>(0x7FEAAAAA); CHECK(IsSignallingNaN(sn)); CHECK(IsSignallingNaN(sm)); CHECK(IsSignallingNaN(sa)); @@ -15415,12 +15025,12 @@ static void DefaultNaNHelper(double n, double m, double a) { TEST(default_nan_double) { INIT_V8(); - double sn = bit_cast<double>(0x7ff5555511111111); - double sm = bit_cast<double>(0x7ff5555522222222); - double sa = bit_cast<double>(0x7ff55555aaaaaaaa); - double qn = bit_cast<double>(0x7ffaaaaa11111111); - double qm = bit_cast<double>(0x7ffaaaaa22222222); - double qa = bit_cast<double>(0x7ffaaaaaaaaaaaaa); + double sn = bit_cast<double>(0x7FF5555511111111); + double sm = bit_cast<double>(0x7FF5555522222222); + double sa = bit_cast<double>(0x7FF55555AAAAAAAA); + double qn = bit_cast<double>(0x7FFAAAAA11111111); + double qm = bit_cast<double>(0x7FFAAAAA22222222); + double qa = bit_cast<double>(0x7FFAAAAAAAAAAAAA); CHECK(IsSignallingNaN(sn)); CHECK(IsSignallingNaN(sm)); CHECK(IsSignallingNaN(sa)); diff --git a/deps/v8/test/cctest/test-assembler-ia32.cc b/deps/v8/test/cctest/test-assembler-ia32.cc index e39489b93d..5b79ff1fc1 100644 --- a/deps/v8/test/cctest/test-assembler-ia32.cc +++ b/deps/v8/test/cctest/test-assembler-ia32.cc @@ -521,6 +521,7 @@ TEST(AssemblerIa32SSE) { __ mulps(xmm2, xmm1); __ subps(xmm2, xmm0); __ divps(xmm2, xmm1); + __ haddps(xmm1, xmm0); __ cvttss2si(eax, xmm2); __ ret(0); } @@ -1054,12 +1055,12 @@ TEST(AssemblerIa32BMI1) { // blsmsk __ inc(eax); __ blsmsk(ebx, ecx); - __ cmp(ebx, Immediate(0x0000000fu)); // expected result + __ cmp(ebx, Immediate(0x0000000Fu)); // expected result __ j(not_equal, &exit); __ inc(eax); __ blsmsk(ebx, Operand(esp, 0)); - __ cmp(ebx, Immediate(0x0000000fu)); // expected result + __ cmp(ebx, Immediate(0x0000000Fu)); // expected result __ j(not_equal, &exit); // blsr @@ -1250,7 +1251,7 @@ TEST(AssemblerIa32BMI2) { __ j(not_equal, &exit); // pdep - __ mov(edx, Immediate(0xfffffff0u)); + __ mov(edx, Immediate(0xFFFFFFF0u)); __ inc(eax); __ pdep(ebx, edx, ecx); @@ -1263,16 +1264,16 @@ TEST(AssemblerIa32BMI2) { __ j(not_equal, &exit); // pext - __ mov(edx, Immediate(0xfffffff0u)); + __ mov(edx, Immediate(0xFFFFFFF0u)); __ inc(eax); __ pext(ebx, edx, ecx); - __ cmp(ebx, Immediate(0x0000fffeu)); // expected result + __ cmp(ebx, Immediate(0x0000FFFEu)); // expected result __ j(not_equal, &exit); __ inc(eax); __ pext(ebx, edx, Operand(esp, 0)); - __ cmp(ebx, Immediate(0x0000fffeu)); // expected result + __ cmp(ebx, Immediate(0x0000FFFEu)); // expected result __ j(not_equal, &exit); // sarx diff --git a/deps/v8/test/cctest/test-assembler-mips.cc b/deps/v8/test/cctest/test-assembler-mips.cc index 79a80c3a43..1b337f525c 100644 --- a/deps/v8/test/cctest/test-assembler-mips.cc +++ b/deps/v8/test/cctest/test-assembler-mips.cc @@ -35,7 +35,7 @@ #include "src/factory.h" #include "src/macro-assembler.h" #include "src/mips/macro-assembler-mips.h" -#include "src/mips/simulator-mips.h" +#include "src/simulator.h" #include "test/cctest/cctest.h" @@ -43,10 +43,11 @@ namespace v8 { namespace internal { // Define these function prototypes to match JSEntryFunction in execution.cc. -typedef Object* (*F1)(int x, int p1, int p2, int p3, int p4); -typedef Object* (*F2)(int x, int y, int p2, int p3, int p4); -typedef Object* (*F3)(void* p, int p1, int p2, int p3, int p4); -typedef Object* (*F4)(void* p0, void* p1, int p2, int p3, int p4); +// TODO(mips): Refine these signatures per test case. +typedef Object*(F1)(int x, int p1, int p2, int p3, int p4); +typedef Object*(F2)(int x, int y, int p2, int p3, int p4); +typedef Object*(F3)(void* p, int p1, int p2, int p3, int p4); +typedef Object*(F4)(void* p0, void* p1, int p2, int p3, int p4); #define __ assm. @@ -67,10 +68,9 @@ TEST(MIPS0) { assm.GetCode(isolate, &desc); Handle<Code> code = isolate->factory()->NewCode(desc, Code::STUB, Handle<Code>()); - F2 f = FUNCTION_CAST<F2>(code->entry()); - int res = reinterpret_cast<int>( - CALL_GENERATED_CODE(isolate, f, 0xab0, 0xc, 0, 0, 0)); - CHECK_EQ(static_cast<int32_t>(0xabc), res); + auto f = GeneratedCode<F2>::FromCode(*code); + int res = reinterpret_cast<int>(f.Call(0xAB0, 0xC, 0, 0, 0)); + CHECK_EQ(static_cast<int32_t>(0xABC), res); } @@ -104,9 +104,8 @@ TEST(MIPS1) { assm.GetCode(isolate, &desc); Handle<Code> code = isolate->factory()->NewCode(desc, Code::STUB, Handle<Code>()); - F1 f = FUNCTION_CAST<F1>(code->entry()); - int res = reinterpret_cast<int>( - CALL_GENERATED_CODE(isolate, f, 50, 0, 0, 0, 0)); + auto f = GeneratedCode<F1>::FromCode(*code); + int res = reinterpret_cast<int>(f.Call(50, 0, 0, 0, 0)); CHECK_EQ(1275, res); } @@ -129,8 +128,8 @@ TEST(MIPS2) { __ ori(t0, zero_reg, 0); __ lui(t0, 0x1234); __ ori(t0, t0, 0); - __ ori(t0, t0, 0x0f0f); - __ ori(t0, t0, 0xf0f0); + __ ori(t0, t0, 0x0F0F); + __ ori(t0, t0, 0xF0F0); __ addiu(t1, t0, 1); __ addiu(t2, t1, -0x10); @@ -138,20 +137,20 @@ TEST(MIPS2) { __ li(t0, 0x00000004); __ li(t1, 0x00001234); __ li(t2, 0x12345678); - __ li(t3, 0x7fffffff); - __ li(t4, 0xfffffffc); - __ li(t5, 0xffffedcc); - __ li(t6, 0xedcba988); + __ li(t3, 0x7FFFFFFF); + __ li(t4, 0xFFFFFFFC); + __ li(t5, 0xFFFFEDCC); + __ li(t6, 0xEDCBA988); __ li(t7, 0x80000000); // SPECIAL class. __ srl(v0, t2, 8); // 0x00123456 - __ sll(v0, v0, 11); // 0x91a2b000 - __ sra(v0, v0, 3); // 0xf2345600 - __ srav(v0, v0, t0); // 0xff234560 - __ sllv(v0, v0, t0); // 0xf2345600 - __ srlv(v0, v0, t0); // 0x0f234560 - __ Branch(&error, ne, v0, Operand(0x0f234560)); + __ sll(v0, v0, 11); // 0x91A2B000 + __ sra(v0, v0, 3); // 0xF2345600 + __ srav(v0, v0, t0); // 0xFF234560 + __ sllv(v0, v0, t0); // 0xF2345600 + __ srlv(v0, v0, t0); // 0x0F234560 + __ Branch(&error, ne, v0, Operand(0x0F234560)); __ nop(); __ addu(v0, t0, t1); // 0x00001238 @@ -161,15 +160,15 @@ TEST(MIPS2) { __ addu(v1, t3, t0); __ Branch(&error, ne, v1, Operand(0x80000003)); __ nop(); - __ subu(v1, t7, t0); // 0x7ffffffc - __ Branch(&error, ne, v1, Operand(0x7ffffffc)); + __ subu(v1, t7, t0); // 0x7FFFFFFC + __ Branch(&error, ne, v1, Operand(0x7FFFFFFC)); __ nop(); __ and_(v0, t1, t2); // 0x00001230 __ or_(v0, v0, t1); // 0x00001234 - __ xor_(v0, v0, t2); // 0x1234444c - __ nor(v0, v0, t2); // 0xedcba987 - __ Branch(&error, ne, v0, Operand(0xedcba983)); + __ xor_(v0, v0, t2); // 0x1234444C + __ nor(v0, v0, t2); // 0xEDCBA987 + __ Branch(&error, ne, v0, Operand(0xEDCBA983)); __ nop(); __ slt(v0, t7, t3); @@ -190,7 +189,7 @@ TEST(MIPS2) { __ nop(); __ slti(v0, t1, 0x00002000); // 0x1 - __ slti(v0, v0, 0xffff8000); // 0x0 + __ slti(v0, v0, 0xFFFF8000); // 0x0 __ Branch(&error, ne, v0, Operand(zero_reg)); __ nop(); __ sltiu(v0, t1, 0x00002000); // 0x1 @@ -198,10 +197,10 @@ TEST(MIPS2) { __ Branch(&error, ne, v0, Operand(0x1)); __ nop(); - __ andi(v0, t1, 0xf0f0); // 0x00001030 - __ ori(v0, v0, 0x8a00); // 0x00009a30 - __ xori(v0, v0, 0x83cc); // 0x000019fc - __ Branch(&error, ne, v0, Operand(0x000019fc)); + __ andi(v0, t1, 0xF0F0); // 0x00001030 + __ ori(v0, v0, 0x8A00); // 0x00009A30 + __ xori(v0, v0, 0x83CC); // 0x000019FC + __ Branch(&error, ne, v0, Operand(0x000019FC)); __ nop(); __ lui(v1, 0x8123); // 0x81230000 __ Branch(&error, ne, v1, Operand(0x81230000)); @@ -218,11 +217,11 @@ TEST(MIPS2) { __ addu(v0, v0, v1); // 51 __ Branch(&error, ne, v0, Operand(51)); __ Movn(a0, t3, t0); // Move a0<-t3 (t0 is NOT 0). - __ Ins(a0, t1, 12, 8); // 0x7ff34fff - __ Branch(&error, ne, a0, Operand(0x7ff34fff)); + __ Ins(a0, t1, 12, 8); // 0x7FF34FFF + __ Branch(&error, ne, a0, Operand(0x7FF34FFF)); __ Movz(a0, t6, t7); // a0 not updated (t7 is NOT 0). - __ Ext(a1, a0, 8, 12); // 0x34f - __ Branch(&error, ne, a1, Operand(0x34f)); + __ Ext(a1, a0, 8, 12); // 0x34F + __ Branch(&error, ne, a1, Operand(0x34F)); __ Movz(a0, t6, v1); // a0<-t6, v0 is 0, from 8 instr back. __ Branch(&error, ne, a0, Operand(t6)); @@ -243,9 +242,8 @@ TEST(MIPS2) { assm.GetCode(isolate, &desc); Handle<Code> code = isolate->factory()->NewCode(desc, Code::STUB, Handle<Code>()); - F2 f = FUNCTION_CAST<F2>(code->entry()); - int res = reinterpret_cast<int>( - CALL_GENERATED_CODE(isolate, f, 0xab0, 0xc, 0, 0, 0)); + auto f = GeneratedCode<F2>::FromCode(*code); + int res = reinterpret_cast<int>(f.Call(0xAB0, 0xC, 0, 0, 0)); CHECK_EQ(static_cast<int32_t>(0x31415926), res); } @@ -346,7 +344,7 @@ TEST(MIPS3) { assm.GetCode(isolate, &desc); Handle<Code> code = isolate->factory()->NewCode(desc, Code::STUB, Handle<Code>()); - F3 f = FUNCTION_CAST<F3>(code->entry()); + auto f = GeneratedCode<F3>::FromCode(*code); // Double test values. t.a = 1.5e14; t.b = 2.75e11; @@ -363,8 +361,7 @@ TEST(MIPS3) { t.fd = 0.0; t.fe = 0.0; t.ff = 0.0; - Object* dummy = CALL_GENERATED_CODE(isolate, f, &t, 0, 0, 0, 0); - USE(dummy); + f.Call(&t, 0, 0, 0, 0); // Expected double results. CHECK_EQ(1.5e14, t.a); CHECK_EQ(1.5e14, t.b); @@ -451,12 +448,11 @@ TEST(MIPS4) { assm.GetCode(isolate, &desc); Handle<Code> code = isolate->factory()->NewCode(desc, Code::STUB, Handle<Code>()); - F3 f = FUNCTION_CAST<F3>(code->entry()); + auto f = GeneratedCode<F3>::FromCode(*code); t.a = 1.5e22; t.b = 2.75e11; t.c = 17.17; - Object* dummy = CALL_GENERATED_CODE(isolate, f, &t, 0, 0, 0, 0); - USE(dummy); + f.Call(&t, 0, 0, 0, 0); CHECK_EQ(2.75e11, t.a); CHECK_EQ(2.75e11, t.b); @@ -515,13 +511,12 @@ TEST(MIPS5) { assm.GetCode(isolate, &desc); Handle<Code> code = isolate->factory()->NewCode(desc, Code::STUB, Handle<Code>()); - F3 f = FUNCTION_CAST<F3>(code->entry()); + auto f = GeneratedCode<F3>::FromCode(*code); t.a = 1.5e4; t.b = 2.75e8; t.i = 12345678; t.j = -100000; - Object* dummy = CALL_GENERATED_CODE(isolate, f, &t, 0, 0, 0, 0); - USE(dummy); + f.Call(&t, 0, 0, 0, 0); CHECK_EQ(12345678.0, t.a); CHECK_EQ(-100000.0, t.b); @@ -585,25 +580,24 @@ TEST(MIPS6) { assm.GetCode(isolate, &desc); Handle<Code> code = isolate->factory()->NewCode(desc, Code::STUB, Handle<Code>()); - F3 f = FUNCTION_CAST<F3>(code->entry()); + auto f = GeneratedCode<F3>::FromCode(*code); t.ui = 0x11223344; - t.si = 0x99aabbcc; - Object* dummy = CALL_GENERATED_CODE(isolate, f, &t, 0, 0, 0, 0); - USE(dummy); + t.si = 0x99AABBCC; + f.Call(&t, 0, 0, 0, 0); CHECK_EQ(static_cast<int32_t>(0x11223344), t.r1); #if __BYTE_ORDER == __LITTLE_ENDIAN CHECK_EQ(static_cast<int32_t>(0x3344), t.r2); - CHECK_EQ(static_cast<int32_t>(0xffffbbcc), t.r3); - CHECK_EQ(static_cast<int32_t>(0x0000bbcc), t.r4); - CHECK_EQ(static_cast<int32_t>(0xffffffcc), t.r5); - CHECK_EQ(static_cast<int32_t>(0x3333bbcc), t.r6); + CHECK_EQ(static_cast<int32_t>(0xFFFFBBCC), t.r3); + CHECK_EQ(static_cast<int32_t>(0x0000BBCC), t.r4); + CHECK_EQ(static_cast<int32_t>(0xFFFFFFCC), t.r5); + CHECK_EQ(static_cast<int32_t>(0x3333BBCC), t.r6); #elif __BYTE_ORDER == __BIG_ENDIAN CHECK_EQ(static_cast<int32_t>(0x1122), t.r2); - CHECK_EQ(static_cast<int32_t>(0xffff99aa), t.r3); - CHECK_EQ(static_cast<int32_t>(0x000099aa), t.r4); - CHECK_EQ(static_cast<int32_t>(0xffffff99), t.r5); - CHECK_EQ(static_cast<int32_t>(0x99aa3333), t.r6); + CHECK_EQ(static_cast<int32_t>(0xFFFF99AA), t.r3); + CHECK_EQ(static_cast<int32_t>(0x000099AA), t.r4); + CHECK_EQ(static_cast<int32_t>(0xFFFFFF99), t.r5); + CHECK_EQ(static_cast<int32_t>(0x99AA3333), t.r6); #else #error Unknown endianness #endif @@ -679,7 +673,7 @@ TEST(MIPS7) { assm.GetCode(isolate, &desc); Handle<Code> code = isolate->factory()->NewCode(desc, Code::STUB, Handle<Code>()); - F3 f = FUNCTION_CAST<F3>(code->entry()); + auto f = GeneratedCode<F3>::FromCode(*code); t.a = 1.5e14; t.b = 2.75e11; t.c = 2.0; @@ -687,8 +681,7 @@ TEST(MIPS7) { t.e = 0.0; t.f = 0.0; t.result = 0; - Object* dummy = CALL_GENERATED_CODE(isolate, f, &t, 0, 0, 0, 0); - USE(dummy); + f.Call(&t, 0, 0, 0, 0); CHECK_EQ(1.5e14, t.a); CHECK_EQ(2.75e11, t.b); CHECK_EQ(1, t.result); @@ -730,11 +723,11 @@ TEST(MIPS8) { // ROTR instruction (called through the Ror macro). __ Ror(t1, t0, 0x0004); __ Ror(t2, t0, 0x0008); - __ Ror(t3, t0, 0x000c); + __ Ror(t3, t0, 0x000C); __ Ror(t4, t0, 0x0010); __ Ror(t5, t0, 0x0014); __ Ror(t6, t0, 0x0018); - __ Ror(t7, t0, 0x001c); + __ Ror(t7, t0, 0x001C); // Basic word store. __ sw(t1, MemOperand(a0, offsetof(T, result_rotr_4)) ); @@ -777,10 +770,9 @@ TEST(MIPS8) { assm.GetCode(isolate, &desc); Handle<Code> code = isolate->factory()->NewCode(desc, Code::STUB, Handle<Code>()); - F3 f = FUNCTION_CAST<F3>(code->entry()); + auto f = GeneratedCode<F3>::FromCode(*code); t.input = 0x12345678; - Object* dummy = CALL_GENERATED_CODE(isolate, f, &t, 0x0, 0, 0, 0); - USE(dummy); + f.Call(&t, 0x0, 0, 0, 0); CHECK_EQ(static_cast<int32_t>(0x81234567), t.result_rotr_4); CHECK_EQ(static_cast<int32_t>(0x78123456), t.result_rotr_8); CHECK_EQ(static_cast<int32_t>(0x67812345), t.result_rotr_12); @@ -875,11 +867,10 @@ TEST(MIPS10) { assm.GetCode(isolate, &desc); Handle<Code> code = isolate->factory()->NewCode(desc, Code::STUB, Handle<Code>()); - F3 f = FUNCTION_CAST<F3>(code->entry()); + auto f = GeneratedCode<F3>::FromCode(*code); t.a = 2.147483646e+09; // 0x7FFFFFFE -> 0xFF80000041DFFFFF as double. - t.b_word = 0x0ff00ff0; // 0x0FF00FF0 -> 0x as double. - Object* dummy = CALL_GENERATED_CODE(isolate, f, &t, 0, 0, 0, 0); - USE(dummy); + t.b_word = 0x0FF00FF0; // 0x0FF00FF0 -> 0x as double. + f.Call(&t, 0, 0, 0, 0); CHECK_EQ(static_cast<int32_t>(0x41DFFFFF), t.dbl_exp); CHECK_EQ(static_cast<int32_t>(0xFF800000), t.dbl_mant); CHECK_EQ(static_cast<int32_t>(0x7FFFFFFE), t.word); @@ -1003,53 +994,52 @@ TEST(MIPS11) { assm.GetCode(isolate, &desc); Handle<Code> code = isolate->factory()->NewCode(desc, Code::STUB, Handle<Code>()); - F3 f = FUNCTION_CAST<F3>(code->entry()); - t.reg_init = 0xaabbccdd; + auto f = GeneratedCode<F3>::FromCode(*code); + t.reg_init = 0xAABBCCDD; t.mem_init = 0x11223344; - Object* dummy = CALL_GENERATED_CODE(isolate, f, &t, 0, 0, 0, 0); - USE(dummy); + f.Call(&t, 0, 0, 0, 0); #if __BYTE_ORDER == __LITTLE_ENDIAN - CHECK_EQ(static_cast<int32_t>(0x44bbccdd), t.lwl_0); - CHECK_EQ(static_cast<int32_t>(0x3344ccdd), t.lwl_1); - CHECK_EQ(static_cast<int32_t>(0x223344dd), t.lwl_2); + CHECK_EQ(static_cast<int32_t>(0x44BBCCDD), t.lwl_0); + CHECK_EQ(static_cast<int32_t>(0x3344CCDD), t.lwl_1); + CHECK_EQ(static_cast<int32_t>(0x223344DD), t.lwl_2); CHECK_EQ(static_cast<int32_t>(0x11223344), t.lwl_3); CHECK_EQ(static_cast<int32_t>(0x11223344), t.lwr_0); - CHECK_EQ(static_cast<int32_t>(0xaa112233), t.lwr_1); - CHECK_EQ(static_cast<int32_t>(0xaabb1122), t.lwr_2); - CHECK_EQ(static_cast<int32_t>(0xaabbcc11), t.lwr_3); - - CHECK_EQ(static_cast<int32_t>(0x112233aa), t.swl_0); - CHECK_EQ(static_cast<int32_t>(0x1122aabb), t.swl_1); - CHECK_EQ(static_cast<int32_t>(0x11aabbcc), t.swl_2); - CHECK_EQ(static_cast<int32_t>(0xaabbccdd), t.swl_3); - - CHECK_EQ(static_cast<int32_t>(0xaabbccdd), t.swr_0); - CHECK_EQ(static_cast<int32_t>(0xbbccdd44), t.swr_1); - CHECK_EQ(static_cast<int32_t>(0xccdd3344), t.swr_2); - CHECK_EQ(static_cast<int32_t>(0xdd223344), t.swr_3); + CHECK_EQ(static_cast<int32_t>(0xAA112233), t.lwr_1); + CHECK_EQ(static_cast<int32_t>(0xAABB1122), t.lwr_2); + CHECK_EQ(static_cast<int32_t>(0xAABBCC11), t.lwr_3); + + CHECK_EQ(static_cast<int32_t>(0x112233AA), t.swl_0); + CHECK_EQ(static_cast<int32_t>(0x1122AABB), t.swl_1); + CHECK_EQ(static_cast<int32_t>(0x11AABBCC), t.swl_2); + CHECK_EQ(static_cast<int32_t>(0xAABBCCDD), t.swl_3); + + CHECK_EQ(static_cast<int32_t>(0xAABBCCDD), t.swr_0); + CHECK_EQ(static_cast<int32_t>(0xBBCCDD44), t.swr_1); + CHECK_EQ(static_cast<int32_t>(0xCCDD3344), t.swr_2); + CHECK_EQ(static_cast<int32_t>(0xDD223344), t.swr_3); #elif __BYTE_ORDER == __BIG_ENDIAN CHECK_EQ(static_cast<int32_t>(0x11223344), t.lwl_0); - CHECK_EQ(static_cast<int32_t>(0x223344dd), t.lwl_1); - CHECK_EQ(static_cast<int32_t>(0x3344ccdd), t.lwl_2); - CHECK_EQ(static_cast<int32_t>(0x44bbccdd), t.lwl_3); + CHECK_EQ(static_cast<int32_t>(0x223344DD), t.lwl_1); + CHECK_EQ(static_cast<int32_t>(0x3344CCDD), t.lwl_2); + CHECK_EQ(static_cast<int32_t>(0x44BBCCDD), t.lwl_3); - CHECK_EQ(static_cast<int32_t>(0xaabbcc11), t.lwr_0); - CHECK_EQ(static_cast<int32_t>(0xaabb1122), t.lwr_1); - CHECK_EQ(static_cast<int32_t>(0xaa112233), t.lwr_2); + CHECK_EQ(static_cast<int32_t>(0xAABBCC11), t.lwr_0); + CHECK_EQ(static_cast<int32_t>(0xAABB1122), t.lwr_1); + CHECK_EQ(static_cast<int32_t>(0xAA112233), t.lwr_2); CHECK_EQ(static_cast<int32_t>(0x11223344), t.lwr_3); - CHECK_EQ(static_cast<int32_t>(0xaabbccdd), t.swl_0); - CHECK_EQ(static_cast<int32_t>(0x11aabbcc), t.swl_1); - CHECK_EQ(static_cast<int32_t>(0x1122aabb), t.swl_2); - CHECK_EQ(static_cast<int32_t>(0x112233aa), t.swl_3); + CHECK_EQ(static_cast<int32_t>(0xAABBCCDD), t.swl_0); + CHECK_EQ(static_cast<int32_t>(0x11AABBCC), t.swl_1); + CHECK_EQ(static_cast<int32_t>(0x1122AABB), t.swl_2); + CHECK_EQ(static_cast<int32_t>(0x112233AA), t.swl_3); - CHECK_EQ(static_cast<int32_t>(0xdd223344), t.swr_0); - CHECK_EQ(static_cast<int32_t>(0xccdd3344), t.swr_1); - CHECK_EQ(static_cast<int32_t>(0xbbccdd44), t.swr_2); - CHECK_EQ(static_cast<int32_t>(0xaabbccdd), t.swr_3); + CHECK_EQ(static_cast<int32_t>(0xDD223344), t.swr_0); + CHECK_EQ(static_cast<int32_t>(0xCCDD3344), t.swr_1); + CHECK_EQ(static_cast<int32_t>(0xBBCCDD44), t.swr_2); + CHECK_EQ(static_cast<int32_t>(0xAABBCCDD), t.swr_3); #else #error Unknown endianness #endif @@ -1130,7 +1120,7 @@ TEST(MIPS12) { assm.GetCode(isolate, &desc); Handle<Code> code = isolate->factory()->NewCode(desc, Code::STUB, Handle<Code>()); - F3 f = FUNCTION_CAST<F3>(code->entry()); + auto f = GeneratedCode<F3>::FromCode(*code); t.x = 1; t.y = 2; t.y1 = 3; @@ -1138,8 +1128,7 @@ TEST(MIPS12) { t.y3 = 0XBABA; t.y4 = 0xDEDA; - Object* dummy = CALL_GENERATED_CODE(isolate, f, &t, 0, 0, 0, 0); - USE(dummy); + f.Call(&t, 0, 0, 0, 0); CHECK_EQ(3, t.y1); } @@ -1185,13 +1174,12 @@ TEST(MIPS13) { assm.GetCode(isolate, &desc); Handle<Code> code = isolate->factory()->NewCode(desc, Code::STUB, Handle<Code>()); - F3 f = FUNCTION_CAST<F3>(code->entry()); + auto f = GeneratedCode<F3>::FromCode(*code); t.cvt_big_in = 0xFFFFFFFF; t.cvt_small_in = 333; - Object* dummy = CALL_GENERATED_CODE(isolate, f, &t, 0, 0, 0, 0); - USE(dummy); + f.Call(&t, 0, 0, 0, 0); CHECK_EQ(t.cvt_big_out, static_cast<double>(t.cvt_big_in)); CHECK_EQ(t.cvt_small_out, static_cast<double>(t.cvt_small_in)); @@ -1307,7 +1295,7 @@ TEST(MIPS14) { assm.GetCode(isolate, &desc); Handle<Code> code = isolate->factory()->NewCode(desc, Code::STUB, Handle<Code>()); - F3 f = FUNCTION_CAST<F3>(code->entry()); + auto f = GeneratedCode<F3>::FromCode(*code); t.round_up_in = 123.51; t.round_down_in = 123.49; @@ -1318,8 +1306,7 @@ TEST(MIPS14) { t.err3_in = static_cast<double>(1) + 0xFFFFFFFF; t.err4_in = NAN; - Object* dummy = CALL_GENERATED_CODE(isolate, f, &t, 0, 0, 0, 0); - USE(dummy); + f.Call(&t, 0, 0, 0, 0); #define GET_FPU_ERR(x) (static_cast<int>(x & kFCSRFlagMask)) #define CHECK_NAN2008(x) (x & kFCSRNaN2008FlagMask) @@ -1413,9 +1400,9 @@ TEST(seleqz_selnez) { assm.GetCode(isolate, &desc); Handle<Code> code = isolate->factory()->NewCode(desc, Code::STUB, Handle<Code>()); - F3 f = FUNCTION_CAST<F3>(code->entry()); + auto f = GeneratedCode<F3>::FromCode(*code); - (CALL_GENERATED_CODE(isolate, f, &test, 0, 0, 0, 0)); + (f.Call(&test, 0, 0, 0, 0)); CHECK_EQ(1, test.a); CHECK_EQ(0, test.b); @@ -1443,7 +1430,7 @@ TEST(seleqz_selnez) { test.f = tests_D[j]; test.i = inputs_S[i]; test.j = tests_S[j]; - (CALL_GENERATED_CODE(isolate, f, &test, 0, 0, 0, 0)); + (f.Call(&test, 0, 0, 0, 0)); CHECK_EQ(outputs_D[i], test.g); CHECK_EQ(0, test.h); CHECK_EQ(outputs_S[i], test.k); @@ -1451,7 +1438,7 @@ TEST(seleqz_selnez) { test.f = tests_D[j+1]; test.j = tests_S[j+1]; - (CALL_GENERATED_CODE(isolate, f, &test, 0, 0, 0, 0)); + (f.Call(&test, 0, 0, 0, 0)); CHECK_EQ(0, test.g); CHECK_EQ(outputs_D[i], test.h); CHECK_EQ(0, test.k); @@ -1528,14 +1515,14 @@ TEST(min_max) { assm.GetCode(isolate, &desc); Handle<Code> code = isolate->factory()->NewCode(desc, Code::STUB, Handle<Code>()); - F3 f = FUNCTION_CAST<F3>(code->entry()); + auto f = GeneratedCode<F3>::FromCode(*code); for (int i = 0; i < kTableLength; i++) { test.a = inputsa[i]; test.b = inputsb[i]; test.e = inputse[i]; test.f = inputsf[i]; - CALL_GENERATED_CODE(isolate, f, &test, 0, 0, 0, 0); + f.Call(&test, 0, 0, 0, 0); CHECK_EQ(0, memcmp(&test.c, &outputsdmin[i], sizeof(test.c))); CHECK_EQ(0, memcmp(&test.d, &outputsdmax[i], sizeof(test.d))); @@ -1639,13 +1626,13 @@ TEST(rint_d) { assm.GetCode(isolate, &desc); Handle<Code> code = isolate->factory()->NewCode(desc, Code::STUB, Handle<Code>()); - F3 f = FUNCTION_CAST<F3>(code->entry()); + auto f = GeneratedCode<F3>::FromCode(*code); for (int j = 0; j < 4; j++) { test.fcsr = fcsr_inputs[j]; for (int i = 0; i < kTableLength; i++) { test.a = inputs[i]; - (CALL_GENERATED_CODE(isolate, f, &test, 0, 0, 0, 0)); + (f.Call(&test, 0, 0, 0, 0)); CHECK_EQ(test.b, outputs[j][i]); } } @@ -1687,7 +1674,7 @@ TEST(sel) { assm.GetCode(isolate, &desc); Handle<Code> code = isolate->factory()->NewCode(desc, Code::STUB, Handle<Code>()); - F3 f = FUNCTION_CAST<F3>(code->entry()); + auto f = GeneratedCode<F3>::FromCode(*code); const int test_size = 3; const int input_size = 5; @@ -1712,13 +1699,13 @@ TEST(sel) { test.ft = inputs_ft[i]; test.fd = tests_S[j]; test.fs = inputs_fs[i]; - (CALL_GENERATED_CODE(isolate, f, &test, 0, 0, 0, 0)); + (f.Call(&test, 0, 0, 0, 0)); CHECK_EQ(test.dd, inputs_ds[i]); CHECK_EQ(test.fd, inputs_fs[i]); test.dd = tests_D[j+1]; test.fd = tests_S[j+1]; - (CALL_GENERATED_CODE(isolate, f, &test, 0, 0, 0, 0)); + (f.Call(&test, 0, 0, 0, 0)); CHECK_EQ(test.dd, inputs_dt[i]); CHECK_EQ(test.fd, inputs_ft[i]); } @@ -1820,13 +1807,13 @@ TEST(rint_s) { assm.GetCode(isolate, &desc); Handle<Code> code = isolate->factory()->NewCode(desc, Code::STUB, Handle<Code>()); - F3 f = FUNCTION_CAST<F3>(code->entry()); + auto f = GeneratedCode<F3>::FromCode(*code); for (int j = 0; j < 4; j++) { test.fcsr = fcsr_inputs[j]; for (int i = 0; i < kTableLength; i++) { test.a = inputs[i]; - (CALL_GENERATED_CODE(isolate, f, &test, 0, 0, 0, 0)); + (f.Call(&test, 0, 0, 0, 0)); CHECK_EQ(test.b, outputs[j][i]); } } @@ -1846,14 +1833,10 @@ TEST(Cvt_d_uw) { uint64_t output; } TestStruct; - unsigned inputs[] = { - 0x0, 0xffffffff, 0x80000000, 0x7fffffff - }; + unsigned inputs[] = {0x0, 0xFFFFFFFF, 0x80000000, 0x7FFFFFFF}; - uint64_t outputs[] = { - 0x0, 0x41efffffffe00000, - 0x41e0000000000000, 0x41dfffffffc00000 - }; + uint64_t outputs[] = {0x0, 0x41EFFFFFFFE00000, 0x41E0000000000000, + 0x41DFFFFFFFC00000}; int kTableLength = sizeof(inputs)/sizeof(inputs[0]); @@ -1869,10 +1852,10 @@ TEST(Cvt_d_uw) { assm.GetCode(isolate, &desc); Handle<Code> code = isolate->factory()->NewCode(desc, Code::STUB, Handle<Code>()); - F3 f = FUNCTION_CAST<F3>(code->entry()); + auto f = GeneratedCode<F3>::FromCode(*code); for (int i = 0; i < kTableLength; i++) { test.input = inputs[i]; - (CALL_GENERATED_CODE(isolate, f, &test, 0, 0, 0, 0)); + (f.Call(&test, 0, 0, 0, 0)); // Check outputs CHECK_EQ(test.output, outputs[i]); } @@ -1951,13 +1934,13 @@ TEST(mina_maxa) { assm.GetCode(isolate, &desc); Handle<Code> code = isolate->factory()->NewCode(desc, Code::STUB, Handle<Code>()); - F3 f = FUNCTION_CAST<F3>(code->entry()); + auto f = GeneratedCode<F3>::FromCode(*code); for (int i = 0; i < kTableLength; i++) { test.a = inputsa[i]; test.b = inputsb[i]; test.c = inputsc[i]; test.d = inputsd[i]; - (CALL_GENERATED_CODE(isolate, f, &test, 0, 0, 0, 0)); + (f.Call(&test, 0, 0, 0, 0)); if (i < kTableLength - 1) { CHECK_EQ(test.resd, resd[i]); CHECK_EQ(test.resf, resf[i]); @@ -2032,11 +2015,11 @@ TEST(trunc_l) { assm.GetCode(isolate, &desc); Handle<Code> code = isolate->factory()->NewCode(desc, Code::STUB, Handle<Code>()); - F3 f = FUNCTION_CAST<F3>(code->entry()); + auto f = GeneratedCode<F3>::FromCode(*code); for (int i = 0; i < kTableLength; i++) { test.a = inputs_D[i]; test.b = inputs_S[i]; - (CALL_GENERATED_CODE(isolate, f, &test, 0, 0, 0, 0)); + (f.Call(&test, 0, 0, 0, 0)); if ((test.isNaN2008 & kFCSRNaN2008FlagMask) && kArchVariant == kMips32r6) { CHECK_EQ(test.c, outputsNaN2008[i]); @@ -2113,20 +2096,20 @@ TEST(movz_movn) { assm.GetCode(isolate, &desc); Handle<Code> code = isolate->factory()->NewCode(desc, Code::STUB, Handle<Code>()); - F3 f = FUNCTION_CAST<F3>(code->entry()); + auto f = GeneratedCode<F3>::FromCode(*code); for (int i = 0; i < kTableLength; i++) { test.a = inputs_D[i]; test.c = inputs_S[i]; test.rt = 1; - (CALL_GENERATED_CODE(isolate, f, &test, 0, 0, 0, 0)); + (f.Call(&test, 0, 0, 0, 0)); CHECK_EQ(test.b, test.bold); CHECK_EQ(test.d, test.dold); CHECK_EQ(test.b1, outputs_D[i]); CHECK_EQ(test.d1, outputs_S[i]); test.rt = 0; - (CALL_GENERATED_CODE(isolate, f, &test, 0, 0, 0, 0)); + (f.Call(&test, 0, 0, 0, 0)); CHECK_EQ(test.b, outputs_D[i]); CHECK_EQ(test.d, outputs_S[i]); CHECK_EQ(test.b1, test.bold1); @@ -2215,15 +2198,15 @@ TEST(movt_movd) { assm.GetCode(isolate, &desc); Handle<Code> code = isolate->factory()->NewCode(desc, Code::STUB, Handle<Code>()); - F3 f = FUNCTION_CAST<F3>(code->entry()); + auto f = GeneratedCode<F3>::FromCode(*code); - (CALL_GENERATED_CODE(isolate, f, &test, 0, 0, 0, 0)); + (f.Call(&test, 0, 0, 0, 0)); CHECK_EQ(test.dstf, outputs_S[i]); CHECK_EQ(test.dstd, outputs_D[i]); CHECK_EQ(test.dstf1, test.dstfold1); CHECK_EQ(test.dstd1, test.dstdold1); test.fcsr = 0; - (CALL_GENERATED_CODE(isolate, f, &test, 0, 0, 0, 0)); + (f.Call(&test, 0, 0, 0, 0)); CHECK_EQ(test.dstf, test.dstfold); CHECK_EQ(test.dstd, test.dstdold); CHECK_EQ(test.dstf1, outputs_S[i]); @@ -2301,12 +2284,12 @@ TEST(cvt_w_d) { assm.GetCode(isolate, &desc); Handle<Code> code = isolate->factory()->NewCode(desc, Code::STUB, Handle<Code>()); - F3 f = FUNCTION_CAST<F3>(code->entry()); + auto f = GeneratedCode<F3>::FromCode(*code); for (int j = 0; j < 4; j++) { test.fcsr = fcsr_inputs[j]; for (int i = 0; i < kTableLength; i++) { test.a = inputs[i]; - (CALL_GENERATED_CODE(isolate, f, &test, 0, 0, 0, 0)); + (f.Call(&test, 0, 0, 0, 0)); CHECK_EQ(test.b, outputs[j][i]); } } @@ -2369,11 +2352,11 @@ TEST(trunc_w) { assm.GetCode(isolate, &desc); Handle<Code> code = isolate->factory()->NewCode(desc, Code::STUB, Handle<Code>()); - F3 f = FUNCTION_CAST<F3>(code->entry()); + auto f = GeneratedCode<F3>::FromCode(*code); for (int i = 0; i < kTableLength; i++) { test.a = inputs_D[i]; test.b = inputs_S[i]; - (CALL_GENERATED_CODE(isolate, f, &test, 0, 0, 0, 0)); + (f.Call(&test, 0, 0, 0, 0)); if ((test.isNaN2008 & kFCSRNaN2008FlagMask) && kArchVariant == kMips32r6) { CHECK_EQ(test.c, outputsNaN2008[i]); } else { @@ -2439,11 +2422,11 @@ TEST(round_w) { assm.GetCode(isolate, &desc); Handle<Code> code = isolate->factory()->NewCode(desc, Code::STUB, Handle<Code>()); - F3 f = FUNCTION_CAST<F3>(code->entry()); + auto f = GeneratedCode<F3>::FromCode(*code); for (int i = 0; i < kTableLength; i++) { test.a = inputs_D[i]; test.b = inputs_S[i]; - (CALL_GENERATED_CODE(isolate, f, &test, 0, 0, 0, 0)); + (f.Call(&test, 0, 0, 0, 0)); if ((test.isNaN2008 & kFCSRNaN2008FlagMask) && kArchVariant == kMips32r6) { CHECK_EQ(test.c, outputsNaN2008[i]); } else { @@ -2511,11 +2494,11 @@ TEST(round_l) { assm.GetCode(isolate, &desc); Handle<Code> code = isolate->factory()->NewCode(desc, Code::STUB, Handle<Code>()); - F3 f = FUNCTION_CAST<F3>(code->entry()); + auto f = GeneratedCode<F3>::FromCode(*code); for (int i = 0; i < kTableLength; i++) { test.a = inputs_D[i]; test.b = inputs_S[i]; - (CALL_GENERATED_CODE(isolate, f, &test, 0, 0, 0, 0)); + (f.Call(&test, 0, 0, 0, 0)); if ((test.isNaN2008 & kFCSRNaN2008FlagMask) && kArchVariant == kMips32r6) { CHECK_EQ(test.c, outputsNaN2008[i]); @@ -2585,13 +2568,13 @@ TEST(sub) { assm.GetCode(isolate, &desc); Handle<Code> code = isolate->factory()->NewCode(desc, Code::STUB, Handle<Code>()); - F3 f = FUNCTION_CAST<F3>(code->entry()); + auto f = GeneratedCode<F3>::FromCode(*code); for (int i = 0; i < kTableLength; i++) { test.a = inputfs_S[i]; test.b = inputft_S[i]; test.c = inputfs_D[i]; test.d = inputft_D[i]; - (CALL_GENERATED_CODE(isolate, f, &test, 0, 0, 0, 0)); + (f.Call(&test, 0, 0, 0, 0)); CHECK_EQ(test.resultS, outputs_S[i]); CHECK_EQ(test.resultD, outputs_D[i]); } @@ -2665,7 +2648,7 @@ TEST(sqrt_rsqrt_recip) { assm.GetCode(isolate, &desc); Handle<Code> code = isolate->factory()->NewCode(desc, Code::STUB, Handle<Code>()); - F3 f = FUNCTION_CAST<F3>(code->entry()); + auto f = GeneratedCode<F3>::FromCode(*code); for (int i = 0; i < kTableLength; i++) { float f1; @@ -2673,7 +2656,7 @@ TEST(sqrt_rsqrt_recip) { test.a = inputs_S[i]; test.c = inputs_D[i]; - (CALL_GENERATED_CODE(isolate, f, &test, 0, 0, 0, 0)); + (f.Call(&test, 0, 0, 0, 0)); CHECK_EQ(test.resultS, outputs_S[i]); CHECK_EQ(test.resultD, outputs_D[i]); @@ -2746,11 +2729,11 @@ TEST(neg) { assm.GetCode(isolate, &desc); Handle<Code> code = isolate->factory()->NewCode(desc, Code::STUB, Handle<Code>()); - F3 f = FUNCTION_CAST<F3>(code->entry()); + auto f = GeneratedCode<F3>::FromCode(*code); for (int i = 0; i < kTableLength; i++) { test.a = inputs_S[i]; test.c = inputs_D[i]; - (CALL_GENERATED_CODE(isolate, f, &test, 0, 0, 0, 0)); + (f.Call(&test, 0, 0, 0, 0)); CHECK_EQ(test.resultS, outputs_S[i]); CHECK_EQ(test.resultD, outputs_D[i]); } @@ -2804,13 +2787,13 @@ TEST(mul) { assm.GetCode(isolate, &desc); Handle<Code> code = isolate->factory()->NewCode(desc, Code::STUB, Handle<Code>()); - F3 f = FUNCTION_CAST<F3>(code->entry()); + auto f = GeneratedCode<F3>::FromCode(*code); for (int i = 0; i < kTableLength; i++) { test.a = inputfs_S[i]; test.b = inputft_S[i]; test.c = inputfs_D[i]; test.d = inputft_D[i]; - (CALL_GENERATED_CODE(isolate, f, &test, 0, 0, 0, 0)); + (f.Call(&test, 0, 0, 0, 0)); CHECK_EQ(test.resultS, inputfs_S[i]*inputft_S[i]); CHECK_EQ(test.resultD, inputfs_D[i]*inputft_D[i]); } @@ -2861,12 +2844,12 @@ TEST(mov) { assm.GetCode(isolate, &desc); Handle<Code> code = isolate->factory()->NewCode(desc, Code::STUB, Handle<Code>()); - F3 f = FUNCTION_CAST<F3>(code->entry()); + auto f = GeneratedCode<F3>::FromCode(*code); for (int i = 0; i < kTableLength; i++) { test.a = inputs_D[i]; test.c = inputs_S[i]; - (CALL_GENERATED_CODE(isolate, f, &test, 0, 0, 0, 0)); + (f.Call(&test, 0, 0, 0, 0)); CHECK_EQ(test.b, outputs_D[i]); CHECK_EQ(test.d, outputs_S[i]); } @@ -2929,11 +2912,11 @@ TEST(floor_w) { assm.GetCode(isolate, &desc); Handle<Code> code = isolate->factory()->NewCode(desc, Code::STUB, Handle<Code>()); - F3 f = FUNCTION_CAST<F3>(code->entry()); + auto f = GeneratedCode<F3>::FromCode(*code); for (int i = 0; i < kTableLength; i++) { test.a = inputs_D[i]; test.b = inputs_S[i]; - (CALL_GENERATED_CODE(isolate, f, &test, 0, 0, 0, 0)); + (f.Call(&test, 0, 0, 0, 0)); if ((test.isNaN2008 & kFCSRNaN2008FlagMask) && kArchVariant == kMips32r6) { CHECK_EQ(test.c, outputsNaN2008[i]); } else { @@ -3001,11 +2984,11 @@ TEST(floor_l) { assm.GetCode(isolate, &desc); Handle<Code> code = isolate->factory()->NewCode(desc, Code::STUB, Handle<Code>()); - F3 f = FUNCTION_CAST<F3>(code->entry()); + auto f = GeneratedCode<F3>::FromCode(*code); for (int i = 0; i < kTableLength; i++) { test.a = inputs_D[i]; test.b = inputs_S[i]; - (CALL_GENERATED_CODE(isolate, f, &test, 0, 0, 0, 0)); + (f.Call(&test, 0, 0, 0, 0)); if ((test.isNaN2008 & kFCSRNaN2008FlagMask) && kArchVariant == kMips32r6) { CHECK_EQ(test.c, outputsNaN2008[i]); @@ -3074,11 +3057,11 @@ TEST(ceil_w) { assm.GetCode(isolate, &desc); Handle<Code> code = isolate->factory()->NewCode(desc, Code::STUB, Handle<Code>()); - F3 f = FUNCTION_CAST<F3>(code->entry()); + auto f = GeneratedCode<F3>::FromCode(*code); for (int i = 0; i < kTableLength; i++) { test.a = inputs_D[i]; test.b = inputs_S[i]; - (CALL_GENERATED_CODE(isolate, f, &test, 0, 0, 0, 0)); + (f.Call(&test, 0, 0, 0, 0)); if ((test.isNaN2008 & kFCSRNaN2008FlagMask) && kArchVariant == kMips32r6) { CHECK_EQ(test.c, outputsNaN2008[i]); } else { @@ -3146,11 +3129,11 @@ TEST(ceil_l) { assm.GetCode(isolate, &desc); Handle<Code> code = isolate->factory()->NewCode(desc, Code::STUB, Handle<Code>()); - F3 f = FUNCTION_CAST<F3>(code->entry()); + auto f = GeneratedCode<F3>::FromCode(*code); for (int i = 0; i < kTableLength; i++) { test.a = inputs_D[i]; test.b = inputs_S[i]; - (CALL_GENERATED_CODE(isolate, f, &test, 0, 0, 0, 0)); + (f.Call(&test, 0, 0, 0, 0)); if ((test.isNaN2008 & kFCSRNaN2008FlagMask) && kArchVariant == kMips32r6) { CHECK_EQ(test.c, outputsNaN2008[i]); @@ -3200,8 +3183,8 @@ TEST(jump_tables1) { for (int i = 0; i < kNumCases; ++i) { __ bind(&labels[i]); - __ lui(v0, (values[i] >> 16) & 0xffff); - __ ori(v0, v0, values[i] & 0xffff); + __ lui(v0, (values[i] >> 16) & 0xFFFF); + __ ori(v0, v0, values[i] & 0xFFFF); __ b(&done); __ nop(); } @@ -3221,10 +3204,9 @@ TEST(jump_tables1) { #ifdef OBJECT_PRINT code->Print(std::cout); #endif - F1 f = FUNCTION_CAST<F1>(code->entry()); + auto f = GeneratedCode<F1>::FromCode(*code); for (int i = 0; i < kNumCases; ++i) { - int res = reinterpret_cast<int>( - CALL_GENERATED_CODE(isolate, f, i, 0, 0, 0, 0)); + int res = reinterpret_cast<int>(f.Call(i, 0, 0, 0, 0)); ::printf("f(%d) = %d\n", i, res); CHECK_EQ(values[i], res); } @@ -3252,8 +3234,8 @@ TEST(jump_tables2) { for (int i = 0; i < kNumCases; ++i) { __ bind(&labels[i]); - __ lui(v0, (values[i] >> 16) & 0xffff); - __ ori(v0, v0, values[i] & 0xffff); + __ lui(v0, (values[i] >> 16) & 0xFFFF); + __ ori(v0, v0, values[i] & 0xFFFF); __ b(&done); __ nop(); } @@ -3291,10 +3273,9 @@ TEST(jump_tables2) { #ifdef OBJECT_PRINT code->Print(std::cout); #endif - F1 f = FUNCTION_CAST<F1>(code->entry()); + auto f = GeneratedCode<F1>::FromCode(*code); for (int i = 0; i < kNumCases; ++i) { - int res = reinterpret_cast<int>( - CALL_GENERATED_CODE(isolate, f, i, 0, 0, 0, 0)); + int res = reinterpret_cast<int>(f.Call(i, 0, 0, 0, 0)); ::printf("f(%d) = %d\n", i, res); CHECK_EQ(values[i], res); } @@ -3329,8 +3310,8 @@ TEST(jump_tables3) { __ bind(&labels[i]); obj = *values[i]; imm32 = reinterpret_cast<intptr_t>(obj); - __ lui(v0, (imm32 >> 16) & 0xffff); - __ ori(v0, v0, imm32 & 0xffff); + __ lui(v0, (imm32 >> 16) & 0xFFFF); + __ ori(v0, v0, imm32 & 0xFFFF); __ b(&done); __ nop(); } @@ -3368,10 +3349,9 @@ TEST(jump_tables3) { #ifdef OBJECT_PRINT code->Print(std::cout); #endif - F1 f = FUNCTION_CAST<F1>(code->entry()); + auto f = GeneratedCode<F1>::FromCode(*code); for (int i = 0; i < kNumCases; ++i) { - Handle<Object> result( - CALL_GENERATED_CODE(isolate, f, i, 0, 0, 0, 0), isolate); + Handle<Object> result(f.Call(i, 0, 0, 0, 0), isolate); #ifdef OBJECT_PRINT ::printf("f(%d) = ", i); result->Print(std::cout); @@ -3416,11 +3396,10 @@ TEST(BITSWAP) { assm.GetCode(isolate, &desc); Handle<Code> code = isolate->factory()->NewCode(desc, Code::STUB, Handle<Code>()); - F3 f = FUNCTION_CAST<F3>(code->entry()); + auto f = GeneratedCode<F3>::FromCode(*code); t.r1 = 0x781A15C3; t.r2 = 0x8B71FCDE; - Object* dummy = CALL_GENERATED_CODE(isolate, f, &t, 0, 0, 0, 0); - USE(dummy); + f.Call(&t, 0, 0, 0, 0); CHECK_EQ(static_cast<int32_t>(0x1E58A8C3), t.r1); CHECK_EQ(static_cast<int32_t>(0xD18E3F7B), t.r2); @@ -3551,7 +3530,7 @@ TEST(class_fmt) { assm.GetCode(isolate, &desc); Handle<Code> code = isolate->factory()->NewCode(desc, Code::STUB, Handle<Code>()); - F3 f = FUNCTION_CAST<F3>(code->entry()); + auto f = GeneratedCode<F3>::FromCode(*code); t.dSignalingNan = std::numeric_limits<double>::signaling_NaN(); t.dQuietNan = std::numeric_limits<double>::quiet_NaN(); @@ -3576,8 +3555,7 @@ TEST(class_fmt) { t.fPosSubnorm = FLT_MIN / 20.0; t.fPosZero = +0.0; - Object* dummy = CALL_GENERATED_CODE(isolate, f, &t, 0, 0, 0, 0); - USE(dummy); + f.Call(&t, 0, 0, 0, 0); // Expected double results. CHECK_EQ(bit_cast<int64_t>(t.dSignalingNan), 0x001); CHECK_EQ(bit_cast<int64_t>(t.dQuietNan), 0x002); @@ -3644,37 +3622,37 @@ TEST(ABS) { assm.GetCode(isolate, &desc); Handle<Code> code = isolate->factory()->NewCode(desc, Code::STUB, Handle<Code>()); - F3 f = FUNCTION_CAST<F3>(code->entry()); + auto f = GeneratedCode<F3>::FromCode(*code); test.a = -2.0; test.b = -2.0; - (CALL_GENERATED_CODE(isolate, f, &test, 0, 0, 0, 0)); + (f.Call(&test, 0, 0, 0, 0)); CHECK_EQ(test.a, 2.0); CHECK_EQ(test.b, 2.0); test.a = 2.0; test.b = 2.0; - (CALL_GENERATED_CODE(isolate, f, &test, 0, 0, 0, 0)); + (f.Call(&test, 0, 0, 0, 0)); CHECK_EQ(test.a, 2.0); CHECK_EQ(test.b, 2.0); // Testing biggest positive number test.a = std::numeric_limits<double>::max(); test.b = std::numeric_limits<float>::max(); - (CALL_GENERATED_CODE(isolate, f, &test, 0, 0, 0, 0)); + (f.Call(&test, 0, 0, 0, 0)); CHECK_EQ(test.a, std::numeric_limits<double>::max()); CHECK_EQ(test.b, std::numeric_limits<float>::max()); // Testing smallest negative number test.a = -std::numeric_limits<double>::max(); // lowest() test.b = -std::numeric_limits<float>::max(); // lowest() - (CALL_GENERATED_CODE(isolate, f, &test, 0, 0, 0, 0)); + (f.Call(&test, 0, 0, 0, 0)); CHECK_EQ(test.a, std::numeric_limits<double>::max()); CHECK_EQ(test.b, std::numeric_limits<float>::max()); // Testing smallest positive number test.a = -std::numeric_limits<double>::min(); test.b = -std::numeric_limits<float>::min(); - (CALL_GENERATED_CODE(isolate, f, &test, 0, 0, 0, 0)); + (f.Call(&test, 0, 0, 0, 0)); CHECK_EQ(test.a, std::numeric_limits<double>::min()); CHECK_EQ(test.b, std::numeric_limits<float>::min()); @@ -3683,7 +3661,7 @@ TEST(ABS) { / std::numeric_limits<double>::min(); test.b = -std::numeric_limits<float>::max() / std::numeric_limits<float>::min(); - (CALL_GENERATED_CODE(isolate, f, &test, 0, 0, 0, 0)); + (f.Call(&test, 0, 0, 0, 0)); CHECK_EQ(test.a, std::numeric_limits<double>::max() / std::numeric_limits<double>::min()); CHECK_EQ(test.b, std::numeric_limits<float>::max() @@ -3691,13 +3669,13 @@ TEST(ABS) { test.a = std::numeric_limits<double>::quiet_NaN(); test.b = std::numeric_limits<float>::quiet_NaN(); - (CALL_GENERATED_CODE(isolate, f, &test, 0, 0, 0, 0)); + (f.Call(&test, 0, 0, 0, 0)); CHECK(std::isnan(test.a)); CHECK(std::isnan(test.b)); test.a = std::numeric_limits<double>::signaling_NaN(); test.b = std::numeric_limits<float>::signaling_NaN(); - (CALL_GENERATED_CODE(isolate, f, &test, 0, 0, 0, 0)); + (f.Call(&test, 0, 0, 0, 0)); CHECK(std::isnan(test.a)); CHECK(std::isnan(test.b)); } @@ -3738,12 +3716,12 @@ TEST(ADD_FMT) { assm.GetCode(isolate, &desc); Handle<Code> code = isolate->factory()->NewCode(desc, Code::STUB, Handle<Code>()); - F3 f = FUNCTION_CAST<F3>(code->entry()); + auto f = GeneratedCode<F3>::FromCode(*code); test.a = 2.0; test.b = 3.0; test.fa = 2.0; test.fb = 3.0; - (CALL_GENERATED_CODE(isolate, f, &test, 0, 0, 0, 0)); + (f.Call(&test, 0, 0, 0, 0)); CHECK_EQ(test.c, 5.0); CHECK_EQ(test.fc, 5.0); @@ -3751,7 +3729,7 @@ TEST(ADD_FMT) { test.b = -std::numeric_limits<double>::max(); // lowest() test.fa = std::numeric_limits<float>::max(); test.fb = -std::numeric_limits<float>::max(); // lowest() - (CALL_GENERATED_CODE(isolate, f, &test, 0, 0, 0, 0)); + (f.Call(&test, 0, 0, 0, 0)); CHECK_EQ(test.c, 0.0); CHECK_EQ(test.fc, 0.0); @@ -3759,7 +3737,7 @@ TEST(ADD_FMT) { test.b = std::numeric_limits<double>::max(); test.fa = std::numeric_limits<float>::max(); test.fb = std::numeric_limits<float>::max(); - (CALL_GENERATED_CODE(isolate, f, &test, 0, 0, 0, 0)); + (f.Call(&test, 0, 0, 0, 0)); CHECK(!std::isfinite(test.c)); CHECK(!std::isfinite(test.fc)); @@ -3767,7 +3745,7 @@ TEST(ADD_FMT) { test.b = std::numeric_limits<double>::signaling_NaN(); test.fa = 5.0; test.fb = std::numeric_limits<float>::signaling_NaN(); - (CALL_GENERATED_CODE(isolate, f, &test, 0, 0, 0, 0)); + (f.Call(&test, 0, 0, 0, 0)); CHECK(std::isnan(test.c)); CHECK(std::isnan(test.fc)); } @@ -3893,12 +3871,12 @@ TEST(C_COND_FMT) { assm.GetCode(isolate, &desc); Handle<Code> code = isolate->factory()->NewCode(desc, Code::STUB, Handle<Code>()); - F3 f = FUNCTION_CAST<F3>(code->entry()); + auto f = GeneratedCode<F3>::FromCode(*code); test.dOp1 = 2.0; test.dOp2 = 3.0; test.fOp1 = 2.0; test.fOp2 = 3.0; - (CALL_GENERATED_CODE(isolate, f, &test, 0, 0, 0, 0)); + (f.Call(&test, 0, 0, 0, 0)); CHECK_EQ(test.dF, 0U); CHECK_EQ(test.dUn, 0U); CHECK_EQ(test.dEq, 0U); @@ -3920,7 +3898,7 @@ TEST(C_COND_FMT) { test.dOp2 = std::numeric_limits<double>::min(); test.fOp1 = std::numeric_limits<float>::min(); test.fOp2 = -std::numeric_limits<float>::max(); // lowest() - (CALL_GENERATED_CODE(isolate, f, &test, 0, 0, 0, 0)); + (f.Call(&test, 0, 0, 0, 0)); CHECK_EQ(test.dF, 0U); CHECK_EQ(test.dUn, 0U); CHECK_EQ(test.dEq, 0U); @@ -3942,7 +3920,7 @@ TEST(C_COND_FMT) { test.dOp2 = -std::numeric_limits<double>::max(); // lowest() test.fOp1 = std::numeric_limits<float>::max(); test.fOp2 = std::numeric_limits<float>::max(); - (CALL_GENERATED_CODE(isolate, f, &test, 0, 0, 0, 0)); + (f.Call(&test, 0, 0, 0, 0)); CHECK_EQ(test.dF, 0U); CHECK_EQ(test.dUn, 0U); CHECK_EQ(test.dEq, 1U); @@ -3964,7 +3942,7 @@ TEST(C_COND_FMT) { test.dOp2 = 0.0; test.fOp1 = std::numeric_limits<float>::quiet_NaN(); test.fOp2 = 0.0; - (CALL_GENERATED_CODE(isolate, f, &test, 0, 0, 0, 0)); + (f.Call(&test, 0, 0, 0, 0)); CHECK_EQ(test.dF, 0U); CHECK_EQ(test.dUn, 1U); CHECK_EQ(test.dEq, 0U); @@ -4094,7 +4072,7 @@ TEST(CMP_COND_FMT) { assm.GetCode(isolate, &desc); Handle<Code> code = isolate->factory()->NewCode(desc, Code::STUB, Handle<Code>()); - F3 f = FUNCTION_CAST<F3>(code->entry()); + auto f = GeneratedCode<F3>::FromCode(*code); uint64_t dTrue = 0xFFFFFFFFFFFFFFFF; uint64_t dFalse = 0x0000000000000000; uint32_t fTrue = 0xFFFFFFFF; @@ -4104,7 +4082,7 @@ TEST(CMP_COND_FMT) { test.dOp2 = 3.0; test.fOp1 = 2.0; test.fOp2 = 3.0; - (CALL_GENERATED_CODE(isolate, f, &test, 0, 0, 0, 0)); + (f.Call(&test, 0, 0, 0, 0)); CHECK_EQ(bit_cast<uint64_t>(test.dF), dFalse); CHECK_EQ(bit_cast<uint64_t>(test.dUn), dFalse); CHECK_EQ(bit_cast<uint64_t>(test.dEq), dFalse); @@ -4129,7 +4107,7 @@ TEST(CMP_COND_FMT) { test.dOp2 = std::numeric_limits<double>::min(); test.fOp1 = std::numeric_limits<float>::min(); test.fOp2 = -std::numeric_limits<float>::max(); // lowest() - (CALL_GENERATED_CODE(isolate, f, &test, 0, 0, 0, 0)); + (f.Call(&test, 0, 0, 0, 0)); CHECK_EQ(bit_cast<uint64_t>(test.dF), dFalse); CHECK_EQ(bit_cast<uint64_t>(test.dUn), dFalse); CHECK_EQ(bit_cast<uint64_t>(test.dEq), dFalse); @@ -4154,7 +4132,7 @@ TEST(CMP_COND_FMT) { test.dOp2 = -std::numeric_limits<double>::max(); // lowest() test.fOp1 = std::numeric_limits<float>::max(); test.fOp2 = std::numeric_limits<float>::max(); - (CALL_GENERATED_CODE(isolate, f, &test, 0, 0, 0, 0)); + (f.Call(&test, 0, 0, 0, 0)); CHECK_EQ(bit_cast<uint64_t>(test.dF), dFalse); CHECK_EQ(bit_cast<uint64_t>(test.dUn), dFalse); CHECK_EQ(bit_cast<uint64_t>(test.dEq), dTrue); @@ -4179,7 +4157,7 @@ TEST(CMP_COND_FMT) { test.dOp2 = 0.0; test.fOp1 = std::numeric_limits<float>::quiet_NaN(); test.fOp2 = 0.0; - (CALL_GENERATED_CODE(isolate, f, &test, 0, 0, 0, 0)); + (f.Call(&test, 0, 0, 0, 0)); CHECK_EQ(bit_cast<uint64_t>(test.dF), dFalse); CHECK_EQ(bit_cast<uint64_t>(test.dUn), dTrue); CHECK_EQ(bit_cast<uint64_t>(test.dEq), dFalse); @@ -4281,7 +4259,7 @@ TEST(CVT) { assm.GetCode(isolate, &desc); Handle<Code> code = isolate->factory()->NewCode(desc, Code::STUB, Handle<Code>()); - F3 f = FUNCTION_CAST<F3>(code->entry()); + auto f = GeneratedCode<F3>::FromCode(*code); test.cvt_d_s_in = -0.51; test.cvt_d_w_in = -1; @@ -4294,7 +4272,7 @@ TEST(CVT) { test.cvt_w_s_in = -0.51; test.cvt_w_d_in = -0.51; - (CALL_GENERATED_CODE(isolate, f, &test, 0, 0, 0, 0)); + (f.Call(&test, 0, 0, 0, 0)); CHECK_EQ(test.cvt_d_s_out, static_cast<double>(test.cvt_d_s_in)); CHECK_EQ(test.cvt_d_w_out, static_cast<double>(test.cvt_d_w_in)); if ((IsMipsArchVariant(kMips32r2) || IsMipsArchVariant(kMips32r6)) && @@ -4325,7 +4303,7 @@ TEST(CVT) { test.cvt_w_s_in = 0.49; test.cvt_w_d_in = 0.49; - (CALL_GENERATED_CODE(isolate, f, &test, 0, 0, 0, 0)); + (f.Call(&test, 0, 0, 0, 0)); CHECK_EQ(test.cvt_d_s_out, static_cast<double>(test.cvt_d_s_in)); CHECK_EQ(test.cvt_d_w_out, static_cast<double>(test.cvt_d_w_in)); if ((IsMipsArchVariant(kMips32r2) || IsMipsArchVariant(kMips32r6)) && @@ -4356,7 +4334,7 @@ TEST(CVT) { test.cvt_w_s_in = std::numeric_limits<float>::max(); test.cvt_w_d_in = std::numeric_limits<double>::max(); - (CALL_GENERATED_CODE(isolate, f, &test, 0, 0, 0, 0)); + (f.Call(&test, 0, 0, 0, 0)); CHECK_EQ(test.cvt_d_s_out, static_cast<double>(test.cvt_d_s_in)); CHECK_EQ(test.cvt_d_w_out, static_cast<double>(test.cvt_d_w_in)); if ((IsMipsArchVariant(kMips32r2) || IsMipsArchVariant(kMips32r6)) && @@ -4388,7 +4366,7 @@ TEST(CVT) { test.cvt_w_s_in = -std::numeric_limits<float>::max(); // lowest() test.cvt_w_d_in = -std::numeric_limits<double>::max(); // lowest() - (CALL_GENERATED_CODE(isolate, f, &test, 0, 0, 0, 0)); + (f.Call(&test, 0, 0, 0, 0)); CHECK_EQ(test.cvt_d_s_out, static_cast<double>(test.cvt_d_s_in)); CHECK_EQ(test.cvt_d_w_out, static_cast<double>(test.cvt_d_w_in)); if ((IsMipsArchVariant(kMips32r2) || IsMipsArchVariant(kMips32r6)) && @@ -4427,7 +4405,7 @@ TEST(CVT) { test.cvt_w_s_in = std::numeric_limits<float>::min(); test.cvt_w_d_in = std::numeric_limits<double>::min(); - (CALL_GENERATED_CODE(isolate, f, &test, 0, 0, 0, 0)); + (f.Call(&test, 0, 0, 0, 0)); CHECK_EQ(test.cvt_d_s_out, static_cast<double>(test.cvt_d_s_in)); CHECK_EQ(test.cvt_d_w_out, static_cast<double>(test.cvt_d_w_in)); if ((IsMipsArchVariant(kMips32r2) || IsMipsArchVariant(kMips32r6)) && @@ -4495,9 +4473,9 @@ TEST(DIV_FMT) { Handle<Code> code = isolate->factory()->NewCode(desc, Code::STUB, Handle<Code>()); - F3 f = FUNCTION_CAST<F3>(code->entry()); + auto f = GeneratedCode<F3>::FromCode(*code); - (CALL_GENERATED_CODE(isolate, f, &test, 0, 0, 0, 0)); + (f.Call(&test, 0, 0, 0, 0)); const int test_size = 3; @@ -4538,7 +4516,7 @@ TEST(DIV_FMT) { test.fOp1 = fOp1[i]; test.fOp2 = fOp2[i]; - (CALL_GENERATED_CODE(isolate, f, &test, 0, 0, 0, 0)); + (f.Call(&test, 0, 0, 0, 0)); CHECK_EQ(test.dRes, dRes[i]); CHECK_EQ(test.fRes, fRes[i]); } @@ -4548,7 +4526,7 @@ TEST(DIV_FMT) { test.fOp1 = FLT_MAX; test.fOp2 = -0.0; - (CALL_GENERATED_CODE(isolate, f, &test, 0, 0, 0, 0)); + (f.Call(&test, 0, 0, 0, 0)); CHECK(!std::isfinite(test.dRes)); CHECK(!std::isfinite(test.fRes)); @@ -4557,7 +4535,7 @@ TEST(DIV_FMT) { test.fOp1 = 0.0; test.fOp2 = -0.0; - (CALL_GENERATED_CODE(isolate, f, &test, 0, 0, 0, 0)); + (f.Call(&test, 0, 0, 0, 0)); CHECK(std::isnan(test.dRes)); CHECK(std::isnan(test.fRes)); @@ -4566,7 +4544,7 @@ TEST(DIV_FMT) { test.fOp1 = std::numeric_limits<float>::quiet_NaN(); test.fOp2 = -5.0; - (CALL_GENERATED_CODE(isolate, f, &test, 0, 0, 0, 0)); + (f.Call(&test, 0, 0, 0, 0)); CHECK(std::isnan(test.dRes)); CHECK(std::isnan(test.fRes)); } @@ -4588,10 +4566,10 @@ uint32_t run_align(uint32_t rs_value, uint32_t rt_value, uint8_t bp) { Handle<Code> code = isolate->factory()->NewCode(desc, Code::STUB, Handle<Code>()); - F2 f = FUNCTION_CAST<F2>(code->entry()); + auto f = GeneratedCode<F2>::FromCode(*code); - uint32_t res = reinterpret_cast<uint32_t>(CALL_GENERATED_CODE( - isolate, f, rs_value, rt_value, 0, 0, 0)); + uint32_t res = + reinterpret_cast<uint32_t>(f.Call(rs_value, rt_value, 0, 0, 0)); return res; } @@ -4608,13 +4586,15 @@ TEST(r6_align) { uint32_t expected_res; }; + // clang-format off struct TestCaseAlign tc[] = { - // rs_value, rt_value, bp, expected_res - { 0x11223344, 0xaabbccdd, 0, 0xaabbccdd }, - { 0x11223344, 0xaabbccdd, 1, 0xbbccdd11 }, - { 0x11223344, 0xaabbccdd, 2, 0xccdd1122 }, - { 0x11223344, 0xaabbccdd, 3, 0xdd112233 }, + // rs_value, rt_value, bp, expected_res + {0x11223344, 0xAABBCCDD, 0, 0xAABBCCDD}, + {0x11223344, 0xAABBCCDD, 1, 0xBBCCDD11}, + {0x11223344, 0xAABBCCDD, 2, 0xCCDD1122}, + {0x11223344, 0xAABBCCDD, 3, 0xDD112233}, }; + // clang-format on size_t nr_test_cases = sizeof(tc) / sizeof(TestCaseAlign); for (size_t i = 0; i < nr_test_cases; ++i) { @@ -4642,11 +4622,10 @@ uint32_t run_aluipc(int16_t offset) { Handle<Code> code = isolate->factory()->NewCode(desc, Code::STUB, Handle<Code>()); - F2 f = FUNCTION_CAST<F2>(code->entry()); - PC = (uint32_t) f; // Set the program counter. + auto f = GeneratedCode<F2>::FromCode(*code); + PC = (uint32_t)code->entry(); // Set the program counter. - uint32_t res = reinterpret_cast<uint32_t>( - CALL_GENERATED_CODE(isolate, f, 0, 0, 0, 0, 0)); + uint32_t res = reinterpret_cast<uint32_t>(f.Call(0, 0, 0, 0, 0)); return res; } @@ -4697,11 +4676,10 @@ uint32_t run_auipc(int16_t offset) { Handle<Code> code = isolate->factory()->NewCode(desc, Code::STUB, Handle<Code>()); - F2 f = FUNCTION_CAST<F2>(code->entry()); - PC = (uint32_t) f; // Set the program counter. + auto f = GeneratedCode<F2>::FromCode(*code); + PC = (uint32_t)code->entry(); // Set the program counter. - uint32_t res = reinterpret_cast<uint32_t>( - CALL_GENERATED_CODE(isolate, f, 0, 0, 0, 0, 0)); + uint32_t res = reinterpret_cast<uint32_t>(f.Call(0, 0, 0, 0, 0)); return res; } @@ -4744,24 +4722,24 @@ uint32_t run_lwpc(int offset) { v8::internal::CodeObjectRequired::kYes); // 256k instructions; 2^8k - // addiu t7, t0, 0xffff; (0x250fffff) + // addiu t7, t0, 0xFFFF; (0x250FFFFF) // ... - // addiu t4, t0, 0x0000; (0x250c0000) + // addiu t4, t0, 0x0000; (0x250C0000) uint32_t addiu_start_1 = 0x25000000; - for (int32_t i = 0xfffff; i >= 0xc0000; --i) { + for (int32_t i = 0xFFFFF; i >= 0xC0000; --i) { uint32_t addiu_new = addiu_start_1 + i; __ dd(addiu_new); } - __ lwpc(t8, offset); // offset 0; 0xef080000 (t8 register) + __ lwpc(t8, offset); // offset 0; 0xEF080000 (t8 register) __ mov(v0, t8); // 256k instructions; 2^8k // addiu t0, t0, 0x0000; (0x25080000) // ... - // addiu t3, t0, 0xffff; (0x250bffff) + // addiu t3, t0, 0xFFFF; (0x250BFFFF) uint32_t addiu_start_2 = 0x25000000; - for (int32_t i = 0x80000; i <= 0xbffff; ++i) { + for (int32_t i = 0x80000; i <= 0xBFFFF; ++i) { uint32_t addiu_new = addiu_start_2 + i; __ dd(addiu_new); } @@ -4774,10 +4752,9 @@ uint32_t run_lwpc(int offset) { Handle<Code> code = isolate->factory()->NewCode(desc, Code::STUB, Handle<Code>()); - F2 f = FUNCTION_CAST<F2>(code->entry()); + auto f = GeneratedCode<F2>::FromCode(*code); - uint32_t res = reinterpret_cast<uint32_t>( - CALL_GENERATED_CODE(isolate, f, 0, 0, 0, 0, 0)); + uint32_t res = reinterpret_cast<uint32_t>(f.Call(0, 0, 0, 0, 0)); return res; } @@ -4792,17 +4769,19 @@ TEST(r6_lwpc) { uint32_t expected_res; }; + // clang-format off struct TestCaseLwpc tc[] = { // offset, expected_res - { -262144, 0x250fffff }, // offset 0x40000 - { -4, 0x250c0003 }, - { -1, 0x250c0000 }, - { 0, 0xef080000 }, + { -262144, 0x250FFFFF }, // offset 0x40000 + { -4, 0x250C0003 }, + { -1, 0x250C0000 }, + { 0, 0xEF080000 }, { 1, 0x03001025 }, // mov(v0, t8) { 2, 0x25080000 }, { 4, 0x25080002 }, - { 262143, 0x250bfffd }, // offset 0x3ffff + { 262143, 0x250BFFFD }, // offset 0x3FFFF }; + // clang-format on size_t nr_test_cases = sizeof(tc) / sizeof(TestCaseLwpc); for (size_t i = 0; i < nr_test_cases; ++i) { @@ -4859,10 +4838,9 @@ uint32_t run_jic(int16_t offset) { Handle<Code> code = isolate->factory()->NewCode(desc, Code::STUB, Handle<Code>()); - F2 f = FUNCTION_CAST<F2>(code->entry()); + auto f = GeneratedCode<F2>::FromCode(*code); - uint32_t res = reinterpret_cast<uint32_t>( - CALL_GENERATED_CODE(isolate, f, 0, 0, 0, 0, 0)); + uint32_t res = reinterpret_cast<uint32_t>(f.Call(0, 0, 0, 0, 0)); return res; } @@ -4932,10 +4910,9 @@ uint64_t run_beqzc(int32_t value, int32_t offset) { Handle<Code> code = isolate->factory()->NewCode(desc, Code::STUB, Handle<Code>()); - F2 f = FUNCTION_CAST<F2>(code->entry()); + auto f = GeneratedCode<F2>::FromCode(*code); - uint32_t res = reinterpret_cast<uint32_t>( - CALL_GENERATED_CODE(isolate, f, value, 0, 0, 0, 0)); + uint32_t res = reinterpret_cast<uint32_t>(f.Call(value, 0, 0, 0, 0)); return res; } @@ -4951,14 +4928,16 @@ TEST(r6_beqzc) { uint32_t expected_res; }; + // clang-format off struct TestCaseBeqzc tc[] = { // value, offset, expected_res { 0x0, -8, 0x66 }, { 0x0, 0, 0x3334 }, { 0x0, 1, 0x3333 }, - { 0xabc, 1, 0x3334 }, + { 0xABC, 1, 0x3334 }, { 0x0, 4, 0x2033 }, }; + // clang-format on size_t nr_test_cases = sizeof(tc) / sizeof(TestCaseBeqzc); for (size_t i = 0; i < nr_test_cases; ++i) { @@ -4970,12 +4949,12 @@ TEST(r6_beqzc) { void load_elements_of_vector(MacroAssembler& assm, const uint64_t elements[], MSARegister w, Register t0, Register t1) { - __ li(t0, static_cast<uint32_t>(elements[0] & 0xffffffff)); - __ li(t1, static_cast<uint32_t>((elements[0] >> 32) & 0xffffffff)); + __ li(t0, static_cast<uint32_t>(elements[0] & 0xFFFFFFFF)); + __ li(t1, static_cast<uint32_t>((elements[0] >> 32) & 0xFFFFFFFF)); __ insert_w(w, 0, t0); __ insert_w(w, 1, t1); - __ li(t0, static_cast<uint32_t>(elements[1] & 0xffffffff)); - __ li(t1, static_cast<uint32_t>((elements[1] >> 32) & 0xffffffff)); + __ li(t0, static_cast<uint32_t>(elements[1] & 0xFFFFFFFF)); + __ li(t1, static_cast<uint32_t>((elements[1] >> 32) & 0xFFFFFFFF)); __ insert_w(w, 2, t0); __ insert_w(w, 3, t1); } @@ -5012,7 +4991,7 @@ void run_bz_bnz(TestCaseMsaBranch* input, Branch GenerateBranch, uint64_t wd_lo; uint64_t wd_hi; } T; - T t = {0x20b9cc4f1a83e0c5, 0xa27e1b5f2f5bb18a, 0x0000000000000000, + T t = {0x20B9CC4F1A83E0C5, 0xA27E1B5F2F5BB18A, 0x0000000000000000, 0x0000000000000000}; msa_reg_t res; Label do_not_move_w0_to_w2; @@ -5036,9 +5015,9 @@ void run_bz_bnz(TestCaseMsaBranch* input, Branch GenerateBranch, #ifdef OBJECT_PRINT code->Print(std::cout); #endif - F3 f = FUNCTION_CAST<F3>(code->entry()); + auto f = GeneratedCode<F3>::FromCode(*code); - (CALL_GENERATED_CODE(isolate, f, &res, 0, 0, 0, 0)); + (f.Call(&res, 0, 0, 0, 0)); if (branched) { CHECK_EQ(t.wd_lo, res.d[0]); CHECK_EQ(t.wd_hi, res.d[1]); @@ -5053,7 +5032,7 @@ TEST(MSA_bz_bnz) { return; TestCaseMsaBranch tz_v[] = { - {0x0, 0x0}, {0xabc, 0x0}, {0x0, 0xabc}, {0xabc, 0xabc}}; + {0x0, 0x0}, {0xABC, 0x0}, {0x0, 0xABC}, {0xABC, 0xABC}}; for (unsigned i = 0; i < arraysize(tz_v); ++i) { run_bz_bnz( &tz_v[i], @@ -5077,32 +5056,32 @@ TEST(MSA_bz_bnz) { j != lanes); \ } TestCaseMsaBranch tz_b[] = {{0x0, 0x0}, - {0xbc0000, 0x0}, - {0x0, 0xab000000000000cd}, - {0x123456789abcdef0, 0xaaaaaaaaaaaaaaaa}}; + {0xBC0000, 0x0}, + {0x0, 0xAB000000000000CD}, + {0x123456789ABCDEF0, 0xAAAAAAAAAAAAAAAA}}; TEST_BZ_DF(tz_b, kMSALanesByte, bz_b, int8_t) TestCaseMsaBranch tz_h[] = {{0x0, 0x0}, - {0xbcde0000, 0x0}, - {0x0, 0xabcd00000000abcd}, - {0x123456789abcdef0, 0xaaaaaaaaaaaaaaaa}}; + {0xBCDE0000, 0x0}, + {0x0, 0xABCD00000000ABCD}, + {0x123456789ABCDEF0, 0xAAAAAAAAAAAAAAAA}}; TEST_BZ_DF(tz_h, kMSALanesHalf, bz_h, int16_t) TestCaseMsaBranch tz_w[] = {{0x0, 0x0}, - {0xbcde123400000000, 0x0}, - {0x0, 0x000000001234abcd}, - {0x123456789abcdef0, 0xaaaaaaaaaaaaaaaa}}; + {0xBCDE123400000000, 0x0}, + {0x0, 0x000000001234ABCD}, + {0x123456789ABCDEF0, 0xAAAAAAAAAAAAAAAA}}; TEST_BZ_DF(tz_w, kMSALanesWord, bz_w, int32_t) TestCaseMsaBranch tz_d[] = {{0x0, 0x0}, - {0xbcde0000, 0x0}, - {0x0, 0xabcd00000000abcd}, - {0x123456789abcdef0, 0xaaaaaaaaaaaaaaaa}}; + {0xBCDE0000, 0x0}, + {0x0, 0xABCD00000000ABCD}, + {0x123456789ABCDEF0, 0xAAAAAAAAAAAAAAAA}}; TEST_BZ_DF(tz_d, kMSALanesDword, bz_d, int64_t) #undef TEST_BZ_DF TestCaseMsaBranch tnz_v[] = { - {0x0, 0x0}, {0xabc, 0x0}, {0x0, 0xabc}, {0xabc, 0xabc}}; + {0x0, 0x0}, {0xABC, 0x0}, {0x0, 0xABC}, {0xABC, 0xABC}}; for (unsigned i = 0; i < arraysize(tnz_v); ++i) { run_bz_bnz(&tnz_v[i], [](MacroAssembler& assm, Label& br_target) { @@ -5127,27 +5106,27 @@ TEST(MSA_bz_bnz) { j == lanes); \ } TestCaseMsaBranch tnz_b[] = {{0x0, 0x0}, - {0xbc0000, 0x0}, - {0x0, 0xab000000000000cd}, - {0x123456789abcdef0, 0xaaaaaaaaaaaaaaaa}}; + {0xBC0000, 0x0}, + {0x0, 0xAB000000000000CD}, + {0x123456789ABCDEF0, 0xAAAAAAAAAAAAAAAA}}; TEST_BNZ_DF(tnz_b, 16, bnz_b, int8_t) TestCaseMsaBranch tnz_h[] = {{0x0, 0x0}, - {0xbcde0000, 0x0}, - {0x0, 0xabcd00000000abcd}, - {0x123456789abcdef0, 0xaaaaaaaaaaaaaaaa}}; + {0xBCDE0000, 0x0}, + {0x0, 0xABCD00000000ABCD}, + {0x123456789ABCDEF0, 0xAAAAAAAAAAAAAAAA}}; TEST_BNZ_DF(tnz_h, 8, bnz_h, int16_t) TestCaseMsaBranch tnz_w[] = {{0x0, 0x0}, - {0xbcde123400000000, 0x0}, - {0x0, 0x000000001234abcd}, - {0x123456789abcdef0, 0xaaaaaaaaaaaaaaaa}}; + {0xBCDE123400000000, 0x0}, + {0x0, 0x000000001234ABCD}, + {0x123456789ABCDEF0, 0xAAAAAAAAAAAAAAAA}}; TEST_BNZ_DF(tnz_w, 4, bnz_w, int32_t) TestCaseMsaBranch tnz_d[] = {{0x0, 0x0}, - {0xbcde0000, 0x0}, - {0x0, 0xabcd00000000abcd}, - {0x123456789abcdef0, 0xaaaaaaaaaaaaaaaa}}; + {0xBCDE0000, 0x0}, + {0x0, 0xABCD00000000ABCD}, + {0x123456789ABCDEF0, 0xAAAAAAAAAAAAAAAA}}; TEST_BNZ_DF(tnz_d, 2, bnz_d, int64_t) #undef TEST_BNZ_DF } @@ -5210,10 +5189,9 @@ uint32_t run_jialc(int16_t offset) { Handle<Code> code = isolate->factory()->NewCode(desc, Code::STUB, Handle<Code>()); - F2 f = FUNCTION_CAST<F2>(code->entry()); + auto f = GeneratedCode<F2>::FromCode(*code); - uint32_t res = reinterpret_cast<uint32_t>( - CALL_GENERATED_CODE(isolate, f, 0, 0, 0, 0, 0)); + uint32_t res = reinterpret_cast<uint32_t>(f.Call(0, 0, 0, 0, 0)); return res; } @@ -5260,11 +5238,10 @@ static uint32_t run_addiupc(int32_t imm19) { Handle<Code> code = isolate->factory()->NewCode(desc, Code::STUB, Handle<Code>()); - F2 f = FUNCTION_CAST<F2>(code->entry()); - PC = (uint32_t) f; // Set the program counter. + auto f = GeneratedCode<F2>::FromCode(*code); + PC = (uint32_t)code->entry(); // Set the program counter. - uint32_t rs = reinterpret_cast<uint32_t>( - CALL_GENERATED_CODE(isolate, f, imm19, 0, 0, 0, 0)); + uint32_t rs = reinterpret_cast<uint32_t>(f.Call(imm19, 0, 0, 0, 0)); return rs; } @@ -5344,10 +5321,9 @@ int32_t run_bc(int32_t offset) { Handle<Code> code = isolate->factory()->NewCode(desc, Code::STUB, Handle<Code>()); - F2 f = FUNCTION_CAST<F2>(code->entry()); + auto f = GeneratedCode<F2>::FromCode(*code); - int32_t res = reinterpret_cast<int32_t>( - CALL_GENERATED_CODE(isolate, f, 0, 0, 0, 0, 0)); + int32_t res = reinterpret_cast<int32_t>(f.Call(0, 0, 0, 0, 0)); return res; } @@ -5427,10 +5403,9 @@ int32_t run_balc(int32_t offset) { Handle<Code> code = isolate->factory()->NewCode(desc, Code::STUB, Handle<Code>()); - F2 f = FUNCTION_CAST<F2>(code->entry()); + auto f = GeneratedCode<F2>::FromCode(*code); - int32_t res = reinterpret_cast<int32_t>( - CALL_GENERATED_CODE(isolate, f, 0, 0, 0, 0, 0)); + int32_t res = reinterpret_cast<int32_t>(f.Call(0, 0, 0, 0, 0)); return res; } @@ -5453,11 +5428,9 @@ uint32_t run_aui(uint32_t rs, uint16_t offset) { Handle<Code> code = isolate->factory()->NewCode(desc, Code::STUB, Handle<Code>()); - F2 f = FUNCTION_CAST<F2>(code->entry()); + auto f = GeneratedCode<F2>::FromCode(*code); - uint32_t res = - reinterpret_cast<uint32_t> - (CALL_GENERATED_CODE(isolate, f, 0, 0, 0, 0, 0)); + uint32_t res = reinterpret_cast<uint32_t>(f.Call(0, 0, 0, 0, 0)); return res; } @@ -5474,15 +5447,15 @@ TEST(r6_aui) { }; struct TestCaseAui tc[] = { - // input, offset, result - {0xfffeffff, 1, 0xffffffff}, - {0xffffffff, 0, 0xffffffff}, - {0, 0xffff, 0xffff0000}, - {0x0008ffff, 0xfff7, 0xffffffff}, - {32767, 32767, 0x7fff7fff}, - // overflow cases - {0xffffffff, 0x1, 0x0000ffff}, - {0xffffffff, 0xffff, 0xfffeffff}, + // input, offset, result + {0xFFFEFFFF, 1, 0xFFFFFFFF}, + {0xFFFFFFFF, 0, 0xFFFFFFFF}, + {0, 0xFFFF, 0xFFFF0000}, + {0x0008FFFF, 0xFFF7, 0xFFFFFFFF}, + {32767, 32767, 0x7FFF7FFF}, + // overflow cases + {0xFFFFFFFF, 0x1, 0x0000FFFF}, + {0xFFFFFFFF, 0xFFFF, 0xFFFEFFFF}, }; size_t nr_test_cases = sizeof(tc) / sizeof(TestCaseAui); @@ -5545,10 +5518,9 @@ uint32_t run_bal(int16_t offset) { Handle<Code> code = isolate->factory()->NewCode(desc, Code::STUB, Handle<Code>()); - F2 f = FUNCTION_CAST<F2>(code->entry()); + auto f = GeneratedCode<F2>::FromCode(*code); - uint32_t res = reinterpret_cast<uint32_t>( - CALL_GENERATED_CODE(isolate, f, 0, 0, 0, 0, 0)); + uint32_t res = reinterpret_cast<uint32_t>(f.Call(0, 0, 0, 0, 0)); return res; } @@ -5598,10 +5570,9 @@ TEST(Trampoline) { assm.GetCode(isolate, &desc); Handle<Code> code = isolate->factory()->NewCode(desc, Code::STUB, Handle<Code>()); - F2 f = FUNCTION_CAST<F2>(code->entry()); + auto f = GeneratedCode<F2>::FromCode(*code); - int32_t res = reinterpret_cast<int32_t>( - CALL_GENERATED_CODE(isolate, f, 42, 42, 0, 0, 0)); + int32_t res = reinterpret_cast<int32_t>(f.Call(42, 42, 0, 0, 0)); CHECK_EQ(0, res); } @@ -5666,7 +5637,7 @@ void helper_madd_msub_maddf_msubf(F func) { assm.GetCode(isolate, &desc); Handle<Code> code = isolate->factory()->NewCode(desc, Code::STUB, Handle<Code>()); - F3 f = FUNCTION_CAST<F3>(code->entry()); + auto f = GeneratedCode<F3>::FromCode(*code); const size_t kTableLength = sizeof(test_cases) / sizeof(TestCaseMaddMsub<T>); TestCaseMaddMsub<T> tc; @@ -5675,7 +5646,7 @@ void helper_madd_msub_maddf_msubf(F func) { tc.fs = test_cases[i].fs; tc.ft = test_cases[i].ft; - (CALL_GENERATED_CODE(isolate, f, &tc, 0, 0, 0, 0)); + (f.Call(&tc, 0, 0, 0, 0)); T res_add = 0; T res_sub = 0; @@ -5753,10 +5724,9 @@ uint32_t run_Subu(uint32_t imm, int32_t num_instr) { assm.GetCode(isolate, &desc); Handle<Code> code = isolate->factory()->NewCode(desc, Code::STUB, Handle<Code>()); - F2 f = FUNCTION_CAST<F2>(code->entry()); + auto f = GeneratedCode<F2>::FromCode(*code); - uint32_t res = reinterpret_cast<uint32_t>( - CALL_GENERATED_CODE(isolate, f, 0, 0, 0, 0, 0)); + uint32_t res = reinterpret_cast<uint32_t>(f.Call(0, 0, 0, 0, 0)); return res; } @@ -5777,28 +5747,28 @@ TEST(Subu) { // 0 - imm = expected_res struct TestCaseSubu tc[] = { // imm, expected_res, num_instr - {0xffff8000, 0x8000, 2}, // min_int16 + {0xFFFF8000, 0x8000, 2}, // min_int16 // Generates ori + addu // We can't have just addiu because -min_int16 > max_int16 so use // register. We can load min_int16 to at register with addiu and then // subtract at with subu, but now we use ori + addu because -min_int16 can // be loaded using ori. - {0x8000, 0xffff8000, 1}, // max_int16 + 1 + {0x8000, 0xFFFF8000, 1}, // max_int16 + 1 // Generates addiu // max_int16 + 1 is not int16 but -(max_int16 + 1) is, just use addiu. - {0xffff7fff, 0x8001, 2}, // min_int16 - 1 + {0xFFFF7FFF, 0x8001, 2}, // min_int16 - 1 // Generates ori + addu // To load this value to at we need two instructions and another one to // subtract, lui + ori + subu. But we can load -value to at using just // ori and then add at register with addu. - {0x8001, 0xffff7fff, 2}, // max_int16 + 2 + {0x8001, 0xFFFF7FFF, 2}, // max_int16 + 2 // Generates ori + subu // Not int16 but is uint16, load value to at with ori and subtract with // subu. - {0x00010000, 0xffff0000, 2}, + {0x00010000, 0xFFFF0000, 2}, // Generates lui + subu // Load value using lui to at and subtract with subu. - {0x00010001, 0xfffeffff, 3}, + {0x00010001, 0xFFFEFFFF, 3}, // Generates lui + ori + subu // We have to generate three instructions in this case. }; @@ -5832,7 +5802,7 @@ TEST(MSA_fill_copy) { { CpuFeatureScope fscope(&assm, MIPS_SIMD); - __ li(t0, 0xa512b683); + __ li(t0, 0xA512B683); __ fill_b(w0, t0); __ fill_h(w2, t0); @@ -5862,17 +5832,16 @@ TEST(MSA_fill_copy) { #ifdef OBJECT_PRINT code->Print(std::cout); #endif - F3 f = FUNCTION_CAST<F3>(code->entry()); + auto f = GeneratedCode<F3>::FromCode(*code); - Object* dummy = CALL_GENERATED_CODE(isolate, f, &t, 0, 0, 0, 0); - USE(dummy); + f.Call(&t, 0, 0, 0, 0); CHECK_EQ(0x83u, t.u8); - CHECK_EQ(0xb683u, t.u16); - CHECK_EQ(0xa512b683u, t.u32); - CHECK_EQ(0xffffff83u, t.s8); - CHECK_EQ(0xffffb683u, t.s16); - CHECK_EQ(0xa512b683u, t.s32); + CHECK_EQ(0xB683u, t.u16); + CHECK_EQ(0xA512B683u, t.u32); + CHECK_EQ(0xFFFFFF83u, t.s8); + CHECK_EQ(0xFFFFB683u, t.s16); + CHECK_EQ(0xA512B683u, t.s32); } TEST(MSA_fill_copy_2) { @@ -5898,7 +5867,7 @@ TEST(MSA_fill_copy_2) { { CpuFeatureScope fscope(&assm, MIPS_SIMD); - __ li(t0, 0xaaaaaaaa); + __ li(t0, 0xAAAAAAAA); __ li(t1, 0x55555555); __ fill_w(w0, t0); @@ -5932,19 +5901,18 @@ TEST(MSA_fill_copy_2) { #ifdef OBJECT_PRINT code->Print(std::cout); #endif - F4 f = FUNCTION_CAST<F4>(code->entry()); + auto f = GeneratedCode<F4>::FromCode(*code); - Object* dummy = CALL_GENERATED_CODE(isolate, f, &t[0], &t[1], 0, 0, 0); - USE(dummy); + f.Call(&t[0], &t[1], 0, 0, 0); CHECK_EQ(0x55555555, t[0].w0); - CHECK_EQ(0xaaaaaaaa, t[0].w1); - CHECK_EQ(0xaaaaaaaa, t[0].w2); - CHECK_EQ(0xaaaaaaaa, t[0].w3); - CHECK_EQ(0xaaaaaaaa, t[1].w0); + CHECK_EQ(0xAAAAAAAA, t[0].w1); + CHECK_EQ(0xAAAAAAAA, t[0].w2); + CHECK_EQ(0xAAAAAAAA, t[0].w3); + CHECK_EQ(0xAAAAAAAA, t[1].w0); CHECK_EQ(0x55555555, t[1].w1); - CHECK_EQ(0xaaaaaaaa, t[1].w2); - CHECK_EQ(0xaaaaaaaa, t[1].w3); + CHECK_EQ(0xAAAAAAAA, t[1].w2); + CHECK_EQ(0xAAAAAAAA, t[1].w3); } TEST(MSA_fill_copy_3) { @@ -5968,7 +5936,7 @@ TEST(MSA_fill_copy_3) { { CpuFeatureScope fscope(&assm, MIPS_SIMD); - __ li(t0, 0xaaaaaaaa); + __ li(t0, 0xAAAAAAAA); __ li(t1, 0x55555555); __ Move(f0, t0, t0); @@ -5991,10 +5959,9 @@ TEST(MSA_fill_copy_3) { #ifdef OBJECT_PRINT code->Print(std::cout); #endif - F4 f = FUNCTION_CAST<F4>(code->entry()); + auto f = GeneratedCode<F4>::FromCode(*code); - Object* dummy = CALL_GENERATED_CODE(isolate, f, &t[0], &t[1], 0, 0, 0); - USE(dummy); + f.Call(&t[0], &t[1], 0, 0, 0); CHECK_EQ(0x5555555555555555, t[0].d0); CHECK_EQ(0x5555555555555555, t[1].d0); @@ -6038,9 +6005,9 @@ void run_msa_insert(int32_t rs_value, int n, msa_reg_t* w) { #ifdef OBJECT_PRINT code->Print(std::cout); #endif - F3 f = FUNCTION_CAST<F3>(code->entry()); + auto f = GeneratedCode<F3>::FromCode(*code); - (CALL_GENERATED_CODE(isolate, f, w, 0, 0, 0, 0)); + (f.Call(w, 0, 0, 0, 0)); } TEST(MSA_insert) { @@ -6058,10 +6025,10 @@ TEST(MSA_insert) { struct TestCaseInsert tc_b[] = { // input, n, exp_res_lo, exp_res_hi - {0xa2, 13, 0xffffffffffffffffu, 0xffffa2ffffffffffu}, - {0x73, 10, 0xffffffffffffffffu, 0xffffffffff73ffffu}, - {0x3494, 5, 0xffff94ffffffffffu, 0xffffffffffffffffu}, - {0xa6b8, 1, 0xffffffffffffb8ffu, 0xffffffffffffffffu}}; + {0xA2, 13, 0xFFFFFFFFFFFFFFFFu, 0xFFFFA2FFFFFFFFFFu}, + {0x73, 10, 0xFFFFFFFFFFFFFFFFu, 0xFFFFFFFFFF73FFFFu}, + {0x3494, 5, 0xFFFF94FFFFFFFFFFu, 0xFFFFFFFFFFFFFFFFu}, + {0xA6B8, 1, 0xFFFFFFFFFFFFB8FFu, 0xFFFFFFFFFFFFFFFFu}}; for (size_t i = 0; i < sizeof(tc_b) / sizeof(TestCaseInsert); ++i) { msa_reg_t res; @@ -6072,10 +6039,10 @@ TEST(MSA_insert) { struct TestCaseInsert tc_h[] = { // input, n, exp_res_lo, exp_res_hi - {0x85a2, 7, 0xffffffffffffffffu, 0x85a2ffffffffffffu}, - {0xe873, 5, 0xffffffffffffffffu, 0xffffffffe873ffffu}, - {0x3494, 3, 0x3494ffffffffffffu, 0xffffffffffffffffu}, - {0xa6b8, 1, 0xffffffffa6b8ffffu, 0xffffffffffffffffu}}; + {0x85A2, 7, 0xFFFFFFFFFFFFFFFFu, 0x85A2FFFFFFFFFFFFu}, + {0xE873, 5, 0xFFFFFFFFFFFFFFFFu, 0xFFFFFFFFE873FFFFu}, + {0x3494, 3, 0x3494FFFFFFFFFFFFu, 0xFFFFFFFFFFFFFFFFu}, + {0xA6B8, 1, 0xFFFFFFFFA6B8FFFFu, 0xFFFFFFFFFFFFFFFFu}}; for (size_t i = 0; i < sizeof(tc_h) / sizeof(TestCaseInsert); ++i) { msa_reg_t res; @@ -6086,10 +6053,10 @@ TEST(MSA_insert) { struct TestCaseInsert tc_w[] = { // input, n, exp_res_lo, exp_res_hi - {0xd2f085a2u, 3, 0xffffffffffffffffu, 0xd2f085a2ffffffffu}, - {0x4567e873u, 2, 0xffffffffffffffffu, 0xffffffff4567e873u}, - {0xacdb3494u, 1, 0xacdb3494ffffffffu, 0xffffffffffffffffu}, - {0x89aba6b8u, 0, 0xffffffff89aba6b8u, 0xffffffffffffffffu}}; + {0xD2F085A2u, 3, 0xFFFFFFFFFFFFFFFFu, 0xD2F085A2FFFFFFFFu}, + {0x4567E873u, 2, 0xFFFFFFFFFFFFFFFFu, 0xFFFFFFFF4567E873u}, + {0xACDB3494u, 1, 0xACDB3494FFFFFFFFu, 0xFFFFFFFFFFFFFFFFu}, + {0x89ABA6B8u, 0, 0xFFFFFFFF89ABA6B8u, 0xFFFFFFFFFFFFFFFFu}}; for (size_t i = 0; i < sizeof(tc_w) / sizeof(TestCaseInsert); ++i) { msa_reg_t res; @@ -6112,12 +6079,12 @@ TEST(MSA_move_v) { uint64_t wd_lo; uint64_t wd_hi; } T; - T t[] = {{0x20b9cc4f1a83e0c5, 0xa27e1b5f2f5bb18a, 0x1e86678b52f8e1ff, - 0x706e51290ac76fb9}, - {0x4414aed7883ffd18, 0x047d183a06b67016, 0x4ef258cf8d822870, - 0x2686b73484c2e843}, - {0xd38ff9d048884ffc, 0x6dc63a57c0943ca7, 0x8520ca2f3e97c426, - 0xa9913868fb819c59}}; + T t[] = {{0x20B9CC4F1A83E0C5, 0xA27E1B5F2F5BB18A, 0x1E86678B52F8E1FF, + 0x706E51290AC76FB9}, + {0x4414AED7883FFD18, 0x047D183A06B67016, 0x4EF258CF8D822870, + 0x2686B73484C2E843}, + {0xD38FF9D048884FFC, 0x6DC63A57C0943CA7, 0x8520CA2F3E97C426, + 0xA9913868FB819C59}}; for (unsigned i = 0; i < arraysize(t); ++i) { MacroAssembler assm(isolate, nullptr, 0, @@ -6139,8 +6106,8 @@ TEST(MSA_move_v) { #ifdef OBJECT_PRINT code->Print(std::cout); #endif - F3 f = FUNCTION_CAST<F3>(code->entry()); - (CALL_GENERATED_CODE(isolate, f, &t[i].wd_lo, 0, 0, 0, 0)); + auto f = GeneratedCode<F3>::FromCode(*code); + (f.Call(&t[i].wd_lo, 0, 0, 0, 0)); CHECK_EQ(t[i].ws_lo, t[i].wd_lo); CHECK_EQ(t[i].ws_hi, t[i].wd_hi); } @@ -6158,12 +6125,12 @@ void run_msa_sldi(OperFunc GenerateOperation, uint64_t wd_lo; uint64_t wd_hi; } T; - T t[] = {{0x20b9cc4f1a83e0c5, 0xa27e1b5f2f5bb18a, 0x1e86678b52f8e1ff, - 0x706e51290ac76fb9}, - {0x4414aed7883ffd18, 0x047d183a06b67016, 0x4ef258cf8d822870, - 0x2686b73484c2e843}, - {0xd38ff9d048884ffc, 0x6dc63a57c0943ca7, 0x8520ca2f3e97c426, - 0xa9913868fb819c59}}; + T t[] = {{0x20B9CC4F1A83E0C5, 0xA27E1B5F2F5BB18A, 0x1E86678B52F8E1FF, + 0x706E51290AC76FB9}, + {0x4414AED7883FFD18, 0x047D183A06B67016, 0x4EF258CF8D822870, + 0x2686B73484C2E843}, + {0xD38FF9D048884FFC, 0x6DC63A57C0943CA7, 0x8520CA2F3E97C426, + 0xA9913868FB819C59}}; uint64_t res[2]; for (unsigned i = 0; i < arraysize(t); ++i) { @@ -6185,8 +6152,8 @@ void run_msa_sldi(OperFunc GenerateOperation, #ifdef OBJECT_PRINT code->Print(std::cout); #endif - F3 f = FUNCTION_CAST<F3>(code->entry()); - (CALL_GENERATED_CODE(isolate, f, &res[0], 0, 0, 0, 0)); + auto f = GeneratedCode<F3>::FromCode(*code); + (f.Call(&res[0], 0, 0, 0, 0)); GenerateExpectedResult(reinterpret_cast<uint8_t*>(&t[i].ws_lo), reinterpret_cast<uint8_t*>(&t[i].wd_lo)); CHECK_EQ(res[0], t[i].wd_lo); @@ -6271,12 +6238,12 @@ void run_msa_ctc_cfc(uint32_t value) { #ifdef OBJECT_PRINT code->Print(std::cout); #endif - F3 f = FUNCTION_CAST<F3>(code->entry()); + auto f = GeneratedCode<F3>::FromCode(*code); uint32_t res; - (CALL_GENERATED_CODE(isolate, f, &res, 0, 0, 0, 0)); + (f.Call(&res, 0, 0, 0, 0)); - CHECK_EQ(value & 0x0167ffff, res); + CHECK_EQ(value & 0x0167FFFF, res); } TEST(MSA_cfc_ctc) { @@ -6285,12 +6252,12 @@ TEST(MSA_cfc_ctc) { CcTest::InitializeVM(); - const uint32_t mask_without_cause = 0xff9c0fff; - const uint32_t mask_always_zero = 0x0167ffff; - const uint32_t mask_enables = 0x00000f80; - uint32_t test_case[] = {0x2d5ede31, 0x07955425, 0x15b7dbe3, 0x2bf8bc37, - 0xe6aae923, 0x24d0f68d, 0x41afa84c, 0x2d6bf64f, - 0x925014bd, 0x4dba7e61}; + const uint32_t mask_without_cause = 0xFF9C0FFF; + const uint32_t mask_always_zero = 0x0167FFFF; + const uint32_t mask_enables = 0x00000F80; + uint32_t test_case[] = {0x2D5EDE31, 0x07955425, 0x15B7DBE3, 0x2BF8BC37, + 0xE6AAE923, 0x24D0F68D, 0x41AFA84C, 0x2D6BF64F, + 0x925014BD, 0x4DBA7E61}; for (unsigned i = 0; i < arraysize(test_case); i++) { // Setting enable bits and corresponding cause bits could result in // exception raised and this prevents that from happening @@ -6315,16 +6282,16 @@ void run_msa_i8(SecondaryField opcode, uint64_t ws_lo, uint64_t ws_hi, v8::internal::CodeObjectRequired::kYes); CpuFeatureScope fscope(&assm, MIPS_SIMD); msa_reg_t res; - uint64_t wd_lo = 0xf35862e13e38f8b0; - uint64_t wd_hi = 0x4f41ffdef2bfe636; + uint64_t wd_lo = 0xF35862E13E38F8B0; + uint64_t wd_hi = 0x4F41FFDEF2BFE636; #define LOAD_W_REG(lo, hi, w_reg) \ - __ li(t0, static_cast<uint32_t>(lo & 0xffffffff)); \ - __ li(t1, static_cast<uint32_t>((lo >> 32) & 0xffffffff)); \ + __ li(t0, static_cast<uint32_t>(lo & 0xFFFFFFFF)); \ + __ li(t1, static_cast<uint32_t>((lo >> 32) & 0xFFFFFFFF)); \ __ insert_w(w_reg, 0, t0); \ __ insert_w(w_reg, 1, t1); \ - __ li(t0, static_cast<uint32_t>(hi & 0xffffffff)); \ - __ li(t1, static_cast<uint32_t>((hi >> 32) & 0xffffffff)); \ + __ li(t0, static_cast<uint32_t>(hi & 0xFFFFFFFF)); \ + __ li(t1, static_cast<uint32_t>((hi >> 32) & 0xFFFFFFFF)); \ __ insert_w(w_reg, 2, t0); \ __ insert_w(w_reg, 3, t1); @@ -6382,9 +6349,9 @@ void run_msa_i8(SecondaryField opcode, uint64_t ws_lo, uint64_t ws_hi, #ifdef OBJECT_PRINT code->Print(std::cout); #endif - F3 f = FUNCTION_CAST<F3>(code->entry()); + auto f = GeneratedCode<F3>::FromCode(*code); - (CALL_GENERATED_CODE(isolate, f, &res, 0, 0, 0, 0)); + (f.Call(&res, 0, 0, 0, 0)); uint64_t mask = i8 * 0x0101010101010101ull; switch (opcode) { @@ -6419,13 +6386,13 @@ void run_msa_i8(SecondaryField opcode, uint64_t ws_lo, uint64_t ws_hi, case SHF_B: { struct ExpResShf exp_b[] = { // i8, exp_lo, exp_hi - {0xffu, 0x11111111b9b9b9b9, 0xf7f7f7f7c8c8c8c8}, - {0x0u, 0x62626262dfdfdfdf, 0xd6d6d6d6c8c8c8c8}, - {0xe4u, 0xf35862e13e38f8b0, 0x4f41ffdef2bfe636}, - {0x1bu, 0x1b756911c3d9a7b9, 0xae94a5f79c8aefc8}, - {0xb1u, 0x662b6253e8c4df12, 0x0d3ad6803f8bc88b}, - {0x4eu, 0x62e1f358f8b03e38, 0xffde4f41e636f2bf}, - {0x27u, 0x1b697511c3a7d9b9, 0xaea594f79cef8ac8}}; + {0xFFu, 0x11111111B9B9B9B9, 0xF7F7F7F7C8C8C8C8}, + {0x0u, 0x62626262DFDFDFDF, 0xD6D6D6D6C8C8C8C8}, + {0xE4u, 0xF35862E13E38F8B0, 0x4F41FFDEF2BFE636}, + {0x1Bu, 0x1B756911C3D9A7B9, 0xAE94A5F79C8AEFC8}, + {0xB1u, 0x662B6253E8C4DF12, 0x0D3AD6803F8BC88B}, + {0x4Eu, 0x62E1F358F8B03E38, 0xFFDE4F41E636F2BF}, + {0x27u, 0x1B697511C3A7D9B9, 0xAEA594F79CEF8AC8}}; for (size_t i = 0; i < sizeof(exp_b) / sizeof(ExpResShf); ++i) { if (exp_b[i].i8 == i8) { CHECK_EQ(exp_b[i].lo, res.d[0]); @@ -6436,13 +6403,13 @@ void run_msa_i8(SecondaryField opcode, uint64_t ws_lo, uint64_t ws_hi, case SHF_H: { struct ExpResShf exp_h[] = { // i8, exp_lo, exp_hi - {0xffu, 0x1169116911691169, 0xf7a5f7a5f7a5f7a5}, - {0x0u, 0x12df12df12df12df, 0x8bc88bc88bc88bc8}, - {0xe4u, 0xf35862e13e38f8b0, 0x4f41ffdef2bfe636}, - {0x1bu, 0xd9c3b9a7751b1169, 0x8a9cc8ef94aef7a5}, - {0xb1u, 0x53622b6612dfc4e8, 0x80d63a0d8bc88b3f}, - {0x4eu, 0x3e38f8b0f35862e1, 0xf2bfe6364f41ffde}, - {0x27u, 0xd9c3751bb9a71169, 0x8a9c94aec8eff7a5}}; + {0xFFu, 0x1169116911691169, 0xF7A5F7A5F7A5F7A5}, + {0x0u, 0x12DF12DF12DF12DF, 0x8BC88BC88BC88BC8}, + {0xE4u, 0xF35862E13E38F8B0, 0x4F41FFDEF2BFE636}, + {0x1Bu, 0xD9C3B9A7751B1169, 0x8A9CC8EF94AEF7A5}, + {0xB1u, 0x53622B6612DFC4E8, 0x80D63A0D8BC88B3F}, + {0x4Eu, 0x3E38F8B0F35862E1, 0xF2BFE6364F41FFDE}, + {0x27u, 0xD9C3751BB9A71169, 0x8A9C94AEC8EFF7A5}}; for (size_t i = 0; i < sizeof(exp_h) / sizeof(ExpResShf); ++i) { if (exp_h[i].i8 == i8) { CHECK_EQ(exp_h[i].lo, res.d[0]); @@ -6453,13 +6420,13 @@ void run_msa_i8(SecondaryField opcode, uint64_t ws_lo, uint64_t ws_hi, case SHF_W: { struct ExpResShf exp_w[] = { // i8, exp_lo, exp_hi - {0xffu, 0xf7a594aef7a594ae, 0xf7a594aef7a594ae}, - {0x0u, 0xc4e812dfc4e812df, 0xc4e812dfc4e812df}, - {0xe4u, 0xf35862e13e38f8b0, 0x4f41ffdef2bfe636}, - {0x1bu, 0xc8ef8a9cf7a594ae, 0xb9a7d9c31169751b}, - {0xb1u, 0xc4e812df2b665362, 0x8b3f8bc83a0d80d6}, - {0x4eu, 0x4f41ffdef2bfe636, 0xf35862e13e38f8b0}, - {0x27u, 0x1169751bf7a594ae, 0xb9a7d9c3c8ef8a9c}}; + {0xFFu, 0xF7A594AEF7A594AE, 0xF7A594AEF7A594AE}, + {0x0u, 0xC4E812DFC4E812DF, 0xC4E812DFC4E812DF}, + {0xE4u, 0xF35862E13E38F8B0, 0x4F41FFDEF2BFE636}, + {0x1Bu, 0xC8EF8A9CF7A594AE, 0xB9A7D9C31169751B}, + {0xB1u, 0xC4E812DF2B665362, 0x8B3F8BC83A0D80D6}, + {0x4Eu, 0x4F41FFDEF2BFE636, 0xF35862E13E38F8B0}, + {0x27u, 0x1169751BF7A594AE, 0xB9A7D9C3C8EF8A9C}}; for (size_t i = 0; i < sizeof(exp_w) / sizeof(ExpResShf); ++i) { if (exp_w[i].i8 == i8) { CHECK_EQ(exp_w[i].lo, res.d[0]); @@ -6485,10 +6452,10 @@ TEST(MSA_andi_ori_nori_xori) { CcTest::InitializeVM(); struct TestCaseMsaI8 tc[] = {// input_lo, input_hi, i8 - {0x1169751bb9a7d9c3, 0xf7a594aec8ef8a9c, 0xffu}, - {0x2b665362c4e812df, 0x3a0d80d68b3f8bc8, 0x0u}, - {0x1169751bb9a7d9c3, 0xf7a594aec8ef8a9c, 0x3bu}, - {0x2b665362c4e812df, 0x3a0d80d68b3f8bc8, 0xd9u}}; + {0x1169751BB9A7D9C3, 0xF7A594AEC8EF8A9C, 0xFFu}, + {0x2B665362C4E812DF, 0x3A0D80D68B3F8BC8, 0x0u}, + {0x1169751BB9A7D9C3, 0xF7A594AEC8EF8A9C, 0x3Bu}, + {0x2B665362C4E812DF, 0x3A0D80D68B3F8BC8, 0xD9u}}; for (size_t i = 0; i < sizeof(tc) / sizeof(TestCaseMsaI8); ++i) { run_msa_i8(ANDI_B, tc[i].input_lo, tc[i].input_hi, tc[i].i8); @@ -6505,10 +6472,10 @@ TEST(MSA_bmnzi_bmzi_bseli) { CcTest::InitializeVM(); struct TestCaseMsaI8 tc[] = {// input_lo, input_hi, i8 - {0x1169751bb9a7d9c3, 0xf7a594aec8ef8a9c, 0xffu}, - {0x2b665362c4e812df, 0x3a0d80d68b3f8bc8, 0x0u}, - {0x1169751bb9a7d9c3, 0xf7a594aec8ef8a9c, 0x3bu}, - {0x2b665362c4e812df, 0x3a0d80d68b3f8bc8, 0xd9u}}; + {0x1169751BB9A7D9C3, 0xF7A594AEC8EF8A9C, 0xFFu}, + {0x2B665362C4E812DF, 0x3A0D80D68B3F8BC8, 0x0u}, + {0x1169751BB9A7D9C3, 0xF7A594AEC8EF8A9C, 0x3Bu}, + {0x2B665362C4E812DF, 0x3A0D80D68B3F8BC8, 0xD9u}}; for (size_t i = 0; i < sizeof(tc) / sizeof(TestCaseMsaI8); ++i) { run_msa_i8(BMNZI_B, tc[i].input_lo, tc[i].input_hi, tc[i].i8); @@ -6525,13 +6492,13 @@ TEST(MSA_shf) { struct TestCaseMsaI8 tc[] = { // input_lo, input_hi, i8 - {0x1169751bb9a7d9c3, 0xf7a594aec8ef8a9c, 0xffu}, // 3333 - {0x2b665362c4e812df, 0x3a0d80d68b3f8bc8, 0x0u}, // 0000 - {0xf35862e13e38f8b0, 0x4f41ffdef2bfe636, 0xe4u}, // 3210 - {0x1169751bb9a7d9c3, 0xf7a594aec8ef8a9c, 0x1bu}, // 0123 - {0x2b665362c4e812df, 0x3a0d80d68b3f8bc8, 0xb1u}, // 2301 - {0xf35862e13e38f8b0, 0x4f41ffdef2bfe636, 0x4eu}, // 1032 - {0x1169751bb9a7d9c3, 0xf7a594aec8ef8a9c, 0x27u} // 0213 + {0x1169751BB9A7D9C3, 0xF7A594AEC8EF8A9C, 0xFFu}, // 3333 + {0x2B665362C4E812DF, 0x3A0D80D68B3F8BC8, 0x0u}, // 0000 + {0xF35862E13E38F8B0, 0x4F41FFDEF2BFE636, 0xE4u}, // 3210 + {0x1169751BB9A7D9C3, 0xF7A594AEC8EF8A9C, 0x1Bu}, // 0123 + {0x2B665362C4E812DF, 0x3A0D80D68B3F8BC8, 0xB1u}, // 2301 + {0xF35862E13E38F8B0, 0x4F41FFDEF2BFE636, 0x4Eu}, // 1032 + {0x1169751BB9A7D9C3, 0xF7A594AEC8EF8A9C, 0x27u} // 0213 }; for (size_t i = 0; i < sizeof(tc) / sizeof(TestCaseMsaI8); ++i) { @@ -6558,10 +6525,9 @@ uint32_t run_Ins(uint32_t imm, uint32_t source, uint16_t pos, uint16_t size) { assm.GetCode(isolate, &desc); Handle<Code> code = isolate->factory()->NewCode(desc, Code::STUB, Handle<Code>()); - F2 f = FUNCTION_CAST<F2>(code->entry()); + auto f = GeneratedCode<F2>::FromCode(*code); - uint32_t res = reinterpret_cast<uint32_t>( - CALL_GENERATED_CODE(isolate, f, 0, 0, 0, 0, 0)); + uint32_t res = reinterpret_cast<uint32_t>(f.Call(0, 0, 0, 0, 0)); return res; } @@ -6570,9 +6536,9 @@ TEST(Ins) { CcTest::InitializeVM(); // run_Ins(rt_value, rs_value, pos, size), expected_result - CHECK_EQ(run_Ins(0x55555555, 0xabcdef01, 31, 1), 0xd5555555); - CHECK_EQ(run_Ins(0x55555555, 0xabcdef02, 30, 2), 0x95555555); - CHECK_EQ(run_Ins(0x01234567, 0xfabcdeff, 0, 32), 0xfabcdeff); + CHECK_EQ(run_Ins(0x55555555, 0xABCDEF01, 31, 1), 0xD5555555); + CHECK_EQ(run_Ins(0x55555555, 0xABCDEF02, 30, 2), 0x95555555); + CHECK_EQ(run_Ins(0x01234567, 0xFABCDEFF, 0, 32), 0xFABCDEFF); // Results with positive sign. CHECK_EQ(run_Ins(0x55555550, 0x80000001, 0, 1), 0x55555551); @@ -6590,7 +6556,7 @@ TEST(Ins) { CHECK_EQ(run_Ins(0x55555555, 0x80800001, 8, 24), 0x80000155); CHECK_EQ(run_Ins(0x55555555, 0x80008001, 16, 16), 0x80015555); CHECK_EQ(run_Ins(0x55555555, 0x80000081, 24, 8), 0x81555555); - CHECK_EQ(run_Ins(0x75555555, 0x00000001, 31, 1), 0xf5555555); + CHECK_EQ(run_Ins(0x75555555, 0x00000001, 31, 1), 0xF5555555); } uint32_t run_Ext(uint32_t source, uint16_t pos, uint16_t size) { @@ -6600,7 +6566,7 @@ uint32_t run_Ext(uint32_t source, uint16_t pos, uint16_t size) { MacroAssembler assm(isolate, nullptr, 0, v8::internal::CodeObjectRequired::kYes); - __ li(v0, 0xffffffff); + __ li(v0, 0xFFFFFFFF); __ li(t0, source); __ Ext(v0, t0, pos, size); __ jr(ra); @@ -6610,10 +6576,9 @@ uint32_t run_Ext(uint32_t source, uint16_t pos, uint16_t size) { assm.GetCode(isolate, &desc); Handle<Code> code = isolate->factory()->NewCode(desc, Code::STUB, Handle<Code>()); - F2 f = FUNCTION_CAST<F2>(code->entry()); + auto f = GeneratedCode<F2>::FromCode(*code); - uint32_t res = reinterpret_cast<uint32_t>( - CALL_GENERATED_CODE(isolate, f, 0, 0, 0, 0, 0)); + uint32_t res = reinterpret_cast<uint32_t>(f.Call(0, 0, 0, 0, 0)); return res; } @@ -6677,9 +6642,9 @@ void run_msa_i5(struct TestCaseMsaI5* input, bool i5_sign_ext, #ifdef OBJECT_PRINT code->Print(std::cout); #endif - F3 f = FUNCTION_CAST<F3>(code->entry()); + auto f = GeneratedCode<F3>::FromCode(*code); - (CALL_GENERATED_CODE(isolate, f, &res, 0, 0, 0, 0)); + (f.Call(&res, 0, 0, 0, 0)); CHECK_EQ(GenerateOperationFunc(input->ws_lo, input->i5), res.d[0]); CHECK_EQ(GenerateOperationFunc(input->ws_hi, input->i5), res.d[1]); @@ -6693,12 +6658,12 @@ TEST(MSA_addvi_subvi) { struct TestCaseMsaI5 tc[] = { // ws_lo, ws_hi, i5 - {0x1169751bb9a7d9c3, 0xf7a594aec8ef8a9c, 0x0000001f}, - {0x2b665362c4e812df, 0x3a0d80d68b3f8bc8, 0x0000000f}, - {0x1169751bb9a7d9c3, 0xf7a594aec8ef8a9c, 0x00000005}, - {0x2b665362c4e812df, 0x3a0d80d68b3f8bc8, 0x00000010}, - {0xffab807f807fffcd, 0x7f23ff80ff567f80, 0x0000000f}, - {0x80ffefff7f12807f, 0x807f80ff7fdeff78, 0x00000010}}; + {0x1169751BB9A7D9C3, 0xF7A594AEC8EF8A9C, 0x0000001F}, + {0x2B665362C4E812DF, 0x3A0D80D68B3F8BC8, 0x0000000F}, + {0x1169751BB9A7D9C3, 0xF7A594AEC8EF8A9C, 0x00000005}, + {0x2B665362C4E812DF, 0x3A0D80D68B3F8BC8, 0x00000010}, + {0xFFAB807F807FFFCD, 0x7F23FF80FF567F80, 0x0000000F}, + {0x80FFEFFF7F12807F, 0x807F80FF7FDEFF78, 0x00000010}}; #define ADDVI_DF(lanes, mask) \ uint64_t res = 0; \ @@ -6769,21 +6734,21 @@ TEST(MSA_maxi_mini) { struct TestCaseMsaI5 tc[] = { // ws_lo, ws_hi, i5 - {0x7f80ff3480ff7f00, 0x8d7fff80ff7f6780, 0x0000001f}, - {0x7f80ff3480ff7f00, 0x8d7fff80ff7f6780, 0x0000000f}, - {0x7f80ff3480ff7f00, 0x8d7fff80ff7f6780, 0x00000010}, - {0x80007fff91daffff, 0x7fff8000ffff5678, 0x0000001f}, - {0x80007fff91daffff, 0x7fff8000ffff5678, 0x0000000f}, - {0x80007fff91daffff, 0x7fff8000ffff5678, 0x00000010}, - {0x7fffffff80000000, 0x12345678ffffffff, 0x0000001f}, - {0x7fffffff80000000, 0x12345678ffffffff, 0x0000000f}, - {0x7fffffff80000000, 0x12345678ffffffff, 0x00000010}, - {0x1169751bb9a7d9c3, 0xf7a594aec8ef8a9c, 0x0000001f}, - {0x2b665362c4e812df, 0x3a0d80d68b3f8bc8, 0x0000000f}, - {0xf35862e13e38f8b0, 0x4f41ffdef2bfe636, 0x00000010}, - {0x1169751bb9a7d9c3, 0xf7a594aec8ef8a9c, 0x00000015}, - {0x2b665362c4e812df, 0x3a0d80d68b3f8bc8, 0x00000009}, - {0xf35862e13e38f8b0, 0x4f41ffdef2bfe636, 0x00000003}}; + {0x7F80FF3480FF7F00, 0x8D7FFF80FF7F6780, 0x0000001F}, + {0x7F80FF3480FF7F00, 0x8D7FFF80FF7F6780, 0x0000000F}, + {0x7F80FF3480FF7F00, 0x8D7FFF80FF7F6780, 0x00000010}, + {0x80007FFF91DAFFFF, 0x7FFF8000FFFF5678, 0x0000001F}, + {0x80007FFF91DAFFFF, 0x7FFF8000FFFF5678, 0x0000000F}, + {0x80007FFF91DAFFFF, 0x7FFF8000FFFF5678, 0x00000010}, + {0x7FFFFFFF80000000, 0x12345678FFFFFFFF, 0x0000001F}, + {0x7FFFFFFF80000000, 0x12345678FFFFFFFF, 0x0000000F}, + {0x7FFFFFFF80000000, 0x12345678FFFFFFFF, 0x00000010}, + {0x1169751BB9A7D9C3, 0xF7A594AEC8EF8A9C, 0x0000001F}, + {0x2B665362C4E812DF, 0x3A0D80D68B3F8BC8, 0x0000000F}, + {0xF35862E13E38F8B0, 0x4F41FFDEF2BFE636, 0x00000010}, + {0x1169751BB9A7D9C3, 0xF7A594AEC8EF8A9C, 0x00000015}, + {0x2B665362C4E812DF, 0x3A0D80D68B3F8BC8, 0x00000009}, + {0xF35862E13E38F8B0, 0x4F41FFDEF2BFE636, 0x00000003}}; #define MAXI_MINI_S_DF(lanes, mask, func) \ [](uint64_t ws, uint32_t ui5) { \ @@ -6904,18 +6869,18 @@ TEST(MSA_ceqi_clti_clei) { CcTest::InitializeVM(); struct TestCaseMsaI5 tc[] = { - {0xff69751bb9a7d9c3, 0xf7a594aec8ff8a9c, 0x0000001f}, - {0xe669ffffb9a7d9c3, 0xf7a594aeffff8a9c, 0x0000001f}, - {0xffffffffb9a7d9c3, 0xf7a594aeffffffff, 0x0000001f}, - {0x2b0b5362c4e812df, 0x3a0d80d68b3f0bc8, 0x0000000b}, - {0x2b66000bc4e812df, 0x3a0d000b8b3f8bc8, 0x0000000b}, - {0x0000000bc4e812df, 0x3a0d80d60000000b, 0x0000000b}, - {0xf38062e13e38f8b0, 0x8041ffdef2bfe636, 0x00000010}, - {0xf35880003e38f8b0, 0x4f41ffdef2bf8000, 0x00000010}, - {0xf35862e180000000, 0x80000000f2bfe636, 0x00000010}, - {0x1169751bb9a7d9c3, 0xf7a594aec8ef8a9c, 0x00000015}, - {0x2b665362c4e812df, 0x3a0d80d68b3f8bc8, 0x00000009}, - {0xf30062e13e38f800, 0x4f00ffdef2bf0036, 0x00000000}}; + {0xFF69751BB9A7D9C3, 0xF7A594AEC8FF8A9C, 0x0000001F}, + {0xE669FFFFB9A7D9C3, 0xF7A594AEFFFF8A9C, 0x0000001F}, + {0xFFFFFFFFB9A7D9C3, 0xF7A594AEFFFFFFFF, 0x0000001F}, + {0x2B0B5362C4E812DF, 0x3A0D80D68B3F0BC8, 0x0000000B}, + {0x2B66000BC4E812DF, 0x3A0D000B8B3F8BC8, 0x0000000B}, + {0x0000000BC4E812DF, 0x3A0D80D60000000B, 0x0000000B}, + {0xF38062E13E38F8B0, 0x8041FFDEF2BFE636, 0x00000010}, + {0xF35880003E38F8B0, 0x4F41FFDEF2BF8000, 0x00000010}, + {0xF35862E180000000, 0x80000000F2BFE636, 0x00000010}, + {0x1169751BB9A7D9C3, 0xF7A594AEC8EF8A9C, 0x00000015}, + {0x2B665362C4E812DF, 0x3A0D80D68B3F8BC8, 0x00000009}, + {0xF30062E13E38F800, 0x4F00FFDEF2BF0036, 0x00000000}}; #define CEQI_CLTI_CLEI_S_DF(lanes, mask, func) \ [](uint64_t ws, uint32_t ui5) { \ @@ -7098,9 +7063,9 @@ void run_msa_2r(const struct TestCaseMsa2R* input, #ifdef OBJECT_PRINT code->Print(std::cout); #endif - F3 f = FUNCTION_CAST<F3>(code->entry()); + auto f = GeneratedCode<F3>::FromCode(*code); - (CALL_GENERATED_CODE(isolate, f, &res, 0, 0, 0, 0)); + (f.Call(&res, 0, 0, 0, 0)); CHECK_EQ(input->exp_res_lo, res.d[0]); CHECK_EQ(input->exp_res_hi, res.d[1]); @@ -7114,44 +7079,44 @@ TEST(MSA_pcnt) { struct TestCaseMsa2R tc_b[] = {// ws_lo, ws_hi, exp_res_lo, exp_res_hi {0x0000000000000000, 0x0000000000000000, 0, 0}, - {0xffffffffffffffff, 0xffffffffffffffff, + {0xFFFFFFFFFFFFFFFF, 0xFFFFFFFFFFFFFFFF, 0x0808080808080808, 0x0808080808080808}, - {0x1169751bb9a7d9c3, 0xf7a594aec8ef8a9c, + {0x1169751BB9A7D9C3, 0xF7A594AEC8EF8A9C, 0x0204050405050504, 0x0704030503070304}, - {0x2b665362c4e812df, 0x3a0d80d68b3f8bc8, + {0x2B665362C4E812DF, 0x3A0D80D68B3F8BC8, 0x0404040303040207, 0x0403010504060403}, - {0xf35862e13e38f8b0, 0x4f41ffdef2bfe636, + {0xF35862E13E38F8B0, 0x4F41FFDEF2BFE636, 0x0603030405030503, 0x0502080605070504}}; struct TestCaseMsa2R tc_h[] = {// ws_lo, ws_hi, exp_res_lo, exp_res_hi {0x0000000000000000, 0x0000000000000000, 0, 0}, - {0xffffffffffffffff, 0xffffffffffffffff, + {0xFFFFFFFFFFFFFFFF, 0xFFFFFFFFFFFFFFFF, 0x0010001000100010, 0x0010001000100010}, - {0x1169751bb9a7d9c3, 0xf7a594aec8ef8a9c, - 0x00060009000a0009, 0x000b0008000a0007}, - {0x2b665362c4e812df, 0x3a0d80d68b3f8bc8, - 0x0008000700070009, 0x00070006000a0007}, - {0xf35862e13e38f8b0, 0x4f41ffdef2bfe636, - 0x0009000700080008, 0x0007000e000c0009}}; + {0x1169751BB9A7D9C3, 0xF7A594AEC8EF8A9C, + 0x00060009000A0009, 0x000B0008000A0007}, + {0x2B665362C4E812DF, 0x3A0D80D68B3F8BC8, + 0x0008000700070009, 0x00070006000A0007}, + {0xF35862E13E38F8B0, 0x4F41FFDEF2BFE636, + 0x0009000700080008, 0x0007000E000C0009}}; struct TestCaseMsa2R tc_w[] = {// ws_lo, ws_hi, exp_res_lo, exp_res_hi {0x0000000000000000, 0x0000000000000000, 0, 0}, - {0xffffffffffffffff, 0xffffffffffffffff, + {0xFFFFFFFFFFFFFFFF, 0xFFFFFFFFFFFFFFFF, 0x0000002000000020, 0x0000002000000020}, - {0x1169751bb9a7d9c3, 0xf7a594aec8ef8a9c, - 0x0000000f00000013, 0x0000001300000011}, - {0x2b665362c4e812df, 0x3a0d80d68b3f8bc8, - 0x0000000f00000010, 0x0000000d00000011}, - {0xf35862e13e38f8b0, 0x4f41ffdef2bfe636, + {0x1169751BB9A7D9C3, 0xF7A594AEC8EF8A9C, + 0x0000000F00000013, 0x0000001300000011}, + {0x2B665362C4E812DF, 0x3A0D80D68B3F8BC8, + 0x0000000F00000010, 0x0000000D00000011}, + {0xF35862E13E38F8B0, 0x4F41FFDEF2BFE636, 0x0000001000000010, 0x0000001500000015}}; struct TestCaseMsa2R tc_d[] = { // ws_lo, ws_hi, exp_res_lo, exp_res_hi {0x0000000000000000, 0x0000000000000000, 0, 0}, - {0xffffffffffffffff, 0xffffffffffffffff, 0x40, 0x40}, - {0x1169751bb9a7d9c3, 0xf7a594aec8ef8a9c, 0x22, 0x24}, - {0x2b665362c4e812df, 0x3a0d80d68b3f8bc8, 0x1f, 0x1e}, - {0xf35862e13e38f8b0, 0x4f41ffdef2bfe636, 0x20, 0x2a}}; + {0xFFFFFFFFFFFFFFFF, 0xFFFFFFFFFFFFFFFF, 0x40, 0x40}, + {0x1169751BB9A7D9C3, 0xF7A594AEC8EF8A9C, 0x22, 0x24}, + {0x2B665362C4E812DF, 0x3A0D80D68B3F8BC8, 0x1F, 0x1E}, + {0xF35862E13E38F8B0, 0x4F41FFDEF2BFE636, 0x20, 0x2A}}; for (size_t i = 0; i < sizeof(tc_b) / sizeof(TestCaseMsa2R); ++i) { run_msa_2r(&tc_b[i], [](MacroAssembler& assm) { __ pcnt_b(w2, w0); }); @@ -7170,43 +7135,43 @@ TEST(MSA_nlzc) { struct TestCaseMsa2R tc_b[] = {// ws_lo, ws_hi, exp_res_lo, exp_res_hi {0x0000000000000000, 0x0000000000000000, 0x0808080808080808, 0x0808080808080808}, - {0xffffffffffffffff, 0xffffffffffffffff, 0, 0}, - {0x1169350b07030100, 0x7f011402381f0a6c, + {0xFFFFFFFFFFFFFFFF, 0xFFFFFFFFFFFFFFFF, 0, 0}, + {0x1169350B07030100, 0x7F011402381F0A6C, 0x0301020405060708, 0x0107030602030401}, - {0x010806003478121f, 0x03013016073f7b08, + {0x010806003478121F, 0x03013016073F7B08, 0x0704050802010303, 0x0607020305020104}, - {0x0168321100083803, 0x07113f03013f1676, + {0x0168321100083803, 0x07113F03013F1676, 0x0701020308040206, 0x0503020607020301}}; struct TestCaseMsa2R tc_h[] = {// ws_lo, ws_hi, exp_res_lo, exp_res_hi {0x0000000000000000, 0x0000000000000000, 0x0010001000100010, 0x0010001000100010}, - {0xffffffffffffffff, 0xffffffffffffffff, 0, 0}, - {0x00010007000a003c, 0x37a5001e00010002, - 0x000f000d000c000a, 0x0002000b000f000e}, - {0x0026066200780edf, 0x003d0003000f00c8, - 0x000a000500090004, 0x000a000e000c0008}, - {0x335807e100480030, 0x01410fde12bf5636, - 0x000200050009000a, 0x0007000400030001}}; + {0xFFFFFFFFFFFFFFFF, 0xFFFFFFFFFFFFFFFF, 0, 0}, + {0x00010007000A003C, 0x37A5001E00010002, + 0x000F000D000C000A, 0x0002000B000F000E}, + {0x0026066200780EDF, 0x003D0003000F00C8, + 0x000A000500090004, 0x000A000E000C0008}, + {0x335807E100480030, 0x01410FDE12BF5636, + 0x000200050009000A, 0x0007000400030001}}; struct TestCaseMsa2R tc_w[] = {// ws_lo, ws_hi, exp_res_lo, exp_res_hi {0x0000000000000000, 0x0000000000000000, 0x0000002000000020, 0x0000002000000020}, - {0xffffffffffffffff, 0xffffffffffffffff, 0, 0}, - {0x00000005000007c3, 0x000014ae00006a9c, - 0x0000001d00000015, 0x0000001300000011}, - {0x00009362000112df, 0x000380d6003f8bc8, - 0x000000100000000f, 0x0000000e0000000a}, - {0x135862e17e38f8b0, 0x0061ffde03bfe636, + {0xFFFFFFFFFFFFFFFF, 0xFFFFFFFFFFFFFFFF, 0, 0}, + {0x00000005000007C3, 0x000014AE00006A9C, + 0x0000001D00000015, 0x0000001300000011}, + {0x00009362000112DF, 0x000380D6003F8BC8, + 0x000000100000000F, 0x0000000E0000000A}, + {0x135862E17E38F8B0, 0x0061FFDE03BFE636, 0x0000000300000001, 0x0000000900000006}}; struct TestCaseMsa2R tc_d[] = { // ws_lo, ws_hi, exp_res_lo, exp_res_hi {0x0000000000000000, 0x0000000000000000, 0x40, 0x40}, - {0xffffffffffffffff, 0xffffffffffffffff, 0, 0}, - {0x000000000000014e, 0x00000000000176da, 0x37, 0x2f}, - {0x00000062c4e812df, 0x000065d68b3f8bc8, 0x19, 0x11}, - {0x00000000e338f8b0, 0x0754534acab32654, 0x20, 0x5}}; + {0xFFFFFFFFFFFFFFFF, 0xFFFFFFFFFFFFFFFF, 0, 0}, + {0x000000000000014E, 0x00000000000176DA, 0x37, 0x2F}, + {0x00000062C4E812DF, 0x000065D68B3F8BC8, 0x19, 0x11}, + {0x00000000E338F8B0, 0x0754534ACAB32654, 0x20, 0x5}}; for (size_t i = 0; i < sizeof(tc_b) / sizeof(TestCaseMsa2R); ++i) { run_msa_2r(&tc_b[i], [](MacroAssembler& assm) { __ nlzc_b(w2, w0); }); @@ -7223,7 +7188,7 @@ TEST(MSA_nloc) { CcTest::InitializeVM(); struct TestCaseMsa2R tc_b[] = {// ws_lo, ws_hi, exp_res_lo, exp_res_hi - {0xffffffffffffffff, 0xffffffffffffffff, + {0xFFFFFFFFFFFFFFFF, 0xFFFFFFFFFFFFFFFF, 0x0808080808080808, 0x0808080808080808}, {0x0000000000000000, 0x0000000000000000, 0, 0}, {0xEE96CAF4F8FCFEFF, 0x80FEEBFDC7E0F593, @@ -7234,32 +7199,32 @@ TEST(MSA_nloc) { 0x0701020308040206, 0x0503020607020301}}; struct TestCaseMsa2R tc_h[] = {// ws_lo, ws_hi, exp_res_lo, exp_res_hi - {0xffffffffffffffff, 0xffffffffffffffff, + {0xFFFFFFFFFFFFFFFF, 0xFFFFFFFFFFFFFFFF, 0x0010001000100010, 0x0010001000100010}, {0x0000000000000000, 0x0000000000000000, 0, 0}, {0xFFFEFFF8FFF5FFC3, 0xC85AFFE1FFFEFFFD, - 0x000f000d000c000a, 0x0002000b000f000e}, + 0x000F000D000C000A, 0x0002000B000F000E}, {0xFFD9F99DFF87F120, 0xFFC2FFFCFFF0FF37, - 0x000a000500090004, 0x000a000e000c0008}, + 0x000A000500090004, 0x000A000E000C0008}, {0xCCA7F81EFFB7FFCF, 0xFEBEF021ED40A9C9, - 0x000200050009000a, 0x0007000400030001}}; + 0x000200050009000A, 0x0007000400030001}}; struct TestCaseMsa2R tc_w[] = {// ws_lo, ws_hi, exp_res_lo, exp_res_hi - {0xffffffffffffffff, 0xffffffffffffffff, + {0xFFFFFFFFFFFFFFFF, 0xFFFFFFFFFFFFFFFF, 0x0000002000000020, 0x0000002000000020}, {0x0000000000000000, 0x0000000000000000, 0, 0}, {0xFFFFFFFAFFFFF83C, 0xFFFFEB51FFFF9563, - 0x0000001d00000015, 0x0000001300000011}, + 0x0000001D00000015, 0x0000001300000011}, {0xFFFF6C9DFFFEED20, 0xFFFC7F29FFC07437, - 0x000000100000000f, 0x0000000e0000000a}, + 0x000000100000000F, 0x0000000E0000000A}, {0xECA79D1E81C7074F, 0xFF9E0021FC4019C9, 0x0000000300000001, 0x0000000900000006}}; struct TestCaseMsa2R tc_d[] = { // ws_lo, ws_hi, exp_res_lo, exp_res_hi - {0xffffffffffffffff, 0xffffffffffffffff, 0x40, 0x40}, + {0xFFFFFFFFFFFFFFFF, 0xFFFFFFFFFFFFFFFF, 0x40, 0x40}, {0x0000000000000000, 0x0000000000000000, 0, 0}, - {0xFFFFFFFFFFFFFEB1, 0xFFFFFFFFFFFE8925, 0x37, 0x2f}, + {0xFFFFFFFFFFFFFEB1, 0xFFFFFFFFFFFE8925, 0x37, 0x2F}, {0xFFFFFF9D3B17ED20, 0xFFFF9A2974C07437, 0x19, 0x11}, {0xFFFFFFFF1CC7074F, 0xF8ABACB5354CD9AB, 0x20, 0x5}}; @@ -7997,11 +7962,11 @@ TEST(MSA_fexupl) { const double inf_double = std::numeric_limits<double>::infinity(); struct TestCaseMsa2RF_U16_F tc_s[] = { - {1, 2, 0x7c00, 0x0c00, 0, 0x7c00, 0xfc00, 0x8000, 0.f, inf_float, + {1, 2, 0x7C00, 0x0C00, 0, 0x7C00, 0xFC00, 0x8000, 0.f, inf_float, -inf_float, -0.f}, - {0xfc00, 0xffff, 0x00ff, 0x8000, 0x81fe, 0x8000, 0x0345, 0xaaaa, + {0xFC00, 0xFFFF, 0x00FF, 0x8000, 0x81FE, 0x8000, 0x0345, 0xAAAA, -3.0398368835e-5f, -0.f, 4.9889088e-5f, -5.2062988281e-2f}, - {3, 4, 0x5555, 6, 0x2aaa, 0x8700, 0x7777, 0x6a8b, 5.2062988281e-2f, + {3, 4, 0x5555, 6, 0x2AAA, 0x8700, 0x7777, 0x6A8B, 5.2062988281e-2f, -1.06811523458e-4f, 3.0576e4f, 3.35e3f}}; struct TestCaseMsa2RF_F_D tc_d[] = { @@ -8030,11 +7995,11 @@ TEST(MSA_fexupr) { const double inf_double = std::numeric_limits<double>::infinity(); struct TestCaseMsa2RF_U16_F tc_s[] = { - {0, 0x7c00, 0xfc00, 0x8000, 1, 2, 0x7c00, 0x0c00, 0.f, inf_float, + {0, 0x7C00, 0xFC00, 0x8000, 1, 2, 0x7C00, 0x0C00, 0.f, inf_float, -inf_float, -0.f}, - {0x81fe, 0x8000, 0x0345, 0xaaaa, 0xfc00, 0xffff, 0x00ff, 0x8000, + {0x81FE, 0x8000, 0x0345, 0xAAAA, 0xFC00, 0xFFFF, 0x00FF, 0x8000, -3.0398368835e-5f, -0.f, 4.9889088e-5f, -5.2062988281e-2f}, - {0x2aaa, 0x8700, 0x7777, 0x6a8b, 3, 4, 0x5555, 6, 5.2062988281e-2f, + {0x2AAA, 0x8700, 0x7777, 0x6A8B, 3, 4, 0x5555, 6, 5.2062988281e-2f, -1.06811523458e-4f, 3.0576e4f, 3.35e3f}}; struct TestCaseMsa2RF_F_D tc_d[] = { @@ -8068,13 +8033,13 @@ TEST(MSA_ffql) { CcTest::InitializeVM(); - struct TestCaseMsa2RF_U16_F tc_s[] = {{0, 3, 0xffff, 0x8000, 0x8000, 0xe000, + struct TestCaseMsa2RF_U16_F tc_s[] = {{0, 3, 0xFFFF, 0x8000, 0x8000, 0xE000, 0x0FF0, 0, -1.f, -0.25f, 0.12451171875f, 0.f}}; struct TestCaseMsa2RF_U32_D tc_d[] = { - {0, 45, 0x80000000, 0xe0000000, -1., -0.25}, - {0x28379, 0xaaaa5555, 0x024903d3, 0, 17.853239085525274277e-3, 0.}}; + {0, 45, 0x80000000, 0xE0000000, -1., -0.25}, + {0x28379, 0xAAAA5555, 0x024903D3, 0, 17.853239085525274277e-3, 0.}}; for (size_t i = 0; i < sizeof(tc_s) / sizeof(TestCaseMsa2RF_U16_F); ++i) { run_msa_2r(reinterpret_cast<const TestCaseMsa2R*>(&tc_s[i]), @@ -8092,13 +8057,13 @@ TEST(MSA_ffqr) { CcTest::InitializeVM(); - struct TestCaseMsa2RF_U16_F tc_s[] = {{0x8000, 0xe000, 0x0FF0, 0, 0, 3, - 0xffff, 0x8000, -1.f, -0.25f, + struct TestCaseMsa2RF_U16_F tc_s[] = {{0x8000, 0xE000, 0x0FF0, 0, 0, 3, + 0xFFFF, 0x8000, -1.f, -0.25f, 0.12451171875f, 0.f}}; struct TestCaseMsa2RF_U32_D tc_d[] = { - {0x80000000, 0xe0000000, 0, 45, -1., -0.25}, - {0x024903d3, 0, 0x28379, 0xaaaa5555, 17.853239085525274277e-3, 0.}}; + {0x80000000, 0xE0000000, 0, 45, -1., -0.25}, + {0x024903D3, 0, 0x28379, 0xAAAA5555, 17.853239085525274277e-3, 0.}}; for (size_t i = 0; i < sizeof(tc_s) / sizeof(TestCaseMsa2RF_U16_F); ++i) { run_msa_2r(reinterpret_cast<const TestCaseMsa2R*>(&tc_s[i]), @@ -8149,9 +8114,9 @@ void run_msa_vector(struct TestCaseMsaVector* input, #ifdef OBJECT_PRINT code->Print(std::cout); #endif - F3 f = FUNCTION_CAST<F3>(code->entry()); + auto f = GeneratedCode<F3>::FromCode(*code); - (CALL_GENERATED_CODE(isolate, f, &res, 0, 0, 0, 0)); + (f.Call(&res, 0, 0, 0, 0)); CHECK_EQ(GenerateOperationFunc(input->wd_lo, input->ws_lo, input->wt_lo), res.d[0]); @@ -8167,12 +8132,12 @@ TEST(MSA_vector) { struct TestCaseMsaVector tc[] = { // wd_lo, wd_hi, ws_lo, ws_hi, wt_lo, wt_hi - {0xf35862e13e38f8b0, 0x4f41ffdef2bfe636, 0xdcd39d91f9057627, - 0x64be4f6dbe9caa51, 0x6b23de1a687d9cb9, 0x49547aad691da4ca}, - {0xf35862e13e38f8b0, 0x4f41ffdef2bfe636, 0x401614523d830549, - 0xd7c46d613f50eddd, 0x52284cbc60a1562b, 0x1756ed510d8849cd}, - {0xf35862e13e38f8b0, 0x4f41ffdef2bfe636, 0xd6e2d2ebcb40d72f, - 0x13a619afce67b079, 0x36cce284343e40f9, 0xb4e8f44fd148bf7f}}; + {0xF35862E13E38F8B0, 0x4F41FFDEF2BFE636, 0xDCD39D91F9057627, + 0x64BE4F6DBE9CAA51, 0x6B23DE1A687D9CB9, 0x49547AAD691DA4CA}, + {0xF35862E13E38F8B0, 0x4F41FFDEF2BFE636, 0x401614523D830549, + 0xD7C46D613F50EDDD, 0x52284CBC60A1562B, 0x1756ED510D8849CD}, + {0xF35862E13E38F8B0, 0x4F41FFDEF2BFE636, 0xD6E2D2EBCB40D72F, + 0x13A619AFCE67B079, 0x36CCE284343E40F9, 0xB4E8F44FD148BF7F}}; for (size_t i = 0; i < sizeof(tc) / sizeof(TestCaseMsaVector); ++i) { run_msa_vector( @@ -8238,9 +8203,9 @@ void run_msa_bit(struct TestCaseMsaBit* input, InstFunc GenerateInstructionFunc, #ifdef OBJECT_PRINT code->Print(std::cout); #endif - F3 f = FUNCTION_CAST<F3>(code->entry()); + auto f = GeneratedCode<F3>::FromCode(*code); - (CALL_GENERATED_CODE(isolate, f, &res, 0, 0, 0, 0)); + (f.Call(&res, 0, 0, 0, 0)); CHECK_EQ(GenerateOperationFunc(input->wd_lo, input->ws_lo, input->m), res.d[0]); @@ -8256,14 +8221,14 @@ TEST(MSA_slli_srai_srli) { struct TestCaseMsaBit tc[] = { // wd_lo, wd_hi ws_lo, ws_hi, m - {0, 0, 0xf35862e13e38f8b0, 0x4f41ffdef2bfe636, 3}, - {0, 0, 0x64be4f6dbe9caa51, 0x6b23de1a687d9cb9, 5}, - {0, 0, 0x1169751bb9a7d9c3, 0xf7a594aec8ef8a9c, 9}, - {0, 0, 0x2b665362c4e812df, 0x3a0d80d68b3f8bc8, 13}, - {0, 0, 0x566be7ba4365b70a, 0x01ebbc1937d76cb4, 21}, - {0, 0, 0x380e2deb9d3f8aae, 0x017e0de0bcc6ca42, 30}, - {0, 0, 0xa46a3a9bcb43f4e5, 0x1c62c8473bdfcffb, 45}, - {0, 0, 0xf6759d85f23b5a2b, 0x5c042ae42c6d12c1, 61}}; + {0, 0, 0xF35862E13E38F8B0, 0x4F41FFDEF2BFE636, 3}, + {0, 0, 0x64BE4F6DBE9CAA51, 0x6B23DE1A687D9CB9, 5}, + {0, 0, 0x1169751BB9A7D9C3, 0xF7A594AEC8EF8A9C, 9}, + {0, 0, 0x2B665362C4E812DF, 0x3A0D80D68B3F8BC8, 13}, + {0, 0, 0x566BE7BA4365B70A, 0x01EBBC1937D76CB4, 21}, + {0, 0, 0x380E2DEB9D3F8AAE, 0x017E0DE0BCC6CA42, 30}, + {0, 0, 0xA46A3A9BCB43F4E5, 0x1C62C8473BDFCFFB, 45}, + {0, 0, 0xF6759D85F23B5A2B, 0x5C042AE42C6D12C1, 61}}; #define SLLI_SRLI_DF(lanes, mask, func) \ [](uint64_t wd, uint64_t ws, uint32_t m) { \ @@ -8409,14 +8374,14 @@ TEST(MSA_bclri_bseti_bnegi) { struct TestCaseMsaBit tc[] = { // wd_lo, wd_hi, ws_lo, ws_hi, m - {0, 0, 0xf35862e13e38f8b0, 0x4f41ffdef2bfe636, 3}, - {0, 0, 0x64be4f6dbe9caa51, 0x6b23de1a687d9cb9, 5}, - {0, 0, 0x1169751bb9a7d9c3, 0xf7a594aec8ef8a9c, 9}, - {0, 0, 0x2b665362c4e812df, 0x3a0d80d68b3f8bc8, 13}, - {0, 0, 0x566be7ba4365b70a, 0x01ebbc1937d76cb4, 21}, - {0, 0, 0x380e2deb9d3f8aae, 0x017e0de0bcc6ca42, 30}, - {0, 0, 0xa46a3a9bcb43f4e5, 0x1c62c8473bdfcffb, 45}, - {0, 0, 0xf6759d85f23b5a2b, 0x5c042ae42c6d12c1, 61}}; + {0, 0, 0xF35862E13E38F8B0, 0x4F41FFDEF2BFE636, 3}, + {0, 0, 0x64BE4F6DBE9CAA51, 0x6B23DE1A687D9CB9, 5}, + {0, 0, 0x1169751BB9A7D9C3, 0xF7A594AEC8EF8A9C, 9}, + {0, 0, 0x2B665362C4E812DF, 0x3A0D80D68B3F8BC8, 13}, + {0, 0, 0x566BE7BA4365B70A, 0x01EBBC1937D76CB4, 21}, + {0, 0, 0x380E2DEB9D3F8AAE, 0x017E0DE0BCC6CA42, 30}, + {0, 0, 0xA46A3A9BCB43F4E5, 0x1C62C8473BDFCFFB, 45}, + {0, 0, 0xF6759D85F23B5A2B, 0x5C042AE42C6D12C1, 61}}; #define BCLRI_BSETI_BNEGI_DF(lanes, mask, func) \ [](uint64_t wd, uint64_t ws, uint32_t m) { \ @@ -8504,22 +8469,22 @@ TEST(MSA_binsli_binsri) { CcTest::InitializeVM(); struct TestCaseMsaBit tc[] = {// wd_lo, wd_hi, ws_lo, ws_hi, m - {0x53f4457553bbd5b4, 0x5fb8250eacc296b2, - 0xf35862e13e38f8b0, 0x4f41ffdef2bfe636, 3}, - {0xf61bfdb0f312e6fc, 0xc9437568dd1ea925, - 0x64be4f6dbe9caa51, 0x6b23de1a687d9cb9, 5}, - {0x53f4457553bbd5b4, 0x5fb8250eacc296b2, - 0x1169751bb9a7d9c3, 0xf7a594aec8ef8a9c, 9}, - {0xf61bfdb0f312e6fc, 0xc9437568dd1ea925, - 0x2b665362c4e812df, 0x3a0d80d68b3f8bc8, 13}, - {0x53f4457553bbd5b4, 0x5fb8250eacc296b2, - 0x566be7ba4365b70a, 0x01ebbc1937d76cb4, 21}, - {0xf61bfdb0f312e6fc, 0xc9437568dd1ea925, - 0x380e2deb9d3f8aae, 0x017e0de0bcc6ca42, 30}, - {0x53f4457553bbd5b4, 0x5fb8250eacc296b2, - 0xa46a3a9bcb43f4e5, 0x1c62c8473bdfcffb, 45}, - {0xf61bfdb0f312e6fc, 0xc9437568dd1ea925, - 0xf6759d85f23b5a2b, 0x5c042ae42c6d12c1, 61}}; + {0x53F4457553BBD5B4, 0x5FB8250EACC296B2, + 0xF35862E13E38F8B0, 0x4F41FFDEF2BFE636, 3}, + {0xF61BFDB0F312E6FC, 0xC9437568DD1EA925, + 0x64BE4F6DBE9CAA51, 0x6B23DE1A687D9CB9, 5}, + {0x53F4457553BBD5B4, 0x5FB8250EACC296B2, + 0x1169751BB9A7D9C3, 0xF7A594AEC8EF8A9C, 9}, + {0xF61BFDB0F312E6FC, 0xC9437568DD1EA925, + 0x2B665362C4E812DF, 0x3A0D80D68B3F8BC8, 13}, + {0x53F4457553BBD5B4, 0x5FB8250EACC296B2, + 0x566BE7BA4365B70A, 0x01EBBC1937D76CB4, 21}, + {0xF61BFDB0F312E6FC, 0xC9437568DD1EA925, + 0x380E2DEB9D3F8AAE, 0x017E0DE0BCC6CA42, 30}, + {0x53F4457553BBD5B4, 0x5FB8250EACC296B2, + 0xA46A3A9BCB43F4E5, 0x1C62C8473BDFCFFB, 45}, + {0xF61BFDB0F312E6FC, 0xC9437568DD1EA925, + 0xF6759D85F23B5A2B, 0x5C042AE42C6D12C1, 61}}; #define BINSLI_BINSRI_DF(lanes, mask, func) \ [](uint64_t wd, uint64_t ws, uint32_t m) { \ @@ -8596,14 +8561,14 @@ TEST(MSA_sat_s_sat_u) { struct TestCaseMsaBit tc[] = { // wd_lo, wd_hi, ws_lo, ws_hi, m - {0, 0, 0xf35862e13e3808b0, 0x4f41ffdef2bfe636, 3}, - {0, 0, 0x64be4f6dbe9caa51, 0x6b23de1a687d9cb9, 5}, - {0, 0, 0x1169751bb9a7d9c3, 0xf7a594aec8ef8a9c, 9}, - {0, 0, 0x2b665362c4e812df, 0x3a0d80d68b3f8bc8, 13}, - {0, 0, 0x566be7ba4365b70a, 0x01ebbc1937d76cb4, 21}, - {0, 0, 0x380e2deb9d3f8aae, 0x017e0de0bcc6ca42, 30}, - {0, 0, 0xa46a3a9bcb43f4e5, 0x1c62c8473bdfcffb, 45}, - {0, 0, 0xf6759d85f23b5a2b, 0x5c042ae42c6d12c1, 61}}; + {0, 0, 0xF35862E13E3808B0, 0x4F41FFDEF2BFE636, 3}, + {0, 0, 0x64BE4F6DBE9CAA51, 0x6B23DE1A687D9CB9, 5}, + {0, 0, 0x1169751BB9A7D9C3, 0xF7A594AEC8EF8A9C, 9}, + {0, 0, 0x2B665362C4E812DF, 0x3A0D80D68B3F8BC8, 13}, + {0, 0, 0x566BE7BA4365B70A, 0x01EBBC1937D76CB4, 21}, + {0, 0, 0x380E2DEB9D3F8AAE, 0x017E0DE0BCC6CA42, 30}, + {0, 0, 0xA46A3A9BCB43F4E5, 0x1C62C8473BDFCFFB, 45}, + {0, 0, 0xF6759D85F23B5A2B, 0x5C042AE42C6D12C1, 61}}; #define SAT_DF(lanes, mask, func) \ [](uint64_t wd, uint64_t ws, uint32_t m) { \ @@ -8712,9 +8677,9 @@ void run_msa_i10(int32_t input, InstFunc GenerateVectorInstructionFunc, #ifdef OBJECT_PRINT code->Print(std::cout); #endif - F3 f = FUNCTION_CAST<F3>(code->entry()); + auto f = GeneratedCode<F3>::FromCode(*code); - (CALL_GENERATED_CODE(isolate, f, &res, 0, 0, 0, 0)); + (f.Call(&res, 0, 0, 0, 0)); CHECK_EQ(GenerateOperationFunc(input), res.d[0]); CHECK_EQ(GenerateOperationFunc(input), res.d[1]); @@ -8791,9 +8756,9 @@ void run_msa_mi10(InstFunc GenerateVectorInstructionFunc) { #ifdef OBJECT_PRINT code->Print(std::cout); #endif - F4 f = FUNCTION_CAST<F4>(code->entry()); + auto f = GeneratedCode<F4>::FromCode(*code); - (CALL_GENERATED_CODE(isolate, f, in_array_middle, out_array_middle, 0, 0, 0)); + (f.Call(in_array_middle, out_array_middle, 0, 0, 0)); CHECK_EQ(memcmp(in_test_vector, out_test_vector, arraysize(in_test_vector)), 0); @@ -8871,9 +8836,9 @@ void run_msa_3r(struct TestCaseMsa3R* input, InstFunc GenerateI5InstructionFunc, #ifdef OBJECT_PRINT code->Print(std::cout); #endif - F3 f = FUNCTION_CAST<F3>(code->entry()); + auto f = GeneratedCode<F3>::FromCode(*code); - (CALL_GENERATED_CODE(isolate, f, &res, 0, 0, 0, 0)); + (f.Call(&res, 0, 0, 0, 0)); GenerateOperationFunc(&input->ws_lo, &input->wt_lo, &input->wd_lo); if (input->wd_lo != Unpredictable) { @@ -8891,32 +8856,32 @@ TEST(MSA_3R_instructions) { CcTest::InitializeVM(); struct TestCaseMsa3R tc[] = { - {0x1169751bb9a7d9c3, 0xf7a594aec8ef8a9c, 0x1169751bb9a7d9c3, - 0xf7a594aec8ef8a9c, 0x1169751bb9a7d9c3, 0xf7a594aec8ef8a9c}, - {0x2b665362c4e812df, 0x3a0d80d68b3f8bc8, 0x2b665362c4e812df, - 0x3a0d80d68b3f8bc8, 0x2b665362c4e812df, 0x3a0d80d68b3f8bc8}, - {0x1169751bb9a7d9c3, 0xf7a594aec8ef8a9c, 0x1169751bb9a7d9c3, - 0xf7a594aec8ef8a9c, 0x1169751bb9a7d9c3, 0xf7a594aec8ef8a9c}, - {0x2b665362c4e812df, 0x3a0d80d68b3f8bc8, 0x2b665362c4e812df, - 0x3a0d80d68b3f8bc8, 0x2b665362c4e812df, 0x3a0d80d68b3f8bc8}, - {0xffab807f807fffcd, 0x7f23ff80ff567f80, 0xffab807f807fffcd, - 0x7f23ff80ff567f80, 0xffab807f807fffcd, 0x7f23ff80ff567f80}, - {0x80ffefff7f12807f, 0x807f80ff7fdeff78, 0x80ffefff7f12807f, - 0x807f80ff7fdeff78, 0x80ffefff7f12807f, 0x807f80ff7fdeff78}, - {0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, - 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff}, - {0x0000000000000000, 0xffffffffffffffff, 0xffffffffffffffff, - 0x0000000000000000, 0x0000000000000000, 0xffffffffffffffff}, - {0xffff0000ffff0000, 0xffff0000ffff0000, 0xffff0000ffff0000, - 0xffff0000ffff0000, 0xffff0000ffff0000, 0xffff0000ffff0000}, - {0xff00ff00ff00ff00, 0xff00ff00ff00ff00, 0xff00ff00ff00ff00, - 0xff00ff00ff00ff00, 0xff00ff00ff00ff00, 0xff00ff00ff00ff00}, - {0xf0f0f0f0f0f0f0f0, 0xf0f0f0f0f0f0f0f0, 0xf0f0f0f0f0f0f0f0, - 0xf0f0f0f0f0f0f0f0, 0xf0f0f0f0f0f0f0f0, 0xf0f0f0f0f0f0f0f0}, - {0xff0000ffff0000ff, 0xff0000ffff0000ff, 0xff0000ffff0000ff, - 0xff0000ffff0000ff, 0xff0000ffff0000ff, 0xff0000ffff0000ff}, - {0xffff00000000ffff, 0xffff00000000ffff, 0xffff00000000ffff, - 0xffff00000000ffff, 0xffff00000000ffff, 0xffff00000000ffff}}; + {0x1169751BB9A7D9C3, 0xF7A594AEC8EF8A9C, 0x1169751BB9A7D9C3, + 0xF7A594AEC8EF8A9C, 0x1169751BB9A7D9C3, 0xF7A594AEC8EF8A9C}, + {0x2B665362C4E812DF, 0x3A0D80D68B3F8BC8, 0x2B665362C4E812DF, + 0x3A0D80D68B3F8BC8, 0x2B665362C4E812DF, 0x3A0D80D68B3F8BC8}, + {0x1169751BB9A7D9C3, 0xF7A594AEC8EF8A9C, 0x1169751BB9A7D9C3, + 0xF7A594AEC8EF8A9C, 0x1169751BB9A7D9C3, 0xF7A594AEC8EF8A9C}, + {0x2B665362C4E812DF, 0x3A0D80D68B3F8BC8, 0x2B665362C4E812DF, + 0x3A0D80D68B3F8BC8, 0x2B665362C4E812DF, 0x3A0D80D68B3F8BC8}, + {0xFFAB807F807FFFCD, 0x7F23FF80FF567F80, 0xFFAB807F807FFFCD, + 0x7F23FF80FF567F80, 0xFFAB807F807FFFCD, 0x7F23FF80FF567F80}, + {0x80FFEFFF7F12807F, 0x807F80FF7FDEFF78, 0x80FFEFFF7F12807F, + 0x807F80FF7FDEFF78, 0x80FFEFFF7F12807F, 0x807F80FF7FDEFF78}, + {0xFFFFFFFFFFFFFFFF, 0xFFFFFFFFFFFFFFFF, 0xFFFFFFFFFFFFFFFF, + 0xFFFFFFFFFFFFFFFF, 0xFFFFFFFFFFFFFFFF, 0xFFFFFFFFFFFFFFFF}, + {0x0000000000000000, 0xFFFFFFFFFFFFFFFF, 0xFFFFFFFFFFFFFFFF, + 0x0000000000000000, 0x0000000000000000, 0xFFFFFFFFFFFFFFFF}, + {0xFFFF0000FFFF0000, 0xFFFF0000FFFF0000, 0xFFFF0000FFFF0000, + 0xFFFF0000FFFF0000, 0xFFFF0000FFFF0000, 0xFFFF0000FFFF0000}, + {0xFF00FF00FF00FF00, 0xFF00FF00FF00FF00, 0xFF00FF00FF00FF00, + 0xFF00FF00FF00FF00, 0xFF00FF00FF00FF00, 0xFF00FF00FF00FF00}, + {0xF0F0F0F0F0F0F0F0, 0xF0F0F0F0F0F0F0F0, 0xF0F0F0F0F0F0F0F0, + 0xF0F0F0F0F0F0F0F0, 0xF0F0F0F0F0F0F0F0, 0xF0F0F0F0F0F0F0F0}, + {0xFF0000FFFF0000FF, 0xFF0000FFFF0000FF, 0xFF0000FFFF0000FF, + 0xFF0000FFFF0000FF, 0xFF0000FFFF0000FF, 0xFF0000FFFF0000FF}, + {0xFFFF00000000FFFF, 0xFFFF00000000FFFF, 0xFFFF00000000FFFF, + 0xFFFF00000000FFFF, 0xFFFF00000000FFFF, 0xFFFF00000000FFFF}}; #define SLL_DF(T, lanes, mask) \ int size_in_bits = kMSARegSize / lanes; \ @@ -9510,8 +9475,8 @@ TEST(MSA_3R_instructions) { T* ws_p = reinterpret_cast<T*>(ws); \ T* wt_p = reinterpret_cast<T*>(wt); \ T* wd_p = reinterpret_cast<T*>(wd); \ - const int mask_not_valid = 0xc0; \ - const int mask_6bits = 0x3f; \ + const int mask_not_valid = 0xC0; \ + const int mask_6bits = 0x3F; \ for (int i = 0; i < lanes; ++i) { \ if ((wd_p[i] & mask_not_valid)) { \ wd_p[i] = 0; \ @@ -9877,9 +9842,9 @@ void run_msa_3rf(const struct TestCaseMsa3RF* input, #ifdef OBJECT_PRINT code->Print(std::cout); #endif - F3 f = FUNCTION_CAST<F3>(code->entry()); + auto f = GeneratedCode<F3>::FromCode(*code); - (CALL_GENERATED_CODE(isolate, f, &res, 0, 0, 0, 0)); + (f.Call(&res, 0, 0, 0, 0)); CHECK_EQ(output->exp_res_lo, res.d[0]); CHECK_EQ(output->exp_res_hi, res.d[1]); @@ -10260,70 +10225,70 @@ TEST(MSA_fixed_point_arithmetic) { CcTest::InitializeVM(); const struct TestCaseMsa3RF tc_h[]{ - {0x800080007fff7fff, 0xe1ed8000fad3863a, 0x80007fff00af7fff, - 0x800015a77fffa0eb, 0x7fff800080007fff, 0x80007fff1f207364}, - {0x800080007fff006a, 0x002affc4329ad87b, 0x80007fff7fff00f3, - 0xffecffb4d0d7f429, 0x80007fff80007c33, 0x54ac6bbce53b8c91}}; + {0x800080007FFF7FFF, 0xE1ED8000FAD3863A, 0x80007FFF00AF7FFF, + 0x800015A77FFFA0EB, 0x7FFF800080007FFF, 0x80007FFF1F207364}, + {0x800080007FFF006A, 0x002AFFC4329AD87B, 0x80007FFF7FFF00F3, + 0xFFECFFB4D0D7F429, 0x80007FFF80007C33, 0x54AC6BBCE53B8C91}}; const struct TestCaseMsa3RF tc_w[]{ - {0x8000000080000000, 0x7fffffff7fffffff, 0x800000007fffffff, - 0x00001ff37fffffff, 0x7fffffff80000000, 0x800000007fffffff}, - {0xe1ed035580000000, 0xfad3863aed462c0b, 0x8000000015a70aec, - 0x7fffffffa0ebd354, 0x800000007fffffff, 0xd0d7f4291f207364}, - {0x8000000080000000, 0x7fffffff0000da1f, 0x800000007fffffff, - 0x7fffffff00f39c3b, 0x800000007fffffff, 0x800000007c33f2fd}, - {0x0000ac33ffff329a, 0x54ac6bbce53bd87b, 0xffffe2b4d0d7f429, - 0x0355ed462c0b1ff3, 0xb5deb625939dd3f9, 0xe642adfa69519596}}; + {0x8000000080000000, 0x7FFFFFFF7FFFFFFF, 0x800000007FFFFFFF, + 0x00001FF37FFFFFFF, 0x7FFFFFFF80000000, 0x800000007FFFFFFF}, + {0xE1ED035580000000, 0xFAD3863AED462C0B, 0x8000000015A70AEC, + 0x7FFFFFFFA0EBD354, 0x800000007FFFFFFF, 0xD0D7F4291F207364}, + {0x8000000080000000, 0x7FFFFFFF0000DA1F, 0x800000007FFFFFFF, + 0x7FFFFFFF00F39C3B, 0x800000007FFFFFFF, 0x800000007C33F2FD}, + {0x0000AC33FFFF329A, 0x54AC6BBCE53BD87B, 0xFFFFE2B4D0D7F429, + 0x0355ED462C0B1FF3, 0xB5DEB625939DD3F9, 0xE642ADFA69519596}}; const struct ExpectedResult_MSA3RF exp_res_mul_q_h[] = { - {0x7fff800100ae7ffe, 0x1e13ea59fad35a74}, - {0x7fff80017ffe0000, 0xffff0000ed5b03a7}}; + {0x7FFF800100AE7FFE, 0x1E13EA59FAD35A74}, + {0x7FFF80017FFE0000, 0xFFFF0000ED5B03A7}}; const struct ExpectedResult_MSA3RF exp_res_madd_q_h[] = { - {0x7fff800080ae7fff, 0x9e136a5819f37fff}, - {0x00000000fffe7c33, 0x54ab6bbcd2969038}}; + {0x7FFF800080AE7FFF, 0x9E136A5819F37FFF}, + {0x00000000FFFE7C33, 0x54AB6BBCD2969038}}; const struct ExpectedResult_MSA3RF exp_res_msub_q_h[] = { - {0xffffffff80000000, 0x80007fff244c18ef}, - {0x80007fff80007c32, 0x54ac6bbbf7df88e9}}; + {0xFFFFFFFF80000000, 0x80007FFF244C18EF}, + {0x80007FFF80007C32, 0x54AC6BBBF7DF88E9}}; const struct ExpectedResult_MSA3RF exp_res_mulr_q_h[] = { - {0x7fff800100af7ffe, 0x1e13ea59fad35a75}, - {0x7fff80017ffe0001, 0x00000000ed5b03a8}}; + {0x7FFF800100AF7FFE, 0x1E13EA59FAD35A75}, + {0x7FFF80017FFE0001, 0x00000000ED5B03A8}}; const struct ExpectedResult_MSA3RF exp_res_maddr_q_h[] = { - {0x7fff800080af7fff, 0x9e136a5819f37fff}, - {0x00000000fffe7c34, 0x54ac6bbcd2969039}}; + {0x7FFF800080AF7FFF, 0x9E136A5819F37FFF}, + {0x00000000FFFE7C34, 0x54AC6BBCD2969039}}; const struct ExpectedResult_MSA3RF exp_res_msubr_q_h[] = { - {0xffffffff80000001, 0x80007fff244d18ef}, - {0x80007fff80007c32, 0x54ac6bbcf7e088e9}}; + {0xFFFFFFFF80000001, 0x80007FFF244D18EF}, + {0x80007FFF80007C32, 0x54AC6BBCF7E088E9}}; const struct ExpectedResult_MSA3RF exp_res_mul_q_w[] = { - {0x7fffffff80000001, 0x00001ff27ffffffe}, - {0x1e12fcabea58f514, 0xfad3863a0de8dee1}, - {0x7fffffff80000001, 0x7ffffffe0000019f}, - {0xffffffff00004bab, 0x0234e1fbf6ca3ee0}}; + {0x7FFFFFFF80000001, 0x00001FF27FFFFFFE}, + {0x1E12FCABEA58F514, 0xFAD3863A0DE8DEE1}, + {0x7FFFFFFF80000001, 0x7FFFFFFE0000019F}, + {0xFFFFFFFF00004BAB, 0x0234E1FBF6CA3EE0}}; const struct ExpectedResult_MSA3RF exp_res_madd_q_w[] = { - {0x7fffffff80000000, 0x80001ff27fffffff}, - {0x9e12fcab6a58f513, 0xcbab7a632d095245}, - {0x0000000000000000, 0xfffffffe7c33f49c}, - {0xb5deb624939e1fa4, 0xe8778ff5601bd476}}; + {0x7FFFFFFF80000000, 0x80001FF27FFFFFFF}, + {0x9E12FCAB6A58F513, 0xCBAB7A632D095245}, + {0x0000000000000000, 0xFFFFFFFE7C33F49C}, + {0xB5DEB624939E1FA4, 0xE8778FF5601BD476}}; const struct ExpectedResult_MSA3RF exp_res_msub_q_w[] = { - {0xffffffffffffffff, 0x8000000000000000}, - {0x800000007fffffff, 0xd6046dee11379482}, - {0x800000007fffffff, 0x800000007c33f15d}, - {0xb5deb625939d884d, 0xe40dcbfe728756b5}}; + {0xFFFFFFFFFFFFFFFF, 0x8000000000000000}, + {0x800000007FFFFFFF, 0xD6046DEE11379482}, + {0x800000007FFFFFFF, 0x800000007C33F15D}, + {0xB5DEB625939D884D, 0xE40DCBFE728756B5}}; const struct ExpectedResult_MSA3RF exp_res_mulr_q_w[] = { - {0x7fffffff80000001, 0x00001ff37ffffffe}, - {0x1e12fcabea58f514, 0xfad3863a0de8dee2}, - {0x7fffffff80000001, 0x7ffffffe0000019f}, - {0x0000000000004bac, 0x0234e1fcf6ca3ee1}}; + {0x7FFFFFFF80000001, 0x00001FF37FFFFFFE}, + {0x1E12FCABEA58F514, 0xFAD3863A0DE8DEE2}, + {0x7FFFFFFF80000001, 0x7FFFFFFE0000019F}, + {0x0000000000004BAC, 0x0234E1FCF6CA3EE1}}; const struct ExpectedResult_MSA3RF exp_res_maddr_q_w[] = { - {0x7fffffff80000000, 0x80001ff37fffffff}, - {0x9e12fcab6a58f513, 0xcbab7a632d095246}, - {0x0000000000000000, 0xfffffffe7c33f49c}, - {0xb5deb625939e1fa5, 0xe8778ff6601bd477}}; + {0x7FFFFFFF80000000, 0x80001FF37FFFFFFF}, + {0x9E12FCAB6A58F513, 0xCBAB7A632D095246}, + {0x0000000000000000, 0xFFFFFFFE7C33F49C}, + {0xB5DEB625939E1FA5, 0xE8778FF6601BD477}}; const struct ExpectedResult_MSA3RF exp_res_msubr_q_w[] = { - {0xffffffffffffffff, 0x8000000000000001}, - {0x800000007fffffff, 0xd6046def11379482}, - {0x800000007fffffff, 0x800000007c33f15e}, - {0xb5deb625939d884d, 0xe40dcbfe728756b5}}; + {0xFFFFFFFFFFFFFFFF, 0x8000000000000001}, + {0x800000007FFFFFFF, 0xD6046DEF11379482}, + {0x800000007FFFFFFF, 0x800000007C33F15E}, + {0xB5DEB625939D884D, 0xE40DCBFE728756B5}}; #define TEST_FIXED_POINT_DF_H(instruction, src, exp_res) \ run_msa_3rf((src), (exp_res), \ @@ -10383,31 +10348,31 @@ TEST(MSA_fexdo) { const struct ExpRes_16I exp_res_fexdo_w[] = { {static_cast<int16_t>(0x0410), static_cast<int16_t>(0x0347), - static_cast<int16_t>(0xd00d), static_cast<int16_t>(0xfc00), - static_cast<int16_t>(0x7c00), static_cast<int16_t>(0x7dff), - static_cast<int16_t>(0x7c00), static_cast<int16_t>(0x7bff)}, + static_cast<int16_t>(0xD00D), static_cast<int16_t>(0xFC00), + static_cast<int16_t>(0x7C00), static_cast<int16_t>(0x7DFF), + static_cast<int16_t>(0x7C00), static_cast<int16_t>(0x7BFF)}, {static_cast<int16_t>(0x8001), static_cast<int16_t>(0x0001), static_cast<int16_t>(0x0002), static_cast<int16_t>(0x8000), static_cast<int16_t>(0x8000), static_cast<int16_t>(0x0000), - static_cast<int16_t>(0x57b9), static_cast<int16_t>(0xe1fb)}, + static_cast<int16_t>(0x57B9), static_cast<int16_t>(0xE1FB)}, {static_cast<int16_t>(0x0001), static_cast<int16_t>(0x8000), - static_cast<int16_t>(0xfc00), static_cast<int16_t>(0xfbff), - static_cast<int16_t>(0x0000), static_cast<int16_t>(0x7c00), - static_cast<int16_t>(0xfc00), static_cast<int16_t>(0x0000)}}; + static_cast<int16_t>(0xFC00), static_cast<int16_t>(0xFBFF), + static_cast<int16_t>(0x0000), static_cast<int16_t>(0x7C00), + static_cast<int16_t>(0xFC00), static_cast<int16_t>(0x0000)}}; const struct ExpRes_32I exp_res_fexdo_d[] = { - {bit_cast<int32_t>(0x7f800000), bit_cast<int32_t>(0x7f7fc99e), - bit_cast<int32_t>(0x7f800000), bit_cast<int32_t>(0xc49a4000)}, - {bit_cast<int32_t>(0xc21bae14), bit_cast<int32_t>(0xff800000), - bit_cast<int32_t>(0x0082ab1e), bit_cast<int32_t>(0x000bfa5a)}, - {bit_cast<int32_t>(0x7673b164), bit_cast<int32_t>(0xfb13653d), + {bit_cast<int32_t>(0x7F800000), bit_cast<int32_t>(0x7F7FC99E), + bit_cast<int32_t>(0x7F800000), bit_cast<int32_t>(0xC49A4000)}, + {bit_cast<int32_t>(0xC21BAE14), bit_cast<int32_t>(0xFF800000), + bit_cast<int32_t>(0x0082AB1E), bit_cast<int32_t>(0x000BFA5A)}, + {bit_cast<int32_t>(0x7673B164), bit_cast<int32_t>(0xFB13653D), bit_cast<int32_t>(0x80000000), bit_cast<int32_t>(0x00000000)}, - {bit_cast<int32_t>(0x000002ca), bit_cast<int32_t>(0x80000000), + {bit_cast<int32_t>(0x000002CA), bit_cast<int32_t>(0x80000000), bit_cast<int32_t>(0x80000001), bit_cast<int32_t>(0x00000001)}, - {bit_cast<int32_t>(0xff800000), bit_cast<int32_t>(0x56b5e621), - bit_cast<int32_t>(0x00000000), bit_cast<int32_t>(0x7f800000)}, - {bit_cast<int32_t>(0xf673b164), bit_cast<int32_t>(0x7b13653d), - bit_cast<int32_t>(0x0000042e), bit_cast<int32_t>(0x00000000)}}; + {bit_cast<int32_t>(0xFF800000), bit_cast<int32_t>(0x56B5E621), + bit_cast<int32_t>(0x00000000), bit_cast<int32_t>(0x7F800000)}, + {bit_cast<int32_t>(0xF673B164), bit_cast<int32_t>(0x7B13653D), + bit_cast<int32_t>(0x0000042E), bit_cast<int32_t>(0x00000000)}}; #define TEST_FEXDO_H(instruction, src, exp_res) \ run_msa_3rf(reinterpret_cast<const struct TestCaseMsa3RF*>(src), \ @@ -10457,31 +10422,31 @@ TEST(MSA_ftq) { {-3e306, 2e-307, 9e307, 2e-307, 0, 0}}; const struct ExpRes_16I exp_res_ftq_w[] = { - {static_cast<int16_t>(0x0000), static_cast<int16_t>(0xb375), - static_cast<int16_t>(0x004b), static_cast<int16_t>(0x0000), - static_cast<int16_t>(0x7fff), static_cast<int16_t>(0x8021), - static_cast<int16_t>(0x7fff), static_cast<int16_t>(0xffff)}, + {static_cast<int16_t>(0x0000), static_cast<int16_t>(0xB375), + static_cast<int16_t>(0x004B), static_cast<int16_t>(0x0000), + static_cast<int16_t>(0x7FFF), static_cast<int16_t>(0x8021), + static_cast<int16_t>(0x7FFF), static_cast<int16_t>(0xFFFF)}, {static_cast<int16_t>(0x0000), static_cast<int16_t>(0x8000), - static_cast<int16_t>(0x7ffd), static_cast<int16_t>(0xfff5), - static_cast<int16_t>(0x7fff), static_cast<int16_t>(0x8000), - static_cast<int16_t>(0x8000), static_cast<int16_t>(0x7fff)}, + static_cast<int16_t>(0x7FFD), static_cast<int16_t>(0xFFF5), + static_cast<int16_t>(0x7FFF), static_cast<int16_t>(0x8000), + static_cast<int16_t>(0x8000), static_cast<int16_t>(0x7FFF)}, {static_cast<int16_t>(0x0000), static_cast<int16_t>(0x0000), - static_cast<int16_t>(0x7fff), static_cast<int16_t>(0xffff), - static_cast<int16_t>(0x0000), static_cast<int16_t>(0x7fff), + static_cast<int16_t>(0x7FFF), static_cast<int16_t>(0xFFFF), + static_cast<int16_t>(0x0000), static_cast<int16_t>(0x7FFF), static_cast<int16_t>(0x8000), static_cast<int16_t>(0x0000)}}; const struct ExpRes_32I exp_res_ftq_d[] = { - {bit_cast<int32_t>(0x7fffffff), bit_cast<int32_t>(0xfffefbf4), - bit_cast<int32_t>(0x7fffffff), bit_cast<int32_t>(0x8020c49c)}, - {bit_cast<int32_t>(0x004b5dcc), bit_cast<int32_t>(0x00000000), - bit_cast<int32_t>(0x000000d7), bit_cast<int32_t>(0xb374bc6a)}, - {bit_cast<int32_t>(0x80000000), bit_cast<int32_t>(0x7fffffff), - bit_cast<int32_t>(0x7fffffff), bit_cast<int32_t>(0x80000000)}, - {bit_cast<int32_t>(0x7ffcb900), bit_cast<int32_t>(0xfff572de), + {bit_cast<int32_t>(0x7FFFFFFF), bit_cast<int32_t>(0xFFFEFBF4), + bit_cast<int32_t>(0x7FFFFFFF), bit_cast<int32_t>(0x8020C49C)}, + {bit_cast<int32_t>(0x004B5DCC), bit_cast<int32_t>(0x00000000), + bit_cast<int32_t>(0x000000D7), bit_cast<int32_t>(0xB374BC6A)}, + {bit_cast<int32_t>(0x80000000), bit_cast<int32_t>(0x7FFFFFFF), + bit_cast<int32_t>(0x7FFFFFFF), bit_cast<int32_t>(0x80000000)}, + {bit_cast<int32_t>(0x7FFCB900), bit_cast<int32_t>(0xFFF572DE), bit_cast<int32_t>(0x00000000), bit_cast<int32_t>(0x80000000)}, {bit_cast<int32_t>(0x80000000), bit_cast<int32_t>(0x00000000), - bit_cast<int32_t>(0x00000000), bit_cast<int32_t>(0x7fffffff)}, - {bit_cast<int32_t>(0x7fffffff), bit_cast<int32_t>(0x00000000), + bit_cast<int32_t>(0x00000000), bit_cast<int32_t>(0x7FFFFFFF)}, + {bit_cast<int32_t>(0x7FFFFFFF), bit_cast<int32_t>(0x00000000), bit_cast<int32_t>(0x80000000), bit_cast<int32_t>(0x00000000)}}; #define TEST_FTQ_H(instruction, src, exp_res) \ diff --git a/deps/v8/test/cctest/test-assembler-mips64.cc b/deps/v8/test/cctest/test-assembler-mips64.cc index f809ea8f39..c59f2af2dc 100644 --- a/deps/v8/test/cctest/test-assembler-mips64.cc +++ b/deps/v8/test/cctest/test-assembler-mips64.cc @@ -35,7 +35,7 @@ #include "src/factory.h" #include "src/macro-assembler.h" #include "src/mips64/macro-assembler-mips64.h" -#include "src/mips64/simulator-mips64.h" +#include "src/simulator.h" #include "test/cctest/cctest.h" @@ -43,11 +43,12 @@ namespace v8 { namespace internal { // Define these function prototypes to match JSEntryFunction in execution.cc. -typedef Object* (*F1)(int x, int p1, int p2, int p3, int p4); -typedef Object* (*F2)(int x, int y, int p2, int p3, int p4); -typedef Object* (*F3)(void* p, int p1, int p2, int p3, int p4); -typedef Object* (*F4)(int64_t x, int64_t y, int64_t p2, int64_t p3, int64_t p4); -typedef Object* (*F5)(void* p0, void* p1, int p2, int p3, int p4); +// TODO(mips64): Refine these signatures per test case. +typedef Object*(F1)(int x, int p1, int p2, int p3, int p4); +typedef Object*(F2)(int x, int y, int p2, int p3, int p4); +typedef Object*(F3)(void* p, int p1, int p2, int p3, int p4); +typedef Object*(F4)(int64_t x, int64_t y, int64_t p2, int64_t p3, int64_t p4); +typedef Object*(F5)(void* p0, void* p1, int p2, int p3, int p4); #define __ assm. @@ -68,10 +69,9 @@ TEST(MIPS0) { assm.GetCode(isolate, &desc); Handle<Code> code = isolate->factory()->NewCode(desc, Code::STUB, Handle<Code>()); - F2 f = FUNCTION_CAST<F2>(code->entry()); - int64_t res = reinterpret_cast<int64_t>( - CALL_GENERATED_CODE(isolate, f, 0xab0, 0xc, 0, 0, 0)); - CHECK_EQ(0xabcL, res); + auto f = GeneratedCode<F2>::FromCode(*code); + int64_t res = reinterpret_cast<int64_t>(f.Call(0xAB0, 0xC, 0, 0, 0)); + CHECK_EQ(0xABCL, res); } @@ -105,9 +105,8 @@ TEST(MIPS1) { assm.GetCode(isolate, &desc); Handle<Code> code = isolate->factory()->NewCode(desc, Code::STUB, Handle<Code>()); - F1 f = FUNCTION_CAST<F1>(code->entry()); - int64_t res = reinterpret_cast<int64_t>( - CALL_GENERATED_CODE(isolate, f, 50, 0, 0, 0, 0)); + auto f = GeneratedCode<F1>::FromCode(*code); + int64_t res = reinterpret_cast<int64_t>(f.Call(50, 0, 0, 0, 0)); CHECK_EQ(1275L, res); } @@ -130,8 +129,8 @@ TEST(MIPS2) { __ ori(a4, zero_reg, 0); __ lui(a4, 0x1234); __ ori(a4, a4, 0); - __ ori(a4, a4, 0x0f0f); - __ ori(a4, a4, 0xf0f0); + __ ori(a4, a4, 0x0F0F); + __ ori(a4, a4, 0xF0F0); __ addiu(a5, a4, 1); __ addiu(a6, a5, -0x10); @@ -139,20 +138,20 @@ TEST(MIPS2) { __ li(a4, 0x00000004); __ li(a5, 0x00001234); __ li(a6, 0x12345678); - __ li(a7, 0x7fffffff); - __ li(t0, 0xfffffffc); - __ li(t1, 0xffffedcc); - __ li(t2, 0xedcba988); + __ li(a7, 0x7FFFFFFF); + __ li(t0, 0xFFFFFFFC); + __ li(t1, 0xFFFFEDCC); + __ li(t2, 0xEDCBA988); __ li(t3, 0x80000000); // SPECIAL class. __ srl(v0, a6, 8); // 0x00123456 - __ sll(v0, v0, 11); // 0x91a2b000 - __ sra(v0, v0, 3); // 0xf2345600 - __ srav(v0, v0, a4); // 0xff234560 - __ sllv(v0, v0, a4); // 0xf2345600 - __ srlv(v0, v0, a4); // 0x0f234560 - __ Branch(&error, ne, v0, Operand(0x0f234560)); + __ sll(v0, v0, 11); // 0x91A2B000 + __ sra(v0, v0, 3); // 0xF2345600 + __ srav(v0, v0, a4); // 0xFF234560 + __ sllv(v0, v0, a4); // 0xF2345600 + __ srlv(v0, v0, a4); // 0x0F234560 + __ Branch(&error, ne, v0, Operand(0x0F234560)); __ nop(); __ addu(v0, a4, a5); // 0x00001238 @@ -160,17 +159,17 @@ TEST(MIPS2) { __ Branch(&error, ne, v0, Operand(0x00001234)); __ nop(); __ addu(v1, a7, a4); // 32bit addu result is sign-extended into 64bit reg. - __ Branch(&error, ne, v1, Operand(0xffffffff80000003)); + __ Branch(&error, ne, v1, Operand(0xFFFFFFFF80000003)); __ nop(); - __ subu(v1, t3, a4); // 0x7ffffffc - __ Branch(&error, ne, v1, Operand(0x7ffffffc)); + __ subu(v1, t3, a4); // 0x7FFFFFFC + __ Branch(&error, ne, v1, Operand(0x7FFFFFFC)); __ nop(); __ and_(v0, a5, a6); // 0x0000000000001230 __ or_(v0, v0, a5); // 0x0000000000001234 - __ xor_(v0, v0, a6); // 0x000000001234444c - __ nor(v0, v0, a6); // 0xffffffffedcba987 - __ Branch(&error, ne, v0, Operand(0xffffffffedcba983)); + __ xor_(v0, v0, a6); // 0x000000001234444C + __ nor(v0, v0, a6); // 0xFFFFFFFFEDCBA987 + __ Branch(&error, ne, v0, Operand(0xFFFFFFFFEDCBA983)); __ nop(); // Shift both 32bit number to left, to preserve meaning of next comparison. @@ -195,11 +194,11 @@ TEST(MIPS2) { __ Branch(&error, ne, v0, Operand(0x00007400)); __ nop(); __ addiu(v1, a7, 0x1); // 0x80000000 - result is sign-extended. - __ Branch(&error, ne, v1, Operand(0xffffffff80000000)); + __ Branch(&error, ne, v1, Operand(0xFFFFFFFF80000000)); __ nop(); __ slti(v0, a5, 0x00002000); // 0x1 - __ slti(v0, v0, 0xffff8000); // 0x0 + __ slti(v0, v0, 0xFFFF8000); // 0x0 __ Branch(&error, ne, v0, Operand(zero_reg)); __ nop(); __ sltiu(v0, a5, 0x00002000); // 0x1 @@ -207,13 +206,13 @@ TEST(MIPS2) { __ Branch(&error, ne, v0, Operand(0x1)); __ nop(); - __ andi(v0, a5, 0xf0f0); // 0x00001030 - __ ori(v0, v0, 0x8a00); // 0x00009a30 - __ xori(v0, v0, 0x83cc); // 0x000019fc - __ Branch(&error, ne, v0, Operand(0x000019fc)); + __ andi(v0, a5, 0xF0F0); // 0x00001030 + __ ori(v0, v0, 0x8A00); // 0x00009A30 + __ xori(v0, v0, 0x83CC); // 0x000019FC + __ Branch(&error, ne, v0, Operand(0x000019FC)); __ nop(); __ lui(v1, 0x8123); // Result is sign-extended into 64bit register. - __ Branch(&error, ne, v1, Operand(0xffffffff81230000)); + __ Branch(&error, ne, v1, Operand(0xFFFFFFFF81230000)); __ nop(); // Bit twiddling instructions & conditional moves. @@ -227,11 +226,11 @@ TEST(MIPS2) { __ addu(v0, v0, v1); // 51 __ Branch(&error, ne, v0, Operand(51)); __ Movn(a0, a7, a4); // Move a0<-a7 (a4 is NOT 0). - __ Ins(a0, a5, 12, 8); // 0x7ff34fff - __ Branch(&error, ne, a0, Operand(0x7ff34fff)); + __ Ins(a0, a5, 12, 8); // 0x7FF34FFF + __ Branch(&error, ne, a0, Operand(0x7FF34FFF)); __ Movz(a0, t2, t3); // a0 not updated (t3 is NOT 0). - __ Ext(a1, a0, 8, 12); // 0x34f - __ Branch(&error, ne, a1, Operand(0x34f)); + __ Ext(a1, a0, 8, 12); // 0x34F + __ Branch(&error, ne, a1, Operand(0x34F)); __ Movz(a0, t2, v1); // a0<-t2, v0 is 0, from 8 instr back. __ Branch(&error, ne, a0, Operand(t2)); @@ -252,9 +251,8 @@ TEST(MIPS2) { assm.GetCode(isolate, &desc); Handle<Code> code = isolate->factory()->NewCode(desc, Code::STUB, Handle<Code>()); - F2 f = FUNCTION_CAST<F2>(code->entry()); - int64_t res = reinterpret_cast<int64_t>( - CALL_GENERATED_CODE(isolate, f, 0xab0, 0xc, 0, 0, 0)); + auto f = GeneratedCode<F2>::FromCode(*code); + int64_t res = reinterpret_cast<int64_t>(f.Call(0xAB0, 0xC, 0, 0, 0)); CHECK_EQ(0x31415926L, res); } @@ -356,7 +354,7 @@ TEST(MIPS3) { assm.GetCode(isolate, &desc); Handle<Code> code = isolate->factory()->NewCode(desc, Code::STUB, Handle<Code>()); - F3 f = FUNCTION_CAST<F3>(code->entry()); + auto f = GeneratedCode<F3>::FromCode(*code); // Double test values. t.a = 1.5e14; t.b = 2.75e11; @@ -373,8 +371,7 @@ TEST(MIPS3) { t.fd = 0.0; t.fe = 0.0; t.ff = 0.0; - Object* dummy = CALL_GENERATED_CODE(isolate, f, &t, 0, 0, 0, 0); - USE(dummy); + f.Call(&t, 0, 0, 0, 0); // Expected double results. CHECK_EQ(1.5e14, t.a); CHECK_EQ(1.5e14, t.b); @@ -451,19 +448,18 @@ TEST(MIPS4) { assm.GetCode(isolate, &desc); Handle<Code> code = isolate->factory()->NewCode(desc, Code::STUB, Handle<Code>()); - F3 f = FUNCTION_CAST<F3>(code->entry()); + auto f = GeneratedCode<F3>::FromCode(*code); t.a = 1.5e22; t.b = 2.75e11; t.c = 17.17; t.d = -2.75e11; - Object* dummy = CALL_GENERATED_CODE(isolate, f, &t, 0, 0, 0, 0); - USE(dummy); + f.Call(&t, 0, 0, 0, 0); CHECK_EQ(2.75e11, t.a); CHECK_EQ(2.75e11, t.b); CHECK_EQ(1.5e22, t.c); - CHECK_EQ(static_cast<int64_t>(0xffffffffc25001d1L), t.high); - CHECK_EQ(static_cast<int64_t>(0xffffffffbf800000L), t.low); + CHECK_EQ(static_cast<int64_t>(0xFFFFFFFFC25001D1L), t.high); + CHECK_EQ(static_cast<int64_t>(0xFFFFFFFFBF800000L), t.low); } @@ -518,13 +514,12 @@ TEST(MIPS5) { assm.GetCode(isolate, &desc); Handle<Code> code = isolate->factory()->NewCode(desc, Code::STUB, Handle<Code>()); - F3 f = FUNCTION_CAST<F3>(code->entry()); + auto f = GeneratedCode<F3>::FromCode(*code); t.a = 1.5e4; t.b = 2.75e8; t.i = 12345678; t.j = -100000; - Object* dummy = CALL_GENERATED_CODE(isolate, f, &t, 0, 0, 0, 0); - USE(dummy); + f.Call(&t, 0, 0, 0, 0); CHECK_EQ(12345678.0, t.a); CHECK_EQ(-100000.0, t.b); @@ -589,25 +584,24 @@ TEST(MIPS6) { assm.GetCode(isolate, &desc); Handle<Code> code = isolate->factory()->NewCode(desc, Code::STUB, Handle<Code>()); - F3 f = FUNCTION_CAST<F3>(code->entry()); + auto f = GeneratedCode<F3>::FromCode(*code); t.ui = 0x11223344; - t.si = 0x99aabbcc; - Object* dummy = CALL_GENERATED_CODE(isolate, f, &t, 0, 0, 0, 0); - USE(dummy); + t.si = 0x99AABBCC; + f.Call(&t, 0, 0, 0, 0); CHECK_EQ(static_cast<int32_t>(0x11223344), t.r1); if (kArchEndian == kLittle) { CHECK_EQ(static_cast<int32_t>(0x3344), t.r2); - CHECK_EQ(static_cast<int32_t>(0xffffbbcc), t.r3); - CHECK_EQ(static_cast<int32_t>(0x0000bbcc), t.r4); - CHECK_EQ(static_cast<int32_t>(0xffffffcc), t.r5); - CHECK_EQ(static_cast<int32_t>(0x3333bbcc), t.r6); + CHECK_EQ(static_cast<int32_t>(0xFFFFBBCC), t.r3); + CHECK_EQ(static_cast<int32_t>(0x0000BBCC), t.r4); + CHECK_EQ(static_cast<int32_t>(0xFFFFFFCC), t.r5); + CHECK_EQ(static_cast<int32_t>(0x3333BBCC), t.r6); } else { CHECK_EQ(static_cast<int32_t>(0x1122), t.r2); - CHECK_EQ(static_cast<int32_t>(0xffff99aa), t.r3); - CHECK_EQ(static_cast<int32_t>(0x000099aa), t.r4); - CHECK_EQ(static_cast<int32_t>(0xffffff99), t.r5); - CHECK_EQ(static_cast<int32_t>(0x99aa3333), t.r6); + CHECK_EQ(static_cast<int32_t>(0xFFFF99AA), t.r3); + CHECK_EQ(static_cast<int32_t>(0x000099AA), t.r4); + CHECK_EQ(static_cast<int32_t>(0xFFFFFF99), t.r5); + CHECK_EQ(static_cast<int32_t>(0x99AA3333), t.r6); } } @@ -677,7 +671,7 @@ TEST(MIPS7) { assm.GetCode(isolate, &desc); Handle<Code> code = isolate->factory()->NewCode(desc, Code::STUB, Handle<Code>()); - F3 f = FUNCTION_CAST<F3>(code->entry()); + auto f = GeneratedCode<F3>::FromCode(*code); t.a = 1.5e14; t.b = 2.75e11; t.c = 2.0; @@ -685,8 +679,7 @@ TEST(MIPS7) { t.e = 0.0; t.f = 0.0; t.result = 0; - Object* dummy = CALL_GENERATED_CODE(isolate, f, &t, 0, 0, 0, 0); - USE(dummy); + f.Call(&t, 0, 0, 0, 0); CHECK_EQ(1.5e14, t.a); CHECK_EQ(2.75e11, t.b); CHECK_EQ(1, t.result); @@ -728,11 +721,11 @@ TEST(MIPS8) { // ROTR instruction (called through the Ror macro). __ Ror(a5, a4, 0x0004); __ Ror(a6, a4, 0x0008); - __ Ror(a7, a4, 0x000c); + __ Ror(a7, a4, 0x000C); __ Ror(t0, a4, 0x0010); __ Ror(t1, a4, 0x0014); __ Ror(t2, a4, 0x0018); - __ Ror(t3, a4, 0x001c); + __ Ror(t3, a4, 0x001C); // Basic word store. __ Sw(a5, MemOperand(a0, offsetof(T, result_rotr_4))); @@ -775,10 +768,9 @@ TEST(MIPS8) { assm.GetCode(isolate, &desc); Handle<Code> code = isolate->factory()->NewCode(desc, Code::STUB, Handle<Code>()); - F3 f = FUNCTION_CAST<F3>(code->entry()); + auto f = GeneratedCode<F3>::FromCode(*code); t.input = 0x12345678; - Object* dummy = CALL_GENERATED_CODE(isolate, f, &t, 0x0, 0, 0, 0); - USE(dummy); + f.Call(&t, 0x0, 0, 0, 0); CHECK_EQ(static_cast<int32_t>(0x81234567), t.result_rotr_4); CHECK_EQ(static_cast<int32_t>(0x78123456), t.result_rotr_8); CHECK_EQ(static_cast<int32_t>(0x67812345), t.result_rotr_12); @@ -898,17 +890,16 @@ TEST(MIPS10) { assm.GetCode(isolate, &desc); Handle<Code> code = isolate->factory()->NewCode(desc, Code::STUB, Handle<Code>()); - F3 f = FUNCTION_CAST<F3>(code->entry()); - t.a = 2.147483647e9; // 0x7fffffff -> 0x41DFFFFFFFC00000 as double. - t.b_long_hi = 0x000000ff; // 0xFF00FF00FF -> 0x426FE01FE01FE000 as double. - t.b_long_lo = 0x00ff00ff; - Object* dummy = CALL_GENERATED_CODE(isolate, f, &t, 0, 0, 0, 0); - USE(dummy); + auto f = GeneratedCode<F3>::FromCode(*code); + t.a = 2.147483647e9; // 0x7FFFFFFF -> 0x41DFFFFFFFC00000 as double. + t.b_long_hi = 0x000000FF; // 0xFF00FF00FF -> 0x426FE01FE01FE000 as double. + t.b_long_lo = 0x00FF00FF; + f.Call(&t, 0, 0, 0, 0); CHECK_EQ(static_cast<int32_t>(0x41DFFFFF), t.dbl_exp); CHECK_EQ(static_cast<int32_t>(0xFFC00000), t.dbl_mant); CHECK_EQ(0, t.long_hi); - CHECK_EQ(static_cast<int32_t>(0x7fffffff), t.long_lo); + CHECK_EQ(static_cast<int32_t>(0x7FFFFFFF), t.long_lo); CHECK_EQ(2.147483647e9, t.a_converted); // 0xFF00FF00FF -> 1.095233372415e12. @@ -1034,53 +1025,52 @@ TEST(MIPS11) { assm.GetCode(isolate, &desc); Handle<Code> code = isolate->factory()->NewCode(desc, Code::STUB, Handle<Code>()); - F3 f = FUNCTION_CAST<F3>(code->entry()); - t.reg_init = 0xaabbccdd; + auto f = GeneratedCode<F3>::FromCode(*code); + t.reg_init = 0xAABBCCDD; t.mem_init = 0x11223344; - Object* dummy = CALL_GENERATED_CODE(isolate, f, &t, 0, 0, 0, 0); - USE(dummy); + f.Call(&t, 0, 0, 0, 0); if (kArchEndian == kLittle) { - CHECK_EQ(static_cast<int32_t>(0x44bbccdd), t.lwl_0); - CHECK_EQ(static_cast<int32_t>(0x3344ccdd), t.lwl_1); - CHECK_EQ(static_cast<int32_t>(0x223344dd), t.lwl_2); + CHECK_EQ(static_cast<int32_t>(0x44BBCCDD), t.lwl_0); + CHECK_EQ(static_cast<int32_t>(0x3344CCDD), t.lwl_1); + CHECK_EQ(static_cast<int32_t>(0x223344DD), t.lwl_2); CHECK_EQ(static_cast<int32_t>(0x11223344), t.lwl_3); CHECK_EQ(static_cast<int32_t>(0x11223344), t.lwr_0); - CHECK_EQ(static_cast<int32_t>(0xaa112233), t.lwr_1); - CHECK_EQ(static_cast<int32_t>(0xaabb1122), t.lwr_2); - CHECK_EQ(static_cast<int32_t>(0xaabbcc11), t.lwr_3); - - CHECK_EQ(static_cast<int32_t>(0x112233aa), t.swl_0); - CHECK_EQ(static_cast<int32_t>(0x1122aabb), t.swl_1); - CHECK_EQ(static_cast<int32_t>(0x11aabbcc), t.swl_2); - CHECK_EQ(static_cast<int32_t>(0xaabbccdd), t.swl_3); - - CHECK_EQ(static_cast<int32_t>(0xaabbccdd), t.swr_0); - CHECK_EQ(static_cast<int32_t>(0xbbccdd44), t.swr_1); - CHECK_EQ(static_cast<int32_t>(0xccdd3344), t.swr_2); - CHECK_EQ(static_cast<int32_t>(0xdd223344), t.swr_3); + CHECK_EQ(static_cast<int32_t>(0xAA112233), t.lwr_1); + CHECK_EQ(static_cast<int32_t>(0xAABB1122), t.lwr_2); + CHECK_EQ(static_cast<int32_t>(0xAABBCC11), t.lwr_3); + + CHECK_EQ(static_cast<int32_t>(0x112233AA), t.swl_0); + CHECK_EQ(static_cast<int32_t>(0x1122AABB), t.swl_1); + CHECK_EQ(static_cast<int32_t>(0x11AABBCC), t.swl_2); + CHECK_EQ(static_cast<int32_t>(0xAABBCCDD), t.swl_3); + + CHECK_EQ(static_cast<int32_t>(0xAABBCCDD), t.swr_0); + CHECK_EQ(static_cast<int32_t>(0xBBCCDD44), t.swr_1); + CHECK_EQ(static_cast<int32_t>(0xCCDD3344), t.swr_2); + CHECK_EQ(static_cast<int32_t>(0xDD223344), t.swr_3); } else { CHECK_EQ(static_cast<int32_t>(0x11223344), t.lwl_0); - CHECK_EQ(static_cast<int32_t>(0x223344dd), t.lwl_1); - CHECK_EQ(static_cast<int32_t>(0x3344ccdd), t.lwl_2); - CHECK_EQ(static_cast<int32_t>(0x44bbccdd), t.lwl_3); + CHECK_EQ(static_cast<int32_t>(0x223344DD), t.lwl_1); + CHECK_EQ(static_cast<int32_t>(0x3344CCDD), t.lwl_2); + CHECK_EQ(static_cast<int32_t>(0x44BBCCDD), t.lwl_3); - CHECK_EQ(static_cast<int32_t>(0xaabbcc11), t.lwr_0); - CHECK_EQ(static_cast<int32_t>(0xaabb1122), t.lwr_1); - CHECK_EQ(static_cast<int32_t>(0xaa112233), t.lwr_2); + CHECK_EQ(static_cast<int32_t>(0xAABBCC11), t.lwr_0); + CHECK_EQ(static_cast<int32_t>(0xAABB1122), t.lwr_1); + CHECK_EQ(static_cast<int32_t>(0xAA112233), t.lwr_2); CHECK_EQ(static_cast<int32_t>(0x11223344), t.lwr_3); - CHECK_EQ(static_cast<int32_t>(0xaabbccdd), t.swl_0); - CHECK_EQ(static_cast<int32_t>(0x11aabbcc), t.swl_1); - CHECK_EQ(static_cast<int32_t>(0x1122aabb), t.swl_2); - CHECK_EQ(static_cast<int32_t>(0x112233aa), t.swl_3); + CHECK_EQ(static_cast<int32_t>(0xAABBCCDD), t.swl_0); + CHECK_EQ(static_cast<int32_t>(0x11AABBCC), t.swl_1); + CHECK_EQ(static_cast<int32_t>(0x1122AABB), t.swl_2); + CHECK_EQ(static_cast<int32_t>(0x112233AA), t.swl_3); - CHECK_EQ(static_cast<int32_t>(0xdd223344), t.swr_0); - CHECK_EQ(static_cast<int32_t>(0xccdd3344), t.swr_1); - CHECK_EQ(static_cast<int32_t>(0xbbccdd44), t.swr_2); - CHECK_EQ(static_cast<int32_t>(0xaabbccdd), t.swr_3); + CHECK_EQ(static_cast<int32_t>(0xDD223344), t.swr_0); + CHECK_EQ(static_cast<int32_t>(0xCCDD3344), t.swr_1); + CHECK_EQ(static_cast<int32_t>(0xBBCCDD44), t.swr_2); + CHECK_EQ(static_cast<int32_t>(0xAABBCCDD), t.swr_3); } } } @@ -1160,7 +1150,7 @@ TEST(MIPS12) { assm.GetCode(isolate, &desc); Handle<Code> code = isolate->factory()->NewCode(desc, Code::STUB, Handle<Code>()); - F3 f = FUNCTION_CAST<F3>(code->entry()); + auto f = GeneratedCode<F3>::FromCode(*code); t.x = 1; t.y = 2; t.y1 = 3; @@ -1168,8 +1158,7 @@ TEST(MIPS12) { t.y3 = 0XBABA; t.y4 = 0xDEDA; - Object* dummy = CALL_GENERATED_CODE(isolate, f, &t, 0, 0, 0, 0); - USE(dummy); + f.Call(&t, 0, 0, 0, 0); CHECK_EQ(3, t.y1); } @@ -1215,13 +1204,12 @@ TEST(MIPS13) { assm.GetCode(isolate, &desc); Handle<Code> code = isolate->factory()->NewCode(desc, Code::STUB, Handle<Code>()); - F3 f = FUNCTION_CAST<F3>(code->entry()); + auto f = GeneratedCode<F3>::FromCode(*code); t.cvt_big_in = 0xFFFFFFFF; t.cvt_small_in = 333; - Object* dummy = CALL_GENERATED_CODE(isolate, f, &t, 0, 0, 0, 0); - USE(dummy); + f.Call(&t, 0, 0, 0, 0); CHECK_EQ(t.cvt_big_out, static_cast<double>(t.cvt_big_in)); CHECK_EQ(t.cvt_small_out, static_cast<double>(t.cvt_small_in)); @@ -1337,7 +1325,7 @@ TEST(MIPS14) { assm.GetCode(isolate, &desc); Handle<Code> code = isolate->factory()->NewCode(desc, Code::STUB, Handle<Code>()); - F3 f = FUNCTION_CAST<F3>(code->entry()); + auto f = GeneratedCode<F3>::FromCode(*code); t.round_up_in = 123.51; t.round_down_in = 123.49; @@ -1348,8 +1336,7 @@ TEST(MIPS14) { t.err3_in = static_cast<double>(1) + 0xFFFFFFFF; t.err4_in = NAN; - Object* dummy = CALL_GENERATED_CODE(isolate, f, &t, 0, 0, 0, 0); - USE(dummy); + f.Call(&t, 0, 0, 0, 0); #define GET_FPU_ERR(x) (static_cast<int>(x & kFCSRFlagMask)) #define CHECK_NAN2008(x) (x & kFCSRNaN2008FlagMask) @@ -1468,9 +1455,9 @@ TEST(MIPS16) { assm.GetCode(isolate, &desc); Handle<Code> code = isolate->factory()->NewCode(desc, Code::STUB, Handle<Code>()); - F3 f = FUNCTION_CAST<F3>(code->entry()); + auto f = GeneratedCode<F3>::FromCode(*code); t.ui = 0x44332211; - t.si = 0x99aabbcc; + t.si = 0x99AABBCC; t.r1 = 0x5555555555555555; t.r2 = 0x5555555555555555; t.r3 = 0x5555555555555555; @@ -1484,8 +1471,7 @@ TEST(MIPS16) { t.r11 = 0x5555555555555555; t.r12 = 0x5555555555555555; - Object* dummy = CALL_GENERATED_CODE(isolate, f, &t, 0, 0, 0, 0); - USE(dummy); + f.Call(&t, 0, 0, 0, 0); if (kArchEndian == kLittle) { // Unsigned data, 32 & 64 @@ -1493,52 +1479,52 @@ TEST(MIPS16) { CHECK_EQ(static_cast<int64_t>(0x0000000044332211L), t.r2); // sd. // Signed data, 32 & 64. - CHECK_EQ(static_cast<int64_t>(0x5555555599aabbccL), t.r3); // lw, sw. - CHECK_EQ(static_cast<int64_t>(0xffffffff99aabbccL), t.r4); // sd. + CHECK_EQ(static_cast<int64_t>(0x5555555599AABBCCL), t.r3); // lw, sw. + CHECK_EQ(static_cast<int64_t>(0xFFFFFFFF99AABBCCL), t.r4); // sd. // Signed data, 32 & 64. - CHECK_EQ(static_cast<int64_t>(0x5555555599aabbccL), t.r5); // lwu, sw. - CHECK_EQ(static_cast<int64_t>(0x0000000099aabbccL), t.r6); // sd. + CHECK_EQ(static_cast<int64_t>(0x5555555599AABBCCL), t.r5); // lwu, sw. + CHECK_EQ(static_cast<int64_t>(0x0000000099AABBCCL), t.r6); // sd. // lh with unsigned and signed data. CHECK_EQ(static_cast<int64_t>(0x5555555500002211L), t.r7); // lh, sw. - CHECK_EQ(static_cast<int64_t>(0x55555555ffffbbccL), t.r8); // lh, sw. + CHECK_EQ(static_cast<int64_t>(0x55555555FFFFBBCCL), t.r8); // lh, sw. // lhu with signed data. - CHECK_EQ(static_cast<int64_t>(0x555555550000bbccL), t.r9); // lhu, sw. + CHECK_EQ(static_cast<int64_t>(0x555555550000BBCCL), t.r9); // lhu, sw. // lb with signed data. - CHECK_EQ(static_cast<int64_t>(0x55555555ffffffccL), t.r10); // lb, sw. + CHECK_EQ(static_cast<int64_t>(0x55555555FFFFFFCCL), t.r10); // lb, sw. // sh with unsigned and signed data. CHECK_EQ(static_cast<int64_t>(0x5555555555552211L), t.r11); // lw, sh. - CHECK_EQ(static_cast<int64_t>(0x555555555555bbccL), t.r12); // lw, sh. + CHECK_EQ(static_cast<int64_t>(0x555555555555BBCCL), t.r12); // lw, sh. } else { // Unsigned data, 32 & 64 CHECK_EQ(static_cast<int64_t>(0x4433221155555555L), t.r1); // lw, sw. CHECK_EQ(static_cast<int64_t>(0x0000000044332211L), t.r2); // sd. // Signed data, 32 & 64. - CHECK_EQ(static_cast<int64_t>(0x99aabbcc55555555L), t.r3); // lw, sw. - CHECK_EQ(static_cast<int64_t>(0xffffffff99aabbccL), t.r4); // sd. + CHECK_EQ(static_cast<int64_t>(0x99AABBCC55555555L), t.r3); // lw, sw. + CHECK_EQ(static_cast<int64_t>(0xFFFFFFFF99AABBCCL), t.r4); // sd. // Signed data, 32 & 64. - CHECK_EQ(static_cast<int64_t>(0x99aabbcc55555555L), t.r5); // lwu, sw. - CHECK_EQ(static_cast<int64_t>(0x0000000099aabbccL), t.r6); // sd. + CHECK_EQ(static_cast<int64_t>(0x99AABBCC55555555L), t.r5); // lwu, sw. + CHECK_EQ(static_cast<int64_t>(0x0000000099AABBCCL), t.r6); // sd. // lh with unsigned and signed data. CHECK_EQ(static_cast<int64_t>(0x0000443355555555L), t.r7); // lh, sw. - CHECK_EQ(static_cast<int64_t>(0xffff99aa55555555L), t.r8); // lh, sw. + CHECK_EQ(static_cast<int64_t>(0xFFFF99AA55555555L), t.r8); // lh, sw. // lhu with signed data. - CHECK_EQ(static_cast<int64_t>(0x000099aa55555555L), t.r9); // lhu, sw. + CHECK_EQ(static_cast<int64_t>(0x000099AA55555555L), t.r9); // lhu, sw. // lb with signed data. - CHECK_EQ(static_cast<int64_t>(0xffffff9955555555L), t.r10); // lb, sw. + CHECK_EQ(static_cast<int64_t>(0xFFFFFF9955555555L), t.r10); // lb, sw. // sh with unsigned and signed data. CHECK_EQ(static_cast<int64_t>(0x2211555555555555L), t.r11); // lw, sh. - CHECK_EQ(static_cast<int64_t>(0xbbcc555555555555L), t.r12); // lw, sh. + CHECK_EQ(static_cast<int64_t>(0xBBCC555555555555L), t.r12); // lw, sh. } } @@ -1597,9 +1583,9 @@ TEST(seleqz_selnez) { assm.GetCode(isolate, &desc); Handle<Code> code = isolate->factory()->NewCode(desc, Code::STUB, Handle<Code>()); - F3 f = FUNCTION_CAST<F3>(code->entry()); + auto f = GeneratedCode<F3>::FromCode(*code); - (CALL_GENERATED_CODE(isolate, f, &test, 0, 0, 0, 0)); + f.Call(&test, 0, 0, 0, 0); CHECK_EQ(1, test.a); CHECK_EQ(0, test.b); @@ -1627,7 +1613,7 @@ TEST(seleqz_selnez) { test.f = tests_D[j]; test.i = inputs_S[i]; test.j = tests_S[j]; - (CALL_GENERATED_CODE(isolate, f, &test, 0, 0, 0, 0)); + f.Call(&test, 0, 0, 0, 0); CHECK_EQ(outputs_D[i], test.g); CHECK_EQ(0, test.h); CHECK_EQ(outputs_S[i], test.k); @@ -1635,7 +1621,7 @@ TEST(seleqz_selnez) { test.f = tests_D[j+1]; test.j = tests_S[j+1]; - (CALL_GENERATED_CODE(isolate, f, &test, 0, 0, 0, 0)); + f.Call(&test, 0, 0, 0, 0); CHECK_EQ(0, test.g); CHECK_EQ(outputs_D[i], test.h); CHECK_EQ(0, test.k); @@ -1713,14 +1699,14 @@ TEST(min_max) { assm.GetCode(isolate, &desc); Handle<Code> code = isolate->factory()->NewCode(desc, Code::STUB, Handle<Code>()); - F3 f = FUNCTION_CAST<F3>(code->entry()); + auto f = GeneratedCode<F3>::FromCode(*code); for (int i = 4; i < kTableLength; i++) { test.a = inputsa[i]; test.b = inputsb[i]; test.e = inputse[i]; test.f = inputsf[i]; - CALL_GENERATED_CODE(isolate, f, &test, 0, 0, 0, 0); + f.Call(&test, 0, 0, 0, 0); CHECK_EQ(0, memcmp(&test.c, &outputsdmin[i], sizeof(test.c))); CHECK_EQ(0, memcmp(&test.d, &outputsdmax[i], sizeof(test.d))); @@ -1822,13 +1808,13 @@ TEST(rint_d) { assm.GetCode(isolate, &desc); Handle<Code> code = isolate->factory()->NewCode(desc, Code::STUB, Handle<Code>()); - F3 f = FUNCTION_CAST<F3>(code->entry()); + auto f = GeneratedCode<F3>::FromCode(*code); for (int j = 0; j < 4; j++) { test.fcsr = fcsr_inputs[j]; for (int i = 0; i < kTableLength; i++) { test.a = inputs[i]; - (CALL_GENERATED_CODE(isolate, f, &test, 0, 0, 0, 0)); + f.Call(&test, 0, 0, 0, 0); CHECK_EQ(test.b, outputs[j][i]); } } @@ -1870,7 +1856,7 @@ TEST(sel) { assm.GetCode(isolate, &desc); Handle<Code> code = isolate->factory()->NewCode(desc, Code::STUB, Handle<Code>()); - F3 f = FUNCTION_CAST<F3>(code->entry()); + auto f = GeneratedCode<F3>::FromCode(*code); const int test_size = 3; const int input_size = 5; @@ -1895,13 +1881,13 @@ TEST(sel) { test.ft = inputs_ft[i]; test.fd = tests_S[j]; test.fs = inputs_fs[i]; - (CALL_GENERATED_CODE(isolate, f, &test, 0, 0, 0, 0)); + f.Call(&test, 0, 0, 0, 0); CHECK_EQ(test.dd, inputs_ds[i]); CHECK_EQ(test.fd, inputs_fs[i]); test.dd = tests_D[j+1]; test.fd = tests_S[j+1]; - (CALL_GENERATED_CODE(isolate, f, &test, 0, 0, 0, 0)); + f.Call(&test, 0, 0, 0, 0); CHECK_EQ(test.dd, inputs_dt[i]); CHECK_EQ(test.fd, inputs_ft[i]); } @@ -2003,13 +1989,13 @@ TEST(rint_s) { assm.GetCode(isolate, &desc); Handle<Code> code = isolate->factory()->NewCode(desc, Code::STUB, Handle<Code>()); - F3 f = FUNCTION_CAST<F3>(code->entry()); + auto f = GeneratedCode<F3>::FromCode(*code); for (int j = 0; j < 4; j++) { test.fcsr = fcsr_inputs[j]; for (int i = 0; i < kTableLength; i++) { test.a = inputs[i]; - (CALL_GENERATED_CODE(isolate, f, &test, 0, 0, 0, 0)); + f.Call(&test, 0, 0, 0, 0); CHECK_EQ(test.b, outputs[j][i]); } } @@ -2089,13 +2075,13 @@ TEST(mina_maxa) { assm.GetCode(isolate, &desc); Handle<Code> code = isolate->factory()->NewCode(desc, Code::STUB, Handle<Code>()); - F3 f = FUNCTION_CAST<F3>(code->entry()); + auto f = GeneratedCode<F3>::FromCode(*code); for (int i = 0; i < kTableLength; i++) { test.a = inputsa[i]; test.b = inputsb[i]; test.c = inputsc[i]; test.d = inputsd[i]; - (CALL_GENERATED_CODE(isolate, f, &test, 0, 0, 0, 0)); + f.Call(&test, 0, 0, 0, 0); if (i < kTableLength - 1) { CHECK_EQ(test.resd, resd[i]); @@ -2171,11 +2157,11 @@ TEST(trunc_l) { assm.GetCode(isolate, &desc); Handle<Code> code = isolate->factory()->NewCode(desc, Code::STUB, Handle<Code>()); - F3 f = FUNCTION_CAST<F3>(code->entry()); + auto f = GeneratedCode<F3>::FromCode(*code); for (int i = 0; i < kTableLength; i++) { test.a = inputs_D[i]; test.b = inputs_S[i]; - (CALL_GENERATED_CODE(isolate, f, &test, 0, 0, 0, 0)); + f.Call(&test, 0, 0, 0, 0); if ((test.isNaN2008 & kFCSRNaN2008FlagMask) && kArchVariant == kMips64r6) { CHECK_EQ(test.c, outputsNaN2008[i]); @@ -2252,20 +2238,20 @@ TEST(movz_movn) { assm.GetCode(isolate, &desc); Handle<Code> code = isolate->factory()->NewCode(desc, Code::STUB, Handle<Code>()); - F3 f = FUNCTION_CAST<F3>(code->entry()); + auto f = GeneratedCode<F3>::FromCode(*code); for (int i = 0; i < kTableLength; i++) { test.a = inputs_D[i]; test.c = inputs_S[i]; test.rt = 1; - (CALL_GENERATED_CODE(isolate, f, &test, 0, 0, 0, 0)); + f.Call(&test, 0, 0, 0, 0); CHECK_EQ(test.b, test.bold); CHECK_EQ(test.d, test.dold); CHECK_EQ(test.b1, outputs_D[i]); CHECK_EQ(test.d1, outputs_S[i]); test.rt = 0; - (CALL_GENERATED_CODE(isolate, f, &test, 0, 0, 0, 0)); + f.Call(&test, 0, 0, 0, 0); CHECK_EQ(test.b, outputs_D[i]); CHECK_EQ(test.d, outputs_S[i]); CHECK_EQ(test.b1, test.bold1); @@ -2353,15 +2339,15 @@ TEST(movt_movd) { assm.GetCode(isolate, &desc); Handle<Code> code = isolate->factory()->NewCode(desc, Code::STUB, Handle<Code>()); - F3 f = FUNCTION_CAST<F3>(code->entry()); + auto f = GeneratedCode<F3>::FromCode(*code); - (CALL_GENERATED_CODE(isolate, f, &test, 0, 0, 0, 0)); + f.Call(&test, 0, 0, 0, 0); CHECK_EQ(test.dstf, outputs_S[i]); CHECK_EQ(test.dstd, outputs_D[i]); CHECK_EQ(test.dstf1, test.dstfold1); CHECK_EQ(test.dstd1, test.dstdold1); test.fcsr = 0; - (CALL_GENERATED_CODE(isolate, f, &test, 0, 0, 0, 0)); + f.Call(&test, 0, 0, 0, 0); CHECK_EQ(test.dstf, test.dstfold); CHECK_EQ(test.dstd, test.dstdold); CHECK_EQ(test.dstf1, outputs_S[i]); @@ -2440,12 +2426,12 @@ TEST(cvt_w_d) { assm.GetCode(isolate, &desc); Handle<Code> code = isolate->factory()->NewCode(desc, Code::STUB, Handle<Code>()); - F3 f = FUNCTION_CAST<F3>(code->entry()); + auto f = GeneratedCode<F3>::FromCode(*code); for (int j = 0; j < 4; j++) { test.fcsr = fcsr_inputs[j]; for (int i = 0; i < kTableLength; i++) { test.a = inputs[i]; - (CALL_GENERATED_CODE(isolate, f, &test, 0, 0, 0, 0)); + f.Call(&test, 0, 0, 0, 0); CHECK_EQ(test.b, outputs[j][i]); } } @@ -2508,11 +2494,11 @@ TEST(trunc_w) { assm.GetCode(isolate, &desc); Handle<Code> code = isolate->factory()->NewCode(desc, Code::STUB, Handle<Code>()); - F3 f = FUNCTION_CAST<F3>(code->entry()); + auto f = GeneratedCode<F3>::FromCode(*code); for (int i = 0; i < kTableLength; i++) { test.a = inputs_D[i]; test.b = inputs_S[i]; - (CALL_GENERATED_CODE(isolate, f, &test, 0, 0, 0, 0)); + f.Call(&test, 0, 0, 0, 0); if ((test.isNaN2008 & kFCSRNaN2008FlagMask) && kArchVariant == kMips64r6) { CHECK_EQ(test.c, outputsNaN2008[i]); } else { @@ -2578,11 +2564,11 @@ TEST(round_w) { assm.GetCode(isolate, &desc); Handle<Code> code = isolate->factory()->NewCode(desc, Code::STUB, Handle<Code>()); - F3 f = FUNCTION_CAST<F3>(code->entry()); + auto f = GeneratedCode<F3>::FromCode(*code); for (int i = 0; i < kTableLength; i++) { test.a = inputs_D[i]; test.b = inputs_S[i]; - (CALL_GENERATED_CODE(isolate, f, &test, 0, 0, 0, 0)); + f.Call(&test, 0, 0, 0, 0); if ((test.isNaN2008 & kFCSRNaN2008FlagMask) && kArchVariant == kMips64r6) { CHECK_EQ(test.c, outputsNaN2008[i]); } else { @@ -2649,11 +2635,11 @@ TEST(round_l) { assm.GetCode(isolate, &desc); Handle<Code> code = isolate->factory()->NewCode(desc, Code::STUB, Handle<Code>()); - F3 f = FUNCTION_CAST<F3>(code->entry()); + auto f = GeneratedCode<F3>::FromCode(*code); for (int i = 0; i < kTableLength; i++) { test.a = inputs_D[i]; test.b = inputs_S[i]; - (CALL_GENERATED_CODE(isolate, f, &test, 0, 0, 0, 0)); + f.Call(&test, 0, 0, 0, 0); if ((test.isNaN2008 & kFCSRNaN2008FlagMask) && kArchVariant == kMips64r6) { CHECK_EQ(test.c, outputsNaN2008[i]); @@ -2722,13 +2708,13 @@ TEST(sub) { assm.GetCode(isolate, &desc); Handle<Code> code = isolate->factory()->NewCode(desc, Code::STUB, Handle<Code>()); - F3 f = FUNCTION_CAST<F3>(code->entry()); + auto f = GeneratedCode<F3>::FromCode(*code); for (int i = 0; i < kTableLength; i++) { test.a = inputfs_S[i]; test.b = inputft_S[i]; test.c = inputfs_D[i]; test.d = inputft_D[i]; - (CALL_GENERATED_CODE(isolate, f, &test, 0, 0, 0, 0)); + f.Call(&test, 0, 0, 0, 0); CHECK_EQ(test.resultS, outputs_S[i]); CHECK_EQ(test.resultD, outputs_D[i]); } @@ -2795,7 +2781,7 @@ TEST(sqrt_rsqrt_recip) { assm.GetCode(isolate, &desc); Handle<Code> code = isolate->factory()->NewCode(desc, Code::STUB, Handle<Code>()); - F3 f = FUNCTION_CAST<F3>(code->entry()); + auto f = GeneratedCode<F3>::FromCode(*code); for (int i = 0; i < kTableLength; i++) { float f1; @@ -2803,7 +2789,7 @@ TEST(sqrt_rsqrt_recip) { test.a = inputs_S[i]; test.c = inputs_D[i]; - (CALL_GENERATED_CODE(isolate, f, &test, 0, 0, 0, 0)); + f.Call(&test, 0, 0, 0, 0); CHECK_EQ(test.resultS, outputs_S[i]); CHECK_EQ(test.resultD, outputs_D[i]); @@ -2874,11 +2860,11 @@ TEST(neg) { assm.GetCode(isolate, &desc); Handle<Code> code = isolate->factory()->NewCode(desc, Code::STUB, Handle<Code>()); - F3 f = FUNCTION_CAST<F3>(code->entry()); + auto f = GeneratedCode<F3>::FromCode(*code); for (int i = 0; i < kTableLength; i++) { test.a = inputs_S[i]; test.c = inputs_D[i]; - (CALL_GENERATED_CODE(isolate, f, &test, 0, 0, 0, 0)); + f.Call(&test, 0, 0, 0, 0); CHECK_EQ(test.resultS, outputs_S[i]); CHECK_EQ(test.resultD, outputs_D[i]); } @@ -2933,13 +2919,13 @@ TEST(mul) { assm.GetCode(isolate, &desc); Handle<Code> code = isolate->factory()->NewCode(desc, Code::STUB, Handle<Code>()); - F3 f = FUNCTION_CAST<F3>(code->entry()); + auto f = GeneratedCode<F3>::FromCode(*code); for (int i = 0; i < kTableLength; i++) { test.a = inputfs_S[i]; test.b = inputft_S[i]; test.c = inputfs_D[i]; test.d = inputft_D[i]; - (CALL_GENERATED_CODE(isolate, f, &test, 0, 0, 0, 0)); + f.Call(&test, 0, 0, 0, 0); CHECK_EQ(test.resultS, inputfs_S[i]*inputft_S[i]); CHECK_EQ(test.resultD, inputfs_D[i]*inputft_D[i]); } @@ -2989,12 +2975,12 @@ TEST(mov) { assm.GetCode(isolate, &desc); Handle<Code> code = isolate->factory()->NewCode(desc, Code::STUB, Handle<Code>()); - F3 f = FUNCTION_CAST<F3>(code->entry()); + auto f = GeneratedCode<F3>::FromCode(*code); for (int i = 0; i < kTableLength; i++) { test.a = inputs_D[i]; test.c = inputs_S[i]; - (CALL_GENERATED_CODE(isolate, f, &test, 0, 0, 0, 0)); + f.Call(&test, 0, 0, 0, 0); CHECK_EQ(test.b, outputs_D[i]); CHECK_EQ(test.d, outputs_S[i]); } @@ -3057,11 +3043,11 @@ TEST(floor_w) { assm.GetCode(isolate, &desc); Handle<Code> code = isolate->factory()->NewCode(desc, Code::STUB, Handle<Code>()); - F3 f = FUNCTION_CAST<F3>(code->entry()); + auto f = GeneratedCode<F3>::FromCode(*code); for (int i = 0; i < kTableLength; i++) { test.a = inputs_D[i]; test.b = inputs_S[i]; - (CALL_GENERATED_CODE(isolate, f, &test, 0, 0, 0, 0)); + f.Call(&test, 0, 0, 0, 0); if ((test.isNaN2008 & kFCSRNaN2008FlagMask) && kArchVariant == kMips64r6) { CHECK_EQ(test.c, outputsNaN2008[i]); } else { @@ -3128,11 +3114,11 @@ TEST(floor_l) { assm.GetCode(isolate, &desc); Handle<Code> code = isolate->factory()->NewCode(desc, Code::STUB, Handle<Code>()); - F3 f = FUNCTION_CAST<F3>(code->entry()); + auto f = GeneratedCode<F3>::FromCode(*code); for (int i = 0; i < kTableLength; i++) { test.a = inputs_D[i]; test.b = inputs_S[i]; - (CALL_GENERATED_CODE(isolate, f, &test, 0, 0, 0, 0)); + f.Call(&test, 0, 0, 0, 0); if ((test.isNaN2008 & kFCSRNaN2008FlagMask) && kArchVariant == kMips64r6) { CHECK_EQ(test.c, outputsNaN2008[i]); @@ -3200,11 +3186,11 @@ TEST(ceil_w) { assm.GetCode(isolate, &desc); Handle<Code> code = isolate->factory()->NewCode(desc, Code::STUB, Handle<Code>()); - F3 f = FUNCTION_CAST<F3>(code->entry()); + auto f = GeneratedCode<F3>::FromCode(*code); for (int i = 0; i < kTableLength; i++) { test.a = inputs_D[i]; test.b = inputs_S[i]; - (CALL_GENERATED_CODE(isolate, f, &test, 0, 0, 0, 0)); + f.Call(&test, 0, 0, 0, 0); if ((test.isNaN2008 & kFCSRNaN2008FlagMask) && kArchVariant == kMips64r6) { CHECK_EQ(test.c, outputsNaN2008[i]); } else { @@ -3271,11 +3257,11 @@ TEST(ceil_l) { assm.GetCode(isolate, &desc); Handle<Code> code = isolate->factory()->NewCode(desc, Code::STUB, Handle<Code>()); - F3 f = FUNCTION_CAST<F3>(code->entry()); + auto f = GeneratedCode<F3>::FromCode(*code); for (int i = 0; i < kTableLength; i++) { test.a = inputs_D[i]; test.b = inputs_S[i]; - (CALL_GENERATED_CODE(isolate, f, &test, 0, 0, 0, 0)); + f.Call(&test, 0, 0, 0, 0); if ((test.isNaN2008 & kFCSRNaN2008FlagMask) && kArchVariant == kMips64r6) { CHECK_EQ(test.c, outputsNaN2008[i]); @@ -3325,8 +3311,8 @@ TEST(jump_tables1) { for (int i = 0; i < kNumCases; ++i) { __ bind(&labels[i]); - __ lui(v0, (values[i] >> 16) & 0xffff); - __ ori(v0, v0, values[i] & 0xffff); + __ lui(v0, (values[i] >> 16) & 0xFFFF); + __ ori(v0, v0, values[i] & 0xFFFF); __ b(&done); __ nop(); } @@ -3346,10 +3332,9 @@ TEST(jump_tables1) { #ifdef OBJECT_PRINT code->Print(std::cout); #endif - F1 f = FUNCTION_CAST<F1>(code->entry()); + auto f = GeneratedCode<F1>::FromCode(*code); for (int i = 0; i < kNumCases; ++i) { - int64_t res = reinterpret_cast<int64_t>( - CALL_GENERATED_CODE(isolate, f, i, 0, 0, 0, 0)); + int64_t res = reinterpret_cast<int64_t>(f.Call(i, 0, 0, 0, 0)); ::printf("f(%d) = %" PRId64 "\n", i, res); CHECK_EQ(values[i], static_cast<int>(res)); } @@ -3378,8 +3363,8 @@ TEST(jump_tables2) { for (int i = 0; i < kNumCases; ++i) { __ bind(&labels[i]); - __ lui(v0, (values[i] >> 16) & 0xffff); - __ ori(v0, v0, values[i] & 0xffff); + __ lui(v0, (values[i] >> 16) & 0xFFFF); + __ ori(v0, v0, values[i] & 0xFFFF); __ b(&done); __ nop(); } @@ -3417,10 +3402,9 @@ TEST(jump_tables2) { #ifdef OBJECT_PRINT code->Print(std::cout); #endif - F1 f = FUNCTION_CAST<F1>(code->entry()); + auto f = GeneratedCode<F1>::FromCode(*code); for (int i = 0; i < kNumCases; ++i) { - int64_t res = reinterpret_cast<int64_t>( - CALL_GENERATED_CODE(isolate, f, i, 0, 0, 0, 0)); + int64_t res = reinterpret_cast<int64_t>(f.Call(i, 0, 0, 0, 0)); ::printf("f(%d) = %" PRId64 "\n", i, res); CHECK_EQ(values[i], res); } @@ -3498,10 +3482,9 @@ TEST(jump_tables3) { #ifdef OBJECT_PRINT code->Print(std::cout); #endif - F1 f = FUNCTION_CAST<F1>(code->entry()); + auto f = GeneratedCode<F1>::FromCode(*code); for (int i = 0; i < kNumCases; ++i) { - Handle<Object> result( - CALL_GENERATED_CODE(isolate, f, i, 0, 0, 0, 0), isolate); + Handle<Object> result(f.Call(i, 0, 0, 0, 0), isolate); #ifdef OBJECT_PRINT ::printf("f(%d) = ", i); result->Print(std::cout); @@ -3569,15 +3552,14 @@ TEST(BITSWAP) { assm.GetCode(isolate, &desc); Handle<Code> code = isolate->factory()->NewCode(desc, Code::STUB, Handle<Code>()); - F3 f = FUNCTION_CAST<F3>(code->entry()); + auto f = GeneratedCode<F3>::FromCode(*code); t.r1 = 0x00102100781A15C3; t.r2 = 0x001021008B71FCDE; t.r3 = 0xFF8017FF781A15C3; t.r4 = 0xFF8017FF8B71FCDE; t.r5 = 0x10C021098B71FCDE; t.r6 = 0xFB8017FF781A15C3; - Object* dummy = CALL_GENERATED_CODE(isolate, f, &t, 0, 0, 0, 0); - USE(dummy); + f.Call(&t, 0, 0, 0, 0); CHECK_EQ(static_cast<int64_t>(0x000000001E58A8C3L), t.r1); CHECK_EQ(static_cast<int64_t>(0xFFFFFFFFD18E3F7BL), t.r2); @@ -3712,7 +3694,7 @@ TEST(class_fmt) { assm.GetCode(isolate, &desc); Handle<Code> code = isolate->factory()->NewCode(desc, Code::STUB, Handle<Code>()); - F3 f = FUNCTION_CAST<F3>(code->entry()); + auto f = GeneratedCode<F3>::FromCode(*code); // Double test values. t.dSignalingNan = std::numeric_limits<double>::signaling_NaN(); @@ -3738,8 +3720,7 @@ TEST(class_fmt) { t.fPosSubnorm = FLT_MIN / 20.0; t.fPosZero = +0.0; - Object* dummy = CALL_GENERATED_CODE(isolate, f, &t, 0, 0, 0, 0); - USE(dummy); + f.Call(&t, 0, 0, 0, 0); // Expected double results. CHECK_EQ(bit_cast<int64_t>(t.dSignalingNan), 0x001); CHECK_EQ(bit_cast<int64_t>(t.dQuietNan), 0x002); @@ -3807,37 +3788,37 @@ TEST(ABS) { assm.GetCode(isolate, &desc); Handle<Code> code = isolate->factory()->NewCode(desc, Code::STUB, Handle<Code>()); - F3 f = FUNCTION_CAST<F3>(code->entry()); + auto f = GeneratedCode<F3>::FromCode(*code); test.a = -2.0; test.b = -2.0; - (CALL_GENERATED_CODE(isolate, f, &test, 0, 0, 0, 0)); + f.Call(&test, 0, 0, 0, 0); CHECK_EQ(test.a, 2.0); CHECK_EQ(test.b, 2.0); test.a = 2.0; test.b = 2.0; - (CALL_GENERATED_CODE(isolate, f, &test, 0, 0, 0, 0)); + f.Call(&test, 0, 0, 0, 0); CHECK_EQ(test.a, 2.0); CHECK_EQ(test.b, 2.0); // Testing biggest positive number test.a = std::numeric_limits<double>::max(); test.b = std::numeric_limits<float>::max(); - (CALL_GENERATED_CODE(isolate, f, &test, 0, 0, 0, 0)); + f.Call(&test, 0, 0, 0, 0); CHECK_EQ(test.a, std::numeric_limits<double>::max()); CHECK_EQ(test.b, std::numeric_limits<float>::max()); // Testing smallest negative number test.a = -std::numeric_limits<double>::max(); // lowest() test.b = -std::numeric_limits<float>::max(); // lowest() - (CALL_GENERATED_CODE(isolate, f, &test, 0, 0, 0, 0)); + f.Call(&test, 0, 0, 0, 0); CHECK_EQ(test.a, std::numeric_limits<double>::max()); CHECK_EQ(test.b, std::numeric_limits<float>::max()); // Testing smallest positive number test.a = -std::numeric_limits<double>::min(); test.b = -std::numeric_limits<float>::min(); - (CALL_GENERATED_CODE(isolate, f, &test, 0, 0, 0, 0)); + f.Call(&test, 0, 0, 0, 0); CHECK_EQ(test.a, std::numeric_limits<double>::min()); CHECK_EQ(test.b, std::numeric_limits<float>::min()); @@ -3846,7 +3827,7 @@ TEST(ABS) { / std::numeric_limits<double>::min(); test.b = -std::numeric_limits<float>::max() / std::numeric_limits<float>::min(); - (CALL_GENERATED_CODE(isolate, f, &test, 0, 0, 0, 0)); + f.Call(&test, 0, 0, 0, 0); CHECK_EQ(test.a, std::numeric_limits<double>::max() / std::numeric_limits<double>::min()); CHECK_EQ(test.b, std::numeric_limits<float>::max() @@ -3854,13 +3835,13 @@ TEST(ABS) { test.a = std::numeric_limits<double>::quiet_NaN(); test.b = std::numeric_limits<float>::quiet_NaN(); - (CALL_GENERATED_CODE(isolate, f, &test, 0, 0, 0, 0)); + f.Call(&test, 0, 0, 0, 0); CHECK(std::isnan(test.a)); CHECK(std::isnan(test.b)); test.a = std::numeric_limits<double>::signaling_NaN(); test.b = std::numeric_limits<float>::signaling_NaN(); - (CALL_GENERATED_CODE(isolate, f, &test, 0, 0, 0, 0)); + f.Call(&test, 0, 0, 0, 0); CHECK(std::isnan(test.a)); CHECK(std::isnan(test.b)); } @@ -3901,12 +3882,12 @@ TEST(ADD_FMT) { assm.GetCode(isolate, &desc); Handle<Code> code = isolate->factory()->NewCode(desc, Code::STUB, Handle<Code>()); - F3 f = FUNCTION_CAST<F3>(code->entry()); + auto f = GeneratedCode<F3>::FromCode(*code); test.a = 2.0; test.b = 3.0; test.fa = 2.0; test.fb = 3.0; - (CALL_GENERATED_CODE(isolate, f, &test, 0, 0, 0, 0)); + f.Call(&test, 0, 0, 0, 0); CHECK_EQ(test.c, 5.0); CHECK_EQ(test.fc, 5.0); @@ -3914,7 +3895,7 @@ TEST(ADD_FMT) { test.b = -std::numeric_limits<double>::max(); // lowest() test.fa = std::numeric_limits<float>::max(); test.fb = -std::numeric_limits<float>::max(); // lowest() - (CALL_GENERATED_CODE(isolate, f, &test, 0, 0, 0, 0)); + f.Call(&test, 0, 0, 0, 0); CHECK_EQ(test.c, 0.0); CHECK_EQ(test.fc, 0.0); @@ -3922,7 +3903,7 @@ TEST(ADD_FMT) { test.b = std::numeric_limits<double>::max(); test.fa = std::numeric_limits<float>::max(); test.fb = std::numeric_limits<float>::max(); - (CALL_GENERATED_CODE(isolate, f, &test, 0, 0, 0, 0)); + f.Call(&test, 0, 0, 0, 0); CHECK(!std::isfinite(test.c)); CHECK(!std::isfinite(test.fc)); @@ -3930,7 +3911,7 @@ TEST(ADD_FMT) { test.b = std::numeric_limits<double>::signaling_NaN(); test.fa = 5.0; test.fb = std::numeric_limits<float>::signaling_NaN(); - (CALL_GENERATED_CODE(isolate, f, &test, 0, 0, 0, 0)); + f.Call(&test, 0, 0, 0, 0); CHECK(std::isnan(test.c)); CHECK(std::isnan(test.fc)); } @@ -4056,12 +4037,12 @@ TEST(C_COND_FMT) { assm.GetCode(isolate, &desc); Handle<Code> code = isolate->factory()->NewCode(desc, Code::STUB, Handle<Code>()); - F3 f = FUNCTION_CAST<F3>(code->entry()); + auto f = GeneratedCode<F3>::FromCode(*code); test.dOp1 = 2.0; test.dOp2 = 3.0; test.fOp1 = 2.0; test.fOp2 = 3.0; - (CALL_GENERATED_CODE(isolate, f, &test, 0, 0, 0, 0)); + f.Call(&test, 0, 0, 0, 0); CHECK_EQ(test.dF, 0U); CHECK_EQ(test.dUn, 0U); CHECK_EQ(test.dEq, 0U); @@ -4083,7 +4064,7 @@ TEST(C_COND_FMT) { test.dOp2 = std::numeric_limits<double>::min(); test.fOp1 = std::numeric_limits<float>::min(); test.fOp2 = -std::numeric_limits<float>::max(); // lowest() - (CALL_GENERATED_CODE(isolate, f, &test, 0, 0, 0, 0)); + f.Call(&test, 0, 0, 0, 0); CHECK_EQ(test.dF, 0U); CHECK_EQ(test.dUn, 0U); CHECK_EQ(test.dEq, 0U); @@ -4105,7 +4086,7 @@ TEST(C_COND_FMT) { test.dOp2 = -std::numeric_limits<double>::max(); // lowest() test.fOp1 = std::numeric_limits<float>::max(); test.fOp2 = std::numeric_limits<float>::max(); - (CALL_GENERATED_CODE(isolate, f, &test, 0, 0, 0, 0)); + f.Call(&test, 0, 0, 0, 0); CHECK_EQ(test.dF, 0U); CHECK_EQ(test.dUn, 0U); CHECK_EQ(test.dEq, 1U); @@ -4127,7 +4108,7 @@ TEST(C_COND_FMT) { test.dOp2 = 0.0; test.fOp1 = std::numeric_limits<float>::quiet_NaN(); test.fOp2 = 0.0; - (CALL_GENERATED_CODE(isolate, f, &test, 0, 0, 0, 0)); + f.Call(&test, 0, 0, 0, 0); CHECK_EQ(test.dF, 0U); CHECK_EQ(test.dUn, 1U); CHECK_EQ(test.dEq, 0U); @@ -4257,7 +4238,7 @@ TEST(CMP_COND_FMT) { assm.GetCode(isolate, &desc); Handle<Code> code = isolate->factory()->NewCode(desc, Code::STUB, Handle<Code>()); - F3 f = FUNCTION_CAST<F3>(code->entry()); + auto f = GeneratedCode<F3>::FromCode(*code); uint64_t dTrue = 0xFFFFFFFFFFFFFFFF; uint64_t dFalse = 0x0000000000000000; uint32_t fTrue = 0xFFFFFFFF; @@ -4267,7 +4248,7 @@ TEST(CMP_COND_FMT) { test.dOp2 = 3.0; test.fOp1 = 2.0; test.fOp2 = 3.0; - (CALL_GENERATED_CODE(isolate, f, &test, 0, 0, 0, 0)); + f.Call(&test, 0, 0, 0, 0); CHECK_EQ(bit_cast<uint64_t>(test.dF), dFalse); CHECK_EQ(bit_cast<uint64_t>(test.dUn), dFalse); CHECK_EQ(bit_cast<uint64_t>(test.dEq), dFalse); @@ -4292,7 +4273,7 @@ TEST(CMP_COND_FMT) { test.dOp2 = std::numeric_limits<double>::min(); test.fOp1 = std::numeric_limits<float>::min(); test.fOp2 = -std::numeric_limits<float>::max(); // lowest() - (CALL_GENERATED_CODE(isolate, f, &test, 0, 0, 0, 0)); + f.Call(&test, 0, 0, 0, 0); CHECK_EQ(bit_cast<uint64_t>(test.dF), dFalse); CHECK_EQ(bit_cast<uint64_t>(test.dUn), dFalse); CHECK_EQ(bit_cast<uint64_t>(test.dEq), dFalse); @@ -4317,7 +4298,7 @@ TEST(CMP_COND_FMT) { test.dOp2 = -std::numeric_limits<double>::max(); // lowest() test.fOp1 = std::numeric_limits<float>::max(); test.fOp2 = std::numeric_limits<float>::max(); - (CALL_GENERATED_CODE(isolate, f, &test, 0, 0, 0, 0)); + f.Call(&test, 0, 0, 0, 0); CHECK_EQ(bit_cast<uint64_t>(test.dF), dFalse); CHECK_EQ(bit_cast<uint64_t>(test.dUn), dFalse); CHECK_EQ(bit_cast<uint64_t>(test.dEq), dTrue); @@ -4342,7 +4323,7 @@ TEST(CMP_COND_FMT) { test.dOp2 = 0.0; test.fOp1 = std::numeric_limits<float>::quiet_NaN(); test.fOp2 = 0.0; - (CALL_GENERATED_CODE(isolate, f, &test, 0, 0, 0, 0)); + f.Call(&test, 0, 0, 0, 0); CHECK_EQ(bit_cast<uint64_t>(test.dF), dFalse); CHECK_EQ(bit_cast<uint64_t>(test.dUn), dTrue); CHECK_EQ(bit_cast<uint64_t>(test.dEq), dFalse); @@ -4436,7 +4417,7 @@ TEST(CVT) { assm.GetCode(isolate, &desc); Handle<Code> code = isolate->factory()->NewCode(desc, Code::STUB, Handle<Code>()); - F3 f = FUNCTION_CAST<F3>(code->entry()); + auto f = GeneratedCode<F3>::FromCode(*code); test.cvt_d_s_in = -0.51; test.cvt_d_w_in = -1; @@ -4449,7 +4430,7 @@ TEST(CVT) { test.cvt_w_s_in = -0.51; test.cvt_w_d_in = -0.51; - (CALL_GENERATED_CODE(isolate, f, &test, 0, 0, 0, 0)); + f.Call(&test, 0, 0, 0, 0); CHECK_EQ(test.cvt_d_s_out, static_cast<double>(test.cvt_d_s_in)); CHECK_EQ(test.cvt_d_w_out, static_cast<double>(test.cvt_d_w_in)); CHECK_EQ(test.cvt_d_l_out, static_cast<double>(test.cvt_d_l_in)); @@ -4472,7 +4453,7 @@ TEST(CVT) { test.cvt_w_s_in = 0.49; test.cvt_w_d_in = 0.49; - (CALL_GENERATED_CODE(isolate, f, &test, 0, 0, 0, 0)); + f.Call(&test, 0, 0, 0, 0); CHECK_EQ(test.cvt_d_s_out, static_cast<double>(test.cvt_d_s_in)); CHECK_EQ(test.cvt_d_w_out, static_cast<double>(test.cvt_d_w_in)); CHECK_EQ(test.cvt_d_l_out, static_cast<double>(test.cvt_d_l_in)); @@ -4495,7 +4476,7 @@ TEST(CVT) { test.cvt_w_s_in = std::numeric_limits<float>::max(); test.cvt_w_d_in = std::numeric_limits<double>::max(); - (CALL_GENERATED_CODE(isolate, f, &test, 0, 0, 0, 0)); + f.Call(&test, 0, 0, 0, 0); CHECK_EQ(test.cvt_d_s_out, static_cast<double>(test.cvt_d_s_in)); CHECK_EQ(test.cvt_d_w_out, static_cast<double>(test.cvt_d_w_in)); CHECK_EQ(test.cvt_d_l_out, static_cast<double>(test.cvt_d_l_in)); @@ -4519,7 +4500,7 @@ TEST(CVT) { test.cvt_w_s_in = -std::numeric_limits<float>::max(); // lowest() test.cvt_w_d_in = -std::numeric_limits<double>::max(); // lowest() - (CALL_GENERATED_CODE(isolate, f, &test, 0, 0, 0, 0)); + f.Call(&test, 0, 0, 0, 0); CHECK_EQ(test.cvt_d_s_out, static_cast<double>(test.cvt_d_s_in)); CHECK_EQ(test.cvt_d_w_out, static_cast<double>(test.cvt_d_w_in)); CHECK_EQ(test.cvt_d_l_out, static_cast<double>(test.cvt_d_l_in)); @@ -4550,7 +4531,7 @@ TEST(CVT) { test.cvt_w_s_in = std::numeric_limits<float>::min(); test.cvt_w_d_in = std::numeric_limits<double>::min(); - (CALL_GENERATED_CODE(isolate, f, &test, 0, 0, 0, 0)); + f.Call(&test, 0, 0, 0, 0); CHECK_EQ(test.cvt_d_s_out, static_cast<double>(test.cvt_d_s_in)); CHECK_EQ(test.cvt_d_w_out, static_cast<double>(test.cvt_d_w_in)); CHECK_EQ(test.cvt_d_l_out, static_cast<double>(test.cvt_d_l_in)); @@ -4608,9 +4589,9 @@ TEST(DIV_FMT) { assm.GetCode(isolate, &desc); Handle<Code> code = isolate->factory()->NewCode(desc, Code::STUB, Handle<Code>()); - F3 f = FUNCTION_CAST<F3>(code->entry()); + auto f = GeneratedCode<F3>::FromCode(*code); - (CALL_GENERATED_CODE(isolate, f, &test, 0, 0, 0, 0)); + f.Call(&test, 0, 0, 0, 0); const int test_size = 3; @@ -4651,7 +4632,7 @@ TEST(DIV_FMT) { test.fOp1 = fOp1[i]; test.fOp2 = fOp2[i]; - (CALL_GENERATED_CODE(isolate, f, &test, 0, 0, 0, 0)); + f.Call(&test, 0, 0, 0, 0); CHECK_EQ(test.dRes, dRes[i]); CHECK_EQ(test.fRes, fRes[i]); } @@ -4661,7 +4642,7 @@ TEST(DIV_FMT) { test.fOp1 = FLT_MAX; test.fOp2 = -0.0; - (CALL_GENERATED_CODE(isolate, f, &test, 0, 0, 0, 0)); + f.Call(&test, 0, 0, 0, 0); CHECK(!std::isfinite(test.dRes)); CHECK(!std::isfinite(test.fRes)); @@ -4670,7 +4651,7 @@ TEST(DIV_FMT) { test.fOp1 = 0.0; test.fOp2 = -0.0; - (CALL_GENERATED_CODE(isolate, f, &test, 0, 0, 0, 0)); + f.Call(&test, 0, 0, 0, 0); CHECK(std::isnan(test.dRes)); CHECK(std::isnan(test.fRes)); @@ -4679,7 +4660,7 @@ TEST(DIV_FMT) { test.fOp1 = std::numeric_limits<float>::quiet_NaN(); test.fOp2 = -5.0; - (CALL_GENERATED_CODE(isolate, f, &test, 0, 0, 0, 0)); + f.Call(&test, 0, 0, 0, 0); CHECK(std::isnan(test.dRes)); CHECK(std::isnan(test.fRes)); } @@ -4701,10 +4682,10 @@ uint64_t run_align(uint64_t rs_value, uint64_t rt_value, uint8_t bp) { Handle<Code> code = isolate->factory()->NewCode(desc, Code::STUB, Handle<Code>()); - F4 f = FUNCTION_CAST<F4>(code->entry()); + auto f = GeneratedCode<F4>::FromCode(*code); - uint64_t res = reinterpret_cast<uint64_t>( - CALL_GENERATED_CODE(isolate, f, rs_value, rt_value, 0, 0, 0)); + uint64_t res = + reinterpret_cast<uint64_t>(f.Call(rs_value, rt_value, 0, 0, 0)); return res; } @@ -4721,13 +4702,15 @@ TEST(r6_align) { uint64_t expected_res; }; + // clang-format off struct TestCaseAlign tc[] = { // rs_value, rt_value, bp, expected_res - { 0x11223344, 0xaabbccdd, 0, 0xffffffffaabbccdd }, - { 0x11223344, 0xaabbccdd, 1, 0xffffffffbbccdd11 }, - { 0x11223344, 0xaabbccdd, 2, 0xffffffffccdd1122 }, - { 0x11223344, 0xaabbccdd, 3, 0xffffffffdd112233 }, + { 0x11223344, 0xAABBCCDD, 0, 0xFFFFFFFFAABBCCDD }, + { 0x11223344, 0xAABBCCDD, 1, 0xFFFFFFFFBBCCDD11 }, + { 0x11223344, 0xAABBCCDD, 2, 0xFFFFFFFFCCDD1122 }, + { 0x11223344, 0xAABBCCDD, 3, 0xFFFFFFFFDD112233 }, }; + // clang-format on size_t nr_test_cases = sizeof(tc) / sizeof(TestCaseAlign); for (size_t i = 0; i < nr_test_cases; ++i) { @@ -4755,9 +4738,9 @@ uint64_t run_dalign(uint64_t rs_value, uint64_t rt_value, uint8_t bp) { Handle<Code> code = isolate->factory()->NewCode(desc, Code::STUB, Handle<Code>()); - F4 f = FUNCTION_CAST<F4>(code->entry()); - uint64_t res = reinterpret_cast<uint64_t>( - CALL_GENERATED_CODE(isolate, f, rs_value, rt_value, 0, 0, 0)); + auto f = GeneratedCode<F4>::FromCode(*code); + uint64_t res = + reinterpret_cast<uint64_t>(f.Call(rs_value, rt_value, 0, 0, 0)); return res; } @@ -4774,17 +4757,19 @@ TEST(r6_dalign) { uint64_t expected_res; }; + // clang-format off struct TestCaseDalign tc[] = { // rs_value, rt_value, bp, expected_res - { 0x1122334455667700, 0xaabbccddeeff8899, 0, 0xaabbccddeeff8899 }, - { 0x1122334455667700, 0xaabbccddeeff8899, 1, 0xbbccddeeff889911 }, - { 0x1122334455667700, 0xaabbccddeeff8899, 2, 0xccddeeff88991122 }, - { 0x1122334455667700, 0xaabbccddeeff8899, 3, 0xddeeff8899112233 }, - { 0x1122334455667700, 0xaabbccddeeff8899, 4, 0xeeff889911223344 }, - { 0x1122334455667700, 0xaabbccddeeff8899, 5, 0xff88991122334455 }, - { 0x1122334455667700, 0xaabbccddeeff8899, 6, 0x8899112233445566 }, - { 0x1122334455667700, 0xaabbccddeeff8899, 7, 0x9911223344556677 } + { 0x1122334455667700, 0xAABBCCDDEEFF8899, 0, 0xAABBCCDDEEFF8899 }, + { 0x1122334455667700, 0xAABBCCDDEEFF8899, 1, 0xBBCCDDEEFF889911 }, + { 0x1122334455667700, 0xAABBCCDDEEFF8899, 2, 0xCCDDEEFF88991122 }, + { 0x1122334455667700, 0xAABBCCDDEEFF8899, 3, 0xDDEEFF8899112233 }, + { 0x1122334455667700, 0xAABBCCDDEEFF8899, 4, 0xEEFF889911223344 }, + { 0x1122334455667700, 0xAABBCCDDEEFF8899, 5, 0xFF88991122334455 }, + { 0x1122334455667700, 0xAABBCCDDEEFF8899, 6, 0x8899112233445566 }, + { 0x1122334455667700, 0xAABBCCDDEEFF8899, 7, 0x9911223344556677 } }; + // clang-format on size_t nr_test_cases = sizeof(tc) / sizeof(TestCaseDalign); for (size_t i = 0; i < nr_test_cases; ++i) { @@ -4814,11 +4799,10 @@ uint64_t run_aluipc(int16_t offset) { Handle<Code> code = isolate->factory()->NewCode(desc, Code::STUB, Handle<Code>()); - F2 f = FUNCTION_CAST<F2>(code->entry()); - PC = (uint64_t) f; // Set the program counter. + auto f = GeneratedCode<F2>::FromCode(*code); + PC = (uint64_t)code->entry(); // Set the program counter. - uint64_t res = reinterpret_cast<uint64_t>( - CALL_GENERATED_CODE(isolate, f, 0, 0, 0, 0, 0)); + uint64_t res = reinterpret_cast<uint64_t>(f.Call(0, 0, 0, 0, 0)); return res; } @@ -4869,11 +4853,10 @@ uint64_t run_auipc(int16_t offset) { Handle<Code> code = isolate->factory()->NewCode(desc, Code::STUB, Handle<Code>()); - F2 f = FUNCTION_CAST<F2>(code->entry()); - PC = (uint64_t) f; // Set the program counter. + auto f = GeneratedCode<F2>::FromCode(*code); + PC = (uint64_t)code->entry(); // Set the program counter. - uint64_t res = reinterpret_cast<uint64_t>( - CALL_GENERATED_CODE(isolate, f, 0, 0, 0, 0, 0)); + uint64_t res = reinterpret_cast<uint64_t>(f.Call(0, 0, 0, 0, 0)); return res; } @@ -4925,11 +4908,9 @@ uint64_t run_aui(uint64_t rs, uint16_t offset) { Handle<Code> code = isolate->factory()->NewCode(desc, Code::STUB, Handle<Code>()); - F2 f = FUNCTION_CAST<F2>(code->entry()); + auto f = GeneratedCode<F2>::FromCode(*code); - uint64_t res = - reinterpret_cast<uint64_t> - (CALL_GENERATED_CODE(isolate, f, 0, 0, 0, 0, 0)); + uint64_t res = reinterpret_cast<uint64_t>(f.Call(0, 0, 0, 0, 0)); return res; } @@ -4952,11 +4933,9 @@ uint64_t run_daui(uint64_t rs, uint16_t offset) { Handle<Code> code = isolate->factory()->NewCode(desc, Code::STUB, Handle<Code>()); - F2 f = FUNCTION_CAST<F2>(code->entry()); + auto f = GeneratedCode<F2>::FromCode(*code); - uint64_t res = - reinterpret_cast<uint64_t> - (CALL_GENERATED_CODE(isolate, f, 0, 0, 0, 0, 0)); + uint64_t res = reinterpret_cast<uint64_t>(f.Call(0, 0, 0, 0, 0)); return res; } @@ -4979,11 +4958,9 @@ uint64_t run_dahi(uint64_t rs, uint16_t offset) { Handle<Code> code = isolate->factory()->NewCode(desc, Code::STUB, Handle<Code>()); - F2 f = FUNCTION_CAST<F2>(code->entry()); + auto f = GeneratedCode<F2>::FromCode(*code); - uint64_t res = - reinterpret_cast<uint64_t> - (CALL_GENERATED_CODE(isolate, f, 0, 0, 0, 0, 0)); + uint64_t res = reinterpret_cast<uint64_t>(f.Call(0, 0, 0, 0, 0)); return res; } @@ -5006,11 +4983,9 @@ uint64_t run_dati(uint64_t rs, uint16_t offset) { Handle<Code> code = isolate->factory()->NewCode(desc, Code::STUB, Handle<Code>()); - F2 f = FUNCTION_CAST<F2>(code->entry()); + auto f = GeneratedCode<F2>::FromCode(*code); - uint64_t res = - reinterpret_cast<uint64_t> - (CALL_GENERATED_CODE(isolate, f, 0, 0, 0, 0, 0)); + uint64_t res = reinterpret_cast<uint64_t>(f.Call(0, 0, 0, 0, 0)); return res; } @@ -5028,13 +5003,13 @@ TEST(r6_aui_family) { // AUI test cases. struct TestCaseAui aui_tc[] = { - {0xfffeffff, 0x1, 0xffffffffffffffff}, - {0xffffffff, 0x0, 0xffffffffffffffff}, - {0, 0xffff, 0xffffffffffff0000}, - {0x0008ffff, 0xfff7, 0xffffffffffffffff}, - {32767, 32767, 0x000000007fff7fff}, - {0x00000000ffffffff, 0x1, 0x000000000000ffff}, - {0xffffffff, 0xffff, 0xfffffffffffeffff}, + {0xFFFEFFFF, 0x1, 0xFFFFFFFFFFFFFFFF}, + {0xFFFFFFFF, 0x0, 0xFFFFFFFFFFFFFFFF}, + {0, 0xFFFF, 0xFFFFFFFFFFFF0000}, + {0x0008FFFF, 0xFFF7, 0xFFFFFFFFFFFFFFFF}, + {32767, 32767, 0x000000007FFF7FFF}, + {0x00000000FFFFFFFF, 0x1, 0x000000000000FFFF}, + {0xFFFFFFFF, 0xFFFF, 0xFFFFFFFFFFFEFFFF}, }; size_t nr_test_cases = sizeof(aui_tc) / sizeof(TestCaseAui); @@ -5045,13 +5020,13 @@ TEST(r6_aui_family) { // DAUI test cases. struct TestCaseAui daui_tc[] = { - {0xfffffffffffeffff, 0x1, 0xffffffffffffffff}, - {0xffffffffffffffff, 0x0, 0xffffffffffffffff}, - {0, 0xffff, 0xffffffffffff0000}, - {0x0008ffff, 0xfff7, 0xffffffffffffffff}, - {32767, 32767, 0x000000007fff7fff}, - {0x00000000ffffffff, 0x1, 0x000000010000ffff}, - {0xffffffff, 0xffff, 0x00000000fffeffff}, + {0xFFFFFFFFFFFEFFFF, 0x1, 0xFFFFFFFFFFFFFFFF}, + {0xFFFFFFFFFFFFFFFF, 0x0, 0xFFFFFFFFFFFFFFFF}, + {0, 0xFFFF, 0xFFFFFFFFFFFF0000}, + {0x0008FFFF, 0xFFF7, 0xFFFFFFFFFFFFFFFF}, + {32767, 32767, 0x000000007FFF7FFF}, + {0x00000000FFFFFFFF, 0x1, 0x000000010000FFFF}, + {0xFFFFFFFF, 0xFFFF, 0x00000000FFFEFFFF}, }; nr_test_cases = sizeof(daui_tc) / sizeof(TestCaseAui); @@ -5062,13 +5037,13 @@ TEST(r6_aui_family) { // DATI test cases. struct TestCaseAui dati_tc[] = { - {0xfffffffffffeffff, 0x1, 0x0000fffffffeffff}, - {0xffffffffffffffff, 0x0, 0xffffffffffffffff}, - {0, 0xffff, 0xffff000000000000}, - {0x0008ffff, 0xfff7, 0xfff700000008ffff}, - {32767, 32767, 0x7fff000000007fff}, - {0x00000000ffffffff, 0x1, 0x00010000ffffffff}, - {0xffffffffffff, 0xffff, 0xffffffffffffffff}, + {0xFFFFFFFFFFFEFFFF, 0x1, 0x0000FFFFFFFEFFFF}, + {0xFFFFFFFFFFFFFFFF, 0x0, 0xFFFFFFFFFFFFFFFF}, + {0, 0xFFFF, 0xFFFF000000000000}, + {0x0008FFFF, 0xFFF7, 0xFFF700000008FFFF}, + {32767, 32767, 0x7FFF000000007FFF}, + {0x00000000FFFFFFFF, 0x1, 0x00010000FFFFFFFF}, + {0xFFFFFFFFFFFF, 0xFFFF, 0xFFFFFFFFFFFFFFFF}, }; nr_test_cases = sizeof(dati_tc) / sizeof(TestCaseAui); @@ -5079,9 +5054,9 @@ TEST(r6_aui_family) { // DAHI test cases. struct TestCaseAui dahi_tc[] = { - {0xfffffffeffffffff, 0x1, 0xffffffffffffffff}, - {0xffffffffffffffff, 0x0, 0xffffffffffffffff}, - {0, 0xffff, 0xffffffff00000000}, + {0xFFFFFFFEFFFFFFFF, 0x1, 0xFFFFFFFFFFFFFFFF}, + {0xFFFFFFFFFFFFFFFF, 0x0, 0xFFFFFFFFFFFFFFFF}, + {0, 0xFFFF, 0xFFFFFFFF00000000}, }; nr_test_cases = sizeof(dahi_tc) / sizeof(TestCaseAui); @@ -5114,10 +5089,9 @@ uint64_t run_li_macro(uint64_t imm, LiFlags mode, int32_t num_instr = 0) { #ifdef OBJECT_PRINT code->Print(std::cout); #endif - F2 f = FUNCTION_CAST<F2>(code->entry()); + auto f = GeneratedCode<F2>::FromCode(*code); - uint64_t res = reinterpret_cast<uint64_t>( - CALL_GENERATED_CODE(isolate, f, 0, 0, 0, 0, 0)); + uint64_t res = reinterpret_cast<uint64_t>(f.Call(0, 0, 0, 0, 0)); return res; } @@ -5137,13 +5111,13 @@ TEST(li_macro) { // We call li(v0, imm) to test cases listed below. struct TestCase_li tc[] = { // imm, r2_num_instr, r6_num_instr - {0xffffffffffff8000, 1, 1}, // min_int16 + {0xFFFFFFFFFFFF8000, 1, 1}, // min_int16 // The test case above generates daddiu instruction. // This is int16 value and we can load it using just daddiu. {0x8000, 1, 1}, // max_int16 + 1 // Generates ori // max_int16 + 1 is not int16 but is uint16, just use ori. - {0xffffffffffff7fff, 2, 2}, // min_int16 - 1 + {0xFFFFFFFFFFFF7FFF, 2, 2}, // min_int16 - 1 // Generates lui + ori // We load int32 value using lui + ori. {0x8001, 1, 1}, // max_int16 + 2 @@ -5155,115 +5129,115 @@ TEST(li_macro) { {0x00010001, 2, 2}, // max_uint16 + 2 // Generates lui + ori // We have to generate two instructions in this case. - {0x00000000ffffffff, 2, 2}, // max_uint32 + {0x00000000FFFFFFFF, 2, 2}, // max_uint32 // r2 - daddiu + dsrl32 // r6 - daddiu + dahi - {0x00000000fffffffe, 3, 2}, // max_uint32 - 1 + {0x00000000FFFFFFFE, 3, 2}, // max_uint32 - 1 // r2 - lui + ori + dsll // r6 - daddiu + dahi - {0x00ffff000000fffe, 3, 3}, + {0x00FFFF000000FFFE, 3, 3}, // ori + dsll32 + ori - {0x00000001fffffffe, 4, 2}, // max_uint32 << 1 + {0x00000001FFFFFFFE, 4, 2}, // max_uint32 << 1 // r2 - lui + ori + dsll + ori // r6 - daddiu + dahi - {0x0000fffffffffffe, 4, 2}, // max_uint48 - 1 + {0x0000FFFFFFFFFFFE, 4, 2}, // max_uint48 - 1 // r2 - daddiu + dsll32 + ori + dsubu // Loading imm directly would require ori + dsll + ori + dsll + ori. // Optimized by loading -imm and using dsubu to get imm. // r6 - daddiu + dati - {0xffffffff00000000, 2, 2}, // max_uint32 << 32 + {0xFFFFFFFF00000000, 2, 2}, // max_uint32 << 32 // r2 - daddiu + dsll32 // r6 - ori + dahi // We need ori to clear register before loading value using dahi. - {0xffffffff80000000, 1, 1}, // min_int32 + {0xFFFFFFFF80000000, 1, 1}, // min_int32 // The test case above generates lui instruction. {0x0000000080000000, 2, 2}, // max_int32 + 1 // r2 - ori + dsll // r6 - lui + dahi {0x0000800000000000, 2, 2}, // ori + dsll32 - {0xffff800000000000, 2, 2}, + {0xFFFF800000000000, 2, 2}, // r2 - daddiu + dsll32 // r6 - ori + dahi - {0xffff80000000ffff, 3, 2}, + {0xFFFF80000000FFFF, 3, 2}, // r2 - daddiu + dsll32 + ori // r6 - ori + dahi - {0xffffff123000ffff, 3, 3}, + {0xFFFFFF123000FFFF, 3, 3}, // daddiu + dsll + ori - {0xffff00000000ffff, 3, 2}, + {0xFFFF00000000FFFF, 3, 2}, // r2 - daddiu + dsll32 + ori // r6 - ori + dati - {0xffff8000ffff0000, 3, 2}, + {0xFFFF8000FFFF0000, 3, 2}, // r2 - lui + ori + dsll // r6 - lui + dahi - {0x0000ffffffff0000, 4, 2}, + {0x0000FFFFFFFF0000, 4, 2}, // r2 - ori + dsll + ori + dsll // r6 - lui + dati - {0x1234ffff80000000, 3, 2}, + {0x1234FFFF80000000, 3, 2}, // r2 - lui + ori + dsll // r6 - lui + dati - {0x1234ffff80010000, 5, 2}, + {0x1234FFFF80010000, 5, 2}, // r2 - lui + ori + dsll + ori + dsll // r6 - lui + dati - {0xffff8000ffff8000, 2, 2}, + {0xFFFF8000FFFF8000, 2, 2}, // r2 - daddiu + dinsu // r6 - daddiu + dahi - {0xffff0000ffff8000, 4, 3}, + {0xFFFF0000FFFF8000, 4, 3}, // r2 - ori + dsll32 + ori + dsubu // Loading imm directly would require lui + dsll + ori + dsll + ori. // Optimized by loading -imm and using dsubu to get imm. // r6 - daddiu + dahi + dati {0x8000000080000000, 2, 2}, // lui + dinsu - {0xabcd0000abcd0000, 2, 2}, + {0xABCD0000ABCD0000, 2, 2}, // lui + dinsu {0x8000800080008000, 3, 3}, // lui + ori + dinsu - {0xabcd1234abcd1234, 3, 3}, + {0xABCD1234ABCD1234, 3, 3}, // The test case above generates lui + ori + dinsu instruction sequence. - {0xffff800080008000, 4, 3}, + {0xFFFF800080008000, 4, 3}, // r2 - lui + ori + dsll + ori // r6 - lui + ori + dahi - {0xffffabcd, 3, 2}, + {0xFFFFABCD, 3, 2}, // r2 - ori + dsll + ori // r6 - daddiu + dahi - {0x1ffffabcd, 4, 2}, + {0x1FFFFABCD, 4, 2}, // r2 - lui + ori + dsll + ori // r6 - daddiu + dahi - {0xffffffffabcd, 4, 2}, + {0xFFFFFFFFABCD, 4, 2}, // r2 - daddiu + dsll32 + ori + dsubu // Loading imm directly would require ori + dsll + ori + dsll + ori. // Optimized by loading -imm and using dsubu to get imm. // r6 - daddiu + dati - {0x1ffffffffabcd, 4, 2}, + {0x1FFFFFFFFABCD, 4, 2}, // r2 - daddiu + dsll32 + ori + dsubu // Loading imm directly would require lui + ori + dsll + ori + dsll + ori. // Optimized by loading -imm and using dsubu to get imm. // r6 - daddiu + dati - {0xffff7fff80010000, 5, 2}, + {0xFFFF7FFF80010000, 5, 2}, // r2 - lui + ori + dsll + ori + dsll // r6 - lui + dahi // Here lui sets high 32 bits to 1 so dahi can be used to get target // value. - {0x00007fff7fff0000, 3, 2}, + {0x00007FFF7FFF0000, 3, 2}, // r2 - lui + ori + dsll // r6 - lui + dahi // High 32 bits are not set so dahi can be used to get target value. - {0xffff7fff7fff0000, 5, 3}, + {0xFFFF7FFF7FFF0000, 5, 3}, // r2 - lui + ori + dsll + ori + dsll // r6 - lui + dahi + dati // High 32 bits are not set so just dahi can't be used to get target // value. - {0x00007fff80010000, 3, 3}, + {0x00007FFF80010000, 3, 3}, // r2 - lui + ori + dsll // r6 - lui + ori + dsll // High 32 bits are set so can't just use lui + dahi to get target value. - {0x1234abcd87654321, 6, 4}, + {0x1234ABCD87654321, 6, 4}, // The test case above generates: // r2 - lui + ori + dsll + ori + dsll + ori instruction sequence, // r6 - lui + ori + dahi + dati. // Load using full instruction sequence. - {0xffff0000ffffffff, 3, 3}, + {0xFFFF0000FFFFFFFF, 3, 3}, // r2 - ori + dsll32 + nor // Loading imm directly would require lui + dsll + ori + dsll + ori. // Optimized by loading ~imm and using nor to get imm. Loading -imm would @@ -5296,24 +5270,24 @@ uint64_t run_lwpc(int offset) { v8::internal::CodeObjectRequired::kYes); // 256k instructions; 2^8k - // addiu t3, a4, 0xffff; (0x250fffff) + // addiu t3, a4, 0xFFFF; (0x250FFFFF) // ... - // addiu t0, a4, 0x0000; (0x250c0000) + // addiu t0, a4, 0x0000; (0x250C0000) uint32_t addiu_start_1 = 0x25000000; - for (int32_t i = 0xfffff; i >= 0xc0000; --i) { + for (int32_t i = 0xFFFFF; i >= 0xC0000; --i) { uint32_t addiu_new = addiu_start_1 + i; __ dd(addiu_new); } - __ lwpc(t8, offset); // offset 0; 0xef080000 (t8 register) + __ lwpc(t8, offset); // offset 0; 0xEF080000 (t8 register) __ mov(v0, t8); // 256k instructions; 2^8k // addiu a4, a4, 0x0000; (0x25080000) // ... - // addiu a7, a4, 0xffff; (0x250bffff) + // addiu a7, a4, 0xFFFF; (0x250BFFFF) uint32_t addiu_start_2 = 0x25000000; - for (int32_t i = 0x80000; i <= 0xbffff; ++i) { + for (int32_t i = 0x80000; i <= 0xBFFFF; ++i) { uint32_t addiu_new = addiu_start_2 + i; __ dd(addiu_new); } @@ -5326,10 +5300,9 @@ uint64_t run_lwpc(int offset) { Handle<Code> code = isolate->factory()->NewCode(desc, Code::STUB, Handle<Code>()); - F2 f = FUNCTION_CAST<F2>(code->entry()); + auto f = GeneratedCode<F2>::FromCode(*code); - uint64_t res = reinterpret_cast<uint64_t>( - CALL_GENERATED_CODE(isolate, f, 0, 0, 0, 0, 0)); + uint64_t res = reinterpret_cast<uint64_t>(f.Call(0, 0, 0, 0, 0)); return res; } @@ -5344,17 +5317,19 @@ TEST(r6_lwpc) { uint64_t expected_res; }; + // clang-format off struct TestCaseLwpc tc[] = { // offset, expected_res - { -262144, 0x250fffff }, // offset 0x40000 - { -4, 0x250c0003 }, - { -1, 0x250c0000 }, - { 0, 0xffffffffef080000 }, + { -262144, 0x250FFFFF }, // offset 0x40000 + { -4, 0x250C0003 }, + { -1, 0x250C0000 }, + { 0, 0xFFFFFFFFEF080000 }, { 1, 0x03001025 }, // mov(v0, t8) { 2, 0x25080000 }, { 4, 0x25080002 }, - { 262143, 0x250bfffd }, // offset 0x3ffff + { 262143, 0x250BFFFD }, // offset 0x3FFFF }; + // clang-format on size_t nr_test_cases = sizeof(tc) / sizeof(TestCaseLwpc); for (size_t i = 0; i < nr_test_cases; ++i) { @@ -5373,24 +5348,24 @@ uint64_t run_lwupc(int offset) { v8::internal::CodeObjectRequired::kYes); // 256k instructions; 2^8k - // addiu t3, a4, 0xffff; (0x250fffff) + // addiu t3, a4, 0xFFFF; (0x250FFFFF) // ... - // addiu t0, a4, 0x0000; (0x250c0000) + // addiu t0, a4, 0x0000; (0x250C0000) uint32_t addiu_start_1 = 0x25000000; - for (int32_t i = 0xfffff; i >= 0xc0000; --i) { + for (int32_t i = 0xFFFFF; i >= 0xC0000; --i) { uint32_t addiu_new = addiu_start_1 + i; __ dd(addiu_new); } - __ lwupc(t8, offset); // offset 0; 0xef080000 (t8 register) + __ lwupc(t8, offset); // offset 0; 0xEF080000 (t8 register) __ mov(v0, t8); // 256k instructions; 2^8k // addiu a4, a4, 0x0000; (0x25080000) // ... - // addiu a7, a4, 0xffff; (0x250bffff) + // addiu a7, a4, 0xFFFF; (0x250BFFFF) uint32_t addiu_start_2 = 0x25000000; - for (int32_t i = 0x80000; i <= 0xbffff; ++i) { + for (int32_t i = 0x80000; i <= 0xBFFFF; ++i) { uint32_t addiu_new = addiu_start_2 + i; __ dd(addiu_new); } @@ -5403,10 +5378,9 @@ uint64_t run_lwupc(int offset) { Handle<Code> code = isolate->factory()->NewCode(desc, Code::STUB, Handle<Code>()); - F2 f = FUNCTION_CAST<F2>(code->entry()); + auto f = GeneratedCode<F2>::FromCode(*code); - uint64_t res = reinterpret_cast<uint64_t>( - CALL_GENERATED_CODE(isolate, f, 0, 0, 0, 0, 0)); + uint64_t res = reinterpret_cast<uint64_t>(f.Call(0, 0, 0, 0, 0)); return res; } @@ -5421,17 +5395,19 @@ TEST(r6_lwupc) { uint64_t expected_res; }; + // clang-format off struct TestCaseLwupc tc[] = { // offset, expected_res - { -262144, 0x250fffff }, // offset 0x40000 - { -4, 0x250c0003 }, - { -1, 0x250c0000 }, - { 0, 0xef100000 }, + { -262144, 0x250FFFFF }, // offset 0x40000 + { -4, 0x250C0003 }, + { -1, 0x250C0000 }, + { 0, 0xEF100000 }, { 1, 0x03001025 }, // mov(v0, t8) { 2, 0x25080000 }, { 4, 0x25080002 }, - { 262143, 0x250bfffd }, // offset 0x3ffff + { 262143, 0x250BFFFD }, // offset 0x3FFFF }; + // clang-format on size_t nr_test_cases = sizeof(tc) / sizeof(TestCaseLwupc); for (size_t i = 0; i < nr_test_cases; ++i) { @@ -5488,10 +5464,9 @@ uint64_t run_jic(int16_t offset) { Handle<Code> code = isolate->factory()->NewCode(desc, Code::STUB, Handle<Code>()); - F2 f = FUNCTION_CAST<F2>(code->entry()); + auto f = GeneratedCode<F2>::FromCode(*code); - uint64_t res = reinterpret_cast<uint64_t>( - CALL_GENERATED_CODE(isolate, f, 0, 0, 0, 0, 0)); + uint64_t res = reinterpret_cast<uint64_t>(f.Call(0, 0, 0, 0, 0)); return res; } @@ -5561,10 +5536,9 @@ uint64_t run_beqzc(int32_t value, int32_t offset) { Handle<Code> code = isolate->factory()->NewCode(desc, Code::STUB, Handle<Code>()); - F2 f = FUNCTION_CAST<F2>(code->entry()); + auto f = GeneratedCode<F2>::FromCode(*code); - uint64_t res = reinterpret_cast<uint64_t>( - CALL_GENERATED_CODE(isolate, f, value, 0, 0, 0, 0)); + uint64_t res = reinterpret_cast<uint64_t>(f.Call(value, 0, 0, 0, 0)); return res; } @@ -5580,14 +5554,16 @@ TEST(r6_beqzc) { uint32_t expected_res; }; + // clang-format off struct TestCaseBeqzc tc[] = { // value, offset, expected_res { 0x0, -8, 0x66 }, { 0x0, 0, 0x3334 }, { 0x0, 1, 0x3333 }, - { 0xabc, 1, 0x3334 }, + { 0xABC, 1, 0x3334 }, { 0x0, 4, 0x2033 }, }; + // clang-format on size_t nr_test_cases = sizeof(tc) / sizeof(TestCaseBeqzc); for (size_t i = 0; i < nr_test_cases; ++i) { @@ -5599,12 +5575,12 @@ TEST(r6_beqzc) { void load_elements_of_vector(MacroAssembler& assm, const uint64_t elements[], MSARegister w, Register t0, Register t1) { - __ li(t0, static_cast<uint32_t>(elements[0] & 0xffffffff)); - __ li(t1, static_cast<uint32_t>((elements[0] >> 32) & 0xffffffff)); + __ li(t0, static_cast<uint32_t>(elements[0] & 0xFFFFFFFF)); + __ li(t1, static_cast<uint32_t>((elements[0] >> 32) & 0xFFFFFFFF)); __ insert_w(w, 0, t0); __ insert_w(w, 1, t1); - __ li(t0, static_cast<uint32_t>(elements[1] & 0xffffffff)); - __ li(t1, static_cast<uint32_t>((elements[1] >> 32) & 0xffffffff)); + __ li(t0, static_cast<uint32_t>(elements[1] & 0xFFFFFFFF)); + __ li(t1, static_cast<uint32_t>((elements[1] >> 32) & 0xFFFFFFFF)); __ insert_w(w, 2, t0); __ insert_w(w, 3, t1); } @@ -5641,7 +5617,7 @@ void run_bz_bnz(TestCaseMsaBranch* input, Branch GenerateBranch, uint64_t wd_lo; uint64_t wd_hi; } T; - T t = {0x20b9cc4f1a83e0c5, 0xa27e1b5f2f5bb18a, 0x0000000000000000, + T t = {0x20B9CC4F1A83E0C5, 0xA27E1B5F2F5BB18A, 0x0000000000000000, 0x0000000000000000}; msa_reg_t res; Label do_not_move_w0_to_w2; @@ -5665,9 +5641,9 @@ void run_bz_bnz(TestCaseMsaBranch* input, Branch GenerateBranch, #ifdef OBJECT_PRINT code->Print(std::cout); #endif - F3 f = FUNCTION_CAST<F3>(code->entry()); + auto f = GeneratedCode<F3>::FromCode(*code); - (CALL_GENERATED_CODE(isolate, f, &res, 0, 0, 0, 0)); + f.Call(&res, 0, 0, 0, 0); if (branched) { CHECK_EQ(t.wd_lo, res.d[0]); CHECK_EQ(t.wd_hi, res.d[1]); @@ -5682,7 +5658,7 @@ TEST(MSA_bz_bnz) { return; TestCaseMsaBranch tz_v[] = { - {0x0, 0x0}, {0xabc, 0x0}, {0x0, 0xabc}, {0xabc, 0xabc}}; + {0x0, 0x0}, {0xABC, 0x0}, {0x0, 0xABC}, {0xABC, 0xABC}}; for (unsigned i = 0; i < arraysize(tz_v); ++i) { run_bz_bnz( &tz_v[i], @@ -5706,32 +5682,32 @@ TEST(MSA_bz_bnz) { j != lanes); \ } TestCaseMsaBranch tz_b[] = {{0x0, 0x0}, - {0xbc0000, 0x0}, - {0x0, 0xab000000000000cd}, - {0x123456789abcdef0, 0xaaaaaaaaaaaaaaaa}}; + {0xBC0000, 0x0}, + {0x0, 0xAB000000000000CD}, + {0x123456789ABCDEF0, 0xAAAAAAAAAAAAAAAA}}; TEST_BZ_DF(tz_b, kMSALanesByte, bz_b, int8_t) TestCaseMsaBranch tz_h[] = {{0x0, 0x0}, - {0xbcde0000, 0x0}, - {0x0, 0xabcd00000000abcd}, - {0x123456789abcdef0, 0xaaaaaaaaaaaaaaaa}}; + {0xBCDE0000, 0x0}, + {0x0, 0xABCD00000000ABCD}, + {0x123456789ABCDEF0, 0xAAAAAAAAAAAAAAAA}}; TEST_BZ_DF(tz_h, kMSALanesHalf, bz_h, int16_t) TestCaseMsaBranch tz_w[] = {{0x0, 0x0}, - {0xbcde123400000000, 0x0}, - {0x0, 0x000000001234abcd}, - {0x123456789abcdef0, 0xaaaaaaaaaaaaaaaa}}; + {0xBCDE123400000000, 0x0}, + {0x0, 0x000000001234ABCD}, + {0x123456789ABCDEF0, 0xAAAAAAAAAAAAAAAA}}; TEST_BZ_DF(tz_w, kMSALanesWord, bz_w, int32_t) TestCaseMsaBranch tz_d[] = {{0x0, 0x0}, - {0xbcde0000, 0x0}, - {0x0, 0xabcd00000000abcd}, - {0x123456789abcdef0, 0xaaaaaaaaaaaaaaaa}}; + {0xBCDE0000, 0x0}, + {0x0, 0xABCD00000000ABCD}, + {0x123456789ABCDEF0, 0xAAAAAAAAAAAAAAAA}}; TEST_BZ_DF(tz_d, kMSALanesDword, bz_d, int64_t) #undef TEST_BZ_DF TestCaseMsaBranch tnz_v[] = { - {0x0, 0x0}, {0xabc, 0x0}, {0x0, 0xabc}, {0xabc, 0xabc}}; + {0x0, 0x0}, {0xABC, 0x0}, {0x0, 0xABC}, {0xABC, 0xABC}}; for (unsigned i = 0; i < arraysize(tnz_v); ++i) { run_bz_bnz(&tnz_v[i], [](MacroAssembler& assm, Label& br_target) { @@ -5756,27 +5732,27 @@ TEST(MSA_bz_bnz) { j == lanes); \ } TestCaseMsaBranch tnz_b[] = {{0x0, 0x0}, - {0xbc0000, 0x0}, - {0x0, 0xab000000000000cd}, - {0x123456789abcdef0, 0xaaaaaaaaaaaaaaaa}}; + {0xBC0000, 0x0}, + {0x0, 0xAB000000000000CD}, + {0x123456789ABCDEF0, 0xAAAAAAAAAAAAAAAA}}; TEST_BNZ_DF(tnz_b, 16, bnz_b, int8_t) TestCaseMsaBranch tnz_h[] = {{0x0, 0x0}, - {0xbcde0000, 0x0}, - {0x0, 0xabcd00000000abcd}, - {0x123456789abcdef0, 0xaaaaaaaaaaaaaaaa}}; + {0xBCDE0000, 0x0}, + {0x0, 0xABCD00000000ABCD}, + {0x123456789ABCDEF0, 0xAAAAAAAAAAAAAAAA}}; TEST_BNZ_DF(tnz_h, 8, bnz_h, int16_t) TestCaseMsaBranch tnz_w[] = {{0x0, 0x0}, - {0xbcde123400000000, 0x0}, - {0x0, 0x000000001234abcd}, - {0x123456789abcdef0, 0xaaaaaaaaaaaaaaaa}}; + {0xBCDE123400000000, 0x0}, + {0x0, 0x000000001234ABCD}, + {0x123456789ABCDEF0, 0xAAAAAAAAAAAAAAAA}}; TEST_BNZ_DF(tnz_w, 4, bnz_w, int32_t) TestCaseMsaBranch tnz_d[] = {{0x0, 0x0}, - {0xbcde0000, 0x0}, - {0x0, 0xabcd00000000abcd}, - {0x123456789abcdef0, 0xaaaaaaaaaaaaaaaa}}; + {0xBCDE0000, 0x0}, + {0x0, 0xABCD00000000ABCD}, + {0x123456789ABCDEF0, 0xAAAAAAAAAAAAAAAA}}; TEST_BNZ_DF(tnz_d, 2, bnz_d, int64_t) #undef TEST_BNZ_DF } @@ -5839,10 +5815,9 @@ uint64_t run_jialc(int16_t offset) { Handle<Code> code = isolate->factory()->NewCode(desc, Code::STUB, Handle<Code>()); - F2 f = FUNCTION_CAST<F2>(code->entry()); + auto f = GeneratedCode<F2>::FromCode(*code); - uint64_t res = reinterpret_cast<uint64_t>( - CALL_GENERATED_CODE(isolate, f, 0, 0, 0, 0, 0)); + uint64_t res = reinterpret_cast<uint64_t>(f.Call(0, 0, 0, 0, 0)); return res; } @@ -5892,11 +5867,10 @@ uint64_t run_addiupc(int32_t imm19) { Handle<Code> code = isolate->factory()->NewCode(desc, Code::STUB, Handle<Code>()); - F2 f = FUNCTION_CAST<F2>(code->entry()); - PC = (uint64_t) f; // Set the program counter. + auto f = GeneratedCode<F2>::FromCode(*code); + PC = (uint64_t)code->entry(); // Set the program counter. - uint64_t res = reinterpret_cast<uint64_t>( - CALL_GENERATED_CODE(isolate, f, 0, 0, 0, 0, 0)); + uint64_t res = reinterpret_cast<uint64_t>(f.Call(0, 0, 0, 0, 0)); return res; } @@ -5939,24 +5913,24 @@ uint64_t run_ldpc(int offset) { v8::internal::CodeObjectRequired::kYes); // 256k instructions; 2 * 2^7k = 2^8k - // addiu t3, a4, 0xffff; (0x250fffff) + // addiu t3, a4, 0xFFFF; (0x250FFFFF) // ... - // addiu t0, a4, 0x0000; (0x250c0000) + // addiu t0, a4, 0x0000; (0x250C0000) uint32_t addiu_start_1 = 0x25000000; - for (int32_t i = 0xfffff; i >= 0xc0000; --i) { + for (int32_t i = 0xFFFFF; i >= 0xC0000; --i) { uint32_t addiu_new = addiu_start_1 + i; __ dd(addiu_new); } - __ ldpc(t8, offset); // offset 0; 0xef080000 (t8 register) + __ ldpc(t8, offset); // offset 0; 0xEF080000 (t8 register) __ mov(v0, t8); // 256k instructions; 2 * 2^7k = 2^8k // addiu a4, a4, 0x0000; (0x25080000) // ... - // addiu a7, a4, 0xffff; (0x250bffff) + // addiu a7, a4, 0xFFFF; (0x250BFFFF) uint32_t addiu_start_2 = 0x25000000; - for (int32_t i = 0x80000; i <= 0xbffff; ++i) { + for (int32_t i = 0x80000; i <= 0xBFFFF; ++i) { uint32_t addiu_new = addiu_start_2 + i; __ dd(addiu_new); } @@ -5969,10 +5943,9 @@ uint64_t run_ldpc(int offset) { Handle<Code> code = isolate->factory()->NewCode(desc, Code::STUB, Handle<Code>()); - F2 f = FUNCTION_CAST<F2>(code->entry()); + auto f = GeneratedCode<F2>::FromCode(*code); - uint64_t res = reinterpret_cast<uint64_t>( - CALL_GENERATED_CODE(isolate, f, 0, 0, 0, 0, 0)); + uint64_t res = reinterpret_cast<uint64_t>(f.Call(0, 0, 0, 0, 0)); return res; } @@ -5996,13 +5969,13 @@ TEST(r6_ldpc) { TestCaseLdpc tc[] = { // offset, expected_res - {-131072, doubleword(0x250ffffe, 0x250fffff)}, - {-4, doubleword(0x250c0006, 0x250c0007)}, - {-1, doubleword(0x250c0000, 0x250c0001)}, - {0, doubleword(0x03001025, 0xef180000)}, + {-131072, doubleword(0x250FFFFE, 0x250FFFFF)}, + {-4, doubleword(0x250C0006, 0x250C0007)}, + {-1, doubleword(0x250C0000, 0x250C0001)}, + {0, doubleword(0x03001025, 0xEF180000)}, {1, doubleword(0x25080001, 0x25080000)}, {4, doubleword(0x25080007, 0x25080006)}, - {131071, doubleword(0x250bfffd, 0x250bfffc)}, + {131071, doubleword(0x250BFFFD, 0x250BFFFC)}, }; size_t nr_test_cases = sizeof(tc) / sizeof(TestCaseLdpc); @@ -6059,10 +6032,9 @@ int64_t run_bc(int32_t offset) { Handle<Code> code = isolate->factory()->NewCode(desc, Code::STUB, Handle<Code>()); - F2 f = FUNCTION_CAST<F2>(code->entry()); + auto f = GeneratedCode<F2>::FromCode(*code); - int64_t res = reinterpret_cast<int64_t>( - CALL_GENERATED_CODE(isolate, f, 0, 0, 0, 0, 0)); + int64_t res = reinterpret_cast<int64_t>(f.Call(0, 0, 0, 0, 0)); return res; } @@ -6142,10 +6114,9 @@ int64_t run_balc(int32_t offset) { Handle<Code> code = isolate->factory()->NewCode(desc, Code::STUB, Handle<Code>()); - F2 f = FUNCTION_CAST<F2>(code->entry()); + auto f = GeneratedCode<F2>::FromCode(*code); - int64_t res = reinterpret_cast<int64_t>( - CALL_GENERATED_CODE(isolate, f, 0, 0, 0, 0, 0)); + int64_t res = reinterpret_cast<int64_t>(f.Call(0, 0, 0, 0, 0)); return res; } @@ -6193,10 +6164,9 @@ uint64_t run_dsll(uint64_t rt_value, uint16_t sa_value) { Handle<Code> code = isolate->factory()->NewCode(desc, Code::STUB, Handle<Code>()); - F4 f = FUNCTION_CAST<F4>(code->entry()); + auto f = GeneratedCode<F4>::FromCode(*code); - uint64_t res = reinterpret_cast<uint64_t>( - CALL_GENERATED_CODE(isolate, f, rt_value, 0, 0, 0, 0)); + uint64_t res = reinterpret_cast<uint64_t>(f.Call(rt_value, 0, 0, 0, 0)); return res; } @@ -6211,12 +6181,14 @@ TEST(dsll) { uint64_t expected_res; }; + // clang-format off struct TestCaseDsll tc[] = { // rt_value, sa_value, expected_res - { 0xffffffffffffffff, 0, 0xffffffffffffffff }, - { 0xffffffffffffffff, 16, 0xffffffffffff0000 }, - { 0xffffffffffffffff, 31, 0xffffffff80000000 }, + { 0xFFFFFFFFFFFFFFFF, 0, 0xFFFFFFFFFFFFFFFF }, + { 0xFFFFFFFFFFFFFFFF, 16, 0xFFFFFFFFFFFF0000 }, + { 0xFFFFFFFFFFFFFFFF, 31, 0xFFFFFFFF80000000 }, }; + // clang-format on size_t nr_test_cases = sizeof(tc) / sizeof(TestCaseDsll); for (size_t i = 0; i < nr_test_cases; ++i) { @@ -6250,10 +6222,9 @@ uint64_t run_bal(int16_t offset) { Handle<Code> code = isolate->factory()->NewCode(desc, Code::STUB, Handle<Code>()); - F2 f = FUNCTION_CAST<F2>(code->entry()); + auto f = GeneratedCode<F2>::FromCode(*code); - uint64_t res = reinterpret_cast<uint64_t>( - CALL_GENERATED_CODE(isolate, f, 0, 0, 0, 0, 0)); + uint64_t res = reinterpret_cast<uint64_t>(f.Call(0, 0, 0, 0, 0)); return res; } @@ -6267,10 +6238,12 @@ TEST(bal) { uint64_t expected_res; }; + // clang-format off struct TestCaseBal tc[] = { // offset, expected_res - { 4, 1 }, + { 4, 1 }, }; + // clang-format on size_t nr_test_cases = sizeof(tc) / sizeof(TestCaseBal); for (size_t i = 0; i < nr_test_cases; ++i) { @@ -6303,10 +6276,9 @@ TEST(Trampoline) { assm.GetCode(isolate, &desc); Handle<Code> code = isolate->factory()->NewCode(desc, Code::STUB, Handle<Code>()); - F2 f = FUNCTION_CAST<F2>(code->entry()); + auto f = GeneratedCode<F2>::FromCode(*code); - int64_t res = reinterpret_cast<int64_t>( - CALL_GENERATED_CODE(isolate, f, 42, 42, 0, 0, 0)); + int64_t res = reinterpret_cast<int64_t>(f.Call(42, 42, 0, 0, 0)); CHECK_EQ(0, res); } @@ -6371,7 +6343,7 @@ void helper_madd_msub_maddf_msubf(F func) { assm.GetCode(isolate, &desc); Handle<Code> code = isolate->factory()->NewCode(desc, Code::STUB, Handle<Code>()); - F3 f = FUNCTION_CAST<F3>(code->entry()); + auto f = GeneratedCode<F3>::FromCode(*code); const size_t kTableLength = sizeof(test_cases) / sizeof(TestCaseMaddMsub<T>); TestCaseMaddMsub<T> tc; @@ -6380,7 +6352,7 @@ void helper_madd_msub_maddf_msubf(F func) { tc.fs = test_cases[i].fs; tc.ft = test_cases[i].ft; - (CALL_GENERATED_CODE(isolate, f, &tc, 0, 0, 0, 0)); + f.Call(&tc, 0, 0, 0, 0); T res_sub; T res_add; @@ -6458,10 +6430,9 @@ uint64_t run_Subu(uint64_t imm, int32_t num_instr) { #ifdef OBJECT_PRINT code->Print(std::cout); #endif - F2 f = FUNCTION_CAST<F2>(code->entry()); + auto f = GeneratedCode<F2>::FromCode(*code); - uint64_t res = reinterpret_cast<uint64_t>( - CALL_GENERATED_CODE(isolate, f, 0, 0, 0, 0, 0)); + uint64_t res = reinterpret_cast<uint64_t>(f.Call(0, 0, 0, 0, 0)); return res; } @@ -6480,39 +6451,41 @@ TEST(Subu) { // We call Subu(v0, zero_reg, imm) to test cases listed below. // 0 - imm = expected_res + // clang-format off struct TestCaseSubu tc[] = { - // imm, expected_res, num_instr - {0xffffffffffff8000, 0x8000, 2}, // min_int16 + // imm, expected_res, num_instr + {0xFFFFFFFFFFFF8000, 0x8000, 2}, // min_int16 // The test case above generates ori + addu instruction sequence. // We can't have just addiu because -min_int16 > max_int16 so use // register. We can load min_int16 to at register with addiu and then // subtract at with subu, but now we use ori + addu because -min_int16 can // be loaded using ori. - {0x8000, 0xffffffffffff8000, 1}, // max_int16 + 1 + {0x8000, 0xFFFFFFFFFFFF8000, 1}, // max_int16 + 1 // Generates addiu // max_int16 + 1 is not int16 but -(max_int16 + 1) is, just use addiu. - {0xffffffffffff7fff, 0x8001, 2}, // min_int16 - 1 + {0xFFFFFFFFFFFF7FFF, 0x8001, 2}, // min_int16 - 1 // Generates ori + addu // To load this value to at we need two instructions and another one to // subtract, lui + ori + subu. But we can load -value to at using just // ori and then add at register with addu. - {0x8001, 0xffffffffffff7fff, 2}, // max_int16 + 2 + {0x8001, 0xFFFFFFFFFFFF7FFF, 2}, // max_int16 + 2 // Generates ori + subu // Not int16 but is uint16, load value to at with ori and subtract with // subu. - {0x00010000, 0xffffffffffff0000, 2}, + {0x00010000, 0xFFFFFFFFFFFF0000, 2}, // Generates lui + subu // Load value using lui to at and subtract with subu. - {0x00010001, 0xfffffffffffeffff, 3}, + {0x00010001, 0xFFFFFFFFFFFEFFFF, 3}, // Generates lui + ori + subu // We have to generate three instructions in this case. - {0x7fffffff, 0xffffffff80000001, 3}, // max_int32 + {0x7FFFFFFF, 0xFFFFFFFF80000001, 3}, // max_int32 // Generates lui + ori + subu - {0xffffffff80000000, 0xffffffff80000000, 2}, // min_int32 + {0xFFFFFFFF80000000, 0xFFFFFFFF80000000, 2}, // min_int32 // The test case above generates lui + subu intruction sequence. // The result of 0 - min_int32 eqauls max_int32 + 1, which wraps around to // min_int32 again. }; + // clang-format on size_t nr_test_cases = sizeof(tc) / sizeof(TestCaseSubu); for (size_t i = 0; i < nr_test_cases; ++i) { @@ -6541,10 +6514,9 @@ uint64_t run_Dsubu(uint64_t imm, int32_t num_instr) { #ifdef OBJECT_PRINT code->Print(std::cout); #endif - F2 f = FUNCTION_CAST<F2>(code->entry()); + auto f = GeneratedCode<F2>::FromCode(*code); - uint64_t res = reinterpret_cast<uint64_t>( - CALL_GENERATED_CODE(isolate, f, 0, 0, 0, 0, 0)); + uint64_t res = reinterpret_cast<uint64_t>(f.Call(0, 0, 0, 0, 0)); return res; } @@ -6563,38 +6535,39 @@ TEST(Dsubu) { // We call Dsubu(v0, zero_reg, imm) to test cases listed below. // 0 - imm = expected_res + // clang-format off struct TestCaseDsubu tc[] = { // imm, expected_res, num_instr - {0xffffffffffff8000, 0x8000, 2}, // min_int16 + {0xFFFFFFFFFFFF8000, 0x8000, 2}, // min_int16 // The test case above generates daddiu + dsubu instruction sequence. // We can't have just daddiu because -min_int16 > max_int16 so use // register, but we can load min_int16 to at register with daddiu and then // subtract at with dsubu. - {0x8000, 0xffffffffffff8000, 1}, // max_int16 + 1 + {0x8000, 0xFFFFFFFFFFFF8000, 1}, // max_int16 + 1 // Generates daddiu // max_int16 + 1 is not int16 but -(max_int16 + 1) is, just use daddiu. - {0xffffffffffff7fff, 0x8001, 2}, // min_int16 - 1 + {0xFFFFFFFFFFFF7FFF, 0x8001, 2}, // min_int16 - 1 // Generates ori + daddu // To load this value to at we need two instructions and another one to // subtract, lui + ori + dsubu. But we can load -value to at using just // ori and then dadd at register with daddu. - {0x8001, 0xffffffffffff7fff, 2}, // max_int16 + 2 + {0x8001, 0xFFFFFFFFFFFF7FFF, 2}, // max_int16 + 2 // Generates ori + dsubu // Not int16 but is uint16, load value to at with ori and subtract with // dsubu. - {0x00010000, 0xffffffffffff0000, 2}, + {0x00010000, 0xFFFFFFFFFFFF0000, 2}, // Generates lui + dsubu // Load value using lui to at and subtract with dsubu. - {0x00010001, 0xfffffffffffeffff, 3}, + {0x00010001, 0xFFFFFFFFFFFEFFFF, 3}, // Generates lui + ori + dsubu // We have to generate three instructions in this case. - {0x7fffffff, 0xffffffff80000001, 3}, // max_int32 + {0x7FFFFFFF, 0xFFFFFFFF80000001, 3}, // max_int32 // Generates lui + ori + dsubu - {0xffffffff80000000, 0x0000000080000000, 2}, // min_int32 + {0xFFFFFFFF80000000, 0x0000000080000000, 2}, // min_int32 // Generates lui + dsubu // The result of 0 - min_int32 eqauls max_int32 + 1, which fits into a 64 // bit register, Dsubu gives a different result here. - {0x7fffffffffffffff, 0x8000000000000001, 3}, // max_int64 + {0x7FFFFFFFFFFFFFFF, 0x8000000000000001, 3}, // max_int64 // r2 - Generates daddiu + dsrl + dsubu // r6 - Generates daddiu + dati + dsubu {0x8000000000000000, 0x8000000000000000, 3}, // min_int64 @@ -6603,13 +6576,14 @@ TEST(Dsubu) { // r6 - ori + dati + dsubu. // The result of 0 - min_int64 eqauls max_int64 + 1, which wraps around to // min_int64 again. - {0xffff0000ffffffff, 0x0000ffff00000001, 4}, + {0xFFFF0000FFFFFFFF, 0x0000FFFF00000001, 4}, // The test case above generates: // r2 - ori + dsll32 + ori + daddu instruction sequence, // r6 - daddiu + dahi + dati + dsubu. // For r2 loading imm would take more instructions than loading -imm so we // can load -imm and add with daddu. }; + // clang-format on size_t nr_test_cases = sizeof(tc) / sizeof(TestCaseDsubu); for (size_t i = 0; i < nr_test_cases; ++i) { @@ -6634,10 +6608,9 @@ uint64_t run_Dins(uint64_t imm, uint64_t source, uint16_t pos, uint16_t size) { assm.GetCode(isolate, &desc); Handle<Code> code = isolate->factory()->NewCode(desc, Code::STUB, Handle<Code>()); - F2 f = FUNCTION_CAST<F2>(code->entry()); + auto f = GeneratedCode<F2>::FromCode(*code); - uint64_t res = reinterpret_cast<uint64_t>( - CALL_GENERATED_CODE(isolate, f, 0, 0, 0, 0, 0)); + uint64_t res = reinterpret_cast<uint64_t>(f.Call(0, 0, 0, 0, 0)); return res; } @@ -6657,18 +6630,20 @@ TEST(Dins) { // We load imm to v0 and source to t0 and then call // Dins(v0, t0, pos, size) to test cases listed below. + // clang-format off struct TestCaseDins tc[] = { // imm, source, pos, size, expected_res - {0x5555555555555555, 0x1abcdef01, 31, 1, 0x55555555d5555555}, - {0x5555555555555555, 0x1abcdef02, 30, 2, 0x5555555595555555}, - {0x201234567, 0x1fabcdeff, 0, 32, 0x2fabcdeff}, - {0x201234567, 0x7fabcdeff, 31, 2, 0x381234567}, - {0x800000000, 0x7fabcdeff, 0, 33, 0x9fabcdeff}, - {0x1234, 0xabcdabcdabcdabcd, 0, 64, 0xabcdabcdabcdabcd}, - {0xabcd, 0xabceabcf, 32, 1, 0x10000abcd}, - {0xabcd, 0xabceabcf, 63, 1, 0x800000000000abcd}, - {0x10000abcd, 0xabc1abc2abc3abc4, 32, 32, 0xabc3abc40000abcd}, + {0x5555555555555555, 0x1ABCDEF01, 31, 1, 0x55555555D5555555}, + {0x5555555555555555, 0x1ABCDEF02, 30, 2, 0x5555555595555555}, + {0x201234567, 0x1FABCDEFF, 0, 32, 0x2FABCDEFF}, + {0x201234567, 0x7FABCDEFF, 31, 2, 0x381234567}, + {0x800000000, 0x7FABCDEFF, 0, 33, 0x9FABCDEFF}, + {0x1234, 0xABCDABCDABCDABCD, 0, 64, 0xABCDABCDABCDABCD}, + {0xABCD, 0xABCEABCF, 32, 1, 0x10000ABCD}, + {0xABCD, 0xABCEABCF, 63, 1, 0x800000000000ABCD}, + {0x10000ABCD, 0xABC1ABC2ABC3ABC4, 32, 32, 0xABC3ABC40000ABCD}, }; + // clang-format on size_t nr_test_cases = sizeof(tc) / sizeof(TestCaseDins); for (size_t i = 0; i < nr_test_cases; ++i) { @@ -6694,10 +6669,9 @@ uint64_t run_Ins(uint64_t imm, uint64_t source, uint16_t pos, uint16_t size) { assm.GetCode(isolate, &desc); Handle<Code> code = isolate->factory()->NewCode(desc, Code::STUB, Handle<Code>()); - F2 f = FUNCTION_CAST<F2>(code->entry()); + auto f = GeneratedCode<F2>::FromCode(*code); - uint64_t res = reinterpret_cast<uint64_t>( - CALL_GENERATED_CODE(isolate, f, 0, 0, 0, 0, 0)); + uint64_t res = reinterpret_cast<uint64_t>(f.Call(0, 0, 0, 0, 0)); return res; } @@ -6707,44 +6681,44 @@ TEST(Ins) { // run_Ins(rt_value, rs_value, pos, size), // expected_result - CHECK_EQ(run_Ins(0x0000000055555555, 0xffffffffabcdef01, 31, 1), - 0xffffffffd5555555); - CHECK_EQ(run_Ins(0x0000000055555555, 0xffffffffabcdef02, 30, 2), - 0xffffffff95555555); - CHECK_EQ(run_Ins(0x0000000001234567, 0xfffffffffabcdeff, 0, 32), - 0xfffffffffabcdeff); + CHECK_EQ(run_Ins(0x0000000055555555, 0xFFFFFFFFABCDEF01, 31, 1), + 0xFFFFFFFFD5555555); + CHECK_EQ(run_Ins(0x0000000055555555, 0xFFFFFFFFABCDEF02, 30, 2), + 0xFFFFFFFF95555555); + CHECK_EQ(run_Ins(0x0000000001234567, 0xFFFFFFFFFABCDEFF, 0, 32), + 0xFFFFFFFFFABCDEFF); // Results with positive sign. - CHECK_EQ(run_Ins(0x0000000055555550, 0xffffffff80000001, 0, 1), + CHECK_EQ(run_Ins(0x0000000055555550, 0xFFFFFFFF80000001, 0, 1), 0x0000000055555551); CHECK_EQ(run_Ins(0x0000000055555555, 0x0000000040000001, 0, 32), 0x0000000040000001); CHECK_EQ(run_Ins(0x0000000055555555, 0x0000000020000001, 1, 31), 0x0000000040000003); - CHECK_EQ(run_Ins(0x0000000055555555, 0xffffffff80700001, 8, 24), + CHECK_EQ(run_Ins(0x0000000055555555, 0xFFFFFFFF80700001, 8, 24), 0x0000000070000155); - CHECK_EQ(run_Ins(0x0000000055555555, 0xffffffff80007001, 16, 16), + CHECK_EQ(run_Ins(0x0000000055555555, 0xFFFFFFFF80007001, 16, 16), 0x0000000070015555); - CHECK_EQ(run_Ins(0x0000000055555555, 0xffffffff80000071, 24, 8), + CHECK_EQ(run_Ins(0x0000000055555555, 0xFFFFFFFF80000071, 24, 8), 0x0000000071555555); CHECK_EQ(run_Ins(0x0000000075555555, 0x0000000040000000, 31, 1), 0x0000000075555555); // Results with negative sign. - CHECK_EQ(run_Ins(0xffffffff85555550, 0xffffffff80000001, 0, 1), - 0xffffffff85555551); - CHECK_EQ(run_Ins(0x0000000055555555, 0xffffffff80000001, 0, 32), - 0xffffffff80000001); + CHECK_EQ(run_Ins(0xFFFFFFFF85555550, 0xFFFFFFFF80000001, 0, 1), + 0xFFFFFFFF85555551); + CHECK_EQ(run_Ins(0x0000000055555555, 0xFFFFFFFF80000001, 0, 32), + 0xFFFFFFFF80000001); CHECK_EQ(run_Ins(0x0000000055555555, 0x0000000040000001, 1, 31), - 0xffffffff80000003); - CHECK_EQ(run_Ins(0x0000000055555555, 0xffffffff80800001, 8, 24), - 0xffffffff80000155); - CHECK_EQ(run_Ins(0x0000000055555555, 0xffffffff80008001, 16, 16), - 0xffffffff80015555); - CHECK_EQ(run_Ins(0x0000000055555555, 0xffffffff80000081, 24, 8), - 0xffffffff81555555); + 0xFFFFFFFF80000003); + CHECK_EQ(run_Ins(0x0000000055555555, 0xFFFFFFFF80800001, 8, 24), + 0xFFFFFFFF80000155); + CHECK_EQ(run_Ins(0x0000000055555555, 0xFFFFFFFF80008001, 16, 16), + 0xFFFFFFFF80015555); + CHECK_EQ(run_Ins(0x0000000055555555, 0xFFFFFFFF80000081, 24, 8), + 0xFFFFFFFF81555555); CHECK_EQ(run_Ins(0x0000000075555555, 0x0000000000000001, 31, 1), - 0xfffffffff5555555); + 0xFFFFFFFFF5555555); } uint64_t run_Ext(uint64_t source, uint16_t pos, uint16_t size) { @@ -6754,7 +6728,7 @@ uint64_t run_Ext(uint64_t source, uint16_t pos, uint16_t size) { MacroAssembler assm(isolate, nullptr, 0, v8::internal::CodeObjectRequired::kYes); - __ li(v0, 0xffffffffffffffff); + __ li(v0, 0xFFFFFFFFFFFFFFFF); __ li(t0, source); __ Ext(v0, t0, pos, size); __ jr(ra); @@ -6764,10 +6738,9 @@ uint64_t run_Ext(uint64_t source, uint16_t pos, uint16_t size) { assm.GetCode(isolate, &desc); Handle<Code> code = isolate->factory()->NewCode(desc, Code::STUB, Handle<Code>()); - F2 f = FUNCTION_CAST<F2>(code->entry()); + auto f = GeneratedCode<F2>::FromCode(*code); - uint64_t res = reinterpret_cast<uint64_t>( - CALL_GENERATED_CODE(isolate, f, 0, 0, 0, 0, 0)); + uint64_t res = reinterpret_cast<uint64_t>(f.Call(0, 0, 0, 0, 0)); return res; } @@ -6777,13 +6750,13 @@ TEST(Ext) { // Source values with negative sign. // run_Ext(rs_value, pos, size), expected_result - CHECK_EQ(run_Ext(0xffffffff80000001, 0, 1), 0x0000000000000001); - CHECK_EQ(run_Ext(0xffffffff80000001, 0, 32), 0xffffffff80000001); - CHECK_EQ(run_Ext(0xffffffff80000002, 1, 31), 0x0000000040000001); - CHECK_EQ(run_Ext(0xffffffff80000100, 8, 24), 0x0000000000800001); - CHECK_EQ(run_Ext(0xffffffff80010000, 16, 16), 0x0000000000008001); - CHECK_EQ(run_Ext(0xffffffff81000000, 24, 8), 0x0000000000000081); - CHECK_EQ(run_Ext(0xffffffff80000000, 31, 1), 0x0000000000000001); + CHECK_EQ(run_Ext(0xFFFFFFFF80000001, 0, 1), 0x0000000000000001); + CHECK_EQ(run_Ext(0xFFFFFFFF80000001, 0, 32), 0xFFFFFFFF80000001); + CHECK_EQ(run_Ext(0xFFFFFFFF80000002, 1, 31), 0x0000000040000001); + CHECK_EQ(run_Ext(0xFFFFFFFF80000100, 8, 24), 0x0000000000800001); + CHECK_EQ(run_Ext(0xFFFFFFFF80010000, 16, 16), 0x0000000000008001); + CHECK_EQ(run_Ext(0xFFFFFFFF81000000, 24, 8), 0x0000000000000081); + CHECK_EQ(run_Ext(0xFFFFFFFF80000000, 31, 1), 0x0000000000000001); // Source values with positive sign. CHECK_EQ(run_Ext(0x0000000000000001, 0, 1), 0x0000000000000001); @@ -6819,7 +6792,7 @@ TEST(MSA_fill_copy) { { CpuFeatureScope fscope(&assm, MIPS_SIMD); - __ li(t0, 0x9e7689aca512b683); + __ li(t0, 0x9E7689ACA512B683); __ fill_b(w0, t0); __ fill_h(w2, t0); @@ -6852,18 +6825,17 @@ TEST(MSA_fill_copy) { #ifdef OBJECT_PRINT code->Print(std::cout); #endif - F3 f = FUNCTION_CAST<F3>(code->entry()); + auto f = GeneratedCode<F3>::FromCode(*code); - Object* dummy = CALL_GENERATED_CODE(isolate, f, &t, 0, 0, 0, 0); - USE(dummy); + f.Call(&t, 0, 0, 0, 0); CHECK_EQ(0x83u, t.u8); - CHECK_EQ(0xb683u, t.u16); - CHECK_EQ(0xa512b683u, t.u32); - CHECK_EQ(0xffffffffffffff83u, t.s8); - CHECK_EQ(0xffffffffffffb683u, t.s16); - CHECK_EQ(0xffffffffa512b683u, t.s32); - CHECK_EQ(0x9e7689aca512b683u, t.s64); + CHECK_EQ(0xB683u, t.u16); + CHECK_EQ(0xA512B683u, t.u32); + CHECK_EQ(0xFFFFFFFFFFFFFF83u, t.s8); + CHECK_EQ(0xFFFFFFFFFFFFB683u, t.s16); + CHECK_EQ(0xFFFFFFFFA512B683u, t.s32); + CHECK_EQ(0x9E7689ACA512B683u, t.s64); } TEST(MSA_fill_copy_2) { @@ -6887,7 +6859,7 @@ TEST(MSA_fill_copy_2) { { CpuFeatureScope fscope(&assm, MIPS_SIMD); - __ li(t0, 0xaaaaaaaaaaaaaaaa); + __ li(t0, 0xAAAAAAAAAAAAAAAA); __ li(t1, 0x5555555555555555); __ fill_d(w0, t0); @@ -6917,15 +6889,14 @@ TEST(MSA_fill_copy_2) { #ifdef OBJECT_PRINT code->Print(std::cout); #endif - F5 f = FUNCTION_CAST<F5>(code->entry()); + auto f = GeneratedCode<F5>::FromCode(*code); - Object* dummy = CALL_GENERATED_CODE(isolate, f, &t[0], &t[1], 0, 0, 0); - USE(dummy); + f.Call(&t[0], &t[1], 0, 0, 0); CHECK_EQ(0x5555555555555555, t[0].d0); - CHECK_EQ(0xaaaaaaaaaaaaaaaa, t[0].d1); + CHECK_EQ(0xAAAAAAAAAAAAAAAA, t[0].d1); CHECK_EQ(0x5555555555555555, t[1].d0); - CHECK_EQ(0xaaaaaaaaaaaaaaaa, t[1].d1); + CHECK_EQ(0xAAAAAAAAAAAAAAAA, t[1].d1); } TEST(MSA_fill_copy_3) { @@ -6949,7 +6920,7 @@ TEST(MSA_fill_copy_3) { { CpuFeatureScope fscope(&assm, MIPS_SIMD); - __ li(t0, 0xaaaaaaaaaaaaaaaa); + __ li(t0, 0xAAAAAAAAAAAAAAAA); __ li(t1, 0x5555555555555555); __ Move(f0, t0); @@ -6972,10 +6943,9 @@ TEST(MSA_fill_copy_3) { #ifdef OBJECT_PRINT code->Print(std::cout); #endif - F5 f = FUNCTION_CAST<F5>(code->entry()); + auto f = GeneratedCode<F5>::FromCode(*code); - Object* dummy = CALL_GENERATED_CODE(isolate, f, &t[0], &t[1], 0, 0, 0); - USE(dummy); + f.Call(&t[0], &t[1], 0, 0, 0); CHECK_EQ(0x5555555555555555, t[0].d0); CHECK_EQ(0x5555555555555555, t[1].d0); @@ -7023,9 +6993,9 @@ void run_msa_insert(int64_t rs_value, int n, msa_reg_t* w) { #ifdef OBJECT_PRINT code->Print(std::cout); #endif - F3 f = FUNCTION_CAST<F3>(code->entry()); + auto f = GeneratedCode<F3>::FromCode(*code); - (CALL_GENERATED_CODE(isolate, f, w, 0, 0, 0, 0)); + f.Call(w, 0, 0, 0, 0); } TEST(MSA_insert) { @@ -7041,12 +7011,15 @@ TEST(MSA_insert) { uint64_t exp_res_hi; }; + // clang-format off struct TestCaseInsert tc_b[] = { - // input, n, exp_res_lo, exp_res_hi - {0xa2, 13, 0xffffffffffffffffu, 0xffffa2ffffffffffu}, - {0x73, 10, 0xffffffffffffffffu, 0xffffffffff73ffffu}, - {0x3494, 5, 0xffff94ffffffffffu, 0xffffffffffffffffu}, - {0xa6b8, 1, 0xffffffffffffb8ffu, 0xffffffffffffffffu}}; + // input, n, exp_res_lo, exp_res_hi + { 0xA2, 13, 0xFFFFFFFFFFFFFFFFu, 0xFFFFA2FFFFFFFFFFu}, + { 0x73, 10, 0xFFFFFFFFFFFFFFFFu, 0xFFFFFFFFFF73FFFFu}, + {0x3494, 5, 0xFFFF94FFFFFFFFFFu, 0xFFFFFFFFFFFFFFFFu}, + {0xA6B8, 1, 0xFFFFFFFFFFFFB8FFu, 0xFFFFFFFFFFFFFFFFu} + }; + // clang-format off for (size_t i = 0; i < sizeof(tc_b) / sizeof(TestCaseInsert); ++i) { msa_reg_t res; @@ -7055,12 +7028,15 @@ TEST(MSA_insert) { CHECK_EQ(tc_b[i].exp_res_hi, res.d[1]); } + // clang-format off struct TestCaseInsert tc_h[] = { - // input, n, exp_res_lo, exp_res_hi - {0x85a2, 7, 0xffffffffffffffffu, 0x85a2ffffffffffffu}, - {0xe873, 5, 0xffffffffffffffffu, 0xffffffffe873ffffu}, - {0x3494, 3, 0x3494ffffffffffffu, 0xffffffffffffffffu}, - {0xa6b8, 1, 0xffffffffa6b8ffffu, 0xffffffffffffffffu}}; + // input, n, exp_res_lo, exp_res_hi + {0x85A2, 7, 0xFFFFFFFFFFFFFFFFu, 0x85A2FFFFFFFFFFFFu}, + {0xE873, 5, 0xFFFFFFFFFFFFFFFFu, 0xFFFFFFFFE873FFFFu}, + {0x3494, 3, 0x3494FFFFFFFFFFFFu, 0xFFFFFFFFFFFFFFFFu}, + {0xA6B8, 1, 0xFFFFFFFFA6B8FFFFu, 0xFFFFFFFFFFFFFFFFu} + }; + // clang-format on for (size_t i = 0; i < sizeof(tc_h) / sizeof(TestCaseInsert); ++i) { msa_reg_t res; @@ -7069,12 +7045,15 @@ TEST(MSA_insert) { CHECK_EQ(tc_h[i].exp_res_hi, res.d[1]); } + // clang-format off struct TestCaseInsert tc_w[] = { - // input, n, exp_res_lo, exp_res_hi - {0xd2f085a2u, 3, 0xffffffffffffffffu, 0xd2f085a2ffffffffu}, - {0x4567e873u, 2, 0xffffffffffffffffu, 0xffffffff4567e873u}, - {0xacdb3494u, 1, 0xacdb3494ffffffffu, 0xffffffffffffffffu}, - {0x89aba6b8u, 0, 0xffffffff89aba6b8u, 0xffffffffffffffffu}}; + // input, n, exp_res_lo, exp_res_hi + {0xD2F085A2u, 3, 0xFFFFFFFFFFFFFFFFu, 0xD2F085A2FFFFFFFFu}, + {0x4567E873u, 2, 0xFFFFFFFFFFFFFFFFu, 0xFFFFFFFF4567E873u}, + {0xACDB3494u, 1, 0xACDB3494FFFFFFFFu, 0xFFFFFFFFFFFFFFFFu}, + {0x89ABA6B8u, 0, 0xFFFFFFFF89ABA6B8u, 0xFFFFFFFFFFFFFFFFu} + }; + // clang-format on for (size_t i = 0; i < sizeof(tc_w) / sizeof(TestCaseInsert); ++i) { msa_reg_t res; @@ -7083,10 +7062,13 @@ TEST(MSA_insert) { CHECK_EQ(tc_w[i].exp_res_hi, res.d[1]); } + // clang-format off struct TestCaseInsert tc_d[] = { - // input, n, exp_res_lo, exp_res_hi - {0xf35862e13e38f8b0, 1, 0xffffffffffffffffu, 0xf35862e13e38f8b0}, - {0x4f41ffdef2bfe636, 0, 0x4f41ffdef2bfe636, 0xffffffffffffffffu}}; + // input, n, exp_res_lo, exp_res_hi + {0xF35862E13E38F8B0, 1, 0xFFFFFFFFFFFFFFFFu, 0xF35862E13E38F8B0}, + {0x4F41FFDEF2BFE636, 0, 0x4F41FFDEF2BFE636, 0xFFFFFFFFFFFFFFFFu} + }; + // clang-format on for (size_t i = 0; i < sizeof(tc_d) / sizeof(TestCaseInsert); ++i) { msa_reg_t res; @@ -7122,13 +7104,13 @@ void run_msa_ctc_cfc(uint64_t value) { #ifdef OBJECT_PRINT code->Print(std::cout); #endif - F3 f = FUNCTION_CAST<F3>(code->entry()); + auto f = GeneratedCode<F3>::FromCode(*code); uint64_t res; - (CALL_GENERATED_CODE(isolate, f, &res, 0, 0, 0, 0)); + f.Call(&res, 0, 0, 0, 0); CHECK_EQ(bit_cast<uint64_t>(static_cast<int64_t>( - bit_cast<int32_t>(static_cast<uint32_t>(value & 0x0167ffff)))), + bit_cast<int32_t>(static_cast<uint32_t>(value & 0x0167FFFF)))), res); } @@ -7145,12 +7127,12 @@ TEST(MSA_move_v) { uint64_t wd_lo; uint64_t wd_hi; } T; - T t[] = {{0x20b9cc4f1a83e0c5, 0xa27e1b5f2f5bb18a, 0x1e86678b52f8e1ff, - 0x706e51290ac76fb9}, - {0x4414aed7883ffd18, 0x047d183a06b67016, 0x4ef258cf8d822870, - 0x2686b73484c2e843}, - {0xd38ff9d048884ffc, 0x6dc63a57c0943ca7, 0x8520ca2f3e97c426, - 0xa9913868fb819c59}}; + T t[] = {{0x20B9CC4F1A83E0C5, 0xA27E1B5F2F5BB18A, 0x1E86678B52F8E1FF, + 0x706E51290AC76FB9}, + {0x4414AED7883FFD18, 0x047D183A06B67016, 0x4EF258CF8D822870, + 0x2686B73484C2E843}, + {0xD38FF9D048884FFC, 0x6DC63A57C0943CA7, 0x8520CA2F3E97C426, + 0xA9913868FB819C59}}; for (unsigned i = 0; i < arraysize(t); ++i) { MacroAssembler assm(isolate, nullptr, 0, @@ -7172,8 +7154,8 @@ TEST(MSA_move_v) { #ifdef OBJECT_PRINT code->Print(std::cout); #endif - F3 f = FUNCTION_CAST<F3>(code->entry()); - (CALL_GENERATED_CODE(isolate, f, &t[i].wd_lo, 0, 0, 0, 0)); + auto f = GeneratedCode<F3>::FromCode(*code); + f.Call(&t[i].wd_lo, 0, 0, 0, 0); CHECK_EQ(t[i].ws_lo, t[i].wd_lo); CHECK_EQ(t[i].ws_hi, t[i].wd_hi); } @@ -7191,12 +7173,12 @@ void run_msa_sldi(OperFunc GenerateOperation, uint64_t wd_lo; uint64_t wd_hi; } T; - T t[] = {{0x20b9cc4f1a83e0c5, 0xa27e1b5f2f5bb18a, 0x1e86678b52f8e1ff, - 0x706e51290ac76fb9}, - {0x4414aed7883ffd18, 0x047d183a06b67016, 0x4ef258cf8d822870, - 0x2686b73484c2e843}, - {0xd38ff9d048884ffc, 0x6dc63a57c0943ca7, 0x8520ca2f3e97c426, - 0xa9913868fb819c59}}; + T t[] = {{0x20B9CC4F1A83E0C5, 0xA27E1B5F2F5BB18A, 0x1E86678B52F8E1FF, + 0x706E51290AC76FB9}, + {0x4414AED7883FFD18, 0x047D183A06B67016, 0x4EF258CF8D822870, + 0x2686B73484C2E843}, + {0xD38FF9D048884FFC, 0x6DC63A57C0943CA7, 0x8520CA2F3E97C426, + 0xA9913868FB819C59}}; uint64_t res[2]; for (unsigned i = 0; i < arraysize(t); ++i) { @@ -7218,8 +7200,8 @@ void run_msa_sldi(OperFunc GenerateOperation, #ifdef OBJECT_PRINT code->Print(std::cout); #endif - F3 f = FUNCTION_CAST<F3>(code->entry()); - (CALL_GENERATED_CODE(isolate, f, &res[0], 0, 0, 0, 0)); + auto f = GeneratedCode<F3>::FromCode(*code); + f.Call(&res[0], 0, 0, 0, 0); GenerateExpectedResult(reinterpret_cast<uint8_t*>(&t[i].ws_lo), reinterpret_cast<uint8_t*>(&t[i].wd_lo)); CHECK_EQ(res[0], t[i].wd_lo); @@ -7284,14 +7266,14 @@ TEST(MSA_cfc_ctc) { CcTest::InitializeVM(); - const uint64_t mask_without_cause = 0xffffffffff9c0fff; - const uint64_t mask_always_zero = 0x0167ffff; - const uint64_t mask_enables = 0x0000000000000f80; - uint64_t test_case[] = {0x30c6f6352d5ede31, 0xefc9fed507955425, - 0x64f2a3ff15b7dbe3, 0x6aa069352bf8bc37, - 0x7ea7ab2ae6aae923, 0xa10f5d4c24d0f68d, - 0x6dd14c9441afa84c, 0xc366373b2d6bf64f, - 0x6b35fb04925014bd, 0x9e3ea39a4dba7e61}; + const uint64_t mask_without_cause = 0xFFFFFFFFFF9C0FFF; + const uint64_t mask_always_zero = 0x0167FFFF; + const uint64_t mask_enables = 0x0000000000000F80; + uint64_t test_case[] = {0x30C6F6352D5EDE31, 0xEFC9FED507955425, + 0x64F2A3FF15B7DBE3, 0x6AA069352BF8BC37, + 0x7EA7AB2AE6AAE923, 0xA10F5D4C24D0F68D, + 0x6DD14C9441AFA84C, 0xC366373B2D6BF64F, + 0x6B35FB04925014BD, 0x9E3EA39A4DBA7E61}; for (unsigned i = 0; i < arraysize(test_case); i++) { // Setting enable bits and corresponding cause bits could result in // exception raised and this prevents that from happening @@ -7316,8 +7298,8 @@ void run_msa_i8(SecondaryField opcode, uint64_t ws_lo, uint64_t ws_hi, v8::internal::CodeObjectRequired::kYes); CpuFeatureScope fscope(&assm, MIPS_SIMD); msa_reg_t res; - uint64_t wd_lo = 0xf35862e13e38f8b0; - uint64_t wd_hi = 0x4f41ffdef2bfe636; + uint64_t wd_lo = 0xF35862E13E38F8B0; + uint64_t wd_hi = 0x4F41FFDEF2BFE636; #define LOAD_W_REG(lo, hi, w_reg) \ __ li(t0, lo); \ @@ -7379,9 +7361,9 @@ void run_msa_i8(SecondaryField opcode, uint64_t ws_lo, uint64_t ws_hi, #ifdef OBJECT_PRINT code->Print(std::cout); #endif - F3 f = FUNCTION_CAST<F3>(code->entry()); + auto f = GeneratedCode<F3>::FromCode(*code); - (CALL_GENERATED_CODE(isolate, f, &res, 0, 0, 0, 0)); + f.Call(&res, 0, 0, 0, 0); uint64_t mask = i8 * 0x0101010101010101ull; switch (opcode) { @@ -7416,13 +7398,13 @@ void run_msa_i8(SecondaryField opcode, uint64_t ws_lo, uint64_t ws_hi, case SHF_B: { struct ExpResShf exp_b[] = { // i8, exp_lo, exp_hi - {0xffu, 0x11111111b9b9b9b9, 0xf7f7f7f7c8c8c8c8}, - {0x0u, 0x62626262dfdfdfdf, 0xd6d6d6d6c8c8c8c8}, - {0xe4u, 0xf35862e13e38f8b0, 0x4f41ffdef2bfe636}, - {0x1bu, 0x1b756911c3d9a7b9, 0xae94a5f79c8aefc8}, - {0xb1u, 0x662b6253e8c4df12, 0x0d3ad6803f8bc88b}, - {0x4eu, 0x62e1f358f8b03e38, 0xffde4f41e636f2bf}, - {0x27u, 0x1b697511c3a7d9b9, 0xaea594f79cef8ac8}}; + {0xFFu, 0x11111111B9B9B9B9, 0xF7F7F7F7C8C8C8C8}, + {0x0u, 0x62626262DFDFDFDF, 0xD6D6D6D6C8C8C8C8}, + {0xE4u, 0xF35862E13E38F8B0, 0x4F41FFDEF2BFE636}, + {0x1Bu, 0x1B756911C3D9A7B9, 0xAE94A5F79C8AEFC8}, + {0xB1u, 0x662B6253E8C4DF12, 0x0D3AD6803F8BC88B}, + {0x4Eu, 0x62E1F358F8B03E38, 0xFFDE4F41E636F2BF}, + {0x27u, 0x1B697511C3A7D9B9, 0xAEA594F79CEF8AC8}}; for (size_t i = 0; i < sizeof(exp_b) / sizeof(ExpResShf); ++i) { if (exp_b[i].i8 == i8) { CHECK_EQ(exp_b[i].lo, res.d[0]); @@ -7433,13 +7415,13 @@ void run_msa_i8(SecondaryField opcode, uint64_t ws_lo, uint64_t ws_hi, case SHF_H: { struct ExpResShf exp_h[] = { // i8, exp_lo, exp_hi - {0xffu, 0x1169116911691169, 0xf7a5f7a5f7a5f7a5}, - {0x0u, 0x12df12df12df12df, 0x8bc88bc88bc88bc8}, - {0xe4u, 0xf35862e13e38f8b0, 0x4f41ffdef2bfe636}, - {0x1bu, 0xd9c3b9a7751b1169, 0x8a9cc8ef94aef7a5}, - {0xb1u, 0x53622b6612dfc4e8, 0x80d63a0d8bc88b3f}, - {0x4eu, 0x3e38f8b0f35862e1, 0xf2bfe6364f41ffde}, - {0x27u, 0xd9c3751bb9a71169, 0x8a9c94aec8eff7a5}}; + {0xFFu, 0x1169116911691169, 0xF7A5F7A5F7A5F7A5}, + {0x0u, 0x12DF12DF12DF12DF, 0x8BC88BC88BC88BC8}, + {0xE4u, 0xF35862E13E38F8B0, 0x4F41FFDEF2BFE636}, + {0x1Bu, 0xD9C3B9A7751B1169, 0x8A9CC8EF94AEF7A5}, + {0xB1u, 0x53622B6612DFC4E8, 0x80D63A0D8BC88B3F}, + {0x4Eu, 0x3E38F8B0F35862E1, 0xF2BFE6364F41FFDE}, + {0x27u, 0xD9C3751BB9A71169, 0x8A9C94AEC8EFF7A5}}; for (size_t i = 0; i < sizeof(exp_h) / sizeof(ExpResShf); ++i) { if (exp_h[i].i8 == i8) { CHECK_EQ(exp_h[i].lo, res.d[0]); @@ -7450,13 +7432,13 @@ void run_msa_i8(SecondaryField opcode, uint64_t ws_lo, uint64_t ws_hi, case SHF_W: { struct ExpResShf exp_w[] = { // i8, exp_lo, exp_hi - {0xffu, 0xf7a594aef7a594ae, 0xf7a594aef7a594ae}, - {0x0u, 0xc4e812dfc4e812df, 0xc4e812dfc4e812df}, - {0xe4u, 0xf35862e13e38f8b0, 0x4f41ffdef2bfe636}, - {0x1bu, 0xc8ef8a9cf7a594ae, 0xb9a7d9c31169751b}, - {0xb1u, 0xc4e812df2b665362, 0x8b3f8bc83a0d80d6}, - {0x4eu, 0x4f41ffdef2bfe636, 0xf35862e13e38f8b0}, - {0x27u, 0x1169751bf7a594ae, 0xb9a7d9c3c8ef8a9c}}; + {0xFFu, 0xF7A594AEF7A594AE, 0xF7A594AEF7A594AE}, + {0x0u, 0xC4E812DFC4E812DF, 0xC4E812DFC4E812DF}, + {0xE4u, 0xF35862E13E38F8B0, 0x4F41FFDEF2BFE636}, + {0x1Bu, 0xC8EF8A9CF7A594AE, 0xB9A7D9C31169751B}, + {0xB1u, 0xC4E812DF2B665362, 0x8B3F8BC83A0D80D6}, + {0x4Eu, 0x4F41FFDEF2BFE636, 0xF35862E13E38F8B0}, + {0x27u, 0x1169751BF7A594AE, 0xB9A7D9C3C8EF8A9C}}; for (size_t i = 0; i < sizeof(exp_w) / sizeof(ExpResShf); ++i) { if (exp_w[i].i8 == i8) { CHECK_EQ(exp_w[i].lo, res.d[0]); @@ -7481,11 +7463,15 @@ TEST(MSA_andi_ori_nori_xori) { CcTest::InitializeVM(); - struct TestCaseMsaI8 tc[] = {// input_lo, input_hi, i8 - {0x1169751bb9a7d9c3, 0xf7a594aec8ef8a9c, 0xffu}, - {0x2b665362c4e812df, 0x3a0d80d68b3f8bc8, 0x0u}, - {0x1169751bb9a7d9c3, 0xf7a594aec8ef8a9c, 0x3bu}, - {0x2b665362c4e812df, 0x3a0d80d68b3f8bc8, 0xd9u}}; + // clang-format off + struct TestCaseMsaI8 tc[] = { + // input_lo, input_hi, i8 + {0x1169751BB9A7D9C3, 0xF7A594AEC8EF8A9C, 0xFFu}, + {0x2B665362C4E812DF, 0x3A0D80D68B3F8BC8, 0x0u}, + {0x1169751BB9A7D9C3, 0xF7A594AEC8EF8A9C, 0x3Bu}, + {0x2B665362C4E812DF, 0x3A0D80D68B3F8BC8, 0xD9u} + }; + // clang-format on for (size_t i = 0; i < sizeof(tc) / sizeof(TestCaseMsaI8); ++i) { run_msa_i8(ANDI_B, tc[i].input_lo, tc[i].input_hi, tc[i].i8); @@ -7501,11 +7487,15 @@ TEST(MSA_bmnzi_bmzi_bseli) { CcTest::InitializeVM(); - struct TestCaseMsaI8 tc[] = {// input_lo, input_hi, i8 - {0x1169751bb9a7d9c3, 0xf7a594aec8ef8a9c, 0xffu}, - {0x2b665362c4e812df, 0x3a0d80d68b3f8bc8, 0x0u}, - {0x1169751bb9a7d9c3, 0xf7a594aec8ef8a9c, 0x3bu}, - {0x2b665362c4e812df, 0x3a0d80d68b3f8bc8, 0xd9u}}; + // clang-format off + struct TestCaseMsaI8 tc[] = { + // input_lo, input_hi, i8 + {0x1169751BB9A7D9C3, 0xF7A594AEC8EF8A9C, 0xFFu}, + {0x2B665362C4E812DF, 0x3A0D80D68B3F8BC8, 0x0u}, + {0x1169751BB9A7D9C3, 0xF7A594AEC8EF8A9C, 0x3Bu}, + {0x2B665362C4E812DF, 0x3A0D80D68B3F8BC8, 0xD9u} + }; + // clang-format on for (size_t i = 0; i < sizeof(tc) / sizeof(TestCaseMsaI8); ++i) { run_msa_i8(BMNZI_B, tc[i].input_lo, tc[i].input_hi, tc[i].i8); @@ -7520,16 +7510,18 @@ TEST(MSA_shf) { CcTest::InitializeVM(); + // clang-format off struct TestCaseMsaI8 tc[] = { // input_lo, input_hi, i8 - {0x1169751bb9a7d9c3, 0xf7a594aec8ef8a9c, 0xffu}, // 3333 - {0x2b665362c4e812df, 0x3a0d80d68b3f8bc8, 0x0u}, // 0000 - {0xf35862e13e38f8b0, 0x4f41ffdef2bfe636, 0xe4u}, // 3210 - {0x1169751bb9a7d9c3, 0xf7a594aec8ef8a9c, 0x1bu}, // 0123 - {0x2b665362c4e812df, 0x3a0d80d68b3f8bc8, 0xb1u}, // 2301 - {0xf35862e13e38f8b0, 0x4f41ffdef2bfe636, 0x4eu}, // 1032 - {0x1169751bb9a7d9c3, 0xf7a594aec8ef8a9c, 0x27u} // 0213 + {0x1169751BB9A7D9C3, 0xF7A594AEC8EF8A9C, 0xFFu}, // 3333 + {0x2B665362C4E812DF, 0x3A0D80D68B3F8BC8, 0x0u}, // 0000 + {0xF35862E13E38F8B0, 0x4F41FFDEF2BFE636, 0xE4u}, // 3210 + {0x1169751BB9A7D9C3, 0xF7A594AEC8EF8A9C, 0x1Bu}, // 0123 + {0x2B665362C4E812DF, 0x3A0D80D68B3F8BC8, 0xB1u}, // 2301 + {0xF35862E13E38F8B0, 0x4F41FFDEF2BFE636, 0x4Eu}, // 1032 + {0x1169751BB9A7D9C3, 0xF7A594AEC8EF8A9C, 0x27u} // 0213 }; + // clang-format on for (size_t i = 0; i < sizeof(tc) / sizeof(TestCaseMsaI8); ++i) { run_msa_i8(SHF_B, tc[i].input_lo, tc[i].input_hi, tc[i].i8); @@ -7574,9 +7566,9 @@ void run_msa_i5(struct TestCaseMsaI5* input, bool i5_sign_ext, #ifdef OBJECT_PRINT code->Print(std::cout); #endif - F3 f = FUNCTION_CAST<F3>(code->entry()); + auto f = GeneratedCode<F3>::FromCode(*code); - (CALL_GENERATED_CODE(isolate, f, &res, 0, 0, 0, 0)); + f.Call(&res, 0, 0, 0, 0); CHECK_EQ(GenerateOperationFunc(input->ws_lo, input->i5), res.d[0]); CHECK_EQ(GenerateOperationFunc(input->ws_hi, input->i5), res.d[1]); @@ -7588,14 +7580,17 @@ TEST(MSA_addvi_subvi) { CcTest::InitializeVM(); + // clang-format off struct TestCaseMsaI5 tc[] = { - // ws_lo, ws_hi, i5 - {0x1169751bb9a7d9c3, 0xf7a594aec8ef8a9c, 0x0000001f}, - {0x2b665362c4e812df, 0x3a0d80d68b3f8bc8, 0x0000000f}, - {0x1169751bb9a7d9c3, 0xf7a594aec8ef8a9c, 0x00000005}, - {0x2b665362c4e812df, 0x3a0d80d68b3f8bc8, 0x00000010}, - {0xffab807f807fffcd, 0x7f23ff80ff567f80, 0x0000000f}, - {0x80ffefff7f12807f, 0x807f80ff7fdeff78, 0x00000010}}; + // ws_lo, ws_hi, i5 + {0x1169751BB9A7D9C3, 0xF7A594AEC8EF8A9C, 0x0000001F}, + {0x2B665362C4E812DF, 0x3A0D80D68B3F8BC8, 0x0000000F}, + {0x1169751BB9A7D9C3, 0xF7A594AEC8EF8A9C, 0x00000005}, + {0x2B665362C4E812DF, 0x3A0D80D68B3F8BC8, 0x00000010}, + {0xFFAB807F807FFFCD, 0x7F23FF80FF567F80, 0x0000000F}, + {0x80FFEFFF7F12807F, 0x807F80FF7FDEFF78, 0x00000010} + }; +// clang-format on #define ADDVI_DF(lanes, mask) \ uint64_t res = 0; \ @@ -7664,23 +7659,26 @@ TEST(MSA_maxi_mini) { CcTest::InitializeVM(); + // clang-format off struct TestCaseMsaI5 tc[] = { - // ws_lo, ws_hi, i5 - {0x7f80ff3480ff7f00, 0x8d7fff80ff7f6780, 0x0000001f}, - {0x7f80ff3480ff7f00, 0x8d7fff80ff7f6780, 0x0000000f}, - {0x7f80ff3480ff7f00, 0x8d7fff80ff7f6780, 0x00000010}, - {0x80007fff91daffff, 0x7fff8000ffff5678, 0x0000001f}, - {0x80007fff91daffff, 0x7fff8000ffff5678, 0x0000000f}, - {0x80007fff91daffff, 0x7fff8000ffff5678, 0x00000010}, - {0x7fffffff80000000, 0x12345678ffffffff, 0x0000001f}, - {0x7fffffff80000000, 0x12345678ffffffff, 0x0000000f}, - {0x7fffffff80000000, 0x12345678ffffffff, 0x00000010}, - {0x1169751bb9a7d9c3, 0xf7a594aec8ef8a9c, 0x0000001f}, - {0x2b665362c4e812df, 0x3a0d80d68b3f8bc8, 0x0000000f}, - {0xf35862e13e38f8b0, 0x4f41ffdef2bfe636, 0x00000010}, - {0x1169751bb9a7d9c3, 0xf7a594aec8ef8a9c, 0x00000015}, - {0x2b665362c4e812df, 0x3a0d80d68b3f8bc8, 0x00000009}, - {0xf35862e13e38f8b0, 0x4f41ffdef2bfe636, 0x00000003}}; + // ws_lo, ws_hi, i5 + {0x7F80FF3480FF7F00, 0x8D7FFF80FF7F6780, 0x0000001F}, + {0x7F80FF3480FF7F00, 0x8D7FFF80FF7F6780, 0x0000000F}, + {0x7F80FF3480FF7F00, 0x8D7FFF80FF7F6780, 0x00000010}, + {0x80007FFF91DAFFFF, 0x7FFF8000FFFF5678, 0x0000001F}, + {0x80007FFF91DAFFFF, 0x7FFF8000FFFF5678, 0x0000000F}, + {0x80007FFF91DAFFFF, 0x7FFF8000FFFF5678, 0x00000010}, + {0x7FFFFFFF80000000, 0x12345678FFFFFFFF, 0x0000001F}, + {0x7FFFFFFF80000000, 0x12345678FFFFFFFF, 0x0000000F}, + {0x7FFFFFFF80000000, 0x12345678FFFFFFFF, 0x00000010}, + {0x1169751BB9A7D9C3, 0xF7A594AEC8EF8A9C, 0x0000001F}, + {0x2B665362C4E812DF, 0x3A0D80D68B3F8BC8, 0x0000000F}, + {0xF35862E13E38F8B0, 0x4F41FFDEF2BFE636, 0x00000010}, + {0x1169751BB9A7D9C3, 0xF7A594AEC8EF8A9C, 0x00000015}, + {0x2B665362C4E812DF, 0x3A0D80D68B3F8BC8, 0x00000009}, + {0xF35862E13E38F8B0, 0x4F41FFDEF2BFE636, 0x00000003} + }; +// clang-format on #define MAXI_MINI_S_DF(lanes, mask, func) \ [](uint64_t ws, uint32_t ui5) { \ @@ -7801,18 +7799,18 @@ TEST(MSA_ceqi_clti_clei) { CcTest::InitializeVM(); struct TestCaseMsaI5 tc[] = { - {0xff69751bb9a7d9c3, 0xf7a594aec8ff8a9c, 0x0000001f}, - {0xe669ffffb9a7d9c3, 0xf7a594aeffff8a9c, 0x0000001f}, - {0xffffffffb9a7d9c3, 0xf7a594aeffffffff, 0x0000001f}, - {0x2b0b5362c4e812df, 0x3a0d80d68b3f0bc8, 0x0000000b}, - {0x2b66000bc4e812df, 0x3a0d000b8b3f8bc8, 0x0000000b}, - {0x0000000bc4e812df, 0x3a0d80d60000000b, 0x0000000b}, - {0xf38062e13e38f8b0, 0x8041ffdef2bfe636, 0x00000010}, - {0xf35880003e38f8b0, 0x4f41ffdef2bf8000, 0x00000010}, - {0xf35862e180000000, 0x80000000f2bfe636, 0x00000010}, - {0x1169751bb9a7d9c3, 0xf7a594aec8ef8a9c, 0x00000015}, - {0x2b665362c4e812df, 0x3a0d80d68b3f8bc8, 0x00000009}, - {0xf30062e13e38f800, 0x4f00ffdef2bf0036, 0x00000000}}; + {0xFF69751BB9A7D9C3, 0xF7A594AEC8FF8A9C, 0x0000001F}, + {0xE669FFFFB9A7D9C3, 0xF7A594AEFFFF8A9C, 0x0000001F}, + {0xFFFFFFFFB9A7D9C3, 0xF7A594AEFFFFFFFF, 0x0000001F}, + {0x2B0B5362C4E812DF, 0x3A0D80D68B3F0BC8, 0x0000000B}, + {0x2B66000BC4E812DF, 0x3A0D000B8B3F8BC8, 0x0000000B}, + {0x0000000BC4E812DF, 0x3A0D80D60000000B, 0x0000000B}, + {0xF38062E13E38F8B0, 0x8041FFDEF2BFE636, 0x00000010}, + {0xF35880003E38F8B0, 0x4F41FFDEF2BF8000, 0x00000010}, + {0xF35862E180000000, 0x80000000F2BFE636, 0x00000010}, + {0x1169751BB9A7D9C3, 0xF7A594AEC8EF8A9C, 0x00000015}, + {0x2B665362C4E812DF, 0x3A0D80D68B3F8BC8, 0x00000009}, + {0xF30062E13E38F800, 0x4F00FFDEF2BF0036, 0x00000000}}; #define CEQI_CLTI_CLEI_S_DF(lanes, mask, func) \ [](uint64_t ws, uint32_t ui5) { \ @@ -7995,9 +7993,9 @@ void run_msa_2r(const struct TestCaseMsa2R* input, #ifdef OBJECT_PRINT code->Print(std::cout); #endif - F3 f = FUNCTION_CAST<F3>(code->entry()); + auto f = GeneratedCode<F3>::FromCode(*code); - (CALL_GENERATED_CODE(isolate, f, &res, 0, 0, 0, 0)); + f.Call(&res, 0, 0, 0, 0); CHECK_EQ(input->exp_res_lo, res.d[0]); CHECK_EQ(input->exp_res_hi, res.d[1]); @@ -8011,44 +8009,44 @@ TEST(MSA_pcnt) { struct TestCaseMsa2R tc_b[] = {// ws_lo, ws_hi, exp_res_lo, exp_res_hi {0x0000000000000000, 0x0000000000000000, 0, 0}, - {0xffffffffffffffff, 0xffffffffffffffff, + {0xFFFFFFFFFFFFFFFF, 0xFFFFFFFFFFFFFFFF, 0x0808080808080808, 0x0808080808080808}, - {0x1169751bb9a7d9c3, 0xf7a594aec8ef8a9c, + {0x1169751BB9A7D9C3, 0xF7A594AEC8EF8A9C, 0x0204050405050504, 0x0704030503070304}, - {0x2b665362c4e812df, 0x3a0d80d68b3f8bc8, + {0x2B665362C4E812DF, 0x3A0D80D68B3F8BC8, 0x0404040303040207, 0x0403010504060403}, - {0xf35862e13e38f8b0, 0x4f41ffdef2bfe636, + {0xF35862E13E38F8B0, 0x4F41FFDEF2BFE636, 0x0603030405030503, 0x0502080605070504}}; struct TestCaseMsa2R tc_h[] = {// ws_lo, ws_hi, exp_res_lo, exp_res_hi {0x0000000000000000, 0x0000000000000000, 0, 0}, - {0xffffffffffffffff, 0xffffffffffffffff, + {0xFFFFFFFFFFFFFFFF, 0xFFFFFFFFFFFFFFFF, 0x0010001000100010, 0x0010001000100010}, - {0x1169751bb9a7d9c3, 0xf7a594aec8ef8a9c, - 0x00060009000a0009, 0x000b0008000a0007}, - {0x2b665362c4e812df, 0x3a0d80d68b3f8bc8, - 0x0008000700070009, 0x00070006000a0007}, - {0xf35862e13e38f8b0, 0x4f41ffdef2bfe636, - 0x0009000700080008, 0x0007000e000c0009}}; + {0x1169751BB9A7D9C3, 0xF7A594AEC8EF8A9C, + 0x00060009000A0009, 0x000B0008000A0007}, + {0x2B665362C4E812DF, 0x3A0D80D68B3F8BC8, + 0x0008000700070009, 0x00070006000A0007}, + {0xF35862E13E38F8B0, 0x4F41FFDEF2BFE636, + 0x0009000700080008, 0x0007000E000C0009}}; struct TestCaseMsa2R tc_w[] = {// ws_lo, ws_hi, exp_res_lo, exp_res_hi {0x0000000000000000, 0x0000000000000000, 0, 0}, - {0xffffffffffffffff, 0xffffffffffffffff, + {0xFFFFFFFFFFFFFFFF, 0xFFFFFFFFFFFFFFFF, 0x0000002000000020, 0x0000002000000020}, - {0x1169751bb9a7d9c3, 0xf7a594aec8ef8a9c, - 0x0000000f00000013, 0x0000001300000011}, - {0x2b665362c4e812df, 0x3a0d80d68b3f8bc8, - 0x0000000f00000010, 0x0000000d00000011}, - {0xf35862e13e38f8b0, 0x4f41ffdef2bfe636, + {0x1169751BB9A7D9C3, 0xF7A594AEC8EF8A9C, + 0x0000000F00000013, 0x0000001300000011}, + {0x2B665362C4E812DF, 0x3A0D80D68B3F8BC8, + 0x0000000F00000010, 0x0000000D00000011}, + {0xF35862E13E38F8B0, 0x4F41FFDEF2BFE636, 0x0000001000000010, 0x0000001500000015}}; struct TestCaseMsa2R tc_d[] = { // ws_lo, ws_hi, exp_res_lo, exp_res_hi {0x0000000000000000, 0x0000000000000000, 0, 0}, - {0xffffffffffffffff, 0xffffffffffffffff, 0x40, 0x40}, - {0x1169751bb9a7d9c3, 0xf7a594aec8ef8a9c, 0x22, 0x24}, - {0x2b665362c4e812df, 0x3a0d80d68b3f8bc8, 0x1f, 0x1e}, - {0xf35862e13e38f8b0, 0x4f41ffdef2bfe636, 0x20, 0x2a}}; + {0xFFFFFFFFFFFFFFFF, 0xFFFFFFFFFFFFFFFF, 0x40, 0x40}, + {0x1169751BB9A7D9C3, 0xF7A594AEC8EF8A9C, 0x22, 0x24}, + {0x2B665362C4E812DF, 0x3A0D80D68B3F8BC8, 0x1F, 0x1E}, + {0xF35862E13E38F8B0, 0x4F41FFDEF2BFE636, 0x20, 0x2A}}; for (size_t i = 0; i < sizeof(tc_b) / sizeof(TestCaseMsa2R); ++i) { run_msa_2r(&tc_b[i], [](MacroAssembler& assm) { __ pcnt_b(w2, w0); }); @@ -8067,43 +8065,43 @@ TEST(MSA_nlzc) { struct TestCaseMsa2R tc_b[] = {// ws_lo, ws_hi, exp_res_lo, exp_res_hi {0x0000000000000000, 0x0000000000000000, 0x0808080808080808, 0x0808080808080808}, - {0xffffffffffffffff, 0xffffffffffffffff, 0, 0}, - {0x1169350b07030100, 0x7f011402381f0a6c, + {0xFFFFFFFFFFFFFFFF, 0xFFFFFFFFFFFFFFFF, 0, 0}, + {0x1169350B07030100, 0x7F011402381F0A6C, 0x0301020405060708, 0x0107030602030401}, - {0x010806003478121f, 0x03013016073f7b08, + {0x010806003478121F, 0x03013016073F7B08, 0x0704050802010303, 0x0607020305020104}, - {0x0168321100083803, 0x07113f03013f1676, + {0x0168321100083803, 0x07113F03013F1676, 0x0701020308040206, 0x0503020607020301}}; struct TestCaseMsa2R tc_h[] = {// ws_lo, ws_hi, exp_res_lo, exp_res_hi {0x0000000000000000, 0x0000000000000000, 0x0010001000100010, 0x0010001000100010}, - {0xffffffffffffffff, 0xffffffffffffffff, 0, 0}, - {0x00010007000a003c, 0x37a5001e00010002, - 0x000f000d000c000a, 0x0002000b000f000e}, - {0x0026066200780edf, 0x003d0003000f00c8, - 0x000a000500090004, 0x000a000e000c0008}, - {0x335807e100480030, 0x01410fde12bf5636, - 0x000200050009000a, 0x0007000400030001}}; + {0xFFFFFFFFFFFFFFFF, 0xFFFFFFFFFFFFFFFF, 0, 0}, + {0x00010007000A003C, 0x37A5001E00010002, + 0x000F000D000C000A, 0x0002000B000F000E}, + {0x0026066200780EDF, 0x003D0003000F00C8, + 0x000A000500090004, 0x000A000E000C0008}, + {0x335807E100480030, 0x01410FDE12BF5636, + 0x000200050009000A, 0x0007000400030001}}; struct TestCaseMsa2R tc_w[] = {// ws_lo, ws_hi, exp_res_lo, exp_res_hi {0x0000000000000000, 0x0000000000000000, 0x0000002000000020, 0x0000002000000020}, - {0xffffffffffffffff, 0xffffffffffffffff, 0, 0}, - {0x00000005000007c3, 0x000014ae00006a9c, - 0x0000001d00000015, 0x0000001300000011}, - {0x00009362000112df, 0x000380d6003f8bc8, - 0x000000100000000f, 0x0000000e0000000a}, - {0x135862e17e38f8b0, 0x0061ffde03bfe636, + {0xFFFFFFFFFFFFFFFF, 0xFFFFFFFFFFFFFFFF, 0, 0}, + {0x00000005000007C3, 0x000014AE00006A9C, + 0x0000001D00000015, 0x0000001300000011}, + {0x00009362000112DF, 0x000380D6003F8BC8, + 0x000000100000000F, 0x0000000E0000000A}, + {0x135862E17E38F8B0, 0x0061FFDE03BFE636, 0x0000000300000001, 0x0000000900000006}}; struct TestCaseMsa2R tc_d[] = { // ws_lo, ws_hi, exp_res_lo, exp_res_hi {0x0000000000000000, 0x0000000000000000, 0x40, 0x40}, - {0xffffffffffffffff, 0xffffffffffffffff, 0, 0}, - {0x000000000000014e, 0x00000000000176da, 0x37, 0x2f}, - {0x00000062c4e812df, 0x000065d68b3f8bc8, 0x19, 0x11}, - {0x00000000e338f8b0, 0x0754534acab32654, 0x20, 0x5}}; + {0xFFFFFFFFFFFFFFFF, 0xFFFFFFFFFFFFFFFF, 0, 0}, + {0x000000000000014E, 0x00000000000176DA, 0x37, 0x2F}, + {0x00000062C4E812DF, 0x000065D68B3F8BC8, 0x19, 0x11}, + {0x00000000E338F8B0, 0x0754534ACAB32654, 0x20, 0x5}}; for (size_t i = 0; i < sizeof(tc_b) / sizeof(TestCaseMsa2R); ++i) { run_msa_2r(&tc_b[i], [](MacroAssembler& assm) { __ nlzc_b(w2, w0); }); @@ -8120,7 +8118,7 @@ TEST(MSA_nloc) { CcTest::InitializeVM(); struct TestCaseMsa2R tc_b[] = {// ws_lo, ws_hi, exp_res_lo, exp_res_hi - {0xffffffffffffffff, 0xffffffffffffffff, + {0xFFFFFFFFFFFFFFFF, 0xFFFFFFFFFFFFFFFF, 0x0808080808080808, 0x0808080808080808}, {0x0000000000000000, 0x0000000000000000, 0, 0}, {0xEE96CAF4F8FCFEFF, 0x80FEEBFDC7E0F593, @@ -8131,32 +8129,32 @@ TEST(MSA_nloc) { 0x0701020308040206, 0x0503020607020301}}; struct TestCaseMsa2R tc_h[] = {// ws_lo, ws_hi, exp_res_lo, exp_res_hi - {0xffffffffffffffff, 0xffffffffffffffff, + {0xFFFFFFFFFFFFFFFF, 0xFFFFFFFFFFFFFFFF, 0x0010001000100010, 0x0010001000100010}, {0x0000000000000000, 0x0000000000000000, 0, 0}, {0xFFFEFFF8FFF5FFC3, 0xC85AFFE1FFFEFFFD, - 0x000f000d000c000a, 0x0002000b000f000e}, + 0x000F000D000C000A, 0x0002000B000F000E}, {0xFFD9F99DFF87F120, 0xFFC2FFFCFFF0FF37, - 0x000a000500090004, 0x000a000e000c0008}, + 0x000A000500090004, 0x000A000E000C0008}, {0xCCA7F81EFFB7FFCF, 0xFEBEF021ED40A9C9, - 0x000200050009000a, 0x0007000400030001}}; + 0x000200050009000A, 0x0007000400030001}}; struct TestCaseMsa2R tc_w[] = {// ws_lo, ws_hi, exp_res_lo, exp_res_hi - {0xffffffffffffffff, 0xffffffffffffffff, + {0xFFFFFFFFFFFFFFFF, 0xFFFFFFFFFFFFFFFF, 0x0000002000000020, 0x0000002000000020}, {0x0000000000000000, 0x0000000000000000, 0, 0}, {0xFFFFFFFAFFFFF83C, 0xFFFFEB51FFFF9563, - 0x0000001d00000015, 0x0000001300000011}, + 0x0000001D00000015, 0x0000001300000011}, {0xFFFF6C9DFFFEED20, 0xFFFC7F29FFC07437, - 0x000000100000000f, 0x0000000e0000000a}, + 0x000000100000000F, 0x0000000E0000000A}, {0xECA79D1E81C7074F, 0xFF9E0021FC4019C9, 0x0000000300000001, 0x0000000900000006}}; struct TestCaseMsa2R tc_d[] = { // ws_lo, ws_hi, exp_res_lo, exp_res_hi - {0xffffffffffffffff, 0xffffffffffffffff, 0x40, 0x40}, + {0xFFFFFFFFFFFFFFFF, 0xFFFFFFFFFFFFFFFF, 0x40, 0x40}, {0x0000000000000000, 0x0000000000000000, 0, 0}, - {0xFFFFFFFFFFFFFEB1, 0xFFFFFFFFFFFE8925, 0x37, 0x2f}, + {0xFFFFFFFFFFFFFEB1, 0xFFFFFFFFFFFE8925, 0x37, 0x2F}, {0xFFFFFF9D3B17ED20, 0xFFFF9A2974C07437, 0x19, 0x11}, {0xFFFFFFFF1CC7074F, 0xF8ABACB5354CD9AB, 0x20, 0x5}}; @@ -8894,11 +8892,11 @@ TEST(MSA_fexupl) { const double inf_double = std::numeric_limits<double>::infinity(); struct TestCaseMsa2RF_U16_F tc_s[] = { - {1, 2, 0x7c00, 0x0c00, 0, 0x7c00, 0xfc00, 0x8000, 0.f, inf_float, + {1, 2, 0x7C00, 0x0C00, 0, 0x7C00, 0xFC00, 0x8000, 0.f, inf_float, -inf_float, -0.f}, - {0xfc00, 0xffff, 0x00ff, 0x8000, 0x81fe, 0x8000, 0x0345, 0xaaaa, + {0xFC00, 0xFFFF, 0x00FF, 0x8000, 0x81FE, 0x8000, 0x0345, 0xAAAA, -3.0398368835e-5f, -0.f, 4.9889088e-5f, -5.2062988281e-2f}, - {3, 4, 0x5555, 6, 0x2aaa, 0x8700, 0x7777, 0x6a8b, 5.2062988281e-2f, + {3, 4, 0x5555, 6, 0x2AAA, 0x8700, 0x7777, 0x6A8B, 5.2062988281e-2f, -1.06811523458e-4f, 3.0576e4f, 3.35e3f}}; struct TestCaseMsa2RF_F_D tc_d[] = { @@ -8927,11 +8925,11 @@ TEST(MSA_fexupr) { const double inf_double = std::numeric_limits<double>::infinity(); struct TestCaseMsa2RF_U16_F tc_s[] = { - {0, 0x7c00, 0xfc00, 0x8000, 1, 2, 0x7c00, 0x0c00, 0.f, inf_float, + {0, 0x7C00, 0xFC00, 0x8000, 1, 2, 0x7C00, 0x0C00, 0.f, inf_float, -inf_float, -0.f}, - {0x81fe, 0x8000, 0x0345, 0xaaaa, 0xfc00, 0xffff, 0x00ff, 0x8000, + {0x81FE, 0x8000, 0x0345, 0xAAAA, 0xFC00, 0xFFFF, 0x00FF, 0x8000, -3.0398368835e-5f, -0.f, 4.9889088e-5f, -5.2062988281e-2f}, - {0x2aaa, 0x8700, 0x7777, 0x6a8b, 3, 4, 0x5555, 6, 5.2062988281e-2f, + {0x2AAA, 0x8700, 0x7777, 0x6A8B, 3, 4, 0x5555, 6, 5.2062988281e-2f, -1.06811523458e-4f, 3.0576e4f, 3.35e3f}}; struct TestCaseMsa2RF_F_D tc_d[] = { @@ -8965,13 +8963,13 @@ TEST(MSA_ffql) { CcTest::InitializeVM(); - struct TestCaseMsa2RF_U16_F tc_s[] = {{0, 3, 0xffff, 0x8000, 0x8000, 0xe000, + struct TestCaseMsa2RF_U16_F tc_s[] = {{0, 3, 0xFFFF, 0x8000, 0x8000, 0xE000, 0x0FF0, 0, -1.f, -0.25f, 0.12451171875f, 0.f}}; struct TestCaseMsa2RF_U32_D tc_d[] = { - {0, 45, 0x80000000, 0xe0000000, -1., -0.25}, - {0x28379, 0xaaaa5555, 0x024903d3, 0, 17.853239085525274277e-3, 0.}}; + {0, 45, 0x80000000, 0xE0000000, -1., -0.25}, + {0x28379, 0xAAAA5555, 0x024903D3, 0, 17.853239085525274277e-3, 0.}}; for (size_t i = 0; i < sizeof(tc_s) / sizeof(TestCaseMsa2RF_U16_F); ++i) { run_msa_2r(reinterpret_cast<const TestCaseMsa2R*>(&tc_s[i]), @@ -8989,13 +8987,13 @@ TEST(MSA_ffqr) { CcTest::InitializeVM(); - struct TestCaseMsa2RF_U16_F tc_s[] = {{0x8000, 0xe000, 0x0FF0, 0, 0, 3, - 0xffff, 0x8000, -1.f, -0.25f, + struct TestCaseMsa2RF_U16_F tc_s[] = {{0x8000, 0xE000, 0x0FF0, 0, 0, 3, + 0xFFFF, 0x8000, -1.f, -0.25f, 0.12451171875f, 0.f}}; struct TestCaseMsa2RF_U32_D tc_d[] = { - {0x80000000, 0xe0000000, 0, 45, -1., -0.25}, - {0x024903d3, 0, 0x28379, 0xaaaa5555, 17.853239085525274277e-3, 0.}}; + {0x80000000, 0xE0000000, 0, 45, -1., -0.25}, + {0x024903D3, 0, 0x28379, 0xAAAA5555, 17.853239085525274277e-3, 0.}}; for (size_t i = 0; i < sizeof(tc_s) / sizeof(TestCaseMsa2RF_U16_F); ++i) { run_msa_2r(reinterpret_cast<const TestCaseMsa2R*>(&tc_s[i]), @@ -9046,9 +9044,9 @@ void run_msa_vector(struct TestCaseMsaVector* input, #ifdef OBJECT_PRINT code->Print(std::cout); #endif - F3 f = FUNCTION_CAST<F3>(code->entry()); + auto f = GeneratedCode<F3>::FromCode(*code); - (CALL_GENERATED_CODE(isolate, f, &res, 0, 0, 0, 0)); + f.Call(&res, 0, 0, 0, 0); CHECK_EQ(GenerateOperationFunc(input->wd_lo, input->ws_lo, input->wt_lo), res.d[0]); @@ -9064,12 +9062,12 @@ TEST(MSA_vector) { struct TestCaseMsaVector tc[] = { // wd_lo, wd_hi, ws_lo, ws_hi, wt_lo, wt_hi - {0xf35862e13e38f8b0, 0x4f41ffdef2bfe636, 0xdcd39d91f9057627, - 0x64be4f6dbe9caa51, 0x6b23de1a687d9cb9, 0x49547aad691da4ca}, - {0xf35862e13e38f8b0, 0x4f41ffdef2bfe636, 0x401614523d830549, - 0xd7c46d613f50eddd, 0x52284cbc60a1562b, 0x1756ed510d8849cd}, - {0xf35862e13e38f8b0, 0x4f41ffdef2bfe636, 0xd6e2d2ebcb40d72f, - 0x13a619afce67b079, 0x36cce284343e40f9, 0xb4e8f44fd148bf7f}}; + {0xF35862E13E38F8B0, 0x4F41FFDEF2BFE636, 0xDCD39D91F9057627, + 0x64BE4F6DBE9CAA51, 0x6B23DE1A687D9CB9, 0x49547AAD691DA4CA}, + {0xF35862E13E38F8B0, 0x4F41FFDEF2BFE636, 0x401614523D830549, + 0xD7C46D613F50EDDD, 0x52284CBC60A1562B, 0x1756ED510D8849CD}, + {0xF35862E13E38F8B0, 0x4F41FFDEF2BFE636, 0xD6E2D2EBCB40D72F, + 0x13A619AFCE67B079, 0x36CCE284343E40F9, 0xB4E8F44FD148BF7F}}; for (size_t i = 0; i < sizeof(tc) / sizeof(TestCaseMsaVector); ++i) { run_msa_vector( @@ -9135,9 +9133,9 @@ void run_msa_bit(struct TestCaseMsaBit* input, InstFunc GenerateInstructionFunc, #ifdef OBJECT_PRINT code->Print(std::cout); #endif - F3 f = FUNCTION_CAST<F3>(code->entry()); + auto f = GeneratedCode<F3>::FromCode(*code); - (CALL_GENERATED_CODE(isolate, f, &res, 0, 0, 0, 0)); + f.Call(&res, 0, 0, 0, 0); CHECK_EQ(GenerateOperationFunc(input->wd_lo, input->ws_lo, input->m), res.d[0]); @@ -9153,14 +9151,14 @@ TEST(MSA_slli_srai_srli) { struct TestCaseMsaBit tc[] = { // wd_lo, wd_hi ws_lo, ws_hi, m - {0, 0, 0xf35862e13e38f8b0, 0x4f41ffdef2bfe636, 3}, - {0, 0, 0x64be4f6dbe9caa51, 0x6b23de1a687d9cb9, 5}, - {0, 0, 0x1169751bb9a7d9c3, 0xf7a594aec8ef8a9c, 9}, - {0, 0, 0x2b665362c4e812df, 0x3a0d80d68b3f8bc8, 13}, - {0, 0, 0x566be7ba4365b70a, 0x01ebbc1937d76cb4, 21}, - {0, 0, 0x380e2deb9d3f8aae, 0x017e0de0bcc6ca42, 30}, - {0, 0, 0xa46a3a9bcb43f4e5, 0x1c62c8473bdfcffb, 45}, - {0, 0, 0xf6759d85f23b5a2b, 0x5c042ae42c6d12c1, 61}}; + {0, 0, 0xF35862E13E38F8B0, 0x4F41FFDEF2BFE636, 3}, + {0, 0, 0x64BE4F6DBE9CAA51, 0x6B23DE1A687D9CB9, 5}, + {0, 0, 0x1169751BB9A7D9C3, 0xF7A594AEC8EF8A9C, 9}, + {0, 0, 0x2B665362C4E812DF, 0x3A0D80D68B3F8BC8, 13}, + {0, 0, 0x566BE7BA4365B70A, 0x01EBBC1937D76CB4, 21}, + {0, 0, 0x380E2DEB9D3F8AAE, 0x017E0DE0BCC6CA42, 30}, + {0, 0, 0xA46A3A9BCB43F4E5, 0x1C62C8473BDFCFFB, 45}, + {0, 0, 0xF6759D85F23B5A2B, 0x5C042AE42C6D12C1, 61}}; #define SLLI_SRLI_DF(lanes, mask, func) \ [](uint64_t wd, uint64_t ws, uint32_t m) { \ @@ -9306,14 +9304,14 @@ TEST(MSA_bclri_bseti_bnegi) { struct TestCaseMsaBit tc[] = { // wd_lo, wd_hi, ws_lo, ws_hi, m - {0, 0, 0xf35862e13e38f8b0, 0x4f41ffdef2bfe636, 3}, - {0, 0, 0x64be4f6dbe9caa51, 0x6b23de1a687d9cb9, 5}, - {0, 0, 0x1169751bb9a7d9c3, 0xf7a594aec8ef8a9c, 9}, - {0, 0, 0x2b665362c4e812df, 0x3a0d80d68b3f8bc8, 13}, - {0, 0, 0x566be7ba4365b70a, 0x01ebbc1937d76cb4, 21}, - {0, 0, 0x380e2deb9d3f8aae, 0x017e0de0bcc6ca42, 30}, - {0, 0, 0xa46a3a9bcb43f4e5, 0x1c62c8473bdfcffb, 45}, - {0, 0, 0xf6759d85f23b5a2b, 0x5c042ae42c6d12c1, 61}}; + {0, 0, 0xF35862E13E38F8B0, 0x4F41FFDEF2BFE636, 3}, + {0, 0, 0x64BE4F6DBE9CAA51, 0x6B23DE1A687D9CB9, 5}, + {0, 0, 0x1169751BB9A7D9C3, 0xF7A594AEC8EF8A9C, 9}, + {0, 0, 0x2B665362C4E812DF, 0x3A0D80D68B3F8BC8, 13}, + {0, 0, 0x566BE7BA4365B70A, 0x01EBBC1937D76CB4, 21}, + {0, 0, 0x380E2DEB9D3F8AAE, 0x017E0DE0BCC6CA42, 30}, + {0, 0, 0xA46A3A9BCB43F4E5, 0x1C62C8473BDFCFFB, 45}, + {0, 0, 0xF6759D85F23B5A2B, 0x5C042AE42C6D12C1, 61}}; #define BCLRI_BSETI_BNEGI_DF(lanes, mask, func) \ [](uint64_t wd, uint64_t ws, uint32_t m) { \ @@ -9401,22 +9399,22 @@ TEST(MSA_binsli_binsri) { CcTest::InitializeVM(); struct TestCaseMsaBit tc[] = {// wd_lo, wd_hi, ws_lo, ws_hi, m - {0x53f4457553bbd5b4, 0x5fb8250eacc296b2, - 0xf35862e13e38f8b0, 0x4f41ffdef2bfe636, 3}, - {0xf61bfdb0f312e6fc, 0xc9437568dd1ea925, - 0x64be4f6dbe9caa51, 0x6b23de1a687d9cb9, 5}, - {0x53f4457553bbd5b4, 0x5fb8250eacc296b2, - 0x1169751bb9a7d9c3, 0xf7a594aec8ef8a9c, 9}, - {0xf61bfdb0f312e6fc, 0xc9437568dd1ea925, - 0x2b665362c4e812df, 0x3a0d80d68b3f8bc8, 13}, - {0x53f4457553bbd5b4, 0x5fb8250eacc296b2, - 0x566be7ba4365b70a, 0x01ebbc1937d76cb4, 21}, - {0xf61bfdb0f312e6fc, 0xc9437568dd1ea925, - 0x380e2deb9d3f8aae, 0x017e0de0bcc6ca42, 30}, - {0x53f4457553bbd5b4, 0x5fb8250eacc296b2, - 0xa46a3a9bcb43f4e5, 0x1c62c8473bdfcffb, 45}, - {0xf61bfdb0f312e6fc, 0xc9437568dd1ea925, - 0xf6759d85f23b5a2b, 0x5c042ae42c6d12c1, 61}}; + {0x53F4457553BBD5B4, 0x5FB8250EACC296B2, + 0xF35862E13E38F8B0, 0x4F41FFDEF2BFE636, 3}, + {0xF61BFDB0F312E6FC, 0xC9437568DD1EA925, + 0x64BE4F6DBE9CAA51, 0x6B23DE1A687D9CB9, 5}, + {0x53F4457553BBD5B4, 0x5FB8250EACC296B2, + 0x1169751BB9A7D9C3, 0xF7A594AEC8EF8A9C, 9}, + {0xF61BFDB0F312E6FC, 0xC9437568DD1EA925, + 0x2B665362C4E812DF, 0x3A0D80D68B3F8BC8, 13}, + {0x53F4457553BBD5B4, 0x5FB8250EACC296B2, + 0x566BE7BA4365B70A, 0x01EBBC1937D76CB4, 21}, + {0xF61BFDB0F312E6FC, 0xC9437568DD1EA925, + 0x380E2DEB9D3F8AAE, 0x017E0DE0BCC6CA42, 30}, + {0x53F4457553BBD5B4, 0x5FB8250EACC296B2, + 0xA46A3A9BCB43F4E5, 0x1C62C8473BDFCFFB, 45}, + {0xF61BFDB0F312E6FC, 0xC9437568DD1EA925, + 0xF6759D85F23B5A2B, 0x5C042AE42C6D12C1, 61}}; #define BINSLI_BINSRI_DF(lanes, mask, func) \ [](uint64_t wd, uint64_t ws, uint32_t m) { \ @@ -9493,14 +9491,14 @@ TEST(MSA_sat_s_sat_u) { struct TestCaseMsaBit tc[] = { // wd_lo, wd_hi, ws_lo, ws_hi, m - {0, 0, 0xf35862e13e3808b0, 0x4f41ffdef2bfe636, 3}, - {0, 0, 0x64be4f6dbe9caa51, 0x6b23de1a687d9cb9, 5}, - {0, 0, 0x1169751bb9a7d9c3, 0xf7a594aec8ef8a9c, 9}, - {0, 0, 0x2b665362c4e812df, 0x3a0d80d68b3f8bc8, 13}, - {0, 0, 0x566be7ba4365b70a, 0x01ebbc1937d76cb4, 21}, - {0, 0, 0x380e2deb9d3f8aae, 0x017e0de0bcc6ca42, 30}, - {0, 0, 0xa46a3a9bcb43f4e5, 0x1c62c8473bdfcffb, 45}, - {0, 0, 0xf6759d85f23b5a2b, 0x5c042ae42c6d12c1, 61}}; + {0, 0, 0xF35862E13E3808B0, 0x4F41FFDEF2BFE636, 3}, + {0, 0, 0x64BE4F6DBE9CAA51, 0x6B23DE1A687D9CB9, 5}, + {0, 0, 0x1169751BB9A7D9C3, 0xF7A594AEC8EF8A9C, 9}, + {0, 0, 0x2B665362C4E812DF, 0x3A0D80D68B3F8BC8, 13}, + {0, 0, 0x566BE7BA4365B70A, 0x01EBBC1937D76CB4, 21}, + {0, 0, 0x380E2DEB9D3F8AAE, 0x017E0DE0BCC6CA42, 30}, + {0, 0, 0xA46A3A9BCB43F4E5, 0x1C62C8473BDFCFFB, 45}, + {0, 0, 0xF6759D85F23B5A2B, 0x5C042AE42C6D12C1, 61}}; #define SAT_DF(lanes, mask, func) \ [](uint64_t wd, uint64_t ws, uint32_t m) { \ @@ -9609,9 +9607,9 @@ void run_msa_i10(int32_t input, InstFunc GenerateVectorInstructionFunc, #ifdef OBJECT_PRINT code->Print(std::cout); #endif - F3 f = FUNCTION_CAST<F3>(code->entry()); + auto f = GeneratedCode<F3>::FromCode(*code); - (CALL_GENERATED_CODE(isolate, f, &res, 0, 0, 0, 0)); + f.Call(&res, 0, 0, 0, 0); CHECK_EQ(GenerateOperationFunc(input), res.d[0]); CHECK_EQ(GenerateOperationFunc(input), res.d[1]); @@ -9688,9 +9686,9 @@ void run_msa_mi10(InstFunc GenerateVectorInstructionFunc) { #ifdef OBJECT_PRINT code->Print(std::cout); #endif - F5 f = FUNCTION_CAST<F5>(code->entry()); + auto f = GeneratedCode<F5>::FromCode(*code); - (CALL_GENERATED_CODE(isolate, f, in_array_middle, out_array_middle, 0, 0, 0)); + f.Call(in_array_middle, out_array_middle, 0, 0, 0); CHECK_EQ(memcmp(in_test_vector, out_test_vector, arraysize(in_test_vector)), 0); @@ -9768,9 +9766,9 @@ void run_msa_3r(struct TestCaseMsa3R* input, InstFunc GenerateI5InstructionFunc, #ifdef OBJECT_PRINT code->Print(std::cout); #endif - F3 f = FUNCTION_CAST<F3>(code->entry()); + auto f = GeneratedCode<F3>::FromCode(*code); - (CALL_GENERATED_CODE(isolate, f, &res, 0, 0, 0, 0)); + f.Call(&res, 0, 0, 0, 0); GenerateOperationFunc(&input->ws_lo, &input->wt_lo, &input->wd_lo); if (input->wd_lo != Unpredictable) { @@ -9787,32 +9785,32 @@ TEST(MSA_3R_instructions) { CcTest::InitializeVM(); struct TestCaseMsa3R tc[] = { - {0x1169751bb9a7d9c3, 0xf7a594aec8ef8a9c, 0x1169751bb9a7d9c3, - 0xf7a594aec8ef8a9c, 0x1169751bb9a7d9c3, 0xf7a594aec8ef8a9c}, - {0x2b665362c4e812df, 0x3a0d80d68b3f8bc8, 0x2b665362c4e812df, - 0x3a0d80d68b3f8bc8, 0x2b665362c4e812df, 0x3a0d80d68b3f8bc8}, - {0x1169751bb9a7d9c3, 0xf7a594aec8ef8a9c, 0x1169751bb9a7d9c3, - 0xf7a594aec8ef8a9c, 0x1169751bb9a7d9c3, 0xf7a594aec8ef8a9c}, - {0x2b665362c4e812df, 0x3a0d80d68b3f8bc8, 0x2b665362c4e812df, - 0x3a0d80d68b3f8bc8, 0x2b665362c4e812df, 0x3a0d80d68b3f8bc8}, - {0xffab807f807fffcd, 0x7f23ff80ff567f80, 0xffab807f807fffcd, - 0x7f23ff80ff567f80, 0xffab807f807fffcd, 0x7f23ff80ff567f80}, - {0x80ffefff7f12807f, 0x807f80ff7fdeff78, 0x80ffefff7f12807f, - 0x807f80ff7fdeff78, 0x80ffefff7f12807f, 0x807f80ff7fdeff78}, - {0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, - 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff}, - {0x0000000000000000, 0xffffffffffffffff, 0xffffffffffffffff, - 0x0000000000000000, 0x0000000000000000, 0xffffffffffffffff}, - {0xffff0000ffff0000, 0xffff0000ffff0000, 0xffff0000ffff0000, - 0xffff0000ffff0000, 0xffff0000ffff0000, 0xffff0000ffff0000}, - {0xff00ff00ff00ff00, 0xff00ff00ff00ff00, 0xff00ff00ff00ff00, - 0xff00ff00ff00ff00, 0xff00ff00ff00ff00, 0xff00ff00ff00ff00}, - {0xf0f0f0f0f0f0f0f0, 0xf0f0f0f0f0f0f0f0, 0xf0f0f0f0f0f0f0f0, - 0xf0f0f0f0f0f0f0f0, 0xf0f0f0f0f0f0f0f0, 0xf0f0f0f0f0f0f0f0}, - {0xff0000ffff0000ff, 0xff0000ffff0000ff, 0xff0000ffff0000ff, - 0xff0000ffff0000ff, 0xff0000ffff0000ff, 0xff0000ffff0000ff}, - {0xffff00000000ffff, 0xffff00000000ffff, 0xffff00000000ffff, - 0xffff00000000ffff, 0xffff00000000ffff, 0xffff00000000ffff}}; + {0x1169751BB9A7D9C3, 0xF7A594AEC8EF8A9C, 0x1169751BB9A7D9C3, + 0xF7A594AEC8EF8A9C, 0x1169751BB9A7D9C3, 0xF7A594AEC8EF8A9C}, + {0x2B665362C4E812DF, 0x3A0D80D68B3F8BC8, 0x2B665362C4E812DF, + 0x3A0D80D68B3F8BC8, 0x2B665362C4E812DF, 0x3A0D80D68B3F8BC8}, + {0x1169751BB9A7D9C3, 0xF7A594AEC8EF8A9C, 0x1169751BB9A7D9C3, + 0xF7A594AEC8EF8A9C, 0x1169751BB9A7D9C3, 0xF7A594AEC8EF8A9C}, + {0x2B665362C4E812DF, 0x3A0D80D68B3F8BC8, 0x2B665362C4E812DF, + 0x3A0D80D68B3F8BC8, 0x2B665362C4E812DF, 0x3A0D80D68B3F8BC8}, + {0xFFAB807F807FFFCD, 0x7F23FF80FF567F80, 0xFFAB807F807FFFCD, + 0x7F23FF80FF567F80, 0xFFAB807F807FFFCD, 0x7F23FF80FF567F80}, + {0x80FFEFFF7F12807F, 0x807F80FF7FDEFF78, 0x80FFEFFF7F12807F, + 0x807F80FF7FDEFF78, 0x80FFEFFF7F12807F, 0x807F80FF7FDEFF78}, + {0xFFFFFFFFFFFFFFFF, 0xFFFFFFFFFFFFFFFF, 0xFFFFFFFFFFFFFFFF, + 0xFFFFFFFFFFFFFFFF, 0xFFFFFFFFFFFFFFFF, 0xFFFFFFFFFFFFFFFF}, + {0x0000000000000000, 0xFFFFFFFFFFFFFFFF, 0xFFFFFFFFFFFFFFFF, + 0x0000000000000000, 0x0000000000000000, 0xFFFFFFFFFFFFFFFF}, + {0xFFFF0000FFFF0000, 0xFFFF0000FFFF0000, 0xFFFF0000FFFF0000, + 0xFFFF0000FFFF0000, 0xFFFF0000FFFF0000, 0xFFFF0000FFFF0000}, + {0xFF00FF00FF00FF00, 0xFF00FF00FF00FF00, 0xFF00FF00FF00FF00, + 0xFF00FF00FF00FF00, 0xFF00FF00FF00FF00, 0xFF00FF00FF00FF00}, + {0xF0F0F0F0F0F0F0F0, 0xF0F0F0F0F0F0F0F0, 0xF0F0F0F0F0F0F0F0, + 0xF0F0F0F0F0F0F0F0, 0xF0F0F0F0F0F0F0F0, 0xF0F0F0F0F0F0F0F0}, + {0xFF0000FFFF0000FF, 0xFF0000FFFF0000FF, 0xFF0000FFFF0000FF, + 0xFF0000FFFF0000FF, 0xFF0000FFFF0000FF, 0xFF0000FFFF0000FF}, + {0xFFFF00000000FFFF, 0xFFFF00000000FFFF, 0xFFFF00000000FFFF, + 0xFFFF00000000FFFF, 0xFFFF00000000FFFF, 0xFFFF00000000FFFF}}; #define SLL_DF(T, lanes, mask) \ int size_in_bits = kMSARegSize / lanes; \ @@ -10406,8 +10404,8 @@ TEST(MSA_3R_instructions) { T* ws_p = reinterpret_cast<T*>(ws); \ T* wt_p = reinterpret_cast<T*>(wt); \ T* wd_p = reinterpret_cast<T*>(wd); \ - const int mask_not_valid = 0xc0; \ - const int mask_6bits = 0x3f; \ + const int mask_not_valid = 0xC0; \ + const int mask_6bits = 0x3F; \ for (int i = 0; i < lanes; ++i) { \ if ((wd_p[i] & mask_not_valid)) { \ wd_p[i] = 0; \ @@ -10773,9 +10771,9 @@ void run_msa_3rf(const struct TestCaseMsa3RF* input, #ifdef OBJECT_PRINT code->Print(std::cout); #endif - F3 f = FUNCTION_CAST<F3>(code->entry()); + auto f = GeneratedCode<F3>::FromCode(*code); - (CALL_GENERATED_CODE(isolate, f, &res, 0, 0, 0, 0)); + f.Call(&res, 0, 0, 0, 0); CHECK_EQ(output->exp_res_lo, res.d[0]); CHECK_EQ(output->exp_res_hi, res.d[1]); @@ -11157,70 +11155,70 @@ TEST(MSA_fixed_point_arithmetic) { CcTest::InitializeVM(); const struct TestCaseMsa3RF tc_h[]{ - {0x800080007fff7fff, 0xe1ed8000fad3863a, 0x80007fff00af7fff, - 0x800015a77fffa0eb, 0x7fff800080007fff, 0x80007fff1f207364}, - {0x800080007fff006a, 0x002affc4329ad87b, 0x80007fff7fff00f3, - 0xffecffb4d0d7f429, 0x80007fff80007c33, 0x54ac6bbce53b8c91}}; + {0x800080007FFF7FFF, 0xE1ED8000FAD3863A, 0x80007FFF00AF7FFF, + 0x800015A77FFFA0EB, 0x7FFF800080007FFF, 0x80007FFF1F207364}, + {0x800080007FFF006A, 0x002AFFC4329AD87B, 0x80007FFF7FFF00F3, + 0xFFECFFB4D0D7F429, 0x80007FFF80007C33, 0x54AC6BBCE53B8C91}}; const struct TestCaseMsa3RF tc_w[]{ - {0x8000000080000000, 0x7fffffff7fffffff, 0x800000007fffffff, - 0x00001ff37fffffff, 0x7fffffff80000000, 0x800000007fffffff}, - {0xe1ed035580000000, 0xfad3863aed462c0b, 0x8000000015a70aec, - 0x7fffffffa0ebd354, 0x800000007fffffff, 0xd0d7f4291f207364}, - {0x8000000080000000, 0x7fffffff0000da1f, 0x800000007fffffff, - 0x7fffffff00f39c3b, 0x800000007fffffff, 0x800000007c33f2fd}, - {0x0000ac33ffff329a, 0x54ac6bbce53bd87b, 0xffffe2b4d0d7f429, - 0x0355ed462c0b1ff3, 0xb5deb625939dd3f9, 0xe642adfa69519596}}; + {0x8000000080000000, 0x7FFFFFFF7FFFFFFF, 0x800000007FFFFFFF, + 0x00001FF37FFFFFFF, 0x7FFFFFFF80000000, 0x800000007FFFFFFF}, + {0xE1ED035580000000, 0xFAD3863AED462C0B, 0x8000000015A70AEC, + 0x7FFFFFFFA0EBD354, 0x800000007FFFFFFF, 0xD0D7F4291F207364}, + {0x8000000080000000, 0x7FFFFFFF0000DA1F, 0x800000007FFFFFFF, + 0x7FFFFFFF00F39C3B, 0x800000007FFFFFFF, 0x800000007C33F2FD}, + {0x0000AC33FFFF329A, 0x54AC6BBCE53BD87B, 0xFFFFE2B4D0D7F429, + 0x0355ED462C0B1FF3, 0xB5DEB625939DD3F9, 0xE642ADFA69519596}}; const struct ExpectedResult_MSA3RF exp_res_mul_q_h[] = { - {0x7fff800100ae7ffe, 0x1e13ea59fad35a74}, - {0x7fff80017ffe0000, 0xffff0000ed5b03a7}}; + {0x7FFF800100AE7FFE, 0x1E13EA59FAD35A74}, + {0x7FFF80017FFE0000, 0xFFFF0000ED5B03A7}}; const struct ExpectedResult_MSA3RF exp_res_madd_q_h[] = { - {0x7fff800080ae7fff, 0x9e136a5819f37fff}, - {0x00000000fffe7c33, 0x54ab6bbcd2969038}}; + {0x7FFF800080AE7FFF, 0x9E136A5819F37FFF}, + {0x00000000FFFE7C33, 0x54AB6BBCD2969038}}; const struct ExpectedResult_MSA3RF exp_res_msub_q_h[] = { - {0xffffffff80000000, 0x80007fff244c18ef}, - {0x80007fff80007c32, 0x54ac6bbbf7df88e9}}; + {0xFFFFFFFF80000000, 0x80007FFF244C18EF}, + {0x80007FFF80007C32, 0x54AC6BBBF7DF88E9}}; const struct ExpectedResult_MSA3RF exp_res_mulr_q_h[] = { - {0x7fff800100af7ffe, 0x1e13ea59fad35a75}, - {0x7fff80017ffe0001, 0x00000000ed5b03a8}}; + {0x7FFF800100AF7FFE, 0x1E13EA59FAD35A75}, + {0x7FFF80017FFE0001, 0x00000000ED5B03A8}}; const struct ExpectedResult_MSA3RF exp_res_maddr_q_h[] = { - {0x7fff800080af7fff, 0x9e136a5819f37fff}, - {0x00000000fffe7c34, 0x54ac6bbcd2969039}}; + {0x7FFF800080AF7FFF, 0x9E136A5819F37FFF}, + {0x00000000FFFE7C34, 0x54AC6BBCD2969039}}; const struct ExpectedResult_MSA3RF exp_res_msubr_q_h[] = { - {0xffffffff80000001, 0x80007fff244d18ef}, - {0x80007fff80007c32, 0x54ac6bbcf7e088e9}}; + {0xFFFFFFFF80000001, 0x80007FFF244D18EF}, + {0x80007FFF80007C32, 0x54AC6BBCF7E088E9}}; const struct ExpectedResult_MSA3RF exp_res_mul_q_w[] = { - {0x7fffffff80000001, 0x00001ff27ffffffe}, - {0x1e12fcabea58f514, 0xfad3863a0de8dee1}, - {0x7fffffff80000001, 0x7ffffffe0000019f}, - {0xffffffff00004bab, 0x0234e1fbf6ca3ee0}}; + {0x7FFFFFFF80000001, 0x00001FF27FFFFFFE}, + {0x1E12FCABEA58F514, 0xFAD3863A0DE8DEE1}, + {0x7FFFFFFF80000001, 0x7FFFFFFE0000019F}, + {0xFFFFFFFF00004BAB, 0x0234E1FBF6CA3EE0}}; const struct ExpectedResult_MSA3RF exp_res_madd_q_w[] = { - {0x7fffffff80000000, 0x80001ff27fffffff}, - {0x9e12fcab6a58f513, 0xcbab7a632d095245}, - {0x0000000000000000, 0xfffffffe7c33f49c}, - {0xb5deb624939e1fa4, 0xe8778ff5601bd476}}; + {0x7FFFFFFF80000000, 0x80001FF27FFFFFFF}, + {0x9E12FCAB6A58F513, 0xCBAB7A632D095245}, + {0x0000000000000000, 0xFFFFFFFE7C33F49C}, + {0xB5DEB624939E1FA4, 0xE8778FF5601BD476}}; const struct ExpectedResult_MSA3RF exp_res_msub_q_w[] = { - {0xffffffffffffffff, 0x8000000000000000}, - {0x800000007fffffff, 0xd6046dee11379482}, - {0x800000007fffffff, 0x800000007c33f15d}, - {0xb5deb625939d884d, 0xe40dcbfe728756b5}}; + {0xFFFFFFFFFFFFFFFF, 0x8000000000000000}, + {0x800000007FFFFFFF, 0xD6046DEE11379482}, + {0x800000007FFFFFFF, 0x800000007C33F15D}, + {0xB5DEB625939D884D, 0xE40DCBFE728756B5}}; const struct ExpectedResult_MSA3RF exp_res_mulr_q_w[] = { - {0x7fffffff80000001, 0x00001ff37ffffffe}, - {0x1e12fcabea58f514, 0xfad3863a0de8dee2}, - {0x7fffffff80000001, 0x7ffffffe0000019f}, - {0x0000000000004bac, 0x0234e1fcf6ca3ee1}}; + {0x7FFFFFFF80000001, 0x00001FF37FFFFFFE}, + {0x1E12FCABEA58F514, 0xFAD3863A0DE8DEE2}, + {0x7FFFFFFF80000001, 0x7FFFFFFE0000019F}, + {0x0000000000004BAC, 0x0234E1FCF6CA3EE1}}; const struct ExpectedResult_MSA3RF exp_res_maddr_q_w[] = { - {0x7fffffff80000000, 0x80001ff37fffffff}, - {0x9e12fcab6a58f513, 0xcbab7a632d095246}, - {0x0000000000000000, 0xfffffffe7c33f49c}, - {0xb5deb625939e1fa5, 0xe8778ff6601bd477}}; + {0x7FFFFFFF80000000, 0x80001FF37FFFFFFF}, + {0x9E12FCAB6A58F513, 0xCBAB7A632D095246}, + {0x0000000000000000, 0xFFFFFFFE7C33F49C}, + {0xB5DEB625939E1FA5, 0xE8778FF6601BD477}}; const struct ExpectedResult_MSA3RF exp_res_msubr_q_w[] = { - {0xffffffffffffffff, 0x8000000000000001}, - {0x800000007fffffff, 0xd6046def11379482}, - {0x800000007fffffff, 0x800000007c33f15e}, - {0xb5deb625939d884d, 0xe40dcbfe728756b5}}; + {0xFFFFFFFFFFFFFFFF, 0x8000000000000001}, + {0x800000007FFFFFFF, 0xD6046DEF11379482}, + {0x800000007FFFFFFF, 0x800000007C33F15E}, + {0xB5DEB625939D884D, 0xE40DCBFE728756B5}}; #define TEST_FIXED_POINT_DF_H(instruction, src, exp_res) \ run_msa_3rf((src), (exp_res), \ @@ -11280,31 +11278,31 @@ TEST(MSA_fexdo) { const struct ExpRes_16I exp_res_fexdo_w[] = { {static_cast<int16_t>(0x0410), static_cast<int16_t>(0x0347), - static_cast<int16_t>(0xd00d), static_cast<int16_t>(0xfc00), - static_cast<int16_t>(0x7c00), static_cast<int16_t>(0x7dff), - static_cast<int16_t>(0x7c00), static_cast<int16_t>(0x7bff)}, + static_cast<int16_t>(0xD00D), static_cast<int16_t>(0xFC00), + static_cast<int16_t>(0x7C00), static_cast<int16_t>(0x7DFF), + static_cast<int16_t>(0x7C00), static_cast<int16_t>(0x7BFF)}, {static_cast<int16_t>(0x8001), static_cast<int16_t>(0x0001), static_cast<int16_t>(0x0002), static_cast<int16_t>(0x8000), static_cast<int16_t>(0x8000), static_cast<int16_t>(0x0000), - static_cast<int16_t>(0x57b9), static_cast<int16_t>(0xe1fb)}, + static_cast<int16_t>(0x57B9), static_cast<int16_t>(0xE1FB)}, {static_cast<int16_t>(0x0001), static_cast<int16_t>(0x8000), - static_cast<int16_t>(0xfc00), static_cast<int16_t>(0xfbff), - static_cast<int16_t>(0x0000), static_cast<int16_t>(0x7c00), - static_cast<int16_t>(0xfc00), static_cast<int16_t>(0x0000)}}; + static_cast<int16_t>(0xFC00), static_cast<int16_t>(0xFBFF), + static_cast<int16_t>(0x0000), static_cast<int16_t>(0x7C00), + static_cast<int16_t>(0xFC00), static_cast<int16_t>(0x0000)}}; const struct ExpRes_32I exp_res_fexdo_d[] = { - {bit_cast<int32_t>(0x7f800000), bit_cast<int32_t>(0x7f7fc99e), - bit_cast<int32_t>(0x7f800000), bit_cast<int32_t>(0xc49a4000)}, - {bit_cast<int32_t>(0xc21bae14), bit_cast<int32_t>(0xff800000), - bit_cast<int32_t>(0x0082ab1e), bit_cast<int32_t>(0x000bfa5a)}, - {bit_cast<int32_t>(0x7673b164), bit_cast<int32_t>(0xfb13653d), + {bit_cast<int32_t>(0x7F800000), bit_cast<int32_t>(0x7F7FC99E), + bit_cast<int32_t>(0x7F800000), bit_cast<int32_t>(0xC49A4000)}, + {bit_cast<int32_t>(0xC21BAE14), bit_cast<int32_t>(0xFF800000), + bit_cast<int32_t>(0x0082AB1E), bit_cast<int32_t>(0x000BFA5A)}, + {bit_cast<int32_t>(0x7673B164), bit_cast<int32_t>(0xFB13653D), bit_cast<int32_t>(0x80000000), bit_cast<int32_t>(0x00000000)}, - {bit_cast<int32_t>(0x000002ca), bit_cast<int32_t>(0x80000000), + {bit_cast<int32_t>(0x000002CA), bit_cast<int32_t>(0x80000000), bit_cast<int32_t>(0x80000001), bit_cast<int32_t>(0x00000001)}, - {bit_cast<int32_t>(0xff800000), bit_cast<int32_t>(0x56b5e621), - bit_cast<int32_t>(0x00000000), bit_cast<int32_t>(0x7f800000)}, - {bit_cast<int32_t>(0xf673b164), bit_cast<int32_t>(0x7b13653d), - bit_cast<int32_t>(0x0000042e), bit_cast<int32_t>(0x00000000)}}; + {bit_cast<int32_t>(0xFF800000), bit_cast<int32_t>(0x56B5E621), + bit_cast<int32_t>(0x00000000), bit_cast<int32_t>(0x7F800000)}, + {bit_cast<int32_t>(0xF673B164), bit_cast<int32_t>(0x7B13653D), + bit_cast<int32_t>(0x0000042E), bit_cast<int32_t>(0x00000000)}}; #define TEST_FEXDO_H(instruction, src, exp_res) \ run_msa_3rf(reinterpret_cast<const struct TestCaseMsa3RF*>(src), \ @@ -11354,31 +11352,31 @@ TEST(MSA_ftq) { {-3e306, 2e-307, 9e307, 2e-307, 0, 0}}; const struct ExpRes_16I exp_res_ftq_w[] = { - {static_cast<int16_t>(0x0000), static_cast<int16_t>(0xb375), - static_cast<int16_t>(0x004b), static_cast<int16_t>(0x0000), - static_cast<int16_t>(0x7fff), static_cast<int16_t>(0x8021), - static_cast<int16_t>(0x7fff), static_cast<int16_t>(0xffff)}, + {static_cast<int16_t>(0x0000), static_cast<int16_t>(0xB375), + static_cast<int16_t>(0x004B), static_cast<int16_t>(0x0000), + static_cast<int16_t>(0x7FFF), static_cast<int16_t>(0x8021), + static_cast<int16_t>(0x7FFF), static_cast<int16_t>(0xFFFF)}, {static_cast<int16_t>(0x0000), static_cast<int16_t>(0x8000), - static_cast<int16_t>(0x7ffd), static_cast<int16_t>(0xfff5), - static_cast<int16_t>(0x7fff), static_cast<int16_t>(0x8000), - static_cast<int16_t>(0x8000), static_cast<int16_t>(0x7fff)}, + static_cast<int16_t>(0x7FFD), static_cast<int16_t>(0xFFF5), + static_cast<int16_t>(0x7FFF), static_cast<int16_t>(0x8000), + static_cast<int16_t>(0x8000), static_cast<int16_t>(0x7FFF)}, {static_cast<int16_t>(0x0000), static_cast<int16_t>(0x0000), - static_cast<int16_t>(0x7fff), static_cast<int16_t>(0xffff), - static_cast<int16_t>(0x0000), static_cast<int16_t>(0x7fff), + static_cast<int16_t>(0x7FFF), static_cast<int16_t>(0xFFFF), + static_cast<int16_t>(0x0000), static_cast<int16_t>(0x7FFF), static_cast<int16_t>(0x8000), static_cast<int16_t>(0x0000)}}; const struct ExpRes_32I exp_res_ftq_d[] = { - {bit_cast<int32_t>(0x7fffffff), bit_cast<int32_t>(0xfffefbf4), - bit_cast<int32_t>(0x7fffffff), bit_cast<int32_t>(0x8020c49c)}, - {bit_cast<int32_t>(0x004b5dcc), bit_cast<int32_t>(0x00000000), - bit_cast<int32_t>(0x000000d7), bit_cast<int32_t>(0xb374bc6a)}, - {bit_cast<int32_t>(0x80000000), bit_cast<int32_t>(0x7fffffff), - bit_cast<int32_t>(0x7fffffff), bit_cast<int32_t>(0x80000000)}, - {bit_cast<int32_t>(0x7ffcb900), bit_cast<int32_t>(0xfff572de), + {bit_cast<int32_t>(0x7FFFFFFF), bit_cast<int32_t>(0xFFFEFBF4), + bit_cast<int32_t>(0x7FFFFFFF), bit_cast<int32_t>(0x8020C49C)}, + {bit_cast<int32_t>(0x004B5DCC), bit_cast<int32_t>(0x00000000), + bit_cast<int32_t>(0x000000D7), bit_cast<int32_t>(0xB374BC6A)}, + {bit_cast<int32_t>(0x80000000), bit_cast<int32_t>(0x7FFFFFFF), + bit_cast<int32_t>(0x7FFFFFFF), bit_cast<int32_t>(0x80000000)}, + {bit_cast<int32_t>(0x7FFCB900), bit_cast<int32_t>(0xFFF572DE), bit_cast<int32_t>(0x00000000), bit_cast<int32_t>(0x80000000)}, {bit_cast<int32_t>(0x80000000), bit_cast<int32_t>(0x00000000), - bit_cast<int32_t>(0x00000000), bit_cast<int32_t>(0x7fffffff)}, - {bit_cast<int32_t>(0x7fffffff), bit_cast<int32_t>(0x00000000), + bit_cast<int32_t>(0x00000000), bit_cast<int32_t>(0x7FFFFFFF)}, + {bit_cast<int32_t>(0x7FFFFFFF), bit_cast<int32_t>(0x00000000), bit_cast<int32_t>(0x80000000), bit_cast<int32_t>(0x00000000)}}; #define TEST_FTQ_H(instruction, src, exp_res) \ diff --git a/deps/v8/test/cctest/test-assembler-ppc.cc b/deps/v8/test/cctest/test-assembler-ppc.cc index 1e150a0cb5..f965975ed9 100644 --- a/deps/v8/test/cctest/test-assembler-ppc.cc +++ b/deps/v8/test/cctest/test-assembler-ppc.cc @@ -30,18 +30,19 @@ #include "src/disassembler.h" #include "src/factory.h" #include "src/ppc/assembler-ppc-inl.h" -#include "src/ppc/simulator-ppc.h" +#include "src/simulator.h" #include "test/cctest/cctest.h" namespace v8 { namespace internal { -// Define these function prototypes to match JSEntryFunction in execution.cc. -typedef Object* (*F1)(int x, int p1, int p2, int p3, int p4); -typedef Object* (*F2)(int x, int y, int p2, int p3, int p4); -typedef Object* (*F3)(void* p0, int p1, int p2, int p3, int p4); -typedef Object* (*F4)(void* p0, void* p1, int p2, int p3, int p4); - +// TODO(ppc): Refine these signatures per test case, they can have arbitrary +// return and argument types and arbitrary number of arguments. +using F_iiiii = Object*(int x, int p1, int p2, int p3, int p4); +using F_piiii = Object*(void* p0, int p1, int p2, int p3, int p4); +using F_ppiii = Object*(void* p0, void* p1, int p2, int p3, int p4); +using F_pppii = Object*(void* p0, void* p1, void* p2, int p3, int p4); +using F_ippii = Object*(int p0, void* p1, void* p2, int p3, int p4); #define __ assm. @@ -65,9 +66,8 @@ TEST(0) { #ifdef DEBUG code->Print(); #endif - F2 f = FUNCTION_CAST<F2>(code->entry()); - intptr_t res = reinterpret_cast<intptr_t>( - CALL_GENERATED_CODE(isolate, f, 3, 4, 0, 0, 0)); + auto f = GeneratedCode<F_iiiii>::FromCode(*code); + intptr_t res = reinterpret_cast<intptr_t>(f.Call(3, 4, 0, 0, 0)); ::printf("f() = %" V8PRIdPTR "\n", res); CHECK_EQ(7, static_cast<int>(res)); } @@ -104,9 +104,8 @@ TEST(1) { #ifdef DEBUG code->Print(); #endif - F1 f = FUNCTION_CAST<F1>(code->entry()); - intptr_t res = reinterpret_cast<intptr_t>( - CALL_GENERATED_CODE(isolate, f, 100, 0, 0, 0, 0)); + auto f = GeneratedCode<F_iiiii>::FromCode(*code); + intptr_t res = reinterpret_cast<intptr_t>(f.Call(100, 0, 0, 0, 0)); ::printf("f() = %" V8PRIdPTR "\n", res); CHECK_EQ(5050, static_cast<int>(res)); } @@ -155,9 +154,8 @@ TEST(2) { #ifdef DEBUG code->Print(); #endif - F1 f = FUNCTION_CAST<F1>(code->entry()); - intptr_t res = reinterpret_cast<intptr_t>( - CALL_GENERATED_CODE(isolate, f, 10, 0, 0, 0, 0)); + auto f = GeneratedCode<F_iiiii>::FromCode(*code); + intptr_t res = reinterpret_cast<intptr_t>(f.Call(10, 0, 0, 0, 0)); ::printf("f() = %" V8PRIdPTR "\n", res); CHECK_EQ(3628800, static_cast<int>(res)); } @@ -228,12 +226,11 @@ TEST(3) { #ifdef DEBUG code->Print(); #endif - F3 f = FUNCTION_CAST<F3>(code->entry()); + auto f = GeneratedCode<F_piiii>::FromCode(*code); t.i = 100000; t.c = 10; t.s = 1000; - intptr_t res = reinterpret_cast<intptr_t>( - CALL_GENERATED_CODE(isolate, f, &t, 0, 0, 0, 0)); + intptr_t res = reinterpret_cast<intptr_t>(f.Call(&t, 0, 0, 0, 0)); ::printf("f() = %" V8PRIdPTR "\n", res); CHECK_EQ(101010, static_cast<int>(res)); CHECK_EQ(100000 / 2, t.i); @@ -301,7 +298,7 @@ TEST(4) { __ vstr(d4, r4, offsetof(T, e)); // Move a literal into a register that requires 64 bits to encode. - // 0x3ff0000010000000 = 1.000000059604644775390625 + // 0x3FF0000010000000 = 1.000000059604644775390625 __ vmov(d4, 1.000000059604644775390625); __ vstr(d4, r4, offsetof(T, d)); @@ -344,7 +341,7 @@ TEST(4) { #ifdef DEBUG Code::cast(code)->Print(); #endif - F3 f = FUNCTION_CAST<F3>(Code::cast(code)->entry()); + auto f = GeneratedCode<F_piiii>::FromCode(*code); t.a = 1.5; t.b = 2.75; t.c = 17.17; @@ -358,8 +355,7 @@ TEST(4) { t.n = 123.456; t.x = 4.5; t.y = 9.0; - Object* dummy = CALL_GENERATED_CODE(isolate, f, &t, 0, 0, 0, 0); - USE(dummy); + f.Call(&t, 0, 0, 0, 0); CHECK_EQ(4.5, t.y); CHECK_EQ(9.0, t.x); CHECK_EQ(-123.456, t.n); @@ -405,9 +401,8 @@ TEST(5) { #ifdef DEBUG Code::cast(code)->Print(); #endif - F1 f = FUNCTION_CAST<F1>(Code::cast(code)->entry()); - int res = reinterpret_cast<int>( - CALL_GENERATED_CODE(isolate, f, 0xAAAAAAAA, 0, 0, 0, 0)); + auto f = GeneratedCode<F_iiiii>::FromCode(*code); + int res = reinterpret_cast<int>(f.Call(0xAAAAAAAA, 0, 0, 0, 0)); ::printf("f() = %d\n", res); CHECK_EQ(-7, res); } @@ -441,9 +436,8 @@ TEST(6) { #ifdef DEBUG Code::cast(code)->Print(); #endif - F1 f = FUNCTION_CAST<F1>(Code::cast(code)->entry()); - int res = reinterpret_cast<int>( - CALL_GENERATED_CODE(isolate, f, 0xFFFF, 0, 0, 0, 0)); + auto f = GeneratedCode<F_iiiii>::FromCode(*code); + int res = reinterpret_cast<int>(f.Call(0xFFFF, 0, 0, 0, 0)); ::printf("f() = %d\n", res); CHECK_EQ(382, res); } @@ -517,9 +511,8 @@ static void TestRoundingMode(VCVTTypes types, #ifdef DEBUG Code::cast(code)->Print(); #endif - F1 f = FUNCTION_CAST<F1>(Code::cast(code)->entry()); - int res = reinterpret_cast<int>( - CALL_GENERATED_CODE(isolate, f, 0, 0, 0, 0, 0)); + auto f = GeneratedCode<F_iiiii>::FromCode(*code); + int res = reinterpret_cast<int>(f.Call(0, 0, 0, 0, 0)); ::printf("res = %d\n", res); CHECK_EQ(expected, res); } @@ -597,8 +590,8 @@ TEST(7) { TestRoundingMode(u32_f64, RZ, kMinInt - 1.0, 0, true); // Positive values. - // kMaxInt is the maximum *signed* integer: 0x7fffffff. - static const uint32_t kMaxUInt = 0xffffffffu; + // kMaxInt is the maximum *signed* integer: 0x7FFFFFFF. + static const uint32_t kMaxUInt = 0xFFFFFFFFu; TestRoundingMode(u32_f64, RZ, 0, 0); TestRoundingMode(u32_f64, RZ, 0.5, 0); TestRoundingMode(u32_f64, RZ, 123.7, 123); @@ -705,7 +698,7 @@ TEST(8) { #ifdef DEBUG Code::cast(code)->Print(); #endif - F4 fn = FUNCTION_CAST<F4>(Code::cast(code)->entry()); + auto fn = GeneratedCode<F_ppiii>::FromCode(*code); d.a = 1.1; d.b = 2.2; d.c = 3.3; @@ -724,8 +717,7 @@ TEST(8) { f.g = 7.0; f.h = 8.0; - Object* dummy = CALL_GENERATED_CODE(isolate, fn, &d, &f, 0, 0, 0); - USE(dummy); + fn.Call(&d, &f, 0, 0, 0); CHECK_EQ(7.7, d.a); CHECK_EQ(8.8, d.b); @@ -821,7 +813,7 @@ TEST(9) { #ifdef DEBUG Code::cast(code)->Print(); #endif - F4 fn = FUNCTION_CAST<F4>(Code::cast(code)->entry()); + auto fn = GeneratedCode<F_ppiii>::FromCode(*code); d.a = 1.1; d.b = 2.2; d.c = 3.3; @@ -840,8 +832,7 @@ TEST(9) { f.g = 7.0; f.h = 8.0; - Object* dummy = CALL_GENERATED_CODE(isolate, fn, &d, &f, 0, 0, 0); - USE(dummy); + fn.Call(&d, &f, 0, 0, 0); CHECK_EQ(7.7, d.a); CHECK_EQ(8.8, d.b); @@ -933,7 +924,7 @@ TEST(10) { #ifdef DEBUG Code::cast(code)->Print(); #endif - F4 fn = FUNCTION_CAST<F4>(Code::cast(code)->entry()); + auto fn = GeneratedCode<F_ppiii>::FromCode(*code); d.a = 1.1; d.b = 2.2; d.c = 3.3; @@ -952,8 +943,7 @@ TEST(10) { f.g = 7.0; f.h = 8.0; - Object* dummy = CALL_GENERATED_CODE(isolate, fn, &d, &f, 0, 0, 0); - USE(dummy); + fn.Call(&d, &f, 0, 0, 0); CHECK_EQ(7.7, d.a); CHECK_EQ(8.8, d.b); @@ -990,8 +980,8 @@ TEST(11) { } I; I i; - i.a = 0xabcd0001; - i.b = 0xabcd0000; + i.a = 0xABCD0001; + i.b = 0xABCD0000; Assembler assm(isolate, nullptr, 0); @@ -1007,13 +997,13 @@ TEST(11) { __ str(r2, MemOperand(r0, offsetof(I, b))); // Test corner cases. - __ mov(r1, Operand(0xffffffff)); + __ mov(r1, Operand(0xFFFFFFFF)); __ mov(r2, Operand::Zero()); __ mov(r3, Operand(r1, ASR, 1), SetCC); // Set the carry. __ adc(r3, r1, Operand(r2)); __ str(r3, MemOperand(r0, offsetof(I, c))); - __ mov(r1, Operand(0xffffffff)); + __ mov(r1, Operand(0xFFFFFFFF)); __ mov(r2, Operand::Zero()); __ mov(r3, Operand(r2, ASR, 1), SetCC); // Unset the carry. __ adc(r3, r1, Operand(r2)); @@ -1031,14 +1021,13 @@ TEST(11) { #ifdef DEBUG Code::cast(code)->Print(); #endif - F3 f = FUNCTION_CAST<F3>(Code::cast(code)->entry()); - Object* dummy = CALL_GENERATED_CODE(isolate, f, &i, 0, 0, 0, 0); - USE(dummy); + auto f = GeneratedCode<F_piiii>::FromCode(*code); + f.Call(&i, 0, 0, 0, 0); - CHECK_EQ(0xabcd0001, i.a); - CHECK_EQ(static_cast<int32_t>(0xabcd0000) >> 1, i.b); + CHECK_EQ(0xABCD0001, i.a); + CHECK_EQ(static_cast<int32_t>(0xABCD0000) >> 1, i.b); CHECK_EQ(0x00000000, i.c); - CHECK_EQ(0xffffffff, i.d); + CHECK_EQ(0xFFFFFFFF, i.d); } diff --git a/deps/v8/test/cctest/test-assembler-s390.cc b/deps/v8/test/cctest/test-assembler-s390.cc index df33b96752..d6bbe34e74 100644 --- a/deps/v8/test/cctest/test-assembler-s390.cc +++ b/deps/v8/test/cctest/test-assembler-s390.cc @@ -31,17 +31,18 @@ #include "src/factory.h" #include "src/macro-assembler.h" #include "src/s390/assembler-s390-inl.h" -#include "src/s390/simulator-s390.h" +#include "src/simulator.h" #include "test/cctest/cctest.h" namespace v8 { namespace internal { // Define these function prototypes to match JSEntryFunction in execution.cc. -typedef Object* (*F1)(int x, int p1, int p2, int p3, int p4); -typedef Object* (*F2)(int x, int y, int p2, int p3, int p4); -typedef Object* (*F3)(void* p0, int p1, int p2, int p3, int p4); -typedef Object* (*F4)(void* p0, void* p1, int p2, int p3, int p4); +// TODO(s390): Refine these signatures per test case. +using F1 = Object*(int x, int p1, int p2, int p3, int p4); +using F2 = Object*(int x, int y, int p2, int p3, int p4); +using F3 = Object*(void* p0, int p1, int p2, int p3, int p4); +using F4 = Object*(void* p0, void* p1, int p2, int p3, int p4); #define __ assm. @@ -66,9 +67,8 @@ TEST(0) { #ifdef DEBUG code->Print(); #endif - F2 f = FUNCTION_CAST<F2>(code->entry()); - intptr_t res = reinterpret_cast<intptr_t>( - CALL_GENERATED_CODE(isolate, f, 3, 4, 0, 0, 0)); + auto f = GeneratedCode<F2>::FromCode(*code); + intptr_t res = reinterpret_cast<intptr_t>(f.Call(3, 4, 0, 0, 0)); ::printf("f() = %" V8PRIxPTR "\n", res); CHECK_EQ(7, static_cast<int>(res)); } @@ -106,9 +106,8 @@ TEST(1) { #ifdef DEBUG code->Print(); #endif - F1 f = FUNCTION_CAST<F1>(code->entry()); - intptr_t res = reinterpret_cast<intptr_t>( - CALL_GENERATED_CODE(isolate, f, 100, 0, 0, 0, 0)); + auto f = GeneratedCode<F1>::FromCode(*code); + intptr_t res = reinterpret_cast<intptr_t>(f.Call(100, 0, 0, 0, 0)); ::printf("f() = %" V8PRIxPTR "\n", res); CHECK_EQ(5050, static_cast<int>(res)); } @@ -158,9 +157,8 @@ TEST(2) { #ifdef DEBUG code->Print(); #endif - F1 f = FUNCTION_CAST<F1>(code->entry()); - intptr_t res = reinterpret_cast<intptr_t>( - CALL_GENERATED_CODE(isolate, f, 10, 0, 0, 0, 0)); + auto f = GeneratedCode<F1>::FromCode(*code); + intptr_t res = reinterpret_cast<intptr_t>(f.Call(10, 0, 0, 0, 0)); ::printf("f() = %" V8PRIxPTR "\n", res); CHECK_EQ(3628800, static_cast<int>(res)); } @@ -255,9 +253,9 @@ TEST(4) { #ifdef DEBUG code->Print(); #endif - F2 f = FUNCTION_CAST<F2>(code->entry()); + auto f = GeneratedCode<F2>::FromCode(*code); intptr_t res = reinterpret_cast<intptr_t>( - CALL_GENERATED_CODE(isolate, f, 3, 4, 3, 0, 0)); + f.Call(3, 4, 3, 0, 0)); ::printf("f() = %" V8PRIdPTR "\n", res); CHECK_EQ(4, static_cast<int>(res)); } @@ -283,9 +281,9 @@ TEST(5) { #ifdef DEBUG code->Print(); #endif - F2 f = FUNCTION_CAST<F2>(code->entry()); + auto f = GeneratedCode<F2>::FromCode(*code); intptr_t res = - reinterpret_cast<intptr_t>(CALL_GENERATED_CODE(isolate, f, 3, 4, 3, 0, 0)); + reinterpret_cast<intptr_t>(f.Call(3, 4, 3, 0, 0)); ::printf("f() = %" V8PRIdPTR "\n", res); CHECK_EQ(2, static_cast<int>(res)); } @@ -317,9 +315,9 @@ TEST(6) { #ifdef DEBUG code->Print(); #endif - F2 f = FUNCTION_CAST<F2>(code->entry()); + auto f = GeneratedCode<F2>::FromCode(*code); intptr_t res = - reinterpret_cast<intptr_t>(CALL_GENERATED_CODE(isolate, f, 3, 4, 3, 0, 0)); + reinterpret_cast<intptr_t>(f.Call(3, 4, 3, 0, 0)); ::printf("f() = %" V8PRIdPTR "\n", res); CHECK_EQ(1, static_cast<int>(res)); } @@ -349,9 +347,9 @@ TEST(7) { #ifdef DEBUG code->Print(); #endif - F2 f = FUNCTION_CAST<F2>(code->entry()); + auto f = GeneratedCode<F2>::FromCode(*code); intptr_t res = - reinterpret_cast<intptr_t>(CALL_GENERATED_CODE(isolate, f, 3, 4, 3, 0, 0)); + reinterpret_cast<intptr_t>(f.Call(3, 4, 3, 0, 0)); ::printf("f() = %" V8PRIdPTR "\n", res); CHECK_EQ(0x2468, static_cast<int>(res)); } @@ -380,9 +378,9 @@ TEST(8) { #ifdef DEBUG code->Print(); #endif - F1 f = FUNCTION_CAST<F1>(code->entry()); + auto f = GeneratedCode<F1>::FromCode(*code); intptr_t res = - reinterpret_cast<intptr_t>(CALL_GENERATED_CODE(isolate, f, 100, 0, + reinterpret_cast<intptr_t>(f.Call(100, 0, 0, 0, 0)); ::printf("f() = %" V8PRIdPTR "\n", res); CHECK_EQ(0, static_cast<int>(res)); @@ -407,9 +405,9 @@ TEST(9) { #ifdef DEBUG code->Print(); #endif - F1 f = FUNCTION_CAST<F1>(code->entry()); + auto f = GeneratedCode<F1>::FromCode(*code); intptr_t res = - reinterpret_cast<intptr_t>(CALL_GENERATED_CODE(isolate, f, 0, 0, 0, 0, 0)); + reinterpret_cast<intptr_t>(f.Call(0, 0, 0, 0, 0)); ::printf("f() = %" V8PRIdPTR "\n", res); } #endif @@ -492,9 +490,8 @@ TEST(10) { #ifdef DEBUG code->Print(); #endif - F2 f = FUNCTION_CAST<F2>(code->entry()); - intptr_t res = reinterpret_cast<intptr_t>( - CALL_GENERATED_CODE(isolate, f, 3, 4, 0, 0, 0)); + auto f = GeneratedCode<F2>::FromCode(*code); + intptr_t res = reinterpret_cast<intptr_t>(f.Call(3, 4, 0, 0, 0)); ::printf("f() = %" V8PRIxPTR "\n", res); CHECK_EQ(0, static_cast<int>(res)); } diff --git a/deps/v8/test/cctest/test-assembler-x64.cc b/deps/v8/test/cctest/test-assembler-x64.cc index e356fb2d82..043743b40a 100644 --- a/deps/v8/test/cctest/test-assembler-x64.cc +++ b/deps/v8/test/cctest/test-assembler-x64.cc @@ -82,6 +82,7 @@ TEST(AssemblerX64ReturnOperation) { CodeDesc desc; masm.GetCode(CcTest::i_isolate(), &desc); + MakeAssemblerBufferExecutable(buffer, allocated); // Call the function from C++. int result = FUNCTION_CAST<F2>(buffer)(3, 2); CHECK_EQ(2, result); @@ -111,6 +112,7 @@ TEST(AssemblerX64StackOperations) { CodeDesc desc; masm.GetCode(CcTest::i_isolate(), &desc); + MakeAssemblerBufferExecutable(buffer, allocated); // Call the function from C++. int result = FUNCTION_CAST<F2>(buffer)(3, 2); CHECK_EQ(2, result); @@ -130,6 +132,7 @@ TEST(AssemblerX64ArithmeticOperations) { CodeDesc desc; masm.GetCode(CcTest::i_isolate(), &desc); + MakeAssemblerBufferExecutable(buffer, allocated); // Call the function from C++. int result = FUNCTION_CAST<F2>(buffer)(3, 2); CHECK_EQ(5, result); @@ -156,6 +159,7 @@ TEST(AssemblerX64CmpbOperation) { CodeDesc desc; masm.GetCode(CcTest::i_isolate(), &desc); + MakeAssemblerBufferExecutable(buffer, allocated); // Call the function from C++. int result = FUNCTION_CAST<F2>(buffer)(0x1002, 0x2002); CHECK_EQ(1, result); @@ -193,6 +197,7 @@ TEST(AssemblerX64ImulOperation) { CodeDesc desc; masm.GetCode(CcTest::i_isolate(), &desc); + MakeAssemblerBufferExecutable(buffer, allocated); // Call the function from C++. int result = FUNCTION_CAST<F2>(buffer)(3, 2); CHECK_EQ(0, result); @@ -362,6 +367,7 @@ TEST(AssemblerX64testbwqOperation) { CodeDesc desc; masm.GetCode(CcTest::i_isolate(), &desc); + MakeAssemblerBufferExecutable(buffer, allocated); // Call the function from C++. int result = FUNCTION_CAST<F2>(buffer)(0, 0); CHECK_EQ(1, result); @@ -382,6 +388,7 @@ TEST(AssemblerX64XchglOperations) { CodeDesc desc; masm.GetCode(CcTest::i_isolate(), &desc); + MakeAssemblerBufferExecutable(buffer, allocated); // Call the function from C++. uint64_t left = V8_2PART_UINT64_C(0x10000000, 20000000); uint64_t right = V8_2PART_UINT64_C(0x30000000, 40000000); @@ -404,6 +411,7 @@ TEST(AssemblerX64OrlOperations) { CodeDesc desc; masm.GetCode(CcTest::i_isolate(), &desc); + MakeAssemblerBufferExecutable(buffer, allocated); // Call the function from C++. uint64_t left = V8_2PART_UINT64_C(0x10000000, 20000000); uint64_t right = V8_2PART_UINT64_C(0x30000000, 40000000); @@ -425,6 +433,7 @@ TEST(AssemblerX64RollOperations) { CodeDesc desc; masm.GetCode(CcTest::i_isolate(), &desc); + MakeAssemblerBufferExecutable(buffer, allocated); // Call the function from C++. uint64_t src = V8_2PART_UINT64_C(0x10000000, C0000000); uint64_t result = FUNCTION_CAST<F5>(buffer)(src); @@ -444,11 +453,12 @@ TEST(AssemblerX64SublOperations) { CodeDesc desc; masm.GetCode(CcTest::i_isolate(), &desc); + MakeAssemblerBufferExecutable(buffer, allocated); // Call the function from C++. uint64_t left = V8_2PART_UINT64_C(0x10000000, 20000000); uint64_t right = V8_2PART_UINT64_C(0x30000000, 40000000); uint64_t result = FUNCTION_CAST<F4>(buffer)(&left, &right); - CHECK_EQ(V8_2PART_UINT64_C(0x10000000, e0000000), left); + CHECK_EQ(V8_2PART_UINT64_C(0x10000000, E0000000), left); USE(result); } @@ -471,6 +481,7 @@ TEST(AssemblerX64TestlOperations) { CodeDesc desc; masm.GetCode(CcTest::i_isolate(), &desc); + MakeAssemblerBufferExecutable(buffer, allocated); // Call the function from C++. uint64_t left = V8_2PART_UINT64_C(0x10000000, 20000000); uint64_t right = V8_2PART_UINT64_C(0x30000000, 00000000); @@ -488,7 +499,7 @@ TEST(AssemblerX64TestwOperations) { // Set rax with the ZF flag of the testl instruction. Label done; __ movq(rax, Immediate(1)); - __ testw(Operand(arg1, 0), Immediate(0xf0f0)); + __ testw(Operand(arg1, 0), Immediate(0xF0F0)); __ j(not_zero, &done, Label::kNear); __ movq(rax, Immediate(0)); __ bind(&done); @@ -496,6 +507,7 @@ TEST(AssemblerX64TestwOperations) { CodeDesc desc; masm.GetCode(CcTest::i_isolate(), &desc); + MakeAssemblerBufferExecutable(buffer, allocated); // Call the function from C++. uint16_t operand = 0x8000; uint16_t result = FUNCTION_CAST<F>(buffer)(&operand); @@ -514,6 +526,7 @@ TEST(AssemblerX64XorlOperations) { CodeDesc desc; masm.GetCode(CcTest::i_isolate(), &desc); + MakeAssemblerBufferExecutable(buffer, allocated); // Call the function from C++. uint64_t left = V8_2PART_UINT64_C(0x10000000, 20000000); uint64_t right = V8_2PART_UINT64_C(0x30000000, 60000000); @@ -548,6 +561,7 @@ TEST(AssemblerX64MemoryOperands) { CodeDesc desc; masm.GetCode(CcTest::i_isolate(), &desc); + MakeAssemblerBufferExecutable(buffer, allocated); // Call the function from C++. int result = FUNCTION_CAST<F2>(buffer)(3, 2); CHECK_EQ(3, result); @@ -574,6 +588,7 @@ TEST(AssemblerX64ControlFlow) { CodeDesc desc; masm.GetCode(CcTest::i_isolate(), &desc); + MakeAssemblerBufferExecutable(buffer, allocated); // Call the function from C++. int result = FUNCTION_CAST<F2>(buffer)(3, 2); CHECK_EQ(3, result); @@ -622,6 +637,7 @@ TEST(AssemblerX64LoopImmediates) { CodeDesc desc; masm.GetCode(CcTest::i_isolate(), &desc); + MakeAssemblerBufferExecutable(buffer, allocated); // Call the function from C++. int result = FUNCTION_CAST<F0>(buffer)(); CHECK_EQ(1, result); @@ -629,7 +645,7 @@ TEST(AssemblerX64LoopImmediates) { TEST(OperandRegisterDependency) { - int offsets[4] = {0, 1, 0xfed, 0xbeefcad}; + int offsets[4] = {0, 1, 0xFED, 0xBEEFCAD}; for (int i = 0; i < 4; i++) { int offset = offsets[i]; CHECK(Operand(rax, offset).AddressUsesRegister(rax)); @@ -892,6 +908,7 @@ TEST(AssemblerX64SSE) { __ subps(xmm2, xmm0); __ divps(xmm2, xmm1); __ cvttss2si(rax, xmm2); + __ haddps(xmm1, xmm0); __ ret(0); } @@ -1452,7 +1469,7 @@ TEST(AssemblerX64AVX_ss) { // arguments in xmm0, xmm1 and xmm2 __ subq(rsp, Immediate(kDoubleSize * 2)); // For memory operand - __ movl(rdx, Immediate(0xc2f64000)); // -123.125 + __ movl(rdx, Immediate(0xC2F64000)); // -123.125 __ vmovd(xmm4, rdx); __ vmovss(Operand(rsp, 0), xmm4); __ vmovss(xmm5, Operand(rsp, 0)); @@ -1546,7 +1563,7 @@ TEST(AssemblerX64AVX_sd) { // Test vcvtss2sd & vcvtsd2ss __ movl(rax, Immediate(9)); - __ movq(rdx, V8_INT64_C(0x426D1A0000000000)); + __ movq(rdx, uint64_t{0x426D1A0000000000}); __ movq(Operand(rsp, 0), rdx); __ vcvtsd2ss(xmm6, xmm6, Operand(rsp, 0)); __ vcvtss2sd(xmm7, xmm6, xmm6); @@ -1572,10 +1589,10 @@ TEST(AssemblerX64AVX_sd) { // Test vcvttsd2siq __ movl(rax, Immediate(11)); - __ movq(rdx, V8_INT64_C(0x426D1A94A2000000)); // 1.0e12 + __ movq(rdx, uint64_t{0x426D1A94A2000000}); // 1.0e12 __ vmovq(xmm6, rdx); __ vcvttsd2siq(rcx, xmm6); - __ movq(rdx, V8_INT64_C(1000000000000)); + __ movq(rdx, uint64_t{1000000000000}); __ cmpq(rcx, rdx); __ j(not_equal, &exit); __ xorq(rcx, rcx); @@ -1586,9 +1603,9 @@ TEST(AssemblerX64AVX_sd) { // Test vmovmskpd __ movl(rax, Immediate(12)); - __ movq(rdx, V8_INT64_C(0x426D1A94A2000000)); // 1.0e12 + __ movq(rdx, uint64_t{0x426D1A94A2000000}); // 1.0e12 __ vmovq(xmm6, rdx); - __ movq(rdx, V8_INT64_C(0xC26D1A94A2000000)); // -1.0e12 + __ movq(rdx, uint64_t{0xC26D1A94A2000000}); // -1.0e12 __ vmovq(xmm7, rdx); __ shufps(xmm6, xmm7, 0x44); __ vmovmskpd(rdx, xmm6); @@ -1596,54 +1613,54 @@ TEST(AssemblerX64AVX_sd) { __ j(not_equal, &exit); // Test vpcmpeqd - __ movq(rdx, V8_UINT64_C(0x0123456789abcdef)); - __ movq(rcx, V8_UINT64_C(0x0123456788888888)); + __ movq(rdx, uint64_t{0x0123456789ABCDEF}); + __ movq(rcx, uint64_t{0x0123456788888888}); __ vmovq(xmm6, rdx); __ vmovq(xmm7, rcx); __ vpcmpeqd(xmm8, xmm6, xmm7); __ vmovq(rdx, xmm8); - __ movq(rcx, V8_UINT64_C(0xffffffff00000000)); + __ movq(rcx, uint64_t{0xFFFFFFFF00000000}); __ cmpq(rcx, rdx); __ movl(rax, Immediate(13)); __ j(not_equal, &exit); // Test vpsllq, vpsrlq __ movl(rax, Immediate(13)); - __ movq(rdx, V8_UINT64_C(0x0123456789abcdef)); + __ movq(rdx, uint64_t{0x0123456789ABCDEF}); __ vmovq(xmm6, rdx); __ vpsrlq(xmm7, xmm6, 4); __ vmovq(rdx, xmm7); - __ movq(rcx, V8_UINT64_C(0x00123456789abcde)); + __ movq(rcx, uint64_t{0x00123456789ABCDE}); __ cmpq(rdx, rcx); __ j(not_equal, &exit); __ vpsllq(xmm7, xmm6, 12); __ vmovq(rdx, xmm7); - __ movq(rcx, V8_UINT64_C(0x3456789abcdef000)); + __ movq(rcx, uint64_t{0x3456789ABCDEF000}); __ cmpq(rdx, rcx); __ j(not_equal, &exit); // Test vandpd, vorpd, vxorpd __ movl(rax, Immediate(14)); - __ movl(rdx, Immediate(0x00ff00ff)); - __ movl(rcx, Immediate(0x0f0f0f0f)); + __ movl(rdx, Immediate(0x00FF00FF)); + __ movl(rcx, Immediate(0x0F0F0F0F)); __ vmovd(xmm4, rdx); __ vmovd(xmm5, rcx); __ vandpd(xmm6, xmm4, xmm5); __ vmovd(rdx, xmm6); - __ cmpl(rdx, Immediate(0x000f000f)); + __ cmpl(rdx, Immediate(0x000F000F)); __ j(not_equal, &exit); __ vorpd(xmm6, xmm4, xmm5); __ vmovd(rdx, xmm6); - __ cmpl(rdx, Immediate(0x0fff0fff)); + __ cmpl(rdx, Immediate(0x0FFF0FFF)); __ j(not_equal, &exit); __ vxorpd(xmm6, xmm4, xmm5); __ vmovd(rdx, xmm6); - __ cmpl(rdx, Immediate(0x0ff00ff0)); + __ cmpl(rdx, Immediate(0x0FF00FF0)); __ j(not_equal, &exit); // Test vsqrtsd __ movl(rax, Immediate(15)); - __ movq(rdx, V8_UINT64_C(0x4004000000000000)); // 2.5 + __ movq(rdx, uint64_t{0x4004000000000000}); // 2.5 __ vmovq(xmm4, rdx); __ vmulsd(xmm5, xmm4, xmm4); __ vmovsd(Operand(rsp, 0), xmm5); @@ -1658,10 +1675,10 @@ TEST(AssemblerX64AVX_sd) { // Test vroundsd __ movl(rax, Immediate(16)); - __ movq(rdx, V8_UINT64_C(0x4002000000000000)); // 2.25 + __ movq(rdx, uint64_t{0x4002000000000000}); // 2.25 __ vmovq(xmm4, rdx); __ vroundsd(xmm5, xmm4, xmm4, kRoundUp); - __ movq(rcx, V8_UINT64_C(0x4008000000000000)); // 3.0 + __ movq(rcx, uint64_t{0x4008000000000000}); // 3.0 __ vmovq(xmm6, rcx); __ vucomisd(xmm5, xmm6); __ j(not_equal, &exit); @@ -1669,7 +1686,7 @@ TEST(AssemblerX64AVX_sd) { // Test vcvtlsi2sd __ movl(rax, Immediate(17)); __ movl(rdx, Immediate(6)); - __ movq(rcx, V8_UINT64_C(0x4018000000000000)); // 6.0 + __ movq(rcx, uint64_t{0x4018000000000000}); // 6.0 __ vmovq(xmm5, rcx); __ vcvtlsi2sd(xmm6, xmm6, rdx); __ vucomisd(xmm5, xmm6); @@ -1681,8 +1698,8 @@ TEST(AssemblerX64AVX_sd) { // Test vcvtqsi2sd __ movl(rax, Immediate(18)); - __ movq(rdx, V8_UINT64_C(0x2000000000000000)); // 2 << 0x3c - __ movq(rcx, V8_UINT64_C(0x43c0000000000000)); + __ movq(rdx, uint64_t{0x2000000000000000}); // 2 << 0x3C + __ movq(rcx, uint64_t{0x43C0000000000000}); __ vmovq(xmm5, rcx); __ vcvtqsi2sd(xmm6, xmm6, rdx); __ vucomisd(xmm5, xmm6); @@ -1690,13 +1707,13 @@ TEST(AssemblerX64AVX_sd) { // Test vcvtsd2si __ movl(rax, Immediate(19)); - __ movq(rdx, V8_UINT64_C(0x4018000000000000)); // 6.0 + __ movq(rdx, uint64_t{0x4018000000000000}); // 6.0 __ vmovq(xmm5, rdx); __ vcvtsd2si(rcx, xmm5); __ cmpl(rcx, Immediate(6)); __ j(not_equal, &exit); - __ movq(rdx, V8_INT64_C(0x3ff0000000000000)); // 1.0 + __ movq(rdx, uint64_t{0x3FF0000000000000}); // 1.0 __ vmovq(xmm7, rdx); __ vmulsd(xmm1, xmm1, xmm7); __ movq(Operand(rsp, 0), rdx); @@ -1775,160 +1792,160 @@ TEST(AssemblerX64BMI1) { CpuFeatureScope fscope(&masm, BMI1); Label exit; - __ movq(rcx, V8_UINT64_C(0x1122334455667788)); // source operand + __ movq(rcx, uint64_t{0x1122334455667788}); // source operand __ pushq(rcx); // For memory operand // andn - __ movq(rdx, V8_UINT64_C(0x1000000020000000)); + __ movq(rdx, uint64_t{0x1000000020000000}); __ movl(rax, Immediate(1)); // Test number __ andnq(r8, rdx, rcx); - __ movq(r9, V8_UINT64_C(0x0122334455667788)); // expected result + __ movq(r9, uint64_t{0x0122334455667788}); // expected result __ cmpq(r8, r9); __ j(not_equal, &exit); __ incq(rax); __ andnq(r8, rdx, Operand(rsp, 0)); - __ movq(r9, V8_UINT64_C(0x0122334455667788)); // expected result + __ movq(r9, uint64_t{0x0122334455667788}); // expected result __ cmpq(r8, r9); __ j(not_equal, &exit); __ incq(rax); __ andnl(r8, rdx, rcx); - __ movq(r9, V8_UINT64_C(0x0000000055667788)); // expected result + __ movq(r9, uint64_t{0x0000000055667788}); // expected result __ cmpq(r8, r9); __ j(not_equal, &exit); __ incq(rax); __ andnl(r8, rdx, Operand(rsp, 0)); - __ movq(r9, V8_UINT64_C(0x0000000055667788)); // expected result + __ movq(r9, uint64_t{0x0000000055667788}); // expected result __ cmpq(r8, r9); __ j(not_equal, &exit); // bextr - __ movq(rdx, V8_UINT64_C(0x0000000000002808)); + __ movq(rdx, uint64_t{0x0000000000002808}); __ incq(rax); __ bextrq(r8, rcx, rdx); - __ movq(r9, V8_UINT64_C(0x0000003344556677)); // expected result + __ movq(r9, uint64_t{0x0000003344556677}); // expected result __ cmpq(r8, r9); __ j(not_equal, &exit); __ incq(rax); __ bextrq(r8, Operand(rsp, 0), rdx); - __ movq(r9, V8_UINT64_C(0x0000003344556677)); // expected result + __ movq(r9, uint64_t{0x0000003344556677}); // expected result __ cmpq(r8, r9); __ j(not_equal, &exit); __ incq(rax); __ bextrl(r8, rcx, rdx); - __ movq(r9, V8_UINT64_C(0x0000000000556677)); // expected result + __ movq(r9, uint64_t{0x0000000000556677}); // expected result __ cmpq(r8, r9); __ j(not_equal, &exit); __ incq(rax); __ bextrl(r8, Operand(rsp, 0), rdx); - __ movq(r9, V8_UINT64_C(0x0000000000556677)); // expected result + __ movq(r9, uint64_t{0x0000000000556677}); // expected result __ cmpq(r8, r9); __ j(not_equal, &exit); // blsi __ incq(rax); __ blsiq(r8, rcx); - __ movq(r9, V8_UINT64_C(0x0000000000000008)); // expected result + __ movq(r9, uint64_t{0x0000000000000008}); // expected result __ cmpq(r8, r9); __ j(not_equal, &exit); __ incq(rax); __ blsiq(r8, Operand(rsp, 0)); - __ movq(r9, V8_UINT64_C(0x0000000000000008)); // expected result + __ movq(r9, uint64_t{0x0000000000000008}); // expected result __ cmpq(r8, r9); __ j(not_equal, &exit); __ incq(rax); __ blsil(r8, rcx); - __ movq(r9, V8_UINT64_C(0x0000000000000008)); // expected result + __ movq(r9, uint64_t{0x0000000000000008}); // expected result __ cmpq(r8, r9); __ j(not_equal, &exit); __ incq(rax); __ blsil(r8, Operand(rsp, 0)); - __ movq(r9, V8_UINT64_C(0x0000000000000008)); // expected result + __ movq(r9, uint64_t{0x0000000000000008}); // expected result __ cmpq(r8, r9); __ j(not_equal, &exit); // blsmsk __ incq(rax); __ blsmskq(r8, rcx); - __ movq(r9, V8_UINT64_C(0x000000000000000f)); // expected result + __ movq(r9, uint64_t{0x000000000000000F}); // expected result __ cmpq(r8, r9); __ j(not_equal, &exit); __ incq(rax); __ blsmskq(r8, Operand(rsp, 0)); - __ movq(r9, V8_UINT64_C(0x000000000000000f)); // expected result + __ movq(r9, uint64_t{0x000000000000000F}); // expected result __ cmpq(r8, r9); __ j(not_equal, &exit); __ incq(rax); __ blsmskl(r8, rcx); - __ movq(r9, V8_UINT64_C(0x000000000000000f)); // expected result + __ movq(r9, uint64_t{0x000000000000000F}); // expected result __ cmpq(r8, r9); __ j(not_equal, &exit); __ incq(rax); __ blsmskl(r8, Operand(rsp, 0)); - __ movq(r9, V8_UINT64_C(0x000000000000000f)); // expected result + __ movq(r9, uint64_t{0x000000000000000F}); // expected result __ cmpq(r8, r9); __ j(not_equal, &exit); // blsr __ incq(rax); __ blsrq(r8, rcx); - __ movq(r9, V8_UINT64_C(0x1122334455667780)); // expected result + __ movq(r9, uint64_t{0x1122334455667780}); // expected result __ cmpq(r8, r9); __ j(not_equal, &exit); __ incq(rax); __ blsrq(r8, Operand(rsp, 0)); - __ movq(r9, V8_UINT64_C(0x1122334455667780)); // expected result + __ movq(r9, uint64_t{0x1122334455667780}); // expected result __ cmpq(r8, r9); __ j(not_equal, &exit); __ incq(rax); __ blsrl(r8, rcx); - __ movq(r9, V8_UINT64_C(0x0000000055667780)); // expected result + __ movq(r9, uint64_t{0x0000000055667780}); // expected result __ cmpq(r8, r9); __ j(not_equal, &exit); __ incq(rax); __ blsrl(r8, Operand(rsp, 0)); - __ movq(r9, V8_UINT64_C(0x0000000055667780)); // expected result + __ movq(r9, uint64_t{0x0000000055667780}); // expected result __ cmpq(r8, r9); __ j(not_equal, &exit); // tzcnt __ incq(rax); __ tzcntq(r8, rcx); - __ movq(r9, V8_UINT64_C(0x0000000000000003)); // expected result + __ movq(r9, uint64_t{0x0000000000000003}); // expected result __ cmpq(r8, r9); __ j(not_equal, &exit); __ incq(rax); __ tzcntq(r8, Operand(rsp, 0)); - __ movq(r9, V8_UINT64_C(0x0000000000000003)); // expected result + __ movq(r9, uint64_t{0x0000000000000003}); // expected result __ cmpq(r8, r9); __ j(not_equal, &exit); __ incq(rax); __ tzcntl(r8, rcx); - __ movq(r9, V8_UINT64_C(0x0000000000000003)); // expected result + __ movq(r9, uint64_t{0x0000000000000003}); // expected result __ cmpq(r8, r9); __ j(not_equal, &exit); __ incq(rax); __ tzcntl(r8, Operand(rsp, 0)); - __ movq(r9, V8_UINT64_C(0x0000000000000003)); // expected result + __ movq(r9, uint64_t{0x0000000000000003}); // expected result __ cmpq(r8, r9); __ j(not_equal, &exit); @@ -1965,30 +1982,30 @@ TEST(AssemblerX64LZCNT) { CpuFeatureScope fscope(&masm, LZCNT); Label exit; - __ movq(rcx, V8_UINT64_C(0x1122334455667788)); // source operand + __ movq(rcx, uint64_t{0x1122334455667788}); // source operand __ pushq(rcx); // For memory operand __ movl(rax, Immediate(1)); // Test number __ lzcntq(r8, rcx); - __ movq(r9, V8_UINT64_C(0x0000000000000003)); // expected result + __ movq(r9, uint64_t{0x0000000000000003}); // expected result __ cmpq(r8, r9); __ j(not_equal, &exit); __ incq(rax); __ lzcntq(r8, Operand(rsp, 0)); - __ movq(r9, V8_UINT64_C(0x0000000000000003)); // expected result + __ movq(r9, uint64_t{0x0000000000000003}); // expected result __ cmpq(r8, r9); __ j(not_equal, &exit); __ incq(rax); __ lzcntl(r8, rcx); - __ movq(r9, V8_UINT64_C(0x0000000000000001)); // expected result + __ movq(r9, uint64_t{0x0000000000000001}); // expected result __ cmpq(r8, r9); __ j(not_equal, &exit); __ incq(rax); __ lzcntl(r8, Operand(rsp, 0)); - __ movq(r9, V8_UINT64_C(0x0000000000000001)); // expected result + __ movq(r9, uint64_t{0x0000000000000001}); // expected result __ cmpq(r8, r9); __ j(not_equal, &exit); @@ -2025,30 +2042,30 @@ TEST(AssemblerX64POPCNT) { CpuFeatureScope fscope(&masm, POPCNT); Label exit; - __ movq(rcx, V8_UINT64_C(0x1111111111111100)); // source operand + __ movq(rcx, uint64_t{0x1111111111111100}); // source operand __ pushq(rcx); // For memory operand __ movl(rax, Immediate(1)); // Test number __ popcntq(r8, rcx); - __ movq(r9, V8_UINT64_C(0x000000000000000e)); // expected result + __ movq(r9, uint64_t{0x000000000000000E}); // expected result __ cmpq(r8, r9); __ j(not_equal, &exit); __ incq(rax); __ popcntq(r8, Operand(rsp, 0)); - __ movq(r9, V8_UINT64_C(0x000000000000000e)); // expected result + __ movq(r9, uint64_t{0x000000000000000E}); // expected result __ cmpq(r8, r9); __ j(not_equal, &exit); __ incq(rax); __ popcntl(r8, rcx); - __ movq(r9, V8_UINT64_C(0x0000000000000006)); // expected result + __ movq(r9, uint64_t{0x0000000000000006}); // expected result __ cmpq(r8, r9); __ j(not_equal, &exit); __ incq(rax); __ popcntl(r8, Operand(rsp, 0)); - __ movq(r9, V8_UINT64_C(0x0000000000000006)); // expected result + __ movq(r9, uint64_t{0x0000000000000006}); // expected result __ cmpq(r8, r9); __ j(not_equal, &exit); @@ -2085,232 +2102,232 @@ TEST(AssemblerX64BMI2) { CpuFeatureScope fscope(&masm, BMI2); Label exit; __ pushq(rbx); // save rbx - __ movq(rcx, V8_UINT64_C(0x1122334455667788)); // source operand + __ movq(rcx, uint64_t{0x1122334455667788}); // source operand __ pushq(rcx); // For memory operand // bzhi - __ movq(rdx, V8_UINT64_C(0x0000000000000009)); + __ movq(rdx, uint64_t{0x0000000000000009}); __ movl(rax, Immediate(1)); // Test number __ bzhiq(r8, rcx, rdx); - __ movq(r9, V8_UINT64_C(0x0000000000000188)); // expected result + __ movq(r9, uint64_t{0x0000000000000188}); // expected result __ cmpq(r8, r9); __ j(not_equal, &exit); __ incq(rax); __ bzhiq(r8, Operand(rsp, 0), rdx); - __ movq(r9, V8_UINT64_C(0x0000000000000188)); // expected result + __ movq(r9, uint64_t{0x0000000000000188}); // expected result __ cmpq(r8, r9); __ j(not_equal, &exit); __ incq(rax); __ bzhil(r8, rcx, rdx); - __ movq(r9, V8_UINT64_C(0x0000000000000188)); // expected result + __ movq(r9, uint64_t{0x0000000000000188}); // expected result __ cmpq(r8, r9); __ j(not_equal, &exit); __ incq(rax); __ bzhil(r8, Operand(rsp, 0), rdx); - __ movq(r9, V8_UINT64_C(0x0000000000000188)); // expected result + __ movq(r9, uint64_t{0x0000000000000188}); // expected result __ cmpq(r8, r9); __ j(not_equal, &exit); // mulx - __ movq(rdx, V8_UINT64_C(0x0000000000001000)); + __ movq(rdx, uint64_t{0x0000000000001000}); __ incq(rax); __ mulxq(r8, r9, rcx); - __ movq(rbx, V8_UINT64_C(0x0000000000000112)); // expected result + __ movq(rbx, uint64_t{0x0000000000000112}); // expected result __ cmpq(r8, rbx); __ j(not_equal, &exit); - __ movq(rbx, V8_UINT64_C(0x2334455667788000)); // expected result + __ movq(rbx, uint64_t{0x2334455667788000}); // expected result __ cmpq(r9, rbx); __ j(not_equal, &exit); __ incq(rax); __ mulxq(r8, r9, Operand(rsp, 0)); - __ movq(rbx, V8_UINT64_C(0x0000000000000112)); // expected result + __ movq(rbx, uint64_t{0x0000000000000112}); // expected result __ cmpq(r8, rbx); __ j(not_equal, &exit); - __ movq(rbx, V8_UINT64_C(0x2334455667788000)); // expected result + __ movq(rbx, uint64_t{0x2334455667788000}); // expected result __ cmpq(r9, rbx); __ j(not_equal, &exit); __ incq(rax); __ mulxl(r8, r9, rcx); - __ movq(rbx, V8_UINT64_C(0x0000000000000556)); // expected result + __ movq(rbx, uint64_t{0x0000000000000556}); // expected result __ cmpq(r8, rbx); __ j(not_equal, &exit); - __ movq(rbx, V8_UINT64_C(0x0000000067788000)); // expected result + __ movq(rbx, uint64_t{0x0000000067788000}); // expected result __ cmpq(r9, rbx); __ j(not_equal, &exit); __ incq(rax); __ mulxl(r8, r9, Operand(rsp, 0)); - __ movq(rbx, V8_UINT64_C(0x0000000000000556)); // expected result + __ movq(rbx, uint64_t{0x0000000000000556}); // expected result __ cmpq(r8, rbx); __ j(not_equal, &exit); - __ movq(rbx, V8_UINT64_C(0x0000000067788000)); // expected result + __ movq(rbx, uint64_t{0x0000000067788000}); // expected result __ cmpq(r9, rbx); __ j(not_equal, &exit); // pdep - __ movq(rdx, V8_UINT64_C(0xfffffffffffffff0)); + __ movq(rdx, uint64_t{0xFFFFFFFFFFFFFFF0}); __ incq(rax); __ pdepq(r8, rdx, rcx); - __ movq(r9, V8_UINT64_C(0x1122334455667400)); // expected result + __ movq(r9, uint64_t{0x1122334455667400}); // expected result __ cmpq(r8, r9); __ j(not_equal, &exit); __ incq(rax); __ pdepq(r8, rdx, Operand(rsp, 0)); - __ movq(r9, V8_UINT64_C(0x1122334455667400)); // expected result + __ movq(r9, uint64_t{0x1122334455667400}); // expected result __ cmpq(r8, r9); __ j(not_equal, &exit); __ incq(rax); __ pdepl(r8, rdx, rcx); - __ movq(r9, V8_UINT64_C(0x0000000055667400)); // expected result + __ movq(r9, uint64_t{0x0000000055667400}); // expected result __ cmpq(r8, r9); __ j(not_equal, &exit); __ incq(rax); __ pdepl(r8, rdx, Operand(rsp, 0)); - __ movq(r9, V8_UINT64_C(0x0000000055667400)); // expected result + __ movq(r9, uint64_t{0x0000000055667400}); // expected result __ cmpq(r8, r9); __ j(not_equal, &exit); // pext - __ movq(rdx, V8_UINT64_C(0xfffffffffffffff0)); + __ movq(rdx, uint64_t{0xFFFFFFFFFFFFFFF0}); __ incq(rax); __ pextq(r8, rdx, rcx); - __ movq(r9, V8_UINT64_C(0x0000000003fffffe)); // expected result + __ movq(r9, uint64_t{0x0000000003FFFFFE}); // expected result __ cmpq(r8, r9); __ j(not_equal, &exit); __ incq(rax); __ pextq(r8, rdx, Operand(rsp, 0)); - __ movq(r9, V8_UINT64_C(0x0000000003fffffe)); // expected result + __ movq(r9, uint64_t{0x0000000003FFFFFE}); // expected result __ cmpq(r8, r9); __ j(not_equal, &exit); __ incq(rax); __ pextl(r8, rdx, rcx); - __ movq(r9, V8_UINT64_C(0x000000000000fffe)); // expected result + __ movq(r9, uint64_t{0x000000000000FFFE}); // expected result __ cmpq(r8, r9); __ j(not_equal, &exit); __ incq(rax); __ pextl(r8, rdx, Operand(rsp, 0)); - __ movq(r9, V8_UINT64_C(0x000000000000fffe)); // expected result + __ movq(r9, uint64_t{0x000000000000FFFE}); // expected result __ cmpq(r8, r9); __ j(not_equal, &exit); // sarx - __ movq(rdx, V8_UINT64_C(0x0000000000000004)); + __ movq(rdx, uint64_t{0x0000000000000004}); __ incq(rax); __ sarxq(r8, rcx, rdx); - __ movq(r9, V8_UINT64_C(0x0112233445566778)); // expected result + __ movq(r9, uint64_t{0x0112233445566778}); // expected result __ cmpq(r8, r9); __ j(not_equal, &exit); __ incq(rax); __ sarxq(r8, Operand(rsp, 0), rdx); - __ movq(r9, V8_UINT64_C(0x0112233445566778)); // expected result + __ movq(r9, uint64_t{0x0112233445566778}); // expected result __ cmpq(r8, r9); __ j(not_equal, &exit); __ incq(rax); __ sarxl(r8, rcx, rdx); - __ movq(r9, V8_UINT64_C(0x0000000005566778)); // expected result + __ movq(r9, uint64_t{0x0000000005566778}); // expected result __ cmpq(r8, r9); __ j(not_equal, &exit); __ incq(rax); __ sarxl(r8, Operand(rsp, 0), rdx); - __ movq(r9, V8_UINT64_C(0x0000000005566778)); // expected result + __ movq(r9, uint64_t{0x0000000005566778}); // expected result __ cmpq(r8, r9); __ j(not_equal, &exit); // shlx - __ movq(rdx, V8_UINT64_C(0x0000000000000004)); + __ movq(rdx, uint64_t{0x0000000000000004}); __ incq(rax); __ shlxq(r8, rcx, rdx); - __ movq(r9, V8_UINT64_C(0x1223344556677880)); // expected result + __ movq(r9, uint64_t{0x1223344556677880}); // expected result __ cmpq(r8, r9); __ j(not_equal, &exit); __ incq(rax); __ shlxq(r8, Operand(rsp, 0), rdx); - __ movq(r9, V8_UINT64_C(0x1223344556677880)); // expected result + __ movq(r9, uint64_t{0x1223344556677880}); // expected result __ cmpq(r8, r9); __ j(not_equal, &exit); __ incq(rax); __ shlxl(r8, rcx, rdx); - __ movq(r9, V8_UINT64_C(0x0000000056677880)); // expected result + __ movq(r9, uint64_t{0x0000000056677880}); // expected result __ cmpq(r8, r9); __ j(not_equal, &exit); __ incq(rax); __ shlxl(r8, Operand(rsp, 0), rdx); - __ movq(r9, V8_UINT64_C(0x0000000056677880)); // expected result + __ movq(r9, uint64_t{0x0000000056677880}); // expected result __ cmpq(r8, r9); __ j(not_equal, &exit); // shrx - __ movq(rdx, V8_UINT64_C(0x0000000000000004)); + __ movq(rdx, uint64_t{0x0000000000000004}); __ incq(rax); __ shrxq(r8, rcx, rdx); - __ movq(r9, V8_UINT64_C(0x0112233445566778)); // expected result + __ movq(r9, uint64_t{0x0112233445566778}); // expected result __ cmpq(r8, r9); __ j(not_equal, &exit); __ incq(rax); __ shrxq(r8, Operand(rsp, 0), rdx); - __ movq(r9, V8_UINT64_C(0x0112233445566778)); // expected result + __ movq(r9, uint64_t{0x0112233445566778}); // expected result __ cmpq(r8, r9); __ j(not_equal, &exit); __ incq(rax); __ shrxl(r8, rcx, rdx); - __ movq(r9, V8_UINT64_C(0x0000000005566778)); // expected result + __ movq(r9, uint64_t{0x0000000005566778}); // expected result __ cmpq(r8, r9); __ j(not_equal, &exit); __ incq(rax); __ shrxl(r8, Operand(rsp, 0), rdx); - __ movq(r9, V8_UINT64_C(0x0000000005566778)); // expected result + __ movq(r9, uint64_t{0x0000000005566778}); // expected result __ cmpq(r8, r9); __ j(not_equal, &exit); // rorx __ incq(rax); __ rorxq(r8, rcx, 0x4); - __ movq(r9, V8_UINT64_C(0x8112233445566778)); // expected result + __ movq(r9, uint64_t{0x8112233445566778}); // expected result __ cmpq(r8, r9); __ j(not_equal, &exit); __ incq(rax); __ rorxq(r8, Operand(rsp, 0), 0x4); - __ movq(r9, V8_UINT64_C(0x8112233445566778)); // expected result + __ movq(r9, uint64_t{0x8112233445566778}); // expected result __ cmpq(r8, r9); __ j(not_equal, &exit); __ incq(rax); __ rorxl(r8, rcx, 0x4); - __ movq(r9, V8_UINT64_C(0x0000000085566778)); // expected result + __ movq(r9, uint64_t{0x0000000085566778}); // expected result __ cmpq(r8, r9); __ j(not_equal, &exit); __ incq(rax); __ rorxl(r8, Operand(rsp, 0), 0x4); - __ movq(r9, V8_UINT64_C(0x0000000085566778)); // expected result + __ movq(r9, uint64_t{0x0000000085566778}); // expected result __ cmpq(r8, r9); __ j(not_equal, &exit); @@ -2444,8 +2461,9 @@ TEST(AssemblerX64PslldWithXmm15) { CodeDesc desc; masm.GetCode(CcTest::i_isolate(), &desc); - uint64_t result = FUNCTION_CAST<F5>(buffer)(V8_UINT64_C(0x1122334455667788)); - CHECK_EQ(V8_UINT64_C(0x22446688aaccef10), result); + MakeAssemblerBufferExecutable(buffer, allocated); + uint64_t result = FUNCTION_CAST<F5>(buffer)(uint64_t{0x1122334455667788}); + CHECK_EQ(uint64_t{0x22446688AACCEF10}, result); } typedef float (*F9)(float x, float y); diff --git a/deps/v8/test/cctest/test-atomicops.cc b/deps/v8/test/cctest/test-atomicops.cc index add819f771..92421138cb 100644 --- a/deps/v8/test/cctest/test-atomicops.cc +++ b/deps/v8/test/cctest/test-atomicops.cc @@ -168,12 +168,11 @@ static void TestAtomicIncrementBounds() { CHECK_EQU(test_val - 1, value); } - -// Return an AtomicType with the value 0xa5a5a5.. +// Return an AtomicType with the value 0xA5A5A5.. template <class AtomicType> static AtomicType TestFillValue() { AtomicType val = 0; - memset(&val, 0xa5, sizeof(AtomicType)); + memset(&val, 0xA5, sizeof(AtomicType)); return val; } diff --git a/deps/v8/test/cctest/test-bignum.cc b/deps/v8/test/cctest/test-bignum.cc index d9721b06e1..966ee5b5d4 100644 --- a/deps/v8/test/cctest/test-bignum.cc +++ b/deps/v8/test/cctest/test-bignum.cc @@ -641,7 +641,7 @@ TEST(MultiplyUInt64) { CHECK_EQ(0, strcmp("FFFEFFFFFFFFFFFF00010000000000000000000000000", buffer)); AssignDecimalString(&bignum, "15611230384529777"); - bignum.MultiplyByUInt64(V8_2PART_UINT64_C(0x8ac72304, 89e80000)); + bignum.MultiplyByUInt64(V8_2PART_UINT64_C(0x8AC72304, 89E80000)); CHECK(bignum.ToHexString(buffer, kBufferSize)); CHECK_EQ(0, strcmp("1E10EE4B11D15A7F3DE7F3C7680000", buffer)); } diff --git a/deps/v8/test/cctest/test-code-layout.cc b/deps/v8/test/cctest/test-code-layout.cc index caeeaf3283..7f6fa58b17 100644 --- a/deps/v8/test/cctest/test-code-layout.cc +++ b/deps/v8/test/cctest/test-code-layout.cc @@ -15,8 +15,8 @@ TEST(CodeLayoutWithoutUnwindingInfo) { HandleScope handle_scope(CcTest::i_isolate()); // "Hello, World!" in ASCII. - byte buffer_array[13] = {0x48, 0x65, 0x6c, 0x6c, 0x6f, 0x2c, 0x20, - 0x57, 0x6f, 0x72, 0x6c, 0x64, 0x21}; + byte buffer_array[13] = {0x48, 0x65, 0x6C, 0x6C, 0x6F, 0x2C, 0x20, + 0x57, 0x6F, 0x72, 0x6C, 0x64, 0x21}; byte* buffer = &buffer_array[0]; int buffer_size = sizeof(buffer_array); @@ -46,11 +46,11 @@ TEST(CodeLayoutWithUnwindingInfo) { HandleScope handle_scope(CcTest::i_isolate()); // "Hello, World!" in ASCII. - byte buffer_array[13] = {0x48, 0x65, 0x6c, 0x6c, 0x6f, 0x2c, 0x20, - 0x57, 0x6f, 0x72, 0x6c, 0x64, 0x21}; + byte buffer_array[13] = {0x48, 0x65, 0x6C, 0x6C, 0x6F, 0x2C, 0x20, + 0x57, 0x6F, 0x72, 0x6C, 0x64, 0x21}; // "JavaScript" in ASCII. - byte unwinding_info_array[10] = {0x4a, 0x61, 0x76, 0x61, 0x53, + byte unwinding_info_array[10] = {0x4A, 0x61, 0x76, 0x61, 0x53, 0x63, 0x72, 0x69, 0x70, 0x74}; byte* buffer = &buffer_array[0]; diff --git a/deps/v8/test/cctest/test-code-stub-assembler.cc b/deps/v8/test/cctest/test-code-stub-assembler.cc index 7a94d3a511..7889a61a77 100644 --- a/deps/v8/test/cctest/test-code-stub-assembler.cc +++ b/deps/v8/test/cctest/test-code-stub-assembler.cc @@ -237,8 +237,8 @@ TEST(DecodeWordFromWord32) { CodeStubAssembler m(asm_tester.state()); class TestBitField : public BitField<unsigned, 3, 3> {}; - m.Return( - m.SmiTag(m.DecodeWordFromWord32<TestBitField>(m.Int32Constant(0x2f)))); + m.Return(m.SmiTag( + m.Signed(m.DecodeWordFromWord32<TestBitField>(m.Int32Constant(0x2F))))); FunctionTester ft(asm_tester.GenerateCode()); MaybeHandle<Object> result = ft.Call(); // value = 00101111 @@ -914,7 +914,7 @@ TEST(TryHasOwnProperty) { JSFunction::EnsureHasInitialMap(function); function->initial_map()->set_instance_type(JS_GLOBAL_OBJECT_TYPE); function->initial_map()->set_is_prototype_map(true); - function->initial_map()->set_dictionary_map(true); + function->initial_map()->set_is_dictionary_map(true); function->initial_map()->set_may_have_interesting_symbols(true); Handle<JSObject> object = factory->NewJSGlobalObject(function); AddProperties(object, names, arraysize(names)); @@ -1706,7 +1706,94 @@ TEST(Arguments) { CSA_ASSERT( &m, m.WordEqual(arguments.AtIndex(2), m.SmiConstant(Smi::FromInt(14)))); - m.Return(arguments.GetReceiver()); + arguments.PopAndReturn(arguments.GetReceiver()); + + FunctionTester ft(asm_tester.GenerateCode(), kNumParams); + Handle<Object> result = ft.Call(isolate->factory()->undefined_value(), + Handle<Smi>(Smi::FromInt(12), isolate), + Handle<Smi>(Smi::FromInt(13), isolate), + Handle<Smi>(Smi::FromInt(14), isolate)) + .ToHandleChecked(); + CHECK_EQ(*isolate->factory()->undefined_value(), *result); +} + +TEST(ArgumentsWithSmiConstantIndices) { + Isolate* isolate(CcTest::InitIsolateOnce()); + + const int kNumParams = 4; + CodeAssemblerTester asm_tester(isolate, kNumParams); + CodeStubAssembler m(asm_tester.state()); + + CodeStubArguments arguments(&m, m.SmiConstant(3), nullptr, + CodeStubAssembler::SMI_PARAMETERS); + + CSA_ASSERT(&m, + m.WordEqual(arguments.AtIndex(m.SmiConstant(0), + CodeStubAssembler::SMI_PARAMETERS), + m.SmiConstant(Smi::FromInt(12)))); + CSA_ASSERT(&m, + m.WordEqual(arguments.AtIndex(m.SmiConstant(1), + CodeStubAssembler::SMI_PARAMETERS), + m.SmiConstant(Smi::FromInt(13)))); + CSA_ASSERT(&m, + m.WordEqual(arguments.AtIndex(m.SmiConstant(2), + CodeStubAssembler::SMI_PARAMETERS), + m.SmiConstant(Smi::FromInt(14)))); + + arguments.PopAndReturn(arguments.GetReceiver()); + + FunctionTester ft(asm_tester.GenerateCode(), kNumParams); + Handle<Object> result = ft.Call(isolate->factory()->undefined_value(), + Handle<Smi>(Smi::FromInt(12), isolate), + Handle<Smi>(Smi::FromInt(13), isolate), + Handle<Smi>(Smi::FromInt(14), isolate)) + .ToHandleChecked(); + CHECK_EQ(*isolate->factory()->undefined_value(), *result); +} + +TNode<Smi> NonConstantSmi(CodeStubAssembler* m, int value) { + // Generate a SMI with the given value and feed it through a Phi so it can't + // be inferred to be constant. + Variable var(m, MachineRepresentation::kTagged, m->SmiConstant(value)); + Label dummy_done(m); + // Even though the Goto always executes, it will taint the variable and thus + // make it appear non-constant when used later. + m->GotoIf(m->Int32Constant(1), &dummy_done); + var.Bind(m->SmiConstant(value)); + m->Goto(&dummy_done); + m->BIND(&dummy_done); + + // Ensure that the above hackery actually created a non-constant SMI. + Smi* smi_constant; + CHECK(!m->ToSmiConstant(var.value(), smi_constant)); + + return m->UncheckedCast<Smi>(var.value()); +} + +TEST(ArgumentsWithSmiIndices) { + Isolate* isolate(CcTest::InitIsolateOnce()); + + const int kNumParams = 4; + CodeAssemblerTester asm_tester(isolate, kNumParams); + CodeStubAssembler m(asm_tester.state()); + + CodeStubArguments arguments(&m, m.SmiConstant(3), nullptr, + CodeStubAssembler::SMI_PARAMETERS); + + CSA_ASSERT(&m, + m.WordEqual(arguments.AtIndex(NonConstantSmi(&m, 0), + CodeStubAssembler::SMI_PARAMETERS), + m.SmiConstant(Smi::FromInt(12)))); + CSA_ASSERT(&m, + m.WordEqual(arguments.AtIndex(NonConstantSmi(&m, 1), + CodeStubAssembler::SMI_PARAMETERS), + m.SmiConstant(Smi::FromInt(13)))); + CSA_ASSERT(&m, + m.WordEqual(arguments.AtIndex(NonConstantSmi(&m, 2), + CodeStubAssembler::SMI_PARAMETERS), + m.SmiConstant(Smi::FromInt(14)))); + + arguments.PopAndReturn(arguments.GetReceiver()); FunctionTester ft(asm_tester.GenerateCode(), kNumParams); Handle<Object> result = ft.Call(isolate->factory()->undefined_value(), @@ -1734,7 +1821,7 @@ TEST(ArgumentsForEach) { arguments.ForEach( list, [&m, &sum](Node* arg) { sum.Bind(m.SmiAdd(sum.value(), arg)); }); - m.Return(sum.value()); + arguments.PopAndReturn(sum.value()); FunctionTester ft(asm_tester.GenerateCode(), kNumParams); Handle<Object> result = ft.Call(isolate->factory()->undefined_value(), @@ -2663,7 +2750,7 @@ TEST(GotoIfNotWhiteSpaceOrLineTerminator) { } } -TEST(BranchIfNumericRelationalComparison) { +TEST(BranchIfNumberRelationalComparison) { Isolate* isolate(CcTest::InitIsolateOnce()); Factory* f = isolate->factory(); const int kNumParams = 2; @@ -2671,9 +2758,9 @@ TEST(BranchIfNumericRelationalComparison) { { CodeStubAssembler m(asm_tester.state()); Label return_true(&m), return_false(&m); - m.BranchIfNumericRelationalComparison(Operation::kGreaterThanOrEqual, - m.Parameter(0), m.Parameter(1), - &return_true, &return_false); + m.BranchIfNumberRelationalComparison(Operation::kGreaterThanOrEqual, + m.Parameter(0), m.Parameter(1), + &return_true, &return_false); m.BIND(&return_true); m.Return(m.BooleanConstant(true)); m.BIND(&return_false); diff --git a/deps/v8/test/cctest/test-code-stubs-arm.cc b/deps/v8/test/cctest/test-code-stubs-arm.cc index 076c918906..d042ea617b 100644 --- a/deps/v8/test/cctest/test-code-stubs-arm.cc +++ b/deps/v8/test/cctest/test-code-stubs-arm.cc @@ -97,7 +97,7 @@ ConvertDToIFunc MakeConvertDToIFuncTrampoline(Isolate* isolate, if (reg != destination_reg) { __ ldr(ip, MemOperand(sp, 0)); __ cmp(reg, ip); - __ Assert(eq, kRegisterWasClobbered); + __ Assert(eq, AbortReason::kRegisterWasClobbered); __ add(sp, sp, Operand(kPointerSize)); } } @@ -115,6 +115,7 @@ ConvertDToIFunc MakeConvertDToIFuncTrampoline(Isolate* isolate, CodeDesc desc; masm.GetCode(isolate, &desc); + MakeAssemblerBufferExecutable(buffer, allocated); Assembler::FlushICache(isolate, buffer, allocated); return (reinterpret_cast<ConvertDToIFunc>( reinterpret_cast<intptr_t>(buffer))); @@ -131,7 +132,8 @@ static Isolate* GetIsolateFrom(LocalContext* context) { int32_t RunGeneratedCodeCallWrapper(ConvertDToIFunc func, double from) { #ifdef USE_SIMULATOR - return CALL_GENERATED_FP_INT(CcTest::i_isolate(), func, from, 0); + return Simulator::current(CcTest::i_isolate()) + ->CallFP<int32_t>(FUNCTION_ADDR(func), from, 0); #else return (*func)(from); #endif diff --git a/deps/v8/test/cctest/test-code-stubs-arm64.cc b/deps/v8/test/cctest/test-code-stubs-arm64.cc index db175de5ec..1086bea7ce 100644 --- a/deps/v8/test/cctest/test-code-stubs-arm64.cc +++ b/deps/v8/test/cctest/test-code-stubs-arm64.cc @@ -57,64 +57,78 @@ ConvertDToIFunc MakeConvertDToIFuncTrampoline(Isolate* isolate, byte* start = stub.GetCode()->instruction_start(); - __ SetStackPointer(csp); __ PushCalleeSavedRegisters(); - __ Mov(jssp, csp); - __ SetStackPointer(jssp); - - // Push the double argument. - __ Push(d0); MacroAssembler::PushPopQueue queue(&masm); // Save registers make sure they don't get clobbered. int source_reg_offset = kDoubleSize; int reg_num = 0; + queue.Queue(xzr); // Push xzr to maintain sp alignment. for (; reg_num < Register::kNumRegisters; ++reg_num) { if (RegisterConfiguration::Default()->IsAllocatableGeneralCode(reg_num)) { Register reg = Register::from_code(reg_num); - if (!reg.is(destination_reg)) { - queue.Queue(reg); - source_reg_offset += kPointerSize; - } + queue.Queue(reg); + source_reg_offset += kPointerSize; } } - // Re-push the double argument. + // Push the double argument. We push a second copy to maintain sp alignment. + queue.Queue(d0); queue.Queue(d0); queue.PushQueued(); - // Call through to the actual stub + // Call through to the actual stub. __ Call(start, RelocInfo::EXTERNAL_REFERENCE); - __ Drop(1, kDoubleSize); + __ Drop(2, kDoubleSize); + + // Make sure no registers have been unexpectedly clobbered. + { + const RegisterConfiguration* config(RegisterConfiguration::Default()); + int allocatable_register_count = + config->num_allocatable_general_registers(); + UseScratchRegisterScope temps(&masm); + Register temp0 = temps.AcquireX(); + Register temp1 = temps.AcquireX(); + for (int i = allocatable_register_count - 1; i > 0; i -= 2) { + int code0 = config->GetAllocatableGeneralCode(i); + int code1 = config->GetAllocatableGeneralCode(i - 1); + Register reg0 = Register::from_code(code0); + Register reg1 = Register::from_code(code1); + __ Pop(temp0, temp1); + if (!reg0.is(destination_reg)) { + __ Cmp(reg0, temp0); + __ Assert(eq, AbortReason::kRegisterWasClobbered); + } + if (!reg1.is(destination_reg)) { + __ Cmp(reg1, temp1); + __ Assert(eq, AbortReason::kRegisterWasClobbered); + } + } - // // Make sure no registers have been unexpectedly clobbered - for (--reg_num; reg_num >= 0; --reg_num) { - if (RegisterConfiguration::Default()->IsAllocatableGeneralCode(reg_num)) { - Register reg = Register::from_code(reg_num); + if (allocatable_register_count % 2 != 0) { + int code = config->GetAllocatableGeneralCode(0); + Register reg = Register::from_code(code); + __ Pop(temp0, xzr); if (!reg.is(destination_reg)) { - __ Pop(ip0); - __ cmp(reg, ip0); - __ Assert(eq, kRegisterWasClobbered); + __ Cmp(reg, temp0); + __ Assert(eq, AbortReason::kRegisterWasClobbered); } } } - __ Drop(1, kDoubleSize); - if (!destination_reg.is(x0)) __ Mov(x0, destination_reg); // Restore callee save registers. - __ Mov(csp, jssp); - __ SetStackPointer(csp); __ PopCalleeSavedRegisters(); __ Ret(); CodeDesc desc; masm.GetCode(isolate, &desc); + MakeAssemblerBufferExecutable(buffer, allocated); Assembler::FlushICache(isolate, buffer, allocated); return (reinterpret_cast<ConvertDToIFunc>( reinterpret_cast<intptr_t>(buffer))); @@ -131,12 +145,8 @@ static Isolate* GetIsolateFrom(LocalContext* context) { int32_t RunGeneratedCodeCallWrapper(ConvertDToIFunc func, double from) { #ifdef USE_SIMULATOR - Simulator::CallArgument args[] = { - Simulator::CallArgument(from), - Simulator::CallArgument::End() - }; - return static_cast<int32_t>(Simulator::current(CcTest::i_isolate()) - ->CallInt64(FUNCTION_ADDR(func), args)); + return Simulator::current(CcTest::i_isolate()) + ->Call<int32_t>(FUNCTION_ADDR(func), from); #else return (*func)(from); #endif diff --git a/deps/v8/test/cctest/test-code-stubs-ia32.cc b/deps/v8/test/cctest/test-code-stubs-ia32.cc index 2fe7e26ddc..7e62ab85e8 100644 --- a/deps/v8/test/cctest/test-code-stubs-ia32.cc +++ b/deps/v8/test/cctest/test-code-stubs-ia32.cc @@ -90,7 +90,7 @@ ConvertDToIFunc MakeConvertDToIFuncTrampoline(Isolate* isolate, Register reg = Register::from_code(reg_num); if (reg != esp && reg != ebp && reg != destination_reg) { __ cmp(reg, MemOperand(esp, 0)); - __ Assert(equal, kRegisterWasClobbered); + __ Assert(equal, AbortReason::kRegisterWasClobbered); __ add(esp, Immediate(kPointerSize)); } } @@ -108,6 +108,7 @@ ConvertDToIFunc MakeConvertDToIFuncTrampoline(Isolate* isolate, CodeDesc desc; masm.GetCode(isolate, &desc); + MakeAssemblerBufferExecutable(buffer, allocated); return reinterpret_cast<ConvertDToIFunc>( reinterpret_cast<intptr_t>(buffer)); } diff --git a/deps/v8/test/cctest/test-code-stubs-mips.cc b/deps/v8/test/cctest/test-code-stubs-mips.cc index 123089614b..b1df94feed 100644 --- a/deps/v8/test/cctest/test-code-stubs-mips.cc +++ b/deps/v8/test/cctest/test-code-stubs-mips.cc @@ -102,7 +102,7 @@ ConvertDToIFunc MakeConvertDToIFuncTrampoline(Isolate* isolate, Register reg = Register::from_code(reg_num); if (reg != destination_reg) { __ lw(at, MemOperand(sp, 0)); - __ Assert(eq, kRegisterWasClobbered, reg, Operand(at)); + __ Assert(eq, AbortReason::kRegisterWasClobbered, reg, Operand(at)); __ Addu(sp, sp, Operand(kPointerSize)); } } @@ -128,6 +128,7 @@ ConvertDToIFunc MakeConvertDToIFuncTrampoline(Isolate* isolate, CodeDesc desc; masm.GetCode(isolate, &desc); + MakeAssemblerBufferExecutable(buffer, allocated); Assembler::FlushICache(isolate, buffer, allocated); return (reinterpret_cast<ConvertDToIFunc>( reinterpret_cast<intptr_t>(buffer))); diff --git a/deps/v8/test/cctest/test-code-stubs-mips64.cc b/deps/v8/test/cctest/test-code-stubs-mips64.cc index ad4c49338a..c09dac24ea 100644 --- a/deps/v8/test/cctest/test-code-stubs-mips64.cc +++ b/deps/v8/test/cctest/test-code-stubs-mips64.cc @@ -100,7 +100,7 @@ ConvertDToIFunc MakeConvertDToIFuncTrampoline(Isolate* isolate, Register reg = Register::from_code(reg_num); if (reg != destination_reg) { __ Ld(at, MemOperand(sp, 0)); - __ Assert(eq, kRegisterWasClobbered, reg, Operand(at)); + __ Assert(eq, AbortReason::kRegisterWasClobbered, reg, Operand(at)); __ Daddu(sp, sp, Operand(kPointerSize)); } } @@ -125,6 +125,7 @@ ConvertDToIFunc MakeConvertDToIFuncTrampoline(Isolate* isolate, CodeDesc desc; masm.GetCode(isolate, &desc); + MakeAssemblerBufferExecutable(buffer, allocated); Assembler::FlushICache(isolate, buffer, allocated); return (reinterpret_cast<ConvertDToIFunc>( reinterpret_cast<intptr_t>(buffer))); diff --git a/deps/v8/test/cctest/test-code-stubs-x64.cc b/deps/v8/test/cctest/test-code-stubs-x64.cc index d69da6d0f6..a03cb4b658 100644 --- a/deps/v8/test/cctest/test-code-stubs-x64.cc +++ b/deps/v8/test/cctest/test-code-stubs-x64.cc @@ -89,7 +89,7 @@ ConvertDToIFunc MakeConvertDToIFuncTrampoline(Isolate* isolate, Register::from_code(config->GetAllocatableGeneralCode(reg_num)); if (reg != rsp && reg != rbp && reg != destination_reg) { __ cmpq(reg, MemOperand(rsp, 0)); - __ Assert(equal, kRegisterWasClobbered); + __ Assert(equal, AbortReason::kRegisterWasClobbered); __ addq(rsp, Immediate(kPointerSize)); } } @@ -106,6 +106,7 @@ ConvertDToIFunc MakeConvertDToIFuncTrampoline(Isolate* isolate, CodeDesc desc; masm.GetCode(isolate, &desc); + MakeAssemblerBufferExecutable(buffer, allocated); return reinterpret_cast<ConvertDToIFunc>( reinterpret_cast<intptr_t>(buffer)); } diff --git a/deps/v8/test/cctest/test-code-stubs.cc b/deps/v8/test/cctest/test-code-stubs.cc index 27f411c56c..61d3a81083 100644 --- a/deps/v8/test/cctest/test-code-stubs.cc +++ b/deps/v8/test/cctest/test-code-stubs.cc @@ -193,7 +193,7 @@ TEST(CodeStubMajorKeys) { #define CHECK_STUB(NAME) \ { \ HandleScope scope(isolate); \ - NAME##Stub stub_impl(0xabcd, isolate); \ + NAME##Stub stub_impl(0xABCD, isolate); \ CodeStub* stub = &stub_impl; \ CHECK_EQ(stub->MajorKey(), CodeStub::NAME); \ } diff --git a/deps/v8/test/cctest/test-compiler.cc b/deps/v8/test/cctest/test-compiler.cc index 92ed988b06..f9195c57fa 100644 --- a/deps/v8/test/cctest/test-compiler.cc +++ b/deps/v8/test/cctest/test-compiler.cc @@ -405,6 +405,7 @@ TEST(OptimizedCodeSharing1) { } TEST(CompileFunctionInContext) { + if (i::FLAG_always_opt) return; CcTest::InitializeVM(); v8::HandleScope scope(CcTest::isolate()); LocalContext env; @@ -420,6 +421,8 @@ TEST(CompileFunctionInContext) { 0, nullptr, 1, &math) .ToLocalChecked(); CHECK(!fun.IsEmpty()); + + i::DisallowCompilation no_compile(CcTest::i_isolate()); fun->Call(env.local(), env->Global(), 0, nullptr).ToLocalChecked(); CHECK(env->Global()->Has(env.local(), v8_str("a")).FromJust()); v8::Local<v8::Value> a = @@ -483,7 +486,11 @@ TEST(CompileFunctionInContextArgs) { v8::ScriptCompiler::CompileFunctionInContext(env.local(), &script_source, 1, &arg, 1, ext) .ToLocalChecked(); - CHECK(!fun.IsEmpty()); + CHECK_EQ(1, fun->Get(env.local(), v8_str("length")) + .ToLocalChecked() + ->ToInt32(env.local()) + .ToLocalChecked() + ->Value()); v8::Local<v8::Value> b_value = v8::Number::New(CcTest::isolate(), 42.0); fun->Call(env.local(), env->Global(), 1, &b_value).ToLocalChecked(); CHECK(env->Global()->Has(env.local(), v8_str("result")).FromJust()); @@ -531,6 +538,97 @@ TEST(CompileFunctionInContextNonIdentifierArgs) { .IsEmpty()); } +TEST(CompileFunctionInContextRenderCallSite) { + CcTest::InitializeVM(); + v8::HandleScope scope(CcTest::isolate()); + LocalContext env; + static const char* source1 = + "try {" + " var a = [];" + " a[0]();" + "} catch (e) {" + " return e.toString();" + "}"; + static const char* expect1 = "TypeError: a[0] is not a function"; + static const char* source2 = + "try {" + " (function() {" + " var a = [];" + " a[0]();" + " })()" + "} catch (e) {" + " return e.toString();" + "}"; + static const char* expect2 = "TypeError: a[0] is not a function"; + { + v8::ScriptCompiler::Source script_source(v8_str(source1)); + v8::Local<v8::Function> fun = + v8::ScriptCompiler::CompileFunctionInContext( + env.local(), &script_source, 0, nullptr, 0, nullptr) + .ToLocalChecked(); + CHECK(!fun.IsEmpty()); + v8::Local<v8::Value> result = + fun->Call(env.local(), env->Global(), 0, nullptr).ToLocalChecked(); + CHECK(result->IsString()); + CHECK(v8::Local<v8::String>::Cast(result) + ->Equals(env.local(), v8_str(expect1)) + .FromJust()); + } + { + v8::ScriptCompiler::Source script_source(v8_str(source2)); + v8::Local<v8::Function> fun = + v8::ScriptCompiler::CompileFunctionInContext( + env.local(), &script_source, 0, nullptr, 0, nullptr) + .ToLocalChecked(); + v8::Local<v8::Value> result = + fun->Call(env.local(), env->Global(), 0, nullptr).ToLocalChecked(); + CHECK(result->IsString()); + CHECK(v8::Local<v8::String>::Cast(result) + ->Equals(env.local(), v8_str(expect2)) + .FromJust()); + } +} + +TEST(CompileFunctionInContextQuirks) { + CcTest::InitializeVM(); + v8::HandleScope scope(CcTest::isolate()); + LocalContext env; + { + static const char* source = + "[x, y] = ['ab', 'cd'];" + "return x + y"; + static const char* expect = "abcd"; + v8::ScriptCompiler::Source script_source(v8_str(source)); + v8::Local<v8::Function> fun = + v8::ScriptCompiler::CompileFunctionInContext( + env.local(), &script_source, 0, nullptr, 0, nullptr) + .ToLocalChecked(); + v8::Local<v8::Value> result = + fun->Call(env.local(), env->Global(), 0, nullptr).ToLocalChecked(); + CHECK(result->IsString()); + CHECK(v8::Local<v8::String>::Cast(result) + ->Equals(env.local(), v8_str(expect)) + .FromJust()); + } + { + static const char* source = "'use strict'; var a = 077"; + v8::ScriptCompiler::Source script_source(v8_str(source)); + v8::TryCatch try_catch(CcTest::isolate()); + CHECK(v8::ScriptCompiler::CompileFunctionInContext( + env.local(), &script_source, 0, nullptr, 0, nullptr) + .IsEmpty()); + CHECK(try_catch.HasCaught()); + } + { + static const char* source = "{ let x; { var x } }"; + v8::ScriptCompiler::Source script_source(v8_str(source)); + v8::TryCatch try_catch(CcTest::isolate()); + CHECK(v8::ScriptCompiler::CompileFunctionInContext( + env.local(), &script_source, 0, nullptr, 0, nullptr) + .IsEmpty()); + CHECK(try_catch.HasCaught()); + } +} TEST(CompileFunctionInContextScriptOrigin) { CcTest::InitializeVM(); @@ -559,7 +657,7 @@ TEST(CompileFunctionInContextScriptOrigin) { CHECK_EQ(42 + strlen("throw "), static_cast<unsigned>(frame->GetColumn())); } -TEST(CompileFunctionInContextHarmonyFunctionToString) { +void TestCompileFunctionInContextToStringImpl() { #define CHECK_NOT_CAUGHT(__local_context__, try_catch, __op__) \ do { \ const char* op = (__op__); \ @@ -573,9 +671,7 @@ TEST(CompileFunctionInContextHarmonyFunctionToString) { } \ } while (0) - auto previous_flag = v8::internal::FLAG_harmony_function_tostring; - v8::internal::FLAG_harmony_function_tostring = true; - { + { // NOLINT CcTest::InitializeVM(); v8::HandleScope scope(CcTest::isolate()); LocalContext env; @@ -601,7 +697,8 @@ TEST(CompileFunctionInContextHarmonyFunctionToString) { v8::Local<v8::String> result = fun->ToString(env.local()).ToLocalChecked(); v8::Local<v8::String> expected = v8_str( - "function(event){return event\n" + "function (event) {\n" + "return event\n" "}"); CHECK(expected->Equals(env.local(), result).FromJust()); } @@ -625,16 +722,52 @@ TEST(CompileFunctionInContextHarmonyFunctionToString) { v8::Local<v8::String> result = fun->ToString(env.local()).ToLocalChecked(); v8::Local<v8::String> expected = v8_str( - "function(){return 0\n" + "function () {\n" + "return 0\n" "}"); CHECK(expected->Equals(env.local(), result).FromJust()); } - } - v8::internal::FLAG_harmony_function_tostring = previous_flag; + // With a name: + { + v8::ScriptOrigin origin(v8_str("test"), v8_int(17), v8_int(31)); + v8::ScriptCompiler::Source script_source(v8_str("return 0"), origin); + + v8::TryCatch try_catch(CcTest::isolate()); + v8::MaybeLocal<v8::Function> maybe_fun = + v8::ScriptCompiler::CompileFunctionInContext( + env.local(), &script_source, 0, nullptr, 0, nullptr); + + CHECK_NOT_CAUGHT(env.local(), try_catch, + "v8::ScriptCompiler::CompileFunctionInContext"); + + v8::Local<v8::Function> fun = maybe_fun.ToLocalChecked(); + CHECK(!fun.IsEmpty()); + CHECK(!try_catch.HasCaught()); + + fun->SetName(v8_str("onclick")); + + v8::Local<v8::String> result = + fun->ToString(env.local()).ToLocalChecked(); + v8::Local<v8::String> expected = v8_str( + "function onclick() {\n" + "return 0\n" + "}"); + CHECK(expected->Equals(env.local(), result).FromJust()); + } + } #undef CHECK_NOT_CAUGHT } +TEST(CompileFunctionInContextHarmonyFunctionToString) { + v8::internal::FLAG_harmony_function_tostring = true; + TestCompileFunctionInContextToStringImpl(); +} + +TEST(CompileFunctionInContextFunctionToString) { + TestCompileFunctionInContextToStringImpl(); +} + TEST(InvocationCount) { FLAG_allow_natives_syntax = true; FLAG_always_opt = false; diff --git a/deps/v8/test/cctest/test-conversions.cc b/deps/v8/test/cctest/test-conversions.cc index dc6e9fcb9d..e306eb9db1 100644 --- a/deps/v8/test/cctest/test-conversions.cc +++ b/deps/v8/test/cctest/test-conversions.cc @@ -45,8 +45,8 @@ TEST(Hex) { CHECK_EQ(0.0, StringToDouble(&uc, "0X0", ALLOW_HEX | ALLOW_IMPLICIT_OCTAL)); CHECK_EQ(1.0, StringToDouble(&uc, "0x1", ALLOW_HEX | ALLOW_IMPLICIT_OCTAL)); CHECK_EQ(16.0, StringToDouble(&uc, "0x10", ALLOW_HEX | ALLOW_IMPLICIT_OCTAL)); - CHECK_EQ(255.0, StringToDouble(&uc, "0xff", - ALLOW_HEX | ALLOW_IMPLICIT_OCTAL)); + CHECK_EQ(255.0, + StringToDouble(&uc, "0xFF", ALLOW_HEX | ALLOW_IMPLICIT_OCTAL)); CHECK_EQ(175.0, StringToDouble(&uc, "0xAF", ALLOW_HEX | ALLOW_IMPLICIT_OCTAL)); @@ -54,7 +54,7 @@ TEST(Hex) { CHECK_EQ(0.0, StringToDouble(&uc, "0X0", ALLOW_HEX)); CHECK_EQ(1.0, StringToDouble(&uc, "0x1", ALLOW_HEX)); CHECK_EQ(16.0, StringToDouble(&uc, "0x10", ALLOW_HEX)); - CHECK_EQ(255.0, StringToDouble(&uc, "0xff", ALLOW_HEX)); + CHECK_EQ(255.0, StringToDouble(&uc, "0xFF", ALLOW_HEX)); CHECK_EQ(175.0, StringToDouble(&uc, "0xAF", ALLOW_HEX)); } diff --git a/deps/v8/test/cctest/test-cpu-profiler.cc b/deps/v8/test/cctest/test-cpu-profiler.cc index 6dfd22e34a..cd847893b0 100644 --- a/deps/v8/test/cctest/test-cpu-profiler.cc +++ b/deps/v8/test/cctest/test-cpu-profiler.cc @@ -476,6 +476,13 @@ v8::CpuProfile* ProfilerHelper::Run(v8::Local<v8::Function> function, return profile; } +static unsigned TotalHitCount(const v8::CpuProfileNode* node) { + unsigned hit_count = node->GetHitCount(); + for (int i = 0, count = node->GetChildrenCount(); i < count; ++i) + hit_count += TotalHitCount(node->GetChild(i)); + return hit_count; +} + static const v8::CpuProfileNode* FindChild(v8::Local<v8::Context> context, const v8::CpuProfileNode* node, const char* name) { @@ -490,16 +497,22 @@ static const v8::CpuProfileNode* FindChild(v8::Local<v8::Context> context, return nullptr; } +static const v8::CpuProfileNode* FindChild(const v8::CpuProfileNode* node, + const char* name) { + for (int i = 0, count = node->GetChildrenCount(); i < count; ++i) { + const v8::CpuProfileNode* child = node->GetChild(i); + if (strcmp(child->GetFunctionNameStr(), name) == 0) { + return child; + } + } + return nullptr; +} static const v8::CpuProfileNode* GetChild(v8::Local<v8::Context> context, const v8::CpuProfileNode* node, const char* name) { const v8::CpuProfileNode* result = FindChild(context, node, name); - if (!result) { - char buffer[100]; - i::SNPrintF(i::ArrayVector(buffer), "Failed to GetChild: %s", name); - FATAL(buffer); - } + if (!result) FATAL("Failed to GetChild: %s", name); return result; } @@ -1941,7 +1954,7 @@ TEST(CollectDeoptEvents) { GetBranchDeoptReason(env, iprofile, branch, arraysize(branch)); if (deopt_reason != reason(i::DeoptimizeReason::kNotAHeapNumber) && deopt_reason != reason(i::DeoptimizeReason::kNotASmi)) { - FATAL(deopt_reason); + FATAL("%s", deopt_reason); } } { @@ -1951,7 +1964,7 @@ TEST(CollectDeoptEvents) { if (deopt_reason != reason(i::DeoptimizeReason::kNaN) && deopt_reason != reason(i::DeoptimizeReason::kLostPrecisionOrNaN) && deopt_reason != reason(i::DeoptimizeReason::kNotASmi)) { - FATAL(deopt_reason); + FATAL("%s", deopt_reason); } } { @@ -2374,6 +2387,53 @@ TEST(CodeEntriesMemoryLeak) { CHECK_GE(10000ul, profiler_listener->entries_count_for_test()); } +TEST(NativeFrameStackTrace) { + // A test for issue https://crbug.com/768540 + // When a sample lands in a native function which has not EXIT frame + // stack frame iterator used to bail out and produce an empty stack trace. + // The source code below makes v8 call the + // v8::internal::StringTable::LookupStringIfExists_NoAllocate native function + // without producing an EXIT frame. + v8::HandleScope scope(CcTest::isolate()); + v8::Local<v8::Context> env = CcTest::NewContext(PROFILER_EXTENSION); + v8::Context::Scope context_scope(env); + + const char* source = R"( + function jsFunction() { + var s = {}; + for (var i = 0; i < 1e4; ++i) { + for (var j = 0; j < 100; j++) { + s['item' + j] = 'alph'; + } + } + })"; + + CompileRun(source); + v8::Local<v8::Function> function = GetFunction(env, "jsFunction"); + + ProfilerHelper helper(env); + + v8::CpuProfile* profile = helper.Run(function, nullptr, 0, 100, 0, true); + + // Count the fraction of samples landing in 'jsFunction' (valid stack) + // vs '(program)' (no stack captured). + const v8::CpuProfileNode* root = profile->GetTopDownRoot(); + const v8::CpuProfileNode* js_function = FindChild(root, "jsFunction"); + const v8::CpuProfileNode* program = FindChild(root, "(program)"); + if (program) { + unsigned js_function_samples = TotalHitCount(js_function); + unsigned program_samples = TotalHitCount(program); + double valid_samples_ratio = + 1. * js_function_samples / (js_function_samples + program_samples); + i::PrintF("Ratio: %f\n", valid_samples_ratio); + // TODO(alph): Investigate other causes of dropped frames. The ratio + // should be close to 99%. + CHECK_GE(valid_samples_ratio, 0.3); + } + + profile->Delete(); +} + } // namespace test_cpu_profiler } // namespace internal } // namespace v8 diff --git a/deps/v8/test/cctest/test-debug.cc b/deps/v8/test/cctest/test-debug.cc index 3d6130549f..dd93a7eaf8 100644 --- a/deps/v8/test/cctest/test-debug.cc +++ b/deps/v8/test/cctest/test-debug.cc @@ -3951,6 +3951,72 @@ TEST(DebugBreak) { CheckDebuggerUnloaded(); } +static void DebugScopingListener(const v8::Debug::EventDetails& event_details) { + v8::DebugEvent event = event_details.GetEvent(); + if (event != v8::Exception) return; + + auto stack_traces = v8::debug::StackTraceIterator::Create(CcTest::isolate()); + v8::debug::Location location = stack_traces->GetSourceLocation(); + CHECK_EQ(26, location.GetColumnNumber()); + CHECK_EQ(0, location.GetLineNumber()); + + auto scopes = stack_traces->GetScopeIterator(); + CHECK_EQ(v8::debug::ScopeIterator::ScopeTypeWith, scopes->GetType()); + CHECK_EQ(20, scopes->GetStartLocation().GetColumnNumber()); + CHECK_EQ(31, scopes->GetEndLocation().GetColumnNumber()); + + scopes->Advance(); + CHECK_EQ(v8::debug::ScopeIterator::ScopeTypeLocal, scopes->GetType()); + CHECK_EQ(0, scopes->GetStartLocation().GetColumnNumber()); + CHECK_EQ(68, scopes->GetEndLocation().GetColumnNumber()); + + scopes->Advance(); + CHECK_EQ(v8::debug::ScopeIterator::ScopeTypeGlobal, scopes->GetType()); + CHECK(scopes->GetFunction().IsEmpty()); + + scopes->Advance(); + CHECK(scopes->Done()); +} + +TEST(DebugBreakInWrappedScript) { + i::FLAG_stress_compaction = false; +#ifdef VERIFY_HEAP + i::FLAG_verify_heap = true; +#endif + DebugLocalContext env; + v8::Isolate* isolate = env->GetIsolate(); + v8::HandleScope scope(isolate); + + // Register a debug event listener which sets the break flag and counts. + SetDebugEventListener(isolate, DebugScopingListener); + + static const char* source = + // 0 1 2 3 4 5 6 7 + "try { with({o : []}){ o[0](); } } catch (e) { return e.toString(); }"; + static const char* expect = "TypeError: o[0] is not a function"; + + // For this test, we want to break on uncaught exceptions: + ChangeBreakOnException(true, true); + + { + v8::ScriptCompiler::Source script_source(v8_str(source)); + v8::Local<v8::Function> fun = + v8::ScriptCompiler::CompileFunctionInContext( + env.context(), &script_source, 0, nullptr, 0, nullptr) + .ToLocalChecked(); + v8::Local<v8::Value> result = + fun->Call(env.context(), env->Global(), 0, nullptr).ToLocalChecked(); + CHECK(result->IsString()); + CHECK(v8::Local<v8::String>::Cast(result) + ->Equals(env.context(), v8_str(expect)) + .FromJust()); + } + + // Get rid of the debug event listener. + SetDebugEventListener(isolate, nullptr); + CheckDebuggerUnloaded(); +} + TEST(DebugBreakWithoutJS) { i::FLAG_stress_compaction = false; #ifdef VERIFY_HEAP @@ -4123,7 +4189,6 @@ static void NamedGetter(v8::Local<v8::Name> name, info.GetReturnValue().SetUndefined(); return; } - info.GetReturnValue().Set(name); } diff --git a/deps/v8/test/cctest/test-disasm-arm.cc b/deps/v8/test/cctest/test-disasm-arm.cc index 253daefa6c..300309244e 100644 --- a/deps/v8/test/cctest/test-disasm-arm.cc +++ b/deps/v8/test/cctest/test-disasm-arm.cc @@ -274,7 +274,7 @@ TEST(Type0) { "e3e03000 mvn r3, #0"); COMPARE(mov(r4, Operand(-2), SetCC, al), "e3f04001 mvns r4, #1"); - COMPARE(mov(r5, Operand(0x0ffffff0), SetCC, ne), + COMPARE(mov(r5, Operand(0x0FFFFFF0), SetCC, ne), "13f052ff mvnnes r5, #-268435441"); COMPARE(mov(r6, Operand(-1), LeaveCC, ne), "13e06000 mvnne r6, #0"); @@ -284,7 +284,7 @@ TEST(Type0) { "e3a03000 mov r3, #0"); COMPARE(mvn(r4, Operand(-2), SetCC, al), "e3b04001 movs r4, #1"); - COMPARE(mvn(r5, Operand(0x0ffffff0), SetCC, ne), + COMPARE(mvn(r5, Operand(0x0FFFFFF0), SetCC, ne), "13b052ff movnes r5, #-268435441"); COMPARE(mvn(r6, Operand(-1), LeaveCC, ne), "13a06000 movne r6, #0"); @@ -312,20 +312,20 @@ TEST(Type0) { COMPARE(movt(r5, 0x4321, ne), "13445321 movtne r5, #17185"); - COMPARE(movw(r5, 0xabcd, eq), + COMPARE(movw(r5, 0xABCD, eq), "030a5bcd movweq r5, #43981"); } // Eor doesn't have an eor-negative variant, but we can do an mvn followed by // an eor to get the same effect. - COMPARE(eor(r5, r4, Operand(0xffffff34), SetCC, ne), + COMPARE(eor(r5, r4, Operand(0xFFFFFF34), SetCC, ne), "13e050cb mvnne r5, #203", "10345005 eornes r5, r4, r5"); // and <-> bic. - COMPARE(and_(r3, r5, Operand(0xfc03ffff)), + COMPARE(and_(r3, r5, Operand(0xFC03FFFF)), "e3c537ff bic r3, r5, #66846720"); - COMPARE(bic(r3, r5, Operand(0xfc03ffff)), + COMPARE(bic(r3, r5, Operand(0xFC03FFFF)), "e20537ff and r3, r5, #66846720"); // sub <-> add. @@ -345,7 +345,7 @@ TEST(Type0) { "e12fff3c blx ip"); COMPARE(bkpt(0), "e1200070 bkpt 0"); - COMPARE(bkpt(0xffff), + COMPARE(bkpt(0xFFFF), "e12fff7f bkpt 65535"); COMPARE(clz(r6, r7), "e16f6f17 clz r6, r7"); @@ -516,7 +516,7 @@ TEST(msr_mrs_disasm) { "e169f007 msr SPSR_fc, r7"); // MSR with no mask is UNPREDICTABLE, and checked by the assembler, but check // that the disassembler does something sensible. - COMPARE(dd(0xe120f008), "e120f008 msr CPSR_(none), r8"); + COMPARE(dd(0xE120F008), "e120f008 msr CPSR_(none), r8"); COMPARE(mrs(r0, CPSR), "e10f0000 mrs r0, CPSR"); COMPARE(mrs(r1, SPSR), "e14f1000 mrs r1, SPSR"); @@ -1478,7 +1478,7 @@ static void TestLoadLiteral(byte* buffer, Assembler* assm, bool* failure, int offset) { int pc_offset = assm->pc_offset(); byte *progcounter = &buffer[pc_offset]; - assm->ldr(r0, MemOperand(pc, offset)); + assm->ldr_pcrel(r0, offset); const char *expected_string_template = (offset >= 0) ? diff --git a/deps/v8/test/cctest/test-disasm-arm64.cc b/deps/v8/test/cctest/test-disasm-arm64.cc index a3823518fc..13deeb534b 100644 --- a/deps/v8/test/cctest/test-disasm-arm64.cc +++ b/deps/v8/test/cctest/test-disasm-arm64.cc @@ -399,7 +399,7 @@ TEST_(add_extended) { COMPARE(add(x18, x19, Operand(x20, SXTB, 3)), "add x18, x19, w20, sxtb #3"); COMPARE(adds(w21, w22, Operand(w23, SXTH, 2)), "adds w21, w22, w23, sxth #2"); COMPARE(add(x24, x25, Operand(x26, SXTW, 1)), "add x24, x25, w26, sxtw #1"); - COMPARE(adds(cp, jssp, Operand(fp, SXTX)), "adds cp, jssp, fp, sxtx"); + COMPARE(adds(cp, x28, Operand(fp, SXTX)), "adds cp, x28, fp, sxtx"); COMPARE(cmn(w0, Operand(w1, UXTB, 2)), "cmn w0, w1, uxtb #2"); COMPARE(cmn(x2, Operand(x3, SXTH, 4)), "cmn x2, w3, sxth #4"); @@ -425,7 +425,7 @@ TEST_(sub_extended) { COMPARE(sub(x18, x19, Operand(x20, SXTB, 3)), "sub x18, x19, w20, sxtb #3"); COMPARE(subs(w21, w22, Operand(w23, SXTH, 2)), "subs w21, w22, w23, sxth #2"); COMPARE(sub(x24, x25, Operand(x26, SXTW, 1)), "sub x24, x25, w26, sxtw #1"); - COMPARE(subs(cp, jssp, Operand(fp, SXTX)), "subs cp, jssp, fp, sxtx"); + COMPARE(subs(cp, x28, Operand(fp, SXTX)), "subs cp, x28, fp, sxtx"); COMPARE(cmp(w0, Operand(w1, SXTB, 1)), "cmp w0, w1, sxtb #1"); COMPARE(cmp(x2, Operand(x3, UXTH, 3)), "cmp x2, w3, uxth #3"); @@ -891,11 +891,10 @@ TEST_(load_store) { COMPARE(str(x20, MemOperand(x21, 255, PostIndex)), "str x20, [x21], #255"); COMPARE(str(x22, MemOperand(x23, -256, PostIndex)), "str x22, [x23], #-256"); - // TODO(all): Fix this for jssp. - COMPARE(ldr(w24, MemOperand(jssp)), "ldr w24, [jssp]"); - COMPARE(ldr(x25, MemOperand(jssp, 8)), "ldr x25, [jssp, #8]"); - COMPARE(str(w26, MemOperand(jssp, 4, PreIndex)), "str w26, [jssp, #4]!"); - COMPARE(str(cp, MemOperand(jssp, -8, PostIndex)), "str cp, [jssp], #-8"); + COMPARE(ldr(w24, MemOperand(x28)), "ldr w24, [x28]"); + COMPARE(ldr(x25, MemOperand(x28, 8)), "ldr x25, [x28, #8]"); + COMPARE(str(w26, MemOperand(x28, 4, PreIndex)), "str w26, [x28, #4]!"); + COMPARE(str(cp, MemOperand(x28, -8, PostIndex)), "str cp, [x28], #-8"); COMPARE(ldrsw(x0, MemOperand(x1)), "ldrsw x0, [x1]"); COMPARE(ldrsw(x2, MemOperand(x3, 8)), "ldrsw x2, [x3, #8]"); @@ -983,9 +982,8 @@ TEST_(load_store_regoffset) { COMPARE(strh(w21, MemOperand(x22, x23, SXTX, 1)), "strh w21, [x22, x23, sxtx #1]"); - // TODO(all): Fix this for jssp. - COMPARE(ldr(x0, MemOperand(jssp, wzr, SXTW)), "ldr x0, [jssp, wzr, sxtw]"); - COMPARE(str(x1, MemOperand(jssp, xzr)), "str x1, [jssp, xzr]"); + COMPARE(ldr(x0, MemOperand(x28, wzr, SXTW)), "ldr x0, [x28, wzr, sxtw]"); + COMPARE(str(x1, MemOperand(x28, xzr)), "str x1, [x28, xzr]"); CLEANUP(); } @@ -1011,9 +1009,8 @@ TEST_(load_store_byte) { COMPARE(strb(w24, MemOperand(x25, 255, PostIndex)), "strb w24, [x25], #255"); COMPARE(strb(w26, MemOperand(cp, -256, PostIndex)), "strb w26, [cp], #-256"); - // TODO(all): Fix this for jssp. - COMPARE(ldrb(w28, MemOperand(jssp, 3, PostIndex)), "ldrb w28, [jssp], #3"); - COMPARE(strb(fp, MemOperand(jssp, -42, PreIndex)), "strb w29, [jssp, #-42]!"); + COMPARE(ldrb(w28, MemOperand(x28, 3, PostIndex)), "ldrb w28, [x28], #3"); + COMPARE(strb(fp, MemOperand(x28, -42, PreIndex)), "strb w29, [x28, #-42]!"); COMPARE(ldrsb(w0, MemOperand(x1)), "ldrsb w0, [x1]"); COMPARE(ldrsb(x2, MemOperand(x3, 8)), "ldrsb x2, [x3, #8]"); COMPARE(ldrsb(w4, MemOperand(x5, 42, PreIndex)), "ldrsb w4, [x5, #42]!"); @@ -1043,9 +1040,8 @@ TEST_(load_store_half) { COMPARE(strh(w24, MemOperand(x25, 255, PostIndex)), "strh w24, [x25], #255"); COMPARE(strh(w26, MemOperand(cp, -256, PostIndex)), "strh w26, [cp], #-256"); - // TODO(all): Fix this for jssp. - COMPARE(ldrh(w28, MemOperand(jssp, 3, PostIndex)), "ldrh w28, [jssp], #3"); - COMPARE(strh(fp, MemOperand(jssp, -42, PreIndex)), "strh w29, [jssp, #-42]!"); + COMPARE(ldrh(w28, MemOperand(x28, 3, PostIndex)), "ldrh w28, [x28], #3"); + COMPARE(strh(fp, MemOperand(x28, -42, PreIndex)), "strh w29, [x28, #-42]!"); COMPARE(ldrh(w30, MemOperand(x0, 255)), "ldurh w30, [x0, #255]"); COMPARE(ldrh(x1, MemOperand(x2, -256)), "ldurh w1, [x2, #-256]"); COMPARE(strh(w3, MemOperand(x4, 255)), "sturh w3, [x4, #255]"); @@ -1306,7 +1302,7 @@ TEST_(load_store_unscaled) { COMPARE(str(w22, MemOperand(x23, -256)), "stur w22, [x23, #-256]"); COMPARE(str(x24, MemOperand(x25, 1)), "stur x24, [x25, #1]"); COMPARE(str(x26, MemOperand(x27, -1)), "stur x26, [cp, #-1]"); - COMPARE(str(x28, MemOperand(x29, 255)), "stur jssp, [fp, #255]"); + COMPARE(str(x28, MemOperand(x29, 255)), "stur x28, [fp, #255]"); COMPARE(str(x30, MemOperand(x0, -256)), "stur lr, [x0, #-256]"); COMPARE(ldr(w0, MemOperand(csp, 1)), "ldur w0, [csp, #1]"); COMPARE(str(x1, MemOperand(csp, -1)), "stur x1, [csp, #-1]"); @@ -1346,8 +1342,8 @@ TEST_(load_store_pair) { COMPARE(ldp(x21, x22, MemOperand(x23, -512)), "ldp x21, x22, [x23, #-512]"); COMPARE(ldp(w24, w25, MemOperand(x26, 252, PreIndex)), "ldp w24, w25, [x26, #252]!"); - COMPARE(ldp(cp, jssp, MemOperand(fp, 504, PreIndex)), - "ldp cp, jssp, [fp, #504]!"); + COMPARE(ldp(cp, x28, MemOperand(fp, 504, PreIndex)), + "ldp cp, x28, [fp, #504]!"); COMPARE(ldp(w30, w0, MemOperand(x1, -256, PreIndex)), "ldp w30, w0, [x1, #-256]!"); COMPARE(ldp(x2, x3, MemOperand(x4, -512, PreIndex)), @@ -1364,8 +1360,8 @@ TEST_(load_store_pair) { COMPARE(ldp(s17, s18, MemOperand(x19)), "ldp s17, s18, [x19]"); COMPARE(ldp(s20, s21, MemOperand(x22, 252)), "ldp s20, s21, [x22, #252]"); COMPARE(ldp(s23, s24, MemOperand(x25, -256)), "ldp s23, s24, [x25, #-256]"); - COMPARE(ldp(s26, s27, MemOperand(jssp, 252, PreIndex)), - "ldp s26, s27, [jssp, #252]!"); + COMPARE(ldp(s26, s27, MemOperand(x28, 252, PreIndex)), + "ldp s26, s27, [x28, #252]!"); COMPARE(ldp(s29, s30, MemOperand(fp, -256, PreIndex)), "ldp s29, s30, [fp, #-256]!"); COMPARE(ldp(s31, s0, MemOperand(x1, 252, PostIndex)), @@ -1375,8 +1371,8 @@ TEST_(load_store_pair) { COMPARE(ldp(d17, d18, MemOperand(x19)), "ldp d17, d18, [x19]"); COMPARE(ldp(d20, d21, MemOperand(x22, 504)), "ldp d20, d21, [x22, #504]"); COMPARE(ldp(d23, d24, MemOperand(x25, -512)), "ldp d23, d24, [x25, #-512]"); - COMPARE(ldp(d26, d27, MemOperand(jssp, 504, PreIndex)), - "ldp d26, d27, [jssp, #504]!"); + COMPARE(ldp(d26, d27, MemOperand(x28, 504, PreIndex)), + "ldp d26, d27, [x28, #504]!"); COMPARE(ldp(d29, d30, MemOperand(fp, -512, PreIndex)), "ldp d29, d30, [fp, #-512]!"); COMPARE(ldp(d31, d0, MemOperand(x1, 504, PostIndex)), @@ -1394,8 +1390,8 @@ TEST_(load_store_pair) { COMPARE(stp(x21, x22, MemOperand(x23, -512)), "stp x21, x22, [x23, #-512]"); COMPARE(stp(w24, w25, MemOperand(x26, 252, PreIndex)), "stp w24, w25, [x26, #252]!"); - COMPARE(stp(cp, jssp, MemOperand(fp, 504, PreIndex)), - "stp cp, jssp, [fp, #504]!"); + COMPARE(stp(cp, x28, MemOperand(fp, 504, PreIndex)), + "stp cp, x28, [fp, #504]!"); COMPARE(stp(w30, w0, MemOperand(x1, -256, PreIndex)), "stp w30, w0, [x1, #-256]!"); COMPARE(stp(x2, x3, MemOperand(x4, -512, PreIndex)), @@ -1412,8 +1408,8 @@ TEST_(load_store_pair) { COMPARE(stp(s17, s18, MemOperand(x19)), "stp s17, s18, [x19]"); COMPARE(stp(s20, s21, MemOperand(x22, 252)), "stp s20, s21, [x22, #252]"); COMPARE(stp(s23, s24, MemOperand(x25, -256)), "stp s23, s24, [x25, #-256]"); - COMPARE(stp(s26, s27, MemOperand(jssp, 252, PreIndex)), - "stp s26, s27, [jssp, #252]!"); + COMPARE(stp(s26, s27, MemOperand(x28, 252, PreIndex)), + "stp s26, s27, [x28, #252]!"); COMPARE(stp(s29, s30, MemOperand(fp, -256, PreIndex)), "stp s29, s30, [fp, #-256]!"); COMPARE(stp(s31, s0, MemOperand(x1, 252, PostIndex)), @@ -1423,8 +1419,8 @@ TEST_(load_store_pair) { COMPARE(stp(d17, d18, MemOperand(x19)), "stp d17, d18, [x19]"); COMPARE(stp(d20, d21, MemOperand(x22, 504)), "stp d20, d21, [x22, #504]"); COMPARE(stp(d23, d24, MemOperand(x25, -512)), "stp d23, d24, [x25, #-512]"); - COMPARE(stp(d26, d27, MemOperand(jssp, 504, PreIndex)), - "stp d26, d27, [jssp, #504]!"); + COMPARE(stp(d26, d27, MemOperand(x28, 504, PreIndex)), + "stp d26, d27, [x28, #504]!"); COMPARE(stp(d29, d30, MemOperand(fp, -512, PreIndex)), "stp d29, d30, [fp, #-512]!"); COMPARE(stp(d31, d0, MemOperand(x1, 504, PostIndex)), @@ -1444,16 +1440,15 @@ TEST_(load_store_pair) { COMPARE(stp(q23, q24, MemOperand(x25, -1024, PostIndex)), "stp q23, q24, [x25], #-1024"); - COMPARE(ldp(w16, w17, MemOperand(jssp, 4, PostIndex)), - "ldp w16, w17, [jssp], #4"); - COMPARE(stp(x18, x19, MemOperand(jssp, -8, PreIndex)), - "stp x18, x19, [jssp, #-8]!"); - COMPARE(ldp(s30, s31, MemOperand(jssp, 12, PostIndex)), - "ldp s30, s31, [jssp], #12"); - COMPARE(stp(d30, d31, MemOperand(jssp, -16)), - "stp d30, d31, [jssp, #-16]"); - COMPARE(ldp(q30, q31, MemOperand(jssp, 32, PostIndex)), - "ldp q30, q31, [jssp], #32"); + COMPARE(ldp(w16, w17, MemOperand(x28, 4, PostIndex)), + "ldp w16, w17, [x28], #4"); + COMPARE(stp(x18, x19, MemOperand(x28, -8, PreIndex)), + "stp x18, x19, [x28, #-8]!"); + COMPARE(ldp(s30, s31, MemOperand(x28, 12, PostIndex)), + "ldp s30, s31, [x28], #12"); + COMPARE(stp(d30, d31, MemOperand(x28, -16)), "stp d30, d31, [x28, #-16]"); + COMPARE(ldp(q30, q31, MemOperand(x28, 32, PostIndex)), + "ldp q30, q31, [x28], #32"); COMPARE(ldpsw(x0, x1, MemOperand(x2)), "ldpsw x0, x1, [x2]"); COMPARE(ldpsw(x3, x4, MemOperand(x5, 16)), "ldpsw x3, x4, [x5, #16]"); @@ -1804,7 +1799,7 @@ TEST_(fcvt_scvtf_ucvtf) { COMPARE(fcvtzu(w6, s5, 32), "fcvtzu w6, s5, #32"); COMPARE(fcvtpu(x24, d25), "fcvtpu x24, d25"); COMPARE(fcvtpu(w26, d27), "fcvtpu w26, d27"); - COMPARE(fcvtps(x28, d29), "fcvtps jssp, d29"); + COMPARE(fcvtps(x28, d29), "fcvtps x28, d29"); COMPARE(fcvtps(w30, d31), "fcvtps w30, d31"); COMPARE(fcvtpu(x0, s1), "fcvtpu x0, s1"); COMPARE(fcvtpu(w2, s3), "fcvtpu w2, s3"); diff --git a/deps/v8/test/cctest/test-disasm-ia32.cc b/deps/v8/test/cctest/test-disasm-ia32.cc index 66716e9d44..35638c723a 100644 --- a/deps/v8/test/cctest/test-disasm-ia32.cc +++ b/deps/v8/test/cctest/test-disasm-ia32.cc @@ -481,6 +481,8 @@ TEST(DisasmIa320) { __ maxsd(xmm1, Operand(ebx, ecx, times_4, 10000)); __ ucomisd(xmm0, xmm1); __ cmpltsd(xmm0, xmm1); + __ haddps(xmm1, xmm0); + __ haddps(xmm1, Operand(ebx, ecx, times_4, 10000)); __ andpd(xmm0, xmm1); @@ -550,6 +552,8 @@ TEST(DisasmIa320) { __ pextrw(Operand(edx, 4), xmm0, 1); __ pextrd(eax, xmm0, 1); __ pextrd(Operand(edx, 4), xmm0, 1); + __ insertps(xmm1, xmm2, 0); + __ insertps(xmm1, Operand(edx, 4), 0); __ pinsrb(xmm1, eax, 0); __ pinsrb(xmm1, Operand(edx, 4), 0); __ pinsrd(xmm1, eax, 0); @@ -611,6 +615,9 @@ TEST(DisasmIa320) { __ vrcpps(xmm1, Operand(ebx, ecx, times_4, 10000)); __ vrsqrtps(xmm1, xmm0); __ vrsqrtps(xmm1, Operand(ebx, ecx, times_4, 10000)); + __ vmovaps(xmm0, xmm1); + __ vshufps(xmm0, xmm1, xmm2, 3); + __ vshufps(xmm0, xmm1, Operand(edx, 4), 3); __ vcmpeqps(xmm5, xmm4, xmm1); __ vcmpeqps(xmm5, xmm4, Operand(ebx, ecx, times_4, 10000)); @@ -655,6 +662,8 @@ TEST(DisasmIa320) { __ vpextrw(Operand(edx, 4), xmm0, 1); __ vpextrd(eax, xmm0, 1); __ vpextrd(Operand(edx, 4), xmm0, 1); + __ vinsertps(xmm0, xmm1, xmm2, 0); + __ vinsertps(xmm0, xmm1, Operand(edx, 4), 0); __ vpinsrb(xmm0, xmm1, eax, 0); __ vpinsrb(xmm0, xmm1, Operand(edx, 4), 0); __ vpinsrw(xmm0, xmm1, eax, 0); @@ -667,6 +676,8 @@ TEST(DisasmIa320) { __ vcvttps2dq(xmm1, xmm0); __ vcvttps2dq(xmm1, Operand(ebx, ecx, times_4, 10000)); + __ vmovdqu(xmm0, Operand(ebx, ecx, times_4, 10000)); + __ vmovdqu(Operand(ebx, ecx, times_4, 10000), xmm0); __ vmovd(xmm0, edi); __ vmovd(xmm0, Operand(ebx, ecx, times_4, 10000)); __ vmovd(eax, xmm1); diff --git a/deps/v8/test/cctest/test-disasm-mips.cc b/deps/v8/test/cctest/test-disasm-mips.cc index 04f007fcb3..e394f9428a 100644 --- a/deps/v8/test/cctest/test-disasm-mips.cc +++ b/deps/v8/test/cctest/test-disasm-mips.cc @@ -144,14 +144,14 @@ if (failure) { \ #define COMPARE_PC_JUMP(asm_, compare_string, target) \ { \ int pc_offset = assm.pc_offset(); \ - byte *progcounter = &buffer[pc_offset]; \ + byte* progcounter = &buffer[pc_offset]; \ char str_with_address[100]; \ int instr_index = (target >> 2) & kImm26Mask; \ snprintf( \ str_with_address, sizeof(str_with_address), "%s %p -> %p", \ - compare_string, reinterpret_cast<void *>(target), \ - reinterpret_cast<void *>(((uint32_t)(progcounter + 4) & ~0xfffffff) | \ - (instr_index << 2))); \ + compare_string, reinterpret_cast<void*>(target), \ + reinterpret_cast<void*>(((uint32_t)(progcounter + 4) & ~0xFFFFFFF) | \ + (instr_index << 2))); \ assm.asm_; \ if (!DisassembleAndCompare(progcounter, str_with_address)) failure = true; \ } @@ -159,11 +159,10 @@ if (failure) { \ #define GET_PC_REGION(pc_region) \ { \ int pc_offset = assm.pc_offset(); \ - byte *progcounter = &buffer[pc_offset]; \ - pc_region = reinterpret_cast<int32_t>(progcounter + 4) & ~0xfffffff; \ + byte* progcounter = &buffer[pc_offset]; \ + pc_region = reinterpret_cast<int32_t>(progcounter + 4) & ~0xFFFFFFF; \ } - TEST(Type0) { SET_UP(); @@ -504,12 +503,12 @@ TEST(Type0) { int32_t target = pc_region | 0x4; COMPARE_PC_JUMP(j(target), "08000001 j ", target); - target = pc_region | 0xffffffc; + 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; + target = pc_region | 0xFFFFFFC; COMPARE_PC_JUMP(jal(target), "0fffffff jal ", target); COMPARE(addiu(a0, a1, 0x0), diff --git a/deps/v8/test/cctest/test-disasm-mips64.cc b/deps/v8/test/cctest/test-disasm-mips64.cc index 0405a82e5d..0a16e860b3 100644 --- a/deps/v8/test/cctest/test-disasm-mips64.cc +++ b/deps/v8/test/cctest/test-disasm-mips64.cc @@ -144,14 +144,14 @@ if (failure) { \ #define COMPARE_PC_JUMP(asm_, compare_string, target) \ { \ int pc_offset = assm.pc_offset(); \ - byte *progcounter = &buffer[pc_offset]; \ + byte* progcounter = &buffer[pc_offset]; \ char str_with_address[100]; \ int instr_index = (target >> 2) & kImm26Mask; \ snprintf( \ str_with_address, sizeof(str_with_address), "%s %p -> %p", \ - compare_string, reinterpret_cast<void *>(target), \ - reinterpret_cast<void *>(((uint64_t)(progcounter + 1) & ~0xfffffff) | \ - (instr_index << 2))); \ + compare_string, reinterpret_cast<void*>(target), \ + reinterpret_cast<void*>(((uint64_t)(progcounter + 1) & ~0xFFFFFFF) | \ + (instr_index << 2))); \ assm.asm_; \ if (!DisassembleAndCompare(progcounter, str_with_address)) failure = true; \ } @@ -159,11 +159,10 @@ if (failure) { \ #define GET_PC_REGION(pc_region) \ { \ int pc_offset = assm.pc_offset(); \ - byte *progcounter = &buffer[pc_offset]; \ - pc_region = reinterpret_cast<int64_t>(progcounter + 4) & ~0xfffffff; \ + byte* progcounter = &buffer[pc_offset]; \ + pc_region = reinterpret_cast<int64_t>(progcounter + 4) & ~0xFFFFFFF; \ } - TEST(Type0) { SET_UP(); @@ -972,7 +971,7 @@ TEST(Type3) { "60a48000 bnvc a1, a0, -32768", -32768); COMPARE_PC_REL_COMPACT(beqzc(a0, 0), "d8800000 beqzc a0, 0", 0); - COMPARE_PC_REL_COMPACT(beqzc(a0, 1048575), // 0x0fffff == 1048575. + COMPARE_PC_REL_COMPACT(beqzc(a0, 1048575), // 0x0FFFFF == 1048575. "d88fffff beqzc a0, 1048575", 1048575); COMPARE_PC_REL_COMPACT(beqzc(a0, -1048576), // 0x100000 == -1048576. "d8900000 beqzc a0, -1048576", -1048576); @@ -1184,12 +1183,12 @@ TEST(Type3) { int64_t target = pc_region | 0x4; COMPARE_PC_JUMP(j(target), "08000001 j ", target); - target = pc_region | 0xffffffc; + 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; + 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 10608f1877..bbc1f89480 100644 --- a/deps/v8/test/cctest/test-disasm-x64.cc +++ b/deps/v8/test/cctest/test-disasm-x64.cc @@ -386,6 +386,10 @@ TEST(DisasmX64) { __ cvtsd2ss(xmm0, xmm1); __ cvtsd2ss(xmm0, Operand(rbx, rcx, times_4, 10000)); __ movaps(xmm0, xmm1); + __ movdqa(xmm0, Operand(rsp, 12)); + __ movdqa(Operand(rsp, 12), xmm0); + __ movdqu(xmm0, Operand(rsp, 12)); + __ movdqu(Operand(rsp, 12), xmm0); __ shufps(xmm0, xmm9, 0x0); // logic operation @@ -451,6 +455,8 @@ TEST(DisasmX64) { __ maxsd(xmm1, xmm0); __ maxsd(xmm1, Operand(rbx, rcx, times_4, 10000)); __ ucomisd(xmm0, xmm1); + __ haddps(xmm1, xmm0); + __ haddps(xmm1, Operand(rbx, rcx, times_4, 10000)); __ andpd(xmm0, xmm1); __ andpd(xmm0, Operand(rbx, rcx, times_4, 10000)); diff --git a/deps/v8/test/cctest/test-diy-fp.cc b/deps/v8/test/cctest/test-diy-fp.cc index 4c597883f1..d46d0519d6 100644 --- a/deps/v8/test/cctest/test-diy-fp.cc +++ b/deps/v8/test/cctest/test-diy-fp.cc @@ -73,7 +73,7 @@ TEST(Multiply) { CHECK_EQ(1, product.f()); CHECK_EQ(11 + 13 + 64, product.e()); - diy_fp1 = DiyFp(V8_2PART_UINT64_C(0x7fffffff, ffffffff), 11); + diy_fp1 = DiyFp(V8_2PART_UINT64_C(0x7FFFFFFF, FFFFFFFF), 11); diy_fp2 = DiyFp(1, 13); product = DiyFp::Times(diy_fp1, diy_fp2); CHECK_EQ(0, product.f()); @@ -84,9 +84,9 @@ TEST(Multiply) { // Big numbers. diy_fp1 = DiyFp(V8_2PART_UINT64_C(0xFFFFFFFF, FFFFFFFF), 11); diy_fp2 = DiyFp(V8_2PART_UINT64_C(0xFFFFFFFF, FFFFFFFF), 13); - // 128bit result: 0xfffffffffffffffe0000000000000001 + // 128bit result: 0xFFFFFFFFFFFFFFFE0000000000000001 product = DiyFp::Times(diy_fp1, diy_fp2); - CHECK(V8_2PART_UINT64_C(0xFFFFFFFF, FFFFFFFe) == product.f()); + CHECK(V8_2PART_UINT64_C(0xFFFFFFFF, FFFFFFFE) == product.f()); CHECK_EQ(11 + 13 + 64, product.e()); } diff --git a/deps/v8/test/cctest/test-double.cc b/deps/v8/test/cctest/test-double.cc index 81a06bf997..46d6d55cc1 100644 --- a/deps/v8/test/cctest/test-double.cc +++ b/deps/v8/test/cctest/test-double.cc @@ -45,7 +45,7 @@ TEST(Uint64Conversions) { uint64_t min_double64 = V8_2PART_UINT64_C(0x00000000, 00000001); CHECK_EQ(5e-324, Double(min_double64).value()); - uint64_t max_double64 = V8_2PART_UINT64_C(0x7fefffff, ffffffff); + uint64_t max_double64 = V8_2PART_UINT64_C(0x7FEFFFFF, FFFFFFFF); CHECK_EQ(1.7976931348623157e308, Double(max_double64).value()); } @@ -63,10 +63,10 @@ TEST(AsDiyFp) { // This is a denormal; so no hidden bit. CHECK_EQ(1, diy_fp.f()); - uint64_t max_double64 = V8_2PART_UINT64_C(0x7fefffff, ffffffff); + uint64_t max_double64 = V8_2PART_UINT64_C(0x7FEFFFFF, FFFFFFFF); diy_fp = Double(max_double64).AsDiyFp(); CHECK_EQ(0x7FE - 0x3FF - 52, diy_fp.e()); - CHECK(V8_2PART_UINT64_C(0x001fffff, ffffffff) == diy_fp.f()); // NOLINT + CHECK(V8_2PART_UINT64_C(0x001FFFFF, FFFFFFFF) == diy_fp.f()); // NOLINT } @@ -83,10 +83,10 @@ TEST(AsNormalizedDiyFp) { // This is a denormal; so no hidden bit. CHECK(V8_2PART_UINT64_C(0x80000000, 00000000) == diy_fp.f()); // NOLINT - uint64_t max_double64 = V8_2PART_UINT64_C(0x7fefffff, ffffffff); + uint64_t max_double64 = V8_2PART_UINT64_C(0x7FEFFFFF, FFFFFFFF); diy_fp = Double(max_double64).AsNormalizedDiyFp(); CHECK_EQ(0x7FE - 0x3FF - 52 - 11, diy_fp.e()); - CHECK((V8_2PART_UINT64_C(0x001fffff, ffffffff) << 11) == + CHECK((V8_2PART_UINT64_C(0x001FFFFF, FFFFFFFF) << 11) == diy_fp.f()); // NOLINT } @@ -202,7 +202,7 @@ TEST(NormalizedBoundaries) { CHECK(diy_fp.f() - boundary_minus.f() == boundary_plus.f() - diy_fp.f()); CHECK((1 << 11) == diy_fp.f() - boundary_minus.f()); // NOLINT - uint64_t max_double64 = V8_2PART_UINT64_C(0x7fefffff, ffffffff); + uint64_t max_double64 = V8_2PART_UINT64_C(0x7FEFFFFF, FFFFFFFF); diy_fp = Double(max_double64).AsNormalizedDiyFp(); Double(max_double64).NormalizedBoundaries(&boundary_minus, &boundary_plus); CHECK_EQ(diy_fp.e(), boundary_minus.e()); @@ -226,7 +226,7 @@ TEST(NextDouble) { CHECK_EQ(4e-324, d2.NextDouble()); CHECK_EQ(-1.7976931348623157e308, Double(-V8_INFINITY).NextDouble()); CHECK_EQ(V8_INFINITY, - Double(V8_2PART_UINT64_C(0x7fefffff, ffffffff)).NextDouble()); + Double(V8_2PART_UINT64_C(0x7FEFFFFF, FFFFFFFF)).NextDouble()); } } // namespace internal diff --git a/deps/v8/test/cctest/test-feedback-vector.cc b/deps/v8/test/cctest/test-feedback-vector.cc index 1dd99c5362..e590b60649 100644 --- a/deps/v8/test/cctest/test-feedback-vector.cc +++ b/deps/v8/test/cctest/test-feedback-vector.cc @@ -257,12 +257,12 @@ TEST(VectorCallCounts) { CompileRun("f(foo); f(foo);"); CHECK_EQ(MONOMORPHIC, nexus.StateFromFeedback()); - CHECK_EQ(3, nexus.ExtractCallCount()); + CHECK_EQ(3, nexus.GetCallCount()); // Send the IC megamorphic, but we should still have incrementing counts. CompileRun("f(function() { return 12; });"); CHECK_EQ(GENERIC, nexus.StateFromFeedback()); - CHECK_EQ(4, nexus.ExtractCallCount()); + CHECK_EQ(4, nexus.GetCallCount()); } TEST(VectorConstructCounts) { @@ -288,12 +288,42 @@ TEST(VectorConstructCounts) { CompileRun("f(Foo); f(Foo);"); CHECK_EQ(MONOMORPHIC, nexus.StateFromFeedback()); - CHECK_EQ(3, nexus.ExtractCallCount()); + CHECK_EQ(3, nexus.GetCallCount()); // Send the IC megamorphic, but we should still have incrementing counts. CompileRun("f(function() {});"); CHECK_EQ(GENERIC, nexus.StateFromFeedback()); - CHECK_EQ(4, nexus.ExtractCallCount()); + CHECK_EQ(4, nexus.GetCallCount()); +} + +TEST(VectorSpeculationMode) { + if (i::FLAG_always_opt) return; + CcTest::InitializeVM(); + LocalContext context; + v8::HandleScope scope(context->GetIsolate()); + Isolate* isolate = CcTest::i_isolate(); + + // Make sure function f has a call that uses a type feedback slot. + CompileRun( + "function Foo() {}" + "function f(a) { new a(); } f(Foo);"); + Handle<JSFunction> f = GetFunction("f"); + Handle<FeedbackVector> feedback_vector = + Handle<FeedbackVector>(f->feedback_vector(), isolate); + + FeedbackSlot slot(0); + CallICNexus nexus(feedback_vector, slot); + CHECK_EQ(SpeculationMode::kAllowSpeculation, nexus.GetSpeculationMode()); + + CompileRun("f(Foo); f(Foo);"); + CHECK_EQ(3, nexus.GetCallCount()); + CHECK_EQ(SpeculationMode::kAllowSpeculation, nexus.GetSpeculationMode()); + + nexus.SetSpeculationMode(SpeculationMode::kAllowSpeculation); + nexus.SetSpeculationMode(SpeculationMode::kDisallowSpeculation); + CHECK_EQ(SpeculationMode::kDisallowSpeculation, nexus.GetSpeculationMode()); + nexus.SetSpeculationMode(SpeculationMode::kAllowSpeculation); + CHECK_EQ(SpeculationMode::kAllowSpeculation, nexus.GetSpeculationMode()); } TEST(VectorLoadICStates) { diff --git a/deps/v8/test/cctest/test-field-type-tracking.cc b/deps/v8/test/cctest/test-field-type-tracking.cc index 9622da53b8..8736c9c5db 100644 --- a/deps/v8/test/cctest/test-field-type-tracking.cc +++ b/deps/v8/test/cctest/test-field-type-tracking.cc @@ -2728,7 +2728,7 @@ TEST(HoleyMutableHeapNumber) { CHECK_EQ(kHoleNanInt64, mhn->value_as_bits()); mhn = isolate->factory()->NewHeapNumber(0.0, MUTABLE); - CHECK_EQ(V8_UINT64_C(0), mhn->value_as_bits()); + CHECK_EQ(uint64_t{0}, mhn->value_as_bits()); mhn->set_value_as_bits(kHoleNanInt64); CHECK_EQ(kHoleNanInt64, mhn->value_as_bits()); diff --git a/deps/v8/test/cctest/test-func-name-inference.cc b/deps/v8/test/cctest/test-func-name-inference.cc index e5ccbc3275..783ab3da83 100644 --- a/deps/v8/test/cctest/test-func-name-inference.cc +++ b/deps/v8/test/cctest/test-func-name-inference.cc @@ -555,3 +555,31 @@ TEST(ReturnAnonymousFunction) { script->Run(CcTest::isolate()->GetCurrentContext()).ToLocalChecked(); CheckFunctionName(script, "return 2012", ""); } + +TEST(IgnoreExtendsClause) { + CcTest::InitializeVM(); + v8::HandleScope scope(CcTest::isolate()); + + v8::Local<v8::Script> script = + Compile(CcTest::isolate(), + "(function() {\n" + " var foo = {};\n" + " foo.C = class {}\n" + " class D extends foo.C {}\n" + " foo.bar = function() { return 1; };\n" + "})()"); + script->Run(CcTest::isolate()->GetCurrentContext()).ToLocalChecked(); + CheckFunctionName(script, "return 1", "foo.bar"); +} + +TEST(ParameterAndArrow) { + CcTest::InitializeVM(); + v8::HandleScope scope(CcTest::isolate()); + + v8::Local<v8::Script> script = Compile(CcTest::isolate(), + "(function(param) {\n" + " (() => { return 2017 })();\n" + "})()"); + script->Run(CcTest::isolate()->GetCurrentContext()).ToLocalChecked(); + CheckFunctionName(script, "return 2017", ""); +} diff --git a/deps/v8/test/cctest/test-heap-profiler.cc b/deps/v8/test/cctest/test-heap-profiler.cc index 5a94708ba8..d9f919fbee 100644 --- a/deps/v8/test/cctest/test-heap-profiler.cc +++ b/deps/v8/test/cctest/test-heap-profiler.cc @@ -875,8 +875,7 @@ class TestJSONStream : public v8::OutputStream { return kContinue; } virtual WriteResult WriteUint32Chunk(uint32_t* buffer, int chars_written) { - CHECK(false); - return kAbort; + UNREACHABLE(); } void WriteTo(i::Vector<char> dest) { buffer_.WriteTo(dest); } int eos_signaled() { return eos_signaled_; } @@ -1064,8 +1063,7 @@ class TestStatsStream : public v8::OutputStream { virtual ~TestStatsStream() {} virtual void EndOfStream() { ++eos_signaled_; } virtual WriteResult WriteAsciiChunk(char* buffer, int chars_written) { - CHECK(false); - return kAbort; + UNREACHABLE(); } virtual WriteResult WriteHeapStatsChunk(v8::HeapStatsUpdate* buffer, int updates_written) { @@ -1460,8 +1458,7 @@ class TestRetainedObjectInfo : public v8::RetainedObjectInfo { return new TestRetainedObjectInfo(2, "ccc-group", "ccc"); } } - CHECK(false); - return nullptr; + UNREACHABLE(); } static std::vector<TestRetainedObjectInfo*> instances; @@ -2816,7 +2813,7 @@ TEST(AddressToTraceMap) { // [0x100, 0x200) -> 1, [0x200, 0x300) -> 2 map.AddRange(ToAddress(0x200), 0x100, 2U); - CHECK_EQ(2u, map.GetTraceNodeId(ToAddress(0x2a0))); + CHECK_EQ(2u, map.GetTraceNodeId(ToAddress(0x2A0))); CHECK_EQ(2u, map.size()); // [0x100, 0x180) -> 1, [0x180, 0x280) -> 3, [0x280, 0x300) -> 2 @@ -3139,6 +3136,31 @@ TEST(SamplingHeapProfilerPretenuredInlineAllocations) { CHECK_GE(count, 8000); } +TEST(SamplingHeapProfilerLargeInterval) { + v8::HandleScope scope(v8::Isolate::GetCurrent()); + LocalContext env; + v8::HeapProfiler* heap_profiler = env->GetIsolate()->GetHeapProfiler(); + + // Suppress randomness to avoid flakiness in tests. + v8::internal::FLAG_sampling_heap_profiler_suppress_randomness = true; + + heap_profiler->StartSamplingHeapProfiler(512 * 1024); + + for (int i = 0; i < 8 * 1024; ++i) { + CcTest::i_isolate()->factory()->NewFixedArray(1024); + } + + std::unique_ptr<v8::AllocationProfile> profile( + heap_profiler->GetAllocationProfile()); + CHECK(profile); + const char* names[] = {"(EXTERNAL)"}; + auto node = FindAllocationProfileNode(env->GetIsolate(), *profile, + ArrayVector(names)); + CHECK(node); + + heap_profiler->StopSamplingHeapProfiler(); +} + TEST(SamplingHeapProfilerSampleDuringDeopt) { i::FLAG_allow_natives_syntax = true; diff --git a/deps/v8/test/cctest/test-inobject-slack-tracking.cc b/deps/v8/test/cctest/test-inobject-slack-tracking.cc index 48ec9e18cd..be6a71b0e3 100644 --- a/deps/v8/test/cctest/test-inobject-slack-tracking.cc +++ b/deps/v8/test/cctest/test-inobject-slack-tracking.cc @@ -622,6 +622,12 @@ static void TestSubclassChain(const std::vector<int>& hierarchy_desc) { TestClassHierarchy(hierarchy_desc, static_cast<int>(hierarchy_desc.size())); } +TEST(Subclasses) { + std::vector<int> hierarchy_desc; + hierarchy_desc.push_back(50); + hierarchy_desc.push_back(128); + TestSubclassChain(hierarchy_desc); +} TEST(LongSubclassChain1) { std::vector<int> hierarchy_desc; diff --git a/deps/v8/test/cctest/test-log-stack-tracer.cc b/deps/v8/test/cctest/test-log-stack-tracer.cc index 9c25f3ce3e..24d6d9c8ba 100644 --- a/deps/v8/test/cctest/test-log-stack-tracer.cc +++ b/deps/v8/test/cctest/test-log-stack-tracer.cc @@ -86,7 +86,7 @@ static void construct_call(const v8::FunctionCallbackInfo<v8::Value>& args) { .FromJust(); #elif defined(V8_HOST_ARCH_64_BIT) uint64_t fp = reinterpret_cast<uint64_t>(calling_frame->fp()); - int32_t low_bits = static_cast<int32_t>(fp & 0xffffffff); + int32_t low_bits = static_cast<int32_t>(fp & 0xFFFFFFFF); int32_t high_bits = static_cast<int32_t>(fp >> 32); args.This()->Set(context, v8_str("low_bits"), v8_num(low_bits)).FromJust(); args.This()->Set(context, v8_str("high_bits"), v8_num(high_bits)).FromJust(); diff --git a/deps/v8/test/cctest/test-log.cc b/deps/v8/test/cctest/test-log.cc index 05ae2e8fcd..0579010292 100644 --- a/deps/v8/test/cctest/test-log.cc +++ b/deps/v8/test/cctest/test-log.cc @@ -648,14 +648,12 @@ TEST(EquivalenceOfLoggingAndTraversal) { v8::Local<v8::Script> script = CompileWithOrigin(source_str, ""); if (script.IsEmpty()) { v8::String::Utf8Value exception(isolate, try_catch.Exception()); - printf("compile: %s\n", *exception); - CHECK(false); + FATAL("compile: %s\n", *exception); } v8::Local<v8::Value> result; if (!script->Run(logger.env()).ToLocal(&result)) { v8::String::Utf8Value exception(isolate, try_catch.Exception()); - printf("run: %s\n", *exception); - CHECK(false); + FATAL("run: %s\n", *exception); } // The result either be the "true" literal or problem description. if (!result->IsTrue()) { @@ -663,10 +661,7 @@ TEST(EquivalenceOfLoggingAndTraversal) { i::ScopedVector<char> data(s->Utf8Length() + 1); CHECK(data.start()); s->WriteUtf8(data.start()); - printf("%s\n", data.start()); - // Make sure that our output is written prior crash due to CHECK failure. - fflush(stdout); - CHECK(false); + FATAL("%s\n", data.start()); } } isolate->Dispose(); @@ -885,6 +880,9 @@ TEST(ConsoleTimeEvents) { } TEST(LogFunctionEvents) { + // Always opt and stress opt will break the fine-grained log order. + if (i::FLAG_always_opt) return; + SETUP_FLAGS(); i::FLAG_log_function_events = true; v8::Isolate::CreateParams create_params; @@ -936,14 +934,21 @@ TEST(LogFunctionEvents) { // - execute eager functions. {"function,parse-function,", ",lazyFunction"}, {"function,compile-lazy,", ",lazyFunction"}, + {"function,first-execution,", ",lazyFunction"}, {"function,parse-function,", ",lazyInnerFunction"}, {"function,compile-lazy,", ",lazyInnerFunction"}, + {"function,first-execution,", ",lazyInnerFunction"}, + + {"function,first-execution,", ",eagerFunction"}, {"function,parse-function,", ",Foo"}, {"function,compile-lazy,", ",Foo"}, + {"function,first-execution,", ",Foo"}, + {"function,parse-function,", ",Foo.foo"}, {"function,compile-lazy,", ",Foo.foo"}, + {"function,first-execution,", ",Foo.foo"}, }; logger.FindLogLines(pairs, arraysize(pairs), start); } diff --git a/deps/v8/test/cctest/test-macro-assembler-arm.cc b/deps/v8/test/cctest/test-macro-assembler-arm.cc index 0becfa52ab..acef2731b9 100644 --- a/deps/v8/test/cctest/test-macro-assembler-arm.cc +++ b/deps/v8/test/cctest/test-macro-assembler-arm.cc @@ -27,10 +27,10 @@ #include <stdlib.h> -#include "src/arm/simulator-arm.h" #include "src/assembler-inl.h" #include "src/macro-assembler.h" #include "src/objects-inl.h" +#include "src/simulator.h" #include "src/v8.h" #include "test/cctest/cctest.h" @@ -38,12 +38,12 @@ namespace v8 { namespace internal { namespace test_macro_assembler_arm { -typedef void* (*F)(int x, int y, int p2, int p3, int p4); +using F = void*(int x, int y, int p2, int p3, int p4); #define __ masm-> -typedef Object* (*F3)(void* p0, int p1, int p2, int p3, int p4); -typedef int (*F5)(void*, void*, void*, void*, void*); +using F3 = Object*(void* p0, int p1, int p2, int p3, int p4); +using F5 = int(void*, void*, void*, void*, void*); TEST(LoadAndStoreWithRepresentation) { Isolate* isolate = CcTest::i_isolate(); @@ -129,8 +129,8 @@ TEST(LoadAndStoreWithRepresentation) { isolate->factory()->NewCode(desc, Code::STUB, Handle<Code>()); // Call the function from C++. - F5 f = FUNCTION_CAST<F5>(code->entry()); - CHECK(!CALL_GENERATED_CODE(isolate, f, 0, 0, 0, 0, 0)); + auto f = GeneratedCode<F5>::FromCode(*code); + CHECK(!f.Call(0, 0, 0, 0, 0)); } TEST(ExtractLane) { @@ -239,9 +239,8 @@ TEST(ExtractLane) { OFStream os(stdout); code->Print(os); #endif - F3 f = FUNCTION_CAST<F3>(code->entry()); - Object* dummy = CALL_GENERATED_CODE(isolate, f, &t, 0, 0, 0, 0); - USE(dummy); + auto f = GeneratedCode<F3>::FromCode(*code); + f.Call(&t, 0, 0, 0, 0); for (int i = 0; i < 4; i++) { CHECK_EQ(i, t.i32x4_low[i]); CHECK_EQ(i, t.f32x4_low[i]); @@ -372,9 +371,8 @@ TEST(ReplaceLane) { OFStream os(stdout); code->Print(os); #endif - F3 f = FUNCTION_CAST<F3>(code->entry()); - Object* dummy = CALL_GENERATED_CODE(isolate, f, &t, 0, 0, 0, 0); - USE(dummy); + auto f = GeneratedCode<F3>::FromCode(*code); + f.Call(&t, 0, 0, 0, 0); for (int i = 0; i < 4; i++) { CHECK_EQ(i, t.i32x4_low[i]); CHECK_EQ(i, t.f32x4_low[i]); diff --git a/deps/v8/test/cctest/test-macro-assembler-mips.cc b/deps/v8/test/cctest/test-macro-assembler-mips.cc index 7879ff2622..66d6c4bf9d 100644 --- a/deps/v8/test/cctest/test-macro-assembler-mips.cc +++ b/deps/v8/test/cctest/test-macro-assembler-mips.cc @@ -32,17 +32,18 @@ #include "src/base/utils/random-number-generator.h" #include "src/macro-assembler.h" #include "src/mips/macro-assembler-mips.h" -#include "src/mips/simulator-mips.h" #include "src/objects-inl.h" +#include "src/simulator.h" #include "src/v8.h" #include "test/cctest/cctest.h" namespace v8 { namespace internal { -typedef Object* (*F1)(int x, int p1, int p2, int p3, int p4); -typedef Object* (*F3)(void* p, int p1, int p2, int p3, int p4); -typedef Object* (*F4)(void* p0, void* p1, int p2, int p3, int p4); +// TODO(mips): Refine these signatures per test case. +using F1 = Object*(int x, int p1, int p2, int p3, int p4); +using F3 = Object*(void* p, int p1, int p2, int p3, int p4); +using F4 = Object*(void* p0, void* p1, int p2, int p3, int p4); #define __ masm-> @@ -96,14 +97,13 @@ TEST(BYTESWAP) { masm->GetCode(isolate, &desc); Handle<Code> code = isolate->factory()->NewCode(desc, Code::STUB, Handle<Code>()); - F3 f = FUNCTION_CAST<F3>(code->entry()); + auto f = GeneratedCode<F3>::FromCode(*code); t.r1 = 0x781A15C3; t.r2 = 0x2CDE; t.r3 = 0x9F; t.r4 = 0x9F; t.r5 = 0x2CDE; - Object* dummy = CALL_GENERATED_CODE(isolate, f, &t, 0, 0, 0, 0); - USE(dummy); + f.Call(&t, 0, 0, 0, 0); CHECK_EQ(static_cast<int32_t>(0xC3151A78), t.r1); CHECK_EQ(static_cast<int32_t>(0xDE2C0000), t.r2); @@ -208,10 +208,9 @@ TEST(jump_tables4) { #ifdef OBJECT_PRINT code->Print(std::cout); #endif - F1 f = FUNCTION_CAST<F1>(code->entry()); + auto f = GeneratedCode<F1>::FromCode(*code); for (int i = 0; i < kNumCases; ++i) { - int res = - reinterpret_cast<int>(CALL_GENERATED_CODE(isolate, f, i, 0, 0, 0, 0)); + int res = reinterpret_cast<int>(f.Call(i, 0, 0, 0, 0)); ::printf("f(%d) = %d\n", i, res); CHECK_EQ(values[i], res); } @@ -275,10 +274,9 @@ TEST(jump_tables5) { #ifdef OBJECT_PRINT code->Print(std::cout); #endif - F1 f = FUNCTION_CAST<F1>(code->entry()); + auto f = GeneratedCode<F1>::FromCode(*code); for (int i = 0; i < kNumCases; ++i) { - int32_t res = reinterpret_cast<int32_t>( - CALL_GENERATED_CODE(isolate, f, i, 0, 0, 0, 0)); + int32_t res = reinterpret_cast<int32_t>(f.Call(i, 0, 0, 0, 0)); ::printf("f(%d) = %d\n", i, res); CHECK_EQ(values[i], res); } @@ -366,10 +364,9 @@ TEST(jump_tables6) { #ifdef OBJECT_PRINT code->Print(std::cout); #endif - F1 f = FUNCTION_CAST<F1>(code->entry()); + auto f = GeneratedCode<F1>::FromCode(*code); for (int i = 0; i < kSwitchTableCases; ++i) { - int res = - reinterpret_cast<int>(CALL_GENERATED_CODE(isolate, f, i, 0, 0, 0, 0)); + int res = reinterpret_cast<int>(f.Call(i, 0, 0, 0, 0)); ::printf("f(%d) = %d\n", i, res); CHECK_EQ(values[i], res); } @@ -391,10 +388,9 @@ static uint32_t run_lsa(uint32_t rt, uint32_t rs, int8_t sa) { Handle<Code> code = isolate->factory()->NewCode(desc, Code::STUB, Handle<Code>()); - F1 f = FUNCTION_CAST<F1>(code->entry()); + auto f = GeneratedCode<F1>::FromCode(*code); - uint32_t res = reinterpret_cast<uint32_t>( - CALL_GENERATED_CODE(isolate, f, rt, rs, 0, 0, 0)); + uint32_t res = reinterpret_cast<uint32_t>(f.Call(rt, rs, 0, 0, 0)); return res; } @@ -412,7 +408,7 @@ TEST(Lsa) { struct TestCaseLsa tc[] = {// rt, rs, sa, expected_res {0x4, 0x1, 1, 0x6}, {0x4, 0x1, 2, 0x8}, - {0x4, 0x1, 3, 0xc}, + {0x4, 0x1, 3, 0xC}, {0x4, 0x1, 4, 0x14}, {0x4, 0x1, 5, 0x24}, {0x0, 0x1, 1, 0x2}, @@ -429,9 +425,9 @@ TEST(Lsa) { // Shift overflow. {0x4, INT32_MAX, 1, 0x2}, {0x4, INT32_MAX >> 1, 2, 0x0}, - {0x4, INT32_MAX >> 2, 3, 0xfffffffc}, - {0x4, INT32_MAX >> 3, 4, 0xfffffff4}, - {0x4, INT32_MAX >> 4, 5, 0xffffffe4}, + {0x4, INT32_MAX >> 2, 3, 0xFFFFFFFC}, + {0x4, INT32_MAX >> 3, 4, 0xFFFFFFF4}, + {0x4, INT32_MAX >> 4, 5, 0xFFFFFFE4}, // Signed addition overflow. {INT32_MAX - 1, 0x1, 1, 0x80000000}, @@ -457,19 +453,19 @@ TEST(Lsa) { } static const std::vector<uint32_t> cvt_trunc_uint32_test_values() { - static const uint32_t kValues[] = {0x00000000, 0x00000001, 0x00ffff00, - 0x7fffffff, 0x80000000, 0x80000001, - 0x80ffff00, 0x8fffffff, 0xffffffff}; + static const uint32_t kValues[] = {0x00000000, 0x00000001, 0x00FFFF00, + 0x7FFFFFFF, 0x80000000, 0x80000001, + 0x80FFFF00, 0x8FFFFFFF, 0xFFFFFFFF}; return std::vector<uint32_t>(&kValues[0], &kValues[arraysize(kValues)]); } static const std::vector<int32_t> cvt_trunc_int32_test_values() { static const int32_t kValues[] = { static_cast<int32_t>(0x00000000), static_cast<int32_t>(0x00000001), - static_cast<int32_t>(0x00ffff00), static_cast<int32_t>(0x7fffffff), + static_cast<int32_t>(0x00FFFF00), static_cast<int32_t>(0x7FFFFFFF), static_cast<int32_t>(0x80000000), static_cast<int32_t>(0x80000001), - static_cast<int32_t>(0x80ffff00), static_cast<int32_t>(0x8fffffff), - static_cast<int32_t>(0xffffffff)}; + static_cast<int32_t>(0x80FFFF00), static_cast<int32_t>(0x8FFFFFFF), + static_cast<int32_t>(0xFFFFFFFF)}; return std::vector<int32_t>(&kValues[0], &kValues[arraysize(kValues)]); } @@ -502,7 +498,7 @@ static const std::vector<int32_t> cvt_trunc_int32_test_values() { template <typename RET_TYPE, typename IN_TYPE, typename Func> RET_TYPE run_Cvt(IN_TYPE x, Func GenerateConvertInstructionFunc) { - typedef RET_TYPE (*F_CVT)(IN_TYPE x0, int x1, int x2, int x3, int x4); + typedef RET_TYPE(F_CVT)(IN_TYPE x0, int x1, int x2, int x3, int x4); Isolate* isolate = CcTest::i_isolate(); HandleScope scope(isolate); @@ -521,10 +517,9 @@ RET_TYPE run_Cvt(IN_TYPE x, Func GenerateConvertInstructionFunc) { Handle<Code> code = isolate->factory()->NewCode(desc, Code::STUB, Handle<Code>()); - F_CVT f = FUNCTION_CAST<F_CVT>(code->entry()); + auto f = GeneratedCode<F_CVT>::FromCode(*code); - return reinterpret_cast<RET_TYPE>( - CALL_GENERATED_CODE(isolate, f, x, 0, 0, 0, 0)); + return reinterpret_cast<RET_TYPE>(f.Call(x, 0, 0, 0, 0)); } TEST(cvt_s_w_Trunc_uw_s) { @@ -553,11 +548,11 @@ TEST(cvt_d_w_Trunc_w_d) { static const std::vector<int32_t> overflow_int32_test_values() { static const int32_t kValues[] = { - static_cast<int32_t>(0xf0000000), static_cast<int32_t>(0x00000001), - static_cast<int32_t>(0xff000000), static_cast<int32_t>(0x0000f000), - static_cast<int32_t>(0x0f000000), static_cast<int32_t>(0x991234ab), - static_cast<int32_t>(0xb0ffff01), static_cast<int32_t>(0x00006fff), - static_cast<int32_t>(0xffffffff)}; + static_cast<int32_t>(0xF0000000), static_cast<int32_t>(0x00000001), + static_cast<int32_t>(0xFF000000), static_cast<int32_t>(0x0000F000), + static_cast<int32_t>(0x0F000000), static_cast<int32_t>(0x991234AB), + static_cast<int32_t>(0xB0FFFF01), static_cast<int32_t>(0x00006FFF), + static_cast<int32_t>(0xFFFFFFFF)}; return std::vector<int32_t>(&kValues[0], &kValues[arraysize(kValues)]); } @@ -609,7 +604,7 @@ static bool IsSubOverflow(T x, T y) { template <typename IN_TYPE, typename Func> static bool runOverflow(IN_TYPE valLeft, IN_TYPE valRight, Func GenerateOverflowInstructions) { - typedef int32_t (*F_CVT)(char* x0, int x1, int x2, int x3, int x4); + typedef int32_t(F_CVT)(char* x0, int x1, int x2, int x3, int x4); Isolate* isolate = CcTest::i_isolate(); HandleScope scope(isolate); @@ -626,10 +621,9 @@ static bool runOverflow(IN_TYPE valLeft, IN_TYPE valRight, Handle<Code> code = isolate->factory()->NewCode(desc, Code::STUB, Handle<Code>()); - F_CVT f = FUNCTION_CAST<F_CVT>(code->entry()); + auto f = GeneratedCode<F_CVT>::FromCode(*code); - int32_t r = - reinterpret_cast<int32_t>(CALL_GENERATED_CODE(isolate, f, 0, 0, 0, 0, 0)); + int32_t r = reinterpret_cast<int32_t>(f.Call(0, 0, 0, 0, 0)); DCHECK(r == 0 || r == 1); return r; @@ -1054,14 +1048,14 @@ TEST(min_max_nan) { masm->GetCode(isolate, &desc); Handle<Code> code = isolate->factory()->NewCode(desc, Code::STUB, Handle<Code>()); - F3 f = FUNCTION_CAST<F3>(code->entry()); + auto f = GeneratedCode<F3>::FromCode(*code); for (int i = 0; i < kTableLength; i++) { test.a = inputsa[i]; test.b = inputsb[i]; test.e = inputse[i]; test.f = inputsf[i]; - CALL_GENERATED_CODE(isolate, f, &test, 0, 0, 0, 0); + f.Call(&test, 0, 0, 0, 0); CHECK_EQ(0, memcmp(&test.c, &outputsdmin[i], sizeof(test.c))); CHECK_EQ(0, memcmp(&test.d, &outputsdmax[i], sizeof(test.d))); @@ -1073,7 +1067,7 @@ TEST(min_max_nan) { template <typename IN_TYPE, typename Func> bool run_Unaligned(char* memory_buffer, int32_t in_offset, int32_t out_offset, IN_TYPE value, Func GenerateUnalignedInstructionFunc) { - typedef int32_t (*F_CVT)(char* x0, int x1, int x2, int x3, int x4); + typedef int32_t(F_CVT)(char* x0, int x1, int x2, int x3, int x4); Isolate* isolate = CcTest::i_isolate(); HandleScope scope(isolate); @@ -1091,10 +1085,10 @@ bool run_Unaligned(char* memory_buffer, int32_t in_offset, int32_t out_offset, Handle<Code> code = isolate->factory()->NewCode(desc, Code::STUB, Handle<Code>()); - F_CVT f = FUNCTION_CAST<F_CVT>(code->entry()); + auto f = GeneratedCode<F_CVT>::FromCode(*code); MemCopy(memory_buffer + in_offset, &value, sizeof(IN_TYPE)); - CALL_GENERATED_CODE(isolate, f, memory_buffer, 0, 0, 0, 0); + f.Call(memory_buffer, 0, 0, 0, 0); MemCopy(&res, memory_buffer + out_offset, sizeof(IN_TYPE)); return res == value; @@ -1102,8 +1096,8 @@ bool run_Unaligned(char* memory_buffer, int32_t in_offset, int32_t out_offset, static const std::vector<uint64_t> unsigned_test_values() { static const uint64_t kValues[] = { - 0x2180f18a06384414, 0x000a714532102277, 0xbc1acccf180649f0, - 0x8000000080008000, 0x0000000000000001, 0xffffffffffffffff, + 0x2180F18A06384414, 0x000A714532102277, 0xBC1ACCCF180649F0, + 0x8000000080008000, 0x0000000000000001, 0xFFFFFFFFFFFFFFFF, }; return std::vector<uint64_t>(&kValues[0], &kValues[arraysize(kValues)]); } @@ -1313,16 +1307,16 @@ TEST(Uldc1) { static const std::vector<uint32_t> sltu_test_values() { static const uint32_t kValues[] = { - 0, 1, 0x7ffe, 0x7fff, 0x8000, - 0x8001, 0xfffe, 0xffff, 0xffff7ffe, 0xffff7fff, - 0xffff8000, 0xffff8001, 0xfffffffe, 0xffffffff, + 0, 1, 0x7FFE, 0x7FFF, 0x8000, + 0x8001, 0xFFFE, 0xFFFF, 0xFFFF7FFE, 0xFFFF7FFF, + 0xFFFF8000, 0xFFFF8001, 0xFFFFFFFE, 0xFFFFFFFF, }; return std::vector<uint32_t>(&kValues[0], &kValues[arraysize(kValues)]); } template <typename Func> bool run_Sltu(uint32_t rs, uint32_t rd, Func GenerateSltuInstructionFunc) { - typedef int32_t (*F_CVT)(uint32_t x0, uint32_t x1, int x2, int x3, int x4); + typedef int32_t(F_CVT)(uint32_t x0, uint32_t x1, int x2, int x3, int x4); Isolate* isolate = CcTest::i_isolate(); HandleScope scope(isolate); @@ -1339,9 +1333,8 @@ bool run_Sltu(uint32_t rs, uint32_t rd, Func GenerateSltuInstructionFunc) { Handle<Code> code = isolate->factory()->NewCode(desc, Code::STUB, Handle<Code>()); - F_CVT f = FUNCTION_CAST<F_CVT>(code->entry()); - int32_t res = reinterpret_cast<int32_t>( - CALL_GENERATED_CODE(isolate, f, rs, rd, 0, 0, 0)); + auto f = GeneratedCode<F_CVT>::FromCode(*code); + int32_t res = reinterpret_cast<int32_t>(f.Call(rs, rd, 0, 0, 0)); return res == 1; } @@ -1367,7 +1360,7 @@ TEST(Sltu) { } template <typename T, typename Inputs, typename Results> -static F4 GenerateMacroFloat32MinMax(MacroAssembler* masm) { +static GeneratedCode<F4> GenerateMacroFloat32MinMax(MacroAssembler* masm) { T a = T::from_code(4); // f4 T b = T::from_code(6); // f6 T c = T::from_code(8); // f8 @@ -1437,7 +1430,7 @@ static F4 GenerateMacroFloat32MinMax(MacroAssembler* masm) { OFStream os(stdout); code->Print(os); #endif - return FUNCTION_CAST<F4>(code->entry()); + return GeneratedCode<F4>::FromCode(*code); } TEST(macro_float_minmax_f32) { @@ -1466,15 +1459,14 @@ TEST(macro_float_minmax_f32) { float max_aba_; }; - F4 f = GenerateMacroFloat32MinMax<FPURegister, Inputs, Results>(masm); - Object* dummy = nullptr; - USE(dummy); + GeneratedCode<F4> f = + GenerateMacroFloat32MinMax<FPURegister, Inputs, Results>(masm); #define CHECK_MINMAX(src1, src2, min, max) \ do { \ Inputs inputs = {src1, src2}; \ Results results; \ - dummy = CALL_GENERATED_CODE(isolate, f, &inputs, &results, 0, 0, 0); \ + f.Call(&inputs, &results, 0, 0, 0); \ CHECK_EQ(bit_cast<uint32_t>(min), bit_cast<uint32_t>(results.min_abc_)); \ CHECK_EQ(bit_cast<uint32_t>(min), bit_cast<uint32_t>(results.min_aab_)); \ CHECK_EQ(bit_cast<uint32_t>(min), bit_cast<uint32_t>(results.min_aba_)); \ @@ -1510,7 +1502,7 @@ TEST(macro_float_minmax_f32) { } template <typename T, typename Inputs, typename Results> -static F4 GenerateMacroFloat64MinMax(MacroAssembler* masm) { +static GeneratedCode<F4> GenerateMacroFloat64MinMax(MacroAssembler* masm) { T a = T::from_code(4); // f4 T b = T::from_code(6); // f6 T c = T::from_code(8); // f8 @@ -1580,7 +1572,7 @@ static F4 GenerateMacroFloat64MinMax(MacroAssembler* masm) { OFStream os(stdout); code->Print(os); #endif - return FUNCTION_CAST<F4>(code->entry()); + return GeneratedCode<F4>::FromCode(*code); } TEST(macro_float_minmax_f64) { @@ -1609,15 +1601,14 @@ TEST(macro_float_minmax_f64) { double max_aba_; }; - F4 f = GenerateMacroFloat64MinMax<DoubleRegister, Inputs, Results>(masm); - Object* dummy = nullptr; - USE(dummy); + GeneratedCode<F4> f = + GenerateMacroFloat64MinMax<DoubleRegister, Inputs, Results>(masm); #define CHECK_MINMAX(src1, src2, min, max) \ do { \ Inputs inputs = {src1, src2}; \ Results results; \ - dummy = CALL_GENERATED_CODE(isolate, f, &inputs, &results, 0, 0, 0); \ + f.Call(&inputs, &results, 0, 0, 0); \ CHECK_EQ(bit_cast<uint64_t>(min), bit_cast<uint64_t>(results.min_abc_)); \ CHECK_EQ(bit_cast<uint64_t>(min), bit_cast<uint64_t>(results.min_aab_)); \ CHECK_EQ(bit_cast<uint64_t>(min), bit_cast<uint64_t>(results.min_aba_)); \ diff --git a/deps/v8/test/cctest/test-macro-assembler-mips64.cc b/deps/v8/test/cctest/test-macro-assembler-mips64.cc index c695d29203..2b199cb9c7 100644 --- a/deps/v8/test/cctest/test-macro-assembler-mips64.cc +++ b/deps/v8/test/cctest/test-macro-assembler-mips64.cc @@ -34,16 +34,17 @@ #include "src/base/utils/random-number-generator.h" #include "src/macro-assembler.h" #include "src/mips64/macro-assembler-mips64.h" -#include "src/mips64/simulator-mips64.h" #include "src/objects-inl.h" +#include "src/simulator.h" namespace v8 { namespace internal { -typedef void* (*FV)(int64_t x, int64_t y, int p2, int p3, int p4); -typedef Object* (*F1)(int x, int p1, int p2, int p3, int p4); -typedef Object* (*F3)(void* p, int p1, int p2, int p3, int p4); -typedef Object* (*F4)(void* p0, void* p1, int p2, int p3, int p4); +// TODO(mips64): Refine these signatures per test case. +using FV = void*(int64_t x, int64_t y, int p2, int p3, int p4); +using F1 = Object*(int x, int p1, int p2, int p3, int p4); +using F3 = Object*(void* p, int p1, int p2, int p3, int p4); +using F4 = Object*(void* p0, void* p1, int p2, int p3, int p4); #define __ masm-> @@ -111,7 +112,7 @@ TEST(BYTESWAP) { masm->GetCode(isolate, &desc); Handle<Code> code = isolate->factory()->NewCode(desc, Code::STUB, Handle<Code>()); - F3 f = FUNCTION_CAST<F3>(code->entry()); + auto f = GeneratedCode<F3>::FromCode(*code); t.r1 = 0x5612FFCD9D327ACC; t.r2 = 0x781A15C3; t.r3 = 0xFCDE; @@ -119,8 +120,7 @@ TEST(BYTESWAP) { t.r5 = 0x9F; t.r6 = 0xFCDE; t.r7 = 0xC81A15C3; - Object* dummy = CALL_GENERATED_CODE(isolate, f, &t, 0, 0, 0, 0); - USE(dummy); + f.Call(&t, 0, 0, 0, 0); CHECK_EQ(static_cast<int64_t>(0xCC7A329DCDFF1256), t.r1); CHECK_EQ(static_cast<int64_t>(0xC3151A7800000000), t.r2); @@ -164,9 +164,8 @@ TEST(LoadConstants) { Handle<Code> code = isolate->factory()->NewCode(desc, Code::STUB, Handle<Code>()); - FV f = FUNCTION_CAST<FV>(code->entry()); - (void)CALL_GENERATED_CODE(isolate, f, reinterpret_cast<int64_t>(result), 0, 0, - 0, 0); + auto f = GeneratedCode<FV>::FromCode(*code); + (void)f.Call(reinterpret_cast<int64_t>(result), 0, 0, 0, 0); // Check results. for (int i = 0; i < 64; i++) { CHECK(refConstants[i] == result[i]); @@ -209,8 +208,8 @@ TEST(LoadAddress) { Handle<Code> code = isolate->factory()->NewCode(desc, Code::STUB, Handle<Code>()); - FV f = FUNCTION_CAST<FV>(code->entry()); - (void)CALL_GENERATED_CODE(isolate, f, 0, 0, 0, 0, 0); + auto f = GeneratedCode<FV>::FromCode(*code); + (void)f.Call(0, 0, 0, 0, 0); // Check results. } @@ -269,10 +268,9 @@ TEST(jump_tables4) { #ifdef OBJECT_PRINT code->Print(std::cout); #endif - F1 f = FUNCTION_CAST<F1>(code->entry()); + auto f = GeneratedCode<F1>::FromCode(*code); for (int i = 0; i < kNumCases; ++i) { - int64_t res = reinterpret_cast<int64_t>( - CALL_GENERATED_CODE(isolate, f, i, 0, 0, 0, 0)); + int64_t res = reinterpret_cast<int64_t>(f.Call(i, 0, 0, 0, 0)); ::printf("f(%d) = %" PRId64 "\n", i, res); CHECK_EQ(values[i], res); } @@ -343,10 +341,9 @@ TEST(jump_tables5) { #ifdef OBJECT_PRINT code->Print(std::cout); #endif - F1 f = FUNCTION_CAST<F1>(code->entry()); + auto f = GeneratedCode<F1>::FromCode(*code); for (int i = 0; i < kNumCases; ++i) { - int64_t res = reinterpret_cast<int64_t>( - CALL_GENERATED_CODE(isolate, f, i, 0, 0, 0, 0)); + int64_t res = reinterpret_cast<int64_t>(f.Call(i, 0, 0, 0, 0)); ::printf("f(%d) = %" PRId64 "\n", i, res); CHECK_EQ(values[i], res); } @@ -435,10 +432,9 @@ TEST(jump_tables6) { #ifdef OBJECT_PRINT code->Print(std::cout); #endif - F1 f = FUNCTION_CAST<F1>(code->entry()); + auto f = GeneratedCode<F1>::FromCode(*code); for (int i = 0; i < kSwitchTableCases; ++i) { - int64_t res = reinterpret_cast<int64_t>( - CALL_GENERATED_CODE(isolate, f, i, 0, 0, 0, 0)); + int64_t res = reinterpret_cast<int64_t>(f.Call(i, 0, 0, 0, 0)); ::printf("f(%d) = %" PRId64 "\n", i, res); CHECK_EQ(values[i], res); } @@ -460,10 +456,9 @@ static uint64_t run_lsa(uint32_t rt, uint32_t rs, int8_t sa) { Handle<Code> code = isolate->factory()->NewCode(desc, Code::STUB, Handle<Code>()); - F1 f = FUNCTION_CAST<F1>(code->entry()); + auto f = GeneratedCode<F1>::FromCode(*code); - uint64_t res = reinterpret_cast<uint64_t>( - CALL_GENERATED_CODE(isolate, f, rt, rs, 0, 0, 0)); + uint64_t res = reinterpret_cast<uint64_t>(f.Call(rt, rs, 0, 0, 0)); return res; } @@ -481,7 +476,7 @@ TEST(Lsa) { struct TestCaseLsa tc[] = {// rt, rs, sa, expected_res {0x4, 0x1, 1, 0x6}, {0x4, 0x1, 2, 0x8}, - {0x4, 0x1, 3, 0xc}, + {0x4, 0x1, 3, 0xC}, {0x4, 0x1, 4, 0x14}, {0x4, 0x1, 5, 0x24}, {0x0, 0x1, 1, 0x2}, @@ -498,16 +493,16 @@ TEST(Lsa) { // Shift overflow. {0x4, INT32_MAX, 1, 0x2}, {0x4, INT32_MAX >> 1, 2, 0x0}, - {0x4, INT32_MAX >> 2, 3, 0xfffffffffffffffc}, - {0x4, INT32_MAX >> 3, 4, 0xfffffffffffffff4}, - {0x4, INT32_MAX >> 4, 5, 0xffffffffffffffe4}, + {0x4, INT32_MAX >> 2, 3, 0xFFFFFFFFFFFFFFFC}, + {0x4, INT32_MAX >> 3, 4, 0xFFFFFFFFFFFFFFF4}, + {0x4, INT32_MAX >> 4, 5, 0xFFFFFFFFFFFFFFE4}, // Signed addition overflow. - {INT32_MAX - 1, 0x1, 1, 0xffffffff80000000}, - {INT32_MAX - 3, 0x1, 2, 0xffffffff80000000}, - {INT32_MAX - 7, 0x1, 3, 0xffffffff80000000}, - {INT32_MAX - 15, 0x1, 4, 0xffffffff80000000}, - {INT32_MAX - 31, 0x1, 5, 0xffffffff80000000}, + {INT32_MAX - 1, 0x1, 1, 0xFFFFFFFF80000000}, + {INT32_MAX - 3, 0x1, 2, 0xFFFFFFFF80000000}, + {INT32_MAX - 7, 0x1, 3, 0xFFFFFFFF80000000}, + {INT32_MAX - 15, 0x1, 4, 0xFFFFFFFF80000000}, + {INT32_MAX - 31, 0x1, 5, 0xFFFFFFFF80000000}, // Addition overflow. {-2, 0x1, 1, 0x0}, @@ -542,10 +537,9 @@ static uint64_t run_dlsa(uint64_t rt, uint64_t rs, int8_t sa) { Handle<Code> code = isolate->factory()->NewCode(desc, Code::STUB, Handle<Code>()); - FV f = FUNCTION_CAST<FV>(code->entry()); + auto f = GeneratedCode<FV>::FromCode(*code); - uint64_t res = reinterpret_cast<uint64_t>( - CALL_GENERATED_CODE(isolate, f, rt, rs, 0, 0, 0)); + uint64_t res = reinterpret_cast<uint64_t>(f.Call(rt, rs, 0, 0, 0)); return res; } @@ -563,7 +557,7 @@ TEST(Dlsa) { struct TestCaseLsa tc[] = {// rt, rs, sa, expected_res {0x4, 0x1, 1, 0x6}, {0x4, 0x1, 2, 0x8}, - {0x4, 0x1, 3, 0xc}, + {0x4, 0x1, 3, 0xC}, {0x4, 0x1, 4, 0x14}, {0x4, 0x1, 5, 0x24}, {0x0, 0x1, 1, 0x2}, @@ -580,9 +574,9 @@ TEST(Dlsa) { // Shift overflow. {0x4, INT64_MAX, 1, 0x2}, {0x4, INT64_MAX >> 1, 2, 0x0}, - {0x4, INT64_MAX >> 2, 3, 0xfffffffffffffffc}, - {0x4, INT64_MAX >> 3, 4, 0xfffffffffffffff4}, - {0x4, INT64_MAX >> 4, 5, 0xffffffffffffffe4}, + {0x4, INT64_MAX >> 2, 3, 0xFFFFFFFFFFFFFFFC}, + {0x4, INT64_MAX >> 3, 4, 0xFFFFFFFFFFFFFFF4}, + {0x4, INT64_MAX >> 4, 5, 0xFFFFFFFFFFFFFFE4}, // Signed addition overflow. {INT64_MAX - 1, 0x1, 1, 0x8000000000000000}, @@ -609,40 +603,40 @@ TEST(Dlsa) { } static const std::vector<uint32_t> cvt_trunc_uint32_test_values() { - static const uint32_t kValues[] = {0x00000000, 0x00000001, 0x00ffff00, - 0x7fffffff, 0x80000000, 0x80000001, - 0x80ffff00, 0x8fffffff, 0xffffffff}; + static const uint32_t kValues[] = {0x00000000, 0x00000001, 0x00FFFF00, + 0x7FFFFFFF, 0x80000000, 0x80000001, + 0x80FFFF00, 0x8FFFFFFF, 0xFFFFFFFF}; return std::vector<uint32_t>(&kValues[0], &kValues[arraysize(kValues)]); } static const std::vector<int32_t> cvt_trunc_int32_test_values() { static const int32_t kValues[] = { static_cast<int32_t>(0x00000000), static_cast<int32_t>(0x00000001), - static_cast<int32_t>(0x00ffff00), static_cast<int32_t>(0x7fffffff), + static_cast<int32_t>(0x00FFFF00), static_cast<int32_t>(0x7FFFFFFF), static_cast<int32_t>(0x80000000), static_cast<int32_t>(0x80000001), - static_cast<int32_t>(0x80ffff00), static_cast<int32_t>(0x8fffffff), - static_cast<int32_t>(0xffffffff)}; + static_cast<int32_t>(0x80FFFF00), static_cast<int32_t>(0x8FFFFFFF), + static_cast<int32_t>(0xFFFFFFFF)}; return std::vector<int32_t>(&kValues[0], &kValues[arraysize(kValues)]); } static const std::vector<uint64_t> cvt_trunc_uint64_test_values() { static const uint64_t kValues[] = { - 0x0000000000000000, 0x0000000000000001, 0x0000ffffffff0000, - 0x7fffffffffffffff, 0x8000000000000000, 0x8000000000000001, - 0x8000ffffffff0000, 0x8fffffffffffffff, 0xffffffffffffffff}; + 0x0000000000000000, 0x0000000000000001, 0x0000FFFFFFFF0000, + 0x7FFFFFFFFFFFFFFF, 0x8000000000000000, 0x8000000000000001, + 0x8000FFFFFFFF0000, 0x8FFFFFFFFFFFFFFF, 0xFFFFFFFFFFFFFFFF}; return std::vector<uint64_t>(&kValues[0], &kValues[arraysize(kValues)]); } static const std::vector<int64_t> cvt_trunc_int64_test_values() { static const int64_t kValues[] = {static_cast<int64_t>(0x0000000000000000), static_cast<int64_t>(0x0000000000000001), - static_cast<int64_t>(0x0000ffffffff0000), - static_cast<int64_t>(0x7fffffffffffffff), + static_cast<int64_t>(0x0000FFFFFFFF0000), + static_cast<int64_t>(0x7FFFFFFFFFFFFFFF), static_cast<int64_t>(0x8000000000000000), static_cast<int64_t>(0x8000000000000001), - static_cast<int64_t>(0x8000ffffffff0000), - static_cast<int64_t>(0x8fffffffffffffff), - static_cast<int64_t>(0xffffffffffffffff)}; + static_cast<int64_t>(0x8000FFFFFFFF0000), + static_cast<int64_t>(0x8FFFFFFFFFFFFFFF), + static_cast<int64_t>(0xFFFFFFFFFFFFFFFF)}; return std::vector<int64_t>(&kValues[0], &kValues[arraysize(kValues)]); } @@ -676,7 +670,7 @@ static const std::vector<int64_t> cvt_trunc_int64_test_values() { template <typename RET_TYPE, typename IN_TYPE, typename Func> RET_TYPE run_Cvt(IN_TYPE x, Func GenerateConvertInstructionFunc) { - typedef RET_TYPE (*F_CVT)(IN_TYPE x0, int x1, int x2, int x3, int x4); + typedef RET_TYPE(F_CVT)(IN_TYPE x0, int x1, int x2, int x3, int x4); Isolate* isolate = CcTest::i_isolate(); HandleScope scope(isolate); @@ -694,10 +688,9 @@ RET_TYPE run_Cvt(IN_TYPE x, Func GenerateConvertInstructionFunc) { Handle<Code> code = isolate->factory()->NewCode(desc, Code::STUB, Handle<Code>()); - F_CVT f = FUNCTION_CAST<F_CVT>(code->entry()); + auto f = GeneratedCode<F_CVT>::FromCode(*code); - return reinterpret_cast<RET_TYPE>( - CALL_GENERATED_CODE(isolate, f, x, 0, 0, 0, 0)); + return reinterpret_cast<RET_TYPE>(f.Call(x, 0, 0, 0, 0)); } TEST(Cvt_s_uw_Trunc_uw_s) { @@ -780,15 +773,15 @@ TEST(cvt_d_w_Trunc_w_d) { } static const std::vector<int64_t> overflow_int64_test_values() { - static const int64_t kValues[] = {static_cast<int64_t>(0xf000000000000000), + static const int64_t kValues[] = {static_cast<int64_t>(0xF000000000000000), static_cast<int64_t>(0x0000000000000001), - static_cast<int64_t>(0xff00000000000000), - static_cast<int64_t>(0x0000f00111111110), - static_cast<int64_t>(0x0f00001000000000), - static_cast<int64_t>(0x991234ab12a96731), - static_cast<int64_t>(0xb0ffff0f0f0f0f01), - static_cast<int64_t>(0x00006fffffffffff), - static_cast<int64_t>(0xffffffffffffffff)}; + static_cast<int64_t>(0xFF00000000000000), + static_cast<int64_t>(0x0000F00111111110), + static_cast<int64_t>(0x0F00001000000000), + static_cast<int64_t>(0x991234AB12A96731), + static_cast<int64_t>(0xB0FFFF0F0F0F0F01), + static_cast<int64_t>(0x00006FFFFFFFFFFF), + static_cast<int64_t>(0xFFFFFFFFFFFFFFFF)}; return std::vector<int64_t>(&kValues[0], &kValues[arraysize(kValues)]); } @@ -840,7 +833,7 @@ static bool IsSubOverflow(T x, T y) { template <typename IN_TYPE, typename Func> static bool runOverflow(IN_TYPE valLeft, IN_TYPE valRight, Func GenerateOverflowInstructions) { - typedef int64_t (*F_CVT)(char* x0, int x1, int x2, int x3, int x4); + typedef int64_t(F_CVT)(char* x0, int x1, int x2, int x3, int x4); Isolate* isolate = CcTest::i_isolate(); HandleScope scope(isolate); @@ -857,10 +850,9 @@ static bool runOverflow(IN_TYPE valLeft, IN_TYPE valRight, Handle<Code> code = isolate->factory()->NewCode(desc, Code::STUB, Handle<Code>()); - F_CVT f = FUNCTION_CAST<F_CVT>(code->entry()); + auto f = GeneratedCode<F_CVT>::FromCode(*code); - int64_t r = - reinterpret_cast<int64_t>(CALL_GENERATED_CODE(isolate, f, 0, 0, 0, 0, 0)); + int64_t r = reinterpret_cast<int64_t>(f.Call(0, 0, 0, 0, 0)); DCHECK(r == 0 || r == 1); return r; @@ -1212,14 +1204,14 @@ TEST(min_max_nan) { masm->GetCode(isolate, &desc); Handle<Code> code = isolate->factory()->NewCode(desc, Code::STUB, Handle<Code>()); - F3 f = FUNCTION_CAST<F3>(code->entry()); + auto f = GeneratedCode<F3>::FromCode(*code); for (int i = 0; i < kTableLength; i++) { test.a = inputsa[i]; test.b = inputsb[i]; test.e = inputse[i]; test.f = inputsf[i]; - CALL_GENERATED_CODE(isolate, f, &test, 0, 0, 0, 0); + f.Call(&test, 0, 0, 0, 0); CHECK_EQ(0, memcmp(&test.c, &outputsdmin[i], sizeof(test.c))); CHECK_EQ(0, memcmp(&test.d, &outputsdmax[i], sizeof(test.d))); @@ -1231,7 +1223,7 @@ TEST(min_max_nan) { template <typename IN_TYPE, typename Func> bool run_Unaligned(char* memory_buffer, int32_t in_offset, int32_t out_offset, IN_TYPE value, Func GenerateUnalignedInstructionFunc) { - typedef int32_t (*F_CVT)(char* x0, int x1, int x2, int x3, int x4); + typedef int32_t(F_CVT)(char* x0, int x1, int x2, int x3, int x4); Isolate* isolate = CcTest::i_isolate(); HandleScope scope(isolate); @@ -1249,10 +1241,10 @@ bool run_Unaligned(char* memory_buffer, int32_t in_offset, int32_t out_offset, Handle<Code> code = isolate->factory()->NewCode(desc, Code::STUB, Handle<Code>()); - F_CVT f = FUNCTION_CAST<F_CVT>(code->entry()); + auto f = GeneratedCode<F_CVT>::FromCode(*code); MemCopy(memory_buffer + in_offset, &value, sizeof(IN_TYPE)); - CALL_GENERATED_CODE(isolate, f, memory_buffer, 0, 0, 0, 0); + f.Call(memory_buffer, 0, 0, 0, 0); MemCopy(&res, memory_buffer + out_offset, sizeof(IN_TYPE)); return res == value; @@ -1260,8 +1252,8 @@ bool run_Unaligned(char* memory_buffer, int32_t in_offset, int32_t out_offset, static const std::vector<uint64_t> unsigned_test_values() { static const uint64_t kValues[] = { - 0x2180f18a06384414, 0x000a714532102277, 0xbc1acccf180649f0, - 0x8000000080008000, 0x0000000000000001, 0xffffffffffffffff, + 0x2180F18A06384414, 0x000A714532102277, 0xBC1ACCCF180649F0, + 0x8000000080008000, 0x0000000000000001, 0xFFFFFFFFFFFFFFFF, }; return std::vector<uint64_t>(&kValues[0], &kValues[arraysize(kValues)]); } @@ -1579,25 +1571,25 @@ static const std::vector<uint64_t> sltu_test_values() { static const uint64_t kValues[] = { 0, 1, - 0x7ffe, - 0x7fff, + 0x7FFE, + 0x7FFF, 0x8000, 0x8001, - 0xfffe, - 0xffff, - 0xffffffffffff7ffe, - 0xffffffffffff7fff, - 0xffffffffffff8000, - 0xffffffffffff8001, - 0xfffffffffffffffe, - 0xffffffffffffffff, + 0xFFFE, + 0xFFFF, + 0xFFFFFFFFFFFF7FFE, + 0xFFFFFFFFFFFF7FFF, + 0xFFFFFFFFFFFF8000, + 0xFFFFFFFFFFFF8001, + 0xFFFFFFFFFFFFFFFE, + 0xFFFFFFFFFFFFFFFF, }; return std::vector<uint64_t>(&kValues[0], &kValues[arraysize(kValues)]); } template <typename Func> bool run_Sltu(uint64_t rs, uint64_t rd, Func GenerateSltuInstructionFunc) { - typedef int64_t (*F_CVT)(uint64_t x0, uint64_t x1, int x2, int x3, int x4); + typedef int64_t(F_CVT)(uint64_t x0, uint64_t x1, int x2, int x3, int x4); Isolate* isolate = CcTest::i_isolate(); HandleScope scope(isolate); @@ -1614,9 +1606,8 @@ bool run_Sltu(uint64_t rs, uint64_t rd, Func GenerateSltuInstructionFunc) { Handle<Code> code = isolate->factory()->NewCode(desc, Code::STUB, Handle<Code>()); - F_CVT f = FUNCTION_CAST<F_CVT>(code->entry()); - int64_t res = reinterpret_cast<int64_t>( - CALL_GENERATED_CODE(isolate, f, rs, rd, 0, 0, 0)); + auto f = GeneratedCode<F_CVT>::FromCode(*code); + int64_t res = reinterpret_cast<int64_t>(f.Call(rs, rd, 0, 0, 0)); return res == 1; } @@ -1642,7 +1633,7 @@ TEST(Sltu) { } template <typename T, typename Inputs, typename Results> -static F4 GenerateMacroFloat32MinMax(MacroAssembler* masm) { +static GeneratedCode<F4> GenerateMacroFloat32MinMax(MacroAssembler* masm) { T a = T::from_code(4); // f4 T b = T::from_code(6); // f6 T c = T::from_code(8); // f8 @@ -1712,7 +1703,7 @@ static F4 GenerateMacroFloat32MinMax(MacroAssembler* masm) { OFStream os(stdout); code->Print(os); #endif - return FUNCTION_CAST<F4>(code->entry()); + return GeneratedCode<F4>::FromCode(*code); } TEST(macro_float_minmax_f32) { @@ -1741,15 +1732,14 @@ TEST(macro_float_minmax_f32) { float max_aba_; }; - F4 f = GenerateMacroFloat32MinMax<FPURegister, Inputs, Results>(masm); - Object* dummy = nullptr; - USE(dummy); + GeneratedCode<F4> f = + GenerateMacroFloat32MinMax<FPURegister, Inputs, Results>(masm); #define CHECK_MINMAX(src1, src2, min, max) \ do { \ Inputs inputs = {src1, src2}; \ Results results; \ - dummy = CALL_GENERATED_CODE(isolate, f, &inputs, &results, 0, 0, 0); \ + f.Call(&inputs, &results, 0, 0, 0); \ CHECK_EQ(bit_cast<uint32_t>(min), bit_cast<uint32_t>(results.min_abc_)); \ CHECK_EQ(bit_cast<uint32_t>(min), bit_cast<uint32_t>(results.min_aab_)); \ CHECK_EQ(bit_cast<uint32_t>(min), bit_cast<uint32_t>(results.min_aba_)); \ @@ -1785,7 +1775,7 @@ TEST(macro_float_minmax_f32) { } template <typename T, typename Inputs, typename Results> -static F4 GenerateMacroFloat64MinMax(MacroAssembler* masm) { +static GeneratedCode<F4> GenerateMacroFloat64MinMax(MacroAssembler* masm) { T a = T::from_code(4); // f4 T b = T::from_code(6); // f6 T c = T::from_code(8); // f8 @@ -1855,7 +1845,7 @@ static F4 GenerateMacroFloat64MinMax(MacroAssembler* masm) { OFStream os(stdout); code->Print(os); #endif - return FUNCTION_CAST<F4>(code->entry()); + return GeneratedCode<F4>::FromCode(*code); } TEST(macro_float_minmax_f64) { @@ -1884,15 +1874,14 @@ TEST(macro_float_minmax_f64) { double max_aba_; }; - F4 f = GenerateMacroFloat64MinMax<DoubleRegister, Inputs, Results>(masm); - Object* dummy = nullptr; - USE(dummy); + GeneratedCode<F4> f = + GenerateMacroFloat64MinMax<DoubleRegister, Inputs, Results>(masm); #define CHECK_MINMAX(src1, src2, min, max) \ do { \ Inputs inputs = {src1, src2}; \ Results results; \ - dummy = CALL_GENERATED_CODE(isolate, f, &inputs, &results, 0, 0, 0); \ + f.Call(&inputs, &results, 0, 0, 0); \ CHECK_EQ(bit_cast<uint64_t>(min), bit_cast<uint64_t>(results.min_abc_)); \ CHECK_EQ(bit_cast<uint64_t>(min), bit_cast<uint64_t>(results.min_aab_)); \ CHECK_EQ(bit_cast<uint64_t>(min), bit_cast<uint64_t>(results.min_aba_)); \ diff --git a/deps/v8/test/cctest/test-macro-assembler-x64.cc b/deps/v8/test/cctest/test-macro-assembler-x64.cc index 5d94412d9b..6ace37c8b4 100644 --- a/deps/v8/test/cctest/test-macro-assembler-x64.cc +++ b/deps/v8/test/cctest/test-macro-assembler-x64.cc @@ -127,6 +127,7 @@ TEST(SmiMove) { CodeDesc desc; masm->GetCode(isolate, &desc); + MakeAssemblerBufferExecutable(buffer, allocated); // Call the function from C++. int result = FUNCTION_CAST<F0>(buffer)(); CHECK_EQ(0, result); @@ -218,6 +219,7 @@ TEST(SmiCompare) { CodeDesc desc; masm->GetCode(isolate, &desc); + MakeAssemblerBufferExecutable(buffer, allocated); // Call the function from C++. int result = FUNCTION_CAST<F0>(buffer)(); CHECK_EQ(0, result); @@ -317,6 +319,7 @@ TEST(Integer32ToSmi) { CodeDesc desc; masm->GetCode(isolate, &desc); + MakeAssemblerBufferExecutable(buffer, allocated); // Call the function from C++. int result = FUNCTION_CAST<F0>(buffer)(); CHECK_EQ(0, result); @@ -391,6 +394,7 @@ TEST(SmiCheck) { CodeDesc desc; masm->GetCode(isolate, &desc); + MakeAssemblerBufferExecutable(buffer, allocated); // Call the function from C++. int result = FUNCTION_CAST<F0>(buffer)(); CHECK_EQ(0, result); @@ -444,6 +448,7 @@ TEST(SmiIndex) { CodeDesc desc; masm->GetCode(isolate, &desc); + MakeAssemblerBufferExecutable(buffer, allocated); // Call the function from C++. int result = FUNCTION_CAST<F0>(buffer)(); CHECK_EQ(0, result); @@ -794,6 +799,7 @@ TEST(OperandOffset) { CodeDesc desc; masm->GetCode(isolate, &desc); + MakeAssemblerBufferExecutable(buffer, allocated); // Call the function from C++. int result = FUNCTION_CAST<F0>(buffer)(); CHECK_EQ(0, result); @@ -829,10 +835,10 @@ TEST(LoadAndStoreWithRepresentation) { // Test 2. __ movq(rax, Immediate(2)); // Test number. __ movq(Operand(rsp, 0 * kPointerSize), Immediate(0)); - __ Set(rcx, V8_2PART_UINT64_C(0xdeadbeaf, 12345678)); + __ Set(rcx, V8_2PART_UINT64_C(0xDEADBEAF, 12345678)); __ Store(Operand(rsp, 0 * kPointerSize), rcx, Representation::Smi()); __ movq(rcx, Operand(rsp, 0 * kPointerSize)); - __ Set(rdx, V8_2PART_UINT64_C(0xdeadbeaf, 12345678)); + __ Set(rdx, V8_2PART_UINT64_C(0xDEADBEAF, 12345678)); __ cmpq(rcx, rdx); __ j(not_equal, &exit); __ Load(rdx, Operand(rsp, 0 * kPointerSize), Representation::Smi()); @@ -868,10 +874,10 @@ TEST(LoadAndStoreWithRepresentation) { // Test 5. __ movq(rax, Immediate(5)); // Test number. __ movq(Operand(rsp, 0 * kPointerSize), Immediate(0)); - __ Set(rcx, V8_2PART_UINT64_C(0x12345678, deadbeaf)); + __ Set(rcx, V8_2PART_UINT64_C(0x12345678, DEADBEAF)); __ Store(Operand(rsp, 0 * kPointerSize), rcx, Representation::Tagged()); __ movq(rcx, Operand(rsp, 0 * kPointerSize)); - __ Set(rdx, V8_2PART_UINT64_C(0x12345678, deadbeaf)); + __ Set(rdx, V8_2PART_UINT64_C(0x12345678, DEADBEAF)); __ cmpq(rcx, rdx); __ j(not_equal, &exit); __ Load(rdx, Operand(rsp, 0 * kPointerSize), Representation::Tagged()); @@ -940,6 +946,7 @@ TEST(LoadAndStoreWithRepresentation) { CodeDesc desc; masm->GetCode(isolate, &desc); + MakeAssemblerBufferExecutable(buffer, allocated); // Call the function from C++. int result = FUNCTION_CAST<F0>(buffer)(); CHECK_EQ(0, result); @@ -1092,6 +1099,7 @@ TEST(SIMDMacros) { CodeDesc desc; masm->GetCode(isolate, &desc); + MakeAssemblerBufferExecutable(buffer, allocated); // Call the function from C++. int result = FUNCTION_CAST<F0>(buffer)(); CHECK_EQ(0, result); diff --git a/deps/v8/test/cctest/test-modules.cc b/deps/v8/test/cctest/test-modules.cc index b61b10bcea..2523b83a16 100644 --- a/deps/v8/test/cctest/test-modules.cc +++ b/deps/v8/test/cctest/test-modules.cc @@ -27,87 +27,166 @@ ScriptOrigin ModuleOrigin(Local<v8::Value> resource_name, Isolate* isolate) { return origin; } -MaybeLocal<Module> FailAlwaysResolveCallback(Local<Context> context, - Local<String> specifier, - Local<Module> referrer) { - Isolate* isolate = context->GetIsolate(); - isolate->ThrowException(v8_str("boom")); - return MaybeLocal<Module>(); -} - -static int g_count = 0; -MaybeLocal<Module> FailOnSecondCallResolveCallback(Local<Context> context, - Local<String> specifier, - Local<Module> referrer) { +static Local<Module> dep1; +static Local<Module> dep2; +MaybeLocal<Module> ResolveCallback(Local<Context> context, + Local<String> specifier, + Local<Module> referrer) { Isolate* isolate = CcTest::isolate(); - if (g_count++ > 0) { - isolate->ThrowException(v8_str("booom")); + if (specifier->StrictEquals(v8_str("./dep1.js"))) { + return dep1; + } else if (specifier->StrictEquals(v8_str("./dep2.js"))) { + return dep2; + } else { + isolate->ThrowException(v8_str("boom")); return MaybeLocal<Module>(); } - Local<String> source_text = v8_str(""); - ScriptOrigin origin = ModuleOrigin(v8_str("module.js"), isolate); - ScriptCompiler::Source source(source_text, origin); - return ScriptCompiler::CompileModule(isolate, &source).ToLocalChecked(); } -TEST(ModuleInstantiationFailures) { +TEST(ModuleInstantiationFailures1) { Isolate* isolate = CcTest::isolate(); HandleScope scope(isolate); LocalContext env; v8::TryCatch try_catch(isolate); - Local<String> source_text = v8_str( - "import './foo.js';\n" - "export {} from './bar.js';"); - ScriptOrigin origin = ModuleOrigin(v8_str("file.js"), CcTest::isolate()); - ScriptCompiler::Source source(source_text, origin); - Local<Module> module = - ScriptCompiler::CompileModule(isolate, &source).ToLocalChecked(); - CHECK_EQ(Module::kUninstantiated, module->GetStatus()); - CHECK_EQ(2, module->GetModuleRequestsLength()); - CHECK(v8_str("./foo.js")->StrictEquals(module->GetModuleRequest(0))); - v8::Location loc = module->GetModuleRequestLocation(0); - CHECK_EQ(0, loc.GetLineNumber()); - CHECK_EQ(7, loc.GetColumnNumber()); - - CHECK(v8_str("./bar.js")->StrictEquals(module->GetModuleRequest(1))); - loc = module->GetModuleRequestLocation(1); - CHECK_EQ(1, loc.GetLineNumber()); - CHECK_EQ(15, loc.GetColumnNumber()); + Local<Module> module; + { + Local<String> source_text = v8_str( + "import './foo.js';\n" + "export {} from './bar.js';"); + ScriptOrigin origin = ModuleOrigin(v8_str("file.js"), CcTest::isolate()); + ScriptCompiler::Source source(source_text, origin); + module = ScriptCompiler::CompileModule(isolate, &source).ToLocalChecked(); + CHECK_EQ(Module::kUninstantiated, module->GetStatus()); + CHECK_EQ(2, module->GetModuleRequestsLength()); + CHECK(v8_str("./foo.js")->StrictEquals(module->GetModuleRequest(0))); + v8::Location loc = module->GetModuleRequestLocation(0); + CHECK_EQ(0, loc.GetLineNumber()); + CHECK_EQ(7, loc.GetColumnNumber()); + CHECK(v8_str("./bar.js")->StrictEquals(module->GetModuleRequest(1))); + loc = module->GetModuleRequestLocation(1); + CHECK_EQ(1, loc.GetLineNumber()); + CHECK_EQ(15, loc.GetColumnNumber()); + } // Instantiation should fail. { v8::TryCatch inner_try_catch(isolate); - CHECK(module->InstantiateModule(env.local(), FailAlwaysResolveCallback) - .IsNothing()); + CHECK(module->InstantiateModule(env.local(), ResolveCallback).IsNothing()); CHECK(inner_try_catch.HasCaught()); CHECK(inner_try_catch.Exception()->StrictEquals(v8_str("boom"))); - CHECK_EQ(Module::kErrored, module->GetStatus()); - Local<Value> exception = module->GetException(); - CHECK(exception->StrictEquals(v8_str("boom"))); - // TODO(neis): Check object identity. + CHECK_EQ(Module::kUninstantiated, module->GetStatus()); } // Start over again... - module = ScriptCompiler::CompileModule(isolate, &source).ToLocalChecked(); + { + Local<String> source_text = v8_str( + "import './dep1.js';\n" + "export {} from './bar.js';"); + ScriptOrigin origin = ModuleOrigin(v8_str("file.js"), CcTest::isolate()); + ScriptCompiler::Source source(source_text, origin); + module = ScriptCompiler::CompileModule(isolate, &source).ToLocalChecked(); + } + + // dep1.js + { + Local<String> source_text = v8_str(""); + ScriptOrigin origin = ModuleOrigin(v8_str("dep1.js"), CcTest::isolate()); + ScriptCompiler::Source source(source_text, origin); + dep1 = ScriptCompiler::CompileModule(isolate, &source).ToLocalChecked(); + } - // Instantiation should fail if a sub-module fails to resolve. - g_count = 0; + // Instantiation should fail because a sub-module fails to resolve. { v8::TryCatch inner_try_catch(isolate); - CHECK( - module->InstantiateModule(env.local(), FailOnSecondCallResolveCallback) - .IsNothing()); + CHECK(module->InstantiateModule(env.local(), ResolveCallback).IsNothing()); CHECK(inner_try_catch.HasCaught()); - CHECK(inner_try_catch.Exception()->StrictEquals(v8_str("booom"))); - CHECK_EQ(Module::kErrored, module->GetStatus()); - Local<Value> exception = module->GetException(); - CHECK(exception->StrictEquals(v8_str("booom"))); + CHECK(inner_try_catch.Exception()->StrictEquals(v8_str("boom"))); + CHECK_EQ(Module::kUninstantiated, module->GetStatus()); } CHECK(!try_catch.HasCaught()); } +TEST(ModuleInstantiationFailures2) { + Isolate* isolate = CcTest::isolate(); + HandleScope scope(isolate); + LocalContext env; + v8::TryCatch try_catch(isolate); + + // root1.js + Local<Module> root; + { + Local<String> source_text = + v8_str("import './dep1.js'; import './dep2.js'"); + ScriptOrigin origin = ModuleOrigin(v8_str("root1.js"), CcTest::isolate()); + ScriptCompiler::Source source(source_text, origin); + root = ScriptCompiler::CompileModule(isolate, &source).ToLocalChecked(); + } + + // dep1.js + { + Local<String> source_text = v8_str("export let x = 42"); + ScriptOrigin origin = ModuleOrigin(v8_str("dep1.js"), CcTest::isolate()); + ScriptCompiler::Source source(source_text, origin); + dep1 = ScriptCompiler::CompileModule(isolate, &source).ToLocalChecked(); + } + + // dep2.js + { + Local<String> source_text = v8_str("import {foo} from './dep3.js'"); + ScriptOrigin origin = ModuleOrigin(v8_str("dep2.js"), CcTest::isolate()); + ScriptCompiler::Source source(source_text, origin); + dep2 = ScriptCompiler::CompileModule(isolate, &source).ToLocalChecked(); + } + + { + v8::TryCatch inner_try_catch(isolate); + CHECK(root->InstantiateModule(env.local(), ResolveCallback).IsNothing()); + CHECK(inner_try_catch.HasCaught()); + CHECK(inner_try_catch.Exception()->StrictEquals(v8_str("boom"))); + CHECK_EQ(Module::kUninstantiated, root->GetStatus()); + CHECK_EQ(Module::kUninstantiated, dep1->GetStatus()); + CHECK_EQ(Module::kUninstantiated, dep2->GetStatus()); + } + + // Change dep2.js + { + Local<String> source_text = v8_str("import {foo} from './dep2.js'"); + ScriptOrigin origin = ModuleOrigin(v8_str("dep2.js"), CcTest::isolate()); + ScriptCompiler::Source source(source_text, origin); + dep2 = ScriptCompiler::CompileModule(isolate, &source).ToLocalChecked(); + } + + { + v8::TryCatch inner_try_catch(isolate); + CHECK(root->InstantiateModule(env.local(), ResolveCallback).IsNothing()); + CHECK(inner_try_catch.HasCaught()); + CHECK(!inner_try_catch.Exception()->StrictEquals(v8_str("boom"))); + CHECK_EQ(Module::kUninstantiated, root->GetStatus()); + CHECK_EQ(Module::kInstantiated, dep1->GetStatus()); + CHECK_EQ(Module::kUninstantiated, dep2->GetStatus()); + } + + // Change dep2.js again + { + Local<String> source_text = v8_str("import {foo} from './dep3.js'"); + ScriptOrigin origin = ModuleOrigin(v8_str("dep2.js"), CcTest::isolate()); + ScriptCompiler::Source source(source_text, origin); + dep2 = ScriptCompiler::CompileModule(isolate, &source).ToLocalChecked(); + } + + { + v8::TryCatch inner_try_catch(isolate); + CHECK(root->InstantiateModule(env.local(), ResolveCallback).IsNothing()); + CHECK(inner_try_catch.HasCaught()); + CHECK(inner_try_catch.Exception()->StrictEquals(v8_str("boom"))); + CHECK_EQ(Module::kUninstantiated, root->GetStatus()); + CHECK_EQ(Module::kInstantiated, dep1->GetStatus()); + CHECK_EQ(Module::kUninstantiated, dep2->GetStatus()); + } +} + static MaybeLocal<Module> CompileSpecifierAsModuleResolveCallback( Local<Context> context, Local<String> specifier, Local<Module> referrer) { ScriptOrigin origin = ModuleOrigin(v8_str("module.js"), CcTest::isolate()); diff --git a/deps/v8/test/cctest/test-parsing.cc b/deps/v8/test/cctest/test-parsing.cc index 0ecdbf2dd6..52a7d3ff7a 100644 --- a/deps/v8/test/cctest/test-parsing.cc +++ b/deps/v8/test/cctest/test-parsing.cc @@ -93,7 +93,7 @@ TEST(ScanKeywords) { CHECK(static_cast<int>(sizeof(buffer)) >= length); { auto stream = i::ScannerStream::ForTesting(keyword, length); - i::Scanner scanner(&unicode_cache, global_use_counts); + i::Scanner scanner(&unicode_cache); scanner.Initialize(stream.get(), false); CHECK_EQ(key_token.token, scanner.Next()); CHECK_EQ(i::Token::EOS, scanner.Next()); @@ -101,7 +101,7 @@ TEST(ScanKeywords) { // Removing characters will make keyword matching fail. { auto stream = i::ScannerStream::ForTesting(keyword, length - 1); - i::Scanner scanner(&unicode_cache, global_use_counts); + i::Scanner scanner(&unicode_cache); scanner.Initialize(stream.get(), false); CHECK_EQ(i::Token::IDENTIFIER, scanner.Next()); CHECK_EQ(i::Token::EOS, scanner.Next()); @@ -112,7 +112,7 @@ TEST(ScanKeywords) { i::MemMove(buffer, keyword, length); buffer[length] = chars_to_append[j]; auto stream = i::ScannerStream::ForTesting(buffer, length + 1); - i::Scanner scanner(&unicode_cache, global_use_counts); + i::Scanner scanner(&unicode_cache); scanner.Initialize(stream.get(), false); CHECK_EQ(i::Token::IDENTIFIER, scanner.Next()); CHECK_EQ(i::Token::EOS, scanner.Next()); @@ -122,7 +122,7 @@ TEST(ScanKeywords) { i::MemMove(buffer, keyword, length); buffer[length - 1] = '_'; auto stream = i::ScannerStream::ForTesting(buffer, length); - i::Scanner scanner(&unicode_cache, global_use_counts); + i::Scanner scanner(&unicode_cache); scanner.Initialize(stream.get(), false); CHECK_EQ(i::Token::IDENTIFIER, scanner.Next()); CHECK_EQ(i::Token::EOS, scanner.Next()); @@ -189,7 +189,7 @@ TEST(ScanHTMLEndComments) { for (int i = 0; tests[i]; i++) { const char* source = tests[i]; auto stream = i::ScannerStream::ForTesting(source); - i::Scanner scanner(i_isolate->unicode_cache(), global_use_counts); + i::Scanner scanner(i_isolate->unicode_cache()); scanner.Initialize(stream.get(), false); i::Zone zone(i_isolate->allocator(), ZONE_NAME); i::AstValueFactory ast_value_factory(&zone, @@ -208,7 +208,7 @@ TEST(ScanHTMLEndComments) { for (int i = 0; fail_tests[i]; i++) { const char* source = fail_tests[i]; auto stream = i::ScannerStream::ForTesting(source); - i::Scanner scanner(i_isolate->unicode_cache(), global_use_counts); + i::Scanner scanner(i_isolate->unicode_cache()); scanner.Initialize(stream.get(), false); i::Zone zone(i_isolate->allocator(), ZONE_NAME); i::AstValueFactory ast_value_factory(&zone, @@ -233,7 +233,7 @@ TEST(ScanHtmlComments) { // Disallow HTML comments. { auto stream = i::ScannerStream::ForTesting(src); - i::Scanner scanner(&unicode_cache, global_use_counts); + i::Scanner scanner(&unicode_cache); scanner.Initialize(stream.get(), true); CHECK_EQ(i::Token::IDENTIFIER, scanner.Next()); CHECK_EQ(i::Token::ILLEGAL, scanner.Next()); @@ -242,7 +242,7 @@ TEST(ScanHtmlComments) { // Skip HTML comments: { auto stream = i::ScannerStream::ForTesting(src); - i::Scanner scanner(&unicode_cache, global_use_counts); + i::Scanner scanner(&unicode_cache); scanner.Initialize(stream.get(), false); CHECK_EQ(i::Token::IDENTIFIER, scanner.Next()); CHECK_EQ(i::Token::EOS, scanner.Next()); @@ -400,7 +400,7 @@ TEST(StandAlonePreParser) { uintptr_t stack_limit = i_isolate->stack_guard()->real_climit(); for (int i = 0; programs[i]; i++) { auto stream = i::ScannerStream::ForTesting(programs[i]); - i::Scanner scanner(i_isolate->unicode_cache(), global_use_counts); + i::Scanner scanner(i_isolate->unicode_cache()); scanner.Initialize(stream.get(), false); i::Zone zone(i_isolate->allocator(), ZONE_NAME); @@ -433,7 +433,7 @@ TEST(StandAlonePreParserNoNatives) { uintptr_t stack_limit = isolate->stack_guard()->real_climit(); for (int i = 0; programs[i]; i++) { auto stream = i::ScannerStream::ForTesting(programs[i]); - i::Scanner scanner(isolate->unicode_cache(), global_use_counts); + i::Scanner scanner(isolate->unicode_cache()); scanner.Initialize(stream.get(), false); // Preparser defaults to disallowing natives syntax. @@ -504,7 +504,7 @@ TEST(RegressChromium62639) { // failed in debug mode, and sometimes crashed in release mode. auto stream = i::ScannerStream::ForTesting(program); - i::Scanner scanner(CcTest::i_isolate()->unicode_cache(), global_use_counts); + i::Scanner scanner(CcTest::i_isolate()->unicode_cache()); scanner.Initialize(stream.get(), false); i::Zone zone(CcTest::i_isolate()->allocator(), ZONE_NAME); i::AstValueFactory ast_value_factory( @@ -579,7 +579,7 @@ TEST(PreParseOverflow) { uintptr_t stack_limit = isolate->stack_guard()->real_climit(); auto stream = i::ScannerStream::ForTesting(program.get(), kProgramSize); - i::Scanner scanner(isolate->unicode_cache(), global_use_counts); + i::Scanner scanner(isolate->unicode_cache()); scanner.Initialize(stream.get(), false); i::Zone zone(CcTest::i_isolate()->allocator(), ZONE_NAME); @@ -599,7 +599,7 @@ void TestStreamScanner(i::Utf16CharacterStream* stream, i::Token::Value* expected_tokens, int skip_pos = 0, // Zero means not skipping. int skip_to = 0) { - i::Scanner scanner(CcTest::i_isolate()->unicode_cache(), global_use_counts); + i::Scanner scanner(CcTest::i_isolate()->unicode_cache()); scanner.Initialize(stream, false); int i = 0; @@ -677,7 +677,7 @@ TEST(StreamScanner) { void TestScanRegExp(const char* re_source, const char* expected) { auto stream = i::ScannerStream::ForTesting(re_source); i::HandleScope scope(CcTest::i_isolate()); - i::Scanner scanner(CcTest::i_isolate()->unicode_cache(), global_use_counts); + i::Scanner scanner(CcTest::i_isolate()->unicode_cache()); scanner.Initialize(stream.get(), false); i::Token::Value start = scanner.peek(); @@ -1078,110 +1078,110 @@ TEST(ScopePositions) { // Check that 6-byte and 4-byte encodings of UTF-8 strings do not throw // the preparser off in terms of byte offsets. // 2 surrogates, encode a character that doesn't need a surrogate. - {" 'foo\355\240\201\355\260\211';\n" + {" 'foo\xED\xA0\x81\xED\xB0\x89';\n" " (function fun", "(a,b) { infunction; }", ")();", i::FUNCTION_SCOPE, i::LanguageMode::kSloppy}, - // 4 byte encoding. - {" 'foo\360\220\220\212';\n" + // 4-byte encoding. + {" 'foo\xF0\x90\x90\x8A';\n" " (function fun", "(a,b) { infunction; }", ")();", i::FUNCTION_SCOPE, i::LanguageMode::kSloppy}, - // 3 byte encoding of \u0fff. - {" 'foo\340\277\277';\n" + // 3-byte encoding of \u0FFF. + {" 'foo\xE0\xBF\xBF';\n" " (function fun", "(a,b) { infunction; }", ")();", i::FUNCTION_SCOPE, i::LanguageMode::kSloppy}, - // 3 byte surrogate, followed by broken 2-byte surrogate w/ impossible 2nd + // 3-byte surrogate, followed by broken 2-byte surrogate w/ impossible 2nd // byte and last byte missing. - {" 'foo\355\240\201\355\211';\n" + {" 'foo\xED\xA0\x81\xED\x89';\n" " (function fun", "(a,b) { infunction; }", ")();", i::FUNCTION_SCOPE, i::LanguageMode::kSloppy}, - // Broken 3 byte encoding of \u0fff with missing last byte. - {" 'foo\340\277';\n" + // Broken 3-byte encoding of \u0FFF with missing last byte. + {" 'foo\xE0\xBF';\n" " (function fun", "(a,b) { infunction; }", ")();", i::FUNCTION_SCOPE, i::LanguageMode::kSloppy}, - // Broken 3 byte encoding of \u0fff with missing 2 last bytes. - {" 'foo\340';\n" + // Broken 3-byte encoding of \u0FFF with missing 2 last bytes. + {" 'foo\xE0';\n" " (function fun", "(a,b) { infunction; }", ")();", i::FUNCTION_SCOPE, i::LanguageMode::kSloppy}, - // Broken 3 byte encoding of \u00ff should be a 2 byte encoding. - {" 'foo\340\203\277';\n" + // Broken 3-byte encoding of \u00FF should be a 2-byte encoding. + {" 'foo\xE0\x83\xBF';\n" " (function fun", "(a,b) { infunction; }", ")();", i::FUNCTION_SCOPE, i::LanguageMode::kSloppy}, - // Broken 3 byte encoding of \u007f should be a 2 byte encoding. - {" 'foo\340\201\277';\n" + // Broken 3-byte encoding of \u007F should be a 2-byte encoding. + {" 'foo\xE0\x81\xBF';\n" " (function fun", "(a,b) { infunction; }", ")();", i::FUNCTION_SCOPE, i::LanguageMode::kSloppy}, // Unpaired lead surrogate. - {" 'foo\355\240\201';\n" + {" 'foo\xED\xA0\x81';\n" " (function fun", "(a,b) { infunction; }", ")();", i::FUNCTION_SCOPE, i::LanguageMode::kSloppy}, - // Unpaired lead surrogate where following code point is a 3 byte + // Unpaired lead surrogate where the following code point is a 3-byte // sequence. - {" 'foo\355\240\201\340\277\277';\n" + {" 'foo\xED\xA0\x81\xE0\xBF\xBF';\n" " (function fun", "(a,b) { infunction; }", ")();", i::FUNCTION_SCOPE, i::LanguageMode::kSloppy}, - // Unpaired lead surrogate where following code point is a 4 byte encoding - // of a trail surrogate. - {" 'foo\355\240\201\360\215\260\211';\n" + // Unpaired lead surrogate where the following code point is a 4-byte + // encoding of a trail surrogate. + {" 'foo\xED\xA0\x81\xF0\x8D\xB0\x89';\n" " (function fun", "(a,b) { infunction; }", ")();", i::FUNCTION_SCOPE, i::LanguageMode::kSloppy}, // Unpaired trail surrogate. - {" 'foo\355\260\211';\n" + {" 'foo\xED\xB0\x89';\n" " (function fun", "(a,b) { infunction; }", ")();", i::FUNCTION_SCOPE, i::LanguageMode::kSloppy}, - // 2 byte encoding of \u00ff. - {" 'foo\303\277';\n" + // 2-byte encoding of \u00FF. + {" 'foo\xC3\xBF';\n" " (function fun", "(a,b) { infunction; }", ")();", i::FUNCTION_SCOPE, i::LanguageMode::kSloppy}, - // Broken 2 byte encoding of \u00ff with missing last byte. - {" 'foo\303';\n" + // Broken 2-byte encoding of \u00FF with missing last byte. + {" 'foo\xC3';\n" " (function fun", "(a,b) { infunction; }", ")();", i::FUNCTION_SCOPE, i::LanguageMode::kSloppy}, - // Broken 2 byte encoding of \u007f should be a 1 byte encoding. - {" 'foo\301\277';\n" + // Broken 2-byte encoding of \u007F should be a 1-byte encoding. + {" 'foo\xC1\xBF';\n" " (function fun", "(a,b) { infunction; }", ")();", i::FUNCTION_SCOPE, i::LanguageMode::kSloppy}, - // Illegal 5 byte encoding. - {" 'foo\370\277\277\277\277';\n" + // Illegal 5-byte encoding. + {" 'foo\xF8\xBF\xBF\xBF\xBF';\n" " (function fun", "(a,b) { infunction; }", ")();", i::FUNCTION_SCOPE, i::LanguageMode::kSloppy}, - // Illegal 6 byte encoding. - {" 'foo\374\277\277\277\277\277';\n" + // Illegal 6-byte encoding. + {" 'foo\xFC\xBF\xBF\xBF\xBF\xBF';\n" " (function fun", "(a,b) { infunction; }", ")();", i::FUNCTION_SCOPE, i::LanguageMode::kSloppy}, - // Illegal 0xfe byte - {" 'foo\376\277\277\277\277\277\277';\n" + // Illegal 0xFE byte + {" 'foo\xFE\xBF\xBF\xBF\xBF\xBF\xBF';\n" " (function fun", "(a,b) { infunction; }", ")();", i::FUNCTION_SCOPE, i::LanguageMode::kSloppy}, - // Illegal 0xff byte - {" 'foo\377\277\277\277\277\277\277\277';\n" + // Illegal 0xFF byte + {" 'foo\xFF\xBF\xBF\xBF\xBF\xBF\xBF\xBF';\n" " (function fun", "(a,b) { infunction; }", ")();", i::FUNCTION_SCOPE, i::LanguageMode::kSloppy}, {" 'foo';\n" " (function fun", - "(a,b) { 'bar\355\240\201\355\260\213'; }", ")();", i::FUNCTION_SCOPE, + "(a,b) { 'bar\xED\xA0\x81\xED\xB0\x8B'; }", ")();", i::FUNCTION_SCOPE, i::LanguageMode::kSloppy}, {" 'foo';\n" " (function fun", - "(a,b) { 'bar\360\220\220\214'; }", ")();", i::FUNCTION_SCOPE, + "(a,b) { 'bar\xF0\x90\x90\x8C'; }", ")();", i::FUNCTION_SCOPE, i::LanguageMode::kSloppy}, {nullptr, nullptr, nullptr, i::EVAL_SCOPE, i::LanguageMode::kSloppy}}; @@ -1315,9 +1315,12 @@ enum ParserFlag { kAllowNatives, kAllowHarmonyFunctionSent, kAllowHarmonyPublicFields, + kAllowHarmonyPrivateFields, + kAllowHarmonyStaticFields, kAllowHarmonyDynamicImport, - kAllowHarmonyAsyncIteration, kAllowHarmonyImportMeta, + kAllowHarmonyDoExpressions, + kAllowHarmonyOptionalCatchBinding, }; enum ParserSyncTestResult { @@ -1330,9 +1333,13 @@ void SetGlobalFlags(i::EnumSet<ParserFlag> flags) { i::FLAG_allow_natives_syntax = flags.Contains(kAllowNatives); i::FLAG_harmony_function_sent = flags.Contains(kAllowHarmonyFunctionSent); i::FLAG_harmony_public_fields = flags.Contains(kAllowHarmonyPublicFields); + i::FLAG_harmony_private_fields = flags.Contains(kAllowHarmonyPrivateFields); + i::FLAG_harmony_static_fields = flags.Contains(kAllowHarmonyStaticFields); i::FLAG_harmony_dynamic_import = flags.Contains(kAllowHarmonyDynamicImport); i::FLAG_harmony_import_meta = flags.Contains(kAllowHarmonyImportMeta); - i::FLAG_harmony_async_iteration = flags.Contains(kAllowHarmonyAsyncIteration); + i::FLAG_harmony_do_expressions = flags.Contains(kAllowHarmonyDoExpressions); + i::FLAG_harmony_optional_catch_binding = + flags.Contains(kAllowHarmonyOptionalCatchBinding); } void SetParserFlags(i::PreParser* parser, i::EnumSet<ParserFlag> flags) { @@ -1341,12 +1348,18 @@ void SetParserFlags(i::PreParser* parser, i::EnumSet<ParserFlag> flags) { flags.Contains(kAllowHarmonyFunctionSent)); parser->set_allow_harmony_public_fields( flags.Contains(kAllowHarmonyPublicFields)); + parser->set_allow_harmony_private_fields( + flags.Contains(kAllowHarmonyPrivateFields)); + parser->set_allow_harmony_static_fields( + flags.Contains(kAllowHarmonyStaticFields)); parser->set_allow_harmony_dynamic_import( flags.Contains(kAllowHarmonyDynamicImport)); parser->set_allow_harmony_import_meta( flags.Contains(kAllowHarmonyImportMeta)); - parser->set_allow_harmony_async_iteration( - flags.Contains(kAllowHarmonyAsyncIteration)); + parser->set_allow_harmony_do_expressions( + flags.Contains(kAllowHarmonyDoExpressions)); + parser->set_allow_harmony_optional_catch_binding( + flags.Contains(kAllowHarmonyOptionalCatchBinding)); } void TestParserSyncWithFlags(i::Handle<i::String> source, @@ -1362,7 +1375,7 @@ void TestParserSyncWithFlags(i::Handle<i::String> source, // Preparse the data. i::PendingCompilationErrorHandler pending_error_handler; if (test_preparser) { - i::Scanner scanner(isolate->unicode_cache(), global_use_counts); + i::Scanner scanner(isolate->unicode_cache()); std::unique_ptr<i::Utf16CharacterStream> stream( i::ScannerStream::For(source)); i::Zone zone(CcTest::i_isolate()->allocator(), ZONE_NAME); @@ -1403,32 +1416,30 @@ void TestParserSyncWithFlags(i::Handle<i::String> source, isolate->clear_pending_exception(); if (result == kSuccess) { - v8::base::OS::Print( + FATAL( "Parser failed on:\n" "\t%s\n" "with error:\n" "\t%s\n" "However, we expected no error.", source->ToCString().get(), message_string->ToCString().get()); - CHECK(false); } if (test_preparser && !pending_error_handler.has_pending_error()) { - v8::base::OS::Print( + FATAL( "Parser failed on:\n" "\t%s\n" "with error:\n" "\t%s\n" "However, the preparser succeeded", source->ToCString().get(), message_string->ToCString().get()); - CHECK(false); } // Check that preparser and parser produce the same error. if (test_preparser && !ignore_error_msg) { i::Handle<i::String> preparser_message = pending_error_handler.FormatErrorMessageForTest(CcTest::i_isolate()); if (!i::String::Equals(message_string, preparser_message)) { - v8::base::OS::Print( + FATAL( "Expected parser and preparser to produce the same error on:\n" "\t%s\n" "However, found the following error messages\n" @@ -1436,11 +1447,10 @@ void TestParserSyncWithFlags(i::Handle<i::String> source, "\tpreparser: %s\n", source->ToCString().get(), message_string->ToCString().get(), preparser_message->ToCString().get()); - CHECK(false); } } } else if (test_preparser && pending_error_handler.has_pending_error()) { - v8::base::OS::Print( + FATAL( "Preparser failed on:\n" "\t%s\n" "with error:\n" @@ -1450,14 +1460,12 @@ void TestParserSyncWithFlags(i::Handle<i::String> source, pending_error_handler.FormatErrorMessageForTest(CcTest::i_isolate()) ->ToCString() .get()); - CHECK(false); } else if (result == kError) { - v8::base::OS::Print( + FATAL( "Expected error on:\n" "\t%s\n" "However, parser and preparser succeeded", source->ToCString().get()); - CHECK(false); } } @@ -2387,12 +2395,11 @@ TEST(DontRegressPreParserDataSizes) { i::ParseData* pd = i::ParseData::FromCachedData(sd); if (pd->FunctionCount() != test_cases[i].functions) { - v8::base::OS::Print( + FATAL( "Expected preparse data for program:\n" "\t%s\n" "to contain %d functions, however, received %d functions.\n", program, test_cases[i].functions, pd->FunctionCount()); - CHECK(false); } delete sd; delete pd; @@ -2450,6 +2457,66 @@ TEST(NoErrorsTryCatchFinally) { RunParserSyncTest(context_data, statement_data, kSuccess); } +TEST(OptionalCatchBinding) { + // clang-format off + const char* context_data[][2] = { + {"", ""}, + {"'use strict';", ""}, + {"try {", "} catch (e) { }"}, + {"try {} catch (e) {", "}"}, + {"try {", "} catch ({e}) { }"}, + {"try {} catch ({e}) {", "}"}, + {"function f() {", "}"}, + { NULL, NULL } + }; + + const char* statement_data[] = { + "try { } catch { }", + "try { } catch { } finally { }", + "try { let e; } catch { let e; }", + "try { let e; } catch { let e; } finally { let e; }", + NULL + }; + // clang-format on + + // No error with flag + static const ParserFlag flags[] = {kAllowHarmonyOptionalCatchBinding}; + RunParserSyncTest(context_data, statement_data, kSuccess, NULL, 0, flags, + arraysize(flags)); + + // Still an error without flag + RunParserSyncTest(context_data, statement_data, kError); +} + +TEST(OptionalCatchBindingInDoExpression) { + // This is an edge case no otherwise hit: a catch scope in a parameter + // expression which needs its own scope. + // clang-format off + const char* context_data[][2] = { + {"((x = (eval(''), do {", "}))=>{})()"}, + { NULL, NULL } + }; + + const char* statement_data[] = { + "try { } catch { }", + "try { } catch { } finally { }", + "try { let e; } catch { let e; }", + "try { let e; } catch { let e; } finally { let e; }", + NULL + }; + // clang-format on + + // No error with flag + static const ParserFlag do_and_catch_flags[] = { + kAllowHarmonyDoExpressions, kAllowHarmonyOptionalCatchBinding}; + RunParserSyncTest(context_data, statement_data, kSuccess, NULL, 0, + do_and_catch_flags, arraysize(do_and_catch_flags)); + + // Still an error without flag + static const ParserFlag do_flag[] = {kAllowHarmonyDoExpressions}; + RunParserSyncTest(context_data, statement_data, kError, NULL, 0, do_flag, + arraysize(do_flag)); +} TEST(ErrorsRegexpLiteral) { const char* context_data[][2] = {{"var r = ", ""}, {nullptr, nullptr}}; @@ -2566,7 +2633,6 @@ TEST(ErrorsObjectLiteralChecking) { "static async get x : 0", "async static x(){}", "*async x(){}", - "async *x(){}", "async x*(){}", "async x : 0", "async 0 : 0", @@ -2869,7 +2935,7 @@ TEST(FuncNameInferrerTwoByte) { "%FunctionGetInferredName(obj1.oXj2.foo1)"); uint16_t* two_byte_name = AsciiToTwoByteString("obj1.oXj2.foo1"); // Make it really non-Latin1 (replace the Xs with a non-Latin1 character). - two_byte_source[14] = two_byte_source[78] = two_byte_name[6] = 0x010d; + two_byte_source[14] = two_byte_source[78] = two_byte_name[6] = 0x010D; v8::Local<v8::String> source = v8::String::NewFromTwoByte(isolate, two_byte_source, v8::NewStringType::kNormal) @@ -2888,7 +2954,7 @@ TEST(FuncNameInferrerTwoByte) { TEST(FuncNameInferrerEscaped) { // The same as FuncNameInferrerTwoByte, except that we express the two-byte - // character as a unicode escape. + // character as a Unicode escape. i::FLAG_allow_natives_syntax = true; v8::Isolate* isolate = CcTest::isolate(); v8::HandleScope scope(isolate); @@ -2898,7 +2964,7 @@ TEST(FuncNameInferrerEscaped) { "%FunctionGetInferredName(obj1.o\\u010dj2.foo1)"); uint16_t* two_byte_name = AsciiToTwoByteString("obj1.oXj2.foo1"); // Fix to correspond to the non-ASCII name in two_byte_source. - two_byte_name[6] = 0x010d; + two_byte_name[6] = 0x010D; v8::Local<v8::String> source = v8::String::NewFromTwoByte(isolate, two_byte_source, v8::NewStringType::kNormal) @@ -3435,81 +3501,81 @@ TEST(MaybeAssignedInsideLoop) { {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 }", {2}}, - {0, "for (j of x) { let [foo] = [j] }", {2}}, - {0, "for (j of x) { const foo = j }", {2}}, - {0, "for (j of x) { const [foo] = [j] }", {2}}, - {0, "for (j of x) { function foo() {return j} }", {2}}, + {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 }", {2}}, - {0, "for ({j} of x) { let [foo] = [j] }", {2}}, - {0, "for ({j} of x) { const foo = j }", {2}}, - {0, "for ({j} of x) { const [foo] = [j] }", {2}}, - {0, "for ({j} of x) { function foo() {return j} }", {2}}, + {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 }", {2}}, - {0, "for (var j of x) { let [foo] = [j] }", {2}}, - {0, "for (var j of x) { const foo = j }", {2}}, - {0, "for (var j of x) { const [foo] = [j] }", {2}}, - {0, "for (var j of x) { function foo() {return j} }", {2}}, + {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 }", {2}}, - {0, "for (var {j} of x) { let [foo] = [j] }", {2}}, - {0, "for (var {j} of x) { const foo = j }", {2}}, - {0, "for (var {j} of x) { const [foo] = [j] }", {2}}, - {0, "for (var {j} of x) { function foo() {return j} }", {2}}, + {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, 2, 0}}, - {0, "for (let j of x) { let [foo] = [j] }", {0, 2, 0}}, - {0, "for (let j of x) { const foo = j }", {0, 2, 0}}, - {0, "for (let j of x) { const [foo] = [j] }", {0, 2, 0}}, - {0, "for (let j of x) { function foo() {return j} }", {0, 2, 0}}, + {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, 2, 0}}, - {0, "for (let {j} of x) { let [foo] = [j] }", {0, 2, 0}}, - {0, "for (let {j} of x) { const foo = j }", {0, 2, 0}}, - {0, "for (let {j} of x) { const [foo] = [j] }", {0, 2, 0}}, - {0, "for (let {j} of x) { function foo() {return j} }", {0, 2, 0}}, + {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, 2, 0}}, - {0, "for (const j of x) { let [foo] = [j] }", {0, 2, 0}}, - {0, "for (const j of x) { const foo = j }", {0, 2, 0}}, - {0, "for (const j of x) { const [foo] = [j] }", {0, 2, 0}}, - {0, "for (const j of x) { function foo() {return j} }", {0, 2, 0}}, + {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, 2, 0}}, - {0, "for (const {j} of x) { let [foo] = [j] }", {0, 2, 0}}, - {0, "for (const {j} of x) { const foo = j }", {0, 2, 0}}, - {0, "for (const {j} of x) { const [foo] = [j] }", {0, 2, 0}}, - {0, "for (const {j} of x) { function foo() {return j} }", {0, 2, 0}}, + {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}, @@ -3843,24 +3909,6 @@ TEST(LineOrParagraphSeparatorAsLineTerminator) { RunParserSyncTest(context_data, statement_data, kError); } -TEST(LineOrParagraphSeparatorAsLineTerminatorUseCount) { - i::Isolate* isolate = CcTest::i_isolate(); - i::HandleScope scope(isolate); - LocalContext env; - int use_counts[v8::Isolate::kUseCounterFeatureCount] = {}; - global_use_counts = use_counts; - CcTest::isolate()->SetUseCounterCallback(MockUseCounterCallback); - CompileRun(""); - CHECK_EQ(0, use_counts[v8::Isolate::UseCounterFeature:: - kLineOrParagraphSeparatorAsLineTerminator]); - CompileRun("// Foo\xE2\x80\xA8"); // "// Foo<U+2028>" - CHECK_LT(0, use_counts[v8::Isolate::UseCounterFeature:: - kLineOrParagraphSeparatorAsLineTerminator]); - CompileRun("// Foo\xE2\x80\xA9"); // "// Foo<U+2029>" - CHECK_LT(1, use_counts[v8::Isolate::UseCounterFeature:: - kLineOrParagraphSeparatorAsLineTerminator]); -} - TEST(ErrorsArrowFormalParameters) { const char* context_data[][2] = { { "()", "=>{}" }, @@ -4639,6 +4687,7 @@ TEST(ClassBodyNoErrors) { "*g() {};", "; *g() {}", "*g() {}; *h(x) {}", + "async *x(){}", "static() {}", "get static() {}", "set static(v) {}", @@ -4659,6 +4708,7 @@ TEST(ClassBodyNoErrors) { "*async(){}", "static async(){}", "static *async(){}", + "static async *x(){}", // Escaped 'static' should be allowed anywhere // static-as-PropertyName is. @@ -4717,6 +4767,96 @@ TEST(ClassPropertyNameNoErrors) { RunParserSyncTest(context_data, name_data, kSuccess); } +TEST(StaticClassFieldsNoErrors) { + // clang-format off + // Tests proposed class fields syntax. + const char* context_data[][2] = {{"(class {", "});"}, + {"(class extends Base {", "});"}, + {"class C {", "}"}, + {"class C extends Base {", "}"}, + {nullptr, nullptr}}; + const char* class_body_data[] = { + // Basic syntax + "static a = 0;", + "static a = 0; b", + "static a = 0; b(){}", + "static a = 0; *b(){}", + "static a = 0; ['b'](){}", + "static a;", + "static a; b;", + "static a; b(){}", + "static a; *b(){}", + "static a; ['b'](){}", + "static ['a'] = 0;", + "static ['a'] = 0; b", + "static ['a'] = 0; b(){}", + "static ['a'] = 0; *b(){}", + "static ['a'] = 0; ['b'](){}", + "static ['a'];", + "static ['a']; b;", + "static ['a']; b(){}", + "static ['a']; *b(){}", + "static ['a']; ['b'](){}", + + "static 0 = 0;", + "static 0;", + "static 'a' = 0;", + "static 'a';", + + // ASI + "static a = 0\n", + "static a = 0\n b", + "static a = 0\n b(){}", + "static a\n", + "static a\n b\n", + "static a\n b(){}", + "static a\n *b(){}", + "static a\n ['b'](){}", + "static ['a'] = 0\n", + "static ['a'] = 0\n b", + "static ['a'] = 0\n b(){}", + "static ['a']\n", + "static ['a']\n b\n", + "static ['a']\n b(){}", + "static ['a']\n *b(){}", + "static ['a']\n ['b'](){}", + + "static a = function t() { arguments; }", + "static a = () => function t() { arguments; }", + + // ASI edge cases + "static a\n get", + "static get\n *a(){}", + "static a\n static", + + // Misc edge cases + "static yield", + "static yield = 0", + "static yield\n a", + "static async;", + "static async = 0;", + "static async", + "static async = 0", + "static async\n a(){}", // a field named async, and a method named a. + "static async\n a", + "static await;", + "static await = 0;", + "static await\n a", + nullptr + }; + // clang-format on + + static const ParserFlag always_flags[] = {kAllowHarmonyPublicFields, + kAllowHarmonyStaticFields}; + RunParserSyncTest(context_data, class_body_data, kSuccess, nullptr, 0, + always_flags, arraysize(always_flags)); + + // Without the static flag, all of these are errors + static const ParserFlag no_static_flags[] = {kAllowHarmonyPublicFields}; + RunParserSyncTest(context_data, class_body_data, kError, nullptr, 0, + no_static_flags, arraysize(no_static_flags)); +} + TEST(ClassFieldsNoErrors) { // clang-format off // Tests proposed class fields syntax. @@ -4753,15 +4893,6 @@ TEST(ClassFieldsNoErrors) { "'a' = 0;", "'a';", - "static a = 0;", - "static a;", - "static ['a'] = 0", - "static ['a']", - "static 0 = 0;", - "static 0;", - "static 'a' = 0;", - "static 'a';", - // ASI "a = 0\n", "a = 0\n b", @@ -4785,16 +4916,17 @@ TEST(ClassFieldsNoErrors) { "get\n *a(){}", "a\n static", + "a = function t() { arguments; }", + "a = () => function() { arguments; }", + // Misc edge cases "yield", "yield = 0", "yield\n a", "async;", "async = 0;", - "static async;" "async", "async = 0", - "static async", "async\n a(){}", // a field named async, and a method named a. "async\n a", "await;", @@ -4807,6 +4939,128 @@ TEST(ClassFieldsNoErrors) { static const ParserFlag always_flags[] = {kAllowHarmonyPublicFields}; RunParserSyncTest(context_data, class_body_data, kSuccess, nullptr, 0, always_flags, arraysize(always_flags)); + + static const ParserFlag static_flags[] = {kAllowHarmonyPublicFields, + kAllowHarmonyStaticFields}; + RunParserSyncTest(context_data, class_body_data, kSuccess, nullptr, 0, + static_flags, arraysize(static_flags)); +} + +TEST(PrivateClassFieldsNoErrors) { + // clang-format off + // Tests proposed class fields syntax. + const char* context_data[][2] = {{"(class {", "});"}, + {"(class extends Base {", "});"}, + {"class C {", "}"}, + {"class C extends Base {", "}"}, + {nullptr, nullptr}}; + const char* class_body_data[] = { + // Basic syntax + "#a = 0;", + "#a = 0; #b", + "#a = 0; b", + "#a = 0; b(){}", + "#a = 0; *b(){}", + "#a = 0; ['b'](){}", + "#a;", + "#a; #b;", + "#a; b;", + "#a; b(){}", + "#a; *b(){}", + "#a; ['b'](){}", + + // ASI + "#a = 0\n", + "#a = 0\n #b", + "#a = 0\n b", + "#a = 0\n b(){}", + "#a\n", + "#a\n #b\n", + "#a\n b\n", + "#a\n b(){}", + "#a\n *b(){}", + "#a\n ['b'](){}", + + // ASI edge cases + "#a\n get", + "#get\n *a(){}", + "#a\n static", + + "#a = function t() { arguments; }", + "#a = () => function() { arguments; }", + + // Misc edge cases + "#yield", + "#yield = 0", + "#yield\n a", + "#async;", + "#async = 0;", + "#async", + "#async = 0", + "#async\n a(){}", // a field named async, and a method named a. + "#async\n a", + "#await;", + "#await = 0;", + "#await\n a", + nullptr + }; + // clang-format on + + RunParserSyncTest(context_data, class_body_data, kError); + + static const ParserFlag private_fields[] = {kAllowHarmonyPrivateFields}; + RunParserSyncTest(context_data, class_body_data, kSuccess, nullptr, 0, + private_fields, arraysize(private_fields)); +} + +TEST(StaticClassFieldsErrors) { + // clang-format off + // Tests proposed class fields syntax. + const char* context_data[][2] = {{"(class {", "});"}, + {"(class extends Base {", "});"}, + {"class C {", "}"}, + {"class C extends Base {", "}"}, + {nullptr, nullptr}}; + const char* class_body_data[] = { + "static a : 0", + "static a =", + "static constructor", + "static prototype", + "static *a = 0", + "static *a", + "static get a", + "static get\n a", + "static yield a", + "static async a = 0", + "static async a", + + "static a = arguments", + "static a = () => arguments", + "static a = () => { arguments }", + "static a = arguments[0]", + "static a = delete arguments[0]", + "static a = f(arguments)", + "static a = () => () => arguments", + + // ASI requires a linebreak + "static a b", + "static a = 0 b", + + // ASI requires that the next token is not part of any legal production + "static a = 0\n *b(){}", + "static a = 0\n ['b'](){}", + nullptr + }; + // clang-format on + + static const ParserFlag no_static_flags[] = {kAllowHarmonyPublicFields}; + RunParserSyncTest(context_data, class_body_data, kError, nullptr, 0, + no_static_flags, arraysize(no_static_flags)); + + static const ParserFlag always_flags[] = {kAllowHarmonyPublicFields, + kAllowHarmonyStaticFields}; + RunParserSyncTest(context_data, class_body_data, kError, nullptr, 0, + always_flags, arraysize(always_flags)); } TEST(ClassFieldsErrors) { @@ -4820,22 +5074,22 @@ TEST(ClassFieldsErrors) { const char* class_body_data[] = { "a : 0", "a =", - "static constructor", - "static prototype", "constructor", "*a = 0", "*a", "get a", "yield a", - "a : 0;", - "a =;", - "*a = 0;", - "*a;", - "get a;", - "yield a;", "async a = 0", "async a", + "a = arguments", + "a = () => arguments", + "a = () => { arguments }", + "a = arguments[0]", + "a = delete arguments[0]", + "a = f(arguments)", + "a = () => () => arguments", + // ASI requires a linebreak "a b", "a = 0 b", @@ -4851,6 +5105,279 @@ TEST(ClassFieldsErrors) { static const ParserFlag always_flags[] = {kAllowHarmonyPublicFields}; RunParserSyncTest(context_data, class_body_data, kError, nullptr, 0, always_flags, arraysize(always_flags)); + + static const ParserFlag static_flags[] = {kAllowHarmonyPublicFields, + kAllowHarmonyStaticFields}; + RunParserSyncTest(context_data, class_body_data, kError, nullptr, 0, + static_flags, arraysize(static_flags)); +} + +TEST(PrivateClassFieldsErrors) { + // clang-format off + // Tests proposed class fields syntax. + const char* context_data[][2] = {{"(class {", "});"}, + {"(class extends Base {", "});"}, + {"class C {", "}"}, + {"class C extends Base {", "}"}, + {nullptr, nullptr}}; + const char* class_body_data[] = { + "#a : 0", + "#a =", + "#*a = 0", + "#*a", + "#get a", + "#yield a", + "#async a = 0", + "#async a", + + "# a = 0", + "#a() { }", + "get #a() { }", + "#get a() { }", + "set #a() { }", + "#set a() { }", + "*#a() { }", + "#*a() { }", + "async #a() { }", + "async *#a() { }", + "async #*a() { }", + + "#0 = 0;", + "#0;", + "#'a' = 0;", + "#'a';", + + "#['a']", + "#['a'] = 1", + "#[a]", + "#[a] = 1", + + "#a = arguments", + "#a = () => arguments", + "#a = () => { arguments }", + "#a = arguments[0]", + "#a = delete arguments[0]", + "#a = f(arguments)", + "#a = () => () => arguments", + + // ASI requires a linebreak + "#a b", + "#a = 0 b", + + // ASI requires that the next token is not part of any legal production + "#a = 0\n *b(){}", + "#a = 0\n ['b'](){}", + nullptr + }; + // clang-format on + + RunParserSyncTest(context_data, class_body_data, kError); + + static const ParserFlag private_fields[] = {kAllowHarmonyPrivateFields}; + RunParserSyncTest(context_data, class_body_data, kError, nullptr, 0, + private_fields, arraysize(private_fields)); +} + +TEST(PrivateStaticClassFieldsErrors) { + // clang-format off + // Tests proposed class fields syntax. + const char* context_data[][2] = {{"(class {", "});"}, + {"(class extends Base {", "});"}, + {"class C {", "}"}, + {"class C extends Base {", "}"}, + {nullptr, nullptr}}; + const char* class_body_data[] = { + // Basic syntax + "static #a = 0;", + "static #a = 0; b", + "static #a = 0; #b", + "static #a = 0; b(){}", + "static #a = 0; *b(){}", + "static #a = 0; ['b'](){}", + "static #a;", + "static #a; b;", + "static #a; b(){}", + "static #a; *b(){}", + "static #a; ['b'](){}", + "static #['a'] = 0;", + "static #['a'] = 0; b", + "static #['a'] = 0; #b", + "static #['a'] = 0; b(){}", + "static #['a'] = 0; *b(){}", + "static #['a'] = 0; ['b'](){}", + "static #['a'];", + "static #['a']; b;", + "static #['a']; #b;", + "static #['a']; b(){}", + "static #['a']; *b(){}", + "static #['a']; ['b'](){}", + + "static #0 = 0;", + "static #0;", + "static #'a' = 0;", + "static #'a';", + + "static # a = 0", + "static #a() { }", + "static get #a() { }", + "static #get a() { }", + "static set #a() { }", + "static #set a() { }", + "static *#a() { }", + "static #*a() { }", + "static async #a() { }", + "static async *#a() { }", + "static async #*a() { }", + + // ASI + "static #a = 0\n", + "static #a = 0\n b", + "static #a = 0\n #b", + "static #a = 0\n b(){}", + "static #a\n", + "static #a\n b\n", + "static #a\n #b\n", + "static #a\n b(){}", + "static #a\n *b(){}", + "static #a\n ['b'](){}", + "static #['a'] = 0\n", + "static #['a'] = 0\n b", + "static #['a'] = 0\n #b", + "static #['a'] = 0\n b(){}", + "static #['a']\n", + "static #['a']\n b\n", + "static #['a']\n #b\n", + "static #['a']\n b(){}", + "static #['a']\n *b(){}", + "static #['a']\n ['b'](){}", + + "static #a = function t() { arguments; }", + "static #a = () => function t() { arguments; }", + + // ASI edge cases + "static #a\n get", + "static #get\n *a(){}", + "static #a\n static", + + // Misc edge cases + "static #yield", + "static #yield = 0", + "static #yield\n a", + "static #async;", + "static #async = 0;", + "static #async", + "static #async = 0", + "static #async\n a(){}", // a field named async, and a method named a. + "static #async\n a", + "static #await;", + "static #await = 0;", + "static #await\n a", + nullptr + }; + // clang-format on + + RunParserSyncTest(context_data, class_body_data, kError); + + static const ParserFlag public_static_fields[] = {kAllowHarmonyPublicFields, + kAllowHarmonyStaticFields}; + RunParserSyncTest(context_data, class_body_data, kError, nullptr, 0, + public_static_fields, arraysize(public_static_fields)); + + static const ParserFlag private_static_fields[] = { + kAllowHarmonyPublicFields, kAllowHarmonyStaticFields, + kAllowHarmonyPrivateFields}; + RunParserSyncTest(context_data, class_body_data, kError, nullptr, 0, + private_static_fields, arraysize(private_static_fields)); +} + +TEST(PrivateNameNoErrors) { + // clang-format off + const char* context_data[][2] = { + {"", ""}, + {"\"use strict\";", ""}, + {nullptr, nullptr} + }; + + const char* statement_data[] = { + "this.#a", + "this.#a()", + "this.#b.#a", + "this.#b.#a()", + + "foo.#a", + "foo.#a()", + "foo.#b.#a", + "foo.#b.#a()", + + "new foo.#a", + "new foo.#b.#a", + "new foo.#b.#a()", + + "foo.#if;", + "foo.#yield;", + "foo.#super;", + "foo.#interface;", + "foo.#eval;", + "foo.#arguments;", + + nullptr + }; + + // clang-format on + RunParserSyncTest(context_data, statement_data, kError); + + static const ParserFlag private_fields[] = {kAllowHarmonyPrivateFields}; + RunParserSyncTest(context_data, statement_data, kSuccess, nullptr, 0, + private_fields, arraysize(private_fields)); +} + +TEST(PrivateNameErrors) { + // clang-format off + const char* context_data[][2] = { + {"", ""}, + {"\"use strict\";", ""}, + {nullptr, nullptr} + }; + + const char* statement_data[] = { + "#foo", + "#foo = 1", + + "# a;", + "#\n a;", + "a, # b", + "a, #, b;", + + "foo.#[a];", + "foo.#['a'];", + + "foo()#a", + "foo()#[a]", + "foo()#['a']", + + "super.#a;", + "super.#a = 1;", + "super.#['a']", + "super.#[a]", + + "new.#a", + "new.#[a]", + + "foo.#{;", + "foo.#};", + "foo.#=;", + "foo.#888;", + "foo.#-;", + "foo.#--;", + nullptr + }; + + // clang-format on + RunParserSyncTest(context_data, statement_data, kError); + + static const ParserFlag private_fields[] = {kAllowHarmonyPrivateFields}; + RunParserSyncTest(context_data, statement_data, kError, nullptr, 0, + private_fields, arraysize(private_fields)); } TEST(ClassExpressionErrors) { @@ -4916,7 +5443,6 @@ TEST(ClassAsyncErrors) { const char* async_data[] = { "*async x(){}", "async *(){}", - "async *x(){}", "async get x(){}", "async set x(y){}", "async x : 0", @@ -4926,7 +5452,6 @@ TEST(ClassAsyncErrors) { "static *async x(){}", "static async *(){}", - "static async *x(){}", "static async get x(){}", "static async set x(y){}", "static async x : 0", @@ -5358,9 +5883,9 @@ TEST(InvalidUnicodeEscapes) { // Braces gone wrong "var foob\\u{c481r = 0;", "var foob\\uc481}r = 0;", "var \\u{0052oo = 0;", "var \\u0052}oo = 0;", "\"foob\\u{c481r\"", "var foob\\u{}ar = 0;", - // Too high value for the unicode escape + // Too high value for the Unicode code point escape "\"\\u{110000}\"", - // Not an unicode escape + // Not a Unicode code point escape "var foob\\v1234r = 0;", "var foob\\U1234r = 0;", "var foob\\v{1234}r = 0;", "var foob\\U{1234}r = 0;", nullptr}; RunParserSyncTest(context_data, data, kError); @@ -5378,11 +5903,10 @@ TEST(UnicodeEscapes) { "var foob\\uc481r = 0;", "var foob\\u{c481}r = 0;", // String with an escape "\"foob\\uc481r\"", "\"foob\\{uc481}r\"", - // This character is a valid unicode character, representable as a - // surrogate - // pair, not representable as 4 hex digits. + // This character is a valid Unicode character, representable as a + // surrogate pair, not representable as 4 hex digits. "\"foo\\u{10e6d}\"", - // Max value for the unicode escape + // Max value for the Unicode code point escape "\"\\u{10ffff}\"", nullptr}; RunParserSyncTest(context_data, data, kSuccess); } @@ -5837,14 +6361,13 @@ TEST(BasicImportExportParsing) { .ToHandleChecked()); isolate->clear_pending_exception(); - v8::base::OS::Print( + FATAL( "Parser failed on:\n" "\t%s\n" "with error:\n" "\t%s\n" "However, we expected no error.", source->ToCString().get(), message_string->ToCString().get()); - CHECK(false); } } @@ -6243,9 +6766,9 @@ TEST(ModuleParsingInternals) { CHECK(declarations->AtForTest(8)->proxy()->raw_name()->IsOneByteEqualTo( "nonexport")); - CHECK(declarations->AtForTest(8)->proxy()->var()->binding_needs_init()); - CHECK(declarations->AtForTest(8)->proxy()->var()->location() != - i::VariableLocation::MODULE); + CHECK(!declarations->AtForTest(8)->proxy()->var()->binding_needs_init()); + CHECK(declarations->AtForTest(8)->proxy()->var()->location() == + i::VariableLocation::LOCAL); CHECK( declarations->AtForTest(9)->proxy()->raw_name()->IsOneByteEqualTo("mm")); @@ -6296,7 +6819,7 @@ TEST(ModuleParsingInternals) { CHECK_EQ(4, elem.second.index); CHECK_EQ(370, elem.second.position); } else { - CHECK(false); + UNREACHABLE(); } } @@ -6942,19 +7465,12 @@ TEST(DestructuringNegativeTests) { "{...[ x = 5 ] }", "{...x.f }", "{...x[0] }", + "async function* a() {}", nullptr }; - const char* async_gen_data[] = { - "async function* a() {}", - nullptr - }; - // clang-format on RunParserSyncTest(context_data, data, kError); - static const ParserFlag async_gen_flags[] = {kAllowHarmonyAsyncIteration}; - RunParserSyncTest(context_data, async_gen_data, kError, nullptr, 0, - async_gen_flags, arraysize(async_gen_flags)); } { // All modes. @@ -8210,6 +8726,8 @@ TEST(FunctionDeclarationError) { "label: function* f() { }", "if (true) async function f() { }", "label: async function f() { }", + "if (true) async function* f() { }", + "label: async function* f() { }", nullptr }; // Valid only in sloppy mode. @@ -8231,20 +8749,6 @@ TEST(FunctionDeclarationError) { // In sloppy mode, sloppy_data is successful RunParserSyncTest(sloppy_context, error_data, kError); RunParserSyncTest(sloppy_context, sloppy_data, kSuccess); - - // No single statement async iterators - // clang-format off - const char* async_iterator_data[] = { - "if (true) async function* f() { }", - "label: async function* f() { }", - nullptr, - }; - // clang-format on - static const ParserFlag flags[] = {kAllowHarmonyAsyncIteration}; - RunParserSyncTest(sloppy_context, async_iterator_data, kError, nullptr, 0, - flags, arraysize(flags)); - RunParserSyncTest(strict_context, async_iterator_data, kError, nullptr, 0, - flags, arraysize(flags)); } TEST(ExponentiationOperator) { @@ -8410,6 +8914,9 @@ TEST(AsyncAwait) { "var O = { method(await) { return await; } };", "var O = { *method() { var await = 1; return await; } };", "var O = { *method(await) { return await; } };", + "var asyncFn = async function*() {}", + "async function* f() {}", + "var O = { async *method() {} };", "(function await() {})", nullptr @@ -8448,10 +8955,7 @@ TEST(AsyncAwaitErrors) { "var f = async() => await;", - "var asyncFn = async function*() {}", - "async function* f() {}", "var O = { *async method() {} };", - "var O = { async *method() {} };", "var O = { async method*() {} };", "var asyncFn = async function(x = await 1) { return x; }", @@ -8571,6 +9075,64 @@ TEST(AsyncAwaitErrors) { RunParserSyncTest(async_body_context_data, async_body_error_data, kError); } +TEST(Regress7173) { + // Await expression is an invalid destructuring target, and should not crash + + // clang-format off + const char* error_context_data[][2] = { + { "'use strict'; async function f() {", "}" }, + { "async function f() {", "}" }, + { "'use strict'; function f() {", "}" }, + { "function f() {", "}" }, + { "let f = async() => {", "}" }, + { "let f = () => {", "}" }, + { "'use strict'; async function* f() {", "}" }, + { "async function* f() {", "}" }, + { "'use strict'; function* f() {", "}" }, + { "function* f() {", "}" }, + { nullptr, nullptr } + }; + + const char* error_data[] = { + "var [await f] = [];", + "let [await f] = [];", + "const [await f] = [];", + + "var [...await f] = [];", + "let [...await f] = [];", + "const [...await f] = [];", + + "var { await f } = {};", + "let { await f } = {};", + "const { await f } = {};", + + "var { ...await f } = {};", + "let { ...await f } = {};", + "const { ...await f } = {};", + + "var { f: await f } = {};", + "let { f: await f } = {};", + "const { f: await f } = {};" + + "var { f: ...await f } = {};", + "let { f: ...await f } = {};", + "const { f: ...await f } = {};" + + "var { [f]: await f } = {};", + "let { [f]: await f } = {};", + "const { [f]: await f } = {};", + + "var { [f]: ...await f } = {};", + "let { [f]: ...await f } = {};", + "const { [f]: ...await f } = {};", + + nullptr + }; + // clang-format on + + RunParserSyncTest(error_context_data, error_data, kError); +} + TEST(AsyncAwaitFormalParameters) { // clang-format off const char* context_for_formal_parameters[][2] = { @@ -9332,24 +9894,18 @@ TEST(ForAwaitOf) { nullptr }; // clang-format on - static const ParserFlag always_flags[] = {kAllowHarmonyAsyncIteration}; - RunParserSyncTest(context_data, expr_data, kSuccess, nullptr, 0, always_flags, - arraysize(always_flags)); - RunParserSyncTest(context_data2, expr_data, kSuccess, nullptr, 0, - always_flags, arraysize(always_flags)); + RunParserSyncTest(context_data, expr_data, kSuccess); + RunParserSyncTest(context_data2, expr_data, kSuccess); - RunParserSyncTest(context_data, var_data, kSuccess, nullptr, 0, always_flags, - arraysize(always_flags)); + RunParserSyncTest(context_data, var_data, kSuccess); // TODO(marja): PreParser doesn't report early errors. // (https://bugs.chromium.org/p/v8/issues/detail?id=2728) // RunParserSyncTest(context_data2, var_data, kError, nullptr, 0, // always_flags, // arraysize(always_flags)); - RunParserSyncTest(context_data, lexical_data, kSuccess, nullptr, 0, - always_flags, arraysize(always_flags)); - RunParserSyncTest(context_data2, lexical_data, kSuccess, nullptr, 0, - always_flags, arraysize(always_flags)); + RunParserSyncTest(context_data, lexical_data, kSuccess); + RunParserSyncTest(context_data2, lexical_data, kSuccess); } TEST(ForAwaitOfErrors) { @@ -9510,9 +10066,7 @@ TEST(ForAwaitOfErrors) { nullptr }; // clang-format on - static const ParserFlag always_flags[] = {kAllowHarmonyAsyncIteration}; - RunParserSyncTest(context_data, data, kError, nullptr, 0, always_flags, - arraysize(always_flags)); + RunParserSyncTest(context_data, data, kError); } TEST(ForAwaitOfFunctionDeclaration) { @@ -9535,9 +10089,7 @@ TEST(ForAwaitOfFunctionDeclaration) { }; // clang-format on - static const ParserFlag always_flags[] = {kAllowHarmonyAsyncIteration}; - RunParserSyncTest(context_data, data, kError, nullptr, 0, always_flags, - arraysize(always_flags)); + RunParserSyncTest(context_data, data, kError); } TEST(AsyncGenerator) { @@ -9634,9 +10186,7 @@ TEST(AsyncGenerator) { }; // clang-format on - static const ParserFlag always_flags[] = {kAllowHarmonyAsyncIteration}; - RunParserSyncTest(context_data, statement_data, kSuccess, nullptr, 0, - always_flags, arraysize(always_flags)); + RunParserSyncTest(context_data, statement_data, kSuccess); } TEST(AsyncGeneratorErrors) { @@ -9724,9 +10274,7 @@ TEST(AsyncGeneratorErrors) { }; // clang-format on - static const ParserFlag always_flags[] = {kAllowHarmonyAsyncIteration}; - RunParserSyncTest(context_data, statement_data, kError, nullptr, 0, - always_flags, arraysize(always_flags)); + RunParserSyncTest(context_data, statement_data, kError); } TEST(LexicalLoopVariable) { diff --git a/deps/v8/test/cctest/test-platform.cc b/deps/v8/test/cctest/test-platform.cc index a50a08b35f..e7ad2d84f1 100644 --- a/deps/v8/test/cctest/test-platform.cc +++ b/deps/v8/test/cctest/test-platform.cc @@ -12,45 +12,6 @@ using OS = v8::base::OS; namespace v8 { namespace internal { -TEST(OSAllocateAndFree) { - size_t page_size = OS::AllocatePageSize(); - CHECK_NE(0, page_size); - - // A large allocation, aligned at native allocation granularity. - const size_t kAllocationSize = 1 * MB; - void* mem_addr = OS::Allocate(OS::GetRandomMmapAddr(), kAllocationSize, - page_size, OS::MemoryPermission::kReadWrite); - CHECK_NOT_NULL(mem_addr); - CHECK(OS::Free(mem_addr, kAllocationSize)); - - // A large allocation, aligned significantly beyond native granularity. - const size_t kBigAlignment = 64 * MB; - void* aligned_mem_addr = - OS::Allocate(OS::GetRandomMmapAddr(), kAllocationSize, kBigAlignment, - OS::MemoryPermission::kReadWrite); - CHECK_NOT_NULL(aligned_mem_addr); - CHECK_EQ(aligned_mem_addr, AlignedAddress(aligned_mem_addr, kBigAlignment)); - CHECK(OS::Free(aligned_mem_addr, kAllocationSize)); -} - -TEST(OSReserveMemory) { - size_t page_size = OS::AllocatePageSize(); - const size_t kAllocationSize = 1 * MB; - void* mem_addr = OS::Allocate(OS::GetRandomMmapAddr(), kAllocationSize, - page_size, OS::MemoryPermission::kReadWrite); - CHECK_NE(0, page_size); - CHECK_NOT_NULL(mem_addr); - size_t commit_size = OS::CommitPageSize(); - CHECK(OS::SetPermissions(mem_addr, commit_size, - OS::MemoryPermission::kReadWrite)); - // Check whether we can write to memory. - int* addr = static_cast<int*>(mem_addr); - addr[KB - 1] = 2; - CHECK(OS::SetPermissions(mem_addr, commit_size, - OS::MemoryPermission::kNoAccess)); - CHECK(OS::Free(mem_addr, kAllocationSize)); -} - #ifdef V8_CC_GNU static uintptr_t sp_addr = 0; diff --git a/deps/v8/test/cctest/test-profile-generator.cc b/deps/v8/test/cctest/test-profile-generator.cc index 46c0c4e132..9dda53a063 100644 --- a/deps/v8/test/cctest/test-profile-generator.cc +++ b/deps/v8/test/cctest/test-profile-generator.cc @@ -649,8 +649,7 @@ int GetFunctionLineNumber(CpuProfiler& profiler, LocalContext& env, v8::Utils::OpenHandle(*v8::Local<v8::Function>::Cast( env->Global()->Get(env.local(), v8_str(name)).ToLocalChecked()))); CodeEntry* func_entry = code_map->FindEntry(func->abstract_code()->address()); - if (!func_entry) - FATAL(name); + if (!func_entry) FATAL("%s", name); return func_entry->line_number(); } diff --git a/deps/v8/test/cctest/test-regexp.cc b/deps/v8/test/cctest/test-regexp.cc index c2e6526f40..5b4e42c26d 100644 --- a/deps/v8/test/cctest/test-regexp.cc +++ b/deps/v8/test/cctest/test-regexp.cc @@ -1707,35 +1707,35 @@ TEST(UnicodeRangeSplitter) { base->Add(CharacterRange::Everything(), &zone); UnicodeRangeSplitter splitter(&zone, base); // BMP - for (uc32 c = 0; c < 0xd800; c++) { + for (uc32 c = 0; c < 0xD800; c++) { CHECK(InClass(c, splitter.bmp())); CHECK(!InClass(c, splitter.lead_surrogates())); CHECK(!InClass(c, splitter.trail_surrogates())); CHECK(!InClass(c, splitter.non_bmp())); } // Lead surrogates - for (uc32 c = 0xd800; c < 0xdbff; c++) { + for (uc32 c = 0xD800; c < 0xDBFF; c++) { CHECK(!InClass(c, splitter.bmp())); CHECK(InClass(c, splitter.lead_surrogates())); CHECK(!InClass(c, splitter.trail_surrogates())); CHECK(!InClass(c, splitter.non_bmp())); } // Trail surrogates - for (uc32 c = 0xdc00; c < 0xdfff; c++) { + for (uc32 c = 0xDC00; c < 0xDFFF; c++) { CHECK(!InClass(c, splitter.bmp())); CHECK(!InClass(c, splitter.lead_surrogates())); CHECK(InClass(c, splitter.trail_surrogates())); CHECK(!InClass(c, splitter.non_bmp())); } // BMP - for (uc32 c = 0xe000; c < 0xffff; c++) { + for (uc32 c = 0xE000; c < 0xFFFF; c++) { CHECK(InClass(c, splitter.bmp())); CHECK(!InClass(c, splitter.lead_surrogates())); CHECK(!InClass(c, splitter.trail_surrogates())); CHECK(!InClass(c, splitter.non_bmp())); } // Non-BMP - for (uc32 c = 0x10000; c < 0x10ffff; c++) { + for (uc32 c = 0x10000; c < 0x10FFFF; c++) { CHECK(!InClass(c, splitter.bmp())); CHECK(!InClass(c, splitter.lead_surrogates())); CHECK(!InClass(c, splitter.trail_surrogates())); diff --git a/deps/v8/test/cctest/test-run-wasm-relocation-arm.cc b/deps/v8/test/cctest/test-run-wasm-relocation-arm.cc index d1931d87dd..000cf34c87 100644 --- a/deps/v8/test/cctest/test-run-wasm-relocation-arm.cc +++ b/deps/v8/test/cctest/test-run-wasm-relocation-arm.cc @@ -40,7 +40,7 @@ TEST(WasmRelocationArmContextReference) { Handle<Code> code = isolate->factory()->NewCode(desc, Code::STUB, Handle<Code>()); - compiler::CSignature0<int32_t> csig; + compiler::CSignatureOf<int32_t> csig; compiler::CodeRunner<int32_t> runnable(isolate, code, &csig); int32_t ret_value = runnable.Call(); CHECK_EQ(ret_value, imm); diff --git a/deps/v8/test/cctest/test-run-wasm-relocation-arm64.cc b/deps/v8/test/cctest/test-run-wasm-relocation-arm64.cc index 0e2b09e43a..59f38e1554 100644 --- a/deps/v8/test/cctest/test-run-wasm-relocation-arm64.cc +++ b/deps/v8/test/cctest/test-run-wasm-relocation-arm64.cc @@ -45,7 +45,7 @@ TEST(WasmRelocationArm64ContextReference) { Handle<Code> code = isolate->factory()->NewCode(desc, Code::STUB, Handle<Code>()); - compiler::CSignature0<int64_t> csig; + compiler::CSignatureOf<int64_t> csig; compiler::CodeRunner<int64_t> runnable(isolate, code, &csig); int64_t ret_value = runnable.Call(); CHECK_EQ(ret_value, imm); diff --git a/deps/v8/test/cctest/test-run-wasm-relocation-ia32.cc b/deps/v8/test/cctest/test-run-wasm-relocation-ia32.cc index 829e0685a8..080da36a47 100644 --- a/deps/v8/test/cctest/test-run-wasm-relocation-ia32.cc +++ b/deps/v8/test/cctest/test-run-wasm-relocation-ia32.cc @@ -40,7 +40,7 @@ TEST(WasmRelocationIa32ContextReference) { __ nop(); __ ret(0); - compiler::CSignature0<int32_t> csig; + compiler::CSignatureOf<int32_t> csig; CodeDesc desc; assm.GetCode(isolate, &desc); Handle<Code> code = diff --git a/deps/v8/test/cctest/test-run-wasm-relocation-x64.cc b/deps/v8/test/cctest/test-run-wasm-relocation-x64.cc index d5c29604dd..0526ce25a2 100644 --- a/deps/v8/test/cctest/test-run-wasm-relocation-x64.cc +++ b/deps/v8/test/cctest/test-run-wasm-relocation-x64.cc @@ -43,7 +43,7 @@ TEST(WasmRelocationX64ContextReference) { isolate->factory()->NewCode(desc, Code::STUB, Handle<Code>()); USE(code); - CSignature0<int64_t> csig; + CSignatureOf<int64_t> csig; CodeRunner<int64_t> runnable(isolate, code, &csig); int64_t ret_value = runnable.Call(); CHECK_EQ(ret_value, imm); diff --git a/deps/v8/test/cctest/test-serialize.cc b/deps/v8/test/cctest/test-serialize.cc index 20aa3f008c..70fc8586eb 100644 --- a/deps/v8/test/cctest/test-serialize.cc +++ b/deps/v8/test/cctest/test-serialize.cc @@ -57,6 +57,8 @@ namespace v8 { namespace internal { +enum CodeCacheType { kLazy, kEager, kAfterExecute }; + void DisableLazyDeserialization() { // UNINITIALIZED tests do not set up the isolate sufficiently for lazy // deserialization to work. @@ -120,9 +122,10 @@ struct StartupBlobs { static StartupBlobs Serialize(v8::Isolate* isolate) { // We have to create one context. One reason for this is so that the builtins - // can be loaded from v8natives.js and their addresses can be processed. This - // will clear the pending fixups array, which would otherwise contain GC roots - // that would confuse the serialization/deserialization process. + // can be loaded from self hosted JS builtins and their addresses can be + // processed. This will clear the pending fixups array, which would otherwise + // contain GC roots that would confuse the serialization/deserialization + // process. v8::Isolate::Scope isolate_scope(isolate); { v8::HandleScope scope(isolate); @@ -368,7 +371,7 @@ static void PartiallySerializeContext(Vector<const byte>* startup_blob_out, v8::Local<v8::Context>::New(v8_isolate, env)->Exit(); } - i::Object* raw_context = *v8::Utils::OpenPersistent(env); + i::Context* raw_context = i::Context::cast(*v8::Utils::OpenPersistent(env)); env.Reset(); @@ -493,7 +496,7 @@ static void PartiallySerializeCustomContext( v8::Local<v8::Context>::New(v8_isolate, env)->Exit(); } - i::Object* raw_context = *v8::Utils::OpenPersistent(env); + i::Context* raw_context = i::Context::cast(*v8::Utils::OpenPersistent(env)); env.Reset(); @@ -1379,10 +1382,11 @@ TEST(CodeSerializerLargeCodeObject) { // code. Don't even bother generating optimized code to avoid timeouts. FLAG_always_opt = false; - Vector<const uint8_t> source = - ConstructSource(STATIC_CHAR_VECTOR("var j=1; if (j == 0) {"), - STATIC_CHAR_VECTOR("for (let i of Object.prototype);"), - STATIC_CHAR_VECTOR("} j=7; j"), 1100); + Vector<const uint8_t> source = ConstructSource( + STATIC_CHAR_VECTOR("var j=1; if (j == 0) {"), + STATIC_CHAR_VECTOR( + "for (let i of Object.prototype) for (let k = 0; k < 0; ++k);"), + STATIC_CHAR_VECTOR("} j=7; j"), 1100); Handle<String> source_str = isolate->factory()->NewStringFromOneByte(source).ToHandleChecked(); @@ -1637,28 +1641,34 @@ class SerializerOneByteResource : public v8::String::ExternalOneByteStringResource { public: SerializerOneByteResource(const char* data, size_t length) - : data_(data), length_(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_++; } + int dispose_count() { return dispose_count_; } private: const char* data_; size_t length_; + int dispose_count_; }; class SerializerTwoByteResource : public v8::String::ExternalStringResource { public: SerializerTwoByteResource(const char* data, size_t length) - : data_(AsciiToTwoByteString(data)), length_(length) {} + : data_(AsciiToTwoByteString(data)), length_(length), dispose_count_(0) {} ~SerializerTwoByteResource() { 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_++; } + int dispose_count() { return dispose_count_; } private: const uint16_t* data_; size_t length_; + int dispose_count_; }; TEST(CodeSerializerExternalString) { @@ -1838,8 +1848,8 @@ static void SerializerCodeEventListener(const v8::JitCodeEvent* event) { } } -v8::ScriptCompiler::CachedData* ProduceCache(const char* source, - bool eager = false) { +v8::ScriptCompiler::CachedData* ProduceCache( + const char* source, CodeCacheType cacheType = CodeCacheType::kLazy) { v8::ScriptCompiler::CachedData* cache; v8::Isolate::CreateParams create_params; create_params.array_buffer_allocator = CcTest::array_buffer_allocator(); @@ -1853,19 +1863,23 @@ v8::ScriptCompiler::CachedData* ProduceCache(const char* source, v8::Local<v8::String> source_str = v8_str(source); v8::ScriptOrigin origin(v8_str("test")); v8::ScriptCompiler::Source source(source_str, origin); - v8::ScriptCompiler::CompileOptions options = - eager ? v8::ScriptCompiler::kProduceFullCodeCache - : v8::ScriptCompiler::kProduceCodeCache; + v8::ScriptCompiler::CompileOptions options; + switch (cacheType) { + case CodeCacheType::kLazy: + options = v8::ScriptCompiler::kProduceCodeCache; + break; + case CodeCacheType::kEager: + options = v8::ScriptCompiler::kProduceFullCodeCache; + break; + case CodeCacheType::kAfterExecute: + options = v8::ScriptCompiler::kNoCompileOptions; + break; + default: + UNREACHABLE(); + } v8::Local<v8::UnboundScript> script = v8::ScriptCompiler::CompileUnboundScript(isolate1, &source, options) .ToLocalChecked(); - const v8::ScriptCompiler::CachedData* data = source.GetCachedData(); - CHECK(data); - // Persist cached data. - uint8_t* buffer = NewArray<uint8_t>(data->length); - MemCopy(buffer, data->data, data->length); - cache = new v8::ScriptCompiler::CachedData( - buffer, data->length, v8::ScriptCompiler::CachedData::BufferOwned); v8::Local<v8::Value> result = script->BindToCurrentContext() ->Run(isolate1->GetCurrentContext()) @@ -1874,6 +1888,18 @@ v8::ScriptCompiler::CachedData* ProduceCache(const char* source, result->ToString(isolate1->GetCurrentContext()).ToLocalChecked(); CHECK(result_string->Equals(isolate1->GetCurrentContext(), v8_str("abcdef")) .FromJust()); + + if (cacheType == CodeCacheType::kAfterExecute) { + cache = ScriptCompiler::CreateCodeCache(script, source_str); + } else { + const ScriptCompiler::CachedData* data = source.GetCachedData(); + CHECK(data); + uint8_t* buffer = NewArray<uint8_t>(data->length); + MemCopy(buffer, data->data, data->length); + cache = new v8::ScriptCompiler::CachedData( + buffer, data->length, v8::ScriptCompiler::CachedData::BufferOwned); + } + CHECK(cache); } isolate1->Dispose(); return cache; @@ -1936,7 +1962,8 @@ TEST(CodeSerializerIsolatesEager) { " }" "}" "f()() + 'def'"; - v8::ScriptCompiler::CachedData* cache = ProduceCache(source, true); + v8::ScriptCompiler::CachedData* cache = + ProduceCache(source, CodeCacheType::kEager); v8::Isolate::CreateParams create_params; create_params.array_buffer_allocator = CcTest::array_buffer_allocator(); @@ -1974,6 +2001,68 @@ TEST(CodeSerializerIsolatesEager) { isolate2->Dispose(); } +TEST(CodeSerializerAfterExecute) { + // We test that no compilations happen when running this code. Forcing + // to always optimize breaks this test. + bool prev_opt_value = FLAG_opt; + bool prev_always_opt_value = FLAG_always_opt; + FLAG_always_opt = false; + FLAG_opt = false; + const char* source = "function f() { return 'abc'; }; f() + 'def'"; + v8::ScriptCompiler::CachedData* cache = + ProduceCache(source, CodeCacheType::kAfterExecute); + + v8::Isolate::CreateParams create_params; + create_params.array_buffer_allocator = CcTest::array_buffer_allocator(); + v8::Isolate* isolate2 = v8::Isolate::New(create_params); + + { + v8::Isolate::Scope iscope(isolate2); + v8::HandleScope scope(isolate2); + v8::Local<v8::Context> context = v8::Context::New(isolate2); + v8::Context::Scope context_scope(context); + + v8::Local<v8::String> source_str = v8_str(source); + v8::ScriptOrigin origin(v8_str("test")); + v8::ScriptCompiler::Source source(source_str, origin, cache); + v8::Local<v8::UnboundScript> script; + { + DisallowCompilation no_compile_expected( + reinterpret_cast<Isolate*>(isolate2)); + script = v8::ScriptCompiler::CompileUnboundScript( + isolate2, &source, v8::ScriptCompiler::kConsumeCodeCache) + .ToLocalChecked(); + } + CHECK(!cache->rejected); + CheckDeserializedFlag(script); + + Handle<SharedFunctionInfo> sfi = v8::Utils::OpenHandle(*script); + CHECK(sfi->HasBytecodeArray()); + BytecodeArray* bytecode = sfi->bytecode_array(); + CHECK_EQ(bytecode->interrupt_budget(), + interpreter::Interpreter::kInterruptBudget); + CHECK_EQ(bytecode->osr_loop_nesting_level(), 0); + + { + DisallowCompilation no_compile_expected( + reinterpret_cast<Isolate*>(isolate2)); + v8::Local<v8::Value> result = script->BindToCurrentContext() + ->Run(isolate2->GetCurrentContext()) + .ToLocalChecked(); + v8::Local<v8::String> result_string = + result->ToString(isolate2->GetCurrentContext()).ToLocalChecked(); + CHECK( + result_string->Equals(isolate2->GetCurrentContext(), v8_str("abcdef")) + .FromJust()); + } + } + isolate2->Dispose(); + + // Restore the flags. + FLAG_always_opt = prev_always_opt_value; + FLAG_opt = prev_opt_value; +} + TEST(CodeSerializerFlagChange) { const char* source = "function f() { return 'abc'; }; f() + 'def'"; v8::ScriptCompiler::CachedData* cache = ProduceCache(source); @@ -2241,6 +2330,9 @@ class SerializedExtension : public v8::Extension { } }; +static SerializerOneByteResource serializable_one_byte_resource("one_byte", 8); +static SerializerTwoByteResource serializable_two_byte_resource("two_byte", 8); + intptr_t original_external_references[] = { reinterpret_cast<intptr_t>(SerializedCallback), reinterpret_cast<intptr_t>(&serialized_static_field), @@ -2248,6 +2340,8 @@ intptr_t original_external_references[] = { reinterpret_cast<intptr_t>(&AccessorForSerialization), reinterpret_cast<intptr_t>(&SerializedExtension::FunctionCallback), reinterpret_cast<intptr_t>(&serialized_static_field), // duplicate entry + reinterpret_cast<intptr_t>(&serializable_one_byte_resource), + reinterpret_cast<intptr_t>(&serializable_two_byte_resource), 0}; intptr_t replaced_external_references[] = { @@ -2257,6 +2351,8 @@ intptr_t replaced_external_references[] = { reinterpret_cast<intptr_t>(&AccessorForSerialization), reinterpret_cast<intptr_t>(&SerializedExtension::FunctionCallback), reinterpret_cast<intptr_t>(&serialized_static_field), + reinterpret_cast<intptr_t>(&serializable_one_byte_resource), + reinterpret_cast<intptr_t>(&serializable_two_byte_resource), 0}; intptr_t short_external_references[] = { @@ -2277,13 +2373,32 @@ TEST(SnapshotCreatorExternalReferences) { v8::Local<v8::Value> function = callback->GetFunction(context).ToLocalChecked(); CHECK(context->Global()->Set(context, v8_str("f"), function).FromJust()); + + CHECK(context->Global() + ->Set(context, v8_str("one_byte"), + v8::String::NewExternalOneByte( + isolate, &serializable_one_byte_resource) + .ToLocalChecked()) + .FromJust()); + CHECK(context->Global() + ->Set(context, v8_str("two_byte"), + v8::String::NewExternalTwoByte( + isolate, &serializable_two_byte_resource) + .ToLocalChecked()) + .FromJust()); + ExpectInt32("f()", 42); + ExpectString("one_byte", "one_byte"); + ExpectString("two_byte", "two_byte"); creator.SetDefaultContext(context); } blob = creator.CreateBlob(v8::SnapshotCreator::FunctionCodeHandling::kClear); } + CHECK_EQ(1, serializable_one_byte_resource.dispose_count()); + CHECK_EQ(1, serializable_two_byte_resource.dispose_count()); + // Deserialize with the original external reference. { v8::Isolate::CreateParams params; @@ -2298,10 +2413,17 @@ TEST(SnapshotCreatorExternalReferences) { v8::Local<v8::Context> context = v8::Context::New(isolate); v8::Context::Scope context_scope(context); ExpectInt32("f()", 42); + ExpectString("one_byte", "one_byte"); + ExpectString("two_byte", "two_byte"); + CHECK(CompileRun("one_byte").As<v8::String>()->IsExternalOneByte()); + CHECK(CompileRun("two_byte").As<v8::String>()->IsExternal()); } isolate->Dispose(); } + CHECK_EQ(2, serializable_one_byte_resource.dispose_count()); + CHECK_EQ(2, serializable_two_byte_resource.dispose_count()); + // Deserialize with some other external reference. { v8::Isolate::CreateParams params; @@ -2319,6 +2441,10 @@ TEST(SnapshotCreatorExternalReferences) { } isolate->Dispose(); } + + CHECK_EQ(3, serializable_one_byte_resource.dispose_count()); + CHECK_EQ(3, serializable_two_byte_resource.dispose_count()); + delete[] blob.data; } @@ -2650,6 +2776,231 @@ TEST(SnapshotCreatorTemplates) { delete[] blob.data; } +TEST(SnapshotCreatorAddData) { + DisableAlwaysOpt(); + v8::StartupData blob; + + { + v8::SnapshotCreator creator; + v8::Isolate* isolate = creator.GetIsolate(); + v8::Eternal<v8::Value> eternal_number; + v8::Persistent<v8::Value> persistent_number_1; + v8::Persistent<v8::Value> persistent_number_2; + v8::Persistent<v8::Context> persistent_context; + { + v8::HandleScope handle_scope(isolate); + + eternal_number.Set(isolate, v8_num(2017)); + persistent_number_1.Reset(isolate, v8_num(2018)); + persistent_number_2.Reset(isolate, v8_num(2019)); + + v8::Local<v8::Context> context = v8::Context::New(isolate); + CHECK_EQ(0u, creator.AddData(context, persistent_number_2.Get(isolate))); + creator.SetDefaultContext(context); + context = v8::Context::New(isolate); + persistent_context.Reset(isolate, context); + + v8::Context::Scope context_scope(context); + + v8::Local<v8::Object> object = CompileRun("({ p: 12 })").As<v8::Object>(); + + v8::Local<v8::ObjectTemplate> object_template = + v8::ObjectTemplate::New(isolate); + object_template->SetInternalFieldCount(3); + + v8::Local<v8::Private> private_symbol = + v8::Private::ForApi(isolate, v8_str("private_symbol")); + + v8::Local<v8::Signature> signature = + v8::Signature::New(isolate, v8::FunctionTemplate::New(isolate)); + + v8::Local<v8::AccessorSignature> accessor_signature = + v8::AccessorSignature::New(isolate, + v8::FunctionTemplate::New(isolate)); + + CHECK_EQ(0u, creator.AddData(context, object)); + CHECK_EQ(1u, creator.AddData(context, v8_str("context-dependent"))); + CHECK_EQ(2u, creator.AddData(context, persistent_number_1.Get(isolate))); + CHECK_EQ(3u, creator.AddData(context, object_template)); + CHECK_EQ(4u, creator.AddData(context, persistent_context.Get(isolate))); + creator.AddContext(context); + + CHECK_EQ(0u, creator.AddData(v8_str("context-independent"))); + CHECK_EQ(1u, creator.AddData(eternal_number.Get(isolate))); + CHECK_EQ(2u, creator.AddData(object_template)); + CHECK_EQ(3u, creator.AddData(v8::FunctionTemplate::New(isolate))); + CHECK_EQ(4u, creator.AddData(private_symbol)); + CHECK_EQ(5u, creator.AddData(signature)); + CHECK_EQ(6u, creator.AddData(accessor_signature)); + } + + blob = + creator.CreateBlob(v8::SnapshotCreator::FunctionCodeHandling::kClear); + } + + { + v8::Isolate::CreateParams params; + params.snapshot_blob = &blob; + params.array_buffer_allocator = CcTest::array_buffer_allocator(); + // Test-appropriate equivalent of v8::Isolate::New. + v8::Isolate* isolate = TestIsolate::New(params); + { + v8::Isolate::Scope isolate_scope(isolate); + v8::HandleScope handle_scope(isolate); + v8::Local<v8::Context> context = + v8::Context::FromSnapshot(isolate, 0).ToLocalChecked(); + + // Check serialized data on the context. + v8::Local<v8::Object> object = + context->GetDataFromSnapshotOnce<v8::Object>(0).ToLocalChecked(); + CHECK(context->GetDataFromSnapshotOnce<v8::Object>(0).IsEmpty()); + CHECK_EQ(12, object->Get(context, v8_str("p")) + .ToLocalChecked() + ->Int32Value(context) + .FromJust()); + + v8::Local<v8::String> string = + context->GetDataFromSnapshotOnce<v8::String>(1).ToLocalChecked(); + CHECK(context->GetDataFromSnapshotOnce<v8::String>(1).IsEmpty()); + CHECK(string->Equals(context, v8_str("context-dependent")).FromJust()); + + v8::Local<v8::Number> number = + context->GetDataFromSnapshotOnce<v8::Number>(2).ToLocalChecked(); + CHECK(context->GetDataFromSnapshotOnce<v8::Number>(2).IsEmpty()); + CHECK_EQ(2018, number->Int32Value(context).FromJust()); + + v8::Local<v8::ObjectTemplate> templ = + context->GetDataFromSnapshotOnce<v8::ObjectTemplate>(3) + .ToLocalChecked(); + CHECK(context->GetDataFromSnapshotOnce<v8::ObjectTemplate>(3).IsEmpty()); + CHECK_EQ(3, templ->InternalFieldCount()); + + v8::Local<v8::Context> serialized_context = + context->GetDataFromSnapshotOnce<v8::Context>(4).ToLocalChecked(); + CHECK(context->GetDataFromSnapshotOnce<v8::Context>(4).IsEmpty()); + CHECK_EQ(*v8::Utils::OpenHandle(*serialized_context), + *v8::Utils::OpenHandle(*context)); + + CHECK(context->GetDataFromSnapshotOnce<v8::Value>(5).IsEmpty()); + + // Check serialized data on the isolate. + string = isolate->GetDataFromSnapshotOnce<v8::String>(0).ToLocalChecked(); + CHECK(context->GetDataFromSnapshotOnce<v8::String>(0).IsEmpty()); + CHECK(string->Equals(context, v8_str("context-independent")).FromJust()); + + number = isolate->GetDataFromSnapshotOnce<v8::Number>(1).ToLocalChecked(); + CHECK(isolate->GetDataFromSnapshotOnce<v8::Number>(1).IsEmpty()); + CHECK_EQ(2017, number->Int32Value(context).FromJust()); + + templ = isolate->GetDataFromSnapshotOnce<v8::ObjectTemplate>(2) + .ToLocalChecked(); + CHECK(isolate->GetDataFromSnapshotOnce<v8::ObjectTemplate>(2).IsEmpty()); + CHECK_EQ(3, templ->InternalFieldCount()); + + isolate->GetDataFromSnapshotOnce<v8::FunctionTemplate>(3) + .ToLocalChecked(); + CHECK( + isolate->GetDataFromSnapshotOnce<v8::FunctionTemplate>(3).IsEmpty()); + + isolate->GetDataFromSnapshotOnce<v8::Private>(4).ToLocalChecked(); + CHECK( + isolate->GetDataFromSnapshotOnce<v8::Private>(4).IsEmpty()); + + isolate->GetDataFromSnapshotOnce<v8::Signature>(5).ToLocalChecked(); + CHECK(isolate->GetDataFromSnapshotOnce<v8::Signature>(5).IsEmpty()); + + isolate->GetDataFromSnapshotOnce<v8::AccessorSignature>(6) + .ToLocalChecked(); + CHECK( + isolate->GetDataFromSnapshotOnce<v8::AccessorSignature>(6).IsEmpty()); + + CHECK(isolate->GetDataFromSnapshotOnce<v8::Value>(7).IsEmpty()); + } + isolate->Dispose(); + } + { + SnapshotCreator creator(nullptr, &blob); + v8::Isolate* isolate = creator.GetIsolate(); + { + // Adding data to a snapshot replaces the list of existing data. + v8::HandleScope hscope(isolate); + v8::Local<v8::Context> context = v8::Context::New(isolate); + creator.SetDefaultContext(context); + context = v8::Context::FromSnapshot(isolate, 0).ToLocalChecked(); + v8::Local<v8::String> string = + context->GetDataFromSnapshotOnce<v8::String>(1).ToLocalChecked(); + CHECK(context->GetDataFromSnapshotOnce<v8::String>(1).IsEmpty()); + CHECK(string->Equals(context, v8_str("context-dependent")).FromJust()); + v8::Local<v8::Number> number = + isolate->GetDataFromSnapshotOnce<v8::Number>(1).ToLocalChecked(); + CHECK(isolate->GetDataFromSnapshotOnce<v8::Number>(1).IsEmpty()); + CHECK_EQ(2017, number->Int32Value(context).FromJust()); + + CHECK_EQ(0u, creator.AddData(context, v8_num(2016))); + CHECK_EQ(0u, creator.AddContext(context)); + CHECK_EQ(0u, creator.AddData(v8_str("stuff"))); + } + delete[] blob.data; + blob = + creator.CreateBlob(v8::SnapshotCreator::FunctionCodeHandling::kClear); + } + { + v8::Isolate::CreateParams params; + params.snapshot_blob = &blob; + params.array_buffer_allocator = CcTest::array_buffer_allocator(); + // Test-appropriate equivalent of v8::Isolate::New. + v8::Isolate* isolate = TestIsolate::New(params); + { + v8::Isolate::Scope isolate_scope(isolate); + v8::HandleScope handle_scope(isolate); + + // Context where we did not re-add data no longer has data. + v8::Local<v8::Context> context = v8::Context::New(isolate); + CHECK(context->GetDataFromSnapshotOnce<v8::Object>(0).IsEmpty()); + + // Context where we re-added data has completely new ones. + context = v8::Context::FromSnapshot(isolate, 0).ToLocalChecked(); + v8::Local<v8::Value> value = + context->GetDataFromSnapshotOnce<v8::Value>(0).ToLocalChecked(); + CHECK_EQ(2016, value->Int32Value(context).FromJust()); + CHECK(context->GetDataFromSnapshotOnce<v8::Value>(1).IsEmpty()); + + // Ditto for the isolate. + v8::Local<v8::String> string = + isolate->GetDataFromSnapshotOnce<v8::String>(0).ToLocalChecked(); + CHECK(string->Equals(context, v8_str("stuff")).FromJust()); + CHECK(context->GetDataFromSnapshotOnce<v8::String>(1).IsEmpty()); + } + isolate->Dispose(); + } + delete[] blob.data; +} + +TEST(SnapshotCreatorUnknownHandles) { + DisableAlwaysOpt(); + v8::StartupData blob; + + { + v8::SnapshotCreator creator; + v8::Isolate* isolate = creator.GetIsolate(); + v8::Eternal<v8::Value> eternal_number; + v8::Persistent<v8::Value> persistent_number; + { + v8::HandleScope handle_scope(isolate); + + eternal_number.Set(isolate, v8_num(2017)); + persistent_number.Reset(isolate, v8_num(2018)); + + v8::Local<v8::Context> context = v8::Context::New(isolate); + creator.SetDefaultContext(context); + } + + blob = + creator.CreateBlob(v8::SnapshotCreator::FunctionCodeHandling::kClear); + } + delete[] blob.data; +} + TEST(SnapshotCreatorIncludeGlobalProxy) { DisableAlwaysOpt(); v8::StartupData blob; diff --git a/deps/v8/test/cctest/test-strings.cc b/deps/v8/test/cctest/test-strings.cc index 66a221f948..ba6186828d 100644 --- a/deps/v8/test/cctest/test-strings.cc +++ b/deps/v8/test/cctest/test-strings.cc @@ -50,8 +50,8 @@ class MyRandomNumberGenerator { init(); } - void init(uint32_t seed = 0x5688c73e) { - static const uint32_t phi = 0x9e3779b9; + void init(uint32_t seed = 0x5688C73E) { + static const uint32_t phi = 0x9E3779B9; c = 362436; i = kQSize-1; Q[0] = seed; @@ -64,7 +64,7 @@ class MyRandomNumberGenerator { uint32_t next() { uint64_t a = 18782; - uint32_t r = 0xfffffffe; + uint32_t r = 0xFFFFFFFE; i = (i + 1) & (kQSize-1); uint64_t t = a * Q[i] + c; c = (t >> 32); diff --git a/deps/v8/test/cctest/test-strtod.cc b/deps/v8/test/cctest/test-strtod.cc index 2a9bf99723..68cf9783b1 100644 --- a/deps/v8/test/cctest/test-strtod.cc +++ b/deps/v8/test/cctest/test-strtod.cc @@ -436,8 +436,8 @@ static uint32_t DeterministicRandom() { // Initialization values don't have any special meaning. (They are the result // of two calls to rand().) - if (hi == 0) hi = 0xbfe166e7; - if (lo == 0) lo = 0x64d1c3c9; + if (hi == 0) hi = 0xBFE166E7; + if (lo == 0) lo = 0x64D1C3C9; // Mix the bits. hi = 36969 * (hi & 0xFFFF) + (hi >> 16); diff --git a/deps/v8/test/cctest/test-sync-primitives-arm.cc b/deps/v8/test/cctest/test-sync-primitives-arm.cc index 403d41ffe9..c99b462319 100644 --- a/deps/v8/test/cctest/test-sync-primitives-arm.cc +++ b/deps/v8/test/cctest/test-sync-primitives-arm.cc @@ -29,11 +29,11 @@ #include "test/cctest/assembler-helper-arm.h" #include "test/cctest/cctest.h" -#include "src/arm/simulator-arm.h" #include "src/assembler-inl.h" #include "src/disassembler.h" #include "src/factory.h" #include "src/macro-assembler.h" +#include "src/simulator.h" namespace v8 { namespace internal { @@ -198,16 +198,15 @@ void TestInvalidateExclusiveAccess(TestData initial_data, MemoryAccess access1, Isolate* isolate = CcTest::i_isolate(); HandleScope scope(isolate); - F_piiii f = FUNCTION_CAST<F_piiii>(AssembleCode([&](Assembler& assm) { + auto f = AssembleCode<int(TestData*, int, int, int)>([&](Assembler& assm) { AssembleLoadExcl(&assm, access1, r1, r1); AssembleMemoryAccess(&assm, access2, r3, r2, r1); AssembleStoreExcl(&assm, access3, r0, r3, r1); - })); + }); TestData t = initial_data; - int res = - reinterpret_cast<int>(CALL_GENERATED_CODE(isolate, f, &t, 0, 0, 0, 0)); + int res = f.Call(&t, 0, 0, 0); CHECK_EQ(expected_res, res); switch (access3.size) { case MemoryAccess::Size::Byte: @@ -267,12 +266,11 @@ namespace { int ExecuteMemoryAccess(Isolate* isolate, TestData* test_data, MemoryAccess access) { HandleScope scope(isolate); - F_piiii f = FUNCTION_CAST<F_piiii>(AssembleCode([&](Assembler& assm) { + auto f = AssembleCode<int(TestData*, int, int)>([&](Assembler& assm) { AssembleMemoryAccess(&assm, access, r0, r2, r1); - })); + }); - return reinterpret_cast<int>( - CALL_GENERATED_CODE(isolate, f, test_data, 0, 0, 0, 0)); + return f.Call(test_data, 0, 0); } } // namespace diff --git a/deps/v8/test/cctest/test-sync-primitives-arm64.cc b/deps/v8/test/cctest/test-sync-primitives-arm64.cc index a4edee69fa..348faf81f7 100644 --- a/deps/v8/test/cctest/test-sync-primitives-arm64.cc +++ b/deps/v8/test/cctest/test-sync-primitives-arm64.cc @@ -209,10 +209,7 @@ void TestInvalidateExclusiveAccess(TestData initial_data, MemoryAccess access1, isolate->factory()->NewCode(desc, Code::STUB, Handle<Code>()); TestData t = initial_data; - Simulator::CallArgument args[] = { - Simulator::CallArgument(reinterpret_cast<uintptr_t>(&t)), - Simulator::CallArgument::End()}; - Simulator::current(isolate)->CallVoid(code->entry(), args); + Simulator::current(isolate)->Call<void>(code->entry(), &t); int res = Simulator::current(isolate)->wreg(0); CHECK_EQ(expected_res, res); @@ -283,10 +280,7 @@ int ExecuteMemoryAccess(Isolate* isolate, TestData* test_data, masm.GetCode(isolate, &desc); Handle<Code> code = isolate->factory()->NewCode(desc, Code::STUB, Handle<Code>()); - Simulator::CallArgument args[] = { - Simulator::CallArgument(reinterpret_cast<uintptr_t>(test_data)), - Simulator::CallArgument::End()}; - Simulator::current(isolate)->CallVoid(code->entry(), args); + Simulator::current(isolate)->Call<void>(code->entry(), test_data); return Simulator::current(isolate)->wreg(0); } diff --git a/deps/v8/test/cctest/test-thread-termination.cc b/deps/v8/test/cctest/test-thread-termination.cc index af8e41d2cf..21bdb645a5 100644 --- a/deps/v8/test/cctest/test-thread-termination.cc +++ b/deps/v8/test/cctest/test-thread-termination.cc @@ -45,11 +45,7 @@ void TerminateCurrentThread(const v8::FunctionCallbackInfo<v8::Value>& args) { args.GetIsolate()->TerminateExecution(); } - -void Fail(const v8::FunctionCallbackInfo<v8::Value>& args) { - CHECK(false); -} - +void Fail(const v8::FunctionCallbackInfo<v8::Value>& args) { UNREACHABLE(); } void Loop(const v8::FunctionCallbackInfo<v8::Value>& args) { CHECK(!args.GetIsolate()->IsExecutionTerminating()); @@ -406,7 +402,7 @@ TEST(TerminateCancelTerminateFromThreadItself) { void MicrotaskShouldNotRun(const v8::FunctionCallbackInfo<v8::Value>& info) { - CHECK(false); + UNREACHABLE(); } diff --git a/deps/v8/test/cctest/test-traced-value.cc b/deps/v8/test/cctest/test-traced-value.cc index 1c3e7ac252..3a33389a3e 100644 --- a/deps/v8/test/cctest/test-traced-value.cc +++ b/deps/v8/test/cctest/test-traced-value.cc @@ -114,13 +114,13 @@ TEST(Escaping) { std::string json; value->AppendAsTraceFormat(&json); // Cannot use the expected value literal directly in CHECK_EQ - // as it fails to process # character on Windows. + // as it fails to process the # character on Windows. const char* expected = "{\"a\":\"abc\\\"\'\\\\\\\\x\\\"y\'z\\n\\t\\u0017\",\"b\":" "\"\\u0001\\u0002\\u0003\\u0004\\u0005\\u0006\\u0007\\u0008\\t\\n\\u000B" "\\u000C\\u000D\\u000E\\u000F\\u0010\\u0011\\u0012\\u0013\\u0014\\u0015\\" "u0016\\u0017\\u0018\\u0019\\u001A\\u001B\\u001C\\u001D\\u001E\\u001F " "!\\\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\\\]^_`" - "abcdefghijklmnopqrstuvwxyz{|}~\177\"}"; + "abcdefghijklmnopqrstuvwxyz{|}~\x7F\"}"; CHECK_EQ(expected, json); } diff --git a/deps/v8/test/cctest/test-typedarrays.cc b/deps/v8/test/cctest/test-typedarrays.cc index 723a6f0680..c785b45022 100644 --- a/deps/v8/test/cctest/test-typedarrays.cc +++ b/deps/v8/test/cctest/test-typedarrays.cc @@ -85,5 +85,79 @@ TEST(AllocateNotExternal) { CHECK_EQ(memory, buffer->GetContents().Data()); } +void TestSpeciesProtector(char* code, + bool invalidates_species_protector = true) { + v8::Isolate::CreateParams create_params; + create_params.array_buffer_allocator = CcTest::array_buffer_allocator(); + std::string typed_array_constructors[] = { +#define TYPED_ARRAY_CTOR(Type, type, TYPE, ctype, size) #Type "Array", + + TYPED_ARRAYS(TYPED_ARRAY_CTOR) +#undef TYPED_ARRAY_CTOR + }; + + for (auto& constructor : typed_array_constructors) { + v8::Isolate* isolate = v8::Isolate::New(create_params); + isolate->Enter(); + { + LocalContext context(isolate); + v8::HandleScope scope(isolate); + v8::TryCatch try_catch(isolate); + + CompileRun(("let x = new " + constructor + "();").c_str()); + CompileRun(("let constructor = " + constructor + ";").c_str()); + v8::Local<v8::Value> constructor_obj = CompileRun(constructor.c_str()); + CHECK_EQ(constructor_obj, CompileRun("x.slice().constructor")); + CHECK_EQ(constructor_obj, CompileRun("x.map(()=>{}).constructor")); + std::string decl = "class MyTypedArray extends " + constructor + " { }"; + CompileRun(decl.c_str()); + + v8::internal::Isolate* i_isolate = + reinterpret_cast<v8::internal::Isolate*>(isolate); + CHECK(i_isolate->IsArraySpeciesLookupChainIntact()); + CompileRun(code); + if (invalidates_species_protector) { + CHECK(!i_isolate->IsArraySpeciesLookupChainIntact()); + } else { + CHECK(i_isolate->IsArraySpeciesLookupChainIntact()); + } + + v8::Local<v8::Value> my_typed_array = CompileRun("MyTypedArray"); + CHECK_EQ(my_typed_array, CompileRun("x.slice().constructor")); + CHECK_EQ(my_typed_array, CompileRun("x.map(()=>{}).constructor")); + } + isolate->Exit(); + isolate->Dispose(); + } +} + +UNINITIALIZED_TEST(SpeciesConstructor) { + char code[] = "x.constructor = MyTypedArray"; + TestSpeciesProtector(code); +} + +UNINITIALIZED_TEST(SpeciesConstructorAccessor) { + char code[] = + "Object.defineProperty(x, 'constructor',{get() {return MyTypedArray;}})"; + TestSpeciesProtector(code); +} + +UNINITIALIZED_TEST(SpeciesModified) { + char code[] = + "Object.defineProperty(constructor, Symbol.species, " + "{value:MyTypedArray})"; + TestSpeciesProtector(code); +} + +UNINITIALIZED_TEST(SpeciesParentConstructor) { + char code[] = "constructor.prototype.constructor = MyTypedArray"; + TestSpeciesProtector(code); +} + +UNINITIALIZED_TEST(SpeciesProto) { + char code[] = "x.__proto__ = MyTypedArray.prototype"; + TestSpeciesProtector(code, false); +} + } // namespace internal } // namespace v8 diff --git a/deps/v8/test/cctest/test-types.cc b/deps/v8/test/cctest/test-types.cc index fcd09eaee5..126e64c7de 100644 --- a/deps/v8/test/cctest/test-types.cc +++ b/deps/v8/test/cctest/test-types.cc @@ -111,7 +111,7 @@ struct Tests { CHECK(this->IsBitset(T.Any)); CHECK(bitset(0) == this->AsBitset(T.None)); - CHECK(bitset(0xfffffffeu) == this->AsBitset(T.Any)); + CHECK(bitset(0xFFFFFFFEu) == this->AsBitset(T.Any)); // Union(T1, T2) is bitset for bitsets T1,T2 for (TypeIterator it1 = T.types.begin(); it1 != T.types.end(); ++it1) { @@ -224,38 +224,38 @@ struct Tests { Factory* fac = isolate->factory(); CHECK(T.NewConstant(fac->NewNumber(0))->Is(T.UnsignedSmall)); CHECK(T.NewConstant(fac->NewNumber(1))->Is(T.UnsignedSmall)); - CHECK(T.NewConstant(fac->NewNumber(0x3fffffff))->Is(T.UnsignedSmall)); + CHECK(T.NewConstant(fac->NewNumber(0x3FFFFFFF))->Is(T.UnsignedSmall)); CHECK(T.NewConstant(fac->NewNumber(-1))->Is(T.Negative31)); - CHECK(T.NewConstant(fac->NewNumber(-0x3fffffff))->Is(T.Negative31)); + CHECK(T.NewConstant(fac->NewNumber(-0x3FFFFFFF))->Is(T.Negative31)); CHECK(T.NewConstant(fac->NewNumber(-0x40000000))->Is(T.Negative31)); CHECK(T.NewConstant(fac->NewNumber(0x40000000))->Is(T.Unsigned31)); CHECK(!T.NewConstant(fac->NewNumber(0x40000000))->Is(T.Unsigned30)); - CHECK(T.NewConstant(fac->NewNumber(0x7fffffff))->Is(T.Unsigned31)); - CHECK(!T.NewConstant(fac->NewNumber(0x7fffffff))->Is(T.Unsigned30)); + CHECK(T.NewConstant(fac->NewNumber(0x7FFFFFFF))->Is(T.Unsigned31)); + CHECK(!T.NewConstant(fac->NewNumber(0x7FFFFFFF))->Is(T.Unsigned30)); CHECK(T.NewConstant(fac->NewNumber(-0x40000001))->Is(T.Negative32)); CHECK(!T.NewConstant(fac->NewNumber(-0x40000001))->Is(T.Negative31)); - CHECK(T.NewConstant(fac->NewNumber(-0x7fffffff))->Is(T.Negative32)); - CHECK(!T.NewConstant(fac->NewNumber(-0x7fffffff - 1))->Is(T.Negative31)); + CHECK(T.NewConstant(fac->NewNumber(-0x7FFFFFFF))->Is(T.Negative32)); + CHECK(!T.NewConstant(fac->NewNumber(-0x7FFFFFFF - 1))->Is(T.Negative31)); if (SmiValuesAre31Bits()) { CHECK(!T.NewConstant(fac->NewNumber(0x40000000))->Is(T.UnsignedSmall)); - CHECK(!T.NewConstant(fac->NewNumber(0x7fffffff))->Is(T.UnsignedSmall)); + CHECK(!T.NewConstant(fac->NewNumber(0x7FFFFFFF))->Is(T.UnsignedSmall)); CHECK(!T.NewConstant(fac->NewNumber(-0x40000001))->Is(T.SignedSmall)); - CHECK(!T.NewConstant(fac->NewNumber(-0x7fffffff - 1))->Is(T.SignedSmall)); + CHECK(!T.NewConstant(fac->NewNumber(-0x7FFFFFFF - 1))->Is(T.SignedSmall)); } else { CHECK(SmiValuesAre32Bits()); CHECK(T.NewConstant(fac->NewNumber(0x40000000))->Is(T.UnsignedSmall)); - CHECK(T.NewConstant(fac->NewNumber(0x7fffffff))->Is(T.UnsignedSmall)); + CHECK(T.NewConstant(fac->NewNumber(0x7FFFFFFF))->Is(T.UnsignedSmall)); CHECK(T.NewConstant(fac->NewNumber(-0x40000001))->Is(T.SignedSmall)); - CHECK(T.NewConstant(fac->NewNumber(-0x7fffffff - 1))->Is(T.SignedSmall)); + CHECK(T.NewConstant(fac->NewNumber(-0x7FFFFFFF - 1))->Is(T.SignedSmall)); } CHECK(T.NewConstant(fac->NewNumber(0x80000000u))->Is(T.Unsigned32)); CHECK(!T.NewConstant(fac->NewNumber(0x80000000u))->Is(T.Unsigned31)); - CHECK(T.NewConstant(fac->NewNumber(0xffffffffu))->Is(T.Unsigned32)); - CHECK(!T.NewConstant(fac->NewNumber(0xffffffffu))->Is(T.Unsigned31)); - CHECK(T.NewConstant(fac->NewNumber(0xffffffffu + 1.0))->Is(T.PlainNumber)); - CHECK(!T.NewConstant(fac->NewNumber(0xffffffffu + 1.0))->Is(T.Integral32)); - CHECK(T.NewConstant(fac->NewNumber(-0x7fffffff - 2.0))->Is(T.PlainNumber)); - CHECK(!T.NewConstant(fac->NewNumber(-0x7fffffff - 2.0))->Is(T.Integral32)); + CHECK(T.NewConstant(fac->NewNumber(0xFFFFFFFFu))->Is(T.Unsigned32)); + CHECK(!T.NewConstant(fac->NewNumber(0xFFFFFFFFu))->Is(T.Unsigned31)); + CHECK(T.NewConstant(fac->NewNumber(0xFFFFFFFFu + 1.0))->Is(T.PlainNumber)); + CHECK(!T.NewConstant(fac->NewNumber(0xFFFFFFFFu + 1.0))->Is(T.Integral32)); + CHECK(T.NewConstant(fac->NewNumber(-0x7FFFFFFF - 2.0))->Is(T.PlainNumber)); + CHECK(!T.NewConstant(fac->NewNumber(-0x7FFFFFFF - 2.0))->Is(T.Integral32)); CHECK(T.NewConstant(fac->NewNumber(0.1))->Is(T.PlainNumber)); CHECK(!T.NewConstant(fac->NewNumber(0.1))->Is(T.Integral32)); CHECK(T.NewConstant(fac->NewNumber(-10.1))->Is(T.PlainNumber)); diff --git a/deps/v8/test/cctest/test-unboxed-doubles.cc b/deps/v8/test/cctest/test-unboxed-doubles.cc index 5f1584bc06..0245bf9e91 100644 --- a/deps/v8/test/cctest/test-unboxed-doubles.cc +++ b/deps/v8/test/cctest/test-unboxed-doubles.cc @@ -1519,7 +1519,7 @@ static void TestIncrementalWriteBarrier(Handle<Map> map, Handle<Map> new_map, // barrier. JSObject::MigrateToMap(obj, new_map); - uint64_t boom_value = UINT64_C(0xbaad0176a37c28e1); + uint64_t boom_value = UINT64_C(0xBAAD0176A37C28E1); FieldIndex double_field_index = FieldIndex::ForDescriptor(*new_map, double_descriptor); diff --git a/deps/v8/test/cctest/test-usecounters.cc b/deps/v8/test/cctest/test-usecounters.cc index a4512ac21d..5e37991252 100644 --- a/deps/v8/test/cctest/test-usecounters.cc +++ b/deps/v8/test/cctest/test-usecounters.cc @@ -60,31 +60,6 @@ TEST(AssigmentExpressionLHSIsCall) { use_counts[v8::Isolate::kAssigmentExpressionLHSIsCallInStrict] = 0; } -TEST(LabeledExpressionStatement) { - v8::Isolate* isolate = CcTest::isolate(); - v8::HandleScope scope(isolate); - LocalContext env; - int use_counts[v8::Isolate::kUseCounterFeatureCount] = {}; - global_use_counts = use_counts; - CcTest::isolate()->SetUseCounterCallback(MockUseCounterCallback); - - CompileRun("typeof a"); - CHECK_EQ(0, use_counts[v8::Isolate::kLabeledExpressionStatement]); - - CompileRun("foo: null"); - CHECK_EQ(1, use_counts[v8::Isolate::kLabeledExpressionStatement]); - - CompileRun("foo: bar: baz: undefined"); - CHECK_EQ(2, use_counts[v8::Isolate::kLabeledExpressionStatement]); - - CompileRun( - "foo: if (false);" - "bar: { }" - "baz: switch (false) { }" - "bat: do { } while (false);"); - CHECK_EQ(2, use_counts[v8::Isolate::kLabeledExpressionStatement]); -} - } // namespace test_usecounters } // namespace internal } // namespace v8 diff --git a/deps/v8/test/cctest/test-utils-arm64.cc b/deps/v8/test/cctest/test-utils-arm64.cc index b65b4a765a..e8bc58ffff 100644 --- a/deps/v8/test/cctest/test-utils-arm64.cc +++ b/deps/v8/test/cctest/test-utils-arm64.cc @@ -114,7 +114,7 @@ bool Equal32(uint32_t expected, const RegisterDump* core, const Register& reg) { // Retrieve the corresponding X register so we can check that the upper part // was properly cleared. int64_t result_x = core->xreg(reg.code()); - if ((result_x & 0xffffffff00000000L) != 0) { + if ((result_x & 0xFFFFFFFF00000000L) != 0) { printf("Expected 0x%08" PRIx32 "\t Found 0x%016" PRIx64 "\n", expected, result_x); return false; @@ -146,7 +146,7 @@ bool EqualFP32(float expected, const RegisterDump* core, // Retrieve the corresponding D register so we can check that the upper part // was properly cleared. uint64_t result_64 = core->dreg_bits(fpreg.code()); - if ((result_64 & 0xffffffff00000000L) != 0) { + if ((result_64 & 0xFFFFFFFF00000000L) != 0) { printf("Expected 0x%08" PRIx32 " (%f)\t Found 0x%016" PRIx64 "\n", bit_cast<uint32_t>(expected), expected, result_64); return false; diff --git a/deps/v8/test/cctest/test-utils-arm64.h b/deps/v8/test/cctest/test-utils-arm64.h index a709240662..78b266cb0b 100644 --- a/deps/v8/test/cctest/test-utils-arm64.h +++ b/deps/v8/test/cctest/test-utils-arm64.h @@ -244,7 +244,7 @@ RegList PopulateVRegisterArray(VRegister* s, VRegister* d, VRegister* v, // top word anyway, so clobbering the full X registers should make tests more // rigorous. void Clobber(MacroAssembler* masm, RegList reg_list, - uint64_t const value = 0xfedcba9876543210UL); + uint64_t const value = 0xFEDCBA9876543210UL); // As Clobber, but for FP registers. void ClobberFP(MacroAssembler* masm, RegList reg_list, diff --git a/deps/v8/test/cctest/test-utils.cc b/deps/v8/test/cctest/test-utils.cc index de2b16203b..c1c15873e9 100644 --- a/deps/v8/test/cctest/test-utils.cc +++ b/deps/v8/test/cctest/test-utils.cc @@ -164,7 +164,7 @@ void TestMemMove(byte* area1, printf("diff at offset %d (%p): is %d, should be %d\n", i, reinterpret_cast<void*>(area1 + i), area1[i], area2[i]); } - CHECK(false); + FATAL("memmove error"); } } @@ -197,7 +197,7 @@ TEST(Collector) { const int kSequentialSize = 1000; const int kBlockSize = 7; for (int loop = 0; loop < kLoops; loop++) { - Vector<int> block = collector.AddBlock(7, 0xbadcafe); + Vector<int> block = collector.AddBlock(7, 0xBADCAFE); for (int i = 0; i < kSequentialSize; i++) { collector.Add(i); } @@ -212,7 +212,7 @@ TEST(Collector) { for (int j = 0; j < kBlockSize - 1; j++) { CHECK_EQ(j * 7, result[offset + j]); } - CHECK_EQ(0xbadcafe, result[offset + kBlockSize - 1]); + CHECK_EQ(0xBADCAFE, result[offset + kBlockSize - 1]); for (int j = 0; j < kSequentialSize; j++) { CHECK_EQ(j, result[offset + kBlockSize + j]); } diff --git a/deps/v8/test/cctest/test-weakmaps.cc b/deps/v8/test/cctest/test-weakmaps.cc index 8db1855cf5..546db6acf4 100644 --- a/deps/v8/test/cctest/test-weakmaps.cc +++ b/deps/v8/test/cctest/test-weakmaps.cc @@ -42,21 +42,6 @@ static Isolate* GetIsolateFrom(LocalContext* context) { return reinterpret_cast<Isolate*>((*context)->GetIsolate()); } - -static Handle<JSWeakMap> AllocateJSWeakMap(Isolate* isolate) { - Handle<Map> map = - isolate->factory()->NewMap(JS_WEAK_MAP_TYPE, JSWeakMap::kSize); - Handle<JSObject> weakmap_obj = isolate->factory()->NewJSObjectFromMap(map); - Handle<JSWeakMap> weakmap(JSWeakMap::cast(*weakmap_obj)); - // Do not leak handles for the hash table, it would make entries strong. - { - HandleScope scope(isolate); - Handle<ObjectHashTable> table = ObjectHashTable::New(isolate, 1); - weakmap->set_table(*table); - } - return weakmap; -} - static int NumberOfWeakCalls = 0; static void WeakPointerCallback(const v8::WeakCallbackInfo<void>& data) { std::pair<v8::Persistent<v8::Value>*, int>* p = @@ -74,7 +59,7 @@ TEST(Weakness) { Isolate* isolate = GetIsolateFrom(&context); Factory* factory = isolate->factory(); HandleScope scope(isolate); - Handle<JSWeakMap> weakmap = AllocateJSWeakMap(isolate); + Handle<JSWeakMap> weakmap = isolate->factory()->NewJSWeakMap(); GlobalHandles* global_handles = isolate->global_handles(); // Keep global reference to the key. @@ -127,7 +112,7 @@ TEST(Shrinking) { Isolate* isolate = GetIsolateFrom(&context); Factory* factory = isolate->factory(); HandleScope scope(isolate); - Handle<JSWeakMap> weakmap = AllocateJSWeakMap(isolate); + Handle<JSWeakMap> weakmap = isolate->factory()->NewJSWeakMap(); // Check initial capacity. CHECK_EQ(32, ObjectHashTable::cast(weakmap->table())->Capacity()); @@ -174,7 +159,7 @@ TEST(Regress2060a) { Handle<JSFunction> function = factory->NewFunctionForTest(factory->function_string()); Handle<JSObject> key = factory->NewJSObject(function); - Handle<JSWeakMap> weakmap = AllocateJSWeakMap(isolate); + Handle<JSWeakMap> weakmap = isolate->factory()->NewJSWeakMap(); // Start second old-space page so that values land on evacuation candidate. Page* first_page = heap->old_space()->anchor()->next_page(); @@ -226,7 +211,7 @@ TEST(Regress2060b) { CHECK(!heap->InNewSpace(*keys[i])); CHECK(!first_page->Contains(keys[i]->address())); } - Handle<JSWeakMap> weakmap = AllocateJSWeakMap(isolate); + Handle<JSWeakMap> weakmap = isolate->factory()->NewJSWeakMap(); for (int i = 0; i < 32; i++) { Handle<Smi> smi(Smi::FromInt(i), isolate); int32_t hash = keys[i]->GetOrCreateHash(isolate)->value(); @@ -250,7 +235,7 @@ TEST(Regress399527) { Heap* heap = isolate->heap(); { HandleScope scope(isolate); - AllocateJSWeakMap(isolate); + isolate->factory()->NewJSWeakMap(); heap::SimulateIncrementalMarking(heap); } // The weak map is marked black here but leaving the handle scope will make diff --git a/deps/v8/test/cctest/testcfg.py b/deps/v8/test/cctest/testcfg.py index d9c3c23609..28d1ab27f9 100644 --- a/deps/v8/test/cctest/testcfg.py +++ b/deps/v8/test/cctest/testcfg.py @@ -28,46 +28,44 @@ import os import shutil -from testrunner.local import commands +from testrunner.local import command from testrunner.local import testsuite from testrunner.local import utils from testrunner.objects import testcase +SHELL = 'cctest' -class CcTestSuite(testsuite.TestSuite): - SHELL = 'cctest' - - def __init__(self, name, root): - super(CcTestSuite, self).__init__(name, root) - if utils.IsWindows(): - build_dir = "build" - else: - build_dir = "out" +class TestSuite(testsuite.TestSuite): def ListTests(self, context): - shell = os.path.abspath(os.path.join(context.shell_dir, self.SHELL)) + shell = os.path.abspath(os.path.join(context.shell_dir, SHELL)) if utils.IsWindows(): shell += ".exe" - cmd = context.command_prefix + [shell, "--list"] + context.extra_flags - output = commands.Execute(cmd) + cmd = command.Command( + cmd_prefix=context.command_prefix, + shell=shell, + args=["--list"] + context.extra_flags) + output = cmd.execute() if output.exit_code != 0: - print ' '.join(cmd) + print cmd print output.stdout print output.stderr return [] - tests = [] - for test_desc in output.stdout.strip().split(): - test = testcase.TestCase(self, test_desc) - tests.append(test) + tests = map(self._create_test, output.stdout.strip().split()) tests.sort(key=lambda t: t.path) return tests - def GetShellForTestCase(self, testcase): - return self.SHELL + def _test_class(self): + return TestCase + + +class TestCase(testcase.TestCase): + def get_shell(self): + return SHELL - def GetParametersForTestCase(self, testcase, context): - return [testcase.path], testcase.flags + context.mode_flags, {} + def _get_files_params(self, ctx): + return [self.path] def GetSuite(name, root): - return CcTestSuite(name, root) + return TestSuite(name, root) diff --git a/deps/v8/test/cctest/trace-extension.cc b/deps/v8/test/cctest/trace-extension.cc index f0cc3cc2cc..00f9946180 100644 --- a/deps/v8/test/cctest/trace-extension.cc +++ b/deps/v8/test/cctest/trace-extension.cc @@ -67,10 +67,8 @@ v8::Local<v8::FunctionTemplate> TraceExtension::GetNativeFunctionTemplate( .ToLocalChecked()) .FromJust()) { return v8::FunctionTemplate::New(isolate, TraceExtension::JSEntrySPLevel2); - } else { - CHECK(false); - return v8::Local<v8::FunctionTemplate>(); } + UNREACHABLE(); } diff --git a/deps/v8/test/cctest/unicode-helpers.h b/deps/v8/test/cctest/unicode-helpers.h index a09a8cbb3e..ca75fb65d7 100644 --- a/deps/v8/test/cctest/unicode-helpers.h +++ b/deps/v8/test/cctest/unicode-helpers.h @@ -10,7 +10,7 @@ static int Ucs2CharLength(unibrow::uchar c) { if (c == unibrow::Utf8::kIncomplete || c == unibrow::Utf8::kBufferEmpty) { return 0; - } else if (c < 0xffff) { + } else if (c < 0xFFFF) { return 1; } else { return 2; @@ -19,12 +19,16 @@ static int Ucs2CharLength(unibrow::uchar c) { static int Utf8LengthHelper(const char* s) { unibrow::Utf8::Utf8IncrementalBuffer buffer(unibrow::Utf8::kBufferEmpty); + unibrow::Utf8::State state = unibrow::Utf8::State::kAccept; + int length = 0; - for (; *s != '\0'; s++) { - unibrow::uchar tmp = unibrow::Utf8::ValueOfIncremental(*s, &buffer); + 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(&buffer); + unibrow::uchar tmp = unibrow::Utf8::ValueOfIncrementalFinish(&state); length += Ucs2CharLength(tmp); return length; } 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 6907b8381e..f5c09b519e 100644 --- a/deps/v8/test/cctest/wasm/test-c-wasm-entry.cc +++ b/deps/v8/test/cctest/wasm/test-c-wasm-entry.cc @@ -71,6 +71,9 @@ class CWasmEntryArgTester { static_assert( arraysize(call_args) == compiler::CWasmEntryParameters::kNumParameters, "adapt this test"); + if (FLAG_wasm_jit_to_native) { + wasm_code_.GetWasmCode()->owner()->SetExecutable(true); + } MaybeHandle<Object> return_obj = Execution::Call( isolate_, c_wasm_entry_fn_, receiver, arraysize(call_args), call_args); CHECK(!return_obj.is_null()); diff --git a/deps/v8/test/cctest/wasm/test-run-wasm-64.cc b/deps/v8/test/cctest/wasm/test-run-wasm-64.cc index 3fe8b4ae99..3ded63730b 100644 --- a/deps/v8/test/cctest/wasm/test-run-wasm-64.cc +++ b/deps/v8/test/cctest/wasm/test-run-wasm-64.cc @@ -214,7 +214,7 @@ WASM_EXEC_TEST(I64ShlUseOnlyLowWord) { WASM_I64_SHL(WASM_GET_LOCAL(0), WASM_GET_LOCAL(1)))); FOR_INT64_INPUTS(i) { FOR_INT64_INPUTS(j) { - int32_t expected = static_cast<int32_t>((*i) << (*j & 0x3f)); + int32_t expected = static_cast<int32_t>((*i) << (*j & 0x3F)); CHECK_EQ(expected, r.Call(*i, *j)); } } @@ -228,7 +228,7 @@ WASM_EXEC_TEST(I64ShrUseOnlyLowWord) { WASM_I64_SHR(WASM_GET_LOCAL(0), WASM_GET_LOCAL(1)))); FOR_UINT64_INPUTS(i) { FOR_UINT64_INPUTS(j) { - int32_t expected = static_cast<int32_t>((*i) >> (*j & 0x3f)); + int32_t expected = static_cast<int32_t>((*i) >> (*j & 0x3F)); CHECK_EQ(expected, r.Call(*i, *j)); } } @@ -242,7 +242,7 @@ WASM_EXEC_TEST(I64SarUseOnlyLowWord) { WASM_I64_SAR(WASM_GET_LOCAL(0), WASM_GET_LOCAL(1)))); FOR_INT64_INPUTS(i) { FOR_INT64_INPUTS(j) { - int32_t expected = static_cast<int32_t>((*i) >> (*j & 0x3f)); + int32_t expected = static_cast<int32_t>((*i) >> (*j & 0x3F)); CHECK_EQ(expected, r.Call(*i, *j)); } } @@ -318,11 +318,11 @@ WASM_EXEC_TEST(I64DivU_Trap) { WASM_EXEC_TEST(I64DivU_Byzero_Const) { REQUIRE(I64DivU); - for (uint64_t denom = 0xfffffffffffffffe; denom < 8; denom++) { + for (uint64_t denom = 0xFFFFFFFFFFFFFFFE; denom < 8; denom++) { WasmRunner<uint64_t, uint64_t> r(execution_mode); BUILD(r, WASM_I64_DIVU(WASM_GET_LOCAL(0), WASM_I64V_1(denom))); - for (uint64_t val = 0xfffffffffffffff0; val < 8; val++) { + for (uint64_t val = 0xFFFFFFFFFFFFFFF0; val < 8; val++) { if (denom == 0) { CHECK_TRAP64(r.Call(val)); } else { @@ -418,7 +418,7 @@ WASM_EXEC_TEST(I64Shl) { FOR_UINT64_INPUTS(i) { FOR_UINT64_INPUTS(j) { - uint64_t expected = (*i) << (*j & 0x3f); + uint64_t expected = (*i) << (*j & 0x3F); CHECK_EQ(expected, r.Call(*i, *j)); } } @@ -453,7 +453,7 @@ WASM_EXEC_TEST(I64ShrU) { FOR_UINT64_INPUTS(i) { FOR_UINT64_INPUTS(j) { - uint64_t expected = (*i) >> (*j & 0x3f); + uint64_t expected = (*i) >> (*j & 0x3F); CHECK_EQ(expected, r.Call(*i, *j)); } } @@ -488,7 +488,7 @@ WASM_EXEC_TEST(I64ShrS) { FOR_INT64_INPUTS(i) { FOR_INT64_INPUTS(j) { - int64_t expected = (*i) >> (*j & 0x3f); + int64_t expected = (*i) >> (*j & 0x3F); CHECK_EQ(expected, r.Call(*i, *j)); } } @@ -632,11 +632,11 @@ WASM_EXEC_TEST(I64Popcnt) { struct { int64_t expected; uint64_t input; - } values[] = {{64, 0xffffffffffffffff}, + } values[] = {{64, 0xFFFFFFFFFFFFFFFF}, {0, 0x0000000000000000}, {2, 0x0000080000008000}, {26, 0x1123456782345678}, - {38, 0xffedcba09edcba09}}; + {38, 0xFFEDCBA09EDCBA09}}; WasmRunner<int64_t, uint64_t> r(execution_mode); BUILD(r, WASM_I64_POPCNT(WASM_GET_LOCAL(0))); @@ -658,81 +658,81 @@ WASM_EXEC_TEST(F32UConvertI64) { uint64_t input; uint32_t expected; } values[] = {{0x0, 0x0}, - {0x1, 0x3f800000}, - {0xffffffff, 0x4f800000}, - {0x1b09788b, 0x4dd84bc4}, - {0x4c5fce8, 0x4c98bf9d}, - {0xcc0de5bf, 0x4f4c0de6}, + {0x1, 0x3F800000}, + {0xFFFFFFFF, 0x4F800000}, + {0x1B09788B, 0x4DD84BC4}, + {0x4C5FCE8, 0x4C98BF9D}, + {0xCC0DE5BF, 0x4F4C0DE6}, {0x2, 0x40000000}, {0x3, 0x40400000}, {0x4, 0x40800000}, - {0x5, 0x40a00000}, + {0x5, 0x40A00000}, {0x8, 0x41000000}, {0x9, 0x41100000}, - {0xffffffffffffffff, 0x5f800000}, - {0xfffffffffffffffe, 0x5f800000}, - {0xfffffffffffffffd, 0x5f800000}, + {0xFFFFFFFFFFFFFFFF, 0x5F800000}, + {0xFFFFFFFFFFFFFFFE, 0x5F800000}, + {0xFFFFFFFFFFFFFFFD, 0x5F800000}, {0x0, 0x0}, - {0x100000000, 0x4f800000}, - {0xffffffff00000000, 0x5f800000}, - {0x1b09788b00000000, 0x5dd84bc4}, - {0x4c5fce800000000, 0x5c98bf9d}, - {0xcc0de5bf00000000, 0x5f4c0de6}, + {0x100000000, 0x4F800000}, + {0xFFFFFFFF00000000, 0x5F800000}, + {0x1B09788B00000000, 0x5DD84BC4}, + {0x4C5FCE800000000, 0x5C98BF9D}, + {0xCC0DE5BF00000000, 0x5F4C0DE6}, {0x200000000, 0x50000000}, {0x300000000, 0x50400000}, {0x400000000, 0x50800000}, - {0x500000000, 0x50a00000}, + {0x500000000, 0x50A00000}, {0x800000000, 0x51000000}, {0x900000000, 0x51100000}, - {0x273a798e187937a3, 0x5e1ce9e6}, - {0xece3af835495a16b, 0x5f6ce3b0}, - {0xb668ecc11223344, 0x5d3668ed}, - {0x9e, 0x431e0000}, + {0x273A798E187937A3, 0x5E1CE9E6}, + {0xECE3AF835495A16B, 0x5F6CE3B0}, + {0xB668ECC11223344, 0x5D3668ED}, + {0x9E, 0x431E0000}, {0x43, 0x42860000}, - {0xaf73, 0x472f7300}, - {0x116b, 0x458b5800}, - {0x658ecc, 0x4acb1d98}, - {0x2b3b4c, 0x4a2ced30}, - {0x88776655, 0x4f087766}, - {0x70000000, 0x4ee00000}, - {0x7200000, 0x4ce40000}, - {0x7fffffff, 0x4f000000}, - {0x56123761, 0x4eac246f}, - {0x7fffff00, 0x4efffffe}, - {0x761c4761eeeeeeee, 0x5eec388f}, - {0x80000000eeeeeeee, 0x5f000000}, - {0x88888888dddddddd, 0x5f088889}, - {0xa0000000dddddddd, 0x5f200000}, - {0xddddddddaaaaaaaa, 0x5f5dddde}, - {0xe0000000aaaaaaaa, 0x5f600000}, - {0xeeeeeeeeeeeeeeee, 0x5f6eeeef}, - {0xfffffffdeeeeeeee, 0x5f800000}, - {0xf0000000dddddddd, 0x5f700000}, - {0x7fffffdddddddd, 0x5b000000}, - {0x3fffffaaaaaaaa, 0x5a7fffff}, - {0x1fffffaaaaaaaa, 0x59fffffd}, - {0xfffff, 0x497ffff0}, - {0x7ffff, 0x48ffffe0}, - {0x3ffff, 0x487fffc0}, - {0x1ffff, 0x47ffff80}, - {0xffff, 0x477fff00}, - {0x7fff, 0x46fffe00}, - {0x3fff, 0x467ffc00}, - {0x1fff, 0x45fff800}, - {0xfff, 0x457ff000}, - {0x7ff, 0x44ffe000}, - {0x3ff, 0x447fc000}, - {0x1ff, 0x43ff8000}, - {0x3fffffffffff, 0x56800000}, - {0x1fffffffffff, 0x56000000}, - {0xfffffffffff, 0x55800000}, - {0x7ffffffffff, 0x55000000}, - {0x3ffffffffff, 0x54800000}, - {0x1ffffffffff, 0x54000000}, - {0x8000008000000000, 0x5f000000}, - {0x8000008000000001, 0x5f000001}, - {0x8000000000000400, 0x5f000000}, - {0x8000000000000401, 0x5f000000}}; + {0xAF73, 0x472F7300}, + {0x116B, 0x458B5800}, + {0x658ECC, 0x4ACB1D98}, + {0x2B3B4C, 0x4A2CED30}, + {0x88776655, 0x4F087766}, + {0x70000000, 0x4EE00000}, + {0x7200000, 0x4CE40000}, + {0x7FFFFFFF, 0x4F000000}, + {0x56123761, 0x4EAC246F}, + {0x7FFFFF00, 0x4EFFFFFE}, + {0x761C4761EEEEEEEE, 0x5EEC388F}, + {0x80000000EEEEEEEE, 0x5F000000}, + {0x88888888DDDDDDDD, 0x5F088889}, + {0xA0000000DDDDDDDD, 0x5F200000}, + {0xDDDDDDDDAAAAAAAA, 0x5F5DDDDE}, + {0xE0000000AAAAAAAA, 0x5F600000}, + {0xEEEEEEEEEEEEEEEE, 0x5F6EEEEF}, + {0xFFFFFFFDEEEEEEEE, 0x5F800000}, + {0xF0000000DDDDDDDD, 0x5F700000}, + {0x7FFFFFDDDDDDDD, 0x5B000000}, + {0x3FFFFFAAAAAAAA, 0x5A7FFFFF}, + {0x1FFFFFAAAAAAAA, 0x59FFFFFD}, + {0xFFFFF, 0x497FFFF0}, + {0x7FFFF, 0x48FFFFE0}, + {0x3FFFF, 0x487FFFC0}, + {0x1FFFF, 0x47FFFF80}, + {0xFFFF, 0x477FFF00}, + {0x7FFF, 0x46FFFE00}, + {0x3FFF, 0x467FFC00}, + {0x1FFF, 0x45FFF800}, + {0xFFF, 0x457FF000}, + {0x7FF, 0x44FFE000}, + {0x3FF, 0x447FC000}, + {0x1FF, 0x43FF8000}, + {0x3FFFFFFFFFFF, 0x56800000}, + {0x1FFFFFFFFFFF, 0x56000000}, + {0xFFFFFFFFFFF, 0x55800000}, + {0x7FFFFFFFFFF, 0x55000000}, + {0x3FFFFFFFFFF, 0x54800000}, + {0x1FFFFFFFFFF, 0x54000000}, + {0x8000008000000000, 0x5F000000}, + {0x8000008000000001, 0x5F000001}, + {0x8000000000000400, 0x5F000000}, + {0x8000000000000401, 0x5F000000}}; WasmRunner<float, uint64_t> r(execution_mode); BUILD(r, WASM_F32_UCONVERT_I64(WASM_GET_LOCAL(0))); for (size_t i = 0; i < arraysize(values); i++) { @@ -753,80 +753,80 @@ WASM_EXEC_TEST(F64UConvertI64) { uint64_t input; uint64_t expected; } values[] = {{0x0, 0x0}, - {0x1, 0x3ff0000000000000}, - {0xffffffff, 0x41efffffffe00000}, - {0x1b09788b, 0x41bb09788b000000}, - {0x4c5fce8, 0x419317f3a0000000}, - {0xcc0de5bf, 0x41e981bcb7e00000}, + {0x1, 0x3FF0000000000000}, + {0xFFFFFFFF, 0x41EFFFFFFFE00000}, + {0x1B09788B, 0x41BB09788B000000}, + {0x4C5FCE8, 0x419317F3A0000000}, + {0xCC0DE5BF, 0x41E981BCB7E00000}, {0x2, 0x4000000000000000}, {0x3, 0x4008000000000000}, {0x4, 0x4010000000000000}, {0x5, 0x4014000000000000}, {0x8, 0x4020000000000000}, {0x9, 0x4022000000000000}, - {0xffffffffffffffff, 0x43f0000000000000}, - {0xfffffffffffffffe, 0x43f0000000000000}, - {0xfffffffffffffffd, 0x43f0000000000000}, - {0x100000000, 0x41f0000000000000}, - {0xffffffff00000000, 0x43efffffffe00000}, - {0x1b09788b00000000, 0x43bb09788b000000}, - {0x4c5fce800000000, 0x439317f3a0000000}, - {0xcc0de5bf00000000, 0x43e981bcb7e00000}, + {0xFFFFFFFFFFFFFFFF, 0x43F0000000000000}, + {0xFFFFFFFFFFFFFFFE, 0x43F0000000000000}, + {0xFFFFFFFFFFFFFFFD, 0x43F0000000000000}, + {0x100000000, 0x41F0000000000000}, + {0xFFFFFFFF00000000, 0x43EFFFFFFFE00000}, + {0x1B09788B00000000, 0x43BB09788B000000}, + {0x4C5FCE800000000, 0x439317F3A0000000}, + {0xCC0DE5BF00000000, 0x43E981BCB7E00000}, {0x200000000, 0x4200000000000000}, {0x300000000, 0x4208000000000000}, {0x400000000, 0x4210000000000000}, {0x500000000, 0x4214000000000000}, {0x800000000, 0x4220000000000000}, {0x900000000, 0x4222000000000000}, - {0x273a798e187937a3, 0x43c39d3cc70c3c9c}, - {0xece3af835495a16b, 0x43ed9c75f06a92b4}, - {0xb668ecc11223344, 0x43a6cd1d98224467}, - {0x9e, 0x4063c00000000000}, - {0x43, 0x4050c00000000000}, - {0xaf73, 0x40e5ee6000000000}, - {0x116b, 0x40b16b0000000000}, - {0x658ecc, 0x415963b300000000}, - {0x2b3b4c, 0x41459da600000000}, - {0x88776655, 0x41e10eeccaa00000}, - {0x70000000, 0x41dc000000000000}, - {0x7200000, 0x419c800000000000}, - {0x7fffffff, 0x41dfffffffc00000}, - {0x56123761, 0x41d5848dd8400000}, - {0x7fffff00, 0x41dfffffc0000000}, - {0x761c4761eeeeeeee, 0x43dd8711d87bbbbc}, - {0x80000000eeeeeeee, 0x43e00000001dddde}, - {0x88888888dddddddd, 0x43e11111111bbbbc}, - {0xa0000000dddddddd, 0x43e40000001bbbbc}, - {0xddddddddaaaaaaaa, 0x43ebbbbbbbb55555}, - {0xe0000000aaaaaaaa, 0x43ec000000155555}, - {0xeeeeeeeeeeeeeeee, 0x43edddddddddddde}, - {0xfffffffdeeeeeeee, 0x43efffffffbdddde}, - {0xf0000000dddddddd, 0x43ee0000001bbbbc}, - {0x7fffffdddddddd, 0x435ffffff7777777}, - {0x3fffffaaaaaaaa, 0x434fffffd5555555}, - {0x1fffffaaaaaaaa, 0x433fffffaaaaaaaa}, - {0xfffff, 0x412ffffe00000000}, - {0x7ffff, 0x411ffffc00000000}, - {0x3ffff, 0x410ffff800000000}, - {0x1ffff, 0x40fffff000000000}, - {0xffff, 0x40efffe000000000}, - {0x7fff, 0x40dfffc000000000}, - {0x3fff, 0x40cfff8000000000}, - {0x1fff, 0x40bfff0000000000}, - {0xfff, 0x40affe0000000000}, - {0x7ff, 0x409ffc0000000000}, - {0x3ff, 0x408ff80000000000}, - {0x1ff, 0x407ff00000000000}, - {0x3fffffffffff, 0x42cfffffffffff80}, - {0x1fffffffffff, 0x42bfffffffffff00}, - {0xfffffffffff, 0x42affffffffffe00}, - {0x7ffffffffff, 0x429ffffffffffc00}, - {0x3ffffffffff, 0x428ffffffffff800}, - {0x1ffffffffff, 0x427ffffffffff000}, - {0x8000008000000000, 0x43e0000010000000}, - {0x8000008000000001, 0x43e0000010000000}, - {0x8000000000000400, 0x43e0000000000000}, - {0x8000000000000401, 0x43e0000000000001}}; + {0x273A798E187937A3, 0x43C39D3CC70C3C9C}, + {0xECE3AF835495A16B, 0x43ED9C75F06A92B4}, + {0xB668ECC11223344, 0x43A6CD1D98224467}, + {0x9E, 0x4063C00000000000}, + {0x43, 0x4050C00000000000}, + {0xAF73, 0x40E5EE6000000000}, + {0x116B, 0x40B16B0000000000}, + {0x658ECC, 0x415963B300000000}, + {0x2B3B4C, 0x41459DA600000000}, + {0x88776655, 0x41E10EECCAA00000}, + {0x70000000, 0x41DC000000000000}, + {0x7200000, 0x419C800000000000}, + {0x7FFFFFFF, 0x41DFFFFFFFC00000}, + {0x56123761, 0x41D5848DD8400000}, + {0x7FFFFF00, 0x41DFFFFFC0000000}, + {0x761C4761EEEEEEEE, 0x43DD8711D87BBBBC}, + {0x80000000EEEEEEEE, 0x43E00000001DDDDE}, + {0x88888888DDDDDDDD, 0x43E11111111BBBBC}, + {0xA0000000DDDDDDDD, 0x43E40000001BBBBC}, + {0xDDDDDDDDAAAAAAAA, 0x43EBBBBBBBB55555}, + {0xE0000000AAAAAAAA, 0x43EC000000155555}, + {0xEEEEEEEEEEEEEEEE, 0x43EDDDDDDDDDDDDE}, + {0xFFFFFFFDEEEEEEEE, 0x43EFFFFFFFBDDDDE}, + {0xF0000000DDDDDDDD, 0x43EE0000001BBBBC}, + {0x7FFFFFDDDDDDDD, 0x435FFFFFF7777777}, + {0x3FFFFFAAAAAAAA, 0x434FFFFFD5555555}, + {0x1FFFFFAAAAAAAA, 0x433FFFFFAAAAAAAA}, + {0xFFFFF, 0x412FFFFE00000000}, + {0x7FFFF, 0x411FFFFC00000000}, + {0x3FFFF, 0x410FFFF800000000}, + {0x1FFFF, 0x40FFFFF000000000}, + {0xFFFF, 0x40EFFFE000000000}, + {0x7FFF, 0x40DFFFC000000000}, + {0x3FFF, 0x40CFFF8000000000}, + {0x1FFF, 0x40BFFF0000000000}, + {0xFFF, 0x40AFFE0000000000}, + {0x7FF, 0x409FFC0000000000}, + {0x3FF, 0x408FF80000000000}, + {0x1FF, 0x407FF00000000000}, + {0x3FFFFFFFFFFF, 0x42CFFFFFFFFFFF80}, + {0x1FFFFFFFFFFF, 0x42BFFFFFFFFFFF00}, + {0xFFFFFFFFFFF, 0x42AFFFFFFFFFFE00}, + {0x7FFFFFFFFFF, 0x429FFFFFFFFFFC00}, + {0x3FFFFFFFFFF, 0x428FFFFFFFFFF800}, + {0x1FFFFFFFFFF, 0x427FFFFFFFFFF000}, + {0x8000008000000000, 0x43E0000010000000}, + {0x8000008000000001, 0x43E0000010000000}, + {0x8000000000000400, 0x43E0000000000000}, + {0x8000000000000401, 0x43E0000000000001}}; WasmRunner<double, uint64_t> r(execution_mode); BUILD(r, WASM_F64_UCONVERT_I64(WASM_GET_LOCAL(0))); for (size_t i = 0; i < arraysize(values); i++) { @@ -907,19 +907,19 @@ WASM_EXEC_TEST(CallI64Parameter) { BUILD( r, WASM_I32_CONVERT_I64(WASM_CALL_FUNCTION( - t.function_index(), WASM_I64V_9(0xbcd12340000000b), - WASM_I64V_9(0xbcd12340000000c), WASM_I32V_1(0xd), - WASM_I32_CONVERT_I64(WASM_I64V_9(0xbcd12340000000e)), - WASM_I64V_9(0xbcd12340000000f), WASM_I64V_10(0xbcd1234000000010), - WASM_I64V_10(0xbcd1234000000011), WASM_I64V_10(0xbcd1234000000012), - WASM_I64V_10(0xbcd1234000000013), WASM_I64V_10(0xbcd1234000000014), - WASM_I64V_10(0xbcd1234000000015), WASM_I64V_10(0xbcd1234000000016), - WASM_I64V_10(0xbcd1234000000017), WASM_I64V_10(0xbcd1234000000018), - WASM_I64V_10(0xbcd1234000000019), WASM_I64V_10(0xbcd123400000001a), - WASM_I64V_10(0xbcd123400000001b), WASM_I64V_10(0xbcd123400000001c), - WASM_I64V_10(0xbcd123400000001d)))); + t.function_index(), WASM_I64V_9(0xBCD12340000000B), + WASM_I64V_9(0xBCD12340000000C), WASM_I32V_1(0xD), + WASM_I32_CONVERT_I64(WASM_I64V_9(0xBCD12340000000E)), + WASM_I64V_9(0xBCD12340000000F), WASM_I64V_10(0xBCD1234000000010), + WASM_I64V_10(0xBCD1234000000011), WASM_I64V_10(0xBCD1234000000012), + WASM_I64V_10(0xBCD1234000000013), WASM_I64V_10(0xBCD1234000000014), + WASM_I64V_10(0xBCD1234000000015), WASM_I64V_10(0xBCD1234000000016), + WASM_I64V_10(0xBCD1234000000017), WASM_I64V_10(0xBCD1234000000018), + WASM_I64V_10(0xBCD1234000000019), WASM_I64V_10(0xBCD123400000001A), + WASM_I64V_10(0xBCD123400000001B), WASM_I64V_10(0xBCD123400000001C), + WASM_I64V_10(0xBCD123400000001D)))); - CHECK_EQ(i + 0xb, r.Call()); + CHECK_EQ(i + 0xB, r.Call()); } } @@ -935,11 +935,10 @@ WASM_EXEC_TEST(CallI64Return) { BUILD(t, WASM_GET_LOCAL(0), WASM_I32V(7)); // Build the first calling function. - BUILD(r, - WASM_CALL_FUNCTION( - t.function_index(), WASM_I64V(0xbcd12340000000b)), WASM_DROP); + BUILD(r, WASM_CALL_FUNCTION(t.function_index(), WASM_I64V(0xBCD12340000000B)), + WASM_DROP); - CHECK_EQ(0xbcd12340000000b, r.Call()); + CHECK_EQ(0xBCD12340000000B, r.Call()); } void TestI64Binop(WasmExecutionMode execution_mode, WasmOpcode opcode, @@ -981,35 +980,35 @@ void TestI64Cmp(WasmExecutionMode execution_mode, WasmOpcode opcode, } while (false) WASM_EXEC_TEST(I64Binops) { - TEST_I64_BINOP(I64Add, -5586332274295447011, 0x501b72ebabc26847, - 0x625de9793d8f79d6); - TEST_I64_BINOP(I64Sub, 9001903251710731490, 0xf24fe6474640002e, - 0x7562b6f711991b4c); - TEST_I64_BINOP(I64Mul, -4569547818546064176, 0x231a263c2cbc6451, - 0xead44de6bd3e23d0); - TEST_I64_BINOP(I64Mul, -25963122347507043, 0x4da1fa47c9352b73, - 0x91fe82317aa035af); - TEST_I64_BINOP(I64Mul, 7640290486138131960, 0x185731abe8eea47c, - 0x714ec59f1380d4c2); - TEST_I64_BINOP(I64DivS, -91517, 0x93b1190a34de56a0, 0x00004d8f68863948); - TEST_I64_BINOP(I64DivU, 149016, 0xe15b3727e8a2080a, 0x0000631bfa72db8b); - TEST_I64_BINOP(I64RemS, -664128064149968, 0x9a78b4e4fe708692, - 0x0003e0b6b3be7609); - TEST_I64_BINOP(I64RemU, 1742040017332765, 0x0ce84708c6258c81, - 0x000a6fde82016697); - TEST_I64_BINOP(I64And, 2531040582801836054, 0xaf257d1602644a16, - 0x33b290a91a10d997); - TEST_I64_BINOP(I64Ior, 8556201506536114940, 0x169d9be7bd3f0a5c, - 0x66bca28d77af40e8); - TEST_I64_BINOP(I64Xor, -4605655183785456377, 0xb6ea20a5d48e85b8, - 0x76ff4da6c80688bf); - TEST_I64_BINOP(I64Shl, -7240704056088331264, 0xef4dc1ed030e8ffe, 9); - TEST_I64_BINOP(I64ShrU, 12500673744059159, 0xb1a52fa7deec5d14, 10); - TEST_I64_BINOP(I64ShrS, 1725103446999874, 0x3107c791461a112b, 11); - TEST_I64_BINOP(I64Ror, -8960135652432576946, 0x73418d1717e4e83a, 12); - TEST_I64_BINOP(I64Ror, 7617662827409989779, 0xebff67cf0c126d36, 13); - TEST_I64_BINOP(I64Rol, -2097714064174346012, 0x43938b8db0b0f230, 14); - TEST_I64_BINOP(I64Rol, 8728493013947314237, 0xe07af243ac4d219d, 15); + TEST_I64_BINOP(I64Add, -5586332274295447011, 0x501B72EBABC26847, + 0x625DE9793D8F79D6); + TEST_I64_BINOP(I64Sub, 9001903251710731490, 0xF24FE6474640002E, + 0x7562B6F711991B4C); + TEST_I64_BINOP(I64Mul, -4569547818546064176, 0x231A263C2CBC6451, + 0xEAD44DE6BD3E23D0); + TEST_I64_BINOP(I64Mul, -25963122347507043, 0x4DA1FA47C9352B73, + 0x91FE82317AA035AF); + TEST_I64_BINOP(I64Mul, 7640290486138131960, 0x185731ABE8EEA47C, + 0x714EC59F1380D4C2); + TEST_I64_BINOP(I64DivS, -91517, 0x93B1190A34DE56A0, 0x00004D8F68863948); + TEST_I64_BINOP(I64DivU, 149016, 0xE15B3727E8A2080A, 0x0000631BFA72DB8B); + TEST_I64_BINOP(I64RemS, -664128064149968, 0x9A78B4E4FE708692, + 0x0003E0B6B3BE7609); + TEST_I64_BINOP(I64RemU, 1742040017332765, 0x0CE84708C6258C81, + 0x000A6FDE82016697); + TEST_I64_BINOP(I64And, 2531040582801836054, 0xAF257D1602644A16, + 0x33B290A91A10D997); + TEST_I64_BINOP(I64Ior, 8556201506536114940, 0x169D9BE7BD3F0A5C, + 0x66BCA28D77AF40E8); + TEST_I64_BINOP(I64Xor, -4605655183785456377, 0xB6EA20A5D48E85B8, + 0x76FF4DA6C80688BF); + TEST_I64_BINOP(I64Shl, -7240704056088331264, 0xEF4DC1ED030E8FFE, 9); + TEST_I64_BINOP(I64ShrU, 12500673744059159, 0xB1A52FA7DEEC5D14, 10); + TEST_I64_BINOP(I64ShrS, 1725103446999874, 0x3107C791461A112B, 11); + TEST_I64_BINOP(I64Ror, -8960135652432576946, 0x73418D1717E4E83A, 12); + TEST_I64_BINOP(I64Ror, 7617662827409989779, 0xEBFF67CF0C126D36, 13); + TEST_I64_BINOP(I64Rol, -2097714064174346012, 0x43938B8DB0B0F230, 14); + TEST_I64_BINOP(I64Rol, 8728493013947314237, 0xE07AF243AC4D219D, 15); } #undef TEST_I64_BINOP @@ -1043,9 +1042,9 @@ WASM_EXEC_TEST(I64Clz) { } values[] = {{0, 0x8000100000000000}, {1, 0x4000050000000000}, {2, 0x2000030000000000}, {3, 0x1000000300000000}, {4, 0x0805000000000000}, {5, 0x0400600000000000}, - {6, 0x0200000000000000}, {7, 0x010000a000000000}, - {8, 0x00800c0000000000}, {9, 0x0040000000000000}, - {10, 0x0020000d00000000}, {11, 0x00100f0000000000}, + {6, 0x0200000000000000}, {7, 0x010000A000000000}, + {8, 0x00800C0000000000}, {9, 0x0040000000000000}, + {10, 0x0020000D00000000}, {11, 0x00100F0000000000}, {12, 0x0008000000000000}, {13, 0x0004100000000000}, {14, 0x0002002000000000}, {15, 0x0001030000000000}, {16, 0x0000804000000000}, {17, 0x0000400500000000}, @@ -1059,9 +1058,9 @@ WASM_EXEC_TEST(I64Clz) { {32, 0x0000000080001000}, {33, 0x0000000040000500}, {34, 0x0000000020000300}, {35, 0x0000000010000003}, {36, 0x0000000008050000}, {37, 0x0000000004006000}, - {38, 0x0000000002000000}, {39, 0x00000000010000a0}, - {40, 0x0000000000800c00}, {41, 0x0000000000400000}, - {42, 0x000000000020000d}, {43, 0x0000000000100f00}, + {38, 0x0000000002000000}, {39, 0x00000000010000A0}, + {40, 0x0000000000800C00}, {41, 0x0000000000400000}, + {42, 0x000000000020000D}, {43, 0x0000000000100F00}, {44, 0x0000000000080000}, {45, 0x0000000000041000}, {46, 0x0000000000020020}, {47, 0x0000000000010300}, {48, 0x0000000000008040}, {49, 0x0000000000004005}, @@ -1088,37 +1087,37 @@ WASM_EXEC_TEST(I64Ctz) { uint64_t input; } values[] = {{64, 0x0000000000000000}, {63, 0x8000000000000000}, {62, 0x4000000000000000}, {61, 0x2000000000000000}, - {60, 0x1000000000000000}, {59, 0xa800000000000000}, - {58, 0xf400000000000000}, {57, 0x6200000000000000}, - {56, 0x9100000000000000}, {55, 0xcd80000000000000}, - {54, 0x0940000000000000}, {53, 0xaf20000000000000}, - {52, 0xac10000000000000}, {51, 0xe0b8000000000000}, - {50, 0x9ce4000000000000}, {49, 0xc792000000000000}, - {48, 0xb8f1000000000000}, {47, 0x3b9f800000000000}, - {46, 0xdb4c400000000000}, {45, 0xe9a3200000000000}, - {44, 0xfca6100000000000}, {43, 0x6c8a780000000000}, - {42, 0x8ce5a40000000000}, {41, 0xcb7d020000000000}, - {40, 0xcb4dc10000000000}, {39, 0xdfbec58000000000}, - {38, 0x27a9db4000000000}, {37, 0xde3bcb2000000000}, - {36, 0xd7e8a61000000000}, {35, 0x9afdbc8800000000}, - {34, 0x9afdbc8400000000}, {33, 0x9afdbc8200000000}, - {32, 0x9afdbc8100000000}, {31, 0x0000000080000000}, + {60, 0x1000000000000000}, {59, 0xA800000000000000}, + {58, 0xF400000000000000}, {57, 0x6200000000000000}, + {56, 0x9100000000000000}, {55, 0xCD80000000000000}, + {54, 0x0940000000000000}, {53, 0xAF20000000000000}, + {52, 0xAC10000000000000}, {51, 0xE0B8000000000000}, + {50, 0x9CE4000000000000}, {49, 0xC792000000000000}, + {48, 0xB8F1000000000000}, {47, 0x3B9F800000000000}, + {46, 0xDB4C400000000000}, {45, 0xE9A3200000000000}, + {44, 0xFCA6100000000000}, {43, 0x6C8A780000000000}, + {42, 0x8CE5A40000000000}, {41, 0xCB7D020000000000}, + {40, 0xCB4DC10000000000}, {39, 0xDFBEC58000000000}, + {38, 0x27A9DB4000000000}, {37, 0xDE3BCB2000000000}, + {36, 0xD7E8A61000000000}, {35, 0x9AFDBC8800000000}, + {34, 0x9AFDBC8400000000}, {33, 0x9AFDBC8200000000}, + {32, 0x9AFDBC8100000000}, {31, 0x0000000080000000}, {30, 0x0000000040000000}, {29, 0x0000000020000000}, - {28, 0x0000000010000000}, {27, 0x00000000a8000000}, - {26, 0x00000000f4000000}, {25, 0x0000000062000000}, - {24, 0x0000000091000000}, {23, 0x00000000cd800000}, - {22, 0x0000000009400000}, {21, 0x00000000af200000}, - {20, 0x00000000ac100000}, {19, 0x00000000e0b80000}, - {18, 0x000000009ce40000}, {17, 0x00000000c7920000}, - {16, 0x00000000b8f10000}, {15, 0x000000003b9f8000}, - {14, 0x00000000db4c4000}, {13, 0x00000000e9a32000}, - {12, 0x00000000fca61000}, {11, 0x000000006c8a7800}, - {10, 0x000000008ce5a400}, {9, 0x00000000cb7d0200}, - {8, 0x00000000cb4dc100}, {7, 0x00000000dfbec580}, - {6, 0x0000000027a9db40}, {5, 0x00000000de3bcb20}, - {4, 0x00000000d7e8a610}, {3, 0x000000009afdbc88}, - {2, 0x000000009afdbc84}, {1, 0x000000009afdbc82}, - {0, 0x000000009afdbc81}}; + {28, 0x0000000010000000}, {27, 0x00000000A8000000}, + {26, 0x00000000F4000000}, {25, 0x0000000062000000}, + {24, 0x0000000091000000}, {23, 0x00000000CD800000}, + {22, 0x0000000009400000}, {21, 0x00000000AF200000}, + {20, 0x00000000AC100000}, {19, 0x00000000E0B80000}, + {18, 0x000000009CE40000}, {17, 0x00000000C7920000}, + {16, 0x00000000B8F10000}, {15, 0x000000003B9F8000}, + {14, 0x00000000DB4C4000}, {13, 0x00000000E9A32000}, + {12, 0x00000000FCA61000}, {11, 0x000000006C8A7800}, + {10, 0x000000008CE5A400}, {9, 0x00000000CB7D0200}, + {8, 0x00000000CB4DC100}, {7, 0x00000000DFBEC580}, + {6, 0x0000000027A9DB40}, {5, 0x00000000DE3BCB20}, + {4, 0x00000000D7E8A610}, {3, 0x000000009AFDBC88}, + {2, 0x000000009AFDBC84}, {1, 0x000000009AFDBC82}, + {0, 0x000000009AFDBC81}}; WasmRunner<int64_t, uint64_t> r(execution_mode); BUILD(r, WASM_I64_CTZ(WASM_GET_LOCAL(0))); @@ -1132,11 +1131,11 @@ WASM_EXEC_TEST(I64Popcnt2) { struct { int64_t expected; uint64_t input; - } values[] = {{64, 0xffffffffffffffff}, + } values[] = {{64, 0xFFFFFFFFFFFFFFFF}, {0, 0x0000000000000000}, {2, 0x0000080000008000}, {26, 0x1123456782345678}, - {38, 0xffedcba09edcba09}}; + {38, 0xFFEDCBA09EDCBA09}}; WasmRunner<int64_t, uint64_t> r(execution_mode); BUILD(r, WASM_I64_POPCNT(WASM_GET_LOCAL(0))); @@ -1343,10 +1342,10 @@ WASM_EXEC_TEST(SignallingNanSurvivesI64ReinterpretF64) { REQUIRE(I64ReinterpretF64); WasmRunner<int64_t> r(execution_mode); BUILD(r, WASM_I64_REINTERPRET_F64(WASM_SEQ(kExprF64Const, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0xf4, 0x7f))); + 0x00, 0x00, 0x00, 0xF4, 0x7F))); // This is a signalling nan. - CHECK_EQ(0x7ff4000000000000, r.Call()); + CHECK_EQ(0x7FF4000000000000, r.Call()); } WASM_EXEC_TEST(F64ReinterpretI64) { @@ -1373,11 +1372,11 @@ WASM_EXEC_TEST(LoadMemI64) { BUILD(r, WASM_LOAD_MEM(MachineType::Int64(), WASM_ZERO)); - r.builder().WriteMemory<int64_t>(&memory[0], 0x1abbccdd00112233LL); - CHECK_EQ(0x1abbccdd00112233LL, r.Call()); + r.builder().WriteMemory<int64_t>(&memory[0], 0x1ABBCCDD00112233LL); + CHECK_EQ(0x1ABBCCDD00112233LL, r.Call()); - r.builder().WriteMemory<int64_t>(&memory[0], 0x33aabbccdd001122LL); - CHECK_EQ(0x33aabbccdd001122LL, r.Call()); + r.builder().WriteMemory<int64_t>(&memory[0], 0x33AABBCCDD001122LL); + CHECK_EQ(0x33AABBCCDD001122LL, r.Call()); r.builder().WriteMemory<int64_t>(&memory[0], 77777777); CHECK_EQ(77777777, r.Call()); @@ -1393,11 +1392,11 @@ WASM_EXEC_TEST(LoadMemI64_alignment) { BUILD(r, WASM_LOAD_MEM_ALIGNMENT(MachineType::Int64(), WASM_ZERO, alignment)); - r.builder().WriteMemory<int64_t>(&memory[0], 0x1abbccdd00112233LL); - CHECK_EQ(0x1abbccdd00112233LL, r.Call()); + r.builder().WriteMemory<int64_t>(&memory[0], 0x1ABBCCDD00112233LL); + CHECK_EQ(0x1ABBCCDD00112233LL, r.Call()); - r.builder().WriteMemory<int64_t>(&memory[0], 0x33aabbccdd001122LL); - CHECK_EQ(0x33aabbccdd001122LL, r.Call()); + r.builder().WriteMemory<int64_t>(&memory[0], 0x33AABBCCDD001122LL); + CHECK_EQ(0x33AABBCCDD001122LL, r.Call()); r.builder().WriteMemory<int64_t>(&memory[0], 77777777); CHECK_EQ(77777777, r.Call()); @@ -1438,7 +1437,7 @@ WASM_EXEC_TEST(MemI64_Sum) { } WASM_EXEC_TEST(StoreMemI64_alignment) { - const int64_t kWritten = 0x12345678abcd0011ll; + const int64_t kWritten = 0x12345678ABCD0011ll; for (byte i = 0; i <= 3; i++) { WasmRunner<int64_t, int64_t> r(execution_mode); @@ -1494,7 +1493,7 @@ WASM_EXEC_TEST(I64Ror) { FOR_UINT64_INPUTS(i) { FOR_UINT64_INPUTS(j) { - int64_t expected = base::bits::RotateRight64(*i, *j & 0x3f); + int64_t expected = base::bits::RotateRight64(*i, *j & 0x3F); CHECK_EQ(expected, r.Call(*i, *j)); } } @@ -1507,7 +1506,7 @@ WASM_EXEC_TEST(I64Rol) { FOR_UINT64_INPUTS(i) { FOR_UINT64_INPUTS(j) { - int64_t expected = base::bits::RotateLeft64(*i, *j & 0x3f); + int64_t expected = base::bits::RotateLeft64(*i, *j & 0x3F); CHECK_EQ(expected, r.Call(*i, *j)); } } @@ -1515,7 +1514,7 @@ WASM_EXEC_TEST(I64Rol) { WASM_EXEC_TEST(StoreMem_offset_oob_i64) { // TODO(eholk): Fix this test for the trap handler. - if (trap_handler::UseTrapHandler()) return; + if (trap_handler::IsTrapHandlerEnabled()) return; static const MachineType machineTypes[] = { MachineType::Int8(), MachineType::Uint8(), MachineType::Int16(), MachineType::Uint16(), MachineType::Int32(), MachineType::Uint32(), @@ -1542,6 +1541,36 @@ WASM_EXEC_TEST(StoreMem_offset_oob_i64) { } } +WASM_EXEC_TEST(Store_i64_narrowed) { + constexpr byte kOpcodes[] = {kExprI64StoreMem8, kExprI64StoreMem16, + kExprI64StoreMem32, kExprI64StoreMem}; + int stored_size_in_bytes = 0; + for (auto opcode : kOpcodes) { + stored_size_in_bytes = std::max(1, stored_size_in_bytes * 2); + constexpr int kBytes = 24; + uint8_t expected_memory[kBytes] = {0}; + WasmRunner<int32_t, int32_t, int64_t> r(execution_mode); + uint8_t* memory = r.builder().AddMemoryElems<uint8_t>(kBytes); + constexpr uint64_t kPattern = 0x0123456789abcdef; + + BUILD(r, WASM_GET_LOCAL(0), // index + WASM_GET_LOCAL(1), // value + opcode, ZERO_ALIGNMENT, ZERO_OFFSET, // store + WASM_ZERO); // return value + + for (int i = 0; i <= kBytes - stored_size_in_bytes; ++i) { + uint64_t pattern = base::bits::RotateLeft64(kPattern, i % 64); + r.Call(i, pattern); + for (int b = 0; b < stored_size_in_bytes; ++b) { + expected_memory[i + b] = static_cast<uint8_t>(pattern >> (b * 8)); + } + for (int w = 0; w < kBytes; ++w) { + CHECK_EQ(expected_memory[w], memory[w]); + } + } + } +} + WASM_EXEC_TEST(UnalignedInt64Load) { WasmRunner<uint64_t> r(execution_mode); r.builder().AddMemoryElems<int64_t>(8); 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 b7b200984d..3b0e319bb4 100644 --- a/deps/v8/test/cctest/wasm/test-run-wasm-atomics.cc +++ b/deps/v8/test/cctest/wasm/test-run-wasm-atomics.cc @@ -234,7 +234,7 @@ WASM_COMPILED_EXEC_TEST(I32AtomicCompareExchange8U) { } } -WASM_COMPILED_EXEC_TEST(I32AtomicLoad) { +WASM_EXEC_TEST(I32AtomicLoad) { EXPERIMENTAL_FLAG_SCOPE(threads); WasmRunner<uint32_t> r(execution_mode); r.builder().SetHasSharedMemory(); @@ -249,7 +249,7 @@ WASM_COMPILED_EXEC_TEST(I32AtomicLoad) { } } -WASM_COMPILED_EXEC_TEST(I32AtomicLoad16U) { +WASM_EXEC_TEST(I32AtomicLoad16U) { EXPERIMENTAL_FLAG_SCOPE(threads); WasmRunner<uint32_t> r(execution_mode); r.builder().SetHasSharedMemory(); @@ -264,7 +264,7 @@ WASM_COMPILED_EXEC_TEST(I32AtomicLoad16U) { } } -WASM_COMPILED_EXEC_TEST(I32AtomicLoad8U) { +WASM_EXEC_TEST(I32AtomicLoad8U) { EXPERIMENTAL_FLAG_SCOPE(threads); WasmRunner<uint32_t> r(execution_mode); r.builder().SetHasSharedMemory(); @@ -279,7 +279,7 @@ WASM_COMPILED_EXEC_TEST(I32AtomicLoad8U) { } } -WASM_COMPILED_EXEC_TEST(I32AtomicStoreLoad) { +WASM_EXEC_TEST(I32AtomicStoreLoad) { EXPERIMENTAL_FLAG_SCOPE(threads); WasmRunner<uint32_t, uint32_t> r(execution_mode); r.builder().SetHasSharedMemory(); @@ -298,7 +298,7 @@ WASM_COMPILED_EXEC_TEST(I32AtomicStoreLoad) { } } -WASM_COMPILED_EXEC_TEST(I32AtomicStoreLoad16U) { +WASM_EXEC_TEST(I32AtomicStoreLoad16U) { EXPERIMENTAL_FLAG_SCOPE(threads); WasmRunner<uint32_t, uint32_t> r(execution_mode); r.builder().SetHasSharedMemory(); @@ -318,7 +318,7 @@ WASM_COMPILED_EXEC_TEST(I32AtomicStoreLoad16U) { } } -WASM_COMPILED_EXEC_TEST(I32AtomicStoreLoad8U) { +WASM_EXEC_TEST(I32AtomicStoreLoad8U) { EXPERIMENTAL_FLAG_SCOPE(threads); WasmRunner<uint32_t, uint32_t> r(execution_mode); r.builder().SetHasSharedMemory(); diff --git a/deps/v8/test/cctest/wasm/test-run-wasm-interpreter.cc b/deps/v8/test/cctest/wasm/test-run-wasm-interpreter.cc index f67ce2d121..76ca00cb3b 100644 --- a/deps/v8/test/cctest/wasm/test-run-wasm-interpreter.cc +++ b/deps/v8/test/cctest/wasm/test-run-wasm-interpreter.cc @@ -294,14 +294,14 @@ TEST(Breakpoint_I32And_disable) { TEST(GrowMemory) { { WasmRunner<int32_t, uint32_t> r(kExecuteInterpreter); - r.builder().AddMemory(WasmModule::kPageSize); + r.builder().AddMemory(kWasmPageSize); r.builder().SetMaxMemPages(10); BUILD(r, WASM_GROW_MEMORY(WASM_GET_LOCAL(0))); CHECK_EQ(1, r.Call(1)); } { WasmRunner<int32_t, uint32_t> r(kExecuteInterpreter); - r.builder().AddMemory(WasmModule::kPageSize); + r.builder().AddMemory(kWasmPageSize); r.builder().SetMaxMemPages(10); BUILD(r, WASM_GROW_MEMORY(WASM_GET_LOCAL(0))); CHECK_EQ(-1, r.Call(11)); @@ -312,7 +312,7 @@ TEST(GrowMemoryPreservesData) { int32_t index = 16; int32_t value = 2335; WasmRunner<int32_t, uint32_t> r(kExecuteInterpreter); - r.builder().AddMemory(WasmModule::kPageSize); + r.builder().AddMemory(kWasmPageSize); BUILD(r, WASM_STORE_MEM(MachineType::Int32(), WASM_I32V(index), WASM_I32V(value)), WASM_GROW_MEMORY(WASM_GET_LOCAL(0)), WASM_DROP, @@ -323,7 +323,7 @@ TEST(GrowMemoryPreservesData) { TEST(GrowMemoryInvalidSize) { // Grow memory by an invalid amount without initial memory. WasmRunner<int32_t, uint32_t> r(kExecuteInterpreter); - r.builder().AddMemory(WasmModule::kPageSize); + r.builder().AddMemory(kWasmPageSize); BUILD(r, WASM_GROW_MEMORY(WASM_GET_LOCAL(0))); CHECK_EQ(-1, r.Call(1048575)); } @@ -364,7 +364,7 @@ TEST(TestPossibleNondeterminism) { { int32_t index = 16; WasmRunner<int32_t, float> r(kExecuteInterpreter); - r.builder().AddMemory(WasmModule::kPageSize); + r.builder().AddMemory(kWasmPageSize); BUILD(r, WASM_STORE_MEM(MachineType::Float32(), WASM_I32V(index), WASM_GET_LOCAL(0)), WASM_I32V(index)); @@ -376,7 +376,7 @@ TEST(TestPossibleNondeterminism) { { int32_t index = 16; WasmRunner<int32_t, double> r(kExecuteInterpreter); - r.builder().AddMemory(WasmModule::kPageSize); + r.builder().AddMemory(kWasmPageSize); BUILD(r, WASM_STORE_MEM(MachineType::Float64(), WASM_I32V(index), WASM_GET_LOCAL(0)), WASM_I32V(index)); 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 b4e0298a72..ab40a6366d 100644 --- a/deps/v8/test/cctest/wasm/test-run-wasm-module.cc +++ b/deps/v8/test/cctest/wasm/test-run-wasm-module.cc @@ -133,9 +133,9 @@ TEST(Run_WasmModule_ReadLoadedDataSegment) { byte code[] = { WASM_LOAD_MEM(MachineType::Int32(), WASM_I32V_1(kDataSegmentDest0))}; EMIT_CODE_WITH_END(f, code); - byte data[] = {0xaa, 0xbb, 0xcc, 0xdd}; + byte data[] = {0xAA, 0xBB, 0xCC, 0xDD}; builder->AddDataSegment(data, sizeof(data), kDataSegmentDest0); - TestModule(&zone, builder, 0xddccbbaa); + TestModule(&zone, builder, 0xDDCCBBAA); } Cleanup(); } @@ -256,7 +256,7 @@ class WasmSerializationTest { uint32_t* slot = reinterpret_cast<uint32_t*>( const_cast<uint8_t*>(serialized_bytes_.first) + SerializedCodeData::kPayloadLengthOffset); - *slot = FLAG_wasm_jit_to_native ? 0u : 0xfefefefeu; + *slot = FLAG_wasm_jit_to_native ? 0u : 0xFEFEFEFEu; } v8::MaybeLocal<v8::WasmCompiledModule> Deserialize() { @@ -277,9 +277,10 @@ class WasmSerializationTest { DisallowHeapAllocation assume_no_gc; Handle<WasmCompiledModule> compiled_part(module_object->compiled_module(), current_isolate()); - CHECK_EQ(memcmp(compiled_part->module_bytes()->GetCharsAddress(), - wire_bytes().first, wire_bytes().second), - 0); + CHECK_EQ( + memcmp(compiled_part->shared()->module_bytes()->GetCharsAddress(), + wire_bytes().first, wire_bytes().second), + 0); } Handle<WasmInstanceObject> instance = SyncInstantiate(current_isolate(), &thrower, module_object, @@ -724,7 +725,7 @@ TEST(Run_WasmModule_GrowMemOobOffset) { static const int kPageSize = 0x10000; // Initial memory size = 16 + GrowMemory(10) static const int index = kPageSize * 17 + 4; - int value = 0xaced; + int value = 0xACED; TestSignatures sigs; v8::internal::AccountingAllocator allocator; Zone zone(&allocator, ZONE_NAME); @@ -746,7 +747,7 @@ TEST(Run_WasmModule_GrowMemOobFixedIndex) { static const int kPageSize = 0x10000; // Initial memory size = 16 + GrowMemory(10) static const int index = kPageSize * 26 + 4; - int value = 0xaced; + int value = 0xACED; TestSignatures sigs; Isolate* isolate = CcTest::InitIsolateOnce(); Zone zone(isolate->allocator(), ZONE_NAME); @@ -785,7 +786,7 @@ TEST(Run_WasmModule_GrowMemOobFixedIndex) { Handle<Object> params[1] = {Handle<Object>(Smi::FromInt(1), isolate)}; int32_t result = testing::RunWasmModuleForTesting(isolate, instance, 1, params); - CHECK_EQ(0xaced, result); + CHECK_EQ(0xACED, result); } Cleanup(); } @@ -793,7 +794,7 @@ TEST(Run_WasmModule_GrowMemOobFixedIndex) { TEST(Run_WasmModule_GrowMemOobVariableIndex) { { static const int kPageSize = 0x10000; - int value = 0xaced; + int value = 0xACED; TestSignatures sigs; Isolate* isolate = CcTest::InitIsolateOnce(); v8::internal::AccountingAllocator allocator; @@ -836,7 +837,7 @@ TEST(Run_WasmModule_GrowMemOobVariableIndex) { Handle<Object>(Smi::FromInt((20 + i) * kPageSize - 4), isolate)}; int32_t result = testing::RunWasmModuleForTesting(isolate, instance, 1, params); - CHECK_EQ(0xaced, result); + CHECK_EQ(0xACED, result); } v8::TryCatch try_catch(reinterpret_cast<v8::Isolate*>(isolate)); @@ -938,7 +939,7 @@ TEST(InitDataAtTheUpperLimit) { U32V_1(9), // section size ENTRY_COUNT(1), // -- 0, // linear memory index - WASM_I32V_3(0xffff), // destination offset + WASM_I32V_3(0xFFFF), // destination offset kExprEnd, U32V_1(1), // source size 'c' // data bytes @@ -949,7 +950,7 @@ TEST(InitDataAtTheUpperLimit) { {}); if (thrower.error()) { thrower.Reify()->Print(); - CHECK(false); + FATAL("compile or instantiate error"); } } Cleanup(); @@ -1044,7 +1045,7 @@ TEST(MemoryWithOOBEmptyDataSegment) { U32V_1(9), // section size ENTRY_COUNT(1), // -- 0, // linear memory index - WASM_I32V_4(0x2468ace), // destination offset + WASM_I32V_4(0x2468ACE), // destination offset kExprEnd, U32V_1(0), // source size }; @@ -1058,12 +1059,35 @@ TEST(MemoryWithOOBEmptyDataSegment) { Cleanup(); } +// Utility to free the allocated memory for a buffer that is manually +// externalized in a test. +struct ManuallyExternalizedBuffer { + Isolate* isolate_; + Handle<JSArrayBuffer> buffer_; + void* allocation_base_; + size_t allocation_length_; + + ManuallyExternalizedBuffer(JSArrayBuffer* buffer, Isolate* isolate) + : isolate_(isolate), + buffer_(buffer, isolate), + allocation_base_(buffer->allocation_base()), + allocation_length_(buffer->allocation_length()) { + if (!buffer->has_guard_region()) { + v8::Utils::ToLocal(buffer_)->Externalize(); + } + } + ~ManuallyExternalizedBuffer() { + if (!buffer_->has_guard_region()) { + isolate_->array_buffer_allocator()->Free( + allocation_base_, allocation_length_, buffer_->allocation_mode()); + } + } +}; + TEST(Run_WasmModule_Buffer_Externalized_GrowMem) { { Isolate* isolate = CcTest::InitIsolateOnce(); HandleScope scope(isolate); - // Initial memory size = 16 + GrowWebAssemblyMemory(4) + GrowMemory(6) - static const int kExpectedValue = 26; TestSignatures sigs; v8::internal::AccountingAllocator allocator; Zone zone(&allocator, ZONE_NAME); @@ -1084,47 +1108,28 @@ TEST(Run_WasmModule_Buffer_Externalized_GrowMem) { ModuleWireBytes(buffer.begin(), buffer.end()), {}, {}) .ToHandleChecked(); - Handle<JSArrayBuffer> memory(instance->memory_object()->array_buffer(), - isolate); - Handle<WasmMemoryObject> mem_obj(instance->memory_object(), isolate); - void* const old_allocation_base = memory->allocation_base(); - size_t const old_allocation_length = memory->allocation_length(); - - // Fake the Embedder flow by externalizing the memory object, and grow. - v8::Utils::ToLocal(memory)->Externalize(); - - uint32_t result = WasmMemoryObject::Grow(isolate, mem_obj, 4); - bool free_memory = !memory->has_guard_region(); - if (!free_memory) { - // current_pages = Initial memory size(16) + GrowWebAssemblyMemory(4) - const uint32_t current_pages = 20; - i::WasmMemoryObject::SetupNewBufferWithSameBackingStore(isolate, mem_obj, - current_pages); - } - wasm::DetachMemoryBuffer(isolate, memory, free_memory); + Handle<WasmMemoryObject> memory_object(instance->memory_object(), isolate); + + // Fake the Embedder flow by externalizing the array buffer. + ManuallyExternalizedBuffer buffer1(memory_object->array_buffer(), isolate); + + // Grow using the API. + uint32_t result = WasmMemoryObject::Grow(isolate, memory_object, 4); CHECK_EQ(16, result); - memory = handle(mem_obj->array_buffer()); - instance->memory_object()->set_array_buffer(*memory); - // Externalize should make no difference without the JS API as in this case - // the buffer is not detached. - v8::Utils::ToLocal(memory)->Externalize(); + CHECK(buffer1.buffer_->was_neutered()); // growing always neuters + CHECK_EQ(0, buffer1.buffer_->byte_length()->Number()); + + CHECK_NE(*buffer1.buffer_, memory_object->array_buffer()); + + // Fake the Embedder flow by externalizing the array buffer. + ManuallyExternalizedBuffer buffer2(memory_object->array_buffer(), isolate); + + // Grow using an internal WASM bytecode. result = testing::RunWasmModuleForTesting(isolate, instance, 0, nullptr); - CHECK_EQ(kExpectedValue, result); - // Free the buffer as the tracker does not know about it. - const v8::ArrayBuffer::Allocator::AllocationMode allocation_mode = - memory->allocation_mode(); - CHECK_NOT_NULL(memory->allocation_base()); - isolate->array_buffer_allocator()->Free(memory->allocation_base(), - memory->allocation_length(), - allocation_mode); - if (free_memory) { - // GrowMemory without guard pages enabled allocates an extra buffer, - // that needs to be freed as well - isolate->array_buffer_allocator()->Free( - old_allocation_base, old_allocation_length, allocation_mode); - } - memory->set_allocation_base(nullptr); - memory->set_allocation_length(0); + CHECK_EQ(26, result); + CHECK(buffer2.buffer_->was_neutered()); // growing always neuters + CHECK_EQ(0, buffer2.buffer_->byte_length()->Number()); + CHECK_NE(*buffer2.buffer_, memory_object->array_buffer()); } Cleanup(); } @@ -1134,19 +1139,17 @@ TEST(Run_WasmModule_Buffer_Externalized_GrowMemMemSize) { Isolate* isolate = CcTest::InitIsolateOnce(); HandleScope scope(isolate); void* backing_store = - isolate->array_buffer_allocator()->Allocate(16 * WasmModule::kPageSize); - Handle<JSArrayBuffer> buffer = wasm::SetupArrayBuffer( - isolate, backing_store, 16 * WasmModule::kPageSize, backing_store, - 16 * WasmModule::kPageSize, false, false); + isolate->array_buffer_allocator()->Allocate(16 * kWasmPageSize); + Handle<JSArrayBuffer> buffer = + wasm::SetupArrayBuffer(isolate, backing_store, 16 * kWasmPageSize, + backing_store, 16 * kWasmPageSize, false, false); Handle<WasmMemoryObject> mem_obj = WasmMemoryObject::New(isolate, buffer, 100); v8::Utils::ToLocal(buffer)->Externalize(); int32_t result = WasmMemoryObject::Grow(isolate, mem_obj, 0); - wasm::DetachMemoryBuffer(isolate, buffer, false); CHECK_EQ(16, result); - isolate->array_buffer_allocator()->Free(backing_store, - 16 * WasmModule::kPageSize); + isolate->array_buffer_allocator()->Free(backing_store, 16 * kWasmPageSize); } Cleanup(); } @@ -1158,14 +1161,13 @@ TEST(Run_WasmModule_Buffer_Externalized_Detach) { Isolate* isolate = CcTest::InitIsolateOnce(); HandleScope scope(isolate); void* backing_store = - isolate->array_buffer_allocator()->Allocate(16 * WasmModule::kPageSize); - Handle<JSArrayBuffer> buffer = wasm::SetupArrayBuffer( - isolate, backing_store, 16 * WasmModule::kPageSize, backing_store, - 16 * WasmModule::kPageSize, false, false); + isolate->array_buffer_allocator()->Allocate(16 * kWasmPageSize); + Handle<JSArrayBuffer> buffer = + wasm::SetupArrayBuffer(isolate, backing_store, 16 * kWasmPageSize, + backing_store, 16 * kWasmPageSize, false, false); v8::Utils::ToLocal(buffer)->Externalize(); wasm::DetachMemoryBuffer(isolate, buffer, true); - isolate->array_buffer_allocator()->Free(backing_store, - 16 * WasmModule::kPageSize); + isolate->array_buffer_allocator()->Free(backing_store, 16 * kWasmPageSize); } Cleanup(); } @@ -1199,10 +1201,9 @@ TEST(AtomicOpDisassembly) { MaybeHandle<WasmModuleObject> module_object = SyncCompile( isolate, &thrower, ModuleWireBytes(buffer.begin(), buffer.end())); - MaybeHandle<WasmCompiledModule> compiled_module( + Handle<WasmCompiledModule> compiled_module( module_object.ToHandleChecked()->compiled_module(), isolate); - CHECK(!compiled_module.is_null()); - compiled_module.ToHandleChecked()->DisassembleFunction(0); + compiled_module->shared()->DisassembleFunction(0); } Cleanup(); } diff --git a/deps/v8/test/cctest/wasm/test-run-wasm-simd.cc b/deps/v8/test/cctest/wasm/test-run-wasm-simd.cc index 93895d7f3c..1a97cdc122 100644 --- a/deps/v8/test/cctest/wasm/test-run-wasm-simd.cc +++ b/deps/v8/test/cctest/wasm/test-run-wasm-simd.cc @@ -31,25 +31,25 @@ typedef int8_t (*Int8BinOp)(int8_t, int8_t); typedef int (*Int8CompareOp)(int8_t, int8_t); typedef int8_t (*Int8ShiftOp)(int8_t, int); -#define WASM_SIMD_TEST(name) \ - void RunWasm_##name##_Impl(WasmExecutionMode execution_mode); \ - TEST(RunWasm_##name##_compiled) { \ - EXPERIMENTAL_FLAG_SCOPE(simd); \ - RunWasm_##name##_Impl(kExecuteTurbofan); \ - } \ - TEST(RunWasm_##name##_simd_lowered) { \ - EXPERIMENTAL_FLAG_SCOPE(simd); \ - RunWasm_##name##_Impl(kExecuteSimdLowered); \ - } \ - void RunWasm_##name##_Impl(WasmExecutionMode execution_mode) - -#define WASM_SIMD_COMPILED_TEST(name) \ - void RunWasm_##name##_Impl(WasmExecutionMode execution_mode); \ - TEST(RunWasm_##name##_compiled) { \ - EXPERIMENTAL_FLAG_SCOPE(simd); \ - RunWasm_##name##_Impl(kExecuteTurbofan); \ - } \ - void RunWasm_##name##_Impl(WasmExecutionMode execution_mode) +#define WASM_SIMD_TEST(name) \ + void RunWasm_##name##_Impl(LowerSimd lower_simd); \ + TEST(RunWasm_##name##_compiled) { \ + EXPERIMENTAL_FLAG_SCOPE(simd); \ + RunWasm_##name##_Impl(kNoLowerSimd); \ + } \ + TEST(RunWasm_##name##_simd_lowered) { \ + EXPERIMENTAL_FLAG_SCOPE(simd); \ + RunWasm_##name##_Impl(kLowerSimd); \ + } \ + void RunWasm_##name##_Impl(LowerSimd lower_simd) + +#define WASM_SIMD_COMPILED_TEST(name) \ + void RunWasm_##name##_Impl(LowerSimd lower_simd); \ + TEST(RunWasm_##name##_compiled) { \ + EXPERIMENTAL_FLAG_SCOPE(simd); \ + RunWasm_##name##_Impl(kNoLowerSimd); \ + } \ + void RunWasm_##name##_Impl(LowerSimd lower_simd) // Generic expected value functions. template <typename T> @@ -195,7 +195,7 @@ template <typename T> T UnsignedNarrow(int64_t value) { static_assert(sizeof(int64_t) > sizeof(T), "T must be int32_t or smaller"); using UnsignedT = typename std::make_unsigned<T>::type; - return static_cast<T>(Clamp<UnsignedT>(value & 0xffffffffu)); + return static_cast<T>(Clamp<UnsignedT>(value & 0xFFFFFFFFu)); } template <typename T> @@ -405,10 +405,8 @@ bool SkipFPValue(float x) { // doesn't handle NaNs. Also skip extreme values. bool SkipFPExpectedValue(float x) { return std::isnan(x) || SkipFPValue(x); } -#if V8_TARGET_ARCH_ARM || V8_TARGET_ARCH_ARM64 || V8_TARGET_ARCH_MIPS || \ - V8_TARGET_ARCH_MIPS64 WASM_SIMD_TEST(F32x4Splat) { - WasmRunner<int32_t, float> r(execution_mode); + WasmRunner<int32_t, float> r(kExecuteTurbofan, lower_simd); byte lane_val = 0; byte simd = r.AllocateLocal(kWasmS128); BUILD(r, @@ -422,7 +420,7 @@ WASM_SIMD_TEST(F32x4Splat) { } WASM_SIMD_TEST(F32x4ReplaceLane) { - WasmRunner<int32_t, float, float> r(execution_mode); + WasmRunner<int32_t, float, float> r(kExecuteTurbofan, lower_simd); byte old_val = 0; byte new_val = 1; byte simd = r.AllocateLocal(kWasmS128); @@ -447,9 +445,11 @@ WASM_SIMD_TEST(F32x4ReplaceLane) { CHECK_EQ(1, r.Call(3.14159f, -1.5f)); } +#if V8_TARGET_ARCH_ARM || V8_TARGET_ARCH_ARM64 || V8_TARGET_ARCH_MIPS || \ + V8_TARGET_ARCH_MIPS64 // Tests both signed and unsigned conversion. WASM_SIMD_TEST(F32x4ConvertI32x4) { - WasmRunner<int32_t, int32_t, float, float> r(execution_mode); + WasmRunner<int32_t, int32_t, float, float> r(kExecuteTurbofan, lower_simd); byte a = 0; byte expected_signed = 1; byte expected_unsigned = 2; @@ -470,10 +470,12 @@ WASM_SIMD_TEST(F32x4ConvertI32x4) { static_cast<float>(static_cast<uint32_t>(*i)))); } } +#endif // V8_TARGET_ARCH_ARM || V8_TARGET_ARCH_ARM64 || V8_TARGET_ARCH_MIPS || + // V8_TARGET_ARCH_MIPS64 -void RunF32x4UnOpTest(WasmExecutionMode execution_mode, WasmOpcode simd_op, +void RunF32x4UnOpTest(LowerSimd lower_simd, WasmOpcode simd_op, FloatUnOp expected_op, float error = 0.0f) { - WasmRunner<int32_t, float, float, float> r(execution_mode); + WasmRunner<int32_t, float, float, float> r(kExecuteTurbofan, lower_simd); byte a = 0; byte low = 1; byte high = 2; @@ -492,27 +494,35 @@ void RunF32x4UnOpTest(WasmExecutionMode execution_mode, WasmOpcode simd_op, } } +#if V8_TARGET_ARCH_ARM || V8_TARGET_ARCH_ARM64 || V8_TARGET_ARCH_MIPS || \ + V8_TARGET_ARCH_MIPS64 || V8_TARGET_ARCH_IA32 WASM_SIMD_TEST(F32x4Abs) { - RunF32x4UnOpTest(execution_mode, kExprF32x4Abs, std::abs); + RunF32x4UnOpTest(lower_simd, kExprF32x4Abs, std::abs); } WASM_SIMD_TEST(F32x4Neg) { - RunF32x4UnOpTest(execution_mode, kExprF32x4Neg, Negate); + RunF32x4UnOpTest(lower_simd, kExprF32x4Neg, Negate); } +#endif // V8_TARGET_ARCH_ARM || V8_TARGET_ARCH_ARM64 || V8_TARGET_ARCH_MIPS || + // V8_TARGET_ARCH_MIPS64 || V8_TARGET_ARCH_IA32 +#if V8_TARGET_ARCH_ARM || V8_TARGET_ARCH_ARM64 || V8_TARGET_ARCH_MIPS || \ + V8_TARGET_ARCH_MIPS64 || V8_TARGET_ARCH_X64 static const float kApproxError = 0.01f; WASM_SIMD_COMPILED_TEST(F32x4RecipApprox) { - RunF32x4UnOpTest(execution_mode, kExprF32x4RecipApprox, Recip, kApproxError); + RunF32x4UnOpTest(lower_simd, kExprF32x4RecipApprox, Recip, kApproxError); } WASM_SIMD_COMPILED_TEST(F32x4RecipSqrtApprox) { - RunF32x4UnOpTest(execution_mode, kExprF32x4RecipSqrtApprox, RecipSqrt, + RunF32x4UnOpTest(lower_simd, kExprF32x4RecipSqrtApprox, RecipSqrt, kApproxError); } +#endif // V8_TARGET_ARCH_ARM || V8_TARGET_ARCH_ARM64 || V8_TARGET_ARCH_MIPS || + // V8_TARGET_ARCH_MIPS64 || V8_TARGET_ARCH_X64 -void RunF32x4BinOpTest(WasmExecutionMode execution_mode, WasmOpcode simd_op, +void RunF32x4BinOpTest(LowerSimd lower_simd, WasmOpcode simd_op, FloatBinOp expected_op) { - WasmRunner<int32_t, float, float, float> r(execution_mode); + WasmRunner<int32_t, float, float, float> r(kExecuteTurbofan, lower_simd); byte a = 0; byte b = 1; byte expected = 2; @@ -535,25 +545,19 @@ void RunF32x4BinOpTest(WasmExecutionMode execution_mode, WasmOpcode simd_op, } } -WASM_SIMD_TEST(F32x4Add) { - RunF32x4BinOpTest(execution_mode, kExprF32x4Add, Add); -} -WASM_SIMD_TEST(F32x4Sub) { - RunF32x4BinOpTest(execution_mode, kExprF32x4Sub, Sub); -} -WASM_SIMD_TEST(F32x4Mul) { - RunF32x4BinOpTest(execution_mode, kExprF32x4Mul, Mul); -} +WASM_SIMD_TEST(F32x4Add) { RunF32x4BinOpTest(lower_simd, kExprF32x4Add, Add); } +WASM_SIMD_TEST(F32x4Sub) { RunF32x4BinOpTest(lower_simd, kExprF32x4Sub, Sub); } +WASM_SIMD_TEST(F32x4Mul) { RunF32x4BinOpTest(lower_simd, kExprF32x4Mul, Mul); } WASM_SIMD_TEST(F32x4_Min) { - RunF32x4BinOpTest(execution_mode, kExprF32x4Min, JSMin); + RunF32x4BinOpTest(lower_simd, kExprF32x4Min, JSMin); } WASM_SIMD_TEST(F32x4_Max) { - RunF32x4BinOpTest(execution_mode, kExprF32x4Max, JSMax); + RunF32x4BinOpTest(lower_simd, kExprF32x4Max, JSMax); } -void RunF32x4CompareOpTest(WasmExecutionMode execution_mode, WasmOpcode simd_op, +void RunF32x4CompareOpTest(LowerSimd lower_simd, WasmOpcode simd_op, FloatCompareOp expected_op) { - WasmRunner<int32_t, float, float, int32_t> r(execution_mode); + WasmRunner<int32_t, float, float, int32_t> r(kExecuteTurbofan, lower_simd); byte a = 0; byte b = 1; byte expected = 2; @@ -577,30 +581,28 @@ void RunF32x4CompareOpTest(WasmExecutionMode execution_mode, WasmOpcode simd_op, } WASM_SIMD_TEST(F32x4Eq) { - RunF32x4CompareOpTest(execution_mode, kExprF32x4Eq, Equal); + RunF32x4CompareOpTest(lower_simd, kExprF32x4Eq, Equal); } WASM_SIMD_TEST(F32x4Ne) { - RunF32x4CompareOpTest(execution_mode, kExprF32x4Ne, NotEqual); + RunF32x4CompareOpTest(lower_simd, kExprF32x4Ne, NotEqual); } WASM_SIMD_TEST(F32x4Gt) { - RunF32x4CompareOpTest(execution_mode, kExprF32x4Gt, Greater); + RunF32x4CompareOpTest(lower_simd, kExprF32x4Gt, Greater); } WASM_SIMD_TEST(F32x4Ge) { - RunF32x4CompareOpTest(execution_mode, kExprF32x4Ge, GreaterEqual); + RunF32x4CompareOpTest(lower_simd, kExprF32x4Ge, GreaterEqual); } WASM_SIMD_TEST(F32x4Lt) { - RunF32x4CompareOpTest(execution_mode, kExprF32x4Lt, Less); + RunF32x4CompareOpTest(lower_simd, kExprF32x4Lt, Less); } WASM_SIMD_TEST(F32x4Le) { - RunF32x4CompareOpTest(execution_mode, kExprF32x4Le, LessEqual); + RunF32x4CompareOpTest(lower_simd, kExprF32x4Le, LessEqual); } -#endif // V8_TARGET_ARCH_ARM || V8_TARGET_ARCH_ARM64 || V8_TARGET_ARCH_MIPS || - // V8_TARGET_ARCH_MIPS64 WASM_SIMD_TEST(I32x4Splat) { // Store SIMD value in a local variable, use extract lane to check lane values @@ -613,7 +615,7 @@ WASM_SIMD_TEST(I32x4Splat) { // return 0 // // return 1 - WasmRunner<int32_t, int32_t> r(execution_mode); + WasmRunner<int32_t, int32_t> r(kExecuteTurbofan, lower_simd); byte lane_val = 0; byte simd = r.AllocateLocal(kWasmS128); BUILD(r, @@ -624,7 +626,7 @@ WASM_SIMD_TEST(I32x4Splat) { } WASM_SIMD_TEST(I32x4ReplaceLane) { - WasmRunner<int32_t, int32_t, int32_t> r(execution_mode); + WasmRunner<int32_t, int32_t, int32_t> r(kExecuteTurbofan, lower_simd); byte old_val = 0; byte new_val = 1; byte simd = r.AllocateLocal(kWasmS128); @@ -650,7 +652,7 @@ WASM_SIMD_TEST(I32x4ReplaceLane) { } WASM_SIMD_TEST(I16x8Splat) { - WasmRunner<int32_t, int32_t> r(execution_mode); + WasmRunner<int32_t, int32_t> r(kExecuteTurbofan, lower_simd); byte lane_val = 0; byte simd = r.AllocateLocal(kWasmS128); BUILD(r, @@ -661,7 +663,7 @@ WASM_SIMD_TEST(I16x8Splat) { } WASM_SIMD_TEST(I16x8ReplaceLane) { - WasmRunner<int32_t, int32_t, int32_t> r(execution_mode); + WasmRunner<int32_t, int32_t, int32_t> r(kExecuteTurbofan, lower_simd); byte old_val = 0; byte new_val = 1; byte simd = r.AllocateLocal(kWasmS128); @@ -710,7 +712,7 @@ WASM_SIMD_TEST(I16x8ReplaceLane) { } WASM_SIMD_TEST(I8x16Splat) { - WasmRunner<int32_t, int32_t> r(execution_mode); + WasmRunner<int32_t, int32_t> r(kExecuteTurbofan, lower_simd); byte lane_val = 0; byte simd = r.AllocateLocal(kWasmS128); BUILD(r, @@ -721,7 +723,7 @@ WASM_SIMD_TEST(I8x16Splat) { } WASM_SIMD_TEST(I8x16ReplaceLane) { - WasmRunner<int32_t, int32_t, int32_t> r(execution_mode); + WasmRunner<int32_t, int32_t, int32_t> r(kExecuteTurbofan, lower_simd); byte old_val = 0; byte new_val = 1; byte simd = r.AllocateLocal(kWasmS128); @@ -828,7 +830,7 @@ WASM_SIMD_TEST(I8x16ReplaceLane) { V8_TARGET_ARCH_MIPS64 // Determines if conversion from float to int will be valid. bool CanRoundToZeroAndConvert(double val, bool unsigned_integer) { - const double max_uint = static_cast<double>(0xffffffffu); + const double max_uint = static_cast<double>(0xFFFFFFFFu); const double max_int = static_cast<double>(kMaxInt); const double min_int = static_cast<double>(kMinInt); @@ -849,7 +851,7 @@ int ConvertInvalidValue(double val, bool unsigned_integer) { return 0; } else { if (unsigned_integer) { - return (val < 0) ? 0 : 0xffffffffu; + return (val < 0) ? 0 : 0xFFFFFFFFu; } else { return (val < 0) ? kMinInt : kMaxInt; } @@ -868,7 +870,7 @@ int32_t ConvertToInt(double val, bool unsigned_integer) { // Tests both signed and unsigned conversion. WASM_SIMD_TEST(I32x4ConvertF32x4) { - WasmRunner<int32_t, float, int32_t, int32_t> r(execution_mode); + WasmRunner<int32_t, float, int32_t, int32_t> r(kExecuteTurbofan, lower_simd); byte a = 0; byte expected_signed = 1; byte expected_unsigned = 2; @@ -893,7 +895,8 @@ WASM_SIMD_TEST(I32x4ConvertF32x4) { // Tests both signed and unsigned conversion from I16x8 (unpacking). WASM_SIMD_COMPILED_TEST(I32x4ConvertI16x8) { - WasmRunner<int32_t, int32_t, int32_t, int32_t> r(execution_mode); + WasmRunner<int32_t, int32_t, int32_t, int32_t> r(kExecuteTurbofan, + lower_simd); byte a = 0; byte unpacked_signed = 1; byte unpacked_unsigned = 2; @@ -918,9 +921,9 @@ WASM_SIMD_COMPILED_TEST(I32x4ConvertI16x8) { #endif // V8_TARGET_ARCH_ARM || V8_TARGET_ARCH_ARM64 || V8_TARGET_ARCH_MIPS || // V8_TARGET_ARCH_MIPS64 -void RunI32x4UnOpTest(WasmExecutionMode execution_mode, WasmOpcode simd_op, +void RunI32x4UnOpTest(LowerSimd lower_simd, WasmOpcode simd_op, Int32UnOp expected_op) { - WasmRunner<int32_t, int32_t, int32_t> r(execution_mode); + WasmRunner<int32_t, int32_t, int32_t> r(kExecuteTurbofan, lower_simd); byte a = 0; byte expected = 1; byte simd = r.AllocateLocal(kWasmS128); @@ -932,16 +935,19 @@ void RunI32x4UnOpTest(WasmExecutionMode execution_mode, WasmOpcode simd_op, } WASM_SIMD_TEST(I32x4Neg) { - RunI32x4UnOpTest(execution_mode, kExprI32x4Neg, Negate); + RunI32x4UnOpTest(lower_simd, kExprI32x4Neg, Negate); } -#if V8_TARGET_ARCH_ARM || V8_TARGET_ARCH_ARM64 || V8_TARGET_ARCH_X64 -WASM_SIMD_TEST(S128Not) { RunI32x4UnOpTest(execution_mode, kExprS128Not, Not); } -#endif // V8_TARGET_ARCH_ARM || V8_TARGET_ARCH_ARM64 || V8_TARGET_ARCH_X64 +#if V8_TARGET_ARCH_ARM || V8_TARGET_ARCH_ARM64 || V8_TARGET_ARCH_X64 || \ + V8_TARGET_ARCH_IA32 +WASM_SIMD_TEST(S128Not) { RunI32x4UnOpTest(lower_simd, kExprS128Not, Not); } +#endif // V8_TARGET_ARCH_ARM || V8_TARGET_ARCH_ARM64 || V8_TARGET_ARCH_X64 || + // V8_TARGET_ARCH_IA32 -void RunI32x4BinOpTest(WasmExecutionMode execution_mode, WasmOpcode simd_op, +void RunI32x4BinOpTest(LowerSimd lower_simd, WasmOpcode simd_op, Int32BinOp expected_op) { - WasmRunner<int32_t, int32_t, int32_t, int32_t> r(execution_mode); + WasmRunner<int32_t, int32_t, int32_t, int32_t> r(kExecuteTurbofan, + lower_simd); byte a = 0; byte b = 1; byte expected = 2; @@ -958,51 +964,38 @@ void RunI32x4BinOpTest(WasmExecutionMode execution_mode, WasmOpcode simd_op, } } -WASM_SIMD_TEST(I32x4Add) { - RunI32x4BinOpTest(execution_mode, kExprI32x4Add, Add); -} +WASM_SIMD_TEST(I32x4Add) { RunI32x4BinOpTest(lower_simd, kExprI32x4Add, Add); } -WASM_SIMD_TEST(I32x4Sub) { - RunI32x4BinOpTest(execution_mode, kExprI32x4Sub, Sub); -} +WASM_SIMD_TEST(I32x4Sub) { RunI32x4BinOpTest(lower_simd, kExprI32x4Sub, Sub); } -WASM_SIMD_TEST(I32x4Mul) { - RunI32x4BinOpTest(execution_mode, kExprI32x4Mul, Mul); -} +WASM_SIMD_TEST(I32x4Mul) { RunI32x4BinOpTest(lower_simd, kExprI32x4Mul, Mul); } WASM_SIMD_TEST(I32x4MinS) { - RunI32x4BinOpTest(execution_mode, kExprI32x4MinS, Minimum); + RunI32x4BinOpTest(lower_simd, kExprI32x4MinS, Minimum); } WASM_SIMD_TEST(I32x4MaxS) { - RunI32x4BinOpTest(execution_mode, kExprI32x4MaxS, Maximum); + RunI32x4BinOpTest(lower_simd, kExprI32x4MaxS, Maximum); } WASM_SIMD_TEST(I32x4MinU) { - RunI32x4BinOpTest(execution_mode, kExprI32x4MinU, UnsignedMinimum); + RunI32x4BinOpTest(lower_simd, kExprI32x4MinU, UnsignedMinimum); } WASM_SIMD_TEST(I32x4MaxU) { - RunI32x4BinOpTest(execution_mode, kExprI32x4MaxU, UnsignedMaximum); + RunI32x4BinOpTest(lower_simd, kExprI32x4MaxU, UnsignedMaximum); } -#if V8_TARGET_ARCH_ARM || V8_TARGET_ARCH_ARM64 || V8_TARGET_ARCH_X64 || \ - V8_TARGET_ARCH_MIPS || V8_TARGET_ARCH_MIPS64 -WASM_SIMD_TEST(S128And) { - RunI32x4BinOpTest(execution_mode, kExprS128And, And); -} +WASM_SIMD_TEST(S128And) { RunI32x4BinOpTest(lower_simd, kExprS128And, And); } -WASM_SIMD_TEST(S128Or) { RunI32x4BinOpTest(execution_mode, kExprS128Or, Or); } +WASM_SIMD_TEST(S128Or) { RunI32x4BinOpTest(lower_simd, kExprS128Or, Or); } -WASM_SIMD_TEST(S128Xor) { - RunI32x4BinOpTest(execution_mode, kExprS128Xor, Xor); -} -#endif // V8_TARGET_ARCH_ARM || V8_TARGET_ARCH_ARM64 || V8_TARGET_ARCH_X64 || - // V8_TARGET_ARCH_MIPS || V8_TARGET_ARCH_MIPS64 +WASM_SIMD_TEST(S128Xor) { RunI32x4BinOpTest(lower_simd, kExprS128Xor, Xor); } -void RunI32x4CompareOpTest(WasmExecutionMode execution_mode, WasmOpcode simd_op, +void RunI32x4CompareOpTest(LowerSimd lower_simd, WasmOpcode simd_op, Int32CompareOp expected_op) { - WasmRunner<int32_t, int32_t, int32_t, int32_t> r(execution_mode); + WasmRunner<int32_t, int32_t, int32_t, int32_t> r(kExecuteTurbofan, + lower_simd); byte a = 0; byte b = 1; byte expected = 2; @@ -1020,48 +1013,48 @@ void RunI32x4CompareOpTest(WasmExecutionMode execution_mode, WasmOpcode simd_op, } WASM_SIMD_TEST(I32x4Eq) { - RunI32x4CompareOpTest(execution_mode, kExprI32x4Eq, Equal); + RunI32x4CompareOpTest(lower_simd, kExprI32x4Eq, Equal); } WASM_SIMD_TEST(I32x4Ne) { - RunI32x4CompareOpTest(execution_mode, kExprI32x4Ne, NotEqual); + RunI32x4CompareOpTest(lower_simd, kExprI32x4Ne, NotEqual); } WASM_SIMD_TEST(I32x4LtS) { - RunI32x4CompareOpTest(execution_mode, kExprI32x4LtS, Less); + RunI32x4CompareOpTest(lower_simd, kExprI32x4LtS, Less); } WASM_SIMD_TEST(I32x4LeS) { - RunI32x4CompareOpTest(execution_mode, kExprI32x4LeS, LessEqual); + RunI32x4CompareOpTest(lower_simd, kExprI32x4LeS, LessEqual); } WASM_SIMD_TEST(I32x4GtS) { - RunI32x4CompareOpTest(execution_mode, kExprI32x4GtS, Greater); + RunI32x4CompareOpTest(lower_simd, kExprI32x4GtS, Greater); } WASM_SIMD_TEST(I32x4GeS) { - RunI32x4CompareOpTest(execution_mode, kExprI32x4GeS, GreaterEqual); + RunI32x4CompareOpTest(lower_simd, kExprI32x4GeS, GreaterEqual); } WASM_SIMD_TEST(I32x4LtU) { - RunI32x4CompareOpTest(execution_mode, kExprI32x4LtU, UnsignedLess); + RunI32x4CompareOpTest(lower_simd, kExprI32x4LtU, UnsignedLess); } WASM_SIMD_TEST(I32x4LeU) { - RunI32x4CompareOpTest(execution_mode, kExprI32x4LeU, UnsignedLessEqual); + RunI32x4CompareOpTest(lower_simd, kExprI32x4LeU, UnsignedLessEqual); } WASM_SIMD_TEST(I32x4GtU) { - RunI32x4CompareOpTest(execution_mode, kExprI32x4GtU, UnsignedGreater); + RunI32x4CompareOpTest(lower_simd, kExprI32x4GtU, UnsignedGreater); } WASM_SIMD_TEST(I32x4GeU) { - RunI32x4CompareOpTest(execution_mode, kExprI32x4GeU, UnsignedGreaterEqual); + RunI32x4CompareOpTest(lower_simd, kExprI32x4GeU, UnsignedGreaterEqual); } -void RunI32x4ShiftOpTest(WasmExecutionMode execution_mode, WasmOpcode simd_op, +void RunI32x4ShiftOpTest(LowerSimd lower_simd, WasmOpcode simd_op, Int32ShiftOp expected_op, int shift) { - WasmRunner<int32_t, int32_t, int32_t> r(execution_mode); + WasmRunner<int32_t, int32_t, int32_t> r(kExecuteTurbofan, lower_simd); byte a = 0; byte expected = 1; byte simd = r.AllocateLocal(kWasmS128); @@ -1074,22 +1067,23 @@ void RunI32x4ShiftOpTest(WasmExecutionMode execution_mode, WasmOpcode simd_op, } WASM_SIMD_TEST(I32x4Shl) { - RunI32x4ShiftOpTest(execution_mode, kExprI32x4Shl, LogicalShiftLeft, 1); + RunI32x4ShiftOpTest(lower_simd, kExprI32x4Shl, LogicalShiftLeft, 1); } WASM_SIMD_TEST(I32x4ShrS) { - RunI32x4ShiftOpTest(execution_mode, kExprI32x4ShrS, ArithmeticShiftRight, 1); + RunI32x4ShiftOpTest(lower_simd, kExprI32x4ShrS, ArithmeticShiftRight, 1); } WASM_SIMD_TEST(I32x4ShrU) { - RunI32x4ShiftOpTest(execution_mode, kExprI32x4ShrU, LogicalShiftRight, 1); + RunI32x4ShiftOpTest(lower_simd, kExprI32x4ShrU, LogicalShiftRight, 1); } #if V8_TARGET_ARCH_ARM || V8_TARGET_ARCH_ARM64 || V8_TARGET_ARCH_MIPS || \ V8_TARGET_ARCH_MIPS64 // Tests both signed and unsigned conversion from I8x16 (unpacking). WASM_SIMD_COMPILED_TEST(I16x8ConvertI8x16) { - WasmRunner<int32_t, int32_t, int32_t, int32_t> r(execution_mode); + WasmRunner<int32_t, int32_t, int32_t, int32_t> r(kExecuteTurbofan, + lower_simd); byte a = 0; byte unpacked_signed = 1; byte unpacked_unsigned = 2; @@ -1113,9 +1107,9 @@ WASM_SIMD_COMPILED_TEST(I16x8ConvertI8x16) { #endif // V8_TARGET_ARCH_ARM || V8_TARGET_ARCH_ARM64 || V8_TARGET_ARCH_MIPS || // V8_TARGET_ARCH_MIPS64 -void RunI16x8UnOpTest(WasmExecutionMode execution_mode, WasmOpcode simd_op, +void RunI16x8UnOpTest(LowerSimd lower_simd, WasmOpcode simd_op, Int16UnOp expected_op) { - WasmRunner<int32_t, int32_t, int32_t> r(execution_mode); + WasmRunner<int32_t, int32_t, int32_t> r(kExecuteTurbofan, lower_simd); byte a = 0; byte expected = 1; byte simd = r.AllocateLocal(kWasmS128); @@ -1127,14 +1121,15 @@ void RunI16x8UnOpTest(WasmExecutionMode execution_mode, WasmOpcode simd_op, } WASM_SIMD_TEST(I16x8Neg) { - RunI16x8UnOpTest(execution_mode, kExprI16x8Neg, Negate); + RunI16x8UnOpTest(lower_simd, kExprI16x8Neg, Negate); } #if V8_TARGET_ARCH_ARM || V8_TARGET_ARCH_ARM64 || V8_TARGET_ARCH_MIPS || \ V8_TARGET_ARCH_MIPS64 // Tests both signed and unsigned conversion from I32x4 (packing). WASM_SIMD_COMPILED_TEST(I16x8ConvertI32x4) { - WasmRunner<int32_t, int32_t, int32_t, int32_t> r(execution_mode); + WasmRunner<int32_t, int32_t, int32_t, int32_t> r(kExecuteTurbofan, + lower_simd); byte a = 0; byte packed_signed = 1; byte packed_unsigned = 2; @@ -1155,16 +1150,17 @@ WASM_SIMD_COMPILED_TEST(I16x8ConvertI32x4) { int32_t packed_signed = Narrow<int16_t>(*i); int32_t packed_unsigned = UnsignedNarrow<int16_t>(*i); // Sign-extend here, since ExtractLane sign extends. - if (packed_unsigned & 0x8000) packed_unsigned |= 0xffff0000; + if (packed_unsigned & 0x8000) packed_unsigned |= 0xFFFF0000; CHECK_EQ(1, r.Call(*i, packed_signed, packed_unsigned)); } } #endif // V8_TARGET_ARCH_ARM || V8_TARGET_ARCH_ARM64 || V8_TARGET_ARCH_MIPS || // V8_TARGET_ARCH_MIPS64 -void RunI16x8BinOpTest(WasmExecutionMode execution_mode, WasmOpcode simd_op, +void RunI16x8BinOpTest(LowerSimd lower_simd, WasmOpcode simd_op, Int16BinOp expected_op) { - WasmRunner<int32_t, int32_t, int32_t, int32_t> r(execution_mode); + WasmRunner<int32_t, int32_t, int32_t, int32_t> r(kExecuteTurbofan, + lower_simd); byte a = 0; byte b = 1; byte expected = 2; @@ -1181,55 +1177,48 @@ void RunI16x8BinOpTest(WasmExecutionMode execution_mode, WasmOpcode simd_op, } } -WASM_SIMD_TEST(I16x8Add) { - RunI16x8BinOpTest(execution_mode, kExprI16x8Add, Add); -} +WASM_SIMD_TEST(I16x8Add) { RunI16x8BinOpTest(lower_simd, kExprI16x8Add, Add); } WASM_SIMD_TEST(I16x8AddSaturateS) { - RunI16x8BinOpTest(execution_mode, kExprI16x8AddSaturateS, AddSaturate); + RunI16x8BinOpTest(lower_simd, kExprI16x8AddSaturateS, AddSaturate); } -WASM_SIMD_TEST(I16x8Sub) { - RunI16x8BinOpTest(execution_mode, kExprI16x8Sub, Sub); -} +WASM_SIMD_TEST(I16x8Sub) { RunI16x8BinOpTest(lower_simd, kExprI16x8Sub, Sub); } WASM_SIMD_TEST(I16x8SubSaturateS) { - RunI16x8BinOpTest(execution_mode, kExprI16x8SubSaturateS, SubSaturate); + RunI16x8BinOpTest(lower_simd, kExprI16x8SubSaturateS, SubSaturate); } -WASM_SIMD_TEST(I16x8Mul) { - RunI16x8BinOpTest(execution_mode, kExprI16x8Mul, Mul); -} +WASM_SIMD_TEST(I16x8Mul) { RunI16x8BinOpTest(lower_simd, kExprI16x8Mul, Mul); } WASM_SIMD_TEST(I16x8MinS) { - RunI16x8BinOpTest(execution_mode, kExprI16x8MinS, Minimum); + RunI16x8BinOpTest(lower_simd, kExprI16x8MinS, Minimum); } WASM_SIMD_TEST(I16x8MaxS) { - RunI16x8BinOpTest(execution_mode, kExprI16x8MaxS, Maximum); + RunI16x8BinOpTest(lower_simd, kExprI16x8MaxS, Maximum); } WASM_SIMD_TEST(I16x8AddSaturateU) { - RunI16x8BinOpTest(execution_mode, kExprI16x8AddSaturateU, - UnsignedAddSaturate); + RunI16x8BinOpTest(lower_simd, kExprI16x8AddSaturateU, UnsignedAddSaturate); } WASM_SIMD_TEST(I16x8SubSaturateU) { - RunI16x8BinOpTest(execution_mode, kExprI16x8SubSaturateU, - UnsignedSubSaturate); + RunI16x8BinOpTest(lower_simd, kExprI16x8SubSaturateU, UnsignedSubSaturate); } WASM_SIMD_TEST(I16x8MinU) { - RunI16x8BinOpTest(execution_mode, kExprI16x8MinU, UnsignedMinimum); + RunI16x8BinOpTest(lower_simd, kExprI16x8MinU, UnsignedMinimum); } WASM_SIMD_TEST(I16x8MaxU) { - RunI16x8BinOpTest(execution_mode, kExprI16x8MaxU, UnsignedMaximum); + RunI16x8BinOpTest(lower_simd, kExprI16x8MaxU, UnsignedMaximum); } -void RunI16x8CompareOpTest(WasmExecutionMode execution_mode, WasmOpcode simd_op, +void RunI16x8CompareOpTest(LowerSimd lower_simd, WasmOpcode simd_op, Int16CompareOp expected_op) { - WasmRunner<int32_t, int32_t, int32_t, int32_t> r(execution_mode); + WasmRunner<int32_t, int32_t, int32_t, int32_t> r(kExecuteTurbofan, + lower_simd); byte a = 0; byte b = 1; byte expected = 2; @@ -1247,48 +1236,48 @@ void RunI16x8CompareOpTest(WasmExecutionMode execution_mode, WasmOpcode simd_op, } WASM_SIMD_TEST(I16x8Eq) { - RunI16x8CompareOpTest(execution_mode, kExprI16x8Eq, Equal); + RunI16x8CompareOpTest(lower_simd, kExprI16x8Eq, Equal); } WASM_SIMD_TEST(I16x8Ne) { - RunI16x8CompareOpTest(execution_mode, kExprI16x8Ne, NotEqual); + RunI16x8CompareOpTest(lower_simd, kExprI16x8Ne, NotEqual); } WASM_SIMD_TEST(I16x8LtS) { - RunI16x8CompareOpTest(execution_mode, kExprI16x8LtS, Less); + RunI16x8CompareOpTest(lower_simd, kExprI16x8LtS, Less); } WASM_SIMD_TEST(I16x8LeS) { - RunI16x8CompareOpTest(execution_mode, kExprI16x8LeS, LessEqual); + RunI16x8CompareOpTest(lower_simd, kExprI16x8LeS, LessEqual); } WASM_SIMD_TEST(I16x8GtS) { - RunI16x8CompareOpTest(execution_mode, kExprI16x8GtS, Greater); + RunI16x8CompareOpTest(lower_simd, kExprI16x8GtS, Greater); } WASM_SIMD_TEST(I16x8GeS) { - RunI16x8CompareOpTest(execution_mode, kExprI16x8GeS, GreaterEqual); + RunI16x8CompareOpTest(lower_simd, kExprI16x8GeS, GreaterEqual); } WASM_SIMD_TEST(I16x8GtU) { - RunI16x8CompareOpTest(execution_mode, kExprI16x8GtU, UnsignedGreater); + RunI16x8CompareOpTest(lower_simd, kExprI16x8GtU, UnsignedGreater); } WASM_SIMD_TEST(I16x8GeU) { - RunI16x8CompareOpTest(execution_mode, kExprI16x8GeU, UnsignedGreaterEqual); + RunI16x8CompareOpTest(lower_simd, kExprI16x8GeU, UnsignedGreaterEqual); } WASM_SIMD_TEST(I16x8LtU) { - RunI16x8CompareOpTest(execution_mode, kExprI16x8LtU, UnsignedLess); + RunI16x8CompareOpTest(lower_simd, kExprI16x8LtU, UnsignedLess); } WASM_SIMD_TEST(I16x8LeU) { - RunI16x8CompareOpTest(execution_mode, kExprI16x8LeU, UnsignedLessEqual); + RunI16x8CompareOpTest(lower_simd, kExprI16x8LeU, UnsignedLessEqual); } -void RunI16x8ShiftOpTest(WasmExecutionMode execution_mode, WasmOpcode simd_op, +void RunI16x8ShiftOpTest(LowerSimd lower_simd, WasmOpcode simd_op, Int16ShiftOp expected_op, int shift) { - WasmRunner<int32_t, int32_t, int32_t> r(execution_mode); + WasmRunner<int32_t, int32_t, int32_t> r(kExecuteTurbofan, lower_simd); byte a = 0; byte expected = 1; byte simd = r.AllocateLocal(kWasmS128); @@ -1301,20 +1290,20 @@ void RunI16x8ShiftOpTest(WasmExecutionMode execution_mode, WasmOpcode simd_op, } WASM_SIMD_TEST(I16x8Shl) { - RunI16x8ShiftOpTest(execution_mode, kExprI16x8Shl, LogicalShiftLeft, 1); + RunI16x8ShiftOpTest(lower_simd, kExprI16x8Shl, LogicalShiftLeft, 1); } WASM_SIMD_TEST(I16x8ShrS) { - RunI16x8ShiftOpTest(execution_mode, kExprI16x8ShrS, ArithmeticShiftRight, 1); + RunI16x8ShiftOpTest(lower_simd, kExprI16x8ShrS, ArithmeticShiftRight, 1); } WASM_SIMD_TEST(I16x8ShrU) { - RunI16x8ShiftOpTest(execution_mode, kExprI16x8ShrU, LogicalShiftRight, 1); + RunI16x8ShiftOpTest(lower_simd, kExprI16x8ShrU, LogicalShiftRight, 1); } -void RunI8x16UnOpTest(WasmExecutionMode execution_mode, WasmOpcode simd_op, +void RunI8x16UnOpTest(LowerSimd lower_simd, WasmOpcode simd_op, Int8UnOp expected_op) { - WasmRunner<int32_t, int32_t, int32_t> r(execution_mode); + WasmRunner<int32_t, int32_t, int32_t> r(kExecuteTurbofan, lower_simd); byte a = 0; byte expected = 1; byte simd = r.AllocateLocal(kWasmS128); @@ -1326,14 +1315,15 @@ void RunI8x16UnOpTest(WasmExecutionMode execution_mode, WasmOpcode simd_op, } WASM_SIMD_TEST(I8x16Neg) { - RunI8x16UnOpTest(execution_mode, kExprI8x16Neg, Negate); + RunI8x16UnOpTest(lower_simd, kExprI8x16Neg, Negate); } #if V8_TARGET_ARCH_ARM || V8_TARGET_ARCH_ARM64 || V8_TARGET_ARCH_MIPS || \ V8_TARGET_ARCH_MIPS64 // Tests both signed and unsigned conversion from I16x8 (packing). WASM_SIMD_COMPILED_TEST(I8x16ConvertI16x8) { - WasmRunner<int32_t, int32_t, int32_t, int32_t> r(execution_mode); + WasmRunner<int32_t, int32_t, int32_t, int32_t> r(kExecuteTurbofan, + lower_simd); byte a = 0; byte packed_signed = 1; byte packed_unsigned = 2; @@ -1354,16 +1344,17 @@ WASM_SIMD_COMPILED_TEST(I8x16ConvertI16x8) { int32_t packed_signed = Narrow<int8_t>(*i); int32_t packed_unsigned = UnsignedNarrow<int8_t>(*i); // Sign-extend here, since ExtractLane sign extends. - if (packed_unsigned & 0x80) packed_unsigned |= 0xffffff00; + if (packed_unsigned & 0x80) packed_unsigned |= 0xFFFFFF00; CHECK_EQ(1, r.Call(*i, packed_signed, packed_unsigned)); } } #endif // V8_TARGET_ARCH_ARM || V8_TARGET_ARCH_ARM64 || V8_TARGET_ARCH_MIPS || // V8_TARGET_ARCH_MIPS64 -void RunI8x16BinOpTest(WasmExecutionMode execution_mode, WasmOpcode simd_op, +void RunI8x16BinOpTest(LowerSimd lower_simd, WasmOpcode simd_op, Int8BinOp expected_op) { - WasmRunner<int32_t, int32_t, int32_t, int32_t> r(execution_mode); + WasmRunner<int32_t, int32_t, int32_t, int32_t> r(kExecuteTurbofan, + lower_simd); byte a = 0; byte b = 1; byte expected = 2; @@ -1380,51 +1371,46 @@ void RunI8x16BinOpTest(WasmExecutionMode execution_mode, WasmOpcode simd_op, } } -WASM_SIMD_TEST(I8x16Add) { - RunI8x16BinOpTest(execution_mode, kExprI8x16Add, Add); -} +WASM_SIMD_TEST(I8x16Add) { RunI8x16BinOpTest(lower_simd, kExprI8x16Add, Add); } WASM_SIMD_TEST(I8x16AddSaturateS) { - RunI8x16BinOpTest(execution_mode, kExprI8x16AddSaturateS, AddSaturate); + RunI8x16BinOpTest(lower_simd, kExprI8x16AddSaturateS, AddSaturate); } -WASM_SIMD_TEST(I8x16Sub) { - RunI8x16BinOpTest(execution_mode, kExprI8x16Sub, Sub); -} +WASM_SIMD_TEST(I8x16Sub) { RunI8x16BinOpTest(lower_simd, kExprI8x16Sub, Sub); } WASM_SIMD_TEST(I8x16SubSaturateS) { - RunI8x16BinOpTest(execution_mode, kExprI8x16SubSaturateS, SubSaturate); + RunI8x16BinOpTest(lower_simd, kExprI8x16SubSaturateS, SubSaturate); } WASM_SIMD_TEST(I8x16MinS) { - RunI8x16BinOpTest(execution_mode, kExprI8x16MinS, Minimum); + RunI8x16BinOpTest(lower_simd, kExprI8x16MinS, Minimum); } WASM_SIMD_TEST(I8x16MaxS) { - RunI8x16BinOpTest(execution_mode, kExprI8x16MaxS, Maximum); + RunI8x16BinOpTest(lower_simd, kExprI8x16MaxS, Maximum); } WASM_SIMD_TEST(I8x16AddSaturateU) { - RunI8x16BinOpTest(execution_mode, kExprI8x16AddSaturateU, - UnsignedAddSaturate); + RunI8x16BinOpTest(lower_simd, kExprI8x16AddSaturateU, UnsignedAddSaturate); } WASM_SIMD_TEST(I8x16SubSaturateU) { - RunI8x16BinOpTest(execution_mode, kExprI8x16SubSaturateU, - UnsignedSubSaturate); + RunI8x16BinOpTest(lower_simd, kExprI8x16SubSaturateU, UnsignedSubSaturate); } WASM_SIMD_TEST(I8x16MinU) { - RunI8x16BinOpTest(execution_mode, kExprI8x16MinU, UnsignedMinimum); + RunI8x16BinOpTest(lower_simd, kExprI8x16MinU, UnsignedMinimum); } WASM_SIMD_TEST(I8x16MaxU) { - RunI8x16BinOpTest(execution_mode, kExprI8x16MaxU, UnsignedMaximum); + RunI8x16BinOpTest(lower_simd, kExprI8x16MaxU, UnsignedMaximum); } -void RunI8x16CompareOpTest(WasmExecutionMode execution_mode, WasmOpcode simd_op, +void RunI8x16CompareOpTest(LowerSimd lower_simd, WasmOpcode simd_op, Int8CompareOp expected_op) { - WasmRunner<int32_t, int32_t, int32_t, int32_t> r(execution_mode); + WasmRunner<int32_t, int32_t, int32_t, int32_t> r(kExecuteTurbofan, + lower_simd); byte a = 0; byte b = 1; byte expected = 2; @@ -1442,56 +1428,54 @@ void RunI8x16CompareOpTest(WasmExecutionMode execution_mode, WasmOpcode simd_op, } WASM_SIMD_TEST(I8x16Eq) { - RunI8x16CompareOpTest(execution_mode, kExprI8x16Eq, Equal); + RunI8x16CompareOpTest(lower_simd, kExprI8x16Eq, Equal); } WASM_SIMD_TEST(I8x16Ne) { - RunI8x16CompareOpTest(execution_mode, kExprI8x16Ne, NotEqual); + RunI8x16CompareOpTest(lower_simd, kExprI8x16Ne, NotEqual); } WASM_SIMD_TEST(I8x16GtS) { - RunI8x16CompareOpTest(execution_mode, kExprI8x16GtS, Greater); + RunI8x16CompareOpTest(lower_simd, kExprI8x16GtS, Greater); } WASM_SIMD_TEST(I8x16GeS) { - RunI8x16CompareOpTest(execution_mode, kExprI8x16GeS, GreaterEqual); + RunI8x16CompareOpTest(lower_simd, kExprI8x16GeS, GreaterEqual); } WASM_SIMD_TEST(I8x16LtS) { - RunI8x16CompareOpTest(execution_mode, kExprI8x16LtS, Less); + RunI8x16CompareOpTest(lower_simd, kExprI8x16LtS, Less); } WASM_SIMD_TEST(I8x16LeS) { - RunI8x16CompareOpTest(execution_mode, kExprI8x16LeS, LessEqual); + RunI8x16CompareOpTest(lower_simd, kExprI8x16LeS, LessEqual); } WASM_SIMD_TEST(I8x16GtU) { - RunI8x16CompareOpTest(execution_mode, kExprI8x16GtU, UnsignedGreater); + RunI8x16CompareOpTest(lower_simd, kExprI8x16GtU, UnsignedGreater); } WASM_SIMD_TEST(I8x16GeU) { - RunI8x16CompareOpTest(execution_mode, kExprI8x16GeU, UnsignedGreaterEqual); + RunI8x16CompareOpTest(lower_simd, kExprI8x16GeU, UnsignedGreaterEqual); } WASM_SIMD_TEST(I8x16LtU) { - RunI8x16CompareOpTest(execution_mode, kExprI8x16LtU, UnsignedLess); + RunI8x16CompareOpTest(lower_simd, kExprI8x16LtU, UnsignedLess); } WASM_SIMD_TEST(I8x16LeU) { - RunI8x16CompareOpTest(execution_mode, kExprI8x16LeU, UnsignedLessEqual); + RunI8x16CompareOpTest(lower_simd, kExprI8x16LeU, UnsignedLessEqual); } #if V8_TARGET_ARCH_ARM || V8_TARGET_ARCH_ARM64 || V8_TARGET_ARCH_MIPS || \ V8_TARGET_ARCH_MIPS64 -WASM_SIMD_TEST(I8x16Mul) { - RunI8x16BinOpTest(execution_mode, kExprI8x16Mul, Mul); -} +WASM_SIMD_TEST(I8x16Mul) { RunI8x16BinOpTest(lower_simd, kExprI8x16Mul, Mul); } #endif // V8_TARGET_ARCH_ARM || V8_TARGET_ARCH_ARM64 || V8_TARGET_ARCH_MIPS || // V8_TARGET_ARCH_MIPS64 -void RunI8x16ShiftOpTest(WasmExecutionMode execution_mode, WasmOpcode simd_op, +void RunI8x16ShiftOpTest(LowerSimd lower_simd, WasmOpcode simd_op, Int8ShiftOp expected_op, int shift) { - WasmRunner<int32_t, int32_t, int32_t> r(execution_mode); + WasmRunner<int32_t, int32_t, int32_t> r(kExecuteTurbofan, lower_simd); byte a = 0; byte expected = 1; byte simd = r.AllocateLocal(kWasmS128); @@ -1506,15 +1490,15 @@ void RunI8x16ShiftOpTest(WasmExecutionMode execution_mode, WasmOpcode simd_op, #if V8_TARGET_ARCH_ARM || V8_TARGET_ARCH_ARM64 || V8_TARGET_ARCH_MIPS || \ V8_TARGET_ARCH_MIPS64 WASM_SIMD_TEST(I8x16Shl) { - RunI8x16ShiftOpTest(execution_mode, kExprI8x16Shl, LogicalShiftLeft, 1); + RunI8x16ShiftOpTest(lower_simd, kExprI8x16Shl, LogicalShiftLeft, 1); } WASM_SIMD_TEST(I8x16ShrS) { - RunI8x16ShiftOpTest(execution_mode, kExprI8x16ShrS, ArithmeticShiftRight, 1); + RunI8x16ShiftOpTest(lower_simd, kExprI8x16ShrS, ArithmeticShiftRight, 1); } WASM_SIMD_TEST(I8x16ShrU) { - RunI8x16ShiftOpTest(execution_mode, kExprI8x16ShrU, LogicalShiftRight, 1); + RunI8x16ShiftOpTest(lower_simd, kExprI8x16ShrU, LogicalShiftRight, 1); } #endif // V8_TARGET_ARCH_ARM || V8_TARGET_ARCH_ARM64 || V8_TARGET_ARCH_MIPS || // V8_TARGET_ARCH_MIPS64 @@ -1526,7 +1510,7 @@ WASM_SIMD_TEST(I8x16ShrU) { // vector. #define WASM_SIMD_SELECT_TEST(format) \ WASM_SIMD_COMPILED_TEST(S##format##Select) { \ - WasmRunner<int32_t, int32_t, int32_t> r(execution_mode); \ + WasmRunner<int32_t, int32_t, int32_t> r(kExecuteTurbofan, lower_simd); \ byte val1 = 0; \ byte val2 = 1; \ byte src1 = r.AllocateLocal(kWasmS128); \ @@ -1566,7 +1550,8 @@ WASM_SIMD_SELECT_TEST(8x16) // rest 0. The mask is not the result of a comparison op. #define WASM_SIMD_NON_CANONICAL_SELECT_TEST(format) \ WASM_SIMD_COMPILED_TEST(S##format##NonCanonicalSelect) { \ - WasmRunner<int32_t, int32_t, int32_t, int32_t> r(execution_mode); \ + WasmRunner<int32_t, int32_t, int32_t, int32_t> r(kExecuteTurbofan, \ + lower_simd); \ byte val1 = 0; \ byte val2 = 1; \ byte combined = 2; \ @@ -1602,9 +1587,9 @@ WASM_SIMD_NON_CANONICAL_SELECT_TEST(8x16) // Test binary ops with two lane test patterns, all lanes distinct. template <typename T> void RunBinaryLaneOpTest( - WasmExecutionMode execution_mode, WasmOpcode simd_op, + LowerSimd lower_simd, WasmOpcode simd_op, const std::array<T, kSimd128Size / sizeof(T)>& expected) { - WasmRunner<int32_t> r(execution_mode); + WasmRunner<int32_t> r(kExecuteTurbofan, lower_simd); // Set up two test patterns as globals, e.g. [0, 1, 2, 3] and [4, 5, 6, 7]. T* src0 = r.builder().AddGlobal<T>(kWasmS128); T* src1 = r.builder().AddGlobal<T>(kWasmS128); @@ -1633,12 +1618,11 @@ void RunBinaryLaneOpTest( } WASM_SIMD_COMPILED_TEST(I32x4AddHoriz) { - RunBinaryLaneOpTest<int32_t>(execution_mode, kExprI32x4AddHoriz, - {{1, 5, 9, 13}}); + RunBinaryLaneOpTest<int32_t>(lower_simd, kExprI32x4AddHoriz, {{1, 5, 9, 13}}); } WASM_SIMD_COMPILED_TEST(I16x8AddHoriz) { - RunBinaryLaneOpTest<int16_t>(execution_mode, kExprI16x8AddHoriz, + RunBinaryLaneOpTest<int16_t>(lower_simd, kExprI16x8AddHoriz, {{1, 5, 9, 13, 17, 21, 25, 29}}); } #endif // V8_TARGET_ARCH_ARM || V8_TARGET_ARCH_ARM64 || V8_TARGET_ARCH_X64 || @@ -1647,7 +1631,7 @@ WASM_SIMD_COMPILED_TEST(I16x8AddHoriz) { #if V8_TARGET_ARCH_ARM || V8_TARGET_ARCH_ARM64 || V8_TARGET_ARCH_MIPS || \ V8_TARGET_ARCH_MIPS64 WASM_SIMD_COMPILED_TEST(F32x4AddHoriz) { - RunBinaryLaneOpTest<float>(execution_mode, kExprF32x4AddHoriz, + RunBinaryLaneOpTest<float>(lower_simd, kExprF32x4AddHoriz, {{1.0f, 5.0f, 9.0f, 13.0f}}); } @@ -1655,255 +1639,255 @@ WASM_SIMD_COMPILED_TEST(F32x4AddHoriz) { // Test a normal and unary versions (where second operand isn't used). WASM_SIMD_COMPILED_TEST(S32x4Dup) { RunBinaryLaneOpTest<int8_t>( - execution_mode, kExprS8x16Shuffle, + lower_simd, kExprS8x16Shuffle, {{16, 17, 18, 19, 16, 17, 18, 19, 16, 17, 18, 19, 16, 17, 18, 19}}); RunBinaryLaneOpTest<int8_t>( - execution_mode, kExprS8x16Shuffle, + lower_simd, kExprS8x16Shuffle, {{4, 5, 6, 7, 4, 5, 6, 7, 4, 5, 6, 7, 4, 5, 6, 7}}); } WASM_SIMD_COMPILED_TEST(S32x4ZipLeft) { RunBinaryLaneOpTest<int8_t>( - execution_mode, kExprS8x16Shuffle, + lower_simd, kExprS8x16Shuffle, {{0, 1, 2, 3, 16, 17, 18, 19, 4, 5, 6, 7, 20, 21, 22, 23}}); RunBinaryLaneOpTest<int8_t>( - execution_mode, kExprS8x16Shuffle, + lower_simd, kExprS8x16Shuffle, {{0, 1, 2, 3, 0, 1, 2, 3, 4, 5, 6, 7, 4, 5, 6, 7}}); } WASM_SIMD_COMPILED_TEST(S32x4ZipRight) { RunBinaryLaneOpTest<int8_t>( - execution_mode, kExprS8x16Shuffle, + lower_simd, kExprS8x16Shuffle, {{8, 9, 10, 11, 24, 25, 26, 27, 12, 13, 14, 15, 28, 29, 30, 31}}); RunBinaryLaneOpTest<int8_t>( - execution_mode, kExprS8x16Shuffle, + lower_simd, kExprS8x16Shuffle, {{8, 9, 10, 11, 8, 9, 10, 11, 12, 13, 14, 15, 12, 13, 14, 15}}); } WASM_SIMD_COMPILED_TEST(S32x4UnzipLeft) { RunBinaryLaneOpTest<int8_t>( - execution_mode, kExprS8x16Shuffle, + lower_simd, kExprS8x16Shuffle, {{0, 1, 2, 3, 8, 9, 10, 11, 16, 17, 18, 19, 24, 25, 26, 27}}); RunBinaryLaneOpTest<int8_t>( - execution_mode, kExprS8x16Shuffle, + lower_simd, kExprS8x16Shuffle, {{0, 1, 2, 3, 8, 9, 10, 11, 0, 1, 2, 3, 8, 9, 10, 11}}); } WASM_SIMD_COMPILED_TEST(S32x4UnzipRight) { RunBinaryLaneOpTest<int8_t>( - execution_mode, kExprS8x16Shuffle, + lower_simd, kExprS8x16Shuffle, {{4, 5, 6, 7, 12, 13, 14, 15, 20, 21, 22, 23, 28, 29, 30, 31}}); RunBinaryLaneOpTest<int8_t>( - execution_mode, kExprS8x16Shuffle, + lower_simd, kExprS8x16Shuffle, {{4, 5, 6, 7, 12, 13, 14, 15, 4, 5, 6, 7, 12, 13, 14, 15}}); } WASM_SIMD_COMPILED_TEST(S32x4TransposeLeft) { RunBinaryLaneOpTest<int8_t>( - execution_mode, kExprS8x16Shuffle, + lower_simd, kExprS8x16Shuffle, {{0, 1, 2, 3, 16, 17, 18, 19, 8, 9, 10, 11, 24, 25, 26, 27}}); RunBinaryLaneOpTest<int8_t>( - execution_mode, kExprS8x16Shuffle, + lower_simd, kExprS8x16Shuffle, {{0, 1, 2, 3, 0, 1, 2, 3, 8, 9, 10, 11, 8, 9, 10, 11}}); } WASM_SIMD_COMPILED_TEST(S32x4TransposeRight) { RunBinaryLaneOpTest<int8_t>( - execution_mode, kExprS8x16Shuffle, + lower_simd, kExprS8x16Shuffle, {{4, 5, 6, 7, 20, 21, 22, 23, 12, 13, 14, 15, 28, 29, 30, 31}}); RunBinaryLaneOpTest<int8_t>( - execution_mode, kExprS8x16Shuffle, + lower_simd, kExprS8x16Shuffle, {{4, 5, 6, 7, 4, 5, 6, 7, 12, 13, 14, 15, 12, 13, 14, 15}}); } // Reverses are only unary. WASM_SIMD_COMPILED_TEST(S32x2Reverse) { RunBinaryLaneOpTest<int8_t>( - execution_mode, kExprS8x16Shuffle, + lower_simd, kExprS8x16Shuffle, {{4, 5, 6, 7, 0, 1, 2, 3, 12, 13, 14, 15, 8, 9, 10, 11}}); } // Test irregular shuffle. WASM_SIMD_COMPILED_TEST(S32x4Irregular) { RunBinaryLaneOpTest<int8_t>( - execution_mode, kExprS8x16Shuffle, + lower_simd, kExprS8x16Shuffle, {{0, 1, 2, 3, 16, 17, 18, 19, 16, 17, 18, 19, 20, 21, 22, 23}}); RunBinaryLaneOpTest<int8_t>( - execution_mode, kExprS8x16Shuffle, + lower_simd, kExprS8x16Shuffle, {{0, 1, 2, 3, 0, 1, 2, 3, 0, 1, 2, 3, 4, 5, 6, 7}}); } WASM_SIMD_COMPILED_TEST(S16x8Dup) { RunBinaryLaneOpTest<int8_t>( - execution_mode, kExprS8x16Shuffle, + lower_simd, kExprS8x16Shuffle, {{18, 19, 18, 19, 18, 19, 18, 19, 18, 19, 18, 19, 18, 19, 18, 19}}); RunBinaryLaneOpTest<int8_t>( - execution_mode, kExprS8x16Shuffle, + lower_simd, kExprS8x16Shuffle, {{6, 7, 6, 7, 6, 7, 6, 7, 6, 7, 6, 7, 6, 7, 6, 7}}); } WASM_SIMD_COMPILED_TEST(S16x8ZipLeft) { RunBinaryLaneOpTest<int8_t>( - execution_mode, kExprS8x16Shuffle, + lower_simd, kExprS8x16Shuffle, {{0, 1, 16, 17, 2, 3, 18, 19, 4, 5, 20, 21, 6, 7, 22, 23}}); RunBinaryLaneOpTest<int8_t>( - execution_mode, kExprS8x16Shuffle, + lower_simd, kExprS8x16Shuffle, {{0, 1, 0, 1, 2, 3, 2, 3, 4, 5, 4, 5, 6, 7, 6, 7}}); } WASM_SIMD_COMPILED_TEST(S16x8ZipRight) { RunBinaryLaneOpTest<int8_t>( - execution_mode, kExprS8x16Shuffle, + lower_simd, kExprS8x16Shuffle, {{8, 9, 24, 25, 10, 11, 26, 27, 12, 13, 28, 29, 14, 15, 30, 31}}); RunBinaryLaneOpTest<int8_t>( - execution_mode, kExprS8x16Shuffle, + lower_simd, kExprS8x16Shuffle, {{8, 9, 8, 9, 10, 11, 10, 11, 12, 13, 12, 13, 14, 15, 14, 15}}); } WASM_SIMD_COMPILED_TEST(S16x8UnzipLeft) { RunBinaryLaneOpTest<int8_t>( - execution_mode, kExprS8x16Shuffle, + lower_simd, kExprS8x16Shuffle, {{0, 1, 4, 5, 8, 9, 12, 13, 16, 17, 20, 21, 24, 25, 28, 29}}); RunBinaryLaneOpTest<int8_t>( - execution_mode, kExprS8x16Shuffle, + lower_simd, kExprS8x16Shuffle, {{0, 1, 4, 5, 8, 9, 12, 13, 0, 1, 4, 5, 8, 9, 12, 13}}); } WASM_SIMD_COMPILED_TEST(S16x8UnzipRight) { RunBinaryLaneOpTest<int8_t>( - execution_mode, kExprS8x16Shuffle, + lower_simd, kExprS8x16Shuffle, {{2, 3, 6, 7, 10, 11, 14, 15, 18, 19, 22, 23, 26, 27, 30, 31}}); RunBinaryLaneOpTest<int8_t>( - execution_mode, kExprS8x16Shuffle, + lower_simd, kExprS8x16Shuffle, {{2, 3, 6, 7, 10, 11, 14, 15, 2, 3, 6, 7, 10, 11, 14, 15}}); } WASM_SIMD_COMPILED_TEST(S16x8TransposeLeft) { RunBinaryLaneOpTest<int8_t>( - execution_mode, kExprS8x16Shuffle, + lower_simd, kExprS8x16Shuffle, {{0, 1, 16, 17, 4, 5, 20, 21, 8, 9, 24, 25, 12, 13, 28, 29}}); RunBinaryLaneOpTest<int8_t>( - execution_mode, kExprS8x16Shuffle, + lower_simd, kExprS8x16Shuffle, {{0, 1, 0, 1, 4, 5, 4, 5, 8, 9, 8, 9, 12, 13, 12, 13}}); } WASM_SIMD_COMPILED_TEST(S16x8TransposeRight) { RunBinaryLaneOpTest<int8_t>( - execution_mode, kExprS8x16Shuffle, + lower_simd, kExprS8x16Shuffle, {{2, 3, 18, 19, 6, 7, 22, 23, 10, 11, 26, 27, 14, 15, 30, 31}}); RunBinaryLaneOpTest<int8_t>( - execution_mode, kExprS8x16Shuffle, + lower_simd, kExprS8x16Shuffle, {{2, 3, 2, 3, 6, 7, 6, 7, 10, 11, 10, 11, 14, 15, 14, 15}}); } WASM_SIMD_COMPILED_TEST(S16x4Reverse) { RunBinaryLaneOpTest<int8_t>( - execution_mode, kExprS8x16Shuffle, + lower_simd, kExprS8x16Shuffle, {{6, 7, 4, 5, 2, 3, 0, 1, 14, 15, 12, 13, 10, 11, 8, 9}}); } WASM_SIMD_COMPILED_TEST(S16x2Reverse) { RunBinaryLaneOpTest<int8_t>( - execution_mode, kExprS8x16Shuffle, + lower_simd, kExprS8x16Shuffle, {{2, 3, 0, 1, 6, 7, 4, 5, 10, 11, 8, 9, 14, 15, 12, 13}}); } WASM_SIMD_COMPILED_TEST(S16x8Irregular) { RunBinaryLaneOpTest<int8_t>( - execution_mode, kExprS8x16Shuffle, + lower_simd, kExprS8x16Shuffle, {{0, 1, 16, 17, 16, 17, 0, 1, 4, 5, 20, 21, 6, 7, 22, 23}}); RunBinaryLaneOpTest<int8_t>( - execution_mode, kExprS8x16Shuffle, + lower_simd, kExprS8x16Shuffle, {{0, 1, 0, 1, 0, 1, 0, 1, 4, 5, 4, 5, 6, 7, 6, 7}}); } WASM_SIMD_COMPILED_TEST(S8x16Dup) { RunBinaryLaneOpTest<int8_t>( - execution_mode, kExprS8x16Shuffle, + lower_simd, kExprS8x16Shuffle, {{19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19}}); RunBinaryLaneOpTest<int8_t>( - execution_mode, kExprS8x16Shuffle, + lower_simd, kExprS8x16Shuffle, {{7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7}}); } WASM_SIMD_COMPILED_TEST(S8x16ZipLeft) { RunBinaryLaneOpTest<int8_t>( - execution_mode, kExprS8x16Shuffle, + lower_simd, kExprS8x16Shuffle, {{0, 16, 1, 17, 2, 18, 3, 19, 4, 20, 5, 21, 6, 22, 7, 23}}); RunBinaryLaneOpTest<int8_t>( - execution_mode, kExprS8x16Shuffle, + lower_simd, kExprS8x16Shuffle, {{0, 0, 1, 1, 2, 2, 3, 3, 4, 4, 5, 5, 6, 6, 7, 7}}); } WASM_SIMD_COMPILED_TEST(S8x16ZipRight) { RunBinaryLaneOpTest<int8_t>( - execution_mode, kExprS8x16Shuffle, + lower_simd, kExprS8x16Shuffle, {{8, 24, 9, 25, 10, 26, 11, 27, 12, 28, 13, 29, 14, 30, 15, 31}}); RunBinaryLaneOpTest<int8_t>( - execution_mode, kExprS8x16Shuffle, + lower_simd, kExprS8x16Shuffle, {{8, 8, 9, 9, 10, 10, 11, 11, 12, 12, 13, 13, 14, 14, 15, 15}}); } WASM_SIMD_COMPILED_TEST(S8x16UnzipLeft) { RunBinaryLaneOpTest<int8_t>( - execution_mode, kExprS8x16Shuffle, + lower_simd, kExprS8x16Shuffle, {{0, 2, 4, 6, 8, 10, 12, 14, 16, 18, 20, 22, 24, 26, 28, 30}}); RunBinaryLaneOpTest<int8_t>( - execution_mode, kExprS8x16Shuffle, + lower_simd, kExprS8x16Shuffle, {{0, 2, 4, 6, 8, 10, 12, 14, 0, 2, 4, 6, 8, 10, 12, 14}}); } WASM_SIMD_COMPILED_TEST(S8x16UnzipRight) { RunBinaryLaneOpTest<int8_t>( - execution_mode, kExprS8x16Shuffle, + lower_simd, kExprS8x16Shuffle, {{1, 3, 5, 7, 9, 11, 13, 15, 17, 19, 21, 23, 25, 27, 29, 31}}); RunBinaryLaneOpTest<int8_t>( - execution_mode, kExprS8x16Shuffle, + lower_simd, kExprS8x16Shuffle, {{1, 3, 5, 7, 9, 11, 13, 15, 1, 3, 5, 7, 9, 11, 13, 15}}); } WASM_SIMD_COMPILED_TEST(S8x16TransposeLeft) { RunBinaryLaneOpTest<int8_t>( - execution_mode, kExprS8x16Shuffle, + lower_simd, kExprS8x16Shuffle, {{0, 16, 2, 18, 4, 20, 6, 22, 8, 24, 10, 26, 12, 28, 14, 30}}); RunBinaryLaneOpTest<int8_t>( - execution_mode, kExprS8x16Shuffle, + lower_simd, kExprS8x16Shuffle, {{0, 0, 2, 2, 4, 4, 6, 6, 8, 8, 10, 10, 12, 12, 14, 14}}); } WASM_SIMD_COMPILED_TEST(S8x16TransposeRight) { RunBinaryLaneOpTest<int8_t>( - execution_mode, kExprS8x16Shuffle, + lower_simd, kExprS8x16Shuffle, {{1, 17, 3, 19, 5, 21, 7, 23, 9, 25, 11, 27, 13, 29, 15, 31}}); RunBinaryLaneOpTest<int8_t>( - execution_mode, kExprS8x16Shuffle, + lower_simd, kExprS8x16Shuffle, {{1, 1, 3, 3, 5, 5, 7, 7, 9, 9, 11, 11, 13, 13, 15, 15}}); } WASM_SIMD_COMPILED_TEST(S8x8Reverse) { RunBinaryLaneOpTest<int8_t>( - execution_mode, kExprS8x16Shuffle, + lower_simd, kExprS8x16Shuffle, {{7, 6, 5, 4, 3, 2, 1, 0, 15, 14, 13, 12, 11, 10, 9, 8}}); } WASM_SIMD_COMPILED_TEST(S8x4Reverse) { RunBinaryLaneOpTest<int8_t>( - execution_mode, kExprS8x16Shuffle, + lower_simd, kExprS8x16Shuffle, {{3, 2, 1, 0, 7, 6, 5, 4, 11, 10, 9, 8, 15, 14, 13, 12}}); } WASM_SIMD_COMPILED_TEST(S8x2Reverse) { RunBinaryLaneOpTest<int8_t>( - execution_mode, kExprS8x16Shuffle, + lower_simd, kExprS8x16Shuffle, {{1, 0, 3, 2, 5, 4, 7, 6, 9, 8, 11, 10, 13, 12, 15, 14}}); } WASM_SIMD_COMPILED_TEST(S8x16Irregular) { RunBinaryLaneOpTest<int8_t>( - execution_mode, kExprS8x16Shuffle, + lower_simd, kExprS8x16Shuffle, {{0, 16, 0, 16, 2, 18, 3, 19, 4, 20, 5, 21, 6, 22, 7, 23}}); RunBinaryLaneOpTest<int8_t>( - execution_mode, kExprS8x16Shuffle, + lower_simd, kExprS8x16Shuffle, {{0, 0, 0, 0, 2, 2, 3, 3, 4, 4, 5, 5, 6, 6, 7, 7}}); } @@ -1922,7 +1906,7 @@ WASM_SIMD_COMPILED_TEST(S8x16Concat) { for (int j = 0; j < bias; j++) { expected[i++] = j + kLanes; } - RunBinaryLaneOpTest(execution_mode, kExprS8x16Shuffle, expected); + RunBinaryLaneOpTest(lower_simd, kExprS8x16Shuffle, expected); } } @@ -1931,7 +1915,7 @@ WASM_SIMD_COMPILED_TEST(S8x16Concat) { // test inputs. Test inputs with all true, all false, one true, and one false. #define WASM_SIMD_BOOL_REDUCTION_TEST(format, lanes) \ WASM_SIMD_COMPILED_TEST(ReductionTest##lanes) { \ - WasmRunner<int32_t> r(execution_mode); \ + WasmRunner<int32_t> r(kExecuteTurbofan, lower_simd); \ byte zero = r.AllocateLocal(kWasmS128); \ byte one_one = r.AllocateLocal(kWasmS128); \ byte reduced = r.AllocateLocal(kWasmI32); \ @@ -2004,7 +1988,7 @@ WASM_SIMD_BOOL_REDUCTION_TEST(16x8, 8) WASM_SIMD_BOOL_REDUCTION_TEST(8x16, 16) WASM_SIMD_TEST(SimdI32x4ExtractWithF32x4) { - WasmRunner<int32_t> r(execution_mode); + WasmRunner<int32_t> r(kExecuteTurbofan, lower_simd); BUILD(r, WASM_IF_ELSE_I( WASM_I32_EQ(WASM_SIMD_I32x4_EXTRACT_LANE( 0, WASM_SIMD_F32x4_SPLAT(WASM_F32(30.5))), @@ -2014,7 +1998,7 @@ WASM_SIMD_TEST(SimdI32x4ExtractWithF32x4) { } WASM_SIMD_TEST(SimdF32x4ExtractWithI32x4) { - WasmRunner<int32_t> r(execution_mode); + WasmRunner<int32_t> r(kExecuteTurbofan, lower_simd); BUILD(r, WASM_IF_ELSE_I(WASM_F32_EQ(WASM_SIMD_F32x4_EXTRACT_LANE( 0, WASM_SIMD_I32x4_SPLAT(WASM_I32V(15))), @@ -2026,9 +2010,9 @@ WASM_SIMD_TEST(SimdF32x4ExtractWithI32x4) { WASM_SIMD_TEST(SimdF32x4AddWithI32x4) { // Choose two floating point values whose sum is normal and exactly // representable as a float. - const int kOne = 0x3f800000; + const int kOne = 0x3F800000; const int kTwo = 0x40000000; - WasmRunner<int32_t> r(execution_mode); + WasmRunner<int32_t> r(kExecuteTurbofan, lower_simd); BUILD(r, WASM_IF_ELSE_I( WASM_F32_EQ( @@ -2043,7 +2027,7 @@ WASM_SIMD_TEST(SimdF32x4AddWithI32x4) { } WASM_SIMD_TEST(SimdI32x4AddWithF32x4) { - WasmRunner<int32_t> r(execution_mode); + WasmRunner<int32_t> r(kExecuteTurbofan, lower_simd); BUILD(r, WASM_IF_ELSE_I( WASM_I32_EQ( @@ -2059,10 +2043,8 @@ WASM_SIMD_TEST(SimdI32x4AddWithF32x4) { #endif // V8_TARGET_ARCH_ARM || V8_TARGET_ARCH_ARM64 || V8_TARGET_ARCH_MIPS || // V8_TARGET_ARCH_MIPS64 -#if V8_TARGET_ARCH_ARM || V8_TARGET_ARCH_ARM64 || V8_TARGET_ARCH_X64 || \ - V8_TARGET_ARCH_MIPS || V8_TARGET_ARCH_MIPS64 WASM_SIMD_TEST(SimdI32x4Local) { - WasmRunner<int32_t> r(execution_mode); + WasmRunner<int32_t> r(kExecuteTurbofan, lower_simd); r.AllocateLocal(kWasmS128); BUILD(r, WASM_SET_LOCAL(0, WASM_SIMD_I32x4_SPLAT(WASM_I32V(31))), @@ -2071,7 +2053,7 @@ WASM_SIMD_TEST(SimdI32x4Local) { } WASM_SIMD_TEST(SimdI32x4SplatFromExtract) { - WasmRunner<int32_t> r(execution_mode); + WasmRunner<int32_t> r(kExecuteTurbofan, lower_simd); r.AllocateLocal(kWasmI32); r.AllocateLocal(kWasmS128); BUILD(r, WASM_SET_LOCAL(0, WASM_SIMD_I32x4_EXTRACT_LANE( @@ -2082,7 +2064,7 @@ WASM_SIMD_TEST(SimdI32x4SplatFromExtract) { } WASM_SIMD_TEST(SimdI32x4For) { - WasmRunner<int32_t> r(execution_mode); + WasmRunner<int32_t> r(kExecuteTurbofan, lower_simd); r.AllocateLocal(kWasmI32); r.AllocateLocal(kWasmS128); BUILD(r, @@ -2114,13 +2096,11 @@ WASM_SIMD_TEST(SimdI32x4For) { WASM_GET_LOCAL(0)); CHECK_EQ(1, r.Call()); } -#endif // V8_TARGET_ARCH_ARM || V8_TARGET_ARCH_ARM64 || V8_TARGET_ARCH_X64 || - // V8_TARGET_ARCH_MIPS || V8_TARGET_ARCH_MIPS64 #if V8_TARGET_ARCH_ARM || V8_TARGET_ARCH_ARM64 || V8_TARGET_ARCH_MIPS || \ V8_TARGET_ARCH_MIPS64 WASM_SIMD_TEST(SimdF32x4For) { - WasmRunner<int32_t> r(execution_mode); + WasmRunner<int32_t> r(kExecuteTurbofan, lower_simd); r.AllocateLocal(kWasmI32); r.AllocateLocal(kWasmS128); BUILD(r, WASM_SET_LOCAL(1, WASM_SIMD_F32x4_SPLAT(WASM_F32(21.25))), @@ -2145,9 +2125,6 @@ WASM_SIMD_TEST(SimdF32x4For) { #endif // V8_TARGET_ARCH_ARM || V8_TARGET_ARCH_ARM64 || V8_TARGET_ARCH_MIPS || // V8_TARGET_ARCH_MIPS64 -#if V8_TARGET_ARCH_ARM || V8_TARGET_ARCH_ARM64 || V8_TARGET_ARCH_X64 || \ - V8_TARGET_ARCH_MIPS || V8_TARGET_ARCH_MIPS64 - template <typename T, int numLanes = 4> void SetVectorByLanes(T* v, const std::array<T, numLanes>& arr) { for (int lane = 0; lane < numLanes; lane++) { @@ -2174,7 +2151,7 @@ const T& GetScalar(T* v, int lane) { } WASM_SIMD_TEST(SimdI32x4GetGlobal) { - WasmRunner<int32_t, int32_t> r(execution_mode); + WasmRunner<int32_t, int32_t> r(kExecuteTurbofan, lower_simd); // Pad the globals with a few unused slots to get a non-zero offset. r.builder().AddGlobal<int32_t>(kWasmI32); // purposefully unused r.builder().AddGlobal<int32_t>(kWasmI32); // purposefully unused @@ -2202,7 +2179,7 @@ WASM_SIMD_TEST(SimdI32x4GetGlobal) { } WASM_SIMD_TEST(SimdI32x4SetGlobal) { - WasmRunner<int32_t, int32_t> r(execution_mode); + WasmRunner<int32_t, int32_t> r(kExecuteTurbofan, lower_simd); // Pad the globals with a few unused slots to get a non-zero offset. r.builder().AddGlobal<int32_t>(kWasmI32); // purposefully unused r.builder().AddGlobal<int32_t>(kWasmI32); // purposefully unused @@ -2223,13 +2200,11 @@ WASM_SIMD_TEST(SimdI32x4SetGlobal) { CHECK_EQ(GetScalar(global, 2), 45); CHECK_EQ(GetScalar(global, 3), 56); } -#endif // V8_TARGET_ARCH_ARM || V8_TARGET_ARCH_ARM64 || V8_TARGET_ARCH_X64 || - // V8_TARGET_ARCH_MIPS || V8_TARGET_ARCH_MIPS64 #if V8_TARGET_ARCH_ARM || V8_TARGET_ARCH_ARM64 || V8_TARGET_ARCH_MIPS || \ - V8_TARGET_ARCH_MIPS64 + V8_TARGET_ARCH_MIPS64 || V8_TARGET_ARCH_IA32 WASM_SIMD_TEST(SimdF32x4GetGlobal) { - WasmRunner<int32_t, int32_t> r(execution_mode); + WasmRunner<int32_t, int32_t> r(kExecuteTurbofan, lower_simd); float* global = r.builder().AddGlobal<float>(kWasmS128); SetVectorByLanes<float>(global, {{0.0, 1.5, 2.25, 3.5}}); r.AllocateLocal(kWasmI32); @@ -2252,7 +2227,7 @@ WASM_SIMD_TEST(SimdF32x4GetGlobal) { } WASM_SIMD_TEST(SimdF32x4SetGlobal) { - WasmRunner<int32_t, int32_t> r(execution_mode); + WasmRunner<int32_t, int32_t> r(kExecuteTurbofan, lower_simd); float* global = r.builder().AddGlobal<float>(kWasmS128); BUILD(r, WASM_SET_GLOBAL(0, WASM_SIMD_F32x4_SPLAT(WASM_F32(13.5))), WASM_SET_GLOBAL(0, WASM_SIMD_F32x4_REPLACE_LANE(1, WASM_GET_GLOBAL(0), @@ -2269,12 +2244,10 @@ WASM_SIMD_TEST(SimdF32x4SetGlobal) { CHECK_EQ(GetScalar(global, 3), 65.0f); } #endif // V8_TARGET_ARCH_ARM || V8_TARGET_ARCH_ARM64 || V8_TARGET_ARCH_MIPS || - // V8_TARGET_ARCH_MIPS64 + // V8_TARGET_ARCH_MIPS64 || V8_TARGET_ARCH_IA32 -#if V8_TARGET_ARCH_ARM || V8_TARGET_ARCH_ARM64 || V8_TARGET_ARCH_X64 || \ - V8_TARGET_ARCH_MIPS || V8_TARGET_ARCH_MIPS64 WASM_SIMD_COMPILED_TEST(SimdLoadStoreLoad) { - WasmRunner<int32_t> r(execution_mode); + WasmRunner<int32_t> r(kExecuteTurbofan, lower_simd); int32_t* memory = r.builder().AddMemoryElems<int32_t>(8); // Load memory, store it, then reload it and extract the first lane. Use a // non-zero offset into the memory of 1 lane (4 bytes) to test indexing. @@ -2287,8 +2260,6 @@ WASM_SIMD_COMPILED_TEST(SimdLoadStoreLoad) { CHECK_EQ(expected, r.Call()); } } -#endif // V8_TARGET_ARCH_ARM || V8_TARGET_ARCH_ARM64 || V8_TARGET_ARCH_X64 || - // V8_TARGET_ARCH_MIPS || V8_TARGET_ARCH_MIPS64 #undef WASM_SIMD_TEST #undef WASM_SIMD_COMPILED_TEST diff --git a/deps/v8/test/cctest/wasm/test-run-wasm.cc b/deps/v8/test/cctest/wasm/test-run-wasm.cc index f928904e9c..6a7fde6401 100644 --- a/deps/v8/test/cctest/wasm/test-run-wasm.cc +++ b/deps/v8/test/cctest/wasm/test-run-wasm.cc @@ -195,19 +195,19 @@ WASM_I32_BINOP_TEST(Sub, int32_t, a - b) WASM_I32_BINOP_TEST(Mul, int32_t, a* b) WASM_I32_BINOP_TEST(DivS, int32_t, (a == kMinInt && b == -1) || b == 0 - ? static_cast<int32_t>(0xdeadbeef) + ? static_cast<int32_t>(0xDEADBEEF) : a / b) -WASM_I32_BINOP_TEST(DivU, uint32_t, b == 0 ? 0xdeadbeef : a / b) -WASM_I32_BINOP_TEST(RemS, int32_t, b == 0 ? 0xdeadbeef : b == -1 ? 0 : a % b) -WASM_I32_BINOP_TEST(RemU, uint32_t, b == 0 ? 0xdeadbeef : a % b) +WASM_I32_BINOP_TEST(DivU, uint32_t, b == 0 ? 0xDEADBEEF : a / b) +WASM_I32_BINOP_TEST(RemS, int32_t, b == 0 ? 0xDEADBEEF : b == -1 ? 0 : a % b) +WASM_I32_BINOP_TEST(RemU, uint32_t, b == 0 ? 0xDEADBEEF : a % b) WASM_I32_BINOP_TEST(And, int32_t, a& b) WASM_I32_BINOP_TEST(Ior, int32_t, a | b) WASM_I32_BINOP_TEST(Xor, int32_t, a ^ b) -WASM_I32_BINOP_TEST(Shl, int32_t, a << (b & 0x1f)) -WASM_I32_BINOP_TEST(ShrU, uint32_t, a >> (b & 0x1f)) -WASM_I32_BINOP_TEST(ShrS, int32_t, a >> (b & 0x1f)) -WASM_I32_BINOP_TEST(Ror, uint32_t, (a >> (b & 0x1f)) | (a << (32 - (b & 0x1f)))) -WASM_I32_BINOP_TEST(Rol, uint32_t, (a << (b & 0x1f)) | (a >> (32 - (b & 0x1f)))) +WASM_I32_BINOP_TEST(Shl, int32_t, a << (b & 0x1F)) +WASM_I32_BINOP_TEST(ShrU, uint32_t, a >> (b & 0x1F)) +WASM_I32_BINOP_TEST(ShrS, int32_t, a >> (b & 0x1F)) +WASM_I32_BINOP_TEST(Ror, uint32_t, (a >> (b & 0x1F)) | (a << (32 - (b & 0x1F)))) +WASM_I32_BINOP_TEST(Rol, uint32_t, (a << (b & 0x1F)) | (a >> (32 - (b & 0x1F)))) WASM_I32_BINOP_TEST(Eq, int32_t, a == b) WASM_I32_BINOP_TEST(Ne, int32_t, a != b) WASM_I32_BINOP_TEST(LtS, int32_t, a < b) @@ -245,11 +245,11 @@ WASM_EXEC_TEST(Int32Clz) { TestInt32Unop(execution_mode, kExprI32Clz, 4, 0x08050000); TestInt32Unop(execution_mode, kExprI32Clz, 5, 0x04006000); TestInt32Unop(execution_mode, kExprI32Clz, 6, 0x02000000); - TestInt32Unop(execution_mode, kExprI32Clz, 7, 0x010000a0); - TestInt32Unop(execution_mode, kExprI32Clz, 8, 0x00800c00); + TestInt32Unop(execution_mode, kExprI32Clz, 7, 0x010000A0); + TestInt32Unop(execution_mode, kExprI32Clz, 8, 0x00800C00); TestInt32Unop(execution_mode, kExprI32Clz, 9, 0x00400000); - TestInt32Unop(execution_mode, kExprI32Clz, 10, 0x0020000d); - TestInt32Unop(execution_mode, kExprI32Clz, 11, 0x00100f00); + TestInt32Unop(execution_mode, kExprI32Clz, 10, 0x0020000D); + TestInt32Unop(execution_mode, kExprI32Clz, 11, 0x00100F00); TestInt32Unop(execution_mode, kExprI32Clz, 12, 0x00080000); TestInt32Unop(execution_mode, kExprI32Clz, 13, 0x00041000); TestInt32Unop(execution_mode, kExprI32Clz, 14, 0x00020020); @@ -279,42 +279,42 @@ WASM_EXEC_TEST(Int32Ctz) { TestInt32Unop(execution_mode, kExprI32Ctz, 30, 0x40000000); TestInt32Unop(execution_mode, kExprI32Ctz, 29, 0x20000000); TestInt32Unop(execution_mode, kExprI32Ctz, 28, 0x10000000); - TestInt32Unop(execution_mode, kExprI32Ctz, 27, 0xa8000000); - TestInt32Unop(execution_mode, kExprI32Ctz, 26, 0xf4000000); + TestInt32Unop(execution_mode, kExprI32Ctz, 27, 0xA8000000); + TestInt32Unop(execution_mode, kExprI32Ctz, 26, 0xF4000000); TestInt32Unop(execution_mode, kExprI32Ctz, 25, 0x62000000); TestInt32Unop(execution_mode, kExprI32Ctz, 24, 0x91000000); - TestInt32Unop(execution_mode, kExprI32Ctz, 23, 0xcd800000); + TestInt32Unop(execution_mode, kExprI32Ctz, 23, 0xCD800000); TestInt32Unop(execution_mode, kExprI32Ctz, 22, 0x09400000); - TestInt32Unop(execution_mode, kExprI32Ctz, 21, 0xaf200000); - TestInt32Unop(execution_mode, kExprI32Ctz, 20, 0xac100000); - TestInt32Unop(execution_mode, kExprI32Ctz, 19, 0xe0b80000); - TestInt32Unop(execution_mode, kExprI32Ctz, 18, 0x9ce40000); - TestInt32Unop(execution_mode, kExprI32Ctz, 17, 0xc7920000); - TestInt32Unop(execution_mode, kExprI32Ctz, 16, 0xb8f10000); - TestInt32Unop(execution_mode, kExprI32Ctz, 15, 0x3b9f8000); - TestInt32Unop(execution_mode, kExprI32Ctz, 14, 0xdb4c4000); - TestInt32Unop(execution_mode, kExprI32Ctz, 13, 0xe9a32000); - TestInt32Unop(execution_mode, kExprI32Ctz, 12, 0xfca61000); - TestInt32Unop(execution_mode, kExprI32Ctz, 11, 0x6c8a7800); - TestInt32Unop(execution_mode, kExprI32Ctz, 10, 0x8ce5a400); - TestInt32Unop(execution_mode, kExprI32Ctz, 9, 0xcb7d0200); - TestInt32Unop(execution_mode, kExprI32Ctz, 8, 0xcb4dc100); - TestInt32Unop(execution_mode, kExprI32Ctz, 7, 0xdfbec580); - TestInt32Unop(execution_mode, kExprI32Ctz, 6, 0x27a9db40); - TestInt32Unop(execution_mode, kExprI32Ctz, 5, 0xde3bcb20); - TestInt32Unop(execution_mode, kExprI32Ctz, 4, 0xd7e8a610); - TestInt32Unop(execution_mode, kExprI32Ctz, 3, 0x9afdbc88); - TestInt32Unop(execution_mode, kExprI32Ctz, 2, 0x9afdbc84); - TestInt32Unop(execution_mode, kExprI32Ctz, 1, 0x9afdbc82); - TestInt32Unop(execution_mode, kExprI32Ctz, 0, 0x9afdbc81); + TestInt32Unop(execution_mode, kExprI32Ctz, 21, 0xAF200000); + TestInt32Unop(execution_mode, kExprI32Ctz, 20, 0xAC100000); + TestInt32Unop(execution_mode, kExprI32Ctz, 19, 0xE0B80000); + TestInt32Unop(execution_mode, kExprI32Ctz, 18, 0x9CE40000); + TestInt32Unop(execution_mode, kExprI32Ctz, 17, 0xC7920000); + TestInt32Unop(execution_mode, kExprI32Ctz, 16, 0xB8F10000); + TestInt32Unop(execution_mode, kExprI32Ctz, 15, 0x3B9F8000); + TestInt32Unop(execution_mode, kExprI32Ctz, 14, 0xDB4C4000); + TestInt32Unop(execution_mode, kExprI32Ctz, 13, 0xE9A32000); + TestInt32Unop(execution_mode, kExprI32Ctz, 12, 0xFCA61000); + TestInt32Unop(execution_mode, kExprI32Ctz, 11, 0x6C8A7800); + TestInt32Unop(execution_mode, kExprI32Ctz, 10, 0x8CE5A400); + TestInt32Unop(execution_mode, kExprI32Ctz, 9, 0xCB7D0200); + TestInt32Unop(execution_mode, kExprI32Ctz, 8, 0xCB4DC100); + TestInt32Unop(execution_mode, kExprI32Ctz, 7, 0xDFBEC580); + TestInt32Unop(execution_mode, kExprI32Ctz, 6, 0x27A9DB40); + TestInt32Unop(execution_mode, kExprI32Ctz, 5, 0xDE3BCB20); + TestInt32Unop(execution_mode, kExprI32Ctz, 4, 0xD7E8A610); + TestInt32Unop(execution_mode, kExprI32Ctz, 3, 0x9AFDBC88); + TestInt32Unop(execution_mode, kExprI32Ctz, 2, 0x9AFDBC84); + TestInt32Unop(execution_mode, kExprI32Ctz, 1, 0x9AFDBC82); + TestInt32Unop(execution_mode, kExprI32Ctz, 0, 0x9AFDBC81); } WASM_EXEC_TEST(Int32Popcnt) { - TestInt32Unop(execution_mode, kExprI32Popcnt, 32, 0xffffffff); + TestInt32Unop(execution_mode, kExprI32Popcnt, 32, 0xFFFFFFFF); TestInt32Unop(execution_mode, kExprI32Popcnt, 0, 0x00000000); TestInt32Unop(execution_mode, kExprI32Popcnt, 1, 0x00008000); TestInt32Unop(execution_mode, kExprI32Popcnt, 13, 0x12345678); - TestInt32Unop(execution_mode, kExprI32Popcnt, 19, 0xfedcba09); + TestInt32Unop(execution_mode, kExprI32Popcnt, 19, 0xFEDCBA09); } WASM_EXEC_TEST(I32Eqz) { @@ -419,11 +419,11 @@ WASM_EXEC_TEST(Int32AsmjsRemS_byzero_const) { } WASM_EXEC_TEST(Int32DivU_byzero_const) { - for (uint32_t denom = 0xfffffffe; denom < 8; ++denom) { + for (uint32_t denom = 0xFFFFFFFE; denom < 8; ++denom) { WasmRunner<uint32_t, uint32_t> r(execution_mode); BUILD(r, WASM_I32_DIVU(WASM_GET_LOCAL(0), WASM_I32V_1(denom))); - for (uint32_t val = 0xfffffff0; val < 8; ++val) { + for (uint32_t val = 0xFFFFFFF0; val < 8; ++val) { if (denom == 0) { CHECK_TRAP(r.Call(val)); } else { @@ -830,7 +830,7 @@ WASM_EXEC_TEST(Regression_660262) { WasmRunner<int32_t> r(execution_mode); r.builder().AddMemoryElems<int32_t>(8); BUILD(r, kExprI32Const, 0x00, kExprI32Const, 0x00, kExprI32LoadMem, 0x00, - 0x0f, kExprBrTable, 0x00, 0x80, 0x00); // entries=0 + 0x0F, kExprBrTable, 0x00, 0x80, 0x00); // entries=0 r.Call(); } @@ -1047,22 +1047,22 @@ WASM_EXEC_TEST(SignallingNanSurvivesI32ReinterpretF32) { WasmRunner<int32_t> r(execution_mode); BUILD(r, WASM_I32_REINTERPRET_F32( - WASM_SEQ(kExprF32Const, 0x00, 0x00, 0xa0, 0x7f))); + WASM_SEQ(kExprF32Const, 0x00, 0x00, 0xA0, 0x7F))); // This is a signalling nan. - CHECK_EQ(0x7fa00000, r.Call()); + CHECK_EQ(0x7FA00000, r.Call()); } #endif WASM_EXEC_TEST(LoadMaxUint32Offset) { // TODO(eholk): Fix this test for the trap handler. - if (trap_handler::UseTrapHandler()) return; + if (trap_handler::IsTrapHandlerEnabled()) return; WasmRunner<int32_t> r(execution_mode); r.builder().AddMemoryElems<int32_t>(8); BUILD(r, WASM_LOAD_MEM_OFFSET(MachineType::Int32(), // type - U32V_5(0xffffffff), // offset + U32V_5(0xFFFFFFFF), // offset WASM_ZERO)); // index CHECK_TRAP32(r.Call()); @@ -1485,20 +1485,20 @@ WASM_EXEC_TEST(LoadMemI32_alignment) { BUILD(r, WASM_LOAD_MEM_ALIGNMENT(MachineType::Int32(), WASM_ZERO, alignment)); - r.builder().WriteMemory(&memory[0], 0x1a2b3c4d); - CHECK_EQ(0x1a2b3c4d, r.Call(0)); + r.builder().WriteMemory(&memory[0], 0x1A2B3C4D); + CHECK_EQ(0x1A2B3C4D, r.Call(0)); - r.builder().WriteMemory(&memory[0], 0x5e6f7a8b); - CHECK_EQ(0x5e6f7a8b, r.Call(0)); + r.builder().WriteMemory(&memory[0], 0x5E6F7A8B); + CHECK_EQ(0x5E6F7A8B, r.Call(0)); - r.builder().WriteMemory(&memory[0], 0x7ca0b1c2); - CHECK_EQ(0x7ca0b1c2, r.Call(0)); + r.builder().WriteMemory(&memory[0], 0x7CA0B1C2); + CHECK_EQ(0x7CA0B1C2, r.Call(0)); } } WASM_EXEC_TEST(LoadMemI32_oob) { // TODO(eholk): Fix this test for the trap handler. - if (trap_handler::UseTrapHandler()) return; + if (trap_handler::IsTrapHandlerEnabled()) return; WasmRunner<int32_t, uint32_t> r(execution_mode); int32_t* memory = r.builder().AddMemoryElems<int32_t>(8); r.builder().RandomizeMemory(1111); @@ -1518,7 +1518,7 @@ WASM_EXEC_TEST(LoadMemI32_oob) { WASM_EXEC_TEST(LoadMem_offset_oob) { // TODO(eholk): Fix this test for the trap handler. - if (trap_handler::UseTrapHandler()) return; + if (trap_handler::IsTrapHandlerEnabled()) return; static const MachineType machineTypes[] = { MachineType::Int8(), MachineType::Uint8(), MachineType::Int16(), MachineType::Uint16(), MachineType::Int32(), MachineType::Uint32(), @@ -1569,7 +1569,7 @@ WASM_EXEC_TEST(LoadMemI32_offset) { WASM_EXEC_TEST(LoadMemI32_const_oob_misaligned) { // TODO(eholk): Fix this test for the trap handler. - if (trap_handler::UseTrapHandler()) return; + if (trap_handler::IsTrapHandlerEnabled()) return; constexpr byte kMemSize = 12; // TODO(titzer): Fix misaligned accesses on MIPS and re-enable. for (byte offset = 0; offset < kMemSize + 5; ++offset) { @@ -1592,7 +1592,7 @@ WASM_EXEC_TEST(LoadMemI32_const_oob_misaligned) { WASM_EXEC_TEST(LoadMemI32_const_oob) { // TODO(eholk): Fix this test for the trap handler. - if (trap_handler::UseTrapHandler()) return; + if (trap_handler::IsTrapHandlerEnabled()) return; constexpr byte kMemSize = 24; for (byte offset = 0; offset < kMemSize + 5; offset += 4) { for (byte index = 0; index < kMemSize + 5; index += 4) { @@ -1632,7 +1632,7 @@ WASM_EXEC_TEST(StoreMemI32_alignment) { WASM_EXEC_TEST(StoreMemI32_offset) { WasmRunner<int32_t, int32_t> r(execution_mode); int32_t* memory = r.builder().AddMemoryElems<int32_t>(4); - const int32_t kWritten = 0xaabbccdd; + const int32_t kWritten = 0xAABBCCDD; BUILD(r, WASM_STORE_MEM_OFFSET(MachineType::Int32(), 4, WASM_GET_LOCAL(0), WASM_I32V_5(kWritten)), @@ -1654,7 +1654,7 @@ WASM_EXEC_TEST(StoreMemI32_offset) { WASM_EXEC_TEST(StoreMem_offset_oob) { // TODO(eholk): Fix this test for the trap handler. - if (trap_handler::UseTrapHandler()) return; + if (trap_handler::IsTrapHandlerEnabled()) return; // 64-bit cases are handled in test-run-wasm-64.cc static const MachineType machineTypes[] = { MachineType::Int8(), MachineType::Uint8(), MachineType::Int16(), @@ -1682,6 +1682,36 @@ WASM_EXEC_TEST(StoreMem_offset_oob) { } } +WASM_EXEC_TEST(Store_i32_narrowed) { + constexpr byte kOpcodes[] = {kExprI32StoreMem8, kExprI32StoreMem16, + kExprI32StoreMem}; + int stored_size_in_bytes = 0; + for (auto opcode : kOpcodes) { + stored_size_in_bytes = std::max(1, stored_size_in_bytes * 2); + constexpr int kBytes = 24; + uint8_t expected_memory[kBytes] = {0}; + WasmRunner<int32_t, int32_t, int32_t> r(execution_mode); + uint8_t* memory = r.builder().AddMemoryElems<uint8_t>(kBytes); + constexpr uint32_t kPattern = 0x12345678; + + BUILD(r, WASM_GET_LOCAL(0), // index + WASM_GET_LOCAL(1), // value + opcode, ZERO_ALIGNMENT, ZERO_OFFSET, // store + WASM_ZERO); // return value + + for (int i = 0; i <= kBytes - stored_size_in_bytes; ++i) { + uint32_t pattern = base::bits::RotateLeft32(kPattern, i % 32); + r.Call(i, pattern); + for (int b = 0; b < stored_size_in_bytes; ++b) { + expected_memory[i + b] = static_cast<uint8_t>(pattern >> (b * 8)); + } + for (int w = 0; w < kBytes; ++w) { + CHECK_EQ(expected_memory[w], memory[w]); + } + } + } +} + WASM_EXEC_TEST(LoadMemI32_P) { const int kNumElems = 8; WasmRunner<int32_t, int32_t> r(execution_mode); @@ -2110,20 +2140,20 @@ WASM_EXEC_TEST(MixedGlobals) { WASM_SET_GLOBAL(4, WASM_LOAD_MEM(MachineType::Float64(), WASM_ZERO)), WASM_ZERO); - memory[0] = 0xaa; - memory[1] = 0xcc; + memory[0] = 0xAA; + memory[1] = 0xCC; memory[2] = 0x55; - memory[3] = 0xee; + memory[3] = 0xEE; memory[4] = 0x33; memory[5] = 0x22; memory[6] = 0x11; memory[7] = 0x99; r.Call(1); - CHECK(static_cast<int32_t>(0xee55ccaa) == *var_int32); - CHECK(static_cast<uint32_t>(0xee55ccaa) == *var_uint32); - CHECK(bit_cast<float>(0xee55ccaa) == *var_float); - CHECK(bit_cast<double>(0x99112233ee55ccaaULL) == *var_double); + CHECK(static_cast<int32_t>(0xEE55CCAA) == *var_int32); + CHECK(static_cast<uint32_t>(0xEE55CCAA) == *var_uint32); + CHECK(bit_cast<float>(0xEE55CCAA) == *var_float); + CHECK(bit_cast<double>(0x99112233EE55CCAAULL) == *var_double); USE(unused); } @@ -2370,10 +2400,11 @@ WASM_EXEC_TEST(AddCall) { byte local = r.AllocateLocal(kWasmI32); BUILD(r, WASM_SET_LOCAL(local, WASM_I32V_2(99)), - WASM_I32_ADD(WASM_CALL_FUNCTION(t1.function_index(), WASM_GET_LOCAL(0), - WASM_GET_LOCAL(0)), - WASM_CALL_FUNCTION(t1.function_index(), WASM_GET_LOCAL(1), - WASM_GET_LOCAL(local)))); + WASM_I32_ADD( + WASM_CALL_FUNCTION(t1.function_index(), WASM_GET_LOCAL(0), + WASM_GET_LOCAL(0)), + WASM_CALL_FUNCTION(t1.function_index(), WASM_GET_LOCAL(local), + WASM_GET_LOCAL(local)))); CHECK_EQ(198, r.Call(0)); CHECK_EQ(200, r.Call(1)); @@ -2823,15 +2854,8 @@ WASM_EXEC_TEST(I32SConvertF32) { WasmRunner<int32_t, float> r(execution_mode); BUILD(r, WASM_I32_SCONVERT_F32(WASM_GET_LOCAL(0))); - // The upper bound is (INT32_MAX + 1), which is the lowest float-representable - // number above INT32_MAX which cannot be represented as int32. - float upper_bound = 2147483648.0f; - // We use INT32_MIN as a lower bound because (INT32_MIN - 1) is not - // representable as float, and no number between (INT32_MIN - 1) and INT32_MIN - // is. - float lower_bound = static_cast<float>(INT32_MIN); FOR_FLOAT32_INPUTS(i) { - if (*i < upper_bound && *i >= lower_bound) { + if (is_inbounds<int32_t>(*i)) { CHECK_EQ(static_cast<int32_t>(*i), r.Call(*i)); } else { CHECK_TRAP32(r.Call(*i)); @@ -2839,18 +2863,29 @@ WASM_EXEC_TEST(I32SConvertF32) { } } +WASM_EXEC_TEST(I32SConvertSatF32) { + EXPERIMENTAL_FLAG_SCOPE(sat_f2i_conversions); + WasmRunner<int32_t, float> r(execution_mode); + BUILD(r, WASM_I32_SCONVERT_SAT_F32(WASM_GET_LOCAL(0))); + + FOR_FLOAT32_INPUTS(i) { + int32_t expected = + is_inbounds<int32_t>(*i) + ? static_cast<int32_t>(*i) + : std::isnan(*i) ? 0 + : *i < 0.0 ? std::numeric_limits<int32_t>::min() + : std::numeric_limits<int32_t>::max(); + int32_t found = r.Call(*i); + CHECK_EQ(expected, found); + } +} + WASM_EXEC_TEST(I32SConvertF64) { WasmRunner<int32_t, double> r(execution_mode); BUILD(r, WASM_I32_SCONVERT_F64(WASM_GET_LOCAL(0))); - // The upper bound is (INT32_MAX + 1), which is the lowest double- - // representable number above INT32_MAX which cannot be represented as int32. - double upper_bound = 2147483648.0; - // The lower bound is (INT32_MIN - 1), which is the greatest double- - // representable number below INT32_MIN which cannot be represented as int32. - double lower_bound = -2147483649.0; FOR_FLOAT64_INPUTS(i) { - if (*i<upper_bound&& * i> lower_bound) { + if (is_inbounds<int32_t>(*i)) { CHECK_EQ(static_cast<int32_t>(*i), r.Call(*i)); } else { CHECK_TRAP32(r.Call(*i)); @@ -2858,16 +2893,27 @@ WASM_EXEC_TEST(I32SConvertF64) { } } +WASM_EXEC_TEST(I32SConvertSatF64) { + EXPERIMENTAL_FLAG_SCOPE(sat_f2i_conversions); + WasmRunner<int32_t, double> r(execution_mode); + BUILD(r, WASM_I32_SCONVERT_SAT_F64(WASM_GET_LOCAL(0))); + FOR_FLOAT64_INPUTS(i) { + int32_t expected = + is_inbounds<int32_t>(*i) + ? static_cast<int32_t>(*i) + : std::isnan(*i) ? 0 + : *i < 0.0 ? std::numeric_limits<int32_t>::min() + : std::numeric_limits<int32_t>::max(); + int32_t found = r.Call(*i); + CHECK_EQ(expected, found); + } +} + WASM_EXEC_TEST(I32UConvertF32) { WasmRunner<uint32_t, float> r(execution_mode); BUILD(r, WASM_I32_UCONVERT_F32(WASM_GET_LOCAL(0))); - // The upper bound is (UINT32_MAX + 1), which is the lowest - // float-representable number above UINT32_MAX which cannot be represented as - // uint32. - double upper_bound = 4294967296.0f; - double lower_bound = -1.0f; FOR_FLOAT32_INPUTS(i) { - if (*i<upper_bound&& * i> lower_bound) { + if (is_inbounds<uint32_t>(*i)) { CHECK_EQ(static_cast<uint32_t>(*i), r.Call(*i)); } else { CHECK_TRAP32(r.Call(*i)); @@ -2875,16 +2921,27 @@ WASM_EXEC_TEST(I32UConvertF32) { } } +WASM_EXEC_TEST(I32UConvertSatF32) { + EXPERIMENTAL_FLAG_SCOPE(sat_f2i_conversions); + WasmRunner<uint32_t, float> r(execution_mode); + BUILD(r, WASM_I32_UCONVERT_SAT_F32(WASM_GET_LOCAL(0))); + FOR_FLOAT32_INPUTS(i) { + int32_t expected = + is_inbounds<uint32_t>(*i) + ? static_cast<uint32_t>(*i) + : std::isnan(*i) ? 0 + : *i < 0.0 ? std::numeric_limits<uint32_t>::min() + : std::numeric_limits<uint32_t>::max(); + int32_t found = r.Call(*i); + CHECK_EQ(expected, found); + } +} + WASM_EXEC_TEST(I32UConvertF64) { WasmRunner<uint32_t, double> r(execution_mode); BUILD(r, WASM_I32_UCONVERT_F64(WASM_GET_LOCAL(0))); - // The upper bound is (UINT32_MAX + 1), which is the lowest - // double-representable number above UINT32_MAX which cannot be represented as - // uint32. - double upper_bound = 4294967296.0; - double lower_bound = -1.0; FOR_FLOAT64_INPUTS(i) { - if (*i<upper_bound&& * i> lower_bound) { + if (is_inbounds<uint32_t>(*i)) { CHECK_EQ(static_cast<uint32_t>(*i), r.Call(*i)); } else { CHECK_TRAP32(r.Call(*i)); @@ -2892,6 +2949,22 @@ WASM_EXEC_TEST(I32UConvertF64) { } } +WASM_EXEC_TEST(I32UConvertSatF64) { + EXPERIMENTAL_FLAG_SCOPE(sat_f2i_conversions); + WasmRunner<uint32_t, double> r(execution_mode); + BUILD(r, WASM_I32_UCONVERT_SAT_F64(WASM_GET_LOCAL(0))); + FOR_FLOAT64_INPUTS(i) { + int32_t expected = + is_inbounds<uint32_t>(*i) + ? static_cast<uint32_t>(*i) + : std::isnan(*i) ? 0 + : *i < 0.0 ? std::numeric_limits<uint32_t>::min() + : std::numeric_limits<uint32_t>::max(); + int32_t found = r.Call(*i); + CHECK_EQ(expected, found); + } +} + WASM_EXEC_TEST(F64CopySign) { WasmRunner<double, double, double> r(execution_mode); BUILD(r, WASM_F64_COPYSIGN(WASM_GET_LOCAL(0), WASM_GET_LOCAL(1))); diff --git a/deps/v8/test/cctest/wasm/test-streaming-compilation.cc b/deps/v8/test/cctest/wasm/test-streaming-compilation.cc index a2c352bb4d..ef77708267 100644 --- a/deps/v8/test/cctest/wasm/test-streaming-compilation.cc +++ b/deps/v8/test/cctest/wasm/test-streaming-compilation.cc @@ -10,6 +10,7 @@ #include "src/wasm/compilation-manager.h" #include "src/wasm/module-decoder.h" #include "src/wasm/streaming-decoder.h" +#include "src/wasm/wasm-engine.h" #include "src/wasm/wasm-module-builder.h" #include "src/wasm/wasm-module.h" @@ -103,8 +104,10 @@ class StreamTester { i::Handle<i::JSPromise> i_promise = v8::Utils::OpenHandle(*promise_); - stream_ = i_isolate->wasm_compilation_manager()->StartStreamingCompilation( - i_isolate, v8::Utils::OpenHandle(*context), i_promise); + stream_ = i_isolate->wasm_engine() + ->compilation_manager() + ->StartStreamingCompilation( + i_isolate, v8::Utils::OpenHandle(*context), i_promise); } std::shared_ptr<StreamingDecoder> stream() { return stream_; } @@ -327,12 +330,12 @@ ZoneBuffer GetModuleWithInvalidSectionSize(Zone* zone) { ZoneBuffer buffer = GetValidModuleBytes(zone); // 9 == 4 (wasm magic) + 4 (version) + 1 (section code) uint8_t* section_size_address = const_cast<uint8_t*>(buffer.begin()) + 9; - // 0x808080800f is an invalid module size in leb encoding. + // 0x808080800F is an invalid module size in leb encoding. section_size_address[0] = 0x80; section_size_address[1] = 0x80; section_size_address[2] = 0x80; section_size_address[3] = 0x80; - section_size_address[4] = 0x0f; + section_size_address[4] = 0x0F; return buffer; } @@ -871,6 +874,84 @@ STREAM_TEST(TestModuleWithZeroFunctions) { CHECK(tester.IsPromiseFulfilled()); } +STREAM_TEST(TestModuleWithMultipleFunctions) { + StreamTester tester; + + uint8_t code[] = { + U32V_1(4), // body size + U32V_1(0), // locals count + kExprGetLocal, 0, kExprEnd // body + }; + + const uint8_t bytes[] = { + WASM_MODULE_HEADER, // module header + kTypeSectionCode, // section code + U32V_1(1 + SIZEOF_SIG_ENTRY_x_x), // section size + U32V_1(1), // type count + SIG_ENTRY_x_x(kLocalI32, kLocalI32), // signature entry + kFunctionSectionCode, // section code + U32V_1(1 + 3), // section size + U32V_1(3), // functions count + 0, // signature index + 0, // signature index + 0, // signature index + kCodeSectionCode, // section code + U32V_1(1 + arraysize(code) * 3), // section size + U32V_1(3), // functions count + }; + + tester.OnBytesReceived(bytes, arraysize(bytes)); + tester.OnBytesReceived(code, arraysize(code)); + tester.OnBytesReceived(code, arraysize(code)); + tester.RunCompilerTasks(); + tester.OnBytesReceived(code, arraysize(code)); + tester.FinishStream(); + tester.RunCompilerTasks(); + CHECK(tester.IsPromiseFulfilled()); +} + +STREAM_TEST(TestModuleWithDataSection) { + StreamTester tester; + + uint8_t code[] = { + U32V_1(4), // body size + U32V_1(0), // locals count + kExprGetLocal, 0, kExprEnd // body + }; + + const uint8_t bytes[] = { + WASM_MODULE_HEADER, // module header + kTypeSectionCode, // section code + U32V_1(1 + SIZEOF_SIG_ENTRY_x_x), // section size + U32V_1(1), // type count + SIG_ENTRY_x_x(kLocalI32, kLocalI32), // signature entry + kFunctionSectionCode, // section code + U32V_1(1 + 3), // section size + U32V_1(3), // functions count + 0, // signature index + 0, // signature index + 0, // signature index + kCodeSectionCode, // section code + U32V_1(1 + arraysize(code) * 3), // section size + U32V_1(3), // functions count + }; + + const uint8_t data_section[] = { + kDataSectionCode, // section code + U32V_1(1), // section size + U32V_1(0), // data segment count + }; + tester.OnBytesReceived(bytes, arraysize(bytes)); + tester.OnBytesReceived(code, arraysize(code)); + tester.OnBytesReceived(code, arraysize(code)); + tester.OnBytesReceived(code, arraysize(code)); + tester.RunCompilerTasks(); + tester.OnBytesReceived(data_section, arraysize(data_section)); + tester.RunCompilerTasks(); + tester.FinishStream(); + tester.RunCompilerTasks(); + CHECK(tester.IsPromiseFulfilled()); +} // Test that all bytes arrive before doing any compilation. FinishStream is // called immediately. STREAM_TEST(TestModuleWithImportedFunction) { @@ -893,6 +974,40 @@ STREAM_TEST(TestModuleWithImportedFunction) { CHECK(tester.IsPromiseFulfilled()); } + +STREAM_TEST(TestModuleWithErrorAfterDataSection) { + StreamTester tester; + + const uint8_t bytes[] = { + WASM_MODULE_HEADER, // module header + kTypeSectionCode, // section code + U32V_1(1 + SIZEOF_SIG_ENTRY_x_x), // section size + U32V_1(1), // type count + SIG_ENTRY_x_x(kLocalI32, kLocalI32), // signature entry + kFunctionSectionCode, // section code + U32V_1(1 + 1), // section size + U32V_1(1), // functions count + 0, // signature index + kCodeSectionCode, // section code + U32V_1(6), // section size + U32V_1(1), // functions count + U32V_1(4), // body size + U32V_1(0), // locals count + kExprGetLocal, // some code + 0, // some code + kExprEnd, // some code + kDataSectionCode, // section code + U32V_1(1), // section size + U32V_1(0), // data segment count + kUnknownSectionCode, // section code + U32V_1(1), // invalid section size + }; + + tester.OnBytesReceived(bytes, arraysize(bytes)); + tester.FinishStream(); + tester.RunCompilerTasks(); + CHECK(tester.IsPromiseRejected()); +} #undef STREAM_TEST } // namespace wasm diff --git a/deps/v8/test/cctest/wasm/test-wasm-breakpoints.cc b/deps/v8/test/cctest/wasm/test-wasm-breakpoints.cc index 22b51bfae5..48640ef1e5 100644 --- a/deps/v8/test/cctest/wasm/test-wasm-breakpoints.cc +++ b/deps/v8/test/cctest/wasm/test-wasm-breakpoints.cc @@ -22,12 +22,10 @@ namespace wasm { namespace { void CheckLocations( - WasmCompiledModule *compiled_module, debug::Location start, - debug::Location end, + WasmSharedModuleData* shared, debug::Location start, debug::Location end, std::initializer_list<debug::Location> expected_locations_init) { std::vector<debug::BreakLocation> locations; - bool success = - compiled_module->GetPossibleBreakpoints(start, end, &locations); + bool success = shared->GetPossibleBreakpoints(start, end, &locations); CHECK(success); printf("got %d locations: ", static_cast<int>(locations.size())); @@ -46,11 +44,11 @@ void CheckLocations( locations[i].GetColumnNumber()); } } -void CheckLocationsFail(WasmCompiledModule *compiled_module, - debug::Location start, debug::Location end) { + +void CheckLocationsFail(WasmSharedModuleData* shared, debug::Location start, + debug::Location end) { std::vector<debug::BreakLocation> locations; - bool success = - compiled_module->GetPossibleBreakpoints(start, end, &locations); + bool success = shared->GetPossibleBreakpoints(start, end, &locations); CHECK(!success); } @@ -269,24 +267,26 @@ WASM_COMPILED_EXEC_TEST(WasmCollectPossibleBreakpoints) { BUILD(runner, WASM_NOP, WASM_I32_ADD(WASM_ZERO, WASM_ONE)); - Handle<WasmInstanceObject> instance = runner.builder().instance_object(); + WasmInstanceObject* instance = *runner.builder().instance_object(); + WasmSharedModuleData* shared = instance->compiled_module()->shared(); + std::vector<debug::Location> locations; // Check all locations for function 0. - CheckLocations(instance->compiled_module(), {0, 0}, {1, 0}, + CheckLocations(shared, {0, 0}, {1, 0}, {{0, 1}, {0, 2}, {0, 4}, {0, 6}, {0, 7}}); // Check a range ending at an instruction. - CheckLocations(instance->compiled_module(), {0, 2}, {0, 4}, {{0, 2}}); + CheckLocations(shared, {0, 2}, {0, 4}, {{0, 2}}); // Check a range ending one behind an instruction. - CheckLocations(instance->compiled_module(), {0, 2}, {0, 5}, {{0, 2}, {0, 4}}); + CheckLocations(shared, {0, 2}, {0, 5}, {{0, 2}, {0, 4}}); // Check a range starting at an instruction. - CheckLocations(instance->compiled_module(), {0, 7}, {0, 8}, {{0, 7}}); + CheckLocations(shared, {0, 7}, {0, 8}, {{0, 7}}); // Check from an instruction to beginning of next function. - CheckLocations(instance->compiled_module(), {0, 7}, {1, 0}, {{0, 7}}); + CheckLocations(shared, {0, 7}, {1, 0}, {{0, 7}}); // Check from end of one function (no valid instruction position) to beginning // of next function. Must be empty, but not fail. - CheckLocations(instance->compiled_module(), {0, 8}, {1, 0}, {}); + CheckLocations(shared, {0, 8}, {1, 0}, {}); // Check from one after the end of the function. Must fail. - CheckLocationsFail(instance->compiled_module(), {0, 9}, {1, 0}); + CheckLocationsFail(shared, {0, 9}, {1, 0}); } WASM_COMPILED_EXEC_TEST(WasmSimpleBreak) { diff --git a/deps/v8/test/cctest/wasm/test-wasm-interpreter-entry.cc b/deps/v8/test/cctest/wasm/test-wasm-interpreter-entry.cc index 818433bd57..16c525945f 100644 --- a/deps/v8/test/cctest/wasm/test-wasm-interpreter-entry.cc +++ b/deps/v8/test/cctest/wasm/test-wasm-interpreter-entry.cc @@ -120,7 +120,7 @@ TEST(TestArgumentPassing_double_int64) { WASM_I64V_1(32))), WASM_CALL_FUNCTION0(f2.function_index())}, [](int32_t a, int32_t b) { - int64_t a64 = static_cast<int64_t>(a) & 0xffffffff; + int64_t a64 = static_cast<int64_t>(a) & 0xFFFFFFFF; int64_t b64 = static_cast<int64_t>(b) << 32; return static_cast<double>(a64 | b64); }); @@ -223,8 +223,8 @@ TEST(TestArgumentPassing_AllTypes) { WASM_GET_LOCAL(4), // fourth arg WASM_CALL_FUNCTION0(f2.function_index())}, [](int32_t a, int32_t b, int32_t c, float d, double e) { - return 0. + a + (static_cast<int64_t>(b) & 0xffffffff) + - ((static_cast<int64_t>(c) & 0xffffffff) << 32) + d + e; + return 0. + a + (static_cast<int64_t>(b) & 0xFFFFFFFF) + + ((static_cast<int64_t>(c) & 0xFFFFFFFF) << 32) + d + e; }); auto CheckCall = [&](int32_t a, int64_t b, float c, double d) { diff --git a/deps/v8/test/cctest/wasm/wasm-run-utils.cc b/deps/v8/test/cctest/wasm/wasm-run-utils.cc index 33090cfb2a..4fa1fb1c7a 100644 --- a/deps/v8/test/cctest/wasm/wasm-run-utils.cc +++ b/deps/v8/test/cctest/wasm/wasm-run-utils.cc @@ -15,7 +15,7 @@ namespace wasm { TestingModuleBuilder::TestingModuleBuilder( Zone* zone, WasmExecutionMode mode, - compiler::RuntimeExceptionSupport exception_support) + compiler::RuntimeExceptionSupport exception_support, LowerSimd lower_simd) : test_module_ptr_(&test_module_), isolate_(CcTest::InitIsolateOnce()), global_offset(0), @@ -24,7 +24,7 @@ TestingModuleBuilder::TestingModuleBuilder( interpreter_(nullptr), execution_mode_(mode), runtime_exception_support_(exception_support), - lower_simd_(mode == kExecuteSimdLowered) { + lower_simd_(lower_simd) { WasmJs::Install(isolate_, true); test_module_.globals_size = kMaxGlobalsSize; memset(globals_data_, 0, sizeof(globals_data_)); @@ -41,9 +41,9 @@ byte* TestingModuleBuilder::AddMemory(uint32_t size) { DCHECK(!instance_object_->has_memory_object()); test_module_.has_memory = true; const bool enable_guard_regions = - trap_handler::UseTrapHandler() && test_module_.is_wasm(); + trap_handler::IsTrapHandlerEnabled() && test_module_.is_wasm(); uint32_t alloc_size = - enable_guard_regions ? RoundUp(size, base::OS::CommitPageSize()) : size; + enable_guard_regions ? RoundUp(size, CommitPageSize()) : size; Handle<JSArrayBuffer> new_buffer = wasm::NewArrayBuffer(isolate_, alloc_size, enable_guard_regions); CHECK(!new_buffer.is_null()); @@ -96,17 +96,15 @@ uint32_t TestingModuleBuilder::AddJsFunction( *v8::Local<v8::Function>::Cast(CompileRun(source)))); uint32_t index = AddFunction(sig, nullptr); js_imports_table->set(0, *isolate_->native_context()); + // TODO(6792): No longer needed once WebAssembly code is off heap. + CodeSpaceMemoryModificationScope modification_scope(isolate_->heap()); + Handle<Code> code = compiler::CompileWasmToJSWrapper( + isolate_, jsfunc, sig, index, test_module_.origin(), + trap_handler::IsTrapHandlerEnabled(), js_imports_table); if (FLAG_wasm_jit_to_native) { native_module_->ResizeCodeTableForTest(index); - Handle<Code> wrapper = compiler::CompileWasmToJSWrapper( - isolate_, jsfunc, sig, index, test_module_.origin(), js_imports_table); - native_module_->AddCodeCopy(wrapper, wasm::WasmCode::WasmToJsWrapper, - index); + native_module_->AddCodeCopy(code, wasm::WasmCode::kWasmToJsWrapper, index); } else { - // TODO(6792): No longer needed once WebAssembly code is off heap. - CodeSpaceMemoryModificationScope modification_scope(isolate_->heap()); - Handle<Code> code = compiler::CompileWasmToJSWrapper( - isolate_, jsfunc, sig, index, test_module_.origin(), js_imports_table); function_code_[index] = code; } return index; @@ -120,10 +118,11 @@ Handle<JSFunction> TestingModuleBuilder::WrapCode(uint32_t index) { : WasmCodeWrapper(function_code_[index]); byte* context_address = test_module_.has_memory - ? reinterpret_cast<byte*>(instance_object_->wasm_context()) + ? reinterpret_cast<byte*>(instance_object_->wasm_context()->get()) : nullptr; Handle<Code> ret_code = compiler::CompileJSToWasmWrapper( - isolate_, &test_module_, code, index, context_address); + isolate_, &test_module_, code, index, context_address, + trap_handler::IsTrapHandlerEnabled()); Handle<JSFunction> ret = WasmExportedFunction::New( isolate_, instance_object(), MaybeHandle<String>(), static_cast<int>(index), @@ -133,19 +132,20 @@ Handle<JSFunction> TestingModuleBuilder::WrapCode(uint32_t index) { // Add weak reference to exported functions. Handle<WasmCompiledModule> compiled_module( instance_object()->compiled_module(), isolate_); - Handle<FixedArray> old_arr = compiled_module->weak_exported_functions(); + Handle<FixedArray> old_arr(compiled_module->weak_exported_functions(), + isolate_); Handle<FixedArray> new_arr = isolate_->factory()->NewFixedArray(old_arr->length() + 1); old_arr->CopyTo(0, *new_arr, 0, old_arr->length()); Handle<WeakCell> weak_fn = isolate_->factory()->NewWeakCell(ret); new_arr->set(old_arr->length(), *weak_fn); - compiled_module->set_weak_exported_functions(new_arr); + compiled_module->set_weak_exported_functions(*new_arr); return ret; } -void TestingModuleBuilder::AddIndirectFunctionTable(uint16_t* function_indexes, - uint32_t table_size) { +void TestingModuleBuilder::AddIndirectFunctionTable( + const uint16_t* function_indexes, uint32_t table_size) { test_module_.function_tables.emplace_back(); WasmIndirectFunctionTable& table = test_module_.function_tables.back(); table.initial_size = table_size; @@ -155,14 +155,10 @@ void TestingModuleBuilder::AddIndirectFunctionTable(uint16_t* function_indexes, table.values.push_back(function_indexes[i]); } + FixedArray* func_table = *isolate_->factory()->NewFixedArray( + table_size * compiler::kFunctionTableEntrySize); function_tables_.push_back( - isolate_->global_handles() - ->Create(*isolate_->factory()->NewFixedArray(table_size)) - .address()); - signature_tables_.push_back( - isolate_->global_handles() - ->Create(*isolate_->factory()->NewFixedArray(table_size)) - .address()); + isolate_->global_handles()->Create(func_table).address()); } void TestingModuleBuilder::PopulateIndirectFunctionTable() { @@ -172,30 +168,32 @@ void TestingModuleBuilder::PopulateIndirectFunctionTable() { WasmIndirectFunctionTable& table = test_module_.function_tables[i]; Handle<FixedArray> function_table( reinterpret_cast<FixedArray**>(function_tables_[i])); - Handle<FixedArray> signature_table( - reinterpret_cast<FixedArray**>(signature_tables_[i])); int table_size = static_cast<int>(table.values.size()); for (int j = 0; j < table_size; j++) { WasmFunction& function = test_module_.functions[table.values[j]]; - signature_table->set( - j, Smi::FromInt(test_module_.signature_map.Find(function.sig))); + function_table->set( + compiler::FunctionTableSigOffset(j), + Smi::FromInt(test_module_.signature_map.Find(function.sig))); if (FLAG_wasm_jit_to_native) { Handle<Foreign> foreign_holder = isolate_->factory()->NewForeign( native_module_->GetCode(function.func_index) ->instructions() .start(), TENURED); - function_table->set(j, *foreign_holder); + function_table->set(compiler::FunctionTableCodeOffset(j), + *foreign_holder); } else { - function_table->set(j, *function_code_[function.func_index]); + function_table->set(compiler::FunctionTableCodeOffset(j), + *function_code_[function.func_index]); } } } } uint32_t TestingModuleBuilder::AddBytes(Vector<const byte> bytes) { - Handle<SeqOneByteString> old_bytes( - instance_object_->compiled_module()->module_bytes(), isolate_); + Handle<WasmSharedModuleData> shared( + instance_object_->compiled_module()->shared(), isolate_); + Handle<SeqOneByteString> old_bytes(shared->module_bytes(), isolate_); uint32_t old_size = static_cast<uint32_t>(old_bytes->length()); // Avoid placing strings at offset 0, this might be interpreted as "not // set", e.g. for function names. @@ -205,14 +203,13 @@ uint32_t TestingModuleBuilder::AddBytes(Vector<const byte> bytes) { memcpy(new_bytes.start() + bytes_offset, bytes.start(), bytes.length()); Handle<SeqOneByteString> new_bytes_str = Handle<SeqOneByteString>::cast( isolate_->factory()->NewStringFromOneByte(new_bytes).ToHandleChecked()); - instance_object_->compiled_module()->shared()->set_module_bytes( - *new_bytes_str); + shared->set_module_bytes(*new_bytes_str); return bytes_offset; } compiler::ModuleEnv TestingModuleBuilder::CreateModuleEnv() { - return {&test_module_, function_tables_, signature_tables_, function_code_, - Handle<Code>::null()}; + return {&test_module_, function_tables_, function_code_, Handle<Code>::null(), + trap_handler::IsTrapHandlerEnabled()}; } const WasmGlobal* TestingModuleBuilder::AddGlobal(ValueType type) { @@ -243,7 +240,7 @@ Handle<WasmInstanceObject> TestingModuleBuilder::InitInstanceObject() { Handle<FixedArray> export_wrappers = isolate_->factory()->NewFixedArray(0); Handle<WasmCompiledModule> compiled_module = WasmCompiledModule::New( isolate_, test_module_ptr_, code_table, export_wrappers, function_tables_, - signature_tables_); + trap_handler::IsTrapHandlerEnabled()); compiled_module->OnWasmModuleDecodingComplete(shared_module_data); // This method is called when we initialize TestEnvironment. We don't // have a memory yet, so we won't create it here. We'll update the @@ -251,43 +248,55 @@ Handle<WasmInstanceObject> TestingModuleBuilder::InitInstanceObject() { native_module_ = compiled_module->GetNativeModule(); Handle<FixedArray> weak_exported = isolate_->factory()->NewFixedArray(0); - compiled_module->set_weak_exported_functions(weak_exported); + compiled_module->set_weak_exported_functions(*weak_exported); DCHECK(WasmCompiledModule::IsWasmCompiledModule(*compiled_module)); script->set_wasm_compiled_module(*compiled_module); auto instance = WasmInstanceObject::New(isolate_, compiled_module); instance->wasm_context()->get()->globals_start = globals_data_; Handle<WeakCell> weak_instance = isolate()->factory()->NewWeakCell(instance); - compiled_module->set_weak_owning_instance(weak_instance); + compiled_module->set_weak_owning_instance(*weak_instance); return instance; } -void TestBuildingGraph( - Zone* zone, compiler::JSGraph* jsgraph, compiler::ModuleEnv* module, - FunctionSig* sig, compiler::SourcePositionTable* source_position_table, - const byte* start, const byte* end, - compiler::RuntimeExceptionSupport runtime_exception_support) { - compiler::WasmGraphBuilder builder( - module, zone, jsgraph, CEntryStub(jsgraph->isolate(), 1).GetCode(), sig, - source_position_table, runtime_exception_support); - +void TestBuildingGraphWithBuilder(compiler::WasmGraphBuilder* builder, + Zone* zone, FunctionSig* sig, + const byte* start, const byte* end) { DecodeResult result = - BuildTFGraph(zone->allocator(), &builder, sig, start, end); + BuildTFGraph(zone->allocator(), builder, sig, start, end); if (result.failed()) { +#ifdef DEBUG if (!FLAG_trace_wasm_decoder) { // Retry the compilation with the tracing flag on, to help in debugging. FLAG_trace_wasm_decoder = true; - result = BuildTFGraph(zone->allocator(), &builder, sig, start, end); + result = BuildTFGraph(zone->allocator(), builder, sig, start, end); } +#endif uint32_t pc = result.error_offset(); - std::ostringstream str; - str << "Verification failed; pc = +" << pc - << ", msg = " << result.error_msg().c_str(); - FATAL(str.str().c_str()); + FATAL("Verification failed; pc = +%x, msg = %s", pc, + result.error_msg().c_str()); } - builder.LowerInt64(); + builder->LowerInt64(); if (!CpuFeatures::SupportsWasmSimd128()) { - builder.SimdScalarLoweringForTesting(); + builder->SimdScalarLoweringForTesting(); + } +} + +void TestBuildingGraph( + Zone* zone, compiler::JSGraph* jsgraph, compiler::ModuleEnv* module, + FunctionSig* sig, compiler::SourcePositionTable* source_position_table, + const byte* start, const byte* end, + compiler::RuntimeExceptionSupport runtime_exception_support) { + if (module) { + compiler::WasmGraphBuilder builder( + module, zone, jsgraph, CEntryStub(jsgraph->isolate(), 1).GetCode(), sig, + source_position_table, runtime_exception_support); + TestBuildingGraphWithBuilder(&builder, zone, sig, start, end); + } else { + compiler::WasmGraphBuilder builder( + nullptr, zone, jsgraph, CEntryStub(jsgraph->isolate(), 1).GetCode(), + sig, source_position_table, runtime_exception_support); + TestBuildingGraphWithBuilder(&builder, zone, sig, start, end); } } @@ -428,7 +437,7 @@ void WasmFunctionCompiler::Build(const byte* start, const byte* end) { if (FLAG_wasm_jit_to_native) { native_module->ResizeCodeTableForTest(function_->func_index); } - Handle<SeqOneByteString> wire_bytes(compiled_module->module_bytes(), + Handle<SeqOneByteString> wire_bytes(compiled_module->shared()->module_bytes(), isolate()); compiler::ModuleEnv module_env = builder_->CreateModuleEnv(); @@ -476,7 +485,7 @@ void WasmFunctionCompiler::Build(const byte* start, const byte* end) { builder_->SetFunctionCode(function_index(), code); // Add to code table. - Handle<FixedArray> code_table = compiled_module->code_table(); + Handle<FixedArray> code_table(compiled_module->code_table(), isolate()); if (static_cast<int>(function_index()) >= code_table->length()) { Handle<FixedArray> new_arr = isolate()->factory()->NewFixedArray( static_cast<int>(function_index()) + 1); @@ -487,11 +496,11 @@ void WasmFunctionCompiler::Build(const byte* start, const byte* end) { DCHECK(code_table->get(static_cast<int>(function_index())) ->IsUndefined(isolate())); code_table->set(static_cast<int>(function_index()), *code); - if (trap_handler::UseTrapHandler()) { + if (trap_handler::IsTrapHandlerEnabled()) { UnpackAndRegisterProtectedInstructionsGC(isolate(), code_table); } } else { - if (trap_handler::UseTrapHandler()) { + if (trap_handler::IsTrapHandlerEnabled()) { UnpackAndRegisterProtectedInstructions(isolate(), native_module); } } @@ -516,7 +525,7 @@ WasmFunctionCompiler::WasmFunctionCompiler(Zone* zone, FunctionSig* sig, WasmFunctionCompiler::~WasmFunctionCompiler() { if (!FLAG_wasm_jit_to_native) { - if (trap_handler::UseTrapHandler() && + if (trap_handler::IsTrapHandlerEnabled() && !builder_->GetFunctionCode(function_index()).is_null()) { const int handler_index = builder_->GetFunctionCode(function_index()) .GetCode() diff --git a/deps/v8/test/cctest/wasm/wasm-run-utils.h b/deps/v8/test/cctest/wasm/wasm-run-utils.h index f46d1e3d61..c0ce21533f 100644 --- a/deps/v8/test/cctest/wasm/wasm-run-utils.h +++ b/deps/v8/test/cctest/wasm/wasm-run-utils.h @@ -25,6 +25,7 @@ #include "src/trap-handler/trap-handler.h" #include "src/wasm/function-body-decoder.h" #include "src/wasm/local-decl-encoder.h" +#include "src/wasm/wasm-code-manager.h" #include "src/wasm/wasm-external-refs.h" #include "src/wasm/wasm-interpreter.h" #include "src/wasm/wasm-js.h" @@ -50,23 +51,23 @@ constexpr uint32_t kMaxGlobalsSize = 128; enum WasmExecutionMode { kExecuteInterpreter, kExecuteTurbofan, - kExecuteLiftoff, - // TODO(bug:7028): Introduce another enum for simd lowering. - kExecuteSimdLowered + kExecuteLiftoff }; +enum LowerSimd : bool { kLowerSimd = true, kNoLowerSimd = false }; + using compiler::CallDescriptor; using compiler::MachineTypeForC; using compiler::Node; // TODO(titzer): check traps more robustly in tests. -// Currently, in tests, we just return 0xdeadbeef from the function in which +// Currently, in tests, we just return 0xDEADBEEF from the function in which // the trap occurs if the runtime context is not available to throw a JavaScript // exception. #define CHECK_TRAP32(x) \ - CHECK_EQ(0xdeadbeef, (bit_cast<uint32_t>(x)) & 0xFFFFFFFF) + CHECK_EQ(0xDEADBEEF, (bit_cast<uint32_t>(x)) & 0xFFFFFFFF) #define CHECK_TRAP64(x) \ - CHECK_EQ(0xdeadbeefdeadbeef, (bit_cast<uint64_t>(x)) & 0xFFFFFFFFFFFFFFFF) + CHECK_EQ(0xDEADBEEFDEADBEEF, (bit_cast<uint64_t>(x)) & 0xFFFFFFFFFFFFFFFF) #define CHECK_TRAP(x) CHECK_TRAP32(x) #define WASM_WRAPPER_RETURN_VALUE 8754 @@ -84,7 +85,7 @@ using compiler::Node; class TestingModuleBuilder { public: TestingModuleBuilder(Zone*, WasmExecutionMode, - compiler::RuntimeExceptionSupport); + compiler::RuntimeExceptionSupport, LowerSimd); void ChangeOriginToAsmjs() { test_module_.set_origin(kAsmJsOrigin); } @@ -190,7 +191,7 @@ class TestingModuleBuilder { function_code_[index] = code; } - void AddIndirectFunctionTable(uint16_t* function_indexes, + void AddIndirectFunctionTable(const uint16_t* function_indexes, uint32_t table_size); void PopulateIndirectFunctionTable(); @@ -203,7 +204,7 @@ class TestingModuleBuilder { WasmInterpreter* interpreter() { return interpreter_; } bool interpret() { return interpreter_ != nullptr; } - bool lower_simd() { return lower_simd_; } + LowerSimd lower_simd() { return lower_simd_; } Isolate* isolate() { return isolate_; } Handle<WasmInstanceObject> instance_object() { return instance_object_; } WasmCodeWrapper GetFunctionCode(uint32_t index) { @@ -222,6 +223,7 @@ class TestingModuleBuilder { if (!linked_) { native_module_->LinkAll(); linked_ = true; + native_module_->SetExecutable(true); } } @@ -242,7 +244,6 @@ class TestingModuleBuilder { uint32_t mem_size_; std::vector<Handle<Code>> function_code_; std::vector<GlobalHandleAddress> function_tables_; - std::vector<GlobalHandleAddress> signature_tables_; V8_ALIGNED(16) byte globals_data_[kMaxGlobalsSize]; WasmInterpreter* interpreter_; WasmExecutionMode execution_mode_; @@ -250,7 +251,7 @@ class TestingModuleBuilder { NativeModule* native_module_; bool linked_ = false; compiler::RuntimeExceptionSupport runtime_exception_support_; - bool lower_simd_; + LowerSimd lower_simd_; const WasmGlobal* AddGlobal(ValueType type); @@ -371,9 +372,10 @@ class WasmFunctionCompiler : public compiler::GraphAndBuilders { class WasmRunnerBase : public HandleAndZoneScope { public: WasmRunnerBase(WasmExecutionMode execution_mode, int num_params, - compiler::RuntimeExceptionSupport runtime_exception_support) + compiler::RuntimeExceptionSupport runtime_exception_support, + LowerSimd lower_simd) : zone_(&allocator_, ZONE_NAME), - builder_(&zone_, execution_mode, runtime_exception_support), + builder_(&zone_, execution_mode, runtime_exception_support, lower_simd), wrapper_(&zone_, num_params) {} // Builds a graph from the given Wasm code and generates the machine @@ -452,20 +454,25 @@ class WasmRunner : public WasmRunnerBase { WasmRunner(WasmExecutionMode execution_mode, const char* main_fn_name = "main", compiler::RuntimeExceptionSupport runtime_exception_support = - compiler::kNoRuntimeExceptionSupport) + compiler::kNoRuntimeExceptionSupport, + LowerSimd lower_simd = kNoLowerSimd) : WasmRunnerBase(execution_mode, sizeof...(ParamTypes), - runtime_exception_support) { + runtime_exception_support, lower_simd) { NewFunction<ReturnType, ParamTypes...>(main_fn_name); if (!interpret()) { wrapper_.Init<ReturnType, ParamTypes...>(functions_[0]->descriptor()); } } + WasmRunner(WasmExecutionMode execution_mode, LowerSimd lower_simd) + : WasmRunner(execution_mode, "main", compiler::kNoRuntimeExceptionSupport, + lower_simd) {} + ReturnType Call(ParamTypes... p) { DCHECK(compiled_); if (interpret()) return CallInterpreter(p...); - ReturnType return_value = static_cast<ReturnType>(0xdeadbeefdeadbeef); + ReturnType return_value = static_cast<ReturnType>(0xDEADBEEFDEADBEEF); WasmRunnerBase::trap_happened = false; auto trap_callback = []() -> void { WasmRunnerBase::trap_happened = true; @@ -485,7 +492,7 @@ class WasmRunner : public WasmRunnerBase { static_cast<void*>(&return_value)); CHECK_EQ(WASM_WRAPPER_RETURN_VALUE, result); return WasmRunnerBase::trap_happened - ? static_cast<ReturnType>(0xdeadbeefdeadbeef) + ? static_cast<ReturnType>(0xDEADBEEFDEADBEEF) : return_value; } @@ -502,7 +509,7 @@ class WasmRunner : public WasmRunnerBase { return val.to<ReturnType>(); } else if (thread->state() == WasmInterpreter::TRAPPED) { // TODO(titzer): return the correct trap code - int64_t result = 0xdeadbeefdeadbeef; + int64_t result = 0xDEADBEEFDEADBEEF; return static_cast<ReturnType>(result); } else { // TODO(titzer): falling off end diff --git a/deps/v8/test/common/wasm/wasm-macro-gen.h b/deps/v8/test/common/wasm/wasm-macro-gen.h index 40718e79aa..83ddaa6b72 100644 --- a/deps/v8/test/common/wasm/wasm-macro-gen.h +++ b/deps/v8/test/common/wasm/wasm-macro-gen.h @@ -557,25 +557,34 @@ inline WasmOpcode LoadStoreOpcodeOf(MachineType type, bool store) { #define WASM_I64_REINTERPRET_F64(x) x, kExprI64ReinterpretF64 //------------------------------------------------------------------------------ +// Numeric operations +//------------------------------------------------------------------------------ +#define WASM_NUMERIC_OP(op) kNumericPrefix, static_cast<byte>(op) +#define WASM_I32_SCONVERT_SAT_F32(x) x, WASM_NUMERIC_OP(kExprI32SConvertSatF32) +#define WASM_I32_UCONVERT_SAT_F32(x) x, WASM_NUMERIC_OP(kExprI32UConvertSatF32) +#define WASM_I32_SCONVERT_SAT_F64(x) x, WASM_NUMERIC_OP(kExprI32SConvertSatF64) +#define WASM_I32_UCONVERT_SAT_F64(x) x, WASM_NUMERIC_OP(kExprI32UConvertSatF64) + +//------------------------------------------------------------------------------ // Memory Operations. //------------------------------------------------------------------------------ #define WASM_GROW_MEMORY(x) x, kExprGrowMemory, 0 #define WASM_MEMORY_SIZE kExprMemorySize, 0 -#define SIG_ENTRY_v_v kWasmFunctionTypeForm, 0, 0 +#define SIG_ENTRY_v_v kWasmFunctionTypeCode, 0, 0 #define SIZEOF_SIG_ENTRY_v_v 3 -#define SIG_ENTRY_v_x(a) kWasmFunctionTypeForm, 1, a, 0 -#define SIG_ENTRY_v_xx(a, b) kWasmFunctionTypeForm, 2, a, b, 0 -#define SIG_ENTRY_v_xxx(a, b, c) kWasmFunctionTypeForm, 3, a, b, c, 0 +#define SIG_ENTRY_v_x(a) kWasmFunctionTypeCode, 1, a, 0 +#define SIG_ENTRY_v_xx(a, b) kWasmFunctionTypeCode, 2, a, b, 0 +#define SIG_ENTRY_v_xxx(a, b, c) kWasmFunctionTypeCode, 3, a, b, c, 0 #define SIZEOF_SIG_ENTRY_v_x 4 #define SIZEOF_SIG_ENTRY_v_xx 5 #define SIZEOF_SIG_ENTRY_v_xxx 6 -#define SIG_ENTRY_x(r) kWasmFunctionTypeForm, 0, 1, r -#define SIG_ENTRY_x_x(r, a) kWasmFunctionTypeForm, 1, a, 1, r -#define SIG_ENTRY_x_xx(r, a, b) kWasmFunctionTypeForm, 2, a, b, 1, r -#define SIG_ENTRY_x_xxx(r, a, b, c) kWasmFunctionTypeForm, 3, a, b, c, 1, r +#define SIG_ENTRY_x(r) kWasmFunctionTypeCode, 0, 1, r +#define SIG_ENTRY_x_x(r, a) kWasmFunctionTypeCode, 1, a, 1, r +#define SIG_ENTRY_x_xx(r, a, b) kWasmFunctionTypeCode, 2, a, b, 1, r +#define SIG_ENTRY_x_xxx(r, a, b, c) kWasmFunctionTypeCode, 3, a, b, c, 1, r #define SIZEOF_SIG_ENTRY_x 4 #define SIZEOF_SIG_ENTRY_x_x 5 #define SIZEOF_SIG_ENTRY_x_xx 6 diff --git a/deps/v8/test/common/wasm/wasm-module-runner.cc b/deps/v8/test/common/wasm/wasm-module-runner.cc index 8150fc08a8..d89d87005e 100644 --- a/deps/v8/test/common/wasm/wasm-module-runner.cc +++ b/deps/v8/test/common/wasm/wasm-module-runner.cc @@ -23,7 +23,7 @@ namespace wasm { namespace testing { uint32_t GetInitialMemSize(const WasmModule* module) { - return WasmModule::kPageSize * module->initial_pages; + return kWasmPageSize * module->initial_pages; } std::unique_ptr<WasmModule> DecodeWasmModuleForTesting( @@ -173,9 +173,9 @@ int32_t InterpretWasmModule(Isolate* isolate, isolate->clear_pending_exception(); *possible_nondeterminism = thread->PossibleNondeterminism(); - if (stack_overflow) return 0xdeadbeef; + if (stack_overflow) return 0xDEADBEEF; - if (thread->state() == WasmInterpreter::TRAPPED) return 0xdeadbeef; + if (thread->state() == WasmInterpreter::TRAPPED) return 0xDEADBEEF; if (interpreter_result == WasmInterpreter::FINISHED) return thread->GetReturnValue().to<int32_t>(); diff --git a/deps/v8/test/d8_default.gyp b/deps/v8/test/d8_default.gyp new file mode 100644 index 0000000000..399623d30a --- /dev/null +++ b/deps/v8/test/d8_default.gyp @@ -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. + +{ + 'conditions': [ + ['test_isolation_mode != "noop"', { + 'targets': [ + { + 'target_name': 'd8_default_run', + 'type': 'none', + 'dependencies': [ + 'debugger/debugger.gyp:debugger_run', + 'intl/intl.gyp:intl_run', + 'message/message.gyp:message_run', + 'mjsunit/mjsunit.gyp:mjsunit_run', + 'preparser/preparser.gyp:preparser_run', + 'webkit/webkit.gyp:webkit_run', + ], + 'includes': [ + '../gypfiles/features.gypi', + '../gypfiles/isolate.gypi', + ], + 'sources': [ + 'd8_default.isolate', + ], + }, + ], + }], + ], +} diff --git a/deps/v8/test/d8_default.isolate b/deps/v8/test/d8_default.isolate new file mode 100644 index 0000000000..efeae64cae --- /dev/null +++ b/deps/v8/test/d8_default.isolate @@ -0,0 +1,18 @@ +# 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. +{ + 'variables': { + 'command': [ + '../tools/run-tests.py', + ], + }, + 'includes': [ + 'debugger/debugger.isolate', + 'intl/intl.isolate', + 'message/message.isolate', + 'mjsunit/mjsunit.isolate', + 'preparser/preparser.isolate', + 'webkit/webkit.isolate', + ], +} diff --git a/deps/v8/test/debugger/debug/debug-modules-set-variable-value.js b/deps/v8/test/debugger/debug/debug-modules-set-variable-value.js index 61c032f026..1d1c6d5d13 100644 --- a/deps/v8/test/debugger/debug/debug-modules-set-variable-value.js +++ b/deps/v8/test/debugger/debug/debug-modules-set-variable-value.js @@ -271,7 +271,7 @@ let salad = 12; function listener(event, exec_state) { if (event == Debug.DebugEvent.Break) { let scope_count = exec_state.frame().scopeCount(); - let module_scope = exec_state.frame().scope(2); + let module_scope = exec_state.frame().scope(1); assertEquals(debug.ScopeType.Module, module_scope.scopeType()); module_scope.setVariableValue('salad', 42); } @@ -311,7 +311,7 @@ export let ham = 1; function listener(event, exec_state) { if (event == Debug.DebugEvent.Break) { let scope_count = exec_state.frame().scopeCount(); - let module_scope = exec_state.frame().scope(2); + let module_scope = exec_state.frame().scope(1); assertEquals(debug.ScopeType.Module, module_scope.scopeType()); module_scope.setVariableValue('ham', 2); } diff --git a/deps/v8/test/debugger/debug/harmony/modules-debug-scopes2.js b/deps/v8/test/debugger/debug/harmony/modules-debug-scopes2.js index 8b9b9e8aee..cc1091e73f 100644 --- a/deps/v8/test/debugger/debug/harmony/modules-debug-scopes2.js +++ b/deps/v8/test/debugger/debug/harmony/modules-debug-scopes2.js @@ -139,10 +139,10 @@ listener_delegate = function(exec_state) { debug.ScopeType.Script, debug.ScopeType.Global], exec_state); CheckScopeContent( - {local_var: undefined, exported_var: undefined, imported_var: undefined}, + {exported_var: undefined, imported_var: undefined}, 0, exec_state); CheckScopeDoesNotHave( - ["doesnotexist", "local_let", "exported_let", "imported_let"], + ["local_var", "doesntexist", "local_let", "exported_let", "imported_let"], 0, exec_state); }; debugger; @@ -161,8 +161,9 @@ listener_delegate = function(exec_state) { debug.ScopeType.Script, debug.ScopeType.Global], exec_state); CheckScopeContent( - {local_let: 1, local_var: 2, exported_let: 3, exported_var: 4, + {exported_let: 3, exported_var: 4, imported_let: 3, imported_var: 4}, 0, exec_state); + CheckScopeDoesNotHave(["local_var", "local_let"], 0, exec_state); }; debugger; EndTest(); @@ -178,8 +179,9 @@ listener_delegate = function(exec_state) { debug.ScopeType.Script, debug.ScopeType.Global], exec_state); CheckScopeContent( - {local_let: 11, local_var: 12, exported_let: 13, exported_var: 14, + {exported_let: 13, exported_var: 14, imported_let: 13, imported_var: 14}, 0, exec_state); + CheckScopeDoesNotHave(["local_var", "local_let"], 0, exec_state); }; debugger; EndTest(); diff --git a/deps/v8/test/debugger/debug/regress/regress-1853.js b/deps/v8/test/debugger/debug/regress/regress-1853.js index 8c6e9404a7..4cd069f77c 100644 --- a/deps/v8/test/debugger/debug/regress/regress-1853.js +++ b/deps/v8/test/debugger/debug/regress/regress-1853.js @@ -25,10 +25,11 @@ // (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: --expose-gc // Test whether scripts compiled after setting the break point are // updated correctly. +gc(); Debug = debug.Debug; var break_count = 0; diff --git a/deps/v8/test/debugger/debug/regress/regress-crbug-481896.js b/deps/v8/test/debugger/debug/regress/regress-crbug-481896.js index d12398070b..751b62a7b6 100644 --- a/deps/v8/test/debugger/debug/regress/regress-crbug-481896.js +++ b/deps/v8/test/debugger/debug/regress/regress-crbug-481896.js @@ -1,8 +1,8 @@ // 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: --expose-gc +gc(); function static() { print("> static"); // Break } diff --git a/deps/v8/test/debugger/testcfg.py b/deps/v8/test/debugger/testcfg.py index 71b19d2159..e287077ec3 100644 --- a/deps/v8/test/debugger/testcfg.py +++ b/deps/v8/test/debugger/testcfg.py @@ -9,14 +9,9 @@ from testrunner.local import testsuite from testrunner.objects import testcase FILES_PATTERN = re.compile(r"//\s+Files:(.*)") -FLAGS_PATTERN = re.compile(r"//\s+Flags:(.*)") MODULE_PATTERN = re.compile(r"^// MODULE$", flags=re.MULTILINE) -class DebuggerTestSuite(testsuite.TestSuite): - - def __init__(self, name, root): - super(DebuggerTestSuite, self).__init__(name, root) - +class TestSuite(testsuite.TestSuite): def ListTests(self, context): tests = [] for dirname, dirs, files in os.walk(self.root): @@ -29,21 +24,23 @@ class DebuggerTestSuite(testsuite.TestSuite): fullpath = os.path.join(dirname, filename) relpath = fullpath[len(self.root) + 1 : -3] testname = relpath.replace(os.path.sep, "/") - test = testcase.TestCase(self, testname) + test = self._create_test(testname) tests.append(test) return tests - def GetParametersForTestCase(self, testcase, context): - flags = ( - testcase.flags + - ["--enable-inspector", "--allow-natives-syntax"] + - context.mode_flags - ) - source = self.GetSourceForTest(testcase) - flags_match = re.findall(FLAGS_PATTERN, source) - for match in flags_match: - flags += match.strip().split() + def _test_class(self): + return TestCase + + +class TestCase(testcase.TestCase): + def __init__(self, *args, **kwargs): + super(TestCase, self).__init__(*args, **kwargs) + source = self.get_source() + self._source_files = self._parse_source_files(source) + self._source_flags = self._parse_source_flags(source) + + def _parse_source_files(self, source): files_list = [] # List of file names to append to command arguments. files_match = FILES_PATTERN.search(source); # Accept several lines of 'Files:'. @@ -55,24 +52,31 @@ class DebuggerTestSuite(testsuite.TestSuite): break files = [] - files.append(os.path.normpath(os.path.join(self.root, "..", "mjsunit", "mjsunit.js"))) - files.append(os.path.join(self.root, "test-api.js")) - files.extend([ os.path.normpath(os.path.join(self.root, '..', '..', f)) - for f in files_list ]) + files.append(os.path.normpath(os.path.join( + self.suite.root, "..", "mjsunit", "mjsunit.js"))) + files.append(os.path.join(self.suite.root, "test-api.js")) + files.extend([os.path.normpath(os.path.join(self.suite.root, '..', '..', f)) + for f in files_list]) if MODULE_PATTERN.search(source): files.append("--module") - files.append(os.path.join(self.root, testcase.path + self.suffix())) + files.append(os.path.join(self.suite.root, self.path + self._get_suffix())) + return files + + def _get_files_params(self, ctx): + files = self._source_files + if ctx.isolates: + files = files + ['--isolate'] + files + return files + + def _get_source_flags(self): + return self._source_flags - all_files = list(files) - if context.isolates: - all_files += ["--isolate"] + files + def _get_suite_flags(self, ctx): + return ['--enable-inspector', '--allow-natives-syntax'] - return all_files, flags, {} + def _get_source_path(self): + return os.path.join(self.suite.root, self.path + self._get_suffix()) - def GetSourceForTest(self, testcase): - filename = os.path.join(self.root, testcase.path + self.suffix()) - with open(filename) as f: - return f.read() def GetSuite(name, root): - return DebuggerTestSuite(name, root) + return TestSuite(name, root) diff --git a/deps/v8/test/default.gyp b/deps/v8/test/default.gyp index 2c6429bada..d1007b8a96 100644 --- a/deps/v8/test/default.gyp +++ b/deps/v8/test/default.gyp @@ -11,6 +11,7 @@ 'type': 'none', 'dependencies': [ 'cctest/cctest.gyp:cctest_run', + 'debugger/debugger.gyp:debugger_run', 'fuzzer/fuzzer.gyp:fuzzer_run', 'inspector/inspector.gyp:inspector-test_run', 'intl/intl.gyp:intl_run', diff --git a/deps/v8/test/fuzzer/fuzzer-support.cc b/deps/v8/test/fuzzer/fuzzer-support.cc index beda4899c1..d6cff118bf 100644 --- a/deps/v8/test/fuzzer/fuzzer-support.cc +++ b/deps/v8/test/fuzzer/fuzzer-support.cc @@ -89,7 +89,14 @@ bool FuzzerSupport::PumpMessageLoop( } // namespace v8_fuzzer -extern "C" int LLVMFuzzerInitialize(int* argc, char*** argv) { +// Explicitly specify some attributes to avoid issues with the linker dead- +// stripping the following function on macOS, as it is not called directly +// by fuzz target. LibFuzzer runtime uses dlsym() to resolve that function. +#if V8_OS_MACOSX +__attribute__((used)) __attribute__((visibility("default"))) +#endif // V8_OS_MACOSX +extern "C" int +LLVMFuzzerInitialize(int* argc, char*** argv) { v8_fuzzer::FuzzerSupport::InitializeFuzzerSupport(argc, argv); return 0; } diff --git a/deps/v8/test/fuzzer/fuzzer.gyp b/deps/v8/test/fuzzer/fuzzer.gyp index 3d76018d55..0c54211290 100644 --- a/deps/v8/test/fuzzer/fuzzer.gyp +++ b/deps/v8/test/fuzzer/fuzzer.gyp @@ -90,6 +90,36 @@ ], }, { + 'target_name': 'v8_simple_multi_return_fuzzer', + 'type': 'executable', + 'dependencies': [ + 'multi_return_fuzzer_lib', + ], + 'include_dirs': [ + '../..', + ], + 'sources': [ + 'fuzzer.cc', + ], + }, + { + 'target_name': 'multi_return_fuzzer_lib', + 'type': 'static_library', + 'dependencies': [ + '../../src/v8.gyp:v8_libplatform', + 'fuzzer_support', + ], + 'include_dirs': [ + '../..', + ], + 'sources': [ ### gcmole(all) ### + '../compiler/c-signature.h', + '../compiler/call-helper.h', + '../compiler/raw-machine-assembler-tester.h', + 'multi-return.cc', + ], + }, + { 'target_name': 'v8_simple_wasm_fuzzer', 'type': 'executable', 'dependencies': [ diff --git a/deps/v8/test/fuzzer/fuzzer.isolate b/deps/v8/test/fuzzer/fuzzer.isolate index 097d55885d..9391dcc7c0 100644 --- a/deps/v8/test/fuzzer/fuzzer.isolate +++ b/deps/v8/test/fuzzer/fuzzer.isolate @@ -8,6 +8,7 @@ '<(PRODUCT_DIR)/v8_simple_json_fuzzer<(EXECUTABLE_SUFFIX)', '<(PRODUCT_DIR)/v8_simple_parser_fuzzer<(EXECUTABLE_SUFFIX)', '<(PRODUCT_DIR)/v8_simple_regexp_fuzzer<(EXECUTABLE_SUFFIX)', + '<(PRODUCT_DIR)/v8_simple_multi_return_fuzzer<(EXECUTABLE_SUFFIX)', '<(PRODUCT_DIR)/v8_simple_wasm_fuzzer<(EXECUTABLE_SUFFIX)', '<(PRODUCT_DIR)/v8_simple_wasm_async_fuzzer<(EXECUTABLE_SUFFIX)', '<(PRODUCT_DIR)/v8_simple_wasm_call_fuzzer<(EXECUTABLE_SUFFIX)', @@ -25,6 +26,7 @@ './json/', './parser/', './regexp/', + './multi_return/', './wasm/', './wasm_async/', './wasm_call/', diff --git a/deps/v8/test/fuzzer/multi-return.cc b/deps/v8/test/fuzzer/multi-return.cc new file mode 100644 index 0000000000..4766774005 --- /dev/null +++ b/deps/v8/test/fuzzer/multi-return.cc @@ -0,0 +1,346 @@ +// 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 <cstddef> +#include <cstdint> + +#include "src/compilation-info.h" +#include "src/compiler/graph.h" +#include "src/compiler/instruction-selector.h" +#include "src/compiler/linkage.h" +#include "src/compiler/node.h" +#include "src/compiler/operator.h" +#include "src/compiler/pipeline.h" +#include "src/compiler/raw-machine-assembler.h" +#include "src/machine-type.h" +#include "src/objects-inl.h" +#include "src/objects.h" +#include "src/simulator.h" +#include "src/zone/accounting-allocator.h" +#include "src/zone/zone.h" +#include "test/fuzzer/fuzzer-support.h" + +namespace v8 { +namespace internal { +namespace compiler { +namespace fuzzer { + +constexpr MachineType kTypes[] = { + // The first entry is just a placeholder, because '0' is a separator. + MachineType(), +#if !V8_TARGET_ARCH_32_BIT + MachineType::Int64(), +#endif + MachineType::Int32(), MachineType::Float32(), MachineType::Float64()}; + +static constexpr int kNumTypes = arraysize(kTypes); + +class InputProvider { + public: + InputProvider(const uint8_t* data, size_t size) + : current_(data), end_(data + size) {} + + size_t NumNonZeroBytes(size_t offset, int limit) { + DCHECK_LE(limit, std::numeric_limits<uint8_t>::max()); + DCHECK_GE(current_ + offset, current_); + const uint8_t* p; + for (p = current_ + offset; p < end_; ++p) { + if (*p % limit == 0) break; + } + return p - current_ - offset; + } + + int NextInt8(int limit) { + DCHECK_LE(limit, std::numeric_limits<uint8_t>::max()); + if (current_ == end_) return 0; + uint8_t result = *current_; + current_++; + return static_cast<int>(result) % limit; + } + + int NextInt32(int limit) { + if (current_ + sizeof(uint32_t) > end_) return 0; + int result = ReadLittleEndianValue<int>(current_); + current_ += sizeof(uint32_t); + return result % limit; + } + + private: + const uint8_t* current_; + const uint8_t* end_; +}; + +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 size(MachineType type) { + return 1 << ElementSizeLog2Of(type.representation()); +} + +int index(MachineType type) { return static_cast<int>(type.representation()); } + +const int* codes(MachineType type) { + const RegisterConfiguration* config = RegisterConfiguration::Default(); + switch (type.representation()) { + case MachineRepresentation::kWord32: + case MachineRepresentation::kWord64: + return config->allocatable_general_codes(); + case MachineRepresentation::kFloat32: + return config->allocatable_float_codes(); + case MachineRepresentation::kFloat64: + return config->allocatable_double_codes(); + default: + UNREACHABLE(); + } +} + +LinkageLocation AllocateLocation(MachineType type, int* int_count, + int* float_count, int* stack_slots) { + int* count = IsFloatingPoint(type.representation()) ? float_count : int_count; + int reg_code = *count; +#if V8_TARGET_ARCH_ARM + // Allocate floats using a double register, but modify the code to + // reflect how ARM FP registers alias. + if (type == MachineType::Float32()) { + reg_code *= 2; + } +#endif + LinkageLocation location = LinkageLocation::ForAnyRegister(); // Dummy. + if (reg_code < num_registers(type)) { + location = LinkageLocation::ForRegister(codes(type)[reg_code], type); + } else { + location = LinkageLocation::ForCallerFrameSlot(-*stack_slots - 1, type); + *stack_slots += std::max(1, size(type) / kPointerSize); + } + ++*count; + return location; +} + +Node* Constant(RawMachineAssembler& m, MachineType type, int value) { + switch (type.representation()) { + case MachineRepresentation::kWord32: + return m.Int32Constant(static_cast<int32_t>(value)); + case MachineRepresentation::kWord64: + return m.Int64Constant(static_cast<int64_t>(value)); + case MachineRepresentation::kFloat32: + return m.Float32Constant(static_cast<float>(value)); + case MachineRepresentation::kFloat64: + return m.Float64Constant(static_cast<double>(value)); + default: + UNREACHABLE(); + } +} + +Node* ToInt32(RawMachineAssembler& m, MachineType type, Node* a) { + switch (type.representation()) { + case MachineRepresentation::kWord32: + return a; + case MachineRepresentation::kWord64: + return m.TruncateInt64ToInt32(a); + case MachineRepresentation::kFloat32: + return m.TruncateFloat32ToInt32(a); + case MachineRepresentation::kFloat64: + return m.RoundFloat64ToInt32(a); + default: + UNREACHABLE(); + } +} + +CallDescriptor* CreateRandomCallDescriptor(Zone* zone, size_t return_count, + size_t param_count, + InputProvider* input) { + LocationSignature::Builder locations(zone, return_count, param_count); + + int stack_slots = 0; + int int_params = 0; + int float_params = 0; + for (size_t i = 0; i < param_count; i++) { + MachineType type = RandomType(input); + LinkageLocation location = + AllocateLocation(type, &int_params, &float_params, &stack_slots); + locations.AddParam(location); + } + // Read the end byte of the parameters. + input->NextInt8(1); + + int stack_params = stack_slots; +#if V8_TARGET_ARCH_ARM64 + // Align the stack slots. + stack_slots = stack_slots + (stack_slots % 2); +#endif + int aligned_stack_params = stack_slots; + int int_returns = 0; + int float_returns = 0; + for (size_t i = 0; i < return_count; i++) { + MachineType type = RandomType(input); + LinkageLocation location = + AllocateLocation(type, &int_returns, &float_returns, &stack_slots); + locations.AddReturn(location); + } + int stack_returns = stack_slots - aligned_stack_params; + + MachineType target_type = MachineType::AnyTagged(); + LinkageLocation target_loc = LinkageLocation::ForAnyRegister(target_type); + return new (zone) CallDescriptor( // -- + CallDescriptor::kCallCodeObject, // kind + target_type, // target MachineType + target_loc, // target location + locations.Build(), // location_sig + stack_params, // on-stack parameter count + compiler::Operator::kNoProperties, // properties + 0, // callee-saved registers + 0, // callee-saved fp regs + CallDescriptor::kNoFlags, // flags + "c-call", // debug name + 0, // allocatable registers + stack_returns); // on-stack return count +} + +extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) { + v8_fuzzer::FuzzerSupport* support = v8_fuzzer::FuzzerSupport::Get(); + v8::Isolate* isolate = support->GetIsolate(); + i::Isolate* i_isolate = reinterpret_cast<Isolate*>(isolate); + v8::Isolate::Scope isolate_scope(isolate); + v8::HandleScope handle_scope(isolate); + v8::Context::Scope context_scope(support->GetContext()); + v8::TryCatch try_catch(isolate); + v8::internal::AccountingAllocator allocator; + Zone zone(&allocator, ZONE_NAME); + + InputProvider input(data, size); + // Create randomized descriptor. + size_t param_count = input.NumNonZeroBytes(0, kNumTypes); + size_t return_count = input.NumNonZeroBytes(param_count + 1, kNumTypes); + CallDescriptor* desc = + CreateRandomCallDescriptor(&zone, return_count, param_count, &input); + + if (FLAG_wasm_fuzzer_gen_test) { + // Print some debugging output which describes the produced signature. + printf("["); + for (size_t j = 0; j < desc->ParameterCount(); ++j) { + printf(" %s", + MachineReprToString(desc->GetParameterType(j).representation())); + } + printf(" ] -> ["); + for (size_t j = 0; j < desc->ReturnCount(); ++j) { + printf(" %s", + MachineReprToString(desc->GetReturnType(j).representation())); + } + printf(" ]\n\n"); + } + + // Count parameters of each type. + constexpr size_t kNumMachineRepresentations = + static_cast<size_t>(MachineRepresentation::kLastRepresentation) + 1; + + // Trivial hash table for the number of occurrences of parameter types. The + // MachineRepresentation of the parameter types is used as hash code. + int counts[kNumMachineRepresentations] = {0}; + for (size_t i = 0; i < desc->ParameterCount(); ++i) { + ++counts[index(desc->GetParameterType(i))]; + } + + // Generate random inputs. + std::unique_ptr<int[]> inputs(new int[desc->ParameterCount()]); + std::unique_ptr<int[]> outputs(new int[desc->ReturnCount()]); + for (size_t i = 0; i < desc->ParameterCount(); ++i) { + inputs[i] = input.NextInt32(10000); + } + + RawMachineAssembler callee( + i_isolate, new (&zone) Graph(&zone), desc, + MachineType::PointerRepresentation(), + InstructionSelector::SupportedMachineOperatorFlags()); + + // Generate callee, returning random picks of its parameters. + std::unique_ptr<Node* []> params(new Node*[desc->ParameterCount() + 1]); + std::unique_ptr<Node* []> returns(new Node*[desc->ReturnCount()]); + for (size_t i = 0; i < desc->ParameterCount(); ++i) { + params[i] = callee.Parameter(i); + } + for (size_t i = 0; i < desc->ReturnCount(); ++i) { + MachineType type = desc->GetReturnType(i); + // Find a random same-type parameter to return. Use a constant if none. + if (counts[index(type)] == 0) { + returns[i] = Constant(callee, type, 42); + outputs[i] = 42; + } else { + int n = input.NextInt8(counts[index(type)]); + int k = 0; + while (desc->GetParameterType(k) != desc->GetReturnType(i) || --n > 0) { + ++k; + } + returns[i] = params[k]; + outputs[i] = inputs[k]; + } + } + callee.Return(static_cast<int>(desc->ReturnCount()), returns.get()); + + CompilationInfo info(ArrayVector("testing"), &zone, Code::STUB); + Handle<Code> code = Pipeline::GenerateCodeForTesting( + &info, i_isolate, desc, callee.graph(), callee.Export()); + + // Generate wrapper. + int expect = 0; + + MachineSignature::Builder sig_builder(&zone, 1, 0); + sig_builder.AddReturn(MachineType::Int32()); + + CallDescriptor* wrapper_desc = + Linkage::GetSimplifiedCDescriptor(&zone, sig_builder.Build()); + RawMachineAssembler caller( + i_isolate, new (&zone) Graph(&zone), wrapper_desc, + MachineType::PointerRepresentation(), + InstructionSelector::SupportedMachineOperatorFlags()); + + params[0] = caller.HeapConstant(code); + for (size_t i = 0; i < desc->ParameterCount(); ++i) { + params[i + 1] = Constant(caller, desc->GetParameterType(i), inputs[i]); + } + Node* call = caller.AddNode(caller.common()->Call(desc), + static_cast<int>(desc->ParameterCount() + 1), + params.get()); + Node* ret = Constant(caller, MachineType::Int32(), 0); + for (size_t i = 0; i < desc->ReturnCount(); ++i) { + // Skip roughly one third of the outputs. + if (input.NextInt8(3) == 0) continue; + Node* ret_i = (desc->ReturnCount() == 1) + ? call + : caller.AddNode(caller.common()->Projection(i), call); + ret = caller.Int32Add(ret, ToInt32(caller, desc->GetReturnType(i), ret_i)); + expect += outputs[i]; + } + caller.Return(ret); + + // Call the wrapper. + CompilationInfo wrapper_info(ArrayVector("wrapper"), &zone, Code::STUB); + Handle<Code> wrapper_code = Pipeline::GenerateCodeForTesting( + &wrapper_info, i_isolate, wrapper_desc, caller.graph(), caller.Export()); + auto fn = GeneratedCode<int32_t>::FromCode(*wrapper_code); + int result = fn.Call(); + + CHECK_EQ(expect, result); + return 0; +} + +} // namespace fuzzer +} // namespace compiler +} // namespace internal +} // namespace v8 diff --git a/deps/v8/test/fuzzer/multi_return/README.md b/deps/v8/test/fuzzer/multi_return/README.md new file mode 100644 index 0000000000..a3764e8a7c --- /dev/null +++ b/deps/v8/test/fuzzer/multi_return/README.md @@ -0,0 +1,4 @@ +All files in this directory are used by the trybots to check that the fuzzer +executes correctly, see +https://github.com/v8/v8/blob/master/test/fuzzer/README.md. There should be at +least one file in this directory, e.g. this README file. diff --git a/deps/v8/test/fuzzer/regexp.cc b/deps/v8/test/fuzzer/regexp.cc index c73901b0e0..b652bd7e3f 100644 --- a/deps/v8/test/fuzzer/regexp.cc +++ b/deps/v8/test/fuzzer/regexp.cc @@ -49,7 +49,7 @@ extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) { static const int kAllFlags = i::JSRegExp::kGlobal | i::JSRegExp::kIgnoreCase | i::JSRegExp::kMultiline | i::JSRegExp::kSticky | - i::JSRegExp::kUnicode; + i::JSRegExp::kUnicode | i::JSRegExp::kDotAll; const uint8_t one_byte_array[6] = {'f', 'o', 'o', 'b', 'a', 'r'}; const i::uc16 two_byte_array[6] = {'f', 0xD83D, 0xDCA9, 'b', 'a', 0x2603}; diff --git a/deps/v8/test/fuzzer/testcfg.py b/deps/v8/test/fuzzer/testcfg.py index 17cb0ef588..b3fe174d95 100644 --- a/deps/v8/test/fuzzer/testcfg.py +++ b/deps/v8/test/fuzzer/testcfg.py @@ -8,47 +8,57 @@ from testrunner.local import testsuite from testrunner.objects import testcase -class FuzzerVariantGenerator(testsuite.VariantGenerator): - # Only run the fuzzer with standard variant. - def FilterVariantsByTest(self, testcase): - return self.standard_variant +class VariantsGenerator(testsuite.VariantsGenerator): + def _get_variants(self, test): + return self._standard_variant - def GetFlagSets(self, testcase, variant): - return testsuite.FAST_VARIANT_FLAGS[variant] - -class FuzzerTestSuite(testsuite.TestSuite): - SUB_TESTS = ( 'json', 'parser', 'regexp', 'wasm', 'wasm_async', - 'wasm_call', 'wasm_code', 'wasm_compile', 'wasm_data_section', - 'wasm_function_sigs_section', 'wasm_globals_section', - 'wasm_imports_section', 'wasm_memory_section', 'wasm_names_section', - 'wasm_types_section' ) - - def __init__(self, name, root): - super(FuzzerTestSuite, self).__init__(name, root) +class TestSuite(testsuite.TestSuite): + SUB_TESTS = ( 'json', 'parser', 'regexp', 'multi_return', 'wasm', + 'wasm_async', 'wasm_call', 'wasm_code', 'wasm_compile', + 'wasm_data_section', 'wasm_function_sigs_section', + 'wasm_globals_section', 'wasm_imports_section', 'wasm_memory_section', + 'wasm_names_section', 'wasm_types_section' ) def ListTests(self, context): tests = [] - for subtest in FuzzerTestSuite.SUB_TESTS: + for subtest in TestSuite.SUB_TESTS: for fname in os.listdir(os.path.join(self.root, subtest)): if not os.path.isfile(os.path.join(self.root, subtest, fname)): continue - test = testcase.TestCase(self, '%s/%s' % (subtest, fname)) + test = self._create_test('%s/%s' % (subtest, fname)) tests.append(test) tests.sort() return tests - def GetShellForTestCase(self, testcase): - group, _ = testcase.path.split('/', 1) - return 'v8_simple_%s_fuzzer' % group + def _test_class(self): + return TestCase + + def _variants_gen_class(self): + return VariantsGenerator + + def _LegacyVariantsGeneratorFactory(self): + return testsuite.StandardLegacyVariantsGenerator - def GetParametersForTestCase(self, testcase, context): - suite, name = testcase.path.split('/') - return [os.path.join(self.root, suite, name)], [], {} - def _VariantGeneratorFactory(self): - return FuzzerVariantGenerator +class TestCase(testcase.TestCase): + def _get_files_params(self, ctx): + suite, name = self.path.split('/') + return [os.path.join(self.suite.root, suite, name)] + + def _get_variant_flags(self): + return [] + + def _get_statusfile_flags(self): + return [] + + def _get_mode_flags(self, ctx): + return [] + + def get_shell(self): + group, _ = self.path.split('/', 1) + return 'v8_simple_%s_fuzzer' % group def GetSuite(name, root): - return FuzzerTestSuite(name, root) + return TestSuite(name, root) diff --git a/deps/v8/test/fuzzer/wasm-async.cc b/deps/v8/test/fuzzer/wasm-async.cc index 13b15a9d70..4718601b0f 100644 --- a/deps/v8/test/fuzzer/wasm-async.cc +++ b/deps/v8/test/fuzzer/wasm-async.cc @@ -94,7 +94,7 @@ extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) { Local<Promise> promise = resolver->GetPromise(); AsyncCompile(i_isolate, Utils::OpenHandle(*promise), - ModuleWireBytes(data, data + size)); + ModuleWireBytes(data, data + size), false); ASSIGN(Function, instantiate_impl, Function::New(support->GetContext(), &InstantiateCallback, diff --git a/deps/v8/test/fuzzer/wasm-compile.cc b/deps/v8/test/fuzzer/wasm-compile.cc index ded3a101f2..4192a938e8 100644 --- a/deps/v8/test/fuzzer/wasm-compile.cc +++ b/deps/v8/test/fuzzer/wasm-compile.cc @@ -30,6 +30,8 @@ namespace fuzzer { namespace { +constexpr int kMaxFunctions = 4; + class DataRange { const uint8_t* data_; size_t size_; @@ -37,46 +39,67 @@ class DataRange { public: DataRange(const uint8_t* data, size_t size) : data_(data), size_(size) {} - size_t size() const { return size_; } - - std::pair<DataRange, DataRange> split(uint32_t index) const { - return std::make_pair(DataRange(data_, index), - DataRange(data_ + index, size() - index)); + // Don't accidentally pass DataRange by value. This will reuse bytes and might + // lead to OOM because the end might not be reached. + // Define move constructor and move assignment, disallow copy constructor and + // copy assignment (below). + DataRange(DataRange&& other) : DataRange(other.data_, other.size_) { + other.data_ = nullptr; + other.size_ = 0; + } + DataRange& operator=(DataRange&& other) { + data_ = other.data_; + size_ = other.size_; + other.data_ = nullptr; + other.size_ = 0; + return *this; } - std::pair<DataRange, DataRange> split() { - uint16_t index = get<uint16_t>(); - if (size() > 0) { - index = index % size(); - } else { - index = 0; - } - return split(index); + size_t size() const { return size_; } + + DataRange split() { + uint16_t num_bytes = get<uint16_t>() % std::max(size_t{1}, size_); + DataRange split(data_, num_bytes); + data_ += num_bytes; + size_ -= num_bytes; + return split; } template <typename T> T get() { - if (size() == 0) { - return T(); - } else { - // We want to support the case where we have less than sizeof(T) bytes - // remaining in the slice. For example, if we emit an i32 constant, it's - // okay if we don't have a full four bytes available, we'll just use what - // we have. We aren't concerned about endianness because we are generating - // arbitrary expressions. - const size_t num_bytes = std::min(sizeof(T), size()); - T result = T(); - memcpy(&result, data_, num_bytes); - data_ += num_bytes; - size_ -= num_bytes; - return result; - } + // We want to support the case where we have less than sizeof(T) bytes + // remaining in the slice. For example, if we emit an i32 constant, it's + // okay if we don't have a full four bytes available, we'll just use what + // we have. We aren't concerned about endianness because we are generating + // arbitrary expressions. + const size_t num_bytes = std::min(sizeof(T), size_); + T result = T(); + memcpy(&result, data_, num_bytes); + data_ += num_bytes; + size_ -= num_bytes; + return result; } + + DISALLOW_COPY_AND_ASSIGN(DataRange); }; +ValueType GetValueType(DataRange& data) { + switch (data.get<uint8_t>() % 4) { + case 0: + return kWasmI32; + case 1: + return kWasmI64; + case 2: + return kWasmF32; + case 3: + return kWasmF64; + } + UNREACHABLE(); +} + class WasmGenerator { template <WasmOpcode Op, ValueType... Args> - void op(DataRange data) { + void op(DataRange& data) { Generate<Args...>(data); builder_->Emit(Op); } @@ -101,20 +124,20 @@ class WasmGenerator { }; template <ValueType T> - void block(DataRange data) { + void block(DataRange& data) { BlockScope block_scope(this, kExprBlock, T, T); Generate<T>(data); } template <ValueType T> - void loop(DataRange data) { + void loop(DataRange& data) { // When breaking to a loop header, don't provide any input value (hence // kWasmStmt). BlockScope block_scope(this, kExprLoop, T, kWasmStmt); Generate<T>(data); } - void br(DataRange data) { + void br(DataRange& data) { // There is always at least the block representing the function body. DCHECK(!blocks_.empty()); const uint32_t target_block = data.get<uint32_t>() % blocks_.size(); @@ -161,7 +184,7 @@ class WasmGenerator { } template <WasmOpcode memory_op, ValueType... arg_types> - void memop(DataRange data) { + void memop(DataRange& data) { const uint8_t align = data.get<uint8_t>() % (max_alignment(memory_op) + 1); const uint32_t offset = data.get<uint32_t>(); @@ -173,21 +196,131 @@ class WasmGenerator { builder_->EmitU32V(offset); } + void drop(DataRange& data) { + Generate(GetValueType(data), data); + builder_->Emit(kExprDrop); + } + + template <ValueType wanted_type> + void call(DataRange& data) { + call(data, wanted_type); + } + + void Convert(ValueType src, ValueType dst) { + auto idx = [](ValueType t) -> int { + switch (t) { + case kWasmI32: + return 0; + case kWasmI64: + return 1; + case kWasmF32: + return 2; + case kWasmF64: + return 3; + default: + UNREACHABLE(); + } + }; + static constexpr WasmOpcode kConvertOpcodes[] = { + // {i32, i64, f32, f64} -> i32 + kExprNop, kExprI32ConvertI64, kExprI32SConvertF32, kExprI32SConvertF64, + // {i32, i64, f32, f64} -> i64 + kExprI64SConvertI32, kExprNop, kExprI64SConvertF32, kExprI64SConvertF64, + // {i32, i64, f32, f64} -> f32 + kExprF32SConvertI32, kExprF32SConvertI64, kExprNop, kExprF32ConvertF64, + // {i32, i64, f32, f64} -> f64 + kExprF64SConvertI32, kExprF64SConvertI64, kExprF64ConvertF32, kExprNop}; + int arr_idx = idx(dst) << 2 | idx(src); + builder_->Emit(kConvertOpcodes[arr_idx]); + } + + void call(DataRange& data, ValueType wanted_type) { + int func_index = data.get<uint8_t>() % functions_.size(); + FunctionSig* sig = functions_[func_index]; + // Generate arguments. + for (size_t i = 0; i < sig->parameter_count(); ++i) { + Generate(sig->GetParam(i), data); + } + // Emit call. + builder_->EmitWithU32V(kExprCallFunction, func_index); + // Convert the return value to the wanted type. + ValueType return_type = + sig->return_count() == 0 ? kWasmStmt : sig->GetReturn(0); + if (return_type == kWasmStmt && wanted_type != kWasmStmt) { + // The call did not generate a value. Thus just generate it here. + Generate(wanted_type, data); + } else if (return_type != kWasmStmt && wanted_type == kWasmStmt) { + // The call did generate a value, but we did not want one. + builder_->Emit(kExprDrop); + } else if (return_type != wanted_type) { + // If the returned type does not match the wanted type, convert it. + Convert(return_type, wanted_type); + } + } + + struct Local { + uint32_t index; + ValueType type = kWasmStmt; + Local() = default; + Local(uint32_t index, ValueType type) : index(index), type(type) {} + bool is_valid() const { return type != kWasmStmt; } + }; + + Local GetRandomLocal(DataRange& data) { + uint32_t num_params = + static_cast<uint32_t>(builder_->signature()->parameter_count()); + uint32_t num_locals = static_cast<uint32_t>(locals_.size()); + if (num_params + num_locals == 0) return {}; + uint32_t index = data.get<uint8_t>() % (num_params + num_locals); + ValueType type = index < num_params ? builder_->signature()->GetParam(index) + : locals_[index - num_params]; + return {index, type}; + } + + template <ValueType wanted_type> + void local_op(DataRange& data, WasmOpcode opcode) { + Local local = GetRandomLocal(data); + // If there are no locals and no parameters, just generate any value (if a + // value is needed), or do nothing. + if (!local.is_valid()) { + if (wanted_type == kWasmStmt) return; + return Generate<wanted_type>(data); + } + + if (opcode != kExprGetLocal) Generate(local.type, data); + builder_->EmitWithU32V(opcode, local.index); + if (wanted_type != kWasmStmt && local.type != wanted_type) { + Convert(local.type, wanted_type); + } + } + + template <ValueType wanted_type> + void get_local(DataRange& data) { + local_op<wanted_type>(data, kExprGetLocal); + } + + void set_local(DataRange& data) { local_op<kWasmStmt>(data, kExprSetLocal); } + + template <ValueType wanted_type> + void tee_local(DataRange& data) { + local_op<wanted_type>(data, kExprTeeLocal); + } + template <ValueType T1, ValueType T2> - void sequence(DataRange data) { + void sequence(DataRange& data) { Generate<T1, T2>(data); } - void current_memory(DataRange data) { + void current_memory(DataRange& data) { builder_->EmitWithU8(kExprMemorySize, 0); } - void grow_memory(DataRange data); + void grow_memory(DataRange& data); - using generate_fn = void (WasmGenerator::*const)(DataRange); + using generate_fn = void (WasmGenerator::*const)(DataRange&); template <size_t N> - void GenerateOneOf(generate_fn (&alternates)[N], DataRange data) { + void GenerateOneOf(generate_fn (&alternates)[N], DataRange& data) { static_assert(N < std::numeric_limits<uint8_t>::max(), "Too many alternates. Replace with a bigger type if needed."); const auto which = data.get<uint8_t>(); @@ -209,26 +342,39 @@ class WasmGenerator { }; public: - explicit WasmGenerator(WasmFunctionBuilder* fn) : builder_(fn) { - DCHECK_EQ(1, fn->signature()->return_count()); - blocks_.push_back(fn->signature()->GetReturn(0)); + WasmGenerator(WasmFunctionBuilder* fn, + const std::vector<FunctionSig*>& functions, DataRange& data) + : builder_(fn), functions_(functions) { + FunctionSig* sig = fn->signature(); + DCHECK_GE(1, sig->return_count()); + blocks_.push_back(sig->return_count() == 0 ? kWasmStmt : sig->GetReturn(0)); + + constexpr uint32_t kMaxLocals = 32; + locals_.resize(data.get<uint8_t>() % kMaxLocals); + for (ValueType& local : locals_) { + local = GetValueType(data); + fn->AddLocal(local); + } } - void Generate(ValueType type, DataRange data); + void Generate(ValueType type, DataRange& data); template <ValueType T> - void Generate(DataRange data); + void Generate(DataRange& data); template <ValueType T1, ValueType T2, ValueType... Ts> - void Generate(DataRange data) { - const auto parts = data.split(); - Generate<T1>(parts.first); - Generate<T2, Ts...>(parts.second); + void Generate(DataRange& data) { + // TODO(clemensh): Implement a more even split. + auto first_data = data.split(); + Generate<T1>(first_data); + Generate<T2, Ts...>(data); } private: WasmFunctionBuilder* builder_; std::vector<ValueType> blocks_; + const std::vector<FunctionSig*>& functions_; + std::vector<ValueType> locals_; uint32_t recursion_depth = 0; static constexpr uint32_t kMaxRecursionDepth = 64; @@ -239,7 +385,7 @@ class WasmGenerator { }; template <> -void WasmGenerator::Generate<kWasmStmt>(DataRange data) { +void WasmGenerator::Generate<kWasmStmt>(DataRange& data) { GeneratorRecursionScope rec_scope(this); if (recursion_limit_reached() || data.size() == 0) return; @@ -257,13 +403,18 @@ void WasmGenerator::Generate<kWasmStmt>(DataRange data) { &WasmGenerator::memop<kExprI64StoreMem32, kWasmI64>, &WasmGenerator::memop<kExprF32StoreMem, kWasmF32>, &WasmGenerator::memop<kExprF64StoreMem, kWasmF64>, - }; + + &WasmGenerator::drop, + + &WasmGenerator::call<kWasmStmt>, + + &WasmGenerator::set_local}; GenerateOneOf(alternates, data); } template <> -void WasmGenerator::Generate<kWasmI32>(DataRange data) { +void WasmGenerator::Generate<kWasmI32>(DataRange& data) { GeneratorRecursionScope rec_scope(this); if (recursion_limit_reached() || data.size() <= sizeof(uint32_t)) { builder_->EmitI32Const(data.get<uint32_t>()); @@ -338,13 +489,18 @@ void WasmGenerator::Generate<kWasmI32>(DataRange data) { &WasmGenerator::memop<kExprI32LoadMem16U>, &WasmGenerator::current_memory, - &WasmGenerator::grow_memory}; + &WasmGenerator::grow_memory, + + &WasmGenerator::get_local<kWasmI32>, + &WasmGenerator::tee_local<kWasmI32>, + + &WasmGenerator::call<kWasmI32>}; GenerateOneOf(alternates, data); } template <> -void WasmGenerator::Generate<kWasmI64>(DataRange data) { +void WasmGenerator::Generate<kWasmI64>(DataRange& data) { GeneratorRecursionScope rec_scope(this); if (recursion_limit_reached() || data.size() <= sizeof(uint64_t)) { builder_->EmitI64Const(data.get<int64_t>()); @@ -385,13 +541,18 @@ void WasmGenerator::Generate<kWasmI64>(DataRange data) { &WasmGenerator::memop<kExprI64LoadMem16S>, &WasmGenerator::memop<kExprI64LoadMem16U>, &WasmGenerator::memop<kExprI64LoadMem32S>, - &WasmGenerator::memop<kExprI64LoadMem32U>}; + &WasmGenerator::memop<kExprI64LoadMem32U>, + + &WasmGenerator::get_local<kWasmI64>, + &WasmGenerator::tee_local<kWasmI64>, + + &WasmGenerator::call<kWasmI64>}; GenerateOneOf(alternates, data); } template <> -void WasmGenerator::Generate<kWasmF32>(DataRange data) { +void WasmGenerator::Generate<kWasmF32>(DataRange& data) { GeneratorRecursionScope rec_scope(this); if (recursion_limit_reached() || data.size() <= sizeof(float)) { builder_->EmitF32Const(data.get<float>()); @@ -408,13 +569,18 @@ void WasmGenerator::Generate<kWasmF32>(DataRange data) { &WasmGenerator::block<kWasmF32>, &WasmGenerator::loop<kWasmF32>, - &WasmGenerator::memop<kExprF32LoadMem>}; + &WasmGenerator::memop<kExprF32LoadMem>, + + &WasmGenerator::get_local<kWasmF32>, + &WasmGenerator::tee_local<kWasmF32>, + + &WasmGenerator::call<kWasmF32>}; GenerateOneOf(alternates, data); } template <> -void WasmGenerator::Generate<kWasmF64>(DataRange data) { +void WasmGenerator::Generate<kWasmF64>(DataRange& data) { GeneratorRecursionScope rec_scope(this); if (recursion_limit_reached() || data.size() <= sizeof(double)) { builder_->EmitF64Const(data.get<double>()); @@ -431,17 +597,22 @@ void WasmGenerator::Generate<kWasmF64>(DataRange data) { &WasmGenerator::block<kWasmF64>, &WasmGenerator::loop<kWasmF64>, - &WasmGenerator::memop<kExprF64LoadMem>}; + &WasmGenerator::memop<kExprF64LoadMem>, + + &WasmGenerator::get_local<kWasmF64>, + &WasmGenerator::tee_local<kWasmF64>, + + &WasmGenerator::call<kWasmF64>}; GenerateOneOf(alternates, data); } -void WasmGenerator::grow_memory(DataRange data) { +void WasmGenerator::grow_memory(DataRange& data) { Generate<kWasmI32>(data); builder_->EmitWithU8(kExprGrowMemory, 0); } -void WasmGenerator::Generate(ValueType type, DataRange data) { +void WasmGenerator::Generate(ValueType type, DataRange& data) { switch (type) { case kWasmStmt: return Generate<kWasmStmt>(data); @@ -457,6 +628,19 @@ void WasmGenerator::Generate(ValueType type, DataRange data) { UNREACHABLE(); } } + +FunctionSig* GenerateSig(Zone* zone, DataRange& data) { + // Generate enough parameters to spill some to the stack. + constexpr int kMaxParameters = 15; + int num_params = int{data.get<uint8_t>()} % (kMaxParameters + 1); + bool has_return = data.get<bool>(); + + FunctionSig::Builder builder(zone, has_return ? 1 : 0, num_params); + if (has_return) builder.AddReturn(GetValueType(data)); + for (int i = 0; i < num_params; ++i) builder.AddParam(GetValueType(data)); + return builder.Build(); +} + } // namespace class WasmCompileFuzzer : public WasmExecutionFuzzer { @@ -469,13 +653,32 @@ class WasmCompileFuzzer : public WasmExecutionFuzzer { WasmModuleBuilder builder(zone); - WasmFunctionBuilder* f = builder.AddFunction(sigs.i_iii()); + DataRange range(data, static_cast<uint32_t>(size)); + std::vector<FunctionSig*> function_signatures; + function_signatures.push_back(sigs.i_iii()); + + static_assert(kMaxFunctions >= 1, "need min. 1 function"); + int num_functions = 1 + (range.get<uint8_t>() % kMaxFunctions); + + for (int i = 1; i < num_functions; ++i) { + function_signatures.push_back(GenerateSig(zone, range)); + } - WasmGenerator gen(f); - gen.Generate<kWasmI32>(DataRange(data, static_cast<uint32_t>(size))); + for (int i = 0; i < num_functions; ++i) { + DataRange function_range = + i == num_functions - 1 ? std::move(range) : range.split(); - f->Emit(kExprEnd); - builder.AddExport(CStrVector("main"), f); + FunctionSig* sig = function_signatures[i]; + WasmFunctionBuilder* f = builder.AddFunction(sig); + + WasmGenerator gen(f, function_signatures, function_range); + ValueType return_type = + sig->return_count() == 0 ? kWasmStmt : sig->GetReturn(0); + gen.Generate(return_type, function_range); + + f->Emit(kExprEnd); + if (i == 0) builder.AddExport(CStrVector("main"), f); + } builder.SetMaxMemorySize(32); builder.WriteTo(buffer); @@ -485,8 +688,8 @@ class WasmCompileFuzzer : public WasmExecutionFuzzer { new WasmValue[3]{WasmValue(1), WasmValue(2), WasmValue(3)}); compiler_args.reset(new Handle<Object>[3]{ - handle(Smi::FromInt(1), isolate), handle(Smi::FromInt(1), isolate), - handle(Smi::FromInt(1), isolate)}); + handle(Smi::FromInt(1), isolate), handle(Smi::FromInt(2), isolate), + handle(Smi::FromInt(3), isolate)}); return true; } }; diff --git a/deps/v8/test/fuzzer/wasm-fuzzer-common.cc b/deps/v8/test/fuzzer/wasm-fuzzer-common.cc index 4e6aed1a25..46f5133486 100644 --- a/deps/v8/test/fuzzer/wasm-fuzzer-common.cc +++ b/deps/v8/test/fuzzer/wasm-fuzzer-common.cc @@ -9,6 +9,7 @@ #include "src/objects-inl.h" #include "src/wasm/module-compiler.h" #include "src/wasm/wasm-api.h" +#include "src/wasm/wasm-engine.h" #include "src/wasm/wasm-module-builder.h" #include "src/wasm/wasm-module.h" #include "src/zone/accounting-allocator.h" @@ -89,29 +90,123 @@ void InterpretAndExecuteModule(i::Isolate* isolate, testing::RunWasmModuleForTesting(isolate, instance, 0, nullptr); } +namespace { +struct PrintSig { + const size_t num; + const std::function<ValueType(size_t)> getter; +}; +PrintSig PrintParameters(const FunctionSig* sig) { + return {sig->parameter_count(), [=](size_t i) { return sig->GetParam(i); }}; +} +PrintSig PrintReturns(const FunctionSig* sig) { + return {sig->return_count(), [=](size_t i) { return sig->GetReturn(i); }}; +} +const char* ValueTypeToConstantName(ValueType type) { + switch (type) { + case kWasmI32: + return "kWasmI32"; + case kWasmI64: + return "kWasmI64"; + case kWasmF32: + return "kWasmF32"; + case kWasmF64: + return "kWasmF64"; + default: + UNREACHABLE(); + } +} +std::ostream& operator<<(std::ostream& os, const PrintSig& print) { + os << "["; + for (size_t i = 0; i < print.num; ++i) { + os << (i == 0 ? "" : ", ") << ValueTypeToConstantName(print.getter(i)); + } + return os << "]"; +} + +void GenerateTestCase(Isolate* isolate, ModuleWireBytes wire_bytes, + bool compiles) { + constexpr bool kVerifyFunctions = false; + ModuleResult module_res = + SyncDecodeWasmModule(isolate, wire_bytes.start(), wire_bytes.end(), + kVerifyFunctions, ModuleOrigin::kWasmOrigin); + CHECK(module_res.ok()); + WasmModule* module = module_res.val.get(); + CHECK_NOT_NULL(module); + + OFStream os(stdout); + + os << "// Copyright 2018 the V8 project authors. All rights reserved.\n" + "// Use of this source code is governed by a BSD-style license that " + "can be\n" + "// found in the LICENSE file.\n" + "\n" + "load('test/mjsunit/wasm/wasm-constants.js');\n" + "load('test/mjsunit/wasm/wasm-module-builder.js');\n" + "\n" + "(function() {\n" + " var builder = new WasmModuleBuilder();\n"; + + if (module->has_memory) { + os << " builder.addMemory(" << module->initial_pages; + if (module->has_maximum_pages) { + os << ", " << module->maximum_pages << ");\n"; + } else { + os << ");\n"; + } + } + + Zone tmp_zone(isolate->allocator(), ZONE_NAME); + + for (const WasmFunction& func : module->functions) { + Vector<const uint8_t> func_code = wire_bytes.GetFunctionBytes(&func); + os << " // Generate function " << func.func_index + 1 << " of " + << module->functions.size() << ".\n"; + // Generate signature. + os << " sig" << func.func_index << " = makeSig(" + << PrintParameters(func.sig) << ", " << PrintReturns(func.sig) << ");\n"; + + // Add function. + os << " builder.addFunction(undefined, sig" << func.func_index << ")\n"; + + // Add locals. + BodyLocalDecls decls(&tmp_zone); + DecodeLocalDecls(&decls, func_code.start(), func_code.end()); + if (!decls.type_list.empty()) { + os << " "; + for (size_t pos = 0, count = 1, locals = decls.type_list.size(); + pos < locals; pos += count, count = 1) { + ValueType type = decls.type_list[pos]; + while (pos + count < locals && decls.type_list[pos + count] == type) + ++count; + os << ".addLocals({" << WasmOpcodes::TypeName(type) + << "_count: " << count << "})"; + } + os << "\n"; + } + + // Add body. + os << " .addBodyWithEnd([\n"; + + FunctionBody func_body(func.sig, func.code.offset(), func_code.start(), + func_code.end()); + PrintRawWasmCode(isolate->allocator(), func_body, module, kOmitLocals); + os << " ])"; + if (func.func_index == 0) os << "\n .exportAs('main')"; + os << ";\n "; + } + + if (compiles) { + os << " var module = builder.instantiate();\n" + " module.exports.main(1, 2, 3);\n"; + } else { + os << " assertThrows(function() { builder.instantiate(); });\n"; + } + os << "})();\n"; +} +} // namespace + int WasmExecutionFuzzer::FuzzWasmModule(const uint8_t* data, size_t size, bool require_valid) { - // Save the flag so that we can change it and restore it later. - bool generate_test = FLAG_wasm_code_fuzzer_gen_test; - if (generate_test) { - OFStream os(stdout); - - os << "// Copyright 2017 the V8 project authors. All rights reserved." - << std::endl; - os << "// Use of this source code is governed by a BSD-style license that " - "can be" - << std::endl; - os << "// found in the LICENSE file." << std::endl; - os << std::endl; - os << "load(\"test/mjsunit/wasm/wasm-constants.js\");" << std::endl; - os << "load(\"test/mjsunit/wasm/wasm-module-builder.js\");" << std::endl; - os << std::endl; - os << "(function() {" << std::endl; - os << " var builder = new WasmModuleBuilder();" << std::endl; - os << " builder.addMemory(16, 32, false);" << std::endl; - os << " builder.addFunction(\"test\", kSig_i_iii)" << std::endl; - os << " .addBodyWithEnd([" << std::endl; - } v8_fuzzer::FuzzerSupport* support = v8_fuzzer::FuzzerSupport::Get(); v8::Isolate* isolate = support->GetIsolate(); i::Isolate* i_isolate = reinterpret_cast<Isolate*>(isolate); @@ -148,26 +243,14 @@ int WasmExecutionFuzzer::FuzzWasmModule(const uint8_t* data, size_t size, FlagScope<bool> no_liftoff(&FLAG_liftoff, false); compiled_module = SyncCompile(i_isolate, &interpreter_thrower, wire_bytes); } - // Clear the flag so that the WebAssembly code is not printed twice. - FLAG_wasm_code_fuzzer_gen_test = false; bool compiles = !compiled_module.is_null(); - if (generate_test) { - OFStream os(stdout); - os << " ])" << std::endl - << " .exportFunc();" << std::endl; - if (compiles) { - os << " var module = builder.instantiate();" << std::endl - << " module.exports.test(1, 2, 3);" << std::endl; - } else { - OFStream os(stdout); - os << " assertThrows(function() { builder.instantiate(); });" - << std::endl; - } - os << "})();" << std::endl; + if (FLAG_wasm_fuzzer_gen_test) { + GenerateTestCase(i_isolate, wire_bytes, compiles); } - bool validates = SyncValidate(i_isolate, wire_bytes); + bool validates = + i_isolate->wasm_engine()->SyncValidate(i_isolate, wire_bytes); CHECK_EQ(compiles, validates); CHECK_IMPLIES(require_valid, validates); @@ -198,7 +281,7 @@ int WasmExecutionFuzzer::FuzzWasmModule(const uint8_t* data, size_t size, } bool expect_exception = - result_interpreter == static_cast<int32_t>(0xdeadbeef); + result_interpreter == static_cast<int32_t>(0xDEADBEEF); int32_t result_turbofan; { diff --git a/deps/v8/test/inspector/debugger/async-chains-expected.txt b/deps/v8/test/inspector/debugger/async-chains-expected.txt new file mode 100644 index 0000000000..e5a57fdb61 --- /dev/null +++ b/deps/v8/test/inspector/debugger/async-chains-expected.txt @@ -0,0 +1,152 @@ +Tests different combinations of async stacks in chains. +Regular +userFunction (test.js:1:36) +-- inner async -- +runWithRegular (utils.js:2:12) +inner (test.js:2:28) +runWithNone (utils.js:27:2) +(anonymous) (test.js:3:10) + +Regular - Regular +userFunction (test.js:1:36) +-- inner async -- +runWithRegular (utils.js:2:12) +inner (test.js:2:28) +-- outer async -- +runWithRegular (utils.js:2:12) +(anonymous) (test.js:3:10) + +Regular - EmptyName +userFunction (test.js:1:36) +-- inner async -- +runWithRegular (utils.js:2:12) +inner (test.js:2:28) +-- <empty> -- +runWithEmptyName (utils.js:6:12) +(anonymous) (test.js:3:10) + +Regular - EmptyStack +userFunction (test.js:1:36) +-- inner async -- +runWithRegular (utils.js:2:12) +inner (test.js:2:28) + +Regular - EmptyNameEmptyStack +userFunction (test.js:1:36) +-- inner async -- +runWithRegular (utils.js:2:12) +inner (test.js:2:28) + +Regular - External +userFunction (test.js:1:36) +-- inner async -- +runWithRegular (utils.js:2:12) +inner (test.js:2:28) +runWithRegular (utils.js:21:4) + <external stack> + +EmptyName +userFunction (test.js:1:36) +-- <empty> -- +runWithEmptyName (utils.js:6:12) +inner (test.js:2:28) +runWithNone (utils.js:27:2) +(anonymous) (test.js:3:10) + +EmptyName - Regular +userFunction (test.js:1:36) +-- <empty> -- +runWithEmptyName (utils.js:6:12) +inner (test.js:2:28) +-- outer async -- +runWithRegular (utils.js:2:12) +(anonymous) (test.js:3:10) + +EmptyName - EmptyName +userFunction (test.js:1:36) +-- <empty> -- +runWithEmptyName (utils.js:6:12) +inner (test.js:2:28) +-- <empty> -- +runWithEmptyName (utils.js:6:12) +(anonymous) (test.js:3:10) + +EmptyName - EmptyStack +userFunction (test.js:1:36) +-- <empty> -- +runWithEmptyName (utils.js:6:12) +inner (test.js:2:28) + +EmptyName - EmptyNameEmptyStack +userFunction (test.js:1:36) +-- <empty> -- +runWithEmptyName (utils.js:6:12) +inner (test.js:2:28) + +EmptyName - External +userFunction (test.js:1:36) +-- <empty> -- +runWithEmptyName (utils.js:6:12) +inner (test.js:2:28) +runWithRegular (utils.js:21:4) + <external stack> + +EmptyStack +userFunction (test.js:1:36) + +EmptyStack - Regular +userFunction (test.js:1:36) +-- inner async -- +-- outer async -- +runWithRegular (utils.js:2:12) +(anonymous) (test.js:3:10) + +EmptyStack - EmptyName +userFunction (test.js:1:36) +-- inner async -- +-- <empty> -- +runWithEmptyName (utils.js:6:12) +(anonymous) (test.js:3:10) + +EmptyStack - EmptyStack +userFunction (test.js:1:36) + +EmptyStack - EmptyNameEmptyStack +userFunction (test.js:1:36) + +EmptyStack - External +userFunction (test.js:1:36) +-- inner async -- + <external stack> + +EmptyNameEmptyStack +userFunction (test.js:1:36) + +EmptyNameEmptyStack - Regular +userFunction (test.js:1:36) +-- outer async -- +runWithRegular (utils.js:2:12) +(anonymous) (test.js:3:10) + +EmptyNameEmptyStack - EmptyName +userFunction (test.js:1:36) +-- <empty> -- +runWithEmptyName (utils.js:6:12) +(anonymous) (test.js:3:10) + +EmptyNameEmptyStack - EmptyStack +userFunction (test.js:1:36) + +EmptyNameEmptyStack - EmptyNameEmptyStack +userFunction (test.js:1:36) + +EmptyNameEmptyStack - External +userFunction (test.js:1:36) +-- <empty> -- + <external stack> + +External +userFunction (test.js:1:36) +runWithRegular (utils.js:21:4) + <external stack> + diff --git a/deps/v8/test/inspector/debugger/async-chains.js b/deps/v8/test/inspector/debugger/async-chains.js new file mode 100644 index 0000000000..766003719e --- /dev/null +++ b/deps/v8/test/inspector/debugger/async-chains.js @@ -0,0 +1,77 @@ +// 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( + 'Tests different combinations of async stacks in chains.'); + +contextGroup.addScript(` +function runWithRegular(f, name) { + inspector.scheduleWithAsyncStack(f, name, false); +} + +function runWithEmptyName(f) { + inspector.scheduleWithAsyncStack(f, '', false); +} + +function runWithEmptyStack(f, name) { + inspector.scheduleWithAsyncStack(f, name, true); +} + +function runWithEmptyNameEmptyStack(f) { + inspector.scheduleWithAsyncStack(f, '', true); +} + +function runWithExternal(f) { + const id = inspector.storeCurrentStackTrace('external'); + runWithRegular(() => { + inspector.externalAsyncTaskStarted(id); + f(); + inspector.externalAsyncTaskFinished(id); + }, 'not-used-async'); +} + +function runWithNone(f) { + f(); +} +//# sourceURL=utils.js`); + +session.setupScriptMap(); +(async function test() { + Protocol.Debugger.enable(); + Protocol.Debugger.setAsyncCallStackDepth({maxDepth: 128}); + + const first = ['Regular', 'EmptyName', 'EmptyStack', 'EmptyNameEmptyStack', 'External'] + const second = ['None', 'Regular', 'EmptyName', 'EmptyStack', 'EmptyNameEmptyStack', 'External'] + + for (const stack1 of first) { + for (const stack2 of second) { + if (stack1 === 'External' && stack2 !== 'None') continue; + + InspectorTest.log(stack2 === 'None' ? stack1 : `${stack1} - ${stack2}`); + Protocol.Runtime.evaluate({ + expression: ` + var userFunction = () => {debugger}; + var inner = () => runWith${stack1}(userFunction, 'inner async'); + runWith${stack2}(inner, 'outer async'); + //# sourceURL=test.js` + }); + await pauseAndDumpStack(); + } + } + + await Protocol.Debugger.disable(); + InspectorTest.completeTest(); +})(); + +async function pauseAndDumpStack() { + const {params:{callFrames, asyncStackTrace, asyncStackTraceId}} + = await Protocol.Debugger.oncePaused(); + session.logCallFrames(callFrames); + if (asyncStackTrace) + session.logAsyncStackTrace(asyncStackTrace); + if (asyncStackTraceId) + InspectorTest.log(' <external stack>'); + InspectorTest.log(''); + return Protocol.Debugger.resume(); +} diff --git a/deps/v8/test/inspector/debugger/async-for-await-of-promise-stack.js b/deps/v8/test/inspector/debugger/async-for-await-of-promise-stack.js index 6a2f4ce972..c9df677cbd 100644 --- a/deps/v8/test/inspector/debugger/async-for-await-of-promise-stack.js +++ b/deps/v8/test/inspector/debugger/async-for-await-of-promise-stack.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-async-iteration - let {session, contextGroup, Protocol} = InspectorTest.start('Checks that async chains for for-await-of are correct.'); contextGroup.addScript(` diff --git a/deps/v8/test/inspector/debugger/evaluate-on-call-frame-in-module-expected.txt b/deps/v8/test/inspector/debugger/evaluate-on-call-frame-in-module-expected.txt index e4819bd6d1..d2b36e3489 100644 --- a/deps/v8/test/inspector/debugger/evaluate-on-call-frame-in-module-expected.txt +++ b/deps/v8/test/inspector/debugger/evaluate-on-call-frame-in-module-expected.txt @@ -12,9 +12,8 @@ local:foo1 module [ [0] : a1 = 10 - [1] : g1 = 1 - [2] : b1 = 11 - [3] : foo1 = function foo1() { let c1 = 12; let g1 = 2; debugger; return a1 + b1 + c1 + g1; } + [1] : b1 = 11 + [2] : foo1 = function foo1() { let c1 = 12; let g1 = 2; debugger; return a1 + b1 + c1 + g1; } ] global [ @@ -180,9 +179,8 @@ foo2 = } module [ - [0] : a3 = 30 - [1] : foo2 = function foo2() { let c2 = 22; return foo1() + a2 + b2 + c2; } - [2] : b3 = 31 + [0] : foo2 = function foo2() { let c2 = 22; return foo1() + a2 + b2 + c2; } + [1] : b3 = 31 ] global [ @@ -200,20 +198,6 @@ Array = objectId : <objectId> type : function } -a3 = -{ - description : 30 - type : number - value : 30 -} -Evaluating: ++a3 -updated a3 = -{ - description : 31 - type : number - value : 31 -} -Evaluating: --a3 foo2 = { className : Function @@ -247,12 +231,6 @@ closure:bar [ [0] : a = 0 ] -module -[ - [0] : a = 1 - [1] : b = 2 - [2] : bar = function bar() { let a = 0; (() => {a; debugger;})(); } -] global [ ... @@ -283,37 +261,10 @@ updated a = value : 1 } Evaluating: --a -b = -{ - description : 2 - type : number - value : 2 -} -Evaluating: ++b -updated b = -{ - description : 3 - type : number - value : 3 -} -Evaluating: --b -bar = -{ - className : Function - description : function bar() { let a = 0; (() => {a; debugger;})(); } - objectId : <objectId> - type : function -} local:bar [ [0] : a = 0 ] -module -[ - [0] : a = 1 - [1] : b = 2 - [2] : bar = function bar() { let a = 0; (() => {a; debugger;})(); } -] global [ ... @@ -344,33 +295,6 @@ updated a = value : 1 } Evaluating: --a -b = -{ - description : 2 - type : number - value : 2 -} -Evaluating: ++b -updated b = -{ - description : 3 - type : number - value : 3 -} -Evaluating: --b -bar = -{ - className : Function - description : function bar() { let a = 0; (() => {a; debugger;})(); } - objectId : <objectId> - type : function -} -module -[ - [0] : a = 1 - [1] : b = 2 - [2] : bar = function bar() { let a = 0; (() => {a; debugger;})(); } -] global [ ... @@ -386,41 +310,6 @@ Array = objectId : <objectId> type : function } -a = -{ - description : 1 - type : number - value : 1 -} -Evaluating: ++a -updated a = -{ - description : 2 - type : number - value : 2 -} -Evaluating: --a -b = -{ - description : 2 - type : number - value : 2 -} -Evaluating: ++b -updated b = -{ - description : 3 - type : number - value : 3 -} -Evaluating: --b -bar = -{ - className : Function - description : function bar() { let a = 0; (() => {a; debugger;})(); } - objectId : <objectId> - type : function -} Running test: testDifferentModuleVariables (anonymous) (module5:5:0) @@ -503,3 +392,112 @@ updated c = value : 1 } Evaluating: --c + +Running test: testCapturedLocalVariable +(anonymous) (module6:2:25) +(anonymous) (module6:2:37) +local +[ + [0] : y = 5 +] +module +[ + [0] : x = 5 +] +global +[ + ... +] +Check variables in frame#0 +let x = 5; +(function() { let y = x; #debugger; })() + + +Array = +{ + className : Function + description : function Array() { [native code] } + objectId : <objectId> + type : function +} +y = +{ + description : 5 + type : number + value : 5 +} +Evaluating: ++y +updated y = +{ + description : 6 + type : number + value : 6 +} +Evaluating: --y +x = +{ + description : 5 + type : number + value : 5 +} +Evaluating: ++x +updated x = +{ + description : 6 + type : number + value : 6 +} +Evaluating: --x +module +[ + [0] : x = 5 +] +global +[ + ... +] +Check variables in frame#1 +let x = 5; +(function() { let y = x; debugger; })#() + + +Array = +{ + className : Function + description : function Array() { [native code] } + objectId : <objectId> + type : function +} +x = +{ + description : 5 + type : number + value : 5 +} +Evaluating: ++x +updated x = +{ + description : 6 + type : number + value : 6 +} +Evaluating: --x + +Running test: testLocalVariableToplevel +(anonymous) (module7:2:0) +global +[ + ... +] +Check variables in frame#0 +let x = 5; +#debugger; + + +Array = +{ + className : Function + description : function Array() { [native code] } + objectId : <objectId> + type : function +} diff --git a/deps/v8/test/inspector/debugger/evaluate-on-call-frame-in-module.js b/deps/v8/test/inspector/debugger/evaluate-on-call-frame-in-module.js index ef9050ec48..e656646cda 100644 --- a/deps/v8/test/inspector/debugger/evaluate-on-call-frame-in-module.js +++ b/deps/v8/test/inspector/debugger/evaluate-on-call-frame-in-module.js @@ -49,6 +49,16 @@ export var c = 0; debugger; `; +var module6 = ` +let x = 5; +(function() { let y = x; debugger; })() +`; + +var module7 = ` +let x = 5; +debugger; +`; + InspectorTest.runAsyncTestSuite([ async function testTotal() { session.setupScriptMap(); @@ -82,6 +92,26 @@ InspectorTest.runAsyncTestSuite([ await checkFrame(callFrames[i], i); } await Protocol.Debugger.resume(); + }, + + async function testCapturedLocalVariable() { + contextGroup.addModule(module6, 'module6'); + let {params:{callFrames}} = (await Protocol.Debugger.oncePaused()); + session.logCallFrames(callFrames); + for (let i = 0; i < callFrames.length; ++i) { + await checkFrame(callFrames[i], i); + } + await Protocol.Debugger.resume(); + }, + + async function testLocalVariableToplevel() { + contextGroup.addModule(module7, 'module7'); + let {params:{callFrames}} = (await Protocol.Debugger.oncePaused()); + session.logCallFrames(callFrames); + for (let i = 0; i < callFrames.length; ++i) { + await checkFrame(callFrames[i], i); + } + await Protocol.Debugger.resume(); } ]); diff --git a/deps/v8/test/inspector/debugger/external-stack-trace.js b/deps/v8/test/inspector/debugger/external-stack-trace.js index c8392e28c7..0b5c084e02 100644 --- a/deps/v8/test/inspector/debugger/external-stack-trace.js +++ b/deps/v8/test/inspector/debugger/external-stack-trace.js @@ -119,7 +119,6 @@ InspectorTest.runAsyncTestSuite([ }, async function testExternalStacks() { - let debuggerId1 = (await Protocol1.Debugger.enable()).result.debuggerId; let debuggerId2 = (await Protocol2.Debugger.enable()).result.debuggerId; Protocol1.Debugger.setAsyncCallStackDepth({maxDepth: 32}); diff --git a/deps/v8/test/inspector/debugger/for-of-loops-expected.txt b/deps/v8/test/inspector/debugger/for-of-loops-expected.txt index 6d23c941cb..bc1bc5ad6a 100644 --- a/deps/v8/test/inspector/debugger/for-of-loops-expected.txt +++ b/deps/v8/test/inspector/debugger/for-of-loops-expected.txt @@ -9,10 +9,10 @@ function testFunction() { var arr = |_|[1]; var all = |_|[]; for (var |_|k in |_|arr) { all.|C|push(k); } - for (var |_|k of |_|arr) { all.|C|push(k); } + for (var |C|k of |_|arr) { all.|C|push(k); } for (var |_|k in |_|obj) { all.|C|push(k); } for (let |_|k in |_|arr) { all.|C|push(k); } - for (let |_|k of |_|arr) { all.|C|push(k); } + for (let |C|k of |_|arr) { all.|C|push(k); } for (let |_|k in |_|obj) { all.|C|push(k); } var iterable = |_|{ @@ -28,9 +28,9 @@ function testFunction() { };|R| } }; - for (var |_|k of |_|iterable) { all.|C|push(k); } + for (var |C|k of |_|iterable) { all.|C|push(k); } |_|iterable.i = 0; - for (let |_|k of |_|iterable) { all.|C|push(k); } + for (let |C|k of |_|iterable) { all.|C|push(k); } |R|} (anonymous) (expr.js:0:0) diff --git a/deps/v8/test/inspector/debugger/get-possible-breakpoints-master-expected.txt b/deps/v8/test/inspector/debugger/get-possible-breakpoints-master-expected.txt index 7ea0920182..c304fe677b 100644 --- a/deps/v8/test/inspector/debugger/get-possible-breakpoints-master-expected.txt +++ b/deps/v8/test/inspector/debugger/get-possible-breakpoints-master-expected.txt @@ -95,10 +95,10 @@ function testForLoop() { |R|} function testForOfLoop() { - for (var |_|k of |_|[]) {} - for (var |_|k of |_|[1]) |_|k; + for (var |C|k of |_|[]) {} + for (var |C|k of |_|[1]) |_|k; var a = |_|[]; - for (var |_|k of |_|a) {} + for (var |C|k of |_|a) {} |R|} function testForInLoop() { @@ -116,7 +116,7 @@ function testSimpleExpressions() { |_|a--; |R|} -Object.defineProperty(this, 'getterFoo', { +|_|Object.|C|defineProperty(this, 'getterFoo', { get: () => |_|return42|R| }); @@ -124,7 +124,7 @@ function testGetter() { |C|getterFoo(); |R|} -var obj = { +var obj = |_|{ foo: () => (|_|{ boo: () => |_|return42|R| })|R| @@ -260,7 +260,7 @@ async function testPromiseComplex() { |R|} function twiceDefined() { - return a + b; + |_|return a + b;|R| } function twiceDefined() { diff --git a/deps/v8/test/inspector/debugger/pause-on-async-call-expected.txt b/deps/v8/test/inspector/debugger/pause-on-async-call-expected.txt index a835810e7a..709eea895a 100644 --- a/deps/v8/test/inspector/debugger/pause-on-async-call-expected.txt +++ b/deps/v8/test/inspector/debugger/pause-on-async-call-expected.txt @@ -206,3 +206,81 @@ paused at: createPromise().then(#v => v * 2); } + +Running test: testWithBlackboxedCode +paused at: +function testBlackboxedCreatePromise() { + #debugger; + createPromise().then(v => v * 2); + +paused at: + debugger; + #createPromise().then(v => v * 2); +} + +paused at: + debugger; + createPromise().#then(v => v * 2); +} + +asyncCallStackTraceId is set + +paused at: + debugger; + createPromise().then(#v => v * 2); +} + + +Running test: testAsyncFunction +paused at: +async function testAsyncFunction() { + #debugger; + foo(); + +paused at: + debugger; + #foo(); + await foo(); + +paused at: + async function foo() { + #return 42; + } + +paused at: + foo(); + await #foo(); + foo().then(boo); + +paused at: + async function foo() { + #return 42; + } + +paused at: + await foo(); + #foo().then(boo); + + +paused at: + async function foo() { + #return 42; + } + +paused at: + await foo(); + foo().#then(boo); + + +paused at: + await foo(); + foo().#then(boo); + + +asyncCallStackTraceId is set + +paused at: + + function boo#() { + } + diff --git a/deps/v8/test/inspector/debugger/pause-on-async-call.js b/deps/v8/test/inspector/debugger/pause-on-async-call.js index ef29905849..7245824f66 100644 --- a/deps/v8/test/inspector/debugger/pause-on-async-call.js +++ b/deps/v8/test/inspector/debugger/pause-on-async-call.js @@ -45,6 +45,20 @@ function testBlackboxedCreatePromise() { debugger; createPromise().then(v => v * 2); } + +async function testAsyncFunction() { + debugger; + foo(); + await foo(); + foo().then(boo); + + async function foo() { + return 42; + } + + function boo() { + } +} //# sourceURL=test.js`); contextGroup.addScript(` @@ -168,6 +182,52 @@ InspectorTest.runAsyncTestSuite([ Protocol.Debugger.resume(); await waitPauseAndDumpLocation(); await Protocol.Debugger.resume(); + }, + + async function testWithBlackboxedCode() { + Protocol.Runtime.evaluate({expression: 'testBlackboxedCreatePromise()'}); + await waitPauseAndDumpLocation(); + Protocol.Debugger.stepOver(); + await waitPauseAndDumpLocation(); + await Protocol.Debugger.setBlackboxPatterns({patterns: ['framework\.js']}); + Protocol.Debugger.stepInto({breakOnAsyncCall: true}); + let parentStackTraceId = await waitPauseAndDumpLocation(); + Protocol.Debugger.pauseOnAsyncCall({parentStackTraceId}); + Protocol.Debugger.resume(); + await waitPauseAndDumpLocation(); + await Protocol.Debugger.resume(); + }, + + async function testAsyncFunction() { + Protocol.Runtime.evaluate({expression: 'testAsyncFunction()'}); + await waitPauseAndDumpLocation(); + Protocol.Debugger.stepOver(); + await waitPauseAndDumpLocation(); + Protocol.Debugger.stepInto({breakOnAsyncCall: true}); + let parentStackTraceId = await waitPauseAndDumpLocation(); + if (parentStackTraceId) + InspectorTest.log( + 'ERROR: we should not report parent stack trace id on async call'); + Protocol.Debugger.stepOut(); + await waitPauseAndDumpLocation(); + Protocol.Debugger.stepInto({breakOnAsyncCall: true}); + parentStackTraceId = await waitPauseAndDumpLocation(); + if (parentStackTraceId) + InspectorTest.log( + 'ERROR: we should not report parent stack trace id on async call'); + Protocol.Debugger.stepOut(); + await waitPauseAndDumpLocation(); + Protocol.Debugger.stepInto({breakOnAsyncCall: true}); + await waitPauseAndDumpLocation(); + Protocol.Debugger.stepOut(); + await waitPauseAndDumpLocation(); + Protocol.Debugger.stepInto({breakOnAsyncCall: true}); + parentStackTraceId = await waitPauseAndDumpLocation(); + Protocol.Debugger.pauseOnAsyncCall({parentStackTraceId}); + Protocol.Debugger.resume(); + await waitPauseAndDumpLocation(); + + await Protocol.Debugger.resume(); } ]); diff --git a/deps/v8/test/inspector/debugger/return-break-locations-expected.txt b/deps/v8/test/inspector/debugger/return-break-locations-expected.txt index 688faf89c3..4b7d4872a6 100644 --- a/deps/v8/test/inspector/debugger/return-break-locations-expected.txt +++ b/deps/v8/test/inspector/debugger/return-break-locations-expected.txt @@ -26,4 +26,10 @@ Running test: testTailCall scriptId : <scriptId> type : return } + [4] : { + columnNumber : 1 + lineNumber : 6 + scriptId : <scriptId> + type : return + } ] diff --git a/deps/v8/test/inspector/debugger/set-breakpoint-ignore-hint-when-no-location-expected.txt b/deps/v8/test/inspector/debugger/set-breakpoint-ignore-hint-when-no-location-expected.txt new file mode 100644 index 0000000000..ad51391e13 --- /dev/null +++ b/deps/v8/test/inspector/debugger/set-breakpoint-ignore-hint-when-no-location-expected.txt @@ -0,0 +1,11 @@ +Tests breakpoint when two scripts have the same url. +{ + breakpointId : <breakpointId> + locations : [ + [0] : { + columnNumber : 2 + lineNumber : 2 + scriptId : <scriptId> + } + ] +} diff --git a/deps/v8/test/inspector/debugger/set-breakpoint-ignore-hint-when-no-location.js b/deps/v8/test/inspector/debugger/set-breakpoint-ignore-hint-when-no-location.js new file mode 100644 index 0000000000..d72d31b799 --- /dev/null +++ b/deps/v8/test/inspector/debugger/set-breakpoint-ignore-hint-when-no-location.js @@ -0,0 +1,27 @@ +// 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( + 'Tests breakpoint when two scripts have the same url.'); + +// Order of addScript is important! +contextGroup.addScript(` +function boo() { + return 42; +} +function foo() {} +`, 0, 0, 'test.js'); + +contextGroup.addScript(`function foo() {}`, 15, 0, 'test.js'); + +(async function test() { + await Protocol.Debugger.enable(); + let {result} = await Protocol.Debugger.setBreakpointByUrl({ + url: 'test.js', + lineNumber: 2, + columnNumber: 2 + }); + InspectorTest.logMessage(result); + InspectorTest.completeTest(); +})(); diff --git a/deps/v8/test/inspector/debugger/step-into-external-async-task-same-context-expected.txt b/deps/v8/test/inspector/debugger/step-into-external-async-task-same-context-expected.txt new file mode 100644 index 0000000000..e6ab816810 --- /dev/null +++ b/deps/v8/test/inspector/debugger/step-into-external-async-task-same-context-expected.txt @@ -0,0 +1,14 @@ +Test for step-into remote async task. +Setup debugger agents.. +Pause before stack trace is captured.. +Run stepInto with breakOnAsyncCall flag +Call pauseOnAsyncCall +Trigger external async task on another context group +Dump stack trace +boo (target.js:1:18) +call (framework.js:3:2) +(anonymous) (target.js:0:0) +-- remote-task -- +store (utils.js:2:25) +foo (source.js:1:13) +(anonymous) (source.js:2:6) diff --git a/deps/v8/test/inspector/debugger/step-into-external-async-task-same-context.js b/deps/v8/test/inspector/debugger/step-into-external-async-task-same-context.js new file mode 100644 index 0000000000..fec786422e --- /dev/null +++ b/deps/v8/test/inspector/debugger/step-into-external-async-task-same-context.js @@ -0,0 +1,81 @@ +// 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('Test for step-into remote async task.'); + +contextGroup.addScript(` +function store(description) { + let buffer = inspector.storeCurrentStackTrace(description); + return '[' + new Int32Array(buffer).join(',') + ']'; +} +//# sourceURL=utils.js`); + +contextGroup.addScript(` +function call(id, f) { + inspector.externalAsyncTaskStarted(Int32Array.from(JSON.parse(id)).buffer); + f(); + inspector.externalAsyncTaskFinished(Int32Array.from(JSON.parse(id)).buffer); +} +//# sourceURL=framework.js`); + +session.setupScriptMap(); + +(async function test() { + InspectorTest.log('Setup debugger agents..'); + let debuggerId = (await Protocol.Debugger.enable()).result.debuggerId; + + Protocol.Debugger.setAsyncCallStackDepth({maxDepth: 128}); + Protocol.Debugger.setBlackboxPatterns({patterns: ['framework\.js']}); + + InspectorTest.log('Pause before stack trace is captured..'); + Protocol.Debugger.setBreakpointByUrl( + {lineNumber: 2, columnNumber: 25, url: 'utils.js'}); + let evaluatePromise = Protocol.Runtime.evaluate({ + expression: `(function foo() { + return store('remote-task'); + })() + //# sourceURL=source.js` + }); + await Protocol.Debugger.oncePaused(); + + InspectorTest.log('Run stepInto with breakOnAsyncCall flag'); + Protocol.Debugger.stepInto({breakOnAsyncCall: true}); + let {params: {asyncCallStackTraceId}} = await Protocol.Debugger.oncePaused(); + + InspectorTest.log('Call pauseOnAsyncCall'); + Protocol.Debugger.pauseOnAsyncCall({ + parentStackTraceId: asyncCallStackTraceId, + }); + Protocol.Debugger.resume(); + + InspectorTest.log('Trigger external async task on another context group'); + let stackTraceId = (await evaluatePromise).result.result.value; + Protocol.Runtime.evaluate({ + expression: `call('${stackTraceId}', + function boo() {}) + //# sourceURL=target.js` + }); + + InspectorTest.log('Dump stack trace'); + let {params: {callFrames, asyncStackTraceId}} = + await Protocol.Debugger.oncePaused(); + while (true) { + session.logCallFrames(callFrames); + if (asyncStackTraceId) { + let {result: {stackTrace}} = await Protocol.Debugger.getStackTrace( + {stackTraceId: asyncStackTraceId}); + InspectorTest.log(`-- ${stackTrace.description} --`); + callFrames = stackTrace.callFrames; + asyncStackTraceId = stackTrace.parentId; + } else { + break; + } + } + + Protocol.Debugger.setAsyncCallStackDepth({maxDepth: 0}); + await Protocol.Debugger.disable(); + + InspectorTest.completeTest(); +})() diff --git a/deps/v8/test/inspector/debugger/wasm-scripts-expected.txt b/deps/v8/test/inspector/debugger/wasm-scripts-expected.txt index 5d23605566..0afcc861c4 100644 --- a/deps/v8/test/inspector/debugger/wasm-scripts-expected.txt +++ b/deps/v8/test/inspector/debugger/wasm-scripts-expected.txt @@ -1,9 +1,10 @@ Tests how wasm scripts are reported Check that inspector gets two wasm scripts at module creation time. Script #0 parsed. URL: v8://test/testFunction -Script #1 parsed. URL: v8://test/runTestRunction -Script #2 parsed. URL: wasm://wasm/wasm-7b04570e/wasm-7b04570e-0 -Script #3 parsed. URL: wasm://wasm/wasm-7b04570e/wasm-7b04570e-1 +Script #1 parsed. URL: +Script #2 parsed. URL: v8://test/runTestRunction +Script #3 parsed. URL: wasm://wasm/wasm-7b04570e/wasm-7b04570e-0 +Script #4 parsed. URL: wasm://wasm/wasm-7b04570e/wasm-7b04570e-1 Source for wasm://wasm/wasm-7b04570e/wasm-7b04570e-0: func $nopFunction nop diff --git a/deps/v8/test/inspector/inspector-test.cc b/deps/v8/test/inspector/inspector-test.cc index 56c7431af6..04a23df528 100644 --- a/deps/v8/test/inspector/inspector-test.cc +++ b/deps/v8/test/inspector/inspector-test.cc @@ -175,7 +175,8 @@ class SendMessageToBackendTask : public TaskRunner::Task { v8::internal::Vector<uint16_t> message_; }; -void RunAsyncTask(TaskRunner* task_runner, const char* task_name, +void RunAsyncTask(TaskRunner* task_runner, + const v8_inspector::StringView& task_name, TaskRunner::Task* task) { class AsyncTask : public TaskRunner::Task { public: @@ -193,10 +194,7 @@ void RunAsyncTask(TaskRunner* task_runner, const char* task_name, DISALLOW_COPY_AND_ASSIGN(AsyncTask); }; - task_runner->data()->AsyncTaskScheduled( - v8_inspector::StringView(reinterpret_cast<const uint8_t*>(task_name), - strlen(task_name)), - task, false); + task_runner->data()->AsyncTaskScheduled(task_name, task, false); task_runner->Append(new AsyncTask(task)); } @@ -626,13 +624,16 @@ class SetTimeoutExtension : public IsolateData::SetupGlobalTask { v8::Local<v8::Context> context = isolate->GetCurrentContext(); IsolateData* data = IsolateData::FromContext(context); int context_group_id = data->GetContextGroupId(context); + const char* task_name = "setTimeout"; + v8_inspector::StringView task_name_view( + reinterpret_cast<const uint8_t*>(task_name), strlen(task_name)); if (args[0]->IsFunction()) { - RunAsyncTask(data->task_runner(), "setTimeout", + RunAsyncTask(data->task_runner(), task_name_view, new SetTimeoutTask(context_group_id, isolate, v8::Local<v8::Function>::Cast(args[0]))); } else { RunAsyncTask( - data->task_runner(), "setTimeout", + data->task_runner(), task_name_view, new ExecuteStringTask( context_group_id, ToVector(args[0].As<v8::String>()), v8::String::Empty(isolate), v8::Integer::New(isolate, 0), @@ -703,6 +704,9 @@ class InspectorExtension : public IsolateData::SetupGlobalTask { ToV8String(isolate, "externalAsyncTaskFinished"), v8::FunctionTemplate::New( isolate, &InspectorExtension::ExternalAsyncTaskFinished)); + inspector->Set(ToV8String(isolate, "scheduleWithAsyncStack"), + v8::FunctionTemplate::New( + isolate, &InspectorExtension::ScheduleWithAsyncStack)); global->Set(ToV8String(isolate, "inspector"), inspector); } @@ -926,6 +930,33 @@ class InspectorExtension : public IsolateData::SetupGlobalTask { args[0].As<v8::ArrayBuffer>()->GetContents().Data()); data->ExternalAsyncTaskFinished(*id); } + + static void ScheduleWithAsyncStack( + const v8::FunctionCallbackInfo<v8::Value>& args) { + if (args.Length() != 3 || !args[0]->IsFunction() || !args[1]->IsString() || + !args[2]->IsBoolean()) { + fprintf(stderr, + "Internal error: scheduleWithAsyncStack(function, " + "'task-name', with_empty_stack)."); + Exit(); + } + v8::Isolate* isolate = args.GetIsolate(); + v8::Local<v8::Context> context = isolate->GetCurrentContext(); + IsolateData* data = IsolateData::FromContext(context); + int context_group_id = data->GetContextGroupId(context); + bool with_empty_stack = args[2].As<v8::Boolean>()->Value(); + if (with_empty_stack) context->Exit(); + + v8::internal::Vector<uint16_t> task_name = + ToVector(args[1].As<v8::String>()); + v8_inspector::StringView task_name_view(task_name.start(), + task_name.length()); + + RunAsyncTask(data->task_runner(), task_name_view, + new SetTimeoutTask(context_group_id, isolate, + v8::Local<v8::Function>::Cast(args[0]))); + if (with_empty_stack) context->Enter(); + } }; } // namespace diff --git a/deps/v8/test/inspector/protocol-test.js b/deps/v8/test/inspector/protocol-test.js index 749aa3fecc..91f55e442a 100644 --- a/deps/v8/test/inspector/protocol-test.js +++ b/deps/v8/test/inspector/protocol-test.js @@ -301,13 +301,9 @@ InspectorTest.Session = class { logAsyncStackTrace(asyncStackTrace) { while (asyncStackTrace) { - if (asyncStackTrace.promiseCreationFrame) { - var frame = asyncStackTrace.promiseCreationFrame; - InspectorTest.log(`-- ${asyncStackTrace.description} (${frame.url}:${frame.lineNumber}:${frame.columnNumber})--`); - } else { - InspectorTest.log(`-- ${asyncStackTrace.description} --`); - } + InspectorTest.log(`-- ${asyncStackTrace.description || '<empty>'} --`); this.logCallFrames(asyncStackTrace.callFrames); + if (asyncStackTrace.parentId) InspectorTest.log(' <external stack>'); asyncStackTrace = asyncStackTrace.parent; } } diff --git a/deps/v8/test/inspector/runtime/console-methods-expected.txt b/deps/v8/test/inspector/runtime/console-methods-expected.txt index 81c3c76813..fea4ca69e0 100644 --- a/deps/v8/test/inspector/runtime/console-methods-expected.txt +++ b/deps/v8/test/inspector/runtime/console-methods-expected.txt @@ -653,7 +653,7 @@ Checks console methods args : [ [0] : { type : string - value : 1 + value : default: 1 } ] executionContextId : <executionContextId> @@ -692,7 +692,7 @@ Checks console methods args : [ [0] : { type : string - value : 2 + value : default: 2 } ] executionContextId : <executionContextId> @@ -725,3 +725,99 @@ Checks console methods type : count } } +{ + method : Runtime.consoleAPICalled + params : { + args : [ + [0] : { + type : string + value : default: 3 + } + ] + executionContextId : <executionContextId> + stackTrace : { + callFrames : [ + [0] : { + columnNumber : 10 + functionName : testFunction + lineNumber : 31 + scriptId : <scriptId> + url : test.js + } + [1] : { + columnNumber : 0 + functionName : + lineNumber : 0 + scriptId : <scriptId> + url : + } + ] + } + timestamp : <timestamp> + type : count + } +} +{ + method : Runtime.consoleAPICalled + params : { + args : [ + [0] : { + type : string + value : default: 4 + } + ] + executionContextId : <executionContextId> + stackTrace : { + callFrames : [ + [0] : { + columnNumber : 10 + functionName : testFunction + lineNumber : 32 + scriptId : <scriptId> + url : test.js + } + [1] : { + columnNumber : 0 + functionName : + lineNumber : 0 + scriptId : <scriptId> + url : + } + ] + } + timestamp : <timestamp> + type : count + } +} +{ + method : Runtime.consoleAPICalled + params : { + args : [ + [0] : { + type : string + value : default: 5 + } + ] + executionContextId : <executionContextId> + stackTrace : { + callFrames : [ + [0] : { + columnNumber : 10 + functionName : testFunction + lineNumber : 33 + scriptId : <scriptId> + url : test.js + } + [1] : { + columnNumber : 0 + functionName : + lineNumber : 0 + scriptId : <scriptId> + url : + } + ] + } + timestamp : <timestamp> + type : count + } +} diff --git a/deps/v8/test/inspector/runtime/console-methods.js b/deps/v8/test/inspector/runtime/console-methods.js index c9e0e1d89b..f2919a6bae 100644 --- a/deps/v8/test/inspector/runtime/console-methods.js +++ b/deps/v8/test/inspector/runtime/console-methods.js @@ -29,6 +29,9 @@ function testFunction() { } foo(); foo(); + console.count(); + console.count(undefined); + console.count('default'); } //# sourceURL=test.js`, 7, 26); diff --git a/deps/v8/test/inspector/runtime/console-time-repeat-expected.txt b/deps/v8/test/inspector/runtime/console-time-repeat-expected.txt new file mode 100644 index 0000000000..b675532adb --- /dev/null +++ b/deps/v8/test/inspector/runtime/console-time-repeat-expected.txt @@ -0,0 +1,76 @@ +Checks that repeated console.time do not reset +{ + method : Runtime.consoleAPICalled + params : { + args : [ + [0] : { + type : string + value : Timer 'a' already exists + } + ] + executionContextId : <executionContextId> + stackTrace : { + callFrames : [ + [0] : { + columnNumber : 8 + functionName : + lineNumber : 0 + scriptId : <scriptId> + url : + } + ] + } + timestamp : <timestamp> + type : warning + } +} +{ + method : Runtime.consoleAPICalled + params : { + args : [ + [0] : { + type : string + value : a: 2ms + } + ] + executionContextId : <executionContextId> + stackTrace : { + callFrames : [ + [0] : { + columnNumber : 8 + functionName : + lineNumber : 0 + scriptId : <scriptId> + url : + } + ] + } + timestamp : <timestamp> + type : timeEnd + } +} +{ + method : Runtime.consoleAPICalled + params : { + args : [ + [0] : { + type : string + value : Timer 'a' does not exist + } + ] + executionContextId : <executionContextId> + stackTrace : { + callFrames : [ + [0] : { + columnNumber : 8 + functionName : + lineNumber : 0 + scriptId : <scriptId> + url : + } + ] + } + timestamp : <timestamp> + type : warning + } +} diff --git a/deps/v8/test/inspector/runtime/console-time-repeat.js b/deps/v8/test/inspector/runtime/console-time-repeat.js new file mode 100644 index 0000000000..f9a5f6ddf8 --- /dev/null +++ b/deps/v8/test/inspector/runtime/console-time-repeat.js @@ -0,0 +1,20 @@ +// 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 repeated console.time do not reset'); + +Protocol.Runtime.onConsoleAPICalled(InspectorTest.logMessage); +Protocol.Runtime.enable(); +(async function() { + utils.setCurrentTimeMSForTest(0.0); + await Protocol.Runtime.evaluate({expression: `console.time('a')`}); + utils.setCurrentTimeMSForTest(1.0); + await Protocol.Runtime.evaluate({expression: `console.time('a')`}); + utils.setCurrentTimeMSForTest(2.0); + await Protocol.Runtime.evaluate({expression: `console.timeEnd('a')`}); + utils.setCurrentTimeMSForTest(5.0); + await Protocol.Runtime.evaluate({expression: `console.timeEnd('a')`}); + + InspectorTest.completeTest(); +})(); diff --git a/deps/v8/test/inspector/runtime/evaluate-async-expected.txt b/deps/v8/test/inspector/runtime/evaluate-async-expected.txt index 763b4295c7..ea47520ef8 100644 --- a/deps/v8/test/inspector/runtime/evaluate-async-expected.txt +++ b/deps/v8/test/inspector/runtime/evaluate-async-expected.txt @@ -43,7 +43,7 @@ Running test: testRejectedPromiseWithError columnNumber : 11 exception : { className : Error - description : Error: MyError at foo (<anonymous>:13:11) at throwError (<anonymous>:15:3) at <anonymous> + description : Error: MyError at foo (<anonymous>:13:11) at throwError (<anonymous>:15:3) objectId : <objectId> subtype : error type : object @@ -58,14 +58,14 @@ Running test: testRejectedPromiseWithError functionName : foo lineNumber : 12 scriptId : <scriptId> - url : + url : } [1] : { columnNumber : 2 functionName : throwError lineNumber : 14 scriptId : <scriptId> - url : + url : } ] } @@ -73,7 +73,7 @@ Running test: testRejectedPromiseWithError } result : { className : Error - description : Error: MyError at foo (<anonymous>:13:11) at throwError (<anonymous>:15:3) at <anonymous> + description : Error: MyError at foo (<anonymous>:13:11) at throwError (<anonymous>:15:3) objectId : <objectId> subtype : error type : object @@ -89,7 +89,7 @@ Running test: testRejectedPromiseWithSyntaxError columnNumber : 5 exception : { className : SyntaxError - description : SyntaxError: Unexpected token } at foo (<anonymous>:21:5) at throwSyntaxError (<anonymous>:23:3) at <anonymous> + description : SyntaxError: Unexpected token } at foo (<anonymous>:21:5) at throwSyntaxError (<anonymous>:23:3) objectId : <objectId> subtype : error type : object @@ -104,14 +104,14 @@ Running test: testRejectedPromiseWithSyntaxError functionName : foo lineNumber : 20 scriptId : <scriptId> - url : + url : } [1] : { columnNumber : 2 functionName : throwSyntaxError lineNumber : 22 scriptId : <scriptId> - url : + url : } ] } @@ -119,7 +119,7 @@ Running test: testRejectedPromiseWithSyntaxError } result : { className : SyntaxError - description : SyntaxError: Unexpected token } at foo (<anonymous>:21:5) at throwSyntaxError (<anonymous>:23:3) at <anonymous> + description : SyntaxError: Unexpected token } at foo (<anonymous>:21:5) at throwSyntaxError (<anonymous>:23:3) objectId : <objectId> subtype : error type : object diff --git a/deps/v8/test/inspector/runtime/get-properties-expected.txt b/deps/v8/test/inspector/runtime/get-properties-expected.txt index 1f7aa507e5..340a51c4a5 100644 --- a/deps/v8/test/inspector/runtime/get-properties-expected.txt +++ b/deps/v8/test/inspector/runtime/get-properties-expected.txt @@ -50,3 +50,40 @@ Running test: testObjectThrowsLength Running test: testTypedArrayWithoutLength __proto__ own object undefined + +Running test: testArrayBuffer +[[Int8Array]] + 0 own number 1 + 1 own number 2 + 2 own number 3 + 3 own number 4 + 4 own number 5 + 5 own number 6 + 6 own number 7 + 7 own number 8 + __proto__ own object undefined +[[Uint8Array]] + 0 own number 1 + 1 own number 2 + 2 own number 3 + 3 own number 4 + 4 own number 5 + 5 own number 6 + 6 own number 7 + 7 own number 8 + __proto__ own object undefined +[[Int16Array]] + 0 own number 513 + 1 own number 1027 + 2 own number 1541 + 3 own number 2055 + __proto__ own object undefined +[[Int32Array]] + 0 own number 67305985 + 1 own number 134678021 + __proto__ own object undefined + +Running test: testArrayBufferWithBrokenUintCtor + [[Int8Array]] own object undefined + [[Uint8Array]] own object undefined + __proto__ own object undefined 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 339595608a..a0437f4af6 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 @@ -1,4 +1,177 @@ Check that while Runtime.getProperties call on proxy object no user defined trap will be executed. +Testing regular Proxy +{ + id : <messageId> + result : { + result : { + className : Object + description : Proxy + objectId : <objectId> + preview : { + description : Proxy + overflow : false + properties : [ + [0] : { + name : a + type : number + value : 1 + } + ] + subtype : proxy + type : object + } + subtype : proxy + type : object + } + } +} +{ + id : <messageId> + result : { + internalProperties : [ + [0] : { + name : [[Handler]] + value : { + className : Object + description : Object + objectId : <objectId> + type : object + } + } + [1] : { + name : [[Target]] + value : { + className : Object + description : Object + objectId : <objectId> + type : object + } + } + [2] : { + name : [[IsRevoked]] + value : { + type : boolean + value : false + } + } + ] + result : [ + ] + } +} +Testing revocable Proxy +{ + id : <messageId> + result : { + result : { + className : Object + description : Proxy + objectId : <objectId> + preview : { + description : Proxy + overflow : false + properties : [ + [0] : { + name : a + type : number + value : 1 + } + ] + subtype : proxy + type : object + } + subtype : proxy + type : object + } + } +} +{ + id : <messageId> + result : { + internalProperties : [ + [0] : { + name : [[Handler]] + value : { + className : Object + description : Object + objectId : <objectId> + type : object + } + } + [1] : { + name : [[Target]] + value : { + className : Object + description : Object + objectId : <objectId> + type : object + } + } + [2] : { + name : [[IsRevoked]] + value : { + type : boolean + value : false + } + } + ] + result : [ + ] + } +} +{ + id : <messageId> + result : { + result : { + className : Object + description : Proxy + objectId : <objectId> + preview : { + description : Proxy + overflow : false + properties : [ + ] + subtype : proxy + type : object + } + subtype : proxy + type : object + } + } +} +{ + id : <messageId> + result : { + internalProperties : [ + [0] : { + name : [[Handler]] + value : { + subtype : null + type : object + value : null + } + } + [1] : { + name : [[Target]] + value : { + subtype : null + type : object + value : null + } + } + [2] : { + name : [[IsRevoked]] + value : { + type : boolean + value : true + } + } + ] + result : [ + ] + } +} +Checking counter { id : <messageId> result : { diff --git a/deps/v8/test/inspector/runtime/get-properties-on-proxy.js b/deps/v8/test/inspector/runtime/get-properties-on-proxy.js index b2981df290..0c96a985ac 100644 --- a/deps/v8/test/inspector/runtime/get-properties-on-proxy.js +++ b/deps/v8/test/inspector/runtime/get-properties-on-proxy.js @@ -6,96 +6,139 @@ let {session, contextGroup, Protocol} = InspectorTest.start("Check that while Ru contextGroup.addScript(` var self = this; -function testFunction() +function testFunction(revocable) { - self.counter = 0; - var handler = { - get: function(target, name){ - self.counter++; - return Reflect.get.apply(this, arguments); - }, - set: function(target, name){ - self.counter++; - return Reflect.set.apply(this, arguments); - }, - getPrototypeOf: function(target) { - self.counter++; - return Reflect.getPrototypeOf.apply(this, arguments); - }, - setPrototypeOf: function(target) { - self.counter++; - return Reflect.setPrototypeOf.apply(this, arguments); - }, - isExtensible: function(target) { - self.counter++; - return Reflect.isExtensible.apply(this, arguments); - }, - isExtensible: function(target) { - self.counter++; - return Reflect.isExtensible.apply(this, arguments); - }, - isExtensible: function(target) { - self.counter++; - return Reflect.isExtensible.apply(this, arguments); - }, - preventExtensions: function() { - self.counter++; - return Reflect.preventExtensions.apply(this, arguments); - }, - getOwnPropertyDescriptor: function() { - self.counter++; - return Reflect.getOwnPropertyDescriptor.apply(this, arguments); - }, - defineProperty: function() { - self.counter++; - return Reflect.defineProperty.apply(this, arguments); - }, - has: function() { - self.counter++; - return Reflect.has.apply(this, arguments); - }, - get: function() { - self.counter++; - return Reflect.get.apply(this, arguments); - }, - set: function() { - self.counter++; - return Reflect.set.apply(this, arguments); - }, - deleteProperty: function() { - self.counter++; - return Reflect.deleteProperty.apply(this, arguments); - }, - ownKeys: function() { - self.counter++; - return Reflect.ownKeys.apply(this, arguments); - }, - apply: function() { - self.counter++; - return Reflect.apply.apply(this, arguments); - }, - construct: function() { - self.counter++; - return Reflect.construct.apply(this, arguments); - } - }; - return new Proxy({ a : 1}, handler); + self.counter = 0; + var handler = { + get: function(target, name){ + self.counter++; + return Reflect.get.apply(this, arguments); + }, + set: function(target, name){ + self.counter++; + return Reflect.set.apply(this, arguments); + }, + getPrototypeOf: function(target) { + self.counter++; + return Reflect.getPrototypeOf.apply(this, arguments); + }, + setPrototypeOf: function(target) { + self.counter++; + return Reflect.setPrototypeOf.apply(this, arguments); + }, + isExtensible: function(target) { + self.counter++; + return Reflect.isExtensible.apply(this, arguments); + }, + isExtensible: function(target) { + self.counter++; + return Reflect.isExtensible.apply(this, arguments); + }, + isExtensible: function(target) { + self.counter++; + return Reflect.isExtensible.apply(this, arguments); + }, + preventExtensions: function() { + self.counter++; + return Reflect.preventExtensions.apply(this, arguments); + }, + getOwnPropertyDescriptor: function() { + self.counter++; + return Reflect.getOwnPropertyDescriptor.apply(this, arguments); + }, + defineProperty: function() { + self.counter++; + return Reflect.defineProperty.apply(this, arguments); + }, + has: function() { + self.counter++; + return Reflect.has.apply(this, arguments); + }, + get: function() { + self.counter++; + return Reflect.get.apply(this, arguments); + }, + set: function() { + self.counter++; + return Reflect.set.apply(this, arguments); + }, + deleteProperty: function() { + self.counter++; + return Reflect.deleteProperty.apply(this, arguments); + }, + ownKeys: function() { + self.counter++; + return Reflect.ownKeys.apply(this, arguments); + }, + apply: function() { + self.counter++; + return Reflect.apply.apply(this, arguments); + }, + construct: function() { + self.counter++; + return Reflect.construct.apply(this, arguments); + } + }; + var obj = { a : 1 }; + if (revocable) { + var revocableProxy = Proxy.revocable(obj, handler); + return [revocableProxy.proxy, revocableProxy.revoke] + } else { + return new Proxy(obj, handler); + } }`); -Protocol.Runtime.evaluate({ expression: "testFunction()"}).then(requestProperties); +function getArrayElement(arrayObjectId, idx) { + return Protocol.Runtime.callFunctionOn({ + functionDeclaration: `function() { return this[${idx}]; }`, + objectId: arrayObjectId + }); +} -function requestProperties(result) -{ - Protocol.Runtime.getProperties({ objectId: result.result.objectId, generatePreview: true }).then(checkCounter); +async function testRegular() { + InspectorTest.logMessage("Testing regular Proxy"); + + var result = await Protocol.Runtime.evaluate({ expression: "testFunction(false)", generatePreview: true }); + InspectorTest.logMessage(result); + var proxyId = result.result.result.objectId; + InspectorTest.logMessage(await Protocol.Runtime.getProperties({ objectId: proxyId, generatePreview: true })); } -function checkCounter(result) -{ - Protocol.Runtime.evaluate({ expression: "self.counter" }).then(dumpCounter); +async function testRevocable() { + InspectorTest.logMessage("Testing revocable Proxy"); + + var result = await Protocol.Runtime.evaluate({ expression: "testFunction(true)" }); + var proxyInfo = await getArrayElement(result.result.result.objectId, 0); + var revokeInfo = await getArrayElement(result.result.result.objectId, 1); + var proxyId = proxyInfo.result.result.objectId; + InspectorTest.logMessage(await Protocol.Runtime.callFunctionOn({ + functionDeclaration: `function() { return this; }`, + objectId: proxyId, + generatePreview: true + })) + InspectorTest.logMessage(await Protocol.Runtime.getProperties({ objectId: proxyId, generatePreview: true })); + await Protocol.Runtime.callFunctionOn({ + functionDeclaration: `function() { this(); }`, + objectId: revokeInfo.result.result.objectId + }); + InspectorTest.logMessage(await Protocol.Runtime.callFunctionOn({ + functionDeclaration: `function() { return this; }`, + objectId: proxyId, + generatePreview: true + })) + InspectorTest.logMessage(await Protocol.Runtime.getProperties({ objectId: proxyId, generatePreview: true })); } -function dumpCounter(result) -{ +async function checkCounter() { + InspectorTest.logMessage("Checking counter"); + + var result = await Protocol.Runtime.evaluate({ expression: "self.counter" }); InspectorTest.logMessage(result); - InspectorTest.completeTest(); } + +(async function test() { + await testRegular(); + await testRevocable(); + await checkCounter(); + InspectorTest.completeTest(); +})(); diff --git a/deps/v8/test/inspector/runtime/get-properties.js b/deps/v8/test/inspector/runtime/get-properties.js index 56a4c4be0b..d8132bb678 100644 --- a/deps/v8/test/inspector/runtime/get-properties.js +++ b/deps/v8/test/inspector/runtime/get-properties.js @@ -5,71 +5,77 @@ let {session, contextGroup, Protocol} = InspectorTest.start('Checks Runtime.getProperties method'); InspectorTest.runAsyncTestSuite([ - async function testObject5() { - let objectId = (await Protocol.Runtime.evaluate({ - expression: '(function(){var r = Object(5); r.foo = \'cat\';return r;})()' - })).result.result.objectId; - let props = await Protocol.Runtime.getProperties({ objectId, ownProperties: true }); - logGetPropertiesResult(props.result); + function testObject5() { + return logExpressionProperties('(function(){var r = Object(5); r.foo = \'cat\';return r;})()'); }, - async function testNotOwn() { - let objectId = (await Protocol.Runtime.evaluate({ - expression: '({ a: 2, set b(_) {}, get b() {return 5;}, __proto__: { a: 3, c: 4, get d() {return 6;} }})' - })).result.result.objectId; - let props = await Protocol.Runtime.getProperties({ objectId, ownProperties: false }); - logGetPropertiesResult(props.result); + function testNotOwn() { + return logExpressionProperties('({ a: 2, set b(_) {}, get b() {return 5;}, __proto__: { a: 3, c: 4, get d() {return 6;} }})', { ownProperties: false }); }, - async function testAccessorsOnly() { - let objectId = (await Protocol.Runtime.evaluate({ - expression: '({ a: 2, set b(_) {}, get b() {return 5;}, c: \'c\', set d(_){} })' - })).result.result.objectId; - let props = await Protocol.Runtime.getProperties({ objectId, ownProperties: true, accessorPropertiesOnly: true }); - logGetPropertiesResult(props.result); + function testAccessorsOnly() { + return logExpressionProperties('({ a: 2, set b(_) {}, get b() {return 5;}, c: \'c\', set d(_){} })', { ownProperties: true, accessorPropertiesOnly: true}); }, - async function testArray() { - let objectId = (await Protocol.Runtime.evaluate({ - expression: '[\'red\', \'green\', \'blue\']' - })).result.result.objectId; - let props = await Protocol.Runtime.getProperties({ objectId, ownProperties: true }); - logGetPropertiesResult(props.result); + function testArray() { + return logExpressionProperties('[\'red\', \'green\', \'blue\']'); }, - async function testBound() { - let objectId = (await Protocol.Runtime.evaluate({ - expression: 'Number.bind({}, 5)' - })).result.result.objectId; - let props = await Protocol.Runtime.getProperties({ objectId, ownProperties: true }); - logGetPropertiesResult(props.result); + function testBound() { + return logExpressionProperties('Number.bind({}, 5)'); }, - async function testObjectThrowsLength() { - let objectId = (await Protocol.Runtime.evaluate({ - expression: '({get length() { throw \'Length called\'; }})' - })).result.result.objectId; - let props = await Protocol.Runtime.getProperties({ objectId, ownProperties: true }); - logGetPropertiesResult(props.result); + function testObjectThrowsLength() { + return logExpressionProperties('({get length() { throw \'Length called\'; }})'); }, - async function testTypedArrayWithoutLength() { - let objectId = (await Protocol.Runtime.evaluate({ - expression: '({__proto__: Uint8Array.prototype})' - })).result.result.objectId; + function testTypedArrayWithoutLength() { + return logExpressionProperties('({__proto__: Uint8Array.prototype})'); + }, + + async function testArrayBuffer() { + let objectId = await evaluateToObjectId('new Uint8Array([1, 2, 3, 4, 5, 6, 7, 8]).buffer'); let props = await Protocol.Runtime.getProperties({ objectId, ownProperties: true }); - logGetPropertiesResult(props.result); + for (let prop of props.result.result) { + if (prop.name === '__proto__') + continue; + InspectorTest.log(prop.name); + await logGetPropertiesResult(prop.value.objectId); + } }, + + async function testArrayBufferWithBrokenUintCtor() { + await evaluateToObjectId(`(function() { + this.uint8array_old = this.Uint8Array; + this.Uint8Array = 42; + })()`); + await logExpressionProperties('new Int8Array([1, 2, 3, 4, 5, 6, 7]).buffer'); + await evaluateToObjectId(`(function() { + this.Uint8Array = this.uint8array_old; + delete this.uint8array_old; + })()`); + } ]); -function logGetPropertiesResult(protocolResult) { +async function logExpressionProperties(expression, flags) { + const objectId = await evaluateToObjectId(expression); + return await logGetPropertiesResult(objectId, flags); +} + +async function evaluateToObjectId(expression) { + return (await Protocol.Runtime.evaluate({ expression })).result.result.objectId; +} + +async function logGetPropertiesResult(objectId, flags = { ownProperties: true }) { function hasGetterSetter(property, fieldName) { var v = property[fieldName]; if (!v) return false; return v.type !== "undefined" } - var propertyArray = protocolResult.result; + flags.objectId = objectId; + let props = await Protocol.Runtime.getProperties(flags); + var propertyArray = props.result.result; propertyArray.sort(NamedThingComparator); for (var i = 0; i < propertyArray.length; i++) { var p = propertyArray[i]; @@ -81,7 +87,7 @@ function logGetPropertiesResult(protocolResult) { InspectorTest.log(" " + p.name + " " + own + " no value" + (hasGetterSetter(p, "get") ? ", getter" : "") + (hasGetterSetter(p, "set") ? ", setter" : "")); } - var internalPropertyArray = protocolResult.internalProperties; + var internalPropertyArray = props.result.internalProperties; if (internalPropertyArray) { InspectorTest.log("Internal properties"); internalPropertyArray.sort(NamedThingComparator); diff --git a/deps/v8/test/inspector/runtime/regression-736302-expected.txt b/deps/v8/test/inspector/runtime/regression-736302-expected.txt index 17243f2745..2174bc54a2 100644 --- a/deps/v8/test/inspector/runtime/regression-736302-expected.txt +++ b/deps/v8/test/inspector/runtime/regression-736302-expected.txt @@ -7,7 +7,7 @@ Running test: testThrowException args : [ [0] : { type : string - value : 1 + value : default: 1 } ] executionContextId : <executionContextId> diff --git a/deps/v8/test/inspector/runtime/runtime-evaluate-null-property-expected.txt b/deps/v8/test/inspector/runtime/runtime-evaluate-null-property-expected.txt new file mode 100644 index 0000000000..a001cb80ef --- /dev/null +++ b/deps/v8/test/inspector/runtime/runtime-evaluate-null-property-expected.txt @@ -0,0 +1,18 @@ +Tests Runtime.evaluate returns object with undefined property. +{ + id : <messageId> + result : { + result : { + type : object + value : { + b : null + c : [ + [0] : 1 + [1] : null + [2] : null + [3] : 4 + ] + } + } + } +} diff --git a/deps/v8/test/inspector/runtime/runtime-evaluate-null-property.js b/deps/v8/test/inspector/runtime/runtime-evaluate-null-property.js new file mode 100644 index 0000000000..665eed8ebd --- /dev/null +++ b/deps/v8/test/inspector/runtime/runtime-evaluate-null-property.js @@ -0,0 +1,14 @@ +// 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( + 'Tests Runtime.evaluate returns object with undefined property.'); + +(async function test() { + InspectorTest.logMessage(await Protocol.Runtime.evaluate({ + expression: '({a:undefined,b:null,c:[1, null, undefined, 4]})', + returnByValue: true + })); + InspectorTest.completeTest(); +})(); diff --git a/deps/v8/test/inspector/testcfg.py b/deps/v8/test/inspector/testcfg.py index f33384e1cf..64fa163a5e 100644 --- a/deps/v8/test/inspector/testcfg.py +++ b/deps/v8/test/inspector/testcfg.py @@ -2,27 +2,22 @@ # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. -import itertools import os -import re -import shlex from testrunner.local import testsuite from testrunner.local import utils from testrunner.objects import testcase +from testrunner.outproc import base as outproc -FLAGS_PATTERN = re.compile(r"//\s+Flags:(.*)") PROTOCOL_TEST_JS = "protocol-test.js" EXPECTED_SUFFIX = "-expected.txt" RESOURCES_FOLDER = "resources" -class InspectorProtocolTestSuite(testsuite.TestSuite): - def __init__(self, name, root): - super(InspectorProtocolTestSuite, self).__init__(name, root) - +class TestSuite(testsuite.TestSuite): def ListTests(self, context): tests = [] - for dirname, dirs, files in os.walk(os.path.join(self.root), followlinks=True): + for dirname, dirs, files in os.walk( + os.path.join(self.root), followlinks=True): for dotted in [x for x in dirs if x.startswith('.')]: dirs.remove(dotted) if dirname.endswith(os.path.sep + RESOURCES_FOLDER): @@ -34,80 +29,41 @@ class InspectorProtocolTestSuite(testsuite.TestSuite): fullpath = os.path.join(dirname, filename) relpath = fullpath[len(self.root) + 1 : -3] testname = relpath.replace(os.path.sep, "/") - test = testcase.TestCase(self, testname) + test = self._create_test(testname) tests.append(test) return tests - def GetShellForTestCase(self, testcase): - return 'inspector-test' + def _test_class(self): + return TestCase - def GetParametersForTestCase(self, testcase, context): - source = self.GetSourceForTest(testcase) - flags = testcase.flags + context.mode_flags - flags_match = re.findall(FLAGS_PATTERN, source) - for match in flags_match: - flags += shlex.split(match.strip()) - files = [ - os.path.join(self.root, PROTOCOL_TEST_JS), - os.path.join(self.root, testcase.path + self.suffix()), - ] - return files, flags, {} - def GetSourceForTest(self, testcase): - filename = os.path.join(self.root, testcase.path + self.suffix()) - with open(filename) as f: - return f.read() +class TestCase(testcase.TestCase): + def __init__(self, *args, **kwargs): + super(TestCase, self).__init__(*args, **kwargs) - def _IgnoreLine(self, string): - """Ignore empty lines, valgrind output and Android output.""" - if not string: return True - return (string.startswith("==") or string.startswith("**") or - string.startswith("ANDROID") or - # FIXME(machenbach): The test driver shouldn't try to use slow - # asserts if they weren't compiled. This fails in optdebug=2. - string == "Warning: unknown flag --enable-slow-asserts." or - string == "Try --help for options") + self._source_flags = self._parse_source_flags() - def IsFailureOutput(self, testcase): - file_name = os.path.join(self.root, testcase.path) + EXPECTED_SUFFIX - with file(file_name, "r") as expected: - expected_lines = expected.readlines() + def _get_files_params(self, ctx): + return [ + os.path.join(self.suite.root, PROTOCOL_TEST_JS), + os.path.join(self.suite.root, self.path + self._get_suffix()), + ] + + def _get_source_flags(self): + return self._source_flags - def ExpIterator(): - for line in expected_lines: - if not line.strip(): continue - yield line.strip() + def _get_source_path(self): + return os.path.join(self.suite.root, self.path + self._get_suffix()) - def ActIterator(lines): - for line in lines: - if self._IgnoreLine(line.strip()): continue - yield line.strip() + def get_shell(self): + return 'inspector-test' - def ActBlockIterator(): - """Iterates over blocks of actual output lines.""" - lines = testcase.output.stdout.splitlines() - start_index = 0 - found_eqeq = False - for index, line in enumerate(lines): - # If a stress test separator is found: - if line.startswith("=="): - # Iterate over all lines before a separator except the first. - if not found_eqeq: - found_eqeq = True - else: - yield ActIterator(lines[start_index:index]) - # The next block of output lines starts after the separator. - start_index = index + 1 - # Iterate over complete output if no separator was found. - if not found_eqeq: - yield ActIterator(lines) + @property + def output_proc(self): + return outproc.ExpectedOutProc( + self.expected_outcomes, + os.path.join(self.suite.root, self.path) + EXPECTED_SUFFIX) - for act_iterator in ActBlockIterator(): - for (expected, actual) in itertools.izip_longest( - ExpIterator(), act_iterator, fillvalue=''): - if expected != actual: - return True - return False def GetSuite(name, root): - return InspectorProtocolTestSuite(name, root) + return TestSuite(name, root) diff --git a/deps/v8/test/intl/testcfg.py b/deps/v8/test/intl/testcfg.py index 977dc11e2e..87aece3da6 100644 --- a/deps/v8/test/intl/testcfg.py +++ b/deps/v8/test/intl/testcfg.py @@ -26,18 +26,11 @@ # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. import os -import re from testrunner.local import testsuite from testrunner.objects import testcase -FLAGS_PATTERN = re.compile(r"//\s+Flags:(.*)") - -class IntlTestSuite(testsuite.TestSuite): - - def __init__(self, name, root): - super(IntlTestSuite, self).__init__(name, root) - +class TestSuite(testsuite.TestSuite): def ListTests(self, context): tests = [] for dirname, dirs, files in os.walk(self.root): @@ -52,34 +45,42 @@ class IntlTestSuite(testsuite.TestSuite): fullpath = os.path.join(dirname, filename) relpath = fullpath[len(self.root) + 1 : -3] testname = relpath.replace(os.path.sep, "/") - test = testcase.TestCase(self, testname) + test = self._create_test(testname) tests.append(test) return tests - def GetParametersForTestCase(self, testcase, context): - source = self.GetSourceForTest(testcase) - flags = testcase.flags + ["--allow-natives-syntax"] + context.mode_flags - flags_match = re.findall(FLAGS_PATTERN, source) - for match in flags_match: - flags += match.strip().split() + def _test_class(self): + return TestCase + + +class TestCase(testcase.TestCase): + def __init__(self, *args, **kwargs): + super(TestCase, self).__init__(*args, **kwargs) + + self._source_flags = self._parse_source_flags() + + def _get_files_params(self, ctx): + files = map(lambda f: os.path.join(self.suite.root, f), [ + 'assert.js', + 'utils.js', + 'regexp-prepare.js', + self.path + self._get_suffix(), + 'regexp-assert.js', + ]) + + if ctx.isolates: + files += ['--isolate'] + files + return files - files = [] - files.append(os.path.join(self.root, "assert.js")) - files.append(os.path.join(self.root, "utils.js")) - files.append(os.path.join(self.root, "regexp-prepare.js")) - files.append(os.path.join(self.root, testcase.path + self.suffix())) - files.append(os.path.join(self.root, "regexp-assert.js")) + def _get_source_flags(self): + return self._source_flags - all_files = list(files) - if context.isolates: - all_files += ["--isolate"] + files + def _get_suite_flags(self, ctx): + return ['--allow-natives-syntax'] - return all_files, flags, {} + def _get_source_path(self): + return os.path.join(self.suite.root, self.path + self._get_suffix()) - def GetSourceForTest(self, testcase): - filename = os.path.join(self.root, testcase.path + self.suffix()) - with open(filename) as f: - return f.read() def GetSuite(name, root): - return IntlTestSuite(name, root) + return TestSuite(name, root) diff --git a/deps/v8/test/js-perf-test/Array/every.js b/deps/v8/test/js-perf-test/Array/every.js index 76b68b7a45..5a29f44e41 100644 --- a/deps/v8/test/js-perf-test/Array/every.js +++ b/deps/v8/test/js-perf-test/Array/every.js @@ -1,38 +1,7 @@ // 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. - -function benchy(name, test, testSetup) { - new BenchmarkSuite(name, [1000], - [ - new Benchmark(name, false, false, 0, test, testSetup, ()=>{}) - ]); -} - -benchy('DoubleEvery', DoubleEvery, DoubleEverySetup); -benchy('SmiEvery', SmiEvery, SmiEverySetup); -benchy('FastEvery', FastEvery, FastEverySetup); -benchy('OptFastEvery', OptFastEvery, FastEverySetup); - -var array; -// Initialize func variable to ensure the first test doesn't benefit from -// global object property tracking. -var func = 0; -var this_arg; -var result; -var array_size = 100; - -// Although these functions have the same code, they are separated for -// clean IC feedback. -function DoubleEvery() { - result = array.every(func, this_arg); -} -function SmiEvery() { - result = array.every(func, this_arg); -} -function FastEvery() { - result = array.every(func, this_arg); -} +(() => { // Make sure we inline the callback, pick up all possible TurboFan // optimizations. @@ -50,20 +19,19 @@ function RunOptFastEvery(multiple) { %NeverOptimizeFunction(OptFastEvery); function OptFastEvery() { RunOptFastEvery(3); } -function SmiEverySetup() { - array = new Array(); - for (var i = 0; i < array_size; i++) array[i] = i; - func = (value, index, object) => { return value != 34343; }; +function side_effect(a) { return a; } +%NeverOptimizeFunction(side_effect); +function OptUnreliableEvery() { + result = array.every(func, side_effect(array)); } -function DoubleEverySetup() { - array = new Array(); - for (var i = 0; i < array_size; i++) array[i] = (i + 0.5); - func = (value, index, object) => { return value > 0.0; }; -} +DefineHigherOrderTests([ + // name, test function, setup function, user callback + "DoubleEvery", mc("every"), DoubleSetup, v => v > 0.0, + "SmiEvery", mc("every"), SmiSetup, v => v != 34343, + "FastEvery", mc("every"), FastSetup, v => v !== 'hi', + "OptFastEvery", OptFastEvery, FastSetup, v => true, + "OptUnreliableEvery", OptUnreliableEvery, FastSetup, v => true +]); -function FastEverySetup() { - array = new Array(); - for (var i = 0; i < array_size; i++) array[i] = 'value ' + i; - func = (value, index, object) => { return value !== 'hi'; }; -} +})(); diff --git a/deps/v8/test/js-perf-test/Array/filter.js b/deps/v8/test/js-perf-test/Array/filter.js index 94ba2651ec..e0d4327dd6 100644 --- a/deps/v8/test/js-perf-test/Array/filter.js +++ b/deps/v8/test/js-perf-test/Array/filter.js @@ -1,61 +1,7 @@ // 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. - -function benchy(name, test, testSetup) { - new BenchmarkSuite(name, [1000], - [ - new Benchmark(name, false, false, 0, test, testSetup, ()=>{}) - ]); -} - -benchy('NaiveFilterReplacement', NaiveFilter, NaiveFilterSetup); -benchy('DoubleFilter', DoubleFilter, DoubleFilterSetup); -benchy('SmiFilter', SmiFilter, SmiFilterSetup); -benchy('FastFilter', FastFilter, FastFilterSetup); -benchy('GenericFilter', GenericFilter, ObjectFilterSetup); -benchy('OptFastFilter', OptFastFilter, FastFilterSetup); - -var array; -// Initialize func variable to ensure the first test doesn't benefit from -// global object property tracking. -var func = 0; -var this_arg; -var result; -var array_size = 100; - -// Although these functions have the same code, they are separated for -// clean IC feedback. -function DoubleFilter() { - result = array.filter(func, this_arg); -} -function SmiFilter() { - result = array.filter(func, this_arg); -} -function FastFilter() { - result = array.filter(func, this_arg); -} - -// Make sure we inline the callback, pick up all possible TurboFan -// optimizations. -function RunOptFastFilter(multiple) { - // Use of variable multiple in the callback function forces - // context creation without escape analysis. - // - // Also, the arrow function requires inlining based on - // SharedFunctionInfo. - result = array.filter((v, i, a) => multiple === 3); -} - -// Don't optimize because I want to optimize RunOptFastMap with a parameter -// to be used in the callback. -%NeverOptimizeFunction(OptFastFilter); -function OptFastFilter() { RunOptFastFilter(3); } - - -function GenericFilter() { - result = Array.prototype.filter.call(array, func, this_arg); -} +(() => { // From the lodash implementation. function NaiveFilter() { @@ -76,37 +22,45 @@ function NaiveFilter() { function NaiveFilterSetup() { // Prime NaiveFilter with polymorphic cases. array = [1, 2, 3]; - func = ()=>true; NaiveFilter(); NaiveFilter(); array = [3.4]; NaiveFilter(); array = new Array(10); array[0] = 'hello'; NaiveFilter(); - SmiFilterSetup(); + SmiSetup(); delete array[1]; } -function SmiFilterSetup() { - array = new Array(); - for (var i = 0; i < array_size; i++) array[i] = i; - func = (value, index, object) => { return value % 2 === 0; }; +// Make sure we inline the callback, pick up all possible TurboFan +// optimizations. +function RunOptFastFilter(multiple) { + // Use of variable multiple in the callback function forces + // context creation without escape analysis. + // + // Also, the arrow function requires inlining based on + // SharedFunctionInfo. + result = array.filter((v, i, a) => multiple === 3); } -function DoubleFilterSetup() { - array = new Array(); - for (var i = 0; i < array_size; i++) array[i] = (i + 0.5); - func = (value, index, object) => { return Math.floor(value) % 2 === 0; }; -} +// Don't optimize because I want to optimize RunOptFastMap with a parameter +// to be used in the callback. +%NeverOptimizeFunction(OptFastFilter); +function OptFastFilter() { RunOptFastFilter(3); } -function FastFilterSetup() { - array = new Array(); - for (var i = 0; i < array_size; i++) array[i] = 'value ' + i; - func = (value, index, object) => { return index % 2 === 0; }; +function side_effect(a) { return a; } +%NeverOptimizeFunction(side_effect); +function OptUnreliableFilter() { + result = array.filter(func, side_effect(array)); } -function ObjectFilterSetup() { - array = { length: array_size }; - for (var i = 0; i < array_size; i++) { - array[i] = i; - } - func = (value, index, object) => { return index % 2 === 0; }; -} +DefineHigherOrderTests([ + // name, test function, setup function, user callback + "NaiveFilterReplacement", NaiveFilter, NaiveFilterSetup, v => true, + "DoubleFilter", mc("filter"), DoubleSetup, v => Math.floor(v) % 2 === 0, + "SmiFilter", mc("filter"), SmiSetup, v => v % 2 === 0, + "FastFilter", mc("filter"), FastSetup, (_, i) => i % 2 === 0, + "GenericFilter", mc("filter", true), ObjectSetup, (_, i) => i % 2 === 0, + "OptFastFilter", OptFastFilter, FastSetup, undefined, + "OptUnreliableFilter", OptUnreliableFilter, FastSetup, v => true +]); + +})(); diff --git a/deps/v8/test/js-perf-test/Array/find-index.js b/deps/v8/test/js-perf-test/Array/find-index.js new file mode 100644 index 0000000000..716aa710bb --- /dev/null +++ b/deps/v8/test/js-perf-test/Array/find-index.js @@ -0,0 +1,63 @@ +// 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. +(() => { + +// Make sure we inline the callback, pick up all possible TurboFan +// optimizations. +function RunOptFast(multiple) { + // Use of variable multiple in the callback function forces + // context creation without escape analysis. + // + // Also, the arrow function requires inlining based on + // SharedFunctionInfo. + result = array.findIndex((v, i, a) => v === `value ${multiple}`); +} + +// Don't optimize because I want to optimize RunOptFast with a parameter +// to be used in the callback. +%NeverOptimizeFunction(OptFast); +function OptFast() { RunOptFast(max_index); } + +function side_effect(a) { return a; } +%NeverOptimizeFunction(side_effect); +function OptUnreliable() { + result = array.findIndex(func, side_effect(array)); +} + +function Naive() { + let index = -1; + const length = array == null ? 0 : array.length; + + for (let index = 0; index < length; index++) { + const value = array[index]; + if (func(value, index, array)) { + result = value; + break; + } + } +} + +function NaiveSetup() { + // Prime Naive with polymorphic cases. + array = [1, 2, 3]; + Naive(); + Naive(); + array = [3.4]; Naive(); + array = new Array(10); array[0] = 'hello'; Naive(); + SmiSetup(); + delete array[1]; +} + +DefineHigherOrderTests([ + // name, test function, setup function, user callback + "NaiveFindIndexReplacement", Naive, NaiveSetup, v => v === max_index, + "DoubleFindIndex", mc("findIndex"), DoubleSetup, v => v === max_index + 0.5, + "SmiFindIndex", mc("findIndex"), SmiSetup, v => v === max_index, + "FastFindIndex", mc("findIndex"), FastSetup, v => v === `value ${max_index}`, + "GenericFindIndex", mc("findIndex", true), ObjectSetup, v => v === max_index, + "OptFastFindIndex", OptFast, FastSetup, undefined, + "OptUnreliableFindIndex", OptUnreliable, FastSetup, v => v === max_index +]); + +})(); diff --git a/deps/v8/test/js-perf-test/Array/find.js b/deps/v8/test/js-perf-test/Array/find.js new file mode 100644 index 0000000000..9b9a19f1c4 --- /dev/null +++ b/deps/v8/test/js-perf-test/Array/find.js @@ -0,0 +1,63 @@ +// 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. +(() => { + +// Make sure we inline the callback, pick up all possible TurboFan +// optimizations. +function RunOptFast(multiple) { + // Use of variable multiple in the callback function forces + // context creation without escape analysis. + // + // Also, the arrow function requires inlining based on + // SharedFunctionInfo. + result = array.find((v, i, a) => v === `value ${multiple}`); +} + +// Don't optimize because I want to optimize RunOptFast with a parameter +// to be used in the callback. +%NeverOptimizeFunction(OptFast); +function OptFast() { RunOptFast(max_index); } + +function side_effect(a) { return a; } +%NeverOptimizeFunction(side_effect); +function OptUnreliable() { + result = array.find(func, side_effect(array)); +} + +function Naive() { + let index = -1; + const length = array == null ? 0 : array.length; + + for (let index = 0; index < length; index++) { + const value = array[index]; + if (func(value, index, array)) { + result = value; + break; + } + } +} + +function NaiveSetup() { + // Prime Naive with polymorphic cases. + array = [1, 2, 3]; + Naive(); + Naive(); + array = [3.4]; Naive(); + array = new Array(10); array[0] = 'hello'; Naive(); + SmiSetup(); + delete array[1]; +} + +DefineHigherOrderTests([ + // name, test function, setup function, user callback + "NaiveFindReplacement", Naive, NaiveSetup, v => v === max_index, + "DoubleFind", mc("find"), DoubleSetup, v => v === max_index + 0.5, + "SmiFind", mc("find"), SmiSetup, v => v === max_index, + "FastFind", mc("find"), FastSetup, v => v === `value ${max_index}`, + "GenericFind", mc("find", true), ObjectSetup, v => v === max_index, + "OptFastFind", OptFast, FastSetup, undefined, + "OptUnreliableFind", OptUnreliable, FastSetup, v => v === max_index +]); + +})(); diff --git a/deps/v8/test/js-perf-test/Array/for-each.js b/deps/v8/test/js-perf-test/Array/for-each.js new file mode 100644 index 0000000000..79d279894b --- /dev/null +++ b/deps/v8/test/js-perf-test/Array/for-each.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. +(() => { + +function Naive() { + let index = -1; + const length = array == null ? 0 : array.length; + + for (let index = 0; index < length; index++) { + const value = array[index]; + if (func(value, index, array)) { + result = value; + break; + } + } +} + +function NaiveSetup() { + // Prime Naive with polymorphic cases. + array = [1, 2, 3]; + Naive(); + Naive(); + array = [3.4]; Naive(); + array = new Array(10); array[0] = 'hello'; Naive(); + SmiSetup(); + delete array[1]; +} + +// Make sure we inline the callback, pick up all possible TurboFan +// optimizations. +function RunOptFast(multiple) { + // Use of variable multiple in the callback function forces + // context creation without escape analysis. + // + // Also, the arrow function requires inlining based on + // SharedFunctionInfo. + result = array.forEach((v, i, a) => v === `value ${multiple}`); +} + +// Don't optimize because I want to optimize RunOptFast with a parameter +// to be used in the callback. +%NeverOptimizeFunction(OptFast); +function OptFast() { RunOptFast(max_index); } + +function side_effect(a) { return a; } +%NeverOptimizeFunction(side_effect); +function OptUnreliable() { + result = array.forEach(func, side_effect(array)); +} + +DefineHigherOrderTests([ + "NaiveForEachReplacement", Naive, NaiveSetup, v => v === max_index, + "DoubleForEach", mc("forEach"), DoubleSetup, v => v === max_index + 0.5, + "SmiForEach", mc("forEach"), SmiSetup, v => v === max_index, + "FastForEach", mc("forEach"), FastSetup, v => v === `value ${max_index}`, + "GenericForEach", mc("forEach", true), ObjectSetup, v => v === max_index, + "OptFastForEach", OptFast, FastSetup, undefined, + "OptUnreliableForEach", OptUnreliable, FastSetup, v => v === `value ${max_index}` +]); + +})(); diff --git a/deps/v8/test/js-perf-test/Array/join.js b/deps/v8/test/js-perf-test/Array/join.js index 7330ae0459..ef9d298421 100644 --- a/deps/v8/test/js-perf-test/Array/join.js +++ b/deps/v8/test/js-perf-test/Array/join.js @@ -1,39 +1,21 @@ // 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. - -function benchy(name, test, testSetup) { - new BenchmarkSuite(name, [1000], - [ - new Benchmark(name, false, false, 0, test, testSetup, ()=>{}) - ]); -} - -benchy('SmiJoin', SmiJoin, SmiJoinSetup); -benchy('StringJoin', StringJoin, StringJoinSetup); -benchy('SparseSmiJoin', SparseSmiJoin, SparseSmiJoinSetup); -benchy('SparseStringJoin', SparseStringJoin, SparseStringJoinSetup); +(() => { var array; var result; var array_size = 1000; - -// Although these functions have the same code, they are separated for -// clean IC feedback. -function SmiJoin() { - result = array.join(); -} -function StringJoin() { - result = array.join(); -} -function SparseSmiJoin() { - result = array.join(); -} -function SparseStringJoin() { - result = array.join(); +function make_join() { + return new Function('result = array.join();'); } +benchy('SmiJoin', make_join(), SmiJoinSetup); +benchy('StringJoin', make_join(), StringJoinSetup); +benchy('SparseSmiJoin', make_join(), SparseSmiJoinSetup); +benchy('SparseStringJoin', make_join(), SparseStringJoinSetup); + function SmiJoinSetup() { array = new Array(); for (var i = 0; i < array_size; ++i) array[i] = i; @@ -50,3 +32,5 @@ function SparseStringJoinSetup() { StringJoinSetup(); array.length = array.length * 2; } + +})(); diff --git a/deps/v8/test/js-perf-test/Array/map.js b/deps/v8/test/js-perf-test/Array/map.js index f4ab95b065..9179aa3c88 100644 --- a/deps/v8/test/js-perf-test/Array/map.js +++ b/deps/v8/test/js-perf-test/Array/map.js @@ -1,58 +1,7 @@ // 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. - -function benchy(name, test, testSetup) { - new BenchmarkSuite(name, [1000], - [ - new Benchmark(name, false, false, 0, test, testSetup, ()=>{}) - ]); -} - -benchy('NaiveMapReplacement', NaiveMap, NaiveMapSetup); -benchy('DoubleMap', DoubleMap, DoubleMapSetup); -benchy('SmallSmiToDoubleMap', SmiMap, SmiToDoubleMapSetup); -benchy('SmallSmiToFastMap', SmiMap, SmiToFastMapSetup); -benchy('SmiMap', SmiMap, SmiMapSetup); -benchy('FastMap', FastMap, FastMapSetup); -benchy('GenericMap', GenericMap, ObjectMapSetup); -benchy('OptFastMap', OptFastMap, FastMapSetup); - -var array; -// Initialize func variable to ensure the first test doesn't benefit from -// global object property tracking. -var func = 0; -var this_arg; -var result; -var array_size = 100; - -// Although these functions have the same code, they are separated for -// clean IC feedback. -function DoubleMap() { - result = array.map(func, this_arg); -} -function SmiMap() { - result = array.map(func, this_arg); -} -function FastMap() { - result = array.map(func, this_arg); -} - -// Make sure we inline the callback, pick up all possible TurboFan -// optimizations. -function RunOptFastMap(multiple) { - // Use of variable multiple in the callback function forces - // context creation without escape analysis. - // - // Also, the arrow function requires inlining based on - // SharedFunctionInfo. - result = array.map((v, i, a) => v + ' ' + multiple); -} - -// Don't optimize because I want to optimize RunOptFastMap with a parameter -// to be used in the callback. -%NeverOptimizeFunction(OptFastMap); -function OptFastMap() { RunOptFastMap(3); } +(() => { function NaiveMap() { let index = -1 @@ -65,57 +14,50 @@ function NaiveMap() { return result } - -function GenericMap() { - result = Array.prototype.map.call(array, func, this_arg); -} - function NaiveMapSetup() { // Prime NaiveMap with polymorphic cases. array = [1, 2, 3]; - func = (v, i, a) => v; NaiveMap(); NaiveMap(); array = [3.4]; NaiveMap(); array = new Array(10); array[0] = 'hello'; NaiveMap(); - SmiMapSetup(); + SmiSetup(); delete array[1]; } -function SmiMapSetup() { - array = new Array(); - for (var i = 0; i < array_size; i++) array[i] = i; - func = (value, index, object) => { return value; }; -} - -function SmiToDoubleMapSetup() { - array = new Array(); - for (var i = 0; i < 1; i++) array[i] = i; - func = (value, index, object) => { return value + 0.5; }; -} - -function SmiToFastMapSetup() { - array = new Array(); - for (var i = 0; i < 1; i++) array[i] = i; - func = (value, index, object) => { return "hi" + value; }; -} - -function DoubleMapSetup() { - array = new Array(); - for (var i = 0; i < array_size; i++) array[i] = (i + 0.5); - func = (value, index, object) => { return value; }; +// Make sure we inline the callback, pick up all possible TurboFan +// optimizations. +function RunOptFastMap(multiple) { + // Use of variable multiple in the callback function forces + // context creation without escape analysis. + // + // Also, the arrow function requires inlining based on + // SharedFunctionInfo. + result = array.map((v, i, a) => v + ' ' + multiple); } -function FastMapSetup() { - array = new Array(); - for (var i = 0; i < array_size; i++) array[i] = 'value ' + i; - func = (value, index, object) => { return value; }; -} +// Don't optimize because I want to optimize RunOptFastMap with a parameter +// to be used in the callback. +%NeverOptimizeFunction(OptFastMap); +function OptFastMap() { RunOptFastMap(3); } -function ObjectMapSetup() { - array = { length: array_size }; - for (var i = 0; i < array_size; i++) { - array[i] = i; - } - func = (value, index, object) => { return value; }; -} +function side_effect(a) { return a; } +%NeverOptimizeFunction(side_effect); +function OptUnreliableMap() { + result = array.map(func, side_effect(array)); +} + +DefineHigherOrderTests([ + // name, test function, setup function, user callback + "NaiveMapReplacement", NaiveMap, NaiveMapSetup, v => v, + "SmiMap", mc("map"), SmiSetup, v => v, + "DoubleMap", mc("map"), DoubleSetup, v => v, + "FastMap", mc("map"), FastSetup, v => v, + "SmallSmiToDoubleMap", mc("map"), SmiSetup, v => v + 0.5, + "SmallSmiToFastMap", mc("map"), SmiSetup, v => "hi" + v, + "GenericMap", mc("map", true), ObjectSetup, v => v, + "OptFastMap", OptFastMap, FastSetup, undefined, + "OptUnreliableMap", OptUnreliableMap, FastSetup, v => v +]); + +})(); diff --git a/deps/v8/test/js-perf-test/Array/of.js b/deps/v8/test/js-perf-test/Array/of.js new file mode 100644 index 0000000000..bfd471245c --- /dev/null +++ b/deps/v8/test/js-perf-test/Array/of.js @@ -0,0 +1,117 @@ +// 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. +(() => { + +benchy('EmptyArrayOf', EmptyArrayOf, EmptyArrayOfSetup); +benchy('SmallTransplantedArrayOf', SmallTransplantedArrayOf, + SmallTransplantedArrayOfSetup); +benchy('SmallSmiArrayOf', SmallSmiArrayOf, SmallSmiArrayOfSetup); +benchy('LargeSmiArrayOf', LargeSmiArrayOf, LargeSmiArrayOfSetup); +benchy('SmallDoubleArrayOf', SmallDoubleArrayOf, SmallDoubleArrayOfSetup); +benchy('SmallStringArrayOf', SmallStringArrayOf, SmallStringArrayOfSetup); +benchy('SmallMixedArrayOf', SmallMixedArrayOf, SmallMixedArrayOfSetup); + +function ArrayLike() {} +ArrayLike.of = Array.of; + +var arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10 +var arg11, arg12, arg13, arg14, arg15, arg16, arg17, arg18, arg19, arg20 +var result; + +function EmptyArrayOf() { + result = Array.of(); +} + +function BaselineArray() { + result = [arg1, arg2, arg3]; +} + +function SmallSmiArrayOf() { + result = Array.of(arg1, arg2, arg3); +} + +function LargeSmiArrayOf() { + result = Array.of(arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, + arg11, arg12, arg13, arg14, arg15, arg16, arg17, arg18, arg19, arg20); +} + +function SmallTransplantedArrayOf() { + result = ArrayLike.of(arg1, arg2, arg3); +} + +function SmallDoubleArrayOf() { + result = Array.of(arg1, arg2, arg3); +} + +function SmallStringArrayOf() { + result = Array.of(arg1, arg2, arg3); +} + +function SmallMixedArrayOf() { + result = Array.of(arg1, arg2, arg3); +} + +function EmptyArrayOfSetup() { +} + +function BaselineArraySetup() { + arg1 = 1; + arg2 = 2; + arg3 = 3; +} + +function SmallSmiArrayOfSetup() { + arg1 = 1; + arg2 = 2; + arg3 = 3; +} + +function SmallTransplantedArrayOfSetup() { + arg1 = 1; + arg2 = 2; + arg3 = 3; +} + +function SmallDoubleArrayOfSetup() { + arg1 = 1.5; + arg2 = 2.5; + arg3 = 3.5; +} + +function SmallStringArrayOfSetup() { + arg1 = "cat"; + arg2 = "dog"; + arg3 = "giraffe"; +} + +function SmallMixedArrayOfSetup() { + arg1 = 1; + arg2 = 2.5; + arg3 = "giraffe"; +} + +function LargeSmiArrayOfSetup() { + arg1 = 1; + arg2 = 2; + arg3 = 3; + arg4 = 4; + arg5 = 5; + arg6 = 6; + arg7 = 7; + arg8 = 8; + arg9 = 9; + arg10 = 10; + arg11 = 11; + arg12 = 12; + arg13 = 13; + arg14 = 14; + arg15 = 15; + arg16 = 16; + arg17 = 17; + arg18 = 18; + arg19 = 19; + arg20 = 20; +} + +})(); diff --git a/deps/v8/test/js-perf-test/Array/reduce-right.js b/deps/v8/test/js-perf-test/Array/reduce-right.js index 29cb67cd1a..ed00f5ac27 100644 --- a/deps/v8/test/js-perf-test/Array/reduce-right.js +++ b/deps/v8/test/js-perf-test/Array/reduce-right.js @@ -1,38 +1,7 @@ // 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. - -function benchy(name, test, testSetup) { - new BenchmarkSuite(name, [1000], - [ - new Benchmark(name, false, false, 0, test, testSetup, ()=>{}) - ]); -} - -benchy('DoubleReduceRight', DoubleReduceRight, DoubleReduceRightSetup); -benchy('SmiReduceRight', SmiReduceRight, SmiReduceRightSetup); -benchy('FastReduceRight', FastReduceRight, FastReduceRightSetup); -benchy('OptFastReduceRight', OptFastReduceRight, FastReduceRightSetup); - -var array; -// Initialize func variable to ensure the first test doesn't benefit from -// global object property tracking. -var func = 0; -var this_arg; -var result; -var array_size = 100; - -// Although these functions have the same code, they are separated for -// clean IC feedback. -function DoubleReduceRight() { - result = array.reduceRight(func, this_arg); -} -function SmiReduceRight() { - result = array.reduceRight(func, this_arg); -} -function FastReduceRight() { - result = array.reduceRight(func, this_arg); -} +(() => { // Make sure we inline the callback, pick up all possible TurboFan // optimizations. @@ -50,20 +19,20 @@ function RunOptFastReduceRight(multiple) { %NeverOptimizeFunction(OptFastReduceRight); function OptFastReduceRight() { RunOptFastReduceRight(3); } -function SmiReduceRightSetup() { - array = new Array(); - for (var i = 0; i < array_size; i++) array[i] = i; - func = (prev, value, index, object) => { return prev + 1; }; +function side_effect(a) { return a; } +%NeverOptimizeFunction(side_effect); +function OptUnreliableReduceRight() { + result = array.reduceRight(func, side_effect(array)); } -function DoubleReduceRightSetup() { - array = new Array(); - for (var i = 0; i < array_size; i++) array[i] = (i + 0.5); - func = (prev, value, index, object) => { return prev + value; }; -} +DefineHigherOrderTests([ + // name, test function, setup function, user callback + "DoubleReduceRight", mc("reduceRight"), DoubleSetup, (p, v, i, o) => p + v, + "SmiReduceRight", mc("reduceRight"), SmiSetup, (p, v, i, a) => p + 1, + "FastReduceRight", mc("reduceRight"), FastSetup, (p, v, i, a) => p + v, + "OptFastReduceRight", OptFastReduceRight, FastSetup, undefined, + "OptUnreliableReduceRight", OptUnreliableReduceRight, FastSetup, + (p, v, i, a) => p + v +]); -function FastReduceRightSetup() { - array = new Array(); - for (var i = 0; i < array_size; i++) array[i] = 'value ' + i; - func = (prev, value, index, object) => { return prev + value; }; -} +})(); diff --git a/deps/v8/test/js-perf-test/Array/reduce.js b/deps/v8/test/js-perf-test/Array/reduce.js index 8790c0a861..02d689f7c4 100644 --- a/deps/v8/test/js-perf-test/Array/reduce.js +++ b/deps/v8/test/js-perf-test/Array/reduce.js @@ -1,38 +1,7 @@ // 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. - -function benchy(name, test, testSetup) { - new BenchmarkSuite(name, [1000], - [ - new Benchmark(name, false, false, 0, test, testSetup, ()=>{}) - ]); -} - -benchy('DoubleReduce', DoubleReduce, DoubleReduceSetup); -benchy('SmiReduce', SmiReduce, SmiReduceSetup); -benchy('FastReduce', FastReduce, FastReduceSetup); -benchy('OptFastReduce', OptFastReduce, FastReduceSetup); - -var array; -// Initialize func variable to ensure the first test doesn't benefit from -// global object property tracking. -var func = 0; -var this_arg; -var result; -var array_size = 100; - -// Although these functions have the same code, they are separated for -// clean IC feedback. -function DoubleReduce() { - result = array.reduce(func, this_arg); -} -function SmiReduce() { - result = array.reduce(func, this_arg); -} -function FastReduce() { - result = array.reduce(func, this_arg); -} +(() => { // Make sure we inline the callback, pick up all possible TurboFan // optimizations. @@ -50,20 +19,20 @@ function RunOptFastReduce(multiple) { %NeverOptimizeFunction(OptFastReduce); function OptFastReduce() { RunOptFastReduce(3); } -function SmiReduceSetup() { - array = new Array(); - for (var i = 0; i < array_size; i++) array[i] = i; - func = (prev, value, index, object) => { return prev + 1; }; +function side_effect(a) { return a; } +%NeverOptimizeFunction(side_effect); +function OptUnreliableReduce() { + result = array.reduce(func, side_effect(array)); } -function DoubleReduceSetup() { - array = new Array(); - for (var i = 0; i < array_size; i++) array[i] = (i + 0.5); - func = (prev, value, index, object) => { return prev + value; }; -} +DefineHigherOrderTests([ + // name, test function, setup function, user callback + "DoubleReduce", mc("reduce"), DoubleSetup, (p, v, i, o) => p + v, + "SmiReduce", mc("reduce"), SmiSetup, (p, v, i, a) => p + 1, + "FastReduce", mc("reduce"), FastSetup, (p, v, i, a) => p + v, + "OptFastReduce", OptFastReduce, FastSetup, undefined, + "OptUnreliableReduce", OptUnreliableReduce, FastSetup, + (p, v, i, a) => p = v +]); -function FastReduceSetup() { - array = new Array(); - for (var i = 0; i < array_size; i++) array[i] = 'value ' + i; - func = (prev, value, index, object) => { return prev + value; }; -} +})(); diff --git a/deps/v8/test/js-perf-test/Array/run.js b/deps/v8/test/js-perf-test/Array/run.js index baf2553eb3..15b4da94c2 100644 --- a/deps/v8/test/js-perf-test/Array/run.js +++ b/deps/v8/test/js-perf-test/Array/run.js @@ -2,16 +2,85 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. - load('../base.js'); +let array; +// Initialize func variable to ensure the first test doesn't benefit from +// global object property tracking. +let func = 0; +let this_arg; +let result; +const array_size = 100; +const max_index = array_size - 1; + +// mc stands for "Make Closure," it's a handy function to get a fresh +// closure unpolluted by IC feedback for a 2nd-order array builtin +// test. +function mc(name, generic = false) { + if (generic) { + return new Function( + `result = Array.prototype.${name}.call(array, func, this_arg);`); + } + return new Function(`result = array.${name}(func, this_arg);`); +} + +function benchy(name, test, testSetup) { + new BenchmarkSuite(name, [1000], + [ + new Benchmark(name, false, false, 0, test, testSetup, ()=>{}) + ]); +} + +function SmiSetup() { + array = Array.from({ length: array_size }, (_, i) => i); +} + +function DoubleSetup() { + array = Array.from({ length: array_size }, (_, i) => i + 0.5); +} + +function FastSetup() { + array = Array.from({ length: array_size }, (_, i) => `value ${i}`); +} + +function ObjectSetup() { + array = { length: array_size }; + for (var i = 0; i < array_size; i++) { + array[i] = i; + } +} + +function DefineHigherOrderTests(tests) { + let i = 0; + while (i < tests.length) { + const name = tests[i++]; + const testFunc = tests[i++]; + const setupFunc = tests[i++]; + const callback = tests[i++]; + + let setupFuncWrapper = () => { + func = callback; + this_arg = undefined; + setupFunc(); + }; + benchy(name, testFunc, setupFuncWrapper); + } +} + +// Higher-order Array builtins. load('filter.js'); load('map.js'); load('every.js'); -load('join.js'); load('some.js'); +load('for-each.js'); load('reduce.js'); load('reduce-right.js'); +load('find.js'); +load('find-index.js'); +load('of.js'); + +// Other Array builtins. +load('join.js'); load('to-string.js'); var success = true; diff --git a/deps/v8/test/js-perf-test/Array/some.js b/deps/v8/test/js-perf-test/Array/some.js index 246ea95c13..ea820e9801 100644 --- a/deps/v8/test/js-perf-test/Array/some.js +++ b/deps/v8/test/js-perf-test/Array/some.js @@ -1,38 +1,7 @@ // 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. - -function benchy(name, test, testSetup) { - new BenchmarkSuite(name, [1000], - [ - new Benchmark(name, false, false, 0, test, testSetup, ()=>{}) - ]); -} - -benchy('DoubleSome', DoubleSome, DoubleSomeSetup); -benchy('SmiSome', SmiSome, SmiSomeSetup); -benchy('FastSome', FastSome, FastSomeSetup); -benchy('OptFastSome', OptFastSome, FastSomeSetup); - -var array; -// Initialize func variable to ensure the first test doesn't benefit from -// global object property tracking. -var func = 0; -var this_arg; -var result; -var array_size = 100; - -// Although these functions have the same code, they are separated for -// clean IC feedback. -function DoubleSome() { - result = array.some(func, this_arg); -} -function SmiSome() { - result = array.some(func, this_arg); -} -function FastSome() { - result = array.some(func, this_arg); -} +(() => { // Make sure we inline the callback, pick up all possible TurboFan // optimizations. @@ -50,20 +19,19 @@ function RunOptFastSome(multiple) { %NeverOptimizeFunction(OptFastSome); function OptFastSome() { RunOptFastSome(3); } -function SmiSomeSetup() { - array = new Array(); - for (var i = 0; i < array_size; i++) array[i] = i; - func = (value, index, object) => { return value === 34343; }; +function side_effect(a) { return a; } +%NeverOptimizeFunction(side_effect); +function OptUnreliableSome() { + result = array.some(func, side_effect(array)); } -function DoubleSomeSetup() { - array = new Array(); - for (var i = 0; i < array_size; i++) array[i] = (i + 0.5); - func = (value, index, object) => { return value < 0.0; }; -} +DefineHigherOrderTests([ + // name, test function, setup function, user callback + "DoubleSome", mc("some"), DoubleSetup, v => v < 0.0, + "SmiSome", mc("some"), SmiSetup, v => v === 34343, + "FastSome", mc("some"), FastSetup, v => v === 'hi', + "OptFastSome", OptFastSome, FastSetup, undefined, + "OptUnreliableSome", OptUnreliableSome, FastSetup, v => v === 'hi' +]); -function FastSomeSetup() { - array = new Array(); - for (var i = 0; i < array_size; i++) array[i] = 'value ' + i; - func = (value, index, object) => { return value === 'hi'; }; -} +})(); diff --git a/deps/v8/test/js-perf-test/Array/to-string.js b/deps/v8/test/js-perf-test/Array/to-string.js index c6a66d726b..1b6dd36eaa 100644 --- a/deps/v8/test/js-perf-test/Array/to-string.js +++ b/deps/v8/test/js-perf-test/Array/to-string.js @@ -1,52 +1,39 @@ // 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. +(() => { -function benchy(name, test, testSetup) { - new BenchmarkSuite(name, [1000], - [ - new Benchmark(name, false, false, 0, test, testSetup, ()=>{}) - ]); +function make_tostring() { + return new Function("result = array.toString();"); } -benchy('SmiToString', SmiToString, SmiToStringSetup); -benchy('StringToString', StringToString, StringToStringSetup); -benchy('SparseSmiToString', SparseSmiToString, SparseSmiToStringSetup); -benchy('SparseStringToString', SparseStringToString, SparseStringToStringSetup); +benchy('SmiToString', make_tostring(), SmiToStringSetup); +benchy('StringToString', make_tostring(), StringToStringSetup); +benchy('SparseSmiToString', make_tostring(), SparseSmiToStringSetup); +benchy('SparseStringToString', make_tostring(), SparseStringToStringSetup); var array; var result; var array_size = 1000; - -// Although these functions have the same code, they are separated for -// clean IC feedback. -function SmiToString() { - result = array.toString(); -} -function StringToString() { - result = array.toString(); -} -function SparseSmiToString() { - result = array.toString(); -} -function SparseStringToString() { - result = array.toString(); -} - function SmiToStringSetup() { array = new Array(); for (var i = 0; i < array_size; ++i) array[i] = i; } + function StringToStringSetup() { array = new Array(); for (var i = 0; i < array_size; ++i) array[i] = `Item no. ${i}`; } + function SparseSmiToStringSetup() { SmiToStringSetup(); array.length = array.length * 2; } + function SparseStringToStringSetup() { StringToStringSetup(); array.length = array.length * 2; } + +})(); diff --git a/deps/v8/test/js-perf-test/JSTests.json b/deps/v8/test/js-perf-test/JSTests.json index 6b0076f6fb..a1a19f5988 100644 --- a/deps/v8/test/js-perf-test/JSTests.json +++ b/deps/v8/test/js-perf-test/JSTests.json @@ -180,13 +180,17 @@ "name": "Strings", "path": ["Strings"], "main": "run.js", - "resources": ["harmony-string.js"], + "resources": ["harmony-string.js", "string-indexof.js"], "results_regexp": "^%s\\-Strings\\(Score\\): (.+)$", "run_count": 1, "timeout": 240, "timeout_arm": 420, "tests": [ - {"name": "StringFunctions"} + {"name": "StringFunctions"}, + {"name": "StringIndexOfConstant"}, + {"name": "StringIndexOfNonConstant"}, + {"name": "StringCharCodeAtConstant"}, + {"name": "StringCharCodeAtNonConstant"} ] }, { @@ -367,10 +371,22 @@ "test_flags": ["set-from-same-type"] }, { + "name": "SliceNoSpecies", + "main": "run.js", + "resources": ["slice-nospecies.js"], + "test_flags": ["slice-nospecies"] + }, + { "name": "Sort", "main": "run.js", "resources": ["sort.js"], "test_flags": ["sort"] + }, + { + "name": "SubarrayNoSpecies", + "main": "run.js", + "resources": ["subarray-nospecies.js"], + "test_flags": ["subarray-nospecies"] } ] }, @@ -380,29 +396,40 @@ "main": "run.js", "resources": [ "filter.js", "map.js", "every.js", "join.js", "some.js", - "reduce.js", "reduce-right.js", "to-string.js" + "reduce.js", "reduce-right.js", "to-string.js", "find.js", + "find-index.js", "of.js" ], "flags": [ "--allow-natives-syntax" ], "results_regexp": "^%s\\-Array\\(Score\\): (.+)$", "tests": [ + {"name": "NaiveForEachReplacement"}, + {"name": "DoubleForEach"}, + {"name": "SmiForEach"}, + {"name": "FastForEach"}, + {"name": "GenericForEach"}, + {"name": "OptFastForEach"}, + {"name": "OptUnreliableForEach"}, {"name": "NaiveFilterReplacement"}, {"name": "DoubleFilter"}, {"name": "SmiFilter"}, {"name": "FastFilter"}, {"name": "GenericFilter"}, {"name": "OptFastFilter"}, + {"name": "OptUnreliableFilter"}, {"name": "NaiveMapReplacement"}, {"name": "DoubleMap"}, {"name": "SmiMap"}, {"name": "FastMap"}, {"name": "GenericMap"}, {"name": "OptFastMap"}, + {"name": "OptUnreliableMap"}, {"name": "DoubleEvery"}, {"name": "SmiEvery"}, {"name": "FastEvery"}, {"name": "OptFastEvery"}, + {"name": "OptUnreliableEvery"}, {"name": "SmiJoin"}, {"name": "StringJoin"}, {"name": "SparseSmiJoin"}, @@ -411,18 +438,42 @@ {"name": "SmiSome"}, {"name": "FastSome"}, {"name": "OptFastSome"}, + {"name": "OptUnreliableSome"}, {"name": "DoubleReduce"}, {"name": "SmiReduce"}, {"name": "FastReduce"}, {"name": "OptFastReduce"}, + {"name": "OptUnreliableReduce"}, {"name": "DoubleReduceRight"}, {"name": "SmiReduceRight"}, {"name": "FastReduceRight"}, {"name": "OptFastReduceRight"}, + {"name": "OptUnreliableReduceRight"}, {"name": "SmiToString"}, {"name": "StringToString"}, {"name": "SparseSmiToString"}, - {"name": "SparseStringToString"} + {"name": "SparseStringToString"}, + {"name": "NaiveFindReplacement"}, + {"name": "DoubleFind"}, + {"name": "SmiFind"}, + {"name": "FastFind"}, + {"name": "GenericFind"}, + {"name": "OptFastFind"}, + {"name": "OptUnreliableFind"}, + {"name": "NaiveFindIndexReplacement"}, + {"name": "DoubleFindIndex"}, + {"name": "SmiFindIndex"}, + {"name": "FastFindIndex"}, + {"name": "GenericFindIndex"}, + {"name": "OptFastFindIndex"}, + {"name": "OptUnreliableFindIndex"}, + {"name": "EmptyArrayOf"}, + {"name": "SmallSmiArrayOf"}, + {"name": "LargeSmiArrayOf"}, + {"name": "SmallTransplantedArrayOf"}, + {"name": "SmallDoubleArrayOf"}, + {"name": "SmallStringArrayOf"}, + {"name": "SmallMixedArrayOf"} ] }, { @@ -514,6 +565,7 @@ "resources": [ "arithmetic.js" ], "test_flags": [ "arithmetic" ], "results_regexp": "^%s\\-BytecodeHandler\\(Score\\): (.+)$", + "timeout": 240, "tests": [ {"name": "Smi-Add"}, {"name": "Number-Add"}, diff --git a/deps/v8/test/js-perf-test/Strings/run.js b/deps/v8/test/js-perf-test/Strings/run.js index 79ca26e68a..66dd9b2188 100644 --- a/deps/v8/test/js-perf-test/Strings/run.js +++ b/deps/v8/test/js-perf-test/Strings/run.js @@ -5,6 +5,7 @@ load('../base.js'); load('harmony-string.js'); +load('string-indexof.js'); var success = true; diff --git a/deps/v8/test/js-perf-test/Strings/string-indexof.js b/deps/v8/test/js-perf-test/Strings/string-indexof.js new file mode 100644 index 0000000000..a2049e0fe6 --- /dev/null +++ b/deps/v8/test/js-perf-test/Strings/string-indexof.js @@ -0,0 +1,69 @@ +// 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. + +new BenchmarkSuite('StringIndexOfConstant', [5], [ + new Benchmark('StringIndexOfConstant', true, false, 0, + StringIndexOfConstant), +]); + +new BenchmarkSuite('StringIndexOfNonConstant', [5], [ + new Benchmark('StringIndexOfNonConstant', true, false, 0, + StringIndexOfNonConstant), +]); + +const subject = "aaaaaaaaaaaaaaaab"; +const searches = ['a', 'b', 'c']; + +function StringIndexOfConstant() { + var sum = 0; + + for (var j = 0; j < searches.length; ++j) { + sum += subject.indexOf("" + searches[j]); + } + + return sum; +} + +function StringIndexOfNonConstant() { + var sum = 0; + + for (var j = 0; j < searches.length; ++j) { + sum += subject.indexOf(searches[j]); + } + + return sum; +} + +new BenchmarkSuite('StringCharCodeAtConstant', [3], [ + new Benchmark('StringIndexOfConstant', true, false, 0, + StringCharCodeAtConstant), +]); + +new BenchmarkSuite('StringCharCodeAtNonConstant', [3], [ + new Benchmark('StringIndexOfNonConstant', true, false, 0, + StringCharCodeAtNonConstant), +]); + +const string = "qweruiplkjhgfdsazxccvbnm"; +const indices = [1, 13, 32, 100, "xx"]; + +function StringCharCodeAtConstant() { + var sum = 0; + + for (var j = 0; j < indices.length - 1; ++j) { + sum += string.charCodeAt(indices[j] | 0); + } + + return sum; +} + +function StringCharCodeAtNonConstant() { + var sum = 0; + + for (var j = 0; j < indices.length - 1; ++j) { + sum += string.charCodeAt(indices[j]); + } + + return sum; +} diff --git a/deps/v8/test/js-perf-test/TypedArrays/slice-nospecies.js b/deps/v8/test/js-perf-test/TypedArrays/slice-nospecies.js new file mode 100644 index 0000000000..4195d71a3d --- /dev/null +++ b/deps/v8/test/js-perf-test/TypedArrays/slice-nospecies.js @@ -0,0 +1,34 @@ +// 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. + +new BenchmarkSuite('SliceNoSpecies', [1000], [ + new Benchmark('SliceNoSpecies', false, false, 0, + slice, sliceSetup, sliceTearDown), +]); + +var size = 1000; +var initialFloat64Array = new Float64Array(size); +for (var i = 0; i < size; ++i) { + initialFloat64Array[i] = Math.random(); +} +var arr; +var new_arr; + +function slice() { + new_arr = arr.slice(1, -1); +} + +function sliceSetup() { + arr = new Float64Array(initialFloat64Array); +} + +function sliceTearDown() { + for (var i = 1; i < size - 1; ++i) { + if (arr[i] != new_arr[i - 1]) { + throw new TypeError("Unexpected result!\n" + new_arr); + } + } + arr = void 0; + new_arr = void 0; +} diff --git a/deps/v8/test/js-perf-test/TypedArrays/subarray-nospecies.js b/deps/v8/test/js-perf-test/TypedArrays/subarray-nospecies.js new file mode 100644 index 0000000000..732dbff1de --- /dev/null +++ b/deps/v8/test/js-perf-test/TypedArrays/subarray-nospecies.js @@ -0,0 +1,34 @@ +// 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. + +new BenchmarkSuite('SubarrayNoSpecies', [1000], [ + new Benchmark('SubarrayNoSpecies', false, false, 0, + subarray, subarraySetup, subarrayTearDown), +]); + +var size = 1000; +var initialFloat64Array = new Float64Array(size); +for (var i = 0; i < size; ++i) { + initialFloat64Array[i] = Math.random(); +} +var arr; +var new_arr; + +function subarray() { + new_arr = arr.subarray(1, -1); +} + +function subarraySetup() { + arr = new Float64Array(initialFloat64Array); +} + +function subarrayTearDown() { + for (var i = 1; i < size - 1; ++i) { + if (arr[i] != new_arr[i - 1]) { + throw new TypeError("Unexpected result!\n" + new_arr); + } + } + arr = void 0; + new_arr = void 0; +} diff --git a/deps/v8/test/message/fail/array-binding-pattern-await1.js b/deps/v8/test/message/fail/array-binding-pattern-await1.js new file mode 100644 index 0000000000..09afccc09f --- /dev/null +++ b/deps/v8/test/message/fail/array-binding-pattern-await1.js @@ -0,0 +1,9 @@ +// 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. + +async function f() { + let [await b] = []; + return b; +} +f(); diff --git a/deps/v8/test/message/fail/array-binding-pattern-await1.out b/deps/v8/test/message/fail/array-binding-pattern-await1.out new file mode 100644 index 0000000000..9ebe2433ed --- /dev/null +++ b/deps/v8/test/message/fail/array-binding-pattern-await1.out @@ -0,0 +1,4 @@ +*%(basename)s:6: SyntaxError: Invalid destructuring assignment target + let [await b] = []; + ^^^^^^^ +SyntaxError: Invalid destructuring assignment target diff --git a/deps/v8/test/message/fail/class-field-static-constructor.js b/deps/v8/test/message/fail/class-field-static-constructor.js index b64cf6254c..63ce1c04d7 100644 --- a/deps/v8/test/message/fail/class-field-static-constructor.js +++ b/deps/v8/test/message/fail/class-field-static-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: --harmony-public-fields +// Flags: --harmony-public-fields --harmony-static-fields class X { static constructor = function() {}; diff --git a/deps/v8/test/message/fail/class-field-static-prototype.js b/deps/v8/test/message/fail/class-field-static-prototype.js index da8120481a..656518879a 100644 --- a/deps/v8/test/message/fail/class-field-static-prototype.js +++ b/deps/v8/test/message/fail/class-field-static-prototype.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-public-fields +// Flags: --harmony-public-fields --harmony-static-fields class X { static prototype = function() {}; diff --git a/deps/v8/test/message/fail/modules-cycle1.out b/deps/v8/test/message/fail/modules-cycle1.out index 3e6f31b1d4..ef6b57f074 100644 --- a/deps/v8/test/message/fail/modules-cycle1.out +++ b/deps/v8/test/message/fail/modules-cycle1.out @@ -1,5 +1,5 @@ -*%(basename)s:7: SyntaxError: Detected cycle while resolving name 'a' +*%(basename)s:7: SyntaxError: Detected cycle while resolving name 'a' in 'modules-cycle1.js' import {a} from "modules-cycle1.js"; ^ -SyntaxError: Detected cycle while resolving name 'a' +SyntaxError: Detected cycle while resolving name 'a' in 'modules-cycle1.js' diff --git a/deps/v8/test/message/fail/modules-cycle2.out b/deps/v8/test/message/fail/modules-cycle2.out index f3c19d20ed..c0d785fe6c 100644 --- a/deps/v8/test/message/fail/modules-cycle2.out +++ b/deps/v8/test/message/fail/modules-cycle2.out @@ -1,5 +1,5 @@ -*%(basename)s:7: SyntaxError: Detected cycle while resolving name 'a' +*%(basename)s:7: SyntaxError: Detected cycle while resolving name 'a' in 'modules-skip-cycle2.js' import {a} from "modules-skip-cycle2.js"; ^ -SyntaxError: Detected cycle while resolving name 'a' +SyntaxError: Detected cycle while resolving name 'a' in 'modules-skip-cycle2.js' diff --git a/deps/v8/test/message/fail/modules-cycle3.out b/deps/v8/test/message/fail/modules-cycle3.out index a5b10149f9..51bf9078cc 100644 --- a/deps/v8/test/message/fail/modules-cycle3.out +++ b/deps/v8/test/message/fail/modules-cycle3.out @@ -1,5 +1,5 @@ -*%(basename)s:7: SyntaxError: Detected cycle while resolving name 'a' +*%(basename)s:7: SyntaxError: Detected cycle while resolving name 'a' in 'modules-skip-cycle3.js' export {a as x} from "modules-skip-cycle3.js"; ^^^^^^ -SyntaxError: Detected cycle while resolving name 'a' +SyntaxError: Detected cycle while resolving name 'a' in 'modules-skip-cycle3.js' diff --git a/deps/v8/test/message/fail/modules-cycle4.out b/deps/v8/test/message/fail/modules-cycle4.out index 74789e0ec9..6e27ced3ad 100644 --- a/deps/v8/test/message/fail/modules-cycle4.out +++ b/deps/v8/test/message/fail/modules-cycle4.out @@ -1,5 +1,5 @@ -*modules-cycle3.js:7: SyntaxError: Detected cycle while resolving name 'a' +*modules-cycle3.js:7: SyntaxError: Detected cycle while resolving name 'a' in 'modules-skip-cycle3.js' export {a as x} from "modules-skip-cycle3.js"; ^^^^^^ -SyntaxError: Detected cycle while resolving name 'a' +SyntaxError: Detected cycle while resolving name 'a' in 'modules-skip-cycle3.js' diff --git a/deps/v8/test/message/fail/modules-cycle5.out b/deps/v8/test/message/fail/modules-cycle5.out index 8eb3e606af..c97cc8d0a4 100644 --- a/deps/v8/test/message/fail/modules-cycle5.out +++ b/deps/v8/test/message/fail/modules-cycle5.out @@ -1,5 +1,5 @@ -*%(basename)s:8: SyntaxError: Detected cycle while resolving name 'foo' +*%(basename)s:8: SyntaxError: Detected cycle while resolving name 'foo' in 'modules-cycle5.js' export {foo} from "modules-cycle5.js"; ^^^ -SyntaxError: Detected cycle while resolving name 'foo' +SyntaxError: Detected cycle while resolving name 'foo' in 'modules-cycle5.js' diff --git a/deps/v8/test/message/fail/modules-cycle6.out b/deps/v8/test/message/fail/modules-cycle6.out index d91e1abc14..ed0e409d5c 100644 --- a/deps/v8/test/message/fail/modules-cycle6.out +++ b/deps/v8/test/message/fail/modules-cycle6.out @@ -1,5 +1,5 @@ -*modules-skip-cycle6.js:5: SyntaxError: The requested module does not provide an export named 'foo' +*modules-skip-cycle6.js:5: SyntaxError: The requested module 'modules-cycle6.js' does not provide an export named 'foo' export {foo} from "modules-cycle6.js"; ^^^ -SyntaxError: The requested module does not provide an export named 'foo' +SyntaxError: The requested module 'modules-cycle6.js' does not provide an export named 'foo' diff --git a/deps/v8/test/message/fail/modules-import1.out b/deps/v8/test/message/fail/modules-import1.out index 6facd0fa7c..ce023698f8 100644 --- a/deps/v8/test/message/fail/modules-import1.out +++ b/deps/v8/test/message/fail/modules-import1.out @@ -1,5 +1,5 @@ -*%(basename)s:7: SyntaxError: The requested module does not provide an export named 'a' +*%(basename)s:7: SyntaxError: The requested module 'modules-import1.js' does not provide an export named 'a' import {a} from "modules-import1.js"; ^ -SyntaxError: The requested module does not provide an export named 'a' +SyntaxError: The requested module 'modules-import1.js' does not provide an export named 'a' diff --git a/deps/v8/test/message/fail/modules-import2.out b/deps/v8/test/message/fail/modules-import2.out index 317399a6db..485419721d 100644 --- a/deps/v8/test/message/fail/modules-import2.out +++ b/deps/v8/test/message/fail/modules-import2.out @@ -1,5 +1,5 @@ -*%(basename)s:7: SyntaxError: The requested module does not provide an export named 'a' +*%(basename)s:7: SyntaxError: The requested module 'modules-import2.js' does not provide an export named 'a' import {a as b} from "modules-import2.js"; ^ -SyntaxError: The requested module does not provide an export named 'a' +SyntaxError: The requested module 'modules-import2.js' does not provide an export named 'a' diff --git a/deps/v8/test/message/fail/modules-import3.out b/deps/v8/test/message/fail/modules-import3.out index 75abc74b50..fd6904d003 100644 --- a/deps/v8/test/message/fail/modules-import3.out +++ b/deps/v8/test/message/fail/modules-import3.out @@ -1,5 +1,5 @@ -*%(basename)s:7: SyntaxError: The requested module does not provide an export named 'default' +*%(basename)s:7: SyntaxError: The requested module 'modules-import3.js' does not provide an export named 'default' import foo from "modules-import3.js"; ^^^ -SyntaxError: The requested module does not provide an export named 'default' +SyntaxError: The requested module 'modules-import3.js' does not provide an export named 'default' diff --git a/deps/v8/test/message/fail/modules-import4.out b/deps/v8/test/message/fail/modules-import4.out index bd406e4021..8193d9e4c8 100644 --- a/deps/v8/test/message/fail/modules-import4.out +++ b/deps/v8/test/message/fail/modules-import4.out @@ -1,5 +1,5 @@ -*%(basename)s:8: SyntaxError: The requested module does not provide an export named 'c' +*%(basename)s:8: SyntaxError: The requested module 'modules-import4.js' does not provide an export named 'c' export {c as a} from "modules-import4.js"; ^^^^^^ -SyntaxError: The requested module does not provide an export named 'c' +SyntaxError: The requested module 'modules-import4.js' does not provide an export named 'c' diff --git a/deps/v8/test/message/fail/modules-import5.out b/deps/v8/test/message/fail/modules-import5.out index 8828774c92..3efb69258e 100644 --- a/deps/v8/test/message/fail/modules-import5.out +++ b/deps/v8/test/message/fail/modules-import5.out @@ -1,5 +1,5 @@ -*%(basename)s:8: SyntaxError: The requested module does not provide an export named 'c' +*%(basename)s:8: SyntaxError: The requested module 'modules-import5.js' does not provide an export named 'c' export {c as a} from "modules-import5.js"; ^^^^^^ -SyntaxError: The requested module does not provide an export named 'c' +SyntaxError: The requested module 'modules-import5.js' does not provide an export named 'c' diff --git a/deps/v8/test/message/fail/modules-import6.out b/deps/v8/test/message/fail/modules-import6.out index 9d7eeebe5d..43e81135c4 100644 --- a/deps/v8/test/message/fail/modules-import6.out +++ b/deps/v8/test/message/fail/modules-import6.out @@ -1,5 +1,5 @@ -*%(basename)s:9: SyntaxError: The requested module does not provide an export named 'c' +*%(basename)s:9: SyntaxError: The requested module 'modules-import6.js' does not provide an export named 'c' import {c} from "modules-import6.js"; ^ -SyntaxError: The requested module does not provide an export named 'c' +SyntaxError: The requested module 'modules-import6.js' does not provide an export named 'c' diff --git a/deps/v8/test/message/fail/modules-star-conflict1.out b/deps/v8/test/message/fail/modules-star-conflict1.out index 969a566edc..db8671165b 100644 --- a/deps/v8/test/message/fail/modules-star-conflict1.out +++ b/deps/v8/test/message/fail/modules-star-conflict1.out @@ -1,5 +1,5 @@ -*%(basename)s:7: SyntaxError: The requested module contains conflicting star exports for name 'a' +*%(basename)s:7: SyntaxError: The requested module '../../mjsunit/modules-skip-7.js' contains conflicting star exports for name 'a' import {a} from "../../mjsunit/modules-skip-7.js"; ^ -SyntaxError: The requested module contains conflicting star exports for name 'a' +SyntaxError: The requested module '../../mjsunit/modules-skip-7.js' contains conflicting star exports for name 'a' diff --git a/deps/v8/test/message/fail/modules-star-conflict2.out b/deps/v8/test/message/fail/modules-star-conflict2.out index 34827e0374..d6decf733d 100644 --- a/deps/v8/test/message/fail/modules-star-conflict2.out +++ b/deps/v8/test/message/fail/modules-star-conflict2.out @@ -1,5 +1,5 @@ -*%(basename)s:7: SyntaxError: The requested module contains conflicting star exports for name 'a' +*%(basename)s:7: SyntaxError: The requested module '../../mjsunit/modules-skip-star-exports-conflict.js' contains conflicting star exports for name 'a' export * from "../../mjsunit/modules-skip-star-exports-conflict.js"; ^ -SyntaxError: The requested module contains conflicting star exports for name 'a' +SyntaxError: The requested module '../../mjsunit/modules-skip-star-exports-conflict.js' contains conflicting star exports for name 'a' diff --git a/deps/v8/test/message/fail/modules-star-default.out b/deps/v8/test/message/fail/modules-star-default.out index a3cd5a6107..1524a7cba6 100644 --- a/deps/v8/test/message/fail/modules-star-default.out +++ b/deps/v8/test/message/fail/modules-star-default.out @@ -1,5 +1,5 @@ -*modules-import4.js:8: SyntaxError: The requested module does not provide an export named 'c' +*modules-import4.js:8: SyntaxError: The requested module 'modules-import4.js' does not provide an export named 'c' export {c as a} from "modules-import4.js"; ^^^^^^ -SyntaxError: The requested module does not provide an export named 'c' +SyntaxError: The requested module 'modules-import4.js' does not provide an export named 'c' diff --git a/deps/v8/test/message/fail/object-binding-pattern-await1.js b/deps/v8/test/message/fail/object-binding-pattern-await1.js new file mode 100644 index 0000000000..8ef7b25866 --- /dev/null +++ b/deps/v8/test/message/fail/object-binding-pattern-await1.js @@ -0,0 +1,9 @@ +// 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. + +async function f() { + let { a: await b } = { a: 1 }; + return b; +} +f(); diff --git a/deps/v8/test/message/fail/object-binding-pattern-await1.out b/deps/v8/test/message/fail/object-binding-pattern-await1.out new file mode 100644 index 0000000000..ee7a3eafb6 --- /dev/null +++ b/deps/v8/test/message/fail/object-binding-pattern-await1.out @@ -0,0 +1,4 @@ +*%(basename)s:6: SyntaxError: Invalid destructuring assignment target + let { a: await b } = { a: 1 }; + ^^^^^^^ +SyntaxError: Invalid destructuring assignment target diff --git a/deps/v8/test/message/message.status b/deps/v8/test/message/message.status index 1c40a25186..6aba054251 100644 --- a/deps/v8/test/message/message.status +++ b/deps/v8/test/message/message.status @@ -37,9 +37,10 @@ 'fail/modules-skip*': [SKIP], }], # ALWAYS -############################################################################## -# BUG(v8:7138). -['arch == arm and not simulator_run and variant == wasm_traps', { - '*': [SKIP], -}], # arch == arm and not simulator_run and variant == wasm_traps +# Liftoff is currently only sufficiently implemented on x64 and ia32. +# TODO(clemensh): Implement on all other platforms (crbug.com/v8/6600). +['arch != x64 and arch != ia32', { + 'wasm-trace-memory-liftoff': [SKIP], +}], # arch != x64 and arch != ia32 + ] diff --git a/deps/v8/test/message/object-binding-pattern-await-computed-name.js b/deps/v8/test/message/object-binding-pattern-await-computed-name.js new file mode 100644 index 0000000000..1b40d0d4a9 --- /dev/null +++ b/deps/v8/test/message/object-binding-pattern-await-computed-name.js @@ -0,0 +1,9 @@ +// 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. + +async function f() { + let { [await "a"]: a } = { a: 1 }; + return a; +} +f(); diff --git a/deps/v8/test/message/object-binding-pattern-await-computed-name.out b/deps/v8/test/message/object-binding-pattern-await-computed-name.out new file mode 100644 index 0000000000..e69de29bb2 --- /dev/null +++ b/deps/v8/test/message/object-binding-pattern-await-computed-name.out diff --git a/deps/v8/test/message/testcfg.py b/deps/v8/test/message/testcfg.py index 28a1e641f6..cd1495f390 100644 --- a/deps/v8/test/message/testcfg.py +++ b/deps/v8/test/message/testcfg.py @@ -25,24 +25,20 @@ # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -import itertools import os import re from testrunner.local import testsuite from testrunner.local import utils from testrunner.objects import testcase +from testrunner.outproc import message -FLAGS_PATTERN = re.compile(r"//\s+Flags:(.*)") INVALID_FLAGS = ["--enable-slow-asserts"] MODULE_PATTERN = re.compile(r"^// MODULE$", flags=re.MULTILINE) -class MessageTestSuite(testsuite.TestSuite): - def __init__(self, name, root): - super(MessageTestSuite, self).__init__(name, root) - +class TestSuite(testsuite.TestSuite): def ListTests(self, context): tests = [] for dirname, dirs, files in os.walk(self.root): @@ -55,80 +51,64 @@ class MessageTestSuite(testsuite.TestSuite): fullpath = os.path.join(dirname, filename) relpath = fullpath[len(self.root) + 1 : -3] testname = relpath.replace(os.path.sep, "/") - test = testcase.TestCase(self, testname) + test = self._create_test(testname) tests.append(test) return tests - def CreateVariantGenerator(self, variants): - return super(MessageTestSuite, self).CreateVariantGenerator( + def _test_class(self): + return TestCase + + def CreateLegacyVariantsGenerator(self, variants): + return super(TestSuite, self).CreateLegacyVariantsGenerator( variants + ["preparser"]) - def GetParametersForTestCase(self, testcase, context): - source = self.GetSourceForTest(testcase) + def create_variant_proc(self, variants): + return super(TestSuite, self).create_variant_proc(variants + ['preparser']) + + +class TestCase(testcase.TestCase): + def __init__(self, *args, **kwargs): + super(TestCase, self).__init__(*args, **kwargs) + + source = self.get_source() + self._source_files = self._parse_source_files(source) + self._source_flags = self._parse_source_flags(source) + + def _parse_source_files(self, source): files = [] if MODULE_PATTERN.search(source): files.append("--module") - files.append(os.path.join(self.root, testcase.path + ".js")) - flags = testcase.flags + context.mode_flags - flags_match = re.findall(FLAGS_PATTERN, source) - for match in flags_match: - flags += match.strip().split() - flags = [x for x in flags if x not in INVALID_FLAGS] - return files, flags, {} - - def GetSourceForTest(self, testcase): - filename = os.path.join(self.root, testcase.path + self.suffix()) - with open(filename) as f: - return f.read() - - def _IgnoreLine(self, string): - """Ignore empty lines, valgrind output, Android output.""" - if not string: return True - if not string.strip(): return True - return (string.startswith("==") or string.startswith("**") or - string.startswith("ANDROID")) - - def _GetExpectedFail(self, testcase): - path = testcase.path + files.append(os.path.join(self.suite.root, self.path + ".js")) + return files + + def _expected_fail(self): + path = self.path while path: - (head, tail) = os.path.split(path) - if tail == "fail": + head, tail = os.path.split(path) + if tail == 'fail': return True path = head return False - def IsFailureOutput(self, testcase): - output = testcase.output - testpath = testcase.path - expected_fail = self._GetExpectedFail(testcase) - fail = testcase.output.exit_code != 0 - if expected_fail != fail: - return True - expected_path = os.path.join(self.root, testpath + ".out") - expected_lines = [] - # Can't use utils.ReadLinesFrom() here because it strips whitespace. - with open(expected_path) as f: - for line in f: - if line.startswith("#") or not line.strip(): continue - expected_lines.append(line) - raw_lines = output.stdout.splitlines() - actual_lines = [ s for s in raw_lines if not self._IgnoreLine(s) ] - env = { "basename": os.path.basename(testpath + ".js") } - if len(expected_lines) != len(actual_lines): - return True - for (expected, actual) in itertools.izip_longest( - expected_lines, actual_lines, fillvalue=''): - pattern = re.escape(expected.rstrip() % env) - pattern = pattern.replace("\\*", ".*") - pattern = pattern.replace("\\{NUMBER\\}", "\d+(?:\.\d*)?") - pattern = "^%s$" % pattern - if not re.match(pattern, actual): - return True - return False + def _get_cmd_params(self, ctx): + params = super(TestCase, self)._get_cmd_params(ctx) + return [p for p in params if p not in INVALID_FLAGS] + + def _get_files_params(self, ctx): + return self._source_files + + def _get_source_flags(self): + return self._source_flags + + def _get_source_path(self): + return os.path.join(self.suite.root, self.path + self._get_suffix()) - def StripOutputForTransmit(self, testcase): - pass + @property + def output_proc(self): + return message.OutProc(self.expected_outcomes, + os.path.join(self.suite.root, self.path), + self._expected_fail()) def GetSuite(name, root): - return MessageTestSuite(name, root) + return TestSuite(name, root) diff --git a/deps/v8/test/message/wasm-trace-memory-interpreted.out b/deps/v8/test/message/wasm-trace-memory-interpreted.out index 6854727885..7865195649 100644 --- a/deps/v8/test/message/wasm-trace-memory-interpreted.out +++ b/deps/v8/test/message/wasm-trace-memory-interpreted.out @@ -1,9 +1,9 @@ -I 0+0x3 read @00000004 i32:0 / 00000000 -I 1+0x3 read @00000001 i8:0 / 00 +I 0+0x3 load @00000004 i32:0 / 00000000 +I 1+0x3 load @00000001 i8:0 / 00 I 3+0x5 store @00000004 i32:305419896 / 12345678 -I 0+0x3 read @00000002 i32:1450704896 / 56780000 -I 1+0x3 read @00000006 i8:52 / 34 -I 2+0x3 read @00000002 f32:68169720922112.000000 / 56780000 +I 0+0x3 load @00000002 i32:1450704896 / 56780000 +I 1+0x3 load @00000006 i8:52 / 34 +I 2+0x3 load @00000002 f32:68169720922112.000000 / 56780000 I 4+0x5 store @00000004 i8:171 / ab -I 0+0x3 read @00000002 i32:1454047232 / 56ab0000 -I 2+0x3 read @00000002 f32:94008244174848.000000 / 56ab0000 +I 0+0x3 load @00000002 i32:1454047232 / 56ab0000 +I 2+0x3 load @00000002 f32:94008244174848.000000 / 56ab0000 diff --git a/deps/v8/test/message/wasm-trace-memory-liftoff.js b/deps/v8/test/message/wasm-trace-memory-liftoff.js new file mode 100644 index 0000000000..00b6421c1b --- /dev/null +++ b/deps/v8/test/message/wasm-trace-memory-liftoff.js @@ -0,0 +1,7 @@ +// 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: --no-stress-opt --expose-wasm --wasm-trace-memory --liftoff + +load("test/message/wasm-trace-memory.js"); diff --git a/deps/v8/test/message/wasm-trace-memory-liftoff.out b/deps/v8/test/message/wasm-trace-memory-liftoff.out new file mode 100644 index 0000000000..26f22a5498 --- /dev/null +++ b/deps/v8/test/message/wasm-trace-memory-liftoff.out @@ -0,0 +1,9 @@ +L 0+0x3 load @00000004 i32:0 / 00000000 +L 1+0x3 load @00000001 i8:0 / 00 +L 3+0x5 store @00000004 i32:305419896 / 12345678 +L 0+0x3 load @00000002 i32:1450704896 / 56780000 +L 1+0x3 load @00000006 i8:52 / 34 +L 2+0x3 load @00000002 f32:68169720922112.000000 / 56780000 +L 4+0x5 store @00000004 i8:171 / ab +L 0+0x3 load @00000002 i32:1454047232 / 56ab0000 +L 2+0x3 load @00000002 f32:94008244174848.000000 / 56ab0000 diff --git a/deps/v8/test/message/wasm-trace-memory.js b/deps/v8/test/message/wasm-trace-memory.js index 6c33b900b1..1beb76a01b 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 --expose-wasm --wasm-trace-memory +// Flags: --no-stress-opt --expose-wasm --wasm-trace-memory --no-liftoff load("test/mjsunit/wasm/wasm-constants.js"); load("test/mjsunit/wasm/wasm-module-builder.js"); diff --git a/deps/v8/test/message/wasm-trace-memory.out b/deps/v8/test/message/wasm-trace-memory.out index 12cbd180a0..37faa6a989 100644 --- a/deps/v8/test/message/wasm-trace-memory.out +++ b/deps/v8/test/message/wasm-trace-memory.out @@ -1,9 +1,9 @@ -C 0+0x3 read @00000004 i32:0 / 00000000 -C 1+0x3 read @00000001 i8:0 / 00 -C 3+0x5 store @00000004 i32:305419896 / 12345678 -C 0+0x3 read @00000002 i32:1450704896 / 56780000 -C 1+0x3 read @00000006 i8:52 / 34 -C 2+0x3 read @00000002 f32:68169720922112.000000 / 56780000 -C 4+0x5 store @00000004 i8:171 / ab -C 0+0x3 read @00000002 i32:1454047232 / 56ab0000 -C 2+0x3 read @00000002 f32:94008244174848.000000 / 56ab0000 +T 0+0x3 load @00000004 i32:0 / 00000000 +T 1+0x3 load @00000001 i8:0 / 00 +T 3+0x5 store @00000004 i32:305419896 / 12345678 +T 0+0x3 load @00000002 i32:1450704896 / 56780000 +T 1+0x3 load @00000006 i8:52 / 34 +T 2+0x3 load @00000002 f32:68169720922112.000000 / 56780000 +T 4+0x5 store @00000004 i8:171 / ab +T 0+0x3 load @00000002 i32:1454047232 / 56ab0000 +T 2+0x3 load @00000002 f32:94008244174848.000000 / 56ab0000 diff --git a/deps/v8/test/mjsunit/array-iteration.js b/deps/v8/test/mjsunit/array-iteration.js index 9d03ed13ce..4de58208b4 100644 --- a/deps/v8/test/mjsunit/array-iteration.js +++ b/deps/v8/test/mjsunit/array-iteration.js @@ -73,6 +73,31 @@ assertEquals(3, count); for (var i in a) assertEquals(2, a[i]); + // Skip over missing properties. + a = { + "0": 0, + "2": 2, + length: 3 + }; + var received = []; + assertArrayEquals([2], + Array.prototype.filter.call(a, function(n) { + received.push(n); + return n == 2; + })); + assertArrayEquals([0, 2], received); + + // Modify array prototype + a = [0, , 2]; + received = []; + assertArrayEquals([2], + Array.prototype.filter.call(a, function(n) { + a.__proto__ = null; + received.push(n); + return n == 2; + })); + assertArrayEquals([0, 2], received); + // Create a new object in each function call when receiver is a // primitive value. See ECMA-262, Annex C. a = []; @@ -131,6 +156,26 @@ a.forEach(function(n) { count++; }); assertEquals(1, count); + // Skip over missing properties. + a = { + "0": 0, + "2": 2, + length: 3 + }; + var received = []; + Array.prototype.forEach.call(a, function(n) { received.push(n); }); + assertArrayEquals([0, 2], received); + + // Modify array prototype + a = [0, , 2]; + received = []; + Array.prototype.forEach.call(a, function(n) { + a.__proto__ = null; + received.push(n); + return n == 2; + }); + assertArrayEquals([0, 2], received); + // Create a new object in each function call when receiver is a // primitive value. See ECMA-262, Annex C. a = []; @@ -194,6 +239,31 @@ assertTrue(a.every(function(n) { count++; return n == 2; })); assertEquals(2, count); + // Skip over missing properties. + a = { + "0": 2, + "2": 2, + length: 3 + }; + var received = []; + assertTrue( + Array.prototype.every.call(a, function(n) { + received.push(n); + return n == 2; + })); + assertArrayEquals([2, 2], received); + + // Modify array prototype + a = [2, , 2]; + received = []; + assertTrue( + Array.prototype.every.call(a, function(n) { + a.__proto__ = null; + received.push(n); + return n == 2; + })); + assertArrayEquals([2, 2], received); + // Create a new object in each function call when receiver is a // primitive value. See ECMA-262, Annex C. a = []; @@ -252,6 +322,31 @@ a = a.map(function(n) { return 2*n; }); for (var i in a) assertEquals(4, a[i]); + // Skip over missing properties. + a = { + "0": 1, + "2": 2, + length: 3 + }; + var received = []; + assertArrayEquals([2, , 4], + Array.prototype.map.call(a, function(n) { + received.push(n); + return n * 2; + })); + assertArrayEquals([1, 2], received); + + // Modify array prototype + a = [1, , 2]; + received = []; + assertArrayEquals([2, , 4], + Array.prototype.map.call(a, function(n) { + a.__proto__ = null; + received.push(n); + return n * 2; + })); + assertArrayEquals([1, 2], received); + // Create a new object in each function call when receiver is a // primitive value. See ECMA-262, Annex C. a = []; diff --git a/deps/v8/test/mjsunit/array-reduce.js b/deps/v8/test/mjsunit/array-reduce.js index 4a4494a72c..171a40f092 100644 --- a/deps/v8/test/mjsunit/array-reduce.js +++ b/deps/v8/test/mjsunit/array-reduce.js @@ -25,6 +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: --allow-natives-syntax + /** * @fileoverview Test reduce and reduceRight */ @@ -557,3 +559,685 @@ assertEquals(undefined, arr.reduceRight(function(val) { return val })); }, 'initial') }, 'do not continue'); })(); + +(function OptimizedReduce() { + let f = (a,current) => a + current; + let g = function(a) { + return a.reduce(f); + } + let a = [1,2,3,4,5,6,7,8,9,10]; + g(a); g(a); + let total = g(a); + %OptimizeFunctionOnNextCall(g); + assertEquals(total, g(a)); +})(); + +(function OptimizedReduceEmpty() { + let f = (a,current) => a + current; + let g = function(a) { + return a.reduce(f); + } + let a = [1,2,3,4,5,6,7,8,9,10]; + g(a); g(a); g(a); + %OptimizeFunctionOnNextCall(g); + g(a); + assertThrows(() => g([])); +})(); + +(function OptimizedReduceLazyDeopt() { + let deopt = false; + let f = (a,current) => { if (deopt) %DeoptimizeNow(); return a + current; }; + let g = function(a) { + return a.reduce(f); + } + let a = [1,2,3,4,5,6,7,8,9,10]; + g(a); g(a); + let total = g(a); + %OptimizeFunctionOnNextCall(g); + g(a); + deopt = true; + assertEquals(total, g(a)); +})(); + +(function OptimizedReduceLazyDeoptMiddleOfIteration() { + let deopt = false; + let f = (a,current) => { + if (current == 6 && deopt) %DeoptimizeNow(); + return a + current; + }; + let g = function(a) { + return a.reduce(f); + } + let a = [11,22,33,45,56,6,77,84,93,101]; + g(a); g(a); + let total = g(a); + %OptimizeFunctionOnNextCall(g); + g(a); + deopt = true; + assertEquals(total, g(a)); +})(); + +(function OptimizedReduceEagerDeoptMiddleOfIteration() { + let deopt = false; + let array = [11,22,33,45,56,6,77,84,93,101]; + let f = (a,current) => { + if (current == 6 && deopt) {array[0] = 1.5; } + return a + current; + }; + let g = function() { + return array.reduce(f); + } + g(); g(); + let total = g(); + %OptimizeFunctionOnNextCall(g); + g(); + deopt = true; + g(); + deopt = false; + array = [11,22,33,45,56,6,77,84,93,101]; + %OptimizeFunctionOnNextCall(g); + g(); + deopt = true; + assertEquals(total, g()); +})(); + +(function ReduceCatch() { + let f = (a,current) => { + return a + current; + }; + let g = function() { + try { + return array.reduce(f); + } catch (e) { + } + } + g(); g(); + let total = g(); + %OptimizeFunctionOnNextCall(g); + g(); + g(); + assertEquals(total, g()); +})(); + +(function ReduceThrow() { + let done = false; + let f = (a, current) => { + if (done) throw "x"; + return a + current; + }; + let array = [1,2,3]; + let g = function() { + try { + return array.reduce(f); + } catch (e) { + return null; + } + } + g(); g(); + let total = g(); + %OptimizeFunctionOnNextCall(g); + g(); + assertEquals(6, g()); + done = true; + assertEquals(null, g()); + done = false; + g(); g(); + %OptimizeFunctionOnNextCall(g); + g(); + assertEquals(6, g()); + done = true; + assertEquals(null, g()); +})(); + +(function ReduceThrow() { + let done = false; + let f = (a, current) => { + if (done) throw "x"; + return a + current; + }; + %NeverOptimizeFunction(f); + let array = [1,2,3]; + let g = function() { + try { + return array.reduce(f); + } catch (e) { + return null; + } + } + g(); g(); + let total = g(); + %OptimizeFunctionOnNextCall(g); + g(); + assertEquals(6, g()); + done = true; + assertEquals(null, g()); + done = false; + g(); g(); + %OptimizeFunctionOnNextCall(g); + g(); + assertEquals(6, g()); + done = true; + assertEquals(null, g()); +})(); + +(function ReduceFinally() { + let done = false; + let f = (a, current) => { + if (done) throw "x"; + return a + current; + }; + let array = [1,2,3]; + let g = function() { + try { + return array.reduce(f); + } catch (e) { + } finally { + if (done) return null; + } + } + g(); g(); + let total = g(); + %OptimizeFunctionOnNextCall(g); + g(); + assertEquals(6, g()); + done = true; + assertEquals(null, g()); + done = false; + g(); g(); + %OptimizeFunctionOnNextCall(g); + g(); + assertEquals(6, g()); + done = true; + assertEquals(null, g()); +})(); + +(function ReduceFinallyNoInline() { + let done = false; + let f = (a, current) => { + if (done) throw "x"; + return a + current; + }; + %NeverOptimizeFunction(f); + let array = [1,2,3]; + let g = function() { + try { + return array.reduce(f); + } catch (e) { + } finally { + if (done) return null; + } + } + g(); g(); + let total = g(); + %OptimizeFunctionOnNextCall(g); + g(); + assertEquals(6, g()); + done = true; + assertEquals(null, g()); + done = false; + g(); g(); + %OptimizeFunctionOnNextCall(g); + g(); + assertEquals(6, g()); + done = true; + assertEquals(null, g()); +})(); + +(function ReduceNonCallableOpt() { + let done = false; + let f = (a, current) => { + return a + current; + }; + let array = [1,2,3]; + let g = function() { + return array.reduce(f); + } + g(); g(); + let total = g(); + %OptimizeFunctionOnNextCall(g); + g(); g(); + assertEquals(6, g()); + f = null; + assertThrows(() => g()); +})(); + +(function ReduceCatchInlineDeopt() { + let done = false; + let f = (a, current) => { + if (done) { + %DeoptimizeNow(); + throw "x"; + } + return a + current; + }; + let array = [1,2,3]; + let g = function() { + try { + return array.reduce(f); + } catch (e) { + if (done) return null; + } + } + g(); g(); + let total = g(); + %OptimizeFunctionOnNextCall(g); + g(); + assertEquals(6, g()); + done = true; + assertEquals(null, g()); + done = false; + g(); g(); + %OptimizeFunctionOnNextCall(g); + g(); + assertEquals(6, g()); + done = true; + assertEquals(null, g()); +})(); + +(function ReduceFinallyInlineDeopt() { + let done = false; + let f = (a, current) => { + if (done) { + %DeoptimizeNow(); + throw "x"; + } + return a + current; + }; + let array = [1,2,3]; + let g = function() { + try { + return array.reduce(f); + } catch (e) { + } finally { + if (done) return null; + } + } + g(); g(); + let total = g(); + %OptimizeFunctionOnNextCall(g); + g(); + assertEquals(6, g()); + done = true; + assertEquals(null, g()); + done = false; + g(); g(); + %OptimizeFunctionOnNextCall(g); + g(); + assertEquals(6, g()); + done = true; + assertEquals(null, g()); +})(); + +(function OptimizedReduceRight() { + let count = 0; + let f = (a,current,i) => a + current * ++count; + let g = function(a) { + count = 0; + return a.reduceRight(f); + } + let a = [1,2,3,4,5,6,7,8,9,10]; + g(a); g(a); + let total = g(a); + %OptimizeFunctionOnNextCall(g); + assertEquals(total, g(a)); +})(); + +(function OptimizedReduceEmpty() { + let count = 0; + let f = (a,current,i) => a + current * ++count; + let g = function(a) { + count = 0; + return a.reduceRight(f); + } + let a = [1,2,3,4,5,6,7,8,9,10]; + g(a); g(a); g(a); + %OptimizeFunctionOnNextCall(g); + g(a); + assertThrows(() => g([])); +})(); + +(function OptimizedReduceLazyDeopt() { + let deopt = false; + let f = (a,current) => { if (deopt) %DeoptimizeNow(); return a + current; }; + let g = function(a) { + return a.reduceRight(f); + } + let a = [1,2,3,4,5,6,7,8,9,10]; + g(a); g(a); + let total = g(a); + %OptimizeFunctionOnNextCall(g); + g(a); + deopt = true; + assertEquals(total, g(a)); +})(); + +(function OptimizedReduceLazyDeoptMiddleOfIteration() { + let deopt = false; + let f = (a,current) => { + if (current == 6 && deopt) %DeoptimizeNow(); + return a + current; + }; + let g = function(a) { + return a.reduceRight(f); + } + let a = [11,22,33,45,56,6,77,84,93,101]; + g(a); g(a); + let total = g(a); + %OptimizeFunctionOnNextCall(g); + g(a); + deopt = true; + assertEquals(total, g(a)); +})(); + +(function OptimizedReduceEagerDeoptMiddleOfIteration() { + let deopt = false; + let array = [11,22,33,45,56,6,77,84,93,101]; + let f = (a,current) => { + if (current == 6 && deopt) {array[9] = 1.5; } + return a + current; + }; + let g = function() { + return array.reduceRight(f); + } + g(); g(); + let total = g(); + %OptimizeFunctionOnNextCall(g); + g(); + deopt = true; + g(); + deopt = false; + array = [11,22,33,45,56,6,77,84,93,101]; + %OptimizeFunctionOnNextCall(g); + g(); + deopt = true; + assertEquals(total, g()); +})(); + +(function ReduceCatch() { + let f = (a,current) => { + return a + current; + }; + let g = function() { + try { + return array.reduceRight(f); + } catch (e) { + } + } + g(); g(); + let total = g(); + %OptimizeFunctionOnNextCall(g); + g(); + g(); + assertEquals(total, g()); +})(); + +(function ReduceThrow() { + let done = false; + let f = (a, current) => { + if (done) throw "x"; + return a + current; + }; + let array = [1,2,3]; + let g = function() { + try { + return array.reduceRight(f); + } catch (e) { + return null; + } + } + g(); g(); + let total = g(); + %OptimizeFunctionOnNextCall(g); + g(); + assertEquals(6, g()); + done = true; + assertEquals(null, g()); + done = false; + g(); g(); + %OptimizeFunctionOnNextCall(g); + g(); + assertEquals(6, g()); + done = true; + assertEquals(null, g()); +})(); + +(function ReduceThrow() { + let done = false; + let f = (a, current) => { + if (done) throw "x"; + return a + current; + }; + %NeverOptimizeFunction(f); + let array = [1,2,3]; + let g = function() { + try { + return array.reduceRight(f); + } catch (e) { + return null; + } + } + g(); g(); + let total = g(); + %OptimizeFunctionOnNextCall(g); + g(); + assertEquals(6, g()); + done = true; + assertEquals(null, g()); + done = false; + g(); g(); + %OptimizeFunctionOnNextCall(g); + g(); + assertEquals(6, g()); + done = true; + assertEquals(null, g()); +})(); + +(function ReduceFinally() { + let done = false; + let f = (a, current) => { + if (done) throw "x"; + return a + current; + }; + let array = [1,2,3]; + let g = function() { + try { + return array.reduceRight(f); + } catch (e) { + } finally { + if (done) return null; + } + } + g(); g(); + let total = g(); + %OptimizeFunctionOnNextCall(g); + g(); + assertEquals(6, g()); + done = true; + assertEquals(null, g()); + done = false; + g(); g(); + %OptimizeFunctionOnNextCall(g); + g(); + assertEquals(6, g()); + done = true; + assertEquals(null, g()); +})(); + +(function ReduceFinallyNoInline() { + let done = false; + let f = (a, current) => { + if (done) throw "x"; + return a + current; + }; + %NeverOptimizeFunction(f); + let array = [1,2,3]; + let g = function() { + try { + return array.reduceRight(f); + } catch (e) { + } finally { + if (done) return null; + } + } + g(); g(); + let total = g(); + %OptimizeFunctionOnNextCall(g); + g(); + assertEquals(6, g()); + done = true; + assertEquals(null, g()); + done = false; + g(); g(); + %OptimizeFunctionOnNextCall(g); + g(); + assertEquals(6, g()); + done = true; + assertEquals(null, g()); +})(); + +(function ReduceNonCallableOpt() { + let done = false; + let f = (a, current) => { + return a + current; + }; + let array = [1,2,3]; + let g = function() { + return array.reduceRight(f); + } + g(); g(); + let total = g(); + %OptimizeFunctionOnNextCall(g); + g(); g(); + assertEquals(6, g()); + f = null; + assertThrows(() => g()); +})(); + +(function ReduceCatchInlineDeopt() { + let done = false; + let f = (a, current) => { + if (done) { + %DeoptimizeNow(); + throw "x"; + } + return a + current; + }; + let array = [1,2,3]; + let g = function() { + try { + return array.reduceRight(f); + } catch (e) { + if (done) return null; + } + } + g(); g(); + let total = g(); + %OptimizeFunctionOnNextCall(g); + g(); + assertEquals(6, g()); + done = true; + assertEquals(null, g()); + done = false; + g(); g(); + %OptimizeFunctionOnNextCall(g); + g(); + assertEquals(6, g()); + done = true; + assertEquals(null, g()); +})(); + +(function ReduceFinallyInlineDeopt() { + let done = false; + let f = (a, current) => { + if (done) { + %DeoptimizeNow(); + throw "x"; + } + return a + current; + }; + let array = [1,2,3]; + let g = function() { + try { + return array.reduceRight(f); + } catch (e) { + } finally { + if (done) return null; + } + } + g(); g(); + let total = g(); + %OptimizeFunctionOnNextCall(g); + g(); + assertEquals(6, g()); + done = true; + assertEquals(null, g()); + done = false; + g(); g(); + %OptimizeFunctionOnNextCall(g); + g(); + assertEquals(6, g()); + done = true; + assertEquals(null, g()); +})(); + +(function ReduceHoleyArrayWithDefaultAccumulator() { + var __v_12258 = new Array(10); + function __f_3253(a) { + let __f_3252 = function(accumulator, currentValue) { + return currentValue; + } + return a.reduce(__f_3252, 13); + } + assertEquals(13, __f_3253(__v_12258)); + assertEquals(13, __f_3253(__v_12258)); + assertEquals(13, __f_3253(__v_12258)); + %OptimizeFunctionOnNextCall(__f_3253); + assertEquals(13, __f_3253(__v_12258)); +})(); + +(function ReduceRightHoleyArrayWithDefaultAccumulator() { + var __v_12258 = new Array(10); + function __f_3253(a) { + let __f_3252 = function(accumulator, currentValue) { + return currentValue; + } + return a.reduceRight(__f_3252, 13); + } + assertEquals(13, __f_3253(__v_12258)); + assertEquals(13, __f_3253(__v_12258)); + assertEquals(13, __f_3253(__v_12258)); + %OptimizeFunctionOnNextCall(__f_3253); + assertEquals(13, __f_3253(__v_12258)); +})(); + +(function ReduceHoleyArrayOneElementWithDefaultAccumulator() { + var __v_12258 = new Array(10); + __v_12258[1] = 5; + function __f_3253(a) { + let __f_3252 = function(accumulator, currentValue) { + return currentValue + accumulator; + } + return a.reduce(__f_3252, 13); + } + assertEquals(18, __f_3253(__v_12258)); + assertEquals(18, __f_3253(__v_12258)); + assertEquals(18, __f_3253(__v_12258)); + %OptimizeFunctionOnNextCall(__f_3253); + assertEquals(18, __f_3253(__v_12258)); +})(); + +(function ReduceRightHoleyArrayOneElementWithDefaultAccumulator() { + var __v_12258 = new Array(10); + __v_12258[1] = 5; + function __f_3253(a) { + let __f_3252 = function(accumulator, currentValue) { + return currentValue + accumulator; + } + return a.reduceRight(__f_3252, 13); + } + assertEquals(18, __f_3253(__v_12258)); + assertEquals(18, __f_3253(__v_12258)); + assertEquals(18, __f_3253(__v_12258)); + %OptimizeFunctionOnNextCall(__f_3253); + assertEquals(18, __f_3253(__v_12258)); +})(); diff --git a/deps/v8/test/mjsunit/code-coverage-block-noopt.js b/deps/v8/test/mjsunit/code-coverage-block-noopt.js index 3eba9d3f57..ef68e0394d 100644 --- a/deps/v8/test/mjsunit/code-coverage-block-noopt.js +++ b/deps/v8/test/mjsunit/code-coverage-block-noopt.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 --no-always-opt --harmony-async-iteration +// Flags: --allow-natives-syntax --no-always-opt // Flags: --no-opt // Files: test/mjsunit/code-coverage-utils.js diff --git a/deps/v8/test/mjsunit/code-coverage-block-opt.js b/deps/v8/test/mjsunit/code-coverage-block-opt.js index bc4a3f1010..e02775bd45 100644 --- a/deps/v8/test/mjsunit/code-coverage-block-opt.js +++ b/deps/v8/test/mjsunit/code-coverage-block-opt.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 --no-always-opt --harmony-async-iteration --opt +// Flags: --allow-natives-syntax --no-always-opt --opt // Files: test/mjsunit/code-coverage-utils.js %DebugToggleBlockCoverage(true); @@ -39,7 +39,7 @@ TestCoverage("Partial coverage collection", }(); // 0400 `, [{"start":52,"end":153,"count":0}, - {"start":127,"end":152,"count":1}] + {"start":121,"end":152,"count":1}] ); %DebugToggleBlockCoverage(false); diff --git a/deps/v8/test/mjsunit/code-coverage-block.js b/deps/v8/test/mjsunit/code-coverage-block.js index 3355fd1259..b9d00bce6d 100644 --- a/deps/v8/test/mjsunit/code-coverage-block.js +++ b/deps/v8/test/mjsunit/code-coverage-block.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 --no-always-opt --harmony-async-iteration +// Flags: --allow-natives-syntax --no-always-opt // Files: test/mjsunit/code-coverage-utils.js %DebugToggleBlockCoverage(true); @@ -38,20 +38,23 @@ function f(x) { // 0050 } // 0550 f(42); // 0600 f(43); // 0650 -`, -[{"start":0,"end":699,"count":1}, +if (true) { // 0700 + const foo = 'bar'; // 0750 +} else { // 0800 + const bar = 'foo'; // 0850 +} // 0900 +`, +[{"start":0,"end":949,"count":1}, + {"start":801,"end":901,"count":0}, {"start":0,"end":15,"count":11}, {"start":50,"end":551,"count":2}, {"start":115,"end":203,"count":1}, {"start":167,"end":171,"count":0}, - {"start":265,"end":273,"count":1}, - {"start":279,"end":287,"count":1}, - {"start":315,"end":319,"count":1}, - {"start":325,"end":329,"count":1}, + {"start":265,"end":287,"count":1}, + {"start":315,"end":329,"count":1}, {"start":363,"end":367,"count":0}, {"start":413,"end":417,"count":0}, - {"start":472,"end":476,"count":0}] - + {"start":466,"end":476,"count":0}] ); TestCoverage( @@ -82,7 +85,7 @@ TestCoverage( `, [{"start":0,"end":249,"count":1}, {"start":1,"end":201,"count":1}, - {"start":124,"end":129,"count":0}] + {"start":118,"end":129,"count":0}] ); TestCoverage( @@ -109,7 +112,7 @@ function g() {} // 0000 {"start":330,"end":334,"count":0}, {"start":431,"end":503,"count":12}, {"start":470,"end":474,"count":4}, - {"start":480,"end":484,"count":8}] + {"start":474,"end":484,"count":8}] ); TestCoverage( diff --git a/deps/v8/test/mjsunit/compiler/array-multiple-receiver-maps.js b/deps/v8/test/mjsunit/compiler/array-multiple-receiver-maps.js new file mode 100644 index 0000000000..2ef0cc3a01 --- /dev/null +++ b/deps/v8/test/mjsunit/compiler/array-multiple-receiver-maps.js @@ -0,0 +1,122 @@ +// 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 --no-always-opt + +function runTest(f, message, mkICTraining, deoptArg) { + function test(f, message, ictraining, deoptArg) { + // Train the call ic to the maps. + let t = ictraining; + + // We put the training data into local variables + // to ensure their maps are kepts alive. If the + // maps die, gc *may* deoptimize {f}, which makes + // the test flaky. + let t1 = t(); + let t2 = t(); + let t3 = t(); + + for (let a of t1) { + f(a.arr, () => a.el); + } + for (let a of t2) { + f(a.arr, () => a.el); + } + %OptimizeFunctionOnNextCall(f); + message += " trained with" + JSON.stringify(t()); + if (deoptArg == undefined) { + // Make sure the optimized function can handle + // all trained maps without deopt. + for (let a of t3) { + f(a.arr, () => a.el); + message += " for args " + JSON.stringify(a); + assertOptimized(f, undefined, message + " should have been optimized"); + } + } else { + // Trigger deopt, causing no-speculation bit to be set. + let a1 = deoptArg; + let a2 = deoptArg; + message += " for args " + JSON.stringify(a1); + f(a1.arr, () => a1.el); + assertUnoptimized(f, undefined, message + " should have been unoptimized"); + %OptimizeFunctionOnNextCall(f); + // No speculation should protect against further deopts. + f(a2.arr, () => a2.el); + assertOptimized(f, undefined, message + " should have been optimized"); + } + } + + // Get function as a string. + var testString = test.toString(); + // Remove the function header.. + testString = testString.replace(new RegExp("[^\n]*"), "let f = " + f.toString() + ";"); + // ..and trailing '}'. + testString = testString.replace(new RegExp("[^\n]*$"), ""); + // Substitute parameters. + testString = testString.replace(new RegExp("ictraining", 'g'), mkICTraining.toString()); + testString = testString.replace(new RegExp("deoptArg", 'g'), + deoptArg ? JSON.stringify(deoptArg) : "undefined"); + + var modTest = new Function("message", testString); + //print(modTest); + modTest(message); +} + +let checks = { + smiReceiver: + { mkTrainingArguments : () => [{arr:[1], el:3}], + deoptingArguments : [{arr:[0.1], el:1}, {arr:[{}], el:1}] + }, + objectReceiver: + { mkTrainingArguments : () => [{arr:[{}], el:0.1}], + deoptingArguments : [] + }, + multipleSmiReceivers: + { mkTrainingArguments : () => { let b = [1]; b.x=3; return [{arr:[1], el:3}, {arr:b, el:3}] }, + deoptingArguments : [{arr:[0.1], el:1}, {arr:[{}], el:1}] + }, + multipleSmiReceiversPackedUnpacked: + { mkTrainingArguments : () => { let b = [1]; b[100] = 3; return [{arr:[1], el:3}, {arr:b, el:3}] }, + deoptingArguments : [{arr:[0.1], el:1}, {arr:[{}], el:1}] + }, + multipleDoubleReceivers: + { mkTrainingArguments : () => { let b = [0.1]; b.x=0.3; return [{arr:[0.1], el:0.3}, {arr:b, el:0.3}] }, + deoptingArguments : [{arr:[{}], el:true}, {arr:[1], el:true}] + }, + multipleDoubleReceiversPackedUnpacked: + { mkTrainingArguments : () => { let b = [0.1]; b[100] = 0.3; return [{arr:[0.1], el:0.3}, {arr:b, el:0.3}] }, + deoptingArguments : [{arr:[{}], el:true}, {arr:[1], el:true}] + }, + multipleMixedReceivers: + { mkTrainingArguments : () => { let b = [0.1]; b.x=0.3; return [{arr:[1], el:0.3}, {arr:[{}], el:true}, {arr:b, el:0.3}] }, + deoptingArguments : [] + }, + multipleMixedReceiversPackedUnpacked: + { mkTrainingArguments : () => { let b = [0.1]; b[100] = 0.3; return [{arr:[1], el:0.3}, {arr:[{}], el:true}, {arr:b, el:0.3}] }, + deoptingArguments : [] + }, +}; + +const functions = { + push_reliable: (a,g) => { let b = g(); return a.push(2, b); }, + push_unreliable: (a,g) => { return a.push(2, g()); }, + pop_reliable: (a,g) => { let b = g(); return a.pop(2, b); }, + pop_unreliable: (a,g) => { return a.pop(2, g()); }, + shift_reliable: (a,g) => { let b = g(); return a.shift(2, b); }, + shift_unreliable: (a,g) => { return a.shift(2, g()); } +} + +Object.keys(checks).forEach( + key => { + let check = checks[key]; + + for (fnc in functions) { + runTest(functions[fnc], "test-reliable-" + key, check.mkTrainingArguments); + // Test each deopting arg separately. + for (let deoptArg of check.deoptingArguments) { + runTest(functions[fnc], "testDeopt-reliable-" + key, check.mkTrainingArguments, deoptArg); + } + } + } +); diff --git a/deps/v8/test/mjsunit/compiler/deopt-array-builtins.js b/deps/v8/test/mjsunit/compiler/deopt-array-builtins.js new file mode 100644 index 0000000000..b737b17ed0 --- /dev/null +++ b/deps/v8/test/mjsunit/compiler/deopt-array-builtins.js @@ -0,0 +1,148 @@ +// 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 --opt + +/* Test MapCheck behavior */ + +(function testForEachMapCheck() { + function f(v,n,o) { + Object.freeze(o); + } + function g() { + [1,2,3].forEach(f); + } + g(); + g(); + %OptimizeFunctionOnNextCall(g); + g(); + %OptimizeFunctionOnNextCall(g); + g(); + assertOptimized(g); +})(); + + +(function testFindMapCheck() { + function f(v,n,o) { + Object.freeze(o); + return false; + } + function g() { + [1,2,3].find(f); + } + g(); + g(); + %OptimizeFunctionOnNextCall(g); + g(); + %OptimizeFunctionOnNextCall(g); + g(); + assertOptimized(g); +})(); + +(function testMapMapCheck() { + function f(v,n,o) { + Object.freeze(o); + return false; + } + function g() { + [1,2,3].map(f); + } + g(); + g(); + %OptimizeFunctionOnNextCall(g); + g(); + %OptimizeFunctionOnNextCall(g); + g(); + assertOptimized(g); +})(); + +(function testFilterMapCheck() { + function f(v,n,o) { + Object.freeze(o); + return true; + } + function g() { + [1,2,3].filter(f); + } + g(); + g(); + %OptimizeFunctionOnNextCall(g); + g(); + %OptimizeFunctionOnNextCall(g); + g(); + assertOptimized(g); +})(); + + +/* Test CheckBounds behavior */ + +(function testForEachCheckBounds() { + function f(v,n,o) { + o.length=2; + } + function g() { + [1,2,3].forEach(f); + } + g(); + g(); + %OptimizeFunctionOnNextCall(g); + g(); + %OptimizeFunctionOnNextCall(g); + g(); + assertOptimized(g); +})(); + + +(function testFindCheckBounds() { + function f(v,n,o) { + o.length=2; + return false; + } + function g() { + [1,2,3].find(f); + } + g(); + g(); + %OptimizeFunctionOnNextCall(g); + g(); + %OptimizeFunctionOnNextCall(g); + g(); + assertOptimized(g); +})(); + +(function testMapCheckBounds() { + function f(v,n,o) { + o.length=2; + return false; + } + function g() { + [1,2,3].map(f); + } + g(); + g(); + %OptimizeFunctionOnNextCall(g); + g(); + %OptimizeFunctionOnNextCall(g); + g(); + assertOptimized(g); +})(); + +(function testFilterCheckBounds() { + function f(v,n,o) { + o.length = 2; + return true; + } + function g() { + [1,2,3].filter(f); + } + g(); + g(); + %OptimizeFunctionOnNextCall(g); + g(); + g(); + %OptimizeFunctionOnNextCall(g); + g(); + g(); + assertOptimized(g); +})(); diff --git a/deps/v8/test/mjsunit/compiler/deopt-array-push.js b/deps/v8/test/mjsunit/compiler/deopt-array-push.js new file mode 100644 index 0000000000..e34d99a325 --- /dev/null +++ b/deps/v8/test/mjsunit/compiler/deopt-array-push.js @@ -0,0 +1,97 @@ +// 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 --opt + +(function test() { + function foo(a) { a.push(a.length = 2); } + + foo([1]); + foo([1]); + %OptimizeFunctionOnNextCall(foo); + foo([1]); + %OptimizeFunctionOnNextCall(foo); + foo([1]); + assertOptimized(foo); +})(); + +(function testElementTypeCheckSmi() { + function foo(a) { a.push('a'); } + + foo([1]); + foo([1]); + %OptimizeFunctionOnNextCall(foo); + foo([1]); + %OptimizeFunctionOnNextCall(foo); + foo([1]); + assertOptimized(foo); +})(); + +(function testElementTypeCheckDouble() { + function foo(a) { a.push('a'); } + + foo([0.3413312]); + foo([0.3413312]); + %OptimizeFunctionOnNextCall(foo); + foo([0.3413312]); + %OptimizeFunctionOnNextCall(foo); + foo([0.3413312]); + assertOptimized(foo); +})(); +(function test() { + function bar(a) { a.x = 2 }; + %NeverOptimizeFunction(bar); + function foo(a) { a.push(bar(a)); } + + foo(["1"]); + foo(["1"]); + %OptimizeFunctionOnNextCall(foo); + foo(["1"]); + %OptimizeFunctionOnNextCall(foo); + foo(["1"]); + assertOptimized(foo); +})(); + +(function test() { + function foo(a) { a.push(a.length = 2); } + + foo([0.34234]); + foo([0.34234]); + %OptimizeFunctionOnNextCall(foo); + foo([0.34234]); + %OptimizeFunctionOnNextCall(foo); + foo([0.34234]); + assertOptimized(foo); +})(); + +(function test() { + const N = 128 * 1024; + + function foo(a) { a.push(1); } + + foo(new Array(N)); + foo(new Array(N)); + %OptimizeFunctionOnNextCall(foo); + foo(new Array(N)); + %OptimizeFunctionOnNextCall(foo); + foo(new Array(N)); + assertOptimized(foo); +})(); + +(function test() { + function mkArray() { + const N = 128 * 1024; + let a = [0.1]; + a.length = N; + return a; + } + function foo(a) { a.push(0.23441233123); } + foo(mkArray()); + foo(mkArray()); + %OptimizeFunctionOnNextCall(foo); + foo(mkArray()); + %OptimizeFunctionOnNextCall(foo); + foo(mkArray()); + assertOptimized(foo); +})(); diff --git a/deps/v8/test/mjsunit/compiler/escape-analysis-13.js b/deps/v8/test/mjsunit/compiler/escape-analysis-13.js index fca4da618e..5f281aaaa4 100644 --- a/deps/v8/test/mjsunit/compiler/escape-analysis-13.js +++ b/deps/v8/test/mjsunit/compiler/escape-analysis-13.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 --turbo-escape --turbo-experimental +// Flags: --allow-natives-syntax --turbo-escape function f() { var x = {}; diff --git a/deps/v8/test/mjsunit/compiler/escape-analysis-15.js b/deps/v8/test/mjsunit/compiler/escape-analysis-15.js index 4f9a40ad5c..1960d74892 100644 --- a/deps/v8/test/mjsunit/compiler/escape-analysis-15.js +++ b/deps/v8/test/mjsunit/compiler/escape-analysis-15.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 --turbo-escape --turbo-experimental --no-turbo-load-elimination +// Flags: --allow-natives-syntax --turbo-escape --no-turbo-load-elimination function f(i) { var o1 = {a: 1, b: 2}; diff --git a/deps/v8/test/mjsunit/compiler/escape-analysis-phi-type.js b/deps/v8/test/mjsunit/compiler/escape-analysis-phi-type.js index 806b09b3de..9d033b9640 100644 --- a/deps/v8/test/mjsunit/compiler/escape-analysis-phi-type.js +++ b/deps/v8/test/mjsunit/compiler/escape-analysis-phi-type.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 --turbo-escape --turbo-experimental --no-turbo-loop-peeling +// Flags: --allow-natives-syntax --turbo-escape --no-turbo-loop-peeling function f(x) { var o = {a : 0}; diff --git a/deps/v8/test/mjsunit/compiler/materialize-dictionary-properties.js b/deps/v8/test/mjsunit/compiler/materialize-dictionary-properties.js new file mode 100644 index 0000000000..5838a83979 --- /dev/null +++ b/deps/v8/test/mjsunit/compiler/materialize-dictionary-properties.js @@ -0,0 +1,18 @@ +// 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 + +function f() { + // Create a non-escaping object. + var o = Object.create(null); + %DeoptimizeNow(); + // Keep it alive. + return o ? 1 : 0; +} + +f(); +f(); +%OptimizeFunctionOnNextCall(f); +assertEquals(1, f()); diff --git a/deps/v8/test/mjsunit/compiler/materialize-mutable-heap-number.js b/deps/v8/test/mjsunit/compiler/materialize-mutable-heap-number.js new file mode 100644 index 0000000000..b6b99afcf4 --- /dev/null +++ b/deps/v8/test/mjsunit/compiler/materialize-mutable-heap-number.js @@ -0,0 +1,22 @@ +// 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 + +function C() {} +%CompleteInobjectSlackTracking(new C()); + +function f() { + // Create a non-escaping object. + var o = new C(); + // Add an out-of-object double property. + o.x = 0.5; + %DeoptimizeNow(); + return o.x + 0.25; +} + +f(); +f(); +%OptimizeFunctionOnNextCall(f); +assertEquals(0.75, f()); diff --git a/deps/v8/test/mjsunit/compiler/new-cons-string.js b/deps/v8/test/mjsunit/compiler/new-cons-string.js new file mode 100644 index 0000000000..7f6da7262a --- /dev/null +++ b/deps/v8/test/mjsunit/compiler/new-cons-string.js @@ -0,0 +1,71 @@ +// 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 --expose-externalize-string + +(function() { + function foo(s) { + return "abcdefghijklm" + s; + } + + assertTrue(isOneByteString(foo("0"))); + assertTrue(isOneByteString(foo("0"))); + %OptimizeFunctionOnNextCall(foo); + assertTrue(isOneByteString(foo("0"))); +})(); + +(function() { + function foo(s) { + return s + "abcdefghijklm"; + } + + assertTrue(isOneByteString(foo("0"))); + assertTrue(isOneByteString(foo("0"))); + %OptimizeFunctionOnNextCall(foo); + assertTrue(isOneByteString(foo("0"))); +})(); + +(function() { + function foo(s) { + return "abcdefghijklm" + s; + } + + assertFalse(isOneByteString(foo("\u1234"))); + assertFalse(isOneByteString(foo("\u1234"))); + %OptimizeFunctionOnNextCall(foo); + assertFalse(isOneByteString(foo("\u1234"))); +})(); + +(function() { + function foo(s) { + return s + "abcdefghijklm"; + } + + assertFalse(isOneByteString(foo("\u1234"))); + assertFalse(isOneByteString(foo("\u1234"))); + %OptimizeFunctionOnNextCall(foo); + assertFalse(isOneByteString(foo("\u1234"))); +})(); + +(function() { + function foo(s) { + return "abcdefghijkl\u1234" + s; + } + + assertFalse(isOneByteString(foo("0"))); + assertFalse(isOneByteString(foo("0"))); + %OptimizeFunctionOnNextCall(foo); + assertFalse(isOneByteString(foo("0"))); +})(); + +(function() { + function foo(s) { + return s + "abcdefghijkl\u1234"; + } + + assertFalse(isOneByteString(foo("0"))); + assertFalse(isOneByteString(foo("0"))); + %OptimizeFunctionOnNextCall(foo); + assertFalse(isOneByteString(foo("0"))); +})(); diff --git a/deps/v8/test/mjsunit/compiler/regress-786521.js b/deps/v8/test/mjsunit/compiler/regress-786521.js new file mode 100644 index 0000000000..2b161270ed --- /dev/null +++ b/deps/v8/test/mjsunit/compiler/regress-786521.js @@ -0,0 +1,23 @@ +// 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 + +// Provoke type None as result of a SpeculativeNumberMultiply to +// ensure that Turbofan can handle this. + +function inlined(b, x) { + if (b) { + x * 2 * 2 + } +} + +inlined(true, 1); +inlined(true, 2); +inlined(false, 1); + +function foo(b) { inlined(b, "") } +foo(false); foo(false); +%OptimizeFunctionOnNextCall(foo); +foo(true); diff --git a/deps/v8/test/mjsunit/compiler/regress-793863.js b/deps/v8/test/mjsunit/compiler/regress-793863.js new file mode 100644 index 0000000000..883805dff6 --- /dev/null +++ b/deps/v8/test/mjsunit/compiler/regress-793863.js @@ -0,0 +1,12 @@ +// 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 + +function f(a) { + return arguments[0]; +} + +%OptimizeFunctionOnNextCall(f); +assertEquals(undefined, f()); diff --git a/deps/v8/test/mjsunit/compiler/regress-796041.js b/deps/v8/test/mjsunit/compiler/regress-796041.js new file mode 100644 index 0000000000..e2c2e11c0b --- /dev/null +++ b/deps/v8/test/mjsunit/compiler/regress-796041.js @@ -0,0 +1,35 @@ +// 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 + +'use strict'; + +function f(abort, n, a, b) { + if (abort) return; + var x = a ? true : "" + a; + if (!a) { + var dead = n + 1 + 1; + if(!b) { + x = dead; + } + if (x) { + x = false; + } + if (b) { + x = false; + } + } + return x + 1; +} +f(false, 5); f(false, 6); f(false, 7); f(false, 8); + +function g(abort, a, b) { + return f(abort, "abc", a, b); +} + +g(true); g(true); g(true); g(true); + +%OptimizeFunctionOnNextCall(g); +g(false); diff --git a/deps/v8/test/mjsunit/compiler/regress-797596.js b/deps/v8/test/mjsunit/compiler/regress-797596.js new file mode 100644 index 0000000000..4e3594bdb1 --- /dev/null +++ b/deps/v8/test/mjsunit/compiler/regress-797596.js @@ -0,0 +1,30 @@ +// 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: --expose-gc --allow-natives-syntax +var notCallable; +function inferReceiverMapsInDeadCode() { + var obj = { func() {} }; + gc(); + function wrappedCode() { try { code(); } catch (e) {} } + function code() { + obj.a; + try { + Object.defineProperty(obj, "func", { get() {} }); + } catch (neverCaught) {} + for (var i = 0; i < 1; i++) { + try { + notCallable(arguments[i]); + } catch (alwaysCaught) {} + } + } + wrappedCode(); + try { + %OptimizeFunctionOnNextCall(wrappedCode); + wrappedCode(); + } catch (e) {} +} +inferReceiverMapsInDeadCode(); +inferReceiverMapsInDeadCode(); +inferReceiverMapsInDeadCode(); diff --git a/deps/v8/test/mjsunit/compiler/regress-801097.js b/deps/v8/test/mjsunit/compiler/regress-801097.js new file mode 100644 index 0000000000..d488ce4deb --- /dev/null +++ b/deps/v8/test/mjsunit/compiler/regress-801097.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: --allow-natives-syntax + +function GetFunction() { + var source = "return ((dividend | 0) / (("; + for (var i = 0; i < 0x8000; i++) { + source += "a," + } + source += "a) | 0)) | 0"; + return Function("dividend", source); +} + +var func = GetFunction(); +assertThrows("func();"); +%OptimizeFunctionOnNextCall(func); +assertThrows("func()"); diff --git a/deps/v8/test/mjsunit/compiler/varargs.js b/deps/v8/test/mjsunit/compiler/varargs.js new file mode 100644 index 0000000000..ae636dc0f7 --- /dev/null +++ b/deps/v8/test/mjsunit/compiler/varargs.js @@ -0,0 +1,49 @@ +// 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. + +x = "a"; + +function test_varargs(...args) { + var sum = this.x; + for (i in args) { + sum += "," + args[i]; + } + return sum; +} + +assertEquals("a", test_varargs()); +assertEquals("a,b", test_varargs("b")); +assertEquals("a,b,c", test_varargs("b", "c")); +assertEquals("a,b,c,d", test_varargs("b", "c", "d")); +assertEquals("a,b,c,d,e", test_varargs("b", "c", "d", "e")); + +function forward_varargs(...args) { + return test_varargs(...args); +} + +assertEquals("a", forward_varargs()); +assertEquals("a,b", forward_varargs("b")); +assertEquals("a,b,c", forward_varargs("b", "c")); +assertEquals("a,b,c,d", forward_varargs("b", "c", "d")); +assertEquals("a,b,c,d,e", forward_varargs("b", "c", "d", "e")); + +function forward_varargs_one_arg(x, ...args) { + return test_varargs(x, ...args); +} + +assertEquals("a,undefined", forward_varargs_one_arg()); +assertEquals("a,b", forward_varargs_one_arg("b")); +assertEquals("a,b,c", forward_varargs_one_arg("b", "c")); +assertEquals("a,b,c,d", forward_varargs_one_arg("b", "c", "d")); +assertEquals("a,b,c,d,e", forward_varargs_one_arg("b", "c", "d", "e")); + +function forward_varargs_two_args(x, y, ...args) { + return test_varargs(x, y, ...args); +} + +assertEquals("a,undefined,undefined", forward_varargs_two_args()); +assertEquals("a,b,undefined", forward_varargs_two_args("b")); +assertEquals("a,b,c", forward_varargs_two_args("b", "c")); +assertEquals("a,b,c,d", forward_varargs_two_args("b", "c", "d")); +assertEquals("a,b,c,d,e", forward_varargs_two_args("b", "c", "d", "e")); diff --git a/deps/v8/test/mjsunit/constant-folding-2.js b/deps/v8/test/mjsunit/constant-folding-2.js index da9e5d5469..7586261c92 100644 --- a/deps/v8/test/mjsunit/constant-folding-2.js +++ b/deps/v8/test/mjsunit/constant-folding-2.js @@ -33,8 +33,6 @@ function test(f) { f(); %OptimizeFunctionOnNextCall(f); f(); - // Assert that there has been no deopt. - assertOptimized(f); } test(function add() { @@ -234,6 +232,7 @@ test(function stringCharCodeAt() { assertEquals("NaN", String("abc".charCodeAt(4))); assertEquals(98, "abc".charCodeAt(1.1)); assertEquals("NaN", String("abc".charCodeAt(4.1))); + assertEquals("NaN", String("abc".charCodeAt(1 + 4294967295))); }); test(function stringCharAt() { @@ -242,6 +241,7 @@ test(function stringCharAt() { assertEquals("", "abc".charAt(4)); assertEquals("b", "abc".charAt(1.1)); assertEquals("", "abc".charAt(4.1)); + assertEquals("", String("abc".charAt(1 + 4294967295))); }); diff --git a/deps/v8/test/mjsunit/d8/.gitignore b/deps/v8/test/mjsunit/d8/.gitignore new file mode 100644 index 0000000000..4497115e4c --- /dev/null +++ b/deps/v8/test/mjsunit/d8/.gitignore @@ -0,0 +1 @@ +v8_trace.json diff --git a/deps/v8/test/mjsunit/d8-os.js b/deps/v8/test/mjsunit/d8/d8-os.js index c2d8ec59bc..c2d8ec59bc 100644 --- a/deps/v8/test/mjsunit/d8-os.js +++ b/deps/v8/test/mjsunit/d8/d8-os.js diff --git a/deps/v8/test/mjsunit/d8-performance-now.js b/deps/v8/test/mjsunit/d8/d8-performance-now.js index 3e5485e81d..3e5485e81d 100644 --- a/deps/v8/test/mjsunit/d8-performance-now.js +++ b/deps/v8/test/mjsunit/d8/d8-performance-now.js diff --git a/deps/v8/test/mjsunit/d8-worker-sharedarraybuffer.js b/deps/v8/test/mjsunit/d8/d8-worker-sharedarraybuffer.js index 09586c3a11..09586c3a11 100644 --- a/deps/v8/test/mjsunit/d8-worker-sharedarraybuffer.js +++ b/deps/v8/test/mjsunit/d8/d8-worker-sharedarraybuffer.js diff --git a/deps/v8/test/mjsunit/d8-worker-spawn-worker.js b/deps/v8/test/mjsunit/d8/d8-worker-spawn-worker.js index a114d8587e..a114d8587e 100644 --- a/deps/v8/test/mjsunit/d8-worker-spawn-worker.js +++ b/deps/v8/test/mjsunit/d8/d8-worker-spawn-worker.js diff --git a/deps/v8/test/mjsunit/d8-worker.js b/deps/v8/test/mjsunit/d8/d8-worker.js index a73d7b1706..a73d7b1706 100644 --- a/deps/v8/test/mjsunit/d8-worker.js +++ b/deps/v8/test/mjsunit/d8/d8-worker.js diff --git a/deps/v8/test/mjsunit/d8/enable-tracing.js b/deps/v8/test/mjsunit/d8/enable-tracing.js new file mode 100644 index 0000000000..5174b41155 --- /dev/null +++ b/deps/v8/test/mjsunit/d8/enable-tracing.js @@ -0,0 +1,8 @@ +// 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: --enable-tracing --trace-path=test/mjsunit/d8/v8_trace.json + +// Just test that running d8 with --enable-tracing does not crash in a normal +// execution without exceptions or calls to natives. diff --git a/deps/v8/test/mjsunit/deserialize-reference.js b/deps/v8/test/mjsunit/deserialize-reference.js index b032013159..ac4979bd26 100644 --- a/deps/v8/test/mjsunit/deserialize-reference.js +++ b/deps/v8/test/mjsunit/deserialize-reference.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: --cache=code --serialize-toplevel +// Flags: --cache=code var a = "123"; assertEquals(a, "123"); diff --git a/deps/v8/test/mjsunit/dictionary-prototypes.js b/deps/v8/test/mjsunit/dictionary-prototypes.js new file mode 100644 index 0000000000..109f8d42a6 --- /dev/null +++ b/deps/v8/test/mjsunit/dictionary-prototypes.js @@ -0,0 +1,409 @@ +// 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 + +function EnsureDictionaryMode(obj, properties=1500) { + for (let i = 0; i < properties; i++) { + obj["x" + i] = 0; + } + assertFalse(%HasFastProperties(obj)); +} + +function EnsureAlmostDictionaryMode(obj) { + for (let i = 0; i < 1020; i++) { + obj["x" + i] = 0; + } +} + +function TestAddingPropertyToDictionaryPrototype() { + let foo_func_called = 0; + let bar_func_called = 0; + + function Foo() {} + Foo.prototype.func = function() { ++foo_func_called; } + + function Bar() {} + Bar.prototype = Object.create(Foo.prototype); + EnsureDictionaryMode(Bar.prototype); + + let o = new Bar(); + + for (let i = 0; i < 11; ++i) { + // First, the property is looked up from Foo. + o.func(); + + // Add the property to Bar which is a dictionary-mode prototype between o + // and Foo. In the next iteration, it's looked up from Bar. + if (i == 9) { + // The UNINITIALIZED -> PREMONOMORPHIC transition of StoreIC should + // properly invalidate prototype chains. + Bar.prototype.func = function() { ++bar_func_called; } + } + } + + assertEquals(10, foo_func_called); + assertEquals(1, bar_func_called); +} + +TestAddingPropertyToDictionaryPrototype(); + +// Same as TestAddingPropertyToDictionaryPrototype, but using o["foo"] access +// instead of o.foo. +function TestAddingPropertyToDictionaryPrototype2() { + let foo_func_called = 0; + let bar_func_called = 0; + let name = "func"; + + function Foo() {} + Foo.prototype[name] = function() { ++foo_func_called; } + + function Bar() {} + Bar.prototype = Object.create(Foo.prototype); + EnsureDictionaryMode(Bar.prototype); + + let o = new Bar(); + + for (let i = 0; i < 11; ++i) { + // First, the property is looked up from Foo. + o[name](); + + // Add the property to Bar which is a dictionary-mode prototype between o + // and Foo. In the next iteration, it's looked up from Bar. + if (i == 9) { + // The UNINITIALIZED -> PREMONOMORPHIC transition of KeyedStoreIC should + // properly invalidate prototype chains. + Bar.prototype[name] = function() { ++bar_func_called; } + } + } + + assertEquals(10, foo_func_called); + assertEquals(1, bar_func_called); +} + +TestAddingPropertyToDictionaryPrototype2(); + +function TestAddingPropertyToDictionaryPrototype_DefineProperty() { + let foo_func_called = 0; + let bar_func_called = 0; + + function Foo() {} + Foo.prototype.func = function() { ++foo_func_called; } + + function Bar() {} + Bar.prototype = Object.create(Foo.prototype); + EnsureDictionaryMode(Bar.prototype); + + let o = new Bar(); + + for (let i = 0; i < 11; ++i) { + // First, the property is looked up from Foo. + o.func(); + + // Add the property to Bar which is a dictionary-mode prototype between o + // and Foo. In the next iteration, it's looked up from Bar. + if (i == 9) { + // The runtime should properly invalidate prototype chains. + Object.defineProperty(Bar.prototype, "func", {value: function() { ++bar_func_called; }}); + } + } + + assertEquals(10, foo_func_called); + assertEquals(1, bar_func_called); +} + +TestAddingPropertyToDictionaryPrototype_DefineProperty(); + +function TestAddingPropertyToDictionaryPrototype_DictionaryAddSlowPath() { + let foo_func_called = 0; + let bar_func_called = 0; + + function Foo() {} + Foo.prototype.func = function() { ++foo_func_called; } + + function Bar() {} + Bar.prototype = Object.create(Foo.prototype); + // The magic number ensures that the next addition to the dictionary will + // trigger the slow path. + EnsureDictionaryMode(Bar.prototype, 2731); + + let o = new Bar(); + + for (let i = 0; i < 11; ++i) { + // First, the property is looked up from Foo. + o.func(); + + // Add the property to Bar which is a dictionary-mode prototype between o + // and Foo. In the next iteration, it's looked up from Bar. + if (i == 9) { + // -> slow path for dictionary add + Bar.prototype.func = function() { ++bar_func_called; } + } + } + + assertEquals(10, foo_func_called); + assertEquals(1, bar_func_called); +} + +TestAddingPropertyToDictionaryPrototype_DictionaryAddSlowPath(); + +function TestAddingAccessorPropertyToDictionaryPrototype() { + let foo_func_called = 0; + let bar_func_called = 0; + + function Foo() {} + Foo.prototype.func = function() { ++foo_func_called; } + + function Bar() {} + Bar.prototype = Object.create(Foo.prototype); + EnsureDictionaryMode(Bar.prototype); + + let o = new Bar(); + + for (let i = 0; i < 11; ++i) { + // First, the property is looked up from Foo. + o.func(); + + // Add the property to Bar which is a dictionary-mode prototype between o + // and Foo. In the next iteration, it's looked up from Bar. + if (i == 9) { + Object.defineProperty(Bar.prototype, "func", + {get: function() { return function() { ++bar_func_called; }}}); + } + } + + assertEquals(10, foo_func_called); + assertEquals(1, bar_func_called); +} + +TestAddingAccessorPropertyToDictionaryPrototype(); + +function TestRemovingPropertyFromDictionaryPrototype() { + let foo_func_called = 0; + let bar_func_called = 0; + + function Foo() {} + Foo.prototype.func = function() { ++foo_func_called; } + + function Bar() {} + Bar.prototype = Object.create(Foo.prototype); + EnsureDictionaryMode(Bar.prototype); + Bar.prototype.func = function() { ++bar_func_called; } + + let o = new Bar(); + + for (let i = 0; i < 11; ++i) { + // First, the property is looked up from Bar. + o.func(); + + // Remove the property from Bar which is a dictionary-mode prototype between + // o and Foo. In the next iteration, it's looked up from Foo. + if (i == 9) { + delete Bar.prototype.func; + } + } + + assertEquals(1, foo_func_called); + assertEquals(10, bar_func_called); +} + +TestRemovingPropertyFromDictionaryPrototype(); + +// Same as TestRemovingPropertyFromDictionaryPrototype, but using o["foo"] access +// instead of o.foo. +function TestRemovingPropertyFromDictionaryPrototype2() { + let foo_func_called = 0; + let bar_func_called = 0; + let name = "func"; + + function Foo() {} + Foo.prototype[name] = function() { ++foo_func_called; } + + function Bar() {} + Bar.prototype = Object.create(Foo.prototype); + EnsureDictionaryMode(Bar.prototype); + Bar.prototype[name] = function() { ++bar_func_called; } + + let o = new Bar(); + + for (let i = 0; i < 11; ++i) { + // First, the property is looked up from Bar. + o[name](); + + // Remove the property from Bar which is a dictionary-mode prototype between + // o and Foo. In the next iteration, it's looked up from Foo. + if (i == 9) { + delete Bar.prototype[name]; + } + } + + assertEquals(1, foo_func_called); + assertEquals(10, bar_func_called); +} + +TestRemovingPropertyFromDictionaryPrototype2(); + +function TestAddingPropertyToDictionaryPrototype_Monomorphic() { + function DoMonomorphicStoreToPrototype(p, f, do_delete=true) { + p.func = f; + if (do_delete) { + delete p.func; + } + } + + let foo_func_called = 0; + let bar_func_called = 0; + + function Foo() {} + Foo.prototype.func = function() { ++foo_func_called; } + + function Bar() {} + Bar.prototype = Object.create(Foo.prototype); + EnsureDictionaryMode(Bar.prototype); + + function bar_func() { + ++bar_func_called; + } + DoMonomorphicStoreToPrototype(Bar.prototype, bar_func); + DoMonomorphicStoreToPrototype(Bar.prototype, bar_func); + DoMonomorphicStoreToPrototype(Bar.prototype, bar_func); + + let o = new Bar(); + + for (let i = 0; i < 11; ++i) { + // First, the property is looked up from Foo. + o.func(); + + // Add the property to Bar which is a dictionary-mode prototype between o + // and Foo. In the next iteration, it's looked up from Bar. + if (i == 9) { + DoMonomorphicStoreToPrototype(Bar.prototype, bar_func, false); + } + } + + assertEquals(10, foo_func_called); + assertEquals(1, bar_func_called); +} + +TestAddingPropertyToDictionaryPrototype_Monomorphic(); + +function TestAddingKeyedPropertyToDictionaryPrototype_Monomorphic() { + function DoMonomorphicKeyedStoreToPrototype(p, name, f, do_delete=true) { + p[name] = f; + if (do_delete) { + delete p[name]; + } + } + + let foo_func_called = 0; + let bar_func_called = 0; + let name = "func"; + + function Foo() {} + Foo.prototype[name] = function() { ++foo_func_called; } + + function Bar() {} + Bar.prototype = Object.create(Foo.prototype); + EnsureDictionaryMode(Bar.prototype); + + function bar_func() { + ++bar_func_called; + } + DoMonomorphicKeyedStoreToPrototype(Bar.prototype, name, bar_func); + DoMonomorphicKeyedStoreToPrototype(Bar.prototype, name, bar_func); + DoMonomorphicKeyedStoreToPrototype(Bar.prototype, name, bar_func); + + let o = new Bar(); + + for (let i = 0; i < 11; ++i) { + // First, the property is looked up from Foo. + o.func(); + + // Add the property to Bar which is a dictionary-mode prototype between o + // and Foo. In the next iteration, it's looked up from Bar. + if (i == 9) { + DoMonomorphicKeyedStoreToPrototype(Bar.prototype, name, bar_func, false); + } + } + + assertEquals(10, foo_func_called); + assertEquals(1, bar_func_called); +} + +TestAddingKeyedPropertyToDictionaryPrototype_Monomorphic(); + +// Like TestAddingPropertyToDictionaryPrototype, except that the prototype isn't +// in dictionary mode yet, but turns to dictionary mode after the interesting +// property is added. +function TestAddingPropertyToAlmostDictionaryPrototype() { + let foo_func_called = 0; + let bar_func_called = 0; + + function Foo() {} + Foo.prototype.func = function() { ++foo_func_called; } + + function Bar() {} + Bar.prototype = Object.create(Foo.prototype); + EnsureAlmostDictionaryMode(Bar.prototype); + + let o = new Bar(); + for (let i = 0; i < 2; ++i) { + o.x0; + } + assertTrue(%HasFastProperties(Bar.prototype)); + + for (let i = 0; i < 11; ++i) { + // First, the property is looked up from Foo. + o.func(); + + // Add the property to Bar which will now turn permanently into dictionary + // mode. In the next iteration, it's looked up from Bar. + if (i == 9) { + Bar.prototype.func = function() { ++bar_func_called; } + assertFalse(%HasFastProperties(Bar.prototype)); + } + } + + assertEquals(10, foo_func_called); + assertEquals(1, bar_func_called); +} + +TestAddingPropertyToAlmostDictionaryPrototype(); + +function TestReconfiguringDataToAccessor() { + let setter_called = 0; + + function Bar() {} + EnsureDictionaryMode(Bar.prototype); + let name = "prop"; + Object.defineProperty(Bar.prototype, name, + {value: 1000, writable: true, configurable: true}); + + for (let i = 0; i < 11; ++i) { + let obj1 = new Bar(); + if (i < 10) { + assertEquals(1000, obj1.prop); + } else { + assertEquals(3000, obj1.prop); + } + + // Add the property into the object. + obj1.prop = 2000; + if (i < 10) { + assertEquals(2000, obj1.prop); + } else { + assertEquals(3000, obj1.prop); + } + + // Make "prop" an accessor property in the prototype. + if (i == 9) { + Object.defineProperty(Bar.prototype, name, + {get: () => 3000, + set: function(val) { ++setter_called; }}); + } + } + assertEquals(1, setter_called); +} + +TestReconfiguringDataToAccessor(); diff --git a/deps/v8/test/mjsunit/es6/array-find.js b/deps/v8/test/mjsunit/es6/array-find.js index 5f6ba4226b..9fed027c8f 100644 --- a/deps/v8/test/mjsunit/es6/array-find.js +++ b/deps/v8/test/mjsunit/es6/array-find.js @@ -234,6 +234,40 @@ assertEquals(22, a.find(function(val) { return 22 === val; }), undefined); // +// Test predicate is called for missing properties +// +(function() { + const obj = { + "0": 0, + "2": 2, + length: 3 + }; + const received = []; + const predicate = (v) => { received.push(v); return false; }; + const found = Array.prototype.find.call(obj, predicate); + assertEquals(undefined, found); + assertArrayEquals([0, undefined, 2], received); +})(); + + +// +// Test predicate modifying array prototype +// +(function() { + const a = [0, , 2]; + const received = []; + const predicate = (v) => { + a.__proto__ = null; + received.push(v); + return false; + }; + const found = Array.prototype.find.call(a, predicate); + assertEquals(undefined, found); + assertArrayEquals([0, undefined, 2], received); +})(); + + +// // Test thisArg // (function() { diff --git a/deps/v8/test/mjsunit/es6/array-findindex.js b/deps/v8/test/mjsunit/es6/array-findindex.js index 716eb4e0db..d335c15108 100644 --- a/deps/v8/test/mjsunit/es6/array-findindex.js +++ b/deps/v8/test/mjsunit/es6/array-findindex.js @@ -234,6 +234,40 @@ assertEquals(3, a.findIndex(function(val) { return 24 === val; })); // +// Test predicate is called for missing properties +// +(function() { + const obj = { + "0": 0, + "2": 2, + length: 3 + }; + const received = []; + const predicate = (v) => { received.push(v); return false; }; + const found = Array.prototype.findIndex.call(obj, predicate); + assertEquals(-1, found); + assertArrayEquals([0, undefined, 2], received); +})(); + + +// +// Test predicate modifying array prototype +// +(function() { + const a = [0, , 2]; + const received = []; + const predicate = (v) => { + a.__proto__ = null; + received.push(v); + return false; + }; + const found = Array.prototype.findIndex.call(a, predicate); + assertEquals(-1, found); + assertArrayEquals([0, undefined, 2], received); +})(); + + +// // Test thisArg // (function() { diff --git a/deps/v8/test/mjsunit/es6/array-iterator-turbo.js b/deps/v8/test/mjsunit/es6/array-iterator-turbo.js index 3a159b6337..489a53dbc7 100644 --- a/deps/v8/test/mjsunit/es6/array-iterator-turbo.js +++ b/deps/v8/test/mjsunit/es6/array-iterator-turbo.js @@ -3,7 +3,7 @@ // found in the LICENSE file. // Flags: --turbo-escape --allow-natives-syntax --no-always-opt -// Flags: --opt --turbo-filter=* +// Flags: --opt --turbo-filter=* --no-force-slow-path "use strict"; diff --git a/deps/v8/test/mjsunit/es6/call-with-spread-modify-next.js b/deps/v8/test/mjsunit/es6/call-with-spread-modify-next.js index d22a1eaec0..3cae94ff9d 100644 --- a/deps/v8/test/mjsunit/es6/call-with-spread-modify-next.js +++ b/deps/v8/test/mjsunit/es6/call-with-spread-modify-next.js @@ -37,6 +37,8 @@ var r2 = testMax(1, 2); - assertEquals(3, called); + // .next() is only loaded once during the iteration prologue (see + // https://github.com/tc39/ecma262/pull/988/ and v8:6861) + assertEquals(1, called); assertEquals(2, r2); })(); diff --git a/deps/v8/test/mjsunit/es6/computed-property-names-object-literals-methods.js b/deps/v8/test/mjsunit/es6/computed-property-names-object-literals-methods.js index 36afbe2ced..24a357258a 100644 --- a/deps/v8/test/mjsunit/es6/computed-property-names-object-literals-methods.js +++ b/deps/v8/test/mjsunit/es6/computed-property-names-object-literals-methods.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-async-iteration - function ID(x) { return x; } diff --git a/deps/v8/test/mjsunit/es6/destructuring-assignment.js b/deps/v8/test/mjsunit/es6/destructuring-assignment.js index 579c87718b..dee7a0b16d 100644 --- a/deps/v8/test/mjsunit/es6/destructuring-assignment.js +++ b/deps/v8/test/mjsunit/es6/destructuring-assignment.js @@ -513,25 +513,31 @@ assertEquals(oz, [1, 2, 3, 4, 5]); } function FakeNewTarget() {} - assertEquals(undefined, ReturnNewTarget1()); - assertEquals(ReturnNewTarget1, new ReturnNewTarget1()); - assertEquals(FakeNewTarget, - Reflect.construct(ReturnNewTarget1, [], FakeNewTarget)); - - assertEquals(undefined, ReturnNewTarget2()); - assertEquals(ReturnNewTarget2, new ReturnNewTarget2()); - assertEquals(FakeNewTarget, - Reflect.construct(ReturnNewTarget2, [], FakeNewTarget)); - - assertEquals(undefined, ReturnNewTarget3()); - assertEquals(ReturnNewTarget3, new ReturnNewTarget3()); - assertEquals(FakeNewTarget, - Reflect.construct(ReturnNewTarget3, [], FakeNewTarget)); - - assertEquals(undefined, ReturnNewTarget4()); - assertEquals(ReturnNewTarget4, new ReturnNewTarget4()); - assertEquals(FakeNewTarget, - Reflect.construct(ReturnNewTarget4, [], FakeNewTarget)); + + function construct() { + assertEquals(undefined, ReturnNewTarget1()); + assertEquals(ReturnNewTarget1, new ReturnNewTarget1()); + assertEquals(FakeNewTarget, + Reflect.construct(ReturnNewTarget1, [], FakeNewTarget)); + + assertEquals(undefined, ReturnNewTarget2()); + assertEquals(ReturnNewTarget2, new ReturnNewTarget2()); + assertEquals(FakeNewTarget, + Reflect.construct(ReturnNewTarget2, [], FakeNewTarget)); + + assertEquals(undefined, ReturnNewTarget3()); + assertEquals(ReturnNewTarget3, new ReturnNewTarget3()); + assertEquals(FakeNewTarget, + Reflect.construct(ReturnNewTarget3, [], FakeNewTarget)); + + assertEquals(undefined, ReturnNewTarget4()); + assertEquals(ReturnNewTarget4, new ReturnNewTarget4()); + assertEquals(FakeNewTarget, + Reflect.construct(ReturnNewTarget4, [], FakeNewTarget)); + } + construct(); + FakeNewTarget.prototype = 1; + construct(); })(); (function testSuperCall() { diff --git a/deps/v8/test/mjsunit/es6/iteration-semantics.js b/deps/v8/test/mjsunit/es6/iteration-semantics.js index 558fb837e7..40037be6f5 100644 --- a/deps/v8/test/mjsunit/es6/iteration-semantics.js +++ b/deps/v8/test/mjsunit/es6/iteration-semantics.js @@ -220,13 +220,11 @@ assertThrows('fold(sum, 0, unreachable({}))', TypeError); assertThrows('fold(sum, 0, unreachable(false))', TypeError); assertThrows('fold(sum, 0, unreachable(37))', TypeError); -// "next" is looked up each time. -assertThrows('fold(sum, 0, remove_next_after(integers_until(10), 5))', - TypeError); -// It is not called at any other time. +// "next" is looked up only once during the iteration prologue (see +// https://github.com/tc39/ecma262/pull/988) +assertEquals(45, fold(sum, 0, remove_next_after(integers_until(10), 5))); assertEquals(45, fold(sum, 0, remove_next_after(integers_until(10), 10))); -// It is not looked up too many times. assertEquals(45, fold(sum, 0, poison_next_after(integers_until(10), 10))); diff --git a/deps/v8/test/mjsunit/es6/reflect-construct.js b/deps/v8/test/mjsunit/es6/reflect-construct.js index 03e8397a9b..34b6f27373 100644 --- a/deps/v8/test/mjsunit/es6/reflect-construct.js +++ b/deps/v8/test/mjsunit/es6/reflect-construct.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-unsafe-function-constructor --harmony-async-iteration +// Flags: --allow-unsafe-function-constructor (function testReflectConstructArity() { diff --git a/deps/v8/test/mjsunit/es6/spread-call.js b/deps/v8/test/mjsunit/es6/spread-call.js index cdedd990c8..7403e0726e 100644 --- a/deps/v8/test/mjsunit/es6/spread-call.js +++ b/deps/v8/test/mjsunit/es6/spread-call.js @@ -376,6 +376,11 @@ testSpreadCallsStrict(); a[3] = 4; var called = 0; + // .next method is only accessed during iteration prologue (see + // https://github.com/tc39/ecma262/pull/988) + let ArrayIteratorPrototype = Array.prototype[Symbol.iterator]().__proto__; + let ArrayIteratorPrototypeNextDescriptor = + Object.getOwnPropertyDescriptor(ArrayIteratorPrototype, 'next'); Object.defineProperty(Array.prototype, 2, { get: function() { var ai = a[Symbol.iterator](); @@ -384,7 +389,8 @@ testSpreadCallsStrict(); get: function() { called++; return original_next; - } + }, + configurable: true }); return 3; }, @@ -392,8 +398,10 @@ testSpreadCallsStrict(); }); assertEquals(10, sum(...a)); - assertEquals(2, called); + assertEquals(0, called); + Object.defineProperty(ArrayIteratorPrototype, 'next', + ArrayIteratorPrototypeNextDescriptor); Object.defineProperty(Array.prototype, 2, {}); })(); @@ -430,9 +438,9 @@ testSpreadCallsStrict(); countArgs(...a); - // should be called 4 times; 3 for the values, 1 for the final - // {value: undefined, done: true} pair - assertEquals(4, called); + // .next method is only accessed during iteration prologue (see + // https://github.com/tc39/ecma262/pull/988) + assertEquals(1, called); })(); (function testArrayIteratorPrototypeModified() { diff --git a/deps/v8/test/mjsunit/es6/super-with-spread-modify-next.js b/deps/v8/test/mjsunit/es6/super-with-spread-modify-next.js index 299917dbf1..cd7798b8d1 100644 --- a/deps/v8/test/mjsunit/es6/super-with-spread-modify-next.js +++ b/deps/v8/test/mjsunit/es6/super-with-spread-modify-next.js @@ -48,7 +48,9 @@ var r2 = testArgumentsPoint(1, 2); - assertEquals(3, called); + // .next() is only loaded once during the iteration prologue (see + // https://github.com/tc39/ecma262/pull/988/ and v8:6861) + assertEquals(1, called); assertInstanceof(r2, ArgumentsPoint); assertInstanceof(r2, Point); assertEquals(r2.x, 1); diff --git a/deps/v8/test/mjsunit/es6/typedarray.js b/deps/v8/test/mjsunit/es6/typedarray.js index 93d92097cd..02bd91c1e5 100644 --- a/deps/v8/test/mjsunit/es6/typedarray.js +++ b/deps/v8/test/mjsunit/es6/typedarray.js @@ -341,16 +341,30 @@ function TestTypedArray(constr, elementSize, typicalElement) { // Modified %ArrayIteratorPrototype%.next() method is honoured (v8:5699) const ArrayIteratorPrototype = Object.getPrototypeOf([][Symbol.iterator]()); + const ArrayIteratorPrototypeNextDescriptor = + Object.getOwnPropertyDescriptor(ArrayIteratorPrototype, 'next'); const ArrayIteratorPrototypeNext = ArrayIteratorPrototype.next; ArrayIteratorPrototype.next = function() { return { done: true }; }; genArr = new constr([1, 2, 3]); assertEquals(0, genArr.length); + ArrayIteratorPrototype.next = ArrayIteratorPrototypeNext; - // Modified %ArrayIteratorPrototype%.next() during iteration is honoured as - // well. + // Modified %ArrayIteratorPrototype%.next() is only loaded during the iterator + // prologue. + let nextMethod = ArrayIteratorPrototypeNext; + let getNextCount = 0; + Object.defineProperty(ArrayIteratorPrototype, 'next', { + get() { + getNextCount++; + return nextMethod; + }, + set(v) { nextMethod = v; }, + configurable: true + }); + genArr = new constr(Object.defineProperty([1, , 3], 1, { get() { ArrayIteratorPrototype.next = function() { @@ -359,9 +373,13 @@ function TestTypedArray(constr, elementSize, typicalElement) { return 2; } })); - assertEquals(2, genArr.length); + Object.defineProperty(ArrayIteratorPrototype, 'next', + ArrayIteratorPrototypeNextDescriptor); + assertEquals(1, getNextCount); + assertEquals(3, genArr.length); assertEquals(1, genArr[0]); assertEquals(2, genArr[1]); + assertEquals(3, genArr[2]); ArrayIteratorPrototype.next = ArrayIteratorPrototypeNext; } diff --git a/deps/v8/test/mjsunit/es8/object-entries.js b/deps/v8/test/mjsunit/es8/object-entries.js index c59d81c823..5c7e74e378 100644 --- a/deps/v8/test/mjsunit/es8/object-entries.js +++ b/deps/v8/test/mjsunit/es8/object-entries.js @@ -284,8 +284,8 @@ TestMutateDuringEnumeration(); HOLEY_DOUBLE_ELEMENTS: [ [, , NaN], [ ["2", NaN] ] ], DICTIONARY_ELEMENTS: [ Object.defineProperties({ 10000: "world" }, { - 100: { enumerable: true, value: "hello" }, - 99: { enumerable: false, value: "nope" } + 100: { enumerable: true, value: "hello", configurable: true}, + 99: { enumerable: false, value: "nope", configurable: true} }), [ ["100", "hello"], ["10000", "world" ] ] ], FAST_SLOPPY_ARGUMENTS_ELEMENTS: [ fastSloppyArguments("a", "b", "c"), @@ -298,17 +298,42 @@ TestMutateDuringEnumeration(); [ ["0", "s"], ["1", "t"], ["2", "r"]] ], SLOW_STRING_WRAPPER_ELEMENTS: [ Object.defineProperties(new String("str"), { - 10000: { enumerable: false, value: "X" }, - 9999: { enumerable: true, value: "Y" } + 10000: { enumerable: false, value: "X", configurable: true}, + 9999: { enumerable: true, value: "Y", configurable: true} }), [["0", "s"], ["1", "t"], ["2", "r"], ["9999", "Y"]] ], }; for (let [kind, [object, expected]] of Object.entries(element_kinds)) { let result1 = Object.entries(object); + %HeapObjectVerify(object); + %HeapObjectVerify(result1); assertEquals(expected, result1, `fast Object.entries() with ${kind}`); let proxy = new Proxy(object, {}); let result2 = Object.entries(proxy); + %HeapObjectVerify(result2); assertEquals(result1, result2, `slow Object.entries() with ${kind}`); } + + function makeFastElements(array) { + // Remove all possible getters. + for (let k of Object.getOwnPropertyNames(this)) { + if (k == "length") continue; + delete this[k]; + } + // Make the array large enough to trigger re-checking for compaction. + this[1000] = 1; + // Make the elements fast again. + Array.prototype.unshift.call(this, 1.1); + } + + // Test that changing the elements kind is supported. + for (let [kind, [object, expected]] of Object.entries(element_kinds)) { + if (kind == "FAST_STRING_WRAPPER_ELEMENTS") break; + object.__defineGetter__(1, makeFastElements); + let result1 = Object.entries(object).toString(); + %HeapObjectVerify(object); + %HeapObjectVerify(result1); + } + })(); diff --git a/deps/v8/test/mjsunit/es8/regress/regress-794744.js b/deps/v8/test/mjsunit/es8/regress/regress-794744.js new file mode 100644 index 0000000000..a4dcb5d42a --- /dev/null +++ b/deps/v8/test/mjsunit/es8/regress/regress-794744.js @@ -0,0 +1,8 @@ +// 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. + +// Object.getOwnPropertyDescriptors loads %FunctionPrototype%.caller, an +// accessor property which inspects the current callstack. Verify that this +// callstack iteration doesn't crash when there are no JS frames on the stack. +Promise.resolve(function () {}).then(Object.getOwnPropertyDescriptors); diff --git a/deps/v8/test/mjsunit/global-prototypes.js b/deps/v8/test/mjsunit/global-prototypes.js new file mode 100644 index 0000000000..98232c2814 --- /dev/null +++ b/deps/v8/test/mjsunit/global-prototypes.js @@ -0,0 +1,354 @@ +// 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 + + +assertEquals(this.__proto__, Object.prototype); + +function TestAddingPropertyToGlobalPrototype() { + let foo_func_called = 0; + let bar_func_called = 0; + + function Foo() {} + Foo.prototype.func = function() { ++foo_func_called; } + + delete this.func; + this.__proto__ = Foo.prototype; + + function Bar() {} + Bar.prototype = this; + + let o = new Bar(); + + for (let i = 0; i < 11; ++i) { + // First, the property is looked up from Foo. + o.func(); + + // Add the property to Bar which is a Global-mode prototype between o + // and Foo. In the next iteration, it's looked up from Bar. + if (i == 9) { + Bar.prototype.func = function() { ++bar_func_called; } + } + } + + assertEquals(10, foo_func_called); + assertEquals(1, bar_func_called); +} + +TestAddingPropertyToGlobalPrototype(); + + +// Same as TestAddingPropertyToGlobalPrototype, but using o["foo"] access +// instead of o.foo. +function TestAddingPropertyToGlobalPrototype2() { + let foo_func_called = 0; + let bar_func_called = 0; + let name = "func"; + + function Foo() {} + Foo.prototype[name] = function() { ++foo_func_called; } + + delete this[name]; + this.__proto__ = Foo.prototype; + + function Bar() {} + Bar.prototype = this; + + let o = new Bar(); + + for (let i = 0; i < 11; ++i) { + // First, the property is looked up from Foo. + o[name](); + + // Add the property to Bar which is a Global-mode prototype between o + // and Foo. In the next iteration, it's looked up from Bar. + if (i == 9) { + Bar.prototype[name] = function() { ++bar_func_called; } + } + } + + assertEquals(10, foo_func_called); + assertEquals(1, bar_func_called); +} + +TestAddingPropertyToGlobalPrototype2(); + + +function TestAddingPropertyToGlobalPrototype_DefineProperty() { + let foo_func_called = 0; + let bar_func_called = 0; + + function Foo() {} + Foo.prototype.func = function() { ++foo_func_called; } + + delete this.func; + this.__proto__ = Foo.prototype; + + function Bar() {} + Bar.prototype = this; + + let o = new Bar(); + + for (let i = 0; i < 11; ++i) { + // First, the property is looked up from Foo. + o.func(); + + // Add the property to Bar which is a Global-mode prototype between o + // and Foo. In the next iteration, it's looked up from Bar. + if (i == 9) { + Object.defineProperty(Bar.prototype, "func", + { + value: function() { ++bar_func_called; }, + configurable:true + }); + } + } + + assertEquals(10, foo_func_called); + assertEquals(1, bar_func_called); +} + +TestAddingPropertyToGlobalPrototype_DefineProperty(); + + +function TestAddingAccessorPropertyToGlobalPrototype() { + let foo_func_called = 0; + let bar_func_called = 0; + + function Foo() {} + Foo.prototype.func = function() { ++foo_func_called; } + + delete this.func; + this.__proto__ = Foo.prototype; + + function Bar() {} + Bar.prototype = this; + + let o = new Bar(); + + for (let i = 0; i < 11; ++i) { + // First, the property is looked up from Foo. + o.func(); + + // Add the property to Bar which is a Global-mode prototype between o + // and Foo. In the next iteration, it's looked up from Bar. + if (i == 9) { + Object.defineProperty(Bar.prototype, "func", + { + get: function() { return function() { ++bar_func_called; }}, + configurable: true + }); + } + } + + assertEquals(10, foo_func_called); + assertEquals(1, bar_func_called); +} + +TestAddingAccessorPropertyToGlobalPrototype(); + + +function TestRemovingPropertyFromGlobalPrototype() { + let foo_func_called = 0; + let bar_func_called = 0; + + function Foo() {} + Foo.prototype.func = function() { ++foo_func_called; } + + delete this.func; + this.__proto__ = Foo.prototype; + + function Bar() {} + Bar.prototype = this; + Bar.prototype.func = function() { ++bar_func_called; } + + let o = new Bar(); + + for (let i = 0; i < 11; ++i) { + // First, the property is looked up from Bar. + o.func(); + + // Remove the property from Bar which is a Global-mode prototype between + // o and Foo. In the next iteration, it's looked up from Foo. + if (i == 9) { + delete Bar.prototype.func; + } + } + + assertEquals(1, foo_func_called); + assertEquals(10, bar_func_called); +} + +TestRemovingPropertyFromGlobalPrototype(); + + +// Same as TestRemovingPropertyFromGlobalPrototype, but using o["foo"] access +// instead of o.foo. +function TestRemovingPropertyFromGlobalPrototype2() { + let foo_func_called = 0; + let bar_func_called = 0; + let name = "func"; + + function Foo() {} + Foo.prototype[name] = function() { ++foo_func_called; } + + this.__proto__ = Foo.prototype; + + function Bar() {} + Bar.prototype = this; + Bar.prototype[name] = function() { ++bar_func_called; } + + let o = new Bar(); + + for (let i = 0; i < 11; ++i) { + // First, the property is looked up from Bar. + o[name](); + + // Remove the property from Bar which is a Global-mode prototype between + // o and Foo. In the next iteration, it's looked up from Foo. + if (i == 9) { + delete Bar.prototype[name]; + } + } + + assertEquals(1, foo_func_called); + assertEquals(10, bar_func_called); +} + +TestRemovingPropertyFromGlobalPrototype2(); + + +function TestAddingPropertyToGlobalPrototype_MonomorphicDot() { + function DoMonomorphicStoreToPrototypeDot(p, f, do_delete=true) { + p.func = f; + if (do_delete) { + delete p.func; + } + } + let foo_func_called = 0; + let bar_func_called = 0; + + function Foo() {} + Foo.prototype.func = function() { ++foo_func_called; } + + delete this.func; + this.__proto__ = Foo.prototype; + + function Bar() {} + Bar.prototype = this; + + function bar_func() { + ++bar_func_called; + } + DoMonomorphicStoreToPrototypeDot(Bar.prototype, bar_func); + DoMonomorphicStoreToPrototypeDot(Bar.prototype, bar_func); + DoMonomorphicStoreToPrototypeDot(Bar.prototype, bar_func); + + let o = new Bar(); + + for (let i = 0; i < 11; ++i) { + // First, the property is looked up from Foo. + o.func(); + + // Add the property to Bar which is a Global-mode prototype between o + // and Foo. In the next iteration, it's looked up from Bar. + if (i == 9) { + DoMonomorphicStoreToPrototypeDot(Bar.prototype, bar_func, false); + } + } + + assertEquals(10, foo_func_called); + assertEquals(1, bar_func_called); +} + +TestAddingPropertyToGlobalPrototype_MonomorphicDot(); + + +function TestAddingPropertyToGlobalPrototype_MonomorphicBrackets() { + function DoMonomorphicStoreToPrototypeBrackets(p, name, f, do_delete=true) { + p[name] = f; + if (do_delete) { + delete p[name]; + } + } + let foo_func_called = 0; + let bar_func_called = 0; + let name = "func"; + + function Foo() {} + Foo.prototype[name] = function() { ++foo_func_called; } + + delete this[name]; + this.__proto__ = Foo.prototype; + + function Bar() {} + Bar.prototype = this; + + function bar_func() { + ++bar_func_called; + } + DoMonomorphicStoreToPrototypeBrackets(Bar.prototype, name, bar_func); + DoMonomorphicStoreToPrototypeBrackets(Bar.prototype, name, bar_func); + DoMonomorphicStoreToPrototypeBrackets(Bar.prototype, name, bar_func); + + let o = new Bar(); + + for (let i = 0; i < 11; ++i) { + // First, the property is looked up from Foo. + o.func(); + + // Add the property to Bar which is a Global-mode prototype between o + // and Foo. In the next iteration, it's looked up from Bar. + if (i == 9) { + DoMonomorphicStoreToPrototypeBrackets(Bar.prototype, name, bar_func, false); + } + } + + assertEquals(10, foo_func_called); + assertEquals(1, bar_func_called); +} + +TestAddingPropertyToGlobalPrototype_MonomorphicBrackets(); + + +function TestReconfiguringDataToAccessor() { + let setter_called = 0; + let name = "prop"; + + delete this[name]; + this.__proto__ = Object.prototype; + + function Bar() {} + Bar.prototype = this; + + Object.defineProperty(Bar.prototype, name, {value: 1000, writable: true, configurable: true}); + + for (let i = 0; i < 11; ++i) { + let obj1 = new Bar(); + if (i < 10) { + assertEquals(1000, obj1.prop); + } else { + assertEquals(3000, obj1.prop); + } + + // Add the property into the object. + obj1.prop = 2000; + if (i < 10) { + assertEquals(2000, obj1.prop); + } else { + assertEquals(3000, obj1.prop); + } + + // Make "prop" an accessor property in the prototype. + if (i == 9) { + Object.defineProperty(Bar.prototype, name, + {get: () => 3000, + set: function(val) { ++setter_called; }}); + } + } + assertEquals(1, setter_called); +} + +TestReconfiguringDataToAccessor(); diff --git a/deps/v8/test/mjsunit/harmony/async-for-of-non-iterable.js b/deps/v8/test/mjsunit/harmony/async-for-of-non-iterable.js index c84c9c6884..3394ed394c 100644 --- a/deps/v8/test/mjsunit/harmony/async-for-of-non-iterable.js +++ b/deps/v8/test/mjsunit/harmony/async-for-of-non-iterable.js @@ -2,7 +2,6 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -// Flags: --harmony-async-iteration var done = false; async function f() { diff --git a/deps/v8/test/mjsunit/harmony/async-from-sync-iterator.js b/deps/v8/test/mjsunit/harmony/async-from-sync-iterator.js index d965bd070c..a7b0d1bda4 100644 --- a/deps/v8/test/mjsunit/harmony/async-from-sync-iterator.js +++ b/deps/v8/test/mjsunit/harmony/async-from-sync-iterator.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-async-iteration --allow-natives-syntax +// Flags: --allow-natives-syntax let testFailed = false; let testFailure; diff --git a/deps/v8/test/mjsunit/harmony/async-generators-basic.js b/deps/v8/test/mjsunit/harmony/async-generators-basic.js index 29441b119b..d7af1836b8 100644 --- a/deps/v8/test/mjsunit/harmony/async-generators-basic.js +++ b/deps/v8/test/mjsunit/harmony/async-generators-basic.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-async-iteration --allow-natives-syntax +// Flags: --allow-natives-syntax function assertThrowsAsync(run, errorType, message) { var actual; diff --git a/deps/v8/test/mjsunit/harmony/async-generators-resume-return.js b/deps/v8/test/mjsunit/harmony/async-generators-resume-return.js index 7a7efe7801..715c81fc21 100644 --- a/deps/v8/test/mjsunit/harmony/async-generators-resume-return.js +++ b/deps/v8/test/mjsunit/harmony/async-generators-resume-return.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-async-iteration --allow-natives-syntax +// Flags: --allow-natives-syntax // .return() from state suspendedStart with undefined testAsync(test => { diff --git a/deps/v8/test/mjsunit/harmony/async-generators-return.js b/deps/v8/test/mjsunit/harmony/async-generators-return.js index b0c7febf8c..27cbd4373b 100644 --- a/deps/v8/test/mjsunit/harmony/async-generators-return.js +++ b/deps/v8/test/mjsunit/harmony/async-generators-return.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-async-iteration --allow-natives-syntax +// Flags: --allow-natives-syntax testAsync(test => { test.plan(2); diff --git a/deps/v8/test/mjsunit/harmony/async-generators-yield.js b/deps/v8/test/mjsunit/harmony/async-generators-yield.js index c999c7006f..feb6339af2 100644 --- a/deps/v8/test/mjsunit/harmony/async-generators-yield.js +++ b/deps/v8/test/mjsunit/harmony/async-generators-yield.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-async-iteration --allow-natives-syntax +// Flags: --allow-natives-syntax // Yield a thenable which is never settled testAsync(test => { 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 08c94245fd..faa7dba866 100644 --- a/deps/v8/test/mjsunit/harmony/bigint/as-int-n.js +++ b/deps/v8/test/mjsunit/harmony/bigint/as-int-n.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 --noopt +// Flags: --harmony-bigint // BigInt.asIntN { @@ -145,6 +145,8 @@ }{ assertThrows(() => BigInt.asIntN(3, 12), TypeError); assertEquals(-4n, BigInt.asIntN(3, "12")); + assertEquals(0x123456789abcdefn, + BigInt.asIntN(64, 0xabcdef0123456789abcdefn)); } // BigInt.asUintN @@ -244,10 +246,9 @@ assertEquals(9223372036854775808n - 42n, BigInt.asUintN(63, -42n)); assertEquals(18446744073709551616n - 42n, BigInt.asUintN(64, -42n)); assertEquals(36893488147419103232n - 42n, BigInt.asUintN(65, -42n)); - // TODO(neis): Enable once we have exponentation. - // assertEquals(2n**127n - 42n, BigInt.asUintN(127, -42n)); - // assertEquals(2n**128n - 42n, BigInt.asUintN(128, -42n)); - // assertEquals(2n**129n - 42n, BigInt.asUintN(129, -42n)); + assertEquals(2n**127n - 42n, BigInt.asUintN(127, -42n)); + assertEquals(2n**128n - 42n, BigInt.asUintN(128, -42n)); + assertEquals(2n**129n - 42n, BigInt.asUintN(129, -42n)); }{ assertEquals(0n, BigInt.asUintN(0, 4294967295n)); assertEquals(1n, BigInt.asUintN(1, 4294967295n)); @@ -274,10 +275,9 @@ BigInt.asUintN(64,-4294967295n)); assertEquals(36893488147419103232n - 4294967295n, BigInt.asUintN(65, -4294967295n)); - // TODO(neis): Enable once we have exponentation. - // assertEquals(2n**127n - 42n, BigInt.asUintN(127, -4294967295n)); - // assertEquals(2n**128n - 42n, BigInt.asUintN(128, -4294967295n)); - // assertEquals(2n**129n - 42n, BigInt.asUintN(129, -4294967295n)); + assertEquals(2n**127n - 4294967295n, BigInt.asUintN(127, -4294967295n)); + assertEquals(2n**128n - 4294967295n, BigInt.asUintN(128, -4294967295n)); + assertEquals(2n**129n - 4294967295n, BigInt.asUintN(129, -4294967295n)); }{ assertEquals(42n, BigInt.asUintN(2**32, 42n)); assertEquals(4294967295n, BigInt.asUintN(2**32, 4294967295n)); diff --git a/deps/v8/test/mjsunit/harmony/bigint/basics.js b/deps/v8/test/mjsunit/harmony/bigint/basics.js index 5ea89009a3..398d670ca8 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 --no-opt +// Flags: --allow-natives-syntax --harmony-bigint 'use strict' @@ -105,14 +105,6 @@ const six = BigInt(6); assertTrue(typeof 1n === "bigint"); assertFalse(typeof 1n === "BigInt"); assertFalse(typeof 1 === "bigint"); -}{ - // TODO(neis): Enable once --no-opt can be removed. - // - // function Typeof(x) { return typeof x } - // assertEquals(Typeof(zero), "bigint"); - // assertEquals(Typeof(zero), "bigint"); - // %OptimizeFunctionOnNextCall(Typeof); - // assertEquals(Typeof(zero), "bigint"); } // ToString diff --git a/deps/v8/test/mjsunit/harmony/bigint/comparisons.js b/deps/v8/test/mjsunit/harmony/bigint/comparisons.js index 7be5eb7ee5..513ff37d00 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 --no-opt +// Flags: --allow-natives-syntax --harmony-bigint 'use strict' diff --git a/deps/v8/test/mjsunit/harmony/bigint/dec.js b/deps/v8/test/mjsunit/harmony/bigint/dec.js index cdf1d96d60..5e1f40b2dd 100644 --- a/deps/v8/test/mjsunit/harmony/bigint/dec.js +++ b/deps/v8/test/mjsunit/harmony/bigint/dec.js @@ -6,9 +6,6 @@ // Flags: --harmony-bigint -// TODO(adamk/jkummerow/neis): Support BigInts in TF unary ops. -// Flags: --noopt - var data = [{ a: "-609648ccf253976b12f6b6c8e20790c17ef6b89ea9f536267783607cf465b1ca", r: "-609648ccf253976b12f6b6c8e20790c17ef6b89ea9f536267783607cf465b1cb" diff --git a/deps/v8/test/mjsunit/harmony/bigint/exp.js b/deps/v8/test/mjsunit/harmony/bigint/exp.js new file mode 100644 index 0000000000..5a4601134f --- /dev/null +++ b/deps/v8/test/mjsunit/harmony/bigint/exp.js @@ -0,0 +1,43 @@ +// 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 --harmony-bigint + +assertEquals(1n, 0n ** 0n); +assertEquals(0n, 0n ** 1n); +assertEquals(0n, 0n ** 23n); + +assertEquals(1n, 1n ** 0n); +assertEquals(1n, 1n ** 1n); +assertEquals(1n, 99n ** 0n); + +assertEquals(2n, 2n ** 1n); +assertEquals(4n, 2n ** 2n); +assertEquals(8n, 2n ** 3n); +assertEquals(16n, 2n ** 4n); +assertEquals(151115727451828646838272n, 2n ** 77n); + +assertEquals(3n, 3n ** 1n); +assertEquals(9n, 3n ** 2n); +assertEquals(27n, 3n ** 3n); +assertEquals(81n, 3n ** 4n); +assertEquals(243n, 3n ** 5n); +assertEquals(30903154382632612361920641803529n, 3n ** 66n); + +assertEquals(1n, (-2n) ** 0n); +assertEquals(-2n, (-2n) ** 1n); +assertEquals(4n, (-2n) ** 2n); +assertEquals(-8n, (-2n) ** 3n); +assertEquals(16n, (-2n) ** 4n); +assertEquals(-32n, (-2n) ** 5n); + +assertEquals(1n, (-3n) ** 0n); +assertEquals(-3n, (-3n) ** 1n); +assertEquals(9n, (-3n) ** 2n); +assertEquals(-27n, (-3n) ** 3n); +assertEquals(81n, (-3n) ** 4n); +assertEquals(-243n, (-3n) ** 5n); + +assertThrows(() => 3n ** -2n, RangeError); // Negative exponent. +assertThrows(() => 2n ** (1024n ** 4n), RangeError); // Too big. diff --git a/deps/v8/test/mjsunit/harmony/bigint/inc.js b/deps/v8/test/mjsunit/harmony/bigint/inc.js index 2773ed9110..64865a2b32 100644 --- a/deps/v8/test/mjsunit/harmony/bigint/inc.js +++ b/deps/v8/test/mjsunit/harmony/bigint/inc.js @@ -6,9 +6,6 @@ // Flags: --harmony-bigint -// TODO(adamk/jkummerow/neis): Support BigInts in TF unary ops. -// Flags: --noopt - var data = [{ a: "-989c298c6fc3", r: "-989c298c6fc2" diff --git a/deps/v8/test/mjsunit/harmony/bigint/json.js b/deps/v8/test/mjsunit/harmony/bigint/json.js index 10afdfce02..eb0eefc4bb 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 --no-opt +// Flags: --allow-natives-syntax --harmony-bigint 'use strict' diff --git a/deps/v8/test/mjsunit/harmony/bigint/neg.js b/deps/v8/test/mjsunit/harmony/bigint/neg.js index 75548f62c3..8cec9cc21b 100644 --- a/deps/v8/test/mjsunit/harmony/bigint/neg.js +++ b/deps/v8/test/mjsunit/harmony/bigint/neg.js @@ -6,9 +6,6 @@ // Flags: --harmony-bigint -// TODO(adamk/jkummerow/neis): Support BigInts in TF unary ops. -// Flags: --noopt - var data = [{ a: "58ad59aa3aa9d04d4c12493966e204ef0500d5f92ecb31", r: "-58ad59aa3aa9d04d4c12493966e204ef0500d5f92ecb31" diff --git a/deps/v8/test/mjsunit/harmony/bigint/not.js b/deps/v8/test/mjsunit/harmony/bigint/not.js index fe23c8f965..7ceaa01e63 100644 --- a/deps/v8/test/mjsunit/harmony/bigint/not.js +++ b/deps/v8/test/mjsunit/harmony/bigint/not.js @@ -6,9 +6,6 @@ // Flags: --harmony-bigint -// TODO(adamk/jkummerow/neis): Support BigInts in TF unary ops. -// Flags: --noopt - var data = [{ a: "3d02c87edc77722299f6559ecca038911f864a4e78c20af80f4a6d9", r: "-3d02c87edc77722299f6559ecca038911f864a4e78c20af80f4a6da" diff --git a/deps/v8/test/mjsunit/harmony/bigint/regressions.js b/deps/v8/test/mjsunit/harmony/bigint/regressions.js index 45c8816fe7..3057fe1230 100644 --- a/deps/v8/test/mjsunit/harmony/bigint/regressions.js +++ b/deps/v8/test/mjsunit/harmony/bigint/regressions.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 --noopt +// Flags: --harmony-bigint var a = 5n; var b = a / -1n; @@ -16,3 +16,5 @@ assertEquals(0n, 5n % 1n); assertEquals(0n, -5n % 1n); assertEquals(0n, 5n % -1n); assertEquals(0n, -5n % -1n); + +assertTrue(0n === 0n); diff --git a/deps/v8/test/mjsunit/harmony/bigint/tonumber.js b/deps/v8/test/mjsunit/harmony/bigint/tonumber.js index 0061d91d67..d2802a79be 100644 --- a/deps/v8/test/mjsunit/harmony/bigint/tonumber.js +++ b/deps/v8/test/mjsunit/harmony/bigint/tonumber.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 --no-opt +// Flags: --harmony-bigint function Check(bigint, number_string) { var number = Number(number_string); diff --git a/deps/v8/test/mjsunit/harmony/bigint/too-big-literal.js b/deps/v8/test/mjsunit/harmony/bigint/too-big-literal.js deleted file mode 100644 index 242700191a..0000000000 --- a/deps/v8/test/mjsunit/harmony/bigint/too-big-literal.js +++ /dev/null @@ -1,14 +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. -// -// Flags: --harmony-bigint --no-opt - -const MAX_BIGINT_BITS = 1024 * 1024; // Matches BigInt::kMaxLengthBits -const MAX_BIGINT_CHARS = MAX_BIGINT_BITS / 4; - -const TOO_MANY_ONES = Array(MAX_BIGINT_CHARS + 2).join("1") + "n"; - -const tooBigHex = "0x" + TOO_MANY_ONES; - -assertThrows(tooBigHex, SyntaxError); diff --git a/deps/v8/test/mjsunit/harmony/bigint/turbo.js b/deps/v8/test/mjsunit/harmony/bigint/turbo.js new file mode 100644 index 0000000000..87130ea101 --- /dev/null +++ b/deps/v8/test/mjsunit/harmony/bigint/turbo.js @@ -0,0 +1,193 @@ +// 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 --harmony-bigint + +'use strict' + + +function test(f, {input, check}) { + let result; + try { + result = { value: f(input), exception: false } + } catch(e) { + result = { value: e, exception: true } + } + check(result); +} + +function Test(f, ...cases) { + for (let i = 0; i < cases.length; ++i) { + test(f, cases[i]); + %OptimizeFunctionOnNextCall(f); + for (let j = 0; j < cases.length; ++j) { + test(f, cases[j]); + } + %DeoptimizeFunction(f); + } +} + + +function V(input, expected_value) { + function check(result) { + assertFalse(result.exception, input); + assertEquals(expected_value, result.value); + } + return {input, check}; +} + +function E(input, expected_exception) { + function check(result) { + assertTrue(result.exception, input); + assertInstanceof(result.value, expected_exception); + } + return {input, check}; +} + + +const six = {[Symbol.toPrimitive]() {return 6n}}; + + +//////////////////////////////////////////////////////////////////////////////// +// The first argument to {Test} is the function to test. The other arguments are +// the test cases, basically pairs of input and expected output. {Test} runs the +// function first unoptimized on one of the inputs, and then optimized on all +// inputs. +//////////////////////////////////////////////////////////////////////////////// + + +Test(x => Number(x), + V(1n, 1), V(1, 1), V("", 0), V(1.4, 1.4), V(null, 0), V(six, 6)); + +Test(x => String(x), + V(1n, "1"), V(1, "1"), V(1.4, "1.4"), V(null, "null"), V(six, "6")); + +Test(x => BigInt(x), + V(true, 1n), V(false, 0n), V(42n, 42n), E(NaN, RangeError), V(six, 6n)); + +Test(x => typeof x, + V(1n, "bigint"), V(1, "number"), V(six, "object")); +Test(x => typeof x == "bigint", + V(1n, true), V(1, false), V(six, false)); + +Test(x => !x, + V(0n, true), V(42n, false), V(0x10000000000000000n, false), V(1, false), + V(undefined, true), V(six, false)); +Test(x => !!x, + V(0n, false), V(42n, true), V(0x10000000000000000n, true), V(1, true), + V(undefined, false), V(six, true)); + +Test(x => +x, + E(-3n, TypeError), V(-4, -4), V(1.4, 1.4), V(null, 0), V("5", 5), + E(six, TypeError)); + +Test(x => -x, + V(-3n, 3n), V(-4, 4), V(1.4, -1.4), V(null, -0), V("5", -5), V(six, -6n)); + +Test(x => ~x, + V(-3n, 2n), V(-4, 3), V(1.5, -2), V(null, -1), V("5", -6), V(six, -7n)); + +Test(x => ++x, + V(-3n, -2n), V(-4, -3), V(1.5, 2.5), V(null, 1), V("5", 6), V(six, 7n)); + +Test(x => --x, + V(-3n, -4n), V(-4, -5), V(1.5, 0.5), V(null, -1), V("5", 4), V(six, 5n)); + +Test(x => x++, + V(-3n, -3n), V(-4, -4), V(1.5, 1.5), V(null, 0), V("5", 5), V(six, 6n)); + +Test(x => x--, + V(-3n, -3n), V(-4, -4), V(1.5, 1.5), V(null, 0), V("5", 5), V(six, 6n)); + +Test(x => x + 42, + E(1n, TypeError), V(2, 44), V(null, 42), V("a", "a42"), E(six, TypeError)); +Test(x => x + 42n, + V(1n, 43n), E(2, TypeError), E(null, TypeError), V("a", "a42"), V(six,48n)); + +Test(x => x - 4, + E(1n, TypeError), V(3, -1), V(null, -4), V("a", NaN), E(six, TypeError)); +Test(x => x - 4n, + V(1n, -3n), E(3, TypeError), E(null, TypeError), E("a", TypeError), + V(six, 2n)); + +Test(x => x * 42, + E(2n, TypeError), V(3, 126), V("a", NaN), V(null, 0), E(six, TypeError)); +Test(x => x * 42n, + V(2n, 84n), E(3, TypeError), E("a", TypeError), E(null, TypeError), + V(six, 252n)); + +Test(x => x / 2, + E(2n, TypeError), V(6, 3), V("a", NaN), V(null, 0), E(six, TypeError)); +Test(x => x / 2n, + V(2n, 1n), E(6, TypeError), E("a", TypeError), E(null, TypeError), + V(six, 3n)); + +Test(x => x % 2, + E(2n, TypeError), V(3, 1), V("a", NaN), V(null, 0), E(six, TypeError)); +Test(x => x % 2n, + V(2n, 0n), E(3, TypeError), E("a", TypeError), E(null, TypeError), + V(six, 0n)); + +Test(x => x | 5, + E(2n, TypeError), V(3, 7), V("a", 5), V(null, 5), E(six, TypeError)); +Test(x => x | 5n, + V(2n, 7n), E(3, TypeError), E("a", TypeError), E(null, TypeError), + V(six, 7n)); + +Test(x => x & 5, + E(2n, TypeError), V(3, 1), V("a", 0), V(null, 0), E(six, TypeError)); +Test(x => x & 5n, + V(2n, 0n), E(3, TypeError), E("a", TypeError), E(null, TypeError), + V(six, 4n)); + +Test(x => x ^ 5, + E(2n, TypeError), V(3, 6), V("a", 5), V(null, 5), E(six, TypeError)); +Test(x => x ^ 5n, + V(2n, 7n), E(3, TypeError), E("a", TypeError), E(null, TypeError), + V(six, 3n)); + +Test(x => x << 3, + E(2n, TypeError), V(3, 24), V("a", 0), V(null, 0), E(six, TypeError)); +Test(x => x << 3n, + V(2n, 16n), E(3, TypeError), E("a", TypeError), E(null, TypeError), + V(six, 48n)); + +Test(x => x >> 1, + E(2n, TypeError), V(3, 1), V("a", 0), V(null, 0), E(six, TypeError)); +Test(x => x >> 1n, + V(2n, 1n), E(3, TypeError), E("a", TypeError), E(null, TypeError), + V(six, 3n)); + +Test(x => x >>> 1, + E(2n, TypeError), V(3, 1), V("a", 0), V(null, 0), E(six, TypeError)); +Test(x => x >>> 1n, + E(2n, TypeError), E(3, TypeError), E("a", TypeError), E(null, TypeError), + E(six, TypeError)); + +Test(x => x === 42, + V(1n, false), V(2, false), V(null, false), V("a", false), V(six, false)); +Test(x => x === 42, + V(42n, false), V(42, true), V(null, false), V("42", false), V(six, false)); +Test(x => x === 42n, + V(1n, false), V(2, false), V(null, false), V("a", false), V(six, false)); +Test(x => x === 42n, + V(42n, true), V(42, false), V(null, false), V("42", false), V(six, false)); + +Test(x => x == 42, + V(1n, false), V(2, false), V(null, false), V("a", false), V(six, false)); +Test(x => x == 42, + V(42n, true), V(42, true), V(null, false), V("42", true), V(six, false)); +Test(x => x == 42n, + V(1n, false), V(2, false), V(null, false), V("a", false), V(six, false)); +Test(x => x == 42n, + V(42n, true), V(42, true), V(null, false), V("42", true), V(six, false)); + +Test(x => x < 42, + V(1n, true), V(2, true), V(null, true), V("41", true), V(six, true)); +Test(x => x < 42, + V(42n, false), V(42, false), V(null, true), V("42", false), V(six, true)); +Test(x => x < 42n, + V(1n, true), V(2, true), V(null, true), V("41", true), V(six, true)); +Test(x => x < 42n, + V(42n, false), V(42, false), V(null, true), V("42", false), V(six, true)); diff --git a/deps/v8/test/mjsunit/harmony/for-await-of.js b/deps/v8/test/mjsunit/harmony/for-await-of.js index efcfdab2ea..e23758a5e1 100644 --- a/deps/v8/test/mjsunit/harmony/for-await-of.js +++ b/deps/v8/test/mjsunit/harmony/for-await-of.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-async-iteration --allow-natives-syntax +// Flags: --allow-natives-syntax let testFailed = false; let testFailure; diff --git a/deps/v8/test/mjsunit/harmony/modules-import-15.js b/deps/v8/test/mjsunit/harmony/modules-import-15.js index ac33cd50b2..32255ce980 100644 --- a/deps/v8/test/mjsunit/harmony/modules-import-15.js +++ b/deps/v8/test/mjsunit/harmony/modules-import-15.js @@ -29,7 +29,8 @@ async function test2() { } catch(e) { assertInstanceof(e, SyntaxError); assertEquals( - "The requested module does not provide an export named 'default'", + "The requested module 'modules-skip-empty.js' does not provide an " + + "export named 'default'", e.message); ran = true; } diff --git a/deps/v8/test/mjsunit/harmony/optional-catch-binding-breaks.js b/deps/v8/test/mjsunit/harmony/optional-catch-binding-breaks.js new file mode 100644 index 0000000000..82be60cda1 --- /dev/null +++ b/deps/v8/test/mjsunit/harmony/optional-catch-binding-breaks.js @@ -0,0 +1,65 @@ +// 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: --harmony-optional-catch-binding + +let state = 'initial'; +x: try { + throw new Error('caught'); + state = 'unreachable'; +} catch { + assertEquals(state, 'initial'); + state = 'caught'; + break x; + state = 'unreachable'; +} +assertEquals(state, 'caught'); + + +state = 'initial'; +x: try { + throw new Error('caught'); + state = 'unreachable'; +} catch { + assertEquals(state, 'initial'); + state = 'caught'; + break x; + state = 'unreachable'; +} finally { + assertEquals(state, 'caught'); + state = 'finally'; +} +assertEquals(state, 'finally'); + + +state = 'initial'; +x: { + y: try { + throw new Error('caught'); + state = 'unreachable'; + } catch { + assertEquals(state, 'initial'); + state = 'caught'; + break x; + state = 'unreachable'; + } finally { + assertEquals(state, 'caught'); + state = 'finally'; + break y; + state = 'unreachable'; + } + assertEquals(state, 'finally'); + state = 'after block'; +} +assertEquals(state, 'after block'); + + +do { + try { + throw new Error(); + } catch { + break; + } + assertUnreachable(); +} while(false); diff --git a/deps/v8/test/mjsunit/harmony/optional-catch-binding.js b/deps/v8/test/mjsunit/harmony/optional-catch-binding.js new file mode 100644 index 0000000000..093288c4e6 --- /dev/null +++ b/deps/v8/test/mjsunit/harmony/optional-catch-binding.js @@ -0,0 +1,39 @@ +// 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: --harmony-optional-catch-binding + +let state = 'initial'; +try { + throw new Error('caught'); + state = 'unreachable'; +} catch { // Note the lack of a binding + assertEquals(state, 'initial'); + state = 'caught'; +} +assertEquals(state, 'caught'); + + +let sigil1 = {}; +try { + throw sigil1; +} catch (e) { + assertEquals(e, sigil1); +} + + +let sigil2 = {}; +let reached = false; +try { + try { + throw sigil1; + } catch { + reached = true; + } finally { + throw sigil2; + } +} catch (e) { + assertEquals(e, sigil2); +} +assertTrue(reached); diff --git a/deps/v8/test/mjsunit/harmony/promise-prototype-finally.js b/deps/v8/test/mjsunit/harmony/promise-prototype-finally.js index 3668ab5538..4e91f2e6d1 100644 --- a/deps/v8/test/mjsunit/harmony/promise-prototype-finally.js +++ b/deps/v8/test/mjsunit/harmony/promise-prototype-finally.js @@ -605,3 +605,13 @@ testAsync(assert => { .then(() => assert.equals(1, value)); }, "PromiseResolve-ordering"); + +(function testIsObject() { + var called = false; + var p = new Proxy(Promise.resolve(), {}); + var oldThen = Promise.prototype.then; + Promise.prototype.then = () => called = true; + Promise.prototype.finally.call(p); + assertTrue(called); + Promise.prototype.then = oldThen; +})(); diff --git a/deps/v8/test/mjsunit/harmony/public-instance-class-fields.js b/deps/v8/test/mjsunit/harmony/public-instance-class-fields.js index acf0f13a99..a82a0ac919 100644 --- a/deps/v8/test/mjsunit/harmony/public-instance-class-fields.js +++ b/deps/v8/test/mjsunit/harmony/public-instance-class-fields.js @@ -52,16 +52,8 @@ b = x; c = 1; hasOwnProperty() { return 1;} - static [x] = 2; - static b = 3; - static d; } - assertEquals(2, C.a); - assertEquals(3, C.b); - assertEquals(undefined, C.d); - assertEquals(undefined, C.c); - let c = new C; assertEquals(undefined, c.a); assertEquals('a', c.b); @@ -270,7 +262,7 @@ let c = new C; assertEquals(1, c.a); assertEquals(undefined, c.b); - assertEquals(undefined, c.c1); + assertEquals(undefined, c[c1]); } { @@ -281,10 +273,10 @@ } class C { - [run(1)] = run(7); - [run(2)] = run(8); + [run(1)] = run(6); + [run(2)] = run(7); [run(3)]() { run(9);} - static [run(4)] = run(6); + [run(4)] = run(8); [run(5)]() { throw new Error('should not execute');}; } @@ -303,10 +295,10 @@ function x() { } class C { - [run(1)] = run(7); - [run(2)] = run(8); + [run(1)] = run(6); + [run(2)] = run(7); [run(3)]() { run(9);} - static [run(4)] = run(6); + [run(4)] = run(8); [run(5)]() { throw new Error('should not execute');}; } @@ -315,7 +307,7 @@ function x() { assertEquals([1, 2, 3, 4, 5, 6, 7, 8, 9], log); } } -x(); +x()(); { class C {} @@ -637,20 +629,6 @@ x(); } { - function t() { - return class { - ['x'] = 1; - static ['x'] = 2; - } - } - - let klass = t(); - let obj = new klass; - assertEquals(1, obj.x); - assertEquals(2, klass.x); -} - -{ new class { t = 1; constructor(t = this.t) { @@ -674,3 +652,47 @@ x(); } }, ReferenceError); } + +{ + class X { + p = function() { return arguments[0]; } + } + + let x = new X; + assertEquals(1, x.p(1)); +} + +{ + class X { + t = () => { + function p() { return arguments[0]; }; + return p; + } + } + + let x = new X; + let p = x.t(); + assertEquals(1, p(1)); +} + +{ + class X { + t = () => { + function p() { return eval("arguments[0]"); }; + return p; + } + } + + let x = new X; + let p = x.t(); + assertEquals(1, p(1)); +} + +{ + class X { + p = eval("(function() { return arguments[0]; })(1)"); + } + + let x = new X; + assertEquals(1, x.p); +} diff --git a/deps/v8/test/mjsunit/harmony/public-static-class-fields.js b/deps/v8/test/mjsunit/harmony/public-static-class-fields.js index 0477e3dca7..3de3e2d9d2 100644 --- a/deps/v8/test/mjsunit/harmony/public-static-class-fields.js +++ b/deps/v8/test/mjsunit/harmony/public-static-class-fields.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-public-fields +// Flags: --harmony-public-fields --harmony-static-fields "use strict"; @@ -262,7 +262,7 @@ assertEquals(1, C.a); assertEquals(undefined, C.b); - assertEquals(undefined, C.c); + assertEquals(undefined, C[c]); } { @@ -310,7 +310,51 @@ function x() { assertEquals([1, 2, 3, 4, 5, 6, 7, 8, 9], log); } } -x(); +x()(); + +{ + let log = []; + function run(i) { + log.push(i); + return i; + } + + class C { + [run(1)] = run(7); + [run(2)] = run(8); + [run(3)]() { run(9);} + static [run(4)] = run(6); + [run(5)]() { throw new Error('should not execute');}; + } + + let c = new C; + c[3](); + assertEquals([1, 2, 3, 4, 5, 6, 7, 8, 9], log); +} + +function y() { + // This tests lazy parsing. + return function() { + let log = []; + function run(i) { + log.push(i); + return i; + } + + class C { + [run(1)] = run(7); + [run(2)] = run(8); + [run(3)]() { run(9);} + static [run(4)] = run(6); + [run(5)]() { throw new Error('should not execute');}; + } + + let c = new C; + c[3](); + assertEquals([1, 2, 3, 4, 5, 6, 7, 8, 9], log); + } +} +y()(); { class C {} @@ -333,3 +377,83 @@ x(); let obj = new klass; assertEquals(2, klass.x); } + +{ + let x = 'a'; + class C { + a; + b = x; + c = 1; + hasOwnProperty() { return 1;} + static [x] = 2; + static b = 3; + static d; + } + + assertEquals(2, C.a); + assertEquals(3, C.b); + assertEquals(undefined, C.d); + assertEquals(undefined, C.c); + + let c = new C; + assertEquals(undefined, c.a); + assertEquals('a', c.b); + assertEquals(1, c.c); + assertEquals(undefined, c.d); + assertEquals(1, c.hasOwnProperty()); +} + +{ + function t() { + return class { + ['x'] = 1; + static ['x'] = 2; + } + } + + let klass = t(); + let obj = new klass; + assertEquals(1, obj.x); + assertEquals(2, klass.x); +} + + +{ + class X { + static p = function() { return arguments[0]; } + } + + assertEquals(1, X.p(1)); +} + +{ + class X { + static t = () => { + function p() { return arguments[0]; }; + return p; + } + } + + let p = X.t(); + assertEquals(1, p(1)); +} + +{ + class X { + static t = () => { + function p() { return eval("arguments[0]"); }; + return p; + } + } + + let p = X.t(); + assertEquals(1, p(1)); +} + +{ + class X { + static p = eval("(function() { return arguments[0]; })(1)"); + } + + assertEquals(1, X.p); +} diff --git a/deps/v8/test/mjsunit/harmony/regexp-named-captures.js b/deps/v8/test/mjsunit/harmony/regexp-named-captures.js index 1ad29f6b49..72041b99bf 100644 --- a/deps/v8/test/mjsunit/harmony/regexp-named-captures.js +++ b/deps/v8/test/mjsunit/harmony/regexp-named-captures.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-regexp-named-captures +// Flags: --harmony-regexp-named-captures --allow-natives-syntax // Malformed named captures. assertThrows("/(?<>a)/u", SyntaxError); // Empty name. @@ -418,3 +418,124 @@ function toSlowMode(re) { assertEquals("cd", "abcd".replace(re, "$<fth>")); assertEquals("cd", "abcd".replace(re, "$<$1>")); } + +// Tests for 'groups' semantics on the regexp result object. +// https://crbug.com/v8/7192 + +{ + const re = /./; + const result = re.exec("a"); + assertTrue(%SpeciesProtector()); + assertEquals(result.__proto__, Array.prototype); + assertTrue(result.hasOwnProperty('groups')); + assertArrayEquals(["a"], result); + assertEquals(0, result.index); + assertEquals(undefined, result.groups); + + Array.prototype.groups = { a: "b" }; + assertTrue(%SpeciesProtector()); + assertEquals("$<a>", "a".replace(re, "$<a>")); + Array.prototype.groups = undefined; +} + +{ + const re = toSlowMode(/./); + const result = re.exec("a"); + assertTrue(%SpeciesProtector()); + assertEquals(result.__proto__, Array.prototype); + assertTrue(result.hasOwnProperty('groups')); + assertArrayEquals(["a"], result); + assertEquals(0, result.index); + assertEquals(undefined, result.groups); + + Array.prototype.groups = { a: "b" }; + assertTrue(%SpeciesProtector()); + assertEquals("$<a>", "a".replace(re, "$<a>")); + Array.prototype.groups = undefined; +} + +{ + const re = /(?<a>a).|(?<x>x)/; + const result = re.exec("ab"); + assertTrue(%SpeciesProtector()); + assertEquals(result.__proto__, Array.prototype); + assertTrue(result.hasOwnProperty('groups')); + assertArrayEquals(["ab", "a", undefined], result); + assertEquals(0, result.index); + assertEquals({a: "a", x: undefined}, result.groups); + + // a is a matched named capture, b is an unmatched named capture, and z + // is not a named capture. + Array.prototype.groups = { a: "b", x: "y", z: "z" }; + assertTrue(%SpeciesProtector()); + assertEquals("a", "ab".replace(re, "$<a>")); + assertEquals("", "ab".replace(re, "$<x>")); + assertEquals("", "ab".replace(re, "$<z>")); + Array.prototype.groups = undefined; +} + +{ + const re = toSlowMode(/(?<a>a).|(?<x>x)/); + const result = re.exec("ab"); + assertTrue(%SpeciesProtector()); + assertEquals(result.__proto__, Array.prototype); + assertTrue(result.hasOwnProperty('groups')); + assertArrayEquals(["ab", "a", undefined], result); + assertEquals(0, result.index); + assertEquals({a: "a", x: undefined}, result.groups); + + // a is a matched named capture, b is an unmatched named capture, and z + // is not a named capture. + Array.prototype.groups = { a: "b", x: "y", z: "z" }; + assertTrue(%SpeciesProtector()); + assertEquals("a", "ab".replace(re, "$<a>")); + assertEquals("", "ab".replace(re, "$<x>")); + assertEquals("", "ab".replace(re, "$<z>")); + Array.prototype.groups = undefined; +} + +{ + class FakeRegExp extends RegExp { + exec(subject) { + const fake_result = [ "ab", "a" ]; + fake_result.index = 0; + // groups is not set, triggering prototype lookup. + return fake_result; + } + }; + + const re = new FakeRegExp(); + const result = re.exec("ab"); + assertTrue(%SpeciesProtector()); + assertEquals(result.__proto__, Array.prototype); + assertFalse(result.hasOwnProperty('groups')); + + Array.prototype.groups = { a: "b" }; + Array.prototype.groups.__proto__.b = "c"; + assertTrue(%SpeciesProtector()); + assertEquals("b", "ab".replace(re, "$<a>")); + assertEquals("c", "ab".replace(re, "$<b>")); + Array.prototype.groups = undefined; +} + +{ + class FakeRegExp extends RegExp { + exec(subject) { + const fake_result = [ "ab", "a" ]; + fake_result.index = 0; + fake_result.groups = { a: "b" }; + fake_result.groups.__proto__.b = "c"; + return fake_result; + } + }; + + const re = new FakeRegExp(); + const result = re.exec("ab"); + assertTrue(%SpeciesProtector()); + assertEquals(result.__proto__, Array.prototype); + assertTrue(result.hasOwnProperty('groups')); + assertEquals({ a: "b" }, result.groups); + + assertEquals("b", "ab".replace(re, "$<a>")); + assertEquals("c", "ab".replace(re, "$<b>")); +} diff --git a/deps/v8/test/mjsunit/harmony/regress/regress-6322.js b/deps/v8/test/mjsunit/harmony/regress/regress-6322.js index 9c312a35a5..927b56ea79 100644 --- a/deps/v8/test/mjsunit/harmony/regress/regress-6322.js +++ b/deps/v8/test/mjsunit/harmony/regress/regress-6322.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-async-iteration - // Crash with --verify-heap (async function() { for await (let { a = class b { } } of [{}]) { } })(); (async function() { var a; for await ({ a = class b { } } of [{}]) { } })(); diff --git a/deps/v8/test/mjsunit/harmony/regress/regress-772649.js b/deps/v8/test/mjsunit/harmony/regress/regress-772649.js index d080410226..2ff27670df 100644 --- a/deps/v8/test/mjsunit/harmony/regress/regress-772649.js +++ b/deps/v8/test/mjsunit/harmony/regress/regress-772649.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-async-iteration +// Flags: --allow-natives-syntax async function* gen([[notIterable]] = [null]) {} assertThrows(() => gen(), TypeError); diff --git a/deps/v8/test/mjsunit/harmony/sharedarraybuffer.js b/deps/v8/test/mjsunit/harmony/sharedarraybuffer.js index 12e8c9508e..a79574d69f 100644 --- a/deps/v8/test/mjsunit/harmony/sharedarraybuffer.js +++ b/deps/v8/test/mjsunit/harmony/sharedarraybuffer.js @@ -89,9 +89,6 @@ function TestTypedArray(constr, elementSize, typicalElement) { assertEquals("[object " + constr.name + "]", Object.prototype.toString.call(a0)); - // TODO(binji): Should this return false here? It is a view, but it doesn't - // view a SharedArrayBuffer... - assertTrue(SharedArrayBuffer.isView(a0)); assertSame(elementSize, a0.BYTES_PER_ELEMENT); assertSame(30, a0.length); assertSame(30*elementSize, a0.byteLength); diff --git a/deps/v8/test/mjsunit/harmony/symbol-async-iterator.js b/deps/v8/test/mjsunit/harmony/symbol-async-iterator.js index 8a92add635..5b7e6b5f40 100644 --- a/deps/v8/test/mjsunit/harmony/symbol-async-iterator.js +++ b/deps/v8/test/mjsunit/harmony/symbol-async-iterator.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-async-iteration - assertTrue(Symbol.hasOwnProperty('asyncIterator')); assertEquals('symbol', typeof Symbol.asyncIterator); assertInstanceof(Object(Symbol.asyncIterator), Symbol); diff --git a/deps/v8/test/mjsunit/ic-lookup-on-receiver.js b/deps/v8/test/mjsunit/ic-lookup-on-receiver.js new file mode 100644 index 0000000000..8be3779f05 --- /dev/null +++ b/deps/v8/test/mjsunit/ic-lookup-on-receiver.js @@ -0,0 +1,44 @@ +// 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 + +(function TestLookupOnReceiver() { + let log = []; + + function f(o, v) { + o.x = v; + return o.x; + } + + let p = {}; + Object.defineProperty( + p, "x", + { + get: function() { return 153; }, + set: function(v) { log.push("set"); }, + configurable: true + }); + + let o = Object.create(p); + // Turn o to dictionary mode. + for (let i = 0; i < 2048; i++) { + o["p"+i] = 0; + } + assertFalse(%HasFastProperties(o)); + + for (let i = 0; i < 5; i++) { + log.push(f(o, i)); + } + + Object.defineProperty(o, "x", { value: 0, configurable: true, writable: true}); + + for (let i = 0; i < 5; i++) { + log.push(f(o, 42 + i)); + } + + assertEquals(log, + ["set", 153, "set", 153, "set", 153, "set", 153, "set", 153, + 42, 43, 44, 45, 46]); +})(); diff --git a/deps/v8/test/mjsunit/mjsunit.status b/deps/v8/test/mjsunit/mjsunit.status index aa59fb680a..d91ff6f015 100644 --- a/deps/v8/test/mjsunit/mjsunit.status +++ b/deps/v8/test/mjsunit/mjsunit.status @@ -31,6 +31,7 @@ # tested standalone. 'modules-skip*': [SKIP], 'harmony/modules-skip*': [SKIP], + 'regress/modules-skip*': [SKIP], # All tests in the bug directory are expected to fail. 'bugs/*': [FAIL], @@ -78,13 +79,16 @@ ############################################################################## # No need to waste time for this test. - 'd8-performance-now': [PASS, NO_VARIANTS], + 'd8/d8-performance-now': [PASS, NO_VARIANTS], 'regress/regress-crbug-491062': [PASS, NO_VARIANTS], # Issue 488: this test sometimes times out. # TODO(arm): This seems to flush out a bug on arm with simulator. 'array-constructor': [PASS, SLOW, ['arch == arm and simulator == True', SKIP]], + # Very slow test + 'regress/regress-crbug-808192' : [PASS, NO_VARIANTS, ['arch == arm or arch == arm64 or arch == android_arm or arch == android_arm64 or arch == mipsel or arch == mips64el or arch == mips64 or arch == mips', SKIP]], + # Very slow on ARM and MIPS, contains no architecture dependent code. 'unicode-case-overoptimization': [PASS, NO_VARIANTS, ['arch == arm or arch == arm64 or arch == android_arm or arch == android_arm64 or arch == mipsel or arch == mips64el or arch == mips64 or arch == mips', SKIP]], 'regress/regress-3976': [PASS, NO_VARIANTS, ['arch == arm or arch == arm64 or arch == android_arm or arch == android_arm64 or arch == mipsel or arch == mips64el or arch == mips64 or arch == mips', SKIP]], @@ -109,11 +113,17 @@ # we cannot run several variants of d8-os simultaneously, since all of them # get the same random seed and would generate the same directory name. Besides # that, it doesn't make sense to run several variants of d8-os anyways. - 'd8-os': [PASS, NO_VARIANTS, ['isolates or arch == android_arm or arch == android_arm64 or arch == android_ia32', SKIP]], + 'd8/d8-os': [PASS, NO_VARIANTS, ['isolates or arch == android_arm or arch == android_arm64 or arch == android_ia32', SKIP]], 'tools/tickprocessor': [PASS, NO_VARIANTS, ['arch == android_arm or arch == android_arm64 or arch == android_ia32', SKIP]], 'tools/dumpcpp': [PASS, NO_VARIANTS, ['arch == android_arm or arch == android_arm64 or arch == android_ia32', SKIP]], ############################################################################## + # This test generates a file in the test directory, so we cannot run several + # variants of the test simultaneously. Additionally the test should not be + # affected by variants. + 'd8/enable-tracing': [PASS, NO_VARIANTS], + + ############################################################################## # Long running test that reproduces memory leak and should be run manually. 'regress/regress-2073': [SKIP], @@ -135,9 +145,9 @@ 'math-floor-of-div-nosudiv': [PASS, SLOW, ['arch not in [arm, arm64, android_arm, android_arm64]', SKIP]], # Too slow for slow variants. - 'asm/embenchen/*': [PASS, SLOW, FAST_VARIANTS], - 'asm/poppler/*': [PASS, SLOW, FAST_VARIANTS], - 'asm/sqlite3/*': [PASS, SLOW, FAST_VARIANTS], + 'asm/embenchen/*': [PASS, SLOW, NO_VARIANTS], + 'asm/poppler/*': [PASS, SLOW, NO_VARIANTS], + 'asm/sqlite3/*': [PASS, SLOW, NO_VARIANTS], # Slow tests. 'copy-on-write-assert': [PASS, SLOW], @@ -162,6 +172,7 @@ 'regexp-modifiers-autogenerated-i18n': [PASS, ['no_i18n == True', FAIL]], # desugaring regexp property class relies on ICU. 'harmony/regexp-property-*': [PASS, ['no_i18n == True', FAIL]], + 'regress/regress-793588': [PASS, ['no_i18n == True', FAIL]], # noi18n build cannot parse characters in supplementary plane. 'harmony/regexp-named-captures': [PASS, ['no_i18n == True', FAIL]], @@ -193,13 +204,19 @@ }], # novfp3 == True ############################################################################## +# TODO(ahaas): Port multiple return values to ARM, MIPS, S390 and PPC +['arch == arm or arch == arm64 or arch == mips or arch == mips64 or arch == mipsel or arch == mips64el or arch == s390 or arch == s390x or arch == ppc or arch == ppc64', { + 'wasm/multi-value': [SKIP], +}], + +############################################################################## ['gc_stress == True', { # Skip tests not suitable for GC stress. 'allocation-site-info': [SKIP], 'array-constructor-feedback': [SKIP], 'array-feedback': [SKIP], 'array-literal-feedback': [SKIP], - 'd8-performance-now': [SKIP], + 'd8/d8-performance-now': [SKIP], 'elements-kind': [SKIP], 'elements-transition-hoisting': [SKIP], 'fast-prototype': [SKIP], @@ -250,7 +267,7 @@ 'regress/regress-inline-getter-near-stack-limit': [PASS, SLOW], # BUG(v8:4779): Crashes flakily with stress mode on arm64. - 'array-splice': [PASS, SLOW, ['arch == arm64', FAST_VARIANTS]], + 'array-splice': [PASS, SLOW, ['arch == arm64', NO_VARIANTS]], # BUG(chromium:751825): Crashes flakily. 'wasm/js-api': [SKIP], @@ -333,6 +350,9 @@ 'unicode-test': [PASS, SLOW], 'wasm/atomics': [PASS, SLOW], 'whitespaces': [PASS, SLOW], + + # BUG(v8:7247). + 'regress/regress-779407': [PASS, SLOW, NO_VARIANTS], }], # 'arch == arm64' ['arch == arm64 and mode == debug and simulator_run', { @@ -578,9 +598,6 @@ 'math-floor-of-div-nosudiv': [PASS, ['mode == debug', SKIP]], 'unicodelctest': [PASS, ['mode == debug', SKIP]], - # BUG(v8:4495). - 'es6/collections': [PASS, ['arch == ia32', FAST_VARIANTS]], - # Setting the timezone and locale with environment variables unavailable 'icu-date-to-string': [SKIP], 'icu-date-lord-howe': [SKIP], @@ -624,14 +641,19 @@ 'regress/regress-336820': [SKIP], 'regress/regress-748069': [SKIP], 'regress/regress-778668': [SKIP], + 'ignition/regress-672027': [PASS, ['tsan', SKIP]], }], # 'gc_fuzzer == True' ############################################################################## ['predictable == True', { # Skip tests that are known to be non-deterministic. - 'd8-worker-sharedarraybuffer': [SKIP], - 'd8-os': [SKIP], + 'd8/d8-worker-sharedarraybuffer': [SKIP], + 'd8/d8-os': [SKIP], + 'harmony/futex': [SKIP], + + # BUG(v8:7166). + 'd8/enable-tracing': [SKIP], }], # 'predictable == True' ############################################################################## @@ -735,16 +757,17 @@ }], # arch != x64 and arch != ia32 ############################################################################## -# BUG(v8:7138). -['arch == arm and not simulator_run and variant == wasm_traps', { - '*': [SKIP], -}], # arch == arm and not simulator_run and variant == wasm_traps - -############################################################################## ['variant == liftoff', { # In the liftoff variant, liftoff compilation happens even though the test # does not explicitly enable it. 'wasm/default-liftoff-setting': [SKIP], }], # variant == liftoff +############################################################################## +['variant == slow_path and gc_stress', { + # Slow tests. + 'regress/regress-crbug-493779': [SKIP], + 'string-replace-gc': [SKIP], +}], # variant == slow_path + ] diff --git a/deps/v8/test/mjsunit/optimized-array-every.js b/deps/v8/test/mjsunit/optimized-array-every.js new file mode 100644 index 0000000000..0cbab7df67 --- /dev/null +++ b/deps/v8/test/mjsunit/optimized-array-every.js @@ -0,0 +1,520 @@ +// 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 --turbo-inline-array-builtins --opt +// Flags: --no-always-opt + +// Early exit from every functions properly. +(() => { + const a = [1, 2, 3, 4, 5]; + let result = 0; + function earlyExit() { + return a.every(v => { + result += v; + return v < 2; + }); + } + assertFalse(earlyExit()); + earlyExit(); + %OptimizeFunctionOnNextCall(earlyExit); + assertFalse(earlyExit()); + assertEquals(9, result); +})(); + +// Soft-deopt plus early exit. +(() => { + const a = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]; + let result = 0; + function softyPlusEarlyExit(deopt) { + return a.every(v => { + result += v; + if (v === 4 && deopt) { + a.abc = 25; + } + return v < 8; + }); + } + assertFalse(softyPlusEarlyExit(false)); + softyPlusEarlyExit(false); + %OptimizeFunctionOnNextCall(softyPlusEarlyExit); + assertFalse(softyPlusEarlyExit(true)); + assertEquals(36*3, result); +})(); + +// Soft-deopt synced with early exit, which forces the lazy deoptimization +// continuation handler to exit. +(() => { + const a = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]; + let called_values = []; + function softyPlusEarlyExit(deopt) { + called_values = []; + return a.every(v => { + called_values.push(v); + if (v === 4 && deopt) { + a.abc = 25; + return false; + } + return v < 8; + }); + } + assertFalse(softyPlusEarlyExit(false)); + assertArrayEquals([1, 2, 3, 4, 5, 6, 7, 8], called_values); + softyPlusEarlyExit(false); + %OptimizeFunctionOnNextCall(softyPlusEarlyExit); + assertFalse(softyPlusEarlyExit(true)); + assertArrayEquals([1, 2, 3, 4], called_values); +})(); + +// Unknown field access leads to soft-deopt unrelated to every, should still +// lead to correct result. +(() => { + const a = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, + 20, 21, 22, 23, 24, 25]; + let result = 0; + function eagerDeoptInCalled(deopt) { + return a.every((v, i) => { + if (i === 13 && deopt) { + a.abc = 25; + } + result += v; + return true; + }); + } + eagerDeoptInCalled(); + eagerDeoptInCalled(); + %OptimizeFunctionOnNextCall(eagerDeoptInCalled); + eagerDeoptInCalled(); + assertTrue(eagerDeoptInCalled(true)); + eagerDeoptInCalled(); + assertEquals(1625, result); +})(); + +// Length change detected during loop, must cause properly handled eager deopt. +(() => { + let called_values; + function eagerDeoptInCalled(deopt) { + const a = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]; + called_values = []; + return a.every((v,i) => { + called_values.push(v); + a.length = (i === 5 && deopt) ? 8 : 10; + return true; + }); + } + assertTrue(eagerDeoptInCalled()); + assertArrayEquals([1, 2, 3, 4, 5, 6, 7, 8, 9, 10], called_values); + eagerDeoptInCalled(); + %OptimizeFunctionOnNextCall(eagerDeoptInCalled); + assertTrue(eagerDeoptInCalled()); + assertTrue(eagerDeoptInCalled(true)); + assertArrayEquals([1, 2, 3, 4, 5, 6, 7, 8], called_values); + eagerDeoptInCalled(); +})(); + +// Lazy deopt from a callback that changes the input array. Deopt in a callback +// execution that returns true. +(() => { + const a = [1, 2, 3, 4, 5]; + function lazyChanger(deopt) { + return a.every((v, i) => { + if (i === 3 && deopt) { + a[3] = 100; + %DeoptimizeNow(); + } + return true; + }); + } + assertTrue(lazyChanger()); + lazyChanger(); + %OptimizeFunctionOnNextCall(lazyChanger); + assertTrue(lazyChanger(true)); + assertTrue(lazyChanger()); +})(); + +// Lazy deopt from a callback that will always return true and no element is +// found. Verifies the lazy-after-callback continuation builtin. +(() => { + const a = [1, 2, 3, 4, 5]; + function lazyChanger(deopt) { + return a.every((v, i) => { + if (i === 3 && deopt) { + %DeoptimizeNow(); + } + return true; + }); + } + assertTrue(lazyChanger()); + lazyChanger(); + %OptimizeFunctionOnNextCall(lazyChanger); + assertTrue(lazyChanger(true)); + assertTrue(lazyChanger()); +})(); + +// Lazy deopt from a callback that changes the input array. Deopt in a callback +// execution that returns true. +(() => { + const a = [1, 2, 3, 4, 5]; + function lazyChanger(deopt) { + return a.every((v, i) => { + if (i === 2 && deopt) { + a[3] = 100; + %DeoptimizeNow(); + } + return true; + }); + } + assertTrue(lazyChanger()); + lazyChanger(); + %OptimizeFunctionOnNextCall(lazyChanger); + assertTrue(lazyChanger(true)); + assertTrue(lazyChanger()); +})(); + +// Escape analyzed array +(() => { + let result = 0; + function eagerDeoptInCalled(deopt) { + const a_noescape = [0, 1, 2, 3, 4, 5]; + a_noescape.every((v, i) => { + result += v | 0; + if (i === 13 && deopt) { + a_noescape.length = 25; + } + return true; + }); + } + eagerDeoptInCalled(); + eagerDeoptInCalled(); + %OptimizeFunctionOnNextCall(eagerDeoptInCalled); + eagerDeoptInCalled(); + eagerDeoptInCalled(true); + eagerDeoptInCalled(); + assertEquals(75, result); +})(); + +// Lazy deopt from runtime call from inlined callback function. +(() => { + const a = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, + 20, 21, 22, 23, 24, 25]; + let result = 0; + function lazyDeopt(deopt) { + a.every((v, i) => { + result += i; + if (i === 13 && deopt) { + %DeoptimizeNow(); + } + return true; + }); + } + lazyDeopt(); + lazyDeopt(); + %OptimizeFunctionOnNextCall(lazyDeopt); + lazyDeopt(); + lazyDeopt(true); + lazyDeopt(); + assertEquals(1500, result); +})(); + +// Lazy deopt from runtime call from non-inline callback function. +(() => { + const a = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, + 20, 21, 22, 23, 24, 25]; + let result = 0; + function lazyDeopt(deopt) { + function callback(v, i) { + result += i; + if (i === 13 && deopt) { + %DeoptimizeNow(); + } + return true; + } + %NeverOptimizeFunction(callback); + a.every(callback); + } + lazyDeopt(); + lazyDeopt(); + %OptimizeFunctionOnNextCall(lazyDeopt); + lazyDeopt(); + lazyDeopt(true); + lazyDeopt(); + assertEquals(1500, result); +})(); + +// Call to a.every is done inside a try-catch block and the callback function +// being called actually throws. +(() => { + const a = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, + 20, 21, 22, 23, 24, 25]; + let caught = false; + function lazyDeopt(deopt) { + try { + a.every((v, i) => { + if (i === 1 && deopt) { + throw("a"); + } + return true; + }); + } catch (e) { + caught = true; + } + } + lazyDeopt(); + lazyDeopt(); + %OptimizeFunctionOnNextCall(lazyDeopt); + lazyDeopt(); + assertDoesNotThrow(() => lazyDeopt(true)); + assertTrue(caught); + lazyDeopt(); +})(); + +// Call to a.every is done inside a try-catch block and the callback function +// being called actually throws, but the callback is not inlined. +(() => { + let a = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]; + let caught = false; + function lazyDeopt(deopt) { + function callback(v, i) { + if (i === 1 && deopt) { + throw("a"); + } + return true; + } + %NeverOptimizeFunction(callback); + try { + a.every(callback); + } catch (e) { + caught = true; + } + } + lazyDeopt(); + lazyDeopt(); + %OptimizeFunctionOnNextCall(lazyDeopt); + lazyDeopt(); + assertDoesNotThrow(() => lazyDeopt(true)); + assertTrue(caught); + lazyDeopt(); +})(); + +// Call to a.every is done inside a try-catch block and the callback function +// being called throws into a deoptimized caller function. +(function TestThrowIntoDeoptimizedOuter() { + const a = [1, 2, 3, 4]; + function lazyDeopt(deopt) { + function callback(v, i) { + if (i === 1 && deopt) { + %DeoptimizeFunction(lazyDeopt); + throw "some exception"; + } + return true; + } + %NeverOptimizeFunction(callback); + let result = 0; + try { + result = a.every(callback); + } catch (e) { + assertEquals("some exception", e); + result = "nope"; + } + return result; + } + assertEquals(true, lazyDeopt(false)); + assertEquals(true, lazyDeopt(false)); + assertEquals("nope", lazyDeopt(true)); + assertEquals("nope", lazyDeopt(true)); + %OptimizeFunctionOnNextCall(lazyDeopt); + assertEquals(true, lazyDeopt(false)); + assertEquals("nope", lazyDeopt(true)); +})(); + +// An error generated inside the callback includes every in it's +// stack trace. +(() => { + const re = /Array\.every/; + function lazyDeopt(deopt) { + const b = [1, 2, 3]; + let result = 0; + b.every((v, i) => { + result += v; + if (i === 1) { + const e = new Error(); + assertTrue(re.exec(e.stack) !== null); + } + return true; + }); + } + lazyDeopt(); + lazyDeopt(); + %OptimizeFunctionOnNextCall(lazyDeopt); + lazyDeopt(); +})(); + +// An error generated inside a non-inlined callback function also +// includes every in it's stack trace. +(() => { + const re = /Array\.every/; + function lazyDeopt(deopt) { + const b = [1, 2, 3]; + let did_assert_error = false; + let result = 0; + function callback(v, i) { + result += v; + if (i === 1) { + const e = new Error(); + assertTrue(re.exec(e.stack) !== null); + did_assert_error = true; + } + return true; + } + %NeverOptimizeFunction(callback); + b.every(callback); + return did_assert_error; + } + lazyDeopt(); + lazyDeopt(); + %OptimizeFunctionOnNextCall(lazyDeopt); + assertTrue(lazyDeopt()); +})(); + +// An error generated inside a recently deoptimized callback function +// includes every in it's stack trace. +(() => { + const re = /Array\.every/; + function lazyDeopt(deopt) { + const b = [1, 2, 3]; + let did_assert_error = false; + let result = 0; + b.every((v, i) => { + result += v; + if (i === 1) { + %DeoptimizeNow(); + } else if (i === 2) { + const e = new Error(); + assertTrue(re.exec(e.stack) !== null); + did_assert_error = true; + } + return true; + }); + return did_assert_error; + } + lazyDeopt(); + lazyDeopt(); + %OptimizeFunctionOnNextCall(lazyDeopt); + assertTrue(lazyDeopt()); +})(); + +// Verify that various exception edges are handled appropriately. +// The thrown Error object should always indicate it was created from +// an every call stack. +(() => { + const re = /Array\.every/; + const a = [1, 2, 3]; + let result = 0; + function lazyDeopt() { + a.every((v, i) => { + result += i; + if (i === 1) { + %DeoptimizeFunction(lazyDeopt); + throw new Error(); + } + return true; + }); + } + assertThrows(() => lazyDeopt()); + assertThrows(() => lazyDeopt()); + try { + lazyDeopt(); + } catch (e) { + assertTrue(re.exec(e.stack) !== null); + } + %OptimizeFunctionOnNextCall(lazyDeopt); + try { + lazyDeopt(); + } catch (e) { + assertTrue(re.exec(e.stack) !== null); + } +})(); + +// Verify holes are skipped. +(() => { + const a = [1, 2, , 3, 4]; + function withHoles() { + const callback_values = []; + a.every(v => { + callback_values.push(v); + return true; + }); + return callback_values; + } + withHoles(); + withHoles(); + %OptimizeFunctionOnNextCall(withHoles); + assertArrayEquals([1, 2, 3, 4], withHoles()); +})(); + +(() => { + const a = [1.5, 2.5, , 3.5, 4.5]; + function withHoles() { + const callback_values = []; + a.every(v => { + callback_values.push(v); + return true; + }); + return callback_values; + } + withHoles(); + withHoles(); + %OptimizeFunctionOnNextCall(withHoles); + assertArrayEquals([1.5, 2.5, 3.5, 4.5], withHoles()); +})(); + +// Ensure that we handle side-effects between load and call. +(() => { + function side_effect(a, b) { if (b) a.foo = 3; return a; } + %NeverOptimizeFunction(side_effect); + + function unreliable(a, b) { + return a.every(x => true, side_effect(a, b)); + } + + let a = [1, 2, 3]; + unreliable(a, false); + unreliable(a, false); + %OptimizeFunctionOnNextCall(unreliable); + unreliable(a, false); + // Now actually do change the map. + unreliable(a, true); +})(); + +// Handle callback is not callable. +(() => { + const a = [1, 2, 3, 4, 5]; + function notCallable() { + return a.every(undefined); + } + + assertThrows(notCallable, TypeError); + try { notCallable(); } catch(e) { } + %OptimizeFunctionOnNextCall(notCallable); + assertThrows(notCallable, TypeError); +})(); + +// Messing with the Array prototype causes deoptimization. +(() => { + const a = [1, 2, 3]; + let result = 0; + function prototypeChanged() { + a.every((v, i) => { + result += v; + return true; + }); + } + prototypeChanged(); + prototypeChanged(); + %OptimizeFunctionOnNextCall(prototypeChanged); + prototypeChanged(); + a.constructor = {}; + prototypeChanged(); + assertUnoptimized(prototypeChanged); + assertEquals(24, result); +})(); diff --git a/deps/v8/test/mjsunit/optimized-array-find.js b/deps/v8/test/mjsunit/optimized-array-find.js new file mode 100644 index 0000000000..abcd2cf704 --- /dev/null +++ b/deps/v8/test/mjsunit/optimized-array-find.js @@ -0,0 +1,460 @@ +// 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 --turbo-inline-array-builtins --opt +// Flags: --no-always-opt + +// Unknown field access leads to soft-deopt unrelated to find, should still +// lead to correct result. +(() => { + const a = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, + 20, 21, 22, 23, 24, 25]; + let result = 0; + function eagerDeoptInCalled(deopt) { + return a.find((v, i) => { + if (i === 13 && deopt) { + a.abc = 25; + } + result += v; + return v === 20; + }); + } + eagerDeoptInCalled(); + eagerDeoptInCalled(); + %OptimizeFunctionOnNextCall(eagerDeoptInCalled); + eagerDeoptInCalled(); + assertEquals(20, eagerDeoptInCalled(true)); + eagerDeoptInCalled(); + assertEquals(1050, result); +})(); + +// Length change detected during loop, must cause properly handled eager deopt. +(() => { + let called_values; + function eagerDeoptInCalled(deopt) { + const a = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]; + called_values = []; + return a.find((v,i) => { + called_values.push(v); + a.length = (i === 5 && deopt) ? 8 : 10; + return v === 9; + }); + } + assertEquals(9, eagerDeoptInCalled()); + assertArrayEquals([1, 2, 3, 4, 5, 6, 7, 8, 9], called_values); + eagerDeoptInCalled(); + %OptimizeFunctionOnNextCall(eagerDeoptInCalled); + assertEquals(9, eagerDeoptInCalled()); + assertEquals(undefined, eagerDeoptInCalled(true)); + assertArrayEquals([1, 2, 3, 4, 5, 6, 7, 8, undefined, undefined], + called_values); + eagerDeoptInCalled(); +})(); + +// Lazy deopt from a callback that changes the input array. Deopt in a callback +// execution that returns true. +(() => { + const a = [1, 2, 3, 4, 5]; + function lazyChanger(deopt) { + return a.find((v, i) => { + if (i === 3 && deopt) { + a[3] = 100; + %DeoptimizeNow(); + } + return v > 3; + }); + } + assertEquals(4, lazyChanger()); + lazyChanger(); + %OptimizeFunctionOnNextCall(lazyChanger); + assertEquals(4, lazyChanger(true)); + assertEquals(100, lazyChanger()); +})(); + +// Lazy deopt from a callback that will always return false and no element is +// found. Verifies the lazy-after-callback continuation builtin. +(() => { + const a = [1, 2, 3, 4, 5]; + function lazyChanger(deopt) { + return a.find((v, i) => { + if (i === 3 && deopt) { + %DeoptimizeNow(); + } + return false; + }); + } + assertEquals(undefined, lazyChanger()); + lazyChanger(); + %OptimizeFunctionOnNextCall(lazyChanger); + assertEquals(undefined, lazyChanger(true)); + assertEquals(undefined, lazyChanger()); +})(); + +// Lazy deopt from a callback that changes the input array. Deopt in a callback +// execution that returns false. +(() => { + const a = [1, 2, 3, 4, 5]; + function lazyChanger(deopt) { + return a.find((v, i) => { + if (i === 2 && deopt) { + a[3] = 100; + %DeoptimizeNow(); + } + return v > 3; + }); + } + assertEquals(4, lazyChanger()); + lazyChanger(); + %OptimizeFunctionOnNextCall(lazyChanger); + assertEquals(100, lazyChanger(true)); + assertEquals(100, lazyChanger()); +})(); + +// Escape analyzed array +(() => { + let result = 0; + function eagerDeoptInCalled(deopt) { + const a_noescape = [0, 1, 2, 3, 4, 5]; + a_noescape.find((v, i) => { + result += v | 0; + if (i === 13 && deopt) { + a_noescape.length = 25; + } + return false; + }); + } + eagerDeoptInCalled(); + eagerDeoptInCalled(); + %OptimizeFunctionOnNextCall(eagerDeoptInCalled); + eagerDeoptInCalled(); + eagerDeoptInCalled(true); + eagerDeoptInCalled(); + assertEquals(75, result); +})(); + +// Lazy deopt from runtime call from inlined callback function. +(() => { + const a = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, + 20, 21, 22, 23, 24, 25]; + let result = 0; + function lazyDeopt(deopt) { + a.find((v, i) => { + result += i; + if (i === 13 && deopt) { + %DeoptimizeNow(); + } + return false; + }); + } + lazyDeopt(); + lazyDeopt(); + %OptimizeFunctionOnNextCall(lazyDeopt); + lazyDeopt(); + lazyDeopt(true); + lazyDeopt(); + assertEquals(1500, result); +})(); + +// Lazy deopt from runtime call from non-inline callback function. +(() => { + const a = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, + 20, 21, 22, 23, 24, 25]; + let result = 0; + function lazyDeopt(deopt) { + function callback(v, i) { + result += i; + if (i === 13 && deopt) { + %DeoptimizeNow(); + } + return false; + } + %NeverOptimizeFunction(callback); + a.find(callback); + } + lazyDeopt(); + lazyDeopt(); + %OptimizeFunctionOnNextCall(lazyDeopt); + lazyDeopt(); + lazyDeopt(true); + lazyDeopt(); + assertEquals(1500, result); +})(); + +// Call to a.find is done inside a try-catch block and the callback function +// being called actually throws. +(() => { + const a = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, + 20, 21, 22, 23, 24, 25]; + let caught = false; + function lazyDeopt(deopt) { + try { + a.find((v, i) => { + if (i === 1 && deopt) { + throw("a"); + } + return false; + }); + } catch (e) { + caught = true; + } + } + lazyDeopt(); + lazyDeopt(); + %OptimizeFunctionOnNextCall(lazyDeopt); + lazyDeopt(); + assertDoesNotThrow(() => lazyDeopt(true)); + assertTrue(caught); + lazyDeopt(); +})(); + +// Call to a.find is done inside a try-catch block and the callback function +// being called actually throws, but the callback is not inlined. +(() => { + let a = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]; + let caught = false; + function lazyDeopt(deopt) { + function callback(v, i) { + if (i === 1 && deopt) { + throw("a"); + } + return false; + } + %NeverOptimizeFunction(callback); + try { + a.find(callback); + } catch (e) { + caught = true; + } + } + lazyDeopt(); + lazyDeopt(); + %OptimizeFunctionOnNextCall(lazyDeopt); + lazyDeopt(); + assertDoesNotThrow(() => lazyDeopt(true)); + assertTrue(caught); + lazyDeopt(); +})(); + +// Call to a.find is done inside a try-catch block and the callback function +// being called throws into a deoptimized caller function. +(function TestThrowIntoDeoptimizedOuter() { + const a = [1, 2, 3, 4]; + function lazyDeopt(deopt) { + function callback(v, i) { + if (i === 1 && deopt) { + %DeoptimizeFunction(lazyDeopt); + throw "some exception"; + } + return v === 3; + } + %NeverOptimizeFunction(callback); + let result = 0; + try { + result = a.find(callback); + } catch (e) { + assertEquals("some exception", e); + result = "nope"; + } + return result; + } + assertEquals(3, lazyDeopt(false)); + assertEquals(3, lazyDeopt(false)); + assertEquals("nope", lazyDeopt(true)); + assertEquals("nope", lazyDeopt(true)); + %OptimizeFunctionOnNextCall(lazyDeopt); + assertEquals(3, lazyDeopt(false)); + assertEquals("nope", lazyDeopt(true)); +})(); + +// An error generated inside the callback includes find in it's +// stack trace. +(() => { + const re = /Array\.find/; + function lazyDeopt(deopt) { + const b = [1, 2, 3]; + let result = 0; + b.find((v, i) => { + result += v; + if (i === 1) { + const e = new Error(); + assertTrue(re.exec(e.stack) !== null); + } + return false; + }); + } + lazyDeopt(); + lazyDeopt(); + %OptimizeFunctionOnNextCall(lazyDeopt); + lazyDeopt(); +})(); + +// An error generated inside a non-inlined callback function also +// includes find in it's stack trace. +(() => { + const re = /Array\.find/; + function lazyDeopt(deopt) { + const b = [1, 2, 3]; + let did_assert_error = false; + let result = 0; + function callback(v, i) { + result += v; + if (i === 1) { + const e = new Error(); + assertTrue(re.exec(e.stack) !== null); + did_assert_error = true; + } + return false; + } + %NeverOptimizeFunction(callback); + b.find(callback); + return did_assert_error; + } + lazyDeopt(); + lazyDeopt(); + %OptimizeFunctionOnNextCall(lazyDeopt); + assertTrue(lazyDeopt()); +})(); + +// An error generated inside a recently deoptimized callback function +// includes find in it's stack trace. +(() => { + const re = /Array\.find/; + function lazyDeopt(deopt) { + const b = [1, 2, 3]; + let did_assert_error = false; + let result = 0; + b.find((v, i) => { + result += v; + if (i === 1) { + %DeoptimizeNow(); + } else if (i === 2) { + const e = new Error(); + assertTrue(re.exec(e.stack) !== null); + did_assert_error = true; + } + return false; + }); + return did_assert_error; + } + lazyDeopt(); + lazyDeopt(); + %OptimizeFunctionOnNextCall(lazyDeopt); + assertTrue(lazyDeopt()); +})(); + +// Verify that various exception edges are handled appropriately. +// The thrown Error object should always indicate it was created from +// a find call stack. +(() => { + const re = /Array\.find/; + const a = [1, 2, 3]; + let result = 0; + function lazyDeopt() { + a.find((v, i) => { + result += i; + if (i === 1) { + %DeoptimizeFunction(lazyDeopt); + throw new Error(); + } + return false; + }); + } + assertThrows(() => lazyDeopt()); + assertThrows(() => lazyDeopt()); + try { + lazyDeopt(); + } catch (e) { + assertTrue(re.exec(e.stack) !== null); + } + %OptimizeFunctionOnNextCall(lazyDeopt); + try { + lazyDeopt(); + } catch (e) { + assertTrue(re.exec(e.stack) !== null); + } +})(); + +// Messing with the Array prototype causes deoptimization. +(() => { + const a = [1, 2, 3]; + let result = 0; + function prototypeChanged() { + a.find((v, i) => { + result += v; + return false; + }); + } + prototypeChanged(); + prototypeChanged(); + %OptimizeFunctionOnNextCall(prototypeChanged); + prototypeChanged(); + a.constructor = {}; + prototypeChanged(); + assertUnoptimized(prototypeChanged); + assertEquals(24, result); +})(); + +// Verify holes are replaced with undefined. +(() => { + const a = [1, 2, , 3, 4]; + function withHoles() { + const callback_values = []; + a.find(v => { + callback_values.push(v); + return false; + }); + return callback_values; + } + withHoles(); + withHoles(); + %OptimizeFunctionOnNextCall(withHoles); + assertArrayEquals([1, 2, undefined, 3, 4], withHoles()); +})(); + +(() => { + const a = [1.5, 2.5, , 3.5, 4.5]; + function withHoles() { + const callback_values = []; + a.find(v => { + callback_values.push(v); + return false; + }); + return callback_values; + } + withHoles(); + withHoles(); + %OptimizeFunctionOnNextCall(withHoles); + assertArrayEquals([1.5, 2.5, undefined, 3.5, 4.5], withHoles()); +})(); + +// Ensure that we handle side-effects between load and call. +(() => { + function side_effect(a, b) { if (b) a.foo = 3; return a; } + %NeverOptimizeFunction(side_effect); + + function unreliable(a, b) { + return a.find(x => false, side_effect(a, b)); + } + + let a = [1, 2, 3]; + unreliable(a, false); + unreliable(a, false); + %OptimizeFunctionOnNextCall(unreliable); + unreliable(a, false); + // Now actually do change the map. + unreliable(a, true); +})(); + +// Handle callback is not callable. +(() => { + const a = [1, 2, 3, 4, 5]; + function notCallable() { + return a.find(undefined); + } + + assertThrows(notCallable, TypeError); + try { notCallable(); } catch(e) { } + %OptimizeFunctionOnNextCall(notCallable); + assertThrows(notCallable, TypeError); +})(); diff --git a/deps/v8/test/mjsunit/optimized-array-findindex.js b/deps/v8/test/mjsunit/optimized-array-findindex.js new file mode 100644 index 0000000000..91f4a6cc60 --- /dev/null +++ b/deps/v8/test/mjsunit/optimized-array-findindex.js @@ -0,0 +1,460 @@ +// 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 --turbo-inline-array-builtins --opt +// Flags: --no-always-opt + +// Unknown field access leads to soft-deopt unrelated to findIndex, should still +// lead to correct result. +(() => { + const a = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, + 20, 21, 22, 23, 24, 25]; + let result = 0; + function eagerDeoptInCalled(deopt) { + return a.findIndex((v, i) => { + if (i === 13 && deopt) { + a.abc = 25; + } + result += v; + return v === 20; + }); + } + eagerDeoptInCalled(); + eagerDeoptInCalled(); + %OptimizeFunctionOnNextCall(eagerDeoptInCalled); + eagerDeoptInCalled(); + assertEquals(19, eagerDeoptInCalled(true)); + eagerDeoptInCalled(); + assertEquals(1050, result); +})(); + +// Length change detected during loop, must cause properly handled eager deopt. +(() => { + let called_values; + function eagerDeoptInCalled(deopt) { + const a = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]; + called_values = []; + return a.findIndex((v,i) => { + called_values.push(v); + a.length = (i === 5 && deopt) ? 8 : 10; + return v === 9; + }); + } + assertEquals(8, eagerDeoptInCalled()); + assertArrayEquals([1, 2, 3, 4, 5, 6, 7, 8, 9], called_values); + eagerDeoptInCalled(); + %OptimizeFunctionOnNextCall(eagerDeoptInCalled); + assertEquals(8, eagerDeoptInCalled()); + assertEquals(-1, eagerDeoptInCalled(true)); + assertArrayEquals([1, 2, 3, 4, 5, 6, 7, 8, undefined, undefined], + called_values); + eagerDeoptInCalled(); +})(); + +// Lazy deopt from a callback that changes the input array. Deopt in a callback +// execution that returns true. +(() => { + const a = [1, 2, 3, 4, 5]; + function lazyChanger(deopt) { + return a.findIndex((v, i) => { + if (i === 3 && deopt) { + a[3] = 3; + %DeoptimizeNow(); + } + return v > 3; + }); + } + assertEquals(3, lazyChanger()); + lazyChanger(); + %OptimizeFunctionOnNextCall(lazyChanger); + assertEquals(3, lazyChanger(true)); + assertEquals(4, lazyChanger()); +})(); + +// Lazy deopt from a callback that will always return false and no element is +// found. Verifies the lazy-after-callback continuation builtin. +(() => { + const a = [1, 2, 3, 4, 5]; + function lazyChanger(deopt) { + return a.findIndex((v, i) => { + if (i === 3 && deopt) { + %DeoptimizeNow(); + } + return false; + }); + } + assertEquals(-1, lazyChanger()); + lazyChanger(); + %OptimizeFunctionOnNextCall(lazyChanger); + assertEquals(-1, lazyChanger(true)); + assertEquals(-1, lazyChanger()); +})(); + +// Lazy deopt from a callback that changes the input array. Deopt in a callback +// execution that returns false. +(() => { + const a = [1, 2, 3, 4, 5]; + function lazyChanger(deopt) { + return a.findIndex((v, i) => { + if (i === 2 && deopt) { + a[3] = 2; + %DeoptimizeNow(); + } + return v > 3; + }); + } + assertEquals(3, lazyChanger()); + lazyChanger(); + %OptimizeFunctionOnNextCall(lazyChanger); + assertEquals(4, lazyChanger(true)); + assertEquals(4, lazyChanger()); +})(); + +// Escape analyzed array +(() => { + let result = 0; + function eagerDeoptInCalled(deopt) { + const a_noescape = [0, 1, 2, 3, 4, 5]; + a_noescape.findIndex((v, i) => { + result += v | 0; + if (i === 13 && deopt) { + a_noescape.length = 25; + } + return false; + }); + } + eagerDeoptInCalled(); + eagerDeoptInCalled(); + %OptimizeFunctionOnNextCall(eagerDeoptInCalled); + eagerDeoptInCalled(); + eagerDeoptInCalled(true); + eagerDeoptInCalled(); + assertEquals(75, result); +})(); + +// Lazy deopt from runtime call from inlined callback function. +(() => { + const a = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, + 20, 21, 22, 23, 24, 25]; + let result = 0; + function lazyDeopt(deopt) { + a.findIndex((v, i) => { + result += i; + if (i === 13 && deopt) { + %DeoptimizeNow(); + } + return false; + }); + } + lazyDeopt(); + lazyDeopt(); + %OptimizeFunctionOnNextCall(lazyDeopt); + lazyDeopt(); + lazyDeopt(true); + lazyDeopt(); + assertEquals(1500, result); +})(); + +// Lazy deopt from runtime call from non-inline callback function. +(() => { + const a = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, + 20, 21, 22, 23, 24, 25]; + let result = 0; + function lazyDeopt(deopt) { + function callback(v, i) { + result += i; + if (i === 13 && deopt) { + %DeoptimizeNow(); + } + return false; + } + %NeverOptimizeFunction(callback); + a.findIndex(callback); + } + lazyDeopt(); + lazyDeopt(); + %OptimizeFunctionOnNextCall(lazyDeopt); + lazyDeopt(); + lazyDeopt(true); + lazyDeopt(); + assertEquals(1500, result); +})(); + +// Call to a.findIndex is done inside a try-catch block and the callback function +// being called actually throws. +(() => { + const a = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, + 20, 21, 22, 23, 24, 25]; + let caught = false; + function lazyDeopt(deopt) { + try { + a.findIndex((v, i) => { + if (i === 1 && deopt) { + throw("a"); + } + return false; + }); + } catch (e) { + caught = true; + } + } + lazyDeopt(); + lazyDeopt(); + %OptimizeFunctionOnNextCall(lazyDeopt); + lazyDeopt(); + assertDoesNotThrow(() => lazyDeopt(true)); + assertTrue(caught); + lazyDeopt(); +})(); + +// Call to a.findIndex is done inside a try-catch block and the callback function +// being called actually throws, but the callback is not inlined. +(() => { + let a = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]; + let caught = false; + function lazyDeopt(deopt) { + function callback(v, i) { + if (i === 1 && deopt) { + throw("a"); + } + return false; + } + %NeverOptimizeFunction(callback); + try { + a.findIndex(callback); + } catch (e) { + caught = true; + } + } + lazyDeopt(); + lazyDeopt(); + %OptimizeFunctionOnNextCall(lazyDeopt); + lazyDeopt(); + assertDoesNotThrow(() => lazyDeopt(true)); + assertTrue(caught); + lazyDeopt(); +})(); + +// Call to a.findIndex is done inside a try-catch block and the callback function +// being called throws into a deoptimized caller function. +(function TestThrowIntoDeoptimizedOuter() { + const a = [1, 2, 3, 4]; + function lazyDeopt(deopt) { + function callback(v, i) { + if (i === 1 && deopt) { + %DeoptimizeFunction(lazyDeopt); + throw "some exception"; + } + return v === 3; + } + %NeverOptimizeFunction(callback); + let result = 0; + try { + result = a.findIndex(callback); + } catch (e) { + assertEquals("some exception", e); + result = "nope"; + } + return result; + } + assertEquals(2, lazyDeopt(false)); + assertEquals(2, lazyDeopt(false)); + assertEquals("nope", lazyDeopt(true)); + assertEquals("nope", lazyDeopt(true)); + %OptimizeFunctionOnNextCall(lazyDeopt); + assertEquals(2, lazyDeopt(false)); + assertEquals("nope", lazyDeopt(true)); +})(); + +// An error generated inside the callback includes findIndex in it's +// stack trace. +(() => { + const re = /Array\.findIndex/; + function lazyDeopt(deopt) { + const b = [1, 2, 3]; + let result = 0; + b.findIndex((v, i) => { + result += v; + if (i === 1) { + const e = new Error(); + assertTrue(re.exec(e.stack) !== null); + } + return false; + }); + } + lazyDeopt(); + lazyDeopt(); + %OptimizeFunctionOnNextCall(lazyDeopt); + lazyDeopt(); +})(); + +// An error generated inside a non-inlined callback function also +// includes findIndex in it's stack trace. +(() => { + const re = /Array\.findIndex/; + function lazyDeopt(deopt) { + const b = [1, 2, 3]; + let did_assert_error = false; + let result = 0; + function callback(v, i) { + result += v; + if (i === 1) { + const e = new Error(); + assertTrue(re.exec(e.stack) !== null); + did_assert_error = true; + } + return false; + } + %NeverOptimizeFunction(callback); + b.findIndex(callback); + return did_assert_error; + } + lazyDeopt(); + lazyDeopt(); + %OptimizeFunctionOnNextCall(lazyDeopt); + assertTrue(lazyDeopt()); +})(); + +// An error generated inside a recently deoptimized callback function +// includes findIndex in it's stack trace. +(() => { + const re = /Array\.findIndex/; + function lazyDeopt(deopt) { + const b = [1, 2, 3]; + let did_assert_error = false; + let result = 0; + b.findIndex((v, i) => { + result += v; + if (i === 1) { + %DeoptimizeNow(); + } else if (i === 2) { + const e = new Error(); + assertTrue(re.exec(e.stack) !== null); + did_assert_error = true; + } + return false; + }); + return did_assert_error; + } + lazyDeopt(); + lazyDeopt(); + %OptimizeFunctionOnNextCall(lazyDeopt); + assertTrue(lazyDeopt()); +})(); + +// Verify that various exception edges are handled appropriately. +// The thrown Error object should always indicate it was created from +// a findIndex call stack. +(() => { + const re = /Array\.findIndex/; + const a = [1, 2, 3]; + let result = 0; + function lazyDeopt() { + a.findIndex((v, i) => { + result += i; + if (i === 1) { + %DeoptimizeFunction(lazyDeopt); + throw new Error(); + } + return false; + }); + } + assertThrows(() => lazyDeopt()); + assertThrows(() => lazyDeopt()); + try { + lazyDeopt(); + } catch (e) { + assertTrue(re.exec(e.stack) !== null); + } + %OptimizeFunctionOnNextCall(lazyDeopt); + try { + lazyDeopt(); + } catch (e) { + assertTrue(re.exec(e.stack) !== null); + } +})(); + +// Messing with the Array prototype causes deoptimization. +(() => { + const a = [1, 2, 3]; + let result = 0; + function prototypeChanged() { + a.findIndex((v, i) => { + result += v; + return false; + }); + } + prototypeChanged(); + prototypeChanged(); + %OptimizeFunctionOnNextCall(prototypeChanged); + prototypeChanged(); + a.constructor = {}; + prototypeChanged(); + assertUnoptimized(prototypeChanged); + assertEquals(24, result); +})(); + +// Verify holes are replaced with undefined. +(() => { + const a = [1, 2, , 3, 4]; + function withHoles() { + const callback_values = []; + a.findIndex(v => { + callback_values.push(v); + return false; + }); + return callback_values; + } + withHoles(); + withHoles(); + %OptimizeFunctionOnNextCall(withHoles); + assertArrayEquals([1, 2, undefined, 3, 4], withHoles()); +})(); + +(() => { + const a = [1.5, 2.5, , 3.5, 4.5]; + function withHoles() { + const callback_values = []; + a.findIndex(v => { + callback_values.push(v); + return false; + }); + return callback_values; + } + withHoles(); + withHoles(); + %OptimizeFunctionOnNextCall(withHoles); + assertArrayEquals([1.5, 2.5, undefined, 3.5, 4.5], withHoles()); +})(); + +// Ensure that we handle side-effects between load and call. +(() => { + function side_effect(a, b) { if (b) a.foo = 3; return a; } + %NeverOptimizeFunction(side_effect); + + function unreliable(a, b) { + return a.findIndex(x => false, side_effect(a, b)); + } + + let a = [1, 2, 3]; + unreliable(a, false); + unreliable(a, false); + %OptimizeFunctionOnNextCall(unreliable); + unreliable(a, false); + // Now actually do change the map. + unreliable(a, true); +})(); + +// Handle callback is not callable. +(() => { + const a = [1, 2, 3, 4, 5]; + function notCallable() { + return a.findIndex(undefined); + } + + assertThrows(notCallable, TypeError); + try { notCallable(); } catch(e) { } + %OptimizeFunctionOnNextCall(notCallable); + assertThrows(notCallable, TypeError); +})(); diff --git a/deps/v8/test/mjsunit/optimized-array-some.js b/deps/v8/test/mjsunit/optimized-array-some.js new file mode 100644 index 0000000000..8d0114aa64 --- /dev/null +++ b/deps/v8/test/mjsunit/optimized-array-some.js @@ -0,0 +1,502 @@ +// 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 --turbo-inline-array-builtins --opt +// Flags: --no-always-opt + +// Early exit from some functions properly. +(() => { + const a = [1, 2, 3, 4, 5]; + let result = 0; + function earlyExit() { + return a.some(v => { + result += v; + return v > 2; + }); + } + assertTrue(earlyExit()); + earlyExit(); + %OptimizeFunctionOnNextCall(earlyExit); + assertTrue(earlyExit()); + assertEquals(18, result); +})(); + +// Soft-deopt plus early exit. +(() => { + const a = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]; + let result = 0; + function softyPlusEarlyExit(deopt) { + return a.some(v => { + result += v; + if (v === 4 && deopt) { + a.abc = 25; + } + return v > 7; + }); + } + assertTrue(softyPlusEarlyExit(false)); + softyPlusEarlyExit(false); + %OptimizeFunctionOnNextCall(softyPlusEarlyExit); + assertTrue(softyPlusEarlyExit(true)); + assertEquals(36*3, result); +})(); + +// Soft-deopt synced with early exit, which forces the lazy deoptimization +// continuation handler to exit. +(() => { + const a = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]; + let called_values = []; + function softyPlusEarlyExit(deopt) { + called_values = []; + return a.some(v => { + called_values.push(v); + if (v === 4 && deopt) { + a.abc = 25; + return true; + } + return v > 7; + }); + } + assertTrue(softyPlusEarlyExit(false)); + assertArrayEquals([1, 2, 3, 4, 5, 6, 7, 8], called_values); + softyPlusEarlyExit(false); + %OptimizeFunctionOnNextCall(softyPlusEarlyExit); + assertTrue(softyPlusEarlyExit(true)); + assertArrayEquals([1, 2, 3, 4], called_values); +})(); + +// Unknown field access leads to soft-deopt unrelated to some, should still +// lead to correct result. +(() => { + const a = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, + 20, 21, 22, 23, 24, 25]; + let result = 0; + function eagerDeoptInCalled(deopt) { + return a.some((v, i) => { + if (i === 13 && deopt) { + a.abc = 25; + } + result += v; + return false; + }); + } + eagerDeoptInCalled(); + eagerDeoptInCalled(); + %OptimizeFunctionOnNextCall(eagerDeoptInCalled); + eagerDeoptInCalled(); + assertFalse(eagerDeoptInCalled(true)); + eagerDeoptInCalled(); + assertEquals(1625, result); +})(); + +// Length change detected during loop, must cause properly handled eager deopt. +(() => { + let called_values; + function eagerDeoptInCalled(deopt) { + const a = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]; + called_values = []; + return a.some((v,i) => { + called_values.push(v); + a.length = (i === 5 && deopt) ? 8 : 10; + return false; + }); + } + assertFalse(eagerDeoptInCalled()); + assertArrayEquals([1, 2, 3, 4, 5, 6, 7, 8, 9, 10], called_values); + eagerDeoptInCalled(); + %OptimizeFunctionOnNextCall(eagerDeoptInCalled); + assertFalse(eagerDeoptInCalled()); + assertFalse(eagerDeoptInCalled(true)); + assertArrayEquals([1, 2, 3, 4, 5, 6, 7, 8], called_values); + eagerDeoptInCalled(); +})(); + +// Lazy deopt from a callback that changes the input array. Deopt in a callback +// execution that returns true. +(() => { + const a = [1, 2, 3, 4, 5]; + function lazyChanger(deopt) { + return a.some((v, i) => { + if (i === 3 && deopt) { + a[3] = 100; + %DeoptimizeNow(); + } + return false; + }); + } + assertFalse(lazyChanger()); + lazyChanger(); + %OptimizeFunctionOnNextCall(lazyChanger); + assertFalse(lazyChanger(true)); + assertFalse(lazyChanger()); +})(); + +// Lazy deopt from a callback that will always return false and no element is +// found. Verifies the lazy-after-callback continuation builtin. +(() => { + const a = [1, 2, 3, 4, 5]; + function lazyChanger(deopt) { + return a.some((v, i) => { + if (i === 3 && deopt) { + %DeoptimizeNow(); + } + return false; + }); + } + assertFalse(lazyChanger()); + lazyChanger(); + %OptimizeFunctionOnNextCall(lazyChanger); + assertFalse(lazyChanger(true)); + assertFalse(lazyChanger()); +})(); + +// Lazy deopt from a callback that changes the input array. Deopt in a callback +// execution that returns false. +(() => { + const a = [1, 2, 3, 4, 5]; + function lazyChanger(deopt) { + return a.every((v, i) => { + if (i === 2 && deopt) { + a[3] = 100; + %DeoptimizeNow(); + } + return false; + }); + } + assertFalse(lazyChanger()); + lazyChanger(); + %OptimizeFunctionOnNextCall(lazyChanger); + assertFalse(lazyChanger(true)); + assertFalse(lazyChanger()); +})(); + +// Escape analyzed array +(() => { + let result = 0; + function eagerDeoptInCalled(deopt) { + const a_noescape = [0, 1, 2, 3, 4, 5]; + a_noescape.some((v, i) => { + result += v | 0; + if (i === 13 && deopt) { + a_noescape.length = 25; + } + return false; + }); + } + eagerDeoptInCalled(); + eagerDeoptInCalled(); + %OptimizeFunctionOnNextCall(eagerDeoptInCalled); + eagerDeoptInCalled(); + eagerDeoptInCalled(true); + eagerDeoptInCalled(); + assertEquals(75, result); +})(); + +// Lazy deopt from runtime call from inlined callback function. +(() => { + const a = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, + 20, 21, 22, 23, 24, 25]; + let result = 0; + function lazyDeopt(deopt) { + a.some((v, i) => { + result += i; + if (i === 13 && deopt) { + %DeoptimizeNow(); + } + return false; + }); + } + lazyDeopt(); + lazyDeopt(); + %OptimizeFunctionOnNextCall(lazyDeopt); + lazyDeopt(); + lazyDeopt(true); + lazyDeopt(); + assertEquals(1500, result); +})(); + +// Lazy deopt from runtime call from non-inline callback function. +(() => { + const a = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, + 20, 21, 22, 23, 24, 25]; + let result = 0; + function lazyDeopt(deopt) { + function callback(v, i) { + result += i; + if (i === 13 && deopt) { + %DeoptimizeNow(); + } + return false; + } + %NeverOptimizeFunction(callback); + a.some(callback); + } + lazyDeopt(); + lazyDeopt(); + %OptimizeFunctionOnNextCall(lazyDeopt); + lazyDeopt(); + lazyDeopt(true); + lazyDeopt(); + assertEquals(1500, result); +})(); + +// Call to a.some is done inside a try-catch block and the callback function +// being called actually throws. +(() => { + const a = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, + 20, 21, 22, 23, 24, 25]; + let caught = false; + function lazyDeopt(deopt) { + try { + a.some((v, i) => { + if (i === 1 && deopt) { + throw("a"); + } + return false; + }); + } catch (e) { + caught = true; + } + } + lazyDeopt(); + lazyDeopt(); + %OptimizeFunctionOnNextCall(lazyDeopt); + lazyDeopt(); + assertDoesNotThrow(() => lazyDeopt(true)); + assertTrue(caught); + lazyDeopt(); +})(); + +// Call to a.some is done inside a try-catch block and the callback function +// being called actually throws, but the callback is not inlined. +(() => { + let a = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]; + let caught = false; + function lazyDeopt(deopt) { + function callback(v, i) { + if (i === 1 && deopt) { + throw("a"); + } + return false; + } + %NeverOptimizeFunction(callback); + try { + a.some(callback); + } catch (e) { + caught = true; + } + } + lazyDeopt(); + lazyDeopt(); + %OptimizeFunctionOnNextCall(lazyDeopt); + lazyDeopt(); + assertDoesNotThrow(() => lazyDeopt(true)); + assertTrue(caught); + lazyDeopt(); +})(); + +// Call to a.some is done inside a try-catch block and the callback function +// being called throws into a deoptimized caller function. +(function TestThrowIntoDeoptimizedOuter() { + const a = [1, 2, 3, 4]; + function lazyDeopt(deopt) { + function callback(v, i) { + if (i === 1 && deopt) { + %DeoptimizeFunction(lazyDeopt); + throw "some exception"; + } + return false; + } + %NeverOptimizeFunction(callback); + let result = 0; + try { + result = a.some(callback); + } catch (e) { + assertEquals("some exception", e); + result = "nope"; + } + return result; + } + assertEquals(false, lazyDeopt(false)); + assertEquals(false, lazyDeopt(false)); + assertEquals("nope", lazyDeopt(true)); + assertEquals("nope", lazyDeopt(true)); + %OptimizeFunctionOnNextCall(lazyDeopt); + assertEquals(false, lazyDeopt(false)); + assertEquals("nope", lazyDeopt(true)); +})(); + +// An error generated inside the callback includes some in it's +// stack trace. +(() => { + const re = /Array\.some/; + function lazyDeopt(deopt) { + const b = [1, 2, 3]; + let result = 0; + b.some((v, i) => { + result += v; + if (i === 1) { + const e = new Error(); + assertTrue(re.exec(e.stack) !== null); + } + return false; + }); + } + lazyDeopt(); + lazyDeopt(); + %OptimizeFunctionOnNextCall(lazyDeopt); + lazyDeopt(); +})(); + +// An error generated inside a non-inlined callback function also +// includes some in it's stack trace. +(() => { + const re = /Array\.some/; + function lazyDeopt(deopt) { + const b = [1, 2, 3]; + let did_assert_error = false; + let result = 0; + function callback(v, i) { + result += v; + if (i === 1) { + const e = new Error(); + assertTrue(re.exec(e.stack) !== null); + did_assert_error = true; + } + return false; + } + %NeverOptimizeFunction(callback); + b.some(callback); + return did_assert_error; + } + lazyDeopt(); + lazyDeopt(); + %OptimizeFunctionOnNextCall(lazyDeopt); + assertTrue(lazyDeopt()); +})(); + +// An error generated inside a recently deoptimized callback function +// includes some in it's stack trace. +(() => { + const re = /Array\.some/; + function lazyDeopt(deopt) { + const b = [1, 2, 3]; + let did_assert_error = false; + let result = 0; + b.some((v, i) => { + result += v; + if (i === 1) { + %DeoptimizeNow(); + } else if (i === 2) { + const e = new Error(); + assertTrue(re.exec(e.stack) !== null); + did_assert_error = true; + } + return false; + }); + return did_assert_error; + } + lazyDeopt(); + lazyDeopt(); + %OptimizeFunctionOnNextCall(lazyDeopt); + assertTrue(lazyDeopt()); +})(); + +// Verify that various exception edges are handled appropriately. +// The thrown Error object should always indicate it was created from +// a some call stack. +(() => { + const re = /Array\.some/; + const a = [1, 2, 3]; + let result = 0; + function lazyDeopt() { + a.some((v, i) => { + result += i; + if (i === 1) { + %DeoptimizeFunction(lazyDeopt); + throw new Error(); + } + return false; + }); + } + assertThrows(() => lazyDeopt()); + assertThrows(() => lazyDeopt()); + try { + lazyDeopt(); + } catch (e) { + assertTrue(re.exec(e.stack) !== null); + } + %OptimizeFunctionOnNextCall(lazyDeopt); + try { + lazyDeopt(); + } catch (e) { + assertTrue(re.exec(e.stack) !== null); + } +})(); + +// Messing with the Array prototype causes deoptimization. +(() => { + const a = [1, 2, 3]; + let result = 0; + function prototypeChanged() { + a.some((v, i) => { + result += v; + return false; + }); + } + prototypeChanged(); + prototypeChanged(); + %OptimizeFunctionOnNextCall(prototypeChanged); + prototypeChanged(); + a.constructor = {}; + prototypeChanged(); + assertUnoptimized(prototypeChanged); + assertEquals(24, result); +})(); + +// Verify holes are skipped. +(() => { + const a = [1, 2, , 3, 4]; + function withHoles() { + const callback_values = []; + a.some(v => { + callback_values.push(v); + return false; + }); + return callback_values; + } + withHoles(); + withHoles(); + %OptimizeFunctionOnNextCall(withHoles); + assertArrayEquals([1, 2, 3, 4], withHoles()); +})(); + +(() => { + const a = [1.5, 2.5, , 3.5, 4.5]; + function withHoles() { + const callback_values = []; + a.some(v => { + callback_values.push(v); + return false; + }); + return callback_values; + } + withHoles(); + withHoles(); + %OptimizeFunctionOnNextCall(withHoles); + assertArrayEquals([1.5, 2.5, 3.5, 4.5], withHoles()); +})(); + +// Handle callback is not callable. +(() => { + const a = [1, 2, 3, 4, 5]; + function notCallable() { + return a.some(undefined); + } + + assertThrows(notCallable, TypeError); + try { notCallable(); } catch(e) { } + %OptimizeFunctionOnNextCall(notCallable); + assertThrows(notCallable, TypeError); +})(); diff --git a/deps/v8/test/mjsunit/optimized-filter.js b/deps/v8/test/mjsunit/optimized-filter.js index b13edc3b36..3c7d827e0f 100644 --- a/deps/v8/test/mjsunit/optimized-filter.js +++ b/deps/v8/test/mjsunit/optimized-filter.js @@ -417,6 +417,59 @@ } })(); +// Verify holes are skipped. +(() => { + const a = [1, 2, , 3, 4]; + let callback_values = []; + function withHoles() { + callback_values = []; + return a.filter(v => { + callback_values.push(v); + return true; + }); + } + withHoles(); + withHoles(); + %OptimizeFunctionOnNextCall(withHoles); + assertArrayEquals([1, 2, 3, 4], withHoles()); + assertArrayEquals([1, 2, 3, 4], callback_values); +})(); + +(() => { + const a = [1.5, 2.5, , 3.5, 4.5]; + let callback_values = []; + function withHoles() { + callback_values = []; + return a.filter(v => { + callback_values.push(v); + return true; + }); + } + withHoles(); + withHoles(); + %OptimizeFunctionOnNextCall(withHoles); + assertArrayEquals([1.5, 2.5, 3.5, 4.5], withHoles()); + assertArrayEquals([1.5, 2.5, 3.5, 4.5], callback_values); +})(); + +// Ensure that we handle side-effects between load and call. +(() => { + function side_effect(a, b) { if (b) a.foo = 3; return a; } + %NeverOptimizeFunction(side_effect); + + function unreliable(a, b) { + return a.filter(x => x % 2 === 0, side_effect(a, b)); + } + + let a = [1, 2, 3]; + unreliable(a, false); + unreliable(a, false); + %OptimizeFunctionOnNextCall(unreliable); + unreliable(a, false); + // Now actually do change the map. + unreliable(a, true); +})(); + // Messing with the Array species constructor causes deoptimization. (function() { var result = 0; diff --git a/deps/v8/test/mjsunit/optimized-foreach.js b/deps/v8/test/mjsunit/optimized-foreach.js index f3513f3838..1fe54b5e9f 100644 --- a/deps/v8/test/mjsunit/optimized-foreach.js +++ b/deps/v8/test/mjsunit/optimized-foreach.js @@ -343,3 +343,53 @@ var c = [1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25]; assertTrue(re.exec(e.stack) !== null); } })(); + +// Verify holes are skipped. +(() => { + const a = [1, 2, , 3, 4]; + function withHoles() { + const callback_values = []; + a.forEach(v => { + callback_values.push(v); + }); + return callback_values; + } + withHoles(); + withHoles(); + %OptimizeFunctionOnNextCall(withHoles); + assertArrayEquals([1, 2, 3, 4], withHoles()); +})(); + +(() => { + const a = [1.5, 2.5, , 3.5, 4.5]; + function withHoles() { + const callback_values = []; + a.forEach(v => { + callback_values.push(v); + }); + return callback_values; + } + withHoles(); + withHoles(); + %OptimizeFunctionOnNextCall(withHoles); + assertArrayEquals([1.5, 2.5, 3.5, 4.5], withHoles()); +})(); + +// Ensure that we handle side-effects between load and call. +(() => { + function side_effect(a, b) { if (b) a.foo = 3; return a; } + %NeverOptimizeFunction(side_effect); + + function unreliable(a, b) { + let sum = 0; + return a.forEach(x => sum += x, side_effect(a, b)); + } + + let a = [1, 2, 3]; + unreliable(a, false); + unreliable(a, false); + %OptimizeFunctionOnNextCall(unreliable); + unreliable(a, false); + // Now actually do change the map. + unreliable(a, true); +})(); diff --git a/deps/v8/test/mjsunit/optimized-map.js b/deps/v8/test/mjsunit/optimized-map.js index d8613e0300..6a3df4d7d4 100644 --- a/deps/v8/test/mjsunit/optimized-map.js +++ b/deps/v8/test/mjsunit/optimized-map.js @@ -468,6 +468,59 @@ var c = [1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25]; assertEquals("hello1", string_results()[0]); })(); +// Verify holes are not visited. +(() => { + const a = [1, 2, , 3, 4]; + let callback_values = []; + function withHoles() { + callback_values = []; + return a.map(v => { + callback_values.push(v); + return v; + }); + } + withHoles(); + withHoles(); + %OptimizeFunctionOnNextCall(withHoles); + assertArrayEquals([1, 2, , 3, 4], withHoles()); + assertArrayEquals([1, 2, 3, 4], callback_values); +})(); + +(() => { + const a = [1.5, 2.5, , 3.5, 4.5]; + let callback_values = []; + function withHoles() { + callback_values = []; + return a.map(v => { + callback_values.push(v); + return v; + }); + } + withHoles(); + withHoles(); + %OptimizeFunctionOnNextCall(withHoles); + assertArrayEquals([1.5, 2.5, , 3.5, 4.5], withHoles()); + assertArrayEquals([1.5, 2.5, 3.5, 4.5], callback_values); +})(); + +// Ensure that we handle side-effects between load and call. +(() => { + function side_effect(a, b) { if (b) a.foo = 3; return a; } + %NeverOptimizeFunction(side_effect); + + function unreliable(a, b) { + return a.map(x => x * 2, side_effect(a, b)); + } + + let a = [1, 2, 3]; + unreliable(a, false); + unreliable(a, false); + %OptimizeFunctionOnNextCall(unreliable); + unreliable(a, false); + // Now actually do change the map. + unreliable(a, true); +})(); + // Messing with the Array species constructor causes deoptimization. (function() { var result = 0; diff --git a/deps/v8/test/mjsunit/regress/modules-skip-regress-797581-1.js b/deps/v8/test/mjsunit/regress/modules-skip-regress-797581-1.js new file mode 100644 index 0000000000..1aa55aa9fb --- /dev/null +++ b/deps/v8/test/mjsunit/regress/modules-skip-regress-797581-1.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. + +export default () diff --git a/deps/v8/test/mjsunit/regress/modules-skip-regress-797581-2.js b/deps/v8/test/mjsunit/regress/modules-skip-regress-797581-2.js new file mode 100644 index 0000000000..855aa2e9d7 --- /dev/null +++ b/deps/v8/test/mjsunit/regress/modules-skip-regress-797581-2.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. + +export default (...) diff --git a/deps/v8/test/mjsunit/regress/modules-skip-regress-797581-3.js b/deps/v8/test/mjsunit/regress/modules-skip-regress-797581-3.js new file mode 100644 index 0000000000..e6d043d2ce --- /dev/null +++ b/deps/v8/test/mjsunit/regress/modules-skip-regress-797581-3.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. + +export default (a, ...b) diff --git a/deps/v8/test/mjsunit/regress/modules-skip-regress-797581-4.js b/deps/v8/test/mjsunit/regress/modules-skip-regress-797581-4.js new file mode 100644 index 0000000000..fc7968d03d --- /dev/null +++ b/deps/v8/test/mjsunit/regress/modules-skip-regress-797581-4.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. + +export default 1, 2; diff --git a/deps/v8/test/mjsunit/regress/modules-skip-regress-797581-5.js b/deps/v8/test/mjsunit/regress/modules-skip-regress-797581-5.js new file mode 100644 index 0000000000..10864c260f --- /dev/null +++ b/deps/v8/test/mjsunit/regress/modules-skip-regress-797581-5.js @@ -0,0 +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. + +let x; +export default x = 0; diff --git a/deps/v8/test/mjsunit/regress/regress-2646.js b/deps/v8/test/mjsunit/regress/regress-2646.js index c51a28060c..ef72556e04 100644 --- a/deps/v8/test/mjsunit/regress/regress-2646.js +++ b/deps/v8/test/mjsunit/regress/regress-2646.js @@ -25,8 +25,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: --heap-stats - var expectedItemsCount = 10000, itemSize = 5, heap = new ArrayBuffer(expectedItemsCount * itemSize * 8), diff --git a/deps/v8/test/mjsunit/regress/regress-370827.js b/deps/v8/test/mjsunit/regress/regress-370827.js index 5536d5196b..e6d5185e70 100644 --- a/deps/v8/test/mjsunit/regress/regress-370827.js +++ b/deps/v8/test/mjsunit/regress/regress-370827.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 --expose-gc --heap-stats +// Flags: --allow-natives-syntax --expose-gc function g(dummy, x) { var start = ""; diff --git a/deps/v8/test/mjsunit/regress/regress-599717.js b/deps/v8/test/mjsunit/regress/regress-599717.js index 94a41ce4d3..51831860e9 100644 --- a/deps/v8/test/mjsunit/regress/regress-599717.js +++ b/deps/v8/test/mjsunit/regress/regress-599717.js @@ -15,7 +15,7 @@ function __f_61(stdlib, foreign, buffer) { } var ok = false; try { - var __v_12 = new ArrayBuffer(1 << 30); + var __v_12 = new ArrayBuffer(2147483648); ok = true; } catch (e) { // Can happen on 32 bit systems. diff --git a/deps/v8/test/mjsunit/regress/regress-791334.js b/deps/v8/test/mjsunit/regress/regress-791334.js new file mode 100644 index 0000000000..9f2748fdad --- /dev/null +++ b/deps/v8/test/mjsunit/regress/regress-791334.js @@ -0,0 +1,8 @@ +// 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. + +// MODULE + +let foo = () => { return this }; +assertEquals(undefined, foo()); diff --git a/deps/v8/test/mjsunit/regress/regress-791958.js b/deps/v8/test/mjsunit/regress/regress-791958.js new file mode 100644 index 0000000000..443ef6e359 --- /dev/null +++ b/deps/v8/test/mjsunit/regress/regress-791958.js @@ -0,0 +1,15 @@ +// 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 + +obj = {m: print}; +function foo() { + for (var x = -536870912; x != -536870903; ++x) { + obj.m(-x >= 1000000 ? x % 1000000 : y); + } +} +foo(); +%OptimizeFunctionOnNextCall(foo); +foo(); diff --git a/deps/v8/test/mjsunit/regress/regress-793588.js b/deps/v8/test/mjsunit/regress/regress-793588.js new file mode 100644 index 0000000000..6ad7a76e2a --- /dev/null +++ b/deps/v8/test/mjsunit/regress/regress-793588.js @@ -0,0 +1,13 @@ +// 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: --harmony-regexp-property + +assertNull(/a\P{Any}a/u.exec("a\u{d83d}a")); +assertEquals(["a\u{d83d}a"], /a\p{Any}a/u.exec("a\u{d83d}a")); +assertEquals(["a\u{d83d}a"], /(?:a\P{Any}a|a\p{Any}a)/u.exec("a\u{d83d}a")); +assertNull(/a[\P{Any}]a/u.exec("a\u{d83d}a")); +assertEquals(["a\u{d83d}a"], /a[^\P{Any}]a/u.exec("a\u{d83d}a")); +assertEquals(["a\u{d83d}a"], /a[^\P{Any}x]a/u.exec("a\u{d83d}a")); +assertNull(/a[^\P{Any}x]a/u.exec("axa")); diff --git a/deps/v8/test/mjsunit/regress/regress-796427.js b/deps/v8/test/mjsunit/regress/regress-796427.js new file mode 100644 index 0000000000..c09688d1ec --- /dev/null +++ b/deps/v8/test/mjsunit/regress/regress-796427.js @@ -0,0 +1,7 @@ +// 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: --stack-size=150 + +assertThrows(() => "" + { toString: Object.prototype.toLocaleString }, RangeError); diff --git a/deps/v8/test/mjsunit/regress/regress-797481.js b/deps/v8/test/mjsunit/regress/regress-797481.js new file mode 100644 index 0000000000..7963dbd3b7 --- /dev/null +++ b/deps/v8/test/mjsunit/regress/regress-797481.js @@ -0,0 +1,10 @@ +// 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: --stack-size=100 + +const a = /x/; + +a.exec = RegExp.prototype.test; +assertThrows(() => RegExp.prototype.test.call(a), RangeError); diff --git a/deps/v8/test/mjsunit/regress/regress-797581.js b/deps/v8/test/mjsunit/regress/regress-797581.js new file mode 100644 index 0000000000..17ac0ea50d --- /dev/null +++ b/deps/v8/test/mjsunit/regress/regress-797581.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: --allow-natives-syntax --harmony-dynamic-import + +function TryToLoadModule(filename, expect_error, token) { + let caught_error; + + function SetError(e) { + caught_error = e; + } + + import(filename).catch(SetError); + %RunMicrotasks(); + + if (expect_error) { + assertTrue(caught_error instanceof SyntaxError); + assertEquals("Unexpected token " + token, caught_error.message); + } else { + assertEquals(undefined, caught_error); + } +} + +TryToLoadModule("modules-skip-regress-797581-1.js", true, ")"); +TryToLoadModule("modules-skip-regress-797581-2.js", true, ")"); +TryToLoadModule("modules-skip-regress-797581-3.js", true, "..."); +TryToLoadModule("modules-skip-regress-797581-4.js", true, ","); +TryToLoadModule("modules-skip-regress-797581-5.js", false); diff --git a/deps/v8/test/mjsunit/regress/regress-800538.js b/deps/v8/test/mjsunit/regress/regress-800538.js new file mode 100644 index 0000000000..bc420d676c --- /dev/null +++ b/deps/v8/test/mjsunit/regress/regress-800538.js @@ -0,0 +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. + +RegExp.prototype.__defineGetter__("global", () => true); +assertEquals("/()/g", /()/.toString()); diff --git a/deps/v8/test/mjsunit/regress/regress-801171.js b/deps/v8/test/mjsunit/regress/regress-801171.js new file mode 100644 index 0000000000..4bd85eeafc --- /dev/null +++ b/deps/v8/test/mjsunit/regress/regress-801171.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. + +let called_custom_unicode_getter = false; +const re = /./; + +function f() { + re.__defineGetter__("unicode", function() { + called_custom_unicode_getter = true; + }); + return 2; +} + +assertEquals(["","",], re[Symbol.split]("abc", { valueOf: f })); + +// The spec mandates retrieving the regexp instance's flags before +// ToUint(limit), i.e. the unicode getter must still be unmodified when +// flags are retrieved. +assertFalse(called_custom_unicode_getter); diff --git a/deps/v8/test/mjsunit/regress/regress-801772.js b/deps/v8/test/mjsunit/regress/regress-801772.js new file mode 100644 index 0000000000..06597e251a --- /dev/null +++ b/deps/v8/test/mjsunit/regress/regress-801772.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. + +function foo(f) { f(); } + +foo(function arguments() { + function skippable() { } +}); diff --git a/deps/v8/test/mjsunit/regress/regress-802060.js b/deps/v8/test/mjsunit/regress/regress-802060.js new file mode 100644 index 0000000000..e975615484 --- /dev/null +++ b/deps/v8/test/mjsunit/regress/regress-802060.js @@ -0,0 +1,24 @@ +// 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 assertEquals(expected, found) { + found.length !== expected.length; +} +assertEquals([], []) +assertEquals("a", "a"); +assertEquals([], []); +function f() { + assertEquals(0, undefined); +} +try { + f(); +} catch (e) { +} +%OptimizeFunctionOnNextCall(f); +try { + f(); +} catch (e) { +} diff --git a/deps/v8/test/mjsunit/regress/regress-crbug-789764.js b/deps/v8/test/mjsunit/regress/regress-crbug-789764.js new file mode 100644 index 0000000000..c377e644fc --- /dev/null +++ b/deps/v8/test/mjsunit/regress/regress-crbug-789764.js @@ -0,0 +1,15 @@ +// 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. + +// Original repro (used to crash): +_v3 = ({ _v7 = (function outer() { + for ([...[]][function inner() {}] in []) { + } + })} = {}) => { +}; +_v3(); + +// Smaller repro (used to crash): +a = (b = !function outer() { for (function inner() {}.foo in []) {} }) => {}; +a(); diff --git a/deps/v8/test/mjsunit/regress/regress-crbug-791245-1.js b/deps/v8/test/mjsunit/regress/regress-crbug-791245-1.js new file mode 100644 index 0000000000..0d51f8a4a0 --- /dev/null +++ b/deps/v8/test/mjsunit/regress/regress-crbug-791245-1.js @@ -0,0 +1,18 @@ +// 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 + +const s = new Map; + +function foo(s) { + const i = s[Symbol.iterator](); + i.next(); + return i; +} + +console.log(foo(s)); +console.log(foo(s)); +%OptimizeFunctionOnNextCall(foo); +console.log(foo(s)); diff --git a/deps/v8/test/mjsunit/regress/regress-crbug-791245-2.js b/deps/v8/test/mjsunit/regress/regress-crbug-791245-2.js new file mode 100644 index 0000000000..6734ed2baa --- /dev/null +++ b/deps/v8/test/mjsunit/regress/regress-crbug-791245-2.js @@ -0,0 +1,18 @@ +// 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 + +const s = new Set; + +function foo(s) { + const i = s[Symbol.iterator](); + i.next(); + return i; +} + +console.log(foo(s)); +console.log(foo(s)); +%OptimizeFunctionOnNextCall(foo); +console.log(foo(s)); diff --git a/deps/v8/test/mjsunit/regress/regress-crbug-795922.js b/deps/v8/test/mjsunit/regress/regress-crbug-795922.js new file mode 100644 index 0000000000..da2b36740e --- /dev/null +++ b/deps/v8/test/mjsunit/regress/regress-crbug-795922.js @@ -0,0 +1,9 @@ +// 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. + +assertThrows( + // Should throw a syntax error, but not crash. + "({ __proto__: null, __proto__: 1 })", + SyntaxError +); diff --git a/deps/v8/test/mjsunit/regress/regress-crbug-798644.js b/deps/v8/test/mjsunit/regress/regress-crbug-798644.js new file mode 100644 index 0000000000..c878a6fda8 --- /dev/null +++ b/deps/v8/test/mjsunit/regress/regress-crbug-798644.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: --allow-natives-syntax + +let arr = []; +// Make the array large enough to trigger re-checking for compaction. +arr[1000] = 0x1234; + +arr.__defineGetter__(256, function () { + // Remove the getter so we can compact the array. + delete arr[256]; + // Trigger compaction. + arr.unshift(1.1); +}); + +let results = Object.entries(arr); +%HeapObjectVerify(results); +%HeapObjectVerify(arr); +let str = results.toString(); diff --git a/deps/v8/test/mjsunit/regress/regress-crbug-800077.js b/deps/v8/test/mjsunit/regress/regress-crbug-800077.js new file mode 100644 index 0000000000..13679073fe --- /dev/null +++ b/deps/v8/test/mjsunit/regress/regress-crbug-800077.js @@ -0,0 +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. + +var sample = new Float64Array(1); +Reflect.has(sample, undefined); diff --git a/deps/v8/test/mjsunit/regress/regress-crbug-800810.js b/deps/v8/test/mjsunit/regress/regress-crbug-800810.js new file mode 100644 index 0000000000..22ac38833e --- /dev/null +++ b/deps/v8/test/mjsunit/regress/regress-crbug-800810.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. + +var array = []; +Object.defineProperty(array , 506519, {}); +Object.defineProperty(array , 3, { + get: function () { + Object.defineProperty(array , undefined, { + }) + } +}); +array.includes(61301); diff --git a/deps/v8/test/mjsunit/regress/regress-crbug-807096.js b/deps/v8/test/mjsunit/regress/regress-crbug-807096.js new file mode 100644 index 0000000000..845120db6a --- /dev/null +++ b/deps/v8/test/mjsunit/regress/regress-crbug-807096.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 --no-lazy + +// For regression testing, it's important that these functions are: +// 1) toplevel +// 2) arrow functions with single-expression bodies +// 3) eagerly compiled + +let f = ({a = (({b = {a = c} = { + a: 0x1234 +}}) => 1)({})}, c) => 1; + +assertThrows(() => f({}), ReferenceError); + +let g = ({a = (async ({b = {a = c} = { + a: 0x1234 +}}) => 1)({})}, c) => a; + +testAsync(assert => { + assert.plan(1); + g({}).catch(e => { + assert.equals("ReferenceError", e.name); + }); +}); diff --git a/deps/v8/test/mjsunit/regress/regress-crbug-808192.js b/deps/v8/test/mjsunit/regress/regress-crbug-808192.js new file mode 100644 index 0000000000..3336c0043e --- /dev/null +++ b/deps/v8/test/mjsunit/regress/regress-crbug-808192.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. + +// TODO(cbruni): enable always opt once v8:7438 +// Flags: --expose-gc --no-always-opt + +const f = eval(`(function f(i) { + if (i == 0) { + class Derived extends Object { + constructor() { + super(); + ${"this.a=1;".repeat(0x3fffe-8)} + } + } + return Derived; + } + + class DerivedN extends f(i-1) { + constructor() { + super(); + ${"this.a=1;".repeat(0x40000-8)} + } + } + + return DerivedN; +})`); + +let a = new (f(0x7ff))(); +a.a = 1; +gc(); +assertEquals(1, a.a); diff --git a/deps/v8/test/mjsunit/regress/regress-crbug-813427.js b/deps/v8/test/mjsunit/regress/regress-crbug-813427.js new file mode 100644 index 0000000000..95fa015de2 --- /dev/null +++ b/deps/v8/test/mjsunit/regress/regress-crbug-813427.js @@ -0,0 +1,49 @@ +// 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 {count} property assignments. +function createPropertiesAssignment(count) { + let result = ""; + for (let i = 0; i < count; i++) { + result += "this.p"+i+" = undefined;"; + } + return result; +} + +function testSubclassProtoProperties(count) { + const MyClass = eval(`(class MyClass { + constructor() { + ${createPropertiesAssignment(count)} + } + });`); + + class BaseClass {}; + class SubClass extends BaseClass { + constructor() { + super() + } + }; + + const boundMyClass = MyClass.bind(); + %HeapObjectVerify(boundMyClass); + + SubClass.__proto__ = boundMyClass; + var instance = new SubClass(); + + %HeapObjectVerify(instance); + // Create some more instances to complete in-object slack tracking. + let results = []; + for (let i = 0; i < 4000; i++) { + results.push(new SubClass()); + } + var instance = new SubClass(); + %HeapObjectVerify(instance); +} + + +for (let count = 0; count < 10; count++) { + testSubclassProtoProperties(count); +} diff --git a/deps/v8/test/mjsunit/regress/regress-v8-7245.js b/deps/v8/test/mjsunit/regress/regress-v8-7245.js new file mode 100644 index 0000000000..c1a9df2bb3 --- /dev/null +++ b/deps/v8/test/mjsunit/regress/regress-v8-7245.js @@ -0,0 +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. + +const { revoke } = Proxy.revocable({}, {}); +assertEquals("", revoke.name); diff --git a/deps/v8/test/mjsunit/regress/wasm/regress-791810.js b/deps/v8/test/mjsunit/regress/wasm/regress-791810.js new file mode 100644 index 0000000000..cd6c4e2728 --- /dev/null +++ b/deps/v8/test/mjsunit/regress/wasm/regress-791810.js @@ -0,0 +1,21 @@ +// 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. + +load('test/mjsunit/wasm/wasm-constants.js'); +load('test/mjsunit/wasm/wasm-module-builder.js'); + +const builder = new WasmModuleBuilder(); +builder.addFunction('test', kSig_i_i) + .addBody([ + kExprGetLocal, 0x00, // get_local 0 + kExprBlock, kWasmStmt, // block + kExprBr, 0x00, // br depth=0 + kExprEnd, // end + kExprBlock, kWasmStmt, // block + kExprBr, 0x00, // br depth=0 + kExprEnd, // end + kExprBr, 0x00, // br depth=0 + ]) + .exportFunc(); +builder.instantiate(); diff --git a/deps/v8/test/mjsunit/regress/wasm/regress-793551.js b/deps/v8/test/mjsunit/regress/wasm/regress-793551.js new file mode 100644 index 0000000000..8aa0241923 --- /dev/null +++ b/deps/v8/test/mjsunit/regress/wasm/regress-793551.js @@ -0,0 +1,20 @@ +// 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. + +load('test/mjsunit/wasm/wasm-constants.js'); +load('test/mjsunit/wasm/wasm-module-builder.js'); + +const builder = new WasmModuleBuilder(); +builder.addFunction('test', kSig_i_i) + .addBody([ + // body: + kExprGetLocal, 0, // get_local 0 + kExprGetLocal, 0, // get_local 0 + kExprLoop, kWasmStmt, // loop + kExprBr, 0, // br depth=0 + kExprEnd, // end + kExprUnreachable, // unreachable + ]) + .exportFunc(); +builder.instantiate(); diff --git a/deps/v8/test/mjsunit/regress/wasm/regress-797846.js b/deps/v8/test/mjsunit/regress/wasm/regress-797846.js new file mode 100644 index 0000000000..6a4fd5c5f7 --- /dev/null +++ b/deps/v8/test/mjsunit/regress/wasm/regress-797846.js @@ -0,0 +1,14 @@ +// 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. + +load('test/mjsunit/wasm/wasm-constants.js'); +load('test/mjsunit/wasm/wasm-module-builder.js'); + +// We need a module with one valid function. +const builder = new WasmModuleBuilder(); +builder.addFunction('test', kSig_v_v).addBody([]); + +const buffer = builder.toBuffer(); +assertPromiseResult( + WebAssembly.compile(buffer), _ => Realm.createAllowCrossRealmAccess()); diff --git a/deps/v8/test/mjsunit/regress/wasm/regress-800756.js b/deps/v8/test/mjsunit/regress/wasm/regress-800756.js new file mode 100644 index 0000000000..2d29997cef --- /dev/null +++ b/deps/v8/test/mjsunit/regress/wasm/regress-800756.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. + +load('test/mjsunit/wasm/wasm-constants.js'); +load('test/mjsunit/wasm/wasm-module-builder.js'); + +const builder = new WasmModuleBuilder(); +builder.addMemory(16, 32); +builder.addFunction(undefined, kSig_i_iii).addBody([ + kExprI32Const, 0, // i32.const 0 + kExprI32LoadMem8S, 0, 0, // i32.load8_s offset=0 align=0 + kExprI32Eqz, // i32.eqz +]); +builder.instantiate(); diff --git a/deps/v8/test/mjsunit/regress/wasm/regress-801850.js b/deps/v8/test/mjsunit/regress/wasm/regress-801850.js new file mode 100644 index 0000000000..ad6ff4c432 --- /dev/null +++ b/deps/v8/test/mjsunit/regress/wasm/regress-801850.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. + +load('test/mjsunit/wasm/wasm-constants.js'); +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() {};'); +worker.postMessage(module) diff --git a/deps/v8/test/mjsunit/regress/wasm/regress-802244.js b/deps/v8/test/mjsunit/regress/wasm/regress-802244.js new file mode 100644 index 0000000000..0b8decb637 --- /dev/null +++ b/deps/v8/test/mjsunit/regress/wasm/regress-802244.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. + +load('test/mjsunit/wasm/wasm-constants.js'); +load('test/mjsunit/wasm/wasm-module-builder.js'); + +const builder = new WasmModuleBuilder(); +builder.addFunction(undefined, kSig_v_iii).addBody([ + kExprI32Const, 0x41, // i32.const 0x41 + kExprLoop, 0x7c, // loop f64 + kExprGetLocal, 0x00, // get_local 0 + kExprGetLocal, 0x01, // get_local 1 + kExprBrIf, 0x01, // br_if depth=1 + kExprGetLocal, 0x00, // get_local 0 + kExprI32Rol, // i32.rol + kExprBrIf, 0x00, // br_if depth=0 + kExprUnreachable, // unreachable + kExprEnd, // end + kExprUnreachable, // unreachable +]); +builder.instantiate(); diff --git a/deps/v8/test/mjsunit/regress/wasm/regress-808980.js b/deps/v8/test/mjsunit/regress/wasm/regress-808980.js new file mode 100644 index 0000000000..884572b895 --- /dev/null +++ b/deps/v8/test/mjsunit/regress/wasm/regress-808980.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: --allow-natives-syntax --throws + +load('test/mjsunit/wasm/wasm-constants.js'); +load('test/mjsunit/wasm/wasm-module-builder.js'); +let kTableSize = 3; + +var builder = new WasmModuleBuilder(); +var sig_index1 = builder.addType(kSig_i_v); +builder.addFunction('main', kSig_i_ii).addBody([ + kExprGetLocal, + 0, + kExprCallIndirect, + sig_index1, + kTableZero +]).exportAs('main'); +builder.setFunctionTableBounds(kTableSize, kTableSize); +var m1_bytes = builder.toBuffer(); +var m1 = new WebAssembly.Module(m1_bytes); + +var serialized_m1 = %SerializeWasmModule(m1); +var m1_clone = %DeserializeWasmModule(serialized_m1, m1_bytes); +var i1 = new WebAssembly.Instance(m1_clone); + +i1.exports.main(123123); diff --git a/deps/v8/test/mjsunit/serialize-after-execute.js b/deps/v8/test/mjsunit/serialize-after-execute.js new file mode 100644 index 0000000000..a3e6bc82ae --- /dev/null +++ b/deps/v8/test/mjsunit/serialize-after-execute.js @@ -0,0 +1,15 @@ +// 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: --cache=after-execute + +function g() { + function h() { + function k() { return 0; }; + return k; + } + return h(); +} + +g(); diff --git a/deps/v8/test/mjsunit/serialize-embedded-error.js b/deps/v8/test/mjsunit/serialize-embedded-error.js index 473c931b30..320fe475b0 100644 --- a/deps/v8/test/mjsunit/serialize-embedded-error.js +++ b/deps/v8/test/mjsunit/serialize-embedded-error.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. -// --serialize-toplevel --cache=code +// --cache=code var caught = false; try { diff --git a/deps/v8/test/mjsunit/serialize-ic.js b/deps/v8/test/mjsunit/serialize-ic.js index 8e5cd2fd50..74821a9ec3 100644 --- a/deps/v8/test/mjsunit/serialize-ic.js +++ b/deps/v8/test/mjsunit/serialize-ic.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: --cache=code --serialize-toplevel +// Flags: --cache=code var foo = []; foo[0] = "bar"; diff --git a/deps/v8/test/mjsunit/testcfg.py b/deps/v8/test/mjsunit/testcfg.py index ff84bc3be5..bc9d69ff33 100644 --- a/deps/v8/test/mjsunit/testcfg.py +++ b/deps/v8/test/mjsunit/testcfg.py @@ -31,7 +31,6 @@ import re from testrunner.local import testsuite from testrunner.objects import testcase -FLAGS_PATTERN = re.compile(r"//\s+Flags:(.*)") FILES_PATTERN = re.compile(r"//\s+Files:(.*)") ENV_PATTERN = re.compile(r"//\s+Environment Variables:(.*)") SELF_SCRIPT_PATTERN = re.compile(r"//\s+Env: TEST_FILE_NAME") @@ -39,11 +38,7 @@ MODULE_PATTERN = re.compile(r"^// MODULE$", flags=re.MULTILINE) NO_HARNESS_PATTERN = re.compile(r"^// NO HARNESS$", flags=re.MULTILINE) -class MjsunitTestSuite(testsuite.TestSuite): - - def __init__(self, name, root): - super(MjsunitTestSuite, self).__init__(name, root) - +class TestSuite(testsuite.TestSuite): def ListTests(self, context): tests = [] for dirname, dirs, files in os.walk(self.root, followlinks=True): @@ -56,19 +51,19 @@ class MjsunitTestSuite(testsuite.TestSuite): fullpath = os.path.join(dirname, filename) relpath = fullpath[len(self.root) + 1 : -3] testname = relpath.replace(os.path.sep, "/") - test = testcase.TestCase(self, testname) + test = self._create_test(testname) tests.append(test) return tests - def GetParametersForTestCase(self, testcase, context): - source = self.GetSourceForTest(testcase) + def _test_class(self): + return TestCase - flags = testcase.flags + context.mode_flags - env = self._get_env(source) - flags_match = re.findall(FLAGS_PATTERN, source) - for match in flags_match: - flags += match.strip().split() +class TestCase(testcase.TestCase): + def __init__(self, *args, **kwargs): + super(TestCase, self).__init__(*args, **kwargs) + + source = self.get_source() files_list = [] # List of file names to append to command arguments. files_match = FILES_PATTERN.search(source); @@ -79,28 +74,32 @@ class MjsunitTestSuite(testsuite.TestSuite): files_match = FILES_PATTERN.search(source, files_match.end()) else: break - files = [ os.path.normpath(os.path.join(self.root, '..', '..', f)) + files = [ os.path.normpath(os.path.join(self.suite.root, '..', '..', f)) for f in files_list ] - testfilename = os.path.join(self.root, testcase.path + self.suffix()) + testfilename = os.path.join(self.suite.root, + self.path + self._get_suffix()) if SELF_SCRIPT_PATTERN.search(source): files = ( ["-e", "TEST_FILE_NAME=\"%s\"" % testfilename.replace("\\", "\\\\")] + files) - if not context.no_harness and not NO_HARNESS_PATTERN.search(source): - files.append(os.path.join(self.root, "mjsunit.js")) + if NO_HARNESS_PATTERN.search(source): + mjsunit_files = [] + else: + mjsunit_files = [os.path.join(self.suite.root, "mjsunit.js")] + files_suffix = [] if MODULE_PATTERN.search(source): - files.append("--module") - files.append(testfilename) - - all_files = list(files) - if context.isolates: - all_files += ["--isolate"] + files + files_suffix.append("--module") + files_suffix.append(testfilename) - return all_files, flags, env + self._source_files = files + self._source_flags = self._parse_source_flags(source) + self._mjsunit_files = mjsunit_files + self._files_suffix = files_suffix + self._env = self._parse_source_env(source) - def _get_env(self, source): + def _parse_source_env(self, source): env_match = ENV_PATTERN.search(source) env = {} if env_match: @@ -109,11 +108,25 @@ class MjsunitTestSuite(testsuite.TestSuite): env[var] = value return env - def GetSourceForTest(self, testcase): - filename = os.path.join(self.root, testcase.path + self.suffix()) - with open(filename) as f: - return f.read() + def _get_source_flags(self): + return self._source_flags + + def _get_files_params(self, ctx): + files = list(self._source_files) + if not ctx.no_harness: + files += self._mjsunit_files + files += self._files_suffix + if ctx.isolates: + files += ['--isolate'] + files + + return files + + def _get_cmd_env(self): + return self._env + + def _get_source_path(self): + return os.path.join(self.suite.root, self.path + self._get_suffix()) def GetSuite(name, root): - return MjsunitTestSuite(name, root) + return TestSuite(name, root) diff --git a/deps/v8/test/mjsunit/wasm/errors.js b/deps/v8/test/mjsunit/wasm/errors.js index 89066d671a..a90236459f 100644 --- a/deps/v8/test/mjsunit/wasm/errors.js +++ b/deps/v8/test/mjsunit/wasm/errors.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: --expose-wasm +// Flags: --expose-wasm --allow-natives-syntax 'use strict'; @@ -170,3 +170,19 @@ function assertConversionError(bytes, imports, msg) { kExprI64Const, 0 ]).exportFunc().end().toBuffer(), {}, "invalid type"); })(); + + +(function InternalDebugTrace() { + var builder = new WasmModuleBuilder(); + var sig = builder.addType(kSig_i_dd); + builder.addImport("mod", "func", sig); + builder.addFunction("main", sig) + .addBody([kExprGetLocal, 0, kExprGetLocal, 1, kExprCallFunction, 0]) + .exportAs("main") + var main = builder.instantiate({ + mod: { + func: ()=>{%DebugTrace();} + } + }).exports.main; + main(); +})(); diff --git a/deps/v8/test/mjsunit/wasm/grow-memory-detaching.js b/deps/v8/test/mjsunit/wasm/grow-memory-detaching.js new file mode 100644 index 0000000000..da6516afd7 --- /dev/null +++ b/deps/v8/test/mjsunit/wasm/grow-memory-detaching.js @@ -0,0 +1,65 @@ +// 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. + +// Flags: --expose-wasm + +load("test/mjsunit/wasm/wasm-constants.js"); +load("test/mjsunit/wasm/wasm-module-builder.js"); + +let module = (() => { + let builder = new WasmModuleBuilder(); + builder.addMemory(1, kV8MaxPages, false); + builder.addFunction("grow_memory", kSig_i_i) + .addBody([kExprGetLocal, 0, kExprGrowMemory, kMemoryZero]) + .exportFunc(); + builder.exportMemoryAs("memory"); + return builder.toModule(); +})(); + +(function TestDetachingViaAPI() { + print("TestDetachingViaAPI..."); + let memory = new WebAssembly.Memory({initial: 1, maximum: 100}); + let growMem = (pages) => memory.grow(pages); + + let b1 = memory.buffer; + assertEquals(kPageSize, b1.byteLength); + + growMem(0); + let b2 = memory.buffer; + assertFalse(b1 === b2); + assertEquals(0, b1.byteLength); + assertEquals(kPageSize, b2.byteLength); + + growMem(1); + let b3 = memory.buffer; + assertFalse(b1 === b3); + assertFalse(b2 === b3); + assertEquals(0, b1.byteLength); + assertEquals(0, b2.byteLength); + assertEquals(2 * kPageSize, b3.byteLength); +})(); + +(function TestDetachingViaBytecode() { + print("TestDetachingViaBytecode..."); + let instance = new WebAssembly.Instance(module); + let growMem = instance.exports.grow_memory; + let memory = instance.exports.memory; + + let b1 = memory.buffer; + assertEquals(kPageSize, b1.byteLength); + + growMem(0); + let b2 = memory.buffer; + assertFalse(b1 === b2); + assertEquals(0, b1.byteLength); + assertEquals(kPageSize, b2.byteLength); + + growMem(1); + let b3 = memory.buffer; + assertFalse(b1 === b3); + assertFalse(b2 === b3); + assertEquals(0, b1.byteLength); + assertEquals(0, b2.byteLength); + assertEquals(2 * kPageSize, b3.byteLength); +})(); diff --git a/deps/v8/test/mjsunit/wasm/indirect-tables.js b/deps/v8/test/mjsunit/wasm/indirect-tables.js index 4c6d9c9f3b..88d1bb719a 100644 --- a/deps/v8/test/mjsunit/wasm/indirect-tables.js +++ b/deps/v8/test/mjsunit/wasm/indirect-tables.js @@ -602,6 +602,47 @@ function js_div(a, b) { return (a / b) | 0; } /signature mismatch/); })(); +(function IndirectCallIntoOtherInstance() { + print("IndirectCallIntoOtherInstance..."); + var mem_1 = new WebAssembly.Memory({initial: 1}); + var mem_2 = new WebAssembly.Memory({initial: 1}); + var view_1 = new Int32Array(mem_1.buffer); + var view_2 = new Int32Array(mem_2.buffer); + view_1[0] = 1; + view_2[0] = 1000; + + let builder = new WasmModuleBuilder(); + let sig = builder.addType(kSig_i_v); + builder.addFunction('main', kSig_i_i) + .addBody([kExprGetLocal, 0, kExprCallIndirect, sig, kTableZero]) + .exportAs('main'); + builder.addImportedMemory('', 'memory', 1); + + builder.setFunctionTableBounds(1, 1); + builder.addExportOfKind('table', kExternalTable); + + let module1 = new WebAssembly.Module(builder.toBuffer()); + let instance1 = new WebAssembly.Instance(module1, {'':{memory:mem_1}}); + + builder = new WasmModuleBuilder(); + builder.addFunction('main', kSig_i_v).addBody([kExprI32Const, 0, kExprI32LoadMem, 0, 0]); + builder.addImportedTable('', 'table'); + builder.addFunctionTableInit(0, false, [0], true); + builder.addImportedMemory('', 'memory', 1); + + + let module2 = new WebAssembly.Module(builder.toBuffer()); + let instance2 = new WebAssembly.Instance(module2, { + '': { + table: instance1.exports.table, + memory: mem_2 + } + }); + + assertEquals(instance1.exports.main(0), 1000); +})(); + + (function ImportedFreestandingTable() { print("ImportedFreestandingTable..."); @@ -665,42 +706,40 @@ function js_div(a, b) { return (a / b) | 0; } test(1, 3); })(); -(function IndirectCallIntoOtherInstance() { - print("IndirectCallIntoOtherInstance..."); - var mem_1 = new WebAssembly.Memory({initial: 1}); - var mem_2 = new WebAssembly.Memory({initial: 1}); - var view_1 = new Int32Array(mem_1.buffer); - var view_2 = new Int32Array(mem_2.buffer); - view_1[0] = 1; - view_2[0] = 1000; - - let builder = new WasmModuleBuilder(); - let sig = builder.addType(kSig_i_v); - builder.addFunction('main', kSig_i_i) - .addBody([kExprGetLocal, 0, kExprCallIndirect, sig, kTableZero]) - .exportAs('main'); - builder.addImportedMemory('', 'memory', 1); - builder.setFunctionTableBounds(1, 1); - builder.addExportOfKind('table', kExternalTable); - - let module1 = new WebAssembly.Module(builder.toBuffer()); - let instance1 = new WebAssembly.Instance(module1, {'':{memory:mem_1}}); - - builder = new WasmModuleBuilder(); - builder.addFunction('main', kSig_i_v).addBody([kExprI32Const, 0, kExprI32LoadMem, 0, 0]); - builder.addImportedTable('', 'table'); - builder.addFunctionTableInit(0, false, [0], true); - builder.addImportedMemory('', 'memory', 1); +// Remove this test when v8:7232 is addressed comprehensively. +(function TablesAreImmutableInWasmCallstacks() { + print('TablesAreImmutableInWasmCallstacks...'); + let table = new WebAssembly.Table({initial:2, element:'anyfunc'}); + let builder = new WasmModuleBuilder(); + builder.addImport('', 'mutator', kSig_v_v); + builder.addFunction('main', kSig_v_v) + .addBody([ + kExprCallFunction, 0 + ]).exportAs('main'); - let module2 = new WebAssembly.Module(builder.toBuffer()); - let instance2 = new WebAssembly.Instance(module2, { + let module = new WebAssembly.Module(builder.toBuffer()); + let instance = new WebAssembly.Instance(module, { '': { - table: instance1.exports.table, - memory: mem_2 + 'mutator': () => {table.set(0, null);} } }); - assertEquals(instance1.exports.main(0), 1000); + table.set(0, instance.exports.main); + + try { + instance.exports.main(); + assertUnreached(); + } catch (e) { + assertTrue(e instanceof RangeError); + } + try { + instance.exports.main(); + assertUnreached(); + } catch (e) { + assertTrue(e instanceof RangeError); + } + table.set(0, null); + assertEquals(null, table.get(0)); })(); diff --git a/deps/v8/test/mjsunit/wasm/lazy-compilation.js b/deps/v8/test/mjsunit/wasm/lazy-compilation.js index 3d840398a8..fc41fbd622 100644 --- a/deps/v8/test/mjsunit/wasm/lazy-compilation.js +++ b/deps/v8/test/mjsunit/wasm/lazy-compilation.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: --wasm-lazy-compilation +// Flags: --wasm-lazy-compilation --allow-natives-syntax load('test/mjsunit/wasm/wasm-constants.js'); load('test/mjsunit/wasm/wasm-module-builder.js'); @@ -46,6 +46,10 @@ load('test/mjsunit/wasm/wasm-module-builder.js'); instance2.exports.call_store(3); assertEquals(3, mem1[0]); assertEquals(0, mem2[0]); + %FreezeWasmLazyCompilation(instance1); + %FreezeWasmLazyCompilation(instance2); + instance2.exports.call_store(7); + assertEquals(7, mem1[0]); })(); (function exportImportedFunction() { @@ -60,4 +64,37 @@ load('test/mjsunit/wasm/wasm-module-builder.js'); const instance2 = builder2.instantiate({A: instance1.exports}); instance2.exports.foo(); + %FreezeWasmLazyCompilation(instance1); + %FreezeWasmLazyCompilation(instance2); + instance2.exports.foo(); +})(); + +(function exportImportedFunctionWithDifferentMemory() { + print(arguments.callee.name); + const builder1 = new WasmModuleBuilder(); + builder1.addMemory(1, 1, true); + builder1.addFunction('store', kSig_v_i) + .addBody([ + kExprI32Const, 0, // i32.const 1 + kExprGetLocal, 0, // get_local 0 + kExprI32StoreMem, 0, 0, // i32.store offset=0 align=0 + ]) + .exportFunc(); + const instance1 = builder1.instantiate(); + const mem1 = new Int32Array(instance1.exports.memory.buffer); + + const builder2 = new WasmModuleBuilder(); + builder2.addMemory(1, 1, true); + const imp_idx = builder2.addImport('A', 'store', kSig_v_i); + builder2.addExport('exp_store', imp_idx); + const instance2 = builder2.instantiate({A: instance1.exports}); + const mem2 = new Int32Array(instance2.exports.memory.buffer); + + instance2.exports.exp_store(3); + assertEquals(3, mem1[0]); + assertEquals(0, mem2[0]); + %FreezeWasmLazyCompilation(instance1); + %FreezeWasmLazyCompilation(instance2); + instance2.exports.exp_store(7); + assertEquals(7, mem1[0]); })(); diff --git a/deps/v8/test/mjsunit/wasm/many-parameters.js b/deps/v8/test/mjsunit/wasm/many-parameters.js index 03d7e09ef3..a56619a6ad 100644 --- a/deps/v8/test/mjsunit/wasm/many-parameters.js +++ b/deps/v8/test/mjsunit/wasm/many-parameters.js @@ -12,10 +12,13 @@ let type_const = [wasmI32Const, wasmF32Const, wasmF64Const]; function f(values, shift, num_const_params, ...args) { assertEquals( values.length + num_const_params, args.length, 'number of arguments'); + const expected = idx => + idx < values.length ? values[(idx + shift) % values.length] : idx; + const msg = 'shifted by ' + shift + ': ' + + 'expected [' + args.map((_, i) => expected(i)).join(', ') + '], got [' + + args.join(', ') + ']'; args.forEach((arg_val, idx) => { - const expected = - idx < values.length ? values[(idx + shift) % values.length] : idx; - assertEquals(expected, arg_val, 'arg #' + idx + ', shifted by ' + shift); + assertEquals(expected(idx), arg_val, 'arg #' + idx + ', ' + msg); }); } diff --git a/deps/v8/test/mjsunit/wasm/module-memory.js b/deps/v8/test/mjsunit/wasm/module-memory.js index f5b5981436..e9d2bb954d 100644 --- a/deps/v8/test/mjsunit/wasm/module-memory.js +++ b/deps/v8/test/mjsunit/wasm/module-memory.js @@ -172,3 +172,26 @@ function testOOBThrows() { } testOOBThrows(); + +function testAddressSpaceLimit() { + // 1TiB, see wasm-memory.h + const kMaxAddressSpace = 1 * 1024 * 1024 * 1024 * 1024; + const kAddressSpacePerMemory = 8 * 1024 * 1024 * 1024; + + try { + let memories = []; + let address_space = 0; + while (address_space <= kMaxAddressSpace + 1) { + memories.push(new WebAssembly.Memory({initial: 1})); + address_space += kAddressSpacePerMemory; + } + } catch (e) { + assertTrue(e instanceof RangeError); + return; + } + failWithMessage("allocated too much memory"); +} + +if(%IsWasmTrapHandlerEnabled()) { + testAddressSpaceLimit(); +} diff --git a/deps/v8/test/mjsunit/wasm/shared-memory.js b/deps/v8/test/mjsunit/wasm/shared-memory.js index fa51a8307f..bbe89a3fe5 100644 --- a/deps/v8/test/mjsunit/wasm/shared-memory.js +++ b/deps/v8/test/mjsunit/wasm/shared-memory.js @@ -7,20 +7,23 @@ load("test/mjsunit/wasm/wasm-constants.js"); load("test/mjsunit/wasm/wasm-module-builder.js"); -function assertMemoryIsValid(memory) { +function assertMemoryIsValid(memory, shared) { assertSame(WebAssembly.Memory.prototype, memory.__proto__); assertSame(WebAssembly.Memory, memory.constructor); assertTrue(memory instanceof Object); assertTrue(memory instanceof WebAssembly.Memory); + if (shared) { + assertTrue(memory.buffer instanceof SharedArrayBuffer); + // Assert that the buffer is frozen when memory is shared. + assertTrue(Object.isFrozen(memory.buffer)); + } } (function TestConstructorWithShared() { print("TestConstructorWithShared"); let memory = new WebAssembly.Memory({ initial: 0, maximum: 10, shared: true}); - assertMemoryIsValid(memory); - // Assert that the buffer is frozen when memory is shared. - assertTrue(Object.isFrozen(memory.buffer)); + assertMemoryIsValid(memory, true); })(); (function TestConstructorWithUndefinedShared() { @@ -36,7 +39,7 @@ function assertMemoryIsValid(memory) { // For numeric values, shared = true. let memory = new WebAssembly.Memory({ initial: 0, maximum: 10, shared: 2098665}); - assertMemoryIsValid(memory); + assertMemoryIsValid(memory, true); })(); (function TestConstructorWithEmptyStringShared() { @@ -101,3 +104,29 @@ function assertMemoryIsValid(memory) { assertThrows(() => new WebAssembly.Instance(module, {m: {imported_mem: memory}}), WebAssembly.LinkError); })(); + +(function TestInstantiateWithSharedDefined() { + print("TestInstantiateWithSharedDefined"); + let builder = new WasmModuleBuilder(); + builder.addMemory(2, 10, true, "shared"); + let module = new WebAssembly.Module(builder.toBuffer()); + let instance = new WebAssembly.Instance(module); + assertMemoryIsValid(instance.exports.memory, true); +})(); + +(function TestAtomicOpWithSharedMemoryDefined() { + print("TestAtomicOpWithSharedMemoryDefined"); + let builder = new WasmModuleBuilder(); + builder.addMemory(2, 10, false, "shared"); + builder.addFunction("main", kSig_i_ii) + .addBody([ + kExprGetLocal, 0, + kExprGetLocal, 1, + kAtomicPrefix, + kExprI32AtomicAdd, 2, 0]) + .exportFunc(); + let module = new WebAssembly.Module(builder.toBuffer()); + let instance = new WebAssembly.Instance(module); + assertEquals(0, instance.exports.main(0, 0x11111111)); + assertEquals(0x11111111, instance.exports.main(0, 0x11111111)); +})(); diff --git a/deps/v8/test/mjsunit/wasm/trap-location.js b/deps/v8/test/mjsunit/wasm/trap-location.js index 0c646c92cd..c4a0f4d787 100644 --- a/deps/v8/test/mjsunit/wasm/trap-location.js +++ b/deps/v8/test/mjsunit/wasm/trap-location.js @@ -86,7 +86,7 @@ let buffer = builder.toBuffer(); // Test async compilation and instantiation. assertPromiseResult(WebAssembly.instantiate(buffer), pair => { - testTrapLocations(pair.instance, 6); + testTrapLocations(pair.instance, 5); }); // Test sync compilation and instantiation. diff --git a/deps/v8/test/mjsunit/wasm/wasm-module-builder.js b/deps/v8/test/mjsunit/wasm/wasm-module-builder.js index d21067b36e..c00c2c8226 100644 --- a/deps/v8/test/mjsunit/wasm/wasm-module-builder.js +++ b/deps/v8/test/mjsunit/wasm/wasm-module-builder.js @@ -121,9 +121,25 @@ class WasmFunctionBuilder { return this; } + getNumLocals() { + let total_locals = 0; + for (let l of this.locals || []) { + for (let type of ["i32", "i64", "f32", "f64", "s128"]) { + total_locals += l[type + "_count"] || 0; + } + } + return total_locals; + } + addLocals(locals, names) { - this.locals = locals; - this.local_names = names; + const old_num_locals = this.getNumLocals(); + if (!this.locals) this.locals = [] + this.locals.push(locals); + if (names) { + if (!this.local_names) this.local_names = []; + const missing_names = old_num_locals - this.local_names.length; + this.local_names.push(...new Array(missing_names), ...names); + } return this; } @@ -409,7 +425,6 @@ class WasmModuleBuilder { } section.emit_u32v(wasm.memory.min); if (has_max) section.emit_u32v(wasm.memory.max); - if (wasm.memory.shared) section.emit_u8(1); }); } @@ -538,9 +553,7 @@ class WasmModuleBuilder { for (let func of wasm.functions) { // Function body length will be patched later. let local_decls = []; - let l = func.locals; - if (l !== undefined) { - let local_decls_count = 0; + for (let l of func.locals || []) { if (l.i32_count > 0) { local_decls.push({count: l.i32_count, type: kWasmI32}); } diff --git a/deps/v8/test/mkgrokdump/mkgrokdump.cc b/deps/v8/test/mkgrokdump/mkgrokdump.cc index 264779601b..75dac7a4a4 100644 --- a/deps/v8/test/mkgrokdump/mkgrokdump.cc +++ b/deps/v8/test/mkgrokdump/mkgrokdump.cc @@ -75,7 +75,7 @@ static int DumpHeapConstants(const char* argv0) { for (i::Object* o = it.Next(); o != NULL; o = it.Next()) { i::Map* m = i::Map::cast(o); const char* n = NULL; - intptr_t p = reinterpret_cast<intptr_t>(m) & 0x7ffff; + intptr_t p = reinterpret_cast<intptr_t>(m) & 0x7FFFF; int t = m->instance_type(); ROOT_LIST(ROOT_LIST_CASE) STRUCT_LIST(STRUCT_LIST_CASE) @@ -93,17 +93,18 @@ static int DumpHeapConstants(const char* argv0) { n = #camel_name; \ i = i::Heap::k##camel_name##RootIndex; \ } - i::OldSpaces spit(heap); + i::PagedSpaces spit(heap); i::PrintF("KNOWN_OBJECTS = {\n"); for (i::PagedSpace* s = spit.next(); s != NULL; s = spit.next()) { i::HeapObjectIterator it(s); // Code objects are generally platform-dependent. - if (s->identity() == i::CODE_SPACE) continue; + if (s->identity() == i::CODE_SPACE || s->identity() == i::MAP_SPACE) + continue; const char* sname = AllocationSpaceName(s->identity()); for (i::Object* o = it.Next(); o != NULL; o = it.Next()) { const char* n = NULL; i::Heap::RootListIndex i = i::Heap::kStrongRootListLength; - intptr_t p = reinterpret_cast<intptr_t>(o) & 0x7ffff; + intptr_t p = reinterpret_cast<intptr_t>(o) & 0x7FFFF; ROOT_LIST(ROOT_LIST_CASE) if (n == NULL) continue; if (!i::Heap::RootIsImmortalImmovable(i)) continue; diff --git a/deps/v8/test/mkgrokdump/testcfg.py b/deps/v8/test/mkgrokdump/testcfg.py index 3dcf80a6a1..de8e71f7ea 100644 --- a/deps/v8/test/mkgrokdump/testcfg.py +++ b/deps/v8/test/mkgrokdump/testcfg.py @@ -3,48 +3,46 @@ # found in the LICENSE file. import os -import difflib from testrunner.local import testsuite from testrunner.objects import testcase +from testrunner.outproc import mkgrokdump -class MkGrokdump(testsuite.TestSuite): - SHELL = 'mkgrokdump' +SHELL = 'mkgrokdump' - def __init__(self, name, root): - super(MkGrokdump, self).__init__(name, root) +class TestSuite(testsuite.TestSuite): + def __init__(self, *args, **kwargs): + super(TestSuite, self).__init__(*args, **kwargs) + + v8_path = os.path.dirname(os.path.dirname(os.path.abspath(self.root))) + self.expected_path = os.path.join(v8_path, 'tools', 'v8heapconst.py') def ListTests(self, context): - test = testcase.TestCase(self, self.SHELL) + test = self._create_test(SHELL) return [test] - def GetShellForTestCase(self, testcase): - return self.SHELL + def _test_class(self): + return TestCase - def GetParametersForTestCase(self, testcase, context): - return [], [], {} - def IsFailureOutput(self, testcase): - output = testcase.output - v8_path = os.path.dirname(os.path.dirname(os.path.abspath(self.root))) - expected_path = os.path.join(v8_path, "tools", "v8heapconst.py") - with open(expected_path) as f: - expected = f.read() - expected_lines = expected.splitlines() - actual_lines = output.stdout.splitlines() - diff = difflib.unified_diff(expected_lines, actual_lines, lineterm="", - fromfile="expected_path") - diffstring = '\n'.join(diff) - if diffstring is not "": - if "generated from a non-shipping build" in output.stdout: - return False - if not "generated from a shipping build" in output.stdout: - output.stdout = "Unexpected output:\n\n" + output.stdout - return True - output.stdout = diffstring - return True - return False +class TestCase(testcase.TestCase): + def _get_variant_flags(self): + return [] + + def _get_statusfile_flags(self): + return [] + + def _get_mode_flags(self, ctx): + return [] + + def get_shell(self): + return SHELL + + @property + def output_proc(self): + return mkgrokdump.OutProc(self.expected_outcomes, self.suite.expected_path) + def GetSuite(name, root): - return MkGrokdump(name, root) + return TestSuite(name, root) diff --git a/deps/v8/test/mozilla/mozilla.status b/deps/v8/test/mozilla/mozilla.status index d64b74f354..40334cdcd8 100644 --- a/deps/v8/test/mozilla/mozilla.status +++ b/deps/v8/test/mozilla/mozilla.status @@ -154,7 +154,7 @@ # Compiles a long chain of && or || operations, can time out under slower # variants. - 'js1_5/Expressions/regress-394673': [PASS, FAST_VARIANTS], + 'js1_5/Expressions/regress-394673': [PASS, NO_VARIANTS], # This takes a long time to run (~100 seconds). It should only be run # by the really patient. @@ -879,10 +879,10 @@ ['no_i18n == True and mode == debug', { # Tests too slow for no18n debug. - 'ecma_3/Statements/regress-302439': [PASS, FAST_VARIANTS], + 'ecma_3/Statements/regress-302439': [PASS, NO_VARIANTS], 'js1_5/Regress/regress-98901': [SKIP], - 'ecma_3/RegExp/perlstress-001': [PASS, FAST_VARIANTS], - 'js1_5/extensions/regress-311161': [FAIL_OK, FAST_VARIANTS], + 'ecma_3/RegExp/perlstress-001': [PASS, NO_VARIANTS], + 'js1_5/extensions/regress-311161': [FAIL_OK, NO_VARIANTS], }], # 'no_i18n == True and mode == debug' diff --git a/deps/v8/test/mozilla/testcfg.py b/deps/v8/test/mozilla/testcfg.py index 46623d0848..8e69b7d9b7 100644 --- a/deps/v8/test/mozilla/testcfg.py +++ b/deps/v8/test/mozilla/testcfg.py @@ -30,6 +30,7 @@ import os from testrunner.local import testsuite from testrunner.objects import testcase +from testrunner.outproc import mozilla EXCLUDED = ["CVS", ".svn"] @@ -54,10 +55,9 @@ TEST_DIRS = """ """.split() -class MozillaTestSuite(testsuite.TestSuite): - +class TestSuite(testsuite.TestSuite): def __init__(self, name, root): - super(MozillaTestSuite, self).__init__(name, root) + super(TestSuite, self).__init__(name, root) self.testroot = os.path.join(root, "data") def ListTests(self, context): @@ -77,37 +77,46 @@ class MozillaTestSuite(testsuite.TestSuite): fullpath = os.path.join(dirname, filename) relpath = fullpath[len(self.testroot) + 1 : -3] testname = relpath.replace(os.path.sep, "/") - case = testcase.TestCase(self, testname) + case = self._create_test(testname) tests.append(case) return tests - def GetParametersForTestCase(self, testcase, context): - files = [os.path.join(self.root, "mozilla-shell-emulation.js")] - testfilename = testcase.path + ".js" + def _test_class(self): + return TestCase + + +class TestCase(testcase.TestCase): + def _get_files_params(self, ctx): + files = [os.path.join(self.suite.root, "mozilla-shell-emulation.js")] + testfilename = self.path + ".js" testfilepath = testfilename.split("/") for i in xrange(len(testfilepath)): - script = os.path.join(self.testroot, + script = os.path.join(self.suite.testroot, reduce(os.path.join, testfilepath[:i], ""), "shell.js") if os.path.exists(script): files.append(script) - files.append(os.path.join(self.testroot, testfilename)) - flags = testcase.flags + context.mode_flags + ["--expose-gc"] - return files, flags, {} - def GetSourceForTest(self, testcase): - filename = os.path.join(self.testroot, testcase.path + ".js") - with open(filename) as f: - return f.read() + files.append(os.path.join(self.suite.testroot, testfilename)) + return files + + def _get_suite_flags(self, ctx): + return ['--expose-gc'] + + def _get_source_path(self): + return os.path.join(self.suite.testroot, self.path + self._get_suffix()) - def IsNegativeTest(self, testcase): - return testcase.path.endswith("-n") + @property + def output_proc(self): + if not self.expected_outcomes: + if self.path.endswith('-n'): + return mozilla.MOZILLA_PASS_NEGATIVE + return mozilla.MOZILLA_PASS_DEFAULT + if self.path.endswith('-n'): + return mozilla.NegOutProc(self.expected_outcomes) + return mozilla.OutProc(self.expected_outcomes) - def IsFailureOutput(self, testcase): - if testcase.output.exit_code != 0: - return True - return "FAILED!" in testcase.output.stdout def GetSuite(name, root): - return MozillaTestSuite(name, root) + return TestSuite(name, root) diff --git a/deps/v8/test/optimize_for_size.gyp b/deps/v8/test/optimize_for_size.gyp index 047e3d8acb..8728479c23 100644 --- a/deps/v8/test/optimize_for_size.gyp +++ b/deps/v8/test/optimize_for_size.gyp @@ -11,6 +11,7 @@ 'type': 'none', 'dependencies': [ 'cctest/cctest.gyp:cctest_run', + 'debugger/debugger.gyp:debugger_run', 'intl/intl.gyp:intl_run', 'mjsunit/mjsunit.gyp:mjsunit_run', 'webkit/webkit.gyp:webkit_run', diff --git a/deps/v8/test/perf.isolate b/deps/v8/test/perf.isolate index 5eec44a3ee..132bcc54f0 100644 --- a/deps/v8/test/perf.isolate +++ b/deps/v8/test/perf.isolate @@ -10,7 +10,7 @@ '../tools/run_perf.py', # TODO(machenbach): These files are referenced by the perf runner. # They should be transformed into a proper python module. - '../tools/testrunner/local/commands.py', + '../tools/testrunner/local/command.py', '../tools/testrunner/local/utils.py', '../tools/testrunner/objects/output.py', # This is often used to trigger performance bots. We include it in the diff --git a/deps/v8/test/preparser/testcfg.py b/deps/v8/test/preparser/testcfg.py index f90d34f4ac..f6814e756f 100644 --- a/deps/v8/test/preparser/testcfg.py +++ b/deps/v8/test/preparser/testcfg.py @@ -32,20 +32,22 @@ from testrunner.local import testsuite from testrunner.objects import testcase -class PreparserTestSuite(testsuite.TestSuite): - def __init__(self, name, root): - super(PreparserTestSuite, self).__init__(name, root) +class VariantsGenerator(testsuite.VariantsGenerator): + def _get_variants(self, test): + return self._standard_variant + +class TestSuite(testsuite.TestSuite): def _ParsePythonTestTemplates(self, result, filename): pathname = os.path.join(self.root, filename + ".pyt") - def Test(name, source, expectation, extra_flags=[]): + def Test(name, source, expectation): source = source.replace("\n", " ") - testname = os.path.join(filename, name) - flags = ["-e", source] + path = os.path.join(filename, name) if expectation: - flags += ["--throws"] - flags += extra_flags - test = testcase.TestCase(self, testname, flags=flags) + template_flags = ["--throws"] + else: + template_flags = [] + test = self._create_test(path, source, template_flags) result.append(test) def Template(name, source): def MkTest(replacement, expectation): @@ -68,16 +70,48 @@ class PreparserTestSuite(testsuite.TestSuite): self._ParsePythonTestTemplates(result, f) return result - def GetParametersForTestCase(self, testcase, context): - return [], testcase.flags, {} + def _create_test(self, path, source, template_flags): + return super(TestSuite, self)._create_test( + path, source=source, template_flags=template_flags) + + def _test_class(self): + return TestCase + + def _LegacyVariantsGeneratorFactory(self): + return testsuite.StandardLegacyVariantsGenerator + + def _variants_gen_class(self): + return VariantsGenerator + + +class TestCase(testcase.TestCase): + def __init__(self, suite, path, name, source, template_flags): + super(TestCase, self).__init__(suite, path, name) + + self._source = source + self._template_flags = template_flags + + def _get_cmd_params(self, ctx): + return ( + self._get_files_params(ctx) + + self._get_extra_flags(ctx) + + ['-e', self._source] + + self._template_flags + + self._get_variant_flags() + + self._get_statusfile_flags() + + self._get_mode_flags(ctx) + + self._get_source_flags() + ) + + def _get_mode_flags(self, ctx): + return [] - def GetSourceForTest(self, testcase): - assert testcase.flags[0] == "-e" - return testcase.flags[1] + def is_source_available(self): + return True - def _VariantGeneratorFactory(self): - return testsuite.StandardVariantGenerator + def get_source(self): + return self._source def GetSuite(name, root): - return PreparserTestSuite(name, root) + return TestSuite(name, root) diff --git a/deps/v8/test/promises-aplus/README b/deps/v8/test/promises-aplus/README deleted file mode 100644 index de15da362c..0000000000 --- a/deps/v8/test/promises-aplus/README +++ /dev/null @@ -1,29 +0,0 @@ -This directory contains code for running Promise/A+ Compliance Test Suite[1]. -You can download the it from [1], or by specifying --download to -tools/run-tests.py. -Promise/A+ Compliance Test Suite requires Node environment and needs some -libraries. To run it in d8 shell, we provides some emulation functions in the -lib/ directory. - - - lib/adapter.js - - An adapter for harmony Promise used in Promise/A+ tests. - - lib/assert.js - - Emulates assert modules in Node. - - lib/global.js - - Provides global functions and variables. - - lib/mocha.js - - Emulates Mocha[2] test framework. - - lib/require.j - - Emulate require function in Node. - - lib/run-tests.js - - Run all describe tests. - -The emulation is not complete. Upgrading Promise/A+ tests will require -changing lib/ scripts. - -Sinon.JS[3], required by Promise/A+ tests, is also downloaded by run-tests.py. - -[1]: https://github.com/promises-aplus/promises-tests -[2]: http://visionmedia.github.io/mocha/ -[3]: http://sinonjs.org/ - diff --git a/deps/v8/test/promises-aplus/lib/adapter.js b/deps/v8/test/promises-aplus/lib/adapter.js deleted file mode 100644 index d99913a138..0000000000 --- a/deps/v8/test/promises-aplus/lib/adapter.js +++ /dev/null @@ -1,41 +0,0 @@ -// Copyright 2014 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. - -var global = this.global || {}; - -global.adapter = { - resolved: function(value) { return Promise.resolve(value); }, - rejected: function(reason) { return Promise.reject(reason); }, - deferred: function() { - var resolve, reject; - var promise = new Promise(function(res, rej) { - resolve = res; - reject = rej; - }); - return {promise: promise, resolve: resolve, reject: reject}; - } -}; diff --git a/deps/v8/test/promises-aplus/lib/assert.js b/deps/v8/test/promises-aplus/lib/assert.js deleted file mode 100644 index 0138f36041..0000000000 --- a/deps/v8/test/promises-aplus/lib/assert.js +++ /dev/null @@ -1,97 +0,0 @@ -// Copyright 2014 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. - -// Mimics assert module in node. - -function compose(message1, message2) { - return message2 ? message1 + ': ' + message2 : message1 -} - -function fail(actual, expected, message, operator) { - var e = Error(compose('FAIL', message) + - ': (' + actual + ' ' + operator + ' ' + expected + ') should hold'); - fails.push(e); - throw e; -} - -function ok(value, message) { - if (!value) { - throw Error(compose('FAIL', + message) + ': value = ' + value); - } -} - -function equal(actual, expected, message) { - if (!(expected == actual)) { - fail(actual, expected, message, '=='); - } -} - -function notEqual(actual, expected, message) { - if (!(expected != actual)) { - fail(actual, expected, message, '!='); - } -} - -function strictEqual(actual, expected, message) { - if (!(expected === actual)) { - fail(actual, expected, message, '==='); - } -} - -function notStrictEqual(actual, expected, message) { - if (!(expected !== actual)) { - fail(actual, expected, message, '!=='); - } -} - -function assert(value, message) { - return ok(value, message); -} - -function notImplemented() { - throw Error('FAIL: This assertion function is not yet implemented.'); -} - -function clear() { - this.fails = []; -} - -assert.fail = fail; -assert.ok = ok; -assert.equal = equal; -assert.notEqual = notEqual; -assert.deepEqual = notImplemented; -assert.notDeepEqual = notImplemented; -assert.strictEqual = strictEqual; -assert.notStrictEqual = notStrictEqual; -assert.throws = notImplemented; -assert.doesNotThrow = notImplemented; -assert.ifError = notImplemented; - -assert.clear = clear; - -exports = assert; diff --git a/deps/v8/test/promises-aplus/lib/global.js b/deps/v8/test/promises-aplus/lib/global.js deleted file mode 100644 index ece338ed3e..0000000000 --- a/deps/v8/test/promises-aplus/lib/global.js +++ /dev/null @@ -1,67 +0,0 @@ -// Copyright 2014 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. - -var global = this.global || {}; -var setTimeout; -var clearTimeout; - -(function() { -var timers = {}; -var currentId = 0; - -setInterval = function(fn, delay) { - var i = 0; - var id = currentId++; - function loop() { - if (!timers[id]) { - return; - } - if (i++ >= delay) { - fn(); - } - %EnqueueMicrotask(loop); - } - %EnqueueMicrotask(loop); - timers[id] = true; - return id; -} - -clearTimeout = function(id) { - delete timers[id]; -} - -clearInterval = clearTimeout; - -setTimeout = function(fn, delay) { - var id = setInterval(function() { - fn(); - clearInterval(id); - }, delay); - return id; -} - -}()); diff --git a/deps/v8/test/promises-aplus/lib/mocha.js b/deps/v8/test/promises-aplus/lib/mocha.js deleted file mode 100644 index 0a172b9d2f..0000000000 --- a/deps/v8/test/promises-aplus/lib/mocha.js +++ /dev/null @@ -1,255 +0,0 @@ -// Copyright 2014 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. - -// This file emulates Mocha test framework used in promises-aplus tests. - -var describe; -var it; -var specify; -var before; -var after; -var beforeEach; -var afterEach; -var RunAllTests; - -var assert = require('assert'); - -(function() { -var TIMEOUT = 1000; - -var context = { - beingDescribed: undefined, - currentSuiteIndex: 0, - suites: [] -}; - -function Run() { - function current() { - while (context.currentSuiteIndex < context.suites.length && - context.suites[context.currentSuiteIndex].hasRun) { - ++context.currentSuiteIndex; - } - if (context.suites.length == context.currentSuiteIndex) { - return undefined; - } - return context.suites[context.currentSuiteIndex]; - } - var suite = current(); - if (!suite) { - // done - print('All tests have run.'); - return; - } - suite.Run(); -} - -RunAllTests = function() { - context.currentSuiteIndex = 0; - var numRegularTestCases = 0; - for (var i = 0; i < context.suites.length; ++i) { - numRegularTestCases += context.suites[i].numRegularTestCases(); - } - print(context.suites.length + ' suites and ' + numRegularTestCases + - ' test cases are found'); - Run(); -}; - -function TestCase(name, before, fn, after, isRegular) { - this.name = name; - this.before = before; - this.fn = fn; - this.after = after; - this.isRegular = isRegular; - this.hasDone = false; -} - -TestCase.prototype.RunFunction = function(suite, fn, postAction) { - if (!fn) { - postAction(); - return; - } - try { - if (fn.length === 0) { - // synchronous - fn(); - postAction(); - } else { - // asynchronous - fn(postAction); - } - } catch (e) { - suite.ReportError(this, e); - } -} - -TestCase.prototype.MarkAsDone = function() { - this.hasDone = true; - clearTimeout(this.timer); -} - -TestCase.prototype.Run = function(suite, postAction) { - print('Running ' + suite.description + '#' + this.name + ' ...'); - assert.clear(); - - this.timer = setTimeout(function() { - suite.ReportError(this, Error('timeout')); - }.bind(this), TIMEOUT); - - this.RunFunction(suite, this.before, function(e) { - if (this.hasDone) { - return; - } - if (e instanceof Error) { - return suite.ReportError(this, e); - } - if (assert.fails.length > 0) { - return suite.ReportError(this, assert.fails[0]); - } - this.RunFunction(suite, this.fn, function(e) { - if (this.hasDone) { - return; - } - if (e instanceof Error) { - return suite.ReportError(this, e); - } - if (assert.fails.length > 0) { - return suite.ReportError(this, assert.fails[0]); - } - this.RunFunction(suite, this.after, function(e) { - if (this.hasDone) { - return; - } - if (e instanceof Error) { - return suite.ReportError(this, e); - } - if (assert.fails.length > 0) { - return suite.ReportError(this, assert.fails[0]); - } - this.MarkAsDone(); - if (this.isRegular) { - print('PASS: ' + suite.description + '#' + this.name); - } - %EnqueueMicrotask(postAction); - }.bind(this)); - }.bind(this)); - }.bind(this)); -}; - -function TestSuite(described) { - this.description = described.description; - this.cases = []; - this.currentIndex = 0; - this.hasRun = false; - - if (described.before) { - this.cases.push(new TestCase(this.description + ' :before', undefined, - described.before, undefined, false)); - } - for (var i = 0; i < described.cases.length; ++i) { - this.cases.push(new TestCase(described.cases[i].description, - described.beforeEach, - described.cases[i].fn, - described.afterEach, - true)); - } - if (described.after) { - this.cases.push(new TestCase(this.description + ' :after', - undefined, described.after, undefined, false)); - } -} - -TestSuite.prototype.Run = function() { - this.hasRun = this.currentIndex === this.cases.length; - if (this.hasRun) { - %EnqueueMicrotask(Run); - return; - } - - // TestCase.prototype.Run cannot throw an exception. - this.cases[this.currentIndex].Run(this, function() { - ++this.currentIndex; - %EnqueueMicrotask(Run); - }.bind(this)); -}; - -TestSuite.prototype.numRegularTestCases = function() { - var n = 0; - for (var i = 0; i < this.cases.length; ++i) { - if (this.cases[i].isRegular) { - ++n; - } - } - return n; -} - -TestSuite.prototype.ReportError = function(testCase, e) { - if (testCase.hasDone) { - return; - } - testCase.MarkAsDone(); - this.hasRun = this.currentIndex === this.cases.length; - print('FAIL: ' + this.description + '#' + testCase.name + ': ' + - e.name + ' (' + e.message + ')'); - ++this.currentIndex; - %EnqueueMicrotask(Run); -}; - -describe = function(description, fn) { - var parent = context.beingDescribed; - var incomplete = { - cases: [], - description: parent ? parent.description + ' ' + description : description, - parent: parent, - }; - context.beingDescribed = incomplete; - fn(); - context.beingDescribed = parent; - - context.suites.push(new TestSuite(incomplete)); -} - -specify = it = function(description, fn) { - context.beingDescribed.cases.push({description: description, fn: fn}); -} - -before = function(fn) { - context.beingDescribed.before = fn; -} - -after = function(fn) { - context.beingDescribed.after = fn; -} - -beforeEach = function(fn) { - context.beingDescribed.beforeEach = fn; -} - -afterEach = function(fn) { - context.beingDescribed.afterEach = fn; -} - -}()); diff --git a/deps/v8/test/promises-aplus/lib/require.js b/deps/v8/test/promises-aplus/lib/require.js deleted file mode 100644 index b987a1a862..0000000000 --- a/deps/v8/test/promises-aplus/lib/require.js +++ /dev/null @@ -1,50 +0,0 @@ -// Copyright 2014 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. - -var global = this.global || {}; - -// Emulates 'require' function in Node. -// This is not a generic function: it only works for known modules. -var require = function(name) { - var exports = {}; - var path; - var base = 'test/promises-aplus/' - if (name.search('./helpers/') === 0) { - path = base + 'promises-tests/lib/tests/' + name + '.js'; - } else if (name === 'assert') { - path = base + 'lib/assert.js'; - } else if (name === 'sinon') { - path = base + 'sinon/sinon.js'; - } else { - throw Error('We cannot load the library: ' + name); - } - eval('(function() { ' + read(path) + '}())'); - if (name === 'sinon') { - return this.sinon; - } - return exports; -}; diff --git a/deps/v8/test/promises-aplus/lib/run-tests.js b/deps/v8/test/promises-aplus/lib/run-tests.js deleted file mode 100644 index 6a0a96c639..0000000000 --- a/deps/v8/test/promises-aplus/lib/run-tests.js +++ /dev/null @@ -1,29 +0,0 @@ -// Copyright 2014 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. - -// Defined in lib/mocha.js -RunAllTests(); diff --git a/deps/v8/test/promises-aplus/promises-aplus.status b/deps/v8/test/promises-aplus/promises-aplus.status deleted file mode 100644 index 5da9efae90..0000000000 --- a/deps/v8/test/promises-aplus/promises-aplus.status +++ /dev/null @@ -1,31 +0,0 @@ -# Copyright 2014 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. - -[ -[ALWAYS, { -}], # ALWAYS -] diff --git a/deps/v8/test/promises-aplus/testcfg.py b/deps/v8/test/promises-aplus/testcfg.py deleted file mode 100644 index 4db598a78a..0000000000 --- a/deps/v8/test/promises-aplus/testcfg.py +++ /dev/null @@ -1,99 +0,0 @@ -# Copyright 2014 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. - - -import hashlib -import os -import shutil -import sys -import tarfile - -from testrunner.local import testsuite -from testrunner.local import utils -from testrunner.objects import testcase - - -""" -Requirements for using this test suite: -Download http://sinonjs.org/releases/sinon-1.7.3.js into -test/promises-aplus/sinon. -Download https://github.com/promises-aplus/promises-tests/tree/2.0.3 into -test/promises-aplus/promises-tests. -""" - -TEST_NAME = 'promises-tests' - - -class PromiseAplusTestSuite(testsuite.TestSuite): - - def __init__(self, name, root): - self.root = root - self.test_files_root = os.path.join(self.root, TEST_NAME, 'lib', 'tests') - self.name = name - self.helper_files_pre = [ - os.path.join(root, 'lib', name) for name in - ['global.js', 'require.js', 'mocha.js', 'adapter.js'] - ] - self.helper_files_post = [ - os.path.join(root, 'lib', name) for name in - ['run-tests.js'] - ] - - def CommonTestName(self, testcase): - return testcase.path.split(os.path.sep)[-1] - - def ListTests(self, context): - return [testcase.TestCase(self, fname[:-len('.js')]) for fname in - os.listdir(os.path.join(self.root, TEST_NAME, 'lib', 'tests')) - if fname.endswith('.js')] - - def GetParametersForTestCase(self, testcase, context): - files = ( - self.helper_files_pre + - [os.path.join(self.test_files_root, testcase.path + '.js')] + - self.helper_files_post - ) - flags = testcase.flags + context.mode_flags + ['--allow-natives-syntax'] - return files, flags, {} - - def GetSourceForTest(self, testcase): - filename = os.path.join(self.root, TEST_NAME, - 'lib', 'tests', testcase.path + '.js') - with open(filename) as f: - return f.read() - - def IsNegativeTest(self, testcase): - return '@negative' in self.GetSourceForTest(testcase) - - def IsFailureOutput(self, testcase): - if testcase.output.exit_code != 0: - return True - return not 'All tests have run.' in testcase.output.stdout or \ - 'FAIL:' in testcase.output.stdout - -def GetSuite(name, root): - return PromiseAplusTestSuite(name, root) diff --git a/deps/v8/test/test262/local-tests/test/language/expressions/class/fields-inner-arrow-err-contains-arguments.js b/deps/v8/test/test262/local-tests/test/language/expressions/class/fields-inner-arrow-err-contains-arguments.js new file mode 100644 index 0000000000..a260f59de7 --- /dev/null +++ b/deps/v8/test/test262/local-tests/test/language/expressions/class/fields-inner-arrow-err-contains-arguments.js @@ -0,0 +1,26 @@ +/*--- +description: Syntax error if `arguments` used in class field (arrow function expression) +esid: sec-class-definitions-static-semantics-early-errors +features: [class, class-fields-public, arrow-function] +flags: [generated] +negative: + phase: early + type: SyntaxError +info: | + Static Semantics: Early Errors + FieldDefinition: + PropertyNameInitializeropt + - It is a Syntax Error if ContainsArguments of Initializer is true. + Static Semantics: ContainsArguments + IdentifierReference : Identifier + 1. If the StringValue of Identifier is "arguments", return true. + ... + For all other grammatical productions, recurse on all nonterminals. If any piece returns true, then return true. Otherwise return false. +---*/ +throw "Test262: This statement should not be evaluated."; +var C = class { + x = () => { + var t = () => { arguments; }; + t(); + } +} diff --git a/deps/v8/test/test262/local-tests/test/language/expressions/class/fields-inner-arrow-eval-err-contains-arguments.js b/deps/v8/test/test262/local-tests/test/language/expressions/class/fields-inner-arrow-eval-err-contains-arguments.js new file mode 100644 index 0000000000..20e2bac839 --- /dev/null +++ b/deps/v8/test/test262/local-tests/test/language/expressions/class/fields-inner-arrow-eval-err-contains-arguments.js @@ -0,0 +1,33 @@ +/*--- +description: error if `arguments` in StatementList of eval (direct eval) +esid: sec-performeval-rules-in-initializer +features: [class, class-fields-public, arrow-function] +flags: [generated] +info: | + Static Semantics: Early Errors + + FieldDefinition: + PropertyNameInitializeropt + + - It is a Syntax Error if ContainsArguments of Initializer is true. + + Static Semantics: ContainsArguments + IdentifierReference : Identifier + + 1. If the StringValue of Identifier is "arguments", return true. + ... + For all other grammatical productions, recurse on all nonterminals. If any piece returns true, then return true. Otherwise return false. + +---*/ + +var C = class { + x = () => { + var t = () => { eval("arguments"); }; + t(); + } +} + +assert.throws(SyntaxError, function() { + var c = new C(); + c.x(); +}); diff --git a/deps/v8/test/test262/local-tests/test/language/expressions/class/fields-inner-eval-arrow-err-contains-arguments.js b/deps/v8/test/test262/local-tests/test/language/expressions/class/fields-inner-eval-arrow-err-contains-arguments.js new file mode 100644 index 0000000000..28ae79ed94 --- /dev/null +++ b/deps/v8/test/test262/local-tests/test/language/expressions/class/fields-inner-eval-arrow-err-contains-arguments.js @@ -0,0 +1,30 @@ +/*--- +description: error if `arguments` in StatementList of eval (direct eval) +esid: sec-performeval-rules-in-initializer +features: [class, class-fields-public, arrow-function] +flags: [generated] +info: | + Static Semantics: Early Errors + + FieldDefinition: + PropertyNameInitializeropt + + - It is a Syntax Error if ContainsArguments of Initializer is true. + + Static Semantics: ContainsArguments + IdentifierReference : Identifier + + 1. If the StringValue of Identifier is "arguments", return true. + ... + For all other grammatical productions, recurse on all nonterminals. If any piece returns true, then return true. Otherwise return false. + +---*/ + +var C = class { + x = eval("() => arguments"); +} + +assert.throws(SyntaxError, function() { + var c = new C(); + c.x(); +}); diff --git a/deps/v8/test/test262/local-tests/test/language/statements/class/fields-inner-arrow-err-contains-arguments.js b/deps/v8/test/test262/local-tests/test/language/statements/class/fields-inner-arrow-err-contains-arguments.js new file mode 100644 index 0000000000..2ce086c612 --- /dev/null +++ b/deps/v8/test/test262/local-tests/test/language/statements/class/fields-inner-arrow-err-contains-arguments.js @@ -0,0 +1,26 @@ +/*--- +description: Syntax error if `arguments` used in class field (arrow function expression) +esid: sec-class-definitions-static-semantics-early-errors +features: [class, class-fields-public, arrow-function] +flags: [generated] +negative: + phase: early + type: SyntaxError +info: | + Static Semantics: Early Errors + FieldDefinition: + PropertyNameInitializeropt + - It is a Syntax Error if ContainsArguments of Initializer is true. + Static Semantics: ContainsArguments + IdentifierReference : Identifier + 1. If the StringValue of Identifier is "arguments", return true. + ... + For all other grammatical productions, recurse on all nonterminals. If any piece returns true, then return true. Otherwise return false. +---*/ +throw "Test262: This statement should not be evaluated."; +class C { + x = () => { + var t = () => { arguments; }; + t(); + } +} diff --git a/deps/v8/test/test262/local-tests/test/language/statements/class/fields-inner-arrow-eval-err-contains-arguments.js b/deps/v8/test/test262/local-tests/test/language/statements/class/fields-inner-arrow-eval-err-contains-arguments.js new file mode 100644 index 0000000000..9b29503256 --- /dev/null +++ b/deps/v8/test/test262/local-tests/test/language/statements/class/fields-inner-arrow-eval-err-contains-arguments.js @@ -0,0 +1,34 @@ +/*--- +description: error if `arguments` in StatementList of eval (direct eval) +esid: sec-performeval-rules-in-initializer +features: [class, class-fields-public, arrow-function] +flags: [generated] +info: | + Static Semantics: Early Errors + + FieldDefinition: + PropertyNameInitializeropt + + - It is a Syntax Error if ContainsArguments of Initializer is true. + + Static Semantics: ContainsArguments + IdentifierReference : Identifier + + 1. If the StringValue of Identifier is "arguments", return true. + ... + For all other grammatical productions, recurse on all nonterminals. If any piece returns true, then return true. Otherwise return false. + +---*/ + + +class C { + x = () => { + var t = () => { eval("arguments"); }; + t(); + } +} + +assert.throws(SyntaxError, function() { + var c = new C(); + c.x(); +}); diff --git a/deps/v8/test/test262/local-tests/test/language/statements/class/fields-inner-eval-arrow-err-contains-arguments.js b/deps/v8/test/test262/local-tests/test/language/statements/class/fields-inner-eval-arrow-err-contains-arguments.js new file mode 100644 index 0000000000..f2680e4b67 --- /dev/null +++ b/deps/v8/test/test262/local-tests/test/language/statements/class/fields-inner-eval-arrow-err-contains-arguments.js @@ -0,0 +1,30 @@ +/*--- +description: error if `arguments` in StatementList of eval (direct eval) +esid: sec-performeval-rules-in-initializer +features: [class, class-fields-public, arrow-function] +flags: [generated] +info: | + Static Semantics: Early Errors + + FieldDefinition: + PropertyNameInitializeropt + + - It is a Syntax Error if ContainsArguments of Initializer is true. + + Static Semantics: ContainsArguments + IdentifierReference : Identifier + + 1. If the StringValue of Identifier is "arguments", return true. + ... + For all other grammatical productions, recurse on all nonterminals. If any piece returns true, then return true. Otherwise return false. + +---*/ + +class C { + x = eval("() => arguments"); +} + +assert.throws(SyntaxError, function() { + var c = new C(); + c.x(); +}); diff --git a/deps/v8/test/test262/test262.status b/deps/v8/test/test262/test262.status index 51ab51447a..bd4b667a09 100644 --- a/deps/v8/test/test262/test262.status +++ b/deps/v8/test/test262/test262.status @@ -95,6 +95,8 @@ 'built-ins/TypedArrays/internals/HasProperty/detached-buffer-realm': [FAIL], 'built-ins/TypedArrays/internals/Set/detached-buffer': [FAIL], 'built-ins/TypedArrays/internals/Set/detached-buffer-realm': [FAIL], + 'built-ins/TypedArrays/internals/Set/tonumber-value-detached-buffer': [FAIL], + 'built-ins/TypedArrays/internals/DefineOwnProperty/tonumber-value-detached-buffer': [FAIL], # Some TypedArray methods throw due to the same bug, from Get 'built-ins/TypedArray/prototype/every/callbackfn-detachbuffer': [FAIL], 'built-ins/TypedArray/prototype/filter/callbackfn-detachbuffer': [FAIL], @@ -222,9 +224,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=4124 - 'built-ins/Simd/*': [SKIP], - # https://bugs.chromium.org/p/v8/issues/detail?id=4958 'built-ins/Function/prototype/toString/*': ['--harmony-function-tostring'], @@ -424,15 +423,33 @@ 'built-ins/Proxy/ownKeys/return-duplicate-symbol-entries-throws': [FAIL], # https://bugs.chromium.org/p/v8/issues/detail?id=6861 - 'language/statements/for-of/iterator-next-reference': [FAIL], - 'language/expressions/async-generator/named-yield-star-async-next': [FAIL], - 'language/expressions/async-generator/yield-star-async-next': [FAIL], - 'language/expressions/class/async-gen-method-yield-star-async-next': [FAIL], - 'language/expressions/class/async-gen-method-static-yield-star-async-next': [FAIL], - 'language/expressions/object/method-definition/async-gen-yield-star-async-next': [FAIL], - 'language/statements/async-generator/yield-star-async-next': [FAIL], - 'language/statements/class/async-gen-method-yield-star-async-next': [FAIL], - 'language/statements/class/async-gen-method-static-yield-star-async-next': [FAIL], + 'language/expressions/object/method-definition/async-gen-yield-star-sync-next': [FAIL], + 'language/expressions/class/async-gen-method-static-yield-star-sync-next': [FAIL], + 'language/expressions/async-generator/yield-star-sync-next': [FAIL], + 'language/statements/class/async-gen-method-static-yield-star-sync-next': [FAIL], + 'language/expressions/async-generator/named-yield-star-sync-next': [FAIL], + 'language/expressions/class/async-gen-method-yield-star-sync-next': [FAIL], + 'language/statements/class/async-gen-method-yield-star-sync-next': [FAIL], + 'language/statements/async-generator/yield-star-sync-next': [FAIL], + + # https://bugs.chromium.org/p/v8/issues/detail?id=6791 + 'built-ins/BigInt/prototype/Symbol.toStringTag': [SKIP], + 'built-ins/DataView/prototype/getBigInt64/*': [SKIP], + 'built-ins/DataView/prototype/getBigUint64/*': [SKIP], + 'built-ins/DataView/prototype/setBigInt64/*': [SKIP], + 'built-ins/DataView/prototype/setBigUint64/*': [SKIP], + 'built-ins/TypedArrays/BigInt64Array/*': [SKIP], + 'built-ins/TypedArrays/BigUint64Array/*': [SKIP], + + # https://bugs.chromium.org/p/v8/issues/detail?id=7184 + 'annexB/language/expressions/yield/star-iterable-return-emulates-undefined-throws-when-called': [FAIL], + 'annexB/language/statements/for-await-of/iterator-close-return-emulates-undefined-throws-when-called': [FAIL], + 'annexB/language/statements/for-of/iterator-close-return-emulates-undefined-throws-when-called': [FAIL], + + # https://bugs.chromium.org/p/v8/issues/detail?id=7186 + 'language/statements/class/fields-indirect-eval-err-contains-arguments': [FAIL], + 'language/expressions/class/fields-indirect-eval-err-contains-arguments': [FAIL], + ######################## NEEDS INVESTIGATION ########################### @@ -446,7 +463,6 @@ 'intl402/DateTimeFormat/prototype/resolvedOptions/hourCycle': [FAIL], 'intl402/DateTimeFormat/12.1.2': [PASS, FAIL], 'intl402/DateTimeFormat/12.2.3_b': [FAIL], - 'intl402/Intl/getCanonicalLocales/success_cases': [FAIL], 'intl402/Number/prototype/toLocaleString/13.2.1_5': [PASS, FAIL], 'intl402/NumberFormat/11.1.1_20_c': [FAIL], 'intl402/NumberFormat/11.1.2': [PASS, FAIL], @@ -514,6 +530,11 @@ 'harness/detachArrayBuffer': [SKIP], 'harness/detachArrayBuffer-host-detachArrayBuffer': [SKIP], + # https://github.com/tc39/test262/pull/1371 + 'language/expressions/bitwise-and/bigint-non-primitive': ['--harmony-bigint'], + 'language/expressions/bitwise-or/bigint-non-primitive': ['--harmony-bigint'], + 'language/expressions/bitwise-xor/bigint-non-primitive': ['--harmony-bigint'], + ############################ SKIPPED TESTS ############################# # These tests take a looong time to run. diff --git a/deps/v8/test/test262/testcfg.py b/deps/v8/test/test262/testcfg.py index 358d0db459..2f23fb67fb 100644 --- a/deps/v8/test/test262/testcfg.py +++ b/deps/v8/test/test262/testcfg.py @@ -33,21 +33,25 @@ import re import sys import tarfile - from testrunner.local import statusfile from testrunner.local import testsuite from testrunner.local import utils from testrunner.objects import testcase +from testrunner.outproc import base as outproc +from testrunner.outproc import test262 + # TODO(littledan): move the flag mapping into the status file FEATURE_FLAGS = { - 'async-iteration': '--harmony-async-iteration', + 'BigInt': '--harmony-bigint', 'regexp-named-groups': '--harmony-regexp-named-captures', 'regexp-unicode-property-escapes': '--harmony-regexp-property', 'Promise.prototype.finally': '--harmony-promise-finally', + 'class-fields-public': '--harmony-class-fields', + 'optional-catch-binding': '--harmony-optional-catch-binding', } -SKIPPED_FEATURES = set(['BigInt', 'class-fields', 'optional-catch-binding']) +SKIPPED_FEATURES = set(['class-fields-private']) DATA = os.path.join(os.path.dirname(os.path.abspath(__file__)), "data") ARCHIVE = DATA + ".tar" @@ -71,64 +75,88 @@ ALL_VARIANT_FLAGS_STRICT = dict( for v, flag_sets in testsuite.ALL_VARIANT_FLAGS.iteritems() ) -FAST_VARIANT_FLAGS_STRICT = dict( - (v, [flags + ["--use-strict"] for flags in flag_sets]) - for v, flag_sets in testsuite.FAST_VARIANT_FLAGS.iteritems() -) - ALL_VARIANT_FLAGS_BOTH = dict( (v, [flags for flags in testsuite.ALL_VARIANT_FLAGS[v] + ALL_VARIANT_FLAGS_STRICT[v]]) for v in testsuite.ALL_VARIANT_FLAGS ) -FAST_VARIANT_FLAGS_BOTH = dict( - (v, [flags for flags in testsuite.FAST_VARIANT_FLAGS[v] + - FAST_VARIANT_FLAGS_STRICT[v]]) - for v in testsuite.FAST_VARIANT_FLAGS -) - ALL_VARIANTS = { 'nostrict': testsuite.ALL_VARIANT_FLAGS, 'strict': ALL_VARIANT_FLAGS_STRICT, 'both': ALL_VARIANT_FLAGS_BOTH, } -FAST_VARIANTS = { - 'nostrict': testsuite.FAST_VARIANT_FLAGS, - 'strict': FAST_VARIANT_FLAGS_STRICT, - 'both': FAST_VARIANT_FLAGS_BOTH, -} - -class Test262VariantGenerator(testsuite.VariantGenerator): - def GetFlagSets(self, testcase, variant): - outcomes = testcase.suite.GetStatusFileOutcomes(testcase) - if outcomes and statusfile.OnlyFastVariants(outcomes): - variant_flags = FAST_VARIANTS - else: - variant_flags = ALL_VARIANTS - - test_record = self.suite.GetTestRecord(testcase) +class LegacyVariantsGenerator(testsuite.LegacyVariantsGenerator): + def GetFlagSets(self, test, variant): + test_record = test.test_record if "noStrict" in test_record: - return variant_flags["nostrict"][variant] + return ALL_VARIANTS["nostrict"][variant] if "onlyStrict" in test_record: - return variant_flags["strict"][variant] - return variant_flags["both"][variant] - - -class Test262TestSuite(testsuite.TestSuite): + return ALL_VARIANTS["strict"][variant] + return ALL_VARIANTS["both"][variant] + + +class VariantsGenerator(testsuite.VariantsGenerator): + def gen(self, test): + flags_set = self._get_flags_set(test) + test_record = test.test_record + for n, variant in enumerate(self._get_variants(test)): + flags = flags_set[variant][0] + if 'noStrict' in test_record: + yield (variant, flags, str(n)) + elif 'onlyStrict' in test_record: + yield (variant, flags + ['--use-strict'], 'strict-%d' % n) + else: + yield (variant, flags, str(n)) + yield (variant, flags + ['--use-strict'], 'strict-%d' % n) + + +class TestSuite(testsuite.TestSuite): # Match the (...) in '/path/to/v8/test/test262/subdir/test/(...).js' # In practice, subdir is data or local-tests def __init__(self, name, root): - super(Test262TestSuite, self).__init__(name, root) + super(TestSuite, self).__init__(name, root) self.testroot = os.path.join(self.root, *TEST_262_SUITE_PATH) self.harnesspath = os.path.join(self.root, *TEST_262_HARNESS_PATH) self.harness = [os.path.join(self.harnesspath, f) for f in TEST_262_HARNESS_FILES] self.harness += [os.path.join(self.root, "harness-adapt.js")] self.localtestroot = os.path.join(self.root, *TEST_262_LOCAL_TESTS_PATH) - self.ParseTestRecord = None + + self._extract_sources() + self.parse_test_record = self._load_parse_test_record() + + def _extract_sources(self): + # The archive is created only on swarming. Local checkouts have the + # data folder. + if (os.path.exists(ARCHIVE) and + # Check for a JS file from the archive if we need to unpack. Some other + # files from the archive unfortunately exist due to a bug in the + # isolate_processor. + # TODO(machenbach): Migrate this to GN to avoid using the faulty + # isolate_processor: http://crbug.com/669910 + not os.path.exists(os.path.join(DATA, 'test', 'harness', 'error.js'))): + print "Extracting archive..." + tar = tarfile.open(ARCHIVE) + tar.extractall(path=os.path.dirname(ARCHIVE)) + tar.close() + + def _load_parse_test_record(self): + root = os.path.join(self.root, *TEST_262_TOOLS_PATH) + f = None + try: + (f, pathname, description) = imp.find_module("parseTestRecord", [root]) + module = imp.load_module("parseTestRecord", f, pathname, description) + return module.parseTestRecord + except: + print ('Cannot load parseTestRecord; ' + 'you may need to gclient sync for test262') + raise + finally: + if f: + f.close() def ListTests(self, context): testnames = set() @@ -148,122 +176,79 @@ class Test262TestSuite(testsuite.TestSuite): fullpath = os.path.join(dirname, filename) relpath = re.match(TEST_262_RELPATH_REGEXP, fullpath).group(1) testnames.add(relpath.replace(os.path.sep, "/")) - cases = [testcase.TestCase(self, testname) for testname in testnames] + cases = map(self._create_test, testnames) return [case for case in cases if len( SKIPPED_FEATURES.intersection( - self.GetTestRecord(case).get("features", []))) == 0] - - def GetParametersForTestCase(self, testcase, context): - files = ( - list(self.harness) + - ([os.path.join(self.root, "harness-agent.js")] - if testcase.path.startswith('built-ins/Atomics') else []) + - self.GetIncludesForTest(testcase) + - (["--module"] if "module" in self.GetTestRecord(testcase) else []) + - [self.GetPathForTest(testcase)] + case.test_record.get("features", []))) == 0] + + def _test_class(self): + return TestCase + + def _LegacyVariantsGeneratorFactory(self): + return LegacyVariantsGenerator + + def _variants_gen_class(self): + return VariantsGenerator + + +class TestCase(testcase.TestCase): + def __init__(self, *args, **kwargs): + super(TestCase, self).__init__(*args, **kwargs) + + source = self.get_source() + self.test_record = self.suite.parse_test_record(source, self.path) + self._expected_exception = ( + self.test_record + .get('negative', {}) + .get('type', None) ) - flags = ( - testcase.flags + context.mode_flags + - (["--throws"] if "negative" in self.GetTestRecord(testcase) - else []) + + + def _get_files_params(self, ctx): + return ( + list(self.suite.harness) + + ([os.path.join(self.suite.root, "harness-agent.js")] + if self.path.startswith('built-ins/Atomics') else []) + + self._get_includes() + + (["--module"] if "module" in self.test_record else []) + + [self._get_source_path()] + ) + + def _get_suite_flags(self, ctx): + return ( + (["--throws"] if "negative" in self.test_record else []) + (["--allow-natives-syntax"] - if "detachArrayBuffer.js" in - self.GetTestRecord(testcase).get("includes", []) + if "detachArrayBuffer.js" in self.test_record.get("includes", []) else []) + - ([flag for (feature, flag) in FEATURE_FLAGS.items() - if feature in self.GetTestRecord(testcase).get("features", [])]) + [flag for (feature, flag) in FEATURE_FLAGS.items() + if feature in self.test_record.get("features", [])] ) - return files, flags, {} - - def _VariantGeneratorFactory(self): - return Test262VariantGenerator - - def LoadParseTestRecord(self): - if not self.ParseTestRecord: - root = os.path.join(self.root, *TEST_262_TOOLS_PATH) - f = None - try: - (f, pathname, description) = imp.find_module("parseTestRecord", [root]) - module = imp.load_module("parseTestRecord", f, pathname, description) - self.ParseTestRecord = module.parseTestRecord - except: - raise ImportError("Cannot load parseTestRecord; you may need to " - "gclient sync for test262") - finally: - if f: - f.close() - return self.ParseTestRecord - - def GetTestRecord(self, testcase): - if not hasattr(testcase, "test_record"): - ParseTestRecord = self.LoadParseTestRecord() - testcase.test_record = ParseTestRecord(self.GetSourceForTest(testcase), - testcase.path) - return testcase.test_record - - def BasePath(self, filename): - return self.root if filename in TEST_262_NATIVE_FILES else self.harnesspath - - def GetIncludesForTest(self, testcase): - test_record = self.GetTestRecord(testcase) - return [os.path.join(self.BasePath(filename), filename) - for filename in test_record.get("includes", [])] - - def GetPathForTest(self, testcase): - filename = os.path.join(self.localtestroot, testcase.path + ".js") - if not os.path.exists(filename): - filename = os.path.join(self.testroot, testcase.path + ".js") - return filename - - def GetSourceForTest(self, testcase): - with open(self.GetPathForTest(testcase)) as f: - return f.read() - - def _ParseException(self, str, testcase): - # somefile:somelinenumber: someerror[: sometext] - # somefile might include an optional drive letter on windows e.g. "e:". - match = re.search( - '^(?:\w:)?[^:]*:[0-9]+: ([^: ]+?)($|: )', str, re.MULTILINE) - if match: - return match.group(1).strip() + + def _get_includes(self): + return [os.path.join(self._base_path(filename), filename) + for filename in self.test_record.get("includes", [])] + + def _base_path(self, filename): + if filename in TEST_262_NATIVE_FILES: + return self.suite.root else: - print "Error parsing exception for %s" % testcase.GetLabel() - return None - - def IsFailureOutput(self, testcase): - output = testcase.output - test_record = self.GetTestRecord(testcase) - if output.exit_code != 0: - return True - if ("negative" in test_record and - "type" in test_record["negative"] and - self._ParseException(output.stdout, testcase) != - test_record["negative"]["type"]): - return True - return "FAILED!" in output.stdout - - def GetExpectedOutcomes(self, testcase): - outcomes = self.GetStatusFileOutcomes(testcase) - if (statusfile.FAIL_SLOPPY in outcomes and - '--use-strict' not in testcase.flags): - return [statusfile.FAIL] - return super(Test262TestSuite, self).GetExpectedOutcomes(testcase) - - def PrepareSources(self): - # The archive is created only on swarming. Local checkouts have the - # data folder. - if (os.path.exists(ARCHIVE) and - # Check for a JS file from the archive if we need to unpack. Some other - # files from the archive unfortunately exist due to a bug in the - # isolate_processor. - # TODO(machenbach): Migrate this to GN to avoid using the faulty - # isolate_processor: http://crbug.com/669910 - not os.path.exists(os.path.join(DATA, 'test', 'harness', 'error.js'))): - print "Extracting archive..." - tar = tarfile.open(ARCHIVE) - tar.extractall(path=os.path.dirname(ARCHIVE)) - tar.close() + return self.suite.harnesspath + + def _get_source_path(self): + filename = self.path + self._get_suffix() + path = os.path.join(self.suite.localtestroot, filename) + if os.path.exists(path): + return path + return os.path.join(self.suite.testroot, filename) + + @property + def output_proc(self): + if self._expected_exception is not None: + return test262.ExceptionOutProc(self.expected_outcomes, + self._expected_exception) + if self.expected_outcomes == outproc.OUTCOMES_PASS: + return test262.PASS_NO_EXCEPTION + return test262.NoExceptionOutProc(self.expected_outcomes) def GetSuite(name, root): - return Test262TestSuite(name, root) + return TestSuite(name, root) diff --git a/deps/v8/test/unittests/BUILD.gn b/deps/v8/test/unittests/BUILD.gn index d6d0a1067f..7f70a5c959 100644 --- a/deps/v8/test/unittests/BUILD.gn +++ b/deps/v8/test/unittests/BUILD.gn @@ -35,6 +35,7 @@ v8_source_set("unittests_sources") { "../../test/common/wasm/wasm-macro-gen.h", "../../testing/gmock-support.h", "../../testing/gtest-support.h", + "allocation-unittest.cc", "api/access-check-unittest.cc", "api/exception-unittest.cc", "api/interceptor-unittest.cc", @@ -121,6 +122,7 @@ v8_source_set("unittests_sources") { "compiler/schedule-unittest.cc", "compiler/scheduler-rpo-unittest.cc", "compiler/scheduler-unittest.cc", + "compiler/simplified-lowering-unittest.cc", "compiler/simplified-operator-reducer-unittest.cc", "compiler/simplified-operator-unittest.cc", "compiler/state-values-utils-unittest.cc", @@ -186,7 +188,7 @@ v8_source_set("unittests_sources") { "wasm/module-decoder-unittest.cc", "wasm/streaming-decoder-unittest.cc", "wasm/trap-handler-unittest.cc", - "wasm/wasm-heap-unittest.cc", + "wasm/wasm-code-manager-unittest.cc", "wasm/wasm-macro-gen-unittest.cc", "wasm/wasm-module-builder-unittest.cc", "wasm/wasm-opcodes-unittest.cc", diff --git a/deps/v8/test/unittests/allocation-unittest.cc b/deps/v8/test/unittests/allocation-unittest.cc new file mode 100644 index 0000000000..42904da149 --- /dev/null +++ b/deps/v8/test/unittests/allocation-unittest.cc @@ -0,0 +1,164 @@ +// Copyright 2017 the V8 project authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "src/allocation.h" + +#if V8_OS_POSIX +#include <setjmp.h> +#include <signal.h> +#include <unistd.h> // NOLINT +#endif // V8_OS_POSIX + +#include "testing/gtest/include/gtest/gtest.h" + +namespace v8 { +namespace internal { + +// TODO(eholk): Add a windows version of permissions tests. +#if V8_OS_POSIX +namespace { + +// These tests make sure the routines to allocate memory do so with the correct +// permissions. +// +// Unfortunately, there is no API to find the protection of a memory address, +// so instead we test permissions by installing a signal handler, probing a +// memory location and recovering from the fault. +// +// We don't test the execution permission because to do so we'd have to +// dynamically generate code and test if we can execute it. + +class MemoryAllocationPermissionsTest : public ::testing::Test { + static void SignalHandler(int signal, siginfo_t* info, void*) { + siglongjmp(continuation_, 1); + } + struct sigaction old_action_; +// On Mac, sometimes we get SIGBUS instead of SIGSEGV. +#if V8_OS_MACOSX + struct sigaction old_bus_action_; +#endif + + protected: + virtual void SetUp() { + struct sigaction action; + action.sa_sigaction = SignalHandler; + sigemptyset(&action.sa_mask); + action.sa_flags = SA_SIGINFO; + sigaction(SIGSEGV, &action, &old_action_); +#if V8_OS_MACOSX + sigaction(SIGBUS, &action, &old_bus_action_); +#endif + } + + virtual void TearDown() { + // Be a good citizen and restore the old signal handler. + sigaction(SIGSEGV, &old_action_, nullptr); +#if V8_OS_MACOSX + sigaction(SIGBUS, &old_bus_action_, nullptr); +#endif + } + + public: + static sigjmp_buf continuation_; + + enum class MemoryAction { kRead, kWrite }; + + void ProbeMemory(volatile int* buffer, MemoryAction action, + bool should_succeed) { + const int save_sigs = 1; + if (!sigsetjmp(continuation_, save_sigs)) { + switch (action) { + case MemoryAction::kRead: { + // static_cast to remove the reference and force a memory read. + USE(static_cast<int>(*buffer)); + break; + } + case MemoryAction::kWrite: { + *buffer = 0; + break; + } + } + if (should_succeed) { + SUCCEED(); + } else { + FAIL(); + } + return; + } + if (should_succeed) { + FAIL(); + } else { + SUCCEED(); + } + } + + 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)); + ProbeMemory(buffer, MemoryAction::kRead, can_read); + ProbeMemory(buffer, MemoryAction::kWrite, can_write); + CHECK(FreePages(buffer, page_size)); + } +}; + +sigjmp_buf MemoryAllocationPermissionsTest::continuation_; + +} // namespace + +TEST_F(MemoryAllocationPermissionsTest, DoTest) { + TestPermissions(PageAllocator::Permission::kNoAccess, false, false); + TestPermissions(PageAllocator::Permission::kReadWrite, true, true); + TestPermissions(PageAllocator::Permission::kReadWriteExecute, true, true); +} +#endif // V8_OS_POSIX + +// Basic tests of allocation. + +class AllocationTest : public ::testing::Test {}; + +TEST(AllocationTest, AllocateAndFree) { + size_t page_size = v8::internal::AllocatePageSize(); + CHECK_NE(0, page_size); + + // 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); + CHECK_NOT_NULL(mem_addr); + CHECK(v8::internal::FreePages(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( + v8::internal::GetRandomMmapAddr(), 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)); +} + +TEST(AllocationTest, ReserveMemory) { + 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); + 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, + 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, + PageAllocator::Permission::kNoAccess)); + CHECK(v8::internal::FreePages(mem_addr, kAllocationSize)); +} + +} // namespace internal +} // namespace v8 diff --git a/deps/v8/test/unittests/api/access-check-unittest.cc b/deps/v8/test/unittests/api/access-check-unittest.cc index 05913de62a..8bfb507a7c 100644 --- a/deps/v8/test/unittests/api/access-check-unittest.cc +++ b/deps/v8/test/unittests/api/access-check-unittest.cc @@ -37,15 +37,10 @@ TEST_F(AccessCheckTest, GetOwnPropertyDescriptor) { global_template->SetAccessCheckCallback(AccessCheck); Local<FunctionTemplate> getter_template = FunctionTemplate::New( - isolate(), [](const FunctionCallbackInfo<Value>& info) { - FAIL() << "This should never be called."; - info.GetReturnValue().Set(42); - }); + isolate(), [](const FunctionCallbackInfo<Value>& info) { FAIL(); }); getter_template->SetAcceptAnyReceiver(false); Local<FunctionTemplate> setter_template = FunctionTemplate::New( - isolate(), [](const FunctionCallbackInfo<v8::Value>& info) { - FAIL() << "This should never be called."; - }); + isolate(), [](const FunctionCallbackInfo<v8::Value>& info) { FAIL(); }); setter_template->SetAcceptAnyReceiver(false); global_template->SetAccessorProperty( String::NewFromUtf8(isolate(), "property", NewStringType::kNormal) diff --git a/deps/v8/test/unittests/asmjs/asm-scanner-unittest.cc b/deps/v8/test/unittests/asmjs/asm-scanner-unittest.cc index ebfcc665f8..fe061f8e2a 100644 --- a/deps/v8/test/unittests/asmjs/asm-scanner-unittest.cc +++ b/deps/v8/test/unittests/asmjs/asm-scanner-unittest.cc @@ -190,7 +190,7 @@ TEST_F(AsmJsScannerTest, LocalScope) { } TEST_F(AsmJsScannerTest, Numbers) { - SetupScanner("1 1.2 0x1f 1.e3"); + SetupScanner("1 1.2 0x1F 1.e3"); CHECK(scanner->IsUnsigned()); CHECK_EQ(1, scanner->AsUnsigned()); @@ -212,10 +212,10 @@ TEST_F(AsmJsScannerTest, Numbers) { } TEST_F(AsmJsScannerTest, UnsignedNumbers) { - SetupScanner("0x7fffffff 0x80000000 0xffffffff 0x100000000"); + SetupScanner("0x7FFFFFFF 0x80000000 0xFFFFFFFF 0x100000000"); CHECK(scanner->IsUnsigned()); - CHECK_EQ(0x7fffffff, scanner->AsUnsigned()); + CHECK_EQ(0x7FFFFFFF, scanner->AsUnsigned()); scanner->Next(); CHECK(scanner->IsUnsigned()); @@ -223,7 +223,7 @@ TEST_F(AsmJsScannerTest, UnsignedNumbers) { scanner->Next(); CHECK(scanner->IsUnsigned()); - CHECK_EQ(0xffffffff, scanner->AsUnsigned()); + CHECK_EQ(0xFFFFFFFF, scanner->AsUnsigned()); scanner->Next(); // Numeric "unsigned" literals with a payload of more than 32-bit are rejected diff --git a/deps/v8/test/unittests/base/bits-unittest.cc b/deps/v8/test/unittests/base/bits-unittest.cc index 485dddf529..6f787eb727 100644 --- a/deps/v8/test/unittests/base/bits-unittest.cc +++ b/deps/v8/test/unittests/base/bits-unittest.cc @@ -22,18 +22,18 @@ TEST(Bits, CountPopulation16) { EXPECT_EQ(0u, CountPopulation(uint16_t{0})); EXPECT_EQ(1u, CountPopulation(uint16_t{1})); EXPECT_EQ(4u, CountPopulation(uint16_t{0x1111})); - EXPECT_EQ(8u, CountPopulation(uint16_t{0xf0f0})); - EXPECT_EQ(12u, CountPopulation(uint16_t{0xf0ff})); - EXPECT_EQ(16u, CountPopulation(uint16_t{0xffff})); + EXPECT_EQ(8u, CountPopulation(uint16_t{0xF0F0})); + EXPECT_EQ(12u, CountPopulation(uint16_t{0xF0FF})); + EXPECT_EQ(16u, CountPopulation(uint16_t{0xFFFF})); } TEST(Bits, CountPopulation32) { EXPECT_EQ(0u, CountPopulation(uint32_t{0})); EXPECT_EQ(1u, CountPopulation(uint32_t{1})); EXPECT_EQ(8u, CountPopulation(uint32_t{0x11111111})); - EXPECT_EQ(16u, CountPopulation(uint32_t{0xf0f0f0f0})); - EXPECT_EQ(24u, CountPopulation(uint32_t{0xfff0f0ff})); - EXPECT_EQ(32u, CountPopulation(uint32_t{0xffffffff})); + EXPECT_EQ(16u, CountPopulation(uint32_t{0xF0F0F0F0})); + EXPECT_EQ(24u, CountPopulation(uint32_t{0xFFF0F0FF})); + EXPECT_EQ(32u, CountPopulation(uint32_t{0xFFFFFFFF})); } TEST(Bits, CountPopulation64) { @@ -41,13 +41,13 @@ TEST(Bits, CountPopulation64) { EXPECT_EQ(1u, CountPopulation(uint64_t{1})); EXPECT_EQ(2u, CountPopulation(uint64_t{0x8000000000000001})); EXPECT_EQ(8u, CountPopulation(uint64_t{0x11111111})); - EXPECT_EQ(16u, CountPopulation(uint64_t{0xf0f0f0f0})); - EXPECT_EQ(24u, CountPopulation(uint64_t{0xfff0f0ff})); - EXPECT_EQ(32u, CountPopulation(uint64_t{0xffffffff})); + EXPECT_EQ(16u, CountPopulation(uint64_t{0xF0F0F0F0})); + EXPECT_EQ(24u, CountPopulation(uint64_t{0xFFF0F0FF})); + EXPECT_EQ(32u, CountPopulation(uint64_t{0xFFFFFFFF})); EXPECT_EQ(16u, CountPopulation(uint64_t{0x1111111111111111})); - EXPECT_EQ(32u, CountPopulation(uint64_t{0xf0f0f0f0f0f0f0f0})); - EXPECT_EQ(48u, CountPopulation(uint64_t{0xfff0f0fffff0f0ff})); - EXPECT_EQ(64u, CountPopulation(uint64_t{0xffffffffffffffff})); + EXPECT_EQ(32u, CountPopulation(uint64_t{0xF0F0F0F0F0F0F0F0})); + EXPECT_EQ(48u, CountPopulation(uint64_t{0xFFF0F0FFFFF0F0FF})); + EXPECT_EQ(64u, CountPopulation(uint64_t{0xFFFFFFFFFFFFFFFF})); } TEST(Bits, CountLeadingZeros16) { @@ -57,7 +57,7 @@ TEST(Bits, CountLeadingZeros16) { EXPECT_EQ(15u - shift, CountLeadingZeros(static_cast<uint16_t>(1 << shift))); } - EXPECT_EQ(4u, CountLeadingZeros(uint16_t{0x0f0f})); + EXPECT_EQ(4u, CountLeadingZeros(uint16_t{0x0F0F})); } TEST(Bits, CountLeadingZeros32) { @@ -66,7 +66,7 @@ TEST(Bits, CountLeadingZeros32) { TRACED_FORRANGE(uint32_t, shift, 0, 31) { EXPECT_EQ(31u - shift, CountLeadingZeros(uint32_t{1} << shift)); } - EXPECT_EQ(4u, CountLeadingZeros(uint32_t{0x0f0f0f0f})); + EXPECT_EQ(4u, CountLeadingZeros(uint32_t{0x0F0F0F0F})); } TEST(Bits, CountLeadingZeros64) { @@ -75,8 +75,8 @@ TEST(Bits, CountLeadingZeros64) { TRACED_FORRANGE(uint32_t, shift, 0, 63) { EXPECT_EQ(63u - shift, CountLeadingZeros(uint64_t{1} << shift)); } - EXPECT_EQ(36u, CountLeadingZeros(uint64_t{0x0f0f0f0f})); - EXPECT_EQ(4u, CountLeadingZeros(uint64_t{0x0f0f0f0f00000000})); + EXPECT_EQ(36u, CountLeadingZeros(uint64_t{0x0F0F0F0F})); + EXPECT_EQ(4u, CountLeadingZeros(uint64_t{0x0F0F0F0F00000000})); } TEST(Bits, CountTrailingZeros16) { @@ -85,7 +85,7 @@ TEST(Bits, CountTrailingZeros16) { TRACED_FORRANGE(uint16_t, shift, 0, 15) { EXPECT_EQ(shift, CountTrailingZeros(static_cast<uint16_t>(1 << shift))); } - EXPECT_EQ(4u, CountTrailingZeros(uint16_t{0xf0f0u})); + EXPECT_EQ(4u, CountTrailingZeros(uint16_t{0xF0F0u})); } TEST(Bits, CountTrailingZerosu32) { @@ -94,7 +94,7 @@ TEST(Bits, CountTrailingZerosu32) { TRACED_FORRANGE(uint32_t, shift, 0, 31) { EXPECT_EQ(shift, CountTrailingZeros(uint32_t{1} << shift)); } - EXPECT_EQ(4u, CountTrailingZeros(uint32_t{0xf0f0f0f0u})); + EXPECT_EQ(4u, CountTrailingZeros(uint32_t{0xF0F0F0F0u})); } TEST(Bits, CountTrailingZerosi32) { @@ -102,7 +102,7 @@ TEST(Bits, CountTrailingZerosi32) { TRACED_FORRANGE(uint32_t, shift, 0, 31) { EXPECT_EQ(shift, CountTrailingZeros(int32_t{1} << shift)); } - EXPECT_EQ(4u, CountTrailingZeros(int32_t{0x70f0f0f0u})); + EXPECT_EQ(4u, CountTrailingZeros(int32_t{0x70F0F0F0u})); EXPECT_EQ(2u, CountTrailingZeros(int32_t{-4})); EXPECT_EQ(0u, CountTrailingZeros(int32_t{-1})); } @@ -113,8 +113,8 @@ TEST(Bits, CountTrailingZeros64) { TRACED_FORRANGE(uint32_t, shift, 0, 63) { EXPECT_EQ(shift, CountTrailingZeros(uint64_t{1} << shift)); } - EXPECT_EQ(4u, CountTrailingZeros(uint64_t{0xf0f0f0f0})); - EXPECT_EQ(36u, CountTrailingZeros(uint64_t{0xf0f0f0f000000000})); + EXPECT_EQ(4u, CountTrailingZeros(uint64_t{0xF0F0F0F0})); + EXPECT_EQ(36u, CountTrailingZeros(uint64_t{0xF0F0F0F000000000})); } @@ -128,21 +128,21 @@ TEST(Bits, IsPowerOfTwo32) { TRACED_FORRANGE(uint32_t, shift, 2, 31) { EXPECT_FALSE(IsPowerOfTwo((1U << shift) - 1U)); } - EXPECT_FALSE(IsPowerOfTwo(0xffffffff)); + EXPECT_FALSE(IsPowerOfTwo(0xFFFFFFFF)); } TEST(Bits, IsPowerOfTwo64) { - EXPECT_FALSE(IsPowerOfTwo(V8_UINT64_C(0))); + EXPECT_FALSE(IsPowerOfTwo(uint64_t{0})); TRACED_FORRANGE(uint32_t, shift, 0, 63) { - EXPECT_TRUE(IsPowerOfTwo(V8_UINT64_C(1) << shift)); - EXPECT_FALSE(IsPowerOfTwo((V8_UINT64_C(1) << shift) + 5U)); - EXPECT_FALSE(IsPowerOfTwo(~(V8_UINT64_C(1) << shift))); + EXPECT_TRUE(IsPowerOfTwo(uint64_t{1} << shift)); + EXPECT_FALSE(IsPowerOfTwo((uint64_t{1} << shift) + 5U)); + EXPECT_FALSE(IsPowerOfTwo(~(uint64_t{1} << shift))); } TRACED_FORRANGE(uint32_t, shift, 2, 63) { - EXPECT_FALSE(IsPowerOfTwo((V8_UINT64_C(1) << shift) - 1U)); + EXPECT_FALSE(IsPowerOfTwo((uint64_t{1} << shift) - 1U)); } - EXPECT_FALSE(IsPowerOfTwo(V8_UINT64_C(0xffffffffffffffff))); + EXPECT_FALSE(IsPowerOfTwo(uint64_t{0xFFFFFFFFFFFFFFFF})); } @@ -153,7 +153,7 @@ TEST(Bits, RoundUpToPowerOfTwo32) { EXPECT_EQ(1u, RoundUpToPowerOfTwo32(0)); EXPECT_EQ(1u, RoundUpToPowerOfTwo32(1)); EXPECT_EQ(4u, RoundUpToPowerOfTwo32(3)); - EXPECT_EQ(0x80000000u, RoundUpToPowerOfTwo32(0x7fffffffu)); + EXPECT_EQ(0x80000000u, RoundUpToPowerOfTwo32(0x7FFFFFFFu)); } @@ -206,7 +206,7 @@ TEST(Bits, RotateRight64) { } EXPECT_EQ(1u, RotateRight64(1, 0)); EXPECT_EQ(1u, RotateRight64(2, 1)); - EXPECT_EQ(V8_UINT64_C(0x8000000000000000), RotateRight64(1, 1)); + EXPECT_EQ(uint64_t{0x8000000000000000}, RotateRight64(1, 1)); } diff --git a/deps/v8/test/unittests/base/logging-unittest.cc b/deps/v8/test/unittests/base/logging-unittest.cc index fd334ec49d..a0686a2f64 100644 --- a/deps/v8/test/unittests/base/logging-unittest.cc +++ b/deps/v8/test/unittests/base/logging-unittest.cc @@ -32,30 +32,34 @@ namespace { } // namespace TEST(LoggingTest, CheckEQImpl) { - CHECK_SUCCEED(EQ, 0.0, 0.0) - CHECK_SUCCEED(EQ, 0.0, -0.0) - CHECK_SUCCEED(EQ, -0.0, 0.0) - CHECK_SUCCEED(EQ, -0.0, -0.0) + CHECK_SUCCEED(EQ, 0.0, 0.0); + CHECK_SUCCEED(EQ, 0.0, -0.0); + CHECK_SUCCEED(EQ, -0.0, 0.0); + CHECK_SUCCEED(EQ, -0.0, -0.0); } TEST(LoggingTest, CompareSignedMismatch) { - CHECK_SUCCEED(EQ, static_cast<int32_t>(14), static_cast<uint32_t>(14)) - CHECK_FAIL(EQ, static_cast<int32_t>(14), static_cast<uint32_t>(15)) - CHECK_FAIL(EQ, static_cast<int32_t>(-1), static_cast<uint32_t>(-1)) - CHECK_SUCCEED(LT, static_cast<int32_t>(-1), static_cast<uint32_t>(0)) - CHECK_SUCCEED(LT, static_cast<int32_t>(-1), static_cast<uint32_t>(-1)) - CHECK_SUCCEED(LE, static_cast<int32_t>(-1), static_cast<uint32_t>(0)) - CHECK_SUCCEED(LE, static_cast<int32_t>(55), static_cast<uint32_t>(55)) - CHECK_SUCCEED(LT, static_cast<int32_t>(55), static_cast<uint32_t>(0x7fffff00)) - CHECK_SUCCEED(LE, static_cast<int32_t>(55), static_cast<uint32_t>(0x7fffff00)) - CHECK_SUCCEED(GE, static_cast<uint32_t>(0x7fffff00), static_cast<int32_t>(55)) - CHECK_SUCCEED(GT, static_cast<uint32_t>(0x7fffff00), static_cast<int32_t>(55)) - CHECK_SUCCEED(GT, static_cast<uint32_t>(-1), static_cast<int32_t>(-1)) - CHECK_SUCCEED(GE, static_cast<uint32_t>(0), static_cast<int32_t>(-1)) - CHECK_SUCCEED(LT, static_cast<int8_t>(-1), static_cast<uint32_t>(0)) - CHECK_SUCCEED(GT, static_cast<uint64_t>(0x7f01010101010101), 0) - CHECK_SUCCEED(LE, static_cast<int64_t>(0xff01010101010101), - static_cast<uint8_t>(13)) + CHECK_SUCCEED(EQ, static_cast<int32_t>(14), static_cast<uint32_t>(14)); + CHECK_FAIL(EQ, static_cast<int32_t>(14), static_cast<uint32_t>(15)); + CHECK_FAIL(EQ, static_cast<int32_t>(-1), static_cast<uint32_t>(-1)); + CHECK_SUCCEED(LT, static_cast<int32_t>(-1), static_cast<uint32_t>(0)); + CHECK_SUCCEED(LT, static_cast<int32_t>(-1), static_cast<uint32_t>(-1)); + CHECK_SUCCEED(LE, static_cast<int32_t>(-1), static_cast<uint32_t>(0)); + CHECK_SUCCEED(LE, static_cast<int32_t>(55), static_cast<uint32_t>(55)); + CHECK_SUCCEED(LT, static_cast<int32_t>(55), + static_cast<uint32_t>(0x7FFFFF00)); + CHECK_SUCCEED(LE, static_cast<int32_t>(55), + static_cast<uint32_t>(0x7FFFFF00)); + CHECK_SUCCEED(GE, static_cast<uint32_t>(0x7FFFFF00), + static_cast<int32_t>(55)); + CHECK_SUCCEED(GT, static_cast<uint32_t>(0x7FFFFF00), + static_cast<int32_t>(55)); + CHECK_SUCCEED(GT, static_cast<uint32_t>(-1), static_cast<int32_t>(-1)); + CHECK_SUCCEED(GE, static_cast<uint32_t>(0), static_cast<int32_t>(-1)); + CHECK_SUCCEED(LT, static_cast<int8_t>(-1), static_cast<uint32_t>(0)); + CHECK_SUCCEED(GT, static_cast<uint64_t>(0x7F01010101010101), 0); + CHECK_SUCCEED(LE, static_cast<int64_t>(0xFF01010101010101), + static_cast<uint8_t>(13)); } TEST(LoggingTest, CompareAgainstStaticConstPointer) { diff --git a/deps/v8/test/unittests/base/ostreams-unittest.cc b/deps/v8/test/unittests/base/ostreams-unittest.cc index 31744cdbda..1444eb7a5c 100644 --- a/deps/v8/test/unittests/base/ostreams-unittest.cc +++ b/deps/v8/test/unittests/base/ostreams-unittest.cc @@ -47,7 +47,7 @@ TEST(Ostream, AsHexBytes) { testAsHexBytes("23 01", AsHexBytes(0x123, 1)); testAsHexBytes("23 01", AsHexBytes(0x123, 2)); testAsHexBytes("23 01 00", AsHexBytes(0x123, 3)); - testAsHexBytes("ff ff ff ff", AsHexBytes(0xffffffff)); + testAsHexBytes("ff ff ff ff", AsHexBytes(0xFFFFFFFF)); testAsHexBytes("00 00 00 00", AsHexBytes(0, 4)); testAsHexBytes("56 34 12", AsHexBytes(0x123456)); @@ -58,7 +58,7 @@ TEST(Ostream, AsHexBytes) { testAsHexBytes("01 23", AsHexBytes(0x123, 1, AsHexBytes::kBigEndian)); testAsHexBytes("01 23", AsHexBytes(0x123, 2, AsHexBytes::kBigEndian)); testAsHexBytes("00 01 23", AsHexBytes(0x123, 3, AsHexBytes::kBigEndian)); - testAsHexBytes("ff ff ff ff", AsHexBytes(0xffffffff, AsHexBytes::kBigEndian)); + testAsHexBytes("ff ff ff ff", AsHexBytes(0xFFFFFFFF, AsHexBytes::kBigEndian)); testAsHexBytes("00 00 00 00", AsHexBytes(0, 4, AsHexBytes::kBigEndian)); testAsHexBytes("12 34 56", AsHexBytes(0x123456, 1, AsHexBytes::kBigEndian)); } diff --git a/deps/v8/test/unittests/base/platform/platform-unittest.cc b/deps/v8/test/unittests/base/platform/platform-unittest.cc index cb07ad1ca4..f9fc26a2df 100644 --- a/deps/v8/test/unittests/base/platform/platform-unittest.cc +++ b/deps/v8/test/unittests/base/platform/platform-unittest.cc @@ -4,23 +4,8 @@ #include "src/base/platform/platform.h" -#if V8_OS_POSIX -#include <setjmp.h> -#include <signal.h> -#include <unistd.h> // NOLINT -#endif - -#if V8_OS_WIN -#include "src/base/win32-headers.h" -#endif #include "testing/gtest/include/gtest/gtest.h" -#if V8_OS_ANDROID -#define DISABLE_ON_ANDROID(Name) DISABLED_##Name -#else -#define DISABLE_ON_ANDROID(Name) Name -#endif - namespace v8 { namespace base { @@ -98,106 +83,5 @@ TEST_F(ThreadLocalStorageTest, DoTest) { Join(); } -#if V8_OS_POSIX -// TODO(eholk): Add a windows version of these tests - -namespace { - -// These tests make sure the routines to allocate memory do so with the correct -// permissions. -// -// Unfortunately, there is no API to find the protection of a memory address, -// so instead we test permissions by installing a signal handler, probing a -// memory location and recovering from the fault. -// -// We don't test the execution permission because to do so we'd have to -// dynamically generate code and test if we can execute it. - -class MemoryAllocationPermissionsTest : public ::testing::Test { - static void SignalHandler(int signal, siginfo_t* info, void*) { - siglongjmp(continuation_, 1); - } - struct sigaction old_action_; -// On Mac, sometimes we get SIGBUS instead of SIGSEGV. -#if V8_OS_MACOSX - struct sigaction old_bus_action_; -#endif - - protected: - virtual void SetUp() { - struct sigaction action; - action.sa_sigaction = SignalHandler; - sigemptyset(&action.sa_mask); - action.sa_flags = SA_SIGINFO; - sigaction(SIGSEGV, &action, &old_action_); -#if V8_OS_MACOSX - sigaction(SIGBUS, &action, &old_bus_action_); -#endif - } - - virtual void TearDown() { - // be a good citizen and restore the old signal handler. - sigaction(SIGSEGV, &old_action_, nullptr); -#if V8_OS_MACOSX - sigaction(SIGBUS, &old_bus_action_, nullptr); -#endif - } - - public: - static sigjmp_buf continuation_; - - enum class MemoryAction { kRead, kWrite }; - - void ProbeMemory(volatile int* buffer, MemoryAction action, - bool should_succeed) { - const int save_sigs = 1; - if (!sigsetjmp(continuation_, save_sigs)) { - switch (action) { - case MemoryAction::kRead: { - // static_cast to remove the reference and force a memory read. - USE(static_cast<int>(*buffer)); - break; - } - case MemoryAction::kWrite: { - *buffer = 0; - break; - } - } - if (should_succeed) { - SUCCEED(); - } else { - FAIL(); - } - return; - } - if (should_succeed) { - FAIL(); - } else { - SUCCEED(); - } - } - - void TestPermissions(OS::MemoryPermission permission, bool can_read, - bool can_write) { - const size_t page_size = OS::AllocatePageSize(); - int* buffer = static_cast<int*>( - OS::Allocate(nullptr, page_size, page_size, permission)); - ProbeMemory(buffer, MemoryAction::kRead, can_read); - ProbeMemory(buffer, MemoryAction::kWrite, can_write); - CHECK(OS::Free(buffer, page_size)); - } -}; - -sigjmp_buf MemoryAllocationPermissionsTest::continuation_; - -TEST_F(MemoryAllocationPermissionsTest, DoTest) { - TestPermissions(OS::MemoryPermission::kNoAccess, false, false); - TestPermissions(OS::MemoryPermission::kReadWrite, true, true); - TestPermissions(OS::MemoryPermission::kReadWriteExecute, true, true); -} - -} // namespace -#endif // V8_OS_POSIX - } // namespace base } // namespace v8 diff --git a/deps/v8/test/unittests/bigint-unittest.cc b/deps/v8/test/unittests/bigint-unittest.cc index 252cad6a8f..6e1018c581 100644 --- a/deps/v8/test/unittests/bigint-unittest.cc +++ b/deps/v8/test/unittests/bigint-unittest.cc @@ -97,7 +97,7 @@ TEST_F(BigIntWithIsolate, CompareToDouble) { big = NewFromInt(isolate(), 0xF00D00); Compare(big, 15731968.125, ComparisonResult::kLessThan); Compare(big, 15731967.875, ComparisonResult::kGreaterThan); - big = BigIntLiteral(isolate(), "0x123456789ab").ToHandleChecked(); + big = BigIntLiteral(isolate(), "0x123456789AB").ToHandleChecked(); Compare(big, 1250999896491.125, ComparisonResult::kLessThan); // Equality! diff --git a/deps/v8/test/unittests/compiler/arm/instruction-selector-arm-unittest.cc b/deps/v8/test/unittests/compiler/arm/instruction-selector-arm-unittest.cc index 186a4397ed..ab1c57d9c5 100644 --- a/deps/v8/test/unittests/compiler/arm/instruction-selector-arm-unittest.cc +++ b/deps/v8/test/unittests/compiler/arm/instruction-selector-arm-unittest.cc @@ -2302,7 +2302,7 @@ TEST_F(InstructionSelectorTest, Int32AddWithWord32And) { MachineType::Int32()); Node* const p0 = m.Parameter(0); Node* const p1 = m.Parameter(1); - Node* const r = m.Int32Add(m.Word32And(p0, m.Int32Constant(0xff)), p1); + Node* const r = m.Int32Add(m.Word32And(p0, m.Int32Constant(0xFF)), p1); m.Return(r); Stream s = m.Build(); ASSERT_EQ(1U, s.size()); @@ -2319,7 +2319,7 @@ TEST_F(InstructionSelectorTest, Int32AddWithWord32And) { MachineType::Int32()); Node* const p0 = m.Parameter(0); Node* const p1 = m.Parameter(1); - Node* const r = m.Int32Add(p1, m.Word32And(p0, m.Int32Constant(0xff))); + Node* const r = m.Int32Add(p1, m.Word32And(p0, m.Int32Constant(0xFF))); m.Return(r); Stream s = m.Build(); ASSERT_EQ(1U, s.size()); @@ -2336,7 +2336,7 @@ TEST_F(InstructionSelectorTest, Int32AddWithWord32And) { MachineType::Int32()); Node* const p0 = m.Parameter(0); Node* const p1 = m.Parameter(1); - Node* const r = m.Int32Add(m.Word32And(p0, m.Int32Constant(0xffff)), p1); + Node* const r = m.Int32Add(m.Word32And(p0, m.Int32Constant(0xFFFF)), p1); m.Return(r); Stream s = m.Build(); ASSERT_EQ(1U, s.size()); @@ -2353,7 +2353,7 @@ TEST_F(InstructionSelectorTest, Int32AddWithWord32And) { MachineType::Int32()); Node* const p0 = m.Parameter(0); Node* const p1 = m.Parameter(1); - Node* const r = m.Int32Add(p1, m.Word32And(p0, m.Int32Constant(0xffff))); + Node* const r = m.Int32Add(p1, m.Word32And(p0, m.Int32Constant(0xFFFF))); m.Return(r); Stream s = m.Build(); ASSERT_EQ(1U, s.size()); @@ -2808,7 +2808,7 @@ TEST_F(InstructionSelectorTest, Word32AndWithUbfxImmediateForARMv7) { if (width == 16) continue; // Uxth. StreamBuilder m(this, MachineType::Int32(), MachineType::Int32()); m.Return(m.Word32And(m.Parameter(0), - m.Int32Constant(0xffffffffu >> (32 - width)))); + m.Int32Constant(0xFFFFFFFFu >> (32 - width)))); Stream s = m.Build(ARMv7); ASSERT_EQ(1U, s.size()); EXPECT_EQ(kArmUbfx, s[0]->arch_opcode()); @@ -2819,7 +2819,7 @@ TEST_F(InstructionSelectorTest, Word32AndWithUbfxImmediateForARMv7) { TRACED_FORRANGE(int32_t, width, 9, 23) { if (width == 16) continue; // Uxth. StreamBuilder m(this, MachineType::Int32(), MachineType::Int32()); - m.Return(m.Word32And(m.Int32Constant(0xffffffffu >> (32 - width)), + m.Return(m.Word32And(m.Int32Constant(0xFFFFFFFFu >> (32 - width)), m.Parameter(0))); Stream s = m.Build(ARMv7); ASSERT_EQ(1U, s.size()); @@ -2837,7 +2837,7 @@ TEST_F(InstructionSelectorTest, Word32AndWithBfcImmediateForARMv7) { StreamBuilder m(this, MachineType::Int32(), MachineType::Int32()); m.Return(m.Word32And( m.Parameter(0), - m.Int32Constant(~((0xffffffffu >> (32 - width)) << lsb)))); + m.Int32Constant(~((0xFFFFFFFFu >> (32 - width)) << lsb)))); Stream s = m.Build(ARMv7); ASSERT_EQ(1U, s.size()); EXPECT_EQ(kArmBfc, s[0]->arch_opcode()); @@ -2853,7 +2853,7 @@ TEST_F(InstructionSelectorTest, Word32AndWithBfcImmediateForARMv7) { TRACED_FORRANGE(int32_t, width, 9, (24 - lsb) - 1) { StreamBuilder m(this, MachineType::Int32(), MachineType::Int32()); m.Return( - m.Word32And(m.Int32Constant(~((0xffffffffu >> (32 - width)) << lsb)), + m.Word32And(m.Int32Constant(~((0xFFFFFFFFu >> (32 - width)) << lsb)), m.Parameter(0))); Stream s = m.Build(ARMv7); ASSERT_EQ(1U, s.size()); @@ -2868,12 +2868,11 @@ TEST_F(InstructionSelectorTest, Word32AndWithBfcImmediateForARMv7) { } } - -TEST_F(InstructionSelectorTest, Word32AndWith0xffff) { +TEST_F(InstructionSelectorTest, Word32AndWith0xFFFF) { { StreamBuilder m(this, MachineType::Int32(), MachineType::Int32()); Node* const p0 = m.Parameter(0); - Node* const r = m.Word32And(p0, m.Int32Constant(0xffff)); + Node* const r = m.Word32And(p0, m.Int32Constant(0xFFFF)); m.Return(r); Stream s = m.Build(); ASSERT_EQ(1U, s.size()); @@ -2887,7 +2886,7 @@ TEST_F(InstructionSelectorTest, Word32AndWith0xffff) { { StreamBuilder m(this, MachineType::Int32(), MachineType::Int32()); Node* const p0 = m.Parameter(0); - Node* const r = m.Word32And(m.Int32Constant(0xffff), p0); + Node* const r = m.Word32And(m.Int32Constant(0xFFFF), p0); m.Return(r); Stream s = m.Build(); ASSERT_EQ(1U, s.size()); @@ -2941,7 +2940,7 @@ TEST_F(InstructionSelectorTest, Word32ShrWithWord32AndWithImmediateForARMv7) { uint32_t max = 1 << lsb; if (max > static_cast<uint32_t>(kMaxInt)) max -= 1; uint32_t jnk = rng()->NextInt(max); - uint32_t msk = ((0xffffffffu >> (32 - width)) << lsb) | jnk; + uint32_t msk = ((0xFFFFFFFFu >> (32 - width)) << lsb) | jnk; StreamBuilder m(this, MachineType::Int32(), MachineType::Int32()); m.Return(m.Word32Shr(m.Word32And(m.Parameter(0), m.Int32Constant(msk)), m.Int32Constant(lsb))); @@ -2958,7 +2957,7 @@ TEST_F(InstructionSelectorTest, Word32ShrWithWord32AndWithImmediateForARMv7) { uint32_t max = 1 << lsb; if (max > static_cast<uint32_t>(kMaxInt)) max -= 1; uint32_t jnk = rng()->NextInt(max); - uint32_t msk = ((0xffffffffu >> (32 - width)) << lsb) | jnk; + uint32_t msk = ((0xFFFFFFFFu >> (32 - width)) << lsb) | jnk; StreamBuilder m(this, MachineType::Int32(), MachineType::Int32()); m.Return(m.Word32Shr(m.Word32And(m.Int32Constant(msk), m.Parameter(0)), m.Int32Constant(lsb))); @@ -3098,7 +3097,7 @@ TEST_F(InstructionSelectorTest, Word32AndWithWord32ShrWithImmediateForARMv7) { continue; // Uxtb/h ror. StreamBuilder m(this, MachineType::Int32(), MachineType::Int32()); m.Return(m.Word32And(m.Word32Shr(m.Parameter(0), m.Int32Constant(lsb)), - m.Int32Constant(0xffffffffu >> (32 - width)))); + m.Int32Constant(0xFFFFFFFFu >> (32 - width)))); Stream s = m.Build(ARMv7); ASSERT_EQ(1U, s.size()); EXPECT_EQ(kArmUbfx, s[0]->arch_opcode()); @@ -3113,7 +3112,7 @@ TEST_F(InstructionSelectorTest, Word32AndWithWord32ShrWithImmediateForARMv7) { ((lsb == 8) || (lsb == 16) || (lsb == 24))) continue; // Uxtb/h ror. StreamBuilder m(this, MachineType::Int32(), MachineType::Int32()); - m.Return(m.Word32And(m.Int32Constant(0xffffffffu >> (32 - width)), + m.Return(m.Word32And(m.Int32Constant(0xFFFFFFFFu >> (32 - width)), m.Word32Shr(m.Parameter(0), m.Int32Constant(lsb)))); Stream s = m.Build(ARMv7); ASSERT_EQ(1U, s.size()); @@ -3125,13 +3124,12 @@ TEST_F(InstructionSelectorTest, Word32AndWithWord32ShrWithImmediateForARMv7) { } } - -TEST_F(InstructionSelectorTest, Word32AndWithWord32ShrAnd0xff) { +TEST_F(InstructionSelectorTest, Word32AndWithWord32ShrAnd0xFF) { TRACED_FORRANGE(int32_t, shr, 1, 3) { StreamBuilder m(this, MachineType::Int32(), MachineType::Int32()); Node* const p0 = m.Parameter(0); Node* const r = m.Word32And(m.Word32Shr(p0, m.Int32Constant(shr * 8)), - m.Int32Constant(0xff)); + m.Int32Constant(0xFF)); m.Return(r); Stream s = m.Build(); ASSERT_EQ(1U, s.size()); @@ -3142,7 +3140,7 @@ TEST_F(InstructionSelectorTest, Word32AndWithWord32ShrAnd0xff) { TRACED_FORRANGE(int32_t, shr, 1, 3) { StreamBuilder m(this, MachineType::Int32(), MachineType::Int32()); Node* const p0 = m.Parameter(0); - Node* const r = m.Word32And(m.Int32Constant(0xff), + Node* const r = m.Word32And(m.Int32Constant(0xFF), m.Word32Shr(p0, m.Int32Constant(shr * 8))); m.Return(r); Stream s = m.Build(); @@ -3153,13 +3151,12 @@ TEST_F(InstructionSelectorTest, Word32AndWithWord32ShrAnd0xff) { } } - -TEST_F(InstructionSelectorTest, Word32AndWithWord32ShrAnd0xffff) { +TEST_F(InstructionSelectorTest, Word32AndWithWord32ShrAnd0xFFFF) { TRACED_FORRANGE(int32_t, shr, 1, 2) { StreamBuilder m(this, MachineType::Int32(), MachineType::Int32()); Node* const p0 = m.Parameter(0); Node* const r = m.Word32And(m.Word32Shr(p0, m.Int32Constant(shr * 8)), - m.Int32Constant(0xffff)); + m.Int32Constant(0xFFFF)); m.Return(r); Stream s = m.Build(); ASSERT_EQ(1U, s.size()); @@ -3170,7 +3167,7 @@ TEST_F(InstructionSelectorTest, Word32AndWithWord32ShrAnd0xffff) { TRACED_FORRANGE(int32_t, shr, 1, 2) { StreamBuilder m(this, MachineType::Int32(), MachineType::Int32()); Node* const p0 = m.Parameter(0); - Node* const r = m.Word32And(m.Int32Constant(0xffff), + Node* const r = m.Word32And(m.Int32Constant(0xFFFF), m.Word32Shr(p0, m.Int32Constant(shr * 8))); m.Return(r); Stream s = m.Build(); diff --git a/deps/v8/test/unittests/compiler/arm64/instruction-selector-arm64-unittest.cc b/deps/v8/test/unittests/compiler/arm64/instruction-selector-arm64-unittest.cc index 92cdb4962c..013d96f26d 100644 --- a/deps/v8/test/unittests/compiler/arm64/instruction-selector-arm64-unittest.cc +++ b/deps/v8/test/unittests/compiler/arm64/instruction-selector-arm64-unittest.cc @@ -80,49 +80,47 @@ const MachInst2 kLogicalInstructions[] = { // sized block. The block is then duplicated across the word. Below is a random // subset of the 32-bit immediates. const uint32_t kLogical32Immediates[] = { - 0x00000002, 0x00000003, 0x00000070, 0x00000080, 0x00000100, 0x000001c0, - 0x00000300, 0x000007e0, 0x00003ffc, 0x00007fc0, 0x0003c000, 0x0003f000, - 0x0003ffc0, 0x0003fff8, 0x0007ff00, 0x0007ffe0, 0x000e0000, 0x001e0000, - 0x001ffffc, 0x003f0000, 0x003f8000, 0x00780000, 0x007fc000, 0x00ff0000, - 0x01800000, 0x01800180, 0x01f801f8, 0x03fe0000, 0x03ffffc0, 0x03fffffc, - 0x06000000, 0x07fc0000, 0x07ffc000, 0x07ffffc0, 0x07ffffe0, 0x0ffe0ffe, - 0x0ffff800, 0x0ffffff0, 0x0fffffff, 0x18001800, 0x1f001f00, 0x1f801f80, - 0x30303030, 0x3ff03ff0, 0x3ff83ff8, 0x3fff0000, 0x3fff8000, 0x3fffffc0, - 0x70007000, 0x7f7f7f7f, 0x7fc00000, 0x7fffffc0, 0x8000001f, 0x800001ff, - 0x81818181, 0x9fff9fff, 0xc00007ff, 0xc0ffffff, 0xdddddddd, 0xe00001ff, - 0xe00003ff, 0xe007ffff, 0xefffefff, 0xf000003f, 0xf001f001, 0xf3fff3ff, - 0xf800001f, 0xf80fffff, 0xf87ff87f, 0xfbfbfbfb, 0xfc00001f, 0xfc0000ff, - 0xfc0001ff, 0xfc03fc03, 0xfe0001ff, 0xff000001, 0xff03ff03, 0xff800000, - 0xff800fff, 0xff801fff, 0xff87ffff, 0xffc0003f, 0xffc007ff, 0xffcfffcf, - 0xffe00003, 0xffe1ffff, 0xfff0001f, 0xfff07fff, 0xfff80007, 0xfff87fff, - 0xfffc00ff, 0xfffe07ff, 0xffff00ff, 0xffffc001, 0xfffff007, 0xfffff3ff, - 0xfffff807, 0xfffff9ff, 0xfffffc0f, 0xfffffeff}; - + 0x00000002, 0x00000003, 0x00000070, 0x00000080, 0x00000100, 0x000001C0, + 0x00000300, 0x000007E0, 0x00003FFC, 0x00007FC0, 0x0003C000, 0x0003F000, + 0x0003FFC0, 0x0003FFF8, 0x0007FF00, 0x0007FFE0, 0x000E0000, 0x001E0000, + 0x001FFFFC, 0x003F0000, 0x003F8000, 0x00780000, 0x007FC000, 0x00FF0000, + 0x01800000, 0x01800180, 0x01F801F8, 0x03FE0000, 0x03FFFFC0, 0x03FFFFFC, + 0x06000000, 0x07FC0000, 0x07FFC000, 0x07FFFFC0, 0x07FFFFE0, 0x0FFE0FFE, + 0x0FFFF800, 0x0FFFFFF0, 0x0FFFFFFF, 0x18001800, 0x1F001F00, 0x1F801F80, + 0x30303030, 0x3FF03FF0, 0x3FF83FF8, 0x3FFF0000, 0x3FFF8000, 0x3FFFFFC0, + 0x70007000, 0x7F7F7F7F, 0x7FC00000, 0x7FFFFFC0, 0x8000001F, 0x800001FF, + 0x81818181, 0x9FFF9FFF, 0xC00007FF, 0xC0FFFFFF, 0xDDDDDDDD, 0xE00001FF, + 0xE00003FF, 0xE007FFFF, 0xEFFFEFFF, 0xF000003F, 0xF001F001, 0xF3FFF3FF, + 0xF800001F, 0xF80FFFFF, 0xF87FF87F, 0xFBFBFBFB, 0xFC00001F, 0xFC0000FF, + 0xFC0001FF, 0xFC03FC03, 0xFE0001FF, 0xFF000001, 0xFF03FF03, 0xFF800000, + 0xFF800FFF, 0xFF801FFF, 0xFF87FFFF, 0xFFC0003F, 0xFFC007FF, 0xFFCFFFCF, + 0xFFE00003, 0xFFE1FFFF, 0xFFF0001F, 0xFFF07FFF, 0xFFF80007, 0xFFF87FFF, + 0xFFFC00FF, 0xFFFE07FF, 0xFFFF00FF, 0xFFFFC001, 0xFFFFF007, 0xFFFFF3FF, + 0xFFFFF807, 0xFFFFF9FF, 0xFFFFFC0F, 0xFFFFFEFF}; // Random subset of 64-bit logical immediates. const uint64_t kLogical64Immediates[] = { 0x0000000000000001, 0x0000000000000002, 0x0000000000000003, 0x0000000000000070, 0x0000000000000080, 0x0000000000000100, - 0x00000000000001c0, 0x0000000000000300, 0x0000000000000600, - 0x00000000000007e0, 0x0000000000003ffc, 0x0000000000007fc0, - 0x0000000600000000, 0x0000003ffffffffc, 0x000000f000000000, - 0x000001f800000000, 0x0003fc0000000000, 0x0003fc000003fc00, - 0x0003ffffffc00000, 0x0003ffffffffffc0, 0x0006000000060000, - 0x003ffffffffc0000, 0x0180018001800180, 0x01f801f801f801f8, + 0x00000000000001C0, 0x0000000000000300, 0x0000000000000600, + 0x00000000000007E0, 0x0000000000003FFC, 0x0000000000007FC0, + 0x0000000600000000, 0x0000003FFFFFFFFC, 0x000000F000000000, + 0x000001F800000000, 0x0003FC0000000000, 0x0003FC000003FC00, + 0x0003FFFFFFC00000, 0x0003FFFFFFFFFFC0, 0x0006000000060000, + 0x003FFFFFFFFC0000, 0x0180018001800180, 0x01F801F801F801F8, 0x0600000000000000, 0x1000000010000000, 0x1000100010001000, - 0x1010101010101010, 0x1111111111111111, 0x1f001f001f001f00, - 0x1f1f1f1f1f1f1f1f, 0x1ffffffffffffffe, 0x3ffc3ffc3ffc3ffc, - 0x5555555555555555, 0x7f7f7f7f7f7f7f7f, 0x8000000000000000, - 0x8000001f8000001f, 0x8181818181818181, 0x9999999999999999, - 0x9fff9fff9fff9fff, 0xaaaaaaaaaaaaaaaa, 0xdddddddddddddddd, - 0xe0000000000001ff, 0xf800000000000000, 0xf8000000000001ff, - 0xf807f807f807f807, 0xfefefefefefefefe, 0xfffefffefffefffe, - 0xfffff807fffff807, 0xfffff9fffffff9ff, 0xfffffc0ffffffc0f, - 0xfffffc0fffffffff, 0xfffffefffffffeff, 0xfffffeffffffffff, - 0xffffff8000000000, 0xfffffffefffffffe, 0xffffffffefffffff, - 0xfffffffff9ffffff, 0xffffffffff800000, 0xffffffffffffc0ff, - 0xfffffffffffffffe}; - + 0x1010101010101010, 0x1111111111111111, 0x1F001F001F001F00, + 0x1F1F1F1F1F1F1F1F, 0x1FFFFFFFFFFFFFFE, 0x3FFC3FFC3FFC3FFC, + 0x5555555555555555, 0x7F7F7F7F7F7F7F7F, 0x8000000000000000, + 0x8000001F8000001F, 0x8181818181818181, 0x9999999999999999, + 0x9FFF9FFF9FFF9FFF, 0xAAAAAAAAAAAAAAAA, 0xDDDDDDDDDDDDDDDD, + 0xE0000000000001FF, 0xF800000000000000, 0xF8000000000001FF, + 0xF807F807F807F807, 0xFEFEFEFEFEFEFEFE, 0xFFFEFFFEFFFEFFFE, + 0xFFFFF807FFFFF807, 0xFFFFF9FFFFFFF9FF, 0xFFFFFC0FFFFFFC0F, + 0xFFFFFC0FFFFFFFFF, 0xFFFFFEFFFFFFFEFF, 0xFFFFFEFFFFFFFFFF, + 0xFFFFFF8000000000, 0xFFFFFFFEFFFFFFFE, 0xFFFFFFFFEFFFFFFF, + 0xFFFFFFFFF9FFFFFF, 0xFFFFFFFFFF800000, 0xFFFFFFFFFFFFC0FF, + 0xFFFFFFFFFFFFFFFE}; // ARM64 arithmetic instructions. struct AddSub { @@ -595,7 +593,7 @@ TEST_P(InstructionSelectorAddSubTest, UnsignedExtendByte) { const MachineType type = dpi.mi.machine_type; StreamBuilder m(this, type, type, type); m.Return((m.*dpi.mi.constructor)( - m.Parameter(0), m.Word32And(m.Parameter(1), m.Int32Constant(0xff)))); + m.Parameter(0), m.Word32And(m.Parameter(1), m.Int32Constant(0xFF)))); Stream s = m.Build(); ASSERT_EQ(1U, s.size()); EXPECT_EQ(dpi.mi.arch_opcode, s[0]->arch_opcode()); @@ -610,7 +608,7 @@ TEST_P(InstructionSelectorAddSubTest, UnsignedExtendHalfword) { const MachineType type = dpi.mi.machine_type; StreamBuilder m(this, type, type, type); m.Return((m.*dpi.mi.constructor)( - m.Parameter(0), m.Word32And(m.Parameter(1), m.Int32Constant(0xffff)))); + m.Parameter(0), m.Word32And(m.Parameter(1), m.Int32Constant(0xFFFF)))); Stream s = m.Build(); ASSERT_EQ(1U, s.size()); EXPECT_EQ(dpi.mi.arch_opcode, s[0]->arch_opcode()); @@ -746,7 +744,7 @@ TEST_F(InstructionSelectorTest, SubZeroOnLeftWithShift) { EXPECT_TRUE(s[0]->InputAt(0)->IsImmediate()); EXPECT_EQ(0, s.ToInt32(s[0]->InputAt(0))); EXPECT_EQ(shift.mode, s[0]->addressing_mode()); - EXPECT_EQ(0x3f & imm, 0x3f & s.ToInt32(s[0]->InputAt(2))); + EXPECT_EQ(0x3F & imm, 0x3F & s.ToInt32(s[0]->InputAt(2))); EXPECT_EQ(1U, s[0]->OutputCount()); } } @@ -772,7 +770,7 @@ TEST_F(InstructionSelectorTest, SubZeroOnLeftWithShift) { EXPECT_TRUE(s[0]->InputAt(0)->IsImmediate()); EXPECT_EQ(0, s.ToInt32(s[0]->InputAt(0))); EXPECT_EQ(shift.mode, s[0]->addressing_mode()); - EXPECT_EQ(0x3f & imm, 0x3f & s.ToInt32(s[0]->InputAt(2))); + EXPECT_EQ(0x3F & imm, 0x3F & s.ToInt32(s[0]->InputAt(2))); EXPECT_EQ(1U, s[0]->OutputCount()); } } @@ -836,7 +834,7 @@ TEST_F(InstructionSelectorTest, AddShiftByImmediateOnLeft) { EXPECT_EQ(kArm64Add32, s[0]->arch_opcode()); EXPECT_EQ(shift.mode, s[0]->addressing_mode()); EXPECT_EQ(3U, s[0]->InputCount()); - EXPECT_EQ(0x3f & imm, 0x3f & s.ToInt64(s[0]->InputAt(2))); + EXPECT_EQ(0x3F & imm, 0x3F & s.ToInt64(s[0]->InputAt(2))); EXPECT_EQ(1U, s[0]->OutputCount()); } } @@ -860,7 +858,7 @@ TEST_F(InstructionSelectorTest, AddShiftByImmediateOnLeft) { EXPECT_EQ(kArm64Add, s[0]->arch_opcode()); EXPECT_EQ(shift.mode, s[0]->addressing_mode()); EXPECT_EQ(3U, s[0]->InputCount()); - EXPECT_EQ(0x3f & imm, 0x3f & s.ToInt64(s[0]->InputAt(2))); + EXPECT_EQ(0x3F & imm, 0x3F & s.ToInt64(s[0]->InputAt(2))); EXPECT_EQ(1U, s[0]->OutputCount()); } } @@ -871,7 +869,7 @@ TEST_F(InstructionSelectorTest, AddUnsignedExtendByteOnLeft) { { StreamBuilder m(this, MachineType::Int32(), MachineType::Int32(), MachineType::Int32()); - m.Return(m.Int32Add(m.Word32And(m.Parameter(0), m.Int32Constant(0xff)), + m.Return(m.Int32Add(m.Word32And(m.Parameter(0), m.Int32Constant(0xFF)), m.Parameter(1))); Stream s = m.Build(); ASSERT_EQ(1U, s.size()); @@ -883,7 +881,7 @@ TEST_F(InstructionSelectorTest, AddUnsignedExtendByteOnLeft) { { StreamBuilder m(this, MachineType::Int64(), MachineType::Int32(), MachineType::Int64()); - m.Return(m.Int64Add(m.Word32And(m.Parameter(0), m.Int32Constant(0xff)), + m.Return(m.Int64Add(m.Word32And(m.Parameter(0), m.Int32Constant(0xFF)), m.Parameter(1))); Stream s = m.Build(); ASSERT_EQ(1U, s.size()); @@ -899,7 +897,7 @@ TEST_F(InstructionSelectorTest, AddUnsignedExtendHalfwordOnLeft) { { StreamBuilder m(this, MachineType::Int32(), MachineType::Int32(), MachineType::Int32()); - m.Return(m.Int32Add(m.Word32And(m.Parameter(0), m.Int32Constant(0xffff)), + m.Return(m.Int32Add(m.Word32And(m.Parameter(0), m.Int32Constant(0xFFFF)), m.Parameter(1))); Stream s = m.Build(); ASSERT_EQ(1U, s.size()); @@ -911,7 +909,7 @@ TEST_F(InstructionSelectorTest, AddUnsignedExtendHalfwordOnLeft) { { StreamBuilder m(this, MachineType::Int64(), MachineType::Int32(), MachineType::Int64()); - m.Return(m.Int64Add(m.Word32And(m.Parameter(0), m.Int32Constant(0xffff)), + m.Return(m.Int64Add(m.Word32And(m.Parameter(0), m.Int32Constant(0xFFFF)), m.Parameter(1))); Stream s = m.Build(); ASSERT_EQ(1U, s.size()); @@ -1167,87 +1165,126 @@ TEST_F(InstructionSelectorTest, AddBranchWithImmediateOnLeft) { } } +struct TestAndBranch { + MachInst<std::function<Node*(InstructionSelectorTest::StreamBuilder&, Node*, + uint32_t mask)>> + mi; + FlagsCondition cond; +}; -TEST_F(InstructionSelectorTest, Word32AndBranchWithOneBitMaskOnRight) { - TRACED_FORRANGE(int, bit, 0, 31) { - uint32_t mask = 1 << bit; - StreamBuilder m(this, MachineType::Int32(), MachineType::Int32()); - RawMachineLabel a, b; - m.Branch(m.Word32And(m.Parameter(0), m.Int32Constant(mask)), &a, &b); - m.Bind(&a); - m.Return(m.Int32Constant(1)); - m.Bind(&b); - m.Return(m.Int32Constant(0)); - Stream s = m.Build(); - ASSERT_EQ(1U, s.size()); - EXPECT_EQ(kArm64TestAndBranch32, s[0]->arch_opcode()); - EXPECT_EQ(kNotEqual, s[0]->flags_condition()); - EXPECT_EQ(4U, s[0]->InputCount()); - EXPECT_EQ(InstructionOperand::IMMEDIATE, s[0]->InputAt(1)->kind()); - EXPECT_EQ(bit, s.ToInt32(s[0]->InputAt(1))); - } - - TRACED_FORRANGE(int, bit, 0, 31) { - uint32_t mask = 1 << bit; - StreamBuilder m(this, MachineType::Int32(), MachineType::Int32()); - RawMachineLabel a, b; - m.Branch( - m.Word32BinaryNot(m.Word32And(m.Parameter(0), m.Int32Constant(mask))), - &a, &b); - m.Bind(&a); - m.Return(m.Int32Constant(1)); - m.Bind(&b); - m.Return(m.Int32Constant(0)); - Stream s = m.Build(); - ASSERT_EQ(1U, s.size()); - EXPECT_EQ(kArm64TestAndBranch32, s[0]->arch_opcode()); - EXPECT_EQ(kEqual, s[0]->flags_condition()); - EXPECT_EQ(4U, s[0]->InputCount()); - EXPECT_EQ(InstructionOperand::IMMEDIATE, s[0]->InputAt(1)->kind()); - EXPECT_EQ(bit, s.ToInt32(s[0]->InputAt(1))); - } +std::ostream& operator<<(std::ostream& os, const TestAndBranch& tb) { + return os << tb.mi; } -TEST_F(InstructionSelectorTest, Word32AndBranchWithOneBitMaskOnLeft) { - TRACED_FORRANGE(int, bit, 0, 31) { - uint32_t mask = 1 << bit; - StreamBuilder m(this, MachineType::Int32(), MachineType::Int32()); - RawMachineLabel a, b; - m.Branch(m.Word32And(m.Int32Constant(mask), m.Parameter(0)), &a, &b); - m.Bind(&a); - m.Return(m.Int32Constant(1)); - m.Bind(&b); - m.Return(m.Int32Constant(0)); - Stream s = m.Build(); - ASSERT_EQ(1U, s.size()); - EXPECT_EQ(kArm64TestAndBranch32, s[0]->arch_opcode()); - EXPECT_EQ(kNotEqual, s[0]->flags_condition()); - EXPECT_EQ(4U, s[0]->InputCount()); - EXPECT_EQ(InstructionOperand::IMMEDIATE, s[0]->InputAt(1)->kind()); - EXPECT_EQ(bit, s.ToInt32(s[0]->InputAt(1))); - } - +const TestAndBranch kTestAndBranchMatchers32[] = { + // Branch on the result of Word32And directly. + {{[](InstructionSelectorTest::StreamBuilder& m, Node* x, uint32_t mask) + -> Node* { return m.Word32And(x, m.Int32Constant(mask)); }, + "if (x and mask)", kArm64TestAndBranch32, MachineType::Int32()}, + kNotEqual}, + {{[](InstructionSelectorTest::StreamBuilder& m, Node* x, + uint32_t mask) -> Node* { + return m.Word32BinaryNot(m.Word32And(x, m.Int32Constant(mask))); + }, + "if not (x and mask)", kArm64TestAndBranch32, MachineType::Int32()}, + kEqual}, + {{[](InstructionSelectorTest::StreamBuilder& m, Node* x, uint32_t mask) + -> Node* { return m.Word32And(m.Int32Constant(mask), x); }, + "if (mask and x)", kArm64TestAndBranch32, MachineType::Int32()}, + kNotEqual}, + {{[](InstructionSelectorTest::StreamBuilder& m, Node* x, + uint32_t mask) -> Node* { + return m.Word32BinaryNot(m.Word32And(m.Int32Constant(mask), x)); + }, + "if not (mask and x)", kArm64TestAndBranch32, MachineType::Int32()}, + kEqual}, + // Branch on the result of '(x and mask) == mask'. This tests that a bit is + // set rather than cleared which is why conditions are inverted. + {{[](InstructionSelectorTest::StreamBuilder& m, Node* x, + uint32_t mask) -> Node* { + return m.Word32Equal(m.Word32And(x, m.Int32Constant(mask)), + m.Int32Constant(mask)); + }, + "if ((x and mask) == mask)", kArm64TestAndBranch32, MachineType::Int32()}, + kNotEqual}, + {{[](InstructionSelectorTest::StreamBuilder& m, Node* x, + uint32_t mask) -> Node* { + return m.Word32BinaryNot(m.Word32Equal( + m.Word32And(x, m.Int32Constant(mask)), m.Int32Constant(mask))); + }, + "if ((x and mask) != mask)", kArm64TestAndBranch32, MachineType::Int32()}, + kEqual}, + {{[](InstructionSelectorTest::StreamBuilder& m, Node* x, + uint32_t mask) -> Node* { + return m.Word32Equal(m.Int32Constant(mask), + m.Word32And(x, m.Int32Constant(mask))); + }, + "if (mask == (x and mask))", kArm64TestAndBranch32, MachineType::Int32()}, + kNotEqual}, + {{[](InstructionSelectorTest::StreamBuilder& m, Node* x, + uint32_t mask) -> Node* { + return m.Word32BinaryNot(m.Word32Equal( + m.Int32Constant(mask), m.Word32And(x, m.Int32Constant(mask)))); + }, + "if (mask != (x and mask))", kArm64TestAndBranch32, MachineType::Int32()}, + kEqual}, + // Same as above but swap 'mask' and 'x'. + {{[](InstructionSelectorTest::StreamBuilder& m, Node* x, + uint32_t mask) -> Node* { + return m.Word32Equal(m.Word32And(m.Int32Constant(mask), x), + m.Int32Constant(mask)); + }, + "if ((mask and x) == mask)", kArm64TestAndBranch32, MachineType::Int32()}, + kNotEqual}, + {{[](InstructionSelectorTest::StreamBuilder& m, Node* x, + uint32_t mask) -> Node* { + return m.Word32BinaryNot(m.Word32Equal( + m.Word32And(m.Int32Constant(mask), x), m.Int32Constant(mask))); + }, + "if ((mask and x) != mask)", kArm64TestAndBranch32, MachineType::Int32()}, + kEqual}, + {{[](InstructionSelectorTest::StreamBuilder& m, Node* x, + uint32_t mask) -> Node* { + return m.Word32Equal(m.Int32Constant(mask), + m.Word32And(m.Int32Constant(mask), x)); + }, + "if (mask == (mask and x))", kArm64TestAndBranch32, MachineType::Int32()}, + kNotEqual}, + {{[](InstructionSelectorTest::StreamBuilder& m, Node* x, + uint32_t mask) -> Node* { + return m.Word32BinaryNot(m.Word32Equal( + m.Int32Constant(mask), m.Word32And(m.Int32Constant(mask), x))); + }, + "if (mask != (mask and x))", kArm64TestAndBranch32, MachineType::Int32()}, + kEqual}}; + +typedef InstructionSelectorTestWithParam<TestAndBranch> + InstructionSelectorTestAndBranchTest; + +TEST_P(InstructionSelectorTestAndBranchTest, TestAndBranch32) { + const TestAndBranch inst = GetParam(); TRACED_FORRANGE(int, bit, 0, 31) { uint32_t mask = 1 << bit; StreamBuilder m(this, MachineType::Int32(), MachineType::Int32()); RawMachineLabel a, b; - m.Branch( - m.Word32BinaryNot(m.Word32And(m.Int32Constant(mask), m.Parameter(0))), - &a, &b); + m.Branch(inst.mi.constructor(m, m.Parameter(0), mask), &a, &b); m.Bind(&a); m.Return(m.Int32Constant(1)); m.Bind(&b); m.Return(m.Int32Constant(0)); Stream s = m.Build(); ASSERT_EQ(1U, s.size()); - EXPECT_EQ(kArm64TestAndBranch32, s[0]->arch_opcode()); - EXPECT_EQ(kEqual, s[0]->flags_condition()); + EXPECT_EQ(inst.mi.arch_opcode, s[0]->arch_opcode()); + EXPECT_EQ(inst.cond, s[0]->flags_condition()); EXPECT_EQ(4U, s[0]->InputCount()); EXPECT_EQ(InstructionOperand::IMMEDIATE, s[0]->InputAt(1)->kind()); EXPECT_EQ(bit, s.ToInt32(s[0]->InputAt(1))); } } +INSTANTIATE_TEST_CASE_P(InstructionSelectorTest, + InstructionSelectorTestAndBranchTest, + ::testing::ValuesIn(kTestAndBranchMatchers32)); TEST_F(InstructionSelectorTest, Word64AndBranchWithOneBitMaskOnRight) { TRACED_FORRANGE(int, bit, 0, 63) { @@ -1335,7 +1372,7 @@ TEST_F(InstructionSelectorTest, Word32EqualZeroAndBranchWithOneBitMask) { TEST_F(InstructionSelectorTest, Word64EqualZeroAndBranchWithOneBitMask) { TRACED_FORRANGE(int, bit, 0, 63) { - uint64_t mask = V8_UINT64_C(1) << bit; + uint64_t mask = uint64_t{1} << bit; StreamBuilder m(this, MachineType::Int64(), MachineType::Int64()); RawMachineLabel a, b; m.Branch(m.Word64Equal(m.Word64And(m.Int64Constant(mask), m.Parameter(0)), @@ -1355,7 +1392,7 @@ TEST_F(InstructionSelectorTest, Word64EqualZeroAndBranchWithOneBitMask) { } TRACED_FORRANGE(int, bit, 0, 63) { - uint64_t mask = V8_UINT64_C(1) << bit; + uint64_t mask = uint64_t{1} << bit; StreamBuilder m(this, MachineType::Int64(), MachineType::Int64()); RawMachineLabel a, b; m.Branch( @@ -2925,7 +2962,7 @@ TEST_F(InstructionSelectorTest, Word32EqualWithWord32Shift) { ASSERT_EQ(3U, s[0]->InputCount()); EXPECT_EQ(s.ToVreg(p0), s.ToVreg(s[0]->InputAt(0))); EXPECT_EQ(s.ToVreg(p1), s.ToVreg(s[0]->InputAt(1))); - EXPECT_EQ(0x3f & imm, 0x3f & s.ToInt32(s[0]->InputAt(2))); + EXPECT_EQ(0x3F & imm, 0x3F & s.ToInt32(s[0]->InputAt(2))); ASSERT_EQ(1U, s[0]->OutputCount()); } TRACED_FORRANGE(int32_t, imm, -32, 63) { @@ -2942,7 +2979,7 @@ TEST_F(InstructionSelectorTest, Word32EqualWithWord32Shift) { ASSERT_EQ(3U, s[0]->InputCount()); EXPECT_EQ(s.ToVreg(p0), s.ToVreg(s[0]->InputAt(0))); EXPECT_EQ(s.ToVreg(p1), s.ToVreg(s[0]->InputAt(1))); - EXPECT_EQ(0x3f & imm, 0x3f & s.ToInt32(s[0]->InputAt(2))); + EXPECT_EQ(0x3F & imm, 0x3F & s.ToInt32(s[0]->InputAt(2))); ASSERT_EQ(1U, s[0]->OutputCount()); } } @@ -2955,7 +2992,7 @@ TEST_F(InstructionSelectorTest, Word32EqualWithUnsignedExtendByte) { MachineType::Int32()); Node* const p0 = m.Parameter(0); Node* const p1 = m.Parameter(1); - Node* r = m.Word32And(p1, m.Int32Constant(0xff)); + Node* r = m.Word32And(p1, m.Int32Constant(0xFF)); m.Return(m.Word32Equal(p0, r)); Stream s = m.Build(); ASSERT_EQ(1U, s.size()); @@ -2971,7 +3008,7 @@ TEST_F(InstructionSelectorTest, Word32EqualWithUnsignedExtendByte) { MachineType::Int32()); Node* const p0 = m.Parameter(0); Node* const p1 = m.Parameter(1); - Node* r = m.Word32And(p1, m.Int32Constant(0xff)); + Node* r = m.Word32And(p1, m.Int32Constant(0xFF)); m.Return(m.Word32Equal(r, p0)); Stream s = m.Build(); ASSERT_EQ(1U, s.size()); @@ -2991,7 +3028,7 @@ TEST_F(InstructionSelectorTest, Word32EqualWithUnsignedExtendHalfword) { MachineType::Int32()); Node* const p0 = m.Parameter(0); Node* const p1 = m.Parameter(1); - Node* r = m.Word32And(p1, m.Int32Constant(0xffff)); + Node* r = m.Word32And(p1, m.Int32Constant(0xFFFF)); m.Return(m.Word32Equal(p0, r)); Stream s = m.Build(); ASSERT_EQ(1U, s.size()); @@ -3007,7 +3044,7 @@ TEST_F(InstructionSelectorTest, Word32EqualWithUnsignedExtendHalfword) { MachineType::Int32()); Node* const p0 = m.Parameter(0); Node* const p1 = m.Parameter(1); - Node* r = m.Word32And(p1, m.Int32Constant(0xffff)); + Node* r = m.Word32And(p1, m.Int32Constant(0xFFFF)); m.Return(m.Word32Equal(r, p0)); Stream s = m.Build(); ASSERT_EQ(1U, s.size()); @@ -3204,7 +3241,7 @@ TEST_F(InstructionSelectorTest, Word32CompareNegateWithWord32Shift) { EXPECT_EQ(kArm64Cmn32, s[0]->arch_opcode()); EXPECT_EQ(3U, s[0]->InputCount()); EXPECT_EQ(shift.mode, s[0]->addressing_mode()); - EXPECT_EQ(0x3f & imm, 0x3f & s.ToInt32(s[0]->InputAt(2))); + EXPECT_EQ(0x3F & imm, 0x3F & s.ToInt32(s[0]->InputAt(2))); EXPECT_EQ(1U, s[0]->OutputCount()); EXPECT_EQ(kFlags_set, s[0]->flags_mode()); EXPECT_EQ(cmp.cond, s[0]->flags_condition()); @@ -3312,7 +3349,7 @@ TEST_F(InstructionSelectorTest, CmpShiftByImmediateOnLeft) { EXPECT_EQ(kArm64Cmp32, s[0]->arch_opcode()); EXPECT_EQ(shift.mode, s[0]->addressing_mode()); EXPECT_EQ(3U, s[0]->InputCount()); - EXPECT_EQ(0x3f & imm, 0x3f & s.ToInt64(s[0]->InputAt(2))); + EXPECT_EQ(0x3F & imm, 0x3F & s.ToInt64(s[0]->InputAt(2))); EXPECT_EQ(1U, s[0]->OutputCount()); EXPECT_EQ(kFlags_set, s[0]->flags_mode()); EXPECT_EQ(cmp.commuted_cond, s[0]->flags_condition()); @@ -3346,7 +3383,7 @@ TEST_F(InstructionSelectorTest, CmnShiftByImmediateOnLeft) { EXPECT_EQ(kArm64Cmn32, s[0]->arch_opcode()); EXPECT_EQ(shift.mode, s[0]->addressing_mode()); EXPECT_EQ(3U, s[0]->InputCount()); - EXPECT_EQ(0x3f & imm, 0x3f & s.ToInt64(s[0]->InputAt(2))); + EXPECT_EQ(0x3F & imm, 0x3F & s.ToInt64(s[0]->InputAt(2))); EXPECT_EQ(1U, s[0]->OutputCount()); EXPECT_EQ(kFlags_set, s[0]->flags_mode()); EXPECT_EQ(cmp.cond, s[0]->flags_condition()); @@ -3816,11 +3853,11 @@ TEST_F(InstructionSelectorTest, Word32ShrWithWord32AndWithImmediate) { // The available shift operand range is `0 <= imm < 32`, but we also test // that immediates outside this range are handled properly (modulo-32). TRACED_FORRANGE(int32_t, shift, -32, 63) { - int32_t lsb = shift & 0x1f; + int32_t lsb = shift & 0x1F; TRACED_FORRANGE(int32_t, width, 1, 32 - lsb) { uint32_t jnk = rng()->NextInt(); jnk = (lsb > 0) ? (jnk >> (32 - lsb)) : 0; - uint32_t msk = ((0xffffffffu >> (32 - width)) << lsb) | jnk; + uint32_t msk = ((0xFFFFFFFFu >> (32 - width)) << lsb) | jnk; StreamBuilder m(this, MachineType::Int32(), MachineType::Int32()); m.Return(m.Word32Shr(m.Word32And(m.Parameter(0), m.Int32Constant(msk)), m.Int32Constant(shift))); @@ -3833,11 +3870,11 @@ TEST_F(InstructionSelectorTest, Word32ShrWithWord32AndWithImmediate) { } } TRACED_FORRANGE(int32_t, shift, -32, 63) { - int32_t lsb = shift & 0x1f; + int32_t lsb = shift & 0x1F; TRACED_FORRANGE(int32_t, width, 1, 32 - lsb) { uint32_t jnk = rng()->NextInt(); jnk = (lsb > 0) ? (jnk >> (32 - lsb)) : 0; - uint32_t msk = ((0xffffffffu >> (32 - width)) << lsb) | jnk; + uint32_t msk = ((0xFFFFFFFFu >> (32 - width)) << lsb) | jnk; StreamBuilder m(this, MachineType::Int32(), MachineType::Int32()); m.Return(m.Word32Shr(m.Word32And(m.Int32Constant(msk), m.Parameter(0)), m.Int32Constant(shift))); @@ -3856,12 +3893,12 @@ TEST_F(InstructionSelectorTest, Word64ShrWithWord64AndWithImmediate) { // The available shift operand range is `0 <= imm < 64`, but we also test // that immediates outside this range are handled properly (modulo-64). TRACED_FORRANGE(int32_t, shift, -64, 127) { - int32_t lsb = shift & 0x3f; + int32_t lsb = shift & 0x3F; TRACED_FORRANGE(int32_t, width, 1, 64 - lsb) { uint64_t jnk = rng()->NextInt64(); jnk = (lsb > 0) ? (jnk >> (64 - lsb)) : 0; uint64_t msk = - ((V8_UINT64_C(0xffffffffffffffff) >> (64 - width)) << lsb) | jnk; + ((uint64_t{0xFFFFFFFFFFFFFFFF} >> (64 - width)) << lsb) | jnk; StreamBuilder m(this, MachineType::Int64(), MachineType::Int64()); m.Return(m.Word64Shr(m.Word64And(m.Parameter(0), m.Int64Constant(msk)), m.Int64Constant(shift))); @@ -3874,12 +3911,12 @@ TEST_F(InstructionSelectorTest, Word64ShrWithWord64AndWithImmediate) { } } TRACED_FORRANGE(int32_t, shift, -64, 127) { - int32_t lsb = shift & 0x3f; + int32_t lsb = shift & 0x3F; TRACED_FORRANGE(int32_t, width, 1, 64 - lsb) { uint64_t jnk = rng()->NextInt64(); jnk = (lsb > 0) ? (jnk >> (64 - lsb)) : 0; uint64_t msk = - ((V8_UINT64_C(0xffffffffffffffff) >> (64 - width)) << lsb) | jnk; + ((uint64_t{0xFFFFFFFFFFFFFFFF} >> (64 - width)) << lsb) | jnk; StreamBuilder m(this, MachineType::Int64(), MachineType::Int64()); m.Return(m.Word64Shr(m.Word64And(m.Int64Constant(msk), m.Parameter(0)), m.Int64Constant(shift))); @@ -3898,7 +3935,7 @@ TEST_F(InstructionSelectorTest, Word32AndWithImmediateWithWord32Shr) { // The available shift operand range is `0 <= imm < 32`, but we also test // that immediates outside this range are handled properly (modulo-32). TRACED_FORRANGE(int32_t, shift, -32, 63) { - int32_t lsb = shift & 0x1f; + int32_t lsb = shift & 0x1F; TRACED_FORRANGE(int32_t, width, 1, 31) { uint32_t msk = (1 << width) - 1; StreamBuilder m(this, MachineType::Int32(), MachineType::Int32()); @@ -3914,7 +3951,7 @@ TEST_F(InstructionSelectorTest, Word32AndWithImmediateWithWord32Shr) { } } TRACED_FORRANGE(int32_t, shift, -32, 63) { - int32_t lsb = shift & 0x1f; + int32_t lsb = shift & 0x1F; TRACED_FORRANGE(int32_t, width, 1, 31) { uint32_t msk = (1 << width) - 1; StreamBuilder m(this, MachineType::Int32(), MachineType::Int32()); @@ -3937,9 +3974,9 @@ TEST_F(InstructionSelectorTest, Word64AndWithImmediateWithWord64Shr) { // The available shift operand range is `0 <= imm < 64`, but we also test // that immediates outside this range are handled properly (modulo-64). TRACED_FORRANGE(int64_t, shift, -64, 127) { - int64_t lsb = shift & 0x3f; + int64_t lsb = shift & 0x3F; TRACED_FORRANGE(int64_t, width, 1, 63) { - uint64_t msk = (V8_UINT64_C(1) << width) - 1; + uint64_t msk = (uint64_t{1} << width) - 1; StreamBuilder m(this, MachineType::Int64(), MachineType::Int64()); m.Return(m.Word64And(m.Word64Shr(m.Parameter(0), m.Int64Constant(shift)), m.Int64Constant(msk))); @@ -3953,9 +3990,9 @@ TEST_F(InstructionSelectorTest, Word64AndWithImmediateWithWord64Shr) { } } TRACED_FORRANGE(int64_t, shift, -64, 127) { - int64_t lsb = shift & 0x3f; + int64_t lsb = shift & 0x3F; TRACED_FORRANGE(int64_t, width, 1, 63) { - uint64_t msk = (V8_UINT64_C(1) << width) - 1; + uint64_t msk = (uint64_t{1} << width) - 1; StreamBuilder m(this, MachineType::Int64(), MachineType::Int64()); m.Return( m.Word64And(m.Int64Constant(msk), @@ -4013,7 +4050,7 @@ TEST_F(InstructionSelectorTest, Int32MulHighWithSar) { EXPECT_EQ(kArm64Asr, s[1]->arch_opcode()); ASSERT_EQ(2U, s[1]->InputCount()); EXPECT_EQ(s.ToVreg(s[0]->Output()), s.ToVreg(s[1]->InputAt(0))); - EXPECT_EQ((shift & 0x1f) + 32, s.ToInt64(s[1]->InputAt(1))); + EXPECT_EQ((shift & 0x1F) + 32, s.ToInt64(s[1]->InputAt(1))); ASSERT_EQ(1U, s[1]->OutputCount()); EXPECT_EQ(s.ToVreg(n), s.ToVreg(s[1]->Output())); } @@ -4072,7 +4109,7 @@ TEST_F(InstructionSelectorTest, Uint32MulHighWithShr) { EXPECT_EQ(kArm64Lsr, s[1]->arch_opcode()); ASSERT_EQ(2U, s[1]->InputCount()); EXPECT_EQ(s.ToVreg(s[0]->Output()), s.ToVreg(s[1]->InputAt(0))); - EXPECT_EQ((shift & 0x1f) + 32, s.ToInt64(s[1]->InputAt(1))); + EXPECT_EQ((shift & 0x1F) + 32, s.ToInt64(s[1]->InputAt(1))); ASSERT_EQ(1U, s[1]->OutputCount()); EXPECT_EQ(s.ToVreg(n), s.ToVreg(s[1]->Output())); } diff --git a/deps/v8/test/unittests/compiler/graph-unittest.cc b/deps/v8/test/unittests/compiler/graph-unittest.cc index 55931d51fb..a39f56e6bb 100644 --- a/deps/v8/test/unittests/compiler/graph-unittest.cc +++ b/deps/v8/test/unittests/compiler/graph-unittest.cc @@ -17,7 +17,8 @@ GraphTest::GraphTest(int num_parameters) : TestWithNativeContext(), TestWithIsolateAndZone(), common_(zone()), - graph_(zone()) { + graph_(zone()), + source_positions_(&graph_) { graph()->SetStart(graph()->NewNode(common()->Start(num_parameters))); graph()->SetEnd(graph()->NewNode(common()->End(1), graph()->start())); } diff --git a/deps/v8/test/unittests/compiler/graph-unittest.h b/deps/v8/test/unittests/compiler/graph-unittest.h index 8701f1ff6d..9d4a15ad27 100644 --- a/deps/v8/test/unittests/compiler/graph-unittest.h +++ b/deps/v8/test/unittests/compiler/graph-unittest.h @@ -6,6 +6,7 @@ #define V8_UNITTESTS_COMPILER_GRAPH_UNITTEST_H_ #include "src/compiler/common-operator.h" +#include "src/compiler/compiler-source-position-table.h" #include "src/compiler/graph.h" #include "src/compiler/typer.h" #include "test/unittests/test-utils.h" @@ -58,10 +59,12 @@ class GraphTest : public virtual TestWithNativeContext, CommonOperatorBuilder* common() { return &common_; } Graph* graph() { return &graph_; } + SourcePositionTable* source_positions() { return &source_positions_; } private: CommonOperatorBuilder common_; Graph graph_; + SourcePositionTable source_positions_; }; diff --git a/deps/v8/test/unittests/compiler/ia32/instruction-selector-ia32-unittest.cc b/deps/v8/test/unittests/compiler/ia32/instruction-selector-ia32-unittest.cc index b9f5fc4b9f..f2767a0bb8 100644 --- a/deps/v8/test/unittests/compiler/ia32/instruction-selector-ia32-unittest.cc +++ b/deps/v8/test/unittests/compiler/ia32/instruction-selector-ia32-unittest.cc @@ -15,7 +15,7 @@ namespace { // Immediates (random subset). const int32_t kImmediates[] = {kMinInt, -42, -1, 0, 1, 2, 3, 4, 5, 6, 7, 8, - 16, 42, 0xff, 0xffff, 0x0f0f0f0f, kMaxInt}; + 16, 42, 0xFF, 0xFFFF, 0x0F0F0F0F, kMaxInt}; } // namespace @@ -864,6 +864,15 @@ TEST_F(InstructionSelectorTest, Word32Clz) { EXPECT_EQ(s.ToVreg(n), s.ToVreg(s[0]->Output())); } +TEST_F(InstructionSelectorTest, SpeculationFence) { + StreamBuilder m(this, MachineType::Int32()); + m.SpeculationFence(); + m.Return(m.Int32Constant(0)); + Stream s = m.Build(); + ASSERT_EQ(1U, s.size()); + EXPECT_EQ(kLFence, s[0]->arch_opcode()); +} + } // namespace compiler } // namespace internal } // namespace v8 diff --git a/deps/v8/test/unittests/compiler/instruction-sequence-unittest.cc b/deps/v8/test/unittests/compiler/instruction-sequence-unittest.cc index d629639c49..17d1572e98 100644 --- a/deps/v8/test/unittests/compiler/instruction-sequence-unittest.cc +++ b/deps/v8/test/unittests/compiler/instruction-sequence-unittest.cc @@ -432,8 +432,7 @@ InstructionOperand InstructionSequenceTest::ConvertInputOp(TestOperand op) { default: break; } - CHECK(false); - return InstructionOperand(); + UNREACHABLE(); } @@ -468,8 +467,7 @@ InstructionOperand InstructionSequenceTest::ConvertOutputOp(VReg vreg, default: break; } - CHECK(false); - return InstructionOperand(); + UNREACHABLE(); } diff --git a/deps/v8/test/unittests/compiler/int64-lowering-unittest.cc b/deps/v8/test/unittests/compiler/int64-lowering-unittest.cc index a6bd1f2dad..ddb8408e5f 100644 --- a/deps/v8/test/unittests/compiler/int64-lowering-unittest.cc +++ b/deps/v8/test/unittests/compiler/int64-lowering-unittest.cc @@ -34,8 +34,8 @@ class Int64LoweringTest : public GraphTest { : GraphTest(), machine_(zone(), MachineRepresentation::kWord32, MachineOperatorBuilder::Flag::kAllOptionalOps) { - value_[0] = 0x1234567890abcdef; - value_[1] = 0x1edcba098765432f; + value_[0] = 0x1234567890ABCDEF; + value_[1] = 0x1EDCBA098765432F; value_[2] = 0x1133557799886644; } @@ -85,7 +85,7 @@ class Int64LoweringTest : public GraphTest { int64_t value(int i) { return value_[i]; } int32_t low_word_value(int i) { - return static_cast<int32_t>(value_[i] & 0xffffffff); + return static_cast<int32_t>(value_[i] & 0xFFFFFFFF); } int32_t high_word_value(int i) { @@ -760,7 +760,7 @@ TEST_F(Int64LoweringTest, I64Ror) { IsMerge(IsIfTrue(branch_lt32_matcher), IsIfFalse(branch_lt32_matcher))); Matcher<Node*> shift_matcher = - IsWord32And(IsParameter(0), IsInt32Constant(0x1f)); + IsWord32And(IsParameter(0), IsInt32Constant(0x1F)); Matcher<Node*> bit_mask_matcher = IsWord32Shl( IsWord32Sar(IsInt32Constant(std::numeric_limits<int32_t>::min()), 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 485efd6288..b07dbfd0dc 100644 --- a/deps/v8/test/unittests/compiler/js-typed-lowering-unittest.cc +++ b/deps/v8/test/unittests/compiler/js-typed-lowering-unittest.cc @@ -382,8 +382,7 @@ TEST_F(JSTypedLoweringTest, JSLoadNamedStringLength) { Reduce(graph()->NewNode(javascript()->LoadNamed(name, feedback), receiver, context, EmptyFrameState(), effect, control)); ASSERT_TRUE(r.Changed()); - EXPECT_THAT(r.replacement(), IsLoadField(AccessBuilder::ForStringLength(), - receiver, effect, control)); + EXPECT_THAT(r.replacement(), IsStringLength(receiver)); } diff --git a/deps/v8/test/unittests/compiler/linkage-tail-call-unittest.cc b/deps/v8/test/unittests/compiler/linkage-tail-call-unittest.cc index 741021a446..17dc998f6d 100644 --- a/deps/v8/test/unittests/compiler/linkage-tail-call-unittest.cc +++ b/deps/v8/test/unittests/compiler/linkage-tail-call-unittest.cc @@ -157,7 +157,9 @@ TEST_F(LinkageTailCall, MoreRegisterAndStackParametersCallee) { Node* const node = Node::New(zone(), 1, op, 0, nullptr, false); EXPECT_TRUE(desc1->CanTailCall(node)); int stack_param_delta = desc2->GetStackParameterDelta(desc1); - EXPECT_EQ(1, stack_param_delta); + // We might need to add one slot of padding to the callee arguments. + int expected = kPadArguments ? 2 : 1; + EXPECT_EQ(expected, stack_param_delta); } @@ -178,7 +180,9 @@ TEST_F(LinkageTailCall, MoreRegisterAndStackParametersCaller) { Node* const node = Node::New(zone(), 1, op, 0, nullptr, false); EXPECT_TRUE(desc1->CanTailCall(node)); int stack_param_delta = desc2->GetStackParameterDelta(desc1); - EXPECT_EQ(-1, stack_param_delta); + // We might need to drop one slot of padding from the caller's arguments. + int expected = kPadArguments ? -2 : -1; + EXPECT_EQ(expected, stack_param_delta); } @@ -313,7 +317,9 @@ TEST_F(LinkageTailCall, MatchingStackParametersExtraCallerRegistersAndStack) { Node::New(zone(), 1, op, arraysize(parameters), parameters, false); EXPECT_TRUE(desc1->CanTailCall(node)); int stack_param_delta = desc2->GetStackParameterDelta(desc1); - EXPECT_EQ(-1, stack_param_delta); + // We might need to add one slot of padding to the callee arguments. + int expected = kPadArguments ? 0 : -1; + EXPECT_EQ(expected, stack_param_delta); } @@ -341,7 +347,9 @@ TEST_F(LinkageTailCall, MatchingStackParametersExtraCalleeRegistersAndStack) { Node::New(zone(), 1, op, arraysize(parameters), parameters, false); EXPECT_TRUE(desc1->CanTailCall(node)); int stack_param_delta = desc2->GetStackParameterDelta(desc1); - EXPECT_EQ(1, stack_param_delta); + // We might need to drop one slot of padding from the caller's arguments. + int expected = kPadArguments ? 0 : 1; + EXPECT_EQ(expected, stack_param_delta); } } // namespace compiler diff --git a/deps/v8/test/unittests/compiler/loop-peeling-unittest.cc b/deps/v8/test/unittests/compiler/loop-peeling-unittest.cc index 969f253ae1..ef129fa7f3 100644 --- a/deps/v8/test/unittests/compiler/loop-peeling-unittest.cc +++ b/deps/v8/test/unittests/compiler/loop-peeling-unittest.cc @@ -74,14 +74,14 @@ class LoopPeelingTest : public GraphTest { PeeledIteration* PeelOne() { LoopTree* loop_tree = GetLoopTree(); LoopTree::Loop* loop = loop_tree->outer_loops()[0]; - EXPECT_TRUE(LoopPeeler::CanPeel(loop_tree, loop)); - return Peel(loop_tree, loop); + LoopPeeler peeler(graph(), common(), loop_tree, zone(), source_positions()); + EXPECT_TRUE(peeler.CanPeel(loop)); + return Peel(peeler, loop); } - PeeledIteration* Peel(LoopTree* loop_tree, LoopTree::Loop* loop) { - EXPECT_TRUE(LoopPeeler::CanPeel(loop_tree, loop)); - PeeledIteration* peeled = - LoopPeeler::Peel(graph(), common(), loop_tree, loop, zone()); + PeeledIteration* Peel(LoopPeeler peeler, LoopTree::Loop* loop) { + EXPECT_TRUE(peeler.CanPeel(loop)); + PeeledIteration* peeled = peeler.Peel(loop); if (FLAG_trace_turbo_graph) { OFStream os(stdout); os << AsRPO(*graph()); @@ -250,7 +250,8 @@ TEST_F(LoopPeelingTest, SimpleNestedLoopWithCounter_peel_inner) { EXPECT_NE(nullptr, loop); EXPECT_EQ(1u, loop->depth()); - PeeledIteration* peeled = Peel(loop_tree, loop); + LoopPeeler peeler(graph(), common(), loop_tree, zone(), source_positions()); + PeeledIteration* peeled = Peel(peeler, loop); ExpectNotPeeled(outer.loop, peeled); ExpectNotPeeled(outer.branch, peeled); @@ -289,7 +290,8 @@ TEST_F(LoopPeelingTest, SimpleInnerCounter_peel_inner) { EXPECT_NE(nullptr, loop); EXPECT_EQ(1u, loop->depth()); - PeeledIteration* peeled = Peel(loop_tree, loop); + LoopPeeler peeler(graph(), common(), loop_tree, zone(), source_positions()); + PeeledIteration* peeled = Peel(peeler, loop); ExpectNotPeeled(outer.loop, peeled); ExpectNotPeeled(outer.branch, peeled); @@ -517,7 +519,8 @@ TEST_F(LoopPeelingTest, SimpleLoopWithUnmarkedExit) { { LoopTree* loop_tree = GetLoopTree(); LoopTree::Loop* loop = loop_tree->outer_loops()[0]; - EXPECT_FALSE(LoopPeeler::CanPeel(loop_tree, loop)); + LoopPeeler peeler(graph(), common(), loop_tree, zone(), source_positions()); + EXPECT_FALSE(peeler.CanPeel(loop)); } } 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 1a4476f488..4448452327 100644 --- a/deps/v8/test/unittests/compiler/machine-operator-reducer-unittest.cc +++ b/deps/v8/test/unittests/compiler/machine-operator-reducer-unittest.cc @@ -173,70 +173,116 @@ const int32_t kInt32Values[] = { 1954730266, 2008792749, 2045320228, std::numeric_limits<int32_t>::max()}; - -const int64_t kInt64Values[] = { - std::numeric_limits<int64_t>::min(), V8_INT64_C(-8974392461363618006), - V8_INT64_C(-8874367046689588135), V8_INT64_C(-8269197512118230839), - V8_INT64_C(-8146091527100606733), V8_INT64_C(-7550917981466150848), - V8_INT64_C(-7216590251577894337), V8_INT64_C(-6464086891160048440), - V8_INT64_C(-6365616494908257190), V8_INT64_C(-6305630541365849726), - V8_INT64_C(-5982222642272245453), V8_INT64_C(-5510103099058504169), - V8_INT64_C(-5496838675802432701), V8_INT64_C(-4047626578868642657), - V8_INT64_C(-4033755046900164544), V8_INT64_C(-3554299241457877041), - V8_INT64_C(-2482258764588614470), V8_INT64_C(-1688515425526875335), - V8_INT64_C(-924784137176548532), V8_INT64_C(-725316567157391307), - V8_INT64_C(-439022654781092241), V8_INT64_C(-105545757668917080), - V8_INT64_C(-2088319373), V8_INT64_C(-2073699916), - V8_INT64_C(-1844949911), V8_INT64_C(-1831090548), - V8_INT64_C(-1756711933), V8_INT64_C(-1559409497), - V8_INT64_C(-1281179700), V8_INT64_C(-1211513985), - V8_INT64_C(-1182371520), V8_INT64_C(-785934753), - V8_INT64_C(-767480697), V8_INT64_C(-705745662), - V8_INT64_C(-514362436), V8_INT64_C(-459916580), - V8_INT64_C(-312328082), V8_INT64_C(-302949707), - V8_INT64_C(-285499304), V8_INT64_C(-125701262), - V8_INT64_C(-95139843), V8_INT64_C(-32768), - V8_INT64_C(-27542), V8_INT64_C(-23600), - V8_INT64_C(-18582), V8_INT64_C(-17770), - V8_INT64_C(-9086), V8_INT64_C(-9010), - V8_INT64_C(-8244), V8_INT64_C(-2890), - V8_INT64_C(-103), V8_INT64_C(-34), - V8_INT64_C(-27), V8_INT64_C(-25), - V8_INT64_C(-9), V8_INT64_C(-7), - V8_INT64_C(0), V8_INT64_C(2), - V8_INT64_C(38), V8_INT64_C(58), - V8_INT64_C(65), V8_INT64_C(93), - V8_INT64_C(111), V8_INT64_C(1003), - V8_INT64_C(1267), V8_INT64_C(12797), - V8_INT64_C(23122), V8_INT64_C(28200), - V8_INT64_C(30888), V8_INT64_C(42648848), - V8_INT64_C(116836693), V8_INT64_C(263003643), - V8_INT64_C(571039860), V8_INT64_C(1079398689), - V8_INT64_C(1145196402), V8_INT64_C(1184846321), - V8_INT64_C(1758281648), V8_INT64_C(1859991374), - V8_INT64_C(1960251588), V8_INT64_C(2042443199), - V8_INT64_C(296220586027987448), V8_INT64_C(1015494173071134726), - V8_INT64_C(1151237951914455318), V8_INT64_C(1331941174616854174), - V8_INT64_C(2022020418667972654), V8_INT64_C(2450251424374977035), - V8_INT64_C(3668393562685561486), V8_INT64_C(4858229301215502171), - V8_INT64_C(4919426235170669383), V8_INT64_C(5034286595330341762), - V8_INT64_C(5055797915536941182), V8_INT64_C(6072389716149252074), - V8_INT64_C(6185309910199801210), V8_INT64_C(6297328311011094138), - V8_INT64_C(6932372858072165827), V8_INT64_C(8483640924987737210), - V8_INT64_C(8663764179455849203), V8_INT64_C(8877197042645298254), - V8_INT64_C(8901543506779157333), std::numeric_limits<int64_t>::max()}; - +const int64_t kInt64Values[] = {std::numeric_limits<int64_t>::min(), + int64_t{-8974392461363618006}, + int64_t{-8874367046689588135}, + int64_t{-8269197512118230839}, + int64_t{-8146091527100606733}, + int64_t{-7550917981466150848}, + int64_t{-7216590251577894337}, + int64_t{-6464086891160048440}, + int64_t{-6365616494908257190}, + int64_t{-6305630541365849726}, + int64_t{-5982222642272245453}, + int64_t{-5510103099058504169}, + int64_t{-5496838675802432701}, + int64_t{-4047626578868642657}, + int64_t{-4033755046900164544}, + int64_t{-3554299241457877041}, + int64_t{-2482258764588614470}, + int64_t{-1688515425526875335}, + int64_t{-924784137176548532}, + int64_t{-725316567157391307}, + int64_t{-439022654781092241}, + int64_t{-105545757668917080}, + int64_t{-2088319373}, + int64_t{-2073699916}, + int64_t{-1844949911}, + int64_t{-1831090548}, + int64_t{-1756711933}, + int64_t{-1559409497}, + int64_t{-1281179700}, + int64_t{-1211513985}, + int64_t{-1182371520}, + int64_t{-785934753}, + int64_t{-767480697}, + int64_t{-705745662}, + int64_t{-514362436}, + int64_t{-459916580}, + int64_t{-312328082}, + int64_t{-302949707}, + int64_t{-285499304}, + int64_t{-125701262}, + int64_t{-95139843}, + int64_t{-32768}, + int64_t{-27542}, + int64_t{-23600}, + int64_t{-18582}, + int64_t{-17770}, + int64_t{-9086}, + int64_t{-9010}, + int64_t{-8244}, + int64_t{-2890}, + int64_t{-103}, + int64_t{-34}, + int64_t{-27}, + int64_t{-25}, + int64_t{-9}, + int64_t{-7}, + int64_t{0}, + int64_t{2}, + int64_t{38}, + int64_t{58}, + int64_t{65}, + int64_t{93}, + int64_t{111}, + int64_t{1003}, + int64_t{1267}, + int64_t{12797}, + int64_t{23122}, + int64_t{28200}, + int64_t{30888}, + int64_t{42648848}, + int64_t{116836693}, + int64_t{263003643}, + int64_t{571039860}, + int64_t{1079398689}, + int64_t{1145196402}, + int64_t{1184846321}, + int64_t{1758281648}, + int64_t{1859991374}, + int64_t{1960251588}, + int64_t{2042443199}, + int64_t{296220586027987448}, + int64_t{1015494173071134726}, + int64_t{1151237951914455318}, + int64_t{1331941174616854174}, + int64_t{2022020418667972654}, + int64_t{2450251424374977035}, + int64_t{3668393562685561486}, + int64_t{4858229301215502171}, + int64_t{4919426235170669383}, + int64_t{5034286595330341762}, + int64_t{5055797915536941182}, + int64_t{6072389716149252074}, + int64_t{6185309910199801210}, + int64_t{6297328311011094138}, + int64_t{6932372858072165827}, + int64_t{8483640924987737210}, + int64_t{8663764179455849203}, + int64_t{8877197042645298254}, + int64_t{8901543506779157333}, + std::numeric_limits<int64_t>::max()}; const uint32_t kUint32Values[] = { - 0x00000000, 0x00000001, 0xffffffff, 0x1b09788b, 0x04c5fce8, 0xcc0de5bf, - 0x273a798e, 0x187937a3, 0xece3af83, 0x5495a16b, 0x0b668ecc, 0x11223344, - 0x0000009e, 0x00000043, 0x0000af73, 0x0000116b, 0x00658ecc, 0x002b3b4c, - 0x88776655, 0x70000000, 0x07200000, 0x7fffffff, 0x56123761, 0x7fffff00, - 0x761c4761, 0x80000000, 0x88888888, 0xa0000000, 0xdddddddd, 0xe0000000, - 0xeeeeeeee, 0xfffffffd, 0xf0000000, 0x007fffff, 0x003fffff, 0x001fffff, - 0x000fffff, 0x0007ffff, 0x0003ffff, 0x0001ffff, 0x0000ffff, 0x00007fff, - 0x00003fff, 0x00001fff, 0x00000fff, 0x000007ff, 0x000003ff, 0x000001ff}; - + 0x00000000, 0x00000001, 0xFFFFFFFF, 0x1B09788B, 0x04C5FCE8, 0xCC0DE5BF, + 0x273A798E, 0x187937A3, 0xECE3AF83, 0x5495A16B, 0x0B668ECC, 0x11223344, + 0x0000009E, 0x00000043, 0x0000AF73, 0x0000116B, 0x00658ECC, 0x002B3B4C, + 0x88776655, 0x70000000, 0x07200000, 0x7FFFFFFF, 0x56123761, 0x7FFFFF00, + 0x761C4761, 0x80000000, 0x88888888, 0xA0000000, 0xDDDDDDDD, 0xE0000000, + 0xEEEEEEEE, 0xFFFFFFFD, 0xF0000000, 0x007FFFFF, 0x003FFFFF, 0x001FFFFF, + 0x000FFFFF, 0x0007FFFF, 0x0003FFFF, 0x0001FFFF, 0x0000FFFF, 0x00007FFF, + 0x00003FFF, 0x00001FFF, 0x00000FFF, 0x000007FF, 0x000003FF, 0x000001FF}; struct ComparisonBinaryOperator { const Operator* (MachineOperatorBuilder::*constructor)(); @@ -1653,7 +1699,7 @@ TEST_F(MachineOperatorReducerTest, Float64DivWithMinusOne) { TEST_F(MachineOperatorReducerTest, Float64DivWithPowerOfTwo) { Node* const p0 = Parameter(0); - TRACED_FORRANGE(uint64_t, exponent, 1, 0x7fe) { + TRACED_FORRANGE(uint64_t, exponent, 1, 0x7FE) { Double divisor = Double(exponent << Double::kPhysicalSignificandSize); if (divisor.value() == 1.0) continue; // Skip x / 1.0 => x. Reduction r = Reduce(graph()->NewNode(machine()->Float64Div(), p0, @@ -1946,7 +1992,7 @@ TEST_F(MachineOperatorReducerTest, Float64InsertLowWord32WithConstant) { EXPECT_THAT( r.replacement(), IsFloat64Constant(BitEq(bit_cast<double>( - (bit_cast<uint64_t>(x) & V8_UINT64_C(0xFFFFFFFF00000000)) | y)))); + (bit_cast<uint64_t>(x) & uint64_t{0xFFFFFFFF00000000}) | y)))); } } } @@ -1965,7 +2011,7 @@ TEST_F(MachineOperatorReducerTest, Float64InsertHighWord32WithConstant) { ASSERT_TRUE(r.Changed()); EXPECT_THAT(r.replacement(), IsFloat64Constant(BitEq(bit_cast<double>( - (bit_cast<uint64_t>(x) & V8_UINT64_C(0xFFFFFFFF)) | + (bit_cast<uint64_t>(x) & uint64_t{0xFFFFFFFF}) | (static_cast<uint64_t>(y) << 32))))); } } @@ -2110,7 +2156,7 @@ TEST_F(MachineOperatorReducerTest, StoreRepWord8WithWord32And) { Node* const node = graph()->NewNode(machine()->Store(rep), base, index, graph()->NewNode(machine()->Word32And(), value, - Uint32Constant(x | 0xffu)), + Uint32Constant(x | 0xFFu)), effect, control); Reduction r = Reduce(node); @@ -2157,7 +2203,7 @@ TEST_F(MachineOperatorReducerTest, StoreRepWord16WithWord32And) { Node* const node = graph()->NewNode(machine()->Store(rep), base, index, graph()->NewNode(machine()->Word32And(), value, - Uint32Constant(x | 0xffffu)), + Uint32Constant(x | 0xFFFFu)), effect, control); Reduction r = Reduce(node); diff --git a/deps/v8/test/unittests/compiler/mips/instruction-selector-mips-unittest.cc b/deps/v8/test/unittests/compiler/mips/instruction-selector-mips-unittest.cc index 2f1e7e8be2..34faec9690 100644 --- a/deps/v8/test/unittests/compiler/mips/instruction-selector-mips-unittest.cc +++ b/deps/v8/test/unittests/compiler/mips/instruction-selector-mips-unittest.cc @@ -356,11 +356,11 @@ TEST_F(InstructionSelectorTest, Word32ShrWithWord32AndWithImmediate) { // The available shift operand range is `0 <= imm < 32`, but we also test // that immediates outside this range are handled properly (modulo-32). TRACED_FORRANGE(int32_t, shift, -32, 63) { - int32_t lsb = shift & 0x1f; + int32_t lsb = shift & 0x1F; TRACED_FORRANGE(int32_t, width, 1, 32 - lsb) { uint32_t jnk = rng()->NextInt(); jnk = (lsb > 0) ? (jnk >> (32 - lsb)) : 0; - uint32_t msk = ((0xffffffffu >> (32 - width)) << lsb) | jnk; + uint32_t msk = ((0xFFFFFFFFu >> (32 - width)) << lsb) | jnk; StreamBuilder m(this, MachineType::Int32(), MachineType::Int32()); m.Return(m.Word32Shr(m.Word32And(m.Parameter(0), m.Int32Constant(msk)), m.Int32Constant(shift))); @@ -373,11 +373,11 @@ TEST_F(InstructionSelectorTest, Word32ShrWithWord32AndWithImmediate) { } } TRACED_FORRANGE(int32_t, shift, -32, 63) { - int32_t lsb = shift & 0x1f; + int32_t lsb = shift & 0x1F; TRACED_FORRANGE(int32_t, width, 1, 32 - lsb) { uint32_t jnk = rng()->NextInt(); jnk = (lsb > 0) ? (jnk >> (32 - lsb)) : 0; - uint32_t msk = ((0xffffffffu >> (32 - width)) << lsb) | jnk; + uint32_t msk = ((0xFFFFFFFFu >> (32 - width)) << lsb) | jnk; StreamBuilder m(this, MachineType::Int32(), MachineType::Int32()); m.Return(m.Word32Shr(m.Word32And(m.Int32Constant(msk), m.Parameter(0)), m.Int32Constant(shift))); @@ -517,7 +517,7 @@ TEST_F(InstructionSelectorTest, Word32AndWithImmediateWithWord32Shr) { // The available shift operand range is `0 <= imm < 32`, but we also test // that immediates outside this range are handled properly (modulo-32). TRACED_FORRANGE(int32_t, shift, -32, 63) { - int32_t lsb = shift & 0x1f; + int32_t lsb = shift & 0x1F; TRACED_FORRANGE(int32_t, width, 1, 31) { uint32_t msk = (1 << width) - 1; StreamBuilder m(this, MachineType::Int32(), MachineType::Int32()); @@ -533,7 +533,7 @@ TEST_F(InstructionSelectorTest, Word32AndWithImmediateWithWord32Shr) { } } TRACED_FORRANGE(int32_t, shift, -32, 63) { - int32_t lsb = shift & 0x1f; + int32_t lsb = shift & 0x1F; TRACED_FORRANGE(int32_t, width, 1, 31) { uint32_t msk = (1 << width) - 1; StreamBuilder m(this, MachineType::Int32(), MachineType::Int32()); diff --git a/deps/v8/test/unittests/compiler/mips64/instruction-selector-mips64-unittest.cc b/deps/v8/test/unittests/compiler/mips64/instruction-selector-mips64-unittest.cc index 74af374379..c090e29321 100644 --- a/deps/v8/test/unittests/compiler/mips64/instruction-selector-mips64-unittest.cc +++ b/deps/v8/test/unittests/compiler/mips64/instruction-selector-mips64-unittest.cc @@ -400,11 +400,11 @@ TEST_F(InstructionSelectorTest, Word32ShrWithWord32AndWithImmediate) { // The available shift operand range is `0 <= imm < 32`, but we also test // that immediates outside this range are handled properly (modulo-32). TRACED_FORRANGE(int32_t, shift, -32, 63) { - int32_t lsb = shift & 0x1f; + int32_t lsb = shift & 0x1F; TRACED_FORRANGE(int32_t, width, 1, 32 - lsb) { uint32_t jnk = rng()->NextInt(); jnk = (lsb > 0) ? (jnk >> (32 - lsb)) : 0; - uint32_t msk = ((0xffffffffu >> (32 - width)) << lsb) | jnk; + uint32_t msk = ((0xFFFFFFFFu >> (32 - width)) << lsb) | jnk; StreamBuilder m(this, MachineType::Int32(), MachineType::Int32()); m.Return(m.Word32Shr(m.Word32And(m.Parameter(0), m.Int32Constant(msk)), m.Int32Constant(shift))); @@ -417,11 +417,11 @@ TEST_F(InstructionSelectorTest, Word32ShrWithWord32AndWithImmediate) { } } TRACED_FORRANGE(int32_t, shift, -32, 63) { - int32_t lsb = shift & 0x1f; + int32_t lsb = shift & 0x1F; TRACED_FORRANGE(int32_t, width, 1, 32 - lsb) { uint32_t jnk = rng()->NextInt(); jnk = (lsb > 0) ? (jnk >> (32 - lsb)) : 0; - uint32_t msk = ((0xffffffffu >> (32 - width)) << lsb) | jnk; + uint32_t msk = ((0xFFFFFFFFu >> (32 - width)) << lsb) | jnk; StreamBuilder m(this, MachineType::Int32(), MachineType::Int32()); m.Return(m.Word32Shr(m.Word32And(m.Int32Constant(msk), m.Parameter(0)), m.Int32Constant(shift))); @@ -440,12 +440,12 @@ TEST_F(InstructionSelectorTest, Word64ShrWithWord64AndWithImmediate) { // The available shift operand range is `0 <= imm < 64`, but we also test // that immediates outside this range are handled properly (modulo-64). TRACED_FORRANGE(int32_t, shift, -64, 127) { - int32_t lsb = shift & 0x3f; + int32_t lsb = shift & 0x3F; TRACED_FORRANGE(int32_t, width, 1, 64 - lsb) { uint64_t jnk = rng()->NextInt64(); jnk = (lsb > 0) ? (jnk >> (64 - lsb)) : 0; uint64_t msk = - ((V8_UINT64_C(0xffffffffffffffff) >> (64 - width)) << lsb) | jnk; + ((uint64_t{0xFFFFFFFFFFFFFFFF} >> (64 - width)) << lsb) | jnk; StreamBuilder m(this, MachineType::Int64(), MachineType::Int64()); m.Return(m.Word64Shr(m.Word64And(m.Parameter(0), m.Int64Constant(msk)), m.Int64Constant(shift))); @@ -458,12 +458,12 @@ TEST_F(InstructionSelectorTest, Word64ShrWithWord64AndWithImmediate) { } } TRACED_FORRANGE(int32_t, shift, -64, 127) { - int32_t lsb = shift & 0x3f; + int32_t lsb = shift & 0x3F; TRACED_FORRANGE(int32_t, width, 1, 64 - lsb) { uint64_t jnk = rng()->NextInt64(); jnk = (lsb > 0) ? (jnk >> (64 - lsb)) : 0; uint64_t msk = - ((V8_UINT64_C(0xffffffffffffffff) >> (64 - width)) << lsb) | jnk; + ((uint64_t{0xFFFFFFFFFFFFFFFF} >> (64 - width)) << lsb) | jnk; StreamBuilder m(this, MachineType::Int64(), MachineType::Int64()); m.Return(m.Word64Shr(m.Word64And(m.Int64Constant(msk), m.Parameter(0)), m.Int64Constant(shift))); @@ -649,7 +649,7 @@ TEST_F(InstructionSelectorTest, Word32AndWithImmediateWithWord32Shr) { // The available shift operand range is `0 <= imm < 32`, but we also test // that immediates outside this range are handled properly (modulo-32). TRACED_FORRANGE(int32_t, shift, -32, 63) { - int32_t lsb = shift & 0x1f; + int32_t lsb = shift & 0x1F; TRACED_FORRANGE(int32_t, width, 1, 31) { uint32_t msk = (1 << width) - 1; StreamBuilder m(this, MachineType::Int32(), MachineType::Int32()); @@ -665,7 +665,7 @@ TEST_F(InstructionSelectorTest, Word32AndWithImmediateWithWord32Shr) { } } TRACED_FORRANGE(int32_t, shift, -32, 63) { - int32_t lsb = shift & 0x1f; + int32_t lsb = shift & 0x1F; TRACED_FORRANGE(int32_t, width, 1, 31) { uint32_t msk = (1 << width) - 1; StreamBuilder m(this, MachineType::Int32(), MachineType::Int32()); @@ -688,9 +688,9 @@ TEST_F(InstructionSelectorTest, Word64AndWithImmediateWithWord64Shr) { // The available shift operand range is `0 <= imm < 64`, but we also test // that immediates outside this range are handled properly (modulo-64). TRACED_FORRANGE(int64_t, shift, -64, 127) { - int64_t lsb = shift & 0x3f; + int64_t lsb = shift & 0x3F; TRACED_FORRANGE(int64_t, width, 1, 63) { - uint64_t msk = (V8_UINT64_C(1) << width) - 1; + uint64_t msk = (uint64_t{1} << width) - 1; StreamBuilder m(this, MachineType::Int64(), MachineType::Int64()); m.Return(m.Word64And(m.Word64Shr(m.Parameter(0), m.Int64Constant(shift)), m.Int64Constant(msk))); @@ -704,9 +704,9 @@ TEST_F(InstructionSelectorTest, Word64AndWithImmediateWithWord64Shr) { } } TRACED_FORRANGE(int64_t, shift, -64, 127) { - int64_t lsb = shift & 0x3f; + int64_t lsb = shift & 0x3F; TRACED_FORRANGE(int64_t, width, 1, 63) { - uint64_t msk = (V8_UINT64_C(1) << width) - 1; + uint64_t msk = (uint64_t{1} << width) - 1; StreamBuilder m(this, MachineType::Int64(), MachineType::Int64()); m.Return( m.Word64And(m.Int64Constant(msk), diff --git a/deps/v8/test/unittests/compiler/node-test-utils.cc b/deps/v8/test/unittests/compiler/node-test-utils.cc index 52fd02b0a6..8e7084d1b1 100644 --- a/deps/v8/test/unittests/compiler/node-test-utils.cc +++ b/deps/v8/test/unittests/compiler/node-test-utils.cc @@ -2182,6 +2182,7 @@ IS_UNOP_MATCHER(ObjectIsReceiver) IS_UNOP_MATCHER(ObjectIsSmi) IS_UNOP_MATCHER(ObjectIsUndetectable) IS_UNOP_MATCHER(StringFromCharCode) +IS_UNOP_MATCHER(StringLength) IS_UNOP_MATCHER(Word32Clz) IS_UNOP_MATCHER(Word32Ctz) IS_UNOP_MATCHER(Word32Popcnt) diff --git a/deps/v8/test/unittests/compiler/node-test-utils.h b/deps/v8/test/unittests/compiler/node-test-utils.h index 81e471f30f..3ce6aba0f3 100644 --- a/deps/v8/test/unittests/compiler/node-test-utils.h +++ b/deps/v8/test/unittests/compiler/node-test-utils.h @@ -272,6 +272,7 @@ 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*> IsStringFromCharCode(const Matcher<Node*>& value_matcher); +Matcher<Node*> IsStringLength(const Matcher<Node*>& value_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/regalloc/move-optimizer-unittest.cc b/deps/v8/test/unittests/compiler/regalloc/move-optimizer-unittest.cc index 0ad114241f..8b3e93fdce 100644 --- a/deps/v8/test/unittests/compiler/regalloc/move-optimizer-unittest.cc +++ b/deps/v8/test/unittests/compiler/regalloc/move-optimizer-unittest.cc @@ -94,8 +94,7 @@ class MoveOptimizerTest : public InstructionSequenceTest { default: break; } - CHECK(false); - return InstructionOperand(); + UNREACHABLE(); } }; diff --git a/deps/v8/test/unittests/compiler/simplified-lowering-unittest.cc b/deps/v8/test/unittests/compiler/simplified-lowering-unittest.cc new file mode 100644 index 0000000000..5f5afe54ef --- /dev/null +++ b/deps/v8/test/unittests/compiler/simplified-lowering-unittest.cc @@ -0,0 +1,89 @@ +// Copyright 2017 the V8 project authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "src/compiler/simplified-lowering.h" + +#include "src/compiler/compiler-source-position-table.h" +#include "src/compiler/machine-operator.h" +#include "src/compiler/simplified-operator.h" + +#include "test/unittests/compiler/graph-unittest.h" +#include "test/unittests/compiler/node-test-utils.h" + +namespace v8 { +namespace internal { +namespace compiler { + +class SimplifiedLoweringTest : public GraphTest { + public: + explicit SimplifiedLoweringTest(int num_parameters = 1) + : GraphTest(num_parameters), + num_parameters_(num_parameters), + machine_(zone()), + javascript_(zone()), + simplified_(zone()), + jsgraph_(isolate(), graph(), common(), &javascript_, &simplified_, + &machine_) {} + ~SimplifiedLoweringTest() override {} + + void LowerGraph(Node* node) { + // Make sure we always start with an empty graph. + graph()->SetStart(graph()->NewNode(common()->Start(num_parameters()))); + graph()->SetEnd(graph()->NewNode(common()->End(1), graph()->start())); + + // Return {node} directly, so that we can match it with + // "IsReturn(expected)". + Node* zero = graph()->NewNode(common()->NumberConstant(0)); + Node* ret = graph()->NewNode(common()->Return(), zero, node, + graph()->start(), graph()->start()); + NodeProperties::MergeControlToEnd(graph(), common(), ret); + + { + // 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(), Typer::kNoFlags, graph()); + typer.Run(); + } + + SimplifiedLowering lowering(jsgraph(), zone(), source_positions()); + lowering.LowerAllNodes(); + } + + int num_parameters() const { return num_parameters_; } + JSGraph* jsgraph() { return &jsgraph_; } + + private: + const int num_parameters_; + MachineOperatorBuilder machine_; + JSOperatorBuilder javascript_; + SimplifiedOperatorBuilder simplified_; + JSGraph jsgraph_; +}; + +const int kSmiValues[] = {Smi::kMinValue, + Smi::kMinValue + 1, + Smi::kMinValue + 2, + 3, + 2, + 1, + 0, + -1, + -2, + -3, + Smi::kMaxValue - 2, + Smi::kMaxValue - 1, + Smi::kMaxValue}; + +TEST_F(SimplifiedLoweringTest, SmiConstantToIntPtrConstant) { + TRACED_FOREACH(int, x, kSmiValues) { + LowerGraph(jsgraph()->Constant(x)); + intptr_t smi = bit_cast<intptr_t>(Smi::FromInt(x)); + EXPECT_THAT(graph()->end()->InputAt(1), + IsReturn(IsIntPtrConstant(smi), start(), start())); + } +} + +} // namespace compiler +} // namespace internal +} // namespace v8 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 2e67c0d4df..5dd7d84fbd 100644 --- a/deps/v8/test/unittests/compiler/simplified-operator-reducer-unittest.cc +++ b/deps/v8/test/unittests/compiler/simplified-operator-reducer-unittest.cc @@ -92,11 +92,10 @@ const int32_t kInt32Values[] = { 1062628108, 1087581664, 1488498068, 1534668023, 1661587028, 1696896187, 1866841746, 2032089723, 2147483647}; - const double kNaNs[] = {-std::numeric_limits<double>::quiet_NaN(), std::numeric_limits<double>::quiet_NaN(), - bit_cast<double>(V8_UINT64_C(0x7FFFFFFFFFFFFFFF)), - bit_cast<double>(V8_UINT64_C(0xFFFFFFFFFFFFFFFF))}; + bit_cast<double>(uint64_t{0x7FFFFFFFFFFFFFFF}), + bit_cast<double>(uint64_t{0xFFFFFFFFFFFFFFFF})}; const CheckForMinusZeroMode kCheckForMinusZeroModes[] = { CheckForMinusZeroMode::kDontCheckForMinusZero, @@ -357,10 +356,10 @@ TEST_F(SimplifiedOperatorReducerTest, CheckedFloat64ToInt32WithConstant) { Node* effect = graph()->start(); Node* control = graph()->start(); TRACED_FOREACH(int32_t, n, kInt32Values) { - Reduction r = Reduce( - graph()->NewNode(simplified()->CheckedFloat64ToInt32( - CheckForMinusZeroMode::kDontCheckForMinusZero), - Float64Constant(n), effect, control)); + Reduction r = Reduce(graph()->NewNode( + simplified()->CheckedFloat64ToInt32( + CheckForMinusZeroMode::kDontCheckForMinusZero, VectorSlotPair()), + Float64Constant(n), effect, control)); ASSERT_TRUE(r.Changed()); EXPECT_THAT(r.replacement(), IsInt32Constant(n)); } @@ -416,8 +415,8 @@ TEST_F(SimplifiedOperatorReducerTest, CheckSmiWithChangeInt31ToTaggedSigned) { Node* control = graph()->start(); Node* value = graph()->NewNode(simplified()->ChangeInt31ToTaggedSigned(), param0); - Reduction reduction = Reduce( - graph()->NewNode(simplified()->CheckSmi(), value, effect, control)); + Reduction reduction = Reduce(graph()->NewNode( + simplified()->CheckSmi(VectorSlotPair()), value, effect, control)); ASSERT_TRUE(reduction.Changed()); EXPECT_EQ(value, reduction.replacement()); } @@ -426,8 +425,8 @@ TEST_F(SimplifiedOperatorReducerTest, CheckSmiWithNumberConstant) { Node* effect = graph()->start(); Node* control = graph()->start(); Node* value = NumberConstant(1.0); - Reduction reduction = Reduce( - graph()->NewNode(simplified()->CheckSmi(), value, effect, control)); + Reduction reduction = Reduce(graph()->NewNode( + simplified()->CheckSmi(VectorSlotPair()), value, effect, control)); ASSERT_TRUE(reduction.Changed()); EXPECT_EQ(value, reduction.replacement()); } @@ -436,10 +435,10 @@ TEST_F(SimplifiedOperatorReducerTest, CheckSmiWithCheckSmi) { Node* param0 = Parameter(0); Node* effect = graph()->start(); Node* control = graph()->start(); - Node* value = effect = - graph()->NewNode(simplified()->CheckSmi(), param0, effect, control); - Reduction reduction = Reduce( - graph()->NewNode(simplified()->CheckSmi(), value, effect, control)); + Node* value = effect = graph()->NewNode( + simplified()->CheckSmi(VectorSlotPair()), param0, effect, control); + Reduction reduction = Reduce(graph()->NewNode( + simplified()->CheckSmi(VectorSlotPair()), value, effect, control)); ASSERT_TRUE(reduction.Changed()); EXPECT_EQ(value, reduction.replacement()); } diff --git a/deps/v8/test/unittests/compiler/state-values-utils-unittest.cc b/deps/v8/test/unittests/compiler/state-values-utils-unittest.cc index 388dd56247..d53e7d9462 100644 --- a/deps/v8/test/unittests/compiler/state-values-utils-unittest.cc +++ b/deps/v8/test/unittests/compiler/state-values-utils-unittest.cc @@ -45,10 +45,12 @@ TEST_F(StateValuesIteratorTest, SimpleIteration) { TEST_F(StateValuesIteratorTest, EmptyIteration) { NodeVector inputs(zone()); Node* state_values = StateValuesFromVector(&inputs); + bool empty = true; for (auto node : StateValuesAccess(state_values)) { USE(node); - FAIL(); + empty = false; } + EXPECT_TRUE(empty); } diff --git a/deps/v8/test/unittests/compiler/typer-unittest.cc b/deps/v8/test/unittests/compiler/typer-unittest.cc index 40f3efd2cf..44464b9476 100644 --- a/deps/v8/test/unittests/compiler/typer-unittest.cc +++ b/deps/v8/test/unittests/compiler/typer-unittest.cc @@ -297,8 +297,8 @@ class TyperTest : public TypedGraphTest { namespace { -int32_t shift_left(int32_t x, int32_t y) { return x << (y & 0x1f); } -int32_t shift_right(int32_t x, int32_t y) { return x >> (y & 0x1f); } +int32_t shift_left(int32_t x, int32_t y) { return x << (y & 0x1F); } +int32_t shift_right(int32_t x, int32_t y) { return x >> (y & 0x1F); } int32_t bit_or(int32_t x, int32_t y) { return x | y; } int32_t bit_and(int32_t x, int32_t y) { return x & y; } int32_t bit_xor(int32_t x, int32_t y) { return x ^ y; } diff --git a/deps/v8/test/unittests/compiler/x64/instruction-selector-x64-unittest.cc b/deps/v8/test/unittests/compiler/x64/instruction-selector-x64-unittest.cc index d1497392f9..031217b6b8 100644 --- a/deps/v8/test/unittests/compiler/x64/instruction-selector-x64-unittest.cc +++ b/deps/v8/test/unittests/compiler/x64/instruction-selector-x64-unittest.cc @@ -1519,12 +1519,11 @@ TEST_F(InstructionSelectorTest, Word64ShlWithChangeUint32ToUint64) { } } - -TEST_F(InstructionSelectorTest, Word32AndWith0xff) { +TEST_F(InstructionSelectorTest, Word32AndWith0xFF) { { StreamBuilder m(this, MachineType::Int32(), MachineType::Int32()); Node* const p0 = m.Parameter(0); - Node* const n = m.Word32And(p0, m.Int32Constant(0xff)); + Node* const n = m.Word32And(p0, m.Int32Constant(0xFF)); m.Return(n); Stream s = m.Build(); ASSERT_EQ(1U, s.size()); @@ -1537,7 +1536,7 @@ TEST_F(InstructionSelectorTest, Word32AndWith0xff) { { StreamBuilder m(this, MachineType::Int32(), MachineType::Int32()); Node* const p0 = m.Parameter(0); - Node* const n = m.Word32And(m.Int32Constant(0xff), p0); + Node* const n = m.Word32And(m.Int32Constant(0xFF), p0); m.Return(n); Stream s = m.Build(); ASSERT_EQ(1U, s.size()); @@ -1549,12 +1548,11 @@ TEST_F(InstructionSelectorTest, Word32AndWith0xff) { } } - -TEST_F(InstructionSelectorTest, Word32AndWith0xffff) { +TEST_F(InstructionSelectorTest, Word32AndWith0xFFFF) { { StreamBuilder m(this, MachineType::Int32(), MachineType::Int32()); Node* const p0 = m.Parameter(0); - Node* const n = m.Word32And(p0, m.Int32Constant(0xffff)); + Node* const n = m.Word32And(p0, m.Int32Constant(0xFFFF)); m.Return(n); Stream s = m.Build(); ASSERT_EQ(1U, s.size()); @@ -1567,7 +1565,7 @@ TEST_F(InstructionSelectorTest, Word32AndWith0xffff) { { StreamBuilder m(this, MachineType::Int32(), MachineType::Int32()); Node* const p0 = m.Parameter(0); - Node* const n = m.Word32And(m.Int32Constant(0xffff), p0); + Node* const n = m.Word32And(m.Int32Constant(0xFFFF), p0); m.Return(n); Stream s = m.Build(); ASSERT_EQ(1U, s.size()); @@ -1643,6 +1641,15 @@ TEST_F(InstructionSelectorTest, LoadAndWord64ShiftRight32) { } } +TEST_F(InstructionSelectorTest, SpeculationFence) { + StreamBuilder m(this, MachineType::Int32()); + m.SpeculationFence(); + m.Return(m.Int32Constant(0)); + Stream s = m.Build(); + ASSERT_EQ(1U, s.size()); + EXPECT_EQ(kLFence, s[0]->arch_opcode()); +} + } // namespace compiler } // namespace internal } // namespace v8 diff --git a/deps/v8/test/unittests/counters-unittest.cc b/deps/v8/test/unittests/counters-unittest.cc index d32d01060e..887ba54e01 100644 --- a/deps/v8/test/unittests/counters-unittest.cc +++ b/deps/v8/test/unittests/counters-unittest.cc @@ -4,6 +4,7 @@ #include <vector> +#include "src/base/atomic-utils.h" #include "src/base/platform/time.h" #include "src/counters-inl.h" #include "src/counters.h" @@ -55,8 +56,9 @@ static base::TimeTicks RuntimeCallStatsTestNow() { class RuntimeCallStatsTest : public TestWithNativeContext { public: RuntimeCallStatsTest() { - FLAG_runtime_stats = - v8::tracing::TracingCategoryObserver::ENABLED_BY_NATIVE; + base::AsAtomic32::Relaxed_Store( + &FLAG_runtime_stats, + v8::tracing::TracingCategoryObserver::ENABLED_BY_NATIVE); // We need to set {time_} to a non-zero value since it would otherwise // cause runtime call timers to think they are uninitialized. Sleep(1); @@ -67,7 +69,7 @@ class RuntimeCallStatsTest : public TestWithNativeContext { // Disable RuntimeCallStats before tearing down the isolate to prevent // printing the tests table. Comment the following line for debugging // purposes. - FLAG_runtime_stats = 0; + base::AsAtomic32::Relaxed_Store(&FLAG_runtime_stats, 0); } static void SetUpTestCase() { @@ -89,22 +91,24 @@ class RuntimeCallStatsTest : public TestWithNativeContext { // Print current RuntimeCallStats table. For debugging purposes. void PrintStats() { stats()->Print(); } - RuntimeCallStats::CounterId counter_id() { - return &RuntimeCallStats::TestCounter1; + RuntimeCallCounterId counter_id() { + return RuntimeCallCounterId::kTestCounter1; } - RuntimeCallStats::CounterId counter_id2() { - return &RuntimeCallStats::TestCounter2; + RuntimeCallCounterId counter_id2() { + return RuntimeCallCounterId::kTestCounter2; } - RuntimeCallStats::CounterId counter_id3() { - return &RuntimeCallStats::TestCounter3; + RuntimeCallCounterId counter_id3() { + return RuntimeCallCounterId::kTestCounter3; } - RuntimeCallCounter* js_counter() { return &stats()->JS_Execution; } - RuntimeCallCounter* counter() { return &(stats()->*counter_id()); } - RuntimeCallCounter* counter2() { return &(stats()->*counter_id2()); } - RuntimeCallCounter* counter3() { return &(stats()->*counter_id3()); } + RuntimeCallCounter* js_counter() { + return stats()->GetCounter(RuntimeCallCounterId::kJS_Execution); + } + RuntimeCallCounter* counter() { return stats()->GetCounter(counter_id()); } + RuntimeCallCounter* counter2() { return stats()->GetCounter(counter_id2()); } + RuntimeCallCounter* counter3() { return stats()->GetCounter(counter_id3()); } void Sleep(int64_t microseconds) { base::TimeDelta delta = base::TimeDelta::FromMicroseconds(microseconds); @@ -300,7 +304,7 @@ TEST_F(RuntimeCallStatsTest, RuntimeCallTimer) { RuntimeCallTimer timer; Sleep(50); - RuntimeCallStats::Enter(stats(), &timer, counter_id()); + stats()->Enter(&timer, counter_id()); EXPECT_EQ(counter(), timer.counter()); EXPECT_EQ(nullptr, timer.parent()); EXPECT_TRUE(timer.IsStarted()); @@ -308,7 +312,7 @@ TEST_F(RuntimeCallStatsTest, RuntimeCallTimer) { Sleep(100); - RuntimeCallStats::Leave(stats(), &timer); + stats()->Leave(&timer); Sleep(50); EXPECT_FALSE(timer.IsStarted()); EXPECT_EQ(1, counter()->count()); @@ -319,7 +323,7 @@ TEST_F(RuntimeCallStatsTest, RuntimeCallTimerSubTimer) { RuntimeCallTimer timer; RuntimeCallTimer timer2; - RuntimeCallStats::Enter(stats(), &timer, counter_id()); + stats()->Enter(&timer, counter_id()); EXPECT_TRUE(timer.IsStarted()); EXPECT_FALSE(timer2.IsStarted()); EXPECT_EQ(counter(), timer.counter()); @@ -328,7 +332,7 @@ TEST_F(RuntimeCallStatsTest, RuntimeCallTimerSubTimer) { Sleep(50); - RuntimeCallStats::Enter(stats(), &timer2, counter_id2()); + stats()->Enter(&timer2, counter_id2()); // timer 1 is paused, while timer 2 is active. EXPECT_TRUE(timer2.IsStarted()); EXPECT_EQ(counter(), timer.counter()); @@ -338,7 +342,7 @@ TEST_F(RuntimeCallStatsTest, RuntimeCallTimerSubTimer) { EXPECT_EQ(&timer2, stats()->current_timer()); Sleep(100); - RuntimeCallStats::Leave(stats(), &timer2); + stats()->Leave(&timer2); // The subtimer subtracts its time from the parent timer. EXPECT_TRUE(timer.IsStarted()); @@ -351,7 +355,7 @@ TEST_F(RuntimeCallStatsTest, RuntimeCallTimerSubTimer) { Sleep(100); - RuntimeCallStats::Leave(stats(), &timer); + stats()->Leave(&timer); EXPECT_FALSE(timer.IsStarted()); EXPECT_EQ(1, counter()->count()); EXPECT_EQ(1, counter2()->count()); @@ -364,13 +368,13 @@ TEST_F(RuntimeCallStatsTest, RuntimeCallTimerRecursive) { RuntimeCallTimer timer; RuntimeCallTimer timer2; - RuntimeCallStats::Enter(stats(), &timer, counter_id()); + stats()->Enter(&timer, counter_id()); EXPECT_EQ(counter(), timer.counter()); EXPECT_EQ(nullptr, timer.parent()); EXPECT_TRUE(timer.IsStarted()); EXPECT_EQ(&timer, stats()->current_timer()); - RuntimeCallStats::Enter(stats(), &timer2, counter_id()); + stats()->Enter(&timer2, counter_id()); EXPECT_EQ(counter(), timer2.counter()); EXPECT_EQ(nullptr, timer.parent()); EXPECT_EQ(&timer, timer2.parent()); @@ -379,7 +383,7 @@ TEST_F(RuntimeCallStatsTest, RuntimeCallTimerRecursive) { Sleep(50); - RuntimeCallStats::Leave(stats(), &timer2); + stats()->Leave(&timer2); EXPECT_EQ(nullptr, timer.parent()); EXPECT_FALSE(timer2.IsStarted()); EXPECT_TRUE(timer.IsStarted()); @@ -388,7 +392,7 @@ TEST_F(RuntimeCallStatsTest, RuntimeCallTimerRecursive) { Sleep(100); - RuntimeCallStats::Leave(stats(), &timer); + stats()->Leave(&timer); EXPECT_FALSE(timer.IsStarted()); EXPECT_EQ(2, counter()->count()); EXPECT_EQ(150, counter()->time().InMicroseconds()); @@ -439,7 +443,8 @@ TEST_F(RuntimeCallStatsTest, RenameTimer) { RuntimeCallTimerScope scope(stats(), counter_id()); Sleep(100); } - CHANGE_CURRENT_RUNTIME_COUNTER(stats(), TestCounter2); + CHANGE_CURRENT_RUNTIME_COUNTER(stats(), + RuntimeCallCounterId::kTestCounter2); EXPECT_EQ(1, counter()->count()); EXPECT_EQ(0, counter2()->count()); EXPECT_EQ(100, counter()->time().InMicroseconds()); @@ -558,7 +563,8 @@ TEST_F(RuntimeCallStatsTest, NestedScopes) { } TEST_F(RuntimeCallStatsTest, BasicJavaScript) { - RuntimeCallCounter* counter = &stats()->JS_Execution; + RuntimeCallCounter* counter = + stats()->GetCounter(RuntimeCallCounterId::kJS_Execution); EXPECT_EQ(0, counter->count()); EXPECT_EQ(0, counter->time().InMicroseconds()); @@ -579,8 +585,10 @@ TEST_F(RuntimeCallStatsTest, BasicJavaScript) { } TEST_F(RuntimeCallStatsTest, FunctionLengthGetter) { - RuntimeCallCounter* getter_counter = &stats()->FunctionLengthGetter; - RuntimeCallCounter* js_counter = &stats()->JS_Execution; + RuntimeCallCounter* getter_counter = + stats()->GetCounter(RuntimeCallCounterId::kFunctionLengthGetter); + RuntimeCallCounter* js_counter = + stats()->GetCounter(RuntimeCallCounterId::kJS_Execution); EXPECT_EQ(0, getter_counter->count()); EXPECT_EQ(0, js_counter->count()); EXPECT_EQ(0, getter_counter->time().InMicroseconds()); diff --git a/deps/v8/test/unittests/eh-frame-iterator-unittest.cc b/deps/v8/test/unittests/eh-frame-iterator-unittest.cc index b228cc9caf..fff38209c5 100644 --- a/deps/v8/test/unittests/eh-frame-iterator-unittest.cc +++ b/deps/v8/test/unittests/eh-frame-iterator-unittest.cc @@ -20,40 +20,40 @@ class EhFrameIteratorTest : public testing::Test {}; TEST_F(EhFrameIteratorTest, Values) { // Assuming little endian. - static const byte kEncoded[] = {0xde, 0xc0, 0xad, 0xde, 0xef, 0xbe, 0xff}; + static const byte kEncoded[] = {0xDE, 0xC0, 0xAD, 0xDE, 0xEF, 0xBE, 0xFF}; EhFrameIterator iterator(&kEncoded[0], &kEncoded[0] + sizeof(kEncoded)); - EXPECT_EQ(0xdeadc0de, iterator.GetNextUInt32()); - EXPECT_EQ(0xbeef, iterator.GetNextUInt16()); - EXPECT_EQ(0xff, iterator.GetNextByte()); + EXPECT_EQ(0xDEADC0DE, iterator.GetNextUInt32()); + EXPECT_EQ(0xBEEF, iterator.GetNextUInt16()); + EXPECT_EQ(0xFF, iterator.GetNextByte()); EXPECT_TRUE(iterator.Done()); } TEST_F(EhFrameIteratorTest, Skip) { - static const byte kEncoded[] = {0xde, 0xad, 0xc0, 0xde}; + static const byte kEncoded[] = {0xDE, 0xAD, 0xC0, 0xDE}; EhFrameIterator iterator(&kEncoded[0], &kEncoded[0] + sizeof(kEncoded)); iterator.Skip(2); EXPECT_EQ(2, iterator.GetCurrentOffset()); - EXPECT_EQ(0xc0, iterator.GetNextByte()); + EXPECT_EQ(0xC0, iterator.GetNextByte()); iterator.Skip(1); EXPECT_TRUE(iterator.Done()); } TEST_F(EhFrameIteratorTest, ULEB128Decoding) { - static const byte kEncoded[] = {0xe5, 0x8e, 0x26}; + static const byte kEncoded[] = {0xE5, 0x8E, 0x26}; EhFrameIterator iterator(&kEncoded[0], &kEncoded[0] + sizeof(kEncoded)); EXPECT_EQ(624485u, iterator.GetNextULeb128()); EXPECT_TRUE(iterator.Done()); } TEST_F(EhFrameIteratorTest, SLEB128DecodingPositive) { - static const byte kEncoded[] = {0xe5, 0x8e, 0x26}; + static const byte kEncoded[] = {0xE5, 0x8E, 0x26}; EhFrameIterator iterator(&kEncoded[0], &kEncoded[0] + sizeof(kEncoded)); EXPECT_EQ(624485, iterator.GetNextSLeb128()); EXPECT_TRUE(iterator.Done()); } TEST_F(EhFrameIteratorTest, SLEB128DecodingNegative) { - static const byte kEncoded[] = {0x9b, 0xf1, 0x59}; + static const byte kEncoded[] = {0x9B, 0xF1, 0x59}; EhFrameIterator iterator(&kEncoded[0], &kEncoded[0] + sizeof(kEncoded)); EXPECT_EQ(-624485, iterator.GetNextSLeb128()); EXPECT_TRUE(iterator.Done()); diff --git a/deps/v8/test/unittests/eh-frame-writer-unittest.cc b/deps/v8/test/unittests/eh-frame-writer-unittest.cc index 0213835e9f..0846fda2f4 100644 --- a/deps/v8/test/unittests/eh-frame-writer-unittest.cc +++ b/deps/v8/test/unittests/eh-frame-writer-unittest.cc @@ -47,7 +47,7 @@ TEST_F(EhFrameWriterTest, Alignment) { } TEST_F(EhFrameWriterTest, FDEHeader) { - static const int kProcedureSize = 0x5678abcd; + static const int kProcedureSize = 0x5678ABCD; EhFrameWriter writer(zone()); writer.Initialize(); @@ -76,7 +76,7 @@ TEST_F(EhFrameWriterTest, FDEHeader) { } TEST_F(EhFrameWriterTest, SetOffset) { - static const uint32_t kOffset = 0x0badc0de; + static const uint32_t kOffset = 0x0BADC0DE; EhFrameWriter writer(zone()); writer.Initialize(); @@ -132,7 +132,7 @@ TEST_F(EhFrameWriterTest, SetRegister) { TEST_F(EhFrameWriterTest, SetRegisterAndOffset) { Register test_register = Register::from_code(kTestRegisterCode); - static const uint32_t kOffset = 0x0badc0de; + static const uint32_t kOffset = 0x0BADC0DE; EhFrameWriter writer(zone()); writer.Initialize(); @@ -199,7 +199,7 @@ TEST_F(EhFrameWriterTest, PcOffsetEncoding8bit) { TEST_F(EhFrameWriterTest, PcOffsetEncoding8bitDelta) { static const int kFirstOffset = 0x10; static const int kSecondOffset = 0x70; - static const int kThirdOffset = 0xb5; + static const int kThirdOffset = 0xB5; EhFrameWriter writer(zone()); writer.Initialize(); diff --git a/deps/v8/test/unittests/heap/gc-tracer-unittest.cc b/deps/v8/test/unittests/heap/gc-tracer-unittest.cc index e7702fda75..e4e9260881 100644 --- a/deps/v8/test/unittests/heap/gc-tracer-unittest.cc +++ b/deps/v8/test/unittests/heap/gc-tracer-unittest.cc @@ -5,6 +5,7 @@ #include <cmath> #include <limits> +#include "src/base/platform/platform.h" #include "src/globals.h" #include "src/heap/gc-tracer.h" #include "src/isolate.h" @@ -294,5 +295,125 @@ TEST_F(GCTracerTest, IncrementalMarkingSpeed) { tracer->IncrementalMarkingSpeedInBytesPerMillisecond())); } +TEST_F(GCTracerTest, BackgroundScavengerScope) { + GCTracer* tracer = i_isolate()->heap()->tracer(); + tracer->ResetForTesting(); + tracer->Start(SCAVENGER, GarbageCollectionReason::kTesting, + "collector unittest"); + tracer->AddBackgroundScopeSample( + GCTracer::BackgroundScope::SCAVENGER_BACKGROUND_SCAVENGE_PARALLEL, 10, + nullptr); + tracer->AddBackgroundScopeSample( + GCTracer::BackgroundScope::SCAVENGER_BACKGROUND_SCAVENGE_PARALLEL, 1, + nullptr); + tracer->Stop(SCAVENGER); + EXPECT_DOUBLE_EQ( + 11, tracer->current_ + .scopes[GCTracer::Scope::SCAVENGER_BACKGROUND_SCAVENGE_PARALLEL]); +} + +TEST_F(GCTracerTest, BackgroundMinorMCScope) { + GCTracer* tracer = i_isolate()->heap()->tracer(); + tracer->ResetForTesting(); + tracer->Start(MINOR_MARK_COMPACTOR, GarbageCollectionReason::kTesting, + "collector unittest"); + tracer->AddBackgroundScopeSample( + GCTracer::BackgroundScope::MINOR_MC_BACKGROUND_MARKING, 10, nullptr); + tracer->AddBackgroundScopeSample( + GCTracer::BackgroundScope::MINOR_MC_BACKGROUND_MARKING, 1, nullptr); + tracer->AddBackgroundScopeSample( + GCTracer::BackgroundScope::MINOR_MC_BACKGROUND_EVACUATE_COPY, 20, + nullptr); + tracer->AddBackgroundScopeSample( + GCTracer::BackgroundScope::MINOR_MC_BACKGROUND_EVACUATE_COPY, 2, nullptr); + tracer->AddBackgroundScopeSample( + GCTracer::BackgroundScope::MINOR_MC_BACKGROUND_EVACUATE_UPDATE_POINTERS, + 30, nullptr); + tracer->AddBackgroundScopeSample( + GCTracer::BackgroundScope::MINOR_MC_BACKGROUND_EVACUATE_UPDATE_POINTERS, + 3, nullptr); + tracer->Stop(MINOR_MARK_COMPACTOR); + EXPECT_DOUBLE_EQ( + 11, + tracer->current_.scopes[GCTracer::Scope::MINOR_MC_BACKGROUND_MARKING]); + EXPECT_DOUBLE_EQ( + 22, tracer->current_ + .scopes[GCTracer::Scope::MINOR_MC_BACKGROUND_EVACUATE_COPY]); + EXPECT_DOUBLE_EQ( + 33, tracer->current_.scopes + [GCTracer::Scope::MINOR_MC_BACKGROUND_EVACUATE_UPDATE_POINTERS]); +} + +TEST_F(GCTracerTest, BackgroundMajorMCScope) { + GCTracer* tracer = i_isolate()->heap()->tracer(); + tracer->ResetForTesting(); + tracer->AddBackgroundScopeSample( + GCTracer::BackgroundScope::MC_BACKGROUND_MARKING, 100, nullptr); + tracer->AddBackgroundScopeSample( + GCTracer::BackgroundScope::MC_BACKGROUND_SWEEPING, 200, nullptr); + tracer->AddBackgroundScopeSample( + GCTracer::BackgroundScope::MC_BACKGROUND_MARKING, 10, nullptr); + // Scavenger should not affect the major mark-compact scopes. + tracer->Start(SCAVENGER, GarbageCollectionReason::kTesting, + "collector unittest"); + tracer->Stop(SCAVENGER); + tracer->AddBackgroundScopeSample( + GCTracer::BackgroundScope::MC_BACKGROUND_SWEEPING, 20, nullptr); + tracer->AddBackgroundScopeSample( + GCTracer::BackgroundScope::MC_BACKGROUND_MARKING, 1, nullptr); + tracer->AddBackgroundScopeSample( + GCTracer::BackgroundScope::MC_BACKGROUND_SWEEPING, 2, nullptr); + tracer->Start(MARK_COMPACTOR, GarbageCollectionReason::kTesting, + "collector unittest"); + tracer->AddBackgroundScopeSample( + GCTracer::BackgroundScope::MC_BACKGROUND_EVACUATE_COPY, 30, nullptr); + tracer->AddBackgroundScopeSample( + GCTracer::BackgroundScope::MC_BACKGROUND_EVACUATE_COPY, 3, nullptr); + tracer->AddBackgroundScopeSample( + GCTracer::BackgroundScope::MC_BACKGROUND_EVACUATE_UPDATE_POINTERS, 40, + nullptr); + tracer->AddBackgroundScopeSample( + GCTracer::BackgroundScope::MC_BACKGROUND_EVACUATE_UPDATE_POINTERS, 4, + nullptr); + tracer->Stop(MARK_COMPACTOR); + EXPECT_DOUBLE_EQ( + 111, tracer->current_.scopes[GCTracer::Scope::MC_BACKGROUND_MARKING]); + EXPECT_DOUBLE_EQ( + 222, tracer->current_.scopes[GCTracer::Scope::MC_BACKGROUND_SWEEPING]); + EXPECT_DOUBLE_EQ( + 33, + tracer->current_.scopes[GCTracer::Scope::MC_BACKGROUND_EVACUATE_COPY]); + EXPECT_DOUBLE_EQ( + 44, tracer->current_ + .scopes[GCTracer::Scope::MC_BACKGROUND_EVACUATE_UPDATE_POINTERS]); +} + +class ThreadWithBackgroundScope final : public base::Thread { + public: + explicit ThreadWithBackgroundScope(GCTracer* tracer) + : Thread(Options("ThreadWithBackgroundScope")), tracer_(tracer) {} + void Run() override { + GCTracer::BackgroundScope scope( + tracer_, GCTracer::BackgroundScope::MC_BACKGROUND_MARKING); + } + + private: + GCTracer* tracer_; +}; + +TEST_F(GCTracerTest, MultithreadedBackgroundScope) { + GCTracer* tracer = i_isolate()->heap()->tracer(); + ThreadWithBackgroundScope thread1(tracer); + ThreadWithBackgroundScope thread2(tracer); + tracer->ResetForTesting(); + thread1.Start(); + thread2.Start(); + tracer->FetchBackgroundMarkCompactCounters(); + thread1.Join(); + thread2.Join(); + tracer->FetchBackgroundMarkCompactCounters(); + EXPECT_LE(0, tracer->current_.scopes[GCTracer::Scope::MC_BACKGROUND_MARKING]); +} + } // namespace internal } // namespace v8 diff --git a/deps/v8/test/unittests/heap/heap-unittest.cc b/deps/v8/test/unittests/heap/heap-unittest.cc index 3b7b610c8c..c63aa2b724 100644 --- a/deps/v8/test/unittests/heap/heap-unittest.cc +++ b/deps/v8/test/unittests/heap/heap-unittest.cc @@ -99,7 +99,7 @@ TEST_F(HeapTest, ASLR) { } if (hints.size() == 1) { EXPECT_TRUE((*hints.begin()) == nullptr); - EXPECT_TRUE(base::OS::GetRandomMmapAddr() == nullptr); + EXPECT_TRUE(i::GetRandomMmapAddr() == nullptr); } else { // It is unlikely that 1000 random samples will collide to less then 500 // values. diff --git a/deps/v8/test/unittests/heap/marking-unittest.cc b/deps/v8/test/unittests/heap/marking-unittest.cc index 9dd432c175..0553dc0ea5 100644 --- a/deps/v8/test/unittests/heap/marking-unittest.cc +++ b/deps/v8/test/unittests/heap/marking-unittest.cc @@ -63,7 +63,7 @@ TEST(Marking, SetAndClearRange) { calloc(Bitmap::kSize / kPointerSize, kPointerSize)); for (int i = 0; i < 3; i++) { bitmap->SetRange(i, Bitmap::kBitsPerCell + i); - CHECK_EQ(reinterpret_cast<uint32_t*>(bitmap)[0], 0xffffffffu << i); + CHECK_EQ(reinterpret_cast<uint32_t*>(bitmap)[0], 0xFFFFFFFFu << i); CHECK_EQ(reinterpret_cast<uint32_t*>(bitmap)[1], (1u << i) - 1); bitmap->ClearRange(i, Bitmap::kBitsPerCell + i); CHECK_EQ(reinterpret_cast<uint32_t*>(bitmap)[0], 0x0u); @@ -77,9 +77,9 @@ TEST(Marking, ClearMultipleRanges) { calloc(Bitmap::kSize / kPointerSize, kPointerSize)); CHECK(bitmap->AllBitsClearInRange(0, Bitmap::kBitsPerCell * 3)); bitmap->SetRange(0, Bitmap::kBitsPerCell * 3); - CHECK_EQ(reinterpret_cast<uint32_t*>(bitmap)[0], 0xffffffffu); - CHECK_EQ(reinterpret_cast<uint32_t*>(bitmap)[1], 0xffffffffu); - CHECK_EQ(reinterpret_cast<uint32_t*>(bitmap)[2], 0xffffffffu); + CHECK_EQ(reinterpret_cast<uint32_t*>(bitmap)[0], 0xFFFFFFFFu); + CHECK_EQ(reinterpret_cast<uint32_t*>(bitmap)[1], 0xFFFFFFFFu); + CHECK_EQ(reinterpret_cast<uint32_t*>(bitmap)[2], 0xFFFFFFFFu); CHECK(bitmap->AllBitsSetInRange(0, Bitmap::kBitsPerCell * 3)); bitmap->ClearRange(Bitmap::kBitsPerCell / 2, Bitmap::kBitsPerCell); bitmap->ClearRange(Bitmap::kBitsPerCell, @@ -87,17 +87,17 @@ TEST(Marking, ClearMultipleRanges) { bitmap->ClearRange(Bitmap::kBitsPerCell * 2 + 8, Bitmap::kBitsPerCell * 2 + 16); bitmap->ClearRange(Bitmap::kBitsPerCell * 2 + 24, Bitmap::kBitsPerCell * 3); - CHECK_EQ(reinterpret_cast<uint32_t*>(bitmap)[0], 0xffffu); + CHECK_EQ(reinterpret_cast<uint32_t*>(bitmap)[0], 0xFFFFu); CHECK(bitmap->AllBitsSetInRange(0, Bitmap::kBitsPerCell / 2)); CHECK(bitmap->AllBitsClearInRange(Bitmap::kBitsPerCell / 2, Bitmap::kBitsPerCell)); - CHECK_EQ(reinterpret_cast<uint32_t*>(bitmap)[1], 0xffff0000u); + CHECK_EQ(reinterpret_cast<uint32_t*>(bitmap)[1], 0xFFFF0000u); CHECK( bitmap->AllBitsSetInRange(Bitmap::kBitsPerCell + Bitmap::kBitsPerCell / 2, 2 * Bitmap::kBitsPerCell)); CHECK(bitmap->AllBitsClearInRange( Bitmap::kBitsPerCell, Bitmap::kBitsPerCell + Bitmap::kBitsPerCell / 2)); - CHECK_EQ(reinterpret_cast<uint32_t*>(bitmap)[2], 0xff00ffu); + CHECK_EQ(reinterpret_cast<uint32_t*>(bitmap)[2], 0xFF00FFu); CHECK(bitmap->AllBitsSetInRange(2 * Bitmap::kBitsPerCell, 2 * Bitmap::kBitsPerCell + 8)); CHECK(bitmap->AllBitsClearInRange(2 * Bitmap::kBitsPerCell + 24, 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 bbc9e565c9..26fcd1937b 100644 --- a/deps/v8/test/unittests/interpreter/bytecode-array-builder-unittest.cc +++ b/deps/v8/test/unittests/interpreter/bytecode-array-builder-unittest.cc @@ -13,6 +13,7 @@ #include "src/interpreter/bytecode-label.h" #include "src/interpreter/bytecode-register-allocator.h" #include "src/objects-inl.h" +#include "test/unittests/interpreter/bytecode-utils.h" #include "test/unittests/test-utils.h" namespace v8 { @@ -41,8 +42,11 @@ TEST_F(BytecodeArrayBuilderTest, AllBytecodesGenerated) { Register reg(0); Register other(reg.index() + 1); Register wide(128); - RegisterList reg_list(0, 10); - RegisterList empty, single(0, 1), pair(0, 2), triple(0, 3); + RegisterList empty; + RegisterList single = BytecodeUtils::NewRegisterList(0, 1); + RegisterList pair = BytecodeUtils::NewRegisterList(0, 2); + RegisterList triple = BytecodeUtils::NewRegisterList(0, 3); + RegisterList reg_list = BytecodeUtils::NewRegisterList(0, 10); // Emit argument creation operations. builder.CreateArguments(CreateArgumentsType::kMappedArguments) @@ -89,8 +93,6 @@ TEST_F(BytecodeArrayBuilderTest, AllBytecodesGenerated) { feedback_spec.AddLoadGlobalICSlot(INSIDE_TYPEOF); FeedbackSlot sloppy_store_global_slot = feedback_spec.AddStoreGlobalICSlot(LanguageMode::kSloppy); - FeedbackSlot strict_store_global_slot = - feedback_spec.AddStoreGlobalICSlot(LanguageMode::kStrict); FeedbackSlot load_slot = feedback_spec.AddLoadICSlot(); FeedbackSlot keyed_load_slot = feedback_spec.AddKeyedLoadICSlot(); FeedbackSlot sloppy_store_slot = @@ -109,10 +111,7 @@ TEST_F(BytecodeArrayBuilderTest, AllBytecodesGenerated) { .LoadGlobal(name, load_global_slot.ToInt(), TypeofMode::NOT_INSIDE_TYPEOF) .LoadGlobal(name, load_global_typeof_slot.ToInt(), TypeofMode::INSIDE_TYPEOF) - .StoreGlobal(name, sloppy_store_global_slot.ToInt(), - LanguageMode::kSloppy) - .StoreGlobal(name, strict_store_global_slot.ToInt(), - LanguageMode::kStrict); + .StoreGlobal(name, sloppy_store_global_slot.ToInt()); // Emit context operations. builder.PushContext(reg) @@ -387,7 +386,7 @@ TEST_F(BytecodeArrayBuilderTest, AllBytecodesGenerated) { // Emit generator operations. builder.SuspendGenerator(reg, reg_list, 0) .RestoreGeneratorState(reg) - .RestoreGeneratorRegisters(reg, reg_list); + .ResumeGenerator(reg, reg, reg_list); // Intrinsics handled by the interpreter. builder.CallRuntime(Runtime::kInlineIsArray, reg_list); @@ -398,7 +397,7 @@ TEST_F(BytecodeArrayBuilderTest, AllBytecodesGenerated) { // Emit abort bytecode. { BytecodeLabel after; - builder.Abort(kGenerator).Bind(&after); + builder.Abort(AbortReason::kOperandIsASmi).Bind(&after); } // Insert dummy ops to force longer jumps. 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 ee5d8803f7..f7c89e2869 100644 --- a/deps/v8/test/unittests/interpreter/bytecode-array-iterator-unittest.cc +++ b/deps/v8/test/unittests/interpreter/bytecode-array-iterator-unittest.cc @@ -7,6 +7,7 @@ #include "src/interpreter/bytecode-array-builder.h" #include "src/interpreter/bytecode-array-iterator.h" #include "src/objects-inl.h" +#include "test/unittests/interpreter/bytecode-utils.h" #include "test/unittests/test-utils.h" namespace v8 { @@ -33,8 +34,8 @@ TEST_F(BytecodeArrayIteratorTest, IteratesBytecodeArray) { Smi* smi_1 = Smi::FromInt(-65536); Register reg_0(0); Register reg_1(1); - RegisterList pair(0, 2); - RegisterList triple(0, 3); + RegisterList pair = BytecodeUtils::NewRegisterList(0, 2); + RegisterList triple = BytecodeUtils::NewRegisterList(0, 3); Register param = Register::FromParameterIndex(2, builder.parameter_count()); const AstRawString* name = ast_factory.GetOneByteString("abc"); uint32_t name_index = 2; 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 12cd55c2a9..8d2cd4c501 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 @@ -7,6 +7,7 @@ #include "src/interpreter/bytecode-array-builder.h" #include "src/interpreter/bytecode-array-random-iterator.h" #include "src/objects-inl.h" +#include "test/unittests/interpreter/bytecode-utils.h" #include "test/unittests/test-utils.h" namespace v8 { @@ -33,8 +34,8 @@ TEST_F(BytecodeArrayRandomIteratorTest, InvalidBeforeStart) { Smi* smi_1 = Smi::FromInt(-65536); Register reg_0(0); Register reg_1(1); - RegisterList pair(0, 2); - RegisterList triple(0, 3); + RegisterList pair = BytecodeUtils::NewRegisterList(0, 2); + RegisterList triple = BytecodeUtils::NewRegisterList(0, 3); Register param = Register::FromParameterIndex(2, builder.parameter_count()); const AstRawString* name = ast_factory.GetOneByteString("abc"); uint32_t feedback_slot = feedback_spec.AddLoadICSlot().ToInt(); @@ -87,8 +88,8 @@ TEST_F(BytecodeArrayRandomIteratorTest, InvalidAfterEnd) { Smi* smi_1 = Smi::FromInt(-65536); Register reg_0(0); Register reg_1(1); - RegisterList pair(0, 2); - RegisterList triple(0, 3); + RegisterList pair = BytecodeUtils::NewRegisterList(0, 2); + RegisterList triple = BytecodeUtils::NewRegisterList(0, 3); Register param = Register::FromParameterIndex(2, builder.parameter_count()); const AstRawString* name = ast_factory.GetOneByteString("abc"); uint32_t feedback_slot = feedback_spec.AddLoadICSlot().ToInt(); @@ -141,8 +142,8 @@ TEST_F(BytecodeArrayRandomIteratorTest, AccessesFirst) { Smi* smi_1 = Smi::FromInt(-65536); Register reg_0(0); Register reg_1(1); - RegisterList pair(0, 2); - RegisterList triple(0, 3); + RegisterList pair = BytecodeUtils::NewRegisterList(0, 2); + RegisterList triple = BytecodeUtils::NewRegisterList(0, 3); Register param = Register::FromParameterIndex(2, builder.parameter_count()); const AstRawString* name = ast_factory.GetOneByteString("abc"); uint32_t feedback_slot = feedback_spec.AddLoadICSlot().ToInt(); @@ -199,8 +200,8 @@ TEST_F(BytecodeArrayRandomIteratorTest, AccessesLast) { Smi* smi_1 = Smi::FromInt(-65536); Register reg_0(0); Register reg_1(1); - RegisterList pair(0, 2); - RegisterList triple(0, 3); + RegisterList pair = BytecodeUtils::NewRegisterList(0, 2); + RegisterList triple = BytecodeUtils::NewRegisterList(0, 3); Register param = Register::FromParameterIndex(2, builder.parameter_count()); const AstRawString* name = ast_factory.GetOneByteString("abc"); uint32_t feedback_slot = feedback_spec.AddLoadICSlot().ToInt(); @@ -258,8 +259,8 @@ TEST_F(BytecodeArrayRandomIteratorTest, RandomAccessValid) { Smi* smi_1 = Smi::FromInt(-65536); Register reg_0(0); Register reg_1(1); - RegisterList pair(0, 2); - RegisterList triple(0, 3); + RegisterList pair = BytecodeUtils::NewRegisterList(0, 2); + RegisterList triple = BytecodeUtils::NewRegisterList(0, 3); Register param = Register::FromParameterIndex(2, builder.parameter_count()); const AstRawString* name = ast_factory.GetOneByteString("abc"); uint32_t name_index = 2; @@ -443,8 +444,8 @@ TEST_F(BytecodeArrayRandomIteratorTest, IteratesBytecodeArray) { Smi* smi_1 = Smi::FromInt(-65536); Register reg_0(0); Register reg_1(1); - RegisterList pair(0, 2); - RegisterList triple(0, 3); + RegisterList pair = BytecodeUtils::NewRegisterList(0, 2); + RegisterList triple = BytecodeUtils::NewRegisterList(0, 3); Register param = Register::FromParameterIndex(2, builder.parameter_count()); const AstRawString* name = ast_factory.GetOneByteString("abc"); uint32_t name_index = 2; @@ -722,8 +723,8 @@ TEST_F(BytecodeArrayRandomIteratorTest, IteratesBytecodeArrayBackwards) { Smi* smi_1 = Smi::FromInt(-65536); Register reg_0(0); Register reg_1(1); - RegisterList pair(0, 2); - RegisterList triple(0, 3); + RegisterList pair = BytecodeUtils::NewRegisterList(0, 2); + RegisterList triple = BytecodeUtils::NewRegisterList(0, 3); Register param = Register::FromParameterIndex(2, builder.parameter_count()); const AstRawString* name = ast_factory.GetOneByteString("abc"); uint32_t name_index = 2; diff --git a/deps/v8/test/unittests/interpreter/bytecode-node-unittest.cc b/deps/v8/test/unittests/interpreter/bytecode-node-unittest.cc index af793ebcfe..8b8cae50ea 100644 --- a/deps/v8/test/unittests/interpreter/bytecode-node-unittest.cc +++ b/deps/v8/test/unittests/interpreter/bytecode-node-unittest.cc @@ -52,7 +52,7 @@ TEST_F(BytecodeNodeTest, Constructor4) { } TEST_F(BytecodeNodeTest, Constructor5) { - uint32_t operands[] = {0x71, 0xa5, 0x5a, 0xfc}; + uint32_t operands[] = {0x71, 0xA5, 0x5A, 0xFC}; BytecodeNode node(Bytecode::kForInNext, operands[0], operands[1], operands[2], operands[3]); CHECK_EQ(node.operand_count(), 4); @@ -65,7 +65,7 @@ TEST_F(BytecodeNodeTest, Constructor5) { } TEST_F(BytecodeNodeTest, Equality) { - uint32_t operands[] = {0x71, 0xa5, 0x5a, 0xfc}; + uint32_t operands[] = {0x71, 0xA5, 0x5A, 0xFC}; BytecodeNode node(Bytecode::kForInNext, operands[0], operands[1], operands[2], operands[3]); CHECK_EQ(node, node); @@ -75,7 +75,7 @@ TEST_F(BytecodeNodeTest, Equality) { } TEST_F(BytecodeNodeTest, EqualityWithSourceInfo) { - uint32_t operands[] = {0x71, 0xa5, 0x5a, 0xfc}; + uint32_t operands[] = {0x71, 0xA5, 0x5A, 0xFC}; BytecodeSourceInfo first_source_info(3, true); BytecodeNode node(Bytecode::kForInNext, operands[0], operands[1], operands[2], operands[3], first_source_info); @@ -87,7 +87,7 @@ TEST_F(BytecodeNodeTest, EqualityWithSourceInfo) { } TEST_F(BytecodeNodeTest, NoEqualityWithDifferentSourceInfo) { - uint32_t operands[] = {0x71, 0xa5, 0x5a, 0xfc}; + uint32_t operands[] = {0x71, 0xA5, 0x5A, 0xFC}; BytecodeSourceInfo source_info(77, true); BytecodeNode node(Bytecode::kForInNext, operands[0], operands[1], operands[2], operands[3], source_info); 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 8c7b363ebf..9e3ceb140f 100644 --- a/deps/v8/test/unittests/interpreter/bytecode-register-optimizer-unittest.cc +++ b/deps/v8/test/unittests/interpreter/bytecode-register-optimizer-unittest.cc @@ -6,6 +6,7 @@ #include "src/interpreter/bytecode-label.h" #include "src/interpreter/bytecode-register-optimizer.h" +#include "test/unittests/interpreter/bytecode-utils.h" #include "test/unittests/test-utils.h" namespace v8 { @@ -169,8 +170,8 @@ TEST_F(BytecodeRegisterOptimizerTest, SingleTemporaryNotMaterializedForInput) { CHECK_EQ(write_count(), 0u); Register reg = optimizer()->GetInputRegister(temp0); - RegisterList reg_list = - optimizer()->GetInputRegisterList(RegisterList(temp0.index(), 1)); + RegisterList reg_list = optimizer()->GetInputRegisterList( + BytecodeUtils::NewRegisterList(temp0.index(), 1)); CHECK_EQ(write_count(), 0u); CHECK_EQ(parameter.index(), reg.index()); CHECK_EQ(parameter.index(), reg_list.first_register().index()); @@ -189,8 +190,8 @@ TEST_F(BytecodeRegisterOptimizerTest, RangeOfTemporariesMaterializedForInput) { optimizer() ->PrepareForBytecode<Bytecode::kCallJSRuntime, AccumulatorUse::kWrite>(); - RegisterList reg_list = - optimizer()->GetInputRegisterList(RegisterList(temp0.index(), 2)); + RegisterList reg_list = optimizer()->GetInputRegisterList( + BytecodeUtils::NewRegisterList(temp0.index(), 2)); CHECK_EQ(temp0.index(), reg_list.first_register().index()); CHECK_EQ(2, reg_list.register_count()); CHECK_EQ(write_count(), 2u); diff --git a/deps/v8/test/unittests/interpreter/bytecode-utils.h b/deps/v8/test/unittests/interpreter/bytecode-utils.h index 9a2cee3014..401884559e 100644 --- a/deps/v8/test/unittests/interpreter/bytecode-utils.h +++ b/deps/v8/test/unittests/interpreter/bytecode-utils.h @@ -6,6 +6,11 @@ #define V8_UNITTESTS_INTERPRETER_BYTECODE_UTILS_H_ #include "src/frames.h" +#include "src/interpreter/bytecode-register.h" + +namespace v8 { +namespace internal { +namespace interpreter { #if V8_TARGET_LITTLE_ENDIAN @@ -33,4 +38,19 @@ #define R16(i) U16(REG_OPERAND(i)) #define R32(i) U32(REG_OPERAND(i)) +class BytecodeUtils { + public: + // Expose raw RegisterList construction to tests. + static RegisterList NewRegisterList(int first_reg_index, int register_count) { + return RegisterList(first_reg_index, register_count); + } + + private: + DISALLOW_IMPLICIT_CONSTRUCTORS(BytecodeUtils); +}; + +} // namespace interpreter +} // namespace internal +} // namespace v8 + #endif // V8_UNITTESTS_INTERPRETER_BYTECODE_UTILS_H_ diff --git a/deps/v8/test/unittests/interpreter/interpreter-assembler-unittest.cc b/deps/v8/test/unittests/interpreter/interpreter-assembler-unittest.cc index 88acf680f5..03d9397c7f 100644 --- a/deps/v8/test/unittests/interpreter/interpreter-assembler-unittest.cc +++ b/deps/v8/test/unittests/interpreter/interpreter-assembler-unittest.cc @@ -417,7 +417,7 @@ TARGET_TEST_F(InterpreterAssemblerTest, StoreRegister) { TRACED_FOREACH(interpreter::Bytecode, bytecode, kBytecodes) { InterpreterAssemblerTestState state(this, bytecode); InterpreterAssemblerForTest m(&state, bytecode); - Node* store_value = m.Int32Constant(0xdeadbeef); + Node* store_value = m.Int32Constant(0xDEADBEEF); Node* reg_index_node = m.Parameter(0); Node* store_reg_node = m.StoreRegister(store_value, reg_index_node); EXPECT_THAT(store_reg_node, @@ -471,7 +471,7 @@ TARGET_TEST_F(InterpreterAssemblerTest, LoadObjectField) { TRACED_FOREACH(interpreter::Bytecode, bytecode, kBytecodes) { InterpreterAssemblerTestState state(this, bytecode); InterpreterAssemblerForTest m(&state, bytecode); - Node* object = m.IntPtrConstant(0xdeadbeef); + Node* object = m.IntPtrConstant(0xDEADBEEF); int offset = 16; Node* load_field = m.LoadObjectField(object, offset); EXPECT_THAT(load_field, diff --git a/deps/v8/test/unittests/object-unittest.cc b/deps/v8/test/unittests/object-unittest.cc index 47772a0f20..4cb113a644 100644 --- a/deps/v8/test/unittests/object-unittest.cc +++ b/deps/v8/test/unittests/object-unittest.cc @@ -61,7 +61,7 @@ TEST(Object, InstanceTypeListOrder) { current_type = InstanceType::type; \ current = static_cast<int>(current_type); \ if (current > static_cast<int>(LAST_NAME_TYPE)) { \ - EXPECT_EQ(last + 1, current); \ + EXPECT_LE(last + 1, current); \ } \ EXPECT_LT(last, current) << " INSTANCE_TYPE_LIST is not ordered: " \ << "last = " << static_cast<InstanceType>(last) \ @@ -73,7 +73,7 @@ TEST(Object, InstanceTypeListOrder) { } TEST(Object, StructListOrder) { - int current = static_cast<int>(InstanceType::ACCESSOR_INFO_TYPE); + int current = static_cast<int>(InstanceType::ACCESS_CHECK_INFO_TYPE); int last = current - 1; ASSERT_LT(0, last); InstanceType current_type = static_cast<InstanceType>(current); diff --git a/deps/v8/test/unittests/parser/ast-value-unittest.cc b/deps/v8/test/unittests/parser/ast-value-unittest.cc index 2b7a227e0f..72e35a43a0 100644 --- a/deps/v8/test/unittests/parser/ast-value-unittest.cc +++ b/deps/v8/test/unittests/parser/ast-value-unittest.cc @@ -41,10 +41,10 @@ TEST_F(AstValueTest, BigIntToBooleanIsTrue) { EXPECT_TRUE(NewBigInt("3")->ToBooleanIsTrue()); EXPECT_TRUE(NewBigInt("0b1")->ToBooleanIsTrue()); EXPECT_TRUE(NewBigInt("0o6")->ToBooleanIsTrue()); - EXPECT_TRUE(NewBigInt("0xa")->ToBooleanIsTrue()); + EXPECT_TRUE(NewBigInt("0xA")->ToBooleanIsTrue()); EXPECT_TRUE(NewBigInt("0b0000001")->ToBooleanIsTrue()); EXPECT_TRUE(NewBigInt("0o00005000")->ToBooleanIsTrue()); - EXPECT_TRUE(NewBigInt("0x0000d00c0")->ToBooleanIsTrue()); + EXPECT_TRUE(NewBigInt("0x0000D00C0")->ToBooleanIsTrue()); } } // namespace internal diff --git a/deps/v8/test/unittests/testcfg.py b/deps/v8/test/unittests/testcfg.py new file mode 100644 index 0000000000..9b18743566 --- /dev/null +++ b/deps/v8/test/unittests/testcfg.py @@ -0,0 +1,70 @@ +# 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. + +import os + +from testrunner.local import command +from testrunner.local import utils +from testrunner.local import testsuite +from testrunner.objects import testcase + + +class TestSuite(testsuite.TestSuite): + def ListTests(self, context): + shell = os.path.abspath(os.path.join(context.shell_dir, self.name)) + if utils.IsWindows(): + shell += ".exe" + + output = None + for i in xrange(3): # Try 3 times in case of errors. + cmd = command.Command( + cmd_prefix=context.command_prefix, + shell=shell, + args=['--gtest_list_tests'] + context.extra_flags) + output = cmd.execute() + if output.exit_code == 0: + break + print "Test executable failed to list the tests (try %d).\n\nCmd:" % i + print cmd + print "\nStdout:" + print output.stdout + print "\nStderr:" + print output.stderr + print "\nExit code: %d" % output.exit_code + else: + raise Exception("Test executable failed to list the tests.") + + tests = [] + test_case = '' + for line in output.stdout.splitlines(): + test_desc = line.strip().split()[0] + if test_desc.endswith('.'): + test_case = test_desc + elif test_case and test_desc: + test_path = test_case + test_desc + tests.append(self._create_test(test_path)) + tests.sort(key=lambda t: t.path) + return tests + + def _test_class(self): + return TestCase + + def _LegacyVariantsGeneratorFactory(self): + return testsuite.StandardLegacyVariantsGenerator + + +class TestCase(testcase.TestCase): + def _get_suite_flags(self, ctx): + return ( + ["--gtest_filter=" + self.path] + + ["--gtest_random_seed=%s" % ctx.random_seed] + + ["--gtest_print_time=0"] + ) + + def get_shell(self): + return self.suite.name + + +def GetSuite(name, root): + return TestSuite(name, root) diff --git a/deps/v8/test/unittests/unicode-unittest.cc b/deps/v8/test/unittests/unicode-unittest.cc index c4df42c1c6..e5ccaca7b1 100644 --- a/deps/v8/test/unittests/unicode-unittest.cc +++ b/deps/v8/test/unittests/unicode-unittest.cc @@ -37,13 +37,15 @@ void DecodeNormally(const std::vector<byte>& bytes, void DecodeIncrementally(const std::vector<byte>& bytes, std::vector<unibrow::uchar>* output) { unibrow::Utf8::Utf8IncrementalBuffer buffer = 0; - for (auto b : bytes) { - unibrow::uchar result = unibrow::Utf8::ValueOfIncremental(b, &buffer); + unibrow::Utf8::State state = unibrow::Utf8::State::kAccept; + for (size_t i = 0; i < bytes.size();) { + unibrow::uchar result = + unibrow::Utf8::ValueOfIncremental(bytes[i], &i, &state, &buffer); if (result != unibrow::Utf8::kIncomplete) { output->push_back(result); } } - unibrow::uchar result = unibrow::Utf8::ValueOfIncrementalFinish(&buffer); + unibrow::uchar result = unibrow::Utf8::ValueOfIncrementalFinish(&state); if (result != unibrow::Utf8::kBufferEmpty) { output->push_back(result); } @@ -72,344 +74,344 @@ TEST(UnicodeTest, IncrementalUTF8DecodingVsNonIncrementalUtf8Decoding) { TestCase data[] = { // Correct UTF-8 text. - {{0xce, 0xba, 0xe1, 0xbd, 0xb9, 0xcf, 0x83, 0xce, 0xbc, 0xce, 0xb5}, - {0x3ba, 0x1f79, 0x3c3, 0x3bc, 0x3b5}}, + {{0xCE, 0xBA, 0xE1, 0xBD, 0xB9, 0xCF, 0x83, 0xCE, 0xBC, 0xCE, 0xB5}, + {0x3BA, 0x1F79, 0x3C3, 0x3BC, 0x3B5}}, // First possible sequence of a certain length: // 1 byte {{0x00}, {0x0}}, // 2 bytes - {{0xc2, 0x80}, {0x80}}, + {{0xC2, 0x80}, {0x80}}, // 3 bytes - {{0xe0, 0xa0, 0x80}, {0x800}}, + {{0xE0, 0xA0, 0x80}, {0x800}}, // 4 bytes - {{0xf0, 0x90, 0x80, 0x80}, {0x10000}}, + {{0xF0, 0x90, 0x80, 0x80}, {0x10000}}, // 5 bytes (not supported) - {{0xf8, 0x88, 0x80, 0x80, 0x80}, - {0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd}}, + {{0xF8, 0x88, 0x80, 0x80, 0x80}, + {0xFFFD, 0xFFFD, 0xFFFD, 0xFFFD, 0xFFFD}}, // 6 bytes (not supported) - {{0xfc, 0x84, 0x80, 0x80, 0x80, 0x80}, - {0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd}}, + {{0xFC, 0x84, 0x80, 0x80, 0x80, 0x80}, + {0xFFFD, 0xFFFD, 0xFFFD, 0xFFFD, 0xFFFD, 0xFFFD}}, // Last possible sequence of certain length: // 1 byte - {{0x7f}, {0x7f}}, + {{0x7F}, {0x7F}}, // 2 bytes - {{0xdf, 0xbf}, {0x7ff}}, + {{0xDF, 0xBF}, {0x7FF}}, // 3 bytes - {{0xef, 0xbf, 0xbf}, {0xffff}}, + {{0xEF, 0xBF, 0xBF}, {0xFFFF}}, // 4 bytes (this sequence is not a valid code point) - {{0xf7, 0xbf, 0xbf, 0xbf}, {0xfffd, 0xfffd, 0xfffd, 0xfffd}}, + {{0xF7, 0xBF, 0xBF, 0xBF}, {0xFFFD, 0xFFFD, 0xFFFD, 0xFFFD}}, // 5 bytes (not supported) - {{0xfb, 0xbf, 0xbf, 0xbf, 0xbf}, - {0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd}}, + {{0xFB, 0xBF, 0xBF, 0xBF, 0xBF}, + {0xFFFD, 0xFFFD, 0xFFFD, 0xFFFD, 0xFFFD}}, // 6 bytes (not supported) - {{0xfd, 0xbf, 0xbf, 0xbf, 0xbf, 0xbf}, - {0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd}}, + {{0xFD, 0xBF, 0xBF, 0xBF, 0xBF, 0xBF}, + {0xFFFD, 0xFFFD, 0xFFFD, 0xFFFD, 0xFFFD, 0xFFFD}}, // Other boundary conditions: - {{0xed, 0x9f, 0xbf}, {0xd7ff}}, - {{0xee, 0x80, 0x80}, {0xe000}}, + {{0xED, 0x9F, 0xBF}, {0xD7FF}}, + {{0xEE, 0x80, 0x80}, {0xE000}}, // U+fffd (invalid code point) - {{0xef, 0xbf, 0xbd}, {0xfffd}}, + {{0xEF, 0xBF, 0xBD}, {0xFFFD}}, // U+10ffff (last valid code point) - {{0xf4, 0x8f, 0xbf, 0xbf}, {0x10ffff}}, + {{0xF4, 0x8F, 0xBF, 0xBF}, {0x10FFFF}}, // First invalid (too large) code point - {{0xf4, 0x90, 0x80, 0x80}, {0xfffd, 0xfffd, 0xfffd, 0xfffd}}, + {{0xF4, 0x90, 0x80, 0x80}, {0xFFFD, 0xFFFD, 0xFFFD, 0xFFFD}}, // Malformed sequences: // Unexpected continuation bytes: // First continuation byte - {{0x80}, {0xfffd}}, + {{0x80}, {0xFFFD}}, // Last continuation byte - {{0xbf}, {0xfffd}}, + {{0xBF}, {0xFFFD}}, // 2 continuation bytes - {{0x80, 0xbf}, {0xfffd, 0xfffd}}, + {{0x80, 0xBF}, {0xFFFD, 0xFFFD}}, // 3 continuation bytes - {{0x80, 0xbf, 0x80}, {0xfffd, 0xfffd, 0xfffd}}, + {{0x80, 0xBF, 0x80}, {0xFFFD, 0xFFFD, 0xFFFD}}, // 4 continuation bytes - {{0x80, 0xbf, 0x80, 0xbf}, {0xfffd, 0xfffd, 0xfffd, 0xfffd}}, + {{0x80, 0xBF, 0x80, 0xBF}, {0xFFFD, 0xFFFD, 0xFFFD, 0xFFFD}}, // 5 continuation bytes - {{0x80, 0xbf, 0x80, 0xbf, 0x80}, - {0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd}}, + {{0x80, 0xBF, 0x80, 0xBF, 0x80}, + {0xFFFD, 0xFFFD, 0xFFFD, 0xFFFD, 0xFFFD}}, // 6 continuation bytes - {{0x80, 0xbf, 0x80, 0xbf, 0x80, 0xbf}, - {0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd}}, + {{0x80, 0xBF, 0x80, 0xBF, 0x80, 0xBF}, + {0xFFFD, 0xFFFD, 0xFFFD, 0xFFFD, 0xFFFD, 0xFFFD}}, // 7 continuation bytes - {{0x80, 0xbf, 0x80, 0xbf, 0x80, 0xbf, 0xbf}, - {0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd}}, + {{0x80, 0xBF, 0x80, 0xBF, 0x80, 0xBF, 0xBF}, + {0xFFFD, 0xFFFD, 0xFFFD, 0xFFFD, 0xFFFD, 0xFFFD, 0xFFFD}}, // Sequence of all 64 possible continuation bytes - {{0x80, 0x81, 0x82, 0x83, 0x84, 0x85, 0x86, 0x87, 0x88, 0x89, 0x8a, - 0x8b, 0x8c, 0x8d, 0x8e, 0x8f, 0x90, 0x91, 0x92, 0x93, 0x94, 0x95, - 0x96, 0x97, 0x98, 0x99, 0x9a, 0x9b, 0x9c, 0x9d, 0x9e, 0x9f, 0xa0, - 0xa1, 0xa2, 0xa3, 0xa4, 0xa5, 0xa6, 0xa7, 0xa8, 0xa9, 0xaa, 0xab, - 0xac, 0xad, 0xae, 0xaf, 0xb0, 0xb1, 0xb2, 0xb3, 0xb4, 0xb5, 0xb6, - 0xb7, 0xb8, 0xb9, 0xba, 0xbb, 0xbc, 0xbd, 0xbe, 0xbf}, - {0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, - 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, - 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, - 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, - 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, - 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, - 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, - 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd}}, + {{0x80, 0x81, 0x82, 0x83, 0x84, 0x85, 0x86, 0x87, 0x88, 0x89, 0x8A, + 0x8B, 0x8C, 0x8D, 0x8E, 0x8F, 0x90, 0x91, 0x92, 0x93, 0x94, 0x95, + 0x96, 0x97, 0x98, 0x99, 0x9A, 0x9B, 0x9C, 0x9D, 0x9E, 0x9F, 0xA0, + 0xA1, 0xA2, 0xA3, 0xA4, 0xA5, 0xA6, 0xA7, 0xA8, 0xA9, 0xAA, 0xAB, + 0xAC, 0xAD, 0xAE, 0xAF, 0xB0, 0xB1, 0xB2, 0xB3, 0xB4, 0xB5, 0xB6, + 0xB7, 0xB8, 0xB9, 0xBA, 0xBB, 0xBC, 0xBD, 0xBE, 0xBF}, + {0xFFFD, 0xFFFD, 0xFFFD, 0xFFFD, 0xFFFD, 0xFFFD, 0xFFFD, 0xFFFD, + 0xFFFD, 0xFFFD, 0xFFFD, 0xFFFD, 0xFFFD, 0xFFFD, 0xFFFD, 0xFFFD, + 0xFFFD, 0xFFFD, 0xFFFD, 0xFFFD, 0xFFFD, 0xFFFD, 0xFFFD, 0xFFFD, + 0xFFFD, 0xFFFD, 0xFFFD, 0xFFFD, 0xFFFD, 0xFFFD, 0xFFFD, 0xFFFD, + 0xFFFD, 0xFFFD, 0xFFFD, 0xFFFD, 0xFFFD, 0xFFFD, 0xFFFD, 0xFFFD, + 0xFFFD, 0xFFFD, 0xFFFD, 0xFFFD, 0xFFFD, 0xFFFD, 0xFFFD, 0xFFFD, + 0xFFFD, 0xFFFD, 0xFFFD, 0xFFFD, 0xFFFD, 0xFFFD, 0xFFFD, 0xFFFD, + 0xFFFD, 0xFFFD, 0xFFFD, 0xFFFD, 0xFFFD, 0xFFFD, 0xFFFD, 0xFFFD}}, // Using each possible continuation byte in a two-byte sequence: - {{0xd0, 0x80, 0xd0, 0x81, 0xd0, 0x82, 0xd0, 0x83, 0xd0, 0x84, 0xd0, 0x85, - 0xd0, 0x86, 0xd0, 0x87, 0xd0, 0x88, 0xd0, 0x89, 0xd0, 0x8a, 0xd0, 0x8b, - 0xd0, 0x8c, 0xd0, 0x8d, 0xd0, 0x8e, 0xd0, 0x8f, 0xd0, 0x90, 0xd0, 0x91, - 0xd0, 0x92, 0xd0, 0x93, 0xd0, 0x94, 0xd0, 0x95, 0xd0, 0x96, 0xd0, 0x97, - 0xd0, 0x98, 0xd0, 0x99, 0xd0, 0x9a, 0xd0, 0x9b, 0xd0, 0x9c, 0xd0, 0x9d, - 0xd0, 0x9e, 0xd0, 0x9f, 0xd0, 0xa0, 0xd0, 0xa1, 0xd0, 0xa2, 0xd0, 0xa3, - 0xd0, 0xa4, 0xd0, 0xa5, 0xd0, 0xa6, 0xd0, 0xa7, 0xd0, 0xa8, 0xd0, 0xa9, - 0xd0, 0xaa, 0xd0, 0xab, 0xd0, 0xac, 0xd0, 0xad, 0xd0, 0xae, 0xd0, 0xaf, - 0xd0, 0xb0, 0xd0, 0xb1, 0xd0, 0xb2, 0xd0, 0xb3, 0xd0, 0xb4, 0xd0, 0xb5, - 0xd0, 0xb6, 0xd0, 0xb7, 0xd0, 0xb8, 0xd0, 0xb9, 0xd0, 0xba, 0xd0, 0xbb, - 0xd0, 0xbc, 0xd0, 0xbd, 0xd0, 0xbe, 0xd0, 0xbf}, + {{0xD0, 0x80, 0xD0, 0x81, 0xD0, 0x82, 0xD0, 0x83, 0xD0, 0x84, 0xD0, 0x85, + 0xD0, 0x86, 0xD0, 0x87, 0xD0, 0x88, 0xD0, 0x89, 0xD0, 0x8A, 0xD0, 0x8B, + 0xD0, 0x8C, 0xD0, 0x8D, 0xD0, 0x8E, 0xD0, 0x8F, 0xD0, 0x90, 0xD0, 0x91, + 0xD0, 0x92, 0xD0, 0x93, 0xD0, 0x94, 0xD0, 0x95, 0xD0, 0x96, 0xD0, 0x97, + 0xD0, 0x98, 0xD0, 0x99, 0xD0, 0x9A, 0xD0, 0x9B, 0xD0, 0x9C, 0xD0, 0x9D, + 0xD0, 0x9E, 0xD0, 0x9F, 0xD0, 0xA0, 0xD0, 0xA1, 0xD0, 0xA2, 0xD0, 0xA3, + 0xD0, 0xA4, 0xD0, 0xA5, 0xD0, 0xA6, 0xD0, 0xA7, 0xD0, 0xA8, 0xD0, 0xA9, + 0xD0, 0xAA, 0xD0, 0xAB, 0xD0, 0xAC, 0xD0, 0xAD, 0xD0, 0xAE, 0xD0, 0xAF, + 0xD0, 0xB0, 0xD0, 0xB1, 0xD0, 0xB2, 0xD0, 0xB3, 0xD0, 0xB4, 0xD0, 0xB5, + 0xD0, 0xB6, 0xD0, 0xB7, 0xD0, 0xB8, 0xD0, 0xB9, 0xD0, 0xBA, 0xD0, 0xBB, + 0xD0, 0xBC, 0xD0, 0xBD, 0xD0, 0xBE, 0xD0, 0xBF}, {0x400, 0x401, 0x402, 0x403, 0x404, 0x405, 0x406, 0x407, 0x408, 0x409, - 0x40a, 0x40b, 0x40c, 0x40d, 0x40e, 0x40f, 0x410, 0x411, 0x412, 0x413, - 0x414, 0x415, 0x416, 0x417, 0x418, 0x419, 0x41a, 0x41b, 0x41c, 0x41d, - 0x41e, 0x41f, 0x420, 0x421, 0x422, 0x423, 0x424, 0x425, 0x426, 0x427, - 0x428, 0x429, 0x42a, 0x42b, 0x42c, 0x42d, 0x42e, 0x42f, 0x430, 0x431, - 0x432, 0x433, 0x434, 0x435, 0x436, 0x437, 0x438, 0x439, 0x43a, 0x43b, - 0x43c, 0x43d, 0x43e, 0x43f}}, + 0x40A, 0x40B, 0x40C, 0x40D, 0x40E, 0x40F, 0x410, 0x411, 0x412, 0x413, + 0x414, 0x415, 0x416, 0x417, 0x418, 0x419, 0x41A, 0x41B, 0x41C, 0x41D, + 0x41E, 0x41F, 0x420, 0x421, 0x422, 0x423, 0x424, 0x425, 0x426, 0x427, + 0x428, 0x429, 0x42A, 0x42B, 0x42C, 0x42D, 0x42E, 0x42F, 0x430, 0x431, + 0x432, 0x433, 0x434, 0x435, 0x436, 0x437, 0x438, 0x439, 0x43A, 0x43B, + 0x43C, 0x43D, 0x43E, 0x43F}}, // Lonely first bytes: // All 32 first bytes of 32-byte sequences, each followed by a space // (generates 32 invalid char + space sequences. - {{0xc0, 0x20, 0xc1, 0x20, 0xc2, 0x20, 0xc3, 0x20, 0xc4, 0x20, 0xc5, - 0x20, 0xc6, 0x20, 0xc7, 0x20, 0xc8, 0x20, 0xc9, 0x20, 0xca, 0x20, - 0xcb, 0x20, 0xcc, 0x20, 0xcd, 0x20, 0xce, 0x20, 0xcf, 0x20, 0xd0, - 0x20, 0xd1, 0x20, 0xd2, 0x20, 0xd3, 0x20, 0xd4, 0x20, 0xd5, 0x20, - 0xd6, 0x20, 0xd7, 0x20, 0xd8, 0x20, 0xd9, 0x20, 0xda, 0x20, 0xdb, - 0x20, 0xdc, 0x20, 0xdd, 0x20, 0xde, 0x20, 0xdf, 0x20}, - {0xfffd, 0x20, 0xfffd, 0x20, 0xfffd, 0x20, 0xfffd, 0x20, 0xfffd, 0x20, - 0xfffd, 0x20, 0xfffd, 0x20, 0xfffd, 0x20, 0xfffd, 0x20, 0xfffd, 0x20, - 0xfffd, 0x20, 0xfffd, 0x20, 0xfffd, 0x20, 0xfffd, 0x20, 0xfffd, 0x20, - 0xfffd, 0x20, 0xfffd, 0x20, 0xfffd, 0x20, 0xfffd, 0x20, 0xfffd, 0x20, - 0xfffd, 0x20, 0xfffd, 0x20, 0xfffd, 0x20, 0xfffd, 0x20, 0xfffd, 0x20, - 0xfffd, 0x20, 0xfffd, 0x20, 0xfffd, 0x20, 0xfffd, 0x20, 0xfffd, 0x20, - 0xfffd, 0x20, 0xfffd, 0x20}}, + {{0xC0, 0x20, 0xC1, 0x20, 0xC2, 0x20, 0xC3, 0x20, 0xC4, 0x20, 0xC5, + 0x20, 0xC6, 0x20, 0xC7, 0x20, 0xC8, 0x20, 0xC9, 0x20, 0xCA, 0x20, + 0xCB, 0x20, 0xCC, 0x20, 0xCD, 0x20, 0xCE, 0x20, 0xCF, 0x20, 0xD0, + 0x20, 0xD1, 0x20, 0xD2, 0x20, 0xD3, 0x20, 0xD4, 0x20, 0xD5, 0x20, + 0xD6, 0x20, 0xD7, 0x20, 0xD8, 0x20, 0xD9, 0x20, 0xDA, 0x20, 0xDB, + 0x20, 0xDC, 0x20, 0xDD, 0x20, 0xDE, 0x20, 0xDF, 0x20}, + {0xFFFD, 0x20, 0xFFFD, 0x20, 0xFFFD, 0x20, 0xFFFD, 0x20, 0xFFFD, 0x20, + 0xFFFD, 0x20, 0xFFFD, 0x20, 0xFFFD, 0x20, 0xFFFD, 0x20, 0xFFFD, 0x20, + 0xFFFD, 0x20, 0xFFFD, 0x20, 0xFFFD, 0x20, 0xFFFD, 0x20, 0xFFFD, 0x20, + 0xFFFD, 0x20, 0xFFFD, 0x20, 0xFFFD, 0x20, 0xFFFD, 0x20, 0xFFFD, 0x20, + 0xFFFD, 0x20, 0xFFFD, 0x20, 0xFFFD, 0x20, 0xFFFD, 0x20, 0xFFFD, 0x20, + 0xFFFD, 0x20, 0xFFFD, 0x20, 0xFFFD, 0x20, 0xFFFD, 0x20, 0xFFFD, 0x20, + 0xFFFD, 0x20, 0xFFFD, 0x20}}, // All 16 first bytes of 3-byte sequences, each followed by a space // (generates 16 invalid char + space sequences): - {{0xe0, 0x20, 0xe1, 0x20, 0xe2, 0x20, 0xe3, 0x20, 0xe4, 0x20, 0xe5, - 0x20, 0xe6, 0x20, 0xe7, 0x20, 0xe8, 0x20, 0xe9, 0x20, 0xea, 0x20, - 0xeb, 0x20, 0xec, 0x20, 0xed, 0x20, 0xee, 0x20, 0xef, 0x20}, - {0xfffd, 0x20, 0xfffd, 0x20, 0xfffd, 0x20, 0xfffd, 0x20, - 0xfffd, 0x20, 0xfffd, 0x20, 0xfffd, 0x20, 0xfffd, 0x20, - 0xfffd, 0x20, 0xfffd, 0x20, 0xfffd, 0x20, 0xfffd, 0x20, - 0xfffd, 0x20, 0xfffd, 0x20, 0xfffd, 0x20, 0xfffd, 0x20}}, + {{0xE0, 0x20, 0xE1, 0x20, 0xE2, 0x20, 0xE3, 0x20, 0xE4, 0x20, 0xE5, + 0x20, 0xE6, 0x20, 0xE7, 0x20, 0xE8, 0x20, 0xE9, 0x20, 0xEA, 0x20, + 0xEB, 0x20, 0xEC, 0x20, 0xED, 0x20, 0xEE, 0x20, 0xEF, 0x20}, + {0xFFFD, 0x20, 0xFFFD, 0x20, 0xFFFD, 0x20, 0xFFFD, 0x20, + 0xFFFD, 0x20, 0xFFFD, 0x20, 0xFFFD, 0x20, 0xFFFD, 0x20, + 0xFFFD, 0x20, 0xFFFD, 0x20, 0xFFFD, 0x20, 0xFFFD, 0x20, + 0xFFFD, 0x20, 0xFFFD, 0x20, 0xFFFD, 0x20, 0xFFFD, 0x20}}, // All 8 first bytes of 4-byte sequences, each followed by a space // (generates 8 invalid char + space sequences): - {{0xf0, 0x20, 0xf1, 0x20, 0xf2, 0x20, 0xf3, 0x20, 0xf4, 0x20, 0xf5, 0x20, - 0xf6, 0x20, 0xf7, 0x20}, - {0xfffd, 0x20, 0xfffd, 0x20, 0xfffd, 0x20, 0xfffd, 0x20, 0xfffd, 0x20, - 0xfffd, 0x20, 0xfffd, 0x20, 0xfffd, 0x20}}, + {{0xF0, 0x20, 0xF1, 0x20, 0xF2, 0x20, 0xF3, 0x20, 0xF4, 0x20, 0xF5, 0x20, + 0xF6, 0x20, 0xF7, 0x20}, + {0xFFFD, 0x20, 0xFFFD, 0x20, 0xFFFD, 0x20, 0xFFFD, 0x20, 0xFFFD, 0x20, + 0xFFFD, 0x20, 0xFFFD, 0x20, 0xFFFD, 0x20}}, // All 4 first bytes of 5-byte sequences (not supported), each followed by // a space (generates 4 invalid char + space sequences): - {{0xf8, 0x20, 0xf9, 0x20, 0xfa, 0x20, 0xfb, 0x20}, - {0xfffd, 0x20, 0xfffd, 0x20, 0xfffd, 0x20, 0xfffd, 0x20}}, + {{0xF8, 0x20, 0xF9, 0x20, 0xFA, 0x20, 0xFB, 0x20}, + {0xFFFD, 0x20, 0xFFFD, 0x20, 0xFFFD, 0x20, 0xFFFD, 0x20}}, // All 2 first bytes of 6-byte sequences (not supported), each followed by // a space (generates 2 invalid char + space sequences): - {{0xfc, 0x20, 0xfd, 0x20}, {0xfffd, 0x20, 0xfffd, 0x20}}, + {{0xFC, 0x20, 0xFD, 0x20}, {0xFFFD, 0x20, 0xFFFD, 0x20}}, // Sequences with last continuation byte missing. Normally the whole // incomplete sequence generates a single invalid character (exceptions // explained below). // 2-byte sequences with last byte missing - {{0xc0}, {0xfffd}}, - {{0xdf}, {0xfffd}}, + {{0xC0}, {0xFFFD}}, + {{0xDF}, {0xFFFD}}, // 3-byte sequences with last byte missing. - {{0xe8, 0x80}, {0xfffd}}, - {{0xe0, 0xbf}, {0xfffd}}, - {{0xef, 0xbf}, {0xfffd}}, + {{0xE8, 0x80}, {0xFFFD}}, + {{0xE0, 0xBF}, {0xFFFD}}, + {{0xEF, 0xBF}, {0xFFFD}}, // Start of an overlong sequence. The first "maximal subpart" is the first // byte; it creates an invalid character. Each following byte generates an // invalid character too. - {{0xe0, 0x80}, {0xfffd, 0xfffd}}, + {{0xE0, 0x80}, {0xFFFD, 0xFFFD}}, // 4-byte sequences with last byte missing - {{0xf1, 0x80, 0x80}, {0xfffd}}, - {{0xf4, 0x8f, 0xbf}, {0xfffd}}, + {{0xF1, 0x80, 0x80}, {0xFFFD}}, + {{0xF4, 0x8F, 0xBF}, {0xFFFD}}, // Start of an overlong sequence. The first "maximal subpart" is the first // byte; it creates an invalid character. Each following byte generates an // invalid character too. - {{0xf0, 0x80, 0x80}, {0xfffd, 0xfffd, 0xfffd}}, + {{0xF0, 0x80, 0x80}, {0xFFFD, 0xFFFD, 0xFFFD}}, // 5-byte sequences (not supported) with last byte missing - {{0xf8, 0x80, 0x80, 0x80}, {0xfffd, 0xfffd, 0xfffd, 0xfffd}}, - {{0xfb, 0xbf, 0xbf, 0xbf}, {0xfffd, 0xfffd, 0xfffd, 0xfffd}}, + {{0xF8, 0x80, 0x80, 0x80}, {0xFFFD, 0xFFFD, 0xFFFD, 0xFFFD}}, + {{0xFB, 0xBF, 0xBF, 0xBF}, {0xFFFD, 0xFFFD, 0xFFFD, 0xFFFD}}, // 6-byte sequences (not supported) with last byte missing - {{0xfc, 0x80, 0x80, 0x80, 0x80}, - {0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd}}, - {{0xfd, 0xbf, 0xbf, 0xbf, 0xbf}, - {0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd}}, + {{0xFC, 0x80, 0x80, 0x80, 0x80}, + {0xFFFD, 0xFFFD, 0xFFFD, 0xFFFD, 0xFFFD}}, + {{0xFD, 0xBF, 0xBF, 0xBF, 0xBF}, + {0xFFFD, 0xFFFD, 0xFFFD, 0xFFFD, 0xFFFD}}, // Concatenation of incomplete sequences: above incomplete sequences // concatenated. - {{0xc0, 0xdf, 0xe8, 0x80, 0xe0, 0xbf, 0xef, 0xbf, 0xe0, 0x80, - 0xf1, 0x80, 0x80, 0xf4, 0x8f, 0xbf, 0xf0, 0x80, 0x80, 0xf8, - 0x80, 0x80, 0x80, 0xfb, 0xbf, 0xbf, 0xbf, 0xfc, 0x80, 0x80, - 0x80, 0x80, 0xfd, 0xbf, 0xbf, 0xbf, 0xbf}, - {0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, - 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, - 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, - 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd}}, + {{0xC0, 0xDF, 0xE8, 0x80, 0xE0, 0xBF, 0xEF, 0xBF, 0xE0, 0x80, + 0xF1, 0x80, 0x80, 0xF4, 0x8F, 0xBF, 0xF0, 0x80, 0x80, 0xF8, + 0x80, 0x80, 0x80, 0xFB, 0xBF, 0xBF, 0xBF, 0xFC, 0x80, 0x80, + 0x80, 0x80, 0xFD, 0xBF, 0xBF, 0xBF, 0xBF}, + {0xFFFD, 0xFFFD, 0xFFFD, 0xFFFD, 0xFFFD, 0xFFFD, 0xFFFD, 0xFFFD, + 0xFFFD, 0xFFFD, 0xFFFD, 0xFFFD, 0xFFFD, 0xFFFD, 0xFFFD, 0xFFFD, + 0xFFFD, 0xFFFD, 0xFFFD, 0xFFFD, 0xFFFD, 0xFFFD, 0xFFFD, 0xFFFD, + 0xFFFD, 0xFFFD, 0xFFFD, 0xFFFD, 0xFFFD, 0xFFFD}}, // Incomplete sequence tests repeated with a space after the incomplete // sequence. // 2-byte sequences with last byte missing - {{0xc0, 0x20}, {0xfffd, 0x20}}, - {{0xdf, 0x20}, {0xfffd, 0x20}}, + {{0xC0, 0x20}, {0xFFFD, 0x20}}, + {{0xDF, 0x20}, {0xFFFD, 0x20}}, // 3-byte sequences with last byte missing - {{0xe8, 0x80, 0x20}, {0xfffd, 0x20}}, - {{0xe0, 0xbf, 0x20}, {0xfffd, 0x20}}, - {{0xef, 0xbf, 0x20}, {0xfffd, 0x20}}, + {{0xE8, 0x80, 0x20}, {0xFFFD, 0x20}}, + {{0xE0, 0xBF, 0x20}, {0xFFFD, 0x20}}, + {{0xEF, 0xBF, 0x20}, {0xFFFD, 0x20}}, // Start of overlong 3-byte sequence with last byte missing - {{0xe0, 0x80, 0x20}, {0xfffd, 0xfffd, 0x20}}, + {{0xE0, 0x80, 0x20}, {0xFFFD, 0xFFFD, 0x20}}, // 4-byte sequences with last byte missing - {{0xf1, 0x80, 0x80, 0x20}, {0xfffd, 0x20}}, - {{0xf4, 0x8f, 0xbf, 0x20}, {0xfffd, 0x20}}, + {{0xF1, 0x80, 0x80, 0x20}, {0xFFFD, 0x20}}, + {{0xF4, 0x8F, 0xBF, 0x20}, {0xFFFD, 0x20}}, // Start of overlong 4-byte sequence with last byte missing - {{0xf0, 0x80, 0x80, 0x20}, {0xfffd, 0xfffd, 0xfffd, 0x20}}, + {{0xF0, 0x80, 0x80, 0x20}, {0xFFFD, 0xFFFD, 0xFFFD, 0x20}}, // 5-byte sequences (not supported) with last byte missing - {{0xf8, 0x80, 0x80, 0x80, 0x20}, {0xfffd, 0xfffd, 0xfffd, 0xfffd, 0x20}}, - {{0xfb, 0xbf, 0xbf, 0xbf, 0x20}, {0xfffd, 0xfffd, 0xfffd, 0xfffd, 0x20}}, + {{0xF8, 0x80, 0x80, 0x80, 0x20}, {0xFFFD, 0xFFFD, 0xFFFD, 0xFFFD, 0x20}}, + {{0xFB, 0xBF, 0xBF, 0xBF, 0x20}, {0xFFFD, 0xFFFD, 0xFFFD, 0xFFFD, 0x20}}, // 6-byte sequences (not supported) with last byte missing - {{0xfc, 0x80, 0x80, 0x80, 0x80, 0x20}, - {0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0x20}}, - {{0xfd, 0xbf, 0xbf, 0xbf, 0xbf, 0x20}, - {0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0x20}}, + {{0xFC, 0x80, 0x80, 0x80, 0x80, 0x20}, + {0xFFFD, 0xFFFD, 0xFFFD, 0xFFFD, 0xFFFD, 0x20}}, + {{0xFD, 0xBF, 0xBF, 0xBF, 0xBF, 0x20}, + {0xFFFD, 0xFFFD, 0xFFFD, 0xFFFD, 0xFFFD, 0x20}}, // Impossible bytes - {{0xfe}, {0xfffd}}, - {{0xff}, {0xfffd}}, - {{0xfe, 0xfe, 0xff, 0xff}, {0xfffd, 0xfffd, 0xfffd, 0xfffd}}, + {{0xFE}, {0xFFFD}}, + {{0xFF}, {0xFFFD}}, + {{0xFE, 0xFE, 0xFF, 0xFF}, {0xFFFD, 0xFFFD, 0xFFFD, 0xFFFD}}, // Lead-byte-like bytes which aren't valid lead bytes. - {{0xc0}, {0xfffd}}, - {{0xc0, 0xaa}, {0xfffd, 0xfffd}}, - {{0xc1}, {0xfffd}}, - {{0xc1, 0xaa}, {0xfffd, 0xfffd}}, - {{0xf5}, {0xfffd}}, - {{0xf5, 0xaa, 0xaa, 0xaa}, {0xfffd, 0xfffd, 0xfffd, 0xfffd}}, - {{0xf6}, {0xfffd}}, - {{0xf6, 0xaa, 0xaa, 0xaa}, {0xfffd, 0xfffd, 0xfffd, 0xfffd}}, - {{0xf7}, {0xfffd}}, - {{0xf7, 0xaa, 0xaa, 0xaa}, {0xfffd, 0xfffd, 0xfffd, 0xfffd}}, - {{0xf8}, {0xfffd}}, - {{0xf8, 0xaa, 0xaa, 0xaa}, {0xfffd, 0xfffd, 0xfffd, 0xfffd}}, - {{0xf9}, {0xfffd}}, - {{0xf9, 0xaa, 0xaa, 0xaa}, {0xfffd, 0xfffd, 0xfffd, 0xfffd}}, - {{0xfa}, {0xfffd}}, - {{0xfa, 0xaa, 0xaa, 0xaa}, {0xfffd, 0xfffd, 0xfffd, 0xfffd}}, - {{0xfb}, {0xfffd}}, - {{0xfb, 0xaa, 0xaa, 0xaa}, {0xfffd, 0xfffd, 0xfffd, 0xfffd}}, - {{0xfc}, {0xfffd}}, - {{0xfc, 0xaa, 0xaa, 0xaa}, {0xfffd, 0xfffd, 0xfffd, 0xfffd}}, - {{0xfd}, {0xfffd}}, - {{0xfd, 0xaa, 0xaa, 0xaa}, {0xfffd, 0xfffd, 0xfffd, 0xfffd}}, - {{0xfe}, {0xfffd}}, - {{0xfe, 0xaa, 0xaa, 0xaa}, {0xfffd, 0xfffd, 0xfffd, 0xfffd}}, - {{0xff}, {0xfffd}}, - {{0xff, 0xaa, 0xaa, 0xaa}, {0xfffd, 0xfffd, 0xfffd, 0xfffd}}, + {{0xC0}, {0xFFFD}}, + {{0xC0, 0xAA}, {0xFFFD, 0xFFFD}}, + {{0xC1}, {0xFFFD}}, + {{0xC1, 0xAA}, {0xFFFD, 0xFFFD}}, + {{0xF5}, {0xFFFD}}, + {{0xF5, 0xAA, 0xAA, 0xAA}, {0xFFFD, 0xFFFD, 0xFFFD, 0xFFFD}}, + {{0xF6}, {0xFFFD}}, + {{0xF6, 0xAA, 0xAA, 0xAA}, {0xFFFD, 0xFFFD, 0xFFFD, 0xFFFD}}, + {{0xF7}, {0xFFFD}}, + {{0xF7, 0xAA, 0xAA, 0xAA}, {0xFFFD, 0xFFFD, 0xFFFD, 0xFFFD}}, + {{0xF8}, {0xFFFD}}, + {{0xF8, 0xAA, 0xAA, 0xAA}, {0xFFFD, 0xFFFD, 0xFFFD, 0xFFFD}}, + {{0xF9}, {0xFFFD}}, + {{0xF9, 0xAA, 0xAA, 0xAA}, {0xFFFD, 0xFFFD, 0xFFFD, 0xFFFD}}, + {{0xFA}, {0xFFFD}}, + {{0xFA, 0xAA, 0xAA, 0xAA}, {0xFFFD, 0xFFFD, 0xFFFD, 0xFFFD}}, + {{0xFB}, {0xFFFD}}, + {{0xFB, 0xAA, 0xAA, 0xAA}, {0xFFFD, 0xFFFD, 0xFFFD, 0xFFFD}}, + {{0xFC}, {0xFFFD}}, + {{0xFC, 0xAA, 0xAA, 0xAA}, {0xFFFD, 0xFFFD, 0xFFFD, 0xFFFD}}, + {{0xFD}, {0xFFFD}}, + {{0xFD, 0xAA, 0xAA, 0xAA}, {0xFFFD, 0xFFFD, 0xFFFD, 0xFFFD}}, + {{0xFE}, {0xFFFD}}, + {{0xFE, 0xAA, 0xAA, 0xAA}, {0xFFFD, 0xFFFD, 0xFFFD, 0xFFFD}}, + {{0xFF}, {0xFFFD}}, + {{0xFF, 0xAA, 0xAA, 0xAA}, {0xFFFD, 0xFFFD, 0xFFFD, 0xFFFD}}, // Overlong sequences: // Overlong encodings for "/" - {{0xc0, 0xaf}, {0xfffd, 0xfffd}}, - {{0xe0, 0x80, 0xaf}, {0xfffd, 0xfffd, 0xfffd}}, - {{0xf0, 0x80, 0x80, 0xaf}, {0xfffd, 0xfffd, 0xfffd, 0xfffd}}, + {{0xC0, 0xAF}, {0xFFFD, 0xFFFD}}, + {{0xE0, 0x80, 0xAF}, {0xFFFD, 0xFFFD, 0xFFFD}}, + {{0xF0, 0x80, 0x80, 0xAF}, {0xFFFD, 0xFFFD, 0xFFFD, 0xFFFD}}, // 5-byte sequence (not supported anyway) - {{0xf8, 0x80, 0x80, 0x80, 0xaf}, - {0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd}}, + {{0xF8, 0x80, 0x80, 0x80, 0xAF}, + {0xFFFD, 0xFFFD, 0xFFFD, 0xFFFD, 0xFFFD}}, // 6-byte sequence (not supported anyway) - {{0xfc, 0x80, 0x80, 0x80, 0x80, 0xaf}, - {0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd}}, + {{0xFC, 0x80, 0x80, 0x80, 0x80, 0xAF}, + {0xFFFD, 0xFFFD, 0xFFFD, 0xFFFD, 0xFFFD, 0xFFFD}}, // Maximum overlong sequences - {{0xc1, 0xbf}, {0xfffd, 0xfffd}}, - {{0xe0, 0x9f, 0xbf}, {0xfffd, 0xfffd, 0xfffd}}, - {{0xf0, 0x8f, 0xbf, 0xbf}, {0xfffd, 0xfffd, 0xfffd, 0xfffd}}, + {{0xC1, 0xBF}, {0xFFFD, 0xFFFD}}, + {{0xE0, 0x9F, 0xBF}, {0xFFFD, 0xFFFD, 0xFFFD}}, + {{0xF0, 0x8F, 0xBF, 0xBF}, {0xFFFD, 0xFFFD, 0xFFFD, 0xFFFD}}, // 5-byte sequence (not supported anyway) - {{0xf8, 0x87, 0xbf, 0xbf, 0xbf}, - {0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd}}, + {{0xF8, 0x87, 0xBF, 0xBF, 0xBF}, + {0xFFFD, 0xFFFD, 0xFFFD, 0xFFFD, 0xFFFD}}, // 6-byte sequence (not supported anyway) - {{0xfc, 0x83, 0xbf, 0xbf, 0xbf, 0xbf}, - {0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd}}, + {{0xFC, 0x83, 0xBF, 0xBF, 0xBF, 0xBF}, + {0xFFFD, 0xFFFD, 0xFFFD, 0xFFFD, 0xFFFD, 0xFFFD}}, // Overlong encodings for 0 - {{0xc0, 0x80}, {0xfffd, 0xfffd}}, - {{0xe0, 0x80, 0x80}, {0xfffd, 0xfffd, 0xfffd}}, - {{0xf0, 0x80, 0x80, 0x80}, {0xfffd, 0xfffd, 0xfffd, 0xfffd}}, + {{0xC0, 0x80}, {0xFFFD, 0xFFFD}}, + {{0xE0, 0x80, 0x80}, {0xFFFD, 0xFFFD, 0xFFFD}}, + {{0xF0, 0x80, 0x80, 0x80}, {0xFFFD, 0xFFFD, 0xFFFD, 0xFFFD}}, // 5-byte sequence (not supported anyway) - {{0xf8, 0x80, 0x80, 0x80, 0x80}, - {0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd}}, + {{0xF8, 0x80, 0x80, 0x80, 0x80}, + {0xFFFD, 0xFFFD, 0xFFFD, 0xFFFD, 0xFFFD}}, // 6-byte sequence (not supported anyway) - {{0xfc, 0x80, 0x80, 0x80, 0x80, 0x80}, - {0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd}}, + {{0xFC, 0x80, 0x80, 0x80, 0x80, 0x80}, + {0xFFFD, 0xFFFD, 0xFFFD, 0xFFFD, 0xFFFD, 0xFFFD}}, // Illegal code positions: // Single UTF-16 surrogates - {{0xed, 0xa0, 0x80}, {0xfffd, 0xfffd, 0xfffd}}, - {{0xed, 0xa0, 0x80}, {0xfffd, 0xfffd, 0xfffd}}, - {{0xed, 0xad, 0xbf}, {0xfffd, 0xfffd, 0xfffd}}, - {{0xed, 0xae, 0x80}, {0xfffd, 0xfffd, 0xfffd}}, - {{0xed, 0xaf, 0xbf}, {0xfffd, 0xfffd, 0xfffd}}, - {{0xed, 0xb0, 0x80}, {0xfffd, 0xfffd, 0xfffd}}, - {{0xed, 0xbe, 0x80}, {0xfffd, 0xfffd, 0xfffd}}, - {{0xed, 0xbf, 0xbf}, {0xfffd, 0xfffd, 0xfffd}}, + {{0xED, 0xA0, 0x80}, {0xFFFD, 0xFFFD, 0xFFFD}}, + {{0xED, 0xA0, 0x80}, {0xFFFD, 0xFFFD, 0xFFFD}}, + {{0xED, 0xAD, 0xBF}, {0xFFFD, 0xFFFD, 0xFFFD}}, + {{0xED, 0xAE, 0x80}, {0xFFFD, 0xFFFD, 0xFFFD}}, + {{0xED, 0xAF, 0xBF}, {0xFFFD, 0xFFFD, 0xFFFD}}, + {{0xED, 0xB0, 0x80}, {0xFFFD, 0xFFFD, 0xFFFD}}, + {{0xED, 0xBE, 0x80}, {0xFFFD, 0xFFFD, 0xFFFD}}, + {{0xED, 0xBF, 0xBF}, {0xFFFD, 0xFFFD, 0xFFFD}}, // Paired surrogates - {{0xed, 0xa0, 0x80, 0xed, 0xb0, 0x80}, - {0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd}}, - {{0xed, 0xa0, 0x80, 0xed, 0xbf, 0xbf}, - {0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd}}, - {{0xed, 0xad, 0xbf, 0xed, 0xb0, 0x80}, - {0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd}}, - {{0xed, 0xad, 0xbf, 0xed, 0xbf, 0xbf}, - {0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd}}, - {{0xed, 0xae, 0x80, 0xed, 0xb0, 0x80}, - {0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd}}, - {{0xed, 0xae, 0x80, 0xed, 0xbf, 0xbf}, - {0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd}}, - {{0xed, 0xaf, 0xbf, 0xed, 0xb0, 0x80}, - {0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd}}, - {{0xed, 0xaf, 0xbf, 0xed, 0xbf, 0xbf}, - {0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd}}, + {{0xED, 0xA0, 0x80, 0xED, 0xB0, 0x80}, + {0xFFFD, 0xFFFD, 0xFFFD, 0xFFFD, 0xFFFD, 0xFFFD}}, + {{0xED, 0xA0, 0x80, 0xED, 0xBF, 0xBF}, + {0xFFFD, 0xFFFD, 0xFFFD, 0xFFFD, 0xFFFD, 0xFFFD}}, + {{0xED, 0xAD, 0xBF, 0xED, 0xB0, 0x80}, + {0xFFFD, 0xFFFD, 0xFFFD, 0xFFFD, 0xFFFD, 0xFFFD}}, + {{0xED, 0xAD, 0xBF, 0xED, 0xBF, 0xBF}, + {0xFFFD, 0xFFFD, 0xFFFD, 0xFFFD, 0xFFFD, 0xFFFD}}, + {{0xED, 0xAE, 0x80, 0xED, 0xB0, 0x80}, + {0xFFFD, 0xFFFD, 0xFFFD, 0xFFFD, 0xFFFD, 0xFFFD}}, + {{0xED, 0xAE, 0x80, 0xED, 0xBF, 0xBF}, + {0xFFFD, 0xFFFD, 0xFFFD, 0xFFFD, 0xFFFD, 0xFFFD}}, + {{0xED, 0xAF, 0xBF, 0xED, 0xB0, 0x80}, + {0xFFFD, 0xFFFD, 0xFFFD, 0xFFFD, 0xFFFD, 0xFFFD}}, + {{0xED, 0xAF, 0xBF, 0xED, 0xBF, 0xBF}, + {0xFFFD, 0xFFFD, 0xFFFD, 0xFFFD, 0xFFFD, 0xFFFD}}, // Surrogates with the last byte missing. - {{0xed, 0xa0}, {0xfffd, 0xfffd}}, - {{0xed, 0xa0}, {0xfffd, 0xfffd}}, - {{0xed, 0xad}, {0xfffd, 0xfffd}}, - {{0xed, 0xae}, {0xfffd, 0xfffd}}, - {{0xed, 0xaf}, {0xfffd, 0xfffd}}, - {{0xed, 0xb0}, {0xfffd, 0xfffd}}, - {{0xed, 0xbe}, {0xfffd, 0xfffd}}, - {{0xed, 0xbf}, {0xfffd, 0xfffd}}, + {{0xED, 0xA0}, {0xFFFD, 0xFFFD}}, + {{0xED, 0xA0}, {0xFFFD, 0xFFFD}}, + {{0xED, 0xAD}, {0xFFFD, 0xFFFD}}, + {{0xED, 0xAE}, {0xFFFD, 0xFFFD}}, + {{0xED, 0xAF}, {0xFFFD, 0xFFFD}}, + {{0xED, 0xB0}, {0xFFFD, 0xFFFD}}, + {{0xED, 0xBE}, {0xFFFD, 0xFFFD}}, + {{0xED, 0xBF}, {0xFFFD, 0xFFFD}}, // Other non-characters - {{0xef, 0xbf, 0xbe}, {0xfffe}}, - {{0xef, 0xbf, 0xbf}, {0xffff}}, - {{0xef, 0xb7, 0x90, 0xef, 0xb7, 0x91, 0xef, 0xb7, 0x92, 0xef, 0xb7, 0x93, - 0xef, 0xb7, 0x94, 0xef, 0xb7, 0x95, 0xef, 0xb7, 0x96, 0xef, 0xb7, 0x97, - 0xef, 0xb7, 0x98, 0xef, 0xb7, 0x99, 0xef, 0xb7, 0x9a, 0xef, 0xb7, 0x9b, - 0xef, 0xb7, 0x9c, 0xef, 0xb7, 0x9d, 0xef, 0xb7, 0x9e, 0xef, 0xb7, 0x9f, - 0xef, 0xb7, 0xa0, 0xef, 0xb7, 0xa1, 0xef, 0xb7, 0xa2, 0xef, 0xb7, 0xa3, - 0xef, 0xb7, 0xa4, 0xef, 0xb7, 0xa5, 0xef, 0xb7, 0xa6, 0xef, 0xb7, 0xa7, - 0xef, 0xb7, 0xa8, 0xef, 0xb7, 0xa9, 0xef, 0xb7, 0xaa, 0xef, 0xb7, 0xab, - 0xef, 0xb7, 0xac, 0xef, 0xb7, 0xad, 0xef, 0xb7, 0xae, 0xef, 0xb7, 0xaf}, - {0xfdd0, 0xfdd1, 0xfdd2, 0xfdd3, 0xfdd4, 0xfdd5, 0xfdd6, 0xfdd7, - 0xfdd8, 0xfdd9, 0xfdda, 0xfddb, 0xfddc, 0xfddd, 0xfdde, 0xfddf, - 0xfde0, 0xfde1, 0xfde2, 0xfde3, 0xfde4, 0xfde5, 0xfde6, 0xfde7, - 0xfde8, 0xfde9, 0xfdea, 0xfdeb, 0xfdec, 0xfded, 0xfdee, 0xfdef}}, - {{0xf0, 0x9f, 0xbf, 0xbe, 0xf0, 0x9f, 0xbf, 0xbf, 0xf0, 0xaf, 0xbf, - 0xbe, 0xf0, 0xaf, 0xbf, 0xbf, 0xf0, 0xbf, 0xbf, 0xbe, 0xf0, 0xbf, - 0xbf, 0xbf, 0xf1, 0x8f, 0xbf, 0xbe, 0xf1, 0x8f, 0xbf, 0xbf, 0xf1, - 0x9f, 0xbf, 0xbe, 0xf1, 0x9f, 0xbf, 0xbf, 0xf1, 0xaf, 0xbf, 0xbe, - 0xf1, 0xaf, 0xbf, 0xbf, 0xf1, 0xbf, 0xbf, 0xbe, 0xf1, 0xbf, 0xbf, - 0xbf, 0xf2, 0x8f, 0xbf, 0xbe, 0xf2, 0x8f, 0xbf, 0xbf}, - {0x1fffe, 0x1ffff, 0x2fffe, 0x2ffff, 0x3fffe, 0x3ffff, 0x4fffe, 0x4ffff, - 0x5fffe, 0x5ffff, 0x6fffe, 0x6ffff, 0x7fffe, 0x7ffff, 0x8fffe, - 0x8ffff}}, + {{0xEF, 0xBF, 0xBE}, {0xFFFE}}, + {{0xEF, 0xBF, 0xBF}, {0xFFFF}}, + {{0xEF, 0xB7, 0x90, 0xEF, 0xB7, 0x91, 0xEF, 0xB7, 0x92, 0xEF, 0xB7, 0x93, + 0xEF, 0xB7, 0x94, 0xEF, 0xB7, 0x95, 0xEF, 0xB7, 0x96, 0xEF, 0xB7, 0x97, + 0xEF, 0xB7, 0x98, 0xEF, 0xB7, 0x99, 0xEF, 0xB7, 0x9A, 0xEF, 0xB7, 0x9B, + 0xEF, 0xB7, 0x9C, 0xEF, 0xB7, 0x9D, 0xEF, 0xB7, 0x9E, 0xEF, 0xB7, 0x9F, + 0xEF, 0xB7, 0xA0, 0xEF, 0xB7, 0xA1, 0xEF, 0xB7, 0xA2, 0xEF, 0xB7, 0xA3, + 0xEF, 0xB7, 0xA4, 0xEF, 0xB7, 0xA5, 0xEF, 0xB7, 0xA6, 0xEF, 0xB7, 0xA7, + 0xEF, 0xB7, 0xA8, 0xEF, 0xB7, 0xA9, 0xEF, 0xB7, 0xAA, 0xEF, 0xB7, 0xAB, + 0xEF, 0xB7, 0xAC, 0xEF, 0xB7, 0xAD, 0xEF, 0xB7, 0xAE, 0xEF, 0xB7, 0xAF}, + {0xFDD0, 0xFDD1, 0xFDD2, 0xFDD3, 0xFDD4, 0xFDD5, 0xFDD6, 0xFDD7, + 0xFDD8, 0xFDD9, 0xFDDA, 0xFDDB, 0xFDDC, 0xFDDD, 0xFDDE, 0xFDDF, + 0xFDE0, 0xFDE1, 0xFDE2, 0xFDE3, 0xFDE4, 0xFDE5, 0xFDE6, 0xFDE7, + 0xFDE8, 0xFDE9, 0xFDEA, 0xFDEB, 0xFDEC, 0xFDED, 0xFDEE, 0xFDEF}}, + {{0xF0, 0x9F, 0xBF, 0xBE, 0xF0, 0x9F, 0xBF, 0xBF, 0xF0, 0xAF, 0xBF, + 0xBE, 0xF0, 0xAF, 0xBF, 0xBF, 0xF0, 0xBF, 0xBF, 0xBE, 0xF0, 0xBF, + 0xBF, 0xBF, 0xF1, 0x8F, 0xBF, 0xBE, 0xF1, 0x8F, 0xBF, 0xBF, 0xF1, + 0x9F, 0xBF, 0xBE, 0xF1, 0x9F, 0xBF, 0xBF, 0xF1, 0xAF, 0xBF, 0xBE, + 0xF1, 0xAF, 0xBF, 0xBF, 0xF1, 0xBF, 0xBF, 0xBE, 0xF1, 0xBF, 0xBF, + 0xBF, 0xF2, 0x8F, 0xBF, 0xBE, 0xF2, 0x8F, 0xBF, 0xBF}, + {0x1FFFE, 0x1FFFF, 0x2FFFE, 0x2FFFF, 0x3FFFE, 0x3FFFF, 0x4FFFE, 0x4FFFF, + 0x5FFFE, 0x5FFFF, 0x6FFFE, 0x6FFFF, 0x7FFFE, 0x7FFFF, 0x8FFFE, + 0x8FFFF}}, }; for (auto test : data) { diff --git a/deps/v8/test/unittests/unittests.gyp b/deps/v8/test/unittests/unittests.gyp index 575f550871..50e820e5f1 100644 --- a/deps/v8/test/unittests/unittests.gyp +++ b/deps/v8/test/unittests/unittests.gyp @@ -8,6 +8,7 @@ 'variables': { 'v8_code': 1, 'unittests_sources': [ ### gcmole(all) ### + 'allocation-unittest.cc', 'api/access-check-unittest.cc', 'api/exception-unittest.cc', 'api/interceptor-unittest.cc', @@ -90,6 +91,7 @@ 'compiler/schedule-unittest.cc', 'compiler/scheduler-unittest.cc', 'compiler/scheduler-rpo-unittest.cc', + 'compiler/simplified-lowering-unittest.cc', 'compiler/simplified-operator-reducer-unittest.cc', 'compiler/simplified-operator-unittest.cc', 'compiler/state-values-utils-unittest.cc', @@ -158,7 +160,7 @@ 'wasm/control-transfer-unittest.cc', 'wasm/decoder-unittest.cc', 'wasm/function-body-decoder-unittest.cc', - 'wasm/wasm-heap-unittest.cc', + 'wasm/wasm-code-manager-unittest.cc', 'wasm/leb-helper-unittest.cc', 'wasm/loop-assignment-analysis-unittest.cc', 'wasm/module-decoder-unittest.cc', diff --git a/deps/v8/test/unittests/unittests.isolate b/deps/v8/test/unittests/unittests.isolate index ae503bf9bf..ec3bae42d3 100644 --- a/deps/v8/test/unittests/unittests.isolate +++ b/deps/v8/test/unittests/unittests.isolate @@ -5,6 +5,7 @@ 'variables': { 'files': [ '<(PRODUCT_DIR)/unittests<(EXECUTABLE_SUFFIX)', + './testcfg.py', './unittests.status', ], }, @@ -12,4 +13,4 @@ '../../src/base.isolate', '../../tools/testrunner/testrunner.isolate', ], -}
\ No newline at end of file +} diff --git a/deps/v8/test/unittests/value-serializer-unittest.cc b/deps/v8/test/unittests/value-serializer-unittest.cc index b3e656e917..c143b58090 100644 --- a/deps/v8/test/unittests/value-serializer-unittest.cc +++ b/deps/v8/test/unittests/value-serializer-unittest.cc @@ -289,11 +289,11 @@ class ValueSerializerTest : public TestWithIsolate { TEST_F(ValueSerializerTest, DecodeInvalid) { // Version tag but no content. - InvalidDecodeTest({0xff}); + InvalidDecodeTest({0xFF}); // Version too large. - InvalidDecodeTest({0xff, 0x7f, 0x5f}); + InvalidDecodeTest({0xFF, 0x7F, 0x5F}); // Nonsense tag. - InvalidDecodeTest({0xff, 0x09, 0xdd}); + InvalidDecodeTest({0xFF, 0x09, 0xDD}); } TEST_F(ValueSerializerTest, RoundTripOddball) { @@ -309,27 +309,27 @@ TEST_F(ValueSerializerTest, RoundTripOddball) { TEST_F(ValueSerializerTest, DecodeOddball) { // What this code is expected to generate. - DecodeTest({0xff, 0x09, 0x5f}, + DecodeTest({0xFF, 0x09, 0x5F}, [](Local<Value> value) { EXPECT_TRUE(value->IsUndefined()); }); - DecodeTest({0xff, 0x09, 0x54}, + DecodeTest({0xFF, 0x09, 0x54}, [](Local<Value> value) { EXPECT_TRUE(value->IsTrue()); }); - DecodeTest({0xff, 0x09, 0x46}, + DecodeTest({0xFF, 0x09, 0x46}, [](Local<Value> value) { EXPECT_TRUE(value->IsFalse()); }); - DecodeTest({0xff, 0x09, 0x30}, + DecodeTest({0xFF, 0x09, 0x30}, [](Local<Value> value) { EXPECT_TRUE(value->IsNull()); }); // What v9 of the Blink code generates. - DecodeTest({0xff, 0x09, 0x3f, 0x00, 0x5f, 0x00}, + DecodeTest({0xFF, 0x09, 0x3F, 0x00, 0x5F, 0x00}, [](Local<Value> value) { EXPECT_TRUE(value->IsUndefined()); }); - DecodeTest({0xff, 0x09, 0x3f, 0x00, 0x54, 0x00}, + DecodeTest({0xFF, 0x09, 0x3F, 0x00, 0x54, 0x00}, [](Local<Value> value) { EXPECT_TRUE(value->IsTrue()); }); - DecodeTest({0xff, 0x09, 0x3f, 0x00, 0x46, 0x00}, + DecodeTest({0xFF, 0x09, 0x3F, 0x00, 0x46, 0x00}, [](Local<Value> value) { EXPECT_TRUE(value->IsFalse()); }); - DecodeTest({0xff, 0x09, 0x3f, 0x00, 0x30, 0x00}, + DecodeTest({0xFF, 0x09, 0x3F, 0x00, 0x30, 0x00}, [](Local<Value> value) { EXPECT_TRUE(value->IsNull()); }); // v0 (with no explicit version). - DecodeTest({0x5f, 0x00}, + DecodeTest({0x5F, 0x00}, [](Local<Value> value) { EXPECT_TRUE(value->IsUndefined()); }); DecodeTest({0x54, 0x00}, [](Local<Value> value) { EXPECT_TRUE(value->IsTrue()); }); @@ -376,44 +376,40 @@ TEST_F(ValueSerializerTest, RoundTripNumber) { TEST_F(ValueSerializerTest, DecodeNumber) { // 42 zig-zag encoded (signed) - DecodeTest({0xff, 0x09, 0x49, 0x54}, - [](Local<Value> value) { - ASSERT_TRUE(value->IsInt32()); - EXPECT_EQ(42, Int32::Cast(*value)->Value()); - }); + DecodeTest({0xFF, 0x09, 0x49, 0x54}, [](Local<Value> value) { + ASSERT_TRUE(value->IsInt32()); + EXPECT_EQ(42, Int32::Cast(*value)->Value()); + }); // 42 varint encoded (unsigned) - DecodeTest({0xff, 0x09, 0x55, 0x2a}, - [](Local<Value> value) { - ASSERT_TRUE(value->IsInt32()); - EXPECT_EQ(42, Int32::Cast(*value)->Value()); - }); + DecodeTest({0xFF, 0x09, 0x55, 0x2A}, [](Local<Value> value) { + ASSERT_TRUE(value->IsInt32()); + EXPECT_EQ(42, Int32::Cast(*value)->Value()); + }); // 160 zig-zag encoded (signed) - DecodeTest({0xff, 0x09, 0x49, 0xc0, 0x02}, - [](Local<Value> value) { - ASSERT_TRUE(value->IsInt32()); - ASSERT_EQ(160, Int32::Cast(*value)->Value()); - }); + DecodeTest({0xFF, 0x09, 0x49, 0xC0, 0x02}, [](Local<Value> value) { + ASSERT_TRUE(value->IsInt32()); + ASSERT_EQ(160, Int32::Cast(*value)->Value()); + }); // 160 varint encoded (unsigned) - DecodeTest({0xff, 0x09, 0x55, 0xa0, 0x01}, - [](Local<Value> value) { - ASSERT_TRUE(value->IsInt32()); - ASSERT_EQ(160, Int32::Cast(*value)->Value()); - }); + DecodeTest({0xFF, 0x09, 0x55, 0xA0, 0x01}, [](Local<Value> value) { + ASSERT_TRUE(value->IsInt32()); + ASSERT_EQ(160, Int32::Cast(*value)->Value()); + }); #if defined(V8_TARGET_LITTLE_ENDIAN) // IEEE 754 doubles, little-endian byte order - DecodeTest({0xff, 0x09, 0x4e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xd0, 0xbf}, + DecodeTest({0xFF, 0x09, 0x4E, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xD0, 0xBF}, [](Local<Value> value) { ASSERT_TRUE(value->IsNumber()); EXPECT_EQ(-0.25, Number::Cast(*value)->Value()); }); // quiet NaN - DecodeTest({0xff, 0x09, 0x4e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf8, 0x7f}, + DecodeTest({0xFF, 0x09, 0x4E, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xF8, 0x7F}, [](Local<Value> value) { ASSERT_TRUE(value->IsNumber()); EXPECT_TRUE(std::isnan(Number::Cast(*value)->Value())); }); // signaling NaN - DecodeTest({0xff, 0x09, 0x4e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf4, 0x7f}, + DecodeTest({0xFF, 0x09, 0x4E, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xF4, 0x7F}, [](Local<Value> value) { ASSERT_TRUE(value->IsNumber()); EXPECT_TRUE(std::isnan(Number::Cast(*value)->Value())); @@ -458,24 +454,23 @@ TEST_F(ValueSerializerTest, RoundTripString) { TEST_F(ValueSerializerTest, DecodeString) { // Decoding the strings above from UTF-8. - DecodeTest({0xff, 0x09, 0x53, 0x00}, - [](Local<Value> value) { - ASSERT_TRUE(value->IsString()); - EXPECT_EQ(0, String::Cast(*value)->Length()); - }); - DecodeTest({0xff, 0x09, 0x53, 0x05, 'H', 'e', 'l', 'l', 'o'}, + DecodeTest({0xFF, 0x09, 0x53, 0x00}, [](Local<Value> value) { + ASSERT_TRUE(value->IsString()); + EXPECT_EQ(0, String::Cast(*value)->Length()); + }); + DecodeTest({0xFF, 0x09, 0x53, 0x05, 'H', 'e', 'l', 'l', 'o'}, [this](Local<Value> value) { ASSERT_TRUE(value->IsString()); EXPECT_EQ(5, String::Cast(*value)->Length()); EXPECT_EQ(kHelloString, Utf8Value(value)); }); - DecodeTest({0xff, 0x09, 0x53, 0x07, 'Q', 'u', 0xc3, 0xa9, 'b', 'e', 'c'}, + DecodeTest({0xFF, 0x09, 0x53, 0x07, 'Q', 'u', 0xC3, 0xA9, 'b', 'e', 'c'}, [this](Local<Value> value) { ASSERT_TRUE(value->IsString()); EXPECT_EQ(6, String::Cast(*value)->Length()); EXPECT_EQ(kQuebecString, Utf8Value(value)); }); - DecodeTest({0xff, 0x09, 0x53, 0x04, 0xf0, 0x9f, 0x91, 0x8a}, + DecodeTest({0xFF, 0x09, 0x53, 0x04, 0xF0, 0x9F, 0x91, 0x8A}, [this](Local<Value> value) { ASSERT_TRUE(value->IsString()); EXPECT_EQ(2, String::Cast(*value)->Length()); @@ -483,17 +478,17 @@ TEST_F(ValueSerializerTest, DecodeString) { }); // And from Latin-1 (for the ones that fit). - DecodeTest({0xff, 0x0a, 0x22, 0x00}, [](Local<Value> value) { + DecodeTest({0xFF, 0x0A, 0x22, 0x00}, [](Local<Value> value) { ASSERT_TRUE(value->IsString()); EXPECT_EQ(0, String::Cast(*value)->Length()); }); - DecodeTest({0xff, 0x0a, 0x22, 0x05, 'H', 'e', 'l', 'l', 'o'}, + DecodeTest({0xFF, 0x0A, 0x22, 0x05, 'H', 'e', 'l', 'l', 'o'}, [this](Local<Value> value) { ASSERT_TRUE(value->IsString()); EXPECT_EQ(5, String::Cast(*value)->Length()); EXPECT_EQ(kHelloString, Utf8Value(value)); }); - DecodeTest({0xff, 0x0a, 0x22, 0x06, 'Q', 'u', 0xe9, 'b', 'e', 'c'}, + DecodeTest({0xFF, 0x0A, 0x22, 0x06, 'Q', 'u', 0xE9, 'b', 'e', 'c'}, [this](Local<Value> value) { ASSERT_TRUE(value->IsString()); EXPECT_EQ(6, String::Cast(*value)->Length()); @@ -502,26 +497,25 @@ TEST_F(ValueSerializerTest, DecodeString) { // And from two-byte strings (endianness dependent). #if defined(V8_TARGET_LITTLE_ENDIAN) - DecodeTest({0xff, 0x09, 0x63, 0x00}, - [](Local<Value> value) { - ASSERT_TRUE(value->IsString()); - EXPECT_EQ(0, String::Cast(*value)->Length()); - }); - DecodeTest({0xff, 0x09, 0x63, 0x0a, 'H', '\0', 'e', '\0', 'l', '\0', 'l', + DecodeTest({0xFF, 0x09, 0x63, 0x00}, [](Local<Value> value) { + ASSERT_TRUE(value->IsString()); + EXPECT_EQ(0, String::Cast(*value)->Length()); + }); + DecodeTest({0xFF, 0x09, 0x63, 0x0A, 'H', '\0', 'e', '\0', 'l', '\0', 'l', '\0', 'o', '\0'}, [this](Local<Value> value) { ASSERT_TRUE(value->IsString()); EXPECT_EQ(5, String::Cast(*value)->Length()); EXPECT_EQ(kHelloString, Utf8Value(value)); }); - DecodeTest({0xff, 0x09, 0x63, 0x0c, 'Q', '\0', 'u', '\0', 0xe9, '\0', 'b', + DecodeTest({0xFF, 0x09, 0x63, 0x0C, 'Q', '\0', 'u', '\0', 0xE9, '\0', 'b', '\0', 'e', '\0', 'c', '\0'}, [this](Local<Value> value) { ASSERT_TRUE(value->IsString()); EXPECT_EQ(6, String::Cast(*value)->Length()); EXPECT_EQ(kQuebecString, Utf8Value(value)); }); - DecodeTest({0xff, 0x09, 0x63, 0x04, 0x3d, 0xd8, 0x4a, 0xdc}, + DecodeTest({0xFF, 0x09, 0x63, 0x04, 0x3D, 0xD8, 0x4A, 0xDC}, [this](Local<Value> value) { ASSERT_TRUE(value->IsString()); EXPECT_EQ(2, String::Cast(*value)->Length()); @@ -533,14 +527,14 @@ TEST_F(ValueSerializerTest, DecodeString) { TEST_F(ValueSerializerTest, DecodeInvalidString) { // UTF-8 string with too few bytes available. - InvalidDecodeTest({0xff, 0x09, 0x53, 0x10, 'v', '8'}); + InvalidDecodeTest({0xFF, 0x09, 0x53, 0x10, 'v', '8'}); // One-byte string with too few bytes available. - InvalidDecodeTest({0xff, 0x0a, 0x22, 0x10, 'v', '8'}); + InvalidDecodeTest({0xFF, 0x0A, 0x22, 0x10, 'v', '8'}); #if defined(V8_TARGET_LITTLE_ENDIAN) // Two-byte string with too few bytes available. - InvalidDecodeTest({0xff, 0x09, 0x63, 0x10, 'v', '\0', '8', '\0'}); + InvalidDecodeTest({0xFF, 0x09, 0x63, 0x10, 'v', '\0', '8', '\0'}); // Two-byte string with an odd byte length. - InvalidDecodeTest({0xff, 0x09, 0x63, 0x03, 'v', '\0', '8'}); + InvalidDecodeTest({0xFF, 0x09, 0x63, 0x03, 'v', '\0', '8'}); #endif // TODO(jbroman): The same for big-endian systems. } @@ -565,9 +559,9 @@ TEST_F(ValueSerializerTest, EncodeTwoByteStringUsesPadding) { // what that value may be. const uint8_t expected_prefix[] = {0x00, 0x63, 0x94, 0x03}; ASSERT_GT(data.size(), sizeof(expected_prefix) + 2); - EXPECT_EQ(0xff, data[0]); + EXPECT_EQ(0xFF, data[0]); EXPECT_GE(data[1], 0x09); - EXPECT_LE(data[1], 0x7f); + EXPECT_LE(data[1], 0x7F); EXPECT_TRUE(std::equal(std::begin(expected_prefix), std::end(expected_prefix), data.begin() + 2)); }); @@ -630,7 +624,7 @@ TEST_F(ValueSerializerTest, RoundTripDictionaryObject) { TEST_F(ValueSerializerTest, DecodeDictionaryObject) { // Empty object. - DecodeTest({0xff, 0x09, 0x3f, 0x00, 0x6f, 0x7b, 0x00, 0x00}, + DecodeTest({0xFF, 0x09, 0x3F, 0x00, 0x6F, 0x7B, 0x00, 0x00}, [this](Local<Value> value) { ASSERT_TRUE(value->IsObject()); EXPECT_TRUE(EvaluateScriptForResultBool( @@ -640,8 +634,8 @@ TEST_F(ValueSerializerTest, DecodeDictionaryObject) { }); // String key. DecodeTest( - {0xff, 0x09, 0x3f, 0x00, 0x6f, 0x3f, 0x01, 0x53, 0x01, 0x61, 0x3f, 0x01, - 0x49, 0x54, 0x7b, 0x01}, + {0xFF, 0x09, 0x3F, 0x00, 0x6F, 0x3F, 0x01, 0x53, 0x01, 0x61, 0x3F, 0x01, + 0x49, 0x54, 0x7B, 0x01}, [this](Local<Value> value) { ASSERT_TRUE(value->IsObject()); EXPECT_TRUE(EvaluateScriptForResultBool("result.hasOwnProperty('a')")); @@ -651,8 +645,8 @@ TEST_F(ValueSerializerTest, DecodeDictionaryObject) { }); // Integer key (treated as a string, but may be encoded differently). DecodeTest( - {0xff, 0x09, 0x3f, 0x00, 0x6f, 0x3f, 0x01, 0x49, 0x54, 0x3f, 0x01, 0x53, - 0x01, 0x61, 0x7b, 0x01}, + {0xFF, 0x09, 0x3F, 0x00, 0x6F, 0x3F, 0x01, 0x49, 0x54, 0x3F, 0x01, 0x53, + 0x01, 0x61, 0x7B, 0x01}, [this](Local<Value> value) { ASSERT_TRUE(value->IsObject()); EXPECT_TRUE(EvaluateScriptForResultBool("result.hasOwnProperty('42')")); @@ -662,20 +656,20 @@ TEST_F(ValueSerializerTest, DecodeDictionaryObject) { }); // Key order must be preserved. DecodeTest( - {0xff, 0x09, 0x3f, 0x00, 0x6f, 0x3f, 0x01, 0x53, 0x01, 0x78, 0x3f, 0x01, - 0x49, 0x02, 0x3f, 0x01, 0x53, 0x01, 0x79, 0x3f, 0x01, 0x49, 0x04, 0x3f, - 0x01, 0x53, 0x01, 0x61, 0x3f, 0x01, 0x49, 0x06, 0x7b, 0x03}, + {0xFF, 0x09, 0x3F, 0x00, 0x6F, 0x3F, 0x01, 0x53, 0x01, 0x78, 0x3F, 0x01, + 0x49, 0x02, 0x3F, 0x01, 0x53, 0x01, 0x79, 0x3F, 0x01, 0x49, 0x04, 0x3F, + 0x01, 0x53, 0x01, 0x61, 0x3F, 0x01, 0x49, 0x06, 0x7B, 0x03}, [this](Local<Value> value) { EXPECT_TRUE(EvaluateScriptForResultBool( "Object.getOwnPropertyNames(result).toString() === 'x,y,a'")); }); // A harder case of enumeration order. DecodeTest( - {0xff, 0x09, 0x3f, 0x00, 0x6f, 0x3f, 0x01, 0x49, 0x02, 0x3f, 0x01, - 0x49, 0x00, 0x3f, 0x01, 0x55, 0xfe, 0xff, 0xff, 0xff, 0x0f, 0x3f, - 0x01, 0x49, 0x06, 0x3f, 0x01, 0x53, 0x01, 0x61, 0x3f, 0x01, 0x49, - 0x04, 0x3f, 0x01, 0x53, 0x0a, 0x34, 0x32, 0x39, 0x34, 0x39, 0x36, - 0x37, 0x32, 0x39, 0x35, 0x3f, 0x01, 0x49, 0x02, 0x7b, 0x04}, + {0xFF, 0x09, 0x3F, 0x00, 0x6F, 0x3F, 0x01, 0x49, 0x02, 0x3F, 0x01, + 0x49, 0x00, 0x3F, 0x01, 0x55, 0xFE, 0xFF, 0xFF, 0xFF, 0x0F, 0x3F, + 0x01, 0x49, 0x06, 0x3F, 0x01, 0x53, 0x01, 0x61, 0x3F, 0x01, 0x49, + 0x04, 0x3F, 0x01, 0x53, 0x0A, 0x34, 0x32, 0x39, 0x34, 0x39, 0x36, + 0x37, 0x32, 0x39, 0x35, 0x3F, 0x01, 0x49, 0x02, 0x7B, 0x04}, [this](Local<Value> value) { EXPECT_TRUE(EvaluateScriptForResultBool( "Object.getOwnPropertyNames(result).toString() === " @@ -689,8 +683,8 @@ TEST_F(ValueSerializerTest, DecodeDictionaryObject) { // before its properties are deserialized, so that references to it can be // resolved. DecodeTest( - {0xff, 0x09, 0x3f, 0x00, 0x6f, 0x3f, 0x01, 0x53, 0x04, 0x73, - 0x65, 0x6c, 0x66, 0x3f, 0x01, 0x5e, 0x00, 0x7b, 0x01, 0x00}, + {0xFF, 0x09, 0x3F, 0x00, 0x6F, 0x3F, 0x01, 0x53, 0x04, 0x73, + 0x65, 0x6C, 0x66, 0x3F, 0x01, 0x5E, 0x00, 0x7B, 0x01, 0x00}, [this](Local<Value> value) { ASSERT_TRUE(value->IsObject()); EXPECT_TRUE(EvaluateScriptForResultBool("result === result.self")); @@ -702,7 +696,7 @@ TEST_F(ValueSerializerTest, InvalidDecodeObjectWithInvalidKeyType) { // object keys. The serializer would have obtained them from the own property // keys list, which should only contain names and indices. InvalidDecodeTest( - {0xff, 0x09, 0x6f, 0x61, 0x00, 0x40, 0x00, 0x00, 0x7b, 0x01}); + {0xFF, 0x09, 0x6F, 0x61, 0x00, 0x40, 0x00, 0x00, 0x7B, 0x01}); } TEST_F(ValueSerializerTest, RoundTripOnlyOwnEnumerableStringKeys) { @@ -820,8 +814,7 @@ TEST_F(ValueSerializerTest, RoundTripDictionaryObjectForTransitions) { TEST_F(ValueSerializerTest, DecodeDictionaryObjectVersion0) { // Empty object. DecodeTestForVersion0( - {0x7b, 0x00}, - [this](Local<Value> value) { + {0x7B, 0x00}, [this](Local<Value> value) { ASSERT_TRUE(value->IsObject()); EXPECT_TRUE(EvaluateScriptForResultBool( "Object.getPrototypeOf(result) === Object.prototype")); @@ -830,7 +823,7 @@ TEST_F(ValueSerializerTest, DecodeDictionaryObjectVersion0) { }); // String key. DecodeTestForVersion0( - {0x53, 0x01, 0x61, 0x49, 0x54, 0x7b, 0x01, 0x00}, + {0x53, 0x01, 0x61, 0x49, 0x54, 0x7B, 0x01, 0x00}, [this](Local<Value> value) { ASSERT_TRUE(value->IsObject()); EXPECT_TRUE(EvaluateScriptForResultBool( @@ -842,7 +835,7 @@ TEST_F(ValueSerializerTest, DecodeDictionaryObjectVersion0) { }); // Integer key (treated as a string, but may be encoded differently). DecodeTestForVersion0( - {0x49, 0x54, 0x53, 0x01, 0x61, 0x7b, 0x01, 0x00}, + {0x49, 0x54, 0x53, 0x01, 0x61, 0x7B, 0x01, 0x00}, [this](Local<Value> value) { ASSERT_TRUE(value->IsObject()); EXPECT_TRUE(EvaluateScriptForResultBool("result.hasOwnProperty('42')")); @@ -853,14 +846,14 @@ TEST_F(ValueSerializerTest, DecodeDictionaryObjectVersion0) { // Key order must be preserved. DecodeTestForVersion0( {0x53, 0x01, 0x78, 0x49, 0x02, 0x53, 0x01, 0x79, 0x49, 0x04, 0x53, 0x01, - 0x61, 0x49, 0x06, 0x7b, 0x03, 0x00}, + 0x61, 0x49, 0x06, 0x7B, 0x03, 0x00}, [this](Local<Value> value) { EXPECT_TRUE(EvaluateScriptForResultBool( "Object.getOwnPropertyNames(result).toString() === 'x,y,a'")); }); // A property and an element. DecodeTestForVersion0( - {0x49, 0x54, 0x53, 0x01, 0x61, 0x53, 0x01, 0x61, 0x49, 0x54, 0x7b, 0x02}, + {0x49, 0x54, 0x53, 0x01, 0x61, 0x53, 0x01, 0x61, 0x49, 0x54, 0x7B, 0x02}, [this](Local<Value> value) { EXPECT_TRUE(EvaluateScriptForResultBool( "Object.getOwnPropertyNames(result).toString() === '42,a'")); @@ -954,9 +947,9 @@ TEST_F(ValueSerializerTest, RoundTripArray) { TEST_F(ValueSerializerTest, DecodeArray) { // A simple array of integers. - DecodeTest({0xff, 0x09, 0x3f, 0x00, 0x41, 0x05, 0x3f, 0x01, 0x49, 0x02, - 0x3f, 0x01, 0x49, 0x04, 0x3f, 0x01, 0x49, 0x06, 0x3f, 0x01, - 0x49, 0x08, 0x3f, 0x01, 0x49, 0x0a, 0x24, 0x00, 0x05, 0x00}, + DecodeTest({0xFF, 0x09, 0x3F, 0x00, 0x41, 0x05, 0x3F, 0x01, 0x49, 0x02, + 0x3F, 0x01, 0x49, 0x04, 0x3F, 0x01, 0x49, 0x06, 0x3F, 0x01, + 0x49, 0x08, 0x3F, 0x01, 0x49, 0x0A, 0x24, 0x00, 0x05, 0x00}, [this](Local<Value> value) { ASSERT_TRUE(value->IsArray()); EXPECT_EQ(5u, Array::Cast(*value)->Length()); @@ -966,8 +959,8 @@ TEST_F(ValueSerializerTest, DecodeArray) { "result.toString() === '1,2,3,4,5'")); }); // A long (sparse) array. - DecodeTest({0xff, 0x09, 0x3f, 0x00, 0x61, 0xe8, 0x07, 0x3f, 0x01, 0x49, - 0xe8, 0x07, 0x3f, 0x01, 0x49, 0x54, 0x40, 0x01, 0xe8, 0x07}, + DecodeTest({0xFF, 0x09, 0x3F, 0x00, 0x61, 0xE8, 0x07, 0x3F, 0x01, 0x49, + 0xE8, 0x07, 0x3F, 0x01, 0x49, 0x54, 0x40, 0x01, 0xE8, 0x07}, [this](Local<Value> value) { ASSERT_TRUE(value->IsArray()); EXPECT_EQ(1000u, Array::Cast(*value)->Length()); @@ -975,8 +968,8 @@ TEST_F(ValueSerializerTest, DecodeArray) { }); // Duplicate reference. DecodeTest( - {0xff, 0x09, 0x3f, 0x00, 0x41, 0x02, 0x3f, 0x01, 0x6f, 0x7b, 0x00, 0x3f, - 0x02, 0x5e, 0x01, 0x24, 0x00, 0x02}, + {0xFF, 0x09, 0x3F, 0x00, 0x41, 0x02, 0x3F, 0x01, 0x6F, 0x7B, 0x00, 0x3F, + 0x02, 0x5E, 0x01, 0x24, 0x00, 0x02}, [this](Local<Value> value) { ASSERT_TRUE(value->IsArray()); ASSERT_EQ(2u, Array::Cast(*value)->Length()); @@ -984,9 +977,9 @@ TEST_F(ValueSerializerTest, DecodeArray) { }); // Duplicate reference in a sparse array. DecodeTest( - {0xff, 0x09, 0x3f, 0x00, 0x61, 0xe8, 0x07, 0x3f, 0x01, 0x49, - 0x02, 0x3f, 0x01, 0x6f, 0x7b, 0x00, 0x3f, 0x02, 0x49, 0xe8, - 0x07, 0x3f, 0x02, 0x5e, 0x01, 0x40, 0x02, 0xe8, 0x07, 0x00}, + {0xFF, 0x09, 0x3F, 0x00, 0x61, 0xE8, 0x07, 0x3F, 0x01, 0x49, + 0x02, 0x3F, 0x01, 0x6F, 0x7B, 0x00, 0x3F, 0x02, 0x49, 0xE8, + 0x07, 0x3F, 0x02, 0x5E, 0x01, 0x40, 0x02, 0xE8, 0x07, 0x00}, [this](Local<Value> value) { ASSERT_TRUE(value->IsArray()); ASSERT_EQ(1000u, Array::Cast(*value)->Length()); @@ -995,7 +988,7 @@ TEST_F(ValueSerializerTest, DecodeArray) { EXPECT_TRUE(EvaluateScriptForResultBool("result[1] === result[500]")); }); // Self reference. - DecodeTest({0xff, 0x09, 0x3f, 0x00, 0x41, 0x01, 0x3f, 0x01, 0x5e, 0x00, 0x24, + DecodeTest({0xFF, 0x09, 0x3F, 0x00, 0x41, 0x01, 0x3F, 0x01, 0x5E, 0x00, 0x24, 0x00, 0x01, 0x00}, [this](Local<Value> value) { ASSERT_TRUE(value->IsArray()); @@ -1004,8 +997,8 @@ TEST_F(ValueSerializerTest, DecodeArray) { }); // Self reference in a sparse array. DecodeTest( - {0xff, 0x09, 0x3f, 0x00, 0x61, 0xe8, 0x07, 0x3f, 0x01, 0x49, - 0x8e, 0x08, 0x3f, 0x01, 0x5e, 0x00, 0x40, 0x01, 0xe8, 0x07}, + {0xFF, 0x09, 0x3F, 0x00, 0x61, 0xE8, 0x07, 0x3F, 0x01, 0x49, + 0x8E, 0x08, 0x3F, 0x01, 0x5E, 0x00, 0x40, 0x01, 0xE8, 0x07}, [this](Local<Value> value) { ASSERT_TRUE(value->IsArray()); ASSERT_EQ(1000u, Array::Cast(*value)->Length()); @@ -1013,8 +1006,8 @@ TEST_F(ValueSerializerTest, DecodeArray) { }); // Array with additional properties. DecodeTest( - {0xff, 0x09, 0x3f, 0x00, 0x41, 0x02, 0x3f, 0x01, 0x49, 0x02, 0x3f, - 0x01, 0x49, 0x04, 0x3f, 0x01, 0x53, 0x03, 0x66, 0x6f, 0x6f, 0x3f, + {0xFF, 0x09, 0x3F, 0x00, 0x41, 0x02, 0x3F, 0x01, 0x49, 0x02, 0x3F, + 0x01, 0x49, 0x04, 0x3F, 0x01, 0x53, 0x03, 0x66, 0x6F, 0x6F, 0x3F, 0x01, 0x53, 0x03, 0x62, 0x61, 0x72, 0x24, 0x01, 0x02, 0x00}, [this](Local<Value> value) { ASSERT_TRUE(value->IsArray()); @@ -1023,9 +1016,9 @@ TEST_F(ValueSerializerTest, DecodeArray) { EXPECT_TRUE(EvaluateScriptForResultBool("result.foo === 'bar'")); }); // Sparse array with additional properties. - DecodeTest({0xff, 0x09, 0x3f, 0x00, 0x61, 0xe8, 0x07, 0x3f, 0x01, - 0x53, 0x03, 0x66, 0x6f, 0x6f, 0x3f, 0x01, 0x53, 0x03, - 0x62, 0x61, 0x72, 0x40, 0x01, 0xe8, 0x07, 0x00}, + DecodeTest({0xFF, 0x09, 0x3F, 0x00, 0x61, 0xE8, 0x07, 0x3F, 0x01, + 0x53, 0x03, 0x66, 0x6F, 0x6F, 0x3F, 0x01, 0x53, 0x03, + 0x62, 0x61, 0x72, 0x40, 0x01, 0xE8, 0x07, 0x00}, [this](Local<Value> value) { ASSERT_TRUE(value->IsArray()); ASSERT_EQ(1000u, Array::Cast(*value)->Length()); @@ -1037,7 +1030,7 @@ TEST_F(ValueSerializerTest, DecodeArray) { // Note that since the previous output from Chrome fails this test, an // encoding using the sparse format was constructed instead. DecodeTest( - {0xff, 0x09, 0x61, 0x02, 0x49, 0x02, 0x5f, 0x40, 0x01, 0x02}, + {0xFF, 0x09, 0x61, 0x02, 0x49, 0x02, 0x5F, 0x40, 0x01, 0x02}, [this](Local<Value> value) { ASSERT_TRUE(value->IsArray()); ASSERT_EQ(2u, Array::Cast(*value)->Length()); @@ -1053,9 +1046,9 @@ TEST_F(ValueSerializerTest, DecodeArray) { TEST_F(ValueSerializerTest, DecodeInvalidOverLargeArray) { // So large it couldn't exist in the V8 heap, and its size couldn't fit in a // SMI on 32-bit systems (2^30). - InvalidDecodeTest({0xff, 0x09, 0x41, 0x80, 0x80, 0x80, 0x80, 0x04}); + InvalidDecodeTest({0xFF, 0x09, 0x41, 0x80, 0x80, 0x80, 0x80, 0x04}); // Not so large, but there isn't enough data left in the buffer. - InvalidDecodeTest({0xff, 0x09, 0x41, 0x01}); + InvalidDecodeTest({0xFF, 0x09, 0x41, 0x01}); } TEST_F(ValueSerializerTest, RoundTripArrayWithNonEnumerableElement) { @@ -1245,7 +1238,7 @@ TEST_F(ValueSerializerTest, DecodeSparseArrayVersion0) { DecodeTestForVersion0( {0x55, 0x00, 0x53, 0x01, 'a', 0x55, 0x02, 0x55, 0x05, 0x53, 0x03, 'f', 'o', 'o', 0x53, 0x03, 'b', 'a', 'r', 0x53, - 0x03, 'b', 'a', 'z', 0x49, 0x0b, 0x40, 0x04, 0x03, 0x00}, + 0x03, 'b', 'a', 'z', 0x49, 0x0B, 0x40, 0x04, 0x03, 0x00}, [this](Local<Value> value) { ASSERT_TRUE(value->IsArray()); EXPECT_EQ(3u, Array::Cast(*value)->Length()); @@ -1282,17 +1275,17 @@ TEST_F(ValueSerializerTest, RoundTripDenseArrayContainingUndefined) { TEST_F(ValueSerializerTest, DecodeDenseArrayContainingUndefined) { // In previous versions, "undefined" in a dense array signified absence of the // element (for compatibility). In new versions, it has a separate encoding. - DecodeTest({0xff, 0x09, 0x41, 0x01, 0x5f, 0x24, 0x00, 0x01}, + DecodeTest({0xFF, 0x09, 0x41, 0x01, 0x5F, 0x24, 0x00, 0x01}, [this](Local<Value> value) { EXPECT_TRUE(EvaluateScriptForResultBool("!(0 in result)")); }); DecodeTest( - {0xff, 0x0b, 0x41, 0x01, 0x5f, 0x24, 0x00, 0x01}, + {0xFF, 0x0B, 0x41, 0x01, 0x5F, 0x24, 0x00, 0x01}, [this](Local<Value> value) { EXPECT_TRUE(EvaluateScriptForResultBool("0 in result")); EXPECT_TRUE(EvaluateScriptForResultBool("result[0] === undefined")); }); - DecodeTest({0xff, 0x0b, 0x41, 0x01, 0x2d, 0x24, 0x00, 0x01}, + DecodeTest({0xFF, 0x0B, 0x41, 0x01, 0x2D, 0x24, 0x00, 0x01}, [this](Local<Value> value) { EXPECT_TRUE(EvaluateScriptForResultBool("!(0 in result)")); }); @@ -1324,29 +1317,29 @@ TEST_F(ValueSerializerTest, RoundTripDate) { TEST_F(ValueSerializerTest, DecodeDate) { #if defined(V8_TARGET_LITTLE_ENDIAN) - DecodeTest({0xff, 0x09, 0x3f, 0x00, 0x44, 0x00, 0x00, 0x00, 0x00, 0x80, 0x84, - 0x2e, 0x41, 0x00}, + DecodeTest({0xFF, 0x09, 0x3F, 0x00, 0x44, 0x00, 0x00, 0x00, 0x00, 0x80, 0x84, + 0x2E, 0x41, 0x00}, [this](Local<Value> value) { ASSERT_TRUE(value->IsDate()); EXPECT_EQ(1e6, Date::Cast(*value)->ValueOf()); EXPECT_TRUE(EvaluateScriptForResultBool( "Object.getPrototypeOf(result) === Date.prototype")); }); - DecodeTest({0xff, 0x09, 0x3f, 0x00, 0x44, 0x00, 0x00, 0x20, 0x45, 0x27, 0x89, - 0x87, 0xc2, 0x00}, + DecodeTest({0xFF, 0x09, 0x3F, 0x00, 0x44, 0x00, 0x00, 0x20, 0x45, 0x27, 0x89, + 0x87, 0xC2, 0x00}, [this](Local<Value> value) { ASSERT_TRUE(value->IsDate()); EXPECT_TRUE(EvaluateScriptForResultBool( "result.toISOString() === '1867-07-01T00:00:00.000Z'")); }); - DecodeTest({0xff, 0x09, 0x3f, 0x00, 0x44, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0xf8, 0x7f, 0x00}, + DecodeTest({0xFF, 0x09, 0x3F, 0x00, 0x44, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0xF8, 0x7F, 0x00}, [](Local<Value> value) { ASSERT_TRUE(value->IsDate()); EXPECT_TRUE(std::isnan(Date::Cast(*value)->ValueOf())); }); #else - DecodeTest({0xff, 0x09, 0x3f, 0x00, 0x44, 0x41, 0x2e, 0x84, 0x80, 0x00, 0x00, + DecodeTest({0xFF, 0x09, 0x3F, 0x00, 0x44, 0x41, 0x2E, 0x84, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00}, [this](Local<Value> value) { ASSERT_TRUE(value->IsDate()); @@ -1354,14 +1347,14 @@ TEST_F(ValueSerializerTest, DecodeDate) { EXPECT_TRUE(EvaluateScriptForResultBool( "Object.getPrototypeOf(result) === Date.prototype")); }); - DecodeTest({0xff, 0x09, 0x3f, 0x00, 0x44, 0xc2, 0x87, 0x89, 0x27, 0x45, 0x20, + DecodeTest({0xFF, 0x09, 0x3F, 0x00, 0x44, 0xC2, 0x87, 0x89, 0x27, 0x45, 0x20, 0x00, 0x00, 0x00}, [this](Local<Value> value) { ASSERT_TRUE(value->IsDate()); EXPECT_TRUE(EvaluateScriptForResultBool( "result.toISOString() === '1867-07-01T00:00:00.000Z'")); }); - DecodeTest({0xff, 0x09, 0x3f, 0x00, 0x44, 0x7f, 0xf8, 0x00, 0x00, 0x00, 0x00, + DecodeTest({0xFF, 0x09, 0x3F, 0x00, 0x44, 0x7F, 0xF8, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, [](Local<Value> value) { ASSERT_TRUE(value->IsDate()); @@ -1369,9 +1362,9 @@ TEST_F(ValueSerializerTest, DecodeDate) { }); #endif DecodeTest( - {0xff, 0x09, 0x3f, 0x00, 0x6f, 0x3f, 0x01, 0x53, 0x01, 0x61, 0x3f, - 0x01, 0x44, 0x00, 0x20, 0x39, 0x50, 0x37, 0x6a, 0x75, 0x42, 0x3f, - 0x02, 0x53, 0x01, 0x62, 0x3f, 0x02, 0x5e, 0x01, 0x7b, 0x02}, + {0xFF, 0x09, 0x3F, 0x00, 0x6F, 0x3F, 0x01, 0x53, 0x01, 0x61, 0x3F, + 0x01, 0x44, 0x00, 0x20, 0x39, 0x50, 0x37, 0x6A, 0x75, 0x42, 0x3F, + 0x02, 0x53, 0x01, 0x62, 0x3F, 0x02, 0x5E, 0x01, 0x7B, 0x02}, [this](Local<Value> value) { EXPECT_TRUE(EvaluateScriptForResultBool("result.a instanceof Date")); EXPECT_TRUE(EvaluateScriptForResultBool("result.a === result.b")); @@ -1440,37 +1433,35 @@ TEST_F(ValueSerializerTest, RejectsOtherValueObjects) { TEST_F(ValueSerializerTest, DecodeValueObjects) { DecodeTest( - {0xff, 0x09, 0x3f, 0x00, 0x79, 0x00}, - [this](Local<Value> value) { + {0xFF, 0x09, 0x3F, 0x00, 0x79, 0x00}, [this](Local<Value> value) { EXPECT_TRUE(EvaluateScriptForResultBool( "Object.getPrototypeOf(result) === Boolean.prototype")); EXPECT_TRUE(EvaluateScriptForResultBool("result.valueOf() === true")); }); DecodeTest( - {0xff, 0x09, 0x3f, 0x00, 0x78, 0x00}, - [this](Local<Value> value) { + {0xFF, 0x09, 0x3F, 0x00, 0x78, 0x00}, [this](Local<Value> value) { EXPECT_TRUE(EvaluateScriptForResultBool( "Object.getPrototypeOf(result) === Boolean.prototype")); EXPECT_TRUE(EvaluateScriptForResultBool("result.valueOf() === false")); }); DecodeTest( - {0xff, 0x09, 0x3f, 0x00, 0x6f, 0x3f, 0x01, 0x53, 0x01, 0x61, 0x3f, 0x01, - 0x79, 0x3f, 0x02, 0x53, 0x01, 0x62, 0x3f, 0x02, 0x5e, 0x01, 0x7b, 0x02}, + {0xFF, 0x09, 0x3F, 0x00, 0x6F, 0x3F, 0x01, 0x53, 0x01, 0x61, 0x3F, 0x01, + 0x79, 0x3F, 0x02, 0x53, 0x01, 0x62, 0x3F, 0x02, 0x5E, 0x01, 0x7B, 0x02}, [this](Local<Value> value) { EXPECT_TRUE(EvaluateScriptForResultBool("result.a instanceof Boolean")); EXPECT_TRUE(EvaluateScriptForResultBool("result.a === result.b")); }); #if defined(V8_TARGET_LITTLE_ENDIAN) DecodeTest( - {0xff, 0x09, 0x3f, 0x00, 0x6e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x45, - 0xc0, 0x00}, + {0xFF, 0x09, 0x3F, 0x00, 0x6E, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x45, + 0xC0, 0x00}, [this](Local<Value> value) { EXPECT_TRUE(EvaluateScriptForResultBool( "Object.getPrototypeOf(result) === Number.prototype")); EXPECT_TRUE(EvaluateScriptForResultBool("result.valueOf() === -42")); }); - DecodeTest({0xff, 0x09, 0x3f, 0x00, 0x6e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0xf8, 0x7f, 0x00}, + DecodeTest({0xFF, 0x09, 0x3F, 0x00, 0x6E, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0xF8, 0x7F, 0x00}, [this](Local<Value> value) { EXPECT_TRUE(EvaluateScriptForResultBool( "Object.getPrototypeOf(result) === Number.prototype")); @@ -1479,14 +1470,14 @@ TEST_F(ValueSerializerTest, DecodeValueObjects) { }); #else DecodeTest( - {0xff, 0x09, 0x3f, 0x00, 0x6e, 0xc0, 0x45, 0x00, 0x00, 0x00, 0x00, 0x00, + {0xFF, 0x09, 0x3F, 0x00, 0x6E, 0xC0, 0x45, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, [this](Local<Value> value) { EXPECT_TRUE(EvaluateScriptForResultBool( "Object.getPrototypeOf(result) === Number.prototype")); EXPECT_TRUE(EvaluateScriptForResultBool("result.valueOf() === -42")); }); - DecodeTest({0xff, 0x09, 0x3f, 0x00, 0x6e, 0x7f, 0xf8, 0x00, 0x00, 0x00, 0x00, + DecodeTest({0xFF, 0x09, 0x3F, 0x00, 0x6E, 0x7F, 0xF8, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, [this](Local<Value> value) { EXPECT_TRUE(EvaluateScriptForResultBool( @@ -1496,14 +1487,14 @@ TEST_F(ValueSerializerTest, DecodeValueObjects) { }); #endif DecodeTest( - {0xff, 0x09, 0x3f, 0x00, 0x6f, 0x3f, 0x01, 0x53, 0x01, 0x61, 0x3f, - 0x01, 0x6e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x40, 0x3f, - 0x02, 0x53, 0x01, 0x62, 0x3f, 0x02, 0x5e, 0x01, 0x7b, 0x02}, + {0xFF, 0x09, 0x3F, 0x00, 0x6F, 0x3F, 0x01, 0x53, 0x01, 0x61, 0x3F, + 0x01, 0x6E, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x40, 0x3F, + 0x02, 0x53, 0x01, 0x62, 0x3F, 0x02, 0x5E, 0x01, 0x7B, 0x02}, [this](Local<Value> value) { EXPECT_TRUE(EvaluateScriptForResultBool("result.a instanceof Number")); EXPECT_TRUE(EvaluateScriptForResultBool("result.a === result.b")); }); - DecodeTest({0xff, 0x09, 0x3f, 0x00, 0x73, 0x07, 0x51, 0x75, 0xc3, 0xa9, 0x62, + DecodeTest({0xFF, 0x09, 0x3F, 0x00, 0x73, 0x07, 0x51, 0x75, 0xC3, 0xA9, 0x62, 0x65, 0x63, 0x00}, [this](Local<Value> value) { EXPECT_TRUE(EvaluateScriptForResultBool( @@ -1512,7 +1503,7 @@ TEST_F(ValueSerializerTest, DecodeValueObjects) { "result.valueOf() === 'Qu\\xe9bec'")); EXPECT_TRUE(EvaluateScriptForResultBool("result.length === 6")); }); - DecodeTest({0xff, 0x09, 0x3f, 0x00, 0x73, 0x04, 0xf0, 0x9f, 0x91, 0x8a}, + DecodeTest({0xFF, 0x09, 0x3F, 0x00, 0x73, 0x04, 0xF0, 0x9F, 0x91, 0x8A}, [this](Local<Value> value) { EXPECT_TRUE(EvaluateScriptForResultBool( "Object.getPrototypeOf(result) === String.prototype")); @@ -1521,16 +1512,16 @@ TEST_F(ValueSerializerTest, DecodeValueObjects) { EXPECT_TRUE(EvaluateScriptForResultBool("result.length === 2")); }); DecodeTest( - {0xff, 0x09, 0x3f, 0x00, 0x6f, 0x3f, 0x01, 0x53, 0x01, - 0x61, 0x3f, 0x01, 0x73, 0x00, 0x3f, 0x02, 0x53, 0x01, - 0x62, 0x3f, 0x02, 0x5e, 0x01, 0x7b, 0x02, 0x00}, + {0xFF, 0x09, 0x3F, 0x00, 0x6F, 0x3F, 0x01, 0x53, 0x01, + 0x61, 0x3F, 0x01, 0x73, 0x00, 0x3F, 0x02, 0x53, 0x01, + 0x62, 0x3F, 0x02, 0x5E, 0x01, 0x7B, 0x02, 0x00}, [this](Local<Value> value) { EXPECT_TRUE(EvaluateScriptForResultBool("result.a instanceof String")); EXPECT_TRUE(EvaluateScriptForResultBool("result.a === result.b")); }); // String object containing a Latin-1 string. - DecodeTest({0xff, 0x0c, 0x73, 0x22, 0x06, 'Q', 'u', 0xe9, 'b', 'e', 'c'}, + DecodeTest({0xFF, 0x0C, 0x73, 0x22, 0x06, 'Q', 'u', 0xE9, 'b', 'e', 'c'}, [this](Local<Value> value) { EXPECT_TRUE(EvaluateScriptForResultBool( "Object.getPrototypeOf(result) === String.prototype")); @@ -1567,7 +1558,7 @@ TEST_F(ValueSerializerTest, RoundTripRegExp) { } TEST_F(ValueSerializerTest, DecodeRegExp) { - DecodeTest({0xff, 0x09, 0x3f, 0x00, 0x52, 0x03, 0x66, 0x6f, 0x6f, 0x01}, + DecodeTest({0xFF, 0x09, 0x3F, 0x00, 0x52, 0x03, 0x66, 0x6F, 0x6F, 0x01}, [this](Local<Value> value) { ASSERT_TRUE(value->IsRegExp()); EXPECT_TRUE(EvaluateScriptForResultBool( @@ -1575,7 +1566,7 @@ TEST_F(ValueSerializerTest, DecodeRegExp) { EXPECT_TRUE(EvaluateScriptForResultBool( "result.toString() === '/foo/g'")); }); - DecodeTest({0xff, 0x09, 0x3f, 0x00, 0x52, 0x07, 0x51, 0x75, 0xc3, 0xa9, 0x62, + DecodeTest({0xFF, 0x09, 0x3F, 0x00, 0x52, 0x07, 0x51, 0x75, 0xC3, 0xA9, 0x62, 0x65, 0x63, 0x02}, [this](Local<Value> value) { ASSERT_TRUE(value->IsRegExp()); @@ -1583,16 +1574,16 @@ TEST_F(ValueSerializerTest, DecodeRegExp) { "result.toString() === '/Qu\\xe9bec/i'")); }); DecodeTest( - {0xff, 0x09, 0x3f, 0x00, 0x52, 0x04, 0xf0, 0x9f, 0x91, 0x8a, 0x11, 0x00}, + {0xFF, 0x09, 0x3F, 0x00, 0x52, 0x04, 0xF0, 0x9F, 0x91, 0x8A, 0x11, 0x00}, [this](Local<Value> value) { ASSERT_TRUE(value->IsRegExp()); EXPECT_TRUE(EvaluateScriptForResultBool( "result.toString() === '/\\ud83d\\udc4a/gu'")); }); DecodeTest( - {0xff, 0x09, 0x3f, 0x00, 0x6f, 0x3f, 0x01, 0x53, 0x01, 0x61, - 0x3f, 0x01, 0x52, 0x03, 0x66, 0x6f, 0x6f, 0x03, 0x3f, 0x02, - 0x53, 0x01, 0x62, 0x3f, 0x02, 0x5e, 0x01, 0x7b, 0x02, 0x00}, + {0xFF, 0x09, 0x3F, 0x00, 0x6F, 0x3F, 0x01, 0x53, 0x01, 0x61, + 0x3F, 0x01, 0x52, 0x03, 0x66, 0x6F, 0x6F, 0x03, 0x3F, 0x02, + 0x53, 0x01, 0x62, 0x3F, 0x02, 0x5E, 0x01, 0x7B, 0x02, 0x00}, [this](Local<Value> value) { EXPECT_TRUE(EvaluateScriptForResultBool("result.a instanceof RegExp")); EXPECT_TRUE(EvaluateScriptForResultBool("result.a === result.b")); @@ -1600,7 +1591,7 @@ TEST_F(ValueSerializerTest, DecodeRegExp) { // RegExp containing a Latin-1 string. DecodeTest( - {0xff, 0x0c, 0x52, 0x22, 0x06, 'Q', 'u', 0xe9, 'b', 'e', 'c', 0x02}, + {0xFF, 0x0C, 0x52, 0x22, 0x06, 'Q', 'u', 0xE9, 'b', 'e', 'c', 0x02}, [this](Local<Value> value) { ASSERT_TRUE(value->IsRegExp()); EXPECT_TRUE(EvaluateScriptForResultBool( @@ -1610,7 +1601,7 @@ TEST_F(ValueSerializerTest, DecodeRegExp) { // Tests that invalid flags are not accepted by the deserializer. TEST_F(ValueSerializerTest, DecodeRegExpDotAll) { - DecodeTest({0xff, 0x09, 0x3f, 0x00, 0x52, 0x03, 0x66, 0x6f, 0x6f, 0x1f}, + DecodeTest({0xFF, 0x09, 0x3F, 0x00, 0x52, 0x03, 0x66, 0x6F, 0x6F, 0x1F}, [this](Local<Value> value) { ASSERT_TRUE(value->IsRegExp()); EXPECT_TRUE(EvaluateScriptForResultBool( @@ -1618,7 +1609,7 @@ TEST_F(ValueSerializerTest, DecodeRegExpDotAll) { EXPECT_TRUE(EvaluateScriptForResultBool( "result.toString() === '/foo/gimuy'")); }); - DecodeTest({0xff, 0x09, 0x3f, 0x00, 0x52, 0x03, 0x66, 0x6f, 0x6f, 0x3f}, + DecodeTest({0xFF, 0x09, 0x3F, 0x00, 0x52, 0x03, 0x66, 0x6F, 0x6F, 0x3F}, [this](Local<Value> value) { ASSERT_TRUE(value->IsRegExp()); EXPECT_TRUE(EvaluateScriptForResultBool( @@ -1627,7 +1618,7 @@ TEST_F(ValueSerializerTest, DecodeRegExpDotAll) { "result.toString() === '/foo/gimsuy'")); }); InvalidDecodeTest( - {0xff, 0x09, 0x3f, 0x00, 0x52, 0x03, 0x66, 0x6f, 0x6f, 0x7f}); + {0xFF, 0x09, 0x3F, 0x00, 0x52, 0x03, 0x66, 0x6F, 0x6F, 0x7F}); } TEST_F(ValueSerializerTest, RoundTripMap) { @@ -1663,8 +1654,8 @@ TEST_F(ValueSerializerTest, RoundTripMap) { TEST_F(ValueSerializerTest, DecodeMap) { DecodeTest( - {0xff, 0x09, 0x3f, 0x00, 0x3b, 0x3f, 0x01, 0x49, 0x54, 0x3f, 0x01, 0x53, - 0x03, 0x66, 0x6f, 0x6f, 0x3a, 0x02}, + {0xFF, 0x09, 0x3F, 0x00, 0x3B, 0x3F, 0x01, 0x49, 0x54, 0x3F, 0x01, 0x53, + 0x03, 0x66, 0x6F, 0x6F, 0x3A, 0x02}, [this](Local<Value> value) { ASSERT_TRUE(value->IsMap()); EXPECT_TRUE(EvaluateScriptForResultBool( @@ -1672,8 +1663,8 @@ TEST_F(ValueSerializerTest, DecodeMap) { EXPECT_TRUE(EvaluateScriptForResultBool("result.size === 1")); EXPECT_TRUE(EvaluateScriptForResultBool("result.get(42) === 'foo'")); }); - DecodeTest({0xff, 0x09, 0x3f, 0x00, 0x3b, 0x3f, 0x01, 0x5e, 0x00, 0x3f, 0x01, - 0x5e, 0x00, 0x3a, 0x02, 0x00}, + DecodeTest({0xFF, 0x09, 0x3F, 0x00, 0x3B, 0x3F, 0x01, 0x5E, 0x00, 0x3F, 0x01, + 0x5E, 0x00, 0x3A, 0x02, 0x00}, [this](Local<Value> value) { ASSERT_TRUE(value->IsMap()); EXPECT_TRUE(EvaluateScriptForResultBool("result.size === 1")); @@ -1681,10 +1672,10 @@ TEST_F(ValueSerializerTest, DecodeMap) { "result.get(result) === result")); }); // Iteration order must be preserved. - DecodeTest({0xff, 0x09, 0x3f, 0x00, 0x3b, 0x3f, 0x01, 0x49, 0x02, 0x3f, - 0x01, 0x49, 0x00, 0x3f, 0x01, 0x53, 0x01, 0x61, 0x3f, 0x01, - 0x49, 0x00, 0x3f, 0x01, 0x49, 0x06, 0x3f, 0x01, 0x49, 0x00, - 0x3f, 0x01, 0x49, 0x04, 0x3f, 0x01, 0x49, 0x00, 0x3a, 0x08}, + DecodeTest({0xFF, 0x09, 0x3F, 0x00, 0x3B, 0x3F, 0x01, 0x49, 0x02, 0x3F, + 0x01, 0x49, 0x00, 0x3F, 0x01, 0x53, 0x01, 0x61, 0x3F, 0x01, + 0x49, 0x00, 0x3F, 0x01, 0x49, 0x06, 0x3F, 0x01, 0x49, 0x00, + 0x3F, 0x01, 0x49, 0x04, 0x3F, 0x01, 0x49, 0x00, 0x3A, 0x08}, [this](Local<Value> value) { ASSERT_TRUE(value->IsMap()); EXPECT_TRUE(EvaluateScriptForResultBool( @@ -1763,8 +1754,8 @@ TEST_F(ValueSerializerTest, RoundTripSet) { } TEST_F(ValueSerializerTest, DecodeSet) { - DecodeTest({0xff, 0x09, 0x3f, 0x00, 0x27, 0x3f, 0x01, 0x49, 0x54, 0x3f, 0x01, - 0x53, 0x03, 0x66, 0x6f, 0x6f, 0x2c, 0x02}, + DecodeTest({0xFF, 0x09, 0x3F, 0x00, 0x27, 0x3F, 0x01, 0x49, 0x54, 0x3F, 0x01, + 0x53, 0x03, 0x66, 0x6F, 0x6F, 0x2C, 0x02}, [this](Local<Value> value) { ASSERT_TRUE(value->IsSet()); EXPECT_TRUE(EvaluateScriptForResultBool( @@ -1774,7 +1765,7 @@ TEST_F(ValueSerializerTest, DecodeSet) { EXPECT_TRUE(EvaluateScriptForResultBool("result.has('foo')")); }); DecodeTest( - {0xff, 0x09, 0x3f, 0x00, 0x27, 0x3f, 0x01, 0x5e, 0x00, 0x2c, 0x01, 0x00}, + {0xFF, 0x09, 0x3F, 0x00, 0x27, 0x3F, 0x01, 0x5E, 0x00, 0x2C, 0x01, 0x00}, [this](Local<Value> value) { ASSERT_TRUE(value->IsSet()); EXPECT_TRUE(EvaluateScriptForResultBool("result.size === 1")); @@ -1782,8 +1773,8 @@ TEST_F(ValueSerializerTest, DecodeSet) { }); // Iteration order must be preserved. DecodeTest( - {0xff, 0x09, 0x3f, 0x00, 0x27, 0x3f, 0x01, 0x49, 0x02, 0x3f, 0x01, 0x53, - 0x01, 0x61, 0x3f, 0x01, 0x49, 0x06, 0x3f, 0x01, 0x49, 0x04, 0x2c, 0x04}, + {0xFF, 0x09, 0x3F, 0x00, 0x27, 0x3F, 0x01, 0x49, 0x02, 0x3F, 0x01, 0x53, + 0x01, 0x61, 0x3F, 0x01, 0x49, 0x06, 0x3F, 0x01, 0x49, 0x04, 0x2C, 0x04}, [this](Local<Value> value) { ASSERT_TRUE(value->IsSet()); EXPECT_TRUE(EvaluateScriptForResultBool( @@ -1849,14 +1840,14 @@ TEST_F(ValueSerializerTest, RoundTripArrayBuffer) { } TEST_F(ValueSerializerTest, DecodeArrayBuffer) { - DecodeTest({0xff, 0x09, 0x3f, 0x00, 0x42, 0x00}, + DecodeTest({0xFF, 0x09, 0x3F, 0x00, 0x42, 0x00}, [this](Local<Value> value) { ASSERT_TRUE(value->IsArrayBuffer()); EXPECT_EQ(0u, ArrayBuffer::Cast(*value)->ByteLength()); EXPECT_TRUE(EvaluateScriptForResultBool( "Object.getPrototypeOf(result) === ArrayBuffer.prototype")); }); - DecodeTest({0xff, 0x09, 0x3f, 0x00, 0x42, 0x03, 0x00, 0x80, 0xff, 0x00}, + DecodeTest({0xFF, 0x09, 0x3F, 0x00, 0x42, 0x03, 0x00, 0x80, 0xFF, 0x00}, [this](Local<Value> value) { ASSERT_TRUE(value->IsArrayBuffer()); EXPECT_EQ(3u, ArrayBuffer::Cast(*value)->ByteLength()); @@ -1864,9 +1855,9 @@ TEST_F(ValueSerializerTest, DecodeArrayBuffer) { "new Uint8Array(result).toString() === '0,128,255'")); }); DecodeTest( - {0xff, 0x09, 0x3f, 0x00, 0x6f, 0x3f, 0x01, 0x53, 0x01, - 0x61, 0x3f, 0x01, 0x42, 0x00, 0x3f, 0x02, 0x53, 0x01, - 0x62, 0x3f, 0x02, 0x5e, 0x01, 0x7b, 0x02, 0x00}, + {0xFF, 0x09, 0x3F, 0x00, 0x6F, 0x3F, 0x01, 0x53, 0x01, + 0x61, 0x3F, 0x01, 0x42, 0x00, 0x3F, 0x02, 0x53, 0x01, + 0x62, 0x3F, 0x02, 0x5E, 0x01, 0x7B, 0x02, 0x00}, [this](Local<Value> value) { EXPECT_TRUE( EvaluateScriptForResultBool("result.a instanceof ArrayBuffer")); @@ -1875,7 +1866,7 @@ TEST_F(ValueSerializerTest, DecodeArrayBuffer) { } TEST_F(ValueSerializerTest, DecodeInvalidArrayBuffer) { - InvalidDecodeTest({0xff, 0x09, 0x42, 0xff, 0xff, 0x00}); + InvalidDecodeTest({0xFF, 0x09, 0x42, 0xFF, 0xFF, 0x00}); } // An array buffer allocator that never has available memory. @@ -1904,8 +1895,8 @@ TEST_F(ValueSerializerTest, DecodeArrayBufferOOM) { Context::Scope context_scope(context); TryCatch try_catch(isolate); - const std::vector<uint8_t> data = {0xff, 0x09, 0x3f, 0x00, 0x42, - 0x03, 0x00, 0x80, 0xff, 0x00}; + const std::vector<uint8_t> data = {0xFF, 0x09, 0x3F, 0x00, 0x42, + 0x03, 0x00, 0x80, 0xFF, 0x00}; ValueDeserializer deserializer(isolate, &data[0], static_cast<int>(data.size()), nullptr); deserializer.SetSupportsLegacyWireFormat(true); @@ -1931,7 +1922,7 @@ class ValueSerializerTestWithArrayBufferTransfer : public ValueSerializerTest { { Context::Scope scope(deserialization_context()); output_buffer_ = ArrayBuffer::New(isolate(), kTestByteLength); - const uint8_t data[kTestByteLength] = {0x00, 0x01, 0x80, 0xff}; + const uint8_t data[kTestByteLength] = {0x00, 0x01, 0x80, 0xFF}; memcpy(output_buffer_->GetContents().Data(), data, kTestByteLength); } } @@ -2044,7 +2035,7 @@ TEST_F(ValueSerializerTest, RoundTripTypedArray) { TEST_F(ValueSerializerTest, DecodeTypedArray) { // Check that the right type comes out the other side for every kind of typed // array. - DecodeTest({0xff, 0x09, 0x3f, 0x00, 0x3f, 0x00, 0x42, 0x02, 0x00, 0x00, 0x56, + DecodeTest({0xFF, 0x09, 0x3F, 0x00, 0x3F, 0x00, 0x42, 0x02, 0x00, 0x00, 0x56, 0x42, 0x00, 0x02}, [this](Local<Value> value) { ASSERT_TRUE(value->IsUint8Array()); @@ -2053,7 +2044,7 @@ TEST_F(ValueSerializerTest, DecodeTypedArray) { EXPECT_TRUE(EvaluateScriptForResultBool( "Object.getPrototypeOf(result) === Uint8Array.prototype")); }); - DecodeTest({0xff, 0x09, 0x3f, 0x00, 0x3f, 0x00, 0x42, 0x02, 0x00, 0x00, 0x56, + DecodeTest({0xFF, 0x09, 0x3F, 0x00, 0x3F, 0x00, 0x42, 0x02, 0x00, 0x00, 0x56, 0x62, 0x00, 0x02}, [this](Local<Value> value) { ASSERT_TRUE(value->IsInt8Array()); @@ -2063,7 +2054,7 @@ TEST_F(ValueSerializerTest, DecodeTypedArray) { "Object.getPrototypeOf(result) === Int8Array.prototype")); }); #if defined(V8_TARGET_LITTLE_ENDIAN) - DecodeTest({0xff, 0x09, 0x3f, 0x00, 0x3f, 0x00, 0x42, 0x04, 0x00, 0x00, 0x00, + DecodeTest({0xFF, 0x09, 0x3F, 0x00, 0x3F, 0x00, 0x42, 0x04, 0x00, 0x00, 0x00, 0x00, 0x56, 0x57, 0x00, 0x04}, [this](Local<Value> value) { ASSERT_TRUE(value->IsUint16Array()); @@ -2072,7 +2063,7 @@ TEST_F(ValueSerializerTest, DecodeTypedArray) { EXPECT_TRUE(EvaluateScriptForResultBool( "Object.getPrototypeOf(result) === Uint16Array.prototype")); }); - DecodeTest({0xff, 0x09, 0x3f, 0x00, 0x3f, 0x00, 0x42, 0x04, 0x00, 0x00, 0x00, + DecodeTest({0xFF, 0x09, 0x3F, 0x00, 0x3F, 0x00, 0x42, 0x04, 0x00, 0x00, 0x00, 0x00, 0x56, 0x77, 0x00, 0x04}, [this](Local<Value> value) { ASSERT_TRUE(value->IsInt16Array()); @@ -2081,7 +2072,7 @@ TEST_F(ValueSerializerTest, DecodeTypedArray) { EXPECT_TRUE(EvaluateScriptForResultBool( "Object.getPrototypeOf(result) === Int16Array.prototype")); }); - DecodeTest({0xff, 0x09, 0x3f, 0x00, 0x3f, 0x00, 0x42, 0x08, 0x00, 0x00, + DecodeTest({0xFF, 0x09, 0x3F, 0x00, 0x3F, 0x00, 0x42, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x56, 0x44, 0x00, 0x08}, [this](Local<Value> value) { ASSERT_TRUE(value->IsUint32Array()); @@ -2090,7 +2081,7 @@ TEST_F(ValueSerializerTest, DecodeTypedArray) { EXPECT_TRUE(EvaluateScriptForResultBool( "Object.getPrototypeOf(result) === Uint32Array.prototype")); }); - DecodeTest({0xff, 0x09, 0x3f, 0x00, 0x3f, 0x00, 0x42, 0x08, 0x00, 0x00, + DecodeTest({0xFF, 0x09, 0x3F, 0x00, 0x3F, 0x00, 0x42, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x56, 0x64, 0x00, 0x08}, [this](Local<Value> value) { ASSERT_TRUE(value->IsInt32Array()); @@ -2099,7 +2090,7 @@ TEST_F(ValueSerializerTest, DecodeTypedArray) { EXPECT_TRUE(EvaluateScriptForResultBool( "Object.getPrototypeOf(result) === Int32Array.prototype")); }); - DecodeTest({0xff, 0x09, 0x3f, 0x00, 0x3f, 0x00, 0x42, 0x08, 0x00, 0x00, + DecodeTest({0xFF, 0x09, 0x3F, 0x00, 0x3F, 0x00, 0x42, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x56, 0x66, 0x00, 0x08}, [this](Local<Value> value) { ASSERT_TRUE(value->IsFloat32Array()); @@ -2108,7 +2099,7 @@ TEST_F(ValueSerializerTest, DecodeTypedArray) { EXPECT_TRUE(EvaluateScriptForResultBool( "Object.getPrototypeOf(result) === Float32Array.prototype")); }); - DecodeTest({0xff, 0x09, 0x3f, 0x00, 0x3f, 0x00, 0x42, 0x10, 0x00, 0x00, + DecodeTest({0xFF, 0x09, 0x3F, 0x00, 0x3F, 0x00, 0x42, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x56, 0x46, 0x00, 0x10}, [this](Local<Value> value) { @@ -2121,22 +2112,22 @@ TEST_F(ValueSerializerTest, DecodeTypedArray) { #endif // V8_TARGET_LITTLE_ENDIAN // Check that values of various kinds are suitably preserved. - DecodeTest({0xff, 0x09, 0x3f, 0x00, 0x3f, 0x00, 0x42, 0x03, 0x01, 0x80, 0xff, + DecodeTest({0xFF, 0x09, 0x3F, 0x00, 0x3F, 0x00, 0x42, 0x03, 0x01, 0x80, 0xFF, 0x56, 0x42, 0x00, 0x03, 0x00}, [this](Local<Value> value) { EXPECT_TRUE(EvaluateScriptForResultBool( "result.toString() === '1,128,255'")); }); #if defined(V8_TARGET_LITTLE_ENDIAN) - DecodeTest({0xff, 0x09, 0x3f, 0x00, 0x3f, 0x00, 0x42, 0x06, 0x00, 0x00, 0x00, + DecodeTest({0xFF, 0x09, 0x3F, 0x00, 0x3F, 0x00, 0x42, 0x06, 0x00, 0x00, 0x00, 0x01, 0x00, 0x80, 0x56, 0x77, 0x00, 0x06}, [this](Local<Value> value) { EXPECT_TRUE(EvaluateScriptForResultBool( "result.toString() === '0,256,-32768'")); }); - DecodeTest({0xff, 0x09, 0x3f, 0x00, 0x3f, 0x00, 0x42, 0x10, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0xbf, 0x00, 0x00, 0xc0, 0x7f, - 0x00, 0x00, 0x80, 0x7f, 0x56, 0x66, 0x00, 0x10}, + DecodeTest({0xFF, 0x09, 0x3F, 0x00, 0x3F, 0x00, 0x42, 0x10, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0xBF, 0x00, 0x00, 0xC0, 0x7F, + 0x00, 0x00, 0x80, 0x7F, 0x56, 0x66, 0x00, 0x10}, [this](Local<Value> value) { EXPECT_TRUE(EvaluateScriptForResultBool( "result.toString() === '0,-0.5,NaN,Infinity'")); @@ -2146,14 +2137,14 @@ TEST_F(ValueSerializerTest, DecodeTypedArray) { // Array buffer views sharing a buffer should do so on the other side. // Similarly, multiple references to the same typed array should be resolved. DecodeTest( - {0xff, 0x09, 0x3f, 0x00, 0x6f, 0x3f, 0x01, 0x53, 0x02, 0x75, 0x38, 0x3f, - 0x01, 0x3f, 0x01, 0x42, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + {0xFF, 0x09, 0x3F, 0x00, 0x6F, 0x3F, 0x01, 0x53, 0x02, 0x75, 0x38, 0x3F, + 0x01, 0x3F, 0x01, 0x42, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x56, 0x42, 0x00, 0x20, 0x3f, 0x03, 0x53, 0x04, 0x75, 0x38, 0x5f, - 0x32, 0x3f, 0x03, 0x5e, 0x02, 0x3f, 0x03, 0x53, 0x03, 0x66, 0x33, 0x32, - 0x3f, 0x03, 0x3f, 0x03, 0x5e, 0x01, 0x56, 0x66, 0x04, 0x14, 0x3f, 0x04, - 0x53, 0x01, 0x62, 0x3f, 0x04, 0x5e, 0x01, 0x7b, 0x04, 0x00}, + 0x00, 0x56, 0x42, 0x00, 0x20, 0x3F, 0x03, 0x53, 0x04, 0x75, 0x38, 0x5F, + 0x32, 0x3F, 0x03, 0x5E, 0x02, 0x3F, 0x03, 0x53, 0x03, 0x66, 0x33, 0x32, + 0x3F, 0x03, 0x3F, 0x03, 0x5E, 0x01, 0x56, 0x66, 0x04, 0x14, 0x3F, 0x04, + 0x53, 0x01, 0x62, 0x3F, 0x04, 0x5E, 0x01, 0x7B, 0x04, 0x00}, [this](Local<Value> value) { EXPECT_TRUE( EvaluateScriptForResultBool("result.u8 instanceof Uint8Array")); @@ -2170,19 +2161,19 @@ TEST_F(ValueSerializerTest, DecodeTypedArray) { TEST_F(ValueSerializerTest, DecodeInvalidTypedArray) { // Byte offset out of range. InvalidDecodeTest( - {0xff, 0x09, 0x42, 0x02, 0x00, 0x00, 0x56, 0x42, 0x03, 0x01}); + {0xFF, 0x09, 0x42, 0x02, 0x00, 0x00, 0x56, 0x42, 0x03, 0x01}); // Byte offset in range, offset + length out of range. InvalidDecodeTest( - {0xff, 0x09, 0x42, 0x02, 0x00, 0x00, 0x56, 0x42, 0x01, 0x03}); + {0xFF, 0x09, 0x42, 0x02, 0x00, 0x00, 0x56, 0x42, 0x01, 0x03}); // Byte offset not divisible by element size. InvalidDecodeTest( - {0xff, 0x09, 0x42, 0x04, 0x00, 0x00, 0x00, 0x00, 0x56, 0x77, 0x01, 0x02}); + {0xFF, 0x09, 0x42, 0x04, 0x00, 0x00, 0x00, 0x00, 0x56, 0x77, 0x01, 0x02}); // Byte length not divisible by element size. InvalidDecodeTest( - {0xff, 0x09, 0x42, 0x04, 0x00, 0x00, 0x00, 0x00, 0x56, 0x77, 0x02, 0x01}); - // Invalid view type (0xff). + {0xFF, 0x09, 0x42, 0x04, 0x00, 0x00, 0x00, 0x00, 0x56, 0x77, 0x02, 0x01}); + // Invalid view type (0xFF). InvalidDecodeTest( - {0xff, 0x09, 0x42, 0x02, 0x00, 0x00, 0x56, 0xff, 0x01, 0x01}); + {0xFF, 0x09, 0x42, 0x02, 0x00, 0x00, 0x56, 0xFF, 0x01, 0x01}); } TEST_F(ValueSerializerTest, RoundTripDataView) { @@ -2198,8 +2189,8 @@ TEST_F(ValueSerializerTest, RoundTripDataView) { } TEST_F(ValueSerializerTest, DecodeDataView) { - DecodeTest({0xff, 0x09, 0x3f, 0x00, 0x3f, 0x00, 0x42, 0x04, 0x00, 0x00, 0x00, - 0x00, 0x56, 0x3f, 0x01, 0x02}, + DecodeTest({0xFF, 0x09, 0x3F, 0x00, 0x3F, 0x00, 0x42, 0x04, 0x00, 0x00, 0x00, + 0x00, 0x56, 0x3F, 0x01, 0x02}, [this](Local<Value> value) { ASSERT_TRUE(value->IsDataView()); EXPECT_EQ(1u, DataView::Cast(*value)->ByteOffset()); @@ -2213,10 +2204,10 @@ TEST_F(ValueSerializerTest, DecodeDataView) { TEST_F(ValueSerializerTest, DecodeInvalidDataView) { // Byte offset out of range. InvalidDecodeTest( - {0xff, 0x09, 0x42, 0x02, 0x00, 0x00, 0x56, 0x3f, 0x03, 0x01}); + {0xFF, 0x09, 0x42, 0x02, 0x00, 0x00, 0x56, 0x3F, 0x03, 0x01}); // Byte offset in range, offset + length out of range. InvalidDecodeTest( - {0xff, 0x09, 0x42, 0x02, 0x00, 0x00, 0x56, 0x3f, 0x01, 0x03}); + {0xFF, 0x09, 0x42, 0x02, 0x00, 0x00, 0x56, 0x3F, 0x01, 0x03}); } class ValueSerializerTestWithSharedArrayBufferTransfer @@ -2303,7 +2294,7 @@ bool ValueSerializerTestWithSharedArrayBufferTransfer::flag_was_enabled_ = TEST_F(ValueSerializerTestWithSharedArrayBufferTransfer, RoundTripSharedArrayBufferTransfer) { - InitializeData({0x00, 0x01, 0x80, 0xff}); + InitializeData({0x00, 0x01, 0x80, 0xFF}); EXPECT_CALL(serializer_delegate_, GetSharedArrayBufferId(isolate(), input_buffer())) @@ -2345,7 +2336,7 @@ TEST_F(ValueSerializerTestWithSharedArrayBufferTransfer, bool flag_was_enabled = i::FLAG_experimental_wasm_threads; i::FLAG_experimental_wasm_threads = true; - std::vector<uint8_t> data = {0x00, 0x01, 0x80, 0xff}; + std::vector<uint8_t> data = {0x00, 0x01, 0x80, 0xFF}; data.resize(65536); InitializeData(data); @@ -2628,7 +2619,7 @@ TEST_F(ValueSerializerTestWithHostObject, DecodeSimpleHostObject) { return NewHostObject(deserialization_context(), 0, nullptr); })); DecodeTest( - {0xff, 0x0d, 0x5c, kExampleHostObjectTag}, [this](Local<Value> value) { + {0xFF, 0x0D, 0x5C, kExampleHostObjectTag}, [this](Local<Value> value) { EXPECT_TRUE(EvaluateScriptForResultBool( "Object.getPrototypeOf(result) === ExampleHostObject.prototype")); }); @@ -2963,67 +2954,67 @@ TEST_F(ValueSerializerTestWithWasm, ComplexObjectWithManyInline) { // As produced around Chrome 56. const unsigned char kSerializedIncrementerWasm[] = { - 0xff, 0x09, 0x3f, 0x00, 0x57, 0x79, 0x2d, 0x00, 0x61, 0x73, 0x6d, 0x0d, - 0x00, 0x00, 0x00, 0x01, 0x06, 0x01, 0x60, 0x01, 0x7f, 0x01, 0x7f, 0x03, - 0x02, 0x01, 0x00, 0x07, 0x0d, 0x01, 0x09, 0x69, 0x6e, 0x63, 0x72, 0x65, - 0x6d, 0x65, 0x6e, 0x74, 0x00, 0x00, 0x0a, 0x08, 0x01, 0x06, 0x00, 0x20, - 0x00, 0x41, 0x01, 0x6a, 0xf8, 0x04, 0xa1, 0x06, 0xde, 0xc0, 0xc6, 0x44, - 0x3c, 0x29, 0x00, 0x00, 0x00, 0x00, 0x1f, 0x02, 0x00, 0x00, 0x81, 0x4e, - 0xce, 0x7c, 0x05, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x30, 0x02, - 0x00, 0x00, 0xb0, 0x25, 0x30, 0xe3, 0xf2, 0xdb, 0x2e, 0x48, 0x00, 0x00, - 0x00, 0x80, 0xe8, 0x00, 0x00, 0x80, 0xe0, 0x01, 0x00, 0x80, 0x00, 0x00, + 0xFF, 0x09, 0x3F, 0x00, 0x57, 0x79, 0x2D, 0x00, 0x61, 0x73, 0x6D, 0x0D, + 0x00, 0x00, 0x00, 0x01, 0x06, 0x01, 0x60, 0x01, 0x7F, 0x01, 0x7F, 0x03, + 0x02, 0x01, 0x00, 0x07, 0x0D, 0x01, 0x09, 0x69, 0x6E, 0x63, 0x72, 0x65, + 0x6D, 0x65, 0x6E, 0x74, 0x00, 0x00, 0x0A, 0x08, 0x01, 0x06, 0x00, 0x20, + 0x00, 0x41, 0x01, 0x6A, 0xF8, 0x04, 0xA1, 0x06, 0xDE, 0xC0, 0xC6, 0x44, + 0x3C, 0x29, 0x00, 0x00, 0x00, 0x00, 0x1F, 0x02, 0x00, 0x00, 0x81, 0x4E, + 0xCE, 0x7C, 0x05, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x30, 0x02, + 0x00, 0x00, 0xB0, 0x25, 0x30, 0xE3, 0xF2, 0xDB, 0x2E, 0x48, 0x00, 0x00, + 0x00, 0x80, 0xE8, 0x00, 0x00, 0x80, 0xE0, 0x01, 0x00, 0x80, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00, 0x80, 0x07, 0x08, 0x00, 0x00, 0x09, 0x04, - 0x10, 0x02, 0x00, 0x00, 0x00, 0x00, 0x01, 0x3c, 0x8c, 0xc0, 0x00, 0x00, - 0x00, 0x00, 0x0d, 0x00, 0x00, 0x00, 0x01, 0x10, 0x8c, 0xc0, 0x00, 0x00, - 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x02, 0x70, 0x94, 0x01, 0x0c, 0x8b, - 0xc1, 0x00, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x25, 0xdc, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x9e, 0x01, 0x10, 0x8c, 0xc0, 0x00, 0x00, - 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x84, 0xc0, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x05, 0x7d, 0x01, 0x1a, 0xe1, 0x02, 0x00, 0x00, + 0x10, 0x02, 0x00, 0x00, 0x00, 0x00, 0x01, 0x3C, 0x8C, 0xC0, 0x00, 0x00, + 0x00, 0x00, 0x0D, 0x00, 0x00, 0x00, 0x01, 0x10, 0x8C, 0xC0, 0x00, 0x00, + 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x02, 0x70, 0x94, 0x01, 0x0C, 0x8B, + 0xC1, 0x00, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x25, 0xDC, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x9E, 0x01, 0x10, 0x8C, 0xC0, 0x00, 0x00, + 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x84, 0xC0, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x05, 0x7D, 0x01, 0x1A, 0xE1, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x11, 0x23, 0x88, 0x42, 0x32, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x63, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3e, 0x00, 0x00, 0x00, 0x04, 0x00, - 0x00, 0x02, 0xa1, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, - 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x49, 0x3b, 0xa5, 0x60, 0x0c, 0x00, - 0x00, 0x0f, 0x86, 0x04, 0x00, 0x00, 0x00, 0x83, 0xc0, 0x01, 0xc3, 0x55, - 0x48, 0x89, 0xe5, 0x49, 0xba, 0x00, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, - 0x00, 0x41, 0x52, 0x48, 0x83, 0xec, 0x08, 0x48, 0x89, 0x45, 0xf0, 0x48, - 0xbb, 0xb0, 0x67, 0xc6, 0x00, 0x00, 0x00, 0x00, 0x00, 0x33, 0xc0, 0x48, - 0xbe, 0xe1, 0x57, 0x81, 0x85, 0xf6, 0x14, 0x00, 0x00, 0xe8, 0xfc, 0x3c, - 0xea, 0xff, 0x48, 0x8b, 0x45, 0xf0, 0x48, 0x8b, 0xe5, 0x5d, 0xeb, 0xbf, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3E, 0x00, 0x00, 0x00, 0x04, 0x00, + 0x00, 0x02, 0xA1, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, 0xFF, + 0xFF, 0xFF, 0x00, 0x00, 0x00, 0x00, 0x49, 0x3B, 0xA5, 0x60, 0x0C, 0x00, + 0x00, 0x0F, 0x86, 0x04, 0x00, 0x00, 0x00, 0x83, 0xC0, 0x01, 0xC3, 0x55, + 0x48, 0x89, 0xE5, 0x49, 0xBA, 0x00, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, + 0x00, 0x41, 0x52, 0x48, 0x83, 0xEC, 0x08, 0x48, 0x89, 0x45, 0xF0, 0x48, + 0xBB, 0xB0, 0x67, 0xC6, 0x00, 0x00, 0x00, 0x00, 0x00, 0x33, 0xC0, 0x48, + 0xBE, 0xE1, 0x57, 0x81, 0x85, 0xF6, 0x14, 0x00, 0x00, 0xE8, 0xFC, 0x3C, + 0xEA, 0xFF, 0x48, 0x8B, 0x45, 0xF0, 0x48, 0x8B, 0xE5, 0x5D, 0xEB, 0xBF, 0x66, 0x90, 0x01, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x44, 0x00, - 0x00, 0x00, 0xff, 0xff, 0xff, 0x0f, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0xFF, 0xFF, 0xFF, 0x0F, 0xFF, 0xFF, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x0f, 0x20, 0x84, 0x0f, 0x7d, 0x01, 0x0d, 0x00, 0x0f, 0x04, - 0x6d, 0x08, 0x0f, 0xf0, 0x02, 0x80, 0x94, 0x01, 0x0c, 0x8b, 0xc1, 0x00, - 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0xed, 0xa9, 0x2d, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x9e, 0xe0, 0x38, 0x1a, 0x61, 0x03, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x0F, 0x20, 0x84, 0x0F, 0x7D, 0x01, 0x0D, 0x00, 0x0F, 0x04, + 0x6D, 0x08, 0x0F, 0xF0, 0x02, 0x80, 0x94, 0x01, 0x0C, 0x8B, 0xC1, 0x00, + 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0xED, 0xA9, 0x2D, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x9E, 0xE0, 0x38, 0x1A, 0x61, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x11, 0x23, 0x88, 0x42, 0x32, 0x03, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x9a, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x4e, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, - 0x02, 0xf9, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, - 0xff, 0x00, 0x00, 0x00, 0x00, 0x55, 0x48, 0x89, 0xe5, 0x56, 0x57, 0x48, - 0x8b, 0x45, 0x10, 0xe8, 0x11, 0xed, 0xed, 0xff, 0xa8, 0x01, 0x0f, 0x85, - 0x2d, 0x00, 0x00, 0x00, 0x48, 0xc1, 0xe8, 0x20, 0xc5, 0xf9, 0x57, 0xc0, - 0xc5, 0xfb, 0x2a, 0xc0, 0xc4, 0xe1, 0xfb, 0x2c, 0xc0, 0x48, 0x83, 0xf8, - 0x01, 0x0f, 0x80, 0x34, 0x00, 0x00, 0x00, 0x8b, 0xc0, 0xe8, 0x27, 0xfe, - 0xff, 0xff, 0x48, 0xc1, 0xe0, 0x20, 0x48, 0x8b, 0xe5, 0x5d, 0xc2, 0x10, - 0x00, 0x49, 0x39, 0x45, 0xa0, 0x0f, 0x84, 0x07, 0x00, 0x00, 0x00, 0xc5, - 0xfb, 0x10, 0x40, 0x07, 0xeb, 0xce, 0x49, 0xba, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0xf8, 0x7f, 0xc4, 0xc1, 0xf9, 0x6e, 0xc2, 0xeb, 0xbd, 0x48, - 0x83, 0xec, 0x08, 0xc5, 0xfb, 0x11, 0x04, 0x24, 0xe8, 0xcc, 0xfe, 0xff, - 0xff, 0x48, 0x83, 0xc4, 0x08, 0xeb, 0xb8, 0x66, 0x90, 0x02, 0x00, 0x00, - 0x00, 0x03, 0x00, 0x00, 0x00, 0x0f, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, - 0x0f, 0x39, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0x0f, 0xff, 0xff, 0x00, - 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0f, 0x20, 0x84, - 0x0f, 0xcc, 0x6e, 0x7d, 0x01, 0x72, 0x98, 0x00, 0x0f, 0xdc, 0x6d, 0x0c, - 0x0f, 0xb0, 0x84, 0x0d, 0x04, 0x84, 0xe3, 0xc0, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x84, 0xe0, 0x84, 0x84, 0x18, 0x2f, 0x2f, 0x2f, - 0x2f, 0x2f}; + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x9A, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x4E, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, + 0x02, 0xF9, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, 0xFF, 0xFF, + 0xFF, 0x00, 0x00, 0x00, 0x00, 0x55, 0x48, 0x89, 0xE5, 0x56, 0x57, 0x48, + 0x8B, 0x45, 0x10, 0xE8, 0x11, 0xED, 0xED, 0xFF, 0xA8, 0x01, 0x0F, 0x85, + 0x2D, 0x00, 0x00, 0x00, 0x48, 0xC1, 0xE8, 0x20, 0xC5, 0xF9, 0x57, 0xC0, + 0xC5, 0xFB, 0x2A, 0xC0, 0xC4, 0xE1, 0xFB, 0x2C, 0xC0, 0x48, 0x83, 0xF8, + 0x01, 0x0F, 0x80, 0x34, 0x00, 0x00, 0x00, 0x8B, 0xC0, 0xE8, 0x27, 0xFE, + 0xFF, 0xFF, 0x48, 0xC1, 0xE0, 0x20, 0x48, 0x8B, 0xE5, 0x5D, 0xC2, 0x10, + 0x00, 0x49, 0x39, 0x45, 0xA0, 0x0F, 0x84, 0x07, 0x00, 0x00, 0x00, 0xC5, + 0xFB, 0x10, 0x40, 0x07, 0xEB, 0xCE, 0x49, 0xBA, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0xF8, 0x7F, 0xC4, 0xC1, 0xF9, 0x6E, 0xC2, 0xEB, 0xBD, 0x48, + 0x83, 0xEC, 0x08, 0xC5, 0xFB, 0x11, 0x04, 0x24, 0xE8, 0xCC, 0xFE, 0xFF, + 0xFF, 0x48, 0x83, 0xC4, 0x08, 0xEB, 0xB8, 0x66, 0x90, 0x02, 0x00, 0x00, + 0x00, 0x03, 0x00, 0x00, 0x00, 0x0F, 0x00, 0x00, 0x00, 0xFF, 0xFF, 0xFF, + 0x0F, 0x39, 0x00, 0x00, 0x00, 0xFF, 0xFF, 0xFF, 0x0F, 0xFF, 0xFF, 0x00, + 0xFF, 0xFF, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0F, 0x20, 0x84, + 0x0F, 0xCC, 0x6E, 0x7D, 0x01, 0x72, 0x98, 0x00, 0x0F, 0xDC, 0x6D, 0x0C, + 0x0F, 0xB0, 0x84, 0x0D, 0x04, 0x84, 0xE3, 0xC0, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x84, 0xE0, 0x84, 0x84, 0x18, 0x2F, 0x2F, 0x2F, + 0x2F, 0x2F}; TEST_F(ValueSerializerTestWithWasm, DecodeWasmModule) { - if (true) return; // TODO(mtrofin): fix this test + if ((true)) return; // TODO(mtrofin): fix this test std::vector<uint8_t> raw( kSerializedIncrementerWasm, kSerializedIncrementerWasm + sizeof(kSerializedIncrementerWasm)); @@ -3037,14 +3028,14 @@ TEST_F(ValueSerializerTestWithWasm, DecodeWasmModule) { // As above, but with empty compiled data. Should work due to fallback to wire // data. const unsigned char kSerializedIncrementerWasmWithInvalidCompiledData[] = { - 0xff, 0x09, 0x3f, 0x00, 0x57, 0x79, 0x2d, 0x00, 0x61, 0x73, 0x6d, - 0x0d, 0x00, 0x00, 0x00, 0x01, 0x06, 0x01, 0x60, 0x01, 0x7f, 0x01, - 0x7f, 0x03, 0x02, 0x01, 0x00, 0x07, 0x0d, 0x01, 0x09, 0x69, 0x6e, - 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x00, 0x00, 0x0a, 0x08, - 0x01, 0x06, 0x00, 0x20, 0x00, 0x41, 0x01, 0x6a, 0x00}; + 0xFF, 0x09, 0x3F, 0x00, 0x57, 0x79, 0x2D, 0x00, 0x61, 0x73, 0x6D, + 0x0D, 0x00, 0x00, 0x00, 0x01, 0x06, 0x01, 0x60, 0x01, 0x7F, 0x01, + 0x7F, 0x03, 0x02, 0x01, 0x00, 0x07, 0x0D, 0x01, 0x09, 0x69, 0x6E, + 0x63, 0x72, 0x65, 0x6D, 0x65, 0x6E, 0x74, 0x00, 0x00, 0x0A, 0x08, + 0x01, 0x06, 0x00, 0x20, 0x00, 0x41, 0x01, 0x6A, 0x00}; TEST_F(ValueSerializerTestWithWasm, DecodeWasmModuleWithInvalidCompiledData) { - if (true) return; // TODO(titzer): regenerate this test + if ((true)) return; // TODO(titzer): regenerate this test std::vector<uint8_t> raw( kSerializedIncrementerWasmWithInvalidCompiledData, kSerializedIncrementerWasmWithInvalidCompiledData + @@ -3058,7 +3049,7 @@ TEST_F(ValueSerializerTestWithWasm, DecodeWasmModuleWithInvalidCompiledData) { // As above, but also with empty wire data. Should fail. const unsigned char kSerializedIncrementerWasmInvalid[] = { - 0xff, 0x09, 0x3f, 0x00, 0x57, 0x79, 0x00, 0x00}; + 0xFF, 0x09, 0x3F, 0x00, 0x57, 0x79, 0x00, 0x00}; TEST_F(ValueSerializerTestWithWasm, DecodeWasmModuleWithInvalidCompiledAndWireData) { @@ -3069,8 +3060,8 @@ TEST_F(ValueSerializerTestWithWasm, } TEST_F(ValueSerializerTestWithWasm, DecodeWasmModuleWithInvalidDataLength) { - InvalidDecodeTest({0xff, 0x09, 0x3f, 0x00, 0x57, 0x79, 0x7f, 0x00}); - InvalidDecodeTest({0xff, 0x09, 0x3f, 0x00, 0x57, 0x79, 0x00, 0x7f}); + InvalidDecodeTest({0xFF, 0x09, 0x3F, 0x00, 0x57, 0x79, 0x7F, 0x00}); + InvalidDecodeTest({0xFF, 0x09, 0x3F, 0x00, 0x57, 0x79, 0x00, 0x7F}); } } // namespace diff --git a/deps/v8/test/unittests/wasm/decoder-unittest.cc b/deps/v8/test/unittests/wasm/decoder-unittest.cc index 24606a43fd..627a9da3ee 100644 --- a/deps/v8/test/unittests/wasm/decoder-unittest.cc +++ b/deps/v8/test/unittests/wasm/decoder-unittest.cc @@ -185,7 +185,7 @@ TEST_F(DecoderTest, ReadU32v_FiveByte) { const uint32_t max = 0xFFFFFFFFu; for (uint32_t i = 1; i < 32; i++) { - uint32_t val = 0x983489aau << i; + uint32_t val = 0x983489AAu << i; CHECK_UINT32V_INLINE(val, 5, U32V_5(val), 0); } @@ -442,7 +442,7 @@ TEST_F(DecoderTest, ReadU32v_extra_bits) { TEST_F(DecoderTest, ReadI32v_extra_bits_negative) { // OK for negative signed values to have extra ones. unsigned length = 0; - byte data[] = {0xff, 0xff, 0xff, 0xff, 0x7f}; + byte data[] = {0xFF, 0xFF, 0xFF, 0xFF, 0x7F}; decoder.Reset(data, data + sizeof(data)); decoder.read_i32v<Decoder::kValidate>(decoder.start(), &length); EXPECT_EQ(5u, length); @@ -463,11 +463,11 @@ TEST_F(DecoderTest, ReadU32v_Bits) { // A more exhaustive test. const int kMaxSize = 5; const uint32_t kVals[] = { - 0xaabbccdd, 0x11223344, 0x33445566, 0xffeeddcc, 0xF0F0F0F0, 0x0F0F0F0F, - 0xEEEEEEEE, 0xAAAAAAAA, 0x12345678, 0x9abcdef0, 0x80309488, 0x729ed997, - 0xc4a0cf81, 0x16c6eb85, 0x4206db8e, 0xf3b089d5, 0xaa2e223e, 0xf99e29c8, - 0x4a4357d8, 0x1890b1c1, 0x8d80a085, 0xacb6ae4c, 0x1b827e10, 0xeb5c7bd9, - 0xbb1bc146, 0xdf57a33l}; + 0xAABBCCDD, 0x11223344, 0x33445566, 0xFFEEDDCC, 0xF0F0F0F0, 0x0F0F0F0F, + 0xEEEEEEEE, 0xAAAAAAAA, 0x12345678, 0x9ABCDEF0, 0x80309488, 0x729ED997, + 0xC4A0CF81, 0x16C6EB85, 0x4206DB8E, 0xF3B089D5, 0xAA2E223E, 0xF99E29C8, + 0x4A4357D8, 0x1890B1C1, 0x8D80A085, 0xACB6AE4C, 0x1B827E10, 0xEB5C7BD9, + 0xBB1BC146, 0xDF57A33l}; byte data[kMaxSize]; // foreach value in above array @@ -560,11 +560,11 @@ TEST_F(DecoderTest, ReadU64v_PowerOf2) { TEST_F(DecoderTest, ReadU64v_Bits) { const int kMaxSize = 10; const uint64_t kVals[] = { - 0xaabbccdd11223344ull, 0x33445566ffeeddccull, 0xF0F0F0F0F0F0F0F0ull, + 0xAABBCCDD11223344ull, 0x33445566FFEEDDCCull, 0xF0F0F0F0F0F0F0F0ull, 0x0F0F0F0F0F0F0F0Full, 0xEEEEEEEEEEEEEEEEull, 0xAAAAAAAAAAAAAAAAull, - 0x123456789abcdef0ull, 0x80309488729ed997ull, 0xc4a0cf8116c6eb85ull, - 0x4206db8ef3b089d5ull, 0xaa2e223ef99e29c8ull, 0x4a4357d81890b1c1ull, - 0x8d80a085acb6ae4cull, 0x1b827e10eb5c7bd9ull, 0xbb1bc146df57a338ull}; + 0x123456789ABCDEF0ull, 0x80309488729ED997ull, 0xC4A0CF8116C6EB85ull, + 0x4206DB8EF3B089D5ull, 0xAA2E223EF99E29C8ull, 0x4A4357D81890B1C1ull, + 0x8D80A085ACB6AE4Cull, 0x1B827E10EB5C7BD9ull, 0xBB1BC146DF57A338ull}; byte data[kMaxSize]; // foreach value in above array @@ -603,11 +603,11 @@ TEST_F(DecoderTest, ReadI64v_Bits) { const int kMaxSize = 10; // Exhaustive signedness test. const uint64_t kVals[] = { - 0xaabbccdd11223344ull, 0x33445566ffeeddccull, 0xF0F0F0F0F0F0F0F0ull, + 0xAABBCCDD11223344ull, 0x33445566FFEEDDCCull, 0xF0F0F0F0F0F0F0F0ull, 0x0F0F0F0F0F0F0F0Full, 0xEEEEEEEEEEEEEEEEull, 0xAAAAAAAAAAAAAAAAull, - 0x123456789abcdef0ull, 0x80309488729ed997ull, 0xc4a0cf8116c6eb85ull, - 0x4206db8ef3b089d5ull, 0xaa2e223ef99e29c8ull, 0x4a4357d81890b1c1ull, - 0x8d80a085acb6ae4cull, 0x1b827e10eb5c7bd9ull, 0xbb1bc146df57a338ull}; + 0x123456789ABCDEF0ull, 0x80309488729ED997ull, 0xC4A0CF8116C6EB85ull, + 0x4206DB8EF3B089D5ull, 0xAA2E223EF99E29C8ull, 0x4A4357D81890B1C1ull, + 0x8D80A085ACB6AE4Cull, 0x1B827E10EB5C7BD9ull, 0xBB1BC146DF57A338ull}; byte data[kMaxSize]; // foreach value in above array @@ -656,7 +656,7 @@ TEST_F(DecoderTest, ReadU64v_extra_bits) { TEST_F(DecoderTest, ReadI64v_extra_bits_negative) { // OK for negative signed values to have extra ones. unsigned length = 0; - byte data[] = {0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x7f}; + byte data[] = {0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x7F}; decoder.Reset(data, data + sizeof(data)); decoder.read_i64v<Decoder::kValidate>(decoder.start(), &length); EXPECT_EQ(10u, length); 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 d02dca36be..5cc4bf8196 100644 --- a/deps/v8/test/unittests/wasm/function-body-decoder-unittest.cc +++ b/deps/v8/test/unittests/wasm/function-body-decoder-unittest.cc @@ -52,36 +52,40 @@ static const WasmOpcode kInt32BinopOpcodes[] = { #define WASM_BRV_IF_ZERO(depth, val) \ val, WASM_ZERO, kExprBrIf, static_cast<byte>(depth) -#define EXPECT_VERIFIES_C(sig, x) Verify(true, sigs.sig(), x, x + arraysize(x)) +#define EXPECT_VERIFIES_C(sig, x) \ + Verify(true, sigs.sig(), x, x + arraysize(x), kAppendEnd) -#define EXPECT_FAILURE_C(sig, x) Verify(false, sigs.sig(), x, x + arraysize(x)) +#define EXPECT_FAILURE_C(sig, x) \ + Verify(false, sigs.sig(), x, x + arraysize(x), kAppendEnd) -#define EXPECT_VERIFIES_SC(sig, x) Verify(true, sig, x, x + arraysize(x)) +#define EXPECT_VERIFIES_SC(sig, x) \ + Verify(true, sig, x, x + arraysize(x), kAppendEnd) -#define EXPECT_FAILURE_SC(sig, x) Verify(false, sig, x, x + arraysize(x)) +#define EXPECT_FAILURE_SC(sig, x) \ + Verify(false, sig, x, x + arraysize(x), kAppendEnd) -#define EXPECT_VERIFIES_S(env, ...) \ - do { \ - static byte code[] = {__VA_ARGS__}; \ - Verify(true, env, code, code + arraysize(code)); \ +#define EXPECT_VERIFIES_S(env, ...) \ + do { \ + static byte code[] = {__VA_ARGS__}; \ + Verify(true, env, code, code + arraysize(code), kAppendEnd); \ } while (false) -#define EXPECT_FAILURE_S(env, ...) \ - do { \ - static byte code[] = {__VA_ARGS__}; \ - Verify(false, env, code, code + arraysize(code)); \ +#define EXPECT_FAILURE_S(env, ...) \ + do { \ + static byte code[] = {__VA_ARGS__}; \ + Verify(false, env, code, code + arraysize(code), kAppendEnd); \ } while (false) -#define EXPECT_VERIFIES(sig, ...) \ - do { \ - static const byte code[] = {__VA_ARGS__}; \ - Verify(true, sigs.sig(), code, code + sizeof(code)); \ +#define EXPECT_VERIFIES(sig, ...) \ + do { \ + static const byte code[] = {__VA_ARGS__}; \ + Verify(true, sigs.sig(), code, code + sizeof(code), kAppendEnd); \ } while (false) -#define EXPECT_FAILURE(sig, ...) \ - do { \ - static const byte code[] = {__VA_ARGS__}; \ - Verify(false, sigs.sig(), code, code + sizeof(code)); \ +#define EXPECT_FAILURE(sig, ...) \ + do { \ + static const byte code[] = {__VA_ARGS__}; \ + Verify(false, sigs.sig(), code, code + sizeof(code), kAppendEnd); \ } while (false) class FunctionBodyDecoderTest : public TestWithZone { @@ -98,18 +102,24 @@ class FunctionBodyDecoderTest : public TestWithZone { local_decls.AddLocals(count, type); } - void PrepareBytecode(const byte** startp, const byte** endp) { + enum AppendEnd : bool { kAppendEnd, kOmitEnd }; + + void PrepareBytecode(const byte** startp, const byte** endp, + AppendEnd append_end) { const byte* start = *startp; const byte* end = *endp; size_t locals_size = local_decls.Size(); - size_t total_size = end - start + locals_size + 1; + size_t total_size = end - start + locals_size; + if (append_end == kAppendEnd) ++total_size; byte* buffer = static_cast<byte*>(zone()->New(total_size)); // Prepend the local decls to the code. local_decls.Emit(buffer); // Emit the code. memcpy(buffer + locals_size, start, end - start); - // Append an extra end opcode. - buffer[total_size - 1] = kExprEnd; + if (append_end == kAppendEnd) { + // Append an extra end opcode. + buffer[total_size - 1] = kExprEnd; + } *startp = buffer; *endp = buffer + total_size; @@ -118,8 +128,8 @@ class FunctionBodyDecoderTest : public TestWithZone { // Prepends local variable declarations and renders nice error messages for // verification failures. void Verify(bool expected_success, FunctionSig* sig, const byte* start, - const byte* end) { - PrepareBytecode(&start, &end); + const byte* end, AppendEnd append_end) { + PrepareBytecode(&start, &end, append_end); // Verify the code. DecodeResult result = @@ -253,8 +263,8 @@ TEST_F(FunctionBodyDecoderTest, Int32Const1) { TEST_F(FunctionBodyDecoderTest, EmptyFunction) { byte code[] = {0}; - Verify(true, sigs.v_v(), code, code); - Verify(false, sigs.i_i(), code, code); + Verify(true, sigs.v_v(), code, code, kAppendEnd); + Verify(false, sigs.i_i(), code, code, kAppendEnd); } TEST_F(FunctionBodyDecoderTest, IncompleteIf1) { @@ -307,10 +317,12 @@ TEST_F(FunctionBodyDecoderTest, Float64Const) { } TEST_F(FunctionBodyDecoderTest, Int32Const_off_end) { - byte code[] = {kExprI32Const, 0xaa, 0xbb, 0xcc, 0x44}; + byte code[] = {kExprI32Const, 0xAA, 0xBB, 0xCC, 0x44}; for (int size = 1; size <= 4; size++) { - Verify(false, sigs.i_i(), code, code + size); + Verify(false, sigs.i_i(), code, code + size, kAppendEnd); + // Should also fail without the trailing 'end' opcode. + Verify(false, sigs.i_i(), code, code + size, kOmitEnd); } } @@ -496,7 +508,7 @@ TEST_F(FunctionBodyDecoderTest, BlockN) { buffer[0] = kExprBlock; buffer[1] = kLocalVoid; buffer[i + 2] = kExprEnd; - Verify(true, sigs.v_i(), buffer, buffer + i + 3); + Verify(true, sigs.v_i(), buffer, buffer + i + 3, kAppendEnd); } } @@ -643,7 +655,8 @@ TEST_F(FunctionBodyDecoderTest, BlockN_off_end) { byte code[] = {WASM_BLOCK(kExprNop, kExprNop, kExprNop, kExprNop)}; EXPECT_VERIFIES_C(v_v, code); for (size_t i = 1; i < arraysize(code); i++) { - Verify(false, sigs.v_v(), code, code + i); + Verify(false, sigs.v_v(), code, code + i, kAppendEnd); + Verify(false, sigs.v_v(), code, code + i, kOmitEnd); } } @@ -973,7 +986,8 @@ TEST_F(FunctionBodyDecoderTest, If_off_end) { static const byte kCode[] = { WASM_IF_ELSE(WASM_GET_LOCAL(0), WASM_GET_LOCAL(0), WASM_GET_LOCAL(0))}; for (size_t len = 3; len < arraysize(kCode); len++) { - Verify(false, sigs.i_i(), kCode, kCode + len); + Verify(false, sigs.i_i(), kCode, kCode + len, kAppendEnd); + Verify(false, sigs.i_i(), kCode, kCode + len, kOmitEnd); } } @@ -1566,6 +1580,40 @@ TEST_F(FunctionBodyDecoderTest, IndirectCallsWithoutTableCrash) { WASM_I32V_2(72))); } +TEST_F(FunctionBodyDecoderTest, IncompleteIndirectCall) { + FunctionSig* sig = sigs.i_i(); + TestModuleBuilder builder; + builder.InitializeFunctionTable(); + module = builder.module(); + + static byte code[] = {kExprCallIndirect}; + Verify(false, sig, code, code + arraysize(code), kOmitEnd); +} + +TEST_F(FunctionBodyDecoderTest, IncompleteStore) { + FunctionSig* sig = sigs.i_i(); + TestModuleBuilder builder; + builder.InitializeMemory(); + builder.InitializeFunctionTable(); + module = builder.module(); + + static byte code[] = {kExprI32StoreMem}; + Verify(false, sig, code, code + arraysize(code), kOmitEnd); +} + +TEST_F(FunctionBodyDecoderTest, IncompleteS8x16Shuffle) { + EXPERIMENTAL_FLAG_SCOPE(simd); + FunctionSig* sig = sigs.i_i(); + TestModuleBuilder builder; + builder.InitializeMemory(); + builder.InitializeFunctionTable(); + module = builder.module(); + + static byte code[] = {kSimdPrefix, + static_cast<byte>(kExprS8x16Shuffle & 0xff)}; + Verify(false, sig, code, code + arraysize(code), kOmitEnd); +} + TEST_F(FunctionBodyDecoderTest, SimpleImportCalls) { FunctionSig* sig = sigs.i_i(); TestModuleBuilder builder; @@ -2139,7 +2187,8 @@ TEST_F(FunctionBodyDecoderTest, BrTable2b) { TEST_F(FunctionBodyDecoderTest, BrTable_off_end) { static byte code[] = {B1(WASM_BR_TABLE(WASM_GET_LOCAL(0), 0, BR_TARGET(0)))}; for (size_t len = 1; len < sizeof(code); len++) { - Verify(false, sigs.i_i(), code, code + len); + Verify(false, sigs.i_i(), code, code + len, kAppendEnd); + Verify(false, sigs.i_i(), code, code + len, kOmitEnd); } } @@ -2616,7 +2665,7 @@ TEST_F(FunctionBodyDecoderTest, Regression709741) { byte code[] = {WASM_NOP}; const byte* start = code; const byte* end = code + sizeof(code); - PrepareBytecode(&start, &end); + PrepareBytecode(&start, &end, kAppendEnd); for (const byte* i = start; i < end; i++) { DecodeResult result = @@ -2919,16 +2968,16 @@ TEST_F(WasmOpcodeLengthTest, SimpleExpressions) { TEST_F(WasmOpcodeLengthTest, SimdExpressions) { #define TEST_SIMD(name, opcode, sig) \ - EXPECT_LENGTH_N(2, kSimdPrefix, static_cast<byte>(kExpr##name & 0xff)); + EXPECT_LENGTH_N(2, kSimdPrefix, static_cast<byte>(kExpr##name & 0xFF)); FOREACH_SIMD_0_OPERAND_OPCODE(TEST_SIMD) #undef TEST_SIMD #define TEST_SIMD(name, opcode, sig) \ - EXPECT_LENGTH_N(3, kSimdPrefix, static_cast<byte>(kExpr##name & 0xff)); + EXPECT_LENGTH_N(3, kSimdPrefix, static_cast<byte>(kExpr##name & 0xFF)); FOREACH_SIMD_1_OPERAND_OPCODE(TEST_SIMD) #undef TEST_SIMD - EXPECT_LENGTH_N(18, kSimdPrefix, static_cast<byte>(kExprS8x16Shuffle & 0xff)); + EXPECT_LENGTH_N(18, kSimdPrefix, static_cast<byte>(kExprS8x16Shuffle & 0xFF)); // test for bad simd opcode - EXPECT_LENGTH_N(2, kSimdPrefix, 0xff); + EXPECT_LENGTH_N(2, kSimdPrefix, 0xFF); } #undef EXPECT_LENGTH diff --git a/deps/v8/test/unittests/wasm/leb-helper-unittest.cc b/deps/v8/test/unittests/wasm/leb-helper-unittest.cc index ec9fd3efb3..704703a3ea 100644 --- a/deps/v8/test/unittests/wasm/leb-helper-unittest.cc +++ b/deps/v8/test/unittests/wasm/leb-helper-unittest.cc @@ -119,7 +119,7 @@ TEST_F(LEBHelperTest, WriteAndDecode_u32v) { CheckEncodeDecode_u32v(87348723); CheckEncodeDecode_u32v(77777); - for (uint32_t val = 0x3a; val != 0; val = val << 1) { + for (uint32_t val = 0x3A; val != 0; val = val << 1) { CheckEncodeDecode_u32v(val); } } @@ -141,7 +141,7 @@ TEST_F(LEBHelperTest, WriteAndDecode_i32v) { CheckEncodeDecode_i32v(-87328723); CheckEncodeDecode_i32v(-77377); - for (uint32_t val = 0x3a; val != 0; val = val << 1) { + for (uint32_t val = 0x3A; val != 0; val = val << 1) { CheckEncodeDecode_i32v(bit_cast<int32_t>(val)); } @@ -159,7 +159,7 @@ TEST_F(LEBHelperTest, WriteAndDecode_u64v) { CheckEncodeDecode_u64v(87348723); CheckEncodeDecode_u64v(77777); - for (uint64_t val = 0x3a; val != 0; val = val << 1) { + for (uint64_t val = 0x3A; val != 0; val = val << 1) { CheckEncodeDecode_u64v(val); } } @@ -180,7 +180,7 @@ TEST_F(LEBHelperTest, WriteAndDecode_i64v) { CheckEncodeDecode_i64v(-87648723); CheckEncodeDecode_i64v(-77377); - for (uint64_t val = 0x3a; val != 0; val = val << 1) { + for (uint64_t val = 0x3A; val != 0; val = val << 1) { CheckEncodeDecode_i64v(bit_cast<int64_t>(val)); } diff --git a/deps/v8/test/unittests/wasm/loop-assignment-analysis-unittest.cc b/deps/v8/test/unittests/wasm/loop-assignment-analysis-unittest.cc index d089d94ca2..20f3d2bf3b 100644 --- a/deps/v8/test/unittests/wasm/loop-assignment-analysis-unittest.cc +++ b/deps/v8/test/unittests/wasm/loop-assignment-analysis-unittest.cc @@ -176,7 +176,7 @@ TEST_F(WasmLoopAssignmentAnalyzerTest, Loop2) { } TEST_F(WasmLoopAssignmentAnalyzerTest, Malformed) { - byte code[] = {kExprLoop, kLocalVoid, kExprF32Neg, kExprBrTable, 0x0e, 'h', + byte code[] = {kExprLoop, kLocalVoid, kExprF32Neg, kExprBrTable, 0x0E, 'h', 'e', 'l', 'l', 'o', ',', ' ', 'w', 'o', 'r', 'l', 'd', '!'}; BitVector* assigned = Analyze(code, code + arraysize(code)); @@ -185,8 +185,8 @@ TEST_F(WasmLoopAssignmentAnalyzerTest, Malformed) { TEST_F(WasmLoopAssignmentAnalyzerTest, regress_642867) { static const byte code[] = { - WASM_LOOP(WASM_ZERO, kExprSetLocal, 0xfa, 0xff, 0xff, 0xff, - 0x0f)}; // local index LEB128 0xfffffffa + WASM_LOOP(WASM_ZERO, kExprSetLocal, 0xFA, 0xFF, 0xFF, 0xFF, + 0x0F)}; // local index LEB128 0xFFFFFFFA // Just make sure that the analysis does not crash. Analyze(code, code + arraysize(code)); } diff --git a/deps/v8/test/unittests/wasm/module-decoder-unittest.cc b/deps/v8/test/unittests/wasm/module-decoder-unittest.cc index ae98bd9a70..a472623096 100644 --- a/deps/v8/test/unittests/wasm/module-decoder-unittest.cc +++ b/deps/v8/test/unittests/wasm/module-decoder-unittest.cc @@ -290,7 +290,7 @@ TEST_F(WasmModuleVerifyTest, ExportMutableGlobal) { static void AppendUint32v(std::vector<byte>& buffer, uint32_t val) { while (true) { uint32_t next = val >> 7; - uint32_t out = val & 0x7f; + uint32_t out = val & 0x7F; if (next) { buffer.push_back(static_cast<byte>(0x80 | out)); val = next; @@ -553,7 +553,7 @@ TEST_F(WasmModuleVerifyTest, DataSegmentWithImmutableGlobal) { 1, kLocalI32, // local type 0, // immutable - WASM_INIT_EXPR_I32V_3(0x9bbaa), // init + WASM_INIT_EXPR_I32V_3(0x9BBAA), // init SECTION(Data, 9), ENTRY_COUNT(1), LINEAR_MEMORY_INDEX_0, @@ -577,7 +577,7 @@ TEST_F(WasmModuleVerifyTest, OneDataSegment) { SECTION(Data, 11), ENTRY_COUNT(1), LINEAR_MEMORY_INDEX_0, - WASM_INIT_EXPR_I32V_3(0x9bbaa), // dest addr + WASM_INIT_EXPR_I32V_3(0x9BBAA), // dest addr U32V_1(3), // source size 'a', 'b', @@ -595,7 +595,7 @@ TEST_F(WasmModuleVerifyTest, OneDataSegment) { const WasmDataSegment* segment = &result.val->data_segments.back(); EXPECT_EQ(WasmInitExpr::kI32Const, segment->dest_addr.kind); - EXPECT_EQ(0x9bbaa, segment->dest_addr.val.i32_const); + EXPECT_EQ(0x9BBAA, segment->dest_addr.val.i32_const); EXPECT_EQ(kDataSegmentSourceOffset, segment->source.offset()); EXPECT_EQ(3u, segment->source.length()); } @@ -616,14 +616,14 @@ TEST_F(WasmModuleVerifyTest, TwoDataSegments) { SECTION(Data, 29), ENTRY_COUNT(2), // segment count LINEAR_MEMORY_INDEX_0, - WASM_INIT_EXPR_I32V_3(0x7ffee), // #0: dest addr + WASM_INIT_EXPR_I32V_3(0x7FFEE), // #0: dest addr U32V_1(4), // source size 1, 2, 3, 4, // data bytes LINEAR_MEMORY_INDEX_0, - WASM_INIT_EXPR_I32V_3(0x6ddcc), // #1: dest addr + WASM_INIT_EXPR_I32V_3(0x6DDCC), // #1: dest addr U32V_1(10), // source size 1, 2, @@ -648,12 +648,12 @@ TEST_F(WasmModuleVerifyTest, TwoDataSegments) { const WasmDataSegment* s1 = &result.val->data_segments[1]; EXPECT_EQ(WasmInitExpr::kI32Const, s0->dest_addr.kind); - EXPECT_EQ(0x7ffee, s0->dest_addr.val.i32_const); + EXPECT_EQ(0x7FFEE, s0->dest_addr.val.i32_const); EXPECT_EQ(kDataSegment0SourceOffset, s0->source.offset()); EXPECT_EQ(4u, s0->source.length()); EXPECT_EQ(WasmInitExpr::kI32Const, s1->dest_addr.kind); - EXPECT_EQ(0x6ddcc, s1->dest_addr.val.i32_const); + EXPECT_EQ(0x6DDCC, s1->dest_addr.val.i32_const); EXPECT_EQ(kDataSegment1SourceOffset, s1->source.offset()); EXPECT_EQ(10u, s1->source.length()); } @@ -666,7 +666,7 @@ TEST_F(WasmModuleVerifyTest, DataWithoutMemory) { SECTION(Data, 11), ENTRY_COUNT(1), LINEAR_MEMORY_INDEX_0, - WASM_INIT_EXPR_I32V_3(0x9bbaa), // dest addr + WASM_INIT_EXPR_I32V_3(0x9BBAA), // dest addr U32V_1(3), // source size 'a', 'b', @@ -718,7 +718,7 @@ TEST_F(WasmModuleVerifyTest, DataSegmentEndOverflow) { ENTRY_COUNT(1), // one entry LINEAR_MEMORY_INDEX_0, // mem index WASM_INIT_EXPR_I32V_1(0), // offset - U32V_5(0xffffffff) // size + U32V_5(0xFFFFFFFF) // size }; EXPECT_FAILURE(data); @@ -731,7 +731,7 @@ TEST_F(WasmModuleVerifyTest, OneIndirectFunction) { // funcs --------------------------------------------------------------- ONE_EMPTY_FUNCTION, // table declaration --------------------------------------------------- - SECTION(Table, 4), ENTRY_COUNT(1), kWasmAnyFunctionTypeForm, 0, 1}; + SECTION(Table, 4), ENTRY_COUNT(1), kWasmAnyFunctionTypeCode, 0, 1}; ModuleResult result = DecodeModule(data, data + sizeof(data)); EXPECT_OK(result); @@ -746,7 +746,7 @@ TEST_F(WasmModuleVerifyTest, OneIndirectFunction) { TEST_F(WasmModuleVerifyTest, ElementSectionWithInternalTable) { static const byte data[] = { // table --------------------------------------------------------------- - SECTION(Table, 4), ENTRY_COUNT(1), kWasmAnyFunctionTypeForm, 0, 1, + SECTION(Table, 4), ENTRY_COUNT(1), kWasmAnyFunctionTypeCode, 0, 1, // elements ------------------------------------------------------------ SECTION(Element, 1), 0 // entry count @@ -764,7 +764,7 @@ TEST_F(WasmModuleVerifyTest, ElementSectionWithImportedTable) { NAME_LENGTH(1), // -- 't', // table name kExternalTable, // import kind - kWasmAnyFunctionTypeForm, // elem_type + kWasmAnyFunctionTypeCode, // elem_type 0, // no maximum field 1, // initial size // elements ------------------------------------------------------------ @@ -797,13 +797,13 @@ TEST_F(WasmModuleVerifyTest, Regression_735887) { // funcs --------------------------------------------------------------- ONE_EMPTY_FUNCTION, // table declaration --------------------------------------------------- - SECTION(Table, 4), ENTRY_COUNT(1), kWasmAnyFunctionTypeForm, 0, 1, + SECTION(Table, 4), ENTRY_COUNT(1), kWasmAnyFunctionTypeCode, 0, 1, // elements ------------------------------------------------------------ SECTION(Element, 7), 1, // entry count TABLE_INDEX(0), WASM_INIT_EXPR_I32V_1(0), 1, // elements count - 0x9a // invalid I32V as function index + 0x9A // invalid I32V as function index }; EXPECT_FAILURE(data); @@ -816,7 +816,7 @@ TEST_F(WasmModuleVerifyTest, OneIndirectFunction_one_entry) { // funcs --------------------------------------------------------------- ONE_EMPTY_FUNCTION, // table declaration --------------------------------------------------- - SECTION(Table, 4), ENTRY_COUNT(1), kWasmAnyFunctionTypeForm, 0, 1, + SECTION(Table, 4), ENTRY_COUNT(1), kWasmAnyFunctionTypeCode, 0, 1, // elements ------------------------------------------------------------ SECTION(Element, 7), 1, // entry count @@ -844,7 +844,7 @@ TEST_F(WasmModuleVerifyTest, MultipleIndirectFunctions) { // funcs ------------------------------------------------------ FOUR_EMPTY_FUNCTIONS, // table declaration ------------------------------------------- - SECTION(Table, 4), ENTRY_COUNT(1), kWasmAnyFunctionTypeForm, 0, 8, + SECTION(Table, 4), ENTRY_COUNT(1), kWasmAnyFunctionTypeCode, 0, 8, // table elements ---------------------------------------------- SECTION(Element, 14), 1, // entry count @@ -974,7 +974,7 @@ TEST_F(WasmSignatureDecodeTest, Ok_i_tt) { } TEST_F(WasmSignatureDecodeTest, TooManyParams) { - static const byte data[] = {kWasmFunctionTypeForm, + static const byte data[] = {kWasmFunctionTypeCode, WASM_I32V_3(kV8MaxWasmFunctionParams + 1), kLocalI32, 0}; FunctionSig* sig = @@ -988,7 +988,7 @@ TEST_F(WasmSignatureDecodeTest, TooManyReturns) { const int max_return_count = static_cast<int>( FLAG_experimental_wasm_mv ? kV8MaxWasmFunctionMultiReturns : kV8MaxWasmFunctionReturns); - byte data[] = {kWasmFunctionTypeForm, 0, WASM_I32V_3(max_return_count + 1), + byte data[] = {kWasmFunctionTypeCode, 0, WASM_I32V_3(max_return_count + 1), kLocalI32}; FunctionSig* sig = DecodeWasmSignatureForTesting(zone(), data, data + sizeof(data)); @@ -1108,11 +1108,11 @@ TEST_F(WasmModuleVerifyTest, OnlyUnknownSectionEmpty) { TEST_F(WasmModuleVerifyTest, OnlyUnknownSectionNonEmpty) { const byte data[] = { UNKNOWN_SECTION(5), - 0xff, - 0xff, - 0xff, - 0xff, - 0xff, // section data + 0xFF, + 0xFF, + 0xFF, + 0xFF, + 0xFF, // section data }; EXPECT_VERIFIES(data); } @@ -1131,7 +1131,7 @@ TEST_F(WasmModuleVerifyTest, SignatureFollowedByUnknownSection) { // signatures SIGNATURES_SECTION_VOID_VOID, // ----------------------------------------------------------- - UNKNOWN_SECTION(5), 0xff, 0xff, 0xff, 0xff, 0xff, + UNKNOWN_SECTION(5), 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, }; EXPECT_VERIFIES(data); } @@ -1497,7 +1497,7 @@ TEST_F(WasmModuleVerifyTest, Regression_738097) { FUNCTION_SIGNATURES_SECTION(1, 0), // -- SECTION(Code, 1 + 5 + 1), // -- 1, // -- - U32V_5(0xffffffff), // function size, + U32V_5(0xFFFFFFFF), // function size, 0 // No real body }; EXPECT_FAILURE(data); @@ -1620,16 +1620,16 @@ TEST_F(WasmModuleVerifyTest, Names_two_empty) { TEST_F(WasmModuleVerifyTest, Regression684855) { static const byte data[] = { SECTION_NAMES(12), - 0xfb, // functions count + 0xFB, // functions count 0x27, // | 0x00, // function name length - 0xff, // local names count - 0xff, // | - 0xff, // | - 0xff, // | - 0xff, // | - 0xff, // error: "varint too large" - 0xff, // | + 0xFF, // local names count + 0xFF, // | + 0xFF, // | + 0xFF, // | + 0xFF, // | + 0xFF, // error: "varint too large" + 0xFF, // | 0x00, // -- 0x00 // -- }; @@ -1703,7 +1703,7 @@ TEST_F(WasmModuleVerifyTest, Multiple_Named_Sections) { } TEST_F(WasmModuleVerifyTest, Section_Name_No_UTF8) { - static const byte data[] = {SECTION(Unknown, 4), 1, 0xff, 17, 18}; + static const byte data[] = {SECTION(Unknown, 4), 1, 0xFF, 17, 18}; EXPECT_FAILURE(data); } diff --git a/deps/v8/test/unittests/wasm/streaming-decoder-unittest.cc b/deps/v8/test/unittests/wasm/streaming-decoder-unittest.cc index 41211ac960..8655651332 100644 --- a/deps/v8/test/unittests/wasm/streaming-decoder-unittest.cc +++ b/deps/v8/test/unittests/wasm/streaming-decoder-unittest.cc @@ -140,20 +140,20 @@ TEST_F(WasmStreamingDecoderTest, IncompleteModuleHeader) { TEST_F(WasmStreamingDecoderTest, MagicAndVersion) { const uint8_t data[] = {U32_LE(kWasmMagic), U32_LE(kWasmVersion)}; - ExpectVerifies(Vector<const uint8_t>(data, arraysize(data)), 0, 0); + ExpectVerifies(ArrayVector(data), 0, 0); } TEST_F(WasmStreamingDecoderTest, BadMagic) { for (uint32_t x = 1; x; x <<= 1) { const uint8_t data[] = {U32_LE(kWasmMagic ^ x), U32_LE(kWasmVersion)}; - ExpectFailure(Vector<const uint8_t>(data, arraysize(data))); + ExpectFailure(ArrayVector(data)); } } TEST_F(WasmStreamingDecoderTest, BadVersion) { for (uint32_t x = 1; x; x <<= 1) { const uint8_t data[] = {U32_LE(kWasmMagic), U32_LE(kWasmVersion ^ x)}; - ExpectFailure(Vector<const uint8_t>(data, arraysize(data))); + ExpectFailure(ArrayVector(data)); } } @@ -170,7 +170,7 @@ TEST_F(WasmStreamingDecoderTest, OneSection) { 0x0, // 5 0x0 // 6 }; - ExpectVerifies(Vector<const uint8_t>(data, arraysize(data)), 1, 0); + ExpectVerifies(ArrayVector(data), 1, 0); } TEST_F(WasmStreamingDecoderTest, OneSection_b) { @@ -187,7 +187,7 @@ TEST_F(WasmStreamingDecoderTest, OneSection_b) { 0x0, // 5 0x0 // 6 }; - ExpectVerifies(Vector<const uint8_t>(data, arraysize(data)), 1, 0); + ExpectVerifies(ArrayVector(data), 1, 0); } TEST_F(WasmStreamingDecoderTest, OneShortSection) { @@ -201,7 +201,7 @@ TEST_F(WasmStreamingDecoderTest, OneShortSection) { 0x0, // Payload 0x0 // 2 }; - ExpectVerifies(Vector<const uint8_t>(data, arraysize(data)), 1, 0); + ExpectVerifies(ArrayVector(data), 1, 0); } TEST_F(WasmStreamingDecoderTest, OneShortSection_b) { @@ -215,7 +215,7 @@ TEST_F(WasmStreamingDecoderTest, OneShortSection_b) { 0x0, // Payload 0x0 // 2 }; - ExpectVerifies(Vector<const uint8_t>(data, arraysize(data)), 1, 0); + ExpectVerifies(ArrayVector(data), 1, 0); } TEST_F(WasmStreamingDecoderTest, OneEmptySection) { @@ -225,7 +225,7 @@ TEST_F(WasmStreamingDecoderTest, OneEmptySection) { 0x1, // Section ID 0x0 // Section Length }; - ExpectVerifies(Vector<const uint8_t>(data, arraysize(data)), 1, 0); + ExpectVerifies(ArrayVector(data), 1, 0); } TEST_F(WasmStreamingDecoderTest, OneSectionNotEnoughPayload1) { @@ -240,7 +240,7 @@ TEST_F(WasmStreamingDecoderTest, OneSectionNotEnoughPayload1) { 0x0, // 4 0x0 // 5 }; - ExpectFailure(Vector<const uint8_t>(data, arraysize(data))); + ExpectFailure(ArrayVector(data)); } TEST_F(WasmStreamingDecoderTest, OneSectionNotEnoughPayload2) { @@ -251,7 +251,7 @@ TEST_F(WasmStreamingDecoderTest, OneSectionNotEnoughPayload2) { 0x6, // Section Length 0x0 // Payload }; - ExpectFailure(Vector<const uint8_t>(data, arraysize(data))); + ExpectFailure(ArrayVector(data)); } TEST_F(WasmStreamingDecoderTest, OneSectionInvalidLength) { @@ -265,7 +265,7 @@ TEST_F(WasmStreamingDecoderTest, OneSectionInvalidLength) { 0x80, // -- 0x80, // -- }; - ExpectFailure(Vector<const uint8_t>(data, arraysize(data))); + ExpectFailure(ArrayVector(data)); } TEST_F(WasmStreamingDecoderTest, TwoLongSections) { @@ -290,7 +290,7 @@ TEST_F(WasmStreamingDecoderTest, TwoLongSections) { 0x0, // 6 0x0 // 7 }; - ExpectVerifies(Vector<const uint8_t>(data, arraysize(data)), 2, 0); + ExpectVerifies(ArrayVector(data), 2, 0); } TEST_F(WasmStreamingDecoderTest, TwoShortSections) { @@ -305,7 +305,7 @@ TEST_F(WasmStreamingDecoderTest, TwoShortSections) { 0x0, // Payload 0x0, // 2 }; - ExpectVerifies(Vector<const uint8_t>(data, arraysize(data)), 2, 0); + ExpectVerifies(ArrayVector(data), 2, 0); } TEST_F(WasmStreamingDecoderTest, TwoSectionsShortLong) { @@ -325,7 +325,7 @@ TEST_F(WasmStreamingDecoderTest, TwoSectionsShortLong) { 0x0, // 6 0x0 // 7 }; - ExpectVerifies(Vector<const uint8_t>(data, arraysize(data)), 2, 0); + ExpectVerifies(ArrayVector(data), 2, 0); } TEST_F(WasmStreamingDecoderTest, TwoEmptySections) { @@ -337,7 +337,7 @@ TEST_F(WasmStreamingDecoderTest, TwoEmptySections) { 0x2, // Section ID 0x0 // Section Length }; - ExpectVerifies(Vector<const uint8_t>(data, arraysize(data)), 2, 0); + ExpectVerifies(ArrayVector(data), 2, 0); } TEST_F(WasmStreamingDecoderTest, OneFunction) { @@ -355,7 +355,7 @@ TEST_F(WasmStreamingDecoderTest, OneFunction) { 0x0, // 5 0x0, // 6 }; - ExpectVerifies(Vector<const uint8_t>(data, arraysize(data)), 0, 1); + ExpectVerifies(ArrayVector(data), 0, 1); } TEST_F(WasmStreamingDecoderTest, OneShortFunction) { @@ -368,7 +368,7 @@ TEST_F(WasmStreamingDecoderTest, OneShortFunction) { 0x1, // Function Length 0x0, // Function }; - ExpectVerifies(Vector<const uint8_t>(data, arraysize(data)), 0, 1); + ExpectVerifies(ArrayVector(data), 0, 1); } TEST_F(WasmStreamingDecoderTest, EmptyFunction) { @@ -380,7 +380,7 @@ TEST_F(WasmStreamingDecoderTest, EmptyFunction) { 0x1, // Number of Functions 0x0, // Function Length }; - ExpectFailure(Vector<const uint8_t>(data, arraysize(data))); + ExpectFailure(ArrayVector(data)); } TEST_F(WasmStreamingDecoderTest, TwoFunctions) { @@ -406,7 +406,7 @@ TEST_F(WasmStreamingDecoderTest, TwoFunctions) { 0x0, // 6 0x0, // 7 }; - ExpectVerifies(Vector<const uint8_t>(data, arraysize(data)), 0, 2); + ExpectVerifies(ArrayVector(data), 0, 2); } TEST_F(WasmStreamingDecoderTest, TwoFunctions_b) { @@ -414,7 +414,7 @@ TEST_F(WasmStreamingDecoderTest, TwoFunctions_b) { U32_LE(kWasmMagic), // -- U32_LE(kWasmVersion), // -- kCodeSectionCode, // Section ID - 0xb, // Section Length + 0xB, // Section Length 0x2, // Number of Functions 0x1, // Function Length 0x0, // Function @@ -427,7 +427,7 @@ TEST_F(WasmStreamingDecoderTest, TwoFunctions_b) { 0x0, // 6 0x0, // 7 }; - ExpectVerifies(Vector<const uint8_t>(data, arraysize(data)), 0, 2); + ExpectVerifies(ArrayVector(data), 0, 2); } TEST_F(WasmStreamingDecoderTest, CodeSectionLengthZero) { @@ -437,7 +437,7 @@ TEST_F(WasmStreamingDecoderTest, CodeSectionLengthZero) { kCodeSectionCode, // Section ID 0x0, // Section Length }; - ExpectFailure(Vector<const uint8_t>(data, arraysize(data))); + ExpectFailure(ArrayVector(data)); } TEST_F(WasmStreamingDecoderTest, CodeSectionLengthTooHigh) { @@ -445,7 +445,7 @@ TEST_F(WasmStreamingDecoderTest, CodeSectionLengthTooHigh) { U32_LE(kWasmMagic), // -- U32_LE(kWasmVersion), // -- kCodeSectionCode, // Section ID - 0xd, // Section Length + 0xD, // Section Length 0x2, // Number of Functions 0x7, // Function Length 0x0, // Function @@ -458,7 +458,7 @@ TEST_F(WasmStreamingDecoderTest, CodeSectionLengthTooHigh) { 0x1, // Function Length 0x0, // Function }; - ExpectFailure(Vector<const uint8_t>(data, arraysize(data))); + ExpectFailure(ArrayVector(data)); } TEST_F(WasmStreamingDecoderTest, CodeSectionLengthTooHighZeroFunctions) { @@ -466,7 +466,7 @@ TEST_F(WasmStreamingDecoderTest, CodeSectionLengthTooHighZeroFunctions) { U32_LE(kWasmMagic), // -- U32_LE(kWasmVersion), // -- kCodeSectionCode, // Section ID - 0xd, // Section Length + 0xD, // Section Length 0x0, // Number of Functions }; ExpectFailure(ArrayVector(data)); @@ -490,7 +490,7 @@ TEST_F(WasmStreamingDecoderTest, CodeSectionLengthTooLow) { 0x1, // Function Length 0x0, // Function }; - ExpectFailure(Vector<const uint8_t>(data, arraysize(data))); + ExpectFailure(ArrayVector(data)); } TEST_F(WasmStreamingDecoderTest, CodeSectionLengthTooLowEndsInNumFunctions) { @@ -513,7 +513,7 @@ TEST_F(WasmStreamingDecoderTest, CodeSectionLengthTooLowEndsInNumFunctions) { 0x1, // Function Length 0x0, // Function }; - ExpectFailure(Vector<const uint8_t>(data, arraysize(data))); + ExpectFailure(ArrayVector(data)); } TEST_F(WasmStreamingDecoderTest, CodeSectionLengthTooLowEndsInFunctionLength) { @@ -538,7 +538,7 @@ TEST_F(WasmStreamingDecoderTest, CodeSectionLengthTooLowEndsInFunctionLength) { 0x1, // Function Length 0x0, // Function }; - ExpectFailure(Vector<const uint8_t>(data, arraysize(data))); + ExpectFailure(ArrayVector(data)); } TEST_F(WasmStreamingDecoderTest, NumberOfFunctionsTooHigh) { @@ -546,7 +546,7 @@ TEST_F(WasmStreamingDecoderTest, NumberOfFunctionsTooHigh) { U32_LE(kWasmMagic), // -- U32_LE(kWasmVersion), // -- kCodeSectionCode, // Section ID - 0xb, // Section Length + 0xB, // Section Length 0x4, // Number of Functions 0x7, // Function Length 0x0, // Function @@ -559,7 +559,7 @@ TEST_F(WasmStreamingDecoderTest, NumberOfFunctionsTooHigh) { 0x1, // Function Length 0x0, // Function }; - ExpectFailure(Vector<const uint8_t>(data, arraysize(data))); + ExpectFailure(ArrayVector(data)); } TEST_F(WasmStreamingDecoderTest, NumberOfFunctionsTooLow) { @@ -567,7 +567,7 @@ TEST_F(WasmStreamingDecoderTest, NumberOfFunctionsTooLow) { U32_LE(kWasmMagic), // -- U32_LE(kWasmVersion), // -- kCodeSectionCode, // Section ID - 0xe, // Section Length + 0xE, // Section Length 0x2, // Number of Functions 0x1, // Function Length 0x0, // Function @@ -583,7 +583,7 @@ TEST_F(WasmStreamingDecoderTest, NumberOfFunctionsTooLow) { 0x0, // 6 0x0, // 7 }; - ExpectFailure(Vector<const uint8_t>(data, arraysize(data))); + ExpectFailure(ArrayVector(data)); } TEST_F(WasmStreamingDecoderTest, TwoCodeSections) { @@ -601,7 +601,7 @@ TEST_F(WasmStreamingDecoderTest, TwoCodeSections) { 0x1, // Function Length 0x0, // Function }; - ExpectFailure(Vector<const uint8_t>(data, arraysize(data))); + ExpectFailure(ArrayVector(data)); } TEST_F(WasmStreamingDecoderTest, UnknownSection) { @@ -619,7 +619,7 @@ TEST_F(WasmStreamingDecoderTest, UnknownSection) { 0x1, // Name 0x0, // Content }; - ExpectVerifies(Vector<const uint8_t>(data, arraysize(data)), 1, 1); + ExpectVerifies(ArrayVector(data), 1, 1); } TEST_F(WasmStreamingDecoderTest, UnknownSectionSandwich) { @@ -642,7 +642,7 @@ TEST_F(WasmStreamingDecoderTest, UnknownSectionSandwich) { 0x1, // Function Length 0x0, // Function }; - ExpectFailure(Vector<const uint8_t>(data, arraysize(data))); + ExpectFailure(ArrayVector(data)); } } // namespace wasm diff --git a/deps/v8/test/unittests/wasm/wasm-heap-unittest.cc b/deps/v8/test/unittests/wasm/wasm-code-manager-unittest.cc index d0c9284f93..1b6af25a4a 100644 --- a/deps/v8/test/unittests/wasm/wasm-heap-unittest.cc +++ b/deps/v8/test/unittests/wasm/wasm-code-manager-unittest.cc @@ -5,7 +5,7 @@ #include "test/unittests/test-utils.h" #include "testing/gmock/include/gmock/gmock.h" -#include "src/wasm/wasm-heap.h" +#include "src/wasm/wasm-code-manager.h" namespace v8 { namespace internal { @@ -190,7 +190,7 @@ class WasmCodeManagerTest : public TestWithIsolate { return native_module->AddCode(desc, 0, index, 0, {}, false); } - size_t page() const { return base::OS::AllocatePageSize(); } + size_t page() const { return AllocatePageSize(); } v8::Isolate* v8_isolate() const { return reinterpret_cast<v8::Isolate*>(isolate()); } diff --git a/deps/v8/test/unittests/wasm/wasm-macro-gen-unittest.cc b/deps/v8/test/unittests/wasm/wasm-macro-gen-unittest.cc index 45a4c5a59b..d1087c02a6 100644 --- a/deps/v8/test/unittests/wasm/wasm-macro-gen-unittest.cc +++ b/deps/v8/test/unittests/wasm/wasm-macro-gen-unittest.cc @@ -37,7 +37,7 @@ TEST_F(WasmMacroGenTest, Constants) { EXPECT_SIZE(4, WASM_I64V_3(10000)); EXPECT_SIZE(5, WASM_I64V_4(-9828934)); EXPECT_SIZE(6, WASM_I64V_5(-1119828934)); - EXPECT_SIZE(10, WASM_I64V_9(0x123456789abcdef0ULL)); + EXPECT_SIZE(10, WASM_I64V_9(0x123456789ABCDEF0ULL)); EXPECT_SIZE(5, WASM_F32(1.0f)); EXPECT_SIZE(5, WASM_F32(10000.0f)); diff --git a/deps/v8/test/wasm-spec-tests/testcfg.py b/deps/v8/test/wasm-spec-tests/testcfg.py index d1eae764e3..7f99ed4711 100644 --- a/deps/v8/test/wasm-spec-tests/testcfg.py +++ b/deps/v8/test/wasm-spec-tests/testcfg.py @@ -7,10 +7,7 @@ import os from testrunner.local import testsuite from testrunner.objects import testcase -class WasmSpecTestsTestSuite(testsuite.TestSuite): - def __init__(self, name, root): - super(WasmSpecTestsTestSuite, self).__init__(name, root) - +class TestSuite(testsuite.TestSuite): def ListTests(self, context): tests = [] for dirname, dirs, files in os.walk(self.root): @@ -21,15 +18,18 @@ class WasmSpecTestsTestSuite(testsuite.TestSuite): fullpath = os.path.join(dirname, filename) relpath = fullpath[len(self.root) + 1 : -3] testname = relpath.replace(os.path.sep, "/") - test = testcase.TestCase(self, testname) + test = self._create_test(testname) tests.append(test) return tests - def GetParametersForTestCase(self, testcase, context): - flags = testcase.flags + context.mode_flags - files = [os.path.join(self.root, testcase.path + self.suffix())] - return files, flags, {} + def _test_class(self): + return TestCase + + +class TestCase(testcase.TestCase): + def _get_files_params(self, ctx): + return [os.path.join(self.suite.root, self.path + self._get_suffix())] def GetSuite(name, root): - return WasmSpecTestsTestSuite(name, root) + return TestSuite(name, root) 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 a0f2e20e1f..6fc33c12e2 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 @@ -4ca2075a2ceb1c7b6e4d7b2d26d23fdb9998fd56
\ No newline at end of file +310ca173c041a53775a713ac948c3627ae357f8d
\ No newline at end of file diff --git a/deps/v8/test/webkit/date-constructor-expected.txt b/deps/v8/test/webkit/date-constructor-expected.txt index 366a39de8d..3ad2cb0f79 100644 --- a/deps/v8/test/webkit/date-constructor-expected.txt +++ b/deps/v8/test/webkit/date-constructor-expected.txt @@ -27,37 +27,36 @@ On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE PASS isNaN(new Date("")) is true -PASS new Date(1111).getTime() is 1111 -PASS new Date(object).getTime() is 1111 -PASS new Date(new Date(1111)).getTime() is 1111 -PASS new Date(new Date(1111).toString()).getTime() is 1000 -PASS new Date(1111, 1).getTime() - timeZoneOffset is -27104803200000 -PASS new Date(1111, 1, 1).getTime() - timeZoneOffset is -27104803200000 -PASS new Date(1111, 1, 1, 1).getTime() - timeZoneOffset is -27104799600000 -PASS new Date(1111, 1, 1, 1, 1).getTime() - timeZoneOffset is -27104799540000 -PASS new Date(1111, 1, 1, 1, 1, 1).getTime() - timeZoneOffset is -27104799539000 -PASS new Date(1111, 1, 1, 1, 1, 1, 1).getTime() - timeZoneOffset is -27104799538999 -PASS new Date(1111, 1, 1, 1, 1, 1, 1, 1).getTime() - timeZoneOffset is -27104799538999 -PASS new Date(1111, 1, 1, 1, 1, 1, 1, 1, 1).getTime() - timeZoneOffset is -27104799538999 -PASS new Date(1111, 1, 1, 1, 1, 1, 1, 1, 1).getTime() - timeZoneOffset is -27104799538999 -PASS new Date(new Date(1111, 1)).getTime() - timeZoneOffset is -27104803200000 -PASS new Date(new Date(1111, 1, 1)).getTime() - timeZoneOffset is -27104803200000 -PASS new Date(new Date(1111, 1, 1, 1)).getTime() - timeZoneOffset is -27104799600000 -PASS new Date(new Date(1111, 1, 1, 1, 1, 1)).getTime() - timeZoneOffset is -27104799539000 -PASS new Date(new Date(1111, 1, 1, 1, 1, 1, 1)).getTime() - timeZoneOffset is -27104799538999 -PASS new Date(new Date(1111, 1, 1, 1, 1, 1, 1, 1)).getTime() - timeZoneOffset is -27104799538999 -PASS new Date(new Date(1111, 1, 1, 1, 1, 1, 1, 1, 1)).getTime() - timeZoneOffset is -27104799538999 +PASS new Date(1995).getTime() is 1995 +PASS new Date(object).getTime() is 1995 +PASS new Date(new Date(1995)).getTime() is 1995 +PASS new Date(new Date(1995).toString()).getTime() is 1000 +PASS new Date(1995, 1).getTime() - timeZoneOffset is 791596800000 +PASS new Date(1995, 1, 1).getTime() - timeZoneOffset is 791596800000 +PASS new Date(1995, 1, 1, 1).getTime() - timeZoneOffset is 791600400000 +PASS new Date(1995, 1, 1, 1, 1).getTime() - timeZoneOffset is 791600460000 +PASS new Date(1995, 1, 1, 1, 1, 1).getTime() - timeZoneOffset is 791600461000 +PASS new Date(1995, 1, 1, 1, 1, 1, 1).getTime() - timeZoneOffset is 791600461001 +PASS new Date(1995, 1, 1, 1, 1, 1, 1, 1).getTime() - timeZoneOffset is 791600461001 +PASS new Date(1995, 1, 1, 1, 1, 1, 1, 1, 1).getTime() - timeZoneOffset is 791600461001 +PASS new Date(new Date(1995, 1)).getTime() - timeZoneOffset is 791596800000 +PASS new Date(new Date(1995, 1, 1)).getTime() - timeZoneOffset is 791596800000 +PASS new Date(new Date(1995, 1, 1, 1)).getTime() - timeZoneOffset is 791600400000 +PASS new Date(new Date(1995, 1, 1, 1, 1)).getTime() - timeZoneOffset is 791600460000 +PASS new Date(new Date(1995, 1, 1, 1, 1, 1)).getTime() - timeZoneOffset is 791600461000 +PASS new Date(new Date(1995, 1, 1, 1, 1, 1, 1)).getTime() - timeZoneOffset is 791600461001 +PASS new Date(new Date(1995, 1, 1, 1, 1, 1, 1, 1)).getTime() - timeZoneOffset is 791600461001 +PASS new Date(new Date(1995, 1, 1, 1, 1, 1, 1, 1, 1)).getTime() - timeZoneOffset is 791600461001 PASS Number(new Date(new Date(Infinity, 1, 1, 1, 1, 1, 1, 1, 1)).getTime() - timeZoneOffset) is Number.NaN -PASS Number(new Date(new Date(1, Infinity, 1, 1, 1, 1, 1, 1, 1)).getTime() - timeZoneOffset) is Number.NaN -PASS Number(new Date(new Date(1, 1, Infinity, 1, 1, 1, 1, 1, 1)).getTime() - timeZoneOffset) is Number.NaN -PASS Number(new Date(new Date(1, 1, 1, Infinity, 1, 1, 1, 1, 1)).getTime() - timeZoneOffset) is Number.NaN -PASS Number(new Date(new Date(1, 1, 1, 1, Infinity, 1, 1, 1, 1)).getTime() - timeZoneOffset) is Number.NaN -PASS Number(new Date(new Date(1, 1, 1, 1, 1, Infinity, 1, 1, 1)).getTime() - timeZoneOffset) is Number.NaN -PASS Number(new Date(new Date(1, 1, 1, 1, 1, 1, Infinity, 1, 1)).getTime() - timeZoneOffset) is Number.NaN -PASS Number(new Date(new Date(1, 1, 1, 1, 1, 1, 1, 1, Infinity)).getTime() - timeZoneOffset) is -2174770738999 +PASS Number(new Date(new Date(95, Infinity, 1, 1, 1, 1, 1, 1, 1)).getTime() - timeZoneOffset) is Number.NaN +PASS Number(new Date(new Date(95, 1, Infinity, 1, 1, 1, 1, 1, 1)).getTime() - timeZoneOffset) is Number.NaN +PASS Number(new Date(new Date(95, 1, 1, Infinity, 1, 1, 1, 1, 1)).getTime() - timeZoneOffset) is Number.NaN +PASS Number(new Date(new Date(95, 1, 1, 1, Infinity, 1, 1, 1, 1)).getTime() - timeZoneOffset) is Number.NaN +PASS Number(new Date(new Date(95, 1, 1, 1, 1, Infinity, 1, 1, 1)).getTime() - timeZoneOffset) is Number.NaN +PASS Number(new Date(new Date(95, 1, 1, 1, 1, 1, Infinity, 1, 1)).getTime() - timeZoneOffset) is Number.NaN +PASS Number(new Date(new Date(95, 1, 1, 1, 1, 1, 1, 1, Infinity)).getTime() - timeZoneOffset) is 791600461001 PASS testStr is "1234567" PASS testStr is "1234567" PASS successfullyParsed is true TEST COMPLETE - diff --git a/deps/v8/test/webkit/date-constructor.js b/deps/v8/test/webkit/date-constructor.js index e96d970193..ff37d0b9d1 100644 --- a/deps/v8/test/webkit/date-constructor.js +++ b/deps/v8/test/webkit/date-constructor.js @@ -28,44 +28,44 @@ description( ); var object = new Object; -object.valueOf = function() { return 1111; } +object.valueOf = function() { return 1995; } object.toString = function() { return "2222"; } shouldBe('isNaN(new Date(""))', 'true'); -var timeZoneOffset = Date.parse("Dec 25 1995") - Date.parse("Dec 25 1995 GMT"); +var timeZoneOffset = Date.parse("Feb 1 1995") - Date.parse("Feb 1 1995 GMT"); -shouldBe('new Date(1111).getTime()', '1111'); -shouldBe('new Date(object).getTime()', '1111'); -shouldBe('new Date(new Date(1111)).getTime()', '1111'); -shouldBe('new Date(new Date(1111).toString()).getTime()', '1000'); +shouldBe('new Date(1995).getTime()', '1995'); +shouldBe('new Date(object).getTime()', '1995'); +shouldBe('new Date(new Date(1995)).getTime()', '1995'); +shouldBe('new Date(new Date(1995).toString()).getTime()', '1000'); -shouldBe('new Date(1111, 1).getTime() - timeZoneOffset', '-27104803200000'); -shouldBe('new Date(1111, 1, 1).getTime() - timeZoneOffset', '-27104803200000'); -shouldBe('new Date(1111, 1, 1, 1).getTime() - timeZoneOffset', '-27104799600000'); -shouldBe('new Date(1111, 1, 1, 1, 1).getTime() - timeZoneOffset', '-27104799540000'); -shouldBe('new Date(1111, 1, 1, 1, 1, 1).getTime() - timeZoneOffset', '-27104799539000'); -shouldBe('new Date(1111, 1, 1, 1, 1, 1, 1).getTime() - timeZoneOffset', '-27104799538999'); -shouldBe('new Date(1111, 1, 1, 1, 1, 1, 1, 1).getTime() - timeZoneOffset', '-27104799538999'); -shouldBe('new Date(1111, 1, 1, 1, 1, 1, 1, 1, 1).getTime() - timeZoneOffset', '-27104799538999'); -shouldBe('new Date(1111, 1, 1, 1, 1, 1, 1, 1, 1).getTime() - timeZoneOffset', '-27104799538999'); +shouldBe('new Date(1995, 1).getTime() - timeZoneOffset', '791596800000'); +shouldBe('new Date(1995, 1, 1).getTime() - timeZoneOffset', '791596800000'); +shouldBe('new Date(1995, 1, 1, 1).getTime() - timeZoneOffset', '791600400000'); +shouldBe('new Date(1995, 1, 1, 1, 1).getTime() - timeZoneOffset', '791600460000'); +shouldBe('new Date(1995, 1, 1, 1, 1, 1).getTime() - timeZoneOffset', '791600461000'); +shouldBe('new Date(1995, 1, 1, 1, 1, 1, 1).getTime() - timeZoneOffset', '791600461001'); +shouldBe('new Date(1995, 1, 1, 1, 1, 1, 1, 1).getTime() - timeZoneOffset', '791600461001'); +shouldBe('new Date(1995, 1, 1, 1, 1, 1, 1, 1, 1).getTime() - timeZoneOffset', '791600461001'); -shouldBe('new Date(new Date(1111, 1)).getTime() - timeZoneOffset', '-27104803200000'); -shouldBe('new Date(new Date(1111, 1, 1)).getTime() - timeZoneOffset', '-27104803200000'); -shouldBe('new Date(new Date(1111, 1, 1, 1)).getTime() - timeZoneOffset', '-27104799600000'); -shouldBe('new Date(new Date(1111, 1, 1, 1, 1, 1)).getTime() - timeZoneOffset', '-27104799539000'); -shouldBe('new Date(new Date(1111, 1, 1, 1, 1, 1, 1)).getTime() - timeZoneOffset', '-27104799538999'); -shouldBe('new Date(new Date(1111, 1, 1, 1, 1, 1, 1, 1)).getTime() - timeZoneOffset', '-27104799538999'); -shouldBe('new Date(new Date(1111, 1, 1, 1, 1, 1, 1, 1, 1)).getTime() - timeZoneOffset', '-27104799538999'); +shouldBe('new Date(new Date(1995, 1)).getTime() - timeZoneOffset', '791596800000'); +shouldBe('new Date(new Date(1995, 1, 1)).getTime() - timeZoneOffset', '791596800000'); +shouldBe('new Date(new Date(1995, 1, 1, 1)).getTime() - timeZoneOffset', '791600400000'); +shouldBe('new Date(new Date(1995, 1, 1, 1, 1)).getTime() - timeZoneOffset', '791600460000'); +shouldBe('new Date(new Date(1995, 1, 1, 1, 1, 1)).getTime() - timeZoneOffset', '791600461000'); +shouldBe('new Date(new Date(1995, 1, 1, 1, 1, 1, 1)).getTime() - timeZoneOffset', '791600461001'); +shouldBe('new Date(new Date(1995, 1, 1, 1, 1, 1, 1, 1)).getTime() - timeZoneOffset', '791600461001'); +shouldBe('new Date(new Date(1995, 1, 1, 1, 1, 1, 1, 1, 1)).getTime() - timeZoneOffset', '791600461001'); shouldBe("Number(new Date(new Date(Infinity, 1, 1, 1, 1, 1, 1, 1, 1)).getTime() - timeZoneOffset)", 'Number.NaN'); -shouldBe("Number(new Date(new Date(1, Infinity, 1, 1, 1, 1, 1, 1, 1)).getTime() - timeZoneOffset)", 'Number.NaN'); -shouldBe("Number(new Date(new Date(1, 1, Infinity, 1, 1, 1, 1, 1, 1)).getTime() - timeZoneOffset)", 'Number.NaN'); -shouldBe("Number(new Date(new Date(1, 1, 1, Infinity, 1, 1, 1, 1, 1)).getTime() - timeZoneOffset)", 'Number.NaN'); -shouldBe("Number(new Date(new Date(1, 1, 1, 1, Infinity, 1, 1, 1, 1)).getTime() - timeZoneOffset)", 'Number.NaN'); -shouldBe("Number(new Date(new Date(1, 1, 1, 1, 1, Infinity, 1, 1, 1)).getTime() - timeZoneOffset)", 'Number.NaN'); -shouldBe("Number(new Date(new Date(1, 1, 1, 1, 1, 1, Infinity, 1, 1)).getTime() - timeZoneOffset)", 'Number.NaN'); -shouldBe("Number(new Date(new Date(1, 1, 1, 1, 1, 1, 1, 1, Infinity)).getTime() - timeZoneOffset)", '-2174770738999'); +shouldBe("Number(new Date(new Date(95, Infinity, 1, 1, 1, 1, 1, 1, 1)).getTime() - timeZoneOffset)", 'Number.NaN'); +shouldBe("Number(new Date(new Date(95, 1, Infinity, 1, 1, 1, 1, 1, 1)).getTime() - timeZoneOffset)", 'Number.NaN'); +shouldBe("Number(new Date(new Date(95, 1, 1, Infinity, 1, 1, 1, 1, 1)).getTime() - timeZoneOffset)", 'Number.NaN'); +shouldBe("Number(new Date(new Date(95, 1, 1, 1, Infinity, 1, 1, 1, 1)).getTime() - timeZoneOffset)", 'Number.NaN'); +shouldBe("Number(new Date(new Date(95, 1, 1, 1, 1, Infinity, 1, 1, 1)).getTime() - timeZoneOffset)", 'Number.NaN'); +shouldBe("Number(new Date(new Date(95, 1, 1, 1, 1, 1, Infinity, 1, 1)).getTime() - timeZoneOffset)", 'Number.NaN'); +shouldBe("Number(new Date(new Date(95, 1, 1, 1, 1, 1, 1, 1, Infinity)).getTime() - timeZoneOffset)", '791600461001'); // In Firefox, the results of the following tests are timezone-dependent, which likely implies that the implementation is not quite correct. // Our results are even worse, though, as the dates are clipped: (new Date(1111, 1201).getTime()) == (new Date(1111, 601).getTime()) diff --git a/deps/v8/test/webkit/testcfg.py b/deps/v8/test/webkit/testcfg.py index 855a1327ba..bd0149ffbc 100644 --- a/deps/v8/test/webkit/testcfg.py +++ b/deps/v8/test/webkit/testcfg.py @@ -25,24 +25,19 @@ # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -import itertools import os import re from testrunner.local import testsuite from testrunner.objects import testcase +from testrunner.outproc import webkit -FLAGS_PATTERN = re.compile(r"//\s+Flags:(.*)") FILES_PATTERN = re.compile(r"//\s+Files:(.*)") SELF_SCRIPT_PATTERN = re.compile(r"//\s+Env: TEST_FILE_NAME") # TODO (machenbach): Share commonalities with mjstest. -class WebkitTestSuite(testsuite.TestSuite): - - def __init__(self, name, root): - super(WebkitTestSuite, self).__init__(name, root) - +class TestSuite(testsuite.TestSuite): def ListTests(self, context): tests = [] for dirname, dirs, files in os.walk(self.root): @@ -58,17 +53,23 @@ class WebkitTestSuite(testsuite.TestSuite): fullpath = os.path.join(dirname, filename) relpath = fullpath[len(self.root) + 1 : -3] testname = relpath.replace(os.path.sep, "/") - test = testcase.TestCase(self, testname) + test = self._create_test(testname) tests.append(test) return tests - def GetParametersForTestCase(self, testcase, context): - source = self.GetSourceForTest(testcase) - flags = testcase.flags + context.mode_flags - flags_match = re.findall(FLAGS_PATTERN, source) - for match in flags_match: - flags += match.strip().split() + def _test_class(self): + return TestCase + + +class TestCase(testcase.TestCase): + def __init__(self, *args, **kwargs): + super(TestCase, self).__init__(*args, **kwargs) + + source = self.get_source() + self._source_files = self._parse_source_files(source) + self._source_flags = self._parse_source_flags(source) + def _parse_source_files(self, source): files_list = [] # List of file names to append to command arguments. files_match = FILES_PATTERN.search(source); # Accept several lines of 'Files:'. @@ -78,82 +79,35 @@ class WebkitTestSuite(testsuite.TestSuite): files_match = FILES_PATTERN.search(source, files_match.end()) else: break - files = [ os.path.normpath(os.path.join(self.root, '..', '..', f)) + files = [ os.path.normpath(os.path.join(self.suite.root, '..', '..', f)) for f in files_list ] - testfilename = os.path.join(self.root, testcase.path + self.suffix()) + testfilename = os.path.join(self.suite.root, self.path + self._get_suffix()) if SELF_SCRIPT_PATTERN.search(source): env = ["-e", "TEST_FILE_NAME=\"%s\"" % testfilename.replace("\\", "\\\\")] files = env + files - files.append(os.path.join(self.root, "resources/standalone-pre.js")) + files.append(os.path.join(self.suite.root, "resources/standalone-pre.js")) files.append(testfilename) - files.append(os.path.join(self.root, "resources/standalone-post.js")) - - all_files = list(files) - if context.isolates: - all_files += ["--isolate"] + files - - return all_files, flags, {} - - def GetSourceForTest(self, testcase): - filename = os.path.join(self.root, testcase.path + self.suffix()) - with open(filename) as f: - return f.read() - - # TODO(machenbach): Share with test/message/testcfg.py - def _IgnoreLine(self, string): - """Ignore empty lines, valgrind output, Android output and trace - incremental marking output.""" - if not string: return True - return (string.startswith("==") or string.startswith("**") or - string.startswith("ANDROID") or "[IncrementalMarking]" in string or - # FIXME(machenbach): The test driver shouldn't try to use slow - # asserts if they weren't compiled. This fails in optdebug=2. - string == "Warning: unknown flag --enable-slow-asserts." or - string == "Try --help for options") - - def IsFailureOutput(self, testcase): - if super(WebkitTestSuite, self).IsFailureOutput(testcase): - return True - file_name = os.path.join(self.root, testcase.path) + "-expected.txt" - with file(file_name, "r") as expected: - expected_lines = expected.readlines() - - def ExpIterator(): - for line in expected_lines: - if line.startswith("#") or not line.strip(): continue - yield line.strip() - - def ActIterator(lines): - for line in lines: - if self._IgnoreLine(line.strip()): continue - yield line.strip() - - def ActBlockIterator(): - """Iterates over blocks of actual output lines.""" - lines = testcase.output.stdout.splitlines() - start_index = 0 - found_eqeq = False - for index, line in enumerate(lines): - # If a stress test separator is found: - if line.startswith("=="): - # Iterate over all lines before a separator except the first. - if not found_eqeq: - found_eqeq = True - else: - yield ActIterator(lines[start_index:index]) - # The next block of output lines starts after the separator. - start_index = index + 1 - # Iterate over complete output if no separator was found. - if not found_eqeq: - yield ActIterator(lines) - - for act_iterator in ActBlockIterator(): - for (expected, actual) in itertools.izip_longest( - ExpIterator(), act_iterator, fillvalue=''): - if expected != actual: - return True - return False + files.append(os.path.join(self.suite.root, "resources/standalone-post.js")) + return files + + def _get_files_params(self, ctx): + files = self._source_files + if ctx.isolates: + files = files + ['--isolate'] + files + return files + + def _get_source_flags(self): + return self._source_flags + + def _get_source_path(self): + return os.path.join(self.suite.root, self.path + self._get_suffix()) + + @property + def output_proc(self): + return webkit.OutProc( + self.expected_outcomes, + os.path.join(self.suite.root, self.path) + '-expected.txt') def GetSuite(name, root): - return WebkitTestSuite(name, root) + return TestSuite(name, root) |