Update V8 to r7427: Initial merge by git

As required by WebKit r82507

Change-Id: I7ae83ef3f689356043b4929255b7c1dd31d8c5df
diff --git a/test/cctest/test-serialize.cc b/test/cctest/test-serialize.cc
index 80910c2..730d72a 100644
--- a/test/cctest/test-serialize.cc
+++ b/test/cctest/test-serialize.cc
@@ -83,7 +83,7 @@
 
 template <class T>
 static Address AddressOf(T id) {
-  return ExternalReference(id).address();
+  return ExternalReference(id, i::Isolate::Current()).address();
 }
 
 
@@ -99,70 +99,75 @@
 
 
 TEST(ExternalReferenceEncoder) {
-  StatsTable::SetCounterFunction(counter_function);
-  Heap::Setup(false);
+  OS::Setup();
+  Isolate* isolate = i::Isolate::Current();
+  isolate->stats_table()->SetCounterFunction(counter_function);
+  HEAP->Setup(false);
   ExternalReferenceEncoder encoder;
-  CHECK_EQ(make_code(BUILTIN, Builtins::ArrayCode),
-           Encode(encoder, Builtins::ArrayCode));
+  CHECK_EQ(make_code(BUILTIN, Builtins::kArrayCode),
+           Encode(encoder, Builtins::kArrayCode));
   CHECK_EQ(make_code(v8::internal::RUNTIME_FUNCTION, Runtime::kAbort),
            Encode(encoder, Runtime::kAbort));
   CHECK_EQ(make_code(IC_UTILITY, IC::kLoadCallbackProperty),
            Encode(encoder, IC_Utility(IC::kLoadCallbackProperty)));
   ExternalReference keyed_load_function_prototype =
-      ExternalReference(&Counters::keyed_load_function_prototype);
+      ExternalReference(isolate->counters()->keyed_load_function_prototype());
   CHECK_EQ(make_code(STATS_COUNTER, Counters::k_keyed_load_function_prototype),
            encoder.Encode(keyed_load_function_prototype.address()));
   ExternalReference the_hole_value_location =
-      ExternalReference::the_hole_value_location();
+      ExternalReference::the_hole_value_location(isolate);
   CHECK_EQ(make_code(UNCLASSIFIED, 2),
            encoder.Encode(the_hole_value_location.address()));
   ExternalReference stack_limit_address =
-      ExternalReference::address_of_stack_limit();
+      ExternalReference::address_of_stack_limit(isolate);
   CHECK_EQ(make_code(UNCLASSIFIED, 4),
            encoder.Encode(stack_limit_address.address()));
   ExternalReference real_stack_limit_address =
-      ExternalReference::address_of_real_stack_limit();
+      ExternalReference::address_of_real_stack_limit(isolate);
   CHECK_EQ(make_code(UNCLASSIFIED, 5),
            encoder.Encode(real_stack_limit_address.address()));
 #ifdef ENABLE_DEBUGGER_SUPPORT
   CHECK_EQ(make_code(UNCLASSIFIED, 15),
-           encoder.Encode(ExternalReference::debug_break().address()));
+           encoder.Encode(ExternalReference::debug_break(isolate).address()));
 #endif  // ENABLE_DEBUGGER_SUPPORT
   CHECK_EQ(make_code(UNCLASSIFIED, 10),
-           encoder.Encode(ExternalReference::new_space_start().address()));
+           encoder.Encode(
+               ExternalReference::new_space_start(isolate).address()));
   CHECK_EQ(make_code(UNCLASSIFIED, 3),
-           encoder.Encode(ExternalReference::roots_address().address()));
+           encoder.Encode(ExternalReference::roots_address(isolate).address()));
 }
 
 
 TEST(ExternalReferenceDecoder) {
-  StatsTable::SetCounterFunction(counter_function);
-  Heap::Setup(false);
+  OS::Setup();
+  Isolate* isolate = i::Isolate::Current();
+  isolate->stats_table()->SetCounterFunction(counter_function);
+  HEAP->Setup(false);
   ExternalReferenceDecoder decoder;
-  CHECK_EQ(AddressOf(Builtins::ArrayCode),
-           decoder.Decode(make_code(BUILTIN, Builtins::ArrayCode)));
+  CHECK_EQ(AddressOf(Builtins::kArrayCode),
+           decoder.Decode(make_code(BUILTIN, Builtins::kArrayCode)));
   CHECK_EQ(AddressOf(Runtime::kAbort),
            decoder.Decode(make_code(v8::internal::RUNTIME_FUNCTION,
                                     Runtime::kAbort)));
   CHECK_EQ(AddressOf(IC_Utility(IC::kLoadCallbackProperty)),
            decoder.Decode(make_code(IC_UTILITY, IC::kLoadCallbackProperty)));
   ExternalReference keyed_load_function =
-      ExternalReference(&Counters::keyed_load_function_prototype);
+      ExternalReference(isolate->counters()->keyed_load_function_prototype());
   CHECK_EQ(keyed_load_function.address(),
            decoder.Decode(
                make_code(STATS_COUNTER,
                          Counters::k_keyed_load_function_prototype)));
-  CHECK_EQ(ExternalReference::the_hole_value_location().address(),
+  CHECK_EQ(ExternalReference::the_hole_value_location(isolate).address(),
            decoder.Decode(make_code(UNCLASSIFIED, 2)));
-  CHECK_EQ(ExternalReference::address_of_stack_limit().address(),
+  CHECK_EQ(ExternalReference::address_of_stack_limit(isolate).address(),
            decoder.Decode(make_code(UNCLASSIFIED, 4)));
-  CHECK_EQ(ExternalReference::address_of_real_stack_limit().address(),
+  CHECK_EQ(ExternalReference::address_of_real_stack_limit(isolate).address(),
            decoder.Decode(make_code(UNCLASSIFIED, 5)));
 #ifdef ENABLE_DEBUGGER_SUPPORT
-  CHECK_EQ(ExternalReference::debug_break().address(),
+  CHECK_EQ(ExternalReference::debug_break(isolate).address(),
            decoder.Decode(make_code(UNCLASSIFIED, 15)));
 #endif  // ENABLE_DEBUGGER_SUPPORT
-  CHECK_EQ(ExternalReference::new_space_start().address(),
+  CHECK_EQ(ExternalReference::new_space_start(isolate).address(),
            decoder.Decode(make_code(UNCLASSIFIED, 10)));
 }
 
@@ -276,12 +281,12 @@
 static void SanityCheck() {
   v8::HandleScope scope;
 #ifdef DEBUG
-  Heap::Verify();
+  HEAP->Verify();
 #endif
-  CHECK(Top::global()->IsJSObject());
-  CHECK(Top::global_context()->IsContext());
-  CHECK(Heap::symbol_table()->IsSymbolTable());
-  CHECK(!Factory::LookupAsciiSymbol("Empty")->IsFailure());
+  CHECK(Isolate::Current()->global()->IsJSObject());
+  CHECK(Isolate::Current()->global_context()->IsContext());
+  CHECK(HEAP->symbol_table()->IsSymbolTable());
+  CHECK(!FACTORY->LookupAsciiSymbol("Empty")->IsFailure());
 }
 
 
@@ -291,7 +296,6 @@
   // serialize a snapshot in a VM that is booted from a snapshot.
   if (!Snapshot::IsEnabled()) {
     v8::HandleScope scope;
-
     Deserialize();
 
     v8::Persistent<v8::Context> env = v8::Context::New();
@@ -305,7 +309,6 @@
 DEPENDENT_TEST(DeserializeFromSecondSerialization, SerializeTwice) {
   if (!Snapshot::IsEnabled()) {
     v8::HandleScope scope;
-
     Deserialize();
 
     v8::Persistent<v8::Context> env = v8::Context::New();
@@ -319,7 +322,6 @@
 DEPENDENT_TEST(DeserializeAndRunScript2, Serialize) {
   if (!Snapshot::IsEnabled()) {
     v8::HandleScope scope;
-
     Deserialize();
 
     v8::Persistent<v8::Context> env = v8::Context::New();
@@ -337,7 +339,6 @@
                SerializeTwice) {
   if (!Snapshot::IsEnabled()) {
     v8::HandleScope scope;
-
     Deserialize();
 
     v8::Persistent<v8::Context> env = v8::Context::New();
@@ -361,11 +362,11 @@
   // Make sure all builtin scripts are cached.
   { HandleScope scope;
     for (int i = 0; i < Natives::GetBuiltinsCount(); i++) {
-      Bootstrapper::NativesSourceLookup(i);
+      Isolate::Current()->bootstrapper()->NativesSourceLookup(i);
     }
   }
-  Heap::CollectAllGarbage(true);
-  Heap::CollectAllGarbage(true);
+  HEAP->CollectAllGarbage(true);
+  HEAP->CollectAllGarbage(true);
 
   Object* raw_foo;
   {
@@ -425,7 +426,7 @@
 #undef fscanf
 #endif
   fclose(fp);
-  Heap::ReserveSpace(new_size,
+  HEAP->ReserveSpace(new_size,
                      pointer_size,
                      data_size,
                      code_size,
@@ -482,12 +483,12 @@
   // Make sure all builtin scripts are cached.
   { HandleScope scope;
     for (int i = 0; i < Natives::GetBuiltinsCount(); i++) {
-      Bootstrapper::NativesSourceLookup(i);
+      Isolate::Current()->bootstrapper()->NativesSourceLookup(i);
     }
   }
   // If we don't do this then we end up with a stray root pointing at the
   // context even after we have disposed of env.
-  Heap::CollectAllGarbage(true);
+  HEAP->CollectAllGarbage(true);
 
   int file_name_length = StrLength(FLAG_testing_serialization_file) + 10;
   Vector<char> startup_name = Vector<char>::New(file_name_length + 1);
@@ -561,7 +562,7 @@
 
   for (int size = 1000; size < 5 * MB; size += size >> 1) {
     int new_space_size = (size < new_space_max) ? size : new_space_max;
-    Heap::ReserveSpace(
+    HEAP->ReserveSpace(
         new_space_size,
         size,              // Old pointer space.
         size,              // Old data space.
@@ -584,7 +585,7 @@
          i + kSmallFixedArraySize <= new_space_size;
          i += kSmallFixedArraySize) {
       Object* obj =
-          Heap::AllocateFixedArray(kSmallFixedArrayLength)->ToObjectChecked();
+          HEAP->AllocateFixedArray(kSmallFixedArrayLength)->ToObjectChecked();
       if (new_last != NULL) {
         CHECK(reinterpret_cast<char*>(obj) ==
               reinterpret_cast<char*>(new_last) + kSmallFixedArraySize);
@@ -596,7 +597,7 @@
     for (int i = 0;
          i + kSmallFixedArraySize <= size;
          i += kSmallFixedArraySize) {
-      Object* obj = Heap::AllocateFixedArray(kSmallFixedArrayLength,
+      Object* obj = HEAP->AllocateFixedArray(kSmallFixedArrayLength,
                                              TENURED)->ToObjectChecked();
       int old_page_fullness = i % Page::kPageSize;
       int page_fullness = (i + kSmallFixedArraySize) % Page::kPageSize;
@@ -614,7 +615,7 @@
 
     Object* data_last = NULL;
     for (int i = 0; i + kSmallStringSize <= size; i += kSmallStringSize) {
-      Object* obj = Heap::AllocateRawAsciiString(kSmallStringLength,
+      Object* obj = HEAP->AllocateRawAsciiString(kSmallStringLength,
                                                  TENURED)->ToObjectChecked();
       int old_page_fullness = i % Page::kPageSize;
       int page_fullness = (i + kSmallStringSize) % Page::kPageSize;
@@ -632,7 +633,7 @@
 
     Object* map_last = NULL;
     for (int i = 0; i + kMapSize <= size; i += kMapSize) {
-      Object* obj = Heap::AllocateMap(JS_OBJECT_TYPE,
+      Object* obj = HEAP->AllocateMap(JS_OBJECT_TYPE,
                                       42 * kPointerSize)->ToObjectChecked();
       int old_page_fullness = i % Page::kPageSize;
       int page_fullness = (i + kMapSize) % Page::kPageSize;
@@ -654,7 +655,7 @@
       AlwaysAllocateScope always;
       int large_object_array_length =
           (size - FixedArray::kHeaderSize) / kPointerSize;
-      Object* obj = Heap::AllocateFixedArray(large_object_array_length,
+      Object* obj = HEAP->AllocateFixedArray(large_object_array_length,
                                              TENURED)->ToObjectChecked();
       CHECK(!obj->IsFailure());
     }