Reviewers: Mads Ager,

Description:
Merge revision 8082 to 3.3 branch (fixes crbug 83877)

Please review this at http://codereview.chromium.org/7075011/

SVN Base: http://v8.googlecode.com/svn/branches/3.3/

Affected files:
  M     src/json-parser.h
  M     src/json-parser.cc
  M     src/version.cc


Index: src/json-parser.cc
===================================================================
--- src/json-parser.cc  (revision 8082)
+++ src/json-parser.cc  (working copy)
@@ -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;
 }
Index: src/json-parser.h
===================================================================
--- src/json-parser.h   (revision 8082)
+++ src/json-parser.h   (working copy)
@@ -135,7 +135,7 @@
     int end_pos;
   };

-  static const int kInitialSpecialStringSize = 100;
+  static const int kInitialSpecialStringSize = 1024;


  private:
Index: src/version.cc
===================================================================
--- src/version.cc      (revision 8082)
+++ src/version.cc      (working copy)
@@ -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


--
v8-dev mailing list
v8-dev@googlegroups.com
http://groups.google.com/group/v8-dev

Reply via email to