Author: [email protected]
Date: Mon Apr 20 09:36:13 2009
New Revision: 1745

Modified:
    branches/bleeding_edge/SConstruct
    branches/bleeding_edge/src/api.cc
    branches/bleeding_edge/src/assembler.cc
    branches/bleeding_edge/src/assembler.h
    branches/bleeding_edge/src/bootstrapper.cc
    branches/bleeding_edge/src/builtins-ia32.cc
    branches/bleeding_edge/src/builtins.cc
    branches/bleeding_edge/src/builtins.h
    branches/bleeding_edge/src/codegen-arm.cc
    branches/bleeding_edge/src/codegen-ia32.cc
    branches/bleeding_edge/src/codegen.cc
    branches/bleeding_edge/src/compiler.cc
    branches/bleeding_edge/src/d8.cc
    branches/bleeding_edge/src/d8.h
    branches/bleeding_edge/src/debug-agent.cc
    branches/bleeding_edge/src/debug-agent.h
    branches/bleeding_edge/src/debug-arm.cc
    branches/bleeding_edge/src/debug-ia32.cc
    branches/bleeding_edge/src/debug.cc
    branches/bleeding_edge/src/debug.h
    branches/bleeding_edge/src/execution.cc
    branches/bleeding_edge/src/execution.h
    branches/bleeding_edge/src/factory.cc
    branches/bleeding_edge/src/factory.h
    branches/bleeding_edge/src/handles.cc
    branches/bleeding_edge/src/heap.cc
    branches/bleeding_edge/src/ic-inl.h
    branches/bleeding_edge/src/ic.cc
    branches/bleeding_edge/src/ic.h
    branches/bleeding_edge/src/macro-assembler-arm.cc
    branches/bleeding_edge/src/macro-assembler-arm.h
    branches/bleeding_edge/src/macro-assembler-ia32.cc
    branches/bleeding_edge/src/macro-assembler-ia32.h
    branches/bleeding_edge/src/objects-inl.h
    branches/bleeding_edge/src/objects.cc
    branches/bleeding_edge/src/objects.h
    branches/bleeding_edge/src/runtime.cc
    branches/bleeding_edge/src/runtime.h
    branches/bleeding_edge/src/serialize.cc
    branches/bleeding_edge/src/stub-cache.cc
    branches/bleeding_edge/src/stub-cache.h
    branches/bleeding_edge/src/top.cc
    branches/bleeding_edge/src/v8.cc
    branches/bleeding_edge/src/v8.h
    branches/bleeding_edge/src/v8threads.cc

Log:
Add ENABLE_DEBUGGER_SUPPORT macro.

ENABLE_DEBUGGER_SUPPORT is enabled by default unless it is on Android  
platform.
On Android platform, it can also enabled by passing  
-DENABLE_DEBUGGER_SUPPORT flag to the compiler.

This should not affect any existing build (I hope, cross my fingers) except  
the build in real Android environment (in other word, it only affects me  
now).

There are lot of room for code refactoring in stead of using #ifdef all  
over the place. I will leave this to v8 folks.

Review URL: http://codereview.chromium.org/77035

Modified: branches/bleeding_edge/SConstruct
==============================================================================
--- branches/bleeding_edge/SConstruct   (original)
+++ branches/bleeding_edge/SConstruct   Mon Apr 20 09:36:13 2009
@@ -94,6 +94,7 @@
        'CCFLAGS':      ['-g', '-O0'],
        'CPPDEFINES':   ['ENABLE_DISASSEMBLER', 'DEBUG'],
        'os:android': {
+        'CPPDEFINES': ['ENABLE_DEBUGGER_SUPPORT'],
          'CCFLAGS':    ['-mthumb']
        }
      },
@@ -102,7 +103,7 @@
                         '-ffunction-sections'],
        'os:android': {
          'CCFLAGS':    ['-mthumb', '-Os'],
-        'CPPDEFINES': ['SK_RELEASE', 'NDEBUG']
+        'CPPDEFINES': ['SK_RELEASE', 'NDEBUG', 'ENABLE_DEBUGGER_SUPPORT']
        }
      },
      'os:linux': {

Modified: branches/bleeding_edge/src/api.cc
==============================================================================
--- branches/bleeding_edge/src/api.cc   (original)
+++ branches/bleeding_edge/src/api.cc   Mon Apr 20 09:36:13 2009
@@ -3180,7 +3180,7 @@

  // --- D e b u g   S u p p o r t ---

-
+#ifdef ENABLE_DEBUGGER_SUPPORT
  bool Debug::SetDebugEventListener(DebugEventCallback that, Handle<Value>  
data) {
    EnsureInitialized("v8::Debug::SetDebugEventListener()");
    ON_BAILOUT("v8::Debug::SetDebugEventListener()", return false);
@@ -3263,7 +3263,7 @@
  bool Debug::EnableAgent(const char* name, int port) {
    return i::Debugger::StartAgent(name, port);
  }
-
+#endif // ENABLE_DEBUGGER_SUPPORT

  namespace internal {


Modified: branches/bleeding_edge/src/assembler.cc
==============================================================================
--- branches/bleeding_edge/src/assembler.cc     (original)
+++ branches/bleeding_edge/src/assembler.cc     Mon Apr 20 09:36:13 2009
@@ -521,10 +521,10 @@
  ExternalReference::ExternalReference(const IC_Utility& ic_utility)
    : address_(ic_utility.address()) {}

-
+#ifdef ENABLE_DEBUGGER_SUPPORT
  ExternalReference::ExternalReference(const Debug_Address& debug_address)
    : address_(debug_address.address()) {}
-
+#endif

  ExternalReference::ExternalReference(StatsCounter* counter)
    : address_(reinterpret_cast<Address>(counter->GetInternalPointer())) {}
@@ -557,31 +557,25 @@
  }


-ExternalReference ExternalReference::debug_break() {
-  return ExternalReference(FUNCTION_ADDR(Debug::Break));
-}
-
-
  ExternalReference ExternalReference::new_space_start() {
    return ExternalReference(Heap::NewSpaceStart());
  }

+
  ExternalReference ExternalReference::new_space_allocation_top_address() {
    return ExternalReference(Heap::NewSpaceAllocationTopAddress());
  }

+
  ExternalReference ExternalReference::heap_always_allocate_scope_depth() {
    return ExternalReference(Heap::always_allocate_scope_depth_address());
  }

+
  ExternalReference ExternalReference::new_space_allocation_limit_address() {
    return ExternalReference(Heap::NewSpaceAllocationLimitAddress());
  }

-ExternalReference ExternalReference::debug_step_in_fp_address() {
-  return ExternalReference(Debug::step_in_fp_addr());
-}
-

  static double add_two_doubles(double x, double y) {
    return x + y;
@@ -617,5 +611,17 @@
    }
    return ExternalReference(FUNCTION_ADDR(function));
  }
+
+
+#ifdef ENABLE_DEBUGGER_SUPPORT
+ExternalReference ExternalReference::debug_break() {
+  return ExternalReference(FUNCTION_ADDR(Debug::Break));
+}
+
+
+ExternalReference ExternalReference::debug_step_in_fp_address() {
+  return ExternalReference(Debug::step_in_fp_addr());
+}
+#endif

  } }  // namespace v8::internal

Modified: branches/bleeding_edge/src/assembler.h
==============================================================================
--- branches/bleeding_edge/src/assembler.h      (original)
+++ branches/bleeding_edge/src/assembler.h      Mon Apr 20 09:36:13 2009
@@ -346,8 +346,10 @@

   
//----------------------------------------------------------------------------
  class IC_Utility;
-class Debug_Address;
  class SCTableReference;
