[JSC] cache TaggedTemplate arrays by callsite rather than by contents
authorcaitp@igalia.com <caitp@igalia.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 13 Feb 2018 18:10:30 +0000 (18:10 +0000)
committercaitp@igalia.com <caitp@igalia.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 13 Feb 2018 18:10:30 +0000 (18:10 +0000)
https://bugs.webkit.org/show_bug.cgi?id=182717

Reviewed by Yusuke Suzuki.

https://github.com/tc39/ecma262/pull/890 imposes a change to template
literals, to allow template callsite arrays to be collected when the
code containing the tagged template call is collected. This spec change
has received concensus and been ratified.

This change eliminates the eternal map associating template contents
with arrays.

JSTests:

* stress/tagged-template-object-collect.js: Renamed from JSTests/stress/tagged-template-registry-key-collect.js.
* stress/tagged-template-object.js: Renamed from JSTests/stress/tagged-template-registry-key.js.
* stress/tagged-templates-identity.js:
* stress/template-string-tags-eval.js:
* test262.yaml:

Source/JavaScriptCore:

* CMakeLists.txt:
* JavaScriptCore.xcodeproj/project.pbxproj:
* Sources.txt:
* bytecode/CodeBlock.cpp:
(JSC::CodeBlock::setConstantRegisters):
* bytecode/DirectEvalCodeCache.cpp:
(JSC::DirectEvalCodeCache::setSlow):
* bytecode/UnlinkedCodeBlock.cpp:
(JSC::UnlinkedCodeBlock::UnlinkedCodeBlock):
* bytecode/UnlinkedCodeBlock.h:
(JSC::UnlinkedCodeBlock::allowDirectEvalCache const):
* bytecompiler/BytecodeGenerator.cpp:
(JSC::BytecodeGenerator::addTemplateObjectConstant):
(JSC::BytecodeGenerator::emitGetTemplateObject):
(JSC::BytecodeGenerator::addTemplateRegistryKeyConstant): Deleted.
* bytecompiler/BytecodeGenerator.h:
* parser/Parser.cpp:
(JSC::Parser<LexerType>::parseInner):
(JSC::Parser<LexerType>::parseMemberExpression):
* parser/Parser.h:
* parser/ParserModes.h:
* runtime/EvalExecutable.h:
(JSC::EvalExecutable::allowDirectEvalCache const):
* runtime/JSGlobalObject.cpp:
(JSC::JSGlobalObject::JSGlobalObject):
* runtime/JSGlobalObject.h:
(JSC::JSGlobalObject::templateRegistry): Deleted.
* runtime/JSTemplateObjectDescriptor.cpp: Renamed from Source/JavaScriptCore/runtime/TemplateRegistry.cpp.
(JSC::JSTemplateObjectDescriptor::JSTemplateObjectDescriptor):
(JSC::JSTemplateObjectDescriptor::create):
(JSC::JSTemplateObjectDescriptor::destroy):
(JSC::JSTemplateObjectDescriptor::createTemplateObject):
* runtime/JSTemplateObjectDescriptor.h: Renamed from Source/JavaScriptCore/runtime/JSTemplateRegistryKey.h.
(JSC::isTemplateObjectDescriptor):
* runtime/JSTemplateRegistryKey.cpp: Removed.
* runtime/TemplateObjectDescriptor.cpp: Renamed from Source/JavaScriptCore/runtime/TemplateRegistryKey.cpp.
(JSC::TemplateObjectDescriptor::~TemplateObjectDescriptor):
* runtime/TemplateObjectDescriptor.h: Renamed from Source/JavaScriptCore/runtime/TemplateRegistryKey.h.
(JSC::TemplateObjectDescriptor::operator== const):
(JSC::TemplateObjectDescriptor::operator!= const):
(JSC::TemplateObjectDescriptor::Hasher::hash):
(JSC::TemplateObjectDescriptor::Hasher::equal):
(JSC::TemplateObjectDescriptor::create):
(JSC::TemplateObjectDescriptor::TemplateObjectDescriptor):
(JSC::TemplateObjectDescriptor::calculateHash):
* runtime/TemplateRegistry.h: Removed.
* runtime/TemplateRegistryKeyTable.cpp: Removed.
* runtime/TemplateRegistryKeyTable.h: Removed.
* runtime/VM.cpp:
(JSC::VM::VM):
* runtime/VM.h:
(JSC::VM::templateRegistryKeyTable): Deleted.
* runtime/VMEntryScope.cpp:

* CMakeLists.txt:
* JavaScriptCore.xcodeproj/project.pbxproj:
* Sources.txt:
* bytecode/CodeBlock.cpp:
(JSC::CodeBlock::setConstantRegisters):
* bytecode/DirectEvalCodeCache.cpp:
(JSC::DirectEvalCodeCache::setSlow):
* bytecode/UnlinkedCodeBlock.h:
(JSC::UnlinkedCodeBlock::allowDirectEvalCache const):
* bytecompiler/BytecodeGenerator.cpp:
(JSC::BytecodeGenerator::addTemplateObjectConstant):
(JSC::BytecodeGenerator::emitGetTemplateObject):
(JSC::BytecodeGenerator::addTemplateRegistryKeyConstant): Deleted.
* bytecompiler/BytecodeGenerator.h:
* parser/Parser.cpp:
(JSC::Parser<LexerType>::parseInner):
(JSC::Parser<LexerType>::parseMemberExpression):
* parser/Parser.h:
* parser/ParserModes.h:
* runtime/EvalExecutable.h:
(JSC::EvalExecutable::allowDirectEvalCache const):
* runtime/JSGlobalObject.cpp:
(JSC::JSGlobalObject::JSGlobalObject):
* runtime/JSGlobalObject.h:
(JSC::JSGlobalObject::templateRegistry): Deleted.
* runtime/JSTemplateObjectDescriptor.cpp: Renamed from Source/JavaScriptCore/runtime/TemplateRegistry.cpp.
(JSC::JSTemplateObjectDescriptor::JSTemplateObjectDescriptor):
(JSC::JSTemplateObjectDescriptor::create):
(JSC::JSTemplateObjectDescriptor::destroy):
(JSC::JSTemplateObjectDescriptor::createTemplateObject):
* runtime/JSTemplateObjectDescriptor.h: Renamed from Source/JavaScriptCore/runtime/JSTemplateRegistryKey.h.
(JSC::isTemplateObjectDescriptor):
* runtime/JSTemplateRegistryKey.cpp: Removed.
* runtime/TemplateObjectDescriptor.cpp: Renamed from Source/JavaScriptCore/runtime/TemplateRegistryKey.cpp.
(JSC::TemplateObjectDescriptor::~TemplateObjectDescriptor):
* runtime/TemplateObjectDescriptor.h: Renamed from Source/JavaScriptCore/runtime/TemplateRegistryKey.h.
(JSC::TemplateObjectDescriptor::operator== const):
(JSC::TemplateObjectDescriptor::operator!= const):
(JSC::TemplateObjectDescriptor::Hasher::hash):
(JSC::TemplateObjectDescriptor::Hasher::equal):
(JSC::TemplateObjectDescriptor::create):
(JSC::TemplateObjectDescriptor::TemplateObjectDescriptor):
(JSC::TemplateObjectDescriptor::calculateHash):
* runtime/TemplateRegistry.h: Removed.
* runtime/TemplateRegistryKeyTable.cpp: Removed.
* runtime/TemplateRegistryKeyTable.h: Removed.
* runtime/VM.cpp:
(JSC::VM::VM):
* runtime/VM.h:
(JSC::VM::templateRegistryKeyTable): Deleted.
* runtime/VMEntryScope.cpp:

* CMakeLists.txt:
* JavaScriptCore.xcodeproj/project.pbxproj:
* Sources.txt:
* bytecode/CodeBlock.cpp:
(JSC::CodeBlock::setConstantRegisters):
* bytecode/DirectEvalCodeCache.cpp:
(JSC::DirectEvalCodeCache::setSlow):
* bytecode/UnlinkedCodeBlock.h:
(JSC::UnlinkedCodeBlock::allowDirectEvalCache const):
* bytecompiler/BytecodeGenerator.cpp:
(JSC::BytecodeGenerator::addTemplateObjectConstant):
(JSC::BytecodeGenerator::emitGetTemplateObject):
(JSC::BytecodeGenerator::addTemplateRegistryKeyConstant): Deleted.
* bytecompiler/BytecodeGenerator.h:
* parser/Parser.cpp:
(JSC::Parser<LexerType>::parseInner):
(JSC::Parser<LexerType>::parseMemberExpression):
* parser/Parser.h:
* parser/ParserModes.h:
* runtime/EvalExecutable.h:
(JSC::EvalExecutable::allowDirectEvalCache const):
* runtime/JSGlobalObject.cpp:
(JSC::JSGlobalObject::JSGlobalObject):
* runtime/JSGlobalObject.h:
(JSC::JSGlobalObject::templateRegistry): Deleted.
* runtime/JSTemplateObjectDescriptor.cpp: Renamed from Source/JavaScriptCore/runtime/TemplateRegistry.cpp.
(JSC::JSTemplateObjectDescriptor::JSTemplateObjectDescriptor):
(JSC::JSTemplateObjectDescriptor::create):
(JSC::JSTemplateObjectDescriptor::destroy):
(JSC::JSTemplateObjectDescriptor::createTemplateObject):
* runtime/JSTemplateObjectDescriptor.h: Renamed from Source/JavaScriptCore/runtime/JSTemplateRegistryKey.h.
(JSC::isTemplateObjectDescriptor):
* runtime/JSTemplateRegistryKey.cpp: Removed.
* runtime/TemplateObjectDescriptor.cpp: Renamed from Source/JavaScriptCore/runtime/TemplateRegistryKey.cpp.
(JSC::TemplateObjectDescriptor::~TemplateObjectDescriptor):
* runtime/TemplateObjectDescriptor.h: Renamed from Source/JavaScriptCore/runtime/TemplateRegistryKey.h.
(JSC::TemplateObjectDescriptor::operator== const):
(JSC::TemplateObjectDescriptor::operator!= const):
(JSC::TemplateObjectDescriptor::Hasher::hash):
(JSC::TemplateObjectDescriptor::Hasher::equal):
(JSC::TemplateObjectDescriptor::create):
(JSC::TemplateObjectDescriptor::TemplateObjectDescriptor):
(JSC::TemplateObjectDescriptor::calculateHash):
* runtime/TemplateRegistry.h: Removed.
* runtime/TemplateRegistryKeyTable.cpp: Removed.
* runtime/TemplateRegistryKeyTable.h: Removed.
* runtime/VM.cpp:
(JSC::VM::VM):
* runtime/VM.h:
(JSC::VM::templateRegistryKeyTable): Deleted.
* runtime/VMEntryScope.cpp:

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@228422 268f45cc-cd09-0410-ab3c-d52691b4dbfc

32 files changed:
JSTests/ChangeLog
JSTests/stress/tagged-template-object-collect.js [moved from JSTests/stress/tagged-template-registry-key-collect.js with 100% similarity]
JSTests/stress/tagged-template-object.js [moved from JSTests/stress/tagged-template-registry-key.js with 81% similarity]
JSTests/stress/tagged-templates-identity.js
JSTests/stress/template-string-tags-eval.js
JSTests/test262.yaml
Source/JavaScriptCore/CMakeLists.txt
Source/JavaScriptCore/ChangeLog
Source/JavaScriptCore/JavaScriptCore.xcodeproj/project.pbxproj
Source/JavaScriptCore/Sources.txt
Source/JavaScriptCore/bytecode/CodeBlock.cpp
Source/JavaScriptCore/bytecode/DirectEvalCodeCache.cpp
Source/JavaScriptCore/bytecode/UnlinkedCodeBlock.h
Source/JavaScriptCore/bytecompiler/BytecodeGenerator.cpp
Source/JavaScriptCore/bytecompiler/BytecodeGenerator.h
Source/JavaScriptCore/parser/Parser.cpp
Source/JavaScriptCore/parser/Parser.h
Source/JavaScriptCore/parser/ParserModes.h
Source/JavaScriptCore/runtime/EvalExecutable.h
Source/JavaScriptCore/runtime/JSGlobalObject.cpp
Source/JavaScriptCore/runtime/JSGlobalObject.h
Source/JavaScriptCore/runtime/JSTemplateObjectDescriptor.cpp [moved from Source/JavaScriptCore/runtime/TemplateRegistry.cpp with 66% similarity]
Source/JavaScriptCore/runtime/JSTemplateObjectDescriptor.h [moved from Source/JavaScriptCore/runtime/JSTemplateRegistryKey.h with 73% similarity]
Source/JavaScriptCore/runtime/JSTemplateRegistryKey.cpp [deleted file]
Source/JavaScriptCore/runtime/TemplateObjectDescriptor.cpp [moved from Source/JavaScriptCore/runtime/TemplateRegistryKey.cpp with 89% similarity]
Source/JavaScriptCore/runtime/TemplateObjectDescriptor.h [moved from Source/JavaScriptCore/runtime/TemplateRegistryKey.h with 65% similarity]
Source/JavaScriptCore/runtime/TemplateRegistry.h [deleted file]
Source/JavaScriptCore/runtime/TemplateRegistryKeyTable.cpp [deleted file]
Source/JavaScriptCore/runtime/TemplateRegistryKeyTable.h [deleted file]
Source/JavaScriptCore/runtime/VM.cpp
Source/JavaScriptCore/runtime/VM.h
Source/JavaScriptCore/runtime/VMEntryScope.cpp

