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

Side by Side Diff: test/mjsunit/harmony/proxies-function.js

Issue 177683002: Mode clean-up pt 1: rename classic/non-strict mode to sloppy mode (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 6 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright 2011 the V8 project authors. All rights reserved. 1 // Copyright 2011 the V8 project authors. All rights reserved.
2 // Redistribution and use in source and binary forms, with or without 2 // Redistribution and use in source and binary forms, with or without
3 // modification, are permitted provided that the following conditions are 3 // modification, are permitted provided that the following conditions are
4 // met: 4 // met:
5 // 5 //
6 // * Redistributions of source code must retain the above copyright 6 // * Redistributions of source code must retain the above copyright
7 // notice, this list of conditions and the following disclaimer. 7 // notice, this list of conditions and the following disclaimer.
8 // * Redistributions in binary form must reproduce the above 8 // * Redistributions in binary form must reproduce the above
9 // copyright notice, this list of conditions and the following 9 // copyright notice, this list of conditions and the following
10 // disclaimer in the documentation and/or other materials provided 10 // disclaimer in the documentation and/or other materials provided
(...skipping 689 matching lines...) Expand 10 before | Expand all | Expand 10 after
700 function(f, x, y, o) { return %_CallFunction(o, x, y, f) }, 700 function(f, x, y, o) { return %_CallFunction(o, x, y, f) },
701 function(f, x, y, o) { return %Call(o, x, y, f) }, 701 function(f, x, y, o) { return %Call(o, x, y, f) },
702 function(f, x, y, o) { return %Apply(f, o, [null, x, y, null], 1, 2) }, 702 function(f, x, y, o) { return %Apply(f, o, [null, x, y, null], 1, 2) },
703 function(f, x, y, o) { return %Apply(f, o, arguments, 2, 2) }, 703 function(f, x, y, o) { return %Apply(f, o, arguments, 2, 2) },
704 function(f, x, y, o) { if (typeof o == "object") return o.f(x, y) }, 704 function(f, x, y, o) { if (typeof o == "object") return o.f(x, y) },
705 function(f, x, y, o) { if (typeof o == "object") return o["f"](x, y) }, 705 function(f, x, y, o) { if (typeof o == "object") return o["f"](x, y) },
706 function(f, x, y, o) { if (typeof o == "object") return (1, o).f(x, y) }, 706 function(f, x, y, o) { if (typeof o == "object") return (1, o).f(x, y) },
707 function(f, x, y, o) { if (typeof o == "object") return (1, o)["f"](x, y) }, 707 function(f, x, y, o) { if (typeof o == "object") return (1, o)["f"](x, y) },
708 ] 708 ]
709 var receivers = [o, global_object, undefined, null, 2, "bla", true] 709 var receivers = [o, global_object, undefined, null, 2, "bla", true]
710 var expectedNonStricts = [o, global_object, global_object, global_object] 710 var expectedSloppies = [o, global_object, global_object, global_object]
711 711
712 for (var t = 0; t < traps.length; ++t) { 712 for (var t = 0; t < traps.length; ++t) {
713 for (var i = 0; i < creates.length; ++i) { 713 for (var i = 0; i < creates.length; ++i) {
714 for (var j = 0; j < binds.length; ++j) { 714 for (var j = 0; j < binds.length; ++j) {
715 for (var k = 0; k < calls.length; ++k) { 715 for (var k = 0; k < calls.length; ++k) {
716 for (var m = 0; m < receivers.length; ++m) { 716 for (var m = 0; m < receivers.length; ++m) {
717 for (var n = 0; n < receivers.length; ++n) { 717 for (var n = 0; n < receivers.length; ++n) {
718 var bound = receivers[m] 718 var bound = receivers[m]
719 var receiver = receivers[n] 719 var receiver = receivers[n]
720 var func = binds[j](creates[i](traps[t]), bound, 31, 11) 720 var func = binds[j](creates[i](traps[t]), bound, 31, 11)
721 var expected = j > 0 ? bound : receiver 721 var expected = j > 0 ? bound : receiver
722 var expectedNonStrict = expectedNonStricts[j > 0 ? m : n] 722 var expectedSloppy = expectedSloppies[j > 0 ? m : n]
723 o.f = func 723 o.f = func
724 global_object.f = func 724 global_object.f = func
725 var x = calls[k](func, 11, 31, receiver) 725 var x = calls[k](func, 11, 31, receiver)
726 if (x !== undefined) { 726 if (x !== undefined) {
727 assertEquals(42, x.result) 727 assertEquals(42, x.result)
728 if (calls[k].length < 4) 728 if (calls[k].length < 4)
729 assertSame(x.strict ? undefined : global_object, x.receiver) 729 assertSame(x.strict ? undefined : global_object, x.receiver)
730 else if (x.strict) 730 else if (x.strict)
731 assertSame(expected, x.receiver) 731 assertSame(expected, x.receiver)
732 else if (expectedNonStrict === undefined) 732 else if (expectedSloppy === undefined)
733 assertSame(expected, x.receiver.valueOf()) 733 assertSame(expected, x.receiver.valueOf())
734 else 734 else
735 assertSame(expectedNonStrict, x.receiver) 735 assertSame(expectedSloppy, x.receiver)
736 } 736 }
737 } 737 }
738 } 738 }
739 } 739 }
740 } 740 }
741 } 741 }
742 } 742 }
743 } 743 }
744 744
745 TestCalls() 745 TestCalls()
(...skipping 19 matching lines...) Expand all
765 with (this) { 765 with (this) {
766 assertEquals(this, fp()); 766 assertEquals(this, fp());
767 assertEquals(this, gp()); 767 assertEquals(this, gp());
768 } 768 }
769 769
770 with ({}) { 770 with ({}) {
771 assertEquals(Realm.shared.fg, fp()); 771 assertEquals(Realm.shared.fg, fp());
772 assertEquals(Realm.shared.gg, gp()); 772 assertEquals(Realm.shared.gg, gp());
773 } 773 }
774 } 774 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698