Revision: 12815
Author: [email protected]
Date: Thu Oct 25 05:23:03 2012
Log: Expose gc(true) to JavaScript, which triggers a scavenger GC.
With the --expose_gc option, gc() is exposed to JavaScript. Currently gc()
triggers a full GC.
To enable JavaScript to test the behavior of a scavenger GC, this patch
exposes gc(true). If the first argument is true, gc(...) triggers a
scavenger GC. Otherwise, gc(...) triggers a full GC.
BUG=
Test=Manually confirmed that gc() and gc(false) trigger a full GC and that
gc(true) triggers a scavenger GC.
Review URL: https://codereview.chromium.org/11232065
Patch from Kentaro Hara <[email protected]>.
http://code.google.com/p/v8/source/detail?r=12815
Modified:
/branches/bleeding_edge/src/extensions/gc-extension.cc
=======================================
--- /branches/bleeding_edge/src/extensions/gc-extension.cc Thu Mar 29
02:45:46 2012
+++ /branches/bleeding_edge/src/extensions/gc-extension.cc Thu Oct 25
05:23:03 2012
@@ -40,7 +40,11 @@
v8::Handle<v8::Value> GCExtension::GC(const v8::Arguments& args) {
- HEAP->CollectAllGarbage(Heap::kNoGCFlags, "gc extension");
+ if (args[0]->BooleanValue()) {
+ HEAP->CollectGarbage(NEW_SPACE, "gc extension");
+ } else {
+ HEAP->CollectAllGarbage(Heap::kNoGCFlags, "gc extension");
+ }
return v8::Undefined();
}
--
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev