Unreviewed, rolling out r244978.
authorcommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 7 May 2019 19:57:10 +0000 (19:57 +0000)
committercommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 7 May 2019 19:57:10 +0000 (19:57 +0000)
https://bugs.webkit.org/show_bug.cgi?id=197671

TemplateObject map should use start/end offsets (Requested by
yusukesuzuki on #webkit).

Reverted changeset:

"TemplateObject passed to template literal tags are not always
identical for the same source location."
https://bugs.webkit.org/show_bug.cgi?id=190756
https://trac.webkit.org/changeset/244978

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

48 files changed:
JSTests/ChangeLog
JSTests/complex.yaml
JSTests/complex/tagged-template-regeneration-after.js [deleted file]
JSTests/complex/tagged-template-regeneration.js [deleted file]
JSTests/modules/tagged-template-inside-module.js [deleted file]
JSTests/modules/tagged-template-inside-module/other-tagged-templates.js [deleted file]
JSTests/stress/call-and-construct-should-return-same-tagged-templates.js [deleted file]
JSTests/stress/tagged-templates-in-direct-eval-should-not-produce-same-site-object.js [deleted file]
JSTests/stress/tagged-templates-in-function-in-direct-eval.js [deleted file]
JSTests/stress/tagged-templates-in-global-function-should-not-produce-same-site-object.js [deleted file]
JSTests/stress/tagged-templates-in-indirect-eval-should-not-produce-same-site-object.js [deleted file]
JSTests/stress/tagged-templates-in-multiple-functions.js [deleted file]
Source/JavaScriptCore/ChangeLog
Source/JavaScriptCore/Scripts/tests/builtins/expected/JavaScriptCore-Builtin.Promise-Combined.js-result
Source/JavaScriptCore/Scripts/tests/builtins/expected/JavaScriptCore-Builtin.Promise-Separate.js-result
Source/JavaScriptCore/Scripts/tests/builtins/expected/JavaScriptCore-Builtin.prototype-Combined.js-result
Source/JavaScriptCore/Scripts/tests/builtins/expected/JavaScriptCore-Builtin.prototype-Separate.js-result
Source/JavaScriptCore/Scripts/tests/builtins/expected/JavaScriptCore-BuiltinConstructor-Combined.js-result
Source/JavaScriptCore/Scripts/tests/builtins/expected/JavaScriptCore-BuiltinConstructor-Separate.js-result
Source/JavaScriptCore/Scripts/tests/builtins/expected/JavaScriptCore-InternalClashingNames-Combined.js-result
Source/JavaScriptCore/Scripts/tests/builtins/expected/WebCore-AnotherGuardedInternalBuiltin-Separate.js-result
Source/JavaScriptCore/Scripts/tests/builtins/expected/WebCore-ArbitraryConditionalGuard-Separate.js-result
Source/JavaScriptCore/Scripts/tests/builtins/expected/WebCore-GuardedBuiltin-Separate.js-result
Source/JavaScriptCore/Scripts/tests/builtins/expected/WebCore-GuardedInternalBuiltin-Separate.js-result
Source/JavaScriptCore/Scripts/tests/builtins/expected/WebCore-UnguardedBuiltin-Separate.js-result
Source/JavaScriptCore/Scripts/tests/builtins/expected/WebCore-xmlCasingTest-Separate.js-result
Source/JavaScriptCore/Scripts/wkbuiltins/builtins_templates.py
Source/JavaScriptCore/bytecode/CodeBlock.cpp
Source/JavaScriptCore/bytecode/CodeBlock.h
Source/JavaScriptCore/bytecode/UnlinkedFunctionExecutable.cpp
Source/JavaScriptCore/bytecode/UnlinkedFunctionExecutable.h
Source/JavaScriptCore/bytecompiler/BytecodeGenerator.cpp
Source/JavaScriptCore/bytecompiler/BytecodeGenerator.h
Source/JavaScriptCore/runtime/CachedTypes.cpp
Source/JavaScriptCore/runtime/EvalExecutable.cpp
Source/JavaScriptCore/runtime/EvalExecutable.h
Source/JavaScriptCore/runtime/FunctionExecutable.cpp
Source/JavaScriptCore/runtime/FunctionExecutable.h
Source/JavaScriptCore/runtime/JSModuleRecord.cpp
Source/JavaScriptCore/runtime/JSTemplateObjectDescriptor.cpp
Source/JavaScriptCore/runtime/JSTemplateObjectDescriptor.h
Source/JavaScriptCore/runtime/ModuleProgramExecutable.cpp
Source/JavaScriptCore/runtime/ModuleProgramExecutable.h
Source/JavaScriptCore/runtime/ProgramExecutable.cpp
Source/JavaScriptCore/runtime/ProgramExecutable.h
Source/JavaScriptCore/runtime/ScriptExecutable.cpp
Source/JavaScriptCore/runtime/ScriptExecutable.h
Source/JavaScriptCore/tools/JSDollarVM.cpp

index 73057b8..487cae1 100644 (file)
@@ -1,3 +1,18 @@
+2019-05-07  Commit Queue  <commit-queue@webkit.org>
+
+        Unreviewed, rolling out r244978.
+        https://bugs.webkit.org/show_bug.cgi?id=197671
+
+        TemplateObject map should use start/end offsets (Requested by
+        yusukesuzuki on #webkit).
+
+        Reverted changeset:
+
+        "TemplateObject passed to template literal tags are not always
+        identical for the same source location."
+        https://bugs.webkit.org/show_bug.cgi?id=190756
+        https://trac.webkit.org/changeset/244978
+
 2019-05-07  Tadeu Zagallo  <tzagallo@apple.com>
 
         tryCachePutByID should not crash if target offset changes
index 1061350..ce038f4 100644 (file)
@@ -25,6 +25,3 @@
 
 - path: complex/generator-regeneration.js
   cmd: runComplexTest [], ["generator-regeneration-after.js"], "--useDollarVM=1"
-
-- path: complex/tagged-template-regeneration.js
-  cmd: runComplexTest [], ["tagged-template-regeneration-after.js"], "--useDollarVM=1"
diff --git a/JSTests/complex/tagged-template-regeneration-after.js b/JSTests/complex/tagged-template-regeneration-after.js
deleted file mode 100644 (file)
index 6fc7f02..0000000
+++ /dev/null
@@ -1,7 +0,0 @@
-function shouldBe(actual, expected) {
-    if (actual !== expected)
-        throw new Error('bad value: ' + actual);
-}
-
-var second = test();
-shouldBe(first, second);
diff --git a/JSTests/complex/tagged-template-regeneration.js b/JSTests/complex/tagged-template-regeneration.js
deleted file mode 100644 (file)
index ec52ab6..0000000
+++ /dev/null
@@ -1,13 +0,0 @@
-function call(site)
-{
-    return site;
-}
-
-function test()
-{
-    return call`Cocoa`;
-}
-
-var first = test();
-$vm.deleteAllCodeWhenIdle();
-fullGC();
diff --git a/JSTests/modules/tagged-template-inside-module.js b/JSTests/modules/tagged-template-inside-module.js
deleted file mode 100644 (file)
index aa747fc..0000000
+++ /dev/null
@@ -1,11 +0,0 @@
-import { shouldThrow, shouldBe } from "./resources/assert.js";
-import { otherTaggedTemplates } from "./tagged-template-inside-module/other-tagged-templates.js"
-
-function call(site) {
-    return site;
-}
-
-var template = otherTaggedTemplates();
-shouldBe(call`Cocoa` !== template, true);
-shouldBe(template, otherTaggedTemplates());
-shouldBe(template, new otherTaggedTemplates());
diff --git a/JSTests/modules/tagged-template-inside-module/other-tagged-templates.js b/JSTests/modules/tagged-template-inside-module/other-tagged-templates.js
deleted file mode 100644 (file)
index 5d167a3..0000000
+++ /dev/null
@@ -1,9 +0,0 @@
-function call(site)
-{
-    return site;
-}
-
-export function otherTaggedTemplates()
-{
-    return call`Cocoa`;
-}
diff --git a/JSTests/stress/call-and-construct-should-return-same-tagged-templates.js b/JSTests/stress/call-and-construct-should-return-same-tagged-templates.js
deleted file mode 100644 (file)
index 8338ce5..0000000
+++ /dev/null
@@ -1,20 +0,0 @@
-function shouldBe(actual, expected)
-{
-    if (actual !== expected)
-        throw new Error('bad value: ' + actual);
-}
-
-function call(site)
-{
-    return site;
-}
-
-function poly()
-{
-    return call`Cocoa`;
-}
-
-var first = poly();
-var second = new poly();
-
-shouldBe(first, second);
diff --git a/JSTests/stress/tagged-templates-in-direct-eval-should-not-produce-same-site-object.js b/JSTests/stress/tagged-templates-in-direct-eval-should-not-produce-same-site-object.js
deleted file mode 100644 (file)
index fa48760..0000000
+++ /dev/null
@@ -1,14 +0,0 @@
-function shouldBe(actual, expected) {
-    if (actual !== expected)
-        throw new Error('bad value: ' + actual);
-}
-
-function call(site)
-{
-    return site;
-}
-
-var expr = "call`Cocoa`";
-var first = eval(expr);
-var second = eval(expr);
-shouldBe(first !== second, true);
diff --git a/JSTests/stress/tagged-templates-in-function-in-direct-eval.js b/JSTests/stress/tagged-templates-in-function-in-direct-eval.js
deleted file mode 100644 (file)
index eed24f6..0000000
+++ /dev/null
@@ -1,19 +0,0 @@
-function shouldBe(actual, expected)
-{
-    if (actual !== expected)
-        throw new Error('bad value: ' + actual);
-}
-
-function call(site)
-{
-    return site;
-}
-
-function test()
-{
-    return eval("(function ok() { return call`Cocoa`; })()");
-}
-
-var first = test();
-var second = test();
-shouldBe(first !== second, true);
diff --git a/JSTests/stress/tagged-templates-in-global-function-should-not-produce-same-site-object.js b/JSTests/stress/tagged-templates-in-global-function-should-not-produce-same-site-object.js
deleted file mode 100644 (file)
index 53e76ed..0000000
+++ /dev/null
@@ -1,21 +0,0 @@
-function shouldBe(actual, expected) {
-    if (actual !== expected)
-        throw new Error('bad value: ' + actual);
-}
-
-function call(site)
-{
-    return site;
-}
-
-var expr = "return call`Cocoa`";
-var firstFunction = Function(expr);
-var secondFunction = Function(expr);
-var first = firstFunction();
-var second = secondFunction();
-shouldBe(first !== second, true);
-
-shouldBe(first, firstFunction());
-shouldBe(first, new firstFunction());
-shouldBe(second, secondFunction());
-shouldBe(second, new secondFunction());
diff --git a/JSTests/stress/tagged-templates-in-indirect-eval-should-not-produce-same-site-object.js b/JSTests/stress/tagged-templates-in-indirect-eval-should-not-produce-same-site-object.js
deleted file mode 100644 (file)
index aeacb1b..0000000
+++ /dev/null
@@ -1,15 +0,0 @@
-function shouldBe(actual, expected) {
-    if (actual !== expected)
-        throw new Error('bad value: ' + actual);
-}
-
-var indirectEval = eval;
-function call(site)
-{
-    return site;
-}
-
-var expr = "call`Cocoa`";
-var first = indirectEval(expr);
-var second = indirectEval(expr);
-shouldBe(first !== second, true);
diff --git a/JSTests/stress/tagged-templates-in-multiple-functions.js b/JSTests/stress/tagged-templates-in-multiple-functions.js
deleted file mode 100644 (file)
index 3828f53..0000000
+++ /dev/null
@@ -1,33 +0,0 @@
-function shouldBe(actual, expected)
-{
-    if (actual !== expected)
-        throw new Error('bad value: ' + actual);
-}
-
-function call(site)
-{
-    return site;
-}
-
-function a()
-{
-    return call`Cocoa`;
-}
-
-function b()
-{
-    return call`Cocoa`;
-}
-
-function c()
-{
-    return [ call`Cocoa`, call`Cocoa` ];
-}
-
-shouldBe(a() !== b(), true);
-shouldBe(a() === a(), true);
-shouldBe(b() === b(), true);
-var result = c();
-shouldBe(c()[0] === result[0], true);
-shouldBe(c()[1] === result[1], true);
-shouldBe(result[0] !== result[1], true);
index da78849..a555e56 100644 (file)
@@ -1,3 +1,18 @@
+2019-05-07  Commit Queue  <commit-queue@webkit.org>
+
+        Unreviewed, rolling out r244978.
+        https://bugs.webkit.org/show_bug.cgi?id=197671
+
+        TemplateObject map should use start/end offsets (Requested by
+        yusukesuzuki on #webkit).
+
+        Reverted changeset:
+
+        "TemplateObject passed to template literal tags are not always
+        identical for the same source location."
+        https://bugs.webkit.org/show_bug.cgi?id=190756
+        https://trac.webkit.org/changeset/244978
+
 2019-05-07  Tadeu Zagallo  <tzagallo@apple.com>
 
         tryCachePutByID should not crash if target offset changes
index 8d30ca9..8ab7656 100644 (file)
@@ -141,7 +141,7 @@ s_JSCCombinedCode + 412
 #define DEFINE_BUILTIN_GENERATOR(codeName, functionName, overriddenName, argumentCount) \
 JSC::FunctionExecutable* codeName##Generator(JSC::VM& vm) \
 {\
-    return vm.builtinExecutables()->codeName##Executable()->link(vm, nullptr, vm.builtinExecutables()->codeName##Source(), WTF::nullopt, s_##codeName##Intrinsic); }
+    return vm.builtinExecutables()->codeName##Executable()->link(vm, vm.builtinExecutables()->codeName##Source(), WTF::nullopt, s_##codeName##Intrinsic); }
 JSC_FOREACH_BUILTIN_CODE(DEFINE_BUILTIN_GENERATOR)
 #undef DEFINE_BUILTIN_GENERATOR
 
index 048a601..bcedfb9 100644 (file)
@@ -158,7 +158,7 @@ const char* const s_builtinPromiseFulfillPromiseCode =
 #define DEFINE_BUILTIN_GENERATOR(codeName, functionName, overriddenName, argumentCount) \
 JSC::FunctionExecutable* codeName##Generator(JSC::VM& vm) \
 {\
-    return vm.builtinExecutables()->codeName##Executable()->link(vm, nullptr, vm.builtinExecutables()->codeName##Source(), WTF::nullopt, s_##codeName##Intrinsic); }
+    return vm.builtinExecutables()->codeName##Executable()->link(vm, vm.builtinExecutables()->codeName##Source(), WTF::nullopt, s_##codeName##Intrinsic); }
 JSC_FOREACH_BUILTIN.PROMISE_BUILTIN_CODE(DEFINE_BUILTIN_GENERATOR)
 #undef DEFINE_BUILTIN_GENERATOR
 
index 3dedbe1..215ec8e 100644 (file)
@@ -167,7 +167,7 @@ s_JSCCombinedCode + 2694
 #define DEFINE_BUILTIN_GENERATOR(codeName, functionName, overriddenName, argumentCount) \
 JSC::FunctionExecutable* codeName##Generator(JSC::VM& vm) \
 {\
-    return vm.builtinExecutables()->codeName##Executable()->link(vm, nullptr, vm.builtinExecutables()->codeName##Source(), WTF::nullopt, s_##codeName##Intrinsic); }
+    return vm.builtinExecutables()->codeName##Executable()->link(vm, vm.builtinExecutables()->codeName##Source(), WTF::nullopt, s_##codeName##Intrinsic); }
 JSC_FOREACH_BUILTIN_CODE(DEFINE_BUILTIN_GENERATOR)
 #undef DEFINE_BUILTIN_GENERATOR
 
index 8ff897f..ebb2e72 100644 (file)
@@ -282,7 +282,7 @@ const char* const s_builtinPrototypeTestCode =
 #define DEFINE_BUILTIN_GENERATOR(codeName, functionName, overriddenName, argumentCount) \
 JSC::FunctionExecutable* codeName##Generator(JSC::VM& vm) \
 {\
-    return vm.builtinExecutables()->codeName##Executable()->link(vm, nullptr, vm.builtinExecutables()->codeName##Source(), WTF::nullopt, s_##codeName##Intrinsic); }
+    return vm.builtinExecutables()->codeName##Executable()->link(vm, vm.builtinExecutables()->codeName##Source(), WTF::nullopt, s_##codeName##Intrinsic); }
 JSC_FOREACH_BUILTIN.PROTOTYPE_BUILTIN_CODE(DEFINE_BUILTIN_GENERATOR)
 #undef DEFINE_BUILTIN_GENERATOR
 
index 1d8345f..be3a59a 100644 (file)
@@ -139,7 +139,7 @@ s_JSCCombinedCode + 2046
 #define DEFINE_BUILTIN_GENERATOR(codeName, functionName, overriddenName, argumentCount) \
 JSC::FunctionExecutable* codeName##Generator(JSC::VM& vm) \
 {\
-    return vm.builtinExecutables()->codeName##Executable()->link(vm, nullptr, vm.builtinExecutables()->codeName##Source(), WTF::nullopt, s_##codeName##Intrinsic); }
+    return vm.builtinExecutables()->codeName##Executable()->link(vm, vm.builtinExecutables()->codeName##Source(), WTF::nullopt, s_##codeName##Intrinsic); }
 JSC_FOREACH_BUILTIN_CODE(DEFINE_BUILTIN_GENERATOR)
 #undef DEFINE_BUILTIN_GENERATOR
 
index a6ddd91..454861f 100644 (file)
@@ -212,7 +212,7 @@ const char* const s_builtinConstructorFromCode =
 #define DEFINE_BUILTIN_GENERATOR(codeName, functionName, overriddenName, argumentCount) \
 JSC::FunctionExecutable* codeName##Generator(JSC::VM& vm) \
 {\
-    return vm.builtinExecutables()->codeName##Executable()->link(vm, nullptr, vm.builtinExecutables()->codeName##Source(), WTF::nullopt, s_##codeName##Intrinsic); }
+    return vm.builtinExecutables()->codeName##Executable()->link(vm, vm.builtinExecutables()->codeName##Source(), WTF::nullopt, s_##codeName##Intrinsic); }
 JSC_FOREACH_BUILTINCONSTRUCTOR_BUILTIN_CODE(DEFINE_BUILTIN_GENERATOR)
 #undef DEFINE_BUILTIN_GENERATOR
 
index b5feac2..bfb2b2e 100644 (file)
@@ -140,7 +140,7 @@ s_JSCCombinedCode + 71
 #define DEFINE_BUILTIN_GENERATOR(codeName, functionName, overriddenName, argumentCount) \
 JSC::FunctionExecutable* codeName##Generator(JSC::VM& vm) \
 {\
-    return vm.builtinExecutables()->codeName##Executable()->link(vm, nullptr, vm.builtinExecutables()->codeName##Source(), WTF::nullopt, s_##codeName##Intrinsic); }
+    return vm.builtinExecutables()->codeName##Executable()->link(vm, vm.builtinExecutables()->codeName##Source(), WTF::nullopt, s_##codeName##Intrinsic); }
 JSC_FOREACH_BUILTIN_CODE(DEFINE_BUILTIN_GENERATOR)
 #undef DEFINE_BUILTIN_GENERATOR
 
index 043a993..e46d23a 100644 (file)
@@ -220,7 +220,7 @@ const char* const s_anotherGuardedInternalBuiltinLetsFetchCode =
 JSC::FunctionExecutable* codeName##Generator(JSC::VM& vm) \
 {\
     JSVMClientData* clientData = static_cast<JSVMClientData*>(vm.clientData); \
-    return clientData->builtinFunctions().anotherGuardedInternalBuiltinBuiltins().codeName##Executable()->link(vm, nullptr, clientData->builtinFunctions().anotherGuardedInternalBuiltinBuiltins().codeName##Source(), WTF::nullopt, s_##codeName##Intrinsic); \
+    return clientData->builtinFunctions().anotherGuardedInternalBuiltinBuiltins().codeName##Executable()->link(vm, clientData->builtinFunctions().anotherGuardedInternalBuiltinBuiltins().codeName##Source(), WTF::nullopt, s_##codeName##Intrinsic); \
 }
 WEBCORE_FOREACH_ANOTHERGUARDEDINTERNALBUILTIN_BUILTIN_CODE(DEFINE_BUILTIN_GENERATOR)
 #undef DEFINE_BUILTIN_GENERATOR
index a42fcfb..be0709a 100644 (file)
@@ -190,7 +190,7 @@ const char* const s_arbitraryConditionalGuardIsReadableStreamLockedCode =
 JSC::FunctionExecutable* codeName##Generator(JSC::VM& vm) \
 {\
     JSVMClientData* clientData = static_cast<JSVMClientData*>(vm.clientData); \
-    return clientData->builtinFunctions().arbitraryConditionalGuardBuiltins().codeName##Executable()->link(vm, nullptr, clientData->builtinFunctions().arbitraryConditionalGuardBuiltins().codeName##Source(), WTF::nullopt, s_##codeName##Intrinsic); \
+    return clientData->builtinFunctions().arbitraryConditionalGuardBuiltins().codeName##Executable()->link(vm, clientData->builtinFunctions().arbitraryConditionalGuardBuiltins().codeName##Source(), WTF::nullopt, s_##codeName##Intrinsic); \
 }
 WEBCORE_FOREACH_ARBITRARYCONDITIONALGUARD_BUILTIN_CODE(DEFINE_BUILTIN_GENERATOR)
 #undef DEFINE_BUILTIN_GENERATOR
index 5896e07..5567dfa 100644 (file)
@@ -190,7 +190,7 @@ const char* const s_guardedBuiltinIsReadableStreamLockedCode =
 JSC::FunctionExecutable* codeName##Generator(JSC::VM& vm) \
 {\
     JSVMClientData* clientData = static_cast<JSVMClientData*>(vm.clientData); \
-    return clientData->builtinFunctions().guardedBuiltinBuiltins().codeName##Executable()->link(vm, nullptr, clientData->builtinFunctions().guardedBuiltinBuiltins().codeName##Source(), WTF::nullopt, s_##codeName##Intrinsic); \
+    return clientData->builtinFunctions().guardedBuiltinBuiltins().codeName##Executable()->link(vm, clientData->builtinFunctions().guardedBuiltinBuiltins().codeName##Source(), WTF::nullopt, s_##codeName##Intrinsic); \
 }
 WEBCORE_FOREACH_GUARDEDBUILTIN_BUILTIN_CODE(DEFINE_BUILTIN_GENERATOR)
 #undef DEFINE_BUILTIN_GENERATOR
index cc191ed..6adaf32 100644 (file)
@@ -222,7 +222,7 @@ const char* const s_guardedInternalBuiltinIsReadableStreamLockedCode =
 JSC::FunctionExecutable* codeName##Generator(JSC::VM& vm) \
 {\
     JSVMClientData* clientData = static_cast<JSVMClientData*>(vm.clientData); \
-    return clientData->builtinFunctions().guardedInternalBuiltinBuiltins().codeName##Executable()->link(vm, nullptr, clientData->builtinFunctions().guardedInternalBuiltinBuiltins().codeName##Source(), WTF::nullopt, s_##codeName##Intrinsic); \
+    return clientData->builtinFunctions().guardedInternalBuiltinBuiltins().codeName##Executable()->link(vm, clientData->builtinFunctions().guardedInternalBuiltinBuiltins().codeName##Source(), WTF::nullopt, s_##codeName##Intrinsic); \
 }
 WEBCORE_FOREACH_GUARDEDINTERNALBUILTIN_BUILTIN_CODE(DEFINE_BUILTIN_GENERATOR)
 #undef DEFINE_BUILTIN_GENERATOR
index 0c091eb..8bc20fb 100644 (file)
@@ -184,7 +184,7 @@ const char* const s_unguardedBuiltinIsReadableStreamLockedCode =
 JSC::FunctionExecutable* codeName##Generator(JSC::VM& vm) \
 {\
     JSVMClientData* clientData = static_cast<JSVMClientData*>(vm.clientData); \
-    return clientData->builtinFunctions().unguardedBuiltinBuiltins().codeName##Executable()->link(vm, nullptr, clientData->builtinFunctions().unguardedBuiltinBuiltins().codeName##Source(), WTF::nullopt, s_##codeName##Intrinsic); \
+    return clientData->builtinFunctions().unguardedBuiltinBuiltins().codeName##Executable()->link(vm, clientData->builtinFunctions().unguardedBuiltinBuiltins().codeName##Source(), WTF::nullopt, s_##codeName##Intrinsic); \
 }
 WEBCORE_FOREACH_UNGUARDEDBUILTIN_BUILTIN_CODE(DEFINE_BUILTIN_GENERATOR)
 #undef DEFINE_BUILTIN_GENERATOR
index fe2eff5..02d4417 100644 (file)
@@ -275,7 +275,7 @@ const char* const s_xmlCasingTestUrlCasingTestCode =
 JSC::FunctionExecutable* codeName##Generator(JSC::VM& vm) \
 {\
     JSVMClientData* clientData = static_cast<JSVMClientData*>(vm.clientData); \
-    return clientData->builtinFunctions().xmlCasingTestBuiltins().codeName##Executable()->link(vm, nullptr, clientData->builtinFunctions().xmlCasingTestBuiltins().codeName##Source(), WTF::nullopt, s_##codeName##Intrinsic); \
+    return clientData->builtinFunctions().xmlCasingTestBuiltins().codeName##Executable()->link(vm, clientData->builtinFunctions().xmlCasingTestBuiltins().codeName##Source(), WTF::nullopt, s_##codeName##Intrinsic); \
 }
 WEBCORE_FOREACH_XMLCASINGTEST_BUILTIN_CODE(DEFINE_BUILTIN_GENERATOR)
 #undef DEFINE_BUILTIN_GENERATOR
index 3665cb5..4c293cc 100644 (file)
@@ -85,7 +85,7 @@ ${macroPrefix}_FOREACH_${objectMacro}_BUILTIN_CODE(DECLARE_BUILTIN_GENERATOR)
 #define DEFINE_BUILTIN_GENERATOR(codeName, functionName, overriddenName, argumentCount) \\
 JSC::FunctionExecutable* codeName##Generator(JSC::VM& vm) \\
 {\\
-    return vm.builtinExecutables()->codeName##Executable()->link(vm, nullptr, vm.builtinExecutables()->codeName##Source(), WTF::nullopt, s_##codeName##Intrinsic); \
+    return vm.builtinExecutables()->codeName##Executable()->link(vm, vm.builtinExecutables()->codeName##Source(), WTF::nullopt, s_##codeName##Intrinsic); \
 }
 ${macroPrefix}_FOREACH_BUILTIN_CODE(DEFINE_BUILTIN_GENERATOR)
 #undef DEFINE_BUILTIN_GENERATOR
@@ -96,7 +96,7 @@ ${macroPrefix}_FOREACH_BUILTIN_CODE(DEFINE_BUILTIN_GENERATOR)
 #define DEFINE_BUILTIN_GENERATOR(codeName, functionName, overriddenName, argumentCount) \\
 JSC::FunctionExecutable* codeName##Generator(JSC::VM& vm) \\
 {\\
-    return vm.builtinExecutables()->codeName##Executable()->link(vm, nullptr, vm.builtinExecutables()->codeName##Source(), WTF::nullopt, s_##codeName##Intrinsic); \
+    return vm.builtinExecutables()->codeName##Executable()->link(vm, vm.builtinExecutables()->codeName##Source(), WTF::nullopt, s_##codeName##Intrinsic); \
 }
 ${macroPrefix}_FOREACH_${objectMacro}_BUILTIN_CODE(DEFINE_BUILTIN_GENERATOR)
 #undef DEFINE_BUILTIN_GENERATOR
@@ -108,7 +108,7 @@ ${macroPrefix}_FOREACH_${objectMacro}_BUILTIN_CODE(DEFINE_BUILTIN_GENERATOR)
 JSC::FunctionExecutable* codeName##Generator(JSC::VM& vm) \\
 {\\
     JSVMClientData* clientData = static_cast<JSVMClientData*>(vm.clientData); \\
-    return clientData->builtinFunctions().${objectNameLC}Builtins().codeName##Executable()->link(vm, nullptr, clientData->builtinFunctions().${objectNameLC}Builtins().codeName##Source(), WTF::nullopt, s_##codeName##Intrinsic); \\
+    return clientData->builtinFunctions().${objectNameLC}Builtins().codeName##Executable()->link(vm, clientData->builtinFunctions().${objectNameLC}Builtins().codeName##Source(), WTF::nullopt, s_##codeName##Intrinsic); \\
 }
 ${macroPrefix}_FOREACH_BUILTIN_CODE(DEFINE_BUILTIN_GENERATOR)
 #undef DEFINE_BUILTIN_GENERATOR
@@ -120,7 +120,7 @@ ${macroPrefix}_FOREACH_BUILTIN_CODE(DEFINE_BUILTIN_GENERATOR)
 JSC::FunctionExecutable* codeName##Generator(JSC::VM& vm) \\
 {\\
     JSVMClientData* clientData = static_cast<JSVMClientData*>(vm.clientData); \\
-    return clientData->builtinFunctions().${objectNameLC}Builtins().codeName##Executable()->link(vm, nullptr, clientData->builtinFunctions().${objectNameLC}Builtins().codeName##Source(), WTF::nullopt, s_##codeName##Intrinsic); \\
+    return clientData->builtinFunctions().${objectNameLC}Builtins().codeName##Executable()->link(vm, clientData->builtinFunctions().${objectNameLC}Builtins().codeName##Source(), WTF::nullopt, s_##codeName##Intrinsic); \\
 }
 ${macroPrefix}_FOREACH_${objectMacro}_BUILTIN_CODE(DEFINE_BUILTIN_GENERATOR)
 #undef DEFINE_BUILTIN_GENERATOR
index 46f3ed7..7b191cd 100644 (file)
@@ -395,8 +395,7 @@ bool CodeBlock::finishCreation(VM& vm, ScriptExecutable* ownerExecutable, Unlink
     if (m_unlinkedCode->wasCompiledWithTypeProfilerOpcodes() || m_unlinkedCode->wasCompiledWithControlFlowProfilerOpcodes())
         vm.functionHasExecutedCache()->removeUnexecutedRange(ownerExecutable->sourceID(), ownerExecutable->typeProfilingStartOffset(vm), ownerExecutable->typeProfilingEndOffset(vm));
 
-    ScriptExecutable* topLevelExecutable = ownerExecutable->topLevelExecutable();
-    setConstantRegisters(unlinkedCodeBlock->constantRegisters(), unlinkedCodeBlock->constantsSourceCodeRepresentation(), topLevelExecutable);
+    setConstantRegisters(unlinkedCodeBlock->constantRegisters(), unlinkedCodeBlock->constantsSourceCodeRepresentation());
     RETURN_IF_EXCEPTION(throwScope, false);
 
     for (unsigned i = 0; i < LinkTimeConstantCount; i++) {
@@ -422,7 +421,7 @@ bool CodeBlock::finishCreation(VM& vm, ScriptExecutable* ownerExecutable, Unlink
         UnlinkedFunctionExecutable* unlinkedExecutable = unlinkedCodeBlock->functionDecl(i);
         if (shouldUpdateFunctionHasExecutedCache)
             vm.functionHasExecutedCache()->insertUnexecutedRange(ownerExecutable->sourceID(), unlinkedExecutable->typeProfilingStartOffset(), unlinkedExecutable->typeProfilingEndOffset());
-        m_functionDecls[i].set(vm, this, unlinkedExecutable->link(vm, topLevelExecutable, ownerExecutable->source()));
+        m_functionDecls[i].set(vm, this, unlinkedExecutable->link(vm, ownerExecutable->source()));
     }
 
     m_functionExprs = RefCountedArray<WriteBarrier<FunctionExecutable>>(unlinkedCodeBlock->numberOfFunctionExprs());
@@ -430,7 +429,7 @@ bool CodeBlock::finishCreation(VM& vm, ScriptExecutable* ownerExecutable, Unlink
         UnlinkedFunctionExecutable* unlinkedExecutable = unlinkedCodeBlock->functionExpr(i);
         if (shouldUpdateFunctionHasExecutedCache)
             vm.functionHasExecutedCache()->insertUnexecutedRange(ownerExecutable->sourceID(), unlinkedExecutable->typeProfilingStartOffset(), unlinkedExecutable->typeProfilingEndOffset());
-        m_functionExprs[i].set(vm, this, unlinkedExecutable->link(vm, topLevelExecutable, ownerExecutable->source()));
+        m_functionExprs[i].set(vm, this, unlinkedExecutable->link(vm, ownerExecutable->source()));
     }
 
     if (unlinkedCodeBlock->hasRareData()) {
@@ -871,7 +870,7 @@ void CodeBlock::setConstantIdentifierSetRegisters(VM& vm, const Vector<ConstantI
     }
 }
 
-void CodeBlock::setConstantRegisters(const Vector<WriteBarrier<Unknown>>& constants, const Vector<SourceCodeRepresentation>& constantsSourceCodeRepresentation, ScriptExecutable* topLevelExecutable)
+void CodeBlock::setConstantRegisters(const Vector<WriteBarrier<Unknown>>& constants, const Vector<SourceCodeRepresentation>& constantsSourceCodeRepresentation)
 {
     VM& vm = *m_vm;
     auto scope = DECLARE_THROW_SCOPE(vm);
@@ -899,7 +898,7 @@ void CodeBlock::setConstantRegisters(const Vector<WriteBarrier<Unknown>>& consta
 
                     constant = clone;
                 } else if (auto* descriptor = jsDynamicCast<JSTemplateObjectDescriptor*>(vm, cell)) {
-                    auto* templateObject = topLevelExecutable->createTemplateObject(exec, descriptor);
+                    auto* templateObject = descriptor->createTemplateObject(exec);
                     RETURN_IF_EXCEPTION(scope, void());
                     constant = templateObject;
                 }
index 406fca0..12f9082 100644 (file)
@@ -911,7 +911,7 @@ private:
 
     void setConstantIdentifierSetRegisters(VM&, const Vector<ConstantIdentifierSetEntry>& constants);
 
-    void setConstantRegisters(const Vector<WriteBarrier<Unknown>>& constants, const Vector<SourceCodeRepresentation>& constantsSourceCodeRepresentation, ScriptExecutable* topLevelExecutable);
+    void setConstantRegisters(const Vector<WriteBarrier<Unknown>>& constants, const Vector<SourceCodeRepresentation>& constantsSourceCodeRepresentation);
 
     void replaceConstant(int index, JSValue value)
     {
index 5e7148e..61449db 100644 (file)
@@ -158,7 +158,7 @@ SourceCode UnlinkedFunctionExecutable::linkedSourceCode(const SourceCode& passed
     return SourceCode(parentSource.provider(), startOffset, startOffset + m_sourceLength, firstLine, startColumn);
 }
 
-FunctionExecutable* UnlinkedFunctionExecutable::link(VM& vm, ScriptExecutable* topLevelExecutable, const SourceCode& passedParentSource, Optional<int> overrideLineNumber, Intrinsic intrinsic)
+FunctionExecutable* UnlinkedFunctionExecutable::link(VM& vm, const SourceCode& passedParentSource, Optional<int> overrideLineNumber, Intrinsic intrinsic)
 {
     SourceCode source = linkedSourceCode(passedParentSource);
     FunctionOverrides::OverrideInfo overrideInfo;
@@ -166,7 +166,7 @@ FunctionExecutable* UnlinkedFunctionExecutable::link(VM& vm, ScriptExecutable* t
     if (UNLIKELY(Options::functionOverrides()))
         hasFunctionOverride = FunctionOverrides::initializeOverrideFor(source, overrideInfo);
 
-    FunctionExecutable* result = FunctionExecutable::create(vm, topLevelExecutable, source, this, intrinsic);
+    FunctionExecutable* result = FunctionExecutable::create(vm, source, this, intrinsic);
     if (overrideLineNumber)
         result->setOverrideLineNumber(*overrideLineNumber);
 
index 8e0abed..1b03597 100644 (file)
@@ -126,7 +126,7 @@ public:
         int overrideLineNumber, Optional<int> functionConstructorParametersEndPosition);
 
     SourceCode linkedSourceCode(const SourceCode&) const;
-    JS_EXPORT_PRIVATE FunctionExecutable* link(VM&, ScriptExecutable* topLevelExecutable, const SourceCode& parentSource, Optional<int> overrideLineNumber = WTF::nullopt, Intrinsic = NoIntrinsic);
+    JS_EXPORT_PRIVATE FunctionExecutable* link(VM&, const SourceCode& parentSource, Optional<int> overrideLineNumber = WTF::nullopt, Intrinsic = NoIntrinsic);
 
     void clearCode(VM& vm)
     {
index 94de182..35409a6 100644 (file)
@@ -2948,12 +2948,12 @@ JSString* BytecodeGenerator::addStringConstant(const Identifier& identifier)
     return stringInMap;
 }
 
-RegisterID* BytecodeGenerator::addTemplateObjectConstant(Ref<TemplateObjectDescriptor>&& descriptor, int startOffset)
+RegisterID* BytecodeGenerator::addTemplateObjectConstant(Ref<TemplateObjectDescriptor>&& descriptor)
 {
-    auto result = m_templateObjectDescriptorSet.add(WTFMove(descriptor));
-    JSTemplateObjectDescriptor* descriptorValue = m_templateDescriptorMap.ensure(startOffset, [&] {
-        return JSTemplateObjectDescriptor::create(*vm(), result.iterator->copyRef(), startOffset);
+    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];
@@ -4141,7 +4141,7 @@ RegisterID* BytecodeGenerator::emitGetTemplateObject(RegisterID* dst, TaggedTemp
         else
             cookedStrings.append(string->cooked()->impl());
     }
-    RefPtr<RegisterID> constant = addTemplateObjectConstant(TemplateObjectDescriptor::create(WTFMove(rawStrings), WTFMove(cookedStrings)), taggedTemplate->startOffset());
+    RefPtr<RegisterID> constant = addTemplateObjectConstant(TemplateObjectDescriptor::create(WTFMove(rawStrings), WTFMove(cookedStrings)));
     if (!dst)
         return constant.get();
     return move(dst, constant.get());
index 29ed39a..4426b51 100644 (file)
@@ -1060,8 +1060,7 @@ namespace JSC {
         using NumberMap = HashMap<double, JSValue>;
         using IdentifierStringMap = HashMap<UniquedStringImpl*, JSString*, IdentifierRepHash>;
         using IdentifierBigIntMap = HashMap<BigIntMapEntry, JSBigInt*>;
-        using TemplateObjectDescriptorSet = HashSet<Ref<TemplateObjectDescriptor>>;
-        using TemplateDescriptorMap = HashMap<uint64_t, JSTemplateObjectDescriptor*, WTF::IntHash<uint64_t>, WTF::UnsignedWithZeroKeyHashTraits<uint64_t>>;
+        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
@@ -1153,7 +1152,7 @@ namespace JSC {
     public:
         JSString* addStringConstant(const Identifier&);
         JSValue addBigIntConstant(const Identifier&, uint8_t radix, bool sign);
-        RegisterID* addTemplateObjectConstant(Ref<TemplateObjectDescriptor>&&, int);
+        RegisterID* addTemplateObjectConstant(Ref<TemplateObjectDescriptor>&&);
 
         const InstructionStream& instructions() const { return m_writer; }
 
@@ -1271,8 +1270,7 @@ namespace JSC {
         JSValueMap m_jsValueMap;
         IdentifierStringMap m_stringMap;
         IdentifierBigIntMap m_bigIntMap;
-        TemplateObjectDescriptorSet m_templateObjectDescriptorSet;
-        TemplateDescriptorMap m_templateDescriptorMap;
+        TemplateObjectDescriptorMap m_templateObjectDescriptorMap;
 
         StaticPropertyAnalyzer m_staticPropertyAnalyzer;
 
index 7a97183..93f2224 100644 (file)
@@ -1152,26 +1152,24 @@ private:
 
 class CachedTemplateObjectDescriptor : public CachedObject<TemplateObjectDescriptor> {
 public:
-    void encode(Encoder& encoder, const JSTemplateObjectDescriptor& descriptor)
+    void encode(Encoder& encoder, const TemplateObjectDescriptor& templateObjectDescriptor)
     {
-        m_rawStrings.encode(encoder, descriptor.descriptor().rawStrings());
-        m_cookedStrings.encode(encoder, descriptor.descriptor().cookedStrings());
-        m_startOffset = descriptor.startOffset();
+        m_rawStrings.encode(encoder, templateObjectDescriptor.rawStrings());
+        m_cookedStrings.encode(encoder, templateObjectDescriptor.cookedStrings());
     }
 
-    JSTemplateObjectDescriptor* decode(Decoder& decoder) const
+    Ref<TemplateObjectDescriptor> decode(Decoder& decoder) const
     {
         TemplateObjectDescriptor::StringVector decodedRawStrings;
         TemplateObjectDescriptor::OptionalStringVector decodedCookedStrings;
         m_rawStrings.decode(decoder, decodedRawStrings);
         m_cookedStrings.decode(decoder, decodedCookedStrings);
-        return JSTemplateObjectDescriptor::create(decoder.vm(), TemplateObjectDescriptor::create(WTFMove(decodedRawStrings), WTFMove(decodedCookedStrings)), m_startOffset);
+        return TemplateObjectDescriptor::create(WTFMove(decodedRawStrings), WTFMove(decodedCookedStrings));
     }
 
 private:
     CachedVector<CachedString, 4> m_rawStrings;
     CachedVector<CachedOptional<CachedString>, 4> m_cookedStrings;
-    int m_startOffset;
 };
 
 class CachedBigInt : public VariableLengthObject<JSBigInt> {
@@ -1245,7 +1243,7 @@ public:
 
         if (auto* templateObjectDescriptor = jsDynamicCast<JSTemplateObjectDescriptor*>(vm, cell)) {
             m_type = EncodedType::TemplateObjectDescriptor;
-            this->allocate<CachedTemplateObjectDescriptor>(encoder)->encode(encoder, *templateObjectDescriptor);
+            this->allocate<CachedTemplateObjectDescriptor>(encoder)->encode(encoder, templateObjectDescriptor->descriptor());
             return;
         }
 
@@ -1280,7 +1278,7 @@ public:
             v = this->buffer<CachedRegExp>()->decode(decoder);
             break;
         case EncodedType::TemplateObjectDescriptor:
-            v = this->buffer<CachedTemplateObjectDescriptor>()->decode(decoder);
+            v = JSTemplateObjectDescriptor::create(decoder.vm(), this->buffer<CachedTemplateObjectDescriptor>()->decode(decoder));
             break;
         case EncodedType::BigInt:
             v = this->buffer<CachedBigInt>()->decode(decoder);
index e2ca408..28c7f76 100644 (file)
@@ -44,11 +44,6 @@ void EvalExecutable::destroy(JSCell* cell)
     static_cast<EvalExecutable*>(cell)->EvalExecutable::~EvalExecutable();
 }
 
-auto EvalExecutable::ensureTemplateObjectMap(VM&) -> TemplateObjectMap&
-{
-    return ensureTemplateObjectMapImpl(m_templateObjectMap);
-}
-
 void EvalExecutable::visitChildren(JSCell* cell, SlotVisitor& visitor)
 {
     EvalExecutable* thisObject = jsCast<EvalExecutable*>(cell);
@@ -56,11 +51,6 @@ void EvalExecutable::visitChildren(JSCell* cell, SlotVisitor& visitor)
     Base::visitChildren(thisObject, visitor);
     visitor.append(thisObject->m_unlinkedEvalCodeBlock);
     visitor.append(thisObject->m_evalCodeBlock);
-    if (TemplateObjectMap* map = thisObject->m_templateObjectMap.get()) {
-        auto locker = holdLock(thisObject->cellLock());
-        for (auto& entry : *map)
-            visitor.append(entry.value);
-    }
 }
 
 } // namespace JSC
index 57b7a35..b9cb74d 100644 (file)
@@ -69,8 +69,6 @@ public:
     unsigned numTopLevelFunctionDecls() { return m_unlinkedEvalCodeBlock->numberOfFunctionDecls(); }
     bool allowDirectEvalCache() const { return m_unlinkedEvalCodeBlock->allowDirectEvalCache(); }
 
-    TemplateObjectMap& ensureTemplateObjectMap(VM&);
-
 protected:
     friend class ExecutableBase;
     friend class ScriptExecutable;
@@ -82,7 +80,6 @@ protected:
 
     WriteBarrier<ExecutableToCodeBlockEdge> m_evalCodeBlock;
     WriteBarrier<UnlinkedEvalCodeBlock> m_unlinkedEvalCodeBlock;
-    std::unique_ptr<TemplateObjectMap> m_templateObjectMap;
 };
 
 } // namespace JSC
index af3ab88..2e85f47 100644 (file)
@@ -54,10 +54,9 @@ FunctionExecutable::FunctionExecutable(VM& vm, const SourceCode& source, Unlinke
         m_singletonFunctionState = ClearWatchpoint;
 }
 
-void FunctionExecutable::finishCreation(VM& vm, ScriptExecutable* topLevelExecutable)
+void FunctionExecutable::finishCreation(VM& vm)
 {
     Base::finishCreation(vm);
-    m_topLevelExecutable.set(vm, this, topLevelExecutable ? topLevelExecutable : this);
     if (VM::canUseJIT())
         m_singletonFunction.set(vm, this, InferredValue::create(vm));
 }
@@ -86,20 +85,12 @@ void FunctionExecutable::visitChildren(JSCell* cell, SlotVisitor& visitor)
     FunctionExecutable* thisObject = jsCast<FunctionExecutable*>(cell);
     ASSERT_GC_OBJECT_INHERITS(thisObject, info());
     Base::visitChildren(thisObject, visitor);
-    visitor.append(thisObject->m_topLevelExecutable);
     visitor.append(thisObject->m_codeBlockForCall);
     visitor.append(thisObject->m_codeBlockForConstruct);
     visitor.append(thisObject->m_unlinkedExecutable);
     if (VM::canUseJIT())
         visitor.append(thisObject->m_singletonFunction);
-    if (RareData* rareData = thisObject->m_rareData.get()) {
-        visitor.append(rareData->m_cachedPolyProtoStructure);
-        if (TemplateObjectMap* map = rareData->m_templateObjectMap.get()) {
-            auto locker = holdLock(thisObject->cellLock());
-            for (auto& entry : *map)
-                visitor.append(entry.value);
-        }
-    }
+    visitor.append(thisObject->m_cachedPolyProtoStructure);
 }
 
 FunctionExecutable* FunctionExecutable::fromGlobalCode(
@@ -112,7 +103,7 @@ FunctionExecutable* FunctionExecutable::fromGlobalCode(
     if (!unlinkedExecutable)
         return nullptr;
 
-    return unlinkedExecutable->link(exec.vm(), nullptr, source, overrideLineNumber);
+    return unlinkedExecutable->link(exec.vm(), source, overrideLineNumber);
 }
 
 FunctionExecutable::RareData& FunctionExecutable::ensureRareDataSlow()
@@ -124,7 +115,6 @@ FunctionExecutable::RareData& FunctionExecutable::ensureRareDataSlow()
     rareData->m_parametersStartOffset = parametersStartOffset();
     rareData->m_typeProfilingStartOffset = typeProfilingStartOffset();
     rareData->m_typeProfilingEndOffset = typeProfilingEndOffset();
-    WTF::storeStoreFence();
     m_rareData = WTFMove(rareData);
     return *m_rareData;
 }
@@ -140,10 +130,4 @@ void FunctionExecutable::overrideInfo(const FunctionOverrideInfo& overrideInfo)
     rareData.m_typeProfilingEndOffset = overrideInfo.typeProfilingEndOffset;
 }
 
-auto FunctionExecutable::ensureTemplateObjectMap(VM&) -> TemplateObjectMap&
-{
-    RareData& rareData = ensureRareData();
-    return ensureTemplateObjectMapImpl(rareData.m_templateObjectMap);
-}
-
 } // namespace JSC
index 6fb5ccd..7cfedbd 100644 (file)
@@ -48,10 +48,10 @@ public:
         return &vm.functionExecutableSpace.space;
     }
 
-    static FunctionExecutable* create(VM& vm, ScriptExecutable* topLevelExecutable, const SourceCode& source, UnlinkedFunctionExecutable* unlinkedExecutable, Intrinsic intrinsic)
+    static FunctionExecutable* create(VM& vm, const SourceCode& source, UnlinkedFunctionExecutable* unlinkedExecutable, Intrinsic intrinsic)
     {
         FunctionExecutable* executable = new (NotNull, allocateCell<FunctionExecutable>(vm.heap)) FunctionExecutable(vm, source, unlinkedExecutable, intrinsic);
-        executable->finishCreation(vm, topLevelExecutable);
+        executable->finishCreation(vm);
         return executable;
     }
     static FunctionExecutable* fromGlobalCode(
@@ -282,16 +282,8 @@ public:
     }
 
     // Cached poly proto structure for the result of constructing this executable.
-    Structure* cachedPolyProtoStructure()
-    {
-        if (UNLIKELY(m_rareData))
-            return m_rareData->m_cachedPolyProtoStructure.get();
-        return nullptr;
-    }
-    void setCachedPolyProtoStructure(VM& vm, Structure* structure)
-    {
-        ensureRareData().m_cachedPolyProtoStructure.set(vm, this, structure);
-    }
+    Structure* cachedPolyProtoStructure() { return m_cachedPolyProtoStructure.get(); }
+    void setCachedPolyProtoStructure(VM& vm, Structure* structure) { m_cachedPolyProtoStructure.set(vm, this, structure); }
 
     InlineWatchpointSet& ensurePolyProtoWatchpoint()
     {
@@ -302,15 +294,11 @@ public:
 
     Box<InlineWatchpointSet> sharedPolyProtoWatchpoint() const { return m_polyProtoWatchpoint; }
 
-    ScriptExecutable* topLevelExecutable() const { return m_topLevelExecutable.get(); }
-
-    TemplateObjectMap& ensureTemplateObjectMap(VM&);
-
 private:
     friend class ExecutableBase;
     FunctionExecutable(VM&, const SourceCode&, UnlinkedFunctionExecutable*, Intrinsic);
     
-    void finishCreation(VM&, ScriptExecutable* topLevelExecutable);
+    void finishCreation(VM&);
 
     friend class ScriptExecutable;
 
@@ -323,8 +311,6 @@ private:
         unsigned m_parametersStartOffset { 0 };
         unsigned m_typeProfilingStartOffset { UINT_MAX };
         unsigned m_typeProfilingEndOffset { UINT_MAX };
-        std::unique_ptr<TemplateObjectMap> m_templateObjectMap;
-        WriteBarrier<Structure> m_cachedPolyProtoStructure;
     };
 
     RareData& ensureRareData()
@@ -335,11 +321,7 @@ private:
     }
     RareData& ensureRareDataSlow();
 
-    // FIXME: We can merge rareData pointer and top-level executable pointer. First time, setting parent.
-    // If RareData is required, materialize RareData, swap it, and store top-level executable pointer inside RareData.
-    // https://bugs.webkit.org/show_bug.cgi?id=197625
     std::unique_ptr<RareData> m_rareData;
-    WriteBarrier<ScriptExecutable> m_topLevelExecutable;
     WriteBarrier<UnlinkedFunctionExecutable> m_unlinkedExecutable;
     WriteBarrier<ExecutableToCodeBlockEdge> m_codeBlockForCall;
     WriteBarrier<ExecutableToCodeBlockEdge> m_codeBlockForConstruct;
@@ -347,6 +329,7 @@ private:
         WriteBarrier<InferredValue> m_singletonFunction;
         WatchpointState m_singletonFunctionState;
     };
+    WriteBarrier<Structure> m_cachedPolyProtoStructure;
     Box<InlineWatchpointSet> m_polyProtoWatchpoint;
 };
 
index 5005759..c55d0d1 100644 (file)
@@ -200,7 +200,7 @@ void JSModuleRecord::instantiateDeclarations(ExecState* exec, ModuleProgramExecu
                     unlinkedFunctionExecutable->typeProfilingStartOffset(),
                     unlinkedFunctionExecutable->typeProfilingEndOffset());
             }
-            JSFunction* function = JSFunction::create(vm, unlinkedFunctionExecutable->link(vm, moduleProgramExecutable, moduleProgramExecutable->source()), moduleEnvironment);
+            JSFunction* function = JSFunction::create(vm, unlinkedFunctionExecutable->link(vm, moduleProgramExecutable->source()), moduleEnvironment);
             bool putResult = false;
             symbolTablePutTouchWatchpointSet(moduleEnvironment, exec, unlinkedFunctionExecutable->name(), function, /* shouldThrowReadOnlyError */ false, /* ignoreReadOnlyErrors */ true, putResult);
             RETURN_IF_EXCEPTION(scope, void());
index ed165cd..2a4a407 100644 (file)
@@ -36,16 +36,15 @@ namespace JSC {
 const ClassInfo JSTemplateObjectDescriptor::s_info = { "TemplateObjectDescriptor", nullptr, nullptr, nullptr, CREATE_METHOD_TABLE(JSTemplateObjectDescriptor) };
 
 
-JSTemplateObjectDescriptor::JSTemplateObjectDescriptor(VM& vm, Ref<TemplateObjectDescriptor>&& descriptor, int startOffset)
+JSTemplateObjectDescriptor::JSTemplateObjectDescriptor(VM& vm, Ref<TemplateObjectDescriptor>&& descriptor)
     : Base(vm, vm.templateObjectDescriptorStructure.get())
     , m_descriptor(WTFMove(descriptor))
-    , m_startOffset(startOffset)
 {
 }
 
-JSTemplateObjectDescriptor* JSTemplateObjectDescriptor::create(VM& vm, Ref<TemplateObjectDescriptor>&& descriptor, int startOffset)
+JSTemplateObjectDescriptor* JSTemplateObjectDescriptor::create(VM& vm, Ref<TemplateObjectDescriptor>&& descriptor)
 {
-    JSTemplateObjectDescriptor* result = new (NotNull, allocateCell<JSTemplateObjectDescriptor>(vm.heap)) JSTemplateObjectDescriptor(vm, WTFMove(descriptor), startOffset);
+    JSTemplateObjectDescriptor* result = new (NotNull, allocateCell<JSTemplateObjectDescriptor>(vm.heap)) JSTemplateObjectDescriptor(vm, WTFMove(descriptor));
     result->finishCreation(vm);
     return result;
 }
index 0005be6..75208bc 100644 (file)
@@ -38,7 +38,7 @@ public:
     static const bool needsDestruction = true;
     DECLARE_INFO;
 
-    static JSTemplateObjectDescriptor* create(VM&, Ref<TemplateObjectDescriptor>&&, int);
+    static JSTemplateObjectDescriptor* create(VM&, Ref<TemplateObjectDescriptor>&&);
 
     static Structure* createStructure(VM& vm, JSGlobalObject* globalObject, JSValue prototype)
     {
@@ -49,16 +49,13 @@ public:
 
     JSArray* createTemplateObject(ExecState*);
 
-    int startOffset() const { return m_startOffset; }
-
 protected:
     static void destroy(JSCell*);
 
 private:
-    JSTemplateObjectDescriptor(VM&, Ref<TemplateObjectDescriptor>&&, int);
+    JSTemplateObjectDescriptor(VM&, Ref<TemplateObjectDescriptor>&&);
 
     Ref<TemplateObjectDescriptor> m_descriptor;
-    int m_startOffset { 0 };
 };
 
 } // namespace JSC
index 4af8c24..4373b64 100644 (file)
@@ -85,11 +85,6 @@ void ModuleProgramExecutable::destroy(JSCell* cell)
     static_cast<ModuleProgramExecutable*>(cell)->ModuleProgramExecutable::~ModuleProgramExecutable();
 }
 
-auto ModuleProgramExecutable::ensureTemplateObjectMap(VM&) -> TemplateObjectMap&
-{
-    return ensureTemplateObjectMapImpl(m_templateObjectMap);
-}
-
 void ModuleProgramExecutable::visitChildren(JSCell* cell, SlotVisitor& visitor)
 {
     ModuleProgramExecutable* thisObject = jsCast<ModuleProgramExecutable*>(cell);
@@ -98,11 +93,6 @@ void ModuleProgramExecutable::visitChildren(JSCell* cell, SlotVisitor& visitor)
     visitor.append(thisObject->m_unlinkedModuleProgramCodeBlock);
     visitor.append(thisObject->m_moduleEnvironmentSymbolTable);
     visitor.append(thisObject->m_moduleProgramCodeBlock);
-    if (TemplateObjectMap* map = thisObject->m_templateObjectMap.get()) {
-        auto locker = holdLock(thisObject->cellLock());
-        for (auto& entry : *map)
-            visitor.append(entry.value);
-    }
 }
 
 } // namespace JSC
index f9b7e2a..6d355b7 100644 (file)
@@ -69,8 +69,6 @@ public:
 
     SymbolTable* moduleEnvironmentSymbolTable() { return m_moduleEnvironmentSymbolTable.get(); }
 
-    TemplateObjectMap& ensureTemplateObjectMap(VM&);
-
 private:
     friend class ExecutableBase;
     friend class ScriptExecutable;
@@ -82,7 +80,6 @@ private:
     WriteBarrier<UnlinkedModuleProgramCodeBlock> m_unlinkedModuleProgramCodeBlock;
     WriteBarrier<SymbolTable> m_moduleEnvironmentSymbolTable;
     WriteBarrier<ExecutableToCodeBlockEdge> m_moduleProgramCodeBlock;
-    std::unique_ptr<TemplateObjectMap> m_templateObjectMap;
 };
 
 } // namespace JSC
index 234db8e..9105416 100644 (file)
@@ -216,11 +216,6 @@ JSObject* ProgramExecutable::initializeGlobalProperties(VM& vm, CallFrame* callF
     return nullptr;
 }
 
-auto ProgramExecutable::ensureTemplateObjectMap(VM&) -> TemplateObjectMap&
-{
-    return ensureTemplateObjectMapImpl(m_templateObjectMap);
-}
-
 void ProgramExecutable::visitChildren(JSCell* cell, SlotVisitor& visitor)
 {
     ProgramExecutable* thisObject = jsCast<ProgramExecutable*>(cell);
@@ -228,11 +223,6 @@ void ProgramExecutable::visitChildren(JSCell* cell, SlotVisitor& visitor)
     Base::visitChildren(thisObject, visitor);
     visitor.append(thisObject->m_unlinkedProgramCodeBlock);
     visitor.append(thisObject->m_programCodeBlock);
-    if (TemplateObjectMap* map = thisObject->m_templateObjectMap.get()) {
-        auto locker = holdLock(thisObject->cellLock());
-        for (auto& entry : *map)
-            visitor.append(entry.value);
-    }
 }
 
 } // namespace JSC
index b968444..6051167 100644 (file)
@@ -73,8 +73,6 @@ public:
 
     ExecutableInfo executableInfo() const { return ExecutableInfo(usesEval(), isStrictMode(), false, false, ConstructorKind::None, JSParserScriptMode::Classic, SuperBinding::NotNeeded, SourceParseMode::ProgramMode, derivedContextType(), isArrowFunctionContext(), false, EvalContextType::None); }
 
-    TemplateObjectMap& ensureTemplateObjectMap(VM&);
-
 private:
     friend class ExecutableBase;
     friend class ScriptExecutable;
@@ -85,7 +83,6 @@ private:
 
     WriteBarrier<UnlinkedProgramCodeBlock> m_unlinkedProgramCodeBlock;
     WriteBarrier<ExecutableToCodeBlockEdge> m_programCodeBlock;
-    std::unique_ptr<TemplateObjectMap> m_templateObjectMap;
 };
 
 } // namespace JSC
index 752c0aa..56a5d48 100644 (file)
@@ -34,7 +34,6 @@
 #include "IsoCellSetInlines.h"
 #include "JIT.h"
 #include "JSCInlines.h"
-#include "JSTemplateObjectDescriptor.h"
 #include "LLIntEntrypoint.h"
 #include "ModuleProgramCodeBlock.h"
 #include "Parser.h"
@@ -436,61 +435,6 @@ Exception* ScriptExecutable::prepareForExecutionImpl(
     return nullptr;
 }
 
-ScriptExecutable* ScriptExecutable::topLevelExecutable()
-{
-    switch (type()) {
-    case FunctionExecutableType:
-        return jsCast<FunctionExecutable*>(this)->topLevelExecutable();
-    default:
-        return this;
-    }
-}
-
-JSArray* ScriptExecutable::createTemplateObject(ExecState* exec, JSTemplateObjectDescriptor* descriptor)
-{
-    VM& vm = exec->vm();
-    auto scope = DECLARE_THROW_SCOPE(vm);
-
-    TemplateObjectMap& templateObjectMap = ensureTemplateObjectMap(vm);
-    TemplateObjectMap::AddResult result;
-    {
-        auto locker = holdLock(cellLock());
-        result = templateObjectMap.add(descriptor->startOffset(), WriteBarrier<JSArray>());
-    }
-    if (JSArray* array = result.iterator->value.get())
-        return array;
-    JSArray* templateObject = descriptor->createTemplateObject(exec);
-    RETURN_IF_EXCEPTION(scope, nullptr);
-    result.iterator->value.set(vm, this, templateObject);
-    return templateObject;
-}
-
-auto ScriptExecutable::ensureTemplateObjectMapImpl(std::unique_ptr<TemplateObjectMap>& dest) -> TemplateObjectMap&
-{
-    if (dest)
-        return *dest;
-    auto result = std::make_unique<TemplateObjectMap>();
-    WTF::storeStoreFence();
-    dest = WTFMove(result);
-    return *dest;
-}
-
-auto ScriptExecutable::ensureTemplateObjectMap(VM& vm) -> TemplateObjectMap&
-{
-    switch (type()) {
-    case FunctionExecutableType:
-        return static_cast<FunctionExecutable*>(this)->ensureTemplateObjectMap(vm);
-    case EvalExecutableType:
-        return static_cast<EvalExecutable*>(this)->ensureTemplateObjectMap(vm);
-    case ProgramExecutableType:
-        return static_cast<ProgramExecutable*>(this)->ensureTemplateObjectMap(vm);
-    case ModuleProgramExecutableType:
-    default:
-        ASSERT(type() == ModuleProgramExecutableType);
-        return static_cast<ModuleProgramExecutable*>(this)->ensureTemplateObjectMap(vm);
-    }
-}
-
 CodeBlockHash ScriptExecutable::hashFor(CodeSpecializationKind kind) const
 {
     return CodeBlockHash(source(), kind);
index cc5eb9d..6c3eecc 100644 (file)
@@ -29,8 +29,6 @@
 
 namespace JSC {
 
-class JSArray;
-class JSTemplateObjectDescriptor;
 class IsoCellSet;
 
 class ScriptExecutable : public ExecutableBase {
@@ -39,8 +37,6 @@ public:
     static const unsigned StructureFlags = Base::StructureFlags;
 
     static void destroy(JSCell*);
-
-    using TemplateObjectMap = HashMap<uint64_t, WriteBarrier<JSArray>, WTF::IntHash<uint64_t>, WTF::UnsignedWithZeroKeyHashTraits<uint64_t>>;
         
     CodeBlockHash hashFor(CodeSpecializationKind) const;
 
@@ -116,17 +112,12 @@ public:
     template <typename ExecutableType>
     Exception* prepareForExecution(VM&, JSFunction*, JSScope*, CodeSpecializationKind, CodeBlock*& resultCodeBlock);
 
-    ScriptExecutable* topLevelExecutable();
-    JSArray* createTemplateObject(ExecState*, JSTemplateObjectDescriptor*);
-
 private:
     friend class ExecutableBase;
     Exception* prepareForExecutionImpl(VM&, JSFunction*, JSScope*, CodeSpecializationKind, CodeBlock*&);
 
     bool hasClearableCode(VM&) const;
 
-    TemplateObjectMap& ensureTemplateObjectMap(VM&);
-
 protected:
     ScriptExecutable(Structure*, VM&, const SourceCode&, bool isInStrictContext, DerivedContextType, bool isInArrowFunctionContext, EvalContextType, Intrinsic);
 
@@ -146,8 +137,6 @@ protected:
         m_hasCapturedVariables = hasCapturedVariables;
     }
 
-    static TemplateObjectMap& ensureTemplateObjectMapImpl(std::unique_ptr<TemplateObjectMap>& dest);
-
     SourceCode m_source;
     Intrinsic m_intrinsic { NoIntrinsic };
     bool m_didTryToEnterInLoop { false };
index 1458d04..d624a70 100644 (file)
@@ -1846,7 +1846,7 @@ static EncodedJSValue JSC_HOST_CALL functionCreateBuiltin(ExecState* exec)
     RETURN_IF_EXCEPTION(scope, encodedJSValue());
 
     const SourceCode& source = makeSource(functionText, { });
-    JSFunction* func = JSFunction::create(vm, createBuiltinExecutable(vm, source, Identifier::fromString(&vm, "foo"), ConstructorKind::None, ConstructAbility::CannotConstruct)->link(vm, nullptr, source), exec->lexicalGlobalObject());
+    JSFunction* func = JSFunction::create(vm, createBuiltinExecutable(vm, source, Identifier::fromString(&vm, "foo"), ConstructorKind::None, ConstructAbility::CannotConstruct)->link(vm, source), exec->lexicalGlobalObject());
 
     return JSValue::encode(func);
 }
@@ -2087,15 +2087,6 @@ static EncodedJSValue JSC_HOST_CALL functionDisableDebuggerModeWhenIdle(ExecStat
     return changeDebuggerModeWhenIdle(exec, { });
 }
 
-static EncodedJSValue JSC_HOST_CALL functionDeleteAllCodeWhenIdle(ExecState* exec)
-{
-    VM* vm = &exec->vm();
-    vm->whenIdle([=] () {
-        vm->deleteAllCode(PreventCollectionAndDeleteAllCode);
-    });
-    return JSValue::encode(jsUndefined());
-}
-
 static EncodedJSValue JSC_HOST_CALL functionGlobalObjectCount(ExecState* exec)
 {
     return JSValue::encode(jsNumber(exec->vm().heap.globalObjectCount()));
@@ -2285,8 +2276,6 @@ void JSDollarVM::finishCreation(VM& vm)
     addFunction(vm, "enableDebuggerModeWhenIdle", functionEnableDebuggerModeWhenIdle, 0);
     addFunction(vm, "disableDebuggerModeWhenIdle", functionDisableDebuggerModeWhenIdle, 0);
 
-    addFunction(vm, "deleteAllCodeWhenIdle", functionDeleteAllCodeWhenIdle, 0);
-
     addFunction(vm, "globalObjectCount", functionGlobalObjectCount, 0);
     addFunction(vm, "globalObjectForObject", functionGlobalObjectForObject, 1);