OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "src/v8.h" | 5 #include "src/v8.h" |
6 | 6 |
7 #include "src/base/atomicops.h" | 7 #include "src/base/atomicops.h" |
8 #include "src/base/bits.h" | 8 #include "src/base/bits.h" |
9 #include "src/code-stubs.h" | 9 #include "src/code-stubs.h" |
10 #include "src/compilation-cache.h" | 10 #include "src/compilation-cache.h" |
(...skipping 880 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
891 SharedFunctionInfo* shared = candidate->shared(); | 891 SharedFunctionInfo* shared = candidate->shared(); |
892 | 892 |
893 Code* code = shared->code(); | 893 Code* code = shared->code(); |
894 MarkBit code_mark = Marking::MarkBitFrom(code); | 894 MarkBit code_mark = Marking::MarkBitFrom(code); |
895 if (Marking::IsWhite(code_mark)) { | 895 if (Marking::IsWhite(code_mark)) { |
896 if (FLAG_trace_code_flushing && shared->is_compiled()) { | 896 if (FLAG_trace_code_flushing && shared->is_compiled()) { |
897 PrintF("[code-flushing clears: "); | 897 PrintF("[code-flushing clears: "); |
898 shared->ShortPrint(); | 898 shared->ShortPrint(); |
899 PrintF(" - age: %d]\n", code->GetAge()); | 899 PrintF(" - age: %d]\n", code->GetAge()); |
900 } | 900 } |
| 901 // Always flush the optimized code map if requested by flag. |
| 902 if (FLAG_cache_optimized_code && FLAG_flush_optimized_code_cache && |
| 903 !shared->optimized_code_map()->IsSmi()) { |
| 904 shared->ClearOptimizedCodeMap(); |
| 905 } |
901 shared->set_code(lazy_compile); | 906 shared->set_code(lazy_compile); |
902 candidate->set_code(lazy_compile); | 907 candidate->set_code(lazy_compile); |
903 } else { | 908 } else { |
904 DCHECK(Marking::IsBlack(code_mark)); | 909 DCHECK(Marking::IsBlack(code_mark)); |
905 candidate->set_code(code); | 910 candidate->set_code(code); |
906 } | 911 } |
907 | 912 |
908 // We are in the middle of a GC cycle so the write barrier in the code | 913 // We are in the middle of a GC cycle so the write barrier in the code |
909 // setter did not record the slot update and we have to do that manually. | 914 // setter did not record the slot update and we have to do that manually. |
910 Address slot = candidate->address() + JSFunction::kCodeEntryOffset; | 915 Address slot = candidate->address() + JSFunction::kCodeEntryOffset; |
(...skipping 23 matching lines...) Expand all Loading... |
934 ClearNextCandidate(candidate); | 939 ClearNextCandidate(candidate); |
935 | 940 |
936 Code* code = candidate->code(); | 941 Code* code = candidate->code(); |
937 MarkBit code_mark = Marking::MarkBitFrom(code); | 942 MarkBit code_mark = Marking::MarkBitFrom(code); |
938 if (Marking::IsWhite(code_mark)) { | 943 if (Marking::IsWhite(code_mark)) { |
939 if (FLAG_trace_code_flushing && candidate->is_compiled()) { | 944 if (FLAG_trace_code_flushing && candidate->is_compiled()) { |
940 PrintF("[code-flushing clears: "); | 945 PrintF("[code-flushing clears: "); |
941 candidate->ShortPrint(); | 946 candidate->ShortPrint(); |
942 PrintF(" - age: %d]\n", code->GetAge()); | 947 PrintF(" - age: %d]\n", code->GetAge()); |
943 } | 948 } |
| 949 // Always flush the optimized code map if requested by flag. |
| 950 if (FLAG_cache_optimized_code && FLAG_flush_optimized_code_cache && |
| 951 !candidate->optimized_code_map()->IsSmi()) { |
| 952 candidate->ClearOptimizedCodeMap(); |
| 953 } |
944 candidate->set_code(lazy_compile); | 954 candidate->set_code(lazy_compile); |
945 } | 955 } |
946 | 956 |
947 Object** code_slot = | 957 Object** code_slot = |
948 HeapObject::RawField(candidate, SharedFunctionInfo::kCodeOffset); | 958 HeapObject::RawField(candidate, SharedFunctionInfo::kCodeOffset); |
949 isolate_->heap()->mark_compact_collector()->RecordSlot(code_slot, code_slot, | 959 isolate_->heap()->mark_compact_collector()->RecordSlot(code_slot, code_slot, |
950 *code_slot); | 960 *code_slot); |
951 | 961 |
952 candidate = next_candidate; | 962 candidate = next_candidate; |
953 } | 963 } |
(...skipping 3782 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4736 SlotsBuffer* buffer = *buffer_address; | 4746 SlotsBuffer* buffer = *buffer_address; |
4737 while (buffer != NULL) { | 4747 while (buffer != NULL) { |
4738 SlotsBuffer* next_buffer = buffer->next(); | 4748 SlotsBuffer* next_buffer = buffer->next(); |
4739 DeallocateBuffer(buffer); | 4749 DeallocateBuffer(buffer); |
4740 buffer = next_buffer; | 4750 buffer = next_buffer; |
4741 } | 4751 } |
4742 *buffer_address = NULL; | 4752 *buffer_address = NULL; |
4743 } | 4753 } |
4744 } // namespace internal | 4754 } // namespace internal |
4745 } // namespace v8 | 4755 } // namespace v8 |
OLD | NEW |