index aef1e27..e132766 100644 (file)
@@ -1,3 +1,24 @@
+2018-02-13  Caitlin Potter  <caitp@igalia.com>
+
+        [JSC] cache TaggedTemplate arrays by callsite rather than by contents
+        https://bugs.webkit.org/show_bug.cgi?id=182717
+
+        Reviewed by Yusuke Suzuki.
+
+        https://github.com/tc39/ecma262/pull/890 imposes a change to template
+        literals, to allow template callsite arrays to be collected when the
+        code containing the tagged template call is collected. This spec change
+        has received concensus and been ratified.
+
+        This change eliminates the eternal map associating template contents
+        with arrays.
+
+        * stress/tagged-template-object-collect.js: Renamed from JSTests/stress/tagged-template-registry-key-collect.js.
+        * stress/tagged-template-object.js: Renamed from JSTests/stress/tagged-template-registry-key.js.
+        * stress/tagged-templates-identity.js:
+        * stress/template-string-tags-eval.js:
+        * test262.yaml:
+
 2018-02-13  Yusuke Suzuki  <utatane.tea@gmail.com>
 
         Support GetArrayLength on ArrayStorage in the FTL
similarity index 81%
rename from JSTests/stress/tagged-template-registry-key.js
rename to JSTests/stress/tagged-template-object.js
index aeb8775..f2c5114 100644 (file)
@@ -17,9 +17,9 @@ function tag(site)
         return tag`Hello`;
     }
 
-    shouldBe(a() === b(), true);
+    shouldBe(a() === b(), false);
     gc();
     var tagA = a();
     gc();
-    shouldBe(tagA === b(), true);
+    shouldBe(tagA === b(), false);
 }
index 302d031..2ab5c7b 100644 (file)
@@ -13,7 +13,7 @@ tag`World`;
 tag`Hello`;
 shouldBe(templates.length, 3);
 shouldBe(templates[0] !== templates[1], true);
-shouldBe(templates[0] === templates[2], true);
+shouldBe(templates[0] !== templates[2], true);
 
 templates = [];
 tag`Hello\n`;
@@ -28,7 +28,7 @@ eval("tag`Hello\n`");
 eval("tag`Hello\r`");
 eval("tag`Hello\u2028`");
 shouldBe(templates.length, 3);
-shouldBe(templates[0] === templates[1], true);
+shouldBe(templates[0] !== templates[1], true);
 shouldBe(templates[0] !== templates[2], true);
 
 templates = [];
@@ -38,7 +38,7 @@ eval("tag`Hello\r`");
 eval("tag`Hello\\r`");
 shouldBe(templates.length, 4);
 shouldBe(templates[0] !== templates[1], true);
-shouldBe(templates[0] === templates[2], true);
+shouldBe(templates[0] !== templates[2], true);
 shouldBe(templates[0] !== templates[3], true);
 shouldBe(templates[1] !== templates[2], true);
 shouldBe(templates[1] !== templates[3], true);
@@ -49,7 +49,7 @@ templates = [];
 eval("tag`Hello\n${v}world`");
 eval("tag`Hello\n${v}world`");
 shouldBe(templates.length, 2);
-shouldBe(templates[0] === templates[1], true);
+shouldBe(templates[0] !== templates[1], true);
 
 var v = 0;
 templates = [];
@@ -57,3 +57,85 @@ eval("tag`Hello${v}\nworld`");
 eval("tag`Hello\n${v}world`");
 shouldBe(templates.length, 2);
 shouldBe(templates[0] !== templates[1], true);
+
+var v = 0;
+templates = [];
+for (v = 0; v < 3; ++v) {
+    tag`Hello${v}world`;
+    if (!v) continue;
+    shouldBe(templates[v] === templates[v - 1], true);
+}
+
+templates = [];
+tag`Hello${1}world`;
+tag`Hello${2}world`;
+shouldBe(templates[0] !== templates[1], true);
+
+// Disable eval caching if a tagged template occurs in eval code
+var v = 0;
+templates = [];
+for (v = 0; v < 3; ++v) {
+    eval("tag`Hello${v}world`");
+    if (!v) continue;
+    shouldBe(templates[v] !== templates[v - 1], true);
+}
+
+templates = [];
+eval("tag`Hello${1}world`");
+eval("tag`Hello${2}world`");
+eval("tag`Hello${3}world`");
+shouldBe(templates[0] !== templates[1], true);
+shouldBe(templates[1] !== templates[2], true);
+
+
+// Disable eval caching if a tagged template occurs in a nested function
+var v = 0;
+templates = [];
+for (v = 0; v < 6; v += 2) {
+    eval("(function() { for (var i = 0; i < 2; ++i) tag`Hello${v}world` })()");
+    shouldBe(templates[v] === templates[v + 1], true);
+}
+
+shouldBe(templates[0] !== templates[2], true);
+shouldBe(templates[0] !== templates[4], true);
+shouldBe(templates[1] !== templates[3], true);
+shouldBe(templates[1] !== templates[5], true);
+shouldBe(templates[2] !== templates[4], true);
+shouldBe(templates[3] !== templates[5], true);
+
+templates = [];
+eval("(function() { for (var i = 0; i < 2; ++i) tag`Hello${1}world` })()");
+eval("(function() { for (var i = 0; i < 2; ++i) tag`Hello${2}world` })()");
+eval("(function() { for (var i = 0; i < 2; ++i) tag`Hello${2}world` })()");
+shouldBe(templates[0] === templates[1], true);
+shouldBe(templates[0] !== templates[2], true);
+shouldBe(templates[0] !== templates[4], true);
+shouldBe(templates[1] !== templates[3], true);
+shouldBe(templates[1] !== templates[5], true);
+shouldBe(templates[2] === templates[3], true);
+shouldBe(templates[2] !== templates[4], true);
+shouldBe(templates[3] !== templates[5], true);
+shouldBe(templates[4] === templates[5], true);
+
+// Disable eval caching if a tagged template occurs in an even deeper nested function
+var v = 0;
+templates = [];
+for (v = 0; v < 3; ++v) {
+    eval("(function() { (function() { tag`Hello${v}world` })() })()");
+    if (!v) continue;
+    shouldBe(templates[v] !== templates[v - 1], true);
+}
+
+templates = [];
+eval("(function() { (function() { for (var i = 0; i < 2; ++i) tag`Hello${1}world` })() })()");
+eval("(function() { (function() { for (var i = 0; i < 2; ++i) tag`Hello${2}world` })() })()");
+eval("(function() { (function() { for (var i = 0; i < 2; ++i) tag`Hello${2}world` })() })()");
+shouldBe(templates[0] === templates[1], true);
+shouldBe(templates[0] !== templates[2], true);
+shouldBe(templates[0] !== templates[4], true);
+shouldBe(templates[1] !== templates[3], true);
+shouldBe(templates[1] !== templates[5], true);
+shouldBe(templates[2] === templates[3], true);
+shouldBe(templates[2] !== templates[4], true);
+shouldBe(templates[3] !== templates[5], true);
+shouldBe(templates[4] === templates[5], true);
index 416ed6a..42bff1e 100644 (file)
@@ -13,5 +13,5 @@ var site1 = eval("0, tag`Cocoa`");
 var site2 = eval("1, tag`Cappuccino`");
 var site3 = eval("2, tag`Cocoa`");
 
-shouldBe(site1 === site3, true);
+shouldBe(site1 !== site3, true);
 shouldBe(site1 !== site2, true);
index 4dbebb2..763633f 100644 (file)
 - path: test262/test/language/expressions/tagged-template/cache-different-functions-same-site.js
   cmd: runTest262 :normal, "NoException", ["../../../../harness/assert.js", "../../../../harness/sta.js"], [:strict]
 - path: test262/test/language/expressions/tagged-template/cache-differing-expressions-eval.js
-  cmd: runTest262 :fail, "NoException", ["../../../../harness/assert.js", "../../../../harness/sta.js"], []
+  cmd: runTest262 :normal, "NoException", ["../../../../harness/assert.js", "../../../../harness/sta.js"], []
 - path: test262/test/language/expressions/tagged-template/cache-differing-expressions-eval.js
-  cmd: runTest262 :fail, "NoException", ["../../../../harness/assert.js", "../../../../harness/sta.js"], [:strict]
+  cmd: runTest262 :normal, "NoException", ["../../../../harness/assert.js", "../../../../harness/sta.js"], [:strict]
 - path: test262/test/language/expressions/tagged-template/cache-differing-expressions-new-function.js
-  cmd: runTest262 :fail, "NoException", ["../../../../harness/assert.js", "../../../../harness/sta.js"], []
+  cmd: runTest262 :normal, "NoException", ["../../../../harness/assert.js", "../../../../harness/sta.js"], []
 - path: test262/test/language/expressions/tagged-template/cache-differing-expressions-new-function.js
-  cmd: runTest262 :fail, "NoException", ["../../../../harness/assert.js", "../../../../harness/sta.js"], [:strict]
+  cmd: runTest262 :normal, "NoException", ["../../../../harness/assert.js", "../../../../harness/sta.js"], [:strict]
 - path: test262/test/language/expressions/tagged-template/cache-differing-expressions.js
-  cmd: runTest262 :fail, "NoException", ["../../../../harness/assert.js", "../../../../harness/sta.js"], []
+  cmd: runTest262 :normal, "NoException", ["../../../../harness/assert.js", "../../../../harness/sta.js"], []
 - path: test262/test/language/expressions/tagged-template/cache-differing-expressions.js
-  cmd: runTest262 :fail, "NoException", ["../../../../harness/assert.js", "../../../../harness/sta.js"], [:strict]
+  cmd: runTest262 :normal, "NoException", ["../../../../harness/assert.js", "../../../../harness/sta.js"], [:strict]
 - path: test262/test/language/expressions/tagged-template/cache-differing-raw-strings.js
   cmd: runTest262 :normal, "NoException", ["../../../../harness/assert.js", "../../../../harness/sta.js"], []
 - path: test262/test/language/expressions/tagged-template/cache-differing-raw-strings.js
 - path: test262/test/language/expressions/tagged-template/cache-differing-string-count.js
   cmd: runTest262 :normal, "NoException", ["../../../../harness/assert.js", "../../../../harness/sta.js"], [:strict]
 - path: test262/test/language/expressions/tagged-template/cache-identical-source-eval.js
-  cmd: runTest262 :fail, "NoException", ["../../../../harness/assert.js", "../../../../harness/sta.js"], []
+  cmd: runTest262 :normal, "NoException", ["../../../../harness/assert.js", "../../../../harness/sta.js"], []
 - path: test262/test/language/expressions/tagged-template/cache-identical-source-eval.js
-  cmd: runTest262 :fail, "NoException", ["../../../../harness/assert.js", "../../../../harness/sta.js"], [:strict]
+  cmd: runTest262 :normal, "NoException", ["../../../../harness/assert.js", "../../../../harness/sta.js"], [:strict]
 - path: test262/test/language/expressions/tagged-template/cache-identical-source-new-function.js
-  cmd: runTest262 :fail, "NoException", ["../../../../harness/assert.js", "../../../../harness/sta.js"], []
+  cmd: runTest262 :normal, "NoException", ["../../../../harness/assert.js", "../../../../harness/sta.js"], []
 - path: test262/test/language/expressions/tagged-template/cache-identical-source-new-function.js
-  cmd: runTest262 :fail, "NoException", ["../../../../harness/assert.js", "../../../../harness/sta.js"], [:strict]
+  cmd: runTest262 :normal, "NoException", ["../../../../harness/assert.js", "../../../../harness/sta.js"], [:strict]
 - path: test262/test/language/expressions/tagged-template/cache-identical-source.js
-  cmd: runTest262 :fail, "NoException", ["../../../../harness/assert.js", "../../../../harness/sta.js"], []
+  cmd: runTest262 :normal, "NoException", ["../../../../harness/assert.js", "../../../../harness/sta.js"], []
 - path: test262/test/language/expressions/tagged-template/cache-identical-source.js
