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

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

Issue 2417703003: parser fuzzer and parser shell should also work in component builds (Closed)
Patch Set: updates Created 4 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
« no previous file with comments | « src/parsing/parse-info.h ('k') | src/parsing/parser.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 #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"
11 #include "src/globals.h"
10 #include "src/parsing/parser-base.h" 12 #include "src/parsing/parser-base.h"
13 #include "src/parsing/preparse-data-format.h"
11 #include "src/parsing/preparse-data.h" 14 #include "src/parsing/preparse-data.h"
12 #include "src/parsing/preparse-data-format.h"
13 #include "src/parsing/preparser.h" 15 #include "src/parsing/preparser.h"
14 #include "src/pending-compilation-error-handler.h" 16 #include "src/pending-compilation-error-handler.h"
15 17
16 namespace v8 { 18 namespace v8 {
17 19
18 class ScriptCompiler; 20 class ScriptCompiler;
19 21
20 namespace internal { 22 namespace internal {
21 23
22 class ParseInfo; 24 class ParseInfo;
(...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after
160 typedef v8::internal::BreakableStatement* BreakableStatement; 162 typedef v8::internal::BreakableStatement* BreakableStatement;
161 typedef v8::internal::IterationStatement* IterationStatement; 163 typedef v8::internal::IterationStatement* IterationStatement;
162 164
163 // For constructing objects returned by the traversing functions. 165 // For constructing objects returned by the traversing functions.
164 typedef AstNodeFactory Factory; 166 typedef AstNodeFactory Factory;
165 167
166 typedef ParserTarget Target; 168 typedef ParserTarget Target;
167 typedef ParserTargetScope TargetScope; 169 typedef ParserTargetScope TargetScope;
168 }; 170 };
169 171
170 class Parser : public ParserBase<Parser> { 172 class V8_EXPORT_PRIVATE Parser : public NON_EXPORTED_BASE(ParserBase<Parser>) {
171 public: 173 public:
172 explicit Parser(ParseInfo* info); 174 explicit Parser(ParseInfo* info);
173 ~Parser() { 175 ~Parser() {
174 delete reusable_preparser_; 176 delete reusable_preparser_;
175 reusable_preparser_ = NULL; 177 reusable_preparser_ = NULL;
176 delete cached_parse_data_; 178 delete cached_parse_data_;
177 cached_parse_data_ = NULL; 179 cached_parse_data_ = NULL;
178 } 180 }
179 181
180 // Parses the source code represented by the compilation info and sets its 182 // Parses the source code represented by the compilation info and sets its
(...skipping 913 matching lines...) Expand 10 before | Expand all | Expand 10 after
1094 1096
1095 // Other information which will be stored in Parser and moved to Isolate after 1097 // Other information which will be stored in Parser and moved to Isolate after
1096 // parsing. 1098 // parsing.
1097 int use_counts_[v8::Isolate::kUseCounterFeatureCount]; 1099 int use_counts_[v8::Isolate::kUseCounterFeatureCount];
1098 int total_preparse_skipped_; 1100 int total_preparse_skipped_;
1099 HistogramTimer* pre_parse_timer_; 1101 HistogramTimer* pre_parse_timer_;
1100 1102
1101 bool parsing_on_main_thread_; 1103 bool parsing_on_main_thread_;
1102 }; 1104 };
1103 1105
1106 // ----------------------------------------------------------------------------
1107 // Target is a support class to facilitate manipulation of the
1108 // Parser's target_stack_ (the stack of potential 'break' and
1109 // 'continue' statement targets). Upon construction, a new target is
1110 // added; it is removed upon destruction.
1111
1112 class ParserTarget BASE_EMBEDDED {
marja 2016/10/14 07:36:30 Could these now be inner classes of Parser?
jochen (gone - plz use gerrit) 2016/10/14 07:37:52 possibly? I tried to do only symbol visibility rel
1113 public:
1114 ParserTarget(ParserBase<Parser>* parser, BreakableStatement* statement)
1115 : variable_(&parser->impl()->target_stack_),
1116 statement_(statement),
1117 previous_(parser->impl()->target_stack_) {
1118 parser->impl()->target_stack_ = this;
1119 }
1120
1121 ~ParserTarget() { *variable_ = previous_; }
1122
1123 ParserTarget* previous() { return previous_; }
1124 BreakableStatement* statement() { return statement_; }
1125
1126 private:
1127 ParserTarget** variable_;
1128 BreakableStatement* statement_;
1129 ParserTarget* previous_;
1130 };
1131
1132 class ParserTargetScope BASE_EMBEDDED {
1133 public:
1134 explicit ParserTargetScope(ParserBase<Parser>* parser)
1135 : variable_(&parser->impl()->target_stack_),
1136 previous_(parser->impl()->target_stack_) {
1137 parser->impl()->target_stack_ = nullptr;
1138 }
1139
1140 ~ParserTargetScope() { *variable_ = previous_; }
1141
1142 private:
1143 ParserTarget** variable_;
1144 ParserTarget* previous_;
1145 };
1146
1104 } // namespace internal 1147 } // namespace internal
1105 } // namespace v8 1148 } // namespace v8
1106 1149
1107 #endif // V8_PARSING_PARSER_H_ 1150 #endif // V8_PARSING_PARSER_H_
OLDNEW
« no previous file with comments | « src/parsing/parse-info.h ('k') | src/parsing/parser.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698