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

Side by Side Diff: src/heap.cc

Issue 12970006: Use internal memcpy for CopyWords and when copying code. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 7 years, 9 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/deoptimizer.cc ('k') | src/v8utils.h » ('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 3870 matching lines...) Expand 10 before | Expand all | Expand 10 after
3881 maybe_result = code_space_->AllocateRaw(new_obj_size); 3881 maybe_result = code_space_->AllocateRaw(new_obj_size);
3882 } 3882 }
3883 3883
3884 Object* result; 3884 Object* result;
3885 if (!maybe_result->ToObject(&result)) return maybe_result; 3885 if (!maybe_result->ToObject(&result)) return maybe_result;
3886 3886
3887 // Copy code object. 3887 // Copy code object.
3888 Address new_addr = reinterpret_cast<HeapObject*>(result)->address(); 3888 Address new_addr = reinterpret_cast<HeapObject*>(result)->address();
3889 3889
3890 // Copy header and instructions. 3890 // Copy header and instructions.
3891 memcpy(new_addr, old_addr, relocation_offset); 3891 CopyBytes(new_addr, old_addr, relocation_offset);
3892 3892
3893 Code* new_code = Code::cast(result); 3893 Code* new_code = Code::cast(result);
3894 new_code->set_relocation_info(ByteArray::cast(reloc_info_array)); 3894 new_code->set_relocation_info(ByteArray::cast(reloc_info_array));
3895 3895
3896 // Copy patched rinfo. 3896 // Copy patched rinfo.
3897 memcpy(new_code->relocation_start(), reloc_info.start(), reloc_info.length()); 3897 CopyBytes(new_code->relocation_start(),
3898 reloc_info.start(),
3899 reloc_info.length());
3898 3900
3899 // Relocate the copy. 3901 // Relocate the copy.
3900 ASSERT(!isolate_->code_range()->exists() || 3902 ASSERT(!isolate_->code_range()->exists() ||
3901 isolate_->code_range()->contains(code->address())); 3903 isolate_->code_range()->contains(code->address()));
3902 new_code->Relocate(new_addr - old_addr); 3904 new_code->Relocate(new_addr - old_addr);
3903 3905
3904 #ifdef VERIFY_HEAP 3906 #ifdef VERIFY_HEAP
3905 if (FLAG_verify_heap) { 3907 if (FLAG_verify_heap) {
3906 code->Verify(); 3908 code->Verify();
3907 } 3909 }
(...skipping 3910 matching lines...) Expand 10 before | Expand all | Expand 10 after
7818 static_cast<int>(object_sizes_last_time_[index])); 7820 static_cast<int>(object_sizes_last_time_[index]));
7819 FIXED_ARRAY_SUB_INSTANCE_TYPE_LIST(ADJUST_LAST_TIME_OBJECT_COUNT) 7821 FIXED_ARRAY_SUB_INSTANCE_TYPE_LIST(ADJUST_LAST_TIME_OBJECT_COUNT)
7820 #undef ADJUST_LAST_TIME_OBJECT_COUNT 7822 #undef ADJUST_LAST_TIME_OBJECT_COUNT
7821 7823
7822 memcpy(object_counts_last_time_, object_counts_, sizeof(object_counts_)); 7824 memcpy(object_counts_last_time_, object_counts_, sizeof(object_counts_));
7823 memcpy(object_sizes_last_time_, object_sizes_, sizeof(object_sizes_)); 7825 memcpy(object_sizes_last_time_, object_sizes_, sizeof(object_sizes_));
7824 ClearObjectStats(); 7826 ClearObjectStats();
7825 } 7827 }
7826 7828
7827 } } // namespace v8::internal 7829 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/deoptimizer.cc ('k') | src/v8utils.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698