Revision: 11995
Author:   [email protected]
Date:     Thu Jul  5 09:23:14 2012
Log:      Fix compilation when disabling debugger support.

Based on a patch by Remi Duraffort <[email protected]>: http://codereview.chromium.org/10702093/

[email protected]
BUG=
TEST=build with debuggersupport=off

Review URL: https://chromiumcodereview.appspot.com/10697085
http://code.google.com/p/v8/source/detail?r=11995

Modified:
 /branches/bleeding_edge/include/v8.h
 /branches/bleeding_edge/samples/lineprocessor.cc
 /branches/bleeding_edge/src/heap.h
 /branches/bleeding_edge/src/liveedit.cc
 /branches/bleeding_edge/src/runtime.cc
 /branches/bleeding_edge/test/cctest/test-heap-profiler.cc

=======================================
--- /branches/bleeding_edge/include/v8.h        Thu Jun 28 09:29:53 2012
+++ /branches/bleeding_edge/include/v8.h        Thu Jul  5 09:23:14 2012
@@ -3934,7 +3934,7 @@
   static const int kNullValueRootIndex = 7;
   static const int kTrueValueRootIndex = 8;
   static const int kFalseValueRootIndex = 9;
-  static const int kEmptySymbolRootIndex = 128;
+  static const int kEmptySymbolRootIndex = 112;

   static const int kJSObjectType = 0xaa;
   static const int kFirstNonstringType = 0x80;
=======================================
--- /branches/bleeding_edge/samples/lineprocessor.cc Tue Jun 19 06:45:30 2012 +++ /branches/bleeding_edge/samples/lineprocessor.cc Thu Jul 5 09:23:14 2012
@@ -25,19 +25,11 @@
 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

-
-// This controls whether this sample is compiled with debugger support.
-// You may trace its usages in source text to see what parts of program
-// are responsible for debugging support.
-// Note that V8 itself should be compiled with enabled debugger support
-// to have it all working.
-#define SUPPORT_DEBUGGING
-
 #include <v8.h>

-#ifdef SUPPORT_DEBUGGING
+#ifdef ENABLE_DEBUGGER_SUPPORT
 #include <v8-debug.h>
-#endif
+#endif  // ENABLE_DEBUGGER_SUPPORT

 #include <fcntl.h>
 #include <string.h>
@@ -116,7 +108,7 @@
                  bool report_exceptions);


-#ifdef SUPPORT_DEBUGGING
+#ifdef ENABLE_DEBUGGER_SUPPORT
 v8::Persistent<v8::Context> debug_message_context;

 void DispatchDebugMessages() {
@@ -135,7 +127,7 @@

   v8::Debug::ProcessDebugMessages();
 }
