| OLD | NEW |
| 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 753 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 764 bool CompileLazyShared(Handle<SharedFunctionInfo> shared, | 764 bool CompileLazyShared(Handle<SharedFunctionInfo> shared, |
| 765 ClearExceptionFlag flag) { | 765 ClearExceptionFlag flag) { |
| 766 CompilationInfo info(shared); | 766 CompilationInfo info(shared); |
| 767 return CompileLazyHelper(&info, flag); | 767 return CompileLazyHelper(&info, flag); |
| 768 } | 768 } |
| 769 | 769 |
| 770 | 770 |
| 771 bool CompileLazy(Handle<JSFunction> function, | 771 bool CompileLazy(Handle<JSFunction> function, |
| 772 Handle<Object> receiver, | 772 Handle<Object> receiver, |
| 773 ClearExceptionFlag flag) { | 773 ClearExceptionFlag flag) { |
| 774 CompilationInfo info(function, 0, receiver); | 774 if (function->shared()->is_compiled()) { |
| 775 bool result = CompileLazyHelper(&info, flag); | 775 function->set_code(function->shared()->code()); |
| 776 PROFILE(FunctionCreateEvent(*function)); | 776 return true; |
| 777 return result; | 777 } else { |
| 778 CompilationInfo info(function, 0, receiver); |
| 779 bool result = CompileLazyHelper(&info, flag); |
| 780 PROFILE(FunctionCreateEvent(*function)); |
| 781 return result; |
| 782 } |
| 778 } | 783 } |
| 779 | 784 |
| 780 | 785 |
| 781 bool CompileLazyInLoop(Handle<JSFunction> function, | 786 bool CompileLazyInLoop(Handle<JSFunction> function, |
| 782 Handle<Object> receiver, | 787 Handle<Object> receiver, |
| 783 ClearExceptionFlag flag) { | 788 ClearExceptionFlag flag) { |
| 784 CompilationInfo info(function, 1, receiver); | 789 if (function->shared()->is_compiled()) { |
| 785 bool result = CompileLazyHelper(&info, flag); | 790 function->set_code(function->shared()->code()); |
| 786 PROFILE(FunctionCreateEvent(*function)); | 791 return true; |
| 787 return result; | 792 } else { |
| 793 CompilationInfo info(function, 1, receiver); |
| 794 bool result = CompileLazyHelper(&info, flag); |
| 795 PROFILE(FunctionCreateEvent(*function)); |
| 796 return result; |
| 797 } |
| 788 } | 798 } |
| 789 | 799 |
| 790 | 800 |
| 791 OptimizedObjectForAddingMultipleProperties:: | 801 OptimizedObjectForAddingMultipleProperties:: |
| 792 OptimizedObjectForAddingMultipleProperties(Handle<JSObject> object, | 802 OptimizedObjectForAddingMultipleProperties(Handle<JSObject> object, |
| 793 int expected_additional_properties, | 803 int expected_additional_properties, |
| 794 bool condition) { | 804 bool condition) { |
| 795 object_ = object; | 805 object_ = object; |
| 796 if (condition && object_->HasFastProperties()) { | 806 if (condition && object_->HasFastProperties()) { |
| 797 // Normalize the properties of object to avoid n^2 behavior | 807 // Normalize the properties of object to avoid n^2 behavior |
| (...skipping 18 matching lines...) Expand all Loading... |
| 816 | 826 |
| 817 OptimizedObjectForAddingMultipleProperties:: | 827 OptimizedObjectForAddingMultipleProperties:: |
| 818 ~OptimizedObjectForAddingMultipleProperties() { | 828 ~OptimizedObjectForAddingMultipleProperties() { |
| 819 // Reoptimize the object to allow fast property access. | 829 // Reoptimize the object to allow fast property access. |
| 820 if (has_been_transformed_) { | 830 if (has_been_transformed_) { |
| 821 TransformToFastProperties(object_, unused_property_fields_); | 831 TransformToFastProperties(object_, unused_property_fields_); |
| 822 } | 832 } |
| 823 } | 833 } |
| 824 | 834 |
| 825 } } // namespace v8::internal | 835 } } // namespace v8::internal |
| OLD | NEW |