+#ifdef ENABLE_DEBUGGER_SUPPORT
+class Debug_Address;
+#endif

  // An ExternalReference represents a C++ address called from the generated
  // code. All references to C++ functions and must be encapsulated in an
@@ -365,7 +367,9 @@

    explicit ExternalReference(const IC_Utility& ic_utility);

+#ifdef ENABLE_DEBUGGER_SUPPORT
    explicit ExternalReference(const Debug_Address& debug_address);
+#endif

    explicit ExternalReference(StatsCounter* counter);

@@ -388,9 +392,6 @@
    // Static variable RegExpStack::limit_address()
    static ExternalReference address_of_regexp_stack_limit();

-  // Function Debug::Break()
-  static ExternalReference debug_break();
-
    // Static variable Heap::NewSpaceStart()
    static ExternalReference new_space_start();
    static ExternalReference heap_always_allocate_scope_depth();
@@ -399,12 +400,17 @@
    static ExternalReference new_space_allocation_top_address();
    static ExternalReference new_space_allocation_limit_address();

-  // Used to check if single stepping is enabled in generated code.
-  static ExternalReference debug_step_in_fp_address();
-
    static ExternalReference double_fp_operation(Token::Value operation);

    Address address() const {return address_;}
+
+#ifdef ENABLE_DEBUGGER_SUPPORT
+  // Function Debug::Break()
+  static ExternalReference debug_break();
+
+  // Used to check if single stepping is enabled in generated code.
+  static ExternalReference debug_step_in_fp_address();
+#endif

   private:
    explicit ExternalReference(void* address)

Modified: branches/bleeding_edge/src/bootstrapper.cc
==============================================================================
--- branches/bleeding_edge/src/bootstrapper.cc  (original)
+++ branches/bleeding_edge/src/bootstrapper.cc  Mon Apr 20 09:36:13 2009
@@ -832,12 +832,16 @@

  bool Genesis::CompileNative(Vector<const char> name, Handle<String>  
source) {
    HandleScope scope;
+#ifdef ENABLE_DEBUGGER_SUPPORT
    Debugger::set_compiling_natives(true);
+#endif
    bool result =
        CompileScriptCached(name, source, &natives_cache, NULL, true);
    ASSERT(Top::has_pending_exception() != result);
    if (!result) Top::clear_pending_exception();
+#ifdef ENABLE_DEBUGGER_SUPPORT
    Debugger::set_compiling_natives(false);
+#endif
    return result;
  }

@@ -1132,6 +1136,7 @@
                  Handle<JSObject>(js_global->builtins()), DONT_ENUM);
    }

+#ifdef ENABLE_DEBUGGER_SUPPORT
    // Expose the debug global object in global if a name for it is  
specified.
    if (FLAG_expose_debug_as != NULL && strlen(FLAG_expose_debug_as) != 0) {
      // If loading fails we just bail out without installing the
@@ -1149,6 +1154,7 @@
      SetProperty(js_global, debug_string,
          Handle<Object>(Debug::debug_context()->global_proxy()), DONT_ENUM);
    }
+#endif

    return true;
  }

Modified: branches/bleeding_edge/src/builtins-ia32.cc
==============================================================================
--- branches/bleeding_edge/src/builtins-ia32.cc (original)
+++ branches/bleeding_edge/src/builtins-ia32.cc Mon Apr 20 09:36:13 2009
@@ -69,10 +69,12 @@
    Label rt_call, allocated;
    if (FLAG_inline_new) {
      Label undo_allocation;
+#ifdef ENABLE_DEBUGGER_SUPPORT
      ExternalReference debug_step_in_fp =
          ExternalReference::debug_step_in_fp_address();
      __ cmp(Operand::StaticVariable(debug_step_in_fp), Immediate(0));
      __ j(not_equal, &rt_call);
+#endif
      // Check that function is not a Smi.
      __ test(edi, Immediate(kSmiTagMask));
      __ j(zero, &rt_call);

Modified: branches/bleeding_edge/src/builtins.cc
==============================================================================
--- branches/bleeding_edge/src/builtins.cc      (original)
+++ branches/bleeding_edge/src/builtins.cc      Mon Apr 20 09:36:13 2009
@@ -559,6 +559,7 @@
  }


+#ifdef ENABLE_DEBUGGER_SUPPORT
  static void Generate_LoadIC_DebugBreak(MacroAssembler* masm) {
    Debug::GenerateLoadICDebugBreak(masm);
  }
@@ -597,7 +598,7 @@
  static void Generate_StubNoRegisters_DebugBreak(MacroAssembler* masm) {
    Debug::GenerateStubNoRegistersDebugBreak(masm);
  }
-
+#endif

  Object* Builtins::builtins_[builtin_count] = { NULL, };
  const char* Builtins::names_[builtin_count] = { NULL, };

Modified: branches/bleeding_edge/src/builtins.h
==============================================================================
--- branches/bleeding_edge/src/builtins.h       (original)
+++ branches/bleeding_edge/src/builtins.h       Mon Apr 20 09:36:13 2009
@@ -83,6 +83,7 @@
    V(FunctionApply,              BUILTIN, UNINITIALIZED)


+#ifdef ENABLE_DEBUGGER_SUPPORT
  // Define list of builtins used by the debugger implemented in assembly.
  #define BUILTIN_LIST_DEBUG_A(V)                                \
    V(Return_DebugBreak,          BUILTIN, DEBUG_BREAK)          \
@@ -93,7 +94,9 @@
    V(KeyedLoadIC_DebugBreak,     KEYED_LOAD_IC, DEBUG_BREAK)    \
    V(StoreIC_DebugBreak,         STORE_IC, DEBUG_BREAK)         \
    V(KeyedStoreIC_DebugBreak,    KEYED_STORE_IC, DEBUG_BREAK)
-
+#else
+#define BUILTIN_LIST_DEBUG_A(V)
+#endif

  // Define list of builtins implemented in JavaScript.
  #define BUILTINS_LIST_JS(V)    \

Modified: branches/bleeding_edge/src/codegen-arm.cc
==============================================================================
--- branches/bleeding_edge/src/codegen-arm.cc   (original)
+++ branches/bleeding_edge/src/codegen-arm.cc   Mon Apr 20 09:36:13 2009
@@ -2335,7 +2335,9 @@
    VirtualFrame::SpilledScope spilled_scope(this);
    Comment cmnt(masm_, "[ DebuggerStatament");
    CodeForStatementPosition(node);
+#ifdef ENABLE_DEBUGGER_SUPPORT
    frame_->CallRuntime(Runtime::kDebugBreak, 0);
+#endif
    // Ignore the return value.
    ASSERT(frame_->height() == original_height);
  }

Modified: branches/bleeding_edge/src/codegen-ia32.cc
==============================================================================
--- branches/bleeding_edge/src/codegen-ia32.cc  (original)
+++ branches/bleeding_edge/src/codegen-ia32.cc  Mon Apr 20 09:36:13 2009
@@ -3179,10 +3179,12 @@
    ASSERT(!in_spilled_code());
    Comment cmnt(masm_, "[ DebuggerStatement");
    CodeForStatementPosition(node);
+#ifdef ENABLE_DEBUGGER_SUPPORT
    // Spill everything, even constants, to the frame.
    frame_->SpillAll();
    frame_->CallRuntime(Runtime::kDebugBreak, 0);
    // Ignore the return value.
+#endif
  }



Modified: branches/bleeding_edge/src/codegen.cc
==============================================================================
--- branches/bleeding_edge/src/codegen.cc       (original)
+++ branches/bleeding_edge/src/codegen.cc       Mon Apr 20 09:36:13 2009
@@ -304,8 +304,10 @@
                                   node->is_expression(), false, script_,
                                   node->inferred_name());

