Reviewers: Hannes Payer,

Description:
[GC] Fix regression in 517195

We missed a check whether we can actually do incremental marking when starting
it on reaching the external allocation limit.

BUG=chromium:517195
LOG=N

Please review this at https://codereview.chromium.org/1274983002/

Base URL: https://chromium.googlesource.com/v8/v8.git@master

Affected files (+31, -12 lines):
  M src/api.cc
  A test/mjsunit/regress/regress-517195.js


Index: src/api.cc
diff --git a/src/api.cc b/src/api.cc
index ef08b032dd21d7c73f6a0cb25109c789bcf88482..e11f366f031fb2e9ef003a6a3557774009202b23 100644
--- a/src/api.cc
+++ b/src/api.cc
@@ -6887,18 +6887,26 @@ Local<Integer> v8::Integer::NewFromUnsigned(Isolate* isolate, uint32_t value) {
 void Isolate::CollectAllGarbage(const char* gc_reason) {
   i::Heap* heap = reinterpret_cast<i::Isolate*>(this)->heap();
   if (heap->incremental_marking()->IsStopped()) {
- heap->StartIncrementalMarking(i::Heap::kNoGCFlags, kGCCallbackFlagForced,
-                                  gc_reason);
-  }
- // TODO(mlippautz): Compute the time slice for incremental marking based on
-  // memory pressure.
-  double deadline = heap->MonotonicallyIncreasingTimeInMs() +
-                    i::FLAG_external_allocation_limit_incremental_time;
-  heap->AdvanceIncrementalMarking(0, deadline,
-                                  i::IncrementalMarking::StepActions(
- i::IncrementalMarking::GC_VIA_STACK_GUARD,
-                                      i::IncrementalMarking::FORCE_MARKING,
- i::IncrementalMarking::FORCE_COMPLETION));
+    if (heap->incremental_marking()->CanBeActivated()) {
+ heap->StartIncrementalMarking(i::Heap::kNoGCFlags, kGCCallbackFlagForced,
+                                    gc_reason);
+    } else {
+      heap->CollectAllGarbage(i::Heap::kNoGCFlags, gc_reason,
+                              kGCCallbackFlagForced);
+    }
+  } else {
+    // Incremental marking is turned on an has already been started.
+
+ // TODO(mlippautz): Compute the time slice for incremental marking based on
+    // memory pressure.
+    double deadline = heap->MonotonicallyIncreasingTimeInMs() +
+                      i::FLAG_external_allocation_limit_incremental_time;
+    heap->AdvanceIncrementalMarking(
+        0, deadline, i::IncrementalMarking::StepActions(
+                         i::IncrementalMarking::GC_VIA_STACK_GUARD,
+                         i::IncrementalMarking::FORCE_MARKING,
+                         i::IncrementalMarking::FORCE_COMPLETION));
+  }
 }


Index: test/mjsunit/regress/regress-517195.js
diff --git a/test/mjsunit/regress/regress-517195.js b/test/mjsunit/regress/regress-517195.js
new file mode 100644
index 0000000000000000000000000000000000000000..3172b4dc8d79a8ddeaa3d38dba4e4ca8b6f31537
--- /dev/null
+++ b/test/mjsunit/regress/regress-517195.js
@@ -0,0 +1,11 @@
+// Copyright 2015 the V8 project authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+// Flags: --invoke-weak-callbacks --omit-quit --noincremental-marking --random-seed=866466637
+//
+// Test requires ASAN.
+
+(function __f_25() {
+  var __v_4 = new ArrayBuffer(1073741823);
+})();


--
--
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/d/optout.

Reply via email to