Reviewers: Benedikt Meurer,

Message:
Please take a look.

Description:
Fix error message wording when instanceof throws.

[email protected]
BUG=82797, v8:1593

Please review this at https://codereview.chromium.org/66463002/

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

Affected files (+12, -8 lines):
  M src/runtime.js
  A + test/message/instanceof.js
  A test/message/instanceof.out
  M test/webkit/exception-for-nonobject-expected.txt
  M test/webkit/instance-of-immediates-expected.txt


Index: src/runtime.js
diff --git a/src/runtime.js b/src/runtime.js
index ce11c37079e6a24b10b4a0fb5d44e76a8dd9ce08..875b6b0405d64c51e4d009839b3b023b29278ca1 100644
--- a/src/runtime.js
+++ b/src/runtime.js
@@ -361,7 +361,7 @@ function IN(x) {
 function INSTANCE_OF(F) {
   var V = this;
   if (!IS_SPEC_FUNCTION(F)) {
-    throw %MakeTypeError('instanceof_function_expected', [V]);
+    throw %MakeTypeError('instanceof_function_expected', [F]);
   }

   // If V is not an object, return false.
Index: test/message/instanceof.js
diff --git a/test/mjsunit/regress/regress-2690.js b/test/message/instanceof.js
similarity index 97%
copy from test/mjsunit/regress/regress-2690.js
copy to test/message/instanceof.js
index 5fe7dc42dc693cf7f0a3e9a2b13c0f7b306189e2..1d55e0f94ebf1ff421ee80b7c7818fb4df7a18f2 100644
--- a/test/mjsunit/regress/regress-2690.js
+++ b/test/message/instanceof.js
@@ -25,5 +25,4 @@
 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

-assertTrue(/\1[a]/.test("\1a"));
-
+1 instanceof 2;
Index: test/message/instanceof.out
diff --git a/test/message/instanceof.out b/test/message/instanceof.out
new file mode 100644
index 0000000000000000000000000000000000000000..d279bc44e78769ffdc79c94918bfc7a5f9072201
--- /dev/null
+++ b/test/message/instanceof.out
@@ -0,0 +1,5 @@
+*%(basename)s:28: TypeError: Expecting a function in instanceof check, but got 2
+1 instanceof 2;
+  ^
+TypeError: Expecting a function in instanceof check, but got 2
+    at *%(basename)s:28:3
Index: test/webkit/exception-for-nonobject-expected.txt
diff --git a/test/webkit/exception-for-nonobject-expected.txt b/test/webkit/exception-for-nonobject-expected.txt index 86068b102c80268f6e502261e69726eaab43fee1..e6003986b99789ceca37629d8d04008a01f7f3cc 100644
--- a/test/webkit/exception-for-nonobject-expected.txt
+++ b/test/webkit/exception-for-nonobject-expected.txt
@@ -27,7 +27,7 @@ On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE


PASS new {}.undefined threw exception TypeError: undefined is not a function. -PASS 1 instanceof {}.undefined threw exception TypeError: Expecting a function in instanceof check, but got 1. +PASS 1 instanceof {}.undefined threw exception TypeError: Expecting a function in instanceof check, but got undefined.
 PASS successfullyParsed is true

 TEST COMPLETE
Index: test/webkit/instance-of-immediates-expected.txt
diff --git a/test/webkit/instance-of-immediates-expected.txt b/test/webkit/instance-of-immediates-expected.txt index a6f6cc50729aed25b29f9a3053acb31c4c1e4683..db58f00d304bece80b1691aaee65db77b744b89e 100644
--- a/test/webkit/instance-of-immediates-expected.txt
+++ b/test/webkit/instance-of-immediates-expected.txt
@@ -27,11 +27,11 @@ On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE


PASS (1 instanceof 1) threw exception TypeError: Expecting a function in instanceof check, but got 1. -PASS ({} instanceof 1) threw exception TypeError: Expecting a function in instanceof check, but got #<Object>. -PASS (obj instanceof 1) threw exception TypeError: Expecting a function in instanceof check, but got #<Constructor>. -PASS (1 instanceof {}) threw exception TypeError: Expecting a function in instanceof check, but got 1. +PASS ({} instanceof 1) threw exception TypeError: Expecting a function in instanceof check, but got 1. +PASS (obj instanceof 1) threw exception TypeError: Expecting a function in instanceof check, but got 1. +PASS (1 instanceof {}) threw exception TypeError: Expecting a function in instanceof check, but got #<Object>. PASS ({} instanceof {}) threw exception TypeError: Expecting a function in instanceof check, but got #<Object>. -PASS (obj instanceof {}) threw exception TypeError: Expecting a function in instanceof check, but got #<Constructor>. +PASS (obj instanceof {}) threw exception TypeError: Expecting a function in instanceof check, but got #<Object>.
 PASS (1 instanceof Constructor) is false
 PASS ({} instanceof Constructor) is false
 PASS (obj instanceof Constructor) is true


--
--
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev
--- You received this message because you are subscribed to the Google Groups "v8-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to