+#ifdef ENABLE_DEBUGGER_SUPPORT
    // Notify debugger that a new function has been added.
    Debugger::OnNewFunction(function);
+#endif

    // Set the expected number of properties for instances and return
    // the resulting function.

Modified: branches/bleeding_edge/src/compiler.cc
==============================================================================
--- branches/bleeding_edge/src/compiler.cc      (original)
+++ branches/bleeding_edge/src/compiler.cc      Mon Apr 20 09:36:13 2009
@@ -92,8 +92,10 @@
    StackGuard guard;
    PostponeInterruptsScope postpone;

+#ifdef ENABLE_DEBUGGER_SUPPORT
    // Notify debugger
    Debugger::OnBeforeCompile(script);
+#endif

    // Only allow non-global compiles for eval.
    ASSERT(is_eval || is_global);
@@ -160,8 +162,10 @@
    // the instances of the function.
    SetExpectedNofPropertiesFromEstimate(fun,  
lit->expected_property_count());

+#ifdef ENABLE_DEBUGGER_SUPPORT
    // Notify debugger
    Debugger::OnAfterCompile(script, fun);
+#endif

    return fun;
  }

Modified: branches/bleeding_edge/src/d8.cc
==============================================================================
--- branches/bleeding_edge/src/d8.cc    (original)
+++ branches/bleeding_edge/src/d8.cc    Mon Apr 20 09:36:13 2009
@@ -262,6 +262,7 @@
  }


+#ifdef ENABLE_DEBUGGER_SUPPORT
  Handle<Object> Shell::DebugMessageDetails(Handle<String> message) {
    Context::Scope context_scope(utility_context_);
    Handle<Object> global = utility_context_->Global();
@@ -282,6 +283,7 @@
    Handle<Value> val = Handle<Function>::Cast(fun)->Call(global, kArgc,  
argv);
    return val;
  }
+#endif


  int32_t* Counter::Bind(const char* name, bool is_histogram) {
@@ -423,11 +425,13 @@
    global_template->Set(String::New("arguments"),
                         Utils::ToLocal(arguments_jsarray));

+#ifdef ENABLE_DEBUGGER_SUPPORT
    // Install the debugger object in the utility scope
    i::Debug::Load();
    i::JSObject* debug = i::Debug::debug_context()->global();
    utility_context_->Global()->Set(String::New("$debug"),
                                    Utils::ToLocal(&debug));
+#endif

    // Run the d8 shell utility script in the utility context
    int source_index = i::NativesCollection<i::D8>::GetIndex("d8");
@@ -453,8 +457,10 @@
    evaluation_context_ = Context::New(NULL, global_template);
    evaluation_context_->SetSecurityToken(Undefined());

+#ifdef ENABLE_DEBUGGER_SUPPORT
    // Set the security token of the debug context to allow access.
     
i::Debug::debug_context()->set_security_token(i::Heap::undefined_value());
+#endif
  }


@@ -709,6 +715,7 @@
        Locker::StartPreemption(preemption_interval);
      }

+#ifdef ENABLE_DEBUGGER_SUPPORT
      // Run the remote debugger if requested.
      if (i::FLAG_remote_debugger) {
        RunRemoteDebugger(i::FLAG_debugger_port);
@@ -724,6 +731,7 @@
      if (i::FLAG_debugger && !i::FLAG_debugger_agent) {
        v8::Debug::SetDebugEventListener(HandleDebugEvent);
      }
+#endif
    }
    if (run_shell)
      RunShell();

Modified: branches/bleeding_edge/src/d8.h
==============================================================================
--- branches/bleeding_edge/src/d8.h     (original)
+++ branches/bleeding_edge/src/d8.h     Mon Apr 20 09:36:13 2009
@@ -132,8 +132,10 @@
    static int Main(int argc, char* argv[]);
    static Handle<Array> GetCompletions(Handle<String> text,
                                        Handle<String> full);
+#ifdef ENABLE_DEBUGGER_SUPPORT
    static Handle<Object> DebugMessageDetails(Handle<String> message);
    static Handle<Value> DebugCommandToJSONRequest(Handle<String> command);
+#endif

    static Handle<Value> Print(const Arguments& args);
    static Handle<Value> Yield(const Arguments& args);

Modified: branches/bleeding_edge/src/debug-agent.cc
==============================================================================
--- branches/bleeding_edge/src/debug-agent.cc   (original)
+++ branches/bleeding_edge/src/debug-agent.cc   Mon Apr 20 09:36:13 2009
@@ -29,9 +29,9 @@
  #include "v8.h"
  #include "debug-agent.h"

+#ifdef ENABLE_DEBUGGER_SUPPORT
  namespace v8 { namespace internal {

-
  // Public V8 debugger API message handler function. This function just  
delegates
  // to the debugger agent through it's data parameter.
  void DebuggerAgentMessageHandler(const uint16_t* message, int length,
@@ -410,5 +410,6 @@
    return total_received;
  }

-
  } }  // namespace v8::internal
+
+#endif  // ENABLE_DEBUGGER_SUPPORT

Modified: branches/bleeding_edge/src/debug-agent.h
==============================================================================
--- branches/bleeding_edge/src/debug-agent.h    (original)
+++ branches/bleeding_edge/src/debug-agent.h    Mon Apr 20 09:36:13 2009
@@ -28,12 +28,12 @@
  #ifndef V8_V8_DEBUG_AGENT_H_
  #define V8_V8_DEBUG_AGENT_H_

+#ifdef ENABLE_DEBUGGER_SUPPORT
  #include "../include/v8-debug.h"
  #include "platform.h"

  namespace v8 { namespace internal {

-
  // Forward decelrations.
  class DebuggerAgentSession;

@@ -111,7 +111,8 @@
    static int ReceiveAll(const Socket* conn, char* data, int len);
  };

-
  } }  // namespace v8::internal
+
+#endif  // ENABLE_DEBUGGER_SUPPORT

  #endif  // V8_V8_DEBUG_AGENT_H_

