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

Side by Side Diff: src/parser.cc

Issue 8746018: Only make function literals in top-level object literals pretenured and constant function propert... (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: Created 9 years 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 | « no previous file | no next file » | 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 3826 matching lines...) Expand 10 before | Expand all | Expand 10 after
3837 return NULL; 3837 return NULL;
3838 } 3838 }
3839 } 3839 }
3840 3840
3841 Expect(Token::COLON, CHECK_OK); 3841 Expect(Token::COLON, CHECK_OK);
3842 Expression* value = ParseAssignmentExpression(true, CHECK_OK); 3842 Expression* value = ParseAssignmentExpression(true, CHECK_OK);
3843 3843
3844 ObjectLiteral::Property* property = 3844 ObjectLiteral::Property* property =
3845 new(zone()) ObjectLiteral::Property(key, value); 3845 new(zone()) ObjectLiteral::Property(key, value);
3846 3846
3847 // Mark object literals that contain function literals and pretenure the 3847 // Mark top-level object literals that contain function literals and
3848 // literal so it can be added as a constant function property. 3848 // pretenure the literal so it can be added as a constant function
3849 if (value->AsFunctionLiteral() != NULL) { 3849 // property.
3850 if (top_scope_->DeclarationScope()->is_global_scope() &&
3851 value->AsFunctionLiteral() != NULL) {
3850 has_function = true; 3852 has_function = true;
3851 value->AsFunctionLiteral()->set_pretenure(); 3853 value->AsFunctionLiteral()->set_pretenure();
3852 } 3854 }
3853 3855
3854 // Count CONSTANT or COMPUTED properties to maintain the enumeration order. 3856 // Count CONSTANT or COMPUTED properties to maintain the enumeration order.
3855 if (IsBoilerplateProperty(property)) number_of_boilerplate_properties++; 3857 if (IsBoilerplateProperty(property)) number_of_boilerplate_properties++;
3856 // Validate the property 3858 // Validate the property
3857 checker.CheckProperty(property, loc, CHECK_OK); 3859 checker.CheckProperty(property, loc, CHECK_OK);
3858 properties->Add(property); 3860 properties->Add(property);
3859 3861
(...skipping 1792 matching lines...) Expand 10 before | Expand all | Expand 10 after
5652 ASSERT(info->isolate()->has_pending_exception()); 5654 ASSERT(info->isolate()->has_pending_exception());
5653 } else { 5655 } else {
5654 result = parser.ParseProgram(info); 5656 result = parser.ParseProgram(info);
5655 } 5657 }
5656 } 5658 }
5657 info->SetFunction(result); 5659 info->SetFunction(result);
5658 return (result != NULL); 5660 return (result != NULL);
5659 } 5661 }
5660 5662
5661 } } // namespace v8::internal 5663 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698