Commit b5144668 authored by sandholm@chromium.org's avatar sandholm@chromium.org

Specialize JSON parser to only check for SequentialAsciiString once.

Review URL: http://codereview.chromium.org/7134010

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@8214 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
parent ad98d142
......@@ -85,7 +85,6 @@ SOURCES = {
inspector.cc
interpreter-irregexp.cc
isolate.cc
json-parser.cc
jsregexp.cc
lithium-allocator.cc
lithium.cc
......
This diff is collapsed.
This diff is collapsed.
......@@ -8480,7 +8480,14 @@ RUNTIME_FUNCTION(MaybeObject*, Runtime_ParseJson) {
ASSERT_EQ(1, args.length());
CONVERT_ARG_CHECKED(String, source, 0);
Handle<Object> result = JsonParser::Parse(source);
source = Handle<String>(source->TryFlattenGetString());
// Optimized fast case where we only have ascii characters.
Handle<Object> result;
if (source->IsSeqAsciiString()) {
result = JsonParser<true>::Parse(source);
} else {
result = JsonParser<false>::Parse(source);
}
if (result.is_null()) {
// Syntax error or stack overflow in scanner.
ASSERT(isolate->has_pending_exception());
......
......@@ -525,7 +525,6 @@
'../../src/inspector.h',
'../../src/interpreter-irregexp.cc',
'../../src/interpreter-irregexp.h',
'../../src/json-parser.cc',
'../../src/json-parser.h',
'../../src/jsregexp.cc',
'../../src/jsregexp.h',
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment