Diff
Modified: trunk/Source/_javascript_Core/ChangeLog (226010 => 226011)
--- trunk/Source/_javascript_Core/ChangeLog 2017-12-17 10:53:51 UTC (rev 226010)
+++ trunk/Source/_javascript_Core/ChangeLog 2017-12-17 19:35:38 UTC (rev 226011)
@@ -1,3 +1,44 @@
+2017-12-17 Yusuke Suzuki <[email protected]>
+
+ [JSC][WebCore][CSSJIT] Remove VM reference in CSSJIT
+ https://bugs.webkit.org/show_bug.cgi?id=180917
+
+ Reviewed by Sam Weinig.
+
+ We do not need to hold JIT flags in VM. We add
+ static VM::{canUseJIT,canUseAssembler,canUseRegExpJIT} functions.
+
+ * interpreter/AbstractPC.cpp:
+ (JSC::AbstractPC::AbstractPC):
+ * jit/JITThunks.cpp:
+ (JSC::JITThunks::ctiNativeCall):
+ (JSC::JITThunks::ctiNativeConstruct):
+ (JSC::JITThunks::ctiNativeTailCall):
+ (JSC::JITThunks::ctiNativeTailCallWithoutSavedTags):
+ (JSC::JITThunks::ctiInternalFunctionCall):
+ (JSC::JITThunks::ctiInternalFunctionConstruct):
+ (JSC::JITThunks::hostFunctionStub):
+ * llint/LLIntEntrypoint.cpp:
+ (JSC::LLInt::setFunctionEntrypoint):
+ (JSC::LLInt::setEvalEntrypoint):
+ (JSC::LLInt::setProgramEntrypoint):
+ (JSC::LLInt::setModuleProgramEntrypoint):
+ * llint/LLIntSlowPaths.cpp:
+ (JSC::LLInt::shouldJIT):
+ (JSC::LLInt::entryOSR):
+ (JSC::LLInt::LLINT_SLOW_PATH_DECL):
+ * runtime/RegExp.cpp:
+ (JSC::RegExp::compile):
+ (JSC::RegExp::compileMatchOnly):
+ * runtime/VM.cpp:
+ (JSC::VM::canUseAssembler):
+ (JSC::VM::canUseJIT):
+ (JSC::VM::canUseRegExpJIT):
+ (JSC::VM::VM):
+ * runtime/VM.h:
+ (JSC::VM::canUseJIT): Deleted.
+ (JSC::VM::canUseRegExpJIT): Deleted.
+
2017-12-16 Yusuke Suzuki <[email protected]>
[JSC] Number of SlotVisitors can increase after setting up m_visitCounters
Modified: trunk/Source/_javascript_Core/interpreter/AbstractPC.cpp (226010 => 226011)
--- trunk/Source/_javascript_Core/interpreter/AbstractPC.cpp 2017-12-17 10:53:51 UTC (rev 226010)
+++ trunk/Source/_javascript_Core/interpreter/AbstractPC.cpp 2017-12-17 19:35:38 UTC (rev 226011)
@@ -39,7 +39,7 @@
UNUSED_PARAM(exec);
#if ENABLE(JIT)
- if (vm.canUseJIT()) {
+ if (VM::canUseJIT()) {
m_pointer = exec->returnPC().value();
m_mode = JIT;
return;
Modified: trunk/Source/_javascript_Core/jit/JITThunks.cpp (226010 => 226011)
--- trunk/Source/_javascript_Core/jit/JITThunks.cpp 2017-12-17 10:53:51 UTC (rev 226010)
+++ trunk/Source/_javascript_Core/jit/JITThunks.cpp 2017-12-17 19:35:38 UTC (rev 226011)
@@ -47,7 +47,7 @@
MacroAssemblerCodePtr JITThunks::ctiNativeCall(VM* vm)
{
- if (!vm->canUseJIT())
+ if (!VM::canUseJIT())
return MacroAssemblerCodePtr::createLLIntCodePtr(llint_native_call_trampoline);
return ctiStub(vm, nativeCallGenerator).code();
}
@@ -54,7 +54,7 @@
MacroAssemblerCodePtr JITThunks::ctiNativeConstruct(VM* vm)
{
- if (!vm->canUseJIT())
+ if (!VM::canUseJIT())
return MacroAssemblerCodePtr::createLLIntCodePtr(llint_native_construct_trampoline);
return ctiStub(vm, nativeConstructGenerator).code();
}
@@ -61,19 +61,19 @@
MacroAssemblerCodePtr JITThunks::ctiNativeTailCall(VM* vm)
{
- ASSERT(vm->canUseJIT());
+ ASSERT(VM::canUseJIT());
return ctiStub(vm, nativeTailCallGenerator).code();
}
MacroAssemblerCodePtr JITThunks::ctiNativeTailCallWithoutSavedTags(VM* vm)
{
- ASSERT(vm->canUseJIT());
+ ASSERT(VM::canUseJIT());
return ctiStub(vm, nativeTailCallWithoutSavedTagsGenerator).code();
}
MacroAssemblerCodePtr JITThunks::ctiInternalFunctionCall(VM* vm)
{
- if (!vm->canUseJIT())
+ if (!VM::canUseJIT())
return MacroAssemblerCodePtr::createLLIntCodePtr(llint_internal_function_call_trampoline);
return ctiStub(vm, internalFunctionCallGenerator).code();
}
@@ -80,7 +80,7 @@
MacroAssemblerCodePtr JITThunks::ctiInternalFunctionConstruct(VM* vm)
{
- if (!vm->canUseJIT())
+ if (!VM::canUseJIT())
return MacroAssemblerCodePtr::createLLIntCodePtr(llint_internal_function_construct_trampoline);
return ctiStub(vm, internalFunctionConstructGenerator).code();
}
@@ -120,7 +120,7 @@
NativeExecutable* JITThunks::hostFunctionStub(VM* vm, NativeFunction function, NativeFunction constructor, ThunkGenerator generator, Intrinsic intrinsic, const DOMJIT::Signature* signature, const String& name)
{
ASSERT(!isCompilationThread());
- ASSERT(vm->canUseJIT());
+ ASSERT(VM::canUseJIT());
if (NativeExecutable* nativeExecutable = m_hostFunctionStubMap->get(std::make_tuple(function, constructor, name)))
return nativeExecutable;
Modified: trunk/Source/_javascript_Core/llint/LLIntEntrypoint.cpp (226010 => 226011)
--- trunk/Source/_javascript_Core/llint/LLIntEntrypoint.cpp 2017-12-17 10:53:51 UTC (rev 226010)
+++ trunk/Source/_javascript_Core/llint/LLIntEntrypoint.cpp 2017-12-17 19:35:38 UTC (rev 226011)
@@ -43,7 +43,7 @@
CodeSpecializationKind kind = codeBlock->specializationKind();
#if ENABLE(JIT)
- if (vm.canUseJIT()) {
+ if (VM::canUseJIT()) {
if (kind == CodeForCall) {
codeBlock->setJITCode(
adoptRef(*new DirectJITCode(vm.getCTIStub(functionForCallEntryThunkGenerator), vm.getCTIStub(functionForCallArityCheckThunkGenerator).code(), JITCode::InterpreterThunk)));
@@ -70,7 +70,7 @@
static void setEvalEntrypoint(VM& vm, CodeBlock* codeBlock)
{
#if ENABLE(JIT)
- if (vm.canUseJIT()) {
+ if (VM::canUseJIT()) {
codeBlock->setJITCode(
adoptRef(*new DirectJITCode(vm.getCTIStub(evalEntryThunkGenerator), MacroAssemblerCodePtr(), JITCode::InterpreterThunk)));
return;
@@ -85,7 +85,7 @@
static void setProgramEntrypoint(VM& vm, CodeBlock* codeBlock)
{
#if ENABLE(JIT)
- if (vm.canUseJIT()) {
+ if (VM::canUseJIT()) {
codeBlock->setJITCode(
adoptRef(*new DirectJITCode(vm.getCTIStub(programEntryThunkGenerator), MacroAssemblerCodePtr(), JITCode::InterpreterThunk)));
return;
@@ -100,7 +100,7 @@
static void setModuleProgramEntrypoint(VM& vm, CodeBlock* codeBlock)
{
#if ENABLE(JIT)
- if (vm.canUseJIT()) {
+ if (VM::canUseJIT()) {
codeBlock->setJITCode(
adoptRef(*new DirectJITCode(vm.getCTIStub(moduleProgramEntryThunkGenerator), MacroAssemblerCodePtr(), JITCode::InterpreterThunk)));
return;
Modified: trunk/Source/_javascript_Core/llint/LLIntSlowPaths.cpp (226010 => 226011)
--- trunk/Source/_javascript_Core/llint/LLIntSlowPaths.cpp 2017-12-17 10:53:51 UTC (rev 226010)
+++ trunk/Source/_javascript_Core/llint/LLIntSlowPaths.cpp 2017-12-17 19:35:38 UTC (rev 226011)
@@ -318,13 +318,13 @@
return baselineWhitelist;
}
-inline bool shouldJIT(ExecState* exec, CodeBlock* codeBlock)
+inline bool shouldJIT(CodeBlock* codeBlock)
{
if (!Options::bytecodeRangeToJITCompile().isInRange(codeBlock->instructionCount())
|| !ensureGlobalJITWhitelist().contains(codeBlock))
return false;
- return exec->vm().canUseJIT() && Options::useBaselineJIT();
+ return VM::canUseJIT() && Options::useBaselineJIT();
}
// Returns true if we should try to OSR.
@@ -370,7 +370,7 @@
codeBlock->llintExecuteCounter(), "\n");
}
- if (!shouldJIT(exec, codeBlock)) {
+ if (!shouldJIT(codeBlock)) {
codeBlock->dontJITAnytimeSoon();
LLINT_RETURN_TWO(0, 0);
}
@@ -430,7 +430,7 @@
unsigned loopOSREntryBytecodeOffset = pc - codeBlock->instructions().begin();
- if (!shouldJIT(exec, codeBlock)) {
+ if (!shouldJIT(codeBlock)) {
codeBlock->dontJITAnytimeSoon();
LLINT_RETURN_TWO(0, 0);
}
@@ -470,7 +470,7 @@
codeBlock->llintExecuteCounter(), "\n");
}
- if (shouldJIT(exec, codeBlock))
+ if (shouldJIT(codeBlock))
jitCompileAndSetHeuristics(codeBlock, exec);
else
codeBlock->dontJITAnytimeSoon();
Modified: trunk/Source/_javascript_Core/runtime/RegExp.cpp (226010 => 226011)
--- trunk/Source/_javascript_Core/runtime/RegExp.cpp 2017-12-17 10:53:51 UTC (rev 226010)
+++ trunk/Source/_javascript_Core/runtime/RegExp.cpp 2017-12-17 19:35:38 UTC (rev 226011)
@@ -316,7 +316,7 @@
}
#if ENABLE(YARR_JIT)
- if (!pattern.m_containsBackreferences && !pattern.containsUnsignedLengthPattern() && vm->canUseRegExpJIT()) {
+ if (!pattern.m_containsBackreferences && !pattern.containsUnsignedLengthPattern() && VM::canUseRegExpJIT()) {
Yarr::jitCompile(pattern, charSize, vm, m_regExpJITCode);
if (!m_regExpJITCode.isFallBack()) {
m_state = JITCode;
@@ -372,7 +372,7 @@
}
#if ENABLE(YARR_JIT)
- if (!pattern.m_containsBackreferences && !pattern.containsUnsignedLengthPattern() && vm->canUseRegExpJIT()) {
+ if (!pattern.m_containsBackreferences && !pattern.containsUnsignedLengthPattern() && VM::canUseRegExpJIT()) {
Yarr::jitCompile(pattern, charSize, vm, m_regExpJITCode, Yarr::MatchOnly);
if (!m_regExpJITCode.isFallBack()) {
m_state = JITCode;
Modified: trunk/Source/_javascript_Core/runtime/VM.cpp (226010 => 226011)
--- trunk/Source/_javascript_Core/runtime/VM.cpp 2017-12-17 10:53:51 UTC (rev 226010)
+++ trunk/Source/_javascript_Core/runtime/VM.cpp 2017-12-17 19:35:38 UTC (rev 226011)
@@ -175,6 +175,48 @@
}
#endif // ENABLE(!ASSEMBLER)
+bool VM::canUseAssembler()
+{
+#if ENABLE(ASSEMBLER)
+ static std::once_flag onceKey;
+ static bool enabled = false;
+ std::call_once(onceKey, [] {
+ enabled = enableAssembler(ExecutableAllocator::singleton());
+ });
+ return enabled;
+#else
+ return false; // interpreter only
+#endif
+}
+
+bool VM::canUseJIT()
+{
+#if ENABLE(JIT)
+ static std::once_flag onceKey;
+ static bool enabled = false;
+ std::call_once(onceKey, [] {
+ enabled = VM::canUseAssembler() && Options::useJIT();
+ });
+ return enabled;
+#else
+ return false; // interpreter only
+#endif
+}
+
+bool VM::canUseRegExpJIT()
+{
+#if ENABLE(YARR_JIT)
+ static std::once_flag onceKey;
+ static bool enabled = false;
+ std::call_once(onceKey, [] {
+ enabled = VM::canUseAssembler() && Options::useRegExpJIT();
+ });
+ return enabled;
+#else
+ return false; // interpreter only
+#endif
+}
+
VM::VM(VMType vmType, HeapType heapType)
: m_apiLock(adoptRef(new JSLock(this)))
#if USE(CF)
@@ -237,15 +279,6 @@
#if ENABLE(REGEXP_TRACING)
, m_rtTraceList(new RTTraceList())
#endif
-#if ENABLE(ASSEMBLER)
- , m_canUseAssembler(enableAssembler(ExecutableAllocator::singleton()))
-#endif
-#if ENABLE(JIT)
- , m_canUseJIT(m_canUseAssembler && Options::useJIT())
-#endif
-#if ENABLE(YARR_JIT)
- , m_canUseRegExpJIT(m_canUseAssembler && Options::useRegExpJIT())
-#endif
#if ENABLE(GC_VALIDATION)
, m_initializingObjectClass(0)
#endif
Modified: trunk/Source/_javascript_Core/runtime/VM.h (226010 => 226011)
--- trunk/Source/_javascript_Core/runtime/VM.h 2017-12-17 10:53:51 UTC (rev 226010)
+++ trunk/Source/_javascript_Core/runtime/VM.h 2017-12-17 19:35:38 UTC (rev 226011)
@@ -478,18 +478,10 @@
DeletePropertyMode m_previousMode;
};
-#if ENABLE(JIT)
- bool canUseJIT() { return m_canUseJIT; }
-#else
- bool canUseJIT() { return false; } // interpreter only
-#endif
+ static JS_EXPORT_PRIVATE bool canUseAssembler();
+ static JS_EXPORT_PRIVATE bool canUseJIT();
+ static JS_EXPORT_PRIVATE bool canUseRegExpJIT();
-#if ENABLE(YARR_JIT)
- bool canUseRegExpJIT() { return m_canUseRegExpJIT; }
-#else
- bool canUseRegExpJIT() { return false; } // interpreter only
-#endif
-
SourceProviderCache* addSourceProviderCache(SourceProvider*);
void clearSourceProviderCaches();
@@ -785,15 +777,6 @@
static void primitiveGigacageDisabledCallback(void*);
void primitiveGigacageDisabled();
-#if ENABLE(ASSEMBLER)
- bool m_canUseAssembler;
-#endif
-#if ENABLE(JIT)
- bool m_canUseJIT;
-#endif
-#if ENABLE(YARR_JIT)
- bool m_canUseRegExpJIT;
-#endif
#if ENABLE(GC_VALIDATION)
const ClassInfo* m_initializingObjectClass;
#endif
Modified: trunk/Source/WebCore/ChangeLog (226010 => 226011)
--- trunk/Source/WebCore/ChangeLog 2017-12-17 10:53:51 UTC (rev 226010)
+++ trunk/Source/WebCore/ChangeLog 2017-12-17 19:35:38 UTC (rev 226011)
@@ -1,3 +1,25 @@
+2017-12-17 Yusuke Suzuki <[email protected]>
+
+ [JSC][WebCore][CSSJIT] Remove VM reference in CSSJIT
+ https://bugs.webkit.org/show_bug.cgi?id=180917
+
+ Reviewed by Sam Weinig.
+
+ Remove VM reference in CSSJIT. CSSJIT should not be
+ bound to a specific VM.
+
+ No behavior change.
+
+ * css/ElementRuleCollector.cpp:
+ (WebCore::ElementRuleCollector::ruleMatches):
+ * cssjit/SelectorCompiler.cpp:
+ (WebCore::SelectorCompiler::compileSelector):
+ * cssjit/SelectorCompiler.h:
+ * dom/SelectorQuery.cpp:
+ (WebCore::SelectorDataList::compileSelector):
+ (WebCore::SelectorDataList::execute const):
+ * dom/SelectorQuery.h:
+
2017-12-16 Dan Bernstein <[email protected]>
WKWebView has no equivalent of -[WebView setAlwaysShowVerticalScroller:]
Modified: trunk/Source/WebCore/css/ElementRuleCollector.cpp (226010 => 226011)
--- trunk/Source/WebCore/css/ElementRuleCollector.cpp 2017-12-17 10:53:51 UTC (rev 226010)
+++ trunk/Source/WebCore/css/ElementRuleCollector.cpp 2017-12-17 19:35:38 UTC (rev 226011)
@@ -385,10 +385,9 @@
#if ENABLE(CSS_SELECTOR_JIT)
void* compiledSelectorChecker = ruleData.compiledSelectorCodeRef().code().executableAddress();
if (!compiledSelectorChecker && ruleData.compilationStatus() == SelectorCompilationStatus::NotCompiled) {
- JSC::VM& vm = m_element.document().scriptExecutionContext()->vm();
SelectorCompilationStatus compilationStatus;
JSC::MacroAssemblerCodeRef compiledSelectorCodeRef;
- compilationStatus = SelectorCompiler::compileSelector(ruleData.selector(), &vm, SelectorCompiler::SelectorContext::RuleCollector, compiledSelectorCodeRef);
+ compilationStatus = SelectorCompiler::compileSelector(ruleData.selector(), SelectorCompiler::SelectorContext::RuleCollector, compiledSelectorCodeRef);
ruleData.setCompiledSelector(compilationStatus, compiledSelectorCodeRef);
compiledSelectorChecker = ruleData.compiledSelectorCodeRef().code().executableAddress();
Modified: trunk/Source/WebCore/cssjit/SelectorCompiler.cpp (226010 => 226011)
--- trunk/Source/WebCore/cssjit/SelectorCompiler.cpp 2017-12-17 10:53:51 UTC (rev 226010)
+++ trunk/Source/WebCore/cssjit/SelectorCompiler.cpp 2017-12-17 19:35:38 UTC (rev 226011)
@@ -390,9 +390,9 @@
static void computeBacktrackingInformation(SelectorFragmentList& selectorFragments, unsigned level = 0);
-SelectorCompilationStatus compileSelector(const CSSSelector* lastSelector, JSC::VM* vm, SelectorContext selectorContext, JSC::MacroAssemblerCodeRef& codeRef)
+SelectorCompilationStatus compileSelector(const CSSSelector* lastSelector, SelectorContext selectorContext, JSC::MacroAssemblerCodeRef& codeRef)
{
- if (!vm->canUseJIT())
+ if (!JSC::VM::canUseJIT())
return SelectorCompilationStatus::CannotCompile;
SelectorCodeGenerator codeGenerator(lastSelector, selectorContext);
return codeGenerator.compile(codeRef);
Modified: trunk/Source/WebCore/cssjit/SelectorCompiler.h (226010 => 226011)
--- trunk/Source/WebCore/cssjit/SelectorCompiler.h 2017-12-17 10:53:51 UTC (rev 226010)
+++ trunk/Source/WebCore/cssjit/SelectorCompiler.h 2017-12-17 19:35:38 UTC (rev 226011)
@@ -34,7 +34,6 @@
namespace JSC {
class MacroAssemblerCodeRef;
-class VM;
}
namespace WebCore {
@@ -82,7 +81,7 @@
typedef unsigned (*RuleCollectorSelectorCheckerWithCheckingContext)(const Element*, SelectorChecker::CheckingContext*, unsigned*);
typedef unsigned (*QuerySelectorSelectorCheckerWithCheckingContext)(const Element*, const SelectorChecker::CheckingContext*);
-SelectorCompilationStatus compileSelector(const CSSSelector*, JSC::VM*, SelectorContext, JSC::MacroAssemblerCodeRef& outputCodeRef);
+SelectorCompilationStatus compileSelector(const CSSSelector*, SelectorContext, JSC::MacroAssemblerCodeRef& outputCodeRef);
inline RuleCollectorSimpleSelectorChecker ruleCollectorSimpleSelectorCheckerFunction(void* executableAddress, SelectorCompilationStatus compilationStatus)
{
Modified: trunk/Source/WebCore/dom/SelectorQuery.cpp (226010 => 226011)
--- trunk/Source/WebCore/dom/SelectorQuery.cpp 2017-12-17 10:53:51 UTC (rev 226010)
+++ trunk/Source/WebCore/dom/SelectorQuery.cpp 2017-12-17 19:35:38 UTC (rev 226011)
@@ -473,13 +473,12 @@
return compilationStatus == SelectorCompilationStatus::SimpleSelectorChecker || compilationStatus == SelectorCompilationStatus::SelectorCheckerWithCheckingContext;
}
-bool SelectorDataList::compileSelector(const SelectorData& selectorData, const ContainerNode& rootNode)
+bool SelectorDataList::compileSelector(const SelectorData& selectorData)
{
if (selectorData.compilationStatus != SelectorCompilationStatus::NotCompiled)
return isCompiledSelector(selectorData.compilationStatus);
- JSC::VM& vm = rootNode.document().scriptExecutionContext()->vm();
- selectorData.compilationStatus = SelectorCompiler::compileSelector(selectorData.selector, &vm, SelectorCompiler::SelectorContext::QuerySelector, selectorData.compiledSelectorCodeRef);
+ selectorData.compilationStatus = SelectorCompiler::compileSelector(selectorData.selector, SelectorCompiler::SelectorContext::QuerySelector, selectorData.compiledSelectorCodeRef);
return isCompiledSelector(selectorData.compilationStatus);
}
@@ -499,7 +498,7 @@
break;
}
#if ENABLE(CSS_SELECTOR_JIT)
- if (compileSelector(selectorData, *searchRootNode))
+ if (compileSelector(selectorData))
goto CompiledSingleCase;
#endif // ENABLE(CSS_SELECTOR_JIT)
goto SingleSelectorCase;
@@ -513,7 +512,7 @@
const SelectorData& selectorData = m_selectors.first();
ASSERT(selectorData.compilationStatus == SelectorCompilationStatus::NotCompiled);
ASSERT(m_matchType == CompilableSingle || m_matchType == CompilableSingleWithRootFilter);
- if (compileSelector(selectorData, *searchRootNode)) {
+ if (compileSelector(selectorData)) {
if (m_matchType == CompilableSingle) {
m_matchType = CompiledSingle;
goto CompiledSingleCase;
@@ -581,7 +580,7 @@
#if ENABLE(CSS_SELECTOR_JIT)
{
for (auto& selector : m_selectors) {
- if (!compileSelector(selector, *searchRootNode)) {
+ if (!compileSelector(selector)) {
m_matchType = MultipleSelectorMatch;
goto MultipleSelectorMatch;
}
Modified: trunk/Source/WebCore/dom/SelectorQuery.h (226010 => 226011)
--- trunk/Source/WebCore/dom/SelectorQuery.h 2017-12-17 10:53:51 UTC (rev 226010)
+++ trunk/Source/WebCore/dom/SelectorQuery.h 2017-12-17 19:35:38 UTC (rev 226011)
@@ -87,7 +87,7 @@
template <typename SelectorQueryTrait> void executeCompiledSimpleSelectorChecker(const ContainerNode& searchRootNode, SelectorCompiler::QuerySelectorSimpleSelectorChecker, typename SelectorQueryTrait::OutputType&, const SelectorData&) const;
template <typename SelectorQueryTrait> void executeCompiledSelectorCheckerWithCheckingContext(const ContainerNode& rootNode, const ContainerNode& searchRootNode, SelectorCompiler::QuerySelectorSelectorCheckerWithCheckingContext, typename SelectorQueryTrait::OutputType&, const SelectorData&) const;
template <typename SelectorQueryTrait> void executeCompiledSingleMultiSelectorData(const ContainerNode& rootNode, typename SelectorQueryTrait::OutputType&) const;
- static bool compileSelector(const SelectorData&, const ContainerNode& rootNode);
+ static bool compileSelector(const SelectorData&);
#endif // ENABLE(CSS_SELECTOR_JIT)
Vector<SelectorData> m_selectors;