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

Unified Diff: src/regexp-stack.cc

Issue 2807031: [Isolates] RegExpStack and memory allocation limits (statics #6) (Closed) Base URL: http://v8.googlecode.com/svn/branches/experimental/isolates/
Patch Set: -> is different than . Created 10 years, 6 months 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/regexp-stack.h ('k') | src/v8threads.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/regexp-stack.cc
===================================================================
--- src/regexp-stack.cc (revision 5002)
+++ src/regexp-stack.cc (working copy)
@@ -31,18 +31,29 @@
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),
@@ -69,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();
}
}
@@ -97,6 +108,4 @@
}
-RegExpStack::ThreadLocal RegExpStack::thread_local_;
-
}} // namespace v8::internal
« no previous file with comments | « src/regexp-stack.h ('k') | src/v8threads.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698