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

Side by Side Diff: src/heap-snapshot-generator.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/factory.cc ('k') | src/heap/heap.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 2013 the V8 project authors. All rights reserved. 1 // Copyright 2013 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/heap-snapshot-generator-inl.h" 7 #include "src/heap-snapshot-generator-inl.h"
8 8
9 #include "src/allocation-tracker.h" 9 #include "src/allocation-tracker.h"
10 #include "src/code-stubs.h" 10 #include "src/code-stubs.h"
(...skipping 3084 matching lines...) Expand 10 before | Expand all | Expand 10 after
3095 writer_->AddCharacter(*s); 3095 writer_->AddCharacter(*s);
3096 continue; 3096 continue;
3097 default: 3097 default:
3098 if (*s > 31 && *s < 128) { 3098 if (*s > 31 && *s < 128) {
3099 writer_->AddCharacter(*s); 3099 writer_->AddCharacter(*s);
3100 } else if (*s <= 31) { 3100 } else if (*s <= 31) {
3101 // Special character with no dedicated literal. 3101 // Special character with no dedicated literal.
3102 WriteUChar(writer_, *s); 3102 WriteUChar(writer_, *s);
3103 } else { 3103 } else {
3104 // Convert UTF-8 into \u UTF-16 literal. 3104 // Convert UTF-8 into \u UTF-16 literal.
3105 unsigned length = 1, cursor = 0; 3105 size_t length = 1, cursor = 0;
3106 for ( ; length <= 4 && *(s + length) != '\0'; ++length) { } 3106 for ( ; length <= 4 && *(s + length) != '\0'; ++length) { }
3107 unibrow::uchar c = unibrow::Utf8::CalculateValue(s, length, &cursor); 3107 unibrow::uchar c = unibrow::Utf8::CalculateValue(s, length, &cursor);
3108 if (c != unibrow::Utf8::kBadChar) { 3108 if (c != unibrow::Utf8::kBadChar) {
3109 WriteUChar(writer_, c); 3109 WriteUChar(writer_, c);
3110 DCHECK(cursor != 0); 3110 DCHECK(cursor != 0);
3111 s += cursor - 1; 3111 s += cursor - 1;
3112 } else { 3112 } else {
3113 writer_->AddCharacter('?'); 3113 writer_->AddCharacter('?');
3114 } 3114 }
3115 } 3115 }
(...skipping 15 matching lines...) Expand all
3131 writer_->AddString("\"<dummy>\""); 3131 writer_->AddString("\"<dummy>\"");
3132 for (int i = 1; i < sorted_strings.length(); ++i) { 3132 for (int i = 1; i < sorted_strings.length(); ++i) {
3133 writer_->AddCharacter(','); 3133 writer_->AddCharacter(',');
3134 SerializeString(sorted_strings[i]); 3134 SerializeString(sorted_strings[i]);
3135 if (writer_->aborted()) return; 3135 if (writer_->aborted()) return;
3136 } 3136 }
3137 } 3137 }
3138 3138
3139 3139
3140 } } // namespace v8::internal 3140 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/factory.cc ('k') | src/heap/heap.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698