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 is never used. Note | 2664 // There is no need to perform patching if the receiver will never be used. |
2665 // that scope predicates are purely syntactical, a call to eval might still | |
2666 // inspect the receiver value. | |
2667 if (!info()->MayUseThis()) return receiver; | 2665 if (!info()->MayUseThis()) return receiver; |
2668 | 2666 |
2669 IfBuilder receiver_check(this); | 2667 IfBuilder receiver_check(this); |
2670 Node* undefined = jsgraph()->UndefinedConstant(); | 2668 Node* undefined = jsgraph()->UndefinedConstant(); |
2671 Node* check = NewNode(javascript()->StrictEqual(), receiver, undefined); | 2669 Node* check = NewNode(javascript()->StrictEqual(), receiver, undefined); |
2672 receiver_check.If(check); | 2670 receiver_check.If(check); |
2673 receiver_check.Then(); | 2671 receiver_check.Then(); |
2674 Node* proxy = BuildLoadGlobalProxy(); | 2672 Node* proxy = BuildLoadGlobalProxy(); |
2675 environment()->Push(proxy); | 2673 environment()->Push(proxy); |
2676 receiver_check.Else(); | 2674 receiver_check.Else(); |
(...skipping 924 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3601 // Phi does not exist yet, introduce one. | 3599 // Phi does not exist yet, introduce one. |
3602 value = NewPhi(inputs, value, control); | 3600 value = NewPhi(inputs, value, control); |
3603 value->ReplaceInput(inputs - 1, other); | 3601 value->ReplaceInput(inputs - 1, other); |
3604 } | 3602 } |
3605 return value; | 3603 return value; |
3606 } | 3604 } |
3607 | 3605 |
3608 } // namespace compiler | 3606 } // namespace compiler |
3609 } // namespace internal | 3607 } // namespace internal |
3610 } // namespace v8 | 3608 } // namespace v8 |
OLD | NEW |