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 {
|
|
|
|
|
|
|
|
|
2015-07-06 07:09:07 +00:00
|
|
|
v8::Local<v8::FunctionTemplate> GCExtension::GetNativeFunctionTemplate(
|
|
|
|
v8::Isolate* isolate, v8::Local<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(
|
2015-06-03 10:27:46 +00:00
|
|
|
args[0]
|
|
|
|
->BooleanValue(args.GetIsolate()->GetCurrentContext())
|
|
|
|
.FromMaybe(false)
|
|
|
|
? v8::Isolate::kMinorGarbageCollection
|
|
|
|
: v8::Isolate::kFullGarbageCollection);
|
2010-11-17 12:28:30 +00:00
|
|
|
}
|
|
|
|
|
2015-06-01 22:46:54 +00:00
|
|
|
} // namespace internal
|
|
|
|
} // namespace v8
|