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

Side by Side Diff: src/value-serializer.cc

Issue 2493553002: Fix -Wsign-compare warnings in parser, scanner, regexp, runtime. (Closed)
Patch Set: Created 4 years, 1 month 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/uri.cc ('k') | test/cctest/test-code-stub-assembler.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 2016 the V8 project authors. All rights reserved. 1 // Copyright 2016 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/value-serializer.h" 5 #include "src/value-serializer.h"
6 6
7 #include <type_traits> 7 #include <type_traits>
8 8
9 #include "src/base/logging.h" 9 #include "src/base/logging.h"
10 #include "src/conversions.h" 10 #include "src/conversions.h"
(...skipping 1121 matching lines...) Expand 10 before | Expand all | Expand 10 after
1132 } 1132 }
1133 1133
1134 expected = String::Flatten(expected); 1134 expected = String::Flatten(expected);
1135 DisallowHeapAllocation no_gc; 1135 DisallowHeapAllocation no_gc;
1136 String::FlatContent flat = expected->GetFlatContent(); 1136 String::FlatContent flat = expected->GetFlatContent();
1137 1137
1138 // If the bytes are verbatim what is in the flattened string, then the string 1138 // If the bytes are verbatim what is in the flattened string, then the string
1139 // is successfully consumed. 1139 // is successfully consumed.
1140 if (tag == SerializationTag::kUtf8String && flat.IsOneByte()) { 1140 if (tag == SerializationTag::kUtf8String && flat.IsOneByte()) {
1141 Vector<const uint8_t> chars = flat.ToOneByteVector(); 1141 Vector<const uint8_t> chars = flat.ToOneByteVector();
1142 if (byte_length == chars.length() && 1142 if (byte_length == static_cast<size_t>(chars.length()) &&
1143 String::IsAscii(chars.begin(), chars.length()) && 1143 String::IsAscii(chars.begin(), chars.length()) &&
1144 memcmp(bytes.begin(), chars.begin(), byte_length) == 0) { 1144 memcmp(bytes.begin(), chars.begin(), byte_length) == 0) {
1145 return true; 1145 return true;
1146 } 1146 }
1147 } else if (tag == SerializationTag::kTwoByteString && flat.IsTwoByte()) { 1147 } else if (tag == SerializationTag::kTwoByteString && flat.IsTwoByte()) {
1148 Vector<const uc16> chars = flat.ToUC16Vector(); 1148 Vector<const uc16> chars = flat.ToUC16Vector();
1149 if (byte_length == static_cast<unsigned>(chars.length()) * sizeof(uc16) && 1149 if (byte_length == static_cast<unsigned>(chars.length()) * sizeof(uc16) &&
1150 memcmp(bytes.begin(), chars.begin(), byte_length) == 0) { 1150 memcmp(bytes.begin(), chars.begin(), byte_length) == 0) {
1151 return true; 1151 return true;
1152 } 1152 }
(...skipping 672 matching lines...) Expand 10 before | Expand all | Expand 10 after
1825 if (stack.size() != 1) { 1825 if (stack.size() != 1) {
1826 isolate_->Throw(*isolate_->factory()->NewError( 1826 isolate_->Throw(*isolate_->factory()->NewError(
1827 MessageTemplate::kDataCloneDeserializationError)); 1827 MessageTemplate::kDataCloneDeserializationError));
1828 return MaybeHandle<Object>(); 1828 return MaybeHandle<Object>();
1829 } 1829 }
1830 return scope.CloseAndEscape(stack[0]); 1830 return scope.CloseAndEscape(stack[0]);
1831 } 1831 }
1832 1832
1833 } // namespace internal 1833 } // namespace internal
1834 } // namespace v8 1834 } // namespace v8
OLDNEW
« no previous file with comments | « src/uri.cc ('k') | test/cctest/test-code-stub-assembler.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698