[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}
This commit is contained in:
bmeurer 2016-02-02 00:23:11 -08:00 committed by Commit bot
parent ef35f11c43
commit c4d366fb0c

View File

@ -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();