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

Unified Diff: test/mjsunit/regress/regress-1412.js

Issue 7096006: Update apply with arguments optimization for strict mode functions and builtins. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Address review comments. Created 9 years, 7 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/bugs/bug-1412.js ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: test/mjsunit/regress/regress-1412.js
diff --git a/test/mjsunit/bugs/bug-1412.js b/test/mjsunit/regress/regress-1412.js
similarity index 66%
rename from test/mjsunit/bugs/bug-1412.js
rename to test/mjsunit/regress/regress-1412.js
index 8e700d5f6cc1d5125be8aa12a6b4c005d36a5ff8..b043f1900fccdbdaef22838ae8d680bb6374a824 100644
--- a/test/mjsunit/bugs/bug-1412.js
+++ b/test/mjsunit/regress/regress-1412.js
@@ -25,10 +25,35 @@
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-function f() { "use strict"; print(this); }
+// Test that the apply with arguments optimization passes values
+// unchanged to strict-mode functions and builtins.
-function g() { assertEquals(void 0, f.apply(undefined, arguments)); }
+// Flags: --allow-natives-syntax
-for (var i = 0; i < 10; i++) g();
-%OptimizeFunctionOnNextCall(g);
-g();
+function strict() { "use strict"; return this; }
+
+function test_strict() {
+ assertEquals(void 0, strict.apply(undefined, arguments));
+ assertEquals(42, strict.apply(42, arguments));
+ assertEquals("asdf", strict.apply("asdf", arguments));
+}
+
+for (var i = 0; i < 10; i++) test_strict();
+%OptimizeFunctionOnNextCall(test_strict);
+test_strict();
+
+function test_builtin(receiver) {
+ Object.prototype.valueOf.apply(receiver, arguments);
+}
+
+for (var i = 0; i < 10; i++) test_builtin(this);
+%OptimizeFunctionOnNextCall(test_builtin);
+test_builtin(this);
+
+var exception = false;
+try {
+ test_builtin(undefined);
+} catch(e) {
+ exception = true;
+}
+assertTrue(exception);
« no previous file with comments | « test/mjsunit/bugs/bug-1412.js ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698