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

Side by Side Diff: src/parsing/parser.h

Issue 2156303002: Implement new Function.prototype.toString and fix CreateDynamicFunction parsing (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: fix async function constructor 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
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 #ifndef V8_PARSING_PARSER_H_ 5 #ifndef V8_PARSING_PARSER_H_
6 #define V8_PARSING_PARSER_H_ 6 #define V8_PARSING_PARSER_H_
7 7
8 #include "src/ast/ast.h" 8 #include "src/ast/ast.h"
9 #include "src/ast/scopes.h" 9 #include "src/ast/scopes.h"
10 #include "src/base/compiler-specific.h" 10 #include "src/base/compiler-specific.h"
(...skipping 1060 matching lines...) Expand 10 before | Expand all | Expand 10 after
1071 } 1071 }
1072 1072
1073 V8_INLINE ZoneList<Expression*>* GetNonPatternList() const { 1073 V8_INLINE ZoneList<Expression*>* GetNonPatternList() const {
1074 return function_state_->non_patterns_to_rewrite(); 1074 return function_state_->non_patterns_to_rewrite();
1075 } 1075 }
1076 1076
1077 V8_INLINE void CountUsage(v8::Isolate::UseCounterFeature feature) { 1077 V8_INLINE void CountUsage(v8::Isolate::UseCounterFeature feature) {
1078 ++use_counts_[feature]; 1078 ++use_counts_[feature];
1079 } 1079 }
1080 1080
1081 // Returns true iff we're parsing the first function literal during
1082 // CreateDynamicFunction().
1083 V8_INLINE bool IgnoreFunctionName() const {
1084 return parameters_end_pos_ != kNoSourcePosition;
1085 }
1086
1081 // Parser's private field members. 1087 // Parser's private field members.
1082 friend class DiscardableZoneScope; // Uses reusable_preparser_. 1088 friend class DiscardableZoneScope; // Uses reusable_preparser_.
1083 // FIXME(marja): Make reusable_preparser_ always use its own temp Zone (call 1089 // FIXME(marja): Make reusable_preparser_ always use its own temp Zone (call
1084 // DeleteAll after each function), so this won't be needed. 1090 // DeleteAll after each function), so this won't be needed.
1085 1091
1086 Scanner scanner_; 1092 Scanner scanner_;
1087 PreParser* reusable_preparser_; 1093 PreParser* reusable_preparser_;
1088 Scope* original_scope_; // for ES5 function declarations in sloppy eval 1094 Scope* original_scope_; // for ES5 function declarations in sloppy eval
1089 1095
1090 friend class ParserTarget; 1096 friend class ParserTarget;
1091 friend class ParserTargetScope; 1097 friend class ParserTargetScope;
1092 ParserTarget* target_stack_; // for break, continue statements 1098 ParserTarget* target_stack_; // for break, continue statements
1093 1099
1094 ScriptCompiler::CompileOptions compile_options_; 1100 ScriptCompiler::CompileOptions compile_options_;
1095 ParseData* cached_parse_data_; 1101 ParseData* cached_parse_data_;
1096 1102
1097 PendingCompilationErrorHandler pending_error_handler_; 1103 PendingCompilationErrorHandler pending_error_handler_;
1098 1104
1099 // Other information which will be stored in Parser and moved to Isolate after 1105 // Other information which will be stored in Parser and moved to Isolate after
1100 // parsing. 1106 // parsing.
1101 int use_counts_[v8::Isolate::kUseCounterFeatureCount]; 1107 int use_counts_[v8::Isolate::kUseCounterFeatureCount];
1102 int total_preparse_skipped_; 1108 int total_preparse_skipped_;
1103 1109
1110 // If not kNoSourcePosition, indicates that the first function literal
1111 // encountered is a dynamic function, see CreateDynamicFunction(). This field
1112 // indicates the correct position of the ')' that closes the parameter list.
1113 // After that ')' is encountered, this field is reset to kNoSourcePosition.
1114 int parameters_end_pos_;
1115
1104 bool parsing_on_main_thread_; 1116 bool parsing_on_main_thread_;
1105 }; 1117 };
1106 1118
1107 // ---------------------------------------------------------------------------- 1119 // ----------------------------------------------------------------------------
1108 // Target is a support class to facilitate manipulation of the 1120 // Target is a support class to facilitate manipulation of the
1109 // Parser's target_stack_ (the stack of potential 'break' and 1121 // Parser's target_stack_ (the stack of potential 'break' and
1110 // 'continue' statement targets). Upon construction, a new target is 1122 // 'continue' statement targets). Upon construction, a new target is
1111 // added; it is removed upon destruction. 1123 // added; it is removed upon destruction.
1112 1124
1113 class ParserTarget BASE_EMBEDDED { 1125 class ParserTarget BASE_EMBEDDED {
(...skipping 28 matching lines...) Expand all
1142 1154
1143 private: 1155 private:
1144 ParserTarget** variable_; 1156 ParserTarget** variable_;
1145 ParserTarget* previous_; 1157 ParserTarget* previous_;
1146 }; 1158 };
1147 1159
1148 } // namespace internal 1160 } // namespace internal
1149 } // namespace v8 1161 } // namespace v8
1150 1162
1151 #endif // V8_PARSING_PARSER_H_ 1163 #endif // V8_PARSING_PARSER_H_
OLDNEW
« src/objects.cc ('K') | « src/parsing/parse-info.cc ('k') | src/parsing/parser.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698