Merge revision 8082 to trunk (fixes crbug 83877)
Review URL: http://codereview.chromium.org/6976027

git-svn-id: http://v8.googlecode.com/svn/trunk@8083 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
diff --git a/src/json-parser.cc b/src/json-parser.cc
index b18d1ec..6cb63ff 100644
--- a/src/json-parser.cc
+++ b/src/json-parser.cc
@@ -380,7 +380,7 @@
   while (c0_ != '"') {
     // Create new seq string
     if (count >= kInitialSpecialStringSize * allocation_count) {
-      allocation_count++;
+      allocation_count = allocation_count * 2;
       int new_size = allocation_count * kInitialSpecialStringSize;
       Handle<String> new_two_byte =
           isolate()->factory()->NewRawTwoByteString(new_size,
@@ -443,10 +443,18 @@
   Advance();
 
   // Shrink the the string to our length.
-  isolate()->heap()->
-      new_space()->
-      ShrinkStringAtAllocationBoundary<SeqTwoByteString>(*seq_two_byte,
-                                                         count);
+  if (isolate()->heap()->InNewSpace(*seq_two_byte)) {
+    isolate()->heap()->new_space()->
+          ShrinkStringAtAllocationBoundary<SeqTwoByteString>(*seq_two_byte,
+                                                             count);
+  } else {
+    int string_size = SeqTwoByteString::SizeFor(count);
+    int allocated_string_size =
+        SeqTwoByteString::SizeFor(kInitialSpecialStringSize * allocation_count);
+    int delta = allocated_string_size - string_size;
+    Address start_filler_object = seq_two_byte->address() + string_size;
+    isolate()->heap()->CreateFillerObjectAt(start_filler_object, delta);
+  }
   string_val_ = isolate()->factory()->NewConsString(ascii, seq_two_byte);
   return Token::STRING;
 }
diff --git a/src/json-parser.h b/src/json-parser.h
index e4ddda0..5903d21 100644
--- a/src/json-parser.h
+++ b/src/json-parser.h
@@ -135,7 +135,7 @@
     int end_pos;
   };
 
-  static const int kInitialSpecialStringSize = 100;
+  static const int kInitialSpecialStringSize = 1024;
 
 
  private:
diff --git a/src/version.cc b/src/version.cc
index 5e37840..df9c508 100644
--- a/src/version.cc
+++ b/src/version.cc
@@ -35,7 +35,7 @@
 #define MAJOR_VERSION     3
 #define MINOR_VERSION     3
 #define BUILD_NUMBER      10
-#define PATCH_LEVEL       0
+#define PATCH_LEVEL       1
 // Use 1 for candidates and 0 otherwise.
 // (Boolean macro values are not supported by all preprocessors.)
 #define IS_CANDIDATE_VERSION 0