Version 1.2.4.

Improved performance of floating point number allocation for ARM platforms.

Fixed crash when using the instanceof operator on functions with number values in their prototype chain (issue 341).

Optimized virtual frame operations in the code generator to speed up compilation time and allocated the frames in the zone.

Made the representation of virtual frames and jump targets in the code generator much more compact.

Avoided linear search for non-locals in scope code when resolving variables inside with and eval scopes.

Optimized lexical scanner by dealing with whitespace as part of the token scanning instead of as a separate step before it.

Changed the scavenging collector so that promoted objects do not reside in the old generation while their remembered set is being swept for pointers into the young generation.

Fixed numeric overflow handling when compiling count operations.


git-svn-id: http://v8.googlecode.com/svn/trunk@1983 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
diff --git a/test/cctest/cctest.status b/test/cctest/cctest.status
index 7b43c8d..93e348b 100644
--- a/test/cctest/cctest.status
+++ b/test/cctest/cctest.status
@@ -40,6 +40,12 @@
 # BUG(240): Test seems flaky on ARM.
 test-api/RegExpInterruption: SKIP
 
+# We cannot assume that we can throw OutOfMemory exceptions in all situations.
+# Apparently our ARM box is in such a state. Skip the test as it also runs for
+# a long time.
+test-api/OutOfMemory: SKIP
+test-api/OutOfMemoryNested: SKIP
+
 [ $simulator == arm ]
 
 # BUG(271): During exception propagation, we compare pointers into the
diff --git a/test/cctest/test-api.cc b/test/cctest/test-api.cc
index 4b55b6b..59e3e50 100644
--- a/test/cctest/test-api.cc
+++ b/test/cctest/test-api.cc
@@ -30,6 +30,7 @@
 #include "v8.h"
 
 #include "api.h"
+#include "compilation-cache.h"
 #include "snapshot.h"
 #include "platform.h"
 #include "top.h"
@@ -464,6 +465,7 @@
     v8::internal::Heap::CollectAllGarbage();
     CHECK_EQ(0, TestResource::dispose_count);
   }
+  v8::internal::CompilationCache::Clear();
   v8::internal::Heap::CollectAllGarbage();
   CHECK_EQ(1, TestResource::dispose_count);
 }
@@ -484,6 +486,7 @@
     v8::internal::Heap::CollectAllGarbage();
     CHECK_EQ(0, TestAsciiResource::dispose_count);
   }
+  v8::internal::CompilationCache::Clear();
   v8::internal::Heap::CollectAllGarbage();
   CHECK_EQ(1, TestAsciiResource::dispose_count);
 }
@@ -505,6 +508,7 @@
     v8::internal::Heap::CollectAllGarbage();
     CHECK_EQ(0, TestResource::dispose_count);
   }
+  v8::internal::CompilationCache::Clear();
   v8::internal::Heap::CollectAllGarbage();
   CHECK_EQ(1, TestResource::dispose_count);
 }
@@ -527,6 +531,7 @@
     v8::internal::Heap::CollectAllGarbage();
     CHECK_EQ(0, TestAsciiResource::dispose_count);
   }
+  v8::internal::CompilationCache::Clear();
   v8::internal::Heap::CollectAllGarbage();
   CHECK_EQ(1, TestAsciiResource::dispose_count);
 }
@@ -1327,6 +1332,38 @@
 }
 
 
