From 63670beae0130e656f2f06ce7a9578aa42a7489c Mon Sep 17 00:00:00 2001 From: "bak@chromium.org" Date: Mon, 20 Oct 2008 07:31:33 +0000 Subject: [PATCH] - Changed gc-greedy to ignore boostrapping. This change reduces the running time of tests without snapshotting. Review URL: http://codereview.chromium.org/7663 git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@525 ce2b1a6d-e550-0410-aec6-3dcde31c8c00 --- src/bootstrapper.h | 2 +- src/heap-inl.h | 7 ++----- src/heap.cc | 8 ++++++++ src/heap.h | 3 +++ 4 files changed, 14 insertions(+), 6 deletions(-) diff --git a/src/bootstrapper.h b/src/bootstrapper.h index 6b5f98791..c34ec9eb3 100644 --- a/src/bootstrapper.h +++ b/src/bootstrapper.h @@ -58,7 +58,7 @@ class Bootstrapper : public AllStatic { // Append code that needs fixup at the end of boot strapping. static void AddFixup(Code* code, MacroAssembler* masm); - // Tells wheter boostrapping is active. + // Tells whether boostrapping is active. static bool IsActive(); // Encoding/decoding support for fixup flags. diff --git a/src/heap-inl.h b/src/heap-inl.h index 822e17c61..036ddb8b7 100644 --- a/src/heap-inl.h +++ b/src/heap-inl.h @@ -146,11 +146,8 @@ OldSpace* Heap::TargetSpace(HeapObject* object) { } -#define GC_GREEDY_CHECK() \ - ASSERT(!FLAG_gc_greedy \ - || v8::internal::Heap::disallow_allocation_failure() \ - || v8::internal::Heap::CollectGarbage(0, NEW_SPACE)) - +#define GC_GREEDY_CHECK() \ + ASSERT(!FLAG_gc_greedy || v8::internal::Heap::GarbageCollectionGreedyCheck()) // Do not use the identifier __object__ in a call to this macro. // diff --git a/src/heap.cc b/src/heap.cc index 8ad7e2cf6..50befdcb6 100644 --- a/src/heap.cc +++ b/src/heap.cc @@ -3106,4 +3106,12 @@ const char* GCTracer::CollectorString() { } +bool Heap::GarbageCollectionGreedyCheck() { + ASSERT(FLAG_gc_greedy); + if (Bootstrapper::IsActive()) return true; + if (disallow_allocation_failure()) return true; + return CollectGarbage(0, NEW_SPACE); +} + + } } // namespace v8::internal diff --git a/src/heap.h b/src/heap.h index 764886808..1f0fc7d89 100644 --- a/src/heap.h +++ b/src/heap.h @@ -565,6 +565,9 @@ class Heap : public AllStatic { // ensure correct callback for weak global handles. static void PerformScavenge(); + // Utility used with flag gc-greedy. + static bool GarbageCollectionGreedyCheck(); + static void SetGlobalGCPrologueCallback(GCCallback callback) { global_gc_prologue_callback_ = callback; } -- 2.34.1