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

Side by Side Diff: src/heap.cc

Issue 14587008: Fix CopyCode to properly record object pointer writes. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 7 years, 7 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 | « no previous file | no next file » | 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 3844 matching lines...) Expand 10 before | Expand all | Expand 10 after
3855 3855
3856 // Copy code object. 3856 // Copy code object.
3857 Address old_addr = code->address(); 3857 Address old_addr = code->address();
3858 Address new_addr = reinterpret_cast<HeapObject*>(result)->address(); 3858 Address new_addr = reinterpret_cast<HeapObject*>(result)->address();
3859 CopyBlock(new_addr, old_addr, obj_size); 3859 CopyBlock(new_addr, old_addr, obj_size);
3860 // Relocate the copy. 3860 // Relocate the copy.
3861 Code* new_code = Code::cast(result); 3861 Code* new_code = Code::cast(result);
3862 ASSERT(!isolate_->code_range()->exists() || 3862 ASSERT(!isolate_->code_range()->exists() ||
3863 isolate_->code_range()->contains(code->address())); 3863 isolate_->code_range()->contains(code->address()));
3864 new_code->Relocate(new_addr - old_addr); 3864 new_code->Relocate(new_addr - old_addr);
3865
3866 // Make sure new object is handled properly by the GC.
3867 incremental_marking()->RecordWrites(new_code);
Michael Starzinger 2013/05/14 16:43:10 So I looked into this write-barrier and I don't th
3868 // RecordWrites(new_code->address(), 0, Code::kHeaderSize);
3869
3865 return new_code; 3870 return new_code;
3866 } 3871 }
3867 3872
3868 3873
3869 MaybeObject* Heap::CopyCode(Code* code, Vector<byte> reloc_info) { 3874 MaybeObject* Heap::CopyCode(Code* code, Vector<byte> reloc_info) {
3870 // Allocate ByteArray before the Code object, so that we do not risk 3875 // Allocate ByteArray before the Code object, so that we do not risk
3871 // leaving uninitialized Code object (and breaking the heap). 3876 // leaving uninitialized Code object (and breaking the heap).
3872 Object* reloc_info_array; 3877 Object* reloc_info_array;
3873 { MaybeObject* maybe_reloc_info_array = 3878 { MaybeObject* maybe_reloc_info_array =
3874 AllocateByteArray(reloc_info.length(), TENURED); 3879 AllocateByteArray(reloc_info.length(), TENURED);
(...skipping 4001 matching lines...) Expand 10 before | Expand all | Expand 10 after
7876 if (FLAG_parallel_recompilation) { 7881 if (FLAG_parallel_recompilation) {
7877 heap_->relocation_mutex_->Lock(); 7882 heap_->relocation_mutex_->Lock();
7878 #ifdef DEBUG 7883 #ifdef DEBUG
7879 heap_->relocation_mutex_locked_by_optimizer_thread_ = 7884 heap_->relocation_mutex_locked_by_optimizer_thread_ =
7880 heap_->isolate()->optimizing_compiler_thread()->IsOptimizerThread(); 7885 heap_->isolate()->optimizing_compiler_thread()->IsOptimizerThread();
7881 #endif // DEBUG 7886 #endif // DEBUG
7882 } 7887 }
7883 } 7888 }
7884 7889
7885 } } // namespace v8::internal 7890 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698