Chromium Code Reviews| 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 ASSERT(shared_info->code()->gc_metadata() != NULL); | |
| 940 | |
| 941 // The function is no longer a candidate, make sure it gets visited | |
| 942 // again so that previous flushing decisions are revisited. | |
| 943 isolate_->heap()->incremental_marking()->RecordWrites(shared_info); | |
| 944 | |
| 945 SharedFunctionInfo* candidate = shared_function_info_candidates_head_; | |
| 946 SharedFunctionInfo* next_candidate; | |
|
Hannes Payer (out of office)
2013/01/11 10:09:51
Why is there a difference between shared_info bein
Michael Starzinger
2013/01/11 12:27:22
The head needs to be handles specially, because it
| |
| 947 if (candidate == shared_info) { | |
| 948 next_candidate = GetNextCandidate(shared_info); | |
| 949 shared_function_info_candidates_head_ = next_candidate; | |
| 950 ClearNextCandidate(shared_info); | |
| 951 } else { | |
| 952 while (candidate != NULL) { | |
| 953 next_candidate = GetNextCandidate(candidate); | |
| 954 | |
| 955 if (next_candidate == shared_info) { | |
| 956 next_candidate = GetNextCandidate(shared_info); | |
| 957 SetNextCandidate(candidate, next_candidate); | |
| 958 ClearNextCandidate(shared_info); | |
|
Michael Starzinger
2013/01/11 12:27:22
As discussed offline, I added a break here.
| |
| 959 } | |
| 960 | |
| 961 candidate = next_candidate; | |
| 962 } | |
| 963 } | |
| 964 } | |
| 965 | |
| 966 | |
| 938 void CodeFlusher::EvictCandidate(JSFunction* function) { | 967 void CodeFlusher::EvictCandidate(JSFunction* function) { |
| 939 ASSERT(!function->next_function_link()->IsUndefined()); | 968 ASSERT(!function->next_function_link()->IsUndefined()); |
| 940 Object* undefined = isolate_->heap()->undefined_value(); | 969 Object* undefined = isolate_->heap()->undefined_value(); |
| 941 | 970 |
| 942 // The function is no longer a candidate, make sure it gets visited | 971 // The function is no longer a candidate, make sure it gets visited |
| 943 // again so that previous flushing decisions are revisited. | 972 // again so that previous flushing decisions are revisited. |
| 944 isolate_->heap()->incremental_marking()->RecordWrites(function); | 973 isolate_->heap()->incremental_marking()->RecordWrites(function); |
| 945 | 974 |
| 946 JSFunction* candidate = jsfunction_candidates_head_; | 975 JSFunction* candidate = jsfunction_candidates_head_; |
| 947 JSFunction* next_candidate; | 976 JSFunction* next_candidate; |
| 948 if (candidate == function) { | 977 if (candidate == function) { |
| 949 next_candidate = GetNextCandidate(function); | 978 next_candidate = GetNextCandidate(function); |
| 950 jsfunction_candidates_head_ = next_candidate; | 979 jsfunction_candidates_head_ = next_candidate; |
| 951 ClearNextCandidate(function, undefined); | 980 ClearNextCandidate(function, undefined); |
| 952 } else { | 981 } else { |
| 953 while (candidate != NULL) { | 982 while (candidate != NULL) { |
| 954 next_candidate = GetNextCandidate(candidate); | 983 next_candidate = GetNextCandidate(candidate); |
| 955 | 984 |
| 956 if (next_candidate == function) { | 985 if (next_candidate == function) { |
| 957 next_candidate = GetNextCandidate(function); | 986 next_candidate = GetNextCandidate(function); |
| 958 SetNextCandidate(candidate, next_candidate); | 987 SetNextCandidate(candidate, next_candidate); |
| 959 ClearNextCandidate(function, undefined); | 988 ClearNextCandidate(function, undefined); |
|
Michael Starzinger
2013/01/11 12:27:22
Likewise.
| |
| 960 } | 989 } |
| 961 | 990 |
| 962 candidate = next_candidate; | 991 candidate = next_candidate; |
| 963 } | 992 } |
| 964 } | 993 } |
| 965 } | 994 } |
| 966 | 995 |
| 967 | 996 |
| 968 void CodeFlusher::EvictJSFunctionCandidates() { | 997 void CodeFlusher::EvictJSFunctionCandidates() { |
| 969 Object* undefined = isolate_->heap()->undefined_value(); | 998 Object* undefined = isolate_->heap()->undefined_value(); |
| (...skipping 2842 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 3812 while (buffer != NULL) { | 3841 while (buffer != NULL) { |
| 3813 SlotsBuffer* next_buffer = buffer->next(); | 3842 SlotsBuffer* next_buffer = buffer->next(); |
| 3814 DeallocateBuffer(buffer); | 3843 DeallocateBuffer(buffer); |
| 3815 buffer = next_buffer; | 3844 buffer = next_buffer; |
| 3816 } | 3845 } |
| 3817 *buffer_address = NULL; | 3846 *buffer_address = NULL; |
| 3818 } | 3847 } |
| 3819 | 3848 |
| 3820 | 3849 |
| 3821 } } // namespace v8::internal | 3850 } } // namespace v8::internal |
| OLD | NEW |