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

Side by Side Diff: src/handles.cc

Issue 6240012: Optimize calls to object literal properties that are initialized with a funct... (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: rebased and fixed lintos Created 9 years, 9 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/handles.h ('k') | src/hydrogen.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 2009 the V8 project authors. All rights reserved. 1 // Copyright 2009 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 940 matching lines...) Expand 10 before | Expand all | Expand 10 after
951 951
952 952
953 bool CompileOptimized(Handle<JSFunction> function, 953 bool CompileOptimized(Handle<JSFunction> function,
954 int osr_ast_id, 954 int osr_ast_id,
955 ClearExceptionFlag flag) { 955 ClearExceptionFlag flag) {
956 CompilationInfo info(function); 956 CompilationInfo info(function);
957 info.SetOptimizing(osr_ast_id); 957 info.SetOptimizing(osr_ast_id);
958 return CompileLazyHelper(&info, flag); 958 return CompileLazyHelper(&info, flag);
959 } 959 }
960 960
961
962 OptimizedObjectForAddingMultipleProperties::
963 OptimizedObjectForAddingMultipleProperties(Handle<JSObject> object,
964 int expected_additional_properties,
965 bool condition) {
966 object_ = object;
967 if (condition && object_->HasFastProperties() && !object->IsJSGlobalProxy()) {
968 // Normalize the properties of object to avoid n^2 behavior
969 // when extending the object multiple properties. Indicate the number of
970 // properties to be added.
971 unused_property_fields_ = object->map()->unused_property_fields();
972 NormalizeProperties(object_,
973 KEEP_INOBJECT_PROPERTIES,
974 expected_additional_properties);
975 has_been_transformed_ = true;
976
977 } else {
978 has_been_transformed_ = false;
979 }
980 }
981
982
983 OptimizedObjectForAddingMultipleProperties::
984 ~OptimizedObjectForAddingMultipleProperties() {
985 // Reoptimize the object to allow fast property access.
986 if (has_been_transformed_) {
987 TransformToFastProperties(object_, unused_property_fields_);
988 }
989 }
990
991 } } // namespace v8::internal 961 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/handles.h ('k') | src/hydrogen.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698