Revision: 18787
Author:   [email protected]
Date:     Thu Jan 23 15:57:14 2014 UTC
Log:      Allow to enable/disable inline allocation via runtime function.

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

BUG=
[email protected]

Review URL: https://codereview.chromium.org/144543005
http://code.google.com/p/v8/source/detail?r=18787

Modified:
 /branches/bleeding_edge/src/heap.cc
 /branches/bleeding_edge/src/runtime.cc

=======================================
--- /branches/bleeding_edge/src/heap.cc Thu Jan 23 13:02:27 2014 UTC
+++ /branches/bleeding_edge/src/heap.cc Thu Jan 23 15:57:14 2014 UTC
@@ -6397,7 +6397,7 @@


 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::DisableInlineAllocation() {
-  ASSERT(!inline_allocation_disabled_);
+  if (inline_allocation_disabled_) return;
   inline_allocation_disabled_ = true;

   // Update inline allocation limit for new space.
=======================================
--- /branches/bleeding_edge/src/runtime.cc      Thu Jan 23 13:02:27 2014 UTC
+++ /branches/bleeding_edge/src/runtime.cc      Thu Jan 23 15:57:14 2014 UTC
@@ -8744,12 +8744,21 @@

 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();
 }

--
--
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.

Reply via email to