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

Side by Side Diff: src/rewriter.cc

Issue 7348008: Merge up to 8597 to experimental/gc from the bleeding edge. (Closed) Base URL: http://v8.googlecode.com/svn/branches/experimental/gc/
Patch Set: '' Created 9 years, 5 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/regexp.js ('k') | src/runtime.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 2011 the V8 project authors. All rights reserved. 1 // Copyright 2011 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 179 matching lines...) Expand 10 before | Expand all | Expand 10 after
190 190
191 void Processor::VisitBreakStatement(BreakStatement* node) { 191 void Processor::VisitBreakStatement(BreakStatement* node) {
192 is_set_ = false; 192 is_set_ = false;
193 } 193 }
194 194
195 195
196 // Do nothing: 196 // Do nothing:
197 void Processor::VisitDeclaration(Declaration* node) {} 197 void Processor::VisitDeclaration(Declaration* node) {}
198 void Processor::VisitEmptyStatement(EmptyStatement* node) {} 198 void Processor::VisitEmptyStatement(EmptyStatement* node) {}
199 void Processor::VisitReturnStatement(ReturnStatement* node) {} 199 void Processor::VisitReturnStatement(ReturnStatement* node) {}
200 void Processor::VisitWithEnterStatement(WithEnterStatement* node) {} 200 void Processor::VisitEnterWithContextStatement(
201 void Processor::VisitWithExitStatement(WithExitStatement* node) {} 201 EnterWithContextStatement* node) {
202 }
203 void Processor::VisitExitContextStatement(ExitContextStatement* node) {}
202 void Processor::VisitDebuggerStatement(DebuggerStatement* node) {} 204 void Processor::VisitDebuggerStatement(DebuggerStatement* node) {}
203 205
204 206
205 // Expressions are never visited yet. 207 // Expressions are never visited yet.
206 void Processor::VisitFunctionLiteral(FunctionLiteral* node) { 208 #define DEF_VISIT(type) \
207 USE(node); 209 void Processor::Visit##type(type* expr) { UNREACHABLE(); }
208 UNREACHABLE(); 210 EXPRESSION_NODE_LIST(DEF_VISIT)
209 } 211 #undef DEF_VISIT
210
211
212 void Processor::VisitSharedFunctionInfoLiteral(
213 SharedFunctionInfoLiteral* node) {
214 USE(node);
215 UNREACHABLE();
216 }
217
218
219 void Processor::VisitConditional(Conditional* node) {
220 USE(node);
221 UNREACHABLE();
222 }
223
224
225 void Processor::VisitVariableProxy(VariableProxy* node) {
226 USE(node);
227 UNREACHABLE();
228 }
229
230
231 void Processor::VisitLiteral(Literal* node) {
232 USE(node);
233 UNREACHABLE();
234 }
235
236
237 void Processor::VisitRegExpLiteral(RegExpLiteral* node) {
238 USE(node);
239 UNREACHABLE();
240 }
241
242
243 void Processor::VisitArrayLiteral(ArrayLiteral* node) {
244 USE(node);
245 UNREACHABLE();
246 }
247
248
249 void Processor::VisitObjectLiteral(ObjectLiteral* node) {
250 USE(node);
251 UNREACHABLE();
252 }
253
254
255 void Processor::VisitCatchExtensionObject(CatchExtensionObject* node) {
256 USE(node);
257 UNREACHABLE();
258 }
259
260
261 void Processor::VisitAssignment(Assignment* node) {
262 USE(node);
263 UNREACHABLE();
264 }
265
266
267 void Processor::VisitThrow(Throw* node) {
268 USE(node);
269 UNREACHABLE();
270 }
271
272
273 void Processor::VisitProperty(Property* node) {
274 USE(node);
275 UNREACHABLE();
276 }
277
278
279 void Processor::VisitCall(Call* node) {
280 USE(node);
281 UNREACHABLE();
282 }
283
284
285 void Processor::VisitCallNew(CallNew* node) {
286 USE(node);
287 UNREACHABLE();
288 }
289
290
291 void Processor::VisitCallRuntime(CallRuntime* node) {
292 USE(node);
293 UNREACHABLE();
294 }
295
296
297 void Processor::VisitUnaryOperation(UnaryOperation* node) {
298 USE(node);
299 UNREACHABLE();
300 }
301
302
303 void Processor::VisitCountOperation(CountOperation* node) {
304 USE(node);
305 UNREACHABLE();
306 }
307
308
309 void Processor::VisitBinaryOperation(BinaryOperation* node) {
310 USE(node);
311 UNREACHABLE();
312 }
313
314
315 void Processor::VisitCompareOperation(CompareOperation* node) {
316 USE(node);
317 UNREACHABLE();
318 }
319
320
321 void Processor::VisitCompareToNull(CompareToNull* node) {
322 USE(node);
323 UNREACHABLE();
324 }
325
326
327 void Processor::VisitThisFunction(ThisFunction* node) {
328 USE(node);
329 UNREACHABLE();
330 }
331 212
332 213
333 // Assumes code has been parsed and scopes have been analyzed. Mutates the 214 // Assumes code has been parsed and scopes have been analyzed. Mutates the
334 // AST, so the AST should not continue to be used in the case of failure. 215 // AST, so the AST should not continue to be used in the case of failure.
335 bool Rewriter::Rewrite(CompilationInfo* info) { 216 bool Rewriter::Rewrite(CompilationInfo* info) {
336 FunctionLiteral* function = info->function(); 217 FunctionLiteral* function = info->function();
337 ASSERT(function != NULL); 218 ASSERT(function != NULL);
338 Scope* scope = function->scope(); 219 Scope* scope = function->scope();
339 ASSERT(scope != NULL); 220 ASSERT(scope != NULL);
340 if (scope->is_function_scope()) return true; 221 if (!scope->is_global_scope() && !scope->is_eval_scope()) return true;
341 222
342 ZoneList<Statement*>* body = function->body(); 223 ZoneList<Statement*>* body = function->body();
343 if (!body->is_empty()) { 224 if (!body->is_empty()) {
344 Variable* result = scope->NewTemporary( 225 Variable* result = scope->NewTemporary(
345 info->isolate()->factory()->result_symbol()); 226 info->isolate()->factory()->result_symbol());
346 Processor processor(result); 227 Processor processor(result);
347 processor.Process(body); 228 processor.Process(body);
348 if (processor.HasStackOverflow()) return false; 229 if (processor.HasStackOverflow()) return false;
349 230
350 if (processor.result_assigned()) { 231 if (processor.result_assigned()) {
351 VariableProxy* result_proxy = new VariableProxy(result); 232 VariableProxy* result_proxy = new VariableProxy(result);
352 body->Add(new ReturnStatement(result_proxy)); 233 body->Add(new ReturnStatement(result_proxy));
353 } 234 }
354 } 235 }
355 236
356 return true; 237 return true;
357 } 238 }
358 239
359 240
360 } } // namespace v8::internal 241 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/regexp.js ('k') | src/runtime.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698