Improved frame merge code generated by the code generator.

Optimized String.prototype.replace.

Implemented __defineGetter__ and __defineSetter__ for properties with integer keys on non-array objects.

Improved debugger and profiler support.

Fixed a number of portability issues to allow compilation for smaller ARM devices.

Exposed object cloning through the API.

Implemented hidden properties.  This is used to expose an identity hash for objects through the API.

Implemented restarting of regular expressions if their input string changes representation during preemption.

Fixed a code generator bug that could cause assignments in loops to be ignored if using continue to break out of the loop (issue 284).


git-svn-id: http://v8.googlecode.com/svn/trunk@1598 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
diff --git a/src/debug.h b/src/debug.h
index 9f4e047..c29b49b 100644
--- a/src/debug.h
+++ b/src/debug.h
@@ -418,20 +418,22 @@
   static Handle<Object> MakeCompileEvent(Handle<Script> script,
                                          bool before,
                                          bool* caught_exception);
-  static void OnDebugBreak(Handle<Object> break_points_hit);
+  static void OnDebugBreak(Handle<Object> break_points_hit, bool auto_continue);
   static void OnException(Handle<Object> exception, bool uncaught);
   static void OnBeforeCompile(Handle<Script> script);
   static void OnAfterCompile(Handle<Script> script,
                            Handle<JSFunction> fun);
   static void OnNewFunction(Handle<JSFunction> fun);
   static void ProcessDebugEvent(v8::DebugEvent event,
-                                Handle<Object> event_data);
+                                Handle<Object> event_data,
+                                bool auto_continue);
   static void SetEventListener(Handle<Object> callback, Handle<Object> data);
   static void SetMessageHandler(v8::DebugMessageHandler handler, void* data);
   static void SetHostDispatchHandler(v8::DebugHostDispatchHandler handler,
                                      void* data);
   static void SendMessage(Vector<uint16_t> message);
   static void ProcessCommand(Vector<const uint16_t> command);
+  static bool HasCommands();
   static void ProcessHostDispatch(void* dispatch);
   static void UpdateActiveDebugger();
   static Handle<Object> Call(Handle<JSFunction> fun,
@@ -439,7 +441,10 @@
                              bool* pending_exception);
 
   // Start the debugger agent listening on the provided port.
-  static bool StartAgent(int port);
+  static bool StartAgent(const char* name, int port);
+
+  // Stop the debugger agent.
+  static void StopAgent();
 
   inline static bool EventActive(v8::DebugEvent event) {
     // Currently argument event is not used.
@@ -528,7 +533,8 @@
   // when host_running_ is false.
   void DebugEvent(v8::DebugEvent,
                   Handle<Object> exec_state,
-                  Handle<Object> event_data);
+                  Handle<Object> event_data,
+                  bool auto_continue);
   // Puts event on the output queue.  Called by V8.
   // This is where V8 hands off
   // processing of the event to the DebugMessageThread thread,
@@ -546,6 +552,9 @@
   // Main function of DebugMessageThread thread.
   void Run();
 
+  // Check whether there are commands in the queue.
+  bool HasCommands() { return !command_queue_.IsEmpty(); }
+
   bool host_running_;  // Is the debugging host running or stopped?
   Semaphore* command_received_;  // Non-zero when command queue is non-empty.
   Semaphore* message_received_;  // Exactly equal to message queue length.
@@ -568,21 +577,11 @@
   EnterDebugger()
       : prev_(Debug::debugger_entry()),
         has_js_frames_(!it_.done()) {
-    ASSERT(!Debug::preemption_pending());
+    ASSERT(prev_ == NULL ? !Debug::preemption_pending() : true);
 
     // Link recursive debugger entry.
     Debug::set_debugger_entry(this);
 
-    // If a preemption is pending when first entering the debugger clear it as
-    // we don't want preemption happening while executing JavaScript in the
-    // debugger. When recursively entering the debugger the preemption flag
-    // cannot be set as this is disabled while in the debugger (see
-    // RuntimePreempt).
-    if (prev_ == NULL && StackGuard::IsPreempted()) {
-      StackGuard::Continue(PREEMPT);
-    }
-    ASSERT(!StackGuard::IsPreempted());
-
     // Store the previous break id and frame id.
     break_id_ = Debug::break_id();
     break_frame_id_ = Debug::break_frame_id();
@@ -616,6 +615,12 @@
       Debug::set_preemption_pending(false);
     }
 
+    // If there are commands in the queue when leaving the debugger request that
+    // these commands are processed.
+    if (prev_ == NULL && Debugger::HasCommands()) {
+      StackGuard::DebugCommand();
+    }
+
     // Leaving this debugger entry.
     Debug::set_debugger_entry(prev_);
   }