Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(350)

Unified Diff: src/compiler/ast-graph-builder.cc

Issue 1656223002: [turbofan] Optimize dynamic variable load of global constant. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 4 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/compiler/ast-graph-builder.cc
diff --git a/src/compiler/ast-graph-builder.cc b/src/compiler/ast-graph-builder.cc
index 61c433821aae88837d34064bb3782e30f95b8d81..77ad611b70c8d49da7804dfdf381bb15f09ec086 100644
--- a/src/compiler/ast-graph-builder.cc
+++ b/src/compiler/ast-graph-builder.cc
@@ -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();
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698