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

Side by Side Diff: src/builtins/builtins-regexp.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/base/cpu.cc ('k') | src/builtins/builtins-string.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/builtins/builtins-utils.h" 5 #include "src/builtins/builtins-utils.h"
6 #include "src/builtins/builtins.h" 6 #include "src/builtins/builtins.h"
7 7
8 #include "src/code-factory.h" 8 #include "src/code-factory.h"
9 #include "src/regexp/jsregexp.h" 9 #include "src/regexp/jsregexp.h"
10 #include "src/regexp/regexp-utils.h" 10 #include "src/regexp/regexp-utils.h"
(...skipping 1294 matching lines...) Expand 10 before | Expand all | Expand 10 after
1305 } 1305 }
1306 continue; 1306 continue;
1307 } 1307 }
1308 1308
1309 { 1309 {
1310 Handle<String> substr = 1310 Handle<String> substr =
1311 factory->NewSubString(string, current_index, start_match); 1311 factory->NewSubString(string, current_index, start_match);
1312 elems = FixedArray::SetAndGrow(elems, num_elems++, substr); 1312 elems = FixedArray::SetAndGrow(elems, num_elems++, substr);
1313 } 1313 }
1314 1314
1315 if (num_elems == limit) break; 1315 if (static_cast<uint32_t>(num_elems) == limit) break;
1316 1316
1317 for (int i = 2; i < match_indices->NumberOfCaptureRegisters(); i += 2) { 1317 for (int i = 2; i < match_indices->NumberOfCaptureRegisters(); i += 2) {
1318 const int start = match_indices->Capture(i); 1318 const int start = match_indices->Capture(i);
1319 const int end = match_indices->Capture(i + 1); 1319 const int end = match_indices->Capture(i + 1);
1320 1320
1321 if (end != -1) { 1321 if (end != -1) {
1322 Handle<String> substr = factory->NewSubString(string, start, end); 1322 Handle<String> substr = factory->NewSubString(string, start, end);
1323 elems = FixedArray::SetAndGrow(elems, num_elems++, substr); 1323 elems = FixedArray::SetAndGrow(elems, num_elems++, substr);
1324 } else { 1324 } else {
1325 elems = FixedArray::SetAndGrow(elems, num_elems++, 1325 elems = FixedArray::SetAndGrow(elems, num_elems++,
1326 factory->undefined_value()); 1326 factory->undefined_value());
1327 } 1327 }
1328 1328
1329 if (num_elems == limit) { 1329 if (static_cast<uint32_t>(num_elems) == limit) {
1330 return NewJSArrayWithElements(isolate, elems, num_elems); 1330 return NewJSArrayWithElements(isolate, elems, num_elems);
1331 } 1331 }
1332 } 1332 }
1333 1333
1334 start_index = current_index = end_index; 1334 start_index = current_index = end_index;
1335 } 1335 }
1336 1336
1337 return NewJSArrayWithElements(isolate, elems, num_elems); 1337 return NewJSArrayWithElements(isolate, elems, num_elems);
1338 } 1338 }
1339 1339
(...skipping 153 matching lines...) Expand 10 before | Expand all | Expand 10 after
1493 if (end == prev_string_index) { 1493 if (end == prev_string_index) {
1494 string_index = RegExpUtils::AdvanceStringIndex(isolate, string, 1494 string_index = RegExpUtils::AdvanceStringIndex(isolate, string,
1495 string_index, unicode); 1495 string_index, unicode);
1496 continue; 1496 continue;
1497 } 1497 }
1498 1498
1499 { 1499 {
1500 Handle<String> substr = 1500 Handle<String> substr =
1501 factory->NewSubString(string, prev_string_index, string_index); 1501 factory->NewSubString(string, prev_string_index, string_index);
1502 elems = FixedArray::SetAndGrow(elems, num_elems++, substr); 1502 elems = FixedArray::SetAndGrow(elems, num_elems++, substr);
1503 if (num_elems == limit) { 1503 if (static_cast<uint32_t>(num_elems) == limit) {
1504 return *NewJSArrayWithElements(isolate, elems, num_elems); 1504 return *NewJSArrayWithElements(isolate, elems, num_elems);
1505 } 1505 }
1506 } 1506 }
1507 1507
1508 prev_string_index = end; 1508 prev_string_index = end;
1509 1509
1510 Handle<Object> num_captures_obj; 1510 Handle<Object> num_captures_obj;
1511 ASSIGN_RETURN_FAILURE_ON_EXCEPTION( 1511 ASSIGN_RETURN_FAILURE_ON_EXCEPTION(
1512 isolate, num_captures_obj, 1512 isolate, num_captures_obj,
1513 Object::GetProperty(result, isolate->factory()->length_string())); 1513 Object::GetProperty(result, isolate->factory()->length_string()));
1514 1514
1515 ASSIGN_RETURN_FAILURE_ON_EXCEPTION( 1515 ASSIGN_RETURN_FAILURE_ON_EXCEPTION(
1516 isolate, num_captures_obj, Object::ToLength(isolate, num_captures_obj)); 1516 isolate, num_captures_obj, Object::ToLength(isolate, num_captures_obj));
1517 const int num_captures = 1517 const int num_captures =
1518 std::max(Handle<Smi>::cast(num_captures_obj)->value(), 0); 1518 std::max(Handle<Smi>::cast(num_captures_obj)->value(), 0);
1519 1519
1520 for (int i = 1; i < num_captures; i++) { 1520 for (int i = 1; i < num_captures; i++) {
1521 Handle<Object> capture; 1521 Handle<Object> capture;
1522 ASSIGN_RETURN_FAILURE_ON_EXCEPTION( 1522 ASSIGN_RETURN_FAILURE_ON_EXCEPTION(
1523 isolate, capture, Object::GetElement(isolate, result, i)); 1523 isolate, capture, Object::GetElement(isolate, result, i));
1524 elems = FixedArray::SetAndGrow(elems, num_elems++, capture); 1524 elems = FixedArray::SetAndGrow(elems, num_elems++, capture);
1525 if (num_elems == limit) { 1525 if (static_cast<uint32_t>(num_elems) == limit) {
1526 return *NewJSArrayWithElements(isolate, elems, num_elems); 1526 return *NewJSArrayWithElements(isolate, elems, num_elems);
1527 } 1527 }
1528 } 1528 }
1529 1529
1530 string_index = prev_string_index; 1530 string_index = prev_string_index;
1531 } 1531 }
1532 1532
1533 { 1533 {
1534 Handle<String> substr = 1534 Handle<String> substr =
1535 factory->NewSubString(string, prev_string_index, length); 1535 factory->NewSubString(string, prev_string_index, length);
(...skipping 472 matching lines...) Expand 10 before | Expand all | Expand 10 after
2008 a->Bind(&if_matched); 2008 a->Bind(&if_matched);
2009 { 2009 {
2010 Node* result = ConstructNewResultFromMatchInfo(isolate, a, context, 2010 Node* result = ConstructNewResultFromMatchInfo(isolate, a, context,
2011 match_indices, string); 2011 match_indices, string);
2012 a->Return(result); 2012 a->Return(result);
2013 } 2013 }
2014 } 2014 }
2015 2015
2016 } // namespace internal 2016 } // namespace internal
2017 } // namespace v8 2017 } // namespace v8
OLDNEW
« no previous file with comments | « src/base/cpu.cc ('k') | src/builtins/builtins-string.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698