-  cmd: runTest262 :fail, "NoException", ["../../../../harness/assert.js", "../../../../harness/sta.js"], [:strict]
+  cmd: runTest262 :normal, "NoException", ["../../../../harness/assert.js", "../../../../harness/sta.js"], [:strict]
 - path: test262/test/language/expressions/tagged-template/cache-realm.js
   cmd: runTest262 :normal, "NoException", ["../../../../harness/assert.js", "../../../../harness/sta.js"], []
 - path: test262/test/language/expressions/tagged-template/cache-realm.js
index 660ce8d..067b86a 100644 (file)
@@ -858,9 +858,7 @@ set(JavaScriptCore_FORWARDING_HEADERS
     runtime/Symbol.h
     runtime/SymbolPrototype.h
     runtime/SymbolTable.h
-    runtime/TemplateRegistry.h
-    runtime/TemplateRegistryKey.h
-    runtime/TemplateRegistryKeyTable.h
+    runtime/TemplateObjectDescriptor.h
     runtime/TestRunnerUtils.h
     runtime/ThrowScope.h
     runtime/ToNativeFromValue.h
index 615686c..b601f0f 100644 (file)
@@ -1,3 +1,176 @@
+2018-02-13  Caitlin Potter  <caitp@igalia.com>
+
+        [JSC] cache TaggedTemplate arrays by callsite rather than by contents
+        https://bugs.webkit.org/show_bug.cgi?id=182717
+
+        Reviewed by Yusuke Suzuki.
+
+        https://github.com/tc39/ecma262/pull/890 imposes a change to template
+        literals, to allow template callsite arrays to be collected when the
+        code containing the tagged template call is collected. This spec change
+        has received concensus and been ratified.
+
+        This change eliminates the eternal map associating template contents
+        with arrays.
+
+        * CMakeLists.txt:
+        * JavaScriptCore.xcodeproj/project.pbxproj:
+        * Sources.txt:
+        * bytecode/CodeBlock.cpp:
+        (JSC::CodeBlock::setConstantRegisters):
+        * bytecode/DirectEvalCodeCache.cpp:
+        (JSC::DirectEvalCodeCache::setSlow):
+        * bytecode/UnlinkedCodeBlock.cpp:
+        (JSC::UnlinkedCodeBlock::UnlinkedCodeBlock):
+        * bytecode/UnlinkedCodeBlock.h:
+        (JSC::UnlinkedCodeBlock::allowDirectEvalCache const):
+        * bytecompiler/BytecodeGenerator.cpp:
+        (JSC::BytecodeGenerator::addTemplateObjectConstant):
+        (JSC::BytecodeGenerator::emitGetTemplateObject):
+        (JSC::BytecodeGenerator::addTemplateRegistryKeyConstant): Deleted.
+        * bytecompiler/BytecodeGenerator.h:
+        * parser/Parser.cpp:
+        (JSC::Parser<LexerType>::parseInner):
+        (JSC::Parser<LexerType>::parseMemberExpression):
+        * parser/Parser.h:
+        * parser/ParserModes.h:
+        * runtime/EvalExecutable.h:
+        (JSC::EvalExecutable::allowDirectEvalCache const):
+        * runtime/JSGlobalObject.cpp:
+        (JSC::JSGlobalObject::JSGlobalObject):
+        * runtime/JSGlobalObject.h:
+        (JSC::JSGlobalObject::templateRegistry): Deleted.
+        * runtime/JSTemplateObjectDescriptor.cpp: Renamed from Source/JavaScriptCore/runtime/TemplateRegistry.cpp.
+        (JSC::JSTemplateObjectDescriptor::JSTemplateObjectDescriptor):
+        (JSC::JSTemplateObjectDescriptor::create):
+        (JSC::JSTemplateObjectDescriptor::destroy):
+        (JSC::JSTemplateObjectDescriptor::createTemplateObject):
+        * runtime/JSTemplateObjectDescriptor.h: Renamed from Source/JavaScriptCore/runtime/JSTemplateRegistryKey.h.
+        (JSC::isTemplateObjectDescriptor):
+        * runtime/JSTemplateRegistryKey.cpp: Removed.
+        * runtime/TemplateObjectDescriptor.cpp: Renamed from Source/JavaScriptCore/runtime/TemplateRegistryKey.cpp.
+        (JSC::TemplateObjectDescriptor::~TemplateObjectDescriptor):
+        * runtime/TemplateObjectDescriptor.h: Renamed from Source/JavaScriptCore/runtime/TemplateRegistryKey.h.
+        (JSC::TemplateObjectDescriptor::operator== const):
+        (JSC::TemplateObjectDescriptor::operator!= const):
+        (JSC::TemplateObjectDescriptor::Hasher::hash):
+        (JSC::TemplateObjectDescriptor::Hasher::equal):
+        (JSC::TemplateObjectDescriptor::create):
+        (JSC::TemplateObjectDescriptor::TemplateObjectDescriptor):
+        (JSC::TemplateObjectDescriptor::calculateHash):
+        * runtime/TemplateRegistry.h: Removed.
+        * runtime/TemplateRegistryKeyTable.cpp: Removed.
+        * runtime/TemplateRegistryKeyTable.h: Removed.
+        * runtime/VM.cpp:
+        (JSC::VM::VM):
+        * runtime/VM.h:
+        (JSC::VM::templateRegistryKeyTable): Deleted.
+        * runtime/VMEntryScope.cpp:
+
+        * CMakeLists.txt:
+        * JavaScriptCore.xcodeproj/project.pbxproj:
+        * Sources.txt:
+        * bytecode/CodeBlock.cpp:
+        (JSC::CodeBlock::setConstantRegisters):
+        * bytecode/DirectEvalCodeCache.cpp:
+        (JSC::DirectEvalCodeCache::setSlow):
+        * bytecode/UnlinkedCodeBlock.h:
+        (JSC::UnlinkedCodeBlock::allowDirectEvalCache const):
+        * bytecompiler/BytecodeGenerator.cpp:
+        (JSC::BytecodeGenerator::addTemplateObjectConstant):
+        (JSC::BytecodeGenerator::emitGetTemplateObject):
+        (JSC::BytecodeGenerator::addTemplateRegistryKeyConstant): Deleted.
+        * bytecompiler/BytecodeGenerator.h:
+        * parser/Parser.cpp:
+        (JSC::Parser<LexerType>::parseInner):
+        (JSC::Parser<LexerType>::parseMemberExpression):
+        * parser/Parser.h:
+        * parser/ParserModes.h:
+        * runtime/EvalExecutable.h:
+        (JSC::EvalExecutable::allowDirectEvalCache const):
+        * runtime/JSGlobalObject.cpp:
+        (JSC::JSGlobalObject::JSGlobalObject):
+        * runtime/JSGlobalObject.h:
+        (JSC::JSGlobalObject::templateRegistry): Deleted.
+        * runtime/JSTemplateObjectDescriptor.cpp: Renamed from Source/JavaScriptCore/runtime/TemplateRegistry.cpp.
+        (JSC::JSTemplateObjectDescriptor::JSTemplateObjectDescriptor):
+        (JSC::JSTemplateObjectDescriptor::create):
+        (JSC::JSTemplateObjectDescriptor::destroy):
+        (JSC::JSTemplateObjectDescriptor::createTemplateObject):
+        * runtime/JSTemplateObjectDescriptor.h: Renamed from Source/JavaScriptCore/runtime/JSTemplateRegistryKey.h.
+        (JSC::isTemplateObjectDescriptor):
+        * runtime/JSTemplateRegistryKey.cpp: Removed.
+        * runtime/TemplateObjectDescriptor.cpp: Renamed from Source/JavaScriptCore/runtime/TemplateRegistryKey.cpp.
+        (JSC::TemplateObjectDescriptor::~TemplateObjectDescriptor):
+        * runtime/TemplateObjectDescriptor.h: Renamed from Source/JavaScriptCore/runtime/TemplateRegistryKey.h.
+        (JSC::TemplateObjectDescriptor::operator== const):
+        (JSC::TemplateObjectDescriptor::operator!= const):
+        (JSC::TemplateObjectDescriptor::Hasher::hash):
+        (JSC::TemplateObjectDescriptor::Hasher::equal):
+        (JSC::TemplateObjectDescriptor::create):
+        (JSC::TemplateObjectDescriptor::TemplateObjectDescriptor):
+        (JSC::TemplateObjectDescriptor::calculateHash):
+        * runtime/TemplateRegistry.h: Removed.
+        * runtime/TemplateRegistryKeyTable.cpp: Removed.
+        * runtime/TemplateRegistryKeyTable.h: Removed.
+        * runtime/VM.cpp:
+        (JSC::VM::VM):
+        * runtime/VM.h:
+        (JSC::VM::templateRegistryKeyTable): Deleted.
+        * runtime/VMEntryScope.cpp:
+
+        * CMakeLists.txt:
+        * JavaScriptCore.xcodeproj/project.pbxproj:
+        * Sources.txt:
+        * bytecode/CodeBlock.cpp:
+        (JSC::CodeBlock::setConstantRegisters):
+        * bytecode/DirectEvalCodeCache.cpp:
+        (JSC::DirectEvalCodeCache::setSlow):
+        * bytecode/UnlinkedCodeBlock.h:
+        (JSC::UnlinkedCodeBlock::allowDirectEvalCache const):
+        * bytecompiler/BytecodeGenerator.cpp:
+        (JSC::BytecodeGenerator::addTemplateObjectConstant):
+        (JSC::BytecodeGenerator::emitGetTemplateObject):
+        (JSC::BytecodeGenerator::addTemplateRegistryKeyConstant): Deleted.
+        * bytecompiler/BytecodeGenerator.h:
+        * parser/Parser.cpp:
+        (JSC::Parser<LexerType>::parseInner):
+        (JSC::Parser<LexerType>::parseMemberExpression):
+        * parser/Parser.h:
+        * parser/ParserModes.h:
+        * runtime/EvalExecutable.h:
+        (JSC::EvalExecutable::allowDirectEvalCache const):
+        * runtime/JSGlobalObject.cpp:
+        (JSC::JSGlobalObject::JSGlobalObject):
+        * runtime/JSGlobalObject.h:
+        (JSC::JSGlobalObject::templateRegistry): Deleted.
+        * runtime/JSTemplateObjectDescriptor.cpp: Renamed from Source/JavaScriptCore/runtime/TemplateRegistry.cpp.
+        (JSC::JSTemplateObjectDescriptor::JSTemplateObjectDescriptor):
+        (JSC::JSTemplateObjectDescriptor::create):
+        (JSC::JSTemplateObjectDescriptor::destroy):
+        (JSC::JSTemplateObjectDescriptor::createTemplateObject):
+        * runtime/JSTemplateObjectDescriptor.h: Renamed from Source/JavaScriptCore/runtime/JSTemplateRegistryKey.h.
+        (JSC::isTemplateObjectDescriptor):
+        * runtime/JSTemplateRegistryKey.cpp: Removed.
+        * runtime/TemplateObjectDescriptor.cpp: Renamed from Source/JavaScriptCore/runtime/TemplateRegistryKey.cpp.
+        (JSC::TemplateObjectDescriptor::~TemplateObjectDescriptor):
+        * runtime/TemplateObjectDescriptor.h: Renamed from Source/JavaScriptCore/runtime/TemplateRegistryKey.h.
+        (JSC::TemplateObjectDescriptor::operator== const):
+        (JSC::TemplateObjectDescriptor::operator!= const):
+        (JSC::TemplateObjectDescriptor::Hasher::hash):
+        (JSC::TemplateObjectDescriptor::Hasher::equal):
+        (JSC::TemplateObjectDescriptor::create):
+        (JSC::TemplateObjectDescriptor::TemplateObjectDescriptor):
+        (JSC::TemplateObjectDescriptor::calculateHash):
+        * runtime/TemplateRegistry.h: Removed.
+        * runtime/TemplateRegistryKeyTable.cpp: Removed.
+        * runtime/TemplateRegistryKeyTable.h: Removed.
+        * runtime/VM.cpp:
+        (JSC::VM::VM):
+        * runtime/VM.h:
+        (JSC::VM::templateRegistryKeyTable): Deleted.
+        * runtime/VMEntryScope.cpp:
+
 2018-02-13  Yusuke Suzuki  <utatane.tea@gmail.com>
 
         Support GetArrayLength on ArrayStorage in the FTL
index a8e3442..cfa7e07 100644 (file)
                70DE9A091BE7D69E005D89D9 /* LLIntAssembly.h in Headers */ = {isa = PBXBuildFile; fileRef = 70DE9A081BE7D670005D89D9 /* LLIntAssembly.h */; };
                70EC0EC31AA0D7DA00B6AAFA /* JSStringIterator.h in Headers */ = {isa = PBXBuildFile; fileRef = 70EC0EBD1AA0D7DA00B6AAFA /* JSStringIterator.h */; settings = {ATTRIBUTES = (Private, ); }; };
                70EC0EC71AA0D7DA00B6AAFA /* StringIteratorPrototype.h in Headers */ = {isa = PBXBuildFile; fileRef = 70EC0EC11AA0D7DA00B6AAFA /* StringIteratorPrototype.h */; settings = {ATTRIBUTES = (Private, ); }; };
-               70ECA6061AFDBEA200449739 /* JSTemplateRegistryKey.h in Headers */ = {isa = PBXBuildFile; fileRef = 70ECA6011AFDBEA200449739 /* JSTemplateRegistryKey.h */; settings = {ATTRIBUTES = (Private, ); }; };
-               70ECA6081AFDBEA200449739 /* TemplateRegistry.h in Headers */ = {isa = PBXBuildFile; fileRef = 70ECA6031AFDBEA200449739 /* TemplateRegistry.h */; settings = {ATTRIBUTES = (Private, ); }; };
-               70ECA6091AFDBEA200449739 /* TemplateRegistryKey.h in Headers */ = {isa = PBXBuildFile; fileRef = 70ECA6041AFDBEA200449739 /* TemplateRegistryKey.h */; settings = {ATTRIBUTES = (Private, ); }; };
+               70ECA6061AFDBEA200449739 /* JSTemplateObjectDescriptor.h in Headers */ = {isa = PBXBuildFile; fileRef = 70ECA6011AFDBEA200449739 /* JSTemplateObjectDescriptor.h */; settings = {ATTRIBUTES = (Private, ); }; };
+               70ECA6091AFDBEA200449739 /* TemplateObjectDescriptor.h in Headers */ = {isa = PBXBuildFile; fileRef = 70ECA6041AFDBEA200449739 /* TemplateObjectDescriptor.h */; settings = {ATTRIBUTES = (Private, ); }; };
                72AAF7CE1D0D31B3005E60BE /* JSCustomGetterSetterFunction.h in Headers */ = {isa = PBXBuildFile; fileRef = 72AAF7CC1D0D318B005E60BE /* JSCustomGetterSetterFunction.h */; };
                790081391E95A8EC0052D7CD /* WasmModule.h in Headers */ = {isa = PBXBuildFile; fileRef = 790081371E95A8EC0052D7CD /* WasmModule.h */; settings = {ATTRIBUTES = (Private, ); }; };
                7905BB691D12050E0019FE57 /* InlineAccess.h in Headers */ = {isa = PBXBuildFile; fileRef = 7905BB671D12050E0019FE57 /* InlineAccess.h */; settings = {ATTRIBUTES = (Private, ); }; };
                932F5BDD0822A1C700736975 /* jsc.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 45E12D8806A49B0F00E9DF84 /* jsc.cpp */; };
                932F5BEA0822A1C700736975 /* JavaScriptCore.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 932F5BD90822A1C700736975 /* JavaScriptCore.framework */; };
                933040040E6A749400786E6A /* SmallStrings.h in Headers */ = {isa = PBXBuildFile; fileRef = 93303FEA0E6A72C000786E6A /* SmallStrings.h */; settings = {ATTRIBUTES = (Private, ); }; };
