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

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: added x64 and arm code. 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
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 849 matching lines...) Expand 10 before | Expand all | Expand 10 after
860 860
861 861
862 bool CompileOptimized(Handle<JSFunction> function, int osr_ast_id) { 862 bool CompileOptimized(Handle<JSFunction> function, int osr_ast_id) {
863 CompilationInfo info(function); 863 CompilationInfo info(function);
864 info.SetOptimizing(osr_ast_id); 864 info.SetOptimizing(osr_ast_id);
865 bool result = CompileLazyHelper(&info, KEEP_EXCEPTION); 865 bool result = CompileLazyHelper(&info, KEEP_EXCEPTION);
866 if (result) PROFILE(FunctionCreateEvent(*function)); 866 if (result) PROFILE(FunctionCreateEvent(*function));
867 return result; 867 return result;
868 } 868 }
869 869
870
871 OptimizedObjectForAddingMultipleProperties::
872 OptimizedObjectForAddingMultipleProperties(Handle<JSObject> object,
873 int expected_additional_properties,
874 bool condition) {
875 object_ = object;
876 if (condition && object_->HasFastProperties()) {
877 // Normalize the properties of object to avoid n^2 behavior
878 // when extending the object multiple properties. Indicate the number of
879 // properties to be added.
880 unused_property_fields_ = object->map()->unused_property_fields();
881 NormalizeProperties(object_,
882 KEEP_INOBJECT_PROPERTIES,
883 expected_additional_properties);
884 has_been_transformed_ = true;
885
886 } else {
887 has_been_transformed_ = false;
888 }
889 }
890
891
892 OptimizedObjectForAddingMultipleProperties::
893 ~OptimizedObjectForAddingMultipleProperties() {
894 // Reoptimize the object to allow fast property access.
895 if (has_been_transformed_) {
896 TransformToFastProperties(object_, unused_property_fields_);
897 }
898 }
899
900 } } // namespace v8::internal 870 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/handles.h ('k') | src/hydrogen.cc » ('j') | src/hydrogen-instructions.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698