Version 3.19.15

Performance and stability improvements on all platforms.

git-svn-id: http://v8.googlecode.com/svn/trunk@15120 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
diff --git a/include/v8.h b/include/v8.h
index 6fcc332..d2a5322 100644
--- a/include/v8.h
+++ b/include/v8.h
@@ -123,7 +123,6 @@
 class Int32;
 class Integer;
 class Isolate;
-class LocalContext;
 class Number;
 class NumberObject;
 class Object;
@@ -162,8 +161,7 @@
 class HeapObject;
 class Isolate;
 class Object;
-template<typename T>
-class CustomArguments;
+template<typename T> class CustomArguments;
 class PropertyCallbackArguments;
 class FunctionCallbackArguments;
 }
@@ -365,21 +363,19 @@
 #endif
 
  private:
+  friend class Utils;
   template<class F> friend class Persistent;
   template<class F> friend class Local;
   friend class Arguments;
   template<class F> friend class FunctionCallbackInfo;
   template<class F> friend class PropertyCallbackInfo;
-  friend class String;
-  friend class Object;
+  template<class F> friend class internal::CustomArguments;
   friend class AccessorInfo;
   friend Handle<Primitive> Undefined(Isolate* isolate);
   friend Handle<Primitive> Null(Isolate* isolate);
   friend Handle<Boolean> True(Isolate* isolate);
   friend Handle<Boolean> False(Isolate* isolate);
   friend class Context;
-  friend class InternalHandleHelper;
-  friend class LocalContext;
   friend class HandleScope;
 
 #ifndef V8_USE_UNSAFE_HANDLES
@@ -454,6 +450,7 @@
 #endif
 
  private:
+  friend class Utils;
   template<class F> friend class Persistent;
   template<class F> friend class Handle;
   friend class Arguments;
@@ -463,8 +460,7 @@
   friend class Object;
   friend class AccessorInfo;
   friend class Context;
-  friend class InternalHandleHelper;
-  friend class LocalContext;
+  template<class F> friend class internal::CustomArguments;
   friend class HandleScope;
 
   V8_INLINE(static Local<T> New(Isolate* isolate, T* that));
@@ -511,11 +507,11 @@
    * to be separately disposed.
    */
   template <class S> V8_INLINE(Persistent(Isolate* isolate, Handle<S> that))
-      : val_(*New(isolate, that)) { }
+      : val_(New(isolate, *that)) { }
 
   template <class S> V8_INLINE(Persistent(Isolate* isolate,
                                           Persistent<S>& that)) // NOLINT
-      : val_(*New(isolate, that)) { }
+      : val_(New(isolate, *that)) { }
 
 #else
   /**
@@ -594,15 +590,9 @@
   }
 #endif
 
+#ifdef V8_USE_UNSAFE_HANDLES
   V8_DEPRECATED(static Persistent<T> New(Handle<T> that));
-
-  /**
-   * Creates a new persistent handle for an existing local or persistent handle.
-   */
-  // TODO(dcarney): remove before cutover
   V8_INLINE(static Persistent<T> New(Isolate* isolate, Handle<T> that));
-#ifndef V8_USE_UNSAFE_HANDLES
-  // TODO(dcarney): remove before cutover
   V8_INLINE(static Persistent<T> New(Isolate* isolate, Persistent<T> that));
 #endif
 
@@ -652,23 +642,17 @@
       P* parameters,
       typename WeakReferenceCallbacks<T, P>::Revivable callback));
 
-  // TODO(dcarney): deprecate
   template<typename S, typename P>
-  V8_INLINE(void MakeWeak(
+  V8_DEPRECATED(void MakeWeak(
       Isolate* isolate,
       P* parameters,
-      typename WeakReferenceCallbacks<S, P>::Revivable callback)) {
-    MakeWeak<S, P>(parameters, callback);
-  }
+      typename WeakReferenceCallbacks<S, P>::Revivable callback));
 
-  // TODO(dcarney): deprecate
   template<typename P>
-  V8_INLINE(void MakeWeak(
+  V8_DEPRECATED(void MakeWeak(
       Isolate* isolate,
       P* parameters,
-      typename WeakReferenceCallbacks<T, P>::Revivable callback)) {
-    MakeWeak<P>(parameters, callback);
-  }
+      typename WeakReferenceCallbacks<T, P>::Revivable callback));
 
   V8_INLINE(void ClearWeak());
 
@@ -779,11 +763,7 @@
 #endif
   // TODO(dcarney): remove before cutover
   template <class S> V8_INLINE(Persistent(S* that)) : val_(that) { }
-  // TODO(dcarney): remove before cutover
-  template <class S> V8_INLINE(Persistent(Persistent<S> that))
-      : val_(*that) {
-    TYPE_CHECK(T, S);
-  }
+
   // TODO(dcarney): remove before cutover
   V8_INLINE(T* operator*() const) { return val_; }
 
@@ -794,16 +774,13 @@
 #endif
 
  private:
+  friend class Utils;
   template<class F> friend class Handle;
   template<class F> friend class Local;
+  template<class F> friend class Persistent;
   template<class F> friend class ReturnValue;
-  friend class ImplementationUtilities;
-  friend class ObjectTemplate;
-  friend class Context;
-  friend class InternalHandleHelper;
-  friend class LocalContext;
 
-  V8_INLINE(static Persistent<T> New(Isolate* isolate, T* that));
+  V8_INLINE(static T* New(Isolate* isolate, T* that));
 
 #ifndef V8_USE_UNSAFE_HANDLES
   T* val_;
@@ -5510,6 +5487,7 @@
 }
 
 
+#ifdef V8_USE_UNSAFE_HANDLES
 template <class T>
 Persistent<T> Persistent<T>::New(Handle<T> that) {
   return New(Isolate::GetCurrent(), that.val_);
@@ -5521,20 +5499,20 @@
   return New(Isolate::GetCurrent(), that.val_);
 }
 
-#ifndef V8_USE_UNSAFE_HANDLES
 template <class T>
 Persistent<T> Persistent<T>::New(Isolate* isolate, Persistent<T> that) {
   return New(Isolate::GetCurrent(), that.val_);
 }
 #endif
 
+
 template <class T>
-Persistent<T> Persistent<T>::New(Isolate* isolate, T* that) {
-  if (that == NULL) return Persistent<T>();
+T* Persistent<T>::New(Isolate* isolate, T* that) {
+  if (that == NULL) return NULL;
   internal::Object** p = reinterpret_cast<internal::Object**>(that);
-  return Persistent<T>(reinterpret_cast<T*>(
+  return reinterpret_cast<T*>(
       V8::GlobalizeReference(reinterpret_cast<internal::Isolate*>(isolate),
-                             p)));
+                             p));
 }
 
 
@@ -5598,6 +5576,26 @@
 
 
 template <class T>
+template <typename S, typename P>
+void Persistent<T>::MakeWeak(
+    Isolate* isolate,
+    P* parameters,
+    typename WeakReferenceCallbacks<S, P>::Revivable callback) {
+  MakeWeak<S, P>(parameters, callback);
+}
+
+
+template <class T>
+template<typename P>
+void Persistent<T>::MakeWeak(
+    Isolate* isolate,
+    P* parameters,
+    typename WeakReferenceCallbacks<T, P>::Revivable callback) {
+  MakeWeak<P>(parameters, callback);
+}
+
+
+template <class T>
 void Persistent<T>::ClearWeak() {
   V8::ClearWeak(reinterpret_cast<internal::Object**>(this->val_));
 }