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/compiler.h" | 7 #include "src/compiler.h" |
8 #include "src/compiler/ast-loop-assignment-analyzer.h" | 8 #include "src/compiler/ast-loop-assignment-analyzer.h" |
9 #include "src/compiler/control-builders.h" | 9 #include "src/compiler/control-builders.h" |
10 #include "src/compiler/js-type-feedback.h" | 10 #include "src/compiler/js-type-feedback.h" |
(...skipping 2643 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2654 return value; | 2654 return value; |
2655 } | 2655 } |
2656 | 2656 |
2657 | 2657 |
2658 Node* AstGraphBuilder::BuildPatchReceiverToGlobalProxy(Node* receiver) { | 2658 Node* AstGraphBuilder::BuildPatchReceiverToGlobalProxy(Node* receiver) { |
2659 // Sloppy mode functions and builtins need to replace the receiver with the | 2659 // Sloppy mode functions and builtins need to replace the receiver with the |
2660 // global proxy when called as functions (without an explicit receiver | 2660 // global proxy when called as functions (without an explicit receiver |
2661 // object). Otherwise there is nothing left to do here. | 2661 // object). Otherwise there is nothing left to do here. |
2662 if (is_strict(language_mode()) || info()->is_native()) return receiver; | 2662 if (is_strict(language_mode()) || info()->is_native()) return receiver; |
2663 | 2663 |
2664 // There is no need to perform patching if the receiver will never be used. | 2664 // There is no need to perform patching if the receiver is never used. Note |
| 2665 // that scope predicates are purely syntactical, a call to eval might still |
| 2666 // inspect the receiver value. |
2665 if (!info()->MayUseThis()) return receiver; | 2667 if (!info()->MayUseThis()) return receiver; |
2666 | 2668 |
2667 IfBuilder receiver_check(this); | 2669 IfBuilder receiver_check(this); |
2668 Node* undefined = jsgraph()->UndefinedConstant(); | 2670 Node* undefined = jsgraph()->UndefinedConstant(); |
2669 Node* check = NewNode(javascript()->StrictEqual(), receiver, undefined); | 2671 Node* check = NewNode(javascript()->StrictEqual(), receiver, undefined); |
2670 receiver_check.If(check); | 2672 receiver_check.If(check); |
2671 receiver_check.Then(); | 2673 receiver_check.Then(); |
2672 Node* proxy = BuildLoadGlobalProxy(); | 2674 Node* proxy = BuildLoadGlobalProxy(); |
2673 environment()->Push(proxy); | 2675 environment()->Push(proxy); |
2674 receiver_check.Else(); | 2676 receiver_check.Else(); |
(...skipping 924 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3599 // Phi does not exist yet, introduce one. | 3601 // Phi does not exist yet, introduce one. |
3600 value = NewPhi(inputs, value, control); | 3602 value = NewPhi(inputs, value, control); |
3601 value->ReplaceInput(inputs - 1, other); | 3603 value->ReplaceInput(inputs - 1, other); |
3602 } | 3604 } |
3603 return value; | 3605 return value; |
3604 } | 3606 } |
3605 | 3607 |
3606 } // namespace compiler | 3608 } // namespace compiler |
3607 } // namespace internal | 3609 } // namespace internal |
3608 } // namespace v8 | 3610 } // namespace v8 |
OLD | NEW |