From: mstarzinger@chromium.org Date: Tue, 4 Dec 2012 12:14:19 +0000 (+0000) Subject: Enforce stack allocation of TryCatch blocks. X-Git-Tag: upstream/4.7.83~15505 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=76dfa8ed608dc22eaf42ebfe907b1ee7419a3577;p=platform%2Fupstream%2Fv8.git Enforce stack allocation of TryCatch blocks. R=svenpanne@chromium.org BUG=v8:2166,chromium:152389 Review URL: https://codereview.chromium.org/11411353 git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@13130 ce2b1a6d-e550-0410-aec6-3dcde31c8c00 --- diff --git a/include/v8.h b/include/v8.h index 01a4cc9..74f489d 100644 --- a/include/v8.h +++ b/include/v8.h @@ -490,8 +490,8 @@ class V8EXPORT HandleScope { static internal::Object** CreateHandle(internal::HeapObject* value); private: - // Make it impossible to create heap-allocated or illegal handle - // scopes by disallowing certain operations. + // Make it hard to create heap-allocated or illegal handle scopes by + // disallowing certain operations. HandleScope(const HandleScope&); void operator=(const HandleScope&); void* operator new(size_t size); @@ -3559,7 +3559,9 @@ class V8EXPORT V8 { class V8EXPORT TryCatch { public: /** - * Creates a new try/catch block and registers it with v8. + * Creates a new try/catch block and registers it with v8. Note that + * all TryCatch blocks should be stack allocated because the memory + * location itself is compared against JavaScript try/catch blocks. */ TryCatch(); @@ -3649,6 +3651,12 @@ class V8EXPORT TryCatch { void SetCaptureMessage(bool value); private: + // Make it hard to create heap-allocated TryCatch blocks. + TryCatch(const TryCatch&); + void operator=(const TryCatch&); + void* operator new(size_t size); + void operator delete(void*, size_t); + v8::internal::Isolate* isolate_; void* next_; void* exception_;