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

Side by Side Diff: src/utils.h

Issue 1559004: Fix the case of no words to copy. (Closed)
Patch Set: Created 10 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
« no previous file with comments | « src/builtins.cc ('k') | 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 2006-2008 the V8 project authors. All rights reserved. 1 // Copyright 2006-2008 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 582 matching lines...) Expand 10 before | Expand all | Expand 10 after
593 } 593 }
594 #endif 594 #endif
595 595
596 #undef STOS 596 #undef STOS
597 } 597 }
598 598
599 599
600 // Copies data from |src| to |dst|. The data spans MUST not overlap. 600 // Copies data from |src| to |dst|. The data spans MUST not overlap.
601 inline void CopyWords(Object** dst, Object** src, int num_words) { 601 inline void CopyWords(Object** dst, Object** src, int num_words) {
602 ASSERT(Min(dst, src) + num_words <= Max(dst, src)); 602 ASSERT(Min(dst, src) + num_words <= Max(dst, src));
603 ASSERT(num_words > 0);
604
603 // Use block copying memcpy if the segment we're copying is 605 // Use block copying memcpy if the segment we're copying is
604 // enough to justify the extra call/setup overhead. 606 // enough to justify the extra call/setup overhead.
605 static const int kBlockCopyLimit = 16; 607 static const int kBlockCopyLimit = 16;
606 608
607 if (num_words >= kBlockCopyLimit) { 609 if (num_words >= kBlockCopyLimit) {
608 memcpy(dst, src, num_words * kPointerSize); 610 memcpy(dst, src, num_words * kPointerSize);
609 } else { 611 } else {
610 int remaining = num_words; 612 int remaining = num_words;
611 do { 613 do {
612 remaining--; 614 remaining--;
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
652 654
653 Dest dest; 655 Dest dest;
654 memcpy(&dest, &source, sizeof(dest)); 656 memcpy(&dest, &source, sizeof(dest));
655 return dest; 657 return dest;
656 } 658 }
657 659
658 660
659 } } // namespace v8::internal 661 } } // namespace v8::internal
660 662
661 #endif // V8_UTILS_H_ 663 #endif // V8_UTILS_H_
OLDNEW
« no previous file with comments | « src/builtins.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698