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

Side by Side Diff: src/rewriter.cc

Issue 10534139: One Zone per CompilationInfo. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Rename CompilationInfoZone to ZoneWithCompilationInfo Created 8 years, 6 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.cc ('k') | src/runtime.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 // 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 20 matching lines...) Expand all
31 31
32 #include "ast.h" 32 #include "ast.h"
33 #include "compiler.h" 33 #include "compiler.h"
34 #include "scopes.h" 34 #include "scopes.h"
35 35
36 namespace v8 { 36 namespace v8 {
37 namespace internal { 37 namespace internal {
38 38
39 class Processor: public AstVisitor { 39 class Processor: public AstVisitor {
40 public: 40 public:
41 explicit Processor(Variable* result) 41 Processor(Variable* result, Zone* zone)
42 : result_(result), 42 : result_(result),
43 result_assigned_(false), 43 result_assigned_(false),
44 is_set_(false), 44 is_set_(false),
45 in_try_(false), 45 in_try_(false),
46 factory_(isolate()) { } 46 factory_(isolate(), zone) { }
47 47
48 virtual ~Processor() { } 48 virtual ~Processor() { }
49 49
50 void Process(ZoneList<Statement*>* statements); 50 void Process(ZoneList<Statement*>* statements);
51 bool result_assigned() const { return result_assigned_; } 51 bool result_assigned() const { return result_assigned_; }
52 52
53 AstNodeFactory<AstNullVisitor>* factory() { 53 AstNodeFactory<AstNullVisitor>* factory() {
54 return &factory_; 54 return &factory_;
55 } 55 }
56 56
(...skipping 179 matching lines...) Expand 10 before | Expand all | Expand 10 after
236 FunctionLiteral* function = info->function(); 236 FunctionLiteral* function = info->function();
237 ASSERT(function != NULL); 237 ASSERT(function != NULL);
238 Scope* scope = function->scope(); 238 Scope* scope = function->scope();
239 ASSERT(scope != NULL); 239 ASSERT(scope != NULL);
240 if (!scope->is_global_scope() && !scope->is_eval_scope()) return true; 240 if (!scope->is_global_scope() && !scope->is_eval_scope()) return true;
241 241
242 ZoneList<Statement*>* body = function->body(); 242 ZoneList<Statement*>* body = function->body();
243 if (!body->is_empty()) { 243 if (!body->is_empty()) {
244 Variable* result = scope->NewTemporary( 244 Variable* result = scope->NewTemporary(
245 info->isolate()->factory()->result_symbol()); 245 info->isolate()->factory()->result_symbol());
246 Processor processor(result); 246 Processor processor(result, info->zone());
247 processor.Process(body); 247 processor.Process(body);
248 if (processor.HasStackOverflow()) return false; 248 if (processor.HasStackOverflow()) return false;
249 249
250 if (processor.result_assigned()) { 250 if (processor.result_assigned()) {
251 ASSERT(function->end_position() != RelocInfo::kNoPosition); 251 ASSERT(function->end_position() != RelocInfo::kNoPosition);
252 // Set the position of the assignment statement one character past the 252 // Set the position of the assignment statement one character past the
253 // source code, such that it definitely is not in the source code range 253 // source code, such that it definitely is not in the source code range
254 // of an immediate inner scope. For example in 254 // of an immediate inner scope. For example in
255 // eval('with ({x:1}) x = 1'); 255 // eval('with ({x:1}) x = 1');
256 // the end position of the function generated for executing the eval code 256 // the end position of the function generated for executing the eval code
257 // coincides with the end of the with scope which is the position of '1'. 257 // coincides with the end of the with scope which is the position of '1'.
258 int position = function->end_position(); 258 int position = function->end_position();
259 VariableProxy* result_proxy = processor.factory()->NewVariableProxy( 259 VariableProxy* result_proxy = processor.factory()->NewVariableProxy(
260 result->name(), false, position); 260 result->name(), false, position);
261 result_proxy->BindTo(result); 261 result_proxy->BindTo(result);
262 Statement* result_statement = 262 Statement* result_statement =
263 processor.factory()->NewReturnStatement(result_proxy); 263 processor.factory()->NewReturnStatement(result_proxy);
264 result_statement->set_statement_pos(position); 264 result_statement->set_statement_pos(position);
265 body->Add(result_statement, info->isolate()->zone()); 265 body->Add(result_statement, info->zone());
266 } 266 }
267 } 267 }
268 268
269 return true; 269 return true;
270 } 270 }
271 271
272 272
273 } } // namespace v8::internal 273 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/parser.cc ('k') | src/runtime.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698