Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(355)

Unified Diff: test/mjsunit/harmony/toMethod.js

Issue 914713002: Remove Function.prototype.toMethod (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: extracted js perf test to a different cl Created 5 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « test/mjsunit/harmony/super.js ('k') | tools/gyp/v8.gyp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: test/mjsunit/harmony/toMethod.js
diff --git a/test/mjsunit/harmony/toMethod.js b/test/mjsunit/harmony/toMethod.js
index ad51b2ff3809001d159443c731408c86f3f36902..0466aa100c0aa48adaf971f45a74d257c3a984a7 100644
--- a/test/mjsunit/harmony/toMethod.js
+++ b/test/mjsunit/harmony/toMethod.js
@@ -5,6 +5,10 @@
// Flags: --harmony-classes --allow-natives-syntax
+// Function.prototype.toMethod was removed from the spec so this test
adamk 2015/02/10 21:27:29 I don't think this comment is helpful. git blame w
+// was modified to call the runtime function directly.
+
+
(function TestSingleClass() {
function f(x) {
var a = [0, 1, 2]
@@ -14,7 +18,7 @@
function ClassD() { }
assertEquals(1, f(1));
- var g = f.toMethod(ClassD.prototype);
+ var g = %ToMethod(f, ClassD.prototype);
assertEquals(1, g(1));
assertEquals(undefined, f[%HomeObjectSymbol()]);
assertEquals(ClassD.prototype, g[%HomeObjectSymbol()]);
@@ -33,22 +37,13 @@
var q = f(0);
assertEquals(2, q(1));
assertEquals(3, q(1));
- var g = q.toMethod(Derived.prototype);
+ var g = %ToMethod(q, Derived.prototype);
assertFalse(g === q);
assertEquals(4, g(1));
assertEquals(5, q(1));
}());
-(function TestErrorCases() {
- var sFun = Function.prototype.toMethod;
- assertThrows(function() { sFun.call({}); }, TypeError);
- assertThrows(function() { sFun.call({}, {}); }, TypeError);
- function f(){};
- assertThrows(function() { f.toMethod(1); }, TypeError);
-}());
-
-
(function TestPrototypeChain() {
var o = {};
var o1 = {};
@@ -56,11 +51,11 @@
function g() { }
- var fMeth = f.toMethod(o);
+ var fMeth = %ToMethod(f, o);
assertEquals(o, fMeth[%HomeObjectSymbol()]);
g.__proto__ = fMeth;
assertEquals(undefined, g[%HomeObjectSymbol()]);
- var gMeth = g.toMethod(o1);
+ var gMeth = %ToMethod(g, o1);
assertEquals(fMeth, gMeth.__proto__);
assertEquals(o, fMeth[%HomeObjectSymbol()]);
assertEquals(o1, gMeth[%HomeObjectSymbol()]);
@@ -82,7 +77,7 @@
}
var fBound = f.bind(o, 1, 2, 3);
- var fMeth = fBound.toMethod(p);
+ var fMeth = %ToMethod(fBound, p);
assertEquals(10, fMeth(4));
assertEquals(10, fMeth.call(p, 4));
var fBound1 = fBound.bind(o, 4);
@@ -100,7 +95,7 @@
assertEquals(15, f(o));
%OptimizeFunctionOnNextCall(f);
assertEquals(15, f(o));
- var g = f.toMethod({});
+ var g = %ToMethod(f, {});
var o1 = {y : 1024, x : "abc"};
assertEquals("abc", f(o1));
assertEquals("abc", g(o1));
@@ -110,6 +105,6 @@
function f() {}
Object.preventExtensions(f);
assertFalse(Object.isExtensible(f));
- var m = f.toMethod({});
+ var m = %ToMethod(f, {});
assertTrue(Object.isExtensible(m));
}());
« no previous file with comments | « test/mjsunit/harmony/super.js ('k') | tools/gyp/v8.gyp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698