Revision: 4361
Author: [email protected]
Date: Thu Apr  8 06:37:39 2010
Log: Make VM state tracking to be independent of logging and profiling.

Also pull out VMState into its own set of source files.

Review URL: http://codereview.chromium.org/1519027
http://code.google.com/p/v8/source/detail?r=4361

Added:
 /branches/bleeding_edge/src/vm-state-inl.h
 /branches/bleeding_edge/src/vm-state.cc
 /branches/bleeding_edge/src/vm-state.h
Modified:
 /branches/bleeding_edge/SConstruct
 /branches/bleeding_edge/src/SConscript
 /branches/bleeding_edge/src/api.cc
 /branches/bleeding_edge/src/log-inl.h
 /branches/bleeding_edge/src/log.cc
 /branches/bleeding_edge/src/log.h
 /branches/bleeding_edge/src/platform-freebsd.cc
 /branches/bleeding_edge/src/platform-linux.cc
 /branches/bleeding_edge/src/platform-macos.cc
 /branches/bleeding_edge/src/platform-openbsd.cc
 /branches/bleeding_edge/src/platform-solaris.cc
 /branches/bleeding_edge/src/platform-win32.cc
 /branches/bleeding_edge/src/spaces.h
 /branches/bleeding_edge/src/v8.h
 /branches/bleeding_edge/tools/gyp/v8.gyp
 /branches/bleeding_edge/tools/v8.xcodeproj/project.pbxproj
 /branches/bleeding_edge/tools/visual_studio/v8_base.vcproj
 /branches/bleeding_edge/tools/visual_studio/v8_base_arm.vcproj
 /branches/bleeding_edge/tools/visual_studio/v8_base_x64.vcproj

