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

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

Issue 11141023: Switch code flushing to use different JSFunction field. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 8 years, 2 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/runtime.cc » ('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 843 matching lines...) Expand 10 before | Expand all | Expand 10 after
854 // the marking stack. Instead, we mark them as both marked and overflowed. 854 // the marking stack. Instead, we mark them as both marked and overflowed.
855 // When the stack is in the overflowed state, objects marked as overflowed 855 // When the stack is in the overflowed state, objects marked as overflowed
856 // have been reached and marked but their children have not been visited yet. 856 // have been reached and marked but their children have not been visited yet.
857 // After emptying the marking stack, we clear the overflow flag and traverse 857 // After emptying the marking stack, we clear the overflow flag and traverse
858 // the heap looking for objects marked as overflowed, push them on the stack, 858 // the heap looking for objects marked as overflowed, push them on the stack,
859 // and continue with marking. This process repeats until all reachable 859 // and continue with marking. This process repeats until all reachable
860 // objects have been marked. 860 // objects have been marked.
861 861
862 void CodeFlusher::ProcessJSFunctionCandidates() { 862 void CodeFlusher::ProcessJSFunctionCandidates() {
863 Code* lazy_compile = isolate_->builtins()->builtin(Builtins::kLazyCompile); 863 Code* lazy_compile = isolate_->builtins()->builtin(Builtins::kLazyCompile);
864 Object* undefined = isolate_->heap()->undefined_value();
864 865
865 JSFunction* candidate = jsfunction_candidates_head_; 866 JSFunction* candidate = jsfunction_candidates_head_;
866 JSFunction* next_candidate; 867 JSFunction* next_candidate;
867 while (candidate != NULL) { 868 while (candidate != NULL) {
868 next_candidate = GetNextCandidate(candidate); 869 next_candidate = GetNextCandidate(candidate);
870 ClearNextCandidate(candidate, undefined);
869 871
870 SharedFunctionInfo* shared = candidate->shared(); 872 SharedFunctionInfo* shared = candidate->shared();
871 873
872 Code* code = shared->code(); 874 Code* code = shared->code();
873 MarkBit code_mark = Marking::MarkBitFrom(code); 875 MarkBit code_mark = Marking::MarkBitFrom(code);
874 if (!code_mark.Get()) { 876 if (!code_mark.Get()) {
875 shared->set_code(lazy_compile); 877 shared->set_code(lazy_compile);
876 candidate->set_code(lazy_compile); 878 candidate->set_code(lazy_compile);
877 } else { 879 } else if (code == lazy_compile) {
878 candidate->set_code(shared->code()); 880 candidate->set_code(lazy_compile);
879 } 881 }
880 882
881 // We are in the middle of a GC cycle so the write barrier in the code 883 // We are in the middle of a GC cycle so the write barrier in the code
882 // setter did not record the slot update and we have to do that manually. 884 // setter did not record the slot update and we have to do that manually.
883 Address slot = candidate->address() + JSFunction::kCodeEntryOffset; 885 Address slot = candidate->address() + JSFunction::kCodeEntryOffset;
884 Code* target = Code::cast(Code::GetObjectFromEntryAddress(slot)); 886 Code* target = Code::cast(Code::GetObjectFromEntryAddress(slot));
885 isolate_->heap()->mark_compact_collector()-> 887 isolate_->heap()->mark_compact_collector()->
886 RecordCodeEntrySlot(slot, target); 888 RecordCodeEntrySlot(slot, target);
887 889
888 Object** shared_code_slot = 890 Object** shared_code_slot =
889 HeapObject::RawField(shared, SharedFunctionInfo::kCodeOffset); 891 HeapObject::RawField(shared, SharedFunctionInfo::kCodeOffset);
890 isolate_->heap()->mark_compact_collector()-> 892 isolate_->heap()->mark_compact_collector()->
891 RecordSlot(shared_code_slot, shared_code_slot, *shared_code_slot); 893 RecordSlot(shared_code_slot, shared_code_slot, *shared_code_slot);
892 894
893 candidate = next_candidate; 895 candidate = next_candidate;
894 } 896 }
895 897
896 jsfunction_candidates_head_ = NULL; 898 jsfunction_candidates_head_ = NULL;
897 } 899 }
898 900
899 901
900 void CodeFlusher::ProcessSharedFunctionInfoCandidates() { 902 void CodeFlusher::ProcessSharedFunctionInfoCandidates() {
901 Code* lazy_compile = isolate_->builtins()->builtin(Builtins::kLazyCompile); 903 Code* lazy_compile = isolate_->builtins()->builtin(Builtins::kLazyCompile);
902 904
903 SharedFunctionInfo* candidate = shared_function_info_candidates_head_; 905 SharedFunctionInfo* candidate = shared_function_info_candidates_head_;
904 SharedFunctionInfo* next_candidate; 906 SharedFunctionInfo* next_candidate;
905 while (candidate != NULL) { 907 while (candidate != NULL) {
906 next_candidate = GetNextCandidate(candidate); 908 next_candidate = GetNextCandidate(candidate);
907 SetNextCandidate(candidate, NULL); 909 ClearNextCandidate(candidate);
908 910
909 Code* code = candidate->code(); 911 Code* code = candidate->code();
910 MarkBit code_mark = Marking::MarkBitFrom(code); 912 MarkBit code_mark = Marking::MarkBitFrom(code);
911 if (!code_mark.Get()) { 913 if (!code_mark.Get()) {
912 candidate->set_code(lazy_compile); 914 candidate->set_code(lazy_compile);
913 } 915 }
914 916
915 Object** code_slot = 917 Object** code_slot =
916 HeapObject::RawField(candidate, SharedFunctionInfo::kCodeOffset); 918 HeapObject::RawField(candidate, SharedFunctionInfo::kCodeOffset);
917 isolate_->heap()->mark_compact_collector()-> 919 isolate_->heap()->mark_compact_collector()->
(...skipping 2835 matching lines...) Expand 10 before | Expand all | Expand 10 after
3753 while (buffer != NULL) { 3755 while (buffer != NULL) {
3754 SlotsBuffer* next_buffer = buffer->next(); 3756 SlotsBuffer* next_buffer = buffer->next();
3755 DeallocateBuffer(buffer); 3757 DeallocateBuffer(buffer);
3756 buffer = next_buffer; 3758 buffer = next_buffer;
3757 } 3759 }
3758 *buffer_address = NULL; 3760 *buffer_address = NULL;
3759 } 3761 }
3760 3762
3761 3763
3762 } } // namespace v8::internal 3764 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/mark-compact.h ('k') | src/runtime.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698