Modified: branches/bleeding_edge/src/debug-arm.cc
==============================================================================
--- branches/bleeding_edge/src/debug-arm.cc     (original)
+++ branches/bleeding_edge/src/debug-arm.cc     Mon Apr 20 09:36:13 2009
@@ -32,7 +32,7 @@

  namespace v8 { namespace internal {

-
+#ifdef ENABLE_DEBUGGER_SUPPORT
  // Currently debug break is not supported in frame exit code on ARM.
  bool BreakLocationIterator::IsDebugBreakAtReturn() {
    return false;
@@ -191,5 +191,6 @@

  #undef __

+#endif  // ENABLE_DEBUGGER_SUPPORT

  } }  // namespace v8::internal

Modified: branches/bleeding_edge/src/debug-ia32.cc
==============================================================================
--- branches/bleeding_edge/src/debug-ia32.cc    (original)
+++ branches/bleeding_edge/src/debug-ia32.cc    Mon Apr 20 09:36:13 2009
@@ -33,6 +33,7 @@

  namespace v8 { namespace internal {

+#ifdef ENABLE_DEBUGGER_SUPPORT

  // A debug break in the frame exit code is identified by a call  
instruction.
  bool BreakLocationIterator::IsDebugBreakAtReturn() {
@@ -214,5 +215,6 @@

  #undef __

+#endif  // ENABLE_DEBUGGER_SUPPORT

  } }  // namespace v8::internal

Modified: branches/bleeding_edge/src/debug.cc
==============================================================================
--- branches/bleeding_edge/src/debug.cc (original)
+++ branches/bleeding_edge/src/debug.cc Mon Apr 20 09:36:13 2009
@@ -41,6 +41,7 @@

  namespace v8 { namespace internal {

+#ifdef ENABLE_DEBUGGER_SUPPORT
  static void PrintLn(v8::Local<v8::Value> value) {
    v8::Local<v8::String> s = value->ToString();
    char* data = NewArray<char>(s->Length() + 1);
@@ -2223,5 +2224,6 @@
    queue_.Clear();
  }

+#endif  // ENABLE_DEBUGGER_SUPPORT

  } }  // namespace v8::internal

Modified: branches/bleeding_edge/src/debug.h
==============================================================================
--- branches/bleeding_edge/src/debug.h  (original)
+++ branches/bleeding_edge/src/debug.h  Mon Apr 20 09:36:13 2009
@@ -28,7 +28,6 @@
  #ifndef V8_V8_DEBUG_H_
  #define V8_V8_DEBUG_H_

-#include "../include/v8-debug.h"
  #include "assembler.h"
  #include "code-stubs.h"
  #include "debug-agent.h"
@@ -38,6 +37,8 @@
  #include "string-stream.h"
  #include "v8threads.h"

+#ifdef ENABLE_DEBUGGER_SUPPORT
+#include "../include/v8-debug.h"

  namespace v8 { namespace internal {

@@ -718,5 +719,7 @@


  } }  // namespace v8::internal
+
+#endif // ENABLE_DEBUGGER_SUPPORT

  #endif  // V8_V8_DEBUG_H_

Modified: branches/bleeding_edge/src/execution.cc
==============================================================================
--- branches/bleeding_edge/src/execution.cc     (original)
+++ branches/bleeding_edge/src/execution.cc     Mon Apr 20 09:36:13 2009
@@ -305,6 +305,7 @@
  }


+#ifdef ENABLE_DEBUGGER_SUPPORT
  bool StackGuard::IsDebugBreak() {
    ExecutionAccess access;
    return thread_local_.interrupt_flags_ & DEBUGBREAK;
@@ -331,7 +332,7 @@
      set_limits(kInterruptLimit, access);
    }
  }
-
+#endif

  void StackGuard::Continue(InterruptFlag after_what) {
    ExecutionAccess access;
@@ -539,6 +540,7 @@

    ContextSwitcher::PreemptionReceived();

+#ifdef ENABLE_DEBUGGER_SUPPORT
    if (Debug::InDebugger()) {
      // If currently in the debugger don't do any actual preemption but  
record
      // that preemption occoured while in the debugger.
@@ -548,11 +550,17 @@
      v8::Unlocker unlocker;
      Thread::YieldCPU();
    }
+#else
+  // Perform preemption.
+  v8::Unlocker unlocker;
+  Thread::YieldCPU();
+#endif

    return Heap::undefined_value();
  }


+#ifdef ENABLE_DEBUGGER_SUPPORT
  Object* Execution::DebugBreakHelper() {
    // Just continue if breaks are disabled.
    if (Debug::disable_break()) {
@@ -598,12 +606,14 @@
    // Return to continue execution.
    return Heap::undefined_value();
  }
-
+#endif

  Object* Execution::HandleStackGuardInterrupt() {
+#ifdef ENABLE_DEBUGGER_SUPPORT
    if (StackGuard::IsDebugBreak() || StackGuard::IsDebugCommand()) {
      DebugBreakHelper();
    }
+#endif
    if (StackGuard::IsPreempted()) RuntimePreempt();
    if (StackGuard::IsInterrupted()) {
      // interrupt

Modified: branches/bleeding_edge/src/execution.h
==============================================================================
--- branches/bleeding_edge/src/execution.h      (original)
+++ branches/bleeding_edge/src/execution.h      Mon Apr 20 09:36:13 2009
@@ -118,8 +118,9 @@
                                            Handle<JSFunction> fun,
                                            Handle<Object> pos,
                                            Handle<Object> is_global);
-
+#ifdef ENABLE_DEBUGGER_SUPPORT
    static Object* DebugBreakHelper();
+#endif

    // If the stack guard is triggered, but it is not an actual
    // stack overflow, then handle the interruption accordingly.
@@ -158,11 +159,13 @@
    static void Preempt();
    static bool IsInterrupted();
    static void Interrupt();
-  static bool IsDebugBreak();
+  static void Continue(InterruptFlag after_what);
+#ifdef ENABLE_DEBUGGER_SUPPORT
    static void DebugBreak();
-  static bool IsDebugCommand();
    static void DebugCommand();
-  static void Continue(InterruptFlag after_what);
+  static bool IsDebugBreak();
+  static bool IsDebugCommand();
+#endif

   private:
    // You should hold the ExecutionAccess lock when calling this method.

Modified: branches/bleeding_edge/src/factory.cc
==============================================================================
--- branches/bleeding_edge/src/factory.cc       (original)
+++ branches/bleeding_edge/src/factory.cc       Mon Apr 20 09:36:13 2009
@@ -671,6 +671,7 @@
  }


+#ifdef ENABLE_DEBUGGER_SUPPORT
  Handle<DebugInfo> Factory::NewDebugInfo(Handle<SharedFunctionInfo> shared)  
{
    // Get the original code of the function.
    Handle<Code> code(shared->code());
@@ -700,6 +701,7 @@

    return debug_info;
  }
+#endif


  Handle<JSObject> Factory::NewArgumentsObject(Handle<Object> callee,

Modified: branches/bleeding_edge/src/factory.h
==============================================================================
--- branches/bleeding_edge/src/factory.h        (original)
+++ branches/bleeding_edge/src/factory.h        Mon Apr 20 09:36:13 2009
@@ -310,8 +310,9 @@
                                                    uint32_t key,
                                                    Handle<Object> value);

+#ifdef ENABLE_DEBUGGER_SUPPORT
    static Handle<DebugInfo> NewDebugInfo(Handle<SharedFunctionInfo> shared);
-
+#endif

    // Return a map using the map cache in the global context.
    // The key the an ordered set of property names.

Modified: branches/bleeding_edge/src/handles.cc
==============================================================================
--- branches/bleeding_edge/src/handles.cc       (original)
+++ branches/bleeding_edge/src/handles.cc       Mon Apr 20 09:36:13 2009
@@ -652,6 +652,7 @@
    // We shouldn't get here if compiling the script failed.
    ASSERT(!boilerplate.is_null());

+#ifdef ENABLE_DEBUGGER_SUPPORT
    // When the debugger running in its own context touches lazy loaded
    // functions loading can be triggered. In that case ensure that the
    // execution of the boilerplate is in the correct context.
@@ -660,6 +661,7 @@
        Top::context() == *Debug::debug_context()) {
      Top::set_context(*compile_context);
    }
+#endif

    // Reset the lazy load data before running the script to make sure
    // not to get recursive lazy loading.

Modified: branches/bleeding_edge/src/heap.cc
==============================================================================
--- branches/bleeding_edge/src/heap.cc  (original)
+++ branches/bleeding_edge/src/heap.cc  Mon Apr 20 09:36:13 2009
@@ -2679,7 +2679,10 @@
    SYNCHRONIZE_TAG("bootstrapper");
    Top::Iterate(v);
    SYNCHRONIZE_TAG("top");
+
+#ifdef ENABLE_DEBUGGER_SUPPORT
    Debug::Iterate(v);
+#endif
    SYNCHRONIZE_TAG("debug");
    CompilationCache::Iterate(v);
    SYNCHRONIZE_TAG("compilationcache");

