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

Side by Side 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, 10 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 unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 the V8 project authors. All rights reserved. 1 // Copyright 2014 the V8 project authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "src/compiler/ast-graph-builder.h" 5 #include "src/compiler/ast-graph-builder.h"
6 6
7 #include "src/ast/scopes.h" 7 #include "src/ast/scopes.h"
8 #include "src/compiler.h" 8 #include "src/compiler.h"
9 #include "src/compiler/ast-loop-assignment-analyzer.h" 9 #include "src/compiler/ast-loop-assignment-analyzer.h"
10 #include "src/compiler/control-builders.h" 10 #include "src/compiler/control-builders.h"
(...skipping 3875 matching lines...) Expand 10 before | Expand all | Expand 10 after
3886 for (int depth = 0; bitset != 0; bitset >>= 1, depth++) { 3886 for (int depth = 0; bitset != 0; bitset >>= 1, depth++) {
3887 if ((bitset & 1) == 0) continue; 3887 if ((bitset & 1) == 0) continue;
3888 Node* load = NewNode( 3888 Node* load = NewNode(
3889 javascript()->LoadContext(depth, Context::EXTENSION_INDEX, false), 3889 javascript()->LoadContext(depth, Context::EXTENSION_INDEX, false),
3890 current_context()); 3890 current_context());
3891 Node* check = NewNode(javascript()->StrictEqual(), load, 3891 Node* check = NewNode(javascript()->StrictEqual(), load,
3892 jsgraph()->TheHoleConstant()); 3892 jsgraph()->TheHoleConstant());
3893 fast_block.BreakUnless(check, BranchHint::kTrue); 3893 fast_block.BreakUnless(check, BranchHint::kTrue);
3894 } 3894 }
3895 3895
3896 // Fast case, because variable is not shadowed. Perform global slot load. 3896 // Fast case, because variable is not shadowed.
3897 Node* fast = BuildGlobalLoad(name, feedback, typeof_mode); 3897 if (Node* constant = TryLoadGlobalConstant(name)) {
3898 states.AddToNode(fast, bailout_id, combine); 3898 environment()->Push(constant);
3899 environment()->Push(fast); 3899 } else {
3900 // Perform global slot load.
3901 Node* fast = BuildGlobalLoad(name, feedback, typeof_mode);
3902 states.AddToNode(fast, bailout_id, combine);
3903 environment()->Push(fast);
3904 }
3900 slow_block.Break(); 3905 slow_block.Break();
3901 environment()->Pop(); 3906 environment()->Pop();
3902 fast_block.EndBlock(); 3907 fast_block.EndBlock();
3903 3908
3904 // Slow case, because variable potentially shadowed. Perform dynamic lookup. 3909 // Slow case, because variable potentially shadowed. Perform dynamic lookup.
3905 const Operator* op = javascript()->LoadDynamic(name, typeof_mode); 3910 const Operator* op = javascript()->LoadDynamic(name, typeof_mode);
3906 Node* slow = NewNode(op, BuildLoadFeedbackVector(), current_context()); 3911 Node* slow = NewNode(op, BuildLoadFeedbackVector(), current_context());
3907 states.AddToNode(slow, bailout_id, combine); 3912 states.AddToNode(slow, bailout_id, combine);
3908 environment()->Push(slow); 3913 environment()->Push(slow);
3909 slow_block.EndBlock(); 3914 slow_block.EndBlock();
(...skipping 424 matching lines...) Expand 10 before | Expand all | Expand 10 after
4334 // Phi does not exist yet, introduce one. 4339 // Phi does not exist yet, introduce one.
4335 value = NewPhi(inputs, value, control); 4340 value = NewPhi(inputs, value, control);
4336 value->ReplaceInput(inputs - 1, other); 4341 value->ReplaceInput(inputs - 1, other);
4337 } 4342 }
4338 return value; 4343 return value;
4339 } 4344 }
4340 4345
4341 } // namespace compiler 4346 } // namespace compiler
4342 } // namespace internal 4347 } // namespace internal
4343 } // namespace v8 4348 } // namespace v8
OLDNEW
« 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