Make sure the fast case of ScanJsonString bails out to the slow case correctly.
authoryangguo@chromium.org <yangguo@chromium.org@ce2b1a6d-e550-0410-aec6-3dcde31c8c00>
Thu, 18 Oct 2012 13:15:05 +0000 (13:15 +0000)
committeryangguo@chromium.org <yangguo@chromium.org@ce2b1a6d-e550-0410-aec6-3dcde31c8c00>
Thu, 18 Oct 2012 13:15:05 +0000 (13:15 +0000)
R=verwaest@chromium.org
BUG=

Review URL: https://chromiumcodereview.appspot.com/11185050

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@12757 ce2b1a6d-e550-0410-aec6-3dcde31c8c00

src/json-parser.h
test/mjsunit/json.js

index d940c14..80991f0 100644 (file)
@@ -580,9 +580,12 @@ Handle<String> JsonParser<seq_ascii>::ScanJsonString() {
     uc32 c0 = c0_;
     do {
       if (c0 == '\\') {
+        c0_ = c0;
+        int beg_pos = position_;
+        position_ = position;
         return SlowScanJsonString<SeqAsciiString, char>(source_,
-                                                        position_,
-                                                        position);
+                                                        beg_pos,
+                                                        position_);
       }
       if (c0 < 0x20) return Handle<String>::null();
       running_hash = StringHasher::AddCharacterCore(running_hash, c0);
index bead376..54fa185 100644 (file)
@@ -428,5 +428,5 @@ var o = JSON.parse('{"__proto__":5}');
 assertEquals(Object.prototype, o.__proto__);  // __proto__ isn't changed.
 assertEquals(0, Object.keys(o).length);  // __proto__ isn't added as enumerable.
 
-
-
+var json = '{"stuff before slash\\\\stuff after slash":"whatever"}';
+assertEquals(json, JSON.stringify(JSON.parse(json)));