Commit c21f952d authored by Mythri's avatar Mythri Committed by Commit Bot

Return early if the context is strict when inferring the language mode

If the context is in strict mode, then we can avoid iterating the
stack since we cannot go stricter than that.

Bug: chromium:925289
Change-Id: I422176c85f2dfd9176a60bc7c3a7674f96238bd0
Reviewed-on: https://chromium-review.googlesource.com/c/1439396Reviewed-by: 's avatarToon Verwaest <verwaest@chromium.org>
Commit-Queue: Mythri Alle <mythria@chromium.org>
Cr-Commit-Position: refs/heads/master@{#59130}
parent ed157248
......@@ -128,6 +128,8 @@ ShouldThrow GetShouldThrow(Isolate* isolate, Maybe<ShouldThrow> should_throw) {
if (should_throw.IsJust()) return should_throw.FromJust();
LanguageMode mode = isolate->context()->scope_info()->language_mode();
if (mode == LanguageMode::kStrict) return kThrowOnError;
for (StackFrameIterator it(isolate); !it.done(); it.Advance()) {
if (!(it.frame()->is_optimized() || it.frame()->is_interpreted())) {
continue;
......
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