Index: src/regexp-stack.cc |
=================================================================== |
--- src/regexp-stack.cc (revision 7267) |
+++ src/regexp-stack.cc (working copy) |
@@ -26,24 +26,34 @@ |
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
#include "v8.h" |
-#include "top.h" |
#include "regexp-stack.h" |
namespace v8 { |
namespace internal { |
-RegExpStack::RegExpStack() { |
+RegExpStackScope::RegExpStackScope(Isolate* isolate) |
+ : regexp_stack_(isolate->regexp_stack()) { |
// Initialize, if not already initialized. |
- RegExpStack::EnsureCapacity(0); |
+ regexp_stack_->EnsureCapacity(0); |
} |
-RegExpStack::~RegExpStack() { |
+RegExpStackScope::~RegExpStackScope() { |
+ ASSERT(Isolate::Current() == regexp_stack_->isolate_); |
// Reset the buffer if it has grown. |
- RegExpStack::Reset(); |
+ regexp_stack_->Reset(); |
} |
+RegExpStack::RegExpStack() |
+ : isolate_(NULL) { |
+} |
+ |
+ |
+RegExpStack::~RegExpStack() { |
+} |
+ |
+ |
char* RegExpStack::ArchiveStack(char* to) { |
size_t size = sizeof(thread_local_); |
memcpy(reinterpret_cast<void*>(to), |
@@ -70,9 +80,9 @@ |
void RegExpStack::ThreadLocal::Free() { |
- if (thread_local_.memory_size_ > 0) { |
- DeleteArray(thread_local_.memory_); |
- thread_local_ = ThreadLocal(); |
+ if (memory_size_ > 0) { |
+ DeleteArray(memory_); |
+ Clear(); |
} |
} |
@@ -98,6 +108,4 @@ |
} |
-RegExpStack::ThreadLocal RegExpStack::thread_local_; |
- |
}} // namespace v8::internal |