Revision: 16234
Author:   [email protected]
Date:     Tue Aug 20 08:07:52 2013 UTC
Log:      Don't use Persistent in runtime

[email protected], [email protected]
BUG=none

Review URL: https://codereview.chromium.org/22432009
http://code.google.com/p/v8/source/detail?r=16234

Modified:
 /branches/bleeding_edge/src/i18n.cc
 /branches/bleeding_edge/src/i18n.h
 /branches/bleeding_edge/src/runtime.cc

=======================================
--- /branches/bleeding_edge/src/i18n.cc Tue Aug 13 12:24:44 2013 UTC
+++ /branches/bleeding_edge/src/i18n.cc Tue Aug 20 08:07:52 2013 UTC
@@ -800,7 +800,7 @@


 void DateFormat::DeleteDateFormat(v8::Isolate* isolate,
-                                  Persistent<v8::Object>* object,
+                                  Persistent<v8::Value>* object,
                                   void* param) {
   // First delete the hidden C++ object.
   delete reinterpret_cast<icu::SimpleDateFormat*>(Handle<JSObject>::cast(
@@ -864,7 +864,7 @@


 void NumberFormat::DeleteNumberFormat(v8::Isolate* isolate,
-                                      Persistent<v8::Object>* object,
+                                      Persistent<v8::Value>* object,
                                       void* param) {
   // First delete the hidden C++ object.
   delete reinterpret_cast<icu::DecimalFormat*>(Handle<JSObject>::cast(
@@ -925,7 +925,7 @@


 void Collator::DeleteCollator(v8::Isolate* isolate,
-                              Persistent<v8::Object>* object,
+                              Persistent<v8::Value>* object,
                               void* param) {
   // First delete the hidden C++ object.
   delete reinterpret_cast<icu::Collator*>(Handle<JSObject>::cast(
=======================================
--- /branches/bleeding_edge/src/i18n.h  Fri Aug  9 09:51:09 2013 UTC
+++ /branches/bleeding_edge/src/i18n.h  Tue Aug 20 08:07:52 2013 UTC
@@ -71,7 +71,7 @@
   // Release memory we allocated for the DateFormat once the JS object that
   // holds the pointer gets garbage collected.
   static void DeleteDateFormat(v8::Isolate* isolate,
-                               Persistent<v8::Object>* object,
+                               Persistent<v8::Value>* object,
                                void* param);
  private:
   DateFormat();
@@ -95,7 +95,7 @@
// Release memory we allocated for the NumberFormat once the JS object that
   // holds the pointer gets garbage collected.
   static void DeleteNumberFormat(v8::Isolate* isolate,
-                                 Persistent<v8::Object>* object,
+                                 Persistent<v8::Value>* object,
                                  void* param);
  private:
   NumberFormat();
@@ -118,7 +118,7 @@
// Release memory we allocated for the Collator once the JS object that holds
   // the pointer gets garbage collected.
   static void DeleteCollator(v8::Isolate* isolate,
-                             Persistent<v8::Object>* object,
+                             Persistent<v8::Value>* object,
                              void* param);
  private:
   Collator();
=======================================
--- /branches/bleeding_edge/src/runtime.cc      Mon Aug 19 13:03:58 2013 UTC
+++ /branches/bleeding_edge/src/runtime.cc      Tue Aug 20 08:07:52 2013 UTC
@@ -13631,11 +13631,11 @@
           isolate->factory()->NewStringFromAscii(CStrVector("valid")),
           NONE));

-  Persistent<v8::Object> wrapper(reinterpret_cast<v8::Isolate*>(isolate),
-                                 v8::Utils::ToLocal(local_object));
// Make object handle weak so we can delete the data format once GC kicks in.
-  wrapper.MakeWeak<void>(NULL, &DateFormat::DeleteDateFormat);
-  wrapper.ClearAndLeak();
+ Handle<Object> wrapper = isolate->global_handles()->Create(*local_object);
+  GlobalHandles::MakeWeak(reinterpret_cast<Object**>(wrapper.location()),
+                          NULL,
+                          DateFormat::DeleteDateFormat);
   return *local_object;
 }

@@ -13734,12 +13734,10 @@
           isolate->factory()->NewStringFromAscii(CStrVector("valid")),
           NONE));

-  Persistent<v8::Object> wrapper(reinterpret_cast<v8::Isolate*>(isolate),
-                                 v8::Utils::ToLocal(local_object));
- // Make object handle weak so we can delete the number format once GC kicks
-  // in.
-  wrapper.MakeWeak<void>(NULL, &NumberFormat::DeleteNumberFormat);
-  wrapper.ClearAndLeak();
+ Handle<Object> wrapper = isolate->global_handles()->Create(*local_object);
+  GlobalHandles::MakeWeak(reinterpret_cast<Object**>(wrapper.location()),
+                          NULL,
+                          NumberFormat::DeleteNumberFormat);
   return *local_object;
 }

@@ -13847,11 +13845,10 @@
           isolate->factory()->NewStringFromAscii(CStrVector("valid")),
           NONE));

-  Persistent<v8::Object> wrapper(reinterpret_cast<v8::Isolate*>(isolate),
-                                 v8::Utils::ToLocal(local_object));
- // Make object handle weak so we can delete the collator once GC kicks in.
-  wrapper.MakeWeak<void>(NULL, &Collator::DeleteCollator);
-  wrapper.ClearAndLeak();
+ Handle<Object> wrapper = isolate->global_handles()->Create(*local_object);
+  GlobalHandles::MakeWeak(reinterpret_cast<Object**>(wrapper.location()),
+                          NULL,
+                          Collator::DeleteCollator);
   return *local_object;
 }

--
--
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev
--- You received this message because you are subscribed to the Google Groups "v8-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to