[gin] Add flag for eliding redundant TDZ checks in Ignition
Bug: v8:13723
Change-Id: I332215c76b5f64514ea5c8e7a9cdccf210839c47
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4523612
Commit-Queue: Shu-yu Guo <syg@chromium.org>
Reviewed-by: Adam Klein <adamk@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1142886}
diff --git a/gin/gin_features.cc b/gin/gin_features.cc
index 96714e6..fef95f01 100644
--- a/gin/gin_features.cc
+++ b/gin/gin_features.cc
@@ -152,6 +152,12 @@
"V8UseLibmTrigFunctions",
base::FEATURE_ENABLED_BY_DEFAULT);
+// Elide redundant TDZ hole checks in bytecode. This only sets the V8 flag when
+// manually overridden.
+BASE_FEATURE(kV8IgnitionElideRedundantTdzChecks,
+ "V8IgnitionElideRedundantTdzChecks",
+ base::FEATURE_ENABLED_BY_DEFAULT);
+
// JavaScript language features.
// Enables the Symbols-as-WeakMap-keys proposal.
diff --git a/gin/gin_features.h b/gin/gin_features.h
index 7399e408..e0cc3c4f 100644
--- a/gin/gin_features.h
+++ b/gin/gin_features.h
@@ -25,6 +25,7 @@
GIN_EXPORT BASE_DECLARE_FEATURE(kV8FlushBaselineCode);
GIN_EXPORT BASE_DECLARE_FEATURE(kV8FlushBytecode);
GIN_EXPORT BASE_DECLARE_FEATURE(kV8FlushEmbeddedBlobICache);
+GIN_EXPORT BASE_DECLARE_FEATURE(kV8IgnitionElideRedundantTdzChecks);
GIN_EXPORT BASE_DECLARE_FEATURE(kV8LazyFeedbackAllocation);
GIN_EXPORT BASE_DECLARE_FEATURE(kV8Maglev);
GIN_EXPORT BASE_DECLARE_FEATURE(kV8MinorMC);
diff --git a/gin/v8_initializer.cc b/gin/v8_initializer.cc
index ee54275..0ea2663 100644
--- a/gin/v8_initializer.cc
+++ b/gin/v8_initializer.cc
@@ -333,6 +333,10 @@
"--no-slow-histograms");
}
+ SetV8FlagsIfOverridden(features::kV8IgnitionElideRedundantTdzChecks,
+ "--ignition-elide-redundant-tdz-checks",
+ "--no-ignition-elide-redundant-tdz-checks");
+
// JavaScript language features.
SetV8FlagsIfOverridden(features::kJavaScriptSymbolAsWeakMapKey,
"--harmony-symbol-as-weakmap-key",