Modified: branches/bleeding_edge/src/ic-inl.h
==============================================================================
--- branches/bleeding_edge/src/ic-inl.h (original)
+++ branches/bleeding_edge/src/ic-inl.h Mon Apr 20 09:36:13 2009
@@ -39,6 +39,7 @@
    // Get the address of the call.
    Address result = pc() - Assembler::kTargetAddrToReturnAddrDist;

+#ifdef ENABLE_DEBUGGER_SUPPORT
    // First check if any break points are active if not just return the  
address
    // of the call.
    if (!Debug::has_break_points()) return result;
@@ -55,6 +56,9 @@
      // No break point here just return the address of the call.
      return result;
    }
+#else
+  return result;
+#endif
  }



Modified: branches/bleeding_edge/src/ic.cc
==============================================================================
--- branches/bleeding_edge/src/ic.cc    (original)
+++ branches/bleeding_edge/src/ic.cc    Mon Apr 20 09:36:13 2009
@@ -100,6 +100,7 @@
  }


+#ifdef ENABLE_DEBUGGER_SUPPORT
  Address IC::OriginalCodeAddress() {
    HandleScope scope;
    // Compute the JavaScript frame for the frame pointer of this IC
@@ -126,7 +127,7 @@
    int delta = original_code->instruction_start() -  
code->instruction_start();
    return addr + delta;
  }
-
+#endif

  IC::State IC::StateFrom(Code* target, Object* receiver) {
    IC::State state = target->ic_state();
@@ -356,6 +357,7 @@
        if (opt->IsJSFunction()) return opt;
      }

+#ifdef ENABLE_DEBUGGER_SUPPORT
      // Handle stepping into a function if step into is active.
      if (Debug::StepInActive()) {
        // Protect the result in a handle as the debugger can allocate and  
might
@@ -365,6 +367,7 @@
        Debug::HandleStepIn(function, fp(), false);
        return *function;
      }
+#endif

      return result;
    }

Modified: branches/bleeding_edge/src/ic.h
==============================================================================
--- branches/bleeding_edge/src/ic.h     (original)
+++ branches/bleeding_edge/src/ic.h     Mon Apr 20 09:36:13 2009
@@ -107,9 +107,11 @@
    Address fp() const { return fp_; }
    Address pc() const { return *pc_address_; }

+#ifdef ENABLE_DEBUGGER_SUPPORT
    // Computes the address in the original code when the code running is
    // containing break points (calls to DebugBreakXXX builtins).
    Address OriginalCodeAddress();
+#endif

    // Set the call-site target.
    void set_target(Code* code) { SetTargetAtAddress(address(), code); }

Modified: branches/bleeding_edge/src/macro-assembler-arm.cc
==============================================================================
--- branches/bleeding_edge/src/macro-assembler-arm.cc   (original)
+++ branches/bleeding_edge/src/macro-assembler-arm.cc   Mon Apr 20 09:36:13  
2009
@@ -320,16 +320,19 @@
    add(r6, fp, Operand(r4, LSL, kPointerSizeLog2));
    add(r6, r6, Operand(ExitFrameConstants::kPPDisplacement - kPointerSize));

+#ifdef ENABLE_DEBUGGER_SUPPORT
    // Save the state of all registers to the stack from the memory
    // location. This is needed to allow nested break points.
    if (type == StackFrame::EXIT_DEBUG) {
      // Use sp as base to push.
      CopyRegistersFromMemoryToStack(sp, kJSCallerSaved);
    }
+#endif
  }


  void MacroAssembler::LeaveExitFrame(StackFrame::Type type) {
+#ifdef ENABLE_DEBUGGER_SUPPORT
    // Restore the memory copy of the registers by digging them out from
    // the stack. This is needed to allow nested break points.
    if (type == StackFrame::EXIT_DEBUG) {
@@ -339,6 +342,7 @@
      add(r3, fp, Operand(kOffset));
      CopyRegistersFromStackToMemory(r3, r2, kJSCallerSaved);
    }
+#endif

    // Clear top frame.
    mov(r3, Operand(0));
@@ -491,6 +495,7 @@
  }


+#ifdef ENABLE_DEBUGGER_SUPPORT
  void MacroAssembler::SaveRegistersToMemory(RegList regs) {
    ASSERT((regs & ~kJSCallerSaved) == 0);
    // Copy the content of registers to memory location.
@@ -548,7 +553,7 @@
      }
    }
  }
-
+#endif

  void MacroAssembler::PushTryHandler(CodeLocation try_location,
                                      HandlerType type) {

Modified: branches/bleeding_edge/src/macro-assembler-arm.h
==============================================================================
--- branches/bleeding_edge/src/macro-assembler-arm.h    (original)
+++ branches/bleeding_edge/src/macro-assembler-arm.h    Mon Apr 20 09:36:13  
2009
@@ -138,6 +138,7 @@
                        InvokeFlag flag);


+#ifdef ENABLE_DEBUGGER_SUPPORT
    //  
---------------------------------------------------------------------------
    // Debugger Support

@@ -147,7 +148,7 @@
    void CopyRegistersFromStackToMemory(Register base,
                                        Register scratch,
                                        RegList regs);
-
+#endif

    //  
---------------------------------------------------------------------------
    // Exception handling

Modified: branches/bleeding_edge/src/macro-assembler-ia32.cc
==============================================================================
--- branches/bleeding_edge/src/macro-assembler-ia32.cc  (original)
+++ branches/bleeding_edge/src/macro-assembler-ia32.cc  Mon Apr 20 09:36:13  
2009
@@ -216,6 +216,7 @@
  }


+#ifdef ENABLE_DEBUGGER_SUPPORT
  void MacroAssembler::SaveRegistersToMemory(RegList regs) {
    ASSERT((regs & ~kJSCallerSaved) == 0);
    // Copy the content of registers to memory location.
@@ -290,7 +291,7 @@
      }
    }
  }
