summaryrefslogtreecommitdiffstats
path: root/js/src/tests/test262/built-ins/Function/prototype/bind
diff options
context:
space:
mode:
Diffstat (limited to 'js/src/tests/test262/built-ins/Function/prototype/bind')
-rw-r--r--js/src/tests/test262/built-ins/Function/prototype/bind/15.3.4.5-0-1.js13
-rw-r--r--js/src/tests/test262/built-ins/Function/prototype/bind/15.3.4.5-10-1.js17
-rw-r--r--js/src/tests/test262/built-ins/Function/prototype/bind/15.3.4.5-11-1.js18
-rw-r--r--js/src/tests/test262/built-ins/Function/prototype/bind/15.3.4.5-16-1.js17
-rw-r--r--js/src/tests/test262/built-ins/Function/prototype/bind/15.3.4.5-16-2.js17
-rw-r--r--js/src/tests/test262/built-ins/Function/prototype/bind/15.3.4.5-2-1.js22
-rw-r--r--js/src/tests/test262/built-ins/Function/prototype/bind/15.3.4.5-2-10.js14
-rw-r--r--js/src/tests/test262/built-ins/Function/prototype/bind/15.3.4.5-2-11.js14
-rw-r--r--js/src/tests/test262/built-ins/Function/prototype/bind/15.3.4.5-2-12.js14
-rw-r--r--js/src/tests/test262/built-ins/Function/prototype/bind/15.3.4.5-2-13.js14
-rw-r--r--js/src/tests/test262/built-ins/Function/prototype/bind/15.3.4.5-2-14.js14
-rw-r--r--js/src/tests/test262/built-ins/Function/prototype/bind/15.3.4.5-2-15.js16
-rw-r--r--js/src/tests/test262/built-ins/Function/prototype/bind/15.3.4.5-2-16.js13
-rw-r--r--js/src/tests/test262/built-ins/Function/prototype/bind/15.3.4.5-2-2.js22
-rw-r--r--js/src/tests/test262/built-ins/Function/prototype/bind/15.3.4.5-2-3.js17
-rw-r--r--js/src/tests/test262/built-ins/Function/prototype/bind/15.3.4.5-2-4.js17
-rw-r--r--js/src/tests/test262/built-ins/Function/prototype/bind/15.3.4.5-2-5.js17
-rw-r--r--js/src/tests/test262/built-ins/Function/prototype/bind/15.3.4.5-2-6.js17
-rw-r--r--js/src/tests/test262/built-ins/Function/prototype/bind/15.3.4.5-2-7.js19
-rw-r--r--js/src/tests/test262/built-ins/Function/prototype/bind/15.3.4.5-2-8.js21
-rw-r--r--js/src/tests/test262/built-ins/Function/prototype/bind/15.3.4.5-2-9.js14
-rw-r--r--js/src/tests/test262/built-ins/Function/prototype/bind/15.3.4.5-20-2.js18
-rw-r--r--js/src/tests/test262/built-ins/Function/prototype/bind/15.3.4.5-20-3.js17
-rw-r--r--js/src/tests/test262/built-ins/Function/prototype/bind/15.3.4.5-21-2.js18
-rw-r--r--js/src/tests/test262/built-ins/Function/prototype/bind/15.3.4.5-21-3.js17
-rw-r--r--js/src/tests/test262/built-ins/Function/prototype/bind/15.3.4.5-3-1.js18
-rw-r--r--js/src/tests/test262/built-ins/Function/prototype/bind/15.3.4.5-6-1.js16
-rw-r--r--js/src/tests/test262/built-ins/Function/prototype/bind/15.3.4.5-6-10.js28
-rw-r--r--js/src/tests/test262/built-ins/Function/prototype/bind/15.3.4.5-6-11.js22
-rw-r--r--js/src/tests/test262/built-ins/Function/prototype/bind/15.3.4.5-6-12.js15
-rw-r--r--js/src/tests/test262/built-ins/Function/prototype/bind/15.3.4.5-6-2.js17
-rw-r--r--js/src/tests/test262/built-ins/Function/prototype/bind/15.3.4.5-6-3.js20
-rw-r--r--js/src/tests/test262/built-ins/Function/prototype/bind/15.3.4.5-6-4.js28
-rw-r--r--js/src/tests/test262/built-ins/Function/prototype/bind/15.3.4.5-6-5.js20
-rw-r--r--js/src/tests/test262/built-ins/Function/prototype/bind/15.3.4.5-6-6.js22
-rw-r--r--js/src/tests/test262/built-ins/Function/prototype/bind/15.3.4.5-6-7.js24
-rw-r--r--js/src/tests/test262/built-ins/Function/prototype/bind/15.3.4.5-6-8.js30
-rw-r--r--js/src/tests/test262/built-ins/Function/prototype/bind/15.3.4.5-6-9.js21
-rw-r--r--js/src/tests/test262/built-ins/Function/prototype/bind/15.3.4.5-8-1.js16
-rw-r--r--js/src/tests/test262/built-ins/Function/prototype/bind/15.3.4.5-8-2.js19
-rw-r--r--js/src/tests/test262/built-ins/Function/prototype/bind/15.3.4.5-9-1.js16
-rw-r--r--js/src/tests/test262/built-ins/Function/prototype/bind/15.3.4.5-9-2.js18
-rw-r--r--js/src/tests/test262/built-ins/Function/prototype/bind/15.3.4.5.1-4-1.js20
-rw-r--r--js/src/tests/test262/built-ins/Function/prototype/bind/15.3.4.5.1-4-10.js23
-rw-r--r--js/src/tests/test262/built-ins/Function/prototype/bind/15.3.4.5.1-4-11.js23
-rw-r--r--js/src/tests/test262/built-ins/Function/prototype/bind/15.3.4.5.1-4-12.js24
-rw-r--r--js/src/tests/test262/built-ins/Function/prototype/bind/15.3.4.5.1-4-13.js24
-rw-r--r--js/src/tests/test262/built-ins/Function/prototype/bind/15.3.4.5.1-4-14.js24
-rw-r--r--js/src/tests/test262/built-ins/Function/prototype/bind/15.3.4.5.1-4-15.js24
-rw-r--r--js/src/tests/test262/built-ins/Function/prototype/bind/15.3.4.5.1-4-2.js24
-rw-r--r--js/src/tests/test262/built-ins/Function/prototype/bind/15.3.4.5.1-4-3.js20
-rw-r--r--js/src/tests/test262/built-ins/Function/prototype/bind/15.3.4.5.1-4-4.js20
-rw-r--r--js/src/tests/test262/built-ins/Function/prototype/bind/15.3.4.5.1-4-5.js20
-rw-r--r--js/src/tests/test262/built-ins/Function/prototype/bind/15.3.4.5.1-4-6.js23
-rw-r--r--js/src/tests/test262/built-ins/Function/prototype/bind/15.3.4.5.1-4-7.js23
-rw-r--r--js/src/tests/test262/built-ins/Function/prototype/bind/15.3.4.5.1-4-8.js23
-rw-r--r--js/src/tests/test262/built-ins/Function/prototype/bind/15.3.4.5.1-4-9.js23
-rw-r--r--js/src/tests/test262/built-ins/Function/prototype/bind/15.3.4.5.2-4-1.js28
-rw-r--r--js/src/tests/test262/built-ins/Function/prototype/bind/15.3.4.5.2-4-10.js21
-rw-r--r--js/src/tests/test262/built-ins/Function/prototype/bind/15.3.4.5.2-4-11.js21
-rw-r--r--js/src/tests/test262/built-ins/Function/prototype/bind/15.3.4.5.2-4-12.js21
-rw-r--r--js/src/tests/test262/built-ins/Function/prototype/bind/15.3.4.5.2-4-13.js21
-rw-r--r--js/src/tests/test262/built-ins/Function/prototype/bind/15.3.4.5.2-4-14.js21
-rw-r--r--js/src/tests/test262/built-ins/Function/prototype/bind/15.3.4.5.2-4-2.js28
-rw-r--r--js/src/tests/test262/built-ins/Function/prototype/bind/15.3.4.5.2-4-3.js22
-rw-r--r--js/src/tests/test262/built-ins/Function/prototype/bind/15.3.4.5.2-4-4.js22
-rw-r--r--js/src/tests/test262/built-ins/Function/prototype/bind/15.3.4.5.2-4-5.js27
-rw-r--r--js/src/tests/test262/built-ins/Function/prototype/bind/15.3.4.5.2-4-6.js21
-rw-r--r--js/src/tests/test262/built-ins/Function/prototype/bind/15.3.4.5.2-4-7.js21
-rw-r--r--js/src/tests/test262/built-ins/Function/prototype/bind/15.3.4.5.2-4-8.js21
-rw-r--r--js/src/tests/test262/built-ins/Function/prototype/bind/15.3.4.5.2-4-9.js21
-rw-r--r--js/src/tests/test262/built-ins/Function/prototype/bind/BoundFunction_restricted-properties.js34
-rw-r--r--js/src/tests/test262/built-ins/Function/prototype/bind/S15.3.4.5_A1.js23
-rw-r--r--js/src/tests/test262/built-ins/Function/prototype/bind/S15.3.4.5_A13.js13
-rw-r--r--js/src/tests/test262/built-ins/Function/prototype/bind/S15.3.4.5_A14.js13
-rw-r--r--js/src/tests/test262/built-ins/Function/prototype/bind/S15.3.4.5_A15.js13
-rw-r--r--js/src/tests/test262/built-ins/Function/prototype/bind/S15.3.4.5_A16.js26
-rw-r--r--js/src/tests/test262/built-ins/Function/prototype/bind/S15.3.4.5_A2.js23
-rw-r--r--js/src/tests/test262/built-ins/Function/prototype/bind/S15.3.4.5_A3.js13
-rw-r--r--js/src/tests/test262/built-ins/Function/prototype/bind/S15.3.4.5_A4.js19
-rw-r--r--js/src/tests/test262/built-ins/Function/prototype/bind/S15.3.4.5_A5.js23
-rw-r--r--js/src/tests/test262/built-ins/Function/prototype/bind/browser.js0
-rw-r--r--js/src/tests/test262/built-ins/Function/prototype/bind/get-fn-realm-recursive.js55
-rw-r--r--js/src/tests/test262/built-ins/Function/prototype/bind/get-fn-realm.js57
-rw-r--r--js/src/tests/test262/built-ins/Function/prototype/bind/instance-construct-newtarget-boundtarget-bound.js29
-rw-r--r--js/src/tests/test262/built-ins/Function/prototype/bind/instance-construct-newtarget-boundtarget.js28
-rw-r--r--js/src/tests/test262/built-ins/Function/prototype/bind/instance-construct-newtarget-self-new.js27
-rw-r--r--js/src/tests/test262/built-ins/Function/prototype/bind/instance-construct-newtarget-self-reflect.js28
-rw-r--r--js/src/tests/test262/built-ins/Function/prototype/bind/instance-length-default-value.js54
-rw-r--r--js/src/tests/test262/built-ins/Function/prototype/bind/instance-length-exceeds-int32.js31
-rw-r--r--js/src/tests/test262/built-ins/Function/prototype/bind/instance-length-prop-desc.js32
-rw-r--r--js/src/tests/test262/built-ins/Function/prototype/bind/instance-length-remaining-args.js37
-rw-r--r--js/src/tests/test262/built-ins/Function/prototype/bind/instance-length-tointeger.js59
-rw-r--r--js/src/tests/test262/built-ins/Function/prototype/bind/instance-name-chained.js25
-rw-r--r--js/src/tests/test262/built-ins/Function/prototype/bind/instance-name-error.js22
-rw-r--r--js/src/tests/test262/built-ins/Function/prototype/bind/instance-name-non-string.js73
-rw-r--r--js/src/tests/test262/built-ins/Function/prototype/bind/instance-name.js24
-rw-r--r--js/src/tests/test262/built-ins/Function/prototype/bind/length.js31
-rw-r--r--js/src/tests/test262/built-ins/Function/prototype/bind/name.js28
-rw-r--r--js/src/tests/test262/built-ins/Function/prototype/bind/not-a-constructor.js35
-rw-r--r--js/src/tests/test262/built-ins/Function/prototype/bind/proto-from-ctor-realm.js31
-rw-r--r--js/src/tests/test262/built-ins/Function/prototype/bind/shell.js0
102 files changed, 2327 insertions, 0 deletions
diff --git a/js/src/tests/test262/built-ins/Function/prototype/bind/15.3.4.5-0-1.js b/js/src/tests/test262/built-ins/Function/prototype/bind/15.3.4.5-0-1.js
new file mode 100644
index 0000000000..77a2101355
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Function/prototype/bind/15.3.4.5-0-1.js
@@ -0,0 +1,13 @@
+// Copyright (c) 2012 Ecma International. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+es5id: 15.3.4.5-0-1
+description: Function.prototype.bind must exist as a function
+---*/
+
+var f = Function.prototype.bind;
+
+assert.sameValue(typeof(f), "function", 'typeof(f)');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Function/prototype/bind/15.3.4.5-10-1.js b/js/src/tests/test262/built-ins/Function/prototype/bind/15.3.4.5-10-1.js
new file mode 100644
index 0000000000..7eed3c3a05
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Function/prototype/bind/15.3.4.5-10-1.js
@@ -0,0 +1,17 @@
+// Copyright (c) 2012 Ecma International. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+es5id: 15.3.4.5-10-1
+description: >
+ Function.prototype.bind - internal property [[Class]] of 'F' is
+ set as Function
+---*/
+
+var foo = function() {};
+
+var obj = foo.bind({});
+
+assert.sameValue(Object.prototype.toString.call(obj), "[object Function]", 'Object.prototype.toString.call(obj)');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Function/prototype/bind/15.3.4.5-11-1.js b/js/src/tests/test262/built-ins/Function/prototype/bind/15.3.4.5-11-1.js
new file mode 100644
index 0000000000..3f90d562e1
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Function/prototype/bind/15.3.4.5-11-1.js
@@ -0,0 +1,18 @@
+// Copyright (c) 2012 Ecma International. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+es5id: 15.3.4.5-11-1
+description: >
+ Function.prototype.bind - internal property [[Prototype]] of 'F'
+ is set as Function.prototype
+---*/
+
+var foo = function() {};
+
+Function.prototype.property = 12;
+var obj = foo.bind({});
+
+assert.sameValue(obj.property, 12, 'obj.property');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Function/prototype/bind/15.3.4.5-16-1.js b/js/src/tests/test262/built-ins/Function/prototype/bind/15.3.4.5-16-1.js
new file mode 100644
index 0000000000..c4ce5ddf31
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Function/prototype/bind/15.3.4.5-16-1.js
@@ -0,0 +1,17 @@
+// Copyright (c) 2012 Ecma International. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+es5id: 15.3.4.5-16-1
+description: Function.prototype.bind, [[Extensible]] of the bound fn is true
+---*/
+
+function foo() {}
+var o = {};
+
+var bf = foo.bind(o);
+var ex = Object.isExtensible(bf);
+
+assert.sameValue(ex, true, 'ex');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Function/prototype/bind/15.3.4.5-16-2.js b/js/src/tests/test262/built-ins/Function/prototype/bind/15.3.4.5-16-2.js
new file mode 100644
index 0000000000..a892cffb99
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Function/prototype/bind/15.3.4.5-16-2.js
@@ -0,0 +1,17 @@
+// Copyright (c) 2012 Ecma International. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+es5id: 15.3.4.5-16-2
+description: >
+ Function.prototype.bind - The [[Extensible]] attribute of internal
+ property in F set as true
+---*/
+
+function foo() {}
+var obj = foo.bind({});
+obj.property = 12;
+
+assert(obj.hasOwnProperty("property"), 'obj.hasOwnProperty("property") !== true');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Function/prototype/bind/15.3.4.5-2-1.js b/js/src/tests/test262/built-ins/Function/prototype/bind/15.3.4.5-2-1.js
new file mode 100644
index 0000000000..a8792e57ee
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Function/prototype/bind/15.3.4.5-2-1.js
@@ -0,0 +1,22 @@
+// Copyright (c) 2012 Ecma International. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+info: |
+ 15.3.4.5 step 2 specifies that a TypeError must be thrown if the Target
+ is not callable.
+es5id: 15.3.4.5-2-1
+description: >
+ Function.prototype.bind throws TypeError if the Target is not
+ callable (but an instance of Function)
+---*/
+
+foo.prototype = Function.prototype;
+// dummy function
+function foo() {}
+var f = new foo();
+assert.throws(TypeError, function() {
+ f.bind();
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Function/prototype/bind/15.3.4.5-2-10.js b/js/src/tests/test262/built-ins/Function/prototype/bind/15.3.4.5-2-10.js
new file mode 100644
index 0000000000..250b4e706b
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Function/prototype/bind/15.3.4.5-2-10.js
@@ -0,0 +1,14 @@
+// Copyright (c) 2012 Ecma International. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+es5id: 15.3.4.5-2-10
+description: Function.prototype.bind throws TypeError if 'Target' is undefined
+---*/
+
+
+assert.throws(TypeError, function() {
+ Function.prototype.bind.call(undefined);
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Function/prototype/bind/15.3.4.5-2-11.js b/js/src/tests/test262/built-ins/Function/prototype/bind/15.3.4.5-2-11.js
new file mode 100644
index 0000000000..6c968fef9a
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Function/prototype/bind/15.3.4.5-2-11.js
@@ -0,0 +1,14 @@
+// Copyright (c) 2012 Ecma International. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+es5id: 15.3.4.5-2-11
+description: Function.prototype.bind throws TypeError if 'Target' is NULL
+---*/
+
+
+assert.throws(TypeError, function() {
+ Function.prototype.bind.call(null);
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Function/prototype/bind/15.3.4.5-2-12.js b/js/src/tests/test262/built-ins/Function/prototype/bind/15.3.4.5-2-12.js
new file mode 100644
index 0000000000..a434514b6c
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Function/prototype/bind/15.3.4.5-2-12.js
@@ -0,0 +1,14 @@
+// Copyright (c) 2012 Ecma International. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+es5id: 15.3.4.5-2-12
+description: Function.prototype.bind throws TypeError if 'Target' is a boolean
+---*/
+
+
+assert.throws(TypeError, function() {
+ Function.prototype.bind.call(true);
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Function/prototype/bind/15.3.4.5-2-13.js b/js/src/tests/test262/built-ins/Function/prototype/bind/15.3.4.5-2-13.js
new file mode 100644
index 0000000000..7964b8f420
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Function/prototype/bind/15.3.4.5-2-13.js
@@ -0,0 +1,14 @@
+// Copyright (c) 2012 Ecma International. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+es5id: 15.3.4.5-2-13
+description: Function.prototype.bind throws TypeError if 'Target' is a number
+---*/
+
+
+assert.throws(TypeError, function() {
+ Function.prototype.bind.call(5);
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Function/prototype/bind/15.3.4.5-2-14.js b/js/src/tests/test262/built-ins/Function/prototype/bind/15.3.4.5-2-14.js
new file mode 100644
index 0000000000..2a33a40781
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Function/prototype/bind/15.3.4.5-2-14.js
@@ -0,0 +1,14 @@
+// Copyright (c) 2012 Ecma International. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+es5id: 15.3.4.5-2-14
+description: Function.prototype.bind throws TypeError if 'Target' is a string
+---*/
+
+
+assert.throws(TypeError, function() {
+ Function.prototype.bind.call("abc");
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Function/prototype/bind/15.3.4.5-2-15.js b/js/src/tests/test262/built-ins/Function/prototype/bind/15.3.4.5-2-15.js
new file mode 100644
index 0000000000..374132951a
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Function/prototype/bind/15.3.4.5-2-15.js
@@ -0,0 +1,16 @@
+// Copyright (c) 2012 Ecma International. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+es5id: 15.3.4.5-2-15
+description: >
+ Function.prototype.bind throws TypeError if 'Target' is Object
+ without Call internal method
+---*/
+
+
+assert.throws(TypeError, function() {
+ Function.prototype.bind.call({});
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Function/prototype/bind/15.3.4.5-2-16.js b/js/src/tests/test262/built-ins/Function/prototype/bind/15.3.4.5-2-16.js
new file mode 100644
index 0000000000..7f6e46fd1f
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Function/prototype/bind/15.3.4.5-2-16.js
@@ -0,0 +1,13 @@
+// Copyright (c) 2012 Ecma International. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+es5id: 15.3.4.5-2-16
+description: Function.prototype.bind - 'Target' is a function
+---*/
+
+function testFunc() {}
+
+testFunc.bind();
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Function/prototype/bind/15.3.4.5-2-2.js b/js/src/tests/test262/built-ins/Function/prototype/bind/15.3.4.5-2-2.js
new file mode 100644
index 0000000000..4d906863eb
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Function/prototype/bind/15.3.4.5-2-2.js
@@ -0,0 +1,22 @@
+// Copyright (c) 2012 Ecma International. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+info: |
+ 15.3.4.5 step 2 specifies that a TypeError must be thrown if the Target
+ is not callable.
+es5id: 15.3.4.5-2-2
+description: >
+ Function.prototype.bind throws TypeError if the Target is not
+ callable (bind attached to object)
+---*/
+
+// dummy function
+function foo() {}
+var f = new foo();
+f.bind = Function.prototype.bind;
+assert.throws(TypeError, function() {
+ f.bind();
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Function/prototype/bind/15.3.4.5-2-3.js b/js/src/tests/test262/built-ins/Function/prototype/bind/15.3.4.5-2-3.js
new file mode 100644
index 0000000000..acca26ac3c
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Function/prototype/bind/15.3.4.5-2-3.js
@@ -0,0 +1,17 @@
+// Copyright (c) 2012 Ecma International. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+info: |
+ 15.3.4.5 step 2 specifies that a TypeError must be thrown if the Target
+ is not callable.
+es5id: 15.3.4.5-2-3
+description: Function.prototype.bind allows Target to be a constructor (Number)
+---*/
+
+var bnc = Number.bind(null);
+var n = bnc(42);
+
+assert.sameValue(n, 42, 'n');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Function/prototype/bind/15.3.4.5-2-4.js b/js/src/tests/test262/built-ins/Function/prototype/bind/15.3.4.5-2-4.js
new file mode 100644
index 0000000000..4ff827b4d0
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Function/prototype/bind/15.3.4.5-2-4.js
@@ -0,0 +1,17 @@
+// Copyright (c) 2012 Ecma International. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+info: |
+ 15.3.4.5 step 2 specifies that a TypeError must be thrown if the Target
+ is not callable.
+es5id: 15.3.4.5-2-4
+description: Function.prototype.bind allows Target to be a constructor (String)
+---*/
+
+var bsc = String.bind(null);
+var s = bsc("hello world");
+
+assert.sameValue(s, "hello world", 's');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Function/prototype/bind/15.3.4.5-2-5.js b/js/src/tests/test262/built-ins/Function/prototype/bind/15.3.4.5-2-5.js
new file mode 100644
index 0000000000..5620009908
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Function/prototype/bind/15.3.4.5-2-5.js
@@ -0,0 +1,17 @@
+// Copyright (c) 2012 Ecma International. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+info: |
+ 15.3.4.5 step 2 specifies that a TypeError must be thrown if the Target
+ is not callable.
+es5id: 15.3.4.5-2-5
+description: Function.prototype.bind allows Target to be a constructor (Boolean)
+---*/
+
+var bbc = Boolean.bind(null);
+var b = bbc(true);
+
+assert.sameValue(b, true, 'b');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Function/prototype/bind/15.3.4.5-2-6.js b/js/src/tests/test262/built-ins/Function/prototype/bind/15.3.4.5-2-6.js
new file mode 100644
index 0000000000..3bd6d59fe8
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Function/prototype/bind/15.3.4.5-2-6.js
@@ -0,0 +1,17 @@
+// Copyright (c) 2012 Ecma International. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+info: |
+ 15.3.4.5 step 2 specifies that a TypeError must be thrown if the Target
+ is not callable.
+es5id: 15.3.4.5-2-6
+description: Function.prototype.bind allows Target to be a constructor (Object)
+---*/
+
+var boc = Object.bind(null);
+var o = boc(42);
+
+assert((o == 42), '(o == 42) !== true');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Function/prototype/bind/15.3.4.5-2-7.js b/js/src/tests/test262/built-ins/Function/prototype/bind/15.3.4.5-2-7.js
new file mode 100644
index 0000000000..822954ff52
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Function/prototype/bind/15.3.4.5-2-7.js
@@ -0,0 +1,19 @@
+// Copyright (c) 2012 Ecma International. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+info: |
+ 15.3.4.5 step 2 specifies that a TypeError must be thrown if the Target
+ is not callable.
+es5id: 15.3.4.5-2-7
+description: >
+ Function.prototype.bind throws TypeError if the Target is not
+ callable (JSON)
+---*/
+
+
+assert.throws(TypeError, function() {
+ JSON.bind();
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Function/prototype/bind/15.3.4.5-2-8.js b/js/src/tests/test262/built-ins/Function/prototype/bind/15.3.4.5-2-8.js
new file mode 100644
index 0000000000..740c893c3b
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Function/prototype/bind/15.3.4.5-2-8.js
@@ -0,0 +1,21 @@
+// Copyright (c) 2012 Ecma International. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+info: |
+ 15.3.4.5 step 2 specifies that a TypeError must be thrown if the Target
+ is not callable.
+es5id: 15.3.4.5-2-8
+description: Function.prototype.bind allows Target to be a constructor (Array)
+---*/
+
+var bac = Array.bind(null);
+var a = bac(42);
+a.prop = "verifyPropertyExist";
+a[41] = 41;
+
+assert.sameValue(a.prop, "verifyPropertyExist", 'a.prop');
+assert.sameValue(a[41], 41, 'a[41]');
+assert.sameValue(a.length, 42, 'a.length');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Function/prototype/bind/15.3.4.5-2-9.js b/js/src/tests/test262/built-ins/Function/prototype/bind/15.3.4.5-2-9.js
new file mode 100644
index 0000000000..1707ab3ce6
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Function/prototype/bind/15.3.4.5-2-9.js
@@ -0,0 +1,14 @@
+// Copyright (c) 2012 Ecma International. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+es5id: 15.3.4.5-2-9
+description: Function.prototype.bind allows Target to be a constructor (Date)
+---*/
+
+var bdc = Date.bind(null);
+var s = bdc(0, 0, 0);
+
+assert.sameValue(typeof(s), 'string', 'typeof(s)');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Function/prototype/bind/15.3.4.5-20-2.js b/js/src/tests/test262/built-ins/Function/prototype/bind/15.3.4.5-20-2.js
new file mode 100644
index 0000000000..fafc4fe681
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Function/prototype/bind/15.3.4.5-20-2.js
@@ -0,0 +1,18 @@
+// Copyright (c) 2012 Ecma International. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+es5id: 15.3.4.5-20-2
+description: >
+ Function.prototype.bind - [[Get]] attribute of 'caller' property
+ in 'F' is thrower
+---*/
+
+function foo() {}
+var obj = foo.bind({});
+
+assert.throws(TypeError, function() {
+ obj.caller;
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Function/prototype/bind/15.3.4.5-20-3.js b/js/src/tests/test262/built-ins/Function/prototype/bind/15.3.4.5-20-3.js
new file mode 100644
index 0000000000..e3a2afad84
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Function/prototype/bind/15.3.4.5-20-3.js
@@ -0,0 +1,17 @@
+// Copyright (c) 2012 Ecma International. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+es5id: 15.3.4.5-20-3
+description: >
+ Function.prototype.bind - [[Set]] attribute of 'caller' property
+ in 'F' is thrower
+---*/
+
+function foo() {}
+var obj = foo.bind({});
+assert.throws(TypeError, function() {
+ obj.caller = 12;
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Function/prototype/bind/15.3.4.5-21-2.js b/js/src/tests/test262/built-ins/Function/prototype/bind/15.3.4.5-21-2.js
new file mode 100644
index 0000000000..4132b1cbb5
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Function/prototype/bind/15.3.4.5-21-2.js
@@ -0,0 +1,18 @@
+// Copyright (c) 2012 Ecma International. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+es5id: 15.3.4.5-21-2
+description: >
+ Function.prototype.bind - [[Get]] attribute of 'arguments'
+ property in 'F' is thrower
+---*/
+
+function foo() {}
+var obj = foo.bind({});
+
+assert.throws(TypeError, function() {
+ obj.arguments;
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Function/prototype/bind/15.3.4.5-21-3.js b/js/src/tests/test262/built-ins/Function/prototype/bind/15.3.4.5-21-3.js
new file mode 100644
index 0000000000..829fdf21cf
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Function/prototype/bind/15.3.4.5-21-3.js
@@ -0,0 +1,17 @@
+// Copyright (c) 2012 Ecma International. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+es5id: 15.3.4.5-21-3
+description: >
+ Function.prototype.bind - [[Set]] attribute of 'arguments'
+ property in 'F' is thrower
+---*/
+
+function foo() {}
+var obj = foo.bind({});
+assert.throws(TypeError, function() {
+ obj.arguments = 12;
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Function/prototype/bind/15.3.4.5-3-1.js b/js/src/tests/test262/built-ins/Function/prototype/bind/15.3.4.5-3-1.js
new file mode 100644
index 0000000000..03b31395ef
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Function/prototype/bind/15.3.4.5-3-1.js
@@ -0,0 +1,18 @@
+// Copyright (c) 2012 Ecma International. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+es5id: 15.3.4.5-3-1
+description: Function.prototype.bind - each arg is defined in A in list order
+---*/
+
+var foo = function(x, y) {
+ return new Boolean((x + y) === "ab" && arguments[0] === "a" &&
+ arguments[1] === "b" && arguments.length === 2);
+};
+
+var obj = foo.bind({}, "a", "b");
+
+assert((obj() == true), '(obj() == true) !== true');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Function/prototype/bind/15.3.4.5-6-1.js b/js/src/tests/test262/built-ins/Function/prototype/bind/15.3.4.5-6-1.js
new file mode 100644
index 0000000000..b3c7b38ce0
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Function/prototype/bind/15.3.4.5-6-1.js
@@ -0,0 +1,16 @@
+// Copyright (c) 2012 Ecma International. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+es5id: 15.3.4.5-6-1
+description: Function.prototype.bind - F can get own data property
+---*/
+
+var foo = function() {};
+
+var obj = foo.bind({});
+obj.property = 12;
+
+assert.sameValue(obj.property, 12, 'obj.property');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Function/prototype/bind/15.3.4.5-6-10.js b/js/src/tests/test262/built-ins/Function/prototype/bind/15.3.4.5-6-10.js
new file mode 100644
index 0000000000..2ce10f9940
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Function/prototype/bind/15.3.4.5-6-10.js
@@ -0,0 +1,28 @@
+// Copyright (c) 2012 Ecma International. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+es5id: 15.3.4.5-6-10
+description: >
+ Function.prototype.bind - F can get own accessor property without
+ a get function that overrides an inherited accessor property
+---*/
+
+var foo = function() {};
+
+var obj = foo.bind({});
+
+Object.defineProperty(Function.prototype, "property", {
+ get: function() {
+ return 3;
+ },
+ configurable: true
+});
+
+Object.defineProperty(obj, "property", {
+ set: function() {}
+});
+
+assert.sameValue(typeof(obj.property), "undefined", 'typeof (obj.property)');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Function/prototype/bind/15.3.4.5-6-11.js b/js/src/tests/test262/built-ins/Function/prototype/bind/15.3.4.5-6-11.js
new file mode 100644
index 0000000000..2321f6a8d6
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Function/prototype/bind/15.3.4.5-6-11.js
@@ -0,0 +1,22 @@
+// Copyright (c) 2012 Ecma International. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+es5id: 15.3.4.5-6-11
+description: >
+ Function.prototype.bind - F can get inherited accessor property
+ without a get function
+---*/
+
+var foo = function() {};
+
+var obj = foo.bind({});
+
+Object.defineProperty(Function.prototype, "property", {
+ set: function() {},
+ configurable: true
+});
+
+assert.sameValue(typeof(obj.property), "undefined", 'typeof (obj.property)');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Function/prototype/bind/15.3.4.5-6-12.js b/js/src/tests/test262/built-ins/Function/prototype/bind/15.3.4.5-6-12.js
new file mode 100644
index 0000000000..34a2cfdc7b
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Function/prototype/bind/15.3.4.5-6-12.js
@@ -0,0 +1,15 @@
+// Copyright (c) 2012 Ecma International. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+es5id: 15.3.4.5-6-12
+description: Function.prototype.bind - F cannot get property which doesn't exist
+---*/
+
+var foo = function() {};
+
+var obj = foo.bind({});
+
+assert.sameValue(typeof(obj.property), "undefined", 'typeof (obj.property)');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Function/prototype/bind/15.3.4.5-6-2.js b/js/src/tests/test262/built-ins/Function/prototype/bind/15.3.4.5-6-2.js
new file mode 100644
index 0000000000..4c963e8b40
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Function/prototype/bind/15.3.4.5-6-2.js
@@ -0,0 +1,17 @@
+// Copyright (c) 2012 Ecma International. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+es5id: 15.3.4.5-6-2
+description: Function.prototype.bind - F can get inherited data property
+---*/
+
+var foo = function() {};
+
+var obj = foo.bind({});
+
+Function.prototype.property = 12;
+
+assert.sameValue(obj.property, 12, 'obj.property');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Function/prototype/bind/15.3.4.5-6-3.js b/js/src/tests/test262/built-ins/Function/prototype/bind/15.3.4.5-6-3.js
new file mode 100644
index 0000000000..ca219a931d
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Function/prototype/bind/15.3.4.5-6-3.js
@@ -0,0 +1,20 @@
+// Copyright (c) 2012 Ecma International. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+es5id: 15.3.4.5-6-3
+description: >
+ Function.prototype.bind - F can get own data property that
+ overrides an inherited data property
+---*/
+
+var foo = function() {};
+
+var obj = foo.bind({});
+
+Function.prototype.property = 3;
+obj.property = 12;
+
+assert.sameValue(obj.property, 12, 'obj.property');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Function/prototype/bind/15.3.4.5-6-4.js b/js/src/tests/test262/built-ins/Function/prototype/bind/15.3.4.5-6-4.js
new file mode 100644
index 0000000000..0945e740d6
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Function/prototype/bind/15.3.4.5-6-4.js
@@ -0,0 +1,28 @@
+// Copyright (c) 2012 Ecma International. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+es5id: 15.3.4.5-6-4
+description: >
+ Function.prototype.bind - F can get own data property that
+ overrides an inherited accessor property
+---*/
+
+var foo = function() {};
+
+var obj = foo.bind({});
+
+Object.defineProperty(Function.prototype, "property", {
+ get: function() {
+ return 3;
+ },
+ configurable: true
+});
+
+Object.defineProperty(obj, "property", {
+ value: 12
+});
+
+assert.sameValue(obj.property, 12, 'obj.property');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Function/prototype/bind/15.3.4.5-6-5.js b/js/src/tests/test262/built-ins/Function/prototype/bind/15.3.4.5-6-5.js
new file mode 100644
index 0000000000..acc29a7f3a
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Function/prototype/bind/15.3.4.5-6-5.js
@@ -0,0 +1,20 @@
+// Copyright (c) 2012 Ecma International. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+es5id: 15.3.4.5-6-5
+description: Function.prototype.bind - F can get own accessor property
+---*/
+
+var foo = function() {};
+
+var obj = foo.bind({});
+Object.defineProperty(obj, "property", {
+ get: function() {
+ return 12;
+ }
+});
+
+assert.sameValue(obj.property, 12, 'obj.property');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Function/prototype/bind/15.3.4.5-6-6.js b/js/src/tests/test262/built-ins/Function/prototype/bind/15.3.4.5-6-6.js
new file mode 100644
index 0000000000..c158887203
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Function/prototype/bind/15.3.4.5-6-6.js
@@ -0,0 +1,22 @@
+// Copyright (c) 2012 Ecma International. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+es5id: 15.3.4.5-6-6
+description: Function.prototype.bind - F can get inherited accessor property
+---*/
+
+var foo = function() {};
+
+var obj = foo.bind({});
+
+Object.defineProperty(Function.prototype, "property", {
+ get: function() {
+ return 12;
+ },
+ configurable: true
+});
+
+assert.sameValue(obj.property, 12, 'obj.property');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Function/prototype/bind/15.3.4.5-6-7.js b/js/src/tests/test262/built-ins/Function/prototype/bind/15.3.4.5-6-7.js
new file mode 100644
index 0000000000..3e03413777
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Function/prototype/bind/15.3.4.5-6-7.js
@@ -0,0 +1,24 @@
+// Copyright (c) 2012 Ecma International. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+es5id: 15.3.4.5-6-7
+description: >
+ Function.prototype.bind - F can get own accessor property that
+ overrides an inherited data property
+---*/
+
+var foo = function() {};
+
+var obj = foo.bind({});
+
+Function.prototype.property = 3;
+Object.defineProperty(obj, "property", {
+ get: function() {
+ return 12;
+ }
+});
+
+assert.sameValue(obj.property, 12, 'obj.property');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Function/prototype/bind/15.3.4.5-6-8.js b/js/src/tests/test262/built-ins/Function/prototype/bind/15.3.4.5-6-8.js
new file mode 100644
index 0000000000..f059f5425b
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Function/prototype/bind/15.3.4.5-6-8.js
@@ -0,0 +1,30 @@
+// Copyright (c) 2012 Ecma International. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+es5id: 15.3.4.5-6-8
+description: >
+ Function.prototype.bind - F can get own accessor property that
+ overrides an inherited accessor property
+---*/
+
+var foo = function() {};
+
+var obj = foo.bind({});
+
+Object.defineProperty(Function.prototype, "property", {
+ get: function() {
+ return 3;
+ },
+ configurable: true
+});
+
+Object.defineProperty(obj, "property", {
+ get: function() {
+ return 12;
+ }
+});
+
+assert.sameValue(obj.property, 12, 'obj.property');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Function/prototype/bind/15.3.4.5-6-9.js b/js/src/tests/test262/built-ins/Function/prototype/bind/15.3.4.5-6-9.js
new file mode 100644
index 0000000000..cdbc5df656
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Function/prototype/bind/15.3.4.5-6-9.js
@@ -0,0 +1,21 @@
+// Copyright (c) 2012 Ecma International. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+es5id: 15.3.4.5-6-9
+description: >
+ Function.prototype.bind - F can get own accessor property without
+ a get function
+---*/
+
+var foo = function() {};
+
+var obj = foo.bind({});
+Object.defineProperty(obj, "property", {
+ set: function() {}
+});
+
+assert(obj.hasOwnProperty("property"), 'obj.hasOwnProperty("property") !== true');
+assert.sameValue(typeof(obj.property), "undefined", 'typeof (obj.property)');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Function/prototype/bind/15.3.4.5-8-1.js b/js/src/tests/test262/built-ins/Function/prototype/bind/15.3.4.5-8-1.js
new file mode 100644
index 0000000000..023981ddac
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Function/prototype/bind/15.3.4.5-8-1.js
@@ -0,0 +1,16 @@
+// Copyright (c) 2012 Ecma International. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+es5id: 15.3.4.5-8-1
+description: Function.prototype.bind, type of bound function must be 'function'
+---*/
+
+function foo() {}
+var o = {};
+
+var bf = foo.bind(o);
+
+assert.sameValue(typeof(bf), 'function', 'typeof(bf)');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Function/prototype/bind/15.3.4.5-8-2.js b/js/src/tests/test262/built-ins/Function/prototype/bind/15.3.4.5-8-2.js
new file mode 100644
index 0000000000..4c42081051
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Function/prototype/bind/15.3.4.5-8-2.js
@@ -0,0 +1,19 @@
+// Copyright (c) 2012 Ecma International. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+es5id: 15.3.4.5-8-2
+description: >
+ Function.prototype.bind, [[Class]] of bound function must be
+ 'Function'
+---*/
+
+function foo() {}
+var o = {};
+
+var bf = foo.bind(o);
+var s = Object.prototype.toString.call(bf);
+
+assert.sameValue(s, '[object Function]', 's');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Function/prototype/bind/15.3.4.5-9-1.js b/js/src/tests/test262/built-ins/Function/prototype/bind/15.3.4.5-9-1.js
new file mode 100644
index 0000000000..e50e673c88
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Function/prototype/bind/15.3.4.5-9-1.js
@@ -0,0 +1,16 @@
+// Copyright (c) 2012 Ecma International. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+es5id: 15.3.4.5-9-1
+description: Function.prototype.bind, [[Prototype]] is Function.prototype
+---*/
+
+function foo() {}
+var o = {};
+
+var bf = foo.bind(o);
+
+assert(Function.prototype.isPrototypeOf(bf), 'Function.prototype.isPrototypeOf(bf) !== true');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Function/prototype/bind/15.3.4.5-9-2.js b/js/src/tests/test262/built-ins/Function/prototype/bind/15.3.4.5-9-2.js
new file mode 100644
index 0000000000..10149a87ed
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Function/prototype/bind/15.3.4.5-9-2.js
@@ -0,0 +1,18 @@
+// Copyright (c) 2012 Ecma International. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+es5id: 15.3.4.5-9-2
+description: >
+ Function.prototype.bind, [[Prototype]] is Function.prototype
+ (using getPrototypeOf)
+---*/
+
+function foo() {}
+var o = {};
+
+var bf = foo.bind(o);
+
+assert.sameValue(Object.getPrototypeOf(bf), Function.prototype, 'Object.getPrototypeOf(bf)');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Function/prototype/bind/15.3.4.5.1-4-1.js b/js/src/tests/test262/built-ins/Function/prototype/bind/15.3.4.5.1-4-1.js
new file mode 100644
index 0000000000..8256d37447
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Function/prototype/bind/15.3.4.5.1-4-1.js
@@ -0,0 +1,20 @@
+// Copyright (c) 2012 Ecma International. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+es5id: 15.3.4.5.1-4-1
+description: >
+ [[Call]] - 'F''s [[BoundArgs]] is used as the former part of
+ arguments of calling the [[Call]] internal method of 'F''s
+ [[TargetFunction]] when 'F' is called
+---*/
+
+var func = function(x, y, z) {
+ return x + y + z;
+};
+
+var newFunc = Function.prototype.bind.call(func, {}, "a", "b", "c");
+
+assert.sameValue(newFunc(), "abc", 'newFunc()');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Function/prototype/bind/15.3.4.5.1-4-10.js b/js/src/tests/test262/built-ins/Function/prototype/bind/15.3.4.5.1-4-10.js
new file mode 100644
index 0000000000..65f7ef60b3
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Function/prototype/bind/15.3.4.5.1-4-10.js
@@ -0,0 +1,23 @@
+// Copyright (c) 2012 Ecma International. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+es5id: 15.3.4.5.1-4-10
+description: >
+ [[Call]] - length of parameters of 'target' is 1, length of
+ 'boundArgs' is 0, length of 'ExtraArgs' is 0, and with 'boundThis'
+---*/
+
+var obj = {
+ prop: "abc"
+};
+
+var func = function(x) {
+ return this === obj && typeof x === "undefined";
+};
+
+var newFunc = Function.prototype.bind.call(func, obj);
+
+assert(newFunc(), 'newFunc() !== true');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Function/prototype/bind/15.3.4.5.1-4-11.js b/js/src/tests/test262/built-ins/Function/prototype/bind/15.3.4.5.1-4-11.js
new file mode 100644
index 0000000000..d1957fc629
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Function/prototype/bind/15.3.4.5.1-4-11.js
@@ -0,0 +1,23 @@
+// Copyright (c) 2012 Ecma International. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+es5id: 15.3.4.5.1-4-11
+description: >
+ [[Call]] - length of parameters of 'target' is 1, length of
+ 'boundArgs' is 0, length of 'ExtraArgs' is 1, and with 'boundThis'
+---*/
+
+var obj = {
+ prop: "abc"
+};
+
+var func = function(x) {
+ return this === obj && x === 1 && arguments[0] === 1 && arguments.length === 1 && this.prop === "abc";
+};
+
+var newFunc = Function.prototype.bind.call(func, obj);
+
+assert(newFunc(1), 'newFunc(1) !== true');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Function/prototype/bind/15.3.4.5.1-4-12.js b/js/src/tests/test262/built-ins/Function/prototype/bind/15.3.4.5.1-4-12.js
new file mode 100644
index 0000000000..5b0a59d61a
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Function/prototype/bind/15.3.4.5.1-4-12.js
@@ -0,0 +1,24 @@
+// Copyright (c) 2012 Ecma International. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+es5id: 15.3.4.5.1-4-12
+description: >
+ [[Call]] - length of parameters of 'target' is 1, length of
+ 'boundArgs' is 0, length of 'ExtraArgs' is 2, and with 'boundThis'
+---*/
+
+var obj = {
+ prop: "abc"
+};
+
+var func = function(x) {
+ return this === obj && x === 1 && arguments[1] === 2 &&
+ arguments[0] === 1 && arguments.length === 2 && this.prop === "abc";
+};
+
+var newFunc = Function.prototype.bind.call(func, obj);
+
+assert(newFunc(1, 2), 'newFunc(1, 2) !== true');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Function/prototype/bind/15.3.4.5.1-4-13.js b/js/src/tests/test262/built-ins/Function/prototype/bind/15.3.4.5.1-4-13.js
new file mode 100644
index 0000000000..cc8c906233
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Function/prototype/bind/15.3.4.5.1-4-13.js
@@ -0,0 +1,24 @@
+// Copyright (c) 2012 Ecma International. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+es5id: 15.3.4.5.1-4-13
+description: >
+ [[Call]] - length of parameters of 'target' is 1, length of
+ 'boundArgs' is 1, length of 'ExtraArgs' is 0, and with 'boundThis'
+---*/
+
+var obj = {
+ prop: "abc"
+};
+
+var func = function(x) {
+ return this === obj && x === 1 &&
+ arguments[0] === 1 && arguments.length === 1 && this.prop === "abc";
+};
+
+var newFunc = Function.prototype.bind.call(func, obj, 1);
+
+assert(newFunc(), 'newFunc() !== true');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Function/prototype/bind/15.3.4.5.1-4-14.js b/js/src/tests/test262/built-ins/Function/prototype/bind/15.3.4.5.1-4-14.js
new file mode 100644
index 0000000000..32c9e5e564
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Function/prototype/bind/15.3.4.5.1-4-14.js
@@ -0,0 +1,24 @@
+// Copyright (c) 2012 Ecma International. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+es5id: 15.3.4.5.1-4-14
+description: >
+ [[Call]] - length of parameters of 'target' is 1, length of
+ 'boundArgs' is 1, length of 'ExtraArgs' is 1, and with 'boundThis'
+---*/
+
+var obj = {
+ prop: "abc"
+};
+
+var func = function(x) {
+ return this === obj && x === 1 && arguments[1] === 2 &&
+ arguments[0] === 1 && arguments.length === 2 && this.prop === "abc";
+};
+
+var newFunc = Function.prototype.bind.call(func, obj, 1);
+
+assert(newFunc(2), 'newFunc(2) !== true');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Function/prototype/bind/15.3.4.5.1-4-15.js b/js/src/tests/test262/built-ins/Function/prototype/bind/15.3.4.5.1-4-15.js
new file mode 100644
index 0000000000..9f02e32671
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Function/prototype/bind/15.3.4.5.1-4-15.js
@@ -0,0 +1,24 @@
+// Copyright (c) 2012 Ecma International. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+es5id: 15.3.4.5.1-4-15
+description: >
+ [[Call]] - length of parameters of 'target' is 1, length of
+ 'boundArgs' is 2, length of 'ExtraArgs' is 0, and with 'boundThis'
+---*/
+
+var obj = {
+ prop: "abc"
+};
+
+var func = function(x) {
+ return this === obj && x === 1 && arguments[1] === 2 &&
+ arguments[0] === 1 && arguments.length === 2 && this.prop === "abc";
+};
+
+var newFunc = Function.prototype.bind.call(func, obj, 1, 2);
+
+assert(newFunc(), 'newFunc() !== true');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Function/prototype/bind/15.3.4.5.1-4-2.js b/js/src/tests/test262/built-ins/Function/prototype/bind/15.3.4.5.1-4-2.js
new file mode 100644
index 0000000000..b4476f72be
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Function/prototype/bind/15.3.4.5.1-4-2.js
@@ -0,0 +1,24 @@
+// Copyright (c) 2012 Ecma International. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+es5id: 15.3.4.5.1-4-2
+description: >
+ [[Call]] - 'F''s [[BoundThis]] is used as the 'this' value of
+ calling the [[Call]] internal method of 'F''s [[TargetFunction]]
+ when 'F' is called
+---*/
+
+var obj = {
+ "prop": "a"
+};
+
+var func = function() {
+ return this;
+};
+
+var newFunc = Function.prototype.bind.call(func, obj);
+
+assert.sameValue(newFunc(), obj, 'newFunc()');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Function/prototype/bind/15.3.4.5.1-4-3.js b/js/src/tests/test262/built-ins/Function/prototype/bind/15.3.4.5.1-4-3.js
new file mode 100644
index 0000000000..606d27bb7e
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Function/prototype/bind/15.3.4.5.1-4-3.js
@@ -0,0 +1,20 @@
+// Copyright (c) 2012 Ecma International. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+es5id: 15.3.4.5.1-4-3
+description: >
+ [[Call]] - the provided arguments is used as the latter part of
+ arguments of calling the [[Call]] internal method of 'F''s
+ [[TargetFunction]] when 'F' is called
+---*/
+
+var func = function(x, y, z) {
+ return z;
+};
+
+var newFunc = Function.prototype.bind.call(func, {}, "a", "b");
+
+assert.sameValue(newFunc("c"), "c", 'newFunc("c")');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Function/prototype/bind/15.3.4.5.1-4-4.js b/js/src/tests/test262/built-ins/Function/prototype/bind/15.3.4.5.1-4-4.js
new file mode 100644
index 0000000000..a7eabf56e4
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Function/prototype/bind/15.3.4.5.1-4-4.js
@@ -0,0 +1,20 @@
+// Copyright (c) 2012 Ecma International. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+es5id: 15.3.4.5.1-4-4
+description: >
+ [[Call]] - length of parameters of 'target' is 0, length of
+ 'boundArgs' is 0, length of 'ExtraArgs' is 0, and without
+ 'boundThis'
+---*/
+
+var func = function() {
+ return arguments.length === 0;
+};
+
+var newFunc = Function.prototype.bind.call(func);
+
+assert(newFunc(), 'newFunc() !== true');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Function/prototype/bind/15.3.4.5.1-4-5.js b/js/src/tests/test262/built-ins/Function/prototype/bind/15.3.4.5.1-4-5.js
new file mode 100644
index 0000000000..7ac4c22290
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Function/prototype/bind/15.3.4.5.1-4-5.js
@@ -0,0 +1,20 @@
+// Copyright (c) 2012 Ecma International. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+es5id: 15.3.4.5.1-4-5
+description: >
+ [[Call]] - length of parameters of 'target' is 0, length of
+ 'boundArgs' is 0, length of 'ExtraArgs' is 1, and without
+ 'boundThis'
+---*/
+
+var func = function() {
+ return arguments[0] === 1;
+};
+
+var newFunc = Function.prototype.bind.call(func);
+
+assert(newFunc(1), 'newFunc(1) !== true');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Function/prototype/bind/15.3.4.5.1-4-6.js b/js/src/tests/test262/built-ins/Function/prototype/bind/15.3.4.5.1-4-6.js
new file mode 100644
index 0000000000..4cde48c6c4
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Function/prototype/bind/15.3.4.5.1-4-6.js
@@ -0,0 +1,23 @@
+// Copyright (c) 2012 Ecma International. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+es5id: 15.3.4.5.1-4-6
+description: >
+ [[Call]] - length of parameters of 'target' is 0, length of
+ 'boundArgs' is 0, length of 'ExtraArgs' is 0, and with 'boundThis'
+---*/
+
+var obj = {
+ prop: "abc"
+};
+
+var func = function() {
+ return this === obj && arguments.length === 0;
+};
+
+var newFunc = Function.prototype.bind.call(func, obj);
+
+assert(newFunc(), 'newFunc() !== true');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Function/prototype/bind/15.3.4.5.1-4-7.js b/js/src/tests/test262/built-ins/Function/prototype/bind/15.3.4.5.1-4-7.js
new file mode 100644
index 0000000000..7ea5079300
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Function/prototype/bind/15.3.4.5.1-4-7.js
@@ -0,0 +1,23 @@
+// Copyright (c) 2012 Ecma International. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+es5id: 15.3.4.5.1-4-7
+description: >
+ [[Call]] - length of parameters of 'target' is 0, length of
+ 'boundArgs' is 1, length of 'ExtraArgs' is 0, and with 'boundThis'
+---*/
+
+var obj = {
+ prop: "abc"
+};
+
+var func = function() {
+ return this === obj && arguments[0] === 1;
+};
+
+var newFunc = Function.prototype.bind.call(func, obj, 1);
+
+assert(newFunc(), 'newFunc() !== true');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Function/prototype/bind/15.3.4.5.1-4-8.js b/js/src/tests/test262/built-ins/Function/prototype/bind/15.3.4.5.1-4-8.js
new file mode 100644
index 0000000000..ad131abdd1
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Function/prototype/bind/15.3.4.5.1-4-8.js
@@ -0,0 +1,23 @@
+// Copyright (c) 2012 Ecma International. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+es5id: 15.3.4.5.1-4-8
+description: >
+ [[Call]] - length of parameters of 'target' is 0, length of
+ 'boundArgs' is 0, length of 'ExtraArgs' is 1, and with 'boundThis'
+---*/
+
+var obj = {
+ prop: "abc"
+};
+
+var func = function() {
+ return this === obj && arguments[0] === 1;
+};
+
+var newFunc = Function.prototype.bind.call(func, obj);
+
+assert(newFunc(1), 'newFunc(1) !== true');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Function/prototype/bind/15.3.4.5.1-4-9.js b/js/src/tests/test262/built-ins/Function/prototype/bind/15.3.4.5.1-4-9.js
new file mode 100644
index 0000000000..a45c1da661
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Function/prototype/bind/15.3.4.5.1-4-9.js
@@ -0,0 +1,23 @@
+// Copyright (c) 2012 Ecma International. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+es5id: 15.3.4.5.1-4-9
+description: >
+ [[Call]] - length of parameters of 'target' is 0, length of
+ 'boundArgs' is 1, length of 'ExtraArgs' is 1, and with 'boundThis'
+---*/
+
+var obj = {
+ prop: "abc"
+};
+
+var func = function() {
+ return this === obj && arguments[0] === 1 && arguments[1] === 2;
+};
+
+var newFunc = Function.prototype.bind.call(func, obj, 1);
+
+assert(newFunc(2), 'newFunc(2) !== true');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Function/prototype/bind/15.3.4.5.2-4-1.js b/js/src/tests/test262/built-ins/Function/prototype/bind/15.3.4.5.2-4-1.js
new file mode 100644
index 0000000000..5fc8f1cef3
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Function/prototype/bind/15.3.4.5.2-4-1.js
@@ -0,0 +1,28 @@
+// Copyright (c) 2012 Ecma International. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+es5id: 15.3.4.5.2-4-1
+description: >
+ [[Construct]] - 'F''s [[BoundArgs]] is used as the former part of
+ arguments of calling the [[Construct]] internal method of 'F''s
+ [[TargetFunction]] when 'F' is called as constructor
+---*/
+
+var func = function(x, y, z) {
+ var objResult = {};
+ objResult.returnValue = x + y + z;
+ objResult.returnVerifyResult = arguments[0] === "a" && arguments.length === 3;
+ return objResult;
+};
+
+var NewFunc = Function.prototype.bind.call(func, {}, "a", "b", "c");
+
+var newInstance = new NewFunc();
+
+assert(newInstance.hasOwnProperty("returnValue"), 'newInstance.hasOwnProperty("returnValue") !== true');
+assert.sameValue(newInstance.returnValue, "abc", 'newInstance.returnValue');
+assert(newInstance.hasOwnProperty("returnVerifyResult"), 'newInstance.hasOwnProperty("returnVerifyResult") !== true');
+assert.sameValue(newInstance.returnVerifyResult, true, 'newInstance.returnVerifyResult');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Function/prototype/bind/15.3.4.5.2-4-10.js b/js/src/tests/test262/built-ins/Function/prototype/bind/15.3.4.5.2-4-10.js
new file mode 100644
index 0000000000..9a67283e9e
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Function/prototype/bind/15.3.4.5.2-4-10.js
@@ -0,0 +1,21 @@
+// Copyright (c) 2012 Ecma International. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+es5id: 15.3.4.5.2-4-10
+description: >
+ [[Construct]] - length of parameters of 'target' is 1, length of
+ 'boundArgs' is 0, length of 'ExtraArgs' is 1
+---*/
+
+var func = function(x) {
+ return new Boolean(arguments.length === 1 && x === 1 && arguments[0] === 1);
+};
+
+var NewFunc = Function.prototype.bind.call(func, {});
+
+var newInstance = new NewFunc(1);
+
+assert.sameValue(newInstance.valueOf(), true, 'newInstance.valueOf()');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Function/prototype/bind/15.3.4.5.2-4-11.js b/js/src/tests/test262/built-ins/Function/prototype/bind/15.3.4.5.2-4-11.js
new file mode 100644
index 0000000000..aed0660c9e
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Function/prototype/bind/15.3.4.5.2-4-11.js
@@ -0,0 +1,21 @@
+// Copyright (c) 2012 Ecma International. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+es5id: 15.3.4.5.2-4-11
+description: >
+ [[Construct]] - length of parameters of 'target' is 1, length of
+ 'boundArgs' is 0, length of 'ExtraArgs' is 2
+---*/
+
+var func = function(x) {
+ return new Boolean(arguments.length === 2 && x === 1 && arguments[1] === 2 && arguments[0] === 1);
+};
+
+var NewFunc = Function.prototype.bind.call(func, {});
+
+var newInstance = new NewFunc(1, 2);
+
+assert.sameValue(newInstance.valueOf(), true, 'newInstance.valueOf()');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Function/prototype/bind/15.3.4.5.2-4-12.js b/js/src/tests/test262/built-ins/Function/prototype/bind/15.3.4.5.2-4-12.js
new file mode 100644
index 0000000000..57441acc65
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Function/prototype/bind/15.3.4.5.2-4-12.js
@@ -0,0 +1,21 @@
+// Copyright (c) 2012 Ecma International. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+es5id: 15.3.4.5.2-4-12
+description: >
+ [[Construct]] - length of parameters of 'target' is 1, length of
+ 'boundArgs' is 1, length of 'ExtraArgs' is 0
+---*/
+
+var func = function(x) {
+ return new Boolean(arguments.length === 1 && x === 1 && arguments[0] === 1);
+};
+
+var NewFunc = Function.prototype.bind.call(func, {}, 1);
+
+var newInstance = new NewFunc();
+
+assert.sameValue(newInstance.valueOf(), true, 'newInstance.valueOf()');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Function/prototype/bind/15.3.4.5.2-4-13.js b/js/src/tests/test262/built-ins/Function/prototype/bind/15.3.4.5.2-4-13.js
new file mode 100644
index 0000000000..7bbc00ee43
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Function/prototype/bind/15.3.4.5.2-4-13.js
@@ -0,0 +1,21 @@
+// Copyright (c) 2012 Ecma International. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+es5id: 15.3.4.5.2-4-13
+description: >
+ [[Construct]] - length of parameters of 'target' is 1, length of
+ 'boundArgs' is 1, length of 'ExtraArgs' is 1
+---*/
+
+var func = function(x) {
+ return new Boolean(arguments.length === 2 && x === 1 && arguments[1] === 2 && arguments[0] === 1);
+};
+
+var NewFunc = Function.prototype.bind.call(func, {}, 1);
+
+var newInstance = new NewFunc(2);
+
+assert.sameValue(newInstance.valueOf(), true, 'newInstance.valueOf()');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Function/prototype/bind/15.3.4.5.2-4-14.js b/js/src/tests/test262/built-ins/Function/prototype/bind/15.3.4.5.2-4-14.js
new file mode 100644
index 0000000000..b94a9ef5f8
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Function/prototype/bind/15.3.4.5.2-4-14.js
@@ -0,0 +1,21 @@
+// Copyright (c) 2012 Ecma International. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+es5id: 15.3.4.5.2-4-14
+description: >
+ [[Construct]] - length of parameters of 'target' is 1, length of
+ 'boundArgs' is 2, length of 'ExtraArgs' is 0
+---*/
+
+var func = function(x) {
+ return new Boolean(arguments.length === 2 && x === 1 && arguments[1] === 2 && arguments[0] === 1);
+};
+
+var NewFunc = Function.prototype.bind.call(func, {}, 1, 2);
+
+var newInstance = new NewFunc();
+
+assert.sameValue(newInstance.valueOf(), true, 'newInstance.valueOf()');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Function/prototype/bind/15.3.4.5.2-4-2.js b/js/src/tests/test262/built-ins/Function/prototype/bind/15.3.4.5.2-4-2.js
new file mode 100644
index 0000000000..773ff11a30
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Function/prototype/bind/15.3.4.5.2-4-2.js
@@ -0,0 +1,28 @@
+// Copyright (c) 2012 Ecma International. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+es5id: 15.3.4.5.2-4-2
+description: >
+ [[Construct]] - the provided arguments is used as the latter part
+ of arguments of calling the [[Construct]] internal method of 'F''s
+ [[TargetFunction]] when 'F' is called as constructor
+---*/
+
+var func = function(x, y, z) {
+ var objResult = {};
+ objResult.returnValue = x + y + z;
+ objResult.returnVerifyResult = arguments[0] === "a" && arguments.length === 3;
+ return objResult;
+};
+
+var NewFunc = Function.prototype.bind.call(func, {});
+
+var newInstance = new NewFunc("a", "b", "c");
+
+assert(newInstance.hasOwnProperty("returnValue"), 'newInstance.hasOwnProperty("returnValue") !== true');
+assert.sameValue(newInstance.returnValue, "abc", 'newInstance.returnValue');
+assert(newInstance.hasOwnProperty("returnVerifyResult"), 'newInstance.hasOwnProperty("returnVerifyResult") !== true');
+assert.sameValue(newInstance.returnVerifyResult, true, 'newInstance.returnVerifyResult');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Function/prototype/bind/15.3.4.5.2-4-3.js b/js/src/tests/test262/built-ins/Function/prototype/bind/15.3.4.5.2-4-3.js
new file mode 100644
index 0000000000..1bce0662c7
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Function/prototype/bind/15.3.4.5.2-4-3.js
@@ -0,0 +1,22 @@
+// Copyright (c) 2012 Ecma International. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+es5id: 15.3.4.5.2-4-3
+description: >
+ [[Construct]] - length of parameters of 'target' is 0, length of
+ 'boundArgs' is 0, length of 'ExtraArgs' is 0, and without
+ 'boundThis'
+---*/
+
+var func = function() {
+ return new Boolean(arguments.length === 0);
+};
+
+var NewFunc = Function.prototype.bind.call(func);
+
+var newInstance = new NewFunc();
+
+assert.sameValue(newInstance.valueOf(), true, 'newInstance.valueOf()');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Function/prototype/bind/15.3.4.5.2-4-4.js b/js/src/tests/test262/built-ins/Function/prototype/bind/15.3.4.5.2-4-4.js
new file mode 100644
index 0000000000..c37c64dead
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Function/prototype/bind/15.3.4.5.2-4-4.js
@@ -0,0 +1,22 @@
+// Copyright (c) 2012 Ecma International. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+es5id: 15.3.4.5.2-4-4
+description: >
+ [[Construct]] - length of parameters of 'target' is 0, length of
+ 'boundArgs' is 0, length of 'ExtraArgs' is 1, and without
+ 'boundThis'
+---*/
+
+var func = function() {
+ return new Boolean(arguments[0] === 1 && arguments.length === 1);
+};
+
+var NewFunc = Function.prototype.bind.call(func);
+
+var newInstance = new NewFunc(1);
+
+assert.sameValue(newInstance.valueOf(), true, 'newInstance.valueOf()');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Function/prototype/bind/15.3.4.5.2-4-5.js b/js/src/tests/test262/built-ins/Function/prototype/bind/15.3.4.5.2-4-5.js
new file mode 100644
index 0000000000..a2a1a1b47a
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Function/prototype/bind/15.3.4.5.2-4-5.js
@@ -0,0 +1,27 @@
+// Copyright (c) 2012 Ecma International. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+es5id: 15.3.4.5.2-4-5
+description: >
+ [[Construct]] - length of parameters of 'target' is 0, length of
+ 'boundArgs' is 0, length of 'ExtraArgs' is 0, and with 'boundThis'
+---*/
+
+var obj = {
+ prop: "abc"
+};
+
+Object.prototype.verifyThis = "verifyThis";
+var func = function() {
+ return new Boolean(arguments.length === 0 && Object.prototype.toString.call(this) === "[object Object]" &&
+ this.verifyThis === "verifyThis");
+};
+
+var NewFunc = Function.prototype.bind.call(func, obj);
+
+var newInstance = new NewFunc();
+
+assert(newInstance.valueOf(), 'newInstance.valueOf() !== true');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Function/prototype/bind/15.3.4.5.2-4-6.js b/js/src/tests/test262/built-ins/Function/prototype/bind/15.3.4.5.2-4-6.js
new file mode 100644
index 0000000000..0264a3096f
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Function/prototype/bind/15.3.4.5.2-4-6.js
@@ -0,0 +1,21 @@
+// Copyright (c) 2012 Ecma International. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+es5id: 15.3.4.5.2-4-6
+description: >
+ [[Construct]] - length of parameters of 'target' is 0, length of
+ 'boundArgs' is 1, length of 'ExtraArgs' is 0
+---*/
+
+var func = function() {
+ return new Boolean(arguments.length === 1 && arguments[0] === 1);
+};
+
+var NewFunc = Function.prototype.bind.call(func, {}, 1);
+
+var newInstance = new NewFunc();
+
+assert.sameValue(newInstance.valueOf(), true, 'newInstance.valueOf()');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Function/prototype/bind/15.3.4.5.2-4-7.js b/js/src/tests/test262/built-ins/Function/prototype/bind/15.3.4.5.2-4-7.js
new file mode 100644
index 0000000000..ef32b29532
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Function/prototype/bind/15.3.4.5.2-4-7.js
@@ -0,0 +1,21 @@
+// Copyright (c) 2012 Ecma International. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+es5id: 15.3.4.5.2-4-7
+description: >
+ [[Construct]] - length of parameters of 'target' is 0, length of
+ 'boundArgs' is 0, length of 'ExtraArgs' is 1
+---*/
+
+var func = function() {
+ return new Boolean(arguments.length === 1 && arguments[0] === 1);
+};
+
+var NewFunc = Function.prototype.bind.call(func, {});
+
+var newInstance = new NewFunc(1);
+
+assert.sameValue(newInstance.valueOf(), true, 'newInstance.valueOf()');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Function/prototype/bind/15.3.4.5.2-4-8.js b/js/src/tests/test262/built-ins/Function/prototype/bind/15.3.4.5.2-4-8.js
new file mode 100644
index 0000000000..3f724f3969
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Function/prototype/bind/15.3.4.5.2-4-8.js
@@ -0,0 +1,21 @@
+// Copyright (c) 2012 Ecma International. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+es5id: 15.3.4.5.2-4-8
+description: >
+ [[Construct]] - length of parameters of 'target' is 0, length of
+ 'boundArgs' is 1, length of 'ExtraArgs' is 1
+---*/
+
+var func = function() {
+ return new Boolean(arguments.length === 2 && arguments[0] === 1 && arguments[1] === 2);
+};
+
+var NewFunc = Function.prototype.bind.call(func, {}, 1);
+
+var newInstance = new NewFunc(2);
+
+assert.sameValue(newInstance.valueOf(), true, 'newInstance.valueOf()');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Function/prototype/bind/15.3.4.5.2-4-9.js b/js/src/tests/test262/built-ins/Function/prototype/bind/15.3.4.5.2-4-9.js
new file mode 100644
index 0000000000..e9fbcb3b8f
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Function/prototype/bind/15.3.4.5.2-4-9.js
@@ -0,0 +1,21 @@
+// Copyright (c) 2012 Ecma International. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+es5id: 15.3.4.5.2-4-9
+description: >
+ [[Construct]] - length of parameters of 'target' is 1, length of
+ 'boundArgs' is 0, length of 'ExtraArgs' is 0
+---*/
+
+var func = function(x) {
+ return new Boolean(arguments.length === 0 && typeof x === "undefined");
+};
+
+var NewFunc = Function.prototype.bind.call(func, {});
+
+var newInstance = new NewFunc();
+
+assert.sameValue(newInstance.valueOf(), true, 'newInstance.valueOf()');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Function/prototype/bind/BoundFunction_restricted-properties.js b/js/src/tests/test262/built-ins/Function/prototype/bind/BoundFunction_restricted-properties.js
new file mode 100644
index 0000000000..3ef55b0461
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Function/prototype/bind/BoundFunction_restricted-properties.js
@@ -0,0 +1,34 @@
+// Copyright (C) 2015 Caitlin Potter. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+description: >
+ Functions created using Function.prototype.bind() do not have own
+ properties "caller" or "arguments", but inherit them from
+ %FunctionPrototype%.
+es6id: 16.1
+---*/
+
+function target() {}
+var bound = target.bind(null);
+
+assert.sameValue(bound.hasOwnProperty('caller'), false, 'Functions created using Function.prototype.bind() do not have own property "caller"');
+assert.sameValue(bound.hasOwnProperty('arguments'), false, 'Functions created using Function.prototype.bind() do not have own property "arguments"');
+
+assert.throws(TypeError, function() {
+ return bound.caller;
+});
+
+assert.throws(TypeError, function() {
+ bound.caller = {};
+});
+
+assert.throws(TypeError, function() {
+ return bound.arguments;
+});
+
+assert.throws(TypeError, function() {
+ bound.arguments = {};
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Function/prototype/bind/S15.3.4.5_A1.js b/js/src/tests/test262/built-ins/Function/prototype/bind/S15.3.4.5_A1.js
new file mode 100644
index 0000000000..6a3d1fc9dd
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Function/prototype/bind/S15.3.4.5_A1.js
@@ -0,0 +1,23 @@
+// Copyright 2011 the Sputnik authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+info: "\"caller\" of bound function is poisoned (step 20)"
+es5id: 15.3.4.5_A1
+description: A bound function should fail to find its "caller"
+---*/
+
+function foo() {
+ return bar.caller;
+}
+var bar = foo.bind({});
+
+function baz() {
+ return bar();
+}
+
+assert.throws(TypeError, function() {
+ baz();
+}, 'baz() throws a TypeError exception');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Function/prototype/bind/S15.3.4.5_A13.js b/js/src/tests/test262/built-ins/Function/prototype/bind/S15.3.4.5_A13.js
new file mode 100644
index 0000000000..01147fa0e9
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Function/prototype/bind/S15.3.4.5_A13.js
@@ -0,0 +1,13 @@
+// Copyright 2011 the Sputnik authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+es5id: 15.3.4.5_A13
+description: If IsCallable(func) is false, then throw a TypeError exception.
+---*/
+
+assert.throws(TypeError, function() {
+ Function.prototype.bind.call(undefined, {});
+}, 'Function.prototype.bind.call(undefined, {}) throws a TypeError exception');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Function/prototype/bind/S15.3.4.5_A14.js b/js/src/tests/test262/built-ins/Function/prototype/bind/S15.3.4.5_A14.js
new file mode 100644
index 0000000000..ef80439ee1
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Function/prototype/bind/S15.3.4.5_A14.js
@@ -0,0 +1,13 @@
+// Copyright 2011 the Sputnik authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+es5id: 15.3.4.5_A14
+description: If IsCallable(func) is false, then throw a TypeError exception.
+---*/
+
+assert.throws(TypeError, function() {
+ Function.prototype.bind.call(null, {});
+}, 'Function.prototype.bind.call(null, {}) throws a TypeError exception');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Function/prototype/bind/S15.3.4.5_A15.js b/js/src/tests/test262/built-ins/Function/prototype/bind/S15.3.4.5_A15.js
new file mode 100644
index 0000000000..31ea5be65f
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Function/prototype/bind/S15.3.4.5_A15.js
@@ -0,0 +1,13 @@
+// Copyright 2011 the Sputnik authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+es5id: 15.3.4.5_A15
+description: If IsCallable(func) is false, then throw a TypeError exception.
+---*/
+
+assert.throws(TypeError, function() {
+ Function.prototype.bind.call({}, {});
+}, 'Function.prototype.bind.call({}, {}) throws a TypeError exception');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Function/prototype/bind/S15.3.4.5_A16.js b/js/src/tests/test262/built-ins/Function/prototype/bind/S15.3.4.5_A16.js
new file mode 100644
index 0000000000..22cb39531b
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Function/prototype/bind/S15.3.4.5_A16.js
@@ -0,0 +1,26 @@
+// Copyright 2011 the Sputnik authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+info: If IsCallable(func) is false, then throw a TypeError exception.
+es5id: 15.3.4.5_A16
+description: >
+ A RegExp is not a function, but it may be callable. Iff it is,
+ it's typeof should be 'function', in which case bind should accept
+ it as a valid this value.
+---*/
+
+var re = (/x/);
+if (typeof re === 'function') {
+ Function.prototype.bind.call(re, undefined);
+} else {
+ try {
+ Function.prototype.bind.call(re, undefined);
+ throw new Test262Error('#1: If IsCallable(func) is false, ' +
+ 'then (bind should) throw a TypeError exception');
+ } catch (e) {
+ assert(e instanceof TypeError, 'The result of evaluating (e instanceof TypeError) is expected to be true');
+ }
+}
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Function/prototype/bind/S15.3.4.5_A2.js b/js/src/tests/test262/built-ins/Function/prototype/bind/S15.3.4.5_A2.js
new file mode 100644
index 0000000000..fe00b327a9
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Function/prototype/bind/S15.3.4.5_A2.js
@@ -0,0 +1,23 @@
+// Copyright 2011 the Sputnik authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+info: "\"arguments\" of bound function is poisoned (step 21)"
+es5id: 15.3.4.5_A2
+description: a bound function should fail to find the bound function "arguments"
+---*/
+
+function foo() {
+ return bar.arguments;
+}
+var bar = foo.bind({});
+
+function baz() {
+ return bar();
+}
+
+assert.throws(TypeError, function() {
+ baz();
+}, 'baz() throws a TypeError exception');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Function/prototype/bind/S15.3.4.5_A3.js b/js/src/tests/test262/built-ins/Function/prototype/bind/S15.3.4.5_A3.js
new file mode 100644
index 0000000000..334561651a
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Function/prototype/bind/S15.3.4.5_A3.js
@@ -0,0 +1,13 @@
+// Copyright 2011 Google Inc. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+es5id: 15.3.4.5_A3
+description: Function.prototype.bind must exist
+---*/
+assert(
+ 'bind' in Function.prototype,
+ 'The result of evaluating (\'bind\' in Function.prototype) is expected to be true'
+);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Function/prototype/bind/S15.3.4.5_A4.js b/js/src/tests/test262/built-ins/Function/prototype/bind/S15.3.4.5_A4.js
new file mode 100644
index 0000000000..76b679e67c
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Function/prototype/bind/S15.3.4.5_A4.js
@@ -0,0 +1,19 @@
+// Copyright 2011 Google Inc. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+es5id: 15.3.4.5_A4
+description: >
+ Function.prototype.bind call the original's internal [[Call]]
+ method rather than its .apply method.
+---*/
+
+function foo() {}
+
+var b = foo.bind(33, 44);
+foo.apply = function() {
+ throw new Test262Error("Function.prototype.bind called original's .apply method");
+};
+b(55, 66);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Function/prototype/bind/S15.3.4.5_A5.js b/js/src/tests/test262/built-ins/Function/prototype/bind/S15.3.4.5_A5.js
new file mode 100644
index 0000000000..55061a1aa5
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Function/prototype/bind/S15.3.4.5_A5.js
@@ -0,0 +1,23 @@
+// Copyright 2011 Google Inc. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+es5id: 15.3.4.5_A5
+description: >
+ Function.prototype.bind must curry [[Construct]] as well as
+ [[Call]].
+---*/
+
+function construct(f, args) {
+ var bound = Function.prototype.bind.apply(f, [null].concat(args));
+ return new bound();
+}
+var d = construct(Date, [1957, 4, 27]);
+
+assert.sameValue(
+ Object.prototype.toString.call(d),
+ '[object Date]',
+ 'Object.prototype.toString.call(construct(Date, [1957, 4, 27])) must return "[object Date]"'
+);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Function/prototype/bind/browser.js b/js/src/tests/test262/built-ins/Function/prototype/bind/browser.js
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Function/prototype/bind/browser.js
diff --git a/js/src/tests/test262/built-ins/Function/prototype/bind/get-fn-realm-recursive.js b/js/src/tests/test262/built-ins/Function/prototype/bind/get-fn-realm-recursive.js
new file mode 100644
index 0000000000..707f5d42ac
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Function/prototype/bind/get-fn-realm-recursive.js
@@ -0,0 +1,55 @@
+// Copyright (C) 2019 Aleksey Shvayka. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-getfunctionrealm
+description: >
+ The realm of a bound function exotic object is the realm of its target function.
+ GetFunctionRealm is called recursively.
+info: |
+ Object ( [ value ] )
+
+ 1. If NewTarget is neither undefined nor the active function, then
+ a. Return ? OrdinaryCreateFromConstructor(NewTarget, "%Object.prototype%").
+
+ OrdinaryCreateFromConstructor ( constructor, intrinsicDefaultProto [ , internalSlotsList ] )
+
+ [...]
+ 2. Let proto be ? GetPrototypeFromConstructor(constructor, intrinsicDefaultProto).
+ 3. Return OrdinaryObjectCreate(proto, internalSlotsList).
+
+ GetPrototypeFromConstructor ( constructor, intrinsicDefaultProto )
+
+ [...]
+ 3. Let proto be ? Get(constructor, "prototype").
+ 4. If Type(proto) is not Object, then
+ a. Let realm be ? GetFunctionRealm(constructor).
+ b. Set proto to realm's intrinsic object named intrinsicDefaultProto.
+ 5. Return proto.
+
+ GetFunctionRealm ( obj )
+
+ [...]
+ 2. If obj has a [[Realm]] internal slot, then
+ a. Return obj.[[Realm]].
+ 3. If obj is a bound function exotic object, then
+ a. Let target be obj.[[BoundTargetFunction]].
+ b. Return ? GetFunctionRealm(target).
+features: [cross-realm, Reflect]
+---*/
+
+var realm1 = $262.createRealm().global;
+var realm2 = $262.createRealm().global;
+var realm3 = $262.createRealm().global;
+var realm4 = $262.createRealm().global;
+
+var newTarget = new realm1.Function();
+newTarget.prototype = 1;
+
+var boundNewTarget = realm2.Function.prototype.bind.call(newTarget);
+var boundBoundNewTarget = realm3.Function.prototype.bind.call(boundNewTarget);
+var object = Reflect.construct(realm4.Object, [], boundBoundNewTarget);
+
+assert(object instanceof realm1.Object);
+assert.sameValue(Object.getPrototypeOf(object), realm1.Object.prototype);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Function/prototype/bind/get-fn-realm.js b/js/src/tests/test262/built-ins/Function/prototype/bind/get-fn-realm.js
new file mode 100644
index 0000000000..64de4787cd
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Function/prototype/bind/get-fn-realm.js
@@ -0,0 +1,57 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-getfunctionrealm
+description: >
+ The realm of a bound function exotic object is the realm of its target function.
+info: |
+ Date ( )
+
+ [...]
+ 3. If NewTarget is undefined, then
+ [...]
+ 4. Else,
+ a. Let O be ? OrdinaryCreateFromConstructor(NewTarget, "%Date.prototype%", « [[DateValue]] »).
+ [...]
+ c. Return O.
+
+ OrdinaryCreateFromConstructor ( constructor, intrinsicDefaultProto [ , internalSlotsList ] )
+
+ [...]
+ 2. Let proto be ? GetPrototypeFromConstructor(constructor, intrinsicDefaultProto).
+ 3. Return OrdinaryObjectCreate(proto, internalSlotsList).
+
+ GetPrototypeFromConstructor ( constructor, intrinsicDefaultProto )
+
+ [...]
+ 3. Let proto be ? Get(constructor, "prototype").
+ 4. If Type(proto) is not Object, then
+ a. Let realm be ? GetFunctionRealm(constructor).
+ b. Set proto to realm's intrinsic object named intrinsicDefaultProto.
+ 5. Return proto.
+
+ GetFunctionRealm ( obj )
+
+ [...]
+ 2. If obj has a [[Realm]] internal slot, then
+ a. Return obj.[[Realm]].
+ 3. If obj is a bound function exotic object, then
+ a. Let target be obj.[[BoundTargetFunction]].
+ b. Return ? GetFunctionRealm(target).
+features: [cross-realm, Reflect]
+---*/
+
+var realm1 = $262.createRealm().global;
+var realm2 = $262.createRealm().global;
+var realm3 = $262.createRealm().global;
+
+var newTarget = new realm1.Function();
+newTarget.prototype = "str";
+
+var boundNewTarget = realm2.Function.prototype.bind.call(newTarget);
+var date = Reflect.construct(realm3.Date, [], boundNewTarget);
+
+assert(date instanceof realm1.Date);
+assert.sameValue(Object.getPrototypeOf(date), realm1.Date.prototype);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Function/prototype/bind/instance-construct-newtarget-boundtarget-bound.js b/js/src/tests/test262/built-ins/Function/prototype/bind/instance-construct-newtarget-boundtarget-bound.js
new file mode 100644
index 0000000000..33d5a435b4
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Function/prototype/bind/instance-construct-newtarget-boundtarget-bound.js
@@ -0,0 +1,29 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-bound-function-exotic-objects-construct-argumentslist-newtarget
+description: >
+ The NewTarget value is changed to the target function when the bound function
+ object is constructed using Reflect.construct and the "bound target" is
+ specified as the NewTarget value (and the bound target is itself a bound
+ function)
+info: |
+ [...]
+ 5. If SameValue(F, newTarget) is true, let newTarget be target.
+ 6. Return ? Construct(target, args, newTarget).
+features: [Reflect, new.target]
+---*/
+
+var newTarget;
+function A() {
+ newTarget = new.target;
+}
+var B = A.bind();
+var C = B.bind();
+
+var c = Reflect.construct(C, [], B);
+
+assert.sameValue(newTarget, A);
+assert.sameValue(Object.getPrototypeOf(c), A.prototype);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Function/prototype/bind/instance-construct-newtarget-boundtarget.js b/js/src/tests/test262/built-ins/Function/prototype/bind/instance-construct-newtarget-boundtarget.js
new file mode 100644
index 0000000000..79e923d9cb
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Function/prototype/bind/instance-construct-newtarget-boundtarget.js
@@ -0,0 +1,28 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-bound-function-exotic-objects-construct-argumentslist-newtarget
+description: >
+ The NewTarget value is changed to the target function when the bound function
+ object is constructed using Reflect.construct and the "bound target" is
+ specified as the NewTarget value
+info: |
+ [...]
+ 5. If SameValue(F, newTarget) is true, let newTarget be target.
+ 6. Return ? Construct(target, args, newTarget).
+features: [Reflect, new.target]
+---*/
+
+var newTarget;
+function A() {
+ newTarget = new.target;
+}
+var B = A.bind();
+var C = B.bind();
+
+var c = Reflect.construct(C, [], A);
+
+assert.sameValue(newTarget, A);
+assert.sameValue(Object.getPrototypeOf(c), A.prototype);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Function/prototype/bind/instance-construct-newtarget-self-new.js b/js/src/tests/test262/built-ins/Function/prototype/bind/instance-construct-newtarget-self-new.js
new file mode 100644
index 0000000000..ff9e645151
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Function/prototype/bind/instance-construct-newtarget-self-new.js
@@ -0,0 +1,27 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-bound-function-exotic-objects-construct-argumentslist-newtarget
+description: >
+ The NewTarget value is changed to the target function when the bound function
+ object is constructed using the `new` operator
+info: |
+ [...]
+ 5. If SameValue(F, newTarget) is true, let newTarget be target.
+ 6. Return ? Construct(target, args, newTarget).
+features: [new.target]
+---*/
+
+var newTarget;
+function A() {
+ newTarget = new.target;
+}
+var B = A.bind();
+var C = B.bind();
+
+var c = new C();
+
+assert.sameValue(newTarget, A);
+assert.sameValue(Object.getPrototypeOf(c), A.prototype);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Function/prototype/bind/instance-construct-newtarget-self-reflect.js b/js/src/tests/test262/built-ins/Function/prototype/bind/instance-construct-newtarget-self-reflect.js
new file mode 100644
index 0000000000..878eb0942e
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Function/prototype/bind/instance-construct-newtarget-self-reflect.js
@@ -0,0 +1,28 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-bound-function-exotic-objects-construct-argumentslist-newtarget
+description: >
+ The NewTarget value is changed to the target function when the bound function
+ object is constructed using Reflect.construct and the bound function is
+ specified as the NewTarget value
+info: |
+ [...]
+ 5. If SameValue(F, newTarget) is true, let newTarget be target.
+ 6. Return ? Construct(target, args, newTarget).
+features: [Reflect, new.target]
+---*/
+
+var newTarget;
+function A() {
+ newTarget = new.target;
+}
+var B = A.bind();
+var C = B.bind();
+
+var c = Reflect.construct(C, [], C);
+
+assert.sameValue(newTarget, A);
+assert.sameValue(Object.getPrototypeOf(c), A.prototype);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Function/prototype/bind/instance-length-default-value.js b/js/src/tests/test262/built-ins/Function/prototype/bind/instance-length-default-value.js
new file mode 100644
index 0000000000..7423b841d0
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Function/prototype/bind/instance-length-default-value.js
@@ -0,0 +1,54 @@
+// Copyright (C) 2020 Alexey Shvayka. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-function.prototype.bind
+description: >
+ "length" value of a bound function defaults to 0.
+ Non-own and non-number "length" values of target function are ignored.
+info: |
+ Function.prototype.bind ( thisArg, ...args )
+
+ [...]
+ 5. Let targetHasLength be ? HasOwnProperty(Target, "length").
+ 6. If targetHasLength is true, then
+ a. Let targetLen be ? Get(Target, "length").
+ b. If Type(targetLen) is not Number, let L be 0.
+ c. Else,
+ i. Set targetLen to ! ToInteger(targetLen).
+ ii. Let L be the larger of 0 and the result of targetLen minus the number of elements of args.
+ 7. Else, let L be 0.
+ 8. Perform ! SetFunctionLength(F, L).
+ [...]
+features: [Symbol]
+---*/
+
+function foo() {}
+
+Object.defineProperty(foo, "length", {value: undefined});
+assert.sameValue(foo.bind(null, 1).length, 0, "undefined");
+
+Object.defineProperty(foo, "length", {value: null});
+assert.sameValue(foo.bind(null, 1).length, 0, "null");
+
+Object.defineProperty(foo, "length", {value: true});
+assert.sameValue(foo.bind(null, 1).length, 0, "boolean");
+
+Object.defineProperty(foo, "length", {value: "1"});
+assert.sameValue(foo.bind(null, 1).length, 0, "string");
+
+Object.defineProperty(foo, "length", {value: Symbol("1")});
+assert.sameValue(foo.bind(null, 1).length, 0, "symbol");
+
+Object.defineProperty(foo, "length", {value: new Number(1)});
+assert.sameValue(foo.bind(null, 1).length, 0, "Number object");
+
+
+function bar() {}
+Object.setPrototypeOf(bar, {length: 42});
+assert(delete bar.length);
+
+var bound = Function.prototype.bind.call(bar, null, 1);
+assert.sameValue(bound.length, 0, "not own");
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Function/prototype/bind/instance-length-exceeds-int32.js b/js/src/tests/test262/built-ins/Function/prototype/bind/instance-length-exceeds-int32.js
new file mode 100644
index 0000000000..467b94edcf
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Function/prototype/bind/instance-length-exceeds-int32.js
@@ -0,0 +1,31 @@
+// Copyright (C) 2018 André Bargull. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-function.prototype.bind
+description: >
+ The target function length can exceed 2**31-1.
+info: |
+ 19.2.3.2 Function.prototype.bind ( thisArg, ...args )
+
+ ...
+ 6. If targetHasLength is true, then
+ a. Let targetLen be ? Get(Target, "length").
+ b. If Type(targetLen) is not Number, let L be 0.
+ c. Else,
+ i. Let targetLen be ToInteger(targetLen).
+ ii. Let L be the larger of 0 and the result of targetLen minus the number of elements of args.
+ ...
+ 8. Perform ! SetFunctionLength(F, L).
+ ...
+---*/
+
+function f(){}
+Object.defineProperty(f, "length", {value: 2147483648});
+
+assert.sameValue(f.bind().length, 2147483648);
+
+Object.defineProperty(f, "length", {value: Number.MAX_SAFE_INTEGER});
+assert.sameValue(f.bind().length, Number.MAX_SAFE_INTEGER);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Function/prototype/bind/instance-length-prop-desc.js b/js/src/tests/test262/built-ins/Function/prototype/bind/instance-length-prop-desc.js
new file mode 100644
index 0000000000..80f75b3b64
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Function/prototype/bind/instance-length-prop-desc.js
@@ -0,0 +1,32 @@
+// Copyright (c) 2012 Ecma International. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-function.prototype.bind
+description: >
+ "length" property of a bound function has correct descriptor.
+info: |
+ Function.prototype.bind ( thisArg, ...args )
+
+ [...]
+ 8. Perform ! SetFunctionLength(F, L).
+ [...]
+
+ SetFunctionLength ( F, length )
+
+ [...]
+ 4. Return ! DefinePropertyOrThrow(F, "length", PropertyDescriptor { [[Value]]:
+ length, [[Writable]]: false, [[Enumerable]]: false, [[Configurable]]: true }).
+includes: [propertyHelper.js]
+---*/
+
+function fn() {}
+
+verifyProperty(fn.bind(null), "length", {
+ value: 0,
+ writable: false,
+ enumerable: false,
+ configurable: true,
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Function/prototype/bind/instance-length-remaining-args.js b/js/src/tests/test262/built-ins/Function/prototype/bind/instance-length-remaining-args.js
new file mode 100644
index 0000000000..5a162187e6
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Function/prototype/bind/instance-length-remaining-args.js
@@ -0,0 +1,37 @@
+// Copyright (c) 2012 Ecma International. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-function.prototype.bind
+description: >
+ "length" value of a bound function is set to remaining number
+ of arguments expected by target function. Extra arguments are ignored.
+info: |
+ Function.prototype.bind ( thisArg, ...args )
+
+ [...]
+ 5. Let targetHasLength be ? HasOwnProperty(Target, "length").
+ 6. If targetHasLength is true, then
+ a. Let targetLen be ? Get(Target, "length").
+ b. If Type(targetLen) is not Number, let L be 0.
+ c. Else,
+ i. Set targetLen to ! ToInteger(targetLen).
+ ii. Let L be the larger of 0 and the result of targetLen minus the number of elements of args.
+ 7. Else, let L be 0.
+ 8. Perform ! SetFunctionLength(F, L).
+ [...]
+---*/
+
+function foo() {}
+
+assert.sameValue(foo.bind(null).length, 0, '0/0');
+assert.sameValue(foo.bind(null, 1).length, 0, '1/0');
+
+function bar(x, y) {}
+
+assert.sameValue(bar.bind(null).length, 2, '0/2');
+assert.sameValue(bar.bind(null, 1).length, 1, '1/2');
+assert.sameValue(bar.bind(null, 1, 2).length, 0, '2/2');
+assert.sameValue(bar.bind(null, 1, 2, 3).length, 0, '3/2');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Function/prototype/bind/instance-length-tointeger.js b/js/src/tests/test262/built-ins/Function/prototype/bind/instance-length-tointeger.js
new file mode 100644
index 0000000000..3d170b7222
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Function/prototype/bind/instance-length-tointeger.js
@@ -0,0 +1,59 @@
+// Copyright (C) 2020 Alexey Shvayka. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-function.prototype.bind
+description: >
+ "length" value of a bound function is non-negative integer.
+ ToInteger is performed on "length" value of target function.
+info: |
+ Function.prototype.bind ( thisArg, ...args )
+
+ [...]
+ 5. Let targetHasLength be ? HasOwnProperty(Target, "length").
+ 6. If targetHasLength is true, then
+ a. Let targetLen be ? Get(Target, "length").
+ b. If Type(targetLen) is Number, then
+ i. If targetLen is +∞𝔽, set L to +∞.
+ ii. Else if targetLen is -∞𝔽, set L to 0.
+ iii. Else,
+ 1. Let targetLenAsInt be ! ToIntegerOrInfinity(targetLen).
+ 2. Assert: targetLenAsInt is finite.
+ 3. Let argCount be the number of elements in args.
+ 4. Set L to max(targetLenAsInt - argCount, 0).
+ 7. Perform ! SetFunctionLength(F, L).
+ [...]
+
+ ToInteger ( argument )
+
+ 1. Let number be ? ToNumber(argument).
+ 2. If number is NaN, +0, or -0, return +0.
+ 3. If number is +∞ or -∞, return number.
+ 4. Let integer be the Number value that is the same sign as number and whose magnitude is floor(abs(number)).
+ 5. If integer is -0, return +0.
+ 6. Return integer.
+---*/
+
+function fn() {}
+
+Object.defineProperty(fn, "length", {value: NaN});
+assert.sameValue(fn.bind().length, 0);
+
+Object.defineProperty(fn, "length", {value: -0});
+assert.sameValue(fn.bind().length, 0);
+
+Object.defineProperty(fn, "length", {value: Infinity});
+assert.sameValue(fn.bind().length, Infinity, "target length of infinity, zero bound arguments");
+assert.sameValue(fn.bind(0, 0).length, Infinity, "target length of infinity, one bound argument");
+
+Object.defineProperty(fn, "length", {value: -Infinity});
+assert.sameValue(fn.bind().length, 0, "target length of negative infinity, zero bound arguments");
+assert.sameValue(fn.bind(0, 0).length, 0, "target length of negative infinity, one bound argument");
+
+Object.defineProperty(fn, "length", {value: 3.66});
+assert.sameValue(fn.bind().length, 3);
+
+Object.defineProperty(fn, "length", {value: -0.77});
+assert.sameValue(fn.bind().length, 0);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Function/prototype/bind/instance-name-chained.js b/js/src/tests/test262/built-ins/Function/prototype/bind/instance-name-chained.js
new file mode 100644
index 0000000000..71b5a26370
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Function/prototype/bind/instance-name-chained.js
@@ -0,0 +1,25 @@
+// Copyright (C) 2015 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+es6id: 19.2.3.2
+description: >
+ Assignment of function `name` attribute (previously-bound function)
+info: |
+ 12. Let targetName be Get(Target, "name").
+ 13. ReturnIfAbrupt(targetName).
+ 14. If Type(targetName) is not String, let targetName be the empty string.
+ 15. Perform SetFunctionName(F, targetName, "bound").
+includes: [propertyHelper.js]
+---*/
+
+var target = Object.defineProperty(function() {}, 'name', {
+ value: 'target'
+});
+
+assert.sameValue(target.bind().bind().name, 'bound bound target');
+verifyNotEnumerable(target.bind().bind(), 'name');
+verifyNotWritable(target.bind().bind(), 'name');
+verifyConfigurable(target.bind().bind(), 'name');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Function/prototype/bind/instance-name-error.js b/js/src/tests/test262/built-ins/Function/prototype/bind/instance-name-error.js
new file mode 100644
index 0000000000..a615b948ee
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Function/prototype/bind/instance-name-error.js
@@ -0,0 +1,22 @@
+// Copyright (C) 2015 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+es6id: 19.2.3.2
+description: Error thrown when accessing target's `name` property
+info: |
+ 12. Let targetName be Get(Target, "name").
+ 13. ReturnIfAbrupt(targetName).
+---*/
+
+var target = Object.defineProperty(function() {}, 'name', {
+ get: function() {
+ throw new Test262Error();
+ }
+});
+
+assert.throws(Test262Error, function() {
+ target.bind();
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Function/prototype/bind/instance-name-non-string.js b/js/src/tests/test262/built-ins/Function/prototype/bind/instance-name-non-string.js
new file mode 100644
index 0000000000..b09d83d0ad
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Function/prototype/bind/instance-name-non-string.js
@@ -0,0 +1,73 @@
+// Copyright (C) 2015 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+es6id: 19.2.3.2
+description: >
+ Assignment of function `name` attribute (target has non-string name)
+info: |
+ 12. Let targetName be Get(Target, "name").
+ 13. ReturnIfAbrupt(targetName).
+ 14. If Type(targetName) is not String, let targetName be the empty string.
+ 15. Perform SetFunctionName(F, targetName, "bound").
+includes: [propertyHelper.js]
+features: [Symbol]
+---*/
+
+var target;
+
+target = Object.defineProperty(function() {}, 'name', {
+ value: undefined
+});
+
+assert.sameValue(target.bind().name, 'bound ');
+verifyNotEnumerable(target.bind(), 'name');
+verifyNotWritable(target.bind(), 'name');
+verifyConfigurable(target.bind(), 'name');
+
+target = Object.defineProperty(function() {}, 'name', {
+ value: null
+});
+
+assert.sameValue(target.bind().name, 'bound ');
+verifyNotEnumerable(target.bind(), 'name');
+verifyNotWritable(target.bind(), 'name');
+verifyConfigurable(target.bind(), 'name');
+
+target = Object.defineProperty(function() {}, 'name', {
+ value: true
+});
+
+assert.sameValue(target.bind().name, 'bound ');
+verifyNotEnumerable(target.bind(), 'name');
+verifyNotWritable(target.bind(), 'name');
+verifyConfigurable(target.bind(), 'name');
+
+target = Object.defineProperty(function() {}, 'name', {
+ value: Symbol('s')
+});
+
+assert.sameValue(target.bind().name, 'bound ');
+verifyNotEnumerable(target.bind(), 'name');
+verifyNotWritable(target.bind(), 'name');
+verifyConfigurable(target.bind(), 'name');
+
+target = Object.defineProperty(function() {}, 'name', {
+ value: 23
+});
+
+assert.sameValue(target.bind().name, 'bound ');
+verifyNotEnumerable(target.bind(), 'name');
+verifyNotWritable(target.bind(), 'name');
+verifyConfigurable(target.bind(), 'name');
+
+target = Object.defineProperty(function() {}, 'name', {
+ value: {}
+});
+
+assert.sameValue(target.bind().name, 'bound ');
+verifyNotEnumerable(target.bind(), 'name');
+verifyNotWritable(target.bind(), 'name');
+verifyConfigurable(target.bind(), 'name');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Function/prototype/bind/instance-name.js b/js/src/tests/test262/built-ins/Function/prototype/bind/instance-name.js
new file mode 100644
index 0000000000..086669cdab
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Function/prototype/bind/instance-name.js
@@ -0,0 +1,24 @@
+// Copyright (C) 2015 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+es6id: 19.2.3.2
+description: Assignment of function `name` attribute
+info: |
+ 12. Let targetName be Get(Target, "name").
+ 13. ReturnIfAbrupt(targetName).
+ 14. If Type(targetName) is not String, let targetName be the empty string.
+ 15. Perform SetFunctionName(F, targetName, "bound").
+includes: [propertyHelper.js]
+---*/
+
+var target = Object.defineProperty(function() {}, 'name', {
+ value: 'target'
+});
+
+assert.sameValue(target.bind().name, 'bound target');
+verifyNotEnumerable(target.bind(), 'name');
+verifyNotWritable(target.bind(), 'name');
+verifyConfigurable(target.bind(), 'name');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Function/prototype/bind/length.js b/js/src/tests/test262/built-ins/Function/prototype/bind/length.js
new file mode 100644
index 0000000000..d3ac850bd7
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Function/prototype/bind/length.js
@@ -0,0 +1,31 @@
+// Copyright (C) 2020 Alexey Shvayka. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-function.prototype.bind
+description: >
+ Function.prototype.bind.length is 1.
+info: |
+ Function.prototype.bind ( thisArg, ...args )
+
+ ECMAScript Standard Built-in Objects
+
+ Every built-in function object, including constructors, has a "length" property whose
+ value is an integer. Unless otherwise specified, this value is equal to the largest
+ number of named arguments shown in the subclause headings for the function description.
+ Optional parameters (which are indicated with brackets: [ ]) or rest parameters (which
+ are shown using the form «...name») are not included in the default argument count.
+
+ Unless otherwise specified, the "length" property of a built-in function object has
+ the attributes { [[Writable]]: false, [[Enumerable]]: false, [[Configurable]]: true }.
+includes: [propertyHelper.js]
+---*/
+
+verifyProperty(Function.prototype.bind, "length", {
+ value: 1,
+ writable: false,
+ enumerable: false,
+ configurable: true,
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Function/prototype/bind/name.js b/js/src/tests/test262/built-ins/Function/prototype/bind/name.js
new file mode 100644
index 0000000000..d9f70e68a4
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Function/prototype/bind/name.js
@@ -0,0 +1,28 @@
+// Copyright (C) 2015 André Bargull. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+es6id: 19.2.3.2
+description: >
+ Function.prototype.bind.name is "bind".
+info: |
+ Function.prototype.bind ( thisArg , ...args)
+
+ 17 ECMAScript Standard Built-in Objects:
+ Every built-in Function object, including constructors, that is not
+ identified as an anonymous function has a name property whose value
+ is a String.
+
+ Unless otherwise specified, the name property of a built-in Function
+ object, if it exists, has the attributes { [[Writable]]: false,
+ [[Enumerable]]: false, [[Configurable]]: true }.
+includes: [propertyHelper.js]
+---*/
+
+assert.sameValue(Function.prototype.bind.name, "bind");
+
+verifyNotEnumerable(Function.prototype.bind, "name");
+verifyNotWritable(Function.prototype.bind, "name");
+verifyConfigurable(Function.prototype.bind, "name");
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Function/prototype/bind/not-a-constructor.js b/js/src/tests/test262/built-ins/Function/prototype/bind/not-a-constructor.js
new file mode 100644
index 0000000000..22f63d1ade
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Function/prototype/bind/not-a-constructor.js
@@ -0,0 +1,35 @@
+// Copyright (C) 2020 Rick Waldron. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-ecmascript-standard-built-in-objects
+description: >
+ Function.prototype.bind does not implement [[Construct]], is not new-able
+info: |
+ ECMAScript Function Objects
+
+ Built-in function objects that are not identified as constructors do not
+ implement the [[Construct]] internal method unless otherwise specified in
+ the description of a particular function.
+
+ sec-evaluatenew
+
+ ...
+ 7. If IsConstructor(constructor) is false, throw a TypeError exception.
+ ...
+includes: [isConstructor.js]
+features: [Reflect.construct, arrow-function]
+---*/
+
+assert.sameValue(
+ isConstructor(Function.prototype.bind),
+ false,
+ 'isConstructor(Function.prototype.bind) must return false'
+);
+
+assert.throws(TypeError, () => {
+ new Function.prototype.bind();
+}, '`new Function.prototype.bind()` throws TypeError');
+
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Function/prototype/bind/proto-from-ctor-realm.js b/js/src/tests/test262/built-ins/Function/prototype/bind/proto-from-ctor-realm.js
new file mode 100644
index 0000000000..ff5a980b22
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Function/prototype/bind/proto-from-ctor-realm.js
@@ -0,0 +1,31 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-bound-function-exotic-objects-construct-argumentslist-newtarget
+description: Default [[Prototype]] value derived from realm of the constructor
+info: |
+ [...]
+ 6. Return ? Construct(target, args, newTarget).
+
+ 9.1.14 GetPrototypeFromConstructor
+
+ [...]
+ 3. Let proto be ? Get(constructor, "prototype").
+ 4. If Type(proto) is not Object, then
+ a. Let realm be ? GetFunctionRealm(constructor).
+ b. Let proto be realm's intrinsic object named intrinsicDefaultProto.
+ [...]
+features: [cross-realm, Reflect]
+---*/
+
+var other = $262.createRealm().global;
+var C = new other.Function();
+C.prototype = null;
+
+var D = function() {}.bind();
+
+var d = Reflect.construct(D, [], C);
+
+assert.sameValue(Object.getPrototypeOf(d), other.Object.prototype);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Function/prototype/bind/shell.js b/js/src/tests/test262/built-ins/Function/prototype/bind/shell.js
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Function/prototype/bind/shell.js