| OLD | NEW |
| 1 // Copyright 2010 the V8 project authors. All rights reserved. | 1 // Copyright 2010 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 17 matching lines...) Expand all Loading... |
| 28 #ifndef V8_PARSER_H_ | 28 #ifndef V8_PARSER_H_ |
| 29 #define V8_PARSER_H_ | 29 #define V8_PARSER_H_ |
| 30 | 30 |
| 31 #include "allocation.h" | 31 #include "allocation.h" |
| 32 #include "ast.h" | 32 #include "ast.h" |
| 33 #include "scanner.h" | 33 #include "scanner.h" |
| 34 | 34 |
| 35 namespace v8 { | 35 namespace v8 { |
| 36 namespace internal { | 36 namespace internal { |
| 37 | 37 |
| 38 class CompilationInfo; |
| 38 class FuncNameInferrer; | 39 class FuncNameInferrer; |
| 39 class ParserFactory; | 40 class ParserFactory; |
| 40 class ParserLog; | 41 class ParserLog; |
| 41 class PositionStack; | 42 class PositionStack; |
| 42 class Target; | 43 class Target; |
| 43 class TemporaryScope; | 44 class TemporaryScope; |
| 44 | 45 |
| 45 template <typename T> class ZoneListWrapper; | 46 template <typename T> class ZoneListWrapper; |
| 46 | 47 |
| 47 | 48 |
| (...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 176 }; | 177 }; |
| 177 | 178 |
| 178 | 179 |
| 179 class Parser { | 180 class Parser { |
| 180 public: | 181 public: |
| 181 Parser(Handle<Script> script, bool allow_natives_syntax, | 182 Parser(Handle<Script> script, bool allow_natives_syntax, |
| 182 v8::Extension* extension, ParserMode is_pre_parsing, | 183 v8::Extension* extension, ParserMode is_pre_parsing, |
| 183 ParserFactory* factory, ParserLog* log, ScriptDataImpl* pre_data); | 184 ParserFactory* factory, ParserLog* log, ScriptDataImpl* pre_data); |
| 184 virtual ~Parser() { } | 185 virtual ~Parser() { } |
| 185 | 186 |
| 186 // Takes a script and and context information, and builds a | 187 // Parses the source code represented by the compilation info and sets its |
| 187 // FunctionLiteral AST node. Returns NULL and deallocates any allocated | 188 // function literal. Returns false (and deallocates any allocated AST |
| 188 // AST nodes if parsing failed. | 189 // nodes) if parsing failed. |
| 189 static FunctionLiteral* MakeAST(bool compile_in_global_context, | 190 static bool Parse(CompilationInfo* info); |
| 190 Handle<Script> script, | |
| 191 v8::Extension* extension, | |
| 192 ScriptDataImpl* pre_data, | |
| 193 bool is_json = false); | |
| 194 | |
| 195 // Support for doing lazy compilation. | |
| 196 static FunctionLiteral* MakeLazyAST(Handle<SharedFunctionInfo> info); | |
| 197 | 191 |
| 198 // Generic preparser generating full preparse data. | 192 // Generic preparser generating full preparse data. |
| 199 static ScriptDataImpl* PreParse(Handle<String> source, | 193 static ScriptDataImpl* PreParse(Handle<String> source, |
| 200 unibrow::CharacterStream* stream, | 194 unibrow::CharacterStream* stream, |
| 201 v8::Extension* extension); | 195 v8::Extension* extension); |
| 202 | 196 |
| 203 // Preparser that only does preprocessing that makes sense if only used | 197 // Preparser that only does preprocessing that makes sense if only used |
| 204 // immediately after. | 198 // immediately after. |
| 205 static ScriptDataImpl* PartialPreParse(Handle<String> source, | 199 static ScriptDataImpl* PartialPreParse(Handle<String> source, |
| 206 unibrow::CharacterStream* stream, | 200 unibrow::CharacterStream* stream, |
| (...skipping 267 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 474 static const int kTypeSlot = 0; | 468 static const int kTypeSlot = 0; |
| 475 static const int kElementsSlot = 1; | 469 static const int kElementsSlot = 1; |
| 476 | 470 |
| 477 DISALLOW_IMPLICIT_CONSTRUCTORS(CompileTimeValue); | 471 DISALLOW_IMPLICIT_CONSTRUCTORS(CompileTimeValue); |
| 478 }; | 472 }; |
| 479 | 473 |
| 480 | 474 |
| 481 } } // namespace v8::internal | 475 } } // namespace v8::internal |
| 482 | 476 |
| 483 #endif // V8_PARSER_H_ | 477 #endif // V8_PARSER_H_ |
| OLD | NEW |