+static v8::Handle<Value> InterceptorForHiddenProperties(
+    Local<String> name, const AccessorInfo& info) {
+  // Make sure objects move.
+  bool saved_always_compact = i::FLAG_always_compact;
+  if (!i::FLAG_never_compact) {
+    i::FLAG_always_compact = true;
+  }
+  // The whole goal of this interceptor is to cause a GC during local property
+  // lookup.
+  i::Heap::CollectAllGarbage();
+  i::FLAG_always_compact = saved_always_compact;
+  return v8::Handle<Value>();
+}
+
+
+THREADED_TEST(HiddenPropertiesWithInterceptors) {
+  v8::HandleScope scope;
+  LocalContext context;
+
+  v8::Local<v8::String> key = v8_str("api-test::hidden-key");
+
+  // Associate an interceptor with an object and start setting hidden values.
+  Local<v8::FunctionTemplate> fun_templ = v8::FunctionTemplate::New();
+  Local<v8::ObjectTemplate> instance_templ = fun_templ->InstanceTemplate();
+  instance_templ->SetNamedPropertyHandler(InterceptorForHiddenProperties);
+  Local<v8::Function> function = fun_templ->GetFunction();
+  Local<v8::Object> obj = function->NewInstance();
+  CHECK(obj->SetHiddenValue(key, v8::Integer::New(2302)));
+  CHECK_EQ(2302, obj->GetHiddenValue(key)->Int32Value());
+}
+
+
 THREADED_TEST(External) {
   v8::HandleScope scope;
   int x = 3;
diff --git a/test/cctest/test-debug.cc b/test/cctest/test-debug.cc
index 288efba..9e5cf6d 100644
--- a/test/cctest/test-debug.cc
+++ b/test/cctest/test-debug.cc
@@ -30,6 +30,7 @@
 #include "v8.h"
 
 #include "api.h"
+#include "compilation-cache.h"
 #include "debug.h"
 #include "platform.h"
 #include "stub-cache.h"
@@ -1678,6 +1679,11 @@
   }
   CHECK_EQ(5, break_point_hit_count);
 
+  // BUG(343): It should not really be necessary to clear the
+  // compilation cache here, but right now the debugger relies on the
+  // script being recompiled, not just fetched from the cache.
+  i::CompilationCache::Clear();
+
   // Reload the script and get f again checking that the ignore survives.
   v8::Script::Compile(script, &origin)->Run();
   f = v8::Local<v8::Function>::Cast(env->Global()->Get(v8::String::New("f")));
diff --git a/test/cctest/test-hashmap.cc b/test/cctest/test-hashmap.cc
index 954dbe1..70213c9 100644
--- a/test/cctest/test-hashmap.cc
+++ b/test/cctest/test-hashmap.cc
@@ -38,20 +38,29 @@
 }
 
 
+typedef uint32_t (*IntKeyHash)(uint32_t key);
+
+
 class IntSet {
  public:
-  IntSet() : map_(DefaultMatchFun)  {}
+  explicit IntSet(IntKeyHash hash) : hash_(hash), map_(DefaultMatchFun)  {}
 
   void Insert(int x) {
     CHECK_NE(0, x);  // 0 corresponds to (void*)NULL - illegal key value
-    HashMap::Entry* p = map_.Lookup(reinterpret_cast<void*>(x), Hash(x), true);
+    HashMap::Entry* p = map_.Lookup(reinterpret_cast<void*>(x), hash_(x), true);
     CHECK(p != NULL);  // insert is set!
     CHECK_EQ(reinterpret_cast<void*>(x), p->key);
     // we don't care about p->value
   }
 
+  void Remove(int x) {
+    CHECK_NE(0, x);  // 0 corresponds to (void*)NULL - illegal key value
+    map_.Remove(reinterpret_cast<void*>(x), hash_(x));
+  }
+
   bool Present(int x) {
-    HashMap::Entry* p = map_.Lookup(reinterpret_cast<void*>(x), Hash(x), false);
+    HashMap::Entry* p =
+        map_.Lookup(reinterpret_cast<void*>(x), hash_(x), false);
     if (p != NULL) {
       CHECK_EQ(reinterpret_cast<void*>(x), p->key);
     }
@@ -72,13 +81,17 @@
   }
 
  private:
+  IntKeyHash hash_;
   HashMap map_;
-  static uint32_t Hash(uint32_t key)  { return key * 23; }
 };
 
 
