diff options
Diffstat (limited to 'deps/v8/src/extensions/gc-extension.cc')
-rw-r--r-- | deps/v8/src/extensions/gc-extension.cc | 28 |
1 files changed, 6 insertions, 22 deletions
diff --git a/deps/v8/src/extensions/gc-extension.cc b/deps/v8/src/extensions/gc-extension.cc index 308879115f..1d4873de73 100644 --- a/deps/v8/src/extensions/gc-extension.cc +++ b/deps/v8/src/extensions/gc-extension.cc @@ -32,33 +32,17 @@ namespace v8 { namespace internal { -v8::Handle<v8::FunctionTemplate> GCExtension::GetNativeFunction( +v8::Handle<v8::FunctionTemplate> GCExtension::GetNativeFunctionTemplate( + v8::Isolate* isolate, v8::Handle<v8::String> str) { - return v8::FunctionTemplate::New(GCExtension::GC); + return v8::FunctionTemplate::New(isolate, GCExtension::GC); } void GCExtension::GC(const v8::FunctionCallbackInfo<v8::Value>& args) { - i::Isolate* isolate = reinterpret_cast<i::Isolate*>(args.GetIsolate()); - if (args[0]->BooleanValue()) { - isolate->heap()->CollectGarbage(NEW_SPACE, "gc extension"); - } else { - isolate->heap()->CollectAllGarbage(Heap::kNoGCFlags, "gc extension"); - } -} - - -void GCExtension::Register() { - static char buffer[50]; - Vector<char> temp_vector(buffer, sizeof(buffer)); - if (FLAG_expose_gc_as != NULL && strlen(FLAG_expose_gc_as) != 0) { - OS::SNPrintF(temp_vector, "native function %s();", FLAG_expose_gc_as); - } else { - OS::SNPrintF(temp_vector, "native function gc();"); - } - - static GCExtension gc_extension(buffer); - static v8::DeclareExtension declaration(&gc_extension); + args.GetIsolate()->RequestGarbageCollectionForTesting( + args[0]->BooleanValue() ? v8::Isolate::kMinorGarbageCollection + : v8::Isolate::kFullGarbageCollection); } } } // namespace v8::internal |