Ubuntu Pastebin

Paste from odroid at Wed, 1 Mar 2017 00:54:51 +0000

Download as text
  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
From cd514b09f1b8a384e5a4994ada9b97334c29c5a1 Mon Sep 17 00:00:00 2001
From: memeka <mihailescu2m@gmail.com>
Date: Wed, 1 Mar 2017 11:10:31 +1030
Subject: [PATCH 1/2] Bug 1334314 - Fix debug mode OSR exception handling for
 IteratorClose trynotes.

---
 js/src/jit-test/tests/ion/bug1334314.js | 16 +++++++++++++
 js/src/jit/BaselineBailouts.cpp         | 40 ++++++++++++++++++++++++---------
 2 files changed, 46 insertions(+), 10 deletions(-)
 create mode 100644 js/src/jit-test/tests/ion/bug1334314.js

diff --git a/js/src/jit-test/tests/ion/bug1334314.js b/js/src/jit-test/tests/ion/bug1334314.js
new file mode 100644
index 0000000..98a8db6
--- /dev/null
+++ b/js/src/jit-test/tests/ion/bug1334314.js
@@ -0,0 +1,16 @@
+// |jit-test| error: TypeError
+	
+	var g = newGlobal();
+g.parent = this;
+g.eval("new Debugger(parent).onExceptionUnwind = function () { };");
+
+	function f() {
+		    [[]] = [];
+		}
+try {
+	    f();
+	} catch (e) {};
+try {
+	    f();
+	} catch (e) {};
+f();
diff --git a/js/src/jit/BaselineBailouts.cpp b/js/src/jit/BaselineBailouts.cpp
index b14d5c6..5d42b2c 100644
--- a/js/src/jit/BaselineBailouts.cpp
+++ b/js/src/jit/BaselineBailouts.cpp
@@ -467,7 +467,7 @@ GetNextNonLoopEntryPc(jsbytecode* pc)
 }
 
 static bool
-HasLiveIteratorAtStackDepth(JSScript* script, jsbytecode* pc, uint32_t stackDepth)
+HasLiveStackValueAtDepth(JSScript* script, jsbytecode* pc, uint32_t stackDepth)
 {
     if (!script->hasTrynotes())
         return false;
@@ -481,15 +481,35 @@ HasLiveIteratorAtStackDepth(JSScript* script, jsbytecode* pc, uint32_t stackDept
         if (pcOffset >= tn->start + tn->length)
             continue;
 
-        // For-in loops have only the iterator on stack.
-        if (tn->kind == JSTRY_FOR_IN && stackDepth == tn->stackDepth)
-            return true;
+        switch (tn->kind) {
+            case JSTRY_FOR_IN:
+                // For-in loops have only the iterator on stack.
+                if (stackDepth == tn->stackDepth)
+                    return true;
+                break;
 
-        // For-of loops have both the iterator and the result on stack.
-        if (tn->kind == JSTRY_FOR_OF &&
-            (stackDepth == tn->stackDepth || stackDepth == tn->stackDepth - 1))
-        {
-            return true;
+            case JSTRY_FOR_OF:
+                // For-of loops have both the iterator and the result on stack.
+                if (stackDepth == tn->stackDepth - 1)
+                    return true;
+                break;
+
+            case JSTRY_ITERCLOSE:
+                // Code that need to call IteratorClose have the iterator on the
+                // stack.
+                if (stackDepth == tn->stackDepth)
+                    return true;
+                break;
+
+            case JSTRY_DESTRUCTURING_ITERCLOSE:
+                // Destructuring code that need to call IteratorClose have both
+                // the iterator and the "done" value on the stack.
+                if (stackDepth == tn->stackDepth || stackDepth == tn->stackDepth - 1)
+                    return true;
+                break;
+
+            default:
+                break;
         }
     }
 
@@ -900,7 +920,7 @@ InitFromBailout(JSContext* cx, HandleScript caller, jsbytecode* callerPC,
             // iterators, however, so read them out. They will be closed by
             // HandleExceptionBaseline.
             MOZ_ASSERT(cx->compartment()->isDebuggee());
-            if (iter.moreFrames() || HasLiveIteratorAtStackDepth(script, pc, i + 1)) {
+            if (iter.moreFrames() || HasLiveStackValueAtDepth(script, pc, i + 1)) {
                 v = iter.read();
             } else {
                 iter.skip();
-- 
2.10.2


From 1a5518b2baca95c7fee87aab7417cb57c49e5145 Mon Sep 17 00:00:00 2001
From: memeka <mihailescu2m@gmail.com>
Date: Wed, 1 Mar 2017 11:23:18 +1030
Subject: [PATCH 2/2] ITERCLOSE is not yet implemented, comment out reference
 to it

---
 js/src/jit/BaselineBailouts.cpp | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/js/src/jit/BaselineBailouts.cpp b/js/src/jit/BaselineBailouts.cpp
index 5d42b2c..2152453 100644
--- a/js/src/jit/BaselineBailouts.cpp
+++ b/js/src/jit/BaselineBailouts.cpp
@@ -490,10 +490,10 @@ HasLiveStackValueAtDepth(JSScript* script, jsbytecode* pc, uint32_t stackDepth)
 
             case JSTRY_FOR_OF:
                 // For-of loops have both the iterator and the result on stack.
-                if (stackDepth == tn->stackDepth - 1)
+                if (stackDepth == tn->stackDepth || stackDepth == tn->stackDepth - 1)
                     return true;
                 break;
-
+/* // Iterator close has not been implemented yet
             case JSTRY_ITERCLOSE:
                 // Code that need to call IteratorClose have the iterator on the
                 // stack.
@@ -507,7 +507,7 @@ HasLiveStackValueAtDepth(JSScript* script, jsbytecode* pc, uint32_t stackDepth)
                 if (stackDepth == tn->stackDepth || stackDepth == tn->stackDepth - 1)
                     return true;
                 break;
-
+*/
             default:
                 break;
         }
-- 
2.10.2
Download as text