Index: test/mjsunit/harmony/templates.js |
diff --git a/test/mjsunit/harmony/templates.js b/test/mjsunit/harmony/templates.js |
index 15ad9e92ca889762ce125cf05a3c811fad92a5f2..d86d26312e88d5dab65b4a7303de1538ea43d255 100644 |
--- a/test/mjsunit/harmony/templates.js |
+++ b/test/mjsunit/harmony/templates.js |
@@ -330,6 +330,43 @@ var obj = { |
})(); |
+(function testCallSiteCaching() { |
+ var callSites = []; |
+ function tag(cs) { callSites.push(cs); } |
+ var a = 1; |
+ var b = 2; |
+ |
+ tag`head${a}tail`; |
+ tag`head${b}tail`; |
+ |
+ assertEquals(2, callSites.length); |
+ assertSame(callSites[0], callSites[1]); |
+ |
+ eval("tag`head${a}tail`"); |
+ assertEquals(3, callSites.length); |
+ assertSame(callSites[1], callSites[2]); |
+ |
+ eval("tag`head${b}tail`"); |
+ assertEquals(4, callSites.length); |
+ assertSame(callSites[2], callSites[3]); |
+ |
+ (new Function("tag", "a", "b", "return tag`head${a}tail`;"))(tag, 1, 2); |
+ assertEquals(5, callSites.length); |
+ assertSame(callSites[3], callSites[4]); |
+ |
+ (new Function("tag", "a", "b", "return tag`head${b}tail`;"))(tag, 1, 2); |
+ assertEquals(6, callSites.length); |
+ assertSame(callSites[4], callSites[5]); |
+ |
+ callSites = []; |
+ |
+ tag`foo${a}bar`; |
+ tag`foo\${.}bar`; |
+ assertEquals(2, callSites[0].length); |
+ assertEquals(1, callSites[1].length); |
+})(); |
arv (Not doing code reviews)
2014/11/19 06:09:11
Maybe a test that has same values in the array but
|
+ |
+ |
(function testExtendedArrayPrototype() { |
Object.defineProperty(Array.prototype, 0, { |
set: function() { |