-TEST(Set) {
-  IntSet set;
+static uint32_t Hash(uint32_t key)  { return 23; }
+static uint32_t CollisionHash(uint32_t key)  { return key & 0x3; }
+
+
+void TestSet(IntKeyHash hash, int size) {
+  IntSet set(hash);
   CHECK_EQ(0, set.occupancy());
 
   set.Insert(1);
@@ -96,6 +109,18 @@
   CHECK(!set.Present(4));
   CHECK_EQ(3, set.occupancy());
 
+  set.Remove(1);
+  CHECK(!set.Present(1));
+  CHECK(set.Present(2));
+  CHECK(set.Present(3));
+  CHECK_EQ(2, set.occupancy());
+
+  set.Remove(3);
+  CHECK(!set.Present(1));
+  CHECK(set.Present(2));
+  CHECK(!set.Present(3));
+  CHECK_EQ(1, set.occupancy());
+
   set.Clear();
   CHECK_EQ(0, set.occupancy());
 
@@ -103,21 +128,49 @@
   const int start = 453;
   const int factor = 13;
   const int offset = 7;
-  const uint32_t n = 1000;
+  const uint32_t n = size;
 
   int x = start;
   for (uint32_t i = 0; i < n; i++) {
     CHECK_EQ(i, static_cast<double>(set.occupancy()));
     set.Insert(x);
-    x = x*factor + offset;
+    x = x * factor + offset;
   }
+  CHECK_EQ(n, static_cast<double>(set.occupancy()));
 
   // Verify the same sequence of values.
   x = start;
   for (uint32_t i = 0; i < n; i++) {
     CHECK(set.Present(x));
-    x = x*factor + offset;
+    x = x * factor + offset;
   }
-
   CHECK_EQ(n, static_cast<double>(set.occupancy()));
+
+  // Remove all these values.
+  x = start;
+  for (uint32_t i = 0; i < n; i++) {
+    CHECK_EQ(n - i, static_cast<double>(set.occupancy()));
+    CHECK(set.Present(x));
+    set.Remove(x);
+    CHECK(!set.Present(x));
+    x = x * factor + offset;
+
+    // Verify the the expected values are still there.
+    int y = start;
+    for (uint32_t j = 0; j < n; j++) {
+      if (j <= i) {
+        CHECK(!set.Present(y));
+      } else {
+        CHECK(set.Present(y));
+      }
+      y = y * factor + offset;
+    }
+  }
+  CHECK_EQ(0, set.occupancy());
+}
+
+
+TEST(Set) {
+  TestSet(Hash, 100);
+  TestSet(CollisionHash, 50);
 }
diff --git a/test/cctest/test-log-ia32.cc b/test/cctest/test-log-ia32.cc
index 43cb294..22b1600 100644
--- a/test/cctest/test-log-ia32.cc
+++ b/test/cctest/test-log-ia32.cc
@@ -13,6 +13,7 @@
 #include "top.h"
 #include "cctest.h"
 #include "disassembler.h"
+#include "register-allocator-inl.h"
 
 using v8::Function;
 using v8::Local;
diff --git a/test/mjsunit/debug-backtrace.js b/test/mjsunit/debug-backtrace.js
index f08f639..1d2bb9a 100644
--- a/test/mjsunit/debug-backtrace.js
+++ b/test/mjsunit/debug-backtrace.js
@@ -37,7 +37,7 @@
 };
 
 function g() {
- m();
+  m();
 };
 
 
