diff --git a/.git-blame-ignore-revs b/.git-blame-ignore-revs index 4c53e208e3..29372f34c1 100644 --- a/.git-blame-ignore-revs +++ b/.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/.gitignore b/.gitignore index b35b5d0b1b..2ebf4b60c0 100644 --- a/.gitignore +++ b/.gitignore @@ -28,6 +28,7 @@ .clangd .cpplint-cache .cproject +.DS_Store .gclient_entries .gdb_history .idea diff --git a/AUTHORS b/AUTHORS index 7a3bf83ea4..21f0b915bb 100644 --- a/AUTHORS +++ b/AUTHORS @@ -153,6 +153,8 @@ Jiawen Geng Jiaxun Yang Joel Stanley Johan Bergström +Johan Levin +John Paul Adrian Glaubitz Jonathan Liu Juan Arboleda Julien Brianceau diff --git a/BUILD.bazel b/BUILD.bazel index bf367db3a9..7f7441ab55 100644 --- a/BUILD.bazel +++ b/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") @@ -68,6 +69,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 @@ -146,6 +148,11 @@ 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, @@ -320,6 +327,7 @@ v8_config( "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", @@ -861,6 +869,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", @@ -870,6 +879,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", @@ -1155,7 +1165,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", @@ -1254,6 +1263,7 @@ filegroup( "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", @@ -1442,9 +1452,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", @@ -1668,6 +1677,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", @@ -1783,6 +1794,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", @@ -2199,8 +2211,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", @@ -2242,10 +2252,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", @@ -2272,12 +2278,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", @@ -2302,12 +2302,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", @@ -2343,12 +2337,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", @@ -2378,12 +2366,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", @@ -2410,10 +2392,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", @@ -2439,12 +2417,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", @@ -2616,7 +2588,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", @@ -2891,10 +2862,13 @@ filegroup( "src/compiler/state-values-utils.h", "src/compiler/store-store-elimination.cc", "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/dead-code-elimination-reducer.h", "src/compiler/turboshaft/decompression-optimization.cc", "src/compiler/turboshaft/decompression-optimization.h", "src/compiler/turboshaft/deopt-data.h", @@ -2909,6 +2883,7 @@ filegroup( "src/compiler/turboshaft/late-escape-analysis-reducer.h", "src/compiler/turboshaft/late-escape-analysis-reducer.cc", "src/compiler/turboshaft/layered-hash-map.h", + "src/compiler/turboshaft/machine-lowering-reducer.h", "src/compiler/turboshaft/machine-optimization-reducer.h", "src/compiler/turboshaft/memory-optimization.cc", "src/compiler/turboshaft/memory-optimization.h", @@ -2919,6 +2894,7 @@ filegroup( "src/compiler/turboshaft/optimization-phase.h", "src/compiler/turboshaft/recreate-schedule.cc", "src/compiler/turboshaft/recreate-schedule.h", + "src/compiler/turboshaft/reducer-traits.h", "src/compiler/turboshaft/representations.cc", "src/compiler/turboshaft/representations.h", "src/compiler/turboshaft/select-lowering-reducer.h", @@ -2929,8 +2905,10 @@ filegroup( "src/compiler/turboshaft/type-inference-reducer.h", "src/compiler/turboshaft/type-parser.cc", "src/compiler/turboshaft/type-parser.h", + "src/compiler/turboshaft/typed-optimizations-reducer.h", "src/compiler/turboshaft/types.cc", "src/compiler/turboshaft/types.h", + "src/compiler/turboshaft/uniform-reducer-adapter.h", "src/compiler/turboshaft/utils.cc", "src/compiler/turboshaft/utils.h", "src/compiler/turboshaft/value-numbering-reducer.h", @@ -2954,6 +2932,59 @@ 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", @@ -2964,6 +2995,8 @@ filegroup( "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", @@ -2982,7 +3015,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", @@ -3002,6 +3035,7 @@ filegroup( "src/builtins/builtins-constructor.h", "src/builtins/builtins-conversion-gen.cc", "src/builtins/builtins-data-view-gen.h", + "src/builtins/builtins-data-view-gen.cc", "src/builtins/builtins-date-gen.cc", "src/builtins/builtins-generator-gen.cc", "src/builtins/builtins-global-gen.cc", @@ -3073,6 +3107,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 = [ @@ -3187,16 +3229,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"], }), ) @@ -3252,6 +3294,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", @@ -3405,8 +3449,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": [], @@ -3422,12 +3466,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", @@ -3440,8 +3480,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", @@ -3507,8 +3567,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", @@ -3578,15 +3636,15 @@ 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", ) @@ -3632,22 +3690,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", @@ -3657,7 +3720,15 @@ 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"], @@ -3747,14 +3818,30 @@ 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( diff --git a/BUILD.gn b/BUILD.gn index 87d0428475..8d1a7b496d 100644 --- a/BUILD.gn +++ b/BUILD.gn @@ -10,10 +10,6 @@ import("//build/config/mips.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") @@ -121,7 +117,7 @@ declare_args() { v8_enable_snapshot_native_code_counters = "" # Use pre-generated static root pointer values from static-roots.h. - v8_enable_static_roots = false + v8_enable_static_roots = "" # Enable code-generation-time checking of types in the CodeStubAssembler. v8_enable_verify_csa = false @@ -207,10 +203,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. @@ -462,8 +454,13 @@ 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 + 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.") + if (v8_builtins_profiling_log_file == "default") { v8_builtins_profiling_log_file = "" @@ -516,6 +513,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")) { @@ -540,11 +541,16 @@ if (v8_enable_sandbox == "") { if (v8_enable_static_roots == "") { # Static roots are only valid for builds with pointer compression and a - # shared ro heap. Also, non-wasm and non-i18n builds have fewer read-only - # roots. + # 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_webassembly && + v8_enable_pointer_compression_shared_cage && + v8_enable_external_code_space && v8_enable_webassembly && v8_enable_i18n_support } @@ -598,8 +604,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") @@ -831,6 +838,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", ] @@ -860,6 +868,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 @@ -1041,6 +1052,9 @@ config("features") { if (v8_enable_maglev) { defines += [ "V8_ENABLE_MAGLEV" ] } + if (v8_enable_turbofan) { + defines += [ "V8_ENABLE_TURBOFAN" ] + } if (v8_enable_swiss_name_dictionary) { defines += [ "V8_ENABLE_SWISS_NAME_DICTIONARY" ] } @@ -1294,13 +1308,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) { @@ -1599,21 +1612,6 @@ 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 - } - } -} - if (v8_postmortem_support) { action("postmortem-metadata") { # Only targets in this file and the top-level visibility target can @@ -1801,6 +1799,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", @@ -1810,6 +1809,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", @@ -2160,12 +2160,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" @@ -2307,6 +2301,7 @@ 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), @@ -2318,36 +2313,45 @@ action("v8_dump_build_config") { "is_clang=$is_clang", "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_disable_write_barriers=$v8_disable_write_barriers", + "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_target_cpu=\"$v8_target_cpu\"", - "v8_enable_cet_shadow_stack=$v8_enable_cet_shadow_stack", ] if (v8_current_cpu == "mips64" || v8_current_cpu == "mips64el") { @@ -2368,6 +2372,7 @@ v8_source_set("v8_snapshot") { deps = [ ":v8_internal_headers", ":v8_libbase", + ":v8_tracing", ] public_deps = [ # This should be public so downstream targets can declare the snapshot @@ -2439,6 +2444,7 @@ v8_source_set("v8_initializers") { "src/builtins/builtins-constructor-gen.h", "src/builtins/builtins-constructor.h", "src/builtins/builtins-conversion-gen.cc", + "src/builtins/builtins-data-view-gen.cc", "src/builtins/builtins-data-view-gen.h", "src/builtins/builtins-date-gen.cc", "src/builtins/builtins-generator-gen.cc", @@ -2980,9 +2986,11 @@ 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/turbofan.h", "src/compiler/turboshaft/assembler.h", "src/compiler/turboshaft/assert-types-reducer.h", "src/compiler/turboshaft/branch-elimination-reducer.h", + "src/compiler/turboshaft/dead-code-elimination-reducer.h", "src/compiler/turboshaft/decompression-optimization.h", "src/compiler/turboshaft/deopt-data.h", "src/compiler/turboshaft/fast-hash.h", @@ -2992,12 +3000,14 @@ v8_header_set("v8_internal_headers") { "src/compiler/turboshaft/index.h", "src/compiler/turboshaft/late-escape-analysis-reducer.h", "src/compiler/turboshaft/layered-hash-map.h", + "src/compiler/turboshaft/machine-lowering-reducer.h", "src/compiler/turboshaft/machine-optimization-reducer.h", "src/compiler/turboshaft/memory-optimization.h", "src/compiler/turboshaft/operation-matching.h", "src/compiler/turboshaft/operations.h", "src/compiler/turboshaft/optimization-phase.h", "src/compiler/turboshaft/recreate-schedule.h", + "src/compiler/turboshaft/reducer-traits.h", "src/compiler/turboshaft/representations.h", "src/compiler/turboshaft/select-lowering-reducer.h", "src/compiler/turboshaft/sidetable.h", @@ -3005,7 +3015,9 @@ v8_header_set("v8_internal_headers") { "src/compiler/turboshaft/snapshot-table.h", "src/compiler/turboshaft/type-inference-reducer.h", "src/compiler/turboshaft/type-parser.h", + "src/compiler/turboshaft/typed-optimizations-reducer.h", "src/compiler/turboshaft/types.h", + "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", @@ -3124,8 +3136,8 @@ v8_header_set("v8_internal_headers") { "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", @@ -3640,6 +3652,7 @@ v8_header_set("v8_internal_headers") { if (v8_enable_maglev) { sources += [ + "src/maglev/maglev-assembler-inl.h", "src/maglev/maglev-assembler.h", "src/maglev/maglev-basic-block.h", "src/maglev/maglev-code-gen-state.h", @@ -3685,6 +3698,7 @@ v8_header_set("v8_internal_headers") { "src/compiler/wasm-gc-operator-reducer.h", "src/compiler/wasm-graph-assembler.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", @@ -3936,7 +3950,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" ] } @@ -4241,6 +4255,7 @@ v8_compiler_sources = [ "src/compiler/simplified-operator.cc", "src/compiler/state-values-utils.cc", "src/compiler/store-store-elimination.cc", + "src/compiler/turbofan-enabled.cc", "src/compiler/type-cache.cc", "src/compiler/type-narrowing-reducer.cc", "src/compiler/typed-optimization.cc", @@ -4249,10 +4264,93 @@ 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", @@ -4263,6 +4361,7 @@ if (v8_enable_webassembly) { "src/compiler/wasm-gc-operator-reducer.cc", "src/compiler/wasm-graph-assembler.cc", "src/compiler/wasm-inlining.cc", + "src/compiler/wasm-load-elimination.cc", "src/compiler/wasm-loop-peeling.cc", "src/compiler/wasm-typer.cc", ] @@ -4275,8 +4374,12 @@ if (v8_enable_wasm_simd256_revec) { ] } -# 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 @@ -4307,11 +4410,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", @@ -4370,8 +4478,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" ] } @@ -4390,7 +4504,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 @@ -4444,7 +4562,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", @@ -4558,7 +4675,6 @@ v8_source_set("v8_base_without_compiler") { "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", @@ -4679,6 +4795,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", @@ -4831,13 +4948,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", @@ -4966,9 +5083,6 @@ v8_source_set("v8_base_without_compiler") { "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", @@ -4982,10 +5096,6 @@ v8_source_set("v8_base_without_compiler") { "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", @@ -5021,10 +5131,6 @@ v8_source_set("v8_base_without_compiler") { "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", @@ -5044,10 +5150,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", @@ -5089,9 +5191,6 @@ v8_source_set("v8_base_without_compiler") { "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", @@ -5107,9 +5206,6 @@ v8_source_set("v8_base_without_compiler") { "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", @@ -5124,10 +5220,6 @@ v8_source_set("v8_base_without_compiler") { "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", @@ -5143,10 +5235,6 @@ v8_source_set("v8_base_without_compiler") { "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", @@ -5162,10 +5250,6 @@ v8_source_set("v8_base_without_compiler") { "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", @@ -5191,9 +5275,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", @@ -5218,9 +5299,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", @@ -5341,8 +5419,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") { @@ -5908,31 +5989,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" ] } } @@ -6548,10 +6629,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" ] @@ -6604,10 +6689,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 b/DEPS index 31a0702c19..c7baa99eb6 100644 --- a/DEPS +++ b/DEPS @@ -39,6 +39,9 @@ vars = { # 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, @@ -50,22 +53,22 @@ vars = { 'fuchsia_sdk_cipd_prefix': 'fuchsia/sdk/gn/', # reclient CIPD package version - 'reclient_version': 're_client_version:0.87.0.b6908b3-gomaip', + 'reclient_version': 're_client_version:0.93.0.9ed3cef-gomaip', # GN CIPD package version. - 'gn_version': 'git_revision:5e19d2fb166fbd4f6f32147fbb2f497091a54ad8', + 'gn_version': 'git_revision:84c8431f3e03cc6226c59dd49637c15ea31169a1', # 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:bac571b5399502fa16ac48a1d3820e1117505085', + 'luci_go': 'git_revision:c41d94e382727fc5276cd2771741990543fce337', # 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:11.20221219.3.1', + 'fuchsia_version': 'version:11.20230131.1.1', # Three lines of non-changing comments so that # the commit queue can handle CLs rolling android_sdk_build-tools_version @@ -98,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': 'oWlET2yQhaPKQ66tYNuSPaueU78Z9VlxpyxOoUjwRuIC', + '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' + '@' + '68e6038b5350cba18c341cc7c572170af5c5b20c', 'build': - Var('chromium_url') + '/chromium/src/build.git' + '@' + '8b3f1346a4f7f3b89c938e537a9be0e2120a9535', + Var('chromium_url') + '/chromium/src/build.git' + '@' + 'e0df145ecb560e48381b6dccf3b9c8b31aa95bcd', 'buildtools': - Var('chromium_url') + '/chromium/src/buildtools.git' + '@' + '600a61514a682cdda7952a3ef8c75acd9487fa6b', + Var('chromium_url') + '/chromium/src/buildtools.git' + '@' + '295c6e5037e358904aef73a21409896d58547ba6', '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': [ { @@ -131,11 +134,11 @@ deps = { 'condition': 'host_os == "mac"', }, 'buildtools/third_party/libc++/trunk': - Var('chromium_url') + '/external/github.com/llvm/llvm-project/libcxx.git' + '@' + '7b20455cbdf0891a6e5e2b66609b08c4f407ae5f', + Var('chromium_url') + '/external/github.com/llvm/llvm-project/libcxx.git' + '@' + '59bae40d835ae4eabaddbef781f5e3b778dd7907', 'buildtools/third_party/libc++abi/trunk': - Var('chromium_url') + '/external/github.com/llvm/llvm-project/libcxxabi.git' + '@' + '123239cdb67b3d69c5af933e364a84019a33575c', + Var('chromium_url') + '/external/github.com/llvm/llvm-project/libcxxabi.git' + '@' + 'b74d7716111d7eda5c03cb8f5dfc940e1c2c0030', 'buildtools/third_party/libunwind/trunk': - Var('chromium_url') + '/external/github.com/llvm/llvm-project/libunwind.git' + '@' + '5e22a7fe2335161ab267867c8e1be481bf6c8300', + Var('chromium_url') + '/external/github.com/llvm/llvm-project/libunwind.git' + '@' + 'e95b94b74d26f8387d4fb03a687a2fab0ed8e91c', 'buildtools/win': { 'packages': [ { @@ -154,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' + '@' + 'e6c6460a5b94e32e01ce9a9d236f3148d4648ce5', + Var('chromium_url') + '/external/github.com/tc39/test262.git' + '@' + 'f00d4118dba5d266d1611ba2cd4e995d3e4b523a', 'third_party/android_ndk': { 'url': Var('chromium_url') + '/android_ndk.git' + '@' + '8388a2be5421311dc75c5f937aae13d821a27f3d', 'condition': 'checkout_android', @@ -209,7 +212,7 @@ deps = { 'dep_type': 'cipd', }, 'third_party/catapult': { - 'url': Var('chromium_url') + '/catapult.git' + '@' + '1e4341629217ba4a71a976d9c173d13f7c4e63a4', + 'url': Var('chromium_url') + '/catapult.git' + '@' + '5a468ccd919e16a29bb3121e3c90f27bf8745942', 'condition': 'checkout_android', }, 'third_party/colorama/src': { @@ -217,7 +220,7 @@ deps = { 'condition': 'checkout_android', }, 'third_party/depot_tools': - Var('chromium_url') + '/chromium/tools/depot_tools.git' + '@' + '5decb175432cb284b6f8ee102dc1b908b58d8e41', + Var('chromium_url') + '/chromium/tools/depot_tools.git' + '@' + '3d072ab6fb49fd3d2116a41cee66d47c3d409299', 'third_party/fuchsia-sdk/sdk': { 'packages': [ { @@ -234,7 +237,7 @@ 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' + '@' + '1b7d391f0528fb3a4976b7541b387ee04f915f83', + Var('chromium_url') + '/chromium/deps/icu.git' + '@' + '2c51e5cc7e0a06cd4cd7cb2ddbac445af9b475ba', 'third_party/instrumented_libraries': Var('chromium_url') + '/chromium/src/third_party/instrumented_libraries.git' + '@' + '09ba70cfb2c0d01c60684660e357ae200caf2968', 'third_party/ittapi': { @@ -244,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': @@ -270,9 +273,9 @@ deps = { 'condition': 'checkout_android', }, 'third_party/zlib': - Var('chromium_url') + '/chromium/src/third_party/zlib.git'+ '@' + '18d27fa10b237fdfcbd8f0c65c19fe009981a3bc', + Var('chromium_url') + '/chromium/src/third_party/zlib.git'+ '@' + '2d44c51ada6d325b85b53427b02dabf44648bca4', 'tools/clang': - Var('chromium_url') + '/chromium/src/tools/clang.git' + '@' + 'cab032b11ddc12804bf4ae8d71a6e0f88bc51ddb', + Var('chromium_url') + '/chromium/src/tools/clang.git' + '@' + '44e5e39a90511e079e4b9bc2f753059f2fe6ac4b', 'tools/luci-go': { 'packages': [ { @@ -621,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/PPC_OWNERS b/PPC_OWNERS index 02c2cd757c..6edd45a6ef 100644 --- a/PPC_OWNERS +++ b/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/S390_OWNERS b/S390_OWNERS index 02c2cd757c..6edd45a6ef 100644 --- a/S390_OWNERS +++ b/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/WATCHLISTS b/WATCHLISTS index 7be659ce45..9da8c5b6c0 100644 --- a/WATCHLISTS +++ b/WATCHLISTS @@ -101,11 +101,13 @@ '|test/unittests/heap/cppgc/' \ '|test/unittests/heap/cppgc-js/', }, + 'trap-handler': { + 'filepath': 'src/trap-handler/', + }, }, 'WATCHLISTS': { 'maglev': [ - 'jgruber+watch@chromium.org', 'leszeks+watch@chromium.org', 'verwaest+watch@chromium.org', 'victorgomes+watch@chromium.org', @@ -168,5 +170,11 @@ 'cppgc': [ 'oilpan-reviews+v8@chromium.org', ], + 'trap-handler': [ + 'ahaas@chromium.org', + 'clemensb@chromium.org', + 'mark@chromium.org', + 'mseaborn@chromium.org', + ], }, } diff --git a/bazel/defs.bzl b/bazel/defs.bzl index 8c3e3b9d1d..a23646ea37 100644 --- a/bazel/defs.bzl +++ b/bazel/defs.bzl @@ -205,7 +205,7 @@ def v8_binary( name = "noicu/" + name, 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, **kwargs @@ -214,7 +214,7 @@ 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, copts = copts + default.copts + ENABLE_I18N_SUPPORT_DEFINES, linkopts = linkopts + default.linkopts, **kwargs @@ -249,7 +249,7 @@ def v8_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, @@ -268,7 +268,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, @@ -296,7 +296,7 @@ def v8_library( **kwargs ) -def _torque_impl(ctx): +def _torque_initializers_impl(ctx): if ctx.workspace_name == "v8": v8root = "." else: @@ -317,7 +317,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: @@ -325,22 +325,19 @@ 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.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")) 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 = "GenTorque", - progress_message = "Generating Torque files", + mnemonic = "GenTorqueInitializers", + progress_message = "Generating Torque initializers", ) return [DefaultInfo(files = depset(outs))] -_v8_torque = rule( - implementation = _torque_impl, +_v8_torque_initializers = rule( + implementation = _torque_initializers_impl, # cfg = v8_target_cpu_transition, attrs = { "prefix": attr.string(mandatory = True), @@ -355,8 +352,8 @@ _v8_torque = rule( }, ) -def v8_torque(name, noicu_srcs, icu_srcs, args, extras): - _v8_torque( +def v8_torque_initializers(name, noicu_srcs, icu_srcs, args, extras): + _v8_torque_initializers( name = "noicu/" + name, prefix = "noicu", srcs = noicu_srcs, @@ -367,7 +364,88 @@ def v8_torque(name, noicu_srcs, icu_srcs, args, extras): "//conditions:default": ":torque", }), ) - _v8_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": ":torque_non_pointer_compression", + "//conditions:default": ":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")) + 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 = "GenTorqueDefinitions", + progress_message = "Generating Torque definitions", + ) + return [DefaultInfo(files = depset(outs))] + +_v8_torque_definitions = rule( + implementation = _torque_definitions_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_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_torque_definitions( name = "icu/" + name, prefix = "icu", srcs = icu_srcs, @@ -533,7 +611,17 @@ 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"), ]) # TODO(victorgomes): Create a rule (instead of a macro), that can diff --git a/gni/snapshot_toolchain.gni b/gni/snapshot_toolchain.gni index 99de816372..c7faa8ca58 100644 --- a/gni/snapshot_toolchain.gni +++ b/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/gni/v8.gni b/gni/v8.gni index f297eb379b..e6ef2249d3 100644 --- a/gni/v8.gni +++ b/gni/v8.gni @@ -63,10 +63,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. @@ -97,6 +106,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 @@ -135,6 +150,13 @@ if (v8_enable_webassembly == "") { 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 == "") { + v8_enable_turbofan = !v8_enable_lite_mode +} +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. @@ -280,6 +302,7 @@ template("v8_executable") { template("v8_component") { component(target_name) { + output_name = target_name forward_variables_from(invoker, "*", [ diff --git a/include/cppgc/cross-thread-persistent.h b/include/cppgc/cross-thread-persistent.h index 1fa28afa13..a5f8bac0b1 100644 --- a/include/cppgc/cross-thread-persistent.h +++ b/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/include/cppgc/heap-consistency.h b/include/cppgc/heap-consistency.h index 35c59ed1ad..eb7fdaee8c 100644 --- a/include/cppgc/heap-consistency.h +++ b/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/include/cppgc/internal/gc-info.h b/include/cppgc/internal/gc-info.h index e8f90fed57..08ffd411a8 100644 --- a/include/cppgc/internal/gc-info.h +++ b/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/include/cppgc/internal/member-storage.h b/include/cppgc/internal/member-storage.h index 0eb6382070..cc803bdcb1 100644 --- a/include/cppgc/internal/member-storage.h +++ b/include/cppgc/internal/member-storage.h @@ -225,9 +225,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/include/cppgc/internal/pointer-policies.h b/include/cppgc/internal/pointer-policies.h index 8455b3df81..a513968312 100644 --- a/include/cppgc/internal/pointer-policies.h +++ b/include/cppgc/internal/pointer-policies.h @@ -34,18 +34,29 @@ struct DijkstraWriteBarrierPolicy { } 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, MemberStorage storage) { +#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 } private: @@ -69,6 +80,7 @@ struct DijkstraWriteBarrierPolicy { struct NoWriteBarrierPolicy { V8_INLINE static void InitializingBarrier(const void*, const void*) {} V8_INLINE static void AssigningBarrier(const void*, const void*) {} + template V8_INLINE static void AssigningBarrier(const void*, MemberStorage) {} }; @@ -197,7 +209,8 @@ template class BasicPersistent; template + typename CheckingPolicy = DefaultMemberCheckingPolicy, + typename StorageType = DefaultMemberStorage> class BasicMember; } // namespace internal diff --git a/include/cppgc/internal/write-barrier.h b/include/cppgc/internal/write-barrier.h index 37bc5c973e..ec941b171a 100644 --- a/include/cppgc/internal/write-barrier.h +++ b/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,14 @@ 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. + 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 +172,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 +217,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 +315,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 +391,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/include/cppgc/member.h b/include/cppgc/member.h index 9bc383634f..13d92b055d 100644 --- a/include/cppgc/member.h +++ b/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,42 @@ 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::AssigningBarrier(Base::GetRawSlot(), value); } V8_INLINE void AssigningWriteBarrier() const { - WriteBarrierPolicy::AssigningBarrier(GetRawSlot(), GetRawStorage()); + WriteBarrierPolicy::AssigningBarrier(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 +325,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 +352,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 +385,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 +499,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 +514,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 +529,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 +556,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 +569,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 +580,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/include/cppgc/persistent.h b/include/cppgc/persistent.h index 3a66ccc086..709f3fd6ab 100644 --- a/include/cppgc/persistent.h +++ b/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/include/cppgc/type-traits.h b/include/cppgc/type-traits.h index 2f499e6886..4651435390 100644 --- a/include/cppgc/type-traits.h +++ b/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/include/cppgc/visitor.h b/include/cppgc/visitor.h index 704aabcdb0..9b135e39a0 100644 --- a/include/cppgc/visitor.h +++ b/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. diff --git a/include/js_protocol.pdl b/include/js_protocol.pdl index 6efcf78785..d4102f5c6c 100644 --- a/include/js_protocol.pdl +++ b/include/js_protocol.pdl @@ -1402,6 +1402,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 +1741,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/include/v8-callbacks.h b/include/v8-callbacks.h index 0ffdfb6656..f3e96c3706 100644 --- a/include/v8-callbacks.h +++ b/include/v8-callbacks.h @@ -328,6 +328,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); diff --git a/include/v8-cppgc.h b/include/v8-cppgc.h index 7e38833163..d5c6b6e123 100644 --- a/include/v8-cppgc.h +++ b/include/v8-cppgc.h @@ -85,6 +85,7 @@ struct CppHeapCreateParams { inline CppHeapCreateParams(WrapperDescriptor wrapper_descriptor) : wrapper_descriptor(wrapper_descriptor) {} + std::vector> custom_spaces; WrapperDescriptor wrapper_descriptor; /** diff --git a/include/v8-embedder-heap.h b/include/v8-embedder-heap.h index f994cdfdf3..9e2e3ef58c 100644 --- a/include/v8-embedder-heap.h +++ b/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/include/v8-internal.h b/include/v8-internal.h index 88de43cf57..ea03bc3e5a 100644 --- a/include/v8-internal.h +++ b/include/v8-internal.h @@ -315,6 +315,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 @@ -322,14 +323,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"); diff --git a/include/v8-isolate.h b/include/v8-isolate.h index 6dfcb25e51..345395b179 100644 --- a/include/v8-isolate.h +++ b/include/v8-isolate.h @@ -541,6 +541,7 @@ class V8_EXPORT Isolate { kTurboFanOsrCompileStarted = 115, kAsyncStackTaggingCreateTaskCall = 116, kDurationFormat = 117, + kInvalidatedNumberStringPrototypeNoReplaceProtector = 118, // 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 @@ -928,27 +929,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. */ @@ -959,8 +943,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. */ @@ -1350,11 +1332,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(); /** @@ -1534,6 +1518,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); diff --git a/include/v8-local-handle.h b/include/v8-local-handle.h index cbf87f949d..633c5633c5 100644 --- a/include/v8-local-handle.h +++ b/include/v8-local-handle.h @@ -53,6 +53,7 @@ class Utils; namespace internal { template class CustomArguments; +class SamplingHeapProfiler; } // namespace internal namespace api_internal { @@ -313,6 +314,7 @@ class Local { friend class BasicTracedReference; template friend class TracedReference; + friend class v8::internal::SamplingHeapProfiler; explicit V8_INLINE Local(T* that) : val_(that) {} V8_INLINE static Local New(Isolate* isolate, T* that) { diff --git a/include/v8-metrics.h b/include/v8-metrics.h index 418531e22b..5c6c1c4705 100644 --- a/include/v8-metrics.h +++ b/include/v8-metrics.h @@ -108,34 +108,12 @@ struct WasmModuleDecoded { function_count(function_count), wall_clock_duration_in_us(wall_clock_duration_in_us) {} - V8_DEPRECATED("Use the version without cpu_duration_in_us") - WasmModuleDecoded(bool async, bool streamed, bool success, - size_t module_size_in_bytes, size_t function_count, - int64_t wall_clock_duration_in_us, - int64_t cpu_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), - cpu_duration_in_us(cpu_duration_in_us) {} - - START_ALLOW_USE_DEPRECATED() - // Copy constructor and copy assignment operator are allowed to copy the - // {cpu_duration_in_us} field. - WasmModuleDecoded(const WasmModuleDecoded&) = default; - WasmModuleDecoded& operator=(const WasmModuleDecoded&) = default; - END_ALLOW_USE_DEPRECATED() - 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; - V8_DEPRECATED("We do not collect cpu times any more") - int64_t cpu_duration_in_us = -1; }; struct WasmModuleCompiled { @@ -155,30 +133,6 @@ struct WasmModuleCompiled { liftoff_bailout_count(liftoff_bailout_count), wall_clock_duration_in_us(wall_clock_duration_in_us) {} - V8_DEPRECATED("Use the version without cpu_duration_in_us") - 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, - int64_t cpu_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), - cpu_duration_in_us(cpu_duration_in_us) {} - - START_ALLOW_USE_DEPRECATED() - // Copy constructor and copy assignment operator are allowed to copy the - // {cpu_duration_in_us} field. - WasmModuleCompiled(const WasmModuleCompiled&) = default; - WasmModuleCompiled& operator=(const WasmModuleCompiled&) = default; - END_ALLOW_USE_DEPRECATED() - bool async = false; bool streamed = false; bool cached = false; @@ -188,8 +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; - V8_DEPRECATED("We do not collect cpu times any more") - int64_t cpu_duration_in_us = -1; }; struct WasmModuleInstantiated { diff --git a/include/v8-profiler.h b/include/v8-profiler.h index 6b73fc60bf..d394151221 100644 --- a/include/v8-profiler.h +++ b/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/include/v8-script.h b/include/v8-script.h index adab62f4ab..844b6aa66b 100644 --- a/include/v8-script.h +++ b/include/v8-script.h @@ -347,6 +347,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 }; @@ -569,7 +575,8 @@ class V8_EXPORT ScriptCompiler { enum CompileOptions { kNoCompileOptions = 0, kConsumeCodeCache, - kEagerCompile + kEagerCompile, + kProduceCompileHints }; /** diff --git a/include/v8-traced-handle.h b/include/v8-traced-handle.h index e0fd57c49d..784016b37c 100644 --- a/include/v8-traced-handle.h +++ b/include/v8-traced-handle.h @@ -117,11 +117,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. @@ -166,7 +166,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 +180,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 { diff --git a/include/v8-version.h b/include/v8-version.h index 134e3a8f62..cce5958627 100644 --- a/include/v8-version.h +++ b/include/v8-version.h @@ -9,7 +9,7 @@ // 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 11 -#define V8_MINOR_VERSION 1 +#define V8_MINOR_VERSION 2 #define V8_BUILD_NUMBER 0 #define V8_PATCH_LEVEL 0 diff --git a/include/v8config.h b/include/v8config.h index c79cd04e0f..a967d92c39 100644 --- a/include/v8config.h +++ b/include/v8config.h @@ -346,6 +346,14 @@ path. Add it with -I to the command line # 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 incomplete on 32-bit, and we see +// failures in component builds. Thus only use it in 64-bit non-component builds +// for now. +#if (defined(_M_X64) || defined(__x86_64__) || defined(__AARCH64EL__) || \ + defined(_M_ARM64)) /* x64 or arm64 */ \ + && !defined(COMPONENT_BUILD) +# 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)) @@ -504,6 +512,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)]] diff --git a/infra/mb/gn_isolate_map.pyl b/infra/mb/gn_isolate_map.pyl index 5732d86218..934ff59b2f 100644 --- a/infra/mb/gn_isolate_map.pyl +++ b/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", diff --git a/infra/mb/mb_config.pyl b/infra/mb/mb_config.pyl index c494280b72..f14a81b238 100644 --- a/infra/mb/mb_config.pyl +++ b/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,7 +63,7 @@ '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', @@ -102,6 +106,7 @@ # 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', @@ -182,7 +187,7 @@ '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', @@ -190,7 +195,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. @@ -242,7 +247,7 @@ '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', @@ -257,6 +262,7 @@ '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', @@ -284,13 +290,13 @@ 'v8_mac64_compile_dbg': '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', @@ -397,18 +403,24 @@ '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', 'v8_enable_slow_dchecks', 'v8_disable_pointer_compression'], @@ -505,6 +517,8 @@ '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' : [ @@ -537,6 +551,8 @@ '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': [ @@ -599,6 +615,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'], @@ -650,7 +669,11 @@ # 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': { @@ -675,6 +698,11 @@ 'gn_args': 'is_asan=true', }, + 'builtins_profiling': { + 'mixins' : ['release_bot_reclient'], + 'gn_args': 'v8_enable_builtins_profiling=true', + }, + 'cfi': { 'mixins': ['v8_enable_test_features'], 'gn_args': ('is_cfi=true use_cfi_cast=true use_cfi_icall=true ' @@ -712,6 +740,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', @@ -934,6 +968,10 @@ 'gn_args': 'v8_enable_runtime_call_stats=false', }, + 'v8_disable_verify_heap': { + 'gn_args': 'v8_enable_verify_heap=false', + }, + 'v8_expose_memory_corruption_api': { 'gn_args': 'v8_expose_memory_corruption_api=true', }, @@ -946,6 +984,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', }, @@ -981,6 +1023,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', }, diff --git a/infra/testing/builders.pyl b/infra/testing/builders.pyl index d6fcb8db83..5887804e83 100644 --- a/infra/testing/builders.pyl +++ b/infra/testing/builders.pyl @@ -180,27 +180,7 @@ ], 'shards': 4, }, - {'name': 'gcmole_v2', 'variant': 'ia32'}, - {'name': 'gcmole_v2', 'variant': 'x64'}, - {'name': 'gcmole_v2', 'variant': 'arm'}, - {'name': 'gcmole_v2', 'variant': 'arm64'}, - # TODO(https://crbug.com/v8/12660): Remove v2 above after testing. {'name': 'gcmole_v3', 'variant': 'ia32', 'shards': 4}, - {'name': 'gcmole_v3', 'variant': 'x64', 'shards': 4}, - {'name': 'gcmole_v3', 'variant': 'arm', 'shards': 4}, - {'name': 'gcmole_v3', 'variant': 'arm64', '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_linux_optional_rel': { @@ -350,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}, ], }, ############################################################################## @@ -475,14 +456,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'}, # 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': { @@ -636,6 +613,20 @@ {'name': 'v8testing', 'variant': 'stress_instruction_scheduling'}, # Maglev -- move to extra once more architectures are supported. {'name': 'mjsunit', 'variant': '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': { @@ -672,6 +663,18 @@ {'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', @@ -746,6 +749,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': { @@ -838,7 +842,7 @@ # Win64 'v8_win64_asan_rel': { 'swarming_dimensions' : { - 'os': 'Windows-10-19042', + 'os': 'Windows-10-19045', }, 'tests': [ {'name': 'v8testing', 'shards': 5}, @@ -847,7 +851,7 @@ 'v8_win64_dbg': { 'swarming_dimensions' : { 'cpu': 'x86-64', - 'os': 'Windows-10-19042', + 'os': 'Windows-10-19045', }, 'tests': [ {'name': 'mozilla'}, @@ -859,7 +863,7 @@ 'v8_win64_msvc_rel': { 'swarming_dimensions' : { 'cpu': 'x86-64', - 'os': 'Windows-10-19042', + 'os': 'Windows-10-19045', }, 'tests': [ {'name': 'mozilla'}, @@ -870,7 +874,7 @@ 'v8_win64_rel': { 'swarming_dimensions' : { 'cpu': 'x86-64', - 'os': 'Windows-10-19042', + 'os': 'Windows-10-19045', }, 'tests': [ {'name': 'mozilla'}, @@ -940,6 +944,8 @@ }, 'tests': [ {'name': 'v8testing'}, + # Maglev -- move to extra once more architectures are supported. + {'name': 'mjsunit', 'variant': 'maglev'}, ], }, 'v8_mac_arm64_dbg': { @@ -950,6 +956,8 @@ }, 'tests': [ {'name': 'v8testing'}, + # Maglev -- move to extra once more architectures are supported. + {'name': 'mjsunit', 'variant': 'maglev'}, ], }, 'v8_mac_arm64_full_dbg': { @@ -960,6 +968,8 @@ }, 'tests': [ {'name': 'v8testing'}, + # Maglev -- move to extra once more architectures are supported. + {'name': 'mjsunit', 'variant': 'maglev'}, ], }, 'v8_mac_arm64_no_pointer_compression_dbg': { @@ -1089,27 +1099,7 @@ 'test_args': ['--extra-flags', '--noenable-avx'], 'shards': 2 }, - {'name': 'gcmole_v2', 'variant': 'ia32'}, - {'name': 'gcmole_v2', 'variant': 'x64'}, - {'name': 'gcmole_v2', 'variant': 'arm'}, - {'name': 'gcmole_v2', 'variant': 'arm64'}, - # TODO(https://crbug.com/v8/12660): Remove v2 above after testing. {'name': 'gcmole_v3', 'variant': 'ia32', 'shards': 4}, - {'name': 'gcmole_v3', 'variant': 'x64', 'shards': 4}, - {'name': 'gcmole_v3', 'variant': 'arm', 'shards': 4}, - {'name': 'gcmole_v3', 'variant': 'arm64', '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 Linux - arm64 - sim - CFI': { @@ -1299,6 +1289,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', @@ -1345,6 +1343,20 @@ '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': { @@ -1457,14 +1469,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'}, # 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': { @@ -1523,14 +1531,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'}, # Experimental regexp engine. {'name': 'mjsunit', 'variant': 'experimental_regexp'}, - # Wasm write protect code space. - {'name': 'mjsunit', 'variant': 'wasm_write_protect_code'}, ], }, 'V8 Linux64 gcc': { @@ -1657,6 +1661,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', @@ -1671,6 +1683,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', @@ -1797,6 +1821,8 @@ 'tests': [ {'name': 'v8testing'}, {'name': 'v8testing', 'variant': 'extra'}, + # Maglev -- move to extra once more architectures are supported. + {'name': 'mjsunit', 'variant': 'maglev'}, ], }, 'V8 Mac - arm64 - debug': { @@ -1813,6 +1839,8 @@ 'tests': [ {'name': 'v8testing', 'shards': 2}, {'name': 'v8testing', 'variant': 'extra', 'shards': 2}, + # Maglev -- move to extra once more architectures are supported. + {'name': 'mjsunit', 'variant': 'maglev'}, ], }, 'V8 Mac - arm64 - no pointer compression debug': { @@ -1879,7 +1907,7 @@ }, 'V8 Win64': { 'swarming_dimensions': { - 'os': 'Windows-10-19042', + 'os': 'Windows-10-19045', }, 'tests': [ {'name': 'mozilla'}, @@ -1890,7 +1918,7 @@ }, 'V8 Win64 - debug': { 'swarming_dimensions': { - 'os': 'Windows-10-19042', + 'os': 'Windows-10-19045', }, 'tests': [ {'name': 'mozilla'}, @@ -1901,7 +1929,7 @@ }, 'V8 Win64 - msvc': { 'swarming_dimensions': { - 'os': 'Windows-10-19042', + 'os': 'Windows-10-19045', }, 'tests': [ {'name': 'mozilla'}, @@ -1911,7 +1939,7 @@ }, 'V8 Win64 ASAN': { 'swarming_dimensions': { - 'os': 'Windows-10-19042', + 'os': 'Windows-10-19045', }, 'tests': [ {'name': 'v8testing', 'shards': 5}, @@ -2056,6 +2084,8 @@ 'test_args': ['--novfp3'], 'shards': 6 }, + # GCMole. + {'name': 'gcmole_v3', 'variant': 'arm', 'shards': 4}, ], }, 'V8 Linux - arm - sim - debug': { @@ -2137,6 +2167,7 @@ {'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': { diff --git a/src/DEPS b/src/DEPS index 8912d7fb25..ebe2dd0dc5 100644 --- a/src/DEPS +++ b/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/src/api/api-natives.cc b/src/api/api-natives.cc index d0b2987234..05a883f2d5 100644 --- a/src/api/api-natives.cc +++ b/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/src/api/api.cc b/src/api/api.cc index 3f585eedf7..07e521aeac 100644 --- a/src/api/api.cc +++ b/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" @@ -64,7 +65,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" @@ -128,7 +128,6 @@ #include "src/tracing/trace-event.h" #include "src/utils/detachable-vector.h" #include "src/utils/version.h" -#include "src/web-snapshot/web-snapshot.h" #if V8_ENABLE_WEBASSEMBLY #include "src/trap-handler/trap-handler.h" @@ -2245,42 +2244,6 @@ MaybeLocal Script::Run(Local context, } #endif auto fun = i::Handle::cast(Utils::OpenHandle(this)); - - // TODO(crbug.com/1193459): remove once ablation study is completed - base::ElapsedTimer timer; - base::TimeDelta delta; - if (i::v8_flags.script_delay > 0) { - delta = v8::base::TimeDelta::FromMillisecondsD(i::v8_flags.script_delay); - } - if (i::v8_flags.script_delay_once > 0 && !i_isolate->did_run_script_delay()) { - delta = - v8::base::TimeDelta::FromMillisecondsD(i::v8_flags.script_delay_once); - i_isolate->set_did_run_script_delay(true); - } - if (i::v8_flags.script_delay_fraction > 0.0) { - timer.Start(); - } else if (delta.InMicroseconds() > 0) { - timer.Start(); - while (timer.Elapsed() < delta) { - // Busy wait. - } - } - - if (V8_UNLIKELY(i::v8_flags.experimental_web_snapshots)) { - i::Handle maybe_script = - handle(fun->shared().script(), i_isolate); - if (maybe_script->IsScript() && - i::Script::cast(*maybe_script).type() == i::Script::TYPE_WEB_SNAPSHOT) { - i::WebSnapshotDeserializer deserializer( - reinterpret_cast(v8_isolate), - i::Handle::cast(maybe_script)); - deserializer.Deserialize(); - RETURN_ON_FAILED_EXECUTION(Value); - Local result = v8::Undefined(v8_isolate); - RETURN_ESCAPED(result); - } - } - i::Handle receiver = i_isolate->global_proxy(); // TODO(cbruni, chromium:1244145): Remove once migrated to the context. i::Handle options( @@ -2290,15 +2253,6 @@ MaybeLocal Script::Run(Local context, has_pending_exception = !ToLocal( i::Execution::CallScript(i_isolate, fun, receiver, options), &result); - if (i::v8_flags.script_delay_fraction > 0.0) { - delta = v8::base::TimeDelta::FromMillisecondsD( - timer.Elapsed().InMillisecondsF() * i::v8_flags.script_delay_fraction); - timer.Restart(); - while (timer.Elapsed() < delta) { - // Busy wait. - } - } - RETURN_ON_FAILED_EXECUTION(Value); RETURN_ESCAPED(result); } @@ -2337,6 +2291,31 @@ Local Script::GetResourceName() { i::handle(i::Script::cast(sfi.script()).name(), i_isolate)); } +std::vector Script::GetProducedCompileHints() const { + i::DisallowGarbageCollection no_gc; + i::Handle func = Utils::OpenHandle(this); + i::Isolate* i_isolate = func->GetIsolate(); + i::SharedFunctionInfo sfi = (*func).shared(); + CHECK(sfi.script().IsScript()); + i::Script script = i::Script::cast(sfi.script()); + i::Object maybe_array_list = script.compiled_lazy_function_positions(); + std::vector result; + if (!maybe_array_list.IsUndefined(i_isolate)) { + i::ArrayList array_list = i::ArrayList::cast(maybe_array_list); + result.reserve(array_list.Length()); + for (int i = 0; i < array_list.Length(); ++i) { + i::Object item = array_list.Get(i); + CHECK(item.IsSmi()); + result.push_back(i::Smi::ToInt(item)); + } + // Clear the data; the embedder can still request more data later, but it'll + // have to keep track of the original data itself. + script.set_compiled_lazy_function_positions( + i::ReadOnlyRoots(i_isolate).undefined_value()); + } + return result; +} + // static Local PrimitiveArray::New(Isolate* v8_isolate, int length) { i::Isolate* i_isolate = reinterpret_cast(v8_isolate); @@ -2759,9 +2738,10 @@ MaybeLocal