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

Side by Side Diff: src/full-codegen/full-codegen.cc

Issue 2487483004: Only treat possible eval calls going through 'with' as special. (Closed)
Patch Set: Rebase Created 4 years, 1 month 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 | « src/compiler/ast-graph-builder.cc ('k') | src/interpreter/bytecode-generator.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2012 the V8 project authors. All rights reserved. 1 // Copyright 2012 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/full-codegen/full-codegen.h" 5 #include "src/full-codegen/full-codegen.h"
6 6
7 #include "src/ast/ast-numbering.h" 7 #include "src/ast/ast-numbering.h"
8 #include "src/ast/ast.h" 8 #include "src/ast/ast.h"
9 #include "src/ast/prettyprinter.h" 9 #include "src/ast/prettyprinter.h"
10 #include "src/ast/scopes.h" 10 #include "src/ast/scopes.h"
(...skipping 1648 matching lines...) Expand 10 before | Expand all | Expand 10 after
1659 // through this function. Avoid early returns. 1659 // through this function. Avoid early returns.
1660 expr->return_is_recorded_ = false; 1660 expr->return_is_recorded_ = false;
1661 #endif 1661 #endif
1662 1662
1663 Comment cmnt(masm_, (expr->tail_call_mode() == TailCallMode::kAllow) 1663 Comment cmnt(masm_, (expr->tail_call_mode() == TailCallMode::kAllow)
1664 ? "[ TailCall" 1664 ? "[ TailCall"
1665 : "[ Call"); 1665 : "[ Call");
1666 Expression* callee = expr->expression(); 1666 Expression* callee = expr->expression();
1667 Call::CallType call_type = expr->GetCallType(); 1667 Call::CallType call_type = expr->GetCallType();
1668 1668
1669 switch (call_type) { 1669 if (expr->is_possibly_eval()) {
1670 case Call::POSSIBLY_EVAL_CALL: 1670 EmitPossiblyEvalCall(expr);
1671 EmitPossiblyEvalCall(expr); 1671 } else {
1672 break; 1672 switch (call_type) {
1673 case Call::GLOBAL_CALL: 1673 case Call::GLOBAL_CALL:
1674 EmitCallWithLoadIC(expr); 1674 EmitCallWithLoadIC(expr);
1675 break; 1675 break;
1676 case Call::WITH_CALL: 1676 case Call::WITH_CALL:
1677 // Call to a lookup slot looked up through a with scope. 1677 // Call to a lookup slot looked up through a with scope.
1678 PushCalleeAndWithBaseObject(expr); 1678 PushCalleeAndWithBaseObject(expr);
1679 EmitCall(expr); 1679 EmitCall(expr);
1680 break; 1680 break;
1681 case Call::NAMED_PROPERTY_CALL: { 1681 case Call::NAMED_PROPERTY_CALL: {
1682 Property* property = callee->AsProperty(); 1682 Property* property = callee->AsProperty();
1683 VisitForStackValue(property->obj()); 1683 VisitForStackValue(property->obj());
1684 EmitCallWithLoadIC(expr); 1684 EmitCallWithLoadIC(expr);
1685 break; 1685 break;
1686 }
1687 case Call::KEYED_PROPERTY_CALL: {
1688 Property* property = callee->AsProperty();
1689 VisitForStackValue(property->obj());
1690 EmitKeyedCallWithLoadIC(expr, property->key());
1691 break;
1692 }
1693 case Call::NAMED_SUPER_PROPERTY_CALL:
1694 EmitSuperCallWithLoadIC(expr);
1695 break;
1696 case Call::KEYED_SUPER_PROPERTY_CALL:
1697 EmitKeyedSuperCallWithLoadIC(expr);
1698 break;
1699 case Call::SUPER_CALL:
1700 EmitSuperConstructorCall(expr);
1701 break;
1702 case Call::OTHER_CALL:
1703 // Call to an arbitrary expression not handled specially above.
1704 VisitForStackValue(callee);
1705 OperandStackDepthIncrement(1);
1706 __ PushRoot(Heap::kUndefinedValueRootIndex);
1707 // Emit function call.
1708 EmitCall(expr);
1709 break;
1686 } 1710 }
1687 case Call::KEYED_PROPERTY_CALL: {
1688 Property* property = callee->AsProperty();
1689 VisitForStackValue(property->obj());
1690 EmitKeyedCallWithLoadIC(expr, property->key());
1691 break;
1692 }
1693 case Call::NAMED_SUPER_PROPERTY_CALL:
1694 EmitSuperCallWithLoadIC(expr);
1695 break;
1696 case Call::KEYED_SUPER_PROPERTY_CALL:
1697 EmitKeyedSuperCallWithLoadIC(expr);
1698 break;
1699 case Call::SUPER_CALL:
1700 EmitSuperConstructorCall(expr);
1701 break;
1702 case Call::OTHER_CALL:
1703 // Call to an arbitrary expression not handled specially above.
1704 VisitForStackValue(callee);
1705 OperandStackDepthIncrement(1);
1706 __ PushRoot(Heap::kUndefinedValueRootIndex);
1707 // Emit function call.
1708 EmitCall(expr);
1709 break;
1710 } 1711 }
1711 1712
1712 #ifdef DEBUG 1713 #ifdef DEBUG
1713 // RecordJSReturnSite should have been called. 1714 // RecordJSReturnSite should have been called.
1714 DCHECK(expr->return_is_recorded_); 1715 DCHECK(expr->return_is_recorded_);
1715 #endif 1716 #endif
1716 } 1717 }
1717 1718
1718 void FullCodeGenerator::VisitCallRuntime(CallRuntime* expr) { 1719 void FullCodeGenerator::VisitCallRuntime(CallRuntime* expr) {
1719 ZoneList<Expression*>* args = expr->arguments(); 1720 ZoneList<Expression*>* args = expr->arguments();
(...skipping 270 matching lines...) Expand 10 before | Expand all | Expand 10 after
1990 return info_->has_simple_parameters(); 1991 return info_->has_simple_parameters();
1991 } 1992 }
1992 1993
1993 FunctionLiteral* FullCodeGenerator::literal() const { return info_->literal(); } 1994 FunctionLiteral* FullCodeGenerator::literal() const { return info_->literal(); }
1994 1995
1995 #undef __ 1996 #undef __
1996 1997
1997 1998
1998 } // namespace internal 1999 } // namespace internal
1999 } // namespace v8 2000 } // namespace v8
OLDNEW
« no previous file with comments | « src/compiler/ast-graph-builder.cc ('k') | src/interpreter/bytecode-generator.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698