Reviewers: Sven Panne,

Message:
PTAL.

Description:
Do not use user-defined __lookupGetter__ when generating stack trace.


BUG=v8:1591
TEST=regress-1591.js


Please review this at http://codereview.chromium.org/10736030/

SVN Base: https://v8.googlecode.com/svn/branches/bleeding_edge

Affected files:
  M src/messages.js
  A + test/mjsunit/regress/regress-1591.js


Index: src/messages.js
diff --git a/src/messages.js b/src/messages.js
index 0701c70eb6a129be041edcf59809b87c6ae54eb7..4da38051f9200746250867e23f9cc4228c524178 100644
--- a/src/messages.js
+++ b/src/messages.js
@@ -859,9 +859,9 @@ function CallSiteGetMethodName() {
   }
   var name = null;
   for (var prop in this.receiver) {
-    if (this.receiver.__lookupGetter__(prop) === this.fun ||
-        this.receiver.__lookupSetter__(prop) === this.fun ||
-        (!this.receiver.__lookupGetter__(prop) &&
+ if (%_CallFunction(this.receiver, prop, ObjectLookupGetter) === this.fun || + %_CallFunction(this.receiver, prop, ObjectLookupSetter) === this.fun ||
+        (!%_CallFunction(this.receiver, prop, ObjectLookupGetter) &&
          this.receiver[prop] === this.fun)) {
       // If we find more than one match bail out to avoid confusion.
       if (name) {
Index: test/mjsunit/regress/regress-1591.js
diff --git a/test/mjsunit/regress/regress-inlining-function-literal-context.js b/test/mjsunit/regress/regress-1591.js
similarity index 81%
copy from test/mjsunit/regress/regress-inlining-function-literal-context.js
copy to test/mjsunit/regress/regress-1591.js
index 9b7f7ac76882f09e1cc837373c1bee547c645de3..69efd0bd87f2d49b185c264f3979d7c6bcad9225 100644
--- a/test/mjsunit/regress/regress-inlining-function-literal-context.js
+++ b/test/mjsunit/regress/regress-1591.js
@@ -25,29 +25,24 @@
 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

-// Flags: --allow-natives-syntax --expose-gc
+var stack;
+var used_custom_lookup = false;

-function mkbaz(x) {
-  function baz() {
-    return function () {
-      return [x];
+({
+  __lookupGetter__ : function() {
+    used_custom_lookup = true;
+  },
+
+  test : function() {
+    try {
+      f();
+    } catch (err) {
+      stack = err.stack;
     }
   }
-  return baz;
-}
-
-var baz = mkbaz(1);
-
-function foo() {
-  var f = baz();
-  return f();
-}
+}).test();

-// Tenure.
-gc();
-gc();
+var expected_message = "ReferenceError: f is not defined";
+assertTrue(stack.indexOf(expected_message) >= 0);
+assertFalse(used_custom_lookup);

-assertArrayEquals([1], foo());
-assertArrayEquals([1], foo());
-%OptimizeFunctionOnNextCall(foo);
-assertArrayEquals([1], foo());


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

Reply via email to