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/preparser.cc

Issue 12257005: Improve JSON stringifier's escape check. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: reduce impact on the scanner. Created 7 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 | Annotate | Revision Log
« no previous file with comments | « src/parser.cc ('k') | src/scanner.h » ('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 // Redistribution and use in source and binary forms, with or without 2 // Redistribution and use in source and binary forms, with or without
3 // modification, are permitted provided that the following conditions are 3 // modification, are permitted provided that the following conditions are
4 // met: 4 // met:
5 // 5 //
6 // * Redistributions of source code must retain the above copyright 6 // * Redistributions of source code must retain the above copyright
7 // notice, this list of conditions and the following disclaimer. 7 // notice, this list of conditions and the following disclaimer.
8 // * Redistributions in binary form must reproduce the above 8 // * Redistributions in binary form must reproduce the above
9 // copyright notice, this list of conditions and the following 9 // copyright notice, this list of conditions and the following
10 // disclaimer in the documentation and/or other materials provided 10 // disclaimer in the documentation and/or other materials provided
(...skipping 1619 matching lines...) Expand 10 before | Expand all | Expand 10 after
1630 #undef CHECK_OK 1630 #undef CHECK_OK
1631 1631
1632 1632
1633 // This function reads an identifier and determines whether or not it 1633 // This function reads an identifier and determines whether or not it
1634 // is 'get' or 'set'. 1634 // is 'get' or 'set'.
1635 PreParser::Identifier PreParser::ParseIdentifierNameOrGetOrSet(bool* is_get, 1635 PreParser::Identifier PreParser::ParseIdentifierNameOrGetOrSet(bool* is_get,
1636 bool* is_set, 1636 bool* is_set,
1637 bool* ok) { 1637 bool* ok) {
1638 Identifier result = ParseIdentifierName(ok); 1638 Identifier result = ParseIdentifierName(ok);
1639 if (!*ok) return Identifier::Default(); 1639 if (!*ok) return Identifier::Default();
1640 if (scanner_->is_literal_ascii() && 1640 if (scanner_->is_literal_printable_ascii() &&
1641 scanner_->literal_length() == 3) { 1641 scanner_->literal_length() == 3) {
1642 const char* token = scanner_->literal_ascii_string().start(); 1642 const char* token = scanner_->literal_ascii_string().start();
1643 *is_get = strncmp(token, "get", 3) == 0; 1643 *is_get = strncmp(token, "get", 3) == 0;
1644 *is_set = !*is_get && strncmp(token, "set", 3) == 0; 1644 *is_set = !*is_get && strncmp(token, "set", 3) == 0;
1645 } 1645 }
1646 return result; 1646 return result;
1647 } 1647 }
1648 1648
1649 bool PreParser::peek_any_identifier() { 1649 bool PreParser::peek_any_identifier() {
1650 i::Token::Value next = peek(); 1650 i::Token::Value next = peek();
(...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after
1780 backing_store_.Add(static_cast<byte>((ascii_length >> 14) | 0x80u)); 1780 backing_store_.Add(static_cast<byte>((ascii_length >> 14) | 0x80u));
1781 } 1781 }
1782 backing_store_.Add(static_cast<byte>((ascii_length >> 7) | 0x80u)); 1782 backing_store_.Add(static_cast<byte>((ascii_length >> 7) | 0x80u));
1783 } 1783 }
1784 backing_store_.Add(static_cast<byte>(ascii_length & 0x7f)); 1784 backing_store_.Add(static_cast<byte>(ascii_length & 0x7f));
1785 1785
1786 backing_store_.AddBlock(bytes); 1786 backing_store_.AddBlock(bytes);
1787 return backing_store_.EndSequence().start(); 1787 return backing_store_.EndSequence().start();
1788 } 1788 }
1789 } } // v8::preparser 1789 } } // v8::preparser
OLDNEW
« no previous file with comments | « src/parser.cc ('k') | src/scanner.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698