| OLD | NEW |
| 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 #include "src/v8.h" | 5 #include "src/v8.h" |
| 6 | 6 |
| 7 #include "src/api.h" | 7 #include "src/api.h" |
| 8 #include "src/ast.h" | 8 #include "src/ast.h" |
| 9 #include "src/bailout-reason.h" | 9 #include "src/bailout-reason.h" |
| 10 #include "src/base/platform/platform.h" | 10 #include "src/base/platform/platform.h" |
| (...skipping 324 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 335 | 335 |
| 336 #define CHECK_FAILED /**/); \ | 336 #define CHECK_FAILED /**/); \ |
| 337 if (failed_) return NULL; \ | 337 if (failed_) return NULL; \ |
| 338 ((void)0 | 338 ((void)0 |
| 339 #define DUMMY ) // to make indentation work | 339 #define DUMMY ) // to make indentation work |
| 340 #undef DUMMY | 340 #undef DUMMY |
| 341 | 341 |
| 342 // ---------------------------------------------------------------------------- | 342 // ---------------------------------------------------------------------------- |
| 343 // Implementation of Parser | 343 // Implementation of Parser |
| 344 | 344 |
| 345 class ParserTraits::Checkpoint | |
| 346 : public ParserBase<ParserTraits>::CheckpointBase { | |
| 347 public: | |
| 348 explicit Checkpoint(ParserBase<ParserTraits>* parser) | |
| 349 : CheckpointBase(parser), parser_(parser) { | |
| 350 saved_ast_node_id_gen_ = *parser_->ast_node_id_gen_; | |
| 351 } | |
| 352 | |
| 353 void Restore() { | |
| 354 CheckpointBase::Restore(); | |
| 355 *parser_->ast_node_id_gen_ = saved_ast_node_id_gen_; | |
| 356 } | |
| 357 | |
| 358 private: | |
| 359 ParserBase<ParserTraits>* parser_; | |
| 360 AstNode::IdGen saved_ast_node_id_gen_; | |
| 361 }; | |
| 362 | |
| 363 | |
| 364 bool ParserTraits::IsEvalOrArguments(const AstRawString* identifier) const { | 345 bool ParserTraits::IsEvalOrArguments(const AstRawString* identifier) const { |
| 365 return identifier == parser_->ast_value_factory()->eval_string() || | 346 return identifier == parser_->ast_value_factory()->eval_string() || |
| 366 identifier == parser_->ast_value_factory()->arguments_string(); | 347 identifier == parser_->ast_value_factory()->arguments_string(); |
| 367 } | 348 } |
| 368 | 349 |
| 369 | 350 |
| 370 bool ParserTraits::IsPrototype(const AstRawString* identifier) const { | 351 bool ParserTraits::IsPrototype(const AstRawString* identifier) const { |
| 371 return identifier == parser_->ast_value_factory()->prototype_string(); | 352 return identifier == parser_->ast_value_factory()->prototype_string(); |
| 372 } | 353 } |
| 373 | 354 |
| (...skipping 4594 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4968 | 4949 |
| 4969 // We cannot internalize on a background thread; a foreground task will take | 4950 // We cannot internalize on a background thread; a foreground task will take |
| 4970 // care of calling Parser::Internalize just before compilation. | 4951 // care of calling Parser::Internalize just before compilation. |
| 4971 | 4952 |
| 4972 if (compile_options() == ScriptCompiler::kProduceParserCache) { | 4953 if (compile_options() == ScriptCompiler::kProduceParserCache) { |
| 4973 if (result != NULL) *info_->cached_data() = recorder.GetScriptData(); | 4954 if (result != NULL) *info_->cached_data() = recorder.GetScriptData(); |
| 4974 log_ = NULL; | 4955 log_ = NULL; |
| 4975 } | 4956 } |
| 4976 } | 4957 } |
| 4977 } } // namespace v8::internal | 4958 } } // namespace v8::internal |
| OLD | NEW |