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/elements.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/deoptimizer.cc ('k') | src/execution.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 165 matching lines...) Expand 10 before | Expand all | Expand 10 after
176 (copy_size + static_cast<int>(from_start)) <= from_base->length()); 176 (copy_size + static_cast<int>(from_start)) <= from_base->length());
177 if (copy_size == 0) return; 177 if (copy_size == 0) return;
178 FixedArray* from = FixedArray::cast(from_base); 178 FixedArray* from = FixedArray::cast(from_base);
179 FixedArray* to = FixedArray::cast(to_base); 179 FixedArray* to = FixedArray::cast(to_base);
180 ASSERT(IsFastSmiOrObjectElementsKind(from_kind)); 180 ASSERT(IsFastSmiOrObjectElementsKind(from_kind));
181 ASSERT(IsFastSmiOrObjectElementsKind(to_kind)); 181 ASSERT(IsFastSmiOrObjectElementsKind(to_kind));
182 Address to_address = to->address() + FixedArray::kHeaderSize; 182 Address to_address = to->address() + FixedArray::kHeaderSize;
183 Address from_address = from->address() + FixedArray::kHeaderSize; 183 Address from_address = from->address() + FixedArray::kHeaderSize;
184 CopyWords(reinterpret_cast<Object**>(to_address) + to_start, 184 CopyWords(reinterpret_cast<Object**>(to_address) + to_start,
185 reinterpret_cast<Object**>(from_address) + from_start, 185 reinterpret_cast<Object**>(from_address) + from_start,
186 copy_size); 186 static_cast<size_t>(copy_size));
187 if (IsFastObjectElementsKind(from_kind) && 187 if (IsFastObjectElementsKind(from_kind) &&
188 IsFastObjectElementsKind(to_kind)) { 188 IsFastObjectElementsKind(to_kind)) {
189 Heap* heap = from->GetHeap(); 189 Heap* heap = from->GetHeap();
190 if (!heap->InNewSpace(to)) { 190 if (!heap->InNewSpace(to)) {
191 heap->RecordWrites(to->address(), 191 heap->RecordWrites(to->address(),
192 to->OffsetOfElementAt(to_start), 192 to->OffsetOfElementAt(to_start),
193 copy_size); 193 copy_size);
194 } 194 }
195 heap->incremental_marking()->RecordWrites(to); 195 heap->incremental_marking()->RecordWrites(to);
196 } 196 }
(...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after
332 if (copy_size == 0) return; 332 if (copy_size == 0) return;
333 FixedDoubleArray* from = FixedDoubleArray::cast(from_base); 333 FixedDoubleArray* from = FixedDoubleArray::cast(from_base);
334 FixedDoubleArray* to = FixedDoubleArray::cast(to_base); 334 FixedDoubleArray* to = FixedDoubleArray::cast(to_base);
335 Address to_address = to->address() + FixedDoubleArray::kHeaderSize; 335 Address to_address = to->address() + FixedDoubleArray::kHeaderSize;
336 Address from_address = from->address() + FixedDoubleArray::kHeaderSize; 336 Address from_address = from->address() + FixedDoubleArray::kHeaderSize;
337 to_address += kDoubleSize * to_start; 337 to_address += kDoubleSize * to_start;
338 from_address += kDoubleSize * from_start; 338 from_address += kDoubleSize * from_start;
339 int words_per_double = (kDoubleSize / kPointerSize); 339 int words_per_double = (kDoubleSize / kPointerSize);
340 CopyWords(reinterpret_cast<Object**>(to_address), 340 CopyWords(reinterpret_cast<Object**>(to_address),
341 reinterpret_cast<Object**>(from_address), 341 reinterpret_cast<Object**>(from_address),
342 words_per_double * copy_size); 342 static_cast<size_t>(words_per_double * copy_size));
343 } 343 }
344 344
345 345
346 static void CopySmiToDoubleElements(FixedArrayBase* from_base, 346 static void CopySmiToDoubleElements(FixedArrayBase* from_base,
347 uint32_t from_start, 347 uint32_t from_start,
348 FixedArrayBase* to_base, 348 FixedArrayBase* to_base,
349 uint32_t to_start, 349 uint32_t to_start,
350 int raw_copy_size) { 350 int raw_copy_size) {
351 int copy_size = raw_copy_size; 351 int copy_size = raw_copy_size;
352 if (raw_copy_size < 0) { 352 if (raw_copy_size < 0) {
(...skipping 1711 matching lines...) Expand 10 before | Expand all | Expand 10 after
2064 UNREACHABLE(); 2064 UNREACHABLE();
2065 break; 2065 break;
2066 } 2066 }
2067 2067
2068 array->set_elements(elms); 2068 array->set_elements(elms);
2069 array->set_length(Smi::FromInt(number_of_elements)); 2069 array->set_length(Smi::FromInt(number_of_elements));
2070 return array; 2070 return array;
2071 } 2071 }
2072 2072
2073 } } // namespace v8::internal 2073 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/deoptimizer.cc ('k') | src/execution.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698