Commit 800f9f7d authored by jochen@chromium.org's avatar jochen@chromium.org

Don't use Persistent in runtime

R=dcarney@chromium.org, mstarzinger@chromium.org
BUG=none

Review URL: https://codereview.chromium.org/22432009

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@16234 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
parent 76a820a9
......@@ -800,7 +800,7 @@ icu::SimpleDateFormat* DateFormat::UnpackDateFormat(
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 @@ icu::DecimalFormat* NumberFormat::UnpackNumberFormat(
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 @@ icu::Collator* Collator::UnpackCollator(Isolate* isolate,
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(
......
......@@ -71,7 +71,7 @@ class DateFormat {
// 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 @@ class NumberFormat {
// 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 @@ class Collator {
// 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();
......
......@@ -13631,11 +13631,11 @@ RUNTIME_FUNCTION(MaybeObject*, Runtime_CreateDateTimeFormat) {
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 @@ RUNTIME_FUNCTION(MaybeObject*, Runtime_CreateNumberFormat) {
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 @@ RUNTIME_FUNCTION(MaybeObject*, Runtime_CreateCollator) {
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;
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment