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

Side by Side Diff: src/handles.cc

Issue 6542017: Minor refactoring: unify lazy function compilation for in loop and no in loop variants. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Switching to enum 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 | « 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 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 816 matching lines...) Expand 10 before | Expand all | Expand 10 after
827 } 827 }
828 828
829 829
830 bool CompileLazyShared(Handle<SharedFunctionInfo> shared, 830 bool CompileLazyShared(Handle<SharedFunctionInfo> shared,
831 ClearExceptionFlag flag) { 831 ClearExceptionFlag flag) {
832 CompilationInfo info(shared); 832 CompilationInfo info(shared);
833 return CompileLazyHelper(&info, flag); 833 return CompileLazyHelper(&info, flag);
834 } 834 }
835 835
836 836
837 bool CompileLazy(Handle<JSFunction> function, 837 static bool CompileLazyFunction(Handle<JSFunction> function,
838 ClearExceptionFlag flag) { 838 ClearExceptionFlag flag,
839 InLoopFlag in_loop_flag) {
839 bool result = true; 840 bool result = true;
840 if (function->shared()->is_compiled()) { 841 if (function->shared()->is_compiled()) {
841 function->ReplaceCode(function->shared()->code()); 842 function->ReplaceCode(function->shared()->code());
842 function->shared()->set_code_age(0); 843 function->shared()->set_code_age(0);
843 } else { 844 } else {
844 CompilationInfo info(function); 845 CompilationInfo info(function);
846 if (in_loop_flag == IN_LOOP) info.MarkAsInLoop();
845 result = CompileLazyHelper(&info, flag); 847 result = CompileLazyHelper(&info, flag);
846 ASSERT(!result || function->is_compiled()); 848 ASSERT(!result || function->is_compiled());
847 } 849 }
848 if (result && function->is_compiled()) { 850 if (result && function->is_compiled()) {
849 PROFILE(FunctionCreateEvent(*function)); 851 PROFILE(FunctionCreateEvent(*function));
850 } 852 }
851 return result; 853 return result;
852 } 854 }
853 855
854 856
857 bool CompileLazy(Handle<JSFunction> function,
858 ClearExceptionFlag flag) {
859 return CompileLazyFunction(function, flag, NOT_IN_LOOP);
860 }
861
862
855 bool CompileLazyInLoop(Handle<JSFunction> function, 863 bool CompileLazyInLoop(Handle<JSFunction> function,
856 ClearExceptionFlag flag) { 864 ClearExceptionFlag flag) {
857 bool result = true; 865 return CompileLazyFunction(function, flag, IN_LOOP);
858 if (function->shared()->is_compiled()) {
859 function->ReplaceCode(function->shared()->code());
860 function->shared()->set_code_age(0);
861 } else {
862 CompilationInfo info(function);
863 info.MarkAsInLoop();
864 result = CompileLazyHelper(&info, flag);
865 ASSERT(!result || function->is_compiled());
866 }
867 if (result && function->is_compiled()) {
868 PROFILE(FunctionCreateEvent(*function));
869 }
870 return result;
871 } 866 }
872 867
873 868
874 bool CompileOptimized(Handle<JSFunction> function, int osr_ast_id) { 869 bool CompileOptimized(Handle<JSFunction> function, int osr_ast_id) {
875 CompilationInfo info(function); 870 CompilationInfo info(function);
876 info.SetOptimizing(osr_ast_id); 871 info.SetOptimizing(osr_ast_id);
877 bool result = CompileLazyHelper(&info, KEEP_EXCEPTION); 872 bool result = CompileLazyHelper(&info, KEEP_EXCEPTION);
878 if (result) PROFILE(FunctionCreateEvent(*function)); 873 if (result) PROFILE(FunctionCreateEvent(*function));
879 return result; 874 return result;
880 } 875 }
(...skipping 22 matching lines...) Expand all
903 898
904 OptimizedObjectForAddingMultipleProperties:: 899 OptimizedObjectForAddingMultipleProperties::
905 ~OptimizedObjectForAddingMultipleProperties() { 900 ~OptimizedObjectForAddingMultipleProperties() {
906 // Reoptimize the object to allow fast property access. 901 // Reoptimize the object to allow fast property access.
907 if (has_been_transformed_) { 902 if (has_been_transformed_) {
908 TransformToFastProperties(object_, unused_property_fields_); 903 TransformToFastProperties(object_, unused_property_fields_);
909 } 904 }
910 } 905 }
911 906
912 } } // namespace v8::internal 907 } } // 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