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

Side by Side Diff: src/mark-compact.cc

Issue 11818052: Fix shared function info code replacement. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Addressed comments by Hannes Payer. Created 7 years, 11 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 | « src/mark-compact.h ('k') | src/objects.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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
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;
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);
959 break;
960 }
961
962 candidate = next_candidate;
963 }
964 }
965 }
966
967
938 void CodeFlusher::EvictCandidate(JSFunction* function) { 968 void CodeFlusher::EvictCandidate(JSFunction* function) {
939 ASSERT(!function->next_function_link()->IsUndefined()); 969 ASSERT(!function->next_function_link()->IsUndefined());
940 Object* undefined = isolate_->heap()->undefined_value(); 970 Object* undefined = isolate_->heap()->undefined_value();
941 971
942 // The function is no longer a candidate, make sure it gets visited 972 // The function is no longer a candidate, make sure it gets visited
943 // again so that previous flushing decisions are revisited. 973 // again so that previous flushing decisions are revisited.
944 isolate_->heap()->incremental_marking()->RecordWrites(function); 974 isolate_->heap()->incremental_marking()->RecordWrites(function);
945 975
946 JSFunction* candidate = jsfunction_candidates_head_; 976 JSFunction* candidate = jsfunction_candidates_head_;
947 JSFunction* next_candidate; 977 JSFunction* next_candidate;
948 if (candidate == function) { 978 if (candidate == function) {
949 next_candidate = GetNextCandidate(function); 979 next_candidate = GetNextCandidate(function);
950 jsfunction_candidates_head_ = next_candidate; 980 jsfunction_candidates_head_ = next_candidate;
951 ClearNextCandidate(function, undefined); 981 ClearNextCandidate(function, undefined);
952 } else { 982 } else {
953 while (candidate != NULL) { 983 while (candidate != NULL) {
954 next_candidate = GetNextCandidate(candidate); 984 next_candidate = GetNextCandidate(candidate);
955 985
956 if (next_candidate == function) { 986 if (next_candidate == function) {
957 next_candidate = GetNextCandidate(function); 987 next_candidate = GetNextCandidate(function);
958 SetNextCandidate(candidate, next_candidate); 988 SetNextCandidate(candidate, next_candidate);
959 ClearNextCandidate(function, undefined); 989 ClearNextCandidate(function, undefined);
990 break;
960 } 991 }
961 992
962 candidate = next_candidate; 993 candidate = next_candidate;
963 } 994 }
964 } 995 }
965 } 996 }
966 997
967 998
968 void CodeFlusher::EvictJSFunctionCandidates() { 999 void CodeFlusher::EvictJSFunctionCandidates() {
969 Object* undefined = isolate_->heap()->undefined_value(); 1000 Object* undefined = isolate_->heap()->undefined_value();
(...skipping 2842 matching lines...) Expand 10 before | Expand all | Expand 10 after
3812 while (buffer != NULL) { 3843 while (buffer != NULL) {
3813 SlotsBuffer* next_buffer = buffer->next(); 3844 SlotsBuffer* next_buffer = buffer->next();
3814 DeallocateBuffer(buffer); 3845 DeallocateBuffer(buffer);
3815 buffer = next_buffer; 3846 buffer = next_buffer;
3816 } 3847 }
3817 *buffer_address = NULL; 3848 *buffer_address = NULL;
3818 } 3849 }
3819 3850
3820 3851
3821 } } // namespace v8::internal 3852 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/mark-compact.h ('k') | src/objects.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698