-#endif
+#endif  // ENABLE_DEBUGGER_SUPPORT


 int RunMain(int argc, char* argv[]) {
@@ -146,11 +138,11 @@
   v8::Handle<v8::Value> script_name(NULL);
   int script_param_counter = 0;

-#ifdef SUPPORT_DEBUGGING
+#ifdef ENABLE_DEBUGGER_SUPPORT
   int port_number = -1;
   bool wait_for_connection = false;
   bool support_callback = false;
-#endif
+#endif  // ENABLE_DEBUGGER_SUPPORT

   MainCycleType cycle_type = CycleInCpp;

@@ -164,7 +156,7 @@
       cycle_type = CycleInCpp;
     } else if (strcmp(str, "--main-cycle-in-js") == 0) {
       cycle_type = CycleInJs;
-#ifdef SUPPORT_DEBUGGING
+#ifdef ENABLE_DEBUGGER_SUPPORT
     } else if (strcmp(str, "--callback") == 0) {
       support_callback = true;
     } else if (strcmp(str, "--wait-for-connection") == 0) {
@@ -172,7 +164,7 @@
     } else if (strcmp(str, "-p") == 0 && i + 1 < argc) {
       port_number = atoi(argv[i + 1]);  // NOLINT
       i++;
-#endif
+#endif  // ENABLE_DEBUGGER_SUPPORT
     } else if (strncmp(str, "--", 2) == 0) {
       printf("Warning: unknown flag %s.\nTry --help for options\n", str);
     } else if (strcmp(str, "-e") == 0 && i + 1 < argc) {
@@ -219,7 +211,7 @@
   // Enter the newly created execution environment.
   v8::Context::Scope context_scope(context);

-#ifdef SUPPORT_DEBUGGING
+#ifdef ENABLE_DEBUGGER_SUPPORT
   debug_message_context = v8::Persistent<v8::Context>::New(context);

   v8::Locker locker;
@@ -231,7 +223,7 @@
   if (port_number != -1) {
v8::Debug::EnableAgent("lineprocessor", port_number, wait_for_connection);
   }
-#endif
+#endif  // ENABLE_DEBUGGER_SUPPORT

   bool report_exceptions = true;

@@ -272,9 +264,9 @@

bool RunCppCycle(v8::Handle<v8::Script> script, v8::Local<v8::Context> context,
                  bool report_exceptions) {
-#ifdef SUPPORT_DEBUGGING
+#ifdef ENABLE_DEBUGGER_SUPPORT
   v8::Locker lock;
-#endif
+#endif  // ENABLE_DEBUGGER_SUPPORT

   v8::Handle<v8::String> fun_name = v8::String::New("ProcessLine");
   v8::Handle<v8::Value> process_val =
@@ -427,9 +419,9 @@

   char* res;
   {
-#ifdef SUPPORT_DEBUGGING
+#ifdef ENABLE_DEBUGGER_SUPPORT
     v8::Unlocker unlocker;
-#endif
+#endif  // ENABLE_DEBUGGER_SUPPORT
     res = fgets(buffer, kBufferSize, stdin);
   }
   if (res == NULL) {
=======================================
--- /branches/bleeding_edge/src/heap.h  Mon Jun 25 02:14:47 2012
+++ /branches/bleeding_edge/src/heap.h  Thu Jul  5 09:23:14 2012
@@ -1392,15 +1392,15 @@
     STRONG_ROOT_LIST(ROOT_INDEX_DECLARATION)
 #undef ROOT_INDEX_DECLARATION

-// Utility type maps
-#define DECLARE_STRUCT_MAP(NAME, Name, name) k##Name##MapRootIndex,
-  STRUCT_LIST(DECLARE_STRUCT_MAP)
-#undef DECLARE_STRUCT_MAP
-
 #define SYMBOL_INDEX_DECLARATION(name, str) k##name##RootIndex,
     SYMBOL_LIST(SYMBOL_INDEX_DECLARATION)
 #undef SYMBOL_DECLARATION

+    // Utility type maps
+#define DECLARE_STRUCT_MAP(NAME, Name, name) k##Name##MapRootIndex,
+    STRUCT_LIST(DECLARE_STRUCT_MAP)
+#undef DECLARE_STRUCT_MAP
+
     kSymbolTableRootIndex,
     kStrongRootListLength = kSymbolTableRootIndex,
     kRootListLength
=======================================
--- /branches/bleeding_edge/src/liveedit.cc     Sun Jul  1 15:25:48 2012
+++ /branches/bleeding_edge/src/liveedit.cc     Thu Jul  5 09:23:14 2012
@@ -1878,7 +1878,8 @@


 void LiveEditFunctionTracker::RecordFunctionInfo(
-    Handle<SharedFunctionInfo> info, FunctionLiteral* lit) {
+    Handle<SharedFunctionInfo> info, FunctionLiteral* lit,
+    Zone* zone) {
 }


=======================================
--- /branches/bleeding_edge/src/runtime.cc      Thu Jul  5 06:54:20 2012
+++ /branches/bleeding_edge/src/runtime.cc      Thu Jul  5 09:23:14 2012
@@ -4892,6 +4892,7 @@
// Check whether debugger and is about to step into the callback that is passed
 // to a built-in function such as Array.forEach.
 RUNTIME_FUNCTION(MaybeObject*, Runtime_DebugCallbackSupportsStepping) {
+#ifdef ENABLE_DEBUGGER_SUPPORT
   if (!isolate->IsDebuggerActive()) return isolate->heap()->false_value();
   CONVERT_ARG_CHECKED(Object, callback, 0);
// We do not step into the callback if it's a builtin or not even a function.
@@ -4899,14 +4900,18 @@
     return isolate->heap()->false_value();
   }
   return isolate->heap()->true_value();
+#else
+  return isolate->heap()->false_value();
+#endif  // ENABLE_DEBUGGER_SUPPORT
 }


 // Set one shot breakpoints for the callback function that is passed to a
// built-in function such as Array.forEach to enable stepping into the callback.
 RUNTIME_FUNCTION(MaybeObject*, Runtime_DebugPrepareStepInIfStepping) {
+#ifdef ENABLE_DEBUGGER_SUPPORT
   Debug* debug = isolate->debug();
-  if (!debug->IsStepping()) return NULL;
+  if (!debug->IsStepping()) return isolate->heap()->undefined_value();
   CONVERT_ARG_HANDLE_CHECKED(JSFunction, callback, 0);
   HandleScope scope(isolate);
// When leaving the callback, step out has been activated, but not performed
@@ -4914,7 +4919,8 @@
   // again, we need to clear the step out at this point.
   debug->ClearStepOut();
   debug->FloodWithOneShot(callback);
-  return NULL;
+#endif  // ENABLE_DEBUGGER_SUPPORT
+  return isolate->heap()->undefined_value();
 }


=======================================
--- /branches/bleeding_edge/test/cctest/test-heap-profiler.cc Mon Jul 2 05:46:31 2012 +++ /branches/bleeding_edge/test/cctest/test-heap-profiler.cc Thu Jul 5 09:23:14 2012
@@ -1559,6 +1559,7 @@
 }


+#ifdef ENABLE_DEBUGGER_SUPPORT
 TEST(NoDebugObjectInSnapshot) {
   v8::HandleScope scope;
   LocalContext env;
@@ -1581,6 +1582,7 @@
   }
   CHECK_EQ(1, globals_count);
 }
+#endif  // ENABLE_DEBUGGER_SUPPORT


 TEST(PersistentHandleCount) {

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

Reply via email to