=======================================
--- /dev/null
+++ /branches/bleeding_edge/src/vm-state-inl.h  Thu Apr  8 06:37:39 2010
@@ -0,0 +1,134 @@
+// Copyright 2010 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:
+//
+//     * Redistributions of source code must retain the above copyright
+//       notice, this list of conditions and the following disclaimer.
+//     * Redistributions in binary form must reproduce the above
+//       copyright notice, this list of conditions and the following
+//       disclaimer in the documentation and/or other materials provided
+//       with the distribution.
+//     * Neither the name of Google Inc. nor the names of its
+//       contributors may be used to endorse or promote products derived
+//       from this software without specific prior written permission.
+//
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+#ifndef V8_VM_STATE_INL_H_
+#define V8_VM_STATE_INL_H_
+
+#include "vm-state.h"
+
+namespace v8 {
+namespace internal {
+
+//
+// VMState class implementation.  A simple stack of VM states held by the
+// logger and partially threaded through the call stack. States are pushed by
+// VMState construction and popped by destruction.
+//
+#ifdef ENABLE_VMSTATE_TRACKING
+inline const char* StateToString(StateTag state) {
+  switch (state) {
+    case JS:
+      return "JS";
+    case GC:
+      return "GC";
+    case COMPILER:
+      return "COMPILER";
+    case OTHER:
+      return "OTHER";
+    default:
+      UNREACHABLE();
+      return NULL;
+  }
+}
+
+VMState::VMState(StateTag state)
+    : disabled_(true),
+      state_(OTHER),
+      external_callback_(NULL) {
+#ifdef ENABLE_LOGGING_AND_PROFILING
+  if (!Logger::is_logging() && !CpuProfiler::is_profiling()) {
+    return;
+  }
+#endif
+
+  disabled_ = false;
+#if !defined(ENABLE_HEAP_PROTECTION)
+  // When not protecting the heap, there is no difference between
+  // EXTERNAL and OTHER.  As an optimization in that case, we will not
+  // perform EXTERNAL->OTHER transitions through the API.  We thus
+  // compress the two states into one.
+  if (state == EXTERNAL) state = OTHER;
+#endif
+  state_ = state;
+  previous_ = current_state_;  // Save the previous state.
+  current_state_ = this;       // Install the new state.
+
+#ifdef ENABLE_LOGGING_AND_PROFILING
+  if (FLAG_log_state_changes) {
+    LOG(UncheckedStringEvent("Entering", StateToString(state_)));
+    if (previous_ != NULL) {
+      LOG(UncheckedStringEvent("From", StateToString(previous_->state_)));
+    }
+  }
+#endif
+
+#ifdef ENABLE_HEAP_PROTECTION
+  if (FLAG_protect_heap) {
+    if (state_ == EXTERNAL) {
+      // We are leaving V8.
+      ASSERT((previous_ != NULL) && (previous_->state_ != EXTERNAL));
+      Heap::Protect();
+    } else if ((previous_ == NULL) || (previous_->state_ == EXTERNAL)) {
+      // We are entering V8.
+      Heap::Unprotect();
+    }
+  }
+#endif
+}
+
+
+VMState::~VMState() {
+  if (disabled_) return;
+  current_state_ = previous_;  // Return to the previous state.
+
+#ifdef ENABLE_LOGGING_AND_PROFILING
+  if (FLAG_log_state_changes) {
+    LOG(UncheckedStringEvent("Leaving", StateToString(state_)));
+    if (previous_ != NULL) {
+      LOG(UncheckedStringEvent("To", StateToString(previous_->state_)));
+    }
+  }
+#endif  // ENABLE_LOGGING_AND_PROFILING
+
+#ifdef ENABLE_HEAP_PROTECTION
+  if (FLAG_protect_heap) {
+    if (state_ == EXTERNAL) {
+      // We are reentering V8.
+      ASSERT((previous_ != NULL) && (previous_->state_ != EXTERNAL));
+      Heap::Unprotect();
+    } else if ((previous_ == NULL) || (previous_->state_ == EXTERNAL)) {
+      // We are leaving V8.
+      Heap::Protect();
+    }
+  }
+#endif  // ENABLE_HEAP_PROTECTION
+}
+#endif  // ENABLE_VMSTATE_TRACKING
+
+} }  // namespace v8::internal
+
+#endif  // V8_VM_STATE_INL_H_
=======================================
--- /dev/null
+++ /branches/bleeding_edge/src/vm-state.cc     Thu Apr  8 06:37:39 2010
@@ -0,0 +1,39 @@
+// Copyright 2010 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:
+//
+//     * Redistributions of source code must retain the above copyright
+//       notice, this list of conditions and the following disclaimer.
+//     * Redistributions in binary form must reproduce the above
+//       copyright notice, this list of conditions and the following
+//       disclaimer in the documentation and/or other materials provided
+//       with the distribution.
+//     * Neither the name of Google Inc. nor the names of its
+//       contributors may be used to endorse or promote products derived
+//       from this software without specific prior written permission.
+//
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+#include "v8.h"
+
+#include "vm-state.h"
+
+namespace v8 {
+namespace internal {
+
+#ifdef ENABLE_VMSTATE_TRACKING
+VMState* VMState::current_state_ = NULL;
+#endif
+
+} }  // namespace v8::internal
=======================================
--- /dev/null
+++ /branches/bleeding_edge/src/vm-state.h      Thu Apr  8 06:37:39 2010
@@ -0,0 +1,70 @@
+// Copyright 2010 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:
+//
+//     * Redistributions of source code must retain the above copyright
+//       notice, this list of conditions and the following disclaimer.
+//     * Redistributions in binary form must reproduce the above
+//       copyright notice, this list of conditions and the following
+//       disclaimer in the documentation and/or other materials provided
+//       with the distribution.
+//     * Neither the name of Google Inc. nor the names of its
+//       contributors may be used to endorse or promote products derived
+//       from this software without specific prior written permission.
+//
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+#ifndef V8_VM_STATE_H_
+#define V8_VM_STATE_H_
+
+namespace v8 {
+namespace internal {
+
+class VMState BASE_EMBEDDED {
+#ifdef ENABLE_VMSTATE_TRACKING
+ public:
+  inline VMState(StateTag state);
+  inline ~VMState();
+
+  StateTag state() { return state_; }
+  void set_external_callback(Address external_callback) {
+    external_callback_ = external_callback;
+  }
+
+  static StateTag current_state() {
+    return current_state_ ? current_state_->state() : EXTERNAL;
+  }
+
+  static Address external_callback() {
+    return current_state_ ? current_state_->external_callback_ : NULL;
+  }
+
+ private:
+  bool disabled_;
+  StateTag state_;
+  VMState* previous_;
+  Address external_callback_;
+
+  // A stack of VM states.
+  static VMState* current_state_;
+#else
+ public:
+  explicit VMState(StateTag state) {}
+#endif
+};
+
+} }  // namespace v8::internal
+
+
+#endif  // V8_VM_STATE_H_
=======================================
--- /branches/bleeding_edge/SConstruct  Tue Mar 30 04:38:39 2010
+++ /branches/bleeding_edge/SConstruct  Thu Apr  8 06:37:39 2010
@@ -102,8 +102,14 @@
     'mode:debug': {
       'CPPDEFINES': ['V8_ENABLE_CHECKS']
     },
