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

Unified Diff: test/mjsunit/compiler/symbol-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 | « test/mjsunit/compiler/boolean-protototype.js ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: test/mjsunit/compiler/symbol-protototype.js
diff --git a/test/mjsunit/compiler/symbol-protototype.js b/test/mjsunit/compiler/symbol-protototype.js
new file mode 100644
index 0000000000000000000000000000000000000000..9a707e8a08caa28dcc929f4d73224cc04cb6f072
--- /dev/null
+++ b/test/mjsunit/compiler/symbol-protototype.js
@@ -0,0 +1,40 @@
+// 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(Symbol()), Symbol.prototype.toString);
+assertSame(test1(Symbol()), Symbol.prototype.toString);
+%OptimizeFunctionOnNextCall(test1);
+assertSame(test1(Symbol()), Symbol.prototype.toString);
+
+function test2(s) {
+ return s.valueOf;
+}
+assertSame(test2(Symbol()), Symbol.prototype.valueOf);
+assertSame(test2(Symbol()), Symbol.prototype.valueOf);
+%OptimizeFunctionOnNextCall(test2);
+assertSame(test2(Symbol()), Symbol.prototype.valueOf);
+
+Symbol.prototype.foo = 1;
+function test3(s) {
+ return s["foo"];
+}
+assertEquals(test3(Symbol()), 1);
+assertEquals(test3(Symbol()), 1);
+%OptimizeFunctionOnNextCall(test3);
+assertEquals(test3(Symbol()), 1);
+
+Symbol.prototype.bar = function() { "use strict"; return this; }
+function test4(s) {
+ return s.bar();
+}
+var s = Symbol("foo");
+assertEquals(test4(s), s);
+assertEquals(test4(s), s);
+%OptimizeFunctionOnNextCall(test4);
+assertEquals(test4(s), s);
« no previous file with comments | « test/mjsunit/compiler/boolean-protototype.js ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698