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

Side by Side Diff: src/parser.cc

Issue 485473004: Refactor parser Checkpoints. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: rebased Created 6 years, 4 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 | Annotate | Revision Log
« no previous file with comments | « src/parser.h ('k') | src/preparser.h » ('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 #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/base/platform/platform.h" 9 #include "src/base/platform/platform.h"
10 #include "src/bootstrapper.h" 10 #include "src/bootstrapper.h"
(...skipping 323 matching lines...) Expand 10 before | Expand all | Expand 10 after
334 334
335 #define CHECK_FAILED /**/); \ 335 #define CHECK_FAILED /**/); \
336 if (failed_) return NULL; \ 336 if (failed_) return NULL; \
337 ((void)0 337 ((void)0
338 #define DUMMY ) // to make indentation work 338 #define DUMMY ) // to make indentation work
339 #undef DUMMY 339 #undef DUMMY
340 340
341 // ---------------------------------------------------------------------------- 341 // ----------------------------------------------------------------------------
342 // Implementation of Parser 342 // Implementation of Parser
343 343
344 class ParserTraits::Checkpoint
345 : public ParserBase<ParserTraits>::CheckpointBase {
346 public:
347 explicit Checkpoint(ParserBase<ParserTraits>* parser)
348 : CheckpointBase(parser) {
349 isolate_ = parser->zone()->isolate();
350 saved_ast_node_id_ = isolate_->ast_node_id();
351 }
352
353 void Restore() {
354 CheckpointBase::Restore();
355 isolate_->set_ast_node_id(saved_ast_node_id_);
356 }
357
358 private:
359 Isolate* isolate_;
360 int saved_ast_node_id_;
361 };
362
363
344 bool ParserTraits::IsEvalOrArguments(const AstRawString* identifier) const { 364 bool ParserTraits::IsEvalOrArguments(const AstRawString* identifier) const {
345 return identifier == parser_->ast_value_factory_->eval_string() || 365 return identifier == parser_->ast_value_factory_->eval_string() ||
346 identifier == parser_->ast_value_factory_->arguments_string(); 366 identifier == parser_->ast_value_factory_->arguments_string();
347 } 367 }
348 368
349 369
350 bool ParserTraits::IsThisProperty(Expression* expression) { 370 bool ParserTraits::IsThisProperty(Expression* expression) {
351 DCHECK(expression != NULL); 371 DCHECK(expression != NULL);
352 Property* property = expression->AsProperty(); 372 Property* property = expression->AsProperty();
353 return property != NULL && 373 return property != NULL &&
(...skipping 4456 matching lines...) Expand 10 before | Expand all | Expand 10 after
4810 info()->SetAstValueFactory(ast_value_factory_); 4830 info()->SetAstValueFactory(ast_value_factory_);
4811 } 4831 }
4812 ast_value_factory_ = NULL; 4832 ast_value_factory_ = NULL;
4813 4833
4814 InternalizeUseCounts(); 4834 InternalizeUseCounts();
4815 4835
4816 return (result != NULL); 4836 return (result != NULL);
4817 } 4837 }
4818 4838
4819 } } // namespace v8::internal 4839 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/parser.h ('k') | src/preparser.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698