-               95D4261AF4C84CE2ACBAC981 /* TemplateRegistryKeyTable.h in Headers */ = {isa = PBXBuildFile; fileRef = 08FC2F37AB76483A9966688F /* TemplateRegistryKeyTable.h */; settings = {ATTRIBUTES = (Private, ); }; };
                960097A60EBABB58007A7297 /* LabelScope.h in Headers */ = {isa = PBXBuildFile; fileRef = 960097A50EBABB58007A7297 /* LabelScope.h */; };
                9688CB150ED12B4E001D649F /* AssemblerBuffer.h in Headers */ = {isa = PBXBuildFile; fileRef = 9688CB130ED12B4E001D649F /* AssemblerBuffer.h */; settings = {ATTRIBUTES = (Private, ); }; };
                9688CB160ED12B4E001D649F /* X86Assembler.h in Headers */ = {isa = PBXBuildFile; fileRef = 9688CB140ED12B4E001D649F /* X86Assembler.h */; settings = {ATTRIBUTES = (Private, ); }; };
 
 /* Begin PBXFileReference section */
                000BEAF0DF604481AF6AB68C /* ModuleScopeData.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ModuleScopeData.h; sourceTree = "<group>"; };
-               08FC2F37AB76483A9966688F /* TemplateRegistryKeyTable.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TemplateRegistryKeyTable.h; sourceTree = "<group>"; };
                0F0123301944EA1B00843A0C /* DFGValueStrength.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = DFGValueStrength.cpp; path = dfg/DFGValueStrength.cpp; sourceTree = "<group>"; };
                0F0123311944EA1B00843A0C /* DFGValueStrength.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = DFGValueStrength.h; path = dfg/DFGValueStrength.h; sourceTree = "<group>"; };
                0F0332BF18ADFAE1005F979A /* ExitingJITType.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ExitingJITType.cpp; sourceTree = "<group>"; };
                70EC0EBD1AA0D7DA00B6AAFA /* JSStringIterator.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSStringIterator.h; sourceTree = "<group>"; };
                70EC0EC01AA0D7DA00B6AAFA /* StringIteratorPrototype.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = StringIteratorPrototype.cpp; sourceTree = "<group>"; };
                70EC0EC11AA0D7DA00B6AAFA /* StringIteratorPrototype.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = StringIteratorPrototype.h; sourceTree = "<group>"; };
-               70ECA6001AFDBEA200449739 /* JSTemplateRegistryKey.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSTemplateRegistryKey.cpp; sourceTree = "<group>"; };
-               70ECA6011AFDBEA200449739 /* JSTemplateRegistryKey.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSTemplateRegistryKey.h; sourceTree = "<group>"; };
-               70ECA6021AFDBEA200449739 /* TemplateRegistry.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = TemplateRegistry.cpp; sourceTree = "<group>"; };
-               70ECA6031AFDBEA200449739 /* TemplateRegistry.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TemplateRegistry.h; sourceTree = "<group>"; };
-               70ECA6041AFDBEA200449739 /* TemplateRegistryKey.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TemplateRegistryKey.h; sourceTree = "<group>"; };
+               70ECA6001AFDBEA200449739 /* JSTemplateObjectDescriptor.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSTemplateObjectDescriptor.cpp; sourceTree = "<group>"; };
+               70ECA6011AFDBEA200449739 /* JSTemplateObjectDescriptor.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSTemplateObjectDescriptor.h; sourceTree = "<group>"; };
+               70ECA6041AFDBEA200449739 /* TemplateObjectDescriptor.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TemplateObjectDescriptor.h; sourceTree = "<group>"; };
                72AAF7CB1D0D318B005E60BE /* JSCustomGetterSetterFunction.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSCustomGetterSetterFunction.cpp; sourceTree = "<group>"; };
                72AAF7CC1D0D318B005E60BE /* JSCustomGetterSetterFunction.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSCustomGetterSetterFunction.h; sourceTree = "<group>"; };
                77B25CB2C3094A92A38E1DB3 /* JSModuleLoader.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSModuleLoader.h; sourceTree = "<group>"; };
                8852151A9C3842389B3215B7 /* ScriptFetcher.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ScriptFetcher.h; sourceTree = "<group>"; };
                8B1735EF1E92E52900369054 /* AsyncFromSyncIteratorPrototype.js */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.javascript; path = AsyncFromSyncIteratorPrototype.js; sourceTree = "<group>"; };
                8B3BF5E31E3D365A0076A87A /* AsyncGeneratorPrototype.lut.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AsyncGeneratorPrototype.lut.h; sourceTree = "<group>"; };
-               8B47F234366C4B72AC852A7E /* TemplateRegistryKeyTable.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = TemplateRegistryKeyTable.cpp; sourceTree = "<group>"; };
                8B6016F31F3E3CC000F9DE6A /* AsyncFromSyncIteratorPrototype.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = AsyncFromSyncIteratorPrototype.cpp; sourceTree = "<group>"; };
                8B6016F41F3E3CC000F9DE6A /* AsyncFromSyncIteratorPrototype.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AsyncFromSyncIteratorPrototype.h; sourceTree = "<group>"; };
                8B9F6D551D5912FA001C739F /* IterationKind.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = IterationKind.h; sourceTree = "<group>"; };
                BCF605120E203EF800B9A64D /* ArgList.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ArgList.h; sourceTree = "<group>"; };
                BCFD8C900EEB2EE700283848 /* JumpTable.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JumpTable.cpp; sourceTree = "<group>"; };
                BCFD8C910EEB2EE700283848 /* JumpTable.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JumpTable.h; sourceTree = "<group>"; };
-               BDB4B5E099CD4C1BB3C1CF05 /* TemplateRegistryKey.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = TemplateRegistryKey.cpp; sourceTree = "<group>"; };
+               BDB4B5E099CD4C1BB3C1CF05 /* TemplateObjectDescriptor.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = TemplateObjectDescriptor.cpp; sourceTree = "<group>"; };
                C203281E1981979D0088B499 /* CustomGlobalObjectClassTest.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = CustomGlobalObjectClassTest.c; path = API/tests/CustomGlobalObjectClassTest.c; sourceTree = "<group>"; };
                C203281F1981979D0088B499 /* CustomGlobalObjectClassTest.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = CustomGlobalObjectClassTest.h; path = API/tests/CustomGlobalObjectClassTest.h; sourceTree = "<group>"; };
                C20BA92C16BB1C1500B3AEA2 /* StructureRareDataInlines.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = StructureRareDataInlines.h; sourceTree = "<group>"; };
                                F692A8870255597D01FF60F7 /* JSCJSValue.cpp */,
                                14ABB36E099C076400E2A24F /* JSCJSValue.h */,
                                865A30F0135007E100CDB49E /* JSCJSValueInlines.h */,
-                               FE2B0B701FD8C4630075DA5F /* JSCPoison.h */,
                                FE2B0B681FD0D2970075DA5F /* JSCPoison.cpp */,
+                               FE2B0B701FD8C4630075DA5F /* JSCPoison.h */,
                                72AAF7CB1D0D318B005E60BE /* JSCustomGetterSetterFunction.cpp */,
                                72AAF7CC1D0D318B005E60BE /* JSCustomGetterSetterFunction.h */,
                                0F2B66BD17B6B5AB00A7AE3F /* JSDataView.cpp */,
                                2600B5A5152BAAA70091EE5F /* JSStringJoiner.h */,
                                0F919D09157EE09D004A4E7D /* JSSymbolTableObject.cpp */,
                                0F919D0A157EE09D004A4E7D /* JSSymbolTableObject.h */,
-                               70ECA6001AFDBEA200449739 /* JSTemplateRegistryKey.cpp */,
-                               70ECA6011AFDBEA200449739 /* JSTemplateRegistryKey.h */,
+                               70ECA6001AFDBEA200449739 /* JSTemplateObjectDescriptor.cpp */,
+                               70ECA6011AFDBEA200449739 /* JSTemplateObjectDescriptor.h */,
                                14ABB454099C2A0F00E2A24F /* JSType.h */,
                                0F2B66CC17B6B5AB00A7AE3F /* JSTypedArrayConstructors.cpp */,
                                0F2B66CD17B6B5AB00A7AE3F /* JSTypedArrayConstructors.h */,
                                705B41AA1A6E501E00716757 /* SymbolPrototype.h */,
                                0F919D2715856770004A4E7D /* SymbolTable.cpp */,
                                14A396A60CD2933100B5B4FF /* SymbolTable.h */,
-                               70ECA6021AFDBEA200449739 /* TemplateRegistry.cpp */,
-                               70ECA6031AFDBEA200449739 /* TemplateRegistry.h */,
-                               BDB4B5E099CD4C1BB3C1CF05 /* TemplateRegistryKey.cpp */,
-                               70ECA6041AFDBEA200449739 /* TemplateRegistryKey.h */,
-                               8B47F234366C4B72AC852A7E /* TemplateRegistryKeyTable.cpp */,
-                               08FC2F37AB76483A9966688F /* TemplateRegistryKeyTable.h */,
+                               BDB4B5E099CD4C1BB3C1CF05 /* TemplateObjectDescriptor.cpp */,
+                               70ECA6041AFDBEA200449739 /* TemplateObjectDescriptor.h */,
                                0FA2C17917D7CF84009D015F /* TestRunnerUtils.cpp */,
                                0FA2C17A17D7CF84009D015F /* TestRunnerUtils.h */,
                                FE2E6A7A1D6EA5FE0060F896 /* ThrowScope.cpp */,
                                0F2AC5711E8EE4540001EE3F /* AirFormTable.h in Headers */,
                                0FEC85771BDACDC70080FF74 /* AirFrequentedBlock.h in Headers */,
                                0FEC85791BDACDC70080FF74 /* AirGenerate.h in Headers */,
