Merge V8 3.9 at 3.9.24.9

http://v8.googlecode.com/svn/branches/3.9@11260

Bug: 5688872
Change-Id: Iddd944e82189d92df3fc427dc5f0d3f1b2f0c6c8
diff --git a/test/cctest/SConscript b/test/cctest/SConscript
index edb859e..bcd1e98 100644
--- a/test/cctest/SConscript
+++ b/test/cctest/SConscript
@@ -1,4 +1,4 @@
-# Copyright 2008 the V8 project authors. All rights reserved.
+# Copyright 2012 the V8 project authors. All rights reserved.
 # Redistribution and use in source and binary forms, with or without
 # modification, are permitted provided that the following conditions are
 # met:
@@ -62,6 +62,7 @@
     'test-conversions.cc',
     'test-cpu-profiler.cc',
     'test-dataflow.cc',
+    'test-date.cc',
     'test-debug.cc',
     'test-decls.cc',
     'test-deoptimization.cc',
@@ -86,6 +87,7 @@
     'test-parsing.cc',
     'test-platform-tls.cc',
     'test-profile-generator.cc',
+    'test-random.cc',
     'test-regexp.cc',
     'test-reloc-info.cc',
     'test-serialize.cc',
diff --git a/test/cctest/cctest.gyp b/test/cctest/cctest.gyp
index 3b8f4f6..a242fe3 100644
--- a/test/cctest/cctest.gyp
+++ b/test/cctest/cctest.gyp
@@ -1,4 +1,4 @@
-# Copyright 2011 the V8 project authors. All rights reserved.
+# Copyright 2012 the V8 project authors. All rights reserved.
 # Redistribution and use in source and binary forms, with or without
 # modification, are permitted provided that the following conditions are
 # met:
@@ -57,6 +57,7 @@
         'test-conversions.cc',
         'test-cpu-profiler.cc',
         'test-dataflow.cc',
+        'test-date.cc',
         'test-debug.cc',
         'test-decls.cc',
         'test-deoptimization.cc',
@@ -81,6 +82,7 @@
         'test-parsing.cc',
         'test-platform-tls.cc',
         'test-profile-generator.cc',
+        'test-random.cc',
         'test-regexp.cc',
         'test-reloc-info.cc',
         'test-serialize.cc',
diff --git a/test/cctest/cctest.status b/test/cctest/cctest.status
index 2de0afb..af28be1 100644
--- a/test/cctest/cctest.status
+++ b/test/cctest/cctest.status
@@ -84,10 +84,6 @@
 
 
 ##############################################################################
-[ $arch == mips ]
-test-serialize: SKIP
-
-##############################################################################
 [ $arch == mips && $crankshaft ]
 
 # Tests that time out with crankshaft.
diff --git a/test/cctest/test-api.cc b/test/cctest/test-api.cc
index 59d6d19..b1a23c1 100644
--- a/test/cctest/test-api.cc
+++ b/test/cctest/test-api.cc
@@ -450,8 +450,7 @@
     CHECK_EQ(0, dispose_count);
   }
   i::Isolate::Current()->compilation_cache()->Clear();
-  // TODO(1608): This should use kAbortIncrementalMarking.
-  HEAP->CollectAllGarbage(i::Heap::kMakeHeapIterableMask);
+  HEAP->CollectAllGarbage(i::Heap::kAbortIncrementalMarkingMask);
   CHECK_EQ(1, dispose_count);
 }
 
@@ -477,8 +476,7 @@
     CHECK_EQ(0, dispose_count);
   }
   i::Isolate::Current()->compilation_cache()->Clear();
-  // TODO(1608): This should use kAbortIncrementalMarking.
-  HEAP->CollectAllGarbage(i::Heap::kMakeHeapIterableMask);
+  HEAP->CollectAllGarbage(i::Heap::kAbortIncrementalMarkingMask);
   CHECK_EQ(1, dispose_count);
 }
 
@@ -2253,9 +2251,8 @@
     V8::AddObjectGroup(g2_objects, 2);
     V8::AddImplicitReferences(g2s2, g2_children, 1);
   }
-  // Do a single full GC. Use kMakeHeapIterableMask to ensure that
-  // incremental garbage collection is stopped.
-  HEAP->CollectAllGarbage(i::Heap::kMakeHeapIterableMask);
+  // Do a single full GC, ensure incremental marking is stopped.
+  HEAP->CollectAllGarbage(i::Heap::kAbortIncrementalMarkingMask);
 
   // All object should be alive.
   CHECK_EQ(0, counter.NumberOfWeakCalls());
@@ -2279,7 +2276,7 @@
     V8::AddImplicitReferences(g2s2, g2_children, 1);
   }
 
-  HEAP->CollectAllGarbage(i::Heap::kMakeHeapIterableMask);
+  HEAP->CollectAllGarbage(i::Heap::kAbortIncrementalMarkingMask);
 
   // All objects should be gone. 5 global handles in total.
   CHECK_EQ(5, counter.NumberOfWeakCalls());
@@ -2288,7 +2285,7 @@
   g1c1.MakeWeak(reinterpret_cast<void*>(&counter), &WeakPointerCallback);
   g2c1.MakeWeak(reinterpret_cast<void*>(&counter), &WeakPointerCallback);
 
-  HEAP->CollectAllGarbage(i::Heap::kMakeHeapIterableMask);
+  HEAP->CollectAllGarbage(i::Heap::kAbortIncrementalMarkingMask);
   CHECK_EQ(7, counter.NumberOfWeakCalls());
 }
 
@@ -2344,7 +2341,7 @@
     V8::AddImplicitReferences(g3s1, g3_children, 1);
   }
   // Do a single full GC
-  HEAP->CollectAllGarbage(i::Heap::kMakeHeapIterableMask);
+  HEAP->CollectAllGarbage(i::Heap::kAbortIncrementalMarkingMask);
 
   // All object should be alive.
   CHECK_EQ(0, counter.NumberOfWeakCalls());
@@ -2368,7 +2365,7 @@
     V8::AddImplicitReferences(g3s1, g3_children, 1);
   }
 
-  HEAP->CollectAllGarbage(i::Heap::kMakeHeapIterableMask);
+  HEAP->CollectAllGarbage(i::Heap::kAbortIncrementalMarkingMask);
 
   // All objects should be gone. 7 global handles in total.
   CHECK_EQ(7, counter.NumberOfWeakCalls());
@@ -5529,6 +5526,17 @@
 }
 
 
+int GetUtf8Length(Handle<String> str) {
+  int len = str->Utf8Length();
+  if (len < 0) {
+    i::Handle<i::String> istr(v8::Utils::OpenHandle(*str));
+    i::FlattenString(istr);
+    len = str->Utf8Length();
+  }
+  return len;
+}
+
+
 THREADED_TEST(StringWrite) {
   LocalContext context;
   v8::HandleScope scope;
@@ -5609,7 +5617,7 @@
   CHECK_EQ(0, strncmp(utf8buf, "ab\1", 3));
 
   memset(utf8buf, 0x1, sizeof(utf8buf));
-  len = left_tree->Utf8Length();
+  len = GetUtf8Length(left_tree);
   int utf8_expected =
       (0x80 + (0x800 - 0x80) * 2 + (0xd800 - 0x800) * 3) / kStride;
   CHECK_EQ(utf8_expected, len);
@@ -5623,7 +5631,7 @@
   CHECK_EQ(1, utf8buf[utf8_expected]);
 
   memset(utf8buf, 0x1, sizeof(utf8buf));
-  len = right_tree->Utf8Length();
+  len = GetUtf8Length(right_tree);
   CHECK_EQ(utf8_expected, len);
   len = right_tree->WriteUtf8(utf8buf, utf8_expected, &charlen);
   CHECK_EQ(utf8_expected, len);
@@ -5748,6 +5756,225 @@
 }
 
 
+static void Utf16Helper(
+    LocalContext& context,
+    const char* name,
+    const char* lengths_name,
+    int len) {
+  Local<v8::Array> a =
+      Local<v8::Array>::Cast(context->Global()->Get(v8_str(name)));
+  Local<v8::Array> alens =
+      Local<v8::Array>::Cast(context->Global()->Get(v8_str(lengths_name)));
+  for (int i = 0; i < len; i++) {
+    Local<v8::String> string =
+      Local<v8::String>::Cast(a->Get(i));
+    Local<v8::Number> expected_len =
+      Local<v8::Number>::Cast(alens->Get(i));
+    CHECK_EQ(expected_len->Value() != string->Length(),
+             string->MayContainNonAscii());
+    int length = GetUtf8Length(string);
+    CHECK_EQ(static_cast<int>(expected_len->Value()), length);
+  }
+}
+
+
+static uint16_t StringGet(Handle<String> str, int index) {
+  i::Handle<i::String> istring =
+      v8::Utils::OpenHandle(String::Cast(*str));
+  return istring->Get(index);
+}
+
+
+static void WriteUtf8Helper(
+    LocalContext& context,
+    const char* name,
+    const char* lengths_name,
+    int len) {
+  Local<v8::Array> b =
+      Local<v8::Array>::Cast(context->Global()->Get(v8_str(name)));
+  Local<v8::Array> alens =
+      Local<v8::Array>::Cast(context->Global()->Get(v8_str(lengths_name)));
+  char buffer[1000];
+  char buffer2[1000];
+  for (int i = 0; i < len; i++) {
+    Local<v8::String> string =
+      Local<v8::String>::Cast(b->Get(i));
+    Local<v8::Number> expected_len =
+      Local<v8::Number>::Cast(alens->Get(i));
+    int utf8_length = static_cast<int>(expected_len->Value());
+    for (int j = utf8_length + 1; j >= 0; j--) {
+      memset(reinterpret_cast<void*>(&buffer), 42, sizeof(buffer));
+      memset(reinterpret_cast<void*>(&buffer2), 42, sizeof(buffer2));
+      int nchars;
+      int utf8_written =
+          string->WriteUtf8(buffer, j, &nchars, String::NO_OPTIONS);
+      int utf8_written2 =
+          string->WriteUtf8(buffer2, j, &nchars, String::NO_NULL_TERMINATION);
+      CHECK_GE(utf8_length + 1, utf8_written);
+      CHECK_GE(utf8_length, utf8_written2);
+      for (int k = 0; k < utf8_written2; k++) {
+        CHECK_EQ(buffer[k], buffer2[k]);
+      }
+      CHECK(nchars * 3 >= utf8_written - 1);
+      CHECK(nchars <= utf8_written);
+      if (j == utf8_length + 1) {
+        CHECK_EQ(utf8_written2, utf8_length);
+        CHECK_EQ(utf8_written2 + 1, utf8_written);
+      }
+      CHECK_EQ(buffer[utf8_written], 42);
+      if (j > utf8_length) {
+        if (utf8_written != 0) CHECK_EQ(buffer[utf8_written - 1], 0);
+        if (utf8_written > 1) CHECK_NE(buffer[utf8_written - 2], 42);
+        Handle<String> roundtrip = v8_str(buffer);
+        CHECK(roundtrip->Equals(string));
+      } else {
+        if (utf8_written != 0) CHECK_NE(buffer[utf8_written - 1], 42);
+      }
+      if (utf8_written2 != 0) CHECK_NE(buffer[utf8_written - 1], 42);
+      if (nchars >= 2) {
+        uint16_t trail = StringGet(string, nchars - 1);
+        uint16_t lead = StringGet(string, nchars - 2);
+        if (((lead & 0xfc00) == 0xd800) &&
+            ((trail & 0xfc00) == 0xdc00)) {
+          unsigned char u1 = buffer2[utf8_written2 - 4];
+          unsigned char u2 = buffer2[utf8_written2 - 3];
+          unsigned char u3 = buffer2[utf8_written2 - 2];
+          unsigned char u4 = buffer2[utf8_written2 - 1];
+          CHECK_EQ((u1 & 0xf8), 0xf0);
+          CHECK_EQ((u2 & 0xc0), 0x80);
+          CHECK_EQ((u3 & 0xc0), 0x80);
+          CHECK_EQ((u4 & 0xc0), 0x80);
+          uint32_t c = 0x10000 + ((lead & 0x3ff) << 10) + (trail & 0x3ff);
+          CHECK_EQ((u4 & 0x3f), (c & 0x3f));
+          CHECK_EQ((u3 & 0x3f), ((c >> 6) & 0x3f));
+          CHECK_EQ((u2 & 0x3f), ((c >> 12) & 0x3f));
+          CHECK_EQ((u1 & 0x3), c >> 18);
+        }
+      }
+    }
+  }
+}
+
+
+THREADED_TEST(Utf16) {
+  LocalContext context;
+  v8::HandleScope scope;
+  CompileRun(
+      "var pad = '01234567890123456789';"
+      "var p = [];"
+      "var plens = [20, 3, 3];"
+      "p.push('01234567890123456789');"
+      "var lead = 0xd800;"
+      "var trail = 0xdc00;"
+      "p.push(String.fromCharCode(0xd800));"
+      "p.push(String.fromCharCode(0xdc00));"
+      "var a = [];"
+      "var b = [];"
+      "var c = [];"
+      "var alens = [];"
+      "for (var i = 0; i < 3; i++) {"
+      "  p[1] = String.fromCharCode(lead++);"
+      "  for (var j = 0; j < 3; j++) {"
+      "    p[2] = String.fromCharCode(trail++);"
+      "    a.push(p[i] + p[j]);"
+      "    b.push(p[i] + p[j]);"
+      "    c.push(p[i] + p[j]);"
+      "    alens.push(plens[i] + plens[j]);"
+      "  }"
+      "}"
+      "alens[5] -= 2;"  // Here the surrogate pairs match up.
+      "var a2 = [];"
+      "var b2 = [];"
+      "var c2 = [];"
+      "var a2lens = [];"
+      "for (var m = 0; m < 9; m++) {"
+      "  for (var n = 0; n < 9; n++) {"
+      "    a2.push(a[m] + a[n]);"
+      "    b2.push(b[m] + b[n]);"
+      "    var newc = 'x' + c[m] + c[n] + 'y';"
+      "    c2.push(newc.substring(1, newc.length - 1));"
+      "    var utf = alens[m] + alens[n];"  // And here.
+           // The 'n's that start with 0xdc.. are 6-8
+           // The 'm's that end with 0xd8.. are 1, 4 and 7
+      "    if ((m % 3) == 1 && n >= 6) utf -= 2;"
+      "    a2lens.push(utf);"
+      "  }"
+      "}");
+  Utf16Helper(context, "a", "alens", 9);
+  Utf16Helper(context, "a2", "a2lens", 81);
+  WriteUtf8Helper(context, "b", "alens", 9);
+  WriteUtf8Helper(context, "b2", "a2lens", 81);
+  WriteUtf8Helper(context, "c2", "a2lens", 81);
+}
+
+
+static bool SameSymbol(Handle<String> s1, Handle<String> s2) {
+  i::Handle<i::String> is1(v8::Utils::OpenHandle(*s1));
+  i::Handle<i::String> is2(v8::Utils::OpenHandle(*s2));
+  return *is1 == *is2;
+}
+
+
+static void SameSymbolHelper(const char* a, const char* b) {
+  Handle<String> symbol1 = v8::String::NewSymbol(a);
+  Handle<String> symbol2 = v8::String::NewSymbol(b);
+  CHECK(SameSymbol(symbol1, symbol2));
+}
+
+
+THREADED_TEST(Utf16Symbol) {
+  LocalContext context;
+  v8::HandleScope scope;
+
+  Handle<String> symbol1 = v8::String::NewSymbol("abc");
+  Handle<String> symbol2 = v8::String::NewSymbol("abc");
+  CHECK(SameSymbol(symbol1, symbol2));
+
+  SameSymbolHelper("\360\220\220\205",  // 4 byte encoding.
+                   "\355\240\201\355\260\205");  // 2 3-byte surrogates.
+  SameSymbolHelper("\355\240\201\355\260\206",  // 2 3-byte surrogates.
+                   "\360\220\220\206");  // 4 byte encoding.
+  SameSymbolHelper("x\360\220\220\205",  // 4 byte encoding.
+                   "x\355\240\201\355\260\205");  // 2 3-byte surrogates.
+  SameSymbolHelper("x\355\240\201\355\260\206",  // 2 3-byte surrogates.
+                   "x\360\220\220\206");  // 4 byte encoding.
+  CompileRun(
+      "var sym0 = 'benedictus';"
+      "var sym0b = 'S\303\270ren';"
+      "var sym1 = '\355\240\201\355\260\207';"
+      "var sym2 = '\360\220\220\210';"
+      "var sym3 = 'x\355\240\201\355\260\207';"
+      "var sym4 = 'x\360\220\220\210';"
+      "if (sym1.length != 2) throw sym1;"
+      "if (sym1.charCodeAt(1) != 0xdc07) throw sym1.charCodeAt(1);"
+      "if (sym2.length != 2) throw sym2;"
+      "if (sym2.charCodeAt(1) != 0xdc08) throw sym2.charCodeAt(2);"
+      "if (sym3.length != 3) throw sym3;"
+      "if (sym3.charCodeAt(2) != 0xdc07) throw sym1.charCodeAt(2);"
+      "if (sym4.length != 3) throw sym4;"
+      "if (sym4.charCodeAt(2) != 0xdc08) throw sym2.charCodeAt(2);");
+  Handle<String> sym0 = v8::String::NewSymbol("benedictus");
+  Handle<String> sym0b = v8::String::NewSymbol("S\303\270ren");
+  Handle<String> sym1 = v8::String::NewSymbol("\355\240\201\355\260\207");
+  Handle<String> sym2 = v8::String::NewSymbol("\360\220\220\210");
+  Handle<String> sym3 = v8::String::NewSymbol("x\355\240\201\355\260\207");
+  Handle<String> sym4 = v8::String::NewSymbol("x\360\220\220\210");
+  v8::Local<v8::Object> global = context->Global();
+  Local<Value> s0 = global->Get(v8_str("sym0"));
+  Local<Value> s0b = global->Get(v8_str("sym0b"));
+  Local<Value> s1 = global->Get(v8_str("sym1"));
+  Local<Value> s2 = global->Get(v8_str("sym2"));
+  Local<Value> s3 = global->Get(v8_str("sym3"));
+  Local<Value> s4 = global->Get(v8_str("sym4"));
+  CHECK(SameSymbol(sym0, Handle<String>(String::Cast(*s0))));
+  CHECK(SameSymbol(sym0b, Handle<String>(String::Cast(*s0b))));
+  CHECK(SameSymbol(sym1, Handle<String>(String::Cast(*s1))));
+  CHECK(SameSymbol(sym2, Handle<String>(String::Cast(*s2))));
+  CHECK(SameSymbol(sym3, Handle<String>(String::Cast(*s3))));
+  CHECK(SameSymbol(sym4, Handle<String>(String::Cast(*s4))));
+}
+
+
 THREADED_TEST(ToArrayIndex) {
   v8::HandleScope scope;
   LocalContext context;
@@ -11050,14 +11277,18 @@
 }
 
 
-v8::Handle<v8::String> a;
-v8::Handle<v8::String> h;
+static const char* kPropertyA = "a";
+static const char* kPropertyH = "h";
 
 static bool NamedGetAccessBlockAandH(Local<v8::Object> obj,
                                        Local<Value> name,
                                        v8::AccessType type,
                                        Local<Value> data) {
-  return !(name->Equals(a) || name->Equals(h));
+  if (!name->IsString()) return false;
+  i::Handle<i::String> name_handle =
+      v8::Utils::OpenHandle(String::Cast(*name));
+  return !name_handle->IsEqualTo(i::CStrVector(kPropertyA))
+      && !name_handle->IsEqualTo(i::CStrVector(kPropertyH));
 }
 
 
@@ -11066,9 +11297,7 @@
 
   // Create an environment with access check to the global object disabled by
   // default. When the registered access checker will block access to properties
-  // a and h
-  a = v8_str("a");
-  h = v8_str("h");
+  // a and h.
   v8::Handle<v8::ObjectTemplate> global_template = v8::ObjectTemplate::New();
   global_template->SetAccessCheckCallbacks(NamedGetAccessBlockAandH,
                                            IndexedGetAccessBlocker,
@@ -11706,6 +11935,9 @@
         "var slice = lhs.substring(1, lhs.length - 1);"
         "var slice_on_cons = (lhs + rhs).substring(1, lhs.length *2 - 1);");
 
+    CHECK(!lhs->MayContainNonAscii());
+    CHECK(!rhs->MayContainNonAscii());
+
     MorphAString(*v8::Utils::OpenHandle(*lhs), &ascii_resource, &uc16_resource);
     MorphAString(*v8::Utils::OpenHandle(*rhs), &ascii_resource, &uc16_resource);
 
@@ -12329,18 +12561,21 @@
 
   i::Handle<i::Smi> value(i::Smi::FromInt(2));
   i::Handle<i::Object> no_failure;
-  no_failure = i::JSObject::SetElement(jsobj, 1, value, i::kNonStrictMode);
+  no_failure =
+      i::JSObject::SetElement(jsobj, 1, value, NONE, i::kNonStrictMode);
   ASSERT(!no_failure.is_null());
   i::USE(no_failure);
   CHECK_EQ(2, i::Smi::cast(jsobj->GetElement(1)->ToObjectChecked())->value());
   *value.location() = i::Smi::FromInt(256);
-  no_failure = i::JSObject::SetElement(jsobj, 1, value, i::kNonStrictMode);
+  no_failure =
+      i::JSObject::SetElement(jsobj, 1, value, NONE, i::kNonStrictMode);
   ASSERT(!no_failure.is_null());
   i::USE(no_failure);
   CHECK_EQ(255,
            i::Smi::cast(jsobj->GetElement(1)->ToObjectChecked())->value());
   *value.location() = i::Smi::FromInt(-1);
-  no_failure = i::JSObject::SetElement(jsobj, 1, value, i::kNonStrictMode);
+  no_failure =
+      i::JSObject::SetElement(jsobj, 1, value, NONE, i::kNonStrictMode);
   ASSERT(!no_failure.is_null());
   i::USE(no_failure);
   CHECK_EQ(0, i::Smi::cast(jsobj->GetElement(1)->ToObjectChecked())->value());
@@ -12902,8 +13137,15 @@
                       "}"
                       "ext_array[7];");
   CHECK_EQ(0, result->Int32Value());
-  CHECK_EQ(
-      0, static_cast<int>(jsobj->GetElement(7)->ToObjectChecked()->Number()));
+  if (array_type == v8::kExternalDoubleArray ||
+      array_type == v8::kExternalFloatArray) {
+    CHECK_EQ(
+        static_cast<int>(i::OS::nan_value()),
+        static_cast<int>(jsobj->GetElement(7)->ToObjectChecked()->Number()));
+  } else {
+    CHECK_EQ(0, static_cast<int>(
+        jsobj->GetElement(7)->ToObjectChecked()->Number()));
+  }
 
   result = CompileRun("for (var i = 0; i < 8; i++) {"
                       "  ext_array[6] = '2.3';"
@@ -13535,6 +13777,137 @@
 }
 
 
+static void RethrowStackTraceHandler(v8::Handle<v8::Message> message,
+                                     v8::Handle<v8::Value> data) {
+  // Use the frame where JavaScript is called from.
+  v8::Handle<v8::StackTrace> stack_trace = message->GetStackTrace();
+  CHECK(!stack_trace.IsEmpty());
+  int frame_count = stack_trace->GetFrameCount();
+  CHECK_EQ(3, frame_count);
+  int line_number[] = {1, 2, 5};
+  for (int i = 0; i < frame_count; i++) {
+    CHECK_EQ(line_number[i], stack_trace->GetFrame(i)->GetLineNumber());
+  }
+}
+
+
+// Test that we only return the stack trace at the site where the exception
+// is first thrown (not where it is rethrown).
+TEST(RethrowStackTrace) {
+  v8::HandleScope scope;
+  LocalContext env;
+  // We make sure that
+  // - the stack trace of the ReferenceError in g() is reported.
+  // - the stack trace is not overwritten when e1 is rethrown by t().
+  // - the stack trace of e2 does not overwrite that of e1.
+  const char* source =
+      "function g() { error; }          \n"
+      "function f() { g(); }            \n"
+      "function t(e) { throw e; }       \n"
+      "try {                            \n"
+      "  f();                           \n"
+      "} catch (e1) {                   \n"
+      "  try {                          \n"
+      "    error;                       \n"
+      "  } catch (e2) {                 \n"
+      "    t(e1);                       \n"
+      "  }                              \n"
+      "}                                \n";
+  v8::V8::AddMessageListener(RethrowStackTraceHandler);
+  v8::V8::SetCaptureStackTraceForUncaughtExceptions(true);
+  CompileRun(source);
+  v8::V8::SetCaptureStackTraceForUncaughtExceptions(false);
+  v8::V8::RemoveMessageListeners(RethrowStackTraceHandler);
+}
+
+
+static void RethrowPrimitiveStackTraceHandler(v8::Handle<v8::Message> message,
+                                              v8::Handle<v8::Value> data) {
+  v8::Handle<v8::StackTrace> stack_trace = message->GetStackTrace();
+  CHECK(!stack_trace.IsEmpty());
+  int frame_count = stack_trace->GetFrameCount();
+  CHECK_EQ(2, frame_count);
+  int line_number[] = {3, 7};
+  for (int i = 0; i < frame_count; i++) {
+    CHECK_EQ(line_number[i], stack_trace->GetFrame(i)->GetLineNumber());
+  }
+}
+
+
+// Test that we do not recognize identity for primitive exceptions.
+TEST(RethrowPrimitiveStackTrace) {
+  v8::HandleScope scope;
+  LocalContext env;
+  // We do not capture stack trace for non Error objects on creation time.
+  // Instead, we capture the stack trace on last throw.
+  const char* source =
+      "function g() { throw 404; }      \n"
+      "function f() { g(); }            \n"
+      "function t(e) { throw e; }       \n"
+      "try {                            \n"
+      "  f();                           \n"
+      "} catch (e1) {                   \n"
+      "  t(e1)                          \n"
+      "}                                \n";
+  v8::V8::AddMessageListener(RethrowPrimitiveStackTraceHandler);
+  v8::V8::SetCaptureStackTraceForUncaughtExceptions(true);
+  CompileRun(source);
+  v8::V8::SetCaptureStackTraceForUncaughtExceptions(false);
+  v8::V8::RemoveMessageListeners(RethrowPrimitiveStackTraceHandler);
+}
+
+
+static void RethrowExistingStackTraceHandler(v8::Handle<v8::Message> message,
+                                              v8::Handle<v8::Value> data) {
+  // Use the frame where JavaScript is called from.
+  v8::Handle<v8::StackTrace> stack_trace = message->GetStackTrace();
+  CHECK(!stack_trace.IsEmpty());
+  CHECK_EQ(1, stack_trace->GetFrameCount());
+  CHECK_EQ(1, stack_trace->GetFrame(0)->GetLineNumber());
+}
+
+
+// Test that the stack trace is captured when the error object is created and
+// not where it is thrown.
+TEST(RethrowExistingStackTrace) {
+  v8::HandleScope scope;
+  LocalContext env;
+  const char* source =
+      "var e = new Error();           \n"
+      "throw e;                       \n";
+  v8::V8::AddMessageListener(RethrowExistingStackTraceHandler);
+  v8::V8::SetCaptureStackTraceForUncaughtExceptions(true);
+  CompileRun(source);
+  v8::V8::SetCaptureStackTraceForUncaughtExceptions(false);
+  v8::V8::RemoveMessageListeners(RethrowExistingStackTraceHandler);
+}
+
+
+static void RethrowBogusErrorStackTraceHandler(v8::Handle<v8::Message> message,
+                                               v8::Handle<v8::Value> data) {
+  // Use the frame where JavaScript is called from.
+  v8::Handle<v8::StackTrace> stack_trace = message->GetStackTrace();
+  CHECK(!stack_trace.IsEmpty());
+  CHECK_EQ(1, stack_trace->GetFrameCount());
+  CHECK_EQ(2, stack_trace->GetFrame(0)->GetLineNumber());
+}
+
+
+// Test that the stack trace is captured where the bogus Error object is thrown.
+TEST(RethrowBogusErrorStackTrace) {
+  v8::HandleScope scope;
+  LocalContext env;
+  const char* source =
+      "var e = {__proto__: new Error()} \n"
+      "throw e;                         \n";
+  v8::V8::AddMessageListener(RethrowBogusErrorStackTraceHandler);
+  v8::V8::SetCaptureStackTraceForUncaughtExceptions(true);
+  CompileRun(source);
+  v8::V8::SetCaptureStackTraceForUncaughtExceptions(false);
+  v8::V8::RemoveMessageListeners(RethrowBogusErrorStackTraceHandler);
+}
+
+
 v8::Handle<Value> AnalyzeStackOfEvalWithSourceURL(const v8::Arguments& args) {
   v8::HandleScope scope;
   v8::Handle<v8::StackTrace> stackTrace =
@@ -13580,58 +13953,65 @@
 THREADED_TEST(IdleNotification) {
   v8::HandleScope scope;
   LocalContext env;
-  CompileRun("function binom(n, m) {"
-             "  var C = [[1]];"
-             "  for (var i = 1; i <= n; ++i) {"
-             "    C[i] = [1];"
-             "    for (var j = 1; j < i; ++j) {"
-             "      C[i][j] = C[i-1][j-1] + C[i-1][j];"
-             "    }"
-             "    C[i][i] = 1;"
-             "  }"
-             "  return C[n][m];"
-             "};"
-             "binom(1000, 500)");
-  bool rv = false;
-  for (int i = 0; i < 100; i++) {
-    rv = v8::V8::IdleNotification();
-    if (rv)
-      break;
+  {
+    // Create garbage in old-space to generate work for idle notification.
+    i::AlwaysAllocateScope always_allocate;
+    for (int i = 0; i < 100; i++) {
+      FACTORY->NewFixedArray(1000, i::TENURED);
+    }
   }
-  CHECK(rv == true);
+  bool finshed_idle_work = false;
+  for (int i = 0; i < 100 && !finshed_idle_work; i++) {
+    finshed_idle_work = v8::V8::IdleNotification();
+  }
+  CHECK(finshed_idle_work);
 }
 
 // Test that idle notification can be handled and eventually returns true.
 // This just checks the contract of the IdleNotification() function,
 // and does not verify that it does reasonable work.
-TEST(IdleNotificationWithHint) {
+TEST(IdleNotificationWithSmallHint) {
   v8::HandleScope scope;
   LocalContext env;
   {
+    // Create garbage in old-space to generate work for idle notification.
     i::AlwaysAllocateScope always_allocate;
-    CompileRun("function binom(n, m) {"
-               "  var C = [[1]];"
-               "  for (var i = 1; i <= n; ++i) {"
-               "    C[i] = [1];"
-               "    for (var j = 1; j < i; ++j) {"
-               "      C[i][j] = C[i-1][j-1] + C[i-1][j];"
-               "    }"
-               "    C[i][i] = 1;"
-               "  }"
-               "  return C[n][m];"
-               "};"
-               "binom(1000, 500)");
+    for (int i = 0; i < 100; i++) {
+      FACTORY->NewFixedArray(1000, i::TENURED);
+    }
   }
-  bool rv = false;
   intptr_t old_size = HEAP->SizeOfObjects();
+  bool finshed_idle_work = false;
   bool no_idle_work = v8::V8::IdleNotification(10);
-  for (int i = 0; i < 200; i++) {
-    rv = v8::V8::IdleNotification(10);
-    if (rv)
-      break;
+  for (int i = 0; i < 200 && !finshed_idle_work; i++) {
+    finshed_idle_work = v8::V8::IdleNotification(10);
   }
-  CHECK(rv == true);
   intptr_t new_size = HEAP->SizeOfObjects();
+  CHECK(finshed_idle_work);
+  CHECK(no_idle_work || new_size < old_size);
+}
+
+
+// This just checks the contract of the IdleNotification() function,
+// and does not verify that it does reasonable work.
+TEST(IdleNotificationWithLargeHint) {
+  v8::HandleScope scope;
+  LocalContext env;
+  {
+    // Create garbage in old-space to generate work for idle notification.
+    i::AlwaysAllocateScope always_allocate;
+    for (int i = 0; i < 100; i++) {
+      FACTORY->NewFixedArray(1000, i::TENURED);
+    }
+  }
+  intptr_t old_size = HEAP->SizeOfObjects();
+  bool finshed_idle_work = false;
+  bool no_idle_work = v8::V8::IdleNotification(900);
+  for (int i = 0; i < 200 && !finshed_idle_work; i++) {
+    finshed_idle_work = v8::V8::IdleNotification(900);
+  }
+  intptr_t new_size = HEAP->SizeOfObjects();
+  CHECK(finshed_idle_work);
   CHECK(no_idle_work || new_size < old_size);
 }
 
@@ -15558,10 +15938,12 @@
   LocalContext context;
 
   // eval and the Function constructor allowed by default.
+  CHECK(context->IsCodeGenerationFromStringsAllowed());
   CheckCodeGenerationAllowed();
 
   // Disallow eval and the Function constructor.
   context->AllowCodeGenerationFromStrings(false);
+  CHECK(!context->IsCodeGenerationFromStringsAllowed());
   CheckCodeGenerationDisallowed();
 
   // Allow again.
@@ -15571,10 +15953,12 @@
   // Disallow but setting a global callback that will allow the calls.
   context->AllowCodeGenerationFromStrings(false);
   V8::SetAllowCodeGenerationFromStringsCallback(&CodeGenerationAllowed);
+  CHECK(!context->IsCodeGenerationFromStringsAllowed());
   CheckCodeGenerationAllowed();
 
   // Set a callback that disallows the code generation.
   V8::SetAllowCodeGenerationFromStringsCallback(&CodeGenerationDisallowed);
+  CHECK(!context->IsCodeGenerationFromStringsAllowed());
   CheckCodeGenerationDisallowed();
 }
 
@@ -15948,3 +16332,72 @@
   v8::V8::AddCallCompletedCallback(CallCompletedCallbackException);
   CompileRun("throw 'first exception';");
 }
+
+
+static int probes_counter = 0;
+static int misses_counter = 0;
+static int updates_counter = 0;
+
+
+static int* LookupCounter(const char* name) {
+  if (strcmp(name, "c:V8.MegamorphicStubCacheProbes") == 0) {
+    return &probes_counter;
+  } else if (strcmp(name, "c:V8.MegamorphicStubCacheMisses") == 0) {
+    return &misses_counter;
+  } else if (strcmp(name, "c:V8.MegamorphicStubCacheUpdates") == 0) {
+    return &updates_counter;
+  }
+  return NULL;
+}
+
+
+static const char* kMegamorphicTestProgram =
+    "function ClassA() { };"
+    "function ClassB() { };"
+    "ClassA.prototype.foo = function() { };"
+    "ClassB.prototype.foo = function() { };"
+    "function fooify(obj) { obj.foo(); };"
+    "var a = new ClassA();"
+    "var b = new ClassB();"
+    "for (var i = 0; i < 10000; i++) {"
+    "  fooify(a);"
+    "  fooify(b);"
+    "}";
+
+
+static void StubCacheHelper(bool primary) {
+  V8::SetCounterFunction(LookupCounter);
+  USE(kMegamorphicTestProgram);
+#ifdef DEBUG
+  i::FLAG_native_code_counters = true;
+  if (primary) {
+    i::FLAG_test_primary_stub_cache = true;
+  } else {
+    i::FLAG_test_secondary_stub_cache = true;
+  }
+  i::FLAG_crankshaft = false;
+  v8::HandleScope scope;
+  LocalContext env;
+  int initial_probes = probes_counter;
+  int initial_misses = misses_counter;
+  int initial_updates = updates_counter;
+  CompileRun(kMegamorphicTestProgram);
+  int probes = probes_counter - initial_probes;
+  int misses = misses_counter - initial_misses;
+  int updates = updates_counter - initial_updates;
+  CHECK_LT(updates, 10);
+  CHECK_LT(misses, 10);
+  CHECK_GE(probes, 10000);
+#endif
+}
+
+
+TEST(SecondaryStubCache) {
+  StubCacheHelper(true);
+}
+
+
+TEST(PrimaryStubCache) {
+  StubCacheHelper(false);
+}
+
diff --git a/test/cctest/test-assembler-mips.cc b/test/cctest/test-assembler-mips.cc
index a6c76f0..6985433 100644
--- a/test/cctest/test-assembler-mips.cc
+++ b/test/cctest/test-assembler-mips.cc
@@ -1,4 +1,4 @@
-// Copyright 2011 the V8 project authors. All rights reserved.
+// Copyright 2012 the V8 project authors. All rights reserved.
 // Redistribution and use in source and binary forms, with or without
 // modification, are permitted provided that the following conditions are
 // met:
@@ -219,21 +219,21 @@
 
   // Bit twiddling instructions & conditional moves.
   // Uses t0-t7 as set above.
-  __ clz(v0, t0);       // 29
-  __ clz(v1, t1);       // 19
+  __ Clz(v0, t0);       // 29
+  __ Clz(v1, t1);       // 19
   __ addu(v0, v0, v1);  // 48
-  __ clz(v1, t2);       // 3
+  __ Clz(v1, t2);       // 3
   __ addu(v0, v0, v1);  // 51
-  __ clz(v1, t7);       // 0
+  __ Clz(v1, t7);       // 0
   __ addu(v0, v0, v1);  // 51
   __ Branch(&error, ne, v0, Operand(51));
-  __ movn(a0, t3, t0);  // Move a0<-t3 (t0 is NOT 0).
+  __ Movn(a0, t3, t0);  // Move a0<-t3 (t0 is NOT 0).
   __ Ins(a0, t1, 12, 8);  // 0x7ff34fff
   __ Branch(&error, ne, a0, Operand(0x7ff34fff));
-  __ movz(a0, t6, t7);    // a0 not updated (t7 is NOT 0).
+  __ Movz(a0, t6, t7);    // a0 not updated (t7 is NOT 0).
   __ Ext(a1, a0, 8, 12);  // 0x34f
   __ Branch(&error, ne, a1, Operand(0x34f));
-  __ movz(a0, t6, v1);    // a0<-t6, v0 is 0, from 8 instr back.
+  __ Movz(a0, t6, v1);    // a0<-t6, v0 is 0, from 8 instr back.
   __ Branch(&error, ne, a0, Operand(t6));
 
   // Everything was correctly executed. Load the expected result.
@@ -579,8 +579,13 @@
 
     __ bind(&neither_is_nan);
 
-    __ c(OLT, D, f6, f4, 2);
-    __ bc1t(&less_than, 2);
+    if (kArchVariant == kLoongson) {
+      __ c(OLT, D, f6, f4);
+      __ bc1t(&less_than);
+    } else {
+      __ c(OLT, D, f6, f4, 2);
+      __ bc1t(&less_than, 2);
+    }
     __ nop();
     __ sw(zero_reg, MemOperand(a0, OFFSET_OF(T, result)) );
     __ Branch(&outa_here);
@@ -774,7 +779,7 @@
   Assembler assm(Isolate::Current(), NULL, 0);
   Label L, C;
 
-  if (CpuFeatures::IsSupported(FPU) && mips32r2) {
+  if (CpuFeatures::IsSupported(FPU) && kArchVariant == kMips32r2) {
     CpuFeatures::Scope scope(FPU);
 
     // Load all structure elements to registers.
diff --git a/test/cctest/test-ast.cc b/test/cctest/test-ast.cc
index 2aa7207..80c7fdf 100644
--- a/test/cctest/test-ast.cc
+++ b/test/cctest/test-ast.cc
@@ -1,4 +1,4 @@
-// Copyright 2006-2008 the V8 project authors. All rights reserved.
+// Copyright 2012 the V8 project authors. All rights reserved.
 // Redistribution and use in source and binary forms, with or without
 // modification, are permitted provided that the following conditions are
 // met:
@@ -40,7 +40,8 @@
   CHECK_EQ(0, list->length());
 
   ZoneScope zone_scope(Isolate::Current(), DELETE_ON_EXIT);
-  AstNode* node = new(ZONE) EmptyStatement();
+  AstNodeFactory<AstNullVisitor> factory(Isolate::Current());
+  AstNode* node = factory.NewEmptyStatement();
   list->Add(node);
   CHECK_EQ(1, list->length());
   CHECK_EQ(node, list->at(0));
diff --git a/test/cctest/test-dataflow.cc b/test/cctest/test-dataflow.cc
index ad48f55..a63008d 100644
--- a/test/cctest/test-dataflow.cc
+++ b/test/cctest/test-dataflow.cc
@@ -1,4 +1,4 @@
-// Copyright 2010 the V8 project authors. All rights reserved.
+// Copyright 2012 the V8 project authors. All rights reserved.
 // Redistribution and use in source and binary forms, with or without
 // modification, are permitted provided that the following conditions are
 // met:
@@ -36,16 +36,17 @@
 
 TEST(BitVector) {
   v8::internal::V8::Initialize(NULL);
-  ZoneScope zone(Isolate::Current(), DELETE_ON_EXIT);
+  ZoneScope zone_scope(Isolate::Current(), DELETE_ON_EXIT);
+  Zone* zone = ZONE;
   {
-    BitVector v(15);
+    BitVector v(15, zone);
     v.Add(1);
     CHECK(v.Contains(1));
     v.Remove(0);
     CHECK(!v.Contains(0));
     v.Add(0);
     v.Add(1);
-    BitVector w(15);
+    BitVector w(15, zone);
     w.Add(1);
     v.Intersect(w);
     CHECK(!v.Contains(0));
@@ -53,7 +54,7 @@
   }
 
   {
-    BitVector v(64);
+    BitVector v(64, zone);
     v.Add(27);
     v.Add(30);
     v.Add(31);
@@ -71,9 +72,9 @@
   }
 
   {
-    BitVector v(15);
+    BitVector v(15, zone);
     v.Add(0);
-    BitVector w(15);
+    BitVector w(15, zone);
     w.Add(1);
     v.Union(w);
     CHECK(v.Contains(0));
@@ -81,13 +82,13 @@
   }
 
   {
-    BitVector v(15);
+    BitVector v(15, zone);
     v.Add(0);
-    BitVector w(15);
+    BitVector w(15, zone);
     w = v;
     CHECK(w.Contains(0));
     w.Add(1);
-    BitVector u(w);
+    BitVector u(w, zone);
     CHECK(u.Contains(0));
     CHECK(u.Contains(1));
     v.Union(w);
@@ -96,9 +97,9 @@
   }
 
   {
-    BitVector v(35);
+    BitVector v(35, zone);
     v.Add(0);
-    BitVector w(35);
+    BitVector w(35, zone);
     w.Add(33);
     v.Union(w);
     CHECK(v.Contains(0));
@@ -106,15 +107,15 @@
   }
 
   {
-    BitVector v(35);
+    BitVector v(35, zone);
     v.Add(32);
     v.Add(33);
-    BitVector w(35);
+    BitVector w(35, zone);
     w.Add(33);
     v.Intersect(w);
     CHECK(!v.Contains(32));
     CHECK(v.Contains(33));
-    BitVector r(35);
+    BitVector r(35, zone);
     r.CopyFrom(v);
     CHECK(!r.Contains(32));
     CHECK(r.Contains(33));
diff --git a/test/cctest/test-date.cc b/test/cctest/test-date.cc
new file mode 100644
index 0000000..903a63a
--- /dev/null
+++ b/test/cctest/test-date.cc
@@ -0,0 +1,168 @@
+// Copyright 2012 the V8 project authors. All rights reserved.
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions are
+// met:
+//
+//     * Redistributions of source code must retain the above copyright
+//       notice, this list of conditions and the following disclaimer.
+//     * Redistributions in binary form must reproduce the above
+//       copyright notice, this list of conditions and the following
+//       disclaimer in the documentation and/or other materials provided
+//       with the distribution.
+//     * Neither the name of Google Inc. nor the names of its
+//       contributors may be used to endorse or promote products derived
+//       from this software without specific prior written permission.
+//
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+#include "v8.h"
+
+#include "global-handles.h"
+#include "snapshot.h"
+#include "cctest.h"
+
+using namespace v8::internal;
+
+class DateCacheMock: public DateCache {
+ public:
+  struct Rule {
+    int year, start_month, start_day, end_month, end_day, offset_sec;
+  };
+
+  DateCacheMock(int local_offset, Rule* rules, int rules_count)
+      : local_offset_(local_offset), rules_(rules), rules_count_(rules_count) {}
+
+ protected:
+  virtual int GetDaylightSavingsOffsetFromOS(int64_t time_sec) {
+    int days = DaysFromTime(time_sec * 1000);
+    int time_in_day_sec = TimeInDay(time_sec * 1000, days) / 1000;
+    int year, month, day;
+    YearMonthDayFromDays(days, &year, &month, &day);
+    Rule* rule = FindRuleFor(year, month, day, time_in_day_sec);
+    return rule == NULL ? 0 : rule->offset_sec * 1000;
+  }
+
+
+  virtual int GetLocalOffsetFromOS() {
+    return local_offset_;
+  }
+
+ private:
+  Rule* FindRuleFor(int year, int month, int day, int time_in_day_sec) {
+    Rule* result = NULL;
+    for (int i = 0; i < rules_count_; i++)
+      if (Match(&rules_[i], year, month, day, time_in_day_sec)) {
+        result = &rules_[i];
+      }
+    return result;
+  }
+
+
+  bool Match(Rule* rule, int year, int month, int day, int time_in_day_sec) {
+    if (rule->year != 0 && rule->year != year) return false;
+    if (rule->start_month > month) return false;
+    if (rule->end_month < month) return false;
+    int start_day = ComputeRuleDay(year, rule->start_month, rule->start_day);
+    if (rule->start_month == month && start_day > day) return false;
+    if (rule->start_month == month && start_day == day &&
+        2 * 3600 > time_in_day_sec)
+      return false;
+    int end_day = ComputeRuleDay(year, rule->end_month, rule->end_day);
+    if (rule->end_month == month && end_day < day) return false;
+    if (rule->end_month == month && end_day == day &&
+        2 * 3600 <= time_in_day_sec)
+      return false;
+    return true;
+  }
+
+
+  int ComputeRuleDay(int year, int month, int day) {
+    if (day != 0) return day;
+    int days = DaysFromYearMonth(year, month);
+    // Find the first Sunday of the month.
+    while (Weekday(days + day) != 6) day++;
+    return day + 1;
+  }
+
+  int local_offset_;
+  Rule* rules_;
+  int rules_count_;
+};
+
+static int64_t TimeFromYearMonthDay(DateCache* date_cache,
+                                    int year,
+                                    int month,
+                                    int day) {
+  int64_t result = date_cache->DaysFromYearMonth(year, month);
+  return (result + day - 1) * DateCache::kMsPerDay;
+}
+
+static void CheckDST(int64_t time) {
+  Isolate* isolate = Isolate::Current();
+  DateCache* date_cache = isolate->date_cache();
+  int64_t actual = date_cache->ToLocal(time);
+  int64_t expected = time + date_cache->GetLocalOffsetFromOS() +
+                     date_cache->GetDaylightSavingsOffsetFromOS(time / 1000);
+  CHECK_EQ(actual, expected);
+}
+
+
+TEST(DaylightSavingsTime) {
+  LocalContext context;
+  v8::HandleScope scope;
+  Isolate* isolate = Isolate::Current();
+  DateCacheMock::Rule rules[] = {
+    {0, 2, 0, 10, 0, 3600},  // DST from March to November in any year.
+    {2010, 2, 0, 7, 20, 3600},  // DST from March to August 20 in 2010.
+    {2010, 7, 20, 8, 10, 0},  // No DST from August 20 to September 10 in 2010.
+    {2010, 8, 10, 10, 0, 3600},  // DST from September 10 to November in 2010.
+  };
+
+  int local_offset_ms = -36000000;  // -10 hours.
+
+  DateCacheMock* date_cache =
+    new DateCacheMock(local_offset_ms, rules, ARRAY_SIZE(rules));
+
+  isolate->set_date_cache(date_cache);
+
+  int64_t start_of_2010 = TimeFromYearMonthDay(date_cache, 2010, 0, 1);
+  int64_t start_of_2011 = TimeFromYearMonthDay(date_cache, 2011, 0, 1);
+  int64_t august_20 = TimeFromYearMonthDay(date_cache, 2010, 7, 20);
+  int64_t september_10 = TimeFromYearMonthDay(date_cache, 2010, 8, 10);
+  CheckDST((august_20 + september_10) / 2);
+  CheckDST(september_10);
+  CheckDST(september_10 + 2 * 3600);
+  CheckDST(september_10 + 2 * 3600 - 1000);
+  CheckDST(august_20 + 2 * 3600);
+  CheckDST(august_20 + 2 * 3600 - 1000);
+  CheckDST(august_20);
+  // Check each day of 2010.
+  for (int64_t time = start_of_2011 + 2 * 3600;
+       time >= start_of_2010;
+       time -= DateCache::kMsPerDay) {
+    CheckDST(time);
+    CheckDST(time - 1000);
+    CheckDST(time + 1000);
+  }
+  // Check one day from 2010 to 2100.
+  for (int year = 2100; year >= 2010; year--) {
+    CheckDST(TimeFromYearMonthDay(date_cache, year, 5, 5));
+  }
+  CheckDST((august_20 + september_10) / 2);
+  CheckDST(september_10);
+  CheckDST(september_10 + 2 * 3600);
+  CheckDST(september_10 + 2 * 3600 - 1000);
+  CheckDST(august_20 + 2 * 3600);
+  CheckDST(august_20 + 2 * 3600 - 1000);
+  CheckDST(august_20);
+}
diff --git a/test/cctest/test-debug.cc b/test/cctest/test-debug.cc
index c0ea707..ffa8458 100644
--- a/test/cctest/test-debug.cc
+++ b/test/cctest/test-debug.cc
@@ -2745,7 +2745,7 @@
   foo->Call(env->Global(), kArgc, args);
 
   // With stepping all break locations are hit.
-  CHECK_EQ(33, break_point_hit_count);
+  CHECK_EQ(34, break_point_hit_count);
 
   v8::Debug::SetDebugEventListener(NULL);
   CheckDebuggerUnloaded();
@@ -2792,7 +2792,7 @@
   foo->Call(env->Global(), kArgc, args);
 
   // With stepping all break locations are hit.
-  CHECK_EQ(32, break_point_hit_count);
+  CHECK_EQ(33, break_point_hit_count);
 
   v8::Debug::SetDebugEventListener(NULL);
   CheckDebuggerUnloaded();
@@ -2836,7 +2836,7 @@
   foo->Call(env->Global(), 0, NULL);
 
   // With stepping all break locations are hit.
-  CHECK_EQ(53, break_point_hit_count);
+  CHECK_EQ(54, break_point_hit_count);
 
   v8::Debug::SetDebugEventListener(NULL);
   CheckDebuggerUnloaded();
@@ -2880,7 +2880,7 @@
 
 // Test of the stepping mechanism for named load in a loop.
 TEST(DebugStepNamedStoreLoop) {
-  DoDebugStepNamedStoreLoop(22);
+  DoDebugStepNamedStoreLoop(23);
 }
 
 
@@ -3252,7 +3252,7 @@
   v8::Handle<v8::Value> argv_10[argc] = { v8::Number::New(10) };
   result = foo->Call(env->Global(), argc, argv_10);
   CHECK_EQ(5, result->Int32Value());
-  CHECK_EQ(50, break_point_hit_count);
+  CHECK_EQ(51, break_point_hit_count);
 
   // Looping 100 times.
   step_action = StepIn;
@@ -3260,7 +3260,7 @@
   v8::Handle<v8::Value> argv_100[argc] = { v8::Number::New(100) };
   result = foo->Call(env->Global(), argc, argv_100);
   CHECK_EQ(50, result->Int32Value());
-  CHECK_EQ(455, break_point_hit_count);
+  CHECK_EQ(456, break_point_hit_count);
 
   // Get rid of the debug event listener.
   v8::Debug::SetDebugEventListener(NULL);
@@ -3304,7 +3304,7 @@
   v8::Handle<v8::Value> argv_10[argc] = { v8::Number::New(10) };
   result = foo->Call(env->Global(), argc, argv_10);
   CHECK_EQ(9, result->Int32Value());
-  CHECK_EQ(53, break_point_hit_count);
+  CHECK_EQ(54, break_point_hit_count);
 
   // Looping 100 times.
   step_action = StepIn;
@@ -3312,7 +3312,7 @@
   v8::Handle<v8::Value> argv_100[argc] = { v8::Number::New(100) };
   result = foo->Call(env->Global(), argc, argv_100);
   CHECK_EQ(99, result->Int32Value());
-  CHECK_EQ(503, break_point_hit_count);
+  CHECK_EQ(504, break_point_hit_count);
 
   // Get rid of the debug event listener.
   v8::Debug::SetDebugEventListener(NULL);
@@ -4222,9 +4222,9 @@
 
   // Get mirrors for the three objects with interceptor.
   CompileRun(
-      "named_mirror = debug.MakeMirror(intercepted_named);"
-      "indexed_mirror = debug.MakeMirror(intercepted_indexed);"
-      "both_mirror = debug.MakeMirror(intercepted_both)");
+      "var named_mirror = debug.MakeMirror(intercepted_named);"
+      "var indexed_mirror = debug.MakeMirror(intercepted_indexed);"
+      "var both_mirror = debug.MakeMirror(intercepted_both)");
   CHECK(CompileRun(
        "named_mirror instanceof debug.ObjectMirror")->BooleanValue());
   CHECK(CompileRun(
@@ -4265,7 +4265,7 @@
   CHECK_EQ(5, CompileRun(source)->Int32Value());
 
   // Get the interceptor properties for the object with only named interceptor.
-  CompileRun("named_values = named_mirror.properties()");
+  CompileRun("var named_values = named_mirror.properties()");
 
   // Check that the properties are interceptor properties.
   for (int i = 0; i < 3; i++) {
@@ -4284,7 +4284,7 @@
 
   // Get the interceptor properties for the object with only indexed
   // interceptor.
-  CompileRun("indexed_values = indexed_mirror.properties()");
+  CompileRun("var indexed_values = indexed_mirror.properties()");
 
   // Check that the properties are interceptor properties.
   for (int i = 0; i < 2; i++) {
@@ -4296,7 +4296,7 @@
 
   // Get the interceptor properties for the object with both types of
   // interceptors.
-  CompileRun("both_values = both_mirror.properties()");
+  CompileRun("var both_values = both_mirror.properties()");
 
   // Check that the properties are interceptor properties.
   for (int i = 0; i < 5; i++) {
@@ -4352,10 +4352,10 @@
 
   // Get mirrors for the four objects.
   CompileRun(
-      "o0_mirror = debug.MakeMirror(o0);"
-      "o1_mirror = debug.MakeMirror(o1);"
-      "o2_mirror = debug.MakeMirror(o2);"
-      "o3_mirror = debug.MakeMirror(o3)");
+      "var o0_mirror = debug.MakeMirror(o0);"
+      "var o1_mirror = debug.MakeMirror(o1);"
+      "var o2_mirror = debug.MakeMirror(o2);"
+      "var o3_mirror = debug.MakeMirror(o3)");
   CHECK(CompileRun("o0_mirror instanceof debug.ObjectMirror")->BooleanValue());
   CHECK(CompileRun("o1_mirror instanceof debug.ObjectMirror")->BooleanValue());
   CHECK(CompileRun("o2_mirror instanceof debug.ObjectMirror")->BooleanValue());
@@ -4441,11 +4441,11 @@
   CHECK_EQ(10, CompileRun("instance.x")->Int32Value());
 
   // Get mirror for the object with property getter.
-  CompileRun("instance_mirror = debug.MakeMirror(instance);");
+  CompileRun("var instance_mirror = debug.MakeMirror(instance);");
   CHECK(CompileRun(
       "instance_mirror instanceof debug.ObjectMirror")->BooleanValue());
 
-  CompileRun("named_names = instance_mirror.propertyNames();");
+  CompileRun("var named_names = instance_mirror.propertyNames();");
   CHECK_EQ(1, CompileRun("named_names.length")->Int32Value());
   CHECK(CompileRun("named_names[0] == 'x'")->BooleanValue());
   CHECK(CompileRun(
@@ -4477,7 +4477,7 @@
   env->Global()->Set(v8::String::New("instance"), named->NewInstance());
 
   // Get mirror for the object with property getter.
-  CompileRun("instance_mirror = debug.MakeMirror(instance);");
+  CompileRun("var instance_mirror = debug.MakeMirror(instance);");
   CHECK(CompileRun(
       "instance_mirror instanceof debug.ObjectMirror")->BooleanValue());
   CompileRun("named_names = instance_mirror.propertyNames();");
@@ -7208,10 +7208,10 @@
   // Receive 100 breaks for each test and then terminate JavaScript execution.
   static const int kBreaksPerTest = 100;
 
-  for (int i = 0; i < 1 && loop_bodies[i] != NULL; i++) {
+  for (int i = 0; loop_bodies[i] != NULL; i++) {
     // Perform a lazy deoptimization after various numbers of breaks
     // have been hit.
-    for (int j = 0; j < 10; j++) {
+    for (int j = 0; j < 11; j++) {
       break_point_hit_count_deoptimize = j;
       if (j == 10) {
         break_point_hit_count_deoptimize = kBreaksPerTest;
@@ -7286,4 +7286,65 @@
 }
 
 
+v8::Local<v8::Script> inline_script;
+
+static void DebugBreakInlineListener(v8::DebugEvent event,
+                                     v8::Handle<v8::Object> exec_state,
+                                     v8::Handle<v8::Object> event_data,
+                                     v8::Handle<v8::Value> data) {
+  if (event != v8::Break) return;
+
+  int expected_frame_count = 4;
+  int expected_line_number[] = {1, 4, 7, 12};
+
+  i::Handle<i::Object> compiled_script = v8::Utils::OpenHandle(*inline_script);
+  i::Handle<i::Script> source_script = i::Handle<i::Script>(i::Script::cast(
+      i::JSFunction::cast(*compiled_script)->shared()->script()));
+
+  int break_id = v8::internal::Isolate::Current()->debug()->break_id();
+  char script[128];
+  i::Vector<char> script_vector(script, sizeof(script));
+  OS::SNPrintF(script_vector, "%%GetFrameCount(%d)", break_id);
+  v8::Local<v8::Value> result = CompileRun(script);
+
+  int frame_count = result->Int32Value();
+  CHECK_EQ(expected_frame_count, frame_count);
+
+  for (int i = 0; i < frame_count; i++) {
+    // The 5. element in the returned array of GetFrameDetails contains the
+    // source position of that frame.
+    OS::SNPrintF(script_vector, "%%GetFrameDetails(%d, %d)[5]", break_id, i);
+    v8::Local<v8::Value> result = CompileRun(script);
+    CHECK_EQ(expected_line_number[i],
+             i::GetScriptLineNumber(source_script, result->Int32Value()));
+  }
+  v8::Debug::SetDebugEventListener(NULL);
+  v8::V8::TerminateExecution();
+}
+
+
+TEST(DebugBreakInline) {
+  i::FLAG_allow_natives_syntax = true;
+  v8::HandleScope scope;
+  DebugLocalContext env;
+  const char* source =
+      "function debug(b) {             \n"
+      "  if (b) debugger;              \n"
+      "}                               \n"
+      "function f(b) {                 \n"
+      "  debug(b)                      \n"
+      "};                              \n"
+      "function g(b) {                 \n"
+      "  f(b);                         \n"
+      "};                              \n"
+      "g(false);                       \n"
+      "g(false);                       \n"
+      "%OptimizeFunctionOnNextCall(g); \n"
+      "g(true);";
+  v8::Debug::SetDebugEventListener(DebugBreakInlineListener);
+  inline_script = v8::Script::Compile(v8::String::New(source));
+  inline_script->Run();
+}
+
+
 #endif  // ENABLE_DEBUGGER_SUPPORT
diff --git a/test/cctest/test-deoptimization.cc b/test/cctest/test-deoptimization.cc
index ea34a75..c52c578 100644
--- a/test/cctest/test-deoptimization.cc
+++ b/test/cctest/test-deoptimization.cc
@@ -97,6 +97,13 @@
 };
 
 
+// Abort any ongoing incremental marking to make sure that all weak global
+// handle callbacks are processed.
+static void NonIncrementalGC() {
+  HEAP->CollectAllGarbage(i::Heap::kAbortIncrementalMarkingMask);
+}
+
+
 static Handle<JSFunction> GetJSFunction(v8::Handle<v8::Object> obj,
                                         const char* property_name) {
   v8::Local<v8::Function> fun =
@@ -107,9 +114,7 @@
 
 TEST(DeoptimizeSimple) {
   v8::HandleScope scope;
-  const char* extension_list[] = { "v8/gc" };
-  v8::ExtensionConfiguration extensions(1, extension_list);
-  LocalContext env(&extensions);
+  LocalContext env;
 
   // Test lazy deoptimization of a simple function.
   {
@@ -119,9 +124,9 @@
         "function h() { %DeoptimizeFunction(f); }"
         "function g() { count++; h(); }"
         "function f() { g(); };"
-        "f();"
-        "gc(); gc()");
+        "f();");
   }
+  NonIncrementalGC();
 
   CHECK_EQ(1, env->Global()->Get(v8_str("count"))->Int32Value());
   CHECK(!GetJSFunction(env->Global(), "f")->IsOptimized());
@@ -135,9 +140,9 @@
         "var count = 0;"
         "function g() { count++; %DeoptimizeFunction(f); f(false); }"
         "function f(x) { if (x) { g(); } else { return } };"
-        "f(true);"
-        "gc(); gc()");
+        "f(true);");
   }
+  NonIncrementalGC();
 
   CHECK_EQ(1, env->Global()->Get(v8_str("count"))->Int32Value());
   CHECK(!GetJSFunction(env->Global(), "f")->IsOptimized());
@@ -147,9 +152,7 @@
 
 TEST(DeoptimizeSimpleWithArguments) {
   v8::HandleScope scope;
-  const char* extension_list[] = { "v8/gc" };
-  v8::ExtensionConfiguration extensions(1, extension_list);
-  LocalContext env(&extensions);
+  LocalContext env;
 
   // Test lazy deoptimization of a simple function with some arguments.
   {
@@ -159,9 +162,9 @@
         "function h(x) { %DeoptimizeFunction(f); }"
         "function g(x, y) { count++; h(x); }"
         "function f(x, y, z) { g(1,x); y+z; };"
-        "f(1, \"2\", false);"
-        "gc(); gc()");
+        "f(1, \"2\", false);");
   }
+  NonIncrementalGC();
 
   CHECK_EQ(1, env->Global()->Get(v8_str("count"))->Int32Value());
   CHECK(!GetJSFunction(env->Global(), "f")->IsOptimized());
@@ -176,9 +179,9 @@
         "var count = 0;"
         "function g(x, y) { count++; %DeoptimizeFunction(f); f(false, 1, y); }"
         "function f(x, y, z) { if (x) { g(x, y); } else { return y + z; } };"
-        "f(true, 1, \"2\");"
-        "gc(); gc()");
+        "f(true, 1, \"2\");");
   }
+  NonIncrementalGC();
 
   CHECK_EQ(1, env->Global()->Get(v8_str("count"))->Int32Value());
   CHECK(!GetJSFunction(env->Global(), "f")->IsOptimized());
@@ -188,9 +191,7 @@
 
 TEST(DeoptimizeSimpleNested) {
   v8::HandleScope scope;
-  const char* extension_list[] = { "v8/gc" };
-  v8::ExtensionConfiguration extensions(1, extension_list);
-  LocalContext env(&extensions);
+  LocalContext env;
 
   // Test lazy deoptimization of a simple function. Have a nested function call
   // do the deoptimization.
@@ -202,8 +203,8 @@
         "function h(x, y, z) { return x + y + z; }"
         "function g(z) { count++; %DeoptimizeFunction(f); return z;}"
         "function f(x,y,z) { return h(x, y, g(z)); };"
-        "result = f(1, 2, 3);"
-        "gc(); gc()");
+        "result = f(1, 2, 3);");
+    NonIncrementalGC();
 
     CHECK_EQ(1, env->Global()->Get(v8_str("count"))->Int32Value());
     CHECK_EQ(6, env->Global()->Get(v8_str("result"))->Int32Value());
@@ -215,9 +216,7 @@
 
 TEST(DeoptimizeRecursive) {
   v8::HandleScope scope;
-  const char* extension_list[] = { "v8/gc" };
-  v8::ExtensionConfiguration extensions(1, extension_list);
-  LocalContext env(&extensions);
+  LocalContext env;
 
   {
     // Test lazy deoptimization of a simple function called recursively. Call
@@ -228,8 +227,9 @@
         "var calls = 0;"
         "function g() { count++; %DeoptimizeFunction(f); }"
         "function f(x) { calls++; if (x > 0) { f(x - 1); } else { g(); } };"
-        "f(10); gc(); gc()");
+        "f(10);");
   }
+  NonIncrementalGC();
 
   CHECK_EQ(1, env->Global()->Get(v8_str("count"))->Int32Value());
   CHECK_EQ(11, env->Global()->Get(v8_str("calls"))->Int32Value());
@@ -243,9 +243,7 @@
 
 TEST(DeoptimizeMultiple) {
   v8::HandleScope scope;
-  const char* extension_list[] = { "v8/gc" };
-  v8::ExtensionConfiguration extensions(1, extension_list);
-  LocalContext env(&extensions);
+  LocalContext env;
 
   {
     AlwaysOptimizeAllowNativesSyntaxNoInlining options;
@@ -261,9 +259,9 @@
         "function f3(x, y, z) { f4(); return x + y + z; };"
         "function f2(x, y) { return x + f3(y + 1, y + 1, y + 1) + y; };"
         "function f1(x) { return f2(x + 1, x + 1) + x; };"
-        "result = f1(1);"
-        "gc(); gc()");
+        "result = f1(1);");
   }
+  NonIncrementalGC();
 
   CHECK_EQ(1, env->Global()->Get(v8_str("count"))->Int32Value());
   CHECK_EQ(14, env->Global()->Get(v8_str("result"))->Int32Value());
@@ -273,9 +271,7 @@
 
 TEST(DeoptimizeConstructor) {
   v8::HandleScope scope;
-  const char* extension_list[] = { "v8/gc" };
-  v8::ExtensionConfiguration extensions(1, extension_list);
-  LocalContext env(&extensions);
+  LocalContext env;
 
   {
     AlwaysOptimizeAllowNativesSyntaxNoInlining options;
@@ -284,9 +280,9 @@
         "function g() { count++;"
         "               %DeoptimizeFunction(f); }"
         "function f() {  g(); };"
-        "result = new f() instanceof f;"
-        "gc(); gc()");
+        "result = new f() instanceof f;");
   }
+  NonIncrementalGC();
 
   CHECK_EQ(1, env->Global()->Get(v8_str("count"))->Int32Value());
   CHECK(env->Global()->Get(v8_str("result"))->IsTrue());
@@ -301,9 +297,9 @@
         "               %DeoptimizeFunction(f); }"
         "function f(x, y) { this.x = x; g(); this.y = y; };"
         "result = new f(1, 2);"
-        "result = result.x + result.y;"
-        "gc(); gc()");
+        "result = result.x + result.y;");
   }
+  NonIncrementalGC();
 
   CHECK_EQ(1, env->Global()->Get(v8_str("count"))->Int32Value());
   CHECK_EQ(3, env->Global()->Get(v8_str("result"))->Int32Value());
@@ -313,9 +309,7 @@
 
 TEST(DeoptimizeConstructorMultiple) {
   v8::HandleScope scope;
-  const char* extension_list[] = { "v8/gc" };
-  v8::ExtensionConfiguration extensions(1, extension_list);
-  LocalContext env(&extensions);
+  LocalContext env;
 
   {
     AlwaysOptimizeAllowNativesSyntaxNoInlining options;
@@ -332,9 +326,9 @@
         "function f2(x, y) {"
         "    this.result = x + new f3(y + 1, y + 1, y + 1).result + y; };"
         "function f1(x) { this.result = new f2(x + 1, x + 1).result + x; };"
-        "result = new f1(1).result;"
-        "gc(); gc()");
+        "result = new f1(1).result;");
   }
+  NonIncrementalGC();
 
   CHECK_EQ(1, env->Global()->Get(v8_str("count"))->Int32Value());
   CHECK_EQ(14, env->Global()->Get(v8_str("result"))->Int32Value());
@@ -344,9 +338,7 @@
 
 TEST(DeoptimizeBinaryOperationADDString) {
   v8::HandleScope scope;
-  const char* extension_list[] = { "v8/gc" };
-  v8::ExtensionConfiguration extensions(1, extension_list);
-  LocalContext env(&extensions);
+  LocalContext env;
 
   const char* f_source = "function f(x, y) { return x + y; };";
 
@@ -376,9 +368,9 @@
 
     // Call f and force deoptimization while processing the binary operation.
     CompileRun("deopt = true;"
-               "var result = f('a+', new X());"
-               "gc(); gc();");
+               "var result = f('a+', new X());");
   }
+  NonIncrementalGC();
 
   CHECK(!GetJSFunction(env->Global(), "f")->IsOptimized());
   CHECK_EQ(1, env->Global()->Get(v8_str("count"))->Int32Value());
@@ -428,18 +420,15 @@
 
   // Call f and force deoptimization while processing the binary operation.
   CompileRun("deopt = true;"
-             "var result = f(7, new X());"
-             "gc(); gc();");
-
+             "var result = f(7, new X());");
+  NonIncrementalGC();
   CHECK(!GetJSFunction((*env)->Global(), "f")->IsOptimized());
 }
 
 
 TEST(DeoptimizeBinaryOperationADD) {
   v8::HandleScope scope;
-  const char* extension_list[] = { "v8/gc" };
-  v8::ExtensionConfiguration extensions(1, extension_list);
-  LocalContext env(&extensions);
+  LocalContext env;
 
   TestDeoptimizeBinaryOpHelper(&env, "+");
 
@@ -451,9 +440,7 @@
 
 TEST(DeoptimizeBinaryOperationSUB) {
   v8::HandleScope scope;
-  const char* extension_list[] = { "v8/gc" };
-  v8::ExtensionConfiguration extensions(1, extension_list);
-  LocalContext env(&extensions);
+  LocalContext env;
 
   TestDeoptimizeBinaryOpHelper(&env, "-");
 
@@ -465,9 +452,7 @@
 
 TEST(DeoptimizeBinaryOperationMUL) {
   v8::HandleScope scope;
-  const char* extension_list[] = { "v8/gc" };
-  v8::ExtensionConfiguration extensions(1, extension_list);
-  LocalContext env(&extensions);
+  LocalContext env;
 
   TestDeoptimizeBinaryOpHelper(&env, "*");
 
@@ -479,9 +464,7 @@
 
 TEST(DeoptimizeBinaryOperationDIV) {
   v8::HandleScope scope;
-  const char* extension_list[] = { "v8/gc" };
-  v8::ExtensionConfiguration extensions(1, extension_list);
-  LocalContext env(&extensions);
+  LocalContext env;
 
   TestDeoptimizeBinaryOpHelper(&env, "/");
 
@@ -493,9 +476,7 @@
 
 TEST(DeoptimizeBinaryOperationMOD) {
   v8::HandleScope scope;
-  const char* extension_list[] = { "v8/gc" };
-  v8::ExtensionConfiguration extensions(1, extension_list);
-  LocalContext env(&extensions);
+  LocalContext env;
 
   TestDeoptimizeBinaryOpHelper(&env, "%");
 
@@ -507,9 +488,7 @@
 
 TEST(DeoptimizeCompare) {
   v8::HandleScope scope;
-  const char* extension_list[] = { "v8/gc" };
-  v8::ExtensionConfiguration extensions(1, extension_list);
-  LocalContext env(&extensions);
+  LocalContext env;
 
   const char* f_source = "function f(x, y) { return x < y; };";
 
@@ -539,9 +518,9 @@
 
     // Call f and force deoptimization while processing the comparison.
     CompileRun("deopt = true;"
-               "var result = f('a', new X());"
-               "gc(); gc();");
+               "var result = f('a', new X());");
   }
+  NonIncrementalGC();
 
   CHECK(!GetJSFunction(env->Global(), "f")->IsOptimized());
   CHECK_EQ(1, env->Global()->Get(v8_str("count"))->Int32Value());
@@ -552,9 +531,7 @@
 
 TEST(DeoptimizeLoadICStoreIC) {
   v8::HandleScope scope;
-  const char* extension_list[] = { "v8/gc" };
-  v8::ExtensionConfiguration extensions(1, extension_list);
-  LocalContext env(&extensions);
+  LocalContext env;
 
   // Functions to generate load/store/keyed load/keyed store IC calls.
   const char* f1_source = "function f1(x) { return x.y; };";
@@ -618,9 +595,9 @@
                "var result = f1(new X());"
                "g1(new X());"
                "f2(new X(), 'z');"
-               "g2(new X(), 'z');"
-               "gc(); gc();");
+               "g2(new X(), 'z');");
   }
+  NonIncrementalGC();
 
   CHECK(!GetJSFunction(env->Global(), "f1")->IsOptimized());
   CHECK(!GetJSFunction(env->Global(), "g1")->IsOptimized());
@@ -634,9 +611,7 @@
 
 TEST(DeoptimizeLoadICStoreICNested) {
   v8::HandleScope scope;
-  const char* extension_list[] = { "v8/gc" };
-  v8::ExtensionConfiguration extensions(1, extension_list);
-  LocalContext env(&extensions);
+  LocalContext env;
 
   // Functions to generate load/store/keyed load/keyed store IC calls.
   const char* f1_source = "function f1(x) { return x.y; };";
@@ -701,9 +676,9 @@
 
     // Call functions and force deoptimization while processing the ics.
     CompileRun("deopt = true;"
-               "var result = f1(new X());"
-               "gc(); gc();");
+               "var result = f1(new X());");
   }
+  NonIncrementalGC();
 
   CHECK(!GetJSFunction(env->Global(), "f1")->IsOptimized());
   CHECK(!GetJSFunction(env->Global(), "g1")->IsOptimized());
diff --git a/test/cctest/test-disasm-mips.cc b/test/cctest/test-disasm-mips.cc
index 8eadc64..1f87424 100644
--- a/test/cctest/test-disasm-mips.cc
+++ b/test/cctest/test-disasm-mips.cc
@@ -1,4 +1,4 @@
-// Copyright 2011 the V8 project authors. All rights reserved.
+// Copyright 2012 the V8 project authors. All rights reserved.
 // Redistribution and use in source and binary forms, with or without
 // modification, are permitted provided that the following conditions are
 // met:
@@ -148,12 +148,14 @@
   COMPARE(divu(v0, v1),
           "0043001b       divu    v0, v1");
 
-  COMPARE(mul(a0, a1, a2),
-          "70a62002       mul     a0, a1, a2");
-  COMPARE(mul(t2, t3, t4),
-          "716c5002       mul     t2, t3, t4");
-  COMPARE(mul(v0, v1, s0),
-          "70701002       mul     v0, v1, s0");
+  if (kArchVariant != kLoongson) {
+    COMPARE(mul(a0, a1, a2),
+            "70a62002       mul     a0, a1, a2");
+    COMPARE(mul(t2, t3, t4),
+            "716c5002       mul     t2, t3, t4");
+    COMPARE(mul(v0, v1, s0),
+            "70701002       mul     v0, v1, s0");
+  }
 
   COMPARE(addiu(a0, a1, 0x0),
           "24a40000       addiu   a0, a1, 0");
@@ -274,7 +276,7 @@
   COMPARE(srav(v0, v1, fp),
           "03c31007       srav    v0, v1, fp");
 
-  if (mips32r2) {
+  if (kArchVariant == kMips32r2) {
     COMPARE(rotr(a0, a1, 0),
             "00252002       rotr    a0, a1, 0");
     COMPARE(rotr(s0, s1, 8),
@@ -377,48 +379,50 @@
   COMPARE(sltiu(v0, v1, -1),
           "2c62ffff       sltiu   v0, v1, -1");
 
-  COMPARE(movz(a0, a1, a2),
-          "00a6200a       movz    a0, a1, a2");
-  COMPARE(movz(s0, s1, s2),
-          "0232800a       movz    s0, s1, s2");
-  COMPARE(movz(t2, t3, t4),
-          "016c500a       movz    t2, t3, t4");
-  COMPARE(movz(v0, v1, a2),
-          "0066100a       movz    v0, v1, a2");
-  COMPARE(movn(a0, a1, a2),
-          "00a6200b       movn    a0, a1, a2");
-  COMPARE(movn(s0, s1, s2),
-          "0232800b       movn    s0, s1, s2");
-  COMPARE(movn(t2, t3, t4),
-          "016c500b       movn    t2, t3, t4");
-  COMPARE(movn(v0, v1, a2),
-          "0066100b       movn    v0, v1, a2");
+  if (kArchVariant != kLoongson) {
+    COMPARE(movz(a0, a1, a2),
+            "00a6200a       movz    a0, a1, a2");
+    COMPARE(movz(s0, s1, s2),
+            "0232800a       movz    s0, s1, s2");
+    COMPARE(movz(t2, t3, t4),
+            "016c500a       movz    t2, t3, t4");
+    COMPARE(movz(v0, v1, a2),
+            "0066100a       movz    v0, v1, a2");
+    COMPARE(movn(a0, a1, a2),
+            "00a6200b       movn    a0, a1, a2");
+    COMPARE(movn(s0, s1, s2),
+            "0232800b       movn    s0, s1, s2");
+    COMPARE(movn(t2, t3, t4),
+            "016c500b       movn    t2, t3, t4");
+    COMPARE(movn(v0, v1, a2),
+            "0066100b       movn    v0, v1, a2");
 
-  COMPARE(movt(a0, a1, 1),
-          "00a52001       movt    a0, a1, 1");
-  COMPARE(movt(s0, s1, 2),
-          "02298001       movt    s0, s1, 2");
-  COMPARE(movt(t2, t3, 3),
-          "016d5001       movt    t2, t3, 3");
-  COMPARE(movt(v0, v1, 7),
-          "007d1001       movt    v0, v1, 7");
-  COMPARE(movf(a0, a1, 0),
-          "00a02001       movf    a0, a1, 0");
-  COMPARE(movf(s0, s1, 4),
-          "02308001       movf    s0, s1, 4");
-  COMPARE(movf(t2, t3, 5),
-          "01745001       movf    t2, t3, 5");
-  COMPARE(movf(v0, v1, 6),
-          "00781001       movf    v0, v1, 6");
+    COMPARE(movt(a0, a1, 1),
+            "00a52001       movt    a0, a1, 1");
+    COMPARE(movt(s0, s1, 2),
+            "02298001       movt    s0, s1, 2");
+    COMPARE(movt(t2, t3, 3),
+            "016d5001       movt    t2, t3, 3");
+    COMPARE(movt(v0, v1, 7),
+            "007d1001       movt    v0, v1, 7");
+    COMPARE(movf(a0, a1, 0),
+            "00a02001       movf    a0, a1, 0");
+    COMPARE(movf(s0, s1, 4),
+            "02308001       movf    s0, s1, 4");
+    COMPARE(movf(t2, t3, 5),
+            "01745001       movf    t2, t3, 5");
+    COMPARE(movf(v0, v1, 6),
+            "00781001       movf    v0, v1, 6");
 
-  COMPARE(clz(a0, a1),
-          "70a42020       clz     a0, a1");
-  COMPARE(clz(s6, s7),
-          "72f6b020       clz     s6, s7");
-  COMPARE(clz(v0, v1),
-          "70621020       clz     v0, v1");
+    COMPARE(clz(a0, a1),
+            "70a42020       clz     a0, a1");
+    COMPARE(clz(s6, s7),
+            "72f6b020       clz     s6, s7");
+    COMPARE(clz(v0, v1),
+            "70621020       clz     v0, v1");
+  }
 
-  if (mips32r2) {
+  if (kArchVariant == kMips32r2) {
     COMPARE(ins_(a0, a1, 31, 1),
             "7ca4ffc4       ins     a0, a1, 31, 1");
     COMPARE(ins_(s6, s7, 30, 2),
diff --git a/test/cctest/test-heap-profiler.cc b/test/cctest/test-heap-profiler.cc
index 4b211b4..a56f250 100644
--- a/test/cctest/test-heap-profiler.cc
+++ b/test/cctest/test-heap-profiler.cc
@@ -18,14 +18,30 @@
       : has_A2(false), has_B2(false), has_C2(false) {
   }
 
-  void Apply(i::HeapEntry** entry_ptr) {
-    if (IsReachableNodeWithName(*entry_ptr, "A2")) has_A2 = true;
-    if (IsReachableNodeWithName(*entry_ptr, "B2")) has_B2 = true;
-    if (IsReachableNodeWithName(*entry_ptr, "C2")) has_C2 = true;
+  void CheckEntry(i::HeapEntry* entry) {
+    if (strcmp(entry->name(), "A2") == 0) has_A2 = true;
+    if (strcmp(entry->name(), "B2") == 0) has_B2 = true;
+    if (strcmp(entry->name(), "C2") == 0) has_C2 = true;
   }
 
-  static bool IsReachableNodeWithName(i::HeapEntry* entry, const char* name) {
-    return strcmp(name, entry->name()) == 0 && entry->painted_reachable();
+  void CheckAllReachables(i::HeapEntry* root) {
+    i::List<i::HeapEntry*> list(10);
+    list.Add(root);
+    root->paint();
+    CheckEntry(root);
+    while (!list.is_empty()) {
+      i::HeapEntry* entry = list.RemoveLast();
+      i::Vector<i::HeapGraphEdge> children = entry->children();
+      for (int i = 0; i < children.length(); ++i) {
+        if (children[i].type() == i::HeapGraphEdge::kShortcut) continue;
+        i::HeapEntry* child = children[i].to();
+        if (!child->painted()) {
+          list.Add(child);
+          child->paint();
+          CheckEntry(child);
+        }
+      }
+    }
   }
 
   bool has_A2;
@@ -90,10 +106,6 @@
       const_cast<i::HeapSnapshot*>(
           reinterpret_cast<const i::HeapSnapshot*>(snapshot_env2));
   const v8::HeapGraphNode* global_env2 = GetGlobalObject(snapshot_env2);
-  // Paint all nodes reachable from global object.
-  i_snapshot_env2->ClearPaint();
-  const_cast<i::HeapEntry*>(
-      reinterpret_cast<const i::HeapEntry*>(global_env2))->PaintAllReachable();
 
   // Verify, that JS global object of env2 has '..2' properties.
   const v8::HeapGraphNode* a2_node =
@@ -105,8 +117,11 @@
       NULL, GetProperty(global_env2, v8::HeapGraphEdge::kShortcut, "b2_2"));
   CHECK_NE(NULL, GetProperty(global_env2, v8::HeapGraphEdge::kShortcut, "c2"));
 
+  // Paint all nodes reachable from global object.
   NamedEntriesDetector det;
-  i_snapshot_env2->IterateEntries(&det);
+  i_snapshot_env2->ClearPaint();
+  det.CheckAllReachables(const_cast<i::HeapEntry*>(
+      reinterpret_cast<const i::HeapEntry*>(global_env2)));
   CHECK(det.has_A2);
   CHECK(det.has_B2);
   CHECK(det.has_C2);
@@ -136,14 +151,47 @@
       GetProperty(x, v8::HeapGraphEdge::kProperty, "b");
   CHECK_NE(NULL, x2);
 
-  // Test approximate sizes.
-  CHECK_EQ(x->GetSelfSize() * 3, x->GetRetainedSize(false));
-  CHECK_EQ(x1->GetSelfSize(), x1->GetRetainedSize(false));
-  CHECK_EQ(x2->GetSelfSize(), x2->GetRetainedSize(false));
-  // Test exact sizes.
-  CHECK_EQ(x->GetSelfSize() * 3, x->GetRetainedSize(true));
-  CHECK_EQ(x1->GetSelfSize(), x1->GetRetainedSize(true));
-  CHECK_EQ(x2->GetSelfSize(), x2->GetRetainedSize(true));
+  // Test sizes.
+  CHECK_EQ(x->GetSelfSize() * 3, x->GetRetainedSize());
+  CHECK_EQ(x1->GetSelfSize(), x1->GetRetainedSize());
+  CHECK_EQ(x2->GetSelfSize(), x2->GetRetainedSize());
+}
+
+
+TEST(BoundFunctionInSnapshot) {
+  v8::HandleScope scope;
+  LocalContext env;
+  CompileRun(
+      "function myFunction(a, b) { this.a = a; this.b = b; }\n"
+      "function AAAAA() {}\n"
+      "boundFunction = myFunction.bind(new AAAAA(), 20, new Number(12)); \n");
+  const v8::HeapSnapshot* snapshot =
+      v8::HeapProfiler::TakeSnapshot(v8_str("sizes"));
+  const v8::HeapGraphNode* global = GetGlobalObject(snapshot);
+  const v8::HeapGraphNode* f =
+      GetProperty(global, v8::HeapGraphEdge::kShortcut, "boundFunction");
+  CHECK(f);
+  CHECK_EQ(v8::String::New("native_bind"), f->GetName());
+  const v8::HeapGraphNode* bindings =
+      GetProperty(f, v8::HeapGraphEdge::kInternal, "bindings");
+  CHECK_NE(NULL, bindings);
+  CHECK_EQ(v8::HeapGraphNode::kArray, bindings->GetType());
+  CHECK_EQ(4, bindings->GetChildrenCount());
+
+  const v8::HeapGraphNode* bound_this = GetProperty(
+      f, v8::HeapGraphEdge::kShortcut, "bound_this");
+  CHECK(bound_this);
+  CHECK_EQ(v8::HeapGraphNode::kObject, bound_this->GetType());
+
+  const v8::HeapGraphNode* bound_function = GetProperty(
+      f, v8::HeapGraphEdge::kShortcut, "bound_function");
+  CHECK(bound_function);
+  CHECK_EQ(v8::HeapGraphNode::kClosure, bound_function->GetType());
+
+  const v8::HeapGraphNode* bound_argument = GetProperty(
+      f, v8::HeapGraphEdge::kShortcut, "bound_argument_1");
+  CHECK(bound_argument);
+  CHECK_EQ(v8::HeapGraphNode::kObject, bound_argument->GetType());
 }
 
 
@@ -304,6 +352,59 @@
 #define CHECK_NE_UINT64_T(a, b) \
   CHECK((a) != (b))  // NOLINT
 
+TEST(HeapEntryIdsAndArrayShift) {
+  v8::HandleScope scope;
+  LocalContext env;
+
+  CompileRun(
+      "function AnObject() {\n"
+      "    this.first = 'first';\n"
+      "    this.second = 'second';\n"
+      "}\n"
+      "var a = new Array();\n"
+      "for (var i = 0; i < 10; ++i)\n"
+      "  a.push(new AnObject());\n");
+  const v8::HeapSnapshot* snapshot1 =
+      v8::HeapProfiler::TakeSnapshot(v8_str("s1"));
+
+  CompileRun(
+      "for (var i = 0; i < 1; ++i)\n"
+      "  a.shift();\n");
+
+  HEAP->CollectAllGarbage(i::Heap::kNoGCFlags);
+
+  const v8::HeapSnapshot* snapshot2 =
+      v8::HeapProfiler::TakeSnapshot(v8_str("s2"));
+
+  const v8::HeapGraphNode* global1 = GetGlobalObject(snapshot1);
+  const v8::HeapGraphNode* global2 = GetGlobalObject(snapshot2);
+  CHECK_NE_UINT64_T(0, global1->GetId());
+  CHECK_EQ_UINT64_T(global1->GetId(), global2->GetId());
+
+  const v8::HeapGraphNode* a1 =
+      GetProperty(global1, v8::HeapGraphEdge::kProperty, "a");
+  CHECK_NE(NULL, a1);
+  const v8::HeapGraphNode* e1 =
+      GetProperty(a1, v8::HeapGraphEdge::kHidden, "1");
+  CHECK_NE(NULL, e1);
+  const v8::HeapGraphNode* k1 =
+      GetProperty(e1, v8::HeapGraphEdge::kInternal, "elements");
+  CHECK_NE(NULL, k1);
+  const v8::HeapGraphNode* a2 =
+      GetProperty(global2, v8::HeapGraphEdge::kProperty, "a");
+  CHECK_NE(NULL, a2);
+  const v8::HeapGraphNode* e2 =
+      GetProperty(a2, v8::HeapGraphEdge::kHidden, "1");
+  CHECK_NE(NULL, e2);
+  const v8::HeapGraphNode* k2 =
+      GetProperty(e2, v8::HeapGraphEdge::kInternal, "elements");
+  CHECK_NE(NULL, k2);
+
+  CHECK_EQ_UINT64_T(a1->GetId(), a2->GetId());
+  CHECK_EQ_UINT64_T(e1->GetId(), e2->GetId());
+  CHECK_EQ_UINT64_T(k1->GetId(), k2->GetId());
+}
+
 TEST(HeapEntryIdsAndGC) {
   v8::HandleScope scope;
   LocalContext env;
@@ -640,7 +741,7 @@
   LocalContext env;
 
   const int snapshots_count = v8::HeapProfiler::GetSnapshotsCount();
-  TestActivityControl aborting_control(3);
+  TestActivityControl aborting_control(1);
   const v8::HeapSnapshot* no_snapshot =
       v8::HeapProfiler::TakeSnapshot(v8_str("abort"),
                                      v8::HeapSnapshot::kFull,
@@ -666,11 +767,13 @@
 class TestRetainedObjectInfo : public v8::RetainedObjectInfo {
  public:
   TestRetainedObjectInfo(int hash,
+                         const char* group_label,
                          const char* label,
                          intptr_t element_count = -1,
                          intptr_t size = -1)
       : disposed_(false),
         hash_(hash),
+        group_label_(group_label),
         label_(label),
         element_count_(element_count),
         size_(size) {
@@ -685,6 +788,7 @@
     return GetHash() == other->GetHash();
   }
   virtual intptr_t GetHash() { return hash_; }
+  virtual const char* GetGroupLabel() { return group_label_; }
   virtual const char* GetLabel() { return label_; }
   virtual intptr_t GetElementCount() { return element_count_; }
   virtual intptr_t GetSizeInBytes() { return size_; }
@@ -696,15 +800,15 @@
       if (wrapper->IsString()) {
         v8::String::AsciiValue ascii(wrapper);
         if (strcmp(*ascii, "AAA") == 0)
-          return new TestRetainedObjectInfo(1, "aaa", 100);
+          return new TestRetainedObjectInfo(1, "aaa-group", "aaa", 100);
         else if (strcmp(*ascii, "BBB") == 0)
-          return new TestRetainedObjectInfo(1, "aaa", 100);
+          return new TestRetainedObjectInfo(1, "aaa-group", "aaa", 100);
       }
     } else if (class_id == 2) {
       if (wrapper->IsString()) {
         v8::String::AsciiValue ascii(wrapper);
         if (strcmp(*ascii, "CCC") == 0)
-          return new TestRetainedObjectInfo(2, "ccc");
+          return new TestRetainedObjectInfo(2, "ccc-group", "ccc");
       }
     }
     CHECK(false);
@@ -717,6 +821,7 @@
   bool disposed_;
   int category_;
   int hash_;
+  const char* group_label_;
   const char* label_;
   intptr_t element_count_;
   intptr_t size_;
@@ -769,18 +874,21 @@
     delete TestRetainedObjectInfo::instances[i];
   }
 
-  const v8::HeapGraphNode* natives = GetNode(
-      snapshot->GetRoot(), v8::HeapGraphNode::kObject, "(Native objects)");
-  CHECK_NE(NULL, natives);
-  CHECK_EQ(2, natives->GetChildrenCount());
+  const v8::HeapGraphNode* native_group_aaa = GetNode(
+      snapshot->GetRoot(), v8::HeapGraphNode::kSynthetic, "aaa-group");
+  CHECK_NE(NULL, native_group_aaa);
+  CHECK_EQ(1, native_group_aaa->GetChildrenCount());
   const v8::HeapGraphNode* aaa = GetNode(
-      natives, v8::HeapGraphNode::kNative, "aaa / 100 entries");
+      native_group_aaa, v8::HeapGraphNode::kNative, "aaa / 100 entries");
   CHECK_NE(NULL, aaa);
+  CHECK_EQ(2, aaa->GetChildrenCount());
+
+  const v8::HeapGraphNode* native_group_ccc = GetNode(
+      snapshot->GetRoot(), v8::HeapGraphNode::kSynthetic, "ccc-group");
   const v8::HeapGraphNode* ccc = GetNode(
-      natives, v8::HeapGraphNode::kNative, "ccc");
+      native_group_ccc, v8::HeapGraphNode::kNative, "ccc");
   CHECK_NE(NULL, ccc);
 
-  CHECK_EQ(2, aaa->GetChildrenCount());
   const v8::HeapGraphNode* n_AAA = GetNode(
       aaa, v8::HeapGraphNode::kString, "AAA");
   CHECK_NE(NULL, n_AAA);
@@ -798,6 +906,75 @@
 }
 
 
+class GraphWithImplicitRefs {
+ public:
+  static const int kObjectsCount = 4;
+  explicit GraphWithImplicitRefs(LocalContext* env) {
+    CHECK_EQ(NULL, instance_);
+    instance_ = this;
+    for (int i = 0; i < kObjectsCount; i++) {
+      objects_[i] = v8::Persistent<v8::Object>::New(v8::Object::New());
+    }
+    (*env)->Global()->Set(v8_str("root_object"), objects_[0]);
+  }
+  ~GraphWithImplicitRefs() {
+    instance_ = NULL;
+  }
+
+  static void gcPrologue() {
+    instance_->AddImplicitReferences();
+  }
+
+ private:
+  void AddImplicitReferences() {
+    // 0 -> 1
+    v8::V8::AddImplicitReferences(
+        v8::Persistent<v8::Object>::Cast(objects_[0]), &objects_[1], 1);
+    // Adding two more references(note length=2 in params): 1 -> 2, 1 -> 3
+    v8::V8::AddImplicitReferences(
+        v8::Persistent<v8::Object>::Cast(objects_[1]), &objects_[2], 2);
+  }
+
+  v8::Persistent<v8::Value> objects_[kObjectsCount];
+  static GraphWithImplicitRefs* instance_;
+};
+
+GraphWithImplicitRefs* GraphWithImplicitRefs::instance_ = NULL;
+
+
+TEST(HeapSnapshotImplicitReferences) {
+  v8::HandleScope scope;
+  LocalContext env;
+
+  GraphWithImplicitRefs graph(&env);
+  v8::V8::SetGlobalGCPrologueCallback(&GraphWithImplicitRefs::gcPrologue);
+
+  const v8::HeapSnapshot* snapshot =
+      v8::HeapProfiler::TakeSnapshot(v8_str("implicit_refs"));
+
+  const v8::HeapGraphNode* global_object = GetGlobalObject(snapshot);
+  // Use kShortcut type to skip intermediate JSGlobalPropertyCell
+  const v8::HeapGraphNode* obj0 = GetProperty(
+      global_object, v8::HeapGraphEdge::kShortcut, "root_object");
+  CHECK(obj0);
+  CHECK_EQ(v8::HeapGraphNode::kObject, obj0->GetType());
+  const v8::HeapGraphNode* obj1 = GetProperty(
+      obj0, v8::HeapGraphEdge::kInternal, "native");
+  CHECK(obj1);
+  int implicit_targets_count = 0;
+  for (int i = 0, count = obj1->GetChildrenCount(); i < count; ++i) {
+    const v8::HeapGraphEdge* prop = obj1->GetChild(i);
+    v8::String::AsciiValue prop_name(prop->GetName());
+    if (prop->GetType() == v8::HeapGraphEdge::kInternal &&
+        strcmp("native", *prop_name) == 0) {
+      ++implicit_targets_count;
+    }
+  }
+  CHECK_EQ(2, implicit_targets_count);
+  v8::V8::SetGlobalGCPrologueCallback(NULL);
+}
+
+
 TEST(DeleteAllHeapSnapshots) {
   v8::HandleScope scope;
   LocalContext env;
@@ -1155,3 +1332,37 @@
       GetProperty(fun, v8::HeapGraphEdge::kInternal, "shared");
   CHECK(HasWeakEdge(shared));
 }
+
+
+TEST(PersistentHandleCount) {
+  v8::HandleScope scope;
+  LocalContext env;
+
+  // V8 also uses global handles internally, so we can't test for an absolute
+  // number.
+  int global_handle_count = v8::HeapProfiler::GetPersistentHandleCount();
+
+  // Create some persistent handles.
+  v8::Persistent<v8::String> p_AAA =
+      v8::Persistent<v8::String>::New(v8_str("AAA"));
+  CHECK_EQ(global_handle_count + 1,
+           v8::HeapProfiler::GetPersistentHandleCount());
+  v8::Persistent<v8::String> p_BBB =
+      v8::Persistent<v8::String>::New(v8_str("BBB"));
+  CHECK_EQ(global_handle_count + 2,
+           v8::HeapProfiler::GetPersistentHandleCount());
+  v8::Persistent<v8::String> p_CCC =
+      v8::Persistent<v8::String>::New(v8_str("CCC"));
+  CHECK_EQ(global_handle_count + 3,
+           v8::HeapProfiler::GetPersistentHandleCount());
+
+  // Dipose the persistent handles in a different order.
+  p_AAA.Dispose();
+  CHECK_EQ(global_handle_count + 2,
+           v8::HeapProfiler::GetPersistentHandleCount());
+  p_CCC.Dispose();
+  CHECK_EQ(global_handle_count + 1,
+           v8::HeapProfiler::GetPersistentHandleCount());
+  p_BBB.Dispose();
+  CHECK_EQ(global_handle_count, v8::HeapProfiler::GetPersistentHandleCount());
+}
diff --git a/test/cctest/test-heap.cc b/test/cctest/test-heap.cc
index 6ce3798..999e2c6 100644
--- a/test/cctest/test-heap.cc
+++ b/test/cctest/test-heap.cc
@@ -1,4 +1,4 @@
-// Copyright 2011 the V8 project authors. All rights reserved.
+// Copyright 2012 the V8 project authors. All rights reserved.
 
 #include <stdlib.h>
 
@@ -612,7 +612,7 @@
   CHECK(!obj->HasLocalProperty(*second));
 
   // check string and symbol match
-  static const char* string1 = "fisk";
+  const char* string1 = "fisk";
   Handle<String> s1 = FACTORY->NewStringFromAscii(CStrVector(string1));
   obj->SetProperty(
       *s1, Smi::FromInt(1), NONE, kNonStrictMode)->ToObjectChecked();
@@ -620,7 +620,7 @@
   CHECK(obj->HasLocalProperty(*s1_symbol));
 
   // check symbol and string match
-  static const char* string2 = "fugl";
+  const char* string2 = "fugl";
   Handle<String> s2_symbol = FACTORY->LookupAsciiSymbol(string2);
   obj->SetProperty(
       *s2_symbol, Smi::FromInt(1), NONE, kNonStrictMode)->ToObjectChecked();
@@ -676,7 +676,7 @@
   CHECK(array->HasFastTypeElements());
 
   // array[length] = name.
-  array->SetElement(0, *name, kNonStrictMode, true)->ToObjectChecked();
+  array->SetElement(0, *name, NONE, kNonStrictMode)->ToObjectChecked();
   CHECK_EQ(Smi::FromInt(1), array->length());
   CHECK_EQ(array->GetElement(0), *name);
 
@@ -691,7 +691,7 @@
   CHECK(array->HasDictionaryElements());  // Must be in slow mode.
 
   // array[length] = name.
-  array->SetElement(int_length, *name, kNonStrictMode, true)->ToObjectChecked();
+  array->SetElement(int_length, *name, NONE, kNonStrictMode)->ToObjectChecked();
   uint32_t new_int_length = 0;
   CHECK(array->length()->ToArrayIndex(&new_int_length));
   CHECK_EQ(static_cast<double>(int_length), new_int_length - 1);
@@ -718,8 +718,8 @@
   obj->SetProperty(
       *second, Smi::FromInt(2), NONE, kNonStrictMode)->ToObjectChecked();
 
-  obj->SetElement(0, *first, kNonStrictMode, true)->ToObjectChecked();
-  obj->SetElement(1, *second, kNonStrictMode, true)->ToObjectChecked();
+  obj->SetElement(0, *first, NONE, kNonStrictMode)->ToObjectChecked();
+  obj->SetElement(1, *second, NONE, kNonStrictMode)->ToObjectChecked();
 
   // Make the clone.
   Handle<JSObject> clone = Copy(obj);
@@ -737,8 +737,8 @@
   clone->SetProperty(
       *second, Smi::FromInt(1), NONE, kNonStrictMode)->ToObjectChecked();
 
-  clone->SetElement(0, *second, kNonStrictMode, true)->ToObjectChecked();
-  clone->SetElement(1, *first, kNonStrictMode, true)->ToObjectChecked();
+  clone->SetElement(0, *second, NONE, kNonStrictMode)->ToObjectChecked();
+  clone->SetElement(1, *first, NONE, kNonStrictMode)->ToObjectChecked();
 
   CHECK_EQ(obj->GetElement(1), clone->GetElement(0));
   CHECK_EQ(obj->GetElement(0), clone->GetElement(1));
@@ -811,7 +811,7 @@
 
   // Allocate a JS array to OLD_POINTER_SPACE and NEW_SPACE
   objs[next_objs_index++] = FACTORY->NewJSArray(10);
-  objs[next_objs_index++] = FACTORY->NewJSArray(10, TENURED);
+  objs[next_objs_index++] = FACTORY->NewJSArray(10, FAST_ELEMENTS, TENURED);
 
   // Allocate a small string to OLD_DATA_SPACE and NEW_SPACE
   objs[next_objs_index++] =
@@ -959,17 +959,17 @@
   CHECK(function->shared()->is_compiled());
 
   // TODO(1609) Currently incremental marker does not support code flushing.
-  HEAP->CollectAllGarbage(Heap::kMakeHeapIterableMask);
-  HEAP->CollectAllGarbage(Heap::kMakeHeapIterableMask);
+  HEAP->CollectAllGarbage(Heap::kAbortIncrementalMarkingMask);
+  HEAP->CollectAllGarbage(Heap::kAbortIncrementalMarkingMask);
 
   CHECK(function->shared()->is_compiled());
 
-  HEAP->CollectAllGarbage(Heap::kMakeHeapIterableMask);
-  HEAP->CollectAllGarbage(Heap::kMakeHeapIterableMask);
-  HEAP->CollectAllGarbage(Heap::kMakeHeapIterableMask);
-  HEAP->CollectAllGarbage(Heap::kMakeHeapIterableMask);
-  HEAP->CollectAllGarbage(Heap::kMakeHeapIterableMask);
-  HEAP->CollectAllGarbage(Heap::kMakeHeapIterableMask);
+  HEAP->CollectAllGarbage(Heap::kAbortIncrementalMarkingMask);
+  HEAP->CollectAllGarbage(Heap::kAbortIncrementalMarkingMask);
+  HEAP->CollectAllGarbage(Heap::kAbortIncrementalMarkingMask);
+  HEAP->CollectAllGarbage(Heap::kAbortIncrementalMarkingMask);
+  HEAP->CollectAllGarbage(Heap::kAbortIncrementalMarkingMask);
+  HEAP->CollectAllGarbage(Heap::kAbortIncrementalMarkingMask);
 
   // foo should no longer be in the compilation cache
   CHECK(!function->shared()->is_compiled() || function->IsOptimized());
@@ -1328,35 +1328,6 @@
   CHECK(old_capacity == new_capacity);
 }
 
-// This just checks the contract of the IdleNotification() function,
-// and does not verify that it does reasonable work.
-TEST(IdleNotificationAdvancesIncrementalMarking) {
-  if (!FLAG_incremental_marking || !FLAG_incremental_marking_steps) return;
-  InitializeVM();
-  v8::HandleScope scope;
-  const char* source = "function binom(n, m) {"
-                       "  var C = [[1]];"
-                       "  for (var i = 1; i <= n; ++i) {"
-                       "    C[i] = [1];"
-                       "    for (var j = 1; j < i; ++j) {"
-                       "      C[i][j] = C[i-1][j-1] + C[i-1][j];"
-                       "    }"
-                       "    C[i][i] = 1;"
-                       "  }"
-                       "  return C[n][m];"
-                       "};"
-                       "binom(1000, 500)";
-  {
-    AlwaysAllocateScope aa_scope;
-    CompileRun(source);
-  }
-  intptr_t old_size = HEAP->SizeOfObjects();
-  bool no_idle_work = v8::V8::IdleNotification(900);
-  while (!v8::V8::IdleNotification(900)) ;
-  intptr_t new_size = HEAP->SizeOfObjects();
-  CHECK(no_idle_work || new_size < old_size);
-}
-
 
 static int NumberOfGlobalObjects() {
   int count = 0;
@@ -1611,7 +1582,7 @@
   Handle<JSObject> prototype;
   PagedSpace* space = HEAP->old_pointer_space();
   do {
-    prototype = FACTORY->NewJSArray(32 * KB, TENURED);
+    prototype = FACTORY->NewJSArray(32 * KB, FAST_ELEMENTS, TENURED);
   } while (space->FirstPage() == space->LastPage() ||
       !space->LastPage()->Contains(prototype->address()));
 
diff --git a/test/cctest/test-log-stack-tracer.cc b/test/cctest/test-log-stack-tracer.cc
index f536e6b..6847ef7 100644
--- a/test/cctest/test-log-stack-tracer.cc
+++ b/test/cctest/test-log-stack-tracer.cc
@@ -307,6 +307,7 @@
   // Stack tracing will start from the first JS function, i.e. "JSFuncDoTrace"
   int base = 0;
   CHECK_GT(sample.frames_count, base + 1);
+
   CHECK(IsAddressWithinFuncCode("JSFuncDoTrace", sample.stack[base + 0]));
   CHECK(IsAddressWithinFuncCode("JSTrace", sample.stack[base + 1]));
 }
diff --git a/test/cctest/test-mark-compact.cc b/test/cctest/test-mark-compact.cc
index f8421e2..973af19 100644
--- a/test/cctest/test-mark-compact.cc
+++ b/test/cctest/test-mark-compact.cc
@@ -1,4 +1,4 @@
-// Copyright 2006-2008 the V8 project authors. All rights reserved.
+// Copyright 2012 the V8 project authors. All rights reserved.
 // Redistribution and use in source and binary forms, with or without
 // modification, are permitted provided that the following conditions are
 // met:
@@ -534,15 +534,15 @@
     intptr_t booted_memory = MemoryInUse();
     if (sizeof(initial_memory) == 8) {
       if (v8::internal::Snapshot::IsEnabled()) {
-        CHECK_LE(booted_memory - initial_memory, 6654 * 1024);  // 6444.
+        CHECK_LE(booted_memory - initial_memory, 6686 * 1024);  // 6476.
       } else {
-        CHECK_LE(booted_memory - initial_memory, 6777 * 1024);  // 6596.
+        CHECK_LE(booted_memory - initial_memory, 6809 * 1024);  // 6628.
       }
     } else {
       if (v8::internal::Snapshot::IsEnabled()) {
-        CHECK_LE(booted_memory - initial_memory, 6500 * 1024);  // 6365.
+        CHECK_LE(booted_memory - initial_memory, 6532 * 1024);  // 6388.
       } else {
-        CHECK_LE(booted_memory - initial_memory, 6654 * 1024);  // 6424
+        CHECK_LE(booted_memory - initial_memory, 6940 * 1024);  // 6456
       }
     }
   }
diff --git a/test/cctest/test-parsing.cc b/test/cctest/test-parsing.cc
index 1b6e4ab..6bcae7c 100755
--- a/test/cctest/test-parsing.cc
+++ b/test/cctest/test-parsing.cc
@@ -63,17 +63,18 @@
     int length = i::StrLength(key_token.keyword);
     CHECK(static_cast<int>(sizeof(buffer)) >= length);
     {
-      i::Utf8ToUC16CharacterStream stream(keyword, length);
+      i::Utf8ToUtf16CharacterStream stream(keyword, length);
       i::Scanner scanner(&unicode_cache);
-      // The scanner should parse 'let' as Token::LET for this test.
+      // The scanner should parse Harmony keywords for this test.
       scanner.SetHarmonyScoping(true);
+      scanner.SetHarmonyModules(true);
       scanner.Initialize(&stream);
       CHECK_EQ(key_token.token, scanner.Next());
       CHECK_EQ(i::Token::EOS, scanner.Next());
     }
     // Removing characters will make keyword matching fail.
     {
-      i::Utf8ToUC16CharacterStream stream(keyword, length - 1);
+      i::Utf8ToUtf16CharacterStream stream(keyword, length - 1);
       i::Scanner scanner(&unicode_cache);
       scanner.Initialize(&stream);
       CHECK_EQ(i::Token::IDENTIFIER, scanner.Next());
@@ -84,7 +85,7 @@
     for (int j = 0; j < static_cast<int>(ARRAY_SIZE(chars_to_append)); ++j) {
       memmove(buffer, keyword, length);
       buffer[length] = chars_to_append[j];
-      i::Utf8ToUC16CharacterStream stream(buffer, length + 1);
+      i::Utf8ToUtf16CharacterStream stream(buffer, length + 1);
       i::Scanner scanner(&unicode_cache);
       scanner.Initialize(&stream);
       CHECK_EQ(i::Token::IDENTIFIER, scanner.Next());
@@ -94,7 +95,7 @@
     {
       memmove(buffer, keyword, length);
       buffer[length - 1] = '_';
-      i::Utf8ToUC16CharacterStream stream(buffer, length);
+      i::Utf8ToUtf16CharacterStream stream(buffer, length);
       i::Scanner scanner(&unicode_cache);
       scanner.Initialize(&stream);
       CHECK_EQ(i::Token::IDENTIFIER, scanner.Next());
@@ -254,7 +255,7 @@
   uintptr_t stack_limit = i::Isolate::Current()->stack_guard()->real_climit();
   for (int i = 0; programs[i]; i++) {
     const char* program = programs[i];
-    i::Utf8ToUC16CharacterStream stream(
+    i::Utf8ToUtf16CharacterStream stream(
         reinterpret_cast<const i::byte*>(program),
         static_cast<unsigned>(strlen(program)));
     i::CompleteParserRecorder log;
@@ -290,7 +291,7 @@
   uintptr_t stack_limit = i::Isolate::Current()->stack_guard()->real_climit();
   for (int i = 0; programs[i]; i++) {
     const char* program = programs[i];
-    i::Utf8ToUC16CharacterStream stream(
+    i::Utf8ToUtf16CharacterStream stream(
         reinterpret_cast<const i::byte*>(program),
         static_cast<unsigned>(strlen(program)));
     i::CompleteParserRecorder log;
@@ -325,8 +326,9 @@
   // and then used the invalid currently scanned literal. This always
   // failed in debug mode, and sometimes crashed in release mode.
 
-  i::Utf8ToUC16CharacterStream stream(reinterpret_cast<const i::byte*>(program),
-                                      static_cast<unsigned>(strlen(program)));
+  i::Utf8ToUtf16CharacterStream stream(
+      reinterpret_cast<const i::byte*>(program),
+      static_cast<unsigned>(strlen(program)));
   i::ScriptDataImpl* data =
       i::ParserApi::PreParse(&stream, NULL, false);
   CHECK(data->HasError());
@@ -359,7 +361,7 @@
 
   int first_function =
       static_cast<int>(strstr(program, "function") - program);
-  int first_lbrace = first_function + static_cast<int>(strlen("function () "));
+  int first_lbrace = first_function + i::StrLength("function () ");
   CHECK_EQ('{', program[first_lbrace]);
   i::FunctionEntry entry1 = data->GetFunctionEntry(first_lbrace);
   CHECK(!entry1.is_valid());
@@ -367,7 +369,7 @@
   int second_function =
       static_cast<int>(strstr(program + first_lbrace, "function") - program);
   int second_lbrace =
-      second_function + static_cast<int>(strlen("function () "));
+      second_function + i::StrLength("function () ");
   CHECK_EQ('{', program[second_lbrace]);
   i::FunctionEntry entry2 = data->GetFunctionEntry(second_lbrace);
   CHECK(entry2.is_valid());
@@ -391,7 +393,7 @@
 
   uintptr_t stack_limit = i::Isolate::Current()->stack_guard()->real_climit();
 
-  i::Utf8ToUC16CharacterStream stream(
+  i::Utf8ToUtf16CharacterStream stream(
       reinterpret_cast<const i::byte*>(*program),
       static_cast<unsigned>(kProgramSize));
   i::CompleteParserRecorder log;
@@ -448,10 +450,10 @@
   i::Handle<i::String> uc16_string(
       FACTORY->NewExternalStringFromTwoByte(&resource));
 
-  i::ExternalTwoByteStringUC16CharacterStream uc16_stream(
+  i::ExternalTwoByteStringUtf16CharacterStream uc16_stream(
       i::Handle<i::ExternalTwoByteString>::cast(uc16_string), start, end);
-  i::GenericStringUC16CharacterStream string_stream(ascii_string, start, end);
-  i::Utf8ToUC16CharacterStream utf8_stream(
+  i::GenericStringUtf16CharacterStream string_stream(ascii_string, start, end);
+  i::Utf8ToUtf16CharacterStream utf8_stream(
       reinterpret_cast<const i::byte*>(ascii_source), end);
   utf8_stream.SeekForward(start);
 
@@ -574,12 +576,14 @@
   char buffer[kAllUtf8CharsSizeU];
   unsigned cursor = 0;
   for (int i = 0; i <= kMaxUC16Char; i++) {
-    cursor += unibrow::Utf8::Encode(buffer + cursor, i);
+    cursor += unibrow::Utf8::Encode(buffer + cursor,
+                                    i,
+                                    unibrow::Utf16::kNoPreviousCharacter);
   }
   ASSERT(cursor == kAllUtf8CharsSizeU);
 
-  i::Utf8ToUC16CharacterStream stream(reinterpret_cast<const i::byte*>(buffer),
-                                      kAllUtf8CharsSizeU);
+  i::Utf8ToUtf16CharacterStream stream(reinterpret_cast<const i::byte*>(buffer),
+                                       kAllUtf8CharsSizeU);
   for (int i = 0; i <= kMaxUC16Char; i++) {
     CHECK_EQU(i, stream.pos());
     int32_t c = stream.Advance();
@@ -609,7 +613,7 @@
 
 #undef CHECK_EQU
 
-void TestStreamScanner(i::UC16CharacterStream* stream,
+void TestStreamScanner(i::Utf16CharacterStream* stream,
                        i::Token::Value* expected_tokens,
                        int skip_pos = 0,  // Zero means not skipping.
                        int skip_to = 0) {
@@ -632,8 +636,8 @@
   v8::V8::Initialize();
 
   const char* str1 = "{ foo get for : */ <- \n\n /*foo*/ bib";
-  i::Utf8ToUC16CharacterStream stream1(reinterpret_cast<const i::byte*>(str1),
-                                       static_cast<unsigned>(strlen(str1)));
+  i::Utf8ToUtf16CharacterStream stream1(reinterpret_cast<const i::byte*>(str1),
+                                        static_cast<unsigned>(strlen(str1)));
   i::Token::Value expectations1[] = {
       i::Token::LBRACE,
       i::Token::IDENTIFIER,
@@ -651,8 +655,8 @@
   TestStreamScanner(&stream1, expectations1, 0, 0);
 
   const char* str2 = "case default const {THIS\nPART\nSKIPPED} do";
-  i::Utf8ToUC16CharacterStream stream2(reinterpret_cast<const i::byte*>(str2),
-                                       static_cast<unsigned>(strlen(str2)));
+  i::Utf8ToUtf16CharacterStream stream2(reinterpret_cast<const i::byte*>(str2),
+                                        static_cast<unsigned>(strlen(str2)));
   i::Token::Value expectations2[] = {
       i::Token::CASE,
       i::Token::DEFAULT,
@@ -682,7 +686,7 @@
   for (int i = 0; i <= 4; i++) {
      expectations3[6 - i] = i::Token::ILLEGAL;
      expectations3[5 - i] = i::Token::EOS;
-     i::Utf8ToUC16CharacterStream stream3(
+     i::Utf8ToUtf16CharacterStream stream3(
          reinterpret_cast<const i::byte*>(str3),
          static_cast<unsigned>(strlen(str3)));
      TestStreamScanner(&stream3, expectations3, 1, 1 + i);
@@ -691,7 +695,7 @@
 
 
 void TestScanRegExp(const char* re_source, const char* expected) {
-  i::Utf8ToUC16CharacterStream stream(
+  i::Utf8ToUtf16CharacterStream stream(
        reinterpret_cast<const i::byte*>(re_source),
        static_cast<unsigned>(strlen(re_source)));
   i::Scanner scanner(i::Isolate::Current()->unicode_cache());
@@ -747,6 +751,67 @@
 }
 
 
+static int Utf8LengthHelper(const char* s) {
+  int len = i::StrLength(s);
+  int character_length = len;
+  for (int i = 0; i < len; i++) {
+    unsigned char c = s[i];
+    int input_offset = 0;
+    int output_adjust = 0;
+    if (c > 0x7f) {
+      if (c < 0xc0) continue;
+      if (c >= 0xf0) {
+        if (c >= 0xf8) {
+          // 5 and 6 byte UTF-8 sequences turn into a kBadChar for each UTF-8
+          // byte.
+          continue;  // Handle first UTF-8 byte.
+        }
+        if ((c & 7) == 0 && ((s[i + 1] & 0x30) == 0)) {
+          // This 4 byte sequence could have been coded as a 3 byte sequence.
+          // Record a single kBadChar for the first byte and continue.
+          continue;
+        }
+        input_offset = 3;
+        // 4 bytes of UTF-8 turn into 2 UTF-16 code units.
+        character_length -= 2;
+      } else if (c >= 0xe0) {
+        if ((c & 0xf) == 0 && ((s[i + 1] & 0x20) == 0)) {
+          // This 3 byte sequence could have been coded as a 2 byte sequence.
+          // Record a single kBadChar for the first byte and continue.
+          continue;
+        }
+        input_offset = 2;
+        // 3 bytes of UTF-8 turn into 1 UTF-16 code unit.
+        output_adjust = 2;
+      } else {
+        if ((c & 0x1e) == 0) {
+          // This 2 byte sequence could have been coded as a 1 byte sequence.
+          // Record a single kBadChar for the first byte and continue.
+          continue;
+        }
+        input_offset = 1;
+        // 2 bytes of UTF-8 turn into 1 UTF-16 code unit.
+        output_adjust = 1;
+      }
+      bool bad = false;
+      for (int j = 1; j <= input_offset; j++) {
+        if ((s[i + j] & 0xc0) != 0x80) {
+          // Bad UTF-8 sequence turns the first in the sequence into kBadChar,
+          // which is a single UTF-16 code unit.
+          bad = true;
+          break;
+        }
+      }
+      if (!bad) {
+        i += input_offset;
+        character_length -= output_adjust;
+      }
+    }
+  }
+  return character_length;
+}
+
+
 TEST(ScopePositions) {
   // Test the parser for correctly setting the start and end positions
   // of a scope. We check the scope positions of exactly one scope
@@ -834,6 +899,91 @@
     { "  for ", "(let x in {})\n"
       "    statement;", "\n"
       "  more;", i::BLOCK_SCOPE, i::EXTENDED_MODE },
+    // Check that 6-byte and 4-byte encodings of UTF-8 strings do not throw
+    // the preparser off in terms of byte offsets.
+    // 6 byte encoding.
+    { "  'foo\355\240\201\355\260\211';\n"
+      "  (function fun", "(a,b) { infunction; }", ")();",
+      i::FUNCTION_SCOPE, i::CLASSIC_MODE },
+    // 4 byte encoding.
+    { "  'foo\360\220\220\212';\n"
+      "  (function fun", "(a,b) { infunction; }", ")();",
+      i::FUNCTION_SCOPE, i::CLASSIC_MODE },
+    // 3 byte encoding of \u0fff.
+    { "  'foo\340\277\277';\n"
+      "  (function fun", "(a,b) { infunction; }", ")();",
+      i::FUNCTION_SCOPE, i::CLASSIC_MODE },
+    // Broken 6 byte encoding with missing last byte.
+    { "  'foo\355\240\201\355\211';\n"
+      "  (function fun", "(a,b) { infunction; }", ")();",
+      i::FUNCTION_SCOPE, i::CLASSIC_MODE },
+    // Broken 3 byte encoding of \u0fff with missing last byte.
+    { "  'foo\340\277';\n"
+      "  (function fun", "(a,b) { infunction; }", ")();",
+      i::FUNCTION_SCOPE, i::CLASSIC_MODE },
+    // Broken 3 byte encoding of \u0fff with missing 2 last bytes.
+    { "  'foo\340';\n"
+      "  (function fun", "(a,b) { infunction; }", ")();",
+      i::FUNCTION_SCOPE, i::CLASSIC_MODE },
+    // Broken 3 byte encoding of \u00ff should be a 2 byte encoding.
+    { "  'foo\340\203\277';\n"
+      "  (function fun", "(a,b) { infunction; }", ")();",
+      i::FUNCTION_SCOPE, i::CLASSIC_MODE },
+    // Broken 3 byte encoding of \u007f should be a 2 byte encoding.
+    { "  'foo\340\201\277';\n"
+      "  (function fun", "(a,b) { infunction; }", ")();",
+      i::FUNCTION_SCOPE, i::CLASSIC_MODE },
+    // Unpaired lead surrogate.
+    { "  'foo\355\240\201';\n"
+      "  (function fun", "(a,b) { infunction; }", ")();",
+      i::FUNCTION_SCOPE, i::CLASSIC_MODE },
+    // Unpaired lead surrogate where following code point is a 3 byte sequence.
+    { "  'foo\355\240\201\340\277\277';\n"
+      "  (function fun", "(a,b) { infunction; }", ")();",
+      i::FUNCTION_SCOPE, i::CLASSIC_MODE },
+    // Unpaired lead surrogate where following code point is a 4 byte encoding
+    // of a trail surrogate.
+    { "  'foo\355\240\201\360\215\260\211';\n"
+      "  (function fun", "(a,b) { infunction; }", ")();",
+      i::FUNCTION_SCOPE, i::CLASSIC_MODE },
+    // Unpaired trail surrogate.
+    { "  'foo\355\260\211';\n"
+      "  (function fun", "(a,b) { infunction; }", ")();",
+      i::FUNCTION_SCOPE, i::CLASSIC_MODE },
+    // 2 byte encoding of \u00ff.
+    { "  'foo\303\277';\n"
+      "  (function fun", "(a,b) { infunction; }", ")();",
+      i::FUNCTION_SCOPE, i::CLASSIC_MODE },
+    // Broken 2 byte encoding of \u00ff with missing last byte.
+    { "  'foo\303';\n"
+      "  (function fun", "(a,b) { infunction; }", ")();",
+      i::FUNCTION_SCOPE, i::CLASSIC_MODE },
+    // Broken 2 byte encoding of \u007f should be a 1 byte encoding.
+    { "  'foo\301\277';\n"
+      "  (function fun", "(a,b) { infunction; }", ")();",
+      i::FUNCTION_SCOPE, i::CLASSIC_MODE },
+    // Illegal 5 byte encoding.
+    { "  'foo\370\277\277\277\277';\n"
+      "  (function fun", "(a,b) { infunction; }", ")();",
+      i::FUNCTION_SCOPE, i::CLASSIC_MODE },
+    // Illegal 6 byte encoding.
+    { "  'foo\374\277\277\277\277\277';\n"
+      "  (function fun", "(a,b) { infunction; }", ")();",
+      i::FUNCTION_SCOPE, i::CLASSIC_MODE },
+    // Illegal 0xfe byte
+    { "  'foo\376\277\277\277\277\277\277';\n"
+      "  (function fun", "(a,b) { infunction; }", ")();",
+      i::FUNCTION_SCOPE, i::CLASSIC_MODE },
+    // Illegal 0xff byte
+    { "  'foo\377\277\277\277\277\277\277\277';\n"
+      "  (function fun", "(a,b) { infunction; }", ")();",
+      i::FUNCTION_SCOPE, i::CLASSIC_MODE },
+    { "  'foo';\n"
+      "  (function fun", "(a,b) { 'bar\355\240\201\355\260\213'; }", ")();",
+      i::FUNCTION_SCOPE, i::CLASSIC_MODE },
+    { "  'foo';\n"
+      "  (function fun", "(a,b) { 'bar\360\220\220\214'; }", ")();",
+      i::FUNCTION_SCOPE, i::CLASSIC_MODE },
     { NULL, NULL, NULL, i::EVAL_SCOPE, i::CLASSIC_MODE }
   };
 
@@ -847,20 +997,24 @@
   i::FLAG_harmony_scoping = true;
 
   for (int i = 0; source_data[i].outer_prefix; i++) {
-    int kPrefixLen = i::StrLength(source_data[i].outer_prefix);
-    int kInnerLen = i::StrLength(source_data[i].inner_source);
-    int kSuffixLen = i::StrLength(source_data[i].outer_suffix);
+    int kPrefixLen = Utf8LengthHelper(source_data[i].outer_prefix);
+    int kInnerLen = Utf8LengthHelper(source_data[i].inner_source);
+    int kSuffixLen = Utf8LengthHelper(source_data[i].outer_suffix);
+    int kPrefixByteLen = i::StrLength(source_data[i].outer_prefix);
+    int kInnerByteLen = i::StrLength(source_data[i].inner_source);
+    int kSuffixByteLen = i::StrLength(source_data[i].outer_suffix);
     int kProgramSize = kPrefixLen + kInnerLen + kSuffixLen;
-    i::Vector<char> program = i::Vector<char>::New(kProgramSize + 1);
-    int length = i::OS::SNPrintF(program, "%s%s%s",
-                                 source_data[i].outer_prefix,
-                                 source_data[i].inner_source,
-                                 source_data[i].outer_suffix);
-    CHECK(length == kProgramSize);
+    int kProgramByteSize = kPrefixByteLen + kInnerByteLen + kSuffixByteLen;
+    i::Vector<char> program = i::Vector<char>::New(kProgramByteSize + 1);
+    i::OS::SNPrintF(program, "%s%s%s",
+                             source_data[i].outer_prefix,
+                             source_data[i].inner_source,
+                             source_data[i].outer_suffix);
 
     // Parse program source.
     i::Handle<i::String> source(
-        FACTORY->NewStringFromAscii(i::CStrVector(program.start())));
+        FACTORY->NewStringFromUtf8(i::CStrVector(program.start())));
+    CHECK_EQ(source->length(), kProgramSize);
     i::Handle<i::Script> script = FACTORY->NewScript(source);
     i::Parser parser(script, i::kAllowLazy | i::EXTENDED_MODE, NULL, NULL);
     i::CompilationInfo info(script);
@@ -893,7 +1047,7 @@
   // Preparse the data.
   i::CompleteParserRecorder log;
   i::Scanner scanner(i::Isolate::Current()->unicode_cache());
-  i::GenericStringUC16CharacterStream stream(source, 0, source->length());
+  i::GenericStringUtf16CharacterStream stream(source, 0, source->length());
   scanner.SetHarmonyScoping(harmony_scoping);
   scanner.Initialize(&stream);
   v8::preparser::PreParser::PreParseResult result =
diff --git a/test/cctest/test-random.cc b/test/cctest/test-random.cc
new file mode 100644
index 0000000..a1f4931
--- /dev/null
+++ b/test/cctest/test-random.cc
@@ -0,0 +1,109 @@
+// Copyright 2012 the V8 project authors. All rights reserved.
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions are
+// met:
+//
+//     * Redistributions of source code must retain the above copyright
+//       notice, this list of conditions and the following disclaimer.
+//     * Redistributions in binary form must reproduce the above
+//       copyright notice, this list of conditions and the following
+//       disclaimer in the documentation and/or other materials provided
+//       with the distribution.
+//     * Neither the name of Google Inc. nor the names of its
+//       contributors may be used to endorse or promote products derived
+//       from this software without specific prior written permission.
+//
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+
+#include "v8.h"
+
+#include "cctest.h"
+#include "compiler.h"
+#include "execution.h"
+#include "isolate.h"
+
+
+using namespace v8::internal;
+
+static v8::Persistent<v8::Context> env;
+
+
+void SetSeeds(Handle<ByteArray> seeds, uint32_t state0, uint32_t state1) {
+  for (int i = 0; i < 4; i++) {
+    seeds->set(i, static_cast<byte>(state0 >> (i * kBitsPerByte)));
+    seeds->set(i + 4, static_cast<byte>(state1 >> (i * kBitsPerByte)));
+  }
+}
+
+
+void TestSeeds(Handle<JSFunction> fun,
+               Handle<Context> context,
+               uint32_t state0,
+               uint32_t state1) {
+  bool has_pending_exception;
+  Handle<JSObject> global(context->global());
+  Handle<ByteArray> seeds(context->random_seed());
+
+  SetSeeds(seeds, state0, state1);
+  Handle<Object> value =
+      Execution::Call(fun, global, 0, NULL, &has_pending_exception);
+  CHECK(value->IsHeapNumber());
+  CHECK(fun->IsOptimized());
+  double crankshaft_value = HeapNumber::cast(*value)->value();
+
+  SetSeeds(seeds, state0, state1);
+  V8::FillHeapNumberWithRandom(*value, *context);
+  double runtime_value = HeapNumber::cast(*value)->value();
+  CHECK_EQ(runtime_value, crankshaft_value);
+}
+
+
+TEST(CrankshaftRandom) {
+  if (env.IsEmpty()) env = v8::Context::New();
+  // Skip test if crankshaft is disabled.
+  if (!V8::UseCrankshaft()) return;
+  v8::HandleScope scope;
+  env->Enter();
+
+  Handle<Context> context(Isolate::Current()->context());
+  Handle<JSObject> global(context->global());
+  Handle<ByteArray> seeds(context->random_seed());
+  bool has_pending_exception;
+
+  CompileRun("function f() { return Math.random(); }");
+
+  Object* symbol = FACTORY->LookupAsciiSymbol("f")->ToObjectChecked();
+  MaybeObject* fun_object =
+      context->global()->GetProperty(String::cast(symbol));
+  Handle<JSFunction> fun(JSFunction::cast(fun_object->ToObjectChecked()));
+
+  // Optimize function.
+  Execution::Call(fun, global, 0, NULL, &has_pending_exception);
+  Execution::Call(fun, global, 0, NULL, &has_pending_exception);
+  if (!fun->IsOptimized()) fun->MarkForLazyRecompilation();
+
+  // Test with some random values.
+  TestSeeds(fun, context, 0xC0C0AFFE, 0x31415926);
+  TestSeeds(fun, context, 0x01020304, 0xFFFFFFFF);
+  TestSeeds(fun, context, 0x00000001, 0x00000000);
+
+  // Test that we bail out to runtime when seeds are uninitialized (zeros).
+  SetSeeds(seeds, 0, 0);
+  Handle<Object> value =
+      Execution::Call(fun, global, 0, NULL, &has_pending_exception);
+  CHECK(value->IsHeapNumber());
+  CHECK(fun->IsOptimized());
+  double crankshaft_value = HeapNumber::cast(*value)->value();
+  CHECK_NE(0.0, crankshaft_value);
+}
diff --git a/test/cctest/test-regexp.cc b/test/cctest/test-regexp.cc
index 3070e16..d941d0f 100644
--- a/test/cctest/test-regexp.cc
+++ b/test/cctest/test-regexp.cc
@@ -449,6 +449,7 @@
     case 0xA0:
     case 0x2028:
     case 0x2029:
+    case 0xFEFF:
       return true;
     default:
       return unibrow::Space::Is(c);
diff --git a/test/mjsunit/array-construct-transition.js b/test/mjsunit/array-construct-transition.js
index 5865e33..577e321 100644
--- a/test/mjsunit/array-construct-transition.js
+++ b/test/mjsunit/array-construct-transition.js
@@ -1,4 +1,4 @@
-// Copyright 2011 the V8 project authors. All rights reserved.
+// Copyright 2012 the V8 project authors. All rights reserved.
 // Redistribution and use in source and binary forms, with or without
 // modification, are permitted provided that the following conditions are
 // met:
@@ -27,7 +27,7 @@
 
 // Flags: --allow-natives-syntax --smi-only-arrays
 
-support_smi_only_arrays = %HasFastSmiOnlyElements([1,2,3,4,5,6,7,8,9,10]);
+support_smi_only_arrays = %HasFastSmiOnlyElements(new Array(1,2,3,4,5,6,7,8));
 
 if (support_smi_only_arrays) {
   var a = new Array(0, 1, 2);
diff --git a/test/mjsunit/array-join.js b/test/mjsunit/array-join.js
index 5c837a5..c08c182 100644
--- a/test/mjsunit/array-join.js
+++ b/test/mjsunit/array-join.js
@@ -75,10 +75,10 @@
   Array.prototype.toString = oldToString;
 }
 
-var a = new Array(123123123);
-assertEquals(123123122, String(a).length);
-assertEquals(123123122, a.join(",").length);
-assertEquals(246246244, a.join("oo").length);
+var a = new Array(123123);
+assertEquals(123122, String(a).length);
+assertEquals(123122, a.join(",").length);
+assertEquals(246244, a.join("oo").length);
 
 a = new Array(Math.pow(2,32) - 1);  // Max length.
 assertEquals("", a.join(""));
@@ -90,4 +90,4 @@
 for (var i = 0; i < a.length; i++) a[i] = undefined;
 a[5] = "ab";
 a[90000] = "cd";
-assertEquals("abcd", a.join(""));  // Must not throw.
\ No newline at end of file
+assertEquals("abcd", a.join(""));  // Must not throw.
diff --git a/test/mjsunit/array-store-and-grow.js b/test/mjsunit/array-store-and-grow.js
new file mode 100644
index 0000000..131d4eb
--- /dev/null
+++ b/test/mjsunit/array-store-and-grow.js
@@ -0,0 +1,183 @@
+// Copyright 2012 the V8 project authors. All rights reserved.
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions are
+// met:
+//
+//     * Redistributions of source code must retain the above copyright
+//       notice, this list of conditions and the following disclaimer.
+//     * Redistributions in binary form must reproduce the above
+//       copyright notice, this list of conditions and the following
+//       disclaimer in the documentation and/or other materials provided
+//       with the distribution.
+//     * Neither the name of Google Inc. nor the names of its
+//       contributors may be used to endorse or promote products derived
+//       from this software without specific prior written permission.
+//
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+// Verifies that the KeyedStoreIC correctly handles out-of-bounds stores
+// to an array that grow it by a single element. Test functions are
+// called twice to make sure that the IC is used, first call is handled
+// by the runtime in the miss stub.
+
+function array_store_1(a,b,c) {
+  return (a[b] = c);
+}
+
+// Check handling of the empty array.
+var a = [];
+array_store_1(a, 0, 1);
+a = [];
+array_store_1(a, 0, 1);
+assertEquals(1, a[0]);
+assertEquals(1, array_store_1([], 0, 1));
+
+a = [];
+for (x=0;x<100000;++x) {
+  assertEquals(x, array_store_1(a, x, x));
+}
+
+for (x=0;x<100000;++x) {
+  assertEquals(x, array_store_1([], 0, x));
+}
+
+function array_store_2(a,b,c) {
+  return (a[b] = c);
+}
+
+a = [];
+array_store_2(a, 0, 0.5);
+a = [];
+array_store_2(a, 0, 0.5);
+assertEquals(0.5, a[0]);
+assertEquals(0.5, array_store_2([], 0, 0.5));
+
+function array_store_3(a,b,c) {
+  return (a[b] = c);
+}
+
+x = new Object();
+a = [];
+array_store_3(a, 0, x);
+a = [];
+array_store_3(a, 0, x);
+assertEquals(x, a[0]);
+assertEquals(x, array_store_3([], 0, x));
+
+// Check the handling of COW arrays
+function makeCOW() {
+  return [1];
+}
+
+function array_store_4(a,b,c) {
+  return (a[b] = c);
+}
+
+a = makeCOW();
+array_store_4(a, 1, 1);
+a = makeCOW();
+array_store_4(a, 1, 1);
+assertEquals(1, a[1]);
+assertEquals(1, array_store_4([], 1, 1));
+
+function array_store_5(a,b,c) {
+  return (a[b] = c);
+}
+
+a = makeCOW();
+array_store_5(a, 1, 0.5);
+a = makeCOW();
+array_store_5(a, 1, 0.5);
+assertEquals(0.5, a[1]);
+assertEquals(0.5, array_store_5([], 1, 0.5));
+
+function array_store_6(a,b,c) {
+  return (a[b] = c);
+}
+
+a = makeCOW();
+array_store_6(a, 1, x);
+a = makeCOW();
+array_store_6(a, 1, x);
+assertEquals(x, a[1]);
+assertEquals(x, array_store_6([], 1, x));
+
+// Check the handling of mutable arrays.
+a = new Array(1,2,3);
+array_store_4(a, 3, 1);
+a = new Array(1,2,3);
+array_store_4(a, 3, 1);
+assertEquals(1, a[3]);
+assertEquals(1, array_store_4([], 3, 1));
+
+function array_store_5(a,b,c) {
+  return (a[b] = c);
+}
+
+a = new Array(1,2,3);
+array_store_5(a, 3, 0.5);
+a = new Array(1,2,3);
+array_store_5(a, 3, 0.5);
+assertEquals(0.5, a[3]);
+assertEquals(0.5, array_store_5([], 3, 0.5));
+
+function array_store_6(a,b,c) {
+  return (a[b] = c);
+}
+
+a = new Array(1,2,3);
+array_store_6(a, 3, x);
+a = new Array(1,2,3);
+array_store_6(a, 3, x);
+assertEquals(x, a[3]);
+assertEquals(x, array_store_6([], 3, x));
+
+function array_store_7(a,b,c) {
+  return (a[b] = c);
+}
+
+// Check the handling of mutable arrays of doubles
+var a = new Array(0.5, 1.5);
+array_store_7(a, 2, .5);
+a = new Array(0.5, 1.5);
+array_store_7(a, 2, .5);
+assertEquals(0.5, a[2]);
+a = new Array(0.5, 1.5);
+assertEquals(0.5, array_store_7(a, 2, 0.5));
+
+for (x=0;x<100000;++x) {
+  a = new Array(0.5, 1.5);
+  assertEquals(x, array_store_7(a, 2, x));
+}
+
+function array_store_8(a,b,c) {
+  return (a[b] = c);
+}
+
+var a = new Array(0.5, 1.5);
+array_store_8(a, 2, .5);
+a = new Array(0.5, 1.5);
+array_store_8(a, 10, .5);
+assertEquals(0.5, a[10]);
+
+// Grow the empty array with a double store.
+function array_store_9(a,b,c) {
+  return (a[b] = c);
+}
+
+var a = [];
+array_store_9(a, 0, 0.5);
+a = [];
+array_store_1(a, 0, 0.5);
+assertEquals(0.5, a[0]);
+assertEquals(0.5, array_store_1([], 0, 0.5));
diff --git a/test/mjsunit/builtins.js b/test/mjsunit/builtins.js
index f2ad544..e43b589 100644
--- a/test/mjsunit/builtins.js
+++ b/test/mjsunit/builtins.js
@@ -27,8 +27,7 @@
 
 // Flags: --expose-natives-as=builtins
 
-// Checks that all function properties of the builtin object are neither
-// writable nor configurable. Also, theose functions that are actually
+// Checks that all function properties of the builtin object that are actually
 // constructors (recognized by having properties on their .prototype object),
 // have only unconfigurable properties on the prototype, and the methods
 // are also non-writable.
@@ -75,8 +74,6 @@
   assertTrue(desc.hasOwnProperty("value"));
   var value = desc.value;
   if (isFunction(value)) {
-    assertFalse(desc.writable, name);
-    assertFalse(desc.configurable, name);
     checkConstructor(value, name);
   }
 }
diff --git a/test/mjsunit/comparison-ops-and-undefined.js b/test/mjsunit/comparison-ops-and-undefined.js
new file mode 100644
index 0000000..06db076
--- /dev/null
+++ b/test/mjsunit/comparison-ops-and-undefined.js
@@ -0,0 +1,128 @@
+// Copyright 2012 the V8 project authors. All rights reserved.
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions are
+// met:
+//
+//     * Redistributions of source code must retain the above copyright
+//       notice, this list of conditions and the following disclaimer.
+//     * Redistributions in binary form must reproduce the above
+//       copyright notice, this list of conditions and the following
+//       disclaimer in the documentation and/or other materials provided
+//       with the distribution.
+//     * Neither the name of Google Inc. nor the names of its
+//       contributors may be used to endorse or promote products derived
+//       from this software without specific prior written permission.
+//
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+// Flags: --allow-natives-syntax
+
+function test_helper_for_ics(func, b1, b2, b3, b4) {
+  assertEquals(b1, func(.5, .5));
+  assertEquals(b2, func(.5, undefined));
+  assertEquals(b3, func(undefined, .5));
+  assertEquals(b4, func(undefined, undefined));
+}
+
+function test_helper_for_crankshaft(func, b1, b2, b3, b4) {
+  assertEquals(b1, func(.5, .5));
+  %OptimizeFunctionOnNextCall(func);
+  assertEquals(b1, func(.5, .5));
+  assertEquals(b2, func(.5, undefined));
+  assertEquals(b3, func(undefined, .5));
+  assertEquals(b4, func(undefined, undefined));
+}
+
+function less_1(a, b) {
+  return a < b;
+}
+
+test_helper_for_ics(less_1, false, false, false, false);
+
+function less_2(a, b) {
+  return a < b;
+}
+
+test_helper_for_crankshaft(less_1, false, false, false, false);
+
+function greater_1(a, b) {
+  return a > b;
+}
+
+test_helper_for_ics(greater_1, false, false, false, false);
+
+function greater_2(a, b) {
+  return a > b;
+}
+
+test_helper_for_crankshaft(greater_1, false, false, false, false);
+
+function less_equal_1(a, b) {
+  return a <= b;
+}
+
+test_helper_for_ics(less_equal_1, true, false, false, false);
+
+function less_equal_2(a, b) {
+  return a <= b;
+}
+
+test_helper_for_crankshaft(less_equal_1, true, false, false, false);
+
+function greater_equal_1(a, b) {
+  return a >= b;
+}
+
+test_helper_for_ics(greater_equal_1, true, false, false, false);
+
+function greater_equal_2(a, b) {
+  return a >= b;
+}
+
+test_helper_for_crankshaft(greater_equal_1, true, false, false, false);
+
+function equal_1(a, b) {
+  return a == b;
+}
+
+test_helper_for_ics(equal_1, true, false, false, true);
+
+function equal_2(a, b) {
+  return a == b;
+}
+
+test_helper_for_crankshaft(equal_2, true, false, false, true);
+
+function strict_equal_1(a, b) {
+  return a === b;
+}
+
+test_helper_for_ics(strict_equal_1, true, false, false, true);
+
+function strict_equal_2(a, b) {
+  return a === b;
+}
+
+test_helper_for_crankshaft(strict_equal_2, true, false, false, true);
+
+function not_equal_1(a, b) {
+  return a != b;
+}
+
+test_helper_for_ics(not_equal_1, false, true, true, false);
+
+function not_equal_2(a, b) {
+  return a != b;
+}
+
+test_helper_for_crankshaft(not_equal_2, false, true, true, false);
diff --git a/test/mjsunit/compiler/alloc-object-huge.js b/test/mjsunit/compiler/alloc-object-huge.js
new file mode 100644
index 0000000..d6d9f1b
--- /dev/null
+++ b/test/mjsunit/compiler/alloc-object-huge.js
@@ -0,0 +1,308 @@
+// Copyright 2012 the V8 project authors. All rights reserved.
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions are
+// met:
+//
+//     * Redistributions of source code must retain the above copyright
+//       notice, this list of conditions and the following disclaimer.
+//     * Redistributions in binary form must reproduce the above
+//       copyright notice, this list of conditions and the following
+//       disclaimer in the documentation and/or other materials provided
+//       with the distribution.
+//     * Neither the name of Google Inc. nor the names of its
+//       contributors may be used to endorse or promote products derived
+//       from this software without specific prior written permission.
+//
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+// Flags: --allow-natives-syntax --inline-construct --nolimit-inlining
+
+// Test that huge constructors (more than 256 this assignments) are
+// handled correctly.
+
+// Test huge constructor when being inlined into hydrogen.
+function test() {
+  return new huge();
+}
+test();
+test();
+%OptimizeFunctionOnNextCall(test);
+var o = test();
+assertEquals(1, o.foo1);
+assertEquals(257, o.foo257);
+
+// Test huge constructor with specialized constructor stub.
+var o = new huge();
+assertEquals(1, o.foo1);
+assertEquals(257, o.foo257);
+
+// The huge constructor, nothing interesting beyond this point.
+function huge() {
+  this.foo1 = 1;
+  this.foo2 = 2;
+  this.foo3 = 3;
+  this.foo4 = 4;
+  this.foo5 = 5;
+  this.foo6 = 6;
+  this.foo7 = 7;
+  this.foo8 = 8;
+  this.foo9 = 9;
+  this.foo10 = 10;
+  this.foo11 = 11;
+  this.foo12 = 12;
+  this.foo13 = 13;
+  this.foo14 = 14;
+  this.foo15 = 15;
+  this.foo16 = 16;
+  this.foo17 = 17;
+  this.foo18 = 18;
+  this.foo19 = 19;
+  this.foo20 = 20;
+  this.foo21 = 21;
+  this.foo22 = 22;
+  this.foo23 = 23;
+  this.foo24 = 24;
+  this.foo25 = 25;
+  this.foo26 = 26;
+  this.foo27 = 27;
+  this.foo28 = 28;
+  this.foo29 = 29;
+  this.foo30 = 30;
+  this.foo31 = 31;
+  this.foo32 = 32;
+  this.foo33 = 33;
+  this.foo34 = 34;
+  this.foo35 = 35;
+  this.foo36 = 36;
+  this.foo37 = 37;
+  this.foo38 = 38;
+  this.foo39 = 39;
+  this.foo40 = 40;
+  this.foo41 = 41;
+  this.foo42 = 42;
+  this.foo43 = 43;
+  this.foo44 = 44;
+  this.foo45 = 45;
+  this.foo46 = 46;
+  this.foo47 = 47;
+  this.foo48 = 48;
+  this.foo49 = 49;
+  this.foo50 = 50;
+  this.foo51 = 51;
+  this.foo52 = 52;
+  this.foo53 = 53;
+  this.foo54 = 54;
+  this.foo55 = 55;
+  this.foo56 = 56;
+  this.foo57 = 57;
+  this.foo58 = 58;
+  this.foo59 = 59;
+  this.foo60 = 60;
+  this.foo61 = 61;
+  this.foo62 = 62;
+  this.foo63 = 63;
+  this.foo64 = 64;
+  this.foo65 = 65;
+  this.foo66 = 66;
+  this.foo67 = 67;
+  this.foo68 = 68;
+  this.foo69 = 69;
+  this.foo70 = 70;
+  this.foo71 = 71;
+  this.foo72 = 72;
+  this.foo73 = 73;
+  this.foo74 = 74;
+  this.foo75 = 75;
+  this.foo76 = 76;
+  this.foo77 = 77;
+  this.foo78 = 78;
+  this.foo79 = 79;
+  this.foo80 = 80;
+  this.foo81 = 81;
+  this.foo82 = 82;
+  this.foo83 = 83;
+  this.foo84 = 84;
+  this.foo85 = 85;
+  this.foo86 = 86;
+  this.foo87 = 87;
+  this.foo88 = 88;
+  this.foo89 = 89;
+  this.foo90 = 90;
+  this.foo91 = 91;
+  this.foo92 = 92;
+  this.foo93 = 93;
+  this.foo94 = 94;
+  this.foo95 = 95;
+  this.foo96 = 96;
+  this.foo97 = 97;
+  this.foo98 = 98;
+  this.foo99 = 99;
+  this.foo100 = 100;
+  this.foo101 = 101;
+  this.foo102 = 102;
+  this.foo103 = 103;
+  this.foo104 = 104;
+  this.foo105 = 105;
+  this.foo106 = 106;
+  this.foo107 = 107;
+  this.foo108 = 108;
+  this.foo109 = 109;
+  this.foo110 = 110;
+  this.foo111 = 111;
+  this.foo112 = 112;
+  this.foo113 = 113;
+  this.foo114 = 114;
+  this.foo115 = 115;
+  this.foo116 = 116;
+  this.foo117 = 117;
+  this.foo118 = 118;
+  this.foo119 = 119;
+  this.foo120 = 120;
+  this.foo121 = 121;
+  this.foo122 = 122;
+  this.foo123 = 123;
+  this.foo124 = 124;
+  this.foo125 = 125;
+  this.foo126 = 126;
+  this.foo127 = 127;
+  this.foo128 = 128;
+  this.foo129 = 129;
+  this.foo130 = 130;
+  this.foo131 = 131;
+  this.foo132 = 132;
+  this.foo133 = 133;
+  this.foo134 = 134;
+  this.foo135 = 135;
+  this.foo136 = 136;
+  this.foo137 = 137;
+  this.foo138 = 138;
+  this.foo139 = 139;
+  this.foo140 = 140;
+  this.foo141 = 141;
+  this.foo142 = 142;
+  this.foo143 = 143;
+  this.foo144 = 144;
+  this.foo145 = 145;
+  this.foo146 = 146;
+  this.foo147 = 147;
+  this.foo148 = 148;
+  this.foo149 = 149;
+  this.foo150 = 150;
+  this.foo151 = 151;
+  this.foo152 = 152;
+  this.foo153 = 153;
+  this.foo154 = 154;
+  this.foo155 = 155;
+  this.foo156 = 156;
+  this.foo157 = 157;
+  this.foo158 = 158;
+  this.foo159 = 159;
+  this.foo160 = 160;
+  this.foo161 = 161;
+  this.foo162 = 162;
+  this.foo163 = 163;
+  this.foo164 = 164;
+  this.foo165 = 165;
+  this.foo166 = 166;
+  this.foo167 = 167;
+  this.foo168 = 168;
+  this.foo169 = 169;
+  this.foo170 = 170;
+  this.foo171 = 171;
+  this.foo172 = 172;
+  this.foo173 = 173;
+  this.foo174 = 174;
+  this.foo175 = 175;
+  this.foo176 = 176;
+  this.foo177 = 177;
+  this.foo178 = 178;
+  this.foo179 = 179;
+  this.foo180 = 180;
+  this.foo181 = 181;
+  this.foo182 = 182;
+  this.foo183 = 183;
+  this.foo184 = 184;
+  this.foo185 = 185;
+  this.foo186 = 186;
+  this.foo187 = 187;
+  this.foo188 = 188;
+  this.foo189 = 189;
+  this.foo190 = 190;
+  this.foo191 = 191;
+  this.foo192 = 192;
+  this.foo193 = 193;
+  this.foo194 = 194;
+  this.foo195 = 195;
+  this.foo196 = 196;
+  this.foo197 = 197;
+  this.foo198 = 198;
+  this.foo199 = 199;
+  this.foo200 = 200;
+  this.foo201 = 201;
+  this.foo202 = 202;
+  this.foo203 = 203;
+  this.foo204 = 204;
+  this.foo205 = 205;
+  this.foo206 = 206;
+  this.foo207 = 207;
+  this.foo208 = 208;
+  this.foo209 = 209;
+  this.foo210 = 210;
+  this.foo211 = 211;
+  this.foo212 = 212;
+  this.foo213 = 213;
+  this.foo214 = 214;
+  this.foo215 = 215;
+  this.foo216 = 216;
+  this.foo217 = 217;
+  this.foo218 = 218;
+  this.foo219 = 219;
+  this.foo220 = 220;
+  this.foo221 = 221;
+  this.foo222 = 222;
+  this.foo223 = 223;
+  this.foo224 = 224;
+  this.foo225 = 225;
+  this.foo226 = 226;
+  this.foo227 = 227;
+  this.foo228 = 228;
+  this.foo229 = 229;
+  this.foo230 = 230;
+  this.foo231 = 231;
+  this.foo232 = 232;
+  this.foo233 = 233;
+  this.foo234 = 234;
+  this.foo235 = 235;
+  this.foo236 = 236;
+  this.foo237 = 237;
+  this.foo238 = 238;
+  this.foo239 = 239;
+  this.foo240 = 240;
+  this.foo241 = 241;
+  this.foo242 = 242;
+  this.foo243 = 243;
+  this.foo244 = 244;
+  this.foo245 = 245;
+  this.foo246 = 246;
+  this.foo247 = 247;
+  this.foo248 = 248;
+  this.foo249 = 249;
+  this.foo250 = 250;
+  this.foo251 = 251;
+  this.foo252 = 252;
+  this.foo253 = 253;
+  this.foo254 = 254;
+  this.foo255 = 255;
+  this.foo256 = 256;
+  this.foo257 = 257;
+}
diff --git a/test/mjsunit/compiler/alloc-object.js b/test/mjsunit/compiler/alloc-object.js
new file mode 100644
index 0000000..1d44efb
--- /dev/null
+++ b/test/mjsunit/compiler/alloc-object.js
@@ -0,0 +1,90 @@
+// Copyright 2012 the V8 project authors. All rights reserved.
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions are
+// met:
+//
+//     * Redistributions of source code must retain the above copyright
+//       notice, this list of conditions and the following disclaimer.
+//     * Redistributions in binary form must reproduce the above
+//       copyright notice, this list of conditions and the following
+//       disclaimer in the documentation and/or other materials provided
+//       with the distribution.
+//     * Neither the name of Google Inc. nor the names of its
+//       contributors may be used to endorse or promote products derived
+//       from this software without specific prior written permission.
+//
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+// Flags: --allow-natives-syntax --expose-gc --inline-construct
+
+// Test that inlined object allocation works for different layouts of
+// objects (e.g. in object properties, slack tracking in progress or
+// changing of function prototypes)
+
+function test_helper(construct, a, b) {
+  return new construct(a, b);
+}
+
+function test(construct) {
+  %DeoptimizeFunction(test);
+  test_helper(construct, 0, 0);
+  test_helper(construct, 0, 0);
+  %OptimizeFunctionOnNextCall(test_helper);
+  // Test adding a new property after allocation was inlined.
+  var o = test_helper(construct, 1, 2);
+  o.z = 3;
+  assertEquals(1, o.x);
+  assertEquals(2, o.y);
+  assertEquals(3, o.z);
+  // Test changing the prototype after allocation was inlined.
+  construct.prototype = { z:6 };
+  var o = test_helper(construct, 4, 5);
+  assertEquals(4, o.x);
+  assertEquals(5, o.y);
+  assertEquals(6, o.z);
+  %DeoptimizeFunction(test_helper);
+  gc();  // Makes V8 forget about type information for test_helper.
+}
+
+function finalize_slack_tracking(construct) {
+  // Value chosen based on kGenerousAllocationCount = 8.
+  for (var i = 0; i < 8; i++) {
+    new construct(0, 0);
+  }
+}
+
+
+// Both properties are pre-allocated in object properties.
+function ConstructInObjectPreAllocated(a, b) {
+  this.x = a;
+  this.y = b;
+}
+finalize_slack_tracking(ConstructInObjectPreAllocated);
+test(ConstructInObjectPreAllocated);
+
+
+// Both properties are unused in object properties.
+function ConstructInObjectUnused(a, b) {
+  this.x = a < 0 ? 0 : a;
+  this.y = b > 0 ? b : 0;
+}
+finalize_slack_tracking(ConstructInObjectUnused);
+test(ConstructInObjectUnused);
+
+
+// Test inlined allocation while slack tracking is still in progress.
+function ConstructWhileSlackTracking(a, b) {
+  this.x = a;
+  this.y = b;
+}
+test(ConstructWhileSlackTracking);
diff --git a/test/mjsunit/compiler/inline-arguments.js b/test/mjsunit/compiler/inline-arguments.js
index 532fc26..b6adf7f 100644
--- a/test/mjsunit/compiler/inline-arguments.js
+++ b/test/mjsunit/compiler/inline-arguments.js
@@ -27,11 +27,89 @@
 
 // Flags: --allow-natives-syntax
 
-// Test inlining functions that use arguments.
-function f() { return g(1, 2, 3); }
+function A() {
+}
 
-function g(x, y, z) { return %_ArgumentsLength(); }
+A.prototype.X = function (a, b, c) {
+  assertTrue(this instanceof A);
+  assertEquals(1, a);
+  assertEquals(2, b);
+  assertEquals(3, c);
+};
 
-for (var i = 0; i < 5; ++i) f();
-%OptimizeFunctionOnNextCall(f);
-assertEquals(3, f());
+A.prototype.Y = function () {
+  this.X.apply(this, arguments);
+};
+
+A.prototype.Z = function () {
+  this.Y(1,2,3);
+};
+
+var a = new A();
+a.Z(4,5,6);
+a.Z(4,5,6);
+%OptimizeFunctionOnNextCall(a.Z);
+a.Z(4,5,6);
+A.prototype.X.apply = function (receiver, args) {
+  return Function.prototype.apply.call(this, receiver, args);
+};
+a.Z(4,5,6);
+
+
+// Ensure that HArgumentsObject is inserted in a correct place
+// and dominates all uses.
+function F1() { }
+function F2() { F1.apply(this, arguments); }
+function F3(x, y) {
+  if (x) {
+    F2(y);
+  }
+}
+
+function F31() {
+  return F1.apply(this, arguments);
+}
+
+function F4() {
+  F3(true, false);
+  return F31(1);
+}
+
+F4(1);
+F4(1);
+F4(1);
+%OptimizeFunctionOnNextCall(F4);
+F4(1);
+
+
+// Test correct adapation of arguments.
+// Strict mode prevents arguments object from shadowing parameters.
+(function () {
+  "use strict";
+
+  function G2() {
+    assertArrayEquals([1,2], arguments);
+  }
+
+  function G4() {
+    assertArrayEquals([1,2,3,4], arguments);
+  }
+
+  function adapt2to4(a, b, c, d) {
+    G2.apply(this, arguments);
+  }
+
+  function adapt4to2(a, b) {
+    G4.apply(this, arguments);
+  }
+
+  function test_adaptation() {
+    adapt2to4(1, 2);
+    adapt4to2(1, 2, 3, 4);
+  }
+
+  test_adaptation();
+  test_adaptation();
+  %OptimizeFunctionOnNextCall(test_adaptation);
+  test_adaptation();
+})();
diff --git a/test/mjsunit/compiler/inline-construct.js b/test/mjsunit/compiler/inline-construct.js
new file mode 100644
index 0000000..af9e69c
--- /dev/null
+++ b/test/mjsunit/compiler/inline-construct.js
@@ -0,0 +1,152 @@
+// Copyright 2012 the V8 project authors. All rights reserved.
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions are
+// met:
+//
+//     * Redistributions of source code must retain the above copyright
+//       notice, this list of conditions and the following disclaimer.
+//     * Redistributions in binary form must reproduce the above
+//       copyright notice, this list of conditions and the following
+//       disclaimer in the documentation and/or other materials provided
+//       with the distribution.
+//     * Neither the name of Google Inc. nor the names of its
+//       contributors may be used to endorse or promote products derived
+//       from this software without specific prior written permission.
+//
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+// Flags: --allow-natives-syntax --expose-gc --inline-construct
+
+// Test inlining of constructor calls.
+
+function TestInlinedConstructor(closure) {
+  var result;
+  var counter = { value:0 };
+  result = closure(11, 12, counter);
+  assertEquals(23, result);
+  assertEquals(1, counter.value);
+  result = closure(23, 19, counter);
+  assertEquals(42, result);
+  assertEquals(2, counter.value);
+  %OptimizeFunctionOnNextCall(closure);
+  result = closure(1, 42, counter)
+  assertEquals(43, result);
+  assertEquals(3, counter.value);
+  result = closure("foo", "bar", counter)
+  assertEquals("foobar", result)
+  assertEquals(4, counter.value);
+}
+
+function TestInAllContexts(constructor) {
+  function value_context(a, b, counter) {
+    var obj = new constructor(a, b, counter);
+    return obj.x;
+  }
+  function test_context(a, b, counter) {
+    if (!new constructor(a, b, counter)) {
+      assertUnreachable("should not happen");
+    }
+    return a + b;
+  }
+  function effect_context(a, b, counter) {
+    new constructor(a, b, counter);
+    return a + b;
+  }
+  TestInlinedConstructor(value_context);
+  TestInlinedConstructor(test_context);
+  TestInlinedConstructor(effect_context);
+  %DeoptimizeFunction(value_context);
+  %DeoptimizeFunction(test_context);
+  %DeoptimizeFunction(effect_context);
+  gc();  // Makes V8 forget about type information for *_context.
+}
+
+
+// Test constructor returning nothing in all contexts.
+function c1(a, b, counter) {
+  this.x = a + b;
+  counter.value++;
+}
+TestInAllContexts(c1);
+
+
+// Test constructor returning an object in all contexts.
+function c2(a, b, counter) {
+  var obj = new Object();
+  obj.x = a + b;
+  counter.value++;
+  return obj;
+}
+TestInAllContexts(c2);
+
+
+// Test constructor returning a primitive value in all contexts.
+function c3(a, b, counter) {
+  this.x = a + b;
+  counter.value++;
+  return "not an object";
+}
+TestInAllContexts(c3);
+
+
+// Test constructor called with too many arguments.
+function c_too_many(a, b) {
+  this.x = a + b;
+}
+function f_too_many(a, b, c) {
+  var obj = new c_too_many(a, b, c);
+  return obj.x;
+}
+assertEquals(23, f_too_many(11, 12, 1));
+assertEquals(42, f_too_many(23, 19, 1));
+%OptimizeFunctionOnNextCall(f_too_many);
+assertEquals(43, f_too_many(1, 42, 1));
+assertEquals("foobar", f_too_many("foo", "bar", "baz"))
+
+
+// Test constructor called with too few arguments.
+function c_too_few(a, b) {
+  assertSame(undefined, b);
+  this.x = a + 1;
+}
+function f_too_few(a) {
+  var obj = new c_too_few(a);
+  return obj.x;
+}
+assertEquals(12, f_too_few(11));
+assertEquals(24, f_too_few(23));
+%OptimizeFunctionOnNextCall(f_too_few);
+assertEquals(2, f_too_few(1));
+assertEquals("foo1", f_too_few("foo"))
+
+
+// Test constructor that cannot be inlined.
+function c_unsupported_syntax(a, b, counter) {
+  try {
+    this.x = a + b;
+    counter.value++;
+  } catch(e) {
+    throw new Error();
+  }
+}
+TestInAllContexts(c_unsupported_syntax);
+
+
+// Regression test: Inlined constructors called as functions do not get their
+// implicit receiver object set to undefined, even in strict mode.
+function c_strict(a, b, counter) {
+  "use strict";
+  this.x = a + b;
+  counter.value++;
+}
+TestInAllContexts(c_strict);
diff --git a/test/mjsunit/compiler/inline-literals.js b/test/mjsunit/compiler/inline-literals.js
new file mode 100644
index 0000000..f78abe8
--- /dev/null
+++ b/test/mjsunit/compiler/inline-literals.js
@@ -0,0 +1,50 @@
+// Copyright 2012 the V8 project authors. All rights reserved.
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions are
+// met:
+//
+//     * Redistributions of source code must retain the above copyright
+//       notice, this list of conditions and the following disclaimer.
+//     * Redistributions in binary form must reproduce the above
+//       copyright notice, this list of conditions and the following
+//       disclaimer in the documentation and/or other materials provided
+//       with the distribution.
+//     * Neither the name of Google Inc. nor the names of its
+//       contributors may be used to endorse or promote products derived
+//       from this software without specific prior written permission.
+//
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+// Flags: --allow-natives-syntax
+
+// Test that we can inline functions containing materialized literals.
+
+function o2(b, c) {
+  return { 'b':b, 'c':c, 'y':b + c };
+}
+
+function o1(a, b, c) {
+  return { 'a':a, 'x':o2(b, c) };
+}
+
+function TestObjectLiteral(a, b, c) {
+  var expected = { 'a':a, 'x':{ 'b':b, 'c':c, 'y':b + c } };
+  var result = o1(a, b, c);
+  assertEquals(expected, result, "TestObjectLiteral");
+}
+
+TestObjectLiteral(1, 2, 3);
+TestObjectLiteral(1, 2, 3);
+%OptimizeFunctionOnNextCall(TestObjectLiteral);
+TestObjectLiteral(1, 2, 3);
+TestObjectLiteral('a', 'b', 'c');
diff --git a/test/mjsunit/compiler/literals-optimized.js b/test/mjsunit/compiler/literals-optimized.js
new file mode 100644
index 0000000..049e21a
--- /dev/null
+++ b/test/mjsunit/compiler/literals-optimized.js
@@ -0,0 +1,121 @@
+// Copyright 2012 the V8 project authors. All rights reserved.
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions are
+// met:
+//
+//     * Redistributions of source code must retain the above copyright
+//       notice, this list of conditions and the following disclaimer.
+//     * Redistributions in binary form must reproduce the above
+//       copyright notice, this list of conditions and the following
+//       disclaimer in the documentation and/or other materials provided
+//       with the distribution.
+//     * Neither the name of Google Inc. nor the names of its
+//       contributors may be used to endorse or promote products derived
+//       from this software without specific prior written permission.
+//
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+// Flags: --allow-natives-syntax
+
+// Test optimized versions of array and object literals.
+
+function TestOptimizedLiteral(create, verify) {
+  verify(create(1, 2, 3), 1, 2, 3);
+  verify(create(3, 5, 7), 3, 5, 7);
+  %OptimizeFunctionOnNextCall(create);
+  verify(create(11, 23, 42), 11, 23, 42);
+}
+
+
+// Test shallow array literal.
+function create_arr_shallow(a, b, c) {
+  return [0, a, 0, b, 0, c];
+}
+function verify_arr_shallow(array, a, b, c) {
+  assertSame(6, array.length);
+  assertSame(0, array[0]);
+  assertSame(a, array[1]);
+  assertSame(0, array[2]);
+  assertSame(b, array[3]);
+  assertSame(0, array[4]);
+  assertSame(c, array[5]);
+}
+TestOptimizedLiteral(create_arr_shallow, verify_arr_shallow);
+
+
+// Test nested array literal.
+function create_arr_nested(a, b, c) {
+  return [[0, a], [b, c], [1, 2], 3];
+}
+function verify_arr_nested(array, a, b, c) {
+  assertSame(4, array.length);
+  assertSame(2, array[0].length);
+  assertSame(0, array[0][0]);
+  assertSame(a, array[0][1]);
+  assertSame(2, array[1].length);
+  assertSame(b, array[1][0]);
+  assertSame(c, array[1][1]);
+  assertSame(2, array[2].length);
+  assertSame(1, array[2][0]);
+  assertSame(2, array[2][1]);
+  assertSame(3, array[3]);
+}
+TestOptimizedLiteral(create_arr_nested, verify_arr_nested);
+
+
+// Test shallow object literal.
+function create_obj_shallow(a, b, c) {
+  return { x:a, y:b, z:c, v:'foo', 9:'bar' };
+}
+function verify_obj_shallow(object, a, b, c) {
+  assertSame(a, object.x);
+  assertSame(b, object.y);
+  assertSame(c, object.z);
+  assertSame('foo', object.v);
+  assertSame('bar', object[9]);
+}
+TestOptimizedLiteral(create_obj_shallow, verify_obj_shallow);
+
+
+// Test nested object literal.
+function create_obj_nested(a, b, c) {
+  return { x:{ v:a, w:b }, y:{ v:1, w:2 }, z:c, v:'foo', 9:'bar' };
+}
+function verify_obj_nested(object, a, b, c) {
+  assertSame(a, object.x.v);
+  assertSame(b, object.x.w);
+  assertSame(1, object.y.v);
+  assertSame(2, object.y.w);
+  assertSame(c, object.z);
+  assertSame('foo', object.v);
+  assertSame('bar', object[9]);
+}
+TestOptimizedLiteral(create_obj_nested, verify_obj_nested);
+
+
+// Test mixed array and object literal.
+function create_mixed_nested(a, b, c) {
+  return { x:[1, 2], y:[a, b], z:c, v:{ v:'foo' }, 9:'bar' };
+}
+function verify_mixed_nested(object, a, b, c) {
+  assertSame(2, object.x.length);
+  assertSame(1, object.x[0]);
+  assertSame(2, object.x[1]);
+  assertSame(2, object.y.length);
+  assertSame(a, object.y[0]);
+  assertSame(b, object.y[1]);
+  assertSame(c, object.z);
+  assertSame('foo', object.v.v);
+  assertSame('bar', object[9]);
+}
+TestOptimizedLiteral(create_mixed_nested, verify_mixed_nested);
diff --git a/test/mjsunit/compiler/math-floor-global.js b/test/mjsunit/compiler/math-floor-global.js
new file mode 100644
index 0000000..9ec183f
--- /dev/null
+++ b/test/mjsunit/compiler/math-floor-global.js
@@ -0,0 +1,161 @@
+// Copyright 2012 the V8 project authors. All rights reserved.
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions are
+// met:
+//
+//     * Redistributions of source code must retain the above copyright
+//       notice, this list of conditions and the following disclaimer.
+//     * Redistributions in binary form must reproduce the above
+//       copyright notice, this list of conditions and the following
+//       disclaimer in the documentation and/or other materials provided
+//       with the distribution.
+//     * Neither the name of Google Inc. nor the names of its
+//       contributors may be used to endorse or promote products derived
+//       from this software without specific prior written permission.
+//
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+// Flags: --max-new-space-size=256 --allow-natives-syntax
+
+// Test inlining of Math.floor when assigned to a global.
+var flo = Math.floor;
+var test_id = 0;
+
+function testFloor(expect, input) {
+  var test = new Function('n',
+                          '"' + (test_id++) + '";return flo(n)');
+  assertEquals(expect, test(input));
+  assertEquals(expect, test(input));
+  assertEquals(expect, test(input));
+  %OptimizeFunctionOnNextCall(test);
+  assertEquals(expect, test(input));
+}
+
+function zero() {
+  var x = 0.5;
+  return (function() { return x - 0.5; })();
+}
+
+function test() {
+  testFloor(0, 0);
+  testFloor(0, zero());
+  testFloor(-0, -0);
+  testFloor(Infinity, Infinity);
+  testFloor(-Infinity, -Infinity);
+  testFloor(NaN, NaN);
+
+  // Ensure that a negative zero coming from Math.floor is properly handled
+  // by other operations.
+  function ifloor(x) {
+    return 1 / Math.floor(x);
+  }
+  assertEquals(-Infinity, ifloor(-0));
+  assertEquals(-Infinity, ifloor(-0));
+  assertEquals(-Infinity, ifloor(-0));
+  %OptimizeFunctionOnNextCall(ifloor);
+  assertEquals(-Infinity, ifloor(-0));
+
+  testFloor(0, 0.1);
+  testFloor(0, 0.49999999999999994);
+  testFloor(0, 0.5);
+  testFloor(0, 0.7);
+  testFloor(-1, -0.1);
+  testFloor(-1, -0.49999999999999994);
+  testFloor(-1, -0.5);
+  testFloor(-1, -0.7);
+  testFloor(1, 1);
+  testFloor(1, 1.1);
+  testFloor(1, 1.5);
+  testFloor(1, 1.7);
+  testFloor(-1, -1);
+  testFloor(-2, -1.1);
+  testFloor(-2, -1.5);
+  testFloor(-2, -1.7);
+
+  testFloor(0, Number.MIN_VALUE);
+  testFloor(-1, -Number.MIN_VALUE);
+  testFloor(Number.MAX_VALUE, Number.MAX_VALUE);
+  testFloor(-Number.MAX_VALUE, -Number.MAX_VALUE);
+  testFloor(Infinity, Infinity);
+  testFloor(-Infinity, -Infinity);
+
+  // 2^30 is a smi boundary.
+  var two_30 = 1 << 30;
+
+  testFloor(two_30, two_30);
+  testFloor(two_30, two_30 + 0.1);
+  testFloor(two_30, two_30 + 0.5);
+  testFloor(two_30, two_30 + 0.7);
+
+  testFloor(two_30 - 1, two_30 - 1);
+  testFloor(two_30 - 1, two_30 - 1 + 0.1);
+  testFloor(two_30 - 1, two_30 - 1 + 0.5);
+  testFloor(two_30 - 1, two_30 - 1 + 0.7);
+
+  testFloor(-two_30, -two_30);
+  testFloor(-two_30, -two_30 + 0.1);
+  testFloor(-two_30, -two_30 + 0.5);
+  testFloor(-two_30, -two_30 + 0.7);
+
+  testFloor(-two_30 + 1, -two_30 + 1);
+  testFloor(-two_30 + 1, -two_30 + 1 + 0.1);
+  testFloor(-two_30 + 1, -two_30 + 1 + 0.5);
+  testFloor(-two_30 + 1, -two_30 + 1 + 0.7);
+
+  // 2^52 is a precision boundary.
+  var two_52 = (1 << 30) * (1 << 22);
+
+  testFloor(two_52, two_52);
+  testFloor(two_52, two_52 + 0.1);
+  assertEquals(two_52, two_52 + 0.5);
+  testFloor(two_52, two_52 + 0.5);
+  assertEquals(two_52 + 1, two_52 + 0.7);
+  testFloor(two_52 + 1, two_52 + 0.7);
+
+  testFloor(two_52 - 1, two_52 - 1);
+  testFloor(two_52 - 1, two_52 - 1 + 0.1);
+  testFloor(two_52 - 1, two_52 - 1 + 0.5);
+  testFloor(two_52 - 1, two_52 - 1 + 0.7);
+
+  testFloor(-two_52, -two_52);
+  testFloor(-two_52, -two_52 + 0.1);
+  testFloor(-two_52, -two_52 + 0.5);
+  testFloor(-two_52, -two_52 + 0.7);
+
+  testFloor(-two_52 + 1, -two_52 + 1);
+  testFloor(-two_52 + 1, -two_52 + 1 + 0.1);
+  testFloor(-two_52 + 1, -two_52 + 1 + 0.5);
+  testFloor(-two_52 + 1, -two_52 + 1 + 0.7);
+}
+
+
+// Test in a loop to cover the custom IC and GC-related issues.
+for (var i = 0; i < 50; i++) {
+  test();
+}
+
+
+// Regression test for a bug where a negative zero coming from Math.floor
+// was not properly handled by other operations.
+function floorsum(i, n) {
+  var ret = Math.floor(n);
+  while (--i > 0) {
+    ret += Math.floor(n);
+  }
+  return ret;
+}
+assertEquals(-0, floorsum(1, -0));
+%OptimizeFunctionOnNextCall(floorsum);
+// The optimized function will deopt.  Run it with enough iterations to try
+// to optimize via OSR (triggering the bug).
+assertEquals(-0, floorsum(100000, -0));
diff --git a/test/mjsunit/compiler/math-floor-local.js b/test/mjsunit/compiler/math-floor-local.js
new file mode 100644
index 0000000..e44b15c
--- /dev/null
+++ b/test/mjsunit/compiler/math-floor-local.js
@@ -0,0 +1,161 @@
+// Copyright 2012 the V8 project authors. All rights reserved.
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions are
+// met:
+//
+//     * Redistributions of source code must retain the above copyright
+//       notice, this list of conditions and the following disclaimer.
+//     * Redistributions in binary form must reproduce the above
+//       copyright notice, this list of conditions and the following
+//       disclaimer in the documentation and/or other materials provided
+//       with the distribution.
+//     * Neither the name of Google Inc. nor the names of its
+//       contributors may be used to endorse or promote products derived
+//       from this software without specific prior written permission.
+//
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+// Flags: --max-new-space-size=256 --allow-natives-syntax
+
+// Test inlining of Math.floor when assigned to a local.
+var test_id = 0;
+
+function testFloor(expect, input) {
+  var test = new Function('n',
+                          '"' + (test_id++) +
+                          '";var f = Math.floor; return f(n)');
+  assertEquals(expect, test(input));
+  assertEquals(expect, test(input));
+  assertEquals(expect, test(input));
+  %OptimizeFunctionOnNextCall(test);
+  assertEquals(expect, test(input));
+}
+
+function zero() {
+  var x = 0.5;
+  return (function() { return x - 0.5; })();
+}
+
+function test() {
+  testFloor(0, 0);
+  testFloor(0, zero());
+  testFloor(-0, -0);
+  testFloor(Infinity, Infinity);
+  testFloor(-Infinity, -Infinity);
+  testFloor(NaN, NaN);
+
+  // Ensure that a negative zero coming from Math.floor is properly handled
+  // by other operations.
+  function ifloor(x) {
+    return 1 / Math.floor(x);
+  }
+  assertEquals(-Infinity, ifloor(-0));
+  assertEquals(-Infinity, ifloor(-0));
+  assertEquals(-Infinity, ifloor(-0));
+  %OptimizeFunctionOnNextCall(ifloor);
+  assertEquals(-Infinity, ifloor(-0));
+
+  testFloor(0, 0.1);
+  testFloor(0, 0.49999999999999994);
+  testFloor(0, 0.5);
+  testFloor(0, 0.7);
+  testFloor(-1, -0.1);
+  testFloor(-1, -0.49999999999999994);
+  testFloor(-1, -0.5);
+  testFloor(-1, -0.7);
+  testFloor(1, 1);
+  testFloor(1, 1.1);
+  testFloor(1, 1.5);
+  testFloor(1, 1.7);
+  testFloor(-1, -1);
+  testFloor(-2, -1.1);
+  testFloor(-2, -1.5);
+  testFloor(-2, -1.7);
+
+  testFloor(0, Number.MIN_VALUE);
+  testFloor(-1, -Number.MIN_VALUE);
+  testFloor(Number.MAX_VALUE, Number.MAX_VALUE);
+  testFloor(-Number.MAX_VALUE, -Number.MAX_VALUE);
+  testFloor(Infinity, Infinity);
+  testFloor(-Infinity, -Infinity);
+
+  // 2^30 is a smi boundary.
+  var two_30 = 1 << 30;
+
+  testFloor(two_30, two_30);
+  testFloor(two_30, two_30 + 0.1);
+  testFloor(two_30, two_30 + 0.5);
+  testFloor(two_30, two_30 + 0.7);
+
+  testFloor(two_30 - 1, two_30 - 1);
+  testFloor(two_30 - 1, two_30 - 1 + 0.1);
+  testFloor(two_30 - 1, two_30 - 1 + 0.5);
+  testFloor(two_30 - 1, two_30 - 1 + 0.7);
+
+  testFloor(-two_30, -two_30);
+  testFloor(-two_30, -two_30 + 0.1);
+  testFloor(-two_30, -two_30 + 0.5);
+  testFloor(-two_30, -two_30 + 0.7);
+
+  testFloor(-two_30 + 1, -two_30 + 1);
+  testFloor(-two_30 + 1, -two_30 + 1 + 0.1);
+  testFloor(-two_30 + 1, -two_30 + 1 + 0.5);
+  testFloor(-two_30 + 1, -two_30 + 1 + 0.7);
+
+  // 2^52 is a precision boundary.
+  var two_52 = (1 << 30) * (1 << 22);
+
+  testFloor(two_52, two_52);
+  testFloor(two_52, two_52 + 0.1);
+  assertEquals(two_52, two_52 + 0.5);
+  testFloor(two_52, two_52 + 0.5);
+  assertEquals(two_52 + 1, two_52 + 0.7);
+  testFloor(two_52 + 1, two_52 + 0.7);
+
+  testFloor(two_52 - 1, two_52 - 1);
+  testFloor(two_52 - 1, two_52 - 1 + 0.1);
+  testFloor(two_52 - 1, two_52 - 1 + 0.5);
+  testFloor(two_52 - 1, two_52 - 1 + 0.7);
+
+  testFloor(-two_52, -two_52);
+  testFloor(-two_52, -two_52 + 0.1);
+  testFloor(-two_52, -two_52 + 0.5);
+  testFloor(-two_52, -two_52 + 0.7);
+
+  testFloor(-two_52 + 1, -two_52 + 1);
+  testFloor(-two_52 + 1, -two_52 + 1 + 0.1);
+  testFloor(-two_52 + 1, -two_52 + 1 + 0.5);
+  testFloor(-two_52 + 1, -two_52 + 1 + 0.7);
+}
+
+
+// Test in a loop to cover the custom IC and GC-related issues.
+for (var i = 0; i < 50; i++) {
+  test();
+}
+
+
+// Regression test for a bug where a negative zero coming from Math.floor
+// was not properly handled by other operations.
+function floorsum(i, n) {
+  var ret = Math.floor(n);
+  while (--i > 0) {
+    ret += Math.floor(n);
+  }
+  return ret;
+}
+assertEquals(-0, floorsum(1, -0));
+%OptimizeFunctionOnNextCall(floorsum);
+// The optimized function will deopt.  Run it with enough iterations to try
+// to optimize via OSR (triggering the bug).
+assertEquals(-0, floorsum(100000, -0));
diff --git a/test/mjsunit/compiler/optimized-for-in.js b/test/mjsunit/compiler/optimized-for-in.js
new file mode 100644
index 0000000..cb8c66d
--- /dev/null
+++ b/test/mjsunit/compiler/optimized-for-in.js
@@ -0,0 +1,300 @@
+// Copyright 2012 the V8 project authors. All rights reserved.
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions are
+// met:
+//
+//     * Redistributions of source code must retain the above copyright
+//       notice, this list of conditions and the following disclaimer.
+//     * Redistributions in binary form must reproduce the above
+//       copyright notice, this list of conditions and the following
+//       disclaimer in the documentation and/or other materials provided
+//       with the distribution.
+//     * Neither the name of Google Inc. nor the names of its
+//       contributors may be used to endorse or promote products derived
+//       from this software without specific prior written permission.
+//
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+// Flags: --optimize-for-in --allow-natives-syntax
+
+// Test for-in support in Crankshaft.  For simplicity this tests assumes certain
+// fixed iteration order for properties and will have to be adjusted if V8
+// stops following insertion order.
+
+
+function a(t) {
+  var result = [];
+  for (var i in t) {
+    result.push(i + t[i]);
+  }
+  return result.join('');
+}
+
+// Check that we correctly deoptimize on map check.
+function b(t) {
+  var result = [];
+  for (var i in t) {
+    result.push(i + t[i]);
+    delete t[i];
+  }
+  return result.join('');
+}
+
+// Check that we correctly deoptimize during preparation step.
+function c(t) {
+  var result = [];
+  for (var i in t) {
+    result.push(i + t[i]);
+  }
+  return result.join('');
+}
+
+// Check that we deoptimize to the place after side effect in the right state.
+function d(t) {
+  var result = [];
+  var o;
+  for (var i in (o = t())) {
+    result.push(i + o[i]);
+  }
+  return result.join('');
+}
+
+// Check that we correctly deoptimize on map check inserted for fused load.
+function e(t) {
+  var result = [];
+  for (var i in t) {
+    delete t[i];
+    t[i] = i;
+    result.push(i + t[i]);
+  }
+  return result.join('');
+}
+
+// Nested for-in loops.
+function f(t) {
+  var result = [];
+  for (var i in t) {
+    for (var j in t) {
+      result.push(i + j + t[i] + t[j]);
+    }
+  }
+  return result.join('');
+}
+
+// Deoptimization from the inner for-in loop.
+function g(t) {
+  var result = [];
+  for (var i in t) {
+    for (var j in t) {
+      result.push(i + j + t[i] + t[j]);
+      var v = t[i];
+      delete t[i];
+      t[i] = v;
+    }
+  }
+  return result.join('');
+}
+
+
+// Break from the inner for-in loop.
+function h(t, deopt) {
+  var result = [];
+  for (var i in t) {
+    for (var j in t) {
+      result.push(i + j + t[i] + t[j]);
+      break;
+    }
+  }
+  deopt.deopt;
+  return result.join('');
+}
+
+// Continue in the inner loop.
+function j(t, deopt) {
+  var result = [];
+  for (var i in t) {
+    for (var j in t) {
+      result.push(i + j + t[i] + t[j]);
+      continue;
+    }
+  }
+  deopt.deopt;
+  return result.join('');
+}
+
+// Continue of the outer loop.
+function k(t, deopt) {
+  var result = [];
+  outer: for (var i in t) {
+    for (var j in t) {
+      result.push(i + j + t[i] + t[j]);
+      continue outer;
+    }
+  }
+  deopt.deopt;
+  return result.join('');
+}
+
+// Break of the outer loop.
+function l(t, deopt) {
+  var result = [];
+  outer: for (var i in t) {
+    for (var j in t) {
+      result.push(i + j + t[i] + t[j]);
+      break outer;
+    }
+  }
+  deopt.deopt;
+  return result.join('');
+}
+
+// Test deoptimization from inlined frame (currently it is not inlined).
+function m0(t, deopt) {
+  for (var i in t) {
+    for (var j in t) {
+      deopt.deopt;
+      return i + j + t[i] + t[j];
+    }
+  }
+}
+
+function m(t, deopt) {
+  return m0(t, deopt);
+}
+
+
+function tryFunction(s, mkT, f) {
+  var d = {deopt: false};
+  assertEquals(s, f(mkT(), d));
+  assertEquals(s, f(mkT(), d));
+  assertEquals(s, f(mkT(), d));
+  %OptimizeFunctionOnNextCall(f);
+  assertEquals(s, f(mkT(), d));
+  assertEquals(s, f(mkT(), {}));
+}
+
+var s = "a1b2c3d4";
+function mkTable() { return { a: "1", b: "2", c: "3", d: "4" }; }
+
+
+tryFunction(s, mkTable, a);
+tryFunction(s, mkTable, b);
+tryFunction("0a1b2c3d", function () { return "abcd"; }, c);
+tryFunction("0a1b2c3d", function () {
+  var cnt = false;
+  return function () {
+    cnt = true;
+    return "abcd";
+  }
+}, d);
+tryFunction("aabbccdd", mkTable, e);
+
+function mkSmallTable() { return { a: "1", b: "2" }; }
+
+tryFunction("aa11ab12ba21bb22", mkSmallTable, f);
+tryFunction("aa11ab12bb22ba21", mkSmallTable, g);
+tryFunction("aa11ba21", mkSmallTable, h);
+tryFunction("aa11ab12ba21bb22", mkSmallTable, j);
+tryFunction("aa11ba21", mkSmallTable, h);
+tryFunction("aa11ba21", mkSmallTable, k);
+tryFunction("aa11", mkSmallTable, l);
+tryFunction("aa11", mkSmallTable, m);
+
+// Test handling of null.
+tryFunction("", function () {
+  return function () { return null; }
+}, function (t) {
+  for (var i in t()) { return i; }
+  return "";
+});
+
+// Test smis.
+tryFunction("", function () {
+  return function () { return 11; }
+}, function (t) {
+  for (var i in t()) { return i; }
+  return "";
+});
+
+// Test LoadFieldByIndex for out of object properties.
+function O() { this.a = 1; }
+for (var i = 0; i < 10; i++) new O();
+tryFunction("a1b2c3d4e5f6", function () {
+  var o = new O();
+  o.b = 2;
+  o.c = 3;
+  o.d = 4;
+  o.e = 5;
+  o.f = 6;
+  return o;
+}, function (t) {
+  var r = [];
+  for (var i in t) r.push(i + t[i]);
+  return r.join('');
+});
+
+// Test OSR inside for-in.
+function osr_inner(t, limit) {
+  var r = 1;
+  for (var x in t) {
+    if (t.hasOwnProperty(x)) {
+      for (var i = 0; i < t[x].length; i++) {
+        r += t[x][i];
+        if (i === limit) {
+          %OptimizeFunctionOnNextCall(osr_inner, "osr");
+        }
+      }
+      r += x;
+    }
+  }
+  return r;
+}
+
+function osr_outer(t, osr_after) {
+  var r = 1;
+  for (var x in t) {
+    for (var i = 0; i < t[x].length; i++) {
+      r += t[x][i];
+    }
+    if (x === osr_after) {
+      %OptimizeFunctionOnNextCall(osr_outer, "osr");
+    }
+    r += x;
+  }
+  return r;
+}
+
+function osr_outer_and_deopt(t, osr_after) {
+  var r = 1;
+  for (var x in t) {
+    r += x;
+    if (x == osr_after) {
+      %OptimizeFunctionOnNextCall(osr_outer_and_deopt, "osr");
+    }
+  }
+  return r;
+}
+
+function test_osr() {
+  with ({}) {}  // Disable optimizations of this function.
+  var arr = new Array(20);
+  for (var i = 0; i < arr.length; i++) {
+    arr[i] = i + 1;
+  }
+  arr.push(":");  // Force deopt at the end of the loop.
+  assertEquals("211:x1234567891011121314151617181920:y", osr_inner({x: arr, y: arr}, (arr.length / 2) | 0));
+  assertEquals("7x456y", osr_outer({x: [1,2,3], y: [4,5,6]}, "x"));
+  assertEquals("101234567", osr_outer_and_deopt([1,2,3,4,5,6,7,8], "5"));
+}
+
+test_osr();
diff --git a/test/mjsunit/compiler/regress-toint32.js b/test/mjsunit/compiler/regress-toint32.js
new file mode 100644
index 0000000..54c2f76
--- /dev/null
+++ b/test/mjsunit/compiler/regress-toint32.js
@@ -0,0 +1,45 @@
+// Copyright 2012 the V8 project authors. All rights reserved.
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions are
+// met:
+//
+//     * Redistributions of source code must retain the above copyright
+//       notice, this list of conditions and the following disclaimer.
+//     * Redistributions in binary form must reproduce the above
+//       copyright notice, this list of conditions and the following
+//       disclaimer in the documentation and/or other materials provided
+//       with the distribution.
+//     * Neither the name of Google Inc. nor the names of its
+//       contributors may be used to endorse or promote products derived
+//       from this software without specific prior written permission.
+//
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+// Flags: --allow-natives-syntax --noenable-sse3
+
+var a = new Int32Array(1);
+var G = 0x80000000;
+
+function f(x) {
+  var v = x;
+  v = v + 1;
+  a[0] = v;
+  v = v - 1;
+  return v;
+}
+
+assertEquals(G, f(G));
+assertEquals(G, f(G));
+%OptimizeFunctionOnNextCall(f);
+assertEquals(G, f(G));
+
diff --git a/test/mjsunit/count-based-osr.js b/test/mjsunit/count-based-osr.js
new file mode 100644
index 0000000..125c4e2
--- /dev/null
+++ b/test/mjsunit/count-based-osr.js
@@ -0,0 +1,38 @@
+// Copyright 2012 the V8 project authors. All rights reserved.
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions are
+// met:
+//
+//     * Redistributions of source code must retain the above copyright
+//       notice, this list of conditions and the following disclaimer.
+//     * Redistributions in binary form must reproduce the above
+//       copyright notice, this list of conditions and the following
+//       disclaimer in the documentation and/or other materials provided
+//       with the distribution.
+//     * Neither the name of Google Inc. nor the names of its
+//       contributors may be used to endorse or promote products derived
+//       from this software without specific prior written permission.
+//
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+// Flags: --count-based-interrupts --interrupt-budget=10 --weighted-back-edges --allow-natives-syntax
+
+// Test that OSR works properly when using count-based interrupting/profiling.
+
+function osr_this() {
+  var a = 1;
+  // Trigger OSR.
+  while (%GetOptimizationStatus(osr_this) == 2) {}
+  return a;
+}
+assertEquals(1, osr_this());
diff --git a/test/mjsunit/d8-os.js b/test/mjsunit/d8-os.js
index 8292ab9..239938c 100644
--- a/test/mjsunit/d8-os.js
+++ b/test/mjsunit/d8-os.js
@@ -63,52 +63,53 @@
   } catch (e) {
   }
   os.mkdirp(TEST_DIR);
-  os.chdir(TEST_DIR);
   try {
     // Check the chdir worked.
     os.system('ls', [TEST_DIR]);
     // Simple create dir.
-    os.mkdirp("dir");
+    os.mkdirp(TEST_DIR + "/dir");
     // Create dir in dir.
-    os.mkdirp("dir/foo");
+    os.mkdirp(TEST_DIR + "/dir/foo");
     // Check that they are there.
-    os.system('ls', ['dir/foo']);
+    os.system('ls', [TEST_DIR + '/dir/foo']);
     // Check that we can detect when something is not there.
-    assertThrows("os.system('ls', ['dir/bar']);", "dir not there");
+    assertThrows("os.system('ls', [TEST_DIR + '/dir/bar']);", "dir not there");
     // Check that mkdirp makes intermediate directories.
-    os.mkdirp("dir2/foo");
-    os.system("ls", ["dir2/foo"]);
+    os.mkdirp(TEST_DIR + "/dir2/foo");
+    os.system("ls", [TEST_DIR + "/dir2/foo"]);
     // Check that mkdirp doesn't mind if the dir is already there.
-    os.mkdirp("dir2/foo");
-    os.mkdirp("dir2/foo/");
+    os.mkdirp(TEST_DIR + "/dir2/foo");
+    os.mkdirp(TEST_DIR + "/dir2/foo/");
     // Check that mkdirp can cope with trailing /
-    os.mkdirp("dir3/");
-    os.system("ls", ["dir3"]);
+    os.mkdirp(TEST_DIR + "/dir3/");
+    os.system("ls", [TEST_DIR + "/dir3"]);
     // Check that we get an error if the name is taken by a file.
-    os.system("sh", ["-c", "echo foo > file1"]);
-    os.system("ls", ["file1"]);
-    assertThrows("os.mkdirp('file1');", "mkdir over file1");
-    assertThrows("os.mkdirp('file1/foo');", "mkdir over file2");
-    assertThrows("os.mkdirp('file1/');", "mkdir over file3");
-    assertThrows("os.mkdirp('file1/foo/');", "mkdir over file4");
+    os.system("sh", ["-c", "echo foo > " + TEST_DIR + "/file1"]);
+    os.system("ls", [TEST_DIR + "/file1"]);
+    assertThrows("os.mkdirp(TEST_DIR + '/file1');", "mkdir over file1");
+    assertThrows("os.mkdirp(TEST_DIR + '/file1/foo');", "mkdir over file2");
+    assertThrows("os.mkdirp(TEST_DIR + '/file1/');", "mkdir over file3");
+    assertThrows("os.mkdirp(TEST_DIR + '/file1/foo/');", "mkdir over file4");
     // Create a dir we cannot read.
-    os.mkdirp("dir4", 0);
+    os.mkdirp(TEST_DIR + "/dir4", 0);
     // This test fails if you are root since root can read any dir.
-    assertThrows("os.chdir('dir4');", "chdir dir4 I");
-    os.rmdir("dir4");
-    assertThrows("os.chdir('dir4');", "chdir dir4 II");
-    // Set umask.
+    assertThrows("os.chdir(TEST_DIR + '/dir4');", "chdir dir4 I");
+    os.rmdir(TEST_DIR + "/dir4");
+    assertThrows("os.chdir(TEST_DIR + '/dir4');", "chdir dir4 II");
+
+    // Set umask.  This changes the umask for the whole process and is
+    // the reason why the test cannot be run multi-threaded.
     var old_umask = os.umask(0777);
     // Create a dir we cannot read.
-    os.mkdirp("dir5");
+    os.mkdirp(TEST_DIR + "/dir5");
     // This test fails if you are root since root can read any dir.
-    assertThrows("os.chdir('dir5');", "cd dir5 I");
-    os.rmdir("dir5");
-    assertThrows("os.chdir('dir5');", "chdir dir5 II");
+    assertThrows("os.chdir(TEST_DIR + '/dir5');", "cd dir5 I");
+    os.rmdir(TEST_DIR + "/dir5");
+    assertThrows("os.chdir(TEST_DIR + '/dir5');", "chdir dir5 II");
     os.umask(old_umask);
 
-    os.mkdirp("hest/fisk/../fisk/ged");
-    os.system("ls", ["hest/fisk/ged"]);
+    os.mkdirp(TEST_DIR + "/hest/fisk/../fisk/ged");
+    os.system("ls", [TEST_DIR + "/hest/fisk/ged"]);
 
     os.setenv("FOO", "bar");
     var environment = os.system("printenv");
diff --git a/test/mjsunit/date.js b/test/mjsunit/date.js
index fa43cbb..3e153ab 100644
--- a/test/mjsunit/date.js
+++ b/test/mjsunit/date.js
@@ -187,6 +187,12 @@
 assertTrue(isNaN(d.getTime()));
 d = new Date(1969, 12, 1, -Infinity);
 assertTrue(isNaN(d.getTime()));
+d = new Date(1969, 12, 1, 0);
+d.setTime(Math.pow(2, 64));
+assertTrue(isNaN(d.getTime()));
+d = new Date(1969, 12, 1, 0);
+d.setTime(Math.pow(-2, 64));
+assertTrue(isNaN(d.getTime()));
 
 
 // Test creation with obscure date values.
diff --git a/test/mjsunit/debug-evaluate-locals-optimized-double.js b/test/mjsunit/debug-evaluate-locals-optimized-double.js
index 7178661..cf25c0c 100644
--- a/test/mjsunit/debug-evaluate-locals-optimized-double.js
+++ b/test/mjsunit/debug-evaluate-locals-optimized-double.js
@@ -25,7 +25,7 @@
 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 
-// Flags: --expose-debug-as debug --allow-natives-syntax
+// Flags: --expose-debug-as debug --expose-gc --allow-natives-syntax --inline-construct
 // Get the Debug object exposed from the debug context global object.
 Debug = debug.Debug
 
@@ -140,7 +140,13 @@
         }
 
         // Check for construct call.
-        assertEquals(testingConstructCall && i == 4, frame.isConstructCall());
+        if (i == 4) {
+          assertEquals(testingConstructCall, frame.isConstructCall());
+        } else if (i == 2) {
+          assertTrue(frame.isConstructCall());
+        } else {
+          assertFalse(frame.isConstructCall());
+        }
 
         // When function f is optimized (1 means YES, see runtime.cc) we
         // expect an optimized frame for f with g1, g2 and g3 inlined.
@@ -204,7 +210,7 @@
   var b3 = input[i].b;
   a3 = a3 + a3 / 100;
   b3 = b3 + b3 / 100;
-  g2(i - 1, a3, b3);
+  new g2(i - 1, a3, b3);
 };
 
 function f(i, x4, y4) {
@@ -222,8 +228,11 @@
 new f(input.length - 1, 11.11, 12.12);
 new f(input.length - 1, 11.11, 12.12, "");
 
-// Make sure that the debug event listener vas invoked.
+// Make sure that the debug event listener was invoked.
 assertFalse(exception, "exception in listener " + exception)
 assertTrue(listenerComplete);
 
+//Throw away type information for next run.
+gc();
+
 Debug.setListener(null);
diff --git a/test/mjsunit/debug-evaluate-locals-optimized.js b/test/mjsunit/debug-evaluate-locals-optimized.js
index 485f752..c88a683 100644
--- a/test/mjsunit/debug-evaluate-locals-optimized.js
+++ b/test/mjsunit/debug-evaluate-locals-optimized.js
@@ -25,7 +25,7 @@
 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 
-// Flags: --expose-debug-as debug --allow-natives-syntax
+// Flags: --expose-debug-as debug --expose-gc --allow-natives-syntax --inline-construct
 // Get the Debug object exposed from the debug context global object.
 Debug = debug.Debug
 
@@ -130,7 +130,13 @@
         }
 
         // Check for construct call.
-        assertEquals(testingConstructCall && i == 4, frame.isConstructCall());
+        if (i == 4) {
+          assertEquals(testingConstructCall, frame.isConstructCall());
+        } else if (i == 2) {
+          assertTrue(frame.isConstructCall());
+        } else {
+          assertFalse(frame.isConstructCall());
+        }
 
         // When function f is optimized (1 means YES, see runtime.cc) we
         // expect an optimized frame for f with g1, g2 and g3 inlined.
@@ -185,7 +191,7 @@
 function g1(i, x3, y3, z3) {
   var a3 = expected[i].locals.a3;
   var b3 = expected[i].locals.b3;
-  g2(i - 1, a3, b3);
+  new g2(i - 1, a3, b3);
 }
 
 function f(i, x4, y4) {
@@ -201,8 +207,11 @@
 new f(expected.length - 1, 11, 12);
 new f(expected.length - 1, 11, 12, 0);
 
-// Make sure that the debug event listener vas invoked.
+// Make sure that the debug event listener was invoked.
 assertFalse(exception, "exception in listener " + exception)
 assertTrue(listenerComplete);
 
+// Throw away type information for next run.
+gc();
+
 Debug.setListener(null);
diff --git a/test/mjsunit/debug-set-script-source.js b/test/mjsunit/debug-set-script-source.js
new file mode 100644
index 0000000..34ae848
--- /dev/null
+++ b/test/mjsunit/debug-set-script-source.js
@@ -0,0 +1,64 @@
+// Copyright 2012 the V8 project authors. All rights reserved.
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions are
+// met:
+//
+//     * Redistributions of source code must retain the above copyright
+//       notice, this list of conditions and the following disclaimer.
+//     * Redistributions in binary form must reproduce the above
+//       copyright notice, this list of conditions and the following
+//       disclaimer in the documentation and/or other materials provided
+//       with the distribution.
+//     * Neither the name of Google Inc. nor the names of its
+//       contributors may be used to endorse or promote products derived
+//       from this software without specific prior written permission.
+//
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+// Flags: --expose-debug-as debug
+// Get the Debug object exposed from the debug context global object.
+Debug = debug.Debug
+
+var script_number = 0;
+var script_names = [];
+var exception = null;
+
+function listener(event, exec_state, event_data, data) {
+  if (event == Debug.DebugEvent.BeforeCompile) {
+    event_data.script().setSource(event_data.script().source() +
+        " //@ sourceURL=proper_location_" + (++script_number));
+  } else if (event == Debug.DebugEvent.AfterCompile) {
+    try {
+      event_data.script().setSource("a=1 //@ sourceURL=wrong_location");
+    } catch(e) {
+      exception = e;
+    }
+    script_names.push(event_data.script().name());
+  }
+};
+
+
+// Add the debug event listener.
+Debug.setListener(listener);
+
+// Compile different sources.
+eval('a=1');
+eval('(function(){})');
+
+assertEquals(2, script_names.length);
+assertEquals("proper_location_1", script_names[0]);
+assertEquals("proper_location_2", script_names[1]);
+
+assertEquals("illegal access", exception);
+
+Debug.setListener(null);
diff --git a/test/mjsunit/debug-stepin-accessor.js b/test/mjsunit/debug-stepin-accessor.js
index 2c9c8c3..70acd5e 100644
--- a/test/mjsunit/debug-stepin-accessor.js
+++ b/test/mjsunit/debug-stepin-accessor.js
@@ -1,4 +1,4 @@
-// Copyright 2008 the V8 project authors. All rights reserved.
+// Copyright 2012 the V8 project authors. All rights reserved.
 // Redistribution and use in source and binary forms, with or without
 // modification, are permitted provided that the following conditions are
 // met:
@@ -112,8 +112,8 @@
 function testGetter1_3() {
   expected_function_name = 'getter1';
   expected_source_line_text = '    return this.name;  // getter 1';
-  debugger;
   for (var i = 1; i < 2; i++) {
+    debugger;
     var x = c['getter' + i];
   }
 }
diff --git a/test/mjsunit/debug-stepin-function-call.js b/test/mjsunit/debug-stepin-function-call.js
index 385fcb2..3b5240c 100644
--- a/test/mjsunit/debug-stepin-function-call.js
+++ b/test/mjsunit/debug-stepin-function-call.js
@@ -135,8 +135,15 @@
   var yetAnotherLocal = 10;
 }
 
+// Test step into bound function.
+function bind1() {
+  var bound = g.bind(null, 3);
+  debugger;
+  bound();
+}
+
 var testFunctions =
-    [call1, call2, call3, call4, apply1, apply2, apply3, apply4];
+    [call1, call2, call3, call4, apply1, apply2, apply3, apply4, bind1];
 
 for (var i = 0; i < testFunctions.length; i++) {
   state = 0;
@@ -145,5 +152,13 @@
   assertEquals(3, state);
 }
 
+// Test global bound function.
+state = 0;
+var globalBound = g.bind(null, 3);
+debugger;
+globalBound();
+assertNull(exception);
+assertEquals(3, state);
+
 // Get rid of the debug event listener.
 Debug.setListener(null);
\ No newline at end of file
diff --git a/test/mjsunit/elements-kind.js b/test/mjsunit/elements-kind.js
index e5b5a66..4aa79de 100644
--- a/test/mjsunit/elements-kind.js
+++ b/test/mjsunit/elements-kind.js
@@ -1,4 +1,4 @@
-// Copyright 2011 the V8 project authors. All rights reserved.
+// Copyright 2012 the V8 project authors. All rights reserved.
 // Redistribution and use in source and binary forms, with or without
 // modification, are permitted provided that the following conditions are
 // met:
@@ -34,7 +34,7 @@
 // in this test case.  Depending on whether smi-only arrays are actually
 // enabled, this test takes the appropriate code path to check smi-only arrays.
 
-support_smi_only_arrays = %HasFastSmiOnlyElements([1,2,3,4,5,6,7,8,9,10]);
+support_smi_only_arrays = %HasFastSmiOnlyElements(new Array(1,2,3,4,5,6,7,8));
 
 if (support_smi_only_arrays) {
   print("Tests include smi-only arrays.");
@@ -108,11 +108,13 @@
 me.drink = 0xC0C0A;
 assertKind(elements_kind.fast, me);
 
-var too = [1,2,3];
-assertKind(elements_kind.fast_smi_only, too);
-too.dance = 0xD15C0;
-too.drink = 0xC0C0A;
-assertKind(elements_kind.fast_smi_only, too);
+if (support_smi_only_arrays) {
+  var too = [1,2,3];
+  assertKind(elements_kind.fast_smi_only, too);
+  too.dance = 0xD15C0;
+  too.drink = 0xC0C0A;
+  assertKind(elements_kind.fast_smi_only, too);
+}
 
 // Make sure the element kind transitions from smionly when a non-smi is stored.
 var you = new Array();
@@ -145,6 +147,7 @@
 
 // Crankshaft support for smi-only array elements.
 function monomorphic(array) {
+  assertKind(elements_kind.fast_smi_only, array);
   for (var i = 0; i < 3; i++) {
     array[i] = i + 10;
   }
@@ -154,7 +157,8 @@
     assertEquals(i + 10, a);
   }
 }
-var smi_only = [1, 2, 3];
+var smi_only = new Array(1, 2, 3);
+assertKind(elements_kind.fast_smi_only, smi_only);
 for (var i = 0; i < 3; i++) monomorphic(smi_only);
 %OptimizeFunctionOnNextCall(monomorphic);
 monomorphic(smi_only);
@@ -232,15 +236,17 @@
 function get(foo) { return foo; }  // Used to generate dynamic values.
 
 function crankshaft_test() {
-  var a = [get(1), get(2), get(3)];
-  assertKind(elements_kind.fast_smi_only, a);
+  if (support_smi_only_arrays) {
+    var a1 = [get(1), get(2), get(3)];
+    assertKind(elements_kind.fast_smi_only, a1);
+  }
+  var a2 = new Array(get(1), get(2), get(3));
+  assertKind(elements_kind.fast_smi_only, a2);
   var b = [get(1), get(2), get("three")];
   assertKind(elements_kind.fast, b);
   var c = [get(1), get(2), get(3.5)];
   if (support_smi_only_arrays) {
     assertKind(elements_kind.fast_double, c);
-  } else {
-    assertKind(elements_kind.fast, c);
   }
 }
 for (var i = 0; i < 3; i++) {
diff --git a/test/mjsunit/elements-transition-hoisting.js b/test/mjsunit/elements-transition-hoisting.js
new file mode 100644
index 0000000..5e78f10
--- /dev/null
+++ b/test/mjsunit/elements-transition-hoisting.js
@@ -0,0 +1,211 @@
+// Copyright 2011 the V8 project authors. All rights reserved.
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions are
+// met:
+//
+//     * Redistributions of source code must retain the above copyright
+//       notice, this list of conditions and the following disclaimer.
+//     * Redistributions in binary form must reproduce the above
+//       copyright notice, this list of conditions and the following
+//       disclaimer in the documentation and/or other materials provided
+//       with the distribution.
+//     * Neither the name of Google Inc. nor the names of its
+//       contributors may be used to endorse or promote products derived
+//       from this software without specific prior written permission.
+//
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+// Flags: --allow-natives-syntax --smi-only-arrays --expose-gc
+
+// Ensure that ElementsKind transitions in various situations are hoisted (or
+// not hoisted) correctly, don't change the semantics programs and don't trigger
+// deopt through hoisting in important situations.
+
+support_smi_only_arrays = %HasFastSmiOnlyElements(new Array(1,2,3,4,5,6));
+
+if (support_smi_only_arrays) {
+  print("Tests include smi-only arrays.");
+} else {
+  print("Tests do NOT include smi-only arrays.");
+}
+
+// Force existing ICs from previous stress runs to be flushed, otherwise the
+// assumptions in this test about when deoptimizations get triggered are not
+// valid.
+gc();
+
+if (support_smi_only_arrays) {
+  // Make sure that a simple elements array transitions inside a loop before
+  // stores to an array gets hoisted in a way that doesn't generate a deopt in
+  // simple cases.}
+  function testDoubleConversion4(a) {
+    var object = new Object();
+    a[0] = 0;
+    var count = 3;
+    do {
+      a[0] = object;
+    } while (--count > 0);
+  }
+
+  testDoubleConversion4(new Array(5));
+  %OptimizeFunctionOnNextCall(testDoubleConversion4);
+  testDoubleConversion4(new Array(5));
+  testDoubleConversion4(new Array(5));
+  assertTrue(2 != %GetOptimizationStatus(testDoubleConversion4));
+
+  // Make sure that non-element related map checks that are not preceded by
+  // transitions in a loop still get hoisted in a way that doesn't generate a
+  // deopt in simple cases.
+  function testExactMapHoisting(a) {
+    var object = new Object();
+    a.foo = 0;
+    a[0] = 0;
+    a[1] = 1;
+    var count = 3;
+    do {
+      a.foo = object; // This map check should be hoistable
+      a[1] = object;
+      result = a.foo == object && a[1] == object;
+    } while (--count > 0);
+  }
+
+  testExactMapHoisting(new Array(5));
+  %OptimizeFunctionOnNextCall(testExactMapHoisting);
+  testExactMapHoisting(new Array(5));
+  testExactMapHoisting(new Array(5));
+  assertTrue(2 != %GetOptimizationStatus(testExactMapHoisting));
+
+  // Make sure that non-element related map checks do NOT get hoisted if they
+  // depend on an elements transition before them and it's not possible to hoist
+  // that transition.
+  function testExactMapHoisting2(a) {
+    var object = new Object();
+    a.foo = 0;
+    a[0] = 0;
+    a[1] = 1;
+    var count = 3;
+    do {
+      if (a.bar === undefined) {
+        a[1] = 2.5;
+      }
+      a.foo = object; // This map check should NOT be hoistable because it
+                      // includes a check for the FAST_ELEMENTS map as well as
+                      // the FAST_DOUBLE_ELEMENTS map, which depends on the
+                      // double transition above in the if, which cannot be
+                      // hoisted.
+    } while (--count > 0);
+  }
+
+  testExactMapHoisting2(new Array(5));
+  %OptimizeFunctionOnNextCall(testExactMapHoisting2);
+  testExactMapHoisting2(new Array(5));
+  testExactMapHoisting2(new Array(5));
+  assertTrue(2 != %GetOptimizationStatus(testExactMapHoisting2));
+
+  // Make sure that non-element related map checks do get hoisted if they use
+  // the transitioned map for the check and all transitions that they depend
+  // upon can hoisted, too.
+  function testExactMapHoisting3(a) {
+    var object = new Object();
+    a.foo = 0;
+    a[0] = 0;
+    a[1] = 1;
+    var count = 3;
+    do {
+      a[1] = 2.5;
+      a.foo = object; // This map check should be hoistable because all elements
+                      // transitions in the loop can also be hoisted.
+    } while (--count > 0);
+  }
+
+  var add_transition = new Array(5);
+  add_transition.foo = 0;
+  add_transition[0] = new Object(); // For FAST_ELEMENT transition to be created
+  testExactMapHoisting3(new Array(5));
+  %OptimizeFunctionOnNextCall(testExactMapHoisting3);
+  testExactMapHoisting3(new Array(5));
+  testExactMapHoisting3(new Array(5));
+  assertTrue(2 != %GetOptimizationStatus(testExactMapHoisting3));
+
+  function testDominatingTransitionHoisting1(a) {
+    var object = new Object();
+    a[0] = 0;
+    var count = 3;
+    do {
+      if (a.baz != true) {
+        a[1] = 2.5;
+      }
+      a[0] = object;
+    } while (--count > 3);
+  }
+
+  testDominatingTransitionHoisting1(new Array(5));
+  %OptimizeFunctionOnNextCall(testDominatingTransitionHoisting1);
+  testDominatingTransitionHoisting1(new Array(5));
+  testDominatingTransitionHoisting1(new Array(5));
+  assertTrue(2 != %GetOptimizationStatus(testDominatingTransitionHoisting1));
+
+  function testHoistingWithSideEffect(a) {
+    var object = new Object();
+    a[0] = 0;
+    var count = 3;
+    do {
+      assertTrue(true);
+      a[0] = object;
+    } while (--count > 3);
+  }
+
+  testHoistingWithSideEffect(new Array(5));
+  %OptimizeFunctionOnNextCall(testHoistingWithSideEffect);
+  testHoistingWithSideEffect(new Array(5));
+  testHoistingWithSideEffect(new Array(5));
+  assertTrue(2 != %GetOptimizationStatus(testHoistingWithSideEffect));
+
+  function testStraightLineDupeElinination(a,b,c,d,e,f) {
+    var count = 3;
+    do {
+      assertTrue(true);
+      a[0] = b;
+      a[1] = c;
+      a[2] = d;
+      assertTrue(true);
+      a[3] = e; // TransitionElementsKind should be eliminated despite call.
+      a[4] = f;
+    } while (--count > 3);
+  }
+
+  testStraightLineDupeElinination(new Array(0, 0, 0, 0, 0),0,0,0,0,.5);
+  testStraightLineDupeElinination(new Array(0, 0, 0, 0, 0),0,0,0,.5,0);
+  testStraightLineDupeElinination(new Array(0, 0, 0, 0, 0),0,0,.5,0,0);
+  testStraightLineDupeElinination(new Array(0, 0, 0, 0, 0),0,.5,0,0,0);
+  testStraightLineDupeElinination(new Array(0, 0, 0, 0, 0),.5,0,0,0,0);
+  testStraightLineDupeElinination(new Array(.1,.1,.1,.1,.1),0,0,0,0,.5);
+  testStraightLineDupeElinination(new Array(.1,.1,.1,.1,.1),0,0,0,.5,0);
+  testStraightLineDupeElinination(new Array(.1,.1,.1,.1,.1),0,0,.5,0,0);
+  testStraightLineDupeElinination(new Array(.1,.1,.1,.1,.1),0,.5,0,0,0);
+  testStraightLineDupeElinination(new Array(.1,.1,.1,.1,.1),.5,0,0,0,0);
+  testStraightLineDupeElinination(new Array(5),.5,0,0,0,0);
+  testStraightLineDupeElinination(new Array(5),0,.5,0,0,0);
+  testStraightLineDupeElinination(new Array(5),0,0,.5,0,0);
+  testStraightLineDupeElinination(new Array(5),0,0,0,.5,0);
+  testStraightLineDupeElinination(new Array(5),0,0,0,0,.5);
+  testStraightLineDupeElinination(new Array(5),.5,0,0,0,0);
+  testStraightLineDupeElinination(new Array(5),0,.5,0,0,0);
+  testStraightLineDupeElinination(new Array(5),0,0,.5,0,0);
+  testStraightLineDupeElinination(new Array(5),0,0,0,.5,0);
+  testStraightLineDupeElinination(new Array(5),0,0,0,0,.5);
+  %OptimizeFunctionOnNextCall(testStraightLineDupeElinination);
+  testStraightLineDupeElinination(new Array(5));
+  testStraightLineDupeElinination(new Array(5));
+  assertTrue(2 != %GetOptimizationStatus(testStraightLineDupeElinination));
+}
diff --git a/test/mjsunit/elements-transition.js b/test/mjsunit/elements-transition.js
index 67095c4..60e051b 100644
--- a/test/mjsunit/elements-transition.js
+++ b/test/mjsunit/elements-transition.js
@@ -1,4 +1,4 @@
-// Copyright 2011 the V8 project authors. All rights reserved.
+// Copyright 2012 the V8 project authors. All rights reserved.
 // Redistribution and use in source and binary forms, with or without
 // modification, are permitted provided that the following conditions are
 // met:
@@ -27,7 +27,7 @@
 
 // Flags: --allow-natives-syntax --smi-only-arrays
 
-support_smi_only_arrays = %HasFastSmiOnlyElements([1,2,3,4,5,6,7,8,9,10]);
+support_smi_only_arrays = %HasFastSmiOnlyElements(new Array(1,2,3,4,5,6,7,8));
 
 if (support_smi_only_arrays) {
   print("Tests include smi-only arrays.");
diff --git a/test/mjsunit/external-array.js b/test/mjsunit/external-array.js
index 72cfd85..32f78a7 100644
--- a/test/mjsunit/external-array.js
+++ b/test/mjsunit/external-array.js
@@ -317,3 +317,37 @@
   %DeoptimizeFunction(array_load_set_smi_check2);
   gc();  // Makes V8 forget about type information for array_load_set_smi_check.
 }
+
+// Check handling of undefined in 32- and 64-bit external float arrays.
+
+function store_float32_undefined(ext_array) {
+  ext_array[0] = undefined;
+}
+
+var float32_array = new Float32Array(1);
+// Make sure runtime does it right
+store_float32_undefined(float32_array);
+assertTrue(isNaN(float32_array[0]));
+// Make sure the ICs do it right
+store_float32_undefined(float32_array);
+assertTrue(isNaN(float32_array[0]));
+// Make sure that Cranskshft does it right.
+%OptimizeFunctionOnNextCall(store_float32_undefined);
+store_float32_undefined(float32_array);
+assertTrue(isNaN(float32_array[0]));
+
+function store_float64_undefined(ext_array) {
+  ext_array[0] = undefined;
+}
+
+var float64_array = new Float64Array(1);
+// Make sure runtime does it right
+store_float64_undefined(float64_array);
+assertTrue(isNaN(float64_array[0]));
+// Make sure the ICs do it right
+store_float64_undefined(float64_array);
+assertTrue(isNaN(float64_array[0]));
+// Make sure that Cranskshft does it right.
+%OptimizeFunctionOnNextCall(store_float64_undefined);
+store_float64_undefined(float64_array);
+assertTrue(isNaN(float64_array[0]));
diff --git a/test/mjsunit/function-call.js b/test/mjsunit/function-call.js
index 06479ad..26890ed 100644
--- a/test/mjsunit/function-call.js
+++ b/test/mjsunit/function-call.js
@@ -68,8 +68,7 @@
      String.prototype.toUpperCase,
      String.prototype.toLocaleUpperCase,
      String.prototype.trim,
-     Number.prototype.toLocaleString,
-     Error.prototype.toString];
+     Number.prototype.toLocaleString];
 
 // Non generic natives do not work on any input other than the specific
 // type, but since this change will allow call to be invoked with undefined
@@ -134,7 +133,8 @@
      Date.prototype.toJSON,
      RegExp.prototype.exec,
      RegExp.prototype.test,
-     RegExp.prototype.toString];
+     RegExp.prototype.toString,
+     Error.prototype.toString];
 
 
 // Mapping functions.
diff --git a/test/mjsunit/fuzz-natives.js b/test/mjsunit/fuzz-natives.js
index c4d18d0..2965e74 100644
--- a/test/mjsunit/fuzz-natives.js
+++ b/test/mjsunit/fuzz-natives.js
@@ -184,8 +184,9 @@
   "RegExpConstructResult": true,
   "_RegExpConstructResult": true,
 
-  // This function performs some checks compile time (it requires its first
-  // argument to be a compile time smi).
+  // This functions perform some checks compile time (they require one of their
+  // arguments to be a compile time smi).
+  "_DateField": true,
   "_GetFromCache": true,
 
   // This function expects its first argument to be a non-smi.
diff --git a/test/mjsunit/get-own-property-descriptor.js b/test/mjsunit/get-own-property-descriptor.js
index abb2420..159c63b 100644
--- a/test/mjsunit/get-own-property-descriptor.js
+++ b/test/mjsunit/get-own-property-descriptor.js
@@ -73,7 +73,7 @@
 var a = new String('foobar');
 for (var i = 0; i < a.length; i++) {
   var descStringObject = Object.getOwnPropertyDescriptor(a, i);
-  assertFalse(descStringObject.enumerable);
+  assertTrue(descStringObject.enumerable);
   assertFalse(descStringObject.configurable);
   assertFalse(descStringObject.writable);
   assertEquals(descStringObject.value, a.substring(i, i+1));
diff --git a/test/mjsunit/getter-in-value-prototype.js b/test/mjsunit/getter-in-value-prototype.js
index b55320a..abe2cb1 100644
--- a/test/mjsunit/getter-in-value-prototype.js
+++ b/test/mjsunit/getter-in-value-prototype.js
@@ -31,5 +31,5 @@
 // JSObject.
 
 String.prototype.__defineGetter__('x', function() { return this; });
-assertEquals('asdf', 'asdf'.x);
+assertEquals(Object('asdf'), 'asdf'.x);
 
diff --git a/test/mjsunit/harmony/block-conflicts.js b/test/mjsunit/harmony/block-conflicts.js
index ee2d979..8388504 100644
--- a/test/mjsunit/harmony/block-conflicts.js
+++ b/test/mjsunit/harmony/block-conflicts.js
@@ -130,5 +130,5 @@
 
 // Test conflicting parameter/var bindings.
 for (var v = 0; v < varbinds.length; ++v) {
-  TestConflict('(function (x) { ' + varbinds[v] + '; })()');
+  TestNoConflict('(function (x) { ' + varbinds[v] + '; })()');
 }
diff --git a/test/mjsunit/harmony/module-parsing.js b/test/mjsunit/harmony/module-parsing.js
new file mode 100644
index 0000000..93e69e3
--- /dev/null
+++ b/test/mjsunit/harmony/module-parsing.js
@@ -0,0 +1,159 @@
+// Copyright 2012 the V8 project authors. All rights reserved.
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions are
+// met:
+//
+//     * Redistributions of source code must retain the above copyright
+//       notice, this list of conditions and the following disclaimer.
+//     * Redistributions in binary form must reproduce the above
+//       copyright notice, this list of conditions and the following
+//       disclaimer in the documentation and/or other materials provided
+//       with the distribution.
+//     * Neither the name of Google Inc. nor the names of its
+//       contributors may be used to endorse or promote products derived
+//       from this software without specific prior written permission.
+//
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+// Flags: --harmony-modules
+
+// Test basic module syntax, with and without automatic semicolon insertion.
+
+module A {}
+
+module A1 = A
+module A2 = A;
+module A3 = A2
+
+module B {
+  export vx
+  export vy, lz, c, f
+
+  var vx
+  var vx, vy;
+  var vx = 0, vy
+  let lx, ly
+  let lz = 1
+  const c = 9
+  function f() {}
+
+  module C0 {}
+
+  export module C {
+    let x
+    export module D { export let x }
+    let y
+  }
+
+  let zz = ""
+
+  export var x0
+  export var x1, x2 = 6, x3
+  export let y0
+  export let y1 = 0, y2
+  export const z0 = 0
+  export const z1 = 2, z2 = 3
+  export function f0() {}
+  export module M1 {}
+  export module M2 = C.D
+  export module M3 at "http://where"
+
+  import i0 from I
+  import i1, i2, i3, M from I
+  import i4, i5 from "http://where"
+}
+
+module I {
+  export let i0, i1, i2, i3;
+  export module M {}
+}
+
+module C1 = B.C;
+module D1 = B.C.D
+module D2 = C1.D
+module D3 = D2
+
+module E1 at "http://where"
+module E2 at "http://where";
+module E3 = E1.F
+
+// Check that ASI does not interfere.
+
+module X
+{
+let x
+}
+
+module Y
+=
+X
+
+module Z
+at
+"file://local"
+
+import
+x
+,
+y
+from
+"file://local"
+
+
+module Wrap {
+export
+x
+,
+y
+
+export
+var
+v1 = 1
+
+export
+let
+v2 = 2
+
+export
+const
+v3 = 3
+
+export
+function
+f
+(
+)
+{
+}
+
+export
+module V
+{
+}
+}
+
+export A, A1, A2, A3, B, I, C1, D1, D2, D3, E1, E2, E3, X, Y, Z, Wrap, x, y, UU
+
+
+
+// Check that 'module' still works as an identifier.
+
+var module
+module = {}
+module["a"] = 6
+function module() {}
+function f(module) { return module }
+try {} catch (module) {}
+
+module
+v = 20
diff --git a/test/mjsunit/harmony/module-resolution.js b/test/mjsunit/harmony/module-resolution.js
new file mode 100644
index 0000000..f9f492c
--- /dev/null
+++ b/test/mjsunit/harmony/module-resolution.js
@@ -0,0 +1,139 @@
+// Copyright 2012 the V8 project authors. All rights reserved.
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions are
+// met:
+//
+//     * Redistributions of source code must retain the above copyright
+//       notice, this list of conditions and the following disclaimer.
+//     * Redistributions in binary form must reproduce the above
+//       copyright notice, this list of conditions and the following
+//       disclaimer in the documentation and/or other materials provided
+//       with the distribution.
+//     * Neither the name of Google Inc. nor the names of its
+//       contributors may be used to endorse or promote products derived
+//       from this software without specific prior written permission.
+//
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+// Flags: --harmony-modules --harmony-scoping
+
+// Test basic module interface inference.
+
+"use strict";
+
+print("begin.")
+
+export let x = print("0")
+
+export module B = A.B
+
+export module A {
+  export let x = print("1")
+  export let f = function() { return B.x }
+  export module B {
+    module BB = B
+    export BB, x
+    let x = print("2")
+    let y = print("3")
+    let Ax = A.x
+    let ABx = A.B.x
+    let Ay = A.y
+    let BBx = BB.x
+    let Af = A.f
+    function f(x,y) { return x }
+  }
+  export let y = print("4")
+  let Ax = A.x
+  let Bx = B.x
+  let ABx = A.B.x
+  module C {
+    export let z = print("5")
+    export module D = B
+    // TODO(rossberg): turn these into proper negative test cases once we have
+    // suitable error messages.
+    // import C.z  // multiple declarations
+    import x from B
+  }
+  module D {
+    // TODO(rossberg): Handle import *.
+    // import A.*  // invalid forward import
+  }
+  module M {}
+  // TODO(rossberg): Handle import *.
+  // import M.*  // invalid forward import
+  let Cz = C.z
+  let CDx = C.D.x
+}
+
+export module Imports {
+  module A1 {
+    export module A2 {}
+  }
+  module B {
+    // TODO(rossberg): Handle import *.
+    // import A1.*
+    // import A2.*  // unbound variable A2
+  }
+}
+
+export module E {
+  export let xx = x
+  export y, B
+  let Bx = B.x
+  // TODO(rossberg): Handle import *.
+  // import A.*
+}
+
+export module M1 {
+  export module A2 = M2
+}
+export module M2 {
+  export module A1 = M1
+}
+
+// TODO(rossberg): turn these into proper negative test cases once we have
+// suitable error messages.
+// module W1 = W2.W
+// module W2 = { export module W = W3 }
+// module W3 = W1  // cyclic module definition
+
+// module W1 = W2.W3
+// module W2 = {
+//   export module W3 = W4
+//   export module W4 = W1
+// }  // cyclic module definition
+
+// TODO(rossberg): Handle import *.
+//module M3B = M3.B
+//export module M3 {
+//  export module B { export let x = "" }
+//  module C1 = { import M3.* }
+//  module C2 = { import M3.B.* }
+//  module C3 = { import M3B.* }
+//  module C4 = { export x import B.* }
+//// TODO(rossberg): turn these into proper negative test cases once we have
+//// suitable error messages.
+//// export module C5 = { import C5.* }  // invalid forward import
+//// export module C6 = { import M3.C6.* }  // invalid forward import
+//}
+
+export module External at "external.js"
+export module External1 = External
+export module ExternalA = External.A
+export module InnerExternal {
+  export module E at "external.js"
+}
+export module External2 = InnerExternal.E
+//export let xxx = InnerExternal.E.A.x
+
+print("end.")
diff --git a/test/mjsunit/harmony/proxies.js b/test/mjsunit/harmony/proxies.js
index 50c8613..8d8f839 100644
--- a/test/mjsunit/harmony/proxies.js
+++ b/test/mjsunit/harmony/proxies.js
@@ -2257,3 +2257,22 @@
     return function(k) { throw "myexn" }
   }
 }))
+
+
+
+// Constructor functions with proxy prototypes.
+
+function TestConstructorWithProxyPrototype() {
+  TestWithProxies(TestConstructorWithProxyPrototype2, {})
+}
+
+function TestConstructorWithProxyPrototype2(create, handler) {
+  function C() {};
+  C.prototype = create(handler);
+
+  var o = new C;
+  assertSame(C.prototype, o.__proto__);
+  assertSame(C.prototype, Object.getPrototypeOf(o));
+}
+
+TestConstructorWithProxyPrototype();
diff --git a/test/mjsunit/math-min-max.js b/test/mjsunit/math-min-max.js
index 7717b3b..e4fd313 100644
--- a/test/mjsunit/math-min-max.js
+++ b/test/mjsunit/math-min-max.js
@@ -146,6 +146,14 @@
   // Double representation.
   assertEquals(v0, Math.max(v0++, v9++));
   assertEquals(v9, Math.min(v0++, v9++));
+  // Mixed representation.
+  assertEquals(v1, Math.min(v1++, v9++));  // int32, double
+  assertEquals(v0, Math.max(v0++, v2++));  // double, int32
+  assertEquals(v1, Math.min(v1++, v6));    // int32, tagged
+  assertEquals(v2, Math.max(v5, v2++));    // tagged, int32
+  assertEquals(v6, Math.min(v6, v9++));    // tagged, double
+  assertEquals(v0, Math.max(v0++, v5));    // double, tagged
+
   // Minus zero.
   assertEquals(Infinity, 1/Math.max(v7, v8));
   assertEquals(-Infinity, 1/Math.min(v7, v8));
diff --git a/test/mjsunit/mjsunit.js b/test/mjsunit/mjsunit.js
index 6f6e323..033c78f 100644
--- a/test/mjsunit/mjsunit.js
+++ b/test/mjsunit/mjsunit.js
@@ -221,6 +221,8 @@
 
 
   assertSame = function assertSame(expected, found, name_opt) {
+    // TODO(mstarzinger): We should think about using Harmony's egal operator
+    // or the function equivalent Object.is() here.
     if (found === expected) {
       if (expected !== 0 || (1 / expected) == (1 / found)) return;
     } else if ((expected !== expected) && (found !== found)) {
diff --git a/test/mjsunit/mjsunit.status b/test/mjsunit/mjsunit.status
index a43d3ea..a1b9270 100644
--- a/test/mjsunit/mjsunit.status
+++ b/test/mjsunit/mjsunit.status
@@ -1,4 +1,4 @@
-# Copyright 2011 the V8 project authors. All rights reserved.
+# Copyright 2012 the V8 project authors. All rights reserved.
 # Redistribution and use in source and binary forms, with or without
 # modification, are permitted provided that the following conditions are
 # met:
@@ -36,9 +36,6 @@
 
 ##############################################################################
 
-# Issue 1845: http://code.google.com/p/v8/issues/detail?id=1845
-harmony/proxies-example-membrane: SKIP
-
 # NewGC: BUG(1719) slow to collect arrays over several contexts.
 regress/regress-524: SKIP
 
@@ -68,6 +65,16 @@
 debug-liveedit-check-stack: SKIP
 debug-liveedit-patch-positions-replace: SKIP
 
+# Test Crankshaft compilation time.  Expected to take too long in debug mode.
+regress/regress-1969: PASS, SKIP if $mode == debug
+
+##############################################################################
+[ $isolates ]
+
+# This test sets the umask on a per-process basis and hence cannot be
+# used in multi-threaded runs.
+d8-os: SKIP
+
 ##############################################################################
 [ $arch == arm ]
 
diff --git a/test/mjsunit/number-is.js b/test/mjsunit/number-is.js
new file mode 100644
index 0000000..1589fc6
--- /dev/null
+++ b/test/mjsunit/number-is.js
@@ -0,0 +1,58 @@
+// Copyright 2012 the V8 project authors. All rights reserved.
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions are
+// met:
+//
+//     * Redistributions of source code must retain the above copyright
+//       notice, this list of conditions and the following disclaimer.
+//     * Redistributions in binary form must reproduce the above
+//       copyright notice, this list of conditions and the following
+//       disclaimer in the documentation and/or other materials provided
+//       with the distribution.
+//     * Neither the name of Google Inc. nor the names of its
+//       contributors may be used to endorse or promote products derived
+//       from this software without specific prior written permission.
+//
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+// Test Harmony Number.isFinite() and Number.isNaN() functions.
+
+assertTrue(Number.isFinite(0));
+assertTrue(Number.isFinite(Number.MIN_VALUE));
+assertTrue(Number.isFinite(Number.MAX_VALUE));
+assertFalse(Number.isFinite(Number.NaN));
+assertFalse(Number.isFinite(Number.POSITIVE_INFINITY));
+assertFalse(Number.isFinite(Number.NEGATIVE_INFINITY));
+assertFalse(Number.isFinite(new Number(0)));
+assertFalse(Number.isFinite(1/0));
+assertFalse(Number.isFinite(-1/0));
+assertFalse(Number.isFinite({}));
+assertFalse(Number.isFinite([]));
+assertFalse(Number.isFinite("s"));
+assertFalse(Number.isFinite(null));
+assertFalse(Number.isFinite(undefined));
+
+assertFalse(Number.isNaN(0));
+assertFalse(Number.isNaN(Number.MIN_VALUE));
+assertFalse(Number.isNaN(Number.MAX_VALUE));
+assertTrue(Number.isNaN(Number.NaN));
+assertFalse(Number.isNaN(Number.POSITIVE_INFINITY));
+assertFalse(Number.isNaN(Number.NEGATIVE_INFINITY));
+assertFalse(Number.isNaN(new Number(0)));
+assertFalse(Number.isNaN(1/0));
+assertFalse(Number.isNaN(-1/0));
+assertFalse(Number.isNaN({}));
+assertFalse(Number.isNaN([]));
+assertFalse(Number.isNaN("s"));
+assertFalse(Number.isNaN(null));
+assertFalse(Number.isNaN(undefined));
diff --git a/test/mjsunit/object-define-property.js b/test/mjsunit/object-define-property.js
index ee6083a..fdaf82d 100644
--- a/test/mjsunit/object-define-property.js
+++ b/test/mjsunit/object-define-property.js
@@ -1,4 +1,4 @@
-// Copyright 2010 the V8 project authors. All rights reserved.
+// Copyright 2012 the V8 project authors. All rights reserved.
 // Redistribution and use in source and binary forms, with or without
 // modification, are permitted provided that the following conditions are
 // met:
@@ -503,7 +503,7 @@
 // Defining properties null should fail even when we have
 // other allowed values
 try {
-  %DefineOrRedefineAccessorProperty(null, 'foo', 0, func, 0);
+  %DefineOrRedefineAccessorProperty(null, 'foo', func, null, 0);
 } catch (e) {
   assertTrue(/illegal access/.test(e));
 }
@@ -1053,4 +1053,35 @@
   // Non-enumerable property forces dictionary mode.
   Object.defineProperty(o, i, {value: i, enumerable: false});
 }
-assertEquals(999, o[999]);
\ No newline at end of file
+assertEquals(999, o[999]);
+
+
+// Regression test: Bizzare behavior on non-strict arguments object.
+(function test(arg0) {
+  // Here arguments[0] is a fast alias on arg0.
+  Object.defineProperty(arguments, "0", {
+    value:1,
+    enumerable:false
+  });
+  // Here arguments[0] is a slow alias on arg0.
+  Object.defineProperty(arguments, "0", {
+    value:2,
+    writable:false
+  });
+  // Here arguments[0] is no alias at all.
+  Object.defineProperty(arguments, "0", {
+    value:3
+  });
+  assertEquals(2, arg0);
+  assertEquals(3, arguments[0]);
+})(0);
+
+
+// Regression test: We should never observe the hole value.
+var objectWithGetter = {};
+objectWithGetter.__defineGetter__('foo', function() {});
+assertEquals(undefined, objectWithGetter.__lookupSetter__('foo'));
+
+var objectWithSetter = {};
+objectWithSetter.__defineSetter__('foo', function(x) {});
+assertEquals(undefined, objectWithSetter.__lookupGetter__('foo'));
diff --git a/test/mjsunit/object-is.js b/test/mjsunit/object-is.js
new file mode 100644
index 0000000..b9fdc84
--- /dev/null
+++ b/test/mjsunit/object-is.js
@@ -0,0 +1,47 @@
+// Copyright 2012 the V8 project authors. All rights reserved.
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions are
+// met:
+//
+//     * Redistributions of source code must retain the above copyright
+//       notice, this list of conditions and the following disclaimer.
+//     * Redistributions in binary form must reproduce the above
+//       copyright notice, this list of conditions and the following
+//       disclaimer in the documentation and/or other materials provided
+//       with the distribution.
+//     * Neither the name of Google Inc. nor the names of its
+//       contributors may be used to endorse or promote products derived
+//       from this software without specific prior written permission.
+//
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+// Test both the Harmony egal operator and it's function equivalent.
+
+function TestEgal(expected, x, y) {
+  // TODO(mstarzinger): Once we have the egal operator, we can test it here.
+  assertSame(expected, Object.is(x, y));
+}
+
+var test_set = [ {}, [], 1/0, -1/0, "s", 0, 0/-1, null, undefined ];
+print(test_set);
+for (var i = 0; i < test_set.length; i++) {
+  for (var j = 0; j < test_set.length; j++) {
+    if (i == j) {
+      assertSame(test_set[i], test_set[j]);
+      TestEgal(true, test_set[i], test_set[j]);
+    } else {
+      TestEgal(false, test_set[i], test_set[j]);
+      TestEgal(false, test_set[j], test_set[i]);
+    }
+  }
+}
diff --git a/test/mjsunit/object-prevent-extensions.js b/test/mjsunit/object-prevent-extensions.js
index 322a2cb..6b9184d 100644
--- a/test/mjsunit/object-prevent-extensions.js
+++ b/test/mjsunit/object-prevent-extensions.js
@@ -114,3 +114,15 @@
 
 foo.x = 29;
 assertEquals(undefined, foo.x);
+
+// when Object.isExtensible(o) === false
+// assignment should return right hand side value
+var o = Object.preventExtensions({});
+var v = o.v = 50;
+assertEquals(undefined, o.v);
+assertEquals(50, v);
+
+// test same behavior as above, but for integer properties
+var n = o[0] = 100;
+assertEquals(undefined, o[0]);
+assertEquals(100, n);
diff --git a/test/mjsunit/pixel-array-rounding.js b/test/mjsunit/pixel-array-rounding.js
new file mode 100644
index 0000000..ef5a10b
--- /dev/null
+++ b/test/mjsunit/pixel-array-rounding.js
@@ -0,0 +1,44 @@
+// Copyright 2012 the V8 project authors. All rights reserved.
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions are
+// met:
+//
+//     * Redistributions of source code must retain the above copyright
+//       notice, this list of conditions and the following disclaimer.
+//     * Redistributions in binary form must reproduce the above
+//       copyright notice, this list of conditions and the following
+//       disclaimer in the documentation and/or other materials provided
+//       with the distribution.
+//     * Neither the name of Google Inc. nor the names of its
+//       contributors may be used to endorse or promote products derived
+//       from this software without specific prior written permission.
+//
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+// Flags: --allow-natives-syntax
+
+var pixels = new PixelArray(8);
+
+function f() {
+  for (var i = 0; i < 8; i++) {
+    pixels[i] = (i * 1.1);
+  }
+  return pixels[1] + pixels[6];
+}
+
+f();
+f();
+assertEquals(6, pixels[5]);
+%OptimizeFunctionOnNextCall(f);
+f();
+assertEquals(6, pixels[5]);
diff --git a/test/mjsunit/regexp.js b/test/mjsunit/regexp.js
index 3c4f883..ec82c96 100644
--- a/test/mjsunit/regexp.js
+++ b/test/mjsunit/regexp.js
@@ -1,4 +1,4 @@
-// Copyright 2008 the V8 project authors. All rights reserved.
+// Copyright 2012 the V8 project authors. All rights reserved.
 // Redistribution and use in source and binary forms, with or without
 // modification, are permitted provided that the following conditions are
 // met:
@@ -127,6 +127,17 @@
 
 assertTrue(/^[Z-\c-e]*$/.test("Z[\\cde"));
 
+// Test that we handle \s and \S correctly on special Unicode characters.
+re = /\s/;
+assertTrue(re.test("\u2028"));
+assertTrue(re.test("\u2029"));
+assertTrue(re.test("\uFEFF"));
+
+re = /\S/;
+assertFalse(re.test("\u2028"));
+assertFalse(re.test("\u2029"));
+assertFalse(re.test("\uFEFF"));
+
 // Test that we handle \s and \S correctly inside some bizarre
 // character classes.
 re = /[\s-:]/;
@@ -690,3 +701,7 @@
 assertThrows("RegExp('(?:*)')");
 assertThrows("RegExp('(?=*)')");
 assertThrows("RegExp('(?!*)')");
+
+// Test trimmed regular expression for RegExp.test().
+assertTrue(/.*abc/.test("abc"));
+assertFalse(/.*\d+/.test("q"));
diff --git a/test/mjsunit/regress/regress-102153.js b/test/mjsunit/regress/regress-102153.js
new file mode 100644
index 0000000..0f67656
--- /dev/null
+++ b/test/mjsunit/regress/regress-102153.js
@@ -0,0 +1,57 @@
+// Copyright 2012 the V8 project authors. All rights reserved.
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions are
+// met:
+//
+//     * Redistributions of source code must retain the above copyright
+//       notice, this list of conditions and the following disclaimer.
+//     * Redistributions in binary form must reproduce the above
+//       copyright notice, this list of conditions and the following
+//       disclaimer in the documentation and/or other materials provided
+//       with the distribution.
+//     * Neither the name of Google Inc. nor the names of its
+//       contributors may be used to endorse or promote products derived
+//       from this software without specific prior written permission.
+//
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+// Flags: --expose-debug-as debug
+
+// Test that the break point is set before initializing the loop variable
+// so that we break before any iteration has been run.
+
+Debug = debug.Debug;
+
+var break_hit = false;
+
+function listener(event, exec_state, event_data, data) {
+  if (event == Debug.DebugEvent.Break) {
+    break_hit = true;
+  }
+}
+
+Debug.setListener(listener);
+
+function test() {
+  for (var i = 0; i < 3; i++) {  // Break here.
+    if (i == 0) break;
+  }
+}
+
+Debug.setBreakPoint(test, 1, 0);
+
+assertTrue(Debug.showBreakPoints(test).indexOf("// Break here.") >= 0);
+
+test();
+
+assertTrue(break_hit);
diff --git a/test/mjsunit/regress/regress-113924.js b/test/mjsunit/regress/regress-113924.js
new file mode 100644
index 0000000..3ecdec4
--- /dev/null
+++ b/test/mjsunit/regress/regress-113924.js
@@ -0,0 +1,31 @@
+// Copyright 2012 the V8 project authors. All rights reserved.
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions are
+// met:
+//
+//     * Redistributions of source code must retain the above copyright
+//       notice, this list of conditions and the following disclaimer.
+//     * Redistributions in binary form must reproduce the above
+//       copyright notice, this list of conditions and the following
+//       disclaimer in the documentation and/or other materials provided
+//       with the distribution.
+//     * Neither the name of Google Inc. nor the names of its
+//       contributors may be used to endorse or promote products derived
+//       from this software without specific prior written permission.
+//
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+var count=12000;
+while(count--) {
+  eval("var a = new Object(10); a[2] += 7;");
+}
diff --git a/test/mjsunit/regress/regress-115452.js b/test/mjsunit/regress/regress-115452.js
new file mode 100644
index 0000000..7e424ed
--- /dev/null
+++ b/test/mjsunit/regress/regress-115452.js
@@ -0,0 +1,48 @@
+// Copyright 2012 the V8 project authors. All rights reserved.
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions are
+// met:
+//
+//     * Redistributions of source code must retain the above copyright
+//       notice, this list of conditions and the following disclaimer.
+//     * Redistributions in binary form must reproduce the above
+//       copyright notice, this list of conditions and the following
+//       disclaimer in the documentation and/or other materials provided
+//       with the distribution.
+//     * Neither the name of Google Inc. nor the names of its
+//       contributors may be used to endorse or promote products derived
+//       from this software without specific prior written permission.
+//
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+// Test that a function declaration cannot overwrite a read-only property.
+
+print(0)
+function foobl() {}
+assertTrue(typeof this.foobl == "function");
+assertTrue(Object.getOwnPropertyDescriptor(this, "foobl").writable);
+
+print(1)
+Object.defineProperty(this, "foobl", {value: 1, writable: false});
+assertSame(1, this.foobl);
+assertFalse(Object.getOwnPropertyDescriptor(this, "foobl").writable);
+
+print(2)
+eval("function foobl() {}");
+assertSame(1, this.foobl);
+assertFalse(Object.getOwnPropertyDescriptor(this, "foobl").writable);
+
+print(3)
+eval("function foobl() {}");
+assertSame(1, this.foobl);
+assertFalse(Object.getOwnPropertyDescriptor(this, "foobl").writable);
diff --git a/test/mjsunit/regress/regress-117794.js b/test/mjsunit/regress/regress-117794.js
new file mode 100644
index 0000000..5e11b40
--- /dev/null
+++ b/test/mjsunit/regress/regress-117794.js
@@ -0,0 +1,57 @@
+// Copyright 2012 the V8 project authors. All rights reserved.
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions are
+// met:
+//
+//     * Redistributions of source code must retain the above copyright
+//       notice, this list of conditions and the following disclaimer.
+//     * Redistributions in binary form must reproduce the above
+//       copyright notice, this list of conditions and the following
+//       disclaimer in the documentation and/or other materials provided
+//       with the distribution.
+//     * Neither the name of Google Inc. nor the names of its
+//       contributors may be used to endorse or promote products derived
+//       from this software without specific prior written permission.
+//
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+// Loads specialized to be from the global object should not omit the
+// smi check on the receiver.  The code below should not crash.
+
+print = function() {}
+
+function constructor() {};
+
+function assertHasOwnProperties(object, limit) {
+  for (var i = 0; i < limit; i++) {  }
+}
+
+try {
+  Object.keys();
+} catch(exc2) {
+  print(exc2.stack);
+}
+
+var x1 = new Object();
+
+try {
+  new Function("A Man Called Horse", x1.d);
+} catch(exc3) {
+  print(exc3.stack);
+}
+
+try {
+  (-(true)).toPrecision(0x30, 'lib1-f1');
+} catch(exc1) {
+  print(exc1.stack);
+}
diff --git a/test/mjsunit/regress/regress-119429.js b/test/mjsunit/regress/regress-119429.js
new file mode 100644
index 0000000..a876487
--- /dev/null
+++ b/test/mjsunit/regress/regress-119429.js
@@ -0,0 +1,37 @@
+// Copyright 2012 the V8 project authors. All rights reserved.
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions are
+// met:
+//
+//     * Redistributions of source code must retain the above copyright
+//       notice, this list of conditions and the following disclaimer.
+//     * Redistributions in binary form must reproduce the above
+//       copyright notice, this list of conditions and the following
+//       disclaimer in the documentation and/or other materials provided
+//       with the distribution.
+//     * Neither the name of Google Inc. nor the names of its
+//       contributors may be used to endorse or promote products derived
+//       from this software without specific prior written permission.
+//
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+// Flags: --allow-natives-syntax
+
+var d = 0;
+function recurse() {
+  if (++d == 25135) { // A magic number just below stack overflow  on ia32
+    %DebugBreak();
+  }
+  recurse();
+}
+assertThrows(function() { recurse();} );
diff --git a/test/mjsunit/regress/regress-119925.js b/test/mjsunit/regress/regress-119925.js
new file mode 100644
index 0000000..6712754
--- /dev/null
+++ b/test/mjsunit/regress/regress-119925.js
@@ -0,0 +1,34 @@
+// Copyright 2012 the V8 project authors. All rights reserved.
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions are
+// met:
+//
+//     * Redistributions of source code must retain the above copyright
+//       notice, this list of conditions and the following disclaimer.
+//     * Redistributions in binary form must reproduce the above
+//       copyright notice, this list of conditions and the following
+//       disclaimer in the documentation and/or other materials provided
+//       with the distribution.
+//     * Neither the name of Google Inc. nor the names of its
+//       contributors may be used to endorse or promote products derived
+//       from this software without specific prior written permission.
+//
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+// Test that the throw is not inlined if object literals cannot be
+// inlined.
+Array.prototype.__proto__ = { 77e4  : null };
+function continueWithinLoop() {
+    for (var key in [(1.2)]) {  }
+};
+continueWithinLoop();
diff --git a/test/mjsunit/regress/regress-1229.js b/test/mjsunit/regress/regress-1229.js
index f3979de..5447f3f 100644
--- a/test/mjsunit/regress/regress-1229.js
+++ b/test/mjsunit/regress/regress-1229.js
@@ -132,13 +132,15 @@
 
 function bar(x, y, z) {
   var non_construct = baz(0); /* baz should be inlined */
-  assertEquals(non_construct, NON_CONSTRUCT_MARKER);
+  assertSame(non_construct, NON_CONSTRUCT_MARKER);
   var non_construct = baz(); /* baz should be inlined */
-  assertEquals(non_construct, NON_CONSTRUCT_MARKER);
+  assertSame(non_construct, NON_CONSTRUCT_MARKER);
   var non_construct = baz(0, 0); /* baz should be inlined */
-  assertEquals(non_construct, NON_CONSTRUCT_MARKER);
+  assertSame(non_construct, NON_CONSTRUCT_MARKER);
   var construct = new baz(0);
-  assertEquals(construct, CONSTRUCT_MARKER);
+  assertSame(construct, CONSTRUCT_MARKER);
+  var construct = new baz(0, 0);
+  assertSame(construct, CONSTRUCT_MARKER);
 }
 
 invoke(bar, [1, 2, 3]);
diff --git a/test/mjsunit/regress/regress-1624-strict.js b/test/mjsunit/regress/regress-1624-strict.js
new file mode 100644
index 0000000..8bc58d5
--- /dev/null
+++ b/test/mjsunit/regress/regress-1624-strict.js
@@ -0,0 +1,140 @@
+// Copyright 2012 the V8 project authors. All rights reserved.
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions are
+// met:
+//
+//     * Redistributions of source code must retain the above copyright
+//       notice, this list of conditions and the following disclaimer.
+//     * Redistributions in binary form must reproduce the above
+//       copyright notice, this list of conditions and the following
+//       disclaimer in the documentation and/or other materials provided
+//       with the distribution.
+//     * Neither the name of Google Inc. nor the names of its
+//       contributors may be used to endorse or promote products derived
+//       from this software without specific prior written permission.
+//
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+// Test that global eval calls of strict code (independent from whether being
+// direct or indirect) have their own lexical and variable environment.
+
+"use strict";
+var evil = eval;
+
+// Test global direct strict eval in strict script.
+// Expects new environment.
+var no_touch = 0;
+eval('"use strict"; var no_touch = 1;');
+assertSame(0, no_touch);
+
+// Test global indirect strict eval in strict script.
+// Expects new environment.
+var no_touch = 0;
+evil('"use strict"; var no_touch = 2;');
+assertSame(0, no_touch);
+
+// Test global direct non-strict eval in strict script.
+// Expects new environment.
+var no_touch = 0;
+eval('var no_touch = 3;');
+assertSame(0, no_touch);
+
+// Test global indirect non-strict eval in strict script.
+// Expects global environment.
+var no_touch = 0;
+evil('var no_touch = 4;');
+assertSame(4, no_touch);
+
+// Test non-global direct strict eval in strict script.
+// Expects new environment.
+var no_touch = 0;
+(function() {
+  var no_touch = 0;
+  eval('"use strict"; var no_touch = 5;');
+  assertSame(0, no_touch);
+})()
+assertSame(0, no_touch);
+
+// Test non-global indirect strict eval in strict script.
+// Expects new environment.
+var no_touch = 0;
+(function() {
+  var no_touch = 0;
+  evil('"use strict"; var no_touch = 6;');
+  assertSame(0, no_touch);
+})()
+assertSame(0, no_touch);
+
+// Test non-global direct non-strict eval in strict script.
+// Expects new environment.
+var no_touch = 0;
+(function() {
+  var no_touch = 0;
+  eval('var no_touch = 7;');
+  assertSame(0, no_touch);
+})()
+assertSame(0, no_touch);
+
+// Test non-global indirect non-strict eval in strict script.
+// Expects global environment.
+var no_touch = 0;
+(function() {
+  var no_touch = 0;
+  evil('var no_touch = 8;');
+  assertSame(0, no_touch);
+})()
+assertSame(8, no_touch);
+
+// Test non-global direct strict eval in strict script.
+// Expects new environment.
+var no_touch = 0;
+(function() {
+  "use strict";
+  var no_touch = 0;
+  eval('"use strict"; var no_touch = 9;');
+  assertSame(0, no_touch);
+})()
+assertSame(0, no_touch);
+
+// Test non-global indirect strict eval in strict script.
+// Expects new environment.
+var no_touch = 0;
+(function() {
+  "use strict";
+  var no_touch = 0;
+  evil('"use strict"; var no_touch = 10;');
+  assertSame(0, no_touch);
+})()
+assertSame(0, no_touch);
+
+// Test non-global direct non-strict eval in strict script.
+// Expects new environment.
+var no_touch = 0;
+(function() {
+  "use strict";
+  var no_touch = 0;
+  eval('var no_touch = 11;');
+  assertSame(0, no_touch);
+})()
+assertSame(0, no_touch);
+
+// Test non-global indirect non-strict eval in strict script.
+// Expects global environment.
+var no_touch = 0;
+(function() {
+  "use strict";
+  var no_touch = 0;
+  evil('var no_touch = 12;');
+  assertSame(0, no_touch);
+})()
+assertSame(12, no_touch);
diff --git a/test/mjsunit/regress/regress-1624.js b/test/mjsunit/regress/regress-1624.js
new file mode 100644
index 0000000..987e036
--- /dev/null
+++ b/test/mjsunit/regress/regress-1624.js
@@ -0,0 +1,139 @@
+// Copyright 2012 the V8 project authors. All rights reserved.
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions are
+// met:
+//
+//     * Redistributions of source code must retain the above copyright
+//       notice, this list of conditions and the following disclaimer.
+//     * Redistributions in binary form must reproduce the above
+//       copyright notice, this list of conditions and the following
+//       disclaimer in the documentation and/or other materials provided
+//       with the distribution.
+//     * Neither the name of Google Inc. nor the names of its
+//       contributors may be used to endorse or promote products derived
+//       from this software without specific prior written permission.
+//
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+// Test that global eval calls of strict code (independent from whether being
+// direct or indirect) have their own lexical and variable environment.
+
+var evil = eval;
+
+// Test global direct strict eval.
+// Expects new environment.
+var no_touch = 0;
+eval('"use strict"; var no_touch = 1;');
+assertSame(0, no_touch);
+
+// Test global indirect strict eval.
+// Expects new environment.
+var no_touch = 0;
+evil('"use strict"; var no_touch = 2;');
+assertSame(0, no_touch);
+
+// Test global direct non-strict eval.
+// Expects global environment.
+var no_touch = 0;
+eval('var no_touch = 3;');
+assertSame(3, no_touch);
+
+// Test global indirect non-strict eval.
+// Expects global environment.
+var no_touch = 0;
+evil('var no_touch = 4;');
+assertSame(4, no_touch);
+
+// Test non-global direct strict eval in non-strict function.
+// Expects new environment.
+var no_touch = 0;
+(function() {
+  var no_touch = 0;
+  eval('"use strict"; var no_touch = 5;');
+  assertSame(0, no_touch);
+})()
+assertSame(0, no_touch);
+
+// Test non-global indirect strict eval in non-strict function.
+// Expects new environment.
+var no_touch = 0;
+(function() {
+  var no_touch = 0;
+  evil('"use strict"; var no_touch = 6;');
+  assertSame(0, no_touch);
+})()
+assertSame(0, no_touch);
+
+// Test non-global direct non-strict eval in non-strict function.
+// Expects function environment.
+var no_touch = 0;
+(function() {
+  var no_touch = 0;
+  eval('var no_touch = 7;');
+  assertSame(7, no_touch);
+})()
+assertSame(0, no_touch);
+
+// Test non-global indirect non-strict eval in non-strict function.
+// Expects global environment.
+var no_touch = 0;
+(function() {
+  var no_touch = 0;
+  evil('var no_touch = 8;');
+  assertSame(0, no_touch);
+})()
+assertSame(8, no_touch);
+
+// Test non-global direct strict eval in strict function.
+// Expects new environment.
+var no_touch = 0;
+(function() {
+  "use strict";
+  var no_touch = 0;
+  eval('"use strict"; var no_touch = 9;');
+  assertSame(0, no_touch);
+})()
+assertSame(0, no_touch);
+
+// Test non-global indirect strict eval in strict function.
+// Expects new environment.
+var no_touch = 0;
+(function() {
+  "use strict";
+  var no_touch = 0;
+  evil('"use strict"; var no_touch = 10;');
+  assertSame(0, no_touch);
+})()
+assertSame(0, no_touch);
+
+// Test non-global direct non-strict eval in strict function.
+// Expects new environment.
+var no_touch = 0;
+(function() {
+  "use strict";
+  var no_touch = 0;
+  eval('var no_touch = 11;');
+  assertSame(0, no_touch);
+})()
+assertSame(0, no_touch);
+
+// Test non-global indirect non-strict eval in strict function.
+// Expects global environment.
+var no_touch = 0;
+(function() {
+  "use strict";
+  var no_touch = 0;
+  evil('var no_touch = 12;');
+  assertSame(0, no_touch);
+})()
+assertSame(12, no_touch);
diff --git a/test/mjsunit/regress/regress-1790.js b/test/mjsunit/regress/regress-1790.js
new file mode 100644
index 0000000..8848eea
--- /dev/null
+++ b/test/mjsunit/regress/regress-1790.js
@@ -0,0 +1,58 @@
+// Copyright 2012 the V8 project authors. All rights reserved.
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions are
+// met:
+//
+//     * Redistributions of source code must retain the above copyright
+//       notice, this list of conditions and the following disclaimer.
+//     * Redistributions in binary form must reproduce the above
+//       copyright notice, this list of conditions and the following
+//       disclaimer in the documentation and/or other materials provided
+//       with the distribution.
+//     * Neither the name of Google Inc. nor the names of its
+//       contributors may be used to endorse or promote products derived
+//       from this software without specific prior written permission.
+//
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+// Regression test checking that the sequence of element access in built-in
+// array functions is specification conform (i.e. [[HasProperty]] might return
+// bogus result after [[Get]] has been called).
+
+function CheckSequence(builtin, callback) {
+  var array = [1,2,3];
+  var callback_count = 0;
+  var callback_wrapper = function() {
+    callback_count++;
+    return callback()
+  }
+
+  // Define getter that will delete itself upon first invocation.
+  Object.defineProperty(array, '1', {
+    get: function () { delete array[1]; },
+    configurable: true
+  });
+
+  assertTrue(array.hasOwnProperty('1'));
+  builtin.apply(array, [callback_wrapper, 'argument']);
+  assertFalse(array.hasOwnProperty('1'));
+  assertEquals(3, callback_count);
+}
+
+CheckSequence(Array.prototype.every,       function() { return true; });
+CheckSequence(Array.prototype.filter,      function() { return true; });
+CheckSequence(Array.prototype.forEach,     function() { return 0; });
+CheckSequence(Array.prototype.map,         function() { return 0; });
+CheckSequence(Array.prototype.reduce,      function() { return 0; });
+CheckSequence(Array.prototype.reduceRight, function() { return 0; });
+CheckSequence(Array.prototype.some,        function() { return false; });
diff --git a/test/mjsunit/regress/regress-1853.js b/test/mjsunit/regress/regress-1853.js
new file mode 100644
index 0000000..f80bade
--- /dev/null
+++ b/test/mjsunit/regress/regress-1853.js
@@ -0,0 +1,116 @@
+// Copyright 2012 the V8 project authors. All rights reserved.
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions are
+// met:
+//
+//     * Redistributions of source code must retain the above copyright
+//       notice, this list of conditions and the following disclaimer.
+//     * Redistributions in binary form must reproduce the above
+//       copyright notice, this list of conditions and the following
+//       disclaimer in the documentation and/or other materials provided
+//       with the distribution.
+//     * Neither the name of Google Inc. nor the names of its
+//       contributors may be used to endorse or promote products derived
+//       from this software without specific prior written permission.
+//
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+// Flags: --expose-debug-as debug
+
+// Test whether scripts compiled after setting the break point are
+// updated correctly.
+
+Debug = debug.Debug;
+
+var break_count = 0;
+var test_break_1 = false;
+var test_break_2 = false;
+
+function sendCommand(state, cmd) {
+  // Get the debug command processor in paused state.
+  var dcp = state.debugCommandProcessor(false);
+  var request = JSON.stringify(cmd);
+  var response = dcp.processDebugJSONRequest(request);
+  return JSON.parse(response);
+}
+
+function setBreakPointByName(state) {
+  sendCommand(state, {
+    seq: 0,
+    type: "request",
+    command: "setbreakpoint",
+    arguments: {
+      type: "script",
+      target: "testScriptOne",
+      line: 2
+    }
+  });
+}
+
+function setBreakPointByRegExp(state) {
+  sendCommand(state, {
+    seq: 0,
+    type: "request",
+    command: "setbreakpoint",
+    arguments: {
+      type: "scriptRegExp",
+      target: "Scrip.Two",
+      line: 2
+    }
+  });
+}
+
+function listener(event, exec_state, event_data, data) {
+  try {
+    if (event == Debug.DebugEvent.Break) {
+      switch (break_count) {
+        case 0:
+          // Set break points before the code has been compiled.
+          setBreakPointByName(exec_state);
+          setBreakPointByRegExp(exec_state);
+          break;
+        case 1:
+          // Set the flag to prove that we hit the first break point.
+          test_break_1 = true;
+          break;
+        case 2:
+          // Set the flag to prove that we hit the second break point.
+          test_break_2 = true;
+          break;
+      }
+      break_count++;
+    }
+  } catch (e) {
+    print(e);
+  }
+}
+
+Debug.setListener(listener);
+debugger;
+
+eval('function test1() {                \n' +
+     '  assertFalse(test_break_1);      \n' +
+     '  assertTrue(test_break_1);       \n' +
+     '}                                 \n' +
+     '//@ sourceURL=testScriptOne');
+
+eval('function test2() {                \n' +
+     '  assertFalse(test_break_2);      \n' +
+     '  assertTrue(test_break_2);       \n' +
+     '}                                 \n' +
+     '//@ sourceURL=testScriptTwo');
+
+test1();
+test2();
+assertEquals(3, break_count);
+
diff --git a/test/mjsunit/regress/regress-1878.js b/test/mjsunit/regress/regress-1878.js
index 1b3c63a..a1648b1 100644
--- a/test/mjsunit/regress/regress-1878.js
+++ b/test/mjsunit/regress/regress-1878.js
@@ -1,4 +1,4 @@
-// Copyright 2009 the V8 project authors. All rights reserved.
+// Copyright 2012 the V8 project authors. All rights reserved.
 // Redistribution and use in source and binary forms, with or without
 // modification, are permitted provided that the following conditions are
 // met:
@@ -30,5 +30,15 @@
 // Flags: --allow-natives-syntax --expose_natives_as=natives
 
 var a = Array();
-var ai = natives.InternalArray();
-assertFalse(%HaveSameMap(ai, a));
+
+for (var i = 0; i < 1000; i++) {
+  var ai = natives.InternalArray(10000);
+  assertFalse(%HaveSameMap(ai, a));
+  assertTrue(%HasFastElements(ai));
+}
+
+for (var i = 0; i < 1000; i++) {
+  var ai = new natives.InternalArray(10000);
+  assertFalse(%HaveSameMap(ai, a));
+  assertTrue(%HasFastElements(ai));
+}
diff --git a/test/mjsunit/regress/regress-1924.js b/test/mjsunit/regress/regress-1924.js
new file mode 100644
index 0000000..8039541
--- /dev/null
+++ b/test/mjsunit/regress/regress-1924.js
@@ -0,0 +1,42 @@
+// Copyright 2012 the V8 project authors. All rights reserved.
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions are
+// met:
+//
+//     * Redistributions of source code must retain the above copyright
+//       notice, this list of conditions and the following disclaimer.
+//     * Redistributions in binary form must reproduce the above
+//       copyright notice, this list of conditions and the following
+//       disclaimer in the documentation and/or other materials provided
+//       with the distribution.
+//     * Neither the name of Google Inc. nor the names of its
+//       contributors may be used to endorse or promote products derived
+//       from this software without specific prior written permission.
+//
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+// For http://code.google.com/p/v8/issues/detail?id=1924
+
+a: break a;
+a: b: break a;
+a: b: break b;
+assertThrows("a: break a a", SyntaxError)
+assertThrows("a: break a 1", SyntaxError)
+assertThrows("a: break a ''", SyntaxError)
+assertThrows("a: break a var b", SyntaxError)
+assertThrows("a: break a {}", SyntaxError)
+
+a: if (0) break a;
+b: if (0) {break b;} else {}
+c: if (0) break c; else {}
+d: if (0) break d; else break d;
diff --git a/test/mjsunit/regress/regress-1969.js b/test/mjsunit/regress/regress-1969.js
new file mode 100644
index 0000000..2728c2c
--- /dev/null
+++ b/test/mjsunit/regress/regress-1969.js
@@ -0,0 +1,5045 @@
+// Copyright 2012 the V8 project authors. All rights reserved.
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions are
+// met:
+//
+//     * Redistributions of source code must retain the above copyright
+//       notice, this list of conditions and the following disclaimer.
+//     * Redistributions in binary form must reproduce the above
+//       copyright notice, this list of conditions and the following
+//       disclaimer in the documentation and/or other materials provided
+//       with the distribution.
+//     * Neither the name of Google Inc. nor the names of its
+//       contributors may be used to endorse or promote products derived
+//       from this software without specific prior written permission.
+//
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+// Flags: --allow-natives-syntax
+
+f();
+f();
+%OptimizeFunctionOnNextCall(f);
+var start = (new Date()).getTime();
+var array = f();
+var end = (new Date()).getTime();
+
+// Assert that recompiling and executing f() takes less than a second.
+assertTrue((end - start) < 1000);
+
+for (var i = 0; i < 5000; i++) assertEquals(0, array[i]);
+
+function f() {
+  var a = new Array(5000);
+  a[0]=0;
+  a[1]=0;
+  a[2]=0;
+  a[3]=0;
+  a[4]=0;
+  a[5]=0;
+  a[6]=0;
+  a[7]=0;
+  a[8]=0;
+  a[9]=0;
+  a[10]=0;
+  a[11]=0;
+  a[12]=0;
+  a[13]=0;
+  a[14]=0;
+  a[15]=0;
+  a[16]=0;
+  a[17]=0;
+  a[18]=0;
+  a[19]=0;
+  a[20]=0;
+  a[21]=0;
+  a[22]=0;
+  a[23]=0;
+  a[24]=0;
+  a[25]=0;
+  a[26]=0;
+  a[27]=0;
+  a[28]=0;
+  a[29]=0;
+  a[30]=0;
+  a[31]=0;
+  a[32]=0;
+  a[33]=0;
+  a[34]=0;
+  a[35]=0;
+  a[36]=0;
+  a[37]=0;
+  a[38]=0;
+  a[39]=0;
+  a[40]=0;
+  a[41]=0;
+  a[42]=0;
+  a[43]=0;
+  a[44]=0;
+  a[45]=0;
+  a[46]=0;
+  a[47]=0;
+  a[48]=0;
+  a[49]=0;
+  a[50]=0;
+  a[51]=0;
+  a[52]=0;
+  a[53]=0;
+  a[54]=0;
+  a[55]=0;
+  a[56]=0;
+  a[57]=0;
+  a[58]=0;
+  a[59]=0;
+  a[60]=0;
+  a[61]=0;
+  a[62]=0;
+  a[63]=0;
+  a[64]=0;
+  a[65]=0;
+  a[66]=0;
+  a[67]=0;
+  a[68]=0;
+  a[69]=0;
+  a[70]=0;
+  a[71]=0;
+  a[72]=0;
+  a[73]=0;
+  a[74]=0;
+  a[75]=0;
+  a[76]=0;
+  a[77]=0;
+  a[78]=0;
+  a[79]=0;
+  a[80]=0;
+  a[81]=0;
+  a[82]=0;
+  a[83]=0;
+  a[84]=0;
+  a[85]=0;
+  a[86]=0;
+  a[87]=0;
+  a[88]=0;
+  a[89]=0;
+  a[90]=0;
+  a[91]=0;
+  a[92]=0;
+  a[93]=0;
+  a[94]=0;
+  a[95]=0;
+  a[96]=0;
+  a[97]=0;
+  a[98]=0;
+  a[99]=0;
+  a[100]=0;
+  a[101]=0;
+  a[102]=0;
+  a[103]=0;
+  a[104]=0;
+  a[105]=0;
+  a[106]=0;
+  a[107]=0;
+  a[108]=0;
+  a[109]=0;
+  a[110]=0;
+  a[111]=0;
+  a[112]=0;
+  a[113]=0;
+  a[114]=0;
+  a[115]=0;
+  a[116]=0;
+  a[117]=0;
+  a[118]=0;
+  a[119]=0;
+  a[120]=0;
+  a[121]=0;
+  a[122]=0;
+  a[123]=0;
+  a[124]=0;
+  a[125]=0;
+  a[126]=0;
+  a[127]=0;
+  a[128]=0;
+  a[129]=0;
+  a[130]=0;
+  a[131]=0;
+  a[132]=0;
+  a[133]=0;
+  a[134]=0;
+  a[135]=0;
+  a[136]=0;
+  a[137]=0;
+  a[138]=0;
+  a[139]=0;
+  a[140]=0;
+  a[141]=0;
+  a[142]=0;
+  a[143]=0;
+  a[144]=0;
+  a[145]=0;
+  a[146]=0;
+  a[147]=0;
+  a[148]=0;
+  a[149]=0;
+  a[150]=0;
+  a[151]=0;
+  a[152]=0;
+  a[153]=0;
+  a[154]=0;
+  a[155]=0;
+  a[156]=0;
+  a[157]=0;
+  a[158]=0;
+  a[159]=0;
+  a[160]=0;
+  a[161]=0;
+  a[162]=0;
+  a[163]=0;
+  a[164]=0;
+  a[165]=0;
+  a[166]=0;
+  a[167]=0;
+  a[168]=0;
+  a[169]=0;
+  a[170]=0;
+  a[171]=0;
+  a[172]=0;
+  a[173]=0;
+  a[174]=0;
+  a[175]=0;
+  a[176]=0;
+  a[177]=0;
+  a[178]=0;
+  a[179]=0;
+  a[180]=0;
+  a[181]=0;
+  a[182]=0;
+  a[183]=0;
+  a[184]=0;
+  a[185]=0;
+  a[186]=0;
+  a[187]=0;
+  a[188]=0;
+  a[189]=0;
+  a[190]=0;
+  a[191]=0;
+  a[192]=0;
+  a[193]=0;
+  a[194]=0;
+  a[195]=0;
+  a[196]=0;
+  a[197]=0;
+  a[198]=0;
+  a[199]=0;
+  a[200]=0;
+  a[201]=0;
+  a[202]=0;
+  a[203]=0;
+  a[204]=0;
+  a[205]=0;
+  a[206]=0;
+  a[207]=0;
+  a[208]=0;
+  a[209]=0;
+  a[210]=0;
+  a[211]=0;
+  a[212]=0;
+  a[213]=0;
+  a[214]=0;
+  a[215]=0;
+  a[216]=0;
+  a[217]=0;
+  a[218]=0;
+  a[219]=0;
+  a[220]=0;
+  a[221]=0;
+  a[222]=0;
+  a[223]=0;
+  a[224]=0;
+  a[225]=0;
+  a[226]=0;
+  a[227]=0;
+  a[228]=0;
+  a[229]=0;
+  a[230]=0;
+  a[231]=0;
+  a[232]=0;
+  a[233]=0;
+  a[234]=0;
+  a[235]=0;
+  a[236]=0;
+  a[237]=0;
+  a[238]=0;
+  a[239]=0;
+  a[240]=0;
+  a[241]=0;
+  a[242]=0;
+  a[243]=0;
+  a[244]=0;
+  a[245]=0;
+  a[246]=0;
+  a[247]=0;
+  a[248]=0;
+  a[249]=0;
+  a[250]=0;
+  a[251]=0;
+  a[252]=0;
+  a[253]=0;
+  a[254]=0;
+  a[255]=0;
+  a[256]=0;
+  a[257]=0;
+  a[258]=0;
+  a[259]=0;
+  a[260]=0;
+  a[261]=0;
+  a[262]=0;
+  a[263]=0;
+  a[264]=0;
+  a[265]=0;
+  a[266]=0;
+  a[267]=0;
+  a[268]=0;
+  a[269]=0;
+  a[270]=0;
+  a[271]=0;
+  a[272]=0;
+  a[273]=0;
+  a[274]=0;
+  a[275]=0;
+  a[276]=0;
+  a[277]=0;
+  a[278]=0;
+  a[279]=0;
+  a[280]=0;
+  a[281]=0;
+  a[282]=0;
+  a[283]=0;
+  a[284]=0;
+  a[285]=0;
+  a[286]=0;
+  a[287]=0;
+  a[288]=0;
+  a[289]=0;
+  a[290]=0;
+  a[291]=0;
+  a[292]=0;
+  a[293]=0;
+  a[294]=0;
+  a[295]=0;
+  a[296]=0;
+  a[297]=0;
+  a[298]=0;
+  a[299]=0;
+  a[300]=0;
+  a[301]=0;
+  a[302]=0;
+  a[303]=0;
+  a[304]=0;
+  a[305]=0;
+  a[306]=0;
+  a[307]=0;
+  a[308]=0;
+  a[309]=0;
+  a[310]=0;
+  a[311]=0;
+  a[312]=0;
+  a[313]=0;
+  a[314]=0;
+  a[315]=0;
+  a[316]=0;
+  a[317]=0;
+  a[318]=0;
+  a[319]=0;
+  a[320]=0;
+  a[321]=0;
+  a[322]=0;
+  a[323]=0;
+  a[324]=0;
+  a[325]=0;
+  a[326]=0;
+  a[327]=0;
+  a[328]=0;
+  a[329]=0;
+  a[330]=0;
+  a[331]=0;
+  a[332]=0;
+  a[333]=0;
+  a[334]=0;
+  a[335]=0;
+  a[336]=0;
+  a[337]=0;
+  a[338]=0;
+  a[339]=0;
+  a[340]=0;
+  a[341]=0;
+  a[342]=0;
+  a[343]=0;
+  a[344]=0;
+  a[345]=0;
+  a[346]=0;
+  a[347]=0;
+  a[348]=0;
+  a[349]=0;
+  a[350]=0;
+  a[351]=0;
+  a[352]=0;
+  a[353]=0;
+  a[354]=0;
+  a[355]=0;
+  a[356]=0;
+  a[357]=0;
+  a[358]=0;
+  a[359]=0;
+  a[360]=0;
+  a[361]=0;
+  a[362]=0;
+  a[363]=0;
+  a[364]=0;
+  a[365]=0;
+  a[366]=0;
+  a[367]=0;
+  a[368]=0;
+  a[369]=0;
+  a[370]=0;
+  a[371]=0;
+  a[372]=0;
+  a[373]=0;
+  a[374]=0;
+  a[375]=0;
+  a[376]=0;
+  a[377]=0;
+  a[378]=0;
+  a[379]=0;
+  a[380]=0;
+  a[381]=0;
+  a[382]=0;
+  a[383]=0;
+  a[384]=0;
+  a[385]=0;
+  a[386]=0;
+  a[387]=0;
+  a[388]=0;
+  a[389]=0;
+  a[390]=0;
+  a[391]=0;
+  a[392]=0;
+  a[393]=0;
+  a[394]=0;
+  a[395]=0;
+  a[396]=0;
+  a[397]=0;
+  a[398]=0;
+  a[399]=0;
+  a[400]=0;
+  a[401]=0;
+  a[402]=0;
+  a[403]=0;
+  a[404]=0;
+  a[405]=0;
+  a[406]=0;
+  a[407]=0;
+  a[408]=0;
+  a[409]=0;
+  a[410]=0;
+  a[411]=0;
+  a[412]=0;
+  a[413]=0;
+  a[414]=0;
+  a[415]=0;
+  a[416]=0;
+  a[417]=0;
+  a[418]=0;
+  a[419]=0;
+  a[420]=0;
+  a[421]=0;
+  a[422]=0;
+  a[423]=0;
+  a[424]=0;
+  a[425]=0;
+  a[426]=0;
+  a[427]=0;
+  a[428]=0;
+  a[429]=0;
+  a[430]=0;
+  a[431]=0;
+  a[432]=0;
+  a[433]=0;
+  a[434]=0;
+  a[435]=0;
+  a[436]=0;
+  a[437]=0;
+  a[438]=0;
+  a[439]=0;
+  a[440]=0;
+  a[441]=0;
+  a[442]=0;
+  a[443]=0;
+  a[444]=0;
+  a[445]=0;
+  a[446]=0;
+  a[447]=0;
+  a[448]=0;
+  a[449]=0;
+  a[450]=0;
+  a[451]=0;
+  a[452]=0;
+  a[453]=0;
+  a[454]=0;
+  a[455]=0;
+  a[456]=0;
+  a[457]=0;
+  a[458]=0;
+  a[459]=0;
+  a[460]=0;
+  a[461]=0;
+  a[462]=0;
+  a[463]=0;
+  a[464]=0;
+  a[465]=0;
+  a[466]=0;
+  a[467]=0;
+  a[468]=0;
+  a[469]=0;
+  a[470]=0;
+  a[471]=0;
+  a[472]=0;
+  a[473]=0;
+  a[474]=0;
+  a[475]=0;
+  a[476]=0;
+  a[477]=0;
+  a[478]=0;
+  a[479]=0;
+  a[480]=0;
+  a[481]=0;
+  a[482]=0;
+  a[483]=0;
+  a[484]=0;
+  a[485]=0;
+  a[486]=0;
+  a[487]=0;
+  a[488]=0;
+  a[489]=0;
+  a[490]=0;
+  a[491]=0;
+  a[492]=0;
+  a[493]=0;
+  a[494]=0;
+  a[495]=0;
+  a[496]=0;
+  a[497]=0;
+  a[498]=0;
+  a[499]=0;
+  a[500]=0;
+  a[501]=0;
+  a[502]=0;
+  a[503]=0;
+  a[504]=0;
+  a[505]=0;
+  a[506]=0;
+  a[507]=0;
+  a[508]=0;
+  a[509]=0;
+  a[510]=0;
+  a[511]=0;
+  a[512]=0;
+  a[513]=0;
+  a[514]=0;
+  a[515]=0;
+  a[516]=0;
+  a[517]=0;
+  a[518]=0;
+  a[519]=0;
+  a[520]=0;
+  a[521]=0;
+  a[522]=0;
+  a[523]=0;
+  a[524]=0;
+  a[525]=0;
+  a[526]=0;
+  a[527]=0;
+  a[528]=0;
+  a[529]=0;
+  a[530]=0;
+  a[531]=0;
+  a[532]=0;
+  a[533]=0;
+  a[534]=0;
+  a[535]=0;
+  a[536]=0;
+  a[537]=0;
+  a[538]=0;
+  a[539]=0;
+  a[540]=0;
+  a[541]=0;
+  a[542]=0;
+  a[543]=0;
+  a[544]=0;
+  a[545]=0;
+  a[546]=0;
+  a[547]=0;
+  a[548]=0;
+  a[549]=0;
+  a[550]=0;
+  a[551]=0;
+  a[552]=0;
+  a[553]=0;
+  a[554]=0;
+  a[555]=0;
+  a[556]=0;
+  a[557]=0;
+  a[558]=0;
+  a[559]=0;
+  a[560]=0;
+  a[561]=0;
+  a[562]=0;
+  a[563]=0;
+  a[564]=0;
+  a[565]=0;
+  a[566]=0;
+  a[567]=0;
+  a[568]=0;
+  a[569]=0;
+  a[570]=0;
+  a[571]=0;
+  a[572]=0;
+  a[573]=0;
+  a[574]=0;
+  a[575]=0;
+  a[576]=0;
+  a[577]=0;
+  a[578]=0;
+  a[579]=0;
+  a[580]=0;
+  a[581]=0;
+  a[582]=0;
+  a[583]=0;
+  a[584]=0;
+  a[585]=0;
+  a[586]=0;
+  a[587]=0;
+  a[588]=0;
+  a[589]=0;
+  a[590]=0;
+  a[591]=0;
+  a[592]=0;
+  a[593]=0;
+  a[594]=0;
+  a[595]=0;
+  a[596]=0;
+  a[597]=0;
+  a[598]=0;
+  a[599]=0;
+  a[600]=0;
+  a[601]=0;
+  a[602]=0;
+  a[603]=0;
+  a[604]=0;
+  a[605]=0;
+  a[606]=0;
+  a[607]=0;
+  a[608]=0;
+  a[609]=0;
+  a[610]=0;
+  a[611]=0;
+  a[612]=0;
+  a[613]=0;
+  a[614]=0;
+  a[615]=0;
+  a[616]=0;
+  a[617]=0;
+  a[618]=0;
+  a[619]=0;
+  a[620]=0;
+  a[621]=0;
+  a[622]=0;
+  a[623]=0;
+  a[624]=0;
+  a[625]=0;
+  a[626]=0;
+  a[627]=0;
+  a[628]=0;
+  a[629]=0;
+  a[630]=0;
+  a[631]=0;
+  a[632]=0;
+  a[633]=0;
+  a[634]=0;
+  a[635]=0;
+  a[636]=0;
+  a[637]=0;
+  a[638]=0;
+  a[639]=0;
+  a[640]=0;
+  a[641]=0;
+  a[642]=0;
+  a[643]=0;
+  a[644]=0;
+  a[645]=0;
+  a[646]=0;
+  a[647]=0;
+  a[648]=0;
+  a[649]=0;
+  a[650]=0;
+  a[651]=0;
+  a[652]=0;
+  a[653]=0;
+  a[654]=0;
+  a[655]=0;
+  a[656]=0;
+  a[657]=0;
+  a[658]=0;
+  a[659]=0;
+  a[660]=0;
+  a[661]=0;
+  a[662]=0;
+  a[663]=0;
+  a[664]=0;
+  a[665]=0;
+  a[666]=0;
+  a[667]=0;
+  a[668]=0;
+  a[669]=0;
+  a[670]=0;
+  a[671]=0;
+  a[672]=0;
+  a[673]=0;
+  a[674]=0;
+  a[675]=0;
+  a[676]=0;
+  a[677]=0;
+  a[678]=0;
+  a[679]=0;
+  a[680]=0;
+  a[681]=0;
+  a[682]=0;
+  a[683]=0;
+  a[684]=0;
+  a[685]=0;
+  a[686]=0;
+  a[687]=0;
+  a[688]=0;
+  a[689]=0;
+  a[690]=0;
+  a[691]=0;
+  a[692]=0;
+  a[693]=0;
+  a[694]=0;
+  a[695]=0;
+  a[696]=0;
+  a[697]=0;
+  a[698]=0;
+  a[699]=0;
+  a[700]=0;
+  a[701]=0;
+  a[702]=0;
+  a[703]=0;
+  a[704]=0;
+  a[705]=0;
+  a[706]=0;
+  a[707]=0;
+  a[708]=0;
+  a[709]=0;
+  a[710]=0;
+  a[711]=0;
+  a[712]=0;
+  a[713]=0;
+  a[714]=0;
+  a[715]=0;
+  a[716]=0;
+  a[717]=0;
+  a[718]=0;
+  a[719]=0;
+  a[720]=0;
+  a[721]=0;
+  a[722]=0;
+  a[723]=0;
+  a[724]=0;
+  a[725]=0;
+  a[726]=0;
+  a[727]=0;
+  a[728]=0;
+  a[729]=0;
+  a[730]=0;
+  a[731]=0;
+  a[732]=0;
+  a[733]=0;
+  a[734]=0;
+  a[735]=0;
+  a[736]=0;
+  a[737]=0;
+  a[738]=0;
+  a[739]=0;
+  a[740]=0;
+  a[741]=0;
+  a[742]=0;
+  a[743]=0;
+  a[744]=0;
+  a[745]=0;
+  a[746]=0;
+  a[747]=0;
+  a[748]=0;
+  a[749]=0;
+  a[750]=0;
+  a[751]=0;
+  a[752]=0;
+  a[753]=0;
+  a[754]=0;
+  a[755]=0;
+  a[756]=0;
+  a[757]=0;
+  a[758]=0;
+  a[759]=0;
+  a[760]=0;
+  a[761]=0;
+  a[762]=0;
+  a[763]=0;
+  a[764]=0;
+  a[765]=0;
+  a[766]=0;
+  a[767]=0;
+  a[768]=0;
+  a[769]=0;
+  a[770]=0;
+  a[771]=0;
+  a[772]=0;
+  a[773]=0;
+  a[774]=0;
+  a[775]=0;
+  a[776]=0;
+  a[777]=0;
+  a[778]=0;
+  a[779]=0;
+  a[780]=0;
+  a[781]=0;
+  a[782]=0;
+  a[783]=0;
+  a[784]=0;
+  a[785]=0;
+  a[786]=0;
+  a[787]=0;
+  a[788]=0;
+  a[789]=0;
+  a[790]=0;
+  a[791]=0;
+  a[792]=0;
+  a[793]=0;
+  a[794]=0;
+  a[795]=0;
+  a[796]=0;
+  a[797]=0;
+  a[798]=0;
+  a[799]=0;
+  a[800]=0;
+  a[801]=0;
+  a[802]=0;
+  a[803]=0;
+  a[804]=0;
+  a[805]=0;
+  a[806]=0;
+  a[807]=0;
+  a[808]=0;
+  a[809]=0;
+  a[810]=0;
+  a[811]=0;
+  a[812]=0;
+  a[813]=0;
+  a[814]=0;
+  a[815]=0;
+  a[816]=0;
+  a[817]=0;
+  a[818]=0;
+  a[819]=0;
+  a[820]=0;
+  a[821]=0;
+  a[822]=0;
+  a[823]=0;
+  a[824]=0;
+  a[825]=0;
+  a[826]=0;
+  a[827]=0;
+  a[828]=0;
+  a[829]=0;
+  a[830]=0;
+  a[831]=0;
+  a[832]=0;
+  a[833]=0;
+  a[834]=0;
+  a[835]=0;
+  a[836]=0;
+  a[837]=0;
+  a[838]=0;
+  a[839]=0;
+  a[840]=0;
+  a[841]=0;
+  a[842]=0;
+  a[843]=0;
+  a[844]=0;
+  a[845]=0;
+  a[846]=0;
+  a[847]=0;
+  a[848]=0;
+  a[849]=0;
+  a[850]=0;
+  a[851]=0;
+  a[852]=0;
+  a[853]=0;
+  a[854]=0;
+  a[855]=0;
+  a[856]=0;
+  a[857]=0;
+  a[858]=0;
+  a[859]=0;
+  a[860]=0;
+  a[861]=0;
+  a[862]=0;
+  a[863]=0;
+  a[864]=0;
+  a[865]=0;
+  a[866]=0;
+  a[867]=0;
+  a[868]=0;
+  a[869]=0;
+  a[870]=0;
+  a[871]=0;
+  a[872]=0;
+  a[873]=0;
+  a[874]=0;
+  a[875]=0;
+  a[876]=0;
+  a[877]=0;
+  a[878]=0;
+  a[879]=0;
+  a[880]=0;
+  a[881]=0;
+  a[882]=0;
+  a[883]=0;
+  a[884]=0;
+  a[885]=0;
+  a[886]=0;
+  a[887]=0;
+  a[888]=0;
+  a[889]=0;
+  a[890]=0;
+  a[891]=0;
+  a[892]=0;
+  a[893]=0;
+  a[894]=0;
+  a[895]=0;
+  a[896]=0;
+  a[897]=0;
+  a[898]=0;
+  a[899]=0;
+  a[900]=0;
+  a[901]=0;
+  a[902]=0;
+  a[903]=0;
+  a[904]=0;
+  a[905]=0;
+  a[906]=0;
+  a[907]=0;
+  a[908]=0;
+  a[909]=0;
+  a[910]=0;
+  a[911]=0;
+  a[912]=0;
+  a[913]=0;
+  a[914]=0;
+  a[915]=0;
+  a[916]=0;
+  a[917]=0;
+  a[918]=0;
+  a[919]=0;
+  a[920]=0;
+  a[921]=0;
+  a[922]=0;
+  a[923]=0;
+  a[924]=0;
+  a[925]=0;
+  a[926]=0;
+  a[927]=0;
+  a[928]=0;
+  a[929]=0;
+  a[930]=0;
+  a[931]=0;
+  a[932]=0;
+  a[933]=0;
+  a[934]=0;
+  a[935]=0;
+  a[936]=0;
+  a[937]=0;
+  a[938]=0;
+  a[939]=0;
+  a[940]=0;
+  a[941]=0;
+  a[942]=0;
+  a[943]=0;
+  a[944]=0;
+  a[945]=0;
+  a[946]=0;
+  a[947]=0;
+  a[948]=0;
+  a[949]=0;
+  a[950]=0;
+  a[951]=0;
+  a[952]=0;
+  a[953]=0;
+  a[954]=0;
+  a[955]=0;
+  a[956]=0;
+  a[957]=0;
+  a[958]=0;
+  a[959]=0;
+  a[960]=0;
+  a[961]=0;
+  a[962]=0;
+  a[963]=0;
+  a[964]=0;
+  a[965]=0;
+  a[966]=0;
+  a[967]=0;
+  a[968]=0;
+  a[969]=0;
+  a[970]=0;
+  a[971]=0;
+  a[972]=0;
+  a[973]=0;
+  a[974]=0;
+  a[975]=0;
+  a[976]=0;
+  a[977]=0;
+  a[978]=0;
+  a[979]=0;
+  a[980]=0;
+  a[981]=0;
+  a[982]=0;
+  a[983]=0;
+  a[984]=0;
+  a[985]=0;
+  a[986]=0;
+  a[987]=0;
+  a[988]=0;
+  a[989]=0;
+  a[990]=0;
+  a[991]=0;
+  a[992]=0;
+  a[993]=0;
+  a[994]=0;
+  a[995]=0;
+  a[996]=0;
+  a[997]=0;
+  a[998]=0;
+  a[999]=0;
+  a[1000]=0;
+  a[1001]=0;
+  a[1002]=0;
+  a[1003]=0;
+  a[1004]=0;
+  a[1005]=0;
+  a[1006]=0;
+  a[1007]=0;
+  a[1008]=0;
+  a[1009]=0;
+  a[1010]=0;
+  a[1011]=0;
+  a[1012]=0;
+  a[1013]=0;
+  a[1014]=0;
+  a[1015]=0;
+  a[1016]=0;
+  a[1017]=0;
+  a[1018]=0;
+  a[1019]=0;
+  a[1020]=0;
+  a[1021]=0;
+  a[1022]=0;
+  a[1023]=0;
+  a[1024]=0;
+  a[1025]=0;
+  a[1026]=0;
+  a[1027]=0;
+  a[1028]=0;
+  a[1029]=0;
+  a[1030]=0;
+  a[1031]=0;
+  a[1032]=0;
+  a[1033]=0;
+  a[1034]=0;
+  a[1035]=0;
+  a[1036]=0;
+  a[1037]=0;
+  a[1038]=0;
+  a[1039]=0;
+  a[1040]=0;
+  a[1041]=0;
+  a[1042]=0;
+  a[1043]=0;
+  a[1044]=0;
+  a[1045]=0;
+  a[1046]=0;
+  a[1047]=0;
+  a[1048]=0;
+  a[1049]=0;
+  a[1050]=0;
+  a[1051]=0;
+  a[1052]=0;
+  a[1053]=0;
+  a[1054]=0;
+  a[1055]=0;
+  a[1056]=0;
+  a[1057]=0;
+  a[1058]=0;
+  a[1059]=0;
+  a[1060]=0;
+  a[1061]=0;
+  a[1062]=0;
+  a[1063]=0;
+  a[1064]=0;
+  a[1065]=0;
+  a[1066]=0;
+  a[1067]=0;
+  a[1068]=0;
+  a[1069]=0;
+  a[1070]=0;
+  a[1071]=0;
+  a[1072]=0;
+  a[1073]=0;
+  a[1074]=0;
+  a[1075]=0;
+  a[1076]=0;
+  a[1077]=0;
+  a[1078]=0;
+  a[1079]=0;
+  a[1080]=0;
+  a[1081]=0;
+  a[1082]=0;
+  a[1083]=0;
+  a[1084]=0;
+  a[1085]=0;
+  a[1086]=0;
+  a[1087]=0;
+  a[1088]=0;
+  a[1089]=0;
+  a[1090]=0;
+  a[1091]=0;
+  a[1092]=0;
+  a[1093]=0;
+  a[1094]=0;
+  a[1095]=0;
+  a[1096]=0;
+  a[1097]=0;
+  a[1098]=0;
+  a[1099]=0;
+  a[1100]=0;
+  a[1101]=0;
+  a[1102]=0;
+  a[1103]=0;
+  a[1104]=0;
+  a[1105]=0;
+  a[1106]=0;
+  a[1107]=0;
+  a[1108]=0;
+  a[1109]=0;
+  a[1110]=0;
+  a[1111]=0;
+  a[1112]=0;
+  a[1113]=0;
+  a[1114]=0;
+  a[1115]=0;
+  a[1116]=0;
+  a[1117]=0;
+  a[1118]=0;
+  a[1119]=0;
+  a[1120]=0;
+  a[1121]=0;
+  a[1122]=0;
+  a[1123]=0;
+  a[1124]=0;
+  a[1125]=0;
+  a[1126]=0;
+  a[1127]=0;
+  a[1128]=0;
+  a[1129]=0;
+  a[1130]=0;
+  a[1131]=0;
+  a[1132]=0;
+  a[1133]=0;
+  a[1134]=0;
+  a[1135]=0;
+  a[1136]=0;
+  a[1137]=0;
+  a[1138]=0;
+  a[1139]=0;
+  a[1140]=0;
+  a[1141]=0;
+  a[1142]=0;
+  a[1143]=0;
+  a[1144]=0;
+  a[1145]=0;
+  a[1146]=0;
+  a[1147]=0;
+  a[1148]=0;
+  a[1149]=0;
+  a[1150]=0;
+  a[1151]=0;
+  a[1152]=0;
+  a[1153]=0;
+  a[1154]=0;
+  a[1155]=0;
+  a[1156]=0;
+  a[1157]=0;
+  a[1158]=0;
+  a[1159]=0;
+  a[1160]=0;
+  a[1161]=0;
+  a[1162]=0;
+  a[1163]=0;
+  a[1164]=0;
+  a[1165]=0;
+  a[1166]=0;
+  a[1167]=0;
+  a[1168]=0;
+  a[1169]=0;
+  a[1170]=0;
+  a[1171]=0;
+  a[1172]=0;
+  a[1173]=0;
+  a[1174]=0;
+  a[1175]=0;
+  a[1176]=0;
+  a[1177]=0;
+  a[1178]=0;
+  a[1179]=0;
+  a[1180]=0;
+  a[1181]=0;
+  a[1182]=0;
+  a[1183]=0;
+  a[1184]=0;
+  a[1185]=0;
+  a[1186]=0;
+  a[1187]=0;
+  a[1188]=0;
+  a[1189]=0;
+  a[1190]=0;
+  a[1191]=0;
+  a[1192]=0;
+  a[1193]=0;
+  a[1194]=0;
+  a[1195]=0;
+  a[1196]=0;
+  a[1197]=0;
+  a[1198]=0;
+  a[1199]=0;
+  a[1200]=0;
+  a[1201]=0;
+  a[1202]=0;
+  a[1203]=0;
+  a[1204]=0;
+  a[1205]=0;
+  a[1206]=0;
+  a[1207]=0;
+  a[1208]=0;
+  a[1209]=0;
+  a[1210]=0;
+  a[1211]=0;
+  a[1212]=0;
+  a[1213]=0;
+  a[1214]=0;
+  a[1215]=0;
+  a[1216]=0;
+  a[1217]=0;
+  a[1218]=0;
+  a[1219]=0;
+  a[1220]=0;
+  a[1221]=0;
+  a[1222]=0;
+  a[1223]=0;
+  a[1224]=0;
+  a[1225]=0;
+  a[1226]=0;
+  a[1227]=0;
+  a[1228]=0;
+  a[1229]=0;
+  a[1230]=0;
+  a[1231]=0;
+  a[1232]=0;
+  a[1233]=0;
+  a[1234]=0;
+  a[1235]=0;
+  a[1236]=0;
+  a[1237]=0;
+  a[1238]=0;
+  a[1239]=0;
+  a[1240]=0;
+  a[1241]=0;
+  a[1242]=0;
+  a[1243]=0;
+  a[1244]=0;
+  a[1245]=0;
+  a[1246]=0;
+  a[1247]=0;
+  a[1248]=0;
+  a[1249]=0;
+  a[1250]=0;
+  a[1251]=0;
+  a[1252]=0;
+  a[1253]=0;
+  a[1254]=0;
+  a[1255]=0;
+  a[1256]=0;
+  a[1257]=0;
+  a[1258]=0;
+  a[1259]=0;
+  a[1260]=0;
+  a[1261]=0;
+  a[1262]=0;
+  a[1263]=0;
+  a[1264]=0;
+  a[1265]=0;
+  a[1266]=0;
+  a[1267]=0;
+  a[1268]=0;
+  a[1269]=0;
+  a[1270]=0;
+  a[1271]=0;
+  a[1272]=0;
+  a[1273]=0;
+  a[1274]=0;
+  a[1275]=0;
+  a[1276]=0;
+  a[1277]=0;
+  a[1278]=0;
+  a[1279]=0;
+  a[1280]=0;
+  a[1281]=0;
+  a[1282]=0;
+  a[1283]=0;
+  a[1284]=0;
+  a[1285]=0;
+  a[1286]=0;
+  a[1287]=0;
+  a[1288]=0;
+  a[1289]=0;
+  a[1290]=0;
+  a[1291]=0;
+  a[1292]=0;
+  a[1293]=0;
+  a[1294]=0;
+  a[1295]=0;
+  a[1296]=0;
+  a[1297]=0;
+  a[1298]=0;
+  a[1299]=0;
+  a[1300]=0;
+  a[1301]=0;
+  a[1302]=0;
+  a[1303]=0;
+  a[1304]=0;
+  a[1305]=0;
+  a[1306]=0;
+  a[1307]=0;
+  a[1308]=0;
+  a[1309]=0;
+  a[1310]=0;
+  a[1311]=0;
+  a[1312]=0;
+  a[1313]=0;
+  a[1314]=0;
+  a[1315]=0;
+  a[1316]=0;
+  a[1317]=0;
+  a[1318]=0;
+  a[1319]=0;
+  a[1320]=0;
+  a[1321]=0;
+  a[1322]=0;
+  a[1323]=0;
+  a[1324]=0;
+  a[1325]=0;
+  a[1326]=0;
+  a[1327]=0;
+  a[1328]=0;
+  a[1329]=0;
+  a[1330]=0;
+  a[1331]=0;
+  a[1332]=0;
+  a[1333]=0;
+  a[1334]=0;
+  a[1335]=0;
+  a[1336]=0;
+  a[1337]=0;
+  a[1338]=0;
+  a[1339]=0;
+  a[1340]=0;
+  a[1341]=0;
+  a[1342]=0;
+  a[1343]=0;
+  a[1344]=0;
+  a[1345]=0;
+  a[1346]=0;
+  a[1347]=0;
+  a[1348]=0;
+  a[1349]=0;
+  a[1350]=0;
+  a[1351]=0;
+  a[1352]=0;
+  a[1353]=0;
+  a[1354]=0;
+  a[1355]=0;
+  a[1356]=0;
+  a[1357]=0;
+  a[1358]=0;
+  a[1359]=0;
+  a[1360]=0;
+  a[1361]=0;
+  a[1362]=0;
+  a[1363]=0;
+  a[1364]=0;
+  a[1365]=0;
+  a[1366]=0;
+  a[1367]=0;
+  a[1368]=0;
+  a[1369]=0;
+  a[1370]=0;
+  a[1371]=0;
+  a[1372]=0;
+  a[1373]=0;
+  a[1374]=0;
+  a[1375]=0;
+  a[1376]=0;
+  a[1377]=0;
+  a[1378]=0;
+  a[1379]=0;
+  a[1380]=0;
+  a[1381]=0;
+  a[1382]=0;
+  a[1383]=0;
+  a[1384]=0;
+  a[1385]=0;
+  a[1386]=0;
+  a[1387]=0;
+  a[1388]=0;
+  a[1389]=0;
+  a[1390]=0;
+  a[1391]=0;
+  a[1392]=0;
+  a[1393]=0;
+  a[1394]=0;
+  a[1395]=0;
+  a[1396]=0;
+  a[1397]=0;
+  a[1398]=0;
+  a[1399]=0;
+  a[1400]=0;
+  a[1401]=0;
+  a[1402]=0;
+  a[1403]=0;
+  a[1404]=0;
+  a[1405]=0;
+  a[1406]=0;
+  a[1407]=0;
+  a[1408]=0;
+  a[1409]=0;
+  a[1410]=0;
+  a[1411]=0;
+  a[1412]=0;
+  a[1413]=0;
+  a[1414]=0;
+  a[1415]=0;
+  a[1416]=0;
+  a[1417]=0;
+  a[1418]=0;
+  a[1419]=0;
+  a[1420]=0;
+  a[1421]=0;
+  a[1422]=0;
+  a[1423]=0;
+  a[1424]=0;
+  a[1425]=0;
+  a[1426]=0;
+  a[1427]=0;
+  a[1428]=0;
+  a[1429]=0;
+  a[1430]=0;
+  a[1431]=0;
+  a[1432]=0;
+  a[1433]=0;
+  a[1434]=0;
+  a[1435]=0;
+  a[1436]=0;
+  a[1437]=0;
+  a[1438]=0;
+  a[1439]=0;
+  a[1440]=0;
+  a[1441]=0;
+  a[1442]=0;
+  a[1443]=0;
+  a[1444]=0;
+  a[1445]=0;
+  a[1446]=0;
+  a[1447]=0;
+  a[1448]=0;
+  a[1449]=0;
+  a[1450]=0;
+  a[1451]=0;
+  a[1452]=0;
+  a[1453]=0;
+  a[1454]=0;
+  a[1455]=0;
+  a[1456]=0;
+  a[1457]=0;
+  a[1458]=0;
+  a[1459]=0;
+  a[1460]=0;
+  a[1461]=0;
+  a[1462]=0;
+  a[1463]=0;
+  a[1464]=0;
+  a[1465]=0;
+  a[1466]=0;
+  a[1467]=0;
+  a[1468]=0;
+  a[1469]=0;
+  a[1470]=0;
+  a[1471]=0;
+  a[1472]=0;
+  a[1473]=0;
+  a[1474]=0;
+  a[1475]=0;
+  a[1476]=0;
+  a[1477]=0;
+  a[1478]=0;
+  a[1479]=0;
+  a[1480]=0;
+  a[1481]=0;
+  a[1482]=0;
+  a[1483]=0;
+  a[1484]=0;
+  a[1485]=0;
+  a[1486]=0;
+  a[1487]=0;
+  a[1488]=0;
+  a[1489]=0;
+  a[1490]=0;
+  a[1491]=0;
+  a[1492]=0;
+  a[1493]=0;
+  a[1494]=0;
+  a[1495]=0;
+  a[1496]=0;
+  a[1497]=0;
+  a[1498]=0;
+  a[1499]=0;
+  a[1500]=0;
+  a[1501]=0;
+  a[1502]=0;
+  a[1503]=0;
+  a[1504]=0;
+  a[1505]=0;
+  a[1506]=0;
+  a[1507]=0;
+  a[1508]=0;
+  a[1509]=0;
+  a[1510]=0;
+  a[1511]=0;
+  a[1512]=0;
+  a[1513]=0;
+  a[1514]=0;
+  a[1515]=0;
+  a[1516]=0;
+  a[1517]=0;
+  a[1518]=0;
+  a[1519]=0;
+  a[1520]=0;
+  a[1521]=0;
+  a[1522]=0;
+  a[1523]=0;
+  a[1524]=0;
+  a[1525]=0;
+  a[1526]=0;
+  a[1527]=0;
+  a[1528]=0;
+  a[1529]=0;
+  a[1530]=0;
+  a[1531]=0;
+  a[1532]=0;
+  a[1533]=0;
+  a[1534]=0;
+  a[1535]=0;
+  a[1536]=0;
+  a[1537]=0;
+  a[1538]=0;
+  a[1539]=0;
+  a[1540]=0;
+  a[1541]=0;
+  a[1542]=0;
+  a[1543]=0;
+  a[1544]=0;
+  a[1545]=0;
+  a[1546]=0;
+  a[1547]=0;
+  a[1548]=0;
+  a[1549]=0;
+  a[1550]=0;
+  a[1551]=0;
+  a[1552]=0;
+  a[1553]=0;
+  a[1554]=0;
+  a[1555]=0;
+  a[1556]=0;
+  a[1557]=0;
+  a[1558]=0;
+  a[1559]=0;
+  a[1560]=0;
+  a[1561]=0;
+  a[1562]=0;
+  a[1563]=0;
+  a[1564]=0;
+  a[1565]=0;
+  a[1566]=0;
+  a[1567]=0;
+  a[1568]=0;
+  a[1569]=0;
+  a[1570]=0;
+  a[1571]=0;
+  a[1572]=0;
+  a[1573]=0;
+  a[1574]=0;
+  a[1575]=0;
+  a[1576]=0;
+  a[1577]=0;
+  a[1578]=0;
+  a[1579]=0;
+  a[1580]=0;
+  a[1581]=0;
+  a[1582]=0;
+  a[1583]=0;
+  a[1584]=0;
+  a[1585]=0;
+  a[1586]=0;
+  a[1587]=0;
+  a[1588]=0;
+  a[1589]=0;
+  a[1590]=0;
+  a[1591]=0;
+  a[1592]=0;
+  a[1593]=0;
+  a[1594]=0;
+  a[1595]=0;
+  a[1596]=0;
+  a[1597]=0;
+  a[1598]=0;
+  a[1599]=0;
+  a[1600]=0;
+  a[1601]=0;
+  a[1602]=0;
+  a[1603]=0;
+  a[1604]=0;
+  a[1605]=0;
+  a[1606]=0;
+  a[1607]=0;
+  a[1608]=0;
+  a[1609]=0;
+  a[1610]=0;
+  a[1611]=0;
+  a[1612]=0;
+  a[1613]=0;
+  a[1614]=0;
+  a[1615]=0;
+  a[1616]=0;
+  a[1617]=0;
+  a[1618]=0;
+  a[1619]=0;
+  a[1620]=0;
+  a[1621]=0;
+  a[1622]=0;
+  a[1623]=0;
+  a[1624]=0;
+  a[1625]=0;
+  a[1626]=0;
+  a[1627]=0;
+  a[1628]=0;
+  a[1629]=0;
+  a[1630]=0;
+  a[1631]=0;
+  a[1632]=0;
+  a[1633]=0;
+  a[1634]=0;
+  a[1635]=0;
+  a[1636]=0;
+  a[1637]=0;
+  a[1638]=0;
+  a[1639]=0;
+  a[1640]=0;
+  a[1641]=0;
+  a[1642]=0;
+  a[1643]=0;
+  a[1644]=0;
+  a[1645]=0;
+  a[1646]=0;
+  a[1647]=0;
+  a[1648]=0;
+  a[1649]=0;
+  a[1650]=0;
+  a[1651]=0;
+  a[1652]=0;
+  a[1653]=0;
+  a[1654]=0;
+  a[1655]=0;
+  a[1656]=0;
+  a[1657]=0;
+  a[1658]=0;
+  a[1659]=0;
+  a[1660]=0;
+  a[1661]=0;
+  a[1662]=0;
+  a[1663]=0;
+  a[1664]=0;
+  a[1665]=0;
+  a[1666]=0;
+  a[1667]=0;
+  a[1668]=0;
+  a[1669]=0;
+  a[1670]=0;
+  a[1671]=0;
+  a[1672]=0;
+  a[1673]=0;
+  a[1674]=0;
+  a[1675]=0;
+  a[1676]=0;
+  a[1677]=0;
+  a[1678]=0;
+  a[1679]=0;
+  a[1680]=0;
+  a[1681]=0;
+  a[1682]=0;
+  a[1683]=0;
+  a[1684]=0;
+  a[1685]=0;
+  a[1686]=0;
+  a[1687]=0;
+  a[1688]=0;
+  a[1689]=0;
+  a[1690]=0;
+  a[1691]=0;
+  a[1692]=0;
+  a[1693]=0;
+  a[1694]=0;
+  a[1695]=0;
+  a[1696]=0;
+  a[1697]=0;
+  a[1698]=0;
+  a[1699]=0;
+  a[1700]=0;
+  a[1701]=0;
+  a[1702]=0;
+  a[1703]=0;
+  a[1704]=0;
+  a[1705]=0;
+  a[1706]=0;
+  a[1707]=0;
+  a[1708]=0;
+  a[1709]=0;
+  a[1710]=0;
+  a[1711]=0;
+  a[1712]=0;
+  a[1713]=0;
+  a[1714]=0;
+  a[1715]=0;
+  a[1716]=0;
+  a[1717]=0;
+  a[1718]=0;
+  a[1719]=0;
+  a[1720]=0;
+  a[1721]=0;
+  a[1722]=0;
+  a[1723]=0;
+  a[1724]=0;
+  a[1725]=0;
+  a[1726]=0;
+  a[1727]=0;
+  a[1728]=0;
+  a[1729]=0;
+  a[1730]=0;
+  a[1731]=0;
+  a[1732]=0;
+  a[1733]=0;
+  a[1734]=0;
+  a[1735]=0;
+  a[1736]=0;
+  a[1737]=0;
+  a[1738]=0;
+  a[1739]=0;
+  a[1740]=0;
+  a[1741]=0;
+  a[1742]=0;
+  a[1743]=0;
+  a[1744]=0;
+  a[1745]=0;
+  a[1746]=0;
+  a[1747]=0;
+  a[1748]=0;
+  a[1749]=0;
+  a[1750]=0;
+  a[1751]=0;
+  a[1752]=0;
+  a[1753]=0;
+  a[1754]=0;
+  a[1755]=0;
+  a[1756]=0;
+  a[1757]=0;
+  a[1758]=0;
+  a[1759]=0;
+  a[1760]=0;
+  a[1761]=0;
+  a[1762]=0;
+  a[1763]=0;
+  a[1764]=0;
+  a[1765]=0;
+  a[1766]=0;
+  a[1767]=0;
+  a[1768]=0;
+  a[1769]=0;
+  a[1770]=0;
+  a[1771]=0;
+  a[1772]=0;
+  a[1773]=0;
+  a[1774]=0;
+  a[1775]=0;
+  a[1776]=0;
+  a[1777]=0;
+  a[1778]=0;
+  a[1779]=0;
+  a[1780]=0;
+  a[1781]=0;
+  a[1782]=0;
+  a[1783]=0;
+  a[1784]=0;
+  a[1785]=0;
+  a[1786]=0;
+  a[1787]=0;
+  a[1788]=0;
+  a[1789]=0;
+  a[1790]=0;
+  a[1791]=0;
+  a[1792]=0;
+  a[1793]=0;
+  a[1794]=0;
+  a[1795]=0;
+  a[1796]=0;
+  a[1797]=0;
+  a[1798]=0;
+  a[1799]=0;
+  a[1800]=0;
+  a[1801]=0;
+  a[1802]=0;
+  a[1803]=0;
+  a[1804]=0;
+  a[1805]=0;
+  a[1806]=0;
+  a[1807]=0;
+  a[1808]=0;
+  a[1809]=0;
+  a[1810]=0;
+  a[1811]=0;
+  a[1812]=0;
+  a[1813]=0;
+  a[1814]=0;
+  a[1815]=0;
+  a[1816]=0;
+  a[1817]=0;
+  a[1818]=0;
+  a[1819]=0;
+  a[1820]=0;
+  a[1821]=0;
+  a[1822]=0;
+  a[1823]=0;
+  a[1824]=0;
+  a[1825]=0;
+  a[1826]=0;
+  a[1827]=0;
+  a[1828]=0;
+  a[1829]=0;
+  a[1830]=0;
+  a[1831]=0;
+  a[1832]=0;
+  a[1833]=0;
+  a[1834]=0;
+  a[1835]=0;
+  a[1836]=0;
+  a[1837]=0;
+  a[1838]=0;
+  a[1839]=0;
+  a[1840]=0;
+  a[1841]=0;
+  a[1842]=0;
+  a[1843]=0;
+  a[1844]=0;
+  a[1845]=0;
+  a[1846]=0;
+  a[1847]=0;
+  a[1848]=0;
+  a[1849]=0;
+  a[1850]=0;
+  a[1851]=0;
+  a[1852]=0;
+  a[1853]=0;
+  a[1854]=0;
+  a[1855]=0;
+  a[1856]=0;
+  a[1857]=0;
+  a[1858]=0;
+  a[1859]=0;
+  a[1860]=0;
+  a[1861]=0;
+  a[1862]=0;
+  a[1863]=0;
+  a[1864]=0;
+  a[1865]=0;
+  a[1866]=0;
+  a[1867]=0;
+  a[1868]=0;
+  a[1869]=0;
+  a[1870]=0;
+  a[1871]=0;
+  a[1872]=0;
+  a[1873]=0;
+  a[1874]=0;
+  a[1875]=0;
+  a[1876]=0;
+  a[1877]=0;
+  a[1878]=0;
+  a[1879]=0;
+  a[1880]=0;
+  a[1881]=0;
+  a[1882]=0;
+  a[1883]=0;
+  a[1884]=0;
+  a[1885]=0;
+  a[1886]=0;
+  a[1887]=0;
+  a[1888]=0;
+  a[1889]=0;
+  a[1890]=0;
+  a[1891]=0;
+  a[1892]=0;
+  a[1893]=0;
+  a[1894]=0;
+  a[1895]=0;
+  a[1896]=0;
+  a[1897]=0;
+  a[1898]=0;
+  a[1899]=0;
+  a[1900]=0;
+  a[1901]=0;
+  a[1902]=0;
+  a[1903]=0;
+  a[1904]=0;
+  a[1905]=0;
+  a[1906]=0;
+  a[1907]=0;
+  a[1908]=0;
+  a[1909]=0;
+  a[1910]=0;
+  a[1911]=0;
+  a[1912]=0;
+  a[1913]=0;
+  a[1914]=0;
+  a[1915]=0;
+  a[1916]=0;
+  a[1917]=0;
+  a[1918]=0;
+  a[1919]=0;
+  a[1920]=0;
+  a[1921]=0;
+  a[1922]=0;
+  a[1923]=0;
+  a[1924]=0;
+  a[1925]=0;
+  a[1926]=0;
+  a[1927]=0;
+  a[1928]=0;
+  a[1929]=0;
+  a[1930]=0;
+  a[1931]=0;
+  a[1932]=0;
+  a[1933]=0;
+  a[1934]=0;
+  a[1935]=0;
+  a[1936]=0;
+  a[1937]=0;
+  a[1938]=0;
+  a[1939]=0;
+  a[1940]=0;
+  a[1941]=0;
+  a[1942]=0;
+  a[1943]=0;
+  a[1944]=0;
+  a[1945]=0;
+  a[1946]=0;
+  a[1947]=0;
+  a[1948]=0;
+  a[1949]=0;
+  a[1950]=0;
+  a[1951]=0;
+  a[1952]=0;
+  a[1953]=0;
+  a[1954]=0;
+  a[1955]=0;
+  a[1956]=0;
+  a[1957]=0;
+  a[1958]=0;
+  a[1959]=0;
+  a[1960]=0;
+  a[1961]=0;
+  a[1962]=0;
+  a[1963]=0;
+  a[1964]=0;
+  a[1965]=0;
+  a[1966]=0;
+  a[1967]=0;
+  a[1968]=0;
+  a[1969]=0;
+  a[1970]=0;
+  a[1971]=0;
+  a[1972]=0;
+  a[1973]=0;
+  a[1974]=0;
+  a[1975]=0;
+  a[1976]=0;
+  a[1977]=0;
+  a[1978]=0;
+  a[1979]=0;
+  a[1980]=0;
+  a[1981]=0;
+  a[1982]=0;
+  a[1983]=0;
+  a[1984]=0;
+  a[1985]=0;
+  a[1986]=0;
+  a[1987]=0;
+  a[1988]=0;
+  a[1989]=0;
+  a[1990]=0;
+  a[1991]=0;
+  a[1992]=0;
+  a[1993]=0;
+  a[1994]=0;
+  a[1995]=0;
+  a[1996]=0;
+  a[1997]=0;
+  a[1998]=0;
+  a[1999]=0;
+  a[2000]=0;
+  a[2001]=0;
+  a[2002]=0;
+  a[2003]=0;
+  a[2004]=0;
+  a[2005]=0;
+  a[2006]=0;
+  a[2007]=0;
+  a[2008]=0;
+  a[2009]=0;
+  a[2010]=0;
+  a[2011]=0;
+  a[2012]=0;
+  a[2013]=0;
+  a[2014]=0;
+  a[2015]=0;
+  a[2016]=0;
+  a[2017]=0;
+  a[2018]=0;
+  a[2019]=0;
+  a[2020]=0;
+  a[2021]=0;
+  a[2022]=0;
+  a[2023]=0;
+  a[2024]=0;
+  a[2025]=0;
+  a[2026]=0;
+  a[2027]=0;
+  a[2028]=0;
+  a[2029]=0;
+  a[2030]=0;
+  a[2031]=0;
+  a[2032]=0;
+  a[2033]=0;
+  a[2034]=0;
+  a[2035]=0;
+  a[2036]=0;
+  a[2037]=0;
+  a[2038]=0;
+  a[2039]=0;
+  a[2040]=0;
+  a[2041]=0;
+  a[2042]=0;
+  a[2043]=0;
+  a[2044]=0;
+  a[2045]=0;
+  a[2046]=0;
+  a[2047]=0;
+  a[2048]=0;
+  a[2049]=0;
+  a[2050]=0;
+  a[2051]=0;
+  a[2052]=0;
+  a[2053]=0;
+  a[2054]=0;
+  a[2055]=0;
+  a[2056]=0;
+  a[2057]=0;
+  a[2058]=0;
+  a[2059]=0;
+  a[2060]=0;
+  a[2061]=0;
+  a[2062]=0;
+  a[2063]=0;
+  a[2064]=0;
+  a[2065]=0;
+  a[2066]=0;
+  a[2067]=0;
+  a[2068]=0;
+  a[2069]=0;
+  a[2070]=0;
+  a[2071]=0;
+  a[2072]=0;
+  a[2073]=0;
+  a[2074]=0;
+  a[2075]=0;
+  a[2076]=0;
+  a[2077]=0;
+  a[2078]=0;
+  a[2079]=0;
+  a[2080]=0;
+  a[2081]=0;
+  a[2082]=0;
+  a[2083]=0;
+  a[2084]=0;
+  a[2085]=0;
+  a[2086]=0;
+  a[2087]=0;
+  a[2088]=0;
+  a[2089]=0;
+  a[2090]=0;
+  a[2091]=0;
+  a[2092]=0;
+  a[2093]=0;
+  a[2094]=0;
+  a[2095]=0;
+  a[2096]=0;
+  a[2097]=0;
+  a[2098]=0;
+  a[2099]=0;
+  a[2100]=0;
+  a[2101]=0;
+  a[2102]=0;
+  a[2103]=0;
+  a[2104]=0;
+  a[2105]=0;
+  a[2106]=0;
+  a[2107]=0;
+  a[2108]=0;
+  a[2109]=0;
+  a[2110]=0;
+  a[2111]=0;
+  a[2112]=0;
+  a[2113]=0;
+  a[2114]=0;
+  a[2115]=0;
+  a[2116]=0;
+  a[2117]=0;
+  a[2118]=0;
+  a[2119]=0;
+  a[2120]=0;
+  a[2121]=0;
+  a[2122]=0;
+  a[2123]=0;
+  a[2124]=0;
+  a[2125]=0;
+  a[2126]=0;
+  a[2127]=0;
+  a[2128]=0;
+  a[2129]=0;
+  a[2130]=0;
+  a[2131]=0;
+  a[2132]=0;
+  a[2133]=0;
+  a[2134]=0;
+  a[2135]=0;
+  a[2136]=0;
+  a[2137]=0;
+  a[2138]=0;
+  a[2139]=0;
+  a[2140]=0;
+  a[2141]=0;
+  a[2142]=0;
+  a[2143]=0;
+  a[2144]=0;
+  a[2145]=0;
+  a[2146]=0;
+  a[2147]=0;
+  a[2148]=0;
+  a[2149]=0;
+  a[2150]=0;
+  a[2151]=0;
+  a[2152]=0;
+  a[2153]=0;
+  a[2154]=0;
+  a[2155]=0;
+  a[2156]=0;
+  a[2157]=0;
+  a[2158]=0;
+  a[2159]=0;
+  a[2160]=0;
+  a[2161]=0;
+  a[2162]=0;
+  a[2163]=0;
+  a[2164]=0;
+  a[2165]=0;
+  a[2166]=0;
+  a[2167]=0;
+  a[2168]=0;
+  a[2169]=0;
+  a[2170]=0;
+  a[2171]=0;
+  a[2172]=0;
+  a[2173]=0;
+  a[2174]=0;
+  a[2175]=0;
+  a[2176]=0;
+  a[2177]=0;
+  a[2178]=0;
+  a[2179]=0;
+  a[2180]=0;
+  a[2181]=0;
+  a[2182]=0;
+  a[2183]=0;
+  a[2184]=0;
+  a[2185]=0;
+  a[2186]=0;
+  a[2187]=0;
+  a[2188]=0;
+  a[2189]=0;
+  a[2190]=0;
+  a[2191]=0;
+  a[2192]=0;
+  a[2193]=0;
+  a[2194]=0;
+  a[2195]=0;
+  a[2196]=0;
+  a[2197]=0;
+  a[2198]=0;
+  a[2199]=0;
+  a[2200]=0;
+  a[2201]=0;
+  a[2202]=0;
+  a[2203]=0;
+  a[2204]=0;
+  a[2205]=0;
+  a[2206]=0;
+  a[2207]=0;
+  a[2208]=0;
+  a[2209]=0;
+  a[2210]=0;
+  a[2211]=0;
+  a[2212]=0;
+  a[2213]=0;
+  a[2214]=0;
+  a[2215]=0;
+  a[2216]=0;
+  a[2217]=0;
+  a[2218]=0;
+  a[2219]=0;
+  a[2220]=0;
+  a[2221]=0;
+  a[2222]=0;
+  a[2223]=0;
+  a[2224]=0;
+  a[2225]=0;
+  a[2226]=0;
+  a[2227]=0;
+  a[2228]=0;
+  a[2229]=0;
+  a[2230]=0;
+  a[2231]=0;
+  a[2232]=0;
+  a[2233]=0;
+  a[2234]=0;
+  a[2235]=0;
+  a[2236]=0;
+  a[2237]=0;
+  a[2238]=0;
+  a[2239]=0;
+  a[2240]=0;
+  a[2241]=0;
+  a[2242]=0;
+  a[2243]=0;
+  a[2244]=0;
+  a[2245]=0;
+  a[2246]=0;
+  a[2247]=0;
+  a[2248]=0;
+  a[2249]=0;
+  a[2250]=0;
+  a[2251]=0;
+  a[2252]=0;
+  a[2253]=0;
+  a[2254]=0;
+  a[2255]=0;
+  a[2256]=0;
+  a[2257]=0;
+  a[2258]=0;
+  a[2259]=0;
+  a[2260]=0;
+  a[2261]=0;
+  a[2262]=0;
+  a[2263]=0;
+  a[2264]=0;
+  a[2265]=0;
+  a[2266]=0;
+  a[2267]=0;
+  a[2268]=0;
+  a[2269]=0;
+  a[2270]=0;
+  a[2271]=0;
+  a[2272]=0;
+  a[2273]=0;
+  a[2274]=0;
+  a[2275]=0;
+  a[2276]=0;
+  a[2277]=0;
+  a[2278]=0;
+  a[2279]=0;
+  a[2280]=0;
+  a[2281]=0;
+  a[2282]=0;
+  a[2283]=0;
+  a[2284]=0;
+  a[2285]=0;
+  a[2286]=0;
+  a[2287]=0;
+  a[2288]=0;
+  a[2289]=0;
+  a[2290]=0;
+  a[2291]=0;
+  a[2292]=0;
+  a[2293]=0;
+  a[2294]=0;
+  a[2295]=0;
+  a[2296]=0;
+  a[2297]=0;
+  a[2298]=0;
+  a[2299]=0;
+  a[2300]=0;
+  a[2301]=0;
+  a[2302]=0;
+  a[2303]=0;
+  a[2304]=0;
+  a[2305]=0;
+  a[2306]=0;
+  a[2307]=0;
+  a[2308]=0;
+  a[2309]=0;
+  a[2310]=0;
+  a[2311]=0;
+  a[2312]=0;
+  a[2313]=0;
+  a[2314]=0;
+  a[2315]=0;
+  a[2316]=0;
+  a[2317]=0;
+  a[2318]=0;
+  a[2319]=0;
+  a[2320]=0;
+  a[2321]=0;
+  a[2322]=0;
+  a[2323]=0;
+  a[2324]=0;
+  a[2325]=0;
+  a[2326]=0;
+  a[2327]=0;
+  a[2328]=0;
+  a[2329]=0;
+  a[2330]=0;
+  a[2331]=0;
+  a[2332]=0;
+  a[2333]=0;
+  a[2334]=0;
+  a[2335]=0;
+  a[2336]=0;
+  a[2337]=0;
+  a[2338]=0;
+  a[2339]=0;
+  a[2340]=0;
+  a[2341]=0;
+  a[2342]=0;
+  a[2343]=0;
+  a[2344]=0;
+  a[2345]=0;
+  a[2346]=0;
+  a[2347]=0;
+  a[2348]=0;
+  a[2349]=0;
+  a[2350]=0;
+  a[2351]=0;
+  a[2352]=0;
+  a[2353]=0;
+  a[2354]=0;
+  a[2355]=0;
+  a[2356]=0;
+  a[2357]=0;
+  a[2358]=0;
+  a[2359]=0;
+  a[2360]=0;
+  a[2361]=0;
+  a[2362]=0;
+  a[2363]=0;
+  a[2364]=0;
+  a[2365]=0;
+  a[2366]=0;
+  a[2367]=0;
+  a[2368]=0;
+  a[2369]=0;
+  a[2370]=0;
+  a[2371]=0;
+  a[2372]=0;
+  a[2373]=0;
+  a[2374]=0;
+  a[2375]=0;
+  a[2376]=0;
+  a[2377]=0;
+  a[2378]=0;
+  a[2379]=0;
+  a[2380]=0;
+  a[2381]=0;
+  a[2382]=0;
+  a[2383]=0;
+  a[2384]=0;
+  a[2385]=0;
+  a[2386]=0;
+  a[2387]=0;
+  a[2388]=0;
+  a[2389]=0;
+  a[2390]=0;
+  a[2391]=0;
+  a[2392]=0;
+  a[2393]=0;
+  a[2394]=0;
+  a[2395]=0;
+  a[2396]=0;
+  a[2397]=0;
+  a[2398]=0;
+  a[2399]=0;
+  a[2400]=0;
+  a[2401]=0;
+  a[2402]=0;
+  a[2403]=0;
+  a[2404]=0;
+  a[2405]=0;
+  a[2406]=0;
+  a[2407]=0;
+  a[2408]=0;
+  a[2409]=0;
+  a[2410]=0;
+  a[2411]=0;
+  a[2412]=0;
+  a[2413]=0;
+  a[2414]=0;
+  a[2415]=0;
+  a[2416]=0;
+  a[2417]=0;
+  a[2418]=0;
+  a[2419]=0;
+  a[2420]=0;
+  a[2421]=0;
+  a[2422]=0;
+  a[2423]=0;
+  a[2424]=0;
+  a[2425]=0;
+  a[2426]=0;
+  a[2427]=0;
+  a[2428]=0;
+  a[2429]=0;
+  a[2430]=0;
+  a[2431]=0;
+  a[2432]=0;
+  a[2433]=0;
+  a[2434]=0;
+  a[2435]=0;
+  a[2436]=0;
+  a[2437]=0;
+  a[2438]=0;
+  a[2439]=0;
+  a[2440]=0;
+  a[2441]=0;
+  a[2442]=0;
+  a[2443]=0;
+  a[2444]=0;
+  a[2445]=0;
+  a[2446]=0;
+  a[2447]=0;
+  a[2448]=0;
+  a[2449]=0;
+  a[2450]=0;
+  a[2451]=0;
+  a[2452]=0;
+  a[2453]=0;
+  a[2454]=0;
+  a[2455]=0;
+  a[2456]=0;
+  a[2457]=0;
+  a[2458]=0;
+  a[2459]=0;
+  a[2460]=0;
+  a[2461]=0;
+  a[2462]=0;
+  a[2463]=0;
+  a[2464]=0;
+  a[2465]=0;
+  a[2466]=0;
+  a[2467]=0;
+  a[2468]=0;
+  a[2469]=0;
+  a[2470]=0;
+  a[2471]=0;
+  a[2472]=0;
+  a[2473]=0;
+  a[2474]=0;
+  a[2475]=0;
+  a[2476]=0;
+  a[2477]=0;
+  a[2478]=0;
+  a[2479]=0;
+  a[2480]=0;
+  a[2481]=0;
+  a[2482]=0;
+  a[2483]=0;
+  a[2484]=0;
+  a[2485]=0;
+  a[2486]=0;
+  a[2487]=0;
+  a[2488]=0;
+  a[2489]=0;
+  a[2490]=0;
+  a[2491]=0;
+  a[2492]=0;
+  a[2493]=0;
+  a[2494]=0;
+  a[2495]=0;
+  a[2496]=0;
+  a[2497]=0;
+  a[2498]=0;
+  a[2499]=0;
+  a[2500]=0;
+  a[2501]=0;
+  a[2502]=0;
+  a[2503]=0;
+  a[2504]=0;
+  a[2505]=0;
+  a[2506]=0;
+  a[2507]=0;
+  a[2508]=0;
+  a[2509]=0;
+  a[2510]=0;
+  a[2511]=0;
+  a[2512]=0;
+  a[2513]=0;
+  a[2514]=0;
+  a[2515]=0;
+  a[2516]=0;
+  a[2517]=0;
+  a[2518]=0;
+  a[2519]=0;
+  a[2520]=0;
+  a[2521]=0;
+  a[2522]=0;
+  a[2523]=0;
+  a[2524]=0;
+  a[2525]=0;
+  a[2526]=0;
+  a[2527]=0;
+  a[2528]=0;
+  a[2529]=0;
+  a[2530]=0;
+  a[2531]=0;
+  a[2532]=0;
+  a[2533]=0;
+  a[2534]=0;
+  a[2535]=0;
+  a[2536]=0;
+  a[2537]=0;
+  a[2538]=0;
+  a[2539]=0;
+  a[2540]=0;
+  a[2541]=0;
+  a[2542]=0;
+  a[2543]=0;
+  a[2544]=0;
+  a[2545]=0;
+  a[2546]=0;
+  a[2547]=0;
+  a[2548]=0;
+  a[2549]=0;
+  a[2550]=0;
+  a[2551]=0;
+  a[2552]=0;
+  a[2553]=0;
+  a[2554]=0;
+  a[2555]=0;
+  a[2556]=0;
+  a[2557]=0;
+  a[2558]=0;
+  a[2559]=0;
+  a[2560]=0;
+  a[2561]=0;
+  a[2562]=0;
+  a[2563]=0;
+  a[2564]=0;
+  a[2565]=0;
+  a[2566]=0;
+  a[2567]=0;
+  a[2568]=0;
+  a[2569]=0;
+  a[2570]=0;
+  a[2571]=0;
+  a[2572]=0;
+  a[2573]=0;
+  a[2574]=0;
+  a[2575]=0;
+  a[2576]=0;
+  a[2577]=0;
+  a[2578]=0;
+  a[2579]=0;
+  a[2580]=0;
+  a[2581]=0;
+  a[2582]=0;
+  a[2583]=0;
+  a[2584]=0;
+  a[2585]=0;
+  a[2586]=0;
+  a[2587]=0;
+  a[2588]=0;
+  a[2589]=0;
+  a[2590]=0;
+  a[2591]=0;
+  a[2592]=0;
+  a[2593]=0;
+  a[2594]=0;
+  a[2595]=0;
+  a[2596]=0;
+  a[2597]=0;
+  a[2598]=0;
+  a[2599]=0;
+  a[2600]=0;
+  a[2601]=0;
+  a[2602]=0;
+  a[2603]=0;
+  a[2604]=0;
+  a[2605]=0;
+  a[2606]=0;
+  a[2607]=0;
+  a[2608]=0;
+  a[2609]=0;
+  a[2610]=0;
+  a[2611]=0;
+  a[2612]=0;
+  a[2613]=0;
+  a[2614]=0;
+  a[2615]=0;
+  a[2616]=0;
+  a[2617]=0;
+  a[2618]=0;
+  a[2619]=0;
+  a[2620]=0;
+  a[2621]=0;
+  a[2622]=0;
+  a[2623]=0;
+  a[2624]=0;
+  a[2625]=0;
+  a[2626]=0;
+  a[2627]=0;
+  a[2628]=0;
+  a[2629]=0;
+  a[2630]=0;
+  a[2631]=0;
+  a[2632]=0;
+  a[2633]=0;
+  a[2634]=0;
+  a[2635]=0;
+  a[2636]=0;
+  a[2637]=0;
+  a[2638]=0;
+  a[2639]=0;
+  a[2640]=0;
+  a[2641]=0;
+  a[2642]=0;
+  a[2643]=0;
+  a[2644]=0;
+  a[2645]=0;
+  a[2646]=0;
+  a[2647]=0;
+  a[2648]=0;
+  a[2649]=0;
+  a[2650]=0;
+  a[2651]=0;
+  a[2652]=0;
+  a[2653]=0;
+  a[2654]=0;
+  a[2655]=0;
+  a[2656]=0;
+  a[2657]=0;
+  a[2658]=0;
+  a[2659]=0;
+  a[2660]=0;
+  a[2661]=0;
+  a[2662]=0;
+  a[2663]=0;
+  a[2664]=0;
+  a[2665]=0;
+  a[2666]=0;
+  a[2667]=0;
+  a[2668]=0;
+  a[2669]=0;
+  a[2670]=0;
+  a[2671]=0;
+  a[2672]=0;
+  a[2673]=0;
+  a[2674]=0;
+  a[2675]=0;
+  a[2676]=0;
+  a[2677]=0;
+  a[2678]=0;
+  a[2679]=0;
+  a[2680]=0;
+  a[2681]=0;
+  a[2682]=0;
+  a[2683]=0;
+  a[2684]=0;
+  a[2685]=0;
+  a[2686]=0;
+  a[2687]=0;
+  a[2688]=0;
+  a[2689]=0;
+  a[2690]=0;
+  a[2691]=0;
+  a[2692]=0;
+  a[2693]=0;
+  a[2694]=0;
+  a[2695]=0;
+  a[2696]=0;
+  a[2697]=0;
+  a[2698]=0;
+  a[2699]=0;
+  a[2700]=0;
+  a[2701]=0;
+  a[2702]=0;
+  a[2703]=0;
+  a[2704]=0;
+  a[2705]=0;
+  a[2706]=0;
+  a[2707]=0;
+  a[2708]=0;
+  a[2709]=0;
+  a[2710]=0;
+  a[2711]=0;
+  a[2712]=0;
+  a[2713]=0;
+  a[2714]=0;
+  a[2715]=0;
+  a[2716]=0;
+  a[2717]=0;
+  a[2718]=0;
+  a[2719]=0;
+  a[2720]=0;
+  a[2721]=0;
+  a[2722]=0;
+  a[2723]=0;
+  a[2724]=0;
+  a[2725]=0;
+  a[2726]=0;
+  a[2727]=0;
+  a[2728]=0;
+  a[2729]=0;
+  a[2730]=0;
+  a[2731]=0;
+  a[2732]=0;
+  a[2733]=0;
+  a[2734]=0;
+  a[2735]=0;
+  a[2736]=0;
+  a[2737]=0;
+  a[2738]=0;
+  a[2739]=0;
+  a[2740]=0;
+  a[2741]=0;
+  a[2742]=0;
+  a[2743]=0;
+  a[2744]=0;
+  a[2745]=0;
+  a[2746]=0;
+  a[2747]=0;
+  a[2748]=0;
+  a[2749]=0;
+  a[2750]=0;
+  a[2751]=0;
+  a[2752]=0;
+  a[2753]=0;
+  a[2754]=0;
+  a[2755]=0;
+  a[2756]=0;
+  a[2757]=0;
+  a[2758]=0;
+  a[2759]=0;
+  a[2760]=0;
+  a[2761]=0;
+  a[2762]=0;
+  a[2763]=0;
+  a[2764]=0;
+  a[2765]=0;
+  a[2766]=0;
+  a[2767]=0;
+  a[2768]=0;
+  a[2769]=0;
+  a[2770]=0;
+  a[2771]=0;
+  a[2772]=0;
+  a[2773]=0;
+  a[2774]=0;
+  a[2775]=0;
+  a[2776]=0;
+  a[2777]=0;
+  a[2778]=0;
+  a[2779]=0;
+  a[2780]=0;
+  a[2781]=0;
+  a[2782]=0;
+  a[2783]=0;
+  a[2784]=0;
+  a[2785]=0;
+  a[2786]=0;
+  a[2787]=0;
+  a[2788]=0;
+  a[2789]=0;
+  a[2790]=0;
+  a[2791]=0;
+  a[2792]=0;
+  a[2793]=0;
+  a[2794]=0;
+  a[2795]=0;
+  a[2796]=0;
+  a[2797]=0;
+  a[2798]=0;
+  a[2799]=0;
+  a[2800]=0;
+  a[2801]=0;
+  a[2802]=0;
+  a[2803]=0;
+  a[2804]=0;
+  a[2805]=0;
+  a[2806]=0;
+  a[2807]=0;
+  a[2808]=0;
+  a[2809]=0;
+  a[2810]=0;
+  a[2811]=0;
+  a[2812]=0;
+  a[2813]=0;
+  a[2814]=0;
+  a[2815]=0;
+  a[2816]=0;
+  a[2817]=0;
+  a[2818]=0;
+  a[2819]=0;
+  a[2820]=0;
+  a[2821]=0;
+  a[2822]=0;
+  a[2823]=0;
+  a[2824]=0;
+  a[2825]=0;
+  a[2826]=0;
+  a[2827]=0;
+  a[2828]=0;
+  a[2829]=0;
+  a[2830]=0;
+  a[2831]=0;
+  a[2832]=0;
+  a[2833]=0;
+  a[2834]=0;
+  a[2835]=0;
+  a[2836]=0;
+  a[2837]=0;
+  a[2838]=0;
+  a[2839]=0;
+  a[2840]=0;
+  a[2841]=0;
+  a[2842]=0;
+  a[2843]=0;
+  a[2844]=0;
+  a[2845]=0;
+  a[2846]=0;
+  a[2847]=0;
+  a[2848]=0;
+  a[2849]=0;
+  a[2850]=0;
+  a[2851]=0;
+  a[2852]=0;
+  a[2853]=0;
+  a[2854]=0;
+  a[2855]=0;
+  a[2856]=0;
+  a[2857]=0;
+  a[2858]=0;
+  a[2859]=0;
+  a[2860]=0;
+  a[2861]=0;
+  a[2862]=0;
+  a[2863]=0;
+  a[2864]=0;
+  a[2865]=0;
+  a[2866]=0;
+  a[2867]=0;
+  a[2868]=0;
+  a[2869]=0;
+  a[2870]=0;
+  a[2871]=0;
+  a[2872]=0;
+  a[2873]=0;
+  a[2874]=0;
+  a[2875]=0;
+  a[2876]=0;
+  a[2877]=0;
+  a[2878]=0;
+  a[2879]=0;
+  a[2880]=0;
+  a[2881]=0;
+  a[2882]=0;
+  a[2883]=0;
+  a[2884]=0;
+  a[2885]=0;
+  a[2886]=0;
+  a[2887]=0;
+  a[2888]=0;
+  a[2889]=0;
+  a[2890]=0;
+  a[2891]=0;
+  a[2892]=0;
+  a[2893]=0;
+  a[2894]=0;
+  a[2895]=0;
+  a[2896]=0;
+  a[2897]=0;
+  a[2898]=0;
+  a[2899]=0;
+  a[2900]=0;
+  a[2901]=0;
+  a[2902]=0;
+  a[2903]=0;
+  a[2904]=0;
+  a[2905]=0;
+  a[2906]=0;
+  a[2907]=0;
+  a[2908]=0;
+  a[2909]=0;
+  a[2910]=0;
+  a[2911]=0;
+  a[2912]=0;
+  a[2913]=0;
+  a[2914]=0;
+  a[2915]=0;
+  a[2916]=0;
+  a[2917]=0;
+  a[2918]=0;
+  a[2919]=0;
+  a[2920]=0;
+  a[2921]=0;
+  a[2922]=0;
+  a[2923]=0;
+  a[2924]=0;
+  a[2925]=0;
+  a[2926]=0;
+  a[2927]=0;
+  a[2928]=0;
+  a[2929]=0;
+  a[2930]=0;
+  a[2931]=0;
+  a[2932]=0;
+  a[2933]=0;
+  a[2934]=0;
+  a[2935]=0;
+  a[2936]=0;
+  a[2937]=0;
+  a[2938]=0;
+  a[2939]=0;
+  a[2940]=0;
+  a[2941]=0;
+  a[2942]=0;
+  a[2943]=0;
+  a[2944]=0;
+  a[2945]=0;
+  a[2946]=0;
+  a[2947]=0;
+  a[2948]=0;
+  a[2949]=0;
+  a[2950]=0;
+  a[2951]=0;
+  a[2952]=0;
+  a[2953]=0;
+  a[2954]=0;
+  a[2955]=0;
+  a[2956]=0;
+  a[2957]=0;
+  a[2958]=0;
+  a[2959]=0;
+  a[2960]=0;
+  a[2961]=0;
+  a[2962]=0;
+  a[2963]=0;
+  a[2964]=0;
+  a[2965]=0;
+  a[2966]=0;
+  a[2967]=0;
+  a[2968]=0;
+  a[2969]=0;
+  a[2970]=0;
+  a[2971]=0;
+  a[2972]=0;
+  a[2973]=0;
+  a[2974]=0;
+  a[2975]=0;
+  a[2976]=0;
+  a[2977]=0;
+  a[2978]=0;
+  a[2979]=0;
+  a[2980]=0;
+  a[2981]=0;
+  a[2982]=0;
+  a[2983]=0;
+  a[2984]=0;
+  a[2985]=0;
+  a[2986]=0;
+  a[2987]=0;
+  a[2988]=0;
+  a[2989]=0;
+  a[2990]=0;
+  a[2991]=0;
+  a[2992]=0;
+  a[2993]=0;
+  a[2994]=0;
+  a[2995]=0;
+  a[2996]=0;
+  a[2997]=0;
+  a[2998]=0;
+  a[2999]=0;
+  a[3000]=0;
+  a[3001]=0;
+  a[3002]=0;
+  a[3003]=0;
+  a[3004]=0;
+  a[3005]=0;
+  a[3006]=0;
+  a[3007]=0;
+  a[3008]=0;
+  a[3009]=0;
+  a[3010]=0;
+  a[3011]=0;
+  a[3012]=0;
+  a[3013]=0;
+  a[3014]=0;
+  a[3015]=0;
+  a[3016]=0;
+  a[3017]=0;
+  a[3018]=0;
+  a[3019]=0;
+  a[3020]=0;
+  a[3021]=0;
+  a[3022]=0;
+  a[3023]=0;
+  a[3024]=0;
+  a[3025]=0;
+  a[3026]=0;
+  a[3027]=0;
+  a[3028]=0;
+  a[3029]=0;
+  a[3030]=0;
+  a[3031]=0;
+  a[3032]=0;
+  a[3033]=0;
+  a[3034]=0;
+  a[3035]=0;
+  a[3036]=0;
+  a[3037]=0;
+  a[3038]=0;
+  a[3039]=0;
+  a[3040]=0;
+  a[3041]=0;
+  a[3042]=0;
+  a[3043]=0;
+  a[3044]=0;
+  a[3045]=0;
+  a[3046]=0;
+  a[3047]=0;
+  a[3048]=0;
+  a[3049]=0;
+  a[3050]=0;
+  a[3051]=0;
+  a[3052]=0;
+  a[3053]=0;
+  a[3054]=0;
+  a[3055]=0;
+  a[3056]=0;
+  a[3057]=0;
+  a[3058]=0;
+  a[3059]=0;
+  a[3060]=0;
+  a[3061]=0;
+  a[3062]=0;
+  a[3063]=0;
+  a[3064]=0;
+  a[3065]=0;
+  a[3066]=0;
+  a[3067]=0;
+  a[3068]=0;
+  a[3069]=0;
+  a[3070]=0;
+  a[3071]=0;
+  a[3072]=0;
+  a[3073]=0;
+  a[3074]=0;
+  a[3075]=0;
+  a[3076]=0;
+  a[3077]=0;
+  a[3078]=0;
+  a[3079]=0;
+  a[3080]=0;
+  a[3081]=0;
+  a[3082]=0;
+  a[3083]=0;
+  a[3084]=0;
+  a[3085]=0;
+  a[3086]=0;
+  a[3087]=0;
+  a[3088]=0;
+  a[3089]=0;
+  a[3090]=0;
+  a[3091]=0;
+  a[3092]=0;
+  a[3093]=0;
+  a[3094]=0;
+  a[3095]=0;
+  a[3096]=0;
+  a[3097]=0;
+  a[3098]=0;
+  a[3099]=0;
+  a[3100]=0;
+  a[3101]=0;
+  a[3102]=0;
+  a[3103]=0;
+  a[3104]=0;
+  a[3105]=0;
+  a[3106]=0;
+  a[3107]=0;
+  a[3108]=0;
+  a[3109]=0;
+  a[3110]=0;
+  a[3111]=0;
+  a[3112]=0;
+  a[3113]=0;
+  a[3114]=0;
+  a[3115]=0;
+  a[3116]=0;
+  a[3117]=0;
+  a[3118]=0;
+  a[3119]=0;
+  a[3120]=0;
+  a[3121]=0;
+  a[3122]=0;
+  a[3123]=0;
+  a[3124]=0;
+  a[3125]=0;
+  a[3126]=0;
+  a[3127]=0;
+  a[3128]=0;
+  a[3129]=0;
+  a[3130]=0;
+  a[3131]=0;
+  a[3132]=0;
+  a[3133]=0;
+  a[3134]=0;
+  a[3135]=0;
+  a[3136]=0;
+  a[3137]=0;
+  a[3138]=0;
+  a[3139]=0;
+  a[3140]=0;
+  a[3141]=0;
+  a[3142]=0;
+  a[3143]=0;
+  a[3144]=0;
+  a[3145]=0;
+  a[3146]=0;
+  a[3147]=0;
+  a[3148]=0;
+  a[3149]=0;
+  a[3150]=0;
+  a[3151]=0;
+  a[3152]=0;
+  a[3153]=0;
+  a[3154]=0;
+  a[3155]=0;
+  a[3156]=0;
+  a[3157]=0;
+  a[3158]=0;
+  a[3159]=0;
+  a[3160]=0;
+  a[3161]=0;
+  a[3162]=0;
+  a[3163]=0;
+  a[3164]=0;
+  a[3165]=0;
+  a[3166]=0;
+  a[3167]=0;
+  a[3168]=0;
+  a[3169]=0;
+  a[3170]=0;
+  a[3171]=0;
+  a[3172]=0;
+  a[3173]=0;
+  a[3174]=0;
+  a[3175]=0;
+  a[3176]=0;
+  a[3177]=0;
+  a[3178]=0;
+  a[3179]=0;
+  a[3180]=0;
+  a[3181]=0;
+  a[3182]=0;
+  a[3183]=0;
+  a[3184]=0;
+  a[3185]=0;
+  a[3186]=0;
+  a[3187]=0;
+  a[3188]=0;
+  a[3189]=0;
+  a[3190]=0;
+  a[3191]=0;
+  a[3192]=0;
+  a[3193]=0;
+  a[3194]=0;
+  a[3195]=0;
+  a[3196]=0;
+  a[3197]=0;
+  a[3198]=0;
+  a[3199]=0;
+  a[3200]=0;
+  a[3201]=0;
+  a[3202]=0;
+  a[3203]=0;
+  a[3204]=0;
+  a[3205]=0;
+  a[3206]=0;
+  a[3207]=0;
+  a[3208]=0;
+  a[3209]=0;
+  a[3210]=0;
+  a[3211]=0;
+  a[3212]=0;
+  a[3213]=0;
+  a[3214]=0;
+  a[3215]=0;
+  a[3216]=0;
+  a[3217]=0;
+  a[3218]=0;
+  a[3219]=0;
+  a[3220]=0;
+  a[3221]=0;
+  a[3222]=0;
+  a[3223]=0;
+  a[3224]=0;
+  a[3225]=0;
+  a[3226]=0;
+  a[3227]=0;
+  a[3228]=0;
+  a[3229]=0;
+  a[3230]=0;
+  a[3231]=0;
+  a[3232]=0;
+  a[3233]=0;
+  a[3234]=0;
+  a[3235]=0;
+  a[3236]=0;
+  a[3237]=0;
+  a[3238]=0;
+  a[3239]=0;
+  a[3240]=0;
+  a[3241]=0;
+  a[3242]=0;
+  a[3243]=0;
+  a[3244]=0;
+  a[3245]=0;
+  a[3246]=0;
+  a[3247]=0;
+  a[3248]=0;
+  a[3249]=0;
+  a[3250]=0;
+  a[3251]=0;
+  a[3252]=0;
+  a[3253]=0;
+  a[3254]=0;
+  a[3255]=0;
+  a[3256]=0;
+  a[3257]=0;
+  a[3258]=0;
+  a[3259]=0;
+  a[3260]=0;
+  a[3261]=0;
+  a[3262]=0;
+  a[3263]=0;
+  a[3264]=0;
+  a[3265]=0;
+  a[3266]=0;
+  a[3267]=0;
+  a[3268]=0;
+  a[3269]=0;
+  a[3270]=0;
+  a[3271]=0;
+  a[3272]=0;
+  a[3273]=0;
+  a[3274]=0;
+  a[3275]=0;
+  a[3276]=0;
+  a[3277]=0;
+  a[3278]=0;
+  a[3279]=0;
+  a[3280]=0;
+  a[3281]=0;
+  a[3282]=0;
+  a[3283]=0;
+  a[3284]=0;
+  a[3285]=0;
+  a[3286]=0;
+  a[3287]=0;
+  a[3288]=0;
+  a[3289]=0;
+  a[3290]=0;
+  a[3291]=0;
+  a[3292]=0;
+  a[3293]=0;
+  a[3294]=0;
+  a[3295]=0;
+  a[3296]=0;
+  a[3297]=0;
+  a[3298]=0;
+  a[3299]=0;
+  a[3300]=0;
+  a[3301]=0;
+  a[3302]=0;
+  a[3303]=0;
+  a[3304]=0;
+  a[3305]=0;
+  a[3306]=0;
+  a[3307]=0;
+  a[3308]=0;
+  a[3309]=0;
+  a[3310]=0;
+  a[3311]=0;
+  a[3312]=0;
+  a[3313]=0;
+  a[3314]=0;
+  a[3315]=0;
+  a[3316]=0;
+  a[3317]=0;
+  a[3318]=0;
+  a[3319]=0;
+  a[3320]=0;
+  a[3321]=0;
+  a[3322]=0;
+  a[3323]=0;
+  a[3324]=0;
+  a[3325]=0;
+  a[3326]=0;
+  a[3327]=0;
+  a[3328]=0;
+  a[3329]=0;
+  a[3330]=0;
+  a[3331]=0;
+  a[3332]=0;
+  a[3333]=0;
+  a[3334]=0;
+  a[3335]=0;
+  a[3336]=0;
+  a[3337]=0;
+  a[3338]=0;
+  a[3339]=0;
+  a[3340]=0;
+  a[3341]=0;
+  a[3342]=0;
+  a[3343]=0;
+  a[3344]=0;
+  a[3345]=0;
+  a[3346]=0;
+  a[3347]=0;
+  a[3348]=0;
+  a[3349]=0;
+  a[3350]=0;
+  a[3351]=0;
+  a[3352]=0;
+  a[3353]=0;
+  a[3354]=0;
+  a[3355]=0;
+  a[3356]=0;
+  a[3357]=0;
+  a[3358]=0;
+  a[3359]=0;
+  a[3360]=0;
+  a[3361]=0;
+  a[3362]=0;
+  a[3363]=0;
+  a[3364]=0;
+  a[3365]=0;
+  a[3366]=0;
+  a[3367]=0;
+  a[3368]=0;
+  a[3369]=0;
+  a[3370]=0;
+  a[3371]=0;
+  a[3372]=0;
+  a[3373]=0;
+  a[3374]=0;
+  a[3375]=0;
+  a[3376]=0;
+  a[3377]=0;
+  a[3378]=0;
+  a[3379]=0;
+  a[3380]=0;
+  a[3381]=0;
+  a[3382]=0;
+  a[3383]=0;
+  a[3384]=0;
+  a[3385]=0;
+  a[3386]=0;
+  a[3387]=0;
+  a[3388]=0;
+  a[3389]=0;
+  a[3390]=0;
+  a[3391]=0;
+  a[3392]=0;
+  a[3393]=0;
+  a[3394]=0;
+  a[3395]=0;
+  a[3396]=0;
+  a[3397]=0;
+  a[3398]=0;
+  a[3399]=0;
+  a[3400]=0;
+  a[3401]=0;
+  a[3402]=0;
+  a[3403]=0;
+  a[3404]=0;
+  a[3405]=0;
+  a[3406]=0;
+  a[3407]=0;
+  a[3408]=0;
+  a[3409]=0;
+  a[3410]=0;
+  a[3411]=0;
+  a[3412]=0;
+  a[3413]=0;
+  a[3414]=0;
+  a[3415]=0;
+  a[3416]=0;
+  a[3417]=0;
+  a[3418]=0;
+  a[3419]=0;
+  a[3420]=0;
+  a[3421]=0;
+  a[3422]=0;
+  a[3423]=0;
+  a[3424]=0;
+  a[3425]=0;
+  a[3426]=0;
+  a[3427]=0;
+  a[3428]=0;
+  a[3429]=0;
+  a[3430]=0;
+  a[3431]=0;
+  a[3432]=0;
+  a[3433]=0;
+  a[3434]=0;
+  a[3435]=0;
+  a[3436]=0;
+  a[3437]=0;
+  a[3438]=0;
+  a[3439]=0;
+  a[3440]=0;
+  a[3441]=0;
+  a[3442]=0;
+  a[3443]=0;
+  a[3444]=0;
+  a[3445]=0;
+  a[3446]=0;
+  a[3447]=0;
+  a[3448]=0;
+  a[3449]=0;
+  a[3450]=0;
+  a[3451]=0;
+  a[3452]=0;
+  a[3453]=0;
+  a[3454]=0;
+  a[3455]=0;
+  a[3456]=0;
+  a[3457]=0;
+  a[3458]=0;
+  a[3459]=0;
+  a[3460]=0;
+  a[3461]=0;
+  a[3462]=0;
+  a[3463]=0;
+  a[3464]=0;
+  a[3465]=0;
+  a[3466]=0;
+  a[3467]=0;
+  a[3468]=0;
+  a[3469]=0;
+  a[3470]=0;
+  a[3471]=0;
+  a[3472]=0;
+  a[3473]=0;
+  a[3474]=0;
+  a[3475]=0;
+  a[3476]=0;
+  a[3477]=0;
+  a[3478]=0;
+  a[3479]=0;
+  a[3480]=0;
+  a[3481]=0;
+  a[3482]=0;
+  a[3483]=0;
+  a[3484]=0;
+  a[3485]=0;
+  a[3486]=0;
+  a[3487]=0;
+  a[3488]=0;
+  a[3489]=0;
+  a[3490]=0;
+  a[3491]=0;
+  a[3492]=0;
+  a[3493]=0;
+  a[3494]=0;
+  a[3495]=0;
+  a[3496]=0;
+  a[3497]=0;
+  a[3498]=0;
+  a[3499]=0;
+  a[3500]=0;
+  a[3501]=0;
+  a[3502]=0;
+  a[3503]=0;
+  a[3504]=0;
+  a[3505]=0;
+  a[3506]=0;
+  a[3507]=0;
+  a[3508]=0;
+  a[3509]=0;
+  a[3510]=0;
+  a[3511]=0;
+  a[3512]=0;
+  a[3513]=0;
+  a[3514]=0;
+  a[3515]=0;
+  a[3516]=0;
+  a[3517]=0;
+  a[3518]=0;
+  a[3519]=0;
+  a[3520]=0;
+  a[3521]=0;
+  a[3522]=0;
+  a[3523]=0;
+  a[3524]=0;
+  a[3525]=0;
+  a[3526]=0;
+  a[3527]=0;
+  a[3528]=0;
+  a[3529]=0;
+  a[3530]=0;
+  a[3531]=0;
+  a[3532]=0;
+  a[3533]=0;
+  a[3534]=0;
+  a[3535]=0;
+  a[3536]=0;
+  a[3537]=0;
+  a[3538]=0;
+  a[3539]=0;
+  a[3540]=0;
+  a[3541]=0;
+  a[3542]=0;
+  a[3543]=0;
+  a[3544]=0;
+  a[3545]=0;
+  a[3546]=0;
+  a[3547]=0;
+  a[3548]=0;
+  a[3549]=0;
+  a[3550]=0;
+  a[3551]=0;
+  a[3552]=0;
+  a[3553]=0;
+  a[3554]=0;
+  a[3555]=0;
+  a[3556]=0;
+  a[3557]=0;
+  a[3558]=0;
+  a[3559]=0;
+  a[3560]=0;
+  a[3561]=0;
+  a[3562]=0;
+  a[3563]=0;
+  a[3564]=0;
+  a[3565]=0;
+  a[3566]=0;
+  a[3567]=0;
+  a[3568]=0;
+  a[3569]=0;
+  a[3570]=0;
+  a[3571]=0;
+  a[3572]=0;
+  a[3573]=0;
+  a[3574]=0;
+  a[3575]=0;
+  a[3576]=0;
+  a[3577]=0;
+  a[3578]=0;
+  a[3579]=0;
+  a[3580]=0;
+  a[3581]=0;
+  a[3582]=0;
+  a[3583]=0;
+  a[3584]=0;
+  a[3585]=0;
+  a[3586]=0;
+  a[3587]=0;
+  a[3588]=0;
+  a[3589]=0;
+  a[3590]=0;
+  a[3591]=0;
+  a[3592]=0;
+  a[3593]=0;
+  a[3594]=0;
+  a[3595]=0;
+  a[3596]=0;
+  a[3597]=0;
+  a[3598]=0;
+  a[3599]=0;
+  a[3600]=0;
+  a[3601]=0;
+  a[3602]=0;
+  a[3603]=0;
+  a[3604]=0;
+  a[3605]=0;
+  a[3606]=0;
+  a[3607]=0;
+  a[3608]=0;
+  a[3609]=0;
+  a[3610]=0;
+  a[3611]=0;
+  a[3612]=0;
+  a[3613]=0;
+  a[3614]=0;
+  a[3615]=0;
+  a[3616]=0;
+  a[3617]=0;
+  a[3618]=0;
+  a[3619]=0;
+  a[3620]=0;
+  a[3621]=0;
+  a[3622]=0;
+  a[3623]=0;
+  a[3624]=0;
+  a[3625]=0;
+  a[3626]=0;
+  a[3627]=0;
+  a[3628]=0;
+  a[3629]=0;
+  a[3630]=0;
+  a[3631]=0;
+  a[3632]=0;
+  a[3633]=0;
+  a[3634]=0;
+  a[3635]=0;
+  a[3636]=0;
+  a[3637]=0;
+  a[3638]=0;
+  a[3639]=0;
+  a[3640]=0;
+  a[3641]=0;
+  a[3642]=0;
+  a[3643]=0;
+  a[3644]=0;
+  a[3645]=0;
+  a[3646]=0;
+  a[3647]=0;
+  a[3648]=0;
+  a[3649]=0;
+  a[3650]=0;
+  a[3651]=0;
+  a[3652]=0;
+  a[3653]=0;
+  a[3654]=0;
+  a[3655]=0;
+  a[3656]=0;
+  a[3657]=0;
+  a[3658]=0;
+  a[3659]=0;
+  a[3660]=0;
+  a[3661]=0;
+  a[3662]=0;
+  a[3663]=0;
+  a[3664]=0;
+  a[3665]=0;
+  a[3666]=0;
+  a[3667]=0;
+  a[3668]=0;
+  a[3669]=0;
+  a[3670]=0;
+  a[3671]=0;
+  a[3672]=0;
+  a[3673]=0;
+  a[3674]=0;
+  a[3675]=0;
+  a[3676]=0;
+  a[3677]=0;
+  a[3678]=0;
+  a[3679]=0;
+  a[3680]=0;
+  a[3681]=0;
+  a[3682]=0;
+  a[3683]=0;
+  a[3684]=0;
+  a[3685]=0;
+  a[3686]=0;
+  a[3687]=0;
+  a[3688]=0;
+  a[3689]=0;
+  a[3690]=0;
+  a[3691]=0;
+  a[3692]=0;
+  a[3693]=0;
+  a[3694]=0;
+  a[3695]=0;
+  a[3696]=0;
+  a[3697]=0;
+  a[3698]=0;
+  a[3699]=0;
+  a[3700]=0;
+  a[3701]=0;
+  a[3702]=0;
+  a[3703]=0;
+  a[3704]=0;
+  a[3705]=0;
+  a[3706]=0;
+  a[3707]=0;
+  a[3708]=0;
+  a[3709]=0;
+  a[3710]=0;
+  a[3711]=0;
+  a[3712]=0;
+  a[3713]=0;
+  a[3714]=0;
+  a[3715]=0;
+  a[3716]=0;
+  a[3717]=0;
+  a[3718]=0;
+  a[3719]=0;
+  a[3720]=0;
+  a[3721]=0;
+  a[3722]=0;
+  a[3723]=0;
+  a[3724]=0;
+  a[3725]=0;
+  a[3726]=0;
+  a[3727]=0;
+  a[3728]=0;
+  a[3729]=0;
+  a[3730]=0;
+  a[3731]=0;
+  a[3732]=0;
+  a[3733]=0;
+  a[3734]=0;
+  a[3735]=0;
+  a[3736]=0;
+  a[3737]=0;
+  a[3738]=0;
+  a[3739]=0;
+  a[3740]=0;
+  a[3741]=0;
+  a[3742]=0;
+  a[3743]=0;
+  a[3744]=0;
+  a[3745]=0;
+  a[3746]=0;
+  a[3747]=0;
+  a[3748]=0;
+  a[3749]=0;
+  a[3750]=0;
+  a[3751]=0;
+  a[3752]=0;
+  a[3753]=0;
+  a[3754]=0;
+  a[3755]=0;
+  a[3756]=0;
+  a[3757]=0;
+  a[3758]=0;
+  a[3759]=0;
+  a[3760]=0;
+  a[3761]=0;
+  a[3762]=0;
+  a[3763]=0;
+  a[3764]=0;
+  a[3765]=0;
+  a[3766]=0;
+  a[3767]=0;
+  a[3768]=0;
+  a[3769]=0;
+  a[3770]=0;
+  a[3771]=0;
+  a[3772]=0;
+  a[3773]=0;
+  a[3774]=0;
+  a[3775]=0;
+  a[3776]=0;
+  a[3777]=0;
+  a[3778]=0;
+  a[3779]=0;
+  a[3780]=0;
+  a[3781]=0;
+  a[3782]=0;
+  a[3783]=0;
+  a[3784]=0;
+  a[3785]=0;
+  a[3786]=0;
+  a[3787]=0;
+  a[3788]=0;
+  a[3789]=0;
+  a[3790]=0;
+  a[3791]=0;
+  a[3792]=0;
+  a[3793]=0;
+  a[3794]=0;
+  a[3795]=0;
+  a[3796]=0;
+  a[3797]=0;
+  a[3798]=0;
+  a[3799]=0;
+  a[3800]=0;
+  a[3801]=0;
+  a[3802]=0;
+  a[3803]=0;
+  a[3804]=0;
+  a[3805]=0;
+  a[3806]=0;
+  a[3807]=0;
+  a[3808]=0;
+  a[3809]=0;
+  a[3810]=0;
+  a[3811]=0;
+  a[3812]=0;
+  a[3813]=0;
+  a[3814]=0;
+  a[3815]=0;
+  a[3816]=0;
+  a[3817]=0;
+  a[3818]=0;
+  a[3819]=0;
+  a[3820]=0;
+  a[3821]=0;
+  a[3822]=0;
+  a[3823]=0;
+  a[3824]=0;
+  a[3825]=0;
+  a[3826]=0;
+  a[3827]=0;
+  a[3828]=0;
+  a[3829]=0;
+  a[3830]=0;
+  a[3831]=0;
+  a[3832]=0;
+  a[3833]=0;
+  a[3834]=0;
+  a[3835]=0;
+  a[3836]=0;
+  a[3837]=0;
+  a[3838]=0;
+  a[3839]=0;
+  a[3840]=0;
+  a[3841]=0;
+  a[3842]=0;
+  a[3843]=0;
+  a[3844]=0;
+  a[3845]=0;
+  a[3846]=0;
+  a[3847]=0;
+  a[3848]=0;
+  a[3849]=0;
+  a[3850]=0;
+  a[3851]=0;
+  a[3852]=0;
+  a[3853]=0;
+  a[3854]=0;
+  a[3855]=0;
+  a[3856]=0;
+  a[3857]=0;
+  a[3858]=0;
+  a[3859]=0;
+  a[3860]=0;
+  a[3861]=0;
+  a[3862]=0;
+  a[3863]=0;
+  a[3864]=0;
+  a[3865]=0;
+  a[3866]=0;
+  a[3867]=0;
+  a[3868]=0;
+  a[3869]=0;
+  a[3870]=0;
+  a[3871]=0;
+  a[3872]=0;
+  a[3873]=0;
+  a[3874]=0;
+  a[3875]=0;
+  a[3876]=0;
+  a[3877]=0;
+  a[3878]=0;
+  a[3879]=0;
+  a[3880]=0;
+  a[3881]=0;
+  a[3882]=0;
+  a[3883]=0;
+  a[3884]=0;
+  a[3885]=0;
+  a[3886]=0;
+  a[3887]=0;
+  a[3888]=0;
+  a[3889]=0;
+  a[3890]=0;
+  a[3891]=0;
+  a[3892]=0;
+  a[3893]=0;
+  a[3894]=0;
+  a[3895]=0;
+  a[3896]=0;
+  a[3897]=0;
+  a[3898]=0;
+  a[3899]=0;
+  a[3900]=0;
+  a[3901]=0;
+  a[3902]=0;
+  a[3903]=0;
+  a[3904]=0;
+  a[3905]=0;
+  a[3906]=0;
+  a[3907]=0;
+  a[3908]=0;
+  a[3909]=0;
+  a[3910]=0;
+  a[3911]=0;
+  a[3912]=0;
+  a[3913]=0;
+  a[3914]=0;
+  a[3915]=0;
+  a[3916]=0;
+  a[3917]=0;
+  a[3918]=0;
+  a[3919]=0;
+  a[3920]=0;
+  a[3921]=0;
+  a[3922]=0;
+  a[3923]=0;
+  a[3924]=0;
+  a[3925]=0;
+  a[3926]=0;
+  a[3927]=0;
+  a[3928]=0;
+  a[3929]=0;
+  a[3930]=0;
+  a[3931]=0;
+  a[3932]=0;
+  a[3933]=0;
+  a[3934]=0;
+  a[3935]=0;
+  a[3936]=0;
+  a[3937]=0;
+  a[3938]=0;
+  a[3939]=0;
+  a[3940]=0;
+  a[3941]=0;
+  a[3942]=0;
+  a[3943]=0;
+  a[3944]=0;
+  a[3945]=0;
+  a[3946]=0;
+  a[3947]=0;
+  a[3948]=0;
+  a[3949]=0;
+  a[3950]=0;
+  a[3951]=0;
+  a[3952]=0;
+  a[3953]=0;
+  a[3954]=0;
+  a[3955]=0;
+  a[3956]=0;
+  a[3957]=0;
+  a[3958]=0;
+  a[3959]=0;
+  a[3960]=0;
+  a[3961]=0;
+  a[3962]=0;
+  a[3963]=0;
+  a[3964]=0;
+  a[3965]=0;
+  a[3966]=0;
+  a[3967]=0;
+  a[3968]=0;
+  a[3969]=0;
+  a[3970]=0;
+  a[3971]=0;
+  a[3972]=0;
+  a[3973]=0;
+  a[3974]=0;
+  a[3975]=0;
+  a[3976]=0;
+  a[3977]=0;
+  a[3978]=0;
+  a[3979]=0;
+  a[3980]=0;
+  a[3981]=0;
+  a[3982]=0;
+  a[3983]=0;
+  a[3984]=0;
+  a[3985]=0;
+  a[3986]=0;
+  a[3987]=0;
+  a[3988]=0;
+  a[3989]=0;
+  a[3990]=0;
+  a[3991]=0;
+  a[3992]=0;
+  a[3993]=0;
+  a[3994]=0;
+  a[3995]=0;
+  a[3996]=0;
+  a[3997]=0;
+  a[3998]=0;
+  a[3999]=0;
+  a[4000]=0;
+  a[4001]=0;
+  a[4002]=0;
+  a[4003]=0;
+  a[4004]=0;
+  a[4005]=0;
+  a[4006]=0;
+  a[4007]=0;
+  a[4008]=0;
+  a[4009]=0;
+  a[4010]=0;
+  a[4011]=0;
+  a[4012]=0;
+  a[4013]=0;
+  a[4014]=0;
+  a[4015]=0;
+  a[4016]=0;
+  a[4017]=0;
+  a[4018]=0;
+  a[4019]=0;
+  a[4020]=0;
+  a[4021]=0;
+  a[4022]=0;
+  a[4023]=0;
+  a[4024]=0;
+  a[4025]=0;
+  a[4026]=0;
+  a[4027]=0;
+  a[4028]=0;
+  a[4029]=0;
+  a[4030]=0;
+  a[4031]=0;
+  a[4032]=0;
+  a[4033]=0;
+  a[4034]=0;
+  a[4035]=0;
+  a[4036]=0;
+  a[4037]=0;
+  a[4038]=0;
+  a[4039]=0;
+  a[4040]=0;
+  a[4041]=0;
+  a[4042]=0;
+  a[4043]=0;
+  a[4044]=0;
+  a[4045]=0;
+  a[4046]=0;
+  a[4047]=0;
+  a[4048]=0;
+  a[4049]=0;
+  a[4050]=0;
+  a[4051]=0;
+  a[4052]=0;
+  a[4053]=0;
+  a[4054]=0;
+  a[4055]=0;
+  a[4056]=0;
+  a[4057]=0;
+  a[4058]=0;
+  a[4059]=0;
+  a[4060]=0;
+  a[4061]=0;
+  a[4062]=0;
+  a[4063]=0;
+  a[4064]=0;
+  a[4065]=0;
+  a[4066]=0;
+  a[4067]=0;
+  a[4068]=0;
+  a[4069]=0;
+  a[4070]=0;
+  a[4071]=0;
+  a[4072]=0;
+  a[4073]=0;
+  a[4074]=0;
+  a[4075]=0;
+  a[4076]=0;
+  a[4077]=0;
+  a[4078]=0;
+  a[4079]=0;
+  a[4080]=0;
+  a[4081]=0;
+  a[4082]=0;
+  a[4083]=0;
+  a[4084]=0;
+  a[4085]=0;
+  a[4086]=0;
+  a[4087]=0;
+  a[4088]=0;
+  a[4089]=0;
+  a[4090]=0;
+  a[4091]=0;
+  a[4092]=0;
+  a[4093]=0;
+  a[4094]=0;
+  a[4095]=0;
+  a[4096]=0;
+  a[4097]=0;
+  a[4098]=0;
+  a[4099]=0;
+  a[4100]=0;
+  a[4101]=0;
+  a[4102]=0;
+  a[4103]=0;
+  a[4104]=0;
+  a[4105]=0;
+  a[4106]=0;
+  a[4107]=0;
+  a[4108]=0;
+  a[4109]=0;
+  a[4110]=0;
+  a[4111]=0;
+  a[4112]=0;
+  a[4113]=0;
+  a[4114]=0;
+  a[4115]=0;
+  a[4116]=0;
+  a[4117]=0;
+  a[4118]=0;
+  a[4119]=0;
+  a[4120]=0;
+  a[4121]=0;
+  a[4122]=0;
+  a[4123]=0;
+  a[4124]=0;
+  a[4125]=0;
+  a[4126]=0;
+  a[4127]=0;
+  a[4128]=0;
+  a[4129]=0;
+  a[4130]=0;
+  a[4131]=0;
+  a[4132]=0;
+  a[4133]=0;
+  a[4134]=0;
+  a[4135]=0;
+  a[4136]=0;
+  a[4137]=0;
+  a[4138]=0;
+  a[4139]=0;
+  a[4140]=0;
+  a[4141]=0;
+  a[4142]=0;
+  a[4143]=0;
+  a[4144]=0;
+  a[4145]=0;
+  a[4146]=0;
+  a[4147]=0;
+  a[4148]=0;
+  a[4149]=0;
+  a[4150]=0;
+  a[4151]=0;
+  a[4152]=0;
+  a[4153]=0;
+  a[4154]=0;
+  a[4155]=0;
+  a[4156]=0;
+  a[4157]=0;
+  a[4158]=0;
+  a[4159]=0;
+  a[4160]=0;
+  a[4161]=0;
+  a[4162]=0;
+  a[4163]=0;
+  a[4164]=0;
+  a[4165]=0;
+  a[4166]=0;
+  a[4167]=0;
+  a[4168]=0;
+  a[4169]=0;
+  a[4170]=0;
+  a[4171]=0;
+  a[4172]=0;
+  a[4173]=0;
+  a[4174]=0;
+  a[4175]=0;
+  a[4176]=0;
+  a[4177]=0;
+  a[4178]=0;
+  a[4179]=0;
+  a[4180]=0;
+  a[4181]=0;
+  a[4182]=0;
+  a[4183]=0;
+  a[4184]=0;
+  a[4185]=0;
+  a[4186]=0;
+  a[4187]=0;
+  a[4188]=0;
+  a[4189]=0;
+  a[4190]=0;
+  a[4191]=0;
+  a[4192]=0;
+  a[4193]=0;
+  a[4194]=0;
+  a[4195]=0;
+  a[4196]=0;
+  a[4197]=0;
+  a[4198]=0;
+  a[4199]=0;
+  a[4200]=0;
+  a[4201]=0;
+  a[4202]=0;
+  a[4203]=0;
+  a[4204]=0;
+  a[4205]=0;
+  a[4206]=0;
+  a[4207]=0;
+  a[4208]=0;
+  a[4209]=0;
+  a[4210]=0;
+  a[4211]=0;
+  a[4212]=0;
+  a[4213]=0;
+  a[4214]=0;
+  a[4215]=0;
+  a[4216]=0;
+  a[4217]=0;
+  a[4218]=0;
+  a[4219]=0;
+  a[4220]=0;
+  a[4221]=0;
+  a[4222]=0;
+  a[4223]=0;
+  a[4224]=0;
+  a[4225]=0;
+  a[4226]=0;
+  a[4227]=0;
+  a[4228]=0;
+  a[4229]=0;
+  a[4230]=0;
+  a[4231]=0;
+  a[4232]=0;
+  a[4233]=0;
+  a[4234]=0;
+  a[4235]=0;
+  a[4236]=0;
+  a[4237]=0;
+  a[4238]=0;
+  a[4239]=0;
+  a[4240]=0;
+  a[4241]=0;
+  a[4242]=0;
+  a[4243]=0;
+  a[4244]=0;
+  a[4245]=0;
+  a[4246]=0;
+  a[4247]=0;
+  a[4248]=0;
+  a[4249]=0;
+  a[4250]=0;
+  a[4251]=0;
+  a[4252]=0;
+  a[4253]=0;
+  a[4254]=0;
+  a[4255]=0;
+  a[4256]=0;
+  a[4257]=0;
+  a[4258]=0;
+  a[4259]=0;
+  a[4260]=0;
+  a[4261]=0;
+  a[4262]=0;
+  a[4263]=0;
+  a[4264]=0;
+  a[4265]=0;
+  a[4266]=0;
+  a[4267]=0;
+  a[4268]=0;
+  a[4269]=0;
+  a[4270]=0;
+  a[4271]=0;
+  a[4272]=0;
+  a[4273]=0;
+  a[4274]=0;
+  a[4275]=0;
+  a[4276]=0;
+  a[4277]=0;
+  a[4278]=0;
+  a[4279]=0;
+  a[4280]=0;
+  a[4281]=0;
+  a[4282]=0;
+  a[4283]=0;
+  a[4284]=0;
+  a[4285]=0;
+  a[4286]=0;
+  a[4287]=0;
+  a[4288]=0;
+  a[4289]=0;
+  a[4290]=0;
+  a[4291]=0;
+  a[4292]=0;
+  a[4293]=0;
+  a[4294]=0;
+  a[4295]=0;
+  a[4296]=0;
+  a[4297]=0;
+  a[4298]=0;
+  a[4299]=0;
+  a[4300]=0;
+  a[4301]=0;
+  a[4302]=0;
+  a[4303]=0;
+  a[4304]=0;
+  a[4305]=0;
+  a[4306]=0;
+  a[4307]=0;
+  a[4308]=0;
+  a[4309]=0;
+  a[4310]=0;
+  a[4311]=0;
+  a[4312]=0;
+  a[4313]=0;
+  a[4314]=0;
+  a[4315]=0;
+  a[4316]=0;
+  a[4317]=0;
+  a[4318]=0;
+  a[4319]=0;
+  a[4320]=0;
+  a[4321]=0;
+  a[4322]=0;
+  a[4323]=0;
+  a[4324]=0;
+  a[4325]=0;
+  a[4326]=0;
+  a[4327]=0;
+  a[4328]=0;
+  a[4329]=0;
+  a[4330]=0;
+  a[4331]=0;
+  a[4332]=0;
+  a[4333]=0;
+  a[4334]=0;
+  a[4335]=0;
+  a[4336]=0;
+  a[4337]=0;
+  a[4338]=0;
+  a[4339]=0;
+  a[4340]=0;
+  a[4341]=0;
+  a[4342]=0;
+  a[4343]=0;
+  a[4344]=0;
+  a[4345]=0;
+  a[4346]=0;
+  a[4347]=0;
+  a[4348]=0;
+  a[4349]=0;
+  a[4350]=0;
+  a[4351]=0;
+  a[4352]=0;
+  a[4353]=0;
+  a[4354]=0;
+  a[4355]=0;
+  a[4356]=0;
+  a[4357]=0;
+  a[4358]=0;
+  a[4359]=0;
+  a[4360]=0;
+  a[4361]=0;
+  a[4362]=0;
+  a[4363]=0;
+  a[4364]=0;
+  a[4365]=0;
+  a[4366]=0;
+  a[4367]=0;
+  a[4368]=0;
+  a[4369]=0;
+  a[4370]=0;
+  a[4371]=0;
+  a[4372]=0;
+  a[4373]=0;
+  a[4374]=0;
+  a[4375]=0;
+  a[4376]=0;
+  a[4377]=0;
+  a[4378]=0;
+  a[4379]=0;
+  a[4380]=0;
+  a[4381]=0;
+  a[4382]=0;
+  a[4383]=0;
+  a[4384]=0;
+  a[4385]=0;
+  a[4386]=0;
+  a[4387]=0;
+  a[4388]=0;
+  a[4389]=0;
+  a[4390]=0;
+  a[4391]=0;
+  a[4392]=0;
+  a[4393]=0;
+  a[4394]=0;
+  a[4395]=0;
+  a[4396]=0;
+  a[4397]=0;
+  a[4398]=0;
+  a[4399]=0;
+  a[4400]=0;
+  a[4401]=0;
+  a[4402]=0;
+  a[4403]=0;
+  a[4404]=0;
+  a[4405]=0;
+  a[4406]=0;
+  a[4407]=0;
+  a[4408]=0;
+  a[4409]=0;
+  a[4410]=0;
+  a[4411]=0;
+  a[4412]=0;
+  a[4413]=0;
+  a[4414]=0;
+  a[4415]=0;
+  a[4416]=0;
+  a[4417]=0;
+  a[4418]=0;
+  a[4419]=0;
+  a[4420]=0;
+  a[4421]=0;
+  a[4422]=0;
+  a[4423]=0;
+  a[4424]=0;
+  a[4425]=0;
+  a[4426]=0;
+  a[4427]=0;
+  a[4428]=0;
+  a[4429]=0;
+  a[4430]=0;
+  a[4431]=0;
+  a[4432]=0;
+  a[4433]=0;
+  a[4434]=0;
+  a[4435]=0;
+  a[4436]=0;
+  a[4437]=0;
+  a[4438]=0;
+  a[4439]=0;
+  a[4440]=0;
+  a[4441]=0;
+  a[4442]=0;
+  a[4443]=0;
+  a[4444]=0;
+  a[4445]=0;
+  a[4446]=0;
+  a[4447]=0;
+  a[4448]=0;
+  a[4449]=0;
+  a[4450]=0;
+  a[4451]=0;
+  a[4452]=0;
+  a[4453]=0;
+  a[4454]=0;
+  a[4455]=0;
+  a[4456]=0;
+  a[4457]=0;
+  a[4458]=0;
+  a[4459]=0;
+  a[4460]=0;
+  a[4461]=0;
+  a[4462]=0;
+  a[4463]=0;
+  a[4464]=0;
+  a[4465]=0;
+  a[4466]=0;
+  a[4467]=0;
+  a[4468]=0;
+  a[4469]=0;
+  a[4470]=0;
+  a[4471]=0;
+  a[4472]=0;
+  a[4473]=0;
+  a[4474]=0;
+  a[4475]=0;
+  a[4476]=0;
+  a[4477]=0;
+  a[4478]=0;
+  a[4479]=0;
+  a[4480]=0;
+  a[4481]=0;
+  a[4482]=0;
+  a[4483]=0;
+  a[4484]=0;
+  a[4485]=0;
+  a[4486]=0;
+  a[4487]=0;
+  a[4488]=0;
+  a[4489]=0;
+  a[4490]=0;
+  a[4491]=0;
+  a[4492]=0;
+  a[4493]=0;
+  a[4494]=0;
+  a[4495]=0;
+  a[4496]=0;
+  a[4497]=0;
+  a[4498]=0;
+  a[4499]=0;
+  a[4500]=0;
+  a[4501]=0;
+  a[4502]=0;
+  a[4503]=0;
+  a[4504]=0;
+  a[4505]=0;
+  a[4506]=0;
+  a[4507]=0;
+  a[4508]=0;
+  a[4509]=0;
+  a[4510]=0;
+  a[4511]=0;
+  a[4512]=0;
+  a[4513]=0;
+  a[4514]=0;
+  a[4515]=0;
+  a[4516]=0;
+  a[4517]=0;
+  a[4518]=0;
+  a[4519]=0;
+  a[4520]=0;
+  a[4521]=0;
+  a[4522]=0;
+  a[4523]=0;
+  a[4524]=0;
+  a[4525]=0;
+  a[4526]=0;
+  a[4527]=0;
+  a[4528]=0;
+  a[4529]=0;
+  a[4530]=0;
+  a[4531]=0;
+  a[4532]=0;
+  a[4533]=0;
+  a[4534]=0;
+  a[4535]=0;
+  a[4536]=0;
+  a[4537]=0;
+  a[4538]=0;
+  a[4539]=0;
+  a[4540]=0;
+  a[4541]=0;
+  a[4542]=0;
+  a[4543]=0;
+  a[4544]=0;
+  a[4545]=0;
+  a[4546]=0;
+  a[4547]=0;
+  a[4548]=0;
+  a[4549]=0;
+  a[4550]=0;
+  a[4551]=0;
+  a[4552]=0;
+  a[4553]=0;
+  a[4554]=0;
+  a[4555]=0;
+  a[4556]=0;
+  a[4557]=0;
+  a[4558]=0;
+  a[4559]=0;
+  a[4560]=0;
+  a[4561]=0;
+  a[4562]=0;
+  a[4563]=0;
+  a[4564]=0;
+  a[4565]=0;
+  a[4566]=0;
+  a[4567]=0;
+  a[4568]=0;
+  a[4569]=0;
+  a[4570]=0;
+  a[4571]=0;
+  a[4572]=0;
+  a[4573]=0;
+  a[4574]=0;
+  a[4575]=0;
+  a[4576]=0;
+  a[4577]=0;
+  a[4578]=0;
+  a[4579]=0;
+  a[4580]=0;
+  a[4581]=0;
+  a[4582]=0;
+  a[4583]=0;
+  a[4584]=0;
+  a[4585]=0;
+  a[4586]=0;
+  a[4587]=0;
+  a[4588]=0;
+  a[4589]=0;
+  a[4590]=0;
+  a[4591]=0;
+  a[4592]=0;
+  a[4593]=0;
+  a[4594]=0;
+  a[4595]=0;
+  a[4596]=0;
+  a[4597]=0;
+  a[4598]=0;
+  a[4599]=0;
+  a[4600]=0;
+  a[4601]=0;
+  a[4602]=0;
+  a[4603]=0;
+  a[4604]=0;
+  a[4605]=0;
+  a[4606]=0;
+  a[4607]=0;
+  a[4608]=0;
+  a[4609]=0;
+  a[4610]=0;
+  a[4611]=0;
+  a[4612]=0;
+  a[4613]=0;
+  a[4614]=0;
+  a[4615]=0;
+  a[4616]=0;
+  a[4617]=0;
+  a[4618]=0;
+  a[4619]=0;
+  a[4620]=0;
+  a[4621]=0;
+  a[4622]=0;
+  a[4623]=0;
+  a[4624]=0;
+  a[4625]=0;
+  a[4626]=0;
+  a[4627]=0;
+  a[4628]=0;
+  a[4629]=0;
+  a[4630]=0;
+  a[4631]=0;
+  a[4632]=0;
+  a[4633]=0;
+  a[4634]=0;
+  a[4635]=0;
+  a[4636]=0;
+  a[4637]=0;
+  a[4638]=0;
+  a[4639]=0;
+  a[4640]=0;
+  a[4641]=0;
+  a[4642]=0;
+  a[4643]=0;
+  a[4644]=0;
+  a[4645]=0;
+  a[4646]=0;
+  a[4647]=0;
+  a[4648]=0;
+  a[4649]=0;
+  a[4650]=0;
+  a[4651]=0;
+  a[4652]=0;
+  a[4653]=0;
+  a[4654]=0;
+  a[4655]=0;
+  a[4656]=0;
+  a[4657]=0;
+  a[4658]=0;
+  a[4659]=0;
+  a[4660]=0;
+  a[4661]=0;
+  a[4662]=0;
+  a[4663]=0;
+  a[4664]=0;
+  a[4665]=0;
+  a[4666]=0;
+  a[4667]=0;
+  a[4668]=0;
+  a[4669]=0;
+  a[4670]=0;
+  a[4671]=0;
+  a[4672]=0;
+  a[4673]=0;
+  a[4674]=0;
+  a[4675]=0;
+  a[4676]=0;
+  a[4677]=0;
+  a[4678]=0;
+  a[4679]=0;
+  a[4680]=0;
+  a[4681]=0;
+  a[4682]=0;
+  a[4683]=0;
+  a[4684]=0;
+  a[4685]=0;
+  a[4686]=0;
+  a[4687]=0;
+  a[4688]=0;
+  a[4689]=0;
+  a[4690]=0;
+  a[4691]=0;
+  a[4692]=0;
+  a[4693]=0;
+  a[4694]=0;
+  a[4695]=0;
+  a[4696]=0;
+  a[4697]=0;
+  a[4698]=0;
+  a[4699]=0;
+  a[4700]=0;
+  a[4701]=0;
+  a[4702]=0;
+  a[4703]=0;
+  a[4704]=0;
+  a[4705]=0;
+  a[4706]=0;
+  a[4707]=0;
+  a[4708]=0;
+  a[4709]=0;
+  a[4710]=0;
+  a[4711]=0;
+  a[4712]=0;
+  a[4713]=0;
+  a[4714]=0;
+  a[4715]=0;
+  a[4716]=0;
+  a[4717]=0;
+  a[4718]=0;
+  a[4719]=0;
+  a[4720]=0;
+  a[4721]=0;
+  a[4722]=0;
+  a[4723]=0;
+  a[4724]=0;
+  a[4725]=0;
+  a[4726]=0;
+  a[4727]=0;
+  a[4728]=0;
+  a[4729]=0;
+  a[4730]=0;
+  a[4731]=0;
+  a[4732]=0;
+  a[4733]=0;
+  a[4734]=0;
+  a[4735]=0;
+  a[4736]=0;
+  a[4737]=0;
+  a[4738]=0;
+  a[4739]=0;
+  a[4740]=0;
+  a[4741]=0;
+  a[4742]=0;
+  a[4743]=0;
+  a[4744]=0;
+  a[4745]=0;
+  a[4746]=0;
+  a[4747]=0;
+  a[4748]=0;
+  a[4749]=0;
+  a[4750]=0;
+  a[4751]=0;
+  a[4752]=0;
+  a[4753]=0;
+  a[4754]=0;
+  a[4755]=0;
+  a[4756]=0;
+  a[4757]=0;
+  a[4758]=0;
+  a[4759]=0;
+  a[4760]=0;
+  a[4761]=0;
+  a[4762]=0;
+  a[4763]=0;
+  a[4764]=0;
+  a[4765]=0;
+  a[4766]=0;
+  a[4767]=0;
+  a[4768]=0;
+  a[4769]=0;
+  a[4770]=0;
+  a[4771]=0;
+  a[4772]=0;
+  a[4773]=0;
+  a[4774]=0;
+  a[4775]=0;
+  a[4776]=0;
+  a[4777]=0;
+  a[4778]=0;
+  a[4779]=0;
+  a[4780]=0;
+  a[4781]=0;
+  a[4782]=0;
+  a[4783]=0;
+  a[4784]=0;
+  a[4785]=0;
+  a[4786]=0;
+  a[4787]=0;
+  a[4788]=0;
+  a[4789]=0;
+  a[4790]=0;
+  a[4791]=0;
+  a[4792]=0;
+  a[4793]=0;
+  a[4794]=0;
+  a[4795]=0;
+  a[4796]=0;
+  a[4797]=0;
+  a[4798]=0;
+  a[4799]=0;
+  a[4800]=0;
+  a[4801]=0;
+  a[4802]=0;
+  a[4803]=0;
+  a[4804]=0;
+  a[4805]=0;
+  a[4806]=0;
+  a[4807]=0;
+  a[4808]=0;
+  a[4809]=0;
+  a[4810]=0;
+  a[4811]=0;
+  a[4812]=0;
+  a[4813]=0;
+  a[4814]=0;
+  a[4815]=0;
+  a[4816]=0;
+  a[4817]=0;
+  a[4818]=0;
+  a[4819]=0;
+  a[4820]=0;
+  a[4821]=0;
+  a[4822]=0;
+  a[4823]=0;
+  a[4824]=0;
+  a[4825]=0;
+  a[4826]=0;
+  a[4827]=0;
+  a[4828]=0;
+  a[4829]=0;
+  a[4830]=0;
+  a[4831]=0;
+  a[4832]=0;
+  a[4833]=0;
+  a[4834]=0;
+  a[4835]=0;
+  a[4836]=0;
+  a[4837]=0;
+  a[4838]=0;
+  a[4839]=0;
+  a[4840]=0;
+  a[4841]=0;
+  a[4842]=0;
+  a[4843]=0;
+  a[4844]=0;
+  a[4845]=0;
+  a[4846]=0;
+  a[4847]=0;
+  a[4848]=0;
+  a[4849]=0;
+  a[4850]=0;
+  a[4851]=0;
+  a[4852]=0;
+  a[4853]=0;
+  a[4854]=0;
+  a[4855]=0;
+  a[4856]=0;
+  a[4857]=0;
+  a[4858]=0;
+  a[4859]=0;
+  a[4860]=0;
+  a[4861]=0;
+  a[4862]=0;
+  a[4863]=0;
+  a[4864]=0;
+  a[4865]=0;
+  a[4866]=0;
+  a[4867]=0;
+  a[4868]=0;
+  a[4869]=0;
+  a[4870]=0;
+  a[4871]=0;
+  a[4872]=0;
+  a[4873]=0;
+  a[4874]=0;
+  a[4875]=0;
+  a[4876]=0;
+  a[4877]=0;
+  a[4878]=0;
+  a[4879]=0;
+  a[4880]=0;
+  a[4881]=0;
+  a[4882]=0;
+  a[4883]=0;
+  a[4884]=0;
+  a[4885]=0;
+  a[4886]=0;
+  a[4887]=0;
+  a[4888]=0;
+  a[4889]=0;
+  a[4890]=0;
+  a[4891]=0;
+  a[4892]=0;
+  a[4893]=0;
+  a[4894]=0;
+  a[4895]=0;
+  a[4896]=0;
+  a[4897]=0;
+  a[4898]=0;
+  a[4899]=0;
+  a[4900]=0;
+  a[4901]=0;
+  a[4902]=0;
+  a[4903]=0;
+  a[4904]=0;
+  a[4905]=0;
+  a[4906]=0;
+  a[4907]=0;
+  a[4908]=0;
+  a[4909]=0;
+  a[4910]=0;
+  a[4911]=0;
+  a[4912]=0;
+  a[4913]=0;
+  a[4914]=0;
+  a[4915]=0;
+  a[4916]=0;
+  a[4917]=0;
+  a[4918]=0;
+  a[4919]=0;
+  a[4920]=0;
+  a[4921]=0;
+  a[4922]=0;
+  a[4923]=0;
+  a[4924]=0;
+  a[4925]=0;
+  a[4926]=0;
+  a[4927]=0;
+  a[4928]=0;
+  a[4929]=0;
+  a[4930]=0;
+  a[4931]=0;
+  a[4932]=0;
+  a[4933]=0;
+  a[4934]=0;
+  a[4935]=0;
+  a[4936]=0;
+  a[4937]=0;
+  a[4938]=0;
+  a[4939]=0;
+  a[4940]=0;
+  a[4941]=0;
+  a[4942]=0;
+  a[4943]=0;
+  a[4944]=0;
+  a[4945]=0;
+  a[4946]=0;
+  a[4947]=0;
+  a[4948]=0;
+  a[4949]=0;
+  a[4950]=0;
+  a[4951]=0;
+  a[4952]=0;
+  a[4953]=0;
+  a[4954]=0;
+  a[4955]=0;
+  a[4956]=0;
+  a[4957]=0;
+  a[4958]=0;
+  a[4959]=0;
+  a[4960]=0;
+  a[4961]=0;
+  a[4962]=0;
+  a[4963]=0;
+  a[4964]=0;
+  a[4965]=0;
+  a[4966]=0;
+  a[4967]=0;
+  a[4968]=0;
+  a[4969]=0;
+  a[4970]=0;
+  a[4971]=0;
+  a[4972]=0;
+  a[4973]=0;
+  a[4974]=0;
+  a[4975]=0;
+  a[4976]=0;
+  a[4977]=0;
+  a[4978]=0;
+  a[4979]=0;
+  a[4980]=0;
+  a[4981]=0;
+  a[4982]=0;
+  a[4983]=0;
+  a[4984]=0;
+  a[4985]=0;
+  a[4986]=0;
+  a[4987]=0;
+  a[4988]=0;
+  a[4989]=0;
+  a[4990]=0;
+  a[4991]=0;
+  a[4992]=0;
+  a[4993]=0;
+  a[4994]=0;
+  a[4995]=0;
+  a[4996]=0;
+  a[4997]=0;
+  a[4998]=0;
+  a[4999]=0;
+  return a;
+}
diff --git a/test/mjsunit/regress/regress-1973.js b/test/mjsunit/regress/regress-1973.js
new file mode 100644
index 0000000..8708bf1
--- /dev/null
+++ b/test/mjsunit/regress/regress-1973.js
@@ -0,0 +1,52 @@
+// Copyright 2012 the V8 project authors. All rights reserved.
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions are
+// met:
+//
+//     * Redistributions of source code must retain the above copyright
+//       notice, this list of conditions and the following disclaimer.
+//     * Redistributions in binary form must reproduce the above
+//       copyright notice, this list of conditions and the following
+//       disclaimer in the documentation and/or other materials provided
+//       with the distribution.
+//     * Neither the name of Google Inc. nor the names of its
+//       contributors may be used to endorse or promote products derived
+//       from this software without specific prior written permission.
+//
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+// Test that getters and setters pass unwrapped this values in strict mode
+// and wrapped this values is non-strict mode.
+
+function TestAccessorWrapping(primitive) {
+  var prototype = Object.getPrototypeOf(Object(primitive))
+  // Check that strict mode passes unwrapped this value.
+  var strict_type = typeof primitive;
+  Object.defineProperty(prototype, "strict", {
+    get: function() { "use strict"; assertSame(strict_type, typeof this); },
+    set: function() { "use strict"; assertSame(strict_type, typeof this); }
+  });
+  primitive.strict = primitive.strict;
+  // Check that non-strict mode passes wrapped this value.
+  var sloppy_type = typeof Object(primitive);
+  Object.defineProperty(prototype, "sloppy", {
+    get: function() { assertSame(sloppy_type, typeof this); },
+    set: function() { assertSame(sloppy_type, typeof this); }
+  });
+  primitive.sloppy = primitive.sloppy;
+}
+
+TestAccessorWrapping(true);
+TestAccessorWrapping(0);
+TestAccessorWrapping({});
+TestAccessorWrapping("");
diff --git a/test/mjsunit/regress/regress-1980.js b/test/mjsunit/regress/regress-1980.js
new file mode 100644
index 0000000..49dfd06
--- /dev/null
+++ b/test/mjsunit/regress/regress-1980.js
@@ -0,0 +1,40 @@
+// Copyright 2011 the V8 project authors. All rights reserved.
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions are
+// met:
+//
+//     * Redistributions of source code must retain the above copyright
+//       notice, this list of conditions and the following disclaimer.
+//     * Redistributions in binary form must reproduce the above
+//       copyright notice, this list of conditions and the following
+//       disclaimer in the documentation and/or other materials provided
+//       with the distribution.
+//     * Neither the name of Google Inc. nor the names of its
+//       contributors may be used to endorse or promote products derived
+//       from this software without specific prior written permission.
+//
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+// See: http://code.google.com/p/v8/issues/detail?id=1980
+
+var invalid_this = [ "invalid", 23, undefined, null ];
+for (var i = 0; i < invalid_this.length; i++) {
+  var exception = false;
+  try {
+    Error.prototype.toString.call(invalid_this[i]);
+  } catch (e) {
+    exception = true;
+    assertTrue("called_on_non_object" == e.type);
+  }
+  assertTrue(exception);
+}
diff --git a/test/mjsunit/regress/regress-crbug-119926.js b/test/mjsunit/regress/regress-crbug-119926.js
new file mode 100644
index 0000000..26b84fa
--- /dev/null
+++ b/test/mjsunit/regress/regress-crbug-119926.js
@@ -0,0 +1,33 @@
+// Copyright 2012 the V8 project authors. All rights reserved.
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions are
+// met:
+//
+//     * Redistributions of source code must retain the above copyright
+//       notice, this list of conditions and the following disclaimer.
+//     * Redistributions in binary form must reproduce the above
+//       copyright notice, this list of conditions and the following
+//       disclaimer in the documentation and/or other materials provided
+//       with the distribution.
+//     * Neither the name of Google Inc. nor the names of its
+//       contributors may be used to endorse or promote products derived
+//       from this software without specific prior written permission.
+//
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+// Test that array elements don't break upon garbage collection.
+
+var a = new Array(500);
+for (var i = 0; i < 500000; i++) {
+  a[i] = new Object();
+}
diff --git a/test/mjsunit/regress/regress-inlining-function-literal-context.js b/test/mjsunit/regress/regress-inlining-function-literal-context.js
new file mode 100644
index 0000000..9b7f7ac
--- /dev/null
+++ b/test/mjsunit/regress/regress-inlining-function-literal-context.js
@@ -0,0 +1,53 @@
+// Copyright 2012 the V8 project authors. All rights reserved.
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions are
+// met:
+//
+//     * Redistributions of source code must retain the above copyright
+//       notice, this list of conditions and the following disclaimer.
+//     * Redistributions in binary form must reproduce the above
+//       copyright notice, this list of conditions and the following
+//       disclaimer in the documentation and/or other materials provided
+//       with the distribution.
+//     * Neither the name of Google Inc. nor the names of its
+//       contributors may be used to endorse or promote products derived
+//       from this software without specific prior written permission.
+//
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+// Flags: --allow-natives-syntax --expose-gc
+
+function mkbaz(x) {
+  function baz() {
+    return function () {
+      return [x];
+    }
+  }
+  return baz;
+}
+
+var baz = mkbaz(1);
+
+function foo() {
+  var f = baz();
+  return f();
+}
+
+// Tenure.
+gc();
+gc();
+
+assertArrayEquals([1], foo());
+assertArrayEquals([1], foo());
+%OptimizeFunctionOnNextCall(foo);
+assertArrayEquals([1], foo());
diff --git a/test/mjsunit/regress/regress-smi-only-concat.js b/test/mjsunit/regress/regress-smi-only-concat.js
new file mode 100644
index 0000000..a9a6d89
--- /dev/null
+++ b/test/mjsunit/regress/regress-smi-only-concat.js
@@ -0,0 +1,37 @@
+// Copyright 2012 the V8 project authors. All rights reserved.
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions are
+// met:
+//
+//     * Redistributions of source code must retain the above copyright
+//       notice, this list of conditions and the following disclaimer.
+//     * Redistributions in binary form must reproduce the above
+//       copyright notice, this list of conditions and the following
+//       disclaimer in the documentation and/or other materials provided
+//       with the distribution.
+//     * Neither the name of Google Inc. nor the names of its
+//       contributors may be used to endorse or promote products derived
+//       from this software without specific prior written permission.
+//
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+// Flags: --allow-natives-syntax
+
+// This tests that concatenating a fast smi-only array and a fast object array
+// results in a fast object array.
+
+var fast_array = ['a', 'b'];
+var array = fast_array.concat(fast_array);
+
+assertTrue(%HasFastElements(fast_array));
+assertTrue(%HasFastElements(array));
\ No newline at end of file
diff --git a/test/mjsunit/regress/regress-sqrt.js b/test/mjsunit/regress/regress-sqrt.js
new file mode 100644
index 0000000..f2a7e55
--- /dev/null
+++ b/test/mjsunit/regress/regress-sqrt.js
@@ -0,0 +1,47 @@
+// Copyright 2012 the V8 project authors. All rights reserved.
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions are
+// met:
+//
+//     * Redistributions of source code must retain the above copyright
+//       notice, this list of conditions and the following disclaimer.
+//     * Redistributions in binary form must reproduce the above
+//       copyright notice, this list of conditions and the following
+//       disclaimer in the documentation and/or other materials provided
+//       with the distribution.
+//     * Neither the name of Google Inc. nor the names of its
+//       contributors may be used to endorse or promote products derived
+//       from this software without specific prior written permission.
+//
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+// Flags: --allow-natives-syntax
+
+// Check that Math.sqrt returns the same value regardless of being
+// optimized or not.
+
+function f(x) {
+  return Math.sqrt(x);
+}
+
+var x = 7.0506280066499245e-233;
+
+var a = f(x);
+
+f(0.1);
+f(0.2);
+%OptimizeFunctionOnNextCall(f);
+
+var b = f(x);
+
+assertEquals(a, b);
diff --git a/test/mjsunit/string-replace-one-char.js b/test/mjsunit/string-replace-one-char.js
index f153acc..cb4167b 100644
--- a/test/mjsunit/string-replace-one-char.js
+++ b/test/mjsunit/string-replace-one-char.js
@@ -71,13 +71,13 @@
 
 // Deep cons tree.
 var nested_1 = "";
-for (var i = 0; i < 1000000; i++) nested_1 += "y";
+for (var i = 0; i < 100000; i++) nested_1 += "y";
 var nested_1_result = prefix1024 + nested_1 + "aa";
 nested_1 = prefix1024 + nested_1 + "z";
 test_replace(nested_1, nested_1_result, "z", "aa");
 
 var nested_2 = "\u2244";
-for (var i = 0; i < 1000000; i++) nested_2 += "y";
+for (var i = 0; i < 100000; i++) nested_2 += "y";
 var nested_2_result = prefix1024 + nested_2 + "aa";
 nested_2 = prefix1024 + nested_2 + "\u2012";
 test_replace(nested_2, nested_2_result, "\u2012", "aa");
diff --git a/test/mjsunit/tools/tickprocessor.js b/test/mjsunit/tools/tickprocessor.js
index 30b0ec2..c48d9f3 100644
--- a/test/mjsunit/tools/tickprocessor.js
+++ b/test/mjsunit/tools/tickprocessor.js
@@ -376,8 +376,11 @@
   }
   assertTrue(pathLen != -1);
   var testsPath = TEST_FILE_NAME.substr(0, pathLen + 1);
-  var tp = new TickProcessor(
-      new CppEntriesProviderMock(), separateIc, ignoreUnknown, stateFilter);
+  var tp = new TickProcessor(new CppEntriesProviderMock(),
+                             separateIc,
+                             TickProcessor.CALL_GRAPH_SIZE,
+                             ignoreUnknown,
+                             stateFilter);
   var pm = new PrintMonitor(testsPath + refOutput);
   tp.processLogFileInTest(testsPath + logInput);
   tp.printStatistics();
diff --git a/test/mozilla/mozilla.status b/test/mozilla/mozilla.status
index bc096d5..e64959a 100644
--- a/test/mozilla/mozilla.status
+++ b/test/mozilla/mozilla.status
@@ -69,6 +69,9 @@
 ecma_3/Date/15.9.3.2-1: SKIP
 js1_2/function/Number: SKIP
 
+# TODO(2018): Temporarily allow timeout in debug mode.
+js1_5/GC/regress-203278-2: PASS || TIMEOUT if $mode == debug
+
 ##################### SLOW TESTS #####################
 
 # This takes a long time to run (~100 seconds). It should only be run
@@ -213,6 +216,10 @@
 # builtin to have undefined as the receiver.
 ecma/String/15.5.4.6-2: FAIL_OK
 
+# Fail because it expects String.prototype.split to distinguish whether
+# separator was undefined or not passed at all.
+ecma/String/15.5.4.8-2: FAIL_OK
+
 # Fail because of toLowerCase and toUpperCase conversion.
 ecma/String/15.5.4.11-2: FAIL_OK
 ecma/String/15.5.4.11-5: FAIL_OK
diff --git a/test/sputnik/sputnik.status b/test/sputnik/sputnik.status
index a587a6d..a4c7d57 100644
--- a/test/sputnik/sputnik.status
+++ b/test/sputnik/sputnik.status
@@ -125,6 +125,13 @@
 S15.5.4.11_D1.1_T1: PASS || FAIL_OK
 S15.5.4.11_D1.1_T3: PASS || FAIL_OK
 S12.6.4_D1: PASS || FAIL_OK
+S15.5.4.14_A1_T6: FAIL_OK
+S15.5.4.14_A1_T7: FAIL_OK
+S15.5.4.14_A1_T8: FAIL_OK
+S15.5.4.14_A1_T9: FAIL_OK
+S15.5.4.14_A2_T7: FAIL_OK
+S15.10.2.12_A1_T1: FAIL_OK
+S15.10.2.12_A2_T1: FAIL_OK
 
 # We allow function declarations within statements
 S12.6.2_A13_T1: FAIL_OK
@@ -189,7 +196,6 @@
 S15.4.4.2_A2_T1: FAIL_OK
 S15.4.4.3_A2_T1: FAIL_OK
 
-
 ##################### SKIPPED TESTS #####################
 
 # These tests take a looong time to run in debug mode.
diff --git a/test/test262/README b/test/test262/README
index 094356f..dae1843 100644
--- a/test/test262/README
+++ b/test/test262/README
@@ -4,11 +4,11 @@
 
   http://hg.ecmascript.org/tests/test262
 
-at revision 271 as 'data' in this directory.  Using later version
+at revision 309 as 'data' in this directory.  Using later version
 may be possible but the tests are only known to pass (and indeed run)
 with that revision.
 
-hg clone -r 271 http://hg.ecmascript.org/tests/test262 data
+hg clone -r 309 http://hg.ecmascript.org/tests/test262 data
 
 If you do update to a newer revision you may have to change the test
 harness adapter code since it uses internal functionality from the
diff --git a/test/test262/test262.status b/test/test262/test262.status
index 1da988e..67607ff 100644
--- a/test/test262/test262.status
+++ b/test/test262/test262.status
@@ -33,72 +33,30 @@
 # '__proto__' should be treated as a normal property in JSON.
 S15.12.2_A1: FAIL
 
-# V8 Bug: http://code.google.com/p/v8/issues/detail?id=1196
-S8.7_A5_T2: FAIL
-
-# V8 Bug: http://code.google.com/p/v8/issues/detail?id=1624
-S10.4.2.1_A1: FAIL
-
 # V8 Bug: http://code.google.com/p/v8/issues/detail?id=1475
 15.2.3.6-4-405: FAIL
 15.2.3.6-4-410: FAIL
 15.2.3.6-4-415: FAIL
 15.2.3.6-4-420: FAIL
 
-# V8 Bug: http://code.google.com/p/v8/issues/detail?id=1772
-15.2.3.6-4-292-1: FAIL
-15.2.3.6-4-293-2: FAIL
-15.2.3.6-4-293-3: FAIL
-15.2.3.6-4-294-1: FAIL
-15.2.3.6-4-295-1: FAIL
-15.2.3.6-4-296-1: FAIL
-15.2.3.6-4-333-11: FAIL
-15.2.3.7-6-a-281: FAIL
-15.2.3.7-6-a-282: FAIL
-15.2.3.7-6-a-283: FAIL
-15.2.3.7-6-a-284: FAIL
-15.2.3.7-6-a-285: FAIL
-
-# V8 Bug: http://code.google.com/p/v8/issues/detail?id=1790
-15.4.4.22-9-9: FAIL
-
-# Invalid test cases (recent change adding var changes semantics)
-S8.3_A1_T1: FAIL
-S15.3_A3_T1: FAIL
-S15.3_A3_T3: FAIL
-
 ##################### DELIBERATE INCOMPATIBILITIES #####################
 
 # We deliberately treat arguments to parseInt() with a leading zero as
 # octal numbers in order to not break the web.
 S15.1.2.2_A5.1_T1: FAIL_OK
 
-# This tests precision of trignometric functions.  We're slightly off
-# from the implementation in libc (~ 1e-17) but it's not clear if we
-# or they are closer to the right answer, or if it even matters.
+# This tests precision of Math.tan and Math.sin.  The implementation for those
+# trigonometric functions are platform/compiler dependent.  Furthermore, the
+# expectation values by far deviates from the actual result given by an
+# arbitrary-precision calculator, making those tests partly bogus.
 S15.8.2.16_A7: PASS || FAIL_OK
 S15.8.2.18_A7: PASS || FAIL_OK
-S15.8.2.13_A23: PASS || FAIL_OK
-
-# Sputnik tests (r97) assume RegExp.prototype is an Object, not a RegExp.
-S15.10.6_A2: FAIL_OK
-
-# We are silent in some regexp cases where the spec wants us to give
-# errors, for compatibility.
-S15.10.2.11_A1_T2: FAIL
-S15.10.2.11_A1_T3: FAIL
 
 # We are more lenient in which string character escapes we allow than
 # the spec (7.8.4 p. 19) wants us to be.  This is for compatibility.
-S7.8.4_A4.3_T3: FAIL_OK
-S7.8.4_A4.3_T4: FAIL_OK
-S7.8.4_A4.3_T5: FAIL_OK
-S7.8.4_A4.3_T6: FAIL_OK
 S7.8.4_A6.1_T4: FAIL_OK
 S7.8.4_A6.2_T1: FAIL_OK
 S7.8.4_A6.2_T2: FAIL_OK
-S7.8.4_A6.4_T1: FAIL_OK
-S7.8.4_A6.4_T2: FAIL_OK
 S7.8.4_A7.1_T4: FAIL_OK
 S7.8.4_A7.2_T1: FAIL_OK
 S7.8.4_A7.2_T2: FAIL_OK
@@ -106,101 +64,24 @@
 S7.8.4_A7.2_T4: FAIL_OK
 S7.8.4_A7.2_T5: FAIL_OK
 S7.8.4_A7.2_T6: FAIL_OK
-S7.8.4_A7.4_T1: FAIL_OK
-S7.8.4_A7.4_T2: FAIL_OK
-
-# Sputnik expects unicode escape sequences in RegExp flags to be interpreted.
-# The specification requires them to be passed uninterpreted to the RegExp
-# constructor. We now implement that.
-S7.8.5_A3.1_T7: FAIL_OK
-S7.8.5_A3.1_T8: FAIL_OK
-S7.8.5_A3.1_T9: FAIL_OK
-
-# We allow some keywords to be used as identifiers.
-S7.5.3_A1.15: FAIL_OK
-S7.5.3_A1.18: FAIL_OK
-S7.5.3_A1.21: FAIL_OK
-S7.5.3_A1.22: FAIL_OK
-S7.5.3_A1.23: FAIL_OK
-S7.5.3_A1.24: FAIL_OK
-S7.5.3_A1.26: FAIL_OK
-
-# This checks for non-262 behavior
-S7.6_D1: PASS || FAIL_OK
-S7.6_D2: PASS || FAIL_OK
-S8.4_D1.1: PASS || FAIL_OK
-S8.4_D2.1: PASS || FAIL_OK
-S8.4_D2.2: PASS || FAIL_OK
-S8.4_D2.3: PASS || FAIL_OK
-S8.4_D2.4: PASS || FAIL_OK
-S8.4_D2.5: PASS || FAIL_OK
-S8.4_D2.6: PASS || FAIL_OK
-S8.4_D2.7: PASS || FAIL_OK
-S11.4.3_D1.2: PASS || FAIL_OK
-S12.6.4_A14_T1: PASS || FAIL_OK
-S12.6.4_D1: PASS || FAIL_OK
-S12.6.4_R1: PASS || FAIL_OK
-S12.6.4_R2: PASS || FAIL_OK
-S13.2_D1.2: PASS || FAIL_OK
-S13_D1_T1: PASS || FAIL_OK
-S14_D4_T3: PASS || FAIL_OK
-S14_D7: PASS || FAIL_OK
-S15.1.2.2_D1.2: PASS || FAIL_OK
-S15.5.2_D2: PASS || FAIL_OK
-S15.5.4.11_D1.1_T1: PASS || FAIL_OK
-S15.5.4.11_D1.1_T2: PASS || FAIL_OK
-S15.5.4.11_D1.1_T3: PASS || FAIL_OK
-S15.5.4.11_D1.1_T4: PASS || FAIL_OK
-
-# We allow function declarations within statements
-S12.6.2_A13_T1: FAIL_OK
-S12.6.2_A13_T2: FAIL_OK
-S12.6.4_A13_T1: FAIL_OK
-S12.6.4_A13_T2: FAIL_OK
-S15.3.4.2_A1_T1: FAIL_OK
 
 # Linux and Mac defaults to extended 80 bit floating point format in the FPU.
 # We follow the other major JS engines by keeping this default.
-S8.5_A2.2: PASS, FAIL if $system == linux, FAIL if $system == macos
-S8.5_A2.1: PASS, FAIL if $system == linux, FAIL if $system == macos
+S8.5_A2.2: PASS if ($system != linux || $arch == x64), FAIL_OK if ($system == linux && $arch != x64)
+S8.5_A2.1: PASS if ($system != linux || $arch == x64), FAIL_OK if ($system == linux && $arch != x64)
 
-############################# ES3 TESTS ################################
-# These tests check for ES3 semantics, and differ from ES5.
-# When we follow ES5 semantics, it's ok to fail the test.
+############################ INVALID TESTS #############################
 
-# Allow keywords as names of properties in object initialisers and
-# in dot-notation property access.
-S11.1.5_A4.1: FAIL_OK
-S11.1.5_A4.2: FAIL_OK
-
-# Calls builtins without an explicit receiver which means that
-# undefined is passed to the builtin. The tests expect the global
-# object to be passed which was true in ES3 but not in ES5.
-S11.1.1_A2: FAIL_OK
-S15.5.4.4_A1_T3: FAIL_OK
-S15.5.4.5_A1_T3: FAIL_OK
-S15.5.4.6_A1_T3: FAIL_OK
-S15.5.4.7_A1_T3: FAIL_OK
-S15.5.4.8_A1_T3: FAIL_OK
-S15.5.4.9_A1_T3: FAIL_OK
-S15.5.4.10_A1_T3: FAIL_OK
-S15.5.4.11_A1_T3: FAIL_OK
-S15.5.4.12_A1_T3: FAIL_OK
-S15.5.4.13_A1_T3: FAIL_OK
-S15.5.4.14_A1_T3: FAIL_OK
-S15.5.4.15_A1_T3: FAIL_OK
-
-# NaN, Infinity and undefined are read-only according to ES5.
-S15.1.1.1_A2_T1: FAIL_OK  # NaN
-S15.1.1.1_A2_T2: FAIL_OK  # NaN
-S15.1.1.2_A2_T1: FAIL_OK  # Infinity
-# S15.1.1.2_A2_T2 would fail if it weren't bogus in r97. sputnik bug #45.
-S15.1.1.3_A2_T1: FAIL_OK  # undefined
-S15.1.1.3_A2_T2: FAIL_OK  # undefined
-
-# Array.prototype.to[Locale]String is generic in ES5.
-S15.4.4.2_A2_T1: FAIL_OK
-S15.4.4.3_A2_T1: FAIL_OK
+# The reference value calculated by Test262 is incorrect if you run these tests
+# in PST/PDT between first Sunday in March and first Sunday in April. The DST
+# switch was moved in 2007 whereas Test262 bases the reference value on 2000.
+# Test262 Bug: https://bugs.ecmascript.org/show_bug.cgi?id=293
+S15.9.3.1_A5_T1: PASS || FAIL_OK
+S15.9.3.1_A5_T2: PASS || FAIL_OK
+S15.9.3.1_A5_T3: PASS || FAIL_OK
+S15.9.3.1_A5_T4: PASS || FAIL_OK
+S15.9.3.1_A5_T5: PASS || FAIL_OK
+S15.9.3.1_A5_T6: PASS || FAIL_OK
 
 ############################ SKIPPED TESTS #############################
 
diff --git a/test/test262/testcfg.py b/test/test262/testcfg.py
index aefda19..294b39c 100644
--- a/test/test262/testcfg.py
+++ b/test/test262/testcfg.py
@@ -29,8 +29,14 @@
 import test
 import os
 from os.path import join, exists
+import urllib
+import hashlib
+import tarfile
 
 
+TEST_262_ARCHIVE_REVISION = '3a890174343c'  # This is the r309 revision.
+TEST_262_ARCHIVE_MD5 = 'be5d4cfbe69cef70430907b8f3a92b50'
+TEST_262_URL = 'http://hg.ecmascript.org/tests/test262/archive/%s.tar.bz2'
 TEST_262_HARNESS = ['sta.js']
 
 
@@ -93,6 +99,28 @@
             tests.append(test)
     return tests
 
+  def DownloadData(self):
+    revision = TEST_262_ARCHIVE_REVISION
+    archive_url = TEST_262_URL % revision
+    archive_name = join(self.root, 'test262-%s.tar.bz2' % revision)
+    directory_name = join(self.root, "test262-%s" % revision)
+    if not exists(directory_name) or not exists(archive_name):
+      if not exists(archive_name):
+        print "Downloading test data from %s ..." % archive_url
+        urllib.urlretrieve(archive_url, archive_name)
+      if not exists(directory_name):
+        print "Extracting test262-%s.tar.bz2 ..." % revision
+        md5 = hashlib.md5()
+        with open(archive_name,'rb') as f:
+          for chunk in iter(lambda: f.read(8192), ''):
+            md5.update(chunk)
+        if md5.hexdigest() != TEST_262_ARCHIVE_MD5:
+          raise Exception("Hash mismatch of test data file")
+        archive = tarfile.open(archive_name, 'r:bz2')
+        archive.extractall(join(self.root))
+      if not exists(join(self.root, 'data')):
+        os.symlink(directory_name, join(self.root, 'data'))
+
   def GetBuildRequirements(self):
     return ['d8']