yangguo@chromium.org | ab30bb8 | 2012-02-24 14:41:46 +0000 | [diff] [blame] | 1 | // Copyright 2012 the V8 project authors. All rights reserved. |
lrn@chromium.org | fa943b7 | 2010-11-03 08:14:36 +0000 | [diff] [blame] | 2 | // Redistribution and use in source and binary forms, with or without |
| 3 | // modification, are permitted provided that the following conditions are |
| 4 | // met: |
| 5 | // |
| 6 | // * Redistributions of source code must retain the above copyright |
| 7 | // notice, this list of conditions and the following disclaimer. |
| 8 | // * Redistributions in binary form must reproduce the above |
| 9 | // copyright notice, this list of conditions and the following |
| 10 | // disclaimer in the documentation and/or other materials provided |
| 11 | // with the distribution. |
| 12 | // * Neither the name of Google Inc. nor the names of its |
| 13 | // contributors may be used to endorse or promote products derived |
| 14 | // from this software without specific prior written permission. |
| 15 | // |
| 16 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS |
| 17 | // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT |
| 18 | // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR |
| 19 | // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT |
| 20 | // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, |
| 21 | // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT |
| 22 | // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
| 23 | // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
| 24 | // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
| 25 | // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
| 26 | // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| 27 | |
| 28 | #ifndef V8_PREPARSER_H |
| 29 | #define V8_PREPARSER_H |
| 30 | |
yangguo@chromium.org | ab30bb8 | 2012-02-24 14:41:46 +0000 | [diff] [blame] | 31 | #include "hashmap.h" |
ricow@chromium.org | 55ee807 | 2011-09-08 16:33:10 +0000 | [diff] [blame] | 32 | #include "token.h" |
| 33 | #include "scanner.h" |
| 34 | |
lrn@chromium.org | fa943b7 | 2010-11-03 08:14:36 +0000 | [diff] [blame] | 35 | namespace v8 { |
ricow@chromium.org | 55ee807 | 2011-09-08 16:33:10 +0000 | [diff] [blame] | 36 | |
| 37 | namespace internal { |
| 38 | class UnicodeCache; |
| 39 | } |
| 40 | |
lrn@chromium.org | fa943b7 | 2010-11-03 08:14:36 +0000 | [diff] [blame] | 41 | namespace preparser { |
| 42 | |
ricow@chromium.org | 55ee807 | 2011-09-08 16:33:10 +0000 | [diff] [blame] | 43 | typedef uint8_t byte; |
| 44 | |
lrn@chromium.org | fa943b7 | 2010-11-03 08:14:36 +0000 | [diff] [blame] | 45 | // Preparsing checks a JavaScript program and emits preparse-data that helps |
| 46 | // a later parsing to be faster. |
lrn@chromium.org | 1c09276 | 2011-05-09 09:42:16 +0000 | [diff] [blame] | 47 | // See preparse-data-format.h for the data format. |
lrn@chromium.org | fa943b7 | 2010-11-03 08:14:36 +0000 | [diff] [blame] | 48 | |
| 49 | // The PreParser checks that the syntax follows the grammar for JavaScript, |
| 50 | // and collects some information about the program along the way. |
| 51 | // The grammar check is only performed in order to understand the program |
| 52 | // sufficiently to deduce some information about it, that can be used |
| 53 | // to speed up later parsing. Finding errors is not the goal of pre-parsing, |
| 54 | // rather it is to speed up properly written and correct programs. |
| 55 | // That means that contextual checks (like a label being declared where |
| 56 | // it is used) are generally omitted. |
| 57 | |
whesse@chromium.org | f0ac72d | 2010-11-08 12:47:26 +0000 | [diff] [blame] | 58 | namespace i = v8::internal; |
| 59 | |
ricow@chromium.org | 55ee807 | 2011-09-08 16:33:10 +0000 | [diff] [blame] | 60 | class DuplicateFinder { |
| 61 | public: |
| 62 | explicit DuplicateFinder(i::UnicodeCache* constants) |
| 63 | : unicode_constants_(constants), |
| 64 | backing_store_(16), |
| 65 | map_(&Match) { } |
| 66 | |
| 67 | int AddAsciiSymbol(i::Vector<const char> key, int value); |
yangguo@chromium.org | 154ff99 | 2012-03-13 08:09:54 +0000 | [diff] [blame] | 68 | int AddUtf16Symbol(i::Vector<const uint16_t> key, int value); |
ricow@chromium.org | 55ee807 | 2011-09-08 16:33:10 +0000 | [diff] [blame] | 69 | // Add a a number literal by converting it (if necessary) |
| 70 | // to the string that ToString(ToNumber(literal)) would generate. |
| 71 | // and then adding that string with AddAsciiSymbol. |
| 72 | // This string is the actual value used as key in an object literal, |
| 73 | // and the one that must be different from the other keys. |
| 74 | int AddNumber(i::Vector<const char> key, int value); |
| 75 | |
| 76 | private: |
| 77 | int AddSymbol(i::Vector<const byte> key, bool is_ascii, int value); |
| 78 | // Backs up the key and its length in the backing store. |
| 79 | // The backup is stored with a base 127 encoding of the |
| 80 | // length (plus a bit saying whether the string is ASCII), |
| 81 | // followed by the bytes of the key. |
| 82 | byte* BackupKey(i::Vector<const byte> key, bool is_ascii); |
| 83 | |
| 84 | // Compare two encoded keys (both pointing into the backing store) |
| 85 | // for having the same base-127 encoded lengths and ASCII-ness, |
| 86 | // and then having the same 'length' bytes following. |
| 87 | static bool Match(void* first, void* second); |
| 88 | // Creates a hash from a sequence of bytes. |
| 89 | static uint32_t Hash(i::Vector<const byte> key, bool is_ascii); |
| 90 | // Checks whether a string containing a JS number is its canonical |
| 91 | // form. |
| 92 | static bool IsNumberCanonical(i::Vector<const char> key); |
| 93 | |
| 94 | // Size of buffer. Sufficient for using it to call DoubleToCString in |
| 95 | // from conversions.h. |
| 96 | static const int kBufferSize = 100; |
| 97 | |
| 98 | i::UnicodeCache* unicode_constants_; |
| 99 | // Backing store used to store strings used as hashmap keys. |
| 100 | i::SequenceCollector<unsigned char> backing_store_; |
| 101 | i::HashMap map_; |
| 102 | // Buffer used for string->number->canonical string conversions. |
| 103 | char number_buffer_[kBufferSize]; |
| 104 | }; |
| 105 | |
| 106 | |
mstarzinger@chromium.org | f705b50 | 2013-04-04 11:38:09 +0000 | [diff] [blame] | 107 | #ifdef WIN32 |
| 108 | #undef Yield |
| 109 | #endif |
| 110 | |
| 111 | |
lrn@chromium.org | fa943b7 | 2010-11-03 08:14:36 +0000 | [diff] [blame] | 112 | class PreParser { |
| 113 | public: |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 114 | enum PreParseResult { |
| 115 | kPreParseStackOverflow, |
| 116 | kPreParseSuccess |
| 117 | }; |
| 118 | |
mstarzinger@chromium.org | 1b3afd1 | 2011-11-29 14:28:56 +0000 | [diff] [blame] | 119 | |
| 120 | PreParser(i::Scanner* scanner, |
| 121 | i::ParserRecorder* log, |
mstarzinger@chromium.org | e27d617 | 2013-04-17 11:51:44 +0000 | [diff] [blame] | 122 | uintptr_t stack_limit) |
mstarzinger@chromium.org | 1b3afd1 | 2011-11-29 14:28:56 +0000 | [diff] [blame] | 123 | : scanner_(scanner), |
| 124 | log_(log), |
| 125 | scope_(NULL), |
| 126 | stack_limit_(stack_limit), |
| 127 | strict_mode_violation_location_(i::Scanner::Location::invalid()), |
| 128 | strict_mode_violation_type_(NULL), |
| 129 | stack_overflow_(false), |
mstarzinger@chromium.org | e27d617 | 2013-04-17 11:51:44 +0000 | [diff] [blame] | 130 | allow_lazy_(false), |
| 131 | allow_natives_syntax_(false), |
| 132 | allow_generators_(false), |
danno@chromium.org | 1fd77d5 | 2013-06-07 16:01:45 +0000 | [diff] [blame] | 133 | allow_for_of_(false), |
mstarzinger@chromium.org | e27d617 | 2013-04-17 11:51:44 +0000 | [diff] [blame] | 134 | parenthesized_function_(false) { } |
mstarzinger@chromium.org | 1b3afd1 | 2011-11-29 14:28:56 +0000 | [diff] [blame] | 135 | |
ricow@chromium.org | 55ee807 | 2011-09-08 16:33:10 +0000 | [diff] [blame] | 136 | ~PreParser() {} |
lrn@chromium.org | fa943b7 | 2010-11-03 08:14:36 +0000 | [diff] [blame] | 137 | |
mstarzinger@chromium.org | e27d617 | 2013-04-17 11:51:44 +0000 | [diff] [blame] | 138 | bool allow_natives_syntax() const { return allow_natives_syntax_; } |
| 139 | bool allow_lazy() const { return allow_lazy_; } |
| 140 | bool allow_modules() const { return scanner_->HarmonyModules(); } |
| 141 | bool allow_harmony_scoping() const { return scanner_->HarmonyScoping(); } |
| 142 | bool allow_generators() const { return allow_generators_; } |
danno@chromium.org | 1fd77d5 | 2013-06-07 16:01:45 +0000 | [diff] [blame] | 143 | bool allow_for_of() const { return allow_for_of_; } |
mstarzinger@chromium.org | e27d617 | 2013-04-17 11:51:44 +0000 | [diff] [blame] | 144 | |
| 145 | void set_allow_natives_syntax(bool allow) { allow_natives_syntax_ = allow; } |
| 146 | void set_allow_lazy(bool allow) { allow_lazy_ = allow; } |
| 147 | void set_allow_modules(bool allow) { scanner_->SetHarmonyModules(allow); } |
| 148 | void set_allow_harmony_scoping(bool allow) { |
| 149 | scanner_->SetHarmonyScoping(allow); |
| 150 | } |
| 151 | void set_allow_generators(bool allow) { allow_generators_ = allow; } |
danno@chromium.org | 1fd77d5 | 2013-06-07 16:01:45 +0000 | [diff] [blame] | 152 | void set_allow_for_of(bool allow) { allow_for_of_ = allow; } |
mstarzinger@chromium.org | e27d617 | 2013-04-17 11:51:44 +0000 | [diff] [blame] | 153 | |
lrn@chromium.org | fa943b7 | 2010-11-03 08:14:36 +0000 | [diff] [blame] | 154 | // Pre-parse the program from the character stream; returns true on |
| 155 | // success (even if parsing failed, the pre-parse data successfully |
| 156 | // captured the syntax error), and false if a stack-overflow happened |
| 157 | // during parsing. |
mstarzinger@chromium.org | e27d617 | 2013-04-17 11:51:44 +0000 | [diff] [blame] | 158 | PreParseResult PreParseProgram() { |
| 159 | Scope top_scope(&scope_, kTopLevelScope); |
| 160 | bool ok = true; |
| 161 | int start_position = scanner_->peek_location().beg_pos; |
| 162 | ParseSourceElements(i::Token::EOS, &ok); |
| 163 | if (stack_overflow_) return kPreParseStackOverflow; |
| 164 | if (!ok) { |
| 165 | ReportUnexpectedToken(scanner_->current_token()); |
| 166 | } else if (!scope_->is_classic_mode()) { |
| 167 | CheckOctalLiteral(start_position, scanner_->location().end_pos, &ok); |
| 168 | } |
| 169 | return kPreParseSuccess; |
lrn@chromium.org | fa943b7 | 2010-11-03 08:14:36 +0000 | [diff] [blame] | 170 | } |
| 171 | |
mstarzinger@chromium.org | 1b3afd1 | 2011-11-29 14:28:56 +0000 | [diff] [blame] | 172 | // Parses a single function literal, from the opening parentheses before |
| 173 | // parameters to the closing brace after the body. |
rossberg@chromium.org | cddc71f | 2012-12-07 12:40:13 +0000 | [diff] [blame] | 174 | // Returns a FunctionEntry describing the body of the function in enough |
mstarzinger@chromium.org | 1b3afd1 | 2011-11-29 14:28:56 +0000 | [diff] [blame] | 175 | // detail that it can be lazily compiled. |
mstarzinger@chromium.org | f705b50 | 2013-04-04 11:38:09 +0000 | [diff] [blame] | 176 | // The scanner is expected to have matched the "function" or "function*" |
| 177 | // keyword and parameters, and have consumed the initial '{'. |
rossberg@chromium.org | cddc71f | 2012-12-07 12:40:13 +0000 | [diff] [blame] | 178 | // At return, unless an error occurred, the scanner is positioned before the |
mstarzinger@chromium.org | 1b3afd1 | 2011-11-29 14:28:56 +0000 | [diff] [blame] | 179 | // the final '}'. |
| 180 | PreParseResult PreParseLazyFunction(i::LanguageMode mode, |
mstarzinger@chromium.org | f705b50 | 2013-04-04 11:38:09 +0000 | [diff] [blame] | 181 | bool is_generator, |
mstarzinger@chromium.org | 1b3afd1 | 2011-11-29 14:28:56 +0000 | [diff] [blame] | 182 | i::ParserRecorder* log); |
| 183 | |
lrn@chromium.org | fa943b7 | 2010-11-03 08:14:36 +0000 | [diff] [blame] | 184 | private: |
ricow@chromium.org | 55ee807 | 2011-09-08 16:33:10 +0000 | [diff] [blame] | 185 | // Used to detect duplicates in object literals. Each of the values |
| 186 | // kGetterProperty, kSetterProperty and kValueProperty represents |
| 187 | // a type of object literal property. When parsing a property, its |
| 188 | // type value is stored in the DuplicateFinder for the property name. |
| 189 | // Values are chosen so that having intersection bits means the there is |
| 190 | // an incompatibility. |
| 191 | // I.e., you can add a getter to a property that already has a setter, since |
| 192 | // kGetterProperty and kSetterProperty doesn't intersect, but not if it |
| 193 | // already has a getter or a value. Adding the getter to an existing |
| 194 | // setter will store the value (kGetterProperty | kSetterProperty), which |
| 195 | // is incompatible with adding any further properties. |
| 196 | enum PropertyType { |
| 197 | kNone = 0, |
| 198 | // Bit patterns representing different object literal property types. |
| 199 | kGetterProperty = 1, |
| 200 | kSetterProperty = 2, |
| 201 | kValueProperty = 7, |
| 202 | // Helper constants. |
| 203 | kValueFlag = 4 |
| 204 | }; |
| 205 | |
| 206 | // Checks the type of conflict based on values coming from PropertyType. |
| 207 | bool HasConflict(int type1, int type2) { return (type1 & type2) != 0; } |
| 208 | bool IsDataDataConflict(int type1, int type2) { |
| 209 | return ((type1 & type2) & kValueFlag) != 0; |
| 210 | } |
| 211 | bool IsDataAccessorConflict(int type1, int type2) { |
| 212 | return ((type1 ^ type2) & kValueFlag) != 0; |
| 213 | } |
| 214 | bool IsAccessorAccessorConflict(int type1, int type2) { |
| 215 | return ((type1 | type2) & kValueFlag) == 0; |
| 216 | } |
| 217 | |
| 218 | |
| 219 | void CheckDuplicate(DuplicateFinder* finder, |
| 220 | i::Token::Value property, |
| 221 | int type, |
| 222 | bool* ok); |
| 223 | |
ager@chromium.org | ea91cc5 | 2011-05-23 06:06:11 +0000 | [diff] [blame] | 224 | // These types form an algebra over syntactic categories that is just |
| 225 | // rich enough to let us recognize and propagate the constructs that |
| 226 | // are either being counted in the preparser data, or is important |
| 227 | // to throw the correct syntax error exceptions. |
| 228 | |
lrn@chromium.org | fa943b7 | 2010-11-03 08:14:36 +0000 | [diff] [blame] | 229 | enum ScopeType { |
| 230 | kTopLevelScope, |
| 231 | kFunctionScope |
| 232 | }; |
| 233 | |
danno@chromium.org | b645116 | 2011-08-17 14:33:23 +0000 | [diff] [blame] | 234 | enum VariableDeclarationContext { |
| 235 | kSourceElement, |
| 236 | kStatement, |
| 237 | kForStatement |
| 238 | }; |
| 239 | |
erik.corry@gmail.com | 394dbcf | 2011-10-27 07:38:48 +0000 | [diff] [blame] | 240 | // If a list of variable declarations includes any initializers. |
| 241 | enum VariableDeclarationProperties { |
| 242 | kHasInitializers, |
| 243 | kHasNoInitializers |
| 244 | }; |
| 245 | |
ager@chromium.org | ea91cc5 | 2011-05-23 06:06:11 +0000 | [diff] [blame] | 246 | class Expression; |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 247 | |
ager@chromium.org | ea91cc5 | 2011-05-23 06:06:11 +0000 | [diff] [blame] | 248 | class Identifier { |
| 249 | public: |
| 250 | static Identifier Default() { |
| 251 | return Identifier(kUnknownIdentifier); |
| 252 | } |
| 253 | static Identifier Eval() { |
| 254 | return Identifier(kEvalIdentifier); |
| 255 | } |
| 256 | static Identifier Arguments() { |
| 257 | return Identifier(kArgumentsIdentifier); |
| 258 | } |
| 259 | static Identifier FutureReserved() { |
| 260 | return Identifier(kFutureReservedIdentifier); |
| 261 | } |
ager@chromium.org | 04921a8 | 2011-06-27 13:21:41 +0000 | [diff] [blame] | 262 | static Identifier FutureStrictReserved() { |
| 263 | return Identifier(kFutureStrictReservedIdentifier); |
| 264 | } |
mstarzinger@chromium.org | f705b50 | 2013-04-04 11:38:09 +0000 | [diff] [blame] | 265 | static Identifier Yield() { |
| 266 | return Identifier(kYieldIdentifier); |
| 267 | } |
ager@chromium.org | ea91cc5 | 2011-05-23 06:06:11 +0000 | [diff] [blame] | 268 | bool IsEval() { return type_ == kEvalIdentifier; } |
| 269 | bool IsArguments() { return type_ == kArgumentsIdentifier; } |
| 270 | bool IsEvalOrArguments() { return type_ >= kEvalIdentifier; } |
mstarzinger@chromium.org | f705b50 | 2013-04-04 11:38:09 +0000 | [diff] [blame] | 271 | bool IsYield() { return type_ == kYieldIdentifier; } |
ager@chromium.org | ea91cc5 | 2011-05-23 06:06:11 +0000 | [diff] [blame] | 272 | bool IsFutureReserved() { return type_ == kFutureReservedIdentifier; } |
ager@chromium.org | 04921a8 | 2011-06-27 13:21:41 +0000 | [diff] [blame] | 273 | bool IsFutureStrictReserved() { |
| 274 | return type_ == kFutureStrictReservedIdentifier; |
| 275 | } |
ager@chromium.org | ea91cc5 | 2011-05-23 06:06:11 +0000 | [diff] [blame] | 276 | bool IsValidStrictVariable() { return type_ == kUnknownIdentifier; } |
jkummerow@chromium.org | e297f59 | 2011-06-08 10:05:15 +0000 | [diff] [blame] | 277 | |
ager@chromium.org | ea91cc5 | 2011-05-23 06:06:11 +0000 | [diff] [blame] | 278 | private: |
| 279 | enum Type { |
| 280 | kUnknownIdentifier, |
| 281 | kFutureReservedIdentifier, |
ager@chromium.org | 04921a8 | 2011-06-27 13:21:41 +0000 | [diff] [blame] | 282 | kFutureStrictReservedIdentifier, |
mstarzinger@chromium.org | f705b50 | 2013-04-04 11:38:09 +0000 | [diff] [blame] | 283 | kYieldIdentifier, |
ager@chromium.org | ea91cc5 | 2011-05-23 06:06:11 +0000 | [diff] [blame] | 284 | kEvalIdentifier, |
| 285 | kArgumentsIdentifier |
| 286 | }; |
| 287 | explicit Identifier(Type type) : type_(type) { } |
| 288 | Type type_; |
| 289 | |
| 290 | friend class Expression; |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 291 | }; |
| 292 | |
ager@chromium.org | ea91cc5 | 2011-05-23 06:06:11 +0000 | [diff] [blame] | 293 | // Bits 0 and 1 are used to identify the type of expression: |
| 294 | // If bit 0 is set, it's an identifier. |
| 295 | // if bit 1 is set, it's a string literal. |
| 296 | // If neither is set, it's no particular type, and both set isn't |
| 297 | // use yet. |
| 298 | // Bit 2 is used to mark the expression as being parenthesized, |
| 299 | // so "(foo)" isn't recognized as a pure identifier (and possible label). |
| 300 | class Expression { |
| 301 | public: |
| 302 | static Expression Default() { |
| 303 | return Expression(kUnknownExpression); |
| 304 | } |
| 305 | |
| 306 | static Expression FromIdentifier(Identifier id) { |
| 307 | return Expression(kIdentifierFlag | (id.type_ << kIdentifierShift)); |
| 308 | } |
| 309 | |
| 310 | static Expression StringLiteral() { |
| 311 | return Expression(kUnknownStringLiteral); |
| 312 | } |
| 313 | |
| 314 | static Expression UseStrictStringLiteral() { |
| 315 | return Expression(kUseStrictString); |
| 316 | } |
| 317 | |
| 318 | static Expression This() { |
| 319 | return Expression(kThisExpression); |
| 320 | } |
| 321 | |
| 322 | static Expression ThisProperty() { |
| 323 | return Expression(kThisPropertyExpression); |
| 324 | } |
| 325 | |
| 326 | static Expression StrictFunction() { |
| 327 | return Expression(kStrictFunctionExpression); |
| 328 | } |
| 329 | |
| 330 | bool IsIdentifier() { |
| 331 | return (code_ & kIdentifierFlag) != 0; |
| 332 | } |
| 333 | |
| 334 | // Only works corretly if it is actually an identifier expression. |
| 335 | PreParser::Identifier AsIdentifier() { |
| 336 | return PreParser::Identifier( |
| 337 | static_cast<PreParser::Identifier::Type>(code_ >> kIdentifierShift)); |
| 338 | } |
| 339 | |
| 340 | bool IsParenthesized() { |
| 341 | // If bit 0 or 1 is set, we interpret bit 2 as meaning parenthesized. |
| 342 | return (code_ & 7) > 4; |
| 343 | } |
| 344 | |
| 345 | bool IsRawIdentifier() { |
| 346 | return !IsParenthesized() && IsIdentifier(); |
| 347 | } |
| 348 | |
| 349 | bool IsStringLiteral() { return (code_ & kStringLiteralFlag) != 0; } |
| 350 | |
| 351 | bool IsRawStringLiteral() { |
| 352 | return !IsParenthesized() && IsStringLiteral(); |
| 353 | } |
| 354 | |
| 355 | bool IsUseStrictLiteral() { |
| 356 | return (code_ & kStringLiteralMask) == kUseStrictString; |
| 357 | } |
| 358 | |
| 359 | bool IsThis() { |
| 360 | return code_ == kThisExpression; |
| 361 | } |
| 362 | |
| 363 | bool IsThisProperty() { |
| 364 | return code_ == kThisPropertyExpression; |
| 365 | } |
| 366 | |
| 367 | bool IsStrictFunction() { |
| 368 | return code_ == kStrictFunctionExpression; |
| 369 | } |
| 370 | |
| 371 | Expression Parenthesize() { |
| 372 | int type = code_ & 3; |
| 373 | if (type != 0) { |
| 374 | // Identifiers and string literals can be parenthesized. |
| 375 | // They no longer work as labels or directive prologues, |
| 376 | // but are still recognized in other contexts. |
mstarzinger@chromium.org | f705b50 | 2013-04-04 11:38:09 +0000 | [diff] [blame] | 377 | return Expression(code_ | kParenthesizedExpressionFlag); |
ager@chromium.org | ea91cc5 | 2011-05-23 06:06:11 +0000 | [diff] [blame] | 378 | } |
| 379 | // For other types of expressions, it's not important to remember |
| 380 | // the parentheses. |
| 381 | return *this; |
| 382 | } |
| 383 | |
| 384 | private: |
| 385 | // First two/three bits are used as flags. |
| 386 | // Bit 0 and 1 represent identifiers or strings literals, and are |
| 387 | // mutually exclusive, but can both be absent. |
| 388 | // If bit 0 or 1 are set, bit 2 marks that the expression has |
| 389 | // been wrapped in parentheses (a string literal can no longer |
| 390 | // be a directive prologue, and an identifier can no longer be |
| 391 | // a label. |
| 392 | enum { |
| 393 | kUnknownExpression = 0, |
| 394 | // Identifiers |
| 395 | kIdentifierFlag = 1, // Used to detect labels. |
| 396 | kIdentifierShift = 3, |
| 397 | |
| 398 | kStringLiteralFlag = 2, // Used to detect directive prologue. |
| 399 | kUnknownStringLiteral = kStringLiteralFlag, |
| 400 | kUseStrictString = kStringLiteralFlag | 8, |
| 401 | kStringLiteralMask = kUseStrictString, |
| 402 | |
mstarzinger@chromium.org | f705b50 | 2013-04-04 11:38:09 +0000 | [diff] [blame] | 403 | // Only if identifier or string literal. |
| 404 | kParenthesizedExpressionFlag = 4, |
ager@chromium.org | ea91cc5 | 2011-05-23 06:06:11 +0000 | [diff] [blame] | 405 | |
| 406 | // Below here applies if neither identifier nor string literal. |
| 407 | kThisExpression = 4, |
| 408 | kThisPropertyExpression = 8, |
| 409 | kStrictFunctionExpression = 12 |
| 410 | }; |
| 411 | |
| 412 | explicit Expression(int expression_code) : code_(expression_code) { } |
| 413 | |
| 414 | int code_; |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 415 | }; |
| 416 | |
ager@chromium.org | ea91cc5 | 2011-05-23 06:06:11 +0000 | [diff] [blame] | 417 | class Statement { |
| 418 | public: |
| 419 | static Statement Default() { |
| 420 | return Statement(kUnknownStatement); |
| 421 | } |
| 422 | |
danno@chromium.org | 40cb878 | 2011-05-25 07:58:50 +0000 | [diff] [blame] | 423 | static Statement FunctionDeclaration() { |
| 424 | return Statement(kFunctionDeclaration); |
| 425 | } |
| 426 | |
ager@chromium.org | ea91cc5 | 2011-05-23 06:06:11 +0000 | [diff] [blame] | 427 | // Creates expression statement from expression. |
| 428 | // Preserves being an unparenthesized string literal, possibly |
| 429 | // "use strict". |
| 430 | static Statement ExpressionStatement(Expression expression) { |
| 431 | if (!expression.IsParenthesized()) { |
| 432 | if (expression.IsUseStrictLiteral()) { |
| 433 | return Statement(kUseStrictExpressionStatement); |
| 434 | } |
| 435 | if (expression.IsStringLiteral()) { |
| 436 | return Statement(kStringLiteralExpressionStatement); |
| 437 | } |
| 438 | } |
| 439 | return Default(); |
| 440 | } |
| 441 | |
| 442 | bool IsStringLiteral() { |
| 443 | return code_ != kUnknownStatement; |
| 444 | } |
| 445 | |
| 446 | bool IsUseStrictLiteral() { |
| 447 | return code_ == kUseStrictExpressionStatement; |
| 448 | } |
| 449 | |
danno@chromium.org | 40cb878 | 2011-05-25 07:58:50 +0000 | [diff] [blame] | 450 | bool IsFunctionDeclaration() { |
| 451 | return code_ == kFunctionDeclaration; |
| 452 | } |
| 453 | |
ager@chromium.org | ea91cc5 | 2011-05-23 06:06:11 +0000 | [diff] [blame] | 454 | private: |
| 455 | enum Type { |
| 456 | kUnknownStatement, |
| 457 | kStringLiteralExpressionStatement, |
danno@chromium.org | 40cb878 | 2011-05-25 07:58:50 +0000 | [diff] [blame] | 458 | kUseStrictExpressionStatement, |
| 459 | kFunctionDeclaration |
ager@chromium.org | ea91cc5 | 2011-05-23 06:06:11 +0000 | [diff] [blame] | 460 | }; |
| 461 | |
| 462 | explicit Statement(Type code) : code_(code) {} |
| 463 | Type code_; |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 464 | }; |
| 465 | |
ager@chromium.org | ea91cc5 | 2011-05-23 06:06:11 +0000 | [diff] [blame] | 466 | enum SourceElements { |
| 467 | kUnknownSourceElements |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 468 | }; |
| 469 | |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 470 | typedef int Arguments; |
| 471 | |
lrn@chromium.org | fa943b7 | 2010-11-03 08:14:36 +0000 | [diff] [blame] | 472 | class Scope { |
| 473 | public: |
| 474 | Scope(Scope** variable, ScopeType type) |
| 475 | : variable_(variable), |
| 476 | prev_(*variable), |
| 477 | type_(type), |
| 478 | materialized_literal_count_(0), |
| 479 | expected_properties_(0), |
lrn@chromium.org | 1c09276 | 2011-05-09 09:42:16 +0000 | [diff] [blame] | 480 | with_nesting_count_(0), |
mstarzinger@chromium.org | 1b3afd1 | 2011-11-29 14:28:56 +0000 | [diff] [blame] | 481 | language_mode_( |
mstarzinger@chromium.org | f705b50 | 2013-04-04 11:38:09 +0000 | [diff] [blame] | 482 | (prev_ != NULL) ? prev_->language_mode() : i::CLASSIC_MODE), |
| 483 | is_generator_(false) { |
lrn@chromium.org | fa943b7 | 2010-11-03 08:14:36 +0000 | [diff] [blame] | 484 | *variable = this; |
| 485 | } |
| 486 | ~Scope() { *variable_ = prev_; } |
| 487 | void NextMaterializedLiteralIndex() { materialized_literal_count_++; } |
| 488 | void AddProperty() { expected_properties_++; } |
| 489 | ScopeType type() { return type_; } |
| 490 | int expected_properties() { return expected_properties_; } |
| 491 | int materialized_literal_count() { return materialized_literal_count_; } |
| 492 | bool IsInsideWith() { return with_nesting_count_ != 0; } |
mstarzinger@chromium.org | f705b50 | 2013-04-04 11:38:09 +0000 | [diff] [blame] | 493 | bool is_generator() { return is_generator_; } |
| 494 | void set_is_generator(bool is_generator) { is_generator_ = is_generator; } |
mstarzinger@chromium.org | 1b3afd1 | 2011-11-29 14:28:56 +0000 | [diff] [blame] | 495 | bool is_classic_mode() { |
| 496 | return language_mode_ == i::CLASSIC_MODE; |
erik.corry@gmail.com | 394dbcf | 2011-10-27 07:38:48 +0000 | [diff] [blame] | 497 | } |
mstarzinger@chromium.org | 1b3afd1 | 2011-11-29 14:28:56 +0000 | [diff] [blame] | 498 | i::LanguageMode language_mode() { |
| 499 | return language_mode_; |
| 500 | } |
| 501 | void set_language_mode(i::LanguageMode language_mode) { |
| 502 | language_mode_ = language_mode; |
erik.corry@gmail.com | 394dbcf | 2011-10-27 07:38:48 +0000 | [diff] [blame] | 503 | } |
danno@chromium.org | 2c26cb1 | 2012-05-03 09:06:43 +0000 | [diff] [blame] | 504 | |
| 505 | class InsideWith { |
| 506 | public: |
| 507 | explicit InsideWith(Scope* scope) : scope_(scope) { |
| 508 | scope->with_nesting_count_++; |
| 509 | } |
| 510 | |
| 511 | ~InsideWith() { scope_->with_nesting_count_--; } |
| 512 | |
| 513 | private: |
| 514 | Scope* scope_; |
| 515 | DISALLOW_COPY_AND_ASSIGN(InsideWith); |
| 516 | }; |
lrn@chromium.org | fa943b7 | 2010-11-03 08:14:36 +0000 | [diff] [blame] | 517 | |
| 518 | private: |
| 519 | Scope** const variable_; |
| 520 | Scope* const prev_; |
| 521 | const ScopeType type_; |
| 522 | int materialized_literal_count_; |
| 523 | int expected_properties_; |
| 524 | int with_nesting_count_; |
mstarzinger@chromium.org | 1b3afd1 | 2011-11-29 14:28:56 +0000 | [diff] [blame] | 525 | i::LanguageMode language_mode_; |
mstarzinger@chromium.org | f705b50 | 2013-04-04 11:38:09 +0000 | [diff] [blame] | 526 | bool is_generator_; |
lrn@chromium.org | fa943b7 | 2010-11-03 08:14:36 +0000 | [diff] [blame] | 527 | }; |
| 528 | |
lrn@chromium.org | fa943b7 | 2010-11-03 08:14:36 +0000 | [diff] [blame] | 529 | // Report syntax error |
whesse@chromium.org | f0ac72d | 2010-11-08 12:47:26 +0000 | [diff] [blame] | 530 | void ReportUnexpectedToken(i::Token::Value token); |
ricow@chromium.org | 55ee807 | 2011-09-08 16:33:10 +0000 | [diff] [blame] | 531 | void ReportMessageAt(i::Scanner::Location location, |
| 532 | const char* type, |
| 533 | const char* name_opt) { |
| 534 | log_->LogMessage(location.beg_pos, location.end_pos, type, name_opt); |
| 535 | } |
lrn@chromium.org | fa943b7 | 2010-11-03 08:14:36 +0000 | [diff] [blame] | 536 | void ReportMessageAt(int start_pos, |
| 537 | int end_pos, |
| 538 | const char* type, |
| 539 | const char* name_opt) { |
| 540 | log_->LogMessage(start_pos, end_pos, type, name_opt); |
| 541 | } |
| 542 | |
lrn@chromium.org | 1c09276 | 2011-05-09 09:42:16 +0000 | [diff] [blame] | 543 | void CheckOctalLiteral(int beg_pos, int end_pos, bool* ok); |
| 544 | |
lrn@chromium.org | fa943b7 | 2010-11-03 08:14:36 +0000 | [diff] [blame] | 545 | // All ParseXXX functions take as the last argument an *ok parameter |
| 546 | // which is set to false if parsing failed; it is unchanged otherwise. |
| 547 | // By making the 'exception handling' explicit, we are forced to check |
| 548 | // for failure at the call sites. |
danno@chromium.org | b645116 | 2011-08-17 14:33:23 +0000 | [diff] [blame] | 549 | Statement ParseSourceElement(bool* ok); |
lrn@chromium.org | fa943b7 | 2010-11-03 08:14:36 +0000 | [diff] [blame] | 550 | SourceElements ParseSourceElements(int end_token, bool* ok); |
| 551 | Statement ParseStatement(bool* ok); |
| 552 | Statement ParseFunctionDeclaration(bool* ok); |
lrn@chromium.org | fa943b7 | 2010-11-03 08:14:36 +0000 | [diff] [blame] | 553 | Statement ParseBlock(bool* ok); |
danno@chromium.org | b645116 | 2011-08-17 14:33:23 +0000 | [diff] [blame] | 554 | Statement ParseVariableStatement(VariableDeclarationContext var_context, |
| 555 | bool* ok); |
| 556 | Statement ParseVariableDeclarations(VariableDeclarationContext var_context, |
erik.corry@gmail.com | 394dbcf | 2011-10-27 07:38:48 +0000 | [diff] [blame] | 557 | VariableDeclarationProperties* decl_props, |
danno@chromium.org | b645116 | 2011-08-17 14:33:23 +0000 | [diff] [blame] | 558 | int* num_decl, |
| 559 | bool* ok); |
lrn@chromium.org | fa943b7 | 2010-11-03 08:14:36 +0000 | [diff] [blame] | 560 | Statement ParseExpressionOrLabelledStatement(bool* ok); |
| 561 | Statement ParseIfStatement(bool* ok); |
| 562 | Statement ParseContinueStatement(bool* ok); |
| 563 | Statement ParseBreakStatement(bool* ok); |
| 564 | Statement ParseReturnStatement(bool* ok); |
| 565 | Statement ParseWithStatement(bool* ok); |
| 566 | Statement ParseSwitchStatement(bool* ok); |
| 567 | Statement ParseDoWhileStatement(bool* ok); |
| 568 | Statement ParseWhileStatement(bool* ok); |
| 569 | Statement ParseForStatement(bool* ok); |
| 570 | Statement ParseThrowStatement(bool* ok); |
| 571 | Statement ParseTryStatement(bool* ok); |
| 572 | Statement ParseDebuggerStatement(bool* ok); |
| 573 | |
| 574 | Expression ParseExpression(bool accept_IN, bool* ok); |
| 575 | Expression ParseAssignmentExpression(bool accept_IN, bool* ok); |
mstarzinger@chromium.org | f705b50 | 2013-04-04 11:38:09 +0000 | [diff] [blame] | 576 | Expression ParseYieldExpression(bool* ok); |
lrn@chromium.org | fa943b7 | 2010-11-03 08:14:36 +0000 | [diff] [blame] | 577 | Expression ParseConditionalExpression(bool accept_IN, bool* ok); |
| 578 | Expression ParseBinaryExpression(int prec, bool accept_IN, bool* ok); |
| 579 | Expression ParseUnaryExpression(bool* ok); |
| 580 | Expression ParsePostfixExpression(bool* ok); |
| 581 | Expression ParseLeftHandSideExpression(bool* ok); |
| 582 | Expression ParseNewExpression(bool* ok); |
| 583 | Expression ParseMemberExpression(bool* ok); |
whesse@chromium.org | f0ac72d | 2010-11-08 12:47:26 +0000 | [diff] [blame] | 584 | Expression ParseMemberWithNewPrefixesExpression(unsigned new_count, bool* ok); |
lrn@chromium.org | fa943b7 | 2010-11-03 08:14:36 +0000 | [diff] [blame] | 585 | Expression ParsePrimaryExpression(bool* ok); |
| 586 | Expression ParseArrayLiteral(bool* ok); |
| 587 | Expression ParseObjectLiteral(bool* ok); |
| 588 | Expression ParseRegExpLiteral(bool seen_equal, bool* ok); |
| 589 | Expression ParseV8Intrinsic(bool* ok); |
| 590 | |
| 591 | Arguments ParseArguments(bool* ok); |
mstarzinger@chromium.org | f705b50 | 2013-04-04 11:38:09 +0000 | [diff] [blame] | 592 | Expression ParseFunctionLiteral(bool is_generator, bool* ok); |
mstarzinger@chromium.org | 1b3afd1 | 2011-11-29 14:28:56 +0000 | [diff] [blame] | 593 | void ParseLazyFunctionLiteralBody(bool* ok); |
lrn@chromium.org | fa943b7 | 2010-11-03 08:14:36 +0000 | [diff] [blame] | 594 | |
| 595 | Identifier ParseIdentifier(bool* ok); |
| 596 | Identifier ParseIdentifierName(bool* ok); |
ager@chromium.org | 04921a8 | 2011-06-27 13:21:41 +0000 | [diff] [blame] | 597 | Identifier ParseIdentifierNameOrGetOrSet(bool* is_get, |
| 598 | bool* is_set, |
| 599 | bool* ok); |
lrn@chromium.org | fa943b7 | 2010-11-03 08:14:36 +0000 | [diff] [blame] | 600 | |
lrn@chromium.org | 5d00b60 | 2011-01-05 09:51:43 +0000 | [diff] [blame] | 601 | // Logs the currently parsed literal as a symbol in the preparser data. |
| 602 | void LogSymbol(); |
| 603 | // Log the currently parsed identifier. |
lrn@chromium.org | fa943b7 | 2010-11-03 08:14:36 +0000 | [diff] [blame] | 604 | Identifier GetIdentifierSymbol(); |
lrn@chromium.org | 5d00b60 | 2011-01-05 09:51:43 +0000 | [diff] [blame] | 605 | // Log the currently parsed string literal. |
lrn@chromium.org | fa943b7 | 2010-11-03 08:14:36 +0000 | [diff] [blame] | 606 | Expression GetStringSymbol(); |
| 607 | |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 608 | i::Token::Value peek() { |
| 609 | if (stack_overflow_) return i::Token::ILLEGAL; |
| 610 | return scanner_->peek(); |
| 611 | } |
lrn@chromium.org | fa943b7 | 2010-11-03 08:14:36 +0000 | [diff] [blame] | 612 | |
whesse@chromium.org | f0ac72d | 2010-11-08 12:47:26 +0000 | [diff] [blame] | 613 | i::Token::Value Next() { |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 614 | if (stack_overflow_) return i::Token::ILLEGAL; |
| 615 | { |
| 616 | int marker; |
| 617 | if (reinterpret_cast<uintptr_t>(&marker) < stack_limit_) { |
| 618 | // Further calls to peek/Next will return illegal token. |
| 619 | // The current one will still be returned. It might already |
| 620 | // have been seen using peek. |
| 621 | stack_overflow_ = true; |
| 622 | } |
| 623 | } |
| 624 | return scanner_->Next(); |
lrn@chromium.org | fa943b7 | 2010-11-03 08:14:36 +0000 | [diff] [blame] | 625 | } |
| 626 | |
ricow@chromium.org | 83aa549 | 2011-02-07 12:42:56 +0000 | [diff] [blame] | 627 | bool peek_any_identifier(); |
| 628 | |
mstarzinger@chromium.org | 1b3afd1 | 2011-11-29 14:28:56 +0000 | [diff] [blame] | 629 | void set_language_mode(i::LanguageMode language_mode) { |
| 630 | scope_->set_language_mode(language_mode); |
lrn@chromium.org | 1c09276 | 2011-05-09 09:42:16 +0000 | [diff] [blame] | 631 | } |
| 632 | |
mstarzinger@chromium.org | 1b3afd1 | 2011-11-29 14:28:56 +0000 | [diff] [blame] | 633 | bool is_classic_mode() { |
| 634 | return scope_->language_mode() == i::CLASSIC_MODE; |
| 635 | } |
erik.corry@gmail.com | 6e28b56 | 2011-10-27 14:20:17 +0000 | [diff] [blame] | 636 | |
mstarzinger@chromium.org | 1b3afd1 | 2011-11-29 14:28:56 +0000 | [diff] [blame] | 637 | bool is_extended_mode() { |
| 638 | return scope_->language_mode() == i::EXTENDED_MODE; |
| 639 | } |
| 640 | |
| 641 | i::LanguageMode language_mode() { return scope_->language_mode(); } |
lrn@chromium.org | 1c09276 | 2011-05-09 09:42:16 +0000 | [diff] [blame] | 642 | |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 643 | void Consume(i::Token::Value token) { Next(); } |
lrn@chromium.org | fa943b7 | 2010-11-03 08:14:36 +0000 | [diff] [blame] | 644 | |
whesse@chromium.org | f0ac72d | 2010-11-08 12:47:26 +0000 | [diff] [blame] | 645 | void Expect(i::Token::Value token, bool* ok) { |
lrn@chromium.org | fa943b7 | 2010-11-03 08:14:36 +0000 | [diff] [blame] | 646 | if (Next() != token) { |
| 647 | *ok = false; |
| 648 | } |
| 649 | } |
| 650 | |
whesse@chromium.org | f0ac72d | 2010-11-08 12:47:26 +0000 | [diff] [blame] | 651 | bool Check(i::Token::Value token) { |
| 652 | i::Token::Value next = peek(); |
lrn@chromium.org | fa943b7 | 2010-11-03 08:14:36 +0000 | [diff] [blame] | 653 | if (next == token) { |
| 654 | Consume(next); |
| 655 | return true; |
| 656 | } |
| 657 | return false; |
| 658 | } |
| 659 | void ExpectSemicolon(bool* ok); |
| 660 | |
danno@chromium.org | 4172848 | 2013-06-12 22:31:22 +0000 | [diff] [blame] | 661 | bool CheckInOrOf(bool accept_OF); |
danno@chromium.org | 1fd77d5 | 2013-06-07 16:01:45 +0000 | [diff] [blame] | 662 | |
whesse@chromium.org | f0ac72d | 2010-11-08 12:47:26 +0000 | [diff] [blame] | 663 | static int Precedence(i::Token::Value tok, bool accept_IN); |
lrn@chromium.org | fa943b7 | 2010-11-03 08:14:36 +0000 | [diff] [blame] | 664 | |
ager@chromium.org | ea91cc5 | 2011-05-23 06:06:11 +0000 | [diff] [blame] | 665 | void SetStrictModeViolation(i::Scanner::Location, |
| 666 | const char* type, |
erik.corry@gmail.com | f2038fb | 2012-01-16 11:42:08 +0000 | [diff] [blame] | 667 | bool* ok); |
ager@chromium.org | ea91cc5 | 2011-05-23 06:06:11 +0000 | [diff] [blame] | 668 | |
| 669 | void CheckDelayedStrictModeViolation(int beg_pos, int end_pos, bool* ok); |
| 670 | |
| 671 | void StrictModeIdentifierViolation(i::Scanner::Location, |
| 672 | const char* eval_args_type, |
| 673 | Identifier identifier, |
| 674 | bool* ok); |
| 675 | |
jkummerow@chromium.org | c3b3712 | 2011-11-07 10:14:12 +0000 | [diff] [blame] | 676 | i::Scanner* scanner_; |
ager@chromium.org | beb2571 | 2010-11-29 08:02:25 +0000 | [diff] [blame] | 677 | i::ParserRecorder* log_; |
lrn@chromium.org | fa943b7 | 2010-11-03 08:14:36 +0000 | [diff] [blame] | 678 | Scope* scope_; |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 679 | uintptr_t stack_limit_; |
ager@chromium.org | ea91cc5 | 2011-05-23 06:06:11 +0000 | [diff] [blame] | 680 | i::Scanner::Location strict_mode_violation_location_; |
| 681 | const char* strict_mode_violation_type_; |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 682 | bool stack_overflow_; |
lrn@chromium.org | fa943b7 | 2010-11-03 08:14:36 +0000 | [diff] [blame] | 683 | bool allow_lazy_; |
erik.corry@gmail.com | 394dbcf | 2011-10-27 07:38:48 +0000 | [diff] [blame] | 684 | bool allow_natives_syntax_; |
mstarzinger@chromium.org | f705b50 | 2013-04-04 11:38:09 +0000 | [diff] [blame] | 685 | bool allow_generators_; |
danno@chromium.org | 1fd77d5 | 2013-06-07 16:01:45 +0000 | [diff] [blame] | 686 | bool allow_for_of_; |
sgjesse@chromium.org | c6c5718 | 2011-01-17 12:24:25 +0000 | [diff] [blame] | 687 | bool parenthesized_function_; |
lrn@chromium.org | fa943b7 | 2010-11-03 08:14:36 +0000 | [diff] [blame] | 688 | }; |
whesse@chromium.org | f0ac72d | 2010-11-08 12:47:26 +0000 | [diff] [blame] | 689 | } } // v8::preparser |
lrn@chromium.org | fa943b7 | 2010-11-03 08:14:36 +0000 | [diff] [blame] | 690 | |
| 691 | #endif // V8_PREPARSER_H |