Minor patch to debugger support.


git-svn-id: http://v8.googlecode.com/svn/trunk@1103 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
diff --git a/ChangeLog b/ChangeLog
index 25ace2e..943ef34 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2009-01-19: Version 0.4.8.1
+
+        Minor patch to debugger support.
+
+
 2009-01-16: Version 0.4.8
 
         Fixed string length bug on ARM (issue 171).
@@ -7,11 +12,11 @@
         Optimized object literals by improving data locality.
 
         Fixed bug that caused incomplete functions to be cached in case of
-	stack overflow exceptions.
+        stack overflow exceptions.
 
         Fixed bugs that caused catch variables and variables introduced by
-	eval to behave incorrectly when using accessors (issues 186, 190
-	and 191).
+        eval to behave incorrectly when using accessors (issues 186, 190
+        and 191).
 
 
 2009-01-06: Version 0.4.7
diff --git a/src/api.cc b/src/api.cc
index c7e8409..4069740 100644
--- a/src/api.cc
+++ b/src/api.cc
@@ -2204,7 +2204,7 @@
 
 
 const char* v8::V8::GetVersion() {
-  return "0.4.8";
+  return "0.4.8.1";
 }
 
 
diff --git a/src/mirror-delay.js b/src/mirror-delay.js
index f087f68..fe6fb9c 100644
--- a/src/mirror-delay.js
+++ b/src/mirror-delay.js
@@ -1660,7 +1660,7 @@
   // mirror to the referenced mirrors.
   if (reference && mirror.isValue()) {
     this.add_(mirror);
-    return '{ref:' + mirror.handle() + '}';
+    return '{"ref":' + mirror.handle() + '}';
   }
   
   // Collect the JSON property/value pairs in an array.
@@ -1922,7 +1922,26 @@
 }
 
 
+/**
+ * Convert a number to a JSON string value. For all finite numbers the number
+ * literal representation is used. For non finite numbers NaN, Infinite and
+ * -Infinite the string representation "NaN", "Infinite" or "-Infinite"
+ * (including the quotes) is returned.
+ *
+ * @param {number} value The number value to convert to a JSON value
+ * @returns {String} JSON value
+ */
 function NumberToJSON_(value) {
+  if (isNaN(value)) {
+    return '"NaN"';
+  }
+  if (!isFinite(value)) {
+    if (value > 0) {
+      return '"Infinity"';
+    } else {
+      return '"-Infinity"';
+    }
+  }
   return String(value); 
 }
 
diff --git a/src/runtime.cc b/src/runtime.cc
index 36fae9d..fd36724 100644
--- a/src/runtime.cc
+++ b/src/runtime.cc
@@ -4536,32 +4536,49 @@
 }
 
 