-
+#endif

  void MacroAssembler::Set(Register dst, const Immediate& x) {
    if (x.is_zero()) {
@@ -378,6 +379,7 @@
    mov(edi, Operand(eax));
    lea(esi, Operand(ebp, eax, times_4, offset));

+#ifdef ENABLE_DEBUGGER_SUPPORT
    // Save the state of all registers to the stack from the memory
    // location. This is needed to allow nested break points.
    if (type == StackFrame::EXIT_DEBUG) {
@@ -389,6 +391,7 @@
      // associated with this issue).
      PushRegistersFromMemory(kJSCallerSaved);
    }
+#endif

    // Reserve space for two arguments: argc and argv.
    sub(Operand(esp), Immediate(2 * kPointerSize));
@@ -406,6 +409,7 @@


  void MacroAssembler::LeaveExitFrame(StackFrame::Type type) {
+#ifdef ENABLE_DEBUGGER_SUPPORT
    // Restore the memory copy of the registers by digging them out from
    // the stack. This is needed to allow nested break points.
    if (type == StackFrame::EXIT_DEBUG) {
@@ -416,6 +420,7 @@
      lea(ebx, Operand(ebp, kOffset));
      CopyRegistersFromStackToMemory(ebx, ecx, kJSCallerSaved);
    }
+#endif

    // Get the return address from the stack and restore the frame pointer.
    mov(ecx, Operand(ebp, 1 * kPointerSize));

Modified: branches/bleeding_edge/src/macro-assembler-ia32.h
==============================================================================
--- branches/bleeding_edge/src/macro-assembler-ia32.h   (original)
+++ branches/bleeding_edge/src/macro-assembler-ia32.h   Mon Apr 20 09:36:13  
2009
@@ -73,7 +73,7 @@
                     Register value,
                     Register scratch);

-
+#ifdef ENABLE_DEBUGGER_SUPPORT
    //  
---------------------------------------------------------------------------
    // Debugger Support

@@ -84,7 +84,7 @@
    void CopyRegistersFromStackToMemory(Register base,
                                        Register scratch,
                                        RegList regs);
-
+#endif

    //  
---------------------------------------------------------------------------
    // Activation frames

Modified: branches/bleeding_edge/src/objects-inl.h
==============================================================================
--- branches/bleeding_edge/src/objects-inl.h    (original)
+++ branches/bleeding_edge/src/objects-inl.h    Mon Apr 20 09:36:13 2009
@@ -2057,6 +2057,7 @@
  ACCESSORS(Script, type, Smi, kTypeOffset)
  ACCESSORS(Script, line_ends, Object, kLineEndsOffset)

+#ifdef ENABLE_DEBUGGER_SUPPORT
  ACCESSORS(DebugInfo, shared, SharedFunctionInfo, kSharedFunctionInfoIndex)
  ACCESSORS(DebugInfo, original_code, Code, kOriginalCodeIndex)
  ACCESSORS(DebugInfo, code, Code, kPatchedCodeIndex)
@@ -2066,6 +2067,7 @@
  ACCESSORS(BreakPointInfo, source_position, Smi, kSourcePositionIndex)
  ACCESSORS(BreakPointInfo, statement_position, Smi, kStatementPositionIndex)
  ACCESSORS(BreakPointInfo, break_point_objects, Object,  
kBreakPointObjectsIndex)
+#endif

  ACCESSORS(SharedFunctionInfo, name, Object, kNameOffset)
  ACCESSORS(SharedFunctionInfo, instance_class_name, Object,

Modified: branches/bleeding_edge/src/objects.cc
==============================================================================
--- branches/bleeding_edge/src/objects.cc       (original)
+++ branches/bleeding_edge/src/objects.cc       Mon Apr 20 09:36:13 2009
@@ -4661,6 +4661,7 @@
      it.rinfo()->set_target_object(code);
    }

+#ifdef ENABLE_DEBUGGER_SUPPORT
    if (Debug::has_break_points()) {
      for (RelocIterator it(this, RelocInfo::ModeMask(RelocInfo::JS_RETURN));
           !it.done();
@@ -4674,6 +4675,7 @@
        }
      }
    }
+#endif
    set_ic_flag(IC_TARGET_IS_OBJECT);
  }

@@ -4695,10 +4697,12 @@
        v->VisitCodeTarget(it.rinfo());
      } else if (rmode == RelocInfo::EXTERNAL_REFERENCE) {
        v->VisitExternalReference(it.rinfo()->target_reference_address());
+#ifdef ENABLE_DEBUGGER_SUPPORT
      } else if (Debug::has_break_points() &&
                 RelocInfo::IsJSReturn(rmode) &&
                 it.rinfo()->IsCallInstruction()) {
        v->VisitDebugTarget(it.rinfo());
+#endif
      } else if (rmode == RelocInfo::RUNTIME_ENTRY) {
        v->VisitRuntimeEntry(it.rinfo());
      }
@@ -4723,6 +4727,7 @@
      it.rinfo()->set_target_address(code->instruction_start());
    }

+#ifdef ENABLE_DEBUGGER_SUPPORT
    if (Debug::has_break_points()) {
      for (RelocIterator it(this, RelocInfo::ModeMask(RelocInfo::JS_RETURN));
           !it.done();
@@ -4734,6 +4739,7 @@
        }
      }
    }
+#endif
    set_ic_flag(IC_TARGET_IS_ADDRESS);
  }

@@ -7162,6 +7168,7 @@
  }


+#ifdef ENABLE_DEBUGGER_SUPPORT
  // Check if there is a break point at this code position.
  bool DebugInfo::HasBreakPoint(int code_position) {
    // Get the break point info object for this code position.
@@ -7405,6 +7412,6 @@
    // Multiple break points.
    return FixedArray::cast(break_point_objects())->length();
  }
-
+#endif

  } }  // namespace v8::internal

Modified: branches/bleeding_edge/src/objects.h
==============================================================================
--- branches/bleeding_edge/src/objects.h        (original)
+++ branches/bleeding_edge/src/objects.h        Mon Apr 20 09:36:13 2009
@@ -389,7 +389,7 @@
  // Note that for subtle reasons related to the ordering or numerical  
values of
  // type tags, elements in this list have to be added to the  
INSTANCE_TYPE_LIST
  // manually.
-#define STRUCT_LIST(V)                                                    \
+#define STRUCT_LIST_ALL(V)                                                \
    V(ACCESSOR_INFO, AccessorInfo, accessor_info)                           \
    V(ACCESS_CHECK_INFO, AccessCheckInfo, access_check_info)                \
    V(INTERCEPTOR_INFO, InterceptorInfo, interceptor_info)                  \
@@ -398,10 +398,19 @@
    V(OBJECT_TEMPLATE_INFO, ObjectTemplateInfo, object_template_info)       \
    V(SIGNATURE_INFO, SignatureInfo, signature_info)                        \
    V(TYPE_SWITCH_INFO, TypeSwitchInfo, type_switch_info)                   \
-  V(DEBUG_INFO, DebugInfo, debug_info)                                    \
-  V(BREAK_POINT_INFO, BreakPointInfo, break_point_info)                   \
    V(SCRIPT, Script, script)

+#ifdef ENABLE_DEBUGGER_SUPPORT
+#define STRUCT_LIST_DEBUGGER(V)                                           \
+  V(DEBUG_INFO, DebugInfo, debug_info)                                    \
+  V(BREAK_POINT_INFO, BreakPointInfo, break_point_info)
+#else
+#define STRUCT_LIST_DEBUGGER(V)
+#endif
+
+#define STRUCT_LIST(V)                                                    \
+  STRUCT_LIST_ALL(V)                                                      \
+  STRUCT_LIST_DEBUGGER(V)

  // We use the full 8 bits of the instance_type field to encode heap object
  // instance types.  The high-order bit (bit 7) is set if the object is not  
a
@@ -4151,6 +4160,7 @@
  };


+#ifdef ENABLE_DEBUGGER_SUPPORT
  // The DebugInfo class holds additional information for a function being
  // debugged.
  class DebugInfo: public Struct {
@@ -4256,6 +4266,7 @@
   private:
    DISALLOW_IMPLICIT_CONSTRUCTORS(BreakPointInfo);
  };
+#endif  // ENABLE_DEBUGGER_SUPPORT


  #undef DECL_BOOLEAN_ACCESSORS

Modified: branches/bleeding_edge/src/runtime.cc
==============================================================================
--- branches/bleeding_edge/src/runtime.cc       (original)
+++ branches/bleeding_edge/src/runtime.cc       Mon Apr 20 09:36:13 2009
@@ -4159,10 +4159,12 @@
      JSFunction* function = JSFunction::cast(constructor);

      // Handle stepping into constructors if step into is active.
+#ifdef ENABLE_DEBUGGER_SUPPORT
      if (Debug::StepInActive()) {
        HandleScope scope;
        Debug::HandleStepIn(Handle<JSFunction>(function), 0, true);
      }
+#endif

      if (function->has_initial_map() &&
          function->initial_map()->instance_type() == JS_FUNCTION_TYPE) {
@@ -4526,12 +4528,6 @@
  }


-static Object* Runtime_DebugBreak(Arguments args) {
-  ASSERT(args.length() == 0);
-  return Execution::DebugBreakHelper();
-}
-
-
  static Object* Runtime_StackGuard(Arguments args) {
    ASSERT(args.length() == 1);

@@ -5297,6 +5293,13 @@
  }


