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

Unified Diff: test/mjsunit/compiler/boolean-protototype.js

Issue 1409163007: [turbofan] We can inline property access for all primitives. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 years, 1 month 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 | « src/objects-inl.h ('k') | test/mjsunit/compiler/symbol-protototype.js » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: test/mjsunit/compiler/boolean-protototype.js
diff --git a/test/mjsunit/compiler/boolean-protototype.js b/test/mjsunit/compiler/boolean-protototype.js
new file mode 100644
index 0000000000000000000000000000000000000000..5e940d75aed53a3ec9eec678c4e1dfafb29d2d36
--- /dev/null
+++ b/test/mjsunit/compiler/boolean-protototype.js
@@ -0,0 +1,43 @@
+// Copyright 2015 the V8 project authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+// Flags: --allow-natives-syntax
+
+function test1(s) {
+ return s.toString;
+}
+assertSame(test1(false), Boolean.prototype.toString);
+assertSame(test1(true), Boolean.prototype.toString);
+%OptimizeFunctionOnNextCall(test1);
+assertSame(test1(false), Boolean.prototype.toString);
+assertSame(test1(true), Boolean.prototype.toString);
+
+function test2(s) {
+ return s.valueOf;
+}
+assertSame(test2(false), Boolean.prototype.valueOf);
+assertSame(test2(true), Boolean.prototype.valueOf);
+%OptimizeFunctionOnNextCall(test2);
+assertSame(test2(false), Boolean.prototype.valueOf);
+assertSame(test2(true), Boolean.prototype.valueOf);
+
+Boolean.prototype.foo = 42;
+function test3(s) {
+ return s["foo"];
+}
+assertEquals(test3(false), 42);
+assertEquals(test3(true), 42);
+%OptimizeFunctionOnNextCall(test3);
+assertEquals(test3(false), 42);
+assertEquals(test3(true), 42);
+
+Boolean.prototype.bar = function bar() { "use strict"; return this; }
+function test4(s) {
+ return s.bar();
+}
+assertEquals(test4(false), false);
+assertEquals(test4(true), true);
+%OptimizeFunctionOnNextCall(test4);
+assertEquals(test4(false), false);
+assertEquals(test4(true), true);
« no previous file with comments | « src/objects-inl.h ('k') | test/mjsunit/compiler/symbol-protototype.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698