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

Unified Diff: src/parser.cc

Issue 7004016: JSON.parse improvement. Call "LookupSymbol" rather than "NewString"... (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: '' Created 9 years, 7 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/parser.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/parser.cc
===================================================================
--- src/parser.cc (revision 7848)
+++ src/parser.cc (working copy)
@@ -4084,6 +4084,21 @@
}
+Handle<String> JsonParser::GetSymbol() {
+ int literal_length = scanner_.literal_length();
+ if (literal_length == 0) {
+ return isolate()->factory()->empty_string();
+ }
+ if (scanner_.is_literal_ascii()) {
+ return isolate()->factory()->LookupAsciiSymbol(
+ scanner_.literal_ascii_string());
+ } else {
+ return isolate()->factory()->LookupTwoByteSymbol(
+ scanner_.literal_uc16_string());
+ }
+}
+
+
// Parse any JSON value.
Handle<Object> JsonParser::ParseJsonValue() {
Token::Value token = scanner_.Next();
@@ -4125,7 +4140,7 @@
if (scanner_.Next() != Token::STRING) {
return ReportUnexpectedToken();
}
- Handle<String> key = GetString();
+ Handle<String> key = GetSymbol();
if (scanner_.Next() != Token::COLON) {
return ReportUnexpectedToken();
}
« no previous file with comments | « src/parser.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698