+#ifdef ENABLE_DEBUGGER_SUPPORT
+static Object* Runtime_DebugBreak(Arguments args) {
+  ASSERT(args.length() == 0);
+  return Execution::DebugBreakHelper();
+}
+
+
  // Helper functions for wrapping and unwrapping stack frame ids.
  static Smi* WrapFrameId(StackFrame::Id id) {
    ASSERT(IsAligned(OffsetFrom(id), 4));
@@ -6777,6 +6780,21 @@
  }


+static Object* Runtime_FunctionGetAssemblerCode(Arguments args) {
+#ifdef DEBUG
+  HandleScope scope;
+  ASSERT(args.length() == 1);
+  // Get the function and make sure it is compiled.
+  CONVERT_ARG_CHECKED(JSFunction, func, 0);
+  if (!func->is_compiled() && !CompileLazy(func, KEEP_EXCEPTION)) {
+    return Failure::Exception();
+  }
+  func->code()->PrintLn();
+#endif  // DEBUG
+  return Heap::undefined_value();
+}
+#endif // ENABLE_DEBUGGER_SUPPORT
+
  // Finds the script object from the script data. NOTE: This operation uses
  // heap traversal to find the function generated for the source position
  // for the requested break point. For lazily compiled functions several  
heap
@@ -6823,21 +6841,6 @@
    Handle<Object> result =
        Runtime_GetScriptFromScriptName(Handle<String>(script_name));
    return *result;
-}
-
-
-static Object* Runtime_FunctionGetAssemblerCode(Arguments args) {
-#ifdef DEBUG
-  HandleScope scope;
-  ASSERT(args.length() == 1);
-  // Get the function and make sure it is compiled.
-  CONVERT_ARG_CHECKED(JSFunction, func, 0);
-  if (!func->is_compiled() && !CompileLazy(func, KEEP_EXCEPTION)) {
-    return Failure::Exception();
-  }
-  func->code()->PrintLn();
-#endif  // DEBUG
-  return Heap::undefined_value();
  }



Modified: branches/bleeding_edge/src/runtime.h
==============================================================================
--- branches/bleeding_edge/src/runtime.h        (original)
+++ branches/bleeding_edge/src/runtime.h        Mon Apr 20 09:36:13 2009
@@ -214,42 +214,6 @@
    F(DefineAccessor, -1 /* 4 or 5 */) \
    F(LookupAccessor, 3) \
    \
-  /* Debugging */ \
-  F(SetDebugEventListener, 2) \
-  F(Break, 0) \
-  F(DebugGetPropertyDetails, 2) \
-  F(DebugGetProperty, 2) \
-  F(DebugLocalPropertyNames, 1) \
-  F(DebugLocalElementNames, 1) \
-  F(DebugPropertyTypeFromDetails, 1) \
-  F(DebugPropertyAttributesFromDetails, 1) \
-  F(DebugPropertyIndexFromDetails, 1) \
-  F(DebugInterceptorInfo, 1) \
-  F(DebugNamedInterceptorPropertyNames, 1) \
-  F(DebugIndexedInterceptorElementNames, 1) \
-  F(DebugNamedInterceptorPropertyValue, 2) \
-  F(DebugIndexedInterceptorElementValue, 2) \
-  F(CheckExecutionState, 1) \
-  F(GetFrameCount, 1) \
-  F(GetFrameDetails, 2) \
-  F(GetCFrames, 1) \
-  F(GetThreadCount, 1) \
-  F(GetThreadDetails, 2) \
-  F(GetBreakLocations, 1) \
-  F(SetFunctionBreakPoint, 3) \
-  F(SetScriptBreakPoint, 3) \
-  F(ClearBreakPoint, 1) \
-  F(ChangeBreakOnException, 2) \
-  F(PrepareStep, 3) \
-  F(ClearStepping, 0) \
-  F(DebugEvaluate, 4) \
-  F(DebugEvaluateGlobal, 3) \
-  F(DebugGetLoadedScripts, 0) \
-  F(DebugReferencedBy, 3) \
-  F(DebugConstructedBy, 2) \
-  F(DebugGetPrototype, 1) \
-  F(SystemBreak, 0) \
-  \
    /* Literals */ \
    F(MaterializeRegExpLiteral, 4)\
    F(CreateArrayLiteralBoilerplate, 3) \
@@ -289,8 +253,6 @@
    F(DebugTrace, 0) \
    F(TraceEnter, 0) \
    F(TraceExit, 1) \
-  F(DebugBreak, 0) \
-  F(FunctionGetAssemblerCode, 1) \
    F(Abort, 2) \
    /* Logging */ \
    F(Log, 2) \
@@ -298,6 +260,48 @@
    /* Pseudo functions - handled as macros by parser */ \
    F(IS_VAR, 1)

+#ifdef ENABLE_DEBUGGER_SUPPORT
+#define RUNTIME_FUNCTION_LIST_DEBUGGER_SUPPORT(F) \
+  /* Debugger support*/ \
+  F(DebugBreak, 0) \
+  F(SetDebugEventListener, 2) \
+  F(Break, 0) \
+  F(DebugGetPropertyDetails, 2) \
+  F(DebugGetProperty, 2) \
+  F(DebugLocalPropertyNames, 1) \
+  F(DebugLocalElementNames, 1) \
+  F(DebugPropertyTypeFromDetails, 1) \
+  F(DebugPropertyAttributesFromDetails, 1) \
+  F(DebugPropertyIndexFromDetails, 1) \
+  F(DebugInterceptorInfo, 1) \
+  F(DebugNamedInterceptorPropertyNames, 1) \
+  F(DebugIndexedInterceptorElementNames, 1) \
+  F(DebugNamedInterceptorPropertyValue, 2) \
+  F(DebugIndexedInterceptorElementValue, 2) \
+  F(CheckExecutionState, 1) \
+  F(GetFrameCount, 1) \
+  F(GetFrameDetails, 2) \
+  F(GetCFrames, 1) \
+  F(GetThreadCount, 1) \
+  F(GetThreadDetails, 2) \
+  F(GetBreakLocations, 1) \
+  F(SetFunctionBreakPoint, 3) \
+  F(SetScriptBreakPoint, 3) \
+  F(ClearBreakPoint, 1) \
+  F(ChangeBreakOnException, 2) \
+  F(PrepareStep, 3) \
+  F(ClearStepping, 0) \
+  F(DebugEvaluate, 4) \
+  F(DebugEvaluateGlobal, 3) \
+  F(DebugGetLoadedScripts, 0) \
+  F(DebugReferencedBy, 3) \
+  F(DebugConstructedBy, 2) \
+  F(DebugGetPrototype, 1) \
+  F(SystemBreak, 0) \
+  F(FunctionGetAssemblerCode, 1)
+#else
+#define RUNTIME_FUNCTION_LIST_DEBUGGER_SUPPORT(F)
+#endif

  #ifdef DEBUG
  #define RUNTIME_FUNCTION_LIST_DEBUG(F) \
@@ -315,7 +319,8 @@

  #define RUNTIME_FUNCTION_LIST(F) \
    RUNTIME_FUNCTION_LIST_ALWAYS(F) \
-  RUNTIME_FUNCTION_LIST_DEBUG(F)
+  RUNTIME_FUNCTION_LIST_DEBUG(F) \
+  RUNTIME_FUNCTION_LIST_DEBUGGER_SUPPORT(F)

  //  
----------------------------------------------------------------------------
  // Runtime provides access to all C++ runtime functions.

Modified: branches/bleeding_edge/src/serialize.cc
==============================================================================
--- branches/bleeding_edge/src/serialize.cc     (original)
+++ branches/bleeding_edge/src/serialize.cc     Mon Apr 20 09:36:13 2009
@@ -548,6 +548,7 @@
      AddFromId(ref_table[i].type, ref_table[i].id, ref_table[i].name);
    }