+    'vmstate:on': {
+      'CPPDEFINES':   ['ENABLE_VMSTATE_TRACKING'],
+    },
+    'protectheap:on': {
+ 'CPPDEFINES': ['ENABLE_VMSTATE_TRACKING', 'ENABLE_HEAP_PROTECTION'],
+    },
     'profilingsupport:on': {
-      'CPPDEFINES':   ['ENABLE_LOGGING_AND_PROFILING'],
+ 'CPPDEFINES': ['ENABLE_VMSTATE_TRACKING', 'ENABLE_LOGGING_AND_PROFILING'],
     },
     'cppprofilesprocessor:on': {
       'CPPDEFINES':   ['ENABLE_CPP_PROFILES_PROCESSOR'],
@@ -672,6 +678,16 @@
     'default': 'static',
     'help': 'the type of library to produce'
   },
+  'vmstate': {
+    'values': ['on', 'off'],
+    'default': 'off',
+    'help': 'enable VM state tracking'
+  },
+  'protectheap': {
+    'values': ['on', 'off'],
+    'default': 'off',
+    'help': 'enable heap protection'
+  },
   'profilingsupport': {
     'values': ['on', 'off'],
     'default': 'on',
=======================================
--- /branches/bleeding_edge/src/SConscript      Fri Mar 26 04:34:00 2010
+++ /branches/bleeding_edge/src/SConscript      Thu Apr  8 06:37:39 2010
@@ -111,6 +111,7 @@
     variables.cc
     version.cc
     virtual-frame.cc
+    vm-state.cc
     zone.cc
     """),
   'arch:arm': Split("""
=======================================
--- /branches/bleeding_edge/src/api.cc  Tue Apr  6 10:58:43 2010
+++ /branches/bleeding_edge/src/api.cc  Thu Apr  8 06:37:39 2010
@@ -2861,6 +2861,7 @@


 void v8::Object::SetPointerInInternalField(int index, void* value) {
+  ENTER_V8;
   i::Object* as_object = reinterpret_cast<i::Object*>(value);
   if (as_object->IsSmi()) {
     Utils::OpenHandle(this)->SetInternalField(index, as_object);
@@ -3425,6 +3426,7 @@
   }
   i::Handle<i::JSObject> paragon_handle(i::JSObject::cast(paragon));
   EXCEPTION_PREAMBLE();
+  ENTER_V8;
   i::Handle<i::JSObject> result = i::Copy(paragon_handle);
   has_pending_exception = result.is_null();
   EXCEPTION_BAILOUT_CHECK(Local<Object>());
=======================================
--- /branches/bleeding_edge/src/log-inl.h       Wed Apr  7 07:18:26 2010
+++ /branches/bleeding_edge/src/log-inl.h       Thu Apr  8 06:37:39 2010
@@ -34,94 +34,7 @@
 namespace v8 {
 namespace internal {

-//
-// VMState class implementation.  A simple stack of VM states held by the
-// logger and partially threaded through the call stack. States are pushed by
-// VMState construction and popped by destruction.
-//
 #ifdef ENABLE_LOGGING_AND_PROFILING
-inline const char* StateToString(StateTag state) {
-  switch (state) {
-    case JS:
-      return "JS";
-    case GC:
-      return "GC";
-    case COMPILER:
-      return "COMPILER";
-    case OTHER:
-      return "OTHER";
-    default:
-      UNREACHABLE();
-      return NULL;
-  }
-}
-
-VMState::VMState(StateTag state)
-    : disabled_(true),
-      state_(OTHER),
-      external_callback_(NULL) {
-  if (!Logger::is_logging() && !CpuProfiler::is_profiling()) {
-    return;
-}
-
-  disabled_ = false;
-#if !defined(ENABLE_HEAP_PROTECTION)
-  // When not protecting the heap, there is no difference between
-  // EXTERNAL and OTHER.  As an optimization in that case, we will not
-  // perform EXTERNAL->OTHER transitions through the API.  We thus
-  // compress the two states into one.
-  if (state == EXTERNAL) state = OTHER;
-#endif
-  state_ = state;
-  previous_ = Logger::current_state_;
-  Logger::current_state_ = this;
-
-  if (FLAG_log_state_changes) {
-    LOG(UncheckedStringEvent("Entering", StateToString(state_)));
-    if (previous_ != NULL) {
-      LOG(UncheckedStringEvent("From", StateToString(previous_->state_)));
-    }
-  }
-
-#ifdef ENABLE_HEAP_PROTECTION
-  if (FLAG_protect_heap && previous_ != NULL) {
-    if (state_ == EXTERNAL) {
-      // We are leaving V8.
-      ASSERT(previous_->state_ != EXTERNAL);
-      Heap::Protect();
-    } else if (previous_->state_ == EXTERNAL) {
-      // We are entering V8.
-      Heap::Unprotect();
-    }
-  }
-#endif
-}
-
-
-VMState::~VMState() {
-  if (disabled_) return;
-  Logger::current_state_ = previous_;
-
-  if (FLAG_log_state_changes) {
-    LOG(UncheckedStringEvent("Leaving", StateToString(state_)));
-    if (previous_ != NULL) {
-      LOG(UncheckedStringEvent("To", StateToString(previous_->state_)));
-    }
-  }
-
-#ifdef ENABLE_HEAP_PROTECTION
-  if (FLAG_protect_heap && previous_ != NULL) {
-    if (state_ == EXTERNAL) {
-      // We are reentering V8.
-      ASSERT(previous_->state_ != EXTERNAL);
-      Heap::Unprotect();
-    } else if (previous_->state_ == EXTERNAL) {
-      // We are leaving V8.
-      Heap::Protect();
-    }
-  }
-#endif
-}

Logger::LogEventsAndTags Logger::ToNativeByScript(Logger::LogEventsAndTags tag,
                                                   Script* script) {
@@ -139,10 +52,10 @@
   }
 #else
   return tag;
-#endif
+#endif  // ENABLE_CPP_PROFILES_PROCESSOR
 }

-#endif
+#endif  // ENABLE_LOGGING_AND_PROFILING


 } }  // namespace v8::internal
=======================================
--- /branches/bleeding_edge/src/log.cc  Wed Apr  7 07:18:26 2010
+++ /branches/bleeding_edge/src/log.cc  Thu Apr  8 06:37:39 2010
@@ -162,8 +162,7 @@
   }

   int i = 0;
