| 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 3832 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3843 | 3843 |
| 3844 // Copy code object. | 3844 // Copy code object. |
| 3845 Address old_addr = code->address(); | 3845 Address old_addr = code->address(); |
| 3846 Address new_addr = reinterpret_cast<HeapObject*>(result)->address(); | 3846 Address new_addr = reinterpret_cast<HeapObject*>(result)->address(); |
| 3847 CopyBlock(new_addr, old_addr, obj_size); | 3847 CopyBlock(new_addr, old_addr, obj_size); |
| 3848 // Relocate the copy. | 3848 // Relocate the copy. |
| 3849 Code* new_code = Code::cast(result); | 3849 Code* new_code = Code::cast(result); |
| 3850 ASSERT(!isolate_->code_range()->exists() || | 3850 ASSERT(!isolate_->code_range()->exists() || |
| 3851 isolate_->code_range()->contains(code->address())); | 3851 isolate_->code_range()->contains(code->address())); |
| 3852 new_code->Relocate(new_addr - old_addr); | 3852 new_code->Relocate(new_addr - old_addr); |
| 3853 |
| 3854 // Make sure new object is handled properly by the GC. |
| 3855 incremental_marking()->RecordWrites(new_code); |
| 3856 // RecordWrites(new_code->address(), 0, Code::kHeaderSize); |
| 3857 |
| 3853 return new_code; | 3858 return new_code; |
| 3854 } | 3859 } |
| 3855 | 3860 |
| 3856 | 3861 |
| 3857 MaybeObject* Heap::CopyCode(Code* code, Vector<byte> reloc_info) { | 3862 MaybeObject* Heap::CopyCode(Code* code, Vector<byte> reloc_info) { |
| 3858 // Allocate ByteArray before the Code object, so that we do not risk | 3863 // Allocate ByteArray before the Code object, so that we do not risk |
| 3859 // leaving uninitialized Code object (and breaking the heap). | 3864 // leaving uninitialized Code object (and breaking the heap). |
| 3860 Object* reloc_info_array; | 3865 Object* reloc_info_array; |
| 3861 { MaybeObject* maybe_reloc_info_array = | 3866 { MaybeObject* maybe_reloc_info_array = |
| 3862 AllocateByteArray(reloc_info.length(), TENURED); | 3867 AllocateByteArray(reloc_info.length(), TENURED); |
| (...skipping 3990 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 7853 static_cast<int>(object_sizes_last_time_[index])); | 7858 static_cast<int>(object_sizes_last_time_[index])); |
| 7854 FIXED_ARRAY_SUB_INSTANCE_TYPE_LIST(ADJUST_LAST_TIME_OBJECT_COUNT) | 7859 FIXED_ARRAY_SUB_INSTANCE_TYPE_LIST(ADJUST_LAST_TIME_OBJECT_COUNT) |
| 7855 #undef ADJUST_LAST_TIME_OBJECT_COUNT | 7860 #undef ADJUST_LAST_TIME_OBJECT_COUNT |
| 7856 | 7861 |
| 7857 OS::MemCopy(object_counts_last_time_, object_counts_, sizeof(object_counts_)); | 7862 OS::MemCopy(object_counts_last_time_, object_counts_, sizeof(object_counts_)); |
| 7858 OS::MemCopy(object_sizes_last_time_, object_sizes_, sizeof(object_sizes_)); | 7863 OS::MemCopy(object_sizes_last_time_, object_sizes_, sizeof(object_sizes_)); |
| 7859 ClearObjectStats(); | 7864 ClearObjectStats(); |
| 7860 } | 7865 } |
| 7861 | 7866 |
| 7862 } } // namespace v8::internal | 7867 } } // namespace v8::internal |
| OLD | NEW |