summaryrefslogtreecommitdiffstats
path: root/js/src/tests/test262/language/expressions/instanceof
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-28 14:29:10 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-28 14:29:10 +0000
commit2aa4a82499d4becd2284cdb482213d541b8804dd (patch)
treeb80bf8bf13c3766139fbacc530efd0dd9d54394c /js/src/tests/test262/language/expressions/instanceof
parentInitial commit. (diff)
downloadfirefox-2aa4a82499d4becd2284cdb482213d541b8804dd.tar.xz
firefox-2aa4a82499d4becd2284cdb482213d541b8804dd.zip
Adding upstream version 86.0.1.upstream/86.0.1upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'js/src/tests/test262/language/expressions/instanceof')
-rw-r--r--js/src/tests/test262/language/expressions/instanceof/S11.8.6_A1.js62
-rw-r--r--js/src/tests/test262/language/expressions/instanceof/S11.8.6_A2.1_T1.js34
-rw-r--r--js/src/tests/test262/language/expressions/instanceof/S11.8.6_A2.1_T2.js21
-rw-r--r--js/src/tests/test262/language/expressions/instanceof/S11.8.6_A2.1_T3.js21
-rw-r--r--js/src/tests/test262/language/expressions/instanceof/S11.8.6_A2.4_T1.js22
-rw-r--r--js/src/tests/test262/language/expressions/instanceof/S11.8.6_A2.4_T2.js26
-rw-r--r--js/src/tests/test262/language/expressions/instanceof/S11.8.6_A2.4_T3.js21
-rw-r--r--js/src/tests/test262/language/expressions/instanceof/S11.8.6_A2.4_T4.js16
-rw-r--r--js/src/tests/test262/language/expressions/instanceof/S11.8.6_A3.js65
-rw-r--r--js/src/tests/test262/language/expressions/instanceof/S11.8.6_A4_T1.js25
-rw-r--r--js/src/tests/test262/language/expressions/instanceof/S11.8.6_A4_T2.js25
-rw-r--r--js/src/tests/test262/language/expressions/instanceof/S11.8.6_A4_T3.js25
-rw-r--r--js/src/tests/test262/language/expressions/instanceof/S11.8.6_A5_T1.js46
-rw-r--r--js/src/tests/test262/language/expressions/instanceof/S11.8.6_A5_T2.js35
-rw-r--r--js/src/tests/test262/language/expressions/instanceof/S11.8.6_A6_T1.js23
-rw-r--r--js/src/tests/test262/language/expressions/instanceof/S11.8.6_A6_T2.js23
-rw-r--r--js/src/tests/test262/language/expressions/instanceof/S11.8.6_A6_T3.js29
-rw-r--r--js/src/tests/test262/language/expressions/instanceof/S11.8.6_A6_T4.js42
-rw-r--r--js/src/tests/test262/language/expressions/instanceof/S11.8.6_A7_T1.js24
-rw-r--r--js/src/tests/test262/language/expressions/instanceof/S11.8.6_A7_T2.js24
-rw-r--r--js/src/tests/test262/language/expressions/instanceof/S11.8.6_A7_T3.js24
-rw-r--r--js/src/tests/test262/language/expressions/instanceof/S15.3.5.3_A1_T1.js21
-rw-r--r--js/src/tests/test262/language/expressions/instanceof/S15.3.5.3_A1_T2.js21
-rw-r--r--js/src/tests/test262/language/expressions/instanceof/S15.3.5.3_A1_T3.js21
-rw-r--r--js/src/tests/test262/language/expressions/instanceof/S15.3.5.3_A1_T4.js21
-rw-r--r--js/src/tests/test262/language/expressions/instanceof/S15.3.5.3_A1_T5.js21
-rw-r--r--js/src/tests/test262/language/expressions/instanceof/S15.3.5.3_A1_T6.js21
-rw-r--r--js/src/tests/test262/language/expressions/instanceof/S15.3.5.3_A1_T7.js21
-rw-r--r--js/src/tests/test262/language/expressions/instanceof/S15.3.5.3_A1_T8.js23
-rw-r--r--js/src/tests/test262/language/expressions/instanceof/S15.3.5.3_A2_T2.js32
-rw-r--r--js/src/tests/test262/language/expressions/instanceof/S15.3.5.3_A2_T5.js40
-rw-r--r--js/src/tests/test262/language/expressions/instanceof/S15.3.5.3_A2_T6.js31
-rw-r--r--js/src/tests/test262/language/expressions/instanceof/S15.3.5.3_A3_T1.js30
-rw-r--r--js/src/tests/test262/language/expressions/instanceof/S15.3.5.3_A3_T2.js35
-rw-r--r--js/src/tests/test262/language/expressions/instanceof/browser.js0
-rw-r--r--js/src/tests/test262/language/expressions/instanceof/primitive-prototype-with-object.js34
-rw-r--r--js/src/tests/test262/language/expressions/instanceof/primitive-prototype-with-primitive.js31
-rw-r--r--js/src/tests/test262/language/expressions/instanceof/prototype-getter-with-object-throws.js44
-rw-r--r--js/src/tests/test262/language/expressions/instanceof/prototype-getter-with-object.js49
-rw-r--r--js/src/tests/test262/language/expressions/instanceof/prototype-getter-with-primitive.js36
-rw-r--r--js/src/tests/test262/language/expressions/instanceof/shell.js0
-rw-r--r--js/src/tests/test262/language/expressions/instanceof/symbol-hasinstance-get-err.js26
-rw-r--r--js/src/tests/test262/language/expressions/instanceof/symbol-hasinstance-invocation.js34
-rw-r--r--js/src/tests/test262/language/expressions/instanceof/symbol-hasinstance-not-callable.js26
-rw-r--r--js/src/tests/test262/language/expressions/instanceof/symbol-hasinstance-to-boolean.js46
45 files changed, 1297 insertions, 0 deletions
diff --git a/js/src/tests/test262/language/expressions/instanceof/S11.8.6_A1.js b/js/src/tests/test262/language/expressions/instanceof/S11.8.6_A1.js
new file mode 100644
index 0000000000..411fbf410e
--- /dev/null
+++ b/js/src/tests/test262/language/expressions/instanceof/S11.8.6_A1.js
@@ -0,0 +1,62 @@
+// Copyright 2009 the Sputnik authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+info: |
+ White Space and Line Terminator between RelationalExpression and
+ "instanceof" and between "instanceof" and ShiftExpression are allowed
+es5id: 11.8.6_A1
+description: Checking by using eval
+---*/
+
+//CHECK#1
+if (eval("({})\u0009instanceof\u0009Object") !== true) {
+ $ERROR('#1: ({})\\u0009instanceof\\u0009Object === true');
+}
+
+//CHECK#2
+if (eval("({})\u000Binstanceof\u000BObject") !== true) {
+ $ERROR('#2: ({})\\u000Binstanceof\\u000BObject === true');
+}
+
+//CHECK#3
+if (eval("({})\u000Cinstanceof\u000CObject") !== true) {
+ $ERROR('#3: ({})\\u000Cinstanceof\\u000CObject === true');
+}
+
+//CHECK#4
+if (eval("({})\u0020instanceof\u0020Object") !== true) {
+ $ERROR('#4: ({})\\u0020instanceof\\u0020Object === true');
+}
+
+//CHECK#5
+if (eval("({})\u00A0instanceof\u00A0Object") !== true) {
+ $ERROR('#5: ({})\\u00A0instanceof\\u00A0Object === true');
+}
+
+//CHECK#6
+if (eval("({})\u000Ainstanceof\u000AObject") !== true) {
+ $ERROR('#6: ({})\\u000Ainstanceof\\u000AObject === true');
+}
+
+//CHECK#7
+if (eval("({})\u000Dinstanceof\u000DObject") !== true) {
+ $ERROR('#7: ({})\\u000Dinstanceof\\u000DObject === true');
+}
+
+//CHECK#8
+if (eval("({})\u2028instanceof\u2028Object") !== true) {
+ $ERROR('#8: ({})\\u2028instanceof\\u2028Object === true');
+}
+
+//CHECK#9
+if (eval("({})\u2029instanceof\u2029Object") !== true) {
+ $ERROR('#9: ({})\\u2029instanceof\\u2029Object === true');
+}
+
+//CHECK#10
+if (eval("({})\u0009\u000B\u000C\u0020\u00A0\u000A\u000D\u2028\u2029instanceof\u0009\u000B\u000C\u0020\u00A0\u000A\u000D\u2028\u2029Object") !== true) {
+ $ERROR('#10: ({})\\u0009\\u000B\\u000C\\u0020\\u00A0\\u000A\\u000D\\u2028\\u2029instanceof\\u0009\\u000B\\u000C\\u0020\\u00A0\\u000A\\u000D\\u2028\\u2029Object === true');
+}
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/expressions/instanceof/S11.8.6_A2.1_T1.js b/js/src/tests/test262/language/expressions/instanceof/S11.8.6_A2.1_T1.js
new file mode 100644
index 0000000000..fc7129f1c7
--- /dev/null
+++ b/js/src/tests/test262/language/expressions/instanceof/S11.8.6_A2.1_T1.js
@@ -0,0 +1,34 @@
+// Copyright 2009 the Sputnik authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+info: Operator "instanceof" uses GetValue
+es5id: 11.8.6_A2.1_T1
+description: Either Expression is not Reference or GetBase is not null
+---*/
+
+//CHECK#1
+if (({}) instanceof Object !== true) {
+ $ERROR('#1: ({}) instanceof Object === true');
+}
+
+//CHECK#2
+var object = {};
+if (object instanceof Object !== true) {
+ $ERROR('#2: var object = {}; object instanceof Object === true');
+}
+
+//CHECK#3
+var OBJECT = Object;
+if (({}) instanceof OBJECT !== true) {
+ $ERROR('#3: var OBJECT = Object; ({}) instanceof OBJECT === true');
+}
+
+//CHECK#4
+var object = {};
+var OBJECT = Object;
+if (object instanceof OBJECT !== true) {
+ $ERROR('#4: var object = {}; var OBJECT = Object; object instanceof OBJECT === true');
+}
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/expressions/instanceof/S11.8.6_A2.1_T2.js b/js/src/tests/test262/language/expressions/instanceof/S11.8.6_A2.1_T2.js
new file mode 100644
index 0000000000..bb208618c6
--- /dev/null
+++ b/js/src/tests/test262/language/expressions/instanceof/S11.8.6_A2.1_T2.js
@@ -0,0 +1,21 @@
+// Copyright 2009 the Sputnik authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+info: Operator "instanceof" uses GetValue
+es5id: 11.8.6_A2.1_T2
+description: If GetBase(RelationalExpression) is null, throw ReferenceError
+---*/
+
+//CHECK#1
+try {
+ object instanceof Object;
+ $ERROR('#1.1: object instanceof Object throw ReferenceError. Actual: ' + (object instanceof Object));
+}
+catch (e) {
+ if ((e instanceof ReferenceError) !== true) {
+ $ERROR('#1.2: object instanceof Object throw ReferenceError. Actual: ' + (e));
+ }
+}
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/expressions/instanceof/S11.8.6_A2.1_T3.js b/js/src/tests/test262/language/expressions/instanceof/S11.8.6_A2.1_T3.js
new file mode 100644
index 0000000000..ff3c14b35b
--- /dev/null
+++ b/js/src/tests/test262/language/expressions/instanceof/S11.8.6_A2.1_T3.js
@@ -0,0 +1,21 @@
+// Copyright 2009 the Sputnik authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+info: Operator "instanceof" uses GetValue
+es5id: 11.8.6_A2.1_T3
+description: If GetBase(ShiftExpression) is null, throw ReferenceError
+---*/
+
+//CHECK#1
+try {
+ ({}) instanceof OBJECT;
+ $ERROR('#1.1: ({}) instanceof OBJECT throw ReferenceError. Actual: ' + (({}) instanceof OBJECT));
+}
+catch (e) {
+ if ((e instanceof ReferenceError) !== true) {
+ $ERROR('#1.2: ({}) instanceof OBJECT throw ReferenceError. Actual: ' + (e));
+ }
+}
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/expressions/instanceof/S11.8.6_A2.4_T1.js b/js/src/tests/test262/language/expressions/instanceof/S11.8.6_A2.4_T1.js
new file mode 100644
index 0000000000..8e24b4a5b9
--- /dev/null
+++ b/js/src/tests/test262/language/expressions/instanceof/S11.8.6_A2.4_T1.js
@@ -0,0 +1,22 @@
+// Copyright 2009 the Sputnik authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+info: First expression is evaluated first, and then second expression
+es5id: 11.8.6_A2.4_T1
+description: Checking with "="
+---*/
+
+//CHECK#1
+var OBJECT = 0;
+if ((OBJECT = Object, {}) instanceof OBJECT !== true) {
+ $ERROR('#1: var OBJECT = 0; (OBJECT = Object, {}) instanceof OBJECT === true');
+}
+
+//CHECK#2
+var object = {};
+if (object instanceof (object = 0, Object) !== true) {
+ $ERROR('#2: var object = {}; object instanceof (object = 0, Object) === true');
+}
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/expressions/instanceof/S11.8.6_A2.4_T2.js b/js/src/tests/test262/language/expressions/instanceof/S11.8.6_A2.4_T2.js
new file mode 100644
index 0000000000..87e7cad8cc
--- /dev/null
+++ b/js/src/tests/test262/language/expressions/instanceof/S11.8.6_A2.4_T2.js
@@ -0,0 +1,26 @@
+// Copyright 2009 the Sputnik authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+info: First expression is evaluated first, and then second expression
+es5id: 11.8.6_A2.4_T2
+description: Checking with "throw"
+---*/
+
+//CHECK#1
+var x = function () { throw "x"; };
+var y = function () { throw "y"; };
+try {
+ x() instanceof y();
+ $ERROR('#1.1: var x = function () { throw "x"; }; var y = function () { throw "y"; }; x() instanceof y() throw "x". Actual: ' + (x() instanceof y()));
+} catch (e) {
+ if (e === "y") {
+ $ERROR('#1.2: First expression is evaluated first, and then second expression');
+ } else {
+ if (e !== "x") {
+ $ERROR('#1.3: var x = function () { throw "x"; }; var y = function () { throw "y"; }; x() instanceof y() throw "x". Actual: ' + (e));
+ }
+ }
+}
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/expressions/instanceof/S11.8.6_A2.4_T3.js b/js/src/tests/test262/language/expressions/instanceof/S11.8.6_A2.4_T3.js
new file mode 100644
index 0000000000..5bfaf9cf8f
--- /dev/null
+++ b/js/src/tests/test262/language/expressions/instanceof/S11.8.6_A2.4_T3.js
@@ -0,0 +1,21 @@
+// Copyright 2009 the Sputnik authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+info: First expression is evaluated first, and then second expression
+es5id: 11.8.6_A2.4_T3
+description: Checking with undeclarated variables
+---*/
+
+//CHECK#1
+try {
+ object instanceof (object = {}, Object);
+ $ERROR('#1.1: object instanceof (object = {}, Object) throw ReferenceError. Actual: ' + (object instanceof (object = {}, Object)));
+}
+catch (e) {
+ if ((e instanceof ReferenceError) !== true) {
+ $ERROR('#1.2: object instanceof (object = {}, Object) throw ReferenceError. Actual: ' + (e));
+ }
+}
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/expressions/instanceof/S11.8.6_A2.4_T4.js b/js/src/tests/test262/language/expressions/instanceof/S11.8.6_A2.4_T4.js
new file mode 100644
index 0000000000..9f26a46f74
--- /dev/null
+++ b/js/src/tests/test262/language/expressions/instanceof/S11.8.6_A2.4_T4.js
@@ -0,0 +1,16 @@
+// Copyright 2009 the Sputnik authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+info: First expression is evaluated first, and then second expression
+es5id: 11.8.6_A2.4_T4
+description: Checking with undeclarated variables
+flags: [noStrict]
+---*/
+
+//CHECK#1
+if ((OBJECT = Object, {}) instanceof OBJECT !== true) {
+ $ERROR('#1: (OBJECT = Object, {}) instanceof OBJECT !== true');
+}
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/expressions/instanceof/S11.8.6_A3.js b/js/src/tests/test262/language/expressions/instanceof/S11.8.6_A3.js
new file mode 100644
index 0000000000..e35ea225ee
--- /dev/null
+++ b/js/src/tests/test262/language/expressions/instanceof/S11.8.6_A3.js
@@ -0,0 +1,65 @@
+// Copyright 2009 the Sputnik authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+info: If ShiftExpression is not an object, throw TypeError
+es5id: 11.8.6_A3
+description: Checking all the types of primitives
+---*/
+
+//CHECK#1
+try {
+ true instanceof true;
+ $ERROR('#1: true instanceof true throw TypeError');
+}
+catch (e) {
+ if (e instanceof TypeError !== true) {
+ $ERROR('#1: true instanceof true throw TypeError');
+ }
+}
+
+//CHECK#2
+try {
+ 1 instanceof 1;
+ $ERROR('#2: 1 instanceof 1 throw TypeError');
+}
+catch (e) {
+ if (e instanceof TypeError !== true) {
+ $ERROR('#2: 1 instanceof 1 throw TypeError');
+ }
+}
+
+//CHECK#3
+try {
+ "string" instanceof "string";
+ $ERROR('#3: "string" instanceof "string" throw TypeError');
+}
+catch (e) {
+ if (e instanceof TypeError !== true) {
+ $ERROR('#3: "string" instanceof "string" throw TypeError');
+ }
+}
+
+//CHECK#4
+try {
+ undefined instanceof undefined;
+ $ERROR('#4: undefined instanceof undefined throw TypeError');
+}
+catch (e) {
+ if (e instanceof TypeError !== true) {
+ $ERROR('#4: undefined instanceof undefined throw TypeError');
+ }
+}
+
+//CHECK#5
+try {
+ null instanceof null;
+ $ERROR('#5: null instanceof null throw TypeError');
+}
+catch (e) {
+ if (e instanceof TypeError !== true) {
+ $ERROR('#5: null instanceof null throw TypeError');
+ }
+}
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/expressions/instanceof/S11.8.6_A4_T1.js b/js/src/tests/test262/language/expressions/instanceof/S11.8.6_A4_T1.js
new file mode 100644
index 0000000000..ae54c2b758
--- /dev/null
+++ b/js/src/tests/test262/language/expressions/instanceof/S11.8.6_A4_T1.js
@@ -0,0 +1,25 @@
+// Copyright 2009 the Sputnik authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+info: Only constructor call (with "new" keyword) makes instance
+es5id: 11.8.6_A4_T1
+description: Checking Boolean case
+---*/
+
+//CHECK#1
+if (false instanceof Boolean) {
+ $ERROR('#1: false is not instanceof Boolean');
+}
+
+//CHECK#2
+if (Boolean(false) instanceof Boolean) {
+ $ERROR('#2: Boolean(false) is not instanceof Boolean');
+}
+
+//CHECK#3
+if (new Boolean instanceof Boolean !== true) {
+ $ERROR('#3: new Boolean instanceof Boolean');
+}
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/expressions/instanceof/S11.8.6_A4_T2.js b/js/src/tests/test262/language/expressions/instanceof/S11.8.6_A4_T2.js
new file mode 100644
index 0000000000..1ff5aa063e
--- /dev/null
+++ b/js/src/tests/test262/language/expressions/instanceof/S11.8.6_A4_T2.js
@@ -0,0 +1,25 @@
+// Copyright 2009 the Sputnik authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+info: Only constructor call (with "new" keyword) makes instance
+es5id: 11.8.6_A4_T2
+description: Checking Number case
+---*/
+
+//CHECK#1
+if (0 instanceof Number) {
+ $ERROR('#1: 0 is not instanceof Number');
+}
+
+//CHECK#2
+if (Number(0) instanceof Number) {
+ $ERROR('#2: Number(0) is not instanceof Number');
+}
+
+//CHECK#3
+if (new Number instanceof Number !== true) {
+ $ERROR('#3: new Number instanceof Number');
+}
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/expressions/instanceof/S11.8.6_A4_T3.js b/js/src/tests/test262/language/expressions/instanceof/S11.8.6_A4_T3.js
new file mode 100644
index 0000000000..b26776c606
--- /dev/null
+++ b/js/src/tests/test262/language/expressions/instanceof/S11.8.6_A4_T3.js
@@ -0,0 +1,25 @@
+// Copyright 2009 the Sputnik authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+info: Only constructor call (with "new" keyword) makes instance
+es5id: 11.8.6_A4_T3
+description: Checking String case
+---*/
+
+//CHECK#1
+if ("" instanceof String) {
+ $ERROR('#1: "" is not instanceof String');
+}
+
+//CHECK#2
+if (String("") instanceof String) {
+ $ERROR('#2: String("") is not instanceof String');
+}
+
+//CHECK#3
+if (new String instanceof String !== true) {
+ $ERROR('#3: new String instanceof String');
+}
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/expressions/instanceof/S11.8.6_A5_T1.js b/js/src/tests/test262/language/expressions/instanceof/S11.8.6_A5_T1.js
new file mode 100644
index 0000000000..9b6f7ead39
--- /dev/null
+++ b/js/src/tests/test262/language/expressions/instanceof/S11.8.6_A5_T1.js
@@ -0,0 +1,46 @@
+// Copyright 2009 the Sputnik authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+info: TypeError is subclass of Error from instanceof operator point of view
+es5id: 11.8.6_A5_T1
+description: Checking Error case
+---*/
+
+var __err = new Error;
+
+//////////////////////////////////////////////////////////////////////////////
+//CHECK#1
+if (!(__err instanceof Error)) {
+ $ERROR('#1: TypeError is subclass of Error from instanceof operator point of view');
+}
+//
+//////////////////////////////////////////////////////////////////////////////
+
+//////////////////////////////////////////////////////////////////////////////
+//CHECK#2
+if (__err instanceof TypeError) {
+ $ERROR('#2: TypeError is subclass of Error from instanceof operator point of view');
+}
+//
+//////////////////////////////////////////////////////////////////////////////
+
+var err__ = Error('failed');
+
+//////////////////////////////////////////////////////////////////////////////
+//CHECK#3
+if (!(err__ instanceof Error)) {
+ $ERROR('#3: TypeError is subclass of Error from instanceof operator point of view');
+}
+//
+//////////////////////////////////////////////////////////////////////////////
+
+//////////////////////////////////////////////////////////////////////////////
+//CHECK#4
+if (err__ instanceof TypeError) {
+ $ERROR('#4: TypeError is subclass of Error from instanceof operator point of view');
+}
+//
+//////////////////////////////////////////////////////////////////////////////
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/expressions/instanceof/S11.8.6_A5_T2.js b/js/src/tests/test262/language/expressions/instanceof/S11.8.6_A5_T2.js
new file mode 100644
index 0000000000..4c5eeba682
--- /dev/null
+++ b/js/src/tests/test262/language/expressions/instanceof/S11.8.6_A5_T2.js
@@ -0,0 +1,35 @@
+// Copyright 2009 the Sputnik authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+info: TypeError is subclass of Error from instanceof operator point of view
+es5id: 11.8.6_A5_T2
+description: Checking TypeError case
+---*/
+
+var __t__err = new TypeError;
+
+//CHECK#1
+if (!(__t__err instanceof Error)) {
+ $ERROR('#1: TypeError is subclass of Error from instanceof operator point of view');
+}
+
+//CHECK#2
+if (!(__t__err instanceof TypeError)) {
+ $ERROR('#2: TypeError is subclass of Error from instanceof operator point of view');
+}
+
+//////////////////////////////////////////////////////////////////////////////
+var err__t__ = TypeError('failed');
+
+//CHECK#3
+if (!(err__t__ instanceof Error)) {
+ $ERROR('#3: TypeError is subclass of Error from instanceof operator point of view');
+}
+
+//CHECK#4
+if (!(err__t__ instanceof TypeError)) {
+ $ERROR('#4: TypeError is subclass of Error from instanceof operator point of view');
+}
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/expressions/instanceof/S11.8.6_A6_T1.js b/js/src/tests/test262/language/expressions/instanceof/S11.8.6_A6_T1.js
new file mode 100644
index 0000000000..550cb0ccd8
--- /dev/null
+++ b/js/src/tests/test262/language/expressions/instanceof/S11.8.6_A6_T1.js
@@ -0,0 +1,23 @@
+// Copyright 2009 the Sputnik authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+info: |
+ Only Function objects implement [[HasInstance]] and can be proper
+ ShiftExpression for the "instanceof" operator consequently
+es5id: 11.8.6_A6_T1
+description: Checking "this" case
+---*/
+
+//CHECK#1
+try{
+ ({}) instanceof this;
+ $ERROR('#1: Only Function objects implement [[HasInstance]] and consequently can be proper ShiftExpression for The instanceof operator');
+}
+catch(e){
+ if (e instanceof TypeError !== true) {
+ $ERROR('#1: Only Function objects implement [[HasInstance]] and consequently can be proper ShiftExpression for The instanceof operator');
+ }
+}
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/expressions/instanceof/S11.8.6_A6_T2.js b/js/src/tests/test262/language/expressions/instanceof/S11.8.6_A6_T2.js
new file mode 100644
index 0000000000..73c3cdb43a
--- /dev/null
+++ b/js/src/tests/test262/language/expressions/instanceof/S11.8.6_A6_T2.js
@@ -0,0 +1,23 @@
+// Copyright 2009 the Sputnik authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+info: |
+ Only Function objects implement [[HasInstance]] and can be proper
+ ShiftExpression for the "instanceof" operator consequently
+es5id: 11.8.6_A6_T2
+description: Checking Math case
+---*/
+
+//CHECK#1
+try{
+ 1 instanceof Math;
+ $ERROR('#1: 1 instanceof Math throw TypeError');
+}
+catch(e){
+ if (e instanceof TypeError !== true) {
+ $ERROR('#1: 1 instanceof Math throw TypeError');
+ }
+}
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/expressions/instanceof/S11.8.6_A6_T3.js b/js/src/tests/test262/language/expressions/instanceof/S11.8.6_A6_T3.js
new file mode 100644
index 0000000000..5fac55c9af
--- /dev/null
+++ b/js/src/tests/test262/language/expressions/instanceof/S11.8.6_A6_T3.js
@@ -0,0 +1,29 @@
+// Copyright 2009 the Sputnik authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+info: |
+ Only Function objects implement [[HasInstance]] and can be proper
+ ShiftExpression for the "instanceof" operator consequently
+es5id: 11.8.6_A6_T3
+description: Checking if RelationalExpression is function
+---*/
+
+function MyFunct(){return 0};
+
+//CHECK#1
+if (MyFunct instanceof MyFunct){
+ $ERROR('#1 function MyFunct(){return 0}; MyFunct instanceof MyFunct === false');
+}
+
+//CHECK#2
+if (MyFunct instanceof Function !== true){
+ $ERROR('#2 function MyFunct(){return 0}; MyFunct instanceof Function === true');
+}
+
+//CHECK#3
+if (MyFunct instanceof Object !== true){
+ $ERROR('#3 function MyFunct(){return 0}; MyFunct instanceof Object === true');
+}
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/expressions/instanceof/S11.8.6_A6_T4.js b/js/src/tests/test262/language/expressions/instanceof/S11.8.6_A6_T4.js
new file mode 100644
index 0000000000..0a2f90ac30
--- /dev/null
+++ b/js/src/tests/test262/language/expressions/instanceof/S11.8.6_A6_T4.js
@@ -0,0 +1,42 @@
+// Copyright 2009 the Sputnik authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+info: |
+ Only Function objects implement [[HasInstance]] and can be proper
+ ShiftExpression for the "instanceof" operator consequently
+es5id: 11.8.6_A6_T4
+description: Checking if RelationalExpression is object
+---*/
+
+var MyFunct = function(){};
+var __my__funct = new MyFunct;
+
+
+//CHECK#1
+if (!(__my__funct instanceof MyFunct)){
+ $ERROR('#1 Only Function objects implement [[HasInstance]] and consequently can be proper ShiftExpression for The instanceof operator');
+}
+
+//CHECK#2
+if (__my__funct instanceof Function){
+ $ERROR('#2 Only Function objects implement [[HasInstance]] and consequently can be proper ShiftExpression for The instanceof operator');
+}
+
+//CHECK#3
+if (!(__my__funct instanceof Object)){
+ $ERROR('#3 Only Function objects implement [[HasInstance]] and consequently can be proper ShiftExpression for The instanceof operator');
+}
+
+//CHECK#4
+try{
+ __my__funct instanceof __my__funct;
+ $ERROR('#4 Only Function objects implement [[HasInstance]] and consequently can be proper ShiftExpression for The instanceof operator');
+}
+catch(e){
+ if (e instanceof TypeError !== true) {
+ $ERROR('#4 Only Function objects implement [[HasInstance]] and consequently can be proper ShiftExpression for The instanceof operator');
+ }
+}
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/expressions/instanceof/S11.8.6_A7_T1.js b/js/src/tests/test262/language/expressions/instanceof/S11.8.6_A7_T1.js
new file mode 100644
index 0000000000..a3c279df9f
--- /dev/null
+++ b/js/src/tests/test262/language/expressions/instanceof/S11.8.6_A7_T1.js
@@ -0,0 +1,24 @@
+// Copyright 2009 the Sputnik authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+info: |
+ When "instanceof" returns true it means that
+ GetValue(RelationalExpression) is constructed with ShiftExpression
+es5id: 11.8.6_A7_T1
+description: Checking Object object
+---*/
+
+var __obj={};
+
+//CHECK#1
+if (!(__obj instanceof Object)) {
+ $ERROR('#1: If instanceof returns true then GetValue(RelationalExpression) was constructed with ShiftExpression');
+}
+
+//CHECK#2
+if (__obj.constructor !== Object) {
+ $ERROR('#2: If instanceof returns true then GetValue(RelationalExpression) was constructed with ShiftExpression');
+}
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/expressions/instanceof/S11.8.6_A7_T2.js b/js/src/tests/test262/language/expressions/instanceof/S11.8.6_A7_T2.js
new file mode 100644
index 0000000000..968d9122d3
--- /dev/null
+++ b/js/src/tests/test262/language/expressions/instanceof/S11.8.6_A7_T2.js
@@ -0,0 +1,24 @@
+// Copyright 2009 the Sputnik authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+info: |
+ When "instanceof" returns true it means that
+ GetValue(RelationalExpression) is constructed with ShiftExpression
+es5id: 11.8.6_A7_T2
+description: Checking Array object
+---*/
+
+var __arr=[];
+
+//CHECK#1
+if (!(__arr instanceof Array)) {
+ $ERROR('#1: If instanceof returns true then GetValue(RelationalExpression) was constructed with ShiftExpression');
+}
+
+//CHECK#2
+if (__arr.constructor !== Array) {
+ $ERROR('#2: If instanceof returns true then GetValue(RelationalExpression) was constructed with ShiftExpression');
+}
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/expressions/instanceof/S11.8.6_A7_T3.js b/js/src/tests/test262/language/expressions/instanceof/S11.8.6_A7_T3.js
new file mode 100644
index 0000000000..707f2bdfcd
--- /dev/null
+++ b/js/src/tests/test262/language/expressions/instanceof/S11.8.6_A7_T3.js
@@ -0,0 +1,24 @@
+// Copyright 2009 the Sputnik authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+info: |
+ When "instanceof" returns true it means that
+ GetValue(RelationalExpression) is constructed with ShiftExpression
+es5id: 11.8.6_A7_T3
+description: Checking Function object
+---*/
+
+var __func = new Function;
+
+//CHECK#1
+if (!(__func instanceof Function)) {
+ $ERROR('#1: If instanceof returns true then GetValue(RelationalExpression) was constructed with ShiftExpression');
+}
+
+//CHECK#2
+if (__func.constructor !== Function) {
+ $ERROR('#2: If instanceof returns true then GetValue(RelationalExpression) was constructed with ShiftExpression');
+}
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/expressions/instanceof/S15.3.5.3_A1_T1.js b/js/src/tests/test262/language/expressions/instanceof/S15.3.5.3_A1_T1.js
new file mode 100644
index 0000000000..6983cb79bf
--- /dev/null
+++ b/js/src/tests/test262/language/expressions/instanceof/S15.3.5.3_A1_T1.js
@@ -0,0 +1,21 @@
+// Copyright 2009 the Sputnik authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+info: |
+ Assume F is a Function object. When the [[HasInstance]] method of F is
+ called with value V, the following steps are taken: i) If V is not an
+ object, return false
+es5id: 15.3.5.3_A1_T1
+description: V is number
+---*/
+
+var FACTORY;
+FACTORY = Function("name","this.name=name;");
+
+//CHECK#1
+if ((1 instanceof FACTORY)!==false) {
+ $ERROR('#1: Assume F is a Function object. When the [[HasInstance]] method of F is called with value V, the following steps are taken: i) If V is not an object, return false');
+}
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/expressions/instanceof/S15.3.5.3_A1_T2.js b/js/src/tests/test262/language/expressions/instanceof/S15.3.5.3_A1_T2.js
new file mode 100644
index 0000000000..b26a45769f
--- /dev/null
+++ b/js/src/tests/test262/language/expressions/instanceof/S15.3.5.3_A1_T2.js
@@ -0,0 +1,21 @@
+// Copyright 2009 the Sputnik authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+info: |
+ Assume F is a Function object. When the [[HasInstance]] method of F is
+ called with value V, the following steps are taken: i) If V is not an
+ object, return false
+es5id: 15.3.5.3_A1_T2
+description: V is string
+---*/
+
+var FACTORY;
+FACTORY = Function("name","this.name=name;");
+
+//CHECK#1
+if (("1" instanceof FACTORY)!==false) {
+ $ERROR('#1: Assume F is a Function object. When the [[HasInstance]] method of F is called with value V, the following steps are taken: i) If V is not an object, return false');
+}
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/expressions/instanceof/S15.3.5.3_A1_T3.js b/js/src/tests/test262/language/expressions/instanceof/S15.3.5.3_A1_T3.js
new file mode 100644
index 0000000000..1698467772
--- /dev/null
+++ b/js/src/tests/test262/language/expressions/instanceof/S15.3.5.3_A1_T3.js
@@ -0,0 +1,21 @@
+// Copyright 2009 the Sputnik authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+info: |
+ Assume F is a Function object. When the [[HasInstance]] method of F is
+ called with value V, the following steps are taken: i) If V is not an
+ object, return false
+es5id: 15.3.5.3_A1_T3
+description: V is boolean true
+---*/
+
+var FACTORY;
+FACTORY = Function("name","this.name=name;");
+
+//CHECK#1
+if ((true instanceof FACTORY)!==false) {
+ $ERROR('#1: Assume F is a Function object. When the [[HasInstance]] method of F is called with value V, the following steps are taken: i) If V is not an object, return false');
+}
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/expressions/instanceof/S15.3.5.3_A1_T4.js b/js/src/tests/test262/language/expressions/instanceof/S15.3.5.3_A1_T4.js
new file mode 100644
index 0000000000..5e38ce31b7
--- /dev/null
+++ b/js/src/tests/test262/language/expressions/instanceof/S15.3.5.3_A1_T4.js
@@ -0,0 +1,21 @@
+// Copyright 2009 the Sputnik authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+info: |
+ Assume F is a Function object. When the [[HasInstance]] method of F is
+ called with value V, the following steps are taken: i) If V is not an
+ object, return false
+es5id: 15.3.5.3_A1_T4
+description: V is boolean false
+---*/
+
+var FACTORY;
+FACTORY = Function("name","this.name=name;");
+
+//CHECK#1
+if ((false instanceof FACTORY)!==false) {
+ $ERROR('#1: Assume F is a Function object. When the [[HasInstance]] method of F is called with value V, the following steps are taken: i) If V is not an object, return false');
+}
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/expressions/instanceof/S15.3.5.3_A1_T5.js b/js/src/tests/test262/language/expressions/instanceof/S15.3.5.3_A1_T5.js
new file mode 100644
index 0000000000..e3da40bb7b
--- /dev/null
+++ b/js/src/tests/test262/language/expressions/instanceof/S15.3.5.3_A1_T5.js
@@ -0,0 +1,21 @@
+// Copyright 2009 the Sputnik authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+info: |
+ Assume F is a Function object. When the [[HasInstance]] method of F is
+ called with value V, the following steps are taken: i) If V is not an
+ object, return false
+es5id: 15.3.5.3_A1_T5
+description: V is void 0
+---*/
+
+var FACTORY;
+FACTORY = Function("name","this.name=name;");
+
+//CHECK#1
+if ((void 0 instanceof FACTORY)!==false) {
+ $ERROR('#1: Assume F is a Function object. When the [[HasInstance]] method of F is called with value V, the following steps are taken: i) If V is not an object, return false');
+}
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/expressions/instanceof/S15.3.5.3_A1_T6.js b/js/src/tests/test262/language/expressions/instanceof/S15.3.5.3_A1_T6.js
new file mode 100644
index 0000000000..211a986f8d
--- /dev/null
+++ b/js/src/tests/test262/language/expressions/instanceof/S15.3.5.3_A1_T6.js
@@ -0,0 +1,21 @@
+// Copyright 2009 the Sputnik authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+info: |
+ Assume F is a Function object. When the [[HasInstance]] method of F is
+ called with value V, the following steps are taken: i) If V is not an
+ object, return false
+es5id: 15.3.5.3_A1_T6
+description: V is null
+---*/
+
+var FACTORY;
+FACTORY = Function("name","this.name=name;");
+
+//CHECK#1
+if ((null instanceof FACTORY)!==false) {
+ $ERROR('#1: Assume F is a Function object. When the [[HasInstance]] method of F is called with value V, the following steps are taken: i) If V is not an object, return false');
+}
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/expressions/instanceof/S15.3.5.3_A1_T7.js b/js/src/tests/test262/language/expressions/instanceof/S15.3.5.3_A1_T7.js
new file mode 100644
index 0000000000..157db551aa
--- /dev/null
+++ b/js/src/tests/test262/language/expressions/instanceof/S15.3.5.3_A1_T7.js
@@ -0,0 +1,21 @@
+// Copyright 2009 the Sputnik authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+info: |
+ Assume F is a Function object. When the [[HasInstance]] method of F is
+ called with value V, the following steps are taken: i) If V is not an
+ object, return false
+es5id: 15.3.5.3_A1_T7
+description: V is undefined
+---*/
+
+var FACTORY;
+FACTORY = Function("name","this.name=name;");
+
+//CHECK#1
+if ((undefined instanceof FACTORY)!==false) {
+ $ERROR('#1: Assume F is a Function object. When the [[HasInstance]] method of F is called with value V, the following steps are taken: i) If V is not an object, return false');
+}
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/expressions/instanceof/S15.3.5.3_A1_T8.js b/js/src/tests/test262/language/expressions/instanceof/S15.3.5.3_A1_T8.js
new file mode 100644
index 0000000000..66339c66b5
--- /dev/null
+++ b/js/src/tests/test262/language/expressions/instanceof/S15.3.5.3_A1_T8.js
@@ -0,0 +1,23 @@
+// Copyright 2009 the Sputnik authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+info: |
+ Assume F is a Function object. When the [[HasInstance]] method of F is
+ called with value V, the following steps are taken: i) If V is not an
+ object, return false
+es5id: 15.3.5.3_A1_T8
+description: V is undefined variable
+---*/
+
+var FACTORY;
+FACTORY = Function("name","this.name=name;");
+
+//CHECK#1
+if ((x instanceof FACTORY)!==false) {
+ $ERROR('#1: Assume F is a Function object. When the [[HasInstance]] method of F is called with value V, the following steps are taken: i) If V is not an object, return false');
+}
+
+var x;
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/expressions/instanceof/S15.3.5.3_A2_T2.js b/js/src/tests/test262/language/expressions/instanceof/S15.3.5.3_A2_T2.js
new file mode 100644
index 0000000000..e232b1ab2d
--- /dev/null
+++ b/js/src/tests/test262/language/expressions/instanceof/S15.3.5.3_A2_T2.js
@@ -0,0 +1,32 @@
+// Copyright 2009 the Sputnik authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+info: |
+ Assume F is a Function object. When the [[HasInstance]] method of F is called with value V and V is an object, the following steps are taken:
+ i) Call the [[Get]] method of F with property name "prototype".
+ ii) Let O be Result(i).
+ iii) O is not an object, throw a TypeError exception
+es5id: 15.3.5.3_A2_T2
+description: F.prototype is undefined, and V is empty object
+---*/
+
+var FACTORY;
+FACTORY = new Function;
+
+FACTORY.prototype = undefined;
+
+var obj;
+obj={};
+
+//CHECK#1
+try {
+ obj instanceof FACTORY;
+ $ERROR('#1: O is not an object, throw a TypeError exception');
+} catch (e) {
+ if (!(e instanceof TypeError)) {
+ $ERROR('#1.1: O is not an object, throw a TypeError exception');
+ }
+}
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/expressions/instanceof/S15.3.5.3_A2_T5.js b/js/src/tests/test262/language/expressions/instanceof/S15.3.5.3_A2_T5.js
new file mode 100644
index 0000000000..4d58fd13c8
--- /dev/null
+++ b/js/src/tests/test262/language/expressions/instanceof/S15.3.5.3_A2_T5.js
@@ -0,0 +1,40 @@
+// Copyright 2009 the Sputnik authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+info: |
+ Assume F is a Function object. When the [[HasInstance]] method of
+ F is called with value V and V is an object, the following steps
+ are taken: i) Call the [[Get]] method of F with property name
+ "prototype". ii) Let O be Result(i). iii) O is not an object,
+ throw a TypeError exception
+es5id: 15.3.5.3_A2_T5
+description: F.prototype is void 0, and V is new F
+---*/
+
+var FACTORY;
+FACTORY = Function("this.prop=1;");
+
+FACTORY.prototype.name = "fairy";
+
+var instance;
+instance = new FACTORY;
+
+FACTORY.prototype = void 0;
+
+// CHECK#1
+try {
+ instance instanceof FACTORY;
+ $ERROR('#1: O is not an object, throw a TypeError exception');
+} catch (e) {
+ if (!(e instanceof TypeError)) {
+ $ERROR('#1.1: O is not an object, throw a TypeError exception');
+ }
+}
+
+// CHECK#2
+if ((instance.constructor !== FACTORY) || (instance.name !== "fairy")) {
+ $ERROR('#2: instance.constructor === FACTORY');
+}
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/expressions/instanceof/S15.3.5.3_A2_T6.js b/js/src/tests/test262/language/expressions/instanceof/S15.3.5.3_A2_T6.js
new file mode 100644
index 0000000000..b5ce4fdc53
--- /dev/null
+++ b/js/src/tests/test262/language/expressions/instanceof/S15.3.5.3_A2_T6.js
@@ -0,0 +1,31 @@
+// Copyright 2009 the Sputnik authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+info: |
+ Assume F is a Function object. When the [[HasInstance]] method of
+ F is called with value V and V is an object, the following steps
+ are taken: i) Call the [[Get]] method of F with property name
+ "prototype". ii) Let O be Result(i). iii) O is not an object,
+ throw a TypeError exception
+es5id: 15.3.5.3_A2_T6
+description: F.prototype is string, and V is function
+---*/
+
+var FACTORY;
+FACTORY = new Function;
+
+FACTORY.prototype = "error";
+
+// CHECK#1
+try {
+ ( function() {
+ }) instanceof FACTORY;
+ $ERROR('#1: O is not an object, throw a TypeError exception');
+} catch (e) {
+ if (!(e instanceof TypeError)) {
+ $ERROR('#1.1: O is not an object, throw a TypeError exception');
+ }
+}
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/expressions/instanceof/S15.3.5.3_A3_T1.js b/js/src/tests/test262/language/expressions/instanceof/S15.3.5.3_A3_T1.js
new file mode 100644
index 0000000000..10d7d7d7eb
--- /dev/null
+++ b/js/src/tests/test262/language/expressions/instanceof/S15.3.5.3_A3_T1.js
@@ -0,0 +1,30 @@
+// Copyright 2009 the Sputnik authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+info: |
+ Assume F is a Function object. When the [[HasInstance]] method of F is called with value V and V is an object, the following steps are taken:
+ i) Call the [[Get]] method of F with property name "prototype".
+ ii) Let O be Result(i) and O is an object.
+ iii) Let V be the value of the [[Prototype]] property of V.
+ iv) If V is null, return false.
+ v) If O and V refer to the same object or if they refer to objects joined to each other (13.1.2), return true.
+ vi) Go to step iii)
+es5id: 15.3.5.3_A3_T1
+description: F.prototype.type is 1, and V is new F
+---*/
+
+var FACTORY;
+FACTORY = Function("this.name=\"root\"");
+
+FACTORY.prototype.type=1;
+
+var instance;
+instance = new FACTORY;
+
+//CHECK#1
+if (!(instance instanceof FACTORY)) {
+ $ERROR('#1: If O and V refer to the same object or if they refer to objects joined to each other (13.1.2), return true');
+}
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/expressions/instanceof/S15.3.5.3_A3_T2.js b/js/src/tests/test262/language/expressions/instanceof/S15.3.5.3_A3_T2.js
new file mode 100644
index 0000000000..52182203cb
--- /dev/null
+++ b/js/src/tests/test262/language/expressions/instanceof/S15.3.5.3_A3_T2.js
@@ -0,0 +1,35 @@
+// Copyright 2009 the Sputnik authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+info: |
+ Assume F is a Function object. When the [[HasInstance]] method of F is called with value V and V is an object, the following steps are taken:
+ i) Call the [[Get]] method of F with property name "prototype".
+ ii) Let O be Result(i) and O is an object.
+ iii) Let V be the value of the [[Prototype]] property of V.
+ iv) If V is null, return false.
+ v) If O and V refer to the same object or if they refer to objects joined to each other (13.1.2), return true.
+ vi) Go to step iii)
+es5id: 15.3.5.3_A3_T2
+description: F.prototype is Object.prototype, and V is empty object
+---*/
+
+var FAKEFACTORY;
+FAKEFACTORY = Function();
+
+var fakeinstance;
+fakeinstance = {};
+
+//CHECK#1
+if (fakeinstance instanceof FAKEFACTORY) {
+ $ERROR('#1: If O and V refer to the same object or if they refer to objects joined to each other (13.1.2), return true');
+}
+
+FAKEFACTORY.prototype=Object.prototype;
+
+//CHECK#2
+if (!(fakeinstance instanceof FAKEFACTORY)) {
+ $ERROR('#2: If O and V refer to the same object or if they refer to objects joined to each other (13.1.2), return true');
+}
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/expressions/instanceof/browser.js b/js/src/tests/test262/language/expressions/instanceof/browser.js
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/js/src/tests/test262/language/expressions/instanceof/browser.js
diff --git a/js/src/tests/test262/language/expressions/instanceof/primitive-prototype-with-object.js b/js/src/tests/test262/language/expressions/instanceof/primitive-prototype-with-object.js
new file mode 100644
index 0000000000..38ee7a8be7
--- /dev/null
+++ b/js/src/tests/test262/language/expressions/instanceof/primitive-prototype-with-object.js
@@ -0,0 +1,34 @@
+// Copyright (C) 2015 André Bargull. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+es6id: 12.9.3
+description: >
+ Throws a TypeError if `prototype` property is not an Object.
+info: |
+ 12.9.3 Runtime Semantics: Evaluation
+ RelationalExpression : RelationalExpression instanceof ShiftExpression
+ ...
+ 7. Return InstanceofOperator(lval, rval).
+
+ 12.9.4 Runtime Semantics: InstanceofOperator(O, C)
+ ...
+ 6. Return OrdinaryHasInstance(C, O).
+
+ 7.3.19 OrdinaryHasInstance
+ ...
+ 3. If Type(O) is not Object, return false.
+ 4. Let P be Get(C, "prototype").
+ 5. ReturnIfAbrupt(P).
+ 6. If Type(P) is not Object, throw a TypeError exception.
+ ...
+---*/
+
+// Check with primitive "prototype" property on non-constructor function.
+Function.prototype.prototype = "";
+
+assert.throws(TypeError, function() {
+ [] instanceof Function.prototype;
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/expressions/instanceof/primitive-prototype-with-primitive.js b/js/src/tests/test262/language/expressions/instanceof/primitive-prototype-with-primitive.js
new file mode 100644
index 0000000000..53ca25f50a
--- /dev/null
+++ b/js/src/tests/test262/language/expressions/instanceof/primitive-prototype-with-primitive.js
@@ -0,0 +1,31 @@
+// Copyright (C) 2015 André Bargull. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+es6id: 12.9.3
+description: >
+ Does not throw a TypeError if left-hand side expression and `prototype` property are both primitive values.
+info: |
+ 12.9.3 Runtime Semantics: Evaluation
+ RelationalExpression : RelationalExpression instanceof ShiftExpression
+ ...
+ 7. Return InstanceofOperator(lval, rval).
+
+ 12.9.4 Runtime Semantics: InstanceofOperator(O, C)
+ ...
+ 6. Return OrdinaryHasInstance(C, O).
+
+ 7.3.19 OrdinaryHasInstance
+ ...
+ 3. If Type(O) is not Object, return false.
+ ...
+---*/
+
+// Check with primitive "prototype" property on non-constructor function.
+Function.prototype.prototype = true;
+
+var result = 0 instanceof Function.prototype;
+
+assert.sameValue(result, false);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/expressions/instanceof/prototype-getter-with-object-throws.js b/js/src/tests/test262/language/expressions/instanceof/prototype-getter-with-object-throws.js
new file mode 100644
index 0000000000..a7100ae431
--- /dev/null
+++ b/js/src/tests/test262/language/expressions/instanceof/prototype-getter-with-object-throws.js
@@ -0,0 +1,44 @@
+// Copyright (C) 2015 André Bargull. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+es6id: 12.9.3
+description: >
+ "prototype" property is retrieved when left-hand side expression in `instanceof` is object.
+info: |
+ 12.9.3 Runtime Semantics: Evaluation
+ RelationalExpression : RelationalExpression instanceof ShiftExpression
+ ...
+ 7. Return InstanceofOperator(lval, rval).
+
+ 12.9.4 Runtime Semantics: InstanceofOperator(O, C)
+ ...
+ 6. Return OrdinaryHasInstance(C, O).
+
+ 7.3.19 OrdinaryHasInstance
+ ...
+ 3. If Type(O) is not Object, return false.
+ 4. Let P be Get(C, "prototype").
+ 5. ReturnIfAbrupt(P).
+ ...
+---*/
+
+var getterCalled = false;
+
+function DummyError() { }
+
+// The "prototype" property for constructor functions is a non-configurable data-property,
+// therefore we need to use a non-constructor function to install the getter.
+Object.defineProperty(Function.prototype, "prototype", {
+ get: function() {
+ assert.sameValue(getterCalled, false, "'prototype' getter called once");
+ getterCalled = true;
+ throw new DummyError();
+ }
+});
+
+assert.throws(DummyError, function() {
+ [] instanceof Function.prototype;
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/expressions/instanceof/prototype-getter-with-object.js b/js/src/tests/test262/language/expressions/instanceof/prototype-getter-with-object.js
new file mode 100644
index 0000000000..a26c3e67f6
--- /dev/null
+++ b/js/src/tests/test262/language/expressions/instanceof/prototype-getter-with-object.js
@@ -0,0 +1,49 @@
+// Copyright (C) 2015 André Bargull. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+es6id: 12.9.3
+description: >
+ "prototype" property is retrieved when left-hand side expression in `instanceof` is object.
+info: |
+ 12.9.3 Runtime Semantics: Evaluation
+ RelationalExpression : RelationalExpression instanceof ShiftExpression
+ ...
+ 7. Return InstanceofOperator(lval, rval).
+
+ 12.9.4 Runtime Semantics: InstanceofOperator(O, C)
+ ...
+ 6. Return OrdinaryHasInstance(C, O).
+
+ 7.3.19 OrdinaryHasInstance
+ ...
+ 3. If Type(O) is not Object, return false.
+ 4. Let P be Get(C, "prototype").
+ 5. ReturnIfAbrupt(P).
+ 6. If Type(P) is not Object, throw a TypeError exception.
+ 7. Repeat
+ a. Let O be O.[[GetPrototypeOf]]().
+ b. ReturnIfAbrupt(O).
+ c. If O is null, return false.
+ d. If SameValue(P, O) is true, return true.
+ ...
+---*/
+
+var getterCalled = false;
+
+// The "prototype" property for constructor functions is a non-configurable data-property,
+// therefore we need to use a non-constructor function to install the getter.
+Object.defineProperty(Function.prototype, "prototype", {
+ get: function() {
+ assert.sameValue(getterCalled, false, "'prototype' getter called once");
+ getterCalled = true;
+ return Array.prototype;
+ }
+});
+
+var result = [] instanceof Function.prototype;
+
+assert(result, "[] should be instance of Function.prototype");
+assert(getterCalled, "'prototype' getter called");
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/expressions/instanceof/prototype-getter-with-primitive.js b/js/src/tests/test262/language/expressions/instanceof/prototype-getter-with-primitive.js
new file mode 100644
index 0000000000..7e8a13b74d
--- /dev/null
+++ b/js/src/tests/test262/language/expressions/instanceof/prototype-getter-with-primitive.js
@@ -0,0 +1,36 @@
+// Copyright (C) 2015 André Bargull. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+es6id: 12.9.3
+description: >
+ "prototype" property is not retrieved when left-hand side expression in `instanceof` is primitive.
+info: |
+ 12.9.3 Runtime Semantics: Evaluation
+ RelationalExpression : RelationalExpression instanceof ShiftExpression
+ ...
+ 7. Return InstanceofOperator(lval, rval).
+
+ 12.9.4 Runtime Semantics: InstanceofOperator(O, C)
+ ...
+ 6. Return OrdinaryHasInstance(C, O).
+
+ 7.3.19 OrdinaryHasInstance
+ ...
+ 3. If Type(O) is not Object, return false.
+ ...
+---*/
+
+// The "prototype" property for constructor functions is a non-configurable data-property,
+// therefore we need to use a non-constructor function to install the getter.
+Object.defineProperty(Function.prototype, "prototype", {
+ get: function() {
+ $ERROR("getter for 'prototype' called");
+ }
+});
+
+var result = 0 instanceof Function.prototype;
+
+assert.sameValue(result, false);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/expressions/instanceof/shell.js b/js/src/tests/test262/language/expressions/instanceof/shell.js
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/js/src/tests/test262/language/expressions/instanceof/shell.js
diff --git a/js/src/tests/test262/language/expressions/instanceof/symbol-hasinstance-get-err.js b/js/src/tests/test262/language/expressions/instanceof/symbol-hasinstance-get-err.js
new file mode 100644
index 0000000000..e562e9c4ff
--- /dev/null
+++ b/js/src/tests/test262/language/expressions/instanceof/symbol-hasinstance-get-err.js
@@ -0,0 +1,26 @@
+// Copyright (C) 2015 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+es6id: 12.9.4
+description: Error thrown when accessing constructor's @@hasInstance property
+info: |
+ 1. If Type(C) is not Object, throw a TypeError exception.
+ 2. Let instOfHandler be GetMethod(C,@@hasInstance).
+ 3. ReturnIfAbrupt(instOfHandler).
+features: [Symbol.hasInstance]
+---*/
+
+var F = {};
+
+Object.defineProperty(F, Symbol.hasInstance, {
+ get: function() {
+ throw new Test262Error();
+ }
+});
+
+assert.throws(Test262Error, function() {
+ 0 instanceof F;
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/expressions/instanceof/symbol-hasinstance-invocation.js b/js/src/tests/test262/language/expressions/instanceof/symbol-hasinstance-invocation.js
new file mode 100644
index 0000000000..bc0a56e9c1
--- /dev/null
+++ b/js/src/tests/test262/language/expressions/instanceof/symbol-hasinstance-invocation.js
@@ -0,0 +1,34 @@
+// Copyright (C) 2015 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+es6id: 12.9.4
+description: >
+ Arguments and 'this' value when invoking constructor's @@hasInstance property
+info: |
+ 1. If Type(C) is not Object, throw a TypeError exception.
+ 2. Let instOfHandler be GetMethod(C,@@hasInstance).
+ 3. ReturnIfAbrupt(instOfHandler).
+ 4. If instOfHandler is not undefined, then
+ a. Return ToBoolean(Call(instOfHandler, C, «O»)).
+features: [Symbol.hasInstance]
+---*/
+
+var F = {};
+var callCount = 0;
+var thisValue, args;
+
+F[Symbol.hasInstance] = function() {
+ thisValue = this;
+ args = arguments;
+ callCount += 1;
+};
+
+0 instanceof F;
+
+assert.sameValue(callCount, 1);
+assert.sameValue(thisValue, F);
+assert.sameValue(args.length, 1);
+assert.sameValue(args[0], 0);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/expressions/instanceof/symbol-hasinstance-not-callable.js b/js/src/tests/test262/language/expressions/instanceof/symbol-hasinstance-not-callable.js
new file mode 100644
index 0000000000..4059b662c1
--- /dev/null
+++ b/js/src/tests/test262/language/expressions/instanceof/symbol-hasinstance-not-callable.js
@@ -0,0 +1,26 @@
+// Copyright (C) 2015 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+es6id: 12.9.4
+description: >
+ Error thrown when constructor's @@hasInstance property is defined but not callable
+info: |
+ 1. If Type(C) is not Object, throw a TypeError exception.
+ 2. Let instOfHandler be GetMethod(C,@@hasInstance).
+ 3. ReturnIfAbrupt(instOfHandler).
+ 4. If instOfHandler is not undefined, then
+ a. Return ToBoolean(Call(instOfHandler, C, «O»)).
+ 5. If IsCallable(C) is false, throw a TypeError exception.
+features: [Symbol.hasInstance]
+---*/
+
+var F = {};
+
+F[Symbol.hasInstance] = null;
+
+assert.throws(TypeError, function() {
+ 0 instanceof F;
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/expressions/instanceof/symbol-hasinstance-to-boolean.js b/js/src/tests/test262/language/expressions/instanceof/symbol-hasinstance-to-boolean.js
new file mode 100644
index 0000000000..195ac80ad1
--- /dev/null
+++ b/js/src/tests/test262/language/expressions/instanceof/symbol-hasinstance-to-boolean.js
@@ -0,0 +1,46 @@
+// Copyright (C) 2015 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+es6id: 12.9.4
+description: >
+ Type coercion of value returned by constructor's @@hasInstance property
+info: |
+ 1. If Type(C) is not Object, throw a TypeError exception.
+ 2. Let instOfHandler be GetMethod(C,@@hasInstance).
+ 3. ReturnIfAbrupt(instOfHandler).
+ 4. If instOfHandler is not undefined, then
+ a. Return ToBoolean(Call(instOfHandler, C, «O»)).
+features: [Symbol, Symbol.hasInstance]
+---*/
+
+var F = {};
+
+F[Symbol.hasInstance] = function() { return undefined; };
+assert.sameValue(0 instanceof F, false);
+
+F[Symbol.hasInstance] = function() { return null; };
+assert.sameValue(0 instanceof F, false);
+
+F[Symbol.hasInstance] = function() { return true; };
+assert.sameValue(0 instanceof F, true);
+
+F[Symbol.hasInstance] = function() { return NaN; };
+assert.sameValue(0 instanceof F, false);
+
+F[Symbol.hasInstance] = function() { return 1; };
+assert.sameValue(0 instanceof F, true);
+
+F[Symbol.hasInstance] = function() { return ''; };
+assert.sameValue(0 instanceof F, false);
+
+F[Symbol.hasInstance] = function() { return 'string'; };
+assert.sameValue(0 instanceof F, true);
+
+F[Symbol.hasInstance] = function() { return Symbol(); };
+assert.sameValue(0 instanceof F, true);
+
+F[Symbol.hasInstance] = function() { return {}; };
+assert.sameValue(0 instanceof F, true);
+
+reportCompare(0, 0);