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

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

Issue 418143007: FYI Implementing 'super' keyword (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Use private own symbol for [[HomeObject]] Created 6 years, 4 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') | test/mjsunit/runtime-gen/tomethod.js » ('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/regress/regress-int32-truncation.js b/test/mjsunit/harmony/toMethod.js
similarity index 74%
copy from test/mjsunit/regress/regress-int32-truncation.js
copy to test/mjsunit/harmony/toMethod.js
index dec4ac1195a6c4928d84eac8cc8dc9496bf66600..e07bb9b09184f7544235c31b14c2493bdb702740 100644
--- a/test/mjsunit/regress/regress-int32-truncation.js
+++ b/test/mjsunit/harmony/toMethod.js
@@ -24,38 +24,38 @@
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
+//
// Flags: --allow-natives-syntax
-function f(i, b) {
- var a = 0;
- if (b) {
- var c = 1 << i;
- a = c + c;
+
+(function () {
+ function f(x) {
+ var a = [0, 1, 2]
+ return a[x];
}
- var x = a >> 3;
- return a;
-}
-f(1, false);
-f(1, true);
-%OptimizeFunctionOnNextCall(f);
-assertEquals((1 << 30) * 2, f(30, true));
+ function ClassD() { }
+ assertEquals(1, f(1));
+ var g = %ToMethod(f, ClassD);
+ assertEquals(1, g(1));
+}());
-var global = 1;
-function f2(b) {
- var a = 0;
- if (b) {
- a = global;
+(function () {
+ function f(x) {
+ return function g(y) { x++; return x + y; };
}
- var x = a >> 3;
- return a;
-}
-
-f2(false);
-f2(true);
-%OptimizeFunctionOnNextCall(f2);
-global = 2.5;
-assertEquals(global, f2(true));
+
+ function Base() {}
+ function Derived() { }
+ Derived.prototype = Object.create(Base.prototype);
+
+ var q = f(0);
+ assertEquals(2, q(1));
+ assertEquals(3, q(1));
+ var g = %ToMethod(q, Derived);
+ assertFalse(g === q);
+ assertEquals(4, g(1));
+ assertEquals(5, q(1));
+}());
« no previous file with comments | « test/mjsunit/harmony/super.js ('k') | test/mjsunit/runtime-gen/tomethod.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698