Fixed bug in stack overflow check code for IA-32 targets where a
non-tagged value in register eax was pushed to the stack.

Fixed potential quadratic behavior when converting strings to numbers.

Fixed bug where the return value from Object::SetProperty could end up
being the property holder instead of the written value.

Improved debugger support by allowing nested break points and by
dealing with stack-overflows when compiling functions before setting
break points in them.


git-svn-id: http://v8.googlecode.com/svn/trunk@4 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
diff --git a/src/debug.h b/src/debug.h
index 069e49b..423bbc0 100644
--- a/src/debug.h
+++ b/src/debug.h
@@ -175,6 +175,10 @@
                                JavaScriptFrame* frame);
   static Handle<DebugInfo> GetDebugInfo(Handle<SharedFunctionInfo> shared);
   static bool HasDebugInfo(Handle<SharedFunctionInfo> shared);
+
+  // Returns whether the operation succedded.
+  static bool EnsureDebugInfo(Handle<SharedFunctionInfo> shared);
+
   static bool IsDebugBreak(Address addr);
 
   // Check whether a code stub with the specified major key is a possible break
@@ -202,6 +206,12 @@
   static Address step_in_fp() { return thread_local_.step_into_fp_; }
   static Address* step_in_fp_addr() { return &thread_local_.step_into_fp_; }
 
+  // Getter and setter for the disable break state.
+  static bool disable_break() { return disable_break_; }
+  static void set_disable_break(bool disable_break) {
+    disable_break_ = disable_break;
+  }
+
   // Getters for the current exception break state.
   static bool break_on_exception() { return break_on_exception_; }
   static bool break_on_uncaught_exception() {
@@ -255,8 +265,8 @@
   static void ActivateStepIn(StackFrame* frame);
   static void ClearStepIn();
   static void ClearStepNext();
-  static void EnsureCompiled(Handle<SharedFunctionInfo> shared);
-  static Handle<DebugInfo> AddDebugInfo(Handle<SharedFunctionInfo> shared);
+  // Returns whether the compile succedded.
+  static bool EnsureCompiled(Handle<SharedFunctionInfo> shared);
   static void RemoveDebugInfo(Handle<DebugInfo> debug_info);
   static void SetAfterBreakTarget(JavaScriptFrame* frame);
   static Handle<Object> CheckBreakPoints(Handle<Object> break_point);
@@ -270,6 +280,7 @@
   static bool has_break_points_;
   static DebugInfoListNode* debug_info_list_;
 
+  static bool disable_break_;
   static bool break_on_exception_;
   static bool break_on_uncaught_exception_;
 
@@ -484,6 +495,26 @@
 };
 
 
+// Stack allocated class for disabling break.
+class DisableBreak BASE_EMBEDDED {
+ public:
+  // Enter the debugger by storing the previous top context and setting the
+  // current top context to the debugger context.
+  explicit DisableBreak(bool disable_break)  {
+    prev_disable_break_ = Debug::disable_break();
+    Debug::set_disable_break(disable_break);
+  }
+  ~DisableBreak() {
+    Debug::set_disable_break(prev_disable_break_);
+  }
+
+ private:
+  // The previous state of the disable break used to restore the value when this
+  // object is destructed.
+  bool prev_disable_break_;
+};
+
+
 // Debug_Address encapsulates the Address pointers used in generating debug
 // code.
 class Debug_Address {