| OLD | NEW |
| 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 903 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 914 } | 914 } |
| 915 | 915 |
| 916 | 916 |
| 917 bool CompileLazyShared(Handle<SharedFunctionInfo> shared, | 917 bool CompileLazyShared(Handle<SharedFunctionInfo> shared, |
| 918 ClearExceptionFlag flag) { | 918 ClearExceptionFlag flag) { |
| 919 CompilationInfo info(shared); | 919 CompilationInfo info(shared); |
| 920 return CompileLazyHelper(&info, flag); | 920 return CompileLazyHelper(&info, flag); |
| 921 } | 921 } |
| 922 | 922 |
| 923 | 923 |
| 924 static bool CompileLazyFunction(Handle<JSFunction> function, | 924 bool CompileLazy(Handle<JSFunction> function, ClearExceptionFlag flag) { |
| 925 ClearExceptionFlag flag, | |
| 926 InLoopFlag in_loop_flag) { | |
| 927 bool result = true; | 925 bool result = true; |
| 928 if (function->shared()->is_compiled()) { | 926 if (function->shared()->is_compiled()) { |
| 929 function->ReplaceCode(function->shared()->code()); | 927 function->ReplaceCode(function->shared()->code()); |
| 930 function->shared()->set_code_age(0); | 928 function->shared()->set_code_age(0); |
| 931 } else { | 929 } else { |
| 932 CompilationInfo info(function); | 930 CompilationInfo info(function); |
| 933 if (in_loop_flag == IN_LOOP) info.MarkAsInLoop(); | |
| 934 result = CompileLazyHelper(&info, flag); | 931 result = CompileLazyHelper(&info, flag); |
| 935 ASSERT(!result || function->is_compiled()); | 932 ASSERT(!result || function->is_compiled()); |
| 936 } | 933 } |
| 937 return result; | 934 return result; |
| 938 } | 935 } |
| 939 | 936 |
| 940 | 937 |
| 941 bool CompileLazy(Handle<JSFunction> function, | |
| 942 ClearExceptionFlag flag) { | |
| 943 return CompileLazyFunction(function, flag, NOT_IN_LOOP); | |
| 944 } | |
| 945 | |
| 946 | |
| 947 bool CompileLazyInLoop(Handle<JSFunction> function, | |
| 948 ClearExceptionFlag flag) { | |
| 949 return CompileLazyFunction(function, flag, IN_LOOP); | |
| 950 } | |
| 951 | |
| 952 | |
| 953 bool CompileOptimized(Handle<JSFunction> function, | 938 bool CompileOptimized(Handle<JSFunction> function, |
| 954 int osr_ast_id, | 939 int osr_ast_id, |
| 955 ClearExceptionFlag flag) { | 940 ClearExceptionFlag flag) { |
| 956 CompilationInfo info(function); | 941 CompilationInfo info(function); |
| 957 info.SetOptimizing(osr_ast_id); | 942 info.SetOptimizing(osr_ast_id); |
| 958 return CompileLazyHelper(&info, flag); | 943 return CompileLazyHelper(&info, flag); |
| 959 } | 944 } |
| 960 | 945 |
| 961 } } // namespace v8::internal | 946 } } // namespace v8::internal |
| OLD | NEW |