Allow to enable/disable inline allocation via runtime function.

This will allow to artificially trigger GCs on all allocations for testing purposes.

BUG=
R=mstarzinger@chromium.org

Review URL: https://codereview.chromium.org/144543005

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@18787 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
This commit is contained in:
machenbach@chromium.org 2014-01-23 15:57:14 +00:00
parent 7fd59e5295
commit e89c7095af
2 changed files with 12 additions and 3 deletions

View File

@ -6397,7 +6397,7 @@ int64_t Heap::PromotedExternalMemorySize() {
void Heap::EnableInlineAllocation() {
ASSERT(inline_allocation_disabled_);
if (!inline_allocation_disabled_) return;
inline_allocation_disabled_ = false;
// Update inline allocation limit for new space.
@ -6406,7 +6406,7 @@ void Heap::EnableInlineAllocation() {
void Heap::DisableInlineAllocation() {
ASSERT(!inline_allocation_disabled_);
if (inline_allocation_disabled_) return;
inline_allocation_disabled_ = true;
// Update inline allocation limit for new space.

View File

@ -8744,12 +8744,21 @@ RUNTIME_FUNCTION(MaybeObject*, Runtime_CompileForOnStackReplacement) {
RUNTIME_FUNCTION(MaybeObject*, Runtime_SetAllocationTimeout) {
SealHandleScope shs(isolate);
ASSERT(args.length() == 2);
ASSERT(args.length() == 2 || args.length() == 3);
#ifdef DEBUG
CONVERT_SMI_ARG_CHECKED(interval, 0);
CONVERT_SMI_ARG_CHECKED(timeout, 1);
isolate->heap()->set_allocation_timeout(timeout);
FLAG_gc_interval = interval;
if (args.length() == 3) {
// Enable/disable inline allocation if requested.
CONVERT_BOOLEAN_ARG_CHECKED(inline_allocation, 2);
if (inline_allocation) {
isolate->heap()->EnableInlineAllocation();
} else {
isolate->heap()->DisableInlineAllocation();
}
}
#endif
return isolate->heap()->undefined_value();
}