| OLD | NEW |
| 1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 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 867 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 878 next_candidate = GetNextCandidate(candidate); | 878 next_candidate = GetNextCandidate(candidate); |
| 879 ClearNextCandidate(candidate, undefined); | 879 ClearNextCandidate(candidate, undefined); |
| 880 | 880 |
| 881 SharedFunctionInfo* shared = candidate->shared(); | 881 SharedFunctionInfo* shared = candidate->shared(); |
| 882 | 882 |
| 883 Code* code = shared->code(); | 883 Code* code = shared->code(); |
| 884 MarkBit code_mark = Marking::MarkBitFrom(code); | 884 MarkBit code_mark = Marking::MarkBitFrom(code); |
| 885 if (!code_mark.Get()) { | 885 if (!code_mark.Get()) { |
| 886 shared->set_code(lazy_compile); | 886 shared->set_code(lazy_compile); |
| 887 candidate->set_code(lazy_compile); | 887 candidate->set_code(lazy_compile); |
| 888 } else if (code == lazy_compile) { | 888 } else { |
| 889 candidate->set_code(lazy_compile); | 889 candidate->set_code(code); |
| 890 } | 890 } |
| 891 | 891 |
| 892 // We are in the middle of a GC cycle so the write barrier in the code | 892 // We are in the middle of a GC cycle so the write barrier in the code |
| 893 // setter did not record the slot update and we have to do that manually. | 893 // setter did not record the slot update and we have to do that manually. |
| 894 Address slot = candidate->address() + JSFunction::kCodeEntryOffset; | 894 Address slot = candidate->address() + JSFunction::kCodeEntryOffset; |
| 895 Code* target = Code::cast(Code::GetObjectFromEntryAddress(slot)); | 895 Code* target = Code::cast(Code::GetObjectFromEntryAddress(slot)); |
| 896 isolate_->heap()->mark_compact_collector()-> | 896 isolate_->heap()->mark_compact_collector()-> |
| 897 RecordCodeEntrySlot(slot, target); | 897 RecordCodeEntrySlot(slot, target); |
| 898 | 898 |
| 899 Object** shared_code_slot = | 899 Object** shared_code_slot = |
| (...skipping 28 matching lines...) Expand all Loading... |
| 928 isolate_->heap()->mark_compact_collector()-> | 928 isolate_->heap()->mark_compact_collector()-> |
| 929 RecordSlot(code_slot, code_slot, *code_slot); | 929 RecordSlot(code_slot, code_slot, *code_slot); |
| 930 | 930 |
| 931 candidate = next_candidate; | 931 candidate = next_candidate; |
| 932 } | 932 } |
| 933 | 933 |
| 934 shared_function_info_candidates_head_ = NULL; | 934 shared_function_info_candidates_head_ = NULL; |
| 935 } | 935 } |
| 936 | 936 |
| 937 | 937 |
| 938 void CodeFlusher::EvictCandidate(SharedFunctionInfo* shared_info) { |
| 939 // Make sure previous flushing decisions are revisited. |
| 940 isolate_->heap()->incremental_marking()->RecordWrites(shared_info); |
| 941 |
| 942 SharedFunctionInfo* candidate = shared_function_info_candidates_head_; |
| 943 SharedFunctionInfo* next_candidate; |
| 944 if (candidate == shared_info) { |
| 945 next_candidate = GetNextCandidate(shared_info); |
| 946 shared_function_info_candidates_head_ = next_candidate; |
| 947 ClearNextCandidate(shared_info); |
| 948 } else { |
| 949 while (candidate != NULL) { |
| 950 next_candidate = GetNextCandidate(candidate); |
| 951 |
| 952 if (next_candidate == shared_info) { |
| 953 next_candidate = GetNextCandidate(shared_info); |
| 954 SetNextCandidate(candidate, next_candidate); |
| 955 ClearNextCandidate(shared_info); |
| 956 break; |
| 957 } |
| 958 |
| 959 candidate = next_candidate; |
| 960 } |
| 961 } |
| 962 } |
| 963 |
| 964 |
| 938 void CodeFlusher::EvictCandidate(JSFunction* function) { | 965 void CodeFlusher::EvictCandidate(JSFunction* function) { |
| 939 ASSERT(!function->next_function_link()->IsUndefined()); | 966 ASSERT(!function->next_function_link()->IsUndefined()); |
| 940 Object* undefined = isolate_->heap()->undefined_value(); | 967 Object* undefined = isolate_->heap()->undefined_value(); |
| 941 | 968 |
| 942 // The function is no longer a candidate, make sure it gets visited | 969 // Make sure previous flushing decisions are revisited. |
| 943 // again so that previous flushing decisions are revisited. | |
| 944 isolate_->heap()->incremental_marking()->RecordWrites(function); | 970 isolate_->heap()->incremental_marking()->RecordWrites(function); |
| 971 isolate_->heap()->incremental_marking()->RecordWrites(function->shared()); |
| 945 | 972 |
| 946 JSFunction* candidate = jsfunction_candidates_head_; | 973 JSFunction* candidate = jsfunction_candidates_head_; |
| 947 JSFunction* next_candidate; | 974 JSFunction* next_candidate; |
| 948 if (candidate == function) { | 975 if (candidate == function) { |
| 949 next_candidate = GetNextCandidate(function); | 976 next_candidate = GetNextCandidate(function); |
| 950 jsfunction_candidates_head_ = next_candidate; | 977 jsfunction_candidates_head_ = next_candidate; |
| 951 ClearNextCandidate(function, undefined); | 978 ClearNextCandidate(function, undefined); |
| 952 } else { | 979 } else { |
| 953 while (candidate != NULL) { | 980 while (candidate != NULL) { |
| 954 next_candidate = GetNextCandidate(candidate); | 981 next_candidate = GetNextCandidate(candidate); |
| 955 | 982 |
| 956 if (next_candidate == function) { | 983 if (next_candidate == function) { |
| 957 next_candidate = GetNextCandidate(function); | 984 next_candidate = GetNextCandidate(function); |
| 958 SetNextCandidate(candidate, next_candidate); | 985 SetNextCandidate(candidate, next_candidate); |
| 959 ClearNextCandidate(function, undefined); | 986 ClearNextCandidate(function, undefined); |
| 987 break; |
| 960 } | 988 } |
| 961 | 989 |
| 962 candidate = next_candidate; | 990 candidate = next_candidate; |
| 963 } | 991 } |
| 964 } | 992 } |
| 965 } | 993 } |
| 966 | 994 |
| 967 | 995 |
| 968 void CodeFlusher::EvictJSFunctionCandidates() { | 996 void CodeFlusher::EvictJSFunctionCandidates() { |
| 969 Object* undefined = isolate_->heap()->undefined_value(); | 997 Object* undefined = isolate_->heap()->undefined_value(); |
| (...skipping 2842 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3812 while (buffer != NULL) { | 3840 while (buffer != NULL) { |
| 3813 SlotsBuffer* next_buffer = buffer->next(); | 3841 SlotsBuffer* next_buffer = buffer->next(); |
| 3814 DeallocateBuffer(buffer); | 3842 DeallocateBuffer(buffer); |
| 3815 buffer = next_buffer; | 3843 buffer = next_buffer; |
| 3816 } | 3844 } |
| 3817 *buffer_address = NULL; | 3845 *buffer_address = NULL; |
| 3818 } | 3846 } |
| 3819 | 3847 |
| 3820 | 3848 |
| 3821 } } // namespace v8::internal | 3849 } } // namespace v8::internal |
| OLD | NEW |