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

Unified Diff: src/log.cc

Issue 53004: Add basic infrastructure for protecting V8's heap when leaving the VM... (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: '' Created 11 years, 9 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/heap.cc ('k') | src/platform.h » ('j') | src/platform-linux.cc » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/log.cc
===================================================================
--- src/log.cc (revision 1577)
+++ src/log.cc (working copy)
@@ -29,10 +29,12 @@
#include "v8.h"
+#include "bootstrapper.h"
#include "log.h"
+#include "macro-assembler.h"
#include "platform.h"
+#include "serialize.h"
#include "string-stream.h"
-#include "macro-assembler.h"
namespace v8 { namespace internal {
@@ -1115,10 +1117,22 @@
if (FLAG_log_state_changes) {
LOG(UncheckedStringEvent("Entering", StateToString(state_)));
- if (previous_) {
+ if (previous_ != NULL) {
LOG(UncheckedStringEvent("From", StateToString(previous_->state_)));
}
}
+
+#ifdef ENABLE_HEAP_PROTECTION
+ if (FLAG_protect_heap && previous_ != NULL) {
+ if (state_ == EXTERNAL) {
+ // Are we leaving V8?
Søren Thygesen Gjesse 2009/03/24 11:43:55 ASSERT that previous state was not EXTERNAL and li
+ if (previous_->state_ != EXTERNAL) Heap::Protect();
+ } else {
+ // Are we entering V8?
+ if (previous_->state_ == EXTERNAL) Heap::Unprotect();
+ }
+ }
+#endif
}
@@ -1127,10 +1141,22 @@
if (FLAG_log_state_changes) {
LOG(UncheckedStringEvent("Leaving", StateToString(state_)));
- if (previous_) {
+ if (previous_ != NULL) {
LOG(UncheckedStringEvent("To", StateToString(previous_->state_)));
}
}
+
+#ifdef ENABLE_HEAP_PROTECTION
+ if (FLAG_protect_heap && previous_ != NULL) {
+ if (state_ == EXTERNAL) {
+ // Are we (re)entering V8?
+ if (previous_->state_ != EXTERNAL) Heap::Unprotect();
+ } else {
+ // Are we leaving V8?
+ if (previous_->state_ == EXTERNAL) Heap::Protect();
+ }
+ }
+#endif
}
#endif
« no previous file with comments | « src/heap.cc ('k') | src/platform.h » ('j') | src/platform-linux.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698