Commit c4d366fb authored by bmeurer's avatar bmeurer Committed by Commit bot

[turbofan] Optimize dynamic variable load of global constant.

Don't insert a JSLoadGlobal node in the fast case of a dynamic variable
load if the target is a global constant.

R=jarin@chromium.org

Review URL: https://codereview.chromium.org/1656223002

Cr-Commit-Position: refs/heads/master@{#33657}
parent ef35f11c
......@@ -3893,10 +3893,15 @@ Node* AstGraphBuilder::TryLoadDynamicVariable(
fast_block.BreakUnless(check, BranchHint::kTrue);
}
// Fast case, because variable is not shadowed. Perform global slot load.
Node* fast = BuildGlobalLoad(name, feedback, typeof_mode);
states.AddToNode(fast, bailout_id, combine);
environment()->Push(fast);
// Fast case, because variable is not shadowed.
if (Node* constant = TryLoadGlobalConstant(name)) {
environment()->Push(constant);
} else {
// Perform global slot load.
Node* fast = BuildGlobalLoad(name, feedback, typeof_mode);
states.AddToNode(fast, bailout_id, combine);
environment()->Push(fast);
}
slow_block.Break();
environment()->Pop();
fast_block.EndBlock();
......
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