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

Side by Side Diff: src/scanner.cc

Issue 902703002: templates: Don't check IsLineTerminator() if character is negative (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: 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 | « no previous file | test/mjsunit/regress/regress-455212.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 2011 the V8 project authors. All rights reserved. 1 // Copyright 2011 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 // Features shared by parsing and pre-parsing scanners. 5 // Features shared by parsing and pre-parsing scanners.
6 6
7 #include <stdint.h> 7 #include <stdint.h>
8 8
9 #include <cmath> 9 #include <cmath>
10 10
(...skipping 825 matching lines...) Expand 10 before | Expand all | Expand 10 after
836 Advance<capture_raw>(); 836 Advance<capture_raw>();
837 if (c == '`') { 837 if (c == '`') {
838 result = Token::TEMPLATE_TAIL; 838 result = Token::TEMPLATE_TAIL;
839 ReduceRawLiteralLength(1); 839 ReduceRawLiteralLength(1);
840 break; 840 break;
841 } else if (c == '$' && c0_ == '{') { 841 } else if (c == '$' && c0_ == '{') {
842 Advance<capture_raw>(); // Consume '{' 842 Advance<capture_raw>(); // Consume '{'
843 ReduceRawLiteralLength(2); 843 ReduceRawLiteralLength(2);
844 break; 844 break;
845 } else if (c == '\\') { 845 } else if (c == '\\') {
846 if (unicode_cache_->IsLineTerminator(c0_)) { 846 if (c0_ > 0 && unicode_cache_->IsLineTerminator(c0_)) {
arv (Not doing code reviews) 2015/02/04 20:10:49 This seems fine. One thing we can do is to add a
847 // The TV of LineContinuation :: \ LineTerminatorSequence is the empty 847 // The TV of LineContinuation :: \ LineTerminatorSequence is the empty
848 // code unit sequence. 848 // code unit sequence.
849 uc32 lastChar = c0_; 849 uc32 lastChar = c0_;
850 Advance<capture_raw>(); 850 Advance<capture_raw>();
851 if (lastChar == '\r') { 851 if (lastChar == '\r') {
852 ReduceRawLiteralLength(1); // Remove \r 852 ReduceRawLiteralLength(1); // Remove \r
853 if (c0_ == '\n') { 853 if (c0_ == '\n') {
854 Advance<capture_raw>(); // Adds \n 854 Advance<capture_raw>(); // Adds \n
855 } else { 855 } else {
856 AddRawLiteralChar('\n'); 856 AddRawLiteralChar('\n');
(...skipping 630 matching lines...) Expand 10 before | Expand all | Expand 10 after
1487 } 1487 }
1488 backing_store_.Add(static_cast<uint8_t>((one_byte_length >> 7) | 0x80u)); 1488 backing_store_.Add(static_cast<uint8_t>((one_byte_length >> 7) | 0x80u));
1489 } 1489 }
1490 backing_store_.Add(static_cast<uint8_t>(one_byte_length & 0x7f)); 1490 backing_store_.Add(static_cast<uint8_t>(one_byte_length & 0x7f));
1491 1491
1492 backing_store_.AddBlock(bytes); 1492 backing_store_.AddBlock(bytes);
1493 return backing_store_.EndSequence().start(); 1493 return backing_store_.EndSequence().start();
1494 } 1494 }
1495 1495
1496 } } // namespace v8::internal 1496 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « no previous file | test/mjsunit/regress/regress-455212.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698