-static Object* DebugLookupResultValue(Object* obj, String* name,
-                                      LookupResult* result,
+static Object* DebugLookupResultValue(Object* receiver, LookupResult* result,
                                       bool* caught_exception) {
+  Object* value;
   switch (result->type()) {
-    case NORMAL:
-    case FIELD:
-    case CONSTANT_FUNCTION:
-      return obj->GetProperty(name);
-    case CALLBACKS: {
-      // Get the property value. If there is an exception it must be thrown from
-      // a JavaScript getter.
-      Object* value;
-      value = obj->GetProperty(name);
-      if (value->IsException()) {
-        if (caught_exception != NULL) {
-          *caught_exception = true;
-        }
-        value = Top::pending_exception();
-        Top::optional_reschedule_exception(true);
+    case NORMAL: {
+      Dictionary* dict =
+          JSObject::cast(result->holder())->property_dictionary();
+      value = dict->ValueAt(result->GetDictionaryEntry());
+      if (value->IsTheHole()) {
+        return Heap::undefined_value();
       }
-      ASSERT(!Top::has_pending_exception());
-      ASSERT(!Top::external_caught_exception());
       return value;
     }
+    case FIELD:
+      value =
+          JSObject::cast(
+              result->holder())->FastPropertyAt(result->GetFieldIndex());
+      if (value->IsTheHole()) {
+        return Heap::undefined_value();
+      }
+      return value;
+    case CONSTANT_FUNCTION:
+      return result->GetConstantFunction();
+    case CALLBACKS: {
+      Object* structure = result->GetCallbackObject();
+      if (structure->IsProxy()) {
+        AccessorDescriptor* callback =
+            reinterpret_cast<AccessorDescriptor*>(
+                Proxy::cast(structure)->proxy());
+        value = (callback->getter)(receiver, callback->data);
+        if (value->IsFailure()) {
+          value = Top::pending_exception();
+          Top::clear_pending_exception();
+          if (caught_exception != NULL) {
+            *caught_exception = true;
+          }
+        }
+        return value;
+      } else {
+        return Heap::undefined_value();
+      }
+    }
     case INTERCEPTOR:
-      return obj->GetProperty(name);
     case MAP_TRANSITION:
     case CONSTANT_TRANSITION:
     case NULL_DESCRIPTOR:
@@ -4609,7 +4626,7 @@
   obj->LocalLookup(*name, &result);
   if (result.IsProperty()) {
     bool caught_exception = false;
-    Handle<Object> value(DebugLookupResultValue(*obj, *name, &result,
+    Handle<Object> value(DebugLookupResultValue(*obj, &result,
                                                 &caught_exception));
     // If the callback object is a fixed array then it contains JavaScript
     // getter and/or setter.
@@ -4643,7 +4660,7 @@
   LookupResult result;
   obj->Lookup(*name, &result);
   if (result.IsProperty()) {
-    return DebugLookupResultValue(*obj, *name, &result, NULL);
+    return DebugLookupResultValue(*obj, &result, NULL);
   }
   return Heap::undefined_value();
 }
diff --git a/test/cctest/test-debug.cc b/test/cctest/test-debug.cc
index 816972b..cd85b8f 100644
--- a/test/cctest/test-debug.cc
+++ b/test/cctest/test-debug.cc
@@ -2746,22 +2746,6 @@
 
   source = "both_values[4].name() == 10";
   CHECK(CompileRun(source)->BooleanValue());
-
-  // Check the property values.
-  source = "both_values[0].value().value() == 'AA'";
-  CHECK(CompileRun(source)->BooleanValue());
-
-  source = "both_values[1].value().value() == 'BB'";
-  CHECK(CompileRun(source)->BooleanValue());
-
-  source = "both_values[2].value().value() == 'CC'";
-  CHECK(CompileRun(source)->BooleanValue());
-
-  source = "both_values[3].value().value() == 2";
-  CHECK(CompileRun(source)->BooleanValue());
-
-  source = "both_values[4].value().value() == 11";
-  CHECK(CompileRun(source)->BooleanValue());
 }
 
 
diff --git a/test/mjsunit/mirror-object.js b/test/mjsunit/mirror-object.js
index b9b0e1a..ec5afa3 100644
--- a/test/mjsunit/mirror-object.js
+++ b/test/mjsunit/mirror-object.js
@@ -193,8 +193,6 @@
 assertEquals('function', mirror.property('a').getter().type());
 assertEquals('undefined', mirror.property('a').setter().type());
 assertEquals('function (){return \'a\';}', mirror.property('a').getter().source());
-assertEquals('a', mirror.property('a').value().value());
-assertFalse(mirror.property('a').isException());
 // b has setter but no getter.
 assertFalse(mirror.property('b').hasGetter());
 assertTrue(mirror.property('b').hasSetter());
@@ -211,8 +209,6 @@
 assertEquals('function', mirror.property('c').setter().type());
 assertEquals('function (){throw \'c\';}', mirror.property('c').getter().source());
 assertEquals('function (){throw \'c\';}', mirror.property('c').setter().source());
-assertEquals('c', mirror.property('c').value().value());
-assertTrue(mirror.property('c').isException());
 
 // Test objects with native accessors.
 mirror = debug.MakeMirror(new String('abc'));
diff --git a/tools/v8.xcodeproj/project.pbxproj b/tools/v8.xcodeproj/project.pbxproj
index d65d342..8adfd0e 100644
--- a/tools/v8.xcodeproj/project.pbxproj
+++ b/tools/v8.xcodeproj/project.pbxproj
@@ -32,6 +32,8 @@
 		890A14030EE9C4B500E49346 /* regexp-macro-assembler-tracer.cc in Sources */ = {isa = PBXBuildFile; fileRef = 89A15C770EE466D000B48DEB /* regexp-macro-assembler-tracer.cc */; };
 		890A14040EE9C4B700E49346 /* regexp-macro-assembler.cc in Sources */ = {isa = PBXBuildFile; fileRef = 89A15C790EE466D000B48DEB /* regexp-macro-assembler.cc */; };
 		893CCE640E71D83700357A03 /* code-stubs.cc in Sources */ = {isa = PBXBuildFile; fileRef = 897FF1110E719B8F00D62E90 /* code-stubs.cc */; };
+		8944AD100F1D4D500028D560 /* regexp-stack.cc in Sources */ = {isa = PBXBuildFile; fileRef = 8944AD0E0F1D4D3A0028D560 /* regexp-stack.cc */; };
+		8944AD110F1D4D570028D560 /* regexp-stack.cc in Sources */ = {isa = PBXBuildFile; fileRef = 8944AD0E0F1D4D3A0028D560 /* regexp-stack.cc */; };
 		89495E480E79FC23001F68C3 /* compilation-cache.cc in Sources */ = {isa = PBXBuildFile; fileRef = 89495E460E79FC23001F68C3 /* compilation-cache.cc */; };
 		89495E490E79FC23001F68C3 /* compilation-cache.cc in Sources */ = {isa = PBXBuildFile; fileRef = 89495E460E79FC23001F68C3 /* compilation-cache.cc */; };
 		896FD03A0E78D717003DFB6A /* libv8-arm.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 89F23C870E78D5B2006B2466 /* libv8-arm.a */; };
@@ -257,6 +259,8 @@
 
 /* Begin PBXFileReference section */
 		8900116B0E71CA2300F91F35 /* libraries.cc */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = libraries.cc; sourceTree = "<group>"; };
+		8944AD0E0F1D4D3A0028D560 /* regexp-stack.cc */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = "regexp-stack.cc"; sourceTree = "<group>"; };
+		8944AD0F0F1D4D3A0028D560 /* regexp-stack.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "regexp-stack.h"; sourceTree = "<group>"; };
 		89471C7F0EB23EE400B6874B /* flag-definitions.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "flag-definitions.h"; sourceTree = "<group>"; };
 		89495E460E79FC23001F68C3 /* compilation-cache.cc */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = "compilation-cache.cc"; sourceTree = "<group>"; };
 		89495E470E79FC23001F68C3 /* compilation-cache.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "compilation-cache.h"; sourceTree = "<group>"; };
@@ -728,6 +732,8 @@
 				89A15C780EE466D000B48DEB /* regexp-macro-assembler-tracer.h */,
 				89A15C790EE466D000B48DEB /* regexp-macro-assembler.cc */,
 				89A15C7A0EE466D000B48DEB /* regexp-macro-assembler.h */,
+				8944AD0E0F1D4D3A0028D560 /* regexp-stack.cc */,
+				8944AD0F0F1D4D3A0028D560 /* regexp-stack.h */,
 				897FF16F0E719B8F00D62E90 /* rewriter.cc */,
 				897FF1700E719B8F00D62E90 /* rewriter.h */,
 				897FF1710E719B8F00D62E90 /* runtime.cc */,
@@ -1085,6 +1091,7 @@
 				89A15C830EE4675E00B48DEB /* regexp-macro-assembler-irregexp.cc in Sources */,
 				89A15C8A0EE467D100B48DEB /* regexp-macro-assembler-tracer.cc in Sources */,
 				89A15C810EE4674900B48DEB /* regexp-macro-assembler.cc in Sources */,
+				8944AD100F1D4D500028D560 /* regexp-stack.cc in Sources */,
 				89A88E190E71A6970043BA31 /* rewriter.cc in Sources */,
 				89A88E1A0E71A69B0043BA31 /* runtime.cc in Sources */,
 				89A88E1B0E71A69D0043BA31 /* scanner.cc in Sources */,
@@ -1187,6 +1194,7 @@
 				890A14020EE9C4B400E49346 /* regexp-macro-assembler-irregexp.cc in Sources */,
 				890A14030EE9C4B500E49346 /* regexp-macro-assembler-tracer.cc in Sources */,
 				890A14040EE9C4B700E49346 /* regexp-macro-assembler.cc in Sources */,
+				8944AD110F1D4D570028D560 /* regexp-stack.cc in Sources */,
 				89F23C6D0E78D5B2006B2466 /* rewriter.cc in Sources */,
 				89F23C6E0E78D5B2006B2466 /* runtime.cc in Sources */,
 				89F23C6F0E78D5B2006B2466 /* scanner.cc in Sources */,