2010-11-17 12:28:30 +00:00
|
|
|
// Copyright 2010 the V8 project authors. All rights reserved.
|
2014-04-29 06:42:26 +00:00
|
|
|
// Use of this source code is governed by a BSD-style license that can be
|
|
|
|
// found in the LICENSE file.
|
2010-11-17 12:28:30 +00:00
|
|
|
|
2014-06-03 08:12:43 +00:00
|
|
|
#include "src/extensions/gc-extension.h"
|
2014-06-30 13:25:46 +00:00
|
|
|
|
|
|
|
#include "src/base/platform/platform.h"
|
2010-11-17 12:28:30 +00:00
|
|
|
|
|
|
|
namespace v8 {
|
|
|
|
namespace internal {
|
|
|
|
|
|
|
|
|
2013-11-28 08:21:26 +00:00
|
|
|
v8::Handle<v8::FunctionTemplate> GCExtension::GetNativeFunctionTemplate(
|
|
|
|
v8::Isolate* isolate,
|
2010-11-17 12:28:30 +00:00
|
|
|
v8::Handle<v8::String> str) {
|
2013-12-18 10:31:42 +00:00
|
|
|
return v8::FunctionTemplate::New(isolate, GCExtension::GC);
|
2010-11-17 12:28:30 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2013-06-05 12:36:33 +00:00
|
|
|
void GCExtension::GC(const v8::FunctionCallbackInfo<v8::Value>& args) {
|
2014-01-20 15:44:03 +00:00
|
|
|
args.GetIsolate()->RequestGarbageCollectionForTesting(
|
|
|
|
args[0]->BooleanValue() ? v8::Isolate::kMinorGarbageCollection
|
|
|
|
: v8::Isolate::kFullGarbageCollection);
|
2010-11-17 12:28:30 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
} } // namespace v8::internal
|