Index: test/mjsunit/keyed-array-call.js |
diff --git a/src/harmony-math.js b/test/mjsunit/keyed-array-call.js |
similarity index 67% |
copy from src/harmony-math.js |
copy to test/mjsunit/keyed-array-call.js |
index a4d3f2e8a5e9c5936630571644605402dee1199d..b97da3cf1b08511d05d41eb0f3e4a4b467702a3b 100644 |
--- a/src/harmony-math.js |
+++ b/test/mjsunit/keyed-array-call.js |
@@ -25,36 +25,32 @@ |
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
-'use strict'; |
- |
-// ES6 draft 09-27-13, section 20.2.2.28. |
-function MathSign(x) { |
- x = TO_NUMBER_INLINE(x); |
- if (x > 0) return 1; |
- if (x < 0) return -1; |
- if (x === 0) return x; |
- return NAN; |
+var a = [function(a) { return a+10; }, |
+ function(a) { return a+20; }]; |
+a.__proto__.test = function(a) { return a+30; } |
+function f(i) { |
+ return "r" + (1, a[i](i+1), a[i](i+2)); |
} |
+assertEquals("r12", f(0)); |
+assertEquals("r12", f(0)); |
+assertEquals("r23", f(1)); |
+assertEquals("r23", f(1)); |
-// ES6 draft 09-27-13, section 20.2.2.34. |
-function MathTrunc(x) { |
- x = TO_NUMBER_INLINE(x); |
- if (x > 0) return MathFloor(x); |
- if (x < 0) return MathCeil(x); |
- if (x === 0) return x; |
- return NAN; |
-} |
- |
+// Deopt the stub. |
+assertEquals("rtest230", f("test")); |
-function ExtendMath() { |
- %CheckIsBootstrapping(); |
- |
- // Set up the non-enumerable functions on the Math object. |
- InstallFunctions($Math, DONT_ENUM, $Array( |
- "sign", MathSign, |
- "trunc", MathTrunc |
- )); |
+var a2 = [function(a) { return a+10; },, |
+ function(a) { return a+20; }]; |
+a2.__proto__.test = function(a) { return a+30; } |
+function f2(i) { |
+ return "r" + (1, a2[i](i+1), a2[i](i+2)); |
} |
-ExtendMath(); |
+assertEquals("r12", f2(0)); |
+assertEquals("r12", f2(0)); |
+assertEquals("r24", f2(2)); |
+assertEquals("r24", f2(2)); |
+ |
+// Deopt the stub. This will throw given that undefined is not a function. |
+assertThrows(function() { f2(1) }); |