| 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 791 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 802 candidate->set_code(shared->code()); | 802 candidate->set_code(shared->code()); |
| 803 } | 803 } |
| 804 | 804 |
| 805 // We are in the middle of a GC cycle so the write barrier in the code | 805 // We are in the middle of a GC cycle so the write barrier in the code |
| 806 // setter did not record the slot update and we have to do that manually. | 806 // setter did not record the slot update and we have to do that manually. |
| 807 Address slot = candidate->address() + JSFunction::kCodeEntryOffset; | 807 Address slot = candidate->address() + JSFunction::kCodeEntryOffset; |
| 808 Code* target = Code::cast(Code::GetObjectFromEntryAddress(slot)); | 808 Code* target = Code::cast(Code::GetObjectFromEntryAddress(slot)); |
| 809 isolate_->heap()->mark_compact_collector()-> | 809 isolate_->heap()->mark_compact_collector()-> |
| 810 RecordCodeEntrySlot(slot, target); | 810 RecordCodeEntrySlot(slot, target); |
| 811 | 811 |
| 812 RecordSharedFunctionInfoCodeSlot(shared); |
| 813 |
| 812 candidate = next_candidate; | 814 candidate = next_candidate; |
| 813 } | 815 } |
| 814 | 816 |
| 815 jsfunction_candidates_head_ = NULL; | 817 jsfunction_candidates_head_ = NULL; |
| 816 } | 818 } |
| 817 | 819 |
| 818 | 820 |
| 819 void ProcessSharedFunctionInfoCandidates() { | 821 void ProcessSharedFunctionInfoCandidates() { |
| 820 Code* lazy_compile = isolate_->builtins()->builtin(Builtins::kLazyCompile); | 822 Code* lazy_compile = isolate_->builtins()->builtin(Builtins::kLazyCompile); |
| 821 | 823 |
| 822 SharedFunctionInfo* candidate = shared_function_info_candidates_head_; | 824 SharedFunctionInfo* candidate = shared_function_info_candidates_head_; |
| 823 SharedFunctionInfo* next_candidate; | 825 SharedFunctionInfo* next_candidate; |
| 824 while (candidate != NULL) { | 826 while (candidate != NULL) { |
| 825 next_candidate = GetNextCandidate(candidate); | 827 next_candidate = GetNextCandidate(candidate); |
| 826 SetNextCandidate(candidate, NULL); | 828 SetNextCandidate(candidate, NULL); |
| 827 | 829 |
| 828 Code* code = candidate->code(); | 830 Code* code = candidate->code(); |
| 829 MarkBit code_mark = Marking::MarkBitFrom(code); | 831 MarkBit code_mark = Marking::MarkBitFrom(code); |
| 830 if (!code_mark.Get()) { | 832 if (!code_mark.Get()) { |
| 831 candidate->set_code(lazy_compile); | 833 candidate->set_code(lazy_compile); |
| 832 } | 834 } |
| 833 | 835 |
| 836 RecordSharedFunctionInfoCodeSlot(candidate); |
| 837 |
| 834 candidate = next_candidate; | 838 candidate = next_candidate; |
| 835 } | 839 } |
| 836 | 840 |
| 837 shared_function_info_candidates_head_ = NULL; | 841 shared_function_info_candidates_head_ = NULL; |
| 838 } | 842 } |
| 839 | 843 |
| 844 void RecordSharedFunctionInfoCodeSlot(SharedFunctionInfo* shared) { |
| 845 Object** slot = HeapObject::RawField(shared, |
| 846 SharedFunctionInfo::kCodeOffset); |
| 847 isolate_->heap()->mark_compact_collector()-> |
| 848 RecordSlot(slot, slot, HeapObject::cast(*slot)); |
| 849 } |
| 850 |
| 840 static JSFunction** GetNextCandidateField(JSFunction* candidate) { | 851 static JSFunction** GetNextCandidateField(JSFunction* candidate) { |
| 841 return reinterpret_cast<JSFunction**>( | 852 return reinterpret_cast<JSFunction**>( |
| 842 candidate->address() + JSFunction::kCodeEntryOffset); | 853 candidate->address() + JSFunction::kCodeEntryOffset); |
| 843 } | 854 } |
| 844 | 855 |
| 845 static JSFunction* GetNextCandidate(JSFunction* candidate) { | 856 static JSFunction* GetNextCandidate(JSFunction* candidate) { |
| 846 return *GetNextCandidateField(candidate); | 857 return *GetNextCandidateField(candidate); |
| 847 } | 858 } |
| 848 | 859 |
| 849 static void SetNextCandidate(JSFunction* candidate, | 860 static void SetNextCandidate(JSFunction* candidate, |
| (...skipping 3236 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4086 while (buffer != NULL) { | 4097 while (buffer != NULL) { |
| 4087 SlotsBuffer* next_buffer = buffer->next(); | 4098 SlotsBuffer* next_buffer = buffer->next(); |
| 4088 DeallocateBuffer(buffer); | 4099 DeallocateBuffer(buffer); |
| 4089 buffer = next_buffer; | 4100 buffer = next_buffer; |
| 4090 } | 4101 } |
| 4091 *buffer_address = NULL; | 4102 *buffer_address = NULL; |
| 4092 } | 4103 } |
| 4093 | 4104 |
| 4094 | 4105 |
| 4095 } } // namespace v8::internal | 4106 } } // namespace v8::internal |
| OLD | NEW |