-                               0F75A061200D26180038E2CF /* LocalAllocator.h in Headers */,
                                0FEC857A1BDACDC70080FF74 /* AirGenerationContext.h in Headers */,
                                0FEC857C1BDACDC70080FF74 /* AirHandleCalleeSaves.h in Headers */,
                                0FEC857E1BDACDC70080FF74 /* AirInsertionSet.h in Headers */,
                                0FEC3C531F33A41600F59B6C /* AlignedMemoryAllocator.h in Headers */,
                                0FA7620B1DB959F900B7A2FD /* AllocatingScope.h in Headers */,
                                0FDCE11C1FAE6209006F3901 /* AllocationFailureMode.h in Headers */,
-                               0F96303A1D4192C8005609D9 /* CellAttributes.h in Headers */,
+                               0F75A063200D261F0038E2CF /* Allocator.h in Headers */,
                                0F30CB5E1FCE4E37004B5323 /* AllocatorForMode.h in Headers */,
+                               0F75A062200D261D0038E2CF /* AllocatorInlines.h in Headers */,
                                0F3730911C0CD70C00052BFA /* AllowMacroScratchRegisterUsage.h in Headers */,
                                A5EA70E919F5B1010098F5EC /* AlternateDispatchableAgent.h in Headers */,
                                2A48D1911772365B00C65A5F /* APICallbackFunction.h in Headers */,
                                0F6B8ADD1C4EFAC300969052 /* B3SSACalculator.h in Headers */,
                                0F33FCF81C136E2500323F67 /* B3StackmapGenerationParams.h in Headers */,
                                0FEC85311BDACDAC0080FF74 /* B3StackmapSpecial.h in Headers */,
-                               0F75A064200D26280038E2CF /* ThreadLocalCacheLayout.h in Headers */,
                                0F338DF21BE93AD10013C88F /* B3StackmapValue.h in Headers */,
                                0F9495881C57F47500413A48 /* B3StackSlot.h in Headers */,
                                0FEC85361BDACDAC0080FF74 /* B3SuccessorCollection.h in Headers */,
                                861816771FB7924200ECC4EC /* BigIntObject.h in Headers */,
                                86976E5E1FA3E8B600E7C4E1 /* BigIntPrototype.h in Headers */,
                                0F64B2721A784BAF006E4E66 /* BinarySwitch.h in Headers */,
+                               C2B916C214DA014E00CBAC86 /* BlockDirectory.h in Headers */,
+                               0F7DF1461E2BEF6A0095951B /* BlockDirectoryInlines.h in Headers */,
                                BC18C3EC0E16F5CD00B34460 /* BooleanObject.h in Headers */,
                                9B4694391F97439E00CCB3F9 /* BooleanPrototype.h in Headers */,
                                996B73191BDA068000331B84 /* BooleanPrototype.lut.h in Headers */,
                                0F3B7E2B19A11B8000D9BC56 /* CallVariant.h in Headers */,
                                FE80C1971D775CDD008510C0 /* CatchScope.h in Headers */,
                                0F24E54217EA9F5900ABB217 /* CCallHelpers.h in Headers */,
+                               0F96303A1D4192C8005609D9 /* CellAttributes.h in Headers */,
                                0F070A471D543A8B006E7232 /* CellContainer.h in Headers */,
                                0F070A481D543A90006E7232 /* CellContainerInlines.h in Headers */,
                                FE1BD01E1E72002A00134BC9 /* CellList.h in Headers */,
                                A53243981856A489002ED692 /* CombinedDomains.json in Headers */,
                                BC18C3F30E16F5CD00B34460 /* CommonIdentifiers.h in Headers */,
                                0F15F15F14B7A73E005DE37D /* CommonSlowPaths.h in Headers */,
-                               0F60FE901FFC37020003320A /* ExecutableToCodeBlockEdge.h in Headers */,
                                6553A33217A1F1EE008CF6F3 /* CommonSlowPathsExceptions.h in Headers */,
                                0FD82E39141AB14D00179C94 /* CompactJITCodeMap.h in Headers */,
                                A7E5A3A81797432D00E893C0 /* CompilationResult.h in Headers */,
                                0F1E3A461534CBAF000F9456 /* DFGArgumentPosition.h in Headers */,
                                0F2DD8121AB3D8BE00BBB8E8 /* DFGArgumentsEliminationPhase.h in Headers */,
                                0F2DD8141AB3D8BE00BBB8E8 /* DFGArgumentsUtilities.h in Headers */,
-                               0F75A063200D261F0038E2CF /* Allocator.h in Headers */,
                                0F485322187750560083B687 /* DFGArithMode.h in Headers */,
                                0F05C3B41683CF9200BAF45B /* DFGArrayifySlowPathGenerator.h in Headers */,
                                0F63948515E4811B006A597C /* DFGArrayMode.h in Headers */,
                                0F7C39FF1C90C55B00480151 /* DFGOpInfo.h in Headers */,
                                A7D89CFE17A0B8CC00773AD8 /* DFGOSRAvailabilityAnalysisPhase.h in Headers */,
                                0FD82E57141DAF1000179C94 /* DFGOSREntry.h in Headers */,
-                               0F42B3C3201EC9FF00357031 /* SecurityOriginToken.h in Headers */,
                                0FD8A32617D51F5700CA2C40 /* DFGOSREntrypointCreationPhase.h in Headers */,
                                0FC0976A1468A6F700CF2442 /* DFGOSRExit.h in Headers */,
                                0F235BEC17178E7300690C7F /* DFGOSRExitBase.h in Headers */,
                                A766B44F0EE8DCD1009518CA /* ExecutableAllocator.h in Headers */,
                                147341CC1DC02D7200AA29BA /* ExecutableBase.h in Headers */,
                                14142E531B796EDD00F4BF4B /* ExecutableInfo.h in Headers */,
+                               0F60FE901FFC37020003320A /* ExecutableToCodeBlockEdge.h in Headers */,
                                0F56A1D315000F35002992B1 /* ExecutionCounter.h in Headers */,
                                0F3AC754188E5EC80032029F /* ExitingJITType.h in Headers */,
                                0FB105861675481200F8AB6E /* ExitKind.h in Headers */,
                                FEA0C4031CDD7D1D00481991 /* FunctionWhitelist.h in Headers */,
                                2AACE63D18CA5A0300ED0191 /* GCActivityCallback.h in Headers */,
                                BCBE2CAE14E985AA000593AD /* GCAssertions.h in Headers */,
-                               0F75A060200D260B0038E2CF /* LocalAllocatorInlines.h in Headers */,
                                0F766D3015A8DCE2008F363E /* GCAwareJITStubRoutine.h in Headers */,
                                0FD0E5EA1E43D34D0006AB08 /* GCConductor.h in Headers */,
                                0FB4767E1D99AEA9008EA6CB /* GCDeferralContext.h in Headers */,
                                0FB7F39A15ED8E4600F167B2 /* IndexingHeaderInlines.h in Headers */,
                                0FB7F39B15ED8E4600F167B2 /* IndexingType.h in Headers */,
                                14386A791DD6989C008652C4 /* IndirectEvalExecutable.h in Headers */,
-                               0F75A062200D261D0038E2CF /* AllocatorInlines.h in Headers */,
                                0FBF92B91FD76FFF00AC28A8 /* InferredStructure.h in Headers */,
                                0FBF92BA1FD7700400AC28A8 /* InferredStructureWatchpoint.h in Headers */,
                                0F0A75231B94BFA900110660 /* InferredType.h in Headers */,
                                BC18C4150E16F5CD00B34460 /* JavaScriptCorePrefix.h in Headers */,
                                1429D9300ED22D7000B89619 /* JIT.h in Headers */,
                                FE1220271BE7F58C0039E6F2 /* JITAddGenerator.h in Headers */,
+                               0F75A0662013E4F10038E2CF /* JITAllocator.h in Headers */,
                                FE3A06B21C10CB8900390FDD /* JITBitAndGenerator.h in Headers */,
                                FE3A06A81C10BC8100390FDD /* JITBitBinaryOpGenerator.h in Headers */,
                                FE3A06A61C10B72D00390FDD /* JITBitOrGenerator.h in Headers */,
                                E33F50791B84225700413856 /* JSInternalPromiseConstructor.h in Headers */,
                                E33F50871B8449EF00413856 /* JSInternalPromiseConstructor.lut.h in Headers */,
                                E33F50851B8437A000413856 /* JSInternalPromiseDeferred.h in Headers */,
-                               0F75A05E200D25F60038E2CF /* ThreadLocalCache.h in Headers */,
                                E33F50751B8421C000413856 /* JSInternalPromisePrototype.h in Headers */,
                                A503FA1E188E0FB000110F14 /* JSJavaScriptCallFramePrototype.h in Headers */,
                                7013CA8C1B491A9400CAE613 /* JSJob.h in Headers */,
                                BC18C4290E16F5CD00B34460 /* JSStringRefCF.h in Headers */,
                                1A28D4A8177B71C80007FA3C /* JSStringRefPrivate.h in Headers */,
                                0F919D0D157EE0A2004A4E7D /* JSSymbolTableObject.h in Headers */,
-                               70ECA6061AFDBEA200449739 /* JSTemplateRegistryKey.h in Headers */,
+                               70ECA6061AFDBEA200449739 /* JSTemplateObjectDescriptor.h in Headers */,
                                AD5C36EA1F75AD6A000BCAAF /* JSToWasm.h in Headers */,
                                BC18C42A0E16F5CD00B34460 /* JSType.h in Headers */,
                                53486BB71C1795C300F6F3AF /* JSTypedArray.h in Headers */,
                                53FA2AE11CF37F3F0022711D /* LLIntPrototypeLoadAdaptiveStructureWatchpoint.h in Headers */,
                                0F4680A514BA7F8D00BFE272 /* LLIntSlowPaths.h in Headers */,
                                0F0B839D14BCF46600885B4F /* LLIntThunks.h in Headers */,
+                               0F75A061200D26180038E2CF /* LocalAllocator.h in Headers */,
+                               0F75A060200D260B0038E2CF /* LocalAllocatorInlines.h in Headers */,
                                0F208AD71DF0925D007D3269 /* LockDuringMarking.h in Headers */,
                                BC18C4370E16F5CD00B34460 /* Lookup.h in Headers */,
                                0F4680CD14BBB17D00BFE272 /* LowLevelInterpreter.h in Headers */,
                                A700873A17CBE85300C3E643 /* MapConstructor.h in Headers */,
                                A74DEF94182D991400522C22 /* MapIteratorPrototype.h in Headers */,
                                A700873E17CBE8D300C3E643 /* MapPrototype.h in Headers */,
-                               C2B916C214DA014E00CBAC86 /* BlockDirectory.h in Headers */,
-                               0F7DF1461E2BEF6A0095951B /* BlockDirectoryInlines.h in Headers */,
                                142D6F0913539A2800B02E86 /* MarkedBlock.h in Headers */,
                                0F7C5FB81D888A0C0044F5E2 /* MarkedBlockInlines.h in Headers */,
                                141448CB13A176EC00F5BA1A /* MarkedBlockSet.h in Headers */,
                                A54CF2FA184EAEDA00237F19 /* ScriptObject.h in Headers */,
                                A55165D51BDF135A003B75C1 /* ScriptProfilingScope.h in Headers */,
                                A54CF2F6184EAB2400237F19 /* ScriptValue.h in Headers */,
+                               0F42B3C3201EC9FF00357031 /* SecurityOriginToken.h in Headers */,
                                A7299DA617D12858005F5FF9 /* SetConstructor.h in Headers */,
                                A790DD6E182F499700588807 /* SetIteratorPrototype.h in Headers */,
                                A7299DA217D12848005F5FF9 /* SetPrototype.h in Headers */,
                                0F1FB38F1E173A6700A9BE50 /* SynchronousStopTheWorldMutatorScheduler.h in Headers */,
                                A784A26411D16622005776AC /* SyntaxChecker.h in Headers */,
                                DC7997831CDE9FA0004D4A09 /* TagRegistersMode.h in Headers */,
-                               70ECA6081AFDBEA200449739 /* TemplateRegistry.h in Headers */,
-                               70ECA6091AFDBEA200449739 /* TemplateRegistryKey.h in Headers */,
-                               95D4261AF4C84CE2ACBAC981 /* TemplateRegistryKeyTable.h in Headers */,
+                               70ECA6091AFDBEA200449739 /* TemplateObjectDescriptor.h in Headers */,
                                0F24E54F17EE274900ABB217 /* TempRegisterSet.h in Headers */,
                                0FA2C17C17D7CF84009D015F /* TestRunnerUtils.h in Headers */,