-  const Address callback = Logger::current_state_ != NULL ?
-      Logger::current_state_->external_callback() : NULL;
+  const Address callback = VMState::external_callback();
   if (callback != NULL) {
     sample->stack[i++] = callback;
   }
@@ -327,8 +326,6 @@
 //
 Ticker* Logger::ticker_ = NULL;
 Profiler* Logger::profiler_ = NULL;
-VMState* Logger::current_state_ = NULL;
-VMState Logger::bottom_state_(EXTERNAL);
 SlidingStateWindow* Logger::sliding_state_window_ = NULL;
 const char** Logger::log_events_ = NULL;
 CompressionHelper* Logger::compression_helper_ = NULL;
@@ -1481,7 +1478,7 @@
     }
   }

-  current_state_ = &bottom_state_;
+ ASSERT(VMState::current_state_ == NULL); // NULL implies outermost external.

   ticker_ = new Ticker(kSamplingIntervalMs);

=======================================
--- /branches/bleeding_edge/src/log.h   Wed Apr  7 07:18:26 2010
+++ /branches/bleeding_edge/src/log.h   Thu Apr  8 06:37:39 2010
@@ -87,30 +87,6 @@
 #define LOG(Call) ((void) 0)
 #endif

-class VMState BASE_EMBEDDED {
-#ifdef ENABLE_LOGGING_AND_PROFILING
- public:
-  inline VMState(StateTag state);
-  inline ~VMState();
-
-  StateTag state() { return state_; }
-  Address external_callback() { return external_callback_; }
-  void set_external_callback(Address external_callback) {
-    external_callback_ = external_callback;
-  }
-
- private:
-  bool disabled_;
-  StateTag state_;
-  VMState* previous_;
-  Address external_callback_;
-#else
- public:
-  explicit VMState(StateTag state) {}
-#endif
-};
-
-
 #define LOG_EVENTS_AND_TAGS_LIST(V) \
   V(CODE_CREATION_EVENT,            "code-creation",          "cc")       \
   V(CODE_MOVE_EVENT,                "code-move",              "cm")       \
