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

Side by Side Diff: src/heap/heap.cc

Issue 864273005: Scanner / Unicode decoding: use size_t instead of unsigned. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: tentative Created 5 years, 10 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/heap-snapshot-generator.cc ('k') | src/objects.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 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "src/v8.h" 5 #include "src/v8.h"
6 6
7 #include "src/accessors.h" 7 #include "src/accessors.h"
8 #include "src/api.h" 8 #include "src/api.h"
9 #include "src/base/bits.h" 9 #include "src/base/bits.h"
10 #include "src/base/once.h" 10 #include "src/base/once.h"
(...skipping 3981 matching lines...) Expand 10 before | Expand all | Expand 10 after
3992 static inline void WriteOneByteData(Vector<const char> vector, uint8_t* chars, 3992 static inline void WriteOneByteData(Vector<const char> vector, uint8_t* chars,
3993 int len) { 3993 int len) {
3994 // Only works for one byte strings. 3994 // Only works for one byte strings.
3995 DCHECK(vector.length() == len); 3995 DCHECK(vector.length() == len);
3996 MemCopy(chars, vector.start(), len); 3996 MemCopy(chars, vector.start(), len);
3997 } 3997 }
3998 3998
3999 static inline void WriteTwoByteData(Vector<const char> vector, uint16_t* chars, 3999 static inline void WriteTwoByteData(Vector<const char> vector, uint16_t* chars,
4000 int len) { 4000 int len) {
4001 const uint8_t* stream = reinterpret_cast<const uint8_t*>(vector.start()); 4001 const uint8_t* stream = reinterpret_cast<const uint8_t*>(vector.start());
4002 unsigned stream_length = vector.length(); 4002 size_t stream_length = vector.length();
4003 while (stream_length != 0) { 4003 while (stream_length != 0) {
4004 unsigned consumed = 0; 4004 size_t consumed = 0;
4005 uint32_t c = unibrow::Utf8::ValueOf(stream, stream_length, &consumed); 4005 uint32_t c = unibrow::Utf8::ValueOf(stream, stream_length, &consumed);
4006 DCHECK(c != unibrow::Utf8::kBadChar); 4006 DCHECK(c != unibrow::Utf8::kBadChar);
4007 DCHECK(consumed <= stream_length); 4007 DCHECK(consumed <= stream_length);
4008 stream_length -= consumed; 4008 stream_length -= consumed;
4009 stream += consumed; 4009 stream += consumed;
4010 if (c > unibrow::Utf16::kMaxNonSurrogateCharCode) { 4010 if (c > unibrow::Utf16::kMaxNonSurrogateCharCode) {
4011 len -= 2; 4011 len -= 2;
4012 if (len < 0) break; 4012 if (len < 0) break;
4013 *chars++ = unibrow::Utf16::LeadSurrogate(c); 4013 *chars++ = unibrow::Utf16::LeadSurrogate(c);
4014 *chars++ = unibrow::Utf16::TrailSurrogate(c); 4014 *chars++ = unibrow::Utf16::TrailSurrogate(c);
(...skipping 2472 matching lines...) Expand 10 before | Expand all | Expand 10 after
6487 static_cast<int>(object_sizes_last_time_[index])); 6487 static_cast<int>(object_sizes_last_time_[index]));
6488 CODE_AGE_LIST_COMPLETE(ADJUST_LAST_TIME_OBJECT_COUNT) 6488 CODE_AGE_LIST_COMPLETE(ADJUST_LAST_TIME_OBJECT_COUNT)
6489 #undef ADJUST_LAST_TIME_OBJECT_COUNT 6489 #undef ADJUST_LAST_TIME_OBJECT_COUNT
6490 6490
6491 MemCopy(object_counts_last_time_, object_counts_, sizeof(object_counts_)); 6491 MemCopy(object_counts_last_time_, object_counts_, sizeof(object_counts_));
6492 MemCopy(object_sizes_last_time_, object_sizes_, sizeof(object_sizes_)); 6492 MemCopy(object_sizes_last_time_, object_sizes_, sizeof(object_sizes_));
6493 ClearObjectStats(); 6493 ClearObjectStats();
6494 } 6494 }
6495 } 6495 }
6496 } // namespace v8::internal 6496 } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/heap-snapshot-generator.cc ('k') | src/objects.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698