+                               0F75A05E200D25F60038E2CF /* ThreadLocalCache.h in Headers */,
+                               0F75A064200D26280038E2CF /* ThreadLocalCacheLayout.h in Headers */,
                                FE3422121D6B81C30032BE88 /* ThrowScope.h in Headers */,
                                0F572D4F16879FDD00E57FBD /* ThunkGenerator.h in Headers */,
                                A7386556118697B400540279 /* ThunkGenerators.h in Headers */,
                                14E84FA214EE1ACC00D6D5D4 /* WeakImpl.h in Headers */,
                                14BE7D3317135CF400D1807A /* WeakInlines.h in Headers */,
                                A7CA3AE417DA41AE006538AF /* WeakMapConstructor.h in Headers */,
-                               0F75A0662013E4F10038E2CF /* JITAllocator.h in Headers */,
                                E3A32BC71FC83147007D7E76 /* WeakMapImpl.h in Headers */,
                                E393ADD81FE702D00022D681 /* WeakMapImplInlines.h in Headers */,
                                A7CA3AE617DA41AE006538AF /* WeakMapPrototype.h in Headers */,
index 8198802..60931c5 100644 (file)
@@ -835,7 +835,7 @@ runtime/JSStringIterator.cpp
 runtime/JSStringJoiner.cpp
 runtime/JSStringHeapCellType.cpp
 runtime/JSSymbolTableObject.cpp
-runtime/JSTemplateRegistryKey.cpp
+runtime/JSTemplateObjectDescriptor.cpp
 runtime/JSTypedArrayConstructors.cpp
 runtime/JSTypedArrayPrototypes.cpp
 runtime/JSTypedArrayViewConstructor.cpp
@@ -917,9 +917,7 @@ runtime/SymbolConstructor.cpp
 runtime/SymbolObject.cpp
 runtime/SymbolPrototype.cpp
 runtime/SymbolTable.cpp
-runtime/TemplateRegistry.cpp
-runtime/TemplateRegistryKey.cpp
-runtime/TemplateRegistryKeyTable.cpp
+runtime/TemplateObjectDescriptor.cpp
 runtime/TestRunnerUtils.cpp
 runtime/ThrowScope.cpp
 runtime/TypeLocationCache.cpp
index 683a968..3db4358 100644 (file)
@@ -62,7 +62,7 @@
 #include "JSModuleEnvironment.h"
 #include "JSSet.h"
 #include "JSString.h"
-#include "JSTemplateRegistryKey.h"
+#include "JSTemplateObjectDescriptor.h"
 #include "LLIntData.h"
 #include "LLIntEntrypoint.h"
 #include "LLIntPrototypeLoadAdaptiveStructureWatchpoint.h"
@@ -942,8 +942,9 @@ void CodeBlock::setConstantRegisters(const Vector<WriteBarrier<Unknown>>& consta
                     clone->setRareDataCodeBlock(this);
 
                 constant = clone;
-            } else if (isTemplateRegistryKey(vm, constant)) {
-                auto* templateObject = globalObject->templateRegistry().getTemplateObject(exec, jsCast<JSTemplateRegistryKey*>(constant));
+            } else if (isTemplateObjectDescriptor(vm, constant)) {
+                auto descriptor = jsCast<JSTemplateObjectDescriptor*>(constant);
+                auto* templateObject = descriptor->createTemplateObject(exec);
                 RETURN_IF_EXCEPTION(scope, void());
                 constant = templateObject;
             }
index 5bfef12..1448640 100644 (file)
@@ -32,6 +32,9 @@ namespace JSC {
 
 void DirectEvalCodeCache::setSlow(ExecState* exec, JSCell* owner, const String& evalSource, CallSiteIndex callSiteIndex, DirectEvalExecutable* evalExecutable)
 {
+    if (!evalExecutable->allowDirectEvalCache())
+        return;
+
     LockHolder locker(m_lock);
     m_cacheMap.set(CacheKey(evalSource, callSiteIndex), WriteBarrier<DirectEvalExecutable>(exec->vm(), owner, evalExecutable));
 }
index c7591e1..54d5a4e 100644 (file)
@@ -134,6 +134,7 @@ public:
     bool isClassContext() const { return m_isClassContext; }
     bool hasTailCalls() const { return m_hasTailCalls; }
     void setHasTailCalls() { m_hasTailCalls = true; }
+    bool allowDirectEvalCache() const { return !(m_features & NoEvalCacheFeature); }
 
     void addExpressionInfo(unsigned instructionOffset, int divot,
         int startOffset, int endOffset, unsigned line, unsigned column);
index 92b5842..b4d4dc3 100644 (file)
@@ -46,7 +46,7 @@
 #include "JSFunction.h"
 #include "JSGeneratorFunction.h"
 #include "JSLexicalEnvironment.h"
-#include "JSTemplateRegistryKey.h"
+#include "JSTemplateObjectDescriptor.h"
 #include "LowLevelInterpreter.h"
 #include "Options.h"
 #include "StackAlignment.h"
@@ -3135,14 +3135,15 @@ JSString* BytecodeGenerator::addStringConstant(const Identifier& identifier)
     return stringInMap;
 }
 
