Introduce a flag to control microtask scope consistency checking

We want to be stricter about checking in the future, so give embedders a
way to disable checking while they fix their microtasks scopes.

BUG=chromium:728583
R=machenbach@chromium.org

Change-Id: I443575bf6820b432def59cbbd4d048b2007573c8
Reviewed-on: https://chromium-review.googlesource.com/522604
Commit-Queue: Jochen Eisinger <jochen@chromium.org>
Reviewed-by: Michael Achenbach <machenbach@chromium.org>
Cr-Commit-Position: refs/heads/master@{#45677}
This commit is contained in:
Jochen Eisinger 2017-06-02 13:52:40 +02:00 committed by Commit Bot
parent 63fd8695c8
commit c30f09304a
4 changed files with 21 additions and 3 deletions

View File

@ -118,6 +118,10 @@ declare_args() {
v8_enable_gdbjit = ((v8_current_cpu == "x86" || v8_current_cpu == "x64" ||
v8_current_cpu == "x87") && (is_linux || is_mac)) ||
(v8_current_cpu == "ppc64" && is_linux)
# Temporary flag to allow embedders to update their microtasks scopes
# while rolling in a new version of V8.
v8_check_microtasks_scopes_consistency = ""
}
# Derived defaults.
@ -136,6 +140,9 @@ if (v8_enable_trace_maps == "") {
if (v8_enable_v8_checks == "") {
v8_enable_v8_checks = is_debug
}
if (v8_check_microtasks_scopes_consistency == "") {
v8_check_microtasks_scopes_consistency = is_debug || v8_enable_v8_checks
}
# Specifies if the target build is a simulator build. Comparing target cpu
# with v8 target cpu to not affect simulator builds for making cross-compile
@ -277,6 +284,9 @@ config("features") {
if (v8_enable_concurrent_marking) {
defines += [ "V8_CONCURRENT_MARKING" ]
}
if (v8_check_microtasks_scopes_consistency) {
defines += [ "V8_CHECK_MICROTASKS_SCOPES_CONSISTENCY" ]
}
}
config("toolchain") {

View File

@ -73,6 +73,9 @@
# Enable/disable JavaScript API accessors.
'v8_js_accessors%': 0,
# Temporary flag to allow embedders to update their microtasks scopes.
'v8_check_microtasks_scopes_consistency%': 'false',
},
'target_defaults': {
'conditions': [
@ -118,6 +121,9 @@
['dcheck_always_on!=0', {
'defines': ['DEBUG',],
}],
['v8_check_microtasks_scopes_consistency=="true"', {
'defines': ['V8_CHECK_MICROTASKS_SCOPES_CONSISTENCY',],
}],
], # conditions
'configurations': {
'DebugBaseCommon': {

View File

@ -43,6 +43,7 @@
'v8_enable_i18n_support%': 1,
'v8_deprecation_warnings': 1,
'v8_imminent_deprecation_warnings': 1,
'v8_check_microtasks_scopes_consistency': 'true',
'msvs_multi_core_compile%': '1',
'mac_deployment_target%': '10.7',
'release_extra_cflags%': '',

View File

@ -219,8 +219,8 @@ class InternalEscapableScope : public v8::EscapableHandleScope {
: v8::EscapableHandleScope(reinterpret_cast<v8::Isolate*>(isolate)) {}
};
#ifdef DEBUG
// TODO(jochen): This should be #ifdef DEBUG
#ifdef V8_CHECK_MICROTASKS_SCOPES_CONSISTENCY
void CheckMicrotasksScopesConsistency(i::Isolate* isolate) {
auto handle_scope_implementer = isolate->handle_scope_implementer();
if (handle_scope_implementer->microtasks_policy() ==
@ -259,7 +259,8 @@ class CallDepthScope {
}
if (!escaped_) isolate_->handle_scope_implementer()->DecrementCallDepth();
if (do_callback) isolate_->FireCallCompletedCallback();
#ifdef DEBUG
// TODO(jochen): This should be #ifdef DEBUG
#ifdef V8_CHECK_MICROTASKS_SCOPES_CONSISTENCY
if (do_callback) CheckMicrotasksScopesConsistency(isolate_);
#endif
}