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

Side by Side Diff: src/ia32/deoptimizer-ia32.cc

Issue 13932006: Replace OS::MemCopy with OS::MemMove (just as fast but more flexible). (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: addressed comments Created 7 years, 8 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/ia32/codegen-ia32.cc ('k') | src/ia32/lithium-codegen-ia32.cc » ('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 72 matching lines...) Expand 10 before | Expand all | Expand 10 after
83 int additional_comments = 83 int additional_comments =
84 (min_padding + comment_reloc_size - 1) / comment_reloc_size; 84 (min_padding + comment_reloc_size - 1) / comment_reloc_size;
85 // Actual padding size. 85 // Actual padding size.
86 int padding = additional_comments * comment_reloc_size; 86 int padding = additional_comments * comment_reloc_size;
87 // Allocate new relocation info and copy old relocation to the end 87 // Allocate new relocation info and copy old relocation to the end
88 // of the new relocation info array because relocation info is 88 // of the new relocation info array because relocation info is
89 // written and read backwards. 89 // written and read backwards.
90 Factory* factory = isolate->factory(); 90 Factory* factory = isolate->factory();
91 Handle<ByteArray> new_reloc = 91 Handle<ByteArray> new_reloc =
92 factory->NewByteArray(reloc_length + padding, TENURED); 92 factory->NewByteArray(reloc_length + padding, TENURED);
93 memcpy(new_reloc->GetDataStartAddress() + padding, 93 OS::MemCopy(new_reloc->GetDataStartAddress() + padding,
94 code->relocation_info()->GetDataStartAddress(), 94 code->relocation_info()->GetDataStartAddress(),
95 reloc_length); 95 reloc_length);
96 // Create a relocation writer to write the comments in the padding 96 // Create a relocation writer to write the comments in the padding
97 // space. Use position 0 for everything to ensure short encoding. 97 // space. Use position 0 for everything to ensure short encoding.
98 RelocInfoWriter reloc_info_writer( 98 RelocInfoWriter reloc_info_writer(
99 new_reloc->GetDataStartAddress() + padding, 0); 99 new_reloc->GetDataStartAddress() + padding, 0);
100 intptr_t comment_string 100 intptr_t comment_string
101 = reinterpret_cast<intptr_t>(RelocInfo::kFillerCommentString); 101 = reinterpret_cast<intptr_t>(RelocInfo::kFillerCommentString);
102 RelocInfo rinfo(0, RelocInfo::COMMENT, comment_string, NULL); 102 RelocInfo rinfo(0, RelocInfo::COMMENT, comment_string, NULL);
103 for (int i = 0; i < additional_comments; ++i) { 103 for (int i = 0; i < additional_comments; ++i) {
104 #ifdef DEBUG 104 #ifdef DEBUG
105 byte* pos_before = reloc_info_writer.pos(); 105 byte* pos_before = reloc_info_writer.pos();
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after
170 ASSERT(prev_call_address == NULL || 170 ASSERT(prev_call_address == NULL ||
171 call_address >= prev_call_address + patch_size()); 171 call_address >= prev_call_address + patch_size());
172 ASSERT(call_address + patch_size() <= code->instruction_end()); 172 ASSERT(call_address + patch_size() <= code->instruction_end());
173 #ifdef DEBUG 173 #ifdef DEBUG
174 prev_call_address = call_address; 174 prev_call_address = call_address;
175 #endif 175 #endif
176 } 176 }
177 177
178 // Move the relocation info to the beginning of the byte array. 178 // Move the relocation info to the beginning of the byte array.
179 int new_reloc_size = reloc_end_address - reloc_info_writer.pos(); 179 int new_reloc_size = reloc_end_address - reloc_info_writer.pos();
180 memmove(code->relocation_start(), reloc_info_writer.pos(), new_reloc_size); 180 OS::MemMove(
181 code->relocation_start(), reloc_info_writer.pos(), new_reloc_size);
181 182
182 // The relocation info is in place, update the size. 183 // The relocation info is in place, update the size.
183 reloc_info->set_length(new_reloc_size); 184 reloc_info->set_length(new_reloc_size);
184 185
185 // Handle the junk part after the new relocation info. We will create 186 // Handle the junk part after the new relocation info. We will create
186 // a non-live object in the extra space at the end of the former reloc info. 187 // a non-live object in the extra space at the end of the former reloc info.
187 Address junk_address = reloc_info->address() + reloc_info->Size(); 188 Address junk_address = reloc_info->address() + reloc_info->Size();
188 ASSERT(junk_address <= reloc_end_address); 189 ASSERT(junk_address <= reloc_end_address);
189 isolate->heap()->CreateFillerObjectAt(junk_address, 190 isolate->heap()->CreateFillerObjectAt(junk_address,
190 reloc_end_address - junk_address); 191 reloc_end_address - junk_address);
(...skipping 731 matching lines...) Expand 10 before | Expand all | Expand 10 after
922 } 923 }
923 __ bind(&done); 924 __ bind(&done);
924 } 925 }
925 926
926 #undef __ 927 #undef __
927 928
928 929
929 } } // namespace v8::internal 930 } } // namespace v8::internal
930 931
931 #endif // V8_TARGET_ARCH_IA32 932 #endif // V8_TARGET_ARCH_IA32
OLDNEW
« no previous file with comments | « src/ia32/codegen-ia32.cc ('k') | src/ia32/lithium-codegen-ia32.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698