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

Side by Side Diff: src/objects.cc

Issue 7866: Misc (Closed)
Patch Set: Created 12 years, 2 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
« src/log.cc ('K') | « src/log.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 3709 matching lines...) Expand 10 before | Expand all | Expand 10 after
3720 template <typename Char> 3720 template <typename Char>
3721 static inline bool CompareRawStringContents(Vector<Char> a, Vector<Char> b) { 3721 static inline bool CompareRawStringContents(Vector<Char> a, Vector<Char> b) {
3722 // Lint complains about taking sizeof a type rather than a variable. 3722 // Lint complains about taking sizeof a type rather than a variable.
3723 // That's just stupid in this case so I'm turning it off. 3723 // That's just stupid in this case so I'm turning it off.
3724 const int kStepSize = sizeof(int) / sizeof(Char); // NOLINT 3724 const int kStepSize = sizeof(int) / sizeof(Char); // NOLINT
3725 int length = a.length(); 3725 int length = a.length();
3726 ASSERT_EQ(length, b.length()); 3726 ASSERT_EQ(length, b.length());
3727 int endpoint = length - kStepSize; 3727 int endpoint = length - kStepSize;
3728 const Char* pa = a.start(); 3728 const Char* pa = a.start();
3729 const Char* pb = b.start(); 3729 const Char* pb = b.start();
3730 #ifndef CAN_READ_UNALIGNED
3731 // If this architecture isn't comfortable reading unaligned ints
3732 // then we have to check that the strings are alingned and fall back
3733 // to the standard comparison if they are not.
3734 const int kAlignmentMask = sizeof(int) - 1; // NOLINT
Erik Corry 2008/10/22 11:44:15 Since you are accessing by uint32_t then that is w
3735 uint32_t pa_addr = reinterpret_cast<uint32_t>(pa);
3736 uint32_t pb_addr = reinterpret_cast<uint32_t>(pb);
3737 if ((pa_addr & kAlignmentMask) | (pb_addr & kAlignmentMask)) {
Erik Corry 2008/10/22 11:44:15 != 0
3738 VectorIterator<Char> ia(a);
3739 VectorIterator<Char> ib(b);
3740 return CompareStringContents(&ia, &ib);
3741 }
3742 #endif
3730 int i; 3743 int i;
3731 // Compare blocks until we reach near the end of the string. 3744 // Compare blocks until we reach near the end of the string.
3732 for (i = 0; i <= endpoint; i += kStepSize) { 3745 for (i = 0; i <= endpoint; i += kStepSize) {
3733 uint32_t wa = *reinterpret_cast<const uint32_t*>(pa + i); 3746 uint32_t wa = *reinterpret_cast<const uint32_t*>(pa + i);
3734 uint32_t wb = *reinterpret_cast<const uint32_t*>(pb + i); 3747 uint32_t wb = *reinterpret_cast<const uint32_t*>(pb + i);
3735 if (wa != wb) { 3748 if (wa != wb) {
3736 return false; 3749 return false;
3737 } 3750 }
3738 } 3751 }
3739 // Compare the remaining characters that didn't fit into a block. 3752 // Compare the remaining characters that didn't fit into a block.
(...skipping 2811 matching lines...) Expand 10 before | Expand all | Expand 10 after
6551 // No break point. 6564 // No break point.
6552 if (break_point_objects()->IsUndefined()) return 0; 6565 if (break_point_objects()->IsUndefined()) return 0;
6553 // Single beak point. 6566 // Single beak point.
6554 if (!break_point_objects()->IsFixedArray()) return 1; 6567 if (!break_point_objects()->IsFixedArray()) return 1;
6555 // Multiple break points. 6568 // Multiple break points.
6556 return FixedArray::cast(break_point_objects())->length(); 6569 return FixedArray::cast(break_point_objects())->length();
6557 } 6570 }
6558 6571
6559 6572
6560 } } // namespace v8::internal 6573 } } // namespace v8::internal
OLDNEW
« src/log.cc ('K') | « src/log.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698