@@ -264,10 +240,6 @@
   static void LogRuntime(Vector<const char> format, JSArray* args);

 #ifdef ENABLE_LOGGING_AND_PROFILING
-  static StateTag state() {
-    return current_state_ ? current_state_->state() : OTHER;
-  }
-
   static bool is_logging() {
     return logging_nesting_ > 0;
   }
@@ -354,12 +326,6 @@
   // of samples.
   static Profiler* profiler_;

-  // A stack of VM states.
-  static VMState* current_state_;
-
-  // Singleton bottom or default vm state.
-  static VMState bottom_state_;
-
   // SlidingStateWindow instance keeping a sliding window of the most
   // recent VM states.
   static SlidingStateWindow* sliding_state_window_;
=======================================
--- /branches/bleeding_edge/src/platform-freebsd.cc     Tue Mar 23 04:40:38 2010
+++ /branches/bleeding_edge/src/platform-freebsd.cc     Thu Apr  8 06:37:39 2010
@@ -569,7 +569,7 @@
   TickSample sample;

   // We always sample the VM state.
-  sample.state = Logger::state();
+  sample.state = VMState::current_state();

   // If profiling, we extract the current pc and sp.
   if (active_sampler_->IsProfiling()) {
=======================================
--- /branches/bleeding_edge/src/platform-linux.cc       Wed Apr  7 07:18:26 2010
+++ /branches/bleeding_edge/src/platform-linux.cc       Thu Apr  8 06:37:39 2010
@@ -738,7 +738,7 @@
 #endif

   // We always sample the VM state.
-  sample->state = Logger::state();
+  sample->state = VMState::current_state();
   // If profiling, we extract the current pc and sp.
   if (active_sampler_->IsProfiling()) {
// Extracting the sample from the context is extremely machine dependent.
=======================================
--- /branches/bleeding_edge/src/platform-macos.cc       Wed Apr  7 07:18:26 2010
+++ /branches/bleeding_edge/src/platform-macos.cc       Thu Apr  8 06:37:39 2010
@@ -557,7 +557,7 @@
 #endif  // ENABLE_CPP_PROFILES_PROCESSOR

       // We always sample the VM state.
-      sample->state = Logger::state();
+      sample->state = VMState::current_state();
       // If profiling, we record the pc and sp of the profiled thread.
       if (sampler_->IsProfiling()
           && KERN_SUCCESS == thread_suspend(profiled_thread_)) {
=======================================
--- /branches/bleeding_edge/src/platform-openbsd.cc     Tue Mar 23 04:40:38 2010
+++ /branches/bleeding_edge/src/platform-openbsd.cc     Thu Apr  8 06:37:39 2010
@@ -542,7 +542,7 @@
   TickSample sample;

   // We always sample the VM state.
-  sample.state = Logger::state();
+  sample.state = VMState::current_state();

   active_sampler_->Tick(&sample);
 }
=======================================
--- /branches/bleeding_edge/src/platform-solaris.cc     Mon Jan 25 08:48:53 2010
+++ /branches/bleeding_edge/src/platform-solaris.cc     Thu Apr  8 06:37:39 2010
@@ -533,7 +533,7 @@
   sample.fp = 0;

   // We always sample the VM state.
-  sample.state = Logger::state();
+  sample.state = VMState::current_state();

   active_sampler_->Tick(&sample);
 }
=======================================
--- /branches/bleeding_edge/src/platform-win32.cc       Wed Apr  7 07:18:26 2010
+++ /branches/bleeding_edge/src/platform-win32.cc       Thu Apr  8 06:37:39 2010
@@ -1816,7 +1816,7 @@
 #endif  // ENABLE_CPP_PROFILES_PROCESSOR

       // We always sample the VM state.
-      sample->state = Logger::state();
+      sample->state = VMState::current_state();
       // If profiling, we record the pc and sp of the profiled thread.
       if (sampler_->IsProfiling()
           && SuspendThread(profiled_thread_) != (DWORD)-1) {
=======================================
--- /branches/bleeding_edge/src/spaces.h        Thu Jan 28 00:46:56 2010
+++ /branches/bleeding_edge/src/spaces.h        Thu Apr  8 06:37:39 2010
@@ -301,6 +301,12 @@

   virtual int Size() = 0;

+#ifdef ENABLE_HEAP_PROTECTION
+  // Protect/unprotect the space by marking it read-only/writable.
+  virtual void Protect() = 0;
+  virtual void Unprotect() = 0;
+#endif
+
 #ifdef DEBUG
   virtual void Print() = 0;
 #endif
@@ -1169,6 +1175,12 @@
   bool Commit();
   bool Uncommit();

+#ifdef ENABLE_HEAP_PROTECTION
+  // Protect/unprotect the space by marking it read-only/writable.
+  virtual void Protect() {}
+  virtual void Unprotect() {}
+#endif
+
 #ifdef DEBUG
   virtual void Print();
   virtual void Verify();
=======================================
--- /branches/bleeding_edge/src/v8.h    Wed Apr  7 01:18:51 2010
+++ /branches/bleeding_edge/src/v8.h    Thu Apr  8 06:37:39 2010
@@ -69,6 +69,7 @@
 #include "log-inl.h"
 #include "cpu-profiler-inl.h"
 #include "handles-inl.h"
+#include "vm-state-inl.h"

 namespace v8 {
 namespace internal {
=======================================
--- /branches/bleeding_edge/tools/gyp/v8.gyp    Tue Apr  6 02:27:09 2010
+++ /branches/bleeding_edge/tools/gyp/v8.gyp    Thu Apr  8 06:37:39 2010
@@ -416,6 +416,9 @@
         '../../src/virtual-frame-inl.h',
         '../../src/virtual-frame.cc',
         '../../src/virtual-frame.h',
+        '../../src/vm-state-inl.h',
+        '../../src/vm-state.cc',
+        '../../src/vm-state.h',
         '../../src/zone-inl.h',
         '../../src/zone.cc',
         '../../src/zone.h',
=======================================
--- /branches/bleeding_edge/tools/v8.xcodeproj/project.pbxproj Tue Apr 6 10:15:19 2010 +++ /branches/bleeding_edge/tools/v8.xcodeproj/project.pbxproj Thu Apr 8 06:37:39 2010
@@ -220,6 +220,8 @@
9F73E3B2114E61A100F84A5A /* profile-generator.cc in Sources */ = {isa = PBXBuildFile; fileRef = 9F73E3AF114E61A100F84A5A /* profile-generator.cc */; }; 9F92FAA90F8F28AD0089F02C /* func-name-inferrer.cc in Sources */ = {isa = PBXBuildFile; fileRef = 9F92FAA70F8F28AD0089F02C /* func-name-inferrer.cc */; }; 9F92FAAA0F8F28AD0089F02C /* func-name-inferrer.cc in Sources */ = {isa = PBXBuildFile; fileRef = 9F92FAA70F8F28AD0089F02C /* func-name-inferrer.cc */; }; + 9FA37335116DD9F000C4CD55 /* vm-state.cc in Sources */ = {isa = PBXBuildFile; fileRef = 9FA37333116DD9F000C4CD55 /* vm-state.cc */; }; + 9FA37336116DD9F000C4CD55 /* vm-state.cc in Sources */ = {isa = PBXBuildFile; fileRef = 9FA37333116DD9F000C4CD55 /* vm-state.cc */; }; 9FBE03DE10BD409900F8BFBA /* fast-codegen.cc in Sources */ = {isa = PBXBuildFile; fileRef = 9FBE03DC10BD409900F8BFBA /* fast-codegen.cc */; }; 9FBE03DF10BD409900F8BFBA /* fast-codegen.cc in Sources */ = {isa = PBXBuildFile; fileRef = 9FBE03DC10BD409900F8BFBA /* fast-codegen.cc */; }; 9FBE03E210BD40EA00F8BFBA /* fast-codegen-ia32.cc in Sources */ = {isa = PBXBuildFile; fileRef = 9FBE03E110BD40EA00F8BFBA /* fast-codegen-ia32.cc */; };
@@ -570,6 +572,9 @@
9F92FAA70F8F28AD0089F02C /* func-name-inferrer.cc */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = "func-name-inferrer.cc"; sourceTree = "<group>"; }; 9F92FAA80F8F28AD0089F02C /* func-name-inferrer.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "func-name-inferrer.h"; sourceTree = "<group>"; }; 9FA36F62116BA26500C4CD55 /* v8-profiler.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "v8-profiler.h"; sourceTree = "<group>"; }; + 9FA37332116DD9F000C4CD55 /* vm-state-inl.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "vm-state-inl.h"; sourceTree = "<group>"; }; + 9FA37333116DD9F000C4CD55 /* vm-state.cc */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = "vm-state.cc"; sourceTree = "<group>"; }; + 9FA37334116DD9F000C4CD55 /* vm-state.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "vm-state.h"; sourceTree = "<group>"; }; 9FBE03DC10BD409900F8BFBA /* fast-codegen.cc */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = "fast-codegen.cc"; sourceTree = "<group>"; }; 9FBE03DD10BD409900F8BFBA /* fast-codegen.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "fast-codegen.h"; sourceTree = "<group>"; }; 9FBE03E110BD40EA00F8BFBA /* fast-codegen-ia32.cc */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = "fast-codegen-ia32.cc"; path = "ia32/fast-codegen-ia32.cc"; sourceTree = "<group>"; };
@@ -918,6 +923,9 @@
                                58950D590F55514900F3E8BA /* 
virtual-frame-ia32.h */,
                                58950D5A0F55514900F3E8BA /* virtual-frame.cc */,
                                58950D5B0F55514900F3E8BA /* virtual-frame.h */,
