Author: [email protected]
Date: Thu Jul  2 08:30:03 2009
New Revision: 2340

Modified:
    branches/bleeding_edge/src/messages.js
    branches/bleeding_edge/test/mjsunit/fuzz-natives.js
    branches/bleeding_edge/test/mjsunit/stack-traces.js
    branches/bleeding_edge/test/mozilla/mozilla.status

Log:
Fixed test failures caused by enabling stack traces by default

Modified: branches/bleeding_edge/src/messages.js
==============================================================================
--- branches/bleeding_edge/src/messages.js      (original)
+++ branches/bleeding_edge/src/messages.js      Thu Jul  2 08:30:03 2009
@@ -609,7 +609,6 @@
  CallSite.prototype.isToplevel = function () {
    if (this.receiver == null)
      return true;
-  var className = $Object.prototype.toString.call(this.receiver);
    return IS_GLOBAL(this.receiver);
  };

@@ -626,6 +625,10 @@
        script.eval_from_position);
  };

+CallSite.prototype.getFunction = function () {
+  return this.fun;
+};
+
  CallSite.prototype.getFunctionName = function () {
    // See if the function knows its own name
    var name = this.fun.name;
@@ -644,6 +647,11 @@
  CallSite.prototype.getMethodName = function () {
    // See if we can find a unique property on the receiver that holds
    // this function.
+  var ownName = this.fun.name;
+  if (ownName && this.receiver && this.receiver[ownName] === this.fun)
+    // To handle DontEnum properties we guess that the method has
+    // the same name as the function.
+    return ownName;
    var name = null;
    for (var prop in this.receiver) {
      if (this.receiver[prop] === this.fun) {
@@ -725,15 +733,23 @@
      fileLocation = "unknown source";
    }
    var line = "";
+  var functionName = frame.getFunction().name;
    var methodName = frame.getMethodName();
-  var functionName = frame.getFunctionName();
    var addPrefix = true;
-  if (frame.isToplevel()) {
-    line += functionName;
-  } else if (frame.isConstructor()) {
-    line += "new " + functionName;
-  } else if (methodName) {
-    line += frame.getTypeName() + "." + methodName;
+  var isConstructor = frame.isConstructor();
+  var isMethodCall = !(frame.isToplevel() || isConstructor);
+  if (isMethodCall) {
+    line += frame.getTypeName() + ".";
+    if (functionName) {
+      line += functionName;
+      if (methodName && (methodName != functionName)) {
+        line += " [as " + methodName + "]";
+      }
+    } else {
+      line += methodName || "<anonymous>";
+    }
+  } else if (isConstructor) {
+    line += "new " + (functionName || "<anonymous>");
    } else if (functionName) {
      line += functionName;
    } else {
@@ -741,11 +757,7 @@
      addPrefix = false;
    }
    if (addPrefix) {
-    line += " (";
-    if (functionName) {
-      line += functionName + " @ ";
-    }
-    line += fileLocation + ")";
+    line += " (" + fileLocation + ")";
    }
    return line;
  }

Modified: branches/bleeding_edge/test/mjsunit/fuzz-natives.js
==============================================================================
--- branches/bleeding_edge/test/mjsunit/fuzz-natives.js (original)
+++ branches/bleeding_edge/test/mjsunit/fuzz-natives.js Thu Jul  2 08:30:03  
2009
@@ -126,7 +126,9 @@
    "CreateArrayLiteralBoilerplate": true,
    "IS_VAR": true,
    "ResolvePossiblyDirectEval": true,
-  "Log": true
+  "Log": true,
+
+  "CollectStackTrace": true
  };

  var currentlyUncallable = {

Modified: branches/bleeding_edge/test/mjsunit/stack-traces.js
==============================================================================
--- branches/bleeding_edge/test/mjsunit/stack-traces.js (original)
+++ branches/bleeding_edge/test/mjsunit/stack-traces.js Thu Jul  2 08:30:03  
2009
@@ -73,6 +73,17 @@
    new Plonk();
  }

+function testRenamedMethod() {
+  function a$b$c$d() { return FAIL; }
+  function Wookie() { }
+  Wookie.prototype.d = a$b$c$d;
+  (new Wookie).d();
+}
+
+function testAnonymousMethod() {
+  (function () { FAIL }).call([1, 2, 3]);
+}
+
  // Utility function for testing that the expected strings occur
  // in the stack trace produced when running the given function.
  function testTrace(fun, expected) {
@@ -149,9 +160,11 @@
  testTrace(testMethodNameInference, ["at Foo.bar"]);
  testTrace(testImplicitConversion, ["at Nirk.valueOf"]);
  testTrace(testEval, ["at Doo (eval at testEval"]);
-testTrace(testNestedEval, ["at eval (eval at Inner (eval at Outer"]);
+testTrace(testNestedEval, ["eval at Inner (eval at Outer"]);
  testTrace(testValue, ["at Number.causeError"]);
  testTrace(testConstructor, ["new Plonk"]);
+testTrace(testRenamedMethod, ["Wookie.a$b$c$d [as d]"]);
+testTrace(testAnonymousMethod, ["Array.<anonymous>"]);

  testCallerCensorship();
  testUnintendedCallerCensorship();

Modified: branches/bleeding_edge/test/mozilla/mozilla.status
==============================================================================
--- branches/bleeding_edge/test/mozilla/mozilla.status  (original)
+++ branches/bleeding_edge/test/mozilla/mozilla.status  Thu Jul  2 08:30:03  
2009
@@ -476,12 +476,11 @@
  js1_5/Array/regress-313153: FAIL_OK


-# Properties stack, fileName, and lineNumber of Error instances are
+# Properties fileName, and lineNumber of Error instances are
  # not supported. Mozilla specific extension.
  js1_5/Exceptions/errstack-001: FAIL_OK
  js1_5/Exceptions/regress-257751: FAIL_OK
  js1_5/Regress/regress-119719: FAIL_OK
-js1_5/Regress/regress-139316: FAIL_OK
  js1_5/Regress/regress-167328: FAIL_OK
  js1_5/Regress/regress-243869: FAIL_OK


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

Reply via email to