Commit c30f0930 authored by Jochen Eisinger's avatar Jochen Eisinger Committed by Commit Bot

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: 's avatarMichael Achenbach <machenbach@chromium.org>
Cr-Commit-Position: refs/heads/master@{#45677}
parent 63fd8695
...@@ -118,6 +118,10 @@ declare_args() { ...@@ -118,6 +118,10 @@ declare_args() {
v8_enable_gdbjit = ((v8_current_cpu == "x86" || v8_current_cpu == "x64" || v8_enable_gdbjit = ((v8_current_cpu == "x86" || v8_current_cpu == "x64" ||
v8_current_cpu == "x87") && (is_linux || is_mac)) || v8_current_cpu == "x87") && (is_linux || is_mac)) ||
(v8_current_cpu == "ppc64" && is_linux) (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. # Derived defaults.
...@@ -136,6 +140,9 @@ if (v8_enable_trace_maps == "") { ...@@ -136,6 +140,9 @@ if (v8_enable_trace_maps == "") {
if (v8_enable_v8_checks == "") { if (v8_enable_v8_checks == "") {
v8_enable_v8_checks = is_debug 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 # 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 # with v8 target cpu to not affect simulator builds for making cross-compile
...@@ -277,6 +284,9 @@ config("features") { ...@@ -277,6 +284,9 @@ config("features") {
if (v8_enable_concurrent_marking) { if (v8_enable_concurrent_marking) {
defines += [ "V8_CONCURRENT_MARKING" ] defines += [ "V8_CONCURRENT_MARKING" ]
} }
if (v8_check_microtasks_scopes_consistency) {
defines += [ "V8_CHECK_MICROTASKS_SCOPES_CONSISTENCY" ]
}
} }
config("toolchain") { config("toolchain") {
......
...@@ -73,6 +73,9 @@ ...@@ -73,6 +73,9 @@
# Enable/disable JavaScript API accessors. # Enable/disable JavaScript API accessors.
'v8_js_accessors%': 0, 'v8_js_accessors%': 0,
# Temporary flag to allow embedders to update their microtasks scopes.
'v8_check_microtasks_scopes_consistency%': 'false',
}, },
'target_defaults': { 'target_defaults': {
'conditions': [ 'conditions': [
...@@ -118,6 +121,9 @@ ...@@ -118,6 +121,9 @@
['dcheck_always_on!=0', { ['dcheck_always_on!=0', {
'defines': ['DEBUG',], 'defines': ['DEBUG',],
}], }],
['v8_check_microtasks_scopes_consistency=="true"', {
'defines': ['V8_CHECK_MICROTASKS_SCOPES_CONSISTENCY',],
}],
], # conditions ], # conditions
'configurations': { 'configurations': {
'DebugBaseCommon': { 'DebugBaseCommon': {
......
...@@ -43,6 +43,7 @@ ...@@ -43,6 +43,7 @@
'v8_enable_i18n_support%': 1, 'v8_enable_i18n_support%': 1,
'v8_deprecation_warnings': 1, 'v8_deprecation_warnings': 1,
'v8_imminent_deprecation_warnings': 1, 'v8_imminent_deprecation_warnings': 1,
'v8_check_microtasks_scopes_consistency': 'true',
'msvs_multi_core_compile%': '1', 'msvs_multi_core_compile%': '1',
'mac_deployment_target%': '10.7', 'mac_deployment_target%': '10.7',
'release_extra_cflags%': '', 'release_extra_cflags%': '',
......
...@@ -219,8 +219,8 @@ class InternalEscapableScope : public v8::EscapableHandleScope { ...@@ -219,8 +219,8 @@ class InternalEscapableScope : public v8::EscapableHandleScope {
: v8::EscapableHandleScope(reinterpret_cast<v8::Isolate*>(isolate)) {} : v8::EscapableHandleScope(reinterpret_cast<v8::Isolate*>(isolate)) {}
}; };
// TODO(jochen): This should be #ifdef DEBUG
#ifdef DEBUG #ifdef V8_CHECK_MICROTASKS_SCOPES_CONSISTENCY
void CheckMicrotasksScopesConsistency(i::Isolate* isolate) { void CheckMicrotasksScopesConsistency(i::Isolate* isolate) {
auto handle_scope_implementer = isolate->handle_scope_implementer(); auto handle_scope_implementer = isolate->handle_scope_implementer();
if (handle_scope_implementer->microtasks_policy() == if (handle_scope_implementer->microtasks_policy() ==
...@@ -259,7 +259,8 @@ class CallDepthScope { ...@@ -259,7 +259,8 @@ class CallDepthScope {
} }
if (!escaped_) isolate_->handle_scope_implementer()->DecrementCallDepth(); if (!escaped_) isolate_->handle_scope_implementer()->DecrementCallDepth();
if (do_callback) isolate_->FireCallCompletedCallback(); 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_); if (do_callback) CheckMicrotasksScopesConsistency(isolate_);
#endif #endif
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment