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

Side by Side Diff: src/rewriter.cc

Issue 974213002: Extract ParseInfo from CompilationInfo. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 years, 9 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/rewriter.h ('k') | src/runtime/runtime-debug.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 #include "src/v8.h" 5 #include "src/v8.h"
6 6
7 #include "src/ast.h"
8 #include "src/parser.h"
7 #include "src/rewriter.h" 9 #include "src/rewriter.h"
8
9 #include "src/ast.h"
10 #include "src/compiler.h"
11 #include "src/scopes.h" 10 #include "src/scopes.h"
12 11
13 namespace v8 { 12 namespace v8 {
14 namespace internal { 13 namespace internal {
15 14
16 class Processor: public AstVisitor { 15 class Processor: public AstVisitor {
17 public: 16 public:
18 Processor(Isolate* isolate, Variable* result, 17 Processor(Isolate* isolate, Variable* result,
19 AstValueFactory* ast_value_factory) 18 AstValueFactory* ast_value_factory)
20 : result_(result), 19 : result_(result),
(...skipping 194 matching lines...) Expand 10 before | Expand all | Expand 10 after
215 214
216 // Expressions are never visited yet. 215 // Expressions are never visited yet.
217 #define DEF_VISIT(type) \ 216 #define DEF_VISIT(type) \
218 void Processor::Visit##type(type* expr) { UNREACHABLE(); } 217 void Processor::Visit##type(type* expr) { UNREACHABLE(); }
219 EXPRESSION_NODE_LIST(DEF_VISIT) 218 EXPRESSION_NODE_LIST(DEF_VISIT)
220 #undef DEF_VISIT 219 #undef DEF_VISIT
221 220
222 221
223 // Assumes code has been parsed. Mutates the AST, so the AST should not 222 // Assumes code has been parsed. Mutates the AST, so the AST should not
224 // continue to be used in the case of failure. 223 // continue to be used in the case of failure.
225 bool Rewriter::Rewrite(CompilationInfo* info) { 224 bool Rewriter::Rewrite(ParseInfo* info) {
226 FunctionLiteral* function = info->function(); 225 FunctionLiteral* function = info->function();
227 DCHECK(function != NULL); 226 DCHECK(function != NULL);
228 Scope* scope = function->scope(); 227 Scope* scope = function->scope();
229 DCHECK(scope != NULL); 228 DCHECK(scope != NULL);
230 if (!scope->is_script_scope() && !scope->is_eval_scope()) return true; 229 if (!scope->is_script_scope() && !scope->is_eval_scope()) return true;
231 230
232 ZoneList<Statement*>* body = function->body(); 231 ZoneList<Statement*>* body = function->body();
233 if (!body->is_empty()) { 232 if (!body->is_empty()) {
234 Variable* result = 233 Variable* result =
235 scope->NewTemporary(info->ast_value_factory()->dot_result_string()); 234 scope->NewTemporary(info->ast_value_factory()->dot_result_string());
(...skipping 18 matching lines...) Expand all
254 processor.factory()->NewReturnStatement(result_proxy, pos); 253 processor.factory()->NewReturnStatement(result_proxy, pos);
255 body->Add(result_statement, info->zone()); 254 body->Add(result_statement, info->zone());
256 } 255 }
257 } 256 }
258 257
259 return true; 258 return true;
260 } 259 }
261 260
262 261
263 } } // namespace v8::internal 262 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/rewriter.h ('k') | src/runtime/runtime-debug.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698