@@ -80,8 +80,9 @@
   {
     // The expected backtrace is
     // 0: f
-    // 1: g
-    // 2: [anonymous]
+    // 1: m
+    // 2: g
+    // 3: [anonymous]
     
     var response;
     var backtrace;
@@ -133,6 +134,23 @@
     assertEquals(2, frames[1].index);
     assertEquals("g", response.lookup(frames[1].func.ref).name);
 
+    // Get backtrace with bottom two frames.
+    json = '{"seq":0,"type":"request","command":"backtrace","arguments":{"fromFrame":0,"toFrame":2, "bottom":true}}'
+    response = new ParsedResponse(dcp.processDebugJSONRequest(json));
+    backtrace = response.body();
+    assertEquals(2, backtrace.fromFrame);
+    assertEquals(4, backtrace.toFrame);
+    assertEquals(4, backtrace.totalFrames);
+    var frames = backtrace.frames;
+    assertEquals(2, frames.length);
+    for (var i = 0; i < frames.length; i++) {
+      assertEquals('frame', frames[i].type);
+    }
+    assertEquals(2, frames[0].index);
+    assertEquals("g", response.lookup(frames[0].func.ref).name);
+    assertEquals(3, frames[1].index);
+    assertEquals("", response.lookup(frames[1].func.ref).name);
+
     // Get the individual frames.
     json = '{"seq":0,"type":"request","command":"frame"}'
     response = new ParsedResponse(dcp.processDebugJSONRequest(json));
diff --git a/test/mjsunit/debug-compile-event.js b/test/mjsunit/debug-compile-event.js
index 035e36c..18975de 100644
--- a/test/mjsunit/debug-compile-event.js
+++ b/test/mjsunit/debug-compile-event.js
@@ -65,6 +65,10 @@
         // exact source.
         assertEquals(current_source, event_data.script().source());
       }
+      // Check that script context is included into the event message.
+      var json = event_data.toJSONProtocol();
+      var msg = eval('(' + json + ')');
+      assertTrue('context' in msg.body.script);
     }
   } catch (e) {
     exception = e
diff --git a/test/mjsunit/debug-scripts-request.js b/test/mjsunit/debug-scripts-request.js
index cf1615b..80b3bce 100644
--- a/test/mjsunit/debug-scripts-request.js
+++ b/test/mjsunit/debug-scripts-request.js
@@ -66,9 +66,6 @@
     testArguments(dcp, '{"types":"xx"}', false);
 
     // Test legal scripts requests.
-    var request = '{' + base_request + '}'
-    var response = safeEval(dcp.processDebugJSONRequest(request));
-    assertTrue(response.success);
     testArguments(dcp, '{}', true);
     testArguments(dcp, '{"types":1}', true);
     testArguments(dcp, '{"types":2}', true);
@@ -76,6 +73,21 @@
     testArguments(dcp, '{"types":7}', true);
     testArguments(dcp, '{"types":0xFF}', true);
 
+    // Test request for all scripts.
+    var request = '{' + base_request + '}'
+    var response = safeEval(dcp.processDebugJSONRequest(request));
+    assertTrue(response.success);
+
+    // Test filtering by id.
+    assertEquals(2, response.body.length);
+    var script = response.body[0];
+    var request = '{' + base_request + ',"arguments":{"ids":[' +
+                  script.id + ']}}';
+    var response = safeEval(dcp.processDebugJSONRequest(request));
+    assertTrue(response.success);
+    assertEquals(1, response.body.length);
+    assertEquals(script.id, response.body[0].id);
+
     // Indicate that all was processed.
     listenerComplete = true;
   }
@@ -91,5 +103,6 @@
 debugger;
 
 // Make sure that the debug event listener vas invoked with no exceptions.
-assertTrue(listenerComplete, "listener did not run to completion");
+assertTrue(listenerComplete,
+           "listener did not run to completion, exception: " + exception);
 assertFalse(exception, "exception in listener")
diff --git a/test/mjsunit/mirror-array.js b/test/mjsunit/mirror-array.js
index 1873d1e..eb8f72a 100644
--- a/test/mjsunit/mirror-array.js
+++ b/test/mjsunit/mirror-array.js
@@ -44,8 +44,9 @@
   // Create mirror and JSON representation.
   var mirror = debug.MakeMirror(a);
   var serializer = debug.MakeMirrorSerializer();