+                               9FA37332116DD9F000C4CD55 /* vm-state-inl.h */,
+                               9FA37333116DD9F000C4CD55 /* vm-state.cc */,
+                               9FA37334116DD9F000C4CD55 /* vm-state.h */,
                                897FF1A10E719B8F00D62E90 /* zone-inl.h */,
                                897FF1A20E719B8F00D62E90 /* zone.cc */,
                                897FF1A30E719B8F00D62E90 /* zone.h */,
@@ -1276,6 +1284,7 @@
                                9F73E3B2114E61A100F84A5A /* 
profile-generator.cc in Sources */,
                                9F2B3712114FF62D007CDAF4 /* circular-queue.cc 
in Sources */,
                                9F2B37271152CEA0007CDAF4 /* cpu-profiler.cc in 
Sources */,
+                               9FA37336116DD9F000C4CD55 /* vm-state.cc in 
Sources */,
                        );
                        runOnlyForDeploymentPostprocessing = 0;
                };
@@ -1390,6 +1399,7 @@
                                9F73E3B1114E61A100F84A5A /* 
profile-generator.cc in Sources */,
                                9F2B3711114FF62D007CDAF4 /* circular-queue.cc 
in Sources */,
                                9F2B37261152CEA0007CDAF4 /* cpu-profiler.cc in 
Sources */,
+                               9FA37335116DD9F000C4CD55 /* vm-state.cc in 
Sources */,
                        );
                        runOnlyForDeploymentPostprocessing = 0;
                };
