OLD | NEW |
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 Loading... |
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 Loading... |
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 |
OLD | NEW |