+#ifdef ENABLE_DEBUGGER_SUPPORT
    // Debug addresses
    Add(Debug_Address(Debug::k_after_break_target_address).address(),
        DEBUG_ADDRESS,
@@ -567,6 +568,7 @@
          Debug::k_register_address << kDebugIdShift | i,
          name.start());
    }
+#endif

    // Stat counters
    struct StatsRefTableEntry {
@@ -659,10 +661,6 @@
        UNCLASSIFIED,
        4,
        "RegExpStack::limit_address()");
-  Add(ExternalReference::debug_break().address(),
-      UNCLASSIFIED,
-      5,
-      "Debug::Break()");
    Add(ExternalReference::new_space_start().address(),
        UNCLASSIFIED,
        6,
@@ -679,6 +677,11 @@
        UNCLASSIFIED,
        9,
        "Heap::NewSpaceAllocationTopAddress()");
+#ifdef ENABLE_DEBUGGER_SUPPORT
+  Add(ExternalReference::debug_break().address(),
+      UNCLASSIFIED,
+      5,
+      "Debug::Break()");
    Add(ExternalReference::debug_step_in_fp_address().address(),
        UNCLASSIFIED,
        10,
@@ -695,6 +698,7 @@
        UNCLASSIFIED,
        13,
        "mul_two_doubles");
+#endif
  }



Modified: branches/bleeding_edge/src/stub-cache.cc
==============================================================================
--- branches/bleeding_edge/src/stub-cache.cc    (original)
+++ branches/bleeding_edge/src/stub-cache.cc    Mon Apr 20 09:36:13 2009
@@ -594,6 +594,7 @@
  }


+#ifdef ENABLE_DEBUGGER_SUPPORT
  Object* StubCache::ComputeCallDebugBreak(int argc) {
    Code::Flags flags =
        Code::ComputeFlags(Code::CALL_IC, DEBUG_BREAK, NORMAL, argc);
@@ -612,6 +613,7 @@
    StubCompiler compiler;
    return FillCache(compiler.CompileCallDebugPrepareStepIn(flags));
  }
+#endif


  Object* StubCache::ComputeLazyCompile(int argc) {
@@ -836,6 +838,7 @@
  }


+#ifdef ENABLE_DEBUGGER_SUPPORT
  Object* StubCompiler::CompileCallDebugBreak(Code::Flags flags) {
    HandleScope scope;
    Debug::GenerateCallICDebugBreak(masm());
@@ -864,6 +867,7 @@
    }
    return result;
  }
+#endif


  Object* StubCompiler::GetCodeWithFlags(Code::Flags flags, const char*  
name) {

Modified: branches/bleeding_edge/src/stub-cache.h
==============================================================================
--- branches/bleeding_edge/src/stub-cache.h     (original)
+++ branches/bleeding_edge/src/stub-cache.h     Mon Apr 20 09:36:13 2009
@@ -157,8 +157,10 @@
    // Finds the Code object stored in the Heap::non_monomorphic_cache().
    static Code* FindCallInitialize(int argc);

+#ifdef ENABLE_DEBUGGER_SUPPORT
    static Object* ComputeCallDebugBreak(int argc);
    static Object* ComputeCallDebugPrepareStepIn(int argc);
+#endif

    static Object* ComputeLazyCompile(int argc);

@@ -288,8 +290,10 @@
    Object* CompileCallNormal(Code::Flags flags);
    Object* CompileCallMegamorphic(Code::Flags flags);
    Object* CompileCallMiss(Code::Flags flags);
+#ifdef ENABLE_DEBUGGER_SUPPORT
    Object* CompileCallDebugBreak(Code::Flags flags);
    Object* CompileCallDebugPrepareStepIn(Code::Flags flags);
+#endif
    Object* CompileLazyCompile(Code::Flags flags);

    // Static functions for generating parts of stubs.

Modified: branches/bleeding_edge/src/top.cc
==============================================================================
--- branches/bleeding_edge/src/top.cc   (original)
+++ branches/bleeding_edge/src/top.cc   Mon Apr 20 09:36:13 2009
@@ -728,8 +728,10 @@
    bool should_return_exception =  
ShouldReportException(&is_caught_externally);
    bool report_exception = !is_out_of_memory && should_return_exception;

+#ifdef ENABLE_DEBUGGER_SUPPORT
    // Notify debugger of exception.
    Debugger::OnException(exception_handle, report_exception);
+#endif

    // Generate the message.
    Handle<Object> message_obj;

Modified: branches/bleeding_edge/src/v8.cc
==============================================================================
--- branches/bleeding_edge/src/v8.cc    (original)
+++ branches/bleeding_edge/src/v8.cc    Mon Apr 20 09:36:13 2009
@@ -72,7 +72,9 @@
      v8::Locker::StartPreemption(100);
    }

+#ifdef ENABLE_DEBUGGER_SUPPORT
    Debug::Setup(create_heap_objects);
+#endif
    StubCache::Initialize(create_heap_objects);

    // If we are deserializing, read the state into the now-empty heap.
@@ -111,7 +113,9 @@
    Heap::TearDown();
    Logger::TearDown();

+#ifdef ENABLE_DEBUGGER_SUPPORT
    Debugger::TearDown();
+#endif

    has_been_setup_ = false;
    has_been_disposed_ = true;

Modified: branches/bleeding_edge/src/v8.h
==============================================================================
--- branches/bleeding_edge/src/v8.h     (original)
+++ branches/bleeding_edge/src/v8.h     Mon Apr 20 09:36:13 2009
@@ -51,6 +51,11 @@
  #error both DEBUG and NDEBUG are set
  #endif

+// Enable debugger support by default, unless it is in ANDROID
+#if !defined(ENABLE_DEBUGGER_SUPPORT) && !defined(ANDROID)
+#define ENABLE_DEBUGGER_SUPPORT
+#endif
+
  // Basic includes
  #include "../include/v8.h"
  #include "globals.h"

Modified: branches/bleeding_edge/src/v8threads.cc
==============================================================================
--- branches/bleeding_edge/src/v8threads.cc     (original)
+++ branches/bleeding_edge/src/v8threads.cc     Mon Apr 20 09:36:13 2009
@@ -144,7 +144,9 @@
    char* from = state->data();
    from = HandleScopeImplementer::RestoreThread(from);
    from = Top::RestoreThread(from);
+#ifdef ENABLE_DEBUGGER_SUPPORT
    from = Debug::RestoreDebug(from);
+#endif
    from = StackGuard::RestoreStackGuard(from);
    from = RegExpStack::RestoreStack(from);
    from = Bootstrapper::RestoreState(from);
@@ -172,7 +174,9 @@
  static int ArchiveSpacePerThread() {
    return HandleScopeImplementer::ArchiveSpacePerThread() +
                              Top::ArchiveSpacePerThread() +
+#ifdef ENABLE_DEBUGGER_SUPPORT
                            Debug::ArchiveSpacePerThread() +
+#endif
                       StackGuard::ArchiveSpacePerThread() +
                      RegExpStack::ArchiveSpacePerThread() +
                     Bootstrapper::ArchiveSpacePerThread();
@@ -259,7 +263,9 @@
    char* to = state->data();
    to = HandleScopeImplementer::ArchiveThread(to);
    to = Top::ArchiveThread(to);
+#ifdef ENABLE_DEBUGGER_SUPPORT
    to = Debug::ArchiveDebug(to);
+#endif
    to = StackGuard::ArchiveStackGuard(to);
    to = RegExpStack::ArchiveStack(to);
    to = Bootstrapper::ArchiveState(to);

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

Reply via email to