Revision: 9015
Author: [email protected]
Date: Thu Aug 25 06:20:23 2011
Log: Remove obsolete kForceCompactionMask flag for GC.
[email protected]
BUG=v8:1608
Review URL: http://codereview.chromium.org/7689002
http://code.google.com/p/v8/source/detail?r=9015
Modified:
/branches/experimental/gc/src/api.cc
/branches/experimental/gc/src/extensions/gc-extension.cc
/branches/experimental/gc/src/heap.cc
/branches/experimental/gc/src/heap.h
/branches/experimental/gc/test/cctest/test-accessors.cc
/branches/experimental/gc/test/cctest/test-api.cc
/branches/experimental/gc/test/cctest/test-debug.cc
/branches/experimental/gc/test/cctest/test-heap-profiler.cc
/branches/experimental/gc/test/cctest/test-heap.cc
/branches/experimental/gc/test/cctest/test-serialize.cc
/branches/experimental/gc/test/mjsunit/regress/regress-deopt-gc.js
=======================================
--- /branches/experimental/gc/src/api.cc Wed Aug 10 05:50:30 2011
+++ /branches/experimental/gc/src/api.cc Thu Aug 25 06:20:23 2011
@@ -3969,7 +3969,7 @@
void v8::V8::LowMemoryNotification() {
i::Isolate* isolate = i::Isolate::Current();
if (!isolate->IsInitialized()) return;
- isolate->heap()->CollectAllGarbage(i::Heap::kForceCompactionMask);
+ isolate->heap()->CollectAllAvailableGarbage();
}
=======================================
--- /branches/experimental/gc/src/extensions/gc-extension.cc Sun Apr 24
04:36:08 2011
+++ /branches/experimental/gc/src/extensions/gc-extension.cc Thu Aug 25
06:20:23 2011
@@ -40,12 +40,7 @@
v8::Handle<v8::Value> GCExtension::GC(const v8::Arguments& args) {
- int flags = Heap::kNoGCFlags;
- // All allocation spaces other than NEW_SPACE have the same effect.
- if (args.Length() >= 1 && args[0]->IsBoolean()) {
- if (args[0]->BooleanValue()) flags |= Heap::kForceCompactionMask;
- }
- HEAP->CollectAllGarbage(flags);
+ HEAP->CollectAllGarbage(Heap::kNoGCFlags);
return v8::Undefined();
}
=======================================
--- /branches/experimental/gc/src/heap.cc Thu Aug 25 03:47:58 2011
+++ /branches/experimental/gc/src/heap.cc Thu Aug 25 06:20:23 2011
@@ -440,9 +440,6 @@
// Since we are ignoring the return value, the exact choice of space does
// not matter, so long as we do not specify NEW_SPACE, which would not
// cause a full GC.
- mark_compact_collector()->SetFlags(
- kMakeHeapIterableMask | kForceCompactionMask);
-
// Major GC would invoke weak handle callbacks on weakly reachable
// handles, but won't collect weakly reachable objects until next
// major GC. Therefore if we collect aggressively and weak handle
callback
@@ -451,6 +448,7 @@
// Note: as weak callbacks can execute arbitrary code, we cannot
// hope that eventually there will be no weak callbacks invocations.
// Therefore stop recollecting after several attempts.
+ mark_compact_collector()->SetFlags(kMakeHeapIterableMask);
const int kMaxNumberOfAttempts = 7;
for (int attempt = 0; attempt < kMaxNumberOfAttempts; attempt++) {
if (!CollectGarbage(OLD_POINTER_SPACE, MARK_COMPACTOR)) {
@@ -4181,7 +4179,7 @@
last_idle_notification_gc_count_ = gc_count_;
} else if (number_idle_notifications_ == kIdlesBeforeMarkCompact) {
- CollectAllGarbage(kForceCompactionMask);
+ CollectAllGarbage(kNoGCFlags);
new_space_.Shrink();
last_idle_notification_gc_count_ = gc_count_;
number_idle_notifications_ = 0;
=======================================
--- /branches/experimental/gc/src/heap.h Tue Aug 23 06:33:22 2011
+++ /branches/experimental/gc/src/heap.h Thu Aug 25 06:20:23 2011
@@ -903,15 +903,16 @@
inline bool CollectGarbage(AllocationSpace space);
static const int kNoGCFlags = 0;
- static const int kForceCompactionMask = 1;
- static const int kMakeHeapIterableMask = 2;
-
- // Performs a full garbage collection. If (flags &
kForceCompactionMask) is
- // non-zero then force compaction. If (flags & kMakeHeapIterableMask)
is non-
- // zero, then the slower precise sweeper is used, which leaves the heap
in a
- // state where we can iterate over the heap visiting all objects.
+ static const int kMakeHeapIterableMask = 1;
+
+ // Performs a full garbage collection. If (flags &
kMakeHeapIterableMask) is
+ // non-zero, then the slower precise sweeper is used, which leaves the
heap
+ // in a state where we can iterate over the heap visiting all objects.
void CollectAllGarbage(int flags);
+ // Last hope GC, should try to squeeze as much as possible.
+ void CollectAllAvailableGarbage();
+
// Check whether the heap is currently iterable.
bool IsHeapIterable();
@@ -919,9 +920,6 @@
// over all objects. May cause a GC.
void EnsureHeapIsIterable();
- // Last hope GC, should try to squeeze as much as possible.
- void CollectAllAvailableGarbage();
-
// Notify the heap that a context has been disposed.
int NotifyContextDisposed() { return ++contexts_disposed_; }
=======================================
--- /branches/experimental/gc/test/cctest/test-accessors.cc Mon May 9
14:11:15 2011
+++ /branches/experimental/gc/test/cctest/test-accessors.cc Thu Aug 25
06:20:23 2011
@@ -243,7 +243,7 @@
ApiTestFuzzer::Fuzz();
CHECK(info.This() == info.Holder());
CHECK(info.Data()->Equals(v8::String::New("data")));
- HEAP->CollectAllGarbage(i::Heap::kForceCompactionMask);
+ HEAP->CollectAllGarbage(i::Heap::kNoGCFlags);
CHECK(info.This() == info.Holder());
CHECK(info.Data()->Equals(v8::String::New("data")));
return v8::Integer::New(17);
=======================================
--- /branches/experimental/gc/test/cctest/test-api.cc Fri Aug 19 06:14:48
2011
+++ /branches/experimental/gc/test/cctest/test-api.cc Thu Aug 25 06:20:23
2011
@@ -8521,7 +8521,7 @@
int* call_count =
reinterpret_cast<int*>(v8::External::Unwrap(info.Data()));
++(*call_count);
if ((*call_count) % 20 == 0) {
- HEAP->CollectAllGarbage(i::Heap::kForceCompactionMask);
+ HEAP->CollectAllGarbage(i::Heap::kNoGCFlags);
}
return v8::Handle<Value>();
}
@@ -13742,7 +13742,7 @@
void FailedAccessCheckCallbackGC(Local<v8::Object> target,
v8::AccessType type,
Local<v8::Value> data) {
- HEAP->CollectAllGarbage(i::Heap::kForceCompactionMask);
+ HEAP->CollectAllGarbage(i::Heap::kNoGCFlags);
}
@@ -14316,7 +14316,7 @@
"})()",
"ReferenceError: cell is not defined");
CompileRun("cell = \"new_second\";");
- HEAP->CollectAllGarbage(i::Heap::kForceCompactionMask);
+ HEAP->CollectAllGarbage(i::Heap::kNoGCFlags);
ExpectString("readCell()", "new_second");
ExpectString("readCell()", "new_second");
}
=======================================
--- /branches/experimental/gc/test/cctest/test-debug.cc Tue Aug 16 01:56:33
2011
+++ /branches/experimental/gc/test/cctest/test-debug.cc Thu Aug 25 06:20:23
2011
@@ -943,7 +943,7 @@
HEAP->CollectGarbage(v8::internal::NEW_SPACE);
} else {
// Mark sweep compact.
- HEAP->CollectAllGarbage(Heap::kForceCompactionMask);
+ HEAP->CollectAllGarbage(Heap::kNoGCFlags);
}
}
}
@@ -1416,8 +1416,7 @@
// Call the function three times with different garbage collections in
between
// and make sure that the break point survives.
static void CallAndGC(v8::Local<v8::Object> recv,
- v8::Local<v8::Function> f,
- int gc_flags) {
+ v8::Local<v8::Function> f) {
break_point_hit_count = 0;
for (int i = 0; i < 3; i++) {
@@ -1431,14 +1430,15 @@
CHECK_EQ(2 + i * 3, break_point_hit_count);
// Mark sweep (and perhaps compact) and call function.
- HEAP->CollectAllGarbage(gc_flags);
+ HEAP->CollectAllGarbage(Heap::kNoGCFlags);
f->Call(recv, 0, NULL);
CHECK_EQ(3 + i * 3, break_point_hit_count);
}
}
-static void TestBreakPointSurviveGC(int gc_flags) {
+// Test that a break point can be set at a return store location.
+TEST(BreakPointSurviveGC) {
break_point_hit_count = 0;
v8::HandleScope scope;
DebugLocalContext env;
@@ -1454,7 +1454,7 @@
foo = CompileFunction(&env, "function foo(){bar=0;}", "foo");
SetBreakPoint(foo, 0);
}
- CallAndGC(env->Global(), foo, gc_flags);
+ CallAndGC(env->Global(), foo);
// Test IC load break point with garbage collection.
{
@@ -1463,7 +1463,7 @@
foo = CompileFunction(&env, "bar=1;function foo(){var x=bar;}", "foo");
SetBreakPoint(foo, 0);
}
- CallAndGC(env->Global(), foo, gc_flags);
+ CallAndGC(env->Global(), foo);
// Test IC call break point with garbage collection.
{
@@ -1474,7 +1474,7 @@
"foo");
SetBreakPoint(foo, 0);
}
- CallAndGC(env->Global(), foo, gc_flags);
+ CallAndGC(env->Global(), foo);
// Test return break point with garbage collection.
{
@@ -1483,7 +1483,7 @@
foo = CompileFunction(&env, "function foo(){}", "foo");
SetBreakPoint(foo, 0);
}
- CallAndGC(env->Global(), foo, gc_flags);
+ CallAndGC(env->Global(), foo);
// Test non IC break point with garbage collection.
{
@@ -1492,19 +1492,12 @@
foo = CompileFunction(&env, "function foo(){var bar=0;}", "foo");
SetBreakPoint(foo, 0);
}
- CallAndGC(env->Global(), foo, gc_flags);
+ CallAndGC(env->Global(), foo);
v8::Debug::SetDebugEventListener(NULL);
CheckDebuggerUnloaded();
}
-
-
-// Test that a break point can be set at a return store location.
-TEST(BreakPointSurviveGC) {
- TestBreakPointSurviveGC(Heap::kNoGCFlags);
- TestBreakPointSurviveGC(Heap::kForceCompactionMask);
-}
// Test that break points can be set using the global Debug object.
=======================================
--- /branches/experimental/gc/test/cctest/test-heap-profiler.cc Wed Aug 3
09:10:10 2011
+++ /branches/experimental/gc/test/cctest/test-heap-profiler.cc Thu Aug 25
06:20:23 2011
@@ -296,7 +296,7 @@
const v8::HeapSnapshot* snapshot1 =
v8::HeapProfiler::TakeSnapshot(v8::String::New("s1"));
- HEAP->CollectAllGarbage(i::Heap::kForceCompactionMask);
+ HEAP->CollectAllGarbage(i::Heap::kNoGCFlags);
const v8::HeapSnapshot* snapshot2 =
v8::HeapProfiler::TakeSnapshot(v8::String::New("s2"));
=======================================
--- /branches/experimental/gc/test/cctest/test-heap.cc Tue Aug 16 01:56:33
2011
+++ /branches/experimental/gc/test/cctest/test-heap.cc Thu Aug 25 06:20:23
2011
@@ -864,7 +864,7 @@
InitializeVM();
// Increase the chance of 'bump-the-pointer' allocation in old space.
- HEAP->CollectAllGarbage(Heap::kForceCompactionMask);
+ HEAP->CollectAllGarbage(Heap::kNoGCFlags);
v8::HandleScope scope;
@@ -960,17 +960,17 @@
Handle<JSFunction> function(JSFunction::cast(func_value));
CHECK(function->shared()->is_compiled());
- HEAP->CollectAllGarbage(Heap::kForceCompactionMask);
- HEAP->CollectAllGarbage(Heap::kForceCompactionMask);
+ HEAP->CollectAllGarbage(Heap::kNoGCFlags);
+ HEAP->CollectAllGarbage(Heap::kNoGCFlags);
CHECK(function->shared()->is_compiled());
- HEAP->CollectAllGarbage(Heap::kForceCompactionMask);
- HEAP->CollectAllGarbage(Heap::kForceCompactionMask);
- HEAP->CollectAllGarbage(Heap::kForceCompactionMask);
- HEAP->CollectAllGarbage(Heap::kForceCompactionMask);
- HEAP->CollectAllGarbage(Heap::kForceCompactionMask);
- HEAP->CollectAllGarbage(Heap::kForceCompactionMask);
+ HEAP->CollectAllGarbage(Heap::kNoGCFlags);
+ HEAP->CollectAllGarbage(Heap::kNoGCFlags);
+ HEAP->CollectAllGarbage(Heap::kNoGCFlags);
+ HEAP->CollectAllGarbage(Heap::kNoGCFlags);
+ HEAP->CollectAllGarbage(Heap::kNoGCFlags);
+ HEAP->CollectAllGarbage(Heap::kNoGCFlags);
// foo should no longer be in the compilation cache
CHECK(!function->shared()->is_compiled() || function->IsOptimized());
@@ -1059,7 +1059,7 @@
}
// Mark compact handles the weak references.
- HEAP->CollectAllGarbage(Heap::kForceCompactionMask);
+ HEAP->CollectAllGarbage(Heap::kNoGCFlags);
CHECK_EQ(opt ? 4 : 0, CountOptimizedUserFunctions(ctx[i]));
// Get rid of f3 and f5 in the same way.
@@ -1068,21 +1068,21 @@
HEAP->PerformScavenge();
CHECK_EQ(opt ? 4 : 0, CountOptimizedUserFunctions(ctx[i]));
}
- HEAP->CollectAllGarbage(Heap::kForceCompactionMask);
+ HEAP->CollectAllGarbage(Heap::kNoGCFlags);
CHECK_EQ(opt ? 3 : 0, CountOptimizedUserFunctions(ctx[i]));
CompileRun("f5=null");
for (int j = 0; j < 10; j++) {
HEAP->PerformScavenge();
CHECK_EQ(opt ? 3 : 0, CountOptimizedUserFunctions(ctx[i]));
}
- HEAP->CollectAllGarbage(Heap::kForceCompactionMask);
+ HEAP->CollectAllGarbage(Heap::kNoGCFlags);
CHECK_EQ(opt ? 2 : 0, CountOptimizedUserFunctions(ctx[i]));
ctx[i]->Exit();
}
// Force compilation cache cleanup.
- HEAP->CollectAllGarbage(Heap::kForceCompactionMask);
+ HEAP->CollectAllGarbage(Heap::kNoGCFlags);
// Dispose the global contexts one by one.
for (int i = 0; i < kNumTestContexts; i++) {
@@ -1096,7 +1096,7 @@
}
// Mark compact handles the weak references.
- HEAP->CollectAllGarbage(Heap::kForceCompactionMask);
+ HEAP->CollectAllGarbage(Heap::kNoGCFlags);
CHECK_EQ(kNumTestContexts - i - 1, CountGlobalContexts());
}
@@ -1111,7 +1111,7 @@
Handle<Object> object(HEAP->global_contexts_list());
while (!object->IsUndefined()) {
count++;
- if (count == n) HEAP->CollectAllGarbage(Heap::kForceCompactionMask);
+ if (count == n) HEAP->CollectAllGarbage(Heap::kNoGCFlags);
object =
Handle<Object>(Context::cast(*object)->get(Context::NEXT_CONTEXT_LINK));
}
@@ -1130,7 +1130,7 @@
while (object->IsJSFunction() &&
!Handle<JSFunction>::cast(object)->IsBuiltin()) {
count++;
- if (count == n) HEAP->CollectAllGarbage(Heap::kForceCompactionMask);
+ if (count == n) HEAP->CollectAllGarbage(Heap::kNoGCFlags);
object = Handle<Object>(
Object::cast(JSFunction::cast(*object)->next_function_link()));
}
=======================================
--- /branches/experimental/gc/test/cctest/test-serialize.cc Wed Aug 10
05:50:30 2011
+++ /branches/experimental/gc/test/cctest/test-serialize.cc Thu Aug 25
06:20:23 2011
@@ -365,8 +365,8 @@
Isolate::Current()->bootstrapper()->NativesSourceLookup(i);
}
}
- HEAP->CollectAllGarbage(Heap::kForceCompactionMask);
- HEAP->CollectAllGarbage(Heap::kForceCompactionMask);
+ HEAP->CollectAllGarbage(Heap::kNoGCFlags);
+ HEAP->CollectAllGarbage(Heap::kNoGCFlags);
Object* raw_foo;
{
@@ -490,7 +490,7 @@
}
// If we don't do this then we end up with a stray root pointing at the
// context even after we have disposed of env.
- HEAP->CollectAllGarbage(Heap::kForceCompactionMask);
+ HEAP->CollectAllGarbage(Heap::kNoGCFlags);
int file_name_length = StrLength(FLAG_testing_serialization_file) + 10;
Vector<char> startup_name = Vector<char>::New(file_name_length + 1);
=======================================
--- /branches/experimental/gc/test/mjsunit/regress/regress-deopt-gc.js Wed
Feb 16 10:02:22 2011
+++ /branches/experimental/gc/test/mjsunit/regress/regress-deopt-gc.js Thu
Aug 25 06:20:23 2011
@@ -42,7 +42,7 @@
// Make sure we don't inline this function
try { var a = 42; } catch(o) {};
%DeoptimizeFunction(opt_me);
- gc(true);
+ gc();
}
--
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev