Chromium Code Reviews| 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##_); |