Reviewers: Michael Starzinger, Sven Panne,
Description:
Introduce an API mirroring the gc extension
BUG=none
[email protected],[email protected]
LOG=y
Please review this at https://codereview.chromium.org/133563003/
SVN Base: https://v8.googlecode.com/svn/branches/bleeding_edge
Affected files (+17, -0 lines):
include/v8.h
src/api.cc
Index: include/v8.h
diff --git a/include/v8.h b/include/v8.h
index
c56295ac78dd8a4c6561f97f12717e5972381520..28e752ad71e6c44d3759fd18294879c109764c4e
100644
--- a/include/v8.h
+++ b/include/v8.h
@@ -4184,6 +4184,12 @@ class V8_EXPORT Isolate {
*/
void ClearInterrupt();
+ /**
+ * Request garbage collection in this Isolate. If |minor| is true, a
+ * minor garbage collection is performed.
+ */
+ void RequestGarbageCollection(bool minor);
+
private:
Isolate();
Isolate(const Isolate&);
Index: src/api.cc
diff --git a/src/api.cc b/src/api.cc
index
db2045f8da97ce9727381743ff5133743d490f43..310a8d06e2a778fef395ff0a530a538f25a0dd39
100644
--- a/src/api.cc
+++ b/src/api.cc
@@ -6452,6 +6452,17 @@ void Isolate::ClearInterrupt() {
}
+void Isolate::RequestGarbageCollection(bool minor) {
+ if (minor) {
+ reinterpret_cast<i::Isolate*>(this)->heap()->CollectGarbage(
+ i::NEW_SPACE, "Isolate::RequestGarbageCollection");
+ } else {
+ reinterpret_cast<i::Isolate*>(this)->heap()->CollectAllGarbage(
+ i::Heap::kNoGCFlags, "Isolate::RequestGarbageCollection");
+ }
+}
+
+
Isolate* Isolate::GetCurrent() {
i::Isolate* isolate = i::Isolate::UncheckedCurrent();
return reinterpret_cast<Isolate*>(isolate);
--
--
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.