-  var json = serializer.serializeValue(mirror);
-  var refs = new MirrorRefCache(serializer.serializeReferencedObjects());
+  var json = JSON.stringify(serializer.serializeValue(mirror));
+  var refs = new MirrorRefCache(
+      JSON.stringify(serializer.serializeReferencedObjects()));
 
   // Check the mirror hierachy.
   assertTrue(mirror instanceof debug.Mirror, 'Unexpected mirror hierachy');
diff --git a/test/mjsunit/mirror-boolean.js b/test/mjsunit/mirror-boolean.js
index 4f93089..311c781 100644
--- a/test/mjsunit/mirror-boolean.js
+++ b/test/mjsunit/mirror-boolean.js
@@ -32,7 +32,7 @@
   // Create mirror and JSON representation.
   var mirror = debug.MakeMirror(b);
   var serializer = debug.MakeMirrorSerializer();
-  var json = serializer.serializeValue(mirror);
+  var json = JSON.stringify(serializer.serializeValue(mirror));
 
   // Check the mirror hierachy.
   assertTrue(mirror instanceof debug.Mirror);
diff --git a/test/mjsunit/mirror-date.js b/test/mjsunit/mirror-date.js
index a6334d0..6b6a3ad 100644
--- a/test/mjsunit/mirror-date.js
+++ b/test/mjsunit/mirror-date.js
@@ -32,7 +32,7 @@
   // Create mirror and JSON representation.
   var mirror = debug.MakeMirror(d);
   var serializer = debug.MakeMirrorSerializer();
-  var json = serializer.serializeValue(mirror);
+  var json = JSON.stringify(serializer.serializeValue(mirror));
 
   // Check the mirror hierachy.
   assertTrue(mirror instanceof debug.Mirror);
@@ -55,9 +55,9 @@
   assertEquals(iso8601, fromJSON.value);
 }
 
-
 // Test Date values.
-testDateMirror(new Date(Date.parse("Dec 25, 1995 1:30 UTC")), "1995-12-25T01:30:00.000Z");
+testDateMirror(new Date(Date.parse("Dec 25, 1995 1:30 UTC")),
+               "1995-12-25T01:30:00Z");
 d = new Date();
 d.setUTCFullYear(1967);
 d.setUTCMonth(0); // January.
@@ -66,10 +66,10 @@
 d.setUTCMinutes(22);
 d.setUTCSeconds(59);
 d.setUTCMilliseconds(0);
-testDateMirror(d, "1967-01-17T09:22:59.000Z");
+testDateMirror(d, "1967-01-17T09:22:59Z");
 d.setUTCMilliseconds(1);
-testDateMirror(d, "1967-01-17T09:22:59.001Z");
-d.setUTCMilliseconds(12);
-testDateMirror(d, "1967-01-17T09:22:59.012Z");
-d.setUTCMilliseconds(123);
-testDateMirror(d, "1967-01-17T09:22:59.123Z");
+testDateMirror(d, "1967-01-17T09:22:59Z");
+d.setUTCSeconds(12);
+testDateMirror(d, "1967-01-17T09:22:12Z");
+d.setUTCSeconds(36);
+testDateMirror(d, "1967-01-17T09:22:36Z");
diff --git a/test/mjsunit/mirror-error.js b/test/mjsunit/mirror-error.js
index 37ec46c..4ed8c1b 100644
--- a/test/mjsunit/mirror-error.js
+++ b/test/mjsunit/mirror-error.js
@@ -44,8 +44,9 @@
   // Create mirror and JSON representation.
   var mirror = debug.MakeMirror(e);
   var serializer = debug.MakeMirrorSerializer();
-  var json = serializer.serializeValue(mirror);
-  var refs = new MirrorRefCache(serializer.serializeReferencedObjects());
+  var json = JSON.stringify(serializer.serializeValue(mirror));
+  var refs = new MirrorRefCache(
+      JSON.stringify(serializer.serializeReferencedObjects()));
 
   // Check the mirror hierachy.
   assertTrue(mirror instanceof debug.Mirror);
