Commit 1b44afe5 authored by cbruni's avatar cbruni Committed by Commit bot

Reland of Avoid Context::Enter and Context::Exit if we're reentering the...

Reland of Avoid Context::Enter and Context::Exit if we're reentering the active and last entered context (patchset #1 id:1 of https://codereview.chromium.org/2140563002/ )

Reason for reland:
https://codereview.chromium.org/2122953002 fixed context issues.

Original issue's description:
> Revert of Avoid Context::Enter and Context::Exit if we're reentering the active and last entered context (patchset #2 id:20001 of https://codereview.chromium.org/2131483002/ )
>
> Reason for revert:
> crashes: crbug.com/626719
>
> Original issue's description:
> > Avoid Context::Enter and Context::Exit if we're reentering the active and last entered context
> >
> > A bit of browsing around indicates that the new fast-path is taken most of the time:
> >    3496 Entering new
> >  152295 Reentering same
> >
> > BUG=
> >
> > Committed: https://crrev.com/1829eb661ef1cf432fb551bcb193f521a219d490
> > Cr-Commit-Position: refs/heads/master@{#37570}
>
> TBR=jochen@chromium.org,verwaest@chromium.org
> # Not skipping CQ checks because original CL landed more than 1 days ago.
> BUG=
>
> Committed: https://crrev.com/bec49a4876fdf8a20600ecdfc8534d0ef45c9528
> Cr-Commit-Position: refs/heads/master@{#37632}

TBR=jochen@chromium.org,verwaest@chromium.org,jkummerow@chromium.org
# Not skipping CQ checks because original CL landed more than 1 days ago.
BUG=

Review-Url: https://codereview.chromium.org/2152803003
Cr-Commit-Position: refs/heads/master@{#37778}
parent ca25c845
......@@ -183,7 +183,17 @@ class CallDepthScope {
DCHECK(!isolate_->external_caught_exception());
isolate_->IncrementJsCallsFromApiCounter();
isolate_->handle_scope_implementer()->IncrementCallDepth();
if (!context_.IsEmpty()) context_->Enter();
if (!context.IsEmpty()) {
i::Handle<i::Context> env = Utils::OpenHandle(*context);
i::HandleScopeImplementer* impl = isolate->handle_scope_implementer();
if (isolate->context() != nullptr &&
isolate->context()->native_context() == env->native_context() &&
impl->LastEnteredContextWas(env)) {
context_ = Local<Context>();
} else {
context_->Enter();
}
}
if (do_callback_) isolate_->FireBeforeCallEnteredCallback();
}
~CallDepthScope() {
......
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