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

Side by Side Diff: src/hydrogen.cc

Issue 7083024: Support optimization of named function literals. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 9 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/arm/lithium-codegen-arm.cc ('k') | src/hydrogen-instructions.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 2290 matching lines...) Expand 10 before | Expand all | Expand 10 after
2301 } 2301 }
2302 2302
2303 while (!arguments.is_empty()) { 2303 while (!arguments.is_empty()) {
2304 AddInstruction(new(zone()) HPushArgument(arguments.RemoveLast())); 2304 AddInstruction(new(zone()) HPushArgument(arguments.RemoveLast()));
2305 } 2305 }
2306 return call; 2306 return call;
2307 } 2307 }
2308 2308
2309 2309
2310 void HGraphBuilder::SetupScope(Scope* scope) { 2310 void HGraphBuilder::SetupScope(Scope* scope) {
2311 // We don't yet handle the function name for named function expressions.
2312 if (scope->function() != NULL) return Bailout("named function expression");
2313
2314 HConstant* undefined_constant = new(zone()) HConstant( 2311 HConstant* undefined_constant = new(zone()) HConstant(
2315 isolate()->factory()->undefined_value(), Representation::Tagged()); 2312 isolate()->factory()->undefined_value(), Representation::Tagged());
2316 AddInstruction(undefined_constant); 2313 AddInstruction(undefined_constant);
2317 graph_->set_undefined_constant(undefined_constant); 2314 graph_->set_undefined_constant(undefined_constant);
2318 2315
2319 // Set the initial values of parameters including "this". "This" has 2316 // Set the initial values of parameters including "this". "This" has
2320 // parameter index 0. 2317 // parameter index 0.
2321 ASSERT_EQ(scope->num_parameters() + 1, environment()->parameter_count()); 2318 ASSERT_EQ(scope->num_parameters() + 1, environment()->parameter_count());
2322 2319
2323 for (int i = 0; i < environment()->parameter_count(); ++i) { 2320 for (int i = 0; i < environment()->parameter_count(); ++i) {
(...skipping 3030 matching lines...) Expand 10 before | Expand all | Expand 10 after
5354 HValue* value = Pop(); 5351 HValue* value = Pop();
5355 HIsNull* compare = new(zone()) HIsNull(value, expr->is_strict()); 5352 HIsNull* compare = new(zone()) HIsNull(value, expr->is_strict());
5356 ast_context()->ReturnInstruction(compare, expr->id()); 5353 ast_context()->ReturnInstruction(compare, expr->id());
5357 } 5354 }
5358 5355
5359 5356
5360 void HGraphBuilder::VisitThisFunction(ThisFunction* expr) { 5357 void HGraphBuilder::VisitThisFunction(ThisFunction* expr) {
5361 ASSERT(!HasStackOverflow()); 5358 ASSERT(!HasStackOverflow());
5362 ASSERT(current_block() != NULL); 5359 ASSERT(current_block() != NULL);
5363 ASSERT(current_block()->HasPredecessor()); 5360 ASSERT(current_block()->HasPredecessor());
5364 return Bailout("ThisFunction"); 5361 HThisFunction* self = new(zone()) HThisFunction;
5362 return ast_context()->ReturnInstruction(self, expr->id());
5365 } 5363 }
5366 5364
5367 5365
5368 void HGraphBuilder::VisitDeclaration(Declaration* decl) { 5366 void HGraphBuilder::VisitDeclaration(Declaration* decl) {
5369 // We allow only declarations that do not require code generation. 5367 // We allow only declarations that do not require code generation.
5370 // The following all require code generation: global variables, 5368 // The following all require code generation: global variables,
5371 // functions, and variables with slot type LOOKUP 5369 // functions, and variables with slot type LOOKUP
5372 Variable* var = decl->proxy()->var(); 5370 Variable* var = decl->proxy()->var();
5373 Slot* slot = var->AsSlot(); 5371 Slot* slot = var->AsSlot();
5374 if (var->is_global() || 5372 if (var->is_global() ||
(...skipping 931 matching lines...) Expand 10 before | Expand all | Expand 10 after
6306 } 6304 }
6307 } 6305 }
6308 6306
6309 #ifdef DEBUG 6307 #ifdef DEBUG
6310 if (graph_ != NULL) graph_->Verify(); 6308 if (graph_ != NULL) graph_->Verify();
6311 if (allocator_ != NULL) allocator_->Verify(); 6309 if (allocator_ != NULL) allocator_->Verify();
6312 #endif 6310 #endif
6313 } 6311 }
6314 6312
6315 } } // namespace v8::internal 6313 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/arm/lithium-codegen-arm.cc ('k') | src/hydrogen-instructions.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698