Modified: trunk/Source/_javascript_Core/ChangeLog (232142 => 232143)
--- trunk/Source/_javascript_Core/ChangeLog 2018-05-24 01:18:20 UTC (rev 232142)
+++ trunk/Source/_javascript_Core/ChangeLog 2018-05-24 03:01:43 UTC (rev 232143)
@@ -1,5 +1,20 @@
2018-05-23 Keith Miller <[email protected]>
+ Expose $vm if window.internals is exposed
+ https://bugs.webkit.org/show_bug.cgi?id=185900
+
+ Reviewed by Mark Lam.
+
+ This is useful for testing vm internals when running LayoutTests.
+
+ * runtime/JSGlobalObject.cpp:
+ (JSC::JSGlobalObject::init):
+ (JSC::JSGlobalObject::visitChildren):
+ (JSC::JSGlobalObject::exposeDollarVM):
+ * runtime/JSGlobalObject.h:
+
+2018-05-23 Keith Miller <[email protected]>
+
Define length on CoW array should properly convert to writable
https://bugs.webkit.org/show_bug.cgi?id=185927
Modified: trunk/Source/_javascript_Core/runtime/JSGlobalObject.cpp (232142 => 232143)
--- trunk/Source/_javascript_Core/runtime/JSGlobalObject.cpp 2018-05-24 01:18:20 UTC (rev 232142)
+++ trunk/Source/_javascript_Core/runtime/JSGlobalObject.cpp 2018-05-24 03:01:43 UTC (rev 232143)
@@ -964,18 +964,9 @@
m_linkTimeConstants[static_cast<unsigned>(LinkTimeConstant::ThrowTypeErrorFunction)] = m_throwTypeErrorFunction.get();
- if (UNLIKELY(Options::useDollarVM())) {
- m_dollarVMStructure.set(vm, this, JSDollarVM::createStructure(vm, this, m_objectPrototype.get()));
- JSDollarVM* dollarVM = JSDollarVM::create(vm, m_dollarVMStructure.get());
+ if (UNLIKELY(Options::useDollarVM()))
+ exposeDollarVM();
- GlobalPropertyInfo extraStaticGlobals[] = {
- GlobalPropertyInfo(vm.propertyNames->builtinNames().dollarVMPrivateName(), dollarVM, PropertyAttribute::DontEnum | PropertyAttribute::DontDelete | PropertyAttribute::ReadOnly),
- };
- addStaticGlobals(extraStaticGlobals, WTF_ARRAY_LENGTH(extraStaticGlobals));
-
- putDirectWithoutTransition(vm, Identifier::fromString(exec, "$vm"), dollarVM, static_cast<unsigned>(PropertyAttribute::DontEnum));
- }
-
#if ENABLE(WEBASSEMBLY)
if (Options::useWebAssembly()) {
auto* webAssemblyPrototype = WebAssemblyPrototype::create(vm, this, WebAssemblyPrototype::createStructure(vm, this, m_objectPrototype.get()));
@@ -1429,7 +1420,6 @@
visitor.append(thisObject->m_regExpMatchesArrayWithGroupsStructure);
visitor.append(thisObject->m_moduleRecordStructure);
visitor.append(thisObject->m_moduleNamespaceObjectStructure);
- visitor.append(thisObject->m_dollarVMStructure);
visitor.append(thisObject->m_proxyObjectStructure);
visitor.append(thisObject->m_callableProxyObjectStructure);
visitor.append(thisObject->m_proxyRevokeStructure);
@@ -1482,6 +1472,23 @@
return CallFrame::create(m_globalCallFrame);
}
+void JSGlobalObject::exposeDollarVM()
+{
+ VM& vm = this->vm();
+
+ if (hasOwnProperty(globalExec(), vm.propertyNames->builtinNames().dollarVMPrivateName()))
+ return;
+
+ JSDollarVM* dollarVM = JSDollarVM::create(vm, JSDollarVM::createStructure(vm, this, m_objectPrototype.get()));
+
+ GlobalPropertyInfo extraStaticGlobals[] = {
+ GlobalPropertyInfo(vm.propertyNames->builtinNames().dollarVMPrivateName(), dollarVM, PropertyAttribute::DontEnum | PropertyAttribute::DontDelete | PropertyAttribute::ReadOnly),
+ };
+ addStaticGlobals(extraStaticGlobals, WTF_ARRAY_LENGTH(extraStaticGlobals));
+
+ putDirect(vm, Identifier::fromString(globalExec(), "$vm"), dollarVM, static_cast<unsigned>(PropertyAttribute::DontEnum));
+}
+
void JSGlobalObject::addStaticGlobals(GlobalPropertyInfo* globals, int count)
{
ScopeOffset startOffset = addVariables(count, jsUndefined());
Modified: trunk/Source/_javascript_Core/runtime/JSGlobalObject.h (232142 => 232143)
--- trunk/Source/_javascript_Core/runtime/JSGlobalObject.h 2018-05-24 01:18:20 UTC (rev 232142)
+++ trunk/Source/_javascript_Core/runtime/JSGlobalObject.h 2018-05-24 03:01:43 UTC (rev 232143)
@@ -355,7 +355,6 @@
WriteBarrier<Structure> m_asyncFunctionStructure;
WriteBarrier<Structure> m_asyncGeneratorFunctionStructure;
WriteBarrier<Structure> m_generatorFunctionStructure;
- WriteBarrier<Structure> m_dollarVMStructure;
WriteBarrier<Structure> m_iteratorResultObjectStructure;
WriteBarrier<Structure> m_regExpMatchesArrayStructure;
WriteBarrier<Structure> m_regExpMatchesArrayWithGroupsStructure;
@@ -902,6 +901,7 @@
WeakRandom& weakRandom() { return m_weakRandom; }
bool needsSiteSpecificQuirks() const { return m_needsSiteSpecificQuirks; }
+ JS_EXPORT_PRIVATE void exposeDollarVM();
#if JSC_OBJC_API_ENABLED
JSWrapperMap* wrapperMap() const { return m_wrapperMap.get(); }
Modified: trunk/Source/WebCore/ChangeLog (232142 => 232143)
--- trunk/Source/WebCore/ChangeLog 2018-05-24 01:18:20 UTC (rev 232142)
+++ trunk/Source/WebCore/ChangeLog 2018-05-24 03:01:43 UTC (rev 232143)
@@ -1,3 +1,15 @@
+2018-05-23 Keith Miller <[email protected]>
+
+ Expose $vm if window.internals is exposed
+ https://bugs.webkit.org/show_bug.cgi?id=185900
+
+ Reviewed by Mark Lam.
+
+ This is useful for testing vm internals when running LayoutTests.
+
+ * testing/js/WebCoreTestSupport.cpp:
+ (WebCoreTestSupport::injectInternalsObject):
+
2018-05-23 David Kilzer <[email protected]>
Don't create the SubimageCache just to clear an image from it
Modified: trunk/Source/WebCore/testing/js/WebCoreTestSupport.cpp (232142 => 232143)
--- trunk/Source/WebCore/testing/js/WebCoreTestSupport.cpp 2018-05-24 01:18:20 UTC (rev 232142)
+++ trunk/Source/WebCore/testing/js/WebCoreTestSupport.cpp 2018-05-24 03:01:43 UTC (rev 232143)
@@ -57,8 +57,10 @@
JSLockHolder lock(exec);
JSDOMGlobalObject* globalObject = jsCast<JSDOMGlobalObject*>(exec->lexicalGlobalObject());
ScriptExecutionContext* scriptContext = globalObject->scriptExecutionContext();
- if (is<Document>(*scriptContext))
+ if (is<Document>(*scriptContext)) {
globalObject->putDirect(exec->vm(), Identifier::fromString(exec, Internals::internalsId), toJS(exec, globalObject, Internals::create(downcast<Document>(*scriptContext))));
+ globalObject->exposeDollarVM();
+ }
}
void resetInternalsObject(JSContextRef context)