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

Unified Diff: src/isolate.cc

Issue 99243002: Experimental scanner multithreading fix. (Closed) Base URL: https://v8.googlecode.com/svn/branches/experimental/parser
Patch Set: Created 7 years 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
« no previous file with comments | « src/isolate.h ('k') | src/lexer/experimental-scanner.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/isolate.cc
diff --git a/src/isolate.cc b/src/isolate.cc
index 740cce00476a3ab66ea35fbf48e411f7bbc06da2..975e84d4ddb12453fa0b22cfd1a30807a59cf8ba 100644
--- a/src/isolate.cc
+++ b/src/isolate.cc
@@ -40,6 +40,7 @@
#include "heap-profiler.h"
#include "hydrogen.h"
#include "isolate-inl.h"
+#include "lexer/experimental-scanner.h"
#include "lithium-allocator.h"
#include "log.h"
#include "messages.h"
@@ -1298,6 +1299,22 @@ bool Isolate::IsErrorObject(Handle<Object> obj) {
return false;
}
+
+void Isolate::UpdateScannersAfterGC(v8::Isolate* isolate,
+ GCType,
+ GCCallbackFlags) {
+ reinterpret_cast<i::Isolate*>(isolate)->UpdateScannersAfterGC();
+}
+
+
+void Isolate::UpdateScannersAfterGC() {
+ for (std::set<ScannerBase*>::const_iterator it = scanners_.begin();
+ it != scanners_.end();
+ ++it)
+ (*it)->UpdateBufferBasedOnHandle();
+}
+
+
static int fatal_exception_depth = 0;
void Isolate::DoThrow(Object* exception, MessageLocation* location) {
@@ -2521,6 +2538,23 @@ Object* Isolate::FindCodeObject(Address a) {
}
+void Isolate::AddScanner(ScannerBase* scanner) {
+ if (scanners_.empty()) {
+ heap()->AddGCEpilogueCallback(
ulan 2013/12/02 15:05:42 Not sure. It is probably better do AddGCEpilogueCa
+ &Isolate::UpdateScannersAfterGC, kGCTypeAll, false);
+ }
+ scanners_.insert(scanner);
+}
+
+
+void Isolate::RemoveScanner(ScannerBase* scanner) {
+ scanners_.erase(scanner);
+ if (scanners_.empty()) {
+ heap()->RemoveGCEpilogueCallback(&Isolate::UpdateScannersAfterGC);
+ }
+}
+
+
#ifdef DEBUG
#define ISOLATE_FIELD_OFFSET(type, name, ignored) \
const intptr_t Isolate::name##_debug_offset_ = OFFSET_OF(Isolate, name##_);
« no previous file with comments | « src/isolate.h ('k') | src/lexer/experimental-scanner.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698