Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(531)

Unified Diff: src/incremental-marking.cc

Issue 6597104: Move IncrementalRecordWrite to a stub. (Closed) Base URL: https://v8.googlecode.com/svn/branches/experimental/gc
Patch Set: Created 9 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: src/incremental-marking.cc
diff --git a/src/incremental-marking.cc b/src/incremental-marking.cc
index 465f5edb05167f8b445f6c63d2eeeccca15547b1..eb2356f920476fd50b38ec158d802852f3082614 100644
--- a/src/incremental-marking.cc
+++ b/src/incremental-marking.cc
@@ -29,6 +29,7 @@
#include "incremental-marking.h"
+#include "code-stubs.h"
namespace v8 {
namespace internal {
@@ -122,6 +123,45 @@ static void ClearMarkbits() {
}
#endif
+bool IncrementalMarking::WorthActivating() {
+#ifndef DEBUG
+ static const intptr_t kActivationThreshold = 20*MB;
+#else
+ static const intptr_t kActivationThreshold = 0;
Erik Corry 2011/03/02 12:34:06 Perhaps worth setting this to some low level so th
Vyacheslav Egorov (Chromium) 2011/03/02 15:11:32 For now let's always resort to incremental marking
+#endif
+
+ return FLAG_incremental_marking &&
+ Heap::PromotedSpaceSize() > kActivationThreshold;
+}
+
+
+static void PatchStubs(bool enable) {
Erik Corry 2011/03/02 12:34:06 This should be called something that reveals what
Vyacheslav Egorov (Chromium) 2011/03/02 15:11:32 Done.
+ NumberDictionary* stubs = Heap::code_stubs();
+
+
Erik Corry 2011/03/02 12:34:06 Blank line.
Vyacheslav Egorov (Chromium) 2011/03/02 15:11:32 Done.
+ int capacity = stubs->Capacity();
+ for (int i = 0; i < capacity; i++) {
+ Object* k = stubs->KeyAt(i);
+ if (stubs->IsKey(k)) {
+ uint32_t key = NumberToUint32(k);
+
+ if (CodeStub::MajorKeyFromKey(key) ==
+ CodeStub::IncrementalMarkingRecordWrite) {
+ Object* e = stubs->ValueAt(i);
+ if (e->IsJSGlobalPropertyCell()) {
+ e = JSGlobalPropertyCell::cast(e)->value();
Erik Corry 2011/03/02 12:34:06 WTF?
Vyacheslav Egorov (Chromium) 2011/03/02 15:11:32 Done.
+ }
+
+ if (e->IsCode()) {
+ Code* stub = Code::cast(e);
+ *stub->instruction_start() = enable ? 0x90 : 0xc3;
Erik Corry 2011/03/02 12:34:06 These should be constants from assembler-ia32.h
Vyacheslav Egorov (Chromium) 2011/03/02 15:11:32 Done.
+ }
+ }
+ }
+ }
+}
+
+
void IncrementalMarking::Start() {
if (FLAG_trace_incremental_marking) {
PrintF("[IncrementalMarking] Start\n");
@@ -130,6 +170,8 @@ void IncrementalMarking::Start() {
ASSERT(state_ == STOPPED);
state_ = MARKING;
+ PatchStubs(true);
+
// Initialize marking stack.
marking_stack_.Initialize(Heap::new_space()->FromSpaceLow(),
Heap::new_space()->FromSpaceHigh());
@@ -181,6 +223,7 @@ void IncrementalMarking::Hurry() {
void IncrementalMarking::Finalize() {
Hurry();
state_ = STOPPED;
+ PatchStubs(false);
ASSERT(marking_stack_.is_empty());
}

Powered by Google App Engine
This is Rietveld 408576698