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

Side by Side Diff: src/parser.cc

Issue 245042: Remove CallEval as a subclass of the Call AST node type. We were not... (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: Created 11 years, 2 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 | Annotate | Revision Log
« no previous file with comments | « src/ia32/codegen-ia32.cc ('k') | src/prettyprinter.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 2006-2008 the V8 project authors. All rights reserved. 1 // Copyright 2006-2008 the V8 project authors. All rights reserved.
2 // Redistribution and use in source and binary forms, with or without 2 // Redistribution and use in source and binary forms, with or without
3 // modification, are permitted provided that the following conditions are 3 // modification, are permitted provided that the following conditions are
4 // met: 4 // met:
5 // 5 //
6 // * Redistributions of source code must retain the above copyright 6 // * Redistributions of source code must retain the above copyright
7 // notice, this list of conditions and the following disclaimer. 7 // notice, this list of conditions and the following disclaimer.
8 // * Redistributions in binary form must reproduce the above 8 // * Redistributions in binary form must reproduce the above
9 // copyright notice, this list of conditions and the following 9 // copyright notice, this list of conditions and the following
10 // disclaimer in the documentation and/or other materials provided 10 // disclaimer in the documentation and/or other materials provided
(...skipping 780 matching lines...) Expand 10 before | Expand all | Expand 10 after
791 return ValidLeftHandSideSentinel::instance(); 791 return ValidLeftHandSideSentinel::instance();
792 } 792 }
793 } 793 }
794 794
795 virtual Expression* NewCall(Expression* expression, 795 virtual Expression* NewCall(Expression* expression,
796 ZoneList<Expression*>* arguments, 796 ZoneList<Expression*>* arguments,
797 int pos) { 797 int pos) {
798 return Call::sentinel(); 798 return Call::sentinel();
799 } 799 }
800 800
801 virtual Expression* NewCallEval(Expression* expression,
802 ZoneList<Expression*>* arguments,
803 int pos) {
804 return CallEval::sentinel();
805 }
806
807 virtual Statement* EmptyStatement() { 801 virtual Statement* EmptyStatement() {
808 return NULL; 802 return NULL;
809 } 803 }
810 804
811 template <typename T> ZoneListWrapper<T> NewList(int size) { 805 template <typename T> ZoneListWrapper<T> NewList(int size) {
812 return is_pre_parsing_ ? ZoneListWrapper<T>() : ZoneListWrapper<T>(size); 806 return is_pre_parsing_ ? ZoneListWrapper<T>() : ZoneListWrapper<T>(size);
813 } 807 }
814 808
815 private: 809 private:
816 bool is_pre_parsing_; 810 bool is_pre_parsing_;
(...skipping 30 matching lines...) Expand all
847 virtual Expression* NewProperty(Expression* obj, Expression* key, int pos) { 841 virtual Expression* NewProperty(Expression* obj, Expression* key, int pos) {
848 return new Property(obj, key, pos); 842 return new Property(obj, key, pos);
849 } 843 }
850 844
851 virtual Expression* NewCall(Expression* expression, 845 virtual Expression* NewCall(Expression* expression,
852 ZoneList<Expression*>* arguments, 846 ZoneList<Expression*>* arguments,
853 int pos) { 847 int pos) {
854 return new Call(expression, arguments, pos); 848 return new Call(expression, arguments, pos);
855 } 849 }
856 850
857 virtual Expression* NewCallEval(Expression* expression,
858 ZoneList<Expression*>* arguments,
859 int pos) {
860 return new CallEval(expression, arguments, pos);
861 }
862
863 virtual Statement* EmptyStatement(); 851 virtual Statement* EmptyStatement();
864 }; 852 };
865 853
866 854
867 class ParserRecorder: public ParserLog { 855 class ParserRecorder: public ParserLog {
868 public: 856 public:
869 ParserRecorder(); 857 ParserRecorder();
870 virtual FunctionEntry LogFunction(int start); 858 virtual FunctionEntry LogFunction(int start);
871 virtual void LogError() { } 859 virtual void LogError() { }
872 virtual void LogMessage(Scanner::Location loc, 860 virtual void LogMessage(Scanner::Location loc,
(...skipping 2194 matching lines...) Expand 10 before | Expand all | Expand 10 after
3067 ZoneList<Expression*>* args = ParseArguments(CHECK_OK); 3055 ZoneList<Expression*>* args = ParseArguments(CHECK_OK);
3068 3056
3069 // Keep track of eval() calls since they disable all local variable 3057 // Keep track of eval() calls since they disable all local variable
3070 // optimizations. 3058 // optimizations.
3071 // The calls that need special treatment are the 3059 // The calls that need special treatment are the
3072 // direct (i.e. not aliased) eval calls. These calls are all of the 3060 // direct (i.e. not aliased) eval calls. These calls are all of the
3073 // form eval(...) with no explicit receiver object where eval is not 3061 // form eval(...) with no explicit receiver object where eval is not
3074 // declared in the current scope chain. These calls are marked as 3062 // declared in the current scope chain. These calls are marked as
3075 // potentially direct eval calls. Whether they are actually direct calls 3063 // potentially direct eval calls. Whether they are actually direct calls
3076 // to eval is determined at run time. 3064 // to eval is determined at run time.
3077
3078 bool is_potentially_direct_eval = false;
3079 if (!is_pre_parsing_) { 3065 if (!is_pre_parsing_) {
3080 VariableProxy* callee = result->AsVariableProxy(); 3066 VariableProxy* callee = result->AsVariableProxy();
3081 if (callee != NULL && callee->IsVariable(Factory::eval_symbol())) { 3067 if (callee != NULL && callee->IsVariable(Factory::eval_symbol())) {
3082 Handle<String> name = callee->name(); 3068 Handle<String> name = callee->name();
3083 Variable* var = top_scope_->Lookup(name); 3069 Variable* var = top_scope_->Lookup(name);
3084 if (var == NULL) { 3070 if (var == NULL) {
3085 top_scope_->RecordEvalCall(); 3071 top_scope_->RecordEvalCall();
3086 is_potentially_direct_eval = true;
3087 } 3072 }
3088 } 3073 }
3089 } 3074 }
3090 3075 result = factory()->NewCall(result, args, pos);
3091 if (is_potentially_direct_eval) {
3092 result = factory()->NewCallEval(result, args, pos);
3093 } else {
3094 result = factory()->NewCall(result, args, pos);
3095 }
3096 break; 3076 break;
3097 } 3077 }
3098 3078
3099 case Token::PERIOD: { 3079 case Token::PERIOD: {
3100 Consume(Token::PERIOD); 3080 Consume(Token::PERIOD);
3101 int pos = scanner().location().beg_pos; 3081 int pos = scanner().location().beg_pos;
3102 Handle<String> name = ParseIdentifier(CHECK_OK); 3082 Handle<String> name = ParseIdentifier(CHECK_OK);
3103 result = factory()->NewProperty(result, NEW(Literal(name)), pos); 3083 result = factory()->NewProperty(result, NEW(Literal(name)), pos);
3104 break; 3084 break;
3105 } 3085 }
(...skipping 1799 matching lines...) Expand 10 before | Expand all | Expand 10 after
4905 start_position, 4885 start_position,
4906 is_expression); 4886 is_expression);
4907 return result; 4887 return result;
4908 } 4888 }
4909 4889
4910 4890
4911 #undef NEW 4891 #undef NEW
4912 4892
4913 4893
4914 } } // namespace v8::internal 4894 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/ia32/codegen-ia32.cc ('k') | src/prettyprinter.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698