diff --git a/common.gypi b/common.gypi index b1d87780db54c3..0dcf428002c4c7 100644 --- a/common.gypi +++ b/common.gypi @@ -36,7 +36,7 @@ # Reset this number to 0 on major V8 upgrades. # Increment by one for each non-official patch applied to deps/v8. - 'v8_embedder_string': '-node.12', + 'v8_embedder_string': '-node.3', ##### V8 defaults for Node.js ##### diff --git a/deps/v8/.git-blame-ignore-revs b/deps/v8/.git-blame-ignore-revs index 4c53e208e3acec..29372f34c1813d 100644 --- a/deps/v8/.git-blame-ignore-revs +++ b/deps/v8/.git-blame-ignore-revs @@ -18,11 +18,106 @@ # - Because you must use a hash, you need to append to this list in a follow-up # CL to the actual reformatting CL that you are trying to ignore. +# objects.h splitting +0604031eb1d01c52b6c1c9ae3012d80b23d74a68 +09e405453359000d66cc0faaa102854e626bebeb +766ef168fbcac6bd0728cc2c9bb3ae7cbd74278a +b5a2839b927be04bdb50a236071c11764e4d6400 +c911f91b5b6219e038c0117b05a8375bdf3db0b0 +1bb48bf91ba8c887884a0fbd674c91f64964d8a5 +19da9f24df7b59fec72b9dd8a979ad0ce5639c87 +b090d7e7468236ffce0afdb55bb496bf0073f2ee +f40638d148b7a435522d5b714993908061e3b10d +e8a1c25f6afae9b77921abb70fad49da252eb6f0 +6fa8283d0e031c9585d190f751907ed45bf85de0 +9aa861c4bcfed612039259f93c2cd2b01337e99e +8175648018bd9f70af866f9fa433f1d79644d86b +c7b1ceb801ec7f639a093468d8e6424212cc197c +e39d2cbe1b1baa6513ddce2d73c981e335cc34fb +eda00a5c499b7a83479115eb275a816b8a2ed104 +68deca9b418976ca8b3375e81058a9e0a815357f +0525e17847f39f80e3fd163021a58f68d8fcaf06 +81a3c699d6eef936452ac3d10c7c59a2c1e38c0c +01452bedfca2b5447a7f62bda87edbbb76259a6e +1baf1050113a5418696839c273e05ea5ad1b5c4d +4b39fe3d608916b1cfea015de287511a1623fc7f +c6effdbba9b301244475553538f6eb1b3d9670b9 +71e4c573199466ea4541e3d6b307c9b33d7bb785 +efc92f0d4aa77bb90f5b56606b6f0d0819fba4af +a9db2c74b5bae2345ac52be404748954a3b5050d +0a01b6202226bbe99c0b83acf6c5a80344f5fb6a +a6c44361c8f2dc07b935e3f2bb3e0d3ad4f4a383 +10d8aab1de430695a69e9d75af6ea42c2cdc9d6d +dd3c4fca2f0a2761b8b95cd47fcd62836d714890 +e9c932233980866074025e65051003d1f298516c +2b1f79881c3f0b69bfb9274bda57ea50f7304982 +7f031160d71a3d836667dc98288eaff4c94e6f56 +490fabb4578f8a3c4096fdccff688c17ed5ed00d +d953b2ab726acca0b3abe90ce090a16d7ccc2ae3 +bb514c426b9438cfb1149d219ac4ec2d8d1c8458 +dfb453d713d8a05e76f720a6aae2871eec210276 +b490fd66b873c89fca37b21eab58502b6367a864 +9a71683d9c8ff9470eda6be5b2b11babac7b9863 +37945f731c4d800ef788e3c32f8663773a93450e +b90c98fc29a8d896354de4a22c055f6d98376171 +35f3e9d0e654e84646a0b98f29e4a2786cdca4b1 +260eb5bb9b62ea3d5fa6ad0b0e8c2de75d48bad4 +cc2c11441ce352360acce8638a19f58edf361f7d +7be0159e4b1e0b064e215ae4ced34d649cb2552e +95a7cfe0eaabbcff0f730ed60e1805779f6cfe41 +8f54d18ba4ad10770e9537a2803459feccfe79a3 +f44759d9ff52a3e5563e5f2bb23ee2c08222fcfd +09050c8a967f5f2956305e5d016b304d7bf5e669 +c769745d5856a7eb3a0dbe6af5376c7638944364 +a1547aa914aeedd7862f74124c18d2bbaf432c36 +5f950698c0dc7c36b855961feb929022f74102fb +4aedeb1bd50c12ebcd6cf954c4cbef1205fff5ac +7366d8954cb1bd277d3283241da2fae62b886c48 +bc35251f5e55a65c3a4acf7cba52cee505c86a46 +4fb60b215801db70c694a799e735b64bfead59bb +03762b8488de0e393077e3f40fe7b63e675b3af3 +a8a45d875f0a98b192cf0063ceda12aaf75ddfaf +a48e5ab8804e9e97b5ea577d6f2667bacee92eb2 + # Update of quotations in DEPS file. e50b49a0e38b34e2b28e026f4d1c7e0da0c7bb1a # Rewrite code base to use "." instead of "->" to access Object members. 878ccb33bd3cf0e6dc018ff8d15843f585ac07be +# Splitting src/ into subfolders +632239011db501e76475d82ff6492f37fa8c1edc +f455f86d899716df3b9550950ce172f5b867619a +24a51e1eee4e286165dd0bba6afb4c35e8177a25 +f9a88acbc928f0fc5e9a3acbcd3b4ece52355f3d +dec3298d9cfbe95759774a0e00302a08836b5f3d +a0c3797461810e3159662851e64946e17654236e +b72941e8b0d2843adf768442024d8950da798db1 +4c986c625f19e35c95f3492c662822f4695218b4 +0fa243af7096ee5b748b194476be2e4efecaec59 +786ce26341b7ab11b4d42f1c77202530d5138ad2 +a6eeea35cb7ff0c29b6cfdd1c786f382110241ce +be014256adea1552d4a044ef80616cdab6a7d549 +93d3b7173fec7d010539057cdbd78d497f09fa9b +5bfe84a0dab60289b3470c080908ce83ac2212d4 +a7695520556665ba73ab02c497ab73b162a5fb13 +61523c45a335fe3be76498e0b16bf8e7aec0d058 +bf372a73d8a5f4029fc9f4f69b675ef0cad80ada +8ad6b335376c6275ffb3361c662a1a45c853f4fc +06bf8261cf2c94fc071652652600b5790f719c05 +81a0102fe8586071cc68e9595b26c5c1207ee5b3 +5f28539599f6a6a265e18b8c897cc96ccbeec9c4 +3253767622a784866dc34aeb7b5d0f02ebdff61e +9ac8b20086f95f1158a1901eefe12e25fd0333e4 +3cb560adfe26edb586a0e6e655e5a7c4755cad1a +7bbd0bfe5161d57bcf268716ce4d1ce14d6786e6 +c39cabbcbea26891558b81fd2236c38a7aeada08 +a3187716d31a0ab9d7051adde6be9bd2b2c6fec1 + # Move test/mjsunit/regress-*.js => test/mjsunit/regress/ cb67be1a3842fcf6a0da18aee444e3b7ea789e04 + +# [include] Split out v8.h +d1b27019d3bf86360ea838c317f8505fac6d3a7e +44fe02ced6e4c6b49d627807e3b3fd0edbbeb36e +ec06bb6ce5641cf65e400ec55b7421f87d04b999 diff --git a/deps/v8/.gitignore b/deps/v8/.gitignore index f1bd2f33fe771a..ed10b522706058 100644 --- a/deps/v8/.gitignore +++ b/deps/v8/.gitignore @@ -28,6 +28,7 @@ .clangd .cpplint-cache .cproject +.DS_Store .gclient_entries .gdb_history .idea @@ -67,6 +68,7 @@ /third_party/jsoncpp/source !/third_party/colorama /third_party/colorama/src +!/third_party/glibc !/third_party/googletest /third_party/googletest/src/* !/third_party/googletest/src/googletest @@ -79,6 +81,7 @@ !/third_party/test262-harness !/third_party/v8 !/third_party/wasm-api +/tools/builtins-pgo/profiles/*.profile /tools/clang /tools/gcmole/bootstrap /tools/gcmole/gcmole-tools diff --git a/deps/v8/.style.yapf b/deps/v8/.style.yapf index de0c6a70f38b94..fdd07237cbe373 100644 --- a/deps/v8/.style.yapf +++ b/deps/v8/.style.yapf @@ -1,2 +1,2 @@ [style] -based_on_style = chromium +based_on_style = yapf diff --git a/deps/v8/AUTHORS b/deps/v8/AUTHORS index c9d4c6eb4c651e..d84c722b8dcb7b 100644 --- a/deps/v8/AUTHORS +++ b/deps/v8/AUTHORS @@ -44,6 +44,7 @@ CodeWeavers, Inc. <*@codeweavers.com> Alibaba, Inc. <*@alibaba-inc.com> SiFive, Inc. <*@sifive.com> +Aapo Alasuutari Aaron Bieber Aaron O'Mullan Abdulla Kamar @@ -81,6 +82,7 @@ Burcu Dogan Caitlin Potter Chao Wang Charles Kerr +Cheng Zhao Chengzhong Wu Choongwoo Han Chris Nardi @@ -153,6 +155,8 @@ Jiawen Geng Jiaxun Yang Joel Stanley Johan Bergström +Johan Levin +John Paul Adrian Glaubitz Jonathan Liu Juan Arboleda Julien Brianceau @@ -256,6 +260,7 @@ Ujjwal Sharma Vadim Gorbachev Varun Varada Victor Costan +Victor Polevoy Vlad Burlik Vladimir Krivosheev Vladimir Shutoff @@ -286,3 +291,5 @@ Zheng Liu Zhongping Wang 柳荣一 Yang Xiang +Kotaro Ohsugi +Jing Peiyang diff --git a/deps/v8/BUILD.bazel b/deps/v8/BUILD.bazel index 3be7da8f3bb11f..81a9286d2670de 100644 --- a/deps/v8/BUILD.bazel +++ b/deps/v8/BUILD.bazel @@ -16,7 +16,8 @@ load( "v8_library", "v8_mksnapshot", "v8_string", - "v8_torque", + "v8_torque_definitions", + "v8_torque_initializers", ) load(":bazel/v8-non-pointer-compression.bzl", "v8_binary_non_pointer_compression") @@ -42,6 +43,7 @@ load(":bazel/v8-non-pointer-compression.bzl", "v8_binary_non_pointer_compression # v8_enable_conservative_stack_scanning # v8_enable_concurrent_marking # v8_enable_ignition_dispatch_counting +# v8_enable_builtins_optimization # v8_enable_builtins_profiling # v8_enable_builtins_profiling_verbose # v8_builtins_profiling_log_file @@ -68,6 +70,7 @@ load(":bazel/v8-non-pointer-compression.bzl", "v8_binary_non_pointer_compression # v8_enable_sandbox # cppgc_enable_caged_heap # cppgc_enable_check_assignments_in_prefinalizers +# cppgc_enable_slim_write_barrier # cppgc_enable_object_names # cppgc_enable_pointer_compression # cppgc_enable_verify_heap @@ -132,6 +135,8 @@ v8_flag(name = "v8_enable_snapshot_code_comments") v8_flag(name = "v8_enable_snapshot_native_code_counters") +v8_flag(name = "v8_enable_static_roots") + v8_flag(name = "v8_enable_trace_maps") v8_flag(name = "v8_enable_v8_checks") @@ -144,11 +149,21 @@ v8_flag(name = "v8_enable_verify_predictable") v8_flag(name = "v8_enable_test_features") +v8_flag( + name = "v8_enable_turbofan", + default = True, +) + v8_flag( name = "v8_enable_webassembly", default = True, ) +v8_flag( + name = "v8_jitless", + default = False, +) + v8_int( name = "v8_typed_array_max_size_in_heap", default = 64, @@ -316,16 +331,18 @@ v8_config( "v8_enable_slow_dchecks": "ENABLE_SLOW_DCHECKS", "v8_enable_runtime_call_stats": "V8_RUNTIME_CALL_STATS", "v8_enable_snapshot_native_code_counters": "V8_SNAPSHOT_NATIVE_CODE_COUNTERS", + "v8_enable_static_roots": "V8_STATIC_ROOTS", "v8_enable_trace_maps": "V8_TRACE_MAPS", + "v8_enable_turbofan": "V8_ENABLE_TURBOFAN", "v8_enable_v8_checks": "V8_ENABLE_CHECKS", "v8_enable_verify_csa": "ENABLE_VERIFY_CSA", "v8_enable_verify_heap": "VERIFY_HEAP", "v8_enable_verify_predictable": "VERIFY_PREDICTABLE", "v8_enable_webassembly": "V8_ENABLE_WEBASSEMBLY", + "v8_jitless": "V8_JITLESS", }, defines = [ "GOOGLE3", - "ENABLE_DEBUGGER_SUPPORT", "V8_ADVANCED_BIGINT_ALGORITHMS", "V8_CONCURRENT_MARKING", ] + select({ @@ -595,6 +612,7 @@ filegroup( "src/base/build_config.h", "src/base/compiler-specific.h", "src/base/container-utils.h", + "src/base/contextual.h", "src/base/cpu.cc", "src/base/cpu.h", "src/base/debug/stack_trace.cc", @@ -653,6 +671,7 @@ filegroup( "src/base/platform/mutex.cc", "src/base/platform/mutex.h", "src/base/platform/platform.h", + "src/base/platform/platform.cc", "src/base/platform/semaphore.cc", "src/base/platform/semaphore.h", "src/base/platform/time.cc", @@ -706,7 +725,6 @@ filegroup( "@v8//bazel/config:is_macos": [ "src/base/debug/stack_trace_posix.cc", "src/base/platform/platform-darwin.cc", - "src/base/platform/platform-macos.cc", ], "@v8//bazel/config:is_windows": [ "src/base/win32-headers.h", @@ -816,6 +834,8 @@ filegroup( "src/builtins/internal-coverage.tq", "src/builtins/internal.tq", "src/builtins/iterator.tq", + "src/builtins/iterator-from.tq", + "src/builtins/iterator-helpers.tq", "src/builtins/math.tq", "src/builtins/number.tq", "src/builtins/object-fromentries.tq", @@ -859,6 +879,7 @@ filegroup( "src/builtins/string-html.tq", "src/builtins/string-includes.tq", "src/builtins/string-indexof.tq", + "src/builtins/string-iswellformed.tq", "src/builtins/string-iterator.tq", "src/builtins/string-match-search.tq", "src/builtins/string-pad.tq", @@ -868,6 +889,7 @@ filegroup( "src/builtins/string-startswith.tq", "src/builtins/string-substr.tq", "src/builtins/string-substring.tq", + "src/builtins/string-towellformed.tq", "src/builtins/string-trim.tq", "src/builtins/symbol.tq", "src/builtins/torque-internal.tq", @@ -924,6 +946,7 @@ filegroup( "src/objects/js-collection.tq", "src/objects/js-function.tq", "src/objects/js-generator.tq", + "src/objects/js-iterator-helpers.tq", "src/objects/js-objects.tq", "src/objects/js-promise.tq", "src/objects/js-proxy.tq", @@ -963,6 +986,7 @@ filegroup( "src/objects/templates.tq", "src/objects/torque-defined-classes.tq", "src/objects/turbofan-types.tq", + "src/objects/turboshaft-types.tq", "test/torque/test-torque.tq", "third_party/v8/builtins/array-sort.tq", ] + select({ @@ -1008,7 +1032,6 @@ filegroup( "src/torque/cfg.h", "src/torque/class-debug-reader-generator.cc", "src/torque/constants.h", - "src/torque/contextual.h", "src/torque/cpp-builder.cc", "src/torque/cpp-builder.h", "src/torque/csa-generator.cc", @@ -1152,7 +1175,6 @@ filegroup( "src/builtins/builtins-utils-inl.h", "src/builtins/builtins-utils.h", "src/builtins/builtins-weak-refs.cc", - "src/builtins/builtins-web-snapshots.cc", "src/builtins/builtins.cc", "src/builtins/builtins.h", "src/builtins/constants-table-builder.cc", @@ -1231,8 +1253,8 @@ filegroup( "src/codegen/tick-counter.h", "src/codegen/tnode.cc", "src/codegen/tnode.h", - "src/codegen/turbo-assembler.cc", - "src/codegen/turbo-assembler.h", + "src/codegen/macro-assembler-base.cc", + "src/codegen/macro-assembler-base.h", "src/codegen/unoptimized-compilation-info.cc", "src/codegen/unoptimized-compilation-info.h", "src/common/assert-scope.cc", @@ -1245,11 +1267,13 @@ filegroup( "src/common/message-template.h", "src/common/operation.h", "src/common/ptr-compr-inl.h", + "src/common/ptr-compr.cc", "src/common/ptr-compr.h", "src/compiler-dispatcher/lazy-compile-dispatcher.cc", "src/compiler-dispatcher/lazy-compile-dispatcher.h", "src/compiler-dispatcher/optimizing-compile-dispatcher.cc", "src/compiler-dispatcher/optimizing-compile-dispatcher.h", + "src/compiler/turbofan.h", "src/date/date.cc", "src/date/date.h", "src/date/dateparser-inl.h", @@ -1429,6 +1453,8 @@ filegroup( "src/heap/cppgc-js/cpp-marking-state-inl.h", "src/heap/cppgc-js/cpp-snapshot.cc", "src/heap/cppgc-js/cpp-snapshot.h", + "src/heap/cppgc-js/cross-heap-remembered-set.cc", + "src/heap/cppgc-js/cross-heap-remembered-set.h", "src/heap/cppgc-js/unified-heap-marking-state.cc", "src/heap/cppgc-js/unified-heap-marking-state.h", "src/heap/cppgc-js/unified-heap-marking-state-inl.h", @@ -1436,9 +1462,8 @@ filegroup( "src/heap/cppgc-js/unified-heap-marking-verifier.h", "src/heap/cppgc-js/unified-heap-marking-visitor.cc", "src/heap/cppgc-js/unified-heap-marking-visitor.h", - "src/heap/embedder-tracing.cc", - "src/heap/embedder-tracing.h", - "src/heap/embedder-tracing-inl.h", + "src/heap/cppgc-js/wrappable-info.h", + "src/heap/cppgc-js/wrappable-info-inl.h", "src/heap/evacuation-verifier.cc", "src/heap/evacuation-verifier.h", "src/heap/evacuation-verifier-inl.h", @@ -1459,8 +1484,6 @@ filegroup( "src/heap/gc-tracer.cc", "src/heap/gc-tracer-inl.h", "src/heap/gc-tracer.h", - "src/heap/global-handle-marking-visitor.cc", - "src/heap/global-handle-marking-visitor.h", "src/heap/heap-allocator-inl.h", "src/heap/heap-allocator.cc", "src/heap/heap-allocator.h", @@ -1528,6 +1551,7 @@ filegroup( "src/heap/new-spaces-inl.h", "src/heap/new-spaces.cc", "src/heap/new-spaces.h", + "src/heap/object-lock.h", "src/heap/object-stats.cc", "src/heap/object-stats.h", "src/heap/objects-visiting-inl.h", @@ -1551,8 +1575,8 @@ filegroup( "src/heap/remembered-set.h", "src/heap/safepoint.cc", "src/heap/safepoint.h", - "src/heap/scavenge-job.cc", - "src/heap/scavenge-job.h", + "src/heap/minor-gc-job.cc", + "src/heap/minor-gc-job.h", "src/heap/scavenger-inl.h", "src/heap/scavenger.cc", "src/heap/scavenger.h", @@ -1561,12 +1585,12 @@ filegroup( "src/heap/spaces-inl.h", "src/heap/spaces.cc", "src/heap/spaces.h", - "src/heap/stress-marking-observer.cc", - "src/heap/stress-marking-observer.h", "src/heap/stress-scavenge-observer.cc", "src/heap/stress-scavenge-observer.h", "src/heap/sweeper.cc", "src/heap/sweeper.h", + "src/heap/traced-handles-marking-visitor.cc", + "src/heap/traced-handles-marking-visitor.h", "src/heap/weak-object-worklists.cc", "src/heap/weak-object-worklists.h", "src/ic/call-optimization.cc", @@ -1662,6 +1686,8 @@ filegroup( "src/numbers/conversions.cc", "src/numbers/conversions.h", "src/numbers/hash-seed-inl.h", + "src/numbers/integer-literal-inl.h", + "src/numbers/integer-literal.h", "src/numbers/math-random.cc", "src/numbers/math-random.h", "src/objects/all-objects-inl.h", @@ -1758,6 +1784,8 @@ filegroup( "src/objects/js-function.h", "src/objects/js-generator-inl.h", "src/objects/js-generator.h", + "src/objects/js-iterator-helpers-inl.h", + "src/objects/js-iterator-helpers.h", "src/objects/js-objects-inl.h", "src/objects/js-objects.cc", "src/objects/js-objects.h", @@ -1777,6 +1805,7 @@ filegroup( "src/objects/js-shadow-realm-inl.h", "src/objects/js-shared-array.h", "src/objects/js-shared-array-inl.h", + "src/objects/js-struct.cc", "src/objects/js-struct.h", "src/objects/js-struct-inl.h", "src/objects/js-temporal-objects.h", @@ -1915,6 +1944,8 @@ filegroup( "src/objects/transitions.h", "src/objects/turbofan-types-inl.h", "src/objects/turbofan-types.h", + "src/objects/turboshaft-types-inl.h", + "src/objects/turboshaft-types.h", "src/objects/type-hints.cc", "src/objects/type-hints.h", "src/objects/value-serializer.cc", @@ -2031,6 +2062,7 @@ filegroup( "src/roots/roots-inl.h", "src/roots/roots.cc", "src/roots/roots.h", + "src/roots/static-roots.h", "src/runtime/runtime-array.cc", "src/runtime/runtime-atomics.cc", "src/runtime/runtime-bigint.cc", @@ -2190,8 +2222,6 @@ filegroup( "src/utils/utils.h", "src/utils/version.cc", "src/utils/version.h", - "src/web-snapshot/web-snapshot.h", - "src/web-snapshot/web-snapshot.cc", "src/zone/accounting-allocator.cc", "src/zone/accounting-allocator.h", "src/zone/compressed-zone-ptr.h", @@ -2233,10 +2263,6 @@ filegroup( "src/codegen/ia32/macro-assembler-ia32.h", "src/codegen/ia32/register-ia32.h", "src/codegen/ia32/reglist-ia32.h", - "src/compiler/backend/ia32/code-generator-ia32.cc", - "src/compiler/backend/ia32/instruction-codes-ia32.h", - "src/compiler/backend/ia32/instruction-scheduler-ia32.cc", - "src/compiler/backend/ia32/instruction-selector-ia32.cc", "src/deoptimizer/ia32/deoptimizer-ia32.cc", "src/diagnostics/ia32/disasm-ia32.cc", "src/diagnostics/ia32/unwinder-ia32.cc", @@ -2263,12 +2289,6 @@ filegroup( "src/codegen/x64/macro-assembler-x64.h", "src/codegen/x64/register-x64.h", "src/codegen/x64/reglist-x64.h", - "src/compiler/backend/x64/code-generator-x64.cc", - "src/compiler/backend/x64/instruction-codes-x64.h", - "src/compiler/backend/x64/instruction-scheduler-x64.cc", - "src/compiler/backend/x64/instruction-selector-x64.cc", - "src/compiler/backend/x64/unwinding-info-writer-x64.cc", - "src/compiler/backend/x64/unwinding-info-writer-x64.h", "src/deoptimizer/x64/deoptimizer-x64.cc", "src/diagnostics/x64/disasm-x64.cc", "src/diagnostics/x64/eh-frame-x64.cc", @@ -2293,12 +2313,6 @@ filegroup( "src/codegen/arm/macro-assembler-arm.h", "src/codegen/arm/register-arm.h", "src/codegen/arm/reglist-arm.h", - "src/compiler/backend/arm/code-generator-arm.cc", - "src/compiler/backend/arm/instruction-codes-arm.h", - "src/compiler/backend/arm/instruction-scheduler-arm.cc", - "src/compiler/backend/arm/instruction-selector-arm.cc", - "src/compiler/backend/arm/unwinding-info-writer-arm.cc", - "src/compiler/backend/arm/unwinding-info-writer-arm.h", "src/deoptimizer/arm/deoptimizer-arm.cc", "src/diagnostics/arm/disasm-arm.cc", "src/diagnostics/arm/eh-frame-arm.cc", @@ -2334,12 +2348,6 @@ filegroup( "src/codegen/arm64/reglist-arm64.h", "src/codegen/arm64/utils-arm64.cc", "src/codegen/arm64/utils-arm64.h", - "src/compiler/backend/arm64/code-generator-arm64.cc", - "src/compiler/backend/arm64/instruction-codes-arm64.h", - "src/compiler/backend/arm64/instruction-scheduler-arm64.cc", - "src/compiler/backend/arm64/instruction-selector-arm64.cc", - "src/compiler/backend/arm64/unwinding-info-writer-arm64.cc", - "src/compiler/backend/arm64/unwinding-info-writer-arm64.h", "src/deoptimizer/arm64/deoptimizer-arm64.cc", "src/diagnostics/arm64/disasm-arm64.cc", "src/diagnostics/arm64/disasm-arm64.h", @@ -2369,12 +2377,6 @@ filegroup( "src/codegen/s390/macro-assembler-s390.h", "src/codegen/s390/register-s390.h", "src/codegen/s390/reglist-s390.h", - "src/compiler/backend/s390/code-generator-s390.cc", - "src/compiler/backend/s390/instruction-codes-s390.h", - "src/compiler/backend/s390/instruction-scheduler-s390.cc", - "src/compiler/backend/s390/instruction-selector-s390.cc", - "src/compiler/backend/s390/unwinding-info-writer-s390.cc", - "src/compiler/backend/s390/unwinding-info-writer-s390.h", "src/deoptimizer/s390/deoptimizer-s390.cc", "src/diagnostics/s390/disasm-s390.cc", "src/diagnostics/s390/eh-frame-s390.cc", @@ -2401,10 +2403,6 @@ filegroup( "src/codegen/riscv64/macro-assembler-riscv64.h", "src/codegen/riscv64/register-riscv64.h", "src/codegen/riscv64/reglist-riscv64.h", - "src/compiler/backend/riscv64/code-generator-riscv64.cc", - "src/compiler/backend/riscv64/instruction-codes-riscv64.h", - "src/compiler/backend/riscv64/instruction-scheduler-riscv64.cc", - "src/compiler/backend/riscv64/instruction-selector-riscv64.cc", "src/deoptimizer/riscv64/deoptimizer-riscv64.cc", "src/diagnostics/riscv64/disasm-riscv64.cc", "src/diagnostics/riscv64/unwinder-riscv64.cc", @@ -2430,12 +2428,6 @@ filegroup( "src/codegen/ppc/macro-assembler-ppc.h", "src/codegen/ppc/register-ppc.h", "src/codegen/ppc/reglist-ppc.h", - "src/compiler/backend/ppc/code-generator-ppc.cc", - "src/compiler/backend/ppc/instruction-codes-ppc.h", - "src/compiler/backend/ppc/instruction-scheduler-ppc.cc", - "src/compiler/backend/ppc/instruction-selector-ppc.cc", - "src/compiler/backend/ppc/unwinding-info-writer-ppc.cc", - "src/compiler/backend/ppc/unwinding-info-writer-ppc.h", "src/deoptimizer/ppc/deoptimizer-ppc.cc", "src/diagnostics/ppc/disasm-ppc.cc", "src/diagnostics/ppc/eh-frame-ppc.cc", @@ -2598,6 +2590,8 @@ filegroup( "src/wasm/wasm-subtyping.h", "src/wasm/wasm-tier.h", "src/wasm/wasm-value.h", + "src/wasm/well-known-imports.cc", + "src/wasm/well-known-imports.h", ], "//conditions:default": [], }), @@ -2607,7 +2601,6 @@ filegroup( name = "icu/v8_base_without_compiler_files", srcs = [ "src/builtins/builtins-intl.cc", - "src/builtins/builtins-intl-gen.cc", "src/objects/intl-objects.cc", "src/objects/intl-objects.h", "src/objects/js-break-iterator.cc", @@ -2849,6 +2842,7 @@ filegroup( "src/compiler/osr.h", "src/compiler/per-isolate-compiler-cache.h", "src/compiler/persistent-map.h", + "src/compiler/phase.h", "src/compiler/pipeline.cc", "src/compiler/pipeline.h", "src/compiler/pipeline-statistics.cc", @@ -2881,36 +2875,91 @@ filegroup( "src/compiler/state-values-utils.cc", "src/compiler/state-values-utils.h", "src/compiler/store-store-elimination.cc", + "src/compiler/string-builder-optimizer.cc", + "src/compiler/string-builder-optimizer.h", "src/compiler/store-store-elimination.h", + "src/compiler/turbofan-enabled.cc", + "src/compiler/turbofan.h", + "src/compiler/turboshaft/assembler.cc", "src/compiler/turboshaft/assembler.h", + "src/compiler/turboshaft/assert-types-reducer.h", + "src/compiler/turboshaft/branch-elimination-reducer.h", + "src/compiler/turboshaft/build-graph-phase.cc", + "src/compiler/turboshaft/build-graph-phase.h", + "src/compiler/turboshaft/builtin-call-descriptors.h", + "src/compiler/turboshaft/dead-code-elimination-phase.cc", + "src/compiler/turboshaft/dead-code-elimination-phase.h", + "src/compiler/turboshaft/dead-code-elimination-reducer.h", "src/compiler/turboshaft/decompression-optimization.cc", "src/compiler/turboshaft/decompression-optimization.h", + "src/compiler/turboshaft/decompression-optimization-phase.cc", + "src/compiler/turboshaft/decompression-optimization-phase.h", + "src/compiler/turboshaft/define-assembler-macros.inc", "src/compiler/turboshaft/deopt-data.h", "src/compiler/turboshaft/fast-hash.h", "src/compiler/turboshaft/graph-builder.cc", "src/compiler/turboshaft/graph-builder.h", "src/compiler/turboshaft/graph.cc", "src/compiler/turboshaft/graph.h", + "src/compiler/turboshaft/index.h", "src/compiler/turboshaft/graph-visualizer.cc", "src/compiler/turboshaft/graph-visualizer.h", + "src/compiler/turboshaft/late-escape-analysis-reducer.h", + "src/compiler/turboshaft/late-escape-analysis-reducer.cc", + "src/compiler/turboshaft/late-optimization-phase.cc", + "src/compiler/turboshaft/late-optimization-phase.h", + "src/compiler/turboshaft/layered-hash-map.h", + "src/compiler/turboshaft/machine-lowering-phase.cc", + "src/compiler/turboshaft/machine-lowering-phase.h", + "src/compiler/turboshaft/machine-lowering-reducer.h", "src/compiler/turboshaft/machine-optimization-reducer.h", + "src/compiler/turboshaft/memory-optimization-reducer.cc", + "src/compiler/turboshaft/memory-optimization-reducer.h", "src/compiler/turboshaft/operations.cc", "src/compiler/turboshaft/operations.h", "src/compiler/turboshaft/operation-matching.h", "src/compiler/turboshaft/optimization-phase.cc", "src/compiler/turboshaft/optimization-phase.h", + "src/compiler/turboshaft/optimize-phase.cc", + "src/compiler/turboshaft/optimize-phase.h", + "src/compiler/turboshaft/phase.cc", + "src/compiler/turboshaft/phase.h", "src/compiler/turboshaft/recreate-schedule.cc", "src/compiler/turboshaft/recreate-schedule.h", + "src/compiler/turboshaft/recreate-schedule-phase.cc", + "src/compiler/turboshaft/recreate-schedule-phase.h", + "src/compiler/turboshaft/reducer-traits.h", "src/compiler/turboshaft/representations.cc", "src/compiler/turboshaft/representations.h", + "src/compiler/turboshaft/runtime-call-descriptors.h", "src/compiler/turboshaft/select-lowering-reducer.h", "src/compiler/turboshaft/sidetable.h", "src/compiler/turboshaft/simplify-tf-loops.cc", "src/compiler/turboshaft/simplify-tf-loops.h", "src/compiler/turboshaft/snapshot-table.h", + "src/compiler/turboshaft/tag-untag-lowering-phase.cc", + "src/compiler/turboshaft/tag-untag-lowering-phase.h", + "src/compiler/turboshaft/tag-untag-lowering-reducer.h", + "src/compiler/turboshaft/tracing.h", + "src/compiler/turboshaft/type-inference-analysis.h", + "src/compiler/turboshaft/type-inference-reducer.h", + "src/compiler/turboshaft/typer.cc", + "src/compiler/turboshaft/typer.h", + "src/compiler/turboshaft/type-assertions-phase.cc", + "src/compiler/turboshaft/type-assertions-phase.h", + "src/compiler/turboshaft/type-parser.cc", + "src/compiler/turboshaft/type-parser.h", + "src/compiler/turboshaft/typed-optimizations-phase.cc", + "src/compiler/turboshaft/typed-optimizations-phase.h", + "src/compiler/turboshaft/typed-optimizations-reducer.h", + "src/compiler/turboshaft/types.cc", + "src/compiler/turboshaft/types.h", + "src/compiler/turboshaft/undef-assembler-macros.inc", + "src/compiler/turboshaft/uniform-reducer-adapter.h", "src/compiler/turboshaft/utils.cc", "src/compiler/turboshaft/utils.h", "src/compiler/turboshaft/value-numbering-reducer.h", + "src/compiler/turboshaft/variable-reducer.h", "src/compiler/type-cache.cc", "src/compiler/type-cache.h", "src/compiler/type-narrowing-reducer.cc", @@ -2930,14 +2979,71 @@ filegroup( "src/compiler/zone-stats.cc", "src/compiler/zone-stats.h", ] + select({ + "@v8//bazel/config:v8_target_ia32": [ + "src/compiler/backend/ia32/code-generator-ia32.cc", + "src/compiler/backend/ia32/instruction-codes-ia32.h", + "src/compiler/backend/ia32/instruction-scheduler-ia32.cc", + "src/compiler/backend/ia32/instruction-selector-ia32.cc", + ], + "@v8//bazel/config:v8_target_x64": [ + "src/compiler/backend/x64/code-generator-x64.cc", + "src/compiler/backend/x64/instruction-codes-x64.h", + "src/compiler/backend/x64/instruction-scheduler-x64.cc", + "src/compiler/backend/x64/instruction-selector-x64.cc", + "src/compiler/backend/x64/unwinding-info-writer-x64.cc", + "src/compiler/backend/x64/unwinding-info-writer-x64.h", + ], + "@v8//bazel/config:v8_target_arm": [ + "src/compiler/backend/arm/code-generator-arm.cc", + "src/compiler/backend/arm/instruction-codes-arm.h", + "src/compiler/backend/arm/instruction-scheduler-arm.cc", + "src/compiler/backend/arm/instruction-selector-arm.cc", + "src/compiler/backend/arm/unwinding-info-writer-arm.cc", + "src/compiler/backend/arm/unwinding-info-writer-arm.h", + ], + "@v8//bazel/config:v8_target_arm64": [ + "src/compiler/backend/arm64/code-generator-arm64.cc", + "src/compiler/backend/arm64/instruction-codes-arm64.h", + "src/compiler/backend/arm64/instruction-scheduler-arm64.cc", + "src/compiler/backend/arm64/instruction-selector-arm64.cc", + "src/compiler/backend/arm64/unwinding-info-writer-arm64.cc", + "src/compiler/backend/arm64/unwinding-info-writer-arm64.h", + ], + "@v8//bazel/config:v8_target_s390x": [ + "src/compiler/backend/s390/code-generator-s390.cc", + "src/compiler/backend/s390/instruction-codes-s390.h", + "src/compiler/backend/s390/instruction-scheduler-s390.cc", + "src/compiler/backend/s390/instruction-selector-s390.cc", + "src/compiler/backend/s390/unwinding-info-writer-s390.cc", + "src/compiler/backend/s390/unwinding-info-writer-s390.h", + ], + "@v8//bazel/config:v8_target_riscv64": [ + "src/compiler/backend/riscv64/code-generator-riscv64.cc", + "src/compiler/backend/riscv64/instruction-codes-riscv64.h", + "src/compiler/backend/riscv64/instruction-scheduler-riscv64.cc", + "src/compiler/backend/riscv64/instruction-selector-riscv64.cc", + ], + "@v8//bazel/config:v8_target_ppc64le": [ + "src/compiler/backend/ppc/code-generator-ppc.cc", + "src/compiler/backend/ppc/instruction-codes-ppc.h", + "src/compiler/backend/ppc/instruction-scheduler-ppc.cc", + "src/compiler/backend/ppc/instruction-selector-ppc.cc", + "src/compiler/backend/ppc/unwinding-info-writer-ppc.cc", + "src/compiler/backend/ppc/unwinding-info-writer-ppc.h", + ], + }) + select({ ":is_v8_enable_webassembly": [ "src/compiler/int64-lowering.cc", "src/compiler/int64-lowering.h", + "src/compiler/wasm-call-descriptors.cc", + "src/compiler/wasm-call-descriptors.h", "src/compiler/wasm-compiler-definitions.h", "src/compiler/wasm-compiler.cc", "src/compiler/wasm-compiler.h", "src/compiler/wasm-escape-analysis.cc", "src/compiler/wasm-escape-analysis.h", + "src/compiler/wasm-load-elimination.cc", + "src/compiler/wasm-load-elimination.h", "src/compiler/wasm-loop-peeling.cc", "src/compiler/wasm-loop-peeling.h", "src/compiler/wasm-gc-lowering.cc", @@ -2948,6 +3054,8 @@ filegroup( "src/compiler/wasm-graph-assembler.h", "src/compiler/wasm-inlining.cc", "src/compiler/wasm-inlining.h", + "src/compiler/wasm-inlining-into-js.cc", + "src/compiler/wasm-inlining-into-js.h", "src/compiler/wasm-typer.cc", "src/compiler/wasm-typer.h", ], @@ -2956,7 +3064,7 @@ filegroup( ) filegroup( - name = "v8_initializers_files", + name = "noicu/v8_initializers_files", srcs = [ "src/builtins/builtins-array-gen.cc", "src/builtins/builtins-array-gen.h", @@ -2990,6 +3098,7 @@ filegroup( "src/builtins/builtins-microtask-queue-gen.cc", "src/builtins/builtins-number-gen.cc", "src/builtins/builtins-object-gen.cc", + "src/builtins/builtins-object-gen.h", "src/builtins/builtins-promise-gen.cc", "src/builtins/builtins-promise-gen.h", "src/builtins/builtins-proxy-gen.cc", @@ -3046,6 +3155,14 @@ filegroup( }), ) +filegroup( + name = "icu/v8_initializers_files", + srcs = [ + "src/builtins/builtins-intl-gen.cc", + ":noicu/v8_initializers_files", + ], +) + filegroup( name = "cppgc_base_files", srcs = [ @@ -3160,16 +3277,16 @@ filegroup( # Note these cannot be v8_target_is_* selects because these contain # inline assembly that runs inside the executable. Since these are # linked directly into mksnapshot, they must use the actual target cpu. - "@v8//bazel/config:is_inline_asm_ia32": ["src/heap/base/asm/ia32/save_registers_asm.cc"], - "@v8//bazel/config:is_inline_asm_x64": ["src/heap/base/asm/x64/save_registers_asm.cc"], - "@v8//bazel/config:is_inline_asm_arm": ["src/heap/base/asm/arm/save_registers_asm.cc"], - "@v8//bazel/config:is_inline_asm_arm64": ["src/heap/base/asm/arm64/save_registers_asm.cc"], - "@v8//bazel/config:is_inline_asm_s390x": ["src/heap/base/asm/s390/save_registers_asm.cc"], - "@v8//bazel/config:is_inline_asm_riscv64": ["src/heap/base/asm/riscv64/save_registers_asm.cc"], - "@v8//bazel/config:is_inline_asm_ppc64le": ["src/heap/base/asm/ppc/save_registers_asm.cc"], - "@v8//bazel/config:is_msvc_asm_ia32": ["src/heap/base/asm/ia32/save_registers_masm.asm"], - "@v8//bazel/config:is_msvc_asm_x64": ["src/heap/base/asm/x64/save_registers_masm.asm"], - "@v8//bazel/config:is_msvc_asm_arm64": ["src/heap/base/asm/arm64/save_registers_masm.S"], + "@v8//bazel/config:is_inline_asm_ia32": ["src/heap/base/asm/ia32/push_registers_asm.cc"], + "@v8//bazel/config:is_inline_asm_x64": ["src/heap/base/asm/x64/push_registers_asm.cc"], + "@v8//bazel/config:is_inline_asm_arm": ["src/heap/base/asm/arm/push_registers_asm.cc"], + "@v8//bazel/config:is_inline_asm_arm64": ["src/heap/base/asm/arm64/push_registers_asm.cc"], + "@v8//bazel/config:is_inline_asm_s390x": ["src/heap/base/asm/s390/push_registers_asm.cc"], + "@v8//bazel/config:is_inline_asm_riscv64": ["src/heap/base/asm/riscv64/push_registers_asm.cc"], + "@v8//bazel/config:is_inline_asm_ppc64le": ["src/heap/base/asm/ppc/push_registers_asm.cc"], + "@v8//bazel/config:is_msvc_asm_ia32": ["src/heap/base/asm/ia32/push_registers_masm.asm"], + "@v8//bazel/config:is_msvc_asm_x64": ["src/heap/base/asm/x64/push_registers_masm.asm"], + "@v8//bazel/config:is_msvc_asm_arm64": ["src/heap/base/asm/arm64/push_registers_masm.S"], }), ) @@ -3215,6 +3332,8 @@ filegroup( "src/snapshot/embedded/platform-embedded-file-writer-mac.h", "src/snapshot/embedded/platform-embedded-file-writer-win.cc", "src/snapshot/embedded/platform-embedded-file-writer-win.h", + "src/snapshot/static-roots-gen.cc", + "src/snapshot/static-roots-gen.h", "src/snapshot/mksnapshot.cc", "src/snapshot/snapshot-empty.cc", ], @@ -3223,6 +3342,8 @@ filegroup( filegroup( name = "v8_inspector_files", srcs = [ + "src/inspector/crc32.cc", + "src/inspector/crc32.h", "src/inspector/custom-preview.cc", "src/inspector/custom-preview.h", "src/inspector/injected-script.cc", @@ -3249,6 +3370,8 @@ filegroup( "src/inspector/v8-debugger.h", "src/inspector/v8-debugger-agent-impl.cc", "src/inspector/v8-debugger-agent-impl.h", + "src/inspector/v8-debugger-barrier.cc", + "src/inspector/v8-debugger-barrier.h", "src/inspector/v8-debugger-id.cc", "src/inspector/v8-debugger-id.h", "src/inspector/v8-debugger-script.cc", @@ -3374,8 +3497,8 @@ filegroup( # TODO(victorgomes): Add support to tools/debug_helper, # which needs class-debug-readers and debug-macros. -v8_torque( - name = "generated_torque_files", +v8_torque_definitions( + name = "generated_torque_definitions", args = select({ ":is_v8_annotate_torque_ir": ["-annotate-ir"], "//conditions:default": [], @@ -3391,12 +3514,8 @@ v8_torque( "class-forward-declarations.h", "class-verifiers.cc", "class-verifiers.h", - "csa-types.h", # "debug-macros.cc", # "debug-macros.h", - "enum-verifiers.cc", - "exported-macros-assembler.cc", - "exported-macros-assembler.h", "factory.cc", "factory.inc", "instance-types.h", @@ -3409,8 +3528,28 @@ v8_torque( noicu_srcs = [":noicu/torque_files"], ) +v8_torque_initializers( + name = "generated_torque_initializers", + args = select({ + ":is_v8_annotate_torque_ir": ["-annotate-ir"], + "//conditions:default": [], + }) + select({ + "@v8//bazel/config:v8_target_is_32_bits": ["-m32"], + "//conditions:default": [], + }), + extras = [ + "csa-types.h", + "enum-verifiers.cc", + "exported-macros-assembler.cc", + "exported-macros-assembler.h", + ], + icu_srcs = [":icu/torque_files"], + noicu_srcs = [":noicu/torque_files"], +) + py_binary( name = "code_generator", + python_version = "PY3", srcs = [ "third_party/inspector_protocol/code_generator.py", "third_party/inspector_protocol/pdl.py", @@ -3476,8 +3615,6 @@ filegroup( name = "v8_common_libshared_files", srcs = [ ":torque_runtime_support_files", - ":v8_compiler_files", - ":v8_initializers_files", ":v8_libplatform_files", ":v8_libsampler_files", ":v8_shared_internal_headers", @@ -3547,14 +3684,16 @@ v8_mksnapshot( # NOTE: This allow headers to be accessed without the icu/noicu prefixes. cc_library( - name = "icu/generated_torque_headers", - hdrs = [":icu/generated_torque_files"], + name = "icu/generated_torque_definitions_headers", + hdrs = [":icu/generated_torque_definitions"], + copts = ["-Wno-implicit-fallthrough"], strip_include_prefix = "icu", ) cc_library( - name = "noicu/generated_torque_headers", - hdrs = [":noicu/generated_torque_files"], + name = "noicu/generated_torque_definitions_headers", + hdrs = [":noicu/generated_torque_definitions"], + copts = ["-Wno-implicit-fallthrough"], strip_include_prefix = "noicu", ) @@ -3564,6 +3703,7 @@ v8_library( ":v8_libbase_files", ":v8_shared_internal_headers", ], + copts = ["-Wno-implicit-fallthrough"], ) cc_library( @@ -3572,6 +3712,7 @@ cc_library( "src/torque/kythe-data.h", "src/torque/torque-compiler.h", ], + copts = ["-Wno-implicit-fallthrough"], include_prefix = "third_party/v8", includes = ["."], ) @@ -3581,7 +3722,7 @@ cc_library( srcs = [ ":torque_base_files", ], - copts = select({ + copts = ["-Wno-implicit-fallthrough"] + select({ "@v8//bazel/config:is_posix": ["-fexceptions"], "//conditions:default": [], }), @@ -3597,21 +3738,27 @@ v8_library( srcs = [ ":v8_base_without_compiler_files", ":v8_common_libshared_files", - ], + ] + select({ + ":is_v8_enable_turbofan": [ + ":v8_compiler_files", + ], + "//conditions:default": [], + }), + copts = ["-Wno-implicit-fallthrough"], icu_deps = [ - ":icu/generated_torque_headers", + ":icu/generated_torque_definitions_headers", "//external:icu", ], icu_srcs = [ ":generated_regexp_special_case", - ":icu/generated_torque_files", + ":icu/generated_torque_definitions", ":icu/v8_base_without_compiler_files", ], noicu_deps = [ - ":noicu/generated_torque_headers", + ":noicu/generated_torque_definitions_headers", ], noicu_srcs = [ - ":noicu/generated_torque_files", + ":noicu/generated_torque_definitions", ], deps = [ ":v8_libbase", @@ -3621,8 +3768,17 @@ v8_library( v8_library( name = "v8", - srcs = [":v8_inspector_files"], + srcs = [ + ":v8_inspector_files", + ] + select({ + ":is_not_v8_enable_turbofan": [ + # With Turbofan disabled, we only include the stubbed-out API. + "src/compiler/turbofan-disabled.cc", + ], + "//conditions:default": [], + }), hdrs = [":public_header_files"], + copts = ["-Wno-implicit-fallthrough"], icu_deps = [":icu/v8_libshared"], icu_srcs = [":icu/snapshot_files"], noicu_deps = [":noicu/v8_libshared"], @@ -3635,6 +3791,7 @@ v8_library( name = "wee8", srcs = [":wee8_files"], hdrs = [":public_wasm_c_api_header_files"], + copts = ["-Wno-implicit-fallthrough"], strip_include_prefix = "third_party", visibility = ["//visibility:public"], deps = [":noicu/v8"], @@ -3664,6 +3821,7 @@ v8_binary( "src/interpreter/bytecodes.cc", "src/interpreter/bytecodes.h", ], + copts = ["-Wno-implicit-fallthrough"], deps = ["v8_libbase"], ) @@ -3675,6 +3833,7 @@ v8_binary( ":v8_libbase_files", ":v8_shared_internal_headers", ], + copts = ["-Wno-implicit-fallthrough"], defines = [ "V8_INTL_SUPPORT", "ICU_UTIL_DATA_IMPL=ICU_UTIL_DATA_STATIC", @@ -3693,10 +3852,11 @@ v8_binary( "src/torque/torque.cc", ":torque_base_files", ], - copts = select({ + copts = ["-Wno-implicit-fallthrough"] + select({ "@v8//bazel/config:is_posix": ["-fexceptions"], "//conditions:default": [], }), + icu_defines = [ "V8_INTL_SUPPORT" ], features = ["-use_header_modules"], linkopts = select({ "@v8//bazel/config:is_android": ["-llog"], @@ -3707,26 +3867,49 @@ v8_binary( v8_binary( name = "mksnapshot", - srcs = [":mksnapshot_files"], + srcs = [ + ":mksnapshot_files", + ] + select({ + ":is_not_v8_enable_turbofan": [ + # Turbofan is needed to generate builtins. + ":v8_compiler_files", + ], + "//conditions:default": [], + }), + copts = ["-Wno-implicit-fallthrough"], icu_deps = [":icu/v8_libshared"], linkopts = select({ "@v8//bazel/config:is_android": ["-llog"], "//conditions:default": [], }), + icu_srcs = [ + ":icu/generated_torque_initializers", + ":icu/v8_initializers_files", + ], noicu_deps = [":v8_libshared_noicu"], + noicu_srcs = [ + ":noicu/generated_torque_initializers", + ":noicu/v8_initializers_files", + ], ) v8_binary( name = "d8", srcs = [":d8_files"], + copts = ["-Wno-implicit-fallthrough"], icu_deps = [":icu/v8"], noicu_deps = [":noicu/v8"], ) # This target forces torque to be compiled without pointer compression. v8_binary_non_pointer_compression( - name = "torque_non_pointer_compression", - binary = "torque", + name = "noicu/torque_non_pointer_compression", + binary = "noicu/torque", +) + +v8_binary_non_pointer_compression( + name = "icu/torque_non_pointer_compression", + binary = "icu/torque", ) alias( diff --git a/deps/v8/BUILD.gn b/deps/v8/BUILD.gn index 78fd8cd2d38790..8f9377940796a5 100644 --- a/deps/v8/BUILD.gn +++ b/deps/v8/BUILD.gn @@ -4,16 +4,14 @@ import("//build/config/android/config.gni") import("//build/config/arm.gni") +import("//build/config/coverage/coverage.gni") import("//build/config/dcheck_always_on.gni") import("//build/config/host_byteorder.gni") import("//build/config/mips.gni") +import("//build/config/riscv.gni") import("//build/config/sanitizers/sanitizers.gni") import("//build_overrides/build.gni") -if (is_android) { - import("//build/config/android/rules.gni") -} - import("gni/snapshot_toolchain.gni") import("gni/v8.gni") @@ -120,6 +118,13 @@ declare_args() { # as per the --native-code-counters flag. v8_enable_snapshot_native_code_counters = "" + # Use pre-generated static root pointer values from static-roots.h. + v8_enable_static_roots = "" + + # Mode used by gen-static-roots.py to have a heap layout which is identical + # to when v8_enable_static_roots is enabled. + v8_enable_static_root_generation = false + # Enable code-generation-time checking of types in the CodeStubAssembler. v8_enable_verify_csa = false @@ -204,10 +209,6 @@ declare_args() { # Sets -dV8_EXTERNAL_CODE_SPACE v8_enable_external_code_space = "" - # Enable the Maglev compiler. - # Sets -dV8_ENABLE_MAGLEV - v8_enable_maglev = "" - # With post mortem support enabled, metadata is embedded into libv8 that # describes various parameters of the VM for use by debuggers. See # tools/gen-postmortem-metadata.py for details. @@ -272,6 +273,9 @@ declare_args() { # Use switch-based dispatch if this is false v8_enable_regexp_interpreter_threaded_dispatch = true + # Check mksnapshot determinism by running it multiple times. + v8_verify_deterministic_mksnapshot = false + # Enable additional targets necessary for verification of torque # file generation v8_verify_torque_generation_invariance = false @@ -310,9 +314,6 @@ declare_args() { # Sets -DV8_ENABLE_SANDBOX. v8_enable_sandbox = "" - # Enable all available sandbox features. Implies v8_enable_sandbox. - v8_enable_sandbox_future = false - # Expose the memory corruption API to JavaScript. Useful for testing the sandbox. # WARNING This will expose builtins that (by design) cause memory corruption. # Sets -DV8_EXPOSE_MEMORY_CORRUPTION_API @@ -376,6 +377,17 @@ declare_args() { # Compile V8 using zlib as dependency. # Sets -DV8_USE_ZLIB v8_use_zlib = true + + # Make ValueDeserializer crash if the data to deserialize is invalid. + v8_value_deserializer_hard_fail = false + + # Enable jitless mode, including compile-time optimizations. Note that even + # when this is set to 'false', one can run V8 in jitless mode at runtime by + # passing the `--jitless` flag; but then you miss out on compile-time + # optimizations. + # iOS (non-simulator) does not have executable pages for 3rd party + # applications yet so disable jit. + v8_jitless = v8_enable_lite_mode || target_is_ios_device } # Derived defaults. @@ -459,20 +471,17 @@ if (v8_enable_external_code_space == "") { (target_os != "fuchsia" && v8_current_cpu == "arm64")) } if (v8_enable_maglev == "") { - v8_enable_maglev = v8_current_cpu == "x64" && v8_enable_pointer_compression -} -if (v8_builtins_profiling_log_file == "default") { - v8_builtins_profiling_log_file = "" - if (is_debug == false) { - if (v8_current_cpu == "x64") { - v8_builtins_profiling_log_file = "tools/builtins-pgo/x64.profile" - } else if (v8_current_cpu == "arm64") { - v8_builtins_profiling_log_file = "tools/builtins-pgo/arm64.profile" - } else if (v8_current_cpu == "arm") { - v8_builtins_profiling_log_file = "tools/builtins-pgo/arm.profile" - } - } + v8_enable_maglev = v8_enable_turbofan && + (v8_current_cpu == "x64" || v8_current_cpu == "arm64") && + v8_enable_pointer_compression } +assert(v8_enable_turbofan || !v8_enable_maglev, + "Maglev is not available when Turbofan is disabled.") + +assert(!v8_jitless || + (!v8_enable_maglev && !v8_enable_turbofan && !v8_enable_webassembly), + "Maglev, Turbofan and Wasm are not available in jitless mode") + if (v8_enable_single_generation == "") { v8_enable_single_generation = v8_disable_write_barriers } @@ -500,6 +509,10 @@ assert(!v8_enable_trace_ignition || v8_enable_trace_unoptimized, "Ignition tracing requires unoptimized tracing to be enabled.") assert(!v8_enable_trace_baseline_exec || v8_enable_trace_unoptimized, "Baseline tracing requires unoptimized tracing to be enabled.") +assert( + v8_enable_debugging_features == true || dcheck_always_on || + !v8_enable_slow_dchecks, + "v8_enable_slow_dchecks requires v8_enable_debugging_features or dcheck_always_on.") if (v8_enable_short_builtin_calls && (!v8_enable_pointer_compression && v8_current_cpu != "x64")) { @@ -522,9 +535,64 @@ if (v8_enable_sandbox == "") { v8_enable_external_code_space && target_os != "fuchsia" } -# Enable all available sandbox features if sandbox future is enabled. -if (v8_enable_sandbox_future) { - v8_enable_sandbox = true +if (v8_enable_static_roots == "") { + # Static roots are only valid for builds with pointer compression and a + # shared read-only heap. + # TODO(olivf, v8:13466) Some configurations could be supported if we + # introduce different static root files for different build configurations: + # Non-wasm and non-i18n builds have fewer read only roots. Configurations + # without external code space allocate read only roots at a further + # location relative to the cage base. + v8_enable_static_roots = + v8_enable_pointer_compression && v8_enable_shared_ro_heap && + v8_enable_pointer_compression_shared_cage && + v8_enable_external_code_space && v8_enable_webassembly && + v8_enable_i18n_support +} + +assert(!v8_enable_static_roots || + (v8_enable_pointer_compression && v8_enable_shared_ro_heap && + v8_enable_pointer_compression_shared_cage && + v8_enable_external_code_space && v8_enable_webassembly && + v8_enable_i18n_support), + "Trying to enable static roots in a configuration that is not supported") + +assert( + !(v8_enable_static_roots && v8_enable_static_root_generation), + "Static root values must be generated in a build that does not rely on static roots itself") + +if (v8_builtins_profiling_log_file == "default") { + v8_builtins_profiling_log_file = "" + + # Don't use existing profile when + # * v8_enable_builtins_optimization is disabled, + # * generating a new one (i.e. v8_enable_builtins_profiling), + # * is_debug or dcheck_always_on because they add more checks to the + # builtins control flow which we don't want to generate, + # * !v8_enable_sandbox because it affects the way how external pointer values + # are accessed, + # * v8_enable_webassembly because it changes the set of opcodes which affects + # graphs hashes, + # * !is_clang because it might affect argument evaluation order, which + # makes node IDs not predictable for subgraphs like Op1(Op2(), Op3()) and + # as a result different graph hash. + if (v8_enable_builtins_optimization && !v8_enable_builtins_profiling && + is_clang && !is_debug && !dcheck_always_on && v8_enable_webassembly) { + if ((v8_current_cpu == "x64" || v8_current_cpu == "arm64") && + v8_enable_pointer_compression && v8_enable_external_code_space && + v8_enable_sandbox) { + # Note, currently x64 profile can be applied to arm64 but not the other + # way round. + v8_builtins_profiling_log_file = "tools/builtins-pgo/profiles/x64.profile" + } else if (v8_current_cpu == "x86" || v8_current_cpu == "arm") { + # Note, x86 profile can be applied to arm but not the other way round. + v8_builtins_profiling_log_file = "tools/builtins-pgo/profiles/x86.profile" + } + } +} + +if (v8_enable_webassembly && !target_is_simulator && v8_current_cpu == "x64") { + v8_enable_wasm_simd256_revec = true } assert(!v8_disable_write_barriers || v8_enable_single_generation, @@ -567,8 +635,9 @@ assert( assert( !v8_enable_pointer_compression_shared_cage || v8_current_cpu == "x64" || - v8_current_cpu == "arm64" || v8_current_cpu == "riscv64", - "Sharing a pointer compression cage is only supported on x64,arm64 and riscv64") + v8_current_cpu == "arm64" || v8_current_cpu == "riscv64" || + v8_current_cpu == "ppc64", + "Sharing a pointer compression cage is only supported on x64,arm64, ppc64 and riscv64") assert(!v8_enable_unconditional_write_barriers || !v8_disable_write_barriers, "Write barriers can't be both enabled and disabled") @@ -583,12 +652,6 @@ assert(!cppgc_enable_young_generation || cppgc_enable_caged_heap, assert(!cppgc_enable_pointer_compression || cppgc_enable_caged_heap, "Pointer compression in CppGC requires caged heap") -assert( - !v8_enable_conservative_stack_scanning || - v8_enable_inner_pointer_resolution_osb || - v8_enable_inner_pointer_resolution_mb, - "Conservative stack scanning requires inner pointer resolution (OSB or MB)") - if (v8_enable_single_generation == true) { assert( v8_enable_unconditional_write_barriers || v8_disable_write_barriers, @@ -741,6 +804,7 @@ external_v8_defines = [ "V8_USE_PERFETTO", "V8_MAP_PACKING", "V8_IS_TSAN", + "V8_ENABLE_CONSERVATIVE_STACK_SCANNING", ] enabled_external_v8_defines = [] @@ -780,6 +844,9 @@ if (v8_enable_map_packing) { if (is_tsan) { enabled_external_v8_defines += [ "V8_IS_TSAN" ] } +if (v8_enable_conservative_stack_scanning) { + enabled_external_v8_defines += [ "V8_ENABLE_CONSERVATIVE_STACK_SCANNING" ] +} disabled_external_v8_defines = external_v8_defines - enabled_external_v8_defines @@ -800,6 +867,7 @@ config("v8_header_features") { external_cppgc_defines = [ "CPPGC_SUPPORTS_OBJECT_NAMES", "CPPGC_CAGED_HEAP", + "CPPGC_SLIM_WRITE_BARRIER", "CPPGC_YOUNG_GENERATION", "CPPGC_POINTER_COMPRESSION", ] @@ -829,6 +897,9 @@ if (cppgc_enable_pointer_compression) { if (cppgc_enable_2gb_cage) { enabled_external_cppgc_defines += [ "CPPGC_2GB_CAGE" ] } +if (cppgc_enable_slim_write_barrier) { + enabled_external_cppgc_defines += [ "CPPGC_SLIM_WRITE_BARRIER" ] +} disabled_external_cppgc_defines = external_cppgc_defines - enabled_external_cppgc_defines @@ -944,15 +1015,6 @@ config("features") { if (v8_enable_single_generation) { defines += [ "V8_ENABLE_SINGLE_GENERATION" ] } - if (v8_enable_conservative_stack_scanning) { - defines += [ "V8_ENABLE_CONSERVATIVE_STACK_SCANNING" ] - } - if (v8_enable_inner_pointer_resolution_osb) { - defines += [ "V8_ENABLE_INNER_POINTER_RESOLUTION_OSB" ] - } - if (v8_enable_inner_pointer_resolution_mb) { - defines += [ "V8_ENABLE_INNER_POINTER_RESOLUTION_MB" ] - } if (v8_disable_write_barriers) { defines += [ "V8_DISABLE_WRITE_BARRIERS" ] } @@ -1010,6 +1072,12 @@ config("features") { if (v8_enable_maglev) { defines += [ "V8_ENABLE_MAGLEV" ] } + if (v8_enable_turbofan) { + defines += [ "V8_ENABLE_TURBOFAN" ] + } + if (v8_jitless) { + defines += [ "V8_JITLESS" ] + } if (v8_enable_swiss_name_dictionary) { defines += [ "V8_ENABLE_SWISS_NAME_DICTIONARY" ] } @@ -1052,9 +1120,24 @@ config("features") { if (v8_enable_pointer_compression_8gb) { defines += [ "V8_COMPRESS_POINTERS_8GB" ] } + if (v8_enable_static_roots) { + defines += [ "V8_STATIC_ROOTS" ] + } + if (v8_enable_static_root_generation) { + defines += [ "V8_STATIC_ROOT_GENERATION" ] + } if (v8_use_zlib) { defines += [ "V8_USE_ZLIB" ] } + if (v8_use_libm_trig_functions) { + defines += [ "V8_USE_LIBM_TRIG_FUNCTIONS" ] + } + if (v8_value_deserializer_hard_fail) { + defines += [ "V8_VALUE_DESERIALIZER_HARD_FAIL" ] + } + if (v8_enable_wasm_simd256_revec) { + defines += [ "V8_ENABLE_WASM_SIMD256_REVEC" ] + } } config("toolchain") { @@ -1189,8 +1272,9 @@ config("toolchain") { if (!is_clang) { cflags += [ "-ffp-contract=off" ] } - if (target_is_simulator) { + if (riscv_use_rvv || target_is_simulator) { defines += [ "CAN_USE_RVV_INSTRUCTIONS" ] + defines += [ "RVV_VLEN=${riscv_rvv_vlen}" ] } } @@ -1242,6 +1326,9 @@ config("toolchain") { } else if (target_os == "win") { defines += [ "V8_HAVE_TARGET_OS" ] defines += [ "V8_TARGET_OS_WIN" ] + } else if (target_os == "chromeos") { + defines += [ "V8_HAVE_TARGET_OS" ] + defines += [ "V8_TARGET_OS_CHROMEOS" ] } # TODO(infra): Support v8_enable_prof on Windows. @@ -1251,13 +1338,12 @@ config("toolchain") { if ((is_linux || is_chromeos) && v8_enable_backtrace) { ldflags += [ "-rdynamic" ] } - + } + if (v8_enable_debugging_features || dcheck_always_on) { defines += [ "DEBUG" ] if (v8_enable_slow_dchecks) { defines += [ "ENABLE_SLOW_DCHECKS" ] } - } else if (dcheck_always_on) { - defines += [ "DEBUG" ] } if (v8_enable_verify_csa) { @@ -1508,23 +1594,6 @@ config("always_turbofanimize") { } } -# Configs for code coverage with gcov. Separate configs for cflags and ldflags -# to selectively influde cflags in non-test targets only. -config("v8_gcov_coverage_cflags") { - cflags = [ - "-fprofile-arcs", - "-ftest-coverage", - - # We already block on gcc warnings on other bots. Let's not block here to - # always generate coverage reports. - "-Wno-error", - ] -} - -config("v8_gcov_coverage_ldflags") { - ldflags = [ "-fprofile-arcs" ] -} - ############################################################################### # Actions # @@ -1556,108 +1625,91 @@ template("asm_to_inline_asm") { } } -if (is_android && enable_java_templates) { - android_assets("v8_external_startup_data_assets") { - if (v8_use_external_startup_data) { - deps = [ "//v8" ] - renaming_sources = [ "$root_out_dir/snapshot_blob.bin" ] - if (current_cpu == "arm" || current_cpu == "x86") { - renaming_destinations = [ "snapshot_blob_32.bin" ] - } else { - renaming_destinations = [ "snapshot_blob_64.bin" ] - } - disable_compression = true - } - } -} - -action("postmortem-metadata") { - # Only targets in this file and the top-level visibility target can - # depend on this. - visibility = [ - ":*", - "//:gn_visibility", - ] - - script = "tools/gen-postmortem-metadata.py" - - # NOSORT - sources = [ - "$target_gen_dir/torque-generated/instance-types.h", - "src/objects/allocation-site.h", - "src/objects/allocation-site-inl.h", - "src/objects/cell.h", - "src/objects/cell-inl.h", - "src/objects/code.h", - "src/objects/code-inl.h", - "src/objects/data-handler.h", - "src/objects/data-handler-inl.h", - "src/objects/descriptor-array.h", - "src/objects/descriptor-array-inl.h", - "src/objects/feedback-cell.h", - "src/objects/feedback-cell-inl.h", - "src/objects/fixed-array.h", - "src/objects/fixed-array-inl.h", - "src/objects/heap-number.h", - "src/objects/heap-number-inl.h", - "src/objects/heap-object.h", - "src/objects/heap-object-inl.h", - "src/objects/instance-type.h", - "src/objects/js-array-buffer.h", - "src/objects/js-array-buffer-inl.h", - "src/objects/js-array.h", - "src/objects/js-array-inl.h", - "src/objects/js-function-inl.h", - "src/objects/js-function.cc", - "src/objects/js-function.h", - "src/objects/js-objects.cc", - "src/objects/js-objects.h", - "src/objects/js-objects-inl.h", - "src/objects/js-promise.h", - "src/objects/js-promise-inl.h", - "src/objects/js-raw-json.cc", - "src/objects/js-raw-json.h", - "src/objects/js-raw-json-inl.h", - "src/objects/js-regexp.cc", - "src/objects/js-regexp.h", - "src/objects/js-regexp-inl.h", - "src/objects/js-regexp-string-iterator.h", - "src/objects/js-regexp-string-iterator-inl.h", - "src/objects/map.cc", - "src/objects/map.h", - "src/objects/map-inl.h", - "src/objects/megadom-handler.h", - "src/objects/megadom-handler-inl.h", - "src/objects/name.h", - "src/objects/name-inl.h", - "src/objects/objects.h", - "src/objects/objects-inl.h", - "src/objects/oddball.h", - "src/objects/oddball-inl.h", - "src/objects/primitive-heap-object.h", - "src/objects/primitive-heap-object-inl.h", - "src/objects/scope-info.h", - "src/objects/scope-info-inl.h", - "src/objects/script.h", - "src/objects/script-inl.h", - "src/objects/shared-function-info.cc", - "src/objects/shared-function-info.h", - "src/objects/shared-function-info-inl.h", - "src/objects/string.cc", - "src/objects/string-comparator.cc", - "src/objects/string-comparator.h", - "src/objects/string.h", - "src/objects/string-inl.h", - "src/objects/struct.h", - "src/objects/struct-inl.h", - ] - - outputs = [ "$target_gen_dir/debug-support.cc" ] +if (v8_postmortem_support) { + action("postmortem-metadata") { + # Only targets in this file can depend on this. + visibility = [ ":*" ] - args = rebase_path(outputs, root_build_dir) + - rebase_path(sources, root_build_dir) + script = "tools/gen-postmortem-metadata.py" - deps = [ ":run_torque" ] + # NOSORT + sources = [ + "$target_gen_dir/torque-generated/instance-types.h", + "src/objects/allocation-site.h", + "src/objects/allocation-site-inl.h", + "src/objects/cell.h", + "src/objects/cell-inl.h", + "src/objects/code.h", + "src/objects/code-inl.h", + "src/objects/data-handler.h", + "src/objects/data-handler-inl.h", + "src/objects/descriptor-array.h", + "src/objects/descriptor-array-inl.h", + "src/objects/feedback-cell.h", + "src/objects/feedback-cell-inl.h", + "src/objects/fixed-array.h", + "src/objects/fixed-array-inl.h", + "src/objects/heap-number.h", + "src/objects/heap-number-inl.h", + "src/objects/heap-object.h", + "src/objects/heap-object-inl.h", + "src/objects/instance-type.h", + "src/objects/js-array-buffer.h", + "src/objects/js-array-buffer-inl.h", + "src/objects/js-array.h", + "src/objects/js-array-inl.h", + "src/objects/js-function-inl.h", + "src/objects/js-function.cc", + "src/objects/js-function.h", + "src/objects/js-objects.cc", + "src/objects/js-objects.h", + "src/objects/js-objects-inl.h", + "src/objects/js-promise.h", + "src/objects/js-promise-inl.h", + "src/objects/js-raw-json.cc", + "src/objects/js-raw-json.h", + "src/objects/js-raw-json-inl.h", + "src/objects/js-regexp.cc", + "src/objects/js-regexp.h", + "src/objects/js-regexp-inl.h", + "src/objects/js-regexp-string-iterator.h", + "src/objects/js-regexp-string-iterator-inl.h", + "src/objects/map.cc", + "src/objects/map.h", + "src/objects/map-inl.h", + "src/objects/megadom-handler.h", + "src/objects/megadom-handler-inl.h", + "src/objects/name.h", + "src/objects/name-inl.h", + "src/objects/objects.h", + "src/objects/objects-inl.h", + "src/objects/oddball.h", + "src/objects/oddball-inl.h", + "src/objects/primitive-heap-object.h", + "src/objects/primitive-heap-object-inl.h", + "src/objects/scope-info.h", + "src/objects/scope-info-inl.h", + "src/objects/script.h", + "src/objects/script-inl.h", + "src/objects/shared-function-info.cc", + "src/objects/shared-function-info.h", + "src/objects/shared-function-info-inl.h", + "src/objects/string.cc", + "src/objects/string-comparator.cc", + "src/objects/string-comparator.h", + "src/objects/string.h", + "src/objects/string-inl.h", + "src/objects/struct.h", + "src/objects/struct-inl.h", + ] + + outputs = [ "$target_gen_dir/debug-support.cc" ] + + args = rebase_path(outputs, root_build_dir) + + rebase_path(sources, root_build_dir) + + deps = [ ":run_torque" ] + } } torque_files = [ @@ -1713,6 +1765,8 @@ torque_files = [ "src/builtins/internal-coverage.tq", "src/builtins/internal.tq", "src/builtins/iterator.tq", + "src/builtins/iterator-from.tq", + "src/builtins/iterator-helpers.tq", "src/builtins/math.tq", "src/builtins/number.tq", "src/builtins/object-fromentries.tq", @@ -1756,6 +1810,7 @@ torque_files = [ "src/builtins/string-html.tq", "src/builtins/string-includes.tq", "src/builtins/string-indexof.tq", + "src/builtins/string-iswellformed.tq", "src/builtins/string-iterator.tq", "src/builtins/string-match-search.tq", "src/builtins/string-pad.tq", @@ -1765,6 +1820,7 @@ torque_files = [ "src/builtins/string-startswith.tq", "src/builtins/string-substr.tq", "src/builtins/string-substring.tq", + "src/builtins/string-towellformed.tq", "src/builtins/string-trim.tq", "src/builtins/symbol.tq", "src/builtins/torque-internal.tq", @@ -1821,6 +1877,7 @@ torque_files = [ "src/objects/js-collection.tq", "src/objects/js-function.tq", "src/objects/js-generator.tq", + "src/objects/js-iterator-helpers.tq", "src/objects/js-objects.tq", "src/objects/js-promise.tq", "src/objects/js-proxy.tq", @@ -1860,6 +1917,7 @@ torque_files = [ "src/objects/templates.tq", "src/objects/torque-defined-classes.tq", "src/objects/turbofan-types.tq", + "src/objects/turboshaft-types.tq", "test/torque/test-torque.tq", "third_party/v8/builtins/array-sort.tq", ] @@ -2005,7 +2063,7 @@ if (v8_verify_torque_generation_invariance) { group("v8_maybe_icu") { if (v8_enable_i18n_support) { - public_deps = [ "//third_party/icu" ] + public_deps = [ v8_icu_path ] } } @@ -2114,12 +2172,6 @@ template("run_mksnapshot") { suffix = "_$name" } action("run_mksnapshot_" + name) { - # Only targets in this file and running mkgrokdump can depend on this. - visibility = [ - ":*", - "tools/debug_helper:run_mkgrokdump", - ] - deps = [ ":mksnapshot($v8_snapshot_toolchain)" ] script = "tools/run.py" @@ -2159,6 +2211,12 @@ template("run_mksnapshot") { "--turbo-profiling-input", rebase_path(v8_builtins_profiling_log_file, root_build_dir), ] + + # Replace this with --warn-about-builtin-profile-data to see the full + # list of builtins with incompatible profiles. + # TODO(crbug.com/v8/13647): Do not fail for invalid profiles + # args += [ "--abort-on-bad-builtin-profile-data" ] + args += [ "--warn-about-builtin-profile-data" ] } # This is needed to distinguish between generating code for the simulator @@ -2253,10 +2311,45 @@ if (emit_builtins_as_inline_asm) { } } +if (v8_verify_deterministic_mksnapshot) { + runs = [ + "run_0", + "run_1", + "run_2", + "run_3", + "run_4", + "run_5", + "run_6", + ] + + foreach(i, runs) { + run_mksnapshot(i) { + args = [] + embedded_variant = "Default" + } + } + + action("verify_deterministic_mksnapshot") { + deps = [] + foreach(i, runs) { + deps += [ ":run_mksnapshot_$i" ] + } + report_file = "$target_gen_dir/mksnapshot_comparison.txt" + script = "tools/snapshot/compare_mksnapshot_output.py" + args = [ + rebase_path("$report_file", root_build_dir), + rebase_path("$target_gen_dir", root_build_dir), + rebase_path("$root_out_dir", root_build_dir), + "7", # Length of the 'runs' list. + ] + outputs = [ report_file ] + } +} + action("v8_dump_build_config") { script = "tools/testrunner/utils/dump_build_config.py" outputs = [ "$root_out_dir/v8_build_config.json" ] - is_gcov_coverage = v8_code_coverage && !is_clang + is_DEBUG_defined = v8_enable_debugging_features || dcheck_always_on is_full_debug = v8_enable_debugging_features && !v8_optimized_debug args = [ rebase_path("$root_out_dir/v8_build_config.json", root_build_dir), @@ -2266,37 +2359,48 @@ action("v8_dump_build_config") { "is_asan=$is_asan", "is_cfi=$is_cfi", "is_clang=$is_clang", + "is_clang_coverage=$use_clang_coverage", "is_component_build=$is_component_build", "is_debug=$v8_enable_debugging_features", + "is_DEBUG_defined=$is_DEBUG_defined", "is_full_debug=$is_full_debug", - "is_gcov_coverage=$is_gcov_coverage", "is_msan=$is_msan", "is_tsan=$is_tsan", "is_ubsan_vptr=$is_ubsan_vptr", "target_cpu=\"$target_cpu\"", + "v8_code_comments=$v8_code_comments", + "v8_control_flow_integrity=$v8_control_flow_integrity", "v8_current_cpu=\"$v8_current_cpu\"", + "v8_dict_property_const_tracking=$v8_dict_property_const_tracking", + "v8_disable_write_barriers=$v8_disable_write_barriers", "v8_enable_atomic_object_field_writes=" + "$v8_enable_atomic_object_field_writes", + "v8_enable_cet_shadow_stack=$v8_enable_cet_shadow_stack", + "v8_enable_concurrent_marking=$v8_enable_concurrent_marking", "v8_enable_conservative_stack_scanning=" + "$v8_enable_conservative_stack_scanning", - "v8_enable_concurrent_marking=$v8_enable_concurrent_marking", - "v8_enable_single_generation=$v8_enable_single_generation", + "v8_enable_debug_code=$v8_enable_debug_code", + "v8_enable_disassembler=$v8_enable_disassembler", + "v8_enable_gdbjit=$v8_enable_gdbjit", "v8_enable_i18n_support=$v8_enable_i18n_support", - "v8_enable_verify_predictable=$v8_enable_verify_predictable", - "v8_enable_verify_csa=$v8_enable_verify_csa", "v8_enable_lite_mode=$v8_enable_lite_mode", - "v8_enable_runtime_call_stats=$v8_enable_runtime_call_stats", + "v8_enable_maglev=$v8_enable_maglev", "v8_enable_pointer_compression=$v8_enable_pointer_compression", "v8_enable_pointer_compression_shared_cage=" + "$v8_enable_pointer_compression_shared_cage", + "v8_enable_runtime_call_stats=$v8_enable_runtime_call_stats", "v8_enable_sandbox=$v8_enable_sandbox", "v8_enable_shared_ro_heap=$v8_enable_shared_ro_heap", + "v8_enable_single_generation=$v8_enable_single_generation", + "v8_enable_slow_dchecks=$v8_enable_slow_dchecks", "v8_enable_third_party_heap=$v8_enable_third_party_heap", + "v8_enable_turbofan=$v8_enable_turbofan", + "v8_enable_verify_csa=$v8_enable_verify_csa", + "v8_enable_verify_heap=$v8_enable_verify_heap", + "v8_enable_verify_predictable=$v8_enable_verify_predictable", "v8_enable_webassembly=$v8_enable_webassembly", - "v8_dict_property_const_tracking=$v8_dict_property_const_tracking", - "v8_control_flow_integrity=$v8_control_flow_integrity", + "v8_jitless=$v8_jitless", "v8_target_cpu=\"$v8_target_cpu\"", - "v8_enable_cet_shadow_stack=$v8_enable_cet_shadow_stack", ] if (v8_current_cpu == "mips64" || v8_current_cpu == "mips64el") { @@ -2312,11 +2416,15 @@ action("v8_dump_build_config") { # v8_source_set("v8_snapshot") { - visibility = [ ":*" ] # Targets in this file can depend on this. + # Let external targets depend on v8_snapshot. + if (v8_use_external_startup_data) { + visibility = [ ":*" ] # Targets in this file can depend on this. + } deps = [ ":v8_internal_headers", ":v8_libbase", + ":v8_tracing", ] public_deps = [ # This should be public so downstream targets can declare the snapshot @@ -2345,9 +2453,6 @@ v8_source_set("v8_snapshot") { sources += [ "src/snapshot/snapshot-external.cc" ] } else { - # Also top-level visibility targets can depend on this. - visibility += [ "//:gn_visibility" ] - public_deps += [ ":v8_maybe_icu" ] sources += [ "$target_gen_dir/snapshot.cc" ] @@ -2404,6 +2509,7 @@ v8_source_set("v8_initializers") { "src/builtins/builtins-microtask-queue-gen.cc", "src/builtins/builtins-number-gen.cc", "src/builtins/builtins-object-gen.cc", + "src/builtins/builtins-object-gen.h", "src/builtins/builtins-promise-gen.cc", "src/builtins/builtins-promise-gen.h", "src/builtins/builtins-proxy-gen.cc", @@ -2454,57 +2560,57 @@ v8_source_set("v8_initializers") { if (v8_current_cpu == "x86") { sources += [ - ### gcmole(arch:ia32) ### + ### gcmole(ia32) ### "src/builtins/ia32/builtins-ia32.cc", ] } else if (v8_current_cpu == "x64") { sources += [ - ### gcmole(arch:x64) ### + ### gcmole(x64) ### "src/builtins/x64/builtins-x64.cc", ] } else if (v8_current_cpu == "arm") { sources += [ - ### gcmole(arch:arm) ### + ### gcmole(arm) ### "src/builtins/arm/builtins-arm.cc", ] } else if (v8_current_cpu == "arm64") { sources += [ - ### gcmole(arch:arm64) ### + ### gcmole(arm64) ### "src/builtins/arm64/builtins-arm64.cc", ] } else if (v8_current_cpu == "mips64" || v8_current_cpu == "mips64el") { sources += [ - ### gcmole(arch:mips64el) ### + ### gcmole(mips64el) ### "src/builtins/mips64/builtins-mips64.cc", ] } else if (v8_current_cpu == "loong64") { sources += [ - ### gcmole(arch:loong64) ### + ### gcmole(loong64) ### "src/builtins/loong64/builtins-loong64.cc", ] } else if (v8_current_cpu == "ppc") { sources += [ - ### gcmole(arch:ppc) ### + ### gcmole(ppc) ### "src/builtins/ppc/builtins-ppc.cc", ] } else if (v8_current_cpu == "ppc64") { sources += [ - ### gcmole(arch:ppc64) ### + ### gcmole(ppc64) ### "src/builtins/ppc/builtins-ppc.cc", ] } else if (v8_current_cpu == "s390" || v8_current_cpu == "s390x") { sources += [ - ### gcmole(arch:s390) ### + ### gcmole(s390) ### "src/builtins/s390/builtins-s390.cc", ] } else if (v8_current_cpu == "riscv64") { sources += [ - ### gcmole(arch:riscv64) ### + ### gcmole(riscv64) ### "src/builtins/riscv/builtins-riscv.cc", ] } else if (v8_current_cpu == "riscv32") { sources += [ - ### gcmole(arch:riscv32) ### + ### gcmole(riscv32) ### "src/builtins/riscv/builtins-riscv.cc", ] } @@ -2775,6 +2881,7 @@ v8_header_set("v8_internal_headers") { "src/codegen/interface-descriptors.h", "src/codegen/label.h", "src/codegen/machine-type.h", + "src/codegen/macro-assembler-base.h", "src/codegen/macro-assembler-inl.h", "src/codegen/macro-assembler.h", "src/codegen/maglev-safepoint-table.h", @@ -2795,7 +2902,6 @@ v8_header_set("v8_internal_headers") { "src/codegen/source-position.h", "src/codegen/tick-counter.h", "src/codegen/tnode.h", - "src/codegen/turbo-assembler.h", "src/codegen/unoptimized-compilation-info.h", "src/common/assert-scope.h", "src/common/checks.h", @@ -2911,6 +3017,7 @@ v8_header_set("v8_internal_headers") { "src/compiler/osr.h", "src/compiler/per-isolate-compiler-cache.h", "src/compiler/persistent-map.h", + "src/compiler/phase.h", "src/compiler/pipeline-statistics.h", "src/compiler/pipeline.h", "src/compiler/processed-feedback.h", @@ -2928,25 +3035,61 @@ v8_header_set("v8_internal_headers") { "src/compiler/simplified-operator.h", "src/compiler/state-values-utils.h", "src/compiler/store-store-elimination.h", + "src/compiler/string-builder-optimizer.h", + "src/compiler/turbofan.h", "src/compiler/turboshaft/assembler.h", + "src/compiler/turboshaft/assert-types-reducer.h", + "src/compiler/turboshaft/branch-elimination-reducer.h", + "src/compiler/turboshaft/build-graph-phase.h", + "src/compiler/turboshaft/builtin-call-descriptors.h", + "src/compiler/turboshaft/dead-code-elimination-phase.h", + "src/compiler/turboshaft/dead-code-elimination-reducer.h", + "src/compiler/turboshaft/decompression-optimization-phase.h", "src/compiler/turboshaft/decompression-optimization.h", + "src/compiler/turboshaft/define-assembler-macros.inc", "src/compiler/turboshaft/deopt-data.h", "src/compiler/turboshaft/fast-hash.h", "src/compiler/turboshaft/graph-builder.h", "src/compiler/turboshaft/graph-visualizer.h", "src/compiler/turboshaft/graph.h", + "src/compiler/turboshaft/index.h", + "src/compiler/turboshaft/late-escape-analysis-reducer.h", + "src/compiler/turboshaft/late-optimization-phase.h", + "src/compiler/turboshaft/layered-hash-map.h", + "src/compiler/turboshaft/machine-lowering-phase.h", + "src/compiler/turboshaft/machine-lowering-reducer.h", "src/compiler/turboshaft/machine-optimization-reducer.h", + "src/compiler/turboshaft/memory-optimization-reducer.h", "src/compiler/turboshaft/operation-matching.h", "src/compiler/turboshaft/operations.h", "src/compiler/turboshaft/optimization-phase.h", + "src/compiler/turboshaft/optimize-phase.h", + "src/compiler/turboshaft/phase.h", + "src/compiler/turboshaft/recreate-schedule-phase.h", "src/compiler/turboshaft/recreate-schedule.h", + "src/compiler/turboshaft/reducer-traits.h", "src/compiler/turboshaft/representations.h", + "src/compiler/turboshaft/runtime-call-descriptors.h", "src/compiler/turboshaft/select-lowering-reducer.h", "src/compiler/turboshaft/sidetable.h", "src/compiler/turboshaft/simplify-tf-loops.h", "src/compiler/turboshaft/snapshot-table.h", + "src/compiler/turboshaft/tag-untag-lowering-phase.h", + "src/compiler/turboshaft/tag-untag-lowering-reducer.h", + "src/compiler/turboshaft/tracing.h", + "src/compiler/turboshaft/type-assertions-phase.h", + "src/compiler/turboshaft/type-inference-analysis.h", + "src/compiler/turboshaft/type-inference-reducer.h", + "src/compiler/turboshaft/type-parser.h", + "src/compiler/turboshaft/typed-optimizations-phase.h", + "src/compiler/turboshaft/typed-optimizations-reducer.h", + "src/compiler/turboshaft/typer.h", + "src/compiler/turboshaft/types.h", + "src/compiler/turboshaft/undef-assembler.macros.inc", + "src/compiler/turboshaft/uniform-reducer-adapater.h", "src/compiler/turboshaft/utils.h", "src/compiler/turboshaft/value-numbering-reducer.h", + "src/compiler/turboshaft/variable-reducer.h", "src/compiler/type-cache.h", "src/compiler/type-narrowing-reducer.h", "src/compiler/typed-optimization.h", @@ -3057,12 +3200,13 @@ v8_header_set("v8_internal_headers") { "src/heap/cppgc-js/cpp-marking-state-inl.h", "src/heap/cppgc-js/cpp-marking-state.h", "src/heap/cppgc-js/cpp-snapshot.h", + "src/heap/cppgc-js/cross-heap-remembered-set.h", "src/heap/cppgc-js/unified-heap-marking-state-inl.h", "src/heap/cppgc-js/unified-heap-marking-state.h", "src/heap/cppgc-js/unified-heap-marking-verifier.h", "src/heap/cppgc-js/unified-heap-marking-visitor.h", - "src/heap/embedder-tracing-inl.h", - "src/heap/embedder-tracing.h", + "src/heap/cppgc-js/wrappable-info-inl.h", + "src/heap/cppgc-js/wrappable-info.h", "src/heap/evacuation-allocator-inl.h", "src/heap/evacuation-allocator.h", "src/heap/evacuation-verifier-inl.h", @@ -3078,7 +3222,6 @@ v8_header_set("v8_internal_headers") { "src/heap/gc-idle-time-handler.h", "src/heap/gc-tracer-inl.h", "src/heap/gc-tracer.h", - "src/heap/global-handle-marking-visitor.h", "src/heap/heap-allocator-inl.h", "src/heap/heap-allocator.h", "src/heap/heap-controller.h", @@ -3118,8 +3261,10 @@ v8_header_set("v8_internal_headers") { "src/heap/memory-measurement-inl.h", "src/heap/memory-measurement.h", "src/heap/memory-reducer.h", + "src/heap/minor-gc-job.h", "src/heap/new-spaces-inl.h", "src/heap/new-spaces.h", + "src/heap/object-lock.h", "src/heap/object-stats.h", "src/heap/objects-visiting-inl.h", "src/heap/objects-visiting.h", @@ -3136,15 +3281,13 @@ v8_header_set("v8_internal_headers") { "src/heap/remembered-set-inl.h", "src/heap/remembered-set.h", "src/heap/safepoint.h", - "src/heap/scavenge-job.h", "src/heap/scavenger-inl.h", "src/heap/scavenger.h", "src/heap/slot-set.h", "src/heap/spaces-inl.h", "src/heap/spaces.h", - "src/heap/stress-marking-observer.h", - "src/heap/stress-scavenge-observer.h", "src/heap/sweeper.h", + "src/heap/traced-handles-marking-visitor.h", "src/heap/weak-object-worklists.h", "src/ic/call-optimization.h", "src/ic/handler-configuration-inl.h", @@ -3281,6 +3424,8 @@ v8_header_set("v8_internal_headers") { "src/objects/js-function.h", "src/objects/js-generator-inl.h", "src/objects/js-generator.h", + "src/objects/js-iterator-helpers-inl.h", + "src/objects/js-iterator-helpers.h", "src/objects/js-objects-inl.h", "src/objects/js-objects.h", "src/objects/js-promise-inl.h", @@ -3406,6 +3551,8 @@ v8_header_set("v8_internal_headers") { "src/objects/transitions.h", "src/objects/turbofan-types-inl.h", "src/objects/turbofan-types.h", + "src/objects/turboshaft-types-inl.h", + "src/objects/turboshaft-types.h", "src/objects/type-hints.h", "src/objects/value-serializer.h", "src/objects/visitors-inl.h", @@ -3473,6 +3620,7 @@ v8_header_set("v8_internal_headers") { "src/regexp/special-case.h", "src/roots/roots-inl.h", "src/roots/roots.h", + "src/roots/static-roots.h", "src/runtime/runtime-utils.h", "src/runtime/runtime.h", "src/sandbox/bounded-size-inl.h", @@ -3592,12 +3740,17 @@ v8_header_set("v8_internal_headers") { "src/maglev/maglev-interpreter-frame-state.h", "src/maglev/maglev-ir-inl.h", "src/maglev/maglev-ir.h", + "src/maglev/maglev-phi-representation-selector.h", "src/maglev/maglev-regalloc-data.h", "src/maglev/maglev-regalloc.h", "src/maglev/maglev-register-frame-array.h", - "src/maglev/maglev-vreg-allocator.h", "src/maglev/maglev.h", ] + if (v8_current_cpu == "arm64") { + sources += [ "src/maglev/arm64/maglev-assembler-arm64-inl.h" ] + } else if (v8_current_cpu == "x64") { + sources += [ "src/maglev/x64/maglev-assembler-x64-inl.h" ] + } } if (v8_enable_webassembly) { @@ -3608,13 +3761,16 @@ v8_header_set("v8_internal_headers") { "src/asmjs/asm-scanner.h", "src/asmjs/asm-types.h", "src/compiler/int64-lowering.h", + "src/compiler/wasm-call-descriptors.h", "src/compiler/wasm-compiler-definitions.h", "src/compiler/wasm-compiler.h", "src/compiler/wasm-escape-analysis.h", "src/compiler/wasm-gc-lowering.h", "src/compiler/wasm-gc-operator-reducer.h", "src/compiler/wasm-graph-assembler.h", + "src/compiler/wasm-inlining-into-js.h", "src/compiler/wasm-inlining.h", + "src/compiler/wasm-load-elimination.h", "src/compiler/wasm-loop-peeling.h", "src/compiler/wasm-typer.h", "src/debug/debug-wasm-objects-inl.h", @@ -3680,11 +3836,15 @@ v8_header_set("v8_internal_headers") { "src/wasm/wasm-subtyping.h", "src/wasm/wasm-tier.h", "src/wasm/wasm-value.h", + "src/wasm/well-known-imports.h", ] } if (v8_enable_wasm_simd256_revec) { - sources += [ "src/compiler/linear-scheduler.h" ] + sources += [ + "src/compiler/linear-scheduler.h", + "src/compiler/revectorizer.h", + ] } if (!v8_enable_third_party_heap) { @@ -3720,8 +3880,6 @@ v8_header_set("v8_internal_headers") { "src/objects/js-segment-iterator.h", "src/objects/js-segmenter-inl.h", "src/objects/js-segmenter.h", - "src/objects/js-segments-inl.h", - "src/objects/js-segments.h", ] } @@ -3733,13 +3891,6 @@ v8_header_set("v8_internal_headers") { sources += [ "src/heap/conservative-stack-visitor.h" ] } - if (v8_enable_inner_pointer_resolution_osb) { - sources += [ - "src/heap/object-start-bitmap-inl.h", - "src/heap/object-start-bitmap.h", - ] - } - if (v8_enable_wasm_gdb_remote_debugging) { sources += [ "src/debug/wasm/gdb-server/gdb-remote-util.h", @@ -3758,7 +3909,8 @@ v8_header_set("v8_internal_headers") { } if (v8_current_cpu == "x86") { - sources += [ ### gcmole(arch:ia32) ### + sources += [ + ### gcmole(ia32) ### "src/baseline/ia32/baseline-assembler-ia32-inl.h", "src/baseline/ia32/baseline-compiler-ia32-inl.h", "src/codegen/ia32/assembler-ia32-inl.h", @@ -3776,7 +3928,8 @@ v8_header_set("v8_internal_headers") { "src/wasm/baseline/ia32/liftoff-assembler-ia32.h", ] } else if (v8_current_cpu == "x64") { - sources += [ ### gcmole(arch:x64) ### + sources += [ + ### gcmole(x64) ### "src/baseline/x64/baseline-assembler-x64-inl.h", "src/baseline/x64/baseline-compiler-x64-inl.h", "src/codegen/shared-ia32-x64/macro-assembler-shared-ia32-x64.h", @@ -3812,7 +3965,8 @@ v8_header_set("v8_internal_headers") { } } } else if (v8_current_cpu == "arm") { - sources += [ ### gcmole(arch:arm) ### + sources += [ + ### gcmole(arm) ### "src/baseline/arm/baseline-assembler-arm-inl.h", "src/baseline/arm/baseline-compiler-arm-inl.h", "src/codegen/arm/assembler-arm-inl.h", @@ -3830,7 +3984,8 @@ v8_header_set("v8_internal_headers") { "src/wasm/baseline/arm/liftoff-assembler-arm.h", ] } else if (v8_current_cpu == "arm64") { - sources += [ ### gcmole(arch:arm64) ### + sources += [ + ### gcmole(arm64) ### "src/baseline/arm64/baseline-assembler-arm64-inl.h", "src/baseline/arm64/baseline-compiler-arm64-inl.h", "src/codegen/arm64/assembler-arm64-inl.h", @@ -3859,7 +4014,7 @@ v8_header_set("v8_internal_headers") { if (v8_enable_webassembly) { # Trap handling is enabled on arm64 Mac and in simulators on x64 on Linux # and Mac. - if ((current_cpu == "arm64" && is_mac) || + if ((current_cpu == "arm64" && (is_mac || is_ios)) || (current_cpu == "x64" && (is_linux || is_chromeos || is_mac))) { sources += [ "src/trap-handler/handler-inside-posix.h" ] } @@ -3872,7 +4027,8 @@ v8_header_set("v8_internal_headers") { sources += [ "src/diagnostics/unwinding-info-win64.h" ] } } else if (v8_current_cpu == "mips64" || v8_current_cpu == "mips64el") { - sources += [ ### gcmole(arch:mips64el) ### + sources += [ + ### gcmole(mips64el) ### "src/baseline/mips64/baseline-assembler-mips64-inl.h", "src/baseline/mips64/baseline-compiler-mips64-inl.h", "src/codegen/mips64/assembler-mips64-inl.h", @@ -3888,7 +4044,8 @@ v8_header_set("v8_internal_headers") { "src/wasm/baseline/mips64/liftoff-assembler-mips64.h", ] } else if (v8_current_cpu == "loong64") { - sources += [ ### gcmole(arch:loong64) ### + sources += [ + ### gcmole(loong64) ### "src/baseline/loong64/baseline-assembler-loong64-inl.h", "src/baseline/loong64/baseline-compiler-loong64-inl.h", "src/codegen/loong64/assembler-loong64-inl.h", @@ -3904,7 +4061,8 @@ v8_header_set("v8_internal_headers") { "src/wasm/baseline/loong64/liftoff-assembler-loong64.h", ] } else if (v8_current_cpu == "ppc") { - sources += [ ### gcmole(arch:ppc) ### + sources += [ + ### gcmole(ppc) ### "src/codegen/ppc/assembler-ppc-inl.h", "src/codegen/ppc/assembler-ppc.h", "src/codegen/ppc/constants-ppc.h", @@ -3920,7 +4078,8 @@ v8_header_set("v8_internal_headers") { "src/wasm/baseline/ppc/liftoff-assembler-ppc.h", ] } else if (v8_current_cpu == "ppc64") { - sources += [ ### gcmole(arch:ppc64) ### + sources += [ + ### gcmole(ppc64) ### "src/baseline/ppc/baseline-assembler-ppc-inl.h", "src/baseline/ppc/baseline-compiler-ppc-inl.h", "src/codegen/ppc/assembler-ppc-inl.h", @@ -3938,7 +4097,8 @@ v8_header_set("v8_internal_headers") { "src/wasm/baseline/ppc/liftoff-assembler-ppc.h", ] } else if (v8_current_cpu == "s390" || v8_current_cpu == "s390x") { - sources += [ ### gcmole(arch:s390) ### + sources += [ + ### gcmole(s390) ### "src/baseline/s390/baseline-assembler-s390-inl.h", "src/baseline/s390/baseline-compiler-s390-inl.h", "src/codegen/s390/assembler-s390-inl.h", @@ -3956,16 +4116,15 @@ v8_header_set("v8_internal_headers") { "src/wasm/baseline/s390/liftoff-assembler-s390.h", ] } else if (v8_current_cpu == "riscv64") { - sources += [ ### gcmole(arch:riscv64) ### + sources += [ + ### gcmole(riscv64) ### "src/baseline/riscv/baseline-assembler-riscv-inl.h", "src/baseline/riscv/baseline-compiler-riscv-inl.h", "src/codegen/riscv/assembler-riscv-inl.h", - "src/codegen/riscv/assembler-riscv-inl.h", "src/codegen/riscv/assembler-riscv.h", "src/codegen/riscv/base-assembler-riscv.h", "src/codegen/riscv/base-constants-riscv.h", "src/codegen/riscv/base-riscv-i.h", - "src/codegen/riscv/base-riscv-i.h", "src/codegen/riscv/constant-riscv-a.h", "src/codegen/riscv/constant-riscv-c.h", "src/codegen/riscv/constant-riscv-d.h", @@ -3978,7 +4137,7 @@ v8_header_set("v8_internal_headers") { "src/codegen/riscv/extension-riscv-a.h", "src/codegen/riscv/extension-riscv-c.h", "src/codegen/riscv/extension-riscv-d.h", - "src/codegen/riscv/extension-riscv-d.h", + "src/codegen/riscv/extension-riscv-f.h", "src/codegen/riscv/extension-riscv-inl.h", "src/codegen/riscv/extension-riscv-m.h", "src/codegen/riscv/extension-riscv-v.h", @@ -3995,11 +4154,12 @@ v8_header_set("v8_internal_headers") { "src/wasm/baseline/riscv64/liftoff-assembler-riscv64.h", ] } else if (v8_current_cpu == "riscv32") { - sources += [ ### gcmole(arch:riscv32) ### + sources += [ + ### gcmole(riscv32) ### "src/baseline/riscv/baseline-assembler-riscv-inl.h", "src/baseline/riscv/baseline-compiler-riscv-inl.h", + "src/codegen/riscv/assembler-riscv-inl.h", "src/codegen/riscv/assembler-riscv.h", - "src/codegen/riscv/assembler-riscv32-inl.h", "src/codegen/riscv/base-assembler-riscv.h", "src/codegen/riscv/base-constants-riscv.h", "src/codegen/riscv/base-riscv-i.h", @@ -4157,6 +4317,8 @@ v8_compiler_sources = [ "src/compiler/simplified-operator.cc", "src/compiler/state-values-utils.cc", "src/compiler/store-store-elimination.cc", + "src/compiler/string-builder-optimizer.cc", + "src/compiler/turbofan-enabled.cc", "src/compiler/type-cache.cc", "src/compiler/type-narrowing-reducer.cc", "src/compiler/typed-optimization.cc", @@ -4165,30 +4327,123 @@ v8_compiler_sources = [ "src/compiler/value-numbering-reducer.cc", "src/compiler/verifier.cc", "src/compiler/zone-stats.cc", - "src/utils/hex-format.cc", - "src/utils/sha-256.cc", ] +if (v8_current_cpu == "x86") { + v8_compiler_sources += [ + ### gcmole(ia32) ### + "src/compiler/backend/ia32/code-generator-ia32.cc", + "src/compiler/backend/ia32/instruction-scheduler-ia32.cc", + "src/compiler/backend/ia32/instruction-selector-ia32.cc", + ] +} else if (v8_current_cpu == "x64") { + v8_compiler_sources += [ + ### gcmole(x64) ### + "src/compiler/backend/x64/code-generator-x64.cc", + "src/compiler/backend/x64/instruction-scheduler-x64.cc", + "src/compiler/backend/x64/instruction-selector-x64.cc", + "src/compiler/backend/x64/unwinding-info-writer-x64.cc", + ] +} else if (v8_current_cpu == "arm") { + v8_compiler_sources += [ + ### gcmole(arm) ### + "src/compiler/backend/arm/code-generator-arm.cc", + "src/compiler/backend/arm/instruction-scheduler-arm.cc", + "src/compiler/backend/arm/instruction-selector-arm.cc", + "src/compiler/backend/arm/unwinding-info-writer-arm.cc", + ] +} else if (v8_current_cpu == "arm64") { + v8_compiler_sources += [ + ### gcmole(arm64) ### + "src/compiler/backend/arm64/code-generator-arm64.cc", + "src/compiler/backend/arm64/instruction-scheduler-arm64.cc", + "src/compiler/backend/arm64/instruction-selector-arm64.cc", + "src/compiler/backend/arm64/unwinding-info-writer-arm64.cc", + ] +} else if (v8_current_cpu == "mips64" || v8_current_cpu == "mips64el") { + v8_compiler_sources += [ + ### gcmole(mips64el) ### + "src/compiler/backend/mips64/code-generator-mips64.cc", + "src/compiler/backend/mips64/instruction-scheduler-mips64.cc", + "src/compiler/backend/mips64/instruction-selector-mips64.cc", + ] +} else if (v8_current_cpu == "loong64") { + v8_compiler_sources += [ + ### gcmole(loong64) ### + "src/compiler/backend/loong64/code-generator-loong64.cc", + "src/compiler/backend/loong64/instruction-scheduler-loong64.cc", + "src/compiler/backend/loong64/instruction-selector-loong64.cc", + ] +} else if (v8_current_cpu == "ppc") { + v8_compiler_sources += [ + ### gcmole(ppc) ### + "src/compiler/backend/ppc/code-generator-ppc.cc", + "src/compiler/backend/ppc/instruction-scheduler-ppc.cc", + "src/compiler/backend/ppc/instruction-selector-ppc.cc", + "src/compiler/backend/ppc/unwinding-info-writer-ppc.cc", + ] +} else if (v8_current_cpu == "ppc64") { + v8_compiler_sources += [ + ### gcmole(ppc64) ### + "src/compiler/backend/ppc/code-generator-ppc.cc", + "src/compiler/backend/ppc/instruction-scheduler-ppc.cc", + "src/compiler/backend/ppc/instruction-selector-ppc.cc", + "src/compiler/backend/ppc/unwinding-info-writer-ppc.cc", + ] +} else if (v8_current_cpu == "s390" || v8_current_cpu == "s390x") { + v8_compiler_sources += [ + ### gcmole(s390) ### + "src/compiler/backend/s390/code-generator-s390.cc", + "src/compiler/backend/s390/instruction-scheduler-s390.cc", + "src/compiler/backend/s390/instruction-selector-s390.cc", + "src/compiler/backend/s390/unwinding-info-writer-s390.cc", + ] +} else if (v8_current_cpu == "riscv64") { + v8_compiler_sources += [ + ### gcmole(riscv64) ### + "src/compiler/backend/riscv/code-generator-riscv.cc", + "src/compiler/backend/riscv/instruction-scheduler-riscv.cc", + "src/compiler/backend/riscv/instruction-selector-riscv64.cc", + ] +} else if (v8_current_cpu == "riscv32") { + v8_compiler_sources += [ + ### gcmole(riscv32) ### + "src/compiler/backend/riscv/code-generator-riscv.cc", + "src/compiler/backend/riscv/instruction-scheduler-riscv.cc", + "src/compiler/backend/riscv/instruction-selector-riscv32.cc", + ] +} + if (v8_enable_webassembly) { v8_compiler_sources += [ "src/compiler/int64-lowering.cc", + "src/compiler/wasm-call-descriptors.cc", "src/compiler/wasm-compiler.cc", "src/compiler/wasm-escape-analysis.cc", "src/compiler/wasm-gc-lowering.cc", "src/compiler/wasm-gc-operator-reducer.cc", "src/compiler/wasm-graph-assembler.cc", + "src/compiler/wasm-inlining-into-js.cc", "src/compiler/wasm-inlining.cc", + "src/compiler/wasm-load-elimination.cc", "src/compiler/wasm-loop-peeling.cc", "src/compiler/wasm-typer.cc", ] } if (v8_enable_wasm_simd256_revec) { - v8_compiler_sources += [ "src/compiler/linear-scheduler.cc" ] + v8_compiler_sources += [ + "src/compiler/linear-scheduler.cc", + "src/compiler/revectorizer.cc", + ] } -# The src/compiler files with optimizations. -v8_source_set("v8_compiler_opt") { +# The src/compiler files for use in mksnapshot. +# - These might be built with additional optimizations if +# v8_enable_fast_mksnapshot is set. +# - We always include Turbofan even if v8_enable_turbofan is unset s.t. +# builtins can be generated by mksnapshot. +v8_source_set("v8_compiler_for_mksnapshot_source_set") { visibility = [ ":*" ] # Only targets in this file can depend on this. sources = v8_compiler_sources @@ -4219,11 +4474,16 @@ v8_source_set("v8_compiler_opt") { } } -# The src/compiler files with default optimization behavior. +# The src/compiler files with default behavior. v8_source_set("v8_compiler") { visibility = [ ":*" ] # Only targets in this file can depend on this. - sources = v8_compiler_sources + if (v8_enable_turbofan) { + sources = v8_compiler_sources + } else { + # With Turbofan disabled, we only include the stubbed-out API. + sources = [ "src/compiler/turbofan-disabled.cc" ] + } public_deps = [ ":generate_bytecode_builtins_list", @@ -4247,15 +4507,32 @@ v8_source_set("v8_turboshaft") { visibility = [ ":*" ] # Only targets in this file can depend on this. sources = [ + "src/compiler/turboshaft/assembler.cc", + "src/compiler/turboshaft/build-graph-phase.cc", + "src/compiler/turboshaft/dead-code-elimination-phase.cc", + "src/compiler/turboshaft/decompression-optimization-phase.cc", "src/compiler/turboshaft/decompression-optimization.cc", "src/compiler/turboshaft/graph-builder.cc", "src/compiler/turboshaft/graph-visualizer.cc", "src/compiler/turboshaft/graph.cc", + "src/compiler/turboshaft/late-escape-analysis-reducer.cc", + "src/compiler/turboshaft/late-optimization-phase.cc", + "src/compiler/turboshaft/machine-lowering-phase.cc", + "src/compiler/turboshaft/memory-optimization-reducer.cc", "src/compiler/turboshaft/operations.cc", "src/compiler/turboshaft/optimization-phase.cc", + "src/compiler/turboshaft/optimize-phase.cc", + "src/compiler/turboshaft/phase.cc", + "src/compiler/turboshaft/recreate-schedule-phase.cc", "src/compiler/turboshaft/recreate-schedule.cc", "src/compiler/turboshaft/representations.cc", "src/compiler/turboshaft/simplify-tf-loops.cc", + "src/compiler/turboshaft/tag-untag-lowering-phase.cc", + "src/compiler/turboshaft/type-assertions-phase.cc", + "src/compiler/turboshaft/type-parser.cc", + "src/compiler/turboshaft/typed-optimizations-phase.cc", + "src/compiler/turboshaft/typer.cc", + "src/compiler/turboshaft/types.cc", "src/compiler/turboshaft/utils.cc", ] @@ -4277,8 +4554,14 @@ v8_source_set("v8_turboshaft") { } group("v8_compiler_for_mksnapshot") { - if (is_debug && !v8_optimized_debug && v8_enable_fast_mksnapshot) { - deps = [ ":v8_compiler_opt" ] + if ((is_debug && !v8_optimized_debug && v8_enable_fast_mksnapshot) || + !v8_enable_turbofan) { + # mksnapshot needs its own version of the compiler, either because + # a) we're optimizing for mksnapshot execution speed and the compiler + # should be optimized even if the rest of V8 is not; or + # b) Turbofan is disabled and thus not compiled into the rest of V8, yet + # mksnapshot still needs TF to generate builtins. + deps = [ ":v8_compiler_for_mksnapshot_source_set" ] } else { deps = [ ":v8_compiler" ] } @@ -4297,7 +4580,11 @@ group("v8_tracing") { } v8_source_set("v8_base_without_compiler") { - visibility = [ ":*" ] # Only targets in this file can depend on this. + # Only targets in this file and gcmole can depend on this. + visibility = [ + ":*", + "tools/gcmole/:*", + ] # Split static libraries on windows into two. split_count = 2 @@ -4351,7 +4638,6 @@ v8_source_set("v8_base_without_compiler") { "src/builtins/builtins-trace.cc", "src/builtins/builtins-typed-array.cc", "src/builtins/builtins-weak-refs.cc", - "src/builtins/builtins-web-snapshots.cc", "src/builtins/builtins.cc", "src/builtins/constants-table-builder.cc", "src/codegen/aligned-slot-allocator.cc", @@ -4371,6 +4657,7 @@ v8_source_set("v8_base_without_compiler") { "src/codegen/handler-table.cc", "src/codegen/interface-descriptors.cc", "src/codegen/machine-type.cc", + "src/codegen/macro-assembler-base.cc", "src/codegen/maglev-safepoint-table.cc", "src/codegen/optimized-compilation-info.cc", "src/codegen/pending-optimization-table.cc", @@ -4381,10 +4668,10 @@ v8_source_set("v8_base_without_compiler") { "src/codegen/source-position.cc", "src/codegen/tick-counter.cc", "src/codegen/tnode.cc", - "src/codegen/turbo-assembler.cc", "src/codegen/unoptimized-compilation-info.cc", "src/common/assert-scope.cc", "src/common/code-memory-access.cc", + "src/common/ptr-compr.cc", "src/compiler-dispatcher/lazy-compile-dispatcher.cc", "src/compiler-dispatcher/optimizing-compile-dispatcher.cc", "src/date/date.cc", @@ -4460,10 +4747,10 @@ v8_source_set("v8_base_without_compiler") { "src/heap/concurrent-marking.cc", "src/heap/cppgc-js/cpp-heap.cc", "src/heap/cppgc-js/cpp-snapshot.cc", + "src/heap/cppgc-js/cross-heap-remembered-set.cc", "src/heap/cppgc-js/unified-heap-marking-state.cc", "src/heap/cppgc-js/unified-heap-marking-verifier.cc", "src/heap/cppgc-js/unified-heap-marking-visitor.cc", - "src/heap/embedder-tracing.cc", "src/heap/evacuation-verifier.cc", "src/heap/factory-base.cc", "src/heap/factory.cc", @@ -4471,7 +4758,6 @@ v8_source_set("v8_base_without_compiler") { "src/heap/free-list.cc", "src/heap/gc-idle-time-handler.cc", "src/heap/gc-tracer.cc", - "src/heap/global-handle-marking-visitor.cc", "src/heap/heap-allocator.cc", "src/heap/heap-controller.cc", "src/heap/heap-layout-tracer.cc", @@ -4494,6 +4780,7 @@ v8_source_set("v8_base_without_compiler") { "src/heap/memory-chunk.cc", "src/heap/memory-measurement.cc", "src/heap/memory-reducer.cc", + "src/heap/minor-gc-job.cc", "src/heap/new-spaces.cc", "src/heap/object-stats.cc", "src/heap/objects-visiting.cc", @@ -4502,13 +4789,12 @@ v8_source_set("v8_base_without_compiler") { "src/heap/read-only-heap.cc", "src/heap/read-only-spaces.cc", "src/heap/safepoint.cc", - "src/heap/scavenge-job.cc", "src/heap/scavenger.cc", "src/heap/slot-set.cc", "src/heap/spaces.cc", - "src/heap/stress-marking-observer.cc", "src/heap/stress-scavenge-observer.cc", "src/heap/sweeper.cc", + "src/heap/traced-handles-marking-visitor.cc", "src/heap/weak-object-worklists.cc", "src/ic/call-optimization.cc", "src/ic/handler-configuration.cc", @@ -4584,6 +4870,7 @@ v8_source_set("v8_base_without_compiler") { "src/objects/js-segment-iterator.cc", "src/objects/js-segmenter.cc", "src/objects/js-segments.cc", + "src/objects/js-struct.cc", "src/objects/js-temporal-objects.cc", "src/objects/keys.cc", "src/objects/literal-objects.cc", @@ -4736,13 +5023,13 @@ v8_source_set("v8_base_without_compiler") { "src/utils/allocation.cc", "src/utils/bit-vector.cc", "src/utils/detachable-vector.cc", + "src/utils/hex-format.cc", "src/utils/identity-map.cc", "src/utils/memcopy.cc", "src/utils/ostreams.cc", + "src/utils/sha-256.cc", "src/utils/utils.cc", "src/utils/version.cc", - "src/web-snapshot/web-snapshot.cc", - "src/web-snapshot/web-snapshot.h", "src/zone/accounting-allocator.cc", "src/zone/type-stats.cc", "src/zone/zone-segment.cc", @@ -4765,13 +5052,26 @@ v8_source_set("v8_base_without_compiler") { "src/maglev/maglev-graph-printer.cc", "src/maglev/maglev-interpreter-frame-state.cc", "src/maglev/maglev-ir.cc", + "src/maglev/maglev-phi-representation-selector.cc", "src/maglev/maglev-regalloc.cc", "src/maglev/maglev.cc", ] + if (v8_current_cpu == "arm64") { + sources += [ + "src/maglev/arm64/maglev-assembler-arm64.cc", + "src/maglev/arm64/maglev-ir-arm64.cc", + ] + } else if (v8_current_cpu == "x64") { + sources += [ + "src/maglev/x64/maglev-assembler-x64.cc", + "src/maglev/x64/maglev-ir-x64.cc", + ] + } } if (v8_enable_webassembly) { - sources += [ ### gcmole(all) ### + sources += [ + ### gcmole(all) ### "src/asmjs/asm-js.cc", "src/asmjs/asm-parser.cc", "src/asmjs/asm-scanner.cc", @@ -4822,6 +5122,7 @@ v8_source_set("v8_base_without_compiler") { "src/wasm/wasm-result.cc", "src/wasm/wasm-serialization.cc", "src/wasm/wasm-subtyping.cc", + "src/wasm/well-known-imports.cc", ] } @@ -4853,14 +5154,12 @@ v8_source_set("v8_base_without_compiler") { } if (v8_current_cpu == "x86") { - sources += [ ### gcmole(arch:ia32) ### + sources += [ + ### gcmole(ia32) ### "src/codegen/ia32/assembler-ia32.cc", "src/codegen/ia32/cpu-ia32.cc", "src/codegen/ia32/macro-assembler-ia32.cc", "src/codegen/shared-ia32-x64/macro-assembler-shared-ia32-x64.cc", - "src/compiler/backend/ia32/code-generator-ia32.cc", - "src/compiler/backend/ia32/instruction-scheduler-ia32.cc", - "src/compiler/backend/ia32/instruction-selector-ia32.cc", "src/deoptimizer/ia32/deoptimizer-ia32.cc", "src/diagnostics/ia32/disasm-ia32.cc", "src/diagnostics/ia32/unwinder-ia32.cc", @@ -4868,15 +5167,12 @@ v8_source_set("v8_base_without_compiler") { "src/regexp/ia32/regexp-macro-assembler-ia32.cc", ] } else if (v8_current_cpu == "x64") { - sources += [ ### gcmole(arch:x64) ### + sources += [ + ### gcmole(x64) ### "src/codegen/shared-ia32-x64/macro-assembler-shared-ia32-x64.cc", "src/codegen/x64/assembler-x64.cc", "src/codegen/x64/cpu-x64.cc", "src/codegen/x64/macro-assembler-x64.cc", - "src/compiler/backend/x64/code-generator-x64.cc", - "src/compiler/backend/x64/instruction-scheduler-x64.cc", - "src/compiler/backend/x64/instruction-selector-x64.cc", - "src/compiler/backend/x64/unwinding-info-writer-x64.cc", "src/deoptimizer/x64/deoptimizer-x64.cc", "src/diagnostics/x64/disasm-x64.cc", "src/diagnostics/x64/eh-frame-x64.cc", @@ -4906,15 +5202,12 @@ v8_source_set("v8_base_without_compiler") { } } } else if (v8_current_cpu == "arm") { - sources += [ ### gcmole(arch:arm) ### + sources += [ + ### gcmole(arm) ### "src/codegen/arm/assembler-arm.cc", "src/codegen/arm/constants-arm.cc", "src/codegen/arm/cpu-arm.cc", "src/codegen/arm/macro-assembler-arm.cc", - "src/compiler/backend/arm/code-generator-arm.cc", - "src/compiler/backend/arm/instruction-scheduler-arm.cc", - "src/compiler/backend/arm/instruction-selector-arm.cc", - "src/compiler/backend/arm/unwinding-info-writer-arm.cc", "src/deoptimizer/arm/deoptimizer-arm.cc", "src/diagnostics/arm/disasm-arm.cc", "src/diagnostics/arm/eh-frame-arm.cc", @@ -4924,7 +5217,8 @@ v8_source_set("v8_base_without_compiler") { "src/regexp/arm/regexp-macro-assembler-arm.cc", ] } else if (v8_current_cpu == "arm64") { - sources += [ ### gcmole(arch:arm64) ### + sources += [ + ### gcmole(arm64) ### "src/codegen/arm64/assembler-arm64.cc", "src/codegen/arm64/cpu-arm64.cc", "src/codegen/arm64/decoder-arm64.cc", @@ -4933,10 +5227,6 @@ v8_source_set("v8_base_without_compiler") { "src/codegen/arm64/macro-assembler-arm64.cc", "src/codegen/arm64/register-arm64.cc", "src/codegen/arm64/utils-arm64.cc", - "src/compiler/backend/arm64/code-generator-arm64.cc", - "src/compiler/backend/arm64/instruction-scheduler-arm64.cc", - "src/compiler/backend/arm64/instruction-selector-arm64.cc", - "src/compiler/backend/arm64/unwinding-info-writer-arm64.cc", "src/deoptimizer/arm64/deoptimizer-arm64.cc", "src/diagnostics/arm64/disasm-arm64.cc", "src/diagnostics/arm64/eh-frame-arm64.cc", @@ -4950,7 +5240,7 @@ v8_source_set("v8_base_without_compiler") { if (v8_enable_webassembly) { # Trap handling is enabled on arm64 Mac and in simulators on x64 on Linux, # Mac, and Windows. - if ((current_cpu == "arm64" && is_mac) || + if ((current_cpu == "arm64" && is_apple) || (current_cpu == "x64" && (is_linux || is_chromeos || is_mac))) { sources += [ "src/trap-handler/handler-inside-posix.cc", @@ -4971,15 +5261,13 @@ v8_source_set("v8_base_without_compiler") { sources += [ "src/diagnostics/unwinding-info-win64.cc" ] } } else if (v8_current_cpu == "mips64" || v8_current_cpu == "mips64el") { - sources += [ ### gcmole(arch:mips64el) ### + sources += [ + ### gcmole(mips64el) ### "src/codegen/mips64/assembler-mips64.cc", "src/codegen/mips64/constants-mips64.cc", "src/codegen/mips64/cpu-mips64.cc", "src/codegen/mips64/interface-descriptors-mips64-inl.h", "src/codegen/mips64/macro-assembler-mips64.cc", - "src/compiler/backend/mips64/code-generator-mips64.cc", - "src/compiler/backend/mips64/instruction-scheduler-mips64.cc", - "src/compiler/backend/mips64/instruction-selector-mips64.cc", "src/deoptimizer/mips64/deoptimizer-mips64.cc", "src/diagnostics/mips64/disasm-mips64.cc", "src/diagnostics/mips64/unwinder-mips64.cc", @@ -4988,15 +5276,13 @@ v8_source_set("v8_base_without_compiler") { "src/regexp/mips64/regexp-macro-assembler-mips64.cc", ] } else if (v8_current_cpu == "loong64") { - sources += [ ### gcmole(arch:loong64) ### + sources += [ + ### gcmole(loong64) ### "src/codegen/loong64/assembler-loong64.cc", "src/codegen/loong64/constants-loong64.cc", "src/codegen/loong64/cpu-loong64.cc", "src/codegen/loong64/interface-descriptors-loong64-inl.h", "src/codegen/loong64/macro-assembler-loong64.cc", - "src/compiler/backend/loong64/code-generator-loong64.cc", - "src/compiler/backend/loong64/instruction-scheduler-loong64.cc", - "src/compiler/backend/loong64/instruction-selector-loong64.cc", "src/deoptimizer/loong64/deoptimizer-loong64.cc", "src/diagnostics/loong64/disasm-loong64.cc", "src/diagnostics/loong64/unwinder-loong64.cc", @@ -5005,15 +5291,12 @@ v8_source_set("v8_base_without_compiler") { "src/regexp/loong64/regexp-macro-assembler-loong64.cc", ] } else if (v8_current_cpu == "ppc") { - sources += [ ### gcmole(arch:ppc) ### + sources += [ + ### gcmole(ppc) ### "src/codegen/ppc/assembler-ppc.cc", "src/codegen/ppc/constants-ppc.cc", "src/codegen/ppc/cpu-ppc.cc", "src/codegen/ppc/macro-assembler-ppc.cc", - "src/compiler/backend/ppc/code-generator-ppc.cc", - "src/compiler/backend/ppc/instruction-scheduler-ppc.cc", - "src/compiler/backend/ppc/instruction-selector-ppc.cc", - "src/compiler/backend/ppc/unwinding-info-writer-ppc.cc", "src/deoptimizer/ppc/deoptimizer-ppc.cc", "src/diagnostics/ppc/disasm-ppc.cc", "src/diagnostics/ppc/eh-frame-ppc.cc", @@ -5023,15 +5306,12 @@ v8_source_set("v8_base_without_compiler") { "src/regexp/ppc/regexp-macro-assembler-ppc.cc", ] } else if (v8_current_cpu == "ppc64") { - sources += [ ### gcmole(arch:ppc64) ### + sources += [ + ### gcmole(ppc64) ### "src/codegen/ppc/assembler-ppc.cc", "src/codegen/ppc/constants-ppc.cc", "src/codegen/ppc/cpu-ppc.cc", "src/codegen/ppc/macro-assembler-ppc.cc", - "src/compiler/backend/ppc/code-generator-ppc.cc", - "src/compiler/backend/ppc/instruction-scheduler-ppc.cc", - "src/compiler/backend/ppc/instruction-selector-ppc.cc", - "src/compiler/backend/ppc/unwinding-info-writer-ppc.cc", "src/deoptimizer/ppc/deoptimizer-ppc.cc", "src/diagnostics/ppc/disasm-ppc.cc", "src/diagnostics/ppc/eh-frame-ppc.cc", @@ -5041,15 +5321,12 @@ v8_source_set("v8_base_without_compiler") { "src/regexp/ppc/regexp-macro-assembler-ppc.cc", ] } else if (v8_current_cpu == "s390" || v8_current_cpu == "s390x") { - sources += [ ### gcmole(arch:s390) ### + sources += [ + ### gcmole(s390) ### "src/codegen/s390/assembler-s390.cc", "src/codegen/s390/constants-s390.cc", "src/codegen/s390/cpu-s390.cc", "src/codegen/s390/macro-assembler-s390.cc", - "src/compiler/backend/s390/code-generator-s390.cc", - "src/compiler/backend/s390/instruction-scheduler-s390.cc", - "src/compiler/backend/s390/instruction-selector-s390.cc", - "src/compiler/backend/s390/unwinding-info-writer-s390.cc", "src/deoptimizer/s390/deoptimizer-s390.cc", "src/diagnostics/s390/disasm-s390.cc", "src/diagnostics/s390/eh-frame-s390.cc", @@ -5059,7 +5336,8 @@ v8_source_set("v8_base_without_compiler") { "src/regexp/s390/regexp-macro-assembler-s390.cc", ] } else if (v8_current_cpu == "riscv64") { - sources += [ ### gcmole(arch:riscv64) ### + sources += [ + ### gcmole(riscv64) ### "src/codegen/riscv/assembler-riscv.cc", "src/codegen/riscv/base-assembler-riscv.cc", "src/codegen/riscv/base-constants-riscv.cc", @@ -5074,9 +5352,6 @@ v8_source_set("v8_base_without_compiler") { "src/codegen/riscv/extension-riscv-zicsr.cc", "src/codegen/riscv/extension-riscv-zifencei.cc", "src/codegen/riscv/macro-assembler-riscv.cc", - "src/compiler/backend/riscv/code-generator-riscv.cc", - "src/compiler/backend/riscv/instruction-scheduler-riscv.cc", - "src/compiler/backend/riscv/instruction-selector-riscv64.cc", "src/deoptimizer/riscv/deoptimizer-riscv.cc", "src/diagnostics/riscv/disasm-riscv.cc", "src/diagnostics/riscv/unwinder-riscv.cc", @@ -5085,7 +5360,8 @@ v8_source_set("v8_base_without_compiler") { "src/regexp/riscv/regexp-macro-assembler-riscv.cc", ] } else if (v8_current_cpu == "riscv32") { - sources += [ ### gcmole(arch:riscv32) ### + sources += [ + ### gcmole(riscv32) ### "src/codegen/riscv/assembler-riscv.cc", "src/codegen/riscv/base-assembler-riscv.cc", "src/codegen/riscv/base-constants-riscv.cc", @@ -5100,9 +5376,6 @@ v8_source_set("v8_base_without_compiler") { "src/codegen/riscv/extension-riscv-zicsr.cc", "src/codegen/riscv/extension-riscv-zifencei.cc", "src/codegen/riscv/macro-assembler-riscv.cc", - "src/compiler/backend/riscv/code-generator-riscv.cc", - "src/compiler/backend/riscv/instruction-scheduler-riscv.cc", - "src/compiler/backend/riscv/instruction-selector-riscv32.cc", "src/deoptimizer/riscv/deoptimizer-riscv.cc", "src/diagnostics/riscv/disasm-riscv.cc", "src/diagnostics/riscv/unwinder-riscv.cc", @@ -5152,7 +5425,7 @@ v8_source_set("v8_base_without_compiler") { deps += [ ":run_gen-regexp-special-case" ] sources += [ "$target_gen_dir/src/regexp/special-case.cc" ] if (is_win) { - deps += [ "//third_party/icu:icudata" ] + deps += [ "$v8_icu_path:icudata" ] } } else { sources -= [ @@ -5178,8 +5451,8 @@ v8_source_set("v8_base_without_compiler") { if (v8_use_zlib) { deps += [ - "//third_party/zlib", - "//third_party/zlib/google:compression_utils_portable", + "$v8_zlib_path", + "$v8_zlib_path/google:compression_utils_portable", ] } @@ -5223,8 +5496,11 @@ group("v8_base") { public_deps = [ ":v8_base_without_compiler", ":v8_compiler", - ":v8_turboshaft", ] + + if (v8_enable_turbofan) { + public_deps += [ ":v8_turboshaft" ] + } } v8_source_set("torque_base") { @@ -5240,7 +5516,6 @@ v8_source_set("torque_base") { "src/torque/cfg.h", "src/torque/class-debug-reader-generator.cc", "src/torque/constants.h", - "src/torque/contextual.h", "src/torque/cpp-builder.cc", "src/torque/cpp-builder.h", "src/torque/csa-generator.cc", @@ -5370,6 +5645,7 @@ v8_component("v8_libbase") { "src/base/build_config.h", "src/base/compiler-specific.h", "src/base/container-utils.h", + "src/base/contextual.h", "src/base/cpu.cc", "src/base/cpu.h", "src/base/debug/stack_trace.cc", @@ -5427,6 +5703,7 @@ v8_component("v8_libbase") { "src/base/platform/memory.h", "src/base/platform/mutex.cc", "src/base/platform/mutex.h", + "src/base/platform/platform.cc", "src/base/platform/platform.h", "src/base/platform/semaphore.cc", "src/base/platform/semaphore.h", @@ -5528,7 +5805,6 @@ v8_component("v8_libbase") { sources += [ "src/base/debug/stack_trace_posix.cc", "src/base/platform/platform-darwin.cc", - "src/base/platform/platform-macos.cc", ] } else { sources += [ @@ -5556,12 +5832,12 @@ v8_component("v8_libbase") { sources += [ "src/base/debug/stack_trace_posix.cc", "src/base/platform/platform-darwin.cc", - "src/base/platform/platform-macos.cc", ] } else if (is_ios) { sources += [ "src/base/debug/stack_trace_posix.cc", "src/base/platform/platform-darwin.cc", + "src/base/platform/platform-ios.cc", ] } else if (is_win) { # TODO(infra): Add support for cygwin. @@ -5612,9 +5888,35 @@ v8_component("v8_libbase") { [ "//build/config/clang:llvm-symbolizer_data($host_toolchain)" ] } + if (v8_use_libm_trig_functions) { + deps += [ ":libm" ] + } + # TODO(infra): Add support for qnx, freebsd, openbsd, netbsd, and solaris. } +if (v8_use_libm_trig_functions) { + source_set("libm") { + sources = [ + "third_party/glibc/src/sysdeps/ieee754/dbl-64/branred.c", + "third_party/glibc/src/sysdeps/ieee754/dbl-64/branred.h", + "third_party/glibc/src/sysdeps/ieee754/dbl-64/dla.h", + "third_party/glibc/src/sysdeps/ieee754/dbl-64/endian.h", + "third_party/glibc/src/sysdeps/ieee754/dbl-64/mydefs.h", + "third_party/glibc/src/sysdeps/ieee754/dbl-64/s_sin.c", + "third_party/glibc/src/sysdeps/ieee754/dbl-64/sincostab.c", + "third_party/glibc/src/sysdeps/ieee754/dbl-64/trig.h", + "third_party/glibc/src/sysdeps/ieee754/dbl-64/usncs.h", + ] + configs += [ "//build/config/compiler:no_chromium_code" ] + configs -= [ "//build/config/compiler:chromium_code" ] + if (!is_debug) { + # Build code using -O3, see: crbug.com/1084371. + configs += [ "//build/config/compiler:optimize_speed" ] + } + } +} + v8_component("v8_libplatform") { sources = [ "//base/trace_event/common/trace_event_common.h", @@ -5764,31 +6066,31 @@ v8_source_set("v8_heap_base") { if (is_clang || !is_win) { if (current_cpu == "x64") { - sources += [ "src/heap/base/asm/x64/save_registers_asm.cc" ] + sources += [ "src/heap/base/asm/x64/push_registers_asm.cc" ] } else if (current_cpu == "x86") { - sources += [ "src/heap/base/asm/ia32/save_registers_asm.cc" ] + sources += [ "src/heap/base/asm/ia32/push_registers_asm.cc" ] } else if (current_cpu == "arm") { - sources += [ "src/heap/base/asm/arm/save_registers_asm.cc" ] + sources += [ "src/heap/base/asm/arm/push_registers_asm.cc" ] } else if (current_cpu == "arm64") { - sources += [ "src/heap/base/asm/arm64/save_registers_asm.cc" ] + sources += [ "src/heap/base/asm/arm64/push_registers_asm.cc" ] } else if (current_cpu == "ppc64") { - sources += [ "src/heap/base/asm/ppc/save_registers_asm.cc" ] + sources += [ "src/heap/base/asm/ppc/push_registers_asm.cc" ] } else if (current_cpu == "s390x") { - sources += [ "src/heap/base/asm/s390/save_registers_asm.cc" ] + sources += [ "src/heap/base/asm/s390/push_registers_asm.cc" ] } else if (current_cpu == "mips64el") { - sources += [ "src/heap/base/asm/mips64/save_registers_asm.cc" ] + sources += [ "src/heap/base/asm/mips64/push_registers_asm.cc" ] } else if (current_cpu == "loong64") { - sources += [ "src/heap/base/asm/loong64/save_registers_asm.cc" ] + sources += [ "src/heap/base/asm/loong64/push_registers_asm.cc" ] } else if (current_cpu == "riscv64" || current_cpu == "riscv32") { - sources += [ "src/heap/base/asm/riscv/save_registers_asm.cc" ] + sources += [ "src/heap/base/asm/riscv/push_registers_asm.cc" ] } } else if (is_win) { if (current_cpu == "x64") { - sources += [ "src/heap/base/asm/x64/save_registers_masm.asm" ] + sources += [ "src/heap/base/asm/x64/push_registers_masm.asm" ] } else if (current_cpu == "x86") { - sources += [ "src/heap/base/asm/ia32/save_registers_masm.asm" ] + sources += [ "src/heap/base/asm/ia32/push_registers_masm.asm" ] } else if (current_cpu == "arm64") { - sources += [ "src/heap/base/asm/arm64/save_registers_masm.S" ] + sources += [ "src/heap/base/asm/arm64/push_registers_masm.S" ] } } @@ -6033,11 +6335,12 @@ if (v8_check_header_includes) { # if (v8_monolithic) { - # A component build is not monolithic. - assert(!is_component_build) + assert(!is_component_build, + "Set `is_component_build = false` for v8_monolithic.") # Using external startup data would produce separate files. - assert(!v8_use_external_startup_data) + assert(!v8_use_external_startup_data, + "Set `v8_use_external_startup_data = false` for v8_monolithic.") v8_static_library("v8_monolith") { deps = [ ":v8", @@ -6124,6 +6427,8 @@ if (current_toolchain == v8_snapshot_toolchain) { "src/snapshot/embedded/platform-embedded-file-writer-win.h", "src/snapshot/mksnapshot.cc", "src/snapshot/snapshot-empty.cc", + "src/snapshot/static-roots-gen.cc", + "src/snapshot/static-roots-gen.h", ] if (v8_control_flow_integrity) { @@ -6222,7 +6527,7 @@ if (v8_enable_i18n_support) { ":v8_libbase", ":v8_shared_internal_headers", "//build/win:default_exe_manifest", - "//third_party/icu", + v8_icu_path, ] configs = [ ":internal_config" ] @@ -6402,10 +6707,14 @@ if (is_component_build) { ":torque_ls_base", ":v8_base", ":v8_headers", - ":v8_initializers", ":v8_snapshot", ] + if (v8_enable_turbofan) { + # For cctest/test-serialize. + public_deps += [ ":v8_initializers" ] + } + configs = [ ":internal_config" ] public_configs = [ ":external_config" ] @@ -6458,10 +6767,14 @@ if (is_component_build) { ":torque_base", ":torque_ls_base", ":v8_base", - ":v8_initializers", ":v8_snapshot", ] + if (v8_enable_turbofan) { + # For cctest/test-serialize. + public_deps += [ ":v8_initializers" ] + } + public_configs = [ ":external_config" ] } diff --git a/deps/v8/DEPS b/deps/v8/DEPS index ab0a9bf5431112..05b32b571c84e2 100644 --- a/deps/v8/DEPS +++ b/deps/v8/DEPS @@ -30,8 +30,18 @@ vars = { 'checkout_instrumented_libraries': False, 'checkout_ittapi': False, + + # Fetch the prebuilt binaries for llvm-cov and llvm-profdata. Needed to + # process the raw profiles produced by instrumented targets (built with + # the gn arg 'use_clang_coverage'). + 'checkout_clang_coverage_tools': False, + # Fetch clang-tidy into the same bin/ directory as our clang binary. 'checkout_clang_tidy': False, + + # Fetch and build V8 builtins with PGO profiles + 'checkout_v8_builtins_pgo_profiles': False, + 'chromium_url': 'https://chromium.googlesource.com', 'android_url': 'https://android.googlesource.com', 'download_gcmole': False, @@ -43,22 +53,22 @@ vars = { 'fuchsia_sdk_cipd_prefix': 'fuchsia/sdk/gn/', # reclient CIPD package version - 'reclient_version': 're_client_version:0.83.0.da55f4f-gomaip', + 'reclient_version': 're_client_version:0.99.0.3f95625-gomaip', # GN CIPD package version. - 'gn_version': 'git_revision:a4d67be044b42963de801001e7146f9657c7fad4', + 'gn_version': 'git_revision:41fef642de70ecdcaaa26be96d56a0398f95abd4', # ninja CIPD package version # https://chrome-infra-packages.appspot.com/p/infra/3pp/tools/ninja - 'ninja_version': 'version:2@1.8.2.chromium.3', + 'ninja_version': 'version:2@1.11.1.chromium.6', # luci-go CIPD package version. - 'luci_go': 'git_revision:f8f64a8c560d2bf68a3ad1137979d17cffb36d30', + 'luci_go': 'git_revision:320bf3ed60cd4d24549d0ea9ee3a94394f2665ce', # Three lines of non-changing comments so that # the commit queue can handle CLs rolling Fuchsia sdk # and whatever else without interference from each other. - 'fuchsia_version': 'version:10.20221109.1.1', + 'fuchsia_version': 'version:12.20230322.3.1', # Three lines of non-changing comments so that # the commit queue can handle CLs rolling android_sdk_build-tools_version @@ -91,18 +101,18 @@ vars = { # Three lines of non-changing comments so that # the commit queue can handle CLs rolling android_sdk_tools-lint_version # and whatever else without interference from each other. - 'android_sdk_cmdline-tools_version': 'IPzAG-uU5zVMxohpg9-7-N0tQC1TCSW1VbrBFw7Ld04C', + 'android_sdk_cmdline-tools_version': '3Yn5Sn7BMObm8gsoZCF0loJMKg9_PpgU07G9DObCLdQC', } deps = { 'base/trace_event/common': - Var('chromium_url') + '/chromium/src/base/trace_event/common.git' + '@' + '521ac34ebd795939c7e16b37d9d3ddb40e8ed556', + Var('chromium_url') + '/chromium/src/base/trace_event/common.git' + '@' + '147f65333c38ddd1ebf554e89965c243c8ce50b3', 'build': - Var('chromium_url') + '/chromium/src/build.git' + '@' + '875cb19167f2e0d7b1eca89a4d5b5693421424c6', + Var('chromium_url') + '/chromium/src/build.git' + '@' + '9e9a4341dd24e68cba0f228567a6edbaff1c665b', 'buildtools': - Var('chromium_url') + '/chromium/src/buildtools.git' + '@' + '49ac7cf34ab2e59a10629a7a722cfb94348c4996', + Var('chromium_url') + '/chromium/src/buildtools.git' + '@' + '0a6c69640f1841d9109eac70a25af310d4c1d8c7', 'buildtools/clang_format/script': - Var('chromium_url') + '/external/github.com/llvm/llvm-project/clang/tools/clang-format.git' + '@' + '8b525d2747f2584fc35d8c7e612e66f377858df7', + Var('chromium_url') + '/external/github.com/llvm/llvm-project/clang/tools/clang-format.git' + '@' + 'f97059df7f8b205064625cdb5f97b56668a125ef', 'buildtools/linux64': { 'packages': [ { @@ -124,11 +134,11 @@ deps = { 'condition': 'host_os == "mac"', }, 'buildtools/third_party/libc++/trunk': - Var('chromium_url') + '/external/github.com/llvm/llvm-project/libcxx.git' + '@' + '4218f3525ad438b22b0e173d963515a09d143398', + Var('chromium_url') + '/external/github.com/llvm/llvm-project/libcxx.git' + '@' + 'e44019bfac2b2d3ebe1618628884f85c8600e322', 'buildtools/third_party/libc++abi/trunk': - Var('chromium_url') + '/external/github.com/llvm/llvm-project/libcxxabi.git' + '@' + '1a32724f721e1c3b6c590a07fe4a954344f15e48', + Var('chromium_url') + '/external/github.com/llvm/llvm-project/libcxxabi.git' + '@' + '9643f2cf13d6935a84a30b7da7de53327733e190', 'buildtools/third_party/libunwind/trunk': - Var('chromium_url') + '/external/github.com/llvm/llvm-project/libunwind.git' + '@' + 'a318d6a4c283a9d342d2a1e20292c1496fe12997', + Var('chromium_url') + '/external/github.com/llvm/llvm-project/libunwind.git' + '@' + '29a6dda8c6588ba4abeafdb21be531e757983e31', 'buildtools/win': { 'packages': [ { @@ -147,14 +157,14 @@ deps = { } ], 'dep_type': 'cipd', - 'condition': '(host_os == "linux" or host_os == "mac" or host_os == "win") and host_cpu != "s390" and host_cpu != "ppc"', + 'condition': '(host_os == "linux" or host_os == "mac" or host_os == "win") and host_cpu != "s390" and host_cpu != "ppc" and host_cpu != "arm64"', }, 'test/benchmarks/data': Var('chromium_url') + '/v8/deps/third_party/benchmarks.git' + '@' + '05d7188267b4560491ff9155c5ee13e207ecd65f', 'test/mozilla/data': Var('chromium_url') + '/v8/deps/third_party/mozilla-tests.git' + '@' + 'f6c578a10ea707b1a8ab0b88943fe5115ce2b9be', 'test/test262/data': - Var('chromium_url') + '/external/github.com/tc39/test262.git' + '@' + 'ade328d530525333751e8a3b58f02e18624da085', + Var('chromium_url') + '/external/github.com/tc39/test262.git' + '@' + 'd216cc197269fc41eb6eca14710529c3d6650535', 'third_party/android_ndk': { 'url': Var('chromium_url') + '/android_ndk.git' + '@' + '8388a2be5421311dc75c5f937aae13d821a27f3d', 'condition': 'checkout_android', @@ -202,15 +212,15 @@ deps = { 'dep_type': 'cipd', }, 'third_party/catapult': { - 'url': Var('chromium_url') + '/catapult.git' + '@' + 'f0b11967c94cba8f7cca91d2da20c98d4420fc25', + 'url': Var('chromium_url') + '/catapult.git' + '@' + '018d397758e54d6a6d3b6ddf28a1784664d63f83', 'condition': 'checkout_android', }, 'third_party/colorama/src': { - 'url': Var('chromium_url') + '/external/colorama.git' + '@' + '799604a1041e9b3bc5d2789ecbd7e8db2e18e6b8', + 'url': Var('chromium_url') + '/external/colorama.git' + '@' + '3de9f013df4b470069d03d250224062e8cf15c49', 'condition': 'checkout_android', }, 'third_party/depot_tools': - Var('chromium_url') + '/chromium/tools/depot_tools.git' + '@' + 'ae1a70891738fb14f64fbb884e00b87ac663aa15', + Var('chromium_url') + '/chromium/tools/depot_tools.git' + '@' + '479e1e9055020c8d1351bf2194d0a606aeca93d5', 'third_party/fuchsia-sdk/sdk': { 'packages': [ { @@ -227,9 +237,9 @@ deps = { 'third_party/googletest/src': Var('chromium_url') + '/external/github.com/google/googletest.git' + '@' + 'af29db7ec28d6df1c7f0f745186884091e602e07', 'third_party/icu': - Var('chromium_url') + '/chromium/deps/icu.git' + '@' + 'da07448619763d1cde255b361324242646f5b268', + Var('chromium_url') + '/chromium/deps/icu.git' + '@' + '1e49ac26ddc712b1ab702f69023cbc57e9ae6628', 'third_party/instrumented_libraries': - Var('chromium_url') + '/chromium/src/third_party/instrumented_libraries.git' + '@' + '7bb87a375ffc3effd17a50f690099dcfb9ee280b', + Var('chromium_url') + '/chromium/src/third_party/instrumented_libraries.git' + '@' + '0f536d22dbed454b1254c7e6d7130eab28fba1fa', 'third_party/ittapi': { # Force checkout ittapi libraries to pass v8 header includes check on # bots that has check_v8_header_includes enabled. @@ -237,7 +247,7 @@ deps = { 'condition': "checkout_ittapi or check_v8_header_includes", }, 'third_party/jinja2': - Var('chromium_url') + '/chromium/src/third_party/jinja2.git' + '@' + '4633bf431193690c3491244f5a0acbe9ac776233', + Var('chromium_url') + '/chromium/src/third_party/jinja2.git' + '@' + '264c07d7e64f2874434a3b8039e101ddf1b01e7e', 'third_party/jsoncpp/source': Var('chromium_url') + '/external/github.com/open-source-parsers/jsoncpp.git'+ '@' + '42e892d96e47b1f6e29844cc705e148ec4856448', 'third_party/logdog/logdog': @@ -255,7 +265,7 @@ deps = { 'condition': 'host_cpu != "s390" and host_cpu != "ppc"' }, 'third_party/perfetto': - Var('android_url') + '/platform/external/perfetto.git' + '@' + '0eba417b2c72264fa825dc21067b9adc9b8adf70', + Var('android_url') + '/platform/external/perfetto.git' + '@' + '0d180f46481a96cbe8340734fa5cdce3bba636c8', 'third_party/protobuf': Var('chromium_url') + '/external/github.com/google/protobuf'+ '@' + '6a59a2ad1f61d9696092f79b6d74368b4d7970a3', 'third_party/requests': { @@ -263,9 +273,9 @@ deps = { 'condition': 'checkout_android', }, 'third_party/zlib': - Var('chromium_url') + '/chromium/src/third_party/zlib.git'+ '@' + '8bbd6c3129b5146489f2321f054e855c347857f4', + Var('chromium_url') + '/chromium/src/third_party/zlib.git'+ '@' + '5edb52d4302d7aef232d585ec9ae27ef5c3c5438', 'tools/clang': - Var('chromium_url') + '/chromium/src/tools/clang.git' + '@' + 'd3df9cc5362e0af4cda798b0612dde39783b3dc0', + Var('chromium_url') + '/chromium/src/tools/clang.git' + '@' + '7a7207a7f2eb0f7f5c9f304a51077a2fd504b3ed', 'tools/luci-go': { 'packages': [ { @@ -499,7 +509,7 @@ hooks = [ '--arch=x64'], }, { - 'name': 'msan_chained_origins', + 'name': 'msan_chained_origins_focal', 'pattern': '.', 'condition': 'checkout_instrumented_libraries', 'action': [ 'python3', @@ -507,11 +517,11 @@ hooks = [ '--no_resume', '--no_auth', '--bucket', 'chromium-instrumented-libraries', - '-s', 'third_party/instrumented_libraries/binaries/msan-chained-origins.tgz.sha1', + '-s', 'third_party/instrumented_libraries/binaries/msan-chained-origins-focal.tgz.sha1', ], }, { - 'name': 'msan_no_origins', + 'name': 'msan_no_origins_focal', 'pattern': '.', 'condition': 'checkout_instrumented_libraries', 'action': [ 'python3', @@ -519,7 +529,7 @@ hooks = [ '--no_resume', '--no_auth', '--bucket', 'chromium-instrumented-libraries', - '-s', 'third_party/instrumented_libraries/binaries/msan-no-origins.tgz.sha1', + '-s', 'third_party/instrumented_libraries/binaries/msan-no-origins-focal.tgz.sha1', ], }, { @@ -557,6 +567,14 @@ hooks = [ 'condition': 'host_os != "aix"', 'action': ['python3', 'tools/clang/scripts/update.py'], }, + { + # This is supposed to support the same set of platforms as 'clang' above. + 'name': 'clang_coverage', + 'pattern': '.', + 'condition': 'checkout_clang_coverage_tools', + 'action': ['python3', 'tools/clang/scripts/update.py', + '--package=coverage_tools'], + }, { 'name': 'clang_tidy', 'pattern': '.', @@ -606,6 +624,16 @@ hooks = [ 'tools/generate-header-include-checks.py', ], }, + { + 'name': 'checkout_v8_builtins_pgo_profiles', + 'pattern': '.', + 'condition': 'checkout_v8_builtins_pgo_profiles', + 'action': [ + 'python3', + 'tools/builtins-pgo/download_profiles.py', + 'download', + ], + }, { # Clean up build dirs for crbug.com/1337238. # After a libc++ roll and revert, .ninja_deps would get into a state diff --git a/deps/v8/PPC_OWNERS b/deps/v8/PPC_OWNERS index 02c2cd757c9cb7..6edd45a6ef2e04 100644 --- a/deps/v8/PPC_OWNERS +++ b/deps/v8/PPC_OWNERS @@ -2,4 +2,3 @@ junyan@redhat.com joransiu@ca.ibm.com midawson@redhat.com mfarazma@redhat.com -vasili.skurydzin@ibm.com diff --git a/deps/v8/PRESUBMIT.py b/deps/v8/PRESUBMIT.py index 03db4c126f346d..5c31d4dfabd776 100644 --- a/deps/v8/PRESUBMIT.py +++ b/deps/v8/PRESUBMIT.py @@ -85,6 +85,7 @@ def _V8PresubmitChecks(input_api, output_api): sys.path.append(input_api.os_path.join( input_api.PresubmitLocalPath(), 'tools')) from v8_presubmit import CppLintProcessor + from v8_presubmit import GCMoleProcessor from v8_presubmit import JSLintProcessor from v8_presubmit import TorqueLintProcessor from v8_presubmit import SourceProcessor @@ -126,6 +127,9 @@ def FilterJSFile(affected_file): if not StatusFilesProcessor().RunOnFiles( input_api.AffectedFiles(include_deletes=True)): results.append(output_api.PresubmitError("Status file check failed")) + if not GCMoleProcessor().RunOnFiles( + input_api.AffectedFiles(include_deletes=False)): + results.append(output_api.PresubmitError("GCMole pattern check failed")) results.extend(input_api.canned_checks.CheckAuthorizedAuthor( input_api, output_api, bot_allowlist=[ 'v8-ci-autoroll-builder@chops-service-accounts.iam.gserviceaccount.com' @@ -257,8 +261,9 @@ def FilterFile(affected_file): files_to_check=(file_inclusion_pattern, ), files_to_skip=files_to_skip) - leading_src_pattern = input_api.re.compile(r'^src/') - dash_dot_slash_pattern = input_api.re.compile(r'[-./]') + leading_src_pattern = input_api.re.compile(r'^src[\\\/]') + dash_dot_slash_pattern = input_api.re.compile(r'[-.\\\/]') + def PathToGuardMacro(path): """Guards should be of the form V8_PATH_TO_FILE_WITHOUT_SRC_H_.""" x = input_api.re.sub(leading_src_pattern, 'v8_', path) diff --git a/deps/v8/S390_OWNERS b/deps/v8/S390_OWNERS index 02c2cd757c9cb7..6edd45a6ef2e04 100644 --- a/deps/v8/S390_OWNERS +++ b/deps/v8/S390_OWNERS @@ -2,4 +2,3 @@ junyan@redhat.com joransiu@ca.ibm.com midawson@redhat.com mfarazma@redhat.com -vasili.skurydzin@ibm.com diff --git a/deps/v8/WATCHLISTS b/deps/v8/WATCHLISTS index a078c5568e4707..d853a0de2a2e36 100644 --- a/deps/v8/WATCHLISTS +++ b/deps/v8/WATCHLISTS @@ -101,11 +101,16 @@ '|test/unittests/heap/cppgc/' \ '|test/unittests/heap/cppgc-js/', }, + 'trap-handler': { + 'filepath': 'src/trap-handler/', + }, + 'tests': { + 'filepath': 'test/', + }, }, 'WATCHLISTS': { 'maglev': [ - 'jgruber+watch@chromium.org', 'leszeks+watch@chromium.org', 'verwaest+watch@chromium.org', 'victorgomes+watch@chromium.org', @@ -122,6 +127,7 @@ ], 'feature_shipping_status': [ 'hablich@chromium.org', + 'saelo+watch@chromium.org', ], 'heap_changes': [ 'hpayer@chromium.org', @@ -168,5 +174,14 @@ 'cppgc': [ 'oilpan-reviews+v8@chromium.org', ], + 'trap-handler': [ + 'ahaas@chromium.org', + 'clemensb@chromium.org', + 'mark@chromium.org', + 'mseaborn@chromium.org', + ], + 'tests': [ + 'almuthanna+watch@chromium.org', + ], }, } diff --git a/deps/v8/base/trace_event/common/trace_event_common.h b/deps/v8/base/trace_event/common/trace_event_common.h index f07f19b3095f57..f2ee4d36b317db 100644 --- a/deps/v8/base/trace_event/common/trace_event_common.h +++ b/deps/v8/base/trace_event/common/trace_event_common.h @@ -208,9 +208,6 @@ #include "base/time/time.h" #include "build/build_config.h" -// Export Perfetto symbols in the same way as //base symbols. -#define PERFETTO_COMPONENT_EXPORT BASE_EXPORT - // Enable legacy trace event macros (e.g., TRACE_EVENT{0,1,2}). #define PERFETTO_ENABLE_LEGACY_TRACE_EVENTS 1 @@ -224,11 +221,6 @@ // variable a unique name based on the line number to prevent name collisions. #define INTERNAL_TRACE_EVENT_UID(name_prefix) PERFETTO_UID(name_prefix) -// Special trace event macro to trace log messages. -// TODO(skyostil): Convert this into a regular typed trace event. -#define TRACE_LOG_MESSAGE(file, message, line) \ - INTERNAL_TRACE_LOG_MESSAGE(file, message, line) - // Declare debug annotation converters for base time types, so they can be // passed as trace event arguments. // TODO(skyostil): Serialize timestamps using perfetto::TracedValue instead. @@ -250,7 +242,8 @@ WriteDebugAnnotation(protos::pbzero::DebugAnnotation* annotation, ::base::Time); } // namespace perfetto // Pull in the tracing macro definitions from Perfetto. -#include "third_party/perfetto/include/perfetto/tracing.h" +#include "third_party/perfetto/include/perfetto/tracing/track_event.h" +#include "third_party/perfetto/include/perfetto/tracing/track_event_legacy.h" namespace perfetto { namespace legacy { @@ -983,10 +976,6 @@ struct BASE_EXPORT TraceTimestampTraits<::base::TimeTicks> { category_group, name, id, \ TRACE_EVENT_FLAG_COPY, arg1_name, arg1_val) -// Special trace event macro to trace log messages. -#define TRACE_LOG_MESSAGE(file, message, line) \ - INTERNAL_TRACE_LOG_MESSAGE(file, message, line) - // TRACE_EVENT_METADATA* events are information related to other // injected events, not events in their own right. #define TRACE_EVENT_METADATA1(category_group, name, arg1_name, arg1_val) \ diff --git a/deps/v8/bazel/config/BUILD.bazel b/deps/v8/bazel/config/BUILD.bazel index 448260de88465d..67454fa90eea46 100644 --- a/deps/v8/bazel/config/BUILD.bazel +++ b/deps/v8/bazel/config/BUILD.bazel @@ -22,6 +22,13 @@ config_setting( }, ) +config_setting( + name = "is_opt", + values = { + "compilation_mode": "opt", + }, +) + config_setting( name = "is_debug", values = { @@ -29,6 +36,14 @@ config_setting( }, ) +selects.config_setting_group( + name = "is_opt_android", + match_all = [ + ":is_opt", + ":is_android", + ], +) + config_setting( name = "platform_cpu_x64", constraint_values = ["@platforms//cpu:x86_64"], diff --git a/deps/v8/bazel/defs.bzl b/deps/v8/bazel/defs.bzl index 77e86ef6f2e646..d4ff96887e7ca7 100644 --- a/deps/v8/bazel/defs.bzl +++ b/deps/v8/bazel/defs.bzl @@ -2,7 +2,12 @@ # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. -FlagInfo = provider(fields = ["value"]) +""" +This module contains helper functions to compile V8. +""" + +FlagInfo = provider("The value of an option.", +fields = ["value"]) def _options_impl(ctx): return FlagInfo(value = ctx.build_setting_value) @@ -151,6 +156,13 @@ def _default_args(): "-fno-integrated-as", ], "//conditions:default": [], + }) + select({ + "@v8//bazel/config:is_opt_android": [ + "-fvisibility=hidden", + "-fvisibility-inlines-hidden", + ], + "//conditions:default": [ + ], }), includes = ["include"], linkopts = select({ @@ -175,29 +187,33 @@ ENABLE_I18N_SUPPORT_DEFINES = [ "-DUNISTR_FROM_CHAR_EXPLICIT=", ] -def _should_emit_noicu_and_icu(noicu_srcs, noicu_deps, icu_srcs, icu_deps): - return noicu_srcs != [] or noicu_deps != [] or icu_srcs != [] or icu_deps != [] +def _should_emit_noicu_and_icu(noicu_srcs, noicu_deps, noicu_defines, icu_srcs, icu_deps, icu_defines): + return noicu_srcs != [] or noicu_deps != [] or noicu_defines != [] or icu_srcs != [] or icu_deps != [] or icu_defines != [] # buildifier: disable=function-docstring def v8_binary( name, srcs, deps = [], + defines = [], includes = [], copts = [], linkopts = [], noicu_srcs = [], noicu_deps = [], + noicu_defines = [], icu_srcs = [], icu_deps = [], + icu_defines = [], **kwargs): default = _default_args() - if _should_emit_noicu_and_icu(noicu_srcs, noicu_deps, icu_srcs, icu_deps): + if _should_emit_noicu_and_icu(noicu_srcs, noicu_deps, noicu_defines, icu_srcs, icu_deps, icu_defines): native.cc_binary( name = "noicu/" + name, srcs = srcs + noicu_srcs, deps = deps + noicu_deps + default.deps, - includes = includes + default.includes, + defines = defines + noicu_defines + default.defines, + includes = includes + ["noicu/"] + default.includes, copts = copts + default.copts, linkopts = linkopts + default.linkopts, **kwargs @@ -206,7 +222,8 @@ def v8_binary( name = "icu/" + name, srcs = srcs + icu_srcs, deps = deps + icu_deps + default.deps, - includes = includes + default.includes, + includes = includes + ["icu/"] + default.includes, + defines = defines + icu_defines + default.defines, copts = copts + default.copts + ENABLE_I18N_SUPPORT_DEFINES, linkopts = linkopts + default.linkopts, **kwargs @@ -216,6 +233,7 @@ def v8_binary( name = name, srcs = srcs, deps = deps + default.deps, + defines = defines + default.defines, includes = includes + default.includes, copts = copts + default.copts, linkopts = linkopts + default.linkopts, @@ -232,16 +250,18 @@ def v8_library( linkopts = [], noicu_srcs = [], noicu_deps = [], + noicu_defines = [], icu_srcs = [], icu_deps = [], + icu_defines = [], **kwargs): default = _default_args() - if _should_emit_noicu_and_icu(noicu_srcs, noicu_deps, icu_srcs, icu_deps): + if _should_emit_noicu_and_icu(noicu_srcs, noicu_deps, noicu_defines, icu_srcs, icu_deps, icu_defines): native.cc_library( name = name + "_noicu", srcs = srcs + noicu_srcs, deps = deps + noicu_deps + default.deps, - includes = includes + default.includes, + includes = includes + ["noicu/"] + default.includes, copts = copts + default.copts, linkopts = linkopts + default.linkopts, alwayslink = 1, @@ -260,7 +280,7 @@ def v8_library( name = name + "_icu", srcs = srcs + icu_srcs, deps = deps + icu_deps + default.deps, - includes = includes + default.includes, + includes = includes + ["icu/"] + default.includes, copts = copts + default.copts + ENABLE_I18N_SUPPORT_DEFINES, linkopts = linkopts + default.linkopts, alwayslink = 1, @@ -288,7 +308,7 @@ def v8_library( **kwargs ) -def _torque_impl(ctx): +def _torque_initializers_impl(ctx): if ctx.workspace_name == "v8": v8root = "." else: @@ -309,7 +329,7 @@ def _torque_impl(ctx): # Generate/declare output files outs = [] for src in ctx.files.srcs: - root, period, ext = src.path.rpartition(".") + root, _period, _ext = src.path.rpartition(".") # Strip v8root if root[:len(v8root)] == v8root: @@ -317,6 +337,84 @@ def _torque_impl(ctx): file = ctx.attr.prefix + "/torque-generated/" + root outs.append(ctx.actions.declare_file(file + "-tq-csa.cc")) outs.append(ctx.actions.declare_file(file + "-tq-csa.h")) + outs += [ctx.actions.declare_file(ctx.attr.prefix + "/torque-generated/" + f) for f in ctx.attr.extras] + ctx.actions.run( + outputs = outs, + inputs = ctx.files.srcs, + arguments = args, + executable = ctx.executable.tool, + mnemonic = "GenTorqueInitializers", + progress_message = "Generating Torque initializers", + ) + return [DefaultInfo(files = depset(outs))] + +_v8_torque_initializers = rule( + implementation = _torque_initializers_impl, + # cfg = v8_target_cpu_transition, + attrs = { + "prefix": attr.string(mandatory = True), + "srcs": attr.label_list(allow_files = True, mandatory = True), + "extras": attr.string_list(), + "tool": attr.label( + allow_files = True, + executable = True, + cfg = "exec", + ), + "args": attr.string_list(), + }, +) + +def v8_torque_initializers(name, noicu_srcs, icu_srcs, args, extras): + _v8_torque_initializers( + name = "noicu/" + name, + prefix = "noicu", + srcs = noicu_srcs, + args = args, + extras = extras, + tool = select({ + "@v8//bazel/config:v8_target_is_32_bits": ":noicu/torque_non_pointer_compression", + "//conditions:default": ":noicu/torque", + }), + ) + _v8_torque_initializers( + name = "icu/" + name, + prefix = "icu", + srcs = icu_srcs, + args = args, + extras = extras, + tool = select({ + "@v8//bazel/config:v8_target_is_32_bits": ":icu/torque_non_pointer_compression", + "//conditions:default": ":icu/torque", + }), + ) + +def _torque_definitions_impl(ctx): + if ctx.workspace_name == "v8": + v8root = "." + else: + v8root = "external/v8" + + # Arguments + args = [] + args += ctx.attr.args + args.append("-o") + args.append(ctx.bin_dir.path + "/" + v8root + "/" + ctx.attr.prefix + "/torque-generated") + args.append("-strip-v8-root") + args.append("-v8-root") + args.append(v8root) + + # Sources + args += [f.path for f in ctx.files.srcs] + + # Generate/declare output files + outs = [] + for src in ctx.files.srcs: + root, _period, _ext = src.path.rpartition(".") + + # Strip v8root + if root[:len(v8root)] == v8root: + root = root[len(v8root):] + file = ctx.attr.prefix + "/torque-generated/" + root outs.append(ctx.actions.declare_file(file + "-tq-inl.inc")) outs.append(ctx.actions.declare_file(file + "-tq.inc")) outs.append(ctx.actions.declare_file(file + "-tq.cc")) @@ -326,13 +424,13 @@ def _torque_impl(ctx): inputs = ctx.files.srcs, arguments = args, executable = ctx.executable.tool, - mnemonic = "GenTorque", - progress_message = "Generating Torque files", + mnemonic = "GenTorqueDefinitions", + progress_message = "Generating Torque definitions", ) return [DefaultInfo(files = depset(outs))] -_v8_torque = rule( - implementation = _torque_impl, +_v8_torque_definitions = rule( + implementation = _torque_definitions_impl, # cfg = v8_target_cpu_transition, attrs = { "prefix": attr.string(mandatory = True), @@ -347,31 +445,33 @@ _v8_torque = rule( }, ) -def v8_torque(name, noicu_srcs, icu_srcs, args, extras): - _v8_torque( +def v8_torque_definitions(name, noicu_srcs, icu_srcs, args, extras): + _v8_torque_definitions( name = "noicu/" + name, prefix = "noicu", srcs = noicu_srcs, args = args, extras = extras, tool = select({ - "@v8//bazel/config:v8_target_is_32_bits": ":torque_non_pointer_compression", - "//conditions:default": ":torque", + "@v8//bazel/config:v8_target_is_32_bits": ":noicu/torque_non_pointer_compression", + "//conditions:default": ":noicu/torque", }), ) - _v8_torque( + _v8_torque_definitions( name = "icu/" + name, prefix = "icu", srcs = icu_srcs, args = args, extras = extras, tool = select({ - "@v8//bazel/config:v8_target_is_32_bits": ":torque_non_pointer_compression", - "//conditions:default": ":torque", + "@v8//bazel/config:v8_target_is_32_bits": ":icu/torque_non_pointer_compression", + "//conditions:default": ":icu/torque", }), ) -def _v8_target_cpu_transition_impl(settings, attr): +def _v8_target_cpu_transition_impl(settings, + attr, # @unused + ): # Check for an existing v8_target_cpu flag. if "@v8//bazel/config:v8_target_cpu" in settings: if settings["@v8//bazel/config:v8_target_cpu"] != "none": @@ -499,10 +599,10 @@ def build_config_content(cpu, icu): ("is_asan", "false"), ("is_cfi", "false"), ("is_clang", "true"), + ("is_clang_coverage", "false"), ("is_component_build", "false"), ("is_debug", "false"), ("is_full_debug", "false"), - ("is_gcov_coverage", "false"), ("is_msan", "false"), ("is_tsan", "false"), ("is_ubsan_vptr", "false"), @@ -525,7 +625,18 @@ def build_config_content(cpu, icu): ("v8_enable_single_generation", "false"), ("v8_enable_sandbox", "false"), ("v8_enable_shared_ro_heap", "false"), + ("v8_disable_write_barriers", "false"), ("v8_target_cpu", cpu), + ("v8_code_comments", "false"), + ("v8_enable_debug_code", "false"), + ("v8_enable_verify_heap", "false"), + ("v8_enable_slow_dchecks", "false"), + ("v8_enable_maglev", "false"), + ("v8_enable_turbofan", "true"), + ("v8_enable_disassembler", "false"), + ("is_DEBUG_defined", "false"), + ("v8_enable_gdbjit", "false"), + ("v8_jitless", "false"), ]) # TODO(victorgomes): Create a rule (instead of a macro), that can diff --git a/deps/v8/build_overrides/build.gni b/deps/v8/build_overrides/build.gni index 4e0c284efaeae9..64abd3e92a5dd8 100644 --- a/deps/v8/build_overrides/build.gni +++ b/deps/v8/build_overrides/build.gni @@ -32,6 +32,9 @@ use_perfetto_client_library = false # Some non-Chromium builds don't support building java targets. enable_java_templates = false +# Enables assertions on safety checks in libc++. +enable_safe_libcxx = true + # Allows different projects to specify their own suppressions files. asan_suppressions_file = "//build/sanitizers/asan_suppressions.cc" lsan_suppressions_file = "//build/sanitizers/lsan_suppressions.cc" diff --git a/deps/v8/gni/snapshot_toolchain.gni b/deps/v8/gni/snapshot_toolchain.gni index 99de816372bf9c..c7faa8ca5897a6 100644 --- a/deps/v8/gni/snapshot_toolchain.gni +++ b/deps/v8/gni/snapshot_toolchain.gni @@ -104,6 +104,10 @@ if (v8_snapshot_toolchain == "") { # cross compile Windows arm64 with host toolchain. v8_snapshot_toolchain = host_toolchain } + } else if (host_cpu == "arm64" && current_cpu == "arm64" && + host_os == "mac") { + # cross compile iOS arm64 with host_toolchain + v8_snapshot_toolchain = host_toolchain } } diff --git a/deps/v8/gni/v8.gni b/deps/v8/gni/v8.gni index 3f093597faccdc..d38f376b94ae4c 100644 --- a/deps/v8/gni/v8.gni +++ b/deps/v8/gni/v8.gni @@ -2,17 +2,15 @@ # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. +import("//build/config/compiler/pgo/pgo.gni") import("//build/config/gclient_args.gni") +import("//build/config/ios/config.gni") import("//build/config/sanitizers/sanitizers.gni") import("//build/config/v8_target_cpu.gni") import("release_branch_toggle.gni") import("split_static_library.gni") declare_args() { - # Set flags for tracking code coverage. Uses gcov with gcc and sanitizer - # coverage with clang. - v8_code_coverage = false - # Includes files needed for correctness fuzzing. v8_correctness_fuzzer = false @@ -36,6 +34,9 @@ declare_args() { # the JS builtins sources and the start snapshot. v8_use_external_startup_data = "" + # Includes profiles to optimize builtins. + v8_enable_builtins_optimization = "" + # Enable ECMAScript Internationalization API. Enabling this feature will # add a dependency on the ICU library. v8_enable_i18n_support = true @@ -63,10 +64,19 @@ declare_args() { # Sets -DV8_LITE_MODE. v8_enable_lite_mode = false + # Enable the Turbofan compiler. + # Sets -dV8_ENABLE_TURBOFAN. + v8_enable_turbofan = "" + + # Enable the Maglev compiler. + # Sets -dV8_ENABLE_MAGLEV + v8_enable_maglev = "" + # Include support for WebAssembly. If disabled, the 'WebAssembly' global # will not be available, and embedder APIs to generate WebAssembly modules # will fail. Also, asm.js will not be translated to WebAssembly and will be # executed as standard JavaScript instead. + # Sets -dV8_ENABLE_WEBASSEMBLY. v8_enable_webassembly = "" # Enable 256-bit long vector re-vectorization pass in WASM compilation pipeline. @@ -81,12 +91,6 @@ declare_args() { # Scan the call stack conservatively during garbage collection. v8_enable_conservative_stack_scanning = false - # Use the object start bitmap for inner pointer resolution. - v8_enable_inner_pointer_resolution_osb = false - - # Use the marking bitmap for inner pointer resolution. - v8_enable_inner_pointer_resolution_mb = false - v8_enable_google_benchmark = false cppgc_is_standalone = false @@ -97,6 +101,12 @@ declare_args() { # Enable young generation in cppgc. cppgc_enable_young_generation = false + # Enables a slim write barrier that only performs a single check in the fast + # path and delegates all further checks to a slow path call. This is fast + # in a setting with few slow-path checks, i.e., with disabled young generation + # GC. + cppgc_enable_slim_write_barrier = true + # Enable pointer compression in cppgc. cppgc_enable_pointer_compression = false @@ -107,6 +117,20 @@ declare_args() { # Enable advanced BigInt algorithms, costing about 10-30 KB binary size # depending on platform. Disabled on Android to save binary size. v8_advanced_bigint_algorithms = !is_android + + # TODO: macros for determining endian type are clang specific. + v8_use_libm_trig_functions = is_clang + + # iOS device does not support executable code pages. Not we + # use target_os == "ios" here because it isn't equivalent + # to is_ios (is_ios is based on host_os). + target_is_ios_device = target_os == "ios" && target_environment == "device" + + # Location of icu. + v8_icu_path = "//third_party/icu" + + # Location of zlib. + v8_zlib_path = "//third_party/zlib" } if (v8_use_external_startup_data == "") { @@ -125,13 +149,36 @@ if (build_with_chromium && use_perfetto_client_library) { v8_use_perfetto = true } +# Includes profiles to optimize builtins if +# * it is a Chromium build, and +# * Chromium builds with optimization. +# If no profiles are downloaded during gclient runhooks, optimization fails +# silently. +if (v8_enable_builtins_optimization == "") { + v8_enable_builtins_optimization = build_with_chromium && chrome_pgo_phase == 2 +} + +# TODO(jgruber): Move v8_jitless from BUILD.gn here as these +# all depend on each other and really should be derived from +# v8_jitless. # WebAssembly is enabled by default, except in lite mode. if (v8_enable_webassembly == "") { - v8_enable_webassembly = !v8_enable_lite_mode + # iOS (non-simulator) does not have executable pages for 3rd party + # applications yet so disable webassembly. + v8_enable_webassembly = !v8_enable_lite_mode && !target_is_ios_device } assert(!(v8_enable_webassembly && v8_enable_lite_mode), "Webassembly is not available in lite mode.") +# Turbofan is enabled by default, except in lite mode. +if (v8_enable_turbofan == "") { + # iOS (non-simulator) does not have executable pages for 3rd party + # applications yet so disable turbofan. + v8_enable_turbofan = !v8_enable_lite_mode && !target_is_ios_device +} +assert(v8_enable_turbofan || !v8_enable_webassembly, + "Webassembly is not available when Turbofan is disabled.") + # Points to // in v8 stand-alone or to //v8/ in chromium. We need absolute # paths for all configs in templates as they are shared in different # subdirectories. @@ -172,13 +219,6 @@ if (!is_debug) { ] } -if (v8_code_coverage && !is_clang) { - v8_add_configs += [ - v8_path_prefix + ":v8_gcov_coverage_cflags", - v8_path_prefix + ":v8_gcov_coverage_ldflags", - ] -} - if (v8_symbol_level != symbol_level) { v8_remove_configs += [ "//build/config/compiler:default_symbols" ] if (v8_symbol_level == 0) { @@ -260,23 +300,13 @@ template("v8_executable") { # For enabling ASLR. ldflags = [ "-pie" ] } - if (defined(testonly) && testonly && v8_code_coverage) { - # Only add code coverage cflags for non-test files for performance - # reasons. - if (is_clang) { - configs -= [ "//build/config/sanitizers:default_sanitizer_flags" ] - configs += - [ "//build/config/sanitizers:default_sanitizer_flags_but_coverage" ] - } else { - configs -= [ v8_path_prefix + ":v8_gcov_coverage_cflags" ] - } - } deps += [ v8_path_prefix + ":v8_dump_build_config" ] } } template("v8_component") { component(target_name) { + output_name = target_name forward_variables_from(invoker, "*", [ diff --git a/deps/v8/include/cppgc/cross-thread-persistent.h b/deps/v8/include/cppgc/cross-thread-persistent.h index 1fa28afa136eb4..a5f8bac0b1013e 100644 --- a/deps/v8/include/cppgc/cross-thread-persistent.h +++ b/deps/v8/include/cppgc/cross-thread-persistent.h @@ -148,10 +148,11 @@ class BasicCrossThreadPersistent final : public CrossThreadPersistentBase, template ::value>> BasicCrossThreadPersistent( internal::BasicMember + MemberCheckingPolicy, MemberStorageType> member, const SourceLocation& loc = SourceLocation::Current()) : BasicCrossThreadPersistent(member.Get(), loc) {} @@ -230,10 +231,11 @@ class BasicCrossThreadPersistent final : public CrossThreadPersistentBase, // Assignment from member. template ::value>> BasicCrossThreadPersistent& operator=( internal::BasicMember + MemberCheckingPolicy, MemberStorageType> member) { return operator=(member.Get()); } diff --git a/deps/v8/include/cppgc/heap-consistency.h b/deps/v8/include/cppgc/heap-consistency.h index 35c59ed1ad417f..eb7fdaee8c3c02 100644 --- a/deps/v8/include/cppgc/heap-consistency.h +++ b/deps/v8/include/cppgc/heap-consistency.h @@ -62,10 +62,10 @@ class HeapConsistency final { * \returns whether a write barrier is needed and which barrier to invoke. */ template + typename CheckingPolicy, typename StorageType> static V8_INLINE WriteBarrierType GetWriteBarrierType( const internal::BasicMember& value, + CheckingPolicy, StorageType>& value, WriteBarrierParams& params) { return internal::WriteBarrier::GetWriteBarrierType( value.GetRawSlot(), value.GetRawStorage(), params); diff --git a/deps/v8/include/cppgc/internal/api-constants.h b/deps/v8/include/cppgc/internal/api-constants.h index 023426e94b04c9..453ab88b461eb7 100644 --- a/deps/v8/include/cppgc/internal/api-constants.h +++ b/deps/v8/include/cppgc/internal/api-constants.h @@ -32,7 +32,7 @@ static constexpr uint16_t kFullyConstructedBitMask = uint16_t{1}; static constexpr size_t kPageSize = size_t{1} << 17; -#if defined(V8_TARGET_ARCH_ARM64) && defined(V8_OS_MACOS) +#if defined(V8_TARGET_ARCH_ARM64) && defined(V8_OS_DARWIN) constexpr size_t kGuardPageSize = 0; #else constexpr size_t kGuardPageSize = 4096; @@ -57,6 +57,9 @@ static constexpr size_t kMaxSupportedAlignment = 2 * kDefaultAlignment; // Granularity of heap allocations. constexpr size_t kAllocationGranularity = sizeof(void*); +// Default cacheline size. +constexpr size_t kCachelineSize = 64; + } // namespace api_constants } // namespace internal diff --git a/deps/v8/include/cppgc/internal/gc-info.h b/deps/v8/include/cppgc/internal/gc-info.h index e8f90fed57109f..08ffd411a8efab 100644 --- a/deps/v8/include/cppgc/internal/gc-info.h +++ b/deps/v8/include/cppgc/internal/gc-info.h @@ -10,6 +10,7 @@ #include #include "cppgc/internal/finalizer-trait.h" +#include "cppgc/internal/logging.h" #include "cppgc/internal/name-trait.h" #include "cppgc/trace-trait.h" #include "v8config.h" // NOLINT(build/include_directory) @@ -20,12 +21,12 @@ namespace internal { using GCInfoIndex = uint16_t; struct V8_EXPORT EnsureGCInfoIndexTrait final { - // Acquires a new GC info object and returns the index. In addition, also - // updates `registered_index` atomically. + // Acquires a new GC info object and updates `registered_index` with the index + // that identifies that new info accordingly. template - V8_INLINE static GCInfoIndex EnsureIndex( + V8_INLINE static void EnsureIndex( std::atomic& registered_index) { - return EnsureGCInfoIndexTraitDispatch{}(registered_index); + EnsureGCInfoIndexTraitDispatch{}(registered_index); } private: @@ -34,38 +35,32 @@ struct V8_EXPORT EnsureGCInfoIndexTrait final { bool = NameTrait::HasNonHiddenName()> struct EnsureGCInfoIndexTraitDispatch; - static GCInfoIndex EnsureGCInfoIndexPolymorphic(std::atomic&, - TraceCallback, - FinalizationCallback, - NameCallback); - static GCInfoIndex EnsureGCInfoIndexPolymorphic(std::atomic&, - TraceCallback, - FinalizationCallback); - static GCInfoIndex EnsureGCInfoIndexPolymorphic(std::atomic&, - TraceCallback, NameCallback); - static GCInfoIndex EnsureGCInfoIndexPolymorphic(std::atomic&, - TraceCallback); - static GCInfoIndex EnsureGCInfoIndexNonPolymorphic(std::atomic&, - TraceCallback, - FinalizationCallback, - NameCallback); - static GCInfoIndex EnsureGCInfoIndexNonPolymorphic(std::atomic&, - TraceCallback, - FinalizationCallback); - static GCInfoIndex EnsureGCInfoIndexNonPolymorphic(std::atomic&, - TraceCallback, - NameCallback); - static GCInfoIndex EnsureGCInfoIndexNonPolymorphic(std::atomic&, - TraceCallback); + static void V8_PRESERVE_MOST + EnsureGCInfoIndexPolymorphic(std::atomic&, TraceCallback, + FinalizationCallback, NameCallback); + static void V8_PRESERVE_MOST EnsureGCInfoIndexPolymorphic( + std::atomic&, TraceCallback, FinalizationCallback); + static void V8_PRESERVE_MOST EnsureGCInfoIndexPolymorphic( + std::atomic&, TraceCallback, NameCallback); + static void V8_PRESERVE_MOST + EnsureGCInfoIndexPolymorphic(std::atomic&, TraceCallback); + static void V8_PRESERVE_MOST + EnsureGCInfoIndexNonPolymorphic(std::atomic&, TraceCallback, + FinalizationCallback, NameCallback); + static void V8_PRESERVE_MOST EnsureGCInfoIndexNonPolymorphic( + std::atomic&, TraceCallback, FinalizationCallback); + static void V8_PRESERVE_MOST EnsureGCInfoIndexNonPolymorphic( + std::atomic&, TraceCallback, NameCallback); + static void V8_PRESERVE_MOST + EnsureGCInfoIndexNonPolymorphic(std::atomic&, TraceCallback); }; #define DISPATCH(is_polymorphic, has_finalizer, has_non_hidden_name, function) \ template \ struct EnsureGCInfoIndexTrait::EnsureGCInfoIndexTraitDispatch< \ T, is_polymorphic, has_finalizer, has_non_hidden_name> { \ - V8_INLINE GCInfoIndex \ - operator()(std::atomic& registered_index) { \ - return function; \ + V8_INLINE void operator()(std::atomic& registered_index) { \ + function; \ } \ }; @@ -143,9 +138,16 @@ struct GCInfoTrait final { static_assert(sizeof(T), "T must be fully defined"); static std::atomic registered_index; // Uses zero initialization. - const GCInfoIndex index = registered_index.load(std::memory_order_acquire); - return index ? index - : EnsureGCInfoIndexTrait::EnsureIndex(registered_index); + GCInfoIndex index = registered_index.load(std::memory_order_acquire); + if (V8_UNLIKELY(!index)) { + EnsureGCInfoIndexTrait::EnsureIndex(registered_index); + // Slow path call uses V8_PRESERVE_MOST which does not support return + // values (also preserves RAX). Avoid out parameter by just reloading the + // value here which at this point is guaranteed to be set. + index = registered_index.load(std::memory_order_acquire); + CPPGC_DCHECK(index != 0); + } + return index; } }; diff --git a/deps/v8/include/cppgc/internal/member-storage.h b/deps/v8/include/cppgc/internal/member-storage.h index 0eb6382070c4da..3dfafc4b08cd11 100644 --- a/deps/v8/include/cppgc/internal/member-storage.h +++ b/deps/v8/include/cppgc/internal/member-storage.h @@ -17,6 +17,11 @@ namespace cppgc { namespace internal { +enum class WriteBarrierSlotType { + kCompressed, + kUncompressed, +}; + #if defined(CPPGC_POINTER_COMPRESSION) #if defined(__clang__) @@ -30,16 +35,16 @@ namespace internal { #define CPPGC_REQUIRE_CONSTANT_INIT #endif // defined(__clang__) -class CageBaseGlobal final { +class V8_EXPORT CageBaseGlobal final { public: V8_INLINE CPPGC_CONST static uintptr_t Get() { CPPGC_DCHECK(IsBaseConsistent()); - return g_base_; + return g_base_.base; } V8_INLINE CPPGC_CONST static bool IsSet() { CPPGC_DCHECK(IsBaseConsistent()); - return (g_base_ & ~kLowerHalfWordMask) != 0; + return (g_base_.base & ~kLowerHalfWordMask) != 0; } private: @@ -47,12 +52,15 @@ class CageBaseGlobal final { static constexpr uintptr_t kLowerHalfWordMask = (api_constants::kCagedHeapReservationAlignment - 1); - static V8_EXPORT uintptr_t g_base_ CPPGC_REQUIRE_CONSTANT_INIT; + static union alignas(api_constants::kCachelineSize) Base { + uintptr_t base; + char cache_line[api_constants::kCachelineSize]; + } g_base_ CPPGC_REQUIRE_CONSTANT_INIT; CageBaseGlobal() = delete; V8_INLINE static bool IsBaseConsistent() { - return kLowerHalfWordMask == (g_base_ & kLowerHalfWordMask); + return kLowerHalfWordMask == (g_base_.base & kLowerHalfWordMask); } friend class CageBaseGlobalUpdater; @@ -64,6 +72,8 @@ class CageBaseGlobal final { class V8_TRIVIAL_ABI CompressedPointer final { public: using IntegralType = uint32_t; + static constexpr auto kWriteBarrierSlotType = + WriteBarrierSlotType::kCompressed; V8_INLINE CompressedPointer() : value_(0u) {} V8_INLINE explicit CompressedPointer(const void* ptr) @@ -173,6 +183,8 @@ class V8_TRIVIAL_ABI CompressedPointer final { class V8_TRIVIAL_ABI RawPointer final { public: using IntegralType = uintptr_t; + static constexpr auto kWriteBarrierSlotType = + WriteBarrierSlotType::kUncompressed; V8_INLINE RawPointer() : ptr_(nullptr) {} V8_INLINE explicit RawPointer(const void* ptr) : ptr_(ptr) {} @@ -225,9 +237,9 @@ class V8_TRIVIAL_ABI RawPointer final { }; #if defined(CPPGC_POINTER_COMPRESSION) -using MemberStorage = CompressedPointer; +using DefaultMemberStorage = CompressedPointer; #else // !defined(CPPGC_POINTER_COMPRESSION) -using MemberStorage = RawPointer; +using DefaultMemberStorage = RawPointer; #endif // !defined(CPPGC_POINTER_COMPRESSION) } // namespace internal diff --git a/deps/v8/include/cppgc/internal/pointer-policies.h b/deps/v8/include/cppgc/internal/pointer-policies.h index 8455b3df8196b4..06fa884f49f34b 100644 --- a/deps/v8/include/cppgc/internal/pointer-policies.h +++ b/deps/v8/include/cppgc/internal/pointer-policies.h @@ -33,20 +33,53 @@ struct DijkstraWriteBarrierPolicy { // barrier doesn't break the tri-color invariant. } + template V8_INLINE static void AssigningBarrier(const void* slot, const void* value) { +#ifdef CPPGC_SLIM_WRITE_BARRIER + if (V8_UNLIKELY(WriteBarrier::IsEnabled())) + WriteBarrier::CombinedWriteBarrierSlow(slot); +#else // !CPPGC_SLIM_WRITE_BARRIER WriteBarrier::Params params; const WriteBarrier::Type type = WriteBarrier::GetWriteBarrierType(slot, value, params); WriteBarrier(type, params, slot, value); +#endif // !CPPGC_SLIM_WRITE_BARRIER } + template + V8_INLINE static void AssigningBarrier(const void* slot, RawPointer storage) { + static_assert( + SlotType == WriteBarrierSlotType::kUncompressed, + "Assigning storages of Member and UncompressedMember is not supported"); +#ifdef CPPGC_SLIM_WRITE_BARRIER + if (V8_UNLIKELY(WriteBarrier::IsEnabled())) + WriteBarrier::CombinedWriteBarrierSlow(slot); +#else // !CPPGC_SLIM_WRITE_BARRIER + WriteBarrier::Params params; + const WriteBarrier::Type type = + WriteBarrier::GetWriteBarrierType(slot, storage, params); + WriteBarrier(type, params, slot, storage.Load()); +#endif // !CPPGC_SLIM_WRITE_BARRIER + } + +#if defined(CPPGC_POINTER_COMPRESSION) + template V8_INLINE static void AssigningBarrier(const void* slot, - MemberStorage storage) { + CompressedPointer storage) { + static_assert( + SlotType == WriteBarrierSlotType::kCompressed, + "Assigning storages of Member and UncompressedMember is not supported"); +#ifdef CPPGC_SLIM_WRITE_BARRIER + if (V8_UNLIKELY(WriteBarrier::IsEnabled())) + WriteBarrier::CombinedWriteBarrierSlow(slot); +#else // !CPPGC_SLIM_WRITE_BARRIER WriteBarrier::Params params; const WriteBarrier::Type type = WriteBarrier::GetWriteBarrierType(slot, storage, params); WriteBarrier(type, params, slot, storage.Load()); +#endif // !CPPGC_SLIM_WRITE_BARRIER } +#endif // defined(CPPGC_POINTER_COMPRESSION) private: V8_INLINE static void WriteBarrier(WriteBarrier::Type type, @@ -68,7 +101,9 @@ struct DijkstraWriteBarrierPolicy { struct NoWriteBarrierPolicy { V8_INLINE static void InitializingBarrier(const void*, const void*) {} + template V8_INLINE static void AssigningBarrier(const void*, const void*) {} + template V8_INLINE static void AssigningBarrier(const void*, MemberStorage) {} }; @@ -197,7 +232,8 @@ template class BasicPersistent; template + typename CheckingPolicy = DefaultMemberCheckingPolicy, + typename StorageType = DefaultMemberStorage> class BasicMember; } // namespace internal diff --git a/deps/v8/include/cppgc/internal/write-barrier.h b/deps/v8/include/cppgc/internal/write-barrier.h index 37bc5c973ef995..566724d30a0901 100644 --- a/deps/v8/include/cppgc/internal/write-barrier.h +++ b/deps/v8/include/cppgc/internal/write-barrier.h @@ -70,6 +70,7 @@ class V8_EXPORT WriteBarrier final { static V8_INLINE Type GetWriteBarrierType(const void* slot, const void* value, Params& params); // Returns the required write barrier for a given `slot` and `value`. + template static V8_INLINE Type GetWriteBarrierType(const void* slot, MemberStorage, Params& params); // Returns the required write barrier for a given `slot`. @@ -79,6 +80,15 @@ class V8_EXPORT WriteBarrier final { // Returns the required write barrier for a given `value`. static V8_INLINE Type GetWriteBarrierType(const void* value, Params& params); +#ifdef CPPGC_SLIM_WRITE_BARRIER + // A write barrier that combines `GenerationalBarrier()` and + // `DijkstraMarkingBarrier()`. We only pass a single parameter here to clobber + // as few registers as possible. + template + static V8_NOINLINE void V8_PRESERVE_MOST + CombinedWriteBarrierSlow(const void* slot); +#endif // CPPGC_SLIM_WRITE_BARRIER + static V8_INLINE void DijkstraMarkingBarrier(const Params& params, const void* object); static V8_INLINE void DijkstraMarkingBarrierRange( @@ -163,7 +173,8 @@ class V8_EXPORT WriteBarrierTypeForCagedHeapPolicy final { return ValueModeDispatch::Get(slot, value, params, callback); } - template + template static V8_INLINE WriteBarrier::Type Get(const void* slot, MemberStorage value, WriteBarrier::Params& params, HeapHandleCallback callback) { @@ -207,7 +218,7 @@ class V8_EXPORT WriteBarrierTypeForCagedHeapPolicy final { template <> struct WriteBarrierTypeForCagedHeapPolicy::ValueModeDispatch< WriteBarrier::ValueMode::kValuePresent> { - template + template static V8_INLINE WriteBarrier::Type Get(const void* slot, MemberStorage storage, WriteBarrier::Params& params, @@ -305,11 +316,9 @@ class V8_EXPORT WriteBarrierTypeForNonCagedHeapPolicy final { } template - static V8_INLINE WriteBarrier::Type Get(const void* slot, MemberStorage value, + static V8_INLINE WriteBarrier::Type Get(const void* slot, RawPointer value, WriteBarrier::Params& params, HeapHandleCallback callback) { - // `MemberStorage` will always be `RawPointer` for non-caged heap builds. - // Just convert to `void*` in this case. return ValueModeDispatch::Get(slot, value.Load(), params, callback); } @@ -383,6 +392,7 @@ WriteBarrier::Type WriteBarrier::GetWriteBarrierType( } // static +template WriteBarrier::Type WriteBarrier::GetWriteBarrierType( const void* slot, MemberStorage value, WriteBarrier::Params& params) { return WriteBarrierTypePolicy::Get(slot, value, diff --git a/deps/v8/include/cppgc/macros.h b/deps/v8/include/cppgc/macros.h index 030f397e3df15c..a9ac22d7af0d0b 100644 --- a/deps/v8/include/cppgc/macros.h +++ b/deps/v8/include/cppgc/macros.h @@ -11,7 +11,10 @@ namespace cppgc { -// Use if the object is only stack allocated. +// Use CPPGC_STACK_ALLOCATED if the object is only stack allocated. +// Add the CPPGC_STACK_ALLOCATED_IGNORE annotation on a case-by-case basis when +// enforcement of CPPGC_STACK_ALLOCATED should be suppressed. +#if defined(__clang__) #define CPPGC_STACK_ALLOCATED() \ public: \ using IsStackAllocatedTypeMarker CPPGC_UNUSED = int; \ @@ -20,6 +23,12 @@ namespace cppgc { void* operator new(size_t) = delete; \ void* operator new(size_t, void*) = delete; \ static_assert(true, "Force semicolon.") +#define CPPGC_STACK_ALLOCATED_IGNORE(bug_or_reason) \ + __attribute__((annotate("stack_allocated_ignore"))) +#else // !defined(__clang__) +#define CPPGC_STACK_ALLOCATED() static_assert(true, "Force semicolon.") +#define CPPGC_STACK_ALLOCATED_IGNORE(bug_or_reason) +#endif // !defined(__clang__) } // namespace cppgc diff --git a/deps/v8/include/cppgc/member.h b/deps/v8/include/cppgc/member.h index 9bc383634f18ea..b6382a02358744 100644 --- a/deps/v8/include/cppgc/member.h +++ b/deps/v8/include/cppgc/member.h @@ -28,13 +28,11 @@ namespace internal { // MemberBase always refers to the object as const object and defers to // BasicMember on casting to the right type as needed. +template class V8_TRIVIAL_ABI MemberBase { public: -#if defined(CPPGC_POINTER_COMPRESSION) - using RawStorage = CompressedPointer; -#else // !defined(CPPGC_POINTER_COMPRESSION) - using RawStorage = RawPointer; -#endif // !defined(CPPGC_POINTER_COMPRESSION) + using RawStorage = StorageType; + protected: struct AtomicInitializerTag {}; @@ -75,16 +73,19 @@ class V8_TRIVIAL_ABI MemberBase { // The basic class from which all Member classes are 'generated'. template -class V8_TRIVIAL_ABI BasicMember final : private MemberBase, + typename CheckingPolicy, typename StorageType> +class V8_TRIVIAL_ABI BasicMember final : private MemberBase, private CheckingPolicy { + using Base = MemberBase; + public: using PointeeType = T; + using RawStorage = typename Base::RawStorage; V8_INLINE constexpr BasicMember() = default; - V8_INLINE constexpr BasicMember(std::nullptr_t) {} // NOLINT - V8_INLINE BasicMember(SentinelPointer s) : MemberBase(s) {} // NOLINT - V8_INLINE BasicMember(T* raw) : MemberBase(raw) { // NOLINT + V8_INLINE constexpr BasicMember(std::nullptr_t) {} // NOLINT + V8_INLINE BasicMember(SentinelPointer s) : Base(s) {} // NOLINT + V8_INLINE BasicMember(T* raw) : Base(raw) { // NOLINT InitializingWriteBarrier(raw); this->CheckPointer(Get()); } @@ -94,13 +95,13 @@ class V8_TRIVIAL_ABI BasicMember final : private MemberBase, // Atomic ctor. Using the AtomicInitializerTag forces BasicMember to // initialize using atomic assignments. This is required for preventing // data races with concurrent marking. - using AtomicInitializerTag = MemberBase::AtomicInitializerTag; + using AtomicInitializerTag = typename Base::AtomicInitializerTag; V8_INLINE BasicMember(std::nullptr_t, AtomicInitializerTag atomic) - : MemberBase(nullptr, atomic) {} + : Base(nullptr, atomic) {} V8_INLINE BasicMember(SentinelPointer s, AtomicInitializerTag atomic) - : MemberBase(s, atomic) {} + : Base(s, atomic) {} V8_INLINE BasicMember(T* raw, AtomicInitializerTag atomic) - : MemberBase(raw, atomic) { + : Base(raw, atomic) { InitializingWriteBarrier(raw); this->CheckPointer(Get()); } @@ -119,7 +120,7 @@ class V8_TRIVIAL_ABI BasicMember final : private MemberBase, std::enable_if_t>* = nullptr> V8_INLINE BasicMember( // NOLINT const BasicMember& other) + OtherCheckingPolicy, StorageType>& other) : BasicMember(other.GetRawStorage()) {} template >* = nullptr> V8_INLINE BasicMember( // NOLINT const BasicMember& other) + OtherCheckingPolicy, StorageType>& other) : BasicMember(other.Get()) {} // Move ctor. @@ -142,8 +143,9 @@ class V8_TRIVIAL_ABI BasicMember final : private MemberBase, template >* = nullptr> - V8_INLINE BasicMember(BasicMember&& other) noexcept + V8_INLINE BasicMember( + BasicMember&& other) noexcept : BasicMember(other.GetRawStorage()) { other.Clear(); } @@ -151,8 +153,9 @@ class V8_TRIVIAL_ABI BasicMember final : private MemberBase, template >* = nullptr> - V8_INLINE BasicMember(BasicMember&& other) noexcept + V8_INLINE BasicMember( + BasicMember&& other) noexcept : BasicMember(other.Get()) { other.Clear(); } @@ -179,7 +182,7 @@ class V8_TRIVIAL_ABI BasicMember final : private MemberBase, typename OtherCheckingPolicy> V8_INLINE BasicMember& operator=( const BasicMember& other) { + OtherCheckingPolicy, StorageType>& other) { if constexpr (internal::IsDecayedSameV) { return operator=(other.GetRawStorage()); } else { @@ -201,8 +204,8 @@ class V8_TRIVIAL_ABI BasicMember final : private MemberBase, template V8_INLINE BasicMember& operator=( - BasicMember&& other) noexcept { + BasicMember&& other) noexcept { if constexpr (internal::IsDecayedSameV) { operator=(other.GetRawStorage()); } else { @@ -226,7 +229,7 @@ class V8_TRIVIAL_ABI BasicMember final : private MemberBase, } V8_INLINE BasicMember& operator=(T* other) { - SetRawAtomic(other); + Base::SetRawAtomic(other); AssigningWriteBarrier(other); this->CheckPointer(Get()); return *this; @@ -237,20 +240,20 @@ class V8_TRIVIAL_ABI BasicMember final : private MemberBase, return *this; } V8_INLINE BasicMember& operator=(SentinelPointer s) { - SetRawAtomic(s); + Base::SetRawAtomic(s); return *this; } template V8_INLINE void Swap(BasicMember& other) { + OtherCheckingPolicy, StorageType>& other) { auto tmp = GetRawStorage(); *this = other; other = tmp; } - V8_INLINE explicit operator bool() const { return !IsCleared(); } + V8_INLINE explicit operator bool() const { return !Base::IsCleared(); } V8_INLINE operator T*() const { return Get(); } V8_INLINE T* operator->() const { return Get(); } V8_INLINE T& operator*() const { return *Get(); } @@ -264,10 +267,12 @@ class V8_TRIVIAL_ABI BasicMember final : private MemberBase, // The const_cast below removes the constness from MemberBase storage. The // following static_cast re-adds any constness if specified through the // user-visible template parameter T. - return static_cast(const_cast(MemberBase::GetRaw())); + return static_cast(const_cast(Base::GetRaw())); } - V8_INLINE void Clear() { SetRawStorageAtomic(RawStorage{}); } + V8_INLINE void Clear() { + Base::SetRawStorageAtomic(RawStorage{}); + } V8_INLINE T* Release() { T* result = Get(); @@ -276,41 +281,44 @@ class V8_TRIVIAL_ABI BasicMember final : private MemberBase, } V8_INLINE const T** GetSlotForTesting() const { - return reinterpret_cast(GetRawSlot()); + return reinterpret_cast(Base::GetRawSlot()); } V8_INLINE RawStorage GetRawStorage() const { - return MemberBase::GetRawStorage(); + return Base::GetRawStorage(); } private: - V8_INLINE explicit BasicMember(RawStorage raw) : MemberBase(raw) { + V8_INLINE explicit BasicMember(RawStorage raw) : Base(raw) { InitializingWriteBarrier(Get()); this->CheckPointer(Get()); } V8_INLINE BasicMember& operator=(RawStorage other) { - SetRawStorageAtomic(other); + Base::SetRawStorageAtomic(other); AssigningWriteBarrier(); this->CheckPointer(Get()); return *this; } V8_INLINE const T* GetRawAtomic() const { - return static_cast(MemberBase::GetRawAtomic()); + return static_cast(Base::GetRawAtomic()); } V8_INLINE void InitializingWriteBarrier(T* value) const { - WriteBarrierPolicy::InitializingBarrier(GetRawSlot(), value); + WriteBarrierPolicy::InitializingBarrier(Base::GetRawSlot(), value); } V8_INLINE void AssigningWriteBarrier(T* value) const { - WriteBarrierPolicy::AssigningBarrier(GetRawSlot(), value); + WriteBarrierPolicy::template AssigningBarrier< + StorageType::kWriteBarrierSlotType>(Base::GetRawSlot(), value); } V8_INLINE void AssigningWriteBarrier() const { - WriteBarrierPolicy::AssigningBarrier(GetRawSlot(), GetRawStorage()); + WriteBarrierPolicy::template AssigningBarrier< + StorageType::kWriteBarrierSlotType>(Base::GetRawSlot(), + Base::GetRawStorage()); } - V8_INLINE void ClearFromGC() const { MemberBase::ClearFromGC(); } + V8_INLINE void ClearFromGC() const { Base::ClearFromGC(); } V8_INLINE T* GetFromGC() const { return Get(); } @@ -319,19 +327,20 @@ class V8_TRIVIAL_ABI BasicMember final : private MemberBase, template friend struct cppgc::TraceTrait; template + typename CheckingPolicy1, typename StorageType1> friend class BasicMember; }; // Member equality operators. template + typename WriteBarrierPolicy2, typename CheckingPolicy2, + typename StorageType> V8_INLINE bool operator==( - const BasicMember& - member1, - const BasicMember& - member2) { + const BasicMember& member1, + const BasicMember& member2) { if constexpr (internal::IsDecayedSameV) { // Check compressed pointers if types are the same. return member1.GetRawStorage() == member2.GetRawStorage(); @@ -345,31 +354,32 @@ V8_INLINE bool operator==( template + typename WriteBarrierPolicy2, typename CheckingPolicy2, + typename StorageType> V8_INLINE bool operator!=( - const BasicMember& - member1, - const BasicMember& - member2) { + const BasicMember& member1, + const BasicMember& member2) { return !(member1 == member2); } // Equality with raw pointers. template -V8_INLINE bool operator==(const BasicMember& member, - U* raw) { + typename CheckingPolicy, typename StorageType, typename U> +V8_INLINE bool operator==( + const BasicMember& member, + U* raw) { // Never allow comparison with erased pointers. static_assert(!internal::IsDecayedSameV); if constexpr (internal::IsDecayedSameV) { // Check compressed pointers if types are the same. - return member.GetRawStorage() == MemberBase::RawStorage(raw); + return member.GetRawStorage() == StorageType(raw); } else if constexpr (internal::IsStrictlyBaseOfV) { // Cast the raw pointer to T, which may adjust the pointer. - return member.GetRawStorage() == - MemberBase::RawStorage(static_cast(raw)); + return member.GetRawStorage() == StorageType(static_cast(raw)); } else { // Otherwise, decompressed the member. return member.Get() == raw; @@ -377,104 +387,112 @@ V8_INLINE bool operator==(const BasicMember -V8_INLINE bool operator!=(const BasicMember& member, - U* raw) { + typename CheckingPolicy, typename StorageType, typename U> +V8_INLINE bool operator!=( + const BasicMember& member, + U* raw) { return !(member == raw); } template -V8_INLINE bool operator==(T* raw, - const BasicMember& member) { + typename WriteBarrierPolicy, typename CheckingPolicy, + typename StorageType> +V8_INLINE bool operator==( + T* raw, const BasicMember& member) { return member == raw; } template -V8_INLINE bool operator!=(T* raw, - const BasicMember& member) { + typename WriteBarrierPolicy, typename CheckingPolicy, + typename StorageType> +V8_INLINE bool operator!=( + T* raw, const BasicMember& member) { return !(raw == member); } // Equality with sentinel. template -V8_INLINE bool operator==(const BasicMember& member, - SentinelPointer) { + typename CheckingPolicy, typename StorageType> +V8_INLINE bool operator==( + const BasicMember& member, + SentinelPointer) { return member.GetRawStorage().IsSentinel(); } template -V8_INLINE bool operator!=(const BasicMember& member, - SentinelPointer s) { + typename CheckingPolicy, typename StorageType> +V8_INLINE bool operator!=( + const BasicMember& member, + SentinelPointer s) { return !(member == s); } template -V8_INLINE bool operator==(SentinelPointer s, - const BasicMember& member) { + typename CheckingPolicy, typename StorageType> +V8_INLINE bool operator==( + SentinelPointer s, const BasicMember& member) { return member == s; } template -V8_INLINE bool operator!=(SentinelPointer s, - const BasicMember& member) { + typename CheckingPolicy, typename StorageType> +V8_INLINE bool operator!=( + SentinelPointer s, const BasicMember& member) { return !(s == member); } // Equality with nullptr. template -V8_INLINE bool operator==(const BasicMember& member, - std::nullptr_t) { + typename CheckingPolicy, typename StorageType> +V8_INLINE bool operator==( + const BasicMember& member, + std::nullptr_t) { return !static_cast(member); } template -V8_INLINE bool operator!=(const BasicMember& member, - std::nullptr_t n) { + typename CheckingPolicy, typename StorageType> +V8_INLINE bool operator!=( + const BasicMember& member, + std::nullptr_t n) { return !(member == n); } template -V8_INLINE bool operator==(std::nullptr_t n, - const BasicMember& member) { + typename CheckingPolicy, typename StorageType> +V8_INLINE bool operator==( + std::nullptr_t n, const BasicMember& member) { return member == n; } template -V8_INLINE bool operator!=(std::nullptr_t n, - const BasicMember& member) { + typename CheckingPolicy, typename StorageType> +V8_INLINE bool operator!=( + std::nullptr_t n, const BasicMember& member) { return !(n == member); } // Relational operators. template + typename WriteBarrierPolicy2, typename CheckingPolicy2, + typename StorageType> V8_INLINE bool operator<( - const BasicMember& - member1, - const BasicMember& - member2) { + const BasicMember& member1, + const BasicMember& member2) { static_assert( internal::IsDecayedSameV, "Comparison works only for same pointer type modulo cv-qualifiers"); @@ -483,12 +501,13 @@ V8_INLINE bool operator<( template + typename WriteBarrierPolicy2, typename CheckingPolicy2, + typename StorageType> V8_INLINE bool operator<=( - const BasicMember& - member1, - const BasicMember& - member2) { + const BasicMember& member1, + const BasicMember& member2) { static_assert( internal::IsDecayedSameV, "Comparison works only for same pointer type modulo cv-qualifiers"); @@ -497,12 +516,13 @@ V8_INLINE bool operator<=( template + typename WriteBarrierPolicy2, typename CheckingPolicy2, + typename StorageType> V8_INLINE bool operator>( - const BasicMember& - member1, - const BasicMember& - member2) { + const BasicMember& member1, + const BasicMember& member2) { static_assert( internal::IsDecayedSameV, "Comparison works only for same pointer type modulo cv-qualifiers"); @@ -511,21 +531,23 @@ V8_INLINE bool operator>( template + typename WriteBarrierPolicy2, typename CheckingPolicy2, + typename StorageType> V8_INLINE bool operator>=( - const BasicMember& - member1, - const BasicMember& - member2) { + const BasicMember& member1, + const BasicMember& member2) { static_assert( internal::IsDecayedSameV, "Comparison works only for same pointer type modulo cv-qualifiers"); return member1.GetRawStorage() >= member2.GetRawStorage(); } -template -struct IsWeak< - internal::BasicMember> +template +struct IsWeak> : std::true_type {}; } // namespace internal @@ -536,8 +558,9 @@ struct IsWeak< * trace method. */ template -using Member = internal::BasicMember; +using Member = internal::BasicMember< + T, internal::StrongMemberTag, internal::DijkstraWriteBarrierPolicy, + internal::DefaultMemberCheckingPolicy, internal::DefaultMemberStorage>; /** * WeakMember is similar to Member in that it is used to point to other garbage @@ -548,8 +571,9 @@ using Member = internal::BasicMember -using WeakMember = internal::BasicMember; +using WeakMember = internal::BasicMember< + T, internal::WeakMemberTag, internal::DijkstraWriteBarrierPolicy, + internal::DefaultMemberCheckingPolicy, internal::DefaultMemberStorage>; /** * UntracedMember is a pointer to an on-heap object that is not traced for some @@ -558,8 +582,22 @@ using WeakMember = internal::BasicMember -using UntracedMember = internal::BasicMember; +using UntracedMember = internal::BasicMember< + T, internal::UntracedMemberTag, internal::NoWriteBarrierPolicy, + internal::DefaultMemberCheckingPolicy, internal::DefaultMemberStorage>; + +namespace subtle { + +/** + * UncompressedMember. Use with care in hot paths that would otherwise cause + * many decompression cycles. + */ +template +using UncompressedMember = internal::BasicMember< + T, internal::StrongMemberTag, internal::DijkstraWriteBarrierPolicy, + internal::DefaultMemberCheckingPolicy, internal::RawPointer>; + +} // namespace subtle } // namespace cppgc diff --git a/deps/v8/include/cppgc/persistent.h b/deps/v8/include/cppgc/persistent.h index 3a66ccc0864328..709f3fd6ab0996 100644 --- a/deps/v8/include/cppgc/persistent.h +++ b/deps/v8/include/cppgc/persistent.h @@ -114,11 +114,12 @@ class BasicPersistent final : public PersistentBase, // Constructor from member. template ::value>> - BasicPersistent( - const internal::BasicMember& member, - const SourceLocation& loc = SourceLocation::Current()) + BasicPersistent(const internal::BasicMember< + U, MemberBarrierPolicy, MemberWeaknessTag, + MemberCheckingPolicy, MemberStorageType>& member, + const SourceLocation& loc = SourceLocation::Current()) : BasicPersistent(member.Get(), loc) {} ~BasicPersistent() { Clear(); } @@ -154,10 +155,12 @@ class BasicPersistent final : public PersistentBase, // Assignment from member. template ::value>> BasicPersistent& operator=( const internal::BasicMember& member) { + MemberCheckingPolicy, MemberStorageType>& + member) { return operator=(member.Get()); } @@ -286,36 +289,39 @@ bool operator!=(const BasicPersistent + typename MemberWeaknessTag, typename MemberCheckingPolicy, + typename MemberStorageType> bool operator==( const BasicPersistent& p, const BasicMember& m) { + MemberCheckingPolicy, MemberStorageType>& m) { return p.Get() == m.Get(); } template + typename MemberWeaknessTag, typename MemberCheckingPolicy, + typename MemberStorageType> bool operator!=( const BasicPersistent& p, const BasicMember& m) { + MemberCheckingPolicy, MemberStorageType>& m) { return !(p == m); } template + typename MemberStorageType, typename T2, + typename PersistentWeaknessPolicy, typename PersistentLocationPolicy, + typename PersistentCheckingPolicy> bool operator==( const BasicMember& m, + MemberCheckingPolicy, MemberStorageType>& m, const BasicPersistent& p) { @@ -324,11 +330,12 @@ bool operator==( template + typename MemberStorageType, typename T2, + typename PersistentWeaknessPolicy, typename PersistentLocationPolicy, + typename PersistentCheckingPolicy> bool operator!=( const BasicMember& m, + MemberCheckingPolicy, MemberStorageType>& m, const BasicPersistent& p) { diff --git a/deps/v8/include/cppgc/type-traits.h b/deps/v8/include/cppgc/type-traits.h index 2f499e6886b929..4651435390058f 100644 --- a/deps/v8/include/cppgc/type-traits.h +++ b/deps/v8/include/cppgc/type-traits.h @@ -16,7 +16,7 @@ class Visitor; namespace internal { template + typename CheckingPolicy, typename StorageType> class BasicMember; struct DijkstraWriteBarrierPolicy; struct NoWriteBarrierPolicy; @@ -126,9 +126,10 @@ template struct IsSubclassOfBasicMemberTemplate { private: - template + template static std::true_type SubclassCheck( - BasicMember*); + BasicMember*); static std::false_type SubclassCheck(...); public: diff --git a/deps/v8/include/cppgc/visitor.h b/deps/v8/include/cppgc/visitor.h index f7ebc1d01f566e..9b135e39a0be1c 100644 --- a/deps/v8/include/cppgc/visitor.h +++ b/deps/v8/include/cppgc/visitor.h @@ -99,6 +99,20 @@ class V8_EXPORT Visitor { &HandleWeak>, &weak_member); } +#if defined(CPPGC_POINTER_COMPRESSION) + /** + * Trace method for UncompressedMember. + * + * \param member UncompressedMember reference retaining an object. + */ + template + void Trace(const subtle::UncompressedMember& member) { + const T* value = member.GetRawAtomic(); + CPPGC_DCHECK(value != kSentinelPointer); + TraceImpl(value); + } +#endif // defined(CPPGC_POINTER_COMPRESSION) + /** * Trace method for inlined objects that are not allocated themselves but * otherwise follow managed heap layout and have a Trace() method. @@ -229,7 +243,8 @@ class V8_EXPORT Visitor { } /** - * Trace method for retaining containers weakly. + * Trace method for retaining containers weakly. Note that weak containers + * should emit write barriers. * * \param object reference to the container. * \param callback to be invoked. diff --git a/deps/v8/include/js_protocol.pdl b/deps/v8/include/js_protocol.pdl index 6efcf787854dac..6285d9b6f24f63 100644 --- a/deps/v8/include/js_protocol.pdl +++ b/deps/v8/include/js_protocol.pdl @@ -511,6 +511,7 @@ domain Debugger CompileError BlockedByActiveGenerator BlockedByActiveFunction + BlockedByTopLevelEsModuleChange # Exception details if any. Only present when `status` is `CompileError`. optional Runtime.ExceptionDetails exceptionDetails @@ -1402,6 +1403,13 @@ domain Runtime optional string objectGroup # Whether to throw an exception if side effect cannot be ruled out during evaluation. experimental optional boolean throwOnSideEffect + # An alternative way to specify the execution context to call function on. + # Compared to contextId that may be reused across processes, this is guaranteed to be + # system-unique, so it can be used to prevent accidental function call + # in context different than intended (e.g. as a result of navigation across process + # boundaries). + # This is mutually exclusive with `executionContextId`. + experimental optional string uniqueContextId # Whether the result should contain `webDriverValue`, serialized according to # https://w3c.github.io/webdriver-bidi. This is mutually exclusive with `returnByValue`, but # resulting `objectId` is still provided. @@ -1734,7 +1742,9 @@ domain Runtime event executionContextDestroyed parameters # Id of the destroyed context - ExecutionContextId executionContextId + deprecated ExecutionContextId executionContextId + # Unique Id of the destroyed context + experimental string executionContextUniqueId # Issued when all executionContexts were cleared in browser event executionContextsCleared diff --git a/deps/v8/include/libplatform/v8-tracing.h b/deps/v8/include/libplatform/v8-tracing.h index 12489327c54210..6039a9c520b6a3 100644 --- a/deps/v8/include/libplatform/v8-tracing.h +++ b/deps/v8/include/libplatform/v8-tracing.h @@ -282,12 +282,12 @@ class V8_PLATFORM_EXPORT TracingController const char* name, uint64_t handle) override; static const char* GetCategoryGroupName(const uint8_t* category_enabled_flag); -#endif // !defined(V8_USE_PERFETTO) void AddTraceStateObserver( v8::TracingController::TraceStateObserver* observer) override; void RemoveTraceStateObserver( v8::TracingController::TraceStateObserver* observer) override; +#endif // !defined(V8_USE_PERFETTO) void StartTracing(TraceConfig* trace_config); void StopTracing(); @@ -307,7 +307,6 @@ class V8_PLATFORM_EXPORT TracingController std::unique_ptr mutex_; std::unique_ptr trace_config_; std::atomic_bool recording_{false}; - std::unordered_set observers_; #if defined(V8_USE_PERFETTO) std::ostream* output_stream_ = nullptr; @@ -316,6 +315,7 @@ class V8_PLATFORM_EXPORT TracingController TraceEventListener* listener_for_testing_ = nullptr; std::unique_ptr tracing_session_; #else // !defined(V8_USE_PERFETTO) + std::unordered_set observers_; std::unique_ptr trace_buffer_; #endif // !defined(V8_USE_PERFETTO) diff --git a/deps/v8/include/v8-array-buffer.h b/deps/v8/include/v8-array-buffer.h index 841bd02a793333..804fc42c4b56dd 100644 --- a/deps/v8/include/v8-array-buffer.h +++ b/deps/v8/include/v8-array-buffer.h @@ -53,12 +53,28 @@ class V8_EXPORT BackingStore : public v8::internal::BackingStoreBase { */ size_t ByteLength() const; + /** + * The maximum length (in bytes) that this backing store may grow to. + * + * If this backing store was created for a resizable ArrayBuffer or a growable + * SharedArrayBuffer, it is >= ByteLength(). Otherwise it is == + * ByteLength(). + */ + size_t MaxByteLength() const; + /** * Indicates whether the backing store was created for an ArrayBuffer or * a SharedArrayBuffer. */ bool IsShared() const; + /** + * Indicates whether the backing store was created for a resizable ArrayBuffer + * or a growable SharedArrayBuffer, and thus may be resized by user JavaScript + * code. + */ + bool IsResizableByUserJavaScript() const; + /** * Prevent implicit instantiation of operator delete with size_t argument. * The size_t argument would be incorrect because ptr points to the @@ -189,6 +205,11 @@ class V8_EXPORT ArrayBuffer : public Object { */ size_t ByteLength() const; + /** + * Maximum length in bytes. + */ + size_t MaxByteLength() const; + /** * Create a new ArrayBuffer. Allocate |byte_length| bytes. * Allocated memory will be owned by a created ArrayBuffer and @@ -235,6 +256,21 @@ class V8_EXPORT ArrayBuffer : public Object { void* data, size_t byte_length, v8::BackingStore::DeleterCallback deleter, void* deleter_data); + /** + * Returns a new resizable standalone BackingStore that is allocated using the + * array buffer allocator of the isolate. The result can be later passed to + * ArrayBuffer::New. + * + * |byte_length| must be <= |max_byte_length|. + * + * This function is usable without an isolate. Unlike |NewBackingStore| calls + * with an isolate, GCs cannot be triggered, and there are no + * retries. Allocation failure will cause the function to crash with an + * out-of-memory error. + */ + static std::unique_ptr NewResizableBackingStore( + size_t byte_length, size_t max_byte_length); + /** * Returns true if this ArrayBuffer may be detached. */ @@ -392,6 +428,11 @@ class V8_EXPORT SharedArrayBuffer : public Object { */ size_t ByteLength() const; + /** + * Maximum length in bytes. + */ + size_t MaxByteLength() const; + /** * Create a new SharedArrayBuffer. Allocate |byte_length| bytes. * Allocated memory will be owned by a created SharedArrayBuffer and diff --git a/deps/v8/include/v8-callbacks.h b/deps/v8/include/v8-callbacks.h index 0ffdfb6656fc64..f0fa561a3d76fb 100644 --- a/deps/v8/include/v8-callbacks.h +++ b/deps/v8/include/v8-callbacks.h @@ -7,6 +7,7 @@ #include +#include #include #include "cppgc/common.h" @@ -328,6 +329,10 @@ using WasmSimdEnabledCallback = bool (*)(Local context); // --- Callback for checking if WebAssembly exceptions are enabled --- using WasmExceptionsEnabledCallback = bool (*)(Local context); +// --- Callback for checking if WebAssembly GC is enabled --- +// If the callback returns true, it will also enable Wasm stringrefs. +using WasmGCEnabledCallback = bool (*)(Local context); + // --- Callback for checking if the SharedArrayBuffer constructor is enabled --- using SharedArrayBufferConstructorEnabledCallback = bool (*)(Local context); @@ -368,6 +373,13 @@ using HostImportModuleDynamicallyCallback = MaybeLocal (*)( Local resource_name, Local specifier, Local import_assertions); +/** + * Callback for requesting a compile hint for a function from the embedder. The + * first parameter is the position of the function in source code and the second + * parameter is embedder data to be passed back. + */ +using CompileHintCallback = bool (*)(int, void*); + /** * HostInitializeImportMetaObjectCallback is called the first time import.meta * is accessed for a module. Subsequent access will reuse the same value. diff --git a/deps/v8/include/v8-context.h b/deps/v8/include/v8-context.h index 3ce0eb0af38c67..3589caabd4b7c1 100644 --- a/deps/v8/include/v8-context.h +++ b/deps/v8/include/v8-context.h @@ -7,8 +7,11 @@ #include +#include + #include "v8-data.h" // NOLINT(build/include_directory) #include "v8-local-handle.h" // NOLINT(build/include_directory) +#include "v8-maybe.h" // NOLINT(build/include_directory) #include "v8-snapshot.h" // NOLINT(build/include_directory) #include "v8config.h" // NOLINT(build/include_directory) @@ -163,6 +166,42 @@ class V8_EXPORT Context : public Data { */ void Exit(); + /** + * Delegate to help with Deep freezing embedder-specific objects (such as + * JSApiObjects) that can not be frozen natively. + */ + class DeepFreezeDelegate { + public: + /** + * Performs embedder-specific operations to freeze the provided embedder + * object. The provided object *will* be frozen by DeepFreeze after this + * function returns, so only embedder-specific objects need to be frozen. + * This function *may not* create new JS objects or perform JS allocations. + * Any v8 objects reachable from the provided embedder object that should + * also be considered for freezing should be added to the children_out + * parameter. Returns true if the operation completed successfully. + */ + virtual bool FreezeEmbedderObjectAndGetChildren( + Local obj, std::vector>& children_out) = 0; + }; + + /** + * Attempts to recursively freeze all objects reachable from this context. + * Some objects (generators, iterators, non-const closures) can not be frozen + * and will cause this method to throw an error. An optional delegate can be + * provided to help freeze embedder-specific objects. + * + * Freezing occurs in two steps: + * 1. "Marking" where we iterate through all objects reachable by this + * context, accumulating a list of objects that need to be frozen and + * looking for objects that can't be frozen. This step is separated because + * it is more efficient when we can assume there is no garbage collection. + * 2. "Freezing" where we go through the list of objects and freezing them. + * This effectively requires copying them so it may trigger garbage + * collection. + */ + Maybe DeepFreeze(DeepFreezeDelegate* delegate = nullptr); + /** Returns the isolate associated with a current context. */ Isolate* GetIsolate(); @@ -365,13 +404,18 @@ Local Context::GetEmbedderData(int index) { #ifdef V8_COMPRESS_POINTERS // We read the full pointer value and then decompress it in order to avoid // dealing with potential endiannes issues. - value = - I::DecompressTaggedAnyField(embedder_data, static_cast(value)); + value = I::DecompressTaggedField(embedder_data, static_cast(value)); #endif + +#ifdef V8_ENABLE_CONSERVATIVE_STACK_SCANNING + return Local(reinterpret_cast(value)); +#else internal::Isolate* isolate = internal::IsolateFromNeverReadOnlySpaceObject( *reinterpret_cast(this)); A* result = HandleScope::CreateHandle(isolate, value); return Local(reinterpret_cast(result)); +#endif + #else return SlowGetEmbedderData(index); #endif @@ -381,7 +425,7 @@ void* Context::GetAlignedPointerFromEmbedderData(int index) { #if !defined(V8_ENABLE_CHECKS) using A = internal::Address; using I = internal::Internals; - A ctx = *reinterpret_cast(this); + A ctx = internal::ValueHelper::ValueAsAddress(this); A embedder_data = I::ReadTaggedPointerField(ctx, I::kNativeContextEmbedderDataOffset); int value_offset = I::kEmbedderDataArrayHeaderSize + diff --git a/deps/v8/include/v8-cppgc.h b/deps/v8/include/v8-cppgc.h index 3a6582cd258496..4a457027c9f76b 100644 --- a/deps/v8/include/v8-cppgc.h +++ b/deps/v8/include/v8-cppgc.h @@ -77,6 +77,12 @@ struct WrapperDescriptor final { }; struct V8_EXPORT CppHeapCreateParams { + CppHeapCreateParams( + std::vector> custom_spaces, + WrapperDescriptor wrapper_descriptor) + : custom_spaces(std::move(custom_spaces)), + wrapper_descriptor(wrapper_descriptor) {} + CppHeapCreateParams(const CppHeapCreateParams&) = delete; CppHeapCreateParams& operator=(const CppHeapCreateParams&) = delete; diff --git a/deps/v8/include/v8-embedder-heap.h b/deps/v8/include/v8-embedder-heap.h index f994cdfdf34376..9e2e3ef58c4341 100644 --- a/deps/v8/include/v8-embedder-heap.h +++ b/deps/v8/include/v8-embedder-heap.h @@ -5,27 +5,14 @@ #ifndef INCLUDE_V8_EMBEDDER_HEAP_H_ #define INCLUDE_V8_EMBEDDER_HEAP_H_ -#include -#include - -#include -#include - -#include "cppgc/common.h" -#include "v8-local-handle.h" // NOLINT(build/include_directory) #include "v8-traced-handle.h" // NOLINT(build/include_directory) #include "v8config.h" // NOLINT(build/include_directory) namespace v8 { -class Data; class Isolate; class Value; -namespace internal { -class LocalEmbedderHeapTracer; -} // namespace internal - /** * Handler for embedder roots on non-unified heap garbage collections. */ @@ -62,162 +49,6 @@ class V8_EXPORT EmbedderRootsHandler { virtual void ResetRoot(const v8::TracedReference& handle) = 0; }; -/** - * Interface for tracing through the embedder heap. During a V8 garbage - * collection, V8 collects hidden fields of all potential wrappers, and at the - * end of its marking phase iterates the collection and asks the embedder to - * trace through its heap and use reporter to report each JavaScript object - * reachable from any of the given wrappers. - */ -class V8_EXPORT -// GCC doesn't like combining __attribute__(()) with [[deprecated]]. -#ifdef __clang__ -V8_DEPRECATED("Use CppHeap when working with v8::TracedReference.") -#endif // __clang__ - EmbedderHeapTracer { - public: - using EmbedderStackState = cppgc::EmbedderStackState; - - enum TraceFlags : uint64_t { - kNoFlags = 0, - kReduceMemory = 1 << 0, - kForced = 1 << 2, - }; - - /** - * Interface for iterating through |TracedReference| handles. - */ - class V8_EXPORT TracedGlobalHandleVisitor { - public: - virtual ~TracedGlobalHandleVisitor() = default; - virtual void VisitTracedReference(const TracedReference& handle) {} - }; - - /** - * Summary of a garbage collection cycle. See |TraceEpilogue| on how the - * summary is reported. - */ - struct TraceSummary { - /** - * Time spent managing the retained memory in milliseconds. This can e.g. - * include the time tracing through objects in the embedder. - */ - double time = 0.0; - - /** - * Memory retained by the embedder through the |EmbedderHeapTracer| - * mechanism in bytes. - */ - size_t allocated_size = 0; - }; - - virtual ~EmbedderHeapTracer() = default; - - /** - * Iterates all |TracedReference| handles created for the |v8::Isolate| the - * tracer is attached to. - */ - void IterateTracedGlobalHandles(TracedGlobalHandleVisitor* visitor); - - /** - * Called by the embedder to set the start of the stack which is e.g. used by - * V8 to determine whether handles are used from stack or heap. - */ - void SetStackStart(void* stack_start); - - /** - * Called by v8 to register internal fields of found wrappers. - * - * The embedder is expected to store them somewhere and trace reachable - * wrappers from them when called through |AdvanceTracing|. - */ - virtual void RegisterV8References( - const std::vector>& embedder_fields) = 0; - - void RegisterEmbedderReference(const BasicTracedReference& ref); - - /** - * Called at the beginning of a GC cycle. - */ - virtual void TracePrologue(TraceFlags flags) {} - - /** - * Called to advance tracing in the embedder. - * - * The embedder is expected to trace its heap starting from wrappers reported - * by RegisterV8References method, and report back all reachable wrappers. - * Furthermore, the embedder is expected to stop tracing by the given - * deadline. A deadline of infinity means that tracing should be finished. - * - * Returns |true| if tracing is done, and false otherwise. - */ - virtual bool AdvanceTracing(double deadline_in_ms) = 0; - - /* - * Returns true if there no more tracing work to be done (see AdvanceTracing) - * and false otherwise. - */ - virtual bool IsTracingDone() = 0; - - /** - * Called at the end of a GC cycle. - * - * Note that allocation is *not* allowed within |TraceEpilogue|. Can be - * overriden to fill a |TraceSummary| that is used by V8 to schedule future - * garbage collections. - */ - virtual void TraceEpilogue(TraceSummary* trace_summary) {} - - /** - * Called upon entering the final marking pause. No more incremental marking - * steps will follow this call. - */ - virtual void EnterFinalPause(EmbedderStackState stack_state) = 0; - - /* - * Called by the embedder to request immediate finalization of the currently - * running tracing phase that has been started with TracePrologue and not - * yet finished with TraceEpilogue. - * - * Will be a noop when currently not in tracing. - * - * This is an experimental feature. - */ - void FinalizeTracing(); - - /** - * See documentation on EmbedderRootsHandler. - */ - virtual bool IsRootForNonTracingGC( - const v8::TracedReference& handle); - - /** - * See documentation on EmbedderRootsHandler. - */ - virtual void ResetHandleInNonTracingGC( - const v8::TracedReference& handle); - - /* - * Called by the embedder to signal newly allocated or freed memory. Not bound - * to tracing phases. Embedders should trade off when increments are reported - * as V8 may consult global heuristics on whether to trigger garbage - * collection on this change. - */ - void IncreaseAllocatedSize(size_t bytes); - void DecreaseAllocatedSize(size_t bytes); - - /* - * Returns the v8::Isolate this tracer is attached too and |nullptr| if it - * is not attached to any v8::Isolate. - */ - v8::Isolate* isolate() const { return v8_isolate_; } - - protected: - v8::Isolate* v8_isolate_ = nullptr; - - friend class internal::LocalEmbedderHeapTracer; -}; - } // namespace v8 #endif // INCLUDE_V8_EMBEDDER_HEAP_H_ diff --git a/deps/v8/include/v8-fast-api-calls.h b/deps/v8/include/v8-fast-api-calls.h index 9ea43fe2535397..0fe7cd2489b05e 100644 --- a/deps/v8/include/v8-fast-api-calls.h +++ b/deps/v8/include/v8-fast-api-calls.h @@ -247,6 +247,7 @@ class CTypeInfo { kUint64, kFloat32, kFloat64, + kPointer, kV8Value, kSeqOneByteString, kApiObject, // This will be deprecated once all users have @@ -435,6 +436,7 @@ struct AnyCType { uint64_t uint64_value; float float_value; double double_value; + void* pointer_value; Local object_value; Local sequence_value; const FastApiTypedArray* uint8_ta_value; @@ -620,6 +622,7 @@ class CFunctionInfoImpl : public CFunctionInfo { kReturnType == CTypeInfo::Type::kUint32 || kReturnType == CTypeInfo::Type::kFloat32 || kReturnType == CTypeInfo::Type::kFloat64 || + kReturnType == CTypeInfo::Type::kPointer || kReturnType == CTypeInfo::Type::kAny, "64-bit int, string and api object values are not currently " "supported return types."); @@ -658,13 +661,14 @@ struct CTypeInfoTraits {}; #define PRIMITIVE_C_TYPES(V) \ V(bool, kBool) \ + V(uint8_t, kUint8) \ V(int32_t, kInt32) \ V(uint32_t, kUint32) \ V(int64_t, kInt64) \ V(uint64_t, kUint64) \ V(float, kFloat32) \ V(double, kFloat64) \ - V(uint8_t, kUint8) + V(void*, kPointer) // Same as above, but includes deprecated types for compatibility. #define ALL_C_TYPES(V) \ @@ -698,13 +702,13 @@ PRIMITIVE_C_TYPES(DEFINE_TYPE_INFO_TRAITS) }; #define TYPED_ARRAY_C_TYPES(V) \ + V(uint8_t, kUint8) \ V(int32_t, kInt32) \ V(uint32_t, kUint32) \ V(int64_t, kInt64) \ V(uint64_t, kUint64) \ V(float, kFloat32) \ - V(double, kFloat64) \ - V(uint8_t, kUint8) + V(double, kFloat64) TYPED_ARRAY_C_TYPES(SPECIALIZE_GET_TYPE_INFO_HELPER_FOR_TA) diff --git a/deps/v8/include/v8-function-callback.h b/deps/v8/include/v8-function-callback.h index 2adff99b1cbb82..60ecca1fd2a34f 100644 --- a/deps/v8/include/v8-function-callback.h +++ b/deps/v8/include/v8-function-callback.h @@ -21,6 +21,7 @@ class Value; namespace internal { class FunctionCallbackArguments; class PropertyCallbackArguments; +class Builtins; } // namespace internal namespace debug { @@ -74,6 +75,11 @@ class ReturnValue { V8_INLINE void SetInternal(internal::Address value) { *value_ = value; } V8_INLINE internal::Address GetDefaultValue(); V8_INLINE explicit ReturnValue(internal::Address* slot); + + // See FunctionCallbackInfo. + static constexpr int kIsolateValueIndex = -2; + static constexpr int kDefaultValueValueIndex = -1; + internal::Address* value_; }; @@ -116,19 +122,35 @@ class FunctionCallbackInfo { V8_INLINE Isolate* GetIsolate() const; /** The ReturnValue for the call. */ V8_INLINE ReturnValue GetReturnValue() const; - // This shouldn't be public, but the arm compiler needs it. - static const int kArgsLength = 6; - protected: + private: friend class internal::FunctionCallbackArguments; friend class internal::CustomArguments; friend class debug::ConsoleCallArguments; - static const int kHolderIndex = 0; - static const int kIsolateIndex = 1; - static const int kReturnValueDefaultValueIndex = 2; - static const int kReturnValueIndex = 3; - static const int kDataIndex = 4; - static const int kNewTargetIndex = 5; + friend class internal::Builtins; + static constexpr int kHolderIndex = 0; + static constexpr int kIsolateIndex = 1; + static constexpr int kReturnValueDefaultValueIndex = 2; + static constexpr int kReturnValueIndex = 3; + static constexpr int kDataIndex = 4; + static constexpr int kNewTargetIndex = 5; + + static constexpr int kArgsLength = 6; + static constexpr int kArgsLengthWithReceiver = 7; + + // Codegen constants: + static constexpr int kSize = 3 * internal::kApiSystemPointerSize; + static constexpr int kImplicitArgsOffset = 0; + static constexpr int kValuesOffset = + kImplicitArgsOffset + internal::kApiSystemPointerSize; + static constexpr int kLengthOffset = + kValuesOffset + internal::kApiSystemPointerSize; + + static constexpr int kThisValuesIndex = -1; + static_assert(ReturnValue::kDefaultValueValueIndex == + kReturnValueDefaultValueIndex - kReturnValueIndex); + static_assert(ReturnValue::kIsolateValueIndex == + kIsolateIndex - kReturnValueIndex); V8_INLINE FunctionCallbackInfo(internal::Address* implicit_args, internal::Address* values, int length); @@ -229,22 +251,24 @@ class PropertyCallbackInfo { */ V8_INLINE bool ShouldThrowOnError() const; - // This shouldn't be public, but the arm compiler needs it. - static const int kArgsLength = 7; - - protected: + private: friend class MacroAssembler; friend class internal::PropertyCallbackArguments; friend class internal::CustomArguments; - static const int kShouldThrowOnErrorIndex = 0; - static const int kHolderIndex = 1; - static const int kIsolateIndex = 2; - static const int kReturnValueDefaultValueIndex = 3; - static const int kReturnValueIndex = 4; - static const int kDataIndex = 5; - static const int kThisIndex = 6; - - V8_INLINE PropertyCallbackInfo(internal::Address* args) : args_(args) {} + static constexpr int kShouldThrowOnErrorIndex = 0; + static constexpr int kHolderIndex = 1; + static constexpr int kIsolateIndex = 2; + static constexpr int kReturnValueDefaultValueIndex = 3; + static constexpr int kReturnValueIndex = 4; + static constexpr int kDataIndex = 5; + static constexpr int kThisIndex = 6; + + static constexpr int kArgsLength = 7; + + static constexpr int kSize = 1 * internal::kApiSystemPointerSize; + + V8_INLINE explicit PropertyCallbackInfo(internal::Address* args) + : args_(args) {} internal::Address* args_; }; @@ -285,7 +309,7 @@ void ReturnValue::Set(const Local handle) { if (V8_UNLIKELY(handle.IsEmpty())) { *value_ = GetDefaultValue(); } else { - *value_ = *reinterpret_cast(*handle); + *value_ = internal::ValueHelper::ValueAsAddress(*handle); } } @@ -328,41 +352,46 @@ void ReturnValue::Set(bool value) { } else { root_index = I::kFalseValueRootIndex; } - *value_ = *I::GetRoot(GetIsolate(), root_index); + *value_ = I::GetRoot(GetIsolate(), root_index); } template void ReturnValue::SetNull() { static_assert(std::is_base_of::value, "type check"); using I = internal::Internals; - *value_ = *I::GetRoot(GetIsolate(), I::kNullValueRootIndex); + *value_ = I::GetRoot(GetIsolate(), I::kNullValueRootIndex); } template void ReturnValue::SetUndefined() { static_assert(std::is_base_of::value, "type check"); using I = internal::Internals; - *value_ = *I::GetRoot(GetIsolate(), I::kUndefinedValueRootIndex); + *value_ = I::GetRoot(GetIsolate(), I::kUndefinedValueRootIndex); } template void ReturnValue::SetEmptyString() { static_assert(std::is_base_of::value, "type check"); using I = internal::Internals; - *value_ = *I::GetRoot(GetIsolate(), I::kEmptyStringRootIndex); + *value_ = I::GetRoot(GetIsolate(), I::kEmptyStringRootIndex); } template Isolate* ReturnValue::GetIsolate() const { // Isolate is always the pointer below the default value on the stack. - return *reinterpret_cast(&value_[-2]); + return *reinterpret_cast(&value_[kIsolateValueIndex]); } template Local ReturnValue::Get() const { using I = internal::Internals; - if (*value_ == *I::GetRoot(GetIsolate(), I::kTheHoleValueRootIndex)) - return Local(*Undefined(GetIsolate())); +#if V8_STATIC_ROOTS_BOOL + if (I::is_identical(*value_, I::StaticReadOnlyRoot::kTheHoleValue)) { +#else + if (*value_ == I::GetRoot(GetIsolate(), I::kTheHoleValueRootIndex)) { +#endif + return Undefined(GetIsolate()); + } return Local::New(GetIsolate(), reinterpret_cast(value_)); } @@ -375,7 +404,7 @@ void ReturnValue::Set(S* whatever) { template internal::Address ReturnValue::GetDefaultValue() { // Default value is always the pointer below value_ on the stack. - return value_[-1]; + return value_[kDefaultValueValueIndex]; } template @@ -387,31 +416,29 @@ FunctionCallbackInfo::FunctionCallbackInfo(internal::Address* implicit_args, template Local FunctionCallbackInfo::operator[](int i) const { // values_ points to the first argument (not the receiver). - if (i < 0 || length_ <= i) return Local(*Undefined(GetIsolate())); - return Local(reinterpret_cast(values_ + i)); + if (i < 0 || length_ <= i) return Undefined(GetIsolate()); + return Local::FromSlot(values_ + i); } template Local FunctionCallbackInfo::This() const { // values_ points to the first argument (not the receiver). - return Local(reinterpret_cast(values_ - 1)); + return Local::FromSlot(values_ + kThisValuesIndex); } template Local FunctionCallbackInfo::Holder() const { - return Local( - reinterpret_cast(&implicit_args_[kHolderIndex])); + return Local::FromSlot(&implicit_args_[kHolderIndex]); } template Local FunctionCallbackInfo::NewTarget() const { - return Local( - reinterpret_cast(&implicit_args_[kNewTargetIndex])); + return Local::FromSlot(&implicit_args_[kNewTargetIndex]); } template Local FunctionCallbackInfo::Data() const { - return Local(reinterpret_cast(&implicit_args_[kDataIndex])); + return Local::FromSlot(&implicit_args_[kDataIndex]); } template @@ -441,17 +468,17 @@ Isolate* PropertyCallbackInfo::GetIsolate() const { template Local PropertyCallbackInfo::Data() const { - return Local(reinterpret_cast(&args_[kDataIndex])); + return Local::FromSlot(&args_[kDataIndex]); } template Local PropertyCallbackInfo::This() const { - return Local(reinterpret_cast(&args_[kThisIndex])); + return Local::FromSlot(&args_[kThisIndex]); } template Local PropertyCallbackInfo::Holder() const { - return Local(reinterpret_cast(&args_[kHolderIndex])); + return Local::FromSlot(&args_[kHolderIndex]); } template diff --git a/deps/v8/include/v8-function.h b/deps/v8/include/v8-function.h index 2dc7e722bb9e8c..1e35bfc8bfa272 100644 --- a/deps/v8/include/v8-function.h +++ b/deps/v8/include/v8-function.h @@ -59,6 +59,7 @@ class V8_EXPORT Function : public Object { void SetName(Local name); Local GetName() const; + V8_DEPRECATED("No direct replacement") MaybeLocal GetUnboundScript() const; /** diff --git a/deps/v8/include/v8-inspector.h b/deps/v8/include/v8-inspector.h index aa5a044afb61c4..563ad196d6e607 100644 --- a/deps/v8/include/v8-inspector.h +++ b/deps/v8/include/v8-inspector.h @@ -32,19 +32,19 @@ namespace Debugger { namespace API { class SearchMatch; } -} +} // namespace Debugger namespace Runtime { namespace API { class RemoteObject; class StackTrace; class StackTraceId; -} -} +} // namespace API +} // namespace Runtime namespace Schema { namespace API { class Domain; } -} +} // namespace Schema } // namespace protocol class V8_EXPORT StringView { @@ -134,6 +134,13 @@ class V8_EXPORT V8DebuggerId { int64_t m_second = 0; }; +struct V8_EXPORT V8StackFrame { + StringView sourceURL; + StringView functionName; + int lineNumber; + int columnNumber; +}; + class V8_EXPORT V8StackTrace { public: virtual StringView firstNonEmptySourceURL() const = 0; @@ -151,6 +158,8 @@ class V8_EXPORT V8StackTrace { // Safe to pass between threads, drops async chain. virtual std::unique_ptr clone() = 0; + + virtual std::vector frames() const = 0; }; class V8_EXPORT V8InspectorSession { @@ -203,6 +212,9 @@ class V8_EXPORT V8InspectorSession { std::unique_ptr* objectGroup) = 0; virtual void releaseObjectGroup(StringView) = 0; virtual void triggerPreciseCoverageDeltaUpdate(StringView occasion) = 0; + + // Prepare for shutdown (disables debugger pausing, etc.). + virtual void stop() = 0; }; class V8_EXPORT WebDriverValue { @@ -365,9 +377,12 @@ class V8_EXPORT V8Inspector { virtual void flushProtocolNotifications() = 0; }; enum ClientTrustLevel { kUntrusted, kFullyTrusted }; + enum SessionPauseState { kWaitingForDebugger, kNotWaitingForDebugger }; + // TODO(chromium:1352175): remove default value once downstream change lands. virtual std::unique_ptr connect( int contextGroupId, Channel*, StringView state, - ClientTrustLevel client_trust_level) { + ClientTrustLevel client_trust_level, + SessionPauseState = kNotWaitingForDebugger) { return nullptr; } diff --git a/deps/v8/include/v8-internal.h b/deps/v8/include/v8-internal.h index a4b8ee0824d81d..e61bb6e4154eb0 100644 --- a/deps/v8/include/v8-internal.h +++ b/deps/v8/include/v8-internal.h @@ -21,15 +21,13 @@ class Array; class Context; class Data; class Isolate; -template -class Local; namespace internal { class Isolate; typedef uintptr_t Address; -static const Address kNullAddress = 0; +static constexpr Address kNullAddress = 0; constexpr int KB = 1024; constexpr int MB = KB * 1024; @@ -82,7 +80,7 @@ struct SmiTagging<4> { static_cast(kUintptrAllBitsSet << (kSmiValueSize - 1)); static constexpr intptr_t kSmiMaxValue = -(kSmiMinValue + 1); - V8_INLINE static int SmiToInt(const internal::Address value) { + V8_INLINE static int SmiToInt(Address value) { int shift_bits = kSmiTagSize + kSmiShiftSize; // Truncate and shift down (requires >> to be sign extending). return static_cast(static_cast(value)) >> shift_bits; @@ -107,7 +105,7 @@ struct SmiTagging<8> { static_cast(kUintptrAllBitsSet << (kSmiValueSize - 1)); static constexpr intptr_t kSmiMaxValue = -(kSmiMinValue + 1); - V8_INLINE static int SmiToInt(const internal::Address value) { + V8_INLINE static int SmiToInt(Address value) { int shift_bits = kSmiTagSize + kSmiShiftSize; // Shift down and throw away top 32 bits. return static_cast(static_cast(value) >> shift_bits); @@ -150,8 +148,9 @@ const int kSmiMinValue = static_cast(PlatformSmiTagging::kSmiMinValue); const int kSmiMaxValue = static_cast(PlatformSmiTagging::kSmiMaxValue); constexpr bool SmiValuesAre31Bits() { return kSmiValueSize == 31; } constexpr bool SmiValuesAre32Bits() { return kSmiValueSize == 32; } +constexpr bool Is64() { return kApiSystemPointerSize == sizeof(int64_t); } -V8_INLINE static constexpr internal::Address IntToSmi(int value) { +V8_INLINE static constexpr Address IntToSmi(int value) { return (static_cast
(value) << (kSmiTagSize + kSmiShiftSize)) | kSmiTag; } @@ -242,6 +241,7 @@ static_assert(1ULL << (64 - kBoundedSizeShift) == #ifdef V8_COMPRESS_POINTERS +#ifdef V8_TARGET_OS_ANDROID // The size of the virtual memory reservation for an external pointer table. // This determines the maximum number of entries in a table. Using a maximum // size allows omitting bounds checks on table accesses if the indices are @@ -249,14 +249,18 @@ static_assert(1ULL << (64 - kBoundedSizeShift) == // value must be a power of two. static const size_t kExternalPointerTableReservationSize = 512 * MB; -// The maximum number of entries in an external pointer table. -static const size_t kMaxExternalPointers = - kExternalPointerTableReservationSize / kApiSystemPointerSize; - // The external pointer table indices stored in HeapObjects as external // pointers are shifted to the left by this amount to guarantee that they are // smaller than the maximum table size. static const uint32_t kExternalPointerIndexShift = 6; +#else +static const size_t kExternalPointerTableReservationSize = 1024 * MB; +static const uint32_t kExternalPointerIndexShift = 5; +#endif // V8_TARGET_OS_ANDROID + +// The maximum number of entries in an external pointer table. +static const size_t kMaxExternalPointers = + kExternalPointerTableReservationSize / kApiSystemPointerSize; static_assert((1 << (32 - kExternalPointerIndexShift)) == kMaxExternalPointers, "kExternalPointerTableReservationSize and " "kExternalPointerIndexShift don't match"); @@ -345,6 +349,14 @@ using ExternalPointer_t = Address; // that the Embedder is not using this byte (really only this one bit) for any // other purpose. This bit also does not collide with the memory tagging // extension (MTE) which would use bits [56, 60). +// +// External pointer tables are also available even when the sandbox is off but +// pointer compression is on. In that case, the mechanism can be used to easy +// alignment requirements as it turns unaligned 64-bit raw pointers into +// aligned 32-bit indices. To "opt-in" to the external pointer table mechanism +// for this purpose, instead of using the ExternalPointer accessors one needs to +// use ExternalPointerHandles directly and use them to access the pointers in an +// ExternalPointerTable. constexpr uint64_t kExternalPointerMarkBit = 1ULL << 62; constexpr uint64_t kExternalPointerTagMask = 0x40ff000000000000; constexpr uint64_t kExternalPointerTagShift = 48; @@ -367,71 +379,58 @@ constexpr uint64_t kAllExternalPointerTypeTags[] = { 0b11001100, 0b11010001, 0b11010010, 0b11010100, 0b11011000, 0b11100001, 0b11100010, 0b11100100, 0b11101000, 0b11110000}; +#define TAG(i) \ + ((kAllExternalPointerTypeTags[i] << kExternalPointerTagShift) | \ + kExternalPointerMarkBit) + // clang-format off -// New entries should be added with state "sandboxed". + // When adding new tags, please ensure that the code using these tags is // "substitution-safe", i.e. still operate safely if external pointers of the // same type are swapped by an attacker. See comment above for more details. -#define TAG(i) (kAllExternalPointerTypeTags[i]) // Shared external pointers are owned by the shared Isolate and stored in the // shared external pointer table associated with that Isolate, where they can // be accessed from multiple threads at the same time. The objects referenced // in this way must therefore always be thread-safe. -#define SHARED_EXTERNAL_POINTER_TAGS(V) \ - V(kFirstSharedTag, sandboxed, TAG(0)) \ - V(kWaiterQueueNodeTag, sandboxed, TAG(0)) \ - V(kExternalStringResourceTag, sandboxed, TAG(1)) \ - V(kExternalStringResourceDataTag, sandboxed, TAG(2)) \ - V(kLastSharedTag, sandboxed, TAG(2)) +#define SHARED_EXTERNAL_POINTER_TAGS(V) \ + V(kFirstSharedTag, TAG(0)) \ + V(kWaiterQueueNodeTag, TAG(0)) \ + V(kExternalStringResourceTag, TAG(1)) \ + V(kExternalStringResourceDataTag, TAG(2)) \ + V(kLastSharedTag, TAG(2)) // External pointers using these tags are kept in a per-Isolate external // pointer table and can only be accessed when this Isolate is active. -#define PER_ISOLATE_EXTERNAL_POINTER_TAGS(V) \ - V(kForeignForeignAddressTag, sandboxed, TAG(10)) \ - V(kNativeContextMicrotaskQueueTag, sandboxed, TAG(11)) \ - V(kEmbedderDataSlotPayloadTag, sandboxed, TAG(12)) \ - V(kExternalObjectValueTag, sandboxed, TAG(13)) \ - V(kCallHandlerInfoCallbackTag, sandboxed, TAG(14)) \ - V(kAccessorInfoGetterTag, sandboxed, TAG(15)) \ - V(kAccessorInfoSetterTag, sandboxed, TAG(16)) \ - V(kWasmInternalFunctionCallTargetTag, sandboxed, TAG(17)) \ - V(kWasmTypeInfoNativeTypeTag, sandboxed, TAG(18)) \ - V(kWasmExportedFunctionDataSignatureTag, sandboxed, TAG(19)) \ - V(kWasmContinuationJmpbufTag, sandboxed, TAG(20)) \ - V(kArrayBufferExtensionTag, sandboxed, TAG(21)) +#define PER_ISOLATE_EXTERNAL_POINTER_TAGS(V) \ + V(kForeignForeignAddressTag, TAG(10)) \ + V(kNativeContextMicrotaskQueueTag, TAG(11)) \ + V(kEmbedderDataSlotPayloadTag, TAG(12)) \ +/* This tag essentially stands for a `void*` pointer in the V8 API, and */ \ +/* it is the Embedder's responsibility to ensure type safety (against */ \ +/* substitution) and lifetime validity of these objects. */ \ + V(kExternalObjectValueTag, TAG(13)) \ + V(kCallHandlerInfoCallbackTag, TAG(14)) \ + V(kAccessorInfoGetterTag, TAG(15)) \ + V(kAccessorInfoSetterTag, TAG(16)) \ + V(kWasmInternalFunctionCallTargetTag, TAG(17)) \ + V(kWasmTypeInfoNativeTypeTag, TAG(18)) \ + V(kWasmExportedFunctionDataSignatureTag, TAG(19)) \ + V(kWasmContinuationJmpbufTag, TAG(20)) \ + V(kArrayBufferExtensionTag, TAG(21)) // All external pointer tags. #define ALL_EXTERNAL_POINTER_TAGS(V) \ SHARED_EXTERNAL_POINTER_TAGS(V) \ PER_ISOLATE_EXTERNAL_POINTER_TAGS(V) -// When the sandbox is enabled, external pointers marked as "sandboxed" above -// use the external pointer table (i.e. are sandboxed). This allows a gradual -// rollout of external pointer sandboxing. If the sandbox is off, no external -// pointers are sandboxed. -// -// Sandboxed external pointer tags are available when compressing pointers even -// when the sandbox is off. Some tags (e.g. kWaiterQueueNodeTag) are used -// manually with the external pointer table even when the sandbox is off to ease -// alignment requirements. -#define sandboxed(X) (X << kExternalPointerTagShift) | kExternalPointerMarkBit -#define unsandboxed(X) kUnsandboxedExternalPointerTag -#if defined(V8_COMPRESS_POINTERS) -#define EXTERNAL_POINTER_TAG_ENUM(Name, State, Bits) Name = State(Bits), -#else -#define EXTERNAL_POINTER_TAG_ENUM(Name, State, Bits) Name = unsandboxed(Bits), -#endif - +#define EXTERNAL_POINTER_TAG_ENUM(Name, Tag) Name = Tag, #define MAKE_TAG(HasMarkBit, TypeTag) \ ((static_cast(TypeTag) << kExternalPointerTagShift) | \ (HasMarkBit ? kExternalPointerMarkBit : 0)) enum ExternalPointerTag : uint64_t { // Empty tag value. Mostly used as placeholder. kExternalPointerNullTag = MAKE_TAG(0, 0b00000000), - // Tag to use for unsandboxed external pointers, which are still stored as - // raw pointers on the heap. - kUnsandboxedExternalPointerTag = MAKE_TAG(0, 0b00000000), // External pointer tag that will match any external pointer. Use with care! kAnyExternalPointerTag = MAKE_TAG(1, 0b11111111), // The free entry tag has all type bits set so every type check with a @@ -445,20 +444,11 @@ enum ExternalPointerTag : uint64_t { }; #undef MAKE_TAG -#undef unsandboxed -#undef sandboxed #undef TAG #undef EXTERNAL_POINTER_TAG_ENUM // clang-format on -// True if the external pointer is sandboxed and so must be referenced through -// an external pointer table. -V8_INLINE static constexpr bool IsSandboxedExternalPointerType( - ExternalPointerTag tag) { - return tag != kUnsandboxedExternalPointerTag; -} - // True if the external pointer must be accessed from the shared isolate's // external pointer table. V8_INLINE static constexpr bool IsSharedExternalPointerType( @@ -467,12 +457,10 @@ V8_INLINE static constexpr bool IsSharedExternalPointerType( } // Sanity checks. -#define CHECK_SHARED_EXTERNAL_POINTER_TAGS(Tag, ...) \ - static_assert(!IsSandboxedExternalPointerType(Tag) || \ - IsSharedExternalPointerType(Tag)); +#define CHECK_SHARED_EXTERNAL_POINTER_TAGS(Tag, ...) \ + static_assert(IsSharedExternalPointerType(Tag)); #define CHECK_NON_SHARED_EXTERNAL_POINTER_TAGS(Tag, ...) \ - static_assert(!IsSandboxedExternalPointerType(Tag) || \ - !IsSharedExternalPointerType(Tag)); + static_assert(!IsSharedExternalPointerType(Tag)); SHARED_EXTERNAL_POINTER_TAGS(CHECK_SHARED_EXTERNAL_POINTER_TAGS) PER_ISOLATE_EXTERNAL_POINTER_TAGS(CHECK_NON_SHARED_EXTERNAL_POINTER_TAGS) @@ -490,7 +478,7 @@ V8_EXPORT internal::Isolate* IsolateFromNeverReadOnlySpaceObject(Address obj); // Returns if we need to throw when an error occurs. This infers the language // mode based on the current context and the closure. This returns true if the // language mode is strict. -V8_EXPORT bool ShouldThrowOnError(v8::internal::Isolate* isolate); +V8_EXPORT bool ShouldThrowOnError(internal::Isolate* isolate); /** * This class exports constants and functionality from within v8 that * is necessary to implement inline functions in the v8 api. Don't @@ -498,8 +486,7 @@ V8_EXPORT bool ShouldThrowOnError(v8::internal::Isolate* isolate); */ class Internals { #ifdef V8_MAP_PACKING - V8_INLINE static constexpr internal::Address UnpackMapWord( - internal::Address mapword) { + V8_INLINE static constexpr Address UnpackMapWord(Address mapword) { // TODO(wenyuzhao): Clear header metadata. return mapword ^ kMapWordXorMask; } @@ -533,6 +520,8 @@ class Internals { static const int kStackGuardSize = 7 * kApiSystemPointerSize; static const int kBuiltinTier0EntryTableSize = 7 * kApiSystemPointerSize; static const int kBuiltinTier0TableSize = 7 * kApiSystemPointerSize; + static const int kLinearAllocationAreaSize = 3 * kApiSystemPointerSize; + static const int kThreadLocalTopSize = 25 * kApiSystemPointerSize; // ExternalPointerTable layout guarantees. static const int kExternalPointerTableBufferOffset = 0; @@ -545,31 +534,60 @@ class Internals { static const int kVariousBooleanFlagsOffset = kIsolateStackGuardOffset + kStackGuardSize; static const int kBuiltinTier0EntryTableOffset = - kVariousBooleanFlagsOffset + kApiSystemPointerSize; + kVariousBooleanFlagsOffset + 8; static const int kBuiltinTier0TableOffset = kBuiltinTier0EntryTableOffset + kBuiltinTier0EntryTableSize; - static const int kIsolateEmbedderDataOffset = + static const int kNewAllocationInfoOffset = kBuiltinTier0TableOffset + kBuiltinTier0TableSize; + static const int kOldAllocationInfoOffset = + kNewAllocationInfoOffset + kLinearAllocationAreaSize; static const int kIsolateFastCCallCallerFpOffset = - kIsolateEmbedderDataOffset + kNumIsolateDataSlots * kApiSystemPointerSize; + kOldAllocationInfoOffset + kLinearAllocationAreaSize; static const int kIsolateFastCCallCallerPcOffset = kIsolateFastCCallCallerFpOffset + kApiSystemPointerSize; static const int kIsolateFastApiCallTargetOffset = kIsolateFastCCallCallerPcOffset + kApiSystemPointerSize; static const int kIsolateLongTaskStatsCounterOffset = kIsolateFastApiCallTargetOffset + kApiSystemPointerSize; + static const int kIsolateThreadLocalTopOffset = + kIsolateLongTaskStatsCounterOffset + kApiSizetSize; + static const int kIsolateEmbedderDataOffset = + kIsolateThreadLocalTopOffset + kThreadLocalTopSize; #ifdef V8_COMPRESS_POINTERS static const int kIsolateExternalPointerTableOffset = - kIsolateLongTaskStatsCounterOffset + kApiSizetSize; + kIsolateEmbedderDataOffset + kNumIsolateDataSlots * kApiSystemPointerSize; static const int kIsolateSharedExternalPointerTableAddressOffset = kIsolateExternalPointerTableOffset + kExternalPointerTableSize; static const int kIsolateRootsOffset = kIsolateSharedExternalPointerTableAddressOffset + kApiSystemPointerSize; #else static const int kIsolateRootsOffset = - kIsolateLongTaskStatsCounterOffset + kApiSizetSize; + kIsolateEmbedderDataOffset + kNumIsolateDataSlots * kApiSystemPointerSize; #endif +#if V8_STATIC_ROOTS_BOOL + +// These constants need to be initialized in api.cc. +#define EXPORTED_STATIC_ROOTS_PTR_LIST(V) \ + V(UndefinedValue) \ + V(NullValue) \ + V(TrueValue) \ + V(FalseValue) \ + V(EmptyString) \ + V(TheHoleValue) + + using Tagged_t = uint32_t; + struct StaticReadOnlyRoot { +#define DEF_ROOT(name) V8_EXPORT static const Tagged_t k##name; + EXPORTED_STATIC_ROOTS_PTR_LIST(DEF_ROOT) +#undef DEF_ROOT + + V8_EXPORT static const Tagged_t kFirstStringMap; + V8_EXPORT static const Tagged_t kLastStringMap; + }; + +#endif // V8_STATIC_ROOTS_BOOL + static const int kUndefinedValueRootIndex = 4; static const int kTheHoleValueRootIndex = 5; static const int kNullValueRootIndex = 6; @@ -623,15 +641,15 @@ class Internals { #endif } - V8_INLINE static bool HasHeapObjectTag(const internal::Address value) { + V8_INLINE static bool HasHeapObjectTag(Address value) { return (value & kHeapObjectTagMask) == static_cast
(kHeapObjectTag); } - V8_INLINE static int SmiValue(const internal::Address value) { + V8_INLINE static int SmiValue(Address value) { return PlatformSmiTagging::SmiToInt(value); } - V8_INLINE static constexpr internal::Address IntToSmi(int value) { + V8_INLINE static constexpr Address IntToSmi(int value) { return internal::IntToSmi(value); } @@ -639,16 +657,30 @@ class Internals { return PlatformSmiTagging::IsValidSmi(value); } - V8_INLINE static int GetInstanceType(const internal::Address obj) { - typedef internal::Address A; - A map = ReadTaggedPointerField(obj, kHeapObjectMapOffset); +#if V8_STATIC_ROOTS_BOOL + V8_INLINE static bool is_identical(Address obj, Tagged_t constant) { + return static_cast(obj) == constant; + } + + V8_INLINE static bool CheckInstanceMapRange(Address obj, Tagged_t first_map, + Tagged_t last_map) { + auto map = ReadRawField(obj, kHeapObjectMapOffset); +#ifdef V8_MAP_PACKING + map = UnpackMapWord(map); +#endif + return map >= first_map && map <= last_map; + } +#endif + + V8_INLINE static int GetInstanceType(Address obj) { + Address map = ReadTaggedPointerField(obj, kHeapObjectMapOffset); #ifdef V8_MAP_PACKING map = UnpackMapWord(map); #endif return ReadRawField(map, kMapInstanceTypeOffset); } - V8_INLINE static int GetOddballKind(const internal::Address obj) { + V8_INLINE static int GetOddballKind(Address obj) { return SmiValue(ReadTaggedSignedField(obj, kOddballKindOffset)); } @@ -669,80 +701,92 @@ class Internals { static_cast(kLastJSApiObjectType - kJSObjectType)); } - V8_INLINE static uint8_t GetNodeFlag(internal::Address* obj, int shift) { + V8_INLINE static uint8_t GetNodeFlag(Address* obj, int shift) { uint8_t* addr = reinterpret_cast(obj) + kNodeFlagsOffset; return *addr & static_cast(1U << shift); } - V8_INLINE static void UpdateNodeFlag(internal::Address* obj, bool value, - int shift) { + V8_INLINE static void UpdateNodeFlag(Address* obj, bool value, int shift) { uint8_t* addr = reinterpret_cast(obj) + kNodeFlagsOffset; uint8_t mask = static_cast(1U << shift); *addr = static_cast((*addr & ~mask) | (value << shift)); } - V8_INLINE static uint8_t GetNodeState(internal::Address* obj) { + V8_INLINE static uint8_t GetNodeState(Address* obj) { uint8_t* addr = reinterpret_cast(obj) + kNodeFlagsOffset; return *addr & kNodeStateMask; } - V8_INLINE static void UpdateNodeState(internal::Address* obj, uint8_t value) { + V8_INLINE static void UpdateNodeState(Address* obj, uint8_t value) { uint8_t* addr = reinterpret_cast(obj) + kNodeFlagsOffset; *addr = static_cast((*addr & ~kNodeStateMask) | value); } V8_INLINE static void SetEmbedderData(v8::Isolate* isolate, uint32_t slot, void* data) { - internal::Address addr = reinterpret_cast(isolate) + - kIsolateEmbedderDataOffset + - slot * kApiSystemPointerSize; + Address addr = reinterpret_cast
(isolate) + + kIsolateEmbedderDataOffset + slot * kApiSystemPointerSize; *reinterpret_cast(addr) = data; } V8_INLINE static void* GetEmbedderData(const v8::Isolate* isolate, uint32_t slot) { - internal::Address addr = reinterpret_cast(isolate) + - kIsolateEmbedderDataOffset + - slot * kApiSystemPointerSize; + Address addr = reinterpret_cast
(isolate) + + kIsolateEmbedderDataOffset + slot * kApiSystemPointerSize; return *reinterpret_cast(addr); } V8_INLINE static void IncrementLongTasksStatsCounter(v8::Isolate* isolate) { - internal::Address addr = reinterpret_cast(isolate) + - kIsolateLongTaskStatsCounterOffset; + Address addr = + reinterpret_cast
(isolate) + kIsolateLongTaskStatsCounterOffset; ++(*reinterpret_cast(addr)); } - V8_INLINE static internal::Address* GetRoot(v8::Isolate* isolate, int index) { - internal::Address addr = reinterpret_cast(isolate) + - kIsolateRootsOffset + - index * kApiSystemPointerSize; - return reinterpret_cast(addr); + V8_INLINE static Address* GetRootSlot(v8::Isolate* isolate, int index) { + Address addr = reinterpret_cast
(isolate) + kIsolateRootsOffset + + index * kApiSystemPointerSize; + return reinterpret_cast(addr); + } + + V8_INLINE static Address GetRoot(v8::Isolate* isolate, int index) { +#if V8_STATIC_ROOTS_BOOL + Address base = *reinterpret_cast( + reinterpret_cast(isolate) + kIsolateCageBaseOffset); + switch (index) { +#define DECOMPRESS_ROOT(name) \ + case k##name##RootIndex: \ + return base + StaticReadOnlyRoot::k##name; + EXPORTED_STATIC_ROOTS_PTR_LIST(DECOMPRESS_ROOT) +#undef DECOMPRESS_ROOT + default: + break; + } +#undef EXPORTED_STATIC_ROOTS_PTR_LIST +#endif // V8_STATIC_ROOTS_BOOL + return *GetRootSlot(isolate, index); } #ifdef V8_ENABLE_SANDBOX - V8_INLINE static internal::Address* GetExternalPointerTableBase( - v8::Isolate* isolate) { - internal::Address addr = reinterpret_cast(isolate) + - kIsolateExternalPointerTableOffset + - kExternalPointerTableBufferOffset; - return *reinterpret_cast(addr); + V8_INLINE static Address* GetExternalPointerTableBase(v8::Isolate* isolate) { + Address addr = reinterpret_cast
(isolate) + + kIsolateExternalPointerTableOffset + + kExternalPointerTableBufferOffset; + return *reinterpret_cast(addr); } - V8_INLINE static internal::Address* GetSharedExternalPointerTableBase( + V8_INLINE static Address* GetSharedExternalPointerTableBase( v8::Isolate* isolate) { - internal::Address addr = reinterpret_cast(isolate) + - kIsolateSharedExternalPointerTableAddressOffset; - addr = *reinterpret_cast(addr); + Address addr = reinterpret_cast
(isolate) + + kIsolateSharedExternalPointerTableAddressOffset; + addr = *reinterpret_cast(addr); addr += kExternalPointerTableBufferOffset; - return *reinterpret_cast(addr); + return *reinterpret_cast(addr); } #endif template - V8_INLINE static T ReadRawField(internal::Address heap_object_ptr, - int offset) { - internal::Address addr = heap_object_ptr + offset - kHeapObjectTag; + V8_INLINE static T ReadRawField(Address heap_object_ptr, int offset) { + Address addr = heap_object_ptr + offset - kHeapObjectTag; #ifdef V8_COMPRESS_POINTERS if (sizeof(T) > kApiTaggedSize) { // TODO(ishell, v8:8875): When pointer compression is enabled 8-byte size @@ -757,29 +801,28 @@ class Internals { return *reinterpret_cast(addr); } - V8_INLINE static internal::Address ReadTaggedPointerField( - internal::Address heap_object_ptr, int offset) { + V8_INLINE static Address ReadTaggedPointerField(Address heap_object_ptr, + int offset) { #ifdef V8_COMPRESS_POINTERS uint32_t value = ReadRawField(heap_object_ptr, offset); - internal::Address base = - GetPtrComprCageBaseFromOnHeapAddress(heap_object_ptr); - return base + static_cast(static_cast(value)); + Address base = GetPtrComprCageBaseFromOnHeapAddress(heap_object_ptr); + return base + static_cast
(static_cast(value)); #else - return ReadRawField(heap_object_ptr, offset); + return ReadRawField
(heap_object_ptr, offset); #endif } - V8_INLINE static internal::Address ReadTaggedSignedField( - internal::Address heap_object_ptr, int offset) { + V8_INLINE static Address ReadTaggedSignedField(Address heap_object_ptr, + int offset) { #ifdef V8_COMPRESS_POINTERS uint32_t value = ReadRawField(heap_object_ptr, offset); - return static_cast(static_cast(value)); + return static_cast
(static_cast(value)); #else - return ReadRawField(heap_object_ptr, offset); + return ReadRawField
(heap_object_ptr, offset); #endif } - V8_INLINE static v8::Isolate* GetIsolateForSandbox(internal::Address obj) { + V8_INLINE static v8::Isolate* GetIsolateForSandbox(Address obj) { #ifdef V8_ENABLE_SANDBOX return reinterpret_cast( internal::IsolateFromNeverReadOnlySpaceObject(obj)); @@ -790,40 +833,37 @@ class Internals { } template - V8_INLINE static internal::Address ReadExternalPointerField( - v8::Isolate* isolate, internal::Address heap_object_ptr, int offset) { + V8_INLINE static Address ReadExternalPointerField(v8::Isolate* isolate, + Address heap_object_ptr, + int offset) { #ifdef V8_ENABLE_SANDBOX - if (IsSandboxedExternalPointerType(tag)) { - // See src/sandbox/external-pointer-table-inl.h. Logic duplicated here so - // it can be inlined and doesn't require an additional call. - internal::Address* table = - IsSharedExternalPointerType(tag) - ? GetSharedExternalPointerTableBase(isolate) - : GetExternalPointerTableBase(isolate); - internal::ExternalPointerHandle handle = - ReadRawField(heap_object_ptr, offset); - uint32_t index = handle >> kExternalPointerIndexShift; - std::atomic* ptr = - reinterpret_cast*>(&table[index]); - internal::Address entry = - std::atomic_load_explicit(ptr, std::memory_order_relaxed); - return entry & ~tag; - } -#endif + static_assert(tag != kExternalPointerNullTag); + // See src/sandbox/external-pointer-table-inl.h. Logic duplicated here so + // it can be inlined and doesn't require an additional call. + Address* table = IsSharedExternalPointerType(tag) + ? GetSharedExternalPointerTableBase(isolate) + : GetExternalPointerTableBase(isolate); + internal::ExternalPointerHandle handle = + ReadRawField(heap_object_ptr, offset); + uint32_t index = handle >> kExternalPointerIndexShift; + std::atomic
* ptr = + reinterpret_cast*>(&table[index]); + Address entry = std::atomic_load_explicit(ptr, std::memory_order_relaxed); + return entry & ~tag; +#else return ReadRawField
(heap_object_ptr, offset); +#endif // V8_ENABLE_SANDBOX } #ifdef V8_COMPRESS_POINTERS - V8_INLINE static internal::Address GetPtrComprCageBaseFromOnHeapAddress( - internal::Address addr) { + V8_INLINE static Address GetPtrComprCageBaseFromOnHeapAddress(Address addr) { return addr & -static_cast(kPtrComprCageBaseAlignment); } - V8_INLINE static internal::Address DecompressTaggedAnyField( - internal::Address heap_object_ptr, uint32_t value) { - internal::Address base = - GetPtrComprCageBaseFromOnHeapAddress(heap_object_ptr); - return base + static_cast(static_cast(value)); + V8_INLINE static Address DecompressTaggedField(Address heap_object_ptr, + uint32_t value) { + Address base = GetPtrComprCageBaseFromOnHeapAddress(heap_object_ptr); + return base + static_cast
(static_cast(value)); } #endif // V8_COMPRESS_POINTERS @@ -861,8 +901,58 @@ class BackingStoreBase {}; // This is needed for histograms sampling garbage collection reasons. constexpr int kGarbageCollectionReasonMaxValue = 27; -} // namespace internal +// Helper functions about values contained in handles. +class ValueHelper final { + public: +#ifdef V8_ENABLE_CONSERVATIVE_STACK_SCANNING + static constexpr Address kLocalTaggedNullAddress = 1; + + template + static constexpr T* EmptyValue() { + return reinterpret_cast(kLocalTaggedNullAddress); + } + + template + V8_INLINE static Address ValueAsAddress(const T* value) { + return reinterpret_cast
(value); + } + + template + V8_INLINE static T* SlotAsValue(S* slot) { + return *reinterpret_cast(slot); + } + + template + V8_INLINE static T* ValueAsSlot(T* const& value) { + return reinterpret_cast(const_cast(&value)); + } + +#else // !V8_ENABLE_CONSERVATIVE_STACK_SCANNING + + template + static constexpr T* EmptyValue() { + return nullptr; + } + + template + V8_INLINE static Address ValueAsAddress(const T* value) { + return *reinterpret_cast(value); + } + + template + V8_INLINE static T* SlotAsValue(S* slot) { + return reinterpret_cast(slot); + } + + template + V8_INLINE static T* ValueAsSlot(T* const& value) { + return value; + } +#endif // V8_ENABLE_CONSERVATIVE_STACK_SCANNING +}; + +} // namespace internal } // namespace v8 #endif // INCLUDE_V8_INTERNAL_H_ diff --git a/deps/v8/include/v8-isolate.h b/deps/v8/include/v8-isolate.h index e9f531973b2eef..0284e6e769c819 100644 --- a/deps/v8/include/v8-isolate.h +++ b/deps/v8/include/v8-isolate.h @@ -233,7 +233,7 @@ class V8_EXPORT Isolate { * Explicitly specify a startup snapshot blob. The embedder owns the blob. * The embedder *must* ensure that the snapshot is from a trusted source. */ - StartupData* snapshot_blob = nullptr; + const StartupData* snapshot_blob = nullptr; /** * Enables the host application to provide a mechanism for recording @@ -333,12 +333,9 @@ class V8_EXPORT Isolate { const DisallowJavascriptExecutionScope&) = delete; private: - OnFailure on_failure_; - v8::Isolate* v8_isolate_; - - bool was_execution_allowed_assert_; - bool was_execution_allowed_throws_; - bool was_execution_allowed_dump_; + v8::Isolate* const v8_isolate_; + const OnFailure on_failure_; + bool was_execution_allowed_; }; /** @@ -356,7 +353,7 @@ class V8_EXPORT Isolate { const AllowJavascriptExecutionScope&) = delete; private: - Isolate* v8_isolate_; + Isolate* const v8_isolate_; bool was_execution_allowed_assert_; bool was_execution_allowed_throws_; bool was_execution_allowed_dump_; @@ -537,6 +534,8 @@ class V8_EXPORT Isolate { kTurboFanOsrCompileStarted = 115, kAsyncStackTaggingCreateTaskCall = 116, kDurationFormat = 117, + kInvalidatedNumberStringPrototypeNoReplaceProtector = 118, + kRegExpUnicodeSetIncompatibilitiesWithUnicodeMode = 119, // Unused. // If you add new values here, you'll also need to update Chromium's: // web_feature.mojom, use_counter_callback.cc, and enums.xml. V8 changes to @@ -924,27 +923,10 @@ class V8_EXPORT Isolate { void RemoveGCPrologueCallback(GCCallbackWithData, void* data = nullptr); void RemoveGCPrologueCallback(GCCallback callback); - START_ALLOW_USE_DEPRECATED() - /** - * Sets the embedder heap tracer for the isolate. - * SetEmbedderHeapTracer cannot be used simultaneously with AttachCppHeap. - */ - void SetEmbedderHeapTracer(EmbedderHeapTracer* tracer); - - /* - * Gets the currently active heap tracer for the isolate that was set with - * SetEmbedderHeapTracer. - */ - EmbedderHeapTracer* GetEmbedderHeapTracer(); - END_ALLOW_USE_DEPRECATED() - /** * Sets an embedder roots handle that V8 should consider when performing - * non-unified heap garbage collections. - * - * Using only EmbedderHeapTracer automatically sets up a default handler. - * The intended use case is for setting a custom handler after invoking - * `AttachCppHeap()`. + * non-unified heap garbage collections. The intended use case is for setting + * a custom handler after invoking `AttachCppHeap()`. * * V8 does not take ownership of the handler. */ @@ -955,8 +937,6 @@ class V8_EXPORT Isolate { * embedder maintains ownership of the CppHeap. At most one C++ heap can be * attached to V8. * - * AttachCppHeap cannot be used simultaneously with SetEmbedderHeapTracer. - * * Multi-threaded use requires the use of v8::Locker/v8::Unlocker, see * CppHeap. */ @@ -1143,9 +1123,8 @@ class V8_EXPORT Isolate { * * This should only be used for testing purposes and not to enforce a garbage * collection schedule. It has strong negative impact on the garbage - * collection performance. Use IdleNotificationDeadline() or - * LowMemoryNotification() instead to influence the garbage collection - * schedule. + * collection performance. Use MemoryPressureNotification() instead to + * influence the garbage collection schedule. */ void RequestGarbageCollectionForTesting(GarbageCollectionType type); @@ -1156,9 +1135,8 @@ class V8_EXPORT Isolate { * * This should only be used for testing purposes and not to enforce a garbage * collection schedule. It has strong negative impact on the garbage - * collection performance. Use IdleNotificationDeadline() or - * LowMemoryNotification() instead to influence the garbage collection - * schedule. + * collection performance. Use MemoryPressureNotification() instead to + * influence the garbage collection schedule. */ void RequestGarbageCollectionForTesting(GarbageCollectionType type, StackState stack_state); @@ -1310,6 +1288,8 @@ class V8_EXPORT Isolate { * that function. There is no guarantee that the actual work will be done * within the time limit. */ + V8_DEPRECATE_SOON( + "Use MemoryPressureNotification() to influence the GC schedule.") bool IdleNotificationDeadline(double deadline_in_seconds); /** @@ -1346,11 +1326,13 @@ class V8_EXPORT Isolate { * V8 uses this notification to guide heuristics which may result in a * smaller memory footprint at the cost of reduced runtime performance. */ + V8_DEPRECATED("Use IsolateInBackgroundNotification() instead") void EnableMemorySavingsMode(); /** * Optional notification which will disable the memory savings mode. */ + V8_DEPRECATED("Use IsolateInBackgroundNotification() instead") void DisableMemorySavingsMode(); /** @@ -1530,6 +1512,13 @@ class V8_EXPORT Isolate { V8_DEPRECATED("Wasm exceptions are always enabled") void SetWasmExceptionsEnabledCallback(WasmExceptionsEnabledCallback callback); + /** + * Register callback to control whehter Wasm GC is enabled. + * The callback overwrites the value of the flag. + * If the callback returns true, it will also enable Wasm stringrefs. + */ + void SetWasmGCEnabledCallback(WasmGCEnabledCallback callback); + void SetSharedArrayBufferConstructorEnabledCallback( SharedArrayBufferConstructorEnabledCallback callback); @@ -1684,7 +1673,8 @@ uint32_t Isolate::GetNumberOfDataSlots() { template MaybeLocal Isolate::GetDataFromSnapshotOnce(size_t index) { - T* data = reinterpret_cast(GetDataFromSnapshotOnce(index)); + T* data = + internal::ValueHelper::SlotAsValue(GetDataFromSnapshotOnce(index)); if (data) internal::PerformCastCheck(data); return Local(data); } diff --git a/deps/v8/include/v8-local-handle.h b/deps/v8/include/v8-local-handle.h index cbf87f949d09fa..0dbbfdbc9f7513 100644 --- a/deps/v8/include/v8-local-handle.h +++ b/deps/v8/include/v8-local-handle.h @@ -50,9 +50,14 @@ class TracedReference; class TracedReferenceBase; class Utils; +namespace debug { +class ConsoleCallArguments; +} + namespace internal { template class CustomArguments; +class SamplingHeapProfiler; } // namespace internal namespace api_internal { @@ -92,6 +97,9 @@ class V8_EXPORT V8_NODISCARD HandleScope { HandleScope(const HandleScope&) = delete; void operator=(const HandleScope&) = delete; + static internal::Address* CreateHandleForCurrentIsolate( + internal::Address value); + protected: V8_INLINE HandleScope() = default; @@ -122,6 +130,33 @@ class V8_EXPORT V8_NODISCARD HandleScope { friend class Context; }; +namespace internal { + +/** + * Helper functions about handles. + */ +class HandleHelper final { + public: + /** + * Checks whether two handles are equal. + * They are equal iff they are both empty or they are both non-empty and the + * objects to which they refer are physically equal. + * + * If both handles refer to JS objects, this is the same as strict equality. + * For primitives, such as numbers or strings, a `false` return value does not + * indicate that the values aren't equal in the JavaScript sense. + * Use `Value::StrictEquals()` to check primitives for equality. + */ + template + V8_INLINE static bool EqualHandles(const T1& lhs, const T2& rhs) { + if (lhs.IsEmpty()) return rhs.IsEmpty(); + if (rhs.IsEmpty()) return false; + return lhs.address() == rhs.address(); + } +}; + +} // namespace internal + /** * An object reference managed by the v8 garbage collector. * @@ -154,7 +189,8 @@ class V8_EXPORT V8_NODISCARD HandleScope { template class Local { public: - V8_INLINE Local() : val_(nullptr) {} + V8_INLINE Local() : val_(internal::ValueHelper::EmptyValue()) {} + template V8_INLINE Local(Local that) : val_(reinterpret_cast(*that)) { /** @@ -168,55 +204,40 @@ class Local { /** * Returns true if the handle is empty. */ - V8_INLINE bool IsEmpty() const { return val_ == nullptr; } + V8_INLINE bool IsEmpty() const { + return val_ == internal::ValueHelper::EmptyValue(); + } /** * Sets the handle to be empty. IsEmpty() will then return true. */ - V8_INLINE void Clear() { val_ = nullptr; } + V8_INLINE void Clear() { val_ = internal::ValueHelper::EmptyValue(); } V8_INLINE T* operator->() const { return val_; } V8_INLINE T* operator*() const { return val_; } /** - * Checks whether two handles are the same. - * Returns true if both are empty, or if the objects to which they refer - * are identical. + * Checks whether two handles are equal or different. + * They are equal iff they are both empty or they are both non-empty and the + * objects to which they refer are physically equal. * - * If both handles refer to JS objects, this is the same as strict equality. - * For primitives, such as numbers or strings, a `false` return value does not - * indicate that the values aren't equal in the JavaScript sense. - * Use `Value::StrictEquals()` to check primitives for equality. + * If both handles refer to JS objects, this is the same as strict + * non-equality. For primitives, such as numbers or strings, a `true` return + * value does not indicate that the values aren't equal in the JavaScript + * sense. Use `Value::StrictEquals()` to check primitives for equality. */ + template V8_INLINE bool operator==(const Local& that) const { - internal::Address* a = reinterpret_cast(this->val_); - internal::Address* b = reinterpret_cast(that.val_); - if (a == nullptr) return b == nullptr; - if (b == nullptr) return false; - return *a == *b; + return internal::HandleHelper::EqualHandles(*this, that); } template V8_INLINE bool operator==(const PersistentBase& that) const { - internal::Address* a = reinterpret_cast(this->val_); - internal::Address* b = reinterpret_cast(that.val_); - if (a == nullptr) return b == nullptr; - if (b == nullptr) return false; - return *a == *b; + return internal::HandleHelper::EqualHandles(*this, that); } - /** - * Checks whether two handles are different. - * Returns true if only one of the handles is empty, or if - * the objects to which they refer are different. - * - * If both handles refer to JS objects, this is the same as strict - * non-equality. For primitives, such as numbers or strings, a `true` return - * value does not indicate that the values aren't equal in the JavaScript - * sense. Use `Value::StrictEquals()` to check primitives for equality. - */ template V8_INLINE bool operator!=(const Local& that) const { return !operator==(that); @@ -263,12 +284,12 @@ class Local { V8_INLINE static Local New(Isolate* isolate, const PersistentBase& that) { - return New(isolate, that.val_); + return New(isolate, internal::ValueHelper::SlotAsValue(that.val_)); } V8_INLINE static Local New(Isolate* isolate, const BasicTracedReference& that) { - return New(isolate, *that); + return New(isolate, internal::ValueHelper::SlotAsValue(*that)); } private: @@ -277,12 +298,6 @@ class Local { template friend class Eternal; template - friend class PersistentBase; - template - friend class Persistent; - template - friend class Local; - template friend class MaybeLocal; template friend class FunctionCallbackInfo; @@ -309,19 +324,31 @@ class Local { friend class ReturnValue; template friend class Traced; - template - friend class BasicTracedReference; - template - friend class TracedReference; + friend class internal::SamplingHeapProfiler; + friend class internal::HandleHelper; + friend class debug::ConsoleCallArguments; explicit V8_INLINE Local(T* that) : val_(that) {} + + V8_INLINE internal::Address address() const { + return internal::ValueHelper::ValueAsAddress(val_); + } + + V8_INLINE static Local FromSlot(internal::Address* slot) { + return Local(internal::ValueHelper::SlotAsValue(slot)); + } + V8_INLINE static Local New(Isolate* isolate, T* that) { +#ifdef V8_ENABLE_CONSERVATIVE_STACK_SCANNING + return Local(that); +#else if (that == nullptr) return Local(); - T* that_ptr = that; - internal::Address* p = reinterpret_cast(that_ptr); + internal::Address* p = reinterpret_cast(that); return Local(reinterpret_cast(HandleScope::CreateHandle( reinterpret_cast(isolate), *p))); +#endif } + T* val_; }; @@ -344,13 +371,15 @@ using Handle = Local; template class MaybeLocal { public: - V8_INLINE MaybeLocal() : val_(nullptr) {} + V8_INLINE MaybeLocal() : val_(internal::ValueHelper::EmptyValue()) {} template V8_INLINE MaybeLocal(Local that) : val_(reinterpret_cast(*that)) { static_assert(std::is_base_of::value, "type check"); } - V8_INLINE bool IsEmpty() const { return val_ == nullptr; } + V8_INLINE bool IsEmpty() const { + return val_ == internal::ValueHelper::EmptyValue(); + } /** * Converts this MaybeLocal<> to a Local<>. If this MaybeLocal<> is empty, @@ -358,7 +387,7 @@ class MaybeLocal { */ template V8_WARN_UNUSED_RESULT V8_INLINE bool ToLocal(Local* out) const { - out->val_ = IsEmpty() ? nullptr : this->val_; + out->val_ = IsEmpty() ? internal::ValueHelper::EmptyValue() : this->val_; return !IsEmpty(); } @@ -367,7 +396,7 @@ class MaybeLocal { * V8 will crash the process. */ V8_INLINE Local ToLocalChecked() { - if (V8_UNLIKELY(val_ == nullptr)) api_internal::ToLocalEmpty(); + if (V8_UNLIKELY(IsEmpty())) api_internal::ToLocalEmpty(); return Local(val_); } @@ -399,9 +428,13 @@ class V8_EXPORT V8_NODISCARD EscapableHandleScope : public HandleScope { */ template V8_INLINE Local Escape(Local value) { +#ifdef V8_ENABLE_CONSERVATIVE_STACK_SCANNING + return value; +#else internal::Address* slot = Escape(reinterpret_cast(*value)); return Local(reinterpret_cast(slot)); +#endif } template diff --git a/deps/v8/include/v8-metrics.h b/deps/v8/include/v8-metrics.h index 887012ac8c3a0b..5c6c1c4705e38b 100644 --- a/deps/v8/include/v8-metrics.h +++ b/deps/v8/include/v8-metrics.h @@ -12,6 +12,7 @@ #include "v8-internal.h" // NOLINT(build/include_directory) #include "v8-local-handle.h" // NOLINT(build/include_directory) +#include "v8config.h" // NOLINT(build/include_directory) namespace v8 { @@ -96,16 +97,42 @@ struct GarbageCollectionYoungCycle { }; struct WasmModuleDecoded { + WasmModuleDecoded() = default; + WasmModuleDecoded(bool async, bool streamed, bool success, + size_t module_size_in_bytes, size_t function_count, + int64_t wall_clock_duration_in_us) + : async(async), + streamed(streamed), + success(success), + module_size_in_bytes(module_size_in_bytes), + function_count(function_count), + wall_clock_duration_in_us(wall_clock_duration_in_us) {} + bool async = false; bool streamed = false; bool success = false; size_t module_size_in_bytes = 0; size_t function_count = 0; int64_t wall_clock_duration_in_us = -1; - int64_t cpu_duration_in_us = -1; }; struct WasmModuleCompiled { + WasmModuleCompiled() = default; + + WasmModuleCompiled(bool async, bool streamed, bool cached, bool deserialized, + bool lazy, bool success, size_t code_size_in_bytes, + size_t liftoff_bailout_count, + int64_t wall_clock_duration_in_us) + : async(async), + streamed(streamed), + cached(cached), + deserialized(deserialized), + lazy(lazy), + success(success), + code_size_in_bytes(code_size_in_bytes), + liftoff_bailout_count(liftoff_bailout_count), + wall_clock_duration_in_us(wall_clock_duration_in_us) {} + bool async = false; bool streamed = false; bool cached = false; @@ -115,7 +142,6 @@ struct WasmModuleCompiled { size_t code_size_in_bytes = 0; size_t liftoff_bailout_count = 0; int64_t wall_clock_duration_in_us = -1; - int64_t cpu_duration_in_us = -1; }; struct WasmModuleInstantiated { diff --git a/deps/v8/include/v8-object.h b/deps/v8/include/v8-object.h index d7332ba0c88d12..d805dbe9e7d818 100644 --- a/deps/v8/include/v8-object.h +++ b/deps/v8/include/v8-object.h @@ -607,6 +607,19 @@ class V8_EXPORT Object : public Value { return object.val_->GetCreationContext(); } + /** + * Gets the context in which the object was created (see GetCreationContext()) + * and if it's available reads respective embedder field value. + * If the context can't be obtained nullptr is returned. + * Basically it's a shortcut for + * obj->GetCreationContext().GetAlignedPointerFromEmbedderData(index) + * which doesn't create a handle for Context object on the way and doesn't + * try to expand the embedder data attached to the context. + * In case the Local is already available because of other reasons, + * it's fine to keep using Context::GetAlignedPointerFromEmbedderData(). + */ + void* GetAlignedPointerFromEmbedderDataInCreationContext(int index); + /** * Checks whether a callback is set by the * ObjectTemplate::SetCallAsFunctionHandler method. @@ -707,7 +720,7 @@ Local Object::GetInternalField(int index) { #ifndef V8_ENABLE_CHECKS using A = internal::Address; using I = internal::Internals; - A obj = *reinterpret_cast(this); + A obj = internal::ValueHelper::ValueAsAddress(this); // Fast path: If the object is a plain JSObject, which is the common case, we // know where to find the internal fields and can return the value directly. int instance_type = I::GetInstanceType(obj); @@ -717,12 +730,17 @@ Local Object::GetInternalField(int index) { #ifdef V8_COMPRESS_POINTERS // We read the full pointer value and then decompress it in order to avoid // dealing with potential endiannes issues. - value = I::DecompressTaggedAnyField(obj, static_cast(value)); + value = I::DecompressTaggedField(obj, static_cast(value)); #endif + +#ifdef V8_ENABLE_CONSERVATIVE_STACK_SCANNING + return Local(reinterpret_cast(value)); +#else internal::Isolate* isolate = internal::IsolateFromNeverReadOnlySpaceObject(obj); A* result = HandleScope::CreateHandle(isolate, value); return Local(reinterpret_cast(result)); +#endif } #endif return SlowGetInternalField(index); @@ -732,7 +750,7 @@ void* Object::GetAlignedPointerFromInternalField(int index) { #if !defined(V8_ENABLE_CHECKS) using A = internal::Address; using I = internal::Internals; - A obj = *reinterpret_cast(this); + A obj = internal::ValueHelper::ValueAsAddress(this); // Fast path: If the object is a plain JSObject, which is the common case, we // know where to find the internal fields and can return the value directly. auto instance_type = I::GetInstanceType(obj); diff --git a/deps/v8/include/v8-persistent-handle.h b/deps/v8/include/v8-persistent-handle.h index dbda4edb9baf4e..fbae1aa6f284e2 100644 --- a/deps/v8/include/v8-persistent-handle.h +++ b/deps/v8/include/v8-persistent-handle.h @@ -55,7 +55,7 @@ class Eternal { V8_INLINE Local Get(Isolate* isolate) const { // The eternal handle will never go away, so as with the roots, we don't // even need to open a handle. - return Local(val_); + return Local(internal::ValueHelper::SlotAsValue(val_)); } V8_INLINE bool IsEmpty() const { return val_ == nullptr; } @@ -68,6 +68,10 @@ class Eternal { } private: + V8_INLINE internal::Address address() const { + return *reinterpret_cast(val_); + } + T* val_; }; @@ -122,20 +126,12 @@ class PersistentBase { template V8_INLINE bool operator==(const PersistentBase& that) const { - internal::Address* a = reinterpret_cast(this->val_); - internal::Address* b = reinterpret_cast(that.val_); - if (a == nullptr) return b == nullptr; - if (b == nullptr) return false; - return *a == *b; + return internal::HandleHelper::EqualHandles(*this, that); } template V8_INLINE bool operator==(const Local& that) const { - internal::Address* a = reinterpret_cast(this->val_); - internal::Address* b = reinterpret_cast(that.val_); - if (a == nullptr) return b == nullptr; - if (b == nullptr) return false; - return *a == *b; + return internal::HandleHelper::EqualHandles(*this, that); } template @@ -221,8 +217,15 @@ class PersistentBase { template friend class PersistentValueVector; friend class Object; + friend class internal::HandleHelper; explicit V8_INLINE PersistentBase(T* val) : val_(val) {} + V8_INLINE T* operator*() const { return this->val_; } + V8_INLINE internal::Address address() const { + return *reinterpret_cast(val_); + } + + V8_INLINE static T* New(Isolate* isolate, Local that); V8_INLINE static T* New(Isolate* isolate, T* that); T* val_; @@ -282,11 +285,13 @@ class Persistent : public PersistentBase { * When the Local is non-empty, a new storage cell is created * pointing to the same object, and no flags are set. */ + template V8_INLINE Persistent(Isolate* isolate, Local that) - : PersistentBase(PersistentBase::New(isolate, *that)) { + : PersistentBase(PersistentBase::New(isolate, that)) { static_assert(std::is_base_of::value, "type check"); } + /** * Construct a Persistent from a Persistent. * When the Persistent is non-empty, a new storage cell is created @@ -356,7 +361,6 @@ class Persistent : public PersistentBase { friend class ReturnValue; explicit V8_INLINE Persistent(T* that) : PersistentBase(that) {} - V8_INLINE T* operator*() const { return this->val_; } template V8_INLINE void Copy(const Persistent& that); }; @@ -381,7 +385,7 @@ class Global : public PersistentBase { */ template V8_INLINE Global(Isolate* isolate, Local that) - : PersistentBase(PersistentBase::New(isolate, *that)) { + : PersistentBase(PersistentBase::New(isolate, that)) { static_assert(std::is_base_of::value, "type check"); } @@ -425,7 +429,6 @@ class Global : public PersistentBase { private: template friend class ReturnValue; - V8_INLINE T* operator*() const { return this->val_; } }; // UniquePersistent is an alias for Global for historical reason. @@ -442,6 +445,12 @@ class V8_EXPORT PersistentHandleVisitor { uint16_t class_id) {} }; +template +T* PersistentBase::New(Isolate* isolate, Local that) { + return PersistentBase::New(isolate, + internal::ValueHelper::ValueAsSlot(*that)); +} + template T* PersistentBase::New(Isolate* isolate, T* that) { if (that == nullptr) return nullptr; @@ -486,7 +495,7 @@ void PersistentBase::Reset(Isolate* isolate, const Local& other) { static_assert(std::is_base_of::value, "type check"); Reset(); if (other.IsEmpty()) return; - this->val_ = New(isolate, other.val_); + this->val_ = New(isolate, internal::ValueHelper::ValueAsSlot(*other)); } /** diff --git a/deps/v8/include/v8-platform.h b/deps/v8/include/v8-platform.h index 32a82f881e7f93..4f476f5c3c3e73 100644 --- a/deps/v8/include/v8-platform.h +++ b/deps/v8/include/v8-platform.h @@ -5,9 +5,11 @@ #ifndef V8_V8_PLATFORM_H_ #define V8_V8_PLATFORM_H_ +#include #include #include #include // For abort. + #include #include @@ -265,6 +267,38 @@ class JobTask { virtual size_t GetMaxConcurrency(size_t worker_count) const = 0; }; +/** + * A "blocking call" refers to any call that causes the calling thread to wait + * off-CPU. It includes but is not limited to calls that wait on synchronous + * file I/O operations: read or write a file from disk, interact with a pipe or + * a socket, rename or delete a file, enumerate files in a directory, etc. + * Acquiring a low contention lock is not considered a blocking call. + */ + +/** + * BlockingType indicates the likelihood that a blocking call will actually + * block. + */ +enum class BlockingType { + // The call might block (e.g. file I/O that might hit in memory cache). + kMayBlock, + // The call will definitely block (e.g. cache already checked and now pinging + // server synchronously). + kWillBlock +}; + +/** + * This class is instantiated with CreateBlockingScope() in every scope where a + * blocking call is made and serves as a precise annotation of the scope that + * may/will block. May be implemented by an embedder to adjust the thread count. + * CPU usage should be minimal within that scope. ScopedBlockingCalls can be + * nested. + */ +class ScopedBlockingCall { + public: + virtual ~ScopedBlockingCall() = default; +}; + /** * The interface represents complex arguments to trace events. */ @@ -285,6 +319,8 @@ class ConvertableToTraceFormat { * V8 Tracing controller. * * Can be implemented by an embedder to record trace events from V8. + * + * Will become obsolete in Perfetto SDK build (v8_use_perfetto = true). */ class TracingController { public: @@ -348,10 +384,16 @@ class TracingController { virtual void OnTraceDisabled() = 0; }; - /** Adds tracing state change observer. */ + /** + * Adds tracing state change observer. + * Does nothing in Perfetto SDK build (v8_use_perfetto = true). + */ virtual void AddTraceStateObserver(TraceStateObserver*) {} - /** Removes tracing state change observer. */ + /** + * Removes tracing state change observer. + * Does nothing in Perfetto SDK build (v8_use_perfetto = true). + */ virtual void RemoveTraceStateObserver(TraceStateObserver*) {} }; @@ -534,7 +576,7 @@ static constexpr PlatformSharedMemoryHandle kInvalidSharedMemoryHandle = -1; // to avoid pulling in large OS header files into this header file. Instead, // the users of these routines are expected to include the respecitve OS // headers in addition to this one. -#if V8_OS_MACOS +#if V8_OS_DARWIN // Convert between a shared memory handle and a mach_port_t referencing a memory // entry object. inline PlatformSharedMemoryHandle SharedMemoryHandleFromMachMemoryEntry( @@ -945,11 +987,12 @@ class Platform { virtual void OnCriticalMemoryPressure() {} /** - * Gets the number of worker threads used by - * Call(BlockingTask)OnWorkerThread(). This can be used to estimate the number - * of tasks a work package should be split into. A return value of 0 means - * that there are no worker threads available. Note that a value of 0 won't - * prohibit V8 from posting tasks using |CallOnWorkerThread|. + * Gets the max number of worker threads that may be used to execute + * concurrent work scheduled for any single TaskPriority by + * Call(BlockingTask)OnWorkerThread() or PostJob(). This can be used to + * estimate the number of tasks a work package should be split into. A return + * value of 0 means that there are no worker threads available. Note that a + * value of 0 won't prohibit V8 from posting tasks using |CallOnWorkerThread|. */ virtual int NumberOfWorkerThreads() = 0; @@ -1064,6 +1107,14 @@ class Platform { virtual std::unique_ptr CreateJob( TaskPriority priority, std::unique_ptr job_task) = 0; + /** + * Instantiates a ScopedBlockingCall to annotate a scope that may/will block. + */ + virtual std::unique_ptr CreateBlockingScope( + BlockingType blocking_type) { + return nullptr; + } + /** * Monotonically increasing time in seconds from an arbitrary fixed point in * the past. This function is expected to return at least @@ -1074,11 +1125,28 @@ class Platform { virtual double MonotonicallyIncreasingTime() = 0; /** - * Current wall-clock time in milliseconds since epoch. - * This function is expected to return at least millisecond-precision values. + * Current wall-clock time in milliseconds since epoch. Use + * CurrentClockTimeMillisHighResolution() when higher precision is + * required. + */ + virtual int64_t CurrentClockTimeMilliseconds() { + return floor(CurrentClockTimeMillis()); + } + + /** + * This function is deprecated and will be deleted. Use either + * CurrentClockTimeMilliseconds() or + * CurrentClockTimeMillisecondsHighResolution(). */ virtual double CurrentClockTimeMillis() = 0; + /** + * Same as CurrentClockTimeMilliseconds(), but with more precision. + */ + virtual double CurrentClockTimeMillisecondsHighResolution() { + return CurrentClockTimeMillis(); + } + typedef void (*StackTracePrinter)(); /** diff --git a/deps/v8/include/v8-primitive.h b/deps/v8/include/v8-primitive.h index 4fef8da7f8d5e7..4148a7053a267f 100644 --- a/deps/v8/include/v8-primitive.h +++ b/deps/v8/include/v8-primitive.h @@ -493,8 +493,15 @@ class V8_EXPORT String : public Name { /** * Returns true if this string can be made external. */ + V8_DEPRECATE_SOON("Use the version that takes an encoding as argument.") bool CanMakeExternal() const; + /** + * Returns true if this string can be made external, given the encoding for + * the external string resource. + */ + bool CanMakeExternal(Encoding encoding) const; + /** * Returns true if the strings values are equal. Same as JS ==/===. */ @@ -776,14 +783,14 @@ Local String::Empty(Isolate* isolate) { using S = internal::Address; using I = internal::Internals; I::CheckInitialized(isolate); - S* slot = I::GetRoot(isolate, I::kEmptyStringRootIndex); - return Local(reinterpret_cast(slot)); + S* slot = I::GetRootSlot(isolate, I::kEmptyStringRootIndex); + return Local::FromSlot(slot); } String::ExternalStringResource* String::GetExternalStringResource() const { using A = internal::Address; using I = internal::Internals; - A obj = *reinterpret_cast(this); + A obj = internal::ValueHelper::ValueAsAddress(this); ExternalStringResource* result; if (I::IsExternalTwoByteString(I::GetInstanceType(obj))) { @@ -804,7 +811,7 @@ String::ExternalStringResourceBase* String::GetExternalStringResourceBase( String::Encoding* encoding_out) const { using A = internal::Address; using I = internal::Internals; - A obj = *reinterpret_cast(this); + A obj = internal::ValueHelper::ValueAsAddress(this); int type = I::GetInstanceType(obj) & I::kStringRepresentationAndEncodingMask; *encoding_out = static_cast(type & I::kStringEncodingMask); ExternalStringResourceBase* resource; @@ -829,32 +836,32 @@ V8_INLINE Local Undefined(Isolate* isolate) { using S = internal::Address; using I = internal::Internals; I::CheckInitialized(isolate); - S* slot = I::GetRoot(isolate, I::kUndefinedValueRootIndex); - return Local(reinterpret_cast(slot)); + S* slot = I::GetRootSlot(isolate, I::kUndefinedValueRootIndex); + return Local::FromSlot(slot); } V8_INLINE Local Null(Isolate* isolate) { using S = internal::Address; using I = internal::Internals; I::CheckInitialized(isolate); - S* slot = I::GetRoot(isolate, I::kNullValueRootIndex); - return Local(reinterpret_cast(slot)); + S* slot = I::GetRootSlot(isolate, I::kNullValueRootIndex); + return Local::FromSlot(slot); } V8_INLINE Local True(Isolate* isolate) { using S = internal::Address; using I = internal::Internals; I::CheckInitialized(isolate); - S* slot = I::GetRoot(isolate, I::kTrueValueRootIndex); - return Local(reinterpret_cast(slot)); + S* slot = I::GetRootSlot(isolate, I::kTrueValueRootIndex); + return Local::FromSlot(slot); } V8_INLINE Local False(Isolate* isolate) { using S = internal::Address; using I = internal::Internals; I::CheckInitialized(isolate); - S* slot = I::GetRoot(isolate, I::kFalseValueRootIndex); - return Local(reinterpret_cast(slot)); + S* slot = I::GetRootSlot(isolate, I::kFalseValueRootIndex); + return Local::FromSlot(slot); } Local Boolean::New(Isolate* isolate, bool value) { diff --git a/deps/v8/include/v8-profiler.h b/deps/v8/include/v8-profiler.h index 6b73fc60bf2c21..d3941512218342 100644 --- a/deps/v8/include/v8-profiler.h +++ b/deps/v8/include/v8-profiler.h @@ -596,6 +596,7 @@ class V8_EXPORT HeapGraphNode { kBigInt = 13, // BigInt. kObjectShape = 14, // Internal data used for tracking the shapes (or // "hidden classes") of JS objects. + kWasmObject = 15, // A WasmGC struct or array. }; /** Returns node type (see HeapGraphNode::Type). */ diff --git a/deps/v8/include/v8-script.h b/deps/v8/include/v8-script.h index e2ba845268d921..4a8ccab7e28d1d 100644 --- a/deps/v8/include/v8-script.h +++ b/deps/v8/include/v8-script.h @@ -11,6 +11,7 @@ #include #include +#include "v8-callbacks.h" // NOLINT(build/include_directory) #include "v8-data.h" // NOLINT(build/include_directory) #include "v8-local-handle.h" // NOLINT(build/include_directory) #include "v8-maybe.h" // NOLINT(build/include_directory) @@ -347,6 +348,12 @@ class V8_EXPORT Script { * ScriptOrigin. This can be either a v8::String or v8::Undefined. */ Local GetResourceName(); + + /** + * If the script was compiled, returns the positions of lazy functions which + * were eventually compiled and executed. + */ + std::vector GetProducedCompileHints() const; }; enum class ScriptType { kClassic, kModule }; @@ -407,6 +414,8 @@ class V8_EXPORT ScriptCompiler { V8_INLINE explicit Source( Local source_string, CachedData* cached_data = nullptr, ConsumeCodeCacheTask* consume_cache_task = nullptr); + V8_INLINE Source(Local source_string, const ScriptOrigin& origin, + CompileHintCallback callback, void* callback_data); V8_INLINE ~Source() = default; // Ownership of the CachedData or its buffers is *not* transferred to the @@ -434,6 +443,10 @@ class V8_EXPORT ScriptCompiler { // set when calling a compile method. std::unique_ptr cached_data; std::unique_ptr consume_cache_task; + + // For requesting compile hints from the embedder. + CompileHintCallback compile_hint_callback = nullptr; + void* compile_hint_callback_data = nullptr; }; /** @@ -562,7 +575,9 @@ class V8_EXPORT ScriptCompiler { enum CompileOptions { kNoCompileOptions = 0, kConsumeCodeCache, - kEagerCompile + kEagerCompile, + kProduceCompileHints, + kConsumeCompileHints }; /** @@ -775,6 +790,19 @@ ScriptCompiler::Source::Source(Local string, CachedData* data, cached_data(data), consume_cache_task(consume_cache_task) {} +ScriptCompiler::Source::Source(Local string, const ScriptOrigin& origin, + CompileHintCallback callback, + void* callback_data) + : source_string(string), + resource_name(origin.ResourceName()), + resource_line_offset(origin.LineOffset()), + resource_column_offset(origin.ColumnOffset()), + resource_options(origin.Options()), + source_map_url(origin.SourceMapUrl()), + host_defined_options(origin.GetHostDefinedOptions()), + compile_hint_callback(callback), + compile_hint_callback_data(callback_data) {} + const ScriptCompiler::CachedData* ScriptCompiler::Source::GetCachedData() const { return cached_data.get(); diff --git a/deps/v8/include/v8-snapshot.h b/deps/v8/include/v8-snapshot.h index 2400357cf6e069..d47bcbaec9e976 100644 --- a/deps/v8/include/v8-snapshot.h +++ b/deps/v8/include/v8-snapshot.h @@ -91,7 +91,7 @@ class V8_EXPORT SnapshotCreator { */ SnapshotCreator(Isolate* isolate, const intptr_t* external_references = nullptr, - StartupData* existing_blob = nullptr); + const StartupData* existing_blob = nullptr); /** * Create and enter an isolate, and set it up for serialization. @@ -102,7 +102,7 @@ class V8_EXPORT SnapshotCreator { * that must be equivalent to CreateParams::external_references. */ SnapshotCreator(const intptr_t* external_references = nullptr, - StartupData* existing_blob = nullptr); + const StartupData* existing_blob = nullptr); /** * Destroy the snapshot creator, and exit and dispose of the Isolate @@ -179,16 +179,12 @@ class V8_EXPORT SnapshotCreator { template size_t SnapshotCreator::AddData(Local context, Local object) { - T* object_ptr = *object; - internal::Address* p = reinterpret_cast(object_ptr); - return AddData(context, *p); + return AddData(context, internal::ValueHelper::ValueAsAddress(*object)); } template size_t SnapshotCreator::AddData(Local object) { - T* object_ptr = *object; - internal::Address* p = reinterpret_cast(object_ptr); - return AddData(*p); + return AddData(internal::ValueHelper::ValueAsAddress(*object)); } } // namespace v8 diff --git a/deps/v8/include/v8-template.h b/deps/v8/include/v8-template.h index 669012a9814465..11296cd48896dd 100644 --- a/deps/v8/include/v8-template.h +++ b/deps/v8/include/v8-template.h @@ -30,7 +30,9 @@ class Signature; F(AsyncIteratorPrototype, initial_async_iterator_prototype) \ F(ErrorPrototype, initial_error_prototype) \ F(IteratorPrototype, initial_iterator_prototype) \ - F(ObjProto_valueOf, object_value_of_function) + F(MapIteratorPrototype, initial_map_iterator_prototype) \ + F(ObjProto_valueOf, object_value_of_function) \ + F(SetIteratorPrototype, initial_set_iterator_prototype) enum Intrinsic { #define V8_DECL_INTRINSIC(name, iname) k##name, diff --git a/deps/v8/include/v8-traced-handle.h b/deps/v8/include/v8-traced-handle.h index e0fd57c49d4c55..d92c3fdc867df5 100644 --- a/deps/v8/include/v8-traced-handle.h +++ b/deps/v8/include/v8-traced-handle.h @@ -62,7 +62,8 @@ class TracedReferenceBase { */ V8_INLINE v8::Local Get(v8::Isolate* isolate) const { if (IsEmpty()) return Local(); - return Local::New(isolate, reinterpret_cast(val_)); + return Local::New(isolate, + internal::ValueHelper::SlotAsValue(val_)); } /** @@ -103,10 +104,13 @@ class TracedReferenceBase { V8_EXPORT void CheckValue() const; + V8_INLINE internal::Address address() const { return *val_; } + // val_ points to a GlobalHandles node. internal::Address* val_ = nullptr; friend class internal::BasicTracedReferenceExtractor; + friend class internal::HandleHelper; template friend class Local; template @@ -117,11 +121,11 @@ class TracedReferenceBase { /** * A traced handle with copy and move semantics. The handle is to be used - * together with |v8::EmbedderHeapTracer| or as part of GarbageCollected objects - * (see v8-cppgc.h) and specifies edges from C++ objects to JavaScript. + * together as part of GarbageCollected objects (see v8-cppgc.h) or from stack + * and specifies edges from C++ objects to JavaScript. * * The exact semantics are: - * - Tracing garbage collections use |v8::EmbedderHeapTracer| or cppgc. + * - Tracing garbage collections using CppHeap. * - Non-tracing garbage collections refer to * |v8::EmbedderRootsHandler::IsRoot()| whether the handle should * be treated as root or not. @@ -135,7 +139,12 @@ class BasicTracedReference : public TracedReferenceBase { /** * Construct a Local from this handle. */ - Local Get(Isolate* isolate) const { return Local::New(isolate, *this); } + Local Get(Isolate* isolate) const { +#ifdef V8_ENABLE_CONSERVATIVE_STACK_SCANNING + if (val_ == nullptr) return Local(); +#endif + return Local::New(isolate, *this); + } template V8_INLINE BasicTracedReference& As() const { @@ -166,7 +175,6 @@ class BasicTracedReference : public TracedReferenceBase { Isolate* isolate, T* that, void* slot, internal::GlobalHandleStoreMode store_mode); - friend class EmbedderHeapTracer; template friend class Local; friend class Object; @@ -181,13 +189,7 @@ class BasicTracedReference : public TracedReferenceBase { /** * A traced handle without destructor that clears the handle. The embedder needs * to ensure that the handle is not accessed once the V8 object has been - * reclaimed. This can happen when the handle is not passed through the - * EmbedderHeapTracer. For more details see BasicTracedReference. - * - * The reference assumes the embedder has precise knowledge about references at - * all times. In case V8 needs to separately handle on-stack references, the - * embedder is required to set the stack start through - * |EmbedderHeapTracer::SetStackStart|. + * reclaimed. For more details see BasicTracedReference. */ template class TracedReference : public BasicTracedReference { @@ -207,7 +209,7 @@ class TracedReference : public BasicTracedReference { */ template TracedReference(Isolate* isolate, Local that) : BasicTracedReference() { - this->val_ = this->New(isolate, that.val_, &this->val_, + this->val_ = this->New(isolate, *that, &this->val_, internal::GlobalHandleStoreMode::kInitializingStore); static_assert(std::is_base_of::value, "type check"); } @@ -291,7 +293,7 @@ template internal::Address* BasicTracedReference::New( Isolate* isolate, T* that, void* slot, internal::GlobalHandleStoreMode store_mode) { - if (that == nullptr) return nullptr; + if (that == internal::ValueHelper::EmptyValue()) return nullptr; internal::Address* p = reinterpret_cast(that); return internal::GlobalizeTracedReference( reinterpret_cast(isolate), p, @@ -306,21 +308,13 @@ void TracedReferenceBase::Reset() { V8_INLINE bool operator==(const TracedReferenceBase& lhs, const TracedReferenceBase& rhs) { - v8::internal::Address* a = reinterpret_cast(lhs.val_); - v8::internal::Address* b = reinterpret_cast(rhs.val_); - if (a == nullptr) return b == nullptr; - if (b == nullptr) return false; - return *a == *b; + return internal::HandleHelper::EqualHandles(lhs, rhs); } template V8_INLINE bool operator==(const TracedReferenceBase& lhs, const v8::Local& rhs) { - v8::internal::Address* a = reinterpret_cast(lhs.val_); - v8::internal::Address* b = reinterpret_cast(*rhs); - if (a == nullptr) return b == nullptr; - if (b == nullptr) return false; - return *a == *b; + return internal::HandleHelper::EqualHandles(lhs, rhs); } template @@ -353,7 +347,7 @@ void TracedReference::Reset(Isolate* isolate, const Local& other) { this->Reset(); if (other.IsEmpty()) return; this->SetSlotThreadSafe( - this->New(isolate, other.val_, &this->val_, + this->New(isolate, *other, &this->val_, internal::GlobalHandleStoreMode::kAssigningStore)); } diff --git a/deps/v8/include/v8-util.h b/deps/v8/include/v8-util.h index 159027d31786ff..36611697632296 100644 --- a/deps/v8/include/v8-util.h +++ b/deps/v8/include/v8-util.h @@ -181,7 +181,11 @@ class PersistentValueMapBase { * Get value stored in map. */ Local Get(const K& key) { - return Local::New(isolate_, FromVal(Traits::Get(&impl_, key))); + V* p = FromVal(Traits::Get(&impl_, key)); +#ifdef V8_ENABLE_CONSERVATIVE_STACK_SCANNING + if (p == nullptr) return Local(); +#endif + return Local::New(isolate_, p); } /** @@ -236,7 +240,8 @@ class PersistentValueMapBase { : value_(other.value_) { } Local NewLocal(Isolate* isolate) const { - return Local::New(isolate, FromVal(value_)); + return Local::New( + isolate, internal::ValueHelper::SlotAsValue(FromVal(value_))); } bool IsEmpty() const { return value_ == kPersistentContainerNotFound; @@ -613,7 +618,8 @@ class V8_DEPRECATE_SOON("Use std::vector>.") PersistentValueVector { * Retrieve the i-th value in the vector. */ Local Get(size_t index) const { - return Local::New(isolate_, FromVal(Traits::Get(&impl_, index))); + return Local::New(isolate_, internal::ValueHelper::SlotAsValue( + FromVal(Traits::Get(&impl_, index)))); } /** diff --git a/deps/v8/include/v8-value.h b/deps/v8/include/v8-value.h index 866da201245877..c80ae064ee7ba9 100644 --- a/deps/v8/include/v8-value.h +++ b/deps/v8/include/v8-value.h @@ -344,6 +344,11 @@ class V8_EXPORT Value : public Data { */ bool IsWasmModuleObject() const; + /** + * Returns true if this value is the WasmNull object. + */ + bool IsWasmNull() const; + /** * Returns true if the value is a Module Namespace Object. */ @@ -469,10 +474,14 @@ bool Value::IsUndefined() const { bool Value::QuickIsUndefined() const { using A = internal::Address; using I = internal::Internals; - A obj = *reinterpret_cast(this); + A obj = internal::ValueHelper::ValueAsAddress(this); +#if V8_STATIC_ROOTS_BOOL + return I::is_identical(obj, I::StaticReadOnlyRoot::kUndefinedValue); +#else if (!I::HasHeapObjectTag(obj)) return false; if (I::GetInstanceType(obj) != I::kOddballType) return false; return (I::GetOddballKind(obj) == I::kUndefinedOddballKind); +#endif // V8_STATIC_ROOTS_BOOL } bool Value::IsNull() const { @@ -486,10 +495,14 @@ bool Value::IsNull() const { bool Value::QuickIsNull() const { using A = internal::Address; using I = internal::Internals; - A obj = *reinterpret_cast(this); + A obj = internal::ValueHelper::ValueAsAddress(this); +#if V8_STATIC_ROOTS_BOOL + return I::is_identical(obj, I::StaticReadOnlyRoot::kNullValue); +#else if (!I::HasHeapObjectTag(obj)) return false; if (I::GetInstanceType(obj) != I::kOddballType) return false; return (I::GetOddballKind(obj) == I::kNullOddballKind); +#endif // V8_STATIC_ROOTS_BOOL } bool Value::IsNullOrUndefined() const { @@ -501,13 +514,17 @@ bool Value::IsNullOrUndefined() const { } bool Value::QuickIsNullOrUndefined() const { +#if V8_STATIC_ROOTS_BOOL + return QuickIsNull() || QuickIsUndefined(); +#else using A = internal::Address; using I = internal::Internals; - A obj = *reinterpret_cast(this); + A obj = internal::ValueHelper::ValueAsAddress(this); if (!I::HasHeapObjectTag(obj)) return false; if (I::GetInstanceType(obj) != I::kOddballType) return false; int kind = I::GetOddballKind(obj); return kind == I::kNullOddballKind || kind == I::kUndefinedOddballKind; +#endif // V8_STATIC_ROOTS_BOOL } bool Value::IsString() const { @@ -521,9 +538,14 @@ bool Value::IsString() const { bool Value::QuickIsString() const { using A = internal::Address; using I = internal::Internals; - A obj = *reinterpret_cast(this); + A obj = internal::ValueHelper::ValueAsAddress(this); if (!I::HasHeapObjectTag(obj)) return false; +#if V8_STATIC_ROOTS_BOOL && !V8_MAP_PACKING + return I::CheckInstanceMapRange(obj, I::StaticReadOnlyRoot::kFirstStringMap, + I::StaticReadOnlyRoot::kLastStringMap); +#else return (I::GetInstanceType(obj) < I::kFirstNonstringType); +#endif // V8_STATIC_ROOTS_BOOL } } // namespace v8 diff --git a/deps/v8/include/v8-version.h b/deps/v8/include/v8-version.h index a9d6f92aff4599..f2146fa1ea3326 100644 --- a/deps/v8/include/v8-version.h +++ b/deps/v8/include/v8-version.h @@ -8,10 +8,10 @@ // These macros define the version number for the current version. // NOTE these macros are used by some of the tool scripts and the build // system so their names cannot be changed without changing the scripts. -#define V8_MAJOR_VERSION 10 -#define V8_MINOR_VERSION 9 -#define V8_BUILD_NUMBER 194 -#define V8_PATCH_LEVEL 9 +#define V8_MAJOR_VERSION 11 +#define V8_MINOR_VERSION 3 +#define V8_BUILD_NUMBER 244 +#define V8_PATCH_LEVEL 4 // Use 1 for candidates and 0 otherwise. // (Boolean macro values are not supported by all preprocessors.) diff --git a/deps/v8/include/v8-wasm.h b/deps/v8/include/v8-wasm.h index 05acd2e86deff8..71514615466eb3 100644 --- a/deps/v8/include/v8-wasm.h +++ b/deps/v8/include/v8-wasm.h @@ -144,7 +144,7 @@ class V8_EXPORT WasmStreaming final { /** * {Finish} should be called after all received bytes where passed to * {OnBytesReceived} to tell V8 that there will be no more bytes. {Finish} - * does not have to be called after {Abort} has been called already. + * must not be called after {Abort} has been called already. * If {can_use_compiled_module} is true and {SetCompiledModuleBytes} was * previously called, the compiled module bytes can be used. * If {can_use_compiled_module} is false, the compiled module bytes previously @@ -156,6 +156,7 @@ class V8_EXPORT WasmStreaming final { * Abort streaming compilation. If {exception} has a value, then the promise * associated with streaming compilation is rejected with that value. If * {exception} does not have value, the promise does not get rejected. + * {Abort} must not be called repeatedly, or after {Finish}. */ void Abort(MaybeLocal exception); diff --git a/deps/v8/include/v8config.h b/deps/v8/include/v8config.h index 2ac27b36b47ee3..bee208ffa95a78 100644 --- a/deps/v8/include/v8config.h +++ b/deps/v8/include/v8config.h @@ -173,6 +173,7 @@ path. Add it with -I to the command line // V8_TARGET_OS_LINUX // V8_TARGET_OS_MACOS // V8_TARGET_OS_WIN +// V8_TARGET_OS_CHROMEOS // // If not set explicitly, these fall back to corresponding V8_OS_ values. @@ -184,7 +185,8 @@ path. Add it with -I to the command line && !defined(V8_TARGET_OS_IOS) \ && !defined(V8_TARGET_OS_LINUX) \ && !defined(V8_TARGET_OS_MACOS) \ - && !defined(V8_TARGET_OS_WIN) + && !defined(V8_TARGET_OS_WIN) \ + && !defined(V8_TARGET_OS_CHROMEOS) # error No known target OS defined. # endif @@ -195,7 +197,8 @@ path. Add it with -I to the command line || defined(V8_TARGET_OS_IOS) \ || defined(V8_TARGET_OS_LINUX) \ || defined(V8_TARGET_OS_MACOS) \ - || defined(V8_TARGET_OS_WIN) + || defined(V8_TARGET_OS_WIN) \ + || defined(V8_TARGET_OS_CHROMEOS) # error A target OS is defined but V8_HAVE_TARGET_OS is unset. # endif @@ -308,6 +311,9 @@ path. Add it with -I to the command line // V8_HAS_BUILTIN_EXPECT - __builtin_expect() supported // V8_HAS_BUILTIN_FRAME_ADDRESS - __builtin_frame_address() supported // V8_HAS_BUILTIN_POPCOUNT - __builtin_popcount() supported +// V8_HAS_BUILTIN_ADD_OVERFLOW - __builtin_add_overflow() supported +// V8_HAS_BUILTIN_SUB_OVERFLOW - __builtin_sub_overflow() supported +// V8_HAS_BUILTIN_MUL_OVERFLOW - __builtin_mul_overflow() supported // V8_HAS_BUILTIN_SADD_OVERFLOW - __builtin_sadd_overflow() supported // V8_HAS_BUILTIN_SSUB_OVERFLOW - __builtin_ssub_overflow() supported // V8_HAS_BUILTIN_UADD_OVERFLOW - __builtin_uadd_overflow() supported @@ -339,9 +345,25 @@ path. Add it with -I to the command line # define V8_HAS_ATTRIBUTE_ALWAYS_INLINE (__has_attribute(always_inline)) # define V8_HAS_ATTRIBUTE_CONSTINIT \ (__has_attribute(require_constant_initialization)) +# define V8_HAS_ATTRIBUTE_CONST (__has_attribute(const)) # define V8_HAS_ATTRIBUTE_NONNULL (__has_attribute(nonnull)) # define V8_HAS_ATTRIBUTE_NOINLINE (__has_attribute(noinline)) # define V8_HAS_ATTRIBUTE_UNUSED (__has_attribute(unused)) +// Support for the "preserve_most" attribute is limited: +// - 32-bit platforms do not implement it, +// - component builds fail because _dl_runtime_resolve clobbers registers, +// - we see crashes on arm64 on Windows (https://crbug.com/1409934), which can +// hopefully be fixed in the future. +// Additionally, the initial implementation in clang <= 16 overwrote the return +// register(s) in the epilogue of a preserve_most function, so we only use +// preserve_most in clang >= 17 (see https://reviews.llvm.org/D143425). +#if (defined(_M_X64) || defined(__x86_64__) /* x64 (everywhere) */ \ + || ((defined(__AARCH64EL__) || defined(_M_ARM64)) /* arm64, but ... */ \ + && !defined(_WIN32))) /* not on windows */ \ + && !defined(COMPONENT_BUILD) /* no component build */\ + && __clang_major__ >= 17 /* clang >= 17 */ +# define V8_HAS_ATTRIBUTE_PRESERVE_MOST (__has_attribute(preserve_most)) +#endif # define V8_HAS_ATTRIBUTE_VISIBILITY (__has_attribute(visibility)) # define V8_HAS_ATTRIBUTE_WARN_UNUSED_RESULT \ (__has_attribute(warn_unused_result)) @@ -360,6 +382,9 @@ path. Add it with -I to the command line # define V8_HAS_BUILTIN_EXPECT (__has_builtin(__builtin_expect)) # define V8_HAS_BUILTIN_FRAME_ADDRESS (__has_builtin(__builtin_frame_address)) # define V8_HAS_BUILTIN_POPCOUNT (__has_builtin(__builtin_popcount)) +# define V8_HAS_BUILTIN_ADD_OVERFLOW (__has_builtin(__builtin_add_overflow)) +# define V8_HAS_BUILTIN_SUB_OVERFLOW (__has_builtin(__builtin_sub_overflow)) +# define V8_HAS_BUILTIN_MUL_OVERFLOW (__has_builtin(__builtin_mul_overflow)) # define V8_HAS_BUILTIN_SADD_OVERFLOW (__has_builtin(__builtin_sadd_overflow)) # define V8_HAS_BUILTIN_SSUB_OVERFLOW (__has_builtin(__builtin_ssub_overflow)) # define V8_HAS_BUILTIN_UADD_OVERFLOW (__has_builtin(__builtin_uadd_overflow)) @@ -455,6 +480,16 @@ path. Add it with -I to the command line #endif +// A macro to mark functions whose values don't change (e.g. across calls) +// and thereby compiler is free to hoist and fold multiple calls together. +// Use like: +// V8_CONST int foo() { ... } +#if V8_HAS_ATTRIBUTE_CONST +# define V8_CONST __attribute__((const)) +#else +# define V8_CONST +#endif + // A macro to mark a declaration as requiring constant initialization. // Use like: // int* foo V8_CONSTINIT; @@ -487,6 +522,21 @@ path. Add it with -I to the command line #endif +// A macro used to change the calling conventions to preserve all registers (no +// caller-saved registers). Use this for cold functions called from hot +// functions. +// Note: The attribute is considered experimental, so apply with care. Also, +// "preserve_most" is currently not handling the return value correctly, so only +// use it for functions returning void (see https://reviews.llvm.org/D141020). +// Use like: +// V8_NOINLINE V8_PRESERVE_MOST void UnlikelyMethod(); +#if V8_HAS_ATTRIBUTE_PRESERVE_MOST +# define V8_PRESERVE_MOST __attribute__((preserve_most)) +#else +# define V8_PRESERVE_MOST /* NOT SUPPORTED */ +#endif + + // A macro (V8_DEPRECATED) to mark classes or functions as deprecated. #if defined(V8_DEPRECATION_WARNINGS) # define V8_DEPRECATED(message) [[deprecated(message)]] @@ -884,4 +934,10 @@ V8 shared library set USING_V8_SHARED. #undef V8_HAS_CPP_ATTRIBUTE +#if !defined(V8_STATIC_ROOTS) +#define V8_STATIC_ROOTS_BOOL false +#else +#define V8_STATIC_ROOTS_BOOL true +#endif + #endif // V8CONFIG_H_ diff --git a/deps/v8/infra/mb/gn_isolate_map.pyl b/deps/v8/infra/mb/gn_isolate_map.pyl index 5732d862189c1a..40df0f013f7d49 100644 --- a/deps/v8/infra/mb/gn_isolate_map.pyl +++ b/deps/v8/infra/mb/gn_isolate_map.pyl @@ -31,6 +31,10 @@ "label": "//test:v8_d8_default", "type": "script", }, + "d8_pgo": { + "label": "//test:d8_pgo", + "type": "script", + }, "generate-bytecode-expectations": { "label": "//test/unittests:generate-bytecode-expectations", "type": "script", @@ -72,7 +76,7 @@ "type": "script", }, "unittests": { - "label": "//test/unittests:unittests", + "label": "//test/unittests:v8_unittests", "type": "script", }, "fuchsia-unittests": { diff --git a/deps/v8/infra/mb/mb_config.pyl b/deps/v8/infra/mb/mb_config.pyl index b5d6231600488a..741ae615cbd2cb 100644 --- a/deps/v8/infra/mb/mb_config.pyl +++ b/deps/v8/infra/mb/mb_config.pyl @@ -52,6 +52,10 @@ 'linux-v8-dr': 'release_x64', }, 'client.v8': { + # PGO + 'V8 Linux PGO instrumentation - builder' : 'builtins_profiling_x86', + 'V8 Linux64 PGO instrumentation - builder' : 'builtins_profiling_x64', + # Linux. 'V8 Linux - builder': 'release_x86_gcmole', 'V8 Linux - debug builder': 'debug_x86', @@ -59,14 +63,13 @@ 'V8 Linux - noi18n - debug builder': 'debug_x86_no_i18n', 'V8 Linux - verify csa - builder': 'release_x86_verify_csa', # Linux64. - 'V8 Linux64 - builder': 'release_x64', + 'V8 Linux64 - builder': 'release_x64_gcmole', 'V8 Linux64 - builder (goma cache silo)': 'release_x64', 'V8 Linux64 - builder (reclient)': 'release_x64_reclient', 'V8 Linux64 - builder (reclient compare)': 'release_x64_reclient', 'V8 Linux64 - debug builder': 'debug_x64', 'V8 Linux64 - external code space - debug - builder': 'debug_x64_external_code_space', 'V8 Linux64 - custom snapshot - debug builder': 'debug_x64_custom', - 'V8 Linux64 - heap sandbox - debug - builder': 'debug_x64_heap_sandbox', 'V8 Linux64 - internal snapshot - builder': 'release_x64_internal', 'V8 Linux64 - debug - header includes - builder': 'debug_x64_header_includes', 'V8 Linux64 - no sandbox - debug builder': 'debug_x64_no_sandbox', @@ -80,6 +83,7 @@ 'V8 Win32 - builder (reclient)': 'release_x86_minimal_symbols_reclient', 'V8 Win32 - builder (reclient compare)': 'release_x86_minimal_symbols_reclient', 'V8 Win32 - debug builder': 'debug_x86_minimal_symbols', + 'V8 Win32 - msvc - debug builder': 'debug_x86_msvc', # TODO(machenbach): Remove after switching to x64 on infra side. 'V8 Win64 ASAN - builder': 'release_x64_asan_no_lsan', 'V8 Win64 - builder': 'release_x64_minimal_symbols', @@ -103,14 +107,16 @@ # Sanitizers. 'V8 Linux64 ASAN - builder': 'release_x64_asan', 'V8 Linux64 TSAN - builder': 'release_x64_tsan', + 'V8 Linux64 TSAN - debug builder': 'debug_x64_tsan_minimal_symbols', 'V8 Linux64 TSAN - no-concurrent-marking - builder': 'release_x64_tsan_no_cm', 'V8 Linux - arm64 - sim - CFI - builder': 'release_simulate_arm64_cfi', 'V8 Linux - arm64 - sim - MSAN - builder': 'release_simulate_arm64_msan', # FYI. 'V8 iOS - sim - builder': 'release_x64_ios_simulator', - 'V8 Linux64 - arm64 - sim - heap sandbox - debug - builder': 'debug_x64_heap_sandbox_arm64_sim', 'V8 Linux64 - arm64 - sim - no pointer compression - builder': 'release_simulate_arm64_no_pointer_compression', + 'V8 Linux64 - coverage': 'release_x64_coverage', + 'V8 Linux64 - coverage - debug': 'debug_x64_coverage', 'V8 Linux64 - cppgc-non-default - debug - builder': 'debug_x64_non_default_cppgc', 'V8 Linux64 - debug - perfetto - builder': 'debug_x64_perfetto', 'V8 Linux64 - disable runtime call stats - builder': 'release_x64_disable_runtime_call_stats', @@ -125,9 +131,9 @@ 'V8 Linux64 - cfi - builder': 'release_x64_cfi', 'V8 Linux64 UBSan - builder': 'release_x64_ubsan', 'V8 Linux - vtunejit': 'debug_x86_vtunejit', - 'V8 Linux64 - gcov coverage': 'release_x64_gcc_coverage', 'V8 Linux64 - Fuzzilli - builder': 'release_x64_fuzzilli', 'V8 Linux64 - predictable - builder': 'release_x64_predictable', + 'V8 Linux64 - verify deterministic': 'release_x64_verify_deterministic', 'V8 Linux - full debug builder': 'full_debug_x86', 'V8 Mac64 - full debug builder': 'full_debug_x64', 'V8 Random Deopt Fuzzer - debug': 'debug_x64', @@ -168,22 +174,28 @@ 'V8 Clusterfuzz Linux64 UBSan - release builder': 'release_x64_ubsan_recover', 'V8 Clusterfuzz Linux64 ASAN sandbox testing - release builder': - 'release_x64_asan_sandbox_testing', + 'release_x64_asan_symbolized_expose_memory_corruption', }, 'client.v8.perf' : { 'V8 Arm - builder - perf': 'official_arm', + 'V8 Arm - builder - pgo - perf': 'official_arm_pgo', 'V8 Android Arm - builder - perf': 'official_android_arm', + 'V8 Android Arm - builder - pgo - perf': 'official_android_arm_pgo', 'V8 Android Arm64 - builder - perf': 'official_android_arm64', + 'V8 Android Arm64 - builder - pgo - perf': 'official_android_arm64_pgo', 'V8 Linux - builder - perf': 'official_x86', + 'V8 Linux - builder - pgo - perf': 'official_x86_pgo', 'V8 Linux64 - builder - perf': 'official_x64', + 'V8 Linux64 - builder - pgo - perf': 'official_x64_pgo', 'V8 Mac Arm64 - builder - perf': 'official_mac_arm64', + 'V8 Mac Arm64 - builder - pgo - perf': 'official_mac_arm64_pgo', }, 'client.v8.ports': { # Arm. 'V8 Arm - builder': 'release_arm', 'V8 Arm - debug builder': 'debug_arm', 'V8 Android Arm - builder': 'release_android_arm', - 'V8 Linux - arm - sim - builder': 'release_simulate_arm', + 'V8 Linux - arm - sim - builder': 'release_simulate_arm_gcmole', 'V8 Linux - arm - sim - debug builder': 'debug_simulate_arm', 'V8 Linux - arm - sim - lite - builder': 'release_simulate_arm_lite', 'V8 Linux - arm - sim - lite - debug builder': 'debug_simulate_arm_lite', @@ -191,7 +203,7 @@ 'V8 Android Arm64 - builder': 'release_android_arm64', 'V8 Android Arm64 - debug builder': 'debug_android_arm64', 'V8 Arm64 - builder': 'release_arm64_hard_float', - 'V8 Linux - arm64 - sim - builder': 'release_simulate_arm64', + 'V8 Linux - arm64 - sim - builder': 'release_simulate_arm64_gcmole', 'V8 Linux - arm64 - sim - debug builder': 'debug_simulate_arm64', 'V8 Linux - arm64 - sim - gc stress - builder': 'debug_simulate_arm64', # Mips. @@ -209,6 +221,7 @@ 'v8_android_arm_compile_rel': 'release_android_arm', 'v8_android_arm64_compile_dbg': 'debug_android_arm64', 'v8_android_arm64_n5x_compile_rel': 'release_android_arm64', + 'v8_android_arm64_d8_compile_rel': 'release_android_arm64', 'v8_fuchsia_compile_rel': 'release_x64_fuchsia_trybot', 'v8_ios_simulator': 'release_x64_ios_simulator', 'v8_linux_compile_rel': 'release_x86_gcmole_trybot', @@ -225,6 +238,8 @@ 'release_simulate_arm64_no_pointer_compression', 'v8_linux64_cppgc_non_default_compile_dbg': 'debug_x64_non_default_cppgc', 'v8_linux64_compile_dbg': 'debug_x64_trybot', + 'v8_linux64_coverage_dbg': 'debug_x64_coverage', + 'v8_linux64_coverage_rel': 'release_x64_coverage', 'v8_linux64_no_sandbox_compile_dbg': 'debug_x64_no_sandbox', 'v8_linux64_dict_tracking_compile_dbg': 'debug_x64_dict_tracking_trybot', 'v8_linux64_disable_runtime_call_stats_compile_rel': 'release_x64_disable_runtime_call_stats', @@ -235,16 +250,13 @@ 'v8_linux64_gcc_compile_dbg': 'debug_x64_gcc', 'v8_linux64_gcc_light_compile_dbg': 'debug_x64_gcc', 'v8_linux64_gcc_compile_rel': 'release_x64_gcc', - 'v8_linux64_gcov_coverage': 'release_x64_gcc_coverage', 'v8_linux64_header_includes_dbg': 'debug_x64_header_includes', - 'v8_linux64_heap_sandbox_compile_dbg': 'debug_x64_heap_sandbox', 'v8_linux64_minor_mc_compile_dbg': 'debug_x64_trybot', - 'v8_linux_arm64_sim_heap_sandbox_compile_dbg': 'debug_x64_heap_sandbox_arm64_sim', 'v8_linux64_fyi_compile_rel': 'release_x64_test_features_trybot', 'v8_linux64_nodcheck_compile_rel': 'release_x64', 'v8_linux64_perfetto_compile_dbg': 'debug_x64_perfetto', 'v8_linux64_no_pointer_compression_compile_rel': 'release_x64_no_pointer_compression', - 'v8_linux64_compile_rel': 'release_x64_test_features_trybot', + 'v8_linux64_compile_rel': 'release_x64_test_features_gcmole_trybot', 'v8_linux64_no_sandbox_compile_rel': 'release_x64_no_sandbox', 'v8_linux64_predictable_compile_rel': 'release_x64_predictable', 'v8_linux64_shared_compile_rel': 'release_x64_shared_verify_heap', @@ -259,15 +271,18 @@ 'v8_linux_riscv32_compile_rel': 'release_simulate_riscv32', 'v8_linux64_riscv64_compile_rel': 'release_simulate_riscv64', 'v8_linux64_tsan_compile_rel': 'release_x64_tsan_minimal_symbols', + 'v8_linux64_tsan_compile_dbg': 'debug_x64_tsan_minimal_symbols', 'v8_linux64_tsan_no_cm_compile_rel': 'release_x64_tsan_no_cm', 'v8_linux64_tsan_isolates_compile_rel': 'release_x64_tsan_minimal_symbols', 'v8_linux64_ubsan_compile_rel': 'release_x64_ubsan_minimal_symbols', + 'v8_linux64_verify_deterministic_rel': 'release_x64_verify_deterministic', 'v8_odroid_arm_compile_rel': 'release_arm', 'v8_linux_torque_compare': 'torque_compare', # TODO(machenbach): Remove after switching to x64 on infra side. 'v8_win_compile_dbg': 'debug_x86_trybot', 'v8_win_compile_rel': 'release_x86_trybot', + 'v8_win_msvc_light_compile_dbg': 'debug_x86_msvc', 'v8_win64_asan_compile_rel': 'release_x64_asan_no_lsan', 'v8_win64_msvc_light_compile_rel': 'release_x64_msvc', 'v8_win64_compile_dbg': 'debug_x64_minimal_symbols', @@ -284,15 +299,15 @@ 'v8_mac64_compile_rel': 'release_x64_trybot', 'v8_mac64_dbg': 'debug_x64', 'v8_mac64_compile_dbg': 'debug_x64', - 'v8_mac64_compile_full_compile_dbg': 'full_debug_x64', + 'v8_mac64_noopt_compile_dbg': 'full_debug_x64', 'v8_mac64_asan_compile_rel': 'release_x64_asan_no_lsan', - 'v8_linux_arm_compile_rel': 'release_simulate_arm_trybot', + 'v8_linux_arm_compile_rel': 'release_simulate_arm_gcmole_trybot', 'v8_linux_arm_lite_compile_dbg': 'debug_simulate_arm_lite', 'v8_linux_arm_lite_compile_rel': 'release_simulate_arm_lite_trybot', 'v8_linux_arm_compile_dbg': 'debug_simulate_arm', 'v8_linux_arm_armv8a_rel': 'release_simulate_arm_trybot', 'v8_linux_arm_armv8a_dbg': 'debug_simulate_arm', - 'v8_linux_arm64_compile_rel': 'release_simulate_arm64_trybot', + 'v8_linux_arm64_compile_rel': 'release_simulate_arm64_gcmole_trybot', 'v8_linux_arm64_cfi_compile_rel' : 'release_simulate_arm64_cfi', 'v8_linux_arm64_compile_dbg': 'debug_simulate_arm64', 'v8_linux_arm64_gc_stress_compile_dbg': 'debug_simulate_arm64', @@ -399,20 +414,26 @@ 'debug_bot', 'simulate_arm64', 'asan', 'lsan'], # Release configs for simulators. - 'release_simulate_arm': [ - 'release_bot', 'simulate_arm'], + 'release_simulate_arm_gcmole': [ + 'release_bot', 'simulate_arm', 'gcmole'], 'release_simulate_arm_lite': [ 'release_bot', 'simulate_arm', 'v8_enable_lite_mode'], - 'release_simulate_arm_trybot': [ - 'release_trybot', 'simulate_arm'], + 'release_simulate_arm_gcmole_trybot': [ + 'release_trybot', 'simulate_arm', 'gcmole'], 'release_simulate_arm_lite_trybot': [ 'release_trybot', 'simulate_arm', 'v8_enable_lite_mode'], + 'release_simulate_arm_trybot': [ + 'release_trybot', 'simulate_arm'], 'release_simulate_arm64': [ 'release_bot', 'simulate_arm64'], 'release_simulate_arm64_cfi': [ 'release_bot', 'simulate_arm64', 'v8_control_flow_integrity'], + 'release_simulate_arm64_gcmole': [ + 'release_bot', 'simulate_arm64', 'gcmole'], + 'release_simulate_arm64_gcmole_trybot': [ + 'release_trybot', 'simulate_arm64', 'gcmole'], 'release_simulate_arm64_no_pointer_compression': [ - 'release_bot', 'simulate_arm64_no_sandbox', 'dcheck_always_on', + 'release_bot', 'simulate_arm64', 'no_sandbox', 'dcheck_always_on', 'v8_enable_slow_dchecks', 'v8_disable_pointer_compression'], 'release_simulate_arm64_msan': [ 'release_bot', 'simulate_arm64', 'msan'], @@ -445,7 +466,7 @@ 'debug_arm64': [ 'debug_bot', 'arm64'], 'debug_arm64_no_pointer_compression': [ - 'debug_bot', 'arm64_no_sandbox', 'dcheck_always_on', 'v8_enable_slow_dchecks', 'v8_enable_javascript_promise_hooks', + 'debug_bot', 'arm64', 'no_sandbox', 'dcheck_always_on', 'v8_enable_slow_dchecks', 'v8_enable_javascript_promise_hooks', 'v8_disable_pointer_compression'], 'full_debug_arm64': [ 'debug_bot', 'arm64', 'v8_full_debug'], @@ -466,15 +487,29 @@ # Official configs for arm 'official_arm': [ - 'release_bot', 'arm', 'hard_float', 'official', 'disable_pgo'], + 'release_bot', 'arm', 'hard_float', 'official', 'disable_chrome_pgo'], + 'official_arm_pgo': [ + 'release_bot', 'arm', 'hard_float', 'official', 'disable_chrome_pgo', + 'builtins_optimization'], 'official_android_arm': [ 'release_bot', 'arm', 'android', 'minimal_symbols', - 'android_strip_outputs', 'official', 'disable_pgo'], + 'android_strip_outputs', 'official', 'disable_chrome_pgo'], + 'official_android_arm_pgo': [ + 'release_bot', 'arm', 'android', 'minimal_symbols', + 'android_strip_outputs', 'official', 'disable_chrome_pgo', + 'builtins_optimization'], 'official_android_arm64': [ 'release_bot', 'arm64', 'android', 'minimal_symbols', - 'android_strip_outputs', 'official', 'disable_pgo'], + 'android_strip_outputs', 'official', 'disable_chrome_pgo'], + 'official_android_arm64_pgo': [ + 'release_bot', 'arm64', 'android', 'minimal_symbols', + 'android_strip_outputs', 'official', 'disable_chrome_pgo', + 'builtins_optimization'], 'official_mac_arm64': [ - 'release_bot', 'arm64', 'official', 'disable_pgo'], + 'release_bot', 'arm64', 'official', 'disable_chrome_pgo'], + 'official_mac_arm64_pgo': [ + 'release_bot', 'arm64', 'official', 'disable_chrome_pgo', + 'builtins_optimization'], # Release configs for x64. 'release_x64': [ @@ -492,6 +527,9 @@ 'release_x64_asan_no_lsan_verify_heap_dchecks': [ 'release_bot', 'x64', 'asan', 'dcheck_always_on', 'v8_enable_slow_dchecks', 'v8_verify_heap'], + 'release_x64_asan_symbolized_expose_memory_corruption': [ + 'release_bot', 'x64', 'asan', 'symbolized', + 'v8_expose_memory_corruption_api'], 'release_x64_asan_symbolized_verify_heap': [ 'release_bot', 'x64', 'asan', 'lsan', 'symbolized', 'v8_verify_heap'], @@ -499,9 +537,13 @@ 'release_bot', 'x64', 'cfi'], 'release_x64_cfi_clusterfuzz': [ 'release_bot', 'x64', 'cfi_clusterfuzz'], + 'release_x64_coverage': [ + 'release_bot', 'x64', 'clang_coverage'], 'release_x64_fuzzilli': [ 'release_bot', 'x64', 'dcheck_always_on', 'v8_enable_slow_dchecks', 'v8_verify_heap', 'v8_verify_csa', 'fuzzilli'], + 'release_x64_gcmole': [ + 'release_bot', 'x64', 'gcmole'], 'release_x64_msvc': [ 'release_bot_no_goma', 'x64', 'minimal_symbols', 'msvc'], 'release_x64_correctness_fuzzer' : [ @@ -514,9 +556,6 @@ 'release_trybot', 'x64', 'fuchsia'], 'release_x64_gcc': [ 'release_bot_no_goma', 'x64', 'gcc', 'lld', 'no_custom_libcxx'], - 'release_x64_gcc_coverage': [ - 'release_bot_no_goma', 'x64', 'coverage', 'gcc', 'lld', - 'no_custom_libcxx', 'no_sysroot'], 'release_x64_ios_simulator': [ 'release_bot', 'x64', 'ios_simulator'], 'release_x64_internal': [ @@ -526,14 +565,16 @@ 'release_x64_minimal_symbols_reclient': [ 'release_bot_reclient', 'x64', 'minimal_symbols'], 'release_x64_no_pointer_compression': [ - 'release_bot', 'x64_no_sandbox', 'dcheck_always_on', 'v8_enable_slow_dchecks', 'v8_enable_javascript_promise_hooks', - 'v8_disable_pointer_compression'], + 'release_bot', 'x64', 'no_sandbox', 'dcheck_always_on', 'v8_enable_slow_dchecks', + 'v8_enable_javascript_promise_hooks', 'v8_disable_pointer_compression'], 'release_x64_reclient': [ 'release_bot_reclient', 'x64'], 'release_x64_no_sandbox': [ - 'release_bot', 'x64_no_sandbox'], + 'release_bot', 'x64', 'no_sandbox'], 'release_x64_trybot': [ 'release_trybot', 'x64'], + 'release_x64_test_features_gcmole_trybot': [ + 'release_trybot', 'x64', 'v8_enable_test_features', 'gcmole'], 'release_x64_test_features_trybot': [ 'release_trybot', 'x64', 'v8_enable_test_features'], 'release_x64_tsan': [ @@ -553,15 +594,17 @@ 'release_x64_verify_csa': [ 'release_bot', 'x64', 'dcheck_always_on', 'v8_enable_slow_dchecks', 'v8_verify_csa'], + 'release_x64_verify_deterministic': [ + 'release_bot', 'x64', 'v8_verify_deterministic'], 'release_x64_webassembly_disabled': [ 'release_bot', 'x64', 'webassembly_disabled'], - 'release_x64_asan_sandbox_testing': [ - 'release_bot', 'x64', 'asan', 'symbolized', 'v8_enable_sandbox_future', - 'v8_expose_memory_corruption_api'], # Official configs for x64. 'official_x64': [ - 'release_bot', 'x64', 'official', 'disable_pgo'], + 'release_bot', 'x64', 'official', 'disable_chrome_pgo'], + 'official_x64_pgo': [ + 'release_bot', 'x64', 'official', 'disable_chrome_pgo', + 'builtins_optimization'], # Debug configs for x64. 'debug_x64': [ @@ -573,6 +616,8 @@ 'x64', 'asan'], 'debug_x64_conservative_stack_scanning': [ 'debug_bot', 'x64', 'conservative_stack_scanning'], + 'debug_x64_coverage': [ + 'debug_bot', 'x64', 'clang_coverage'], 'debug_x64_custom': [ 'debug_bot', 'x64', 'v8_snapshot_custom'], 'debug_x64_external_code_space': [ @@ -583,10 +628,6 @@ 'debug_bot_no_goma', 'x64', 'gcc', 'lld', 'no_custom_libcxx'], 'debug_x64_header_includes': [ 'debug_bot', 'x64', 'v8_check_header_includes'], - 'debug_x64_heap_sandbox': [ - 'debug_bot', 'x64', 'v8_enable_sandbox_future', 'v8_expose_memory_corruption_api'], - 'debug_x64_heap_sandbox_arm64_sim': [ - 'debug_bot', 'simulate_arm64', 'v8_enable_sandbox_future', 'v8_expose_memory_corruption_api'], 'debug_x64_minimal_symbols': [ 'debug_bot', 'x64', 'minimal_symbols'], 'debug_x64_non_default_cppgc': [ @@ -594,7 +635,7 @@ 'debug_x64_perfetto': [ 'debug_bot', 'x64', 'perfetto'], 'debug_x64_no_sandbox': [ - 'debug_bot', 'x64_no_sandbox'], + 'debug_bot', 'x64', 'no_sandbox'], 'debug_x64_single_generation': [ 'debug_bot', 'x64', 'v8_enable_single_generation'], 'debug_x64_trybot': [ @@ -603,6 +644,9 @@ 'debug_trybot', 'x64', 'v8_enable_dict_property_const_tracking'], 'debug_x64_trybot_custom': [ 'debug_trybot', 'x64', 'v8_snapshot_custom'], + 'debug_x64_tsan_minimal_symbols': [ + 'debug_bot_no_slow_dchecks', 'minimal_symbols', 'x64', 'dcheck_always_on', + 'tsan', 'v8_disable_verify_heap', 'v8_fast_mksnapshot'], 'full_debug_x64': [ 'debug_bot', 'x64', 'v8_full_debug'], @@ -613,6 +657,8 @@ 'debug_bot', 'x86', 'asan', 'lsan'], 'debug_x86_minimal_symbols': [ 'debug_bot', 'x86', 'minimal_symbols'], + 'debug_x86_msvc': [ + 'debug_bot_no_goma', 'x86', 'minimal_symbols', 'msvc'], 'debug_x86_no_i18n': [ 'debug_bot', 'x86', 'v8_no_i18n'], 'debug_x86_trybot': [ @@ -650,11 +696,18 @@ # Official configs for x86. 'official_x86': [ - 'release_bot', 'x86', 'official', 'disable_pgo'], + 'release_bot', 'x86', 'official', 'disable_chrome_pgo'], + 'official_x86_pgo': [ + 'release_bot', 'x86', 'official', 'disable_chrome_pgo', + 'builtins_optimization'], # Torque compare test 'torque_compare': [ - 'release_bot', 'verify_torque'] + 'release_bot', 'verify_torque'], + + # PGO + 'builtins_profiling_x86': ['builtins_profiling', 'x86'], + 'builtins_profiling_x64': ['builtins_profiling', 'x64'], }, 'mixins': { @@ -671,11 +724,7 @@ }, 'arm64': { - 'gn_args': 'target_cpu="arm64" v8_enable_sandbox=true', - }, - - 'arm64_no_sandbox': { - 'gn_args': 'target_cpu="arm64" v8_enable_sandbox=false', + 'gn_args': 'target_cpu="arm64"', }, 'asan': { @@ -683,6 +732,15 @@ 'gn_args': 'is_asan=true', }, + 'builtins_profiling': { + 'mixins' : ['release_bot_reclient'], + 'gn_args': 'v8_enable_builtins_profiling=true', + }, + + 'builtins_optimization': { + 'gn_args': 'v8_enable_builtins_optimization=true', + }, + 'cfi': { 'mixins': ['v8_enable_test_features'], 'gn_args': ('is_cfi=true use_cfi_cast=true use_cfi_icall=true ' @@ -699,13 +757,12 @@ 'gn_args': 'is_clang=true', }, - 'conservative_stack_scanning': { - 'gn_args': 'v8_enable_conservative_stack_scanning=true ' - 'v8_enable_inner_pointer_resolution_mb=true', + 'clang_coverage': { + 'gn_args': 'use_clang_coverage=true', }, - 'coverage': { - 'gn_args': 'v8_code_coverage=true', + 'conservative_stack_scanning': { + 'gn_args': 'v8_enable_conservative_stack_scanning=true', }, 'dcheck_always_on': { @@ -716,6 +773,12 @@ 'gn_args': 'is_debug=true v8_enable_backtrace=true', }, + 'debug_bot_no_slow_dchecks': { + 'mixins': [ + 'debug', 'shared', 'goma', 'v8_disable_slow_dchecks', + 'v8_optimized_debug', 'v8_enable_google_benchmark'], + }, + 'debug_bot': { 'mixins': [ 'debug', 'shared', 'goma', 'v8_enable_slow_dchecks', @@ -741,7 +804,7 @@ 'v8_enable_atomic_object_field_writes=false ', }, - 'disable_pgo': { + 'disable_chrome_pgo': { 'gn_args': 'chrome_pgo_phase=0', }, @@ -793,12 +856,12 @@ 'msan': { 'mixins': ['v8_enable_test_features'], - 'gn_args': 'is_msan=true msan_track_origins=2', + 'gn_args': 'is_msan=true msan_track_origins=2 instrumented_libraries_release="focal"', }, 'msan_no_origins': { 'mixins': ['v8_enable_test_features'], - 'gn_args': 'is_msan=true msan_track_origins=0', + 'gn_args': 'is_msan=true msan_track_origins=0 instrumented_libraries_release="focal"', }, 'msvc': { @@ -813,8 +876,8 @@ 'gn_args': 'use_goma=false', }, - 'no_sysroot': { - 'gn_args': 'use_sysroot=false', + 'no_sandbox': { + 'gn_args': 'v8_enable_sandbox=false', }, 'non_default_cppgc': { @@ -862,11 +925,7 @@ }, 'simulate_arm64': { - 'gn_args': 'target_cpu="x64" v8_target_cpu="arm64" v8_enable_sandbox=true', - }, - - 'simulate_arm64_no_sandbox': { - 'gn_args': 'target_cpu="x64" v8_target_cpu="arm64" v8_enable_sandbox=false', + 'gn_args': 'target_cpu="x64" v8_target_cpu="arm64"', }, 'simulate_loong64': { @@ -938,8 +997,8 @@ 'gn_args': 'v8_enable_runtime_call_stats=false', }, - 'v8_enable_sandbox_future': { - 'gn_args': 'v8_enable_sandbox_future=true', + 'v8_disable_verify_heap': { + 'gn_args': 'v8_enable_verify_heap=false', }, 'v8_expose_memory_corruption_api': { @@ -954,6 +1013,10 @@ 'gn_args': 'v8_enable_slow_dchecks=true', }, + 'v8_disable_slow_dchecks': { + 'gn_args': 'v8_enable_slow_dchecks=false', + }, + 'v8_enable_javascript_promise_hooks': { 'gn_args': 'v8_enable_javascript_promise_hooks=true', }, @@ -989,6 +1052,10 @@ 'gn_args': 'v8_enable_vtunejit=true v8_enable_vtunetracemark=true', }, + 'v8_fast_mksnapshot': { + 'gn_args': 'v8_enable_fast_mksnapshot=true', + }, + 'v8_full_debug': { 'gn_args': 'v8_optimized_debug=false', }, @@ -1018,6 +1085,10 @@ 'gn_args': 'v8_enable_verify_csa=true', }, + 'v8_verify_deterministic': { + 'gn_args': 'v8_verify_deterministic_mksnapshot=true', + }, + 's390x': { 'gn_args': 'target_cpu="s390x" v8_target_cpu="s390x"', }, @@ -1031,11 +1102,7 @@ }, 'x64': { - 'gn_args': 'target_cpu="x64" v8_enable_sandbox=true', - }, - - 'x64_no_sandbox': { - 'gn_args': 'target_cpu="x64" v8_enable_sandbox=false', + 'gn_args': 'target_cpu="x64"', }, 'x86': { diff --git a/deps/v8/infra/testing/builders.pyl b/deps/v8/infra/testing/builders.pyl index 19d5e1845249ec..63d675bddd23dd 100644 --- a/deps/v8/infra/testing/builders.pyl +++ b/deps/v8/infra/testing/builders.pyl @@ -89,7 +89,8 @@ 'name': 'test262', 'suffix': 'noavx', 'variant': 'default', - 'test_args': ['--extra-flags', '--noenable-avx'] + 'test_args': ['--extra-flags', '--noenable-avx'], + 'shards': 2 }, { 'name': 'v8testing', @@ -128,8 +129,8 @@ {'name': 'benchmarks', 'variant': 'extra'}, {'name': 'mozilla'}, {'name': 'mozilla', 'variant': 'extra'}, - {'name': 'test262', 'shards': 2}, - {'name': 'test262', 'variant': 'extra', 'shards': 2}, + {'name': 'test262', 'shards': 4}, + {'name': 'test262', 'variant': 'extra', 'shards': 4}, {'name': 'v8testing', 'shards': 2}, {'name': 'v8testing', 'variant': 'extra'}, { @@ -149,7 +150,7 @@ }, 'tests': [ {'name': 'mozilla', 'variant': 'default'}, - {'name': 'test262', 'variant': 'default'}, + {'name': 'test262', 'variant': 'default', 'shards': 2}, {'name': 'v8testing', 'variant': 'default', 'shards': 2}, ], }, @@ -179,7 +180,7 @@ ], 'shards': 4, }, - {'name': 'gcmole'}, + {'name': 'gcmole_v3', 'variant': 'ia32', 'shards': 4}, ], }, 'v8_linux_optional_rel': { @@ -210,6 +211,7 @@ '--extra-flags', '--noenable-sse3 --noenable-ssse3 --noenable-sse4-1 --noenable-avx', ], + 'shards': 2, }, { 'name': 'v8testing', @@ -237,6 +239,7 @@ '--extra-flags', '--noenable-ssse3 --noenable-sse4-1 --noenable-avx', ], + 'shards': 2, }, { 'name': 'v8testing', @@ -258,6 +261,7 @@ 'suffix': 'nosse4', 'variant': 'default', 'test_args': ['--extra-flags', '--noenable-sse4-1 --noenable-avx'], + 'shards': 2, }, { 'name': 'v8testing', @@ -275,7 +279,8 @@ 'name': 'test262', 'suffix': 'noavx', 'variant': 'default', - 'test_args': ['--extra-flags', '--noenable-avx'] + 'test_args': ['--extra-flags', '--noenable-avx'], + 'shards': 2, }, { 'name': 'v8testing', @@ -325,6 +330,7 @@ {'name': 'test262', 'variant': 'default', 'shards': 2}, {'name': 'v8testing', 'shards': 10}, {'name': 'v8testing', 'variant': 'extra', 'shards': 10}, + {'name': 'gcmole_v3', 'variant': 'arm', 'shards': 4}, ], }, ############################################################################## @@ -348,10 +354,28 @@ {'name': 'benchmarks'}, {'name': 'mozilla'}, {'name': 'optimize_for_size'}, - {'name': 'test262', 'variant': 'default'}, + {'name': 'test262', 'variant': 'default', 'shards': 2}, {'name': 'v8testing', 'shards': 3}, ], }, + 'v8_linux64_coverage_dbg': { + 'swarming_dimensions' : { + 'os': 'Ubuntu-18.04', + }, + 'tests': [ + {'name': 'v8testing', 'variant': 'default'}, + {'name': 'v8testing', 'variant': 'future'}, + ], + }, + 'v8_linux64_coverage_rel': { + 'swarming_dimensions' : { + 'os': 'Ubuntu-18.04', + }, + 'tests': [ + {'name': 'v8testing', 'variant': 'default'}, + {'name': 'v8testing', 'variant': 'future'}, + ], + }, 'v8_linux64_cppgc_non_default_dbg': { 'swarming_dimensions' : { 'cpu': 'x86-64-avx2', @@ -361,6 +385,14 @@ {'name': 'v8testing', 'shards': 3}, ], }, + 'v8_linux64_css_dbg': { + 'swarming_dimensions' : { + 'os': 'Ubuntu-18.04', + }, + 'tests': [ + {'name': 'v8testing', 'shards': 5}, + ], + }, 'v8_linux64_dbg': { 'swarming_dimensions' : { 'cpu': 'x86-64-avx2', @@ -368,12 +400,12 @@ }, 'tests': [ {'name': 'benchmarks', 'shards': 2}, - {'name': 'benchmarks', 'variant': 'extra'}, + {'name': 'benchmarks', 'variant': 'extra', 'shards': 2}, {'name': 'mjsunit_sp_frame_access', 'shards': 2}, {'name': 'mozilla'}, {'name': 'mozilla', 'variant': 'extra'}, - {'name': 'test262', 'variant': 'default', 'shards': 2}, - {'name': 'test262', 'variant': 'extra', 'shards': 9}, + {'name': 'test262', 'variant': 'default', 'shards': 3}, + {'name': 'test262', 'variant': 'extra', 'shards': 12}, {'name': 'v8testing', 'shards': 5}, {'name': 'v8testing', 'variant': 'extra', 'shards': 5}, {'name': 'v8testing', 'variant': 'minor_mc'}, @@ -383,6 +415,7 @@ {'name': 'v8testing', 'variant': 'stress_concurrent_inlining'}, # Maglev -- move to extra once more architectures are supported. {'name': 'mjsunit', 'variant': 'maglev'}, + {'name': 'mjsunit', 'variant': 'stress_maglev'}, ], }, 'v8_linux64_dict_tracking_dbg': { @@ -430,14 +463,10 @@ {'name': 'webkit', 'variant': 'stress_sampling'}, # Stress snapshot. {'name': 'mjsunit', 'variant': 'stress_snapshot'}, - # Maglev. - {'name': 'mjsunit', 'variant': 'maglev'}, - # Stress maglev. - {'name': 'mjsunit', 'variant': 'stress_maglev'}, + # Stress maglev-future. + {'name': 'mjsunit', 'variant': 'maglev_future'}, # Experimental regexp engine. {'name': 'mjsunit', 'variant': 'experimental_regexp'}, - # Wasm write protect code space. - {'name': 'mjsunit', 'variant': 'wasm_write_protect_code'}, ], }, 'v8_linux64_gc_stress_custom_snapshot_dbg': { @@ -481,22 +510,6 @@ {'name': 'v8testing'}, ], }, - 'v8_linux64_gcov_coverage': { - 'swarming_dimensions' : { - 'os': 'Ubuntu-18.04', - }, - 'tests': [ - {'name': 'v8testing'}, - ], - }, - 'v8_linux64_heap_sandbox_dbg': { - 'swarming_dimensions' : { - 'os': 'Ubuntu-18.04', - }, - 'tests': [ - {'name': 'v8testing', 'shards': 4}, - ], - }, 'v8_linux64_minor_mc_dbg': { 'swarming_dimensions' : { 'cpu': 'x86-64-avx2', @@ -512,11 +525,11 @@ }, 'v8_linux64_msan_rel': { 'swarming_dimensions' : { - 'os': 'Ubuntu-18.04', + 'os': 'Ubuntu-20.04', }, 'tests': [ - {'name': 'test262', 'variant': 'default', 'shards': 2}, - {'name': 'v8testing', 'shards': 5}, + {'name': 'test262', 'variant': 'default', 'shards': 4}, + {'name': 'v8testing', 'shards': 4}, ], }, 'v8_linux64_nodcheck_rel': { @@ -533,9 +546,9 @@ {'name': 'mozilla', 'variant': 'assert_types'}, {'name': 'mozilla', 'variant': 'extra'}, {'name': 'perf_integration'}, - {'name': 'test262', 'shards': 2}, - {'name': 'test262', 'variant': 'assert_types', 'shards': 2}, - {'name': 'test262', 'variant': 'extra', 'shards': 2}, + {'name': 'test262', 'shards': 4}, + {'name': 'test262', 'variant': 'assert_types'}, + {'name': 'test262', 'variant': 'extra', 'shards': 4}, {'name': 'v8testing', 'shards': 2}, {'name': 'v8testing', 'variant': 'assert_types'}, {'name': 'v8testing', 'variant': 'extra'}, @@ -543,6 +556,7 @@ {'name': 'v8testing', 'variant': 'stress_instruction_scheduling'}, # Maglev -- move to extra once more architectures are supported. {'name': 'mjsunit', 'variant': 'maglev'}, + {'name': 'mjsunit', 'variant': 'stress_maglev'}, ], }, 'v8_linux64_perfetto_dbg': { @@ -589,7 +603,7 @@ {'name': 'mjsunit_sp_frame_access'}, {'name': 'optimize_for_size'}, {'name': 'test262', 'shards': 4}, - {'name': 'test262', 'variant': 'extra', 'shards': 3}, + {'name': 'test262', 'variant': 'extra', 'shards': 4}, {'name': 'v8initializers'}, {'name': 'v8testing', 'shards': 2}, {'name': 'v8testing', 'variant': 'extra', 'shards': 2}, @@ -599,6 +613,21 @@ {'name': 'v8testing', 'variant': 'stress_instruction_scheduling'}, # Maglev -- move to extra once more architectures are supported. {'name': 'mjsunit', 'variant': 'maglev'}, + {'name': 'mjsunit', 'variant': 'stress_maglev'}, + # GCMole. + {'name': 'gcmole_v3', 'variant': 'x64', 'shards': 4}, + { + 'name': 'gcmole_v2', + 'variant': 'x64', + 'suffix': 'test single host', + 'test_args': ['--test-run'], + }, + { + 'name': 'gcmole_v3', + 'variant': 'x64', + 'suffix': 'test multi host', + 'test_args': ['--test-run'], + }, ], }, 'v8_linux64_predictable_rel': { @@ -630,11 +659,23 @@ {'name': 'mozilla', 'shards': 2}, {'name': 'test262', 'variant': 'default', 'shards': 5}, {'name': 'v8testing', 'shards': 6}, - {'name': 'v8testing', 'variant': 'extra', 'shards': 5}, + {'name': 'v8testing', 'variant': 'extra', 'shards': 6}, {'name': 'v8testing', 'variant': 'slow_path', 'shards': 2}, {'name': 'v8testing', 'variant': 'stress_concurrent_allocation', 'shards': 2}, ], }, + 'v8_linux64_tsan_dbg': { + 'swarming_dimensions' : { + 'os': 'Ubuntu-18.04', + }, + 'tests': [ + {'name': 'benchmarks', 'shards': 2}, + {'name': 'mozilla', 'shards': 4}, + {'name': 'test262', 'variant': 'default', 'shards': 5}, + {'name': 'v8testing', 'shards': 12}, + {'name': 'v8testing', 'variant': 'extra', 'shards': 10}, + ], + }, 'v8_linux64_tsan_no_cm_rel': { 'swarming_dimensions' : { 'os': 'Ubuntu-18.04', @@ -699,14 +740,6 @@ {'name': 'd8testing', 'test_args': ['--gc-stress'], 'shards': 12}, ], }, - 'v8_linux_arm64_sim_heap_sandbox_dbg': { - 'swarming_dimensions' : { - 'os': 'Ubuntu-18.04', - }, - 'tests': [ - {'name': 'v8testing', 'shards': 14}, - ], - }, 'v8_linux_arm64_rel': { 'swarming_dimensions' : { 'os': 'Ubuntu-18.04', @@ -717,6 +750,7 @@ {'name': 'test262', 'variant': 'default', 'shards': 4}, {'name': 'v8testing', 'shards': 14}, {'name': 'v8testing', 'variant': 'extra', 'shards': 14}, + {'name': 'gcmole_v3', 'variant': 'arm64', 'shards': 4}, ], }, 'v8_linux_arm64_cfi_rel': { @@ -787,7 +821,7 @@ 'v8_win_dbg': { 'swarming_dimensions' : { 'cpu': 'x86-64', - 'os': 'Windows-7-SP1', + 'os': 'Windows-10-19045', }, 'tests': [ {'name': 'mozilla'}, @@ -797,7 +831,7 @@ 'v8_win_rel': { 'swarming_dimensions' : { 'cpu': 'x86-64', - 'os': 'Windows-7-SP1', + 'os': 'Windows-10-19045', }, 'tests': [ {'name': 'mozilla'}, @@ -809,7 +843,7 @@ # Win64 'v8_win64_asan_rel': { 'swarming_dimensions' : { - 'os': 'Windows-10-19042', + 'os': 'Windows-10-19045', }, 'tests': [ {'name': 'v8testing', 'shards': 5}, @@ -818,7 +852,7 @@ 'v8_win64_dbg': { 'swarming_dimensions' : { 'cpu': 'x86-64', - 'os': 'Windows-10-19042', + 'os': 'Windows-10-19045', }, 'tests': [ {'name': 'mozilla'}, @@ -830,7 +864,7 @@ 'v8_win64_msvc_rel': { 'swarming_dimensions' : { 'cpu': 'x86-64', - 'os': 'Windows-10-19042', + 'os': 'Windows-10-19045', }, 'tests': [ {'name': 'mozilla'}, @@ -841,7 +875,7 @@ 'v8_win64_rel': { 'swarming_dimensions' : { 'cpu': 'x86-64', - 'os': 'Windows-10-19042', + 'os': 'Windows-10-19045', }, 'tests': [ {'name': 'mozilla'}, @@ -855,7 +889,7 @@ 'v8_mac64_asan_rel': { 'swarming_dimensions' : { 'cpu': 'x86-64', - 'os': 'Mac-10.15', + 'os': 'Mac-12', }, 'tests': [ {'name': 'v8testing', 'shards': 8}, @@ -864,7 +898,7 @@ 'v8_mac64_dbg': { 'swarming_dimensions' : { 'cpu': 'x86-64', - 'os': 'Mac-10.15', + 'os': 'Mac-12', }, 'tests': [ {'name': 'mozilla'}, @@ -876,16 +910,25 @@ 'v8_mac64_gc_stress_dbg': { 'swarming_dimensions' : { 'cpu': 'x86-64', - 'os': 'Mac-10.15', + 'os': 'Mac-12', }, 'tests': [ {'name': 'd8testing', 'test_args': ['--gc-stress'], 'shards': 6}, ], }, + 'v8_mac64_noopt_dbg': { + 'swarming_dimensions' : { + 'cpu': 'x86-64', + 'os': 'Mac-12', + }, + 'tests': [ + {'name': 'v8testing', 'shards': 6}, + ], + }, 'v8_mac64_rel': { 'swarming_dimensions' : { 'cpu': 'x86-64', - 'os': 'Mac-10.15', + 'os': 'Mac-12', }, 'tests': [ {'name': 'mozilla'}, @@ -902,6 +945,9 @@ }, 'tests': [ {'name': 'v8testing'}, + # Maglev -- move to extra once more architectures are supported. + {'name': 'mjsunit', 'variant': 'maglev'}, + {'name': 'mjsunit', 'variant': 'stress_maglev'}, ], }, 'v8_mac_arm64_dbg': { @@ -912,6 +958,9 @@ }, 'tests': [ {'name': 'v8testing'}, + # Maglev -- move to extra once more architectures are supported. + {'name': 'mjsunit', 'variant': 'maglev'}, + {'name': 'mjsunit', 'variant': 'stress_maglev'}, ], }, 'v8_mac_arm64_full_dbg': { @@ -922,6 +971,9 @@ }, 'tests': [ {'name': 'v8testing'}, + # Maglev -- move to extra once more architectures are supported. + {'name': 'mjsunit', 'variant': 'maglev'}, + {'name': 'mjsunit', 'variant': 'stress_maglev'}, ], }, 'v8_mac_arm64_no_pointer_compression_dbg': { @@ -937,7 +989,7 @@ 'v8_mac_arm64_sim_rel': { 'swarming_dimensions' : { 'cpu': 'x86-64', - 'os': 'Mac-10.15', + 'os': 'Mac-12', }, 'tests': [ {'name': 'v8testing', 'shards': 8}, @@ -947,7 +999,7 @@ 'v8_mac_arm64_sim_dbg': { 'swarming_dimensions' : { 'cpu': 'x86-64', - 'os': 'Mac-10.15', + 'os': 'Mac-12', }, 'tests': [ {'name': 'v8testing', 'shards': 8}, @@ -957,7 +1009,7 @@ 'v8_mac_arm64_sim_nodcheck_rel': { 'swarming_dimensions' : { 'cpu': 'x86-64', - 'os': 'Mac-10.15', + 'os': 'Mac-12', }, 'tests': [ {'name': 'v8testing', 'shards': 8}, @@ -1042,7 +1094,8 @@ 'name': 'test262', 'suffix': 'noavx', 'variant': 'default', - 'test_args': ['--extra-flags', '--noenable-avx'] + 'test_args': ['--extra-flags', '--noenable-avx'], + 'shards': 2 }, { 'name': 'v8testing', @@ -1050,7 +1103,7 @@ 'test_args': ['--extra-flags', '--noenable-avx'], 'shards': 2 }, - {'name': 'gcmole'}, + {'name': 'gcmole_v3', 'variant': 'ia32', 'shards': 4}, ], }, 'V8 Linux - arm64 - sim - CFI': { @@ -1064,10 +1117,10 @@ }, 'V8 Linux - arm64 - sim - MSAN': { 'swarming_dimensions': { - 'os': 'Ubuntu-18.04', + 'os': 'Ubuntu-20.04', }, 'tests': [ - {'name': 'test262', 'variant': 'default', 'shards': 3}, + {'name': 'test262', 'variant': 'default', 'shards': 4}, {'name': 'v8testing', 'shards': 4}, ], }, @@ -1086,9 +1139,9 @@ {'name': 'mozilla', 'variant': 'code_serializer', 'shards': 1}, {'name': 'mozilla', 'variant': 'extra'}, {'name': 'optimize_for_size'}, - {'name': 'test262', 'shards': 6}, + {'name': 'test262', 'shards': 12}, {'name': 'test262', 'variant': 'code_serializer', 'shards': 2}, - {'name': 'test262', 'variant': 'extra', 'shards': 5}, + {'name': 'test262', 'variant': 'extra', 'shards': 10}, {'name': 'v8testing', 'shards': 3}, { 'name': 'v8testing', @@ -1096,7 +1149,7 @@ 'test_args': ['--isolates'], 'shards': 4 }, - {'name': 'v8testing', 'variant': 'extra', 'shards': 2}, + {'name': 'v8testing', 'variant': 'extra', 'shards': 4}, # Nosse3. { 'name': 'mozilla', @@ -1107,7 +1160,8 @@ 'name': 'test262', 'suffix': 'nosse3', 'variant': 'default', - 'test_args': ['--extra-flags', '--noenable-sse3 --noenable-ssse3 --noenable-sse4-1 --noenable-avx'] + 'test_args': ['--extra-flags', '--noenable-sse3 --noenable-ssse3 --noenable-sse4-1 --noenable-avx'], + 'shards': 2 }, { 'name': 'v8testing', @@ -1125,7 +1179,8 @@ 'name': 'test262', 'suffix': 'nossse3', 'variant': 'default', - 'test_args': ['--extra-flags', '--noenable-ssse3 --noenable-sse4-1 --noenable-avx'] + 'test_args': ['--extra-flags', '--noenable-ssse3 --noenable-sse4-1 --noenable-avx'], + 'shards': 2 }, { 'name': 'v8testing', @@ -1143,7 +1198,8 @@ 'name': 'test262', 'suffix': 'nosse4', 'variant': 'default', - 'test_args': ['--extra-flags', '--noenable-sse4-1 --noenable-avx'] + 'test_args': ['--extra-flags', '--noenable-sse4-1 --noenable-avx'], + 'shards': 2 }, { 'name': 'v8testing', @@ -1161,7 +1217,8 @@ 'name': 'test262', 'suffix': 'noavx', 'variant': 'default', - 'test_args': ['--extra-flags', '--noenable-avx'] + 'test_args': ['--extra-flags', '--noenable-avx'], + 'shards': 2 }, { 'name': 'v8testing', @@ -1203,7 +1260,7 @@ }, 'tests': [ {'name': 'mozilla', 'variant': 'default'}, - {'name': 'test262', 'variant': 'default'}, + {'name': 'test262', 'variant': 'default', 'shards': 2}, {'name': 'v8testing', 'variant': 'default'}, ], }, @@ -1224,7 +1281,7 @@ }, 'tests': [ {'name': 'mozilla'}, - {'name': 'test262', 'variant': 'default'}, + {'name': 'test262', 'variant': 'default', 'shards': 2}, {'name': 'v8testing'}, ], }, @@ -1236,6 +1293,14 @@ {'name': 'v8testing'}, ], }, + 'V8 Linux PGO instrumentation - builder' : { + 'swarming_dimensions': { + 'os': 'Ubuntu-18.04', + }, + 'tests': [ + {'name': 'pgo_instrumentation'} + ], + }, 'V8 Linux64': { 'swarming_dimensions': { 'cpu': 'x86-64-avx2', @@ -1253,7 +1318,7 @@ {'name': 'optimize_for_size'}, {'name': 'perf_integration'}, {'name': 'test262', 'shards': 2}, - {'name': 'test262', 'variant': 'assert_types'}, + {'name': 'test262', 'variant': 'assert_types', 'shards': 2}, {'name': 'test262', 'variant': 'extra', 'shards': 2}, {'name': 'v8initializers'}, {'name': 'v8testing'}, @@ -1264,6 +1329,7 @@ {'name': 'v8testing', 'variant': 'stress_instruction_scheduling'}, # Maglev -- move to extra once more architectures are supported. {'name': 'mjsunit', 'variant': 'maglev'}, + {'name': 'mjsunit', 'variant': 'stress_maglev'}, # Noavx. { 'name': 'mozilla', @@ -1274,13 +1340,28 @@ 'name': 'test262', 'suffix': 'noavx', 'variant': 'default', - 'test_args': ['--extra-flags', '--noenable-avx'] + 'test_args': ['--extra-flags', '--noenable-avx'], + 'shards': 2 }, { 'name': 'v8testing', 'suffix': 'noavx', 'test_args': ['--extra-flags', '--noenable-avx'] }, + # GCMole. + {'name': 'gcmole_v3', 'variant': 'x64', 'shards': 4}, + { + 'name': 'gcmole_v2', + 'variant': 'x64', + 'suffix': 'test single host', + 'test_args': ['--test-run'], + }, + { + 'name': 'gcmole_v3', + 'variant': 'x64', + 'suffix': 'test multi host', + 'test_args': ['--test-run'], + }, ], }, 'V8 Linux64 - cfi': { @@ -1291,10 +1372,28 @@ {'name': 'benchmarks'}, {'name': 'mozilla'}, {'name': 'optimize_for_size'}, - {'name': 'test262', 'variant': 'default'}, + {'name': 'test262', 'variant': 'default', 'shards': 2}, {'name': 'v8testing', 'shards': 2}, ], }, + 'V8 Linux64 - coverage': { + 'swarming_dimensions' : { + 'os': 'Ubuntu-18.04', + }, + 'tests': [ + {'name': 'v8testing', 'variant': 'default'}, + {'name': 'v8testing', 'variant': 'future'}, + ], + }, + 'V8 Linux64 - coverage - debug': { + 'swarming_dimensions' : { + 'os': 'Ubuntu-18.04', + }, + 'tests': [ + {'name': 'v8testing', 'variant': 'default'}, + {'name': 'v8testing', 'variant': 'future'}, + ], + }, 'V8 Linux64 - custom snapshot - debug': { 'swarming_dimensions' : { 'os': 'Ubuntu-18.04', @@ -1318,15 +1417,16 @@ {'name': 'test262', 'shards': 7}, {'name': 'test262', 'variant': 'extra', 'shards': 5}, {'name': 'v8testing', 'shards': 2}, - {'name': 'v8testing', 'variant': 'extra', 'shards': 2}, + {'name': 'v8testing', 'variant': 'extra', 'shards': 4}, {'name': 'v8testing', 'variant': 'minor_mc'}, {'name': 'v8testing', 'variant': 'no_lfa'}, {'name': 'v8testing', 'variant': 'slow_path'}, {'name': 'v8testing', 'variant': 'stress_instruction_scheduling'}, {'name': 'v8testing', 'variant': 'stress_concurrent_allocation'}, - {'name': 'v8testing', 'variant': 'stress_concurrent_inlining'}, + {'name': 'v8testing', 'variant': 'stress_concurrent_inlining', 'shards': 2}, # Maglev -- move to extra once more architectures are supported. {'name': 'mjsunit', 'variant': 'maglev'}, + {'name': 'mjsunit', 'variant': 'stress_maglev'}, # Noavx. { 'name': 'mozilla', @@ -1337,7 +1437,8 @@ 'name': 'test262', 'suffix': 'noavx', 'variant': 'default', - 'test_args': ['--extra-flags', '--noenable-avx'] + 'test_args': ['--extra-flags', '--noenable-avx'], + 'shards': 2 }, { 'name': 'v8testing', @@ -1380,14 +1481,10 @@ {'name': 'webkit', 'variant': 'stress_sampling'}, # Stress snapshot. {'name': 'mjsunit', 'variant': 'stress_snapshot'}, - # Maglev. - {'name': 'mjsunit', 'variant': 'maglev'}, - # Stress maglev. - {'name': 'mjsunit', 'variant': 'stress_maglev'}, + # Stress maglev-future. + {'name': 'mjsunit', 'variant': 'maglev_future'}, # Experimental regexp engine. {'name': 'mjsunit', 'variant': 'experimental_regexp'}, - # Wasm write protect code space. - {'name': 'mjsunit', 'variant': 'wasm_write_protect_code'}, ], }, 'V8 Linux64 - cppgc-non-default - debug': { @@ -1446,14 +1543,10 @@ {'name': 'webkit', 'variant': 'stress_sampling'}, # Stress snapshot. {'name': 'mjsunit', 'variant': 'stress_snapshot'}, - # Maglev. - {'name': 'mjsunit', 'variant': 'maglev'}, - # Stress maglev. - {'name': 'mjsunit', 'variant': 'stress_maglev'}, + # Stress maglev-future. + {'name': 'mjsunit', 'variant': 'maglev_future'}, # Experimental regexp engine. {'name': 'mjsunit', 'variant': 'experimental_regexp'}, - # Wasm write protect code space. - {'name': 'mjsunit', 'variant': 'wasm_write_protect_code'}, ], }, 'V8 Linux64 gcc': { @@ -1489,22 +1582,6 @@ }, ], }, - 'V8 Linux64 - gcov coverage': { - 'swarming_dimensions' : { - 'os': 'Ubuntu-18.04', - }, - 'tests': [ - {'name': 'v8testing'}, - ], - }, - 'V8 Linux64 - heap sandbox - debug': { - 'swarming_dimensions' : { - 'os': 'Ubuntu-18.04', - }, - 'tests': [ - {'name': 'v8testing', 'shards': 2}, - ], - }, 'V8 Linux64 - internal snapshot': { 'swarming_dimensions' : { 'os': 'Ubuntu-18.04', @@ -1545,7 +1622,7 @@ }, 'tests': [ {'name': 'mozilla'}, - {'name': 'test262', 'variant': 'default'}, + {'name': 'test262', 'variant': 'default', 'shards': 2}, {'name': 'v8testing'}, ], }, @@ -1568,6 +1645,14 @@ {'name': 'v8testing', 'variant': 'slow_path', 'shards': 1}, ], }, + 'V8 Linux64 css - debug': { + 'swarming_dimensions' : { + 'os': 'Ubuntu-18.04', + }, + 'tests': [ + {'name': 'v8testing', 'shards': 5}, + ], + }, 'V8 Linux64 GC Stress - custom snapshot': { 'swarming_dimensions' : { 'os': 'Ubuntu-18.04', @@ -1580,6 +1665,14 @@ }, ], }, + 'V8 Linux64 PGO instrumentation - builder' : { + 'swarming_dimensions' : { + 'os': 'Ubuntu-18.04', + }, + 'tests': [ + {'name': 'pgo_instrumentation'} + ], + }, 'V8 Linux64 TSAN': { 'swarming_dimensions' : { 'os': 'Ubuntu-18.04', @@ -1594,6 +1687,18 @@ {'name': 'v8testing', 'variant': 'stress_concurrent_allocation', 'shards': 2}, ], }, + 'V8 Linux64 TSAN - debug': { + 'swarming_dimensions' : { + 'os': 'Ubuntu-18.04', + }, + 'tests': [ + {'name': 'benchmarks', 'shards': 2}, + {'name': 'mozilla', 'shards': 4}, + {'name': 'test262', 'variant': 'default', 'shards': 5}, + {'name': 'v8testing', 'shards': 12}, + {'name': 'v8testing', 'variant': 'extra', 'shards': 10}, + ], + }, 'V8 Linux64 TSAN - stress-incremental-marking': { 'swarming_dimensions' : { 'os': 'Ubuntu-18.04', @@ -1667,7 +1772,7 @@ 'V8 Mac64': { 'swarming_dimensions': { 'cpu': 'x86-64', - 'os': 'Mac-10.15', + 'os': 'Mac-12', }, 'tests': [ {'name': 'mozilla'}, @@ -1679,7 +1784,7 @@ 'V8 Mac64 - debug': { 'swarming_dimensions': { 'cpu': 'x86-64', - 'os': 'Mac-10.15', + 'os': 'Mac-12', }, 'tests': [ {'name': 'mozilla'}, @@ -1691,7 +1796,7 @@ 'V8 Mac64 ASAN': { 'swarming_dimensions': { 'cpu': 'x86-64', - 'os': 'Mac-10.15', + 'os': 'Mac-12', }, 'tests': [ {'name': 'v8testing', 'shards': 10}, @@ -1700,7 +1805,7 @@ 'V8 Mac64 GC Stress': { 'swarming_dimensions': { 'cpu': 'x86-64', - 'os': 'Mac-10.15', + 'os': 'Mac-12', }, 'tests': [ {'name': 'd8testing', 'test_args': ['--gc-stress'], 'shards': 6}, @@ -1720,6 +1825,9 @@ 'tests': [ {'name': 'v8testing'}, {'name': 'v8testing', 'variant': 'extra'}, + # Maglev -- move to extra once more architectures are supported. + {'name': 'mjsunit', 'variant': 'maglev'}, + {'name': 'mjsunit', 'variant': 'stress_maglev'}, ], }, 'V8 Mac - arm64 - debug': { @@ -1736,6 +1844,9 @@ 'tests': [ {'name': 'v8testing', 'shards': 2}, {'name': 'v8testing', 'variant': 'extra', 'shards': 2}, + # Maglev -- move to extra once more architectures are supported. + {'name': 'mjsunit', 'variant': 'maglev'}, + {'name': 'mjsunit', 'variant': 'stress_maglev'}, ], }, 'V8 Mac - arm64 - no pointer compression debug': { @@ -1751,7 +1862,7 @@ 'V8 Mac - arm64 - sim - debug': { 'swarming_dimensions' : { 'cpu': 'x86-64', - 'os': 'Mac-10.15', + 'os': 'Mac-12', }, 'swarming_task_attrs': { 'expiration': 14400, @@ -1766,7 +1877,7 @@ 'V8 Mac - arm64 - sim - release': { 'swarming_dimensions' : { 'cpu': 'x86-64', - 'os': 'Mac-10.15', + 'os': 'Mac-12', }, 'swarming_task_attrs': { 'expiration': 14400, @@ -1781,39 +1892,39 @@ 'V8 Win32': { 'swarming_dimensions': { 'cpu': 'x86-64', - 'os': 'Windows-7-SP1', + 'os': 'Windows-10-19045', }, 'tests': [ {'name': 'mozilla'}, - {'name': 'test262', 'variant': 'default'}, + {'name': 'test262', 'variant': 'default', 'shards': 2}, {'name': 'v8testing'}, ], }, 'V8 Win32 - debug': { 'swarming_dimensions': { 'cpu': 'x86-64', - 'os': 'Windows-7-SP1', + 'os': 'Windows-10-19045', }, 'tests': [ {'name': 'mozilla'}, - {'name': 'test262', 'variant': 'default'}, + {'name': 'test262', 'variant': 'default', 'shards': 2}, {'name': 'v8testing', 'shards': 5}, ], }, 'V8 Win64': { 'swarming_dimensions': { - 'os': 'Windows-10-19042', + 'os': 'Windows-10-19045', }, 'tests': [ {'name': 'mozilla'}, - {'name': 'test262', 'variant': 'default'}, + {'name': 'test262', 'variant': 'default', 'shards': 2}, {'name': 'v8testing', 'shards': 2}, {'name': 'v8testing', 'variant': 'extra', 'shards': 2}, ], }, 'V8 Win64 - debug': { 'swarming_dimensions': { - 'os': 'Windows-10-19042', + 'os': 'Windows-10-19045', }, 'tests': [ {'name': 'mozilla'}, @@ -1824,17 +1935,17 @@ }, 'V8 Win64 - msvc': { 'swarming_dimensions': { - 'os': 'Windows-10-19042', + 'os': 'Windows-10-19045', }, 'tests': [ {'name': 'mozilla'}, - {'name': 'test262', 'variant': 'default'}, + {'name': 'test262', 'variant': 'default', 'shards': 2}, {'name': 'v8testing', 'shards': 2}, ], }, 'V8 Win64 ASAN': { 'swarming_dimensions': { - 'os': 'Windows-10-19042', + 'os': 'Windows-10-19045', }, 'tests': [ {'name': 'v8testing', 'shards': 5}, @@ -1951,7 +2062,8 @@ 'name': 'test262', 'suffix': 'armv8-a', 'variant': 'default', - 'test_args': ['--extra-flags', '--enable-armv8'] + 'test_args': ['--extra-flags', '--enable-armv8'], + 'shards': 2 }, { 'name': 'v8testing', @@ -1970,6 +2082,7 @@ 'suffix': 'novfp3', 'variant': 'default', 'test_args': ['--novfp3'], + 'shards': 2 }, { 'name': 'v8testing', @@ -1977,6 +2090,8 @@ 'test_args': ['--novfp3'], 'shards': 6 }, + # GCMole. + {'name': 'gcmole_v3', 'variant': 'arm', 'shards': 4}, ], }, 'V8 Linux - arm - sim - debug': { @@ -2055,9 +2170,10 @@ 'tests': [ {'name': 'mjsunit_sp_frame_access'}, {'name': 'mozilla'}, - {'name': 'test262', 'variant': 'default'}, + {'name': 'test262', 'variant': 'default', 'shards': 2}, {'name': 'v8testing', 'shards': 3}, {'name': 'v8testing', 'variant': 'extra', 'shards': 2}, + {'name': 'gcmole_v3', 'variant': 'arm64', 'shards': 4}, ], }, 'V8 Linux - arm64 - sim - debug': { @@ -2093,19 +2209,6 @@ }, ], }, - 'V8 Linux64 - arm64 - sim - heap sandbox - debug': { - 'swarming_dimensions' : { - 'os': 'Ubuntu-18.04', - }, - 'swarming_task_attrs': { - 'expiration': 14400, - 'hard_timeout': 7200, - 'priority': 35, - }, - 'tests': [ - {'name': 'v8testing', 'shards': 14}, - ], - }, 'V8 Linux - loong64 - sim': { 'swarming_dimensions': { 'os': 'Ubuntu-18.04', @@ -2129,7 +2232,7 @@ 'priority': 35, }, 'tests': [ - {'name': 'test262', 'variant': 'default'}, + {'name': 'test262', 'variant': 'default', 'shards': 2}, {'name': 'v8testing', 'shards': 4}, ], }, diff --git a/deps/v8/src/DEPS b/deps/v8/src/DEPS index 8912d7fb25186c..ebe2dd0dc5442c 100644 --- a/deps/v8/src/DEPS +++ b/deps/v8/src/DEPS @@ -10,19 +10,20 @@ include_rules = [ "-src/bigint", "+src/bigint/bigint.h", "-src/compiler", - "+src/compiler/pipeline.h", "+src/compiler/code-assembler.h", + "+src/compiler/turbofan.h", "+src/compiler/wasm-compiler-definitions.h", "+src/compiler/wasm-compiler.h", "-src/heap", "+src/heap/basic-memory-chunk.h", "+src/heap/code-range.h", "+src/heap/combined-heap.h", - "+src/heap/embedder-tracing.h", "+src/heap/factory.h", "+src/heap/factory-inl.h", # TODO(v8:10496): Don't expose so much (through transitive includes) outside # of heap/. + "+src/heap/gc-tracer.h", + "+src/heap/gc-tracer-inl.h", "+src/heap/heap.h", "+src/heap/heap-verifier.h", "+src/heap/heap-inl.h", @@ -76,6 +77,7 @@ include_rules = [ "+starboard", # Using cppgc inside v8 is not (yet) allowed. "-include/cppgc", + "+include/cppgc/common.h", "+include/cppgc/platform.h", "+include/cppgc/source-location.h", ] @@ -84,7 +86,8 @@ specific_include_rules = { "d8\.cc": [ "+include/libplatform/libplatform.h", "+include/libplatform/v8-tracing.h", - "+perfetto/tracing.h" + "+perfetto/tracing/track_event.h", + "+perfetto/tracing/track_event_legacy.h" ], "d8-platforms\.cc": [ "+include/libplatform/libplatform.h", diff --git a/deps/v8/src/api/api-arguments-inl.h b/deps/v8/src/api/api-arguments-inl.h index 470ab95e181e84..31daa9a39cae89 100644 --- a/deps/v8/src/api/api-arguments-inl.h +++ b/deps/v8/src/api/api-arguments-inl.h @@ -11,51 +11,51 @@ #include "src/execution/vm-state-inl.h" #include "src/logging/runtime-call-stats-scope.h" #include "src/objects/api-callbacks.h" +#include "src/objects/instance-type.h" #include "src/objects/slots-inl.h" +#include "v8-isolate.h" namespace v8 { namespace internal { -void Object::VerifyApiCallResultType() { #if DEBUG - if (IsSmi()) return; +bool Object::IsApiCallResultType() const { + if (IsSmi()) return true; DCHECK(IsHeapObject()); - if (!(IsString() || IsSymbol() || IsJSReceiver() || IsHeapNumber() || - IsBigInt() || IsUndefined() || IsTrue() || IsFalse() || IsNull())) { - FATAL("API call returned invalid object"); - } -#endif // DEBUG + return (IsString() || IsSymbol() || IsJSReceiver() || IsHeapNumber() || + IsBigInt() || IsUndefined() || IsTrue() || IsFalse() || IsNull()); } +#endif // DEBUG CustomArgumentsBase::CustomArgumentsBase(Isolate* isolate) : Relocatable(isolate) {} template CustomArguments::~CustomArguments() { - slot_at(kReturnValueOffset).store(Object(kHandleZapValue)); + slot_at(kReturnValueIndex).store(Object(kHandleZapValue)); } template template -Handle CustomArguments::GetReturnValue(Isolate* isolate) { +Handle CustomArguments::GetReturnValue(Isolate* isolate) const { // Check the ReturnValue. - FullObjectSlot slot = slot_at(kReturnValueOffset); + FullObjectSlot slot = slot_at(kReturnValueIndex); // Nothing was set, return empty handle as per previous behaviour. - if ((*slot).IsTheHole(isolate)) return Handle(); - Handle result = Handle::cast(Handle(slot.location())); - result->VerifyApiCallResultType(); - return result; + Object raw_object = *slot; + if (raw_object.IsTheHole(isolate)) return Handle(); + DCHECK(raw_object.IsApiCallResultType()); + return Handle::cast(Handle(slot.location())); } -inline JSObject PropertyCallbackArguments::holder() { +inline JSObject PropertyCallbackArguments::holder() const { return JSObject::cast(*slot_at(T::kHolderIndex)); } -inline Object PropertyCallbackArguments::receiver() { +inline Object PropertyCallbackArguments::receiver() const { return *slot_at(T::kThisIndex); } -inline JSReceiver FunctionCallbackArguments::holder() { +inline JSReceiver FunctionCallbackArguments::holder() const { return JSReceiver::cast(*slot_at(T::kHolderIndex)); } diff --git a/deps/v8/src/api/api-arguments.h b/deps/v8/src/api/api-arguments.h index 39958964fd4233..9caf5decb0b0ae 100644 --- a/deps/v8/src/api/api-arguments.h +++ b/deps/v8/src/api/api-arguments.h @@ -6,6 +6,7 @@ #define V8_API_API_ARGUMENTS_H_ #include "include/v8-template.h" +#include "src/builtins/builtins-utils.h" #include "src/execution/isolate.h" #include "src/objects/slots.h" #include "src/objects/visitors.h" @@ -24,7 +25,8 @@ class CustomArgumentsBase : public Relocatable { template class CustomArguments : public CustomArgumentsBase { public: - static const int kReturnValueOffset = T::kReturnValueIndex; + static constexpr int kReturnValueIndex = T::kReturnValueIndex; + static_assert(T::kSize == sizeof(T)); ~CustomArguments() override; @@ -38,19 +40,20 @@ class CustomArguments : public CustomArgumentsBase { : CustomArgumentsBase(isolate) {} template - Handle GetReturnValue(Isolate* isolate); + Handle GetReturnValue(Isolate* isolate) const; - inline Isolate* isolate() { + inline Isolate* isolate() const { return reinterpret_cast((*slot_at(T::kIsolateIndex)).ptr()); } - inline FullObjectSlot slot_at(int index) { + inline FullObjectSlot slot_at(int index) const { // This allows index == T::kArgsLength so "one past the end" slots // can be retrieved for iterating purposes. DCHECK_LE(static_cast(index), static_cast(T::kArgsLength)); return FullObjectSlot(values_ + index); } + Address values_[T::kArgsLength]; }; @@ -69,14 +72,14 @@ class PropertyCallbackArguments final public: using T = PropertyCallbackInfo; using Super = CustomArguments; - static const int kArgsLength = T::kArgsLength; - static const int kThisIndex = T::kThisIndex; - static const int kHolderIndex = T::kHolderIndex; - static const int kDataIndex = T::kDataIndex; - static const int kReturnValueDefaultValueIndex = + static constexpr int kArgsLength = T::kArgsLength; + static constexpr int kThisIndex = T::kThisIndex; + static constexpr int kHolderIndex = T::kHolderIndex; + static constexpr int kDataIndex = T::kDataIndex; + static constexpr int kReturnValueDefaultValueIndex = T::kReturnValueDefaultValueIndex; - static const int kIsolateIndex = T::kIsolateIndex; - static const int kShouldThrowOnErrorIndex = T::kShouldThrowOnErrorIndex; + static constexpr int kIsolateIndex = T::kIsolateIndex; + static constexpr int kShouldThrowOnErrorIndex = T::kShouldThrowOnErrorIndex; PropertyCallbackArguments(Isolate* isolate, Object data, Object self, JSObject holder, Maybe should_throw); @@ -161,13 +164,13 @@ class PropertyCallbackArguments final GenericNamedPropertyGetterCallback f, Handle name, Handle info, Handle receiver = Handle()); - inline JSObject holder(); - inline Object receiver(); + inline JSObject holder() const; + inline Object receiver() const; #ifdef DEBUG // This stores current value of Isolate::javascript_execution_counter(). // It's used for detecting whether JavaScript code was executed between - // PropertyCallbackArguments's constructior and destructor. + // PropertyCallbackArguments's constructor and destructor. uint32_t javascript_execution_counter_; #endif // DEBUG }; @@ -177,13 +180,21 @@ class FunctionCallbackArguments public: using T = FunctionCallbackInfo; using Super = CustomArguments; - static const int kArgsLength = T::kArgsLength; - static const int kHolderIndex = T::kHolderIndex; - static const int kDataIndex = T::kDataIndex; - static const int kReturnValueDefaultValueIndex = + static constexpr int kArgsLength = T::kArgsLength; + static constexpr int kArgsLengthWithReceiver = T::kArgsLengthWithReceiver; + + static constexpr int kHolderIndex = T::kHolderIndex; + static constexpr int kDataIndex = T::kDataIndex; + static constexpr int kReturnValueDefaultValueIndex = T::kReturnValueDefaultValueIndex; - static const int kIsolateIndex = T::kIsolateIndex; - static const int kNewTargetIndex = T::kNewTargetIndex; + static constexpr int kIsolateIndex = T::kIsolateIndex; + static constexpr int kNewTargetIndex = T::kNewTargetIndex; + + static_assert(T::kThisValuesIndex == BuiltinArguments::kReceiverArgsOffset); + // Make sure all FunctionCallbackInfo constants are in sync. + static_assert(T::kImplicitArgsOffset == offsetof(T, implicit_args_)); + static_assert(T::kValuesOffset == offsetof(T, values_)); + static_assert(T::kLengthOffset == offsetof(T, length_)); FunctionCallbackArguments(Isolate* isolate, Object data, Object holder, HeapObject new_target, Address* argv, int argc); @@ -199,12 +210,17 @@ class FunctionCallbackArguments inline Handle Call(CallHandlerInfo handler); private: - inline JSReceiver holder(); + inline JSReceiver holder() const; internal::Address* argv_; - int argc_; + int const argc_; }; +static_assert(BuiltinArguments::kNumExtraArgs == + BuiltinExitFrameConstants::kNumExtraArgsWithoutReceiver); +static_assert(BuiltinArguments::kNumExtraArgsWithReceiver == + BuiltinExitFrameConstants::kNumExtraArgsWithReceiver); + } // namespace internal } // namespace v8 diff --git a/deps/v8/src/api/api-inl.h b/deps/v8/src/api/api-inl.h index ac675a87fc82ba..73be24cbe0718e 100644 --- a/deps/v8/src/api/api-inl.h +++ b/deps/v8/src/api/api-inl.h @@ -7,8 +7,10 @@ #include "include/v8-fast-api-calls.h" #include "src/api/api.h" +#include "src/common/assert-scope.h" #include "src/execution/interrupts-scope.h" #include "src/execution/microtask-queue.h" +#include "src/flags/flags.h" #include "src/handles/handles-inl.h" #include "src/heap/heap-inl.h" #include "src/objects/foreign-inl.h" @@ -51,7 +53,10 @@ inline v8::internal::Handle FromCData( template inline Local Utils::Convert(v8::internal::Handle obj) { DCHECK(obj.is_null() || (obj->IsSmi() || !obj->IsTheHole())); - return Local(reinterpret_cast(obj.location())); +#ifdef V8_ENABLE_CONSERVATIVE_STACK_SCANNING + if (obj.is_null()) return Local(); +#endif + return Local(internal::ValueHelper::SlotAsValue(obj.location())); } // Implementations of ToLocal @@ -61,6 +66,8 @@ inline Local Utils::Convert(v8::internal::Handle obj) { return Convert(obj); \ } +TO_LOCAL_LIST(MAKE_TO_LOCAL) + #define MAKE_TO_LOCAL_TYPED_ARRAY(Type, typeName, TYPE, ctype) \ Local Utils::ToLocal##Type##Array( \ v8::internal::Handle obj) { \ @@ -68,65 +75,51 @@ inline Local Utils::Convert(v8::internal::Handle obj) { return Convert(obj); \ } -MAKE_TO_LOCAL(ToLocal, AccessorPair, debug::AccessorPair) -MAKE_TO_LOCAL(ToLocal, Context, Context) -MAKE_TO_LOCAL(ToLocal, Object, Value) -MAKE_TO_LOCAL(ToLocal, Module, Module) -MAKE_TO_LOCAL(ToLocal, Name, Name) -MAKE_TO_LOCAL(ToLocal, String, String) -MAKE_TO_LOCAL(ToLocal, Symbol, Symbol) -MAKE_TO_LOCAL(ToLocal, JSRegExp, RegExp) -MAKE_TO_LOCAL(ToLocal, JSReceiver, Object) -MAKE_TO_LOCAL(ToLocal, JSObject, Object) -MAKE_TO_LOCAL(ToLocal, JSFunction, Function) -MAKE_TO_LOCAL(ToLocal, JSArray, Array) -MAKE_TO_LOCAL(ToLocal, JSMap, Map) -MAKE_TO_LOCAL(ToLocal, JSSet, Set) -MAKE_TO_LOCAL(ToLocal, JSProxy, Proxy) -MAKE_TO_LOCAL(ToLocal, JSArrayBuffer, ArrayBuffer) -MAKE_TO_LOCAL(ToLocal, JSArrayBufferView, ArrayBufferView) -MAKE_TO_LOCAL(ToLocal, JSDataView, DataView) -MAKE_TO_LOCAL(ToLocal, JSTypedArray, TypedArray) -MAKE_TO_LOCAL(ToLocalShared, JSArrayBuffer, SharedArrayBuffer) - TYPED_ARRAYS(MAKE_TO_LOCAL_TYPED_ARRAY) -MAKE_TO_LOCAL(ToLocal, FunctionTemplateInfo, FunctionTemplate) -MAKE_TO_LOCAL(ToLocal, ObjectTemplateInfo, ObjectTemplate) -MAKE_TO_LOCAL(SignatureToLocal, FunctionTemplateInfo, Signature) -MAKE_TO_LOCAL(MessageToLocal, Object, Message) -MAKE_TO_LOCAL(PromiseToLocal, JSObject, Promise) -MAKE_TO_LOCAL(StackTraceToLocal, FixedArray, StackTrace) -MAKE_TO_LOCAL(StackFrameToLocal, StackFrameInfo, StackFrame) -MAKE_TO_LOCAL(NumberToLocal, Object, Number) -MAKE_TO_LOCAL(IntegerToLocal, Object, Integer) -MAKE_TO_LOCAL(Uint32ToLocal, Object, Uint32) -MAKE_TO_LOCAL(ToLocal, BigInt, BigInt) -MAKE_TO_LOCAL(ExternalToLocal, JSObject, External) -MAKE_TO_LOCAL(CallableToLocal, JSReceiver, Function) -MAKE_TO_LOCAL(ToLocalPrimitive, Object, Primitive) -MAKE_TO_LOCAL(FixedArrayToLocal, FixedArray, FixedArray) -MAKE_TO_LOCAL(PrimitiveArrayToLocal, FixedArray, PrimitiveArray) -MAKE_TO_LOCAL(ToLocal, ScriptOrModule, ScriptOrModule) - #undef MAKE_TO_LOCAL_TYPED_ARRAY #undef MAKE_TO_LOCAL +#undef TO_LOCAL_LIST // Implementations of OpenHandle -#define MAKE_OPEN_HANDLE(From, To) \ - v8::internal::Handle Utils::OpenHandle( \ - const v8::From* that, bool allow_empty_handle) { \ - DCHECK(allow_empty_handle || that != nullptr); \ - DCHECK(that == nullptr || \ - v8::internal::Object( \ - *reinterpret_cast(that)) \ - .Is##To()); \ - return v8::internal::Handle( \ - reinterpret_cast( \ - const_cast(that))); \ +#ifdef V8_ENABLE_CONSERVATIVE_STACK_SCANNING + +#define MAKE_OPEN_HANDLE(From, To) \ + v8::internal::Handle Utils::OpenHandle( \ + const v8::From* that, bool allow_empty_handle) { \ + DCHECK(allow_empty_handle || \ + that != v8::internal::ValueHelper::EmptyValue()); \ + DCHECK( \ + that == v8::internal::ValueHelper::EmptyValue() || \ + v8::internal::Object(v8::internal::ValueHelper::ValueAsAddress(that)) \ + .Is##To()); \ + if (that == v8::internal::ValueHelper::EmptyValue()) { \ + return v8::internal::Handle::null(); \ + } \ + return v8::internal::Handle( \ + v8::HandleScope::CreateHandleForCurrentIsolate( \ + reinterpret_cast(that))); \ } +#else + +#define MAKE_OPEN_HANDLE(From, To) \ + v8::internal::Handle Utils::OpenHandle( \ + const v8::From* that, bool allow_empty_handle) { \ + DCHECK(allow_empty_handle || \ + that != v8::internal::ValueHelper::EmptyValue()); \ + DCHECK( \ + that == v8::internal::ValueHelper::EmptyValue() || \ + v8::internal::Object(v8::internal::ValueHelper::ValueAsAddress(that)) \ + .Is##To()); \ + return v8::internal::Handle( \ + reinterpret_cast( \ + const_cast(that))); \ + } + +#endif + OPEN_HANDLE_LIST(MAKE_OPEN_HANDLE) #undef MAKE_OPEN_HANDLE @@ -150,12 +143,13 @@ class V8_NODISCARD CallDepthScope { isolate_->thread_local_top()->IncrementCallDepth(this); isolate_->set_next_v8_call_is_safe_for_termination(false); if (!context.IsEmpty()) { - i::Handle env = Utils::OpenHandle(*context); + i::DisallowGarbageCollection no_gc; + i::Context env = *Utils::OpenHandle(*context); i::HandleScopeImplementer* impl = isolate->handle_scope_implementer(); if (isolate->context().is_null() || - isolate->context().native_context() != env->native_context()) { + isolate->context().native_context() != env.native_context()) { impl->SaveContext(isolate->context()); - isolate->set_context(*env); + isolate->set_context(env); did_enter_context_ = true; } } @@ -207,7 +201,8 @@ class V8_NODISCARD CallDepthScope { bool did_perform_microtask_checkpoint = isolate_->thread_local_top()->CallDepthIsZero() && do_callback && microtask_queue && - microtask_queue->microtasks_policy() == MicrotasksPolicy::kAuto; + microtask_queue->microtasks_policy() == MicrotasksPolicy::kAuto && + !isolate_->is_execution_terminating(); return !did_perform_microtask_checkpoint || isolate_->heap()->weak_refs_keep_during_job().IsUndefined(isolate_); } diff --git a/deps/v8/src/api/api-macros.h b/deps/v8/src/api/api-macros.h index 149dd0555a69be..bcad7df2881231 100644 --- a/deps/v8/src/api/api-macros.h +++ b/deps/v8/src/api/api-macros.h @@ -41,7 +41,8 @@ #define ENTER_V8_BASIC(i_isolate) \ /* Embedders should never enter V8 after terminating it */ \ - DCHECK(!i_isolate->is_execution_terminating()); \ + DCHECK_IMPLIES(i::v8_flags.strict_termination_checks, \ + !i_isolate->is_execution_terminating()); \ i::VMState __state__((i_isolate)) #define ENTER_V8_HELPER_INTERNAL(i_isolate, context, class_name, \ @@ -91,29 +92,19 @@ bailout_value, HandleScopeClass, false); \ i::DisallowJavascriptExecutionDebugOnly __no_script__((i_isolate)) -#define DCHECK_NO_SCRIPT_NO_EXCEPTION_MAYBE_TEARDOWN(i_isolate) \ +// Lightweight version for APIs that don't require an active context. +#define DCHECK_NO_SCRIPT_NO_EXCEPTION(i_isolate) \ i::DisallowJavascriptExecutionDebugOnly __no_script__((i_isolate)); \ i::DisallowExceptions __no_exceptions__((i_isolate)) -// Lightweight version for APIs that don't require an active context. -#define DCHECK_NO_SCRIPT_NO_EXCEPTION(i_isolate) \ - /* Embedders should never enter V8 after terminating it */ \ - DCHECK(!i_isolate->is_execution_terminating()); \ - DCHECK_NO_SCRIPT_NO_EXCEPTION_MAYBE_TEARDOWN(i_isolate) - #define ENTER_V8_NO_SCRIPT_NO_EXCEPTION(i_isolate) \ i::VMState __state__((i_isolate)); \ DCHECK_NO_SCRIPT_NO_EXCEPTION(i_isolate) -// Used instead of ENTER_V8_NO_SCRIPT_NO_EXCEPTION where the V8 Api is entered -// during termination sequences. -#define ENTER_V8_MAYBE_TEARDOWN(i_isolate) \ - i::VMState __state__((i_isolate)); \ - DCHECK_NO_SCRIPT_NO_EXCEPTION_MAYBE_TEARDOWN(i_isolate) - -#define ENTER_V8_FOR_NEW_CONTEXT(i_isolate) \ - DCHECK(!(i_isolate)->is_execution_terminating()); \ - i::VMState __state__((i_isolate)); \ +#define ENTER_V8_FOR_NEW_CONTEXT(i_isolate) \ + DCHECK_IMPLIES(i::v8_flags.strict_termination_checks, \ + !(i_isolate)->is_execution_terminating()); \ + i::VMState __state__((i_isolate)); \ i::DisallowExceptions __no_exceptions__((i_isolate)) #else // DEBUG #define ENTER_V8_NO_SCRIPT(i_isolate, context, class_name, function_name, \ @@ -122,14 +113,10 @@ bailout_value, HandleScopeClass, false) #define DCHECK_NO_SCRIPT_NO_EXCEPTION(i_isolate) -#define DCHECK_NO_SCRIPT_NO_EXCEPTION_MAYBE_TEARDOWN(i_isolate) #define ENTER_V8_NO_SCRIPT_NO_EXCEPTION(i_isolate) \ i::VMState __state__((i_isolate)); -#define ENTER_V8_MAYBE_TEARDOWN(i_isolate) \ - i::VMState __state__((i_isolate)); - #define ENTER_V8_FOR_NEW_CONTEXT(i_isolate) \ i::VMState __state__((i_isolate)); #endif // DEBUG diff --git a/deps/v8/src/api/api-natives.cc b/deps/v8/src/api/api-natives.cc index d0b298723423e9..05a883f2d560e3 100644 --- a/deps/v8/src/api/api-natives.cc +++ b/deps/v8/src/api/api-natives.cc @@ -83,7 +83,7 @@ MaybeHandle DefineAccessorProperty(Isolate* isolate, InstantiateFunction(isolate, Handle::cast(getter)), Object); - Handle trampoline = BUILTIN_CODE(isolate, DebugBreakTrampoline); + Handle trampoline = BUILTIN_CODE(isolate, DebugBreakTrampoline); Handle::cast(getter)->set_code(*trampoline); } if (setter->IsFunctionTemplateInfo() && @@ -93,7 +93,7 @@ MaybeHandle DefineAccessorProperty(Isolate* isolate, InstantiateFunction(isolate, Handle::cast(setter)), Object); - Handle trampoline = BUILTIN_CODE(isolate, DebugBreakTrampoline); + Handle trampoline = BUILTIN_CODE(isolate, DebugBreakTrampoline); Handle::cast(setter)->set_code(*trampoline); } RETURN_ON_EXCEPTION( diff --git a/deps/v8/src/api/api.cc b/deps/v8/src/api/api.cc index da75db119baf10..e286ccd254497a 100644 --- a/deps/v8/src/api/api.cc +++ b/deps/v8/src/api/api.cc @@ -38,6 +38,7 @@ #include "src/baseline/baseline-batch-compiler.h" #include "src/builtins/accessors.h" #include "src/builtins/builtins-utils.h" +#include "src/codegen/compilation-cache.h" #include "src/codegen/compiler.h" #include "src/codegen/cpu-features.h" #include "src/codegen/script-details.h" @@ -45,10 +46,6 @@ #include "src/common/globals.h" #include "src/compiler-dispatcher/lazy-compile-dispatcher.h" #include "src/date/date.h" -#include "src/objects/primitive-heap-object.h" -#if V8_ENABLE_WEBASSEMBLY -#include "src/debug/debug-wasm-objects.h" -#endif // V8_ENABLE_WEBASSEMBLY #include "src/debug/liveedit.h" #include "src/deoptimizer/deoptimizer.h" #include "src/execution/embedder-state.h" @@ -64,7 +61,6 @@ #include "src/handles/persistent-handles.h" #include "src/handles/shared-object-conveyor-handles.h" #include "src/handles/traced-handles.h" -#include "src/heap/embedder-tracing.h" #include "src/heap/heap-inl.h" #include "src/heap/heap-write-barrier.h" #include "src/heap/safepoint.h" @@ -85,6 +81,8 @@ #include "src/objects/embedder-data-slot-inl.h" #include "src/objects/hash-table-inl.h" #include "src/objects/heap-object.h" +#include "src/objects/instance-type-inl.h" +#include "src/objects/instance-type.h" #include "src/objects/js-array-buffer-inl.h" #include "src/objects/js-array-inl.h" #include "src/objects/js-collection-inl.h" @@ -95,6 +93,7 @@ #include "src/objects/objects-inl.h" #include "src/objects/oddball.h" #include "src/objects/ordered-hash-table-inl.h" +#include "src/objects/primitive-heap-object.h" #include "src/objects/property-descriptor.h" #include "src/objects/property-details.h" #include "src/objects/property.h" @@ -115,6 +114,7 @@ #include "src/profiler/profile-generator-inl.h" #include "src/profiler/tick-sample.h" #include "src/regexp/regexp-utils.h" +#include "src/roots/static-roots.h" #include "src/runtime/runtime.h" #include "src/sandbox/external-pointer.h" #include "src/sandbox/sandbox.h" @@ -127,10 +127,11 @@ #include "src/strings/unicode-inl.h" #include "src/tracing/trace-event.h" #include "src/utils/detachable-vector.h" +#include "src/utils/identity-map.h" #include "src/utils/version.h" -#include "src/web-snapshot/web-snapshot.h" #if V8_ENABLE_WEBASSEMBLY +#include "src/debug/debug-wasm-objects.h" #include "src/trap-handler/trap-handler.h" #include "src/wasm/streaming-decoder.h" #include "src/wasm/value-type.h" @@ -143,6 +144,7 @@ #if V8_OS_LINUX || V8_OS_DARWIN || V8_OS_FREEBSD #include +#include #if V8_ENABLE_WEBASSEMBLY #include "include/v8-wasm-trap-handler-posix.h" @@ -337,7 +339,7 @@ void Utils::ReportOOMFailure(i::Isolate* i_isolate, const char* location, #ifdef V8_FUZZILLI // Ignore OOM crashes for fuzzing but exit with an error such that // samples are discarded by Fuzzilli. - exit(1); + _exit(1); #else base::OS::Abort(); #endif // V8_FUZZILLI @@ -358,19 +360,12 @@ void V8::SetSnapshotDataBlob(StartupData* snapshot_blob) { namespace { #ifdef V8_ENABLE_SANDBOX -// ArrayBufferAllocator to use when sandboxed pointers are used in which case -// all ArrayBuffer backing stores need to be allocated inside the sandbox. -// Note, the current implementation is extremely inefficient as it uses the -// BoundedPageAllocator. In the future, we'll need a proper allocator -// implementation. +// ArrayBufferAllocator to use when the sandbox is enabled in which case all +// ArrayBuffer backing stores need to be allocated inside the sandbox. class ArrayBufferAllocator : public v8::ArrayBuffer::Allocator { public: - ArrayBufferAllocator() { CHECK(page_allocator_); } - void* Allocate(size_t length) override { - return page_allocator_->AllocatePages(nullptr, RoundUp(length, page_size_), - page_size_, - PageAllocator::kReadWrite); + return allocator_->Allocate(length); } void* AllocateUninitialized(size_t length) override { @@ -378,12 +373,136 @@ class ArrayBufferAllocator : public v8::ArrayBuffer::Allocator { } void Free(void* data, size_t length) override { - page_allocator_->FreePages(data, RoundUp(length, page_size_)); + return allocator_->Free(data); } private: - PageAllocator* page_allocator_ = internal::GetArrayBufferPageAllocator(); - const size_t page_size_ = page_allocator_->AllocatePageSize(); + // Backend allocator shared by all ArrayBufferAllocator instances. This way, + // there is a single region of virtual addres space reserved inside the + // sandbox from which all ArrayBufferAllocators allocate their memory, + // instead of each allocator creating their own region, which may cause + // address space exhaustion inside the sandbox. + // TODO(chromium:1340224): replace this with a more efficient allocator. + class BackendAllocator { + public: + BackendAllocator() { + CHECK(i::GetProcessWideSandbox()->is_initialized()); + VirtualAddressSpace* vas = i::GetProcessWideSandbox()->address_space(); + constexpr size_t max_backing_memory_size = 8ULL * i::GB; + constexpr size_t min_backing_memory_size = 1ULL * i::GB; + size_t backing_memory_size = max_backing_memory_size; + i::Address backing_memory_base = 0; + while (!backing_memory_base && + backing_memory_size >= min_backing_memory_size) { + backing_memory_base = vas->AllocatePages( + VirtualAddressSpace::kNoHint, backing_memory_size, kChunkSize, + PagePermissions::kNoAccess); + if (!backing_memory_base) { + backing_memory_size /= 2; + } + } + if (!backing_memory_base) { + i::V8::FatalProcessOutOfMemory( + nullptr, + "Could not reserve backing memory for ArrayBufferAllocators"); + } + DCHECK(IsAligned(backing_memory_base, kChunkSize)); + + region_alloc_ = std::make_unique( + backing_memory_base, backing_memory_size, kAllocationGranularity); + end_of_accessible_region_ = region_alloc_->begin(); + + // Install a on-merge callback to discard or decommit unused pages. + region_alloc_->set_on_merge_callback([this](i::Address start, + size_t size) { + mutex_.AssertHeld(); + VirtualAddressSpace* vas = i::GetProcessWideSandbox()->address_space(); + i::Address end = start + size; + if (end == region_alloc_->end() && + start <= end_of_accessible_region_ - kChunkSize) { + // Can shrink the accessible region. + i::Address new_end_of_accessible_region = RoundUp(start, kChunkSize); + size_t size = + end_of_accessible_region_ - new_end_of_accessible_region; + CHECK(vas->DecommitPages(new_end_of_accessible_region, size)); + end_of_accessible_region_ = new_end_of_accessible_region; + } else if (size >= 2 * kChunkSize) { + // Can discard pages. The pages stay accessible, so the size of the + // accessible region doesn't change. + i::Address chunk_start = RoundUp(start, kChunkSize); + i::Address chunk_end = RoundDown(start + size, kChunkSize); + CHECK(vas->DiscardSystemPages(chunk_start, chunk_end - chunk_start)); + } + }); + } + + ~BackendAllocator() { + // The sandbox may already have been torn down, in which case there's no + // need to free any memory. + if (i::GetProcessWideSandbox()->is_initialized()) { + VirtualAddressSpace* vas = i::GetProcessWideSandbox()->address_space(); + vas->FreePages(region_alloc_->begin(), region_alloc_->size()); + } + } + + BackendAllocator(const BackendAllocator&) = delete; + BackendAllocator& operator=(const BackendAllocator&) = delete; + + void* Allocate(size_t length) { + base::MutexGuard guard(&mutex_); + + length = RoundUp(length, kAllocationGranularity); + i::Address region = region_alloc_->AllocateRegion(length); + if (region == base::RegionAllocator::kAllocationFailure) return nullptr; + + // Check if the memory is inside the accessible region. If not, grow it. + i::Address end = region + length; + size_t length_to_memset = length; + if (end > end_of_accessible_region_) { + VirtualAddressSpace* vas = i::GetProcessWideSandbox()->address_space(); + i::Address new_end_of_accessible_region = RoundUp(end, kChunkSize); + size_t size = new_end_of_accessible_region - end_of_accessible_region_; + if (!vas->SetPagePermissions(end_of_accessible_region_, size, + PagePermissions::kReadWrite)) { + CHECK(region_alloc_->FreeRegion(region)); + return nullptr; + } + + // The pages that were inaccessible are guaranteed to be zeroed, so only + // memset until the previous end of the accessible region. + length_to_memset = end_of_accessible_region_ - region; + end_of_accessible_region_ = new_end_of_accessible_region; + } + + void* mem = reinterpret_cast(region); + memset(mem, 0, length_to_memset); + return mem; + } + + void Free(void* data) { + base::MutexGuard guard(&mutex_); + region_alloc_->FreeRegion(reinterpret_cast(data)); + } + + static BackendAllocator* SharedInstance() { + static base::LeakyObject instance; + return instance.get(); + } + + private: + // Use a region allocator with a "page size" of 128 bytes as a reasonable + // compromise between the number of regions it has to manage and the amount + // of memory wasted due to rounding allocation sizes up to the page size. + static constexpr size_t kAllocationGranularity = 128; + // The backing memory's accessible region is grown in chunks of this size. + static constexpr size_t kChunkSize = 1 * i::MB; + + std::unique_ptr region_alloc_; + size_t end_of_accessible_region_; + base::Mutex mutex_; + }; + + BackendAllocator* allocator_ = BackendAllocator::SharedInstance(); }; #else @@ -429,7 +548,7 @@ struct SnapshotCreatorData { SnapshotCreator::SnapshotCreator(Isolate* v8_isolate, const intptr_t* external_references, - StartupData* existing_snapshot) { + const StartupData* existing_snapshot) { SnapshotCreatorData* data = new SnapshotCreatorData(v8_isolate); i::Isolate* i_isolate = reinterpret_cast(v8_isolate); i_isolate->set_array_buffer_allocator(&data->allocator_); @@ -451,7 +570,7 @@ SnapshotCreator::SnapshotCreator(Isolate* v8_isolate, } SnapshotCreator::SnapshotCreator(const intptr_t* external_references, - StartupData* existing_snapshot) + const StartupData* existing_snapshot) : SnapshotCreator(Isolate::Allocate(), external_references, existing_snapshot) {} @@ -617,7 +736,7 @@ StartupData SnapshotCreator::CreateBlob( i::Snapshot::ClearReconstructableDataForSerialization( i_isolate, function_code_handling == FunctionCodeHandling::kClear); - i::SafepointKind safepoint_kind = i_isolate->has_shared_heap() + i::SafepointKind safepoint_kind = i_isolate->has_shared_space() ? i::SafepointKind::kGlobal : i::SafepointKind::kIsolate; i::SafepointScope safepoint_scope(i_isolate, safepoint_kind); @@ -796,10 +915,11 @@ i::Address* GlobalizeTracedReference(i::Isolate* i_isolate, i::Address* obj, Utils::ApiCheck((slot != nullptr), "v8::GlobalizeTracedReference", "the address slot must be not null"); #endif - auto result = i_isolate->traced_handles()->Create(*obj, slot, store_mode); + auto obj_addr = internal::ValueHelper::ValueAsAddress(obj); + auto result = i_isolate->traced_handles()->Create(obj_addr, slot, store_mode); #ifdef VERIFY_HEAP if (i::v8_flags.verify_heap) { - i::Object(*obj).ObjectVerify(i_isolate); + i::Object(obj_addr).ObjectVerify(i_isolate); } #endif // VERIFY_HEAP return result.location(); @@ -818,6 +938,41 @@ void DisposeTracedReference(internal::Address* location) { TracedHandles::Destroy(location); } +#if V8_STATIC_ROOTS_BOOL + +// Initialize static root constants exposed in v8-internal.h. + +namespace { +constexpr InstanceTypeChecker::RootIndexRange kStringMapRange = + *InstanceTypeChecker::UniqueMapRangeOfInstanceTypeRange(FIRST_STRING_TYPE, + LAST_STRING_TYPE); +constexpr Tagged_t kFirstStringMapPtr = + StaticReadOnlyRootsPointerTable[static_cast(kStringMapRange.first)]; +constexpr Tagged_t kLastStringMapPtr = + StaticReadOnlyRootsPointerTable[static_cast( + kStringMapRange.second)]; +} // namespace + +#define EXPORTED_STATIC_ROOTS_MAPPING(V) \ + V(UndefinedValue, i::StaticReadOnlyRoot::kUndefinedValue) \ + V(NullValue, i::StaticReadOnlyRoot::kNullValue) \ + V(TrueValue, i::StaticReadOnlyRoot::kTrueValue) \ + V(FalseValue, i::StaticReadOnlyRoot::kFalseValue) \ + V(EmptyString, i::StaticReadOnlyRoot::kempty_string) \ + V(TheHoleValue, i::StaticReadOnlyRoot::kTheHoleValue) \ + V(FirstStringMap, kFirstStringMapPtr) \ + V(LastStringMap, kLastStringMapPtr) + +static_assert(std::is_same::value); +#define DEF_STATIC_ROOT(name, internal_value) \ + const Internals::Tagged_t Internals::StaticReadOnlyRoot::k##name = \ + internal_value; +EXPORTED_STATIC_ROOTS_MAPPING(DEF_STATIC_ROOT) +#undef DEF_STATIC_ROOT +#undef EXPORTED_STATIC_ROOTS_MAPPING + +#endif // V8_STATIC_ROOTS_BOOL + } // namespace internal namespace api_internal { @@ -930,6 +1085,15 @@ i::Address* HandleScope::CreateHandle(i::Isolate* i_isolate, i::Address value) { return i::HandleScope::CreateHandle(i_isolate, value); } +#ifdef V8_ENABLE_CONSERVATIVE_STACK_SCANNING + +i::Address* HandleScope::CreateHandleForCurrentIsolate(i::Address value) { + i::Isolate* i_isolate = i::Isolate::Current(); + return i::HandleScope::CreateHandle(i_isolate, value); +} + +#endif + EscapableHandleScope::EscapableHandleScope(Isolate* v8_isolate) { i::Isolate* i_isolate = reinterpret_cast(v8_isolate); escape_slot_ = CreateHandle( @@ -1013,10 +1177,7 @@ void Context::Enter() { i::DisallowGarbageCollection no_gc; i::Context env = *Utils::OpenHandle(this); i::Isolate* i_isolate = env.GetIsolate(); - // TODO(cbruni): Use ENTER_V8_NO_SCRIPT_NO_EXCEPTION which also checks - // Isolate::is_execution_terminating - // ENTER_V8_NO_SCRIPT_NO_EXCEPTION(i_isolate); - ENTER_V8_MAYBE_TEARDOWN(i_isolate); + ENTER_V8_NO_SCRIPT_NO_EXCEPTION(i_isolate); i::HandleScopeImplementer* impl = i_isolate->handle_scope_implementer(); impl->EnterContext(env); impl->SaveContext(i_isolate->context()); @@ -1026,7 +1187,7 @@ void Context::Enter() { void Context::Exit() { i::Handle env = Utils::OpenHandle(this); i::Isolate* i_isolate = env->GetIsolate(); - ENTER_V8_MAYBE_TEARDOWN(i_isolate); + ENTER_V8_NO_SCRIPT_NO_EXCEPTION(i_isolate); i::HandleScopeImplementer* impl = i_isolate->handle_scope_implementer(); if (!Utils::ApiCheck(impl->LastEnteredContextWas(*env), "v8::Context::Exit()", "Cannot exit non-entered context")) { @@ -1069,7 +1230,7 @@ static i::Handle EmbedderDataFor(Context* context, const char* location) { i::Handle env = Utils::OpenHandle(context); i::Isolate* i_isolate = env->GetIsolate(); - DCHECK_NO_SCRIPT_NO_EXCEPTION_MAYBE_TEARDOWN(i_isolate); + DCHECK_NO_SCRIPT_NO_EXCEPTION(i_isolate); bool ok = Utils::ApiCheck(env->IsNativeContext(), location, "Not a native context") && Utils::ApiCheck(index >= 0, location, "Negative index"); @@ -1942,30 +2103,6 @@ void ObjectTemplate::SetCodeLike() { // Internally, UnboundScript and UnboundModuleScript are SharedFunctionInfos, // and Script is a JSFunction. -namespace { -inline Local GetSharedFunctionInfoSourceMappingURL( - i::Isolate* isolate, i::Handle obj) { - ENTER_V8_NO_SCRIPT_NO_EXCEPTION(isolate); - if (obj->script().IsScript()) { - i::Object url = i::Script::cast(obj->script()).source_mapping_url(); - return Utils::ToLocal(i::Handle(url, isolate)); - } else { - return Local(); - } -} - -inline Local GetSharedFunctionInfoSourceURL( - i::Isolate* isolate, i::Handle obj) { - ENTER_V8_NO_SCRIPT_NO_EXCEPTION(isolate); - if (obj->script().IsScript()) { - i::Object url = i::Script::cast(obj->script()).source_url(); - return Utils::ToLocal(i::Handle(url, isolate)); - } else { - return Local(); - } -} -} // namespace - ScriptCompiler::CachedData::CachedData(const uint8_t* data_, int length_, BufferPolicy buffer_policy_) : data(data_), @@ -1986,9 +2123,10 @@ ScriptCompiler::StreamedSource::StreamedSource( ScriptCompiler::StreamedSource::~StreamedSource() = default; Local