diff options
Diffstat (limited to 'src/3rdparty/v8/src/v8threads.cc')
-rw-r--r-- | src/3rdparty/v8/src/v8threads.cc | 23 |
1 files changed, 20 insertions, 3 deletions
diff --git a/src/3rdparty/v8/src/v8threads.cc b/src/3rdparty/v8/src/v8threads.cc index fd8d536..32ea5e1 100644 --- a/src/3rdparty/v8/src/v8threads.cc +++ b/src/3rdparty/v8/src/v8threads.cc @@ -1,4 +1,4 @@ -// Copyright 2008 the V8 project authors. All rights reserved. +// Copyright 2012 the V8 project authors. All rights reserved. // Redistribution and use in source and binary forms, with or without // modification, are permitted provided that the following conditions are // met: @@ -238,12 +238,18 @@ static int ArchiveSpacePerThread() { ThreadState::ThreadState(ThreadManager* thread_manager) : id_(ThreadId::Invalid()), terminate_on_restore_(false), + data_(NULL), next_(this), previous_(this), thread_manager_(thread_manager) { } +ThreadState::~ThreadState() { + DeleteArray<char>(data_); +} + + void ThreadState::AllocateSpace() { data_ = NewArray<char>(ArchiveSpacePerThread()); } @@ -306,8 +312,19 @@ ThreadManager::ThreadManager() ThreadManager::~ThreadManager() { delete mutex_; - delete free_anchor_; - delete in_use_anchor_; + DeleteThreadStateList(free_anchor_); + DeleteThreadStateList(in_use_anchor_); +} + + +void ThreadManager::DeleteThreadStateList(ThreadState* anchor) { + // The list starts and ends with the anchor. + for (ThreadState* current = anchor->next_; current != anchor;) { + ThreadState* next = current->next_; + delete current; + current = next; + } + delete anchor; } |