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/trace-extension.cc b/test/cctest/trace-extension.cc
index 0a1ff87..ea2b2ce 100644
--- a/test/cctest/trace-extension.cc
+++ b/test/cctest/trace-extension.cc
@@ -27,7 +27,8 @@
 
 #include "test/cctest/trace-extension.h"
 
-#include "src/sampler.h"
+#include "src/profiler/sampler.h"
+#include "src/vm-state-inl.h"
 #include "test/cctest/cctest.h"
 
 namespace v8 {
@@ -40,20 +41,35 @@
     "native function js_entry_sp_level2();";
 
 
-v8::Handle<v8::FunctionTemplate> TraceExtension::GetNativeFunctionTemplate(
-    v8::Isolate* isolate, v8::Handle<v8::String> name) {
-  if (name->Equals(v8::String::NewFromUtf8(isolate, "trace"))) {
+v8::Local<v8::FunctionTemplate> TraceExtension::GetNativeFunctionTemplate(
+    v8::Isolate* isolate, v8::Local<v8::String> name) {
+  v8::Local<v8::Context> context = isolate->GetCurrentContext();
+  if (name->Equals(context, v8::String::NewFromUtf8(isolate, "trace",
+                                                    v8::NewStringType::kNormal)
+                                .ToLocalChecked())
+          .FromJust()) {
     return v8::FunctionTemplate::New(isolate, TraceExtension::Trace);
-  } else if (name->Equals(v8::String::NewFromUtf8(isolate, "js_trace"))) {
+  } else if (name->Equals(context,
+                          v8::String::NewFromUtf8(isolate, "js_trace",
+                                                  v8::NewStringType::kNormal)
+                              .ToLocalChecked())
+                 .FromJust()) {
     return v8::FunctionTemplate::New(isolate, TraceExtension::JSTrace);
-  } else if (name->Equals(v8::String::NewFromUtf8(isolate, "js_entry_sp"))) {
+  } else if (name->Equals(context,
+                          v8::String::NewFromUtf8(isolate, "js_entry_sp",
+                                                  v8::NewStringType::kNormal)
+                              .ToLocalChecked())
+                 .FromJust()) {
     return v8::FunctionTemplate::New(isolate, TraceExtension::JSEntrySP);
-  } else if (name->Equals(v8::String::NewFromUtf8(isolate,
-                                                  "js_entry_sp_level2"))) {
+  } else if (name->Equals(context,
+                          v8::String::NewFromUtf8(isolate, "js_entry_sp_level2",
+                                                  v8::NewStringType::kNormal)
+                              .ToLocalChecked())
+                 .FromJust()) {
     return v8::FunctionTemplate::New(isolate, TraceExtension::JSEntrySPLevel2);
   } else {
     CHECK(false);
-    return v8::Handle<v8::FunctionTemplate>();
+    return v8::Local<v8::FunctionTemplate>();
   }
 }
 
@@ -97,6 +113,11 @@
 
 
 void TraceExtension::Trace(const v8::FunctionCallbackInfo<v8::Value>& args) {
+  i::Isolate* isolate = reinterpret_cast<i::Isolate*>(args.GetIsolate());
+  i::VMState<EXTERNAL> state(isolate);
+  Address address = reinterpret_cast<Address>(
+      reinterpret_cast<intptr_t>(&TraceExtension::Trace));
+  i::ExternalCallbackScope call_scope(isolate, address);
   DoTrace(GetFP(args));
 }
 
@@ -114,19 +135,24 @@
 
 
 void TraceExtension::JSTrace(const v8::FunctionCallbackInfo<v8::Value>& args) {
+  i::Isolate* isolate = reinterpret_cast<i::Isolate*>(args.GetIsolate());
+  i::VMState<EXTERNAL> state(isolate);
+  Address address = reinterpret_cast<Address>(
+      reinterpret_cast<intptr_t>(&TraceExtension::JSTrace));
+  i::ExternalCallbackScope call_scope(isolate, address);
   DoTraceHideCEntryFPAddress(GetFP(args));
 }
 
 
 Address TraceExtension::GetJsEntrySp() {
-  CHECK_NE(NULL, CcTest::i_isolate()->thread_local_top());
+  CHECK(CcTest::i_isolate()->thread_local_top());
   return CcTest::i_isolate()->js_entry_sp();
 }
 
 
 void TraceExtension::JSEntrySP(
     const v8::FunctionCallbackInfo<v8::Value>& args) {
-  CHECK_NE(0, GetJsEntrySp());
+  CHECK(GetJsEntrySp());
 }
 
 
@@ -134,10 +160,11 @@
     const v8::FunctionCallbackInfo<v8::Value>& args) {
   v8::HandleScope scope(args.GetIsolate());
   const Address js_entry_sp = GetJsEntrySp();
-  CHECK_NE(0, js_entry_sp);
+  CHECK(js_entry_sp);
   CompileRun("js_entry_sp();");
   CHECK_EQ(js_entry_sp, GetJsEntrySp());
 }
 
 
-} }  // namespace v8::internal
+}  // namespace internal
+}  // namespace v8