-RegisterID* BytecodeGenerator::addTemplateRegistryKeyConstant(Ref<TemplateRegistryKey>&& templateRegistryKey)
+RegisterID* BytecodeGenerator::addTemplateObjectConstant(Ref<TemplateObjectDescriptor>&& descriptor)
 {
-    return m_templateRegistryKeyMap.ensure(templateRegistryKey.copyRef(), [&] {
-        auto* result = JSTemplateRegistryKey::create(*vm(), WTFMove(templateRegistryKey));
-        unsigned index = addConstantIndex();
-        m_codeBlock->addConstant(result);
-        return &m_constantPoolRegisters[index];
+    JSTemplateObjectDescriptor* descriptorValue = m_templateObjectDescriptorMap.ensure(descriptor.copyRef(), [&] {
+        return JSTemplateObjectDescriptor::create(*vm(), WTFMove(descriptor));
     }).iterator->value;
+
+    int index = addConstantIndex();
+    m_codeBlock->addConstant(descriptorValue);
+    return &m_constantPoolRegisters[index];
 }
 
 RegisterID* BytecodeGenerator::emitNewArray(RegisterID* dst, ElementNode* elements, unsigned length)
@@ -4401,8 +4402,8 @@ void BytecodeGenerator::emitEnumeration(ThrowableExpressionData* node, Expressio
 
 RegisterID* BytecodeGenerator::emitGetTemplateObject(RegisterID* dst, TaggedTemplateNode* taggedTemplate)
 {
-    TemplateRegistryKey::StringVector rawStrings;
-    TemplateRegistryKey::OptionalStringVector cookedStrings;
+    TemplateObjectDescriptor::StringVector rawStrings;
+    TemplateObjectDescriptor::OptionalStringVector cookedStrings;
 
     TemplateStringListNode* templateString = taggedTemplate->templateLiteral()->templateStrings();
     for (; templateString; templateString = templateString->next()) {
@@ -4414,7 +4415,7 @@ RegisterID* BytecodeGenerator::emitGetTemplateObject(RegisterID* dst, TaggedTemp
         else
             cookedStrings.append(string->cooked()->impl());
     }
-    RefPtr<RegisterID> constant = addTemplateRegistryKeyConstant(m_vm->templateRegistryKeyTable().createKey(WTFMove(rawStrings), WTFMove(cookedStrings)));
+    RefPtr<RegisterID> constant = addTemplateObjectConstant(TemplateObjectDescriptor::create(WTFMove(rawStrings), WTFMove(cookedStrings)));
     if (!dst)
         return constant.get();
     return emitMove(dst, constant.get());
index 14db706..8824a81 100644 (file)
@@ -36,6 +36,7 @@
 #include "JSAsyncGeneratorFunction.h"
 #include "JSBigInt.h"
 #include "JSGeneratorFunction.h"
+#include "JSTemplateObjectDescriptor.h"
 #include "Label.h"
 #include "LabelScope.h"
 #include "Nodes.h"
@@ -43,7 +44,6 @@
 #include "RegisterID.h"
 #include "StaticPropertyAnalyzer.h"
 #include "SymbolTable.h"
-#include "TemplateRegistryKey.h"
 #include "UnlinkedCodeBlock.h"
 #include <functional>
 #include <wtf/CheckedArithmetic.h>
@@ -55,7 +55,6 @@
 namespace JSC {
 
     class Identifier;
-    class JSTemplateRegistryKey;
 
     enum ExpectedFunction {
         NoExpectedFunction,
@@ -1008,7 +1007,7 @@ namespace JSC {
         using NumberMap = HashMap<double, JSValue>;
         using IdentifierStringMap = HashMap<UniquedStringImpl*, JSString*, IdentifierRepHash>;
         using IdentifierBigIntMap = HashMap<BigIntMapEntry, JSBigInt*>;
-        using TemplateRegistryKeyMap = HashMap<Ref<TemplateRegistryKey>, RegisterID*>;
+        using TemplateObjectDescriptorMap = HashMap<Ref<TemplateObjectDescriptor>, JSTemplateObjectDescriptor*>;
 
         // Helper for emitCall() and emitConstruct(). This works because the set of
         // expected functions have identical behavior for both call and construct
@@ -1093,7 +1092,7 @@ namespace JSC {
     public:
         JSString* addStringConstant(const Identifier&);
         JSValue addBigIntConstant(const Identifier&, uint8_t radix);
-        RegisterID* addTemplateRegistryKeyConstant(Ref<TemplateRegistryKey>&&);
+        RegisterID* addTemplateObjectConstant(Ref<TemplateObjectDescriptor>&&);
 
         Vector<UnlinkedInstruction, 0, UnsafeVectorOverflow>& instructions() { return m_instructions; }
 
@@ -1193,7 +1192,7 @@ namespace JSC {
         JSValueMap m_jsValueMap;
         IdentifierStringMap m_stringMap;
         IdentifierBigIntMap m_bigIntMap;
-        TemplateRegistryKeyMap m_templateRegistryKeyMap;
+        TemplateObjectDescriptorMap m_templateObjectDescriptorMap;
 
         StaticPropertyAnalyzer m_staticPropertyAnalyzer { &m_instructions };
 
index f485136..93effa3 100644 (file)
@@ -272,6 +272,8 @@ String Parser<LexerType>::parseInner(const Identifier& calleeName, SourceParseMo
         features |= StrictModeFeature;
     if (scope->shadowsArguments())
         features |= ShadowsArgumentsFeature;
+    if (m_seenTaggedTemplate)
+        features |= NoEvalCacheFeature;
 
 #ifndef NDEBUG
     if (m_parsingBuiltin && isProgramParseMode(parseMode)) {
@@ -4832,6 +4834,7 @@ template <class TreeBuilder> TreeExpression Parser<LexerType>::parseMemberExpres
             failIfFalse(templateLiteral, "Cannot parse template literal");
             base = context.createTaggedTemplate(startLocation, base, templateLiteral, expressionStart, expressionEnd, lastTokenEndPosition());
             m_parserState.nonLHSCount = nonLHSCount;
+            m_seenTaggedTemplate = true;
             break;
         }
         default:
index 750305c..083121b 100644 (file)
@@ -1841,6 +1841,7 @@ private:
     RefPtr<ModuleScopeData> m_moduleScopeData;
     DebuggerParseData* m_debuggerParseData;
     CallOrApplyDepthScope* m_callOrApplyDepthScope { nullptr };
+    bool m_seenTaggedTemplate { false };
 };
 
 
index 82229ad..2cea882 100644 (file)
@@ -304,9 +304,10 @@ const CodeFeatures ArrowFunctionContextFeature = 1 << 7;
 const CodeFeatures SuperCallFeature =            1 << 8;
 const CodeFeatures SuperPropertyFeature =        1 << 9;
 const CodeFeatures NewTargetFeature =            1 << 10;
+const CodeFeatures NoEvalCacheFeature =          1 << 11;
 
 const CodeFeatures AllFeatures = EvalFeature | ArgumentsFeature | WithFeature | ThisFeature | StrictModeFeature | ShadowsArgumentsFeature | ArrowFunctionFeature | ArrowFunctionContextFeature |
-    SuperCallFeature | SuperPropertyFeature | NewTargetFeature;
+    SuperCallFeature | SuperPropertyFeature | NewTargetFeature | NoEvalCacheFeature;
 
 typedef uint8_t InnerArrowFunctionCodeFeatures;
     
index ea2fde0..b834a7c 100644 (file)
@@ -61,6 +61,7 @@ public:
     unsigned numVariables() { return m_unlinkedEvalCodeBlock->numVariables(); }
     unsigned numFunctionHoistingCandidates() { return m_unlinkedEvalCodeBlock->numFunctionHoistingCandidates(); }
     unsigned numTopLevelFunctionDecls() { return m_unlinkedEvalCodeBlock->numberOfFunctionDecls(); }
+    bool allowDirectEvalCache() const { return m_unlinkedEvalCodeBlock->allowDirectEvalCache(); }
 
 protected:
     friend class ExecutableBase;
index e97a9b6..c299226 100644 (file)
 #include "JSPromisePrototype.h"
 #include "JSSet.h"
 #include "JSStringIterator.h"
-#include "JSTemplateRegistryKey.h"
 #include "JSTypedArrayConstructors.h"
 #include "JSTypedArrayPrototypes.h"
 #include "JSTypedArrayViewConstructor.h"
@@ -350,7 +349,6 @@ JSGlobalObject::JSGlobalObject(VM& vm, Structure* structure, const GlobalObjectM
     , m_setAddWatchpoint(IsWatched)
     , m_arraySpeciesWatchpoint(ClearWatchpoint)
     , m_numberToStringWatchpoint(IsWatched)
-    , m_templateRegistry(vm)
     , m_runtimeFlags()
     , m_globalObjectMethodTable(globalObjectMethodTable ? globalObjectMethodTable : &s_globalObjectMethodTable)
     , m_threadLocalCache(threadLocalCache ? WTFMove(threadLocalCache) : vm.defaultThreadLocalCache)
index d696128..cefe6d5 100644 (file)
@@ -41,7 +41,6 @@
 #include "SpecialPointer.h"
 #include "StringPrototype.h"
 #include "SymbolPrototype.h"
-#include "TemplateRegistry.h"
 #include "VM.h"
 #include "Watchpoint.h"
 #include <JavaScriptCore/JSBase.h>
@@ -459,8 +458,6 @@ public:
     bool isMapPrototypeSetFastAndNonObservable();
     bool isSetPrototypeAddFastAndNonObservable();
 
-    TemplateRegistry m_templateRegistry;
-
     bool m_evalEnabled { true };
     bool m_webAssemblyEnabled { true };
     String m_evalDisabledErrorMessage;
@@ -880,8 +877,6 @@ public:
         return m_rareData->opaqueJSClassData;
     }
 
-    TemplateRegistry& templateRegistry() { return m_templateRegistry; }
-
     static ptrdiff_t weakRandomOffset() { return OBJECT_OFFSETOF(JSGlobalObject, m_weakRandom); }
     double weakRandomNumber() { return m_weakRandom.get(); }
     unsigned weakRandomInteger() { return m_weakRandom.getUint32(); }
@@ -1,6 +1,6 @@
 /*
  * Copyright (C) 2015 Yusuke Suzuki <utatane.tea@gmail.com>.
- * Copyright (C) 2016-2017 Apple Inc. All Rights Reserved.
+ * Copyright (C) 2016 Apple Inc. All Rights Reserved.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
  */
 
 #include "config.h"
-#include "TemplateRegistry.h"
+#include "JSTemplateObjectDescriptor.h"
 
-#include "BuiltinNames.h"
 #include "JSCInlines.h"
-#include "JSGlobalObject.h"
-#include "JSTemplateRegistryKey.h"
 #include "ObjectConstructor.h"
-#include "TemplateRegistryKey.h"
-#include "WeakGCMapInlines.h"
+#include "VM.h"
 
 namespace JSC {
 
-TemplateRegistry::TemplateRegistry(VM& vm)
-    : m_templateMap(vm)
+const ClassInfo JSTemplateObjectDescriptor::s_info = { "TemplateObjectDescriptor", nullptr, nullptr, nullptr, CREATE_METHOD_TABLE(JSTemplateObjectDescriptor) };
+
+
+JSTemplateObjectDescriptor::JSTemplateObjectDescriptor(VM& vm, Ref<TemplateObjectDescriptor>&& descriptor)
+    : Base(vm, vm.templateObjectDescriptorStructure.get())
+    , m_descriptor(WTFMove(descriptor))
+{
+}
+
+JSTemplateObjectDescriptor* JSTemplateObjectDescriptor::create(VM& vm, Ref<TemplateObjectDescriptor>&& descriptor)
 {
+    JSTemplateObjectDescriptor* result = new (NotNull, allocateCell<JSTemplateObjectDescriptor>(vm.heap)) JSTemplateObjectDescriptor(vm, WTFMove(descriptor));
+    result->finishCreation(vm);
+    return result;
 }
 
-JSArray* TemplateRegistry::getTemplateObject(ExecState* exec, JSTemplateRegistryKey* templateKeyObject)
+void JSTemplateObjectDescriptor::destroy(JSCell* cell)
 {
-    auto& templateKey = templateKeyObject->templateRegistryKey();
-    JSArray* cached = m_templateMap.get(&templateKey);
-    if (cached)
-        return cached;
+    static_cast<JSTemplateObjectDescriptor*>(cell)->JSTemplateObjectDescriptor::~JSTemplateObjectDescriptor();
+}
 
+JSArray* JSTemplateObjectDescriptor::createTemplateObject(ExecState* exec)
+{
     VM& vm = exec->vm();
     auto scope = DECLARE_THROW_SCOPE(vm);
-    unsigned count = templateKey.cookedStrings().size();
+    unsigned count = descriptor().cookedStrings().size();
     JSArray* templateObject = constructEmptyArray(exec, nullptr, count);
     RETURN_IF_EXCEPTION(scope, nullptr);
     JSArray* rawObject = constructEmptyArray(exec, nullptr, count);
     RETURN_IF_EXCEPTION(scope, nullptr);
 
     for (unsigned index = 0; index < count; ++index) {
-        auto cooked = templateKey.cookedStrings()[index];
+        auto cooked = descriptor().cookedStrings()[index];
         if (cooked)
             templateObject->putDirectIndex(exec, index, jsString(exec, cooked.value()), PropertyAttribute::ReadOnly | PropertyAttribute::DontDelete, PutDirectIndexLikePutDirect);
         else
             templateObject->putDirectIndex(exec, index, jsUndefined(), PropertyAttribute::ReadOnly | PropertyAttribute::DontDelete, PutDirectIndexLikePutDirect);
         RETURN_IF_EXCEPTION(scope, nullptr);
 
-        rawObject->putDirectIndex(exec, index, jsString(exec, templateKey.rawStrings()[index]), PropertyAttribute::ReadOnly | PropertyAttribute::DontDelete, PutDirectIndexLikePutDirect);
+        rawObject->putDirectIndex(exec, index, jsString(exec, descriptor().rawStrings()[index]), PropertyAttribute::ReadOnly | PropertyAttribute::DontDelete, PutDirectIndexLikePutDirect);
         RETURN_IF_EXCEPTION(scope, nullptr);
     }
 
@@ -74,17 +81,10 @@ JSArray* TemplateRegistry::getTemplateObject(ExecState* exec, JSTemplateRegistry
 
     templateObject->putDirect(vm, vm.propertyNames->raw, rawObject, PropertyAttribute::ReadOnly | PropertyAttribute::DontEnum | PropertyAttribute::DontDelete);
 
-    // Template JSArray hold the reference to JSTemplateRegistryKey to make TemplateRegistryKey pointer live until this JSArray is collected.
-    // TemplateRegistryKey pointer is used for TemplateRegistry's key.
-    templateObject->putDirect(vm, vm.propertyNames->builtinNames().templateRegistryKeyPrivateName(), templateKeyObject, PropertyAttribute::ReadOnly | PropertyAttribute::DontEnum | PropertyAttribute::DontDelete);
-
     objectConstructorFreeze(exec, templateObject);
     scope.assertNoException();
 
-    m_templateMap.set(&templateKey, templateObject);
-
     return templateObject;
 }
 
-
 } // namespace JSC
 #pragma once
 
 #include "Structure.h"
-#include "TemplateRegistryKey.h"
+#include "TemplateObjectDescriptor.h"
 
 namespace JSC {
 
-class JSTemplateRegistryKey final : public JSCell {
+class JSTemplateObjectDescriptor final : public JSCell {
 public:
     using Base = JSCell;
 
@@ -38,32 +38,34 @@ public:
     static const bool needsDestruction = true;
     DECLARE_INFO;
 
-    static JSTemplateRegistryKey* create(VM&, Ref<TemplateRegistryKey>&&);
+    static JSTemplateObjectDescriptor* create(VM&, Ref<TemplateObjectDescriptor>&&);
 
     static Structure* createStructure(VM& vm, JSGlobalObject* globalObject, JSValue prototype)
     {
         return Structure::create(vm, globalObject, prototype, TypeInfo(CellType, StructureFlags), info());
     }
 
-    const TemplateRegistryKey& templateRegistryKey() const { return m_templateRegistryKey.get(); }
+    const TemplateObjectDescriptor& descriptor() const { return m_descriptor.get(); }
+
+    JSArray* createTemplateObject(ExecState*);
 
 protected:
     static void destroy(JSCell*);
 
 private:
-    JSTemplateRegistryKey(VM&, Ref<TemplateRegistryKey>&&);
+    JSTemplateObjectDescriptor(VM&, Ref<TemplateObjectDescriptor>&&);
 
-    Ref<TemplateRegistryKey> m_templateRegistryKey;
+    Ref<TemplateObjectDescriptor> m_descriptor;
 };
 
-inline bool isTemplateRegistryKey(VM& vm, JSCell* cell)
+inline bool isTemplateObjectDescriptor(VM& vm, JSCell* cell)
 {
-    return cell->classInfo(vm) == JSTemplateRegistryKey::info();
+    return cell->classInfo(vm) == JSTemplateObjectDescriptor::info();
 }
 
-inline bool isTemplateRegistryKey(VM& vm, JSValue v)
+inline bool isTemplateObjectDescriptor(VM& vm, JSValue v)
 {
-    return v.isCell() && isTemplateRegistryKey(vm, v.asCell());
+    return v.isCell() && isTemplateObjectDescriptor(vm, v.asCell());
 }
 
 } // namespace JSC
diff --git a/Source/JavaScriptCore/runtime/JSTemplateRegistryKey.cpp b/Source/JavaScriptCore/runtime/JSTemplateRegistryKey.cpp
deleted file mode 100644 (file)
index 94325ba..0000000
+++ /dev/null
@@ -1,56 +0,0 @@
-/*
- * Copyright (C) 2015 Yusuke Suzuki <utatane.tea@gmail.com>.
- * Copyright (C) 2016 Apple Inc. All Rights Reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the
- *    documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
- * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
- * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
- * THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include "config.h"
-#include "JSTemplateRegistryKey.h"
-
-#include "JSCInlines.h"
-#include "VM.h"
-
-namespace JSC {
-
-const ClassInfo JSTemplateRegistryKey::s_info = { "TemplateRegistryKey", nullptr, nullptr, nullptr, CREATE_METHOD_TABLE(JSTemplateRegistryKey) };
-
-
-JSTemplateRegistryKey::JSTemplateRegistryKey(VM& vm, Ref<TemplateRegistryKey>&& templateRegistryKey)
-    : Base(vm, vm.templateRegistryKeyStructure.get())
-    , m_templateRegistryKey(WTFMove(templateRegistryKey))
-{
-}
-
-JSTemplateRegistryKey* JSTemplateRegistryKey::create(VM& vm, Ref<TemplateRegistryKey>&& templateRegistryKey)
-{
-    JSTemplateRegistryKey* result = new (NotNull, allocateCell<JSTemplateRegistryKey>(vm.heap)) JSTemplateRegistryKey(vm, WTFMove(templateRegistryKey));
-    result->finishCreation(vm);
-    return result;
-}
-
-void JSTemplateRegistryKey::destroy(JSCell* cell)
-{
-    static_cast<JSTemplateRegistryKey*>(cell)->JSTemplateRegistryKey::~JSTemplateRegistryKey();
-}
-
-} // namespace JSC
  */
 
 #include "config.h"
-#include "TemplateRegistryKey.h"
-
-#include "TemplateRegistryKeyTable.h"
+#include "TemplateObjectDescriptor.h"
 
 namespace JSC {
 
-TemplateRegistryKey::~TemplateRegistryKey()
+TemplateObjectDescriptor::~TemplateObjectDescriptor()
 {
-    if (m_table)
-        m_table->unregister(*this);
 }
 
 } // namespace JSC
 
 namespace JSC {
 
-class TemplateRegistryKeyTable;
+class TemplateObjectDescriptorTable;
 
-class TemplateRegistryKey : public RefCounted<TemplateRegistryKey> {
+class TemplateObjectDescriptor : public RefCounted<TemplateObjectDescriptor> {
 public:
-    friend class TemplateRegistryKeyTable;
     typedef Vector<String, 4> StringVector;
     typedef Vector<std::optional<String>, 4> OptionalStringVector;
 
     enum DeletedValueTag { DeletedValue };
-    TemplateRegistryKey(DeletedValueTag);
+    TemplateObjectDescriptor(DeletedValueTag);
     enum EmptyValueTag { EmptyValue };
-    TemplateRegistryKey(EmptyValueTag);
+    TemplateObjectDescriptor(EmptyValueTag);
 
     bool isDeletedValue() const { return m_rawStrings.isEmpty() && m_hash == std::numeric_limits<unsigned>::max(); }
 
@@ -54,50 +53,49 @@ public:
     const StringVector& rawStrings() const { return m_rawStrings; }
     const OptionalStringVector& cookedStrings() const { return m_cookedStrings; }
 
-    bool operator==(const TemplateRegistryKey& other) const { return m_hash == other.m_hash && m_rawStrings == other.m_rawStrings; }
-    bool operator!=(const TemplateRegistryKey& other) const { return m_hash != other.m_hash || m_rawStrings != other.m_rawStrings; }
+    bool operator==(const TemplateObjectDescriptor& other) const { return m_hash == other.m_hash && m_rawStrings == other.m_rawStrings; }
+    bool operator!=(const TemplateObjectDescriptor& other) const { return m_hash != other.m_hash || m_rawStrings != other.m_rawStrings; }
 
     struct Hasher {
-        static unsigned hash(const TemplateRegistryKey& key) { return key.hash(); }
-        static bool equal(const TemplateRegistryKey& a, const TemplateRegistryKey& b) { return a == b; }
+        static unsigned hash(const TemplateObjectDescriptor& key) { return key.hash(); }
+        static bool equal(const TemplateObjectDescriptor& a, const TemplateObjectDescriptor& b) { return a == b; }
         static const bool safeToCompareToEmptyOrDeleted = false;
     };
 
     static unsigned calculateHash(const StringVector& rawStrings);
-    ~TemplateRegistryKey();
+    ~TemplateObjectDescriptor();
 
-private:
-    static Ref<TemplateRegistryKey> create(StringVector&& rawStrings, OptionalStringVector&& cookedStrings)
+    static Ref<TemplateObjectDescriptor> create(StringVector&& rawStrings, OptionalStringVector&& cookedStrings)
     {
-        return adoptRef(*new TemplateRegistryKey(WTFMove(rawStrings), WTFMove(cookedStrings)));
+        return adoptRef(*new TemplateObjectDescriptor(WTFMove(rawStrings), WTFMove(cookedStrings)));
     }
 
-    TemplateRegistryKey(StringVector&& rawStrings, OptionalStringVector&& cookedStrings);
+private:
+    TemplateObjectDescriptor(StringVector&& rawStrings, OptionalStringVector&& cookedStrings);
 
-    TemplateRegistryKeyTable* m_table { nullptr };
     StringVector m_rawStrings;
     OptionalStringVector m_cookedStrings;
     unsigned m_hash { 0 };
 };
 
-inline TemplateRegistryKey::TemplateRegistryKey(StringVector&& rawStrings, OptionalStringVector&& cookedStrings)
+inline TemplateObjectDescriptor::TemplateObjectDescriptor(StringVector&& rawStrings, OptionalStringVector&& cookedStrings)
     : m_rawStrings(WTFMove(rawStrings))
     , m_cookedStrings(WTFMove(cookedStrings))
     , m_hash(calculateHash(rawStrings))
 {
 }
 
-inline TemplateRegistryKey::TemplateRegistryKey(DeletedValueTag)
+inline TemplateObjectDescriptor::TemplateObjectDescriptor(DeletedValueTag)
     : m_hash(std::numeric_limits<unsigned>::max())
 {
 }
 
-inline TemplateRegistryKey::TemplateRegistryKey(EmptyValueTag)
+inline TemplateObjectDescriptor::TemplateObjectDescriptor(EmptyValueTag)
     : m_hash(0)
 {
 }
 
-inline unsigned TemplateRegistryKey::calculateHash(const StringVector& rawStrings)
+inline unsigned TemplateObjectDescriptor::calculateHash(const StringVector& rawStrings)
 {
     StringHasher hasher;
     for (const String& string : rawStrings) {
@@ -114,11 +112,11 @@ inline unsigned TemplateRegistryKey::calculateHash(const StringVector& rawString
 namespace WTF {
 template<typename T> struct DefaultHash;
 
-template<> struct DefaultHash<JSC::TemplateRegistryKey> {
-    typedef JSC::TemplateRegistryKey::Hasher Hash;
+template<> struct DefaultHash<JSC::TemplateObjectDescriptor> {
+    typedef JSC::TemplateObjectDescriptor::Hasher Hash;
 };
 
-template<> struct HashTraits<JSC::TemplateRegistryKey> : CustomHashTraits<JSC::TemplateRegistryKey> {
+template<> struct HashTraits<JSC::TemplateObjectDescriptor> : CustomHashTraits<JSC::TemplateObjectDescriptor> {
 };
 
 } // namespace WTF
diff --git a/Source/JavaScriptCore/runtime/TemplateRegistry.h b/Source/JavaScriptCore/runtime/TemplateRegistry.h
deleted file mode 100644 (file)
index e130904..0000000
+++ /dev/null
@@ -1,47 +0,0 @@
-/*
- * Copyright (C) 2015 Yusuke Suzuki <utatane.tea@gmail.com>.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the
- *    documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
- * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
- * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
- * THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#pragma once
-
-#include "JSArray.h"
-#include "WeakGCMap.h"
-#include <limits>
-
-namespace JSC {
-
-class JSTemplateRegistryKey;
-class TemplateRegistryKey;
-
-class TemplateRegistry {
-public:
-    TemplateRegistry(VM&);
-
-    JSArray* getTemplateObject(ExecState*, JSTemplateRegistryKey*);
-
-private:
-    WeakGCMap<const TemplateRegistryKey*, JSArray> m_templateMap;
-};
-
-} // namespace JSC
diff --git a/Source/JavaScriptCore/runtime/TemplateRegistryKeyTable.cpp b/Source/JavaScriptCore/runtime/TemplateRegistryKeyTable.cpp
deleted file mode 100644 (file)
index 1e3e358..0000000
+++ /dev/null
@@ -1,64 +0,0 @@
-/*
- * Copyright (C) 2016 Yusuke Suzuki <utatane.tea@gmail.com>.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the
- *    documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
- * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
- * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
- * THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include "config.h"
-#include "TemplateRegistryKeyTable.h"
-
-#include "TemplateRegistryKey.h"
-
-namespace JSC {
-
-struct TemplateRegistryKeyTranslator {
-    static unsigned hash(TemplateRegistryKey* generator) { return generator->hash(); }
-    static inline bool equal(TemplateRegistryKey* key, TemplateRegistryKey* generator) { return *key == *generator; }
-    static void translate(TemplateRegistryKey*& location, TemplateRegistryKey* generator, unsigned) { location = generator; }
-};
-
-TemplateRegistryKeyTable::~TemplateRegistryKeyTable()
-{
-    for (auto& key : m_atomicTable)
-        key->m_table = nullptr;
-}
-
-Ref<TemplateRegistryKey> TemplateRegistryKeyTable::createKey(TemplateRegistryKey::StringVector&& rawStrings, TemplateRegistryKey::OptionalStringVector&& cookedStrings)
-{
-    auto key = TemplateRegistryKey::create(WTFMove(rawStrings), WTFMove(cookedStrings));
-    auto addResult = m_atomicTable.add<TemplateRegistryKeyTranslator>(key.ptr());
-    if (addResult.isNewEntry)
-        (*addResult.iterator)->m_table = this;
-
-    return **addResult.iterator;
-}
-
-void TemplateRegistryKeyTable::unregister(TemplateRegistryKey& key)
-{
-    ASSERT(key.m_table == this);
-    auto iterator = m_atomicTable.find(&key);
-    ASSERT_WITH_MESSAGE(iterator != m_atomicTable.end(), "The TemplateRegistryKey being removed is registered in the other TemplateRegistryKeyTable.");
-    m_atomicTable.remove(iterator);
-
-}
-
-} // namespace JSC
diff --git a/Source/JavaScriptCore/runtime/TemplateRegistryKeyTable.h b/Source/JavaScriptCore/runtime/TemplateRegistryKeyTable.h
deleted file mode 100644 (file)
index c3252a8..0000000
+++ /dev/null
@@ -1,59 +0,0 @@
-/*
- * Copyright (C) 2016 Yusuke Suzuki <utatane.tea@gmail.com>.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the
- *    documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
- * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
- * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
- * THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#pragma once
-
-#include "TemplateRegistryKey.h"
-#include <wtf/Forward.h>
-#include <wtf/HashSet.h>
-#include <wtf/Noncopyable.h>
-
-namespace JSC {
-
-class TemplateRegistryKeyTable {
-    WTF_MAKE_NONCOPYABLE(TemplateRegistryKeyTable);
-public:
-    using StringVector = Vector<String, 4>;
-    using OptionalStringVector = Vector<std::optional<String>, 4>;
-
-    TemplateRegistryKeyTable() = default;
-
-    Ref<TemplateRegistryKey> createKey(StringVector&& rawStrings, OptionalStringVector&& cookedStrings);
-
-    void unregister(TemplateRegistryKey&);
-
-    ~TemplateRegistryKeyTable();
-
-private:
-    struct KeyHash {
-        static unsigned hash(const TemplateRegistryKey* key) { return key->hash(); }
-        static bool equal(const TemplateRegistryKey* a, const TemplateRegistryKey* b) { return *a == *b; }
-        static const bool safeToCompareToEmptyOrDeleted = false;
-    };
-
-    HashSet<TemplateRegistryKey*, KeyHash> m_atomicTable;
-};
-
-} // namespace JSC
index 472b7db..7ee8750 100644 (file)
@@ -90,7 +90,7 @@
 #include "JSSetIterator.h"
 #include "JSSourceCode.h"
 #include "JSStringHeapCellType.h"
-#include "JSTemplateRegistryKey.h"
+#include "JSTemplateObjectDescriptor.h"
 #include "JSWeakMap.h"
 #include "JSWeakSet.h"
 #include "JSWebAssembly.h"
@@ -360,7 +360,7 @@ VM::VM(VMType vmType, HeapType heapType)
     scriptFetchParametersStructure.set(*this, JSScriptFetchParameters::createStructure(*this, 0, jsNull()));
     structureChainStructure.set(*this, StructureChain::createStructure(*this, 0, jsNull()));
     sparseArrayValueMapStructure.set(*this, SparseArrayValueMap::createStructure(*this, 0, jsNull()));
-    templateRegistryKeyStructure.set(*this, JSTemplateRegistryKey::createStructure(*this, 0, jsNull()));
+    templateObjectDescriptorStructure.set(*this, JSTemplateObjectDescriptor::createStructure(*this, 0, jsNull()));
     arrayBufferNeuteringWatchpointStructure.set(*this, ArrayBufferNeuteringWatchpoint::createStructure(*this));
     unlinkedFunctionExecutableStructure.set(*this, UnlinkedFunctionExecutable::createStructure(*this, 0, jsNull()));
     unlinkedProgramCodeBlockStructure.set(*this, UnlinkedProgramCodeBlock::createStructure(*this, 0, jsNull()));
index cafb588..80854af 100644 (file)
@@ -51,7 +51,6 @@
 #include "SmallStrings.h"
 #include "Strong.h"
 #include "StructureCache.h"
-#include "TemplateRegistryKeyTable.h"
 #include "VMEntryRecord.h"
 #include "VMTraps.h"
 #include "ThreadLocalCache.h"
@@ -447,7 +446,7 @@ public:
     Strong<Structure> scriptFetchParametersStructure;
     Strong<Structure> structureChainStructure;
     Strong<Structure> sparseArrayValueMapStructure;
-    Strong<Structure> templateRegistryKeyStructure;
+    Strong<Structure> templateObjectDescriptorStructure;
     Strong<Structure> arrayBufferNeuteringWatchpointStructure;
     Strong<Structure> unlinkedFunctionExecutableStructure;
     Strong<Structure> unlinkedProgramCodeBlockStructure;
@@ -485,7 +484,6 @@ public:
 
     AtomicStringTable* m_atomicStringTable;
     WTF::SymbolRegistry m_symbolRegistry;
-    TemplateRegistryKeyTable m_templateRegistryKeytable;
     CommonIdentifiers* propertyNames;
     const ArgList* emptyList;
     SmallStrings smallStrings;
@@ -499,8 +497,6 @@ public:
     AtomicStringTable* atomicStringTable() const { return m_atomicStringTable; }
     WTF::SymbolRegistry& symbolRegistry() { return m_symbolRegistry; }
 
-    TemplateRegistryKeyTable& templateRegistryKeyTable() { return m_templateRegistryKeytable; }
-
     WeakGCMap<SymbolImpl*, Symbol, PtrHash<SymbolImpl*>> symbolImplToSymbolMap;
 
     enum class DeletePropertyMode {
index a06166a..d10915a 100644 (file)
@@ -27,6 +27,7 @@
 #include "VMEntryScope.h"
 
 #include "DisallowVMReentry.h"
+#include "JSGlobalObject.h"
 #include "Options.h"
 #include "SamplingProfiler.h"
 #include "ThreadLocalCacheInlines.h"