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

Side by Side Diff: src/hydrogen.cc

Issue 6534022: Optimize functions needing a local context.... (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: '' Created 9 years, 10 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/ia32/deoptimizer-ia32.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 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 2274 matching lines...) Expand 10 before | Expand all | Expand 10 after
2285 while (!arguments.is_empty()) { 2285 while (!arguments.is_empty()) {
2286 AddInstruction(new HPushArgument(arguments.RemoveLast())); 2286 AddInstruction(new HPushArgument(arguments.RemoveLast()));
2287 } 2287 }
2288 } 2288 }
2289 2289
2290 2290
2291 void HGraphBuilder::SetupScope(Scope* scope) { 2291 void HGraphBuilder::SetupScope(Scope* scope) {
2292 // We don't yet handle the function name for named function expressions. 2292 // We don't yet handle the function name for named function expressions.
2293 if (scope->function() != NULL) BAILOUT("named function expression"); 2293 if (scope->function() != NULL) BAILOUT("named function expression");
2294 2294
2295 // We can't handle heap-allocated locals.
2296 if (scope->num_heap_slots() > 0) BAILOUT("heap allocated locals");
2297
2298 HConstant* undefined_constant = 2295 HConstant* undefined_constant =
2299 new HConstant(Factory::undefined_value(), Representation::Tagged()); 2296 new HConstant(Factory::undefined_value(), Representation::Tagged());
2300 AddInstruction(undefined_constant); 2297 AddInstruction(undefined_constant);
2301 graph_->set_undefined_constant(undefined_constant); 2298 graph_->set_undefined_constant(undefined_constant);
2302 2299
2303 // Set the initial values of parameters including "this". "This" has 2300 // Set the initial values of parameters including "this". "This" has
2304 // parameter index 0. 2301 // parameter index 0.
2305 int count = scope->num_parameters() + 1; 2302 int count = scope->num_parameters() + 1;
2306 for (int i = 0; i < count; ++i) { 2303 for (int i = 0; i < count; ++i) {
2307 HInstruction* parameter = AddInstruction(new HParameter(i)); 2304 HInstruction* parameter = AddInstruction(new HParameter(i));
2308 environment()->Bind(i, parameter); 2305 environment()->Bind(i, parameter);
2309 } 2306 }
2310 2307
2311 // Set the initial values of stack-allocated locals. 2308 // Set the initial values of stack-allocated locals.
2312 for (int i = count; i < environment()->length(); ++i) { 2309 for (int i = count; i < environment()->length(); ++i) {
2313 environment()->Bind(i, undefined_constant); 2310 environment()->Bind(i, undefined_constant);
2314 } 2311 }
2315 2312
2316 // Handle the arguments and arguments shadow variables specially (they do 2313 // Handle the arguments and arguments shadow variables specially (they do
2317 // not have declarations). 2314 // not have declarations).
2318 if (scope->arguments() != NULL) { 2315 if (scope->arguments() != NULL) {
2316 if (!scope->arguments()->IsStackAllocated() ||
2317 !scope->arguments_shadow()->IsStackAllocated()) {
2318 BAILOUT("context-allocated arguments");
2319 }
2319 HArgumentsObject* object = new HArgumentsObject; 2320 HArgumentsObject* object = new HArgumentsObject;
2320 AddInstruction(object); 2321 AddInstruction(object);
2321 graph()->SetArgumentsObject(object); 2322 graph()->SetArgumentsObject(object);
2322 environment()->Bind(scope->arguments(), object); 2323 environment()->Bind(scope->arguments(), object);
2323 environment()->Bind(scope->arguments_shadow(), object); 2324 environment()->Bind(scope->arguments_shadow(), object);
2324 } 2325 }
2325 } 2326 }
2326 2327
2327 2328
2328 void HGraphBuilder::VisitStatements(ZoneList<Statement*>* statements) { 2329 void HGraphBuilder::VisitStatements(ZoneList<Statement*>* statements) {
(...skipping 1687 matching lines...) Expand 10 before | Expand all | Expand 10 after
4016 4017
4017 // Parse and allocate variables. 4018 // Parse and allocate variables.
4018 CompilationInfo inner_info(target); 4019 CompilationInfo inner_info(target);
4019 if (!ParserApi::Parse(&inner_info) || 4020 if (!ParserApi::Parse(&inner_info) ||
4020 !Scope::Analyze(&inner_info)) { 4021 !Scope::Analyze(&inner_info)) {
4021 if (Top::has_pending_exception()) { 4022 if (Top::has_pending_exception()) {
4022 SetStackOverflow(); 4023 SetStackOverflow();
4023 } 4024 }
4024 return false; 4025 return false;
4025 } 4026 }
4027 if (inner_info.scope()->num_heap_slots() > 0) return false;
4026 FunctionLiteral* function = inner_info.function(); 4028 FunctionLiteral* function = inner_info.function();
4027 4029
4028 // Count the number of AST nodes added by inlining this call. 4030 // Count the number of AST nodes added by inlining this call.
4029 int nodes_added = AstNode::Count() - count_before; 4031 int nodes_added = AstNode::Count() - count_before;
4030 if (FLAG_limit_inlining && nodes_added > kMaxInlinedSize) { 4032 if (FLAG_limit_inlining && nodes_added > kMaxInlinedSize) {
4031 if (FLAG_trace_inlining) TraceInline(target, false); 4033 if (FLAG_trace_inlining) TraceInline(target, false);
4032 return false; 4034 return false;
4033 } 4035 }
4034 4036
4035 // Check if we can handle all declarations in the inlined functions. 4037 // Check if we can handle all declarations in the inlined functions.
(...skipping 2005 matching lines...) Expand 10 before | Expand all | Expand 10 after
6041 } 6043 }
6042 } 6044 }
6043 6045
6044 #ifdef DEBUG 6046 #ifdef DEBUG
6045 if (graph_ != NULL) graph_->Verify(); 6047 if (graph_ != NULL) graph_->Verify();
6046 if (allocator_ != NULL) allocator_->Verify(); 6048 if (allocator_ != NULL) allocator_->Verify();
6047 #endif 6049 #endif
6048 } 6050 }
6049 6051
6050 } } // namespace v8::internal 6052 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/arm/lithium-codegen-arm.cc ('k') | src/ia32/deoptimizer-ia32.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698