This is experimental, we'd like to see the impact on page cycler intl1 and intl2.
*/
static int GetLogLines(int from_pos, char* dest_buf, int max_size);
+#if defined(ANDROID)
+ /**
+ * Android system sends the browser low memory signal, and it is good to
+ * collect JS heap, which can free some DOM nodes.
+ * This function should ONLY be used by the browser in low memory condition.
+ */
+ static void CollectAllGarbage();
+#endif
/**
* Releases any resources used by v8 and stops any utility threads
return 0;
}
+
+void V8::CollectAllGarbage() {
+ i::Heap::CollectAllGarbage();
+}
+
+
String::Utf8Value::Utf8Value(v8::Handle<v8::Value> obj) {
EnsureInitialized("v8::String::Utf8Value::Utf8Value()");
if (obj.IsEmpty()) {
return;
v8::Context::Scope scope(context);
-
+#if PLATFORM(ANDROID)
+ v8::V8::CollectAllGarbage();
+#else
m_proxy->evaluate(ScriptSourceCode("if (window.gc) void(gc());"), 0);
+#endif
}
bool ScriptController::haveInterpreter() const
#if USE(JSC)
// force JavaScript to GC when clear cache
WebCore::gcController().garbageCollectSoon();
+#elif USE(V8)
+ WebCore::Frame* pFrame = GET_NATIVE_FRAME(env, obj);
+ pFrame->script()->collectGarbage();
#endif // USE(JSC)
}