diff --git a/test/mjsunit/mirror-function.js b/test/mjsunit/mirror-function.js
index 59d9e78..58aee3d 100644
--- a/test/mjsunit/mirror-function.js
+++ b/test/mjsunit/mirror-function.js
@@ -44,8 +44,9 @@
   // Create mirror and JSON representation.
   var mirror = debug.MakeMirror(f);
   var serializer = debug.MakeMirrorSerializer();
-  var json = serializer.serializeValue(mirror);
-  var refs = new MirrorRefCache(serializer.serializeReferencedObjects());
+  var json = JSON.stringify(serializer.serializeValue(mirror));
+  var refs = new MirrorRefCache(
+      JSON.stringify(serializer.serializeReferencedObjects()));
 
   // Check the mirror hierachy.
   assertTrue(mirror instanceof debug.Mirror);
diff --git a/test/mjsunit/mirror-null.js b/test/mjsunit/mirror-null.js
index db68966..1ee555b 100644
--- a/test/mjsunit/mirror-null.js
+++ b/test/mjsunit/mirror-null.js
@@ -31,7 +31,7 @@
 // Create mirror and JSON representation.
 var mirror = debug.MakeMirror(null);
 var serializer = debug.MakeMirrorSerializer();
-var json = serializer.serializeValue(mirror);
+var json = JSON.stringify(serializer.serializeValue(mirror));
 
 // Check the mirror hierachy.
 assertTrue(mirror instanceof debug.Mirror);
diff --git a/test/mjsunit/mirror-number.js b/test/mjsunit/mirror-number.js
index 68eb0d7..2db5df4 100644
--- a/test/mjsunit/mirror-number.js
+++ b/test/mjsunit/mirror-number.js
@@ -32,7 +32,7 @@
   // Create mirror and JSON representation.
   var mirror = debug.MakeMirror(n);
   var serializer = debug.MakeMirrorSerializer();
-  var json = serializer.serializeValue(mirror);
+  var json = JSON.stringify(serializer.serializeValue(mirror));
 
   // Check the mirror hierachy.
   assertTrue(mirror instanceof debug.Mirror);
diff --git a/test/mjsunit/mirror-object.js b/test/mjsunit/mirror-object.js
index e829a0e..ad7add8 100644
--- a/test/mjsunit/mirror-object.js
+++ b/test/mjsunit/mirror-object.js
@@ -44,8 +44,9 @@
   // Create mirror and JSON representation.
   var mirror = debug.MakeMirror(obj);
   var serializer = debug.MakeMirrorSerializer();
-  var json = serializer.serializeValue(mirror);
-  var refs = new MirrorRefCache(serializer.serializeReferencedObjects());
+  var json = JSON.stringify(serializer.serializeValue(mirror));
+  var refs = new MirrorRefCache(
+      JSON.stringify(serializer.serializeReferencedObjects()));
 
   // Check the mirror hierachy.
   assertTrue(mirror instanceof debug.Mirror, 'Unexpected mirror hierachy');
@@ -105,7 +106,7 @@
   assertEquals(names.length, fromJSON.properties.length, 'Some properties missing in JSON');
   for (var i = 0; i < fromJSON.properties.length; i++) {
     var name = fromJSON.properties[i].name;
-    if (!name) name = fromJSON.properties[i].index;
+    if (typeof name == 'undefined') name = fromJSON.properties[i].index;
     var found = false;
     for (var j = 0; j < names.length; j++) {
       if (names[j] == name) {
@@ -157,7 +158,6 @@
   this.y_ = y;
 }
 
-
 // Test a number of different objects.
 testObjectMirror({}, 'Object', 'Object');
 testObjectMirror({'a':1,'b':2}, 'Object', 'Object');
diff --git a/test/mjsunit/mirror-regexp.js b/test/mjsunit/mirror-regexp.js
index 0490b17..8c834bf 100644
--- a/test/mjsunit/mirror-regexp.js
+++ b/test/mjsunit/mirror-regexp.js
@@ -55,8 +55,9 @@
   // Create mirror and JSON representation.
   var mirror = debug.MakeMirror(r);
   var serializer = debug.MakeMirrorSerializer();
-  var json = serializer.serializeValue(mirror);
-  var refs = new MirrorRefCache(serializer.serializeReferencedObjects());
+  var json = JSON.stringify(serializer.serializeValue(mirror));
+  var refs = new MirrorRefCache(
+      JSON.stringify(serializer.serializeReferencedObjects()));
 
   // Check the mirror hierachy.
   assertTrue(mirror instanceof debug.Mirror);
diff --git a/test/mjsunit/mirror-script.js b/test/mjsunit/mirror-script.js
index 61f0f3a..2ffa44f 100644
--- a/test/mjsunit/mirror-script.js
+++ b/test/mjsunit/mirror-script.js
@@ -32,7 +32,7 @@
   // Create mirror and JSON representation.
   var mirror = debug.MakeMirror(f).script();
   var serializer = debug.MakeMirrorSerializer();
-  var json = serializer.serializeValue(mirror);
+  var json = JSON.stringify(serializer.serializeValue(mirror));
 
   // Check the mirror hierachy.
   assertTrue(mirror instanceof debug.Mirror);
diff --git a/test/mjsunit/mirror-string.js b/test/mjsunit/mirror-string.js
index eeabc5f..c241849 100644
--- a/test/mjsunit/mirror-string.js
+++ b/test/mjsunit/mirror-string.js
@@ -34,7 +34,7 @@
   // Create mirror and JSON representation.
   var mirror = debug.MakeMirror(s);
   var serializer = debug.MakeMirrorSerializer();
-  var json = serializer.serializeValue(mirror);
+  var json = JSON.stringify(serializer.serializeValue(mirror));
 
   // Check the mirror hierachy.
   assertTrue(mirror instanceof debug.Mirror);
diff --git a/test/mjsunit/mirror-undefined.js b/test/mjsunit/mirror-undefined.js
index 2b5b84c..7f63239 100644
--- a/test/mjsunit/mirror-undefined.js
+++ b/test/mjsunit/mirror-undefined.js
@@ -31,7 +31,7 @@
 // Create mirror and JSON representation.
 var mirror = debug.MakeMirror(void 0);
 var serializer = debug.MakeMirrorSerializer();
-var json = serializer.serializeValue(mirror);
+var json = JSON.stringify(serializer.serializeValue(mirror));
 
 // Check the mirror hierachy.
 assertTrue(mirror instanceof debug.Mirror);
diff --git a/test/mjsunit/mirror-unresolved-function.js b/test/mjsunit/mirror-unresolved-function.js
index 8d8ca37..c1fe4a3 100644
--- a/test/mjsunit/mirror-unresolved-function.js
+++ b/test/mjsunit/mirror-unresolved-function.js
@@ -42,8 +42,9 @@
 
 var mirror = new debug.UnresolvedFunctionMirror("f");
 var serializer = debug.MakeMirrorSerializer();
-var json = serializer.serializeValue(mirror);
-var refs = new MirrorRefCache(serializer.serializeReferencedObjects());
+var json = JSON.stringify(serializer.serializeValue(mirror));
+var refs = new MirrorRefCache(
+    JSON.stringify(serializer.serializeReferencedObjects()));
 
 // Check the mirror hierachy for unresolved functions.
 assertTrue(mirror instanceof debug.Mirror);
diff --git a/test/mjsunit/bugs/bug-334.js b/test/mjsunit/regress/regress-334.js
similarity index 100%
rename from test/mjsunit/bugs/bug-334.js
rename to test/mjsunit/regress/regress-334.js