mirror of
https://github.com/dart-lang/sdk
synced 2024-09-19 21:21:41 +00:00
Fixes shutdown crashes.
- Restores fix to debug message queue. - Fixes for precompilation. BUG= R=johnmccutchan@google.com, rmacnak@google.com Review URL: https://codereview.chromium.org/1406013004 .
This commit is contained in:
parent
52d8128b4e
commit
1fb050baa0
|
@ -1277,6 +1277,12 @@ Debugger::~Debugger() {
|
|||
|
||||
|
||||
void Debugger::Shutdown() {
|
||||
// TODO(johnmccutchan): Do not create a debugger for isolates that don't need
|
||||
// them. Then, assert here that isolate_ is not one of those isolates.
|
||||
if ((isolate_ == Dart::vm_isolate()) ||
|
||||
ServiceIsolate::IsServiceIsolateDescendant(isolate_)) {
|
||||
return;
|
||||
}
|
||||
while (breakpoint_locations_ != NULL) {
|
||||
BreakpointLocation* bpt = breakpoint_locations_;
|
||||
breakpoint_locations_ = breakpoint_locations_->next();
|
||||
|
@ -1294,9 +1300,7 @@ void Debugger::Shutdown() {
|
|||
delete bpt;
|
||||
}
|
||||
// Signal isolate shutdown event.
|
||||
if (!ServiceIsolate::IsServiceIsolateDescendant(isolate_)) {
|
||||
SignalIsolateEvent(DebuggerEvent::kIsolateShutdown);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -319,6 +319,7 @@ class RunServiceTask : public ThreadPool::Task {
|
|||
&error));
|
||||
if (isolate == NULL) {
|
||||
OS::PrintErr("vm-service: Isolate creation error: %s\n", error);
|
||||
ServiceIsolate::SetServiceIsolate(NULL);
|
||||
ServiceIsolate::FinishedInitializing();
|
||||
return;
|
||||
}
|
||||
|
|
|
@ -33,7 +33,9 @@ VirtualMemory* VirtualMemory::ForInstructionsSnapshot(void* pointer,
|
|||
// Memory for precompilated instructions was allocated by the embedder, so
|
||||
// create a VirtualMemory without allocating.
|
||||
MemoryRegion region(pointer, size);
|
||||
return new VirtualMemory(region);
|
||||
VirtualMemory* memory = new VirtualMemory(region);
|
||||
memory->embedder_allocated_ = true;
|
||||
return memory;
|
||||
}
|
||||
|
||||
} // namespace dart
|
||||
|
|
|
@ -69,6 +69,8 @@ class VirtualMemory {
|
|||
// Commit a reserved memory area, so that the memory can be accessed.
|
||||
bool Commit(uword addr, intptr_t size, bool is_executable);
|
||||
|
||||
bool embedder_allocated() const { return embedder_allocated_; }
|
||||
|
||||
static VirtualMemory* ForInstructionsSnapshot(void* pointer, uword size);
|
||||
|
||||
private:
|
||||
|
@ -92,6 +94,9 @@ class VirtualMemory {
|
|||
|
||||
static uword page_size_;
|
||||
|
||||
// True for a region provided by the embedder.
|
||||
bool embedder_allocated_;
|
||||
|
||||
DISALLOW_IMPLICIT_CONSTRUCTORS(VirtualMemory);
|
||||
};
|
||||
|
||||
|
|
|
@ -53,7 +53,9 @@ static void unmap(void* address, intptr_t size) {
|
|||
|
||||
|
||||
VirtualMemory::~VirtualMemory() {
|
||||
if (!embedder_allocated()) {
|
||||
unmap(address(), reserved_size_);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -52,7 +52,9 @@ static void unmap(void* address, intptr_t size) {
|
|||
|
||||
|
||||
VirtualMemory::~VirtualMemory() {
|
||||
if (!embedder_allocated()) {
|
||||
unmap(address(), reserved_size_);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -53,7 +53,9 @@ static void unmap(void* address, intptr_t size) {
|
|||
|
||||
|
||||
VirtualMemory::~VirtualMemory() {
|
||||
if (!embedder_allocated()) {
|
||||
unmap(address(), reserved_size_);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -33,7 +33,7 @@ VirtualMemory* VirtualMemory::ReserveInternal(intptr_t size) {
|
|||
|
||||
|
||||
VirtualMemory::~VirtualMemory() {
|
||||
if (reserved_size_ == 0) {
|
||||
if (embedder_allocated() || (reserved_size_ == 0)) {
|
||||
return;
|
||||
}
|
||||
if (VirtualFree(address(), 0, MEM_RELEASE) == 0) {
|
||||
|
|
Loading…
Reference in a new issue