=======================================
--- /branches/bleeding_edge/tools/visual_studio/v8_base.vcproj Tue Apr 6 10:15:19 2010 +++ /branches/bleeding_edge/tools/visual_studio/v8_base.vcproj Thu Apr 8 06:37:39 2010
@@ -1035,6 +1035,18 @@
                        <File
                                RelativePath="..\..\src\virtual-frame-heavy.cc"
                                >
+                       </File>
+                       <File
+                               RelativePath="..\..\src\vm-state.cc"
+                               >
+                       </File>
+                       <File
+                               RelativePath="..\..\src\vm-state-inl.h"
+                               >
+                       </File>
+                       <File
+                               RelativePath="..\..\src\vm-state.h"
+                               >
                        </File>
                        <File
                                RelativePath="..\..\src\zone-inl.h"
=======================================
--- /branches/bleeding_edge/tools/visual_studio/v8_base_arm.vcproj Tue Apr 6 10:15:19 2010 +++ /branches/bleeding_edge/tools/visual_studio/v8_base_arm.vcproj Thu Apr 8 06:37:39 2010
@@ -1027,6 +1027,18 @@
                        <File
                                RelativePath="..\..\src\virtual-frame-light.cc"
                                >
+                       </File>
+                       <File
+                               RelativePath="..\..\src\vm-state.cc"
+                               >
+                       </File>
+                       <File
+                               RelativePath="..\..\src\vm-state-inl.h"
+                               >
+                       </File>
+                       <File
+                               RelativePath="..\..\src\vm-state.h"
+                               >
                        </File>
                        <File
                                RelativePath="..\..\src\zone-inl.h"
=======================================
--- /branches/bleeding_edge/tools/visual_studio/v8_base_x64.vcproj Tue Apr 6 10:15:19 2010 +++ /branches/bleeding_edge/tools/visual_studio/v8_base_x64.vcproj Thu Apr 8 06:37:39 2010
@@ -1012,6 +1012,18 @@
                        <File
                                RelativePath="..\..\src\virtual-frame-heavy.cc"
                                >
+                       </File>
+                       <File
+                               RelativePath="..\..\src\vm-state.cc"
+                               >
+                       </File>
+                       <File
+                               RelativePath="..\..\src\vm-state-inl.h"
+                               >
+                       </File>
+                       <File
+                               RelativePath="..\..\src\vm-state.h"
+                               >
                        </File>
                        <File
                                RelativePath="..\..\src\zone-inl.h"

--
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev

To unsubscribe, reply using "remove me" as the subject.

Reply via email to