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

Side by Side Diff: src/parser.cc

Issue 802313003: RegExpParser: Fix Reset()ting to the end. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: long lines Created 6 years 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 | « no previous file | test/mjsunit/regress/regress-3756.js » ('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/api.h" 7 #include "src/api.h"
8 #include "src/ast.h" 8 #include "src/ast.h"
9 #include "src/bailout-reason.h" 9 #include "src/bailout-reason.h"
10 #include "src/base/platform/platform.h" 10 #include "src/base/platform/platform.h"
(...skipping 4305 matching lines...) Expand 10 before | Expand all | Expand 10 after
4316 if (check.HasOverflowed()) { 4316 if (check.HasOverflowed()) {
4317 ReportError(CStrVector(Isolate::kStackOverflowMessage)); 4317 ReportError(CStrVector(Isolate::kStackOverflowMessage));
4318 } else if (zone()->excess_allocation()) { 4318 } else if (zone()->excess_allocation()) {
4319 ReportError(CStrVector("Regular expression too large")); 4319 ReportError(CStrVector("Regular expression too large"));
4320 } else { 4320 } else {
4321 current_ = in()->Get(next_pos_); 4321 current_ = in()->Get(next_pos_);
4322 next_pos_++; 4322 next_pos_++;
4323 } 4323 }
4324 } else { 4324 } else {
4325 current_ = kEndMarker; 4325 current_ = kEndMarker;
4326 // Advance so that position() points to 1-after-the-last-character. This is
4327 // important so that Reset() to this position works correctly.
4328 next_pos_ = in()->length() + 1;
4326 has_more_ = false; 4329 has_more_ = false;
4327 } 4330 }
4328 } 4331 }
4329 4332
4330 4333
4331 void RegExpParser::Reset(int pos) { 4334 void RegExpParser::Reset(int pos) {
4332 next_pos_ = pos; 4335 next_pos_ = pos;
4333 has_more_ = (pos < in()->length()); 4336 has_more_ = (pos < in()->length());
4334 Advance(); 4337 Advance();
4335 } 4338 }
(...skipping 955 matching lines...) Expand 10 before | Expand all | Expand 10 after
5291 } else { 5294 } else {
5292 const uc16* data = reinterpret_cast<const uc16*>(raw_string->raw_data()); 5295 const uc16* data = reinterpret_cast<const uc16*>(raw_string->raw_data());
5293 running_hash = StringHasher::ComputeRunningHash(running_hash, data, 5296 running_hash = StringHasher::ComputeRunningHash(running_hash, data,
5294 raw_string->length()); 5297 raw_string->length());
5295 } 5298 }
5296 } 5299 }
5297 5300
5298 return running_hash; 5301 return running_hash;
5299 } 5302 }
5300 } } // namespace v8::internal 5303 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « no previous file | test/mjsunit/regress/regress-3756.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698