Upgrade V8 to version 4.9.385.28

https://chromium.googlesource.com/v8/v8/+/4.9.385.28

FPIIM-449

Change-Id: I4b2e74289d4bf3667f2f3dc8aa2e541f63e26eb4
diff --git a/test/cctest/test-api.cc b/test/cctest/test-api.cc
index 06cf553..b78d450 100644
--- a/test/cctest/test-api.cc
+++ b/test/cctest/test-api.cc
@@ -30,7 +30,7 @@
 #include <map>
 #include <string>
 
-#include "src/v8.h"
+#include "test/cctest/test-api.h"
 
 #if V8_OS_POSIX
 #include <unistd.h>  // NOLINT
@@ -40,17 +40,18 @@
 #include "src/api.h"
 #include "src/arguments.h"
 #include "src/base/platform/platform.h"
+#include "src/base/smart-pointers.h"
 #include "src/compilation-cache.h"
-#include "src/cpu-profiler.h"
+#include "src/debug/debug.h"
 #include "src/execution.h"
-#include "src/isolate.h"
+#include "src/futex-emulation.h"
 #include "src/objects.h"
-#include "src/parser.h"
-#include "src/snapshot.h"
+#include "src/parsing/parser.h"
 #include "src/unicode-inl.h"
 #include "src/utils.h"
 #include "src/vm-state.h"
-#include "test/cctest/cctest.h"
+#include "test/cctest/heap/heap-tester.h"
+#include "test/cctest/heap/utils-inl.h"
 
 static const bool kLogThreading = false;
 
@@ -60,15 +61,17 @@
 using ::v8::Extension;
 using ::v8::Function;
 using ::v8::FunctionTemplate;
-using ::v8::Handle;
 using ::v8::HandleScope;
 using ::v8::Local;
-using ::v8::Name;
+using ::v8::Maybe;
 using ::v8::Message;
 using ::v8::MessageCallback;
+using ::v8::Name;
+using ::v8::None;
 using ::v8::Object;
 using ::v8::ObjectTemplate;
 using ::v8::Persistent;
+using ::v8::PropertyAttribute;
 using ::v8::Script;
 using ::v8::StackTrace;
 using ::v8::String;
@@ -91,8 +94,7 @@
 void RunWithProfiler(void (*test)()) {
   LocalContext env;
   v8::HandleScope scope(env->GetIsolate());
-  v8::Local<v8::String> profile_name =
-      v8::String::NewFromUtf8(env->GetIsolate(), "my_profile1");
+  v8::Local<v8::String> profile_name = v8_str("my_profile1");
   v8::CpuProfiler* cpu_profiler = env->GetIsolate()->GetCpuProfiler();
 
   cpu_profiler->StartProfiling(profile_name);
@@ -107,25 +109,27 @@
     const v8::FunctionCallbackInfo<v8::Value>& args) {
   ApiTestFuzzer::Fuzz();
   signature_callback_count++;
-  CHECK_EQ(signature_expected_receiver, args.Holder());
-  CHECK_EQ(signature_expected_receiver, args.This());
-  v8::Handle<v8::Array> result =
+  CHECK(signature_expected_receiver->Equals(
+                                       args.GetIsolate()->GetCurrentContext(),
+                                       args.Holder())
+            .FromJust());
+  CHECK(signature_expected_receiver->Equals(
+                                       args.GetIsolate()->GetCurrentContext(),
+                                       args.This())
+            .FromJust());
+  v8::Local<v8::Array> result =
       v8::Array::New(args.GetIsolate(), args.Length());
-  for (int i = 0; i < args.Length(); i++)
-    result->Set(v8::Integer::New(args.GetIsolate(), i), args[i]);
+  for (int i = 0; i < args.Length(); i++) {
+    CHECK(result->Set(args.GetIsolate()->GetCurrentContext(),
+                      v8::Integer::New(args.GetIsolate(), i), args[i])
+              .FromJust());
+  }
   args.GetReturnValue().Set(result);
 }
 
 
-static void SignatureCallback(
-    const v8::FunctionCallbackInfo<v8::Value>& args) {
-  ApiTestFuzzer::Fuzz();
-  v8::Handle<v8::Array> result =
-      v8::Array::New(args.GetIsolate(), args.Length());
-  for (int i = 0; i < args.Length(); i++) {
-    result->Set(v8::Integer::New(args.GetIsolate(), i), args[i]);
-  }
-  args.GetReturnValue().Set(result);
+static void Returns42(const v8::FunctionCallbackInfo<v8::Value>& info) {
+  info.GetReturnValue().Set(42);
 }
 
 
@@ -158,13 +162,13 @@
   CHECK(!local_env.IsEmpty());
   local_env->Enter();
 
-  v8::Handle<v8::Primitive> undef = v8::Undefined(CcTest::isolate());
+  v8::Local<v8::Primitive> undef = v8::Undefined(CcTest::isolate());
   CHECK(!undef.IsEmpty());
   CHECK(undef->IsUndefined());
 
   const char* source = "1 + 2 + 3";
   Local<Script> script = v8_compile(source);
-  CHECK_EQ(6, script->Run()->Int32Value());
+  CHECK_EQ(6, v8_run_int32value(script));
 
   local_env->Exit();
 }
@@ -172,7 +176,7 @@
 
 THREADED_TEST(IsolateOfContext) {
   v8::HandleScope scope(CcTest::isolate());
-  v8::Handle<Context> env = Context::New(CcTest::isolate());
+  v8::Local<Context> env = Context::New(CcTest::isolate());
 
   CHECK(!env->GetIsolate()->InContext());
   CHECK(env->GetIsolate() == CcTest::isolate());
@@ -196,14 +200,18 @@
   signature_callback_count = 0;
   signature_expected_receiver = receiver;
   bool expected_to_throw = receiver.IsEmpty();
-  v8::TryCatch try_catch;
+  v8::TryCatch try_catch(isolate);
   CompileRun(source.start());
   CHECK_EQ(expected_to_throw, try_catch.HasCaught());
   if (!expected_to_throw) {
     CHECK_EQ(10, signature_callback_count);
   } else {
-    CHECK_EQ(v8_str("TypeError: Illegal invocation"),
-             try_catch.Exception()->ToString(isolate));
+    CHECK(v8_str("TypeError: Illegal invocation")
+              ->Equals(isolate->GetCurrentContext(),
+                       try_catch.Exception()
+                           ->ToString(isolate->GetCurrentContext())
+                           .ToLocalChecked())
+              .FromJust());
   }
 }
 
@@ -213,32 +221,43 @@
   v8::Isolate* isolate = env->GetIsolate();
   v8::HandleScope scope(isolate);
   // Setup templates.
-  v8::Handle<v8::FunctionTemplate> fun = v8::FunctionTemplate::New(isolate);
-  v8::Handle<v8::Signature> sig = v8::Signature::New(isolate, fun);
-  v8::Handle<v8::FunctionTemplate> callback_sig =
-      v8::FunctionTemplate::New(
-          isolate, IncrementingSignatureCallback, Local<Value>(), sig);
-  v8::Handle<v8::FunctionTemplate> callback =
+  v8::Local<v8::FunctionTemplate> fun = v8::FunctionTemplate::New(isolate);
+  v8::Local<v8::Signature> sig = v8::Signature::New(isolate, fun);
+  v8::Local<v8::FunctionTemplate> callback_sig = v8::FunctionTemplate::New(
+      isolate, IncrementingSignatureCallback, Local<Value>(), sig);
+  v8::Local<v8::FunctionTemplate> callback =
       v8::FunctionTemplate::New(isolate, IncrementingSignatureCallback);
-  v8::Handle<v8::FunctionTemplate> sub_fun = v8::FunctionTemplate::New(isolate);
+  v8::Local<v8::FunctionTemplate> sub_fun = v8::FunctionTemplate::New(isolate);
   sub_fun->Inherit(fun);
-  v8::Handle<v8::FunctionTemplate> unrel_fun =
+  v8::Local<v8::FunctionTemplate> unrel_fun =
       v8::FunctionTemplate::New(isolate);
   // Install properties.
-  v8::Handle<v8::ObjectTemplate> fun_proto = fun->PrototypeTemplate();
+  v8::Local<v8::ObjectTemplate> fun_proto = fun->PrototypeTemplate();
   fun_proto->Set(v8_str("prop_sig"), callback_sig);
   fun_proto->Set(v8_str("prop"), callback);
   fun_proto->SetAccessorProperty(
       v8_str("accessor_sig"), callback_sig, callback_sig);
   fun_proto->SetAccessorProperty(v8_str("accessor"), callback, callback);
   // Instantiate templates.
-  Local<Value> fun_instance = fun->InstanceTemplate()->NewInstance();
-  Local<Value> sub_fun_instance = sub_fun->InstanceTemplate()->NewInstance();
+  Local<Value> fun_instance =
+      fun->InstanceTemplate()->NewInstance(env.local()).ToLocalChecked();
+  Local<Value> sub_fun_instance =
+      sub_fun->InstanceTemplate()->NewInstance(env.local()).ToLocalChecked();
   // Setup global variables.
-  env->Global()->Set(v8_str("Fun"), fun->GetFunction());
-  env->Global()->Set(v8_str("UnrelFun"), unrel_fun->GetFunction());
-  env->Global()->Set(v8_str("fun_instance"), fun_instance);
-  env->Global()->Set(v8_str("sub_fun_instance"), sub_fun_instance);
+  CHECK(env->Global()
+            ->Set(env.local(), v8_str("Fun"),
+                  fun->GetFunction(env.local()).ToLocalChecked())
+            .FromJust());
+  CHECK(env->Global()
+            ->Set(env.local(), v8_str("UnrelFun"),
+                  unrel_fun->GetFunction(env.local()).ToLocalChecked())
+            .FromJust());
+  CHECK(env->Global()
+            ->Set(env.local(), v8_str("fun_instance"), fun_instance)
+            .FromJust());
+  CHECK(env->Global()
+            ->Set(env.local(), v8_str("sub_fun_instance"), sub_fun_instance)
+            .FromJust());
   CompileRun(
       "var accessor_sig_key = 'accessor_sig';"
       "var accessor_key = 'accessor';"
@@ -283,81 +302,12 @@
 }
 
 
-THREADED_TEST(ArgumentSignature) {
-  LocalContext env;
-  v8::Isolate* isolate = env->GetIsolate();
-  v8::HandleScope scope(isolate);
-  v8::Handle<v8::FunctionTemplate> cons = v8::FunctionTemplate::New(isolate);
-  cons->SetClassName(v8_str("Cons"));
-  v8::Handle<v8::Signature> sig = v8::Signature::New(
-      isolate, v8::Handle<v8::FunctionTemplate>(), 1, &cons);
-  v8::Handle<v8::FunctionTemplate> fun =
-      v8::FunctionTemplate::New(isolate,
-                                SignatureCallback,
-                                v8::Handle<Value>(),
-                                sig);
-  env->Global()->Set(v8_str("Cons"), cons->GetFunction());
-  env->Global()->Set(v8_str("Fun1"), fun->GetFunction());
-
-  v8::Handle<Value> value1 = CompileRun("Fun1(4) == '';");
-  CHECK(value1->IsTrue());
-
-  v8::Handle<Value> value2 = CompileRun("Fun1(new Cons()) == '[object Cons]';");
-  CHECK(value2->IsTrue());
-
-  v8::Handle<Value> value3 = CompileRun("Fun1() == '';");
-  CHECK(value3->IsTrue());
-
-  v8::Handle<v8::FunctionTemplate> cons1 = v8::FunctionTemplate::New(isolate);
-  cons1->SetClassName(v8_str("Cons1"));
-  v8::Handle<v8::FunctionTemplate> cons2 = v8::FunctionTemplate::New(isolate);
-  cons2->SetClassName(v8_str("Cons2"));
-  v8::Handle<v8::FunctionTemplate> cons3 = v8::FunctionTemplate::New(isolate);
-  cons3->SetClassName(v8_str("Cons3"));
-
-  v8::Handle<v8::FunctionTemplate> args[3] = { cons1, cons2, cons3 };
-  v8::Handle<v8::Signature> wsig = v8::Signature::New(
-      isolate, v8::Handle<v8::FunctionTemplate>(), 3, args);
-  v8::Handle<v8::FunctionTemplate> fun2 =
-      v8::FunctionTemplate::New(isolate,
-                                SignatureCallback,
-                                v8::Handle<Value>(),
-                                wsig);
-
-  env->Global()->Set(v8_str("Cons1"), cons1->GetFunction());
-  env->Global()->Set(v8_str("Cons2"), cons2->GetFunction());
-  env->Global()->Set(v8_str("Cons3"), cons3->GetFunction());
-  env->Global()->Set(v8_str("Fun2"), fun2->GetFunction());
-  v8::Handle<Value> value4 = CompileRun(
-      "Fun2(new Cons1(), new Cons2(), new Cons3()) =="
-      "'[object Cons1],[object Cons2],[object Cons3]'");
-  CHECK(value4->IsTrue());
-
-  v8::Handle<Value> value5 = CompileRun(
-      "Fun2(new Cons1(), new Cons2(), 5) == '[object Cons1],[object Cons2],'");
-  CHECK(value5->IsTrue());
-
-  v8::Handle<Value> value6 = CompileRun(
-      "Fun2(new Cons3(), new Cons2(), new Cons1()) == ',[object Cons2],'");
-  CHECK(value6->IsTrue());
-
-  v8::Handle<Value> value7 = CompileRun(
-      "Fun2(new Cons1(), new Cons2(), new Cons3(), 'd') == "
-      "'[object Cons1],[object Cons2],[object Cons3],d';");
-  CHECK(value7->IsTrue());
-
-  v8::Handle<Value> value8 = CompileRun(
-      "Fun2(new Cons1(), new Cons2()) == '[object Cons1],[object Cons2]'");
-  CHECK(value8->IsTrue());
-}
-
-
 THREADED_TEST(HulIgennem) {
   LocalContext env;
   v8::Isolate* isolate = env->GetIsolate();
   v8::HandleScope scope(isolate);
-  v8::Handle<v8::Primitive> undef = v8::Undefined(isolate);
-  Local<String> undef_str = undef->ToString(isolate);
+  v8::Local<v8::Primitive> undef = v8::Undefined(isolate);
+  Local<String> undef_str = undef->ToString(env.local()).ToLocalChecked();
   char* value = i::NewArray<char>(undef_str->Utf8Length() + 1);
   undef_str->WriteUtf8(value);
   CHECK_EQ(0, strcmp(value, "undefined"));
@@ -370,14 +320,16 @@
   v8::Isolate* isolate = env->GetIsolate();
   v8::HandleScope scope(isolate);
   Local<v8::Object> obj = v8::Object::New(isolate);
-  Local<Value> foo_before = obj->Get(v8_str("foo"));
+  Local<Value> foo_before =
+      obj->Get(env.local(), v8_str("foo")).ToLocalChecked();
   CHECK(foo_before->IsUndefined());
   Local<String> bar_str = v8_str("bar");
-  obj->Set(v8_str("foo"), bar_str);
-  Local<Value> foo_after = obj->Get(v8_str("foo"));
+  CHECK(obj->Set(env.local(), v8_str("foo"), bar_str).FromJust());
+  Local<Value> foo_after =
+      obj->Get(env.local(), v8_str("foo")).ToLocalChecked();
   CHECK(!foo_after->IsUndefined());
   CHECK(foo_after->IsString());
-  CHECK_EQ(bar_str, foo_after);
+  CHECK(bar_str->Equals(env.local(), foo_after).FromJust());
 }
 
 
@@ -385,18 +337,22 @@
   LocalContext env;
   v8::HandleScope scope(env->GetIsolate());
   Local<v8::Object> obj = v8::Object::New(env->GetIsolate());
-  Local<Value> before = obj->Get(1);
+  Local<Value> before = obj->Get(env.local(), 1).ToLocalChecked();
   CHECK(before->IsUndefined());
   Local<String> bar_str = v8_str("bar");
-  obj->Set(1, bar_str);
-  Local<Value> after = obj->Get(1);
+  CHECK(obj->Set(env.local(), 1, bar_str).FromJust());
+  Local<Value> after = obj->Get(env.local(), 1).ToLocalChecked();
   CHECK(!after->IsUndefined());
   CHECK(after->IsString());
-  CHECK_EQ(bar_str, after);
+  CHECK(bar_str->Equals(env.local(), after).FromJust());
 
   Local<v8::Array> value = CompileRun("[\"a\", \"b\"]").As<v8::Array>();
-  CHECK_EQ(v8_str("a"), value->Get(0));
-  CHECK_EQ(v8_str("b"), value->Get(1));
+  CHECK(v8_str("a")
+            ->Equals(env.local(), value->Get(env.local(), 0).ToLocalChecked())
+            .FromJust());
+  CHECK(v8_str("b")
+            ->Equals(env.local(), value->Get(env.local(), 1).ToLocalChecked())
+            .FromJust());
 }
 
 
@@ -405,7 +361,7 @@
   v8::HandleScope scope(env->GetIsolate());
   const char* source = "1 + 2 + 3";
   Local<Script> script = v8_compile(source);
-  CHECK_EQ(6, script->Run()->Int32Value());
+  CHECK_EQ(6, v8_run_int32value(script));
 }
 
 
@@ -476,11 +432,13 @@
     LocalContext env;
     v8::HandleScope scope(env->GetIsolate());
     TestResource* resource = new TestResource(two_byte_source, &dispose_count);
-    Local<String> source = String::NewExternal(env->GetIsolate(), resource);
+    Local<String> source =
+        String::NewExternalTwoByte(env->GetIsolate(), resource)
+            .ToLocalChecked();
     Local<Script> script = v8_compile(source);
-    Local<Value> value = script->Run();
+    Local<Value> value = script->Run(env.local()).ToLocalChecked();
     CHECK(value->IsNumber());
-    CHECK_EQ(7, value->Int32Value());
+    CHECK_EQ(7, value->Int32Value(env.local()).FromJust());
     CHECK(source->IsExternal());
     CHECK_EQ(resource,
              static_cast<TestResource*>(source->GetExternalStringResource()));
@@ -488,7 +446,7 @@
     CHECK_EQ(static_cast<const String::ExternalStringResourceBase*>(resource),
              source->GetExternalStringResourceBase(&encoding));
     CHECK_EQ(String::TWO_BYTE_ENCODING, encoding);
-    CcTest::heap()->CollectAllGarbage(i::Heap::kNoGCFlags);
+    CcTest::heap()->CollectAllGarbage();
     CHECK_EQ(0, dispose_count);
   }
   CcTest::i_isolate()->compilation_cache()->Clear();
@@ -505,7 +463,9 @@
     v8::HandleScope scope(env->GetIsolate());
     TestOneByteResource* resource =
         new TestOneByteResource(i::StrDup(c_source), &dispose_count);
-    Local<String> source = String::NewExternal(env->GetIsolate(), resource);
+    Local<String> source =
+        String::NewExternalOneByte(env->GetIsolate(), resource)
+            .ToLocalChecked();
     CHECK(source->IsExternalOneByte());
     CHECK_EQ(static_cast<const String::ExternalStringResourceBase*>(resource),
              source->GetExternalOneByteStringResource());
@@ -514,10 +474,10 @@
              source->GetExternalStringResourceBase(&encoding));
     CHECK_EQ(String::ONE_BYTE_ENCODING, encoding);
     Local<Script> script = v8_compile(source);
-    Local<Value> value = script->Run();
+    Local<Value> value = script->Run(env.local()).ToLocalChecked();
     CHECK(value->IsNumber());
-    CHECK_EQ(7, value->Int32Value());
-    CcTest::heap()->CollectAllGarbage(i::Heap::kNoGCFlags);
+    CHECK_EQ(7, value->Int32Value(env.local()).FromJust());
+    CcTest::heap()->CollectAllGarbage();
     CHECK_EQ(0, dispose_count);
   }
   CcTest::i_isolate()->compilation_cache()->Clear();
@@ -533,27 +493,29 @@
     LocalContext env;
     v8::HandleScope scope(env->GetIsolate());
     Local<String> source =
-        String::NewFromTwoByte(env->GetIsolate(), two_byte_source);
+        String::NewFromTwoByte(env->GetIsolate(), two_byte_source,
+                               v8::NewStringType::kNormal)
+            .ToLocalChecked();
     // Trigger GCs so that the newly allocated string moves to old gen.
     CcTest::heap()->CollectGarbage(i::NEW_SPACE);  // in survivor space now
     CcTest::heap()->CollectGarbage(i::NEW_SPACE);  // in old gen now
     CHECK_EQ(source->IsExternal(), false);
     CHECK_EQ(source->IsExternalOneByte(), false);
     String::Encoding encoding = String::UNKNOWN_ENCODING;
-    CHECK_EQ(NULL, source->GetExternalStringResourceBase(&encoding));
+    CHECK(!source->GetExternalStringResourceBase(&encoding));
     CHECK_EQ(String::ONE_BYTE_ENCODING, encoding);
     bool success = source->MakeExternal(new TestResource(two_byte_source,
                                                          &dispose_count));
     CHECK(success);
     Local<Script> script = v8_compile(source);
-    Local<Value> value = script->Run();
+    Local<Value> value = script->Run(env.local()).ToLocalChecked();
     CHECK(value->IsNumber());
-    CHECK_EQ(7, value->Int32Value());
-    CcTest::heap()->CollectAllGarbage(i::Heap::kNoGCFlags);
+    CHECK_EQ(7, value->Int32Value(env.local()).FromJust());
+    CcTest::heap()->CollectAllGarbage();
     CHECK_EQ(0, dispose_count);
   }
   CcTest::i_isolate()->compilation_cache()->Clear();
-  CcTest::heap()->CollectAllGarbage(i::Heap::kAbortIncrementalMarkingMask);
+  CcTest::heap()->CollectAllGarbage();
   CHECK_EQ(1, dispose_count);
 }
 
@@ -572,14 +534,14 @@
         new TestOneByteResource(i::StrDup(c_source), &dispose_count));
     CHECK(success);
     Local<Script> script = v8_compile(source);
-    Local<Value> value = script->Run();
+    Local<Value> value = script->Run(env.local()).ToLocalChecked();
     CHECK(value->IsNumber());
-    CHECK_EQ(7, value->Int32Value());
-    CcTest::heap()->CollectAllGarbage(i::Heap::kNoGCFlags);
+    CHECK_EQ(7, value->Int32Value(env.local()).FromJust());
+    CcTest::heap()->CollectAllGarbage();
     CHECK_EQ(0, dispose_count);
   }
   CcTest::i_isolate()->compilation_cache()->Clear();
-  CcTest::heap()->CollectAllGarbage(i::Heap::kAbortIncrementalMarkingMask);
+  CcTest::heap()->CollectAllGarbage();
   CHECK_EQ(1, dispose_count);
 }
 
@@ -594,10 +556,12 @@
 
   uint16_t* two_byte_string = AsciiToTwoByteString("s1");
   Local<String> small_string =
-      String::NewFromTwoByte(env->GetIsolate(), two_byte_string);
+      String::NewFromTwoByte(env->GetIsolate(), two_byte_string,
+                             v8::NewStringType::kNormal)
+          .ToLocalChecked();
   i::DeleteArray(two_byte_string);
 
-  // We should refuse to externalize newly created small string.
+  // We should refuse to externalize small strings.
   CHECK(!small_string->CanMakeExternal());
   // Trigger GCs so that the newly allocated string moves to old gen.
   CcTest::heap()->CollectGarbage(i::NEW_SPACE);  // in survivor space now
@@ -606,17 +570,11 @@
   CHECK(small_string->CanMakeExternal());
 
   two_byte_string = AsciiToTwoByteString("small string 2");
-  small_string = String::NewFromTwoByte(env->GetIsolate(), two_byte_string);
+  small_string = String::NewFromTwoByte(env->GetIsolate(), two_byte_string,
+                                        v8::NewStringType::kNormal)
+                     .ToLocalChecked();
   i::DeleteArray(two_byte_string);
 
-  // We should refuse externalizing newly created small string.
-  CHECK(!small_string->CanMakeExternal());
-  for (int i = 0; i < 100; i++) {
-    String::Value value(small_string);
-  }
-  // Frequently used strings should be accepted.
-  CHECK(small_string->CanMakeExternal());
-
   const int buf_size = 10 * 1024;
   char* buf = i::NewArray<char>(buf_size);
   memset(buf, 'a', buf_size);
@@ -624,7 +582,9 @@
 
   two_byte_string = AsciiToTwoByteString(buf);
   Local<String> large_string =
-      String::NewFromTwoByte(env->GetIsolate(), two_byte_string);
+      String::NewFromTwoByte(env->GetIsolate(), two_byte_string,
+                             v8::NewStringType::kNormal)
+          .ToLocalChecked();
   i::DeleteArray(buf);
   i::DeleteArray(two_byte_string);
   // Large strings should be immediately accepted.
@@ -640,8 +600,8 @@
   CcTest::heap()->CollectGarbage(i::NEW_SPACE);
   CcTest::heap()->CollectGarbage(i::NEW_SPACE);
 
-  Local<String> small_string = String::NewFromUtf8(env->GetIsolate(), "s1");
-  // We should refuse to externalize newly created small string.
+  Local<String> small_string = v8_str("s1");
+  // We should refuse to externalize small strings.
   CHECK(!small_string->CanMakeExternal());
   // Trigger GCs so that the newly allocated string moves to old gen.
   CcTest::heap()->CollectGarbage(i::NEW_SPACE);  // in survivor space now
@@ -649,20 +609,11 @@
   // Old space strings should be accepted.
   CHECK(small_string->CanMakeExternal());
 
-  small_string = String::NewFromUtf8(env->GetIsolate(), "small string 2");
-  // We should refuse externalizing newly created small string.
-  CHECK(!small_string->CanMakeExternal());
-  for (int i = 0; i < 100; i++) {
-    String::Value value(small_string);
-  }
-  // Frequently used strings should be accepted.
-  CHECK(small_string->CanMakeExternal());
-
   const int buf_size = 10 * 1024;
   char* buf = i::NewArray<char>(buf_size);
   memset(buf, 'a', buf_size);
   buf[buf_size - 1] = '\0';
-  Local<String> large_string = String::NewFromUtf8(env->GetIsolate(), buf);
+  Local<String> large_string = v8_str(buf);
   i::DeleteArray(buf);
   // Large strings should be immediately accepted.
   CHECK(large_string->CanMakeExternal());
@@ -683,7 +634,7 @@
       "slice('abcdefghijklmnopqrstuvwxyz');"));
 
   // Trigger GCs so that the newly allocated string moves to old gen.
-  SimulateFullSpace(CcTest::heap()->old_pointer_space());
+  SimulateFullSpace(CcTest::heap()->old_space());
   CcTest::heap()->CollectGarbage(i::NEW_SPACE);  // in survivor space now
   CcTest::heap()->CollectGarbage(i::NEW_SPACE);  // in old gen now
 
@@ -698,7 +649,7 @@
   CHECK(success);
 
   // Trigger GCs and force evacuation.
-  CcTest::heap()->CollectAllGarbage(i::Heap::kNoGCFlags);
+  CcTest::heap()->CollectAllGarbage();
   CcTest::heap()->CollectAllGarbage(i::Heap::kReduceMemoryFootprintMask);
 }
 
@@ -708,8 +659,10 @@
   {
     v8::HandleScope scope(CcTest::isolate());
     uint16_t* two_byte_string = AsciiToTwoByteString("test string");
-    Local<String> string = String::NewExternal(
-        CcTest::isolate(), new TestResource(two_byte_string));
+    Local<String> string =
+        String::NewExternalTwoByte(CcTest::isolate(),
+                                   new TestResource(two_byte_string))
+            .ToLocalChecked();
     i::Handle<i::String> istring = v8::Utils::OpenHandle(*string);
     // Trigger GCs so that the newly allocated string moves to old gen.
     CcTest::heap()->CollectGarbage(i::NEW_SPACE);  // in survivor space now
@@ -718,8 +671,8 @@
         factory->InternalizeString(istring);
     CHECK(isymbol->IsInternalizedString());
   }
-  CcTest::heap()->CollectAllGarbage(i::Heap::kNoGCFlags);
-  CcTest::heap()->CollectAllGarbage(i::Heap::kNoGCFlags);
+  CcTest::heap()->CollectAllGarbage();
+  CcTest::heap()->CollectAllGarbage();
 }
 
 
@@ -728,8 +681,11 @@
   {
     v8::HandleScope scope(CcTest::isolate());
     const char* one_byte_string = "test string";
-    Local<String> string = String::NewExternal(
-        CcTest::isolate(), new TestOneByteResource(i::StrDup(one_byte_string)));
+    Local<String> string =
+        String::NewExternalOneByte(
+            CcTest::isolate(),
+            new TestOneByteResource(i::StrDup(one_byte_string)))
+            .ToLocalChecked();
     i::Handle<i::String> istring = v8::Utils::OpenHandle(*string);
     // Trigger GCs so that the newly allocated string moves to old gen.
     CcTest::heap()->CollectGarbage(i::NEW_SPACE);  // in survivor space now
@@ -738,8 +694,8 @@
         factory->InternalizeString(istring);
     CHECK(isymbol->IsInternalizedString());
   }
-  CcTest::heap()->CollectAllGarbage(i::Heap::kNoGCFlags);
-  CcTest::heap()->CollectAllGarbage(i::Heap::kNoGCFlags);
+  CcTest::heap()->CollectAllGarbage();
+  CcTest::heap()->CollectAllGarbage();
 }
 
 
@@ -769,28 +725,25 @@
 
 
 THREADED_TEST(NewExternalForVeryLongString) {
+  auto isolate = CcTest::isolate();
   {
-    LocalContext env;
-    v8::HandleScope scope(env->GetIsolate());
-    v8::TryCatch try_catch;
+    v8::HandleScope scope(isolate);
+    v8::TryCatch try_catch(isolate);
     RandomLengthOneByteResource r(1 << 30);
-    v8::Local<v8::String> str = v8::String::NewExternal(CcTest::isolate(), &r);
-    CHECK(str.IsEmpty());
-    CHECK(try_catch.HasCaught());
-    String::Utf8Value exception_value(try_catch.Exception());
-    CHECK_EQ("RangeError: Invalid string length", *exception_value);
+    v8::MaybeLocal<v8::String> maybe_str =
+        v8::String::NewExternalOneByte(isolate, &r);
+    CHECK(maybe_str.IsEmpty());
+    CHECK(!try_catch.HasCaught());
   }
 
   {
-    LocalContext env;
-    v8::HandleScope scope(env->GetIsolate());
-    v8::TryCatch try_catch;
+    v8::HandleScope scope(isolate);
+    v8::TryCatch try_catch(isolate);
     RandomLengthResource r(1 << 30);
-    v8::Local<v8::String> str = v8::String::NewExternal(CcTest::isolate(), &r);
-    CHECK(str.IsEmpty());
-    CHECK(try_catch.HasCaught());
-    String::Utf8Value exception_value(try_catch.Exception());
-    CHECK_EQ("RangeError: Invalid string length", *exception_value);
+    v8::MaybeLocal<v8::String> maybe_str =
+        v8::String::NewExternalTwoByte(isolate, &r);
+    CHECK(maybe_str.IsEmpty());
+    CHECK(!try_catch.HasCaught());
   }
 }
 
@@ -803,16 +756,18 @@
   {
     v8::HandleScope scope(CcTest::isolate());
     uint16_t* two_byte_string = AsciiToTwoByteString("test string");
-    Local<String> string = String::NewExternal(
-        CcTest::isolate(), new TestResource(two_byte_string, &dispose_count));
+    Local<String> string =
+        String::NewExternalTwoByte(
+            CcTest::isolate(),
+            new TestResource(two_byte_string, &dispose_count))
+            .ToLocalChecked();
     i::Handle<i::String> istring = v8::Utils::OpenHandle(*string);
     CcTest::heap()->CollectGarbage(i::NEW_SPACE);
     in_new_space = CcTest::heap()->InNewSpace(*istring);
-    CHECK(in_new_space || CcTest::heap()->old_data_space()->Contains(*istring));
+    CHECK(in_new_space || CcTest::heap()->old_space()->Contains(*istring));
     CHECK_EQ(0, dispose_count);
   }
-  CcTest::heap()->CollectGarbage(
-      in_new_space ? i::NEW_SPACE : i::OLD_DATA_SPACE);
+  CcTest::heap()->CollectGarbage(in_new_space ? i::NEW_SPACE : i::OLD_SPACE);
   CHECK_EQ(1, dispose_count);
 }
 
@@ -825,17 +780,18 @@
   {
     v8::HandleScope scope(CcTest::isolate());
     const char* one_byte_string = "test string";
-    Local<String> string = String::NewExternal(
-        CcTest::isolate(),
-        new TestOneByteResource(i::StrDup(one_byte_string), &dispose_count));
+    Local<String> string =
+        String::NewExternalOneByte(
+            CcTest::isolate(),
+            new TestOneByteResource(i::StrDup(one_byte_string), &dispose_count))
+            .ToLocalChecked();
     i::Handle<i::String> istring = v8::Utils::OpenHandle(*string);
     CcTest::heap()->CollectGarbage(i::NEW_SPACE);
     in_new_space = CcTest::heap()->InNewSpace(*istring);
-    CHECK(in_new_space || CcTest::heap()->old_data_space()->Contains(*istring));
+    CHECK(in_new_space || CcTest::heap()->old_space()->Contains(*istring));
     CHECK_EQ(0, dispose_count);
   }
-  CcTest::heap()->CollectGarbage(
-      in_new_space ? i::NEW_SPACE : i::OLD_DATA_SPACE);
+  CcTest::heap()->CollectGarbage(in_new_space ? i::NEW_SPACE : i::OLD_SPACE);
   CHECK_EQ(1, dispose_count);
 }
 
@@ -872,11 +828,13 @@
   {
     LocalContext env;
     v8::HandleScope scope(env->GetIsolate());
-    Local<String> source =  String::NewExternal(env->GetIsolate(), &res_stack);
+    Local<String> source =
+        String::NewExternalOneByte(env->GetIsolate(), &res_stack)
+            .ToLocalChecked();
     Local<Script> script = v8_compile(source);
-    Local<Value> value = script->Run();
+    Local<Value> value = script->Run(env.local()).ToLocalChecked();
     CHECK(value->IsNumber());
-    CHECK_EQ(7, value->Int32Value());
+    CHECK_EQ(7, value->Int32Value(env.local()).FromJust());
     CcTest::heap()->CollectAllAvailableGarbage();
     CHECK_EQ(0, TestOneByteResourceWithDisposeControl::dispose_count);
   }
@@ -893,11 +851,13 @@
   {
     LocalContext env;
     v8::HandleScope scope(env->GetIsolate());
-    Local<String> source =  String::NewExternal(env->GetIsolate(), res_heap);
+    Local<String> source =
+        String::NewExternalOneByte(env->GetIsolate(), res_heap)
+            .ToLocalChecked();
     Local<Script> script = v8_compile(source);
-    Local<Value> value = script->Run();
+    Local<Value> value = script->Run(env.local()).ToLocalChecked();
     CHECK(value->IsNumber());
-    CHECK_EQ(7, value->Int32Value());
+    CHECK_EQ(7, value->Int32Value(env.local()).FromJust());
     CcTest::heap()->CollectAllAvailableGarbage();
     CHECK_EQ(0, TestOneByteResourceWithDisposeControl::dispose_count);
   }
@@ -923,74 +883,55 @@
 
     uint16_t* two_byte_source = AsciiToTwoByteString(two_byte_string_1);
     Local<String> right =
-        String::NewFromTwoByte(env->GetIsolate(), two_byte_source);
+        String::NewFromTwoByte(env->GetIsolate(), two_byte_source,
+                               v8::NewStringType::kNormal)
+            .ToLocalChecked();
     i::DeleteArray(two_byte_source);
 
     Local<String> source = String::Concat(left, right);
-    right = String::NewExternal(
-        env->GetIsolate(),
-        new TestOneByteResource(i::StrDup(one_byte_extern_1)));
+    right = String::NewExternalOneByte(
+                env->GetIsolate(),
+                new TestOneByteResource(i::StrDup(one_byte_extern_1)))
+                .ToLocalChecked();
     source = String::Concat(source, right);
-    right = String::NewExternal(
-        env->GetIsolate(),
-        new TestResource(AsciiToTwoByteString(two_byte_extern_1)));
+    right = String::NewExternalTwoByte(
+                env->GetIsolate(),
+                new TestResource(AsciiToTwoByteString(two_byte_extern_1)))
+                .ToLocalChecked();
     source = String::Concat(source, right);
     right = v8_str(one_byte_string_2);
     source = String::Concat(source, right);
 
     two_byte_source = AsciiToTwoByteString(two_byte_string_2);
-    right = String::NewFromTwoByte(env->GetIsolate(), two_byte_source);
+    right = String::NewFromTwoByte(env->GetIsolate(), two_byte_source,
+                                   v8::NewStringType::kNormal)
+                .ToLocalChecked();
     i::DeleteArray(two_byte_source);
 
     source = String::Concat(source, right);
-    right = String::NewExternal(
-        env->GetIsolate(),
-        new TestResource(AsciiToTwoByteString(two_byte_extern_2)));
+    right = String::NewExternalTwoByte(
+                env->GetIsolate(),
+                new TestResource(AsciiToTwoByteString(two_byte_extern_2)))
+                .ToLocalChecked();
     source = String::Concat(source, right);
     Local<Script> script = v8_compile(source);
-    Local<Value> value = script->Run();
+    Local<Value> value = script->Run(env.local()).ToLocalChecked();
     CHECK(value->IsNumber());
-    CHECK_EQ(68, value->Int32Value());
+    CHECK_EQ(68, value->Int32Value(env.local()).FromJust());
   }
   CcTest::i_isolate()->compilation_cache()->Clear();
-  CcTest::heap()->CollectAllGarbage(i::Heap::kNoGCFlags);
-  CcTest::heap()->CollectAllGarbage(i::Heap::kNoGCFlags);
+  CcTest::heap()->CollectAllGarbage();
+  CcTest::heap()->CollectAllGarbage();
 }
 
 
 THREADED_TEST(GlobalProperties) {
   LocalContext env;
   v8::HandleScope scope(env->GetIsolate());
-  v8::Handle<v8::Object> global = env->Global();
-  global->Set(v8_str("pi"), v8_num(3.1415926));
-  Local<Value> pi = global->Get(v8_str("pi"));
-  CHECK_EQ(3.1415926, pi->NumberValue());
-}
-
-
-template<typename T>
-static void CheckReturnValue(const T& t, i::Address callback) {
-  v8::ReturnValue<v8::Value> rv = t.GetReturnValue();
-  i::Object** o = *reinterpret_cast<i::Object***>(&rv);
-  CHECK_EQ(CcTest::isolate(), t.GetIsolate());
-  CHECK_EQ(t.GetIsolate(), rv.GetIsolate());
-  CHECK((*o)->IsTheHole() || (*o)->IsUndefined());
-  // Verify reset
-  bool is_runtime = (*o)->IsTheHole();
-  rv.Set(true);
-  CHECK(!(*o)->IsTheHole() && !(*o)->IsUndefined());
-  rv.Set(v8::Handle<v8::Object>());
-  CHECK((*o)->IsTheHole() || (*o)->IsUndefined());
-  CHECK_EQ(is_runtime, (*o)->IsTheHole());
-
-  i::Isolate* isolate = reinterpret_cast<i::Isolate*>(t.GetIsolate());
-  // If CPU profiler is active check that when API callback is invoked
-  // VMState is set to EXTERNAL.
-  if (isolate->cpu_profiler()->is_profiling()) {
-    CHECK_EQ(v8::EXTERNAL, isolate->current_vm_state());
-    CHECK(isolate->external_callback_scope());
-    CHECK_EQ(callback, isolate->external_callback_scope()->callback());
-  }
+  v8::Local<v8::Object> global = env->Global();
+  CHECK(global->Set(env.local(), v8_str("pi"), v8_num(3.1415926)).FromJust());
+  Local<Value> pi = global->Get(env.local(), v8_str("pi")).ToLocalChecked();
+  CHECK_EQ(3.1415926, pi->NumberValue(env.local()).FromJust());
 }
 
 
@@ -1016,8 +957,14 @@
     const v8::FunctionCallbackInfo<Value>& info) {
   ApiTestFuzzer::Fuzz();
   CheckReturnValue(info, FUNCTION_ADDR(construct_callback));
-  info.This()->Set(v8_str("x"), v8_num(1));
-  info.This()->Set(v8_str("y"), v8_num(2));
+  CHECK(
+      info.This()
+          ->Set(info.GetIsolate()->GetCurrentContext(), v8_str("x"), v8_num(1))
+          .FromJust());
+  CHECK(
+      info.This()
+          ->Set(info.GetIsolate()->GetCurrentContext(), v8_str("y"), v8_num(2))
+          .FromJust());
   info.GetReturnValue().Set(v8_str("bad value"));
   info.GetReturnValue().Set(info.This());
 }
@@ -1043,11 +990,11 @@
 
     Local<v8::FunctionTemplate> fun_templ =
         v8::FunctionTemplate::New(isolate, handler);
-    Local<Function> fun = fun_templ->GetFunction();
-    env->Global()->Set(v8_str("obj"), fun);
+    Local<Function> fun = fun_templ->GetFunction(env.local()).ToLocalChecked();
+    CHECK(env->Global()->Set(env.local(), v8_str("obj"), fun).FromJust());
     Local<Script> script = v8_compile("obj()");
     for (int i = 0; i < 30; i++) {
-      CHECK_EQ(102, script->Run()->Int32Value());
+      CHECK_EQ(102, v8_run_int32value(script));
     }
   }
   // Use SetCallHandler to initialize a function template, should work like
@@ -1059,11 +1006,11 @@
 
     Local<v8::FunctionTemplate> fun_templ = v8::FunctionTemplate::New(isolate);
     fun_templ->SetCallHandler(handler_2);
-    Local<Function> fun = fun_templ->GetFunction();
-    env->Global()->Set(v8_str("obj"), fun);
+    Local<Function> fun = fun_templ->GetFunction(env.local()).ToLocalChecked();
+    CHECK(env->Global()->Set(env.local(), v8_str("obj"), fun).FromJust());
     Local<Script> script = v8_compile("obj()");
     for (int i = 0; i < 30; i++) {
-      CHECK_EQ(102, script->Run()->Int32Value());
+      CHECK_EQ(102, v8_run_int32value(script));
     }
   }
 }
@@ -1079,19 +1026,20 @@
       v8::FunctionTemplate::New(env->GetIsolate(), constructor);
   fun_templ->SetClassName(v8_str("funky"));
   fun_templ->InstanceTemplate()->SetAccessor(v8_str("m"), accessor);
-  Local<Function> fun = fun_templ->GetFunction();
-  env->Global()->Set(v8_str("obj"), fun);
-  Local<Value> result = v8_compile("(new obj()).toString()")->Run();
-  CHECK_EQ(v8_str("[object funky]"), result);
+  Local<Function> fun = fun_templ->GetFunction(env.local()).ToLocalChecked();
+  CHECK(env->Global()->Set(env.local(), v8_str("obj"), fun).FromJust());
+  Local<Value> result =
+      v8_compile("(new obj()).toString()")->Run(env.local()).ToLocalChecked();
+  CHECK(v8_str("[object funky]")->Equals(env.local(), result).FromJust());
   CompileRun("var obj_instance = new obj();");
   Local<Script> script;
   script = v8_compile("obj_instance.x");
   for (int i = 0; i < 30; i++) {
-    CHECK_EQ(1, script->Run()->Int32Value());
+    CHECK_EQ(1, v8_run_int32value(script));
   }
   script = v8_compile("obj_instance.m");
   for (int i = 0; i < 30; i++) {
-    CHECK_EQ(239, script->Run()->Int32Value());
+    CHECK_EQ(239, v8_run_int32value(script));
   }
 }
 
@@ -1115,20 +1063,24 @@
   v8::Isolate* isolate = env->GetIsolate();
   v8::HandleScope scope(isolate);
 
-  v8::Handle<v8::ObjectTemplate> object_template =
+  v8::Local<v8::ObjectTemplate> object_template =
       v8::ObjectTemplate::New(isolate);
   object_template->Set(isolate, "callback",
                        v8::FunctionTemplate::New(isolate, callback));
-  v8::Local<v8::Object> object = object_template->NewInstance();
-  (*env)->Global()->Set(v8_str("callback_object"), object);
-  v8::Handle<v8::Script> script;
+  v8::Local<v8::Object> object =
+      object_template->NewInstance(env.local()).ToLocalChecked();
+  CHECK((*env)
+            ->Global()
+            ->Set(env.local(), v8_str("callback_object"), object)
+            .FromJust());
+  v8::Local<v8::Script> script;
   script = v8_compile("callback_object.callback(17)");
   for (int i = 0; i < 30; i++) {
-    CHECK_EQ(51424, script->Run()->Int32Value());
+    CHECK_EQ(51424, v8_run_int32value(script));
   }
   script = v8_compile("callback_object.callback(17, 24)");
   for (int i = 0; i < 30; i++) {
-    CHECK_EQ(51425, script->Run()->Int32Value());
+    CHECK_EQ(51425, v8_run_int32value(script));
   }
 }
 
@@ -1209,25 +1161,29 @@
 template<>
 void FastReturnValueCallback<Object>(
     const v8::FunctionCallbackInfo<v8::Value>& info) {
-  v8::Handle<v8::Object> object;
+  v8::Local<v8::Object> object;
   if (!fast_return_value_object_is_empty) {
     object = Object::New(info.GetIsolate());
   }
   info.GetReturnValue().Set(object);
 }
 
-template<typename T>
-Handle<Value> TestFastReturnValues() {
+template <typename T>
+Local<Value> TestFastReturnValues() {
   LocalContext env;
   v8::Isolate* isolate = env->GetIsolate();
   v8::EscapableHandleScope scope(isolate);
-  v8::Handle<v8::ObjectTemplate> object_template =
+  v8::Local<v8::ObjectTemplate> object_template =
       v8::ObjectTemplate::New(isolate);
   v8::FunctionCallback callback = &FastReturnValueCallback<T>;
   object_template->Set(isolate, "callback",
                        v8::FunctionTemplate::New(isolate, callback));
-  v8::Local<v8::Object> object = object_template->NewInstance();
-  (*env)->Global()->Set(v8_str("callback_object"), object);
+  v8::Local<v8::Object> object =
+      object_template->NewInstance(env.local()).ToLocalChecked();
+  CHECK((*env)
+            ->Global()
+            ->Set(env.local(), v8_str("callback_object"), object)
+            .FromJust());
   return scope.Escape(CompileRun("callback_object.callback()"));
 }
 
@@ -1236,7 +1192,7 @@
   LocalContext env;
   v8::Isolate* isolate = env->GetIsolate();
   v8::HandleScope scope(isolate);
-  v8::Handle<v8::Value> value;
+  v8::Local<v8::Value> value;
   // check int32_t and uint32_t
   int32_t int_values[] = {
       0, 234, -723,
@@ -1249,24 +1205,28 @@
       fast_return_value_int32 = int_value;
       value = TestFastReturnValues<int32_t>();
       CHECK(value->IsInt32());
-      CHECK(fast_return_value_int32 == value->Int32Value());
+      CHECK_EQ(fast_return_value_int32,
+               value->Int32Value(env.local()).FromJust());
       // check uint32_t
       fast_return_value_uint32 = static_cast<uint32_t>(int_value);
       value = TestFastReturnValues<uint32_t>();
       CHECK(value->IsUint32());
-      CHECK(fast_return_value_uint32 == value->Uint32Value());
+      CHECK_EQ(fast_return_value_uint32,
+               value->Uint32Value(env.local()).FromJust());
     }
   }
   // check double
   value = TestFastReturnValues<double>();
   CHECK(value->IsNumber());
-  CHECK_EQ(kFastReturnValueDouble, value->ToNumber(isolate)->Value());
+  CHECK_EQ(kFastReturnValueDouble,
+           value->ToNumber(env.local()).ToLocalChecked()->Value());
   // check bool values
   for (int i = 0; i < 2; i++) {
     fast_return_value_bool = i == 0;
     value = TestFastReturnValues<bool>();
     CHECK(value->IsBoolean());
-    CHECK_EQ(fast_return_value_bool, value->ToBoolean(isolate)->Value());
+    CHECK_EQ(fast_return_value_bool,
+             value->ToBoolean(env.local()).ToLocalChecked()->Value());
   }
   // check oddballs
   ReturnValueOddball oddballs[] = {
@@ -1306,33 +1266,30 @@
   v8::HandleScope scope(isolate);
   {
     Local<v8::FunctionTemplate> fun_templ =
-        v8::FunctionTemplate::New(isolate,
-                                  handle_callback,
-                                  Handle<v8::Value>(),
-                                  Handle<v8::Signature>(),
-                                  23);
-    Local<Function> fun = fun_templ->GetFunction();
-    env->Global()->Set(v8_str("obj"), fun);
+        v8::FunctionTemplate::New(isolate, handle_callback, Local<v8::Value>(),
+                                  Local<v8::Signature>(), 23);
+    Local<Function> fun = fun_templ->GetFunction(env.local()).ToLocalChecked();
+    CHECK(env->Global()->Set(env.local(), v8_str("obj"), fun).FromJust());
     Local<Script> script = v8_compile("obj.length");
-    CHECK_EQ(23, script->Run()->Int32Value());
+    CHECK_EQ(23, v8_run_int32value(script));
   }
   {
     Local<v8::FunctionTemplate> fun_templ =
         v8::FunctionTemplate::New(isolate, handle_callback);
     fun_templ->SetLength(22);
-    Local<Function> fun = fun_templ->GetFunction();
-    env->Global()->Set(v8_str("obj"), fun);
+    Local<Function> fun = fun_templ->GetFunction(env.local()).ToLocalChecked();
+    CHECK(env->Global()->Set(env.local(), v8_str("obj"), fun).FromJust());
     Local<Script> script = v8_compile("obj.length");
-    CHECK_EQ(22, script->Run()->Int32Value());
+    CHECK_EQ(22, v8_run_int32value(script));
   }
   {
     // Without setting length it defaults to 0.
     Local<v8::FunctionTemplate> fun_templ =
         v8::FunctionTemplate::New(isolate, handle_callback);
-    Local<Function> fun = fun_templ->GetFunction();
-    env->Global()->Set(v8_str("obj"), fun);
+    Local<Function> fun = fun_templ->GetFunction(env.local()).ToLocalChecked();
+    CHECK(env->Global()->Set(env.local(), v8_str("obj"), fun).FromJust());
     Local<Script> script = v8_compile("obj.length");
-    CHECK_EQ(0, script->Run()->Int32Value());
+    CHECK_EQ(0, v8_run_int32value(script));
   }
 }
 
@@ -1350,19 +1307,22 @@
   v8::Isolate* isolate = env->GetIsolate();
   v8::HandleScope scope(isolate);
 
-  v8::Handle<v8::Value> data =
-      v8::External::New(isolate, expected_ptr);
+  v8::Local<v8::Value> data = v8::External::New(isolate, expected_ptr);
 
-  v8::Handle<v8::Object> obj = v8::Object::New(isolate);
-  obj->Set(v8_str("func"),
-           v8::FunctionTemplate::New(isolate, callback, data)->GetFunction());
-  env->Global()->Set(v8_str("obj"), obj);
+  v8::Local<v8::Object> obj = v8::Object::New(isolate);
+  CHECK(obj->Set(env.local(), v8_str("func"),
+                 v8::FunctionTemplate::New(isolate, callback, data)
+                     ->GetFunction(env.local())
+                     .ToLocalChecked())
+            .FromJust());
+  CHECK(env->Global()->Set(env.local(), v8_str("obj"), obj).FromJust());
 
-  CHECK(CompileRun(
-        "function foo() {\n"
-        "  for (var i = 0; i < 13; i++) obj.func();\n"
-        "}\n"
-        "foo(), true")->BooleanValue());
+  CHECK(CompileRun("function foo() {\n"
+                   "  for (var i = 0; i < 13; i++) obj.func();\n"
+                   "}\n"
+                   "foo(), true")
+            ->BooleanValue(env.local())
+            .FromJust());
 }
 
 
@@ -1422,28 +1382,43 @@
   Local<v8::FunctionTemplate> other = v8::FunctionTemplate::New(isolate);
   derived->Inherit(base);
 
-  Local<v8::Function> base_function = base->GetFunction();
-  Local<v8::Function> derived_function = derived->GetFunction();
-  Local<v8::Function> other_function = other->GetFunction();
+  Local<v8::Function> base_function =
+      base->GetFunction(env.local()).ToLocalChecked();
+  Local<v8::Function> derived_function =
+      derived->GetFunction(env.local()).ToLocalChecked();
+  Local<v8::Function> other_function =
+      other->GetFunction(env.local()).ToLocalChecked();
 
-  Local<v8::Object> base_instance = base_function->NewInstance();
-  Local<v8::Object> derived_instance = derived_function->NewInstance();
-  Local<v8::Object> derived_instance2 = derived_function->NewInstance();
-  Local<v8::Object> other_instance = other_function->NewInstance();
-  derived_instance2->Set(v8_str("__proto__"), derived_instance);
-  other_instance->Set(v8_str("__proto__"), derived_instance2);
+  Local<v8::Object> base_instance =
+      base_function->NewInstance(env.local()).ToLocalChecked();
+  Local<v8::Object> derived_instance =
+      derived_function->NewInstance(env.local()).ToLocalChecked();
+  Local<v8::Object> derived_instance2 =
+      derived_function->NewInstance(env.local()).ToLocalChecked();
+  Local<v8::Object> other_instance =
+      other_function->NewInstance(env.local()).ToLocalChecked();
+  CHECK(
+      derived_instance2->Set(env.local(), v8_str("__proto__"), derived_instance)
+          .FromJust());
+  CHECK(other_instance->Set(env.local(), v8_str("__proto__"), derived_instance2)
+            .FromJust());
 
   // base_instance is only an instance of base.
-  CHECK_EQ(base_instance,
-           base_instance->FindInstanceInPrototypeChain(base));
+  CHECK(base_instance->Equals(env.local(),
+                              base_instance->FindInstanceInPrototypeChain(base))
+            .FromJust());
   CHECK(base_instance->FindInstanceInPrototypeChain(derived).IsEmpty());
   CHECK(base_instance->FindInstanceInPrototypeChain(other).IsEmpty());
 
   // derived_instance is an instance of base and derived.
-  CHECK_EQ(derived_instance,
-           derived_instance->FindInstanceInPrototypeChain(base));
-  CHECK_EQ(derived_instance,
-           derived_instance->FindInstanceInPrototypeChain(derived));
+  CHECK(derived_instance->Equals(env.local(),
+                                 derived_instance->FindInstanceInPrototypeChain(
+                                     base))
+            .FromJust());
+  CHECK(derived_instance->Equals(env.local(),
+                                 derived_instance->FindInstanceInPrototypeChain(
+                                     derived))
+            .FromJust());
   CHECK(derived_instance->FindInstanceInPrototypeChain(other).IsEmpty());
 
   // other_instance is an instance of other and its immediate
@@ -1451,12 +1426,18 @@
   // Note, derived_instance is an instance of base and derived too,
   // but it comes after derived_instance2 in the prototype chain of
   // other_instance.
-  CHECK_EQ(derived_instance2,
-           other_instance->FindInstanceInPrototypeChain(base));
-  CHECK_EQ(derived_instance2,
-           other_instance->FindInstanceInPrototypeChain(derived));
-  CHECK_EQ(other_instance,
-           other_instance->FindInstanceInPrototypeChain(other));
+  CHECK(derived_instance2->Equals(
+                             env.local(),
+                             other_instance->FindInstanceInPrototypeChain(base))
+            .FromJust());
+  CHECK(derived_instance2->Equals(env.local(),
+                                  other_instance->FindInstanceInPrototypeChain(
+                                      derived))
+            .FromJust());
+  CHECK(other_instance->Equals(
+                          env.local(),
+                          other_instance->FindInstanceInPrototypeChain(other))
+            .FromJust());
 }
 
 
@@ -1586,12 +1567,12 @@
 THREADED_TEST(IsNativeError) {
   LocalContext env;
   v8::HandleScope scope(env->GetIsolate());
-  v8::Handle<Value> syntax_error = CompileRun(
+  v8::Local<Value> syntax_error = CompileRun(
       "var out = 0; try { eval(\"#\"); } catch(x) { out = x; } out; ");
   CHECK(syntax_error->IsNativeError());
-  v8::Handle<Value> not_error = CompileRun("{a:42}");
+  v8::Local<Value> not_error = CompileRun("{a:42}");
   CHECK(!not_error->IsNativeError());
-  v8::Handle<Value> not_object = CompileRun("42");
+  v8::Local<Value> not_object = CompileRun("42");
   CHECK(!not_object->IsNativeError());
 }
 
@@ -1601,10 +1582,10 @@
   v8::HandleScope scope(env->GetIsolate());
 
   CompileRun("function *gen() { yield 1; }\nfunction func() {}");
-  v8::Handle<Value> gen = CompileRun("gen");
-  v8::Handle<Value> genObj = CompileRun("gen()");
-  v8::Handle<Value> object = CompileRun("{a:42}");
-  v8::Handle<Value> func = CompileRun("func");
+  v8::Local<Value> gen = CompileRun("gen");
+  v8::Local<Value> genObj = CompileRun("gen()");
+  v8::Local<Value> object = CompileRun("{a:42}");
+  v8::Local<Value> func = CompileRun("func");
 
   CHECK(gen->IsGeneratorFunction());
   CHECK(gen->IsFunction());
@@ -1627,12 +1608,12 @@
 THREADED_TEST(ArgumentsObject) {
   LocalContext env;
   v8::HandleScope scope(env->GetIsolate());
-  v8::Handle<Value> arguments_object =
+  v8::Local<Value> arguments_object =
       CompileRun("var out = 0; (function(){ out = arguments; })(1,2,3); out;");
   CHECK(arguments_object->IsArgumentsObject());
-  v8::Handle<Value> array = CompileRun("[1,2,3]");
+  v8::Local<Value> array = CompileRun("[1,2,3]");
   CHECK(!array->IsArgumentsObject());
-  v8::Handle<Value> object = CompileRun("{a:42}");
+  v8::Local<Value> object = CompileRun("{a:42}");
   CHECK(!object->IsArgumentsObject());
 }
 
@@ -1640,10 +1621,10 @@
 THREADED_TEST(IsMapOrSet) {
   LocalContext env;
   v8::HandleScope scope(env->GetIsolate());
-  v8::Handle<Value> map = CompileRun("new Map()");
-  v8::Handle<Value> set = CompileRun("new Set()");
-  v8::Handle<Value> weak_map = CompileRun("new WeakMap()");
-  v8::Handle<Value> weak_set = CompileRun("new WeakSet()");
+  v8::Local<Value> map = CompileRun("new Map()");
+  v8::Local<Value> set = CompileRun("new Set()");
+  v8::Local<Value> weak_map = CompileRun("new WeakMap()");
+  v8::Local<Value> weak_set = CompileRun("new WeakSet()");
   CHECK(map->IsMap());
   CHECK(set->IsSet());
   CHECK(weak_map->IsWeakMap());
@@ -1665,7 +1646,7 @@
   CHECK(!weak_set->IsSet());
   CHECK(!weak_set->IsWeakMap());
 
-  v8::Handle<Value> object = CompileRun("{a:42}");
+  v8::Local<Value> object = CompileRun("{a:42}");
   CHECK(!object->IsMap());
   CHECK(!object->IsSet());
   CHECK(!object->IsWeakMap());
@@ -1676,20 +1657,20 @@
 THREADED_TEST(StringObject) {
   LocalContext env;
   v8::HandleScope scope(env->GetIsolate());
-  v8::Handle<Value> boxed_string = CompileRun("new String(\"test\")");
+  v8::Local<Value> boxed_string = CompileRun("new String(\"test\")");
   CHECK(boxed_string->IsStringObject());
-  v8::Handle<Value> unboxed_string = CompileRun("\"test\"");
+  v8::Local<Value> unboxed_string = CompileRun("\"test\"");
   CHECK(!unboxed_string->IsStringObject());
-  v8::Handle<Value> boxed_not_string = CompileRun("new Number(42)");
+  v8::Local<Value> boxed_not_string = CompileRun("new Number(42)");
   CHECK(!boxed_not_string->IsStringObject());
-  v8::Handle<Value> not_object = CompileRun("0");
+  v8::Local<Value> not_object = CompileRun("0");
   CHECK(!not_object->IsStringObject());
-  v8::Handle<v8::StringObject> as_boxed = boxed_string.As<v8::StringObject>();
+  v8::Local<v8::StringObject> as_boxed = boxed_string.As<v8::StringObject>();
   CHECK(!as_boxed.IsEmpty());
   Local<v8::String> the_string = as_boxed->ValueOf();
   CHECK(!the_string.IsEmpty());
   ExpectObject("\"test\"", the_string);
-  v8::Handle<v8::Value> new_boxed_string = v8::StringObject::New(the_string);
+  v8::Local<v8::Value> new_boxed_string = v8::StringObject::New(the_string);
   CHECK(new_boxed_string->IsStringObject());
   as_boxed = new_boxed_string.As<v8::StringObject>();
   the_string = as_boxed->ValueOf();
@@ -1698,20 +1679,31 @@
 }
 
 
+TEST(StringObjectDelete) {
+  LocalContext context;
+  v8::HandleScope scope(context->GetIsolate());
+  v8::Local<Value> boxed_string = CompileRun("new String(\"test\")");
+  CHECK(boxed_string->IsStringObject());
+  v8::Local<v8::Object> str_obj = boxed_string.As<v8::Object>();
+  CHECK(!str_obj->Delete(context.local(), 2).FromJust());
+  CHECK(!str_obj->Delete(context.local(), v8_num(2)).FromJust());
+}
+
+
 THREADED_TEST(NumberObject) {
   LocalContext env;
   v8::HandleScope scope(env->GetIsolate());
-  v8::Handle<Value> boxed_number = CompileRun("new Number(42)");
+  v8::Local<Value> boxed_number = CompileRun("new Number(42)");
   CHECK(boxed_number->IsNumberObject());
-  v8::Handle<Value> unboxed_number = CompileRun("42");
+  v8::Local<Value> unboxed_number = CompileRun("42");
   CHECK(!unboxed_number->IsNumberObject());
-  v8::Handle<Value> boxed_not_number = CompileRun("new Boolean(false)");
+  v8::Local<Value> boxed_not_number = CompileRun("new Boolean(false)");
   CHECK(!boxed_not_number->IsNumberObject());
-  v8::Handle<v8::NumberObject> as_boxed = boxed_number.As<v8::NumberObject>();
+  v8::Local<v8::NumberObject> as_boxed = boxed_number.As<v8::NumberObject>();
   CHECK(!as_boxed.IsEmpty());
   double the_number = as_boxed->ValueOf();
   CHECK_EQ(42.0, the_number);
-  v8::Handle<v8::Value> new_boxed_number =
+  v8::Local<v8::Value> new_boxed_number =
       v8::NumberObject::New(env->GetIsolate(), 43);
   CHECK(new_boxed_number->IsNumberObject());
   as_boxed = new_boxed_number.As<v8::NumberObject>();
@@ -1723,19 +1715,20 @@
 THREADED_TEST(BooleanObject) {
   LocalContext env;
   v8::HandleScope scope(env->GetIsolate());
-  v8::Handle<Value> boxed_boolean = CompileRun("new Boolean(true)");
+  v8::Local<Value> boxed_boolean = CompileRun("new Boolean(true)");
   CHECK(boxed_boolean->IsBooleanObject());
-  v8::Handle<Value> unboxed_boolean = CompileRun("true");
+  v8::Local<Value> unboxed_boolean = CompileRun("true");
   CHECK(!unboxed_boolean->IsBooleanObject());
-  v8::Handle<Value> boxed_not_boolean = CompileRun("new Number(42)");
+  v8::Local<Value> boxed_not_boolean = CompileRun("new Number(42)");
   CHECK(!boxed_not_boolean->IsBooleanObject());
-  v8::Handle<v8::BooleanObject> as_boxed =
-      boxed_boolean.As<v8::BooleanObject>();
+  v8::Local<v8::BooleanObject> as_boxed = boxed_boolean.As<v8::BooleanObject>();
   CHECK(!as_boxed.IsEmpty());
   bool the_boolean = as_boxed->ValueOf();
   CHECK_EQ(true, the_boolean);
-  v8::Handle<v8::Value> boxed_true = v8::BooleanObject::New(true);
-  v8::Handle<v8::Value> boxed_false = v8::BooleanObject::New(false);
+  v8::Local<v8::Value> boxed_true =
+      v8::BooleanObject::New(env->GetIsolate(), true);
+  v8::Local<v8::Value> boxed_false =
+      v8::BooleanObject::New(env->GetIsolate(), false);
   CHECK(boxed_true->IsBooleanObject());
   CHECK(boxed_false->IsBooleanObject());
   as_boxed = boxed_true.As<v8::BooleanObject>();
@@ -1752,22 +1745,21 @@
   Local<Value> primitive_false = Boolean::New(env->GetIsolate(), false);
   CHECK(primitive_false->IsBoolean());
   CHECK(!primitive_false->IsBooleanObject());
-  CHECK(!primitive_false->BooleanValue());
+  CHECK(!primitive_false->BooleanValue(env.local()).FromJust());
   CHECK(!primitive_false->IsTrue());
   CHECK(primitive_false->IsFalse());
 
-  Local<Value> false_value = BooleanObject::New(false);
+  Local<Value> false_value = BooleanObject::New(env->GetIsolate(), false);
   CHECK(!false_value->IsBoolean());
   CHECK(false_value->IsBooleanObject());
-  CHECK(false_value->BooleanValue());
+  CHECK(false_value->BooleanValue(env.local()).FromJust());
   CHECK(!false_value->IsTrue());
   CHECK(!false_value->IsFalse());
 
   Local<BooleanObject> false_boolean_object = false_value.As<BooleanObject>();
   CHECK(!false_boolean_object->IsBoolean());
   CHECK(false_boolean_object->IsBooleanObject());
-  // TODO(svenpanne) Uncomment when BooleanObject::BooleanValue() is deleted.
-  // CHECK(false_boolean_object->BooleanValue());
+  CHECK(false_boolean_object->BooleanValue(env.local()).FromJust());
   CHECK(!false_boolean_object->ValueOf());
   CHECK(!false_boolean_object->IsTrue());
   CHECK(!false_boolean_object->IsFalse());
@@ -1775,22 +1767,21 @@
   Local<Value> primitive_true = Boolean::New(env->GetIsolate(), true);
   CHECK(primitive_true->IsBoolean());
   CHECK(!primitive_true->IsBooleanObject());
-  CHECK(primitive_true->BooleanValue());
+  CHECK(primitive_true->BooleanValue(env.local()).FromJust());
   CHECK(primitive_true->IsTrue());
   CHECK(!primitive_true->IsFalse());
 
-  Local<Value> true_value = BooleanObject::New(true);
+  Local<Value> true_value = BooleanObject::New(env->GetIsolate(), true);
   CHECK(!true_value->IsBoolean());
   CHECK(true_value->IsBooleanObject());
-  CHECK(true_value->BooleanValue());
+  CHECK(true_value->BooleanValue(env.local()).FromJust());
   CHECK(!true_value->IsTrue());
   CHECK(!true_value->IsFalse());
 
   Local<BooleanObject> true_boolean_object = true_value.As<BooleanObject>();
   CHECK(!true_boolean_object->IsBoolean());
   CHECK(true_boolean_object->IsBooleanObject());
-  // TODO(svenpanne) Uncomment when BooleanObject::BooleanValue() is deleted.
-  // CHECK(true_boolean_object->BooleanValue());
+  CHECK(true_boolean_object->BooleanValue(env.local()).FromJust());
   CHECK(true_boolean_object->ValueOf());
   CHECK(!true_boolean_object->IsTrue());
   CHECK(!true_boolean_object->IsFalse());
@@ -1802,7 +1793,7 @@
   v8::HandleScope scope(env->GetIsolate());
   double PI = 3.1415926;
   Local<v8::Number> pi_obj = v8::Number::New(env->GetIsolate(), PI);
-  CHECK_EQ(PI, pi_obj->NumberValue());
+  CHECK_EQ(PI, pi_obj->NumberValue(env.local()).FromJust());
 }
 
 
@@ -1811,11 +1802,11 @@
   v8::Isolate* isolate = CcTest::isolate();
   v8::HandleScope scope(isolate);
   Local<String> str = v8_str("3.1415926");
-  CHECK_EQ(3.1415926, str->NumberValue());
-  v8::Handle<v8::Boolean> t = v8::True(isolate);
-  CHECK_EQ(1.0, t->NumberValue());
-  v8::Handle<v8::Boolean> f = v8::False(isolate);
-  CHECK_EQ(0.0, f->NumberValue());
+  CHECK_EQ(3.1415926, str->NumberValue(env.local()).FromJust());
+  v8::Local<v8::Boolean> t = v8::True(isolate);
+  CHECK_EQ(1.0, t->NumberValue(env.local()).FromJust());
+  v8::Local<v8::Boolean> f = v8::False(isolate);
+  CHECK_EQ(0.0, f->NumberValue(env.local()).FromJust());
 }
 
 
@@ -1823,11 +1814,17 @@
   LocalContext env;
   v8::HandleScope scope(env->GetIsolate());
   double PI = 3.1415926;
-  Local<Value> date = v8::Date::New(env->GetIsolate(), PI);
-  CHECK_EQ(3.0, date->NumberValue());
-  date.As<v8::Date>()->Set(v8_str("property"),
-                           v8::Integer::New(env->GetIsolate(), 42));
-  CHECK_EQ(42, date.As<v8::Date>()->Get(v8_str("property"))->Int32Value());
+  Local<Value> date = v8::Date::New(env.local(), PI).ToLocalChecked();
+  CHECK_EQ(3.0, date->NumberValue(env.local()).FromJust());
+  CHECK(date.As<v8::Date>()
+            ->Set(env.local(), v8_str("property"),
+                  v8::Integer::New(env->GetIsolate(), 42))
+            .FromJust());
+  CHECK_EQ(42, date.As<v8::Date>()
+                   ->Get(env.local(), v8_str("property"))
+                   .ToLocalChecked()
+                   ->Int32Value(env.local())
+                   .FromJust());
 }
 
 
@@ -1835,23 +1832,27 @@
   LocalContext env;
   v8::Isolate* isolate = env->GetIsolate();
   v8::HandleScope scope(isolate);
-  v8::Handle<v8::Boolean> t = v8::True(isolate);
+  v8::Local<v8::Boolean> t = v8::True(isolate);
   CHECK(t->Value());
-  v8::Handle<v8::Boolean> f = v8::False(isolate);
+  v8::Local<v8::Boolean> f = v8::False(isolate);
   CHECK(!f->Value());
-  v8::Handle<v8::Primitive> u = v8::Undefined(isolate);
-  CHECK(!u->BooleanValue());
-  v8::Handle<v8::Primitive> n = v8::Null(isolate);
-  CHECK(!n->BooleanValue());
-  v8::Handle<String> str1 = v8_str("");
-  CHECK(!str1->BooleanValue());
-  v8::Handle<String> str2 = v8_str("x");
-  CHECK(str2->BooleanValue());
-  CHECK(!v8::Number::New(isolate, 0)->BooleanValue());
-  CHECK(v8::Number::New(isolate, -1)->BooleanValue());
-  CHECK(v8::Number::New(isolate, 1)->BooleanValue());
-  CHECK(v8::Number::New(isolate, 42)->BooleanValue());
-  CHECK(!v8_compile("NaN")->Run()->BooleanValue());
+  v8::Local<v8::Primitive> u = v8::Undefined(isolate);
+  CHECK(!u->BooleanValue(env.local()).FromJust());
+  v8::Local<v8::Primitive> n = v8::Null(isolate);
+  CHECK(!n->BooleanValue(env.local()).FromJust());
+  v8::Local<String> str1 = v8_str("");
+  CHECK(!str1->BooleanValue(env.local()).FromJust());
+  v8::Local<String> str2 = v8_str("x");
+  CHECK(str2->BooleanValue(env.local()).FromJust());
+  CHECK(!v8::Number::New(isolate, 0)->BooleanValue(env.local()).FromJust());
+  CHECK(v8::Number::New(isolate, -1)->BooleanValue(env.local()).FromJust());
+  CHECK(v8::Number::New(isolate, 1)->BooleanValue(env.local()).FromJust());
+  CHECK(v8::Number::New(isolate, 42)->BooleanValue(env.local()).FromJust());
+  CHECK(!v8_compile("NaN")
+             ->Run(env.local())
+             .ToLocalChecked()
+             ->BooleanValue(env.local())
+             .FromJust());
 }
 
 
@@ -1871,44 +1872,74 @@
 THREADED_TEST(GlobalPrototype) {
   v8::Isolate* isolate = CcTest::isolate();
   v8::HandleScope scope(isolate);
-  v8::Handle<v8::FunctionTemplate> func_templ =
+  v8::Local<v8::FunctionTemplate> func_templ =
       v8::FunctionTemplate::New(isolate);
   func_templ->PrototypeTemplate()->Set(
       isolate, "dummy", v8::FunctionTemplate::New(isolate, DummyCallHandler));
-  v8::Handle<ObjectTemplate> templ = func_templ->InstanceTemplate();
+  v8::Local<ObjectTemplate> templ = func_templ->InstanceTemplate();
   templ->Set(isolate, "x", v8_num(200));
   templ->SetAccessor(v8_str("m"), GetM);
   LocalContext env(0, templ);
-  v8::Handle<Script> script(v8_compile("dummy()"));
-  v8::Handle<Value> result(script->Run());
-  CHECK_EQ(13.4, result->NumberValue());
-  CHECK_EQ(200, v8_compile("x")->Run()->Int32Value());
-  CHECK_EQ(876, v8_compile("m")->Run()->Int32Value());
+  v8::Local<Script> script(v8_compile("dummy()"));
+  v8::Local<Value> result(script->Run(env.local()).ToLocalChecked());
+  CHECK_EQ(13.4, result->NumberValue(env.local()).FromJust());
+  CHECK_EQ(200, v8_run_int32value(v8_compile("x")));
+  CHECK_EQ(876, v8_run_int32value(v8_compile("m")));
 }
 
 
 THREADED_TEST(ObjectTemplate) {
   v8::Isolate* isolate = CcTest::isolate();
   v8::HandleScope scope(isolate);
-  Local<ObjectTemplate> templ1 = ObjectTemplate::New(isolate);
+  Local<v8::FunctionTemplate> fun = v8::FunctionTemplate::New(isolate);
+  v8::Local<v8::String> class_name = v8_str("the_class_name");
+  fun->SetClassName(class_name);
+  Local<ObjectTemplate> templ1 = ObjectTemplate::New(isolate, fun);
   templ1->Set(isolate, "x", v8_num(10));
   templ1->Set(isolate, "y", v8_num(13));
   LocalContext env;
-  Local<v8::Object> instance1 = templ1->NewInstance();
-  env->Global()->Set(v8_str("p"), instance1);
-  CHECK(v8_compile("(p.x == 10)")->Run()->BooleanValue());
-  CHECK(v8_compile("(p.y == 13)")->Run()->BooleanValue());
-  Local<v8::FunctionTemplate> fun = v8::FunctionTemplate::New(isolate);
-  fun->PrototypeTemplate()->Set(isolate, "nirk", v8_num(123));
-  Local<ObjectTemplate> templ2 = fun->InstanceTemplate();
+  Local<v8::Object> instance1 =
+      templ1->NewInstance(env.local()).ToLocalChecked();
+  CHECK(class_name->StrictEquals(instance1->GetConstructorName()));
+  CHECK(env->Global()->Set(env.local(), v8_str("p"), instance1).FromJust());
+  CHECK(v8_compile("(p.x == 10)")
+            ->Run(env.local())
+            .ToLocalChecked()
+            ->BooleanValue(env.local())
+            .FromJust());
+  CHECK(v8_compile("(p.y == 13)")
+            ->Run(env.local())
+            .ToLocalChecked()
+            ->BooleanValue(env.local())
+            .FromJust());
+  Local<v8::FunctionTemplate> fun2 = v8::FunctionTemplate::New(isolate);
+  fun2->PrototypeTemplate()->Set(isolate, "nirk", v8_num(123));
+  Local<ObjectTemplate> templ2 = fun2->InstanceTemplate();
   templ2->Set(isolate, "a", v8_num(12));
   templ2->Set(isolate, "b", templ1);
-  Local<v8::Object> instance2 = templ2->NewInstance();
-  env->Global()->Set(v8_str("q"), instance2);
-  CHECK(v8_compile("(q.nirk == 123)")->Run()->BooleanValue());
-  CHECK(v8_compile("(q.a == 12)")->Run()->BooleanValue());
-  CHECK(v8_compile("(q.b.x == 10)")->Run()->BooleanValue());
-  CHECK(v8_compile("(q.b.y == 13)")->Run()->BooleanValue());
+  Local<v8::Object> instance2 =
+      templ2->NewInstance(env.local()).ToLocalChecked();
+  CHECK(env->Global()->Set(env.local(), v8_str("q"), instance2).FromJust());
+  CHECK(v8_compile("(q.nirk == 123)")
+            ->Run(env.local())
+            .ToLocalChecked()
+            ->BooleanValue(env.local())
+            .FromJust());
+  CHECK(v8_compile("(q.a == 12)")
+            ->Run(env.local())
+            .ToLocalChecked()
+            ->BooleanValue(env.local())
+            .FromJust());
+  CHECK(v8_compile("(q.b.x == 10)")
+            ->Run(env.local())
+            .ToLocalChecked()
+            ->BooleanValue(env.local())
+            .FromJust());
+  CHECK(v8_compile("(q.b.y == 13)")
+            ->Run(env.local())
+            .ToLocalChecked()
+            ->BooleanValue(env.local())
+            .FromJust());
 }
 
 
@@ -1928,7 +1959,7 @@
 THREADED_TEST(DescriptorInheritance) {
   v8::Isolate* isolate = CcTest::isolate();
   v8::HandleScope scope(isolate);
-  v8::Handle<v8::FunctionTemplate> super = v8::FunctionTemplate::New(isolate);
+  v8::Local<v8::FunctionTemplate> super = v8::FunctionTemplate::New(isolate);
   super->PrototypeTemplate()->Set(isolate, "flabby",
                                   v8::FunctionTemplate::New(isolate,
                                                             GetFlabby));
@@ -1936,62 +1967,121 @@
 
   super->InstanceTemplate()->SetAccessor(v8_str("knurd"), GetKnurd);
 
-  v8::Handle<v8::FunctionTemplate> base1 = v8::FunctionTemplate::New(isolate);
+  v8::Local<v8::FunctionTemplate> base1 = v8::FunctionTemplate::New(isolate);
   base1->Inherit(super);
   base1->PrototypeTemplate()->Set(isolate, "v1", v8_num(20.1));
 
-  v8::Handle<v8::FunctionTemplate> base2 = v8::FunctionTemplate::New(isolate);
+  v8::Local<v8::FunctionTemplate> base2 = v8::FunctionTemplate::New(isolate);
   base2->Inherit(super);
   base2->PrototypeTemplate()->Set(isolate, "v2", v8_num(10.1));
 
   LocalContext env;
 
-  env->Global()->Set(v8_str("s"), super->GetFunction());
-  env->Global()->Set(v8_str("base1"), base1->GetFunction());
-  env->Global()->Set(v8_str("base2"), base2->GetFunction());
+  CHECK(env->Global()
+            ->Set(env.local(), v8_str("s"),
+                  super->GetFunction(env.local()).ToLocalChecked())
+            .FromJust());
+  CHECK(env->Global()
+            ->Set(env.local(), v8_str("base1"),
+                  base1->GetFunction(env.local()).ToLocalChecked())
+            .FromJust());
+  CHECK(env->Global()
+            ->Set(env.local(), v8_str("base2"),
+                  base2->GetFunction(env.local()).ToLocalChecked())
+            .FromJust());
 
   // Checks right __proto__ chain.
-  CHECK(CompileRun("base1.prototype.__proto__ == s.prototype")->BooleanValue());
-  CHECK(CompileRun("base2.prototype.__proto__ == s.prototype")->BooleanValue());
+  CHECK(CompileRun("base1.prototype.__proto__ == s.prototype")
+            ->BooleanValue(env.local())
+            .FromJust());
+  CHECK(CompileRun("base2.prototype.__proto__ == s.prototype")
+            ->BooleanValue(env.local())
+            .FromJust());
 
-  CHECK(v8_compile("s.prototype.PI == 3.14")->Run()->BooleanValue());
+  CHECK(v8_compile("s.prototype.PI == 3.14")
+            ->Run(env.local())
+            .ToLocalChecked()
+            ->BooleanValue(env.local())
+            .FromJust());
 
   // Instance accessor should not be visible on function object or its prototype
-  CHECK(CompileRun("s.knurd == undefined")->BooleanValue());
-  CHECK(CompileRun("s.prototype.knurd == undefined")->BooleanValue());
-  CHECK(CompileRun("base1.prototype.knurd == undefined")->BooleanValue());
+  CHECK(
+      CompileRun("s.knurd == undefined")->BooleanValue(env.local()).FromJust());
+  CHECK(CompileRun("s.prototype.knurd == undefined")
+            ->BooleanValue(env.local())
+            .FromJust());
+  CHECK(CompileRun("base1.prototype.knurd == undefined")
+            ->BooleanValue(env.local())
+            .FromJust());
 
-  env->Global()->Set(v8_str("obj"),
-                     base1->GetFunction()->NewInstance());
-  CHECK_EQ(17.2, v8_compile("obj.flabby()")->Run()->NumberValue());
-  CHECK(v8_compile("'flabby' in obj")->Run()->BooleanValue());
-  CHECK_EQ(15.2, v8_compile("obj.knurd")->Run()->NumberValue());
-  CHECK(v8_compile("'knurd' in obj")->Run()->BooleanValue());
-  CHECK_EQ(20.1, v8_compile("obj.v1")->Run()->NumberValue());
+  CHECK(env->Global()
+            ->Set(env.local(), v8_str("obj"), base1->GetFunction(env.local())
+                                                  .ToLocalChecked()
+                                                  ->NewInstance(env.local())
+                                                  .ToLocalChecked())
+            .FromJust());
+  CHECK_EQ(17.2, v8_compile("obj.flabby()")
+                     ->Run(env.local())
+                     .ToLocalChecked()
+                     ->NumberValue(env.local())
+                     .FromJust());
+  CHECK(v8_compile("'flabby' in obj")
+            ->Run(env.local())
+            .ToLocalChecked()
+            ->BooleanValue(env.local())
+            .FromJust());
+  CHECK_EQ(15.2, v8_compile("obj.knurd")
+                     ->Run(env.local())
+                     .ToLocalChecked()
+                     ->NumberValue(env.local())
+                     .FromJust());
+  CHECK(v8_compile("'knurd' in obj")
+            ->Run(env.local())
+            .ToLocalChecked()
+            ->BooleanValue(env.local())
+            .FromJust());
+  CHECK_EQ(20.1, v8_compile("obj.v1")
+                     ->Run(env.local())
+                     .ToLocalChecked()
+                     ->NumberValue(env.local())
+                     .FromJust());
 
-  env->Global()->Set(v8_str("obj2"),
-                     base2->GetFunction()->NewInstance());
-  CHECK_EQ(17.2, v8_compile("obj2.flabby()")->Run()->NumberValue());
-  CHECK(v8_compile("'flabby' in obj2")->Run()->BooleanValue());
-  CHECK_EQ(15.2, v8_compile("obj2.knurd")->Run()->NumberValue());
-  CHECK(v8_compile("'knurd' in obj2")->Run()->BooleanValue());
-  CHECK_EQ(10.1, v8_compile("obj2.v2")->Run()->NumberValue());
+  CHECK(env->Global()
+            ->Set(env.local(), v8_str("obj2"), base2->GetFunction(env.local())
+                                                   .ToLocalChecked()
+                                                   ->NewInstance(env.local())
+                                                   .ToLocalChecked())
+            .FromJust());
+  CHECK_EQ(17.2, v8_compile("obj2.flabby()")
+                     ->Run(env.local())
+                     .ToLocalChecked()
+                     ->NumberValue(env.local())
+                     .FromJust());
+  CHECK(v8_compile("'flabby' in obj2")
+            ->Run(env.local())
+            .ToLocalChecked()
+            ->BooleanValue(env.local())
+            .FromJust());
+  CHECK_EQ(15.2, v8_compile("obj2.knurd")
+                     ->Run(env.local())
+                     .ToLocalChecked()
+                     ->NumberValue(env.local())
+                     .FromJust());
+  CHECK(v8_compile("'knurd' in obj2")
+            ->Run(env.local())
+            .ToLocalChecked()
+            ->BooleanValue(env.local())
+            .FromJust());
+  CHECK_EQ(10.1, v8_compile("obj2.v2")
+                     ->Run(env.local())
+                     .ToLocalChecked()
+                     ->NumberValue(env.local())
+                     .FromJust());
 
   // base1 and base2 cannot cross reference to each's prototype
-  CHECK(v8_compile("obj.v2")->Run()->IsUndefined());
-  CHECK(v8_compile("obj2.v1")->Run()->IsUndefined());
-}
-
-
-int echo_named_call_count;
-
-
-static void EchoNamedProperty(Local<Name> name,
-                              const v8::PropertyCallbackInfo<v8::Value>& info) {
-  ApiTestFuzzer::Fuzz();
-  CHECK_EQ(v8_str("data"), info.Data());
-  echo_named_call_count++;
-  info.GetReturnValue().Set(name);
+  CHECK(v8_compile("obj.v2")->Run(env.local()).ToLocalChecked()->IsUndefined());
+  CHECK(
+      v8_compile("obj2.v1")->Run(env.local()).ToLocalChecked()->IsUndefined());
 }
 
 
@@ -1999,15 +2089,18 @@
 
 void SimpleAccessorGetter(Local<String> name,
                           const v8::PropertyCallbackInfo<v8::Value>& info) {
-  Handle<Object> self = Handle<Object>::Cast(info.This());
-  info.GetReturnValue().Set(
-      self->Get(String::Concat(v8_str("accessor_"), name)));
+  Local<Object> self = Local<Object>::Cast(info.This());
+  info.GetReturnValue().Set(self->Get(info.GetIsolate()->GetCurrentContext(),
+                                      String::Concat(v8_str("accessor_"), name))
+                                .ToLocalChecked());
 }
 
 void SimpleAccessorSetter(Local<String> name, Local<Value> value,
                           const v8::PropertyCallbackInfo<void>& info) {
-  Handle<Object> self = Handle<Object>::Cast(info.This());
-  self->Set(String::Concat(v8_str("accessor_"), name), value);
+  Local<Object> self = Local<Object>::Cast(info.This());
+  CHECK(self->Set(info.GetIsolate()->GetCurrentContext(),
+                  String::Concat(v8_str("accessor_"), name), value)
+            .FromJust());
 }
 
 void SymbolAccessorGetter(Local<Name> name,
@@ -2042,226 +2135,17 @@
 }
 
 
-void EmptyInterceptorGetter(Local<Name> name,
-                            const v8::PropertyCallbackInfo<v8::Value>& info) {}
-
-
-void EmptyInterceptorSetter(Local<Name> name, Local<Value> value,
-                            const v8::PropertyCallbackInfo<v8::Value>& info) {}
-
-
-void EmptyGenericInterceptorGetter(
-    Local<Name> name, const v8::PropertyCallbackInfo<v8::Value>& info) {}
-
-
-void EmptyGenericInterceptorSetter(
-    Local<Name> name, Local<Value> value,
-    const v8::PropertyCallbackInfo<v8::Value>& info) {}
-
-
-void StringInterceptorGetter(
-    Local<String> name,
-    const v8::PropertyCallbackInfo<v8::Value>&
-        info) {  // Intercept names that start with 'interceptor_'.
-  String::Utf8Value utf8(name);
-  char* name_str = *utf8;
-  char prefix[] = "interceptor_";
-  int i;
-  for (i = 0; name_str[i] && prefix[i]; ++i) {
-    if (name_str[i] != prefix[i]) return;
-  }
-  Handle<Object> self = Handle<Object>::Cast(info.This());
-  info.GetReturnValue().Set(self->GetHiddenValue(v8_str(name_str + i)));
-}
-
-
-void StringInterceptorSetter(Local<String> name, Local<Value> value,
-                             const v8::PropertyCallbackInfo<v8::Value>& info) {
-  // Intercept accesses that set certain integer values, for which the name does
-  // not start with 'accessor_'.
-  String::Utf8Value utf8(name);
-  char* name_str = *utf8;
-  char prefix[] = "accessor_";
-  int i;
-  for (i = 0; name_str[i] && prefix[i]; ++i) {
-    if (name_str[i] != prefix[i]) break;
-  }
-  if (!prefix[i]) return;
-
-  if (value->IsInt32() && value->Int32Value() < 10000) {
-    Handle<Object> self = Handle<Object>::Cast(info.This());
-    self->SetHiddenValue(name, value);
-    info.GetReturnValue().Set(value);
-  }
-}
-
-void InterceptorGetter(Local<Name> generic_name,
-                       const v8::PropertyCallbackInfo<v8::Value>& info) {
-  if (generic_name->IsSymbol()) return;
-  StringInterceptorGetter(Local<String>::Cast(generic_name), info);
-}
-
-void InterceptorSetter(Local<Name> generic_name, Local<Value> value,
-                       const v8::PropertyCallbackInfo<v8::Value>& info) {
-  if (generic_name->IsSymbol()) return;
-  StringInterceptorSetter(Local<String>::Cast(generic_name), value, info);
-}
-
-void GenericInterceptorGetter(Local<Name> generic_name,
-                              const v8::PropertyCallbackInfo<v8::Value>& info) {
-  Local<String> str;
-  if (generic_name->IsSymbol()) {
-    Local<Value> name = Local<Symbol>::Cast(generic_name)->Name();
-    if (name->IsUndefined()) return;
-    str = String::Concat(v8_str("_sym_"), Local<String>::Cast(name));
-  } else {
-    Local<String> name = Local<String>::Cast(generic_name);
-    String::Utf8Value utf8(name);
-    char* name_str = *utf8;
-    if (*name_str == '_') return;
-    str = String::Concat(v8_str("_str_"), name);
-  }
-
-  Handle<Object> self = Handle<Object>::Cast(info.This());
-  info.GetReturnValue().Set(self->Get(str));
-}
-
-void GenericInterceptorSetter(Local<Name> generic_name, Local<Value> value,
-                              const v8::PropertyCallbackInfo<v8::Value>& info) {
-  Local<String> str;
-  if (generic_name->IsSymbol()) {
-    Local<Value> name = Local<Symbol>::Cast(generic_name)->Name();
-    if (name->IsUndefined()) return;
-    str = String::Concat(v8_str("_sym_"), Local<String>::Cast(name));
-  } else {
-    Local<String> name = Local<String>::Cast(generic_name);
-    String::Utf8Value utf8(name);
-    char* name_str = *utf8;
-    if (*name_str == '_') return;
-    str = String::Concat(v8_str("_str_"), name);
-  }
-
-  Handle<Object> self = Handle<Object>::Cast(info.This());
-  self->Set(str, value);
-  info.GetReturnValue().Set(value);
-}
-
-void AddAccessor(Handle<FunctionTemplate> templ,
-                 Handle<String> name,
-                 v8::AccessorGetterCallback getter,
-                 v8::AccessorSetterCallback setter) {
-  templ->PrototypeTemplate()->SetAccessor(name, getter, setter);
-}
-
-void AddInterceptor(Handle<FunctionTemplate> templ,
-                    v8::NamedPropertyGetterCallback getter,
-                    v8::NamedPropertySetterCallback setter) {
-  templ->InstanceTemplate()->SetNamedPropertyHandler(getter, setter);
-}
-
-
-void AddAccessor(Handle<FunctionTemplate> templ,
-                 Handle<Name> name,
-                 v8::AccessorNameGetterCallback getter,
-                 v8::AccessorNameSetterCallback setter) {
-  templ->PrototypeTemplate()->SetAccessor(name, getter, setter);
-}
-
-void AddInterceptor(Handle<FunctionTemplate> templ,
-                    v8::GenericNamedPropertyGetterCallback getter,
-                    v8::GenericNamedPropertySetterCallback setter) {
-  templ->InstanceTemplate()->SetHandler(
-      v8::NamedPropertyHandlerConfiguration(getter, setter));
-}
-
-
-THREADED_TEST(EmptyInterceptorDoesNotShadowAccessors) {
-  v8::HandleScope scope(CcTest::isolate());
-  Handle<FunctionTemplate> parent = FunctionTemplate::New(CcTest::isolate());
-  Handle<FunctionTemplate> child = FunctionTemplate::New(CcTest::isolate());
-  child->Inherit(parent);
-  AddAccessor(parent, v8_str("age"),
-              SimpleAccessorGetter, SimpleAccessorSetter);
-  AddInterceptor(child, EmptyInterceptorGetter, EmptyInterceptorSetter);
-  LocalContext env;
-  env->Global()->Set(v8_str("Child"), child->GetFunction());
-  CompileRun("var child = new Child;"
-             "child.age = 10;");
-  ExpectBoolean("child.hasOwnProperty('age')", false);
-  ExpectInt32("child.age", 10);
-  ExpectInt32("child.accessor_age", 10);
-}
-
-
-THREADED_TEST(LegacyInterceptorDoesNotSeeSymbols) {
-  LocalContext env;
-  v8::Isolate* isolate = CcTest::isolate();
-  v8::HandleScope scope(isolate);
-  Handle<FunctionTemplate> parent = FunctionTemplate::New(isolate);
-  Handle<FunctionTemplate> child = FunctionTemplate::New(isolate);
-  v8::Local<v8::Symbol> age = v8::Symbol::New(isolate, v8_str("age"));
-
-  child->Inherit(parent);
-  AddAccessor(parent, age, SymbolAccessorGetter, SymbolAccessorSetter);
-  AddInterceptor(child, StringInterceptorGetter, StringInterceptorSetter);
-
-  env->Global()->Set(v8_str("Child"), child->GetFunction());
-  env->Global()->Set(v8_str("age"), age);
-  CompileRun(
-      "var child = new Child;"
-      "child[age] = 10;");
-  ExpectInt32("child[age]", 10);
-  ExpectBoolean("child.hasOwnProperty('age')", false);
-  ExpectBoolean("child.hasOwnProperty('accessor_age')", true);
-}
-
-
-THREADED_TEST(GenericInterceptorDoesSeeSymbols) {
-  LocalContext env;
-  v8::Isolate* isolate = CcTest::isolate();
-  v8::HandleScope scope(isolate);
-  Handle<FunctionTemplate> parent = FunctionTemplate::New(isolate);
-  Handle<FunctionTemplate> child = FunctionTemplate::New(isolate);
-  v8::Local<v8::Symbol> age = v8::Symbol::New(isolate, v8_str("age"));
-  v8::Local<v8::Symbol> anon = v8::Symbol::New(isolate);
-
-  child->Inherit(parent);
-  AddAccessor(parent, age, SymbolAccessorGetter, SymbolAccessorSetter);
-  AddInterceptor(child, GenericInterceptorGetter, GenericInterceptorSetter);
-
-  env->Global()->Set(v8_str("Child"), child->GetFunction());
-  env->Global()->Set(v8_str("age"), age);
-  env->Global()->Set(v8_str("anon"), anon);
-  CompileRun(
-      "var child = new Child;"
-      "child[age] = 10;");
-  ExpectInt32("child[age]", 10);
-  ExpectInt32("child._sym_age", 10);
-
-  // Check that it also sees strings.
-  CompileRun("child.foo = 47");
-  ExpectInt32("child.foo", 47);
-  ExpectInt32("child._str_foo", 47);
-
-  // Check that the interceptor can punt (in this case, on anonymous symbols).
-  CompileRun("child[anon] = 31337");
-  ExpectInt32("child[anon]", 31337);
-}
-
-
 THREADED_TEST(ExecutableAccessorIsPreservedOnAttributeChange) {
   v8::Isolate* isolate = CcTest::isolate();
   v8::HandleScope scope(isolate);
   LocalContext env;
   v8::Local<v8::Value> res = CompileRun("var a = []; a;");
-  i::Handle<i::JSObject> a(v8::Utils::OpenHandle(v8::Object::Cast(*res)));
+  i::Handle<i::JSReceiver> a(v8::Utils::OpenHandle(v8::Object::Cast(*res)));
   CHECK(a->map()->instance_descriptors()->IsFixedArray());
   CHECK_GT(i::FixedArray::cast(a->map()->instance_descriptors())->length(), 0);
   CompileRun("Object.defineProperty(a, 'length', { writable: false });");
   CHECK_EQ(i::FixedArray::cast(a->map()->instance_descriptors())->length(), 0);
   // But we should still have an ExecutableAccessorInfo.
-  i::Isolate* i_isolate = reinterpret_cast<i::Isolate*>(isolate);
-  i::LookupResult lookup(i_isolate);
   i::Handle<i::String> name(v8::Utils::OpenHandle(*v8_str("length")));
   i::LookupIterator it(a, name, i::LookupIterator::OWN_SKIP_INTERCEPTOR);
   CHECK_EQ(i::LookupIterator::ACCESSOR, it.state());
@@ -2269,498 +2153,84 @@
 }
 
 
-THREADED_TEST(EmptyInterceptorBreakTransitions) {
-  v8::HandleScope scope(CcTest::isolate());
-  Handle<FunctionTemplate> templ = FunctionTemplate::New(CcTest::isolate());
-  AddInterceptor(templ, EmptyInterceptorGetter, EmptyInterceptorSetter);
-  LocalContext env;
-  env->Global()->Set(v8_str("Constructor"), templ->GetFunction());
-  CompileRun("var o1 = new Constructor;"
-             "o1.a = 1;"  // Ensure a and x share the descriptor array.
-             "Object.defineProperty(o1, 'x', {value: 10});");
-  CompileRun("var o2 = new Constructor;"
-             "o2.a = 1;"
-             "Object.defineProperty(o2, 'x', {value: 10});");
-}
-
-
-THREADED_TEST(EmptyInterceptorDoesNotShadowJSAccessors) {
-  v8::Isolate* isolate = CcTest::isolate();
-  v8::HandleScope scope(isolate);
-  Handle<FunctionTemplate> parent = FunctionTemplate::New(isolate);
-  Handle<FunctionTemplate> child = FunctionTemplate::New(isolate);
-  child->Inherit(parent);
-  AddInterceptor(child, EmptyInterceptorGetter, EmptyInterceptorSetter);
-  LocalContext env;
-  env->Global()->Set(v8_str("Child"), child->GetFunction());
-  CompileRun("var child = new Child;"
-             "var parent = child.__proto__;"
-             "Object.defineProperty(parent, 'age', "
-             "  {get: function(){ return this.accessor_age; }, "
-             "   set: function(v){ this.accessor_age = v; }, "
-             "   enumerable: true, configurable: true});"
-             "child.age = 10;");
-  ExpectBoolean("child.hasOwnProperty('age')", false);
-  ExpectInt32("child.age", 10);
-  ExpectInt32("child.accessor_age", 10);
-}
-
-
-THREADED_TEST(EmptyInterceptorDoesNotAffectJSProperties) {
-  v8::Isolate* isolate = CcTest::isolate();
-  v8::HandleScope scope(isolate);
-  Handle<FunctionTemplate> parent = FunctionTemplate::New(isolate);
-  Handle<FunctionTemplate> child = FunctionTemplate::New(isolate);
-  child->Inherit(parent);
-  AddInterceptor(child, EmptyInterceptorGetter, EmptyInterceptorSetter);
-  LocalContext env;
-  env->Global()->Set(v8_str("Child"), child->GetFunction());
-  CompileRun("var child = new Child;"
-             "var parent = child.__proto__;"
-             "parent.name = 'Alice';");
-  ExpectBoolean("child.hasOwnProperty('name')", false);
-  ExpectString("child.name", "Alice");
-  CompileRun("child.name = 'Bob';");
-  ExpectString("child.name", "Bob");
-  ExpectBoolean("child.hasOwnProperty('name')", true);
-  ExpectString("parent.name", "Alice");
-}
-
-
-THREADED_TEST(SwitchFromInterceptorToAccessor) {
-  v8::HandleScope scope(CcTest::isolate());
-  Handle<FunctionTemplate> templ = FunctionTemplate::New(CcTest::isolate());
-  AddAccessor(templ, v8_str("age"),
-              SimpleAccessorGetter, SimpleAccessorSetter);
-  AddInterceptor(templ, InterceptorGetter, InterceptorSetter);
-  LocalContext env;
-  env->Global()->Set(v8_str("Obj"), templ->GetFunction());
-  CompileRun("var obj = new Obj;"
-             "function setAge(i){ obj.age = i; };"
-             "for(var i = 0; i <= 10000; i++) setAge(i);");
-  // All i < 10000 go to the interceptor.
-  ExpectInt32("obj.interceptor_age", 9999);
-  // The last i goes to the accessor.
-  ExpectInt32("obj.accessor_age", 10000);
-}
-
-
-THREADED_TEST(SwitchFromAccessorToInterceptor) {
-  v8::HandleScope scope(CcTest::isolate());
-  Handle<FunctionTemplate> templ = FunctionTemplate::New(CcTest::isolate());
-  AddAccessor(templ, v8_str("age"),
-              SimpleAccessorGetter, SimpleAccessorSetter);
-  AddInterceptor(templ, InterceptorGetter, InterceptorSetter);
-  LocalContext env;
-  env->Global()->Set(v8_str("Obj"), templ->GetFunction());
-  CompileRun("var obj = new Obj;"
-             "function setAge(i){ obj.age = i; };"
-             "for(var i = 20000; i >= 9999; i--) setAge(i);");
-  // All i >= 10000 go to the accessor.
-  ExpectInt32("obj.accessor_age", 10000);
-  // The last i goes to the interceptor.
-  ExpectInt32("obj.interceptor_age", 9999);
-}
-
-
-THREADED_TEST(SwitchFromInterceptorToAccessorWithInheritance) {
-  v8::HandleScope scope(CcTest::isolate());
-  Handle<FunctionTemplate> parent = FunctionTemplate::New(CcTest::isolate());
-  Handle<FunctionTemplate> child = FunctionTemplate::New(CcTest::isolate());
-  child->Inherit(parent);
-  AddAccessor(parent, v8_str("age"),
-              SimpleAccessorGetter, SimpleAccessorSetter);
-  AddInterceptor(child, InterceptorGetter, InterceptorSetter);
-  LocalContext env;
-  env->Global()->Set(v8_str("Child"), child->GetFunction());
-  CompileRun("var child = new Child;"
-             "function setAge(i){ child.age = i; };"
-             "for(var i = 0; i <= 10000; i++) setAge(i);");
-  // All i < 10000 go to the interceptor.
-  ExpectInt32("child.interceptor_age", 9999);
-  // The last i goes to the accessor.
-  ExpectInt32("child.accessor_age", 10000);
-}
-
-
-THREADED_TEST(SwitchFromAccessorToInterceptorWithInheritance) {
-  v8::HandleScope scope(CcTest::isolate());
-  Handle<FunctionTemplate> parent = FunctionTemplate::New(CcTest::isolate());
-  Handle<FunctionTemplate> child = FunctionTemplate::New(CcTest::isolate());
-  child->Inherit(parent);
-  AddAccessor(parent, v8_str("age"),
-              SimpleAccessorGetter, SimpleAccessorSetter);
-  AddInterceptor(child, InterceptorGetter, InterceptorSetter);
-  LocalContext env;
-  env->Global()->Set(v8_str("Child"), child->GetFunction());
-  CompileRun("var child = new Child;"
-             "function setAge(i){ child.age = i; };"
-             "for(var i = 20000; i >= 9999; i--) setAge(i);");
-  // All i >= 10000 go to the accessor.
-  ExpectInt32("child.accessor_age", 10000);
-  // The last i goes to the interceptor.
-  ExpectInt32("child.interceptor_age", 9999);
-}
-
-
-THREADED_TEST(SwitchFromInterceptorToJSAccessor) {
-  v8::HandleScope scope(CcTest::isolate());
-  Handle<FunctionTemplate> templ = FunctionTemplate::New(CcTest::isolate());
-  AddInterceptor(templ, InterceptorGetter, InterceptorSetter);
-  LocalContext env;
-  env->Global()->Set(v8_str("Obj"), templ->GetFunction());
-  CompileRun("var obj = new Obj;"
-             "function setter(i) { this.accessor_age = i; };"
-             "function getter() { return this.accessor_age; };"
-             "function setAge(i) { obj.age = i; };"
-             "Object.defineProperty(obj, 'age', { get:getter, set:setter });"
-             "for(var i = 0; i <= 10000; i++) setAge(i);");
-  // All i < 10000 go to the interceptor.
-  ExpectInt32("obj.interceptor_age", 9999);
-  // The last i goes to the JavaScript accessor.
-  ExpectInt32("obj.accessor_age", 10000);
-  // The installed JavaScript getter is still intact.
-  // This last part is a regression test for issue 1651 and relies on the fact
-  // that both interceptor and accessor are being installed on the same object.
-  ExpectInt32("obj.age", 10000);
-  ExpectBoolean("obj.hasOwnProperty('age')", true);
-  ExpectUndefined("Object.getOwnPropertyDescriptor(obj, 'age').value");
-}
-
-
-THREADED_TEST(SwitchFromJSAccessorToInterceptor) {
-  v8::HandleScope scope(CcTest::isolate());
-  Handle<FunctionTemplate> templ = FunctionTemplate::New(CcTest::isolate());
-  AddInterceptor(templ, InterceptorGetter, InterceptorSetter);
-  LocalContext env;
-  env->Global()->Set(v8_str("Obj"), templ->GetFunction());
-  CompileRun("var obj = new Obj;"
-             "function setter(i) { this.accessor_age = i; };"
-             "function getter() { return this.accessor_age; };"
-             "function setAge(i) { obj.age = i; };"
-             "Object.defineProperty(obj, 'age', { get:getter, set:setter });"
-             "for(var i = 20000; i >= 9999; i--) setAge(i);");
-  // All i >= 10000 go to the accessor.
-  ExpectInt32("obj.accessor_age", 10000);
-  // The last i goes to the interceptor.
-  ExpectInt32("obj.interceptor_age", 9999);
-  // The installed JavaScript getter is still intact.
-  // This last part is a regression test for issue 1651 and relies on the fact
-  // that both interceptor and accessor are being installed on the same object.
-  ExpectInt32("obj.age", 10000);
-  ExpectBoolean("obj.hasOwnProperty('age')", true);
-  ExpectUndefined("Object.getOwnPropertyDescriptor(obj, 'age').value");
-}
-
-
-THREADED_TEST(SwitchFromInterceptorToProperty) {
-  v8::HandleScope scope(CcTest::isolate());
-  Handle<FunctionTemplate> parent = FunctionTemplate::New(CcTest::isolate());
-  Handle<FunctionTemplate> child = FunctionTemplate::New(CcTest::isolate());
-  child->Inherit(parent);
-  AddInterceptor(child, InterceptorGetter, InterceptorSetter);
-  LocalContext env;
-  env->Global()->Set(v8_str("Child"), child->GetFunction());
-  CompileRun("var child = new Child;"
-             "function setAge(i){ child.age = i; };"
-             "for(var i = 0; i <= 10000; i++) setAge(i);");
-  // All i < 10000 go to the interceptor.
-  ExpectInt32("child.interceptor_age", 9999);
-  // The last i goes to child's own property.
-  ExpectInt32("child.age", 10000);
-}
-
-
-THREADED_TEST(SwitchFromPropertyToInterceptor) {
-  v8::HandleScope scope(CcTest::isolate());
-  Handle<FunctionTemplate> parent = FunctionTemplate::New(CcTest::isolate());
-  Handle<FunctionTemplate> child = FunctionTemplate::New(CcTest::isolate());
-  child->Inherit(parent);
-  AddInterceptor(child, InterceptorGetter, InterceptorSetter);
-  LocalContext env;
-  env->Global()->Set(v8_str("Child"), child->GetFunction());
-  CompileRun("var child = new Child;"
-             "function setAge(i){ child.age = i; };"
-             "for(var i = 20000; i >= 9999; i--) setAge(i);");
-  // All i >= 10000 go to child's own property.
-  ExpectInt32("child.age", 10000);
-  // The last i goes to the interceptor.
-  ExpectInt32("child.interceptor_age", 9999);
-}
-
-
-THREADED_TEST(NamedPropertyHandlerGetter) {
-  echo_named_call_count = 0;
-  v8::HandleScope scope(CcTest::isolate());
-  v8::Handle<v8::FunctionTemplate> templ =
-      v8::FunctionTemplate::New(CcTest::isolate());
-  templ->InstanceTemplate()->SetHandler(v8::NamedPropertyHandlerConfiguration(
-      EchoNamedProperty, 0, 0, 0, 0, v8_str("data")));
-  LocalContext env;
-  env->Global()->Set(v8_str("obj"),
-                     templ->GetFunction()->NewInstance());
-  CHECK_EQ(echo_named_call_count, 0);
-  v8_compile("obj.x")->Run();
-  CHECK_EQ(echo_named_call_count, 1);
-  const char* code = "var str = 'oddle'; obj[str] + obj.poddle;";
-  v8::Handle<Value> str = CompileRun(code);
-  String::Utf8Value value(str);
-  CHECK_EQ(*value, "oddlepoddle");
-  // Check default behavior
-  CHECK_EQ(v8_compile("obj.flob = 10;")->Run()->Int32Value(), 10);
-  CHECK(v8_compile("'myProperty' in obj")->Run()->BooleanValue());
-  CHECK(v8_compile("delete obj.myProperty")->Run()->BooleanValue());
-}
-
-
-int echo_indexed_call_count = 0;
-
-
-static void EchoIndexedProperty(
-    uint32_t index,
-    const v8::PropertyCallbackInfo<v8::Value>& info) {
-  ApiTestFuzzer::Fuzz();
-  CHECK_EQ(v8_num(637), info.Data());
-  echo_indexed_call_count++;
-  info.GetReturnValue().Set(v8_num(index));
-}
-
-
-THREADED_TEST(IndexedPropertyHandlerGetter) {
-  v8::Isolate* isolate = CcTest::isolate();
-  v8::HandleScope scope(isolate);
-  v8::Handle<v8::FunctionTemplate> templ = v8::FunctionTemplate::New(isolate);
-  templ->InstanceTemplate()->SetHandler(v8::IndexedPropertyHandlerConfiguration(
-      EchoIndexedProperty, 0, 0, 0, 0, v8_num(637)));
-  LocalContext env;
-  env->Global()->Set(v8_str("obj"),
-                     templ->GetFunction()->NewInstance());
-  Local<Script> script = v8_compile("obj[900]");
-  CHECK_EQ(script->Run()->Int32Value(), 900);
-}
-
-
-v8::Handle<v8::Object> bottom;
-
-static void CheckThisIndexedPropertyHandler(
-    uint32_t index,
-    const v8::PropertyCallbackInfo<v8::Value>& info) {
-  CheckReturnValue(info, FUNCTION_ADDR(CheckThisIndexedPropertyHandler));
-  ApiTestFuzzer::Fuzz();
-  CHECK(info.This()->Equals(bottom));
-}
-
-static void CheckThisNamedPropertyHandler(
-    Local<Name> name, const v8::PropertyCallbackInfo<v8::Value>& info) {
-  CheckReturnValue(info, FUNCTION_ADDR(CheckThisNamedPropertyHandler));
-  ApiTestFuzzer::Fuzz();
-  CHECK(info.This()->Equals(bottom));
-}
-
-void CheckThisIndexedPropertySetter(
-    uint32_t index,
-    Local<Value> value,
-    const v8::PropertyCallbackInfo<v8::Value>& info) {
-  CheckReturnValue(info, FUNCTION_ADDR(CheckThisIndexedPropertySetter));
-  ApiTestFuzzer::Fuzz();
-  CHECK(info.This()->Equals(bottom));
-}
-
-
-void CheckThisNamedPropertySetter(
-    Local<Name> property, Local<Value> value,
-    const v8::PropertyCallbackInfo<v8::Value>& info) {
-  CheckReturnValue(info, FUNCTION_ADDR(CheckThisNamedPropertySetter));
-  ApiTestFuzzer::Fuzz();
-  CHECK(info.This()->Equals(bottom));
-}
-
-void CheckThisIndexedPropertyQuery(
-    uint32_t index,
-    const v8::PropertyCallbackInfo<v8::Integer>& info) {
-  CheckReturnValue(info, FUNCTION_ADDR(CheckThisIndexedPropertyQuery));
-  ApiTestFuzzer::Fuzz();
-  CHECK(info.This()->Equals(bottom));
-}
-
-
-void CheckThisNamedPropertyQuery(
-    Local<Name> property, const v8::PropertyCallbackInfo<v8::Integer>& info) {
-  CheckReturnValue(info, FUNCTION_ADDR(CheckThisNamedPropertyQuery));
-  ApiTestFuzzer::Fuzz();
-  CHECK(info.This()->Equals(bottom));
-}
-
-
-void CheckThisIndexedPropertyDeleter(
-    uint32_t index,
-    const v8::PropertyCallbackInfo<v8::Boolean>& info) {
-  CheckReturnValue(info, FUNCTION_ADDR(CheckThisIndexedPropertyDeleter));
-  ApiTestFuzzer::Fuzz();
-  CHECK(info.This()->Equals(bottom));
-}
-
-
-void CheckThisNamedPropertyDeleter(
-    Local<Name> property, const v8::PropertyCallbackInfo<v8::Boolean>& info) {
-  CheckReturnValue(info, FUNCTION_ADDR(CheckThisNamedPropertyDeleter));
-  ApiTestFuzzer::Fuzz();
-  CHECK(info.This()->Equals(bottom));
-}
-
-
-void CheckThisIndexedPropertyEnumerator(
-    const v8::PropertyCallbackInfo<v8::Array>& info) {
-  CheckReturnValue(info, FUNCTION_ADDR(CheckThisIndexedPropertyEnumerator));
-  ApiTestFuzzer::Fuzz();
-  CHECK(info.This()->Equals(bottom));
-}
-
-
-void CheckThisNamedPropertyEnumerator(
-    const v8::PropertyCallbackInfo<v8::Array>& info) {
-  CheckReturnValue(info, FUNCTION_ADDR(CheckThisNamedPropertyEnumerator));
-  ApiTestFuzzer::Fuzz();
-  CHECK(info.This()->Equals(bottom));
-}
-
-
-THREADED_PROFILED_TEST(PropertyHandlerInPrototype) {
-  LocalContext env;
-  v8::Isolate* isolate = env->GetIsolate();
-  v8::HandleScope scope(isolate);
-
-  // Set up a prototype chain with three interceptors.
-  v8::Handle<v8::FunctionTemplate> templ = v8::FunctionTemplate::New(isolate);
-  templ->InstanceTemplate()->SetHandler(v8::IndexedPropertyHandlerConfiguration(
-      CheckThisIndexedPropertyHandler, CheckThisIndexedPropertySetter,
-      CheckThisIndexedPropertyQuery, CheckThisIndexedPropertyDeleter,
-      CheckThisIndexedPropertyEnumerator));
-
-  templ->InstanceTemplate()->SetHandler(v8::NamedPropertyHandlerConfiguration(
-      CheckThisNamedPropertyHandler, CheckThisNamedPropertySetter,
-      CheckThisNamedPropertyQuery, CheckThisNamedPropertyDeleter,
-      CheckThisNamedPropertyEnumerator));
-
-  bottom = templ->GetFunction()->NewInstance();
-  Local<v8::Object> top = templ->GetFunction()->NewInstance();
-  Local<v8::Object> middle = templ->GetFunction()->NewInstance();
-
-  bottom->SetPrototype(middle);
-  middle->SetPrototype(top);
-  env->Global()->Set(v8_str("obj"), bottom);
-
-  // Indexed and named get.
-  CompileRun("obj[0]");
-  CompileRun("obj.x");
-
-  // Indexed and named set.
-  CompileRun("obj[1] = 42");
-  CompileRun("obj.y = 42");
-
-  // Indexed and named query.
-  CompileRun("0 in obj");
-  CompileRun("'x' in obj");
-
-  // Indexed and named deleter.
-  CompileRun("delete obj[0]");
-  CompileRun("delete obj.x");
-
-  // Enumerators.
-  CompileRun("for (var p in obj) ;");
-}
-
-
-static void PrePropertyHandlerGet(
-    Local<Name> key, const v8::PropertyCallbackInfo<v8::Value>& info) {
-  ApiTestFuzzer::Fuzz();
-  if (v8_str("pre")->Equals(key)) {
-    info.GetReturnValue().Set(v8_str("PrePropertyHandler: pre"));
-  }
-}
-
-
-static void PrePropertyHandlerQuery(
-    Local<Name> key, const v8::PropertyCallbackInfo<v8::Integer>& info) {
-  if (v8_str("pre")->Equals(key)) {
-    info.GetReturnValue().Set(static_cast<int32_t>(v8::None));
-  }
-}
-
-
-THREADED_TEST(PrePropertyHandler) {
-  v8::Isolate* isolate = CcTest::isolate();
-  v8::HandleScope scope(isolate);
-  v8::Handle<v8::FunctionTemplate> desc = v8::FunctionTemplate::New(isolate);
-  desc->InstanceTemplate()->SetHandler(v8::NamedPropertyHandlerConfiguration(
-      PrePropertyHandlerGet, 0, PrePropertyHandlerQuery));
-  LocalContext env(NULL, desc->InstanceTemplate());
-  CompileRun("var pre = 'Object: pre'; var on = 'Object: on';");
-  v8::Handle<Value> result_pre = CompileRun("pre");
-  CHECK_EQ(v8_str("PrePropertyHandler: pre"), result_pre);
-  v8::Handle<Value> result_on = CompileRun("on");
-  CHECK_EQ(v8_str("Object: on"), result_on);
-  v8::Handle<Value> result_post = CompileRun("post");
-  CHECK(result_post.IsEmpty());
-}
-
-
 THREADED_TEST(UndefinedIsNotEnumerable) {
   LocalContext env;
   v8::HandleScope scope(env->GetIsolate());
-  v8::Handle<Value> result = CompileRun("this.propertyIsEnumerable(undefined)");
+  v8::Local<Value> result = CompileRun("this.propertyIsEnumerable(undefined)");
   CHECK(result->IsFalse());
 }
 
 
-v8::Handle<Script> call_recursively_script;
-static const int kTargetRecursionDepth = 200;  // near maximum
+v8::Local<Script> call_recursively_script;
+static const int kTargetRecursionDepth = 150;  // near maximum
 
 
 static void CallScriptRecursivelyCall(
     const v8::FunctionCallbackInfo<v8::Value>& args) {
   ApiTestFuzzer::Fuzz();
-  int depth = args.This()->Get(v8_str("depth"))->Int32Value();
+  v8::Local<v8::Context> context = args.GetIsolate()->GetCurrentContext();
+  int depth = args.This()
+                  ->Get(context, v8_str("depth"))
+                  .ToLocalChecked()
+                  ->Int32Value(context)
+                  .FromJust();
   if (depth == kTargetRecursionDepth) return;
-  args.This()->Set(v8_str("depth"),
-                   v8::Integer::New(args.GetIsolate(), depth + 1));
-  args.GetReturnValue().Set(call_recursively_script->Run());
+  CHECK(args.This()
+            ->Set(context, v8_str("depth"),
+                  v8::Integer::New(args.GetIsolate(), depth + 1))
+            .FromJust());
+  args.GetReturnValue().Set(
+      call_recursively_script->Run(context).ToLocalChecked());
 }
 
 
 static void CallFunctionRecursivelyCall(
     const v8::FunctionCallbackInfo<v8::Value>& args) {
   ApiTestFuzzer::Fuzz();
-  int depth = args.This()->Get(v8_str("depth"))->Int32Value();
+  v8::Local<v8::Context> context = args.GetIsolate()->GetCurrentContext();
+  int depth = args.This()
+                  ->Get(context, v8_str("depth"))
+                  .ToLocalChecked()
+                  ->Int32Value(context)
+                  .FromJust();
   if (depth == kTargetRecursionDepth) {
     printf("[depth = %d]\n", depth);
     return;
   }
-  args.This()->Set(v8_str("depth"),
-                   v8::Integer::New(args.GetIsolate(), depth + 1));
-  v8::Handle<Value> function =
-      args.This()->Get(v8_str("callFunctionRecursively"));
-  args.GetReturnValue().Set(
-      function.As<Function>()->Call(args.This(), 0, NULL));
+  CHECK(args.This()
+            ->Set(context, v8_str("depth"),
+                  v8::Integer::New(args.GetIsolate(), depth + 1))
+            .FromJust());
+  v8::Local<Value> function =
+      args.This()
+          ->Get(context, v8_str("callFunctionRecursively"))
+          .ToLocalChecked();
+  args.GetReturnValue().Set(function.As<Function>()
+                                ->Call(context, args.This(), 0, NULL)
+                                .ToLocalChecked());
 }
 
 
 THREADED_TEST(DeepCrossLanguageRecursion) {
   v8::Isolate* isolate = CcTest::isolate();
   v8::HandleScope scope(isolate);
-  v8::Handle<v8::ObjectTemplate> global = ObjectTemplate::New(isolate);
+  v8::Local<v8::ObjectTemplate> global = ObjectTemplate::New(isolate);
   global->Set(v8_str("callScriptRecursively"),
               v8::FunctionTemplate::New(isolate, CallScriptRecursivelyCall));
   global->Set(v8_str("callFunctionRecursively"),
               v8::FunctionTemplate::New(isolate, CallFunctionRecursivelyCall));
   LocalContext env(NULL, global);
 
-  env->Global()->Set(v8_str("depth"), v8::Integer::New(isolate, 0));
+  CHECK(env->Global()
+            ->Set(env.local(), v8_str("depth"), v8::Integer::New(isolate, 0))
+            .FromJust());
   call_recursively_script = v8_compile("callScriptRecursively()");
-  call_recursively_script->Run();
-  call_recursively_script = v8::Handle<Script>();
+  call_recursively_script->Run(env.local()).ToLocalChecked();
+  call_recursively_script = v8::Local<Script>();
 
-  env->Global()->Set(v8_str("depth"), v8::Integer::New(isolate, 0));
+  CHECK(env->Global()
+            ->Set(env.local(), v8_str("depth"), v8::Integer::New(isolate, 0))
+            .FromJust());
   CompileRun("callFunctionRecursively()");
 }
 
@@ -2786,17 +2256,20 @@
 THREADED_TEST(CallbackExceptionRegression) {
   v8::Isolate* isolate = CcTest::isolate();
   v8::HandleScope scope(isolate);
-  v8::Handle<v8::ObjectTemplate> obj = ObjectTemplate::New(isolate);
+  v8::Local<v8::ObjectTemplate> obj = ObjectTemplate::New(isolate);
   obj->SetHandler(v8::NamedPropertyHandlerConfiguration(
       ThrowingPropertyHandlerGet, ThrowingPropertyHandlerSet));
   LocalContext env;
-  env->Global()->Set(v8_str("obj"), obj->NewInstance());
-  v8::Handle<Value> otto = CompileRun(
-      "try { with (obj) { otto; } } catch (e) { e; }");
-  CHECK_EQ(v8_str("otto"), otto);
-  v8::Handle<Value> netto = CompileRun(
-      "try { with (obj) { netto = 4; } } catch (e) { e; }");
-  CHECK_EQ(v8_str("netto"), netto);
+  CHECK(env->Global()
+            ->Set(env.local(), v8_str("obj"),
+                  obj->NewInstance(env.local()).ToLocalChecked())
+            .FromJust());
+  v8::Local<Value> otto =
+      CompileRun("try { with (obj) { otto; } } catch (e) { e; }");
+  CHECK(v8_str("otto")->Equals(env.local(), otto).FromJust());
+  v8::Local<Value> netto =
+      CompileRun("try { with (obj) { netto = 4; } } catch (e) { e; }");
+  CHECK(v8_str("netto")->Equals(env.local(), netto).FromJust());
 }
 
 
@@ -2806,9 +2279,12 @@
   Local<v8::FunctionTemplate> Foo = v8::FunctionTemplate::New(isolate);
   Foo->PrototypeTemplate()->Set(v8_str("plak"), v8_num(321));
   LocalContext env;
-  env->Global()->Set(v8_str("Foo"), Foo->GetFunction());
+  CHECK(env->Global()
+            ->Set(env.local(), v8_str("Foo"),
+                  Foo->GetFunction(env.local()).ToLocalChecked())
+            .FromJust());
   Local<Script> script = v8_compile("Foo.prototype.plak");
-  CHECK_EQ(script->Run()->Int32Value(), 321);
+  CHECK_EQ(v8_run_int32value(script), 321);
 }
 
 
@@ -2820,11 +2296,14 @@
   Local<v8::FunctionTemplate> templ = v8::FunctionTemplate::New(isolate);
   Local<v8::ObjectTemplate> instance_templ = templ->InstanceTemplate();
   instance_templ->SetInternalFieldCount(1);
-  Local<v8::Object> obj = templ->GetFunction()->NewInstance();
+  Local<v8::Object> obj = templ->GetFunction(env.local())
+                              .ToLocalChecked()
+                              ->NewInstance(env.local())
+                              .ToLocalChecked();
   CHECK_EQ(1, obj->InternalFieldCount());
   CHECK(obj->GetInternalField(0)->IsUndefined());
   obj->SetInternalField(0, v8_num(17));
-  CHECK_EQ(17, obj->GetInternalField(0)->Int32Value());
+  CHECK_EQ(17, obj->GetInternalField(0)->Int32Value(env.local()).FromJust());
 }
 
 
@@ -2834,12 +2313,12 @@
   Local<v8::ObjectTemplate> global_template = v8::ObjectTemplate::New(isolate);
   global_template->SetInternalFieldCount(1);
   LocalContext env(NULL, global_template);
-  v8::Handle<v8::Object> global_proxy = env->Global();
-  v8::Handle<v8::Object> global = global_proxy->GetPrototype().As<v8::Object>();
+  v8::Local<v8::Object> global_proxy = env->Global();
+  v8::Local<v8::Object> global = global_proxy->GetPrototype().As<v8::Object>();
   CHECK_EQ(1, global->InternalFieldCount());
   CHECK(global->GetInternalField(0)->IsUndefined());
   global->SetInternalField(0, v8_num(17));
-  CHECK_EQ(17, global->GetInternalField(0)->Int32Value());
+  CHECK_EQ(17, global->GetInternalField(0)->Int32Value(env.local()).FromJust());
 }
 
 
@@ -2848,16 +2327,16 @@
   v8::HandleScope scope(CcTest::isolate());
 
   v8::Local<v8::Object> global = env->Global();
-  global->Set(0, v8::String::NewFromUtf8(CcTest::isolate(), "value"));
-  CHECK(global->HasRealIndexedProperty(0));
+  CHECK(global->Set(env.local(), 0, v8_str("value")).FromJust());
+  CHECK(global->HasRealIndexedProperty(env.local(), 0).FromJust());
 }
 
 
-static void CheckAlignedPointerInInternalField(Handle<v8::Object> obj,
+static void CheckAlignedPointerInInternalField(Local<v8::Object> obj,
                                                void* value) {
   CHECK_EQ(0, static_cast<int>(reinterpret_cast<uintptr_t>(value) & 0x1));
   obj->SetAlignedPointerInInternalField(0, value);
-  CcTest::heap()->CollectAllGarbage(i::Heap::kNoGCFlags);
+  CcTest::heap()->CollectAllGarbage();
   CHECK_EQ(value, obj->GetAlignedPointerFromInternalField(0));
 }
 
@@ -2870,7 +2349,10 @@
   Local<v8::FunctionTemplate> templ = v8::FunctionTemplate::New(isolate);
   Local<v8::ObjectTemplate> instance_templ = templ->InstanceTemplate();
   instance_templ->SetInternalFieldCount(1);
-  Local<v8::Object> obj = templ->GetFunction()->NewInstance();
+  Local<v8::Object> obj = templ->GetFunction(env.local())
+                              .ToLocalChecked()
+                              ->NewInstance(env.local())
+                              .ToLocalChecked();
   CHECK_EQ(1, obj->InternalFieldCount());
 
   CheckAlignedPointerInInternalField(obj, NULL);
@@ -2885,18 +2367,17 @@
   void* huge = reinterpret_cast<void*>(~static_cast<uintptr_t>(1));
   CheckAlignedPointerInInternalField(obj, huge);
 
-  v8::UniquePersistent<v8::Object> persistent(isolate, obj);
+  v8::Global<v8::Object> persistent(isolate, obj);
   CHECK_EQ(1, Object::InternalFieldCount(persistent));
   CHECK_EQ(huge, Object::GetAlignedPointerFromInternalField(persistent, 0));
 }
 
 
-static void CheckAlignedPointerInEmbedderData(LocalContext* env,
-                                              int index,
+static void CheckAlignedPointerInEmbedderData(LocalContext* env, int index,
                                               void* value) {
   CHECK_EQ(0, static_cast<int>(reinterpret_cast<uintptr_t>(value) & 0x1));
   (*env)->SetAlignedPointerInEmbedderData(index, value);
-  CcTest::heap()->CollectAllGarbage(i::Heap::kNoGCFlags);
+  CcTest::heap()->CollectAllGarbage();
   CHECK_EQ(value, (*env)->GetAlignedPointerFromEmbedderData(index));
 }
 
@@ -2926,16 +2407,15 @@
   for (int i = 0; i < 100; i++) {
     env->SetAlignedPointerInEmbedderData(i, AlignedTestPointer(i));
   }
-  CcTest::heap()->CollectAllGarbage(i::Heap::kNoGCFlags);
+  CcTest::heap()->CollectAllGarbage();
   for (int i = 0; i < 100; i++) {
     CHECK_EQ(AlignedTestPointer(i), env->GetAlignedPointerFromEmbedderData(i));
   }
 }
 
 
-static void CheckEmbedderData(LocalContext* env,
-                              int index,
-                              v8::Handle<Value> data) {
+static void CheckEmbedderData(LocalContext* env, int index,
+                              v8::Local<Value> data) {
   (*env)->SetEmbedderData(index, data);
   CHECK((*env)->GetEmbedderData(index)->StrictEquals(data));
 }
@@ -2946,26 +2426,13 @@
   v8::Isolate* isolate = env->GetIsolate();
   v8::HandleScope scope(isolate);
 
-  CheckEmbedderData(
-      &env, 3,
-      v8::String::NewFromUtf8(isolate, "The quick brown fox jumps"));
-  CheckEmbedderData(&env, 2, v8::String::NewFromUtf8(isolate,
-                                                     "over the lazy dog."));
+  CheckEmbedderData(&env, 3, v8_str("The quick brown fox jumps"));
+  CheckEmbedderData(&env, 2, v8_str("over the lazy dog."));
   CheckEmbedderData(&env, 1, v8::Number::New(isolate, 1.2345));
   CheckEmbedderData(&env, 0, v8::Boolean::New(isolate, true));
 }
 
 
-THREADED_TEST(GetIsolate) {
-  LocalContext env;
-  v8::Isolate* isolate = env->GetIsolate();
-  v8::HandleScope scope(isolate);
-  Local<v8::Object> obj = v8::Object::New(isolate);
-  CHECK_EQ(isolate, obj->GetIsolate());
-  CHECK_EQ(isolate, CcTest::global()->GetIsolate());
-}
-
-
 THREADED_TEST(IdentityHash) {
   LocalContext env;
   v8::Isolate* isolate = env->GetIsolate();
@@ -2973,7 +2440,7 @@
 
   // Ensure that the test starts with an fresh heap to test whether the hash
   // code is based on the address.
-  CcTest::heap()->CollectAllGarbage(i::Heap::kNoGCFlags);
+  CcTest::heap()->CollectAllGarbage();
   Local<v8::Object> obj = v8::Object::New(isolate);
   int hash = obj->GetIdentityHash();
   int hash1 = obj->GetIdentityHash();
@@ -2983,7 +2450,7 @@
   // objects should not be assigned the same hash code. If the test below fails
   // the random number generator should be evaluated.
   CHECK_NE(hash, hash2);
-  CcTest::heap()->CollectAllGarbage(i::Heap::kNoGCFlags);
+  CcTest::heap()->CollectAllGarbage();
   int hash3 = v8::Object::New(isolate)->GetIdentityHash();
   // Make sure that the identity hash is not based on the initial address of
   // the object alone. If the test below fails the random number generator
@@ -3011,25 +2478,45 @@
 }
 
 
-THREADED_TEST(GlobalProxyIdentityHash) {
+void GlobalProxyIdentityHash(bool set_in_js) {
   LocalContext env;
   v8::Isolate* isolate = env->GetIsolate();
+  i::Isolate* i_isolate = reinterpret_cast<i::Isolate*>(isolate);
   v8::HandleScope scope(isolate);
-  Handle<Object> global_proxy = env->Global();
-  int hash1 = global_proxy->GetIdentityHash();
+  Local<Object> global_proxy = env->Global();
+  i::Handle<i::Object> i_global_proxy = v8::Utils::OpenHandle(*global_proxy);
+  CHECK(env->Global()
+            ->Set(env.local(), v8_str("global"), global_proxy)
+            .FromJust());
+  i::Handle<i::Object> original_hash;
+  if (set_in_js) {
+    CompileRun("var m = new Set(); m.add(global);");
+    original_hash = i::Handle<i::Object>(i_global_proxy->GetHash(), i_isolate);
+  } else {
+    original_hash = i::Handle<i::Object>(
+        i::Object::GetOrCreateHash(i_isolate, i_global_proxy));
+  }
+  CHECK(original_hash->IsSmi());
+  int32_t hash1 = i::Handle<i::Smi>::cast(original_hash)->value();
   // Hash should be retained after being detached.
   env->DetachGlobal();
   int hash2 = global_proxy->GetIdentityHash();
   CHECK_EQ(hash1, hash2);
   {
     // Re-attach global proxy to a new context, hash should stay the same.
-    LocalContext env2(NULL, Handle<ObjectTemplate>(), global_proxy);
+    LocalContext env2(NULL, Local<ObjectTemplate>(), global_proxy);
     int hash3 = global_proxy->GetIdentityHash();
     CHECK_EQ(hash1, hash3);
   }
 }
 
 
+THREADED_TEST(GlobalProxyIdentityHash) {
+  GlobalProxyIdentityHash(true);
+  GlobalProxyIdentityHash(false);
+}
+
+
 TEST(SymbolIdentityHash) {
   LocalContext env;
   v8::Isolate* isolate = env->GetIsolate();
@@ -3040,18 +2527,18 @@
     int hash = symbol->GetIdentityHash();
     int hash1 = symbol->GetIdentityHash();
     CHECK_EQ(hash, hash1);
-    CcTest::heap()->CollectAllGarbage(i::Heap::kNoGCFlags);
+    CcTest::heap()->CollectAllGarbage();
     int hash3 = symbol->GetIdentityHash();
     CHECK_EQ(hash, hash3);
   }
 
   {
-    v8::Handle<v8::Symbol> js_symbol =
+    v8::Local<v8::Symbol> js_symbol =
         CompileRun("Symbol('foo')").As<v8::Symbol>();
     int hash = js_symbol->GetIdentityHash();
     int hash1 = js_symbol->GetIdentityHash();
     CHECK_EQ(hash, hash1);
-    CcTest::heap()->CollectAllGarbage(i::Heap::kNoGCFlags);
+    CcTest::heap()->CollectAllGarbage();
     int hash3 = js_symbol->GetIdentityHash();
     CHECK_EQ(hash, hash3);
   }
@@ -3063,15 +2550,15 @@
   v8::Isolate* isolate = env->GetIsolate();
   v8::HandleScope scope(isolate);
 
-  Local<v8::String> str = v8::String::NewFromUtf8(isolate, "str1");
+  Local<v8::String> str = v8_str("str1");
   int hash = str->GetIdentityHash();
   int hash1 = str->GetIdentityHash();
   CHECK_EQ(hash, hash1);
-  CcTest::heap()->CollectAllGarbage(i::Heap::kNoGCFlags);
+  CcTest::heap()->CollectAllGarbage();
   int hash3 = str->GetIdentityHash();
   CHECK_EQ(hash, hash3);
 
-  Local<v8::String> str2 = v8::String::NewFromUtf8(isolate, "str1");
+  Local<v8::String> str2 = v8_str("str1");
   int hash4 = str2->GetIdentityHash();
   CHECK_EQ(hash, hash4);
 }
@@ -3084,104 +2571,155 @@
 
   v8::Local<v8::Object> obj = v8::Object::New(isolate);
   v8::Local<v8::Symbol> sym1 = v8::Symbol::New(isolate);
-  v8::Local<v8::Symbol> sym2 =
-      v8::Symbol::New(isolate, v8_str("my-symbol"));
-  v8::Local<v8::Symbol> sym3 =
-      v8::Symbol::New(isolate, v8_str("sym3"));
+  v8::Local<v8::Symbol> sym2 = v8::Symbol::New(isolate, v8_str("my-symbol"));
+  v8::Local<v8::Symbol> sym3 = v8::Symbol::New(isolate, v8_str("sym3"));
 
-  CcTest::heap()->CollectAllGarbage(i::Heap::kNoGCFlags);
+  CcTest::heap()->CollectAllGarbage();
 
   // Check basic symbol functionality.
   CHECK(sym1->IsSymbol());
   CHECK(sym2->IsSymbol());
   CHECK(!obj->IsSymbol());
 
-  CHECK(sym1->Equals(sym1));
-  CHECK(sym2->Equals(sym2));
-  CHECK(!sym1->Equals(sym2));
-  CHECK(!sym2->Equals(sym1));
+  CHECK(sym1->Equals(env.local(), sym1).FromJust());
+  CHECK(sym2->Equals(env.local(), sym2).FromJust());
+  CHECK(!sym1->Equals(env.local(), sym2).FromJust());
+  CHECK(!sym2->Equals(env.local(), sym1).FromJust());
   CHECK(sym1->StrictEquals(sym1));
   CHECK(sym2->StrictEquals(sym2));
   CHECK(!sym1->StrictEquals(sym2));
   CHECK(!sym2->StrictEquals(sym1));
 
-  CHECK(sym2->Name()->Equals(v8_str("my-symbol")));
+  CHECK(sym2->Name()->Equals(env.local(), v8_str("my-symbol")).FromJust());
 
   v8::Local<v8::Value> sym_val = sym2;
   CHECK(sym_val->IsSymbol());
-  CHECK(sym_val->Equals(sym2));
+  CHECK(sym_val->Equals(env.local(), sym2).FromJust());
   CHECK(sym_val->StrictEquals(sym2));
-  CHECK(v8::Symbol::Cast(*sym_val)->Equals(sym2));
+  CHECK(v8::Symbol::Cast(*sym_val)->Equals(env.local(), sym2).FromJust());
 
   v8::Local<v8::Value> sym_obj = v8::SymbolObject::New(isolate, sym2);
   CHECK(sym_obj->IsSymbolObject());
   CHECK(!sym2->IsSymbolObject());
   CHECK(!obj->IsSymbolObject());
-  CHECK(!sym_obj->Equals(sym2));
+  CHECK(sym_obj->Equals(env.local(), sym2).FromJust());
   CHECK(!sym_obj->StrictEquals(sym2));
-  CHECK(v8::SymbolObject::Cast(*sym_obj)->Equals(sym_obj));
-  CHECK(v8::SymbolObject::Cast(*sym_obj)->ValueOf()->Equals(sym2));
+  CHECK(v8::SymbolObject::Cast(*sym_obj)
+            ->Equals(env.local(), sym_obj)
+            .FromJust());
+  CHECK(v8::SymbolObject::Cast(*sym_obj)
+            ->ValueOf()
+            ->Equals(env.local(), sym2)
+            .FromJust());
 
   // Make sure delete of a non-existent symbol property works.
-  CHECK(obj->Delete(sym1));
-  CHECK(!obj->Has(sym1));
+  CHECK(obj->Delete(env.local(), sym1).FromJust());
+  CHECK(!obj->Has(env.local(), sym1).FromJust());
 
-  CHECK(obj->Set(sym1, v8::Integer::New(isolate, 1503)));
-  CHECK(obj->Has(sym1));
-  CHECK_EQ(1503, obj->Get(sym1)->Int32Value());
-  CHECK(obj->Set(sym1, v8::Integer::New(isolate, 2002)));
-  CHECK(obj->Has(sym1));
-  CHECK_EQ(2002, obj->Get(sym1)->Int32Value());
-  CHECK_EQ(v8::None, obj->GetPropertyAttributes(sym1));
+  CHECK(
+      obj->Set(env.local(), sym1, v8::Integer::New(isolate, 1503)).FromJust());
+  CHECK(obj->Has(env.local(), sym1).FromJust());
+  CHECK_EQ(1503, obj->Get(env.local(), sym1)
+                     .ToLocalChecked()
+                     ->Int32Value(env.local())
+                     .FromJust());
+  CHECK(
+      obj->Set(env.local(), sym1, v8::Integer::New(isolate, 2002)).FromJust());
+  CHECK(obj->Has(env.local(), sym1).FromJust());
+  CHECK_EQ(2002, obj->Get(env.local(), sym1)
+                     .ToLocalChecked()
+                     ->Int32Value(env.local())
+                     .FromJust());
+  CHECK_EQ(v8::None, obj->GetPropertyAttributes(env.local(), sym1).FromJust());
 
-  CHECK_EQ(0, obj->GetOwnPropertyNames()->Length());
-  int num_props = obj->GetPropertyNames()->Length();
-  CHECK(obj->Set(v8::String::NewFromUtf8(isolate, "bla"),
-                 v8::Integer::New(isolate, 20)));
-  CHECK_EQ(1, obj->GetOwnPropertyNames()->Length());
-  CHECK_EQ(num_props + 1, obj->GetPropertyNames()->Length());
+  CHECK_EQ(0u,
+           obj->GetOwnPropertyNames(env.local()).ToLocalChecked()->Length());
+  unsigned num_props =
+      obj->GetPropertyNames(env.local()).ToLocalChecked()->Length();
+  CHECK(obj->Set(env.local(), v8_str("bla"), v8::Integer::New(isolate, 20))
+            .FromJust());
+  CHECK_EQ(1u,
+           obj->GetOwnPropertyNames(env.local()).ToLocalChecked()->Length());
+  CHECK_EQ(num_props + 1,
+           obj->GetPropertyNames(env.local()).ToLocalChecked()->Length());
 
-  CcTest::heap()->CollectAllGarbage(i::Heap::kNoGCFlags);
+  CcTest::heap()->CollectAllGarbage();
 
-  CHECK(obj->SetAccessor(sym3, SymbolAccessorGetter, SymbolAccessorSetter));
-  CHECK(obj->Get(sym3)->IsUndefined());
-  CHECK(obj->Set(sym3, v8::Integer::New(isolate, 42)));
-  CHECK(obj->Get(sym3)->Equals(v8::Integer::New(isolate, 42)));
-  CHECK(obj->Get(v8::String::NewFromUtf8(isolate, "accessor_sym3"))->Equals(
-      v8::Integer::New(isolate, 42)));
+  CHECK(obj->SetAccessor(env.local(), sym3, SymbolAccessorGetter,
+                         SymbolAccessorSetter)
+            .FromJust());
+  CHECK(obj->Get(env.local(), sym3).ToLocalChecked()->IsUndefined());
+  CHECK(obj->Set(env.local(), sym3, v8::Integer::New(isolate, 42)).FromJust());
+  CHECK(obj->Get(env.local(), sym3)
+            .ToLocalChecked()
+            ->Equals(env.local(), v8::Integer::New(isolate, 42))
+            .FromJust());
+  CHECK(obj->Get(env.local(), v8_str("accessor_sym3"))
+            .ToLocalChecked()
+            ->Equals(env.local(), v8::Integer::New(isolate, 42))
+            .FromJust());
 
   // Add another property and delete it afterwards to force the object in
   // slow case.
-  CHECK(obj->Set(sym2, v8::Integer::New(isolate, 2008)));
-  CHECK_EQ(2002, obj->Get(sym1)->Int32Value());
-  CHECK_EQ(2008, obj->Get(sym2)->Int32Value());
-  CHECK_EQ(2002, obj->Get(sym1)->Int32Value());
-  CHECK_EQ(2, obj->GetOwnPropertyNames()->Length());
+  CHECK(
+      obj->Set(env.local(), sym2, v8::Integer::New(isolate, 2008)).FromJust());
+  CHECK_EQ(2002, obj->Get(env.local(), sym1)
+                     .ToLocalChecked()
+                     ->Int32Value(env.local())
+                     .FromJust());
+  CHECK_EQ(2008, obj->Get(env.local(), sym2)
+                     .ToLocalChecked()
+                     ->Int32Value(env.local())
+                     .FromJust());
+  CHECK_EQ(2002, obj->Get(env.local(), sym1)
+                     .ToLocalChecked()
+                     ->Int32Value(env.local())
+                     .FromJust());
+  CHECK_EQ(2u,
+           obj->GetOwnPropertyNames(env.local()).ToLocalChecked()->Length());
 
-  CHECK(obj->Has(sym1));
-  CHECK(obj->Has(sym2));
-  CHECK(obj->Has(sym3));
-  CHECK(obj->Has(v8::String::NewFromUtf8(isolate, "accessor_sym3")));
-  CHECK(obj->Delete(sym2));
-  CHECK(obj->Has(sym1));
-  CHECK(!obj->Has(sym2));
-  CHECK(obj->Has(sym3));
-  CHECK(obj->Has(v8::String::NewFromUtf8(isolate, "accessor_sym3")));
-  CHECK_EQ(2002, obj->Get(sym1)->Int32Value());
-  CHECK(obj->Get(sym3)->Equals(v8::Integer::New(isolate, 42)));
-  CHECK(obj->Get(v8::String::NewFromUtf8(isolate, "accessor_sym3"))->Equals(
-      v8::Integer::New(isolate, 42)));
-  CHECK_EQ(2, obj->GetOwnPropertyNames()->Length());
+  CHECK(obj->Has(env.local(), sym1).FromJust());
+  CHECK(obj->Has(env.local(), sym2).FromJust());
+  CHECK(obj->Has(env.local(), sym3).FromJust());
+  CHECK(obj->Has(env.local(), v8_str("accessor_sym3")).FromJust());
+  CHECK(obj->Delete(env.local(), sym2).FromJust());
+  CHECK(obj->Has(env.local(), sym1).FromJust());
+  CHECK(!obj->Has(env.local(), sym2).FromJust());
+  CHECK(obj->Has(env.local(), sym3).FromJust());
+  CHECK(obj->Has(env.local(), v8_str("accessor_sym3")).FromJust());
+  CHECK_EQ(2002, obj->Get(env.local(), sym1)
+                     .ToLocalChecked()
+                     ->Int32Value(env.local())
+                     .FromJust());
+  CHECK(obj->Get(env.local(), sym3)
+            .ToLocalChecked()
+            ->Equals(env.local(), v8::Integer::New(isolate, 42))
+            .FromJust());
+  CHECK(obj->Get(env.local(), v8_str("accessor_sym3"))
+            .ToLocalChecked()
+            ->Equals(env.local(), v8::Integer::New(isolate, 42))
+            .FromJust());
+  CHECK_EQ(2u,
+           obj->GetOwnPropertyNames(env.local()).ToLocalChecked()->Length());
 
   // Symbol properties are inherited.
   v8::Local<v8::Object> child = v8::Object::New(isolate);
-  child->SetPrototype(obj);
-  CHECK(child->Has(sym1));
-  CHECK_EQ(2002, child->Get(sym1)->Int32Value());
-  CHECK(obj->Get(sym3)->Equals(v8::Integer::New(isolate, 42)));
-  CHECK(obj->Get(v8::String::NewFromUtf8(isolate, "accessor_sym3"))->Equals(
-      v8::Integer::New(isolate, 42)));
-  CHECK_EQ(0, child->GetOwnPropertyNames()->Length());
+  CHECK(child->SetPrototype(env.local(), obj).FromJust());
+  CHECK(child->Has(env.local(), sym1).FromJust());
+  CHECK_EQ(2002, child->Get(env.local(), sym1)
+                     .ToLocalChecked()
+                     ->Int32Value(env.local())
+                     .FromJust());
+  CHECK(obj->Get(env.local(), sym3)
+            .ToLocalChecked()
+            ->Equals(env.local(), v8::Integer::New(isolate, 42))
+            .FromJust());
+  CHECK(obj->Get(env.local(), v8_str("accessor_sym3"))
+            .ToLocalChecked()
+            ->Equals(env.local(), v8::Integer::New(isolate, 42))
+            .FromJust());
+  CHECK_EQ(0u,
+           child->GetOwnPropertyNames(env.local()).ToLocalChecked()->Length());
 }
 
 
@@ -3193,9 +2731,110 @@
   v8::Local<v8::Name> name = v8::Symbol::New(isolate);
   CHECK(!name.IsEmpty());
   foo->PrototypeTemplate()->Set(name, v8::FunctionTemplate::New(isolate));
-  v8::Local<v8::Object> new_instance = foo->InstanceTemplate()->NewInstance();
+  v8::Local<v8::Object> new_instance =
+      foo->InstanceTemplate()->NewInstance(env.local()).ToLocalChecked();
   CHECK(!new_instance.IsEmpty());
-  CHECK(new_instance->Has(name));
+  CHECK(new_instance->Has(env.local(), name).FromJust());
+}
+
+
+THREADED_TEST(PrivatePropertiesOnProxies) {
+  i::FLAG_harmony_proxies = true;
+  LocalContext env;
+  v8::Isolate* isolate = env->GetIsolate();
+  v8::HandleScope scope(isolate);
+
+  v8::Local<v8::Object> target = CompileRun("({})").As<v8::Object>();
+  v8::Local<v8::Object> handler = CompileRun("({})").As<v8::Object>();
+
+  v8::Local<v8::Proxy> proxy =
+      v8::Proxy::New(env.local(), target, handler).ToLocalChecked();
+
+  v8::Local<v8::Private> priv1 = v8::Private::New(isolate);
+  v8::Local<v8::Private> priv2 =
+      v8::Private::New(isolate, v8_str("my-private"));
+
+  CcTest::heap()->CollectAllGarbage();
+
+  CHECK(priv2->Name()
+            ->Equals(env.local(),
+                     v8::String::NewFromUtf8(isolate, "my-private",
+                                             v8::NewStringType::kNormal)
+                         .ToLocalChecked())
+            .FromJust());
+
+  // Make sure delete of a non-existent private symbol property works.
+  proxy->DeletePrivate(env.local(), priv1).FromJust();
+  CHECK(!proxy->HasPrivate(env.local(), priv1).FromJust());
+
+  CHECK(proxy->SetPrivate(env.local(), priv1, v8::Integer::New(isolate, 1503))
+            .FromJust());
+  CHECK(proxy->HasPrivate(env.local(), priv1).FromJust());
+  CHECK_EQ(1503, proxy->GetPrivate(env.local(), priv1)
+                     .ToLocalChecked()
+                     ->Int32Value(env.local())
+                     .FromJust());
+  CHECK(proxy->SetPrivate(env.local(), priv1, v8::Integer::New(isolate, 2002))
+            .FromJust());
+  CHECK(proxy->HasPrivate(env.local(), priv1).FromJust());
+  CHECK_EQ(2002, proxy->GetPrivate(env.local(), priv1)
+                     .ToLocalChecked()
+                     ->Int32Value(env.local())
+                     .FromJust());
+
+  CHECK_EQ(0u,
+           proxy->GetOwnPropertyNames(env.local()).ToLocalChecked()->Length());
+  unsigned num_props =
+      proxy->GetPropertyNames(env.local()).ToLocalChecked()->Length();
+  CHECK(proxy->Set(env.local(), v8::String::NewFromUtf8(
+                                    isolate, "bla", v8::NewStringType::kNormal)
+                                    .ToLocalChecked(),
+                   v8::Integer::New(isolate, 20))
+            .FromJust());
+  CHECK_EQ(1u,
+           proxy->GetOwnPropertyNames(env.local()).ToLocalChecked()->Length());
+  CHECK_EQ(num_props + 1,
+           proxy->GetPropertyNames(env.local()).ToLocalChecked()->Length());
+
+  CcTest::heap()->CollectAllGarbage();
+
+  // Add another property and delete it afterwards to force the object in
+  // slow case.
+  CHECK(proxy->SetPrivate(env.local(), priv2, v8::Integer::New(isolate, 2008))
+            .FromJust());
+  CHECK_EQ(2002, proxy->GetPrivate(env.local(), priv1)
+                     .ToLocalChecked()
+                     ->Int32Value(env.local())
+                     .FromJust());
+  CHECK_EQ(2008, proxy->GetPrivate(env.local(), priv2)
+                     .ToLocalChecked()
+                     ->Int32Value(env.local())
+                     .FromJust());
+  CHECK_EQ(2002, proxy->GetPrivate(env.local(), priv1)
+                     .ToLocalChecked()
+                     ->Int32Value(env.local())
+                     .FromJust());
+  CHECK_EQ(1u,
+           proxy->GetOwnPropertyNames(env.local()).ToLocalChecked()->Length());
+
+  CHECK(proxy->HasPrivate(env.local(), priv1).FromJust());
+  CHECK(proxy->HasPrivate(env.local(), priv2).FromJust());
+  CHECK(proxy->DeletePrivate(env.local(), priv2).FromJust());
+  CHECK(proxy->HasPrivate(env.local(), priv1).FromJust());
+  CHECK(!proxy->HasPrivate(env.local(), priv2).FromJust());
+  CHECK_EQ(2002, proxy->GetPrivate(env.local(), priv1)
+                     .ToLocalChecked()
+                     ->Int32Value(env.local())
+                     .FromJust());
+  CHECK_EQ(1u,
+           proxy->GetOwnPropertyNames(env.local()).ToLocalChecked()->Length());
+
+  // Private properties are not inherited (for the time being).
+  v8::Local<v8::Object> child = v8::Object::New(isolate);
+  CHECK(child->SetPrototype(env.local(), proxy).FromJust());
+  CHECK(!child->HasPrivate(env.local(), priv1).FromJust());
+  CHECK_EQ(0u,
+           child->GetOwnPropertyNames(env.local()).ToLocalChecked()->Length());
 }
 
 
@@ -3209,52 +2848,87 @@
   v8::Local<v8::Private> priv2 =
       v8::Private::New(isolate, v8_str("my-private"));
 
-  CcTest::heap()->CollectAllGarbage(i::Heap::kNoGCFlags);
+  CcTest::heap()->CollectAllGarbage();
 
-  CHECK(priv2->Name()->Equals(v8::String::NewFromUtf8(isolate, "my-private")));
+  CHECK(priv2->Name()
+            ->Equals(env.local(),
+                     v8::String::NewFromUtf8(isolate, "my-private",
+                                             v8::NewStringType::kNormal)
+                         .ToLocalChecked())
+            .FromJust());
 
   // Make sure delete of a non-existent private symbol property works.
-  CHECK(obj->DeletePrivate(priv1));
-  CHECK(!obj->HasPrivate(priv1));
+  obj->DeletePrivate(env.local(), priv1).FromJust();
+  CHECK(!obj->HasPrivate(env.local(), priv1).FromJust());
 
-  CHECK(obj->SetPrivate(priv1, v8::Integer::New(isolate, 1503)));
-  CHECK(obj->HasPrivate(priv1));
-  CHECK_EQ(1503, obj->GetPrivate(priv1)->Int32Value());
-  CHECK(obj->SetPrivate(priv1, v8::Integer::New(isolate, 2002)));
-  CHECK(obj->HasPrivate(priv1));
-  CHECK_EQ(2002, obj->GetPrivate(priv1)->Int32Value());
+  CHECK(obj->SetPrivate(env.local(), priv1, v8::Integer::New(isolate, 1503))
+            .FromJust());
+  CHECK(obj->HasPrivate(env.local(), priv1).FromJust());
+  CHECK_EQ(1503, obj->GetPrivate(env.local(), priv1)
+                     .ToLocalChecked()
+                     ->Int32Value(env.local())
+                     .FromJust());
+  CHECK(obj->SetPrivate(env.local(), priv1, v8::Integer::New(isolate, 2002))
+            .FromJust());
+  CHECK(obj->HasPrivate(env.local(), priv1).FromJust());
+  CHECK_EQ(2002, obj->GetPrivate(env.local(), priv1)
+                     .ToLocalChecked()
+                     ->Int32Value(env.local())
+                     .FromJust());
 
-  CHECK_EQ(0, obj->GetOwnPropertyNames()->Length());
-  int num_props = obj->GetPropertyNames()->Length();
-  CHECK(obj->Set(v8::String::NewFromUtf8(isolate, "bla"),
-                 v8::Integer::New(isolate, 20)));
-  CHECK_EQ(1, obj->GetOwnPropertyNames()->Length());
-  CHECK_EQ(num_props + 1, obj->GetPropertyNames()->Length());
+  CHECK_EQ(0u,
+           obj->GetOwnPropertyNames(env.local()).ToLocalChecked()->Length());
+  unsigned num_props =
+      obj->GetPropertyNames(env.local()).ToLocalChecked()->Length();
+  CHECK(obj->Set(env.local(), v8::String::NewFromUtf8(
+                                  isolate, "bla", v8::NewStringType::kNormal)
+                                  .ToLocalChecked(),
+                 v8::Integer::New(isolate, 20))
+            .FromJust());
+  CHECK_EQ(1u,
+           obj->GetOwnPropertyNames(env.local()).ToLocalChecked()->Length());
+  CHECK_EQ(num_props + 1,
+           obj->GetPropertyNames(env.local()).ToLocalChecked()->Length());
 
-  CcTest::heap()->CollectAllGarbage(i::Heap::kNoGCFlags);
+  CcTest::heap()->CollectAllGarbage();
 
   // Add another property and delete it afterwards to force the object in
   // slow case.
-  CHECK(obj->SetPrivate(priv2, v8::Integer::New(isolate, 2008)));
-  CHECK_EQ(2002, obj->GetPrivate(priv1)->Int32Value());
-  CHECK_EQ(2008, obj->GetPrivate(priv2)->Int32Value());
-  CHECK_EQ(2002, obj->GetPrivate(priv1)->Int32Value());
-  CHECK_EQ(1, obj->GetOwnPropertyNames()->Length());
+  CHECK(obj->SetPrivate(env.local(), priv2, v8::Integer::New(isolate, 2008))
+            .FromJust());
+  CHECK_EQ(2002, obj->GetPrivate(env.local(), priv1)
+                     .ToLocalChecked()
+                     ->Int32Value(env.local())
+                     .FromJust());
+  CHECK_EQ(2008, obj->GetPrivate(env.local(), priv2)
+                     .ToLocalChecked()
+                     ->Int32Value(env.local())
+                     .FromJust());
+  CHECK_EQ(2002, obj->GetPrivate(env.local(), priv1)
+                     .ToLocalChecked()
+                     ->Int32Value(env.local())
+                     .FromJust());
+  CHECK_EQ(1u,
+           obj->GetOwnPropertyNames(env.local()).ToLocalChecked()->Length());
 
-  CHECK(obj->HasPrivate(priv1));
-  CHECK(obj->HasPrivate(priv2));
-  CHECK(obj->DeletePrivate(priv2));
-  CHECK(obj->HasPrivate(priv1));
-  CHECK(!obj->HasPrivate(priv2));
-  CHECK_EQ(2002, obj->GetPrivate(priv1)->Int32Value());
-  CHECK_EQ(1, obj->GetOwnPropertyNames()->Length());
+  CHECK(obj->HasPrivate(env.local(), priv1).FromJust());
+  CHECK(obj->HasPrivate(env.local(), priv2).FromJust());
+  CHECK(obj->DeletePrivate(env.local(), priv2).FromJust());
+  CHECK(obj->HasPrivate(env.local(), priv1).FromJust());
+  CHECK(!obj->HasPrivate(env.local(), priv2).FromJust());
+  CHECK_EQ(2002, obj->GetPrivate(env.local(), priv1)
+                     .ToLocalChecked()
+                     ->Int32Value(env.local())
+                     .FromJust());
+  CHECK_EQ(1u,
+           obj->GetOwnPropertyNames(env.local()).ToLocalChecked()->Length());
 
-  // Private properties are inherited (for the time being).
+  // Private properties are not inherited (for the time being).
   v8::Local<v8::Object> child = v8::Object::New(isolate);
-  child->SetPrototype(obj);
-  CHECK(child->HasPrivate(priv1));
-  CHECK_EQ(2002, child->GetPrivate(priv1)->Int32Value());
-  CHECK_EQ(0, child->GetOwnPropertyNames()->Length());
+  CHECK(child->SetPrototype(env.local(), obj).FromJust());
+  CHECK(!child->HasPrivate(env.local(), priv1).FromJust());
+  CHECK_EQ(0u,
+           child->GetOwnPropertyNames(env.local()).ToLocalChecked()->Length());
 }
 
 
@@ -3277,7 +2951,8 @@
   CHECK(!sym->SameValue(glob));
 
   CompileRun("var sym2 = Symbol.for('my-symbol')");
-  v8::Local<Value> sym2 = env->Global()->Get(v8_str("sym2"));
+  v8::Local<Value> sym2 =
+      env->Global()->Get(env.local(), v8_str("sym2")).ToLocalChecked();
   CHECK(sym2->SameValue(glob));
   CHECK(!sym2->SameValue(glob_api));
 }
@@ -3292,7 +2967,8 @@
   v8::Local<v8::Symbol> symbol = getter(isolate);
   std::string script = std::string("var sym = ") + name;
   CompileRun(script.c_str());
-  v8::Local<Value> value = env->Global()->Get(v8_str("sym"));
+  v8::Local<Value> value =
+      env->Global()->Get(env.local(), v8_str("sym")).ToLocalChecked();
 
   CHECK(!value.IsEmpty());
   CHECK(!symbol.IsEmpty());
@@ -3307,6 +2983,7 @@
 
 
 THREADED_TEST(GlobalPrivates) {
+  i::FLAG_allow_natives_syntax = true;
   LocalContext env;
   v8::Isolate* isolate = env->GetIsolate();
   v8::HandleScope scope(isolate);
@@ -3314,37 +2991,41 @@
   v8::Local<String> name = v8_str("my-private");
   v8::Local<v8::Private> glob = v8::Private::ForApi(isolate, name);
   v8::Local<v8::Object> obj = v8::Object::New(isolate);
-  CHECK(obj->SetPrivate(glob, v8::Integer::New(isolate, 3)));
+  CHECK(obj->SetPrivate(env.local(), glob, v8::Integer::New(isolate, 3))
+            .FromJust());
 
   v8::Local<v8::Private> glob2 = v8::Private::ForApi(isolate, name);
-  CHECK(obj->HasPrivate(glob2));
+  CHECK(obj->HasPrivate(env.local(), glob2).FromJust());
 
   v8::Local<v8::Private> priv = v8::Private::New(isolate, name);
-  CHECK(!obj->HasPrivate(priv));
+  CHECK(!obj->HasPrivate(env.local(), priv).FromJust());
 
-  CompileRun("var intern = %CreateGlobalPrivateSymbol('my-private')");
-  v8::Local<Value> intern = env->Global()->Get(v8_str("intern"));
-  CHECK(!obj->Has(intern));
+  CompileRun("var intern = %CreatePrivateSymbol('my-private')");
+  v8::Local<Value> intern =
+      env->Global()->Get(env.local(), v8_str("intern")).ToLocalChecked();
+  CHECK(!obj->Has(env.local(), intern).FromJust());
 }
 
 
 class ScopedArrayBufferContents {
  public:
-  explicit ScopedArrayBufferContents(
-      const v8::ArrayBuffer::Contents& contents)
-    : contents_(contents) {}
+  explicit ScopedArrayBufferContents(const v8::ArrayBuffer::Contents& contents)
+      : contents_(contents) {}
   ~ScopedArrayBufferContents() { free(contents_.Data()); }
   void* Data() const { return contents_.Data(); }
   size_t ByteLength() const { return contents_.ByteLength(); }
+
  private:
   const v8::ArrayBuffer::Contents contents_;
 };
 
 template <typename T>
-static void CheckInternalFieldsAreZero(v8::Handle<T> value) {
+static void CheckInternalFieldsAreZero(v8::Local<T> value) {
   CHECK_EQ(T::kInternalFieldCount, value->InternalFieldCount());
   for (int i = 0; i < value->InternalFieldCount(); i++) {
-    CHECK_EQ(0, value->GetInternalField(i)->Int32Value());
+    CHECK_EQ(0, value->GetInternalField(i)
+                    ->Int32Value(CcTest::isolate()->GetCurrentContext())
+                    .FromJust());
   }
 }
 
@@ -3358,30 +3039,31 @@
   CheckInternalFieldsAreZero(ab);
   CHECK_EQ(1024, static_cast<int>(ab->ByteLength()));
   CHECK(!ab->IsExternal());
-  CcTest::heap()->CollectAllGarbage(i::Heap::kNoGCFlags);
+  CcTest::heap()->CollectAllGarbage();
 
   ScopedArrayBufferContents ab_contents(ab->Externalize());
   CHECK(ab->IsExternal());
 
   CHECK_EQ(1024, static_cast<int>(ab_contents.ByteLength()));
   uint8_t* data = static_cast<uint8_t*>(ab_contents.Data());
-  DCHECK(data != NULL);
-  env->Global()->Set(v8_str("ab"), ab);
+  CHECK(data != NULL);
+  CHECK(env->Global()->Set(env.local(), v8_str("ab"), ab).FromJust());
 
-  v8::Handle<v8::Value> result = CompileRun("ab.byteLength");
-  CHECK_EQ(1024, result->Int32Value());
+  v8::Local<v8::Value> result = CompileRun("ab.byteLength");
+  CHECK_EQ(1024, result->Int32Value(env.local()).FromJust());
 
-  result = CompileRun("var u8 = new Uint8Array(ab);"
-                      "u8[0] = 0xFF;"
-                      "u8[1] = 0xAA;"
-                      "u8.length");
-  CHECK_EQ(1024, result->Int32Value());
+  result = CompileRun(
+      "var u8 = new Uint8Array(ab);"
+      "u8[0] = 0xFF;"
+      "u8[1] = 0xAA;"
+      "u8.length");
+  CHECK_EQ(1024, result->Int32Value(env.local()).FromJust());
   CHECK_EQ(0xFF, data[0]);
   CHECK_EQ(0xAA, data[1]);
   data[0] = 0xCC;
   data[1] = 0x11;
   result = CompileRun("u8[0] + u8[1]");
-  CHECK_EQ(0xDD, result->Int32Value());
+  CHECK_EQ(0xDD, result->Int32Value(env.local()).FromJust());
 }
 
 
@@ -3391,11 +3073,11 @@
   v8::HandleScope handle_scope(isolate);
 
 
-  v8::Local<v8::Value> result =
-      CompileRun("var ab1 = new ArrayBuffer(2);"
-                 "var u8_a = new Uint8Array(ab1);"
-                 "u8_a[0] = 0xAA;"
-                 "u8_a[1] = 0xFF; u8_a.buffer");
+  v8::Local<v8::Value> result = CompileRun(
+      "var ab1 = new ArrayBuffer(2);"
+      "var u8_a = new Uint8Array(ab1);"
+      "u8_a[0] = 0xAA;"
+      "u8_a[1] = 0xFF; u8_a.buffer");
   Local<v8::ArrayBuffer> ab1 = Local<v8::ArrayBuffer>::Cast(result);
   CheckInternalFieldsAreZero(ab1);
   CHECK_EQ(2, static_cast<int>(ab1->ByteLength()));
@@ -3404,17 +3086,18 @@
   CHECK(ab1->IsExternal());
 
   result = CompileRun("ab1.byteLength");
-  CHECK_EQ(2, result->Int32Value());
+  CHECK_EQ(2, result->Int32Value(env.local()).FromJust());
   result = CompileRun("u8_a[0]");
-  CHECK_EQ(0xAA, result->Int32Value());
+  CHECK_EQ(0xAA, result->Int32Value(env.local()).FromJust());
   result = CompileRun("u8_a[1]");
-  CHECK_EQ(0xFF, result->Int32Value());
-  result = CompileRun("var u8_b = new Uint8Array(ab1);"
-                      "u8_b[0] = 0xBB;"
-                      "u8_a[0]");
-  CHECK_EQ(0xBB, result->Int32Value());
+  CHECK_EQ(0xFF, result->Int32Value(env.local()).FromJust());
+  result = CompileRun(
+      "var u8_b = new Uint8Array(ab1);"
+      "u8_b[0] = 0xBB;"
+      "u8_a[0]");
+  CHECK_EQ(0xBB, result->Int32Value(env.local()).FromJust());
   result = CompileRun("u8_b[1]");
-  CHECK_EQ(0xFF, result->Int32Value());
+  CHECK_EQ(0xFF, result->Int32Value(env.local()).FromJust());
 
   CHECK_EQ(2, static_cast<int>(ab1_contents.ByteLength()));
   uint8_t* ab1_data = static_cast<uint8_t*>(ab1_contents.Data());
@@ -3423,7 +3106,7 @@
   ab1_data[0] = 0xCC;
   ab1_data[1] = 0x11;
   result = CompileRun("u8_a[0] + u8_a[1]");
-  CHECK_EQ(0xDD, result->Int32Value());
+  CHECK_EQ(0xDD, result->Int32Value(env.local()).FromJust());
 }
 
 
@@ -3440,22 +3123,23 @@
   CHECK_EQ(100, static_cast<int>(ab3->ByteLength()));
   CHECK(ab3->IsExternal());
 
-  env->Global()->Set(v8_str("ab3"), ab3);
+  CHECK(env->Global()->Set(env.local(), v8_str("ab3"), ab3).FromJust());
 
-  v8::Handle<v8::Value> result = CompileRun("ab3.byteLength");
-  CHECK_EQ(100, result->Int32Value());
+  v8::Local<v8::Value> result = CompileRun("ab3.byteLength");
+  CHECK_EQ(100, result->Int32Value(env.local()).FromJust());
 
-  result = CompileRun("var u8_b = new Uint8Array(ab3);"
-                      "u8_b[0] = 0xBB;"
-                      "u8_b[1] = 0xCC;"
-                      "u8_b.length");
-  CHECK_EQ(100, result->Int32Value());
+  result = CompileRun(
+      "var u8_b = new Uint8Array(ab3);"
+      "u8_b[0] = 0xBB;"
+      "u8_b[1] = 0xCC;"
+      "u8_b.length");
+  CHECK_EQ(100, result->Int32Value(env.local()).FromJust());
   CHECK_EQ(0xBB, my_data[0]);
   CHECK_EQ(0xCC, my_data[1]);
   my_data[0] = 0xCC;
   my_data[1] = 0x11;
   result = CompileRun("u8_b[0] + u8_b[1]");
-  CHECK_EQ(0xDD, result->Int32Value());
+  CHECK_EQ(0xDD, result->Int32Value(env.local()).FromJust());
 }
 
 
@@ -3477,13 +3161,13 @@
 }
 
 
-static void CheckDataViewIsNeutered(v8::Handle<v8::DataView> dv) {
+static void CheckDataViewIsNeutered(v8::Local<v8::DataView> dv) {
   CHECK_EQ(0, static_cast<int>(dv->ByteLength()));
   CHECK_EQ(0, static_cast<int>(dv->ByteOffset()));
 }
 
 
-static void CheckIsNeutered(v8::Handle<v8::TypedArray> ta) {
+static void CheckIsNeutered(v8::Local<v8::TypedArray> ta) {
   CHECK_EQ(0, static_cast<int>(ta->ByteLength()));
   CHECK_EQ(0, static_cast<int>(ta->Length()));
   CHECK_EQ(0, static_cast<int>(ta->ByteOffset()));
@@ -3493,20 +3177,19 @@
 static void CheckIsTypedArrayVarNeutered(const char* name) {
   i::ScopedVector<char> source(1024);
   i::SNPrintF(source,
-      "%s.byteLength == 0 && %s.byteOffset == 0 && %s.length == 0",
-      name, name, name);
+              "%s.byteLength == 0 && %s.byteOffset == 0 && %s.length == 0",
+              name, name, name);
   CHECK(CompileRun(source.start())->IsTrue());
-  v8::Handle<v8::TypedArray> ta =
-    v8::Handle<v8::TypedArray>::Cast(CompileRun(name));
+  v8::Local<v8::TypedArray> ta =
+      v8::Local<v8::TypedArray>::Cast(CompileRun(name));
   CheckIsNeutered(ta);
 }
 
 
 template <typename TypedArray, int kElementSize>
-static Handle<TypedArray> CreateAndCheck(Handle<v8::ArrayBuffer> ab,
-                                         int byteOffset,
-                                         int length) {
-  v8::Handle<TypedArray> ta = TypedArray::New(ab, byteOffset, length);
+static Local<TypedArray> CreateAndCheck(Local<v8::ArrayBuffer> ab,
+                                        int byteOffset, int length) {
+  v8::Local<TypedArray> ta = TypedArray::New(ab, byteOffset, length);
   CheckInternalFieldsAreZero<v8::ArrayBufferView>(ta);
   CHECK_EQ(byteOffset, static_cast<int>(ta->ByteOffset()));
   CHECK_EQ(length, static_cast<int>(ta->Length()));
@@ -3520,31 +3203,31 @@
   v8::Isolate* isolate = env->GetIsolate();
   v8::HandleScope handle_scope(isolate);
 
-  v8::Handle<v8::ArrayBuffer> buffer = v8::ArrayBuffer::New(isolate, 1024);
+  v8::Local<v8::ArrayBuffer> buffer = v8::ArrayBuffer::New(isolate, 1024);
 
-  v8::Handle<v8::Uint8Array> u8a =
-    CreateAndCheck<v8::Uint8Array, 1>(buffer, 1, 1023);
-  v8::Handle<v8::Uint8ClampedArray> u8c =
-    CreateAndCheck<v8::Uint8ClampedArray, 1>(buffer, 1, 1023);
-  v8::Handle<v8::Int8Array> i8a =
-    CreateAndCheck<v8::Int8Array, 1>(buffer, 1, 1023);
+  v8::Local<v8::Uint8Array> u8a =
+      CreateAndCheck<v8::Uint8Array, 1>(buffer, 1, 1023);
+  v8::Local<v8::Uint8ClampedArray> u8c =
+      CreateAndCheck<v8::Uint8ClampedArray, 1>(buffer, 1, 1023);
+  v8::Local<v8::Int8Array> i8a =
+      CreateAndCheck<v8::Int8Array, 1>(buffer, 1, 1023);
 
-  v8::Handle<v8::Uint16Array> u16a =
-    CreateAndCheck<v8::Uint16Array, 2>(buffer, 2, 511);
-  v8::Handle<v8::Int16Array> i16a =
-    CreateAndCheck<v8::Int16Array, 2>(buffer, 2, 511);
+  v8::Local<v8::Uint16Array> u16a =
+      CreateAndCheck<v8::Uint16Array, 2>(buffer, 2, 511);
+  v8::Local<v8::Int16Array> i16a =
+      CreateAndCheck<v8::Int16Array, 2>(buffer, 2, 511);
 
-  v8::Handle<v8::Uint32Array> u32a =
-    CreateAndCheck<v8::Uint32Array, 4>(buffer, 4, 255);
-  v8::Handle<v8::Int32Array> i32a =
-    CreateAndCheck<v8::Int32Array, 4>(buffer, 4, 255);
+  v8::Local<v8::Uint32Array> u32a =
+      CreateAndCheck<v8::Uint32Array, 4>(buffer, 4, 255);
+  v8::Local<v8::Int32Array> i32a =
+      CreateAndCheck<v8::Int32Array, 4>(buffer, 4, 255);
 
-  v8::Handle<v8::Float32Array> f32a =
-    CreateAndCheck<v8::Float32Array, 4>(buffer, 4, 255);
-  v8::Handle<v8::Float64Array> f64a =
-    CreateAndCheck<v8::Float64Array, 8>(buffer, 8, 127);
+  v8::Local<v8::Float32Array> f32a =
+      CreateAndCheck<v8::Float32Array, 4>(buffer, 4, 255);
+  v8::Local<v8::Float64Array> f64a =
+      CreateAndCheck<v8::Float64Array, 8>(buffer, 8, 127);
 
-  v8::Handle<v8::DataView> dv = v8::DataView::New(buffer, 1, 1023);
+  v8::Local<v8::DataView> dv = v8::DataView::New(buffer, 1, 1023);
   CheckInternalFieldsAreZero<v8::ArrayBufferView>(dv);
   CHECK_EQ(1, static_cast<int>(dv->ByteOffset()));
   CHECK_EQ(1023, static_cast<int>(dv->ByteLength()));
@@ -3583,16 +3266,15 @@
       "var f64a = new Float64Array(ab, 8, 127);"
       "var dv = new DataView(ab, 1, 1023);");
 
-  v8::Handle<v8::ArrayBuffer> ab =
+  v8::Local<v8::ArrayBuffer> ab =
       Local<v8::ArrayBuffer>::Cast(CompileRun("ab"));
 
-  v8::Handle<v8::DataView> dv =
-    v8::Handle<v8::DataView>::Cast(CompileRun("dv"));
+  v8::Local<v8::DataView> dv = v8::Local<v8::DataView>::Cast(CompileRun("dv"));
 
   ScopedArrayBufferContents contents(ab->Externalize());
   ab->Neuter();
   CHECK_EQ(0, static_cast<int>(ab->ByteLength()));
-  CHECK_EQ(0, CompileRun("ab.byteLength")->Int32Value());
+  CHECK_EQ(0, v8_run_int32value(v8_compile("ab.byteLength")));
 
   CheckIsTypedArrayVarNeutered("u8a");
   CheckIsTypedArrayVarNeutered("u8c");
@@ -3609,6 +3291,135 @@
 }
 
 
+class ScopedSharedArrayBufferContents {
+ public:
+  explicit ScopedSharedArrayBufferContents(
+      const v8::SharedArrayBuffer::Contents& contents)
+      : contents_(contents) {}
+  ~ScopedSharedArrayBufferContents() { free(contents_.Data()); }
+  void* Data() const { return contents_.Data(); }
+  size_t ByteLength() const { return contents_.ByteLength(); }
+
+ private:
+  const v8::SharedArrayBuffer::Contents contents_;
+};
+
+
+THREADED_TEST(SharedArrayBuffer_ApiInternalToExternal) {
+  i::FLAG_harmony_sharedarraybuffer = true;
+  LocalContext env;
+  v8::Isolate* isolate = env->GetIsolate();
+  v8::HandleScope handle_scope(isolate);
+
+  Local<v8::SharedArrayBuffer> ab = v8::SharedArrayBuffer::New(isolate, 1024);
+  CheckInternalFieldsAreZero(ab);
+  CHECK_EQ(1024, static_cast<int>(ab->ByteLength()));
+  CHECK(!ab->IsExternal());
+  CcTest::heap()->CollectAllGarbage();
+
+  ScopedSharedArrayBufferContents ab_contents(ab->Externalize());
+  CHECK(ab->IsExternal());
+
+  CHECK_EQ(1024, static_cast<int>(ab_contents.ByteLength()));
+  uint8_t* data = static_cast<uint8_t*>(ab_contents.Data());
+  CHECK(data != NULL);
+  CHECK(env->Global()->Set(env.local(), v8_str("ab"), ab).FromJust());
+
+  v8::Local<v8::Value> result = CompileRun("ab.byteLength");
+  CHECK_EQ(1024, result->Int32Value(env.local()).FromJust());
+
+  result = CompileRun(
+      "var u8 = new Uint8Array(ab);"
+      "u8[0] = 0xFF;"
+      "u8[1] = 0xAA;"
+      "u8.length");
+  CHECK_EQ(1024, result->Int32Value(env.local()).FromJust());
+  CHECK_EQ(0xFF, data[0]);
+  CHECK_EQ(0xAA, data[1]);
+  data[0] = 0xCC;
+  data[1] = 0x11;
+  result = CompileRun("u8[0] + u8[1]");
+  CHECK_EQ(0xDD, result->Int32Value(env.local()).FromJust());
+}
+
+
+THREADED_TEST(SharedArrayBuffer_JSInternalToExternal) {
+  i::FLAG_harmony_sharedarraybuffer = true;
+  LocalContext env;
+  v8::Isolate* isolate = env->GetIsolate();
+  v8::HandleScope handle_scope(isolate);
+
+
+  v8::Local<v8::Value> result = CompileRun(
+      "var ab1 = new SharedArrayBuffer(2);"
+      "var u8_a = new Uint8Array(ab1);"
+      "u8_a[0] = 0xAA;"
+      "u8_a[1] = 0xFF; u8_a.buffer");
+  Local<v8::SharedArrayBuffer> ab1 = Local<v8::SharedArrayBuffer>::Cast(result);
+  CheckInternalFieldsAreZero(ab1);
+  CHECK_EQ(2, static_cast<int>(ab1->ByteLength()));
+  CHECK(!ab1->IsExternal());
+  ScopedSharedArrayBufferContents ab1_contents(ab1->Externalize());
+  CHECK(ab1->IsExternal());
+
+  result = CompileRun("ab1.byteLength");
+  CHECK_EQ(2, result->Int32Value(env.local()).FromJust());
+  result = CompileRun("u8_a[0]");
+  CHECK_EQ(0xAA, result->Int32Value(env.local()).FromJust());
+  result = CompileRun("u8_a[1]");
+  CHECK_EQ(0xFF, result->Int32Value(env.local()).FromJust());
+  result = CompileRun(
+      "var u8_b = new Uint8Array(ab1);"
+      "u8_b[0] = 0xBB;"
+      "u8_a[0]");
+  CHECK_EQ(0xBB, result->Int32Value(env.local()).FromJust());
+  result = CompileRun("u8_b[1]");
+  CHECK_EQ(0xFF, result->Int32Value(env.local()).FromJust());
+
+  CHECK_EQ(2, static_cast<int>(ab1_contents.ByteLength()));
+  uint8_t* ab1_data = static_cast<uint8_t*>(ab1_contents.Data());
+  CHECK_EQ(0xBB, ab1_data[0]);
+  CHECK_EQ(0xFF, ab1_data[1]);
+  ab1_data[0] = 0xCC;
+  ab1_data[1] = 0x11;
+  result = CompileRun("u8_a[0] + u8_a[1]");
+  CHECK_EQ(0xDD, result->Int32Value(env.local()).FromJust());
+}
+
+
+THREADED_TEST(SharedArrayBuffer_External) {
+  i::FLAG_harmony_sharedarraybuffer = true;
+  LocalContext env;
+  v8::Isolate* isolate = env->GetIsolate();
+  v8::HandleScope handle_scope(isolate);
+
+  i::ScopedVector<uint8_t> my_data(100);
+  memset(my_data.start(), 0, 100);
+  Local<v8::SharedArrayBuffer> ab3 =
+      v8::SharedArrayBuffer::New(isolate, my_data.start(), 100);
+  CheckInternalFieldsAreZero(ab3);
+  CHECK_EQ(100, static_cast<int>(ab3->ByteLength()));
+  CHECK(ab3->IsExternal());
+
+  CHECK(env->Global()->Set(env.local(), v8_str("ab3"), ab3).FromJust());
+
+  v8::Local<v8::Value> result = CompileRun("ab3.byteLength");
+  CHECK_EQ(100, result->Int32Value(env.local()).FromJust());
+
+  result = CompileRun(
+      "var u8_b = new Uint8Array(ab3);"
+      "u8_b[0] = 0xBB;"
+      "u8_b[1] = 0xCC;"
+      "u8_b.length");
+  CHECK_EQ(100, result->Int32Value(env.local()).FromJust());
+  CHECK_EQ(0xBB, my_data[0]);
+  CHECK_EQ(0xCC, my_data[1]);
+  my_data[0] = 0xCC;
+  my_data[1] = 0x11;
+  result = CompileRun("u8_b[0] + u8_b[1]");
+  CHECK_EQ(0xDD, result->Int32Value(env.local()).FromJust());
+}
+
 
 THREADED_TEST(HiddenProperties) {
   LocalContext env;
@@ -3616,50 +3427,83 @@
   v8::HandleScope scope(isolate);
 
   v8::Local<v8::Object> obj = v8::Object::New(env->GetIsolate());
-  v8::Local<v8::String> key = v8_str("api-test::hidden-key");
+  v8::Local<v8::Private> key =
+      v8::Private::ForApi(isolate, v8_str("api-test::hidden-key"));
   v8::Local<v8::String> empty = v8_str("");
   v8::Local<v8::String> prop_name = v8_str("prop_name");
 
-  CcTest::heap()->CollectAllGarbage(i::Heap::kNoGCFlags);
+  CcTest::heap()->CollectAllGarbage();
 
   // Make sure delete of a non-existent hidden value works
-  CHECK(obj->DeleteHiddenValue(key));
+  obj->DeletePrivate(env.local(), key).FromJust();
 
-  CHECK(obj->SetHiddenValue(key, v8::Integer::New(isolate, 1503)));
-  CHECK_EQ(1503, obj->GetHiddenValue(key)->Int32Value());
-  CHECK(obj->SetHiddenValue(key, v8::Integer::New(isolate, 2002)));
-  CHECK_EQ(2002, obj->GetHiddenValue(key)->Int32Value());
+  CHECK(obj->SetPrivate(env.local(), key, v8::Integer::New(isolate, 1503))
+            .FromJust());
+  CHECK_EQ(1503, obj->GetPrivate(env.local(), key)
+                     .ToLocalChecked()
+                     ->Int32Value(env.local())
+                     .FromJust());
+  CHECK(obj->SetPrivate(env.local(), key, v8::Integer::New(isolate, 2002))
+            .FromJust());
+  CHECK_EQ(2002, obj->GetPrivate(env.local(), key)
+                     .ToLocalChecked()
+                     ->Int32Value(env.local())
+                     .FromJust());
 
-  CcTest::heap()->CollectAllGarbage(i::Heap::kNoGCFlags);
+  CcTest::heap()->CollectAllGarbage();
 
   // Make sure we do not find the hidden property.
-  CHECK(!obj->Has(empty));
-  CHECK_EQ(2002, obj->GetHiddenValue(key)->Int32Value());
-  CHECK(obj->Get(empty)->IsUndefined());
-  CHECK_EQ(2002, obj->GetHiddenValue(key)->Int32Value());
-  CHECK(obj->Set(empty, v8::Integer::New(isolate, 2003)));
-  CHECK_EQ(2002, obj->GetHiddenValue(key)->Int32Value());
-  CHECK_EQ(2003, obj->Get(empty)->Int32Value());
+  CHECK(!obj->Has(env.local(), empty).FromJust());
+  CHECK_EQ(2002, obj->GetPrivate(env.local(), key)
+                     .ToLocalChecked()
+                     ->Int32Value(env.local())
+                     .FromJust());
+  CHECK(obj->Get(env.local(), empty).ToLocalChecked()->IsUndefined());
+  CHECK_EQ(2002, obj->GetPrivate(env.local(), key)
+                     .ToLocalChecked()
+                     ->Int32Value(env.local())
+                     .FromJust());
+  CHECK(
+      obj->Set(env.local(), empty, v8::Integer::New(isolate, 2003)).FromJust());
+  CHECK_EQ(2002, obj->GetPrivate(env.local(), key)
+                     .ToLocalChecked()
+                     ->Int32Value(env.local())
+                     .FromJust());
+  CHECK_EQ(2003, obj->Get(env.local(), empty)
+                     .ToLocalChecked()
+                     ->Int32Value(env.local())
+                     .FromJust());
 
-  CcTest::heap()->CollectAllGarbage(i::Heap::kNoGCFlags);
+  CcTest::heap()->CollectAllGarbage();
 
   // Add another property and delete it afterwards to force the object in
   // slow case.
-  CHECK(obj->Set(prop_name, v8::Integer::New(isolate, 2008)));
-  CHECK_EQ(2002, obj->GetHiddenValue(key)->Int32Value());
-  CHECK_EQ(2008, obj->Get(prop_name)->Int32Value());
-  CHECK_EQ(2002, obj->GetHiddenValue(key)->Int32Value());
-  CHECK(obj->Delete(prop_name));
-  CHECK_EQ(2002, obj->GetHiddenValue(key)->Int32Value());
+  CHECK(obj->Set(env.local(), prop_name, v8::Integer::New(isolate, 2008))
+            .FromJust());
+  CHECK_EQ(2002, obj->GetPrivate(env.local(), key)
+                     .ToLocalChecked()
+                     ->Int32Value(env.local())
+                     .FromJust());
+  CHECK_EQ(2008, obj->Get(env.local(), prop_name)
+                     .ToLocalChecked()
+                     ->Int32Value(env.local())
+                     .FromJust());
+  CHECK_EQ(2002, obj->GetPrivate(env.local(), key)
+                     .ToLocalChecked()
+                     ->Int32Value(env.local())
+                     .FromJust());
+  CHECK(obj->Delete(env.local(), prop_name).FromJust());
+  CHECK_EQ(2002, obj->GetPrivate(env.local(), key)
+                     .ToLocalChecked()
+                     ->Int32Value(env.local())
+                     .FromJust());
 
-  CcTest::heap()->CollectAllGarbage(i::Heap::kNoGCFlags);
+  CcTest::heap()->CollectAllGarbage();
 
-  CHECK(obj->SetHiddenValue(key, Handle<Value>()));
-  CHECK(obj->GetHiddenValue(key).IsEmpty());
-
-  CHECK(obj->SetHiddenValue(key, v8::Integer::New(isolate, 2002)));
-  CHECK(obj->DeleteHiddenValue(key));
-  CHECK(obj->GetHiddenValue(key).IsEmpty());
+  CHECK(obj->SetPrivate(env.local(), key, v8::Integer::New(isolate, 2002))
+            .FromJust());
+  CHECK(obj->DeletePrivate(env.local(), key).FromJust());
+  CHECK(!obj->HasPrivate(env.local(), key).FromJust());
 }
 
 
@@ -3671,7 +3515,8 @@
   v8::HandleScope scope(env->GetIsolate());
 
   v8::Local<v8::Object> obj = v8::Object::New(env->GetIsolate());
-  v8::Local<v8::String> key = v8_str("hidden");
+  v8::Local<v8::Private> key =
+      v8::Private::New(env->GetIsolate(), v8_str("hidden"));
 
   CompileRun(
       "set_called = false;"
@@ -3681,42 +3526,18 @@
       "    {get: function() { return 45; },"
       "     set: function() { set_called = true; }})");
 
-  CHECK(obj->GetHiddenValue(key).IsEmpty());
+  CHECK(!obj->HasPrivate(env.local(), key).FromJust());
   // Make sure that the getter and setter from Object.prototype is not invoked.
   // If it did we would have full access to the hidden properties in
   // the accessor.
-  CHECK(obj->SetHiddenValue(key, v8::Integer::New(env->GetIsolate(), 42)));
+  CHECK(
+      obj->SetPrivate(env.local(), key, v8::Integer::New(env->GetIsolate(), 42))
+          .FromJust());
   ExpectFalse("set_called");
-  CHECK_EQ(42, obj->GetHiddenValue(key)->Int32Value());
-}
-
-
-static bool interceptor_for_hidden_properties_called;
-static void InterceptorForHiddenProperties(
-    Local<Name> name, const v8::PropertyCallbackInfo<v8::Value>& info) {
-  interceptor_for_hidden_properties_called = true;
-}
-
-
-THREADED_TEST(HiddenPropertiesWithInterceptors) {
-  LocalContext context;
-  v8::Isolate* isolate = context->GetIsolate();
-  v8::HandleScope scope(isolate);
-
-  interceptor_for_hidden_properties_called = false;
-
-  v8::Local<v8::String> key = v8_str("api-test::hidden-key");
-
-  // Associate an interceptor with an object and start setting hidden values.
-  Local<v8::FunctionTemplate> fun_templ = v8::FunctionTemplate::New(isolate);
-  Local<v8::ObjectTemplate> instance_templ = fun_templ->InstanceTemplate();
-  instance_templ->SetHandler(
-      v8::NamedPropertyHandlerConfiguration(InterceptorForHiddenProperties));
-  Local<v8::Function> function = fun_templ->GetFunction();
-  Local<v8::Object> obj = function->NewInstance();
-  CHECK(obj->SetHiddenValue(key, v8::Integer::New(isolate, 2302)));
-  CHECK_EQ(2302, obj->GetHiddenValue(key)->Int32Value());
-  CHECK(!interceptor_for_hidden_properties_called);
+  CHECK_EQ(42, obj->GetPrivate(env.local(), key)
+                   .ToLocalChecked()
+                   ->Int32Value(env.local())
+                   .FromJust());
 }
 
 
@@ -3725,9 +3546,9 @@
   int x = 3;
   Local<v8::External> ext = v8::External::New(CcTest::isolate(), &x);
   LocalContext env;
-  env->Global()->Set(v8_str("ext"), ext);
+  CHECK(env->Global()->Set(env.local(), v8_str("ext"), ext).FromJust());
   Local<Value> reext_obj = CompileRun("this.ext");
-  v8::Handle<v8::External> reext = reext_obj.As<v8::External>();
+  v8::Local<v8::External> reext = reext_obj.As<v8::External>();
   int* ptr = static_cast<int*>(reext->Value());
   CHECK_EQ(x, 3);
   *ptr = 10;
@@ -3828,21 +3649,21 @@
 }
 
 
-template<class T>
-static v8::UniquePersistent<T> PassUnique(v8::UniquePersistent<T> unique) {
+template <class T>
+static v8::Global<T> PassUnique(v8::Global<T> unique) {
   return unique.Pass();
 }
 
 
-template<class T>
-static v8::UniquePersistent<T> ReturnUnique(v8::Isolate* isolate,
-                                            const v8::Persistent<T> & global) {
-  v8::UniquePersistent<String> unique(isolate, global);
+template <class T>
+static v8::Global<T> ReturnUnique(v8::Isolate* isolate,
+                                  const v8::Persistent<T>& global) {
+  v8::Global<String> unique(isolate, global);
   return unique.Pass();
 }
 
 
-THREADED_TEST(UniquePersistent) {
+THREADED_TEST(Global) {
   v8::Isolate* isolate = CcTest::isolate();
   v8::Persistent<String> global;
   {
@@ -3853,11 +3674,11 @@
       reinterpret_cast<v8::internal::Isolate*>(isolate)->global_handles();
   int initial_handle_count = global_handles->global_handles_count();
   {
-    v8::UniquePersistent<String> unique(isolate, global);
+    v8::Global<String> unique(isolate, global);
     CHECK_EQ(initial_handle_count + 1, global_handles->global_handles_count());
     // Test assignment via Pass
     {
-      v8::UniquePersistent<String> copy = unique.Pass();
+      v8::Global<String> copy = unique.Pass();
       CHECK(unique.IsEmpty());
       CHECK(copy == global);
       CHECK_EQ(initial_handle_count + 1,
@@ -3866,7 +3687,7 @@
     }
     // Test ctor via Pass
     {
-      v8::UniquePersistent<String> copy(unique.Pass());
+      v8::Global<String> copy(unique.Pass());
       CHECK(unique.IsEmpty());
       CHECK(copy == global);
       CHECK_EQ(initial_handle_count + 1,
@@ -3875,7 +3696,7 @@
     }
     // Test pass through function call
     {
-      v8::UniquePersistent<String> copy = PassUnique(unique.Pass());
+      v8::Global<String> copy = PassUnique(unique.Pass());
       CHECK(unique.IsEmpty());
       CHECK(copy == global);
       CHECK_EQ(initial_handle_count + 1,
@@ -3886,7 +3707,7 @@
   }
   // Test pass from function call
   {
-    v8::UniquePersistent<String> unique = ReturnUnique(isolate, global);
+    v8::Global<String> unique = ReturnUnique(isolate, global);
     CHECK(unique == global);
     CHECK_EQ(initial_handle_count + 1, global_handles->global_handles_count());
   }
@@ -3895,43 +3716,192 @@
 }
 
 
-template<typename K, typename V>
-class WeakStdMapTraits : public v8::StdMapTraits<K, V> {
+namespace {
+
+class TwoPassCallbackData;
+void FirstPassCallback(const v8::WeakCallbackInfo<TwoPassCallbackData>& data);
+void SecondPassCallback(const v8::WeakCallbackInfo<TwoPassCallbackData>& data);
+
+
+class TwoPassCallbackData {
  public:
-  typedef typename v8::PersistentValueMap<K, V, WeakStdMapTraits<K, V> >
-      MapType;
-  static const v8::PersistentContainerCallbackType kCallbackType = v8::kWeak;
+  TwoPassCallbackData(v8::Isolate* isolate, int* instance_counter)
+      : first_pass_called_(false),
+        second_pass_called_(false),
+        trigger_gc_(false),
+        instance_counter_(instance_counter) {
+    HandleScope scope(isolate);
+    i::ScopedVector<char> buffer(40);
+    i::SNPrintF(buffer, "%p", static_cast<void*>(this));
+    auto string =
+        v8::String::NewFromUtf8(isolate, buffer.start(),
+                                v8::NewStringType::kNormal).ToLocalChecked();
+    cell_.Reset(isolate, string);
+    (*instance_counter_)++;
+  }
+
+  ~TwoPassCallbackData() {
+    CHECK(first_pass_called_);
+    CHECK(second_pass_called_);
+    CHECK(cell_.IsEmpty());
+    (*instance_counter_)--;
+  }
+
+  void FirstPass() {
+    CHECK(!first_pass_called_);
+    CHECK(!second_pass_called_);
+    CHECK(!cell_.IsEmpty());
+    cell_.Reset();
+    first_pass_called_ = true;
+  }
+
+  void SecondPass() {
+    CHECK(first_pass_called_);
+    CHECK(!second_pass_called_);
+    CHECK(cell_.IsEmpty());
+    second_pass_called_ = true;
+    delete this;
+  }
+
+  void SetWeak() {
+    cell_.SetWeak(this, FirstPassCallback, v8::WeakCallbackType::kParameter);
+  }
+
+  void MarkTriggerGc() { trigger_gc_ = true; }
+  bool trigger_gc() { return trigger_gc_; }
+
+  int* instance_counter() { return instance_counter_; }
+
+ private:
+  bool first_pass_called_;
+  bool second_pass_called_;
+  bool trigger_gc_;
+  v8::Global<v8::String> cell_;
+  int* instance_counter_;
+};
+
+
+void SecondPassCallback(const v8::WeakCallbackInfo<TwoPassCallbackData>& data) {
+  ApiTestFuzzer::Fuzz();
+  bool trigger_gc = data.GetParameter()->trigger_gc();
+  int* instance_counter = data.GetParameter()->instance_counter();
+  data.GetParameter()->SecondPass();
+  if (!trigger_gc) return;
+  auto data_2 = new TwoPassCallbackData(data.GetIsolate(), instance_counter);
+  data_2->SetWeak();
+  CcTest::heap()->CollectAllGarbage();
+}
+
+
+void FirstPassCallback(const v8::WeakCallbackInfo<TwoPassCallbackData>& data) {
+  data.GetParameter()->FirstPass();
+  data.SetSecondPassCallback(SecondPassCallback);
+}
+
+}  // namespace
+
+
+TEST(TwoPassPhantomCallbacks) {
+  auto isolate = CcTest::isolate();
+  const size_t kLength = 20;
+  int instance_counter = 0;
+  for (size_t i = 0; i < kLength; ++i) {
+    auto data = new TwoPassCallbackData(isolate, &instance_counter);
+    data->SetWeak();
+  }
+  CHECK_EQ(static_cast<int>(kLength), instance_counter);
+  CcTest::heap()->CollectAllGarbage();
+  EmptyMessageQueues(isolate);
+  CHECK_EQ(0, instance_counter);
+}
+
+
+TEST(TwoPassPhantomCallbacksNestedGc) {
+  auto isolate = CcTest::isolate();
+  const size_t kLength = 20;
+  TwoPassCallbackData* array[kLength];
+  int instance_counter = 0;
+  for (size_t i = 0; i < kLength; ++i) {
+    array[i] = new TwoPassCallbackData(isolate, &instance_counter);
+    array[i]->SetWeak();
+  }
+  array[5]->MarkTriggerGc();
+  array[10]->MarkTriggerGc();
+  array[15]->MarkTriggerGc();
+  CHECK_EQ(static_cast<int>(kLength), instance_counter);
+  CcTest::heap()->CollectAllGarbage();
+  EmptyMessageQueues(isolate);
+  CHECK_EQ(0, instance_counter);
+}
+
+
+namespace {
+
+void* IntKeyToVoidPointer(int key) { return reinterpret_cast<void*>(key << 1); }
+
+
+Local<v8::Object> NewObjectForIntKey(
+    v8::Isolate* isolate, const v8::Global<v8::ObjectTemplate>& templ,
+    int key) {
+  auto local = Local<v8::ObjectTemplate>::New(isolate, templ);
+  auto obj = local->NewInstance(isolate->GetCurrentContext()).ToLocalChecked();
+  obj->SetAlignedPointerInInternalField(0, IntKeyToVoidPointer(key));
+  return obj;
+}
+
+
+template <typename K, typename V>
+class PhantomStdMapTraits : public v8::StdMapTraits<K, V> {
+ public:
+  typedef typename v8::GlobalValueMap<K, V, PhantomStdMapTraits<K, V>> MapType;
+  static const v8::PersistentContainerCallbackType kCallbackType =
+      v8::kWeakWithInternalFields;
   struct WeakCallbackDataType {
     MapType* map;
     K key;
   };
-  static WeakCallbackDataType* WeakCallbackParameter(
-      MapType* map, const K& key, Local<V> value) {
+  static WeakCallbackDataType* WeakCallbackParameter(MapType* map, const K& key,
+                                                     Local<V> value) {
     WeakCallbackDataType* data = new WeakCallbackDataType;
     data->map = map;
     data->key = key;
     return data;
   }
-  static MapType* MapFromWeakCallbackData(
-      const v8::WeakCallbackData<V, WeakCallbackDataType>& data) {
+  static MapType* MapFromWeakCallbackInfo(
+      const v8::WeakCallbackInfo<WeakCallbackDataType>& data) {
     return data.GetParameter()->map;
   }
-  static K KeyFromWeakCallbackData(
-      const v8::WeakCallbackData<V, WeakCallbackDataType>& data) {
+  static K KeyFromWeakCallbackInfo(
+      const v8::WeakCallbackInfo<WeakCallbackDataType>& data) {
     return data.GetParameter()->key;
   }
-  static void DisposeCallbackData(WeakCallbackDataType* data) {
-    delete data;
+  static void DisposeCallbackData(WeakCallbackDataType* data) { delete data; }
+  static void Dispose(v8::Isolate* isolate, v8::Global<V> value, K key) {
+    CHECK_EQ(IntKeyToVoidPointer(key),
+             v8::Object::GetAlignedPointerFromInternalField(value, 0));
   }
-  static void Dispose(v8::Isolate* isolate, v8::UniquePersistent<V> value,
-      K key) { }
+  static void OnWeakCallback(
+      const v8::WeakCallbackInfo<WeakCallbackDataType>&) {}
+  static void DisposeWeak(
+      const v8::WeakCallbackInfo<WeakCallbackDataType>& info) {
+    K key = KeyFromWeakCallbackInfo(info);
+    CHECK_EQ(IntKeyToVoidPointer(key), info.GetInternalField(0));
+    DisposeCallbackData(info.GetParameter());
+  }
 };
 
 
-template<typename Map>
-static void TestPersistentValueMap() {
+template <typename Map>
+void TestGlobalValueMap() {
   LocalContext env;
   v8::Isolate* isolate = env->GetIsolate();
+  v8::Global<ObjectTemplate> templ;
+  {
+    HandleScope scope(isolate);
+    auto t = ObjectTemplate::New(isolate);
+    t->SetInternalFieldCount(1);
+    templ.Reset(isolate, t);
+  }
   Map map(isolate);
   v8::internal::GlobalHandles* global_handles =
       reinterpret_cast<v8::internal::Isolate*>(isolate)->global_handles();
@@ -3945,12 +3915,12 @@
     map.Set(7, expected);
     CHECK_EQ(1, static_cast<int>(map.Size()));
     obj = map.Get(7);
-    CHECK_EQ(expected, obj);
+    CHECK(expected->Equals(env.local(), obj).FromJust());
     {
       typename Map::PersistentValueReference ref = map.GetReference(7);
-      CHECK_EQ(expected, ref.NewLocal(isolate));
+      CHECK(expected->Equals(env.local(), ref.NewLocal(isolate)).FromJust());
     }
-    v8::UniquePersistent<v8::Object> removed = map.Remove(7);
+    v8::Global<v8::Object> removed = map.Remove(7);
     CHECK_EQ(0, static_cast<int>(map.Size()));
     CHECK(expected == removed);
     removed = map.Remove(7);
@@ -3961,34 +3931,43 @@
     CHECK_EQ(1, static_cast<int>(map.Size()));
     {
       typename Map::PersistentValueReference ref;
-      Local<v8::Object> expected2 = v8::Object::New(isolate);
-      removed = map.Set(8,
-          v8::UniquePersistent<v8::Object>(isolate, expected2), &ref);
+      Local<v8::Object> expected2 = NewObjectForIntKey(isolate, templ, 8);
+      removed = map.Set(8, v8::Global<v8::Object>(isolate, expected2), &ref);
       CHECK_EQ(1, static_cast<int>(map.Size()));
       CHECK(expected == removed);
-      CHECK_EQ(expected2, ref.NewLocal(isolate));
+      CHECK(expected2->Equals(env.local(), ref.NewLocal(isolate)).FromJust());
     }
   }
   CHECK_EQ(initial_handle_count + 1, global_handles->global_handles_count());
   if (map.IsWeak()) {
-    reinterpret_cast<v8::internal::Isolate*>(isolate)->heap()->
-        CollectAllGarbage(i::Heap::kAbortIncrementalMarkingMask);
+    CcTest::i_isolate()->heap()->CollectAllGarbage(
+        i::Heap::kAbortIncrementalMarkingMask);
   } else {
     map.Clear();
   }
   CHECK_EQ(0, static_cast<int>(map.Size()));
   CHECK_EQ(initial_handle_count, global_handles->global_handles_count());
+  {
+    HandleScope scope(isolate);
+    Local<v8::Object> value = NewObjectForIntKey(isolate, templ, 9);
+    map.Set(9, value);
+    map.Clear();
+  }
+  CHECK_EQ(0, static_cast<int>(map.Size()));
+  CHECK_EQ(initial_handle_count, global_handles->global_handles_count());
 }
 
+}  // namespace
 
-TEST(PersistentValueMap) {
+
+TEST(GlobalValueMap) {
   // Default case, w/o weak callbacks:
-  TestPersistentValueMap<v8::StdPersistentValueMap<int, v8::Object> >();
+  TestGlobalValueMap<v8::StdGlobalValueMap<int, v8::Object>>();
 
   // Custom traits with weak callbacks:
-  typedef v8::PersistentValueMap<int, v8::Object,
-      WeakStdMapTraits<int, v8::Object> > WeakPersistentValueMap;
-  TestPersistentValueMap<WeakPersistentValueMap>();
+  typedef v8::GlobalValueMap<int, v8::Object,
+                             PhantomStdMapTraits<int, v8::Object>> WeakMap;
+  TestGlobalValueMap<WeakMap>();
 }
 
 
@@ -4004,7 +3983,7 @@
 
   Local<v8::Object> obj1 = v8::Object::New(isolate);
   Local<v8::Object> obj2 = v8::Object::New(isolate);
-  v8::UniquePersistent<v8::Object> obj3(isolate, v8::Object::New(isolate));
+  v8::Global<v8::Object> obj3(isolate, v8::Object::New(isolate));
 
   CHECK(vector.IsEmpty());
   CHECK_EQ(0, static_cast<int>(vector.Size()));
@@ -4021,10 +4000,10 @@
   CHECK(!vector.IsEmpty());
   CHECK_EQ(5, static_cast<int>(vector.Size()));
   CHECK(obj3.IsEmpty());
-  CHECK_EQ(obj1, vector.Get(0));
-  CHECK_EQ(obj1, vector.Get(2));
-  CHECK_EQ(obj1, vector.Get(4));
-  CHECK_EQ(obj2, vector.Get(1));
+  CHECK(obj1->Equals(env.local(), vector.Get(0)).FromJust());
+  CHECK(obj1->Equals(env.local(), vector.Get(2)).FromJust());
+  CHECK(obj1->Equals(env.local(), vector.Get(4)).FromJust());
+  CHECK(obj2->Equals(env.local(), vector.Get(1)).FromJust());
 
   CHECK_EQ(5 + handle_count, global_handles->global_handles_count());
 
@@ -4096,17 +4075,18 @@
 
 class WeakCallCounter {
  public:
-  explicit WeakCallCounter(int id) : id_(id), number_of_weak_calls_(0) { }
+  explicit WeakCallCounter(int id) : id_(id), number_of_weak_calls_(0) {}
   int id() { return id_; }
   void increment() { number_of_weak_calls_++; }
   int NumberOfWeakCalls() { return number_of_weak_calls_; }
+
  private:
   int id_;
   int number_of_weak_calls_;
 };
 
 
-template<typename T>
+template <typename T>
 struct WeakCallCounterAndPersistent {
   explicit WeakCallCounterAndPersistent(WeakCallCounter* counter)
       : counter(counter) {}
@@ -4117,14 +4097,14 @@
 
 template <typename T>
 static void WeakPointerCallback(
-    const v8::WeakCallbackData<T, WeakCallCounterAndPersistent<T> >& data) {
+    const v8::WeakCallbackInfo<WeakCallCounterAndPersistent<T>>& data) {
   CHECK_EQ(1234, data.GetParameter()->counter->id());
   data.GetParameter()->counter->increment();
   data.GetParameter()->handle.Reset();
 }
 
 
-template<typename T>
+template <typename T>
 static UniqueId MakeUniqueId(const Persistent<T>& p) {
   return UniqueId(reinterpret_cast<uintptr_t>(*v8::Utils::OpenPersistent(p)));
 }
@@ -4149,16 +4129,22 @@
     g1s1.handle.Reset(iso, Object::New(iso));
     g1s2.handle.Reset(iso, Object::New(iso));
     g1c1.handle.Reset(iso, Object::New(iso));
-    g1s1.handle.SetWeak(&g1s1, &WeakPointerCallback);
-    g1s2.handle.SetWeak(&g1s2, &WeakPointerCallback);
-    g1c1.handle.SetWeak(&g1c1, &WeakPointerCallback);
+    g1s1.handle.SetWeak(&g1s1, &WeakPointerCallback,
+                        v8::WeakCallbackType::kParameter);
+    g1s2.handle.SetWeak(&g1s2, &WeakPointerCallback,
+                        v8::WeakCallbackType::kParameter);
+    g1c1.handle.SetWeak(&g1c1, &WeakPointerCallback,
+                        v8::WeakCallbackType::kParameter);
 
     g2s1.handle.Reset(iso, Object::New(iso));
     g2s2.handle.Reset(iso, Object::New(iso));
     g2c1.handle.Reset(iso, Object::New(iso));
-    g2s1.handle.SetWeak(&g2s1, &WeakPointerCallback);
-    g2s2.handle.SetWeak(&g2s2, &WeakPointerCallback);
-    g2c1.handle.SetWeak(&g2c1, &WeakPointerCallback);
+    g2s1.handle.SetWeak(&g2s1, &WeakPointerCallback,
+                        v8::WeakCallbackType::kParameter);
+    g2s2.handle.SetWeak(&g2s2, &WeakPointerCallback,
+                        v8::WeakCallbackType::kParameter);
+    g2c1.handle.SetWeak(&g2c1, &WeakPointerCallback,
+                        v8::WeakCallbackType::kParameter);
   }
 
   WeakCallCounterAndPersistent<Value> root(&counter);
@@ -4167,10 +4153,12 @@
   // Connect group 1 and 2, make a cycle.
   {
     HandleScope scope(iso);
-    CHECK(Local<Object>::New(iso, g1s2.handle.As<Object>())->
-            Set(0, Local<Value>::New(iso, g2s2.handle)));
-    CHECK(Local<Object>::New(iso, g2s1.handle.As<Object>())->
-            Set(0, Local<Value>::New(iso, g1s1.handle)));
+    CHECK(Local<Object>::New(iso, g1s2.handle.As<Object>())
+              ->Set(env.local(), 0, Local<Value>::New(iso, g2s2.handle))
+              .FromJust());
+    CHECK(Local<Object>::New(iso, g2s1.handle.As<Object>())
+              ->Set(env.local(), 0, Local<Value>::New(iso, g1s1.handle))
+              .FromJust());
   }
 
   {
@@ -4184,15 +4172,16 @@
     iso->SetReferenceFromGroup(id2, g2c1.handle);
   }
   // Do a single full GC, ensure incremental marking is stopped.
-  v8::internal::Heap* heap = reinterpret_cast<v8::internal::Isolate*>(
-      iso)->heap();
-  heap->CollectAllGarbage(i::Heap::kAbortIncrementalMarkingMask);
+  v8::internal::Heap* heap =
+      reinterpret_cast<v8::internal::Isolate*>(iso)->heap();
+  heap->CollectAllGarbage();
 
   // All object should be alive.
   CHECK_EQ(0, counter.NumberOfWeakCalls());
 
   // Weaken the root.
-  root.handle.SetWeak(&root, &WeakPointerCallback);
+  root.handle.SetWeak(&root, &WeakPointerCallback,
+                      v8::WeakCallbackType::kParameter);
   // But make children strong roots---all the objects (except for children)
   // should be collectable now.
   g1c1.handle.ClearWeak();
@@ -4210,16 +4199,18 @@
     iso->SetReferenceFromGroup(id2, g2c1.handle);
   }
 
-  heap->CollectAllGarbage(i::Heap::kAbortIncrementalMarkingMask);
+  heap->CollectAllGarbage();
 
   // All objects should be gone. 5 global handles in total.
   CHECK_EQ(5, counter.NumberOfWeakCalls());
 
   // And now make children weak again and collect them.
-  g1c1.handle.SetWeak(&g1c1, &WeakPointerCallback);
-  g2c1.handle.SetWeak(&g2c1, &WeakPointerCallback);
+  g1c1.handle.SetWeak(&g1c1, &WeakPointerCallback,
+                      v8::WeakCallbackType::kParameter);
+  g2c1.handle.SetWeak(&g2c1, &WeakPointerCallback,
+                      v8::WeakCallbackType::kParameter);
 
-  heap->CollectAllGarbage(i::Heap::kAbortIncrementalMarkingMask);
+  heap->CollectAllGarbage();
   CHECK_EQ(7, counter.NumberOfWeakCalls());
 }
 
@@ -4241,18 +4232,24 @@
   {
     HandleScope scope(iso);
     g1s1.handle.Reset(iso, Object::New(iso));
-    g1s2.handle.Reset(iso, String::NewFromUtf8(iso, "foo1"));
-    g1c1.handle.Reset(iso, String::NewFromUtf8(iso, "foo2"));
-    g1s1.handle.SetWeak(&g1s1, &WeakPointerCallback);
-    g1s2.handle.SetWeak(&g1s2, &WeakPointerCallback);
-    g1c1.handle.SetWeak(&g1c1, &WeakPointerCallback);
+    g1s2.handle.Reset(iso, v8_str("foo1"));
+    g1c1.handle.Reset(iso, v8_str("foo2"));
+    g1s1.handle.SetWeak(&g1s1, &WeakPointerCallback,
+                        v8::WeakCallbackType::kParameter);
+    g1s2.handle.SetWeak(&g1s2, &WeakPointerCallback,
+                        v8::WeakCallbackType::kParameter);
+    g1c1.handle.SetWeak(&g1c1, &WeakPointerCallback,
+                        v8::WeakCallbackType::kParameter);
 
     g2s1.handle.Reset(iso, Object::New(iso));
-    g2s2.handle.Reset(iso, String::NewFromUtf8(iso, "foo3"));
-    g2c1.handle.Reset(iso, String::NewFromUtf8(iso, "foo4"));
-    g2s1.handle.SetWeak(&g2s1, &WeakPointerCallback);
-    g2s2.handle.SetWeak(&g2s2, &WeakPointerCallback);
-    g2c1.handle.SetWeak(&g2c1, &WeakPointerCallback);
+    g2s2.handle.Reset(iso, v8_str("foo3"));
+    g2c1.handle.Reset(iso, v8_str("foo4"));
+    g2s1.handle.SetWeak(&g2s1, &WeakPointerCallback,
+                        v8::WeakCallbackType::kParameter);
+    g2s2.handle.SetWeak(&g2s2, &WeakPointerCallback,
+                        v8::WeakCallbackType::kParameter);
+    g2c1.handle.SetWeak(&g2c1, &WeakPointerCallback,
+                        v8::WeakCallbackType::kParameter);
   }
 
   WeakCallCounterAndPersistent<Value> root(&counter);
@@ -4262,9 +4259,11 @@
   {
     HandleScope scope(iso);
     CHECK(Local<Object>::New(iso, g1s1.handle)
-              ->Set(0, Local<Object>::New(iso, g2s1.handle)));
+              ->Set(env.local(), 0, Local<Object>::New(iso, g2s1.handle))
+              .FromJust());
     CHECK(Local<Object>::New(iso, g2s1.handle)
-              ->Set(0, Local<Object>::New(iso, g1s1.handle)));
+              ->Set(env.local(), 0, Local<Object>::New(iso, g1s1.handle))
+              .FromJust());
   }
 
   {
@@ -4278,15 +4277,16 @@
     iso->SetReferenceFromGroup(id2, g2c1.handle);
   }
   // Do a single full GC, ensure incremental marking is stopped.
-  v8::internal::Heap* heap = reinterpret_cast<v8::internal::Isolate*>(
-      iso)->heap();
-  heap->CollectAllGarbage(i::Heap::kAbortIncrementalMarkingMask);
+  v8::internal::Heap* heap =
+      reinterpret_cast<v8::internal::Isolate*>(iso)->heap();
+  heap->CollectAllGarbage();
 
   // All object should be alive.
   CHECK_EQ(0, counter.NumberOfWeakCalls());
 
   // Weaken the root.
-  root.handle.SetWeak(&root, &WeakPointerCallback);
+  root.handle.SetWeak(&root, &WeakPointerCallback,
+                      v8::WeakCallbackType::kParameter);
   // But make children strong roots---all the objects (except for children)
   // should be collectable now.
   g1c1.handle.ClearWeak();
@@ -4304,16 +4304,18 @@
     iso->SetReferenceFromGroup(id2, g2c1.handle);
   }
 
-  heap->CollectAllGarbage(i::Heap::kAbortIncrementalMarkingMask);
+  heap->CollectAllGarbage();
 
   // All objects should be gone. 5 global handles in total.
   CHECK_EQ(5, counter.NumberOfWeakCalls());
 
   // And now make children weak again and collect them.
-  g1c1.handle.SetWeak(&g1c1, &WeakPointerCallback);
-  g2c1.handle.SetWeak(&g2c1, &WeakPointerCallback);
+  g1c1.handle.SetWeak(&g1c1, &WeakPointerCallback,
+                      v8::WeakCallbackType::kParameter);
+  g2c1.handle.SetWeak(&g2c1, &WeakPointerCallback,
+                      v8::WeakCallbackType::kParameter);
 
-  heap->CollectAllGarbage(i::Heap::kAbortIncrementalMarkingMask);
+  heap->CollectAllGarbage();
   CHECK_EQ(7, counter.NumberOfWeakCalls());
 }
 
@@ -4338,29 +4340,37 @@
     HandleScope scope(iso);
     g1s1.handle.Reset(iso, Object::New(iso));
     g1s2.handle.Reset(iso, Object::New(iso));
-    g1s1.handle.SetWeak(&g1s1, &WeakPointerCallback);
-    g1s2.handle.SetWeak(&g1s2, &WeakPointerCallback);
+    g1s1.handle.SetWeak(&g1s1, &WeakPointerCallback,
+                        v8::WeakCallbackType::kParameter);
+    g1s2.handle.SetWeak(&g1s2, &WeakPointerCallback,
+                        v8::WeakCallbackType::kParameter);
     CHECK(g1s1.handle.IsWeak());
     CHECK(g1s2.handle.IsWeak());
 
     g2s1.handle.Reset(iso, Object::New(iso));
     g2s2.handle.Reset(iso, Object::New(iso));
-    g2s1.handle.SetWeak(&g2s1, &WeakPointerCallback);
-    g2s2.handle.SetWeak(&g2s2, &WeakPointerCallback);
+    g2s1.handle.SetWeak(&g2s1, &WeakPointerCallback,
+                        v8::WeakCallbackType::kParameter);
+    g2s2.handle.SetWeak(&g2s2, &WeakPointerCallback,
+                        v8::WeakCallbackType::kParameter);
     CHECK(g2s1.handle.IsWeak());
     CHECK(g2s2.handle.IsWeak());
 
     g3s1.handle.Reset(iso, Object::New(iso));
     g3s2.handle.Reset(iso, Object::New(iso));
-    g3s1.handle.SetWeak(&g3s1, &WeakPointerCallback);
-    g3s2.handle.SetWeak(&g3s2, &WeakPointerCallback);
+    g3s1.handle.SetWeak(&g3s1, &WeakPointerCallback,
+                        v8::WeakCallbackType::kParameter);
+    g3s2.handle.SetWeak(&g3s2, &WeakPointerCallback,
+                        v8::WeakCallbackType::kParameter);
     CHECK(g3s1.handle.IsWeak());
     CHECK(g3s2.handle.IsWeak());
 
     g4s1.handle.Reset(iso, Object::New(iso));
     g4s2.handle.Reset(iso, Object::New(iso));
-    g4s1.handle.SetWeak(&g4s1, &WeakPointerCallback);
-    g4s2.handle.SetWeak(&g4s2, &WeakPointerCallback);
+    g4s1.handle.SetWeak(&g4s1, &WeakPointerCallback,
+                        v8::WeakCallbackType::kParameter);
+    g4s2.handle.SetWeak(&g4s2, &WeakPointerCallback,
+                        v8::WeakCallbackType::kParameter);
     CHECK(g4s1.handle.IsWeak());
     CHECK(g4s2.handle.IsWeak());
   }
@@ -4390,15 +4400,16 @@
     iso->SetReferenceFromGroup(id4, g1s1.handle);
   }
   // Do a single full GC
-  v8::internal::Heap* heap = reinterpret_cast<v8::internal::Isolate*>(
-      iso)->heap();
-  heap->CollectAllGarbage(i::Heap::kAbortIncrementalMarkingMask);
+  v8::internal::Heap* heap =
+      reinterpret_cast<v8::internal::Isolate*>(iso)->heap();
+  heap->CollectAllGarbage();
 
   // All object should be alive.
   CHECK_EQ(0, counter.NumberOfWeakCalls());
 
   // Weaken the root.
-  root.handle.SetWeak(&root, &WeakPointerCallback);
+  root.handle.SetWeak(&root, &WeakPointerCallback,
+                      v8::WeakCallbackType::kParameter);
 
   // Groups are deleted, rebuild groups.
   {
@@ -4420,52 +4431,13 @@
     iso->SetReferenceFromGroup(id4, g1s1.handle);
   }
 
-  heap->CollectAllGarbage(i::Heap::kAbortIncrementalMarkingMask);
+  heap->CollectAllGarbage();
 
   // All objects should be gone. 9 global handles in total.
   CHECK_EQ(9, counter.NumberOfWeakCalls());
 }
 
 
-THREADED_TEST(WeakRootsSurviveTwoRoundsOfGC) {
-  LocalContext env;
-  v8::Isolate* iso = env->GetIsolate();
-  HandleScope scope(iso);
-
-  WeakCallCounter counter(1234);
-
-  WeakCallCounterAndPersistent<Value> weak_obj(&counter);
-
-  // Create a weak object that references a internalized string.
-  {
-    HandleScope scope(iso);
-    weak_obj.handle.Reset(iso, Object::New(iso));
-    weak_obj.handle.SetWeak(&weak_obj, &WeakPointerCallback);
-    CHECK(weak_obj.handle.IsWeak());
-    Local<Object>::New(iso, weak_obj.handle.As<Object>())->Set(
-        v8_str("x"),
-        String::NewFromUtf8(iso, "magic cookie", String::kInternalizedString));
-  }
-  // Do a single full GC
-  i::Isolate* i_iso = reinterpret_cast<v8::internal::Isolate*>(iso);
-  i::Heap* heap = i_iso->heap();
-  heap->CollectAllGarbage(i::Heap::kAbortIncrementalMarkingMask);
-
-  // We should have received the weak callback.
-  CHECK_EQ(1, counter.NumberOfWeakCalls());
-
-  // Check that the string is still alive.
-  {
-    HandleScope scope(iso);
-    i::MaybeHandle<i::String> magic_string =
-        i::StringTable::LookupStringIfExists(
-            i_iso,
-            v8::Utils::OpenHandle(*String::NewFromUtf8(iso, "magic cookie")));
-    magic_string.Check();
-  }
-}
-
-
 // TODO(mstarzinger): This should be a THREADED_TEST but causes failures
 // on the buildbots, so was made non-threaded for the time being.
 TEST(ApiObjectGroupsCycleForScavenger) {
@@ -4488,18 +4460,24 @@
     HandleScope scope(iso);
     g1s1.handle.Reset(iso, Object::New(iso));
     g1s2.handle.Reset(iso, Object::New(iso));
-    g1s1.handle.SetWeak(&g1s1, &WeakPointerCallback);
-    g1s2.handle.SetWeak(&g1s2, &WeakPointerCallback);
+    g1s1.handle.SetWeak(&g1s1, &WeakPointerCallback,
+                        v8::WeakCallbackType::kParameter);
+    g1s2.handle.SetWeak(&g1s2, &WeakPointerCallback,
+                        v8::WeakCallbackType::kParameter);
 
     g2s1.handle.Reset(iso, Object::New(iso));
     g2s2.handle.Reset(iso, Object::New(iso));
-    g2s1.handle.SetWeak(&g2s1, &WeakPointerCallback);
-    g2s2.handle.SetWeak(&g2s2, &WeakPointerCallback);
+    g2s1.handle.SetWeak(&g2s1, &WeakPointerCallback,
+                        v8::WeakCallbackType::kParameter);
+    g2s2.handle.SetWeak(&g2s2, &WeakPointerCallback,
+                        v8::WeakCallbackType::kParameter);
 
     g3s1.handle.Reset(iso, Object::New(iso));
     g3s2.handle.Reset(iso, Object::New(iso));
-    g3s1.handle.SetWeak(&g3s1, &WeakPointerCallback);
-    g3s2.handle.SetWeak(&g3s2, &WeakPointerCallback);
+    g3s1.handle.SetWeak(&g3s1, &WeakPointerCallback,
+                        v8::WeakCallbackType::kParameter);
+    g3s2.handle.SetWeak(&g3s2, &WeakPointerCallback,
+                        v8::WeakCallbackType::kParameter);
   }
 
   // Make a root.
@@ -4520,27 +4498,31 @@
     g3s2.handle.MarkPartiallyDependent();
     iso->SetObjectGroupId(g1s1.handle, UniqueId(1));
     iso->SetObjectGroupId(g1s2.handle, UniqueId(1));
-    Local<Object>::New(iso, g1s1.handle.As<Object>())->Set(
-        v8_str("x"), Local<Value>::New(iso, g2s1.handle));
+    Local<Object>::New(iso, g1s1.handle.As<Object>())
+        ->Set(env.local(), v8_str("x"), Local<Value>::New(iso, g2s1.handle))
+        .FromJust();
     iso->SetObjectGroupId(g2s1.handle, UniqueId(2));
     iso->SetObjectGroupId(g2s2.handle, UniqueId(2));
-    Local<Object>::New(iso, g2s1.handle.As<Object>())->Set(
-        v8_str("x"), Local<Value>::New(iso, g3s1.handle));
+    Local<Object>::New(iso, g2s1.handle.As<Object>())
+        ->Set(env.local(), v8_str("x"), Local<Value>::New(iso, g3s1.handle))
+        .FromJust();
     iso->SetObjectGroupId(g3s1.handle, UniqueId(3));
     iso->SetObjectGroupId(g3s2.handle, UniqueId(3));
-    Local<Object>::New(iso, g3s1.handle.As<Object>())->Set(
-        v8_str("x"), Local<Value>::New(iso, g1s1.handle));
+    Local<Object>::New(iso, g3s1.handle.As<Object>())
+        ->Set(env.local(), v8_str("x"), Local<Value>::New(iso, g1s1.handle))
+        .FromJust();
   }
 
-  v8::internal::Heap* heap = reinterpret_cast<v8::internal::Isolate*>(
-      iso)->heap();
-  heap->CollectAllGarbage(i::Heap::kNoGCFlags);
+  v8::internal::Heap* heap =
+      reinterpret_cast<v8::internal::Isolate*>(iso)->heap();
+  heap->CollectAllGarbage();
 
   // All objects should be alive.
   CHECK_EQ(0, counter.NumberOfWeakCalls());
 
   // Weaken the root.
-  root.handle.SetWeak(&root, &WeakPointerCallback);
+  root.handle.SetWeak(&root, &WeakPointerCallback,
+                      v8::WeakCallbackType::kParameter);
   root.handle.MarkPartiallyDependent();
 
   // Groups are deleted, rebuild groups.
@@ -4554,19 +4536,22 @@
     g3s2.handle.MarkPartiallyDependent();
     iso->SetObjectGroupId(g1s1.handle, UniqueId(1));
     iso->SetObjectGroupId(g1s2.handle, UniqueId(1));
-    Local<Object>::New(iso, g1s1.handle.As<Object>())->Set(
-        v8_str("x"), Local<Value>::New(iso, g2s1.handle));
+    Local<Object>::New(iso, g1s1.handle.As<Object>())
+        ->Set(env.local(), v8_str("x"), Local<Value>::New(iso, g2s1.handle))
+        .FromJust();
     iso->SetObjectGroupId(g2s1.handle, UniqueId(2));
     iso->SetObjectGroupId(g2s2.handle, UniqueId(2));
-    Local<Object>::New(iso, g2s1.handle.As<Object>())->Set(
-        v8_str("x"), Local<Value>::New(iso, g3s1.handle));
+    Local<Object>::New(iso, g2s1.handle.As<Object>())
+        ->Set(env.local(), v8_str("x"), Local<Value>::New(iso, g3s1.handle))
+        .FromJust();
     iso->SetObjectGroupId(g3s1.handle, UniqueId(3));
     iso->SetObjectGroupId(g3s2.handle, UniqueId(3));
-    Local<Object>::New(iso, g3s1.handle.As<Object>())->Set(
-        v8_str("x"), Local<Value>::New(iso, g1s1.handle));
+    Local<Object>::New(iso, g3s1.handle.As<Object>())
+        ->Set(env.local(), v8_str("x"), Local<Value>::New(iso, g1s1.handle))
+        .FromJust();
   }
 
-  heap->CollectAllGarbage(i::Heap::kNoGCFlags);
+  heap->CollectAllGarbage();
 
   // All objects should be gone. 7 global handles in total.
   CHECK_EQ(7, counter.NumberOfWeakCalls());
@@ -4577,12 +4562,12 @@
   LocalContext env;
   v8::HandleScope scope(env->GetIsolate());
   Local<Script> script = v8_compile("throw 'panama!';");
-  v8::TryCatch try_catch;
-  Local<Value> result = script->Run();
+  v8::TryCatch try_catch(env->GetIsolate());
+  v8::MaybeLocal<Value> result = script->Run(env.local());
   CHECK(result.IsEmpty());
   CHECK(try_catch.HasCaught());
   String::Utf8Value exception_value(try_catch.Exception());
-  CHECK_EQ(*exception_value, "panama!");
+  CHECK_EQ(0, strcmp(*exception_value, "panama!"));
 }
 
 
@@ -4590,22 +4575,32 @@
   LocalContext env;
   v8::Isolate* isolate = env->GetIsolate();
   v8::HandleScope scope(isolate);
-  v8::TryCatch try_catch;
-  CompileRun("function CustomError() { this.a = 'b'; }"
-             "(function f() { throw new CustomError(); })();");
+  v8::TryCatch try_catch(isolate);
+  CompileRun(
+      "function CustomError() { this.a = 'b'; }"
+      "(function f() { throw new CustomError(); })();");
   CHECK(try_catch.HasCaught());
-  CHECK(try_catch.Exception()->ToObject(isolate)->Get(v8_str("a"))->Equals(
-      v8_str("b")));
+  CHECK(try_catch.Exception()
+            ->ToObject(env.local())
+            .ToLocalChecked()
+            ->Get(env.local(), v8_str("a"))
+            .ToLocalChecked()
+            ->Equals(env.local(), v8_str("b"))
+            .FromJust());
 }
 
 
 bool message_received;
 
 
-static void check_message_0(v8::Handle<v8::Message> message,
-                            v8::Handle<Value> data) {
-  CHECK_EQ(5.76, data->NumberValue());
-  CHECK_EQ(6.75, message->GetScriptOrigin().ResourceName()->NumberValue());
+static void check_message_0(v8::Local<v8::Message> message,
+                            v8::Local<Value> data) {
+  CHECK_EQ(5.76, data->NumberValue(CcTest::isolate()->GetCurrentContext())
+                     .FromJust());
+  CHECK_EQ(6.75, message->GetScriptOrigin()
+                     .ResourceName()
+                     ->NumberValue(CcTest::isolate()->GetCurrentContext())
+                     .FromJust());
   CHECK(!message->IsSharedCrossOrigin());
   message_received = true;
 }
@@ -4616,19 +4611,20 @@
   v8::HandleScope scope(CcTest::isolate());
   CHECK(!message_received);
   LocalContext context;
-  v8::V8::AddMessageListener(check_message_0, v8_num(5.76));
-  v8::Handle<v8::Script> script = CompileWithOrigin("throw 'error'", "6.75");
-  script->Run();
+  CcTest::isolate()->AddMessageListener(check_message_0, v8_num(5.76));
+  v8::Local<v8::Script> script = CompileWithOrigin("throw 'error'", "6.75");
+  CHECK(script->Run(context.local()).IsEmpty());
   CHECK(message_received);
   // clear out the message listener
-  v8::V8::RemoveMessageListeners(check_message_0);
+  CcTest::isolate()->RemoveMessageListeners(check_message_0);
 }
 
 
-static void check_message_1(v8::Handle<v8::Message> message,
-                            v8::Handle<Value> data) {
+static void check_message_1(v8::Local<v8::Message> message,
+                            v8::Local<Value> data) {
   CHECK(data->IsNumber());
-  CHECK_EQ(1337, data->Int32Value());
+  CHECK_EQ(1337,
+           data->Int32Value(CcTest::isolate()->GetCurrentContext()).FromJust());
   CHECK(!message->IsSharedCrossOrigin());
   message_received = true;
 }
@@ -4638,22 +4634,28 @@
   message_received = false;
   v8::HandleScope scope(CcTest::isolate());
   CHECK(!message_received);
-  v8::V8::AddMessageListener(check_message_1);
+  CcTest::isolate()->AddMessageListener(check_message_1);
   LocalContext context;
   CompileRun("throw 1337;");
   CHECK(message_received);
   // clear out the message listener
-  v8::V8::RemoveMessageListeners(check_message_1);
+  CcTest::isolate()->RemoveMessageListeners(check_message_1);
 }
 
 
-static void check_message_2(v8::Handle<v8::Message> message,
-                            v8::Handle<Value> data) {
+static void check_message_2(v8::Local<v8::Message> message,
+                            v8::Local<Value> data) {
   LocalContext context;
   CHECK(data->IsObject());
   v8::Local<v8::Value> hidden_property =
-      v8::Object::Cast(*data)->GetHiddenValue(v8_str("hidden key"));
-  CHECK(v8_str("hidden value")->Equals(hidden_property));
+      v8::Object::Cast(*data)
+          ->GetPrivate(
+              context.local(),
+              v8::Private::ForApi(CcTest::isolate(), v8_str("hidden key")))
+          .ToLocalChecked();
+  CHECK(v8_str("hidden value")
+            ->Equals(context.local(), hidden_property)
+            .FromJust());
   CHECK(!message->IsSharedCrossOrigin());
   message_received = true;
 }
@@ -4663,23 +4665,38 @@
   message_received = false;
   v8::HandleScope scope(CcTest::isolate());
   CHECK(!message_received);
-  v8::V8::AddMessageListener(check_message_2);
+  CcTest::isolate()->AddMessageListener(check_message_2);
   LocalContext context;
   v8::Local<v8::Value> error = v8::Exception::Error(v8_str("custom error"));
-  v8::Object::Cast(*error)->SetHiddenValue(v8_str("hidden key"),
-                                           v8_str("hidden value"));
-  context->Global()->Set(v8_str("error"), error);
+  v8::Object::Cast(*error)
+      ->SetPrivate(context.local(),
+                   v8::Private::ForApi(CcTest::isolate(), v8_str("hidden key")),
+                   v8_str("hidden value"))
+      .FromJust();
+  CHECK(context->Global()
+            ->Set(context.local(), v8_str("error"), error)
+            .FromJust());
   CompileRun("throw error;");
   CHECK(message_received);
   // clear out the message listener
-  v8::V8::RemoveMessageListeners(check_message_2);
+  CcTest::isolate()->RemoveMessageListeners(check_message_2);
 }
 
 
-static void check_message_3(v8::Handle<v8::Message> message,
-                            v8::Handle<Value> data) {
+static void check_message_3(v8::Local<v8::Message> message,
+                            v8::Local<Value> data) {
   CHECK(message->IsSharedCrossOrigin());
-  CHECK_EQ(6.75, message->GetScriptOrigin().ResourceName()->NumberValue());
+  CHECK(message->GetScriptOrigin().Options().IsSharedCrossOrigin());
+  CHECK(message->GetScriptOrigin().Options().IsEmbedderDebugScript());
+  CHECK(message->GetScriptOrigin().Options().IsOpaque());
+  CHECK_EQ(6.75, message->GetScriptOrigin()
+                     .ResourceName()
+                     ->NumberValue(CcTest::isolate()->GetCurrentContext())
+                     .FromJust());
+  CHECK_EQ(7.40, message->GetScriptOrigin()
+                     .SourceMapUrl()
+                     ->NumberValue(CcTest::isolate()->GetCurrentContext())
+                     .FromJust());
   message_received = true;
 }
 
@@ -4689,26 +4706,29 @@
   v8::Isolate* isolate = CcTest::isolate();
   v8::HandleScope scope(isolate);
   CHECK(!message_received);
-  v8::V8::AddMessageListener(check_message_3);
+  isolate->AddMessageListener(check_message_3);
   LocalContext context;
-  v8::ScriptOrigin origin =
-      v8::ScriptOrigin(v8_str("6.75"),
-                       v8::Integer::New(isolate, 1),
-                       v8::Integer::New(isolate, 2),
-                       v8::True(isolate));
-  v8::Handle<v8::Script> script = Script::Compile(v8_str("throw 'error'"),
-                                                  &origin);
-  script->Run();
+  v8::ScriptOrigin origin = v8::ScriptOrigin(
+      v8_str("6.75"), v8::Integer::New(isolate, 1),
+      v8::Integer::New(isolate, 2), v8::True(isolate), Local<v8::Integer>(),
+      v8::True(isolate), v8_str("7.40"), v8::True(isolate));
+  v8::Local<v8::Script> script =
+      Script::Compile(context.local(), v8_str("throw 'error'"), &origin)
+          .ToLocalChecked();
+  CHECK(script->Run(context.local()).IsEmpty());
   CHECK(message_received);
   // clear out the message listener
-  v8::V8::RemoveMessageListeners(check_message_3);
+  isolate->RemoveMessageListeners(check_message_3);
 }
 
 
-static void check_message_4(v8::Handle<v8::Message> message,
-                            v8::Handle<Value> data) {
+static void check_message_4(v8::Local<v8::Message> message,
+                            v8::Local<Value> data) {
   CHECK(!message->IsSharedCrossOrigin());
-  CHECK_EQ(6.75, message->GetScriptOrigin().ResourceName()->NumberValue());
+  CHECK_EQ(6.75, message->GetScriptOrigin()
+                     .ResourceName()
+                     ->NumberValue(CcTest::isolate()->GetCurrentContext())
+                     .FromJust());
   message_received = true;
 }
 
@@ -4718,34 +4738,39 @@
   v8::Isolate* isolate = CcTest::isolate();
   v8::HandleScope scope(isolate);
   CHECK(!message_received);
-  v8::V8::AddMessageListener(check_message_4);
+  isolate->AddMessageListener(check_message_4);
   LocalContext context;
   v8::ScriptOrigin origin =
-      v8::ScriptOrigin(v8_str("6.75"),
-                       v8::Integer::New(isolate, 1),
-                       v8::Integer::New(isolate, 2),
-                       v8::False(isolate));
-  v8::Handle<v8::Script> script = Script::Compile(v8_str("throw 'error'"),
-                                                  &origin);
-  script->Run();
+      v8::ScriptOrigin(v8_str("6.75"), v8::Integer::New(isolate, 1),
+                       v8::Integer::New(isolate, 2), v8::False(isolate));
+  v8::Local<v8::Script> script =
+      Script::Compile(context.local(), v8_str("throw 'error'"), &origin)
+          .ToLocalChecked();
+  CHECK(script->Run(context.local()).IsEmpty());
   CHECK(message_received);
   // clear out the message listener
-  v8::V8::RemoveMessageListeners(check_message_4);
+  isolate->RemoveMessageListeners(check_message_4);
 }
 
 
-static void check_message_5a(v8::Handle<v8::Message> message,
-                            v8::Handle<Value> data) {
+static void check_message_5a(v8::Local<v8::Message> message,
+                             v8::Local<Value> data) {
   CHECK(message->IsSharedCrossOrigin());
-  CHECK_EQ(6.75, message->GetScriptOrigin().ResourceName()->NumberValue());
+  CHECK_EQ(6.75, message->GetScriptOrigin()
+                     .ResourceName()
+                     ->NumberValue(CcTest::isolate()->GetCurrentContext())
+                     .FromJust());
   message_received = true;
 }
 
 
-static void check_message_5b(v8::Handle<v8::Message> message,
-                            v8::Handle<Value> data) {
+static void check_message_5b(v8::Local<v8::Message> message,
+                             v8::Local<Value> data) {
   CHECK(!message->IsSharedCrossOrigin());
-  CHECK_EQ(6.75, message->GetScriptOrigin().ResourceName()->NumberValue());
+  CHECK_EQ(6.75, message->GetScriptOrigin()
+                     .ResourceName()
+                     ->NumberValue(CcTest::isolate()->GetCurrentContext())
+                     .FromJust());
   message_received = true;
 }
 
@@ -4755,33 +4780,110 @@
   v8::Isolate* isolate = CcTest::isolate();
   v8::HandleScope scope(isolate);
   CHECK(!message_received);
-  v8::V8::AddMessageListener(check_message_5a);
+  isolate->AddMessageListener(check_message_5a);
   LocalContext context;
-  v8::ScriptOrigin origin =
-      v8::ScriptOrigin(v8_str("6.75"),
-                       v8::Integer::New(isolate, 1),
-                       v8::Integer::New(isolate, 2),
-                       v8::True(isolate));
-  v8::Handle<v8::Script> script = Script::Compile(v8_str("throw 'error'"),
-                                                  &origin);
-  script->Run();
+  v8::ScriptOrigin origin1 =
+      v8::ScriptOrigin(v8_str("6.75"), v8::Integer::New(isolate, 1),
+                       v8::Integer::New(isolate, 2), v8::True(isolate));
+  v8::Local<v8::Script> script =
+      Script::Compile(context.local(), v8_str("throw 'error'"), &origin1)
+          .ToLocalChecked();
+  CHECK(script->Run(context.local()).IsEmpty());
   CHECK(message_received);
   // clear out the message listener
-  v8::V8::RemoveMessageListeners(check_message_5a);
+  isolate->RemoveMessageListeners(check_message_5a);
 
   message_received = false;
-  v8::V8::AddMessageListener(check_message_5b);
-  origin =
-      v8::ScriptOrigin(v8_str("6.75"),
-                       v8::Integer::New(isolate, 1),
-                       v8::Integer::New(isolate, 2),
-                       v8::False(isolate));
-  script = Script::Compile(v8_str("throw 'error'"),
-                           &origin);
-  script->Run();
+  isolate->AddMessageListener(check_message_5b);
+  v8::ScriptOrigin origin2 =
+      v8::ScriptOrigin(v8_str("6.75"), v8::Integer::New(isolate, 1),
+                       v8::Integer::New(isolate, 2), v8::False(isolate));
+  script = Script::Compile(context.local(), v8_str("throw 'error'"), &origin2)
+               .ToLocalChecked();
+  CHECK(script->Run(context.local()).IsEmpty());
   CHECK(message_received);
   // clear out the message listener
-  v8::V8::RemoveMessageListeners(check_message_5b);
+  isolate->RemoveMessageListeners(check_message_5b);
+}
+
+
+TEST(NativeWeakMap) {
+  v8::Isolate* isolate = CcTest::isolate();
+  HandleScope scope(isolate);
+  Local<v8::NativeWeakMap> weak_map(v8::NativeWeakMap::New(isolate));
+  CHECK(!weak_map.IsEmpty());
+
+  LocalContext env;
+  Local<Object> value = v8::Object::New(isolate);
+
+  Local<Object> local1 = v8::Object::New(isolate);
+  CHECK(!weak_map->Has(local1));
+  CHECK(weak_map->Get(local1)->IsUndefined());
+  weak_map->Set(local1, value);
+  CHECK(weak_map->Has(local1));
+  CHECK(value->Equals(env.local(), weak_map->Get(local1)).FromJust());
+
+  WeakCallCounter counter(1234);
+  WeakCallCounterAndPersistent<Value> o1(&counter);
+  WeakCallCounterAndPersistent<Value> o2(&counter);
+  WeakCallCounterAndPersistent<Value> s1(&counter);
+  {
+    HandleScope scope(isolate);
+    Local<v8::Object> obj1 = v8::Object::New(isolate);
+    Local<v8::Object> obj2 = v8::Object::New(isolate);
+    Local<v8::Symbol> sym1 = v8::Symbol::New(isolate);
+
+    weak_map->Set(obj1, value);
+    weak_map->Set(obj2, value);
+    weak_map->Set(sym1, value);
+
+    o1.handle.Reset(isolate, obj1);
+    o2.handle.Reset(isolate, obj2);
+    s1.handle.Reset(isolate, sym1);
+
+    CHECK(weak_map->Has(local1));
+    CHECK(weak_map->Has(obj1));
+    CHECK(weak_map->Has(obj2));
+    CHECK(weak_map->Has(sym1));
+
+    CHECK(value->Equals(env.local(), weak_map->Get(local1)).FromJust());
+    CHECK(value->Equals(env.local(), weak_map->Get(obj1)).FromJust());
+    CHECK(value->Equals(env.local(), weak_map->Get(obj2)).FromJust());
+    CHECK(value->Equals(env.local(), weak_map->Get(sym1)).FromJust());
+  }
+  CcTest::heap()->CollectAllGarbage();
+  {
+    HandleScope scope(isolate);
+    CHECK(value->Equals(env.local(), weak_map->Get(local1)).FromJust());
+    CHECK(value->Equals(env.local(),
+                        weak_map->Get(Local<Value>::New(isolate, o1.handle)))
+              .FromJust());
+    CHECK(value->Equals(env.local(),
+                        weak_map->Get(Local<Value>::New(isolate, o2.handle)))
+              .FromJust());
+    CHECK(value->Equals(env.local(),
+                        weak_map->Get(Local<Value>::New(isolate, s1.handle)))
+              .FromJust());
+  }
+
+  o1.handle.SetWeak(&o1, &WeakPointerCallback,
+                    v8::WeakCallbackType::kParameter);
+  o2.handle.SetWeak(&o2, &WeakPointerCallback,
+                    v8::WeakCallbackType::kParameter);
+  s1.handle.SetWeak(&s1, &WeakPointerCallback,
+                    v8::WeakCallbackType::kParameter);
+
+  CcTest::heap()->CollectAllGarbage();
+  CHECK_EQ(3, counter.NumberOfWeakCalls());
+
+  CHECK(o1.handle.IsEmpty());
+  CHECK(o2.handle.IsEmpty());
+  CHECK(s1.handle.IsEmpty());
+
+  CHECK(value->Equals(env.local(), weak_map->Get(local1)).FromJust());
+  CHECK(weak_map->Delete(local1));
+  CHECK(!weak_map->Has(local1));
+  CHECK(weak_map->Get(local1)->IsUndefined());
 }
 
 
@@ -4789,30 +4891,71 @@
   LocalContext context;
   v8::Isolate* isolate = context->GetIsolate();
   v8::HandleScope scope(isolate);
-  context->Global()->Set(v8_str("foo"), v8_num(14));
-  context->Global()->Set(v8_str("12"), v8_num(92));
-  context->Global()->Set(v8::Integer::New(isolate, 16), v8_num(32));
-  context->Global()->Set(v8_num(13), v8_num(56));
+  CHECK(context->Global()
+            ->Set(context.local(), v8_str("foo"), v8_num(14))
+            .FromJust());
+  CHECK(context->Global()
+            ->Set(context.local(), v8_str("12"), v8_num(92))
+            .FromJust());
+  CHECK(context->Global()
+            ->Set(context.local(), v8::Integer::New(isolate, 16), v8_num(32))
+            .FromJust());
+  CHECK(context->Global()
+            ->Set(context.local(), v8_num(13), v8_num(56))
+            .FromJust());
   Local<Value> foo = CompileRun("this.foo");
-  CHECK_EQ(14, foo->Int32Value());
+  CHECK_EQ(14, foo->Int32Value(context.local()).FromJust());
   Local<Value> twelve = CompileRun("this[12]");
-  CHECK_EQ(92, twelve->Int32Value());
+  CHECK_EQ(92, twelve->Int32Value(context.local()).FromJust());
   Local<Value> sixteen = CompileRun("this[16]");
-  CHECK_EQ(32, sixteen->Int32Value());
+  CHECK_EQ(32, sixteen->Int32Value(context.local()).FromJust());
   Local<Value> thirteen = CompileRun("this[13]");
-  CHECK_EQ(56, thirteen->Int32Value());
-  CHECK_EQ(92,
-           context->Global()->Get(v8::Integer::New(isolate, 12))->Int32Value());
-  CHECK_EQ(92, context->Global()->Get(v8_str("12"))->Int32Value());
-  CHECK_EQ(92, context->Global()->Get(v8_num(12))->Int32Value());
-  CHECK_EQ(32,
-           context->Global()->Get(v8::Integer::New(isolate, 16))->Int32Value());
-  CHECK_EQ(32, context->Global()->Get(v8_str("16"))->Int32Value());
-  CHECK_EQ(32, context->Global()->Get(v8_num(16))->Int32Value());
-  CHECK_EQ(56,
-           context->Global()->Get(v8::Integer::New(isolate, 13))->Int32Value());
-  CHECK_EQ(56, context->Global()->Get(v8_str("13"))->Int32Value());
-  CHECK_EQ(56, context->Global()->Get(v8_num(13))->Int32Value());
+  CHECK_EQ(56, thirteen->Int32Value(context.local()).FromJust());
+  CHECK_EQ(92, context->Global()
+                   ->Get(context.local(), v8::Integer::New(isolate, 12))
+                   .ToLocalChecked()
+                   ->Int32Value(context.local())
+                   .FromJust());
+  CHECK_EQ(92, context->Global()
+                   ->Get(context.local(), v8_str("12"))
+                   .ToLocalChecked()
+                   ->Int32Value(context.local())
+                   .FromJust());
+  CHECK_EQ(92, context->Global()
+                   ->Get(context.local(), v8_num(12))
+                   .ToLocalChecked()
+                   ->Int32Value(context.local())
+                   .FromJust());
+  CHECK_EQ(32, context->Global()
+                   ->Get(context.local(), v8::Integer::New(isolate, 16))
+                   .ToLocalChecked()
+                   ->Int32Value(context.local())
+                   .FromJust());
+  CHECK_EQ(32, context->Global()
+                   ->Get(context.local(), v8_str("16"))
+                   .ToLocalChecked()
+                   ->Int32Value(context.local())
+                   .FromJust());
+  CHECK_EQ(32, context->Global()
+                   ->Get(context.local(), v8_num(16))
+                   .ToLocalChecked()
+                   ->Int32Value(context.local())
+                   .FromJust());
+  CHECK_EQ(56, context->Global()
+                   ->Get(context.local(), v8::Integer::New(isolate, 13))
+                   .ToLocalChecked()
+                   ->Int32Value(context.local())
+                   .FromJust());
+  CHECK_EQ(56, context->Global()
+                   ->Get(context.local(), v8_str("13"))
+                   .ToLocalChecked()
+                   ->Int32Value(context.local())
+                   .FromJust());
+  CHECK_EQ(56, context->Global()
+                   ->Get(context.local(), v8_num(13))
+                   .ToLocalChecked()
+                   ->Int32Value(context.local())
+                   .FromJust());
 }
 
 
@@ -4821,41 +4964,81 @@
   v8::HandleScope scope(context->GetIsolate());
   // none
   Local<String> prop = v8_str("none");
-  context->Global()->Set(prop, v8_num(7));
-  CHECK_EQ(v8::None, context->Global()->GetPropertyAttributes(prop));
+  CHECK(context->Global()->Set(context.local(), prop, v8_num(7)).FromJust());
+  CHECK_EQ(v8::None, context->Global()
+                         ->GetPropertyAttributes(context.local(), prop)
+                         .FromJust());
   // read-only
   prop = v8_str("read_only");
-  context->Global()->ForceSet(prop, v8_num(7), v8::ReadOnly);
-  CHECK_EQ(7, context->Global()->Get(prop)->Int32Value());
-  CHECK_EQ(v8::ReadOnly, context->Global()->GetPropertyAttributes(prop));
+  context->Global()
+      ->DefineOwnProperty(context.local(), prop, v8_num(7), v8::ReadOnly)
+      .FromJust();
+  CHECK_EQ(7, context->Global()
+                  ->Get(context.local(), prop)
+                  .ToLocalChecked()
+                  ->Int32Value(context.local())
+                  .FromJust());
+  CHECK_EQ(v8::ReadOnly, context->Global()
+                             ->GetPropertyAttributes(context.local(), prop)
+                             .FromJust());
   CompileRun("read_only = 9");
-  CHECK_EQ(7, context->Global()->Get(prop)->Int32Value());
-  context->Global()->Set(prop, v8_num(10));
-  CHECK_EQ(7, context->Global()->Get(prop)->Int32Value());
+  CHECK_EQ(7, context->Global()
+                  ->Get(context.local(), prop)
+                  .ToLocalChecked()
+                  ->Int32Value(context.local())
+                  .FromJust());
+  CHECK(context->Global()->Set(context.local(), prop, v8_num(10)).FromJust());
+  CHECK_EQ(7, context->Global()
+                  ->Get(context.local(), prop)
+                  .ToLocalChecked()
+                  ->Int32Value(context.local())
+                  .FromJust());
   // dont-delete
   prop = v8_str("dont_delete");
-  context->Global()->ForceSet(prop, v8_num(13), v8::DontDelete);
-  CHECK_EQ(13, context->Global()->Get(prop)->Int32Value());
+  context->Global()
+      ->DefineOwnProperty(context.local(), prop, v8_num(13), v8::DontDelete)
+      .FromJust();
+  CHECK_EQ(13, context->Global()
+                   ->Get(context.local(), prop)
+                   .ToLocalChecked()
+                   ->Int32Value(context.local())
+                   .FromJust());
   CompileRun("delete dont_delete");
-  CHECK_EQ(13, context->Global()->Get(prop)->Int32Value());
-  CHECK_EQ(v8::DontDelete, context->Global()->GetPropertyAttributes(prop));
+  CHECK_EQ(13, context->Global()
+                   ->Get(context.local(), prop)
+                   .ToLocalChecked()
+                   ->Int32Value(context.local())
+                   .FromJust());
+  CHECK_EQ(v8::DontDelete, context->Global()
+                               ->GetPropertyAttributes(context.local(), prop)
+                               .FromJust());
   // dont-enum
   prop = v8_str("dont_enum");
-  context->Global()->ForceSet(prop, v8_num(28), v8::DontEnum);
-  CHECK_EQ(v8::DontEnum, context->Global()->GetPropertyAttributes(prop));
+  context->Global()
+      ->DefineOwnProperty(context.local(), prop, v8_num(28), v8::DontEnum)
+      .FromJust();
+  CHECK_EQ(v8::DontEnum, context->Global()
+                             ->GetPropertyAttributes(context.local(), prop)
+                             .FromJust());
   // absent
   prop = v8_str("absent");
-  CHECK_EQ(v8::None, context->Global()->GetPropertyAttributes(prop));
+  CHECK_EQ(v8::None, context->Global()
+                         ->GetPropertyAttributes(context.local(), prop)
+                         .FromJust());
   Local<Value> fake_prop = v8_num(1);
-  CHECK_EQ(v8::None, context->Global()->GetPropertyAttributes(fake_prop));
+  CHECK_EQ(v8::None, context->Global()
+                         ->GetPropertyAttributes(context.local(), fake_prop)
+                         .FromJust());
   // exception
-  TryCatch try_catch;
+  TryCatch try_catch(context->GetIsolate());
   Local<Value> exception =
       CompileRun("({ toString: function() { throw 'exception';} })");
-  CHECK_EQ(v8::None, context->Global()->GetPropertyAttributes(exception));
+  CHECK(context->Global()
+            ->GetPropertyAttributes(context.local(), exception)
+            .IsNothing());
   CHECK(try_catch.HasCaught());
   String::Utf8Value exception_value(try_catch.Exception());
-  CHECK_EQ("exception", *exception_value);
+  CHECK_EQ(0, strcmp("exception", *exception_value));
   try_catch.Reset();
 }
 
@@ -4864,27 +5047,39 @@
   LocalContext context;
   v8::HandleScope scope(context->GetIsolate());
   Local<v8::Array> array = v8::Array::New(context->GetIsolate());
-  CHECK_EQ(0, array->Length());
-  CHECK(array->Get(0)->IsUndefined());
-  CHECK(!array->Has(0));
-  CHECK(array->Get(100)->IsUndefined());
-  CHECK(!array->Has(100));
-  array->Set(2, v8_num(7));
-  CHECK_EQ(3, array->Length());
-  CHECK(!array->Has(0));
-  CHECK(!array->Has(1));
-  CHECK(array->Has(2));
-  CHECK_EQ(7, array->Get(2)->Int32Value());
+  CHECK_EQ(0u, array->Length());
+  CHECK(array->Get(context.local(), 0).ToLocalChecked()->IsUndefined());
+  CHECK(!array->Has(context.local(), 0).FromJust());
+  CHECK(array->Get(context.local(), 100).ToLocalChecked()->IsUndefined());
+  CHECK(!array->Has(context.local(), 100).FromJust());
+  CHECK(array->Set(context.local(), 2, v8_num(7)).FromJust());
+  CHECK_EQ(3u, array->Length());
+  CHECK(!array->Has(context.local(), 0).FromJust());
+  CHECK(!array->Has(context.local(), 1).FromJust());
+  CHECK(array->Has(context.local(), 2).FromJust());
+  CHECK_EQ(7, array->Get(context.local(), 2)
+                  .ToLocalChecked()
+                  ->Int32Value(context.local())
+                  .FromJust());
   Local<Value> obj = CompileRun("[1, 2, 3]");
   Local<v8::Array> arr = obj.As<v8::Array>();
-  CHECK_EQ(3, arr->Length());
-  CHECK_EQ(1, arr->Get(0)->Int32Value());
-  CHECK_EQ(2, arr->Get(1)->Int32Value());
-  CHECK_EQ(3, arr->Get(2)->Int32Value());
+  CHECK_EQ(3u, arr->Length());
+  CHECK_EQ(1, arr->Get(context.local(), 0)
+                  .ToLocalChecked()
+                  ->Int32Value(context.local())
+                  .FromJust());
+  CHECK_EQ(2, arr->Get(context.local(), 1)
+                  .ToLocalChecked()
+                  ->Int32Value(context.local())
+                  .FromJust());
+  CHECK_EQ(3, arr->Get(context.local(), 2)
+                  .ToLocalChecked()
+                  ->Int32Value(context.local())
+                  .FromJust());
   array = v8::Array::New(context->GetIsolate(), 27);
-  CHECK_EQ(27, array->Length());
+  CHECK_EQ(27u, array->Length());
   array = v8::Array::New(context->GetIsolate(), -27);
-  CHECK_EQ(0, array->Length());
+  CHECK_EQ(0u, array->Length());
 }
 
 
@@ -4892,8 +5087,10 @@
   v8::EscapableHandleScope scope(args.GetIsolate());
   ApiTestFuzzer::Fuzz();
   Local<v8::Array> result = v8::Array::New(args.GetIsolate(), args.Length());
-  for (int i = 0; i < args.Length(); i++)
-    result->Set(i, args[i]);
+  for (int i = 0; i < args.Length(); i++) {
+    CHECK(result->Set(CcTest::isolate()->GetCurrentContext(), i, args[i])
+              .FromJust());
+  }
   args.GetReturnValue().Set(scope.Escape(result));
 }
 
@@ -4907,33 +5104,63 @@
 
   const char* fun = "f()";
   Local<v8::Array> a0 = CompileRun(fun).As<v8::Array>();
-  CHECK_EQ(0, a0->Length());
+  CHECK_EQ(0u, a0->Length());
 
   const char* fun2 = "f(11)";
   Local<v8::Array> a1 = CompileRun(fun2).As<v8::Array>();
-  CHECK_EQ(1, a1->Length());
-  CHECK_EQ(11, a1->Get(0)->Int32Value());
+  CHECK_EQ(1u, a1->Length());
+  CHECK_EQ(11, a1->Get(context.local(), 0)
+                   .ToLocalChecked()
+                   ->Int32Value(context.local())
+                   .FromJust());
 
   const char* fun3 = "f(12, 13)";
   Local<v8::Array> a2 = CompileRun(fun3).As<v8::Array>();
-  CHECK_EQ(2, a2->Length());
-  CHECK_EQ(12, a2->Get(0)->Int32Value());
-  CHECK_EQ(13, a2->Get(1)->Int32Value());
+  CHECK_EQ(2u, a2->Length());
+  CHECK_EQ(12, a2->Get(context.local(), 0)
+                   .ToLocalChecked()
+                   ->Int32Value(context.local())
+                   .FromJust());
+  CHECK_EQ(13, a2->Get(context.local(), 1)
+                   .ToLocalChecked()
+                   ->Int32Value(context.local())
+                   .FromJust());
 
   const char* fun4 = "f(14, 15, 16)";
   Local<v8::Array> a3 = CompileRun(fun4).As<v8::Array>();
-  CHECK_EQ(3, a3->Length());
-  CHECK_EQ(14, a3->Get(0)->Int32Value());
-  CHECK_EQ(15, a3->Get(1)->Int32Value());
-  CHECK_EQ(16, a3->Get(2)->Int32Value());
+  CHECK_EQ(3u, a3->Length());
+  CHECK_EQ(14, a3->Get(context.local(), 0)
+                   .ToLocalChecked()
+                   ->Int32Value(context.local())
+                   .FromJust());
+  CHECK_EQ(15, a3->Get(context.local(), 1)
+                   .ToLocalChecked()
+                   ->Int32Value(context.local())
+                   .FromJust());
+  CHECK_EQ(16, a3->Get(context.local(), 2)
+                   .ToLocalChecked()
+                   ->Int32Value(context.local())
+                   .FromJust());
 
   const char* fun5 = "f(17, 18, 19, 20)";
   Local<v8::Array> a4 = CompileRun(fun5).As<v8::Array>();
-  CHECK_EQ(4, a4->Length());
-  CHECK_EQ(17, a4->Get(0)->Int32Value());
-  CHECK_EQ(18, a4->Get(1)->Int32Value());
-  CHECK_EQ(19, a4->Get(2)->Int32Value());
-  CHECK_EQ(20, a4->Get(3)->Int32Value());
+  CHECK_EQ(4u, a4->Length());
+  CHECK_EQ(17, a4->Get(context.local(), 0)
+                   .ToLocalChecked()
+                   ->Int32Value(context.local())
+                   .FromJust());
+  CHECK_EQ(18, a4->Get(context.local(), 1)
+                   .ToLocalChecked()
+                   ->Int32Value(context.local())
+                   .FromJust());
+  CHECK_EQ(19, a4->Get(context.local(), 2)
+                   .ToLocalChecked()
+                   ->Int32Value(context.local())
+                   .FromJust());
+  CHECK_EQ(20, a4->Get(context.local(), 3)
+                   .ToLocalChecked()
+                   ->Int32Value(context.local())
+                   .FromJust());
 }
 
 
@@ -4942,86 +5169,140 @@
   v8::Isolate* isolate = context->GetIsolate();
   v8::HandleScope scope(isolate);
   CompileRun(
-    "function Foo() {"
-    "  var result = [];"
-    "  for (var i = 0; i < arguments.length; i++) {"
-    "    result.push(arguments[i]);"
-    "  }"
-    "  return result;"
-    "}"
-    "function ReturnThisSloppy() {"
-    "  return this;"
-    "}"
-    "function ReturnThisStrict() {"
-    "  'use strict';"
-    "  return this;"
-    "}");
-  Local<Function> Foo =
-      Local<Function>::Cast(context->Global()->Get(v8_str("Foo")));
-  Local<Function> ReturnThisSloppy =
-      Local<Function>::Cast(context->Global()->Get(v8_str("ReturnThisSloppy")));
-  Local<Function> ReturnThisStrict =
-      Local<Function>::Cast(context->Global()->Get(v8_str("ReturnThisStrict")));
+      "function Foo() {"
+      "  var result = [];"
+      "  for (var i = 0; i < arguments.length; i++) {"
+      "    result.push(arguments[i]);"
+      "  }"
+      "  return result;"
+      "}"
+      "function ReturnThisSloppy() {"
+      "  return this;"
+      "}"
+      "function ReturnThisStrict() {"
+      "  'use strict';"
+      "  return this;"
+      "}");
+  Local<Function> Foo = Local<Function>::Cast(
+      context->Global()->Get(context.local(), v8_str("Foo")).ToLocalChecked());
+  Local<Function> ReturnThisSloppy = Local<Function>::Cast(
+      context->Global()
+          ->Get(context.local(), v8_str("ReturnThisSloppy"))
+          .ToLocalChecked());
+  Local<Function> ReturnThisStrict = Local<Function>::Cast(
+      context->Global()
+          ->Get(context.local(), v8_str("ReturnThisStrict"))
+          .ToLocalChecked());
 
-  v8::Handle<Value>* args0 = NULL;
-  Local<v8::Array> a0 = Local<v8::Array>::Cast(Foo->Call(Foo, 0, args0));
-  CHECK_EQ(0, a0->Length());
+  v8::Local<Value>* args0 = NULL;
+  Local<v8::Array> a0 = Local<v8::Array>::Cast(
+      Foo->Call(context.local(), Foo, 0, args0).ToLocalChecked());
+  CHECK_EQ(0u, a0->Length());
 
-  v8::Handle<Value> args1[] = { v8_num(1.1) };
-  Local<v8::Array> a1 = Local<v8::Array>::Cast(Foo->Call(Foo, 1, args1));
-  CHECK_EQ(1, a1->Length());
-  CHECK_EQ(1.1, a1->Get(v8::Integer::New(isolate, 0))->NumberValue());
+  v8::Local<Value> args1[] = {v8_num(1.1)};
+  Local<v8::Array> a1 = Local<v8::Array>::Cast(
+      Foo->Call(context.local(), Foo, 1, args1).ToLocalChecked());
+  CHECK_EQ(1u, a1->Length());
+  CHECK_EQ(1.1, a1->Get(context.local(), v8::Integer::New(isolate, 0))
+                    .ToLocalChecked()
+                    ->NumberValue(context.local())
+                    .FromJust());
 
-  v8::Handle<Value> args2[] = { v8_num(2.2),
-                                v8_num(3.3) };
-  Local<v8::Array> a2 = Local<v8::Array>::Cast(Foo->Call(Foo, 2, args2));
-  CHECK_EQ(2, a2->Length());
-  CHECK_EQ(2.2, a2->Get(v8::Integer::New(isolate, 0))->NumberValue());
-  CHECK_EQ(3.3, a2->Get(v8::Integer::New(isolate, 1))->NumberValue());
+  v8::Local<Value> args2[] = {v8_num(2.2), v8_num(3.3)};
+  Local<v8::Array> a2 = Local<v8::Array>::Cast(
+      Foo->Call(context.local(), Foo, 2, args2).ToLocalChecked());
+  CHECK_EQ(2u, a2->Length());
+  CHECK_EQ(2.2, a2->Get(context.local(), v8::Integer::New(isolate, 0))
+                    .ToLocalChecked()
+                    ->NumberValue(context.local())
+                    .FromJust());
+  CHECK_EQ(3.3, a2->Get(context.local(), v8::Integer::New(isolate, 1))
+                    .ToLocalChecked()
+                    ->NumberValue(context.local())
+                    .FromJust());
 
-  v8::Handle<Value> args3[] = { v8_num(4.4),
-                                v8_num(5.5),
-                                v8_num(6.6) };
-  Local<v8::Array> a3 = Local<v8::Array>::Cast(Foo->Call(Foo, 3, args3));
-  CHECK_EQ(3, a3->Length());
-  CHECK_EQ(4.4, a3->Get(v8::Integer::New(isolate, 0))->NumberValue());
-  CHECK_EQ(5.5, a3->Get(v8::Integer::New(isolate, 1))->NumberValue());
-  CHECK_EQ(6.6, a3->Get(v8::Integer::New(isolate, 2))->NumberValue());
+  v8::Local<Value> args3[] = {v8_num(4.4), v8_num(5.5), v8_num(6.6)};
+  Local<v8::Array> a3 = Local<v8::Array>::Cast(
+      Foo->Call(context.local(), Foo, 3, args3).ToLocalChecked());
+  CHECK_EQ(3u, a3->Length());
+  CHECK_EQ(4.4, a3->Get(context.local(), v8::Integer::New(isolate, 0))
+                    .ToLocalChecked()
+                    ->NumberValue(context.local())
+                    .FromJust());
+  CHECK_EQ(5.5, a3->Get(context.local(), v8::Integer::New(isolate, 1))
+                    .ToLocalChecked()
+                    ->NumberValue(context.local())
+                    .FromJust());
+  CHECK_EQ(6.6, a3->Get(context.local(), v8::Integer::New(isolate, 2))
+                    .ToLocalChecked()
+                    ->NumberValue(context.local())
+                    .FromJust());
 
-  v8::Handle<Value> args4[] = { v8_num(7.7),
-                                v8_num(8.8),
-                                v8_num(9.9),
-                                v8_num(10.11) };
-  Local<v8::Array> a4 = Local<v8::Array>::Cast(Foo->Call(Foo, 4, args4));
-  CHECK_EQ(4, a4->Length());
-  CHECK_EQ(7.7, a4->Get(v8::Integer::New(isolate, 0))->NumberValue());
-  CHECK_EQ(8.8, a4->Get(v8::Integer::New(isolate, 1))->NumberValue());
-  CHECK_EQ(9.9, a4->Get(v8::Integer::New(isolate, 2))->NumberValue());
-  CHECK_EQ(10.11, a4->Get(v8::Integer::New(isolate, 3))->NumberValue());
+  v8::Local<Value> args4[] = {v8_num(7.7), v8_num(8.8), v8_num(9.9),
+                              v8_num(10.11)};
+  Local<v8::Array> a4 = Local<v8::Array>::Cast(
+      Foo->Call(context.local(), Foo, 4, args4).ToLocalChecked());
+  CHECK_EQ(4u, a4->Length());
+  CHECK_EQ(7.7, a4->Get(context.local(), v8::Integer::New(isolate, 0))
+                    .ToLocalChecked()
+                    ->NumberValue(context.local())
+                    .FromJust());
+  CHECK_EQ(8.8, a4->Get(context.local(), v8::Integer::New(isolate, 1))
+                    .ToLocalChecked()
+                    ->NumberValue(context.local())
+                    .FromJust());
+  CHECK_EQ(9.9, a4->Get(context.local(), v8::Integer::New(isolate, 2))
+                    .ToLocalChecked()
+                    ->NumberValue(context.local())
+                    .FromJust());
+  CHECK_EQ(10.11, a4->Get(context.local(), v8::Integer::New(isolate, 3))
+                      .ToLocalChecked()
+                      ->NumberValue(context.local())
+                      .FromJust());
 
-  Local<v8::Value> r1 = ReturnThisSloppy->Call(v8::Undefined(isolate), 0, NULL);
+  Local<v8::Value> r1 =
+      ReturnThisSloppy->Call(context.local(), v8::Undefined(isolate), 0, NULL)
+          .ToLocalChecked();
   CHECK(r1->StrictEquals(context->Global()));
-  Local<v8::Value> r2 = ReturnThisSloppy->Call(v8::Null(isolate), 0, NULL);
+  Local<v8::Value> r2 =
+      ReturnThisSloppy->Call(context.local(), v8::Null(isolate), 0, NULL)
+          .ToLocalChecked();
   CHECK(r2->StrictEquals(context->Global()));
-  Local<v8::Value> r3 = ReturnThisSloppy->Call(v8_num(42), 0, NULL);
+  Local<v8::Value> r3 =
+      ReturnThisSloppy->Call(context.local(), v8_num(42), 0, NULL)
+          .ToLocalChecked();
   CHECK(r3->IsNumberObject());
   CHECK_EQ(42.0, r3.As<v8::NumberObject>()->ValueOf());
-  Local<v8::Value> r4 = ReturnThisSloppy->Call(v8_str("hello"), 0, NULL);
+  Local<v8::Value> r4 =
+      ReturnThisSloppy->Call(context.local(), v8_str("hello"), 0, NULL)
+          .ToLocalChecked();
   CHECK(r4->IsStringObject());
   CHECK(r4.As<v8::StringObject>()->ValueOf()->StrictEquals(v8_str("hello")));
-  Local<v8::Value> r5 = ReturnThisSloppy->Call(v8::True(isolate), 0, NULL);
+  Local<v8::Value> r5 =
+      ReturnThisSloppy->Call(context.local(), v8::True(isolate), 0, NULL)
+          .ToLocalChecked();
   CHECK(r5->IsBooleanObject());
   CHECK(r5.As<v8::BooleanObject>()->ValueOf());
 
-  Local<v8::Value> r6 = ReturnThisStrict->Call(v8::Undefined(isolate), 0, NULL);
+  Local<v8::Value> r6 =
+      ReturnThisStrict->Call(context.local(), v8::Undefined(isolate), 0, NULL)
+          .ToLocalChecked();
   CHECK(r6->IsUndefined());
-  Local<v8::Value> r7 = ReturnThisStrict->Call(v8::Null(isolate), 0, NULL);
+  Local<v8::Value> r7 =
+      ReturnThisStrict->Call(context.local(), v8::Null(isolate), 0, NULL)
+          .ToLocalChecked();
   CHECK(r7->IsNull());
-  Local<v8::Value> r8 = ReturnThisStrict->Call(v8_num(42), 0, NULL);
+  Local<v8::Value> r8 =
+      ReturnThisStrict->Call(context.local(), v8_num(42), 0, NULL)
+          .ToLocalChecked();
   CHECK(r8->StrictEquals(v8_num(42)));
-  Local<v8::Value> r9 = ReturnThisStrict->Call(v8_str("hello"), 0, NULL);
+  Local<v8::Value> r9 =
+      ReturnThisStrict->Call(context.local(), v8_str("hello"), 0, NULL)
+          .ToLocalChecked();
   CHECK(r9->StrictEquals(v8_str("hello")));
-  Local<v8::Value> r10 = ReturnThisStrict->Call(v8::True(isolate), 0, NULL);
+  Local<v8::Value> r10 =
+      ReturnThisStrict->Call(context.local(), v8::True(isolate), 0, NULL)
+          .ToLocalChecked();
   CHECK(r10->StrictEquals(v8::True(isolate)));
 }
 
@@ -5031,59 +5312,81 @@
   v8::Isolate* isolate = context->GetIsolate();
   v8::HandleScope scope(isolate);
   CompileRun(
-    "function Foo() {"
-    "  var result = [];"
-    "  for (var i = 0; i < arguments.length; i++) {"
-    "    result.push(arguments[i]);"
-    "  }"
-    "  return result;"
-    "}");
-  Local<Function> Foo =
-      Local<Function>::Cast(context->Global()->Get(v8_str("Foo")));
+      "function Foo() {"
+      "  var result = [];"
+      "  for (var i = 0; i < arguments.length; i++) {"
+      "    result.push(arguments[i]);"
+      "  }"
+      "  return result;"
+      "}");
+  Local<Function> Foo = Local<Function>::Cast(
+      context->Global()->Get(context.local(), v8_str("Foo")).ToLocalChecked());
 
-  v8::Handle<Value>* args0 = NULL;
-  Local<v8::Array> a0 = Local<v8::Array>::Cast(Foo->NewInstance(0, args0));
-  CHECK_EQ(0, a0->Length());
+  v8::Local<Value>* args0 = NULL;
+  Local<v8::Array> a0 = Local<v8::Array>::Cast(
+      Foo->NewInstance(context.local(), 0, args0).ToLocalChecked());
+  CHECK_EQ(0u, a0->Length());
 
-  v8::Handle<Value> args1[] = { v8_num(1.1) };
-  Local<v8::Array> a1 = Local<v8::Array>::Cast(Foo->NewInstance(1, args1));
-  CHECK_EQ(1, a1->Length());
-  CHECK_EQ(1.1, a1->Get(v8::Integer::New(isolate, 0))->NumberValue());
+  v8::Local<Value> args1[] = {v8_num(1.1)};
+  Local<v8::Array> a1 = Local<v8::Array>::Cast(
+      Foo->NewInstance(context.local(), 1, args1).ToLocalChecked());
+  CHECK_EQ(1u, a1->Length());
+  CHECK_EQ(1.1, a1->Get(context.local(), v8::Integer::New(isolate, 0))
+                    .ToLocalChecked()
+                    ->NumberValue(context.local())
+                    .FromJust());
 
-  v8::Handle<Value> args2[] = { v8_num(2.2),
-                                v8_num(3.3) };
-  Local<v8::Array> a2 = Local<v8::Array>::Cast(Foo->NewInstance(2, args2));
-  CHECK_EQ(2, a2->Length());
-  CHECK_EQ(2.2, a2->Get(v8::Integer::New(isolate, 0))->NumberValue());
-  CHECK_EQ(3.3, a2->Get(v8::Integer::New(isolate, 1))->NumberValue());
+  v8::Local<Value> args2[] = {v8_num(2.2), v8_num(3.3)};
+  Local<v8::Array> a2 = Local<v8::Array>::Cast(
+      Foo->NewInstance(context.local(), 2, args2).ToLocalChecked());
+  CHECK_EQ(2u, a2->Length());
+  CHECK_EQ(2.2, a2->Get(context.local(), v8::Integer::New(isolate, 0))
+                    .ToLocalChecked()
+                    ->NumberValue(context.local())
+                    .FromJust());
+  CHECK_EQ(3.3, a2->Get(context.local(), v8::Integer::New(isolate, 1))
+                    .ToLocalChecked()
+                    ->NumberValue(context.local())
+                    .FromJust());
 
-  v8::Handle<Value> args3[] = { v8_num(4.4),
-                                v8_num(5.5),
-                                v8_num(6.6) };
-  Local<v8::Array> a3 = Local<v8::Array>::Cast(Foo->NewInstance(3, args3));
-  CHECK_EQ(3, a3->Length());
-  CHECK_EQ(4.4, a3->Get(v8::Integer::New(isolate, 0))->NumberValue());
-  CHECK_EQ(5.5, a3->Get(v8::Integer::New(isolate, 1))->NumberValue());
-  CHECK_EQ(6.6, a3->Get(v8::Integer::New(isolate, 2))->NumberValue());
+  v8::Local<Value> args3[] = {v8_num(4.4), v8_num(5.5), v8_num(6.6)};
+  Local<v8::Array> a3 = Local<v8::Array>::Cast(
+      Foo->NewInstance(context.local(), 3, args3).ToLocalChecked());
+  CHECK_EQ(3u, a3->Length());
+  CHECK_EQ(4.4, a3->Get(context.local(), v8::Integer::New(isolate, 0))
+                    .ToLocalChecked()
+                    ->NumberValue(context.local())
+                    .FromJust());
+  CHECK_EQ(5.5, a3->Get(context.local(), v8::Integer::New(isolate, 1))
+                    .ToLocalChecked()
+                    ->NumberValue(context.local())
+                    .FromJust());
+  CHECK_EQ(6.6, a3->Get(context.local(), v8::Integer::New(isolate, 2))
+                    .ToLocalChecked()
+                    ->NumberValue(context.local())
+                    .FromJust());
 
-  v8::Handle<Value> args4[] = { v8_num(7.7),
-                                v8_num(8.8),
-                                v8_num(9.9),
-                                v8_num(10.11) };
-  Local<v8::Array> a4 = Local<v8::Array>::Cast(Foo->NewInstance(4, args4));
-  CHECK_EQ(4, a4->Length());
-  CHECK_EQ(7.7, a4->Get(v8::Integer::New(isolate, 0))->NumberValue());
-  CHECK_EQ(8.8, a4->Get(v8::Integer::New(isolate, 1))->NumberValue());
-  CHECK_EQ(9.9, a4->Get(v8::Integer::New(isolate, 2))->NumberValue());
-  CHECK_EQ(10.11, a4->Get(v8::Integer::New(isolate, 3))->NumberValue());
-}
-
-
-static void CheckUncle(v8::TryCatch* try_catch) {
-  CHECK(try_catch->HasCaught());
-  String::Utf8Value str_value(try_catch->Exception());
-  CHECK_EQ(*str_value, "uncle?");
-  try_catch->Reset();
+  v8::Local<Value> args4[] = {v8_num(7.7), v8_num(8.8), v8_num(9.9),
+                              v8_num(10.11)};
+  Local<v8::Array> a4 = Local<v8::Array>::Cast(
+      Foo->NewInstance(context.local(), 4, args4).ToLocalChecked());
+  CHECK_EQ(4u, a4->Length());
+  CHECK_EQ(7.7, a4->Get(context.local(), v8::Integer::New(isolate, 0))
+                    .ToLocalChecked()
+                    ->NumberValue(context.local())
+                    .FromJust());
+  CHECK_EQ(8.8, a4->Get(context.local(), v8::Integer::New(isolate, 1))
+                    .ToLocalChecked()
+                    ->NumberValue(context.local())
+                    .FromJust());
+  CHECK_EQ(9.9, a4->Get(context.local(), v8::Integer::New(isolate, 2))
+                    .ToLocalChecked()
+                    ->NumberValue(context.local())
+                    .FromJust());
+  CHECK_EQ(10.11, a4->Get(context.local(), v8::Integer::New(isolate, 3))
+                      .ToLocalChecked()
+                      ->NumberValue(context.local())
+                      .FromJust());
 }
 
 
@@ -5093,47 +5396,57 @@
   v8::HandleScope scope(isolate);
   // Very large number.
   CompileRun("var obj = Math.pow(2,32) * 1237;");
-  Local<Value> obj = env->Global()->Get(v8_str("obj"));
-  CHECK_EQ(5312874545152.0, obj->ToNumber(isolate)->Value());
-  CHECK_EQ(0, obj->ToInt32(isolate)->Value());
+  Local<Value> obj =
+      env->Global()->Get(env.local(), v8_str("obj")).ToLocalChecked();
+  CHECK_EQ(5312874545152.0,
+           obj->ToNumber(env.local()).ToLocalChecked()->Value());
+  CHECK_EQ(0, obj->ToInt32(env.local()).ToLocalChecked()->Value());
   CHECK(0u ==
-        obj->ToUint32(isolate)->Value());  // NOLINT - no CHECK_EQ for unsigned.
+        obj->ToUint32(env.local())
+            .ToLocalChecked()
+            ->Value());  // NOLINT - no CHECK_EQ for unsigned.
   // Large number.
   CompileRun("var obj = -1234567890123;");
-  obj = env->Global()->Get(v8_str("obj"));
-  CHECK_EQ(-1234567890123.0, obj->ToNumber(isolate)->Value());
-  CHECK_EQ(-1912276171, obj->ToInt32(isolate)->Value());
-  CHECK(2382691125u == obj->ToUint32(isolate)->Value());  // NOLINT
+  obj = env->Global()->Get(env.local(), v8_str("obj")).ToLocalChecked();
+  CHECK_EQ(-1234567890123.0,
+           obj->ToNumber(env.local()).ToLocalChecked()->Value());
+  CHECK_EQ(-1912276171, obj->ToInt32(env.local()).ToLocalChecked()->Value());
+  CHECK(2382691125u ==
+        obj->ToUint32(env.local()).ToLocalChecked()->Value());  // NOLINT
   // Small positive integer.
   CompileRun("var obj = 42;");
-  obj = env->Global()->Get(v8_str("obj"));
-  CHECK_EQ(42.0, obj->ToNumber(isolate)->Value());
-  CHECK_EQ(42, obj->ToInt32(isolate)->Value());
-  CHECK(42u == obj->ToUint32(isolate)->Value());  // NOLINT
+  obj = env->Global()->Get(env.local(), v8_str("obj")).ToLocalChecked();
+  CHECK_EQ(42.0, obj->ToNumber(env.local()).ToLocalChecked()->Value());
+  CHECK_EQ(42, obj->ToInt32(env.local()).ToLocalChecked()->Value());
+  CHECK(42u == obj->ToUint32(env.local()).ToLocalChecked()->Value());  // NOLINT
   // Negative integer.
   CompileRun("var obj = -37;");
-  obj = env->Global()->Get(v8_str("obj"));
-  CHECK_EQ(-37.0, obj->ToNumber(isolate)->Value());
-  CHECK_EQ(-37, obj->ToInt32(isolate)->Value());
-  CHECK(4294967259u == obj->ToUint32(isolate)->Value());  // NOLINT
+  obj = env->Global()->Get(env.local(), v8_str("obj")).ToLocalChecked();
+  CHECK_EQ(-37.0, obj->ToNumber(env.local()).ToLocalChecked()->Value());
+  CHECK_EQ(-37, obj->ToInt32(env.local()).ToLocalChecked()->Value());
+  CHECK(4294967259u ==
+        obj->ToUint32(env.local()).ToLocalChecked()->Value());  // NOLINT
   // Positive non-int32 integer.
   CompileRun("var obj = 0x81234567;");
-  obj = env->Global()->Get(v8_str("obj"));
-  CHECK_EQ(2166572391.0, obj->ToNumber(isolate)->Value());
-  CHECK_EQ(-2128394905, obj->ToInt32(isolate)->Value());
-  CHECK(2166572391u == obj->ToUint32(isolate)->Value());  // NOLINT
+  obj = env->Global()->Get(env.local(), v8_str("obj")).ToLocalChecked();
+  CHECK_EQ(2166572391.0, obj->ToNumber(env.local()).ToLocalChecked()->Value());
+  CHECK_EQ(-2128394905, obj->ToInt32(env.local()).ToLocalChecked()->Value());
+  CHECK(2166572391u ==
+        obj->ToUint32(env.local()).ToLocalChecked()->Value());  // NOLINT
   // Fraction.
   CompileRun("var obj = 42.3;");
-  obj = env->Global()->Get(v8_str("obj"));
-  CHECK_EQ(42.3, obj->ToNumber(isolate)->Value());
-  CHECK_EQ(42, obj->ToInt32(isolate)->Value());
-  CHECK(42u == obj->ToUint32(isolate)->Value());  // NOLINT
+  obj = env->Global()->Get(env.local(), v8_str("obj")).ToLocalChecked();
+  CHECK_EQ(42.3, obj->ToNumber(env.local()).ToLocalChecked()->Value());
+  CHECK_EQ(42, obj->ToInt32(env.local()).ToLocalChecked()->Value());
+  CHECK(42u == obj->ToUint32(env.local()).ToLocalChecked()->Value());  // NOLINT
   // Large negative fraction.
   CompileRun("var obj = -5726623061.75;");
-  obj = env->Global()->Get(v8_str("obj"));
-  CHECK_EQ(-5726623061.75, obj->ToNumber(isolate)->Value());
-  CHECK_EQ(-1431655765, obj->ToInt32(isolate)->Value());
-  CHECK(2863311531u == obj->ToUint32(isolate)->Value());  // NOLINT
+  obj = env->Global()->Get(env.local(), v8_str("obj")).ToLocalChecked();
+  CHECK_EQ(-5726623061.75,
+           obj->ToNumber(env.local()).ToLocalChecked()->Value());
+  CHECK_EQ(-1431655765, obj->ToInt32(env.local()).ToLocalChecked()->Value());
+  CHECK(2863311531u ==
+        obj->ToUint32(env.local()).ToLocalChecked()->Value());  // NOLINT
 }
 
 
@@ -5142,103 +5455,103 @@
   v8::HandleScope scope(env->GetIsolate());
   // Very large number.
   CompileRun("var obj = Math.pow(2,32) * 1237;");
-  Local<Value> obj = env->Global()->Get(v8_str("obj"));
+  Local<Value> obj =
+      env->Global()->Get(env.local(), v8_str("obj")).ToLocalChecked();
   CHECK(!obj->IsInt32());
   CHECK(!obj->IsUint32());
   // Large negative number.
   CompileRun("var obj = -1234567890123;");
-  obj = env->Global()->Get(v8_str("obj"));
+  obj = env->Global()->Get(env.local(), v8_str("obj")).ToLocalChecked();
   CHECK(!obj->IsInt32());
   CHECK(!obj->IsUint32());
   // Small positive integer.
   CompileRun("var obj = 42;");
-  obj = env->Global()->Get(v8_str("obj"));
+  obj = env->Global()->Get(env.local(), v8_str("obj")).ToLocalChecked();
   CHECK(obj->IsInt32());
   CHECK(obj->IsUint32());
   // Negative integer.
   CompileRun("var obj = -37;");
-  obj = env->Global()->Get(v8_str("obj"));
+  obj = env->Global()->Get(env.local(), v8_str("obj")).ToLocalChecked();
   CHECK(obj->IsInt32());
   CHECK(!obj->IsUint32());
   // Positive non-int32 integer.
   CompileRun("var obj = 0x81234567;");
-  obj = env->Global()->Get(v8_str("obj"));
+  obj = env->Global()->Get(env.local(), v8_str("obj")).ToLocalChecked();
   CHECK(!obj->IsInt32());
   CHECK(obj->IsUint32());
   // Fraction.
   CompileRun("var obj = 42.3;");
-  obj = env->Global()->Get(v8_str("obj"));
+  obj = env->Global()->Get(env.local(), v8_str("obj")).ToLocalChecked();
   CHECK(!obj->IsInt32());
   CHECK(!obj->IsUint32());
   // Large negative fraction.
   CompileRun("var obj = -5726623061.75;");
-  obj = env->Global()->Get(v8_str("obj"));
+  obj = env->Global()->Get(env.local(), v8_str("obj")).ToLocalChecked();
   CHECK(!obj->IsInt32());
   CHECK(!obj->IsUint32());
   // Positive zero
   CompileRun("var obj = 0.0;");
-  obj = env->Global()->Get(v8_str("obj"));
+  obj = env->Global()->Get(env.local(), v8_str("obj")).ToLocalChecked();
   CHECK(obj->IsInt32());
   CHECK(obj->IsUint32());
   // Positive zero
   CompileRun("var obj = -0.0;");
-  obj = env->Global()->Get(v8_str("obj"));
+  obj = env->Global()->Get(env.local(), v8_str("obj")).ToLocalChecked();
   CHECK(!obj->IsInt32());
   CHECK(!obj->IsUint32());
 }
 
 
+static void CheckUncle(v8::TryCatch* try_catch) {
+  CHECK(try_catch->HasCaught());
+  String::Utf8Value str_value(try_catch->Exception());
+  CHECK_EQ(0, strcmp(*str_value, "uncle?"));
+  try_catch->Reset();
+}
+
+
 THREADED_TEST(ConversionException) {
   LocalContext env;
   v8::Isolate* isolate = env->GetIsolate();
   v8::HandleScope scope(isolate);
   CompileRun(
-    "function TestClass() { };"
-    "TestClass.prototype.toString = function () { throw 'uncle?'; };"
-    "var obj = new TestClass();");
-  Local<Value> obj = env->Global()->Get(v8_str("obj"));
+      "function TestClass() { };"
+      "TestClass.prototype.toString = function () { throw 'uncle?'; };"
+      "var obj = new TestClass();");
+  Local<Value> obj =
+      env->Global()->Get(env.local(), v8_str("obj")).ToLocalChecked();
 
   v8::TryCatch try_catch(isolate);
 
-  Local<Value> to_string_result = obj->ToString(isolate);
-  CHECK(to_string_result.IsEmpty());
+  CHECK(obj->ToString(env.local()).IsEmpty());
   CheckUncle(&try_catch);
 
-  Local<Value> to_number_result = obj->ToNumber(isolate);
-  CHECK(to_number_result.IsEmpty());
+  CHECK(obj->ToNumber(env.local()).IsEmpty());
   CheckUncle(&try_catch);
 
-  Local<Value> to_integer_result = obj->ToInteger(isolate);
-  CHECK(to_integer_result.IsEmpty());
+  CHECK(obj->ToInteger(env.local()).IsEmpty());
   CheckUncle(&try_catch);
 
-  Local<Value> to_uint32_result = obj->ToUint32(isolate);
-  CHECK(to_uint32_result.IsEmpty());
+  CHECK(obj->ToUint32(env.local()).IsEmpty());
   CheckUncle(&try_catch);
 
-  Local<Value> to_int32_result = obj->ToInt32(isolate);
-  CHECK(to_int32_result.IsEmpty());
+  CHECK(obj->ToInt32(env.local()).IsEmpty());
   CheckUncle(&try_catch);
 
-  Local<Value> to_object_result = v8::Undefined(isolate)->ToObject(isolate);
-  CHECK(to_object_result.IsEmpty());
+  CHECK(v8::Undefined(isolate)->ToObject(env.local()).IsEmpty());
   CHECK(try_catch.HasCaught());
   try_catch.Reset();
 
-  int32_t int32_value = obj->Int32Value();
-  CHECK_EQ(0, int32_value);
+  CHECK(obj->Int32Value(env.local()).IsNothing());
   CheckUncle(&try_catch);
 
-  uint32_t uint32_value = obj->Uint32Value();
-  CHECK_EQ(0, uint32_value);
+  CHECK(obj->Uint32Value(env.local()).IsNothing());
   CheckUncle(&try_catch);
 
-  double number_value = obj->NumberValue();
-  CHECK_NE(0, std::isnan(number_value));
+  CHECK(obj->NumberValue(env.local()).IsNothing());
   CheckUncle(&try_catch);
 
-  int64_t integer_value = obj->IntegerValue();
-  CHECK_EQ(0.0, static_cast<double>(integer_value));
+  CHECK(obj->IntegerValue(env.local()).IsNothing());
   CheckUncle(&try_catch);
 }
 
@@ -5255,8 +5568,11 @@
     return;
   }
   v8::HandleScope scope(args.GetIsolate());
-  v8::TryCatch try_catch;
-  Local<Value> result = CompileRun(args[0]->ToString(args.GetIsolate()));
+  v8::TryCatch try_catch(args.GetIsolate());
+  Local<Value> result =
+      CompileRun(args[0]
+                     ->ToString(args.GetIsolate()->GetCurrentContext())
+                     .ToLocalChecked());
   CHECK(!try_catch.HasCaught() || result.IsEmpty());
   args.GetReturnValue().Set(try_catch.HasCaught());
 }
@@ -5270,14 +5586,16 @@
              v8::FunctionTemplate::New(isolate, ThrowFromC));
   LocalContext context(0, templ);
   CompileRun(
-    "var thrown = false;"
-    "try {"
-    "  ThrowFromC();"
-    "} catch (e) {"
-    "  thrown = true;"
-    "}");
-  Local<Value> thrown = context->Global()->Get(v8_str("thrown"));
-  CHECK(thrown->BooleanValue());
+      "var thrown = false;"
+      "try {"
+      "  ThrowFromC();"
+      "} catch (e) {"
+      "  thrown = true;"
+      "}");
+  Local<Value> thrown = context->Global()
+                            ->Get(context.local(), v8_str("thrown"))
+                            .ToLocalChecked();
+  CHECK(thrown->BooleanValue(context.local()).FromJust());
 }
 
 
@@ -5288,7 +5606,7 @@
   templ->Set(v8_str("ThrowFromC"),
              v8::FunctionTemplate::New(isolate, ThrowFromC));
   LocalContext context(0, templ);
-  v8::TryCatch try_catch;
+  v8::TryCatch try_catch(isolate);
   CompileRun("ThrowFromC();");
   CHECK(try_catch.HasCaught());
 }
@@ -5305,156 +5623,128 @@
   v8::Isolate* isolate = CcTest::isolate();
   v8::HandleScope scope(isolate);
   Local<ObjectTemplate> templ = ObjectTemplate::New(isolate);
-  templ->Set(v8_str("CCatcher"),
-             v8::FunctionTemplate::New(isolate, CCatcher));
+  templ->Set(v8_str("CCatcher"), v8::FunctionTemplate::New(isolate, CCatcher));
   LocalContext context(0, templ);
-  Local<Value> result = CompileRun("try {"
-                                   "  try {"
-                                   "    CCatcher('throw 7;');"
-                                   "  } finally {"
-                                   "  }"
-                                   "} catch (e) {"
-                                   "}");
+  Local<Value> result = CompileRun(
+      "try {"
+      "  try {"
+      "    CCatcher('throw 7;');"
+      "  } finally {"
+      "  }"
+      "} catch (e) {"
+      "}");
   CHECK(result->IsTrue());
 }
 
 
-static void check_reference_error_message(
-    v8::Handle<v8::Message> message,
-    v8::Handle<v8::Value> data) {
-  const char* reference_error = "Uncaught ReferenceError: asdf is not defined";
-  CHECK(message->Get()->Equals(v8_str(reference_error)));
-}
-
-
-static void Fail(const v8::FunctionCallbackInfo<v8::Value>& args) {
-  ApiTestFuzzer::Fuzz();
-  CHECK(false);
-}
-
-
-// Test that overwritten methods are not invoked on uncaught exception
-// formatting. However, they are invoked when performing normal error
-// string conversions.
-TEST(APIThrowMessageOverwrittenToString) {
-  v8::Isolate* isolate = CcTest::isolate();
-  v8::HandleScope scope(isolate);
-  v8::V8::AddMessageListener(check_reference_error_message);
-  Local<ObjectTemplate> templ = ObjectTemplate::New(isolate);
-  templ->Set(v8_str("fail"), v8::FunctionTemplate::New(isolate, Fail));
-  LocalContext context(NULL, templ);
-  CompileRun("asdf;");
-  CompileRun("var limit = {};"
-             "limit.valueOf = fail;"
-             "Error.stackTraceLimit = limit;");
-  CompileRun("asdf");
-  CompileRun("Array.prototype.pop = fail;");
-  CompileRun("Object.prototype.hasOwnProperty = fail;");
-  CompileRun("Object.prototype.toString = function f() { return 'Yikes'; }");
-  CompileRun("Number.prototype.toString = function f() { return 'Yikes'; }");
-  CompileRun("String.prototype.toString = function f() { return 'Yikes'; }");
-  CompileRun("ReferenceError.prototype.toString ="
-             "  function() { return 'Whoops' }");
-  CompileRun("asdf;");
-  CompileRun("ReferenceError.prototype.constructor.name = void 0;");
-  CompileRun("asdf;");
-  CompileRun("ReferenceError.prototype.constructor = void 0;");
-  CompileRun("asdf;");
-  CompileRun("ReferenceError.prototype.__proto__ = new Object();");
-  CompileRun("asdf;");
-  CompileRun("ReferenceError.prototype = new Object();");
-  CompileRun("asdf;");
-  v8::Handle<Value> string = CompileRun("try { asdf; } catch(e) { e + ''; }");
-  CHECK(string->Equals(v8_str("Whoops")));
-  CompileRun("ReferenceError.prototype.constructor = new Object();"
-             "ReferenceError.prototype.constructor.name = 1;"
-             "Number.prototype.toString = function() { return 'Whoops'; };"
-             "ReferenceError.prototype.toString = Object.prototype.toString;");
-  CompileRun("asdf;");
-  v8::V8::RemoveMessageListeners(check_reference_error_message);
-}
-
-
-static void check_custom_error_tostring(
-    v8::Handle<v8::Message> message,
-    v8::Handle<v8::Value> data) {
+static void check_custom_error_tostring(v8::Local<v8::Message> message,
+                                        v8::Local<v8::Value> data) {
   const char* uncaught_error = "Uncaught MyError toString";
-  CHECK(message->Get()->Equals(v8_str(uncaught_error)));
+  CHECK(message->Get()
+            ->Equals(CcTest::isolate()->GetCurrentContext(),
+                     v8_str(uncaught_error))
+            .FromJust());
 }
 
 
 TEST(CustomErrorToString) {
   LocalContext context;
   v8::HandleScope scope(context->GetIsolate());
-  v8::V8::AddMessageListener(check_custom_error_tostring);
+  context->GetIsolate()->AddMessageListener(check_custom_error_tostring);
   CompileRun(
-    "function MyError(name, message) {                   "
-    "  this.name = name;                                 "
-    "  this.message = message;                           "
-    "}                                                   "
-    "MyError.prototype = Object.create(Error.prototype); "
-    "MyError.prototype.toString = function() {           "
-    "  return 'MyError toString';                        "
-    "};                                                  "
-    "throw new MyError('my name', 'my message');         ");
-  v8::V8::RemoveMessageListeners(check_custom_error_tostring);
+      "function MyError(name, message) {                   "
+      "  this.name = name;                                 "
+      "  this.message = message;                           "
+      "}                                                   "
+      "MyError.prototype = Object.create(Error.prototype); "
+      "MyError.prototype.toString = function() {           "
+      "  return 'MyError toString';                        "
+      "};                                                  "
+      "throw new MyError('my name', 'my message');         ");
+  context->GetIsolate()->RemoveMessageListeners(check_custom_error_tostring);
 }
 
 
-static void check_custom_error_message(
-    v8::Handle<v8::Message> message,
-    v8::Handle<v8::Value> data) {
+static void check_custom_error_message(v8::Local<v8::Message> message,
+                                       v8::Local<v8::Value> data) {
   const char* uncaught_error = "Uncaught MyError: my message";
   printf("%s\n", *v8::String::Utf8Value(message->Get()));
-  CHECK(message->Get()->Equals(v8_str(uncaught_error)));
+  CHECK(message->Get()
+            ->Equals(CcTest::isolate()->GetCurrentContext(),
+                     v8_str(uncaught_error))
+            .FromJust());
 }
 
 
 TEST(CustomErrorMessage) {
   LocalContext context;
   v8::HandleScope scope(context->GetIsolate());
-  v8::V8::AddMessageListener(check_custom_error_message);
+  context->GetIsolate()->AddMessageListener(check_custom_error_message);
 
   // Handlebars.
   CompileRun(
-    "function MyError(msg) {                             "
-    "  this.name = 'MyError';                            "
-    "  this.message = msg;                               "
-    "}                                                   "
-    "MyError.prototype = new Error();                    "
-    "throw new MyError('my message');                    ");
+      "function MyError(msg) {                             "
+      "  this.name = 'MyError';                            "
+      "  this.message = msg;                               "
+      "}                                                   "
+      "MyError.prototype = new Error();                    "
+      "throw new MyError('my message');                    ");
 
   // Closure.
   CompileRun(
-    "function MyError(msg) {                             "
-    "  this.name = 'MyError';                            "
-    "  this.message = msg;                               "
-    "}                                                   "
-    "inherits = function(childCtor, parentCtor) {        "
-    "    function tempCtor() {};                         "
-    "    tempCtor.prototype = parentCtor.prototype;      "
-    "    childCtor.superClass_ = parentCtor.prototype;   "
-    "    childCtor.prototype = new tempCtor();           "
-    "    childCtor.prototype.constructor = childCtor;    "
-    "};                                                  "
-    "inherits(MyError, Error);                           "
-    "throw new MyError('my message');                    ");
+      "function MyError(msg) {                             "
+      "  this.name = 'MyError';                            "
+      "  this.message = msg;                               "
+      "}                                                   "
+      "inherits = function(childCtor, parentCtor) {        "
+      "    function tempCtor() {};                         "
+      "    tempCtor.prototype = parentCtor.prototype;      "
+      "    childCtor.superClass_ = parentCtor.prototype;   "
+      "    childCtor.prototype = new tempCtor();           "
+      "    childCtor.prototype.constructor = childCtor;    "
+      "};                                                  "
+      "inherits(MyError, Error);                           "
+      "throw new MyError('my message');                    ");
 
   // Object.create.
   CompileRun(
-    "function MyError(msg) {                             "
-    "  this.name = 'MyError';                            "
-    "  this.message = msg;                               "
-    "}                                                   "
-    "MyError.prototype = Object.create(Error.prototype); "
-    "throw new MyError('my message');                    ");
+      "function MyError(msg) {                             "
+      "  this.name = 'MyError';                            "
+      "  this.message = msg;                               "
+      "}                                                   "
+      "MyError.prototype = Object.create(Error.prototype); "
+      "throw new MyError('my message');                    ");
 
-  v8::V8::RemoveMessageListeners(check_custom_error_message);
+  context->GetIsolate()->RemoveMessageListeners(check_custom_error_message);
 }
 
 
-static void receive_message(v8::Handle<v8::Message> message,
-                            v8::Handle<v8::Value> data) {
+static void check_custom_rethrowing_message(v8::Local<v8::Message> message,
+                                            v8::Local<v8::Value> data) {
+  const char* uncaught_error = "Uncaught exception";
+  CHECK(message->Get()
+            ->Equals(CcTest::isolate()->GetCurrentContext(),
+                     v8_str(uncaught_error))
+            .FromJust());
+}
+
+
+TEST(CustomErrorRethrowsOnToString) {
+  LocalContext context;
+  v8::HandleScope scope(context->GetIsolate());
+  context->GetIsolate()->AddMessageListener(check_custom_rethrowing_message);
+
+  CompileRun(
+      "var e = { toString: function() { throw e; } };"
+      "try { throw e; } finally {}");
+
+  context->GetIsolate()->RemoveMessageListeners(
+      check_custom_rethrowing_message);
+}
+
+
+static void receive_message(v8::Local<v8::Message> message,
+                            v8::Local<v8::Value> data) {
   message->Get();
   message_received = true;
 }
@@ -5464,14 +5754,14 @@
   message_received = false;
   v8::Isolate* isolate = CcTest::isolate();
   v8::HandleScope scope(isolate);
-  v8::V8::AddMessageListener(receive_message);
+  isolate->AddMessageListener(receive_message);
   Local<ObjectTemplate> templ = ObjectTemplate::New(isolate);
   templ->Set(v8_str("ThrowFromC"),
              v8::FunctionTemplate::New(isolate, ThrowFromC));
   LocalContext context(0, templ);
   CompileRun("ThrowFromC();");
   CHECK(message_received);
-  v8::V8::RemoveMessageListeners(receive_message);
+  isolate->RemoveMessageListeners(receive_message);
 }
 
 
@@ -5479,18 +5769,18 @@
   message_received = false;
   v8::Isolate* isolate = CcTest::isolate();
   v8::HandleScope scope(isolate);
-  v8::V8::AddMessageListener(receive_message);
+  isolate->AddMessageListener(receive_message);
   Local<ObjectTemplate> templ = ObjectTemplate::New(isolate);
   templ->Set(v8_str("ThrowFromC"),
              v8::FunctionTemplate::New(isolate, ThrowFromC));
   LocalContext context(0, templ);
-  v8::TryCatch try_catch;
+  v8::TryCatch try_catch(isolate);
   try_catch.SetVerbose(true);
   Local<Value> result = CompileRun("ThrowFromC();");
   CHECK(try_catch.HasCaught());
   CHECK(result.IsEmpty());
   CHECK(message_received);
-  v8::V8::RemoveMessageListeners(receive_message);
+  isolate->RemoveMessageListeners(receive_message);
 }
 
 
@@ -5498,14 +5788,14 @@
   message_received = false;
   LocalContext context;
   v8::HandleScope scope(context->GetIsolate());
-  v8::V8::AddMessageListener(receive_message);
-  v8::TryCatch try_catch;
+  context->GetIsolate()->AddMessageListener(receive_message);
+  v8::TryCatch try_catch(context->GetIsolate());
   try_catch.SetVerbose(true);
   Local<Value> result = CompileRun("function foo() { foo(); } foo();");
   CHECK(try_catch.HasCaught());
   CHECK(result.IsEmpty());
   CHECK(message_received);
-  v8::V8::RemoveMessageListeners(receive_message);
+  context->GetIsolate()->RemoveMessageListeners(receive_message);
 }
 
 
@@ -5517,36 +5807,35 @@
              v8::FunctionTemplate::New(isolate, ThrowFromC));
   LocalContext context(0, templ);
 
-  v8::TryCatch try_catch;
+  v8::TryCatch try_catch(isolate);
   Local<Value> result = CompileRun("ThrowFromC(); throw 'panama';");
   CHECK(result.IsEmpty());
   CHECK(try_catch.HasCaught());
   String::Utf8Value exception_value(try_catch.Exception());
-  CHECK_EQ("konto", *exception_value);
+  CHECK_EQ(0, strcmp("konto", *exception_value));
 }
 
 
-
 void CThrowCountDown(const v8::FunctionCallbackInfo<v8::Value>& args) {
   ApiTestFuzzer::Fuzz();
   CHECK_EQ(4, args.Length());
-  int count = args[0]->Int32Value();
-  int cInterval = args[2]->Int32Value();
+  v8::Local<v8::Context> context = args.GetIsolate()->GetCurrentContext();
+  int count = args[0]->Int32Value(context).FromJust();
+  int cInterval = args[2]->Int32Value(context).FromJust();
   if (count == 0) {
     args.GetIsolate()->ThrowException(v8_str("FromC"));
     return;
   } else {
-    Local<v8::Object> global =
-        args.GetIsolate()->GetCurrentContext()->Global();
-    Local<Value> fun = global->Get(v8_str("JSThrowCountDown"));
-    v8::Handle<Value> argv[] = { v8_num(count - 1),
-                                 args[1],
-                                 args[2],
-                                 args[3] };
+    Local<v8::Object> global = context->Global();
+    Local<Value> fun =
+        global->Get(context, v8_str("JSThrowCountDown")).ToLocalChecked();
+    v8::Local<Value> argv[] = {v8_num(count - 1), args[1], args[2], args[3]};
     if (count % cInterval == 0) {
-      v8::TryCatch try_catch;
-      Local<Value> result = fun.As<Function>()->Call(global, 4, argv);
-      int expected = args[3]->Int32Value();
+      v8::TryCatch try_catch(args.GetIsolate());
+      Local<Value> result = fun.As<Function>()
+                                ->Call(context, global, 4, argv)
+                                .FromMaybe(Local<Value>());
+      int expected = args[3]->Int32Value(context).FromJust();
       if (try_catch.HasCaught()) {
         CHECK_EQ(expected, count);
         CHECK(result.IsEmpty());
@@ -5557,7 +5846,9 @@
       args.GetReturnValue().Set(result);
       return;
     } else {
-      args.GetReturnValue().Set(fun.As<Function>()->Call(global, 4, argv));
+      args.GetReturnValue().Set(fun.As<Function>()
+                                    ->Call(context, global, 4, argv)
+                                    .FromMaybe(v8::Local<v8::Value>()));
       return;
     }
   }
@@ -5567,9 +5858,10 @@
 void JSCheck(const v8::FunctionCallbackInfo<v8::Value>& args) {
   ApiTestFuzzer::Fuzz();
   CHECK_EQ(3, args.Length());
-  bool equality = args[0]->BooleanValue();
-  int count = args[1]->Int32Value();
-  int expected = args[2]->Int32Value();
+  v8::Local<v8::Context> context = args.GetIsolate()->GetCurrentContext();
+  bool equality = args[0]->BooleanValue(context).FromJust();
+  int count = args[1]->Int32Value(context).FromJust();
+  int expected = args[2]->Int32Value(context).FromJust();
   if (equality) {
     CHECK_EQ(count, expected);
   } else {
@@ -5581,14 +5873,15 @@
 THREADED_TEST(EvalInTryFinally) {
   LocalContext context;
   v8::HandleScope scope(context->GetIsolate());
-  v8::TryCatch try_catch;
-  CompileRun("(function() {"
-             "  try {"
-             "    eval('asldkf (*&^&*^');"
-             "  } finally {"
-             "    return;"
-             "  }"
-             "})()");
+  v8::TryCatch try_catch(context->GetIsolate());
+  CompileRun(
+      "(function() {"
+      "  try {"
+      "    eval('asldkf (*&^&*^');"
+      "  } finally {"
+      "    return;"
+      "  }"
+      "})()");
   CHECK(!try_catch.HasCaught());
 }
 
@@ -5622,52 +5915,54 @@
              v8::FunctionTemplate::New(isolate, CThrowCountDown));
   LocalContext context(0, templ);
   CompileRun(
-    "function JSThrowCountDown(count, jsInterval, cInterval, expected) {"
-    "  if (count == 0) throw 'FromJS';"
-    "  if (count % jsInterval == 0) {"
-    "    try {"
-    "      var value = CThrowCountDown(count - 1,"
-    "                                  jsInterval,"
-    "                                  cInterval,"
-    "                                  expected);"
-    "      check(false, count, expected);"
-    "      return value;"
-    "    } catch (e) {"
-    "      check(true, count, expected);"
-    "    }"
-    "  } else {"
-    "    return CThrowCountDown(count - 1, jsInterval, cInterval, expected);"
-    "  }"
-    "}");
-  Local<Function> fun =
-      Local<Function>::Cast(context->Global()->Get(v8_str("JSThrowCountDown")));
+      "function JSThrowCountDown(count, jsInterval, cInterval, expected) {"
+      "  if (count == 0) throw 'FromJS';"
+      "  if (count % jsInterval == 0) {"
+      "    try {"
+      "      var value = CThrowCountDown(count - 1,"
+      "                                  jsInterval,"
+      "                                  cInterval,"
+      "                                  expected);"
+      "      check(false, count, expected);"
+      "      return value;"
+      "    } catch (e) {"
+      "      check(true, count, expected);"
+      "    }"
+      "  } else {"
+      "    return CThrowCountDown(count - 1, jsInterval, cInterval, expected);"
+      "  }"
+      "}");
+  Local<Function> fun = Local<Function>::Cast(
+      context->Global()
+          ->Get(context.local(), v8_str("JSThrowCountDown"))
+          .ToLocalChecked());
 
   const int argc = 4;
   //                             count      jsInterval cInterval  expected
 
   // *JS[4] *C[3] @JS[2] C[1] JS[0]
-  v8::Handle<Value> a0[argc] = { v8_num(4), v8_num(2), v8_num(3), v8_num(2) };
-  fun->Call(fun, argc, a0);
+  v8::Local<Value> a0[argc] = {v8_num(4), v8_num(2), v8_num(3), v8_num(2)};
+  fun->Call(context.local(), fun, argc, a0).ToLocalChecked();
 
   // JS[5] *C[4] JS[3] @C[2] JS[1] C[0]
-  v8::Handle<Value> a1[argc] = { v8_num(5), v8_num(6), v8_num(1), v8_num(2) };
-  fun->Call(fun, argc, a1);
+  v8::Local<Value> a1[argc] = {v8_num(5), v8_num(6), v8_num(1), v8_num(2)};
+  fun->Call(context.local(), fun, argc, a1).ToLocalChecked();
 
   // JS[6] @C[5] JS[4] C[3] JS[2] C[1] JS[0]
-  v8::Handle<Value> a2[argc] = { v8_num(6), v8_num(7), v8_num(5), v8_num(5) };
-  fun->Call(fun, argc, a2);
+  v8::Local<Value> a2[argc] = {v8_num(6), v8_num(7), v8_num(5), v8_num(5)};
+  fun->Call(context.local(), fun, argc, a2).ToLocalChecked();
 
   // @JS[6] C[5] JS[4] C[3] JS[2] C[1] JS[0]
-  v8::Handle<Value> a3[argc] = { v8_num(6), v8_num(6), v8_num(7), v8_num(6) };
-  fun->Call(fun, argc, a3);
+  v8::Local<Value> a3[argc] = {v8_num(6), v8_num(6), v8_num(7), v8_num(6)};
+  fun->Call(context.local(), fun, argc, a3).ToLocalChecked();
 
   // JS[6] *C[5] @JS[4] C[3] JS[2] C[1] JS[0]
-  v8::Handle<Value> a4[argc] = { v8_num(6), v8_num(4), v8_num(5), v8_num(4) };
-  fun->Call(fun, argc, a4);
+  v8::Local<Value> a4[argc] = {v8_num(6), v8_num(4), v8_num(5), v8_num(4)};
+  fun->Call(context.local(), fun, argc, a4).ToLocalChecked();
 
   // JS[6] C[5] *JS[4] @C[3] JS[2] C[1] JS[0]
-  v8::Handle<Value> a5[argc] = { v8_num(6), v8_num(4), v8_num(3), v8_num(3) };
-  fun->Call(fun, argc, a5);
+  v8::Local<Value> a5[argc] = {v8_num(6), v8_num(4), v8_num(3), v8_num(3)};
+  fun->Call(context.local(), fun, argc, a5).ToLocalChecked();
 }
 
 
@@ -5684,47 +5979,63 @@
   Local<ObjectTemplate> templ = ObjectTemplate::New(isolate);
   templ->Set(v8_str("Throw"), v8::FunctionTemplate::New(isolate, ThrowValue));
   LocalContext context(0, templ);
-  v8::Handle<v8::Array> result = v8::Handle<v8::Array>::Cast(CompileRun(
-    "function Run(obj) {"
-    "  try {"
-    "    Throw(obj);"
-    "  } catch (e) {"
-    "    return e;"
-    "  }"
-    "  return 'no exception';"
-    "}"
-    "[Run('str'), Run(1), Run(0), Run(null), Run(void 0)];"));
-  CHECK_EQ(5, result->Length());
-  CHECK(result->Get(v8::Integer::New(isolate, 0))->IsString());
-  CHECK(result->Get(v8::Integer::New(isolate, 1))->IsNumber());
-  CHECK_EQ(1, result->Get(v8::Integer::New(isolate, 1))->Int32Value());
-  CHECK(result->Get(v8::Integer::New(isolate, 2))->IsNumber());
-  CHECK_EQ(0, result->Get(v8::Integer::New(isolate, 2))->Int32Value());
-  CHECK(result->Get(v8::Integer::New(isolate, 3))->IsNull());
-  CHECK(result->Get(v8::Integer::New(isolate, 4))->IsUndefined());
+  v8::Local<v8::Array> result = v8::Local<v8::Array>::Cast(
+      CompileRun("function Run(obj) {"
+                 "  try {"
+                 "    Throw(obj);"
+                 "  } catch (e) {"
+                 "    return e;"
+                 "  }"
+                 "  return 'no exception';"
+                 "}"
+                 "[Run('str'), Run(1), Run(0), Run(null), Run(void 0)];"));
+  CHECK_EQ(5u, result->Length());
+  CHECK(result->Get(context.local(), v8::Integer::New(isolate, 0))
+            .ToLocalChecked()
+            ->IsString());
+  CHECK(result->Get(context.local(), v8::Integer::New(isolate, 1))
+            .ToLocalChecked()
+            ->IsNumber());
+  CHECK_EQ(1, result->Get(context.local(), v8::Integer::New(isolate, 1))
+                  .ToLocalChecked()
+                  ->Int32Value(context.local())
+                  .FromJust());
+  CHECK(result->Get(context.local(), v8::Integer::New(isolate, 2))
+            .ToLocalChecked()
+            ->IsNumber());
+  CHECK_EQ(0, result->Get(context.local(), v8::Integer::New(isolate, 2))
+                  .ToLocalChecked()
+                  ->Int32Value(context.local())
+                  .FromJust());
+  CHECK(result->Get(context.local(), v8::Integer::New(isolate, 3))
+            .ToLocalChecked()
+            ->IsNull());
+  CHECK(result->Get(context.local(), v8::Integer::New(isolate, 4))
+            .ToLocalChecked()
+            ->IsUndefined());
 }
 
 
 THREADED_TEST(CatchZero) {
   LocalContext context;
   v8::HandleScope scope(context->GetIsolate());
-  v8::TryCatch try_catch;
+  v8::TryCatch try_catch(context->GetIsolate());
   CHECK(!try_catch.HasCaught());
   CompileRun("throw 10");
   CHECK(try_catch.HasCaught());
-  CHECK_EQ(10, try_catch.Exception()->Int32Value());
+  CHECK_EQ(10, try_catch.Exception()->Int32Value(context.local()).FromJust());
   try_catch.Reset();
   CHECK(!try_catch.HasCaught());
   CompileRun("throw 0");
   CHECK(try_catch.HasCaught());
-  CHECK_EQ(0, try_catch.Exception()->Int32Value());
+  CHECK_EQ(0, try_catch.Exception()->Int32Value(context.local()).FromJust());
 }
 
 
 THREADED_TEST(CatchExceptionFromWith) {
   LocalContext context;
   v8::HandleScope scope(context->GetIsolate());
-  v8::TryCatch try_catch;
+  v8::TryCatch try_catch(context->GetIsolate());
   CHECK(!try_catch.HasCaught());
   CompileRun("var o = {}; with (o) { throw 42; }");
   CHECK(try_catch.HasCaught());
@@ -5734,7 +6045,7 @@
 THREADED_TEST(TryCatchAndFinallyHidingException) {
   LocalContext context;
   v8::HandleScope scope(context->GetIsolate());
-  v8::TryCatch try_catch;
+  v8::TryCatch try_catch(context->GetIsolate());
   CHECK(!try_catch.HasCaught());
   CompileRun("function f(k) { try { this[k]; } finally { return 0; } };");
   CompileRun("f({toString: function() { throw 42; }});");
@@ -5743,7 +6054,7 @@
 
 
 void WithTryCatch(const v8::FunctionCallbackInfo<v8::Value>& args) {
-  v8::TryCatch try_catch;
+  v8::TryCatch try_catch(args.GetIsolate());
 }
 
 
@@ -5751,10 +6062,13 @@
   LocalContext context;
   v8::Isolate* isolate = context->GetIsolate();
   v8::HandleScope scope(isolate);
-  context->Global()->Set(
-      v8_str("native_with_try_catch"),
-      v8::FunctionTemplate::New(isolate, WithTryCatch)->GetFunction());
-  v8::TryCatch try_catch;
+  CHECK(context->Global()
+            ->Set(context.local(), v8_str("native_with_try_catch"),
+                  v8::FunctionTemplate::New(isolate, WithTryCatch)
+                      ->GetFunction(context.local())
+                      .ToLocalChecked())
+            .FromJust());
+  v8::TryCatch try_catch(isolate);
   CHECK(!try_catch.HasCaught());
   CompileRun(
       "try {\n"
@@ -5768,7 +6082,7 @@
 
 static void TryCatchNested1Helper(int depth) {
   if (depth > 0) {
-    v8::TryCatch try_catch;
+    v8::TryCatch try_catch(CcTest::isolate());
     try_catch.SetVerbose(true);
     TryCatchNested1Helper(depth - 1);
     CHECK(try_catch.HasCaught());
@@ -5781,7 +6095,7 @@
 
 static void TryCatchNested2Helper(int depth) {
   if (depth > 0) {
-    v8::TryCatch try_catch;
+    v8::TryCatch try_catch(CcTest::isolate());
     try_catch.SetVerbose(true);
     TryCatchNested2Helper(depth - 1);
     CHECK(try_catch.HasCaught());
@@ -5799,7 +6113,7 @@
 
   {
     // Test nested try-catch with a native throw in the end.
-    v8::TryCatch try_catch;
+    v8::TryCatch try_catch(context->GetIsolate());
     TryCatchNested1Helper(5);
     CHECK(try_catch.HasCaught());
     CHECK_EQ(0, strcmp(*v8::String::Utf8Value(try_catch.Exception()), "E1"));
@@ -5807,7 +6121,7 @@
 
   {
     // Test nested try-catch with a JavaScript throw in the end.
-    v8::TryCatch try_catch;
+    v8::TryCatch try_catch(context->GetIsolate());
     TryCatchNested2Helper(5);
     CHECK(try_catch.HasCaught());
     CHECK_EQ(0, strcmp(*v8::String::Utf8Value(try_catch.Exception()), "E2"));
@@ -5817,20 +6131,22 @@
 
 void TryCatchMixedNestingCheck(v8::TryCatch* try_catch) {
   CHECK(try_catch->HasCaught());
-  Handle<Message> message = try_catch->Message();
-  Handle<Value> resource = message->GetScriptOrigin().ResourceName();
+  Local<Message> message = try_catch->Message();
+  Local<Value> resource = message->GetScriptOrigin().ResourceName();
   CHECK_EQ(0, strcmp(*v8::String::Utf8Value(resource), "inner"));
-  CHECK_EQ(0, strcmp(*v8::String::Utf8Value(message->Get()),
-                     "Uncaught Error: a"));
-  CHECK_EQ(1, message->GetLineNumber());
-  CHECK_EQ(6, message->GetStartColumn());
+  CHECK_EQ(0,
+           strcmp(*v8::String::Utf8Value(message->Get()), "Uncaught Error: a"));
+  CHECK_EQ(1, message->GetLineNumber(CcTest::isolate()->GetCurrentContext())
+                  .FromJust());
+  CHECK_EQ(0, message->GetStartColumn(CcTest::isolate()->GetCurrentContext())
+                  .FromJust());
 }
 
 
 void TryCatchMixedNestingHelper(
     const v8::FunctionCallbackInfo<v8::Value>& args) {
   ApiTestFuzzer::Fuzz();
-  v8::TryCatch try_catch;
+  v8::TryCatch try_catch(args.GetIsolate());
   CompileRunWithOrigin("throw new Error('a');\n", "inner", 0, 0);
   CHECK(try_catch.HasCaught());
   TryCatchMixedNestingCheck(&try_catch);
@@ -5847,7 +6163,7 @@
   v8::Isolate* isolate = CcTest::isolate();
   v8::HandleScope scope(isolate);
   v8::V8::Initialize();
-  v8::TryCatch try_catch;
+  v8::TryCatch try_catch(isolate);
   Local<ObjectTemplate> templ = ObjectTemplate::New(isolate);
   templ->Set(v8_str("TryCatchMixedNestingHelper"),
              v8::FunctionTemplate::New(isolate, TryCatchMixedNestingHelper));
@@ -5859,7 +6175,7 @@
 
 void TryCatchNativeHelper(const v8::FunctionCallbackInfo<v8::Value>& args) {
   ApiTestFuzzer::Fuzz();
-  v8::TryCatch try_catch;
+  v8::TryCatch try_catch(args.GetIsolate());
   args.GetIsolate()->ThrowException(v8_str("boom"));
   CHECK(try_catch.HasCaught());
 }
@@ -5869,7 +6185,7 @@
   v8::Isolate* isolate = CcTest::isolate();
   v8::HandleScope scope(isolate);
   v8::V8::Initialize();
-  v8::TryCatch try_catch;
+  v8::TryCatch try_catch(isolate);
   Local<ObjectTemplate> templ = ObjectTemplate::New(isolate);
   templ->Set(v8_str("TryCatchNativeHelper"),
              v8::FunctionTemplate::New(isolate, TryCatchNativeHelper));
@@ -5882,7 +6198,7 @@
 void TryCatchNativeResetHelper(
     const v8::FunctionCallbackInfo<v8::Value>& args) {
   ApiTestFuzzer::Fuzz();
-  v8::TryCatch try_catch;
+  v8::TryCatch try_catch(args.GetIsolate());
   args.GetIsolate()->ThrowException(v8_str("boom"));
   CHECK(try_catch.HasCaught());
   try_catch.Reset();
@@ -5894,7 +6210,7 @@
   v8::Isolate* isolate = CcTest::isolate();
   v8::HandleScope scope(isolate);
   v8::V8::Initialize();
-  v8::TryCatch try_catch;
+  v8::TryCatch try_catch(isolate);
   Local<ObjectTemplate> templ = ObjectTemplate::New(isolate);
   templ->Set(v8_str("TryCatchNativeResetHelper"),
              v8::FunctionTemplate::New(isolate, TryCatchNativeResetHelper));
@@ -5909,14 +6225,14 @@
   v8::Isolate* isolate = context->GetIsolate();
   v8::HandleScope scope(context->GetIsolate());
   // Check that equality works at all before relying on CHECK_EQ
-  CHECK(v8_str("a")->Equals(v8_str("a")));
-  CHECK(!v8_str("a")->Equals(v8_str("b")));
+  CHECK(v8_str("a")->Equals(context.local(), v8_str("a")).FromJust());
+  CHECK(!v8_str("a")->Equals(context.local(), v8_str("b")).FromJust());
 
-  CHECK_EQ(v8_str("a"), v8_str("a"));
-  CHECK_NE(v8_str("a"), v8_str("b"));
-  CHECK_EQ(v8_num(1), v8_num(1));
-  CHECK_EQ(v8_num(1.00), v8_num(1));
-  CHECK_NE(v8_num(1), v8_num(2));
+  CHECK(v8_str("a")->Equals(context.local(), v8_str("a")).FromJust());
+  CHECK(!v8_str("a")->Equals(context.local(), v8_str("b")).FromJust());
+  CHECK(v8_num(1)->Equals(context.local(), v8_num(1)).FromJust());
+  CHECK(v8_num(1.00)->Equals(context.local(), v8_num(1)).FromJust());
+  CHECK(!v8_num(1)->Equals(context.local(), v8_num(2)).FromJust());
 
   // Assume String is not internalized.
   CHECK(v8_str("a")->StrictEquals(v8_str("a")));
@@ -5925,12 +6241,12 @@
   CHECK(v8_num(1)->StrictEquals(v8_num(1)));
   CHECK(!v8_num(1)->StrictEquals(v8_num(2)));
   CHECK(v8_num(0.0)->StrictEquals(v8_num(-0.0)));
-  Local<Value> not_a_number = v8_num(v8::base::OS::nan_value());
+  Local<Value> not_a_number = v8_num(std::numeric_limits<double>::quiet_NaN());
   CHECK(!not_a_number->StrictEquals(not_a_number));
   CHECK(v8::False(isolate)->StrictEquals(v8::False(isolate)));
   CHECK(!v8::False(isolate)->StrictEquals(v8::Undefined(isolate)));
 
-  v8::Handle<v8::Object> obj = v8::Object::New(isolate);
+  v8::Local<v8::Object> obj = v8::Object::New(isolate);
   v8::Persistent<v8::Object> alias(isolate, obj);
   CHECK(v8::Local<v8::Object>::New(isolate, alias)->StrictEquals(obj));
   alias.Reset();
@@ -5951,16 +6267,20 @@
   LocalContext context;
   v8::HandleScope scope(context->GetIsolate());
   Local<Script> script = v8_compile("x");
-  for (int i = 0; i < 10; i++)
-    script->Run();
+  for (int i = 0; i < 10; i++) {
+    script->Run(context.local()).IsEmpty();
+  }
 }
 
 
-static void GetXValue(Local<String> name,
+static void GetXValue(Local<Name> name,
                       const v8::PropertyCallbackInfo<v8::Value>& info) {
   ApiTestFuzzer::Fuzz();
-  CHECK_EQ(info.Data(), v8_str("donut"));
-  CHECK_EQ(name, v8_str("x"));
+  CHECK(info.Data()
+            ->Equals(CcTest::isolate()->GetCurrentContext(), v8_str("donut"))
+            .FromJust());
+  CHECK(name->Equals(CcTest::isolate()->GetCurrentContext(), v8_str("x"))
+            .FromJust());
   info.GetReturnValue().Set(name);
 }
 
@@ -5971,11 +6291,14 @@
   v8::HandleScope scope(isolate);
   Local<ObjectTemplate> templ = ObjectTemplate::New(isolate);
   templ->SetAccessor(v8_str("x"), GetXValue, NULL, v8_str("donut"));
-  context->Global()->Set(v8_str("obj"), templ->NewInstance());
+  CHECK(context->Global()
+            ->Set(context.local(), v8_str("obj"),
+                  templ->NewInstance(context.local()).ToLocalChecked())
+            .FromJust());
   Local<Script> script = v8_compile("obj.x");
   for (int i = 0; i < 10; i++) {
-    Local<Value> result = script->Run();
-    CHECK_EQ(result, v8_str("x"));
+    Local<Value> result = script->Run(context.local()).ToLocalChecked();
+    CHECK(result->Equals(context.local(), v8_str("x")).FromJust());
   }
 }
 
@@ -5986,15 +6309,18 @@
   v8::HandleScope scope(isolate);
   Local<ObjectTemplate> templ = ObjectTemplate::New(isolate);
   templ->SetAccessor(v8_str("x"), GetXValue, NULL, v8_str("donut"));
-  context->Global()->Set(v8_str("obj"), templ->NewInstance());
+  CHECK(context->Global()
+            ->Set(context.local(), v8_str("obj"),
+                  templ->NewInstance(context.local()).ToLocalChecked())
+            .FromJust());
 
   // Uses getOwnPropertyDescriptor to check the configurable status
   Local<Script> script_desc = v8_compile(
       "var prop = Object.getOwnPropertyDescriptor( "
       "obj, 'x');"
       "prop.configurable;");
-  Local<Value> result = script_desc->Run();
-  CHECK_EQ(result->BooleanValue(), true);
+  Local<Value> result = script_desc->Run(context.local()).ToLocalChecked();
+  CHECK_EQ(result->BooleanValue(context.local()).FromJust(), true);
 
   // Redefine get - but still configurable
   Local<Script> script_define = v8_compile(
@@ -6002,12 +6328,12 @@
       "            configurable: true };"
       "Object.defineProperty(obj, 'x', desc);"
       "obj.x");
-  result = script_define->Run();
-  CHECK_EQ(result, v8_num(42));
+  result = script_define->Run(context.local()).ToLocalChecked();
+  CHECK(result->Equals(context.local(), v8_num(42)).FromJust());
 
   // Check that the accessor is still configurable
-  result = script_desc->Run();
-  CHECK_EQ(result->BooleanValue(), true);
+  result = script_desc->Run(context.local()).ToLocalChecked();
+  CHECK_EQ(result->BooleanValue(context.local()).FromJust(), true);
 
   // Redefine to a non-configurable
   script_define = v8_compile(
@@ -6015,17 +6341,18 @@
       "             configurable: false };"
       "Object.defineProperty(obj, 'x', desc);"
       "obj.x");
-  result = script_define->Run();
-  CHECK_EQ(result, v8_num(43));
-  result = script_desc->Run();
-  CHECK_EQ(result->BooleanValue(), false);
+  result = script_define->Run(context.local()).ToLocalChecked();
+  CHECK(result->Equals(context.local(), v8_num(43)).FromJust());
+  result = script_desc->Run(context.local()).ToLocalChecked();
+  CHECK_EQ(result->BooleanValue(context.local()).FromJust(), false);
 
   // Make sure that it is not possible to redefine again
-  v8::TryCatch try_catch;
-  result = script_define->Run();
+  v8::TryCatch try_catch(isolate);
+  CHECK(script_define->Run(context.local()).IsEmpty());
   CHECK(try_catch.HasCaught());
   String::Utf8Value exception_value(try_catch.Exception());
-  CHECK_EQ(*exception_value, "TypeError: Cannot redefine property: x");
+  CHECK_EQ(0,
+           strcmp(*exception_value, "TypeError: Cannot redefine property: x"));
 }
 
 
@@ -6035,51 +6362,57 @@
   Local<ObjectTemplate> templ = ObjectTemplate::New(isolate);
   templ->SetAccessor(v8_str("x"), GetXValue, NULL, v8_str("donut"));
   LocalContext context;
-  context->Global()->Set(v8_str("obj"), templ->NewInstance());
+  CHECK(context->Global()
+            ->Set(context.local(), v8_str("obj"),
+                  templ->NewInstance(context.local()).ToLocalChecked())
+            .FromJust());
 
   Local<Script> script_desc = v8_compile(
       "var prop ="
       "Object.getOwnPropertyDescriptor( "
       "obj, 'x');"
       "prop.configurable;");
-  Local<Value> result = script_desc->Run();
-  CHECK_EQ(result->BooleanValue(), true);
+  Local<Value> result = script_desc->Run(context.local()).ToLocalChecked();
+  CHECK_EQ(result->BooleanValue(context.local()).FromJust(), true);
 
   Local<Script> script_define = v8_compile(
       "var desc = {get: function(){return 42; },"
       "            configurable: true };"
       "Object.defineProperty(obj, 'x', desc);"
       "obj.x");
-  result = script_define->Run();
-  CHECK_EQ(result, v8_num(42));
+  result = script_define->Run(context.local()).ToLocalChecked();
+  CHECK(result->Equals(context.local(), v8_num(42)).FromJust());
 
-
-  result = script_desc->Run();
-  CHECK_EQ(result->BooleanValue(), true);
-
+  result = script_desc->Run(context.local()).ToLocalChecked();
+  CHECK_EQ(result->BooleanValue(context.local()).FromJust(), true);
 
   script_define = v8_compile(
       "var desc = {get: function(){return 43; },"
       "            configurable: false };"
       "Object.defineProperty(obj, 'x', desc);"
       "obj.x");
-  result = script_define->Run();
-  CHECK_EQ(result, v8_num(43));
-  result = script_desc->Run();
+  result = script_define->Run(context.local()).ToLocalChecked();
+  CHECK(result->Equals(context.local(), v8_num(43)).FromJust());
 
-  CHECK_EQ(result->BooleanValue(), false);
+  result = script_desc->Run(context.local()).ToLocalChecked();
+  CHECK_EQ(result->BooleanValue(context.local()).FromJust(), false);
 
-  v8::TryCatch try_catch;
-  result = script_define->Run();
+  v8::TryCatch try_catch(isolate);
+  CHECK(script_define->Run(context.local()).IsEmpty());
   CHECK(try_catch.HasCaught());
   String::Utf8Value exception_value(try_catch.Exception());
-  CHECK_EQ(*exception_value, "TypeError: Cannot redefine property: x");
+  CHECK_EQ(0,
+           strcmp(*exception_value, "TypeError: Cannot redefine property: x"));
 }
 
 
-static v8::Handle<v8::Object> GetGlobalProperty(LocalContext* context,
-                                                char const* name) {
-  return v8::Handle<v8::Object>::Cast((*context)->Global()->Get(v8_str(name)));
+static v8::Local<v8::Object> GetGlobalProperty(LocalContext* context,
+                                               char const* name) {
+  return v8::Local<v8::Object>::Cast(
+      (*context)
+          ->Global()
+          ->Get(CcTest::isolate()->GetCurrentContext(), v8_str(name))
+          .ToLocalChecked());
 }
 
 
@@ -6089,20 +6422,27 @@
   Local<ObjectTemplate> templ = ObjectTemplate::New(isolate);
   LocalContext context;
 
-  context->Global()->Set(v8_str("obj1"), templ->NewInstance());
+  CHECK(context->Global()
+            ->Set(context.local(), v8_str("obj1"),
+                  templ->NewInstance(context.local()).ToLocalChecked())
+            .FromJust());
   CompileRun("var obj2 = {};");
 
   CHECK(CompileRun("obj1.x")->IsUndefined());
   CHECK(CompileRun("obj2.x")->IsUndefined());
 
-  CHECK(GetGlobalProperty(&context, "obj1")->
-      SetAccessor(v8_str("x"), GetXValue, NULL, v8_str("donut")));
+  CHECK(GetGlobalProperty(&context, "obj1")
+            ->SetAccessor(context.local(), v8_str("x"), GetXValue, NULL,
+                          v8_str("donut"))
+            .FromJust());
 
   ExpectString("obj1.x", "x");
   CHECK(CompileRun("obj2.x")->IsUndefined());
 
-  CHECK(GetGlobalProperty(&context, "obj2")->
-      SetAccessor(v8_str("x"), GetXValue, NULL, v8_str("donut")));
+  CHECK(GetGlobalProperty(&context, "obj2")
+            ->SetAccessor(context.local(), v8_str("x"), GetXValue, NULL,
+                          v8_str("donut"))
+            .FromJust());
 
   ExpectString("obj1.x", "x");
   ExpectString("obj2.x", "x");
@@ -6110,14 +6450,16 @@
   ExpectTrue("Object.getOwnPropertyDescriptor(obj1, 'x').configurable");
   ExpectTrue("Object.getOwnPropertyDescriptor(obj2, 'x').configurable");
 
-  CompileRun("Object.defineProperty(obj1, 'x',"
-             "{ get: function() { return 'y'; }, configurable: true })");
+  CompileRun(
+      "Object.defineProperty(obj1, 'x',"
+      "{ get: function() { return 'y'; }, configurable: true })");
 
   ExpectString("obj1.x", "y");
   ExpectString("obj2.x", "x");
 
-  CompileRun("Object.defineProperty(obj2, 'x',"
-             "{ get: function() { return 'y'; }, configurable: true })");
+  CompileRun(
+      "Object.defineProperty(obj2, 'x',"
+      "{ get: function() { return 'y'; }, configurable: true })");
 
   ExpectString("obj1.x", "y");
   ExpectString("obj2.x", "y");
@@ -6125,10 +6467,14 @@
   ExpectTrue("Object.getOwnPropertyDescriptor(obj1, 'x').configurable");
   ExpectTrue("Object.getOwnPropertyDescriptor(obj2, 'x').configurable");
 
-  CHECK(GetGlobalProperty(&context, "obj1")->
-      SetAccessor(v8_str("x"), GetXValue, NULL, v8_str("donut")));
-  CHECK(GetGlobalProperty(&context, "obj2")->
-      SetAccessor(v8_str("x"), GetXValue, NULL, v8_str("donut")));
+  CHECK(GetGlobalProperty(&context, "obj1")
+            ->SetAccessor(context.local(), v8_str("x"), GetXValue, NULL,
+                          v8_str("donut"))
+            .FromJust());
+  CHECK(GetGlobalProperty(&context, "obj2")
+            ->SetAccessor(context.local(), v8_str("x"), GetXValue, NULL,
+                          v8_str("donut"))
+            .FromJust());
 
   ExpectString("obj1.x", "x");
   ExpectString("obj2.x", "x");
@@ -6137,21 +6483,26 @@
   ExpectTrue("Object.getOwnPropertyDescriptor(obj2, 'x').configurable");
 
   // Define getters/setters, but now make them not configurable.
-  CompileRun("Object.defineProperty(obj1, 'x',"
-             "{ get: function() { return 'z'; }, configurable: false })");
-  CompileRun("Object.defineProperty(obj2, 'x',"
-             "{ get: function() { return 'z'; }, configurable: false })");
-
+  CompileRun(
+      "Object.defineProperty(obj1, 'x',"
+      "{ get: function() { return 'z'; }, configurable: false })");
+  CompileRun(
+      "Object.defineProperty(obj2, 'x',"
+      "{ get: function() { return 'z'; }, configurable: false })");
   ExpectTrue("!Object.getOwnPropertyDescriptor(obj1, 'x').configurable");
   ExpectTrue("!Object.getOwnPropertyDescriptor(obj2, 'x').configurable");
 
   ExpectString("obj1.x", "z");
   ExpectString("obj2.x", "z");
 
-  CHECK(!GetGlobalProperty(&context, "obj1")->
-      SetAccessor(v8_str("x"), GetXValue, NULL, v8_str("donut")));
-  CHECK(!GetGlobalProperty(&context, "obj2")->
-      SetAccessor(v8_str("x"), GetXValue, NULL, v8_str("donut")));
+  CHECK(GetGlobalProperty(&context, "obj1")
+            ->SetAccessor(context.local(), v8_str("x"), GetXValue, NULL,
+                          v8_str("donut"))
+            .IsNothing());
+  CHECK(GetGlobalProperty(&context, "obj2")
+            ->SetAccessor(context.local(), v8_str("x"), GetXValue, NULL,
+                          v8_str("donut"))
+            .IsNothing());
 
   ExpectString("obj1.x", "z");
   ExpectString("obj2.x", "z");
@@ -6164,17 +6515,20 @@
   Local<ObjectTemplate> templ = ObjectTemplate::New(isolate);
   LocalContext context;
 
-  context->Global()->Set(v8_str("obj1"), templ->NewInstance());
+  CHECK(context->Global()
+            ->Set(context.local(), v8_str("obj1"),
+                  templ->NewInstance(context.local()).ToLocalChecked())
+            .FromJust());
   CompileRun("var obj2 = {};");
 
-  CHECK(GetGlobalProperty(&context, "obj1")->SetAccessor(
-        v8_str("x"),
-        GetXValue, NULL,
-        v8_str("donut"), v8::DEFAULT, v8::DontDelete));
-  CHECK(GetGlobalProperty(&context, "obj2")->SetAccessor(
-        v8_str("x"),
-        GetXValue, NULL,
-        v8_str("donut"), v8::DEFAULT, v8::DontDelete));
+  CHECK(GetGlobalProperty(&context, "obj1")
+            ->SetAccessor(context.local(), v8_str("x"), GetXValue, NULL,
+                          v8_str("donut"), v8::DEFAULT, v8::DontDelete)
+            .FromJust());
+  CHECK(GetGlobalProperty(&context, "obj2")
+            ->SetAccessor(context.local(), v8_str("x"), GetXValue, NULL,
+                          v8_str("donut"), v8::DEFAULT, v8::DontDelete)
+            .FromJust());
 
   ExpectString("obj1.x", "x");
   ExpectString("obj2.x", "x");
@@ -6182,35 +6536,46 @@
   ExpectTrue("!Object.getOwnPropertyDescriptor(obj1, 'x').configurable");
   ExpectTrue("!Object.getOwnPropertyDescriptor(obj2, 'x').configurable");
 
-  CHECK(!GetGlobalProperty(&context, "obj1")->
-      SetAccessor(v8_str("x"), GetXValue, NULL, v8_str("donut")));
-  CHECK(!GetGlobalProperty(&context, "obj2")->
-      SetAccessor(v8_str("x"), GetXValue, NULL, v8_str("donut")));
+  CHECK(GetGlobalProperty(&context, "obj1")
+            ->SetAccessor(context.local(), v8_str("x"), GetXValue, NULL,
+                          v8_str("donut"))
+            .IsNothing());
+  CHECK(GetGlobalProperty(&context, "obj2")
+            ->SetAccessor(context.local(), v8_str("x"), GetXValue, NULL,
+                          v8_str("donut"))
+            .IsNothing());
 
   {
-    v8::TryCatch try_catch;
-    CompileRun("Object.defineProperty(obj1, 'x',"
+    v8::TryCatch try_catch(isolate);
+    CompileRun(
+        "Object.defineProperty(obj1, 'x',"
         "{get: function() { return 'func'; }})");
     CHECK(try_catch.HasCaught());
     String::Utf8Value exception_value(try_catch.Exception());
-    CHECK_EQ(*exception_value, "TypeError: Cannot redefine property: x");
+    CHECK_EQ(
+        0, strcmp(*exception_value, "TypeError: Cannot redefine property: x"));
   }
   {
-    v8::TryCatch try_catch;
-    CompileRun("Object.defineProperty(obj2, 'x',"
+    v8::TryCatch try_catch(isolate);
+    CompileRun(
+        "Object.defineProperty(obj2, 'x',"
         "{get: function() { return 'func'; }})");
     CHECK(try_catch.HasCaught());
     String::Utf8Value exception_value(try_catch.Exception());
-    CHECK_EQ(*exception_value, "TypeError: Cannot redefine property: x");
+    CHECK_EQ(
+        0, strcmp(*exception_value, "TypeError: Cannot redefine property: x"));
   }
 }
 
 
-static void Get239Value(Local<String> name,
+static void Get239Value(Local<Name> name,
                         const v8::PropertyCallbackInfo<v8::Value>& info) {
   ApiTestFuzzer::Fuzz();
-  CHECK_EQ(info.Data(), v8_str("donut"));
-  CHECK_EQ(name, v8_str("239"));
+  CHECK(info.Data()
+            ->Equals(info.GetIsolate()->GetCurrentContext(), v8_str("donut"))
+            .FromJust());
+  CHECK(name->Equals(info.GetIsolate()->GetCurrentContext(), v8_str("239"))
+            .FromJust());
   info.GetReturnValue().Set(name);
 }
 
@@ -6221,17 +6586,20 @@
   Local<ObjectTemplate> templ = ObjectTemplate::New(isolate);
   LocalContext context;
 
-  context->Global()->Set(v8_str("obj1"), templ->NewInstance());
+  CHECK(context->Global()
+            ->Set(context.local(), v8_str("obj1"),
+                  templ->NewInstance(context.local()).ToLocalChecked())
+            .FromJust());
   CompileRun("var obj2 = {};");
 
-  CHECK(GetGlobalProperty(&context, "obj1")->SetAccessor(
-        v8_str("239"),
-        Get239Value, NULL,
-        v8_str("donut")));
-  CHECK(GetGlobalProperty(&context, "obj2")->SetAccessor(
-        v8_str("239"),
-        Get239Value, NULL,
-        v8_str("donut")));
+  CHECK(GetGlobalProperty(&context, "obj1")
+            ->SetAccessor(context.local(), v8_str("239"), Get239Value, NULL,
+                          v8_str("donut"))
+            .FromJust());
+  CHECK(GetGlobalProperty(&context, "obj2")
+            ->SetAccessor(context.local(), v8_str("239"), Get239Value, NULL,
+                          v8_str("donut"))
+            .FromJust());
 
   ExpectString("obj1[239]", "239");
   ExpectString("obj2[239]", "239");
@@ -6243,12 +6611,12 @@
 v8::Persistent<Value> xValue;
 
 
-static void SetXValue(Local<String> name,
-                      Local<Value> value,
+static void SetXValue(Local<Name> name, Local<Value> value,
                       const v8::PropertyCallbackInfo<void>& info) {
-  CHECK_EQ(value, v8_num(4));
-  CHECK_EQ(info.Data(), v8_str("donut"));
-  CHECK_EQ(name, v8_str("x"));
+  Local<Context> context = info.GetIsolate()->GetCurrentContext();
+  CHECK(value->Equals(context, v8_num(4)).FromJust());
+  CHECK(info.Data()->Equals(context, v8_str("donut")).FromJust());
+  CHECK(name->Equals(context, v8_str("x")).FromJust());
   CHECK(xValue.IsEmpty());
   xValue.Reset(info.GetIsolate(), value);
 }
@@ -6260,12 +6628,18 @@
   Local<ObjectTemplate> templ = ObjectTemplate::New(isolate);
   templ->SetAccessor(v8_str("x"), GetXValue, SetXValue, v8_str("donut"));
   LocalContext context;
-  context->Global()->Set(v8_str("obj"), templ->NewInstance());
+  CHECK(context->Global()
+            ->Set(context.local(), v8_str("obj"),
+                  templ->NewInstance(context.local()).ToLocalChecked())
+            .FromJust());
   Local<Script> script = v8_compile("obj.x = 4");
   for (int i = 0; i < 10; i++) {
     CHECK(xValue.IsEmpty());
-    script->Run();
-    CHECK_EQ(v8_num(4), Local<Value>::New(CcTest::isolate(), xValue));
+    script->Run(context.local()).ToLocalChecked();
+    CHECK(v8_num(4)
+              ->Equals(context.local(),
+                       Local<Value>::New(CcTest::isolate(), xValue))
+              .FromJust());
     xValue.Reset();
   }
 }
@@ -6277,12 +6651,18 @@
   Local<ObjectTemplate> templ = ObjectTemplate::New(isolate);
   templ->SetAccessor(v8_str("x"), NULL, SetXValue, v8_str("donut"));
   LocalContext context;
-  context->Global()->Set(v8_str("obj"), templ->NewInstance());
+  CHECK(context->Global()
+            ->Set(context.local(), v8_str("obj"),
+                  templ->NewInstance(context.local()).ToLocalChecked())
+            .FromJust());
   Local<Script> script = v8_compile("obj.x = 4; obj.x");
   for (int i = 0; i < 10; i++) {
     CHECK(xValue.IsEmpty());
-    script->Run();
-    CHECK_EQ(v8_num(4), Local<Value>::New(CcTest::isolate(), xValue));
+    script->Run(context.local()).ToLocalChecked();
+    CHECK(v8_num(4)
+              ->Equals(context.local(),
+                       Local<Value>::New(CcTest::isolate(), xValue))
+              .FromJust());
     xValue.Reset();
   }
 }
@@ -6292,644 +6672,69 @@
   v8::Isolate* isolate = CcTest::isolate();
   v8::HandleScope scope(isolate);
   Local<ObjectTemplate> templ = ObjectTemplate::New(isolate);
-  templ->SetAccessor(v8_str("x"),
-                     static_cast<v8::AccessorGetterCallback>(NULL),
-                     NULL,
-                     v8_str("donut"));
+  templ->SetAccessor(v8_str("x"), static_cast<v8::AccessorGetterCallback>(NULL),
+                     NULL, v8_str("donut"));
   LocalContext context;
-  context->Global()->Set(v8_str("obj"), templ->NewInstance());
+  CHECK(context->Global()
+            ->Set(context.local(), v8_str("obj"),
+                  templ->NewInstance(context.local()).ToLocalChecked())
+            .FromJust());
   Local<Script> script = v8_compile("obj.x = 4; obj.x");
   for (int i = 0; i < 10; i++) {
-    script->Run();
+    script->Run(context.local()).ToLocalChecked();
   }
 }
 
 
-static void XPropertyGetter(Local<Name> property,
-                            const v8::PropertyCallbackInfo<v8::Value>& info) {
-  ApiTestFuzzer::Fuzz();
-  CHECK(info.Data()->IsUndefined());
-  info.GetReturnValue().Set(property);
-}
-
-
-THREADED_TEST(NamedInterceptorPropertyRead) {
-  v8::Isolate* isolate = CcTest::isolate();
-  v8::HandleScope scope(isolate);
-  Local<ObjectTemplate> templ = ObjectTemplate::New(isolate);
-  templ->SetHandler(v8::NamedPropertyHandlerConfiguration(XPropertyGetter));
-  LocalContext context;
-  context->Global()->Set(v8_str("obj"), templ->NewInstance());
-  Local<Script> script = v8_compile("obj.x");
-  for (int i = 0; i < 10; i++) {
-    Local<Value> result = script->Run();
-    CHECK_EQ(result, v8_str("x"));
-  }
-}
-
-
-THREADED_TEST(NamedInterceptorDictionaryIC) {
-  v8::Isolate* isolate = CcTest::isolate();
-  v8::HandleScope scope(isolate);
-  Local<ObjectTemplate> templ = ObjectTemplate::New(isolate);
-  templ->SetHandler(v8::NamedPropertyHandlerConfiguration(XPropertyGetter));
-  LocalContext context;
-  // Create an object with a named interceptor.
-  context->Global()->Set(v8_str("interceptor_obj"), templ->NewInstance());
-  Local<Script> script = v8_compile("interceptor_obj.x");
-  for (int i = 0; i < 10; i++) {
-    Local<Value> result = script->Run();
-    CHECK_EQ(result, v8_str("x"));
-  }
-  // Create a slow case object and a function accessing a property in
-  // that slow case object (with dictionary probing in generated
-  // code). Then force object with a named interceptor into slow-case,
-  // pass it to the function, and check that the interceptor is called
-  // instead of accessing the local property.
-  Local<Value> result =
-      CompileRun("function get_x(o) { return o.x; };"
-                 "var obj = { x : 42, y : 0 };"
-                 "delete obj.y;"
-                 "for (var i = 0; i < 10; i++) get_x(obj);"
-                 "interceptor_obj.x = 42;"
-                 "interceptor_obj.y = 10;"
-                 "delete interceptor_obj.y;"
-                 "get_x(interceptor_obj)");
-  CHECK_EQ(result, v8_str("x"));
-}
-
-
-THREADED_TEST(NamedInterceptorDictionaryICMultipleContext) {
-  v8::Isolate* isolate = CcTest::isolate();
-  v8::HandleScope scope(isolate);
-  v8::Local<Context> context1 = Context::New(isolate);
-
-  context1->Enter();
-  Local<ObjectTemplate> templ = ObjectTemplate::New(isolate);
-  templ->SetHandler(v8::NamedPropertyHandlerConfiguration(XPropertyGetter));
-  // Create an object with a named interceptor.
-  v8::Local<v8::Object> object = templ->NewInstance();
-  context1->Global()->Set(v8_str("interceptor_obj"), object);
-
-  // Force the object into the slow case.
-  CompileRun("interceptor_obj.y = 0;"
-             "delete interceptor_obj.y;");
-  context1->Exit();
-
-  {
-    // Introduce the object into a different context.
-    // Repeat named loads to exercise ICs.
-    LocalContext context2;
-    context2->Global()->Set(v8_str("interceptor_obj"), object);
-    Local<Value> result =
-      CompileRun("function get_x(o) { return o.x; }"
-                 "interceptor_obj.x = 42;"
-                 "for (var i=0; i != 10; i++) {"
-                 "  get_x(interceptor_obj);"
-                 "}"
-                 "get_x(interceptor_obj)");
-    // Check that the interceptor was actually invoked.
-    CHECK_EQ(result, v8_str("x"));
-  }
-
-  // Return to the original context and force some object to the slow case
-  // to cause the NormalizedMapCache to verify.
-  context1->Enter();
-  CompileRun("var obj = { x : 0 }; delete obj.x;");
-  context1->Exit();
-}
-
-
-static void SetXOnPrototypeGetter(
-    Local<Name> property, const v8::PropertyCallbackInfo<v8::Value>& info) {
-  // Set x on the prototype object and do not handle the get request.
-  v8::Handle<v8::Value> proto = info.Holder()->GetPrototype();
-  proto.As<v8::Object>()->Set(v8_str("x"),
-                              v8::Integer::New(info.GetIsolate(), 23));
-}
-
-
-// This is a regression test for http://crbug.com/20104. Map
-// transitions should not interfere with post interceptor lookup.
-THREADED_TEST(NamedInterceptorMapTransitionRead) {
-  v8::Isolate* isolate = CcTest::isolate();
-  v8::HandleScope scope(isolate);
-  Local<v8::FunctionTemplate> function_template =
-      v8::FunctionTemplate::New(isolate);
-  Local<v8::ObjectTemplate> instance_template
-      = function_template->InstanceTemplate();
-  instance_template->SetHandler(
-      v8::NamedPropertyHandlerConfiguration(SetXOnPrototypeGetter));
-  LocalContext context;
-  context->Global()->Set(v8_str("F"), function_template->GetFunction());
-  // Create an instance of F and introduce a map transition for x.
-  CompileRun("var o = new F(); o.x = 23;");
-  // Create an instance of F and invoke the getter. The result should be 23.
-  Local<Value> result = CompileRun("o = new F(); o.x");
-  CHECK_EQ(result->Int32Value(), 23);
-}
-
-
-static void IndexedPropertyGetter(
-    uint32_t index,
-    const v8::PropertyCallbackInfo<v8::Value>& info) {
-  ApiTestFuzzer::Fuzz();
-  if (index == 37) {
-    info.GetReturnValue().Set(v8_num(625));
-  }
-}
-
-
-static void IndexedPropertySetter(
-    uint32_t index,
-    Local<Value> value,
-    const v8::PropertyCallbackInfo<v8::Value>& info) {
-  ApiTestFuzzer::Fuzz();
-  if (index == 39) {
-    info.GetReturnValue().Set(value);
-  }
-}
-
-
-THREADED_TEST(IndexedInterceptorWithIndexedAccessor) {
-  v8::Isolate* isolate = CcTest::isolate();
-  v8::HandleScope scope(isolate);
-  Local<ObjectTemplate> templ = ObjectTemplate::New(isolate);
-  templ->SetHandler(v8::IndexedPropertyHandlerConfiguration(
-      IndexedPropertyGetter, IndexedPropertySetter));
-  LocalContext context;
-  context->Global()->Set(v8_str("obj"), templ->NewInstance());
-  Local<Script> getter_script = v8_compile(
-      "obj.__defineGetter__(\"3\", function(){return 5;});obj[3];");
-  Local<Script> setter_script = v8_compile(
-      "obj.__defineSetter__(\"17\", function(val){this.foo = val;});"
-      "obj[17] = 23;"
-      "obj.foo;");
-  Local<Script> interceptor_setter_script = v8_compile(
-      "obj.__defineSetter__(\"39\", function(val){this.foo = \"hit\";});"
-      "obj[39] = 47;"
-      "obj.foo;");  // This setter should not run, due to the interceptor.
-  Local<Script> interceptor_getter_script = v8_compile(
-      "obj[37];");
-  Local<Value> result = getter_script->Run();
-  CHECK_EQ(v8_num(5), result);
-  result = setter_script->Run();
-  CHECK_EQ(v8_num(23), result);
-  result = interceptor_setter_script->Run();
-  CHECK_EQ(v8_num(23), result);
-  result = interceptor_getter_script->Run();
-  CHECK_EQ(v8_num(625), result);
-}
-
-
-static void UnboxedDoubleIndexedPropertyGetter(
-    uint32_t index,
-    const v8::PropertyCallbackInfo<v8::Value>& info) {
-  ApiTestFuzzer::Fuzz();
-  if (index < 25) {
-    info.GetReturnValue().Set(v8_num(index));
-  }
-}
-
-
-static void UnboxedDoubleIndexedPropertySetter(
-    uint32_t index,
-    Local<Value> value,
-    const v8::PropertyCallbackInfo<v8::Value>& info) {
-  ApiTestFuzzer::Fuzz();
-  if (index < 25) {
-    info.GetReturnValue().Set(v8_num(index));
-  }
-}
-
-
-void UnboxedDoubleIndexedPropertyEnumerator(
-    const v8::PropertyCallbackInfo<v8::Array>& info) {
-  // Force the list of returned keys to be stored in a FastDoubleArray.
-  Local<Script> indexed_property_names_script = v8_compile(
-      "keys = new Array(); keys[125000] = 1;"
-      "for(i = 0; i < 80000; i++) { keys[i] = i; };"
-      "keys.length = 25; keys;");
-  Local<Value> result = indexed_property_names_script->Run();
-  info.GetReturnValue().Set(Local<v8::Array>::Cast(result));
-}
-
-
-// Make sure that the the interceptor code in the runtime properly handles
-// merging property name lists for double-array-backed arrays.
-THREADED_TEST(IndexedInterceptorUnboxedDoubleWithIndexedAccessor) {
-  v8::Isolate* isolate = CcTest::isolate();
-  v8::HandleScope scope(isolate);
-  Local<ObjectTemplate> templ = ObjectTemplate::New(isolate);
-  templ->SetHandler(v8::IndexedPropertyHandlerConfiguration(
-      UnboxedDoubleIndexedPropertyGetter, UnboxedDoubleIndexedPropertySetter, 0,
-      0, UnboxedDoubleIndexedPropertyEnumerator));
-  LocalContext context;
-  context->Global()->Set(v8_str("obj"), templ->NewInstance());
-  // When obj is created, force it to be Stored in a FastDoubleArray.
-  Local<Script> create_unboxed_double_script = v8_compile(
-      "obj[125000] = 1; for(i = 0; i < 80000; i+=2) { obj[i] = i; } "
-      "key_count = 0; "
-      "for (x in obj) {key_count++;};"
-      "obj;");
-  Local<Value> result = create_unboxed_double_script->Run();
-  CHECK(result->ToObject(isolate)->HasRealIndexedProperty(2000));
-  Local<Script> key_count_check = v8_compile("key_count;");
-  result = key_count_check->Run();
-  CHECK_EQ(v8_num(40013), result);
-}
-
-
-void SloppyArgsIndexedPropertyEnumerator(
-    const v8::PropertyCallbackInfo<v8::Array>& info) {
-  // Force the list of returned keys to be stored in a Arguments object.
-  Local<Script> indexed_property_names_script = v8_compile(
-      "function f(w,x) {"
-      " return arguments;"
-      "}"
-      "keys = f(0, 1, 2, 3);"
-      "keys;");
-  Local<Object> result =
-      Local<Object>::Cast(indexed_property_names_script->Run());
-  // Have to populate the handle manually, as it's not Cast-able.
-  i::Handle<i::JSObject> o =
-      v8::Utils::OpenHandle<Object, i::JSObject>(result);
-  i::Handle<i::JSArray> array(reinterpret_cast<i::JSArray*>(*o));
-  info.GetReturnValue().Set(v8::Utils::ToLocal(array));
-}
-
-
-static void SloppyIndexedPropertyGetter(
-    uint32_t index,
-    const v8::PropertyCallbackInfo<v8::Value>& info) {
-  ApiTestFuzzer::Fuzz();
-  if (index < 4) {
-    info.GetReturnValue().Set(v8_num(index));
-  }
-}
-
-
-// Make sure that the the interceptor code in the runtime properly handles
-// merging property name lists for non-string arguments arrays.
-THREADED_TEST(IndexedInterceptorSloppyArgsWithIndexedAccessor) {
-  v8::Isolate* isolate = CcTest::isolate();
-  v8::HandleScope scope(isolate);
-  Local<ObjectTemplate> templ = ObjectTemplate::New(isolate);
-  templ->SetHandler(v8::IndexedPropertyHandlerConfiguration(
-      SloppyIndexedPropertyGetter, 0, 0, 0,
-      SloppyArgsIndexedPropertyEnumerator));
-  LocalContext context;
-  context->Global()->Set(v8_str("obj"), templ->NewInstance());
-  Local<Script> create_args_script = v8_compile(
-      "var key_count = 0;"
-      "for (x in obj) {key_count++;} key_count;");
-  Local<Value> result = create_args_script->Run();
-  CHECK_EQ(v8_num(4), result);
-}
-
-
-static void IdentityIndexedPropertyGetter(
-    uint32_t index,
-    const v8::PropertyCallbackInfo<v8::Value>& info) {
-  info.GetReturnValue().Set(index);
-}
-
-
-THREADED_TEST(IndexedInterceptorWithGetOwnPropertyDescriptor) {
-  v8::Isolate* isolate = CcTest::isolate();
-  v8::HandleScope scope(isolate);
-  Local<ObjectTemplate> templ = ObjectTemplate::New(isolate);
-  templ->SetHandler(
-      v8::IndexedPropertyHandlerConfiguration(IdentityIndexedPropertyGetter));
-
-  LocalContext context;
-  context->Global()->Set(v8_str("obj"), templ->NewInstance());
-
-  // Check fast object case.
-  const char* fast_case_code =
-      "Object.getOwnPropertyDescriptor(obj, 0).value.toString()";
-  ExpectString(fast_case_code, "0");
-
-  // Check slow case.
-  const char* slow_case_code =
-      "obj.x = 1; delete obj.x;"
-      "Object.getOwnPropertyDescriptor(obj, 1).value.toString()";
-  ExpectString(slow_case_code, "1");
-}
-
-
-THREADED_TEST(IndexedInterceptorWithNoSetter) {
-  v8::Isolate* isolate = CcTest::isolate();
-  v8::HandleScope scope(isolate);
-  Local<ObjectTemplate> templ = ObjectTemplate::New(isolate);
-  templ->SetHandler(
-      v8::IndexedPropertyHandlerConfiguration(IdentityIndexedPropertyGetter));
-
-  LocalContext context;
-  context->Global()->Set(v8_str("obj"), templ->NewInstance());
-
-  const char* code =
-      "try {"
-      "  obj[0] = 239;"
-      "  for (var i = 0; i < 100; i++) {"
-      "    var v = obj[0];"
-      "    if (v != 0) throw 'Wrong value ' + v + ' at iteration ' + i;"
-      "  }"
-      "  'PASSED'"
-      "} catch(e) {"
-      "  e"
-      "}";
-  ExpectString(code, "PASSED");
-}
-
-
-THREADED_TEST(IndexedInterceptorWithAccessorCheck) {
-  v8::Isolate* isolate = CcTest::isolate();
-  v8::HandleScope scope(isolate);
-  Local<ObjectTemplate> templ = ObjectTemplate::New(isolate);
-  templ->SetHandler(
-      v8::IndexedPropertyHandlerConfiguration(IdentityIndexedPropertyGetter));
-
-  LocalContext context;
-  Local<v8::Object> obj = templ->NewInstance();
-  obj->TurnOnAccessCheck();
-  context->Global()->Set(v8_str("obj"), obj);
-
-  const char* code =
-      "var result = 'PASSED';"
-      "for (var i = 0; i < 100; i++) {"
-      "  try {"
-      "    var v = obj[0];"
-      "    result = 'Wrong value ' + v + ' at iteration ' + i;"
-      "    break;"
-      "  } catch (e) {"
-      "    /* pass */"
-      "  }"
-      "}"
-      "result";
-  ExpectString(code, "PASSED");
-}
-
-
-THREADED_TEST(IndexedInterceptorWithAccessorCheckSwitchedOn) {
-  i::FLAG_allow_natives_syntax = true;
-  v8::Isolate* isolate = CcTest::isolate();
-  v8::HandleScope scope(isolate);
-  Local<ObjectTemplate> templ = ObjectTemplate::New(isolate);
-  templ->SetHandler(
-      v8::IndexedPropertyHandlerConfiguration(IdentityIndexedPropertyGetter));
-
-  LocalContext context;
-  Local<v8::Object> obj = templ->NewInstance();
-  context->Global()->Set(v8_str("obj"), obj);
-
-  const char* code =
-      "var result = 'PASSED';"
-      "for (var i = 0; i < 100; i++) {"
-      "  var expected = i;"
-      "  if (i == 5) {"
-      "    %EnableAccessChecks(obj);"
-      "  }"
-      "  try {"
-      "    var v = obj[i];"
-      "    if (i == 5) {"
-      "      result = 'Should not have reached this!';"
-      "      break;"
-      "    } else if (v != expected) {"
-      "      result = 'Wrong value ' + v + ' at iteration ' + i;"
-      "      break;"
-      "    }"
-      "  } catch (e) {"
-      "    if (i != 5) {"
-      "      result = e;"
-      "    }"
-      "  }"
-      "  if (i == 5) %DisableAccessChecks(obj);"
-      "}"
-      "result";
-  ExpectString(code, "PASSED");
-}
-
-
-THREADED_TEST(IndexedInterceptorWithDifferentIndices) {
-  v8::Isolate* isolate = CcTest::isolate();
-  v8::HandleScope scope(isolate);
-  Local<ObjectTemplate> templ = ObjectTemplate::New(isolate);
-  templ->SetHandler(
-      v8::IndexedPropertyHandlerConfiguration(IdentityIndexedPropertyGetter));
-
-  LocalContext context;
-  Local<v8::Object> obj = templ->NewInstance();
-  context->Global()->Set(v8_str("obj"), obj);
-
-  const char* code =
-      "try {"
-      "  for (var i = 0; i < 100; i++) {"
-      "    var v = obj[i];"
-      "    if (v != i) throw 'Wrong value ' + v + ' at iteration ' + i;"
-      "  }"
-      "  'PASSED'"
-      "} catch(e) {"
-      "  e"
-      "}";
-  ExpectString(code, "PASSED");
-}
-
-
-THREADED_TEST(IndexedInterceptorWithNegativeIndices) {
-  v8::Isolate* isolate = CcTest::isolate();
-  v8::HandleScope scope(isolate);
-  Local<ObjectTemplate> templ = ObjectTemplate::New(isolate);
-  templ->SetHandler(
-      v8::IndexedPropertyHandlerConfiguration(IdentityIndexedPropertyGetter));
-
-  LocalContext context;
-  Local<v8::Object> obj = templ->NewInstance();
-  context->Global()->Set(v8_str("obj"), obj);
-
-  const char* code =
-      "try {"
-      "  for (var i = 0; i < 100; i++) {"
-      "    var expected = i;"
-      "    var key = i;"
-      "    if (i == 25) {"
-      "       key = -1;"
-      "       expected = undefined;"
-      "    }"
-      "    if (i == 50) {"
-      "       /* probe minimal Smi number on 32-bit platforms */"
-      "       key = -(1 << 30);"
-      "       expected = undefined;"
-      "    }"
-      "    if (i == 75) {"
-      "       /* probe minimal Smi number on 64-bit platforms */"
-      "       key = 1 << 31;"
-      "       expected = undefined;"
-      "    }"
-      "    var v = obj[key];"
-      "    if (v != expected) throw 'Wrong value ' + v + ' at iteration ' + i;"
-      "  }"
-      "  'PASSED'"
-      "} catch(e) {"
-      "  e"
-      "}";
-  ExpectString(code, "PASSED");
-}
-
-
-THREADED_TEST(IndexedInterceptorWithNotSmiLookup) {
-  v8::Isolate* isolate = CcTest::isolate();
-  v8::HandleScope scope(isolate);
-  Local<ObjectTemplate> templ = ObjectTemplate::New(isolate);
-  templ->SetHandler(
-      v8::IndexedPropertyHandlerConfiguration(IdentityIndexedPropertyGetter));
-
-  LocalContext context;
-  Local<v8::Object> obj = templ->NewInstance();
-  context->Global()->Set(v8_str("obj"), obj);
-
-  const char* code =
-      "try {"
-      "  for (var i = 0; i < 100; i++) {"
-      "    var expected = i;"
-      "    var key = i;"
-      "    if (i == 50) {"
-      "       key = 'foobar';"
-      "       expected = undefined;"
-      "    }"
-      "    var v = obj[key];"
-      "    if (v != expected) throw 'Wrong value ' + v + ' at iteration ' + i;"
-      "  }"
-      "  'PASSED'"
-      "} catch(e) {"
-      "  e"
-      "}";
-  ExpectString(code, "PASSED");
-}
-
-
-THREADED_TEST(IndexedInterceptorGoingMegamorphic) {
-  v8::Isolate* isolate = CcTest::isolate();
-  v8::HandleScope scope(isolate);
-  Local<ObjectTemplate> templ = ObjectTemplate::New(isolate);
-  templ->SetHandler(
-      v8::IndexedPropertyHandlerConfiguration(IdentityIndexedPropertyGetter));
-
-  LocalContext context;
-  Local<v8::Object> obj = templ->NewInstance();
-  context->Global()->Set(v8_str("obj"), obj);
-
-  const char* code =
-      "var original = obj;"
-      "try {"
-      "  for (var i = 0; i < 100; i++) {"
-      "    var expected = i;"
-      "    if (i == 50) {"
-      "       obj = {50: 'foobar'};"
-      "       expected = 'foobar';"
-      "    }"
-      "    var v = obj[i];"
-      "    if (v != expected) throw 'Wrong value ' + v + ' at iteration ' + i;"
-      "    if (i == 50) obj = original;"
-      "  }"
-      "  'PASSED'"
-      "} catch(e) {"
-      "  e"
-      "}";
-  ExpectString(code, "PASSED");
-}
-
-
-THREADED_TEST(IndexedInterceptorReceiverTurningSmi) {
-  v8::Isolate* isolate = CcTest::isolate();
-  v8::HandleScope scope(isolate);
-  Local<ObjectTemplate> templ = ObjectTemplate::New(isolate);
-  templ->SetHandler(
-      v8::IndexedPropertyHandlerConfiguration(IdentityIndexedPropertyGetter));
-
-  LocalContext context;
-  Local<v8::Object> obj = templ->NewInstance();
-  context->Global()->Set(v8_str("obj"), obj);
-
-  const char* code =
-      "var original = obj;"
-      "try {"
-      "  for (var i = 0; i < 100; i++) {"
-      "    var expected = i;"
-      "    if (i == 5) {"
-      "       obj = 239;"
-      "       expected = undefined;"
-      "    }"
-      "    var v = obj[i];"
-      "    if (v != expected) throw 'Wrong value ' + v + ' at iteration ' + i;"
-      "    if (i == 5) obj = original;"
-      "  }"
-      "  'PASSED'"
-      "} catch(e) {"
-      "  e"
-      "}";
-  ExpectString(code, "PASSED");
-}
-
-
-THREADED_TEST(IndexedInterceptorOnProto) {
-  v8::Isolate* isolate = CcTest::isolate();
-  v8::HandleScope scope(isolate);
-  Local<ObjectTemplate> templ = ObjectTemplate::New(isolate);
-  templ->SetHandler(
-      v8::IndexedPropertyHandlerConfiguration(IdentityIndexedPropertyGetter));
-
-  LocalContext context;
-  Local<v8::Object> obj = templ->NewInstance();
-  context->Global()->Set(v8_str("obj"), obj);
-
-  const char* code =
-      "var o = {__proto__: obj};"
-      "try {"
-      "  for (var i = 0; i < 100; i++) {"
-      "    var v = o[i];"
-      "    if (v != i) throw 'Wrong value ' + v + ' at iteration ' + i;"
-      "  }"
-      "  'PASSED'"
-      "} catch(e) {"
-      "  e"
-      "}";
-  ExpectString(code, "PASSED");
-}
-
-
 THREADED_TEST(MultiContexts) {
   v8::Isolate* isolate = CcTest::isolate();
   v8::HandleScope scope(isolate);
-  v8::Handle<ObjectTemplate> templ = ObjectTemplate::New(isolate);
-  templ->Set(v8_str("dummy"), v8::FunctionTemplate::New(isolate,
-                                                        DummyCallHandler));
+  v8::Local<ObjectTemplate> templ = ObjectTemplate::New(isolate);
+  templ->Set(v8_str("dummy"),
+             v8::FunctionTemplate::New(isolate, DummyCallHandler));
 
   Local<String> password = v8_str("Password");
 
   // Create an environment
   LocalContext context0(0, templ);
   context0->SetSecurityToken(password);
-  v8::Handle<v8::Object> global0 = context0->Global();
-  global0->Set(v8_str("custom"), v8_num(1234));
-  CHECK_EQ(1234, global0->Get(v8_str("custom"))->Int32Value());
+  v8::Local<v8::Object> global0 = context0->Global();
+  CHECK(global0->Set(context0.local(), v8_str("custom"), v8_num(1234))
+            .FromJust());
+  CHECK_EQ(1234, global0->Get(context0.local(), v8_str("custom"))
+                     .ToLocalChecked()
+                     ->Int32Value(context0.local())
+                     .FromJust());
 
   // Create an independent environment
   LocalContext context1(0, templ);
   context1->SetSecurityToken(password);
-  v8::Handle<v8::Object> global1 = context1->Global();
-  global1->Set(v8_str("custom"), v8_num(1234));
-  CHECK_NE(global0, global1);
-  CHECK_EQ(1234, global0->Get(v8_str("custom"))->Int32Value());
-  CHECK_EQ(1234, global1->Get(v8_str("custom"))->Int32Value());
+  v8::Local<v8::Object> global1 = context1->Global();
+  CHECK(global1->Set(context1.local(), v8_str("custom"), v8_num(1234))
+            .FromJust());
+  CHECK(!global0->Equals(context1.local(), global1).FromJust());
+  CHECK_EQ(1234, global0->Get(context1.local(), v8_str("custom"))
+                     .ToLocalChecked()
+                     ->Int32Value(context0.local())
+                     .FromJust());
+  CHECK_EQ(1234, global1->Get(context1.local(), v8_str("custom"))
+                     .ToLocalChecked()
+                     ->Int32Value(context1.local())
+                     .FromJust());
 
   // Now create a new context with the old global
   LocalContext context2(0, templ, global1);
   context2->SetSecurityToken(password);
-  v8::Handle<v8::Object> global2 = context2->Global();
-  CHECK_EQ(global1, global2);
-  CHECK_EQ(0, global1->Get(v8_str("custom"))->Int32Value());
-  CHECK_EQ(0, global2->Get(v8_str("custom"))->Int32Value());
+  v8::Local<v8::Object> global2 = context2->Global();
+  CHECK(global1->Equals(context2.local(), global2).FromJust());
+  CHECK_EQ(0, global1->Get(context2.local(), v8_str("custom"))
+                  .ToLocalChecked()
+                  ->Int32Value(context1.local())
+                  .FromJust());
+  CHECK_EQ(0, global2->Get(context2.local(), v8_str("custom"))
+                  .ToLocalChecked()
+                  ->Int32Value(context2.local())
+                  .FromJust());
 }
 
 
@@ -6940,26 +6745,34 @@
   v8::HandleScope scope(CcTest::isolate());
 
   LocalContext env0;
-  v8::Handle<v8::Object> global0 =
-      env0->Global();
-  v8::Handle<v8::Object> object0 =
-      global0->Get(v8_str("Object")).As<v8::Object>();
-  v8::Handle<v8::Object> tostring0 =
-      object0->Get(v8_str("toString")).As<v8::Object>();
-  v8::Handle<v8::Object> proto0 =
-      tostring0->Get(v8_str("__proto__")).As<v8::Object>();
-  proto0->Set(v8_str("custom"), v8_num(1234));
+  v8::Local<v8::Object> global0 = env0->Global();
+  v8::Local<v8::Object> object0 = global0->Get(env0.local(), v8_str("Object"))
+                                      .ToLocalChecked()
+                                      .As<v8::Object>();
+  v8::Local<v8::Object> tostring0 =
+      object0->Get(env0.local(), v8_str("toString"))
+          .ToLocalChecked()
+          .As<v8::Object>();
+  v8::Local<v8::Object> proto0 =
+      tostring0->Get(env0.local(), v8_str("__proto__"))
+          .ToLocalChecked()
+          .As<v8::Object>();
+  CHECK(proto0->Set(env0.local(), v8_str("custom"), v8_num(1234)).FromJust());
 
   LocalContext env1;
-  v8::Handle<v8::Object> global1 =
-      env1->Global();
-  v8::Handle<v8::Object> object1 =
-      global1->Get(v8_str("Object")).As<v8::Object>();
-  v8::Handle<v8::Object> tostring1 =
-      object1->Get(v8_str("toString")).As<v8::Object>();
-  v8::Handle<v8::Object> proto1 =
-      tostring1->Get(v8_str("__proto__")).As<v8::Object>();
-  CHECK(!proto1->Has(v8_str("custom")));
+  v8::Local<v8::Object> global1 = env1->Global();
+  v8::Local<v8::Object> object1 = global1->Get(env1.local(), v8_str("Object"))
+                                      .ToLocalChecked()
+                                      .As<v8::Object>();
+  v8::Local<v8::Object> tostring1 =
+      object1->Get(env1.local(), v8_str("toString"))
+          .ToLocalChecked()
+          .As<v8::Object>();
+  v8::Local<v8::Object> proto1 =
+      tostring1->Get(env1.local(), v8_str("__proto__"))
+          .ToLocalChecked()
+          .As<v8::Object>();
+  CHECK(!proto1->Has(env1.local(), v8_str("custom")).FromJust());
 }
 
 
@@ -6972,17 +6785,24 @@
 
   v8::HandleScope scope(CcTest::isolate());
 
-  Local<String> source = v8_str("Object.prototype.obj = 1234;"
-                                "Array.prototype.arr = 4567;"
-                                "8901");
+  Local<String> source = v8_str(
+      "Object.prototype.obj = 1234;"
+      "Array.prototype.arr = 4567;"
+      "8901");
 
   LocalContext env0;
   Local<Script> script0 = v8_compile(source);
-  CHECK_EQ(8901.0, script0->Run()->NumberValue());
+  CHECK_EQ(8901.0, script0->Run(env0.local())
+                       .ToLocalChecked()
+                       ->NumberValue(env0.local())
+                       .FromJust());
 
   LocalContext env1;
   Local<Script> script1 = v8_compile(source);
-  CHECK_EQ(8901.0, script1->Run()->NumberValue());
+  CHECK_EQ(8901.0, script1->Run(env1.local())
+                       .ToLocalChecked()
+                       ->NumberValue(env1.local())
+                       .FromJust());
 }
 
 
@@ -6994,8 +6814,12 @@
       v8::FunctionTemplate::New(env->GetIsolate());
   desc->InstanceTemplate()->MarkAsUndetectable();  // undetectable
 
-  Local<v8::Object> obj = desc->GetFunction()->NewInstance();
-  env->Global()->Set(v8_str("undetectable"), obj);
+  Local<v8::Object> obj = desc->GetFunction(env.local())
+                              .ToLocalChecked()
+                              ->NewInstance(env.local())
+                              .ToLocalChecked();
+  CHECK(
+      env->Global()->Set(env.local(), v8_str("undetectable"), obj).FromJust());
 
   ExpectString("undetectable.toString()", "[object Object]");
   ExpectString("typeof undetectable", "undefined");
@@ -7038,8 +6862,12 @@
   Local<v8::FunctionTemplate> desc = v8::FunctionTemplate::New(isolate);
   desc->InstanceTemplate()->MarkAsUndetectable();  // undetectable
 
-  Local<v8::Object> obj = desc->GetFunction()->NewInstance();
-  env->Global()->Set(v8_str("undetectable"), obj);
+  Local<v8::Object> obj = desc->GetFunction(env.local())
+                              .ToLocalChecked()
+                              ->NewInstance(env.local())
+                              .ToLocalChecked();
+  CHECK(
+      env->Global()->Set(env.local(), v8_str("undetectable"), obj).FromJust());
 
   ExpectBoolean("undefined == void 0", true);
   ExpectBoolean("undetectable == void 0", true);
@@ -7055,22 +6883,24 @@
   ExpectBoolean("void 0 === undetectable", false);
   ExpectBoolean("void 0 === null", false);
 
-  ExpectString("(function() {"
-               "  try {"
-               "    return x === void 0;"
-               "  } catch(e) {"
-               "    return e.toString();"
-               "  }"
-               "})()",
-               "ReferenceError: x is not defined");
-  ExpectString("(function() {"
-               "  try {"
-               "    return void 0 === x;"
-               "  } catch(e) {"
-               "    return e.toString();"
-               "  }"
-               "})()",
-               "ReferenceError: x is not defined");
+  ExpectString(
+      "(function() {"
+      "  try {"
+      "    return x === void 0;"
+      "  } catch(e) {"
+      "    return e.toString();"
+      "  }"
+      "})()",
+      "ReferenceError: x is not defined");
+  ExpectString(
+      "(function() {"
+      "  try {"
+      "    return void 0 === x;"
+      "  } catch(e) {"
+      "    return e.toString();"
+      "  }"
+      "})()",
+      "ReferenceError: x is not defined");
 }
 
 
@@ -7082,105 +6912,37 @@
   Local<v8::FunctionTemplate> desc = v8::FunctionTemplate::New(isolate);
   desc->InstanceTemplate()->MarkAsUndetectable();  // undetectable
 
-  Local<v8::Object> obj = desc->GetFunction()->NewInstance();
-  env->Global()->Set(v8_str("undetectable"), obj);
+  Local<v8::Object> obj = desc->GetFunction(env.local())
+                              .ToLocalChecked()
+                              ->NewInstance(env.local())
+                              .ToLocalChecked();
+  CHECK(
+      env->Global()->Set(env.local(), v8_str("undetectable"), obj).FromJust());
 
-  Local<String> source = v8_str("undetectable.x = 42;"
-                                "undetectable.x");
+  Local<String> source = v8_str(
+      "undetectable.x = 42;"
+      "undetectable.x");
 
   Local<Script> script = v8_compile(source);
 
-  CHECK_EQ(v8::Integer::New(isolate, 42), script->Run());
+  CHECK(v8::Integer::New(isolate, 42)
+            ->Equals(env.local(), script->Run(env.local()).ToLocalChecked())
+            .FromJust());
 
   ExpectBoolean("Object.isExtensible(undetectable)", true);
 
   source = v8_str("Object.preventExtensions(undetectable);");
   script = v8_compile(source);
-  script->Run();
+  script->Run(env.local()).ToLocalChecked();
   ExpectBoolean("Object.isExtensible(undetectable)", false);
 
   source = v8_str("undetectable.y = 2000;");
   script = v8_compile(source);
-  script->Run();
+  script->Run(env.local()).ToLocalChecked();
   ExpectBoolean("undetectable.y == undefined", true);
 }
 
 
-
-THREADED_TEST(UndetectableString) {
-  LocalContext env;
-  v8::HandleScope scope(env->GetIsolate());
-
-  Local<String> obj = String::NewFromUtf8(env->GetIsolate(), "foo",
-                                          String::kUndetectableString);
-  env->Global()->Set(v8_str("undetectable"), obj);
-
-  ExpectString("undetectable", "foo");
-  ExpectString("typeof undetectable", "undefined");
-  ExpectString("typeof(undetectable)", "undefined");
-  ExpectBoolean("typeof undetectable == 'undefined'", true);
-  ExpectBoolean("typeof undetectable == 'string'", false);
-  ExpectBoolean("if (undetectable) { true; } else { false; }", false);
-  ExpectBoolean("!undetectable", true);
-
-  ExpectObject("true&&undetectable", obj);
-  ExpectBoolean("false&&undetectable", false);
-  ExpectBoolean("true||undetectable", true);
-  ExpectObject("false||undetectable", obj);
-
-  ExpectObject("undetectable&&true", obj);
-  ExpectObject("undetectable&&false", obj);
-  ExpectBoolean("undetectable||true", true);
-  ExpectBoolean("undetectable||false", false);
-
-  ExpectBoolean("undetectable==null", true);
-  ExpectBoolean("null==undetectable", true);
-  ExpectBoolean("undetectable==undefined", true);
-  ExpectBoolean("undefined==undetectable", true);
-  ExpectBoolean("undetectable==undetectable", true);
-
-
-  ExpectBoolean("undetectable===null", false);
-  ExpectBoolean("null===undetectable", false);
-  ExpectBoolean("undetectable===undefined", false);
-  ExpectBoolean("undefined===undetectable", false);
-  ExpectBoolean("undetectable===undetectable", true);
-}
-
-
-TEST(UndetectableOptimized) {
-  i::FLAG_allow_natives_syntax = true;
-  LocalContext env;
-  v8::HandleScope scope(env->GetIsolate());
-
-  Local<String> obj = String::NewFromUtf8(env->GetIsolate(), "foo",
-                                          String::kUndetectableString);
-  env->Global()->Set(v8_str("undetectable"), obj);
-  env->Global()->Set(v8_str("detectable"), v8_str("bar"));
-
-  ExpectString(
-      "function testBranch() {"
-      "  if (!%_IsUndetectableObject(undetectable)) throw 1;"
-      "  if (%_IsUndetectableObject(detectable)) throw 2;"
-      "}\n"
-      "function testBool() {"
-      "  var b1 = !%_IsUndetectableObject(undetectable);"
-      "  var b2 = %_IsUndetectableObject(detectable);"
-      "  if (b1) throw 3;"
-      "  if (b2) throw 4;"
-      "  return b1 == b2;"
-      "}\n"
-      "%OptimizeFunctionOnNextCall(testBranch);"
-      "%OptimizeFunctionOnNextCall(testBool);"
-      "for (var i = 0; i < 10; i++) {"
-      "  testBranch();"
-      "  testBool();"
-      "}\n"
-      "\"PASS\"",
-      "PASS");
-}
-
-
 // The point of this test is type checking. We run it only so compilers
 // don't complain about an unused function.
 TEST(PersistentHandles) {
@@ -7218,61 +6980,61 @@
 
 
 static const char* kSimpleExtensionSource =
-  "function Foo() {"
-  "  return 4;"
-  "}";
+    "function Foo() {"
+    "  return 4;"
+    "}";
 
 
 TEST(SimpleExtensions) {
   v8::HandleScope handle_scope(CcTest::isolate());
   v8::RegisterExtension(new Extension("simpletest", kSimpleExtensionSource));
-  const char* extension_names[] = { "simpletest" };
+  const char* extension_names[] = {"simpletest"};
   v8::ExtensionConfiguration extensions(1, extension_names);
-  v8::Handle<Context> context =
-      Context::New(CcTest::isolate(), &extensions);
+  v8::Local<Context> context = Context::New(CcTest::isolate(), &extensions);
   Context::Scope lock(context);
-  v8::Handle<Value> result = CompileRun("Foo()");
-  CHECK_EQ(result, v8::Integer::New(CcTest::isolate(), 4));
+  v8::Local<Value> result = CompileRun("Foo()");
+  CHECK(result->Equals(context, v8::Integer::New(CcTest::isolate(), 4))
+            .FromJust());
 }
 
 
 static const char* kStackTraceFromExtensionSource =
-  "function foo() {"
-  "  throw new Error();"
-  "}"
-  "function bar() {"
-  "  foo();"
-  "}";
+    "function foo() {"
+    "  throw new Error();"
+    "}"
+    "function bar() {"
+    "  foo();"
+    "}";
 
 
 TEST(StackTraceInExtension) {
   v8::HandleScope handle_scope(CcTest::isolate());
-  v8::RegisterExtension(new Extension("stacktracetest",
-                        kStackTraceFromExtensionSource));
-  const char* extension_names[] = { "stacktracetest" };
+  v8::RegisterExtension(
+      new Extension("stacktracetest", kStackTraceFromExtensionSource));
+  const char* extension_names[] = {"stacktracetest"};
   v8::ExtensionConfiguration extensions(1, extension_names);
-  v8::Handle<Context> context =
-      Context::New(CcTest::isolate(), &extensions);
+  v8::Local<Context> context = Context::New(CcTest::isolate(), &extensions);
   Context::Scope lock(context);
-  CompileRun("function user() { bar(); }"
-             "var error;"
-             "try{ user(); } catch (e) { error = e; }");
-  CHECK_EQ(-1, CompileRun("error.stack.indexOf('foo')")->Int32Value());
-  CHECK_EQ(-1, CompileRun("error.stack.indexOf('bar')")->Int32Value());
-  CHECK_NE(-1, CompileRun("error.stack.indexOf('user')")->Int32Value());
+  CompileRun(
+      "function user() { bar(); }"
+      "var error;"
+      "try{ user(); } catch (e) { error = e; }");
+  CHECK_EQ(-1, v8_run_int32value(v8_compile("error.stack.indexOf('foo')")));
+  CHECK_EQ(-1, v8_run_int32value(v8_compile("error.stack.indexOf('bar')")));
+  CHECK_NE(-1, v8_run_int32value(v8_compile("error.stack.indexOf('user')")));
 }
 
 
 TEST(NullExtensions) {
   v8::HandleScope handle_scope(CcTest::isolate());
   v8::RegisterExtension(new Extension("nulltest", NULL));
-  const char* extension_names[] = { "nulltest" };
+  const char* extension_names[] = {"nulltest"};
   v8::ExtensionConfiguration extensions(1, extension_names);
-  v8::Handle<Context> context =
-      Context::New(CcTest::isolate(), &extensions);
+  v8::Local<Context> context = Context::New(CcTest::isolate(), &extensions);
   Context::Scope lock(context);
-  v8::Handle<Value> result = CompileRun("1+3");
-  CHECK_EQ(result, v8::Integer::New(CcTest::isolate(), 4));
+  v8::Local<Value> result = CompileRun("1+3");
+  CHECK(result->Equals(context, v8::Integer::New(CcTest::isolate(), 4))
+            .FromJust());
 }
 
 
@@ -7284,13 +7046,12 @@
 
 TEST(ExtensionMissingSourceLength) {
   v8::HandleScope handle_scope(CcTest::isolate());
-  v8::RegisterExtension(new Extension("srclentest_fail",
-                                      kEmbeddedExtensionSource));
-  const char* extension_names[] = { "srclentest_fail" };
+  v8::RegisterExtension(
+      new Extension("srclentest_fail", kEmbeddedExtensionSource));
+  const char* extension_names[] = {"srclentest_fail"};
   v8::ExtensionConfiguration extensions(1, extension_names);
-  v8::Handle<Context> context =
-      Context::New(CcTest::isolate(), &extensions);
-  CHECK_EQ(0, *context);
+  v8::Local<Context> context = Context::New(CcTest::isolate(), &extensions);
+  CHECK(0 == *context);
 }
 
 
@@ -7300,89 +7061,90 @@
     v8::HandleScope handle_scope(CcTest::isolate());
     i::ScopedVector<char> extension_name(32);
     i::SNPrintF(extension_name, "ext #%d", source_len);
-    v8::RegisterExtension(new Extension(extension_name.start(),
-                                        kEmbeddedExtensionSource, 0, 0,
-                                        source_len));
-    const char* extension_names[1] = { extension_name.start() };
+    v8::RegisterExtension(new Extension(
+        extension_name.start(), kEmbeddedExtensionSource, 0, 0, source_len));
+    const char* extension_names[1] = {extension_name.start()};
     v8::ExtensionConfiguration extensions(1, extension_names);
-    v8::Handle<Context> context =
-      Context::New(CcTest::isolate(), &extensions);
+    v8::Local<Context> context = Context::New(CcTest::isolate(), &extensions);
     if (source_len == kEmbeddedExtensionSourceValidLen) {
       Context::Scope lock(context);
-      v8::Handle<Value> result = CompileRun("Ret54321()");
-      CHECK_EQ(v8::Integer::New(CcTest::isolate(), 54321), result);
+      v8::Local<Value> result = CompileRun("Ret54321()");
+      CHECK(v8::Integer::New(CcTest::isolate(), 54321)
+                ->Equals(context, result)
+                .FromJust());
     } else {
       // Anything but exactly the right length should fail to compile.
-      CHECK_EQ(0, *context);
+      CHECK(0 == *context);
     }
   }
 }
 
 
 static const char* kEvalExtensionSource1 =
-  "function UseEval1() {"
-  "  var x = 42;"
-  "  return eval('x');"
-  "}";
+    "function UseEval1() {"
+    "  var x = 42;"
+    "  return eval('x');"
+    "}";
 
 
 static const char* kEvalExtensionSource2 =
-  "(function() {"
-  "  var x = 42;"
-  "  function e() {"
-  "    return eval('x');"
-  "  }"
-  "  this.UseEval2 = e;"
-  "})()";
+    "(function() {"
+    "  var x = 42;"
+    "  function e() {"
+    "    return eval('x');"
+    "  }"
+    "  this.UseEval2 = e;"
+    "})()";
 
 
 TEST(UseEvalFromExtension) {
   v8::HandleScope handle_scope(CcTest::isolate());
   v8::RegisterExtension(new Extension("evaltest1", kEvalExtensionSource1));
   v8::RegisterExtension(new Extension("evaltest2", kEvalExtensionSource2));
-  const char* extension_names[] = { "evaltest1", "evaltest2" };
+  const char* extension_names[] = {"evaltest1", "evaltest2"};
   v8::ExtensionConfiguration extensions(2, extension_names);
-  v8::Handle<Context> context =
-      Context::New(CcTest::isolate(), &extensions);
+  v8::Local<Context> context = Context::New(CcTest::isolate(), &extensions);
   Context::Scope lock(context);
-  v8::Handle<Value> result = CompileRun("UseEval1()");
-  CHECK_EQ(result, v8::Integer::New(CcTest::isolate(), 42));
+  v8::Local<Value> result = CompileRun("UseEval1()");
+  CHECK(result->Equals(context, v8::Integer::New(CcTest::isolate(), 42))
+            .FromJust());
   result = CompileRun("UseEval2()");
-  CHECK_EQ(result, v8::Integer::New(CcTest::isolate(), 42));
+  CHECK(result->Equals(context, v8::Integer::New(CcTest::isolate(), 42))
+            .FromJust());
 }
 
 
 static const char* kWithExtensionSource1 =
-  "function UseWith1() {"
-  "  var x = 42;"
-  "  with({x:87}) { return x; }"
-  "}";
-
+    "function UseWith1() {"
+    "  var x = 42;"
+    "  with({x:87}) { return x; }"
+    "}";
 
 
 static const char* kWithExtensionSource2 =
-  "(function() {"
-  "  var x = 42;"
-  "  function e() {"
-  "    with ({x:87}) { return x; }"
-  "  }"
-  "  this.UseWith2 = e;"
-  "})()";
+    "(function() {"
+    "  var x = 42;"
+    "  function e() {"
+    "    with ({x:87}) { return x; }"
+    "  }"
+    "  this.UseWith2 = e;"
+    "})()";
 
 
 TEST(UseWithFromExtension) {
   v8::HandleScope handle_scope(CcTest::isolate());
   v8::RegisterExtension(new Extension("withtest1", kWithExtensionSource1));
   v8::RegisterExtension(new Extension("withtest2", kWithExtensionSource2));
-  const char* extension_names[] = { "withtest1", "withtest2" };
+  const char* extension_names[] = {"withtest1", "withtest2"};
   v8::ExtensionConfiguration extensions(2, extension_names);
-  v8::Handle<Context> context =
-      Context::New(CcTest::isolate(), &extensions);
+  v8::Local<Context> context = Context::New(CcTest::isolate(), &extensions);
   Context::Scope lock(context);
-  v8::Handle<Value> result = CompileRun("UseWith1()");
-  CHECK_EQ(result, v8::Integer::New(CcTest::isolate(), 87));
+  v8::Local<Value> result = CompileRun("UseWith1()");
+  CHECK(result->Equals(context, v8::Integer::New(CcTest::isolate(), 87))
+            .FromJust());
   result = CompileRun("UseWith2()");
-  CHECK_EQ(result, v8::Integer::New(CcTest::isolate(), 87));
+  CHECK(result->Equals(context, v8::Integer::New(CcTest::isolate(), 87))
+            .FromJust());
 }
 
 
@@ -7391,46 +7153,42 @@
   Extension* extension = new Extension("autotest", kSimpleExtensionSource);
   extension->set_auto_enable(true);
   v8::RegisterExtension(extension);
-  v8::Handle<Context> context =
-      Context::New(CcTest::isolate());
+  v8::Local<Context> context = Context::New(CcTest::isolate());
   Context::Scope lock(context);
-  v8::Handle<Value> result = CompileRun("Foo()");
-  CHECK_EQ(result, v8::Integer::New(CcTest::isolate(), 4));
+  v8::Local<Value> result = CompileRun("Foo()");
+  CHECK(result->Equals(context, v8::Integer::New(CcTest::isolate(), 4))
+            .FromJust());
 }
 
 
-static const char* kSyntaxErrorInExtensionSource =
-    "[";
+static const char* kSyntaxErrorInExtensionSource = "[";
 
 
 // Test that a syntax error in an extension does not cause a fatal
 // error but results in an empty context.
 TEST(SyntaxErrorExtensions) {
   v8::HandleScope handle_scope(CcTest::isolate());
-  v8::RegisterExtension(new Extension("syntaxerror",
-                                      kSyntaxErrorInExtensionSource));
-  const char* extension_names[] = { "syntaxerror" };
+  v8::RegisterExtension(
+      new Extension("syntaxerror", kSyntaxErrorInExtensionSource));
+  const char* extension_names[] = {"syntaxerror"};
   v8::ExtensionConfiguration extensions(1, extension_names);
-  v8::Handle<Context> context =
-      Context::New(CcTest::isolate(), &extensions);
+  v8::Local<Context> context = Context::New(CcTest::isolate(), &extensions);
   CHECK(context.IsEmpty());
 }
 
 
-static const char* kExceptionInExtensionSource =
-    "throw 42";
+static const char* kExceptionInExtensionSource = "throw 42";
 
 
 // Test that an exception when installing an extension does not cause
 // a fatal error but results in an empty context.
 TEST(ExceptionExtensions) {
   v8::HandleScope handle_scope(CcTest::isolate());
-  v8::RegisterExtension(new Extension("exception",
-                                      kExceptionInExtensionSource));
-  const char* extension_names[] = { "exception" };
+  v8::RegisterExtension(
+      new Extension("exception", kExceptionInExtensionSource));
+  const char* extension_names[] = {"exception"};
   v8::ExtensionConfiguration extensions(1, extension_names);
-  v8::Handle<Context> context =
-      Context::New(CcTest::isolate(), &extensions);
+  v8::Local<Context> context = Context::New(CcTest::isolate(), &extensions);
   CHECK(context.IsEmpty());
 }
 
@@ -7447,35 +7205,33 @@
 // Test that a native runtime calls are supported in extensions.
 TEST(NativeCallInExtensions) {
   v8::HandleScope handle_scope(CcTest::isolate());
-  v8::RegisterExtension(new Extension("nativecall",
-                                      kNativeCallInExtensionSource));
-  const char* extension_names[] = { "nativecall" };
+  v8::RegisterExtension(
+      new Extension("nativecall", kNativeCallInExtensionSource));
+  const char* extension_names[] = {"nativecall"};
   v8::ExtensionConfiguration extensions(1, extension_names);
-  v8::Handle<Context> context =
-      Context::New(CcTest::isolate(), &extensions);
+  v8::Local<Context> context = Context::New(CcTest::isolate(), &extensions);
   Context::Scope lock(context);
-  v8::Handle<Value> result = CompileRun(kNativeCallTest);
-  CHECK_EQ(result, v8::Integer::New(CcTest::isolate(), 3));
+  v8::Local<Value> result = CompileRun(kNativeCallTest);
+  CHECK(result->Equals(context, v8::Integer::New(CcTest::isolate(), 3))
+            .FromJust());
 }
 
 
 class NativeFunctionExtension : public Extension {
  public:
-  NativeFunctionExtension(const char* name,
-                          const char* source,
+  NativeFunctionExtension(const char* name, const char* source,
                           v8::FunctionCallback fun = &Echo)
-      : Extension(name, source),
-        function_(fun) { }
+      : Extension(name, source), function_(fun) {}
 
-  virtual v8::Handle<v8::FunctionTemplate> GetNativeFunctionTemplate(
-      v8::Isolate* isolate,
-      v8::Handle<v8::String> name) {
+  virtual v8::Local<v8::FunctionTemplate> GetNativeFunctionTemplate(
+      v8::Isolate* isolate, v8::Local<v8::String> name) {
     return v8::FunctionTemplate::New(isolate, function_);
   }
 
   static void Echo(const v8::FunctionCallbackInfo<v8::Value>& args) {
     if (args.Length() >= 1) args.GetReturnValue().Set(args[0]);
   }
+
  private:
   v8::FunctionCallback function_;
 };
@@ -7484,15 +7240,15 @@
 TEST(NativeFunctionDeclaration) {
   v8::HandleScope handle_scope(CcTest::isolate());
   const char* name = "nativedecl";
-  v8::RegisterExtension(new NativeFunctionExtension(name,
-                                                    "native function foo();"));
-  const char* extension_names[] = { name };
+  v8::RegisterExtension(
+      new NativeFunctionExtension(name, "native function foo();"));
+  const char* extension_names[] = {name};
   v8::ExtensionConfiguration extensions(1, extension_names);
-  v8::Handle<Context> context =
-      Context::New(CcTest::isolate(), &extensions);
+  v8::Local<Context> context = Context::New(CcTest::isolate(), &extensions);
   Context::Scope lock(context);
-  v8::Handle<Value> result = CompileRun("foo(42);");
-  CHECK_EQ(result, v8::Integer::New(CcTest::isolate(), 42));
+  v8::Local<Value> result = CompileRun("foo(42);");
+  CHECK(result->Equals(context, v8::Integer::New(CcTest::isolate(), 42))
+            .FromJust());
 }
 
 
@@ -7500,12 +7256,11 @@
   v8::HandleScope handle_scope(CcTest::isolate());
   const char* name = "nativedeclerr";
   // Syntax error in extension code.
-  v8::RegisterExtension(new NativeFunctionExtension(name,
-                                                    "native\nfunction foo();"));
-  const char* extension_names[] = { name };
+  v8::RegisterExtension(
+      new NativeFunctionExtension(name, "native\nfunction foo();"));
+  const char* extension_names[] = {name};
   v8::ExtensionConfiguration extensions(1, extension_names);
-  v8::Handle<Context> context =
-      Context::New(CcTest::isolate(), &extensions);
+  v8::Local<Context> context = Context::New(CcTest::isolate(), &extensions);
   CHECK(context.IsEmpty());
 }
 
@@ -7515,13 +7270,11 @@
   const char* name = "nativedeclerresc";
   // Syntax error in extension code - escape code in "native" means that
   // it's not treated as a keyword.
-  v8::RegisterExtension(new NativeFunctionExtension(
-      name,
-      "nativ\\u0065 function foo();"));
-  const char* extension_names[] = { name };
+  v8::RegisterExtension(
+      new NativeFunctionExtension(name, "nativ\\u0065 function foo();"));
+  const char* extension_names[] = {name};
   v8::ExtensionConfiguration extensions(1, extension_names);
-  v8::Handle<Context> context =
-      Context::New(CcTest::isolate(), &extensions);
+  v8::Local<Context> context = Context::New(CcTest::isolate(), &extensions);
   CHECK(context.IsEmpty());
 }
 
@@ -7530,8 +7283,12 @@
   v8::HandleScope handle_scope(CcTest::isolate());
   v8::ExtensionConfiguration config(1, &name);
   LocalContext context(&config);
-  CHECK_EQ(String::NewFromUtf8(CcTest::isolate(), expected),
-           context->Global()->Get(v8_str("loaded")));
+  CHECK(
+      v8_str(expected)
+          ->Equals(context.local(), context->Global()
+                                        ->Get(context.local(), v8_str("loaded"))
+                                        .ToLocalChecked())
+          .FromJust());
 }
 
 
@@ -7543,11 +7300,11 @@
  *     \-- C <--/
  */
 THREADED_TEST(ExtensionDependency) {
-  static const char* kEDeps[] = { "D" };
+  static const char* kEDeps[] = {"D"};
   v8::RegisterExtension(new Extension("E", "this.loaded += 'E';", 1, kEDeps));
-  static const char* kDDeps[] = { "B", "C" };
+  static const char* kDDeps[] = {"B", "C"};
   v8::RegisterExtension(new Extension("D", "this.loaded += 'D';", 2, kDDeps));
-  static const char* kBCDeps[] = { "A" };
+  static const char* kBCDeps[] = {"A"};
   v8::RegisterExtension(new Extension("B", "this.loaded += 'B';", 1, kBCDeps));
   v8::RegisterExtension(new Extension("C", "this.loaded += 'C';", 1, kBCDeps));
   v8::RegisterExtension(new Extension("A", "this.loaded += 'A';"));
@@ -7557,28 +7314,36 @@
   CheckDependencies("D", "undefinedABCD");
   CheckDependencies("E", "undefinedABCDE");
   v8::HandleScope handle_scope(CcTest::isolate());
-  static const char* exts[2] = { "C", "E" };
+  static const char* exts[2] = {"C", "E"};
   v8::ExtensionConfiguration config(2, exts);
   LocalContext context(&config);
-  CHECK_EQ(v8_str("undefinedACBDE"), context->Global()->Get(v8_str("loaded")));
+  CHECK(
+      v8_str("undefinedACBDE")
+          ->Equals(context.local(), context->Global()
+                                        ->Get(context.local(), v8_str("loaded"))
+                                        .ToLocalChecked())
+          .FromJust());
 }
 
 
 static const char* kExtensionTestScript =
-  "native function A();"
-  "native function B();"
-  "native function C();"
-  "function Foo(i) {"
-  "  if (i == 0) return A();"
-  "  if (i == 1) return B();"
-  "  if (i == 2) return C();"
-  "}";
+    "native function A();"
+    "native function B();"
+    "native function C();"
+    "function Foo(i) {"
+    "  if (i == 0) return A();"
+    "  if (i == 1) return B();"
+    "  if (i == 2) return C();"
+    "}";
 
 
 static void CallFun(const v8::FunctionCallbackInfo<v8::Value>& args) {
   ApiTestFuzzer::Fuzz();
   if (args.IsConstructCall()) {
-    args.This()->Set(v8_str("data"), args.Data());
+    CHECK(args.This()
+              ->Set(args.GetIsolate()->GetCurrentContext(), v8_str("data"),
+                    args.Data())
+              .FromJust());
     args.GetReturnValue().SetNull();
     return;
   }
@@ -7588,28 +7353,29 @@
 
 class FunctionExtension : public Extension {
  public:
-  FunctionExtension() : Extension("functiontest", kExtensionTestScript) { }
-  virtual v8::Handle<v8::FunctionTemplate> GetNativeFunctionTemplate(
-      v8::Isolate* isolate,
-      v8::Handle<String> name);
+  FunctionExtension() : Extension("functiontest", kExtensionTestScript) {}
+  virtual v8::Local<v8::FunctionTemplate> GetNativeFunctionTemplate(
+      v8::Isolate* isolate, v8::Local<String> name);
 };
 
 
 static int lookup_count = 0;
-v8::Handle<v8::FunctionTemplate> FunctionExtension::GetNativeFunctionTemplate(
-    v8::Isolate* isolate, v8::Handle<String> name) {
+v8::Local<v8::FunctionTemplate> FunctionExtension::GetNativeFunctionTemplate(
+    v8::Isolate* isolate, v8::Local<String> name) {
   lookup_count++;
-  if (name->Equals(v8_str("A"))) {
-    return v8::FunctionTemplate::New(
-        isolate, CallFun, v8::Integer::New(isolate, 8));
-  } else if (name->Equals(v8_str("B"))) {
-    return v8::FunctionTemplate::New(
-        isolate, CallFun, v8::Integer::New(isolate, 7));
-  } else if (name->Equals(v8_str("C"))) {
-    return v8::FunctionTemplate::New(
-        isolate, CallFun, v8::Integer::New(isolate, 6));
+  if (name->Equals(isolate->GetCurrentContext(), v8_str("A")).FromJust()) {
+    return v8::FunctionTemplate::New(isolate, CallFun,
+                                     v8::Integer::New(isolate, 8));
+  } else if (name->Equals(isolate->GetCurrentContext(), v8_str("B"))
+                 .FromJust()) {
+    return v8::FunctionTemplate::New(isolate, CallFun,
+                                     v8::Integer::New(isolate, 7));
+  } else if (name->Equals(isolate->GetCurrentContext(), v8_str("C"))
+                 .FromJust()) {
+    return v8::FunctionTemplate::New(isolate, CallFun,
+                                     v8::Integer::New(isolate, 6));
   } else {
-    return v8::Handle<v8::FunctionTemplate>();
+    return v8::Local<v8::FunctionTemplate>();
   }
 }
 
@@ -7617,34 +7383,40 @@
 THREADED_TEST(FunctionLookup) {
   v8::RegisterExtension(new FunctionExtension());
   v8::HandleScope handle_scope(CcTest::isolate());
-  static const char* exts[1] = { "functiontest" };
+  static const char* exts[1] = {"functiontest"};
   v8::ExtensionConfiguration config(1, exts);
   LocalContext context(&config);
   CHECK_EQ(3, lookup_count);
-  CHECK_EQ(v8::Integer::New(CcTest::isolate(), 8),
-           CompileRun("Foo(0)"));
-  CHECK_EQ(v8::Integer::New(CcTest::isolate(), 7),
-           CompileRun("Foo(1)"));
-  CHECK_EQ(v8::Integer::New(CcTest::isolate(), 6),
-           CompileRun("Foo(2)"));
+  CHECK(v8::Integer::New(CcTest::isolate(), 8)
+            ->Equals(context.local(), CompileRun("Foo(0)"))
+            .FromJust());
+  CHECK(v8::Integer::New(CcTest::isolate(), 7)
+            ->Equals(context.local(), CompileRun("Foo(1)"))
+            .FromJust());
+  CHECK(v8::Integer::New(CcTest::isolate(), 6)
+            ->Equals(context.local(), CompileRun("Foo(2)"))
+            .FromJust());
 }
 
 
 THREADED_TEST(NativeFunctionConstructCall) {
   v8::RegisterExtension(new FunctionExtension());
   v8::HandleScope handle_scope(CcTest::isolate());
-  static const char* exts[1] = { "functiontest" };
+  static const char* exts[1] = {"functiontest"};
   v8::ExtensionConfiguration config(1, exts);
   LocalContext context(&config);
   for (int i = 0; i < 10; i++) {
     // Run a few times to ensure that allocation of objects doesn't
     // change behavior of a constructor function.
-    CHECK_EQ(v8::Integer::New(CcTest::isolate(), 8),
-             CompileRun("(new A()).data"));
-    CHECK_EQ(v8::Integer::New(CcTest::isolate(), 7),
-             CompileRun("(new B()).data"));
-    CHECK_EQ(v8::Integer::New(CcTest::isolate(), 6),
-             CompileRun("(new C()).data"));
+    CHECK(v8::Integer::New(CcTest::isolate(), 8)
+              ->Equals(context.local(), CompileRun("(new A()).data"))
+              .FromJust());
+    CHECK(v8::Integer::New(CcTest::isolate(), 7)
+              ->Equals(context.local(), CompileRun("(new B()).data"))
+              .FromJust());
+    CHECK(v8::Integer::New(CcTest::isolate(), 6)
+              ->Equals(context.local(), CompileRun("(new C()).data"))
+              .FromJust());
   }
 }
 
@@ -7663,54 +7435,58 @@
 // tests that the fatal error handler gets called.  This renders V8
 // unusable and therefore this test cannot be run in parallel.
 TEST(ErrorReporting) {
-  v8::V8::SetFatalErrorHandler(StoringErrorCallback);
-  static const char* aDeps[] = { "B" };
+  CcTest::isolate()->SetFatalErrorHandler(StoringErrorCallback);
+  static const char* aDeps[] = {"B"};
   v8::RegisterExtension(new Extension("A", "", 1, aDeps));
-  static const char* bDeps[] = { "A" };
+  static const char* bDeps[] = {"A"};
   v8::RegisterExtension(new Extension("B", "", 1, bDeps));
   last_location = NULL;
   v8::ExtensionConfiguration config(1, bDeps);
-  v8::Handle<Context> context =
-      Context::New(CcTest::isolate(), &config);
+  v8::Local<Context> context = Context::New(CcTest::isolate(), &config);
   CHECK(context.IsEmpty());
-  CHECK_NE(last_location, NULL);
+  CHECK(last_location);
 }
 
 
-static void MissingScriptInfoMessageListener(v8::Handle<v8::Message> message,
-                                             v8::Handle<Value> data) {
+static void MissingScriptInfoMessageListener(v8::Local<v8::Message> message,
+                                             v8::Local<Value> data) {
+  v8::Isolate* isolate = CcTest::isolate();
+  Local<Context> context = isolate->GetCurrentContext();
   CHECK(message->GetScriptOrigin().ResourceName()->IsUndefined());
-  CHECK_EQ(v8::Undefined(CcTest::isolate()),
-      message->GetScriptOrigin().ResourceName());
-  message->GetLineNumber();
-  message->GetSourceLine();
+  CHECK(v8::Undefined(isolate)
+            ->Equals(context, message->GetScriptOrigin().ResourceName())
+            .FromJust());
+  message->GetLineNumber(context).FromJust();
+  message->GetSourceLine(context).ToLocalChecked();
 }
 
 
 THREADED_TEST(ErrorWithMissingScriptInfo) {
   LocalContext context;
   v8::HandleScope scope(context->GetIsolate());
-  v8::V8::AddMessageListener(MissingScriptInfoMessageListener);
+  context->GetIsolate()->AddMessageListener(MissingScriptInfoMessageListener);
   CompileRun("throw Error()");
-  v8::V8::RemoveMessageListeners(MissingScriptInfoMessageListener);
+  context->GetIsolate()->RemoveMessageListeners(
+      MissingScriptInfoMessageListener);
 }
 
 
 struct FlagAndPersistent {
   bool flag;
-  v8::Persistent<v8::Object> handle;
+  v8::Global<v8::Object> handle;
 };
 
 
-static void SetFlag(const v8::PhantomCallbackData<FlagAndPersistent>& data) {
+static void SetFlag(const v8::WeakCallbackInfo<FlagAndPersistent>& data) {
   data.GetParameter()->flag = true;
+  data.GetParameter()->handle.Reset();
 }
 
 
 static void IndependentWeakHandle(bool global_gc, bool interlinked) {
   v8::Isolate* iso = CcTest::isolate();
   v8::HandleScope scope(iso);
-  v8::Handle<Context> context = Context::New(iso);
+  v8::Local<Context> context = Context::New(iso);
   Context::Scope context_scope(context);
 
   FlagAndPersistent object_a, object_b;
@@ -7724,43 +7500,45 @@
     object_a.handle.Reset(iso, a);
     object_b.handle.Reset(iso, b);
     if (interlinked) {
-      a->Set(v8_str("x"), b);
-      b->Set(v8_str("x"), a);
+      a->Set(context, v8_str("x"), b).FromJust();
+      b->Set(context, v8_str("x"), a).FromJust();
     }
     if (global_gc) {
-      CcTest::heap()->CollectAllGarbage(TestHeap::Heap::kNoGCFlags);
+      CcTest::heap()->CollectAllGarbage();
     } else {
       CcTest::heap()->CollectGarbage(i::NEW_SPACE);
     }
     // We are relying on this creating a big flag array and reserving the space
     // up front.
-    v8::Handle<Value> big_array = CompileRun("new Array(50000)");
-    a->Set(v8_str("y"), big_array);
+    v8::Local<Value> big_array = CompileRun("new Array(5000)");
+    a->Set(context, v8_str("y"), big_array).FromJust();
     big_heap_size = CcTest::heap()->SizeOfObjects();
   }
 
   object_a.flag = false;
   object_b.flag = false;
-  object_a.handle.SetPhantom(&object_a, &SetFlag);
-  object_b.handle.SetPhantom(&object_b, &SetFlag);
+  object_a.handle.SetWeak(&object_a, &SetFlag,
+                          v8::WeakCallbackType::kParameter);
+  object_b.handle.SetWeak(&object_b, &SetFlag,
+                          v8::WeakCallbackType::kParameter);
   CHECK(!object_b.handle.IsIndependent());
   object_a.handle.MarkIndependent();
   object_b.handle.MarkIndependent();
   CHECK(object_b.handle.IsIndependent());
   if (global_gc) {
-    CcTest::heap()->CollectAllGarbage(TestHeap::Heap::kNoGCFlags);
+    CcTest::heap()->CollectAllGarbage();
   } else {
     CcTest::heap()->CollectGarbage(i::NEW_SPACE);
   }
   // A single GC should be enough to reclaim the memory, since we are using
   // phantom handles.
-  CHECK_LT(CcTest::heap()->SizeOfObjects(), big_heap_size - 200000);
+  CHECK_LT(CcTest::heap()->SizeOfObjects(), big_heap_size - 20000);
   CHECK(object_a.flag);
   CHECK(object_b.flag);
 }
 
 
-THREADED_TEST(IndependentWeakHandle) {
+TEST(IndependentWeakHandle) {
   IndependentWeakHandle(false, false);
   IndependentWeakHandle(false, true);
   IndependentWeakHandle(true, false);
@@ -7797,9 +7575,11 @@
 
 
 void CheckInternalFields(
-    const v8::InternalFieldsCallbackData<Trivial, Trivial2>& data) {
-  Trivial* t1 = data.GetInternalField1();
-  Trivial2* t2 = data.GetInternalField2();
+    const v8::WeakCallbackInfo<v8::Persistent<v8::Object>>& data) {
+  v8::Persistent<v8::Object>* handle = data.GetParameter();
+  handle->Reset();
+  Trivial* t1 = reinterpret_cast<Trivial*>(data.GetInternalField(0));
+  Trivial2* t2 = reinterpret_cast<Trivial2*>(data.GetInternalField(1));
   CHECK_EQ(42, t1->x());
   CHECK_EQ(103, t2->x());
   t1->set_x(1729);
@@ -7819,7 +7599,10 @@
   instance_templ->SetInternalFieldCount(2);
   {
     v8::HandleScope scope(isolate);
-    Local<v8::Object> obj = templ->GetFunction()->NewInstance();
+    Local<v8::Object> obj = templ->GetFunction(env.local())
+                                .ToLocalChecked()
+                                ->NewInstance(env.local())
+                                .ToLocalChecked();
     v8::Persistent<v8::Object> handle(isolate, obj);
     CHECK_EQ(2, obj->InternalFieldCount());
     CHECK(obj->GetInternalField(0)->IsUndefined());
@@ -7835,13 +7618,14 @@
         reinterpret_cast<Trivial2*>(obj->GetAlignedPointerFromInternalField(1));
     CHECK_EQ(103, t2->x());
 
-    handle.SetPhantom(CheckInternalFields, 0, 1);
+    handle.SetWeak<v8::Persistent<v8::Object>>(
+        &handle, CheckInternalFields, v8::WeakCallbackType::kInternalFields);
     if (!global_gc) {
       handle.MarkIndependent();
     }
   }
   if (global_gc) {
-    CcTest::heap()->CollectAllGarbage(TestHeap::Heap::kNoGCFlags);
+    CcTest::heap()->CollectAllGarbage();
   } else {
     CcTest::heap()->CollectGarbage(i::NEW_SPACE);
   }
@@ -7861,19 +7645,22 @@
 
 
 static void ResetUseValueAndSetFlag(
-    const v8::WeakCallbackData<v8::Object, FlagAndPersistent>& data) {
+    const v8::WeakCallbackInfo<FlagAndPersistent>& data) {
   // Blink will reset the handle, and then use the other handle, so they
   // can't use the same backing slot.
   data.GetParameter()->handle.Reset();
-  data.GetValue()->IsBoolean();  // Make sure the handle still works.
   data.GetParameter()->flag = true;
 }
 
 
-static void ResetWeakHandle(bool global_gc) {
+void v8::internal::HeapTester::ResetWeakHandle(bool global_gc) {
+  using v8::Context;
+  using v8::Local;
+  using v8::Object;
+
   v8::Isolate* iso = CcTest::isolate();
   v8::HandleScope scope(iso);
-  v8::Handle<Context> context = Context::New(iso);
+  v8::Local<Context> context = Context::New(iso);
   Context::Scope context_scope(context);
 
   FlagAndPersistent object_a, object_b;
@@ -7885,8 +7672,7 @@
     object_a.handle.Reset(iso, a);
     object_b.handle.Reset(iso, b);
     if (global_gc) {
-      CcTest::heap()->CollectAllGarbage(
-          TestHeap::Heap::kAbortIncrementalMarkingMask);
+      CcTest::heap()->CollectAllGarbage(Heap::kAbortIncrementalMarkingMask);
     } else {
       CcTest::heap()->CollectGarbage(i::NEW_SPACE);
     }
@@ -7894,16 +7680,17 @@
 
   object_a.flag = false;
   object_b.flag = false;
-  object_a.handle.SetWeak(&object_a, &ResetUseValueAndSetFlag);
-  object_b.handle.SetWeak(&object_b, &ResetUseValueAndSetFlag);
+  object_a.handle.SetWeak(&object_a, &ResetUseValueAndSetFlag,
+                          v8::WeakCallbackType::kParameter);
+  object_b.handle.SetWeak(&object_b, &ResetUseValueAndSetFlag,
+                          v8::WeakCallbackType::kParameter);
   if (!global_gc) {
     object_a.handle.MarkIndependent();
     object_b.handle.MarkIndependent();
     CHECK(object_b.handle.IsIndependent());
   }
   if (global_gc) {
-    CcTest::heap()->CollectAllGarbage(
-        TestHeap::Heap::kAbortIncrementalMarkingMask);
+    CcTest::heap()->CollectAllGarbage(Heap::kAbortIncrementalMarkingMask);
   } else {
     CcTest::heap()->CollectGarbage(i::NEW_SPACE);
   }
@@ -7912,49 +7699,55 @@
 }
 
 
-THREADED_TEST(ResetWeakHandle) {
-  ResetWeakHandle(false);
-  ResetWeakHandle(true);
+THREADED_HEAP_TEST(ResetWeakHandle) {
+  v8::internal::HeapTester::ResetWeakHandle(false);
+  v8::internal::HeapTester::ResetWeakHandle(true);
 }
 
 
-static void InvokeScavenge() {
-  CcTest::heap()->CollectGarbage(i::NEW_SPACE);
-}
+static void InvokeScavenge() { CcTest::heap()->CollectGarbage(i::NEW_SPACE); }
 
 
-static void InvokeMarkSweep() {
-  CcTest::heap()->CollectAllGarbage(i::Heap::kNoGCFlags);
-}
+static void InvokeMarkSweep() { CcTest::heap()->CollectAllGarbage(); }
 
 
-static void ForceScavenge(
-    const v8::WeakCallbackData<v8::Object, FlagAndPersistent>& data) {
-  data.GetParameter()->handle.Reset();
+static void ForceScavenge2(
+    const v8::WeakCallbackInfo<FlagAndPersistent>& data) {
   data.GetParameter()->flag = true;
   InvokeScavenge();
 }
 
-
-static void ForceMarkSweep(
-    const v8::WeakCallbackData<v8::Object, FlagAndPersistent>& data) {
+static void ForceScavenge1(
+    const v8::WeakCallbackInfo<FlagAndPersistent>& data) {
   data.GetParameter()->handle.Reset();
+  data.SetSecondPassCallback(ForceScavenge2);
+}
+
+
+static void ForceMarkSweep2(
+    const v8::WeakCallbackInfo<FlagAndPersistent>& data) {
   data.GetParameter()->flag = true;
   InvokeMarkSweep();
 }
 
+static void ForceMarkSweep1(
+    const v8::WeakCallbackInfo<FlagAndPersistent>& data) {
+  data.GetParameter()->handle.Reset();
+  data.SetSecondPassCallback(ForceMarkSweep2);
+}
+
 
 THREADED_TEST(GCFromWeakCallbacks) {
   v8::Isolate* isolate = CcTest::isolate();
+  v8::Locker locker(CcTest::isolate());
   v8::HandleScope scope(isolate);
-  v8::Handle<Context> context = Context::New(isolate);
+  v8::Local<Context> context = Context::New(isolate);
   Context::Scope context_scope(context);
 
   static const int kNumberOfGCTypes = 2;
-  typedef v8::WeakCallbackData<v8::Object, FlagAndPersistent>::Callback
-      Callback;
-  Callback gc_forcing_callback[kNumberOfGCTypes] =
-      {&ForceScavenge, &ForceMarkSweep};
+  typedef v8::WeakCallbackInfo<FlagAndPersistent>::Callback Callback;
+  Callback gc_forcing_callback[kNumberOfGCTypes] = {&ForceScavenge1,
+                                                    &ForceMarkSweep1};
 
   typedef void (*GCInvoker)();
   GCInvoker invoke_gc[kNumberOfGCTypes] = {&InvokeScavenge, &InvokeMarkSweep};
@@ -7967,266 +7760,96 @@
         object.handle.Reset(isolate, v8::Object::New(isolate));
       }
       object.flag = false;
-      object.handle.SetWeak(&object, gc_forcing_callback[inner_gc]);
+      object.handle.SetWeak(&object, gc_forcing_callback[inner_gc],
+                            v8::WeakCallbackType::kParameter);
       object.handle.MarkIndependent();
       invoke_gc[outer_gc]();
+      EmptyMessageQueues(isolate);
       CHECK(object.flag);
     }
   }
 }
 
 
-static void RevivingCallback(
-    const v8::WeakCallbackData<v8::Object, FlagAndPersistent>& data) {
-  data.GetParameter()->handle.ClearWeak();
-  data.GetParameter()->flag = true;
-}
-
-
-THREADED_TEST(IndependentHandleRevival) {
-  v8::Isolate* isolate = CcTest::isolate();
-  v8::HandleScope scope(isolate);
-  v8::Handle<Context> context = Context::New(isolate);
-  Context::Scope context_scope(context);
-
-  FlagAndPersistent object;
-  {
-    v8::HandleScope handle_scope(isolate);
-    v8::Local<v8::Object> o = v8::Object::New(isolate);
-    object.handle.Reset(isolate, o);
-    o->Set(v8_str("x"), v8::Integer::New(isolate, 1));
-    v8::Local<String> y_str = v8_str("y");
-    o->Set(y_str, y_str);
-  }
-  object.flag = false;
-  object.handle.SetWeak(&object, &RevivingCallback);
-  object.handle.MarkIndependent();
-  CcTest::heap()->CollectGarbage(i::NEW_SPACE);
-  CHECK(object.flag);
-  CcTest::heap()->CollectAllGarbage(i::Heap::kAbortIncrementalMarkingMask);
-  {
-    v8::HandleScope handle_scope(isolate);
-    v8::Local<v8::Object> o =
-        v8::Local<v8::Object>::New(isolate, object.handle);
-    v8::Local<String> y_str = v8_str("y");
-    CHECK_EQ(v8::Integer::New(isolate, 1), o->Get(v8_str("x")));
-    CHECK(o->Get(y_str)->Equals(y_str));
-  }
-}
-
-
-v8::Handle<Function> args_fun;
+v8::Local<Function> args_fun;
 
 
 static void ArgumentsTestCallback(
     const v8::FunctionCallbackInfo<v8::Value>& args) {
   ApiTestFuzzer::Fuzz();
   v8::Isolate* isolate = args.GetIsolate();
-  CHECK_EQ(args_fun, args.Callee());
+  Local<Context> context = isolate->GetCurrentContext();
+  CHECK(args_fun->Equals(context, args.Callee()).FromJust());
   CHECK_EQ(3, args.Length());
-  CHECK_EQ(v8::Integer::New(isolate, 1), args[0]);
-  CHECK_EQ(v8::Integer::New(isolate, 2), args[1]);
-  CHECK_EQ(v8::Integer::New(isolate, 3), args[2]);
-  CHECK_EQ(v8::Undefined(isolate), args[3]);
+  CHECK(v8::Integer::New(isolate, 1)->Equals(context, args[0]).FromJust());
+  CHECK(v8::Integer::New(isolate, 2)->Equals(context, args[1]).FromJust());
+  CHECK(v8::Integer::New(isolate, 3)->Equals(context, args[2]).FromJust());
+  CHECK(v8::Undefined(isolate)->Equals(context, args[3]).FromJust());
   v8::HandleScope scope(args.GetIsolate());
-  CcTest::heap()->CollectAllGarbage(i::Heap::kNoGCFlags);
+  CcTest::heap()->CollectAllGarbage();
 }
 
 
 THREADED_TEST(Arguments) {
   v8::Isolate* isolate = CcTest::isolate();
   v8::HandleScope scope(isolate);
-  v8::Handle<v8::ObjectTemplate> global = ObjectTemplate::New(isolate);
+  v8::Local<v8::ObjectTemplate> global = ObjectTemplate::New(isolate);
   global->Set(v8_str("f"),
               v8::FunctionTemplate::New(isolate, ArgumentsTestCallback));
   LocalContext context(NULL, global);
-  args_fun = context->Global()->Get(v8_str("f")).As<Function>();
-  v8_compile("f(1, 2, 3)")->Run();
+  args_fun = context->Global()
+                 ->Get(context.local(), v8_str("f"))
+                 .ToLocalChecked()
+                 .As<Function>();
+  v8_compile("f(1, 2, 3)")->Run(context.local()).ToLocalChecked();
 }
 
 
-static void NoBlockGetterX(Local<Name> name,
-                           const v8::PropertyCallbackInfo<v8::Value>&) {}
+static int p_getter_count;
+static int p_getter_count2;
 
 
-static void NoBlockGetterI(uint32_t index,
-                           const v8::PropertyCallbackInfo<v8::Value>&) {
-}
-
-
-static void PDeleter(Local<Name> name,
-                     const v8::PropertyCallbackInfo<v8::Boolean>& info) {
-  if (!name->Equals(v8_str("foo"))) {
-    return;  // not intercepted
-  }
-
-  info.GetReturnValue().Set(false);  // intercepted, don't delete the property
-}
-
-
-static void IDeleter(uint32_t index,
-                     const v8::PropertyCallbackInfo<v8::Boolean>& info) {
-  if (index != 2) {
-    return;  // not intercepted
-  }
-
-  info.GetReturnValue().Set(false);  // intercepted, don't delete the property
-}
-
-
-THREADED_TEST(Deleter) {
-  v8::Isolate* isolate = CcTest::isolate();
-  v8::HandleScope scope(isolate);
-  v8::Handle<v8::ObjectTemplate> obj = ObjectTemplate::New(isolate);
-  obj->SetHandler(v8::NamedPropertyHandlerConfiguration(NoBlockGetterX, NULL,
-                                                        NULL, PDeleter, NULL));
-  obj->SetHandler(v8::IndexedPropertyHandlerConfiguration(
-      NoBlockGetterI, NULL, NULL, IDeleter, NULL));
-  LocalContext context;
-  context->Global()->Set(v8_str("k"), obj->NewInstance());
-  CompileRun(
-    "k.foo = 'foo';"
-    "k.bar = 'bar';"
-    "k[2] = 2;"
-    "k[4] = 4;");
-  CHECK(v8_compile("delete k.foo")->Run()->IsFalse());
-  CHECK(v8_compile("delete k.bar")->Run()->IsTrue());
-
-  CHECK_EQ(v8_compile("k.foo")->Run(), v8_str("foo"));
-  CHECK(v8_compile("k.bar")->Run()->IsUndefined());
-
-  CHECK(v8_compile("delete k[2]")->Run()->IsFalse());
-  CHECK(v8_compile("delete k[4]")->Run()->IsTrue());
-
-  CHECK_EQ(v8_compile("k[2]")->Run(), v8_num(2));
-  CHECK(v8_compile("k[4]")->Run()->IsUndefined());
-}
-
-
-static void GetK(Local<Name> name,
-                 const v8::PropertyCallbackInfo<v8::Value>& info) {
-  ApiTestFuzzer::Fuzz();
-  if (name->Equals(v8_str("foo")) ||
-      name->Equals(v8_str("bar")) ||
-      name->Equals(v8_str("baz"))) {
-    info.GetReturnValue().SetUndefined();
-  }
-}
-
-
-static void IndexedGetK(uint32_t index,
-                        const v8::PropertyCallbackInfo<v8::Value>& info) {
-  ApiTestFuzzer::Fuzz();
-  if (index == 0 || index == 1) info.GetReturnValue().SetUndefined();
-}
-
-
-static void NamedEnum(const v8::PropertyCallbackInfo<v8::Array>& info) {
-  ApiTestFuzzer::Fuzz();
-  v8::Handle<v8::Array> result = v8::Array::New(info.GetIsolate(), 3);
-  result->Set(v8::Integer::New(info.GetIsolate(), 0), v8_str("foo"));
-  result->Set(v8::Integer::New(info.GetIsolate(), 1), v8_str("bar"));
-  result->Set(v8::Integer::New(info.GetIsolate(), 2), v8_str("baz"));
-  info.GetReturnValue().Set(result);
-}
-
-
-static void IndexedEnum(const v8::PropertyCallbackInfo<v8::Array>& info) {
-  ApiTestFuzzer::Fuzz();
-  v8::Handle<v8::Array> result = v8::Array::New(info.GetIsolate(), 2);
-  result->Set(v8::Integer::New(info.GetIsolate(), 0), v8_str("0"));
-  result->Set(v8::Integer::New(info.GetIsolate(), 1), v8_str("1"));
-  info.GetReturnValue().Set(result);
-}
-
-
-THREADED_TEST(Enumerators) {
-  v8::Isolate* isolate = CcTest::isolate();
-  v8::HandleScope scope(isolate);
-  v8::Handle<v8::ObjectTemplate> obj = ObjectTemplate::New(isolate);
-  obj->SetHandler(
-      v8::NamedPropertyHandlerConfiguration(GetK, NULL, NULL, NULL, NamedEnum));
-  obj->SetHandler(v8::IndexedPropertyHandlerConfiguration(
-      IndexedGetK, NULL, NULL, NULL, IndexedEnum));
-  LocalContext context;
-  context->Global()->Set(v8_str("k"), obj->NewInstance());
-  v8::Handle<v8::Array> result = v8::Handle<v8::Array>::Cast(CompileRun(
-    "k[10] = 0;"
-    "k.a = 0;"
-    "k[5] = 0;"
-    "k.b = 0;"
-    "k[4294967295] = 0;"
-    "k.c = 0;"
-    "k[4294967296] = 0;"
-    "k.d = 0;"
-    "k[140000] = 0;"
-    "k.e = 0;"
-    "k[30000000000] = 0;"
-    "k.f = 0;"
-    "var result = [];"
-    "for (var prop in k) {"
-    "  result.push(prop);"
-    "}"
-    "result"));
-  // Check that we get all the property names returned including the
-  // ones from the enumerators in the right order: indexed properties
-  // in numerical order, indexed interceptor properties, named
-  // properties in insertion order, named interceptor properties.
-  // This order is not mandated by the spec, so this test is just
-  // documenting our behavior.
-  CHECK_EQ(17, result->Length());
-  // Indexed properties in numerical order.
-  CHECK_EQ(v8_str("5"), result->Get(v8::Integer::New(isolate, 0)));
-  CHECK_EQ(v8_str("10"), result->Get(v8::Integer::New(isolate, 1)));
-  CHECK_EQ(v8_str("140000"), result->Get(v8::Integer::New(isolate, 2)));
-  CHECK_EQ(v8_str("4294967295"), result->Get(v8::Integer::New(isolate, 3)));
-  // Indexed interceptor properties in the order they are returned
-  // from the enumerator interceptor.
-  CHECK_EQ(v8_str("0"), result->Get(v8::Integer::New(isolate, 4)));
-  CHECK_EQ(v8_str("1"), result->Get(v8::Integer::New(isolate, 5)));
-  // Named properties in insertion order.
-  CHECK_EQ(v8_str("a"), result->Get(v8::Integer::New(isolate, 6)));
-  CHECK_EQ(v8_str("b"), result->Get(v8::Integer::New(isolate, 7)));
-  CHECK_EQ(v8_str("c"), result->Get(v8::Integer::New(isolate, 8)));
-  CHECK_EQ(v8_str("4294967296"), result->Get(v8::Integer::New(isolate, 9)));
-  CHECK_EQ(v8_str("d"), result->Get(v8::Integer::New(isolate, 10)));
-  CHECK_EQ(v8_str("e"), result->Get(v8::Integer::New(isolate, 11)));
-  CHECK_EQ(v8_str("30000000000"), result->Get(v8::Integer::New(isolate, 12)));
-  CHECK_EQ(v8_str("f"), result->Get(v8::Integer::New(isolate, 13)));
-  // Named interceptor properties.
-  CHECK_EQ(v8_str("foo"), result->Get(v8::Integer::New(isolate, 14)));
-  CHECK_EQ(v8_str("bar"), result->Get(v8::Integer::New(isolate, 15)));
-  CHECK_EQ(v8_str("baz"), result->Get(v8::Integer::New(isolate, 16)));
-}
-
-
-int p_getter_count;
-int p_getter_count2;
-
-
-static void PGetter(Local<String> name,
+static void PGetter(Local<Name> name,
                     const v8::PropertyCallbackInfo<v8::Value>& info) {
   ApiTestFuzzer::Fuzz();
   p_getter_count++;
-  v8::Handle<v8::Object> global =
-      info.GetIsolate()->GetCurrentContext()->Global();
-  CHECK_EQ(info.Holder(), global->Get(v8_str("o1")));
-  if (name->Equals(v8_str("p1"))) {
-    CHECK_EQ(info.This(), global->Get(v8_str("o1")));
-  } else if (name->Equals(v8_str("p2"))) {
-    CHECK_EQ(info.This(), global->Get(v8_str("o2")));
-  } else if (name->Equals(v8_str("p3"))) {
-    CHECK_EQ(info.This(), global->Get(v8_str("o3")));
-  } else if (name->Equals(v8_str("p4"))) {
-    CHECK_EQ(info.This(), global->Get(v8_str("o4")));
+  v8::Local<v8::Context> context = info.GetIsolate()->GetCurrentContext();
+  v8::Local<v8::Object> global = context->Global();
+  CHECK(
+      info.Holder()
+          ->Equals(context, global->Get(context, v8_str("o1")).ToLocalChecked())
+          .FromJust());
+  if (name->Equals(context, v8_str("p1")).FromJust()) {
+    CHECK(info.This()
+              ->Equals(context,
+                       global->Get(context, v8_str("o1")).ToLocalChecked())
+              .FromJust());
+  } else if (name->Equals(context, v8_str("p2")).FromJust()) {
+    CHECK(info.This()
+              ->Equals(context,
+                       global->Get(context, v8_str("o2")).ToLocalChecked())
+              .FromJust());
+  } else if (name->Equals(context, v8_str("p3")).FromJust()) {
+    CHECK(info.This()
+              ->Equals(context,
+                       global->Get(context, v8_str("o3")).ToLocalChecked())
+              .FromJust());
+  } else if (name->Equals(context, v8_str("p4")).FromJust()) {
+    CHECK(info.This()
+              ->Equals(context,
+                       global->Get(context, v8_str("o4")).ToLocalChecked())
+              .FromJust());
   }
 }
 
 
-static void RunHolderTest(v8::Handle<v8::ObjectTemplate> obj) {
+static void RunHolderTest(v8::Local<v8::ObjectTemplate> obj) {
   ApiTestFuzzer::Fuzz();
   LocalContext context;
-  context->Global()->Set(v8_str("o1"), obj->NewInstance());
+  CHECK(context->Global()
+            ->Set(context.local(), v8_str("o1"),
+                  obj->NewInstance(context.local()).ToLocalChecked())
+            .FromJust());
   CompileRun(
     "o1.__proto__ = { };"
     "var o2 = { __proto__: o1 };"
@@ -8243,17 +7866,32 @@
                      const v8::PropertyCallbackInfo<v8::Value>& info) {
   ApiTestFuzzer::Fuzz();
   p_getter_count2++;
-  v8::Handle<v8::Object> global =
-      info.GetIsolate()->GetCurrentContext()->Global();
-  CHECK_EQ(info.Holder(), global->Get(v8_str("o1")));
-  if (name->Equals(v8_str("p1"))) {
-    CHECK_EQ(info.This(), global->Get(v8_str("o1")));
-  } else if (name->Equals(v8_str("p2"))) {
-    CHECK_EQ(info.This(), global->Get(v8_str("o2")));
-  } else if (name->Equals(v8_str("p3"))) {
-    CHECK_EQ(info.This(), global->Get(v8_str("o3")));
-  } else if (name->Equals(v8_str("p4"))) {
-    CHECK_EQ(info.This(), global->Get(v8_str("o4")));
+  v8::Local<v8::Context> context = info.GetIsolate()->GetCurrentContext();
+  v8::Local<v8::Object> global = context->Global();
+  CHECK(
+      info.Holder()
+          ->Equals(context, global->Get(context, v8_str("o1")).ToLocalChecked())
+          .FromJust());
+  if (name->Equals(context, v8_str("p1")).FromJust()) {
+    CHECK(info.This()
+              ->Equals(context,
+                       global->Get(context, v8_str("o1")).ToLocalChecked())
+              .FromJust());
+  } else if (name->Equals(context, v8_str("p2")).FromJust()) {
+    CHECK(info.This()
+              ->Equals(context,
+                       global->Get(context, v8_str("o2")).ToLocalChecked())
+              .FromJust());
+  } else if (name->Equals(context, v8_str("p3")).FromJust()) {
+    CHECK(info.This()
+              ->Equals(context,
+                       global->Get(context, v8_str("o3")).ToLocalChecked())
+              .FromJust());
+  } else if (name->Equals(context, v8_str("p4")).FromJust()) {
+    CHECK(info.This()
+              ->Equals(context,
+                       global->Get(context, v8_str("o4")).ToLocalChecked())
+              .FromJust());
   }
 }
 
@@ -8261,7 +7899,7 @@
 THREADED_TEST(GetterHolders) {
   v8::Isolate* isolate = CcTest::isolate();
   v8::HandleScope scope(isolate);
-  v8::Handle<v8::ObjectTemplate> obj = ObjectTemplate::New(isolate);
+  v8::Local<v8::ObjectTemplate> obj = ObjectTemplate::New(isolate);
   obj->SetAccessor(v8_str("p1"), PGetter);
   obj->SetAccessor(v8_str("p2"), PGetter);
   obj->SetAccessor(v8_str("p3"), PGetter);
@@ -8275,7 +7913,7 @@
 THREADED_TEST(PreInterceptorHolders) {
   v8::Isolate* isolate = CcTest::isolate();
   v8::HandleScope scope(isolate);
-  v8::Handle<v8::ObjectTemplate> obj = ObjectTemplate::New(isolate);
+  v8::Local<v8::ObjectTemplate> obj = ObjectTemplate::New(isolate);
   obj->SetHandler(v8::NamedPropertyHandlerConfiguration(PGetter2));
   p_getter_count2 = 0;
   RunHolderTest(obj);
@@ -8286,19 +7924,26 @@
 THREADED_TEST(ObjectInstantiation) {
   v8::Isolate* isolate = CcTest::isolate();
   v8::HandleScope scope(isolate);
-  v8::Handle<v8::ObjectTemplate> templ = ObjectTemplate::New(isolate);
+  v8::Local<v8::ObjectTemplate> templ = ObjectTemplate::New(isolate);
   templ->SetAccessor(v8_str("t"), PGetter2);
   LocalContext context;
-  context->Global()->Set(v8_str("o"), templ->NewInstance());
+  CHECK(context->Global()
+            ->Set(context.local(), v8_str("o"),
+                  templ->NewInstance(context.local()).ToLocalChecked())
+            .FromJust());
   for (int i = 0; i < 100; i++) {
     v8::HandleScope inner_scope(CcTest::isolate());
-    v8::Handle<v8::Object> obj = templ->NewInstance();
-    CHECK_NE(obj, context->Global()->Get(v8_str("o")));
-    context->Global()->Set(v8_str("o2"), obj);
-    v8::Handle<Value> value =
-        CompileRun("o.__proto__ === o2.__proto__");
-    CHECK_EQ(v8::True(isolate), value);
-    context->Global()->Set(v8_str("o"), obj);
+    v8::Local<v8::Object> obj =
+        templ->NewInstance(context.local()).ToLocalChecked();
+    CHECK(!obj->Equals(context.local(), context->Global()
+                                            ->Get(context.local(), v8_str("o"))
+                                            .ToLocalChecked())
+               .FromJust());
+    CHECK(
+        context->Global()->Set(context.local(), v8_str("o2"), obj).FromJust());
+    v8::Local<Value> value = CompileRun("o.__proto__ === o2.__proto__");
+    CHECK(v8::True(isolate)->Equals(context.local(), value).FromJust());
+    CHECK(context->Global()->Set(context.local(), v8_str("o"), obj).FromJust());
   }
 }
 
@@ -8324,7 +7969,7 @@
 }
 
 
-int GetUtf8Length(Handle<String> str) {
+int GetUtf8Length(Local<String> str) {
   int len = str->Utf8Length();
   if (len < 0) {
     i::Handle<i::String> istr(v8::Utils::OpenHandle(*str));
@@ -8338,27 +7983,37 @@
 THREADED_TEST(StringWrite) {
   LocalContext context;
   v8::HandleScope scope(context->GetIsolate());
-  v8::Handle<String> str = v8_str("abcde");
+  v8::Local<String> str = v8_str("abcde");
   // abc<Icelandic eth><Unicode snowman>.
-  v8::Handle<String> str2 = v8_str("abc\303\260\342\230\203");
-  v8::Handle<String> str3 = v8::String::NewFromUtf8(
-      context->GetIsolate(), "abc\0def", v8::String::kNormalString, 7);
+  v8::Local<String> str2 = v8_str("abc\303\260\342\230\203");
+  v8::Local<String> str3 =
+      v8::String::NewFromUtf8(context->GetIsolate(), "abc\0def",
+                              v8::NewStringType::kNormal, 7)
+          .ToLocalChecked();
   // "ab" + lead surrogate + "cd" + trail surrogate + "ef"
   uint16_t orphans[8] = { 0x61, 0x62, 0xd800, 0x63, 0x64, 0xdc00, 0x65, 0x66 };
-  v8::Handle<String> orphans_str = v8::String::NewFromTwoByte(
-      context->GetIsolate(), orphans, v8::String::kNormalString, 8);
+  v8::Local<String> orphans_str =
+      v8::String::NewFromTwoByte(context->GetIsolate(), orphans,
+                                 v8::NewStringType::kNormal, 8)
+          .ToLocalChecked();
   // single lead surrogate
   uint16_t lead[1] = { 0xd800 };
-  v8::Handle<String> lead_str = v8::String::NewFromTwoByte(
-      context->GetIsolate(), lead, v8::String::kNormalString, 1);
+  v8::Local<String> lead_str =
+      v8::String::NewFromTwoByte(context->GetIsolate(), lead,
+                                 v8::NewStringType::kNormal, 1)
+          .ToLocalChecked();
   // single trail surrogate
   uint16_t trail[1] = { 0xdc00 };
-  v8::Handle<String> trail_str = v8::String::NewFromTwoByte(
-      context->GetIsolate(), trail, v8::String::kNormalString, 1);
+  v8::Local<String> trail_str =
+      v8::String::NewFromTwoByte(context->GetIsolate(), trail,
+                                 v8::NewStringType::kNormal, 1)
+          .ToLocalChecked();
   // surrogate pair
   uint16_t pair[2] = { 0xd800,  0xdc00 };
-  v8::Handle<String> pair_str = v8::String::NewFromTwoByte(
-      context->GetIsolate(), pair, v8::String::kNormalString, 2);
+  v8::Local<String> pair_str =
+      v8::String::NewFromTwoByte(context->GetIsolate(), pair,
+                                 v8::NewStringType::kNormal, 2)
+          .ToLocalChecked();
   const int kStride = 4;  // Must match stride in for loops in JS below.
   CompileRun(
       "var left = '';"
@@ -8370,9 +8025,13 @@
       "for (var i = 0; i < 0xd800; i += 4) {"
       "  right = String.fromCharCode(i) + right;"
       "}");
-  v8::Handle<v8::Object> global = context->Global();
-  Handle<String> left_tree = global->Get(v8_str("left")).As<String>();
-  Handle<String> right_tree = global->Get(v8_str("right")).As<String>();
+  v8::Local<v8::Object> global = context->Global();
+  Local<String> left_tree = global->Get(context.local(), v8_str("left"))
+                                .ToLocalChecked()
+                                .As<String>();
+  Local<String> right_tree = global->Get(context.local(), v8_str("right"))
+                                 .ToLocalChecked()
+                                 .As<String>();
 
   CHECK_EQ(5, str2->Length());
   CHECK_EQ(0xd800 / kStride, left_tree->Length());
@@ -8648,99 +8307,23 @@
     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> a = Local<v8::Array>::Cast(
+      context->Global()->Get(context.local(), v8_str(name)).ToLocalChecked());
   Local<v8::Array> alens =
-      Local<v8::Array>::Cast(context->Global()->Get(v8_str(lengths_name)));
+      Local<v8::Array>::Cast(context->Global()
+                                 ->Get(context.local(), v8_str(lengths_name))
+                                 .ToLocalChecked());
   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));
+        Local<v8::String>::Cast(a->Get(context.local(), i).ToLocalChecked());
+    Local<v8::Number> expected_len = Local<v8::Number>::Cast(
+        alens->Get(context.local(), i).ToLocalChecked());
     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,  // NOLINT
-    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(context->GetIsolate());
@@ -8787,50 +8370,30 @@
       "}");
   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) {
+static bool SameSymbol(Local<String> s1, Local<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(v8::Isolate* isolate, const char* a,
-                             const char* b) {
-  Handle<String> symbol1 =
-      v8::String::NewFromUtf8(isolate, a, v8::String::kInternalizedString);
-  Handle<String> symbol2 =
-      v8::String::NewFromUtf8(isolate, b, v8::String::kInternalizedString);
-  CHECK(SameSymbol(symbol1, symbol2));
-}
-
 
 THREADED_TEST(Utf16Symbol) {
   LocalContext context;
   v8::HandleScope scope(context->GetIsolate());
 
-  Handle<String> symbol1 = v8::String::NewFromUtf8(
-      context->GetIsolate(), "abc", v8::String::kInternalizedString);
-  Handle<String> symbol2 = v8::String::NewFromUtf8(
-      context->GetIsolate(), "abc", v8::String::kInternalizedString);
+  Local<String> symbol1 =
+      v8::String::NewFromUtf8(context->GetIsolate(), "abc",
+                              v8::NewStringType::kInternalized)
+          .ToLocalChecked();
+  Local<String> symbol2 =
+      v8::String::NewFromUtf8(context->GetIsolate(), "abc",
+                              v8::NewStringType::kInternalized)
+          .ToLocalChecked();
   CHECK(SameSymbol(symbol1, symbol2));
 
-  SameSymbolHelper(context->GetIsolate(),
-                   "\360\220\220\205",  // 4 byte encoding.
-                   "\355\240\201\355\260\205");  // 2 3-byte surrogates.
-  SameSymbolHelper(context->GetIsolate(),
-                   "\355\240\201\355\260\206",  // 2 3-byte surrogates.
-                   "\360\220\220\206");  // 4 byte encoding.
-  SameSymbolHelper(context->GetIsolate(),
-                   "x\360\220\220\205",  // 4 byte encoding.
-                   "x\355\240\201\355\260\205");  // 2 3-byte surrogates.
-  SameSymbolHelper(context->GetIsolate(),
-                   "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';"
@@ -8846,35 +8409,100 @@
       "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::NewFromUtf8(
-      context->GetIsolate(), "benedictus", v8::String::kInternalizedString);
-  Handle<String> sym0b = v8::String::NewFromUtf8(
-      context->GetIsolate(), "S\303\270ren", v8::String::kInternalizedString);
-  Handle<String> sym1 =
+  Local<String> sym0 =
+      v8::String::NewFromUtf8(context->GetIsolate(), "benedictus",
+                              v8::NewStringType::kInternalized)
+          .ToLocalChecked();
+  Local<String> sym0b =
+      v8::String::NewFromUtf8(context->GetIsolate(), "S\303\270ren",
+                              v8::NewStringType::kInternalized)
+          .ToLocalChecked();
+  Local<String> sym1 =
       v8::String::NewFromUtf8(context->GetIsolate(), "\355\240\201\355\260\207",
-                              v8::String::kInternalizedString);
-  Handle<String> sym2 =
+                              v8::NewStringType::kInternalized)
+          .ToLocalChecked();
+  Local<String> sym2 =
       v8::String::NewFromUtf8(context->GetIsolate(), "\360\220\220\210",
-                              v8::String::kInternalizedString);
-  Handle<String> sym3 = v8::String::NewFromUtf8(
-      context->GetIsolate(), "x\355\240\201\355\260\207",
-      v8::String::kInternalizedString);
-  Handle<String> sym4 =
+                              v8::NewStringType::kInternalized)
+          .ToLocalChecked();
+  Local<String> sym3 = v8::String::NewFromUtf8(context->GetIsolate(),
+                                               "x\355\240\201\355\260\207",
+                                               v8::NewStringType::kInternalized)
+                           .ToLocalChecked();
+  Local<String> sym4 =
       v8::String::NewFromUtf8(context->GetIsolate(), "x\360\220\220\210",
-                              v8::String::kInternalizedString);
+                              v8::NewStringType::kInternalized)
+          .ToLocalChecked();
   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>::Cast(s0)));
-  CHECK(SameSymbol(sym0b, Handle<String>::Cast(s0b)));
-  CHECK(SameSymbol(sym1, Handle<String>::Cast(s1)));
-  CHECK(SameSymbol(sym2, Handle<String>::Cast(s2)));
-  CHECK(SameSymbol(sym3, Handle<String>::Cast(s3)));
-  CHECK(SameSymbol(sym4, Handle<String>::Cast(s4)));
+  Local<Value> s0 =
+      global->Get(context.local(), v8_str("sym0")).ToLocalChecked();
+  Local<Value> s0b =
+      global->Get(context.local(), v8_str("sym0b")).ToLocalChecked();
+  Local<Value> s1 =
+      global->Get(context.local(), v8_str("sym1")).ToLocalChecked();
+  Local<Value> s2 =
+      global->Get(context.local(), v8_str("sym2")).ToLocalChecked();
+  Local<Value> s3 =
+      global->Get(context.local(), v8_str("sym3")).ToLocalChecked();
+  Local<Value> s4 =
+      global->Get(context.local(), v8_str("sym4")).ToLocalChecked();
+  CHECK(SameSymbol(sym0, Local<String>::Cast(s0)));
+  CHECK(SameSymbol(sym0b, Local<String>::Cast(s0b)));
+  CHECK(SameSymbol(sym1, Local<String>::Cast(s1)));
+  CHECK(SameSymbol(sym2, Local<String>::Cast(s2)));
+  CHECK(SameSymbol(sym3, Local<String>::Cast(s3)));
+  CHECK(SameSymbol(sym4, Local<String>::Cast(s4)));
+}
+
+
+THREADED_TEST(Utf16MissingTrailing) {
+  LocalContext context;
+  v8::HandleScope scope(context->GetIsolate());
+
+  // Make sure it will go past the buffer, so it will call `WriteUtf16Slow`
+  int size = 1024 * 64;
+  uint8_t* buffer = new uint8_t[size];
+  for (int i = 0; i < size; i += 4) {
+    buffer[i] = 0xf0;
+    buffer[i + 1] = 0x9d;
+    buffer[i + 2] = 0x80;
+    buffer[i + 3] = 0x9e;
+  }
+
+  // Now invoke the decoder without last 3 bytes
+  v8::Local<v8::String> str =
+      v8::String::NewFromUtf8(
+          context->GetIsolate(), reinterpret_cast<char*>(buffer),
+          v8::NewStringType::kNormal, size - 3).ToLocalChecked();
+  USE(str);
+  delete[] buffer;
+}
+
+
+THREADED_TEST(Utf16Trailing3Byte) {
+  LocalContext context;
+  v8::HandleScope scope(context->GetIsolate());
+
+  // Make sure it will go past the buffer, so it will call `WriteUtf16Slow`
+  int size = 1024 * 63;
+  uint8_t* buffer = new uint8_t[size];
+  for (int i = 0; i < size; i += 3) {
+    buffer[i] = 0xe2;
+    buffer[i + 1] = 0x80;
+    buffer[i + 2] = 0xa6;
+  }
+
+  // Now invoke the decoder without last 3 bytes
+  v8::Local<v8::String> str =
+      v8::String::NewFromUtf8(
+          context->GetIsolate(), reinterpret_cast<char*>(buffer),
+          v8::NewStringType::kNormal, size).ToLocalChecked();
+
+  v8::String::Value value(str);
+  CHECK_EQ(value.length(), size / 3);
+  CHECK_EQ((*value)[value.length() - 1], 0x2026);
+
+  delete[] buffer;
 }
 
 
@@ -8883,29 +8511,32 @@
   v8::Isolate* isolate = context->GetIsolate();
   v8::HandleScope scope(isolate);
 
-  v8::Handle<String> str = v8_str("42");
-  v8::Handle<v8::Uint32> index = str->ToArrayIndex();
+  v8::Local<String> str = v8_str("42");
+  v8::MaybeLocal<v8::Uint32> index = str->ToArrayIndex(context.local());
   CHECK(!index.IsEmpty());
-  CHECK_EQ(42.0, index->Uint32Value());
+  CHECK_EQ(42.0,
+           index.ToLocalChecked()->Uint32Value(context.local()).FromJust());
   str = v8_str("42asdf");
-  index = str->ToArrayIndex();
+  index = str->ToArrayIndex(context.local());
   CHECK(index.IsEmpty());
   str = v8_str("-42");
-  index = str->ToArrayIndex();
+  index = str->ToArrayIndex(context.local());
   CHECK(index.IsEmpty());
-  str = v8_str("4294967295");
-  index = str->ToArrayIndex();
+  str = v8_str("4294967294");
+  index = str->ToArrayIndex(context.local());
   CHECK(!index.IsEmpty());
-  CHECK_EQ(4294967295.0, index->Uint32Value());
-  v8::Handle<v8::Number> num = v8::Number::New(isolate, 1);
-  index = num->ToArrayIndex();
+  CHECK_EQ(4294967294.0,
+           index.ToLocalChecked()->Uint32Value(context.local()).FromJust());
+  v8::Local<v8::Number> num = v8::Number::New(isolate, 1);
+  index = num->ToArrayIndex(context.local());
   CHECK(!index.IsEmpty());
-  CHECK_EQ(1.0, index->Uint32Value());
+  CHECK_EQ(1.0,
+           index.ToLocalChecked()->Uint32Value(context.local()).FromJust());
   num = v8::Number::New(isolate, -1);
-  index = num->ToArrayIndex();
+  index = num->ToArrayIndex(context.local());
   CHECK(index.IsEmpty());
-  v8::Handle<v8::Object> obj = v8::Object::New(isolate);
-  index = obj->ToArrayIndex();
+  v8::Local<v8::Object> obj = v8::Object::New(isolate);
+  index = obj->ToArrayIndex(context.local());
   CHECK(index.IsEmpty());
 }
 
@@ -8914,33 +8545,58 @@
   LocalContext context;
   v8::HandleScope scope(context->GetIsolate());
 
-  v8::Handle<String> foo = v8_str("foo");
-  v8::Handle<String> message = v8_str("message");
-  v8::Handle<Value> range_error = v8::Exception::RangeError(foo);
+  v8::Local<String> foo = v8_str("foo");
+  v8::Local<String> message = v8_str("message");
+  v8::Local<Value> range_error = v8::Exception::RangeError(foo);
   CHECK(range_error->IsObject());
-  CHECK(range_error.As<v8::Object>()->Get(message)->Equals(foo));
-  v8::Handle<Value> reference_error = v8::Exception::ReferenceError(foo);
+  CHECK(range_error.As<v8::Object>()
+            ->Get(context.local(), message)
+            .ToLocalChecked()
+            ->Equals(context.local(), foo)
+            .FromJust());
+  v8::Local<Value> reference_error = v8::Exception::ReferenceError(foo);
   CHECK(reference_error->IsObject());
-  CHECK(reference_error.As<v8::Object>()->Get(message)->Equals(foo));
-  v8::Handle<Value> syntax_error = v8::Exception::SyntaxError(foo);
+  CHECK(reference_error.As<v8::Object>()
+            ->Get(context.local(), message)
+            .ToLocalChecked()
+            ->Equals(context.local(), foo)
+            .FromJust());
+  v8::Local<Value> syntax_error = v8::Exception::SyntaxError(foo);
   CHECK(syntax_error->IsObject());
-  CHECK(syntax_error.As<v8::Object>()->Get(message)->Equals(foo));
-  v8::Handle<Value> type_error = v8::Exception::TypeError(foo);
+  CHECK(syntax_error.As<v8::Object>()
+            ->Get(context.local(), message)
+            .ToLocalChecked()
+            ->Equals(context.local(), foo)
+            .FromJust());
+  v8::Local<Value> type_error = v8::Exception::TypeError(foo);
   CHECK(type_error->IsObject());
-  CHECK(type_error.As<v8::Object>()->Get(message)->Equals(foo));
-  v8::Handle<Value> error = v8::Exception::Error(foo);
+  CHECK(type_error.As<v8::Object>()
+            ->Get(context.local(), message)
+            .ToLocalChecked()
+            ->Equals(context.local(), foo)
+            .FromJust());
+  v8::Local<Value> error = v8::Exception::Error(foo);
   CHECK(error->IsObject());
-  CHECK(error.As<v8::Object>()->Get(message)->Equals(foo));
+  CHECK(error.As<v8::Object>()
+            ->Get(context.local(), message)
+            .ToLocalChecked()
+            ->Equals(context.local(), foo)
+            .FromJust());
 }
 
 
 static void ThrowV8Exception(const v8::FunctionCallbackInfo<v8::Value>& info) {
   ApiTestFuzzer::Fuzz();
-  v8::Handle<String> foo = v8_str("foo");
-  v8::Handle<String> message = v8_str("message");
-  v8::Handle<Value> error = v8::Exception::Error(foo);
+  v8::Local<String> foo = v8_str("foo");
+  v8::Local<String> message = v8_str("message");
+  v8::Local<Value> error = v8::Exception::Error(foo);
   CHECK(error->IsObject());
-  CHECK(error.As<v8::Object>()->Get(message)->Equals(foo));
+  v8::Local<v8::Context> context = info.GetIsolate()->GetCurrentContext();
+  CHECK(error.As<v8::Object>()
+            ->Get(context, message)
+            .ToLocalChecked()
+            ->Equals(context, foo)
+            .FromJust());
   info.GetIsolate()->ThrowException(error);
   info.GetReturnValue().SetUndefined();
 }
@@ -8949,17 +8605,19 @@
 THREADED_TEST(ExceptionCreateMessage) {
   LocalContext context;
   v8::HandleScope scope(context->GetIsolate());
-  v8::Handle<String> foo_str = v8_str("foo");
-  v8::Handle<String> message_str = v8_str("message");
+  v8::Local<String> foo_str = v8_str("foo");
+  v8::Local<String> message_str = v8_str("message");
 
-  v8::V8::SetCaptureStackTraceForUncaughtExceptions(true);
+  context->GetIsolate()->SetCaptureStackTraceForUncaughtExceptions(true);
 
   Local<v8::FunctionTemplate> fun =
       v8::FunctionTemplate::New(context->GetIsolate(), ThrowV8Exception);
   v8::Local<v8::Object> global = context->Global();
-  global->Set(v8_str("throwV8Exception"), fun->GetFunction());
+  CHECK(global->Set(context.local(), v8_str("throwV8Exception"),
+                    fun->GetFunction(context.local()).ToLocalChecked())
+            .FromJust());
 
-  TryCatch try_catch;
+  TryCatch try_catch(context->GetIsolate());
   CompileRun(
       "function f1() {\n"
       "  throwV8Exception();\n"
@@ -8967,16 +8625,21 @@
       "f1();");
   CHECK(try_catch.HasCaught());
 
-  v8::Handle<v8::Value> error = try_catch.Exception();
+  v8::Local<v8::Value> error = try_catch.Exception();
   CHECK(error->IsObject());
-  CHECK(error.As<v8::Object>()->Get(message_str)->Equals(foo_str));
+  CHECK(error.As<v8::Object>()
+            ->Get(context.local(), message_str)
+            .ToLocalChecked()
+            ->Equals(context.local(), foo_str)
+            .FromJust());
 
-  v8::Handle<v8::Message> message = v8::Exception::CreateMessage(error);
+  v8::Local<v8::Message> message =
+      v8::Exception::CreateMessage(context->GetIsolate(), error);
   CHECK(!message.IsEmpty());
-  CHECK_EQ(2, message->GetLineNumber());
-  CHECK_EQ(2, message->GetStartColumn());
+  CHECK_EQ(2, message->GetLineNumber(context.local()).FromJust());
+  CHECK_EQ(2, message->GetStartColumn(context.local()).FromJust());
 
-  v8::Handle<v8::StackTrace> stackTrace = message->GetStackTrace();
+  v8::Local<v8::StackTrace> stackTrace = message->GetStackTrace();
   CHECK(!stackTrace.IsEmpty());
   CHECK_EQ(2, stackTrace->GetFrameCount());
 
@@ -8984,7 +8647,7 @@
   CHECK(!stackTrace.IsEmpty());
   CHECK_EQ(2, stackTrace->GetFrameCount());
 
-  v8::V8::SetCaptureStackTraceForUncaughtExceptions(false);
+  context->GetIsolate()->SetCaptureStackTraceForUncaughtExceptions(false);
 
   // Now check message location when SetCaptureStackTraceForUncaughtExceptions
   // is false.
@@ -8999,12 +8662,16 @@
 
   error = try_catch.Exception();
   CHECK(error->IsObject());
-  CHECK(error.As<v8::Object>()->Get(message_str)->Equals(foo_str));
+  CHECK(error.As<v8::Object>()
+            ->Get(context.local(), message_str)
+            .ToLocalChecked()
+            ->Equals(context.local(), foo_str)
+            .FromJust());
 
-  message = v8::Exception::CreateMessage(error);
+  message = v8::Exception::CreateMessage(context->GetIsolate(), error);
   CHECK(!message.IsEmpty());
-  CHECK_EQ(2, message->GetLineNumber());
-  CHECK_EQ(9, message->GetStartColumn());
+  CHECK_EQ(2, message->GetLineNumber(context.local()).FromJust());
+  CHECK_EQ(9, message->GetStartColumn(context.local()).FromJust());
 
   // Should be empty stack trace.
   stackTrace = message->GetStackTrace();
@@ -9013,6 +8680,22 @@
 }
 
 
+THREADED_TEST(ExceptionCreateMessageLength) {
+  LocalContext context;
+  v8::HandleScope scope(context->GetIsolate());
+
+  // Test that the message is not truncated.
+  TryCatch try_catch(context->GetIsolate());
+  CompileRun(
+      "var message = 'm';"
+      "while (message.length < 1000) message += message;"
+      "throw message;");
+  CHECK(try_catch.HasCaught());
+
+  CHECK_LT(1000, try_catch.Message()->Get()->Length());
+}
+
+
 static void YGetter(Local<String> name,
                     const v8::PropertyCallbackInfo<v8::Value>& info) {
   ApiTestFuzzer::Fuzz();
@@ -9024,48 +8707,27 @@
                     Local<Value> value,
                     const v8::PropertyCallbackInfo<void>& info) {
   Local<Object> this_obj = Local<Object>::Cast(info.This());
-  if (this_obj->Has(name)) this_obj->Delete(name);
-  this_obj->Set(name, value);
+  v8::Local<v8::Context> context = info.GetIsolate()->GetCurrentContext();
+  if (this_obj->Has(context, name).FromJust())
+    this_obj->Delete(context, name).FromJust();
+  CHECK(this_obj->Set(context, name, value).FromJust());
 }
 
 
 THREADED_TEST(DeleteAccessor) {
   v8::Isolate* isolate = CcTest::isolate();
   v8::HandleScope scope(isolate);
-  v8::Handle<v8::ObjectTemplate> obj = ObjectTemplate::New(isolate);
+  v8::Local<v8::ObjectTemplate> obj = ObjectTemplate::New(isolate);
   obj->SetAccessor(v8_str("y"), YGetter, YSetter);
   LocalContext context;
-  v8::Handle<v8::Object> holder = obj->NewInstance();
-  context->Global()->Set(v8_str("holder"), holder);
-  v8::Handle<Value> result = CompileRun(
-      "holder.y = 11; holder.y = 12; holder.y");
-  CHECK_EQ(12, result->Uint32Value());
-}
-
-
-THREADED_TEST(TypeSwitch) {
-  v8::Isolate* isolate = CcTest::isolate();
-  v8::HandleScope scope(isolate);
-  v8::Handle<v8::FunctionTemplate> templ1 = v8::FunctionTemplate::New(isolate);
-  v8::Handle<v8::FunctionTemplate> templ2 = v8::FunctionTemplate::New(isolate);
-  v8::Handle<v8::FunctionTemplate> templ3 = v8::FunctionTemplate::New(isolate);
-  v8::Handle<v8::FunctionTemplate> templs[3] = { templ1, templ2, templ3 };
-  v8::Handle<v8::TypeSwitch> type_switch = v8::TypeSwitch::New(3, templs);
-  LocalContext context;
-  v8::Handle<v8::Object> obj0 = v8::Object::New(isolate);
-  v8::Handle<v8::Object> obj1 = templ1->GetFunction()->NewInstance();
-  v8::Handle<v8::Object> obj2 = templ2->GetFunction()->NewInstance();
-  v8::Handle<v8::Object> obj3 = templ3->GetFunction()->NewInstance();
-  for (int i = 0; i < 10; i++) {
-    CHECK_EQ(0, type_switch->match(obj0));
-    CHECK_EQ(1, type_switch->match(obj1));
-    CHECK_EQ(2, type_switch->match(obj2));
-    CHECK_EQ(3, type_switch->match(obj3));
-    CHECK_EQ(3, type_switch->match(obj3));
-    CHECK_EQ(2, type_switch->match(obj2));
-    CHECK_EQ(1, type_switch->match(obj1));
-    CHECK_EQ(0, type_switch->match(obj0));
-  }
+  v8::Local<v8::Object> holder =
+      obj->NewInstance(context.local()).ToLocalChecked();
+  CHECK(context->Global()
+            ->Set(context.local(), v8_str("holder"), holder)
+            .FromJust());
+  v8::Local<Value> result =
+      CompileRun("holder.y = 11; holder.y = 12; holder.y");
+  CHECK_EQ(12u, result->Uint32Value(context.local()).FromJust());
 }
 
 
@@ -9075,20 +8737,22 @@
   trouble_nesting++;
 
   // Call a JS function that throws an uncaught exception.
-  Local<v8::Object> arg_this =
-      args.GetIsolate()->GetCurrentContext()->Global();
-  Local<Value> trouble_callee = (trouble_nesting == 3) ?
-    arg_this->Get(v8_str("trouble_callee")) :
-    arg_this->Get(v8_str("trouble_caller"));
+  Local<v8::Context> context = args.GetIsolate()->GetCurrentContext();
+  Local<v8::Object> arg_this = context->Global();
+  Local<Value> trouble_callee =
+      (trouble_nesting == 3)
+          ? arg_this->Get(context, v8_str("trouble_callee")).ToLocalChecked()
+          : arg_this->Get(context, v8_str("trouble_caller")).ToLocalChecked();
   CHECK(trouble_callee->IsFunction());
-  args.GetReturnValue().Set(
-      Function::Cast(*trouble_callee)->Call(arg_this, 0, NULL));
+  args.GetReturnValue().Set(Function::Cast(*trouble_callee)
+                                ->Call(context, arg_this, 0, NULL)
+                                .FromMaybe(v8::Local<v8::Value>()));
 }
 
 
 static int report_count = 0;
-static void ApiUncaughtExceptionTestListener(v8::Handle<v8::Message>,
-                                             v8::Handle<Value>) {
+static void ApiUncaughtExceptionTestListener(v8::Local<v8::Message>,
+                                             v8::Local<Value>) {
   report_count++;
 }
 
@@ -9100,12 +8764,14 @@
   LocalContext env;
   v8::Isolate* isolate = env->GetIsolate();
   v8::HandleScope scope(isolate);
-  v8::V8::AddMessageListener(ApiUncaughtExceptionTestListener);
+  isolate->AddMessageListener(ApiUncaughtExceptionTestListener);
 
   Local<v8::FunctionTemplate> fun =
       v8::FunctionTemplate::New(isolate, TroubleCallback);
   v8::Local<v8::Object> global = env->Global();
-  global->Set(v8_str("trouble"), fun->GetFunction());
+  CHECK(global->Set(env.local(), v8_str("trouble"),
+                    fun->GetFunction(env.local()).ToLocalChecked())
+            .FromJust());
 
   CompileRun(
       "function trouble_callee() {"
@@ -9115,25 +8781,31 @@
       "function trouble_caller() {"
       "  trouble();"
       "};");
-  Local<Value> trouble = global->Get(v8_str("trouble"));
+  Local<Value> trouble =
+      global->Get(env.local(), v8_str("trouble")).ToLocalChecked();
   CHECK(trouble->IsFunction());
-  Local<Value> trouble_callee = global->Get(v8_str("trouble_callee"));
+  Local<Value> trouble_callee =
+      global->Get(env.local(), v8_str("trouble_callee")).ToLocalChecked();
   CHECK(trouble_callee->IsFunction());
-  Local<Value> trouble_caller = global->Get(v8_str("trouble_caller"));
+  Local<Value> trouble_caller =
+      global->Get(env.local(), v8_str("trouble_caller")).ToLocalChecked();
   CHECK(trouble_caller->IsFunction());
-  Function::Cast(*trouble_caller)->Call(global, 0, NULL);
+  Function::Cast(*trouble_caller)
+      ->Call(env.local(), global, 0, NULL)
+      .FromMaybe(v8::Local<v8::Value>());
   CHECK_EQ(1, report_count);
-  v8::V8::RemoveMessageListeners(ApiUncaughtExceptionTestListener);
+  isolate->RemoveMessageListeners(ApiUncaughtExceptionTestListener);
 }
 
 
 TEST(ApiUncaughtExceptionInObjectObserve) {
+  v8::internal::FLAG_harmony_object_observe = true;
   v8::internal::FLAG_stack_size = 150;
   report_count = 0;
   LocalContext env;
   v8::Isolate* isolate = env->GetIsolate();
   v8::HandleScope scope(isolate);
-  v8::V8::AddMessageListener(ApiUncaughtExceptionTestListener);
+  isolate->AddMessageListener(ApiUncaughtExceptionTestListener);
   CompileRun(
       "var obj = {};"
       "var observe_count = 0;"
@@ -9149,20 +8821,23 @@
       "obj.foo = 'bar';");
   CHECK_EQ(3, report_count);
   ExpectInt32("observe_count", 2);
-  v8::V8::RemoveMessageListeners(ApiUncaughtExceptionTestListener);
+  isolate->RemoveMessageListeners(ApiUncaughtExceptionTestListener);
 }
 
 
 static const char* script_resource_name = "ExceptionInNativeScript.js";
-static void ExceptionInNativeScriptTestListener(v8::Handle<v8::Message> message,
-                                                v8::Handle<Value>) {
-  v8::Handle<v8::Value> name_val = message->GetScriptOrigin().ResourceName();
+static void ExceptionInNativeScriptTestListener(v8::Local<v8::Message> message,
+                                                v8::Local<Value>) {
+  v8::Local<v8::Value> name_val = message->GetScriptOrigin().ResourceName();
   CHECK(!name_val.IsEmpty() && name_val->IsString());
   v8::String::Utf8Value name(message->GetScriptOrigin().ResourceName());
-  CHECK_EQ(script_resource_name, *name);
-  CHECK_EQ(3, message->GetLineNumber());
-  v8::String::Utf8Value source_line(message->GetSourceLine());
-  CHECK_EQ("  new o.foo();", *source_line);
+  CHECK_EQ(0, strcmp(script_resource_name, *name));
+  v8::Local<v8::Context> context =
+      v8::Isolate::GetCurrent()->GetCurrentContext();
+  CHECK_EQ(3, message->GetLineNumber(context).FromJust());
+  v8::String::Utf8Value source_line(
+      message->GetSourceLine(context).ToLocalChecked());
+  CHECK_EQ(0, strcmp("  new o.foo();", *source_line));
 }
 
 
@@ -9170,12 +8845,14 @@
   LocalContext env;
   v8::Isolate* isolate = env->GetIsolate();
   v8::HandleScope scope(isolate);
-  v8::V8::AddMessageListener(ExceptionInNativeScriptTestListener);
+  isolate->AddMessageListener(ExceptionInNativeScriptTestListener);
 
   Local<v8::FunctionTemplate> fun =
       v8::FunctionTemplate::New(isolate, TroubleCallback);
   v8::Local<v8::Object> global = env->Global();
-  global->Set(v8_str("trouble"), fun->GetFunction());
+  CHECK(global->Set(env.local(), v8_str("trouble"),
+                    fun->GetFunction(env.local()).ToLocalChecked())
+            .FromJust());
 
   CompileRunWithOrigin(
       "function trouble() {\n"
@@ -9183,19 +8860,20 @@
       "  new o.foo();\n"
       "};",
       script_resource_name);
-  Local<Value> trouble = global->Get(v8_str("trouble"));
+  Local<Value> trouble =
+      global->Get(env.local(), v8_str("trouble")).ToLocalChecked();
   CHECK(trouble->IsFunction());
-  Function::Cast(*trouble)->Call(global, 0, NULL);
-  v8::V8::RemoveMessageListeners(ExceptionInNativeScriptTestListener);
+  CHECK(Function::Cast(*trouble)->Call(env.local(), global, 0, NULL).IsEmpty());
+  isolate->RemoveMessageListeners(ExceptionInNativeScriptTestListener);
 }
 
 
 TEST(CompilationErrorUsingTryCatchHandler) {
   LocalContext env;
   v8::HandleScope scope(env->GetIsolate());
-  v8::TryCatch try_catch;
+  v8::TryCatch try_catch(env->GetIsolate());
   v8_compile("This doesn't &*&@#$&*^ compile.");
-  CHECK_NE(NULL, *try_catch.Exception());
+  CHECK(*try_catch.Exception());
   CHECK(try_catch.HasCaught());
 }
 
@@ -9203,7 +8881,7 @@
 TEST(TryCatchFinallyUsingTryCatchHandler) {
   LocalContext env;
   v8::HandleScope scope(env->GetIsolate());
-  v8::TryCatch try_catch;
+  v8::TryCatch try_catch(env->GetIsolate());
   CompileRun("try { throw ''; } catch (e) {}");
   CHECK(!try_catch.HasCaught());
   CompileRun("try { throw ''; } finally {}");
@@ -9224,7 +8902,9 @@
 
 void CEvaluate(const v8::FunctionCallbackInfo<v8::Value>& args) {
   v8::HandleScope scope(args.GetIsolate());
-  CompileRun(args[0]->ToString(args.GetIsolate()));
+  CompileRun(args[0]
+                 ->ToString(args.GetIsolate()->GetCurrentContext())
+                 .ToLocalChecked());
 }
 
 
@@ -9235,7 +8915,7 @@
   templ->Set(v8_str("CEvaluate"),
              v8::FunctionTemplate::New(isolate, CEvaluate));
   LocalContext context(0, templ);
-  v8::TryCatch try_catch;
+  v8::TryCatch try_catch(isolate);
   CompileRun("try {"
              "  CEvaluate('throw 1;');"
              "} finally {"
@@ -9243,7 +8923,7 @@
   CHECK(try_catch.HasCaught());
   CHECK(!try_catch.Message().IsEmpty());
   String::Utf8Value exception_value(try_catch.Exception());
-  CHECK_EQ(*exception_value, "1");
+  CHECK_EQ(0, strcmp(*exception_value, "1"));
   try_catch.Reset();
   CompileRun("try {"
              "  CEvaluate('throw 1;');"
@@ -9253,36 +8933,15 @@
   CHECK(try_catch.HasCaught());
   CHECK(!try_catch.Message().IsEmpty());
   String::Utf8Value finally_exception_value(try_catch.Exception());
-  CHECK_EQ(*finally_exception_value, "2");
+  CHECK_EQ(0, strcmp(*finally_exception_value, "2"));
 }
 
 
 // For use within the TestSecurityHandler() test.
 static bool g_security_callback_result = false;
-static bool NamedSecurityTestCallback(Local<v8::Object> global,
-                                      Local<Value> name,
-                                      v8::AccessType type,
-                                      Local<Value> data) {
+static bool SecurityTestCallback(Local<v8::Context> accessing_context,
+                                 Local<v8::Object> accessed_object) {
   printf("a\n");
-  // Always allow read access.
-  if (type == v8::ACCESS_GET)
-    return true;
-
-  // Sometimes allow other access.
-  return g_security_callback_result;
-}
-
-
-static bool IndexedSecurityTestCallback(Local<v8::Object> global,
-                                        uint32_t key,
-                                        v8::AccessType type,
-                                        Local<Value> data) {
-  printf("b\n");
-  // Always allow read access.
-  if (type == v8::ACCESS_GET)
-    return true;
-
-  // Sometimes allow other access.
   return g_security_callback_result;
 }
 
@@ -9291,56 +8950,60 @@
 TEST(SecurityHandler) {
   v8::Isolate* isolate = CcTest::isolate();
   v8::HandleScope scope0(isolate);
-  v8::Handle<v8::ObjectTemplate> global_template =
+  v8::Local<v8::ObjectTemplate> global_template =
       v8::ObjectTemplate::New(isolate);
-  global_template->SetAccessCheckCallbacks(NamedSecurityTestCallback,
-                                           IndexedSecurityTestCallback);
+  global_template->SetAccessCheckCallback(SecurityTestCallback);
   // Create an environment
-  v8::Handle<Context> context0 = Context::New(isolate, NULL, global_template);
+  v8::Local<Context> context0 = Context::New(isolate, NULL, global_template);
   context0->Enter();
 
-  v8::Handle<v8::Object> global0 = context0->Global();
-  v8::Handle<Script> script0 = v8_compile("foo = 111");
-  script0->Run();
-  global0->Set(v8_str("0"), v8_num(999));
-  v8::Handle<Value> foo0 = global0->Get(v8_str("foo"));
-  CHECK_EQ(111, foo0->Int32Value());
-  v8::Handle<Value> z0 = global0->Get(v8_str("0"));
-  CHECK_EQ(999, z0->Int32Value());
+  v8::Local<v8::Object> global0 = context0->Global();
+  v8::Local<Script> script0 = v8_compile("foo = 111");
+  script0->Run(context0).ToLocalChecked();
+  CHECK(global0->Set(context0, v8_str("0"), v8_num(999)).FromJust());
+  v8::Local<Value> foo0 =
+      global0->Get(context0, v8_str("foo")).ToLocalChecked();
+  CHECK_EQ(111, foo0->Int32Value(context0).FromJust());
+  v8::Local<Value> z0 = global0->Get(context0, v8_str("0")).ToLocalChecked();
+  CHECK_EQ(999, z0->Int32Value(context0).FromJust());
 
   // Create another environment, should fail security checks.
   v8::HandleScope scope1(isolate);
 
-  v8::Handle<Context> context1 =
-    Context::New(isolate, NULL, global_template);
+  v8::Local<Context> context1 = Context::New(isolate, NULL, global_template);
   context1->Enter();
 
-  v8::Handle<v8::Object> global1 = context1->Global();
-  global1->Set(v8_str("othercontext"), global0);
+  v8::Local<v8::Object> global1 = context1->Global();
+  global1->Set(context1, v8_str("othercontext"), global0).FromJust();
   // This set will fail the security check.
-  v8::Handle<Script> script1 =
-    v8_compile("othercontext.foo = 222; othercontext[0] = 888;");
-  script1->Run();
+  v8::Local<Script> script1 =
+      v8_compile("othercontext.foo = 222; othercontext[0] = 888;");
+  CHECK(script1->Run(context1).IsEmpty());
+  g_security_callback_result = true;
   // This read will pass the security check.
-  v8::Handle<Value> foo1 = global0->Get(v8_str("foo"));
-  CHECK_EQ(111, foo1->Int32Value());
+  v8::Local<Value> foo1 =
+      global0->Get(context1, v8_str("foo")).ToLocalChecked();
+  CHECK_EQ(111, foo1->Int32Value(context0).FromJust());
   // This read will pass the security check.
-  v8::Handle<Value> z1 = global0->Get(v8_str("0"));
-  CHECK_EQ(999, z1->Int32Value());
+  v8::Local<Value> z1 = global0->Get(context1, v8_str("0")).ToLocalChecked();
+  CHECK_EQ(999, z1->Int32Value(context1).FromJust());
 
   // Create another environment, should pass security checks.
-  { g_security_callback_result = true;  // allow security handler to pass.
+  {
     v8::HandleScope scope2(isolate);
     LocalContext context2;
-    v8::Handle<v8::Object> global2 = context2->Global();
-    global2->Set(v8_str("othercontext"), global0);
-    v8::Handle<Script> script2 =
+    v8::Local<v8::Object> global2 = context2->Global();
+    CHECK(global2->Set(context2.local(), v8_str("othercontext"), global0)
+              .FromJust());
+    v8::Local<Script> script2 =
         v8_compile("othercontext.foo = 333; othercontext[0] = 888;");
-    script2->Run();
-    v8::Handle<Value> foo2 = global0->Get(v8_str("foo"));
-    CHECK_EQ(333, foo2->Int32Value());
-    v8::Handle<Value> z2 = global0->Get(v8_str("0"));
-    CHECK_EQ(888, z2->Int32Value());
+    script2->Run(context2.local()).ToLocalChecked();
+    v8::Local<Value> foo2 =
+        global0->Get(context2.local(), v8_str("foo")).ToLocalChecked();
+    CHECK_EQ(333, foo2->Int32Value(context2.local()).FromJust());
+    v8::Local<Value> z2 =
+        global0->Get(context2.local(), v8_str("0")).ToLocalChecked();
+    CHECK_EQ(888, z2->Int32Value(context2.local()).FromJust());
   }
 
   context1->Exit();
@@ -9351,7 +9014,7 @@
 THREADED_TEST(SecurityChecks) {
   LocalContext env1;
   v8::HandleScope handle_scope(env1->GetIsolate());
-  v8::Handle<Context> env2 = Context::New(env1->GetIsolate());
+  v8::Local<Context> env2 = Context::New(env1->GetIsolate());
 
   Local<Value> foo = v8_str("foo");
   Local<Value> bar = v8_str("bar");
@@ -9361,12 +9024,14 @@
 
   // Create a function in env1.
   CompileRun("spy=function(){return spy;}");
-  Local<Value> spy = env1->Global()->Get(v8_str("spy"));
+  Local<Value> spy =
+      env1->Global()->Get(env1.local(), v8_str("spy")).ToLocalChecked();
   CHECK(spy->IsFunction());
 
   // Create another function accessing global objects.
   CompileRun("spy2=function(){return new this.Array();}");
-  Local<Value> spy2 = env1->Global()->Get(v8_str("spy2"));
+  Local<Value> spy2 =
+      env1->Global()->Get(env1.local(), v8_str("spy2")).ToLocalChecked();
   CHECK(spy2->IsFunction());
 
   // Switch to env2 in the same domain and invoke spy on env2.
@@ -9374,7 +9039,9 @@
     env2->SetSecurityToken(foo);
     // Enter env2
     Context::Scope scope_env2(env2);
-    Local<Value> result = Function::Cast(*spy)->Call(env2->Global(), 0, NULL);
+    Local<Value> result = Function::Cast(*spy)
+                              ->Call(env2, env2->Global(), 0, NULL)
+                              .ToLocalChecked();
     CHECK(result->IsFunction());
   }
 
@@ -9383,8 +9050,8 @@
     Context::Scope scope_env2(env2);
 
     // Call cross_domain_call, it should throw an exception
-    v8::TryCatch try_catch;
-    Function::Cast(*spy2)->Call(env2->Global(), 0, NULL);
+    v8::TryCatch try_catch(env1->GetIsolate());
+    CHECK(Function::Cast(*spy2)->Call(env2, env2->Global(), 0, NULL).IsEmpty());
     CHECK(try_catch.HasCaught());
   }
 }
@@ -9394,18 +9061,25 @@
 THREADED_TEST(SecurityChecksForPrototypeChain) {
   LocalContext current;
   v8::HandleScope scope(current->GetIsolate());
-  v8::Handle<Context> other = Context::New(current->GetIsolate());
+  v8::Local<Context> other = Context::New(current->GetIsolate());
 
   // Change context to be able to get to the Object function in the
   // other context without hitting the security checks.
   v8::Local<Value> other_object;
   { Context::Scope scope(other);
-    other_object = other->Global()->Get(v8_str("Object"));
-    other->Global()->Set(v8_num(42), v8_num(87));
+    other_object =
+        other->Global()->Get(other, v8_str("Object")).ToLocalChecked();
+    CHECK(other->Global()->Set(other, v8_num(42), v8_num(87)).FromJust());
   }
 
-  current->Global()->Set(v8_str("other"), other->Global());
-  CHECK(v8_compile("other")->Run()->Equals(other->Global()));
+  CHECK(current->Global()
+            ->Set(current.local(), v8_str("other"), other->Global())
+            .FromJust());
+  CHECK(v8_compile("other")
+            ->Run(current.local())
+            .ToLocalChecked()
+            ->Equals(current.local(), other->Global())
+            .FromJust());
 
   // Make sure the security check fails here and we get an undefined
   // result instead of getting the Object function. Repeat in a loop
@@ -9413,65 +9087,60 @@
   v8::Local<Script> access_other0 = v8_compile("other.Object");
   v8::Local<Script> access_other1 = v8_compile("other[42]");
   for (int i = 0; i < 5; i++) {
-    CHECK(access_other0->Run().IsEmpty());
-    CHECK(access_other1->Run().IsEmpty());
+    CHECK(access_other0->Run(current.local()).IsEmpty());
+    CHECK(access_other1->Run(current.local()).IsEmpty());
   }
 
   // Create an object that has 'other' in its prototype chain and make
   // sure we cannot access the Object function indirectly through
   // that. Repeat in a loop to make sure to exercise the IC code.
-  v8_compile("function F() { };"
-             "F.prototype = other;"
-             "var f = new F();")->Run();
+  v8_compile(
+      "function F() { };"
+      "F.prototype = other;"
+      "var f = new F();")
+      ->Run(current.local())
+      .ToLocalChecked();
   v8::Local<Script> access_f0 = v8_compile("f.Object");
   v8::Local<Script> access_f1 = v8_compile("f[42]");
   for (int j = 0; j < 5; j++) {
-    CHECK(access_f0->Run().IsEmpty());
-    CHECK(access_f1->Run().IsEmpty());
+    CHECK(access_f0->Run(current.local()).IsEmpty());
+    CHECK(access_f1->Run(current.local()).IsEmpty());
   }
 
   // Now it gets hairy: Set the prototype for the other global object
   // to be the current global object. The prototype chain for 'f' now
   // goes through 'other' but ends up in the current global object.
   { Context::Scope scope(other);
-    other->Global()->Set(v8_str("__proto__"), current->Global());
+    CHECK(other->Global()
+              ->Set(other, v8_str("__proto__"), current->Global())
+              .FromJust());
   }
   // Set a named and an index property on the current global
   // object. To force the lookup to go through the other global object,
   // the properties must not exist in the other global object.
-  current->Global()->Set(v8_str("foo"), v8_num(100));
-  current->Global()->Set(v8_num(99), v8_num(101));
+  CHECK(current->Global()
+            ->Set(current.local(), v8_str("foo"), v8_num(100))
+            .FromJust());
+  CHECK(current->Global()
+            ->Set(current.local(), v8_num(99), v8_num(101))
+            .FromJust());
   // Try to read the properties from f and make sure that the access
   // gets stopped by the security checks on the other global object.
   Local<Script> access_f2 = v8_compile("f.foo");
   Local<Script> access_f3 = v8_compile("f[99]");
   for (int k = 0; k < 5; k++) {
-    CHECK(access_f2->Run().IsEmpty());
-    CHECK(access_f3->Run().IsEmpty());
+    CHECK(access_f2->Run(current.local()).IsEmpty());
+    CHECK(access_f3->Run(current.local()).IsEmpty());
   }
 }
 
 
-static bool named_security_check_with_gc_called;
+static bool security_check_with_gc_called;
 
-static bool NamedSecurityCallbackWithGC(Local<v8::Object> global,
-                                        Local<Value> name,
-                                        v8::AccessType type,
-                                        Local<Value> data) {
-  CcTest::heap()->CollectAllGarbage(i::Heap::kNoGCFlags);
-  named_security_check_with_gc_called = true;
-  return true;
-}
-
-
-static bool indexed_security_check_with_gc_called;
-
-static bool IndexedSecurityTestCallbackWithGC(Local<v8::Object> global,
-                                              uint32_t key,
-                                              v8::AccessType type,
-                                              Local<Value> data) {
-  CcTest::heap()->CollectAllGarbage(i::Heap::kNoGCFlags);
-  indexed_security_check_with_gc_called = true;
+static bool SecurityTestCallbackWithGC(Local<v8::Context> accessing_context,
+                                       Local<v8::Object> accessed_object) {
+  CcTest::heap()->CollectAllGarbage();
+  security_check_with_gc_called = true;
   return true;
 }
 
@@ -9479,38 +9148,36 @@
 TEST(SecurityTestGCAllowed) {
   v8::Isolate* isolate = CcTest::isolate();
   v8::HandleScope handle_scope(isolate);
-  v8::Handle<v8::ObjectTemplate> object_template =
+  v8::Local<v8::ObjectTemplate> object_template =
       v8::ObjectTemplate::New(isolate);
-  object_template->SetAccessCheckCallbacks(NamedSecurityCallbackWithGC,
-                                           IndexedSecurityTestCallbackWithGC);
+  object_template->SetAccessCheckCallback(SecurityTestCallbackWithGC);
 
-  v8::Handle<Context> context = Context::New(isolate);
+  v8::Local<Context> context = Context::New(isolate);
   v8::Context::Scope context_scope(context);
 
-  context->Global()->Set(v8_str("obj"), object_template->NewInstance());
+  CHECK(context->Global()
+            ->Set(context, v8_str("obj"),
+                  object_template->NewInstance(context).ToLocalChecked())
+            .FromJust());
 
-  named_security_check_with_gc_called = false;
-  CompileRun("obj.foo = new String(1001);");
-  CHECK(named_security_check_with_gc_called);
-
-  indexed_security_check_with_gc_called = false;
+  security_check_with_gc_called = false;
   CompileRun("obj[0] = new String(1002);");
-  CHECK(indexed_security_check_with_gc_called);
+  CHECK(security_check_with_gc_called);
 
-  named_security_check_with_gc_called = false;
-  CHECK(CompileRun("obj.foo")->ToString(isolate)->Equals(v8_str("1001")));
-  CHECK(named_security_check_with_gc_called);
-
-  indexed_security_check_with_gc_called = false;
-  CHECK(CompileRun("obj[0]")->ToString(isolate)->Equals(v8_str("1002")));
-  CHECK(indexed_security_check_with_gc_called);
+  security_check_with_gc_called = false;
+  CHECK(CompileRun("obj[0]")
+            ->ToString(context)
+            .ToLocalChecked()
+            ->Equals(context, v8_str("1002"))
+            .FromJust());
+  CHECK(security_check_with_gc_called);
 }
 
 
 THREADED_TEST(CrossDomainDelete) {
   LocalContext env1;
   v8::HandleScope handle_scope(env1->GetIsolate());
-  v8::Handle<Context> env2 = Context::New(env1->GetIsolate());
+  v8::Local<Context> env2 = Context::New(env1->GetIsolate());
 
   Local<Value> foo = v8_str("foo");
   Local<Value> bar = v8_str("bar");
@@ -9519,8 +9186,9 @@
   env1->SetSecurityToken(foo);
   env2->SetSecurityToken(foo);
 
-  env1->Global()->Set(v8_str("prop"), v8_num(3));
-  env2->Global()->Set(v8_str("env1"), env1->Global());
+  CHECK(
+      env1->Global()->Set(env1.local(), v8_str("prop"), v8_num(3)).FromJust());
+  CHECK(env2->Global()->Set(env2, v8_str("env1"), env1->Global()).FromJust());
 
   // Change env2 to a different domain and delete env1.prop.
   env2->SetSecurityToken(bar);
@@ -9532,16 +9200,17 @@
   }
 
   // Check that env1.prop still exists.
-  Local<Value> v = env1->Global()->Get(v8_str("prop"));
+  Local<Value> v =
+      env1->Global()->Get(env1.local(), v8_str("prop")).ToLocalChecked();
   CHECK(v->IsNumber());
-  CHECK_EQ(3, v->Int32Value());
+  CHECK_EQ(3, v->Int32Value(env1.local()).FromJust());
 }
 
 
-THREADED_TEST(CrossDomainIsPropertyEnumerable) {
+THREADED_TEST(CrossDomainPropertyIsEnumerable) {
   LocalContext env1;
   v8::HandleScope handle_scope(env1->GetIsolate());
-  v8::Handle<Context> env2 = Context::New(env1->GetIsolate());
+  v8::Local<Context> env2 = Context::New(env1->GetIsolate());
 
   Local<Value> foo = v8_str("foo");
   Local<Value> bar = v8_str("bar");
@@ -9550,8 +9219,9 @@
   env1->SetSecurityToken(foo);
   env2->SetSecurityToken(foo);
 
-  env1->Global()->Set(v8_str("prop"), v8_num(3));
-  env2->Global()->Set(v8_str("env1"), env1->Global());
+  CHECK(
+      env1->Global()->Set(env1.local(), v8_str("prop"), v8_num(3)).FromJust());
+  CHECK(env2->Global()->Set(env2, v8_str("env1"), env1->Global()).FromJust());
 
   // env1.prop is enumerable in env2.
   Local<String> test = v8_str("propertyIsEnumerable.call(env1, 'prop')");
@@ -9571,10 +9241,10 @@
 }
 
 
-THREADED_TEST(CrossDomainForIn) {
+THREADED_TEST(CrossDomainFor) {
   LocalContext env1;
   v8::HandleScope handle_scope(env1->GetIsolate());
-  v8::Handle<Context> env2 = Context::New(env1->GetIsolate());
+  v8::Local<Context> env2 = Context::New(env1->GetIsolate());
 
   Local<Value> foo = v8_str("foo");
   Local<Value> bar = v8_str("bar");
@@ -9583,8 +9253,48 @@
   env1->SetSecurityToken(foo);
   env2->SetSecurityToken(foo);
 
-  env1->Global()->Set(v8_str("prop"), v8_num(3));
-  env2->Global()->Set(v8_str("env1"), env1->Global());
+  CHECK(
+      env1->Global()->Set(env1.local(), v8_str("prop"), v8_num(3)).FromJust());
+  CHECK(env2->Global()->Set(env2, v8_str("env1"), env1->Global()).FromJust());
+
+  // Change env2 to a different domain and set env1's global object
+  // as the __proto__ of an object in env2 and enumerate properties
+  // in for-in. It shouldn't enumerate properties on env1's global
+  // object. It shouldn't throw either, just silently ignore them.
+  env2->SetSecurityToken(bar);
+  {
+    Context::Scope scope_env2(env2);
+    Local<Value> result = CompileRun(
+        "(function() {"
+        "  try {"
+        "    for (var p in env1) {"
+        "      if (p == 'prop') return false;"
+        "    }"
+        "    return true;"
+        "  } catch (e) {"
+        "    return false;"
+        "  }"
+        "})()");
+    CHECK(result->IsTrue());
+  }
+}
+
+
+THREADED_TEST(CrossDomainForInOnPrototype) {
+  LocalContext env1;
+  v8::HandleScope handle_scope(env1->GetIsolate());
+  v8::Local<Context> env2 = Context::New(env1->GetIsolate());
+
+  Local<Value> foo = v8_str("foo");
+  Local<Value> bar = v8_str("bar");
+
+  // Set to the same domain.
+  env1->SetSecurityToken(foo);
+  env2->SetSecurityToken(foo);
+
+  CHECK(
+      env1->Global()->Set(env1.local(), v8_str("prop"), v8_num(3)).FromJust());
+  CHECK(env2->Global()->Set(env2, v8_str("env1"), env1->Global()).FromJust());
 
   // Change env2 to a different domain and set env1's global object
   // as the __proto__ of an object in env2 and enumerate properties
@@ -9600,9 +9310,9 @@
         "    for (var p in obj) {"
         "      if (p == 'prop') return false;"
         "    }"
-        "    return false;"
-        "  } catch (e) {"
         "    return true;"
+        "  } catch (e) {"
+        "    return false;"
         "  }"
         "})()");
     CHECK(result->IsTrue());
@@ -9613,9 +9323,8 @@
 TEST(ContextDetachGlobal) {
   LocalContext env1;
   v8::HandleScope handle_scope(env1->GetIsolate());
-  v8::Handle<Context> env2 = Context::New(env1->GetIsolate());
+  v8::Local<Context> env2 = Context::New(env1->GetIsolate());
 
-  Local<v8::Object> global1 = env1->Global();
 
   Local<Value> foo = v8_str("foo");
 
@@ -9628,44 +9337,54 @@
 
   // Create a function in env2 and add a reference to it in env1.
   Local<v8::Object> global2 = env2->Global();
-  global2->Set(v8_str("prop"), v8::Integer::New(env2->GetIsolate(), 1));
+  CHECK(global2->Set(env2, v8_str("prop"),
+                     v8::Integer::New(env2->GetIsolate(), 1))
+            .FromJust());
   CompileRun("function getProp() {return prop;}");
 
-  env1->Global()->Set(v8_str("getProp"),
-                      global2->Get(v8_str("getProp")));
+  CHECK(env1->Global()
+            ->Set(env1.local(), v8_str("getProp"),
+                  global2->Get(env2, v8_str("getProp")).ToLocalChecked())
+            .FromJust());
 
   // Detach env2's global, and reuse the global object of env2
   env2->Exit();
   env2->DetachGlobal();
 
-  v8::Handle<Context> env3 = Context::New(env1->GetIsolate(),
-                                          0,
-                                          v8::Handle<v8::ObjectTemplate>(),
-                                          global2);
+  v8::Local<Context> env3 = Context::New(
+      env1->GetIsolate(), 0, v8::Local<v8::ObjectTemplate>(), global2);
   env3->SetSecurityToken(v8_str("bar"));
-  env3->Enter();
 
+  env3->Enter();
   Local<v8::Object> global3 = env3->Global();
-  CHECK_EQ(global2, global3);
-  CHECK(global3->Get(v8_str("prop"))->IsUndefined());
-  CHECK(global3->Get(v8_str("getProp"))->IsUndefined());
-  global3->Set(v8_str("prop"), v8::Integer::New(env3->GetIsolate(), -1));
-  global3->Set(v8_str("prop2"), v8::Integer::New(env3->GetIsolate(), 2));
+  CHECK(global2->Equals(env3, global3).FromJust());
+  CHECK(global3->Get(env3, v8_str("prop")).ToLocalChecked()->IsUndefined());
+  CHECK(global3->Get(env3, v8_str("getProp")).ToLocalChecked()->IsUndefined());
+  CHECK(global3->Set(env3, v8_str("prop"),
+                     v8::Integer::New(env3->GetIsolate(), -1))
+            .FromJust());
+  CHECK(global3->Set(env3, v8_str("prop2"),
+                     v8::Integer::New(env3->GetIsolate(), 2))
+            .FromJust());
   env3->Exit();
 
   // Call getProp in env1, and it should return the value 1
   {
-    Local<Value> get_prop = global1->Get(v8_str("getProp"));
+    Local<v8::Object> global1 = env1->Global();
+    Local<Value> get_prop =
+        global1->Get(env1.local(), v8_str("getProp")).ToLocalChecked();
     CHECK(get_prop->IsFunction());
-    v8::TryCatch try_catch;
-    Local<Value> r = Function::Cast(*get_prop)->Call(global1, 0, NULL);
+    v8::TryCatch try_catch(env1->GetIsolate());
+    Local<Value> r = Function::Cast(*get_prop)
+                         ->Call(env1.local(), global1, 0, NULL)
+                         .ToLocalChecked();
     CHECK(!try_catch.HasCaught());
-    CHECK_EQ(1, r->Int32Value());
+    CHECK_EQ(1, r->Int32Value(env1.local()).FromJust());
   }
 
   // Check that env3 is not accessible from env1
   {
-    Local<Value> r = global3->Get(v8_str("prop2"));
+    v8::MaybeLocal<Value> r = global3->Get(env1.local(), v8_str("prop2"));
     CHECK(r.IsEmpty());
   }
 }
@@ -9676,7 +9395,7 @@
   v8::HandleScope scope(env1->GetIsolate());
 
   // Create second environment.
-  v8::Handle<Context> env2 = Context::New(env1->GetIsolate());
+  v8::Local<Context> env2 = Context::New(env1->GetIsolate());
 
   Local<Value> foo = v8_str("foo");
 
@@ -9687,16 +9406,20 @@
   // Create a property on the global object in env2.
   {
     v8::Context::Scope scope(env2);
-    env2->Global()->Set(v8_str("p"), v8::Integer::New(env2->GetIsolate(), 42));
+    CHECK(env2->Global()
+              ->Set(env2, v8_str("p"), v8::Integer::New(env2->GetIsolate(), 42))
+              .FromJust());
   }
 
   // Create a reference to env2 global from env1 global.
-  env1->Global()->Set(v8_str("other"), env2->Global());
+  CHECK(env1->Global()
+            ->Set(env1.local(), v8_str("other"), env2->Global())
+            .FromJust());
 
   // Check that we have access to other.p in env2 from env1.
   Local<Value> result = CompileRun("other.p");
   CHECK(result->IsInt32());
-  CHECK_EQ(42, result->Int32Value());
+  CHECK_EQ(42, result->Int32Value(env1.local()).FromJust());
 
   // Hold on to global from env2 and detach global from env2.
   Local<v8::Object> global2 = env2->Global();
@@ -9708,11 +9431,9 @@
   CHECK(result.IsEmpty());
 
   // Reuse global2 for env3.
-  v8::Handle<Context> env3 = Context::New(env1->GetIsolate(),
-                                          0,
-                                          v8::Handle<v8::ObjectTemplate>(),
-                                          global2);
-  CHECK_EQ(global2, env3->Global());
+  v8::Local<Context> env3 = Context::New(
+      env1->GetIsolate(), 0, v8::Local<v8::ObjectTemplate>(), global2);
+  CHECK(global2->Equals(env1.local(), env3->Global()).FromJust());
 
   // Start by using the same security token for env3 as for env1 and env2.
   env3->SetSecurityToken(foo);
@@ -9720,13 +9441,15 @@
   // Create a property on the global object in env3.
   {
     v8::Context::Scope scope(env3);
-    env3->Global()->Set(v8_str("p"), v8::Integer::New(env3->GetIsolate(), 24));
+    CHECK(env3->Global()
+              ->Set(env3, v8_str("p"), v8::Integer::New(env3->GetIsolate(), 24))
+              .FromJust());
   }
 
   // Check that other.p is now the property in env3 and that we have access.
   result = CompileRun("other.p");
   CHECK(result->IsInt32());
-  CHECK_EQ(24, result->Int32Value());
+  CHECK_EQ(24, result->Int32Value(env3).FromJust());
 
   // Change security token for env3 to something different from env1 and env2.
   env3->SetSecurityToken(v8_str("bar"));
@@ -9740,8 +9463,9 @@
 
 
 void GetThisX(const v8::FunctionCallbackInfo<v8::Value>& info) {
+  v8::Local<v8::Context> context = info.GetIsolate()->GetCurrentContext();
   info.GetReturnValue().Set(
-      info.GetIsolate()->GetCurrentContext()->Global()->Get(v8_str("x")));
+      context->Global()->Get(context, v8_str("x")).ToLocalChecked());
 }
 
 
@@ -9763,47 +9487,53 @@
   env1->SetSecurityToken(foo);
   env2->SetSecurityToken(foo);
 
-  env1->Global()->Set(v8_str("x"), v8_str("env1_x"));
+  CHECK(env1->Global()
+            ->Set(env1.local(), v8_str("x"), v8_str("env1_x"))
+            .FromJust());
 
   {
     v8::Context::Scope scope(env2);
-    env2->Global()->Set(v8_str("x"), v8_str("env2_x"));
+    CHECK(env2->Global()->Set(env2, v8_str("x"), v8_str("env2_x")).FromJust());
     CompileRun(
         "function bound_x() { return x; }"
         "function get_x()   { return this.x; }"
         "function get_x_w() { return (function() {return this.x;})(); }");
-    env1->Global()->Set(v8_str("bound_x"), CompileRun("bound_x"));
-    env1->Global()->Set(v8_str("get_x"), CompileRun("get_x"));
-    env1->Global()->Set(v8_str("get_x_w"), CompileRun("get_x_w"));
-    env1->Global()->Set(
-        v8_str("this_x"),
-        CompileRun("Object.getOwnPropertyDescriptor(this, 'this_x').get"));
+    CHECK(env1->Global()
+              ->Set(env1.local(), v8_str("bound_x"), CompileRun("bound_x"))
+              .FromJust());
+    CHECK(env1->Global()
+              ->Set(env1.local(), v8_str("get_x"), CompileRun("get_x"))
+              .FromJust());
+    CHECK(env1->Global()
+              ->Set(env1.local(), v8_str("get_x_w"), CompileRun("get_x_w"))
+              .FromJust());
+    env1->Global()
+        ->Set(env1.local(), v8_str("this_x"),
+              CompileRun("Object.getOwnPropertyDescriptor(this, 'this_x').get"))
+        .FromJust();
   }
 
   Local<Object> env2_global = env2->Global();
-  env2_global->TurnOnAccessCheck();
   env2->DetachGlobal();
 
   Local<Value> result;
   result = CompileRun("bound_x()");
-  CHECK_EQ(v8_str("env2_x"), result);
+  CHECK(v8_str("env2_x")->Equals(env1.local(), result).FromJust());
   result = CompileRun("get_x()");
   CHECK(result.IsEmpty());
   result = CompileRun("get_x_w()");
   CHECK(result.IsEmpty());
   result = CompileRun("this_x()");
-  CHECK_EQ(v8_str("env2_x"), result);
+  CHECK(v8_str("env2_x")->Equals(env1.local(), result).FromJust());
 
   // Reattach env2's proxy
-  env2 = Context::New(env1->GetIsolate(),
-                      0,
-                      v8::Handle<v8::ObjectTemplate>(),
+  env2 = Context::New(env1->GetIsolate(), 0, v8::Local<v8::ObjectTemplate>(),
                       env2_global);
   env2->SetSecurityToken(foo);
   {
     v8::Context::Scope scope(env2);
-    env2->Global()->Set(v8_str("x"), v8_str("env3_x"));
-    env2->Global()->Set(v8_str("env1"), env1->Global());
+    CHECK(env2->Global()->Set(env2, v8_str("x"), v8_str("env3_x")).FromJust());
+    CHECK(env2->Global()->Set(env2, v8_str("env1"), env1->Global()).FromJust());
     result = CompileRun(
         "results = [];"
         "for (var i = 0; i < 4; i++ ) {"
@@ -9814,12 +9544,20 @@
         "}"
         "results");
     Local<v8::Array> results = Local<v8::Array>::Cast(result);
-    CHECK_EQ(16, results->Length());
+    CHECK_EQ(16u, results->Length());
     for (int i = 0; i < 16; i += 4) {
-      CHECK_EQ(v8_str("env2_x"), results->Get(i + 0));
-      CHECK_EQ(v8_str("env1_x"), results->Get(i + 1));
-      CHECK_EQ(v8_str("env3_x"), results->Get(i + 2));
-      CHECK_EQ(v8_str("env2_x"), results->Get(i + 3));
+      CHECK(v8_str("env2_x")
+                ->Equals(env2, results->Get(env2, i + 0).ToLocalChecked())
+                .FromJust());
+      CHECK(v8_str("env1_x")
+                ->Equals(env2, results->Get(env2, i + 1).ToLocalChecked())
+                .FromJust());
+      CHECK(v8_str("env3_x")
+                ->Equals(env2, results->Get(env2, i + 2).ToLocalChecked())
+                .FromJust());
+      CHECK(v8_str("env2_x")
+                ->Equals(env2, results->Get(env2, i + 3).ToLocalChecked())
+                .FromJust());
     }
   }
 
@@ -9833,12 +9571,24 @@
       "}"
       "results");
   Local<v8::Array> results = Local<v8::Array>::Cast(result);
-  CHECK_EQ(16, results->Length());
+  CHECK_EQ(16u, results->Length());
   for (int i = 0; i < 16; i += 4) {
-    CHECK_EQ(v8_str("env2_x"), results->Get(i + 0));
-    CHECK_EQ(v8_str("env3_x"), results->Get(i + 1));
-    CHECK_EQ(v8_str("env3_x"), results->Get(i + 2));
-    CHECK_EQ(v8_str("env2_x"), results->Get(i + 3));
+    CHECK(v8_str("env2_x")
+              ->Equals(env1.local(),
+                       results->Get(env1.local(), i + 0).ToLocalChecked())
+              .FromJust());
+    CHECK(v8_str("env3_x")
+              ->Equals(env1.local(),
+                       results->Get(env1.local(), i + 1).ToLocalChecked())
+              .FromJust());
+    CHECK(v8_str("env3_x")
+              ->Equals(env1.local(),
+                       results->Get(env1.local(), i + 2).ToLocalChecked())
+              .FromJust());
+    CHECK(v8_str("env2_x")
+              ->Equals(env1.local(),
+                       results->Get(env1.local(), i + 3).ToLocalChecked())
+              .FromJust());
   }
 
   result = CompileRun(
@@ -9851,32 +9601,34 @@
       "}"
       "results");
   results = Local<v8::Array>::Cast(result);
-  CHECK_EQ(16, results->Length());
+  CHECK_EQ(16u, results->Length());
   for (int i = 0; i < 16; i += 4) {
-    CHECK_EQ(v8_str("env2_x"), results->Get(i + 0));
-    CHECK_EQ(v8_str("env1_x"), results->Get(i + 1));
-    CHECK_EQ(v8_str("env3_x"), results->Get(i + 2));
-    CHECK_EQ(v8_str("env2_x"), results->Get(i + 3));
+    CHECK(v8_str("env2_x")
+              ->Equals(env1.local(),
+                       results->Get(env1.local(), i + 0).ToLocalChecked())
+              .FromJust());
+    CHECK(v8_str("env1_x")
+              ->Equals(env1.local(),
+                       results->Get(env1.local(), i + 1).ToLocalChecked())
+              .FromJust());
+    CHECK(v8_str("env3_x")
+              ->Equals(env1.local(),
+                       results->Get(env1.local(), i + 2).ToLocalChecked())
+              .FromJust());
+    CHECK(v8_str("env2_x")
+              ->Equals(env1.local(),
+                       results->Get(env1.local(), i + 3).ToLocalChecked())
+              .FromJust());
   }
 }
 
 
-static bool allowed_access_type[v8::ACCESS_KEYS + 1] = { false };
-static bool NamedAccessBlocker(Local<v8::Object> global,
-                               Local<Value> name,
-                               v8::AccessType type,
-                               Local<Value> data) {
-  return CcTest::isolate()->GetCurrentContext()->Global()->Equals(global) ||
-      allowed_access_type[type];
-}
-
-
-static bool IndexedAccessBlocker(Local<v8::Object> global,
-                                 uint32_t key,
-                                 v8::AccessType type,
-                                 Local<Value> data) {
-  return CcTest::isolate()->GetCurrentContext()->Global()->Equals(global) ||
-      allowed_access_type[type];
+static bool allowed_access = false;
+static bool AccessBlocker(Local<v8::Context> accessing_context,
+                          Local<v8::Object> accessed_object) {
+  v8::Local<v8::Context> context = CcTest::isolate()->GetCurrentContext();
+  return context->Global()->Equals(context, accessed_object).FromJust() ||
+         allowed_access;
 }
 
 
@@ -9890,11 +9642,11 @@
 }
 
 
-static void EchoSetter(Local<String> name,
-                       Local<Value> value,
-                       const v8::PropertyCallbackInfo<void>&) {
+static void EchoSetter(Local<String> name, Local<Value> value,
+                       const v8::PropertyCallbackInfo<void>& args) {
   if (value->IsNumber())
-    g_echo_value = value->Int32Value();
+    g_echo_value =
+        value->Int32Value(args.GetIsolate()->GetCurrentContext()).FromJust();
 }
 
 
@@ -9921,24 +9673,20 @@
 TEST(AccessControl) {
   v8::Isolate* isolate = CcTest::isolate();
   v8::HandleScope handle_scope(isolate);
-  v8::Handle<v8::ObjectTemplate> global_template =
+  v8::Local<v8::ObjectTemplate> global_template =
       v8::ObjectTemplate::New(isolate);
 
-  global_template->SetAccessCheckCallbacks(NamedAccessBlocker,
-                                           IndexedAccessBlocker);
+  global_template->SetAccessCheckCallback(AccessBlocker);
 
   // Add an accessor accessible by cross-domain JS code.
   global_template->SetAccessor(
-      v8_str("accessible_prop"),
-      EchoGetter, EchoSetter,
-      v8::Handle<Value>(),
+      v8_str("accessible_prop"), EchoGetter, EchoSetter, v8::Local<Value>(),
       v8::AccessControl(v8::ALL_CAN_READ | v8::ALL_CAN_WRITE));
 
 
   // Add an accessor that is not accessible by cross-domain JS code.
-  global_template->SetAccessor(v8_str("blocked_prop"),
-                               UnreachableGetter, UnreachableSetter,
-                               v8::Handle<Value>(),
+  global_template->SetAccessor(v8_str("blocked_prop"), UnreachableGetter,
+                               UnreachableSetter, v8::Local<Value>(),
                                v8::DEFAULT);
 
   global_template->SetAccessorProperty(
@@ -9952,7 +9700,7 @@
   v8::Local<Context> context0 = Context::New(isolate, NULL, global_template);
   context0->Enter();
 
-  v8::Handle<v8::Object> global0 = context0->Global();
+  v8::Local<v8::Object> global0 = context0->Global();
 
   // Define a property with JS getter and setter.
   CompileRun(
@@ -9960,11 +9708,13 @@
       "function setter() { return 'setter'; }\n"
       "Object.defineProperty(this, 'js_accessor_p', {get:getter, set:setter})");
 
-  Local<Value> getter = global0->Get(v8_str("getter"));
-  Local<Value> setter = global0->Get(v8_str("setter"));
+  Local<Value> getter =
+      global0->Get(context0, v8_str("getter")).ToLocalChecked();
+  Local<Value> setter =
+      global0->Get(context0, v8_str("setter")).ToLocalChecked();
 
   // And define normal element.
-  global0->Set(239, v8_str("239"));
+  CHECK(global0->Set(context0, 239, v8_str("239")).FromJust());
 
   // Define an element with JS getter and setter.
   CompileRun(
@@ -9972,16 +9722,18 @@
       "function el_setter() { return 'el_setter'; };\n"
       "Object.defineProperty(this, '42', {get: el_getter, set: el_setter});");
 
-  Local<Value> el_getter = global0->Get(v8_str("el_getter"));
-  Local<Value> el_setter = global0->Get(v8_str("el_setter"));
+  Local<Value> el_getter =
+      global0->Get(context0, v8_str("el_getter")).ToLocalChecked();
+  Local<Value> el_setter =
+      global0->Get(context0, v8_str("el_setter")).ToLocalChecked();
 
   v8::HandleScope scope1(isolate);
 
   v8::Local<Context> context1 = Context::New(isolate);
   context1->Enter();
 
-  v8::Handle<v8::Object> global1 = context1->Global();
-  global1->Set(v8_str("other"), global0);
+  v8::Local<v8::Object> global1 = context1->Global();
+  CHECK(global1->Set(context1, v8_str("other"), global0).FromJust());
 
   // Access blocked property.
   CompileRun("other.blocked_prop = 1");
@@ -9999,15 +9751,10 @@
   CHECK(CompileRun("Object.getOwnPropertyDescriptor(other, '239')").IsEmpty());
   CHECK(CompileRun("propertyIsEnumerable.call(other, '239')").IsEmpty());
 
-  // Enable ACCESS_HAS
-  allowed_access_type[v8::ACCESS_HAS] = true;
-  CHECK(CompileRun("other[239]").IsEmpty());
-  // ... and now we can get the descriptor...
-  CHECK(CompileRun("Object.getOwnPropertyDescriptor(other, '239').value")
-            .IsEmpty());
-  // ... and enumerate the property.
+  allowed_access = true;
+  // Now we can enumerate the property.
   ExpectTrue("propertyIsEnumerable.call(other, '239')");
-  allowed_access_type[v8::ACCESS_HAS] = false;
+  allowed_access = false;
 
   // Access a property with JS accessor.
   CHECK(CompileRun("other.js_accessor_p = 2").IsEmpty());
@@ -10016,9 +9763,7 @@
   CHECK(CompileRun("Object.getOwnPropertyDescriptor(other, 'js_accessor_p')")
             .IsEmpty());
 
-  // Enable both ACCESS_HAS and ACCESS_GET.
-  allowed_access_type[v8::ACCESS_HAS] = true;
-  allowed_access_type[v8::ACCESS_GET] = true;
+  allowed_access = true;
 
   ExpectString("other.js_accessor_p", "getter");
   ExpectObject(
@@ -10028,8 +9773,7 @@
   ExpectUndefined(
       "Object.getOwnPropertyDescriptor(other, 'js_accessor_p').value");
 
-  allowed_access_type[v8::ACCESS_HAS] = false;
-  allowed_access_type[v8::ACCESS_GET] = false;
+  allowed_access = false;
 
   // Access an element with JS accessor.
   CHECK(CompileRun("other[42] = 2").IsEmpty());
@@ -10037,40 +9781,38 @@
   CHECK(CompileRun("other[42]").IsEmpty());
   CHECK(CompileRun("Object.getOwnPropertyDescriptor(other, '42')").IsEmpty());
 
-  // Enable both ACCESS_HAS and ACCESS_GET.
-  allowed_access_type[v8::ACCESS_HAS] = true;
-  allowed_access_type[v8::ACCESS_GET] = true;
+  allowed_access = true;
 
   ExpectString("other[42]", "el_getter");
   ExpectObject("Object.getOwnPropertyDescriptor(other, '42').get", el_getter);
   ExpectObject("Object.getOwnPropertyDescriptor(other, '42').set", el_setter);
   ExpectUndefined("Object.getOwnPropertyDescriptor(other, '42').value");
 
-  allowed_access_type[v8::ACCESS_HAS] = false;
-  allowed_access_type[v8::ACCESS_GET] = false;
+  allowed_access = false;
 
-  v8::Handle<Value> value;
+  v8::Local<Value> value;
 
   // Access accessible property
   value = CompileRun("other.accessible_prop = 3");
   CHECK(value->IsNumber());
-  CHECK_EQ(3, value->Int32Value());
+  CHECK_EQ(3, value->Int32Value(context1).FromJust());
   CHECK_EQ(3, g_echo_value);
 
   value = CompileRun("other.accessible_prop");
   CHECK(value->IsNumber());
-  CHECK_EQ(3, value->Int32Value());
+  CHECK_EQ(3, value->Int32Value(context1).FromJust());
 
   value = CompileRun(
       "Object.getOwnPropertyDescriptor(other, 'accessible_prop').value");
   CHECK(value->IsNumber());
-  CHECK_EQ(3, value->Int32Value());
+  CHECK_EQ(3, value->Int32Value(context1).FromJust());
 
   value = CompileRun("propertyIsEnumerable.call(other, 'accessible_prop')");
   CHECK(value->IsTrue());
 
   // Enumeration doesn't enumerate accessors from inaccessible objects in
   // the prototype chain even if the accessors are in themselves accessible.
+  // Enumeration doesn't throw, it silently ignores what it can't access.
   value = CompileRun(
       "(function() {"
       "  var obj = { '__proto__': other };"
@@ -10082,13 +9824,24 @@
       "        return false;"
       "      }"
       "    }"
-      "    return false;"
-      "  } catch (e) {"
       "    return true;"
+      "  } catch (e) {"
+      "    return false;"
       "  }"
       "})()");
   CHECK(value->IsTrue());
 
+  // Test that preventExtensions fails on a non-accessible object even if that
+  // object is already non-extensible.
+  CHECK(global1->Set(context1, v8_str("checked_object"),
+                     global_template->NewInstance(context1).ToLocalChecked())
+            .FromJust());
+  allowed_access = true;
+  CompileRun("Object.preventExtensions(checked_object)");
+  ExpectFalse("Object.isExtensible(checked_object)");
+  allowed_access = false;
+  CHECK(CompileRun("Object.preventExtensions(checked_object)").IsEmpty());
+
   context1->Exit();
   context0->Exit();
 }
@@ -10097,39 +9850,40 @@
 TEST(AccessControlES5) {
   v8::Isolate* isolate = CcTest::isolate();
   v8::HandleScope handle_scope(isolate);
-  v8::Handle<v8::ObjectTemplate> global_template =
+  v8::Local<v8::ObjectTemplate> global_template =
       v8::ObjectTemplate::New(isolate);
 
-  global_template->SetAccessCheckCallbacks(NamedAccessBlocker,
-                                           IndexedAccessBlocker);
+  global_template->SetAccessCheckCallback(AccessBlocker);
 
   // Add accessible accessor.
   global_template->SetAccessor(
-      v8_str("accessible_prop"),
-      EchoGetter, EchoSetter,
-      v8::Handle<Value>(),
+      v8_str("accessible_prop"), EchoGetter, EchoSetter, v8::Local<Value>(),
       v8::AccessControl(v8::ALL_CAN_READ | v8::ALL_CAN_WRITE));
 
 
   // Add an accessor that is not accessible by cross-domain JS code.
-  global_template->SetAccessor(v8_str("blocked_prop"),
-                               UnreachableGetter, UnreachableSetter,
-                               v8::Handle<Value>(),
+  global_template->SetAccessor(v8_str("blocked_prop"), UnreachableGetter,
+                               UnreachableSetter, v8::Local<Value>(),
                                v8::DEFAULT);
 
   // Create an environment
   v8::Local<Context> context0 = Context::New(isolate, NULL, global_template);
   context0->Enter();
 
-  v8::Handle<v8::Object> global0 = context0->Global();
+  v8::Local<v8::Object> global0 = context0->Global();
 
   v8::Local<Context> context1 = Context::New(isolate);
   context1->Enter();
-  v8::Handle<v8::Object> global1 = context1->Global();
-  global1->Set(v8_str("other"), global0);
+  v8::Local<v8::Object> global1 = context1->Global();
+  CHECK(global1->Set(context1, v8_str("other"), global0).FromJust());
 
   // Regression test for issue 1154.
-  CHECK(CompileRun("Object.keys(other)").IsEmpty());
+  CHECK(CompileRun("Object.keys(other).length == 1")
+            ->BooleanValue(context1)
+            .FromJust());
+  CHECK(CompileRun("Object.keys(other)[0] == 'accessible_prop'")
+            ->BooleanValue(context1)
+            .FromJust());
   CHECK(CompileRun("other.blocked_prop").IsEmpty());
 
   // Regression test for issue 1027.
@@ -10157,21 +9911,18 @@
   CompileRun("other.accessible_prop = 42");
   CHECK_EQ(42, g_echo_value);
 
-  v8::Handle<Value> value;
-  CompileRun("Object.defineProperty(other, 'accessible_prop', {value: -1})");
-  value = CompileRun("other.accessible_prop == 42");
-  CHECK(value->IsTrue());
+  // [[DefineOwnProperty]] always throws for access-checked objects.
+  CHECK(
+      CompileRun("Object.defineProperty(other, 'accessible_prop', {value: 43})")
+          .IsEmpty());
+  CHECK(CompileRun("other.accessible_prop == 42")->IsTrue());
+  CHECK_EQ(42, g_echo_value);  // Make sure we didn't call the setter.
 }
 
 
-static bool BlockEverythingNamed(Local<v8::Object> object, Local<Value> name,
-                                 v8::AccessType type, Local<Value> data) {
-  return false;
-}
-
-
-static bool BlockEverythingIndexed(Local<v8::Object> object, uint32_t key,
-                                   v8::AccessType type, Local<Value> data) {
+static bool AccessAlwaysBlocked(Local<v8::Context> accessing_context,
+                                Local<v8::Object> global) {
+  i::PrintF("Access blocked.\n");
   return false;
 }
 
@@ -10179,157 +9930,78 @@
 THREADED_TEST(AccessControlGetOwnPropertyNames) {
   v8::Isolate* isolate = CcTest::isolate();
   v8::HandleScope handle_scope(isolate);
-  v8::Handle<v8::ObjectTemplate> obj_template =
-      v8::ObjectTemplate::New(isolate);
+  v8::Local<v8::ObjectTemplate> obj_template = v8::ObjectTemplate::New(isolate);
 
   obj_template->Set(v8_str("x"), v8::Integer::New(isolate, 42));
-  obj_template->SetAccessCheckCallbacks(BlockEverythingNamed,
-                                        BlockEverythingIndexed);
+  obj_template->SetAccessCheckCallback(AccessAlwaysBlocked);
+
+  // Add an accessor accessible by cross-domain JS code.
+  obj_template->SetAccessor(
+      v8_str("accessible_prop"), EchoGetter, EchoSetter, v8::Local<Value>(),
+      v8::AccessControl(v8::ALL_CAN_READ | v8::ALL_CAN_WRITE));
 
   // Create an environment
   v8::Local<Context> context0 = Context::New(isolate, NULL, obj_template);
   context0->Enter();
 
-  v8::Handle<v8::Object> global0 = context0->Global();
+  v8::Local<v8::Object> global0 = context0->Global();
 
   v8::HandleScope scope1(CcTest::isolate());
 
   v8::Local<Context> context1 = Context::New(isolate);
   context1->Enter();
 
-  v8::Handle<v8::Object> global1 = context1->Global();
-  global1->Set(v8_str("other"), global0);
-  global1->Set(v8_str("object"), obj_template->NewInstance());
+  v8::Local<v8::Object> global1 = context1->Global();
+  CHECK(global1->Set(context1, v8_str("other"), global0).FromJust());
+  CHECK(global1->Set(context1, v8_str("object"),
+                     obj_template->NewInstance(context1).ToLocalChecked())
+            .FromJust());
 
-  v8::Handle<Value> value;
+  v8::Local<Value> value;
 
   // Attempt to get the property names of the other global object and
   // of an object that requires access checks.  Accessing the other
   // global object should be blocked by access checks on the global
   // proxy object.  Accessing the object that requires access checks
   // is blocked by the access checks on the object itself.
-  value = CompileRun("Object.getOwnPropertyNames(other).length == 0");
-  CHECK(value.IsEmpty());
+  value = CompileRun(
+      "var names = Object.getOwnPropertyNames(other);"
+      "names.length == 1 && names[0] == 'accessible_prop';");
+  CHECK(value->BooleanValue(context1).FromJust());
 
-  value = CompileRun("Object.getOwnPropertyNames(object).length == 0");
-  CHECK(value.IsEmpty());
+  value = CompileRun(
+      "var names = Object.getOwnPropertyNames(object);"
+      "names.length == 1 && names[0] == 'accessible_prop';");
+  CHECK(value->BooleanValue(context1).FromJust());
 
   context1->Exit();
   context0->Exit();
 }
 
 
-TEST(SuperAccessControl) {
-  i::FLAG_harmony_classes = true;
+TEST(Regress470113) {
   v8::Isolate* isolate = CcTest::isolate();
   v8::HandleScope handle_scope(isolate);
-  v8::Handle<v8::ObjectTemplate> obj_template =
-      v8::ObjectTemplate::New(isolate);
-  obj_template->SetAccessCheckCallbacks(BlockEverythingNamed,
-                                        BlockEverythingIndexed);
+  v8::Local<v8::ObjectTemplate> obj_template = v8::ObjectTemplate::New(isolate);
+  obj_template->SetAccessCheckCallback(AccessAlwaysBlocked);
   LocalContext env;
-  env->Global()->Set(v8_str("prohibited"), obj_template->NewInstance());
+  CHECK(env->Global()
+            ->Set(env.local(), v8_str("prohibited"),
+                  obj_template->NewInstance(env.local()).ToLocalChecked())
+            .FromJust());
 
   {
-    v8::TryCatch try_catch;
+    v8::TryCatch try_catch(isolate);
     CompileRun(
-        "function f() { return super.hasOwnProperty; };"
-        "var m = f.toMethod(prohibited);"
-        "m();");
+        "'use strict';\n"
+        "class C extends Object {\n"
+        "   m() { super.powned = 'Powned!'; }\n"
+        "}\n"
+        "let c = new C();\n"
+        "c.m.call(prohibited)");
+
     CHECK(try_catch.HasCaught());
   }
-
-  {
-    v8::TryCatch try_catch;
-    CompileRun(
-        "function f() { return super[42]; };"
-        "var m = f.toMethod(prohibited);"
-        "m();");
-    CHECK(try_catch.HasCaught());
-  }
-
-  {
-    v8::TryCatch try_catch;
-    CompileRun(
-        "function f() { super.hasOwnProperty = function () {}; };"
-        "var m = f.toMethod(prohibited);"
-        "m();");
-    CHECK(try_catch.HasCaught());
-  }
-
-  {
-    v8::TryCatch try_catch;
-    CompileRun(
-        "Object.defineProperty(Object.prototype, 'x', { set : function(){}});"
-        "function f() { "
-        "     'use strict';"
-        "     super.x = function () {}; "
-        "};"
-        "var m = f.toMethod(prohibited);"
-        "m();");
-    CHECK(try_catch.HasCaught());
-  }
-}
-
-
-static void IndexedPropertyEnumerator(
-    const v8::PropertyCallbackInfo<v8::Array>& info) {
-  v8::Handle<v8::Array> result = v8::Array::New(info.GetIsolate(), 1);
-  result->Set(0, v8::Integer::New(info.GetIsolate(), 7));
-  info.GetReturnValue().Set(result);
-}
-
-
-static void NamedPropertyEnumerator(
-    const v8::PropertyCallbackInfo<v8::Array>& info) {
-  v8::Handle<v8::Array> result = v8::Array::New(info.GetIsolate(), 2);
-  result->Set(0, v8_str("x"));
-  result->Set(1, v8::Symbol::GetIterator(info.GetIsolate()));
-  info.GetReturnValue().Set(result);
-}
-
-
-THREADED_TEST(GetOwnPropertyNamesWithInterceptor) {
-  v8::Isolate* isolate = CcTest::isolate();
-  v8::HandleScope handle_scope(isolate);
-  v8::Handle<v8::ObjectTemplate> obj_template =
-      v8::ObjectTemplate::New(isolate);
-
-  obj_template->Set(v8_str("7"), v8::Integer::New(CcTest::isolate(), 7));
-  obj_template->Set(v8_str("x"), v8::Integer::New(CcTest::isolate(), 42));
-  obj_template->SetHandler(v8::IndexedPropertyHandlerConfiguration(
-      NULL, NULL, NULL, NULL, IndexedPropertyEnumerator));
-  obj_template->SetHandler(v8::NamedPropertyHandlerConfiguration(
-      NULL, NULL, NULL, NULL, NamedPropertyEnumerator));
-
-  LocalContext context;
-  v8::Handle<v8::Object> global = context->Global();
-  global->Set(v8_str("object"), obj_template->NewInstance());
-
-  v8::Handle<v8::Value> result =
-      CompileRun("Object.getOwnPropertyNames(object)");
-  CHECK(result->IsArray());
-  v8::Handle<v8::Array> result_array = v8::Handle<v8::Array>::Cast(result);
-  CHECK_EQ(2, result_array->Length());
-  CHECK(result_array->Get(0)->IsString());
-  CHECK(result_array->Get(1)->IsString());
-  CHECK_EQ(v8_str("7"), result_array->Get(0));
-  CHECK_EQ(v8_str("x"), result_array->Get(1));
-
-  result = CompileRun("var ret = []; for (var k in object) ret.push(k); ret");
-  CHECK(result->IsArray());
-  result_array = v8::Handle<v8::Array>::Cast(result);
-  CHECK_EQ(2, result_array->Length());
-  CHECK(result_array->Get(0)->IsString());
-  CHECK(result_array->Get(1)->IsString());
-  CHECK_EQ(v8_str("7"), result_array->Get(0));
-  CHECK_EQ(v8_str("x"), result_array->Get(1));
-
-  result = CompileRun("Object.getOwnPropertySymbols(object)");
-  CHECK(result->IsArray());
-  result_array = v8::Handle<v8::Array>::Cast(result);
-  CHECK_EQ(1, result_array->Length());
-  CHECK_EQ(result_array->Get(0), v8::Symbol::GetIterator(isolate));
 }
 
 
@@ -10343,80 +10015,65 @@
   v8::Isolate* isolate = CcTest::isolate();
   v8::HandleScope handle_scope(isolate);
 
-  v8::Handle<v8::FunctionTemplate> func_template =
+  v8::Local<v8::FunctionTemplate> func_template =
       v8::FunctionTemplate::New(isolate);
 
-  v8::Handle<v8::ObjectTemplate> global_template =
+  v8::Local<v8::ObjectTemplate> global_template =
       func_template->InstanceTemplate();
 
-  v8::Handle<v8::ObjectTemplate> proto_template =
+  v8::Local<v8::ObjectTemplate> proto_template =
       func_template->PrototypeTemplate();
 
   // Add an accessor to proto that's accessible by cross-domain JS code.
-  proto_template->SetAccessor(v8_str("accessible"),
-                              ConstTenGetter, 0,
-                              v8::Handle<Value>(),
-                              v8::ALL_CAN_READ);
+  proto_template->SetAccessor(v8_str("accessible"), ConstTenGetter, 0,
+                              v8::Local<Value>(), v8::ALL_CAN_READ);
 
   // Add an accessor that is not accessible by cross-domain JS code.
-  global_template->SetAccessor(v8_str("unreachable"),
-                               UnreachableGetter, 0,
-                               v8::Handle<Value>(),
-                               v8::DEFAULT);
+  global_template->SetAccessor(v8_str("unreachable"), UnreachableGetter, 0,
+                               v8::Local<Value>(), v8::DEFAULT);
 
   v8::Local<Context> context0 = Context::New(isolate, NULL, global_template);
   context0->Enter();
 
   Local<v8::Object> global = context0->Global();
   // Add a normal property that shadows 'accessible'
-  global->Set(v8_str("accessible"), v8_num(11));
+  CHECK(global->Set(context0, v8_str("accessible"), v8_num(11)).FromJust());
 
   // Enter a new context.
   v8::HandleScope scope1(CcTest::isolate());
   v8::Local<Context> context1 = Context::New(isolate);
   context1->Enter();
 
-  v8::Handle<v8::Object> global1 = context1->Global();
-  global1->Set(v8_str("other"), global);
+  v8::Local<v8::Object> global1 = context1->Global();
+  CHECK(global1->Set(context1, v8_str("other"), global).FromJust());
 
   // Should return 10, instead of 11
-  v8::Handle<Value> value = v8_compile("other.accessible")->Run();
+  v8::Local<Value> value =
+      v8_compile("other.accessible")->Run(context1).ToLocalChecked();
   CHECK(value->IsNumber());
-  CHECK_EQ(10, value->Int32Value());
+  CHECK_EQ(10, value->Int32Value(context1).FromJust());
 
-  value = v8_compile("other.unreachable")->Run();
-  CHECK(value.IsEmpty());
+  v8::MaybeLocal<v8::Value> maybe_value =
+      v8_compile("other.unreachable")->Run(context1);
+  CHECK(maybe_value.IsEmpty());
 
   context1->Exit();
   context0->Exit();
 }
 
 
-static int named_access_count = 0;
-static int indexed_access_count = 0;
+static int access_count = 0;
 
-static bool NamedAccessCounter(Local<v8::Object> global,
-                               Local<Value> name,
-                               v8::AccessType type,
-                               Local<Value> data) {
-  named_access_count++;
-  return true;
-}
-
-
-static bool IndexedAccessCounter(Local<v8::Object> global,
-                                 uint32_t key,
-                                 v8::AccessType type,
-                                 Local<Value> data) {
-  indexed_access_count++;
+static bool AccessCounter(Local<v8::Context> accessing_context,
+                          Local<v8::Object> accessed_object) {
+  access_count++;
   return true;
 }
 
 
 // This one is too easily disturbed by other tests.
 TEST(AccessControlIC) {
-  named_access_count = 0;
-  indexed_access_count = 0;
+  access_count = 0;
 
   v8::Isolate* isolate = CcTest::isolate();
   v8::HandleScope handle_scope(isolate);
@@ -10427,11 +10084,11 @@
 
   // Create an object that requires access-check functions to be
   // called for cross-domain access.
-  v8::Handle<v8::ObjectTemplate> object_template =
+  v8::Local<v8::ObjectTemplate> object_template =
       v8::ObjectTemplate::New(isolate);
-  object_template->SetAccessCheckCallbacks(NamedAccessCounter,
-                                           IndexedAccessCounter);
-  Local<v8::Object> object = object_template->NewInstance();
+  object_template->SetAccessCheckCallback(AccessCounter);
+  Local<v8::Object> object =
+      object_template->NewInstance(context0).ToLocalChecked();
 
   v8::HandleScope scope1(isolate);
 
@@ -10440,10 +10097,10 @@
   context1->Enter();
 
   // Make easy access to the object from the other environment.
-  v8::Handle<v8::Object> global1 = context1->Global();
-  global1->Set(v8_str("obj"), object);
+  v8::Local<v8::Object> global1 = context1->Global();
+  CHECK(global1->Set(context1, v8_str("obj"), object).FromJust());
 
-  v8::Handle<Value> value;
+  v8::Local<Value> value;
 
   // Check that the named access-control function is called every time.
   CompileRun("function testProp(obj) {"
@@ -10453,8 +10110,8 @@
              "}");
   value = CompileRun("testProp(obj)");
   CHECK(value->IsNumber());
-  CHECK_EQ(1, value->Int32Value());
-  CHECK_EQ(21, named_access_count);
+  CHECK_EQ(1, value->Int32Value(context1).FromJust());
+  CHECK_EQ(21, access_count);
 
   // Check that the named access-control function is called every time.
   CompileRun("var p = 'prop';"
@@ -10467,17 +10124,19 @@
   // in that case.
   value = CompileRun("testKeyed(obj)");
   CHECK(value->IsNumber());
-  CHECK_EQ(1, value->Int32Value());
-  CHECK_EQ(42, named_access_count);
+  CHECK_EQ(1, value->Int32Value(context1).FromJust());
+  CHECK_EQ(42, access_count);
   // Force the inline caches into generic state and try again.
   CompileRun("testKeyed({ a: 0 })");
   CompileRun("testKeyed({ b: 0 })");
   value = CompileRun("testKeyed(obj)");
   CHECK(value->IsNumber());
-  CHECK_EQ(1, value->Int32Value());
-  CHECK_EQ(63, named_access_count);
+  CHECK_EQ(1, value->Int32Value(context1).FromJust());
+  CHECK_EQ(63, access_count);
 
   // Check that the indexed access-control function is called every time.
+  access_count = 0;
+
   CompileRun("function testIndexed(obj) {"
              "  for (var i = 0; i < 10; i++) obj[0] = 1;"
              "  for (var j = 0; j < 10; j++) obj[0];"
@@ -10485,16 +10144,17 @@
              "}");
   value = CompileRun("testIndexed(obj)");
   CHECK(value->IsNumber());
-  CHECK_EQ(1, value->Int32Value());
-  CHECK_EQ(21, indexed_access_count);
+  CHECK_EQ(1, value->Int32Value(context1).FromJust());
+  CHECK_EQ(21, access_count);
   // Force the inline caches into generic state.
   CompileRun("testIndexed(new Array(1))");
   // Test that the indexed access check is called.
   value = CompileRun("testIndexed(obj)");
   CHECK(value->IsNumber());
-  CHECK_EQ(1, value->Int32Value());
-  CHECK_EQ(42, indexed_access_count);
+  CHECK_EQ(1, value->Int32Value(context1).FromJust());
+  CHECK_EQ(42, access_count);
 
+  access_count = 0;
   // Check that the named access check is called when invoking
   // functions on an object that requires access checks.
   CompileRun("obj.f = function() {}");
@@ -10502,204 +10162,33 @@
              "  for (var i = 0; i < 10; i++) obj.f();"
              "}");
   CompileRun("testCallNormal(obj)");
-  CHECK_EQ(74, named_access_count);
+  printf("%i\n", access_count);
+  CHECK_EQ(11, access_count);
 
   // Force obj into slow case.
   value = CompileRun("delete obj.prop");
-  CHECK(value->BooleanValue());
+  CHECK(value->BooleanValue(context1).FromJust());
   // Force inline caches into dictionary probing mode.
   CompileRun("var o = { x: 0 }; delete o.x; testProp(o);");
   // Test that the named access check is called.
   value = CompileRun("testProp(obj);");
   CHECK(value->IsNumber());
-  CHECK_EQ(1, value->Int32Value());
-  CHECK_EQ(96, named_access_count);
+  CHECK_EQ(1, value->Int32Value(context1).FromJust());
+  CHECK_EQ(33, access_count);
 
   // Force the call inline cache into dictionary probing mode.
   CompileRun("o.f = function() {}; testCallNormal(o)");
   // Test that the named access check is still called for each
   // invocation of the function.
   value = CompileRun("testCallNormal(obj)");
-  CHECK_EQ(106, named_access_count);
+  CHECK_EQ(43, access_count);
 
   context1->Exit();
   context0->Exit();
 }
 
 
-static bool NamedAccessFlatten(Local<v8::Object> global,
-                               Local<Value> name,
-                               v8::AccessType type,
-                               Local<Value> data) {
-  char buf[100];
-  int len;
-
-  CHECK(name->IsString());
-
-  memset(buf, 0x1, sizeof(buf));
-  len = name.As<String>()->WriteOneByte(reinterpret_cast<uint8_t*>(buf));
-  CHECK_EQ(4, len);
-
-  uint16_t buf2[100];
-
-  memset(buf, 0x1, sizeof(buf));
-  len = name.As<String>()->Write(buf2);
-  CHECK_EQ(4, len);
-
-  return true;
-}
-
-
-static bool IndexedAccessFlatten(Local<v8::Object> global,
-                                 uint32_t key,
-                                 v8::AccessType type,
-                                 Local<Value> data) {
-  return true;
-}
-
-
-// Regression test.  In access checks, operations that may cause
-// garbage collection are not allowed.  It used to be the case that
-// using the Write operation on a string could cause a garbage
-// collection due to flattening of the string.  This is no longer the
-// case.
-THREADED_TEST(AccessControlFlatten) {
-  named_access_count = 0;
-  indexed_access_count = 0;
-
-  v8::Isolate* isolate = CcTest::isolate();
-  v8::HandleScope handle_scope(isolate);
-
-  // Create an environment.
-  v8::Local<Context> context0 = Context::New(isolate);
-  context0->Enter();
-
-  // Create an object that requires access-check functions to be
-  // called for cross-domain access.
-  v8::Handle<v8::ObjectTemplate> object_template =
-      v8::ObjectTemplate::New(isolate);
-  object_template->SetAccessCheckCallbacks(NamedAccessFlatten,
-                                           IndexedAccessFlatten);
-  Local<v8::Object> object = object_template->NewInstance();
-
-  v8::HandleScope scope1(isolate);
-
-  // Create another environment.
-  v8::Local<Context> context1 = Context::New(isolate);
-  context1->Enter();
-
-  // Make easy access to the object from the other environment.
-  v8::Handle<v8::Object> global1 = context1->Global();
-  global1->Set(v8_str("obj"), object);
-
-  v8::Handle<Value> value;
-
-  value = v8_compile("var p = 'as' + 'df';")->Run();
-  value = v8_compile("obj[p];")->Run();
-
-  context1->Exit();
-  context0->Exit();
-}
-
-
-static void AccessControlNamedGetter(
-    Local<Name>, const v8::PropertyCallbackInfo<v8::Value>& info) {
-  info.GetReturnValue().Set(42);
-}
-
-
-static void AccessControlNamedSetter(
-    Local<Name>, Local<Value> value,
-    const v8::PropertyCallbackInfo<v8::Value>& info) {
-  info.GetReturnValue().Set(value);
-}
-
-
-static void AccessControlIndexedGetter(
-      uint32_t index,
-      const v8::PropertyCallbackInfo<v8::Value>& info) {
-  info.GetReturnValue().Set(v8_num(42));
-}
-
-
-static void AccessControlIndexedSetter(
-    uint32_t,
-    Local<Value> value,
-    const v8::PropertyCallbackInfo<v8::Value>& info) {
-  info.GetReturnValue().Set(value);
-}
-
-
-THREADED_TEST(AccessControlInterceptorIC) {
-  named_access_count = 0;
-  indexed_access_count = 0;
-
-  v8::Isolate* isolate = CcTest::isolate();
-  v8::HandleScope handle_scope(isolate);
-
-  // Create an environment.
-  v8::Local<Context> context0 = Context::New(isolate);
-  context0->Enter();
-
-  // Create an object that requires access-check functions to be
-  // called for cross-domain access.  The object also has interceptors
-  // interceptor.
-  v8::Handle<v8::ObjectTemplate> object_template =
-      v8::ObjectTemplate::New(isolate);
-  object_template->SetAccessCheckCallbacks(NamedAccessCounter,
-                                           IndexedAccessCounter);
-  object_template->SetHandler(v8::NamedPropertyHandlerConfiguration(
-      AccessControlNamedGetter, AccessControlNamedSetter));
-  object_template->SetHandler(v8::IndexedPropertyHandlerConfiguration(
-      AccessControlIndexedGetter, AccessControlIndexedSetter));
-  Local<v8::Object> object = object_template->NewInstance();
-
-  v8::HandleScope scope1(isolate);
-
-  // Create another environment.
-  v8::Local<Context> context1 = Context::New(isolate);
-  context1->Enter();
-
-  // Make easy access to the object from the other environment.
-  v8::Handle<v8::Object> global1 = context1->Global();
-  global1->Set(v8_str("obj"), object);
-
-  v8::Handle<Value> value;
-
-  // Check that the named access-control function is called every time
-  // eventhough there is an interceptor on the object.
-  value = v8_compile("for (var i = 0; i < 10; i++) obj.x = 1;")->Run();
-  value = v8_compile("for (var i = 0; i < 10; i++) obj.x;"
-                     "obj.x")->Run();
-  CHECK(value->IsNumber());
-  CHECK_EQ(42, value->Int32Value());
-  CHECK_EQ(21, named_access_count);
-
-  value = v8_compile("var p = 'x';")->Run();
-  value = v8_compile("for (var i = 0; i < 10; i++) obj[p] = 1;")->Run();
-  value = v8_compile("for (var i = 0; i < 10; i++) obj[p];"
-                     "obj[p]")->Run();
-  CHECK(value->IsNumber());
-  CHECK_EQ(42, value->Int32Value());
-  CHECK_EQ(42, named_access_count);
-
-  // Check that the indexed access-control function is called every
-  // time eventhough there is an interceptor on the object.
-  value = v8_compile("for (var i = 0; i < 10; i++) obj[0] = 1;")->Run();
-  value = v8_compile("for (var i = 0; i < 10; i++) obj[0];"
-                     "obj[0]")->Run();
-  CHECK(value->IsNumber());
-  CHECK_EQ(42, value->Int32Value());
-  CHECK_EQ(21, indexed_access_count);
-
-  context1->Exit();
-  context0->Exit();
-}
-
-
-THREADED_TEST(Version) {
-  v8::V8::GetVersion();
-}
+THREADED_TEST(Version) { v8::V8::GetVersion(); }
 
 
 static void InstanceFunctionCallback(
@@ -10721,14 +10210,17 @@
   instance->Set(v8_str("f"),
                 v8::FunctionTemplate::New(isolate, InstanceFunctionCallback));
 
-  Local<Value> o = t->GetFunction()->NewInstance();
+  Local<Value> o = t->GetFunction(context.local())
+                       .ToLocalChecked()
+                       ->NewInstance(context.local())
+                       .ToLocalChecked();
 
-  context->Global()->Set(v8_str("i"), o);
+  CHECK(context->Global()->Set(context.local(), v8_str("i"), o).FromJust());
   Local<Value> value = CompileRun("i.x");
-  CHECK_EQ(42, value->Int32Value());
+  CHECK_EQ(42, value->Int32Value(context.local()).FromJust());
 
   value = CompileRun("i.f()");
-  CHECK_EQ(12, value->Int32Value());
+  CHECK_EQ(12, value->Int32Value(context.local()).FromJust());
 }
 
 
@@ -10776,22 +10268,22 @@
     global_object = env->Global();
 
     Local<Value> value = CompileRun("x");
-    CHECK_EQ(42, value->Int32Value());
+    CHECK_EQ(42, value->Int32Value(env.local()).FromJust());
     value = CompileRun("f()");
-    CHECK_EQ(12, value->Int32Value());
+    CHECK_EQ(12, value->Int32Value(env.local()).FromJust());
     value = CompileRun(script);
-    CHECK_EQ(1, value->Int32Value());
+    CHECK_EQ(1, value->Int32Value(env.local()).FromJust());
   }
 
   {
     // Create new environment reusing the global object.
     LocalContext env(NULL, instance_template, global_object);
     Local<Value> value = CompileRun("x");
-    CHECK_EQ(42, value->Int32Value());
+    CHECK_EQ(42, value->Int32Value(env.local()).FromJust());
     value = CompileRun("f()");
-    CHECK_EQ(12, value->Int32Value());
+    CHECK_EQ(12, value->Int32Value(env.local()).FromJust());
     value = CompileRun(script);
-    CHECK_EQ(1, value->Int32Value());
+    CHECK_EQ(1, value->Int32Value(env.local()).FromJust());
   }
 }
 
@@ -10831,7 +10323,7 @@
   {
     // Create new environment reusing the global object.
     LocalContext env(NULL, instance_template, global_object);
-    env->Global()->Set(v8_str("foo"), foo);
+    CHECK(env->Global()->Set(env.local(), v8_str("foo"), foo).FromJust());
     CompileRun("foo()");
   }
 }
@@ -10898,25 +10390,30 @@
 
   instance->SetAccessor(v8_str("y"), ShadowYGetter, ShadowYSetter);
 
-  Local<Value> o = t->GetFunction()->NewInstance();
-  context->Global()->Set(v8_str("__proto__"), o);
+  Local<Value> o = t->GetFunction(context.local())
+                       .ToLocalChecked()
+                       ->NewInstance(context.local())
+                       .ToLocalChecked();
+  CHECK(context->Global()
+            ->Set(context.local(), v8_str("__proto__"), o)
+            .FromJust());
 
   Local<Value> value =
       CompileRun("this.propertyIsEnumerable(0)");
   CHECK(value->IsBoolean());
-  CHECK(!value->BooleanValue());
+  CHECK(!value->BooleanValue(context.local()).FromJust());
 
   value = CompileRun("x");
-  CHECK_EQ(12, value->Int32Value());
+  CHECK_EQ(12, value->Int32Value(context.local()).FromJust());
 
   value = CompileRun("f()");
-  CHECK_EQ(42, value->Int32Value());
+  CHECK_EQ(42, value->Int32Value(context.local()).FromJust());
 
   CompileRun("y = 43");
   CHECK_EQ(1, shadow_y_setter_call_count);
   value = CompileRun("y");
   CHECK_EQ(1, shadow_y_getter_call_count);
-  CHECK_EQ(42, value->Int32Value());
+  CHECK_EQ(42, value->Int32Value(context.local()).FromJust());
 }
 
 
@@ -10936,32 +10433,78 @@
   Local<v8::FunctionTemplate> t3 = v8::FunctionTemplate::New(isolate);
   t3->InstanceTemplate()->Set(v8_str("u"), v8_num(3));
 
-  Local<v8::Object> o0 = t0->GetFunction()->NewInstance();
-  Local<v8::Object> o1 = t1->GetFunction()->NewInstance();
-  Local<v8::Object> o2 = t2->GetFunction()->NewInstance();
-  Local<v8::Object> o3 = t3->GetFunction()->NewInstance();
+  Local<v8::Object> o0 = t0->GetFunction(context.local())
+                             .ToLocalChecked()
+                             ->NewInstance(context.local())
+                             .ToLocalChecked();
+  Local<v8::Object> o1 = t1->GetFunction(context.local())
+                             .ToLocalChecked()
+                             ->NewInstance(context.local())
+                             .ToLocalChecked();
+  Local<v8::Object> o2 = t2->GetFunction(context.local())
+                             .ToLocalChecked()
+                             ->NewInstance(context.local())
+                             .ToLocalChecked();
+  Local<v8::Object> o3 = t3->GetFunction(context.local())
+                             .ToLocalChecked()
+                             ->NewInstance(context.local())
+                             .ToLocalChecked();
 
   // Setting the prototype on an object skips hidden prototypes.
-  CHECK_EQ(0, o0->Get(v8_str("x"))->Int32Value());
-  o0->Set(v8_str("__proto__"), o1);
-  CHECK_EQ(0, o0->Get(v8_str("x"))->Int32Value());
-  CHECK_EQ(1, o0->Get(v8_str("y"))->Int32Value());
-  o0->Set(v8_str("__proto__"), o2);
-  CHECK_EQ(0, o0->Get(v8_str("x"))->Int32Value());
-  CHECK_EQ(1, o0->Get(v8_str("y"))->Int32Value());
-  CHECK_EQ(2, o0->Get(v8_str("z"))->Int32Value());
-  o0->Set(v8_str("__proto__"), o3);
-  CHECK_EQ(0, o0->Get(v8_str("x"))->Int32Value());
-  CHECK_EQ(1, o0->Get(v8_str("y"))->Int32Value());
-  CHECK_EQ(2, o0->Get(v8_str("z"))->Int32Value());
-  CHECK_EQ(3, o0->Get(v8_str("u"))->Int32Value());
+  CHECK_EQ(0, o0->Get(context.local(), v8_str("x"))
+                  .ToLocalChecked()
+                  ->Int32Value(context.local())
+                  .FromJust());
+  CHECK(o0->Set(context.local(), v8_str("__proto__"), o1).FromJust());
+  CHECK_EQ(0, o0->Get(context.local(), v8_str("x"))
+                  .ToLocalChecked()
+                  ->Int32Value(context.local())
+                  .FromJust());
+  CHECK_EQ(1, o0->Get(context.local(), v8_str("y"))
+                  .ToLocalChecked()
+                  ->Int32Value(context.local())
+                  .FromJust());
+  CHECK(o0->Set(context.local(), v8_str("__proto__"), o2).FromJust());
+  CHECK_EQ(0, o0->Get(context.local(), v8_str("x"))
+                  .ToLocalChecked()
+                  ->Int32Value(context.local())
+                  .FromJust());
+  CHECK_EQ(1, o0->Get(context.local(), v8_str("y"))
+                  .ToLocalChecked()
+                  ->Int32Value(context.local())
+                  .FromJust());
+  CHECK_EQ(2, o0->Get(context.local(), v8_str("z"))
+                  .ToLocalChecked()
+                  ->Int32Value(context.local())
+                  .FromJust());
+  CHECK(o0->Set(context.local(), v8_str("__proto__"), o3).FromJust());
+  CHECK_EQ(0, o0->Get(context.local(), v8_str("x"))
+                  .ToLocalChecked()
+                  ->Int32Value(context.local())
+                  .FromJust());
+  CHECK_EQ(1, o0->Get(context.local(), v8_str("y"))
+                  .ToLocalChecked()
+                  ->Int32Value(context.local())
+                  .FromJust());
+  CHECK_EQ(2, o0->Get(context.local(), v8_str("z"))
+                  .ToLocalChecked()
+                  ->Int32Value(context.local())
+                  .FromJust());
+  CHECK_EQ(3, o0->Get(context.local(), v8_str("u"))
+                  .ToLocalChecked()
+                  ->Int32Value(context.local())
+                  .FromJust());
 
   // Getting the prototype of o0 should get the first visible one
   // which is o3.  Therefore, z should not be defined on the prototype
   // object.
-  Local<Value> proto = o0->Get(v8_str("__proto__"));
+  Local<Value> proto =
+      o0->Get(context.local(), v8_str("__proto__")).ToLocalChecked();
   CHECK(proto->IsObject());
-  CHECK(proto.As<v8::Object>()->Get(v8_str("z"))->IsUndefined());
+  CHECK(proto.As<v8::Object>()
+            ->Get(context.local(), v8_str("z"))
+            .ToLocalChecked()
+            ->IsUndefined());
 }
 
 
@@ -10976,34 +10519,70 @@
   Local<v8::FunctionTemplate> pt = v8::FunctionTemplate::New(isolate);
   ht->InstanceTemplate()->Set(v8_str("x"), v8_num(0));
 
-  Local<v8::Object> o = ot->GetFunction()->NewInstance();
-  Local<v8::Object> h = ht->GetFunction()->NewInstance();
-  Local<v8::Object> p = pt->GetFunction()->NewInstance();
-  o->Set(v8_str("__proto__"), h);
-  h->Set(v8_str("__proto__"), p);
+  Local<v8::Object> o = ot->GetFunction(context.local())
+                            .ToLocalChecked()
+                            ->NewInstance(context.local())
+                            .ToLocalChecked();
+  Local<v8::Object> h = ht->GetFunction(context.local())
+                            .ToLocalChecked()
+                            ->NewInstance(context.local())
+                            .ToLocalChecked();
+  Local<v8::Object> p = pt->GetFunction(context.local())
+                            .ToLocalChecked()
+                            ->NewInstance(context.local())
+                            .ToLocalChecked();
+  CHECK(o->Set(context.local(), v8_str("__proto__"), h).FromJust());
+  CHECK(h->Set(context.local(), v8_str("__proto__"), p).FromJust());
 
   // Setting a property that exists on the hidden prototype goes there.
-  o->Set(v8_str("x"), v8_num(7));
-  CHECK_EQ(7, o->Get(v8_str("x"))->Int32Value());
-  CHECK_EQ(7, h->Get(v8_str("x"))->Int32Value());
-  CHECK(p->Get(v8_str("x"))->IsUndefined());
+  CHECK(o->Set(context.local(), v8_str("x"), v8_num(7)).FromJust());
+  CHECK_EQ(7, o->Get(context.local(), v8_str("x"))
+                  .ToLocalChecked()
+                  ->Int32Value(context.local())
+                  .FromJust());
+  CHECK_EQ(7, h->Get(context.local(), v8_str("x"))
+                  .ToLocalChecked()
+                  ->Int32Value(context.local())
+                  .FromJust());
+  CHECK(p->Get(context.local(), v8_str("x")).ToLocalChecked()->IsUndefined());
 
   // Setting a new property should not be forwarded to the hidden prototype.
-  o->Set(v8_str("y"), v8_num(6));
-  CHECK_EQ(6, o->Get(v8_str("y"))->Int32Value());
-  CHECK(h->Get(v8_str("y"))->IsUndefined());
-  CHECK(p->Get(v8_str("y"))->IsUndefined());
+  CHECK(o->Set(context.local(), v8_str("y"), v8_num(6)).FromJust());
+  CHECK_EQ(6, o->Get(context.local(), v8_str("y"))
+                  .ToLocalChecked()
+                  ->Int32Value(context.local())
+                  .FromJust());
+  CHECK(h->Get(context.local(), v8_str("y")).ToLocalChecked()->IsUndefined());
+  CHECK(p->Get(context.local(), v8_str("y")).ToLocalChecked()->IsUndefined());
 
   // Setting a property that only exists on a prototype of the hidden prototype
   // is treated normally again.
-  p->Set(v8_str("z"), v8_num(8));
-  CHECK_EQ(8, o->Get(v8_str("z"))->Int32Value());
-  CHECK_EQ(8, h->Get(v8_str("z"))->Int32Value());
-  CHECK_EQ(8, p->Get(v8_str("z"))->Int32Value());
-  o->Set(v8_str("z"), v8_num(9));
-  CHECK_EQ(9, o->Get(v8_str("z"))->Int32Value());
-  CHECK_EQ(8, h->Get(v8_str("z"))->Int32Value());
-  CHECK_EQ(8, p->Get(v8_str("z"))->Int32Value());
+  CHECK(p->Set(context.local(), v8_str("z"), v8_num(8)).FromJust());
+  CHECK_EQ(8, o->Get(context.local(), v8_str("z"))
+                  .ToLocalChecked()
+                  ->Int32Value(context.local())
+                  .FromJust());
+  CHECK_EQ(8, h->Get(context.local(), v8_str("z"))
+                  .ToLocalChecked()
+                  ->Int32Value(context.local())
+                  .FromJust());
+  CHECK_EQ(8, p->Get(context.local(), v8_str("z"))
+                  .ToLocalChecked()
+                  ->Int32Value(context.local())
+                  .FromJust());
+  CHECK(o->Set(context.local(), v8_str("z"), v8_num(9)).FromJust());
+  CHECK_EQ(9, o->Get(context.local(), v8_str("z"))
+                  .ToLocalChecked()
+                  ->Int32Value(context.local())
+                  .FromJust());
+  CHECK_EQ(8, h->Get(context.local(), v8_str("z"))
+                  .ToLocalChecked()
+                  ->Int32Value(context.local())
+                  .FromJust());
+  CHECK_EQ(8, p->Get(context.local(), v8_str("z"))
+                  .ToLocalChecked()
+                  ->Int32Value(context.local())
+                  .FromJust());
 }
 
 
@@ -11012,17 +10591,20 @@
   LocalContext context;
   v8::HandleScope handle_scope(context->GetIsolate());
 
-  Handle<FunctionTemplate> t = FunctionTemplate::New(context->GetIsolate());
+  Local<FunctionTemplate> t = FunctionTemplate::New(context->GetIsolate());
   t->SetHiddenPrototype(true);
   t->InstanceTemplate()->Set(v8_str("foo"), v8_num(75));
-  Handle<Object> p = t->GetFunction()->NewInstance();
-  Handle<Object> o = Object::New(context->GetIsolate());
-  o->SetPrototype(p);
+  Local<Object> p = t->GetFunction(context.local())
+                        .ToLocalChecked()
+                        ->NewInstance(context.local())
+                        .ToLocalChecked();
+  Local<Object> o = Object::New(context->GetIsolate());
+  CHECK(o->SetPrototype(context.local(), p).FromJust());
 
   int hash = o->GetIdentityHash();
   USE(hash);
-  o->Set(v8_str("foo"), v8_num(42));
-  DCHECK_EQ(hash, o->GetIdentityHash());
+  CHECK(o->Set(context.local(), v8_str("foo"), v8_num(42)).FromJust());
+  CHECK_EQ(hash, o->GetIdentityHash());
 }
 
 
@@ -11042,45 +10624,88 @@
   Local<v8::FunctionTemplate> t3 = v8::FunctionTemplate::New(isolate);
   t3->InstanceTemplate()->Set(v8_str("u"), v8_num(3));
 
-  Local<v8::Object> o0 = t0->GetFunction()->NewInstance();
-  Local<v8::Object> o1 = t1->GetFunction()->NewInstance();
-  Local<v8::Object> o2 = t2->GetFunction()->NewInstance();
-  Local<v8::Object> o3 = t3->GetFunction()->NewInstance();
+  Local<v8::Object> o0 = t0->GetFunction(context.local())
+                             .ToLocalChecked()
+                             ->NewInstance(context.local())
+                             .ToLocalChecked();
+  Local<v8::Object> o1 = t1->GetFunction(context.local())
+                             .ToLocalChecked()
+                             ->NewInstance(context.local())
+                             .ToLocalChecked();
+  Local<v8::Object> o2 = t2->GetFunction(context.local())
+                             .ToLocalChecked()
+                             ->NewInstance(context.local())
+                             .ToLocalChecked();
+  Local<v8::Object> o3 = t3->GetFunction(context.local())
+                             .ToLocalChecked()
+                             ->NewInstance(context.local())
+                             .ToLocalChecked();
 
   // Setting the prototype on an object does not skip hidden prototypes.
-  CHECK_EQ(0, o0->Get(v8_str("x"))->Int32Value());
-  CHECK(o0->SetPrototype(o1));
-  CHECK_EQ(0, o0->Get(v8_str("x"))->Int32Value());
-  CHECK_EQ(1, o0->Get(v8_str("y"))->Int32Value());
-  CHECK(o1->SetPrototype(o2));
-  CHECK_EQ(0, o0->Get(v8_str("x"))->Int32Value());
-  CHECK_EQ(1, o0->Get(v8_str("y"))->Int32Value());
-  CHECK_EQ(2, o0->Get(v8_str("z"))->Int32Value());
-  CHECK(o2->SetPrototype(o3));
-  CHECK_EQ(0, o0->Get(v8_str("x"))->Int32Value());
-  CHECK_EQ(1, o0->Get(v8_str("y"))->Int32Value());
-  CHECK_EQ(2, o0->Get(v8_str("z"))->Int32Value());
-  CHECK_EQ(3, o0->Get(v8_str("u"))->Int32Value());
+  CHECK_EQ(0, o0->Get(context.local(), v8_str("x"))
+                  .ToLocalChecked()
+                  ->Int32Value(context.local())
+                  .FromJust());
+  CHECK(o0->SetPrototype(context.local(), o1).FromJust());
+  CHECK_EQ(0, o0->Get(context.local(), v8_str("x"))
+                  .ToLocalChecked()
+                  ->Int32Value(context.local())
+                  .FromJust());
+  CHECK_EQ(1, o0->Get(context.local(), v8_str("y"))
+                  .ToLocalChecked()
+                  ->Int32Value(context.local())
+                  .FromJust());
+  CHECK(o1->SetPrototype(context.local(), o2).FromJust());
+  CHECK_EQ(0, o0->Get(context.local(), v8_str("x"))
+                  .ToLocalChecked()
+                  ->Int32Value(context.local())
+                  .FromJust());
+  CHECK_EQ(1, o0->Get(context.local(), v8_str("y"))
+                  .ToLocalChecked()
+                  ->Int32Value(context.local())
+                  .FromJust());
+  CHECK_EQ(2, o0->Get(context.local(), v8_str("z"))
+                  .ToLocalChecked()
+                  ->Int32Value(context.local())
+                  .FromJust());
+  CHECK(o2->SetPrototype(context.local(), o3).FromJust());
+  CHECK_EQ(0, o0->Get(context.local(), v8_str("x"))
+                  .ToLocalChecked()
+                  ->Int32Value(context.local())
+                  .FromJust());
+  CHECK_EQ(1, o0->Get(context.local(), v8_str("y"))
+                  .ToLocalChecked()
+                  ->Int32Value(context.local())
+                  .FromJust());
+  CHECK_EQ(2, o0->Get(context.local(), v8_str("z"))
+                  .ToLocalChecked()
+                  ->Int32Value(context.local())
+                  .FromJust());
+  CHECK_EQ(3, o0->Get(context.local(), v8_str("u"))
+                  .ToLocalChecked()
+                  ->Int32Value(context.local())
+                  .FromJust());
 
   // Getting the prototype of o0 should get the first visible one
   // which is o3.  Therefore, z should not be defined on the prototype
   // object.
-  Local<Value> proto = o0->Get(v8_str("__proto__"));
+  Local<Value> proto =
+      o0->Get(context.local(), v8_str("__proto__")).ToLocalChecked();
   CHECK(proto->IsObject());
-  CHECK_EQ(proto.As<v8::Object>(), o3);
+  CHECK(proto.As<v8::Object>()->Equals(context.local(), o3).FromJust());
 
   // However, Object::GetPrototype ignores hidden prototype.
   Local<Value> proto0 = o0->GetPrototype();
   CHECK(proto0->IsObject());
-  CHECK_EQ(proto0.As<v8::Object>(), o1);
+  CHECK(proto0.As<v8::Object>()->Equals(context.local(), o1).FromJust());
 
   Local<Value> proto1 = o1->GetPrototype();
   CHECK(proto1->IsObject());
-  CHECK_EQ(proto1.As<v8::Object>(), o2);
+  CHECK(proto1.As<v8::Object>()->Equals(context.local(), o2).FromJust());
 
   Local<Value> proto2 = o2->GetPrototype();
   CHECK(proto2->IsObject());
-  CHECK_EQ(proto2.As<v8::Object>(), o3);
+  CHECK(proto2.As<v8::Object>()->Equals(context.local(), o3).FromJust());
 }
 
 
@@ -11114,21 +10739,33 @@
     t2->InstanceTemplate()->Set(v8_str(name_buf.start()), v8_num(2));
   }
 
-  Local<v8::Object> o1 = t1->GetFunction()->NewInstance();
-  Local<v8::Object> o2 = t2->GetFunction()->NewInstance();
-  Local<v8::Object> o3 = t3->GetFunction()->NewInstance();
-  Local<v8::Object> o4 = t4->GetFunction()->NewInstance();
+  Local<v8::Object> o1 = t1->GetFunction(context.local())
+                             .ToLocalChecked()
+                             ->NewInstance(context.local())
+                             .ToLocalChecked();
+  Local<v8::Object> o2 = t2->GetFunction(context.local())
+                             .ToLocalChecked()
+                             ->NewInstance(context.local())
+                             .ToLocalChecked();
+  Local<v8::Object> o3 = t3->GetFunction(context.local())
+                             .ToLocalChecked()
+                             ->NewInstance(context.local())
+                             .ToLocalChecked();
+  Local<v8::Object> o4 = t4->GetFunction(context.local())
+                             .ToLocalChecked()
+                             ->NewInstance(context.local())
+                             .ToLocalChecked();
 
   // Create prototype chain of hidden prototypes.
-  CHECK(o4->SetPrototype(o3));
-  CHECK(o3->SetPrototype(o2));
-  CHECK(o2->SetPrototype(o1));
+  CHECK(o4->SetPrototype(context.local(), o3).FromJust());
+  CHECK(o3->SetPrototype(context.local(), o2).FromJust());
+  CHECK(o2->SetPrototype(context.local(), o1).FromJust());
 
   // Call the runtime version of GetOwnPropertyNames() on the natively
   // created object through JavaScript.
-  context->Global()->Set(v8_str("obj"), o4);
-  // PROPERTY_ATTRIBUTES_NONE = 0
-  CompileRun("var names = %GetOwnPropertyNames(obj, 0);");
+  CHECK(context->Global()->Set(context.local(), v8_str("obj"), o4).FromJust());
+  // PROPERTY_FILTER_NONE = 0
+  CompileRun("var names = %GetOwnPropertyKeys(obj, 0);");
 
   ExpectInt32("names.length", 1006);
   ExpectTrue("names.indexOf(\"baz\") >= 0");
@@ -11161,7 +10798,10 @@
   i1->Set(v8_str("n1"), v8_num(1));
   i1->Set(v8_str("n2"), v8_num(2));
 
-  Local<v8::Object> o1 = t1->GetFunction()->NewInstance();
+  Local<v8::Object> o1 = t1->GetFunction(context.local())
+                             .ToLocalChecked()
+                             ->NewInstance(context.local())
+                             .ToLocalChecked();
   Local<v8::FunctionTemplate> t2 =
       v8::FunctionTemplate::New(context->GetIsolate());
   t2->SetHiddenPrototype(true);
@@ -11170,21 +10810,26 @@
   t2->Inherit(t1);
   t2->InstanceTemplate()->Set(v8_str("mine"), v8_num(4));
 
-  Local<v8::Object> o2 = t2->GetFunction()->NewInstance();
-  CHECK(o2->SetPrototype(o1));
+  Local<v8::Object> o2 = t2->GetFunction(context.local())
+                             .ToLocalChecked()
+                             ->NewInstance(context.local())
+                             .ToLocalChecked();
+  CHECK(o2->SetPrototype(context.local(), o1).FromJust());
 
   v8::Local<v8::Symbol> sym =
       v8::Symbol::New(context->GetIsolate(), v8_str("s1"));
-  o1->Set(sym, v8_num(3));
-  o1->SetHiddenValue(
-      v8_str("h1"), v8::Integer::New(context->GetIsolate(), 2013));
+  CHECK(o1->Set(context.local(), sym, v8_num(3)).FromJust());
+  o1->SetPrivate(context.local(),
+                 v8::Private::New(context->GetIsolate(), v8_str("h1")),
+                 v8::Integer::New(context->GetIsolate(), 2013))
+      .FromJust();
 
   // Call the runtime version of GetOwnPropertyNames() on
   // the natively created object through JavaScript.
-  context->Global()->Set(v8_str("obj"), o2);
-  context->Global()->Set(v8_str("sym"), sym);
-  // PROPERTY_ATTRIBUTES_NONE = 0
-  CompileRun("var names = %GetOwnPropertyNames(obj, 0);");
+  CHECK(context->Global()->Set(context.local(), v8_str("obj"), o2).FromJust());
+  CHECK(context->Global()->Set(context.local(), v8_str("sym"), sym).FromJust());
+  // PROPERTY_FILTER_NONE = 0
+  CompileRun("var names = %GetOwnPropertyKeys(obj, 0);");
 
   ExpectInt32("names.length", 7);
   ExpectTrue("names.indexOf(\"foo\") >= 0");
@@ -11205,27 +10850,44 @@
   Local<v8::FunctionTemplate> t1 = v8::FunctionTemplate::New(isolate);
   t1->PrototypeTemplate()->Set(v8_str("x"), v8::Integer::New(isolate, 42));
   t1->ReadOnlyPrototype();
-  context->Global()->Set(v8_str("func1"), t1->GetFunction());
+  CHECK(context->Global()
+            ->Set(context.local(), v8_str("func1"),
+                  t1->GetFunction(context.local()).ToLocalChecked())
+            .FromJust());
   // Configured value of ReadOnly flag.
-  CHECK(CompileRun(
-      "(function() {"
-      "  descriptor = Object.getOwnPropertyDescriptor(func1, 'prototype');"
-      "  return (descriptor['writable'] == false);"
-      "})()")->BooleanValue());
-  CHECK_EQ(42, CompileRun("func1.prototype.x")->Int32Value());
-  CHECK_EQ(42,
-           CompileRun("func1.prototype = {}; func1.prototype.x")->Int32Value());
+  CHECK(
+      CompileRun(
+          "(function() {"
+          "  descriptor = Object.getOwnPropertyDescriptor(func1, 'prototype');"
+          "  return (descriptor['writable'] == false);"
+          "})()")
+          ->BooleanValue(context.local())
+          .FromJust());
+  CHECK_EQ(
+      42,
+      CompileRun("func1.prototype.x")->Int32Value(context.local()).FromJust());
+  CHECK_EQ(42, CompileRun("func1.prototype = {}; func1.prototype.x")
+                   ->Int32Value(context.local())
+                   .FromJust());
 
   Local<v8::FunctionTemplate> t2 = v8::FunctionTemplate::New(isolate);
   t2->PrototypeTemplate()->Set(v8_str("x"), v8::Integer::New(isolate, 42));
-  context->Global()->Set(v8_str("func2"), t2->GetFunction());
+  CHECK(context->Global()
+            ->Set(context.local(), v8_str("func2"),
+                  t2->GetFunction(context.local()).ToLocalChecked())
+            .FromJust());
   // Default value of ReadOnly flag.
-  CHECK(CompileRun(
-      "(function() {"
-      "  descriptor = Object.getOwnPropertyDescriptor(func2, 'prototype');"
-      "  return (descriptor['writable'] == true);"
-      "})()")->BooleanValue());
-  CHECK_EQ(42, CompileRun("func2.prototype.x")->Int32Value());
+  CHECK(
+      CompileRun(
+          "(function() {"
+          "  descriptor = Object.getOwnPropertyDescriptor(func2, 'prototype');"
+          "  return (descriptor['writable'] == true);"
+          "})()")
+          ->BooleanValue(context.local())
+          .FromJust());
+  CHECK_EQ(
+      42,
+      CompileRun("func2.prototype.x")->Int32Value(context.local()).FromJust());
 }
 
 
@@ -11236,18 +10898,26 @@
 
   Local<v8::FunctionTemplate> t = v8::FunctionTemplate::New(isolate);
 
-  Local<v8::Object> o0 = t->GetFunction()->NewInstance();
-  Local<v8::Object> o1 = t->GetFunction()->NewInstance();
+  Local<v8::Object> o0 = t->GetFunction(context.local())
+                             .ToLocalChecked()
+                             ->NewInstance(context.local())
+                             .ToLocalChecked();
+  Local<v8::Object> o1 = t->GetFunction(context.local())
+                             .ToLocalChecked()
+                             ->NewInstance(context.local())
+                             .ToLocalChecked();
 
-  CHECK(o0->SetPrototype(o1));
+  CHECK(o0->SetPrototype(context.local(), o1).FromJust());
   // If setting the prototype leads to the cycle, SetPrototype should
   // return false and keep VM in sane state.
-  v8::TryCatch try_catch;
-  CHECK(!o1->SetPrototype(o0));
+  v8::TryCatch try_catch(isolate);
+  CHECK(o1->SetPrototype(context.local(), o0).IsNothing());
   CHECK(!try_catch.HasCaught());
-  DCHECK(!CcTest::i_isolate()->has_pending_exception());
+  CHECK(!CcTest::i_isolate()->has_pending_exception());
 
-  CHECK_EQ(42, CompileRun("function f() { return 42; }; f()")->Int32Value());
+  CHECK_EQ(42, CompileRun("function f() { return 42; }; f()")
+                   ->Int32Value(context.local())
+                   .FromJust());
 }
 
 
@@ -11258,16 +10928,18 @@
 
   Local<v8::FunctionTemplate> t1 = v8::FunctionTemplate::New(isolate);
   t1->RemovePrototype();
-  Local<v8::Function> fun = t1->GetFunction();
-  context->Global()->Set(v8_str("fun"), fun);
-  CHECK(!CompileRun("'prototype' in fun")->BooleanValue());
+  Local<v8::Function> fun = t1->GetFunction(context.local()).ToLocalChecked();
+  CHECK(context->Global()->Set(context.local(), v8_str("fun"), fun).FromJust());
+  CHECK(!CompileRun("'prototype' in fun")
+             ->BooleanValue(context.local())
+             .FromJust());
 
-  v8::TryCatch try_catch;
+  v8::TryCatch try_catch(isolate);
   CompileRun("new fun()");
   CHECK(try_catch.HasCaught());
 
   try_catch.Reset();
-  fun->NewInstance();
+  CHECK(fun->NewInstance(context.local()).IsEmpty());
   CHECK(try_catch.HasCaught());
 }
 
@@ -11277,22 +10949,26 @@
   v8::Isolate* isolate = context->GetIsolate();
   v8::HandleScope handle_scope(isolate);
   CompileRun(
-    "function Foo() { };"
-    "function Throw() { throw 5; };"
-    "var x = { };"
-    "x.__defineSetter__('set', Throw);"
-    "x.__defineGetter__('get', Throw);");
-  Local<v8::Object> x =
-      Local<v8::Object>::Cast(context->Global()->Get(v8_str("x")));
-  v8::TryCatch try_catch;
-  x->Set(v8_str("set"), v8::Integer::New(isolate, 8));
-  x->Get(v8_str("get"));
-  x->Set(v8_str("set"), v8::Integer::New(isolate, 8));
-  x->Get(v8_str("get"));
-  x->Set(v8_str("set"), v8::Integer::New(isolate, 8));
-  x->Get(v8_str("get"));
-  x->Set(v8_str("set"), v8::Integer::New(isolate, 8));
-  x->Get(v8_str("get"));
+      "function Foo() { };"
+      "function Throw() { throw 5; };"
+      "var x = { };"
+      "x.__defineSetter__('set', Throw);"
+      "x.__defineGetter__('get', Throw);");
+  Local<v8::Object> x = Local<v8::Object>::Cast(
+      context->Global()->Get(context.local(), v8_str("x")).ToLocalChecked());
+  v8::TryCatch try_catch(isolate);
+  CHECK(x->Set(context.local(), v8_str("set"), v8::Integer::New(isolate, 8))
+            .IsNothing());
+  CHECK(x->Get(context.local(), v8_str("get")).IsEmpty());
+  CHECK(x->Set(context.local(), v8_str("set"), v8::Integer::New(isolate, 8))
+            .IsNothing());
+  CHECK(x->Get(context.local(), v8_str("get")).IsEmpty());
+  CHECK(x->Set(context.local(), v8_str("set"), v8::Integer::New(isolate, 8))
+            .IsNothing());
+  CHECK(x->Get(context.local(), v8_str("get")).IsEmpty());
+  CHECK(x->Set(context.local(), v8_str("set"), v8::Integer::New(isolate, 8))
+            .IsNothing());
+  CHECK(x->Get(context.local(), v8_str("get")).IsEmpty());
 }
 
 
@@ -11302,13 +10978,14 @@
   v8::HandleScope handle_scope(isolate);
   Local<v8::FunctionTemplate> templ = v8::FunctionTemplate::New(isolate);
   templ->SetClassName(v8_str("Fun"));
-  Local<Function> cons = templ->GetFunction();
-  context->Global()->Set(v8_str("Fun"), cons);
-  Local<v8::Object> inst = cons->NewInstance();
-  i::Handle<i::JSObject> obj(v8::Utils::OpenHandle(*inst));
+  Local<Function> cons = templ->GetFunction(context.local()).ToLocalChecked();
+  CHECK(
+      context->Global()->Set(context.local(), v8_str("Fun"), cons).FromJust());
+  Local<v8::Object> inst = cons->NewInstance(context.local()).ToLocalChecked();
+  i::Handle<i::JSReceiver> obj(v8::Utils::OpenHandle(*inst));
   CHECK(obj->IsJSObject());
   Local<Value> value = CompileRun("(new Fun()).constructor === Fun");
-  CHECK(value->BooleanValue());
+  CHECK(value->BooleanValue(context.local()).FromJust());
 }
 
 
@@ -11317,18 +10994,19 @@
   ApiTestFuzzer::Fuzz();
   Local<Object> This;
 
+  v8::Local<v8::Context> context = args.GetIsolate()->GetCurrentContext();
   if (args.IsConstructCall()) {
     Local<Object> Holder = args.Holder();
     This = Object::New(args.GetIsolate());
     Local<Value> proto = Holder->GetPrototype();
     if (proto->IsObject()) {
-      This->SetPrototype(proto);
+      This->SetPrototype(context, proto).FromJust();
     }
   } else {
     This = args.This();
   }
 
-  This->Set(v8_str("a"), args[0]);
+  This->Set(context, v8_str("a"), args[0]).FromJust();
   args.GetReturnValue().Set(This);
 }
 
@@ -11345,11 +11023,15 @@
   v8::Isolate* isolate = context->GetIsolate();
   v8::HandleScope handle_scope(isolate);
 
-  { Local<ObjectTemplate> instance_template = ObjectTemplate::New(isolate);
+  {
+    Local<ObjectTemplate> instance_template = ObjectTemplate::New(isolate);
     instance_template->SetCallAsFunctionHandler(ConstructorCallback);
-    Local<Object> instance = instance_template->NewInstance();
-    context->Global()->Set(v8_str("obj"), instance);
-    v8::TryCatch try_catch;
+    Local<Object> instance =
+        instance_template->NewInstance(context.local()).ToLocalChecked();
+    CHECK(context->Global()
+              ->Set(context.local(), v8_str("obj"), instance)
+              .FromJust());
+    v8::TryCatch try_catch(isolate);
     Local<Value> value;
     CHECK(!try_catch.HasCaught());
 
@@ -11357,121 +11039,142 @@
     value = CompileRun("(function() { var o = new obj(28); return o.a; })()");
     CHECK(!try_catch.HasCaught());
     CHECK(value->IsInt32());
-    CHECK_EQ(28, value->Int32Value());
+    CHECK_EQ(28, value->Int32Value(context.local()).FromJust());
 
-    Local<Value> args1[] = { v8_num(28) };
-    Local<Value> value_obj1 = instance->CallAsConstructor(1, args1);
+    Local<Value> args1[] = {v8_num(28)};
+    Local<Value> value_obj1 =
+        instance->CallAsConstructor(context.local(), 1, args1).ToLocalChecked();
     CHECK(value_obj1->IsObject());
     Local<Object> object1 = Local<Object>::Cast(value_obj1);
-    value = object1->Get(v8_str("a"));
+    value = object1->Get(context.local(), v8_str("a")).ToLocalChecked();
     CHECK(value->IsInt32());
     CHECK(!try_catch.HasCaught());
-    CHECK_EQ(28, value->Int32Value());
+    CHECK_EQ(28, value->Int32Value(context.local()).FromJust());
 
     // Call the Object's constructor with a String.
-    value = CompileRun(
-        "(function() { var o = new obj('tipli'); return o.a; })()");
+    value =
+        CompileRun("(function() { var o = new obj('tipli'); return o.a; })()");
     CHECK(!try_catch.HasCaught());
     CHECK(value->IsString());
-    String::Utf8Value string_value1(value->ToString(isolate));
-    CHECK_EQ("tipli", *string_value1);
+    String::Utf8Value string_value1(
+        value->ToString(context.local()).ToLocalChecked());
+    CHECK_EQ(0, strcmp("tipli", *string_value1));
 
-    Local<Value> args2[] = { v8_str("tipli") };
-    Local<Value> value_obj2 = instance->CallAsConstructor(1, args2);
+    Local<Value> args2[] = {v8_str("tipli")};
+    Local<Value> value_obj2 =
+        instance->CallAsConstructor(context.local(), 1, args2).ToLocalChecked();
     CHECK(value_obj2->IsObject());
     Local<Object> object2 = Local<Object>::Cast(value_obj2);
-    value = object2->Get(v8_str("a"));
+    value = object2->Get(context.local(), v8_str("a")).ToLocalChecked();
     CHECK(!try_catch.HasCaught());
     CHECK(value->IsString());
-    String::Utf8Value string_value2(value->ToString(isolate));
-    CHECK_EQ("tipli", *string_value2);
+    String::Utf8Value string_value2(
+        value->ToString(context.local()).ToLocalChecked());
+    CHECK_EQ(0, strcmp("tipli", *string_value2));
 
     // Call the Object's constructor with a Boolean.
     value = CompileRun("(function() { var o = new obj(true); return o.a; })()");
     CHECK(!try_catch.HasCaught());
     CHECK(value->IsBoolean());
-    CHECK_EQ(true, value->BooleanValue());
+    CHECK_EQ(true, value->BooleanValue(context.local()).FromJust());
 
-    Handle<Value> args3[] = { v8::True(isolate) };
-    Local<Value> value_obj3 = instance->CallAsConstructor(1, args3);
+    Local<Value> args3[] = {v8::True(isolate)};
+    Local<Value> value_obj3 =
+        instance->CallAsConstructor(context.local(), 1, args3).ToLocalChecked();
     CHECK(value_obj3->IsObject());
     Local<Object> object3 = Local<Object>::Cast(value_obj3);
-    value = object3->Get(v8_str("a"));
+    value = object3->Get(context.local(), v8_str("a")).ToLocalChecked();
     CHECK(!try_catch.HasCaught());
     CHECK(value->IsBoolean());
-    CHECK_EQ(true, value->BooleanValue());
+    CHECK_EQ(true, value->BooleanValue(context.local()).FromJust());
 
     // Call the Object's constructor with undefined.
-    Handle<Value> args4[] = { v8::Undefined(isolate) };
-    Local<Value> value_obj4 = instance->CallAsConstructor(1, args4);
+    Local<Value> args4[] = {v8::Undefined(isolate)};
+    Local<Value> value_obj4 =
+        instance->CallAsConstructor(context.local(), 1, args4).ToLocalChecked();
     CHECK(value_obj4->IsObject());
     Local<Object> object4 = Local<Object>::Cast(value_obj4);
-    value = object4->Get(v8_str("a"));
+    value = object4->Get(context.local(), v8_str("a")).ToLocalChecked();
     CHECK(!try_catch.HasCaught());
     CHECK(value->IsUndefined());
 
     // Call the Object's constructor with null.
-    Handle<Value> args5[] = { v8::Null(isolate) };
-    Local<Value> value_obj5 = instance->CallAsConstructor(1, args5);
+    Local<Value> args5[] = {v8::Null(isolate)};
+    Local<Value> value_obj5 =
+        instance->CallAsConstructor(context.local(), 1, args5).ToLocalChecked();
     CHECK(value_obj5->IsObject());
     Local<Object> object5 = Local<Object>::Cast(value_obj5);
-    value = object5->Get(v8_str("a"));
+    value = object5->Get(context.local(), v8_str("a")).ToLocalChecked();
     CHECK(!try_catch.HasCaught());
     CHECK(value->IsNull());
   }
 
   // Check exception handling when there is no constructor set for the Object.
-  { Local<ObjectTemplate> instance_template = ObjectTemplate::New(isolate);
-    Local<Object> instance = instance_template->NewInstance();
-    context->Global()->Set(v8_str("obj2"), instance);
-    v8::TryCatch try_catch;
+  {
+    Local<ObjectTemplate> instance_template = ObjectTemplate::New(isolate);
+    Local<Object> instance =
+        instance_template->NewInstance(context.local()).ToLocalChecked();
+    CHECK(context->Global()
+              ->Set(context.local(), v8_str("obj2"), instance)
+              .FromJust());
+    v8::TryCatch try_catch(isolate);
     Local<Value> value;
     CHECK(!try_catch.HasCaught());
 
     value = CompileRun("new obj2(28)");
     CHECK(try_catch.HasCaught());
     String::Utf8Value exception_value1(try_catch.Exception());
-    CHECK_EQ("TypeError: object is not a function", *exception_value1);
+    CHECK_EQ(0,
+             strcmp("TypeError: obj2 is not a constructor", *exception_value1));
     try_catch.Reset();
 
-    Local<Value> args[] = { v8_num(29) };
-    value = instance->CallAsConstructor(1, args);
+    Local<Value> args[] = {v8_num(29)};
+    CHECK(instance->CallAsConstructor(context.local(), 1, args).IsEmpty());
     CHECK(try_catch.HasCaught());
     String::Utf8Value exception_value2(try_catch.Exception());
-    CHECK_EQ("TypeError: #<Object> is not a function", *exception_value2);
+    CHECK_EQ(
+        0, strcmp("TypeError: object is not a constructor", *exception_value2));
     try_catch.Reset();
   }
 
   // Check the case when constructor throws exception.
-  { Local<ObjectTemplate> instance_template = ObjectTemplate::New(isolate);
+  {
+    Local<ObjectTemplate> instance_template = ObjectTemplate::New(isolate);
     instance_template->SetCallAsFunctionHandler(ThrowValue);
-    Local<Object> instance = instance_template->NewInstance();
-    context->Global()->Set(v8_str("obj3"), instance);
-    v8::TryCatch try_catch;
+    Local<Object> instance =
+        instance_template->NewInstance(context.local()).ToLocalChecked();
+    CHECK(context->Global()
+              ->Set(context.local(), v8_str("obj3"), instance)
+              .FromJust());
+    v8::TryCatch try_catch(isolate);
     Local<Value> value;
     CHECK(!try_catch.HasCaught());
 
     value = CompileRun("new obj3(22)");
     CHECK(try_catch.HasCaught());
     String::Utf8Value exception_value1(try_catch.Exception());
-    CHECK_EQ("22", *exception_value1);
+    CHECK_EQ(0, strcmp("22", *exception_value1));
     try_catch.Reset();
 
-    Local<Value> args[] = { v8_num(23) };
-    value = instance->CallAsConstructor(1, args);
+    Local<Value> args[] = {v8_num(23)};
+    CHECK(instance->CallAsConstructor(context.local(), 1, args).IsEmpty());
     CHECK(try_catch.HasCaught());
     String::Utf8Value exception_value2(try_catch.Exception());
-    CHECK_EQ("23", *exception_value2);
+    CHECK_EQ(0, strcmp("23", *exception_value2));
     try_catch.Reset();
   }
 
   // Check whether constructor returns with an object or non-object.
-  { Local<FunctionTemplate> function_template =
+  {
+    Local<FunctionTemplate> function_template =
         FunctionTemplate::New(isolate, FakeConstructorCallback);
-    Local<Function> function = function_template->GetFunction();
+    Local<Function> function =
+        function_template->GetFunction(context.local()).ToLocalChecked();
     Local<Object> instance1 = function;
-    context->Global()->Set(v8_str("obj4"), instance1);
-    v8::TryCatch try_catch;
+    CHECK(context->Global()
+              ->Set(context.local(), v8_str("obj4"), instance1)
+              .FromJust());
+    v8::TryCatch try_catch(isolate);
     Local<Value> value;
     CHECK(!try_catch.HasCaught());
 
@@ -11482,26 +11185,31 @@
     CHECK(!try_catch.HasCaught());
     CHECK(value->IsObject());
 
-    Local<Value> args1[] = { v8_num(28) };
-    value = instance1->CallAsConstructor(1, args1);
+    Local<Value> args1[] = {v8_num(28)};
+    value = instance1->CallAsConstructor(context.local(), 1, args1)
+                .ToLocalChecked();
     CHECK(!try_catch.HasCaught());
     CHECK(value->IsObject());
 
     Local<ObjectTemplate> instance_template = ObjectTemplate::New(isolate);
     instance_template->SetCallAsFunctionHandler(FakeConstructorCallback);
-    Local<Object> instance2 = instance_template->NewInstance();
-    context->Global()->Set(v8_str("obj5"), instance2);
+    Local<Object> instance2 =
+        instance_template->NewInstance(context.local()).ToLocalChecked();
+    CHECK(context->Global()
+              ->Set(context.local(), v8_str("obj5"), instance2)
+              .FromJust());
     CHECK(!try_catch.HasCaught());
 
     CHECK(instance2->IsObject());
-    CHECK(!instance2->IsFunction());
+    CHECK(instance2->IsFunction());
 
     value = CompileRun("new obj5(28)");
     CHECK(!try_catch.HasCaught());
     CHECK(!value->IsObject());
 
-    Local<Value> args2[] = { v8_num(28) };
-    value = instance2->CallAsConstructor(1, args2);
+    Local<Value> args2[] = {v8_num(28)};
+    value = instance2->CallAsConstructor(context.local(), 1, args2)
+                .ToLocalChecked();
     CHECK(!try_catch.HasCaught());
     CHECK(!value->IsObject());
   }
@@ -11514,23 +11222,24 @@
   v8::HandleScope handle_scope(isolate);
   Local<v8::FunctionTemplate> templ = v8::FunctionTemplate::New(isolate);
   templ->SetClassName(v8_str("Fun"));
-  Local<Function> cons = templ->GetFunction();
-  context->Global()->Set(v8_str("Fun"), cons);
+  Local<Function> cons = templ->GetFunction(context.local()).ToLocalChecked();
+  CHECK(
+      context->Global()->Set(context.local(), v8_str("Fun"), cons).FromJust());
   Local<Value> value = CompileRun(
-    "function test() {"
-    "  try {"
-    "    (new Fun()).blah()"
-    "  } catch (e) {"
-    "    var str = String(e);"
-    // "    if (str.indexOf('TypeError') == -1) return 1;"
-    // "    if (str.indexOf('[object Fun]') != -1) return 2;"
-    // "    if (str.indexOf('#<Fun>') == -1) return 3;"
-    "    return 0;"
-    "  }"
-    "  return 4;"
-    "}"
-    "test();");
-  CHECK_EQ(0, value->Int32Value());
+      "function test() {"
+      "  try {"
+      "    (new Fun()).blah()"
+      "  } catch (e) {"
+      "    var str = String(e);"
+      // "    if (str.indexOf('TypeError') == -1) return 1;"
+      // "    if (str.indexOf('[object Fun]') != -1) return 2;"
+      // "    if (str.indexOf('#<Fun>') == -1) return 3;"
+      "    return 0;"
+      "  }"
+      "  return 4;"
+      "}"
+      "test();");
+  CHECK_EQ(0, value->Int32Value(context.local()).FromJust());
 }
 
 
@@ -11550,21 +11259,37 @@
       "var x = new Object();"
       "x.eval = function(x) { return 1; };"
       "result3 = f(x);");
-  script->Run();
-  CHECK_EQ(2, current->Global()->Get(v8_str("result1"))->Int32Value());
-  CHECK_EQ(0, current->Global()->Get(v8_str("result2"))->Int32Value());
-  CHECK_EQ(1, current->Global()->Get(v8_str("result3"))->Int32Value());
+  script->Run(current.local()).ToLocalChecked();
+  CHECK_EQ(2, current->Global()
+                  ->Get(current.local(), v8_str("result1"))
+                  .ToLocalChecked()
+                  ->Int32Value(current.local())
+                  .FromJust());
+  CHECK_EQ(0, current->Global()
+                  ->Get(current.local(), v8_str("result2"))
+                  .ToLocalChecked()
+                  ->Int32Value(current.local())
+                  .FromJust());
+  CHECK_EQ(1, current->Global()
+                  ->Get(current.local(), v8_str("result3"))
+                  .ToLocalChecked()
+                  ->Int32Value(current.local())
+                  .FromJust());
 
-  v8::TryCatch try_catch;
+  v8::TryCatch try_catch(current->GetIsolate());
   script = v8_compile(
       "function f(x) { "
       "  var bar = 2;"
       "  with (x) { return eval('bar'); }"
       "}"
       "result4 = f(this)");
-  script->Run();
+  script->Run(current.local()).ToLocalChecked();
   CHECK(!try_catch.HasCaught());
-  CHECK_EQ(2, current->Global()->Get(v8_str("result4"))->Int32Value());
+  CHECK_EQ(2, current->Global()
+                  ->Get(current.local(), v8_str("result4"))
+                  .ToLocalChecked()
+                  ->Int32Value(current.local())
+                  .FromJust());
 
   try_catch.Reset();
 }
@@ -11580,27 +11305,34 @@
   current->SetSecurityToken(token);
 
   // Set up reference from current to other.
-  current->Global()->Set(v8_str("other"), other->Global());
+  CHECK(current->Global()
+            ->Set(current.local(), v8_str("other"), other->Global())
+            .FromJust());
 
   // Check that new variables are introduced in other context.
   Local<Script> script = v8_compile("other.eval('var foo = 1234')");
-  script->Run();
-  Local<Value> foo = other->Global()->Get(v8_str("foo"));
-  CHECK_EQ(1234, foo->Int32Value());
-  CHECK(!current->Global()->Has(v8_str("foo")));
+  script->Run(current.local()).ToLocalChecked();
+  Local<Value> foo =
+      other->Global()->Get(current.local(), v8_str("foo")).ToLocalChecked();
+  CHECK_EQ(1234, foo->Int32Value(other.local()).FromJust());
+  CHECK(!current->Global()->Has(current.local(), v8_str("foo")).FromJust());
 
   // Check that writing to non-existing properties introduces them in
   // the other context.
   script = v8_compile("other.eval('na = 1234')");
-  script->Run();
-  CHECK_EQ(1234, other->Global()->Get(v8_str("na"))->Int32Value());
-  CHECK(!current->Global()->Has(v8_str("na")));
+  script->Run(current.local()).ToLocalChecked();
+  CHECK_EQ(1234, other->Global()
+                     ->Get(current.local(), v8_str("na"))
+                     .ToLocalChecked()
+                     ->Int32Value(other.local())
+                     .FromJust());
+  CHECK(!current->Global()->Has(current.local(), v8_str("na")).FromJust());
 
   // Check that global variables in current context are not visible in other
   // context.
-  v8::TryCatch try_catch;
+  v8::TryCatch try_catch(CcTest::isolate());
   script = v8_compile("var bar = 42; other.eval('bar');");
-  Local<Value> result = script->Run();
+  CHECK(script->Run(current.local()).IsEmpty());
   CHECK(try_catch.HasCaught());
   try_catch.Reset();
 
@@ -11611,36 +11343,43 @@
       "  var baz = 87;"
       "  return other.eval('baz');"
       "})();");
-  result = script->Run();
+  CHECK(script->Run(current.local()).IsEmpty());
   CHECK(try_catch.HasCaught());
   try_catch.Reset();
 
   // Check that global variables in the other environment are visible
   // when evaluting code.
-  other->Global()->Set(v8_str("bis"), v8_num(1234));
+  CHECK(other->Global()
+            ->Set(other.local(), v8_str("bis"), v8_num(1234))
+            .FromJust());
   script = v8_compile("other.eval('bis')");
-  CHECK_EQ(1234, script->Run()->Int32Value());
+  CHECK_EQ(1234, script->Run(current.local())
+                     .ToLocalChecked()
+                     ->Int32Value(current.local())
+                     .FromJust());
   CHECK(!try_catch.HasCaught());
 
   // Check that the 'this' pointer points to the global object evaluating
   // code.
-  other->Global()->Set(v8_str("t"), other->Global());
+  CHECK(other->Global()
+            ->Set(current.local(), v8_str("t"), other->Global())
+            .FromJust());
   script = v8_compile("other.eval('this == t')");
-  result = script->Run();
+  Local<Value> result = script->Run(current.local()).ToLocalChecked();
   CHECK(result->IsTrue());
   CHECK(!try_catch.HasCaught());
 
   // Check that variables introduced in with-statement are not visible in
   // other context.
   script = v8_compile("with({x:2}){other.eval('x')}");
-  result = script->Run();
+  CHECK(script->Run(current.local()).IsEmpty());
   CHECK(try_catch.HasCaught());
   try_catch.Reset();
 
   // Check that you cannot use 'eval.call' with another object than the
   // current global object.
   script = v8_compile("other.y = 1; eval.call(other, 'y')");
-  result = script->Run();
+  CHECK(script->Run(current.local()).IsEmpty());
   CHECK(try_catch.HasCaught());
 }
 
@@ -11656,25 +11395,25 @@
 
   // Set up function in context0 that uses eval from context0.
   context0->Enter();
-  v8::Handle<v8::Value> fun =
-      CompileRun("var x = 42;"
-                 "(function() {"
-                 "  var e = eval;"
-                 "  return function(s) { return e(s); }"
-                 "})()");
+  v8::Local<v8::Value> fun = CompileRun(
+      "var x = 42;"
+      "(function() {"
+      "  var e = eval;"
+      "  return function(s) { return e(s); }"
+      "})()");
   context0->Exit();
 
   // Put the function into context1 and call it before and after
   // detaching the global.  Before detaching, the call succeeds and
   // after detaching and exception is thrown.
   context1->Enter();
-  context1->Global()->Set(v8_str("fun"), fun);
-  v8::Handle<v8::Value> x_value = CompileRun("fun('x')");
-  CHECK_EQ(42, x_value->Int32Value());
+  CHECK(context1->Global()->Set(context1, v8_str("fun"), fun).FromJust());
+  v8::Local<v8::Value> x_value = CompileRun("fun('x')");
+  CHECK_EQ(42, x_value->Int32Value(context1).FromJust());
   context0->DetachGlobal();
-  v8::TryCatch catcher;
+  v8::TryCatch catcher(isolate);
   x_value = CompileRun("fun('x')");
-  CHECK_EQ(42, x_value->Int32Value());
+  CHECK_EQ(42, x_value->Int32Value(context1).FromJust());
   context1->Exit();
 }
 
@@ -11689,12 +11428,14 @@
   current->SetSecurityToken(token);
 
   // Set up reference from current to other.
-  current->Global()->Set(v8_str("other"), other->Global());
+  CHECK(current->Global()
+            ->Set(current.local(), v8_str("other"), other->Global())
+            .FromJust());
 
   // Trigger lazy loading in other context.
   Local<Script> script = v8_compile("other.eval('new Date(42)')");
-  Local<Value> value = script->Run();
-  CHECK_EQ(42.0, value->NumberValue());
+  Local<Value> value = script->Run(current.local()).ToLocalChecked();
+  CHECK_EQ(42.0, value->NumberValue(current.local()).FromJust());
 }
 
 
@@ -11702,7 +11443,10 @@
   ApiTestFuzzer::Fuzz();
   if (args.IsConstructCall()) {
     if (args[0]->IsInt32()) {
-      args.GetReturnValue().Set(v8_num(-args[0]->Int32Value()));
+      args.GetReturnValue().Set(
+          v8_num(-args[0]
+                      ->Int32Value(args.GetIsolate()->GetCurrentContext())
+                      .FromJust()));
       return;
     }
   }
@@ -11724,65 +11468,79 @@
   v8::Isolate* isolate = context->GetIsolate();
   v8::HandleScope scope(isolate);
 
-  { Local<v8::FunctionTemplate> t = v8::FunctionTemplate::New(isolate);
+  {
+    Local<v8::FunctionTemplate> t = v8::FunctionTemplate::New(isolate);
     Local<ObjectTemplate> instance_template = t->InstanceTemplate();
     instance_template->SetCallAsFunctionHandler(call_as_function);
-    Local<v8::Object> instance = t->GetFunction()->NewInstance();
-    context->Global()->Set(v8_str("obj"), instance);
-    v8::TryCatch try_catch;
+    Local<v8::Object> instance = t->GetFunction(context.local())
+                                     .ToLocalChecked()
+                                     ->NewInstance(context.local())
+                                     .ToLocalChecked();
+    CHECK(context->Global()
+              ->Set(context.local(), v8_str("obj"), instance)
+              .FromJust());
+    v8::TryCatch try_catch(isolate);
     Local<Value> value;
     CHECK(!try_catch.HasCaught());
 
     value = CompileRun("obj(42)");
     CHECK(!try_catch.HasCaught());
-    CHECK_EQ(42, value->Int32Value());
+    CHECK_EQ(42, value->Int32Value(context.local()).FromJust());
 
     value = CompileRun("(function(o){return o(49)})(obj)");
     CHECK(!try_catch.HasCaught());
-    CHECK_EQ(49, value->Int32Value());
+    CHECK_EQ(49, value->Int32Value(context.local()).FromJust());
 
     // test special case of call as function
     value = CompileRun("[obj]['0'](45)");
     CHECK(!try_catch.HasCaught());
-    CHECK_EQ(45, value->Int32Value());
+    CHECK_EQ(45, value->Int32Value(context.local()).FromJust());
 
-    value = CompileRun("obj.call = Function.prototype.call;"
-                       "obj.call(null, 87)");
+    value = CompileRun(
+        "obj.call = Function.prototype.call;"
+        "obj.call(null, 87)");
     CHECK(!try_catch.HasCaught());
-    CHECK_EQ(87, value->Int32Value());
+    CHECK_EQ(87, value->Int32Value(context.local()).FromJust());
 
     // Regression tests for bug #1116356: Calling call through call/apply
     // must work for non-function receivers.
     const char* apply_99 = "Function.prototype.call.apply(obj, [this, 99])";
     value = CompileRun(apply_99);
     CHECK(!try_catch.HasCaught());
-    CHECK_EQ(99, value->Int32Value());
+    CHECK_EQ(99, value->Int32Value(context.local()).FromJust());
 
     const char* call_17 = "Function.prototype.call.call(obj, this, 17)";
     value = CompileRun(call_17);
     CHECK(!try_catch.HasCaught());
-    CHECK_EQ(17, value->Int32Value());
+    CHECK_EQ(17, value->Int32Value(context.local()).FromJust());
 
     // Check that the call-as-function handler can be called through
     // new.
     value = CompileRun("new obj(43)");
     CHECK(!try_catch.HasCaught());
-    CHECK_EQ(-43, value->Int32Value());
+    CHECK_EQ(-43, value->Int32Value(context.local()).FromJust());
 
     // Check that the call-as-function handler can be called through
     // the API.
-    v8::Handle<Value> args[] = { v8_num(28) };
-    value = instance->CallAsFunction(instance, 1, args);
+    v8::Local<Value> args[] = {v8_num(28)};
+    value = instance->CallAsFunction(context.local(), instance, 1, args)
+                .ToLocalChecked();
     CHECK(!try_catch.HasCaught());
-    CHECK_EQ(28, value->Int32Value());
+    CHECK_EQ(28, value->Int32Value(context.local()).FromJust());
   }
 
-  { Local<v8::FunctionTemplate> t = v8::FunctionTemplate::New(isolate);
+  {
+    Local<v8::FunctionTemplate> t = v8::FunctionTemplate::New(isolate);
     Local<ObjectTemplate> instance_template(t->InstanceTemplate());
     USE(instance_template);
-    Local<v8::Object> instance = t->GetFunction()->NewInstance();
-    context->Global()->Set(v8_str("obj2"), instance);
-    v8::TryCatch try_catch;
+    Local<v8::Object> instance = t->GetFunction(context.local())
+                                     .ToLocalChecked()
+                                     ->NewInstance(context.local())
+                                     .ToLocalChecked();
+    CHECK(context->Global()
+              ->Set(context.local(), v8_str("obj2"), instance)
+              .FromJust());
+    v8::TryCatch try_catch(isolate);
     Local<Value> value;
     CHECK(!try_catch.HasCaught());
 
@@ -11792,27 +11550,33 @@
     CHECK(try_catch.HasCaught());
     String::Utf8Value exception_value1(try_catch.Exception());
     // TODO(verwaest): Better message
-    CHECK_EQ("TypeError: object is not a function",
-             *exception_value1);
+    CHECK_EQ(0, strcmp("TypeError: obj2 is not a function", *exception_value1));
     try_catch.Reset();
 
     // Call an object without call-as-function handler through the API
     value = CompileRun("obj2(28)");
-    v8::Handle<Value> args[] = { v8_num(28) };
-    value = instance->CallAsFunction(instance, 1, args);
-    CHECK(value.IsEmpty());
+    v8::Local<Value> args[] = {v8_num(28)};
+    CHECK(
+        instance->CallAsFunction(context.local(), instance, 1, args).IsEmpty());
     CHECK(try_catch.HasCaught());
     String::Utf8Value exception_value2(try_catch.Exception());
-    CHECK_EQ("TypeError: [object Object] is not a function", *exception_value2);
+    CHECK_EQ(0,
+             strcmp("TypeError: object is not a function", *exception_value2));
     try_catch.Reset();
   }
 
-  { Local<v8::FunctionTemplate> t = v8::FunctionTemplate::New(isolate);
+  {
+    Local<v8::FunctionTemplate> t = v8::FunctionTemplate::New(isolate);
     Local<ObjectTemplate> instance_template = t->InstanceTemplate();
     instance_template->SetCallAsFunctionHandler(ThrowValue);
-    Local<v8::Object> instance = t->GetFunction()->NewInstance();
-    context->Global()->Set(v8_str("obj3"), instance);
-    v8::TryCatch try_catch;
+    Local<v8::Object> instance = t->GetFunction(context.local())
+                                     .ToLocalChecked()
+                                     ->NewInstance(context.local())
+                                     .ToLocalChecked();
+    CHECK(context->Global()
+              ->Set(context.local(), v8_str("obj3"), instance)
+              .FromJust());
+    v8::TryCatch try_catch(isolate);
     Local<Value> value;
     CHECK(!try_catch.HasCaught());
 
@@ -11820,87 +11584,119 @@
     value = CompileRun("obj3(22)");
     CHECK(try_catch.HasCaught());
     String::Utf8Value exception_value1(try_catch.Exception());
-    CHECK_EQ("22", *exception_value1);
+    CHECK_EQ(0, strcmp("22", *exception_value1));
     try_catch.Reset();
 
-    v8::Handle<Value> args[] = { v8_num(23) };
-    value = instance->CallAsFunction(instance, 1, args);
+    v8::Local<Value> args[] = {v8_num(23)};
+    CHECK(
+        instance->CallAsFunction(context.local(), instance, 1, args).IsEmpty());
     CHECK(try_catch.HasCaught());
     String::Utf8Value exception_value2(try_catch.Exception());
-    CHECK_EQ("23", *exception_value2);
+    CHECK_EQ(0, strcmp("23", *exception_value2));
     try_catch.Reset();
   }
 
-  { Local<v8::FunctionTemplate> t = v8::FunctionTemplate::New(isolate);
+  {
+    Local<v8::FunctionTemplate> t = v8::FunctionTemplate::New(isolate);
     Local<ObjectTemplate> instance_template = t->InstanceTemplate();
     instance_template->SetCallAsFunctionHandler(ReturnThis);
-    Local<v8::Object> instance = t->GetFunction()->NewInstance();
+    Local<v8::Object> instance = t->GetFunction(context.local())
+                                     .ToLocalChecked()
+                                     ->NewInstance(context.local())
+                                     .ToLocalChecked();
 
     Local<v8::Value> a1 =
-        instance->CallAsFunction(v8::Undefined(isolate), 0, NULL);
+        instance->CallAsFunction(context.local(), v8::Undefined(isolate), 0,
+                                 NULL)
+            .ToLocalChecked();
     CHECK(a1->StrictEquals(instance));
     Local<v8::Value> a2 =
-        instance->CallAsFunction(v8::Null(isolate), 0, NULL);
+        instance->CallAsFunction(context.local(), v8::Null(isolate), 0, NULL)
+            .ToLocalChecked();
     CHECK(a2->StrictEquals(instance));
     Local<v8::Value> a3 =
-        instance->CallAsFunction(v8_num(42), 0, NULL);
+        instance->CallAsFunction(context.local(), v8_num(42), 0, NULL)
+            .ToLocalChecked();
     CHECK(a3->StrictEquals(instance));
     Local<v8::Value> a4 =
-        instance->CallAsFunction(v8_str("hello"), 0, NULL);
+        instance->CallAsFunction(context.local(), v8_str("hello"), 0, NULL)
+            .ToLocalChecked();
     CHECK(a4->StrictEquals(instance));
     Local<v8::Value> a5 =
-        instance->CallAsFunction(v8::True(isolate), 0, NULL);
+        instance->CallAsFunction(context.local(), v8::True(isolate), 0, NULL)
+            .ToLocalChecked();
     CHECK(a5->StrictEquals(instance));
   }
 
-  { CompileRun(
-      "function ReturnThisSloppy() {"
-      "  return this;"
-      "}"
-      "function ReturnThisStrict() {"
-      "  'use strict';"
-      "  return this;"
-      "}");
-    Local<Function> ReturnThisSloppy =
-        Local<Function>::Cast(
-            context->Global()->Get(v8_str("ReturnThisSloppy")));
-    Local<Function> ReturnThisStrict =
-        Local<Function>::Cast(
-            context->Global()->Get(v8_str("ReturnThisStrict")));
+  {
+    CompileRun(
+        "function ReturnThisSloppy() {"
+        "  return this;"
+        "}"
+        "function ReturnThisStrict() {"
+        "  'use strict';"
+        "  return this;"
+        "}");
+    Local<Function> ReturnThisSloppy = Local<Function>::Cast(
+        context->Global()
+            ->Get(context.local(), v8_str("ReturnThisSloppy"))
+            .ToLocalChecked());
+    Local<Function> ReturnThisStrict = Local<Function>::Cast(
+        context->Global()
+            ->Get(context.local(), v8_str("ReturnThisStrict"))
+            .ToLocalChecked());
 
     Local<v8::Value> a1 =
-        ReturnThisSloppy->CallAsFunction(v8::Undefined(isolate), 0, NULL);
+        ReturnThisSloppy->CallAsFunction(context.local(),
+                                         v8::Undefined(isolate), 0, NULL)
+            .ToLocalChecked();
     CHECK(a1->StrictEquals(context->Global()));
     Local<v8::Value> a2 =
-        ReturnThisSloppy->CallAsFunction(v8::Null(isolate), 0, NULL);
+        ReturnThisSloppy->CallAsFunction(context.local(), v8::Null(isolate), 0,
+                                         NULL)
+            .ToLocalChecked();
     CHECK(a2->StrictEquals(context->Global()));
     Local<v8::Value> a3 =
-        ReturnThisSloppy->CallAsFunction(v8_num(42), 0, NULL);
+        ReturnThisSloppy->CallAsFunction(context.local(), v8_num(42), 0, NULL)
+            .ToLocalChecked();
     CHECK(a3->IsNumberObject());
     CHECK_EQ(42.0, a3.As<v8::NumberObject>()->ValueOf());
     Local<v8::Value> a4 =
-        ReturnThisSloppy->CallAsFunction(v8_str("hello"), 0, NULL);
+        ReturnThisSloppy->CallAsFunction(context.local(), v8_str("hello"), 0,
+                                         NULL)
+            .ToLocalChecked();
     CHECK(a4->IsStringObject());
     CHECK(a4.As<v8::StringObject>()->ValueOf()->StrictEquals(v8_str("hello")));
     Local<v8::Value> a5 =
-        ReturnThisSloppy->CallAsFunction(v8::True(isolate), 0, NULL);
+        ReturnThisSloppy->CallAsFunction(context.local(), v8::True(isolate), 0,
+                                         NULL)
+            .ToLocalChecked();
     CHECK(a5->IsBooleanObject());
     CHECK(a5.As<v8::BooleanObject>()->ValueOf());
 
     Local<v8::Value> a6 =
-        ReturnThisStrict->CallAsFunction(v8::Undefined(isolate), 0, NULL);
+        ReturnThisStrict->CallAsFunction(context.local(),
+                                         v8::Undefined(isolate), 0, NULL)
+            .ToLocalChecked();
     CHECK(a6->IsUndefined());
     Local<v8::Value> a7 =
-        ReturnThisStrict->CallAsFunction(v8::Null(isolate), 0, NULL);
+        ReturnThisStrict->CallAsFunction(context.local(), v8::Null(isolate), 0,
+                                         NULL)
+            .ToLocalChecked();
     CHECK(a7->IsNull());
     Local<v8::Value> a8 =
-        ReturnThisStrict->CallAsFunction(v8_num(42), 0, NULL);
+        ReturnThisStrict->CallAsFunction(context.local(), v8_num(42), 0, NULL)
+            .ToLocalChecked();
     CHECK(a8->StrictEquals(v8_num(42)));
     Local<v8::Value> a9 =
-        ReturnThisStrict->CallAsFunction(v8_str("hello"), 0, NULL);
+        ReturnThisStrict->CallAsFunction(context.local(), v8_str("hello"), 0,
+                                         NULL)
+            .ToLocalChecked();
     CHECK(a9->StrictEquals(v8_str("hello")));
     Local<v8::Value> a10 =
-        ReturnThisStrict->CallAsFunction(v8::True(isolate), 0, NULL);
+        ReturnThisStrict->CallAsFunction(context.local(), v8::True(isolate), 0,
+                                         NULL)
+            .ToLocalChecked();
     CHECK(a10->StrictEquals(v8::True(isolate)));
   }
 }
@@ -11912,37 +11708,45 @@
   v8::Isolate* isolate = context->GetIsolate();
   v8::HandleScope scope(isolate);
 
-  { Local<ObjectTemplate> instance_template = ObjectTemplate::New(isolate);
+  {
+    Local<ObjectTemplate> instance_template = ObjectTemplate::New(isolate);
     instance_template->SetCallAsFunctionHandler(call_as_function);
-    Local<Object> instance = instance_template->NewInstance();
-    v8::TryCatch try_catch;
+    Local<Object> instance =
+        instance_template->NewInstance(context.local()).ToLocalChecked();
+    v8::TryCatch try_catch(isolate);
 
     CHECK(instance->IsCallable());
     CHECK(!try_catch.HasCaught());
   }
 
-  { Local<ObjectTemplate> instance_template = ObjectTemplate::New(isolate);
-    Local<Object> instance = instance_template->NewInstance();
-    v8::TryCatch try_catch;
+  {
+    Local<ObjectTemplate> instance_template = ObjectTemplate::New(isolate);
+    Local<Object> instance =
+        instance_template->NewInstance(context.local()).ToLocalChecked();
+    v8::TryCatch try_catch(isolate);
 
     CHECK(!instance->IsCallable());
     CHECK(!try_catch.HasCaught());
   }
 
-  { Local<FunctionTemplate> function_template =
+  {
+    Local<FunctionTemplate> function_template =
         FunctionTemplate::New(isolate, call_as_function);
-    Local<Function> function = function_template->GetFunction();
+    Local<Function> function =
+        function_template->GetFunction(context.local()).ToLocalChecked();
     Local<Object> instance = function;
-    v8::TryCatch try_catch;
+    v8::TryCatch try_catch(isolate);
 
     CHECK(instance->IsCallable());
     CHECK(!try_catch.HasCaught());
   }
 
-  { Local<FunctionTemplate> function_template = FunctionTemplate::New(isolate);
-    Local<Function> function = function_template->GetFunction();
+  {
+    Local<FunctionTemplate> function_template = FunctionTemplate::New(isolate);
+    Local<Function> function =
+        function_template->GetFunction(context.local()).ToLocalChecked();
     Local<Object> instance = function;
-    v8::TryCatch try_catch;
+    v8::TryCatch try_catch(isolate);
 
     CHECK(instance->IsCallable());
     CHECK(!try_catch.HasCaught());
@@ -11950,6 +11754,54 @@
 }
 
 
+THREADED_TEST(Regress567998) {
+  LocalContext env;
+  v8::HandleScope scope(env->GetIsolate());
+
+  Local<v8::FunctionTemplate> desc =
+      v8::FunctionTemplate::New(env->GetIsolate());
+  desc->InstanceTemplate()->MarkAsUndetectable();  // undetectable
+  desc->InstanceTemplate()->SetCallAsFunctionHandler(ReturnThis);  // callable
+
+  Local<v8::Object> obj = desc->GetFunction(env.local())
+                              .ToLocalChecked()
+                              ->NewInstance(env.local())
+                              .ToLocalChecked();
+  CHECK(
+      env->Global()->Set(env.local(), v8_str("undetectable"), obj).FromJust());
+
+  ExpectString("undetectable.toString()", "[object Object]");
+  ExpectString("typeof undetectable", "undefined");
+  ExpectString("typeof(undetectable)", "undefined");
+  ExpectBoolean("typeof undetectable == 'undefined'", true);
+  ExpectBoolean("typeof undetectable == 'object'", false);
+  ExpectBoolean("if (undetectable) { true; } else { false; }", false);
+  ExpectBoolean("!undetectable", true);
+
+  ExpectObject("true&&undetectable", obj);
+  ExpectBoolean("false&&undetectable", false);
+  ExpectBoolean("true||undetectable", true);
+  ExpectObject("false||undetectable", obj);
+
+  ExpectObject("undetectable&&true", obj);
+  ExpectObject("undetectable&&false", obj);
+  ExpectBoolean("undetectable||true", true);
+  ExpectBoolean("undetectable||false", false);
+
+  ExpectBoolean("undetectable==null", true);
+  ExpectBoolean("null==undetectable", true);
+  ExpectBoolean("undetectable==undefined", true);
+  ExpectBoolean("undefined==undetectable", true);
+  ExpectBoolean("undetectable==undetectable", true);
+
+  ExpectBoolean("undetectable===null", false);
+  ExpectBoolean("null===undetectable", false);
+  ExpectBoolean("undetectable===undefined", false);
+  ExpectBoolean("undefined===undetectable", false);
+  ExpectBoolean("undetectable===undetectable", true);
+}
+
+
 static int Recurse(v8::Isolate* isolate, int depth, int iterations) {
   v8::HandleScope scope(isolate);
   if (depth == 0) return v8::HandleScope::NumberOfHandles(isolate);
@@ -11991,834 +11843,6 @@
 }
 
 
-static void InterceptorHasOwnPropertyGetter(
-    Local<Name> name, const v8::PropertyCallbackInfo<v8::Value>& info) {
-  ApiTestFuzzer::Fuzz();
-}
-
-
-THREADED_TEST(InterceptorHasOwnProperty) {
-  LocalContext context;
-  v8::Isolate* isolate = context->GetIsolate();
-  v8::HandleScope scope(isolate);
-  Local<v8::FunctionTemplate> fun_templ = v8::FunctionTemplate::New(isolate);
-  Local<v8::ObjectTemplate> instance_templ = fun_templ->InstanceTemplate();
-  instance_templ->SetHandler(
-      v8::NamedPropertyHandlerConfiguration(InterceptorHasOwnPropertyGetter));
-  Local<Function> function = fun_templ->GetFunction();
-  context->Global()->Set(v8_str("constructor"), function);
-  v8::Handle<Value> value = CompileRun(
-      "var o = new constructor();"
-      "o.hasOwnProperty('ostehaps');");
-  CHECK_EQ(false, value->BooleanValue());
-  value = CompileRun(
-      "o.ostehaps = 42;"
-      "o.hasOwnProperty('ostehaps');");
-  CHECK_EQ(true, value->BooleanValue());
-  value = CompileRun(
-      "var p = new constructor();"
-      "p.hasOwnProperty('ostehaps');");
-  CHECK_EQ(false, value->BooleanValue());
-}
-
-
-static void InterceptorHasOwnPropertyGetterGC(
-    Local<Name> name, const v8::PropertyCallbackInfo<v8::Value>& info) {
-  ApiTestFuzzer::Fuzz();
-  CcTest::heap()->CollectAllGarbage(i::Heap::kNoGCFlags);
-}
-
-
-THREADED_TEST(InterceptorHasOwnPropertyCausingGC) {
-  LocalContext context;
-  v8::Isolate* isolate = context->GetIsolate();
-  v8::HandleScope scope(isolate);
-  Local<v8::FunctionTemplate> fun_templ = v8::FunctionTemplate::New(isolate);
-  Local<v8::ObjectTemplate> instance_templ = fun_templ->InstanceTemplate();
-  instance_templ->SetHandler(
-      v8::NamedPropertyHandlerConfiguration(InterceptorHasOwnPropertyGetterGC));
-  Local<Function> function = fun_templ->GetFunction();
-  context->Global()->Set(v8_str("constructor"), function);
-  // Let's first make some stuff so we can be sure to get a good GC.
-  CompileRun(
-      "function makestr(size) {"
-      "  switch (size) {"
-      "    case 1: return 'f';"
-      "    case 2: return 'fo';"
-      "    case 3: return 'foo';"
-      "  }"
-      "  return makestr(size >> 1) + makestr((size + 1) >> 1);"
-      "}"
-      "var x = makestr(12345);"
-      "x = makestr(31415);"
-      "x = makestr(23456);");
-  v8::Handle<Value> value = CompileRun(
-      "var o = new constructor();"
-      "o.__proto__ = new String(x);"
-      "o.hasOwnProperty('ostehaps');");
-  CHECK_EQ(false, value->BooleanValue());
-}
-
-
-static void CheckInterceptorLoadIC(
-    v8::GenericNamedPropertyGetterCallback getter, const char* source,
-    int expected) {
-  v8::Isolate* isolate = CcTest::isolate();
-  v8::HandleScope scope(isolate);
-  v8::Handle<v8::ObjectTemplate> templ = ObjectTemplate::New(isolate);
-  templ->SetHandler(v8::NamedPropertyHandlerConfiguration(getter, 0, 0, 0, 0,
-                                                          v8_str("data")));
-  LocalContext context;
-  context->Global()->Set(v8_str("o"), templ->NewInstance());
-  v8::Handle<Value> value = CompileRun(source);
-  CHECK_EQ(expected, value->Int32Value());
-}
-
-
-static void InterceptorLoadICGetter(
-    Local<Name> name, const v8::PropertyCallbackInfo<v8::Value>& info) {
-  ApiTestFuzzer::Fuzz();
-  v8::Isolate* isolate = CcTest::isolate();
-  CHECK_EQ(isolate, info.GetIsolate());
-  CHECK_EQ(v8_str("data"), info.Data());
-  CHECK_EQ(v8_str("x"), name);
-  info.GetReturnValue().Set(v8::Integer::New(isolate, 42));
-}
-
-
-// This test should hit the load IC for the interceptor case.
-THREADED_TEST(InterceptorLoadIC) {
-  CheckInterceptorLoadIC(InterceptorLoadICGetter,
-    "var result = 0;"
-    "for (var i = 0; i < 1000; i++) {"
-    "  result = o.x;"
-    "}",
-    42);
-}
-
-
-// Below go several tests which verify that JITing for various
-// configurations of interceptor and explicit fields works fine
-// (those cases are special cased to get better performance).
-
-static void InterceptorLoadXICGetter(
-    Local<Name> name, const v8::PropertyCallbackInfo<v8::Value>& info) {
-  ApiTestFuzzer::Fuzz();
-  info.GetReturnValue().Set(
-      v8_str("x")->Equals(name) ?
-          v8::Handle<v8::Value>(v8::Integer::New(info.GetIsolate(), 42)) :
-          v8::Handle<v8::Value>());
-}
-
-
-THREADED_TEST(InterceptorLoadICWithFieldOnHolder) {
-  CheckInterceptorLoadIC(InterceptorLoadXICGetter,
-    "var result = 0;"
-    "o.y = 239;"
-    "for (var i = 0; i < 1000; i++) {"
-    "  result = o.y;"
-    "}",
-    239);
-}
-
-
-THREADED_TEST(InterceptorLoadICWithSubstitutedProto) {
-  CheckInterceptorLoadIC(InterceptorLoadXICGetter,
-    "var result = 0;"
-    "o.__proto__ = { 'y': 239 };"
-    "for (var i = 0; i < 1000; i++) {"
-    "  result = o.y + o.x;"
-    "}",
-    239 + 42);
-}
-
-
-THREADED_TEST(InterceptorLoadICWithPropertyOnProto) {
-  CheckInterceptorLoadIC(InterceptorLoadXICGetter,
-    "var result = 0;"
-    "o.__proto__.y = 239;"
-    "for (var i = 0; i < 1000; i++) {"
-    "  result = o.y + o.x;"
-    "}",
-    239 + 42);
-}
-
-
-THREADED_TEST(InterceptorLoadICUndefined) {
-  CheckInterceptorLoadIC(InterceptorLoadXICGetter,
-    "var result = 0;"
-    "for (var i = 0; i < 1000; i++) {"
-    "  result = (o.y == undefined) ? 239 : 42;"
-    "}",
-    239);
-}
-
-
-THREADED_TEST(InterceptorLoadICWithOverride) {
-  CheckInterceptorLoadIC(InterceptorLoadXICGetter,
-    "fst = new Object();  fst.__proto__ = o;"
-    "snd = new Object();  snd.__proto__ = fst;"
-    "var result1 = 0;"
-    "for (var i = 0; i < 1000;  i++) {"
-    "  result1 = snd.x;"
-    "}"
-    "fst.x = 239;"
-    "var result = 0;"
-    "for (var i = 0; i < 1000; i++) {"
-    "  result = snd.x;"
-    "}"
-    "result + result1",
-    239 + 42);
-}
-
-
-// Test the case when we stored field into
-// a stub, but interceptor produced value on its own.
-THREADED_TEST(InterceptorLoadICFieldNotNeeded) {
-  CheckInterceptorLoadIC(InterceptorLoadXICGetter,
-    "proto = new Object();"
-    "o.__proto__ = proto;"
-    "proto.x = 239;"
-    "for (var i = 0; i < 1000; i++) {"
-    "  o.x;"
-    // Now it should be ICed and keep a reference to x defined on proto
-    "}"
-    "var result = 0;"
-    "for (var i = 0; i < 1000; i++) {"
-    "  result += o.x;"
-    "}"
-    "result;",
-    42 * 1000);
-}
-
-
-// Test the case when we stored field into
-// a stub, but it got invalidated later on.
-THREADED_TEST(InterceptorLoadICInvalidatedField) {
-  CheckInterceptorLoadIC(InterceptorLoadXICGetter,
-    "proto1 = new Object();"
-    "proto2 = new Object();"
-    "o.__proto__ = proto1;"
-    "proto1.__proto__ = proto2;"
-    "proto2.y = 239;"
-    "for (var i = 0; i < 1000; i++) {"
-    "  o.y;"
-    // Now it should be ICed and keep a reference to y defined on proto2
-    "}"
-    "proto1.y = 42;"
-    "var result = 0;"
-    "for (var i = 0; i < 1000; i++) {"
-    "  result += o.y;"
-    "}"
-    "result;",
-    42 * 1000);
-}
-
-
-static int interceptor_load_not_handled_calls = 0;
-static void InterceptorLoadNotHandled(
-    Local<Name> name, const v8::PropertyCallbackInfo<v8::Value>& info) {
-  ++interceptor_load_not_handled_calls;
-}
-
-
-// Test how post-interceptor lookups are done in the non-cacheable
-// case: the interceptor should not be invoked during this lookup.
-THREADED_TEST(InterceptorLoadICPostInterceptor) {
-  interceptor_load_not_handled_calls = 0;
-  CheckInterceptorLoadIC(InterceptorLoadNotHandled,
-    "receiver = new Object();"
-    "receiver.__proto__ = o;"
-    "proto = new Object();"
-    "/* Make proto a slow-case object. */"
-    "for (var i = 0; i < 1000; i++) {"
-    "  proto[\"xxxxxxxx\" + i] = [];"
-    "}"
-    "proto.x = 17;"
-    "o.__proto__ = proto;"
-    "var result = 0;"
-    "for (var i = 0; i < 1000; i++) {"
-    "  result += receiver.x;"
-    "}"
-    "result;",
-    17 * 1000);
-  CHECK_EQ(1000, interceptor_load_not_handled_calls);
-}
-
-
-// Test the case when we stored field into
-// a stub, but it got invalidated later on due to override on
-// global object which is between interceptor and fields' holders.
-THREADED_TEST(InterceptorLoadICInvalidatedFieldViaGlobal) {
-  CheckInterceptorLoadIC(InterceptorLoadXICGetter,
-    "o.__proto__ = this;"  // set a global to be a proto of o.
-    "this.__proto__.y = 239;"
-    "for (var i = 0; i < 10; i++) {"
-    "  if (o.y != 239) throw 'oops: ' + o.y;"
-    // Now it should be ICed and keep a reference to y defined on field_holder.
-    "}"
-    "this.y = 42;"  // Assign on a global.
-    "var result = 0;"
-    "for (var i = 0; i < 10; i++) {"
-    "  result += o.y;"
-    "}"
-    "result;",
-    42 * 10);
-}
-
-
-static void SetOnThis(Local<String> name,
-                      Local<Value> value,
-                      const v8::PropertyCallbackInfo<void>& info) {
-  Local<Object>::Cast(info.This())->ForceSet(name, value);
-}
-
-
-THREADED_TEST(InterceptorLoadICWithCallbackOnHolder) {
-  v8::Isolate* isolate = CcTest::isolate();
-  v8::HandleScope scope(isolate);
-  v8::Handle<v8::ObjectTemplate> templ = ObjectTemplate::New(isolate);
-  templ->SetHandler(
-      v8::NamedPropertyHandlerConfiguration(InterceptorLoadXICGetter));
-  templ->SetAccessor(v8_str("y"), Return239Callback);
-  LocalContext context;
-  context->Global()->Set(v8_str("o"), templ->NewInstance());
-
-  // Check the case when receiver and interceptor's holder
-  // are the same objects.
-  v8::Handle<Value> value = CompileRun(
-      "var result = 0;"
-      "for (var i = 0; i < 7; i++) {"
-      "  result = o.y;"
-      "}");
-  CHECK_EQ(239, value->Int32Value());
-
-  // Check the case when interceptor's holder is in proto chain
-  // of receiver.
-  value = CompileRun(
-      "r = { __proto__: o };"
-      "var result = 0;"
-      "for (var i = 0; i < 7; i++) {"
-      "  result = r.y;"
-      "}");
-  CHECK_EQ(239, value->Int32Value());
-}
-
-
-THREADED_TEST(InterceptorLoadICWithCallbackOnProto) {
-  v8::Isolate* isolate = CcTest::isolate();
-  v8::HandleScope scope(isolate);
-  v8::Handle<v8::ObjectTemplate> templ_o = ObjectTemplate::New(isolate);
-  templ_o->SetHandler(
-      v8::NamedPropertyHandlerConfiguration(InterceptorLoadXICGetter));
-  v8::Handle<v8::ObjectTemplate> templ_p = ObjectTemplate::New(isolate);
-  templ_p->SetAccessor(v8_str("y"), Return239Callback);
-
-  LocalContext context;
-  context->Global()->Set(v8_str("o"), templ_o->NewInstance());
-  context->Global()->Set(v8_str("p"), templ_p->NewInstance());
-
-  // Check the case when receiver and interceptor's holder
-  // are the same objects.
-  v8::Handle<Value> value = CompileRun(
-      "o.__proto__ = p;"
-      "var result = 0;"
-      "for (var i = 0; i < 7; i++) {"
-      "  result = o.x + o.y;"
-      "}");
-  CHECK_EQ(239 + 42, value->Int32Value());
-
-  // Check the case when interceptor's holder is in proto chain
-  // of receiver.
-  value = CompileRun(
-      "r = { __proto__: o };"
-      "var result = 0;"
-      "for (var i = 0; i < 7; i++) {"
-      "  result = r.x + r.y;"
-      "}");
-  CHECK_EQ(239 + 42, value->Int32Value());
-}
-
-
-THREADED_TEST(InterceptorLoadICForCallbackWithOverride) {
-  v8::Isolate* isolate = CcTest::isolate();
-  v8::HandleScope scope(isolate);
-  v8::Handle<v8::ObjectTemplate> templ = ObjectTemplate::New(isolate);
-  templ->SetHandler(
-      v8::NamedPropertyHandlerConfiguration(InterceptorLoadXICGetter));
-  templ->SetAccessor(v8_str("y"), Return239Callback);
-
-  LocalContext context;
-  context->Global()->Set(v8_str("o"), templ->NewInstance());
-
-  v8::Handle<Value> value = CompileRun(
-    "fst = new Object();  fst.__proto__ = o;"
-    "snd = new Object();  snd.__proto__ = fst;"
-    "var result1 = 0;"
-    "for (var i = 0; i < 7;  i++) {"
-    "  result1 = snd.x;"
-    "}"
-    "fst.x = 239;"
-    "var result = 0;"
-    "for (var i = 0; i < 7; i++) {"
-    "  result = snd.x;"
-    "}"
-    "result + result1");
-  CHECK_EQ(239 + 42, value->Int32Value());
-}
-
-
-// Test the case when we stored callback into
-// a stub, but interceptor produced value on its own.
-THREADED_TEST(InterceptorLoadICCallbackNotNeeded) {
-  v8::Isolate* isolate = CcTest::isolate();
-  v8::HandleScope scope(isolate);
-  v8::Handle<v8::ObjectTemplate> templ_o = ObjectTemplate::New(isolate);
-  templ_o->SetHandler(
-      v8::NamedPropertyHandlerConfiguration(InterceptorLoadXICGetter));
-  v8::Handle<v8::ObjectTemplate> templ_p = ObjectTemplate::New(isolate);
-  templ_p->SetAccessor(v8_str("y"), Return239Callback);
-
-  LocalContext context;
-  context->Global()->Set(v8_str("o"), templ_o->NewInstance());
-  context->Global()->Set(v8_str("p"), templ_p->NewInstance());
-
-  v8::Handle<Value> value = CompileRun(
-    "o.__proto__ = p;"
-    "for (var i = 0; i < 7; i++) {"
-    "  o.x;"
-    // Now it should be ICed and keep a reference to x defined on p
-    "}"
-    "var result = 0;"
-    "for (var i = 0; i < 7; i++) {"
-    "  result += o.x;"
-    "}"
-    "result");
-  CHECK_EQ(42 * 7, value->Int32Value());
-}
-
-
-// Test the case when we stored callback into
-// a stub, but it got invalidated later on.
-THREADED_TEST(InterceptorLoadICInvalidatedCallback) {
-  v8::Isolate* isolate = CcTest::isolate();
-  v8::HandleScope scope(isolate);
-  v8::Handle<v8::ObjectTemplate> templ_o = ObjectTemplate::New(isolate);
-  templ_o->SetHandler(
-      v8::NamedPropertyHandlerConfiguration(InterceptorLoadXICGetter));
-  v8::Handle<v8::ObjectTemplate> templ_p = ObjectTemplate::New(isolate);
-  templ_p->SetAccessor(v8_str("y"), Return239Callback, SetOnThis);
-
-  LocalContext context;
-  context->Global()->Set(v8_str("o"), templ_o->NewInstance());
-  context->Global()->Set(v8_str("p"), templ_p->NewInstance());
-
-  v8::Handle<Value> value = CompileRun(
-    "inbetween = new Object();"
-    "o.__proto__ = inbetween;"
-    "inbetween.__proto__ = p;"
-    "for (var i = 0; i < 10; i++) {"
-    "  o.y;"
-    // Now it should be ICed and keep a reference to y defined on p
-    "}"
-    "inbetween.y = 42;"
-    "var result = 0;"
-    "for (var i = 0; i < 10; i++) {"
-    "  result += o.y;"
-    "}"
-    "result");
-  CHECK_EQ(42 * 10, value->Int32Value());
-}
-
-
-// Test the case when we stored callback into
-// a stub, but it got invalidated later on due to override on
-// global object which is between interceptor and callbacks' holders.
-THREADED_TEST(InterceptorLoadICInvalidatedCallbackViaGlobal) {
-  v8::Isolate* isolate = CcTest::isolate();
-  v8::HandleScope scope(isolate);
-  v8::Handle<v8::ObjectTemplate> templ_o = ObjectTemplate::New(isolate);
-  templ_o->SetHandler(
-      v8::NamedPropertyHandlerConfiguration(InterceptorLoadXICGetter));
-  v8::Handle<v8::ObjectTemplate> templ_p = ObjectTemplate::New(isolate);
-  templ_p->SetAccessor(v8_str("y"), Return239Callback, SetOnThis);
-
-  LocalContext context;
-  context->Global()->Set(v8_str("o"), templ_o->NewInstance());
-  context->Global()->Set(v8_str("p"), templ_p->NewInstance());
-
-  v8::Handle<Value> value = CompileRun(
-    "o.__proto__ = this;"
-    "this.__proto__ = p;"
-    "for (var i = 0; i < 10; i++) {"
-    "  if (o.y != 239) throw 'oops: ' + o.y;"
-    // Now it should be ICed and keep a reference to y defined on p
-    "}"
-    "this.y = 42;"
-    "var result = 0;"
-    "for (var i = 0; i < 10; i++) {"
-    "  result += o.y;"
-    "}"
-    "result");
-  CHECK_EQ(42 * 10, value->Int32Value());
-}
-
-
-static void InterceptorLoadICGetter0(
-    Local<Name> name, const v8::PropertyCallbackInfo<v8::Value>& info) {
-  ApiTestFuzzer::Fuzz();
-  CHECK(v8_str("x")->Equals(name));
-  info.GetReturnValue().Set(v8::Integer::New(info.GetIsolate(), 0));
-}
-
-
-THREADED_TEST(InterceptorReturningZero) {
-  CheckInterceptorLoadIC(InterceptorLoadICGetter0,
-     "o.x == undefined ? 1 : 0",
-     0);
-}
-
-
-static void InterceptorStoreICSetter(
-    Local<Name> key, Local<Value> value,
-    const v8::PropertyCallbackInfo<v8::Value>& info) {
-  CHECK(v8_str("x")->Equals(key));
-  CHECK_EQ(42, value->Int32Value());
-  info.GetReturnValue().Set(value);
-}
-
-
-// This test should hit the store IC for the interceptor case.
-THREADED_TEST(InterceptorStoreIC) {
-  v8::Isolate* isolate = CcTest::isolate();
-  v8::HandleScope scope(isolate);
-  v8::Handle<v8::ObjectTemplate> templ = ObjectTemplate::New(isolate);
-  templ->SetHandler(v8::NamedPropertyHandlerConfiguration(
-      InterceptorLoadICGetter, InterceptorStoreICSetter, 0, 0, 0,
-      v8_str("data")));
-  LocalContext context;
-  context->Global()->Set(v8_str("o"), templ->NewInstance());
-  CompileRun(
-      "for (var i = 0; i < 1000; i++) {"
-      "  o.x = 42;"
-      "}");
-}
-
-
-THREADED_TEST(InterceptorStoreICWithNoSetter) {
-  v8::Isolate* isolate = CcTest::isolate();
-  v8::HandleScope scope(isolate);
-  v8::Handle<v8::ObjectTemplate> templ = ObjectTemplate::New(isolate);
-  templ->SetHandler(
-      v8::NamedPropertyHandlerConfiguration(InterceptorLoadXICGetter));
-  LocalContext context;
-  context->Global()->Set(v8_str("o"), templ->NewInstance());
-  v8::Handle<Value> value = CompileRun(
-    "for (var i = 0; i < 1000; i++) {"
-    "  o.y = 239;"
-    "}"
-    "42 + o.y");
-  CHECK_EQ(239 + 42, value->Int32Value());
-}
-
-
-
-
-v8::Handle<Value> call_ic_function;
-v8::Handle<Value> call_ic_function2;
-v8::Handle<Value> call_ic_function3;
-
-static void InterceptorCallICGetter(
-    Local<Name> name, const v8::PropertyCallbackInfo<v8::Value>& info) {
-  ApiTestFuzzer::Fuzz();
-  CHECK(v8_str("x")->Equals(name));
-  info.GetReturnValue().Set(call_ic_function);
-}
-
-
-// This test should hit the call IC for the interceptor case.
-THREADED_TEST(InterceptorCallIC) {
-  v8::Isolate* isolate = CcTest::isolate();
-  v8::HandleScope scope(isolate);
-  v8::Handle<v8::ObjectTemplate> templ = ObjectTemplate::New(isolate);
-  templ->SetHandler(
-      v8::NamedPropertyHandlerConfiguration(InterceptorCallICGetter));
-  LocalContext context;
-  context->Global()->Set(v8_str("o"), templ->NewInstance());
-  call_ic_function =
-      v8_compile("function f(x) { return x + 1; }; f")->Run();
-  v8::Handle<Value> value = CompileRun(
-    "var result = 0;"
-    "for (var i = 0; i < 1000; i++) {"
-    "  result = o.x(41);"
-    "}");
-  CHECK_EQ(42, value->Int32Value());
-}
-
-
-// This test checks that if interceptor doesn't provide
-// a value, we can fetch regular value.
-THREADED_TEST(InterceptorCallICSeesOthers) {
-  v8::Isolate* isolate = CcTest::isolate();
-  v8::HandleScope scope(isolate);
-  v8::Handle<v8::ObjectTemplate> templ = ObjectTemplate::New(isolate);
-  templ->SetHandler(v8::NamedPropertyHandlerConfiguration(NoBlockGetterX));
-  LocalContext context;
-  context->Global()->Set(v8_str("o"), templ->NewInstance());
-  v8::Handle<Value> value = CompileRun(
-    "o.x = function f(x) { return x + 1; };"
-    "var result = 0;"
-    "for (var i = 0; i < 7; i++) {"
-    "  result = o.x(41);"
-    "}");
-  CHECK_EQ(42, value->Int32Value());
-}
-
-
-static v8::Handle<Value> call_ic_function4;
-static void InterceptorCallICGetter4(
-    Local<Name> name, const v8::PropertyCallbackInfo<v8::Value>& info) {
-  ApiTestFuzzer::Fuzz();
-  CHECK(v8_str("x")->Equals(name));
-  info.GetReturnValue().Set(call_ic_function4);
-}
-
-
-// This test checks that if interceptor provides a function,
-// even if we cached shadowed variant, interceptor's function
-// is invoked
-THREADED_TEST(InterceptorCallICCacheableNotNeeded) {
-  v8::Isolate* isolate = CcTest::isolate();
-  v8::HandleScope scope(isolate);
-  v8::Handle<v8::ObjectTemplate> templ = ObjectTemplate::New(isolate);
-  templ->SetHandler(
-      v8::NamedPropertyHandlerConfiguration(InterceptorCallICGetter4));
-  LocalContext context;
-  context->Global()->Set(v8_str("o"), templ->NewInstance());
-  call_ic_function4 =
-      v8_compile("function f(x) { return x - 1; }; f")->Run();
-  v8::Handle<Value> value = CompileRun(
-    "Object.getPrototypeOf(o).x = function(x) { return x + 1; };"
-    "var result = 0;"
-    "for (var i = 0; i < 1000; i++) {"
-    "  result = o.x(42);"
-    "}");
-  CHECK_EQ(41, value->Int32Value());
-}
-
-
-// Test the case when we stored cacheable lookup into
-// a stub, but it got invalidated later on
-THREADED_TEST(InterceptorCallICInvalidatedCacheable) {
-  v8::Isolate* isolate = CcTest::isolate();
-  v8::HandleScope scope(isolate);
-  v8::Handle<v8::ObjectTemplate> templ = ObjectTemplate::New(isolate);
-  templ->SetHandler(v8::NamedPropertyHandlerConfiguration(NoBlockGetterX));
-  LocalContext context;
-  context->Global()->Set(v8_str("o"), templ->NewInstance());
-  v8::Handle<Value> value = CompileRun(
-    "proto1 = new Object();"
-    "proto2 = new Object();"
-    "o.__proto__ = proto1;"
-    "proto1.__proto__ = proto2;"
-    "proto2.y = function(x) { return x + 1; };"
-    // Invoke it many times to compile a stub
-    "for (var i = 0; i < 7; i++) {"
-    "  o.y(42);"
-    "}"
-    "proto1.y = function(x) { return x - 1; };"
-    "var result = 0;"
-    "for (var i = 0; i < 7; i++) {"
-    "  result += o.y(42);"
-    "}");
-  CHECK_EQ(41 * 7, value->Int32Value());
-}
-
-
-// This test checks that if interceptor doesn't provide a function,
-// cached constant function is used
-THREADED_TEST(InterceptorCallICConstantFunctionUsed) {
-  v8::Isolate* isolate = CcTest::isolate();
-  v8::HandleScope scope(isolate);
-  v8::Handle<v8::ObjectTemplate> templ = ObjectTemplate::New(isolate);
-  templ->SetHandler(v8::NamedPropertyHandlerConfiguration(NoBlockGetterX));
-  LocalContext context;
-  context->Global()->Set(v8_str("o"), templ->NewInstance());
-  v8::Handle<Value> value = CompileRun(
-    "function inc(x) { return x + 1; };"
-    "inc(1);"
-    "o.x = inc;"
-    "var result = 0;"
-    "for (var i = 0; i < 1000; i++) {"
-    "  result = o.x(42);"
-    "}");
-  CHECK_EQ(43, value->Int32Value());
-}
-
-
-static v8::Handle<Value> call_ic_function5;
-static void InterceptorCallICGetter5(
-    Local<Name> name, const v8::PropertyCallbackInfo<v8::Value>& info) {
-  ApiTestFuzzer::Fuzz();
-  if (v8_str("x")->Equals(name))
-    info.GetReturnValue().Set(call_ic_function5);
-}
-
-
-// This test checks that if interceptor provides a function,
-// even if we cached constant function, interceptor's function
-// is invoked
-THREADED_TEST(InterceptorCallICConstantFunctionNotNeeded) {
-  v8::Isolate* isolate = CcTest::isolate();
-  v8::HandleScope scope(isolate);
-  v8::Handle<v8::ObjectTemplate> templ = ObjectTemplate::New(isolate);
-  templ->SetHandler(
-      v8::NamedPropertyHandlerConfiguration(InterceptorCallICGetter5));
-  LocalContext context;
-  context->Global()->Set(v8_str("o"), templ->NewInstance());
-  call_ic_function5 =
-      v8_compile("function f(x) { return x - 1; }; f")->Run();
-  v8::Handle<Value> value = CompileRun(
-    "function inc(x) { return x + 1; };"
-    "inc(1);"
-    "o.x = inc;"
-    "var result = 0;"
-    "for (var i = 0; i < 1000; i++) {"
-    "  result = o.x(42);"
-    "}");
-  CHECK_EQ(41, value->Int32Value());
-}
-
-
-static v8::Handle<Value> call_ic_function6;
-static void InterceptorCallICGetter6(
-    Local<Name> name, const v8::PropertyCallbackInfo<v8::Value>& info) {
-  ApiTestFuzzer::Fuzz();
-  if (v8_str("x")->Equals(name))
-    info.GetReturnValue().Set(call_ic_function6);
-}
-
-
-// Same test as above, except the code is wrapped in a function
-// to test the optimized compiler.
-THREADED_TEST(InterceptorCallICConstantFunctionNotNeededWrapped) {
-  i::FLAG_allow_natives_syntax = true;
-  v8::Isolate* isolate = CcTest::isolate();
-  v8::HandleScope scope(isolate);
-  v8::Handle<v8::ObjectTemplate> templ = ObjectTemplate::New(isolate);
-  templ->SetHandler(
-      v8::NamedPropertyHandlerConfiguration(InterceptorCallICGetter6));
-  LocalContext context;
-  context->Global()->Set(v8_str("o"), templ->NewInstance());
-  call_ic_function6 =
-      v8_compile("function f(x) { return x - 1; }; f")->Run();
-  v8::Handle<Value> value = CompileRun(
-    "function inc(x) { return x + 1; };"
-    "inc(1);"
-    "o.x = inc;"
-    "function test() {"
-    "  var result = 0;"
-    "  for (var i = 0; i < 1000; i++) {"
-    "    result = o.x(42);"
-    "  }"
-    "  return result;"
-    "};"
-    "test();"
-    "test();"
-    "test();"
-    "%OptimizeFunctionOnNextCall(test);"
-    "test()");
-  CHECK_EQ(41, value->Int32Value());
-}
-
-
-// Test the case when we stored constant function into
-// a stub, but it got invalidated later on
-THREADED_TEST(InterceptorCallICInvalidatedConstantFunction) {
-  v8::Isolate* isolate = CcTest::isolate();
-  v8::HandleScope scope(isolate);
-  v8::Handle<v8::ObjectTemplate> templ = ObjectTemplate::New(isolate);
-  templ->SetHandler(v8::NamedPropertyHandlerConfiguration(NoBlockGetterX));
-  LocalContext context;
-  context->Global()->Set(v8_str("o"), templ->NewInstance());
-  v8::Handle<Value> value = CompileRun(
-    "function inc(x) { return x + 1; };"
-    "inc(1);"
-    "proto1 = new Object();"
-    "proto2 = new Object();"
-    "o.__proto__ = proto1;"
-    "proto1.__proto__ = proto2;"
-    "proto2.y = inc;"
-    // Invoke it many times to compile a stub
-    "for (var i = 0; i < 7; i++) {"
-    "  o.y(42);"
-    "}"
-    "proto1.y = function(x) { return x - 1; };"
-    "var result = 0;"
-    "for (var i = 0; i < 7; i++) {"
-    "  result += o.y(42);"
-    "}");
-  CHECK_EQ(41 * 7, value->Int32Value());
-}
-
-
-// Test the case when we stored constant function into
-// a stub, but it got invalidated later on due to override on
-// global object which is between interceptor and constant function' holders.
-THREADED_TEST(InterceptorCallICInvalidatedConstantFunctionViaGlobal) {
-  v8::Isolate* isolate = CcTest::isolate();
-  v8::HandleScope scope(isolate);
-  v8::Handle<v8::ObjectTemplate> templ = ObjectTemplate::New(isolate);
-  templ->SetHandler(v8::NamedPropertyHandlerConfiguration(NoBlockGetterX));
-  LocalContext context;
-  context->Global()->Set(v8_str("o"), templ->NewInstance());
-  v8::Handle<Value> value = CompileRun(
-    "function inc(x) { return x + 1; };"
-    "inc(1);"
-    "o.__proto__ = this;"
-    "this.__proto__.y = inc;"
-    // Invoke it many times to compile a stub
-    "for (var i = 0; i < 7; i++) {"
-    "  if (o.y(42) != 43) throw 'oops: ' + o.y(42);"
-    "}"
-    "this.y = function(x) { return x - 1; };"
-    "var result = 0;"
-    "for (var i = 0; i < 7; i++) {"
-    "  result += o.y(42);"
-    "}");
-  CHECK_EQ(41 * 7, value->Int32Value());
-}
-
-
-// Test the case when actual function to call sits on global object.
-THREADED_TEST(InterceptorCallICCachedFromGlobal) {
-  v8::Isolate* isolate = CcTest::isolate();
-  v8::HandleScope scope(isolate);
-  v8::Handle<v8::ObjectTemplate> templ_o = ObjectTemplate::New(isolate);
-  templ_o->SetHandler(v8::NamedPropertyHandlerConfiguration(NoBlockGetterX));
-
-  LocalContext context;
-  context->Global()->Set(v8_str("o"), templ_o->NewInstance());
-
-  v8::Handle<Value> value = CompileRun(
-    "try {"
-    "  o.__proto__ = this;"
-    "  for (var i = 0; i < 10; i++) {"
-    "    var v = o.parseFloat('239');"
-    "    if (v != 239) throw v;"
-      // Now it should be ICed and keep a reference to parseFloat.
-    "  }"
-    "  var result = 0;"
-    "  for (var i = 0; i < 10; i++) {"
-    "    result += o.parseFloat('239');"
-    "  }"
-    "  result"
-    "} catch(e) {"
-    "  e"
-    "};");
-  CHECK_EQ(239 * 10, value->Int32Value());
-}
-
 static void InterceptorCallICFastApi(
     Local<Name> name, const v8::PropertyCallbackInfo<v8::Value>& info) {
   ApiTestFuzzer::Fuzz();
@@ -12827,7 +11851,7 @@
       reinterpret_cast<int*>(v8::External::Cast(*info.Data())->Value());
   ++(*call_count);
   if ((*call_count) % 20 == 0) {
-    CcTest::heap()->CollectAllGarbage(i::Heap::kNoGCFlags);
+    CcTest::heap()->CollectAllGarbage();
   }
 }
 
@@ -12837,9 +11861,14 @@
   CheckReturnValue(args, FUNCTION_ADDR(FastApiCallback_TrivialSignature));
   v8::Isolate* isolate = CcTest::isolate();
   CHECK_EQ(isolate, args.GetIsolate());
-  CHECK_EQ(args.This(), args.Holder());
-  CHECK(args.Data()->Equals(v8_str("method_data")));
-  args.GetReturnValue().Set(args[0]->Int32Value() + 1);
+  CHECK(args.This()
+            ->Equals(isolate->GetCurrentContext(), args.Holder())
+            .FromJust());
+  CHECK(args.Data()
+            ->Equals(isolate->GetCurrentContext(), v8_str("method_data"))
+            .FromJust());
+  args.GetReturnValue().Set(
+      args[0]->Int32Value(isolate->GetCurrentContext()).FromJust() + 1);
 }
 
 static void FastApiCallback_SimpleSignature(
@@ -12848,12 +11877,20 @@
   CheckReturnValue(args, FUNCTION_ADDR(FastApiCallback_SimpleSignature));
   v8::Isolate* isolate = CcTest::isolate();
   CHECK_EQ(isolate, args.GetIsolate());
-  CHECK_EQ(args.This()->GetPrototype(), args.Holder());
-  CHECK(args.Data()->Equals(v8_str("method_data")));
+  CHECK(args.This()
+            ->GetPrototype()
+            ->Equals(isolate->GetCurrentContext(), args.Holder())
+            .FromJust());
+  CHECK(args.Data()
+            ->Equals(isolate->GetCurrentContext(), v8_str("method_data"))
+            .FromJust());
   // Note, we're using HasRealNamedProperty instead of Has to avoid
   // invoking the interceptor again.
-  CHECK(args.Holder()->HasRealNamedProperty(v8_str("foo")));
-  args.GetReturnValue().Set(args[0]->Int32Value() + 1);
+  CHECK(args.Holder()
+            ->HasRealNamedProperty(isolate->GetCurrentContext(), v8_str("foo"))
+            .FromJust());
+  args.GetReturnValue().Set(
+      args[0]->Int32Value(isolate->GetCurrentContext()).FromJust() + 1);
 }
 
 
@@ -12871,7 +11908,7 @@
 void DirectApiCallback(const v8::FunctionCallbackInfo<v8::Value>& args) {
   static int count = 0;
   if (count++ % 3 == 0) {
-    CcTest::heap()->CollectAllGarbage(i::Heap::kAbortIncrementalMarkingMask);
+    CcTest::heap()->CollectAllGarbage();
         // This should move the stub
     GenerateSomeGarbage();  // This should ensure the old stub memory is flushed
   }
@@ -12882,13 +11919,16 @@
   LocalContext context;
   v8::Isolate* isolate = context->GetIsolate();
   v8::HandleScope scope(isolate);
-  v8::Handle<v8::ObjectTemplate> nativeobject_templ =
+  v8::Local<v8::ObjectTemplate> nativeobject_templ =
       v8::ObjectTemplate::New(isolate);
   nativeobject_templ->Set(isolate, "callback",
                           v8::FunctionTemplate::New(isolate,
                                                     DirectApiCallback));
-  v8::Local<v8::Object> nativeobject_obj = nativeobject_templ->NewInstance();
-  context->Global()->Set(v8_str("nativeobject"), nativeobject_obj);
+  v8::Local<v8::Object> nativeobject_obj =
+      nativeobject_templ->NewInstance(context.local()).ToLocalChecked();
+  CHECK(context->Global()
+            ->Set(context.local(), v8_str("nativeobject"), nativeobject_obj)
+            .FromJust());
   // call the api function multiple times to ensure direct call stub creation.
   CompileRun(
         "function f() {"
@@ -12910,15 +11950,18 @@
   LocalContext context;
   v8::Isolate* isolate = context->GetIsolate();
   v8::HandleScope scope(isolate);
-  v8::Handle<v8::ObjectTemplate> nativeobject_templ =
+  v8::Local<v8::ObjectTemplate> nativeobject_templ =
       v8::ObjectTemplate::New(isolate);
   nativeobject_templ->Set(isolate, "callback",
                           v8::FunctionTemplate::New(isolate,
                                                     ThrowingDirectApiCallback));
-  v8::Local<v8::Object> nativeobject_obj = nativeobject_templ->NewInstance();
-  context->Global()->Set(v8_str("nativeobject"), nativeobject_obj);
+  v8::Local<v8::Object> nativeobject_obj =
+      nativeobject_templ->NewInstance(context.local()).ToLocalChecked();
+  CHECK(context->Global()
+            ->Set(context.local(), v8_str("nativeobject"), nativeobject_obj)
+            .FromJust());
   // call the api function multiple times to ensure direct call stub creation.
-  v8::Handle<Value> result = CompileRun(
+  v8::Local<Value> result = CompileRun(
       "var result = '';"
       "function f() {"
       "  for (var i = 1; i <= 5; i++) {"
@@ -12926,18 +11969,22 @@
       "  }"
       "}"
       "f(); result;");
-  CHECK_EQ(v8_str("ggggg"), result);
+  CHECK(v8_str("ggggg")->Equals(context.local(), result).FromJust());
 }
 
 
-static Handle<Value> DoDirectGetter() {
-  if (++p_getter_count % 3 == 0) {
-    CcTest::heap()->CollectAllGarbage(i::Heap::kAbortIncrementalMarkingMask);
+static int p_getter_count_3;
+
+
+static Local<Value> DoDirectGetter() {
+  if (++p_getter_count_3 % 3 == 0) {
+    CcTest::heap()->CollectAllGarbage();
     GenerateSomeGarbage();
   }
   return v8_str("Direct Getter Result");
 }
 
+
 static void DirectGetterCallback(
     Local<String> name,
     const v8::PropertyCallbackInfo<v8::Value>& info) {
@@ -12951,18 +11998,23 @@
   LocalContext context;
   v8::Isolate* isolate = context->GetIsolate();
   v8::HandleScope scope(isolate);
-  v8::Handle<v8::ObjectTemplate> obj = v8::ObjectTemplate::New(isolate);
+  v8::Local<v8::ObjectTemplate> obj = v8::ObjectTemplate::New(isolate);
   obj->SetAccessor(v8_str("p1"), accessor);
-  context->Global()->Set(v8_str("o1"), obj->NewInstance());
-  p_getter_count = 0;
-  v8::Handle<v8::Value> result = CompileRun(
+  CHECK(context->Global()
+            ->Set(context.local(), v8_str("o1"),
+                  obj->NewInstance(context.local()).ToLocalChecked())
+            .FromJust());
+  p_getter_count_3 = 0;
+  v8::Local<v8::Value> result = CompileRun(
       "function f() {"
       "  for (var i = 0; i < 30; i++) o1.p1;"
       "  return o1.p1"
       "}"
       "f();");
-  CHECK_EQ(v8_str("Direct Getter Result"), result);
-  CHECK_EQ(31, p_getter_count);
+  CHECK(v8_str("Direct Getter Result")
+            ->Equals(context.local(), result)
+            .FromJust());
+  CHECK_EQ(31, p_getter_count_3);
 }
 
 
@@ -12982,16 +12034,19 @@
   LocalContext context;
   v8::Isolate* isolate = context->GetIsolate();
   v8::HandleScope scope(isolate);
-  v8::Handle<v8::ObjectTemplate> obj = v8::ObjectTemplate::New(isolate);
+  v8::Local<v8::ObjectTemplate> obj = v8::ObjectTemplate::New(isolate);
   obj->SetAccessor(v8_str("p1"), ThrowingDirectGetterCallback);
-  context->Global()->Set(v8_str("o1"), obj->NewInstance());
-  v8::Handle<Value> result = CompileRun(
+  CHECK(context->Global()
+            ->Set(context.local(), v8_str("o1"),
+                  obj->NewInstance(context.local()).ToLocalChecked())
+            .FromJust());
+  v8::Local<Value> result = CompileRun(
       "var result = '';"
       "for (var i = 0; i < 5; i++) {"
       "    try { o1.p1; } catch (e) { result += e; }"
       "}"
       "result;");
-  CHECK_EQ(v8_str("ggggg"), result);
+  CHECK(v8_str("ggggg")->Equals(context.local(), result).FromJust());
 }
 
 
@@ -12999,29 +12054,35 @@
   int interceptor_call_count = 0;
   v8::Isolate* isolate = CcTest::isolate();
   v8::HandleScope scope(isolate);
-  v8::Handle<v8::FunctionTemplate> fun_templ =
+  v8::Local<v8::FunctionTemplate> fun_templ =
       v8::FunctionTemplate::New(isolate);
-  v8::Handle<v8::FunctionTemplate> method_templ =
-      v8::FunctionTemplate::New(isolate,
-                                FastApiCallback_TrivialSignature,
-                                v8_str("method_data"),
-                                v8::Handle<v8::Signature>());
-  v8::Handle<v8::ObjectTemplate> proto_templ = fun_templ->PrototypeTemplate();
+  v8::Local<v8::FunctionTemplate> method_templ = v8::FunctionTemplate::New(
+      isolate, FastApiCallback_TrivialSignature, v8_str("method_data"),
+      v8::Local<v8::Signature>());
+  v8::Local<v8::ObjectTemplate> proto_templ = fun_templ->PrototypeTemplate();
   proto_templ->Set(v8_str("method"), method_templ);
-  v8::Handle<v8::ObjectTemplate> templ = fun_templ->InstanceTemplate();
+  v8::Local<v8::ObjectTemplate> templ = fun_templ->InstanceTemplate();
   templ->SetHandler(v8::NamedPropertyHandlerConfiguration(
       InterceptorCallICFastApi, NULL, NULL, NULL, NULL,
       v8::External::New(isolate, &interceptor_call_count)));
   LocalContext context;
-  v8::Handle<v8::Function> fun = fun_templ->GetFunction();
+  v8::Local<v8::Function> fun =
+      fun_templ->GetFunction(context.local()).ToLocalChecked();
   GenerateSomeGarbage();
-  context->Global()->Set(v8_str("o"), fun->NewInstance());
+  CHECK(context->Global()
+            ->Set(context.local(), v8_str("o"),
+                  fun->NewInstance(context.local()).ToLocalChecked())
+            .FromJust());
   CompileRun(
       "var result = 0;"
       "for (var i = 0; i < 100; i++) {"
       "  result = o.method(41);"
       "}");
-  CHECK_EQ(42, context->Global()->Get(v8_str("result"))->Int32Value());
+  CHECK_EQ(42, context->Global()
+                   ->Get(context.local(), v8_str("result"))
+                   .ToLocalChecked()
+                   ->Int32Value(context.local())
+                   .FromJust());
   CHECK_EQ(100, interceptor_call_count);
 }
 
@@ -13030,22 +12091,26 @@
   int interceptor_call_count = 0;
   v8::Isolate* isolate = CcTest::isolate();
   v8::HandleScope scope(isolate);
-  v8::Handle<v8::FunctionTemplate> fun_templ =
+  v8::Local<v8::FunctionTemplate> fun_templ =
       v8::FunctionTemplate::New(isolate);
-  v8::Handle<v8::FunctionTemplate> method_templ = v8::FunctionTemplate::New(
+  v8::Local<v8::FunctionTemplate> method_templ = v8::FunctionTemplate::New(
       isolate, FastApiCallback_SimpleSignature, v8_str("method_data"),
       v8::Signature::New(isolate, fun_templ));
-  v8::Handle<v8::ObjectTemplate> proto_templ = fun_templ->PrototypeTemplate();
+  v8::Local<v8::ObjectTemplate> proto_templ = fun_templ->PrototypeTemplate();
   proto_templ->Set(v8_str("method"), method_templ);
   fun_templ->SetHiddenPrototype(true);
-  v8::Handle<v8::ObjectTemplate> templ = fun_templ->InstanceTemplate();
+  v8::Local<v8::ObjectTemplate> templ = fun_templ->InstanceTemplate();
   templ->SetHandler(v8::NamedPropertyHandlerConfiguration(
       InterceptorCallICFastApi, NULL, NULL, NULL, NULL,
       v8::External::New(isolate, &interceptor_call_count)));
   LocalContext context;
-  v8::Handle<v8::Function> fun = fun_templ->GetFunction();
+  v8::Local<v8::Function> fun =
+      fun_templ->GetFunction(context.local()).ToLocalChecked();
   GenerateSomeGarbage();
-  context->Global()->Set(v8_str("o"), fun->NewInstance());
+  CHECK(context->Global()
+            ->Set(context.local(), v8_str("o"),
+                  fun->NewInstance(context.local()).ToLocalChecked())
+            .FromJust());
   CompileRun(
       "o.foo = 17;"
       "var receiver = {};"
@@ -13054,7 +12119,11 @@
       "for (var i = 0; i < 100; i++) {"
       "  result = receiver.method(41);"
       "}");
-  CHECK_EQ(42, context->Global()->Get(v8_str("result"))->Int32Value());
+  CHECK_EQ(42, context->Global()
+                   ->Get(context.local(), v8_str("result"))
+                   .ToLocalChecked()
+                   ->Int32Value(context.local())
+                   .FromJust());
   CHECK_EQ(100, interceptor_call_count);
 }
 
@@ -13063,22 +12132,26 @@
   int interceptor_call_count = 0;
   v8::Isolate* isolate = CcTest::isolate();
   v8::HandleScope scope(isolate);
-  v8::Handle<v8::FunctionTemplate> fun_templ =
+  v8::Local<v8::FunctionTemplate> fun_templ =
       v8::FunctionTemplate::New(isolate);
-  v8::Handle<v8::FunctionTemplate> method_templ = v8::FunctionTemplate::New(
+  v8::Local<v8::FunctionTemplate> method_templ = v8::FunctionTemplate::New(
       isolate, FastApiCallback_SimpleSignature, v8_str("method_data"),
       v8::Signature::New(isolate, fun_templ));
-  v8::Handle<v8::ObjectTemplate> proto_templ = fun_templ->PrototypeTemplate();
+  v8::Local<v8::ObjectTemplate> proto_templ = fun_templ->PrototypeTemplate();
   proto_templ->Set(v8_str("method"), method_templ);
   fun_templ->SetHiddenPrototype(true);
-  v8::Handle<v8::ObjectTemplate> templ = fun_templ->InstanceTemplate();
+  v8::Local<v8::ObjectTemplate> templ = fun_templ->InstanceTemplate();
   templ->SetHandler(v8::NamedPropertyHandlerConfiguration(
       InterceptorCallICFastApi, NULL, NULL, NULL, NULL,
       v8::External::New(isolate, &interceptor_call_count)));
   LocalContext context;
-  v8::Handle<v8::Function> fun = fun_templ->GetFunction();
+  v8::Local<v8::Function> fun =
+      fun_templ->GetFunction(context.local()).ToLocalChecked();
   GenerateSomeGarbage();
-  context->Global()->Set(v8_str("o"), fun->NewInstance());
+  CHECK(context->Global()
+            ->Set(context.local(), v8_str("o"),
+                  fun->NewInstance(context.local()).ToLocalChecked())
+            .FromJust());
   CompileRun(
       "o.foo = 17;"
       "var receiver = {};"
@@ -13092,8 +12165,16 @@
       "    receiver = {method: function(x) { return x - 1 }};"
       "  }"
       "}");
-  CHECK_EQ(40, context->Global()->Get(v8_str("result"))->Int32Value());
-  CHECK_EQ(42, context->Global()->Get(v8_str("saved_result"))->Int32Value());
+  CHECK_EQ(40, context->Global()
+                   ->Get(context.local(), v8_str("result"))
+                   .ToLocalChecked()
+                   ->Int32Value(context.local())
+                   .FromJust());
+  CHECK_EQ(42, context->Global()
+                   ->Get(context.local(), v8_str("saved_result"))
+                   .ToLocalChecked()
+                   ->Int32Value(context.local())
+                   .FromJust());
   CHECK_GE(interceptor_call_count, 50);
 }
 
@@ -13102,22 +12183,26 @@
   int interceptor_call_count = 0;
   v8::Isolate* isolate = CcTest::isolate();
   v8::HandleScope scope(isolate);
-  v8::Handle<v8::FunctionTemplate> fun_templ =
+  v8::Local<v8::FunctionTemplate> fun_templ =
       v8::FunctionTemplate::New(isolate);
-  v8::Handle<v8::FunctionTemplate> method_templ = v8::FunctionTemplate::New(
+  v8::Local<v8::FunctionTemplate> method_templ = v8::FunctionTemplate::New(
       isolate, FastApiCallback_SimpleSignature, v8_str("method_data"),
       v8::Signature::New(isolate, fun_templ));
-  v8::Handle<v8::ObjectTemplate> proto_templ = fun_templ->PrototypeTemplate();
+  v8::Local<v8::ObjectTemplate> proto_templ = fun_templ->PrototypeTemplate();
   proto_templ->Set(v8_str("method"), method_templ);
   fun_templ->SetHiddenPrototype(true);
-  v8::Handle<v8::ObjectTemplate> templ = fun_templ->InstanceTemplate();
+  v8::Local<v8::ObjectTemplate> templ = fun_templ->InstanceTemplate();
   templ->SetHandler(v8::NamedPropertyHandlerConfiguration(
       InterceptorCallICFastApi, NULL, NULL, NULL, NULL,
       v8::External::New(isolate, &interceptor_call_count)));
   LocalContext context;
-  v8::Handle<v8::Function> fun = fun_templ->GetFunction();
+  v8::Local<v8::Function> fun =
+      fun_templ->GetFunction(context.local()).ToLocalChecked();
   GenerateSomeGarbage();
-  context->Global()->Set(v8_str("o"), fun->NewInstance());
+  CHECK(context->Global()
+            ->Set(context.local(), v8_str("o"),
+                  fun->NewInstance(context.local()).ToLocalChecked())
+            .FromJust());
   CompileRun(
       "o.foo = 17;"
       "var receiver = {};"
@@ -13131,8 +12216,16 @@
       "    o.method = function(x) { return x - 1 };"
       "  }"
       "}");
-  CHECK_EQ(40, context->Global()->Get(v8_str("result"))->Int32Value());
-  CHECK_EQ(42, context->Global()->Get(v8_str("saved_result"))->Int32Value());
+  CHECK_EQ(40, context->Global()
+                   ->Get(context.local(), v8_str("result"))
+                   .ToLocalChecked()
+                   ->Int32Value(context.local())
+                   .FromJust());
+  CHECK_EQ(42, context->Global()
+                   ->Get(context.local(), v8_str("saved_result"))
+                   .ToLocalChecked()
+                   ->Int32Value(context.local())
+                   .FromJust());
   CHECK_GE(interceptor_call_count, 50);
 }
 
@@ -13141,23 +12234,27 @@
   int interceptor_call_count = 0;
   v8::Isolate* isolate = CcTest::isolate();
   v8::HandleScope scope(isolate);
-  v8::Handle<v8::FunctionTemplate> fun_templ =
+  v8::Local<v8::FunctionTemplate> fun_templ =
       v8::FunctionTemplate::New(isolate);
-  v8::Handle<v8::FunctionTemplate> method_templ = v8::FunctionTemplate::New(
+  v8::Local<v8::FunctionTemplate> method_templ = v8::FunctionTemplate::New(
       isolate, FastApiCallback_SimpleSignature, v8_str("method_data"),
       v8::Signature::New(isolate, fun_templ));
-  v8::Handle<v8::ObjectTemplate> proto_templ = fun_templ->PrototypeTemplate();
+  v8::Local<v8::ObjectTemplate> proto_templ = fun_templ->PrototypeTemplate();
   proto_templ->Set(v8_str("method"), method_templ);
   fun_templ->SetHiddenPrototype(true);
-  v8::Handle<v8::ObjectTemplate> templ = fun_templ->InstanceTemplate();
+  v8::Local<v8::ObjectTemplate> templ = fun_templ->InstanceTemplate();
   templ->SetHandler(v8::NamedPropertyHandlerConfiguration(
       InterceptorCallICFastApi, NULL, NULL, NULL, NULL,
       v8::External::New(isolate, &interceptor_call_count)));
   LocalContext context;
-  v8::Handle<v8::Function> fun = fun_templ->GetFunction();
+  v8::Local<v8::Function> fun =
+      fun_templ->GetFunction(context.local()).ToLocalChecked();
   GenerateSomeGarbage();
-  context->Global()->Set(v8_str("o"), fun->NewInstance());
-  v8::TryCatch try_catch;
+  CHECK(context->Global()
+            ->Set(context.local(), v8_str("o"),
+                  fun->NewInstance(context.local()).ToLocalChecked())
+            .FromJust());
+  v8::TryCatch try_catch(isolate);
   CompileRun(
       "o.foo = 17;"
       "var receiver = {};"
@@ -13173,9 +12270,17 @@
       "}");
   CHECK(try_catch.HasCaught());
   // TODO(verwaest): Adjust message.
-  CHECK_EQ(v8_str("TypeError: undefined is not a function"),
-           try_catch.Exception()->ToString(isolate));
-  CHECK_EQ(42, context->Global()->Get(v8_str("saved_result"))->Int32Value());
+  CHECK(
+      v8_str("TypeError: receiver.method is not a function")
+          ->Equals(
+              context.local(),
+              try_catch.Exception()->ToString(context.local()).ToLocalChecked())
+          .FromJust());
+  CHECK_EQ(42, context->Global()
+                   ->Get(context.local(), v8_str("saved_result"))
+                   .ToLocalChecked()
+                   ->Int32Value(context.local())
+                   .FromJust());
   CHECK_GE(interceptor_call_count, 50);
 }
 
@@ -13184,23 +12289,27 @@
   int interceptor_call_count = 0;
   v8::Isolate* isolate = CcTest::isolate();
   v8::HandleScope scope(isolate);
-  v8::Handle<v8::FunctionTemplate> fun_templ =
+  v8::Local<v8::FunctionTemplate> fun_templ =
       v8::FunctionTemplate::New(isolate);
-  v8::Handle<v8::FunctionTemplate> method_templ = v8::FunctionTemplate::New(
+  v8::Local<v8::FunctionTemplate> method_templ = v8::FunctionTemplate::New(
       isolate, FastApiCallback_SimpleSignature, v8_str("method_data"),
       v8::Signature::New(isolate, fun_templ));
-  v8::Handle<v8::ObjectTemplate> proto_templ = fun_templ->PrototypeTemplate();
+  v8::Local<v8::ObjectTemplate> proto_templ = fun_templ->PrototypeTemplate();
   proto_templ->Set(v8_str("method"), method_templ);
   fun_templ->SetHiddenPrototype(true);
-  v8::Handle<v8::ObjectTemplate> templ = fun_templ->InstanceTemplate();
+  v8::Local<v8::ObjectTemplate> templ = fun_templ->InstanceTemplate();
   templ->SetHandler(v8::NamedPropertyHandlerConfiguration(
       InterceptorCallICFastApi, NULL, NULL, NULL, NULL,
       v8::External::New(isolate, &interceptor_call_count)));
   LocalContext context;
-  v8::Handle<v8::Function> fun = fun_templ->GetFunction();
+  v8::Local<v8::Function> fun =
+      fun_templ->GetFunction(context.local()).ToLocalChecked();
   GenerateSomeGarbage();
-  context->Global()->Set(v8_str("o"), fun->NewInstance());
-  v8::TryCatch try_catch;
+  CHECK(context->Global()
+            ->Set(context.local(), v8_str("o"),
+                  fun->NewInstance(context.local()).ToLocalChecked())
+            .FromJust());
+  v8::TryCatch try_catch(isolate);
   CompileRun(
       "o.foo = 17;"
       "var receiver = {};"
@@ -13215,9 +12324,17 @@
       "  }"
       "}");
   CHECK(try_catch.HasCaught());
-  CHECK_EQ(v8_str("TypeError: Illegal invocation"),
-           try_catch.Exception()->ToString(isolate));
-  CHECK_EQ(42, context->Global()->Get(v8_str("saved_result"))->Int32Value());
+  CHECK(
+      v8_str("TypeError: Illegal invocation")
+          ->Equals(
+              context.local(),
+              try_catch.Exception()->ToString(context.local()).ToLocalChecked())
+          .FromJust());
+  CHECK_EQ(42, context->Global()
+                   ->Get(context.local(), v8_str("saved_result"))
+                   .ToLocalChecked()
+                   ->Int32Value(context.local())
+                   .FromJust());
   CHECK_GE(interceptor_call_count, 50);
 }
 
@@ -13225,48 +12342,58 @@
 THREADED_PROFILED_TEST(CallICFastApi_TrivialSignature) {
   v8::Isolate* isolate = CcTest::isolate();
   v8::HandleScope scope(isolate);
-  v8::Handle<v8::FunctionTemplate> fun_templ =
+  v8::Local<v8::FunctionTemplate> fun_templ =
       v8::FunctionTemplate::New(isolate);
-  v8::Handle<v8::FunctionTemplate> method_templ =
-      v8::FunctionTemplate::New(isolate,
-                                FastApiCallback_TrivialSignature,
-                                v8_str("method_data"),
-                                v8::Handle<v8::Signature>());
-  v8::Handle<v8::ObjectTemplate> proto_templ = fun_templ->PrototypeTemplate();
+  v8::Local<v8::FunctionTemplate> method_templ = v8::FunctionTemplate::New(
+      isolate, FastApiCallback_TrivialSignature, v8_str("method_data"),
+      v8::Local<v8::Signature>());
+  v8::Local<v8::ObjectTemplate> proto_templ = fun_templ->PrototypeTemplate();
   proto_templ->Set(v8_str("method"), method_templ);
-  v8::Handle<v8::ObjectTemplate> templ(fun_templ->InstanceTemplate());
+  v8::Local<v8::ObjectTemplate> templ(fun_templ->InstanceTemplate());
   USE(templ);
   LocalContext context;
-  v8::Handle<v8::Function> fun = fun_templ->GetFunction();
+  v8::Local<v8::Function> fun =
+      fun_templ->GetFunction(context.local()).ToLocalChecked();
   GenerateSomeGarbage();
-  context->Global()->Set(v8_str("o"), fun->NewInstance());
+  CHECK(context->Global()
+            ->Set(context.local(), v8_str("o"),
+                  fun->NewInstance(context.local()).ToLocalChecked())
+            .FromJust());
   CompileRun(
       "var result = 0;"
       "for (var i = 0; i < 100; i++) {"
       "  result = o.method(41);"
       "}");
 
-  CHECK_EQ(42, context->Global()->Get(v8_str("result"))->Int32Value());
+  CHECK_EQ(42, context->Global()
+                   ->Get(context.local(), v8_str("result"))
+                   .ToLocalChecked()
+                   ->Int32Value(context.local())
+                   .FromJust());
 }
 
 
 THREADED_PROFILED_TEST(CallICFastApi_SimpleSignature) {
   v8::Isolate* isolate = CcTest::isolate();
   v8::HandleScope scope(isolate);
-  v8::Handle<v8::FunctionTemplate> fun_templ =
+  v8::Local<v8::FunctionTemplate> fun_templ =
       v8::FunctionTemplate::New(isolate);
-  v8::Handle<v8::FunctionTemplate> method_templ = v8::FunctionTemplate::New(
+  v8::Local<v8::FunctionTemplate> method_templ = v8::FunctionTemplate::New(
       isolate, FastApiCallback_SimpleSignature, v8_str("method_data"),
       v8::Signature::New(isolate, fun_templ));
-  v8::Handle<v8::ObjectTemplate> proto_templ = fun_templ->PrototypeTemplate();
+  v8::Local<v8::ObjectTemplate> proto_templ = fun_templ->PrototypeTemplate();
   proto_templ->Set(v8_str("method"), method_templ);
   fun_templ->SetHiddenPrototype(true);
-  v8::Handle<v8::ObjectTemplate> templ(fun_templ->InstanceTemplate());
+  v8::Local<v8::ObjectTemplate> templ(fun_templ->InstanceTemplate());
   CHECK(!templ.IsEmpty());
   LocalContext context;
-  v8::Handle<v8::Function> fun = fun_templ->GetFunction();
+  v8::Local<v8::Function> fun =
+      fun_templ->GetFunction(context.local()).ToLocalChecked();
   GenerateSomeGarbage();
-  context->Global()->Set(v8_str("o"), fun->NewInstance());
+  CHECK(context->Global()
+            ->Set(context.local(), v8_str("o"),
+                  fun->NewInstance(context.local()).ToLocalChecked())
+            .FromJust());
   CompileRun(
       "o.foo = 17;"
       "var receiver = {};"
@@ -13276,27 +12403,35 @@
       "  result = receiver.method(41);"
       "}");
 
-  CHECK_EQ(42, context->Global()->Get(v8_str("result"))->Int32Value());
+  CHECK_EQ(42, context->Global()
+                   ->Get(context.local(), v8_str("result"))
+                   .ToLocalChecked()
+                   ->Int32Value(context.local())
+                   .FromJust());
 }
 
 
 THREADED_PROFILED_TEST(CallICFastApi_SimpleSignature_Miss1) {
   v8::Isolate* isolate = CcTest::isolate();
   v8::HandleScope scope(isolate);
-  v8::Handle<v8::FunctionTemplate> fun_templ =
+  v8::Local<v8::FunctionTemplate> fun_templ =
       v8::FunctionTemplate::New(isolate);
-  v8::Handle<v8::FunctionTemplate> method_templ = v8::FunctionTemplate::New(
+  v8::Local<v8::FunctionTemplate> method_templ = v8::FunctionTemplate::New(
       isolate, FastApiCallback_SimpleSignature, v8_str("method_data"),
       v8::Signature::New(isolate, fun_templ));
-  v8::Handle<v8::ObjectTemplate> proto_templ = fun_templ->PrototypeTemplate();
+  v8::Local<v8::ObjectTemplate> proto_templ = fun_templ->PrototypeTemplate();
   proto_templ->Set(v8_str("method"), method_templ);
   fun_templ->SetHiddenPrototype(true);
-  v8::Handle<v8::ObjectTemplate> templ(fun_templ->InstanceTemplate());
+  v8::Local<v8::ObjectTemplate> templ(fun_templ->InstanceTemplate());
   CHECK(!templ.IsEmpty());
   LocalContext context;
-  v8::Handle<v8::Function> fun = fun_templ->GetFunction();
+  v8::Local<v8::Function> fun =
+      fun_templ->GetFunction(context.local()).ToLocalChecked();
   GenerateSomeGarbage();
-  context->Global()->Set(v8_str("o"), fun->NewInstance());
+  CHECK(context->Global()
+            ->Set(context.local(), v8_str("o"),
+                  fun->NewInstance(context.local()).ToLocalChecked())
+            .FromJust());
   CompileRun(
       "o.foo = 17;"
       "var receiver = {};"
@@ -13310,29 +12445,41 @@
       "    receiver = {method: function(x) { return x - 1 }};"
       "  }"
       "}");
-  CHECK_EQ(40, context->Global()->Get(v8_str("result"))->Int32Value());
-  CHECK_EQ(42, context->Global()->Get(v8_str("saved_result"))->Int32Value());
+  CHECK_EQ(40, context->Global()
+                   ->Get(context.local(), v8_str("result"))
+                   .ToLocalChecked()
+                   ->Int32Value(context.local())
+                   .FromJust());
+  CHECK_EQ(42, context->Global()
+                   ->Get(context.local(), v8_str("saved_result"))
+                   .ToLocalChecked()
+                   ->Int32Value(context.local())
+                   .FromJust());
 }
 
 
 THREADED_PROFILED_TEST(CallICFastApi_SimpleSignature_Miss2) {
   v8::Isolate* isolate = CcTest::isolate();
   v8::HandleScope scope(isolate);
-  v8::Handle<v8::FunctionTemplate> fun_templ =
+  v8::Local<v8::FunctionTemplate> fun_templ =
       v8::FunctionTemplate::New(isolate);
-  v8::Handle<v8::FunctionTemplate> method_templ = v8::FunctionTemplate::New(
+  v8::Local<v8::FunctionTemplate> method_templ = v8::FunctionTemplate::New(
       isolate, FastApiCallback_SimpleSignature, v8_str("method_data"),
       v8::Signature::New(isolate, fun_templ));
-  v8::Handle<v8::ObjectTemplate> proto_templ = fun_templ->PrototypeTemplate();
+  v8::Local<v8::ObjectTemplate> proto_templ = fun_templ->PrototypeTemplate();
   proto_templ->Set(v8_str("method"), method_templ);
   fun_templ->SetHiddenPrototype(true);
-  v8::Handle<v8::ObjectTemplate> templ(fun_templ->InstanceTemplate());
+  v8::Local<v8::ObjectTemplate> templ(fun_templ->InstanceTemplate());
   CHECK(!templ.IsEmpty());
   LocalContext context;
-  v8::Handle<v8::Function> fun = fun_templ->GetFunction();
+  v8::Local<v8::Function> fun =
+      fun_templ->GetFunction(context.local()).ToLocalChecked();
   GenerateSomeGarbage();
-  context->Global()->Set(v8_str("o"), fun->NewInstance());
-  v8::TryCatch try_catch;
+  CHECK(context->Global()
+            ->Set(context.local(), v8_str("o"),
+                  fun->NewInstance(context.local()).ToLocalChecked())
+            .FromJust());
+  v8::TryCatch try_catch(isolate);
   CompileRun(
       "o.foo = 17;"
       "var receiver = {};"
@@ -13348,30 +12495,42 @@
       "}");
   CHECK(try_catch.HasCaught());
   // TODO(verwaest): Adjust message.
-  CHECK_EQ(v8_str("TypeError: undefined is not a function"),
-           try_catch.Exception()->ToString(isolate));
-  CHECK_EQ(42, context->Global()->Get(v8_str("saved_result"))->Int32Value());
+  CHECK(
+      v8_str("TypeError: receiver.method is not a function")
+          ->Equals(
+              context.local(),
+              try_catch.Exception()->ToString(context.local()).ToLocalChecked())
+          .FromJust());
+  CHECK_EQ(42, context->Global()
+                   ->Get(context.local(), v8_str("saved_result"))
+                   .ToLocalChecked()
+                   ->Int32Value(context.local())
+                   .FromJust());
 }
 
 
 THREADED_PROFILED_TEST(CallICFastApi_SimpleSignature_TypeError) {
   v8::Isolate* isolate = CcTest::isolate();
   v8::HandleScope scope(isolate);
-  v8::Handle<v8::FunctionTemplate> fun_templ =
+  v8::Local<v8::FunctionTemplate> fun_templ =
       v8::FunctionTemplate::New(isolate);
-  v8::Handle<v8::FunctionTemplate> method_templ = v8::FunctionTemplate::New(
+  v8::Local<v8::FunctionTemplate> method_templ = v8::FunctionTemplate::New(
       isolate, FastApiCallback_SimpleSignature, v8_str("method_data"),
       v8::Signature::New(isolate, fun_templ));
-  v8::Handle<v8::ObjectTemplate> proto_templ = fun_templ->PrototypeTemplate();
+  v8::Local<v8::ObjectTemplate> proto_templ = fun_templ->PrototypeTemplate();
   proto_templ->Set(v8_str("method"), method_templ);
   fun_templ->SetHiddenPrototype(true);
-  v8::Handle<v8::ObjectTemplate> templ(fun_templ->InstanceTemplate());
+  v8::Local<v8::ObjectTemplate> templ(fun_templ->InstanceTemplate());
   CHECK(!templ.IsEmpty());
   LocalContext context;
-  v8::Handle<v8::Function> fun = fun_templ->GetFunction();
+  v8::Local<v8::Function> fun =
+      fun_templ->GetFunction(context.local()).ToLocalChecked();
   GenerateSomeGarbage();
-  context->Global()->Set(v8_str("o"), fun->NewInstance());
-  v8::TryCatch try_catch;
+  CHECK(context->Global()
+            ->Set(context.local(), v8_str("o"),
+                  fun->NewInstance(context.local()).ToLocalChecked())
+            .FromJust());
+  v8::TryCatch try_catch(isolate);
   CompileRun(
       "o.foo = 17;"
       "var receiver = {};"
@@ -13386,354 +12545,24 @@
       "  }"
       "}");
   CHECK(try_catch.HasCaught());
-  CHECK_EQ(v8_str("TypeError: Illegal invocation"),
-           try_catch.Exception()->ToString(isolate));
-  CHECK_EQ(42, context->Global()->Get(v8_str("saved_result"))->Int32Value());
-}
-
-
-v8::Handle<Value> keyed_call_ic_function;
-
-static void InterceptorKeyedCallICGetter(
-    Local<Name> name, const v8::PropertyCallbackInfo<v8::Value>& info) {
-  ApiTestFuzzer::Fuzz();
-  if (v8_str("x")->Equals(name)) {
-    info.GetReturnValue().Set(keyed_call_ic_function);
-  }
-}
-
-
-// Test the case when we stored cacheable lookup into
-// a stub, but the function name changed (to another cacheable function).
-THREADED_TEST(InterceptorKeyedCallICKeyChange1) {
-  v8::Isolate* isolate = CcTest::isolate();
-  v8::HandleScope scope(isolate);
-  v8::Handle<v8::ObjectTemplate> templ = ObjectTemplate::New(isolate);
-  templ->SetHandler(v8::NamedPropertyHandlerConfiguration(NoBlockGetterX));
-  LocalContext context;
-  context->Global()->Set(v8_str("o"), templ->NewInstance());
-  CompileRun(
-    "proto = new Object();"
-    "proto.y = function(x) { return x + 1; };"
-    "proto.z = function(x) { return x - 1; };"
-    "o.__proto__ = proto;"
-    "var result = 0;"
-    "var method = 'y';"
-    "for (var i = 0; i < 10; i++) {"
-    "  if (i == 5) { method = 'z'; };"
-    "  result += o[method](41);"
-    "}");
-  CHECK_EQ(42*5 + 40*5, context->Global()->Get(v8_str("result"))->Int32Value());
-}
-
-
-// Test the case when we stored cacheable lookup into
-// a stub, but the function name changed (and the new function is present
-// both before and after the interceptor in the prototype chain).
-THREADED_TEST(InterceptorKeyedCallICKeyChange2) {
-  v8::Isolate* isolate = CcTest::isolate();
-  v8::HandleScope scope(isolate);
-  v8::Handle<v8::ObjectTemplate> templ = ObjectTemplate::New(isolate);
-  templ->SetHandler(
-      v8::NamedPropertyHandlerConfiguration(InterceptorKeyedCallICGetter));
-  LocalContext context;
-  context->Global()->Set(v8_str("proto1"), templ->NewInstance());
-  keyed_call_ic_function =
-      v8_compile("function f(x) { return x - 1; }; f")->Run();
-  CompileRun(
-    "o = new Object();"
-    "proto2 = new Object();"
-    "o.y = function(x) { return x + 1; };"
-    "proto2.y = function(x) { return x + 2; };"
-    "o.__proto__ = proto1;"
-    "proto1.__proto__ = proto2;"
-    "var result = 0;"
-    "var method = 'x';"
-    "for (var i = 0; i < 10; i++) {"
-    "  if (i == 5) { method = 'y'; };"
-    "  result += o[method](41);"
-    "}");
-  CHECK_EQ(42*5 + 40*5, context->Global()->Get(v8_str("result"))->Int32Value());
-}
-
-
-// Same as InterceptorKeyedCallICKeyChange1 only the cacheable function sit
-// on the global object.
-THREADED_TEST(InterceptorKeyedCallICKeyChangeOnGlobal) {
-  v8::Isolate* isolate = CcTest::isolate();
-  v8::HandleScope scope(isolate);
-  v8::Handle<v8::ObjectTemplate> templ = ObjectTemplate::New(isolate);
-  templ->SetHandler(v8::NamedPropertyHandlerConfiguration(NoBlockGetterX));
-  LocalContext context;
-  context->Global()->Set(v8_str("o"), templ->NewInstance());
-  CompileRun(
-    "function inc(x) { return x + 1; };"
-    "inc(1);"
-    "function dec(x) { return x - 1; };"
-    "dec(1);"
-    "o.__proto__ = this;"
-    "this.__proto__.x = inc;"
-    "this.__proto__.y = dec;"
-    "var result = 0;"
-    "var method = 'x';"
-    "for (var i = 0; i < 10; i++) {"
-    "  if (i == 5) { method = 'y'; };"
-    "  result += o[method](41);"
-    "}");
-  CHECK_EQ(42*5 + 40*5, context->Global()->Get(v8_str("result"))->Int32Value());
-}
-
-
-// Test the case when actual function to call sits on global object.
-THREADED_TEST(InterceptorKeyedCallICFromGlobal) {
-  v8::Isolate* isolate = CcTest::isolate();
-  v8::HandleScope scope(isolate);
-  v8::Handle<v8::ObjectTemplate> templ_o = ObjectTemplate::New(isolate);
-  templ_o->SetHandler(v8::NamedPropertyHandlerConfiguration(NoBlockGetterX));
-  LocalContext context;
-  context->Global()->Set(v8_str("o"), templ_o->NewInstance());
-
-  CompileRun(
-    "function len(x) { return x.length; };"
-    "o.__proto__ = this;"
-    "var m = 'parseFloat';"
-    "var result = 0;"
-    "for (var i = 0; i < 10; i++) {"
-    "  if (i == 5) {"
-    "    m = 'len';"
-    "    saved_result = result;"
-    "  };"
-    "  result = o[m]('239');"
-    "}");
-  CHECK_EQ(3, context->Global()->Get(v8_str("result"))->Int32Value());
-  CHECK_EQ(239, context->Global()->Get(v8_str("saved_result"))->Int32Value());
-}
-
-
-// Test the map transition before the interceptor.
-THREADED_TEST(InterceptorKeyedCallICMapChangeBefore) {
-  v8::Isolate* isolate = CcTest::isolate();
-  v8::HandleScope scope(isolate);
-  v8::Handle<v8::ObjectTemplate> templ_o = ObjectTemplate::New(isolate);
-  templ_o->SetHandler(v8::NamedPropertyHandlerConfiguration(NoBlockGetterX));
-  LocalContext context;
-  context->Global()->Set(v8_str("proto"), templ_o->NewInstance());
-
-  CompileRun(
-    "var o = new Object();"
-    "o.__proto__ = proto;"
-    "o.method = function(x) { return x + 1; };"
-    "var m = 'method';"
-    "var result = 0;"
-    "for (var i = 0; i < 10; i++) {"
-    "  if (i == 5) { o.method = function(x) { return x - 1; }; };"
-    "  result += o[m](41);"
-    "}");
-  CHECK_EQ(42*5 + 40*5, context->Global()->Get(v8_str("result"))->Int32Value());
-}
-
-
-// Test the map transition after the interceptor.
-THREADED_TEST(InterceptorKeyedCallICMapChangeAfter) {
-  v8::Isolate* isolate = CcTest::isolate();
-  v8::HandleScope scope(isolate);
-  v8::Handle<v8::ObjectTemplate> templ_o = ObjectTemplate::New(isolate);
-  templ_o->SetHandler(v8::NamedPropertyHandlerConfiguration(NoBlockGetterX));
-  LocalContext context;
-  context->Global()->Set(v8_str("o"), templ_o->NewInstance());
-
-  CompileRun(
-    "var proto = new Object();"
-    "o.__proto__ = proto;"
-    "proto.method = function(x) { return x + 1; };"
-    "var m = 'method';"
-    "var result = 0;"
-    "for (var i = 0; i < 10; i++) {"
-    "  if (i == 5) { proto.method = function(x) { return x - 1; }; };"
-    "  result += o[m](41);"
-    "}");
-  CHECK_EQ(42*5 + 40*5, context->Global()->Get(v8_str("result"))->Int32Value());
-}
-
-
-static int interceptor_call_count = 0;
-
-static void InterceptorICRefErrorGetter(
-    Local<Name> name, const v8::PropertyCallbackInfo<v8::Value>& info) {
-  ApiTestFuzzer::Fuzz();
-  if (v8_str("x")->Equals(name) && interceptor_call_count++ < 20) {
-    info.GetReturnValue().Set(call_ic_function2);
-  }
-}
-
-
-// This test should hit load and call ICs for the interceptor case.
-// Once in a while, the interceptor will reply that a property was not
-// found in which case we should get a reference error.
-THREADED_TEST(InterceptorICReferenceErrors) {
-  v8::Isolate* isolate = CcTest::isolate();
-  v8::HandleScope scope(isolate);
-  v8::Handle<v8::ObjectTemplate> templ = ObjectTemplate::New(isolate);
-  templ->SetHandler(
-      v8::NamedPropertyHandlerConfiguration(InterceptorICRefErrorGetter));
-  LocalContext context(0, templ, v8::Handle<Value>());
-  call_ic_function2 = v8_compile("function h(x) { return x; }; h")->Run();
-  v8::Handle<Value> value = CompileRun(
-    "function f() {"
-    "  for (var i = 0; i < 1000; i++) {"
-    "    try { x; } catch(e) { return true; }"
-    "  }"
-    "  return false;"
-    "};"
-    "f();");
-  CHECK_EQ(true, value->BooleanValue());
-  interceptor_call_count = 0;
-  value = CompileRun(
-    "function g() {"
-    "  for (var i = 0; i < 1000; i++) {"
-    "    try { x(42); } catch(e) { return true; }"
-    "  }"
-    "  return false;"
-    "};"
-    "g();");
-  CHECK_EQ(true, value->BooleanValue());
-}
-
-
-static int interceptor_ic_exception_get_count = 0;
-
-static void InterceptorICExceptionGetter(
-    Local<Name> name, const v8::PropertyCallbackInfo<v8::Value>& info) {
-  ApiTestFuzzer::Fuzz();
-  if (v8_str("x")->Equals(name) && ++interceptor_ic_exception_get_count < 20) {
-    info.GetReturnValue().Set(call_ic_function3);
-  }
-  if (interceptor_ic_exception_get_count == 20) {
-    info.GetIsolate()->ThrowException(v8_num(42));
-    return;
-  }
-}
-
-
-// Test interceptor load/call IC where the interceptor throws an
-// exception once in a while.
-THREADED_TEST(InterceptorICGetterExceptions) {
-  interceptor_ic_exception_get_count = 0;
-  v8::Isolate* isolate = CcTest::isolate();
-  v8::HandleScope scope(isolate);
-  v8::Handle<v8::ObjectTemplate> templ = ObjectTemplate::New(isolate);
-  templ->SetHandler(
-      v8::NamedPropertyHandlerConfiguration(InterceptorICExceptionGetter));
-  LocalContext context(0, templ, v8::Handle<Value>());
-  call_ic_function3 = v8_compile("function h(x) { return x; }; h")->Run();
-  v8::Handle<Value> value = CompileRun(
-    "function f() {"
-    "  for (var i = 0; i < 100; i++) {"
-    "    try { x; } catch(e) { return true; }"
-    "  }"
-    "  return false;"
-    "};"
-    "f();");
-  CHECK_EQ(true, value->BooleanValue());
-  interceptor_ic_exception_get_count = 0;
-  value = CompileRun(
-    "function f() {"
-    "  for (var i = 0; i < 100; i++) {"
-    "    try { x(42); } catch(e) { return true; }"
-    "  }"
-    "  return false;"
-    "};"
-    "f();");
-  CHECK_EQ(true, value->BooleanValue());
-}
-
-
-static int interceptor_ic_exception_set_count = 0;
-
-static void InterceptorICExceptionSetter(
-    Local<Name> key, Local<Value> value,
-    const v8::PropertyCallbackInfo<v8::Value>& info) {
-  ApiTestFuzzer::Fuzz();
-  if (++interceptor_ic_exception_set_count > 20) {
-    info.GetIsolate()->ThrowException(v8_num(42));
-  }
-}
-
-
-// Test interceptor store IC where the interceptor throws an exception
-// once in a while.
-THREADED_TEST(InterceptorICSetterExceptions) {
-  interceptor_ic_exception_set_count = 0;
-  v8::Isolate* isolate = CcTest::isolate();
-  v8::HandleScope scope(isolate);
-  v8::Handle<v8::ObjectTemplate> templ = ObjectTemplate::New(isolate);
-  templ->SetHandler(
-      v8::NamedPropertyHandlerConfiguration(0, InterceptorICExceptionSetter));
-  LocalContext context(0, templ, v8::Handle<Value>());
-  v8::Handle<Value> value = CompileRun(
-    "function f() {"
-    "  for (var i = 0; i < 100; i++) {"
-    "    try { x = 42; } catch(e) { return true; }"
-    "  }"
-    "  return false;"
-    "};"
-    "f();");
-  CHECK_EQ(true, value->BooleanValue());
-}
-
-
-// Test that we ignore null interceptors.
-THREADED_TEST(NullNamedInterceptor) {
-  v8::Isolate* isolate = CcTest::isolate();
-  v8::HandleScope scope(isolate);
-  v8::Handle<v8::ObjectTemplate> templ = ObjectTemplate::New(isolate);
-  templ->SetHandler(v8::NamedPropertyHandlerConfiguration(
-      static_cast<v8::GenericNamedPropertyGetterCallback>(0)));
-  LocalContext context;
-  templ->Set(CcTest::isolate(), "x", v8_num(42));
-  v8::Handle<v8::Object> obj = templ->NewInstance();
-  context->Global()->Set(v8_str("obj"), obj);
-  v8::Handle<Value> value = CompileRun("obj.x");
-  CHECK(value->IsInt32());
-  CHECK_EQ(42, value->Int32Value());
-}
-
-
-// Test that we ignore null interceptors.
-THREADED_TEST(NullIndexedInterceptor) {
-  v8::Isolate* isolate = CcTest::isolate();
-  v8::HandleScope scope(isolate);
-  v8::Handle<v8::ObjectTemplate> templ = ObjectTemplate::New(isolate);
-  templ->SetHandler(v8::IndexedPropertyHandlerConfiguration(
-      static_cast<v8::IndexedPropertyGetterCallback>(0)));
-  LocalContext context;
-  templ->Set(CcTest::isolate(), "42", v8_num(42));
-  v8::Handle<v8::Object> obj = templ->NewInstance();
-  context->Global()->Set(v8_str("obj"), obj);
-  v8::Handle<Value> value = CompileRun("obj[42]");
-  CHECK(value->IsInt32());
-  CHECK_EQ(42, value->Int32Value());
-}
-
-
-THREADED_TEST(NamedPropertyHandlerGetterAttributes) {
-  v8::Isolate* isolate = CcTest::isolate();
-  v8::HandleScope scope(isolate);
-  v8::Handle<v8::FunctionTemplate> templ = v8::FunctionTemplate::New(isolate);
-  templ->InstanceTemplate()->SetHandler(
-      v8::NamedPropertyHandlerConfiguration(InterceptorLoadXICGetter));
-  LocalContext env;
-  env->Global()->Set(v8_str("obj"),
-                     templ->GetFunction()->NewInstance());
-  ExpectTrue("obj.x === 42");
-  ExpectTrue("!obj.propertyIsEnumerable('x')");
+  CHECK(
+      v8_str("TypeError: Illegal invocation")
+          ->Equals(
+              context.local(),
+              try_catch.Exception()->ToString(context.local()).ToLocalChecked())
+          .FromJust());
+  CHECK_EQ(42, context->Global()
+                   ->Get(context.local(), v8_str("saved_result"))
+                   .ToLocalChecked()
+                   ->Int32Value(context.local())
+                   .FromJust());
 }
 
 
 static void ThrowingGetter(Local<String> name,
                            const v8::PropertyCallbackInfo<v8::Value>& info) {
   ApiTestFuzzer::Fuzz();
-  info.GetIsolate()->ThrowException(Handle<Value>());
+  info.GetIsolate()->ThrowException(Local<Value>());
   info.GetReturnValue().SetUndefined();
 }
 
@@ -13746,10 +12575,13 @@
   Local<ObjectTemplate> instance_templ = templ->InstanceTemplate();
   instance_templ->SetAccessor(v8_str("f"), ThrowingGetter);
 
-  Local<Object> instance = templ->GetFunction()->NewInstance();
+  Local<Object> instance = templ->GetFunction(context.local())
+                               .ToLocalChecked()
+                               ->NewInstance(context.local())
+                               .ToLocalChecked();
 
   Local<Object> another = Object::New(context->GetIsolate());
-  another->SetPrototype(instance);
+  CHECK(another->SetPrototype(context.local(), instance).FromJust());
 
   Local<Object> with_js_getter = CompileRun(
       "o = {};\n"
@@ -13757,34 +12589,55 @@
       "o\n").As<Object>();
   CHECK(!with_js_getter.IsEmpty());
 
-  TryCatch try_catch;
+  TryCatch try_catch(context->GetIsolate());
 
-  Local<Value> result = instance->GetRealNamedProperty(v8_str("f"));
+  v8::MaybeLocal<Value> result =
+      instance->GetRealNamedProperty(context.local(), v8_str("f"));
   CHECK(try_catch.HasCaught());
   try_catch.Reset();
   CHECK(result.IsEmpty());
 
-  result = another->GetRealNamedProperty(v8_str("f"));
+  Maybe<PropertyAttribute> attr =
+      instance->GetRealNamedPropertyAttributes(context.local(), v8_str("f"));
+  CHECK(!try_catch.HasCaught());
+  CHECK(Just(None) == attr);
+
+  result = another->GetRealNamedProperty(context.local(), v8_str("f"));
   CHECK(try_catch.HasCaught());
   try_catch.Reset();
   CHECK(result.IsEmpty());
 
-  result = another->GetRealNamedPropertyInPrototypeChain(v8_str("f"));
+  attr = another->GetRealNamedPropertyAttributes(context.local(), v8_str("f"));
+  CHECK(!try_catch.HasCaught());
+  CHECK(Just(None) == attr);
+
+  result = another->GetRealNamedPropertyInPrototypeChain(context.local(),
+                                                         v8_str("f"));
   CHECK(try_catch.HasCaught());
   try_catch.Reset();
   CHECK(result.IsEmpty());
 
-  result = another->Get(v8_str("f"));
+  attr = another->GetRealNamedPropertyAttributesInPrototypeChain(
+      context.local(), v8_str("f"));
+  CHECK(!try_catch.HasCaught());
+  CHECK(Just(None) == attr);
+
+  result = another->Get(context.local(), v8_str("f"));
   CHECK(try_catch.HasCaught());
   try_catch.Reset();
   CHECK(result.IsEmpty());
 
-  result = with_js_getter->GetRealNamedProperty(v8_str("f"));
+  result = with_js_getter->GetRealNamedProperty(context.local(), v8_str("f"));
   CHECK(try_catch.HasCaught());
   try_catch.Reset();
   CHECK(result.IsEmpty());
 
-  result = with_js_getter->Get(v8_str("f"));
+  attr = with_js_getter->GetRealNamedPropertyAttributes(context.local(),
+                                                        v8_str("f"));
+  CHECK(!try_catch.HasCaught());
+  CHECK(Just(None) == attr);
+
+  result = with_js_getter->Get(context.local(), v8_str("f"));
   CHECK(try_catch.HasCaught());
   try_catch.Reset();
   CHECK(result.IsEmpty());
@@ -13793,7 +12646,7 @@
 
 static void ThrowingCallbackWithTryCatch(
     const v8::FunctionCallbackInfo<v8::Value>& args) {
-  TryCatch try_catch;
+  TryCatch try_catch(args.GetIsolate());
   // Verboseness is important: it triggers message delivery which can call into
   // external code.
   try_catch.SetVerbose(true);
@@ -13807,23 +12660,23 @@
 static int call_depth;
 
 
-static void WithTryCatch(Handle<Message> message, Handle<Value> data) {
-  TryCatch try_catch;
+static void WithTryCatch(Local<Message> message, Local<Value> data) {
+  TryCatch try_catch(CcTest::isolate());
 }
 
 
-static void ThrowFromJS(Handle<Message> message, Handle<Value> data) {
+static void ThrowFromJS(Local<Message> message, Local<Value> data) {
   if (--call_depth) CompileRun("throw 'ThrowInJS';");
 }
 
 
-static void ThrowViaApi(Handle<Message> message, Handle<Value> data) {
+static void ThrowViaApi(Local<Message> message, Local<Value> data) {
   if (--call_depth) CcTest::isolate()->ThrowException(v8_str("ThrowViaApi"));
 }
 
 
-static void WebKitLike(Handle<Message> message, Handle<Value> data) {
-  Handle<String> errorMessageString = message->Get();
+static void WebKitLike(Local<Message> message, Local<Value> data) {
+  Local<String> errorMessageString = message->Get();
   CHECK(!errorMessageString.IsEmpty());
   message->GetStackTrace();
   message->GetScriptOrigin().ResourceName();
@@ -13836,16 +12689,18 @@
   HandleScope scope(isolate);
 
   Local<Function> func =
-      FunctionTemplate::New(isolate,
-                            ThrowingCallbackWithTryCatch)->GetFunction();
-  context->Global()->Set(v8_str("func"), func);
+      FunctionTemplate::New(isolate, ThrowingCallbackWithTryCatch)
+          ->GetFunction(context.local())
+          .ToLocalChecked();
+  CHECK(
+      context->Global()->Set(context.local(), v8_str("func"), func).FromJust());
 
   MessageCallback callbacks[] =
       { NULL, WebKitLike, ThrowViaApi, ThrowFromJS, WithTryCatch };
   for (unsigned i = 0; i < sizeof(callbacks)/sizeof(callbacks[0]); i++) {
     MessageCallback callback = callbacks[i];
     if (callback != NULL) {
-      V8::AddMessageListener(callback);
+      isolate->AddMessageListener(callback);
     }
     // Some small number to control number of times message handler should
     // throw an exception.
@@ -13855,7 +12710,7 @@
         "try { func(); } catch(e) { thrown = true; }\n"
         "thrown\n");
     if (callback != NULL) {
-      V8::RemoveMessageListeners(callback);
+      isolate->RemoveMessageListeners(callback);
     }
   }
 }
@@ -13902,34 +12757,39 @@
   // so 'h' can be shadowed on the instance object.
   Local<ObjectTemplate> child_proto_templ = child_templ->PrototypeTemplate();
   child_proto_templ->SetAccessor(v8_str("h"), ParentGetter, 0,
-      v8::Handle<Value>(), v8::DEFAULT, v8::ReadOnly);
+                                 v8::Local<Value>(), v8::DEFAULT, v8::ReadOnly);
 
   // Add 'i' as an accessor to the instance template with ReadOnly attributes
   // but the attribute does not have effect because it is duplicated with
   // NULL setter.
   child_instance_templ->SetAccessor(v8_str("i"), ChildGetter, 0,
-      v8::Handle<Value>(), v8::DEFAULT, v8::ReadOnly);
-
+                                    v8::Local<Value>(), v8::DEFAULT,
+                                    v8::ReadOnly);
 
 
   // Instantiate the child template.
-  Local<v8::Object> instance = child_templ->GetFunction()->NewInstance();
+  Local<v8::Object> instance = child_templ->GetFunction(context.local())
+                                   .ToLocalChecked()
+                                   ->NewInstance(context.local())
+                                   .ToLocalChecked();
 
   // Check that the child function overrides the parent one.
-  context->Global()->Set(v8_str("o"), instance);
-  Local<Value> value = v8_compile("o.f")->Run();
+  CHECK(context->Global()
+            ->Set(context.local(), v8_str("o"), instance)
+            .FromJust());
+  Local<Value> value = v8_compile("o.f")->Run(context.local()).ToLocalChecked();
   // Check that the 'g' that was added last is hit.
-  CHECK_EQ(42, value->Int32Value());
-  value = v8_compile("o.g")->Run();
-  CHECK_EQ(42, value->Int32Value());
+  CHECK_EQ(42, value->Int32Value(context.local()).FromJust());
+  value = v8_compile("o.g")->Run(context.local()).ToLocalChecked();
+  CHECK_EQ(42, value->Int32Value(context.local()).FromJust());
 
   // Check that 'h' cannot be shadowed.
-  value = v8_compile("o.h = 3; o.h")->Run();
-  CHECK_EQ(1, value->Int32Value());
+  value = v8_compile("o.h = 3; o.h")->Run(context.local()).ToLocalChecked();
+  CHECK_EQ(1, value->Int32Value(context.local()).FromJust());
 
   // Check that 'i' cannot be shadowed or changed.
-  value = v8_compile("o.i = 3; o.i")->Run();
-  CHECK_EQ(42, value->Int32Value());
+  value = v8_compile("o.i = 3; o.i")->Run(context.local()).ToLocalChecked();
+  CHECK_EQ(42, value->Int32Value(context.local()).FromJust());
 }
 
 
@@ -13950,11 +12810,14 @@
 
   LocalContext context;
 
-  context->Global()->Set(v8_str("f"), templ->GetFunction());
-  Local<Value> value = v8_compile("f()")->Run();
-  CHECK(!value->BooleanValue());
-  value = v8_compile("new f()")->Run();
-  CHECK(value->BooleanValue());
+  CHECK(context->Global()
+            ->Set(context.local(), v8_str("f"),
+                  templ->GetFunction(context.local()).ToLocalChecked())
+            .FromJust());
+  Local<Value> value = v8_compile("f()")->Run(context.local()).ToLocalChecked();
+  CHECK(!value->BooleanValue(context.local()).FromJust());
+  value = v8_compile("new f()")->Run(context.local()).ToLocalChecked();
+  CHECK(value->BooleanValue(context.local()).FromJust());
 }
 
 
@@ -13969,27 +12832,41 @@
   Local<String> customized_tostring = v8_str("customized toString");
 
   // Replace Object.prototype.toString
-  v8_compile("Object.prototype.toString = function() {"
-                  "  return 'customized toString';"
-                  "}")->Run();
+  v8_compile(
+      "Object.prototype.toString = function() {"
+      "  return 'customized toString';"
+      "}")
+      ->Run(context.local())
+      .ToLocalChecked();
 
   // Normal ToString call should call replaced Object.prototype.toString
-  Local<v8::Object> instance = templ->GetFunction()->NewInstance();
-  Local<String> value = instance->ToString(isolate);
-  CHECK(value->IsString() && value->Equals(customized_tostring));
+  Local<v8::Object> instance = templ->GetFunction(context.local())
+                                   .ToLocalChecked()
+                                   ->NewInstance(context.local())
+                                   .ToLocalChecked();
+  Local<String> value = instance->ToString(context.local()).ToLocalChecked();
+  CHECK(value->IsString() &&
+        value->Equals(context.local(), customized_tostring).FromJust());
 
   // ObjectProtoToString should not call replace toString function.
-  value = instance->ObjectProtoToString();
-  CHECK(value->IsString() && value->Equals(v8_str("[object MyClass]")));
+  value = instance->ObjectProtoToString(context.local()).ToLocalChecked();
+  CHECK(value->IsString() &&
+        value->Equals(context.local(), v8_str("[object MyClass]")).FromJust());
 
   // Check global
-  value = context->Global()->ObjectProtoToString();
-  CHECK(value->IsString() && value->Equals(v8_str("[object global]")));
+  value =
+      context->Global()->ObjectProtoToString(context.local()).ToLocalChecked();
+  CHECK(value->IsString() &&
+        value->Equals(context.local(), v8_str("[object global]")).FromJust());
 
   // Check ordinary object
-  Local<Value> object = v8_compile("new Object()")->Run();
-  value = object.As<v8::Object>()->ObjectProtoToString();
-  CHECK(value->IsString() && value->Equals(v8_str("[object Object]")));
+  Local<Value> object =
+      v8_compile("new Object()")->Run(context.local()).ToLocalChecked();
+  value = object.As<v8::Object>()
+              ->ObjectProtoToString(context.local())
+              .ToLocalChecked();
+  CHECK(value->IsString() &&
+        value->Equals(context.local(), v8_str("[object Object]")).FromJust());
 }
 
 
@@ -14011,76 +12888,145 @@
       "}");
 
   // Normal ToString call should call replaced Object.prototype.toString
-  Local<v8::Object> instance = templ->GetFunction()->NewInstance();
-  Local<String> value = instance->ToString(isolate);
-  CHECK(value->IsString() && value->Equals(customized_tostring));
+  Local<v8::Object> instance = templ->GetFunction(context.local())
+                                   .ToLocalChecked()
+                                   ->NewInstance(context.local())
+                                   .ToLocalChecked();
+  Local<String> value = instance->ToString(context.local()).ToLocalChecked();
+  CHECK(value->IsString() &&
+        value->Equals(context.local(), customized_tostring).FromJust());
 
   // ObjectProtoToString should not call replace toString function.
-  value = instance->ObjectProtoToString();
-  CHECK(value->IsString() && value->Equals(v8_str("[object MyClass]")));
+  value = instance->ObjectProtoToString(context.local()).ToLocalChecked();
+  CHECK(value->IsString() &&
+        value->Equals(context.local(), v8_str("[object MyClass]")).FromJust());
 
   // Check global
-  value = context->Global()->ObjectProtoToString();
-  CHECK(value->IsString() && value->Equals(v8_str("[object global]")));
+  value =
+      context->Global()->ObjectProtoToString(context.local()).ToLocalChecked();
+  CHECK(value->IsString() &&
+        value->Equals(context.local(), v8_str("[object global]")).FromJust());
 
   // Check ordinary object
   Local<Value> object = CompileRun("new Object()");
-  value = object.As<v8::Object>()->ObjectProtoToString();
-  CHECK(value->IsString() && value->Equals(v8_str("[object Object]")));
+  value = object.As<v8::Object>()
+              ->ObjectProtoToString(context.local())
+              .ToLocalChecked();
+  CHECK(value->IsString() &&
+        value->Equals(context.local(), v8_str("[object Object]")).FromJust());
 
   // Check that ES6 semantics using @@toStringTag work
   Local<v8::Symbol> toStringTag = v8::Symbol::GetToStringTag(isolate);
 
-#define TEST_TOSTRINGTAG(type, tag, expected)                \
-  do {                                                       \
-    object = CompileRun("new " #type "()");                  \
-    object.As<v8::Object>()->Set(toStringTag, v8_str(#tag)); \
-    value = object.As<v8::Object>()->ObjectProtoToString();  \
-    CHECK(value->IsString() &&                               \
-          value->Equals(v8_str("[object " #expected "]")));  \
+#define TEST_TOSTRINGTAG(type, tag, expected)                              \
+  do {                                                                     \
+    object = CompileRun("new " #type "()");                                \
+    CHECK(object.As<v8::Object>()                                          \
+              ->Set(context.local(), toStringTag, v8_str(#tag))            \
+              .FromJust());                                                \
+    value = object.As<v8::Object>()                                        \
+                ->ObjectProtoToString(context.local())                     \
+                .ToLocalChecked();                                         \
+    CHECK(value->IsString() &&                                             \
+          value->Equals(context.local(), v8_str("[object " #expected "]")) \
+              .FromJust());                                                \
   } while (0)
 
   TEST_TOSTRINGTAG(Array, Object, Object);
-  TEST_TOSTRINGTAG(Object, Arguments, ~Arguments);
-  TEST_TOSTRINGTAG(Object, Array, ~Array);
-  TEST_TOSTRINGTAG(Object, Boolean, ~Boolean);
-  TEST_TOSTRINGTAG(Object, Date, ~Date);
-  TEST_TOSTRINGTAG(Object, Error, ~Error);
-  TEST_TOSTRINGTAG(Object, Function, ~Function);
-  TEST_TOSTRINGTAG(Object, Number, ~Number);
-  TEST_TOSTRINGTAG(Object, RegExp, ~RegExp);
-  TEST_TOSTRINGTAG(Object, String, ~String);
+  TEST_TOSTRINGTAG(Object, Arguments, Arguments);
+  TEST_TOSTRINGTAG(Object, Array, Array);
+  TEST_TOSTRINGTAG(Object, Boolean, Boolean);
+  TEST_TOSTRINGTAG(Object, Date, Date);
+  TEST_TOSTRINGTAG(Object, Error, Error);
+  TEST_TOSTRINGTAG(Object, Function, Function);
+  TEST_TOSTRINGTAG(Object, Number, Number);
+  TEST_TOSTRINGTAG(Object, RegExp, RegExp);
+  TEST_TOSTRINGTAG(Object, String, String);
   TEST_TOSTRINGTAG(Object, Foo, Foo);
 
 #undef TEST_TOSTRINGTAG
 
+  Local<v8::RegExp> valueRegExp =
+      v8::RegExp::New(context.local(), v8_str("^$"), v8::RegExp::kNone)
+          .ToLocalChecked();
+  Local<Value> valueNumber = v8_num(123);
+  Local<v8::Symbol> valueSymbol = v8_symbol("TestSymbol");
+  Local<v8::Function> valueFunction =
+      CompileRun("(function fn() {})").As<v8::Function>();
+  Local<v8::Object> valueObject = v8::Object::New(v8::Isolate::GetCurrent());
+  Local<v8::Primitive> valueNull = v8::Null(v8::Isolate::GetCurrent());
+  Local<v8::Primitive> valueUndef = v8::Undefined(v8::Isolate::GetCurrent());
+
+#define TEST_TOSTRINGTAG(type, tagValue, expected)                         \
+  do {                                                                     \
+    object = CompileRun("new " #type "()");                                \
+    CHECK(object.As<v8::Object>()                                          \
+              ->Set(context.local(), toStringTag, tagValue)                \
+              .FromJust());                                                \
+    value = object.As<v8::Object>()                                        \
+                ->ObjectProtoToString(context.local())                     \
+                .ToLocalChecked();                                         \
+    CHECK(value->IsString() &&                                             \
+          value->Equals(context.local(), v8_str("[object " #expected "]")) \
+              .FromJust());                                                \
+  } while (0)
+
+#define TEST_TOSTRINGTAG_TYPES(tagValue)                    \
+  TEST_TOSTRINGTAG(Array, tagValue, Array);                 \
+  TEST_TOSTRINGTAG(Object, tagValue, Object);               \
+  TEST_TOSTRINGTAG(Function, tagValue, Function);           \
+  TEST_TOSTRINGTAG(Date, tagValue, Date);                   \
+  TEST_TOSTRINGTAG(RegExp, tagValue, RegExp);               \
+  TEST_TOSTRINGTAG(Error, tagValue, Error);                 \
+
+  // Test non-String-valued @@toStringTag
+  TEST_TOSTRINGTAG_TYPES(valueRegExp);
+  TEST_TOSTRINGTAG_TYPES(valueNumber);
+  TEST_TOSTRINGTAG_TYPES(valueSymbol);
+  TEST_TOSTRINGTAG_TYPES(valueFunction);
+  TEST_TOSTRINGTAG_TYPES(valueObject);
+  TEST_TOSTRINGTAG_TYPES(valueNull);
+  TEST_TOSTRINGTAG_TYPES(valueUndef);
+
+#undef TEST_TOSTRINGTAG
+#undef TEST_TOSTRINGTAG_TYPES
+
   // @@toStringTag getter throws
   Local<Value> obj = v8::Object::New(isolate);
-  obj.As<v8::Object>()->SetAccessor(toStringTag, ThrowingSymbolAccessorGetter);
+  obj.As<v8::Object>()
+      ->SetAccessor(context.local(), toStringTag, ThrowingSymbolAccessorGetter)
+      .FromJust();
   {
-    TryCatch try_catch;
-    value = obj.As<v8::Object>()->ObjectProtoToString();
-    CHECK(value.IsEmpty());
+    TryCatch try_catch(isolate);
+    CHECK(obj.As<v8::Object>()->ObjectProtoToString(context.local()).IsEmpty());
     CHECK(try_catch.HasCaught());
   }
 
   // @@toStringTag getter does not throw
   obj = v8::Object::New(isolate);
-  obj.As<v8::Object>()->SetAccessor(
-      toStringTag, SymbolAccessorGetterReturnsDefault, 0, v8_str("Test"));
+  obj.As<v8::Object>()
+      ->SetAccessor(context.local(), toStringTag,
+                    SymbolAccessorGetterReturnsDefault, 0, v8_str("Test"))
+      .FromJust();
   {
-    TryCatch try_catch;
-    value = obj.As<v8::Object>()->ObjectProtoToString();
-    CHECK(value->IsString() && value->Equals(v8_str("[object Test]")));
+    TryCatch try_catch(isolate);
+    value = obj.As<v8::Object>()
+                ->ObjectProtoToString(context.local())
+                .ToLocalChecked();
+    CHECK(value->IsString() &&
+          value->Equals(context.local(), v8_str("[object Test]")).FromJust());
     CHECK(!try_catch.HasCaught());
   }
 
   // JS @@toStringTag value
   obj = CompileRun("obj = {}; obj[Symbol.toStringTag] = 'Test'; obj");
   {
-    TryCatch try_catch;
-    value = obj.As<v8::Object>()->ObjectProtoToString();
-    CHECK(value->IsString() && value->Equals(v8_str("[object Test]")));
+    TryCatch try_catch(isolate);
+    value = obj.As<v8::Object>()
+                ->ObjectProtoToString(context.local())
+                .ToLocalChecked();
+    CHECK(value->IsString() &&
+          value->Equals(context.local(), v8_str("[object Test]")).FromJust());
     CHECK(!try_catch.HasCaught());
   }
 
@@ -14090,9 +13036,8 @@
       "  get: function() { throw 'Test'; }"
       "}); obj");
   {
-    TryCatch try_catch;
-    value = obj.As<v8::Object>()->ObjectProtoToString();
-    CHECK(value.IsEmpty());
+    TryCatch try_catch(isolate);
+    CHECK(obj.As<v8::Object>()->ObjectProtoToString(context.local()).IsEmpty());
     CHECK(try_catch.HasCaught());
   }
 
@@ -14102,9 +13047,12 @@
       "  get: function() { return 'Test'; }"
       "}); obj");
   {
-    TryCatch try_catch;
-    value = obj.As<v8::Object>()->ObjectProtoToString();
-    CHECK(value->IsString() && value->Equals(v8_str("[object Test]")));
+    TryCatch try_catch(isolate);
+    value = obj.As<v8::Object>()
+                ->ObjectProtoToString(context.local())
+                .ToLocalChecked();
+    CHECK(value->IsString() &&
+          value->Equals(context.local(), v8_str("[object Test]")).FromJust());
     CHECK(!try_catch.HasCaught());
   }
 }
@@ -14114,26 +13062,87 @@
   v8::Isolate* isolate = CcTest::isolate();
   LocalContext context;
   v8::HandleScope scope(isolate);
-  v8_compile("function Parent() {};"
-             "function Child() {};"
-             "Child.prototype = new Parent();"
-             "var outer = { inner: function() { } };"
-             "var p = new Parent();"
-             "var c = new Child();"
-             "var x = new outer.inner();")->Run();
+  v8_compile(
+      "function Parent() {};"
+      "function Child() {};"
+      "Child.prototype = new Parent();"
+      "Child.prototype.constructor = Child;"
+      "var outer = { inner: function() { } };"
+      "var p = new Parent();"
+      "var c = new Child();"
+      "var x = new outer.inner();"
+      "var proto = Child.prototype;")
+      ->Run(context.local())
+      .ToLocalChecked();
 
-  Local<v8::Value> p = context->Global()->Get(v8_str("p"));
+  Local<v8::Value> p =
+      context->Global()->Get(context.local(), v8_str("p")).ToLocalChecked();
   CHECK(p->IsObject() &&
-        p->ToObject(isolate)->GetConstructorName()->Equals(v8_str("Parent")));
+        p->ToObject(context.local())
+            .ToLocalChecked()
+            ->GetConstructorName()
+            ->Equals(context.local(), v8_str("Parent"))
+            .FromJust());
 
-  Local<v8::Value> c = context->Global()->Get(v8_str("c"));
+  Local<v8::Value> c =
+      context->Global()->Get(context.local(), v8_str("c")).ToLocalChecked();
   CHECK(c->IsObject() &&
-        c->ToObject(isolate)->GetConstructorName()->Equals(v8_str("Child")));
+        c->ToObject(context.local())
+            .ToLocalChecked()
+            ->GetConstructorName()
+            ->Equals(context.local(), v8_str("Child"))
+            .FromJust());
 
-  Local<v8::Value> x = context->Global()->Get(v8_str("x"));
+  Local<v8::Value> x =
+      context->Global()->Get(context.local(), v8_str("x")).ToLocalChecked();
   CHECK(x->IsObject() &&
-        x->ToObject(isolate)->GetConstructorName()->Equals(
-            v8_str("outer.inner")));
+        x->ToObject(context.local())
+            .ToLocalChecked()
+            ->GetConstructorName()
+            ->Equals(context.local(), v8_str("outer.inner"))
+            .FromJust());
+
+  Local<v8::Value> child_prototype =
+      context->Global()->Get(context.local(), v8_str("proto")).ToLocalChecked();
+  CHECK(child_prototype->IsObject() &&
+        child_prototype->ToObject(context.local())
+            .ToLocalChecked()
+            ->GetConstructorName()
+            ->Equals(context.local(), v8_str("Parent"))
+            .FromJust());
+}
+
+
+THREADED_TEST(SubclassGetConstructorName) {
+  v8::Isolate* isolate = CcTest::isolate();
+  LocalContext context;
+  v8::HandleScope scope(isolate);
+  v8_compile(
+      "\"use strict\";"
+      "class Parent {}"
+      "class Child extends Parent {}"
+      "var p = new Parent();"
+      "var c = new Child();")
+      ->Run(context.local())
+      .ToLocalChecked();
+
+  Local<v8::Value> p =
+      context->Global()->Get(context.local(), v8_str("p")).ToLocalChecked();
+  CHECK(p->IsObject() &&
+        p->ToObject(context.local())
+            .ToLocalChecked()
+            ->GetConstructorName()
+            ->Equals(context.local(), v8_str("Parent"))
+            .FromJust());
+
+  Local<v8::Value> c =
+      context->Global()->Get(context.local(), v8_str("c")).ToLocalChecked();
+  CHECK(c->IsObject() &&
+        c->ToObject(context.local())
+            .ToLocalChecked()
+            ->GetConstructorName()
+            ->Equals(context.local(), v8_str("Child"))
+            .FromJust());
 }
 
 
@@ -14308,9 +13317,10 @@
   {
     v8::Locker nested_locker(isolate);
     v8::HandleScope scope(isolate);
-    v8::Handle<Value> exception;
-    { v8::TryCatch try_catch;
-      v8::Handle<Value> value = CompileRun(code);
+    v8::Local<Value> exception;
+    {
+      v8::TryCatch try_catch(isolate);
+      v8::Local<Value> value = CompileRun(code);
       CHECK(value.IsEmpty());
       CHECK(try_catch.HasCaught());
       // Make sure to wrap the exception in a new handle because
@@ -14331,7 +13341,7 @@
   {
     v8::Locker nested_locker(CcTest::isolate());
     v8::HandleScope scope(args.GetIsolate());
-    v8::Handle<Value> value = CompileRun(code);
+    v8::Local<Value> value = CompileRun(code);
     CHECK(value.IsEmpty());
     args.GetReturnValue().Set(v8_str("foo"));
   }
@@ -14348,8 +13358,8 @@
   v8::HandleScope scope(env->GetIsolate());
   Local<v8::FunctionTemplate> fun_templ =
       v8::FunctionTemplate::New(isolate, ThrowInJS);
-  Local<Function> fun = fun_templ->GetFunction();
-  env->Global()->Set(v8_str("throw_in_js"), fun);
+  Local<Function> fun = fun_templ->GetFunction(env.local()).ToLocalChecked();
+  CHECK(env->Global()->Set(env.local(), v8_str("throw_in_js"), fun).FromJust());
   Local<Script> script = v8_compile("(function () {"
                                     "  try {"
                                     "    throw_in_js();"
@@ -14358,7 +13368,10 @@
                                     "    return e * 13;"
                                     "  }"
                                     "})();");
-  CHECK_EQ(91, script->Run()->Int32Value());
+  CHECK_EQ(91, script->Run(env.local())
+                   .ToLocalChecked()
+                   ->Int32Value(env.local())
+                   .FromJust());
 }
 
 
@@ -14370,8 +13383,8 @@
   v8::HandleScope scope(env->GetIsolate());
   Local<v8::FunctionTemplate> fun_templ =
       v8::FunctionTemplate::New(env->GetIsolate(), ThrowInJSNoCatch);
-  Local<Function> fun = fun_templ->GetFunction();
-  env->Global()->Set(v8_str("throw_in_js"), fun);
+  Local<Function> fun = fun_templ->GetFunction(env.local()).ToLocalChecked();
+  CHECK(env->Global()->Set(env.local(), v8_str("throw_in_js"), fun).FromJust());
   Local<Script> script = v8_compile("(function () {"
                                     "  try {"
                                     "    throw_in_js();"
@@ -14380,7 +13393,10 @@
                                     "    return e * 13;"
                                     "  }"
                                     "})();");
-  CHECK_EQ(91, script->Run()->Int32Value());
+  CHECK_EQ(91, script->Run(env.local())
+                   .ToLocalChecked()
+                   ->Int32Value(env.local())
+                   .FromJust());
 }
 
 
@@ -14406,13 +13422,18 @@
     LocalContext env;
     Local<v8::FunctionTemplate> fun_templ =
         v8::FunctionTemplate::New(CcTest::isolate(), UnlockForAMoment);
-    Local<Function> fun = fun_templ->GetFunction();
-    env->Global()->Set(v8_str("unlock_for_a_moment"), fun);
+    Local<Function> fun = fun_templ->GetFunction(env.local()).ToLocalChecked();
+    CHECK(env->Global()
+              ->Set(env.local(), v8_str("unlock_for_a_moment"), fun)
+              .FromJust());
     Local<Script> script = v8_compile("(function () {"
                                       "  unlock_for_a_moment();"
                                       "  return 42;"
                                       "})();");
-    CHECK_EQ(42, script->Run()->Int32Value());
+    CHECK_EQ(42, script->Run(env.local())
+                     .ToLocalChecked()
+                     ->Int32Value(env.local())
+                     .FromJust());
   }
   {
     v8::Locker locker(CcTest::isolate());
@@ -14420,13 +13441,18 @@
     LocalContext env;
     Local<v8::FunctionTemplate> fun_templ =
         v8::FunctionTemplate::New(CcTest::isolate(), UnlockForAMoment);
-    Local<Function> fun = fun_templ->GetFunction();
-    env->Global()->Set(v8_str("unlock_for_a_moment"), fun);
+    Local<Function> fun = fun_templ->GetFunction(env.local()).ToLocalChecked();
+    CHECK(env->Global()
+              ->Set(env.local(), v8_str("unlock_for_a_moment"), fun)
+              .FromJust());
     Local<Script> script = v8_compile("(function () {"
                                       "  unlock_for_a_moment();"
                                       "  return 42;"
                                       "})();");
-    CHECK_EQ(42, script->Run()->Int32Value());
+    CHECK_EQ(42, script->Run(env.local())
+                     .ToLocalChecked()
+                     ->Int32Value(env.local())
+                     .FromJust());
   }
 }
 
@@ -14435,7 +13461,13 @@
   int count = 0;
   i::HeapIterator it(CcTest::heap());
   for (i::HeapObject* object = it.next(); object != NULL; object = it.next())
-    if (object->IsJSGlobalObject()) count++;
+    if (object->IsJSGlobalObject()) {
+      i::JSGlobalObject* g = i::JSGlobalObject::cast(object);
+      // Skip dummy global object.
+      if (i::GlobalDictionary::cast(g->properties())->NumberOfElements() != 0) {
+        count++;
+      }
+    }
   return count;
 }
 
@@ -14446,7 +13478,7 @@
   // the first garbage collection but some of the maps have already
   // been marked at that point.  Therefore some of the maps are not
   // collected until the second garbage collection.
-  CcTest::heap()->CollectAllGarbage(i::Heap::kNoGCFlags);
+  CcTest::heap()->CollectAllGarbage();
   CcTest::heap()->CollectAllGarbage(i::Heap::kMakeHeapIterableMask);
   int count = GetGlobalObjectsCount();
 #ifdef DEBUG
@@ -14471,14 +13503,14 @@
 
     { v8::HandleScope scope(CcTest::isolate());
       LocalContext context;
-      v8_compile("Date")->Run();
+      v8_compile("Date")->Run(context.local()).ToLocalChecked();
     }
     CcTest::isolate()->ContextDisposedNotification();
     CheckSurvivingGlobalObjectsCount(0);
 
     { v8::HandleScope scope(CcTest::isolate());
       LocalContext context;
-      v8_compile("/aaa/")->Run();
+      v8_compile("/aaa/")->Run(context.local()).ToLocalChecked();
     }
     CcTest::isolate()->ContextDisposedNotification();
     CheckSurvivingGlobalObjectsCount(0);
@@ -14487,7 +13519,7 @@
       const char* extension_list[] = { "v8/gc" };
       v8::ExtensionConfiguration extensions(1, extension_list);
       LocalContext context(&extensions);
-      v8_compile("gc();")->Run();
+      v8_compile("gc();")->Run(context.local()).ToLocalChecked();
     }
     CcTest::isolate()->ContextDisposedNotification();
     CheckSurvivingGlobalObjectsCount(0);
@@ -14524,9 +13556,7 @@
 
 
 static void WeakApiCallback(
-    const v8::WeakCallbackData<v8::Object, Persistent<v8::Object> >& data) {
-  Local<Value> value = data.GetValue()->Get(v8_str("key"));
-  CHECK_EQ(231, static_cast<int32_t>(Local<v8::Integer>::Cast(value)->Value()));
+    const v8::WeakCallbackInfo<Persistent<v8::Object>>& data) {
   data.GetParameter()->Reset();
   delete data.GetParameter();
 }
@@ -14541,14 +13571,16 @@
   {
     v8::HandleScope scope(isolate);
     v8::Local<v8::Object> obj = v8::Object::New(isolate);
-    obj->Set(v8_str("key"), v8::Integer::New(isolate, 231));
+    CHECK(
+        obj->Set(context.local(), v8_str("key"), v8::Integer::New(isolate, 231))
+            .FromJust());
     v8::Persistent<v8::Object>* handle =
         new v8::Persistent<v8::Object>(isolate, obj);
-    handle->SetWeak<v8::Object, v8::Persistent<v8::Object> >(handle,
-                                                             WeakApiCallback);
+    handle->SetWeak<v8::Persistent<v8::Object>>(
+        handle, WeakApiCallback, v8::WeakCallbackType::kParameter);
   }
-  reinterpret_cast<i::Isolate*>(isolate)->heap()->
-      CollectAllGarbage(i::Heap::kNoGCFlags);
+  reinterpret_cast<i::Isolate*>(isolate)->heap()->CollectAllGarbage(
+      i::Heap::kAbortIncrementalMarkingMask);
   // Verify disposed.
   CHECK_EQ(initial_handles, globals->global_handles_count());
 }
@@ -14557,11 +13589,18 @@
 v8::Persistent<v8::Object> some_object;
 v8::Persistent<v8::Object> bad_handle;
 
-void NewPersistentHandleCallback(
-    const v8::WeakCallbackData<v8::Object, v8::Persistent<v8::Object> >& data) {
+
+void NewPersistentHandleCallback2(
+    const v8::WeakCallbackInfo<v8::Persistent<v8::Object>>& data) {
   v8::HandleScope scope(data.GetIsolate());
   bad_handle.Reset(data.GetIsolate(), some_object);
+}
+
+
+void NewPersistentHandleCallback1(
+    const v8::WeakCallbackInfo<v8::Persistent<v8::Object>>& data) {
   data.GetParameter()->Reset();
+  data.SetSecondPassCallback(NewPersistentHandleCallback2);
 }
 
 
@@ -14580,19 +13619,27 @@
   // global handle nodes are processed by PostGarbageCollectionProcessing
   // in reverse allocation order, so if second allocated handle is deleted,
   // weak callback of the first handle would be able to 'reallocate' it.
-  handle1.SetWeak(&handle1, NewPersistentHandleCallback);
+  handle1.SetWeak(&handle1, NewPersistentHandleCallback1,
+                  v8::WeakCallbackType::kParameter);
   handle2.Reset();
-  CcTest::heap()->CollectAllGarbage(i::Heap::kAbortIncrementalMarkingMask);
+  CcTest::heap()->CollectAllGarbage();
 }
 
 
 v8::Persistent<v8::Object> to_be_disposed;
 
-void DisposeAndForceGcCallback(
-    const v8::WeakCallbackData<v8::Object, v8::Persistent<v8::Object> >& data) {
+
+void DisposeAndForceGcCallback2(
+    const v8::WeakCallbackInfo<v8::Persistent<v8::Object>>& data) {
   to_be_disposed.Reset();
-  CcTest::heap()->CollectAllGarbage(i::Heap::kNoGCFlags);
+  CcTest::heap()->CollectAllGarbage();
+}
+
+
+void DisposeAndForceGcCallback1(
+    const v8::WeakCallbackInfo<v8::Persistent<v8::Object>>& data) {
   data.GetParameter()->Reset();
+  data.SetSecondPassCallback(DisposeAndForceGcCallback2);
 }
 
 
@@ -14606,26 +13653,33 @@
     handle1.Reset(isolate, v8::Object::New(isolate));
     handle2.Reset(isolate, v8::Object::New(isolate));
   }
-  handle1.SetWeak(&handle1, DisposeAndForceGcCallback);
+  handle1.SetWeak(&handle1, DisposeAndForceGcCallback1,
+                  v8::WeakCallbackType::kParameter);
   to_be_disposed.Reset(isolate, handle2);
-  CcTest::heap()->CollectAllGarbage(i::Heap::kAbortIncrementalMarkingMask);
+  CcTest::heap()->CollectAllGarbage();
 }
 
 void DisposingCallback(
-    const v8::WeakCallbackData<v8::Object, v8::Persistent<v8::Object> >& data) {
+    const v8::WeakCallbackInfo<v8::Persistent<v8::Object>>& data) {
   data.GetParameter()->Reset();
 }
 
-void HandleCreatingCallback(
-    const v8::WeakCallbackData<v8::Object, v8::Persistent<v8::Object> >& data) {
+void HandleCreatingCallback2(
+    const v8::WeakCallbackInfo<v8::Persistent<v8::Object>>& data) {
   v8::HandleScope scope(data.GetIsolate());
-  v8::Persistent<v8::Object>(data.GetIsolate(),
-                             v8::Object::New(data.GetIsolate()));
+  v8::Global<v8::Object>(data.GetIsolate(), v8::Object::New(data.GetIsolate()));
+}
+
+
+void HandleCreatingCallback1(
+    const v8::WeakCallbackInfo<v8::Persistent<v8::Object>>& data) {
   data.GetParameter()->Reset();
+  data.SetSecondPassCallback(HandleCreatingCallback2);
 }
 
 
 THREADED_TEST(NoGlobalHandlesOrphaningDueToWeakCallback) {
+  v8::Locker locker(CcTest::isolate());
   LocalContext context;
   v8::Isolate* isolate = context->GetIsolate();
 
@@ -14636,9 +13690,12 @@
     handle2.Reset(isolate, v8::Object::New(isolate));
     handle1.Reset(isolate, v8::Object::New(isolate));
   }
-  handle2.SetWeak(&handle2, DisposingCallback);
-  handle3.SetWeak(&handle3, HandleCreatingCallback);
-  CcTest::heap()->CollectAllGarbage(i::Heap::kAbortIncrementalMarkingMask);
+  handle2.SetWeak(&handle2, DisposingCallback,
+                  v8::WeakCallbackType::kParameter);
+  handle3.SetWeak(&handle3, HandleCreatingCallback1,
+                  v8::WeakCallbackType::kParameter);
+  CcTest::heap()->CollectAllGarbage();
+  EmptyMessageQueues(isolate);
 }
 
 
@@ -14665,7 +13722,7 @@
 }
 
 
-static v8::Handle<Value> NestedScope(v8::Local<Context> env) {
+static v8::Local<Value> NestedScope(v8::Local<Context> env) {
   v8::EscapableHandleScope inner(env->GetIsolate());
   env->Enter();
   v8::Local<Value> three = v8_num(3);
@@ -14680,8 +13737,8 @@
   v8::HandleScope outer(isolate);
   v8::Local<Context> env = Context::New(isolate);
   env->Enter();
-  v8::Handle<Value> value = NestedScope(env);
-  v8::Handle<String> str(value->ToString(isolate));
+  v8::Local<Value> value = NestedScope(env);
+  v8::Local<String> str(value->ToString(env).ToLocalChecked());
   CHECK(!str.IsEmpty());
   env->Exit();
 }
@@ -14928,7 +13985,9 @@
 
   Local<ObjectTemplate> t = ObjectTemplate::New(isolate);
   t->Set(v8_str("asdf"), v8::FunctionTemplate::New(isolate, RuntimeCallback));
-  env->Global()->Set(v8_str("obj"), t->NewInstance());
+  CHECK(env->Global()
+            ->Set(env, v8_str("obj"), t->NewInstance(env).ToLocalChecked())
+            .FromJust());
 
   const char* script =
       "function bar() {\n"
@@ -14941,16 +14000,15 @@
       "// Invoke on the runtime function.\n"
       "obj.asdf()";
   CompileRun(script);
-  bar_func_ = i::Handle<i::JSFunction>::cast(
-          v8::Utils::OpenHandle(*env->Global()->Get(v8_str("bar"))));
-  DCHECK(!bar_func_.is_null());
+  bar_func_ = i::Handle<i::JSFunction>::cast(v8::Utils::OpenHandle(
+      *env->Global()->Get(env, v8_str("bar")).ToLocalChecked()));
+  CHECK(!bar_func_.is_null());
 
-  foo_func_ =
-      i::Handle<i::JSFunction>::cast(
-           v8::Utils::OpenHandle(*env->Global()->Get(v8_str("foo"))));
-  DCHECK(!foo_func_.is_null());
+  foo_func_ = i::Handle<i::JSFunction>::cast(v8::Utils::OpenHandle(
+      *env->Global()->Get(env, v8_str("foo")).ToLocalChecked()));
+  CHECK(!foo_func_.is_null());
 
-  v8::Handle<v8::Value> value = CompileRun("bar();");
+  v8::Local<v8::Value> value = CompileRun("bar();");
   CHECK(value->IsNumber());
   CHECK_EQ(9801.0, v8::Number::Cast(*value)->Value());
 
@@ -14969,6 +14027,7 @@
   v8::Isolate::CreateParams create_params;
   create_params.entry_hook = EntryHook;
   create_params.code_event_handler = JitEvent;
+  create_params.array_buffer_allocator = CcTest::array_buffer_allocator();
   v8::Isolate* isolate = v8::Isolate::New(create_params);
 
   {
@@ -14991,7 +14050,9 @@
   Reset();
 
   // Make sure a second isolate is unaffected by the previous entry hook.
-  isolate = v8::Isolate::New();
+  create_params = v8::Isolate::CreateParams();
+  create_params.array_buffer_allocator = CcTest::array_buffer_allocator();
+  isolate = v8::Isolate::New(create_params);
   {
     v8::Isolate::Scope scope(isolate);
 
@@ -15012,6 +14073,7 @@
   // This test breaks because InstallGetter (function from snapshot that
   // only gets called from experimental natives) is compiled with entry hooks.
   i::FLAG_allow_natives_syntax = true;
+  i::FLAG_turbo_inlining = false;
   i::FLAG_use_inlining = false;
 
   SetFunctionEntryHookTest test;
@@ -15075,10 +14137,8 @@
         CHECK(event->code_start != NULL);
         CHECK_NE(0, static_cast<int>(event->code_len));
         CHECK(event->name.str != NULL);
-        i::HashMap::Entry* entry =
-            code_map->Lookup(event->code_start,
-                             i::ComputePointerHash(event->code_start),
-                             true);
+        i::HashMap::Entry* entry = code_map->LookupOrInsert(
+            event->code_start, i::ComputePointerHash(event->code_start));
         entry->value = reinterpret_cast<void*>(event->code_len);
 
         if (FunctionNameIs("bar", event)) {
@@ -15096,18 +14156,16 @@
         // Compiler::RecordFunctionCompilation) and the line endings
         // calculations can cause a GC, which can move the newly created code
         // before its existence can be logged.
-        i::HashMap::Entry* entry =
-            code_map->Lookup(event->code_start, hash, false);
+        i::HashMap::Entry* entry = code_map->Lookup(event->code_start, hash);
         if (entry != NULL) {
           ++move_events;
 
           CHECK_EQ(reinterpret_cast<void*>(event->code_len), entry->value);
           code_map->Remove(event->code_start, hash);
 
-          entry = code_map->Lookup(event->new_code_start,
-                                   i::ComputePointerHash(event->new_code_start),
-                                   true);
-          CHECK(entry != NULL);
+          entry = code_map->LookupOrInsert(
+              event->new_code_start,
+              i::ComputePointerHash(event->new_code_start));
           entry->value = reinterpret_cast<void*>(event->code_len);
         }
       }
@@ -15125,10 +14183,8 @@
         DummyJitCodeLineInfo* line_info = new DummyJitCodeLineInfo();
         v8::JitCodeEvent* temp_event = const_cast<v8::JitCodeEvent*>(event);
         temp_event->user_data = line_info;
-        i::HashMap::Entry* entry =
-            jitcode_line_info->Lookup(line_info,
-                                      i::ComputePointerHash(line_info),
-                                      true);
+        i::HashMap::Entry* entry = jitcode_line_info->LookupOrInsert(
+            line_info, i::ComputePointerHash(line_info));
         entry->value = reinterpret_cast<void*>(line_info);
       }
       break;
@@ -15139,7 +14195,7 @@
         CHECK(event->user_data != NULL);
         uint32_t hash = i::ComputePointerHash(event->user_data);
         i::HashMap::Entry* entry =
-            jitcode_line_info->Lookup(event->user_data, hash, false);
+            jitcode_line_info->Lookup(event->user_data, hash);
         CHECK(entry != NULL);
         delete reinterpret_cast<DummyJitCodeLineInfo*>(event->user_data);
       }
@@ -15149,7 +14205,7 @@
         CHECK(event->user_data != NULL);
         uint32_t hash = i::ComputePointerHash(event->user_data);
         i::HashMap::Entry* entry =
-            jitcode_line_info->Lookup(event->user_data, hash, false);
+            jitcode_line_info->Lookup(event->user_data, hash);
         CHECK(entry != NULL);
       }
       break;
@@ -15167,22 +14223,27 @@
   i::FLAG_incremental_marking = false;
   if (i::FLAG_never_compact) return;
   const char* script =
-    "function bar() {"
-    "  var sum = 0;"
-    "  for (i = 0; i < 100; ++i)"
-    "    sum = foo(i);"
-    "  return sum;"
-    "}"
-    "function foo(i) { return i * i; };"
-    "bar();";
+      "function bar() {"
+      "  var sum = 0;"
+      "  for (i = 0; i < 10; ++i)"
+      "    sum = foo(i);"
+      "  return sum;"
+      "}"
+      "function foo(i) { return i; };"
+      "bar();";
 
   // Run this test in a new isolate to make sure we don't
   // have remnants of state from other code.
-  v8::Isolate* isolate = v8::Isolate::New();
+  v8::Isolate::CreateParams create_params;
+  create_params.array_buffer_allocator = CcTest::array_buffer_allocator();
+  v8::Isolate* isolate = v8::Isolate::New(create_params);
   isolate->Enter();
   i::Isolate* i_isolate = reinterpret_cast<i::Isolate*>(isolate);
   i::Heap* heap = i_isolate->heap();
 
+  // Start with a clean slate.
+  heap->CollectAllAvailableGarbage("TestSetJitCodeEventHandler_Prepare");
+
   {
     v8::HandleScope scope(isolate);
     i::HashMap code(MatchPointers);
@@ -15206,17 +14267,25 @@
       CompileRun(script);
 
       // Keep a strong reference to the code object in the handle scope.
-      i::Handle<i::Code> bar_code(i::Handle<i::JSFunction>::cast(
-          v8::Utils::OpenHandle(*env->Global()->Get(v8_str("bar"))))->code());
-      i::Handle<i::Code> foo_code(i::Handle<i::JSFunction>::cast(
-          v8::Utils::OpenHandle(*env->Global()->Get(v8_str("foo"))))->code());
+      i::Handle<i::Code> bar_code(
+          i::Handle<i::JSFunction>::cast(
+              v8::Utils::OpenHandle(*env->Global()
+                                         ->Get(env.local(), v8_str("bar"))
+                                         .ToLocalChecked()))
+              ->code());
+      i::Handle<i::Code> foo_code(
+          i::Handle<i::JSFunction>::cast(
+              v8::Utils::OpenHandle(*env->Global()
+                                         ->Get(env.local(), v8_str("foo"))
+                                         .ToLocalChecked()))
+              ->code());
 
       // Clear the compilation cache to get more wastage.
       reinterpret_cast<i::Isolate*>(isolate)->compilation_cache()->Clear();
     }
 
     // Force code movement.
-    heap->CollectAllAvailableGarbage("TestSetJitCodeEventHandler");
+    heap->CollectAllAvailableGarbage("TestSetJitCodeEventHandler_Move");
 
     isolate->SetJitCodeEventHandler(v8::kJitCodeEventDefault, NULL);
 
@@ -15231,7 +14300,7 @@
   isolate->Dispose();
 
   // Do this in a new isolate.
-  isolate = v8::Isolate::New();
+  isolate = v8::Isolate::New(create_params);
   isolate->Enter();
 
   // Verify that we get callbacks for existing code objects when we
@@ -15257,7 +14326,7 @@
     // notifications, we could compare two collections, one created by listening
     // from the time of creation of an isolate, and the other by subscribing
     // with EnumExisting.
-    CHECK_LT(0, code.occupancy());
+    CHECK_LT(0u, code.occupancy());
 
     code_map = NULL;
   }
@@ -15278,6 +14347,23 @@
            isolate->AdjustAmountOfExternalAllocatedMemory(kSize));
   CHECK_EQ(baseline,
            isolate->AdjustAmountOfExternalAllocatedMemory(-kSize));
+  const int64_t kTriggerGCSize =
+      v8::internal::Internals::kExternalAllocationLimit + 1;
+  CHECK_EQ(baseline + kTriggerGCSize,
+           isolate->AdjustAmountOfExternalAllocatedMemory(kTriggerGCSize));
+  CHECK_EQ(baseline,
+           isolate->AdjustAmountOfExternalAllocatedMemory(-kTriggerGCSize));
+}
+
+
+TEST(Regress51719) {
+  i::FLAG_incremental_marking = false;
+  CcTest::InitializeVM();
+
+  const int64_t kTriggerGCSize =
+      v8::internal::Internals::kExternalAllocationLimit + 1;
+  v8::Isolate* isolate = CcTest::isolate();
+  isolate->AdjustAmountOfExternalAllocatedMemory(kTriggerGCSize);
 }
 
 
@@ -15295,8 +14381,10 @@
     local->SetInternalFieldCount(1);
     templ.Reset(isolate, inner.Escape(local));
   }
-  v8::Handle<v8::Object> result =
-      v8::Local<v8::ObjectTemplate>::New(isolate, templ)->NewInstance();
+  v8::Local<v8::Object> result =
+      v8::Local<v8::ObjectTemplate>::New(isolate, templ)
+          ->NewInstance(context.local())
+          .ToLocalChecked();
   CHECK_EQ(1, result->InternalFieldCount());
 }
 
@@ -15306,36 +14394,36 @@
 TEST(CatchStackOverflow) {
   LocalContext context;
   v8::HandleScope scope(context->GetIsolate());
-  v8::TryCatch try_catch;
-  v8::Handle<v8::Value> result = CompileRun(
-    "function f() {"
-    "  return f();"
-    "}"
-    ""
-    "f();");
+  v8::TryCatch try_catch(context->GetIsolate());
+  v8::Local<v8::Value> result = CompileRun(
+      "function f() {"
+      "  return f();"
+      "}"
+      ""
+      "f();");
   CHECK(result.IsEmpty());
 }
 
 
-static void CheckTryCatchSourceInfo(v8::Handle<v8::Script> script,
+static void CheckTryCatchSourceInfo(v8::Local<v8::Script> script,
                                     const char* resource_name,
                                     int line_offset) {
   v8::HandleScope scope(CcTest::isolate());
-  v8::TryCatch try_catch;
-  v8::Handle<v8::Value> result = script->Run();
-  CHECK(result.IsEmpty());
+  v8::TryCatch try_catch(CcTest::isolate());
+  v8::Local<v8::Context> context = CcTest::isolate()->GetCurrentContext();
+  CHECK(script->Run(context).IsEmpty());
   CHECK(try_catch.HasCaught());
-  v8::Handle<v8::Message> message = try_catch.Message();
+  v8::Local<v8::Message> message = try_catch.Message();
   CHECK(!message.IsEmpty());
-  CHECK_EQ(10 + line_offset, message->GetLineNumber());
+  CHECK_EQ(10 + line_offset, message->GetLineNumber(context).FromJust());
   CHECK_EQ(91, message->GetStartPosition());
   CHECK_EQ(92, message->GetEndPosition());
-  CHECK_EQ(2, message->GetStartColumn());
-  CHECK_EQ(3, message->GetEndColumn());
-  v8::String::Utf8Value line(message->GetSourceLine());
-  CHECK_EQ("  throw 'nirk';", *line);
+  CHECK_EQ(2, message->GetStartColumn(context).FromJust());
+  CHECK_EQ(3, message->GetEndColumn(context).FromJust());
+  v8::String::Utf8Value line(message->GetSourceLine(context).ToLocalChecked());
+  CHECK_EQ(0, strcmp("  throw 'nirk';", *line));
   v8::String::Utf8Value name(message->GetScriptOrigin().ResourceName());
-  CHECK_EQ(resource_name, *name);
+  CHECK_EQ(0, strcmp(resource_name, *name));
 }
 
 
@@ -15358,40 +14446,59 @@
       "Foo();\n");
 
   const char* resource_name;
-  v8::Handle<v8::Script> script;
+  v8::Local<v8::Script> script;
   resource_name = "test.js";
   script = CompileWithOrigin(source, resource_name);
   CheckTryCatchSourceInfo(script, resource_name, 0);
 
   resource_name = "test1.js";
-  v8::ScriptOrigin origin1(
-      v8::String::NewFromUtf8(context->GetIsolate(), resource_name));
-  script = v8::Script::Compile(source, &origin1);
+  v8::ScriptOrigin origin1(v8_str(resource_name));
+  script =
+      v8::Script::Compile(context.local(), source, &origin1).ToLocalChecked();
   CheckTryCatchSourceInfo(script, resource_name, 0);
 
   resource_name = "test2.js";
-  v8::ScriptOrigin origin2(
-      v8::String::NewFromUtf8(context->GetIsolate(), resource_name),
-      v8::Integer::New(context->GetIsolate(), 7));
-  script = v8::Script::Compile(source, &origin2);
+  v8::ScriptOrigin origin2(v8_str(resource_name),
+                           v8::Integer::New(context->GetIsolate(), 7));
+  script =
+      v8::Script::Compile(context.local(), source, &origin2).ToLocalChecked();
   CheckTryCatchSourceInfo(script, resource_name, 7);
 }
 
 
+THREADED_TEST(TryCatchSourceInfoForEOSError) {
+  LocalContext context;
+  v8::HandleScope scope(context->GetIsolate());
+  v8::TryCatch try_catch(context->GetIsolate());
+  CHECK(v8::Script::Compile(context.local(), v8_str("!\n")).IsEmpty());
+  CHECK(try_catch.HasCaught());
+  v8::Local<v8::Message> message = try_catch.Message();
+  CHECK_EQ(1, message->GetLineNumber(context.local()).FromJust());
+  CHECK_EQ(0, message->GetStartColumn(context.local()).FromJust());
+}
+
+
 THREADED_TEST(CompilationCache) {
   LocalContext context;
   v8::HandleScope scope(context->GetIsolate());
-  v8::Handle<v8::String> source0 =
-      v8::String::NewFromUtf8(context->GetIsolate(), "1234");
-  v8::Handle<v8::String> source1 =
-      v8::String::NewFromUtf8(context->GetIsolate(), "1234");
-  v8::Handle<v8::Script> script0 = CompileWithOrigin(source0, "test.js");
-  v8::Handle<v8::Script> script1 = CompileWithOrigin(source1, "test.js");
-  v8::Handle<v8::Script> script2 =
-      v8::Script::Compile(source0);  // different origin
-  CHECK_EQ(1234, script0->Run()->Int32Value());
-  CHECK_EQ(1234, script1->Run()->Int32Value());
-  CHECK_EQ(1234, script2->Run()->Int32Value());
+  v8::Local<v8::String> source0 = v8_str("1234");
+  v8::Local<v8::String> source1 = v8_str("1234");
+  v8::Local<v8::Script> script0 = CompileWithOrigin(source0, "test.js");
+  v8::Local<v8::Script> script1 = CompileWithOrigin(source1, "test.js");
+  v8::Local<v8::Script> script2 = v8::Script::Compile(context.local(), source0)
+                                      .ToLocalChecked();  // different origin
+  CHECK_EQ(1234, script0->Run(context.local())
+                     .ToLocalChecked()
+                     ->Int32Value(context.local())
+                     .FromJust());
+  CHECK_EQ(1234, script1->Run(context.local())
+                     .ToLocalChecked()
+                     ->Int32Value(context.local())
+                     .FromJust());
+  CHECK_EQ(1234, script2->Run(context.local())
+                     .ToLocalChecked()
+                     ->Int32Value(context.local())
+                     .FromJust());
 }
 
 
@@ -15409,48 +14516,52 @@
   Local<ObjectTemplate> t = ObjectTemplate::New(isolate);
   t->Set(v8_str("asdf"),
          v8::FunctionTemplate::New(isolate, FunctionNameCallback));
-  context->Global()->Set(v8_str("obj"), t->NewInstance());
-  v8::Handle<v8::Value> value = CompileRun("obj.asdf.name");
+  CHECK(context->Global()
+            ->Set(context.local(), v8_str("obj"),
+                  t->NewInstance(context.local()).ToLocalChecked())
+            .FromJust());
+  v8::Local<v8::Value> value = CompileRun("obj.asdf.name");
   CHECK(value->IsString());
   v8::String::Utf8Value name(value);
-  CHECK_EQ("asdf", *name);
+  CHECK_EQ(0, strcmp("asdf", *name));
 }
 
 
 THREADED_TEST(DateAccess) {
   LocalContext context;
   v8::HandleScope scope(context->GetIsolate());
-  v8::Handle<v8::Value> date =
-      v8::Date::New(context->GetIsolate(), 1224744689038.0);
+  v8::Local<v8::Value> date =
+      v8::Date::New(context.local(), 1224744689038.0).ToLocalChecked();
   CHECK(date->IsDate());
   CHECK_EQ(1224744689038.0, date.As<v8::Date>()->ValueOf());
 }
 
 
-void CheckProperties(v8::Isolate* isolate,
-                     v8::Handle<v8::Value> val,
-                     int elmc,
-                     const char* elmv[]) {
-  v8::Handle<v8::Object> obj = val.As<v8::Object>();
-  v8::Handle<v8::Array> props = obj->GetPropertyNames();
+void CheckProperties(v8::Isolate* isolate, v8::Local<v8::Value> val,
+                     unsigned elmc, const char* elmv[]) {
+  v8::Local<v8::Context> context = isolate->GetCurrentContext();
+  v8::Local<v8::Object> obj = val.As<v8::Object>();
+  v8::Local<v8::Array> props = obj->GetPropertyNames(context).ToLocalChecked();
   CHECK_EQ(elmc, props->Length());
-  for (int i = 0; i < elmc; i++) {
-    v8::String::Utf8Value elm(props->Get(v8::Integer::New(isolate, i)));
-    CHECK_EQ(elmv[i], *elm);
+  for (unsigned i = 0; i < elmc; i++) {
+    v8::String::Utf8Value elm(
+        props->Get(context, v8::Integer::New(isolate, i)).ToLocalChecked());
+    CHECK_EQ(0, strcmp(elmv[i], *elm));
   }
 }
 
 
-void CheckOwnProperties(v8::Isolate* isolate,
-                        v8::Handle<v8::Value> val,
-                        int elmc,
-                        const char* elmv[]) {
-  v8::Handle<v8::Object> obj = val.As<v8::Object>();
-  v8::Handle<v8::Array> props = obj->GetOwnPropertyNames();
+void CheckOwnProperties(v8::Isolate* isolate, v8::Local<v8::Value> val,
+                        unsigned elmc, const char* elmv[]) {
+  v8::Local<v8::Context> context = isolate->GetCurrentContext();
+  v8::Local<v8::Object> obj = val.As<v8::Object>();
+  v8::Local<v8::Array> props =
+      obj->GetOwnPropertyNames(context).ToLocalChecked();
   CHECK_EQ(elmc, props->Length());
-  for (int i = 0; i < elmc; i++) {
-    v8::String::Utf8Value elm(props->Get(v8::Integer::New(isolate, i)));
-    CHECK_EQ(elmv[i], *elm);
+  for (unsigned i = 0; i < elmc; i++) {
+    v8::String::Utf8Value elm(
+        props->Get(context, v8::Integer::New(isolate, i)).ToLocalChecked());
+    CHECK_EQ(0, strcmp(elmv[i], *elm));
   }
 }
 
@@ -15459,7 +14570,7 @@
   LocalContext context;
   v8::Isolate* isolate = context->GetIsolate();
   v8::HandleScope scope(isolate);
-  v8::Handle<v8::Value> obj = CompileRun(
+  v8::Local<v8::Value> obj = CompileRun(
       "var result = [];"
       "result[0] = {};"
       "result[1] = {a: 1, b: 2};"
@@ -15468,34 +14579,50 @@
       "var x = { __proto__: proto, w: 0, z: 1 };"
       "result[3] = x;"
       "result;");
-  v8::Handle<v8::Array> elms = obj.As<v8::Array>();
-  CHECK_EQ(4, elms->Length());
+  v8::Local<v8::Array> elms = obj.As<v8::Array>();
+  CHECK_EQ(4u, elms->Length());
   int elmc0 = 0;
   const char** elmv0 = NULL;
   CheckProperties(
-      isolate, elms->Get(v8::Integer::New(isolate, 0)), elmc0, elmv0);
+      isolate,
+      elms->Get(context.local(), v8::Integer::New(isolate, 0)).ToLocalChecked(),
+      elmc0, elmv0);
   CheckOwnProperties(
-      isolate, elms->Get(v8::Integer::New(isolate, 0)), elmc0, elmv0);
+      isolate,
+      elms->Get(context.local(), v8::Integer::New(isolate, 0)).ToLocalChecked(),
+      elmc0, elmv0);
   int elmc1 = 2;
   const char* elmv1[] = {"a", "b"};
   CheckProperties(
-      isolate, elms->Get(v8::Integer::New(isolate, 1)), elmc1, elmv1);
+      isolate,
+      elms->Get(context.local(), v8::Integer::New(isolate, 1)).ToLocalChecked(),
+      elmc1, elmv1);
   CheckOwnProperties(
-      isolate, elms->Get(v8::Integer::New(isolate, 1)), elmc1, elmv1);
+      isolate,
+      elms->Get(context.local(), v8::Integer::New(isolate, 1)).ToLocalChecked(),
+      elmc1, elmv1);
   int elmc2 = 3;
   const char* elmv2[] = {"0", "1", "2"};
   CheckProperties(
-      isolate, elms->Get(v8::Integer::New(isolate, 2)), elmc2, elmv2);
+      isolate,
+      elms->Get(context.local(), v8::Integer::New(isolate, 2)).ToLocalChecked(),
+      elmc2, elmv2);
   CheckOwnProperties(
-      isolate, elms->Get(v8::Integer::New(isolate, 2)), elmc2, elmv2);
+      isolate,
+      elms->Get(context.local(), v8::Integer::New(isolate, 2)).ToLocalChecked(),
+      elmc2, elmv2);
   int elmc3 = 4;
   const char* elmv3[] = {"w", "z", "x", "y"};
   CheckProperties(
-      isolate, elms->Get(v8::Integer::New(isolate, 3)), elmc3, elmv3);
+      isolate,
+      elms->Get(context.local(), v8::Integer::New(isolate, 3)).ToLocalChecked(),
+      elmc3, elmv3);
   int elmc4 = 2;
   const char* elmv4[] = {"w", "z"};
   CheckOwnProperties(
-      isolate, elms->Get(v8::Integer::New(isolate, 3)), elmc4, elmv4);
+      isolate,
+      elms->Get(context.local(), v8::Integer::New(isolate, 3)).ToLocalChecked(),
+      elmc4, elmv4);
 }
 
 
@@ -15503,7 +14630,7 @@
   LocalContext context;
   v8::Isolate* isolate = context->GetIsolate();
   v8::HandleScope scope(isolate);
-  v8::Handle<v8::Value> obj = CompileRun(
+  v8::Local<v8::Value> obj = CompileRun(
       "var result = [];"
       "result[0] = {};"
       "result[1] = {a: 1, b: 2};"
@@ -15512,76 +14639,32 @@
       "var x = { __proto__: proto, w: 0, z: 1 };"
       "result[3] = x;"
       "result;");
-  v8::Handle<v8::Array> elms = obj.As<v8::Array>();
-  CHECK_EQ(4, elms->Length());
+  v8::Local<v8::Array> elms = obj.As<v8::Array>();
+  CHECK_EQ(4u, elms->Length());
   int elmc0 = 0;
   const char** elmv0 = NULL;
-  CheckProperties(isolate,
-                  elms->Get(v8::Integer::New(isolate, 0)), elmc0, elmv0);
+  CheckProperties(
+      isolate,
+      elms->Get(context.local(), v8::Integer::New(isolate, 0)).ToLocalChecked(),
+      elmc0, elmv0);
 
-  v8::Handle<v8::Value> val = elms->Get(v8::Integer::New(isolate, 0));
-  v8::Handle<v8::Array> props = val.As<v8::Object>()->GetPropertyNames();
-  CHECK_EQ(0, props->Length());
+  v8::Local<v8::Value> val =
+      elms->Get(context.local(), v8::Integer::New(isolate, 0)).ToLocalChecked();
+  v8::Local<v8::Array> props =
+      val.As<v8::Object>()->GetPropertyNames(context.local()).ToLocalChecked();
+  CHECK_EQ(0u, props->Length());
   for (uint32_t i = 0; i < props->Length(); i++) {
     printf("p[%u]\n", i);
   }
 }
 
-static bool NamedSetAccessBlocker(Local<v8::Object> obj,
-                                  Local<Value> name,
-                                  v8::AccessType type,
-                                  Local<Value> data) {
-  return type != v8::ACCESS_SET;
-}
-
-
-static bool IndexedSetAccessBlocker(Local<v8::Object> obj,
-                                    uint32_t key,
-                                    v8::AccessType type,
-                                    Local<Value> data) {
-  return type != v8::ACCESS_SET;
-}
-
-
-THREADED_TEST(DisableAccessChecksWhileConfiguring) {
-  LocalContext context;
-  v8::Isolate* isolate = context->GetIsolate();
-  v8::HandleScope scope(isolate);
-  Local<ObjectTemplate> templ = ObjectTemplate::New(isolate);
-  templ->SetAccessCheckCallbacks(NamedSetAccessBlocker,
-                                 IndexedSetAccessBlocker);
-  templ->Set(v8_str("x"), v8::True(isolate));
-  Local<v8::Object> instance = templ->NewInstance();
-  context->Global()->Set(v8_str("obj"), instance);
-  Local<Value> value = CompileRun("obj.x");
-  CHECK(value->BooleanValue());
-}
-
-
-static bool NamedGetAccessBlocker(Local<v8::Object> obj,
-                                  Local<Value> name,
-                                  v8::AccessType type,
-                                  Local<Value> data) {
-  return false;
-}
-
-
-static bool IndexedGetAccessBlocker(Local<v8::Object> obj,
-                                    uint32_t key,
-                                    v8::AccessType type,
-                                    Local<Value> data) {
-  return false;
-}
-
-
 
 THREADED_TEST(AccessChecksReenabledCorrectly) {
   LocalContext context;
   v8::Isolate* isolate = context->GetIsolate();
   v8::HandleScope scope(isolate);
   Local<ObjectTemplate> templ = ObjectTemplate::New(isolate);
-  templ->SetAccessCheckCallbacks(NamedGetAccessBlocker,
-                                 IndexedGetAccessBlocker);
+  templ->SetAccessCheckCallback(AccessAlwaysBlocked);
   templ->Set(v8_str("a"), v8_str("a"));
   // Add more than 8 (see kMaxFastProperties) properties
   // so that the constructor will force copying map.
@@ -15599,211 +14682,26 @@
     }
   }
 
-  Local<v8::Object> instance_1 = templ->NewInstance();
-  context->Global()->Set(v8_str("obj_1"), instance_1);
+  Local<v8::Object> instance_1 =
+      templ->NewInstance(context.local()).ToLocalChecked();
+  CHECK(context->Global()
+            ->Set(context.local(), v8_str("obj_1"), instance_1)
+            .FromJust());
 
   Local<Value> value_1 = CompileRun("obj_1.a");
   CHECK(value_1.IsEmpty());
 
-  Local<v8::Object> instance_2 = templ->NewInstance();
-  context->Global()->Set(v8_str("obj_2"), instance_2);
+  Local<v8::Object> instance_2 =
+      templ->NewInstance(context.local()).ToLocalChecked();
+  CHECK(context->Global()
+            ->Set(context.local(), v8_str("obj_2"), instance_2)
+            .FromJust());
 
   Local<Value> value_2 = CompileRun("obj_2.a");
   CHECK(value_2.IsEmpty());
 }
 
 
-// This tests that access check information remains on the global
-// object template when creating contexts.
-THREADED_TEST(AccessControlRepeatedContextCreation) {
-  v8::Isolate* isolate = CcTest::isolate();
-  v8::HandleScope handle_scope(isolate);
-  v8::Handle<v8::ObjectTemplate> global_template =
-      v8::ObjectTemplate::New(isolate);
-  global_template->SetAccessCheckCallbacks(NamedSetAccessBlocker,
-                                           IndexedSetAccessBlocker);
-  i::Handle<i::ObjectTemplateInfo> internal_template =
-      v8::Utils::OpenHandle(*global_template);
-  CHECK(!internal_template->constructor()->IsUndefined());
-  i::Handle<i::FunctionTemplateInfo> constructor(
-      i::FunctionTemplateInfo::cast(internal_template->constructor()));
-  CHECK(!constructor->access_check_info()->IsUndefined());
-  v8::Local<Context> context0(Context::New(isolate, NULL, global_template));
-  CHECK(!context0.IsEmpty());
-  CHECK(!constructor->access_check_info()->IsUndefined());
-}
-
-
-THREADED_TEST(TurnOnAccessCheck) {
-  v8::Isolate* isolate = CcTest::isolate();
-  v8::HandleScope handle_scope(isolate);
-
-  // Create an environment with access check to the global object disabled by
-  // default.
-  v8::Handle<v8::ObjectTemplate> global_template =
-      v8::ObjectTemplate::New(isolate);
-  global_template->SetAccessCheckCallbacks(NamedGetAccessBlocker,
-                                           IndexedGetAccessBlocker,
-                                           v8::Handle<v8::Value>(),
-                                           false);
-  v8::Local<Context> context = Context::New(isolate, NULL, global_template);
-  Context::Scope context_scope(context);
-
-  // Set up a property and a number of functions.
-  context->Global()->Set(v8_str("a"), v8_num(1));
-  CompileRun("function f1() {return a;}"
-             "function f2() {return a;}"
-             "function g1() {return h();}"
-             "function g2() {return h();}"
-             "function h() {return 1;}");
-  Local<Function> f1 =
-      Local<Function>::Cast(context->Global()->Get(v8_str("f1")));
-  Local<Function> f2 =
-      Local<Function>::Cast(context->Global()->Get(v8_str("f2")));
-  Local<Function> g1 =
-      Local<Function>::Cast(context->Global()->Get(v8_str("g1")));
-  Local<Function> g2 =
-      Local<Function>::Cast(context->Global()->Get(v8_str("g2")));
-  Local<Function> h =
-      Local<Function>::Cast(context->Global()->Get(v8_str("h")));
-
-  // Get the global object.
-  v8::Handle<v8::Object> global = context->Global();
-
-  // Call f1 one time and f2 a number of times. This will ensure that f1 still
-  // uses the runtime system to retreive property a whereas f2 uses global load
-  // inline cache.
-  CHECK(f1->Call(global, 0, NULL)->Equals(v8_num(1)));
-  for (int i = 0; i < 4; i++) {
-    CHECK(f2->Call(global, 0, NULL)->Equals(v8_num(1)));
-  }
-
-  // Same for g1 and g2.
-  CHECK(g1->Call(global, 0, NULL)->Equals(v8_num(1)));
-  for (int i = 0; i < 4; i++) {
-    CHECK(g2->Call(global, 0, NULL)->Equals(v8_num(1)));
-  }
-
-  // Detach the global and turn on access check.
-  Local<Object> hidden_global = Local<Object>::Cast(
-      context->Global()->GetPrototype());
-  context->DetachGlobal();
-  hidden_global->TurnOnAccessCheck();
-
-  // Failing access check results in exception.
-  CHECK(f1->Call(global, 0, NULL).IsEmpty());
-  CHECK(f2->Call(global, 0, NULL).IsEmpty());
-  CHECK(g1->Call(global, 0, NULL).IsEmpty());
-  CHECK(g2->Call(global, 0, NULL).IsEmpty());
-
-  // No failing access check when just returning a constant.
-  CHECK(h->Call(global, 0, NULL)->Equals(v8_num(1)));
-}
-
-
-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) {
-  if (!name->IsString()) return false;
-  i::Handle<i::String> name_handle =
-      v8::Utils::OpenHandle(String::Cast(*name));
-  return !name_handle->IsUtf8EqualTo(i::CStrVector(kPropertyA))
-      && !name_handle->IsUtf8EqualTo(i::CStrVector(kPropertyH));
-}
-
-
-THREADED_TEST(TurnOnAccessCheckAndRecompile) {
-  v8::Isolate* isolate = CcTest::isolate();
-  v8::HandleScope handle_scope(isolate);
-
-  // 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.
-  v8::Handle<v8::ObjectTemplate> global_template =
-     v8::ObjectTemplate::New(isolate);
-  global_template->SetAccessCheckCallbacks(NamedGetAccessBlockAandH,
-                                           IndexedGetAccessBlocker,
-                                           v8::Handle<v8::Value>(),
-                                           false);
-  v8::Local<Context> context = Context::New(isolate, NULL, global_template);
-  Context::Scope context_scope(context);
-
-  // Set up a property and a number of functions.
-  context->Global()->Set(v8_str("a"), v8_num(1));
-  static const char* source = "function f1() {return a;}"
-                              "function f2() {return a;}"
-                              "function g1() {return h();}"
-                              "function g2() {return h();}"
-                              "function h() {return 1;}";
-
-  CompileRun(source);
-  Local<Function> f1;
-  Local<Function> f2;
-  Local<Function> g1;
-  Local<Function> g2;
-  Local<Function> h;
-  f1 = Local<Function>::Cast(context->Global()->Get(v8_str("f1")));
-  f2 = Local<Function>::Cast(context->Global()->Get(v8_str("f2")));
-  g1 = Local<Function>::Cast(context->Global()->Get(v8_str("g1")));
-  g2 = Local<Function>::Cast(context->Global()->Get(v8_str("g2")));
-  h =  Local<Function>::Cast(context->Global()->Get(v8_str("h")));
-
-  // Get the global object.
-  v8::Handle<v8::Object> global = context->Global();
-
-  // Call f1 one time and f2 a number of times. This will ensure that f1 still
-  // uses the runtime system to retreive property a whereas f2 uses global load
-  // inline cache.
-  CHECK(f1->Call(global, 0, NULL)->Equals(v8_num(1)));
-  for (int i = 0; i < 4; i++) {
-    CHECK(f2->Call(global, 0, NULL)->Equals(v8_num(1)));
-  }
-
-  // Same for g1 and g2.
-  CHECK(g1->Call(global, 0, NULL)->Equals(v8_num(1)));
-  for (int i = 0; i < 4; i++) {
-    CHECK(g2->Call(global, 0, NULL)->Equals(v8_num(1)));
-  }
-
-  // Detach the global and turn on access check now blocking access to property
-  // a and function h.
-  Local<Object> hidden_global = Local<Object>::Cast(
-      context->Global()->GetPrototype());
-  context->DetachGlobal();
-  hidden_global->TurnOnAccessCheck();
-
-  // Failing access check results in exception.
-  CHECK(f1->Call(global, 0, NULL).IsEmpty());
-  CHECK(f2->Call(global, 0, NULL).IsEmpty());
-  CHECK(g1->Call(global, 0, NULL).IsEmpty());
-  CHECK(g2->Call(global, 0, NULL).IsEmpty());
-
-  // No failing access check when just returning a constant.
-  CHECK(h->Call(global, 0, NULL)->Equals(v8_num(1)));
-
-  // Now compile the source again. And get the newly compiled functions, except
-  // for h for which access is blocked.
-  CompileRun(source);
-  f1 = Local<Function>::Cast(hidden_global->Get(v8_str("f1")));
-  f2 = Local<Function>::Cast(hidden_global->Get(v8_str("f2")));
-  g1 = Local<Function>::Cast(hidden_global->Get(v8_str("g1")));
-  g2 = Local<Function>::Cast(hidden_global->Get(v8_str("g2")));
-  CHECK(hidden_global->Get(v8_str("h")).IsEmpty());
-
-  // Failing access check results in exception.
-  v8::Local<v8::Value> result = f1->Call(global, 0, NULL);
-  CHECK(result.IsEmpty());
-  CHECK(f1->Call(global, 0, NULL).IsEmpty());
-  CHECK(f2->Call(global, 0, NULL).IsEmpty());
-  CHECK(g1->Call(global, 0, NULL).IsEmpty());
-  CHECK(g2->Call(global, 0, NULL).IsEmpty());
-}
-
-
 // Tests that ScriptData can be serialized and deserialized.
 TEST(PreCompileSerialization) {
   v8::V8::Initialize();
@@ -15814,8 +14712,9 @@
   i::FLAG_min_preparse_length = 0;
   const char* script = "function foo(a) { return a+1; }";
   v8::ScriptCompiler::Source source(v8_str(script));
-  v8::ScriptCompiler::Compile(isolate, &source,
-                              v8::ScriptCompiler::kProduceParserCache);
+  v8::ScriptCompiler::Compile(env.local(), &source,
+                              v8::ScriptCompiler::kProduceParserCache)
+      .ToLocalChecked();
   // Serialize.
   const v8::ScriptCompiler::CachedData* cd = source.GetCachedData();
   i::byte* serialized_data = i::NewArray<i::byte>(cd->length);
@@ -15843,15 +14742,19 @@
   // Test LoadIC.
   for (int i = 0; i < 2; i++) {
     LocalContext context;
-    context->Global()->Set(v8_str("tmp"), v8::True(CcTest::isolate()));
-    context->Global()->Delete(v8_str("tmp"));
+    CHECK(context->Global()
+              ->Set(context.local(), v8_str("tmp"), v8::True(CcTest::isolate()))
+              .FromJust());
+    context->Global()->Delete(context.local(), v8_str("tmp")).FromJust();
     CompileRun("for (var j = 0; j < 10; j++) new RegExp('');");
   }
   // Test CallIC.
   for (int i = 0; i < 2; i++) {
     LocalContext context;
-    context->Global()->Set(v8_str("tmp"), v8::True(CcTest::isolate()));
-    context->Global()->Delete(v8_str("tmp"));
+    CHECK(context->Global()
+              ->Set(context.local(), v8_str("tmp"), v8::True(CcTest::isolate()))
+              .FromJust());
+    context->Global()->Delete(context.local(), v8_str("tmp")).FromJust();
     CompileRun("for (var j = 0; j < 10; j++) RegExp('')");
   }
 }
@@ -15879,10 +14782,12 @@
   // Call the constructor function from context0 and check that the
   // result has the 'x' property.
   context1->Enter();
-  context1->Global()->Set(v8_str("other"), context0->Global());
+  CHECK(context1->Global()
+            ->Set(context1, v8_str("other"), context0->Global())
+            .FromJust());
   Local<Value> value = CompileRun("var instance = new other.C(); instance.x");
   CHECK(value->IsInt32());
-  CHECK_EQ(42, value->Int32Value());
+  CHECK_EQ(42, value->Int32Value(context1).FromJust());
   context1->Exit();
 }
 
@@ -15903,22 +14808,47 @@
   Local<Value> val = CompileRun(sample);
   CHECK(val->IsObject());
   Local<v8::Object> obj = val.As<v8::Object>();
-  obj->Set(v8_str("gamma"), v8_str("cloneme"));
+  obj->Set(env.local(), v8_str("gamma"), v8_str("cloneme")).FromJust();
 
-  CHECK_EQ(v8_str("hello"), obj->Get(v8_str("alpha")));
-  CHECK_EQ(v8::Integer::New(isolate, 123), obj->Get(v8_str("beta")));
-  CHECK_EQ(v8_str("cloneme"), obj->Get(v8_str("gamma")));
+  CHECK(v8_str("hello")
+            ->Equals(env.local(),
+                     obj->Get(env.local(), v8_str("alpha")).ToLocalChecked())
+            .FromJust());
+  CHECK(v8::Integer::New(isolate, 123)
+            ->Equals(env.local(),
+                     obj->Get(env.local(), v8_str("beta")).ToLocalChecked())
+            .FromJust());
+  CHECK(v8_str("cloneme")
+            ->Equals(env.local(),
+                     obj->Get(env.local(), v8_str("gamma")).ToLocalChecked())
+            .FromJust());
 
   // Clone it.
   Local<v8::Object> clone = obj->Clone();
-  CHECK_EQ(v8_str("hello"), clone->Get(v8_str("alpha")));
-  CHECK_EQ(v8::Integer::New(isolate, 123), clone->Get(v8_str("beta")));
-  CHECK_EQ(v8_str("cloneme"), clone->Get(v8_str("gamma")));
+  CHECK(v8_str("hello")
+            ->Equals(env.local(),
+                     clone->Get(env.local(), v8_str("alpha")).ToLocalChecked())
+            .FromJust());
+  CHECK(v8::Integer::New(isolate, 123)
+            ->Equals(env.local(),
+                     clone->Get(env.local(), v8_str("beta")).ToLocalChecked())
+            .FromJust());
+  CHECK(v8_str("cloneme")
+            ->Equals(env.local(),
+                     clone->Get(env.local(), v8_str("gamma")).ToLocalChecked())
+            .FromJust());
 
   // Set a property on the clone, verify each object.
-  clone->Set(v8_str("beta"), v8::Integer::New(isolate, 456));
-  CHECK_EQ(v8::Integer::New(isolate, 123), obj->Get(v8_str("beta")));
-  CHECK_EQ(v8::Integer::New(isolate, 456), clone->Get(v8_str("beta")));
+  CHECK(clone->Set(env.local(), v8_str("beta"), v8::Integer::New(isolate, 456))
+            .FromJust());
+  CHECK(v8::Integer::New(isolate, 123)
+            ->Equals(env.local(),
+                     obj->Get(env.local(), v8_str("beta")).ToLocalChecked())
+            .FromJust());
+  CHECK(v8::Integer::New(isolate, 456)
+            ->Equals(env.local(),
+                     clone->Get(env.local(), v8_str("beta")).ToLocalChecked())
+            .FromJust());
 }
 
 
@@ -15993,8 +14923,8 @@
         v8::Utils::ToLocal(factory->NewExternalStringFromOneByte(
                                         &one_byte_resource).ToHandleChecked()));
 
-    env->Global()->Set(v8_str("lhs"), lhs);
-    env->Global()->Set(v8_str("rhs"), rhs);
+    CHECK(env->Global()->Set(env.local(), v8_str("lhs"), lhs).FromJust());
+    CHECK(env->Global()->Set(env.local(), v8_str("rhs"), rhs).FromJust());
 
     CompileRun(
         "var cons = lhs + rhs;"
@@ -16010,7 +14940,8 @@
                  &uc16_resource);
 
     // This should UTF-8 without flattening, since everything is ASCII.
-    Handle<String> cons = v8_compile("cons")->Run().As<String>();
+    Local<String> cons =
+        v8_compile("cons")->Run(env.local()).ToLocalChecked().As<String>();
     CHECK_EQ(128, cons->Utf8Length());
     int nchars = -1;
     CHECK_EQ(129, cons->WriteUtf8(utf_buffer, -1, &nchars));
@@ -16033,12 +14964,22 @@
     const char* expected_slice_on_cons =
         "ow is the time for all good men to come to the aid of the party"
         "Now is the time for all good men to come to the aid of the part";
-    CHECK_EQ(String::NewFromUtf8(env->GetIsolate(), expected_cons),
-             env->Global()->Get(v8_str("cons")));
-    CHECK_EQ(String::NewFromUtf8(env->GetIsolate(), expected_slice),
-             env->Global()->Get(v8_str("slice")));
-    CHECK_EQ(String::NewFromUtf8(env->GetIsolate(), expected_slice_on_cons),
-             env->Global()->Get(v8_str("slice_on_cons")));
+    CHECK(v8_str(expected_cons)
+              ->Equals(env.local(), env->Global()
+                                        ->Get(env.local(), v8_str("cons"))
+                                        .ToLocalChecked())
+              .FromJust());
+    CHECK(v8_str(expected_slice)
+              ->Equals(env.local(), env->Global()
+                                        ->Get(env.local(), v8_str("slice"))
+                                        .ToLocalChecked())
+              .FromJust());
+    CHECK(v8_str(expected_slice_on_cons)
+              ->Equals(env.local(),
+                       env->Global()
+                           ->Get(env.local(), v8_str("slice_on_cons"))
+                           .ToLocalChecked())
+              .FromJust());
   }
   i::DeleteArray(two_byte_string);
 }
@@ -16061,8 +15002,9 @@
     uint16_t* two_byte_string = AsciiToTwoByteString(one_byte_sources[i]);
     TestResource* uc16_resource = new TestResource(two_byte_string);
     v8::Local<v8::String> source =
-        v8::String::NewExternal(context->GetIsolate(), uc16_resource);
-    v8::Script::Compile(source);
+        v8::String::NewExternalTwoByte(context->GetIsolate(), uc16_resource)
+            .ToLocalChecked();
+    v8::Script::Compile(context.local(), source).FromMaybe(Local<Script>());
   }
 }
 
@@ -16086,11 +15028,13 @@
          v8::base::NoBarrier_Load(&regexp_interruption_data.loop_count) < 7;
          v8::base::NoBarrier_AtomicIncrement(
              &regexp_interruption_data.loop_count, 1)) {
-      v8::base::OS::Sleep(50);  // Wait a bit before requesting GC.
+      // Wait a bit before requesting GC.
+      v8::base::OS::Sleep(v8::base::TimeDelta::FromMilliseconds(50));
       reinterpret_cast<i::Isolate*>(isolate_)->stack_guard()->RequestGC();
     }
-    v8::base::OS::Sleep(50);  // Wait a bit before terminating.
-    v8::V8::TerminateExecution(isolate_);
+    // Wait a bit before terminating.
+    v8::base::OS::Sleep(v8::base::TimeDelta::FromMilliseconds(50));
+    isolate_->TerminateExecution();
   }
 
  private:
@@ -16098,11 +15042,12 @@
 };
 
 
-void RunBeforeGC(v8::GCType type, v8::GCCallbackFlags flags) {
+void RunBeforeGC(v8::Isolate* isolate, v8::GCType type,
+                 v8::GCCallbackFlags flags) {
   if (v8::base::NoBarrier_Load(&regexp_interruption_data.loop_count) != 2) {
     return;
   }
-  v8::HandleScope scope(CcTest::isolate());
+  v8::HandleScope scope(isolate);
   v8::Local<v8::String> string = v8::Local<v8::String>::New(
       CcTest::isolate(), regexp_interruption_data.string);
   string->MakeExternal(regexp_interruption_data.string_resource);
@@ -16114,22 +15059,22 @@
 // * turn the subject string from one-byte internal to two-byte external string
 // * force termination
 TEST(RegExpInterruption) {
-  v8::HandleScope scope(CcTest::isolate());
   LocalContext env;
+  v8::HandleScope scope(env->GetIsolate());
 
-  RegExpInterruptionThread timeout_thread(CcTest::isolate());
+  RegExpInterruptionThread timeout_thread(env->GetIsolate());
 
-  v8::V8::AddGCPrologueCallback(RunBeforeGC);
+  env->GetIsolate()->AddGCPrologueCallback(RunBeforeGC);
   static const char* one_byte_content = "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa";
   i::uc16* uc16_content = AsciiToTwoByteString(one_byte_content);
   v8::Local<v8::String> string = v8_str(one_byte_content);
 
-  CcTest::global()->Set(v8_str("a"), string);
-  regexp_interruption_data.string.Reset(CcTest::isolate(), string);
+  env->Global()->Set(env.local(), v8_str("a"), string).FromJust();
+  regexp_interruption_data.string.Reset(env->GetIsolate(), string);
   regexp_interruption_data.string_resource = new UC16VectorResource(
       i::Vector<const i::uc16>(uc16_content, i::StrLength(one_byte_content)));
 
-  v8::TryCatch try_catch;
+  v8::TryCatch try_catch(env->GetIsolate());
   timeout_thread.Start();
 
   CompileRun("/((a*)*)*b/.exec(a)");
@@ -16149,304 +15094,249 @@
 TEST(ReadOnlyPropertyInGlobalProto) {
   v8::Isolate* isolate = CcTest::isolate();
   v8::HandleScope scope(isolate);
-  v8::Handle<v8::ObjectTemplate> templ = v8::ObjectTemplate::New(isolate);
+  v8::Local<v8::ObjectTemplate> templ = v8::ObjectTemplate::New(isolate);
   LocalContext context(0, templ);
-  v8::Handle<v8::Object> global = context->Global();
-  v8::Handle<v8::Object> global_proto =
-      v8::Handle<v8::Object>::Cast(global->Get(v8_str("__proto__")));
-  global_proto->ForceSet(v8_str("x"), v8::Integer::New(isolate, 0),
-                         v8::ReadOnly);
-  global_proto->ForceSet(v8_str("y"), v8::Integer::New(isolate, 0),
-                         v8::ReadOnly);
+  v8::Local<v8::Object> global = context->Global();
+  v8::Local<v8::Object> global_proto = v8::Local<v8::Object>::Cast(
+      global->Get(context.local(), v8_str("__proto__")).ToLocalChecked());
+  global_proto->DefineOwnProperty(context.local(), v8_str("x"),
+                                  v8::Integer::New(isolate, 0), v8::ReadOnly)
+      .FromJust();
+  global_proto->DefineOwnProperty(context.local(), v8_str("y"),
+                                  v8::Integer::New(isolate, 0), v8::ReadOnly)
+      .FromJust();
   // Check without 'eval' or 'with'.
-  v8::Handle<v8::Value> res =
+  v8::Local<v8::Value> res =
       CompileRun("function f() { x = 42; return x; }; f()");
-  CHECK_EQ(v8::Integer::New(isolate, 0), res);
+  CHECK(v8::Integer::New(isolate, 0)->Equals(context.local(), res).FromJust());
   // Check with 'eval'.
   res = CompileRun("function f() { eval('1'); y = 43; return y; }; f()");
-  CHECK_EQ(v8::Integer::New(isolate, 0), res);
+  CHECK(v8::Integer::New(isolate, 0)->Equals(context.local(), res).FromJust());
   // Check with 'with'.
   res = CompileRun("function f() { with (this) { y = 44 }; return y; }; f()");
-  CHECK_EQ(v8::Integer::New(isolate, 0), res);
+  CHECK(v8::Integer::New(isolate, 0)->Equals(context.local(), res).FromJust());
 }
 
-static int force_set_set_count = 0;
-static int force_set_get_count = 0;
-bool pass_on_get = false;
 
-static void ForceSetGetter(v8::Local<v8::String> name,
-                           const v8::PropertyCallbackInfo<v8::Value>& info) {
-  force_set_get_count++;
-  if (pass_on_get) {
-    return;
+TEST(CreateDataProperty) {
+  LocalContext env;
+  v8::Isolate* isolate = env->GetIsolate();
+  v8::HandleScope handle_scope(isolate);
+
+  CompileRun(
+      "var a = {};"
+      "var b = [];"
+      "Object.defineProperty(a, 'foo', {value: 23});"
+      "Object.defineProperty(a, 'bar', {value: 23, configurable: true});");
+
+  v8::Local<v8::Object> obj = v8::Local<v8::Object>::Cast(
+      env->Global()->Get(env.local(), v8_str("a")).ToLocalChecked());
+  v8::Local<v8::Array> arr = v8::Local<v8::Array>::Cast(
+      env->Global()->Get(env.local(), v8_str("b")).ToLocalChecked());
+  {
+    // Can't change a non-configurable properties.
+    v8::TryCatch try_catch(isolate);
+    CHECK(!obj->CreateDataProperty(env.local(), v8_str("foo"),
+                                   v8::Integer::New(isolate, 42)).FromJust());
+    CHECK(!try_catch.HasCaught());
+    CHECK(obj->CreateDataProperty(env.local(), v8_str("bar"),
+                                  v8::Integer::New(isolate, 42)).FromJust());
+    CHECK(!try_catch.HasCaught());
+    v8::Local<v8::Value> val =
+        obj->Get(env.local(), v8_str("bar")).ToLocalChecked();
+    CHECK(val->IsNumber());
+    CHECK_EQ(42.0, val->NumberValue(env.local()).FromJust());
   }
-  info.GetReturnValue().Set(3);
-}
-
-static void ForceSetSetter(v8::Local<v8::String> name,
-                           v8::Local<v8::Value> value,
-                           const v8::PropertyCallbackInfo<void>& info) {
-  force_set_set_count++;
-}
-
-static void ForceSetInterceptGetter(
-    v8::Local<v8::Name> name, const v8::PropertyCallbackInfo<v8::Value>& info) {
-  CHECK(name->IsString());
-  ForceSetGetter(Local<String>::Cast(name), info);
-}
-
-static void ForceSetInterceptSetter(
-    v8::Local<v8::Name> name, v8::Local<v8::Value> value,
-    const v8::PropertyCallbackInfo<v8::Value>& info) {
-  force_set_set_count++;
-  info.GetReturnValue().SetUndefined();
-}
-
-
-TEST(ForceSet) {
-  force_set_get_count = 0;
-  force_set_set_count = 0;
-  pass_on_get = false;
-
-  v8::Isolate* isolate = CcTest::isolate();
-  v8::HandleScope scope(isolate);
-  v8::Handle<v8::ObjectTemplate> templ = v8::ObjectTemplate::New(isolate);
-  v8::Handle<v8::String> access_property =
-      v8::String::NewFromUtf8(isolate, "a");
-  templ->SetAccessor(access_property, ForceSetGetter, ForceSetSetter);
-  LocalContext context(NULL, templ);
-  v8::Handle<v8::Object> global = context->Global();
-
-  // Ordinary properties
-  v8::Handle<v8::String> simple_property =
-      v8::String::NewFromUtf8(isolate, "p");
-  global->ForceSet(simple_property, v8::Int32::New(isolate, 4), v8::ReadOnly);
-  CHECK_EQ(4, global->Get(simple_property)->Int32Value());
-  // This should fail because the property is read-only
-  global->Set(simple_property, v8::Int32::New(isolate, 5));
-  CHECK_EQ(4, global->Get(simple_property)->Int32Value());
-  // This should succeed even though the property is read-only
-  global->ForceSet(simple_property, v8::Int32::New(isolate, 6));
-  CHECK_EQ(6, global->Get(simple_property)->Int32Value());
-
-  // Accessors
-  CHECK_EQ(0, force_set_set_count);
-  CHECK_EQ(0, force_set_get_count);
-  CHECK_EQ(3, global->Get(access_property)->Int32Value());
-  // CHECK_EQ the property shouldn't override it, just call the setter
-  // which in this case does nothing.
-  global->Set(access_property, v8::Int32::New(isolate, 7));
-  CHECK_EQ(3, global->Get(access_property)->Int32Value());
-  CHECK_EQ(1, force_set_set_count);
-  CHECK_EQ(2, force_set_get_count);
-  // Forcing the property to be set should override the accessor without
-  // calling it
-  global->ForceSet(access_property, v8::Int32::New(isolate, 8));
-  CHECK_EQ(8, global->Get(access_property)->Int32Value());
-  CHECK_EQ(1, force_set_set_count);
-  CHECK_EQ(2, force_set_get_count);
-}
-
-
-TEST(ForceSetWithInterceptor) {
-  force_set_get_count = 0;
-  force_set_set_count = 0;
-  pass_on_get = false;
-
-  v8::Isolate* isolate = CcTest::isolate();
-  v8::HandleScope scope(isolate);
-  v8::Handle<v8::ObjectTemplate> templ = v8::ObjectTemplate::New(isolate);
-  templ->SetHandler(v8::NamedPropertyHandlerConfiguration(
-      ForceSetInterceptGetter, ForceSetInterceptSetter));
-  LocalContext context(NULL, templ);
-  v8::Handle<v8::Object> global = context->Global();
-
-  v8::Handle<v8::String> some_property =
-      v8::String::NewFromUtf8(isolate, "a");
-  CHECK_EQ(0, force_set_set_count);
-  CHECK_EQ(0, force_set_get_count);
-  CHECK_EQ(3, global->Get(some_property)->Int32Value());
-  // Setting the property shouldn't override it, just call the setter
-  // which in this case does nothing.
-  global->Set(some_property, v8::Int32::New(isolate, 7));
-  CHECK_EQ(3, global->Get(some_property)->Int32Value());
-  CHECK_EQ(1, force_set_set_count);
-  CHECK_EQ(2, force_set_get_count);
-  // Getting the property when the interceptor returns an empty handle
-  // should yield undefined, since the property isn't present on the
-  // object itself yet.
-  pass_on_get = true;
-  CHECK(global->Get(some_property)->IsUndefined());
-  CHECK_EQ(1, force_set_set_count);
-  CHECK_EQ(3, force_set_get_count);
-  // Forcing the property to be set should cause the value to be
-  // set locally without calling the interceptor.
-  global->ForceSet(some_property, v8::Int32::New(isolate, 8));
-  CHECK_EQ(8, global->Get(some_property)->Int32Value());
-  CHECK_EQ(1, force_set_set_count);
-  CHECK_EQ(4, force_set_get_count);
-  // Reenabling the interceptor should cause it to take precedence over
-  // the property
-  pass_on_get = false;
-  CHECK_EQ(3, global->Get(some_property)->Int32Value());
-  CHECK_EQ(1, force_set_set_count);
-  CHECK_EQ(5, force_set_get_count);
-  // The interceptor should also work for other properties
-  CHECK_EQ(3, global->Get(v8::String::NewFromUtf8(isolate, "b"))
-                  ->Int32Value());
-  CHECK_EQ(1, force_set_set_count);
-  CHECK_EQ(6, force_set_get_count);
-}
-
-
-THREADED_TEST(ForceDelete) {
-  v8::Isolate* isolate = CcTest::isolate();
-  v8::HandleScope scope(isolate);
-  v8::Handle<v8::ObjectTemplate> templ = v8::ObjectTemplate::New(isolate);
-  LocalContext context(NULL, templ);
-  v8::Handle<v8::Object> global = context->Global();
-
-  // Ordinary properties
-  v8::Handle<v8::String> simple_property =
-      v8::String::NewFromUtf8(isolate, "p");
-  global->ForceSet(simple_property, v8::Int32::New(isolate, 4), v8::DontDelete);
-  CHECK_EQ(4, global->Get(simple_property)->Int32Value());
-  // This should fail because the property is dont-delete.
-  CHECK(!global->Delete(simple_property));
-  CHECK_EQ(4, global->Get(simple_property)->Int32Value());
-  // This should succeed even though the property is dont-delete.
-  CHECK(global->ForceDelete(simple_property));
-  CHECK(global->Get(simple_property)->IsUndefined());
-}
-
-
-static int force_delete_interceptor_count = 0;
-static bool pass_on_delete = false;
-
-
-static void ForceDeleteDeleter(
-    v8::Local<v8::Name> name,
-    const v8::PropertyCallbackInfo<v8::Boolean>& info) {
-  force_delete_interceptor_count++;
-  if (pass_on_delete) return;
-  info.GetReturnValue().Set(true);
-}
-
-
-THREADED_TEST(ForceDeleteWithInterceptor) {
-  force_delete_interceptor_count = 0;
-  pass_on_delete = false;
-
-  v8::Isolate* isolate = CcTest::isolate();
-  v8::HandleScope scope(isolate);
-  v8::Handle<v8::ObjectTemplate> templ = v8::ObjectTemplate::New(isolate);
-  templ->SetHandler(
-      v8::NamedPropertyHandlerConfiguration(0, 0, 0, ForceDeleteDeleter));
-  LocalContext context(NULL, templ);
-  v8::Handle<v8::Object> global = context->Global();
-
-  v8::Handle<v8::String> some_property =
-      v8::String::NewFromUtf8(isolate, "a");
-  global->ForceSet(some_property, v8::Integer::New(isolate, 42),
-                   v8::DontDelete);
-
-  // Deleting a property should get intercepted and nothing should
-  // happen.
-  CHECK_EQ(0, force_delete_interceptor_count);
-  CHECK(global->Delete(some_property));
-  CHECK_EQ(1, force_delete_interceptor_count);
-  CHECK_EQ(42, global->Get(some_property)->Int32Value());
-  // Deleting the property when the interceptor returns an empty
-  // handle should not delete the property since it is DontDelete.
-  pass_on_delete = true;
-  CHECK(!global->Delete(some_property));
-  CHECK_EQ(2, force_delete_interceptor_count);
-  CHECK_EQ(42, global->Get(some_property)->Int32Value());
-  // Forcing the property to be deleted should delete the value
-  // without calling the interceptor.
-  CHECK(global->ForceDelete(some_property));
-  CHECK(global->Get(some_property)->IsUndefined());
-  CHECK_EQ(2, force_delete_interceptor_count);
-}
-
-
-// Make sure that forcing a delete invalidates any IC stubs, so we
-// don't read the hole value.
-THREADED_TEST(ForceDeleteIC) {
-  LocalContext context;
-  v8::HandleScope scope(context->GetIsolate());
-  // Create a DontDelete variable on the global object.
-  CompileRun("this.__proto__ = { foo: 'horse' };"
-             "var foo = 'fish';"
-             "function f() { return foo.length; }");
-  // Initialize the IC for foo in f.
-  CompileRun("for (var i = 0; i < 4; i++) f();");
-  // Make sure the value of foo is correct before the deletion.
-  CHECK_EQ(4, CompileRun("f()")->Int32Value());
-  // Force the deletion of foo.
-  CHECK(context->Global()->ForceDelete(v8_str("foo")));
-  // Make sure the value for foo is read from the prototype, and that
-  // we don't get in trouble with reading the deleted cell value
-  // sentinel.
-  CHECK_EQ(5, CompileRun("f()")->Int32Value());
-}
-
-
-TEST(InlinedFunctionAcrossContexts) {
-  i::FLAG_allow_natives_syntax = true;
-  v8::Isolate* isolate = CcTest::isolate();
-  v8::HandleScope outer_scope(isolate);
-  v8::Local<v8::Context> ctx1 = v8::Context::New(isolate);
-  v8::Local<v8::Context> ctx2 = v8::Context::New(isolate);
-  ctx1->Enter();
 
   {
-    v8::HandleScope inner_scope(CcTest::isolate());
-    CompileRun("var G = 42; function foo() { return G; }");
-    v8::Local<v8::Value> foo = ctx1->Global()->Get(v8_str("foo"));
-    ctx2->Enter();
-    ctx2->Global()->Set(v8_str("o"), foo);
-    v8::Local<v8::Value> res = CompileRun(
-        "function f() { return o(); }"
-        "for (var i = 0; i < 10; ++i) f();"
-        "%OptimizeFunctionOnNextCall(f);"
-        "f();");
-    CHECK_EQ(42, res->Int32Value());
-    ctx2->Exit();
-    v8::Handle<v8::String> G_property =
-        v8::String::NewFromUtf8(CcTest::isolate(), "G");
-    CHECK(ctx1->Global()->ForceDelete(G_property));
-    ctx2->Enter();
-    ExpectString(
-        "(function() {"
-        "  try {"
-        "    return f();"
-        "  } catch(e) {"
-        "    return e.toString();"
-        "  }"
-        " })()",
-        "ReferenceError: G is not defined");
-    ctx2->Exit();
-    ctx1->Exit();
+    // Set a regular property.
+    v8::TryCatch try_catch(isolate);
+    CHECK(obj->CreateDataProperty(env.local(), v8_str("blub"),
+                                  v8::Integer::New(isolate, 42)).FromJust());
+    CHECK(!try_catch.HasCaught());
+    v8::Local<v8::Value> val =
+        obj->Get(env.local(), v8_str("blub")).ToLocalChecked();
+    CHECK(val->IsNumber());
+    CHECK_EQ(42.0, val->NumberValue(env.local()).FromJust());
+  }
+
+  {
+    // Set an indexed property.
+    v8::TryCatch try_catch(isolate);
+    CHECK(obj->CreateDataProperty(env.local(), v8_str("1"),
+                                  v8::Integer::New(isolate, 42)).FromJust());
+    CHECK(!try_catch.HasCaught());
+    v8::Local<v8::Value> val = obj->Get(env.local(), 1).ToLocalChecked();
+    CHECK(val->IsNumber());
+    CHECK_EQ(42.0, val->NumberValue(env.local()).FromJust());
+  }
+
+  {
+    // Special cases for arrays.
+    v8::TryCatch try_catch(isolate);
+    CHECK(!arr->CreateDataProperty(env.local(), v8_str("length"),
+                                   v8::Integer::New(isolate, 1)).FromJust());
+    CHECK(!try_catch.HasCaught());
+  }
+  {
+    // Special cases for arrays: index exceeds the array's length
+    v8::TryCatch try_catch(isolate);
+    CHECK(arr->CreateDataProperty(env.local(), 1, v8::Integer::New(isolate, 23))
+              .FromJust());
+    CHECK(!try_catch.HasCaught());
+    CHECK_EQ(2U, arr->Length());
+    v8::Local<v8::Value> val = arr->Get(env.local(), 1).ToLocalChecked();
+    CHECK(val->IsNumber());
+    CHECK_EQ(23.0, val->NumberValue(env.local()).FromJust());
+
+    // Set an existing entry.
+    CHECK(arr->CreateDataProperty(env.local(), 0, v8::Integer::New(isolate, 42))
+              .FromJust());
+    CHECK(!try_catch.HasCaught());
+    val = arr->Get(env.local(), 0).ToLocalChecked();
+    CHECK(val->IsNumber());
+    CHECK_EQ(42.0, val->NumberValue(env.local()).FromJust());
+  }
+
+  CompileRun("Object.freeze(a);");
+  {
+    // Can't change non-extensible objects.
+    v8::TryCatch try_catch(isolate);
+    CHECK(!obj->CreateDataProperty(env.local(), v8_str("baz"),
+                                   v8::Integer::New(isolate, 42)).FromJust());
+    CHECK(!try_catch.HasCaught());
+  }
+
+  v8::Local<v8::ObjectTemplate> templ = v8::ObjectTemplate::New(isolate);
+  templ->SetAccessCheckCallback(AccessAlwaysBlocked);
+  v8::Local<v8::Object> access_checked =
+      templ->NewInstance(env.local()).ToLocalChecked();
+  {
+    v8::TryCatch try_catch(isolate);
+    CHECK(access_checked->CreateDataProperty(env.local(), v8_str("foo"),
+                                             v8::Integer::New(isolate, 42))
+              .IsNothing());
+    CHECK(try_catch.HasCaught());
   }
 }
 
 
-static v8::Local<Context> calling_context0;
-static v8::Local<Context> calling_context1;
-static v8::Local<Context> calling_context2;
+TEST(DefineOwnProperty) {
+  LocalContext env;
+  v8::Isolate* isolate = env->GetIsolate();
+  v8::HandleScope handle_scope(isolate);
 
+  CompileRun(
+      "var a = {};"
+      "var b = [];"
+      "Object.defineProperty(a, 'foo', {value: 23});"
+      "Object.defineProperty(a, 'bar', {value: 23, configurable: true});");
 
-// Check that the call to the callback is initiated in
-// calling_context2, the directly calling context is calling_context1
-// and the callback itself is in calling_context0.
-static void GetCallingContextCallback(
-    const v8::FunctionCallbackInfo<v8::Value>& args) {
-  ApiTestFuzzer::Fuzz();
-  CHECK(args.GetIsolate()->GetCurrentContext() == calling_context0);
-  CHECK(args.GetIsolate()->GetCallingContext() == calling_context1);
-  CHECK(args.GetIsolate()->GetEnteredContext() == calling_context2);
-  args.GetReturnValue().Set(42);
+  v8::Local<v8::Object> obj = v8::Local<v8::Object>::Cast(
+      env->Global()->Get(env.local(), v8_str("a")).ToLocalChecked());
+  v8::Local<v8::Array> arr = v8::Local<v8::Array>::Cast(
+      env->Global()->Get(env.local(), v8_str("b")).ToLocalChecked());
+  {
+    // Can't change a non-configurable properties.
+    v8::TryCatch try_catch(isolate);
+    CHECK(!obj->DefineOwnProperty(env.local(), v8_str("foo"),
+                                  v8::Integer::New(isolate, 42)).FromJust());
+    CHECK(!try_catch.HasCaught());
+    CHECK(obj->DefineOwnProperty(env.local(), v8_str("bar"),
+                                 v8::Integer::New(isolate, 42)).FromJust());
+    CHECK(!try_catch.HasCaught());
+    v8::Local<v8::Value> val =
+        obj->Get(env.local(), v8_str("bar")).ToLocalChecked();
+    CHECK(val->IsNumber());
+    CHECK_EQ(42.0, val->NumberValue(env.local()).FromJust());
+  }
+
+  {
+    // Set a regular property.
+    v8::TryCatch try_catch(isolate);
+    CHECK(obj->DefineOwnProperty(env.local(), v8_str("blub"),
+                                 v8::Integer::New(isolate, 42)).FromJust());
+    CHECK(!try_catch.HasCaught());
+    v8::Local<v8::Value> val =
+        obj->Get(env.local(), v8_str("blub")).ToLocalChecked();
+    CHECK(val->IsNumber());
+    CHECK_EQ(42.0, val->NumberValue(env.local()).FromJust());
+  }
+
+  {
+    // Set an indexed property.
+    v8::TryCatch try_catch(isolate);
+    CHECK(obj->DefineOwnProperty(env.local(), v8_str("1"),
+                                 v8::Integer::New(isolate, 42)).FromJust());
+    CHECK(!try_catch.HasCaught());
+    v8::Local<v8::Value> val = obj->Get(env.local(), 1).ToLocalChecked();
+    CHECK(val->IsNumber());
+    CHECK_EQ(42.0, val->NumberValue(env.local()).FromJust());
+  }
+
+  {
+    // Special cases for arrays.
+    v8::TryCatch try_catch(isolate);
+    CHECK(!arr->DefineOwnProperty(env.local(), v8_str("length"),
+                                  v8::Integer::New(isolate, 1)).FromJust());
+    CHECK(!try_catch.HasCaught());
+  }
+  {
+    // Special cases for arrays: index exceeds the array's length
+    v8::TryCatch try_catch(isolate);
+    CHECK(arr->DefineOwnProperty(env.local(), v8_str("1"),
+                                 v8::Integer::New(isolate, 23)).FromJust());
+    CHECK(!try_catch.HasCaught());
+    CHECK_EQ(2U, arr->Length());
+    v8::Local<v8::Value> val = arr->Get(env.local(), 1).ToLocalChecked();
+    CHECK(val->IsNumber());
+    CHECK_EQ(23.0, val->NumberValue(env.local()).FromJust());
+
+    // Set an existing entry.
+    CHECK(arr->DefineOwnProperty(env.local(), v8_str("0"),
+                                 v8::Integer::New(isolate, 42)).FromJust());
+    CHECK(!try_catch.HasCaught());
+    val = arr->Get(env.local(), 0).ToLocalChecked();
+    CHECK(val->IsNumber());
+    CHECK_EQ(42.0, val->NumberValue(env.local()).FromJust());
+  }
+
+  {
+    // Set a non-writable property.
+    v8::TryCatch try_catch(isolate);
+    CHECK(obj->DefineOwnProperty(env.local(), v8_str("lala"),
+                                 v8::Integer::New(isolate, 42),
+                                 v8::ReadOnly).FromJust());
+    CHECK(!try_catch.HasCaught());
+    v8::Local<v8::Value> val =
+        obj->Get(env.local(), v8_str("lala")).ToLocalChecked();
+    CHECK(val->IsNumber());
+    CHECK_EQ(42.0, val->NumberValue(env.local()).FromJust());
+    CHECK_EQ(v8::ReadOnly, obj->GetPropertyAttributes(
+                                    env.local(), v8_str("lala")).FromJust());
+    CHECK(!try_catch.HasCaught());
+  }
+
+  CompileRun("Object.freeze(a);");
+  {
+    // Can't change non-extensible objects.
+    v8::TryCatch try_catch(isolate);
+    CHECK(!obj->DefineOwnProperty(env.local(), v8_str("baz"),
+                                  v8::Integer::New(isolate, 42)).FromJust());
+    CHECK(!try_catch.HasCaught());
+  }
+
+  v8::Local<v8::ObjectTemplate> templ = v8::ObjectTemplate::New(isolate);
+  templ->SetAccessCheckCallback(AccessAlwaysBlocked);
+  v8::Local<v8::Object> access_checked =
+      templ->NewInstance(env.local()).ToLocalChecked();
+  {
+    v8::TryCatch try_catch(isolate);
+    CHECK(access_checked->DefineOwnProperty(env.local(), v8_str("foo"),
+                                            v8::Integer::New(isolate, 42))
+              .IsNothing());
+    CHECK(try_catch.HasCaught());
+  }
 }
 
 
@@ -16462,52 +15352,6 @@
 }
 
 
-THREADED_TEST(GetCallingContext) {
-  v8::Isolate* isolate = CcTest::isolate();
-  v8::HandleScope scope(isolate);
-
-  Local<Context> calling_context0(Context::New(isolate));
-  Local<Context> calling_context1(Context::New(isolate));
-  Local<Context> calling_context2(Context::New(isolate));
-  ::calling_context0 = calling_context0;
-  ::calling_context1 = calling_context1;
-  ::calling_context2 = calling_context2;
-
-  // Allow cross-domain access.
-  Local<String> token = v8_str("<security token>");
-  calling_context0->SetSecurityToken(token);
-  calling_context1->SetSecurityToken(token);
-  calling_context2->SetSecurityToken(token);
-
-  // Create an object with a C++ callback in context0.
-  calling_context0->Enter();
-  Local<v8::FunctionTemplate> callback_templ =
-      v8::FunctionTemplate::New(isolate, GetCallingContextCallback);
-  calling_context0->Global()->Set(v8_str("callback"),
-                                  callback_templ->GetFunction());
-  calling_context0->Exit();
-
-  // Expose context0 in context1 and set up a function that calls the
-  // callback function.
-  calling_context1->Enter();
-  calling_context1->Global()->Set(v8_str("context0"),
-                                  calling_context0->Global());
-  CompileRun("function f() { context0.callback() }");
-  calling_context1->Exit();
-
-  // Expose context1 in context2 and call the callback function in
-  // context0 indirectly through f in context1.
-  calling_context2->Enter();
-  calling_context2->Global()->Set(v8_str("context1"),
-                                  calling_context1->Global());
-  CompileRun("context1.f()");
-  calling_context2->Exit();
-  ::calling_context0.Clear();
-  ::calling_context1.Clear();
-  ::calling_context2.Clear();
-}
-
-
 // Check that a variable declaration with no explicit initialization
 // value does shadow an existing property in the prototype chain.
 THREADED_TEST(InitGlobalVarInProtoChain) {
@@ -16515,9 +15359,9 @@
   v8::HandleScope scope(context->GetIsolate());
   // Introduce a variable in the prototype chain.
   CompileRun("__proto__.x = 42");
-  v8::Handle<v8::Value> result = CompileRun("var x = 43; x");
+  v8::Local<v8::Value> result = CompileRun("var x = 43; x");
   CHECK(!result->IsUndefined());
-  CHECK_EQ(43, result->Int32Value());
+  CHECK_EQ(43, result->Int32Value(context.local()).FromJust());
 }
 
 
@@ -16530,16 +15374,16 @@
   LocalContext context;
   v8::Isolate* isolate = context->GetIsolate();
   v8::HandleScope scope(isolate);
-  v8::Handle<v8::Object> obj = v8::Object::New(isolate);
-  v8::Handle<v8::FunctionTemplate> func_templ =
+  v8::Local<v8::Object> obj = v8::Object::New(isolate);
+  v8::Local<v8::FunctionTemplate> func_templ =
       v8::FunctionTemplate::New(isolate);
-  v8::Handle<v8::String> foo_string =
-      v8::String::NewFromUtf8(isolate, "foo");
-  obj->Set(foo_string, func_templ->GetFunction());
-  v8::Handle<v8::Object> obj_clone = obj->Clone();
-  obj_clone->Set(foo_string,
-                 v8::String::NewFromUtf8(isolate, "Hello"));
-  CHECK(!obj->Get(foo_string)->IsUndefined());
+  v8::Local<v8::String> foo_string = v8_str("foo");
+  obj->Set(context.local(), foo_string,
+           func_templ->GetFunction(context.local()).ToLocalChecked())
+      .FromJust();
+  v8::Local<v8::Object> obj_clone = obj->Clone();
+  obj_clone->Set(context.local(), foo_string, v8_str("Hello")).FromJust();
+  CHECK(!obj->Get(context.local(), foo_string).ToLocalChecked()->IsUndefined());
 }
 
 
@@ -16553,500 +15397,22 @@
 }
 
 
-THREADED_TEST(PixelArray) {
-  LocalContext context;
-  i::Isolate* isolate = CcTest::i_isolate();
-  i::Factory* factory = isolate->factory();
-  v8::HandleScope scope(context->GetIsolate());
-  const int kElementCount = 260;
-  uint8_t* pixel_data = reinterpret_cast<uint8_t*>(malloc(kElementCount));
-  i::Handle<i::ExternalUint8ClampedArray> pixels =
-      i::Handle<i::ExternalUint8ClampedArray>::cast(
-          factory->NewExternalArray(kElementCount,
-                                    v8::kExternalUint8ClampedArray,
-                                    pixel_data));
-  // Force GC to trigger verification.
-  CcTest::heap()->CollectAllGarbage(i::Heap::kNoGCFlags);
-  for (int i = 0; i < kElementCount; i++) {
-    pixels->set(i, i % 256);
-  }
-  // Force GC to trigger verification.
-  CcTest::heap()->CollectAllGarbage(i::Heap::kNoGCFlags);
-  for (int i = 0; i < kElementCount; i++) {
-    CHECK_EQ(i % 256, pixels->get_scalar(i));
-    CHECK_EQ(i % 256, pixel_data[i]);
-  }
-
-  v8::Handle<v8::Object> obj = v8::Object::New(context->GetIsolate());
-  i::Handle<i::JSObject> jsobj = v8::Utils::OpenHandle(*obj);
-  // Set the elements to be the pixels.
-  // jsobj->set_elements(*pixels);
-  obj->SetIndexedPropertiesToPixelData(pixel_data, kElementCount);
-  CheckElementValue(isolate, 1, jsobj, 1);
-  obj->Set(v8_str("field"), v8::Int32::New(CcTest::isolate(), 1503));
-  context->Global()->Set(v8_str("pixels"), obj);
-  v8::Handle<v8::Value> result = CompileRun("pixels.field");
-  CHECK_EQ(1503, result->Int32Value());
-  result = CompileRun("pixels[1]");
-  CHECK_EQ(1, result->Int32Value());
-
-  result = CompileRun("var sum = 0;"
-                      "for (var i = 0; i < 8; i++) {"
-                      "  sum += pixels[i] = pixels[i] = -i;"
-                      "}"
-                      "sum;");
-  CHECK_EQ(-28, result->Int32Value());
-
-  result = CompileRun("var sum = 0;"
-                      "for (var i = 0; i < 8; i++) {"
-                      "  sum += pixels[i] = pixels[i] = 0;"
-                      "}"
-                      "sum;");
-  CHECK_EQ(0, result->Int32Value());
-
-  result = CompileRun("var sum = 0;"
-                      "for (var i = 0; i < 8; i++) {"
-                      "  sum += pixels[i] = pixels[i] = 255;"
-                      "}"
-                      "sum;");
-  CHECK_EQ(8 * 255, result->Int32Value());
-
-  result = CompileRun("var sum = 0;"
-                      "for (var i = 0; i < 8; i++) {"
-                      "  sum += pixels[i] = pixels[i] = 256 + i;"
-                      "}"
-                      "sum;");
-  CHECK_EQ(2076, result->Int32Value());
-
-  result = CompileRun("var sum = 0;"
-                      "for (var i = 0; i < 8; i++) {"
-                      "  sum += pixels[i] = pixels[i] = i;"
-                      "}"
-                      "sum;");
-  CHECK_EQ(28, result->Int32Value());
-
-  result = CompileRun("var sum = 0;"
-                      "for (var i = 0; i < 8; i++) {"
-                      "  sum += pixels[i];"
-                      "}"
-                      "sum;");
-  CHECK_EQ(28, result->Int32Value());
-
-  i::Handle<i::Smi> value(i::Smi::FromInt(2),
-                          reinterpret_cast<i::Isolate*>(context->GetIsolate()));
-  i::Handle<i::Object> no_failure;
-  no_failure = i::JSObject::SetElement(
-      jsobj, 1, value, NONE, i::SLOPPY).ToHandleChecked();
-  DCHECK(!no_failure.is_null());
-  USE(no_failure);
-  CheckElementValue(isolate, 2, jsobj, 1);
-  *value.location() = i::Smi::FromInt(256);
-  no_failure = i::JSObject::SetElement(
-      jsobj, 1, value, NONE, i::SLOPPY).ToHandleChecked();
-  DCHECK(!no_failure.is_null());
-  USE(no_failure);
-  CheckElementValue(isolate, 255, jsobj, 1);
-  *value.location() = i::Smi::FromInt(-1);
-  no_failure = i::JSObject::SetElement(
-      jsobj, 1, value, NONE, i::SLOPPY).ToHandleChecked();
-  DCHECK(!no_failure.is_null());
-  USE(no_failure);
-  CheckElementValue(isolate, 0, jsobj, 1);
-
-  result = CompileRun("for (var i = 0; i < 8; i++) {"
-                      "  pixels[i] = (i * 65) - 109;"
-                      "}"
-                      "pixels[1] + pixels[6];");
-  CHECK_EQ(255, result->Int32Value());
-  CheckElementValue(isolate, 0, jsobj, 0);
-  CheckElementValue(isolate, 0, jsobj, 1);
-  CheckElementValue(isolate, 21, jsobj, 2);
-  CheckElementValue(isolate, 86, jsobj, 3);
-  CheckElementValue(isolate, 151, jsobj, 4);
-  CheckElementValue(isolate, 216, jsobj, 5);
-  CheckElementValue(isolate, 255, jsobj, 6);
-  CheckElementValue(isolate, 255, jsobj, 7);
-  result = CompileRun("var sum = 0;"
-                      "for (var i = 0; i < 8; i++) {"
-                      "  sum += pixels[i];"
-                      "}"
-                      "sum;");
-  CHECK_EQ(984, result->Int32Value());
-
-  result = CompileRun("for (var i = 0; i < 8; i++) {"
-                      "  pixels[i] = (i * 1.1);"
-                      "}"
-                      "pixels[1] + pixels[6];");
-  CHECK_EQ(8, result->Int32Value());
-  CheckElementValue(isolate, 0, jsobj, 0);
-  CheckElementValue(isolate, 1, jsobj, 1);
-  CheckElementValue(isolate, 2, jsobj, 2);
-  CheckElementValue(isolate, 3, jsobj, 3);
-  CheckElementValue(isolate, 4, jsobj, 4);
-  CheckElementValue(isolate, 6, jsobj, 5);
-  CheckElementValue(isolate, 7, jsobj, 6);
-  CheckElementValue(isolate, 8, jsobj, 7);
-
-  result = CompileRun("for (var i = 0; i < 8; i++) {"
-                      "  pixels[7] = undefined;"
-                      "}"
-                      "pixels[7];");
-  CHECK_EQ(0, result->Int32Value());
-  CheckElementValue(isolate, 0, jsobj, 7);
-
-  result = CompileRun("for (var i = 0; i < 8; i++) {"
-                      "  pixels[6] = '2.3';"
-                      "}"
-                      "pixels[6];");
-  CHECK_EQ(2, result->Int32Value());
-  CheckElementValue(isolate, 2, jsobj, 6);
-
-  result = CompileRun("for (var i = 0; i < 8; i++) {"
-                      "  pixels[5] = NaN;"
-                      "}"
-                      "pixels[5];");
-  CHECK_EQ(0, result->Int32Value());
-  CheckElementValue(isolate, 0, jsobj, 5);
-
-  result = CompileRun("for (var i = 0; i < 8; i++) {"
-                      "  pixels[8] = Infinity;"
-                      "}"
-                      "pixels[8];");
-  CHECK_EQ(255, result->Int32Value());
-  CheckElementValue(isolate, 255, jsobj, 8);
-
-  result = CompileRun("for (var i = 0; i < 8; i++) {"
-                      "  pixels[9] = -Infinity;"
-                      "}"
-                      "pixels[9];");
-  CHECK_EQ(0, result->Int32Value());
-  CheckElementValue(isolate, 0, jsobj, 9);
-
-  result = CompileRun("pixels[3] = 33;"
-                      "delete pixels[3];"
-                      "pixels[3];");
-  CHECK_EQ(33, result->Int32Value());
-
-  result = CompileRun("pixels[0] = 10; pixels[1] = 11;"
-                      "pixels[2] = 12; pixels[3] = 13;"
-                      "pixels.__defineGetter__('2',"
-                      "function() { return 120; });"
-                      "pixels[2];");
-  CHECK_EQ(12, result->Int32Value());
-
-  result = CompileRun("var js_array = new Array(40);"
-                      "js_array[0] = 77;"
-                      "js_array;");
-  CHECK_EQ(77, v8::Object::Cast(*result)->Get(v8_str("0"))->Int32Value());
-
-  result = CompileRun("pixels[1] = 23;"
-                      "pixels.__proto__ = [];"
-                      "js_array.__proto__ = pixels;"
-                      "js_array.concat(pixels);");
-  CHECK_EQ(77, v8::Object::Cast(*result)->Get(v8_str("0"))->Int32Value());
-  CHECK_EQ(23, v8::Object::Cast(*result)->Get(v8_str("1"))->Int32Value());
-
-  result = CompileRun("pixels[1] = 23;");
-  CHECK_EQ(23, result->Int32Value());
-
-  // Test for index greater than 255.  Regression test for:
-  // http://code.google.com/p/chromium/issues/detail?id=26337.
-  result = CompileRun("pixels[256] = 255;");
-  CHECK_EQ(255, result->Int32Value());
-  result = CompileRun("var i = 0;"
-                      "for (var j = 0; j < 8; j++) { i = pixels[256]; }"
-                      "i");
-  CHECK_EQ(255, result->Int32Value());
-
-  // Make sure that pixel array ICs recognize when a non-pixel array
-  // is passed to it.
-  result = CompileRun("function pa_load(p) {"
-                      "  var sum = 0;"
-                      "  for (var j = 0; j < 256; j++) { sum += p[j]; }"
-                      "  return sum;"
-                      "}"
-                      "for (var i = 0; i < 256; ++i) { pixels[i] = i; }"
-                      "for (var i = 0; i < 10; ++i) { pa_load(pixels); }"
-                      "just_ints = new Object();"
-                      "for (var i = 0; i < 256; ++i) { just_ints[i] = i; }"
-                      "for (var i = 0; i < 10; ++i) {"
-                      "  result = pa_load(just_ints);"
-                      "}"
-                      "result");
-  CHECK_EQ(32640, result->Int32Value());
-
-  // Make sure that pixel array ICs recognize out-of-bound accesses.
-  result = CompileRun("function pa_load(p, start) {"
-                      "  var sum = 0;"
-                      "  for (var j = start; j < 256; j++) { sum += p[j]; }"
-                      "  return sum;"
-                      "}"
-                      "for (var i = 0; i < 256; ++i) { pixels[i] = i; }"
-                      "for (var i = 0; i < 10; ++i) { pa_load(pixels,0); }"
-                      "for (var i = 0; i < 10; ++i) {"
-                      "  result = pa_load(pixels,-10);"
-                      "}"
-                      "result");
-  CHECK_EQ(0, result->Int32Value());
-
-  // Make sure that generic ICs properly handles a pixel array.
-  result = CompileRun("function pa_load(p) {"
-                      "  var sum = 0;"
-                      "  for (var j = 0; j < 256; j++) { sum += p[j]; }"
-                      "  return sum;"
-                      "}"
-                      "for (var i = 0; i < 256; ++i) { pixels[i] = i; }"
-                      "just_ints = new Object();"
-                      "for (var i = 0; i < 256; ++i) { just_ints[i] = i; }"
-                      "for (var i = 0; i < 10; ++i) { pa_load(just_ints); }"
-                      "for (var i = 0; i < 10; ++i) {"
-                      "  result = pa_load(pixels);"
-                      "}"
-                      "result");
-  CHECK_EQ(32640, result->Int32Value());
-
-  // Make sure that generic load ICs recognize out-of-bound accesses in
-  // pixel arrays.
-  result = CompileRun("function pa_load(p, start) {"
-                      "  var sum = 0;"
-                      "  for (var j = start; j < 256; j++) { sum += p[j]; }"
-                      "  return sum;"
-                      "}"
-                      "for (var i = 0; i < 256; ++i) { pixels[i] = i; }"
-                      "just_ints = new Object();"
-                      "for (var i = 0; i < 256; ++i) { just_ints[i] = i; }"
-                      "for (var i = 0; i < 10; ++i) { pa_load(just_ints,0); }"
-                      "for (var i = 0; i < 10; ++i) { pa_load(pixels,0); }"
-                      "for (var i = 0; i < 10; ++i) {"
-                      "  result = pa_load(pixels,-10);"
-                      "}"
-                      "result");
-  CHECK_EQ(0, result->Int32Value());
-
-  // Make sure that generic ICs properly handles other types than pixel
-  // arrays (that the inlined fast pixel array test leaves the right information
-  // in the right registers).
-  result = CompileRun("function pa_load(p) {"
-                      "  var sum = 0;"
-                      "  for (var j = 0; j < 256; j++) { sum += p[j]; }"
-                      "  return sum;"
-                      "}"
-                      "for (var i = 0; i < 256; ++i) { pixels[i] = i; }"
-                      "just_ints = new Object();"
-                      "for (var i = 0; i < 256; ++i) { just_ints[i] = i; }"
-                      "for (var i = 0; i < 10; ++i) { pa_load(just_ints); }"
-                      "for (var i = 0; i < 10; ++i) { pa_load(pixels); }"
-                      "sparse_array = new Object();"
-                      "for (var i = 0; i < 256; ++i) { sparse_array[i] = i; }"
-                      "sparse_array[1000000] = 3;"
-                      "for (var i = 0; i < 10; ++i) {"
-                      "  result = pa_load(sparse_array);"
-                      "}"
-                      "result");
-  CHECK_EQ(32640, result->Int32Value());
-
-  // Make sure that pixel array store ICs clamp values correctly.
-  result = CompileRun("function pa_store(p) {"
-                      "  for (var j = 0; j < 256; j++) { p[j] = j * 2; }"
-                      "}"
-                      "pa_store(pixels);"
-                      "var sum = 0;"
-                      "for (var j = 0; j < 256; j++) { sum += pixels[j]; }"
-                      "sum");
-  CHECK_EQ(48896, result->Int32Value());
-
-  // Make sure that pixel array stores correctly handle accesses outside
-  // of the pixel array..
-  result = CompileRun("function pa_store(p,start) {"
-                      "  for (var j = 0; j < 256; j++) {"
-                      "    p[j+start] = j * 2;"
-                      "  }"
-                      "}"
-                      "pa_store(pixels,0);"
-                      "pa_store(pixels,-128);"
-                      "var sum = 0;"
-                      "for (var j = 0; j < 256; j++) { sum += pixels[j]; }"
-                      "sum");
-  CHECK_EQ(65280, result->Int32Value());
-
-  // Make sure that the generic store stub correctly handle accesses outside
-  // of the pixel array..
-  result = CompileRun("function pa_store(p,start) {"
-                      "  for (var j = 0; j < 256; j++) {"
-                      "    p[j+start] = j * 2;"
-                      "  }"
-                      "}"
-                      "pa_store(pixels,0);"
-                      "just_ints = new Object();"
-                      "for (var i = 0; i < 256; ++i) { just_ints[i] = i; }"
-                      "pa_store(just_ints, 0);"
-                      "pa_store(pixels,-128);"
-                      "var sum = 0;"
-                      "for (var j = 0; j < 256; j++) { sum += pixels[j]; }"
-                      "sum");
-  CHECK_EQ(65280, result->Int32Value());
-
-  // Make sure that the generic keyed store stub clamps pixel array values
-  // correctly.
-  result = CompileRun("function pa_store(p) {"
-                      "  for (var j = 0; j < 256; j++) { p[j] = j * 2; }"
-                      "}"
-                      "pa_store(pixels);"
-                      "just_ints = new Object();"
-                      "pa_store(just_ints);"
-                      "pa_store(pixels);"
-                      "var sum = 0;"
-                      "for (var j = 0; j < 256; j++) { sum += pixels[j]; }"
-                      "sum");
-  CHECK_EQ(48896, result->Int32Value());
-
-  // Make sure that pixel array loads are optimized by crankshaft.
-  result = CompileRun("function pa_load(p) {"
-                      "  var sum = 0;"
-                      "  for (var i=0; i<256; ++i) {"
-                      "    sum += p[i];"
-                      "  }"
-                      "  return sum; "
-                      "}"
-                      "for (var i = 0; i < 256; ++i) { pixels[i] = i; }"
-                      "for (var i = 0; i < 5000; ++i) {"
-                      "  result = pa_load(pixels);"
-                      "}"
-                      "result");
-  CHECK_EQ(32640, result->Int32Value());
-
-  // Make sure that pixel array stores are optimized by crankshaft.
-  result = CompileRun("function pa_init(p) {"
-                      "for (var i = 0; i < 256; ++i) { p[i] = i; }"
-                      "}"
-                      "function pa_load(p) {"
-                      "  var sum = 0;"
-                      "  for (var i=0; i<256; ++i) {"
-                      "    sum += p[i];"
-                      "  }"
-                      "  return sum; "
-                      "}"
-                      "for (var i = 0; i < 5000; ++i) {"
-                      "  pa_init(pixels);"
-                      "}"
-                      "result = pa_load(pixels);"
-                      "result");
-  CHECK_EQ(32640, result->Int32Value());
-
-  free(pixel_data);
-}
-
-
-THREADED_TEST(PixelArrayInfo) {
-  LocalContext context;
-  v8::HandleScope scope(context->GetIsolate());
-  for (int size = 0; size < 100; size += 10) {
-    uint8_t* pixel_data = reinterpret_cast<uint8_t*>(malloc(size));
-    v8::Handle<v8::Object> obj = v8::Object::New(context->GetIsolate());
-    obj->SetIndexedPropertiesToPixelData(pixel_data, size);
-    CHECK(obj->HasIndexedPropertiesInPixelData());
-    CHECK_EQ(pixel_data, obj->GetIndexedPropertiesPixelData());
-    CHECK_EQ(size, obj->GetIndexedPropertiesPixelDataLength());
-    free(pixel_data);
-  }
-}
-
-
-static void NotHandledIndexedPropertyGetter(
-    uint32_t index,
-    const v8::PropertyCallbackInfo<v8::Value>& info) {
-  ApiTestFuzzer::Fuzz();
-}
-
-
-static void NotHandledIndexedPropertySetter(
-    uint32_t index,
-    Local<Value> value,
-    const v8::PropertyCallbackInfo<v8::Value>& info) {
-  ApiTestFuzzer::Fuzz();
-}
-
-
-THREADED_TEST(PixelArrayWithInterceptor) {
-  LocalContext context;
-  i::Factory* factory = CcTest::i_isolate()->factory();
-  v8::Isolate* isolate = context->GetIsolate();
-  v8::HandleScope scope(isolate);
-  const int kElementCount = 260;
-  uint8_t* pixel_data = reinterpret_cast<uint8_t*>(malloc(kElementCount));
-  i::Handle<i::ExternalUint8ClampedArray> pixels =
-      i::Handle<i::ExternalUint8ClampedArray>::cast(
-          factory->NewExternalArray(kElementCount,
-                                    v8::kExternalUint8ClampedArray,
-                                    pixel_data));
-  for (int i = 0; i < kElementCount; i++) {
-    pixels->set(i, i % 256);
-  }
-  v8::Handle<v8::ObjectTemplate> templ =
-      v8::ObjectTemplate::New(context->GetIsolate());
-  templ->SetHandler(v8::IndexedPropertyHandlerConfiguration(
-      NotHandledIndexedPropertyGetter, NotHandledIndexedPropertySetter));
-  v8::Handle<v8::Object> obj = templ->NewInstance();
-  obj->SetIndexedPropertiesToPixelData(pixel_data, kElementCount);
-  context->Global()->Set(v8_str("pixels"), obj);
-  v8::Handle<v8::Value> result = CompileRun("pixels[1]");
-  CHECK_EQ(1, result->Int32Value());
-  result = CompileRun("var sum = 0;"
-                      "for (var i = 0; i < 8; i++) {"
-                      "  sum += pixels[i] = pixels[i] = -i;"
-                      "}"
-                      "sum;");
-  CHECK_EQ(-28, result->Int32Value());
-  result = CompileRun("pixels.hasOwnProperty('1')");
-  CHECK(result->BooleanValue());
-  free(pixel_data);
-}
-
-
-static int ExternalArrayElementSize(v8::ExternalArrayType array_type) {
-  switch (array_type) {
-    case v8::kExternalInt8Array:
-    case v8::kExternalUint8Array:
-    case v8::kExternalUint8ClampedArray:
-      return 1;
-      break;
-    case v8::kExternalInt16Array:
-    case v8::kExternalUint16Array:
-      return 2;
-      break;
-    case v8::kExternalInt32Array:
-    case v8::kExternalUint32Array:
-    case v8::kExternalFloat32Array:
-      return 4;
-      break;
-    case v8::kExternalFloat64Array:
-      return 8;
-      break;
-    default:
-      UNREACHABLE();
-      return -1;
-  }
-  UNREACHABLE();
-  return -1;
-}
-
-
 template <class ExternalArrayClass, class ElementType>
-static void ObjectWithExternalArrayTestHelper(
-    Handle<Context> context,
-    v8::Handle<Object> obj,
-    int element_count,
-    v8::ExternalArrayType array_type,
-    int64_t low, int64_t high) {
-  i::Handle<i::JSObject> jsobj = v8::Utils::OpenHandle(*obj);
+static void ObjectWithExternalArrayTestHelper(Local<Context> context,
+                                              v8::Local<Object> obj,
+                                              int element_count,
+                                              i::ExternalArrayType array_type,
+                                              int64_t low, int64_t high) {
+  i::Handle<i::JSReceiver> jsobj = v8::Utils::OpenHandle(*obj);
   i::Isolate* isolate = jsobj->GetIsolate();
-  obj->Set(v8_str("field"),
-           v8::Int32::New(reinterpret_cast<v8::Isolate*>(isolate), 1503));
-  context->Global()->Set(v8_str("ext_array"), obj);
-  v8::Handle<v8::Value> result = CompileRun("ext_array.field");
-  CHECK_EQ(1503, result->Int32Value());
+  obj->Set(context, v8_str("field"),
+           v8::Int32::New(reinterpret_cast<v8::Isolate*>(isolate), 1503))
+      .FromJust();
+  CHECK(context->Global()->Set(context, v8_str("ext_array"), obj).FromJust());
+  v8::Local<v8::Value> result = CompileRun("ext_array.field");
+  CHECK_EQ(1503, result->Int32Value(context).FromJust());
   result = CompileRun("ext_array[1]");
-  CHECK_EQ(1, result->Int32Value());
+  CHECK_EQ(1, result->Int32Value(context).FromJust());
 
   // Check assigned smis
   result = CompileRun("for (var i = 0; i < 8; i++) {"
@@ -17058,14 +15424,14 @@
                       "}"
                       "sum;");
 
-  CHECK_EQ(28, result->Int32Value());
+  CHECK_EQ(28, result->Int32Value(context).FromJust());
   // Check pass through of assigned smis
   result = CompileRun("var sum = 0;"
                       "for (var i = 0; i < 8; i++) {"
                       "  sum += ext_array[i] = ext_array[i] = -i;"
                       "}"
                       "sum;");
-  CHECK_EQ(-28, result->Int32Value());
+  CHECK_EQ(-28, result->Int32Value(context).FromJust());
 
 
   // Check assigned smis in reverse order
@@ -17077,7 +15443,7 @@
                       "  sum += ext_array[i];"
                       "}"
                       "sum;");
-  CHECK_EQ(28, result->Int32Value());
+  CHECK_EQ(28, result->Int32Value(context).FromJust());
 
   // Check pass through of assigned HeapNumbers
   result = CompileRun("var sum = 0;"
@@ -17085,7 +15451,7 @@
                       "  sum += ext_array[i] = ext_array[i] = (-i * 0.5);"
                       "}"
                       "sum;");
-  CHECK_EQ(-28, result->Int32Value());
+  CHECK_EQ(-28, result->Int32Value(context).FromJust());
 
   // Check assigned HeapNumbers
   result = CompileRun("for (var i = 0; i < 16; i+=2) {"
@@ -17096,7 +15462,7 @@
                       "  sum += ext_array[i];"
                       "}"
                       "sum;");
-  CHECK_EQ(28, result->Int32Value());
+  CHECK_EQ(28, result->Int32Value(context).FromJust());
 
   // Check assigned HeapNumbers in reverse order
   result = CompileRun("for (var i = 14; i >= 0; i-=2) {"
@@ -17107,7 +15473,7 @@
                       "  sum += ext_array[i];"
                       "}"
                       "sum;");
-  CHECK_EQ(28, result->Int32Value());
+  CHECK_EQ(28, result->Int32Value(context).FromJust());
 
   i::ScopedVector<char> test_buf(1024);
 
@@ -17126,13 +15492,13 @@
               boundary_program,
               low);
   result = CompileRun(test_buf.start());
-  CHECK_EQ(low, result->IntegerValue());
+  CHECK_EQ(low, result->IntegerValue(context).FromJust());
 
   i::SNPrintF(test_buf,
               boundary_program,
               high);
   result = CompileRun(test_buf.start());
-  CHECK_EQ(high, result->IntegerValue());
+  CHECK_EQ(high, result->IntegerValue(context).FromJust());
 
   // Check misprediction of type in IC.
   result = CompileRun("var tmp_array = ext_array;"
@@ -17146,8 +15512,8 @@
                       "}"
                       "sum;");
   // Force GC to trigger verification.
-  CcTest::heap()->CollectAllGarbage(i::Heap::kNoGCFlags);
-  CHECK_EQ(28, result->Int32Value());
+  CcTest::heap()->CollectAllGarbage();
+  CHECK_EQ(28, result->Int32Value(context).FromJust());
 
   // Make sure out-of-range loads do not throw.
   i::SNPrintF(test_buf,
@@ -17160,7 +15526,7 @@
               "caught_exception;",
               element_count);
   result = CompileRun(test_buf.start());
-  CHECK_EQ(false, result->BooleanValue());
+  CHECK_EQ(false, result->BooleanValue(context).FromJust());
 
   // Make sure out-of-range stores do not throw.
   i::SNPrintF(test_buf,
@@ -17173,20 +15539,18 @@
               "caught_exception;",
               element_count);
   result = CompileRun(test_buf.start());
-  CHECK_EQ(false, result->BooleanValue());
+  CHECK_EQ(false, result->BooleanValue(context).FromJust());
 
   // Check other boundary conditions, values and operations.
   result = CompileRun("for (var i = 0; i < 8; i++) {"
                       "  ext_array[7] = undefined;"
                       "}"
                       "ext_array[7];");
-  CHECK_EQ(0, result->Int32Value());
-  if (array_type == v8::kExternalFloat64Array ||
-      array_type == v8::kExternalFloat32Array) {
-    CHECK_EQ(static_cast<int>(v8::base::OS::nan_value()),
-             static_cast<int>(
-                 i::Object::GetElement(
-                     isolate, jsobj, 7).ToHandleChecked()->Number()));
+  CHECK_EQ(0, result->Int32Value(context).FromJust());
+  if (array_type == i::kExternalFloat64Array ||
+      array_type == i::kExternalFloat32Array) {
+    CHECK(std::isnan(
+        i::Object::GetElement(isolate, jsobj, 7).ToHandleChecked()->Number()));
   } else {
     CheckElementValue(isolate, 0, jsobj, 7);
   }
@@ -17195,14 +15559,14 @@
                       "  ext_array[6] = '2.3';"
                       "}"
                       "ext_array[6];");
-  CHECK_EQ(2, result->Int32Value());
+  CHECK_EQ(2, result->Int32Value(context).FromJust());
   CHECK_EQ(2,
            static_cast<int>(
                i::Object::GetElement(
                    isolate, jsobj, 6).ToHandleChecked()->Number()));
 
-  if (array_type != v8::kExternalFloat32Array &&
-      array_type != v8::kExternalFloat64Array) {
+  if (array_type != i::kExternalFloat32Array &&
+      array_type != i::kExternalFloat64Array) {
     // Though the specification doesn't state it, be explicit about
     // converting NaNs and +/-Infinity to zero.
     result = CompileRun("for (var i = 0; i < 8; i++) {"
@@ -17212,7 +15576,7 @@
                         "  ext_array[i] = NaN;"
                         "}"
                         "ext_array[5];");
-    CHECK_EQ(0, result->Int32Value());
+    CHECK_EQ(0, result->Int32Value(context).FromJust());
     CheckElementValue(isolate, 0, jsobj, 5);
 
     result = CompileRun("for (var i = 0; i < 8; i++) {"
@@ -17223,8 +15587,8 @@
                         "}"
                         "ext_array[5];");
     int expected_value =
-        (array_type == v8::kExternalUint8ClampedArray) ? 255 : 0;
-    CHECK_EQ(expected_value, result->Int32Value());
+        (array_type == i::kExternalUint8ClampedArray) ? 255 : 0;
+    CHECK_EQ(expected_value, result->Int32Value(context).FromJust());
     CheckElementValue(isolate, expected_value, jsobj, 5);
 
     result = CompileRun("for (var i = 0; i < 8; i++) {"
@@ -17234,7 +15598,7 @@
                         "  ext_array[i] = -Infinity;"
                         "}"
                         "ext_array[5];");
-    CHECK_EQ(0, result->Int32Value());
+    CHECK_EQ(0, result->Int32Value(context).FromJust());
     CheckElementValue(isolate, 0, jsobj, 5);
 
     // Check truncation behavior of integral arrays.
@@ -17247,11 +15611,10 @@
     const char* pixel_data =
         "var source_data = [0.6, 10.6];"
         "var expected_results = [1, 11];";
-    bool is_unsigned =
-        (array_type == v8::kExternalUint8Array ||
-         array_type == v8::kExternalUint16Array ||
-         array_type == v8::kExternalUint32Array);
-    bool is_pixel_data = array_type == v8::kExternalUint8ClampedArray;
+    bool is_unsigned = (array_type == i::kExternalUint8Array ||
+                        array_type == i::kExternalUint16Array ||
+                        array_type == i::kExternalUint32Array);
+    bool is_pixel_data = array_type == i::kExternalUint8ClampedArray;
 
     i::SNPrintF(test_buf,
                 "%s"
@@ -17268,11 +15631,11 @@
                      unsigned_data :
                      (is_pixel_data ? pixel_data : signed_data)));
     result = CompileRun(test_buf.start());
-    CHECK_EQ(true, result->BooleanValue());
+    CHECK_EQ(true, result->BooleanValue(context).FromJust());
   }
 
-  i::Handle<ExternalArrayClass> array(
-      ExternalArrayClass::cast(jsobj->elements()));
+  i::Handle<ExternalArrayClass> array(ExternalArrayClass::cast(
+      i::Handle<i::JSObject>::cast(jsobj)->elements()));
   for (int i = 0; i < element_count; i++) {
     array->set(i, static_cast<ElementType>(i));
   }
@@ -17290,7 +15653,7 @@
                       "  sum=ee_op_test_complex_func(sum);"
                       "}"
                       "sum;");
-  CHECK_EQ(16000000, result->Int32Value());
+  CHECK_EQ(16000000, result->Int32Value(context).FromJust());
 
   // Test count operations
   result = CompileRun("function ee_op_test_count_func(sum) {"
@@ -17305,72 +15668,77 @@
                       "  sum=ee_op_test_count_func(sum);"
                       "}"
                       "sum;");
-  CHECK_EQ(16000000, result->Int32Value());
+  CHECK_EQ(16000000, result->Int32Value(context).FromJust());
 
   result = CompileRun("ext_array[3] = 33;"
                       "delete ext_array[3];"
                       "ext_array[3];");
-  CHECK_EQ(33, result->Int32Value());
+  CHECK_EQ(33, result->Int32Value(context).FromJust());
 
   result = CompileRun("ext_array[0] = 10; ext_array[1] = 11;"
                       "ext_array[2] = 12; ext_array[3] = 13;"
                       "ext_array.__defineGetter__('2',"
                       "function() { return 120; });"
                       "ext_array[2];");
-  CHECK_EQ(12, result->Int32Value());
+  CHECK_EQ(12, result->Int32Value(context).FromJust());
 
   result = CompileRun("var js_array = new Array(40);"
                       "js_array[0] = 77;"
                       "js_array;");
-  CHECK_EQ(77, v8::Object::Cast(*result)->Get(v8_str("0"))->Int32Value());
+  CHECK_EQ(77, v8::Object::Cast(*result)
+                   ->Get(context, v8_str("0"))
+                   .ToLocalChecked()
+                   ->Int32Value(context)
+                   .FromJust());
 
   result = CompileRun("ext_array[1] = 23;"
                       "ext_array.__proto__ = [];"
                       "js_array.__proto__ = ext_array;"
                       "js_array.concat(ext_array);");
-  CHECK_EQ(77, v8::Object::Cast(*result)->Get(v8_str("0"))->Int32Value());
-  CHECK_EQ(23, v8::Object::Cast(*result)->Get(v8_str("1"))->Int32Value());
+  CHECK_EQ(77, v8::Object::Cast(*result)
+                   ->Get(context, v8_str("0"))
+                   .ToLocalChecked()
+                   ->Int32Value(context)
+                   .FromJust());
+  CHECK_EQ(23, v8::Object::Cast(*result)
+                   ->Get(context, v8_str("1"))
+                   .ToLocalChecked()
+                   ->Int32Value(context)
+                   .FromJust());
 
   result = CompileRun("ext_array[1] = 23;");
-  CHECK_EQ(23, result->Int32Value());
+  CHECK_EQ(23, result->Int32Value(context).FromJust());
 }
 
 
-template <class FixedTypedArrayClass,
-          i::ElementsKind elements_kind,
+template <class FixedTypedArrayClass, i::ElementsKind elements_kind,
           class ElementType>
-static void FixedTypedArrayTestHelper(
-    v8::ExternalArrayType array_type,
-    ElementType low,
-    ElementType high) {
+static void FixedTypedArrayTestHelper(i::ExternalArrayType array_type,
+                                      ElementType low, ElementType high) {
   i::FLAG_allow_natives_syntax = true;
   LocalContext context;
   i::Isolate* isolate = CcTest::i_isolate();
   i::Factory* factory = isolate->factory();
   v8::HandleScope scope(context->GetIsolate());
   const int kElementCount = 260;
-  i::Handle<FixedTypedArrayClass> fixed_array =
-    i::Handle<FixedTypedArrayClass>::cast(
-        factory->NewFixedTypedArray(kElementCount, array_type));
+  i::Handle<i::JSTypedArray> jsobj =
+      factory->NewJSTypedArray(elements_kind, kElementCount);
+  i::Handle<FixedTypedArrayClass> fixed_array(
+      FixedTypedArrayClass::cast(jsobj->elements()));
   CHECK_EQ(FixedTypedArrayClass::kInstanceType,
            fixed_array->map()->instance_type());
   CHECK_EQ(kElementCount, fixed_array->length());
-  CcTest::heap()->CollectAllGarbage(i::Heap::kNoGCFlags);
+  CcTest::heap()->CollectAllGarbage();
   for (int i = 0; i < kElementCount; i++) {
     fixed_array->set(i, static_cast<ElementType>(i));
   }
   // Force GC to trigger verification.
-  CcTest::heap()->CollectAllGarbage(i::Heap::kNoGCFlags);
+  CcTest::heap()->CollectAllGarbage();
   for (int i = 0; i < kElementCount; i++) {
     CHECK_EQ(static_cast<int64_t>(static_cast<ElementType>(i)),
              static_cast<int64_t>(fixed_array->get_scalar(i)));
   }
-  v8::Handle<v8::Object> obj = v8::Object::New(CcTest::isolate());
-  i::Handle<i::JSObject> jsobj = v8::Utils::OpenHandle(*obj);
-  i::Handle<i::Map> fixed_array_map =
-      i::JSObject::GetElementsTransitionMap(jsobj, elements_kind);
-  jsobj->set_map(*fixed_array_map);
-  jsobj->set_elements(*fixed_array);
+  v8::Local<v8::Object> obj = v8::Utils::ToLocal(jsobj);
 
   ObjectWithExternalArrayTestHelper<FixedTypedArrayClass, ElementType>(
       context.local(), obj, kElementCount, array_type,
@@ -17381,442 +15749,63 @@
 
 THREADED_TEST(FixedUint8Array) {
   FixedTypedArrayTestHelper<i::FixedUint8Array, i::UINT8_ELEMENTS, uint8_t>(
-    v8::kExternalUint8Array,
-    0x0, 0xFF);
+      i::kExternalUint8Array, 0x0, 0xFF);
 }
 
 
 THREADED_TEST(FixedUint8ClampedArray) {
   FixedTypedArrayTestHelper<i::FixedUint8ClampedArray,
                             i::UINT8_CLAMPED_ELEMENTS, uint8_t>(
-    v8::kExternalUint8ClampedArray,
-    0x0, 0xFF);
+      i::kExternalUint8ClampedArray, 0x0, 0xFF);
 }
 
 
 THREADED_TEST(FixedInt8Array) {
   FixedTypedArrayTestHelper<i::FixedInt8Array, i::INT8_ELEMENTS, int8_t>(
-    v8::kExternalInt8Array,
-    -0x80, 0x7F);
+      i::kExternalInt8Array, -0x80, 0x7F);
 }
 
 
 THREADED_TEST(FixedUint16Array) {
   FixedTypedArrayTestHelper<i::FixedUint16Array, i::UINT16_ELEMENTS, uint16_t>(
-    v8::kExternalUint16Array,
-    0x0, 0xFFFF);
+      i::kExternalUint16Array, 0x0, 0xFFFF);
 }
 
 
 THREADED_TEST(FixedInt16Array) {
   FixedTypedArrayTestHelper<i::FixedInt16Array, i::INT16_ELEMENTS, int16_t>(
-    v8::kExternalInt16Array,
-    -0x8000, 0x7FFF);
+      i::kExternalInt16Array, -0x8000, 0x7FFF);
 }
 
 
 THREADED_TEST(FixedUint32Array) {
   FixedTypedArrayTestHelper<i::FixedUint32Array, i::UINT32_ELEMENTS, uint32_t>(
-    v8::kExternalUint32Array,
-    0x0, UINT_MAX);
+      i::kExternalUint32Array, 0x0, UINT_MAX);
 }
 
 
 THREADED_TEST(FixedInt32Array) {
   FixedTypedArrayTestHelper<i::FixedInt32Array, i::INT32_ELEMENTS, int32_t>(
-    v8::kExternalInt32Array,
-    INT_MIN, INT_MAX);
+      i::kExternalInt32Array, INT_MIN, INT_MAX);
 }
 
 
 THREADED_TEST(FixedFloat32Array) {
   FixedTypedArrayTestHelper<i::FixedFloat32Array, i::FLOAT32_ELEMENTS, float>(
-    v8::kExternalFloat32Array,
-    -500, 500);
+      i::kExternalFloat32Array, -500, 500);
 }
 
 
 THREADED_TEST(FixedFloat64Array) {
   FixedTypedArrayTestHelper<i::FixedFloat64Array, i::FLOAT64_ELEMENTS, float>(
-    v8::kExternalFloat64Array,
-    -500, 500);
+      i::kExternalFloat64Array, -500, 500);
 }
 
 
-template <class ExternalArrayClass, class ElementType>
-static void ExternalArrayTestHelper(v8::ExternalArrayType array_type,
-                                    int64_t low,
-                                    int64_t high) {
-  LocalContext context;
-  i::Isolate* isolate = CcTest::i_isolate();
-  i::Factory* factory = isolate->factory();
-  v8::HandleScope scope(context->GetIsolate());
-  const int kElementCount = 40;
-  int element_size = ExternalArrayElementSize(array_type);
-  ElementType* array_data =
-      static_cast<ElementType*>(malloc(kElementCount * element_size));
-  i::Handle<ExternalArrayClass> array =
-      i::Handle<ExternalArrayClass>::cast(
-          factory->NewExternalArray(kElementCount, array_type, array_data));
-  // Force GC to trigger verification.
-  CcTest::heap()->CollectAllGarbage(i::Heap::kNoGCFlags);
-  for (int i = 0; i < kElementCount; i++) {
-    array->set(i, static_cast<ElementType>(i));
-  }
-  // Force GC to trigger verification.
-  CcTest::heap()->CollectAllGarbage(i::Heap::kNoGCFlags);
-  for (int i = 0; i < kElementCount; i++) {
-    CHECK_EQ(static_cast<int64_t>(i),
-             static_cast<int64_t>(array->get_scalar(i)));
-    CHECK_EQ(static_cast<int64_t>(i), static_cast<int64_t>(array_data[i]));
-  }
-
-  v8::Handle<v8::Object> obj = v8::Object::New(context->GetIsolate());
-  i::Handle<i::JSObject> jsobj = v8::Utils::OpenHandle(*obj);
-  // Set the elements to be the external array.
-  obj->SetIndexedPropertiesToExternalArrayData(array_data,
-                                               array_type,
-                                               kElementCount);
-  CHECK_EQ(1,
-           static_cast<int>(
-               i::Object::GetElement(
-                   isolate, jsobj, 1).ToHandleChecked()->Number()));
-
-  ObjectWithExternalArrayTestHelper<ExternalArrayClass, ElementType>(
-      context.local(), obj, kElementCount, array_type, low, high);
-
-  v8::Handle<v8::Value> result;
-
-  // Test more complex manipulations which cause eax to contain values
-  // that won't be completely overwritten by loads from the arrays.
-  // This catches bugs in the instructions used for the KeyedLoadIC
-  // for byte and word types.
-  {
-    const int kXSize = 300;
-    const int kYSize = 300;
-    const int kLargeElementCount = kXSize * kYSize * 4;
-    ElementType* large_array_data =
-        static_cast<ElementType*>(malloc(kLargeElementCount * element_size));
-    v8::Handle<v8::Object> large_obj = v8::Object::New(context->GetIsolate());
-    // Set the elements to be the external array.
-    large_obj->SetIndexedPropertiesToExternalArrayData(large_array_data,
-                                                       array_type,
-                                                       kLargeElementCount);
-    context->Global()->Set(v8_str("large_array"), large_obj);
-    // Initialize contents of a few rows.
-    for (int x = 0; x < 300; x++) {
-      int row = 0;
-      int offset = row * 300 * 4;
-      large_array_data[offset + 4 * x + 0] = (ElementType) 127;
-      large_array_data[offset + 4 * x + 1] = (ElementType) 0;
-      large_array_data[offset + 4 * x + 2] = (ElementType) 0;
-      large_array_data[offset + 4 * x + 3] = (ElementType) 127;
-      row = 150;
-      offset = row * 300 * 4;
-      large_array_data[offset + 4 * x + 0] = (ElementType) 127;
-      large_array_data[offset + 4 * x + 1] = (ElementType) 0;
-      large_array_data[offset + 4 * x + 2] = (ElementType) 0;
-      large_array_data[offset + 4 * x + 3] = (ElementType) 127;
-      row = 298;
-      offset = row * 300 * 4;
-      large_array_data[offset + 4 * x + 0] = (ElementType) 127;
-      large_array_data[offset + 4 * x + 1] = (ElementType) 0;
-      large_array_data[offset + 4 * x + 2] = (ElementType) 0;
-      large_array_data[offset + 4 * x + 3] = (ElementType) 127;
-    }
-    // The goal of the code below is to make "offset" large enough
-    // that the computation of the index (which goes into eax) has
-    // high bits set which will not be overwritten by a byte or short
-    // load.
-    result = CompileRun("var failed = false;"
-                        "var offset = 0;"
-                        "for (var i = 0; i < 300; i++) {"
-                        "  if (large_array[4 * i] != 127 ||"
-                        "      large_array[4 * i + 1] != 0 ||"
-                        "      large_array[4 * i + 2] != 0 ||"
-                        "      large_array[4 * i + 3] != 127) {"
-                        "    failed = true;"
-                        "  }"
-                        "}"
-                        "offset = 150 * 300 * 4;"
-                        "for (var i = 0; i < 300; i++) {"
-                        "  if (large_array[offset + 4 * i] != 127 ||"
-                        "      large_array[offset + 4 * i + 1] != 0 ||"
-                        "      large_array[offset + 4 * i + 2] != 0 ||"
-                        "      large_array[offset + 4 * i + 3] != 127) {"
-                        "    failed = true;"
-                        "  }"
-                        "}"
-                        "offset = 298 * 300 * 4;"
-                        "for (var i = 0; i < 300; i++) {"
-                        "  if (large_array[offset + 4 * i] != 127 ||"
-                        "      large_array[offset + 4 * i + 1] != 0 ||"
-                        "      large_array[offset + 4 * i + 2] != 0 ||"
-                        "      large_array[offset + 4 * i + 3] != 127) {"
-                        "    failed = true;"
-                        "  }"
-                        "}"
-                        "!failed;");
-    CHECK_EQ(true, result->BooleanValue());
-    free(large_array_data);
-  }
-
-  // The "" property descriptor is overloaded to store information about
-  // the external array. Ensure that setting and accessing the "" property
-  // works (it should overwrite the information cached about the external
-  // array in the DescriptorArray) in various situations.
-  result = CompileRun("ext_array[''] = 23; ext_array['']");
-  CHECK_EQ(23, result->Int32Value());
-
-  // Property "" set after the external array is associated with the object.
-  {
-    v8::Handle<v8::Object> obj2 = v8::Object::New(context->GetIsolate());
-    obj2->Set(v8_str("ee_test_field"),
-              v8::Int32::New(context->GetIsolate(), 256));
-    obj2->Set(v8_str(""), v8::Int32::New(context->GetIsolate(), 1503));
-    // Set the elements to be the external array.
-    obj2->SetIndexedPropertiesToExternalArrayData(array_data,
-                                                  array_type,
-                                                  kElementCount);
-    context->Global()->Set(v8_str("ext_array"), obj2);
-    result = CompileRun("ext_array['']");
-    CHECK_EQ(1503, result->Int32Value());
-  }
-
-  // Property "" set after the external array is associated with the object.
-  {
-    v8::Handle<v8::Object> obj2 = v8::Object::New(context->GetIsolate());
-    obj2->Set(v8_str("ee_test_field_2"),
-              v8::Int32::New(context->GetIsolate(), 256));
-    // Set the elements to be the external array.
-    obj2->SetIndexedPropertiesToExternalArrayData(array_data,
-                                                  array_type,
-                                                  kElementCount);
-    obj2->Set(v8_str(""), v8::Int32::New(context->GetIsolate(), 1503));
-    context->Global()->Set(v8_str("ext_array"), obj2);
-    result = CompileRun("ext_array['']");
-    CHECK_EQ(1503, result->Int32Value());
-  }
-
-  // Should reuse the map from previous test.
-  {
-    v8::Handle<v8::Object> obj2 = v8::Object::New(context->GetIsolate());
-    obj2->Set(v8_str("ee_test_field_2"),
-              v8::Int32::New(context->GetIsolate(), 256));
-    // Set the elements to be the external array. Should re-use the map
-    // from previous test.
-    obj2->SetIndexedPropertiesToExternalArrayData(array_data,
-                                                  array_type,
-                                                  kElementCount);
-    context->Global()->Set(v8_str("ext_array"), obj2);
-    result = CompileRun("ext_array['']");
-  }
-
-  // Property "" is a constant function that shouldn't not be interfered with
-  // when an external array is set.
-  {
-    v8::Handle<v8::Object> obj2 = v8::Object::New(context->GetIsolate());
-    // Start
-    obj2->Set(v8_str("ee_test_field3"),
-              v8::Int32::New(context->GetIsolate(), 256));
-
-    // Add a constant function to an object.
-    context->Global()->Set(v8_str("ext_array"), obj2);
-    result = CompileRun("ext_array[''] = function() {return 1503;};"
-                        "ext_array['']();");
-
-    // Add an external array transition to the same map that
-    // has the constant transition.
-    v8::Handle<v8::Object> obj3 = v8::Object::New(context->GetIsolate());
-    obj3->Set(v8_str("ee_test_field3"),
-              v8::Int32::New(context->GetIsolate(), 256));
-    obj3->SetIndexedPropertiesToExternalArrayData(array_data,
-                                                  array_type,
-                                                  kElementCount);
-    context->Global()->Set(v8_str("ext_array"), obj3);
-  }
-
-  // If a external array transition is in the map, it should get clobbered
-  // by a constant function.
-  {
-    // Add an external array transition.
-    v8::Handle<v8::Object> obj3 = v8::Object::New(context->GetIsolate());
-    obj3->Set(v8_str("ee_test_field4"),
-              v8::Int32::New(context->GetIsolate(), 256));
-    obj3->SetIndexedPropertiesToExternalArrayData(array_data,
-                                                  array_type,
-                                                  kElementCount);
-
-    // Add a constant function to the same map that just got an external array
-    // transition.
-    v8::Handle<v8::Object> obj2 = v8::Object::New(context->GetIsolate());
-    obj2->Set(v8_str("ee_test_field4"),
-              v8::Int32::New(context->GetIsolate(), 256));
-    context->Global()->Set(v8_str("ext_array"), obj2);
-    result = CompileRun("ext_array[''] = function() {return 1503;};"
-                        "ext_array['']();");
-  }
-
-  free(array_data);
-}
-
-
-THREADED_TEST(ExternalInt8Array) {
-  ExternalArrayTestHelper<i::ExternalInt8Array, int8_t>(
-      v8::kExternalInt8Array,
-      -128,
-      127);
-}
-
-
-THREADED_TEST(ExternalUint8Array) {
-  ExternalArrayTestHelper<i::ExternalUint8Array, uint8_t>(
-      v8::kExternalUint8Array,
-      0,
-      255);
-}
-
-
-THREADED_TEST(ExternalUint8ClampedArray) {
-  ExternalArrayTestHelper<i::ExternalUint8ClampedArray, uint8_t>(
-      v8::kExternalUint8ClampedArray,
-      0,
-      255);
-}
-
-
-THREADED_TEST(ExternalInt16Array) {
-  ExternalArrayTestHelper<i::ExternalInt16Array, int16_t>(
-      v8::kExternalInt16Array,
-      -32768,
-      32767);
-}
-
-
-THREADED_TEST(ExternalUint16Array) {
-  ExternalArrayTestHelper<i::ExternalUint16Array, uint16_t>(
-      v8::kExternalUint16Array,
-      0,
-      65535);
-}
-
-
-THREADED_TEST(ExternalInt32Array) {
-  ExternalArrayTestHelper<i::ExternalInt32Array, int32_t>(
-      v8::kExternalInt32Array,
-      INT_MIN,   // -2147483648
-      INT_MAX);  //  2147483647
-}
-
-
-THREADED_TEST(ExternalUint32Array) {
-  ExternalArrayTestHelper<i::ExternalUint32Array, uint32_t>(
-      v8::kExternalUint32Array,
-      0,
-      UINT_MAX);  // 4294967295
-}
-
-
-THREADED_TEST(ExternalFloat32Array) {
-  ExternalArrayTestHelper<i::ExternalFloat32Array, float>(
-      v8::kExternalFloat32Array,
-      -500,
-      500);
-}
-
-
-THREADED_TEST(ExternalFloat64Array) {
-  ExternalArrayTestHelper<i::ExternalFloat64Array, double>(
-      v8::kExternalFloat64Array,
-      -500,
-      500);
-}
-
-
-THREADED_TEST(ExternalArrays) {
-  TestExternalInt8Array();
-  TestExternalUint8Array();
-  TestExternalInt16Array();
-  TestExternalUint16Array();
-  TestExternalInt32Array();
-  TestExternalUint32Array();
-  TestExternalFloat32Array();
-}
-
-
-void ExternalArrayInfoTestHelper(v8::ExternalArrayType array_type) {
-  LocalContext context;
-  v8::HandleScope scope(context->GetIsolate());
-  for (int size = 0; size < 100; size += 10) {
-    int element_size = ExternalArrayElementSize(array_type);
-    void* external_data = malloc(size * element_size);
-    v8::Handle<v8::Object> obj = v8::Object::New(context->GetIsolate());
-    obj->SetIndexedPropertiesToExternalArrayData(
-        external_data, array_type, size);
-    CHECK(obj->HasIndexedPropertiesInExternalArrayData());
-    CHECK_EQ(external_data, obj->GetIndexedPropertiesExternalArrayData());
-    CHECK_EQ(array_type, obj->GetIndexedPropertiesExternalArrayDataType());
-    CHECK_EQ(size, obj->GetIndexedPropertiesExternalArrayDataLength());
-    free(external_data);
-  }
-}
-
-
-THREADED_TEST(ExternalArrayInfo) {
-  ExternalArrayInfoTestHelper(v8::kExternalInt8Array);
-  ExternalArrayInfoTestHelper(v8::kExternalUint8Array);
-  ExternalArrayInfoTestHelper(v8::kExternalInt16Array);
-  ExternalArrayInfoTestHelper(v8::kExternalUint16Array);
-  ExternalArrayInfoTestHelper(v8::kExternalInt32Array);
-  ExternalArrayInfoTestHelper(v8::kExternalUint32Array);
-  ExternalArrayInfoTestHelper(v8::kExternalFloat32Array);
-  ExternalArrayInfoTestHelper(v8::kExternalFloat64Array);
-  ExternalArrayInfoTestHelper(v8::kExternalUint8ClampedArray);
-}
-
-
-void ExtArrayLimitsHelper(v8::Isolate* isolate,
-                          v8::ExternalArrayType array_type,
-                          int size) {
-  v8::Handle<v8::Object> obj = v8::Object::New(isolate);
-  v8::V8::SetFatalErrorHandler(StoringErrorCallback);
-  last_location = last_message = NULL;
-  obj->SetIndexedPropertiesToExternalArrayData(NULL, array_type, size);
-  CHECK(!obj->HasIndexedPropertiesInExternalArrayData());
-  CHECK_NE(NULL, last_location);
-  CHECK_NE(NULL, last_message);
-}
-
-
-TEST(ExternalArrayLimits) {
-  LocalContext context;
-  v8::Isolate* isolate = context->GetIsolate();
-  v8::HandleScope scope(isolate);
-  ExtArrayLimitsHelper(isolate, v8::kExternalInt8Array, 0x40000000);
-  ExtArrayLimitsHelper(isolate, v8::kExternalInt8Array, 0xffffffff);
-  ExtArrayLimitsHelper(isolate, v8::kExternalUint8Array, 0x40000000);
-  ExtArrayLimitsHelper(isolate, v8::kExternalUint8Array, 0xffffffff);
-  ExtArrayLimitsHelper(isolate, v8::kExternalInt16Array, 0x40000000);
-  ExtArrayLimitsHelper(isolate, v8::kExternalInt16Array, 0xffffffff);
-  ExtArrayLimitsHelper(isolate, v8::kExternalUint16Array, 0x40000000);
-  ExtArrayLimitsHelper(isolate, v8::kExternalUint16Array, 0xffffffff);
-  ExtArrayLimitsHelper(isolate, v8::kExternalInt32Array, 0x40000000);
-  ExtArrayLimitsHelper(isolate, v8::kExternalInt32Array, 0xffffffff);
-  ExtArrayLimitsHelper(isolate, v8::kExternalUint32Array, 0x40000000);
-  ExtArrayLimitsHelper(isolate, v8::kExternalUint32Array, 0xffffffff);
-  ExtArrayLimitsHelper(isolate, v8::kExternalFloat32Array, 0x40000000);
-  ExtArrayLimitsHelper(isolate, v8::kExternalFloat32Array, 0xffffffff);
-  ExtArrayLimitsHelper(isolate, v8::kExternalFloat64Array, 0x40000000);
-  ExtArrayLimitsHelper(isolate, v8::kExternalFloat64Array, 0xffffffff);
-  ExtArrayLimitsHelper(isolate, v8::kExternalUint8ClampedArray, 0x40000000);
-  ExtArrayLimitsHelper(isolate, v8::kExternalUint8ClampedArray, 0xffffffff);
-}
-
-
-template <typename ElementType, typename TypedArray,
-          class ExternalArrayClass>
-void TypedArrayTestHelper(v8::ExternalArrayType array_type,
-                          int64_t low, int64_t high) {
+template <typename ElementType, typename TypedArray, class ExternalArrayClass,
+          class ArrayBufferType>
+void TypedArrayTestHelper(i::ExternalArrayType array_type, int64_t low,
+                          int64_t high) {
   const int kElementCount = 50;
 
   i::ScopedVector<ElementType> backing_store(kElementCount+2);
@@ -17825,17 +15814,16 @@
   v8::Isolate* isolate = env->GetIsolate();
   v8::HandleScope handle_scope(isolate);
 
-  Local<v8::ArrayBuffer> ab =
-      v8::ArrayBuffer::New(isolate, backing_store.start(),
+  Local<ArrayBufferType> ab =
+      ArrayBufferType::New(isolate, backing_store.start(),
                            (kElementCount + 2) * sizeof(ElementType));
   Local<TypedArray> ta =
       TypedArray::New(ab, 2*sizeof(ElementType), kElementCount);
   CheckInternalFieldsAreZero<v8::ArrayBufferView>(ta);
   CHECK_EQ(kElementCount, static_cast<int>(ta->Length()));
-  CHECK_EQ(2*sizeof(ElementType), static_cast<int>(ta->ByteOffset()));
-  CHECK_EQ(kElementCount*sizeof(ElementType),
-           static_cast<int>(ta->ByteLength()));
-  CHECK_EQ(ab, ta->Buffer());
+  CHECK_EQ(2 * sizeof(ElementType), ta->ByteOffset());
+  CHECK_EQ(kElementCount * sizeof(ElementType), ta->ByteLength());
+  CHECK(ab->Equals(env.local(), ta->Buffer()).FromJust());
 
   ElementType* data = backing_store.start() + 2;
   for (int i = 0; i < kElementCount; i++) {
@@ -17848,59 +15836,59 @@
 
 
 THREADED_TEST(Uint8Array) {
-  TypedArrayTestHelper<uint8_t, v8::Uint8Array, i::ExternalUint8Array>(
-      v8::kExternalUint8Array, 0, 0xFF);
+  TypedArrayTestHelper<uint8_t, v8::Uint8Array, i::FixedUint8Array,
+                       v8::ArrayBuffer>(i::kExternalUint8Array, 0, 0xFF);
 }
 
 
 THREADED_TEST(Int8Array) {
-  TypedArrayTestHelper<int8_t, v8::Int8Array, i::ExternalInt8Array>(
-      v8::kExternalInt8Array, -0x80, 0x7F);
+  TypedArrayTestHelper<int8_t, v8::Int8Array, i::FixedInt8Array,
+                       v8::ArrayBuffer>(i::kExternalInt8Array, -0x80, 0x7F);
 }
 
 
 THREADED_TEST(Uint16Array) {
-  TypedArrayTestHelper<uint16_t,
-                       v8::Uint16Array,
-                       i::ExternalUint16Array>(
-      v8::kExternalUint16Array, 0, 0xFFFF);
+  TypedArrayTestHelper<uint16_t, v8::Uint16Array, i::FixedUint16Array,
+                       v8::ArrayBuffer>(i::kExternalUint16Array, 0, 0xFFFF);
 }
 
 
 THREADED_TEST(Int16Array) {
-  TypedArrayTestHelper<int16_t, v8::Int16Array, i::ExternalInt16Array>(
-      v8::kExternalInt16Array, -0x8000, 0x7FFF);
+  TypedArrayTestHelper<int16_t, v8::Int16Array, i::FixedInt16Array,
+                       v8::ArrayBuffer>(i::kExternalInt16Array, -0x8000,
+                                        0x7FFF);
 }
 
 
 THREADED_TEST(Uint32Array) {
-  TypedArrayTestHelper<uint32_t, v8::Uint32Array, i::ExternalUint32Array>(
-      v8::kExternalUint32Array, 0, UINT_MAX);
+  TypedArrayTestHelper<uint32_t, v8::Uint32Array, i::FixedUint32Array,
+                       v8::ArrayBuffer>(i::kExternalUint32Array, 0, UINT_MAX);
 }
 
 
 THREADED_TEST(Int32Array) {
-  TypedArrayTestHelper<int32_t, v8::Int32Array, i::ExternalInt32Array>(
-      v8::kExternalInt32Array, INT_MIN, INT_MAX);
+  TypedArrayTestHelper<int32_t, v8::Int32Array, i::FixedInt32Array,
+                       v8::ArrayBuffer>(i::kExternalInt32Array, INT_MIN,
+                                        INT_MAX);
 }
 
 
 THREADED_TEST(Float32Array) {
-  TypedArrayTestHelper<float, v8::Float32Array, i::ExternalFloat32Array>(
-      v8::kExternalFloat32Array, -500, 500);
+  TypedArrayTestHelper<float, v8::Float32Array, i::FixedFloat32Array,
+                       v8::ArrayBuffer>(i::kExternalFloat32Array, -500, 500);
 }
 
 
 THREADED_TEST(Float64Array) {
-  TypedArrayTestHelper<double, v8::Float64Array, i::ExternalFloat64Array>(
-      v8::kExternalFloat64Array, -500, 500);
+  TypedArrayTestHelper<double, v8::Float64Array, i::FixedFloat64Array,
+                       v8::ArrayBuffer>(i::kExternalFloat64Array, -500, 500);
 }
 
 
 THREADED_TEST(Uint8ClampedArray) {
-  TypedArrayTestHelper<uint8_t,
-                       v8::Uint8ClampedArray, i::ExternalUint8ClampedArray>(
-      v8::kExternalUint8ClampedArray, 0, 0xFF);
+  TypedArrayTestHelper<uint8_t, v8::Uint8ClampedArray,
+                       i::FixedUint8ClampedArray, v8::ArrayBuffer>(
+      i::kExternalUint8ClampedArray, 0, 0xFF);
 }
 
 
@@ -17915,27 +15903,166 @@
 
   Local<v8::ArrayBuffer> ab =
       v8::ArrayBuffer::New(isolate, backing_store.start(), 2 + kSize);
-  Local<v8::DataView> dv =
-      v8::DataView::New(ab, 2, kSize);
+  Local<v8::DataView> dv = v8::DataView::New(ab, 2, kSize);
   CheckInternalFieldsAreZero<v8::ArrayBufferView>(dv);
-  CHECK_EQ(2, static_cast<int>(dv->ByteOffset()));
+  CHECK_EQ(2u, dv->ByteOffset());
   CHECK_EQ(kSize, static_cast<int>(dv->ByteLength()));
-  CHECK_EQ(ab, dv->Buffer());
+  CHECK(ab->Equals(env.local(), dv->Buffer()).FromJust());
 }
 
 
-#define IS_ARRAY_BUFFER_VIEW_TEST(View)                                       \
-  THREADED_TEST(Is##View) {                                                   \
-    LocalContext env;                                                         \
-    v8::Isolate* isolate = env->GetIsolate();                                 \
-    v8::HandleScope handle_scope(isolate);                                    \
-                                                                              \
-    Handle<Value> result = CompileRun(                                        \
-        "var ab = new ArrayBuffer(128);"                                      \
-        "new " #View "(ab)");                                                 \
-    CHECK(result->IsArrayBufferView());                                       \
-    CHECK(result->Is##View());                                                \
-    CheckInternalFieldsAreZero<v8::ArrayBufferView>(result.As<v8::View>());   \
+THREADED_TEST(SkipArrayBufferBackingStoreDuringGC) {
+  LocalContext env;
+  v8::Isolate* isolate = env->GetIsolate();
+  v8::HandleScope handle_scope(isolate);
+
+  // Make sure the pointer looks like a heap object
+  uint8_t* store_ptr = reinterpret_cast<uint8_t*>(i::kHeapObjectTag);
+
+  // Create ArrayBuffer with pointer-that-cannot-be-visited in the backing store
+  Local<v8::ArrayBuffer> ab = v8::ArrayBuffer::New(isolate, store_ptr, 8);
+
+  // Should not crash
+  CcTest::heap()->CollectGarbage(i::NEW_SPACE);  // in survivor space now
+  CcTest::heap()->CollectGarbage(i::NEW_SPACE);  // in old gen now
+  CcTest::heap()->CollectAllGarbage();
+  CcTest::heap()->CollectAllGarbage();
+
+  // Should not move the pointer
+  CHECK_EQ(ab->GetContents().Data(), store_ptr);
+}
+
+
+THREADED_TEST(SkipArrayBufferDuringScavenge) {
+  LocalContext env;
+  v8::Isolate* isolate = env->GetIsolate();
+  v8::HandleScope handle_scope(isolate);
+
+  // Make sure the pointer looks like a heap object
+  Local<v8::Object> tmp = v8::Object::New(isolate);
+  uint8_t* store_ptr =
+      reinterpret_cast<uint8_t*>(*reinterpret_cast<uintptr_t*>(*tmp));
+
+  // Make `store_ptr` point to from space
+  CcTest::heap()->CollectGarbage(i::NEW_SPACE);
+
+  // Create ArrayBuffer with pointer-that-cannot-be-visited in the backing store
+  Local<v8::ArrayBuffer> ab = v8::ArrayBuffer::New(isolate, store_ptr, 8);
+
+  // Should not crash,
+  // i.e. backing store pointer should not be treated as a heap object pointer
+  CcTest::heap()->CollectGarbage(i::NEW_SPACE);  // in survivor space now
+  CcTest::heap()->CollectGarbage(i::NEW_SPACE);  // in old gen now
+
+  // Use `ab` to silence compiler warning
+  CHECK_EQ(ab->GetContents().Data(), store_ptr);
+}
+
+
+THREADED_TEST(SharedUint8Array) {
+  i::FLAG_harmony_sharedarraybuffer = true;
+  TypedArrayTestHelper<uint8_t, v8::Uint8Array, i::FixedUint8Array,
+                       v8::SharedArrayBuffer>(i::kExternalUint8Array, 0, 0xFF);
+}
+
+
+THREADED_TEST(SharedInt8Array) {
+  i::FLAG_harmony_sharedarraybuffer = true;
+  TypedArrayTestHelper<int8_t, v8::Int8Array, i::FixedInt8Array,
+                       v8::SharedArrayBuffer>(i::kExternalInt8Array, -0x80,
+                                              0x7F);
+}
+
+
+THREADED_TEST(SharedUint16Array) {
+  i::FLAG_harmony_sharedarraybuffer = true;
+  TypedArrayTestHelper<uint16_t, v8::Uint16Array, i::FixedUint16Array,
+                       v8::SharedArrayBuffer>(i::kExternalUint16Array, 0,
+                                              0xFFFF);
+}
+
+
+THREADED_TEST(SharedInt16Array) {
+  i::FLAG_harmony_sharedarraybuffer = true;
+  TypedArrayTestHelper<int16_t, v8::Int16Array, i::FixedInt16Array,
+                       v8::SharedArrayBuffer>(i::kExternalInt16Array, -0x8000,
+                                              0x7FFF);
+}
+
+
+THREADED_TEST(SharedUint32Array) {
+  i::FLAG_harmony_sharedarraybuffer = true;
+  TypedArrayTestHelper<uint32_t, v8::Uint32Array, i::FixedUint32Array,
+                       v8::SharedArrayBuffer>(i::kExternalUint32Array, 0,
+                                              UINT_MAX);
+}
+
+
+THREADED_TEST(SharedInt32Array) {
+  i::FLAG_harmony_sharedarraybuffer = true;
+  TypedArrayTestHelper<int32_t, v8::Int32Array, i::FixedInt32Array,
+                       v8::SharedArrayBuffer>(i::kExternalInt32Array, INT_MIN,
+                                              INT_MAX);
+}
+
+
+THREADED_TEST(SharedFloat32Array) {
+  i::FLAG_harmony_sharedarraybuffer = true;
+  TypedArrayTestHelper<float, v8::Float32Array, i::FixedFloat32Array,
+                       v8::SharedArrayBuffer>(i::kExternalFloat32Array, -500,
+                                              500);
+}
+
+
+THREADED_TEST(SharedFloat64Array) {
+  i::FLAG_harmony_sharedarraybuffer = true;
+  TypedArrayTestHelper<double, v8::Float64Array, i::FixedFloat64Array,
+                       v8::SharedArrayBuffer>(i::kExternalFloat64Array, -500,
+                                              500);
+}
+
+
+THREADED_TEST(SharedUint8ClampedArray) {
+  i::FLAG_harmony_sharedarraybuffer = true;
+  TypedArrayTestHelper<uint8_t, v8::Uint8ClampedArray,
+                       i::FixedUint8ClampedArray, v8::SharedArrayBuffer>(
+      i::kExternalUint8ClampedArray, 0, 0xFF);
+}
+
+
+THREADED_TEST(SharedDataView) {
+  i::FLAG_harmony_sharedarraybuffer = true;
+  const int kSize = 50;
+
+  i::ScopedVector<uint8_t> backing_store(kSize + 2);
+
+  LocalContext env;
+  v8::Isolate* isolate = env->GetIsolate();
+  v8::HandleScope handle_scope(isolate);
+
+  Local<v8::SharedArrayBuffer> ab =
+      v8::SharedArrayBuffer::New(isolate, backing_store.start(), 2 + kSize);
+  Local<v8::DataView> dv =
+      v8::DataView::New(ab, 2, kSize);
+  CheckInternalFieldsAreZero<v8::ArrayBufferView>(dv);
+  CHECK_EQ(2u, dv->ByteOffset());
+  CHECK_EQ(kSize, static_cast<int>(dv->ByteLength()));
+  CHECK(ab->Equals(env.local(), dv->Buffer()).FromJust());
+}
+
+
+#define IS_ARRAY_BUFFER_VIEW_TEST(View)                                     \
+  THREADED_TEST(Is##View) {                                                 \
+    LocalContext env;                                                       \
+    v8::Isolate* isolate = env->GetIsolate();                               \
+    v8::HandleScope handle_scope(isolate);                                  \
+                                                                            \
+    Local<Value> result = CompileRun(                                       \
+        "var ab = new ArrayBuffer(128);"                                    \
+        "new " #View "(ab)");                                               \
+    CHECK(result->IsArrayBufferView());                                     \
+    CHECK(result->Is##View());                                              \
+    CheckInternalFieldsAreZero<v8::ArrayBufferView>(result.As<v8::View>()); \
   }
 
 IS_ARRAY_BUFFER_VIEW_TEST(Uint8Array)
@@ -17957,47 +16084,74 @@
   LocalContext c1;
   v8::HandleScope scope(c1->GetIsolate());
   const char *source = "foo";
-  v8::Handle<v8::Script> dep = v8_compile(source);
-  v8::ScriptCompiler::Source script_source(v8::String::NewFromUtf8(
-      c1->GetIsolate(), source));
-  v8::Handle<v8::UnboundScript> indep =
-      v8::ScriptCompiler::CompileUnbound(c1->GetIsolate(), &script_source);
-  c1->Global()->Set(v8::String::NewFromUtf8(c1->GetIsolate(), "foo"),
-                    v8::Integer::New(c1->GetIsolate(), 100));
-  CHECK_EQ(dep->Run()->Int32Value(), 100);
-  CHECK_EQ(indep->BindToCurrentContext()->Run()->Int32Value(), 100);
+  v8::Local<v8::Script> dep = v8_compile(source);
+  v8::ScriptCompiler::Source script_source(
+      v8::String::NewFromUtf8(c1->GetIsolate(), source,
+                              v8::NewStringType::kNormal)
+          .ToLocalChecked());
+  v8::Local<v8::UnboundScript> indep =
+      v8::ScriptCompiler::CompileUnboundScript(c1->GetIsolate(), &script_source)
+          .ToLocalChecked();
+  c1->Global()
+      ->Set(c1.local(), v8::String::NewFromUtf8(c1->GetIsolate(), "foo",
+                                                v8::NewStringType::kNormal)
+                            .ToLocalChecked(),
+            v8::Integer::New(c1->GetIsolate(), 100))
+      .FromJust();
+  CHECK_EQ(
+      dep->Run(c1.local()).ToLocalChecked()->Int32Value(c1.local()).FromJust(),
+      100);
+  CHECK_EQ(indep->BindToCurrentContext()
+               ->Run(c1.local())
+               .ToLocalChecked()
+               ->Int32Value(c1.local())
+               .FromJust(),
+           100);
   LocalContext c2;
-  c2->Global()->Set(v8::String::NewFromUtf8(c2->GetIsolate(), "foo"),
-                    v8::Integer::New(c2->GetIsolate(), 101));
-  CHECK_EQ(dep->Run()->Int32Value(), 100);
-  CHECK_EQ(indep->BindToCurrentContext()->Run()->Int32Value(), 101);
+  c2->Global()
+      ->Set(c2.local(), v8::String::NewFromUtf8(c2->GetIsolate(), "foo",
+                                                v8::NewStringType::kNormal)
+                            .ToLocalChecked(),
+            v8::Integer::New(c2->GetIsolate(), 101))
+      .FromJust();
+  CHECK_EQ(
+      dep->Run(c2.local()).ToLocalChecked()->Int32Value(c2.local()).FromJust(),
+      100);
+  CHECK_EQ(indep->BindToCurrentContext()
+               ->Run(c2.local())
+               .ToLocalChecked()
+               ->Int32Value(c2.local())
+               .FromJust(),
+           101);
 }
 
 
 THREADED_TEST(StackTrace) {
   LocalContext context;
   v8::HandleScope scope(context->GetIsolate());
-  v8::TryCatch try_catch;
+  v8::TryCatch try_catch(context->GetIsolate());
   const char *source = "function foo() { FAIL.FAIL; }; foo();";
-  v8::Handle<v8::String> src =
-      v8::String::NewFromUtf8(context->GetIsolate(), source);
-  v8::Handle<v8::String> origin =
-      v8::String::NewFromUtf8(context->GetIsolate(), "stack-trace-test");
+  v8::Local<v8::String> src = v8_str(source);
+  v8::Local<v8::String> origin = v8_str("stack-trace-test");
   v8::ScriptCompiler::Source script_source(src, v8::ScriptOrigin(origin));
-  v8::ScriptCompiler::CompileUnbound(context->GetIsolate(), &script_source)
-      ->BindToCurrentContext()
-      ->Run();
+  CHECK(v8::ScriptCompiler::CompileUnboundScript(context->GetIsolate(),
+                                                 &script_source)
+            .ToLocalChecked()
+            ->BindToCurrentContext()
+            ->Run(context.local())
+            .IsEmpty());
   CHECK(try_catch.HasCaught());
-  v8::String::Utf8Value stack(try_catch.StackTrace());
+  v8::String::Utf8Value stack(
+      try_catch.StackTrace(context.local()).ToLocalChecked());
   CHECK(strstr(*stack, "at foo (stack-trace-test") != NULL);
 }
 
 
 // Checks that a StackFrame has certain expected values.
 void checkStackFrame(const char* expected_script_name,
-    const char* expected_func_name, int expected_line_number,
-    int expected_column, bool is_eval, bool is_constructor,
-    v8::Handle<v8::StackFrame> frame) {
+                     const char* expected_func_name, int expected_line_number,
+                     int expected_column, bool is_eval, bool is_constructor,
+                     v8::Local<v8::StackFrame> frame) {
   v8::HandleScope scope(CcTest::isolate());
   v8::String::Utf8Value func_name(frame->GetFunctionName());
   v8::String::Utf8Value script_name(frame->GetScriptName());
@@ -18020,12 +16174,18 @@
   const char* origin = "capture-stack-trace-test";
   const int kOverviewTest = 1;
   const int kDetailedTest = 2;
+  const int kFunctionName = 3;
+  const int kDisplayName = 4;
+  const int kFunctionNameAndDisplayName = 5;
+  const int kDisplayNameIsNotString = 6;
+  const int kFunctionNameIsNotString = 7;
 
-  DCHECK(args.Length() == 1);
+  CHECK(args.Length() == 1);
 
-  int testGroup = args[0]->Int32Value();
+  v8::Local<v8::Context> context = args.GetIsolate()->GetCurrentContext();
+  int testGroup = args[0]->Int32Value(context).FromJust();
   if (testGroup == kOverviewTest) {
-    v8::Handle<v8::StackTrace> stackTrace = v8::StackTrace::CurrentStackTrace(
+    v8::Local<v8::StackTrace> stackTrace = v8::StackTrace::CurrentStackTrace(
         args.GetIsolate(), 10, v8::StackTrace::kOverview);
     CHECK_EQ(4, stackTrace->GetFrameCount());
     checkStackFrame(origin, "bar", 2, 10, false, false,
@@ -18033,15 +16193,13 @@
     checkStackFrame(origin, "foo", 6, 3, false, false,
                     stackTrace->GetFrame(1));
     // This is the source string inside the eval which has the call to foo.
-    checkStackFrame(NULL, "", 1, 5, false, false,
-                    stackTrace->GetFrame(2));
+    checkStackFrame(NULL, "", 1, 1, false, false, stackTrace->GetFrame(2));
     // The last frame is an anonymous function which has the initial eval call.
-    checkStackFrame(origin, "", 8, 7, false, false,
-                    stackTrace->GetFrame(3));
+    checkStackFrame(origin, "", 8, 7, false, false, stackTrace->GetFrame(3));
 
     CHECK(stackTrace->AsArray()->IsArray());
   } else if (testGroup == kDetailedTest) {
-    v8::Handle<v8::StackTrace> stackTrace = v8::StackTrace::CurrentStackTrace(
+    v8::Local<v8::StackTrace> stackTrace = v8::StackTrace::CurrentStackTrace(
         args.GetIsolate(), 10, v8::StackTrace::kDetailed);
     CHECK_EQ(4, stackTrace->GetFrameCount());
     checkStackFrame(origin, "bat", 4, 22, false, false,
@@ -18050,13 +16208,40 @@
                     stackTrace->GetFrame(1));
     bool is_eval = true;
     // This is the source string inside the eval which has the call to baz.
-    checkStackFrame(NULL, "", 1, 5, is_eval, false,
-                    stackTrace->GetFrame(2));
+    checkStackFrame(NULL, "", 1, 1, is_eval, false, stackTrace->GetFrame(2));
     // The last frame is an anonymous function which has the initial eval call.
-    checkStackFrame(origin, "", 10, 1, false, false,
-                    stackTrace->GetFrame(3));
+    checkStackFrame(origin, "", 10, 1, false, false, stackTrace->GetFrame(3));
 
     CHECK(stackTrace->AsArray()->IsArray());
+  } else if (testGroup == kFunctionName) {
+    v8::Local<v8::StackTrace> stackTrace = v8::StackTrace::CurrentStackTrace(
+        args.GetIsolate(), 5, v8::StackTrace::kOverview);
+    CHECK_EQ(3, stackTrace->GetFrameCount());
+    checkStackFrame(origin, "function.name", 2, 24, false, false,
+                    stackTrace->GetFrame(0));
+  } else if (testGroup == kDisplayName) {
+    v8::Local<v8::StackTrace> stackTrace = v8::StackTrace::CurrentStackTrace(
+        args.GetIsolate(), 5, v8::StackTrace::kOverview);
+    CHECK_EQ(3, stackTrace->GetFrameCount());
+    checkStackFrame(origin, "function.displayName", 2, 24, false, false,
+                    stackTrace->GetFrame(0));
+  } else if (testGroup == kFunctionNameAndDisplayName) {
+    v8::Local<v8::StackTrace> stackTrace = v8::StackTrace::CurrentStackTrace(
+        args.GetIsolate(), 5, v8::StackTrace::kOverview);
+    CHECK_EQ(3, stackTrace->GetFrameCount());
+    checkStackFrame(origin, "function.displayName", 2, 24, false, false,
+                    stackTrace->GetFrame(0));
+  } else if (testGroup == kDisplayNameIsNotString) {
+    v8::Local<v8::StackTrace> stackTrace = v8::StackTrace::CurrentStackTrace(
+        args.GetIsolate(), 5, v8::StackTrace::kOverview);
+    CHECK_EQ(3, stackTrace->GetFrameCount());
+    checkStackFrame(origin, "function.name", 2, 24, false, false,
+                    stackTrace->GetFrame(0));
+  } else if (testGroup == kFunctionNameIsNotString) {
+    v8::Local<v8::StackTrace> stackTrace = v8::StackTrace::CurrentStackTrace(
+        args.GetIsolate(), 5, v8::StackTrace::kOverview);
+    CHECK_EQ(3, stackTrace->GetFrameCount());
+    checkStackFrame(origin, "f", 2, 24, false, false, stackTrace->GetFrame(0));
   }
 }
 
@@ -18067,8 +16252,7 @@
 TEST(CaptureStackTrace) {
   v8::Isolate* isolate = CcTest::isolate();
   v8::HandleScope scope(isolate);
-  v8::Handle<v8::String> origin =
-      v8::String::NewFromUtf8(isolate, "capture-stack-trace-test");
+  v8::Local<v8::String> origin = v8_str("capture-stack-trace-test");
   Local<ObjectTemplate> templ = ObjectTemplate::New(isolate);
   templ->Set(v8_str("AnalyzeStackInNativeCode"),
              v8::FunctionTemplate::New(isolate, AnalyzeStackInNativeCode));
@@ -18085,14 +16269,15 @@
     "  bar();\n"
     "}\n"
     "var x;eval('new foo();');";
-  v8::Handle<v8::String> overview_src =
-      v8::String::NewFromUtf8(isolate, overview_source);
+  v8::Local<v8::String> overview_src = v8_str(overview_source);
   v8::ScriptCompiler::Source script_source(overview_src,
                                            v8::ScriptOrigin(origin));
-  v8::Handle<Value> overview_result(
-      v8::ScriptCompiler::CompileUnbound(isolate, &script_source)
+  v8::Local<Value> overview_result(
+      v8::ScriptCompiler::CompileUnboundScript(isolate, &script_source)
+          .ToLocalChecked()
           ->BindToCurrentContext()
-          ->Run());
+          ->Run(context.local())
+          .ToLocalChecked());
   CHECK(!overview_result.IsEmpty());
   CHECK(overview_result->IsObject());
 
@@ -18105,27 +16290,58 @@
     "  bat();\n"
     "}\n"
     "eval('new baz();');";
-  v8::Handle<v8::String> detailed_src =
-      v8::String::NewFromUtf8(isolate, detailed_source);
+  v8::Local<v8::String> detailed_src = v8_str(detailed_source);
   // Make the script using a non-zero line and column offset.
-  v8::Handle<v8::Integer> line_offset = v8::Integer::New(isolate, 3);
-  v8::Handle<v8::Integer> column_offset = v8::Integer::New(isolate, 5);
+  v8::Local<v8::Integer> line_offset = v8::Integer::New(isolate, 3);
+  v8::Local<v8::Integer> column_offset = v8::Integer::New(isolate, 5);
   v8::ScriptOrigin detailed_origin(origin, line_offset, column_offset);
   v8::ScriptCompiler::Source script_source2(detailed_src, detailed_origin);
-  v8::Handle<v8::UnboundScript> detailed_script(
-      v8::ScriptCompiler::CompileUnbound(isolate, &script_source2));
-  v8::Handle<Value> detailed_result(
-      detailed_script->BindToCurrentContext()->Run());
+  v8::Local<v8::UnboundScript> detailed_script(
+      v8::ScriptCompiler::CompileUnboundScript(isolate, &script_source2)
+          .ToLocalChecked());
+  v8::Local<Value> detailed_result(detailed_script->BindToCurrentContext()
+                                       ->Run(context.local())
+                                       .ToLocalChecked());
   CHECK(!detailed_result.IsEmpty());
   CHECK(detailed_result->IsObject());
+
+  // Test using function.name and function.displayName in stack trace
+  const char* function_name_source =
+      "function bar(function_name, display_name, testGroup) {\n"
+      "  var f = function() { AnalyzeStackInNativeCode(testGroup); };\n"
+      "  if (function_name) {\n"
+      "    Object.defineProperty(f, 'name', { value: function_name });\n"
+      "  }\n"
+      "  if (display_name) {\n"
+      "    f.displayName = display_name;"
+      "  }\n"
+      "  f()\n"
+      "}\n"
+      "bar('function.name', undefined, 3);\n"
+      "bar(undefined, 'function.displayName', 4);\n"
+      "bar('function.name', 'function.displayName', 5);\n"
+      "bar('function.name', 239, 6);\n"
+      "bar(239, undefined, 7);\n";
+  v8::Local<v8::String> function_name_src =
+      v8::String::NewFromUtf8(isolate, function_name_source,
+                              v8::NewStringType::kNormal)
+          .ToLocalChecked();
+  v8::ScriptCompiler::Source script_source3(function_name_src,
+                                            v8::ScriptOrigin(origin));
+  v8::Local<Value> function_name_result(
+      v8::ScriptCompiler::CompileUnboundScript(isolate, &script_source3)
+          .ToLocalChecked()
+          ->BindToCurrentContext()
+          ->Run(context.local())
+          .ToLocalChecked());
+  CHECK(!function_name_result.IsEmpty());
 }
 
 
 static void StackTraceForUncaughtExceptionListener(
-    v8::Handle<v8::Message> message,
-    v8::Handle<Value>) {
+    v8::Local<v8::Message> message, v8::Local<Value>) {
   report_count++;
-  v8::Handle<v8::StackTrace> stack_trace = message->GetStackTrace();
+  v8::Local<v8::StackTrace> stack_trace = message->GetStackTrace();
   CHECK_EQ(2, stack_trace->GetFrameCount());
   checkStackFrame("origin", "foo", 2, 3, false, false,
                   stack_trace->GetFrame(0));
@@ -18137,9 +16353,10 @@
 TEST(CaptureStackTraceForUncaughtException) {
   report_count = 0;
   LocalContext env;
-  v8::HandleScope scope(env->GetIsolate());
-  v8::V8::AddMessageListener(StackTraceForUncaughtExceptionListener);
-  v8::V8::SetCaptureStackTraceForUncaughtExceptions(true);
+  v8::Isolate* isolate = env->GetIsolate();
+  v8::HandleScope scope(isolate);
+  isolate->AddMessageListener(StackTraceForUncaughtExceptionListener);
+  isolate->SetCaptureStackTraceForUncaughtExceptions(true);
 
   CompileRunWithOrigin(
       "function foo() {\n"
@@ -18150,11 +16367,12 @@
       "};",
       "origin");
   v8::Local<v8::Object> global = env->Global();
-  Local<Value> trouble = global->Get(v8_str("bar"));
+  Local<Value> trouble =
+      global->Get(env.local(), v8_str("bar")).ToLocalChecked();
   CHECK(trouble->IsFunction());
-  Function::Cast(*trouble)->Call(global, 0, NULL);
-  v8::V8::SetCaptureStackTraceForUncaughtExceptions(false);
-  v8::V8::RemoveMessageListeners(StackTraceForUncaughtExceptionListener);
+  CHECK(Function::Cast(*trouble)->Call(env.local(), global, 0, NULL).IsEmpty());
+  isolate->SetCaptureStackTraceForUncaughtExceptions(false);
+  isolate->RemoveMessageListeners(StackTraceForUncaughtExceptionListener);
   CHECK_EQ(1, report_count);
 }
 
@@ -18162,7 +16380,8 @@
 TEST(GetStackTraceForUncaughtExceptionFromSimpleStackTrace) {
   report_count = 0;
   LocalContext env;
-  v8::HandleScope scope(env->GetIsolate());
+  v8::Isolate* isolate = env->GetIsolate();
+  v8::HandleScope scope(isolate);
 
   // Create an Error object first.
   CompileRunWithOrigin(
@@ -18175,27 +16394,28 @@
       "var e;",
       "origin");
   v8::Local<v8::Object> global = env->Global();
-  Local<Value> trouble = global->Get(v8_str("bar"));
+  Local<Value> trouble =
+      global->Get(env.local(), v8_str("bar")).ToLocalChecked();
   CHECK(trouble->IsFunction());
-  Function::Cast(*trouble)->Call(global, 0, NULL);
+  Function::Cast(*trouble)->Call(env.local(), global, 0, NULL).ToLocalChecked();
 
   // Enable capturing detailed stack trace late, and throw the exception.
   // The detailed stack trace should be extracted from the simple stack.
-  v8::V8::AddMessageListener(StackTraceForUncaughtExceptionListener);
-  v8::V8::SetCaptureStackTraceForUncaughtExceptions(true);
+  isolate->AddMessageListener(StackTraceForUncaughtExceptionListener);
+  isolate->SetCaptureStackTraceForUncaughtExceptions(true);
   CompileRunWithOrigin("throw e", "origin");
-  v8::V8::SetCaptureStackTraceForUncaughtExceptions(false);
-  v8::V8::RemoveMessageListeners(StackTraceForUncaughtExceptionListener);
+  isolate->SetCaptureStackTraceForUncaughtExceptions(false);
+  isolate->RemoveMessageListeners(StackTraceForUncaughtExceptionListener);
   CHECK_EQ(1, report_count);
 }
 
 
 TEST(CaptureStackTraceForUncaughtExceptionAndSetters) {
   LocalContext env;
-  v8::HandleScope scope(env->GetIsolate());
-  v8::V8::SetCaptureStackTraceForUncaughtExceptions(true,
-                                                    1024,
-                                                    v8::StackTrace::kDetailed);
+  v8::Isolate* isolate = env->GetIsolate();
+  v8::HandleScope scope(isolate);
+  isolate->SetCaptureStackTraceForUncaughtExceptions(true, 1024,
+                                                     v8::StackTrace::kDetailed);
 
   CompileRun(
       "var setters = ['column', 'lineNumber', 'scriptName',\n"
@@ -18206,14 +16426,63 @@
       "  Object.prototype.__defineSetter__(prop, function() { throw prop; });\n"
       "}\n");
   CompileRun("throw 'exception';");
-  v8::V8::SetCaptureStackTraceForUncaughtExceptions(false);
+  isolate->SetCaptureStackTraceForUncaughtExceptions(false);
 }
 
 
-static void RethrowStackTraceHandler(v8::Handle<v8::Message> message,
-                                     v8::Handle<v8::Value> data) {
+static void StackTraceFunctionNameListener(v8::Local<v8::Message> message,
+                                           v8::Local<Value>) {
+  v8::Local<v8::StackTrace> stack_trace = message->GetStackTrace();
+  CHECK_EQ(5, stack_trace->GetFrameCount());
+  checkStackFrame("origin", "foo:0", 4, 7, false, false,
+                  stack_trace->GetFrame(0));
+  checkStackFrame("origin", "foo:1", 5, 27, false, false,
+                  stack_trace->GetFrame(1));
+  checkStackFrame("origin", "foo", 5, 27, false, false,
+                  stack_trace->GetFrame(2));
+  checkStackFrame("origin", "foo", 5, 27, false, false,
+                  stack_trace->GetFrame(3));
+  checkStackFrame("origin", "", 1, 14, false, false, stack_trace->GetFrame(4));
+}
+
+
+TEST(GetStackTraceContainsFunctionsWithFunctionName) {
+  LocalContext env;
+  v8::Isolate* isolate = env->GetIsolate();
+  v8::HandleScope scope(isolate);
+
+  CompileRunWithOrigin(
+      "function gen(name, counter) {\n"
+      "  var f = function foo() {\n"
+      "    if (counter === 0)\n"
+      "      throw 1;\n"
+      "    gen(name, counter - 1)();\n"
+      "  };\n"
+      "  if (counter == 3) {\n"
+      "    Object.defineProperty(f, 'name', {get: function(){ throw 239; }});\n"
+      "  } else {\n"
+      "    Object.defineProperty(f, 'name', {writable:true});\n"
+      "    if (counter == 2)\n"
+      "      f.name = 42;\n"
+      "    else\n"
+      "      f.name = name + ':' + counter;\n"
+      "  }\n"
+      "  return f;\n"
+      "};",
+      "origin");
+
+  isolate->AddMessageListener(StackTraceFunctionNameListener);
+  isolate->SetCaptureStackTraceForUncaughtExceptions(true);
+  CompileRunWithOrigin("gen('foo', 3)();", "origin");
+  isolate->SetCaptureStackTraceForUncaughtExceptions(false);
+  isolate->RemoveMessageListeners(StackTraceFunctionNameListener);
+}
+
+
+static void RethrowStackTraceHandler(v8::Local<v8::Message> message,
+                                     v8::Local<v8::Value> data) {
   // Use the frame where JavaScript is called from.
-  v8::Handle<v8::StackTrace> stack_trace = message->GetStackTrace();
+  v8::Local<v8::StackTrace> stack_trace = message->GetStackTrace();
   CHECK(!stack_trace.IsEmpty());
   int frame_count = stack_trace->GetFrameCount();
   CHECK_EQ(3, frame_count);
@@ -18228,7 +16497,8 @@
 // is first thrown (not where it is rethrown).
 TEST(RethrowStackTrace) {
   LocalContext env;
-  v8::HandleScope scope(env->GetIsolate());
+  v8::Isolate* isolate = env->GetIsolate();
+  v8::HandleScope scope(isolate);
   // 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().
@@ -18246,17 +16516,17 @@
       "    t(e1);                       \n"
       "  }                              \n"
       "}                                \n";
-  v8::V8::AddMessageListener(RethrowStackTraceHandler);
-  v8::V8::SetCaptureStackTraceForUncaughtExceptions(true);
+  isolate->AddMessageListener(RethrowStackTraceHandler);
+  isolate->SetCaptureStackTraceForUncaughtExceptions(true);
   CompileRun(source);
-  v8::V8::SetCaptureStackTraceForUncaughtExceptions(false);
-  v8::V8::RemoveMessageListeners(RethrowStackTraceHandler);
+  isolate->SetCaptureStackTraceForUncaughtExceptions(false);
+  isolate->RemoveMessageListeners(RethrowStackTraceHandler);
 }
 
 
-static void RethrowPrimitiveStackTraceHandler(v8::Handle<v8::Message> message,
-                                              v8::Handle<v8::Value> data) {
-  v8::Handle<v8::StackTrace> stack_trace = message->GetStackTrace();
+static void RethrowPrimitiveStackTraceHandler(v8::Local<v8::Message> message,
+                                              v8::Local<v8::Value> data) {
+  v8::Local<v8::StackTrace> stack_trace = message->GetStackTrace();
   CHECK(!stack_trace.IsEmpty());
   int frame_count = stack_trace->GetFrameCount();
   CHECK_EQ(2, frame_count);
@@ -18270,7 +16540,8 @@
 // Test that we do not recognize identity for primitive exceptions.
 TEST(RethrowPrimitiveStackTrace) {
   LocalContext env;
-  v8::HandleScope scope(env->GetIsolate());
+  v8::Isolate* isolate = env->GetIsolate();
+  v8::HandleScope scope(isolate);
   // 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 =
@@ -18282,18 +16553,18 @@
       "} catch (e1) {                   \n"
       "  t(e1)                          \n"
       "}                                \n";
-  v8::V8::AddMessageListener(RethrowPrimitiveStackTraceHandler);
-  v8::V8::SetCaptureStackTraceForUncaughtExceptions(true);
+  isolate->AddMessageListener(RethrowPrimitiveStackTraceHandler);
+  isolate->SetCaptureStackTraceForUncaughtExceptions(true);
   CompileRun(source);
-  v8::V8::SetCaptureStackTraceForUncaughtExceptions(false);
-  v8::V8::RemoveMessageListeners(RethrowPrimitiveStackTraceHandler);
+  isolate->SetCaptureStackTraceForUncaughtExceptions(false);
+  isolate->RemoveMessageListeners(RethrowPrimitiveStackTraceHandler);
 }
 
 
-static void RethrowExistingStackTraceHandler(v8::Handle<v8::Message> message,
-                                              v8::Handle<v8::Value> data) {
+static void RethrowExistingStackTraceHandler(v8::Local<v8::Message> message,
+                                             v8::Local<v8::Value> data) {
   // Use the frame where JavaScript is called from.
-  v8::Handle<v8::StackTrace> stack_trace = message->GetStackTrace();
+  v8::Local<v8::StackTrace> stack_trace = message->GetStackTrace();
   CHECK(!stack_trace.IsEmpty());
   CHECK_EQ(1, stack_trace->GetFrameCount());
   CHECK_EQ(1, stack_trace->GetFrame(0)->GetLineNumber());
@@ -18304,22 +16575,23 @@
 // not where it is thrown.
 TEST(RethrowExistingStackTrace) {
   LocalContext env;
-  v8::HandleScope scope(env->GetIsolate());
+  v8::Isolate* isolate = env->GetIsolate();
+  v8::HandleScope scope(isolate);
   const char* source =
       "var e = new Error();           \n"
       "throw e;                       \n";
-  v8::V8::AddMessageListener(RethrowExistingStackTraceHandler);
-  v8::V8::SetCaptureStackTraceForUncaughtExceptions(true);
+  isolate->AddMessageListener(RethrowExistingStackTraceHandler);
+  isolate->SetCaptureStackTraceForUncaughtExceptions(true);
   CompileRun(source);
-  v8::V8::SetCaptureStackTraceForUncaughtExceptions(false);
-  v8::V8::RemoveMessageListeners(RethrowExistingStackTraceHandler);
+  isolate->SetCaptureStackTraceForUncaughtExceptions(false);
+  isolate->RemoveMessageListeners(RethrowExistingStackTraceHandler);
 }
 
 
-static void RethrowBogusErrorStackTraceHandler(v8::Handle<v8::Message> message,
-                                               v8::Handle<v8::Value> data) {
+static void RethrowBogusErrorStackTraceHandler(v8::Local<v8::Message> message,
+                                               v8::Local<v8::Value> data) {
   // Use the frame where JavaScript is called from.
-  v8::Handle<v8::StackTrace> stack_trace = message->GetStackTrace();
+  v8::Local<v8::StackTrace> stack_trace = message->GetStackTrace();
   CHECK(!stack_trace.IsEmpty());
   CHECK_EQ(1, stack_trace->GetFrameCount());
   CHECK_EQ(2, stack_trace->GetFrame(0)->GetLineNumber());
@@ -18329,66 +16601,96 @@
 // Test that the stack trace is captured where the bogus Error object is thrown.
 TEST(RethrowBogusErrorStackTrace) {
   LocalContext env;
-  v8::HandleScope scope(env->GetIsolate());
+  v8::Isolate* isolate = env->GetIsolate();
+  v8::HandleScope scope(isolate);
   const char* source =
       "var e = {__proto__: new Error()} \n"
       "throw e;                         \n";
-  v8::V8::AddMessageListener(RethrowBogusErrorStackTraceHandler);
-  v8::V8::SetCaptureStackTraceForUncaughtExceptions(true);
+  isolate->AddMessageListener(RethrowBogusErrorStackTraceHandler);
+  isolate->SetCaptureStackTraceForUncaughtExceptions(true);
   CompileRun(source);
-  v8::V8::SetCaptureStackTraceForUncaughtExceptions(false);
-  v8::V8::RemoveMessageListeners(RethrowBogusErrorStackTraceHandler);
+  isolate->SetCaptureStackTraceForUncaughtExceptions(false);
+  isolate->RemoveMessageListeners(RethrowBogusErrorStackTraceHandler);
 }
 
 
 v8::PromiseRejectEvent reject_event = v8::kPromiseRejectWithNoHandler;
 int promise_reject_counter = 0;
 int promise_revoke_counter = 0;
+int promise_reject_msg_line_number = -1;
+int promise_reject_msg_column_number = -1;
 int promise_reject_line_number = -1;
+int promise_reject_column_number = -1;
 int promise_reject_frame_count = -1;
 
-void PromiseRejectCallback(v8::PromiseRejectMessage message) {
-  if (message.GetEvent() == v8::kPromiseRejectWithNoHandler) {
+void PromiseRejectCallback(v8::PromiseRejectMessage reject_message) {
+  v8::Local<v8::Object> global = CcTest::global();
+  v8::Local<v8::Context> context = CcTest::isolate()->GetCurrentContext();
+  if (reject_message.GetEvent() == v8::kPromiseRejectWithNoHandler) {
     promise_reject_counter++;
-    CcTest::global()->Set(v8_str("rejected"), message.GetPromise());
-    CcTest::global()->Set(v8_str("value"), message.GetValue());
-    v8::Handle<v8::StackTrace> stack_trace =
-        v8::Exception::CreateMessage(message.GetValue())->GetStackTrace();
+    global->Set(context, v8_str("rejected"), reject_message.GetPromise())
+        .FromJust();
+    global->Set(context, v8_str("value"), reject_message.GetValue()).FromJust();
+    v8::Local<v8::Message> message = v8::Exception::CreateMessage(
+        CcTest::isolate(), reject_message.GetValue());
+    v8::Local<v8::StackTrace> stack_trace = message->GetStackTrace();
+
+    promise_reject_msg_line_number = message->GetLineNumber(context).FromJust();
+    promise_reject_msg_column_number =
+        message->GetStartColumn(context).FromJust() + 1;
+
     if (!stack_trace.IsEmpty()) {
       promise_reject_frame_count = stack_trace->GetFrameCount();
       if (promise_reject_frame_count > 0) {
-        CHECK(stack_trace->GetFrame(0)->GetScriptName()->Equals(v8_str("pro")));
+        CHECK(stack_trace->GetFrame(0)
+                  ->GetScriptName()
+                  ->Equals(context, v8_str("pro"))
+                  .FromJust());
         promise_reject_line_number = stack_trace->GetFrame(0)->GetLineNumber();
+        promise_reject_column_number = stack_trace->GetFrame(0)->GetColumn();
       } else {
         promise_reject_line_number = -1;
+        promise_reject_column_number = -1;
       }
     }
   } else {
     promise_revoke_counter++;
-    CcTest::global()->Set(v8_str("revoked"), message.GetPromise());
-    CHECK(message.GetValue().IsEmpty());
+    global->Set(context, v8_str("revoked"), reject_message.GetPromise())
+        .FromJust();
+    CHECK(reject_message.GetValue().IsEmpty());
   }
 }
 
 
-v8::Handle<v8::Promise> GetPromise(const char* name) {
-  return v8::Handle<v8::Promise>::Cast(CcTest::global()->Get(v8_str(name)));
+v8::Local<v8::Promise> GetPromise(const char* name) {
+  return v8::Local<v8::Promise>::Cast(
+      CcTest::global()
+          ->Get(CcTest::isolate()->GetCurrentContext(), v8_str(name))
+          .ToLocalChecked());
 }
 
 
-v8::Handle<v8::Value> RejectValue() {
-  return CcTest::global()->Get(v8_str("value"));
+v8::Local<v8::Value> RejectValue() {
+  return CcTest::global()
+      ->Get(CcTest::isolate()->GetCurrentContext(), v8_str("value"))
+      .ToLocalChecked();
 }
 
 
 void ResetPromiseStates() {
   promise_reject_counter = 0;
   promise_revoke_counter = 0;
+  promise_reject_msg_line_number = -1;
+  promise_reject_msg_column_number = -1;
   promise_reject_line_number = -1;
+  promise_reject_column_number = -1;
   promise_reject_frame_count = -1;
-  CcTest::global()->Set(v8_str("rejected"), v8_str(""));
-  CcTest::global()->Set(v8_str("value"), v8_str(""));
-  CcTest::global()->Set(v8_str("revoked"), v8_str(""));
+
+  v8::Local<v8::Object> global = CcTest::global();
+  v8::Local<v8::Context> context = CcTest::isolate()->GetCurrentContext();
+  global->Set(context, v8_str("rejected"), v8_str("")).FromJust();
+  global->Set(context, v8_str("value"), v8_str("")).FromJust();
+  global->Set(context, v8_str("revoked"), v8_str("")).FromJust();
 }
 
 
@@ -18427,8 +16729,9 @@
   CHECK_EQ(1, promise_reject_counter);
   CHECK_EQ(0, promise_revoke_counter);
   CHECK_EQ(v8::kPromiseRejectWithNoHandler, reject_event);
-  CHECK(GetPromise("rejected")->Equals(GetPromise("p1")));
-  CHECK(RejectValue()->Equals(v8_str("ppp")));
+  CHECK(
+      GetPromise("rejected")->Equals(env.local(), GetPromise("p1")).FromJust());
+  CHECK(RejectValue()->Equals(env.local(), v8_str("ppp")).FromJust());
 
   // Reject p0 again. Callback is not triggered again.
   CompileRun("reject();");
@@ -18444,9 +16747,11 @@
   CHECK(!GetPromise("p2")->HasHandler());
   CHECK_EQ(2, promise_reject_counter);
   CHECK_EQ(1, promise_revoke_counter);
-  CHECK(GetPromise("rejected")->Equals(GetPromise("p2")));
-  CHECK(RejectValue()->Equals(v8_str("ppp")));
-  CHECK(GetPromise("revoked")->Equals(GetPromise("p1")));
+  CHECK(
+      GetPromise("rejected")->Equals(env.local(), GetPromise("p2")).FromJust());
+  CHECK(RejectValue()->Equals(env.local(), v8_str("ppp")).FromJust());
+  CHECK(
+      GetPromise("revoked")->Equals(env.local(), GetPromise("p1")).FromJust());
 
   ResetPromiseStates();
 
@@ -18492,9 +16797,11 @@
   CHECK(GetPromise("q_")->HasHandler());
   CHECK_EQ(2, promise_reject_counter);
   CHECK_EQ(1, promise_revoke_counter);
-  CHECK(GetPromise("rejected")->Equals(GetPromise("q2")));
-  CHECK(GetPromise("revoked")->Equals(GetPromise("q_")));
-  CHECK(RejectValue()->Equals(v8_str("qqq")));
+  CHECK(
+      GetPromise("rejected")->Equals(env.local(), GetPromise("q2")).FromJust());
+  CHECK(
+      GetPromise("revoked")->Equals(env.local(), GetPromise("q_")).FromJust());
+  CHECK(RejectValue()->Equals(env.local(), v8_str("qqq")).FromJust());
 
   // Add a reject handler to the resolved q1, which rejects by throwing.
   CompileRun(
@@ -18509,8 +16816,9 @@
   CHECK(!GetPromise("q3")->HasHandler());
   CHECK_EQ(3, promise_reject_counter);
   CHECK_EQ(1, promise_revoke_counter);
-  CHECK(GetPromise("rejected")->Equals(GetPromise("q3")));
-  CHECK(RejectValue()->Equals(v8_str("qqqq")));
+  CHECK(
+      GetPromise("rejected")->Equals(env.local(), GetPromise("q3")).FromJust());
+  CHECK(RejectValue()->Equals(env.local(), v8_str("qqqq")).FromJust());
 
   ResetPromiseStates();
 
@@ -18540,8 +16848,9 @@
   CHECK(!GetPromise("r3")->HasHandler());
   CHECK_EQ(1, promise_reject_counter);
   CHECK_EQ(0, promise_revoke_counter);
-  CHECK(GetPromise("rejected")->Equals(GetPromise("r2")));
-  CHECK(RejectValue()->Equals(v8_str("rrr")));
+  CHECK(
+      GetPromise("rejected")->Equals(env.local(), GetPromise("r2")).FromJust());
+  CHECK(RejectValue()->Equals(env.local(), v8_str("rrr")).FromJust());
 
   // Add reject handler to r2.
   CompileRun("var r4 = r2.catch(function() {});");
@@ -18552,8 +16861,9 @@
   CHECK(!GetPromise("r4")->HasHandler());
   CHECK_EQ(1, promise_reject_counter);
   CHECK_EQ(1, promise_revoke_counter);
-  CHECK(GetPromise("revoked")->Equals(GetPromise("r2")));
-  CHECK(RejectValue()->Equals(v8_str("rrr")));
+  CHECK(
+      GetPromise("revoked")->Equals(env.local(), GetPromise("r2")).FromJust());
+  CHECK(RejectValue()->Equals(env.local(), v8_str("rrr")).FromJust());
 
   // Add reject handlers to r4.
   CompileRun("var r5 = r4.then(function() {}, function() {});");
@@ -18593,10 +16903,10 @@
   CHECK(!GetPromise("s3")->HasHandler());
   CHECK_EQ(3, promise_reject_counter);
   CHECK_EQ(0, promise_revoke_counter);
-  CHECK(RejectValue()->Equals(v8_str("sss")));
+  CHECK(RejectValue()->Equals(env.local(), v8_str("sss")).FromJust());
 
   // Test stack frames.
-  V8::SetCaptureStackTraceForUncaughtExceptions(true);
+  env->GetIsolate()->SetCaptureStackTraceForUncaughtExceptions(true);
 
   ResetPromiseStates();
 
@@ -18613,6 +16923,9 @@
   CHECK_EQ(0, promise_revoke_counter);
   CHECK_EQ(2, promise_reject_frame_count);
   CHECK_EQ(3, promise_reject_line_number);
+  CHECK_EQ(5, promise_reject_column_number);
+  CHECK_EQ(3, promise_reject_msg_line_number);
+  CHECK_EQ(5, promise_reject_msg_column_number);
 
   ResetPromiseStates();
 
@@ -18633,6 +16946,9 @@
   CHECK_EQ(0, promise_revoke_counter);
   CHECK_EQ(2, promise_reject_frame_count);
   CHECK_EQ(5, promise_reject_line_number);
+  CHECK_EQ(23, promise_reject_column_number);
+  CHECK_EQ(5, promise_reject_msg_line_number);
+  CHECK_EQ(23, promise_reject_msg_column_number);
 
   // Throw in u3, which handles u1's rejection.
   CompileRunWithOrigin(
@@ -18656,6 +16972,9 @@
   CHECK_EQ(2, promise_revoke_counter);
   CHECK_EQ(3, promise_reject_frame_count);
   CHECK_EQ(3, promise_reject_line_number);
+  CHECK_EQ(12, promise_reject_column_number);
+  CHECK_EQ(3, promise_reject_msg_line_number);
+  CHECK_EQ(12, promise_reject_msg_column_number);
 
   ResetPromiseStates();
 
@@ -18675,21 +16994,43 @@
   CHECK_EQ(1, promise_revoke_counter);
   CHECK_EQ(0, promise_reject_frame_count);
   CHECK_EQ(-1, promise_reject_line_number);
+  CHECK_EQ(-1, promise_reject_column_number);
+
+  ResetPromiseStates();
+
+  // Create promise t1, which rejects by throwing syntax error from eval.
+  CompileRunWithOrigin(
+      "var t1 = new Promise(   \n"
+      "  function(res, rej) {  \n"
+      "    var content = '\\n\\\n"
+      "      }';               \n"
+      "    eval(content);      \n"
+      "  }                     \n"
+      ");                      \n",
+      "pro", 0, 0);
+  CHECK(!GetPromise("t1")->HasHandler());
+  CHECK_EQ(1, promise_reject_counter);
+  CHECK_EQ(0, promise_revoke_counter);
+  CHECK_EQ(2, promise_reject_frame_count);
+  CHECK_EQ(5, promise_reject_line_number);
+  CHECK_EQ(10, promise_reject_column_number);
+  CHECK_EQ(2, promise_reject_msg_line_number);
+  CHECK_EQ(7, promise_reject_msg_column_number);
 }
 
 
 void AnalyzeStackOfEvalWithSourceURL(
     const v8::FunctionCallbackInfo<v8::Value>& args) {
   v8::HandleScope scope(args.GetIsolate());
-  v8::Handle<v8::StackTrace> stackTrace = v8::StackTrace::CurrentStackTrace(
+  v8::Local<v8::StackTrace> stackTrace = v8::StackTrace::CurrentStackTrace(
       args.GetIsolate(), 10, v8::StackTrace::kDetailed);
   CHECK_EQ(5, stackTrace->GetFrameCount());
-  v8::Handle<v8::String> url = v8_str("eval_url");
+  v8::Local<v8::String> url = v8_str("eval_url");
   for (int i = 0; i < 3; i++) {
-    v8::Handle<v8::String> name =
+    v8::Local<v8::String> name =
         stackTrace->GetFrame(i)->GetScriptNameOrSourceURL();
     CHECK(!name.IsEmpty());
-    CHECK_EQ(url, name);
+    CHECK(url->Equals(args.GetIsolate()->GetCurrentContext(), name).FromJust());
   }
 }
 
@@ -18729,7 +17070,7 @@
 void AnalyzeScriptIdInStack(
     const v8::FunctionCallbackInfo<v8::Value>& args) {
   v8::HandleScope scope(args.GetIsolate());
-  v8::Handle<v8::StackTrace> stackTrace = v8::StackTrace::CurrentStackTrace(
+  v8::Local<v8::StackTrace> stackTrace = v8::StackTrace::CurrentStackTrace(
       args.GetIsolate(), 10, v8::StackTrace::kScriptId);
   CHECK_EQ(2, stackTrace->GetFrameCount());
   for (int i = 0; i < 2; i++) {
@@ -18746,14 +17087,13 @@
              v8::FunctionTemplate::New(isolate, AnalyzeScriptIdInStack));
   LocalContext context(0, templ);
 
-  v8::Handle<v8::String> scriptSource = v8::String::NewFromUtf8(
-    isolate,
-    "function foo() {\n"
-    "  AnalyzeScriptIdInStack();"
-    "}\n"
-    "foo();\n");
+  v8::Local<v8::String> scriptSource = v8_str(
+      "function foo() {\n"
+      "  AnalyzeScriptIdInStack();"
+      "}\n"
+      "foo();\n");
   v8::Local<v8::Script> script = CompileWithOrigin(scriptSource, "test");
-  script->Run();
+  script->Run(context.local()).ToLocalChecked();
   for (int i = 0; i < 2; i++) {
     CHECK(scriptIdInStack[i] != v8::Message::kNoScriptIdInfo);
     CHECK_EQ(scriptIdInStack[i], script->GetUnboundScript()->GetId());
@@ -18764,15 +17104,15 @@
 void AnalyzeStackOfInlineScriptWithSourceURL(
     const v8::FunctionCallbackInfo<v8::Value>& args) {
   v8::HandleScope scope(args.GetIsolate());
-  v8::Handle<v8::StackTrace> stackTrace = v8::StackTrace::CurrentStackTrace(
+  v8::Local<v8::StackTrace> stackTrace = v8::StackTrace::CurrentStackTrace(
       args.GetIsolate(), 10, v8::StackTrace::kDetailed);
   CHECK_EQ(4, stackTrace->GetFrameCount());
-  v8::Handle<v8::String> url = v8_str("url");
+  v8::Local<v8::String> url = v8_str("source_url");
   for (int i = 0; i < 3; i++) {
-    v8::Handle<v8::String> name =
+    v8::Local<v8::String> name =
         stackTrace->GetFrame(i)->GetScriptNameOrSourceURL();
     CHECK(!name.IsEmpty());
-    CHECK_EQ(url, name);
+    CHECK(url->Equals(args.GetIsolate()->GetCurrentContext(), name).FromJust());
   }
 }
 
@@ -18810,15 +17150,15 @@
 void AnalyzeStackOfDynamicScriptWithSourceURL(
     const v8::FunctionCallbackInfo<v8::Value>& args) {
   v8::HandleScope scope(args.GetIsolate());
-  v8::Handle<v8::StackTrace> stackTrace = v8::StackTrace::CurrentStackTrace(
+  v8::Local<v8::StackTrace> stackTrace = v8::StackTrace::CurrentStackTrace(
       args.GetIsolate(), 10, v8::StackTrace::kDetailed);
   CHECK_EQ(4, stackTrace->GetFrameCount());
-  v8::Handle<v8::String> url = v8_str("source_url");
+  v8::Local<v8::String> url = v8_str("source_url");
   for (int i = 0; i < 3; i++) {
-    v8::Handle<v8::String> name =
+    v8::Local<v8::String> name =
         stackTrace->GetFrame(i)->GetScriptNameOrSourceURL();
     CHECK(!name.IsEmpty());
-    CHECK_EQ(url, name);
+    CHECK(url->Equals(args.GetIsolate()->GetCurrentContext(), name).FromJust());
   }
 }
 
@@ -18868,10 +17208,11 @@
 
   i::ScopedVector<char> code(1024);
   i::SNPrintF(code, source, "//# sourceURL=source_url");
-  v8::TryCatch try_catch;
+  v8::TryCatch try_catch(context->GetIsolate());
   CompileRunWithOrigin(code.start(), "", 0, 0);
   CHECK(try_catch.HasCaught());
-  v8::String::Utf8Value stack(try_catch.StackTrace());
+  v8::String::Utf8Value stack(
+      try_catch.StackTrace(context.local()).ToLocalChecked());
   CHECK(strstr(*stack, "at foo (source_url:3:5)") != NULL);
 }
 
@@ -18889,14 +17230,13 @@
     "outer();\n"
     "//# sourceURL=outer_url";
 
-  v8::TryCatch try_catch;
+  v8::TryCatch try_catch(context->GetIsolate());
   CompileRun(source);
   CHECK(try_catch.HasCaught());
 
   Local<v8::Message> message = try_catch.Message();
-  Handle<Value> sourceURL =
-    message->GetScriptOrigin().ResourceName();
-  CHECK_EQ(*v8::String::Utf8Value(sourceURL), "source_url");
+  Local<Value> sourceURL = message->GetScriptOrigin().ResourceName();
+  CHECK_EQ(0, strcmp(*v8::String::Utf8Value(sourceURL), "source_url"));
 }
 
 
@@ -18913,14 +17253,13 @@
     "outer();\n"
     "//# sourceURL=outer_url";
 
-  v8::TryCatch try_catch;
+  v8::TryCatch try_catch(context->GetIsolate());
   CompileRun(source);
   CHECK(try_catch.HasCaught());
 
   Local<v8::Message> message = try_catch.Message();
-  Handle<Value> sourceURL =
-    message->GetScriptOrigin().ResourceName();
-  CHECK_EQ(*v8::String::Utf8Value(sourceURL), "source_url");
+  Local<Value> sourceURL = message->GetScriptOrigin().ResourceName();
+  CHECK_EQ(0, strcmp(*v8::String::Utf8Value(sourceURL), "source_url"));
 }
 
 
@@ -18934,30 +17273,11 @@
 }
 
 
-// Test that idle notification can be handled and eventually returns true.
-TEST(IdleNotification) {
-  const intptr_t MB = 1024 * 1024;
-  const int IdlePauseInMs = 1000;
-  LocalContext env;
-  v8::HandleScope scope(env->GetIsolate());
-  intptr_t initial_size = CcTest::heap()->SizeOfObjects();
-  CreateGarbageInOldSpace();
-  intptr_t size_with_garbage = CcTest::heap()->SizeOfObjects();
-  CHECK_GT(size_with_garbage, initial_size + MB);
-  bool finished = false;
-  for (int i = 0; i < 200 && !finished; i++) {
-    finished = env->GetIsolate()->IdleNotification(IdlePauseInMs);
-  }
-  intptr_t final_size = CcTest::heap()->SizeOfObjects();
-  CHECK(finished);
-  CHECK_LT(final_size, initial_size + 1);
-}
-
-
 // Test that idle notification can be handled and eventually collects garbage.
-TEST(IdleNotificationWithSmallHint) {
+TEST(TestIdleNotification) {
+  if (!i::FLAG_incremental_marking) return;
   const intptr_t MB = 1024 * 1024;
-  const int IdlePauseInMs = 900;
+  const double IdlePauseInSeconds = 1.0;
   LocalContext env;
   v8::HandleScope scope(env->GetIsolate());
   intptr_t initial_size = CcTest::heap()->SizeOfObjects();
@@ -18966,27 +17286,16 @@
   CHECK_GT(size_with_garbage, initial_size + MB);
   bool finished = false;
   for (int i = 0; i < 200 && !finished; i++) {
-    finished = env->GetIsolate()->IdleNotification(IdlePauseInMs);
-  }
-  intptr_t final_size = CcTest::heap()->SizeOfObjects();
-  CHECK(finished);
-  CHECK_LT(final_size, initial_size + 1);
-}
-
-
-// Test that idle notification can be handled and eventually collects garbage.
-TEST(IdleNotificationWithLargeHint) {
-  const intptr_t MB = 1024 * 1024;
-  const int IdlePauseInMs = 900;
-  LocalContext env;
-  v8::HandleScope scope(env->GetIsolate());
-  intptr_t initial_size = CcTest::heap()->SizeOfObjects();
-  CreateGarbageInOldSpace();
-  intptr_t size_with_garbage = CcTest::heap()->SizeOfObjects();
-  CHECK_GT(size_with_garbage, initial_size + MB);
-  bool finished = false;
-  for (int i = 0; i < 200 && !finished; i++) {
-    finished = env->GetIsolate()->IdleNotification(IdlePauseInMs);
+    if (i < 10 && CcTest::heap()->incremental_marking()->IsStopped()) {
+      CcTest::heap()->StartIdleIncrementalMarking();
+    }
+    finished = env->GetIsolate()->IdleNotificationDeadline(
+        (v8::base::TimeTicks::HighResolutionNow().ToInternalValue() /
+         static_cast<double>(v8::base::Time::kMicrosecondsPerSecond)) +
+        IdlePauseInSeconds);
+    if (CcTest::heap()->mark_compact_collector()->sweeping_in_progress()) {
+      CcTest::heap()->mark_compact_collector()->EnsureSweepingCompleted();
+    }
   }
   intptr_t final_size = CcTest::heap()->SizeOfObjects();
   CHECK(finished);
@@ -19039,8 +17348,10 @@
   v8::HandleScope scope(env->GetIsolate());
   Local<v8::FunctionTemplate> fun_templ =
       v8::FunctionTemplate::New(env->GetIsolate(), GetStackLimitCallback);
-  Local<Function> fun = fun_templ->GetFunction();
-  env->Global()->Set(v8_str("get_stack_limit"), fun);
+  Local<Function> fun = fun_templ->GetFunction(env.local()).ToLocalChecked();
+  CHECK(env->Global()
+            ->Set(env.local(), v8_str("get_stack_limit"), fun)
+            .FromJust());
   CompileRun("get_stack_limit();");
 
   CHECK(stack_limit == set_limit);
@@ -19061,8 +17372,10 @@
     LocalContext env;
     Local<v8::FunctionTemplate> fun_templ =
         v8::FunctionTemplate::New(CcTest::isolate(), GetStackLimitCallback);
-    Local<Function> fun = fun_templ->GetFunction();
-    env->Global()->Set(v8_str("get_stack_limit"), fun);
+    Local<Function> fun = fun_templ->GetFunction(env.local()).ToLocalChecked();
+    CHECK(env->Global()
+              ->Set(env.local(), v8_str("get_stack_limit"), fun)
+              .FromJust());
     CompileRun("get_stack_limit();");
 
     CHECK(stack_limit == set_limit);
@@ -19078,8 +17391,8 @@
   LocalContext c1;
   v8::HandleScope scope(c1->GetIsolate());
   v8::HeapStatistics heap_statistics;
-  CHECK_EQ(static_cast<int>(heap_statistics.total_heap_size()), 0);
-  CHECK_EQ(static_cast<int>(heap_statistics.used_heap_size()), 0);
+  CHECK_EQ(0u, heap_statistics.total_heap_size());
+  CHECK_EQ(0u, heap_statistics.used_heap_size());
   c1->GetIsolate()->GetHeapStatistics(&heap_statistics);
   CHECK_NE(static_cast<int>(heap_statistics.total_heap_size()), 0);
   CHECK_NE(static_cast<int>(heap_statistics.used_heap_size()), 0);
@@ -19095,7 +17408,7 @@
     }
   }
   virtual ~VisitorImpl() {}
-  virtual void VisitExternalString(v8::Handle<v8::String> string) {
+  virtual void VisitExternalString(v8::Local<v8::String> string) {
     if (!string->IsExternal()) {
       CHECK(string->IsExternalOneByte());
       return;
@@ -19127,11 +17440,12 @@
   LocalContext env;
   v8::HandleScope scope(isolate);
   v8::Local<v8::String> cons =
-      CompileRun("'Romeo Montague ' + 'Juliet Capulet'")->ToString(isolate);
+      CompileRun("'Romeo Montague ' + 'Juliet Capulet'")
+          ->ToString(env.local())
+          .ToLocalChecked();
   CHECK(v8::Utils::OpenHandle(*cons)->IsConsString());
   CcTest::heap()->CollectAllAvailableGarbage();
-  CHECK(CcTest::heap()->old_pointer_space()->Contains(
-            *v8::Utils::OpenHandle(*cons)));
+  CHECK(CcTest::heap()->old_space()->Contains(*v8::Utils::OpenHandle(*cons)));
 
   TestResource* resource = new TestResource(
       AsciiToTwoByteString("Romeo Montague Juliet Capulet"));
@@ -19150,11 +17464,12 @@
   LocalContext env;
   v8::HandleScope scope(isolate);
   v8::Local<v8::String> cons =
-      CompileRun("'Romeo Montague ' + 'Juliet Capulet'")->ToString(isolate);
+      CompileRun("'Romeo Montague ' + 'Juliet Capulet'")
+          ->ToString(env.local())
+          .ToLocalChecked();
   CHECK(v8::Utils::OpenHandle(*cons)->IsConsString());
   CcTest::heap()->CollectAllAvailableGarbage();
-  CHECK(CcTest::heap()->old_pointer_space()->Contains(
-            *v8::Utils::OpenHandle(*cons)));
+  CHECK(CcTest::heap()->old_space()->Contains(*v8::Utils::OpenHandle(*cons)));
 
   TestOneByteResource* resource =
       new TestOneByteResource(i::StrDup("Romeo Montague Juliet Capulet"));
@@ -19177,21 +17492,26 @@
   TestResource* resource[4];
   resource[0] = new TestResource(two_byte_string);
   v8::Local<v8::String> string0 =
-      v8::String::NewExternal(env->GetIsolate(), resource[0]);
+      v8::String::NewExternalTwoByte(env->GetIsolate(), resource[0])
+          .ToLocalChecked();
   resource[1] = new TestResource(two_byte_string, NULL, false);
   v8::Local<v8::String> string1 =
-      v8::String::NewExternal(env->GetIsolate(), resource[1]);
+      v8::String::NewExternalTwoByte(env->GetIsolate(), resource[1])
+          .ToLocalChecked();
 
   // Externalized symbol.
   resource[2] = new TestResource(two_byte_string, NULL, false);
-  v8::Local<v8::String> string2 = v8::String::NewFromUtf8(
-      env->GetIsolate(), string, v8::String::kInternalizedString);
+  v8::Local<v8::String> string2 =
+      v8::String::NewFromUtf8(env->GetIsolate(), string,
+                              v8::NewStringType::kInternalized)
+          .ToLocalChecked();
   CHECK(string2->MakeExternal(resource[2]));
 
   // Symbolized External.
   resource[3] = new TestResource(AsciiToTwoByteString("Some other string"));
   v8::Local<v8::String> string3 =
-      v8::String::NewExternal(env->GetIsolate(), resource[3]);
+      v8::String::NewExternalTwoByte(env->GetIsolate(), resource[3])
+          .ToLocalChecked();
   CcTest::heap()->CollectAllAvailableGarbage();  // Tenure string.
   // Turn into a symbol.
   i::Handle<i::String> string3_i = v8::Utils::OpenHandle(*string3);
@@ -19206,20 +17526,23 @@
   CHECK(string3->IsExternal());
 
   VisitorImpl visitor(resource);
-  v8::V8::VisitExternalResources(&visitor);
+  isolate->VisitExternalResources(&visitor);
   visitor.CheckVisitedResources();
 }
 
 
 TEST(ExternalStringCollectedAtTearDown) {
   int destroyed = 0;
-  v8::Isolate* isolate = v8::Isolate::New();
+  v8::Isolate::CreateParams create_params;
+  create_params.array_buffer_allocator = CcTest::array_buffer_allocator();
+  v8::Isolate* isolate = v8::Isolate::New(create_params);
   { v8::Isolate::Scope isolate_scope(isolate);
     v8::HandleScope handle_scope(isolate);
     const char* s = "One string to test them all, one string to find them.";
     TestOneByteResource* inscription =
         new TestOneByteResource(i::StrDup(s), &destroyed);
-    v8::Local<v8::String> ring = v8::String::NewExternal(isolate, inscription);
+    v8::Local<v8::String> ring =
+        v8::String::NewExternalOneByte(isolate, inscription).ToLocalChecked();
     // Ring is still alive.  Orcs are roaming freely across our lands.
     CHECK_EQ(0, destroyed);
     USE(ring);
@@ -19233,7 +17556,9 @@
 
 TEST(ExternalInternalizedStringCollectedAtTearDown) {
   int destroyed = 0;
-  v8::Isolate* isolate = v8::Isolate::New();
+  v8::Isolate::CreateParams create_params;
+  create_params.array_buffer_allocator = CcTest::array_buffer_allocator();
+  v8::Isolate* isolate = v8::Isolate::New(create_params);
   { v8::Isolate::Scope isolate_scope(isolate);
     LocalContext env(isolate);
     v8::HandleScope handle_scope(isolate);
@@ -19241,7 +17566,8 @@
     const char* s = "One string to test them all";
     TestOneByteResource* inscription =
         new TestOneByteResource(i::StrDup(s), &destroyed);
-    v8::Local<v8::String> ring = CompileRun("ring")->ToString(isolate);
+    v8::Local<v8::String> ring =
+        CompileRun("ring")->ToString(env.local()).ToLocalChecked();
     CHECK(v8::Utils::OpenHandle(*ring)->IsInternalizedString());
     ring->MakeExternal(inscription);
     // Ring is still alive.  Orcs are roaming freely across our lands.
@@ -19256,9 +17582,6 @@
 
 
 TEST(ExternalInternalizedStringCollectedAtGC) {
-  // TODO(mvstanton): vector ics need weak support.
-  if (i::FLAG_vector_ics) return;
-
   int destroyed = 0;
   { LocalContext env;
     v8::HandleScope handle_scope(env->GetIsolate());
@@ -19300,7 +17623,7 @@
 static double DoubleToDateTime(double input) {
   double date_limit = 864e13;
   if (std::isnan(input) || input < -date_limit || input > date_limit) {
-    return v8::base::OS::nan_value();
+    return std::numeric_limits<double>::quiet_NaN();
   }
   return (input < 0) ? -(std::floor(-input)) : std::floor(input);
 }
@@ -19317,7 +17640,7 @@
   LocalContext context;
   v8::Isolate* isolate = context->GetIsolate();
   v8::HandleScope scope(isolate);
-  v8::TryCatch try_catch;
+  v8::TryCatch try_catch(isolate);
 
   // Special double values.
   double snan = DoubleFromBits(0x7ff00000, 0x00000001);
@@ -19360,15 +17683,16 @@
     double test_value = test_values[i];
 
     // Check that Number::New preserves non-NaNs and quiets SNaNs.
-    v8::Handle<v8::Value> number = v8::Number::New(isolate, test_value);
-    double stored_number = number->NumberValue();
+    v8::Local<v8::Value> number = v8::Number::New(isolate, test_value);
+    double stored_number = number->NumberValue(context.local()).FromJust();
     if (!std::isnan(test_value)) {
       CHECK_EQ(test_value, stored_number);
     } else {
       uint64_t stored_bits = DoubleToBits(stored_number);
       // Check if quiet nan (bits 51..62 all set).
 #if (defined(V8_TARGET_ARCH_MIPS) || defined(V8_TARGET_ARCH_MIPS64)) && \
-    !defined(_MIPS_ARCH_MIPS64R6) && !defined(USE_SIMULATOR)
+    !defined(_MIPS_ARCH_MIPS64R6) && !defined(_MIPS_ARCH_MIPS32R6) &&   \
+    !defined(USE_SIMULATOR)
       // Most significant fraction bit for quiet nan is set to 0
       // on MIPS architecture. Allowed by IEEE-754.
       CHECK_EQ(0xffe, static_cast<int>((stored_bits >> 51) & 0xfff));
@@ -19379,17 +17703,18 @@
 
     // Check that Date::New preserves non-NaNs in the date range and
     // quiets SNaNs.
-    v8::Handle<v8::Value> date =
-        v8::Date::New(isolate, test_value);
+    v8::Local<v8::Value> date =
+        v8::Date::New(context.local(), test_value).ToLocalChecked();
     double expected_stored_date = DoubleToDateTime(test_value);
-    double stored_date = date->NumberValue();
+    double stored_date = date->NumberValue(context.local()).FromJust();
     if (!std::isnan(expected_stored_date)) {
       CHECK_EQ(expected_stored_date, stored_date);
     } else {
       uint64_t stored_bits = DoubleToBits(stored_date);
       // Check if quiet nan (bits 51..62 all set).
 #if (defined(V8_TARGET_ARCH_MIPS) || defined(V8_TARGET_ARCH_MIPS64)) && \
-    !defined(_MIPS_ARCH_MIPS64R6) && !defined(USE_SIMULATOR)
+    !defined(_MIPS_ARCH_MIPS64R6) && !defined(_MIPS_ARCH_MIPS32R6) &&   \
+    !defined(USE_SIMULATOR)
       // Most significant fraction bit for quiet nan is set to 0
       // on MIPS architecture. Allowed by IEEE-754.
       CHECK_EQ(0xffe, static_cast<int>((stored_bits >> 51) & 0xfff));
@@ -19404,8 +17729,9 @@
 static void SpaghettiIncident(
     const v8::FunctionCallbackInfo<v8::Value>& args) {
   v8::HandleScope scope(args.GetIsolate());
-  v8::TryCatch tc;
-  v8::Handle<v8::String> str(args[0]->ToString(args.GetIsolate()));
+  v8::TryCatch tc(args.GetIsolate());
+  v8::MaybeLocal<v8::String> str(
+      args[0]->ToString(args.GetIsolate()->GetCurrentContext()));
   USE(str);
   if (tc.HasCaught())
     tc.ReThrow();
@@ -19418,10 +17744,13 @@
   v8::Isolate* isolate = CcTest::isolate();
   v8::HandleScope scope(isolate);
   LocalContext context;
-  context->Global()->Set(
-      v8::String::NewFromUtf8(isolate, "s"),
-      v8::FunctionTemplate::New(isolate, SpaghettiIncident)->GetFunction());
-  v8::TryCatch try_catch;
+  context->Global()
+      ->Set(context.local(), v8_str("s"),
+            v8::FunctionTemplate::New(isolate, SpaghettiIncident)
+                ->GetFunction(context.local())
+                .ToLocalChecked())
+      .FromJust();
+  v8::TryCatch try_catch(isolate);
   CompileRun(
       "var i = 0;"
       "var o = {"
@@ -19444,6 +17773,7 @@
 TEST(Regress528) {
   v8::V8::Initialize();
   v8::Isolate* isolate = CcTest::isolate();
+  i::FLAG_retain_maps_for_n_gc = 0;
   v8::HandleScope scope(isolate);
   v8::Local<Context> other_context;
   int gc_count;
@@ -19460,7 +17790,7 @@
     v8::Local<Context> context = Context::New(isolate);
 
     context->Enter();
-    Local<v8::String> obj = v8::String::NewFromUtf8(isolate, "");
+    Local<v8::String> obj = v8_str("");
     context->SetEmbedderData(0, obj);
     CompileRun(source_simple);
     context->Exit();
@@ -19470,7 +17800,7 @@
     other_context->Enter();
     CompileRun(source_simple);
     other_context->Exit();
-    CcTest::heap()->CollectAllGarbage(i::Heap::kNoGCFlags);
+    CcTest::heap()->CollectAllGarbage();
     if (GetGlobalObjectsCount() == 1) break;
   }
   CHECK_GE(2, gc_count);
@@ -19492,7 +17822,7 @@
     other_context->Enter();
     CompileRun(source_eval);
     other_context->Exit();
-    CcTest::heap()->CollectAllGarbage(i::Heap::kNoGCFlags);
+    CcTest::heap()->CollectAllGarbage();
     if (GetGlobalObjectsCount() == 1) break;
   }
   CHECK_GE(2, gc_count);
@@ -19506,12 +17836,12 @@
     v8::Local<Context> context = Context::New(isolate);
 
     context->Enter();
-    v8::TryCatch try_catch;
+    v8::TryCatch try_catch(isolate);
     CompileRun(source_exception);
     CHECK(try_catch.HasCaught());
-    v8::Handle<v8::Message> message = try_catch.Message();
+    v8::Local<v8::Message> message = try_catch.Message();
     CHECK(!message.IsEmpty());
-    CHECK_EQ(1, message->GetLineNumber());
+    CHECK_EQ(1, message->GetLineNumber(context).FromJust());
     context->Exit();
   }
   isolate->ContextDisposedNotification();
@@ -19519,7 +17849,7 @@
     other_context->Enter();
     CompileRun(source_exception);
     other_context->Exit();
-    CcTest::heap()->CollectAllGarbage(i::Heap::kNoGCFlags);
+    CcTest::heap()->CollectAllGarbage();
     if (GetGlobalObjectsCount() == 1) break;
   }
   CHECK_GE(2, gc_count);
@@ -19532,38 +17862,141 @@
 THREADED_TEST(ScriptOrigin) {
   LocalContext env;
   v8::HandleScope scope(env->GetIsolate());
-  v8::ScriptOrigin origin =
-      v8::ScriptOrigin(v8::String::NewFromUtf8(env->GetIsolate(), "test"));
-  v8::Handle<v8::String> script = v8::String::NewFromUtf8(
-      env->GetIsolate(), "function f() {}\n\nfunction g() {}");
-  v8::Script::Compile(script, &origin)->Run();
+  v8::ScriptOrigin origin = v8::ScriptOrigin(
+      v8_str("test"), v8::Integer::New(env->GetIsolate(), 1),
+      v8::Integer::New(env->GetIsolate(), 1), v8::True(env->GetIsolate()),
+      v8::Local<v8::Integer>(), v8::True(env->GetIsolate()),
+      v8_str("http://sourceMapUrl"), v8::True(env->GetIsolate()));
+  v8::Local<v8::String> script = v8_str("function f() {}\n\nfunction g() {}");
+  v8::Script::Compile(env.local(), script, &origin)
+      .ToLocalChecked()
+      ->Run(env.local())
+      .ToLocalChecked();
   v8::Local<v8::Function> f = v8::Local<v8::Function>::Cast(
-      env->Global()->Get(v8::String::NewFromUtf8(env->GetIsolate(), "f")));
+      env->Global()->Get(env.local(), v8_str("f")).ToLocalChecked());
   v8::Local<v8::Function> g = v8::Local<v8::Function>::Cast(
-      env->Global()->Get(v8::String::NewFromUtf8(env->GetIsolate(), "g")));
+      env->Global()->Get(env.local(), v8_str("g")).ToLocalChecked());
 
   v8::ScriptOrigin script_origin_f = f->GetScriptOrigin();
-  CHECK_EQ("test", *v8::String::Utf8Value(script_origin_f.ResourceName()));
-  CHECK_EQ(0, script_origin_f.ResourceLineOffset()->Int32Value());
+  CHECK_EQ(0, strcmp("test",
+                     *v8::String::Utf8Value(script_origin_f.ResourceName())));
+  CHECK_EQ(
+      1,
+      script_origin_f.ResourceLineOffset()->Int32Value(env.local()).FromJust());
+  CHECK(script_origin_f.Options().IsSharedCrossOrigin());
+  CHECK(script_origin_f.Options().IsEmbedderDebugScript());
+  CHECK(script_origin_f.Options().IsOpaque());
+  printf("is name = %d\n", script_origin_f.SourceMapUrl()->IsUndefined());
+
+  CHECK_EQ(0, strcmp("http://sourceMapUrl",
+                     *v8::String::Utf8Value(script_origin_f.SourceMapUrl())));
 
   v8::ScriptOrigin script_origin_g = g->GetScriptOrigin();
-  CHECK_EQ("test", *v8::String::Utf8Value(script_origin_g.ResourceName()));
-  CHECK_EQ(0, script_origin_g.ResourceLineOffset()->Int32Value());
+  CHECK_EQ(0, strcmp("test",
+                     *v8::String::Utf8Value(script_origin_g.ResourceName())));
+  CHECK_EQ(
+      1,
+      script_origin_g.ResourceLineOffset()->Int32Value(env.local()).FromJust());
+  CHECK(script_origin_g.Options().IsSharedCrossOrigin());
+  CHECK(script_origin_g.Options().IsEmbedderDebugScript());
+  CHECK(script_origin_g.Options().IsOpaque());
+  CHECK_EQ(0, strcmp("http://sourceMapUrl",
+                     *v8::String::Utf8Value(script_origin_g.SourceMapUrl())));
 }
 
 
 THREADED_TEST(FunctionGetInferredName) {
   LocalContext env;
   v8::HandleScope scope(env->GetIsolate());
-  v8::ScriptOrigin origin =
-      v8::ScriptOrigin(v8::String::NewFromUtf8(env->GetIsolate(), "test"));
-  v8::Handle<v8::String> script = v8::String::NewFromUtf8(
-      env->GetIsolate(),
-      "var foo = { bar : { baz : function() {}}}; var f = foo.bar.baz;");
-  v8::Script::Compile(script, &origin)->Run();
+  v8::ScriptOrigin origin = v8::ScriptOrigin(v8_str("test"));
+  v8::Local<v8::String> script =
+      v8_str("var foo = { bar : { baz : function() {}}}; var f = foo.bar.baz;");
+  v8::Script::Compile(env.local(), script, &origin)
+      .ToLocalChecked()
+      ->Run(env.local())
+      .ToLocalChecked();
   v8::Local<v8::Function> f = v8::Local<v8::Function>::Cast(
-      env->Global()->Get(v8::String::NewFromUtf8(env->GetIsolate(), "f")));
-  CHECK_EQ("foo.bar.baz", *v8::String::Utf8Value(f->GetInferredName()));
+      env->Global()->Get(env.local(), v8_str("f")).ToLocalChecked());
+  CHECK_EQ(0,
+           strcmp("foo.bar.baz", *v8::String::Utf8Value(f->GetInferredName())));
+}
+
+
+THREADED_TEST(FunctionGetDebugName) {
+  LocalContext env;
+  v8::HandleScope scope(env->GetIsolate());
+  const char* code =
+      "var error = false;"
+      "function a() { this.x = 1; };"
+      "a.displayName = 'display_a';"
+      "var b = (function() {"
+      "  var f = function() { this.x = 2; };"
+      "  f.displayName = 'display_b';"
+      "  return f;"
+      "})();"
+      "var c = function() {};"
+      "c.__defineGetter__('displayName', function() {"
+      "  error = true;"
+      "  throw new Error();"
+      "});"
+      "function d() {};"
+      "d.__defineGetter__('displayName', function() {"
+      "  error = true;"
+      "  return 'wrong_display_name';"
+      "});"
+      "function e() {};"
+      "e.displayName = 'wrong_display_name';"
+      "e.__defineSetter__('displayName', function() {"
+      "  error = true;"
+      "  throw new Error();"
+      "});"
+      "function f() {};"
+      "f.displayName = { 'foo': 6, toString: function() {"
+      "  error = true;"
+      "  return 'wrong_display_name';"
+      "}};"
+      "var g = function() {"
+      "  arguments.callee.displayName = 'set_in_runtime';"
+      "}; g();"
+      "var h = function() {};"
+      "h.displayName = 'displayName';"
+      "Object.defineProperty(h, 'name', { value: 'function.name' });"
+      "var i = function() {};"
+      "i.displayName = 239;"
+      "Object.defineProperty(i, 'name', { value: 'function.name' });"
+      "var j = function() {};"
+      "Object.defineProperty(j, 'name', { value: 'function.name' });"
+      "var foo = { bar : { baz : function() {}}}; var k = foo.bar.baz;";
+  v8::ScriptOrigin origin = v8::ScriptOrigin(v8_str("test"));
+  v8::Script::Compile(env.local(), v8_str(code), &origin)
+      .ToLocalChecked()
+      ->Run(env.local())
+      .ToLocalChecked();
+  v8::Local<v8::Value> error =
+      env->Global()->Get(env.local(), v8_str("error")).ToLocalChecked();
+  CHECK_EQ(false, error->BooleanValue(env.local()).FromJust());
+  const char* functions[] = {"a", "display_a",
+                             "b", "display_b",
+                             "c", "c",
+                             "d", "d",
+                             "e", "e",
+                             "f", "f",
+                             "g", "set_in_runtime",
+                             "h", "displayName",
+                             "i", "function.name",
+                             "j", "function.name",
+                             "k", "foo.bar.baz"};
+  for (size_t i = 0; i < sizeof(functions) / sizeof(functions[0]) / 2; ++i) {
+    v8::Local<v8::Function> f = v8::Local<v8::Function>::Cast(
+        env->Global()
+            ->Get(env.local(),
+                  v8::String::NewFromUtf8(env->GetIsolate(), functions[i * 2],
+                                          v8::NewStringType::kNormal)
+                      .ToLocalChecked())
+            .ToLocalChecked());
+    CHECK_EQ(0, strcmp(functions[i * 2 + 1],
+                       *v8::String::Utf8Value(f->GetDebugName())));
+  }
 }
 
 
@@ -19601,51 +18034,53 @@
                      "}};"
                      "var g = function() {"
                      "  arguments.callee.displayName = 'set_in_runtime';"
-                     "}; g();"
-                     ;
-  v8::ScriptOrigin origin =
-      v8::ScriptOrigin(v8::String::NewFromUtf8(env->GetIsolate(), "test"));
-  v8::Script::Compile(v8::String::NewFromUtf8(env->GetIsolate(), code), &origin)
-      ->Run();
+                     "}; g();";
+  v8::ScriptOrigin origin = v8::ScriptOrigin(v8_str("test"));
+  v8::Script::Compile(env.local(), v8_str(code), &origin)
+      .ToLocalChecked()
+      ->Run(env.local())
+      .ToLocalChecked();
   v8::Local<v8::Value> error =
-      env->Global()->Get(v8::String::NewFromUtf8(env->GetIsolate(), "error"));
+      env->Global()->Get(env.local(), v8_str("error")).ToLocalChecked();
   v8::Local<v8::Function> a = v8::Local<v8::Function>::Cast(
-      env->Global()->Get(v8::String::NewFromUtf8(env->GetIsolate(), "a")));
+      env->Global()->Get(env.local(), v8_str("a")).ToLocalChecked());
   v8::Local<v8::Function> b = v8::Local<v8::Function>::Cast(
-      env->Global()->Get(v8::String::NewFromUtf8(env->GetIsolate(), "b")));
+      env->Global()->Get(env.local(), v8_str("b")).ToLocalChecked());
   v8::Local<v8::Function> c = v8::Local<v8::Function>::Cast(
-      env->Global()->Get(v8::String::NewFromUtf8(env->GetIsolate(), "c")));
+      env->Global()->Get(env.local(), v8_str("c")).ToLocalChecked());
   v8::Local<v8::Function> d = v8::Local<v8::Function>::Cast(
-      env->Global()->Get(v8::String::NewFromUtf8(env->GetIsolate(), "d")));
+      env->Global()->Get(env.local(), v8_str("d")).ToLocalChecked());
   v8::Local<v8::Function> e = v8::Local<v8::Function>::Cast(
-      env->Global()->Get(v8::String::NewFromUtf8(env->GetIsolate(), "e")));
+      env->Global()->Get(env.local(), v8_str("e")).ToLocalChecked());
   v8::Local<v8::Function> f = v8::Local<v8::Function>::Cast(
-      env->Global()->Get(v8::String::NewFromUtf8(env->GetIsolate(), "f")));
+      env->Global()->Get(env.local(), v8_str("f")).ToLocalChecked());
   v8::Local<v8::Function> g = v8::Local<v8::Function>::Cast(
-      env->Global()->Get(v8::String::NewFromUtf8(env->GetIsolate(), "g")));
-  CHECK_EQ(false, error->BooleanValue());
-  CHECK_EQ("display_a", *v8::String::Utf8Value(a->GetDisplayName()));
-  CHECK_EQ("display_b", *v8::String::Utf8Value(b->GetDisplayName()));
+      env->Global()->Get(env.local(), v8_str("g")).ToLocalChecked());
+  CHECK_EQ(false, error->BooleanValue(env.local()).FromJust());
+  CHECK_EQ(0, strcmp("display_a", *v8::String::Utf8Value(a->GetDisplayName())));
+  CHECK_EQ(0, strcmp("display_b", *v8::String::Utf8Value(b->GetDisplayName())));
   CHECK(c->GetDisplayName()->IsUndefined());
   CHECK(d->GetDisplayName()->IsUndefined());
   CHECK(e->GetDisplayName()->IsUndefined());
   CHECK(f->GetDisplayName()->IsUndefined());
-  CHECK_EQ("set_in_runtime", *v8::String::Utf8Value(g->GetDisplayName()));
+  CHECK_EQ(
+      0, strcmp("set_in_runtime", *v8::String::Utf8Value(g->GetDisplayName())));
 }
 
 
 THREADED_TEST(ScriptLineNumber) {
   LocalContext env;
   v8::HandleScope scope(env->GetIsolate());
-  v8::ScriptOrigin origin =
-      v8::ScriptOrigin(v8::String::NewFromUtf8(env->GetIsolate(), "test"));
-  v8::Handle<v8::String> script = v8::String::NewFromUtf8(
-      env->GetIsolate(), "function f() {}\n\nfunction g() {}");
-  v8::Script::Compile(script, &origin)->Run();
+  v8::ScriptOrigin origin = v8::ScriptOrigin(v8_str("test"));
+  v8::Local<v8::String> script = v8_str("function f() {}\n\nfunction g() {}");
+  v8::Script::Compile(env.local(), script, &origin)
+      .ToLocalChecked()
+      ->Run(env.local())
+      .ToLocalChecked();
   v8::Local<v8::Function> f = v8::Local<v8::Function>::Cast(
-      env->Global()->Get(v8::String::NewFromUtf8(env->GetIsolate(), "f")));
+      env->Global()->Get(env.local(), v8_str("f")).ToLocalChecked());
   v8::Local<v8::Function> g = v8::Local<v8::Function>::Cast(
-      env->Global()->Get(v8::String::NewFromUtf8(env->GetIsolate(), "g")));
+      env->Global()->Get(env.local(), v8_str("g")).ToLocalChecked());
   CHECK_EQ(0, f->GetScriptLineNumber());
   CHECK_EQ(2, g->GetScriptLineNumber());
 }
@@ -19656,16 +18091,18 @@
   v8::Isolate* isolate = env->GetIsolate();
   v8::HandleScope scope(isolate);
   v8::ScriptOrigin origin =
-      v8::ScriptOrigin(v8::String::NewFromUtf8(isolate, "test"),
-                       v8::Integer::New(isolate, 3),
+      v8::ScriptOrigin(v8_str("test"), v8::Integer::New(isolate, 3),
                        v8::Integer::New(isolate, 2));
-  v8::Handle<v8::String> script = v8::String::NewFromUtf8(
-      isolate, "function foo() {}\n\n     function bar() {}");
-  v8::Script::Compile(script, &origin)->Run();
+  v8::Local<v8::String> script =
+      v8_str("function foo() {}\n\n     function bar() {}");
+  v8::Script::Compile(env.local(), script, &origin)
+      .ToLocalChecked()
+      ->Run(env.local())
+      .ToLocalChecked();
   v8::Local<v8::Function> foo = v8::Local<v8::Function>::Cast(
-      env->Global()->Get(v8::String::NewFromUtf8(isolate, "foo")));
+      env->Global()->Get(env.local(), v8_str("foo")).ToLocalChecked());
   v8::Local<v8::Function> bar = v8::Local<v8::Function>::Cast(
-      env->Global()->Get(v8::String::NewFromUtf8(isolate, "bar")));
+      env->Global()->Get(env.local(), v8_str("bar")).ToLocalChecked());
   CHECK_EQ(14, foo->GetScriptColumnNumber());
   CHECK_EQ(17, bar->GetScriptColumnNumber());
 }
@@ -19694,17 +18131,17 @@
   v8::Isolate* isolate = env->GetIsolate();
   v8::HandleScope scope(isolate);
   v8::ScriptOrigin origin =
-      v8::ScriptOrigin(v8::String::NewFromUtf8(isolate, "test"),
-                       v8::Integer::New(isolate, 3),
+      v8::ScriptOrigin(v8_str("test"), v8::Integer::New(isolate, 3),
                        v8::Integer::New(isolate, 2));
-  v8::Handle<v8::String> scriptSource = v8::String::NewFromUtf8(
-      isolate, "function foo() {}\n\n     function bar() {}");
-  v8::Local<v8::Script> script(v8::Script::Compile(scriptSource, &origin));
-  script->Run();
+  v8::Local<v8::String> scriptSource =
+      v8_str("function foo() {}\n\n     function bar() {}");
+  v8::Local<v8::Script> script(
+      v8::Script::Compile(env.local(), scriptSource, &origin).ToLocalChecked());
+  script->Run(env.local()).ToLocalChecked();
   v8::Local<v8::Function> foo = v8::Local<v8::Function>::Cast(
-      env->Global()->Get(v8::String::NewFromUtf8(isolate, "foo")));
+      env->Global()->Get(env.local(), v8_str("foo")).ToLocalChecked());
   v8::Local<v8::Function> bar = v8::Local<v8::Function>::Cast(
-      env->Global()->Get(v8::String::NewFromUtf8(isolate, "bar")));
+      env->Global()->Get(env.local(), v8_str("bar")).ToLocalChecked());
   CHECK_EQ(script->GetUnboundScript()->GetId(), foo->ScriptId());
   CHECK_EQ(script->GetUnboundScript()->GetId(), bar->ScriptId());
 }
@@ -19713,24 +18150,27 @@
 THREADED_TEST(FunctionGetBoundFunction) {
   LocalContext env;
   v8::HandleScope scope(env->GetIsolate());
-  v8::ScriptOrigin origin = v8::ScriptOrigin(v8::String::NewFromUtf8(
-      env->GetIsolate(), "test"));
-  v8::Handle<v8::String> script = v8::String::NewFromUtf8(
-      env->GetIsolate(),
+  v8::ScriptOrigin origin = v8::ScriptOrigin(v8_str("test"));
+  v8::Local<v8::String> script = v8_str(
       "var a = new Object();\n"
       "a.x = 1;\n"
       "function f () { return this.x };\n"
       "var g = f.bind(a);\n"
       "var b = g();");
-  v8::Script::Compile(script, &origin)->Run();
+  v8::Script::Compile(env.local(), script, &origin)
+      .ToLocalChecked()
+      ->Run(env.local())
+      .ToLocalChecked();
   v8::Local<v8::Function> f = v8::Local<v8::Function>::Cast(
-      env->Global()->Get(v8::String::NewFromUtf8(env->GetIsolate(), "f")));
+      env->Global()->Get(env.local(), v8_str("f")).ToLocalChecked());
   v8::Local<v8::Function> g = v8::Local<v8::Function>::Cast(
-      env->Global()->Get(v8::String::NewFromUtf8(env->GetIsolate(), "g")));
+      env->Global()->Get(env.local(), v8_str("g")).ToLocalChecked());
   CHECK(g->GetBoundFunction()->IsFunction());
   Local<v8::Function> original_function = Local<v8::Function>::Cast(
       g->GetBoundFunction());
-  CHECK_EQ(f->GetName(), original_function->GetName());
+  CHECK(f->GetName()
+            ->Equals(env.local(), original_function->GetName())
+            .FromJust());
   CHECK_EQ(f->GetScriptLineNumber(), original_function->GetScriptLineNumber());
   CHECK_EQ(f->GetScriptColumnNumber(),
            original_function->GetScriptColumnNumber());
@@ -19752,7 +18192,9 @@
     const v8::PropertyCallbackInfo<void>& info) {
   CHECK(v8::Utils::OpenHandle(*info.This())->IsJSObject());
   CHECK(v8::Utils::OpenHandle(*info.Holder())->IsJSObject());
-  Local<Object>::Cast(info.This())->Set(v8_str("y"), v8_num(23));
+  Local<Object>::Cast(info.This())
+      ->Set(info.GetIsolate()->GetCurrentContext(), v8_str("y"), v8_num(23))
+      .FromJust();
 }
 
 
@@ -19760,7 +18202,10 @@
                        const v8::PropertyCallbackInfo<v8::Value>& info) {
   CHECK(v8::Utils::OpenHandle(*info.This())->IsJSObject());
   CHECK(v8::Utils::OpenHandle(*info.Holder())->IsJSObject());
-  if (!name->Equals(v8_str("foo"))) return;
+  if (!name->Equals(info.GetIsolate()->GetCurrentContext(), v8_str("foo"))
+           .FromJust()) {
+    return;
+  }
   info.GetReturnValue().Set(v8_num(42));
 }
 
@@ -19769,8 +18214,13 @@
                        const v8::PropertyCallbackInfo<v8::Value>& info) {
   CHECK(v8::Utils::OpenHandle(*info.This())->IsJSObject());
   CHECK(v8::Utils::OpenHandle(*info.Holder())->IsJSObject());
-  if (!name->Equals(v8_str("foo"))) return;
-  Local<Object>::Cast(info.This())->Set(v8_str("y"), v8_num(23));
+  if (!name->Equals(info.GetIsolate()->GetCurrentContext(), v8_str("foo"))
+           .FromJust()) {
+    return;
+  }
+  Local<Object>::Cast(info.This())
+      ->Set(info.GetIsolate()->GetCurrentContext(), v8_str("y"), v8_num(23))
+      .FromJust();
   info.GetReturnValue().Set(v8_num(23));
 }
 
@@ -19782,7 +18232,10 @@
   templ->SetAccessor(v8_str("x"), GetterWhichReturns42,
                      SetterWhichSetsYOnThisTo23);
   LocalContext context;
-  context->Global()->Set(v8_str("P"), templ->NewInstance());
+  CHECK(context->Global()
+            ->Set(context.local(), v8_str("P"),
+                  templ->NewInstance(context.local()).ToLocalChecked())
+            .FromJust());
   CompileRun("function C1() {"
              "  this.x = 23;"
              "};"
@@ -19796,16 +18249,30 @@
   v8::Local<v8::Script> script;
   script = v8_compile("new C1();");
   for (int i = 0; i < 10; i++) {
-    v8::Handle<v8::Object> c1 = v8::Handle<v8::Object>::Cast(script->Run());
-    CHECK_EQ(42, c1->Get(v8_str("x"))->Int32Value());
-    CHECK_EQ(23, c1->Get(v8_str("y"))->Int32Value());
+    v8::Local<v8::Object> c1 = v8::Local<v8::Object>::Cast(
+        script->Run(context.local()).ToLocalChecked());
+    CHECK_EQ(42, c1->Get(context.local(), v8_str("x"))
+                     .ToLocalChecked()
+                     ->Int32Value(context.local())
+                     .FromJust());
+    CHECK_EQ(23, c1->Get(context.local(), v8_str("y"))
+                     .ToLocalChecked()
+                     ->Int32Value(context.local())
+                     .FromJust());
   }
 
-script = v8_compile("new C2();");
+  script = v8_compile("new C2();");
   for (int i = 0; i < 10; i++) {
-    v8::Handle<v8::Object> c2 = v8::Handle<v8::Object>::Cast(script->Run());
-    CHECK_EQ(42, c2->Get(v8_str("x"))->Int32Value());
-    CHECK_EQ(23, c2->Get(v8_str("y"))->Int32Value());
+    v8::Local<v8::Object> c2 = v8::Local<v8::Object>::Cast(
+        script->Run(context.local()).ToLocalChecked());
+    CHECK_EQ(42, c2->Get(context.local(), v8_str("x"))
+                     .ToLocalChecked()
+                     ->Int32Value(context.local())
+                     .FromJust());
+    CHECK_EQ(23, c2->Get(context.local(), v8_str("y"))
+                     .ToLocalChecked()
+                     ->Int32Value(context.local())
+                     .FromJust());
   }
 }
 
@@ -19819,8 +18286,11 @@
 static void NamedPropertySetterWhichSetsYOnThisTo23(
     Local<Name> name, Local<Value> value,
     const v8::PropertyCallbackInfo<v8::Value>& info) {
-  if (name->Equals(v8_str("x"))) {
-    Local<Object>::Cast(info.This())->Set(v8_str("y"), v8_num(23));
+  if (name->Equals(info.GetIsolate()->GetCurrentContext(), v8_str("x"))
+          .FromJust()) {
+    Local<Object>::Cast(info.This())
+        ->Set(info.GetIsolate()->GetCurrentContext(), v8_str("y"), v8_num(23))
+        .FromJust();
   }
 }
 
@@ -19833,7 +18303,10 @@
       NamedPropertyGetterWhichReturns42,
       NamedPropertySetterWhichSetsYOnThisTo23));
   LocalContext context;
-  context->Global()->Set(v8_str("P"), templ->NewInstance());
+  CHECK(context->Global()
+            ->Set(context.local(), v8_str("P"),
+                  templ->NewInstance(context.local()).ToLocalChecked())
+            .FromJust());
   CompileRun("function C1() {"
              "  this.x = 23;"
              "};"
@@ -19847,16 +18320,30 @@
   v8::Local<v8::Script> script;
   script = v8_compile("new C1();");
   for (int i = 0; i < 10; i++) {
-    v8::Handle<v8::Object> c1 = v8::Handle<v8::Object>::Cast(script->Run());
-    CHECK_EQ(23, c1->Get(v8_str("x"))->Int32Value());
-    CHECK_EQ(42, c1->Get(v8_str("y"))->Int32Value());
+    v8::Local<v8::Object> c1 = v8::Local<v8::Object>::Cast(
+        script->Run(context.local()).ToLocalChecked());
+    CHECK_EQ(23, c1->Get(context.local(), v8_str("x"))
+                     .ToLocalChecked()
+                     ->Int32Value(context.local())
+                     .FromJust());
+    CHECK_EQ(42, c1->Get(context.local(), v8_str("y"))
+                     .ToLocalChecked()
+                     ->Int32Value(context.local())
+                     .FromJust());
   }
 
   script = v8_compile("new C2();");
   for (int i = 0; i < 10; i++) {
-    v8::Handle<v8::Object> c2 = v8::Handle<v8::Object>::Cast(script->Run());
-    CHECK_EQ(23, c2->Get(v8_str("x"))->Int32Value());
-    CHECK_EQ(42, c2->Get(v8_str("y"))->Int32Value());
+    v8::Local<v8::Object> c2 = v8::Local<v8::Object>::Cast(
+        script->Run(context.local()).ToLocalChecked());
+    CHECK_EQ(23, c2->Get(context.local(), v8_str("x"))
+                     .ToLocalChecked()
+                     ->Int32Value(context.local())
+                     .FromJust());
+    CHECK_EQ(42, c2->Get(context.local(), v8_str("y"))
+                     .ToLocalChecked()
+                     ->Int32Value(context.local())
+                     .FromJust());
   }
 }
 
@@ -19874,8 +18361,10 @@
 
   // Use a simple object as prototype.
   v8::Local<v8::Object> prototype = v8::Object::New(isolate);
-  prototype->Set(v8_str("y"), v8_num(42));
-  context->Global()->Set(v8_str("P"), prototype);
+  prototype->Set(context.local(), v8_str("y"), v8_num(42)).FromJust();
+  CHECK(context->Global()
+            ->Set(context.local(), v8_str("P"), prototype)
+            .FromJust());
 
   // This compile will add the code to the compilation cache.
   CompileRun(source);
@@ -19884,25 +18373,42 @@
   // Allow enough iterations for the inobject slack tracking logic
   // to finalize instance size and install the fast construct stub.
   for (int i = 0; i < 256; i++) {
-    v8::Handle<v8::Object> c1 = v8::Handle<v8::Object>::Cast(script->Run());
-    CHECK_EQ(23, c1->Get(v8_str("x"))->Int32Value());
-    CHECK_EQ(42, c1->Get(v8_str("y"))->Int32Value());
+    v8::Local<v8::Object> c1 = v8::Local<v8::Object>::Cast(
+        script->Run(context.local()).ToLocalChecked());
+    CHECK_EQ(23, c1->Get(context.local(), v8_str("x"))
+                     .ToLocalChecked()
+                     ->Int32Value(context.local())
+                     .FromJust());
+    CHECK_EQ(42, c1->Get(context.local(), v8_str("y"))
+                     .ToLocalChecked()
+                     ->Int32Value(context.local())
+                     .FromJust());
   }
 
   // Use an API object with accessors as prototype.
   Local<ObjectTemplate> templ = ObjectTemplate::New(isolate);
   templ->SetAccessor(v8_str("x"), GetterWhichReturns42,
                      SetterWhichSetsYOnThisTo23);
-  context->Global()->Set(v8_str("P"), templ->NewInstance());
+  CHECK(context->Global()
+            ->Set(context.local(), v8_str("P"),
+                  templ->NewInstance(context.local()).ToLocalChecked())
+            .FromJust());
 
   // This compile will get the code from the compilation cache.
   CompileRun(source);
 
   script = v8_compile("new C1();");
   for (int i = 0; i < 10; i++) {
-    v8::Handle<v8::Object> c1 = v8::Handle<v8::Object>::Cast(script->Run());
-    CHECK_EQ(42, c1->Get(v8_str("x"))->Int32Value());
-    CHECK_EQ(23, c1->Get(v8_str("y"))->Int32Value());
+    v8::Local<v8::Object> c1 = v8::Local<v8::Object>::Cast(
+        script->Run(context.local()).ToLocalChecked());
+    CHECK_EQ(42, c1->Get(context.local(), v8_str("x"))
+                     .ToLocalChecked()
+                     ->Int32Value(context.local())
+                     .FromJust());
+    CHECK_EQ(23, c1->Get(context.local(), v8_str("y"))
+                     .ToLocalChecked()
+                     ->Int32Value(context.local())
+                     .FromJust());
   }
 }
 
@@ -19914,12 +18420,6 @@
 int prologue_call_count_alloc = 0;
 int epilogue_call_count_alloc = 0;
 
-void PrologueCallback(v8::GCType, v8::GCCallbackFlags flags) {
-  CHECK_EQ(flags, v8::kNoGCCallbackFlags);
-  ++prologue_call_count;
-}
-
-
 void PrologueCallback(v8::Isolate* isolate,
                       v8::GCType,
                       v8::GCCallbackFlags flags) {
@@ -19928,13 +18428,6 @@
   ++prologue_call_count;
 }
 
-
-void EpilogueCallback(v8::GCType, v8::GCCallbackFlags flags) {
-  CHECK_EQ(flags, v8::kNoGCCallbackFlags);
-  ++epilogue_call_count;
-}
-
-
 void EpilogueCallback(v8::Isolate* isolate,
                       v8::GCType,
                       v8::GCCallbackFlags flags) {
@@ -19944,12 +18437,6 @@
 }
 
 
-void PrologueCallbackSecond(v8::GCType, v8::GCCallbackFlags flags) {
-  CHECK_EQ(flags, v8::kNoGCCallbackFlags);
-  ++prologue_call_count_second;
-}
-
-
 void PrologueCallbackSecond(v8::Isolate* isolate,
                             v8::GCType,
                             v8::GCCallbackFlags flags) {
@@ -19959,12 +18446,6 @@
 }
 
 
-void EpilogueCallbackSecond(v8::GCType, v8::GCCallbackFlags flags) {
-  CHECK_EQ(flags, v8::kNoGCCallbackFlags);
-  ++epilogue_call_count_second;
-}
-
-
 void EpilogueCallbackSecond(v8::Isolate* isolate,
                             v8::GCType,
                             v8::GCCallbackFlags flags) {
@@ -20017,30 +18498,32 @@
 TEST(GCCallbacksOld) {
   LocalContext context;
 
-  v8::V8::AddGCPrologueCallback(PrologueCallback);
-  v8::V8::AddGCEpilogueCallback(EpilogueCallback);
+  gc_callbacks_isolate = context->GetIsolate();
+
+  context->GetIsolate()->AddGCPrologueCallback(PrologueCallback);
+  context->GetIsolate()->AddGCEpilogueCallback(EpilogueCallback);
   CHECK_EQ(0, prologue_call_count);
   CHECK_EQ(0, epilogue_call_count);
-  CcTest::heap()->CollectAllGarbage(i::Heap::kNoGCFlags);
+  CcTest::heap()->CollectAllGarbage();
   CHECK_EQ(1, prologue_call_count);
   CHECK_EQ(1, epilogue_call_count);
-  v8::V8::AddGCPrologueCallback(PrologueCallbackSecond);
-  v8::V8::AddGCEpilogueCallback(EpilogueCallbackSecond);
-  CcTest::heap()->CollectAllGarbage(i::Heap::kNoGCFlags);
+  context->GetIsolate()->AddGCPrologueCallback(PrologueCallbackSecond);
+  context->GetIsolate()->AddGCEpilogueCallback(EpilogueCallbackSecond);
+  CcTest::heap()->CollectAllGarbage();
   CHECK_EQ(2, prologue_call_count);
   CHECK_EQ(2, epilogue_call_count);
   CHECK_EQ(1, prologue_call_count_second);
   CHECK_EQ(1, epilogue_call_count_second);
-  v8::V8::RemoveGCPrologueCallback(PrologueCallback);
-  v8::V8::RemoveGCEpilogueCallback(EpilogueCallback);
-  CcTest::heap()->CollectAllGarbage(i::Heap::kNoGCFlags);
+  context->GetIsolate()->RemoveGCPrologueCallback(PrologueCallback);
+  context->GetIsolate()->RemoveGCEpilogueCallback(EpilogueCallback);
+  CcTest::heap()->CollectAllGarbage();
   CHECK_EQ(2, prologue_call_count);
   CHECK_EQ(2, epilogue_call_count);
   CHECK_EQ(2, prologue_call_count_second);
   CHECK_EQ(2, epilogue_call_count_second);
-  v8::V8::RemoveGCPrologueCallback(PrologueCallbackSecond);
-  v8::V8::RemoveGCEpilogueCallback(EpilogueCallbackSecond);
-  CcTest::heap()->CollectAllGarbage(i::Heap::kNoGCFlags);
+  context->GetIsolate()->RemoveGCPrologueCallback(PrologueCallbackSecond);
+  context->GetIsolate()->RemoveGCEpilogueCallback(EpilogueCallbackSecond);
+  CcTest::heap()->CollectAllGarbage();
   CHECK_EQ(2, prologue_call_count);
   CHECK_EQ(2, epilogue_call_count);
   CHECK_EQ(2, prologue_call_count_second);
@@ -20056,26 +18539,26 @@
   isolate->AddGCEpilogueCallback(EpilogueCallback);
   CHECK_EQ(0, prologue_call_count);
   CHECK_EQ(0, epilogue_call_count);
-  CcTest::heap()->CollectAllGarbage(i::Heap::kNoGCFlags);
+  CcTest::heap()->CollectAllGarbage();
   CHECK_EQ(1, prologue_call_count);
   CHECK_EQ(1, epilogue_call_count);
   isolate->AddGCPrologueCallback(PrologueCallbackSecond);
   isolate->AddGCEpilogueCallback(EpilogueCallbackSecond);
-  CcTest::heap()->CollectAllGarbage(i::Heap::kNoGCFlags);
+  CcTest::heap()->CollectAllGarbage();
   CHECK_EQ(2, prologue_call_count);
   CHECK_EQ(2, epilogue_call_count);
   CHECK_EQ(1, prologue_call_count_second);
   CHECK_EQ(1, epilogue_call_count_second);
   isolate->RemoveGCPrologueCallback(PrologueCallback);
   isolate->RemoveGCEpilogueCallback(EpilogueCallback);
-  CcTest::heap()->CollectAllGarbage(i::Heap::kNoGCFlags);
+  CcTest::heap()->CollectAllGarbage();
   CHECK_EQ(2, prologue_call_count);
   CHECK_EQ(2, epilogue_call_count);
   CHECK_EQ(2, prologue_call_count_second);
   CHECK_EQ(2, epilogue_call_count_second);
   isolate->RemoveGCPrologueCallback(PrologueCallbackSecond);
   isolate->RemoveGCEpilogueCallback(EpilogueCallbackSecond);
-  CcTest::heap()->CollectAllGarbage(i::Heap::kNoGCFlags);
+  CcTest::heap()->CollectAllGarbage();
   CHECK_EQ(2, prologue_call_count);
   CHECK_EQ(2, epilogue_call_count);
   CHECK_EQ(2, prologue_call_count_second);
@@ -20094,118 +18577,6 @@
 }
 
 
-THREADED_TEST(AddToJSFunctionResultCache) {
-  i::FLAG_stress_compaction = false;
-  i::FLAG_allow_natives_syntax = true;
-  v8::HandleScope scope(CcTest::isolate());
-
-  LocalContext context;
-
-  const char* code =
-      "(function() {"
-      "  var key0 = 'a';"
-      "  var key1 = 'b';"
-      "  var r0 = %_GetFromCache(0, key0);"
-      "  var r1 = %_GetFromCache(0, key1);"
-      "  var r0_ = %_GetFromCache(0, key0);"
-      "  if (r0 !== r0_)"
-      "    return 'Different results for ' + key0 + ': ' + r0 + ' vs. ' + r0_;"
-      "  var r1_ = %_GetFromCache(0, key1);"
-      "  if (r1 !== r1_)"
-      "    return 'Different results for ' + key1 + ': ' + r1 + ' vs. ' + r1_;"
-      "  return 'PASSED';"
-      "})()";
-  CcTest::heap()->ClearJSFunctionResultCaches();
-  ExpectString(code, "PASSED");
-}
-
-
-THREADED_TEST(FillJSFunctionResultCache) {
-  i::FLAG_allow_natives_syntax = true;
-  LocalContext context;
-  v8::HandleScope scope(context->GetIsolate());
-
-  const char* code =
-      "(function() {"
-      "  var k = 'a';"
-      "  var r = %_GetFromCache(0, k);"
-      "  for (var i = 0; i < 16; i++) {"
-      "    %_GetFromCache(0, 'a' + i);"
-      "  };"
-      "  if (r === %_GetFromCache(0, k))"
-      "    return 'FAILED: k0CacheSize is too small';"
-      "  return 'PASSED';"
-      "})()";
-  CcTest::heap()->ClearJSFunctionResultCaches();
-  ExpectString(code, "PASSED");
-}
-
-
-THREADED_TEST(RoundRobinGetFromCache) {
-  i::FLAG_allow_natives_syntax = true;
-  LocalContext context;
-  v8::HandleScope scope(context->GetIsolate());
-
-  const char* code =
-      "(function() {"
-      "  var keys = [];"
-      "  for (var i = 0; i < 16; i++) keys.push(i);"
-      "  var values = [];"
-      "  for (var i = 0; i < 16; i++) values[i] = %_GetFromCache(0, keys[i]);"
-      "  for (var i = 0; i < 16; i++) {"
-      "    var v = %_GetFromCache(0, keys[i]);"
-      "    if (v.toString() !== values[i].toString())"
-      "      return 'Wrong value for ' + "
-      "          keys[i] + ': ' + v + ' vs. ' + values[i];"
-      "  };"
-      "  return 'PASSED';"
-      "})()";
-  CcTest::heap()->ClearJSFunctionResultCaches();
-  ExpectString(code, "PASSED");
-}
-
-
-THREADED_TEST(ReverseGetFromCache) {
-  i::FLAG_allow_natives_syntax = true;
-  LocalContext context;
-  v8::HandleScope scope(context->GetIsolate());
-
-  const char* code =
-      "(function() {"
-      "  var keys = [];"
-      "  for (var i = 0; i < 16; i++) keys.push(i);"
-      "  var values = [];"
-      "  for (var i = 0; i < 16; i++) values[i] = %_GetFromCache(0, keys[i]);"
-      "  for (var i = 15; i >= 16; i--) {"
-      "    var v = %_GetFromCache(0, keys[i]);"
-      "    if (v !== values[i])"
-      "      return 'Wrong value for ' + "
-      "          keys[i] + ': ' + v + ' vs. ' + values[i];"
-      "  };"
-      "  return 'PASSED';"
-      "})()";
-  CcTest::heap()->ClearJSFunctionResultCaches();
-  ExpectString(code, "PASSED");
-}
-
-
-THREADED_TEST(TestEviction) {
-  i::FLAG_allow_natives_syntax = true;
-  LocalContext context;
-  v8::HandleScope scope(context->GetIsolate());
-
-  const char* code =
-      "(function() {"
-      "  for (var i = 0; i < 2*16; i++) {"
-      "    %_GetFromCache(0, 'a' + i);"
-      "  };"
-      "  return 'PASSED';"
-      "})()";
-  CcTest::heap()->ClearJSFunctionResultCaches();
-  ExpectString(code, "PASSED");
-}
-
-
 THREADED_TEST(TwoByteStringInOneByteCons) {
   // See Chromium issue 47824.
   LocalContext context;
@@ -20258,17 +18629,17 @@
 
   // Atom RegExp.
   Local<Value> reresult = CompileRun("str2.match(/abel/g).length;");
-  CHECK_EQ(6, reresult->Int32Value());
+  CHECK_EQ(6, reresult->Int32Value(context.local()).FromJust());
 
   // Nonatom RegExp.
   reresult = CompileRun("str2.match(/abe./g).length;");
-  CHECK_EQ(6, reresult->Int32Value());
+  CHECK_EQ(6, reresult->Int32Value(context.local()).FromJust());
 
   reresult = CompileRun("str2.search(/bel/g);");
-  CHECK_EQ(1, reresult->Int32Value());
+  CHECK_EQ(1, reresult->Int32Value(context.local()).FromJust());
 
   reresult = CompileRun("str2.search(/be./g);");
-  CHECK_EQ(1, reresult->Int32Value());
+  CHECK_EQ(1, reresult->Int32Value(context.local()).FromJust());
 
   ExpectTrue("/bel/g.test(str2);");
 
@@ -20291,7 +18662,8 @@
   ExpectObject("str2.lastIndexOf('dab');", lastindexof);
 
   reresult = CompileRun("str2.charCodeAt(2);");
-  CHECK_EQ(static_cast<int32_t>('e'), reresult->Int32Value());
+  CHECK_EQ(static_cast<int32_t>('e'),
+           reresult->Int32Value(context.local()).FromJust());
 }
 
 
@@ -20303,8 +18675,8 @@
   const int length = 512;
   // Ensure word aligned assignment.
   const int aligned_length = length*sizeof(uintptr_t)/sizeof(uint16_t);
-  i::SmartArrayPointer<uintptr_t>
-  aligned_contents(new uintptr_t[aligned_length]);
+  v8::base::SmartArrayPointer<uintptr_t> aligned_contents(
+      new uintptr_t[aligned_length]);
   uint16_t* string_contents =
       reinterpret_cast<uint16_t*>(aligned_contents.get());
   // Set to contain only one byte.
@@ -20313,27 +18685,31 @@
   }
   string_contents[length-1] = 0;
   // Simple case.
-  Handle<String> string =
-      String::NewExternal(isolate,
-                          new TestResource(string_contents, NULL, false));
+  Local<String> string =
+      String::NewExternalTwoByte(isolate,
+                                 new TestResource(string_contents, NULL, false))
+          .ToLocalChecked();
   CHECK(!string->IsOneByte() && string->ContainsOnlyOneByte());
   // Counter example.
-  string = String::NewFromTwoByte(isolate, string_contents);
+  string = String::NewFromTwoByte(isolate, string_contents,
+                                  v8::NewStringType::kNormal)
+               .ToLocalChecked();
   CHECK(string->IsOneByte() && string->ContainsOnlyOneByte());
   // Test left right and balanced cons strings.
-  Handle<String> base = String::NewFromUtf8(isolate, "a");
-  Handle<String> left = base;
-  Handle<String> right = base;
+  Local<String> base = v8_str("a");
+  Local<String> left = base;
+  Local<String> right = base;
   for (int i = 0; i < 1000; i++) {
     left = String::Concat(base, left);
     right = String::Concat(right, base);
   }
-  Handle<String> balanced = String::Concat(left, base);
+  Local<String> balanced = String::Concat(left, base);
   balanced = String::Concat(balanced, right);
-  Handle<String> cons_strings[] = {left, balanced, right};
-  Handle<String> two_byte =
-      String::NewExternal(isolate,
-                          new TestResource(string_contents, NULL, false));
+  Local<String> cons_strings[] = {left, balanced, right};
+  Local<String> two_byte =
+      String::NewExternalTwoByte(isolate,
+                                 new TestResource(string_contents, NULL, false))
+          .ToLocalChecked();
   USE(two_byte); USE(cons_strings);
   for (size_t i = 0; i < arraysize(cons_strings); i++) {
     // Base assumptions.
@@ -20354,9 +18730,10 @@
       for (int i = 0; i < size; i++) {
         int shift = 8 + (i % 7);
         string_contents[alignment + i] = 1 << shift;
-        string = String::NewExternal(
-            isolate,
-            new TestResource(string_contents + alignment, NULL, false));
+        string = String::NewExternalTwoByte(
+                     isolate,
+                     new TestResource(string_contents + alignment, NULL, false))
+                     .ToLocalChecked();
         CHECK_EQ(size, string->Length());
         CHECK(!string->ContainsOnlyOneByte());
         string_contents[alignment + i] = 0x41;
@@ -20371,7 +18748,9 @@
 void FailedAccessCheckCallbackGC(Local<v8::Object> target,
                                  v8::AccessType type,
                                  Local<v8::Value> data) {
-  CcTest::heap()->CollectAllGarbage(i::Heap::kNoGCFlags);
+  CcTest::heap()->CollectAllGarbage();
+  CcTest::isolate()->ThrowException(
+      v8::Exception::Error(v8_str("cross context")));
 }
 
 
@@ -20380,118 +18759,213 @@
   // invocation. Then force the callback to be called from va
 
   v8::V8::Initialize();
-  v8::V8::SetFailedAccessCheckCallbackFunction(&FailedAccessCheckCallbackGC);
-
   v8::Isolate* isolate = CcTest::isolate();
+
+  isolate->SetFailedAccessCheckCallbackFunction(&FailedAccessCheckCallbackGC);
+
   v8::HandleScope scope(isolate);
 
   // Create an ObjectTemplate for global objects and install access
   // check callbacks that will block access.
-  v8::Handle<v8::ObjectTemplate> global_template =
+  v8::Local<v8::ObjectTemplate> global_template =
       v8::ObjectTemplate::New(isolate);
-  global_template->SetAccessCheckCallbacks(NamedGetAccessBlocker,
-                                           IndexedGetAccessBlocker,
-                                           v8::Handle<v8::Value>(),
-                                           false);
+  global_template->SetAccessCheckCallback(AccessAlwaysBlocked);
 
   // Create a context and set an x property on it's global object.
   LocalContext context0(NULL, global_template);
-  context0->Global()->Set(v8_str("x"), v8_num(42));
-  v8::Handle<v8::Object> global0 = context0->Global();
+  CHECK(context0->Global()
+            ->Set(context0.local(), v8_str("x"), v8_num(42))
+            .FromJust());
+  v8::Local<v8::Object> global0 = context0->Global();
 
   // Create a context with a different security token so that the
   // failed access check callback will be called on each access.
   LocalContext context1(NULL, global_template);
-  context1->Global()->Set(v8_str("other"), global0);
+  CHECK(context1->Global()
+            ->Set(context1.local(), v8_str("other"), global0)
+            .FromJust());
+
+  v8::TryCatch try_catch(isolate);
 
   // Get property with failed access check.
-  ExpectUndefined("other.x");
+  CHECK(CompileRun("other.x").IsEmpty());
+  CHECK(try_catch.HasCaught());
+  try_catch.Reset();
 
   // Get element with failed access check.
-  ExpectUndefined("other[0]");
+  CHECK(CompileRun("other[0]").IsEmpty());
+  CHECK(try_catch.HasCaught());
+  try_catch.Reset();
 
   // Set property with failed access check.
-  v8::Handle<v8::Value> result = CompileRun("other.x = new Object()");
-  CHECK(result->IsObject());
+  CHECK(CompileRun("other.x = new Object()").IsEmpty());
+  CHECK(try_catch.HasCaught());
+  try_catch.Reset();
 
   // Set element with failed access check.
-  result = CompileRun("other[0] = new Object()");
-  CHECK(result->IsObject());
+  CHECK(CompileRun("other[0] = new Object()").IsEmpty());
+  CHECK(try_catch.HasCaught());
+  try_catch.Reset();
 
   // Get property attribute with failed access check.
-  ExpectFalse("\'x\' in other");
+  CHECK(CompileRun("\'x\' in other").IsEmpty());
+  CHECK(try_catch.HasCaught());
+  try_catch.Reset();
 
   // Get property attribute for element with failed access check.
-  ExpectFalse("0 in other");
+  CHECK(CompileRun("0 in other").IsEmpty());
+  CHECK(try_catch.HasCaught());
+  try_catch.Reset();
 
   // Delete property.
-  ExpectFalse("delete other.x");
+  CHECK(CompileRun("delete other.x").IsEmpty());
+  CHECK(try_catch.HasCaught());
+  try_catch.Reset();
 
   // Delete element.
-  CHECK_EQ(false, global0->Delete(0));
+  CHECK(global0->Delete(context1.local(), 0).IsNothing());
+  CHECK(try_catch.HasCaught());
+  try_catch.Reset();
 
   // DefineAccessor.
-  CHECK_EQ(false,
-           global0->SetAccessor(v8_str("x"), GetXValue, NULL, v8_str("x")));
+  CHECK(global0->SetAccessor(context1.local(), v8_str("x"), GetXValue, NULL,
+                             v8_str("x"))
+            .IsNothing());
+  CHECK(try_catch.HasCaught());
+  try_catch.Reset();
 
   // Define JavaScript accessor.
-  ExpectUndefined("Object.prototype.__defineGetter__.call("
-                  "    other, \'x\', function() { return 42; })");
+  CHECK(CompileRun(
+            "Object.prototype.__defineGetter__.call("
+            "    other, \'x\', function() { return 42; })").IsEmpty());
+  CHECK(try_catch.HasCaught());
+  try_catch.Reset();
 
   // LookupAccessor.
-  ExpectUndefined("Object.prototype.__lookupGetter__.call("
-                  "    other, \'x\')");
+  CHECK(CompileRun(
+            "Object.prototype.__lookupGetter__.call("
+            "    other, \'x\')").IsEmpty());
+  CHECK(try_catch.HasCaught());
+  try_catch.Reset();
 
   // HasOwnElement.
-  ExpectFalse("Object.prototype.hasOwnProperty.call(other, \'0\')");
+  CHECK(CompileRun(
+            "Object.prototype.hasOwnProperty.call("
+            "other, \'0\')").IsEmpty());
+  CHECK(try_catch.HasCaught());
+  try_catch.Reset();
 
-  CHECK_EQ(false, global0->HasRealIndexedProperty(0));
-  CHECK_EQ(false, global0->HasRealNamedProperty(v8_str("x")));
-  CHECK_EQ(false, global0->HasRealNamedCallbackProperty(v8_str("x")));
+  CHECK(global0->HasRealIndexedProperty(context1.local(), 0).IsNothing());
+  CHECK(try_catch.HasCaught());
+  try_catch.Reset();
+
+  CHECK(
+      global0->HasRealNamedProperty(context1.local(), v8_str("x")).IsNothing());
+  CHECK(try_catch.HasCaught());
+  try_catch.Reset();
+
+  CHECK(global0->HasRealNamedCallbackProperty(context1.local(), v8_str("x"))
+            .IsNothing());
+  CHECK(try_catch.HasCaught());
+  try_catch.Reset();
 
   // Reset the failed access check callback so it does not influence
   // the other tests.
-  v8::V8::SetFailedAccessCheckCallbackFunction(NULL);
+  isolate->SetFailedAccessCheckCallbackFunction(NULL);
 }
 
 
 TEST(IsolateNewDispose) {
   v8::Isolate* current_isolate = CcTest::isolate();
-  v8::Isolate* isolate = v8::Isolate::New();
+  v8::Isolate::CreateParams create_params;
+  create_params.array_buffer_allocator = CcTest::array_buffer_allocator();
+  v8::Isolate* isolate = v8::Isolate::New(create_params);
   CHECK(isolate != NULL);
   CHECK(current_isolate != isolate);
   CHECK(current_isolate == CcTest::isolate());
 
-  v8::V8::SetFatalErrorHandler(StoringErrorCallback);
+  isolate->SetFatalErrorHandler(StoringErrorCallback);
   last_location = last_message = NULL;
   isolate->Dispose();
-  CHECK_EQ(last_location, NULL);
-  CHECK_EQ(last_message, NULL);
+  CHECK(!last_location);
+  CHECK(!last_message);
 }
 
 
 UNINITIALIZED_TEST(DisposeIsolateWhenInUse) {
-  v8::Isolate* isolate = v8::Isolate::New();
+  v8::Isolate::CreateParams create_params;
+  create_params.array_buffer_allocator = CcTest::array_buffer_allocator();
+  v8::Isolate* isolate = v8::Isolate::New(create_params);
   {
     v8::Isolate::Scope i_scope(isolate);
     v8::HandleScope scope(isolate);
     LocalContext context(isolate);
     // Run something in this isolate.
     ExpectTrue("true");
-    v8::V8::SetFatalErrorHandler(StoringErrorCallback);
+    isolate->SetFatalErrorHandler(StoringErrorCallback);
     last_location = last_message = NULL;
     // Still entered, should fail.
     isolate->Dispose();
-    CHECK_NE(last_location, NULL);
-    CHECK_NE(last_message, NULL);
+    CHECK(last_location);
+    CHECK(last_message);
   }
   isolate->Dispose();
 }
 
 
+static void BreakArrayGuarantees(const char* script) {
+  v8::Isolate::CreateParams create_params;
+  create_params.array_buffer_allocator = CcTest::array_buffer_allocator();
+  v8::Isolate* isolate1 = v8::Isolate::New(create_params);
+  isolate1->Enter();
+  v8::Persistent<v8::Context> context1;
+  {
+    v8::HandleScope scope(isolate1);
+    context1.Reset(isolate1, Context::New(isolate1));
+  }
+
+  {
+    v8::HandleScope scope(isolate1);
+    v8::Local<v8::Context> context =
+        v8::Local<v8::Context>::New(isolate1, context1);
+    v8::Context::Scope context_scope(context);
+    v8::internal::Isolate* i_isolate =
+        reinterpret_cast<v8::internal::Isolate*>(isolate1);
+    CHECK_EQ(true, i_isolate->IsFastArrayConstructorPrototypeChainIntact());
+    // Run something in new isolate.
+    CompileRun(script);
+    CHECK_EQ(false, i_isolate->IsFastArrayConstructorPrototypeChainIntact());
+  }
+  isolate1->Exit();
+  isolate1->Dispose();
+}
+
+
+TEST(VerifyArrayPrototypeGuarantees) {
+  // Break fast array hole handling by element changes.
+  BreakArrayGuarantees("[].__proto__[1] = 3;");
+  BreakArrayGuarantees("Object.prototype[3] = 'three';");
+  BreakArrayGuarantees("Array.prototype.push(1);");
+  BreakArrayGuarantees("Array.prototype.unshift(1);");
+  // Break fast array hole handling by changing length.
+  BreakArrayGuarantees("Array.prototype.length = 30;");
+  // Break fast array hole handling by prototype structure changes.
+  BreakArrayGuarantees("[].__proto__.__proto__ = { funny: true };");
+  // By sending elements to dictionary mode.
+  BreakArrayGuarantees(
+      "Object.defineProperty(Array.prototype, 0, {"
+      "  get: function() { return 3; }});");
+  BreakArrayGuarantees(
+      "Object.defineProperty(Object.prototype, 0, {"
+      "  get: function() { return 3; }});");
+}
+
+
 TEST(RunTwoIsolatesOnSingleThread) {
   // Run isolate 1.
-  v8::Isolate* isolate1 = v8::Isolate::New();
+  v8::Isolate::CreateParams create_params;
+  create_params.array_buffer_allocator = CcTest::array_buffer_allocator();
+  v8::Isolate* isolate1 = v8::Isolate::New(create_params);
   isolate1->Enter();
   v8::Persistent<v8::Context> context1;
   {
@@ -20510,7 +18984,7 @@
   }
 
   // Run isolate 2.
-  v8::Isolate* isolate2 = v8::Isolate::New();
+  v8::Isolate* isolate2 = v8::Isolate::New(create_params);
   v8::Persistent<v8::Context> context2;
 
   {
@@ -20592,16 +19066,16 @@
   context1.Reset();
   isolate1->Exit();
 
-  v8::V8::SetFatalErrorHandler(StoringErrorCallback);
+  isolate2->SetFatalErrorHandler(StoringErrorCallback);
   last_location = last_message = NULL;
 
   isolate1->Dispose();
-  CHECK_EQ(last_location, NULL);
-  CHECK_EQ(last_message, NULL);
+  CHECK(!last_location);
+  CHECK(!last_message);
 
   isolate2->Dispose();
-  CHECK_EQ(last_location, NULL);
-  CHECK_EQ(last_message, NULL);
+  CHECK(!last_location);
+  CHECK(!last_message);
 
   // Check that default isolate still runs.
   {
@@ -20626,7 +19100,7 @@
                     "fib(%d)", limit);
   Local<Value> value = CompileRun(code.start());
   CHECK(value->IsNumber());
-  return static_cast<int>(value->NumberValue());
+  return static_cast<int>(value->NumberValue(context.local()).FromJust());
 }
 
 class IsolateThread : public v8::base::Thread {
@@ -20635,7 +19109,9 @@
       : Thread(Options("IsolateThread")), fib_limit_(fib_limit), result_(0) {}
 
   void Run() {
-    v8::Isolate* isolate = v8::Isolate::New();
+    v8::Isolate::CreateParams create_params;
+    create_params.array_buffer_allocator = CcTest::array_buffer_allocator();
+    v8::Isolate* isolate = v8::Isolate::New(create_params);
     result_ = CalcFibonacci(isolate, fib_limit_);
     isolate->Dispose();
   }
@@ -20672,7 +19148,9 @@
 
 
 TEST(IsolateDifferentContexts) {
-  v8::Isolate* isolate = v8::Isolate::New();
+  v8::Isolate::CreateParams create_params;
+  create_params.array_buffer_allocator = CcTest::array_buffer_allocator();
+  v8::Isolate* isolate = v8::Isolate::New(create_params);
   Local<v8::Context> context;
   {
     v8::Isolate::Scope isolate_scope(isolate);
@@ -20681,7 +19159,7 @@
     v8::Context::Scope context_scope(context);
     Local<Value> v = CompileRun("2");
     CHECK(v->IsNumber());
-    CHECK_EQ(2, static_cast<int>(v->NumberValue()));
+    CHECK_EQ(2, static_cast<int>(v->NumberValue(context).FromJust()));
   }
   {
     v8::Isolate::Scope isolate_scope(isolate);
@@ -20690,7 +19168,7 @@
     v8::Context::Scope context_scope(context);
     Local<Value> v = CompileRun("22");
     CHECK(v->IsNumber());
-    CHECK_EQ(22, static_cast<int>(v->NumberValue()));
+    CHECK_EQ(22, static_cast<int>(v->NumberValue(context).FromJust()));
   }
   isolate->Dispose();
 }
@@ -20712,10 +19190,13 @@
 
   void Run() {
     v8::Isolate::CreateParams create_params;
+    create_params.array_buffer_allocator = CcTest::array_buffer_allocator();
+    const intptr_t pageSizeMult =
+        v8::internal::Page::kPageSize / v8::internal::MB;
     switch (testCase_) {
       case SetResourceConstraints: {
-        create_params.constraints.set_max_semi_space_size(1);
-        create_params.constraints.set_max_old_space_size(4);
+        create_params.constraints.set_max_semi_space_size(1 * pageSizeMult);
+        create_params.constraints.set_max_old_space_size(4 * pageSizeMult);
         break;
       }
       default:
@@ -20729,7 +19210,7 @@
         break;
 
       case SetFatalHandler:
-        v8::V8::SetFatalErrorHandler(NULL);
+        isolate->SetFatalErrorHandler(NULL);
         break;
 
       case SetCounterFunction:
@@ -20892,69 +19373,13 @@
                  "})()",
                  "ReferenceError: cell is not defined");
     CompileRun("cell = \"new_second\";");
-    CcTest::heap()->CollectAllGarbage(i::Heap::kNoGCFlags);
+    CcTest::heap()->CollectAllGarbage();
     ExpectString("readCell()", "new_second");
     ExpectString("readCell()", "new_second");
   }
 }
 
 
-TEST(DontDeleteCellLoadICForceDelete) {
-  const char* function_code =
-      "function readCell() { while (true) { return cell; } }";
-
-  // Run the code twice to initialize the load IC for a don't delete
-  // cell.
-  LocalContext context;
-  v8::HandleScope scope(context->GetIsolate());
-  CompileRun("var cell = \"value\";");
-  ExpectBoolean("delete cell", false);
-  CompileRun(function_code);
-  ExpectString("readCell()", "value");
-  ExpectString("readCell()", "value");
-
-  // Delete the cell using the API and check the inlined code works
-  // correctly.
-  CHECK(context->Global()->ForceDelete(v8_str("cell")));
-  ExpectString("(function() {"
-               "  try {"
-               "    return readCell();"
-               "  } catch(e) {"
-               "    return e.toString();"
-               "  }"
-               "})()",
-               "ReferenceError: cell is not defined");
-}
-
-
-TEST(DontDeleteCellLoadICAPI) {
-  const char* function_code =
-      "function readCell() { while (true) { return cell; } }";
-
-  // Run the code twice to initialize the load IC for a don't delete
-  // cell created using the API.
-  LocalContext context;
-  v8::HandleScope scope(context->GetIsolate());
-  context->Global()->ForceSet(v8_str("cell"), v8_str("value"), v8::DontDelete);
-  ExpectBoolean("delete cell", false);
-  CompileRun(function_code);
-  ExpectString("readCell()", "value");
-  ExpectString("readCell()", "value");
-
-  // Delete the cell using the API and check the inlined code works
-  // correctly.
-  CHECK(context->Global()->ForceDelete(v8_str("cell")));
-  ExpectString("(function() {"
-               "  try {"
-               "    return readCell();"
-               "  } catch(e) {"
-               "    return e.toString();"
-               "  }"
-               "})()",
-               "ReferenceError: cell is not defined");
-}
-
-
 class Visitor42 : public v8::PersistentHandleVisitor {
  public:
   explicit Visitor42(v8::Persistent<v8::Object>* object)
@@ -20966,11 +19391,12 @@
     CHECK_EQ(42, value->WrapperClassId());
     v8::Isolate* isolate = CcTest::isolate();
     v8::HandleScope handle_scope(isolate);
-    v8::Handle<v8::Value> handle = v8::Local<v8::Value>::New(isolate, *value);
-    v8::Handle<v8::Value> object =
-        v8::Local<v8::Object>::New(isolate, *object_);
+    v8::Local<v8::Value> handle = v8::Local<v8::Value>::New(isolate, *value);
+    v8::Local<v8::Value> object = v8::Local<v8::Object>::New(isolate, *object_);
     CHECK(handle->IsObject());
-    CHECK_EQ(Handle<Object>::Cast(handle), object);
+    CHECK(Local<Object>::Cast(handle)
+              ->Equals(isolate->GetCurrentContext(), object)
+              .FromJust());
     ++counter_;
   }
 
@@ -20989,7 +19415,7 @@
   CHECK_EQ(42, object.WrapperClassId());
 
   Visitor42 visitor(&object);
-  v8::V8::VisitHandlesWithClassIds(isolate, &visitor);
+  isolate->VisitHandlesWithClassIds(&visitor);
   CHECK_EQ(1, visitor.counter_);
 
   object.Reset();
@@ -21017,8 +19443,8 @@
   object1.SetWrapperClassId(42);
   CHECK_EQ(42, object1.WrapperClassId());
 
-  CcTest::heap()->CollectAllGarbage(i::Heap::kNoGCFlags);
-  CcTest::heap()->CollectAllGarbage(i::Heap::kNoGCFlags);
+  CcTest::heap()->CollectAllGarbage();
+  CcTest::heap()->CollectAllGarbage();
 
   v8::Persistent<v8::Object> object2(isolate, v8::Object::New(isolate));
   CHECK_EQ(0, object2.WrapperClassId());
@@ -21026,7 +19452,7 @@
   CHECK_EQ(42, object2.WrapperClassId());
 
   Visitor42 visitor(&object2);
-  v8::V8::VisitHandlesForPartialDependence(isolate, &visitor);
+  isolate->VisitHandlesForPartialDependence(&visitor);
   CHECK_EQ(1, visitor.counter_);
 
   object1.Reset();
@@ -21035,38 +19461,53 @@
 
 
 TEST(RegExp) {
+  i::FLAG_harmony_regexps = true;
+  i::FLAG_harmony_unicode_regexps = true;
   LocalContext context;
   v8::HandleScope scope(context->GetIsolate());
 
-  v8::Handle<v8::RegExp> re = v8::RegExp::New(v8_str("foo"), v8::RegExp::kNone);
+  v8::Local<v8::RegExp> re =
+      v8::RegExp::New(context.local(), v8_str("foo"), v8::RegExp::kNone)
+          .ToLocalChecked();
   CHECK(re->IsRegExp());
-  CHECK(re->GetSource()->Equals(v8_str("foo")));
+  CHECK(re->GetSource()->Equals(context.local(), v8_str("foo")).FromJust());
   CHECK_EQ(v8::RegExp::kNone, re->GetFlags());
 
-  re = v8::RegExp::New(v8_str("bar"),
+  re = v8::RegExp::New(context.local(), v8_str("bar"),
                        static_cast<v8::RegExp::Flags>(v8::RegExp::kIgnoreCase |
-                                                      v8::RegExp::kGlobal));
+                                                      v8::RegExp::kGlobal))
+           .ToLocalChecked();
   CHECK(re->IsRegExp());
-  CHECK(re->GetSource()->Equals(v8_str("bar")));
+  CHECK(re->GetSource()->Equals(context.local(), v8_str("bar")).FromJust());
   CHECK_EQ(v8::RegExp::kIgnoreCase | v8::RegExp::kGlobal,
            static_cast<int>(re->GetFlags()));
 
-  re = v8::RegExp::New(v8_str("baz"),
+  re = v8::RegExp::New(context.local(), v8_str("baz"),
                        static_cast<v8::RegExp::Flags>(v8::RegExp::kIgnoreCase |
-                                                      v8::RegExp::kMultiline));
+                                                      v8::RegExp::kMultiline))
+           .ToLocalChecked();
   CHECK(re->IsRegExp());
-  CHECK(re->GetSource()->Equals(v8_str("baz")));
+  CHECK(re->GetSource()->Equals(context.local(), v8_str("baz")).FromJust());
   CHECK_EQ(v8::RegExp::kIgnoreCase | v8::RegExp::kMultiline,
            static_cast<int>(re->GetFlags()));
 
+  re = v8::RegExp::New(context.local(), v8_str("baz"),
+                       static_cast<v8::RegExp::Flags>(v8::RegExp::kUnicode |
+                                                      v8::RegExp::kSticky))
+           .ToLocalChecked();
+  CHECK(re->IsRegExp());
+  CHECK(re->GetSource()->Equals(context.local(), v8_str("baz")).FromJust());
+  CHECK_EQ(v8::RegExp::kUnicode | v8::RegExp::kSticky,
+           static_cast<int>(re->GetFlags()));
+
   re = CompileRun("/quux/").As<v8::RegExp>();
   CHECK(re->IsRegExp());
-  CHECK(re->GetSource()->Equals(v8_str("quux")));
+  CHECK(re->GetSource()->Equals(context.local(), v8_str("quux")).FromJust());
   CHECK_EQ(v8::RegExp::kNone, re->GetFlags());
 
   re = CompileRun("/quux/gm").As<v8::RegExp>();
   CHECK(re->IsRegExp());
-  CHECK(re->GetSource()->Equals(v8_str("quux")));
+  CHECK(re->GetSource()->Equals(context.local(), v8_str("quux")).FromJust());
   CHECK_EQ(v8::RegExp::kGlobal | v8::RegExp::kMultiline,
            static_cast<int>(re->GetFlags()));
 
@@ -21074,32 +19515,39 @@
   // still works.
   CompileRun("RegExp = function() {}");
 
-  re = v8::RegExp::New(v8_str("foobar"), v8::RegExp::kNone);
+  re = v8::RegExp::New(context.local(), v8_str("foobar"), v8::RegExp::kNone)
+           .ToLocalChecked();
   CHECK(re->IsRegExp());
-  CHECK(re->GetSource()->Equals(v8_str("foobar")));
+  CHECK(re->GetSource()->Equals(context.local(), v8_str("foobar")).FromJust());
   CHECK_EQ(v8::RegExp::kNone, re->GetFlags());
 
-  re = v8::RegExp::New(v8_str("foobarbaz"),
+  re = v8::RegExp::New(context.local(), v8_str("foobarbaz"),
                        static_cast<v8::RegExp::Flags>(v8::RegExp::kIgnoreCase |
-                                                      v8::RegExp::kMultiline));
+                                                      v8::RegExp::kMultiline))
+           .ToLocalChecked();
   CHECK(re->IsRegExp());
-  CHECK(re->GetSource()->Equals(v8_str("foobarbaz")));
+  CHECK(
+      re->GetSource()->Equals(context.local(), v8_str("foobarbaz")).FromJust());
   CHECK_EQ(v8::RegExp::kIgnoreCase | v8::RegExp::kMultiline,
            static_cast<int>(re->GetFlags()));
 
-  context->Global()->Set(v8_str("re"), re);
+  CHECK(context->Global()->Set(context.local(), v8_str("re"), re).FromJust());
   ExpectTrue("re.test('FoobarbaZ')");
 
   // RegExps are objects on which you can set properties.
-  re->Set(v8_str("property"), v8::Integer::New(context->GetIsolate(), 32));
-  v8::Handle<v8::Value> value(CompileRun("re.property"));
-  CHECK_EQ(32, value->Int32Value());
+  re->Set(context.local(), v8_str("property"),
+          v8::Integer::New(context->GetIsolate(), 32))
+      .FromJust();
+  v8::Local<v8::Value> value(CompileRun("re.property"));
+  CHECK_EQ(32, value->Int32Value(context.local()).FromJust());
 
-  v8::TryCatch try_catch;
-  re = v8::RegExp::New(v8_str("foo["), v8::RegExp::kNone);
-  CHECK(re.IsEmpty());
+  v8::TryCatch try_catch(context->GetIsolate());
+  CHECK(v8::RegExp::New(context.local(), v8_str("foo["), v8::RegExp::kNone)
+            .IsEmpty());
   CHECK(try_catch.HasCaught());
-  context->Global()->Set(v8_str("ex"), try_catch.Exception());
+  CHECK(context->Global()
+            ->Set(context.local(), v8_str("ex"), try_catch.Exception())
+            .FromJust());
   ExpectTrue("ex instanceof SyntaxError");
 }
 
@@ -21108,18 +19556,18 @@
   LocalContext localContext;
   v8::HandleScope handleScope(localContext->GetIsolate());
 
-  v8::Handle<v8::Object> globalProxy = localContext->Global();
-  v8::Handle<Value> global = globalProxy->GetPrototype();
+  v8::Local<v8::Object> globalProxy = localContext->Global();
+  v8::Local<Value> global = globalProxy->GetPrototype();
 
   CHECK(global->StrictEquals(global));
   CHECK(!global->StrictEquals(globalProxy));
   CHECK(!globalProxy->StrictEquals(global));
   CHECK(globalProxy->StrictEquals(globalProxy));
 
-  CHECK(global->Equals(global));
-  CHECK(!global->Equals(globalProxy));
-  CHECK(!globalProxy->Equals(global));
-  CHECK(globalProxy->Equals(globalProxy));
+  CHECK(global->Equals(localContext.local(), global).FromJust());
+  CHECK(!global->Equals(localContext.local(), globalProxy).FromJust());
+  CHECK(!globalProxy->Equals(localContext.local(), global).FromJust());
+  CHECK(globalProxy->Equals(localContext.local(), globalProxy).FromJust());
 }
 
 
@@ -21130,8 +19578,10 @@
 
 
 static void Enumerator(const v8::PropertyCallbackInfo<v8::Array>& info) {
-  v8::Handle<v8::Array> result = v8::Array::New(info.GetIsolate());
-  result->Set(0, v8_str("universalAnswer"));
+  v8::Local<v8::Array> result = v8::Array::New(info.GetIsolate());
+  result->Set(info.GetIsolate()->GetCurrentContext(), 0,
+              v8_str("universalAnswer"))
+      .FromJust();
   info.GetReturnValue().Set(result);
 }
 
@@ -21142,53 +19592,68 @@
   v8::HandleScope handle_scope(isolate);
   v8::Context::Scope context_scope(context.local());
 
-  v8::Handle<v8::ObjectTemplate> tmpl = v8::ObjectTemplate::New(isolate);
+  v8::Local<v8::ObjectTemplate> tmpl = v8::ObjectTemplate::New(isolate);
   tmpl->SetHandler(v8::NamedPropertyHandlerConfiguration(Getter, NULL, NULL,
                                                          NULL, Enumerator));
-  context->Global()->Set(v8_str("o"), tmpl->NewInstance());
-  v8::Handle<v8::Array> result = v8::Handle<v8::Array>::Cast(CompileRun(
-        "var result = []; for (var k in o) result.push(k); result"));
-  CHECK_EQ(1, result->Length());
-  CHECK_EQ(v8_str("universalAnswer"), result->Get(0));
+  CHECK(context->Global()
+            ->Set(context.local(), v8_str("o"),
+                  tmpl->NewInstance(context.local()).ToLocalChecked())
+            .FromJust());
+  v8::Local<v8::Array> result = v8::Local<v8::Array>::Cast(
+      CompileRun("var result = []; for (var k in o) result.push(k); result"));
+  CHECK_EQ(1u, result->Length());
+  CHECK(v8_str("universalAnswer")
+            ->Equals(context.local(),
+                     result->Get(context.local(), 0).ToLocalChecked())
+            .FromJust());
 }
 
 
 TEST(DefinePropertyPostDetach) {
   LocalContext context;
   v8::HandleScope scope(context->GetIsolate());
-  v8::Handle<v8::Object> proxy = context->Global();
-  v8::Handle<v8::Function> define_property =
-      CompileRun("(function() {"
-                 "  Object.defineProperty("
-                 "    this,"
-                 "    1,"
-                 "    { configurable: true, enumerable: true, value: 3 });"
-                 "})").As<Function>();
+  v8::Local<v8::Object> proxy = context->Global();
+  v8::Local<v8::Function> define_property =
+      CompileRun(
+          "(function() {"
+          "  Object.defineProperty("
+          "    this,"
+          "    1,"
+          "    { configurable: true, enumerable: true, value: 3 });"
+          "})")
+          .As<Function>();
   context->DetachGlobal();
-  define_property->Call(proxy, 0, NULL);
+  CHECK(define_property->Call(context.local(), proxy, 0, NULL).IsEmpty());
 }
 
 
-static void InstallContextId(v8::Handle<Context> context, int id) {
+static void InstallContextId(v8::Local<Context> context, int id) {
   Context::Scope scope(context);
-  CompileRun("Object.prototype").As<Object>()->
-      Set(v8_str("context_id"), v8::Integer::New(context->GetIsolate(), id));
+  CHECK(CompileRun("Object.prototype")
+            .As<Object>()
+            ->Set(context, v8_str("context_id"),
+                  v8::Integer::New(context->GetIsolate(), id))
+            .FromJust());
 }
 
 
-static void CheckContextId(v8::Handle<Object> object, int expected) {
-  CHECK_EQ(expected, object->Get(v8_str("context_id"))->Int32Value());
+static void CheckContextId(v8::Local<Object> object, int expected) {
+  v8::Local<v8::Context> context = CcTest::isolate()->GetCurrentContext();
+  CHECK_EQ(expected, object->Get(context, v8_str("context_id"))
+                         .ToLocalChecked()
+                         ->Int32Value(context)
+                         .FromJust());
 }
 
 
 THREADED_TEST(CreationContext) {
   v8::Isolate* isolate = CcTest::isolate();
   HandleScope handle_scope(isolate);
-  Handle<Context> context1 = Context::New(isolate);
+  Local<Context> context1 = Context::New(isolate);
   InstallContextId(context1, 1);
-  Handle<Context> context2 = Context::New(isolate);
+  Local<Context> context2 = Context::New(isolate);
   InstallContextId(context2, 2);
-  Handle<Context> context3 = Context::New(isolate);
+  Local<Context> context3 = Context::New(isolate);
   InstallContextId(context3, 3);
 
   Local<v8::FunctionTemplate> tmpl = v8::FunctionTemplate::New(isolate);
@@ -21198,7 +19663,7 @@
   {
     Context::Scope scope(context1);
     object1 = Object::New(isolate);
-    func1 = tmpl->GetFunction();
+    func1 = tmpl->GetFunction(context1).ToLocalChecked();
   }
 
   Local<Object> object2;
@@ -21206,7 +19671,7 @@
   {
     Context::Scope scope(context2);
     object2 = Object::New(isolate);
-    func2 = tmpl->GetFunction();
+    func2 = tmpl->GetFunction(context2).ToLocalChecked();
   }
 
   Local<Object> instance1;
@@ -21214,22 +19679,26 @@
 
   {
     Context::Scope scope(context3);
-    instance1 = func1->NewInstance();
-    instance2 = func2->NewInstance();
+    instance1 = func1->NewInstance(context3).ToLocalChecked();
+    instance2 = func2->NewInstance(context3).ToLocalChecked();
   }
 
-  CHECK(object1->CreationContext() == context1);
-  CheckContextId(object1, 1);
-  CHECK(func1->CreationContext() == context1);
-  CheckContextId(func1, 1);
-  CHECK(instance1->CreationContext() == context1);
-  CheckContextId(instance1, 1);
-  CHECK(object2->CreationContext() == context2);
-  CheckContextId(object2, 2);
-  CHECK(func2->CreationContext() == context2);
-  CheckContextId(func2, 2);
-  CHECK(instance2->CreationContext() == context2);
-  CheckContextId(instance2, 2);
+  {
+    Local<Context> other_context = Context::New(isolate);
+    Context::Scope scope(other_context);
+    CHECK(object1->CreationContext() == context1);
+    CheckContextId(object1, 1);
+    CHECK(func1->CreationContext() == context1);
+    CheckContextId(func1, 1);
+    CHECK(instance1->CreationContext() == context1);
+    CheckContextId(instance1, 1);
+    CHECK(object2->CreationContext() == context2);
+    CheckContextId(object2, 2);
+    CHECK(func2->CreationContext() == context2);
+    CheckContextId(func2, 2);
+    CHECK(instance2->CreationContext() == context2);
+    CheckContextId(instance2, 2);
+  }
 
   {
     Context::Scope scope(context1);
@@ -21267,7 +19736,7 @@
 
 THREADED_TEST(CreationContextOfJsFunction) {
   HandleScope handle_scope(CcTest::isolate());
-  Handle<Context> context = Context::New(CcTest::isolate());
+  Local<Context> context = Context::New(CcTest::isolate());
   InstallContextId(context, 1);
 
   Local<Object> function;
@@ -21276,11 +19745,46 @@
     function = CompileRun("function foo() {}; foo").As<Object>();
   }
 
+  Local<Context> other_context = Context::New(CcTest::isolate());
+  Context::Scope scope(other_context);
   CHECK(function->CreationContext() == context);
   CheckContextId(function, 1);
 }
 
 
+THREADED_TEST(CreationContextOfJsBoundFunction) {
+  HandleScope handle_scope(CcTest::isolate());
+  Local<Context> context1 = Context::New(CcTest::isolate());
+  InstallContextId(context1, 1);
+  Local<Context> context2 = Context::New(CcTest::isolate());
+  InstallContextId(context2, 2);
+
+  Local<Function> target_function;
+  {
+    Context::Scope scope(context1);
+    target_function = CompileRun("function foo() {}; foo").As<Function>();
+  }
+
+  Local<Function> bound_function1, bound_function2;
+  {
+    Context::Scope scope(context2);
+    CHECK(context2->Global()
+              ->Set(context2, v8_str("foo"), target_function)
+              .FromJust());
+    bound_function1 = CompileRun("foo.bind(1)").As<Function>();
+    bound_function2 =
+        CompileRun("Function.prototype.bind.call(foo, 2)").As<Function>();
+  }
+
+  Local<Context> other_context = Context::New(CcTest::isolate());
+  Context::Scope scope(other_context);
+  CHECK(bound_function1->CreationContext() == context1);
+  CheckContextId(bound_function1, 1);
+  CHECK(bound_function2->CreationContext() == context2);
+  CheckContextId(bound_function2, 1);
+}
+
+
 void HasOwnPropertyIndexedPropertyGetter(
     uint32_t index,
     const v8::PropertyCallbackInfo<v8::Value>& info) {
@@ -21290,7 +19794,10 @@
 
 void HasOwnPropertyNamedPropertyGetter(
     Local<Name> property, const v8::PropertyCallbackInfo<v8::Value>& info) {
-  if (property->Equals(v8_str("foo"))) info.GetReturnValue().Set(v8_str("yes"));
+  if (property->Equals(info.GetIsolate()->GetCurrentContext(), v8_str("foo"))
+          .FromJust()) {
+    info.GetReturnValue().Set(v8_str("yes"));
+  }
 }
 
 
@@ -21302,13 +19809,19 @@
 
 void HasOwnPropertyNamedPropertyQuery(
     Local<Name> property, const v8::PropertyCallbackInfo<v8::Integer>& info) {
-  if (property->Equals(v8_str("foo"))) info.GetReturnValue().Set(1);
+  if (property->Equals(info.GetIsolate()->GetCurrentContext(), v8_str("foo"))
+          .FromJust()) {
+    info.GetReturnValue().Set(1);
+  }
 }
 
 
 void HasOwnPropertyNamedPropertyQuery2(
     Local<Name> property, const v8::PropertyCallbackInfo<v8::Integer>& info) {
-  if (property->Equals(v8_str("bar"))) info.GetReturnValue().Set(1);
+  if (property->Equals(info.GetIsolate()->GetCurrentContext(), v8_str("bar"))
+          .FromJust()) {
+    info.GetReturnValue().Set(1);
+  }
 }
 
 
@@ -21324,7 +19837,7 @@
   v8::Isolate* isolate = env->GetIsolate();
   v8::HandleScope scope(isolate);
   { // Check normal properties and defined getters.
-    Handle<Value> value = CompileRun(
+    Local<Value> value = CompileRun(
         "function Foo() {"
         "    this.foo = 11;"
         "    this.__defineGetter__('baz', function() { return 1; });"
@@ -21336,63 +19849,63 @@
         "Bar.prototype = new Foo();"
         "new Bar();");
     CHECK(value->IsObject());
-    Handle<Object> object = value->ToObject(isolate);
-    CHECK(object->Has(v8_str("foo")));
-    CHECK(!object->HasOwnProperty(v8_str("foo")));
-    CHECK(object->HasOwnProperty(v8_str("bar")));
-    CHECK(object->Has(v8_str("baz")));
-    CHECK(!object->HasOwnProperty(v8_str("baz")));
-    CHECK(object->HasOwnProperty(v8_str("bla")));
+    Local<Object> object = value->ToObject(env.local()).ToLocalChecked();
+    CHECK(object->Has(env.local(), v8_str("foo")).FromJust());
+    CHECK(!object->HasOwnProperty(env.local(), v8_str("foo")).FromJust());
+    CHECK(object->HasOwnProperty(env.local(), v8_str("bar")).FromJust());
+    CHECK(object->Has(env.local(), v8_str("baz")).FromJust());
+    CHECK(!object->HasOwnProperty(env.local(), v8_str("baz")).FromJust());
+    CHECK(object->HasOwnProperty(env.local(), v8_str("bla")).FromJust());
   }
   { // Check named getter interceptors.
-    Handle<ObjectTemplate> templ = ObjectTemplate::New(isolate);
+    Local<ObjectTemplate> templ = ObjectTemplate::New(isolate);
     templ->SetHandler(v8::NamedPropertyHandlerConfiguration(
         HasOwnPropertyNamedPropertyGetter));
-    Handle<Object> instance = templ->NewInstance();
-    CHECK(!instance->HasOwnProperty(v8_str("42")));
-    CHECK(instance->HasOwnProperty(v8_str("foo")));
-    CHECK(!instance->HasOwnProperty(v8_str("bar")));
+    Local<Object> instance = templ->NewInstance(env.local()).ToLocalChecked();
+    CHECK(!instance->HasOwnProperty(env.local(), v8_str("42")).FromJust());
+    CHECK(instance->HasOwnProperty(env.local(), v8_str("foo")).FromJust());
+    CHECK(!instance->HasOwnProperty(env.local(), v8_str("bar")).FromJust());
   }
   { // Check indexed getter interceptors.
-    Handle<ObjectTemplate> templ = ObjectTemplate::New(isolate);
+    Local<ObjectTemplate> templ = ObjectTemplate::New(isolate);
     templ->SetHandler(v8::IndexedPropertyHandlerConfiguration(
         HasOwnPropertyIndexedPropertyGetter));
-    Handle<Object> instance = templ->NewInstance();
-    CHECK(instance->HasOwnProperty(v8_str("42")));
-    CHECK(!instance->HasOwnProperty(v8_str("43")));
-    CHECK(!instance->HasOwnProperty(v8_str("foo")));
+    Local<Object> instance = templ->NewInstance(env.local()).ToLocalChecked();
+    CHECK(instance->HasOwnProperty(env.local(), v8_str("42")).FromJust());
+    CHECK(!instance->HasOwnProperty(env.local(), v8_str("43")).FromJust());
+    CHECK(!instance->HasOwnProperty(env.local(), v8_str("foo")).FromJust());
   }
   { // Check named query interceptors.
-    Handle<ObjectTemplate> templ = ObjectTemplate::New(isolate);
+    Local<ObjectTemplate> templ = ObjectTemplate::New(isolate);
     templ->SetHandler(v8::NamedPropertyHandlerConfiguration(
         0, 0, HasOwnPropertyNamedPropertyQuery));
-    Handle<Object> instance = templ->NewInstance();
-    CHECK(instance->HasOwnProperty(v8_str("foo")));
-    CHECK(!instance->HasOwnProperty(v8_str("bar")));
+    Local<Object> instance = templ->NewInstance(env.local()).ToLocalChecked();
+    CHECK(instance->HasOwnProperty(env.local(), v8_str("foo")).FromJust());
+    CHECK(!instance->HasOwnProperty(env.local(), v8_str("bar")).FromJust());
   }
   { // Check indexed query interceptors.
-    Handle<ObjectTemplate> templ = ObjectTemplate::New(isolate);
+    Local<ObjectTemplate> templ = ObjectTemplate::New(isolate);
     templ->SetHandler(v8::IndexedPropertyHandlerConfiguration(
         0, 0, HasOwnPropertyIndexedPropertyQuery));
-    Handle<Object> instance = templ->NewInstance();
-    CHECK(instance->HasOwnProperty(v8_str("42")));
-    CHECK(!instance->HasOwnProperty(v8_str("41")));
+    Local<Object> instance = templ->NewInstance(env.local()).ToLocalChecked();
+    CHECK(instance->HasOwnProperty(env.local(), v8_str("42")).FromJust());
+    CHECK(!instance->HasOwnProperty(env.local(), v8_str("41")).FromJust());
   }
   { // Check callbacks.
-    Handle<ObjectTemplate> templ = ObjectTemplate::New(isolate);
+    Local<ObjectTemplate> templ = ObjectTemplate::New(isolate);
     templ->SetAccessor(v8_str("foo"), HasOwnPropertyAccessorGetter);
-    Handle<Object> instance = templ->NewInstance();
-    CHECK(instance->HasOwnProperty(v8_str("foo")));
-    CHECK(!instance->HasOwnProperty(v8_str("bar")));
+    Local<Object> instance = templ->NewInstance(env.local()).ToLocalChecked();
+    CHECK(instance->HasOwnProperty(env.local(), v8_str("foo")).FromJust());
+    CHECK(!instance->HasOwnProperty(env.local(), v8_str("bar")).FromJust());
   }
   { // Check that query wins on disagreement.
-    Handle<ObjectTemplate> templ = ObjectTemplate::New(isolate);
+    Local<ObjectTemplate> templ = ObjectTemplate::New(isolate);
     templ->SetHandler(v8::NamedPropertyHandlerConfiguration(
         HasOwnPropertyNamedPropertyGetter, 0,
         HasOwnPropertyNamedPropertyQuery2));
-    Handle<Object> instance = templ->NewInstance();
-    CHECK(!instance->HasOwnProperty(v8_str("foo")));
-    CHECK(instance->HasOwnProperty(v8_str("bar")));
+    Local<Object> instance = templ->NewInstance(env.local()).ToLocalChecked();
+    CHECK(!instance->HasOwnProperty(env.local(), v8_str("foo")).FromJust());
+    CHECK(instance->HasOwnProperty(env.local(), v8_str("bar")).FromJust());
   }
 }
 
@@ -21400,38 +19913,42 @@
 TEST(IndexedInterceptorWithStringProto) {
   v8::Isolate* isolate = CcTest::isolate();
   v8::HandleScope scope(isolate);
-  Handle<ObjectTemplate> templ = ObjectTemplate::New(isolate);
+  Local<ObjectTemplate> templ = ObjectTemplate::New(isolate);
   templ->SetHandler(v8::IndexedPropertyHandlerConfiguration(
       NULL, NULL, HasOwnPropertyIndexedPropertyQuery));
   LocalContext context;
-  context->Global()->Set(v8_str("obj"), templ->NewInstance());
+  CHECK(context->Global()
+            ->Set(context.local(), v8_str("obj"),
+                  templ->NewInstance(context.local()).ToLocalChecked())
+            .FromJust());
   CompileRun("var s = new String('foobar'); obj.__proto__ = s;");
   // These should be intercepted.
-  CHECK(CompileRun("42 in obj")->BooleanValue());
-  CHECK(CompileRun("'42' in obj")->BooleanValue());
+  CHECK(CompileRun("42 in obj")->BooleanValue(context.local()).FromJust());
+  CHECK(CompileRun("'42' in obj")->BooleanValue(context.local()).FromJust());
   // These should fall through to the String prototype.
-  CHECK(CompileRun("0 in obj")->BooleanValue());
-  CHECK(CompileRun("'0' in obj")->BooleanValue());
+  CHECK(CompileRun("0 in obj")->BooleanValue(context.local()).FromJust());
+  CHECK(CompileRun("'0' in obj")->BooleanValue(context.local()).FromJust());
   // And these should both fail.
-  CHECK(!CompileRun("32 in obj")->BooleanValue());
-  CHECK(!CompileRun("'32' in obj")->BooleanValue());
+  CHECK(!CompileRun("32 in obj")->BooleanValue(context.local()).FromJust());
+  CHECK(!CompileRun("'32' in obj")->BooleanValue(context.local()).FromJust());
 }
 
 
 void CheckCodeGenerationAllowed() {
-  Handle<Value> result = CompileRun("eval('42')");
-  CHECK_EQ(42, result->Int32Value());
+  Local<v8::Context> context = CcTest::isolate()->GetCurrentContext();
+  Local<Value> result = CompileRun("eval('42')");
+  CHECK_EQ(42, result->Int32Value(context).FromJust());
   result = CompileRun("(function(e) { return e('42'); })(eval)");
-  CHECK_EQ(42, result->Int32Value());
+  CHECK_EQ(42, result->Int32Value(context).FromJust());
   result = CompileRun("var f = new Function('return 42'); f()");
-  CHECK_EQ(42, result->Int32Value());
+  CHECK_EQ(42, result->Int32Value(context).FromJust());
 }
 
 
 void CheckCodeGenerationDisallowed() {
-  TryCatch try_catch;
+  TryCatch try_catch(CcTest::isolate());
 
-  Handle<Value> result = CompileRun("eval('42')");
+  Local<Value> result = CompileRun("eval('42')");
   CHECK(result.IsEmpty());
   CHECK(try_catch.HasCaught());
   try_catch.Reset();
@@ -21478,12 +19995,14 @@
 
   // Disallow but setting a global callback that will allow the calls.
   context->AllowCodeGenerationFromStrings(false);
-  V8::SetAllowCodeGenerationFromStringsCallback(&CodeGenerationAllowed);
+  context->GetIsolate()->SetAllowCodeGenerationFromStringsCallback(
+      &CodeGenerationAllowed);
   CHECK(!context->IsCodeGenerationFromStringsAllowed());
   CheckCodeGenerationAllowed();
 
   // Set a callback that disallows the code generation.
-  V8::SetAllowCodeGenerationFromStringsCallback(&CodeGenerationDisallowed);
+  context->GetIsolate()->SetAllowCodeGenerationFromStringsCallback(
+      &CodeGenerationDisallowed);
   CHECK(!context->IsCodeGenerationFromStringsAllowed());
   CheckCodeGenerationDisallowed();
 }
@@ -21492,18 +20011,19 @@
 TEST(SetErrorMessageForCodeGenFromStrings) {
   LocalContext context;
   v8::HandleScope scope(context->GetIsolate());
-  TryCatch try_catch;
+  TryCatch try_catch(context->GetIsolate());
 
-  Handle<String> message = v8_str("Message") ;
-  Handle<String> expected_message = v8_str("Uncaught EvalError: Message");
-  V8::SetAllowCodeGenerationFromStringsCallback(&CodeGenerationDisallowed);
+  Local<String> message = v8_str("Message");
+  Local<String> expected_message = v8_str("Uncaught EvalError: Message");
+  context->GetIsolate()->SetAllowCodeGenerationFromStringsCallback(
+      &CodeGenerationDisallowed);
   context->AllowCodeGenerationFromStrings(false);
   context->SetErrorMessageForCodeGenerationFromStrings(message);
-  Handle<Value> result = CompileRun("eval('42')");
+  Local<Value> result = CompileRun("eval('42')");
   CHECK(result.IsEmpty());
   CHECK(try_catch.HasCaught());
-  Handle<String> actual_message = try_catch.Message()->Get();
-  CHECK(expected_message->Equals(actual_message));
+  Local<String> actual_message = try_catch.Message()->Get();
+  CHECK(expected_message->Equals(context.local(), actual_message).FromJust());
 }
 
 
@@ -21515,11 +20035,14 @@
   LocalContext context;
   v8::Isolate* isolate = context->GetIsolate();
   v8::HandleScope scope(isolate);
-  Handle<FunctionTemplate> templ =
+  Local<FunctionTemplate> templ =
       v8::FunctionTemplate::New(isolate, NonObjectThis);
-  Handle<Function> function = templ->GetFunction();
-  context->Global()->Set(v8_str("f"), function);
-  TryCatch try_catch;
+  Local<Function> function =
+      templ->GetFunction(context.local()).ToLocalChecked();
+  CHECK(context->Global()
+            ->Set(context.local(), v8_str("f"), function)
+            .FromJust());
+  TryCatch try_catch(isolate);
   CompileRun("f.call(2)");
 }
 
@@ -21531,19 +20054,35 @@
   Local<ObjectTemplate> templ = ObjectTemplate::New(isolate);
 
   LocalContext context;
-  Local<v8::Object> obj = templ->NewInstance();
-  context->Global()->Set(v8_str("obj"), obj);
-  obj->ForceSet(v8_str("1"), v8_str("DONT_CHANGE"), v8::ReadOnly);
-  obj->Set(v8_str("1"), v8_str("foobar"));
-  CHECK_EQ(v8_str("DONT_CHANGE"), obj->Get(v8_str("1")));
-  obj->ForceSet(v8_num(2), v8_str("DONT_CHANGE"), v8::ReadOnly);
-  obj->Set(v8_num(2), v8_str("foobar"));
-  CHECK_EQ(v8_str("DONT_CHANGE"), obj->Get(v8_num(2)));
+  Local<v8::Object> obj = templ->NewInstance(context.local()).ToLocalChecked();
+  CHECK(context->Global()->Set(context.local(), v8_str("obj"), obj).FromJust());
+  obj->DefineOwnProperty(context.local(), v8_str("1"), v8_str("DONT_CHANGE"),
+                         v8::ReadOnly)
+      .FromJust();
+  obj->Set(context.local(), v8_str("1"), v8_str("foobar")).FromJust();
+  CHECK(v8_str("DONT_CHANGE")
+            ->Equals(context.local(),
+                     obj->Get(context.local(), v8_str("1")).ToLocalChecked())
+            .FromJust());
+  obj->DefineOwnProperty(context.local(), v8_str("2"), v8_str("DONT_CHANGE"),
+                         v8::ReadOnly)
+      .FromJust();
+  obj->Set(context.local(), v8_num(2), v8_str("foobar")).FromJust();
+  CHECK(v8_str("DONT_CHANGE")
+            ->Equals(context.local(),
+                     obj->Get(context.local(), v8_num(2)).ToLocalChecked())
+            .FromJust());
 
   // Test non-smi case.
-  obj->ForceSet(v8_str("2000000000"), v8_str("DONT_CHANGE"), v8::ReadOnly);
-  obj->Set(v8_str("2000000000"), v8_str("foobar"));
-  CHECK_EQ(v8_str("DONT_CHANGE"), obj->Get(v8_str("2000000000")));
+  obj->DefineOwnProperty(context.local(), v8_str("2000000000"),
+                         v8_str("DONT_CHANGE"), v8::ReadOnly)
+      .FromJust();
+  obj->Set(context.local(), v8_str("2000000000"), v8_str("foobar")).FromJust();
+  CHECK(v8_str("DONT_CHANGE")
+            ->Equals(context.local(),
+                     obj->Get(context.local(), v8_str("2000000000"))
+                         .ToLocalChecked())
+            .FromJust());
 }
 
 
@@ -21578,39 +20117,19 @@
   int elements = CountLiveMapsInMapCache(CcTest::i_isolate()->context());
   CHECK_LE(1, elements);
 
-  CcTest::heap()->CollectAllGarbage(i::Heap::kAbortIncrementalMarkingMask);
+  CcTest::heap()->CollectAllGarbage();
 
   CHECK_GT(elements, CountLiveMapsInMapCache(CcTest::i_isolate()->context()));
 }
 
 
-static bool BlockProtoNamedSecurityTestCallback(Local<v8::Object> global,
-                                                Local<Value> name,
-                                                v8::AccessType type,
-                                                Local<Value> data) {
-  // Only block read access to __proto__.
-  if (type == v8::ACCESS_GET && name->IsString() &&
-      name.As<v8::String>()->Length() == 9 &&
-      name.As<v8::String>()->Utf8Length() == 9) {
-    char buffer[10];
-    CHECK_EQ(10, name.As<v8::String>()->WriteUtf8(buffer));
-    return strncmp(buffer, "__proto__", 9) != 0;
-  }
-
-  return true;
-}
-
-
 THREADED_TEST(Regress93759) {
   v8::Isolate* isolate = CcTest::isolate();
   HandleScope scope(isolate);
 
   // Template for object with security check.
   Local<ObjectTemplate> no_proto_template = v8::ObjectTemplate::New(isolate);
-  // We don't do indexing, so any callback can be used for that.
-  no_proto_template->SetAccessCheckCallbacks(
-      BlockProtoNamedSecurityTestCallback,
-      IndexedSecurityTestCallback);
+  no_proto_template->SetAccessCheckCallback(AccessAlwaysBlocked);
 
   // Templates for objects with hidden prototypes and possibly security check.
   Local<FunctionTemplate> hidden_proto_template =
@@ -21619,9 +20138,8 @@
 
   Local<FunctionTemplate> protected_hidden_proto_template =
       v8::FunctionTemplate::New(isolate);
-  protected_hidden_proto_template->InstanceTemplate()->SetAccessCheckCallbacks(
-      BlockProtoNamedSecurityTestCallback,
-      IndexedSecurityTestCallback);
+  protected_hidden_proto_template->InstanceTemplate()->SetAccessCheckCallback(
+      AccessAlwaysBlocked);
   protected_hidden_proto_template->SetHiddenPrototype(true);
 
   // Context for "foreign" objects used in test.
@@ -21633,28 +20151,23 @@
 
   // Object with explicit security check.
   Local<Object> protected_object =
-      no_proto_template->NewInstance();
+      no_proto_template->NewInstance(context).ToLocalChecked();
 
   // JSGlobalProxy object, always have security check.
-  Local<Object> proxy_object =
-      context->Global();
+  Local<Object> proxy_object = context->Global();
 
   // Global object, the  prototype of proxy_object. No security checks.
-  Local<Object> global_object = proxy_object->GetPrototype()->ToObject(isolate);
+  Local<Object> global_object =
+      proxy_object->GetPrototype()->ToObject(context).ToLocalChecked();
 
   // Hidden prototype without security check.
-  Local<Object> hidden_prototype =
-      hidden_proto_template->GetFunction()->NewInstance();
+  Local<Object> hidden_prototype = hidden_proto_template->GetFunction(context)
+                                       .ToLocalChecked()
+                                       ->NewInstance(context)
+                                       .ToLocalChecked();
   Local<Object> object_with_hidden =
     Object::New(isolate);
-  object_with_hidden->SetPrototype(hidden_prototype);
-
-  // Hidden prototype with security check on the hidden prototype.
-  Local<Object> protected_hidden_prototype =
-      protected_hidden_proto_template->GetFunction()->NewInstance();
-  Local<Object> object_with_protected_hidden =
-    Object::New(isolate);
-  object_with_protected_hidden->SetPrototype(protected_hidden_prototype);
+  object_with_hidden->SetPrototype(context, hidden_prototype).FromJust();
 
   context->Exit();
 
@@ -21666,52 +20179,29 @@
   global_template->Set(v8_str("global"), global_object);
   global_template->Set(v8_str("proxy"), proxy_object);
   global_template->Set(v8_str("hidden"), object_with_hidden);
-  global_template->Set(v8_str("phidden"), object_with_protected_hidden);
 
   LocalContext context2(NULL, global_template);
 
   Local<Value> result1 = CompileRun("Object.getPrototypeOf(simple)");
-  CHECK(result1->Equals(simple_object->GetPrototype()));
+  CHECK(result1->Equals(context2.local(), simple_object->GetPrototype())
+            .FromJust());
 
   Local<Value> result2 = CompileRun("Object.getPrototypeOf(protected)");
-  CHECK(result2.IsEmpty());
+  CHECK(result2->IsNull());
 
   Local<Value> result3 = CompileRun("Object.getPrototypeOf(global)");
-  CHECK(result3->Equals(global_object->GetPrototype()));
+  CHECK(result3->Equals(context2.local(), global_object->GetPrototype())
+            .FromJust());
 
   Local<Value> result4 = CompileRun("Object.getPrototypeOf(proxy)");
-  CHECK(result4.IsEmpty());
+  CHECK(result4->IsNull());
 
   Local<Value> result5 = CompileRun("Object.getPrototypeOf(hidden)");
-  CHECK(result5->Equals(
-      object_with_hidden->GetPrototype()->ToObject(isolate)->GetPrototype()));
-
-  Local<Value> result6 = CompileRun("Object.getPrototypeOf(phidden)");
-  CHECK(result6.IsEmpty());
-}
-
-
-THREADED_TEST(Regress125988) {
-  v8::HandleScope scope(CcTest::isolate());
-  Handle<FunctionTemplate> intercept = FunctionTemplate::New(CcTest::isolate());
-  AddInterceptor(intercept, EmptyInterceptorGetter, EmptyInterceptorSetter);
-  LocalContext env;
-  env->Global()->Set(v8_str("Intercept"), intercept->GetFunction());
-  CompileRun("var a = new Object();"
-             "var b = new Intercept();"
-             "var c = new Object();"
-             "c.__proto__ = b;"
-             "b.__proto__ = a;"
-             "a.x = 23;"
-             "for (var i = 0; i < 3; i++) c.x;");
-  ExpectBoolean("c.hasOwnProperty('x')", false);
-  ExpectInt32("c.x", 23);
-  CompileRun("a.y = 42;"
-             "for (var i = 0; i < 3; i++) c.x;");
-  ExpectBoolean("c.hasOwnProperty('x')", false);
-  ExpectInt32("c.x", 23);
-  ExpectBoolean("c.hasOwnProperty('y')", false);
-  ExpectInt32("c.y", 42);
+  CHECK(result5->Equals(context2.local(), object_with_hidden->GetPrototype()
+                                              ->ToObject(context2.local())
+                                              .ToLocalChecked()
+                                              ->GetPrototype())
+            .FromJust());
 }
 
 
@@ -21719,9 +20209,16 @@
                          Local<Value> expected_receiver,
                          const char* code) {
   Local<Value> result = CompileRun(code);
+  Local<Context> context = CcTest::isolate()->GetCurrentContext();
   CHECK(result->IsObject());
-  CHECK(expected_receiver->Equals(result.As<v8::Object>()->Get(1)));
-  CHECK(expected_result->Equals(result.As<v8::Object>()->Get(0)));
+  CHECK(expected_receiver
+            ->Equals(context,
+                     result.As<v8::Object>()->Get(context, 1).ToLocalChecked())
+            .FromJust());
+  CHECK(expected_result
+            ->Equals(context,
+                     result.As<v8::Object>()->Get(context, 0).ToLocalChecked())
+            .FromJust());
 }
 
 
@@ -21770,11 +20267,19 @@
              "}"
              "var id = 'o';"
              "ownfunc");
-  context->Global()->Set(v8_str("func"), foreign_function);
+  CHECK(context->Global()
+            ->Set(context.local(), v8_str("func"), foreign_function)
+            .FromJust());
 
   // Sanity check the contexts.
-  CHECK(i->Equals(foreign_context->Global()->Get(id)));
-  CHECK(o->Equals(context->Global()->Get(id)));
+  CHECK(
+      i->Equals(
+           context.local(),
+           foreign_context->Global()->Get(context.local(), id).ToLocalChecked())
+          .FromJust());
+  CHECK(o->Equals(context.local(),
+                  context->Global()->Get(context.local(), id).ToLocalChecked())
+            .FromJust());
 
   // Checking local function's receiver.
   // Calling function using its call/apply methods.
@@ -21782,9 +20287,15 @@
   TestReceiver(o, context->Global(), "ownfunc.apply()");
   // Making calls through built-in functions.
   TestReceiver(o, context->Global(), "[1].map(ownfunc)[0]");
-  CHECK(o->Equals(CompileRun("'abcbd'.replace(/b/,ownfunc)[1]")));
-  CHECK(o->Equals(CompileRun("'abcbd'.replace(/b/g,ownfunc)[1]")));
-  CHECK(o->Equals(CompileRun("'abcbd'.replace(/b/g,ownfunc)[3]")));
+  CHECK(
+      o->Equals(context.local(), CompileRun("'abcbd'.replace(/b/,ownfunc)[1]"))
+          .FromJust());
+  CHECK(
+      o->Equals(context.local(), CompileRun("'abcbd'.replace(/b/g,ownfunc)[1]"))
+          .FromJust());
+  CHECK(
+      o->Equals(context.local(), CompileRun("'abcbd'.replace(/b/g,ownfunc)[3]"))
+          .FromJust());
   // Calling with environment record as base.
   TestReceiver(o, context->Global(), "ownfunc()");
   // Calling with no base.
@@ -21806,9 +20317,12 @@
   // Making calls through built-in functions.
   TestReceiver(i, foreign_context->Global(), "[1].map(func)[0]");
   // ToString(func()) is func()[0], i.e., the returned this.id.
-  CHECK(i->Equals(CompileRun("'abcbd'.replace(/b/,func)[1]")));
-  CHECK(i->Equals(CompileRun("'abcbd'.replace(/b/g,func)[1]")));
-  CHECK(i->Equals(CompileRun("'abcbd'.replace(/b/g,func)[3]")));
+  CHECK(i->Equals(context.local(), CompileRun("'abcbd'.replace(/b/,func)[1]"))
+            .FromJust());
+  CHECK(i->Equals(context.local(), CompileRun("'abcbd'.replace(/b/g,func)[1]"))
+            .FromJust());
+  CHECK(i->Equals(context.local(), CompileRun("'abcbd'.replace(/b/g,func)[3]"))
+            .FromJust());
 
   // Calling with environment record as base.
   TestReceiver(i, foreign_context->Global(), "func()");
@@ -21833,7 +20347,8 @@
 
 
 void RecursiveCall(const v8::FunctionCallbackInfo<v8::Value>& args) {
-  int32_t level = args[0]->Int32Value();
+  int32_t level =
+      args[0]->Int32Value(args.GetIsolate()->GetCurrentContext()).FromJust();
   if (level < 3) {
     level++;
     v8::base::OS::Print("Entering recursion level %d.\n", level);
@@ -21853,32 +20368,35 @@
 TEST(CallCompletedCallback) {
   LocalContext env;
   v8::HandleScope scope(env->GetIsolate());
-  v8::Handle<v8::FunctionTemplate> recursive_runtime =
+  v8::Local<v8::FunctionTemplate> recursive_runtime =
       v8::FunctionTemplate::New(env->GetIsolate(), RecursiveCall);
-  env->Global()->Set(v8_str("recursion"),
-                     recursive_runtime->GetFunction());
+  env->Global()
+      ->Set(env.local(), v8_str("recursion"),
+            recursive_runtime->GetFunction(env.local()).ToLocalChecked())
+      .FromJust();
   // Adding the same callback a second time has no effect.
   env->GetIsolate()->AddCallCompletedCallback(CallCompletedCallback1);
   env->GetIsolate()->AddCallCompletedCallback(CallCompletedCallback1);
   env->GetIsolate()->AddCallCompletedCallback(CallCompletedCallback2);
   v8::base::OS::Print("--- Script (1) ---\n");
-  Local<Script> script = v8::Script::Compile(
-      v8::String::NewFromUtf8(env->GetIsolate(), "recursion(0)"));
-  script->Run();
+  Local<Script> script =
+      v8::Script::Compile(env.local(), v8_str("recursion(0)")).ToLocalChecked();
+  script->Run(env.local()).ToLocalChecked();
   CHECK_EQ(3, callback_fired);
 
   v8::base::OS::Print("\n--- Script (2) ---\n");
   callback_fired = 0;
   env->GetIsolate()->RemoveCallCompletedCallback(CallCompletedCallback1);
-  script->Run();
+  script->Run(env.local()).ToLocalChecked();
   CHECK_EQ(2, callback_fired);
 
   v8::base::OS::Print("\n--- Function ---\n");
   callback_fired = 0;
-  Local<Function> recursive_function =
-      Local<Function>::Cast(env->Global()->Get(v8_str("recursion")));
-  v8::Handle<Value> args[] = { v8_num(0) };
-  recursive_function->Call(env->Global(), 1, args);
+  Local<Function> recursive_function = Local<Function>::Cast(
+      env->Global()->Get(env.local(), v8_str("recursion")).ToLocalChecked());
+  v8::Local<Value> args[] = {v8_num(0)};
+  recursive_function->Call(env.local(), env->Global(), 1, args)
+      .ToLocalChecked();
   CHECK_EQ(2, callback_fired);
 }
 
@@ -21938,50 +20456,50 @@
       "var ext1Calls = 0;"
       "var ext2Calls = 0;");
   CompileRun("1+1;");
-  CHECK_EQ(0, CompileRun("ext1Calls")->Int32Value());
-  CHECK_EQ(0, CompileRun("ext2Calls")->Int32Value());
+  CHECK_EQ(0, CompileRun("ext1Calls")->Int32Value(env.local()).FromJust());
+  CHECK_EQ(0, CompileRun("ext2Calls")->Int32Value(env.local()).FromJust());
 
   env->GetIsolate()->EnqueueMicrotask(
-      Function::New(env->GetIsolate(), MicrotaskOne));
+      Function::New(env.local(), MicrotaskOne).ToLocalChecked());
   CompileRun("1+1;");
-  CHECK_EQ(1, CompileRun("ext1Calls")->Int32Value());
-  CHECK_EQ(0, CompileRun("ext2Calls")->Int32Value());
+  CHECK_EQ(1, CompileRun("ext1Calls")->Int32Value(env.local()).FromJust());
+  CHECK_EQ(0, CompileRun("ext2Calls")->Int32Value(env.local()).FromJust());
 
   env->GetIsolate()->EnqueueMicrotask(
-      Function::New(env->GetIsolate(), MicrotaskOne));
+      Function::New(env.local(), MicrotaskOne).ToLocalChecked());
   env->GetIsolate()->EnqueueMicrotask(
-      Function::New(env->GetIsolate(), MicrotaskTwo));
+      Function::New(env.local(), MicrotaskTwo).ToLocalChecked());
   CompileRun("1+1;");
-  CHECK_EQ(2, CompileRun("ext1Calls")->Int32Value());
-  CHECK_EQ(1, CompileRun("ext2Calls")->Int32Value());
+  CHECK_EQ(2, CompileRun("ext1Calls")->Int32Value(env.local()).FromJust());
+  CHECK_EQ(1, CompileRun("ext2Calls")->Int32Value(env.local()).FromJust());
 
   env->GetIsolate()->EnqueueMicrotask(
-      Function::New(env->GetIsolate(), MicrotaskTwo));
+      Function::New(env.local(), MicrotaskTwo).ToLocalChecked());
   CompileRun("1+1;");
-  CHECK_EQ(2, CompileRun("ext1Calls")->Int32Value());
-  CHECK_EQ(2, CompileRun("ext2Calls")->Int32Value());
+  CHECK_EQ(2, CompileRun("ext1Calls")->Int32Value(env.local()).FromJust());
+  CHECK_EQ(2, CompileRun("ext2Calls")->Int32Value(env.local()).FromJust());
 
   CompileRun("1+1;");
-  CHECK_EQ(2, CompileRun("ext1Calls")->Int32Value());
-  CHECK_EQ(2, CompileRun("ext2Calls")->Int32Value());
+  CHECK_EQ(2, CompileRun("ext1Calls")->Int32Value(env.local()).FromJust());
+  CHECK_EQ(2, CompileRun("ext2Calls")->Int32Value(env.local()).FromJust());
 
   g_passed_to_three = NULL;
   env->GetIsolate()->EnqueueMicrotask(MicrotaskThree);
   CompileRun("1+1;");
-  CHECK_EQ(NULL, g_passed_to_three);
-  CHECK_EQ(2, CompileRun("ext1Calls")->Int32Value());
-  CHECK_EQ(2, CompileRun("ext2Calls")->Int32Value());
+  CHECK(!g_passed_to_three);
+  CHECK_EQ(2, CompileRun("ext1Calls")->Int32Value(env.local()).FromJust());
+  CHECK_EQ(2, CompileRun("ext2Calls")->Int32Value(env.local()).FromJust());
 
   int dummy;
   env->GetIsolate()->EnqueueMicrotask(
-      Function::New(env->GetIsolate(), MicrotaskOne));
+      Function::New(env.local(), MicrotaskOne).ToLocalChecked());
   env->GetIsolate()->EnqueueMicrotask(MicrotaskThree, &dummy);
   env->GetIsolate()->EnqueueMicrotask(
-      Function::New(env->GetIsolate(), MicrotaskTwo));
+      Function::New(env.local(), MicrotaskTwo).ToLocalChecked());
   CompileRun("1+1;");
   CHECK_EQ(&dummy, g_passed_to_three);
-  CHECK_EQ(3, CompileRun("ext1Calls")->Int32Value());
-  CHECK_EQ(3, CompileRun("ext2Calls")->Int32Value());
+  CHECK_EQ(3, CompileRun("ext1Calls")->Int32Value(env.local()).FromJust());
+  CHECK_EQ(3, CompileRun("ext2Calls")->Int32Value(env.local()).FromJust());
   g_passed_to_three = NULL;
 }
 
@@ -22012,14 +20530,16 @@
       "var exception1Calls = 0;"
       "var exception2Calls = 0;");
   isolate->EnqueueMicrotask(
-      Function::New(isolate, MicrotaskExceptionOne));
+      Function::New(env.local(), MicrotaskExceptionOne).ToLocalChecked());
   isolate->EnqueueMicrotask(
-      Function::New(isolate, MicrotaskExceptionTwo));
-  TryCatch try_catch;
+      Function::New(env.local(), MicrotaskExceptionTwo).ToLocalChecked());
+  TryCatch try_catch(isolate);
   CompileRun("1+1;");
   CHECK(!try_catch.HasCaught());
-  CHECK_EQ(1, CompileRun("exception1Calls")->Int32Value());
-  CHECK_EQ(1, CompileRun("exception2Calls")->Int32Value());
+  CHECK_EQ(1,
+           CompileRun("exception1Calls")->Int32Value(env.local()).FromJust());
+  CHECK_EQ(1,
+           CompileRun("exception2Calls")->Int32Value(env.local()).FromJust());
 }
 
 
@@ -22030,57 +20550,57 @@
       "var ext1Calls = 0;"
       "var ext2Calls = 0;");
   CompileRun("1+1;");
-  CHECK_EQ(0, CompileRun("ext1Calls")->Int32Value());
-  CHECK_EQ(0, CompileRun("ext2Calls")->Int32Value());
+  CHECK_EQ(0, CompileRun("ext1Calls")->Int32Value(env.local()).FromJust());
+  CHECK_EQ(0, CompileRun("ext2Calls")->Int32Value(env.local()).FromJust());
 
   env->GetIsolate()->EnqueueMicrotask(
-      Function::New(env->GetIsolate(), MicrotaskOne));
+      Function::New(env.local(), MicrotaskOne).ToLocalChecked());
   CompileRun("1+1;");
-  CHECK_EQ(1, CompileRun("ext1Calls")->Int32Value());
-  CHECK_EQ(0, CompileRun("ext2Calls")->Int32Value());
+  CHECK_EQ(1, CompileRun("ext1Calls")->Int32Value(env.local()).FromJust());
+  CHECK_EQ(0, CompileRun("ext2Calls")->Int32Value(env.local()).FromJust());
 
   env->GetIsolate()->SetAutorunMicrotasks(false);
   env->GetIsolate()->EnqueueMicrotask(
-      Function::New(env->GetIsolate(), MicrotaskOne));
+      Function::New(env.local(), MicrotaskOne).ToLocalChecked());
   env->GetIsolate()->EnqueueMicrotask(
-      Function::New(env->GetIsolate(), MicrotaskTwo));
+      Function::New(env.local(), MicrotaskTwo).ToLocalChecked());
   CompileRun("1+1;");
-  CHECK_EQ(1, CompileRun("ext1Calls")->Int32Value());
-  CHECK_EQ(0, CompileRun("ext2Calls")->Int32Value());
+  CHECK_EQ(1, CompileRun("ext1Calls")->Int32Value(env.local()).FromJust());
+  CHECK_EQ(0, CompileRun("ext2Calls")->Int32Value(env.local()).FromJust());
 
   env->GetIsolate()->RunMicrotasks();
-  CHECK_EQ(2, CompileRun("ext1Calls")->Int32Value());
-  CHECK_EQ(1, CompileRun("ext2Calls")->Int32Value());
+  CHECK_EQ(2, CompileRun("ext1Calls")->Int32Value(env.local()).FromJust());
+  CHECK_EQ(1, CompileRun("ext2Calls")->Int32Value(env.local()).FromJust());
 
   env->GetIsolate()->EnqueueMicrotask(
-      Function::New(env->GetIsolate(), MicrotaskTwo));
+      Function::New(env.local(), MicrotaskTwo).ToLocalChecked());
   CompileRun("1+1;");
-  CHECK_EQ(2, CompileRun("ext1Calls")->Int32Value());
-  CHECK_EQ(1, CompileRun("ext2Calls")->Int32Value());
+  CHECK_EQ(2, CompileRun("ext1Calls")->Int32Value(env.local()).FromJust());
+  CHECK_EQ(1, CompileRun("ext2Calls")->Int32Value(env.local()).FromJust());
 
   env->GetIsolate()->RunMicrotasks();
-  CHECK_EQ(2, CompileRun("ext1Calls")->Int32Value());
-  CHECK_EQ(2, CompileRun("ext2Calls")->Int32Value());
+  CHECK_EQ(2, CompileRun("ext1Calls")->Int32Value(env.local()).FromJust());
+  CHECK_EQ(2, CompileRun("ext2Calls")->Int32Value(env.local()).FromJust());
 
   env->GetIsolate()->SetAutorunMicrotasks(true);
   env->GetIsolate()->EnqueueMicrotask(
-      Function::New(env->GetIsolate(), MicrotaskTwo));
+      Function::New(env.local(), MicrotaskTwo).ToLocalChecked());
   CompileRun("1+1;");
-  CHECK_EQ(2, CompileRun("ext1Calls")->Int32Value());
-  CHECK_EQ(3, CompileRun("ext2Calls")->Int32Value());
+  CHECK_EQ(2, CompileRun("ext1Calls")->Int32Value(env.local()).FromJust());
+  CHECK_EQ(3, CompileRun("ext2Calls")->Int32Value(env.local()).FromJust());
 
   env->GetIsolate()->EnqueueMicrotask(
-      Function::New(env->GetIsolate(), MicrotaskTwo));
+      Function::New(env.local(), MicrotaskTwo).ToLocalChecked());
   {
     v8::Isolate::SuppressMicrotaskExecutionScope scope(env->GetIsolate());
     CompileRun("1+1;");
-    CHECK_EQ(2, CompileRun("ext1Calls")->Int32Value());
-    CHECK_EQ(3, CompileRun("ext2Calls")->Int32Value());
+    CHECK_EQ(2, CompileRun("ext1Calls")->Int32Value(env.local()).FromJust());
+    CHECK_EQ(3, CompileRun("ext2Calls")->Int32Value(env.local()).FromJust());
   }
 
   CompileRun("1+1;");
-  CHECK_EQ(2, CompileRun("ext1Calls")->Int32Value());
-  CHECK_EQ(4, CompileRun("ext2Calls")->Int32Value());
+  CHECK_EQ(2, CompileRun("ext1Calls")->Int32Value(env.local()).FromJust());
+  CHECK_EQ(4, CompileRun("ext2Calls")->Int32Value(env.local()).FromJust());
 }
 
 
@@ -22088,16 +20608,17 @@
   v8::Isolate* isolate = CcTest::isolate();
   HandleScope handle_scope(isolate);
   isolate->SetAutorunMicrotasks(false);
-  Handle<Context> context = Context::New(isolate);
+  Local<Context> context = Context::New(isolate);
   {
     Context::Scope context_scope(context);
     CompileRun("var ext1Calls = 0;");
-    isolate->EnqueueMicrotask(Function::New(isolate, MicrotaskOne));
+    isolate->EnqueueMicrotask(
+        Function::New(context, MicrotaskOne).ToLocalChecked());
   }
   isolate->RunMicrotasks();
   {
     Context::Scope context_scope(context);
-    CHECK_EQ(1, CompileRun("ext1Calls")->Int32Value());
+    CHECK_EQ(1, CompileRun("ext1Calls")->Int32Value(context).FromJust());
   }
   isolate->SetAutorunMicrotasks(true);
 }
@@ -22106,22 +20627,25 @@
 static void DebugEventInObserver(const v8::Debug::EventDetails& event_details) {
   v8::DebugEvent event = event_details.GetEvent();
   if (event != v8::Break) return;
-  Handle<Object> exec_state = event_details.GetExecutionState();
-  Handle<Value> break_id = exec_state->Get(v8_str("break_id"));
+  Local<Object> exec_state = event_details.GetExecutionState();
+  Local<Context> context = CcTest::isolate()->GetCurrentContext();
+  Local<Value> break_id =
+      exec_state->Get(context, v8_str("break_id")).ToLocalChecked();
   CompileRun("function f(id) { new FrameDetails(id, 0); }");
-  Handle<Function> fun =
-      Handle<Function>::Cast(CcTest::global()->Get(v8_str("f")));
-  fun->Call(CcTest::global(), 1, &break_id);
+  Local<Function> fun = Local<Function>::Cast(
+      CcTest::global()->Get(context, v8_str("f")).ToLocalChecked());
+  fun->Call(context, CcTest::global(), 1, &break_id).ToLocalChecked();
 }
 
 
 TEST(Regress385349) {
+  i::FLAG_harmony_object_observe = true;
   i::FLAG_allow_natives_syntax = true;
   v8::Isolate* isolate = CcTest::isolate();
   HandleScope handle_scope(isolate);
   isolate->SetAutorunMicrotasks(false);
-  Handle<Context> context = Context::New(isolate);
-  v8::Debug::SetDebugEventListener(DebugEventInObserver);
+  Local<Context> context = Context::New(isolate);
+  v8::Debug::SetDebugEventListener(isolate, DebugEventInObserver);
   {
     Context::Scope context_scope(context);
     CompileRun("var obj = {};"
@@ -22130,7 +20654,7 @@
   }
   isolate->RunMicrotasks();
   isolate->SetAutorunMicrotasks(true);
-  v8::Debug::SetDebugEventListener(NULL);
+  v8::Debug::SetDebugEventListener(isolate, nullptr);
 }
 
 
@@ -22255,12 +20779,14 @@
 
 UNINITIALIZED_TEST(IsolateEmbedderData) {
   CcTest::DisableAutomaticDispose();
-  v8::Isolate* isolate = v8::Isolate::New();
+  v8::Isolate::CreateParams create_params;
+  create_params.array_buffer_allocator = CcTest::array_buffer_allocator();
+  v8::Isolate* isolate = v8::Isolate::New(create_params);
   isolate->Enter();
   i::Isolate* i_isolate = reinterpret_cast<i::Isolate*>(isolate);
   for (uint32_t slot = 0; slot < v8::Isolate::GetNumberOfDataSlots(); ++slot) {
-    CHECK_EQ(NULL, isolate->GetData(slot));
-    CHECK_EQ(NULL, i_isolate->GetData(slot));
+    CHECK(!isolate->GetData(slot));
+    CHECK(!i_isolate->GetData(slot));
   }
   for (uint32_t slot = 0; slot < v8::Isolate::GetNumberOfDataSlots(); ++slot) {
     void* data = reinterpret_cast<void*>(0xacce55ed + slot);
@@ -22299,7 +20825,8 @@
 static void InstanceCheckedGetter(
     Local<String> name,
     const v8::PropertyCallbackInfo<v8::Value>& info) {
-  CHECK_EQ(name, v8_str("foo"));
+  CHECK(name->Equals(info.GetIsolate()->GetCurrentContext(), v8_str("foo"))
+            .FromJust());
   instance_checked_getter_count++;
   info.GetReturnValue().Set(v8_num(11));
 }
@@ -22309,8 +20836,10 @@
 static void InstanceCheckedSetter(Local<String> name,
                       Local<Value> value,
                       const v8::PropertyCallbackInfo<void>& info) {
-  CHECK_EQ(name, v8_str("foo"));
-  CHECK_EQ(value, v8_num(23));
+  CHECK(name->Equals(info.GetIsolate()->GetCurrentContext(), v8_str("foo"))
+            .FromJust());
+  CHECK(value->Equals(info.GetIsolate()->GetCurrentContext(), v8_num(23))
+            .FromJust());
   instance_checked_setter_count++;
 }
 
@@ -22334,7 +20863,7 @@
 static void CheckInstanceCheckedAccessors(bool expects_callbacks) {
   instance_checked_getter_count = 0;
   instance_checked_setter_count = 0;
-  TryCatch try_catch;
+  TryCatch try_catch(CcTest::isolate());
 
   // Test path through generic runtime code.
   CompileRun("obj.foo");
@@ -22381,27 +20910,38 @@
 
   Local<FunctionTemplate> templ = FunctionTemplate::New(context->GetIsolate());
   Local<ObjectTemplate> inst = templ->InstanceTemplate();
-  inst->SetAccessor(v8_str("foo"),
-                    InstanceCheckedGetter, InstanceCheckedSetter,
-                    Handle<Value>(),
-                    v8::DEFAULT,
-                    v8::None,
+  inst->SetAccessor(v8_str("foo"), InstanceCheckedGetter, InstanceCheckedSetter,
+                    Local<Value>(), v8::DEFAULT, v8::None,
                     v8::AccessorSignature::New(context->GetIsolate(), templ));
-  context->Global()->Set(v8_str("f"), templ->GetFunction());
+  CHECK(context->Global()
+            ->Set(context.local(), v8_str("f"),
+                  templ->GetFunction(context.local()).ToLocalChecked())
+            .FromJust());
 
   printf("Testing positive ...\n");
   CompileRun("var obj = new f();");
-  CHECK(templ->HasInstance(context->Global()->Get(v8_str("obj"))));
+  CHECK(templ->HasInstance(
+      context->Global()->Get(context.local(), v8_str("obj")).ToLocalChecked()));
   CheckInstanceCheckedAccessors(true);
 
   printf("Testing negative ...\n");
   CompileRun("var obj = {};"
              "obj.__proto__ = new f();");
-  CHECK(!templ->HasInstance(context->Global()->Get(v8_str("obj"))));
+  CHECK(!templ->HasInstance(
+      context->Global()->Get(context.local(), v8_str("obj")).ToLocalChecked()));
   CheckInstanceCheckedAccessors(false);
 }
 
 
+static void EmptyInterceptorGetter(
+    Local<String> name, const v8::PropertyCallbackInfo<v8::Value>& info) {}
+
+
+static void EmptyInterceptorSetter(
+    Local<String> name, Local<Value> value,
+    const v8::PropertyCallbackInfo<v8::Value>& info) {}
+
+
 THREADED_TEST(InstanceCheckOnInstanceAccessorWithInterceptor) {
   v8::internal::FLAG_allow_natives_syntax = true;
   LocalContext context;
@@ -22409,24 +20949,27 @@
 
   Local<FunctionTemplate> templ = FunctionTemplate::New(context->GetIsolate());
   Local<ObjectTemplate> inst = templ->InstanceTemplate();
-  AddInterceptor(templ, EmptyInterceptorGetter, EmptyInterceptorSetter);
-  inst->SetAccessor(v8_str("foo"),
-                    InstanceCheckedGetter, InstanceCheckedSetter,
-                    Handle<Value>(),
-                    v8::DEFAULT,
-                    v8::None,
+  templ->InstanceTemplate()->SetNamedPropertyHandler(EmptyInterceptorGetter,
+                                                     EmptyInterceptorSetter);
+  inst->SetAccessor(v8_str("foo"), InstanceCheckedGetter, InstanceCheckedSetter,
+                    Local<Value>(), v8::DEFAULT, v8::None,
                     v8::AccessorSignature::New(context->GetIsolate(), templ));
-  context->Global()->Set(v8_str("f"), templ->GetFunction());
+  CHECK(context->Global()
+            ->Set(context.local(), v8_str("f"),
+                  templ->GetFunction(context.local()).ToLocalChecked())
+            .FromJust());
 
   printf("Testing positive ...\n");
   CompileRun("var obj = new f();");
-  CHECK(templ->HasInstance(context->Global()->Get(v8_str("obj"))));
+  CHECK(templ->HasInstance(
+      context->Global()->Get(context.local(), v8_str("obj")).ToLocalChecked()));
   CheckInstanceCheckedAccessors(true);
 
   printf("Testing negative ...\n");
   CompileRun("var obj = {};"
              "obj.__proto__ = new f();");
-  CHECK(!templ->HasInstance(context->Global()->Get(v8_str("obj"))));
+  CHECK(!templ->HasInstance(
+      context->Global()->Get(context.local(), v8_str("obj")).ToLocalChecked()));
   CheckInstanceCheckedAccessors(false);
 }
 
@@ -22439,20 +20982,25 @@
   Local<FunctionTemplate> templ = FunctionTemplate::New(context->GetIsolate());
   Local<ObjectTemplate> proto = templ->PrototypeTemplate();
   proto->SetAccessor(v8_str("foo"), InstanceCheckedGetter,
-                     InstanceCheckedSetter, Handle<Value>(), v8::DEFAULT,
+                     InstanceCheckedSetter, Local<Value>(), v8::DEFAULT,
                      v8::None,
                      v8::AccessorSignature::New(context->GetIsolate(), templ));
-  context->Global()->Set(v8_str("f"), templ->GetFunction());
+  CHECK(context->Global()
+            ->Set(context.local(), v8_str("f"),
+                  templ->GetFunction(context.local()).ToLocalChecked())
+            .FromJust());
 
   printf("Testing positive ...\n");
   CompileRun("var obj = new f();");
-  CHECK(templ->HasInstance(context->Global()->Get(v8_str("obj"))));
+  CHECK(templ->HasInstance(
+      context->Global()->Get(context.local(), v8_str("obj")).ToLocalChecked()));
   CheckInstanceCheckedAccessors(true);
 
   printf("Testing negative ...\n");
   CompileRun("var obj = {};"
              "obj.__proto__ = new f();");
-  CHECK(!templ->HasInstance(context->Global()->Get(v8_str("obj"))));
+  CHECK(!templ->HasInstance(
+      context->Global()->Get(context.local(), v8_str("obj")).ToLocalChecked()));
   CheckInstanceCheckedAccessors(false);
 
   printf("Testing positive with modified prototype chain ...\n");
@@ -22460,7 +21008,8 @@
              "var pro = {};"
              "pro.__proto__ = obj.__proto__;"
              "obj.__proto__ = pro;");
-  CHECK(templ->HasInstance(context->Global()->Get(v8_str("obj"))));
+  CHECK(templ->HasInstance(
+      context->Global()->Get(context.local(), v8_str("obj")).ToLocalChecked()));
   CheckInstanceCheckedAccessors(true);
 }
 
@@ -22472,7 +21021,7 @@
     // Test that the original error message is not lost if there is a
     // recursive call into Javascript is done in the finally block, e.g. to
     // initialize an IC. (crbug.com/129171)
-    TryCatch try_catch;
+    TryCatch try_catch(context->GetIsolate());
     const char* trigger_ic =
         "try {                      \n"
         "  throw new Error('test'); \n"
@@ -22484,13 +21033,13 @@
     CHECK(try_catch.HasCaught());
     Local<Message> message = try_catch.Message();
     CHECK(!message.IsEmpty());
-    CHECK_EQ(2, message->GetLineNumber());
+    CHECK_EQ(2, message->GetLineNumber(context.local()).FromJust());
   }
 
   {
     // Test that the original exception message is indeed overwritten if
     // a new error is thrown in the finally block.
-    TryCatch try_catch;
+    TryCatch try_catch(context->GetIsolate());
     const char* throw_again =
         "try {                       \n"
         "  throw new Error('test');  \n"
@@ -22503,7 +21052,7 @@
     CHECK(try_catch.HasCaught());
     Local<Message> message = try_catch.Message();
     CHECK(!message.IsEmpty());
-    CHECK_EQ(6, message->GetLineNumber());
+    CHECK_EQ(6, message->GetLineNumber(context.local()).FromJust());
   }
 }
 
@@ -22522,7 +21071,10 @@
                        GetterWhichReturns42,
                        SetterWhichSetsYOnThisTo23);
   }
-  context->Global()->Set(v8_str("obj"), templ->NewInstance());
+  CHECK(context->Global()
+            ->Set(context.local(), v8_str("obj"),
+                  templ->NewInstance(context.local()).ToLocalChecked())
+            .FromJust());
 
   // Turn monomorphic on slow object with native accessor, then turn
   // polymorphic, finally optimize to create negative lookup and fail.
@@ -22548,10 +21100,16 @@
     CompileRun("result = obj.y;");
   }
   if (remove_accessor && !interceptor) {
-    CHECK(context->Global()->Get(v8_str("result"))->IsUndefined());
+    CHECK(context->Global()
+              ->Get(context.local(), v8_str("result"))
+              .ToLocalChecked()
+              ->IsUndefined());
   } else {
-    CHECK_EQ(do_store ? 23 : 42,
-             context->Global()->Get(v8_str("result"))->Int32Value());
+    CHECK_EQ(do_store ? 23 : 42, context->Global()
+                                     ->Get(context.local(), v8_str("result"))
+                                     .ToLocalChecked()
+                                     ->Int32Value(context.local())
+                                     .FromJust());
   }
 }
 
@@ -22575,7 +21133,10 @@
   templ->SetAccessor(v8_str("foo"),
                      GetterWhichReturns42,
                      SetterWhichSetsYOnThisTo23);
-  context->Global()->Set(v8_str("obj"), templ->NewInstance());
+  CHECK(context->Global()
+            ->Set(context.local(), v8_str("obj"),
+                  templ->NewInstance(context.local()).ToLocalChecked())
+            .FromJust());
 
   // Turn monomorphic on slow object with native accessor, then just
   // delete the property and fail.
@@ -22626,12 +21187,30 @@
              "store2(subobj);"
              "var y_from_obj = obj.y;"
              "var y_from_subobj = subobj.y;");
-  CHECK(context->Global()->Get(v8_str("load_result"))->IsUndefined());
-  CHECK(context->Global()->Get(v8_str("load_result2"))->IsUndefined());
-  CHECK(context->Global()->Get(v8_str("keyed_load_result"))->IsUndefined());
-  CHECK(context->Global()->Get(v8_str("keyed_load_result2"))->IsUndefined());
-  CHECK(context->Global()->Get(v8_str("y_from_obj"))->IsUndefined());
-  CHECK(context->Global()->Get(v8_str("y_from_subobj"))->IsUndefined());
+  CHECK(context->Global()
+            ->Get(context.local(), v8_str("load_result"))
+            .ToLocalChecked()
+            ->IsUndefined());
+  CHECK(context->Global()
+            ->Get(context.local(), v8_str("load_result2"))
+            .ToLocalChecked()
+            ->IsUndefined());
+  CHECK(context->Global()
+            ->Get(context.local(), v8_str("keyed_load_result"))
+            .ToLocalChecked()
+            ->IsUndefined());
+  CHECK(context->Global()
+            ->Get(context.local(), v8_str("keyed_load_result2"))
+            .ToLocalChecked()
+            ->IsUndefined());
+  CHECK(context->Global()
+            ->Get(context.local(), v8_str("y_from_obj"))
+            .ToLocalChecked()
+            ->IsUndefined());
+  CHECK(context->Global()
+            ->Get(context.local(), v8_str("y_from_subobj"))
+            .ToLocalChecked()
+            ->IsUndefined());
 }
 
 
@@ -22644,7 +21223,10 @@
   templ->SetAccessor(v8_str("foo"),
                      GetterWhichReturns42,
                      SetterWhichSetsYOnThisTo23);
-  context->Global()->Set(v8_str("obj"), templ->NewInstance());
+  CHECK(context->Global()
+            ->Set(context.local(), v8_str("obj"),
+                  templ->NewInstance(context.local()).ToLocalChecked())
+            .FromJust());
 
   CompileRun("function load(x) { return x.foo; }"
              "var o = Object.create(obj);"
@@ -22653,23 +21235,6 @@
 }
 
 
-THREADED_TEST(Regress3337) {
-  LocalContext context;
-  v8::Isolate* isolate = context->GetIsolate();
-  v8::HandleScope scope(isolate);
-  Local<v8::Object> o1 = Object::New(isolate);
-  Local<v8::Object> o2 = Object::New(isolate);
-  i::Handle<i::JSObject> io1 = v8::Utils::OpenHandle(*o1);
-  i::Handle<i::JSObject> io2 = v8::Utils::OpenHandle(*o2);
-  CHECK(io1->map() == io2->map());
-  o1->SetIndexedPropertiesToExternalArrayData(
-      NULL, v8::kExternalUint32Array, 0);
-  o2->SetIndexedPropertiesToExternalArrayData(
-      NULL, v8::kExternalUint32Array, 0);
-  CHECK(io1->map() == io2->map());
-}
-
-
 THREADED_TEST(Regress137496) {
   i::FLAG_expose_gc = true;
   LocalContext context;
@@ -22677,31 +21242,23 @@
 
   // Compile a try-finally clause where the finally block causes a GC
   // while there still is a message pending for external reporting.
-  TryCatch try_catch;
+  TryCatch try_catch(context->GetIsolate());
   try_catch.SetVerbose(true);
   CompileRun("try { throw new Error(); } finally { gc(); }");
   CHECK(try_catch.HasCaught());
 }
 
 
-THREADED_TEST(Regress149912) {
-  LocalContext context;
-  v8::HandleScope scope(context->GetIsolate());
-  Handle<FunctionTemplate> templ = FunctionTemplate::New(context->GetIsolate());
-  AddInterceptor(templ, EmptyInterceptorGetter, EmptyInterceptorSetter);
-  context->Global()->Set(v8_str("Bug"), templ->GetFunction());
-  CompileRun("Number.prototype.__proto__ = new Bug; var x = 0; x.foo();");
-}
-
-
 THREADED_TEST(Regress157124) {
   LocalContext context;
   v8::Isolate* isolate = context->GetIsolate();
   v8::HandleScope scope(isolate);
   Local<ObjectTemplate> templ = ObjectTemplate::New(isolate);
-  Local<Object> obj = templ->NewInstance();
+  Local<Object> obj = templ->NewInstance(context.local()).ToLocalChecked();
   obj->GetIdentityHash();
-  obj->DeleteHiddenValue(v8_str("Bug"));
+  obj->DeletePrivate(context.local(),
+                     v8::Private::ForApi(isolate, v8_str("Bug")))
+      .FromJust();
 }
 
 
@@ -22722,9 +21279,10 @@
   v8::Isolate* isolate = context->GetIsolate();
   v8::HandleScope scope(isolate);
   Local<Object> obj = Object::New(isolate);
-  Local<String> key = String::NewFromUtf8(context->GetIsolate(), "key");
-  obj->SetHiddenValue(key, v8::Undefined(isolate));
-  Local<Value> value = obj->GetHiddenValue(key);
+  Local<v8::Private> key = v8::Private::New(isolate, v8_str("key"));
+  CHECK(
+      obj->SetPrivate(context.local(), key, v8::Undefined(isolate)).FromJust());
+  Local<Value> value = obj->GetPrivate(context.local(), key).ToLocalChecked();
   CHECK(!value.IsEmpty());
   CHECK(value->IsUndefined());
 }
@@ -22737,7 +21295,8 @@
   Local<FunctionTemplate> templ = FunctionTemplate::New(isolate,
                                                         DummyCallHandler);
   CompileRun("for (var i = 0; i < 128; i++) Object.prototype[i] = 0;");
-  Local<Function> function = templ->GetFunction();
+  Local<Function> function =
+      templ->GetFunction(context.local()).ToLocalChecked();
   CHECK(!function.IsEmpty());
   CHECK(function->IsFunction());
 }
@@ -22746,9 +21305,11 @@
 THREADED_TEST(JSONParseObject) {
   LocalContext context;
   HandleScope scope(context->GetIsolate());
-  Local<Value> obj = v8::JSON::Parse(v8_str("{\"x\":42}"));
-  Handle<Object> global = context->Global();
-  global->Set(v8_str("obj"), obj);
+  Local<Value> obj =
+      v8::JSON::Parse(context->GetIsolate(), v8_str("{\"x\":42}"))
+          .ToLocalChecked();
+  Local<Object> global = context->Global();
+  global->Set(context.local(), v8_str("obj"), obj).FromJust();
   ExpectString("JSON.stringify(obj)", "{\"x\":42}");
 }
 
@@ -22756,9 +21317,10 @@
 THREADED_TEST(JSONParseNumber) {
   LocalContext context;
   HandleScope scope(context->GetIsolate());
-  Local<Value> obj = v8::JSON::Parse(v8_str("42"));
-  Handle<Object> global = context->Global();
-  global->Set(v8_str("obj"), obj);
+  Local<Value> obj =
+      v8::JSON::Parse(context->GetIsolate(), v8_str("42")).ToLocalChecked();
+  Local<Object> global = context->Global();
+  global->Set(context.local(), v8_str("obj"), obj).FromJust();
   ExpectString("JSON.stringify(obj)", "42");
 }
 
@@ -22789,7 +21351,7 @@
       struct sigaction action;
 
       // Ensure that we'll enter waiting condition
-      v8::base::OS::Sleep(100);
+      v8::base::OS::Sleep(v8::base::TimeDelta::FromMilliseconds(100));
 
       // Setup signal handler
       memset(&action, 0, sizeof(action));
@@ -22800,7 +21362,7 @@
       kill(getpid(), SIGCHLD);
 
       // Ensure that if wait has returned because of error
-      v8::base::OS::Sleep(100);
+      v8::base::OS::Sleep(v8::base::TimeDelta::FromMilliseconds(100));
 
       // Set value and signal semaphore
       test_->sem_value_ = 1;
@@ -22827,24 +21389,6 @@
 #endif  // V8_OS_POSIX
 
 
-static bool NamedAccessAlwaysBlocked(Local<v8::Object> global,
-                                     Local<Value> name,
-                                     v8::AccessType type,
-                                     Local<Value> data) {
-  i::PrintF("Named access blocked.\n");
-  return false;
-}
-
-
-static bool IndexAccessAlwaysBlocked(Local<v8::Object> global,
-                                     uint32_t key,
-                                     v8::AccessType type,
-                                     Local<Value> data) {
-  i::PrintF("Indexed access blocked.\n");
-  return false;
-}
-
-
 void UnreachableCallback(const v8::FunctionCallbackInfo<v8::Value>& args) {
   CHECK(false);
 }
@@ -22857,43 +21401,36 @@
 
   // Create an ObjectTemplate for global objects and install access
   // check callbacks that will block access.
-  v8::Handle<v8::ObjectTemplate> global_template =
+  v8::Local<v8::ObjectTemplate> global_template =
       v8::ObjectTemplate::New(isolate);
-  global_template->SetAccessCheckCallbacks(NamedAccessAlwaysBlocked,
-                                           IndexAccessAlwaysBlocked);
+  global_template->SetAccessCheckCallback(AccessAlwaysBlocked);
 
   // Create a context and set an x property on it's global object.
   LocalContext context0(NULL, global_template);
-  v8::Handle<v8::Object> global0 = context0->Global();
-  global0->Set(v8_str("x"), v8_num(42));
+  v8::Local<v8::Object> global0 = context0->Global();
+  global0->Set(context0.local(), v8_str("x"), v8_num(42)).FromJust();
   ExpectString("JSON.stringify(this)", "{\"x\":42}");
 
   for (int i = 0; i < 2; i++) {
     if (i == 1) {
       // Install a toJSON function on the second run.
-      v8::Handle<v8::FunctionTemplate> toJSON =
+      v8::Local<v8::FunctionTemplate> toJSON =
           v8::FunctionTemplate::New(isolate, UnreachableCallback);
 
-      global0->Set(v8_str("toJSON"), toJSON->GetFunction());
+      global0->Set(context0.local(), v8_str("toJSON"),
+                   toJSON->GetFunction(context0.local()).ToLocalChecked())
+          .FromJust();
     }
     // Create a context with a different security token so that the
     // failed access check callback will be called on each access.
     LocalContext context1(NULL, global_template);
-    context1->Global()->Set(v8_str("other"), global0);
+    CHECK(context1->Global()
+              ->Set(context1.local(), v8_str("other"), global0)
+              .FromJust());
 
     CHECK(CompileRun("JSON.stringify(other)").IsEmpty());
     CHECK(CompileRun("JSON.stringify({ 'a' : other, 'b' : ['c'] })").IsEmpty());
     CHECK(CompileRun("JSON.stringify([other, 'b', 'c'])").IsEmpty());
-
-    v8::Handle<v8::Array> array = v8::Array::New(isolate, 2);
-    array->Set(0, v8_str("a"));
-    array->Set(1, v8_str("b"));
-    context1->Global()->Set(v8_str("array"), array);
-    ExpectString("JSON.stringify(array)", "[\"a\",\"b\"]");
-    array->TurnOnAccessCheck();
-    CHECK(CompileRun("JSON.stringify(array)").IsEmpty());
-    CHECK(CompileRun("JSON.stringify([array])").IsEmpty());
-    CHECK(CompileRun("JSON.stringify({'a' : array})").IsEmpty());
   }
 }
 
@@ -22922,8 +21459,13 @@
 
 
 void HasOwnPropertyCallback(const v8::FunctionCallbackInfo<v8::Value>& args) {
-  args[0]->ToObject(args.GetIsolate())->HasOwnProperty(
-      args[1]->ToString(args.GetIsolate()));
+  v8::Local<v8::Context> context = args.GetIsolate()->GetCurrentContext();
+  CHECK(
+      args[0]
+          ->ToObject(context)
+          .ToLocalChecked()
+          ->HasOwnProperty(context, args[1]->ToString(context).ToLocalChecked())
+          .IsNothing());
 }
 
 
@@ -22950,36 +21492,44 @@
 TEST(AccessCheckThrows) {
   i::FLAG_allow_natives_syntax = true;
   v8::V8::Initialize();
-  v8::V8::SetFailedAccessCheckCallbackFunction(&FailedAccessCheckThrows);
   v8::Isolate* isolate = CcTest::isolate();
+  isolate->SetFailedAccessCheckCallbackFunction(&FailedAccessCheckThrows);
   v8::HandleScope scope(isolate);
 
   // Create an ObjectTemplate for global objects and install access
   // check callbacks that will block access.
-  v8::Handle<v8::ObjectTemplate> global_template =
+  v8::Local<v8::ObjectTemplate> global_template =
       v8::ObjectTemplate::New(isolate);
-  global_template->SetAccessCheckCallbacks(NamedAccessAlwaysBlocked,
-                                           IndexAccessAlwaysBlocked);
+  global_template->SetAccessCheckCallback(AccessAlwaysBlocked);
 
   // Create a context and set an x property on it's global object.
   LocalContext context0(NULL, global_template);
-  v8::Handle<v8::Object> global0 = context0->Global();
+  v8::Local<v8::Object> global0 = context0->Global();
 
   // Create a context with a different security token so that the
   // failed access check callback will be called on each access.
   LocalContext context1(NULL, global_template);
-  context1->Global()->Set(v8_str("other"), global0);
+  CHECK(context1->Global()
+            ->Set(context1.local(), v8_str("other"), global0)
+            .FromJust());
 
-  v8::Handle<v8::FunctionTemplate> catcher_fun =
+  v8::Local<v8::FunctionTemplate> catcher_fun =
       v8::FunctionTemplate::New(isolate, CatcherCallback);
-  context1->Global()->Set(v8_str("catcher"), catcher_fun->GetFunction());
+  CHECK(context1->Global()
+            ->Set(context1.local(), v8_str("catcher"),
+                  catcher_fun->GetFunction(context1.local()).ToLocalChecked())
+            .FromJust());
 
-  v8::Handle<v8::FunctionTemplate> has_own_property_fun =
+  v8::Local<v8::FunctionTemplate> has_own_property_fun =
       v8::FunctionTemplate::New(isolate, HasOwnPropertyCallback);
-  context1->Global()->Set(v8_str("has_own_property"),
-                          has_own_property_fun->GetFunction());
+  CHECK(context1->Global()
+            ->Set(context1.local(), v8_str("has_own_property"),
+                  has_own_property_fun->GetFunction(context1.local())
+                      .ToLocalChecked())
+            .FromJust());
 
-  { v8::TryCatch try_catch;
+  {
+    v8::TryCatch try_catch(isolate);
     access_check_fail_thrown = false;
     CompileRun("other.x;");
     CHECK(access_check_fail_thrown);
@@ -22993,126 +21543,20 @@
   CheckCorrectThrow("%GetProperty(other, 'x')");
   CheckCorrectThrow("%SetProperty(other, 'x', 'foo', 0)");
   CheckCorrectThrow("%AddNamedProperty(other, 'x', 'foo', 1)");
-  CheckCorrectThrow("%DeleteProperty(other, 'x', 0)");
-  CheckCorrectThrow("%DeleteProperty(other, '1', 0)");
+  CheckCorrectThrow("%DeleteProperty_Sloppy(other, 'x')");
+  CheckCorrectThrow("%DeleteProperty_Strict(other, 'x')");
+  CheckCorrectThrow("%DeleteProperty_Sloppy(other, '1')");
+  CheckCorrectThrow("%DeleteProperty_Strict(other, '1')");
   CheckCorrectThrow("%HasOwnProperty(other, 'x')");
-  CheckCorrectThrow("%HasProperty(other, 'x')");
-  CheckCorrectThrow("%HasElement(other, 1)");
-  CheckCorrectThrow("%IsPropertyEnumerable(other, 'x')");
-  CheckCorrectThrow("%GetPropertyNames(other)");
+  CheckCorrectThrow("%HasProperty('x', other)");
+  CheckCorrectThrow("%PropertyIsEnumerable(other, 'x')");
   // PROPERTY_ATTRIBUTES_NONE = 0
-  CheckCorrectThrow("%GetOwnPropertyNames(other, 0)");
   CheckCorrectThrow("%DefineAccessorPropertyUnchecked("
                         "other, 'x', null, null, 1)");
 
   // Reset the failed access check callback so it does not influence
   // the other tests.
-  v8::V8::SetFailedAccessCheckCallbackFunction(NULL);
-}
-
-
-THREADED_TEST(Regress256330) {
-  i::FLAG_allow_natives_syntax = true;
-  LocalContext context;
-  v8::HandleScope scope(context->GetIsolate());
-  Handle<FunctionTemplate> templ = FunctionTemplate::New(context->GetIsolate());
-  AddInterceptor(templ, EmptyInterceptorGetter, EmptyInterceptorSetter);
-  context->Global()->Set(v8_str("Bug"), templ->GetFunction());
-  CompileRun("\"use strict\"; var o = new Bug;"
-             "function f(o) { o.x = 10; };"
-             "f(o); f(o); f(o);"
-             "%OptimizeFunctionOnNextCall(f);"
-             "f(o);");
-  ExpectBoolean("%GetOptimizationStatus(f) != 2", true);
-}
-
-
-THREADED_TEST(CrankshaftInterceptorSetter) {
-  i::FLAG_allow_natives_syntax = true;
-  v8::HandleScope scope(CcTest::isolate());
-  Handle<FunctionTemplate> templ = FunctionTemplate::New(CcTest::isolate());
-  AddInterceptor(templ, InterceptorGetter, InterceptorSetter);
-  LocalContext env;
-  env->Global()->Set(v8_str("Obj"), templ->GetFunction());
-  CompileRun("var obj = new Obj;"
-             // Initialize fields to avoid transitions later.
-             "obj.age = 0;"
-             "obj.accessor_age = 42;"
-             "function setter(i) { this.accessor_age = i; };"
-             "function getter() { return this.accessor_age; };"
-             "function setAge(i) { obj.age = i; };"
-             "Object.defineProperty(obj, 'age', { get:getter, set:setter });"
-             "setAge(1);"
-             "setAge(2);"
-             "setAge(3);"
-             "%OptimizeFunctionOnNextCall(setAge);"
-             "setAge(4);");
-  // All stores went through the interceptor.
-  ExpectInt32("obj.interceptor_age", 4);
-  ExpectInt32("obj.accessor_age", 42);
-}
-
-
-THREADED_TEST(CrankshaftInterceptorGetter) {
-  i::FLAG_allow_natives_syntax = true;
-  v8::HandleScope scope(CcTest::isolate());
-  Handle<FunctionTemplate> templ = FunctionTemplate::New(CcTest::isolate());
-  AddInterceptor(templ, InterceptorGetter, InterceptorSetter);
-  LocalContext env;
-  env->Global()->Set(v8_str("Obj"), templ->GetFunction());
-  CompileRun("var obj = new Obj;"
-             // Initialize fields to avoid transitions later.
-             "obj.age = 1;"
-             "obj.accessor_age = 42;"
-             "function getter() { return this.accessor_age; };"
-             "function getAge() { return obj.interceptor_age; };"
-             "Object.defineProperty(obj, 'interceptor_age', { get:getter });"
-             "getAge();"
-             "getAge();"
-             "getAge();"
-             "%OptimizeFunctionOnNextCall(getAge);");
-  // Access through interceptor.
-  ExpectInt32("getAge()", 1);
-}
-
-
-THREADED_TEST(CrankshaftInterceptorFieldRead) {
-  i::FLAG_allow_natives_syntax = true;
-  v8::HandleScope scope(CcTest::isolate());
-  Handle<FunctionTemplate> templ = FunctionTemplate::New(CcTest::isolate());
-  AddInterceptor(templ, InterceptorGetter, InterceptorSetter);
-  LocalContext env;
-  env->Global()->Set(v8_str("Obj"), templ->GetFunction());
-  CompileRun("var obj = new Obj;"
-             "obj.__proto__.interceptor_age = 42;"
-             "obj.age = 100;"
-             "function getAge() { return obj.interceptor_age; };");
-  ExpectInt32("getAge();", 100);
-  ExpectInt32("getAge();", 100);
-  ExpectInt32("getAge();", 100);
-  CompileRun("%OptimizeFunctionOnNextCall(getAge);");
-  // Access through interceptor.
-  ExpectInt32("getAge();", 100);
-}
-
-
-THREADED_TEST(CrankshaftInterceptorFieldWrite) {
-  i::FLAG_allow_natives_syntax = true;
-  v8::HandleScope scope(CcTest::isolate());
-  Handle<FunctionTemplate> templ = FunctionTemplate::New(CcTest::isolate());
-  AddInterceptor(templ, InterceptorGetter, InterceptorSetter);
-  LocalContext env;
-  env->Global()->Set(v8_str("Obj"), templ->GetFunction());
-  CompileRun("var obj = new Obj;"
-             "obj.age = 100000;"
-             "function setAge(i) { obj.age = i };"
-             "setAge(100);"
-             "setAge(101);"
-             "setAge(102);"
-             "%OptimizeFunctionOnNextCall(setAge);"
-             "setAge(103);");
-  ExpectInt32("obj.age", 100000);
-  ExpectInt32("obj.interceptor_age", 103);
+  isolate->SetFailedAccessCheckCallbackFunction(NULL);
 }
 
 
@@ -23213,9 +21657,12 @@
     : public RequestInterruptTestBaseWithSimpleInterrupt {
  public:
   virtual void TestBody() {
-    Local<Function> func = Function::New(
-        isolate_, ShouldContinueCallback, v8::External::New(isolate_, this));
-    env_->Global()->Set(v8_str("ShouldContinue"), func);
+    Local<Function> func = Function::New(env_.local(), ShouldContinueCallback,
+                                         v8::External::New(isolate_, this))
+                               .ToLocalChecked();
+    CHECK(env_->Global()
+              ->Set(env_.local(), v8_str("ShouldContinue"), func)
+              .FromJust());
 
     CompileRun("while (ShouldContinue()) { }");
   }
@@ -23228,9 +21675,14 @@
   virtual void TestBody() {
     v8::Local<v8::FunctionTemplate> t = v8::FunctionTemplate::New(isolate_);
     v8::Local<v8::Template> proto = t->PrototypeTemplate();
-    proto->Set(v8_str("shouldContinue"), Function::New(
-        isolate_, ShouldContinueCallback, v8::External::New(isolate_, this)));
-    env_->Global()->Set(v8_str("Klass"), t->GetFunction());
+    proto->Set(v8_str("shouldContinue"),
+               Function::New(env_.local(), ShouldContinueCallback,
+                             v8::External::New(isolate_, this))
+                   .ToLocalChecked());
+    CHECK(env_->Global()
+              ->Set(env_.local(), v8_str("Klass"),
+                    t->GetFunction(env_.local()).ToLocalChecked())
+              .FromJust());
 
     CompileRun("var obj = new Klass; while (obj.shouldContinue()) { }");
   }
@@ -23245,7 +21697,10 @@
     v8::Local<v8::Template> proto = t->PrototypeTemplate();
     proto->SetAccessorProperty(v8_str("shouldContinue"), FunctionTemplate::New(
         isolate_, ShouldContinueCallback, v8::External::New(isolate_, this)));
-    env_->Global()->Set(v8_str("Klass"), t->GetFunction());
+    CHECK(env_->Global()
+              ->Set(env_.local(), v8_str("Klass"),
+                    t->GetFunction(env_.local()).ToLocalChecked())
+              .FromJust());
 
     CompileRun("var obj = new Klass; while (obj.shouldContinue) { }");
   }
@@ -23262,7 +21717,10 @@
         &ShouldContinueNativeGetter,
         NULL,
         v8::External::New(isolate_, this));
-    env_->Global()->Set(v8_str("Klass"), t->GetFunction());
+    CHECK(env_->Global()
+              ->Set(env_.local(), v8_str("Klass"),
+                    t->GetFunction(env_.local()).ToLocalChecked())
+              .FromJust());
 
     CompileRun("var obj = new Klass; while (obj.shouldContinue) { }");
   }
@@ -23285,13 +21743,18 @@
   virtual void TestBody() {
     v8::Local<v8::FunctionTemplate> t = v8::FunctionTemplate::New(isolate_);
     v8::Local<v8::Template> proto = t->PrototypeTemplate();
-    proto->Set(v8_str("shouldContinue"), Function::New(
-        isolate_, ShouldContinueCallback, v8::External::New(isolate_, this)));
+    proto->Set(v8_str("shouldContinue"),
+               Function::New(env_.local(), ShouldContinueCallback,
+                             v8::External::New(isolate_, this))
+                   .ToLocalChecked());
     v8::Local<v8::ObjectTemplate> instance_template = t->InstanceTemplate();
     instance_template->SetHandler(
         v8::NamedPropertyHandlerConfiguration(EmptyInterceptor));
 
-    env_->Global()->Set(v8_str("Klass"), t->GetFunction());
+    CHECK(env_->Global()
+              ->Set(env_.local(), v8_str("Klass"),
+                    t->GetFunction(env_.local()).ToLocalChecked())
+              .FromJust());
 
     CompileRun("var obj = new Klass; while (obj.shouldContinue()) { }");
   }
@@ -23306,15 +21769,19 @@
     : public RequestInterruptTestBaseWithSimpleInterrupt {
  public:
   virtual void TestBody() {
-    env_->Global()->Set(v8_str("WakeUpInterruptor"), Function::New(
-        isolate_,
-        WakeUpInterruptorCallback,
-        v8::External::New(isolate_, this)));
+    env_->Global()
+        ->Set(env_.local(), v8_str("WakeUpInterruptor"),
+              Function::New(env_.local(), WakeUpInterruptorCallback,
+                            v8::External::New(isolate_, this))
+                  .ToLocalChecked())
+        .FromJust();
 
-    env_->Global()->Set(v8_str("ShouldContinue"), Function::New(
-        isolate_,
-        ShouldContinueCallback,
-        v8::External::New(isolate_, this)));
+    env_->Global()
+        ->Set(env_.local(), v8_str("ShouldContinue"),
+              Function::New(env_.local(), ShouldContinueCallback,
+                            v8::External::New(isolate_, this))
+                  .ToLocalChecked())
+        .FromJust();
 
     i::FLAG_allow_natives_syntax = true;
     CompileRun("function loopish(o) {"
@@ -23339,7 +21806,11 @@
  private:
   static void WakeUpInterruptorCallback(
       const v8::FunctionCallbackInfo<Value>& info) {
-    if (!info[0]->BooleanValue()) return;
+    if (!info[0]
+             ->BooleanValue(info.GetIsolate()->GetCurrentContext())
+             .FromJust()) {
+      return;
+    }
 
     RequestInterruptTestBase* test =
         reinterpret_cast<RequestInterruptTestBase*>(
@@ -23396,9 +21867,12 @@
   }
 
   virtual void TestBody() {
-    Local<Function> func = Function::New(
-        isolate_, ShouldContinueCallback, v8::External::New(isolate_, this));
-    env_->Global()->Set(v8_str("ShouldContinue"), func);
+    Local<Function> func = Function::New(env_.local(), ShouldContinueCallback,
+                                         v8::External::New(isolate_, this))
+                               .ToLocalChecked();
+    CHECK(env_->Global()
+              ->Set(env_.local(), v8_str("ShouldContinue"), func)
+              .FromJust());
 
     CompileRun("while (ShouldContinue()) { }");
   }
@@ -23435,9 +21909,32 @@
 TEST(RequestMultipleInterrupts) { RequestMultipleInterrupts().RunTest(); }
 
 
+static bool interrupt_was_called = false;
+
+
+void SmallScriptsInterruptCallback(v8::Isolate* isolate, void* data) {
+  interrupt_was_called = true;
+}
+
+
+TEST(RequestInterruptSmallScripts) {
+  LocalContext env;
+  v8::Isolate* isolate = CcTest::isolate();
+  v8::HandleScope scope(isolate);
+
+  interrupt_was_called = false;
+  isolate->RequestInterrupt(&SmallScriptsInterruptCallback, NULL);
+  CompileRun("(function(x){return x;})(1);");
+  CHECK(interrupt_was_called);
+}
+
+
 static Local<Value> function_new_expected_env;
 static void FunctionNewCallback(const v8::FunctionCallbackInfo<Value>& info) {
-  CHECK_EQ(function_new_expected_env, info.Data());
+  CHECK(
+      function_new_expected_env->Equals(info.GetIsolate()->GetCurrentContext(),
+                                        info.Data())
+          .FromJust());
   info.GetReturnValue().Set(17);
 }
 
@@ -23448,28 +21945,31 @@
   v8::HandleScope scope(isolate);
   Local<Object> data = v8::Object::New(isolate);
   function_new_expected_env = data;
-  Local<Function> func = Function::New(isolate, FunctionNewCallback, data);
-  env->Global()->Set(v8_str("func"), func);
+  Local<Function> func =
+      Function::New(env.local(), FunctionNewCallback, data).ToLocalChecked();
+  CHECK(env->Global()->Set(env.local(), v8_str("func"), func).FromJust());
   Local<Value> result = CompileRun("func();");
-  CHECK_EQ(v8::Integer::New(isolate, 17), result);
-  // Verify function not cached
-  int serial_number =
-      i::Smi::cast(v8::Utils::OpenHandle(*func)
-          ->shared()->get_api_func_data()->serial_number())->value();
+  CHECK(v8::Integer::New(isolate, 17)->Equals(env.local(), result).FromJust());
   i::Isolate* i_isolate = reinterpret_cast<i::Isolate*>(isolate);
-  i::Handle<i::JSObject> cache(i_isolate->native_context()->function_cache());
-  i::Handle<i::Object> elm =
-      i::Object::GetElement(i_isolate, cache, serial_number).ToHandleChecked();
-  CHECK(elm->IsUndefined());
+  // Verify function not cached
+  auto serial_number = handle(
+      i::Smi::cast(i::Handle<i::JSFunction>::cast(v8::Utils::OpenHandle(*func))
+                       ->shared()
+                       ->get_api_func_data()
+                       ->serial_number()),
+      i_isolate);
+  auto cache = i_isolate->function_cache();
+  CHECK(cache->Lookup(serial_number)->IsTheHole());
   // Verify that each Function::New creates a new function instance
   Local<Object> data2 = v8::Object::New(isolate);
   function_new_expected_env = data2;
-  Local<Function> func2 = Function::New(isolate, FunctionNewCallback, data2);
+  Local<Function> func2 =
+      Function::New(env.local(), FunctionNewCallback, data2).ToLocalChecked();
   CHECK(!func2->IsNull());
-  CHECK_NE(func, func2);
-  env->Global()->Set(v8_str("func2"), func2);
+  CHECK(!func->Equals(env.local(), func2).FromJust());
+  CHECK(env->Global()->Set(env.local(), v8_str("func2"), func2).FromJust());
   Local<Value> result2 = CompileRun("func2();");
-  CHECK_EQ(v8::Integer::New(isolate, 17), result2);
+  CHECK(v8::Integer::New(isolate, 17)->Equals(env.local(), result2).FromJust());
 }
 
 
@@ -23487,7 +21987,9 @@
   for (int i = 0; i < runs; i++) {
     Local<String> expected;
     if (i != 0) {
-      CHECK_EQ(v8_str("escape value"), values[i]);
+      CHECK(v8_str("escape value")
+                ->Equals(context.local(), values[i])
+                .FromJust());
     } else {
       CHECK(values[i].IsEmpty());
     }
@@ -23507,7 +22009,10 @@
   v8::HandleScope scope(isolate);
   Local<ObjectTemplate> templ = ObjectTemplate::New(isolate);
   templ->SetAccessor(v8_str("x"), 0, SetterWhichExpectsThisAndHolderToDiffer);
-  context->Global()->Set(v8_str("P"), templ->NewInstance());
+  CHECK(context->Global()
+            ->Set(context.local(), v8_str("P"),
+                  templ->NewInstance(context.local()).ToLocalChecked())
+            .FromJust());
   CompileRun(
       "function C1() {"
       "  this.x = 23;"
@@ -23533,7 +22038,9 @@
     CHECK(data == info.Data());
     CHECK(receiver == info.This());
     if (info.Length() == 1) {
-      CHECK_EQ(v8_num(1), info[0]);
+      CHECK(v8_num(1)
+                ->Equals(info.GetIsolate()->GetCurrentContext(), info[0])
+                .FromJust());
     }
     CHECK(holder == info.Holder());
     count++;
@@ -23591,8 +22098,11 @@
         v8::Context::New(isolate, NULL, signature_template);
     v8::Context::Scope context_scope(context);
     // Install regular object that can pass signature checks.
-    Local<Object> function_receiver = signature_template->NewInstance();
-    context->Global()->Set(v8_str("function_receiver"), function_receiver);
+    Local<Object> function_receiver =
+        signature_template->NewInstance(context).ToLocalChecked();
+    CHECK(context->Global()
+              ->Set(context, v8_str("function_receiver"), function_receiver)
+              .FromJust());
     // Get the holder objects.
     Local<Object> inner_global =
         Local<Object>::Cast(context->Global()->GetPrototype());
@@ -23600,16 +22110,17 @@
     data = Object::New(isolate);
     Local<FunctionTemplate> function_template = FunctionTemplate::New(
         isolate, OptimizationCallback, data, signature);
-    Local<Function> function = function_template->GetFunction();
+    Local<Function> function =
+        function_template->GetFunction(context).ToLocalChecked();
     Local<Object> global_holder = inner_global;
     Local<Object> function_holder = function_receiver;
     if (signature_type == kSignatureOnPrototype) {
       function_holder = Local<Object>::Cast(function_holder->GetPrototype());
       global_holder = Local<Object>::Cast(global_holder->GetPrototype());
     }
-    global_holder->Set(v8_str("g_f"), function);
+    global_holder->Set(context, v8_str("g_f"), function).FromJust();
     global_holder->SetAccessorProperty(v8_str("g_acc"), function, function);
-    function_holder->Set(v8_str("f"), function);
+    function_holder->Set(context, v8_str("f"), function).FromJust();
     function_holder->SetAccessorProperty(v8_str("acc"), function, function);
     // Initialize expected values.
     callee = function;
@@ -23681,9 +22192,9 @@
         "%%OptimizeFunctionOnNextCall(wrap_set_%d);\n"
         "check(wrap_set());\n",
         wrap_function.start(), key, key, key, key, key, key);
-    v8::TryCatch try_catch;
+    v8::TryCatch try_catch(isolate);
     CompileRun(source.start());
-    DCHECK(!try_catch.HasCaught());
+    CHECK(!try_catch.HasCaught());
     CHECK_EQ(9, count);
   }
 };
@@ -23696,13 +22207,225 @@
 int ApiCallOptimizationChecker::count = 0;
 
 
-TEST(TestFunctionCallOptimization) {
+TEST(FunctionCallOptimization) {
   i::FLAG_allow_natives_syntax = true;
   ApiCallOptimizationChecker checker;
   checker.RunAll();
 }
 
 
+TEST(FunctionCallOptimizationMultipleArgs) {
+  i::FLAG_allow_natives_syntax = true;
+  LocalContext context;
+  v8::Isolate* isolate = context->GetIsolate();
+  v8::HandleScope scope(isolate);
+  Local<Object> global = context->Global();
+  Local<v8::Function> function =
+      Function::New(context.local(), Returns42).ToLocalChecked();
+  global->Set(context.local(), v8_str("x"), function).FromJust();
+  CompileRun(
+      "function x_wrap() {\n"
+      "  for (var i = 0; i < 5; i++) {\n"
+      "    x(1,2,3);\n"
+      "  }\n"
+      "}\n"
+      "x_wrap();\n"
+      "%OptimizeFunctionOnNextCall(x_wrap);"
+      "x_wrap();\n");
+}
+
+
+static void ReturnsSymbolCallback(
+    const v8::FunctionCallbackInfo<v8::Value>& info) {
+  info.GetReturnValue().Set(v8::Symbol::New(info.GetIsolate()));
+}
+
+
+TEST(ApiCallbackCanReturnSymbols) {
+  i::FLAG_allow_natives_syntax = true;
+  LocalContext context;
+  v8::Isolate* isolate = context->GetIsolate();
+  v8::HandleScope scope(isolate);
+  Local<Object> global = context->Global();
+  Local<v8::Function> function =
+      Function::New(context.local(), ReturnsSymbolCallback).ToLocalChecked();
+  global->Set(context.local(), v8_str("x"), function).FromJust();
+  CompileRun(
+      "function x_wrap() {\n"
+      "  for (var i = 0; i < 5; i++) {\n"
+      "    x();\n"
+      "  }\n"
+      "}\n"
+      "x_wrap();\n"
+      "%OptimizeFunctionOnNextCall(x_wrap);"
+      "x_wrap();\n");
+}
+
+
+TEST(EmptyApiCallback) {
+  LocalContext context;
+  auto isolate = context->GetIsolate();
+  v8::HandleScope scope(isolate);
+  auto global = context->Global();
+  auto function = FunctionTemplate::New(isolate)
+                      ->GetFunction(context.local())
+                      .ToLocalChecked();
+  global->Set(context.local(), v8_str("x"), function).FromJust();
+
+  auto result = CompileRun("x()");
+  CHECK(v8::Utils::OpenHandle(*result)->IsJSGlobalProxy());
+
+  result = CompileRun("x(1,2,3)");
+  CHECK(v8::Utils::OpenHandle(*result)->IsJSGlobalProxy());
+
+  result = CompileRun("x.call(undefined)");
+  CHECK(v8::Utils::OpenHandle(*result)->IsJSGlobalProxy());
+
+  result = CompileRun("x.call(null)");
+  CHECK(v8::Utils::OpenHandle(*result)->IsJSGlobalProxy());
+
+  result = CompileRun("7 + x.call(3) + 11");
+  CHECK(result->IsInt32());
+  CHECK_EQ(21, result->Int32Value(context.local()).FromJust());
+
+  result = CompileRun("7 + x.call(3, 101, 102, 103, 104) + 11");
+  CHECK(result->IsInt32());
+  CHECK_EQ(21, result->Int32Value(context.local()).FromJust());
+
+  result = CompileRun("var y = []; x.call(y)");
+  CHECK(result->IsArray());
+
+  result = CompileRun("x.call(y, 1, 2, 3, 4)");
+  CHECK(result->IsArray());
+}
+
+
+TEST(SimpleSignatureCheck) {
+  LocalContext context;
+  auto isolate = context->GetIsolate();
+  v8::HandleScope scope(isolate);
+  auto global = context->Global();
+  auto sig_obj = FunctionTemplate::New(isolate);
+  auto sig = v8::Signature::New(isolate, sig_obj);
+  auto x = FunctionTemplate::New(isolate, Returns42, Local<Value>(), sig);
+  global->Set(context.local(), v8_str("sig_obj"),
+              sig_obj->GetFunction(context.local()).ToLocalChecked())
+      .FromJust();
+  global->Set(context.local(), v8_str("x"),
+              x->GetFunction(context.local()).ToLocalChecked())
+      .FromJust();
+  CompileRun("var s = new sig_obj();");
+  {
+    TryCatch try_catch(isolate);
+    CompileRun("x()");
+    CHECK(try_catch.HasCaught());
+  }
+  {
+    TryCatch try_catch(isolate);
+    CompileRun("x.call(1)");
+    CHECK(try_catch.HasCaught());
+  }
+  {
+    TryCatch try_catch(isolate);
+    auto result = CompileRun("s.x = x; s.x()");
+    CHECK(!try_catch.HasCaught());
+    CHECK_EQ(42, result->Int32Value(context.local()).FromJust());
+  }
+  {
+    TryCatch try_catch(isolate);
+    auto result = CompileRun("x.call(s)");
+    CHECK(!try_catch.HasCaught());
+    CHECK_EQ(42, result->Int32Value(context.local()).FromJust());
+  }
+}
+
+
+TEST(ChainSignatureCheck) {
+  LocalContext context;
+  auto isolate = context->GetIsolate();
+  v8::HandleScope scope(isolate);
+  auto global = context->Global();
+  auto sig_obj = FunctionTemplate::New(isolate);
+  auto sig = v8::Signature::New(isolate, sig_obj);
+  for (int i = 0; i < 4; ++i) {
+    auto temp = FunctionTemplate::New(isolate);
+    temp->Inherit(sig_obj);
+    sig_obj = temp;
+  }
+  auto x = FunctionTemplate::New(isolate, Returns42, Local<Value>(), sig);
+  global->Set(context.local(), v8_str("sig_obj"),
+              sig_obj->GetFunction(context.local()).ToLocalChecked())
+      .FromJust();
+  global->Set(context.local(), v8_str("x"),
+              x->GetFunction(context.local()).ToLocalChecked())
+      .FromJust();
+  CompileRun("var s = new sig_obj();");
+  {
+    TryCatch try_catch(isolate);
+    CompileRun("x()");
+    CHECK(try_catch.HasCaught());
+  }
+  {
+    TryCatch try_catch(isolate);
+    CompileRun("x.call(1)");
+    CHECK(try_catch.HasCaught());
+  }
+  {
+    TryCatch try_catch(isolate);
+    auto result = CompileRun("s.x = x; s.x()");
+    CHECK(!try_catch.HasCaught());
+    CHECK_EQ(42, result->Int32Value(context.local()).FromJust());
+  }
+  {
+    TryCatch try_catch(isolate);
+    auto result = CompileRun("x.call(s)");
+    CHECK(!try_catch.HasCaught());
+    CHECK_EQ(42, result->Int32Value(context.local()).FromJust());
+  }
+}
+
+
+TEST(PrototypeSignatureCheck) {
+  LocalContext context;
+  auto isolate = context->GetIsolate();
+  v8::HandleScope scope(isolate);
+  auto global = context->Global();
+  auto sig_obj = FunctionTemplate::New(isolate);
+  sig_obj->SetHiddenPrototype(true);
+  auto sig = v8::Signature::New(isolate, sig_obj);
+  auto x = FunctionTemplate::New(isolate, Returns42, Local<Value>(), sig);
+  global->Set(context.local(), v8_str("sig_obj"),
+              sig_obj->GetFunction(context.local()).ToLocalChecked())
+      .FromJust();
+  global->Set(context.local(), v8_str("x"),
+              x->GetFunction(context.local()).ToLocalChecked())
+      .FromJust();
+  CompileRun("s = {}; s.__proto__ = new sig_obj();");
+  {
+    TryCatch try_catch(isolate);
+    CompileRun("x()");
+    CHECK(try_catch.HasCaught());
+  }
+  {
+    TryCatch try_catch(isolate);
+    CompileRun("x.call(1)");
+    CHECK(try_catch.HasCaught());
+  }
+  {
+    TryCatch try_catch(isolate);
+    auto result = CompileRun("s.x = x; s.x()");
+    CHECK(!try_catch.HasCaught());
+    CHECK_EQ(42, result->Int32Value(context.local()).FromJust());
+  }
+  {
+    TryCatch try_catch(isolate);
+    auto result = CompileRun("x.call(s)");
+    CHECK(!try_catch.HasCaught());
+    CHECK_EQ(42, result->Int32Value(context.local()).FromJust());
+  }
+}
+
+
 static const char* last_event_message;
 static int last_event_status;
 void StoringEventLoggerCallback(const char* message, int status) {
@@ -23715,13 +22438,13 @@
   v8::Isolate* isolate = CcTest::isolate();
   isolate->SetEventLogger(StoringEventLoggerCallback);
   v8::internal::HistogramTimer histogramTimer(
-      "V8.Test", 0, 10000, 50,
+      "V8.Test", 0, 10000, v8::internal::HistogramTimer::MILLISECOND, 50,
       reinterpret_cast<v8::internal::Isolate*>(isolate));
   histogramTimer.Start();
-  CHECK_EQ("V8.Test", last_event_message);
+  CHECK_EQ(0, strcmp("V8.Test", last_event_message));
   CHECK_EQ(0, last_event_status);
   histogramTimer.Stop();
-  CHECK_EQ("V8.Test", last_event_message);
+  CHECK_EQ(0, strcmp("V8.Test", last_event_message));
   CHECK_EQ(1, last_event_status);
 }
 
@@ -23730,94 +22453,26 @@
   LocalContext context;
   v8::Isolate* isolate = context->GetIsolate();
   v8::HandleScope scope(isolate);
-  Handle<Object> global = context->Global();
 
   // Creation.
-  Handle<v8::Promise::Resolver> pr = v8::Promise::Resolver::New(isolate);
-  Handle<v8::Promise::Resolver> rr = v8::Promise::Resolver::New(isolate);
-  Handle<v8::Promise> p = pr->GetPromise();
-  Handle<v8::Promise> r = rr->GetPromise();
-  CHECK_EQ(isolate, p->GetIsolate());
+  Local<v8::Promise::Resolver> pr =
+      v8::Promise::Resolver::New(context.local()).ToLocalChecked();
+  Local<v8::Promise::Resolver> rr =
+      v8::Promise::Resolver::New(context.local()).ToLocalChecked();
+  Local<v8::Promise> p = pr->GetPromise();
+  Local<v8::Promise> r = rr->GetPromise();
 
   // IsPromise predicate.
   CHECK(p->IsPromise());
   CHECK(r->IsPromise());
-  Handle<Value> o = v8::Object::New(isolate);
+  Local<Value> o = v8::Object::New(isolate);
   CHECK(!o->IsPromise());
 
   // Resolution and rejection.
-  pr->Resolve(v8::Integer::New(isolate, 1));
+  pr->Resolve(context.local(), v8::Integer::New(isolate, 1)).FromJust();
   CHECK(p->IsPromise());
-  rr->Reject(v8::Integer::New(isolate, 2));
+  rr->Reject(context.local(), v8::Integer::New(isolate, 2)).FromJust();
   CHECK(r->IsPromise());
-
-  // Chaining non-pending promises.
-  CompileRun(
-      "var x1 = 0;\n"
-      "var x2 = 0;\n"
-      "function f1(x) { x1 = x; return x+1 };\n"
-      "function f2(x) { x2 = x; return x+1 };\n");
-  Handle<Function> f1 = Handle<Function>::Cast(global->Get(v8_str("f1")));
-  Handle<Function> f2 = Handle<Function>::Cast(global->Get(v8_str("f2")));
-
-  p->Chain(f1);
-  CHECK_EQ(0, global->Get(v8_str("x1"))->Int32Value());
-  isolate->RunMicrotasks();
-  CHECK_EQ(1, global->Get(v8_str("x1"))->Int32Value());
-
-  p->Catch(f2);
-  isolate->RunMicrotasks();
-  CHECK_EQ(0, global->Get(v8_str("x2"))->Int32Value());
-
-  r->Catch(f2);
-  CHECK_EQ(0, global->Get(v8_str("x2"))->Int32Value());
-  isolate->RunMicrotasks();
-  CHECK_EQ(2, global->Get(v8_str("x2"))->Int32Value());
-
-  r->Chain(f1);
-  isolate->RunMicrotasks();
-  CHECK_EQ(1, global->Get(v8_str("x1"))->Int32Value());
-
-  // Chaining pending promises.
-  CompileRun("x1 = x2 = 0;");
-  pr = v8::Promise::Resolver::New(isolate);
-  rr = v8::Promise::Resolver::New(isolate);
-
-  pr->GetPromise()->Chain(f1);
-  rr->GetPromise()->Catch(f2);
-  isolate->RunMicrotasks();
-  CHECK_EQ(0, global->Get(v8_str("x1"))->Int32Value());
-  CHECK_EQ(0, global->Get(v8_str("x2"))->Int32Value());
-
-  pr->Resolve(v8::Integer::New(isolate, 1));
-  rr->Reject(v8::Integer::New(isolate, 2));
-  CHECK_EQ(0, global->Get(v8_str("x1"))->Int32Value());
-  CHECK_EQ(0, global->Get(v8_str("x2"))->Int32Value());
-
-  isolate->RunMicrotasks();
-  CHECK_EQ(1, global->Get(v8_str("x1"))->Int32Value());
-  CHECK_EQ(2, global->Get(v8_str("x2"))->Int32Value());
-
-  // Multi-chaining.
-  CompileRun("x1 = x2 = 0;");
-  pr = v8::Promise::Resolver::New(isolate);
-  pr->GetPromise()->Chain(f1)->Chain(f2);
-  pr->Resolve(v8::Integer::New(isolate, 3));
-  CHECK_EQ(0, global->Get(v8_str("x1"))->Int32Value());
-  CHECK_EQ(0, global->Get(v8_str("x2"))->Int32Value());
-  isolate->RunMicrotasks();
-  CHECK_EQ(3, global->Get(v8_str("x1"))->Int32Value());
-  CHECK_EQ(4, global->Get(v8_str("x2"))->Int32Value());
-
-  CompileRun("x1 = x2 = 0;");
-  rr = v8::Promise::Resolver::New(isolate);
-  rr->GetPromise()->Catch(f1)->Chain(f2);
-  rr->Reject(v8::Integer::New(isolate, 3));
-  CHECK_EQ(0, global->Get(v8_str("x1"))->Int32Value());
-  CHECK_EQ(0, global->Get(v8_str("x2"))->Int32Value());
-  isolate->RunMicrotasks();
-  CHECK_EQ(3, global->Get(v8_str("x1"))->Int32Value());
-  CHECK_EQ(4, global->Get(v8_str("x2"))->Int32Value());
 }
 
 
@@ -23825,19 +22480,21 @@
   LocalContext context;
   v8::Isolate* isolate = context->GetIsolate();
   v8::HandleScope scope(isolate);
-  Handle<Object> global = context->Global();
+  Local<Object> global = context->Global();
 
   // Creation.
-  Handle<v8::Promise::Resolver> pr = v8::Promise::Resolver::New(isolate);
-  Handle<v8::Promise::Resolver> qr = v8::Promise::Resolver::New(isolate);
-  Handle<v8::Promise> p = pr->GetPromise();
-  Handle<v8::Promise> q = qr->GetPromise();
+  Local<v8::Promise::Resolver> pr =
+      v8::Promise::Resolver::New(context.local()).ToLocalChecked();
+  Local<v8::Promise::Resolver> qr =
+      v8::Promise::Resolver::New(context.local()).ToLocalChecked();
+  Local<v8::Promise> p = pr->GetPromise();
+  Local<v8::Promise> q = qr->GetPromise();
 
   CHECK(p->IsPromise());
   CHECK(q->IsPromise());
 
-  pr->Resolve(v8::Integer::New(isolate, 1));
-  qr->Resolve(p);
+  pr->Resolve(context.local(), v8::Integer::New(isolate, 1)).FromJust();
+  qr->Resolve(context.local(), p).FromJust();
 
   // Chaining non-pending promises.
   CompileRun(
@@ -23845,45 +22502,73 @@
       "var x2 = 0;\n"
       "function f1(x) { x1 = x; return x+1 };\n"
       "function f2(x) { x2 = x; return x+1 };\n");
-  Handle<Function> f1 = Handle<Function>::Cast(global->Get(v8_str("f1")));
-  Handle<Function> f2 = Handle<Function>::Cast(global->Get(v8_str("f2")));
-
-  // Chain
-  q->Chain(f1);
-  CHECK(global->Get(v8_str("x1"))->IsNumber());
-  CHECK_EQ(0, global->Get(v8_str("x1"))->Int32Value());
-  isolate->RunMicrotasks();
-  CHECK(!global->Get(v8_str("x1"))->IsNumber());
-  CHECK_EQ(p, global->Get(v8_str("x1")));
+  Local<Function> f1 = Local<Function>::Cast(
+      global->Get(context.local(), v8_str("f1")).ToLocalChecked());
+  Local<Function> f2 = Local<Function>::Cast(
+      global->Get(context.local(), v8_str("f2")).ToLocalChecked());
 
   // Then
   CompileRun("x1 = x2 = 0;");
-  q->Then(f1);
-  CHECK_EQ(0, global->Get(v8_str("x1"))->Int32Value());
+  q->Then(context.local(), f1).ToLocalChecked();
+  CHECK_EQ(0, global->Get(context.local(), v8_str("x1"))
+                  .ToLocalChecked()
+                  ->Int32Value(context.local())
+                  .FromJust());
   isolate->RunMicrotasks();
-  CHECK_EQ(1, global->Get(v8_str("x1"))->Int32Value());
+  CHECK_EQ(1, global->Get(context.local(), v8_str("x1"))
+                  .ToLocalChecked()
+                  ->Int32Value(context.local())
+                  .FromJust());
 
   // Then
   CompileRun("x1 = x2 = 0;");
-  pr = v8::Promise::Resolver::New(isolate);
-  qr = v8::Promise::Resolver::New(isolate);
+  pr = v8::Promise::Resolver::New(context.local()).ToLocalChecked();
+  qr = v8::Promise::Resolver::New(context.local()).ToLocalChecked();
 
-  qr->Resolve(pr);
-  qr->GetPromise()->Then(f1)->Then(f2);
+  qr->Resolve(context.local(), pr).FromJust();
+  qr->GetPromise()
+      ->Then(context.local(), f1)
+      .ToLocalChecked()
+      ->Then(context.local(), f2)
+      .ToLocalChecked();
 
-  CHECK_EQ(0, global->Get(v8_str("x1"))->Int32Value());
-  CHECK_EQ(0, global->Get(v8_str("x2"))->Int32Value());
+  CHECK_EQ(0, global->Get(context.local(), v8_str("x1"))
+                  .ToLocalChecked()
+                  ->Int32Value(context.local())
+                  .FromJust());
+  CHECK_EQ(0, global->Get(context.local(), v8_str("x2"))
+                  .ToLocalChecked()
+                  ->Int32Value(context.local())
+                  .FromJust());
   isolate->RunMicrotasks();
-  CHECK_EQ(0, global->Get(v8_str("x1"))->Int32Value());
-  CHECK_EQ(0, global->Get(v8_str("x2"))->Int32Value());
+  CHECK_EQ(0, global->Get(context.local(), v8_str("x1"))
+                  .ToLocalChecked()
+                  ->Int32Value(context.local())
+                  .FromJust());
+  CHECK_EQ(0, global->Get(context.local(), v8_str("x2"))
+                  .ToLocalChecked()
+                  ->Int32Value(context.local())
+                  .FromJust());
 
-  pr->Resolve(v8::Integer::New(isolate, 3));
+  pr->Resolve(context.local(), v8::Integer::New(isolate, 3)).FromJust();
 
-  CHECK_EQ(0, global->Get(v8_str("x1"))->Int32Value());
-  CHECK_EQ(0, global->Get(v8_str("x2"))->Int32Value());
+  CHECK_EQ(0, global->Get(context.local(), v8_str("x1"))
+                  .ToLocalChecked()
+                  ->Int32Value(context.local())
+                  .FromJust());
+  CHECK_EQ(0, global->Get(context.local(), v8_str("x2"))
+                  .ToLocalChecked()
+                  ->Int32Value(context.local())
+                  .FromJust());
   isolate->RunMicrotasks();
-  CHECK_EQ(3, global->Get(v8_str("x1"))->Int32Value());
-  CHECK_EQ(4, global->Get(v8_str("x2"))->Int32Value());
+  CHECK_EQ(3, global->Get(context.local(), v8_str("x1"))
+                  .ToLocalChecked()
+                  ->Int32Value(context.local())
+                  .FromJust());
+  CHECK_EQ(4, global->Get(context.local(), v8_str("x2"))
+                  .ToLocalChecked()
+                  ->Int32Value(context.local())
+                  .FromJust());
 }
 
 
@@ -23915,7 +22600,7 @@
   LocalContext context;
   v8::Isolate* isolate = context->GetIsolate();
   v8::HandleScope scope(isolate);
-  v8::TryCatch try_catch;
+  v8::TryCatch try_catch(isolate);
   v8::Isolate::DisallowJavascriptExecutionScope throw_js(
       isolate, v8::Isolate::DisallowJavascriptExecutionScope::THROW_ON_FAILURE);
   CompileRun("1+1");
@@ -23928,43 +22613,46 @@
   v8::Isolate* isolate = current->GetIsolate();
   v8::HandleScope scope(isolate);
 
-  v8::Handle<v8::ObjectTemplate> templ = v8::ObjectTemplate::New(isolate);
-  templ->SetAccessCheckCallbacks(NamedAccessCounter, IndexedAccessCounter);
-  current->Global()->Set(v8_str("friend"), templ->NewInstance());
+  v8::Local<v8::ObjectTemplate> templ = v8::ObjectTemplate::New(isolate);
+  templ->SetAccessCheckCallback(AccessCounter);
+  CHECK(current->Global()
+            ->Set(current.local(), v8_str("friend"),
+                  templ->NewInstance(current.local()).ToLocalChecked())
+            .FromJust());
 
   // Test access using __proto__ from the prototype chain.
-  named_access_count = 0;
+  access_count = 0;
   CompileRun("friend.__proto__ = {};");
-  CHECK_EQ(2, named_access_count);
+  CHECK_EQ(2, access_count);
   CompileRun("friend.__proto__;");
-  CHECK_EQ(4, named_access_count);
+  CHECK_EQ(4, access_count);
 
   // Test access using __proto__ as a hijacked function (A).
-  named_access_count = 0;
+  access_count = 0;
   CompileRun("var p = Object.prototype;"
              "var f = Object.getOwnPropertyDescriptor(p, '__proto__').set;"
              "f.call(friend, {});");
-  CHECK_EQ(1, named_access_count);
+  CHECK_EQ(1, access_count);
   CompileRun("var p = Object.prototype;"
              "var f = Object.getOwnPropertyDescriptor(p, '__proto__').get;"
              "f.call(friend);");
-  CHECK_EQ(2, named_access_count);
+  CHECK_EQ(2, access_count);
 
   // Test access using __proto__ as a hijacked function (B).
-  named_access_count = 0;
+  access_count = 0;
   CompileRun("var f = Object.prototype.__lookupSetter__('__proto__');"
              "f.call(friend, {});");
-  CHECK_EQ(1, named_access_count);
+  CHECK_EQ(1, access_count);
   CompileRun("var f = Object.prototype.__lookupGetter__('__proto__');"
              "f.call(friend);");
-  CHECK_EQ(2, named_access_count);
+  CHECK_EQ(2, access_count);
 
   // Test access using Object.setPrototypeOf reflective method.
-  named_access_count = 0;
+  access_count = 0;
   CompileRun("Object.setPrototypeOf(friend, {});");
-  CHECK_EQ(1, named_access_count);
+  CHECK_EQ(1, access_count);
   CompileRun("Object.getPrototypeOf(friend);");
-  CHECK_EQ(2, named_access_count);
+  CHECK_EQ(2, access_count);
 }
 
 
@@ -23973,9 +22661,9 @@
   LocalContext current;
   v8::Isolate* isolate = current->GetIsolate();
   v8::HandleScope scope(isolate);
-  V8::SetCaptureStackTraceForUncaughtExceptions(
-      true, 10, v8::StackTrace::kDetailed);
-  v8::TryCatch try_catch;
+  isolate->SetCaptureStackTraceForUncaughtExceptions(true, 10,
+                                                     v8::StackTrace::kDetailed);
+  v8::TryCatch try_catch(isolate);
   CompileRun("(function f(x) { f(x+1); })(0)");
   CHECK(try_catch.HasCaught());
 }
@@ -23988,29 +22676,29 @@
   const char* url = "http://www.foo.com/foo.js";
   v8::ScriptOrigin origin(v8_str(url), v8::Integer::New(isolate, 13));
   v8::ScriptCompiler::Source script_source(v8_str("var foo;"), origin);
-  Local<Script> script = v8::ScriptCompiler::Compile(
-      isolate, &script_source);
+  Local<Script> script =
+      v8::ScriptCompiler::Compile(env.local(), &script_source).ToLocalChecked();
   Local<Value> script_name = script->GetUnboundScript()->GetScriptName();
   CHECK(!script_name.IsEmpty());
   CHECK(script_name->IsString());
   String::Utf8Value utf8_name(script_name);
-  CHECK_EQ(url, *utf8_name);
+  CHECK_EQ(0, strcmp(url, *utf8_name));
   int line_number = script->GetUnboundScript()->GetLineNumber(0);
   CHECK_EQ(13, line_number);
 }
 
-void CheckMagicComments(Handle<Script> script, const char* expected_source_url,
+void CheckMagicComments(Local<Script> script, const char* expected_source_url,
                         const char* expected_source_mapping_url) {
   if (expected_source_url != NULL) {
     v8::String::Utf8Value url(script->GetUnboundScript()->GetSourceURL());
-    CHECK_EQ(expected_source_url, *url);
+    CHECK_EQ(0, strcmp(expected_source_url, *url));
   } else {
     CHECK(script->GetUnboundScript()->GetSourceURL()->IsUndefined());
   }
   if (expected_source_mapping_url != NULL) {
     v8::String::Utf8Value url(
         script->GetUnboundScript()->GetSourceMappingURL());
-    CHECK_EQ(expected_source_mapping_url, *url);
+    CHECK_EQ(0, strcmp(expected_source_mapping_url, *url));
   } else {
     CHECK(script->GetUnboundScript()->GetSourceMappingURL()->IsUndefined());
   }
@@ -24097,35 +22785,56 @@
     "  set : function(value) { this.value = value; },"
     "  get : function() { return this.value; },"
     "});");
-  Local<Object> x = Local<Object>::Cast(env->Global()->Get(v8_str("x")));
-  Local<Value> desc = x->GetOwnPropertyDescriptor(v8_str("no_prop"));
+  Local<Object> x = Local<Object>::Cast(
+      env->Global()->Get(env.local(), v8_str("x")).ToLocalChecked());
+  Local<Value> desc =
+      x->GetOwnPropertyDescriptor(env.local(), v8_str("no_prop"))
+          .ToLocalChecked();
   CHECK(desc->IsUndefined());
-  desc = x->GetOwnPropertyDescriptor(v8_str("p0"));
-  CHECK_EQ(v8_num(12), Local<Object>::Cast(desc)->Get(v8_str("value")));
-  desc = x->GetOwnPropertyDescriptor(v8_str("p1"));
+  desc =
+      x->GetOwnPropertyDescriptor(env.local(), v8_str("p0")).ToLocalChecked();
+  CHECK(v8_num(12)
+            ->Equals(env.local(), Local<Object>::Cast(desc)
+                                      ->Get(env.local(), v8_str("value"))
+                                      .ToLocalChecked())
+            .FromJust());
+  desc =
+      x->GetOwnPropertyDescriptor(env.local(), v8_str("p1")).ToLocalChecked();
   Local<Function> set =
-    Local<Function>::Cast(Local<Object>::Cast(desc)->Get(v8_str("set")));
+      Local<Function>::Cast(Local<Object>::Cast(desc)
+                                ->Get(env.local(), v8_str("set"))
+                                .ToLocalChecked());
   Local<Function> get =
-    Local<Function>::Cast(Local<Object>::Cast(desc)->Get(v8_str("get")));
-  CHECK_EQ(v8_num(13), get->Call(x, 0, NULL));
-  Handle<Value> args[] = { v8_num(14) };
-  set->Call(x, 1, args);
-  CHECK_EQ(v8_num(14), get->Call(x, 0, NULL));
+      Local<Function>::Cast(Local<Object>::Cast(desc)
+                                ->Get(env.local(), v8_str("get"))
+                                .ToLocalChecked());
+  CHECK(v8_num(13)
+            ->Equals(env.local(),
+                     get->Call(env.local(), x, 0, NULL).ToLocalChecked())
+            .FromJust());
+  Local<Value> args[] = {v8_num(14)};
+  set->Call(env.local(), x, 1, args).ToLocalChecked();
+  CHECK(v8_num(14)
+            ->Equals(env.local(),
+                     get->Call(env.local(), x, 0, NULL).ToLocalChecked())
+            .FromJust());
 }
 
 
 TEST(Regress411877) {
   v8::Isolate* isolate = CcTest::isolate();
   v8::HandleScope handle_scope(isolate);
-  v8::Handle<v8::ObjectTemplate> object_template =
+  v8::Local<v8::ObjectTemplate> object_template =
       v8::ObjectTemplate::New(isolate);
-  object_template->SetAccessCheckCallbacks(NamedAccessCounter,
-                                           IndexedAccessCounter);
+  object_template->SetAccessCheckCallback(AccessCounter);
 
-  v8::Handle<Context> context = Context::New(isolate);
+  v8::Local<Context> context = Context::New(isolate);
   v8::Context::Scope context_scope(context);
 
-  context->Global()->Set(v8_str("o"), object_template->NewInstance());
+  CHECK(context->Global()
+            ->Set(context, v8_str("o"),
+                  object_template->NewInstance(context).ToLocalChecked())
+            .FromJust());
   CompileRun("Object.getOwnPropertyNames(o)");
 }
 
@@ -24133,34 +22842,38 @@
 TEST(GetHiddenPropertyTableAfterAccessCheck) {
   v8::Isolate* isolate = CcTest::isolate();
   v8::HandleScope handle_scope(isolate);
-  v8::Handle<v8::ObjectTemplate> object_template =
+  v8::Local<v8::ObjectTemplate> object_template =
       v8::ObjectTemplate::New(isolate);
-  object_template->SetAccessCheckCallbacks(NamedAccessCounter,
-                                           IndexedAccessCounter);
+  object_template->SetAccessCheckCallback(AccessCounter);
 
-  v8::Handle<Context> context = Context::New(isolate);
+  v8::Local<Context> context = Context::New(isolate);
   v8::Context::Scope context_scope(context);
 
-  v8::Handle<v8::Object> obj = object_template->NewInstance();
-  obj->Set(v8_str("key"), v8_str("value"));
-  obj->Delete(v8_str("key"));
+  v8::Local<v8::Object> obj =
+      object_template->NewInstance(context).ToLocalChecked();
+  obj->Set(context, v8_str("key"), v8_str("value")).FromJust();
+  obj->Delete(context, v8_str("key")).FromJust();
 
-  obj->SetHiddenValue(v8_str("hidden key 2"), v8_str("hidden value 2"));
+  obj->SetPrivate(context, v8::Private::New(isolate, v8_str("hidden key 2")),
+                  v8_str("hidden value 2"))
+      .FromJust();
 }
 
 
 TEST(Regress411793) {
   v8::Isolate* isolate = CcTest::isolate();
   v8::HandleScope handle_scope(isolate);
-  v8::Handle<v8::ObjectTemplate> object_template =
+  v8::Local<v8::ObjectTemplate> object_template =
       v8::ObjectTemplate::New(isolate);
-  object_template->SetAccessCheckCallbacks(NamedAccessCounter,
-                                           IndexedAccessCounter);
+  object_template->SetAccessCheckCallback(AccessCounter);
 
-  v8::Handle<Context> context = Context::New(isolate);
+  v8::Local<Context> context = Context::New(isolate);
   v8::Context::Scope context_scope(context);
 
-  context->Global()->Set(v8_str("o"), object_template->NewInstance());
+  CHECK(context->Global()
+            ->Set(context, v8_str("o"),
+                  object_template->NewInstance(context).ToLocalChecked())
+            .FromJust());
   CompileRun(
       "Object.defineProperty(o, 'key', "
       "    { get: function() {}, set: function() {} });");
@@ -24219,7 +22932,7 @@
   LocalContext env;
   v8::Isolate* isolate = env->GetIsolate();
   v8::HandleScope scope(isolate);
-  v8::TryCatch try_catch;
+  v8::TryCatch try_catch(isolate);
 
   v8::ScriptCompiler::StreamedSource source(new TestSourceStream(chunks),
                                             encoding);
@@ -24231,20 +22944,20 @@
   task->Run();
   delete task;
 
-  v8::ScriptOrigin origin(v8_str("http://foo.com"));
-  char* full_source = TestSourceStream::FullSourceString(chunks);
-
-  // The possible errors are only produced while compiling.
+  // Possible errors are only produced while compiling.
   CHECK_EQ(false, try_catch.HasCaught());
 
-  v8::Handle<Script> script = v8::ScriptCompiler::Compile(
-      isolate, &source, v8_str(full_source), origin);
+  v8::ScriptOrigin origin(v8_str("http://foo.com"));
+  char* full_source = TestSourceStream::FullSourceString(chunks);
+  v8::MaybeLocal<Script> script = v8::ScriptCompiler::Compile(
+      env.local(), &source, v8_str(full_source), origin);
   if (expected_success) {
     CHECK(!script.IsEmpty());
-    v8::Handle<Value> result(script->Run());
+    v8::Local<Value> result(
+        script.ToLocalChecked()->Run(env.local()).ToLocalChecked());
     // All scripts are supposed to return the fixed value 13 when ran.
-    CHECK_EQ(13, result->Int32Value());
-    CheckMagicComments(script, expected_source_url,
+    CHECK_EQ(13, result->Int32Value(env.local()).FromJust());
+    CheckMagicComments(script.ToLocalChecked(), expected_source_url,
                        expected_source_mapping_url);
   } else {
     CHECK(script.IsEmpty());
@@ -24477,6 +23190,56 @@
 }
 
 
+TEST(StreamingWithDebuggingEnabledLate) {
+  // The streaming parser can only parse lazily, i.e. inner functions are not
+  // fully parsed. However, we may compile inner functions eagerly when
+  // debugging. Make sure that we can deal with this when turning on debugging
+  // after streaming parser has already finished parsing.
+  i::FLAG_min_preparse_length = 0;
+  const char* chunks[] = {"with({x:1}) {",
+                          "  var foo = function foo(y) {",
+                          "    return x + y;",
+                          "  };",
+                          "  foo(2);",
+                          "}",
+                          NULL};
+
+  LocalContext env;
+  v8::Isolate* isolate = env->GetIsolate();
+  v8::HandleScope scope(isolate);
+  v8::TryCatch try_catch(isolate);
+
+  v8::ScriptCompiler::StreamedSource source(
+      new TestSourceStream(chunks),
+      v8::ScriptCompiler::StreamedSource::ONE_BYTE);
+  v8::ScriptCompiler::ScriptStreamingTask* task =
+      v8::ScriptCompiler::StartStreamingScript(isolate, &source);
+
+  task->Run();
+  delete task;
+
+  CHECK(!try_catch.HasCaught());
+
+  v8::ScriptOrigin origin(v8_str("http://foo.com"));
+  char* full_source = TestSourceStream::FullSourceString(chunks);
+
+  EnableDebugger(isolate);
+
+  v8::Local<Script> script =
+      v8::ScriptCompiler::Compile(env.local(), &source, v8_str(full_source),
+                                  origin)
+          .ToLocalChecked();
+
+  Maybe<uint32_t> result =
+      script->Run(env.local()).ToLocalChecked()->Uint32Value(env.local());
+  CHECK_EQ(3U, result.FromMaybe(0));
+
+  delete[] full_source;
+
+  DisableDebugger(isolate);
+}
+
+
 TEST(StreamingScriptWithInvalidUtf8) {
   // Regression test for a crash: test that invalid UTF-8 bytes in the end of a
   // chunk don't produce a crash.
@@ -24539,19 +23302,122 @@
 }
 
 
+TEST(StreamingWithHarmonyScopes) {
+  // Don't use RunStreamingTest here so that both scripts get to use the same
+  // LocalContext and HandleScope.
+  LocalContext env;
+  v8::Isolate* isolate = env->GetIsolate();
+  v8::HandleScope scope(isolate);
+
+  // First, run a script with a let variable.
+  CompileRun("\"use strict\"; let x = 1;");
+
+  // Then stream a script which (erroneously) tries to introduce the same
+  // variable again.
+  const char* chunks[] = {"\"use strict\"; let x = 2;", NULL};
+
+  v8::TryCatch try_catch(isolate);
+  v8::ScriptCompiler::StreamedSource source(
+      new TestSourceStream(chunks),
+      v8::ScriptCompiler::StreamedSource::ONE_BYTE);
+  v8::ScriptCompiler::ScriptStreamingTask* task =
+      v8::ScriptCompiler::StartStreamingScript(isolate, &source);
+  task->Run();
+  delete task;
+
+  // Parsing should succeed (the script will be parsed and compiled in a context
+  // independent way, so the error is not detected).
+  CHECK_EQ(false, try_catch.HasCaught());
+
+  v8::ScriptOrigin origin(v8_str("http://foo.com"));
+  char* full_source = TestSourceStream::FullSourceString(chunks);
+  v8::Local<Script> script =
+      v8::ScriptCompiler::Compile(env.local(), &source, v8_str(full_source),
+                                  origin)
+          .ToLocalChecked();
+  CHECK(!script.IsEmpty());
+  CHECK_EQ(false, try_catch.HasCaught());
+
+  // Running the script exposes the error.
+  CHECK(script->Run(env.local()).IsEmpty());
+  CHECK(try_catch.HasCaught());
+  delete[] full_source;
+}
+
+
+TEST(CodeCache) {
+  v8::Isolate::CreateParams create_params;
+  create_params.array_buffer_allocator = CcTest::array_buffer_allocator();
+
+  const char* source = "Math.sqrt(4)";
+  const char* origin = "code cache test";
+  v8::ScriptCompiler::CachedData* cache;
+
+  v8::Isolate* isolate1 = v8::Isolate::New(create_params);
+  {
+    v8::Isolate::Scope iscope(isolate1);
+    v8::HandleScope scope(isolate1);
+    v8::Local<v8::Context> context = v8::Context::New(isolate1);
+    v8::Context::Scope cscope(context);
+    v8::Local<v8::String> source_string = v8_str(source);
+    v8::ScriptOrigin script_origin(v8_str(origin));
+    v8::ScriptCompiler::Source source(source_string, script_origin);
+    v8::ScriptCompiler::CompileOptions option =
+        v8::ScriptCompiler::kProduceCodeCache;
+    v8::ScriptCompiler::Compile(context, &source, option).ToLocalChecked();
+    int length = source.GetCachedData()->length;
+    uint8_t* cache_data = new uint8_t[length];
+    memcpy(cache_data, source.GetCachedData()->data, length);
+    cache = new v8::ScriptCompiler::CachedData(
+        cache_data, length, v8::ScriptCompiler::CachedData::BufferOwned);
+  }
+  isolate1->Dispose();
+
+  v8::Isolate* isolate2 = v8::Isolate::New(create_params);
+  {
+    v8::Isolate::Scope iscope(isolate2);
+    v8::HandleScope scope(isolate2);
+    v8::Local<v8::Context> context = v8::Context::New(isolate2);
+    v8::Context::Scope cscope(context);
+    v8::Local<v8::String> source_string = v8_str(source);
+    v8::ScriptOrigin script_origin(v8_str(origin));
+    v8::ScriptCompiler::Source source(source_string, script_origin, cache);
+    v8::ScriptCompiler::CompileOptions option =
+        v8::ScriptCompiler::kConsumeCodeCache;
+    v8::Local<v8::Script> script;
+    {
+      i::DisallowCompilation no_compile(
+          reinterpret_cast<i::Isolate*>(isolate2));
+      script = v8::ScriptCompiler::Compile(context, &source, option)
+                   .ToLocalChecked();
+    }
+    CHECK_EQ(2, script->Run(context)
+                    .ToLocalChecked()
+                    ->ToInt32(context)
+                    .ToLocalChecked()
+                    ->Int32Value(context)
+                    .FromJust());
+  }
+  isolate2->Dispose();
+}
+
+
 void TestInvalidCacheData(v8::ScriptCompiler::CompileOptions option) {
   const char* garbage = "garbage garbage garbage garbage garbage garbage";
   const uint8_t* data = reinterpret_cast<const uint8_t*>(garbage);
   int length = 16;
   v8::ScriptCompiler::CachedData* cached_data =
       new v8::ScriptCompiler::CachedData(data, length);
-  DCHECK(!cached_data->rejected);
+  CHECK(!cached_data->rejected);
   v8::ScriptOrigin origin(v8_str("origin"));
   v8::ScriptCompiler::Source source(v8_str("42"), origin, cached_data);
-  v8::Handle<v8::Script> script =
-      v8::ScriptCompiler::Compile(CcTest::isolate(), &source, option);
+  v8::Local<v8::Context> context = CcTest::isolate()->GetCurrentContext();
+  v8::Local<v8::Script> script =
+      v8::ScriptCompiler::Compile(context, &source, option).ToLocalChecked();
   CHECK(cached_data->rejected);
-  CHECK_EQ(42, script->Run()->Int32Value());
+  CHECK_EQ(
+      42,
+      script->Run(context).ToLocalChecked()->Int32Value(context).FromJust());
 }
 
 
@@ -24573,9 +23439,11 @@
   v8::ScriptOrigin origin(v8_str("origin"));
   v8::Local<v8::String> source_str = v8_str("function foo() {}");
   v8::ScriptCompiler::Source source(source_str, origin);
-  v8::Handle<v8::Script> script = v8::ScriptCompiler::Compile(
-      CcTest::isolate(), &source, v8::ScriptCompiler::kProduceParserCache);
-  CHECK(!script.IsEmpty());
+  v8::Local<v8::Script> script =
+      v8::ScriptCompiler::Compile(context.local(), &source,
+                                  v8::ScriptCompiler::kProduceParserCache)
+          .ToLocalChecked();
+  USE(script);
   const v8::ScriptCompiler::CachedData* original_cached_data =
       source.GetCachedData();
   CHECK(original_cached_data != NULL);
@@ -24588,10 +23456,11 @@
         source_str, origin,
         new v8::ScriptCompiler::CachedData(original_cached_data->data,
                                            original_cached_data->length));
-    v8::Handle<v8::Script> script =
-        v8::ScriptCompiler::Compile(CcTest::isolate(), &source_with_cached_data,
-                                    v8::ScriptCompiler::kConsumeParserCache);
-    CHECK(!script.IsEmpty());
+    v8::Local<v8::Script> script =
+        v8::ScriptCompiler::Compile(context.local(), &source_with_cached_data,
+                                    v8::ScriptCompiler::kConsumeParserCache)
+            .ToLocalChecked();
+    USE(script);
     const v8::ScriptCompiler::CachedData* new_cached_data =
         source_with_cached_data.GetCachedData();
     CHECK(new_cached_data != NULL);
@@ -24607,10 +23476,11 @@
         incompatible_source_str, origin,
         new v8::ScriptCompiler::CachedData(original_cached_data->data,
                                            original_cached_data->length));
-    v8::Handle<v8::Script> script =
-        v8::ScriptCompiler::Compile(CcTest::isolate(), &source_with_cached_data,
-                                    v8::ScriptCompiler::kConsumeParserCache);
-    CHECK(!script.IsEmpty());
+    v8::Local<v8::Script> script =
+        v8::ScriptCompiler::Compile(context.local(), &source_with_cached_data,
+                                    v8::ScriptCompiler::kConsumeParserCache)
+            .ToLocalChecked();
+    USE(script);
     const v8::ScriptCompiler::CachedData* new_cached_data =
         source_with_cached_data.GetCachedData();
     CHECK(new_cached_data != NULL);
@@ -24624,9 +23494,10 @@
   v8::HandleScope scope(CcTest::isolate());
   RandomLengthOneByteResource* r =
       new RandomLengthOneByteResource(i::String::kMaxLength);
-  v8::Local<v8::String> str = v8::String::NewExternal(CcTest::isolate(), r);
+  v8::Local<v8::String> str =
+      v8::String::NewExternalOneByte(CcTest::isolate(), r).ToLocalChecked();
   CHECK(!str.IsEmpty());
-  v8::TryCatch try_catch;
+  v8::TryCatch try_catch(CcTest::isolate());
   v8::Local<v8::String> result = v8::String::Concat(str, str);
   CHECK(result.IsEmpty());
   CHECK(!try_catch.HasCaught());
@@ -24637,11 +23508,7 @@
   v8::V8::Initialize();
   v8::HandleScope scope(CcTest::isolate());
   LocalContext context;
-#if V8_TURBOFAN_TARGET
   bool should_be_neuterable = !i::FLAG_turbo_asm;
-#else
-  bool should_be_neuterable = true;
-#endif
   const char* load =
       "function Module(stdlib, foreign, heap) {"
       "  'use asm';"
@@ -24653,6 +23520,7 @@
       "Module(this, {}, buffer).load();"
       "buffer";
 
+  i::FLAG_turbo_osr = false;  // TODO(titzer): test requires eager TF.
   v8::Local<v8::ArrayBuffer> result = CompileRun(load).As<v8::ArrayBuffer>();
   CHECK_EQ(should_be_neuterable, result->IsNeuterable());
 
@@ -24667,6 +23535,7 @@
       "Module(this, {}, buffer).store();"
       "buffer";
 
+  i::FLAG_turbo_osr = false;  // TODO(titzer): test requires eager TF.
   result = CompileRun(store).As<v8::ArrayBuffer>();
   CHECK_EQ(should_be_neuterable, result->IsNeuterable());
 }
@@ -24678,21 +23547,18 @@
   v8::HandleScope handle_scope(isolate);
   LocalContext env;
 
-  v8::Handle<v8::ObjectTemplate> obj_template =
-      v8::ObjectTemplate::New(isolate);
-  obj_template->SetAccessCheckCallbacks(BlockEverythingNamed,
-                                        BlockEverythingIndexed);
+  v8::Local<v8::ObjectTemplate> obj_template = v8::ObjectTemplate::New(isolate);
+  obj_template->SetAccessCheckCallback(AccessAlwaysBlocked);
 
-  env->Global()->Set(v8_str("prohibited"), obj_template->NewInstance());
+  CHECK(env->Global()
+            ->Set(env.local(), v8_str("prohibited"),
+                  obj_template->NewInstance(env.local()).ToLocalChecked())
+            .FromJust());
 
-  {
-    v8::TryCatch try_catch;
-    CompileRun(
-        "function f() { %_GetPrototype(prohibited); }"
-        "%OptimizeFunctionOnNextCall(f);"
-        "f();");
-    CHECK(try_catch.HasCaught());
-  }
+  CHECK(CompileRun(
+            "function f() { return %_GetPrototype(prohibited); }"
+            "%OptimizeFunctionOnNextCall(f);"
+            "f();")->IsNull());
 }
 
 
@@ -24702,36 +23568,38 @@
   v8::HandleScope handle_scope(isolate);
   LocalContext env;
 
-  Handle<FunctionTemplate> t = FunctionTemplate::New(isolate);
+  Local<FunctionTemplate> t = FunctionTemplate::New(isolate);
   t->SetHiddenPrototype(true);
-  Handle<Object> proto = t->GetFunction()->NewInstance();
-  Handle<Object> object = Object::New(isolate);
-  Handle<Object> proto2 = Object::New(isolate);
-  object->SetPrototype(proto);
-  proto->SetPrototype(proto2);
+  Local<Object> proto = t->GetFunction(env.local())
+                            .ToLocalChecked()
+                            ->NewInstance(env.local())
+                            .ToLocalChecked();
+  Local<Object> object = Object::New(isolate);
+  Local<Object> proto2 = Object::New(isolate);
+  object->SetPrototype(env.local(), proto).FromJust();
+  proto->SetPrototype(env.local(), proto2).FromJust();
 
-  env->Global()->Set(v8_str("object"), object);
-  env->Global()->Set(v8_str("proto"), proto);
-  env->Global()->Set(v8_str("proto2"), proto2);
+  CHECK(env->Global()->Set(env.local(), v8_str("object"), object).FromJust());
+  CHECK(env->Global()->Set(env.local(), v8_str("proto"), proto).FromJust());
+  CHECK(env->Global()->Set(env.local(), v8_str("proto2"), proto2).FromJust());
 
-  v8::Handle<v8::Value> result = CompileRun("%_GetPrototype(object)");
-  CHECK(result->Equals(proto2));
+  v8::Local<v8::Value> result = CompileRun("%_GetPrototype(object)");
+  CHECK(result->Equals(env.local(), proto2).FromJust());
 
   result = CompileRun(
       "function f() { return %_GetPrototype(object); }"
       "%OptimizeFunctionOnNextCall(f);"
       "f()");
-  CHECK(result->Equals(proto2));
+  CHECK(result->Equals(env.local(), proto2).FromJust());
 }
 
 
 TEST(ClassPrototypeCreationContext) {
-  i::FLAG_harmony_classes = true;
   v8::Isolate* isolate = CcTest::isolate();
   v8::HandleScope handle_scope(isolate);
   LocalContext env;
 
-  Handle<Object> result = Handle<Object>::Cast(
+  Local<Object> result = Local<Object>::Cast(
       CompileRun("'use strict'; class Example { }; Example.prototype"));
   CHECK(env.local() == result->CreationContext());
 }
@@ -24759,3 +23627,833 @@
   RunStreamingTest(chunks, v8::ScriptCompiler::StreamedSource::UTF8, true, NULL,
                    "bar2.js");
 }
+
+
+TEST(NewStringRangeError) {
+  v8::Isolate* isolate = CcTest::isolate();
+  v8::HandleScope handle_scope(isolate);
+  const int length = i::String::kMaxLength + 1;
+  const int buffer_size = length * sizeof(uint16_t);
+  void* buffer = malloc(buffer_size);
+  if (buffer == NULL) return;
+  memset(buffer, 'A', buffer_size);
+  {
+    v8::TryCatch try_catch(isolate);
+    char* data = reinterpret_cast<char*>(buffer);
+    CHECK(v8::String::NewFromUtf8(isolate, data, v8::NewStringType::kNormal,
+                                  length)
+              .IsEmpty());
+    CHECK(!try_catch.HasCaught());
+  }
+  {
+    v8::TryCatch try_catch(isolate);
+    uint8_t* data = reinterpret_cast<uint8_t*>(buffer);
+    CHECK(v8::String::NewFromOneByte(isolate, data, v8::NewStringType::kNormal,
+                                     length)
+              .IsEmpty());
+    CHECK(!try_catch.HasCaught());
+  }
+  {
+    v8::TryCatch try_catch(isolate);
+    uint16_t* data = reinterpret_cast<uint16_t*>(buffer);
+    CHECK(v8::String::NewFromTwoByte(isolate, data, v8::NewStringType::kNormal,
+                                     length)
+              .IsEmpty());
+    CHECK(!try_catch.HasCaught());
+  }
+  free(buffer);
+}
+
+
+TEST(SealHandleScope) {
+  v8::Isolate* isolate = CcTest::isolate();
+  v8::HandleScope handle_scope(isolate);
+  LocalContext env;
+
+  v8::SealHandleScope seal(isolate);
+
+  // Should fail
+  v8::Local<v8::Object> obj = v8::Object::New(isolate);
+
+  USE(obj);
+}
+
+
+TEST(SealHandleScopeNested) {
+  v8::Isolate* isolate = CcTest::isolate();
+  v8::HandleScope handle_scope(isolate);
+  LocalContext env;
+
+  v8::SealHandleScope seal(isolate);
+
+  {
+    v8::HandleScope handle_scope(isolate);
+
+    // Should work
+    v8::Local<v8::Object> obj = v8::Object::New(isolate);
+
+    USE(obj);
+  }
+}
+
+
+static bool access_was_called = false;
+
+
+static bool AccessAlwaysAllowedWithFlag(Local<v8::Context> accessing_context,
+                                        Local<v8::Object> accessed_object) {
+  access_was_called = true;
+  return true;
+}
+
+
+static bool AccessAlwaysBlockedWithFlag(Local<v8::Context> accessing_context,
+                                        Local<v8::Object> accessed_object) {
+  access_was_called = true;
+  return false;
+}
+
+
+TEST(StrongModeAccessCheckAllowed) {
+  i::FLAG_strong_mode = true;
+  v8::Isolate* isolate = CcTest::isolate();
+  v8::HandleScope handle_scope(isolate);
+  v8::Local<Value> value;
+  access_was_called = false;
+
+  v8::Local<v8::ObjectTemplate> obj_template = v8::ObjectTemplate::New(isolate);
+
+  obj_template->Set(v8_str("x"), v8::Integer::New(isolate, 42));
+  obj_template->SetAccessCheckCallback(AccessAlwaysAllowedWithFlag);
+
+  // Create an environment
+  v8::Local<Context> context0 = Context::New(isolate, NULL, obj_template);
+  context0->Enter();
+  v8::Local<v8::Object> global0 = context0->Global();
+  global0->Set(context0, v8_str("object"),
+               obj_template->NewInstance(context0).ToLocalChecked())
+      .FromJust();
+  {
+    v8::TryCatch try_catch(isolate);
+    value = CompileRun("'use strong'; object.x");
+    CHECK(!try_catch.HasCaught());
+    CHECK(!access_was_called);
+    CHECK_EQ(42, value->Int32Value(context0).FromJust());
+  }
+  {
+    v8::TryCatch try_catch(isolate);
+    value = CompileRun("'use strong'; object.foo");
+    CHECK(try_catch.HasCaught());
+    CHECK(!access_was_called);
+  }
+  {
+    v8::TryCatch try_catch(isolate);
+    value = CompileRun("'use strong'; object[10]");
+    CHECK(try_catch.HasCaught());
+    CHECK(!access_was_called);
+  }
+
+  // Create an environment
+  v8::Local<Context> context1 = Context::New(isolate);
+  context1->Enter();
+  v8::Local<v8::Object> global1 = context1->Global();
+  global1->Set(context1, v8_str("object"),
+               obj_template->NewInstance(context1).ToLocalChecked())
+      .FromJust();
+  {
+    v8::TryCatch try_catch(isolate);
+    value = CompileRun("'use strong'; object.x");
+    CHECK(!try_catch.HasCaught());
+    CHECK(access_was_called);
+    CHECK_EQ(42, value->Int32Value(context1).FromJust());
+  }
+  access_was_called = false;
+  {
+    v8::TryCatch try_catch(isolate);
+    value = CompileRun("'use strong'; object.foo");
+    CHECK(try_catch.HasCaught());
+    CHECK(access_was_called);
+  }
+  access_was_called = false;
+  {
+    v8::TryCatch try_catch(isolate);
+    value = CompileRun("'use strong'; object[10]");
+    CHECK(try_catch.HasCaught());
+    CHECK(access_was_called);
+  }
+
+  context1->Exit();
+  context0->Exit();
+}
+
+
+TEST(StrongModeAccessCheckBlocked) {
+  i::FLAG_strong_mode = true;
+  v8::Isolate* isolate = CcTest::isolate();
+  v8::HandleScope handle_scope(isolate);
+  v8::Local<Value> value;
+  access_was_called = false;
+
+  v8::Local<v8::ObjectTemplate> obj_template = v8::ObjectTemplate::New(isolate);
+
+  obj_template->Set(v8_str("x"), v8::Integer::New(isolate, 42));
+  obj_template->SetAccessCheckCallback(AccessAlwaysBlockedWithFlag);
+
+  // Create an environment
+  v8::Local<Context> context0 = Context::New(isolate, NULL, obj_template);
+  context0->Enter();
+  v8::Local<v8::Object> global0 = context0->Global();
+  global0->Set(context0, v8_str("object"),
+               obj_template->NewInstance(context0).ToLocalChecked())
+      .FromJust();
+  {
+    v8::TryCatch try_catch(isolate);
+    value = CompileRun("'use strong'; object.x");
+    CHECK(!try_catch.HasCaught());
+    CHECK(!access_was_called);
+    CHECK_EQ(42, value->Int32Value(context0).FromJust());
+  }
+  {
+    v8::TryCatch try_catch(isolate);
+    value = CompileRun("'use strong'; object.foo");
+    CHECK(try_catch.HasCaught());
+    CHECK(!access_was_called);
+  }
+  {
+    v8::TryCatch try_catch(isolate);
+    value = CompileRun("'use strong'; object[10]");
+    CHECK(try_catch.HasCaught());
+    CHECK(!access_was_called);
+  }
+
+  // Create an environment
+  v8::Local<Context> context1 = Context::New(isolate);
+  context1->Enter();
+  v8::Local<v8::Object> global1 = context1->Global();
+  global1->Set(context1, v8_str("object"),
+               obj_template->NewInstance(context1).ToLocalChecked())
+      .FromJust();
+  {
+    v8::TryCatch try_catch(isolate);
+    value = CompileRun("'use strong'; object.x");
+    CHECK(try_catch.HasCaught());
+    CHECK(access_was_called);
+  }
+  access_was_called = false;
+  {
+    v8::TryCatch try_catch(isolate);
+    value = CompileRun("'use strong'; object.foo");
+    CHECK(try_catch.HasCaught());
+    CHECK(access_was_called);
+  }
+  access_was_called = false;
+  {
+    v8::TryCatch try_catch(isolate);
+    value = CompileRun("'use strong'; object[10]");
+    CHECK(try_catch.HasCaught());
+    CHECK(access_was_called);
+  }
+
+  context1->Exit();
+  context0->Exit();
+}
+
+
+TEST(StrongModeArityCallFromApi) {
+  i::FLAG_strong_mode = true;
+  LocalContext env;
+  v8::Isolate* isolate = env->GetIsolate();
+  v8::HandleScope scope(isolate);
+  Local<Function> fun;
+  {
+    v8::TryCatch try_catch(isolate);
+    fun = Local<Function>::Cast(CompileRun(
+        "function f(x) { 'use strong'; }"
+        "f"));
+
+    CHECK(!try_catch.HasCaught());
+  }
+
+  {
+    v8::TryCatch try_catch(isolate);
+    CHECK(fun->Call(env.local(), v8::Undefined(isolate), 0, nullptr).IsEmpty());
+    CHECK(try_catch.HasCaught());
+  }
+
+  {
+    v8::TryCatch try_catch(isolate);
+    v8::Local<Value> args[] = {v8_num(42)};
+    fun->Call(env.local(), v8::Undefined(isolate), arraysize(args), args)
+        .ToLocalChecked();
+    CHECK(!try_catch.HasCaught());
+  }
+
+  {
+    v8::TryCatch try_catch(isolate);
+    v8::Local<Value> args[] = {v8_num(42), v8_num(555)};
+    fun->Call(env.local(), v8::Undefined(isolate), arraysize(args), args)
+        .ToLocalChecked();
+    CHECK(!try_catch.HasCaught());
+  }
+}
+
+
+TEST(StrongModeArityCallFromApi2) {
+  i::FLAG_strong_mode = true;
+  LocalContext env;
+  v8::Isolate* isolate = env->GetIsolate();
+  v8::HandleScope scope(isolate);
+  Local<Function> fun;
+  {
+    v8::TryCatch try_catch(isolate);
+    fun = Local<Function>::Cast(CompileRun(
+        "'use strong';"
+        "function f(x) {}"
+        "f"));
+
+    CHECK(!try_catch.HasCaught());
+  }
+
+  {
+    v8::TryCatch try_catch(isolate);
+    CHECK(fun->Call(env.local(), v8::Undefined(isolate), 0, nullptr).IsEmpty());
+    CHECK(try_catch.HasCaught());
+  }
+
+  {
+    v8::TryCatch try_catch(isolate);
+    v8::Local<Value> args[] = {v8_num(42)};
+    fun->Call(env.local(), v8::Undefined(isolate), arraysize(args), args)
+        .ToLocalChecked();
+    CHECK(!try_catch.HasCaught());
+  }
+
+  {
+    v8::TryCatch try_catch(isolate);
+    v8::Local<Value> args[] = {v8_num(42), v8_num(555)};
+    fun->Call(env.local(), v8::Undefined(isolate), arraysize(args), args)
+        .ToLocalChecked();
+    CHECK(!try_catch.HasCaught());
+  }
+}
+
+
+TEST(StrongObjectDelete) {
+  i::FLAG_strong_mode = true;
+  LocalContext env;
+  v8::Isolate* isolate = env->GetIsolate();
+  v8::HandleScope scope(isolate);
+  Local<Object> obj;
+  {
+    v8::TryCatch try_catch(isolate);
+    obj = Local<Object>::Cast(CompileRun(
+        "'use strong';"
+        "({});"));
+    CHECK(!try_catch.HasCaught());
+  }
+  obj->DefineOwnProperty(env.local(), v8_str("foo"), v8_num(1), v8::None)
+      .FromJust();
+  obj->DefineOwnProperty(env.local(), v8_str("2"), v8_num(1), v8::None)
+      .FromJust();
+  CHECK(obj->HasOwnProperty(env.local(), v8_str("foo")).FromJust());
+  CHECK(obj->HasOwnProperty(env.local(), v8_str("2")).FromJust());
+  CHECK(!obj->Delete(env.local(), v8_str("foo")).FromJust());
+  CHECK(!obj->Delete(env.local(), 2).FromJust());
+}
+
+
+static void ExtrasBindingTestRuntimeFunction(
+    const v8::FunctionCallbackInfo<v8::Value>& args) {
+  CHECK_EQ(
+      3,
+      args[0]->Int32Value(args.GetIsolate()->GetCurrentContext()).FromJust());
+  args.GetReturnValue().Set(v8_num(7));
+}
+
+
+TEST(ExtrasBindingObject) {
+  v8::Isolate* isolate = CcTest::isolate();
+  v8::HandleScope handle_scope(isolate);
+  LocalContext env;
+
+  // standalone.gypi ensures we include the test-extra.js file, which should
+  // export the tested functions.
+  v8::Local<v8::Object> binding = env->GetExtrasBindingObject();
+
+  auto func = binding->Get(env.local(), v8_str("testExtraShouldReturnFive"))
+                  .ToLocalChecked()
+                  .As<v8::Function>();
+  auto undefined = v8::Undefined(isolate);
+  auto result = func->Call(env.local(), undefined, 0, {})
+                    .ToLocalChecked()
+                    .As<v8::Number>();
+  CHECK_EQ(5, result->Int32Value(env.local()).FromJust());
+
+  v8::Local<v8::FunctionTemplate> runtimeFunction =
+      v8::FunctionTemplate::New(isolate, ExtrasBindingTestRuntimeFunction);
+  binding->Set(env.local(), v8_str("runtime"),
+               runtimeFunction->GetFunction(env.local()).ToLocalChecked())
+      .FromJust();
+  func = binding->Get(env.local(), v8_str("testExtraShouldCallToRuntime"))
+             .ToLocalChecked()
+             .As<v8::Function>();
+  result = func->Call(env.local(), undefined, 0, {})
+               .ToLocalChecked()
+               .As<v8::Number>();
+  CHECK_EQ(7, result->Int32Value(env.local()).FromJust());
+}
+
+
+TEST(ExperimentalExtras) {
+  i::FLAG_experimental_extras = true;
+
+  v8::Isolate* isolate = CcTest::isolate();
+  v8::HandleScope handle_scope(isolate);
+  LocalContext env;
+
+  // standalone.gypi ensures we include the test-experimental-extra.js file,
+  // which should export the tested functions.
+  v8::Local<v8::Object> binding = env->GetExtrasBindingObject();
+
+  auto func =
+      binding->Get(env.local(), v8_str("testExperimentalExtraShouldReturnTen"))
+          .ToLocalChecked()
+          .As<v8::Function>();
+  auto undefined = v8::Undefined(isolate);
+  auto result = func->Call(env.local(), undefined, 0, {})
+                    .ToLocalChecked()
+                    .As<v8::Number>();
+  CHECK_EQ(10, result->Int32Value(env.local()).FromJust());
+
+  v8::Local<v8::FunctionTemplate> runtimeFunction =
+      v8::FunctionTemplate::New(isolate, ExtrasBindingTestRuntimeFunction);
+  binding->Set(env.local(), v8_str("runtime"),
+               runtimeFunction->GetFunction(env.local()).ToLocalChecked())
+      .FromJust();
+  func = binding->Get(env.local(),
+                      v8_str("testExperimentalExtraShouldCallToRuntime"))
+             .ToLocalChecked()
+             .As<v8::Function>();
+  result = func->Call(env.local(), undefined, 0, {})
+               .ToLocalChecked()
+               .As<v8::Number>();
+  CHECK_EQ(7, result->Int32Value(env.local()).FromJust());
+}
+
+
+TEST(ExtrasUtilsObject) {
+  LocalContext context;
+  v8::Isolate* isolate = context->GetIsolate();
+  v8::HandleScope handle_scope(isolate);
+
+  LocalContext env;
+  v8::Local<v8::Object> binding = env->GetExtrasBindingObject();
+
+  auto func = binding->Get(env.local(), v8_str("testExtraCanUseUtils"))
+                  .ToLocalChecked()
+                  .As<v8::Function>();
+  auto undefined = v8::Undefined(isolate);
+  auto result = func->Call(env.local(), undefined, 0, {})
+                    .ToLocalChecked()
+                    .As<v8::Object>();
+
+  auto private_symbol = result->Get(env.local(), v8_str("privateSymbol"))
+                            .ToLocalChecked()
+                            .As<v8::Symbol>();
+  i::Handle<i::Symbol> ips = v8::Utils::OpenHandle(*private_symbol);
+  CHECK_EQ(true, ips->IsPrivate());
+
+  CompileRun("var result = 0; function store(x) { result = x; }");
+  auto store = CompileRun("store").As<v8::Function>();
+
+  auto fulfilled_promise = result->Get(env.local(), v8_str("fulfilledPromise"))
+                               .ToLocalChecked()
+                               .As<v8::Promise>();
+  fulfilled_promise->Then(env.local(), store).ToLocalChecked();
+  isolate->RunMicrotasks();
+  CHECK_EQ(1, CompileRun("result")->Int32Value(env.local()).FromJust());
+
+  auto fulfilled_promise_2 =
+      result->Get(env.local(), v8_str("fulfilledPromise2"))
+          .ToLocalChecked()
+          .As<v8::Promise>();
+  fulfilled_promise_2->Then(env.local(), store).ToLocalChecked();
+  isolate->RunMicrotasks();
+  CHECK_EQ(2, CompileRun("result")->Int32Value(env.local()).FromJust());
+
+  auto rejected_promise = result->Get(env.local(), v8_str("rejectedPromise"))
+                              .ToLocalChecked()
+                              .As<v8::Promise>();
+  rejected_promise->Catch(env.local(), store).ToLocalChecked();
+  isolate->RunMicrotasks();
+  CHECK_EQ(3, CompileRun("result")->Int32Value(env.local()).FromJust());
+}
+
+
+TEST(Map) {
+  v8::Isolate* isolate = CcTest::isolate();
+  v8::HandleScope handle_scope(isolate);
+  LocalContext env;
+
+  v8::Local<v8::Map> map = v8::Map::New(isolate);
+  CHECK(map->IsObject());
+  CHECK(map->IsMap());
+  CHECK(map->GetPrototype()->StrictEquals(CompileRun("Map.prototype")));
+  CHECK_EQ(0U, map->Size());
+
+  v8::Local<v8::Value> val = CompileRun("new Map([[1, 2], [3, 4]])");
+  CHECK(val->IsMap());
+  map = v8::Local<v8::Map>::Cast(val);
+  CHECK_EQ(2U, map->Size());
+
+  v8::Local<v8::Array> contents = map->AsArray();
+  CHECK_EQ(4U, contents->Length());
+  CHECK_EQ(
+      1,
+      contents->Get(env.local(), 0).ToLocalChecked().As<v8::Int32>()->Value());
+  CHECK_EQ(
+      2,
+      contents->Get(env.local(), 1).ToLocalChecked().As<v8::Int32>()->Value());
+  CHECK_EQ(
+      3,
+      contents->Get(env.local(), 2).ToLocalChecked().As<v8::Int32>()->Value());
+  CHECK_EQ(
+      4,
+      contents->Get(env.local(), 3).ToLocalChecked().As<v8::Int32>()->Value());
+
+  CHECK_EQ(2U, map->Size());
+
+  CHECK(map->Has(env.local(), v8::Integer::New(isolate, 1)).FromJust());
+  CHECK(map->Has(env.local(), v8::Integer::New(isolate, 3)).FromJust());
+
+  CHECK(!map->Has(env.local(), v8::Integer::New(isolate, 2)).FromJust());
+  CHECK(!map->Has(env.local(), map).FromJust());
+
+  CHECK_EQ(2, map->Get(env.local(), v8::Integer::New(isolate, 1))
+                  .ToLocalChecked()
+                  ->Int32Value(env.local())
+                  .FromJust());
+  CHECK_EQ(4, map->Get(env.local(), v8::Integer::New(isolate, 3))
+                  .ToLocalChecked()
+                  ->Int32Value(env.local())
+                  .FromJust());
+
+  CHECK(map->Get(env.local(), v8::Integer::New(isolate, 42))
+            .ToLocalChecked()
+            ->IsUndefined());
+
+  CHECK(!map->Set(env.local(), map, map).IsEmpty());
+  CHECK_EQ(3U, map->Size());
+  CHECK(map->Has(env.local(), map).FromJust());
+
+  CHECK(map->Delete(env.local(), map).FromJust());
+  CHECK_EQ(2U, map->Size());
+  CHECK(!map->Has(env.local(), map).FromJust());
+  CHECK(!map->Delete(env.local(), map).FromJust());
+
+  map->Clear();
+  CHECK_EQ(0U, map->Size());
+}
+
+
+TEST(Set) {
+  v8::Isolate* isolate = CcTest::isolate();
+  v8::HandleScope handle_scope(isolate);
+  LocalContext env;
+
+  v8::Local<v8::Set> set = v8::Set::New(isolate);
+  CHECK(set->IsObject());
+  CHECK(set->IsSet());
+  CHECK(set->GetPrototype()->StrictEquals(CompileRun("Set.prototype")));
+  CHECK_EQ(0U, set->Size());
+
+  v8::Local<v8::Value> val = CompileRun("new Set([1, 2])");
+  CHECK(val->IsSet());
+  set = v8::Local<v8::Set>::Cast(val);
+  CHECK_EQ(2U, set->Size());
+
+  v8::Local<v8::Array> keys = set->AsArray();
+  CHECK_EQ(2U, keys->Length());
+  CHECK_EQ(1,
+           keys->Get(env.local(), 0).ToLocalChecked().As<v8::Int32>()->Value());
+  CHECK_EQ(2,
+           keys->Get(env.local(), 1).ToLocalChecked().As<v8::Int32>()->Value());
+
+  CHECK_EQ(2U, set->Size());
+
+  CHECK(set->Has(env.local(), v8::Integer::New(isolate, 1)).FromJust());
+  CHECK(set->Has(env.local(), v8::Integer::New(isolate, 2)).FromJust());
+
+  CHECK(!set->Has(env.local(), v8::Integer::New(isolate, 3)).FromJust());
+  CHECK(!set->Has(env.local(), set).FromJust());
+
+  CHECK(!set->Add(env.local(), set).IsEmpty());
+  CHECK_EQ(3U, set->Size());
+  CHECK(set->Has(env.local(), set).FromJust());
+
+  CHECK(set->Delete(env.local(), set).FromJust());
+  CHECK_EQ(2U, set->Size());
+  CHECK(!set->Has(env.local(), set).FromJust());
+  CHECK(!set->Delete(env.local(), set).FromJust());
+
+  set->Clear();
+  CHECK_EQ(0U, set->Size());
+}
+
+
+TEST(CompatibleReceiverCheckOnCachedICHandler) {
+  v8::Isolate* isolate = CcTest::isolate();
+  v8::HandleScope scope(isolate);
+  v8::Local<v8::FunctionTemplate> parent = FunctionTemplate::New(isolate);
+  v8::Local<v8::Signature> signature = v8::Signature::New(isolate, parent);
+  auto returns_42 =
+      v8::FunctionTemplate::New(isolate, Returns42, Local<Value>(), signature);
+  parent->PrototypeTemplate()->SetAccessorProperty(v8_str("age"), returns_42);
+  v8::Local<v8::FunctionTemplate> child = v8::FunctionTemplate::New(isolate);
+  child->Inherit(parent);
+  LocalContext env;
+  CHECK(env->Global()
+            ->Set(env.local(), v8_str("Child"),
+                  child->GetFunction(env.local()).ToLocalChecked())
+            .FromJust());
+
+  // Make sure there's a compiled stub for "Child.prototype.age" in the cache.
+  CompileRun(
+      "var real = new Child();\n"
+      "for (var i = 0; i < 3; ++i) {\n"
+      "  real.age;\n"
+      "}\n");
+
+  // Check that the cached stub is never used.
+  ExpectInt32(
+      "var fake = Object.create(Child.prototype);\n"
+      "var result = 0;\n"
+      "function test(d) {\n"
+      "  if (d == 3) return;\n"
+      "  try {\n"
+      "    fake.age;\n"
+      "    result = 1;\n"
+      "  } catch (e) {\n"
+      "  }\n"
+      "  test(d+1);\n"
+      "}\n"
+      "test(0);\n"
+      "result;\n",
+      0);
+}
+
+class FutexInterruptionThread : public v8::base::Thread {
+ public:
+  explicit FutexInterruptionThread(v8::Isolate* isolate)
+      : Thread(Options("FutexInterruptionThread")), isolate_(isolate) {}
+
+  virtual void Run() {
+    // Wait a bit before terminating.
+    v8::base::OS::Sleep(v8::base::TimeDelta::FromMilliseconds(100));
+    isolate_->TerminateExecution();
+  }
+
+ private:
+  v8::Isolate* isolate_;
+};
+
+
+TEST(FutexInterruption) {
+  i::FLAG_harmony_sharedarraybuffer = true;
+  v8::Isolate* isolate = CcTest::isolate();
+  v8::HandleScope scope(isolate);
+  LocalContext env;
+
+  FutexInterruptionThread timeout_thread(isolate);
+
+  v8::TryCatch try_catch(CcTest::isolate());
+  timeout_thread.Start();
+
+  CompileRun(
+      "var ab = new SharedArrayBuffer(4);"
+      "var i32a = new Int32Array(ab);"
+      "Atomics.futexWait(i32a, 0, 0);");
+  CHECK(try_catch.HasTerminated());
+  timeout_thread.Join();
+}
+
+
+TEST(EstimatedContextSize) {
+  v8::Isolate* isolate = CcTest::isolate();
+  v8::HandleScope scope(isolate);
+  LocalContext env;
+  CHECK(50000 < env->EstimatedSize());
+}
+
+
+static int nb_uncaught_exception_callback_calls = 0;
+
+
+bool NoAbortOnUncaughtException(v8::Isolate* isolate) {
+  ++nb_uncaught_exception_callback_calls;
+  return false;
+}
+
+
+TEST(AbortOnUncaughtExceptionNoAbort) {
+  v8::Isolate* isolate = CcTest::isolate();
+  v8::HandleScope handle_scope(isolate);
+  v8::Local<v8::ObjectTemplate> global_template =
+      v8::ObjectTemplate::New(isolate);
+  LocalContext env(NULL, global_template);
+
+  i::FLAG_abort_on_uncaught_exception = true;
+  isolate->SetAbortOnUncaughtExceptionCallback(NoAbortOnUncaughtException);
+
+  CompileRun("function boom() { throw new Error(\"boom\") }");
+
+  v8::Local<v8::Object> global_object = env->Global();
+  v8::Local<v8::Function> foo = v8::Local<v8::Function>::Cast(
+      global_object->Get(env.local(), v8_str("boom")).ToLocalChecked());
+
+  CHECK(foo->Call(env.local(), global_object, 0, NULL).IsEmpty());
+
+  CHECK_EQ(1, nb_uncaught_exception_callback_calls);
+}
+
+
+TEST(AccessCheckedIsConcatSpreadable) {
+  i::FLAG_harmony_concat_spreadable = true;
+  v8::Isolate* isolate = CcTest::isolate();
+  HandleScope scope(isolate);
+  LocalContext env;
+
+  // Object with access check
+  Local<ObjectTemplate> spreadable_template = v8::ObjectTemplate::New(isolate);
+  spreadable_template->SetAccessCheckCallback(AccessBlocker);
+  spreadable_template->Set(v8::Symbol::GetIsConcatSpreadable(isolate),
+                           v8::Boolean::New(isolate, true));
+  Local<Object> object =
+      spreadable_template->NewInstance(env.local()).ToLocalChecked();
+
+  allowed_access = true;
+  CHECK(env->Global()->Set(env.local(), v8_str("object"), object).FromJust());
+  object->Set(env.local(), v8_str("length"), v8_num(2)).FromJust();
+  object->Set(env.local(), 0U, v8_str("a")).FromJust();
+  object->Set(env.local(), 1U, v8_str("b")).FromJust();
+
+  // Access check is allowed, and the object is spread
+  CompileRun("var result = [].concat(object)");
+  ExpectTrue("Array.isArray(result)");
+  ExpectString("result[0]", "a");
+  ExpectString("result[1]", "b");
+  ExpectTrue("result.length === 2");
+  ExpectTrue("object[Symbol.isConcatSpreadable]");
+
+  // If access check fails, the value of @@isConcatSpreadable is ignored
+  allowed_access = false;
+  CompileRun("var result = [].concat(object)");
+  ExpectTrue("Array.isArray(result)");
+  ExpectTrue("result[0] === object");
+  ExpectTrue("result.length === 1");
+  ExpectTrue("object[Symbol.isConcatSpreadable] === undefined");
+}
+
+
+TEST(AccessCheckedToStringTag) {
+  i::FLAG_harmony_tostring = true;
+  v8::Isolate* isolate = CcTest::isolate();
+  HandleScope scope(isolate);
+  LocalContext env;
+
+  // Object with access check
+  Local<ObjectTemplate> object_template = v8::ObjectTemplate::New(isolate);
+  object_template->SetAccessCheckCallback(AccessBlocker);
+  Local<Object> object =
+      object_template->NewInstance(env.local()).ToLocalChecked();
+
+  allowed_access = true;
+  env->Global()->Set(env.local(), v8_str("object"), object).FromJust();
+  object->Set(env.local(), v8::Symbol::GetToStringTag(isolate), v8_str("hello"))
+      .FromJust();
+
+  // Access check is allowed, and the toStringTag is read
+  CompileRun("var result = Object.prototype.toString.call(object)");
+  ExpectString("result", "[object hello]");
+  ExpectString("object[Symbol.toStringTag]", "hello");
+
+  // ToString through the API should succeed too.
+  String::Utf8Value result_allowed(
+      object->ObjectProtoToString(env.local()).ToLocalChecked());
+  CHECK_EQ(0, strcmp(*result_allowed, "[object hello]"));
+
+  // If access check fails, the value of @@toStringTag is ignored
+  allowed_access = false;
+  CompileRun("var result = Object.prototype.toString.call(object)");
+  ExpectString("result", "[object Object]");
+  ExpectTrue("object[Symbol.toStringTag] === undefined");
+
+  // ToString through the API should also fail.
+  String::Utf8Value result_denied(
+      object->ObjectProtoToString(env.local()).ToLocalChecked());
+  CHECK_EQ(0, strcmp(*result_denied, "[object Object]"));
+}
+
+
+TEST(ObjectTemplateIntrinsics) {
+  v8::Isolate* isolate = CcTest::isolate();
+  v8::HandleScope scope(isolate);
+  LocalContext env;
+
+  Local<ObjectTemplate> object_template = v8::ObjectTemplate::New(isolate);
+  object_template->SetIntrinsicDataProperty(v8_str("values"),
+                                            v8::kArrayProto_values);
+  Local<Object> object =
+      object_template->NewInstance(env.local()).ToLocalChecked();
+
+  CHECK(env->Global()->Set(env.local(), v8_str("obj1"), object).FromJust());
+  ExpectString("typeof obj1.values", "function");
+
+  auto values = Local<Function>::Cast(
+      object->Get(env.local(), v8_str("values")).ToLocalChecked());
+  auto fn = i::Handle<i::JSFunction>::cast(v8::Utils::OpenHandle(*values));
+  auto ctx = v8::Utils::OpenHandle(*env.local());
+  CHECK_EQ(fn->GetCreationContext(), *ctx);
+
+  {
+    LocalContext env2;
+    Local<Object> object2 =
+        object_template->NewInstance(env2.local()).ToLocalChecked();
+    CHECK(
+        env2->Global()->Set(env2.local(), v8_str("obj2"), object2).FromJust());
+    ExpectString("typeof obj2.values", "function");
+    CHECK_NE(*object->Get(env2.local(), v8_str("values")).ToLocalChecked(),
+             *object2->Get(env2.local(), v8_str("values")).ToLocalChecked());
+
+    auto values2 = Local<Function>::Cast(
+        object2->Get(env2.local(), v8_str("values")).ToLocalChecked());
+    auto fn2 = i::Handle<i::JSFunction>::cast(v8::Utils::OpenHandle(*values2));
+    auto ctx2 = v8::Utils::OpenHandle(*env2.local());
+    CHECK_EQ(fn2->GetCreationContext(), *ctx2);
+  }
+}
+
+
+TEST(Proxy) {
+  i::FLAG_harmony_proxies = true;
+  LocalContext context;
+  v8::Isolate* isolate = CcTest::isolate();
+  v8::HandleScope scope(isolate);
+  v8::Local<v8::Object> target = CompileRun("({})").As<v8::Object>();
+  v8::Local<v8::Object> handler = CompileRun("({})").As<v8::Object>();
+
+  v8::Local<v8::Proxy> proxy =
+      v8::Proxy::New(context.local(), target, handler).ToLocalChecked();
+  CHECK(proxy->IsProxy());
+  CHECK(!target->IsProxy());
+  CHECK(!proxy->IsRevoked());
+  CHECK(proxy->GetTarget()->SameValue(target));
+  CHECK(proxy->GetHandler()->SameValue(handler));
+
+  proxy->Revoke();
+  CHECK(proxy->IsProxy());
+  CHECK(!target->IsProxy());
+  CHECK(proxy->IsRevoked());
+  CHECK(proxy->GetTarget()->SameValue(target));
+  CHECK(proxy->GetHandler()->IsNull());
+}