Source/JavaScriptCore/ChangeLog

 12021-07-02 Philip Chimento <pchimento@igalia.com>
 2
 3 [JSC] Implement Temporal
 4 https://bugs.webkit.org/show_bug.cgi?id=223166
 5
 6 Reviewed by NOBODY (OOPS!).
 7
 8 Intended to be the first patch in a stack. Adds boilerplate for
 9 Temporal in order to unblock further parallelizable work on this bug.
 10
 11 This patch adds a feature flag for Temporal, and a toplevel Temporal
 12 global containing only Temporal.now, which is itself an empty object.
 13 These objects will be further populated in later patches.
 14
 15 * CMakeLists.txt: Add TemporalObject and TemporalNow. Property lookup
 16 table in TemporalObject.
 17 * Sources.txt: Add TemporalObject and TemporalNow.
 18 * runtime/CommonIdentifiers.h: Add 'Temporal' property key.
 19 * runtime/JSGlobalObject.cpp:
 20 (JSC::JSGlobalObject::init): Create the Temporal global if the feature
 21 flag is enabled.
 22 * runtime/OptionsList.h: Add useTemporal feature flag.
 23 * runtime/TemporalNow.cpp: Added.
 24 (JSC::TemporalNow::TemporalNow):
 25 (JSC::TemporalNow::create):
 26 (JSC::TemporalNow::createStructure):
 27 (JSC::TemporalNow::finishCreation):
 28 * runtime/TemporalNow.h: Added.
 29 * runtime/TemporalObject.cpp: Added.
 30 (JSC::createNowObject):
 31 (JSC::TemporalObject::TemporalObject):
 32 (JSC::TemporalObject::create):
 33 (JSC::TemporalObject::createStructure):
 34 (JSC::TemporalObject::finishCreation):
 35 * runtime/TemporalObject.h: Added.
 36
1372021-07-02 Philippe Normand <pnormand@igalia.com>
238
339 [GTK] Add new revision variable in pkgconfig file

Source/JavaScriptCore/CMakeLists.txt

@@set(JavaScriptCore_OBJECT_LUT_SOURCES
107107 runtime/StringPrototype.cpp
108108 runtime/SymbolConstructor.cpp
109109 runtime/SymbolPrototype.cpp
 110 runtime/TemporalObject.cpp
110111
111112 wasm/js/JSWebAssembly.cpp
112113 wasm/js/JSToWasmICCallee.cpp

@@set(JavaScriptCore_PRIVATE_FRAMEWORK_HEADERS
10861087 runtime/SymbolTable.h
10871088 runtime/SymbolTableOrScopeDepth.h
10881089 runtime/TemplateObjectDescriptor.h
 1090 runtime/TemporalNow.h
 1091 runtime/TemporalObject.h
10891092 runtime/TestRunnerUtils.h
10901093 runtime/ThrowScope.h
10911094 runtime/ToNativeFromValue.h

Source/JavaScriptCore/Sources.txt

@@runtime/SymbolObject.cpp
10091009runtime/SymbolPrototype.cpp
10101010runtime/SymbolTable.cpp
10111011runtime/TemplateObjectDescriptor.cpp
 1012runtime/TemporalNow.cpp
 1013runtime/TemporalObject.cpp
10121014runtime/TestRunnerUtils.cpp
10131015runtime/ThrowScope.cpp
10141016runtime/TypeLocationCache.cpp

Source/JavaScriptCore/runtime/CommonIdentifiers.h

6161 macro(SharedArrayBuffer) \
6262 macro(String) \
6363 macro(Symbol) \
 64 macro(Temporal) \
6465 macro(WeakRef) \
6566 macro(__defineGetter__) \
6667 macro(__defineSetter__) \

Source/JavaScriptCore/runtime/JSGlobalObject.cpp

201201#include "SymbolConstructor.h"
202202#include "SymbolObject.h"
203203#include "SymbolPrototype.h"
 204#include "TemporalObject.h"
204205#include "VMTrapsInlines.h"
205206#include "WasmCapabilities.h"
206207#include "WeakMapConstructor.h"

@@capitalName ## Constructor* lowerName ## Constructor = featureFlag ? capitalName
12171218 IntlObject* intl = IntlObject::create(vm, this, IntlObject::createStructure(vm, this, m_objectPrototype.get()));
12181219 putDirectWithoutTransition(vm, vm.propertyNames->Intl, intl, static_cast<unsigned>(PropertyAttribute::DontEnum));
12191220
 1221 if (Options::useTemporal()) {
 1222 TemporalObject* temporal = TemporalObject::create(vm, TemporalObject::createStructure(vm, this));
 1223 putDirectWithoutTransition(vm, vm.propertyNames->Temporal, temporal, static_cast<unsigned>(PropertyAttribute::DontEnum));
 1224 }
 1225
12201226 m_moduleLoader.initLater(
12211227 [] (const Initializer<JSModuleLoader>& init) {
12221228 auto catchScope = DECLARE_CATCH_SCOPE(init.vm);

Source/JavaScriptCore/runtime/OptionsList.h

@@bool canUseWebAssemblyFastMemory();
550550 v(Bool, useDataICInOptimizingJIT, false, Normal, nullptr) \
551551 v(Bool, useDataICSharing, false, Normal, nullptr) \
552552 v(Bool, useBFI, false, Normal, "Allow ARM64 instruction selection of BFI") \
 553 v(Bool, useTemporal, false, Normal, "Expose the Temporal object.") \
553554
554555
555556enum OptionEquivalence {

Source/JavaScriptCore/runtime/TemporalNow.cpp

 1/*
 2 * Copyright (C) 2021 Igalia S.L. All rights reserved.
 3 *
 4 * This library is free software; you can redistribute it and/or
 5 * modify it under the terms of the GNU Lesser General Public
 6 * License as published by the Free Software Foundation; either
 7 * version 2 of the License, or (at your option) any later version.
 8 *
 9 * This library is distributed in the hope that it will be useful,
 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
 12 * Lesser General Public License for more details.
 13 *
 14 * You should have received a copy of the GNU Lesser General Public
 15 * License along with this library; if not, write to the Free Software
 16 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
 17 *
 18 */
 19
 20#include "config.h"
 21#include "TemporalNow.h"
 22
 23#include "JSGlobalObject.h"
 24#include "ObjectPrototype.h"
 25
 26namespace JSC {
 27
 28STATIC_ASSERT_IS_TRIVIALLY_DESTRUCTIBLE(TemporalNow);
 29
 30const ClassInfo TemporalNow::s_info = { "Temporal.now", &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(TemporalNow) };
 31
 32TemporalNow::TemporalNow(VM& vm, Structure* structure)
 33 : Base(vm, structure)
 34{
 35}
 36
 37TemporalNow* TemporalNow::create(VM& vm, Structure* structure)
 38{
 39 TemporalNow* object = new (NotNull, allocateCell<TemporalNow>(vm.heap)) TemporalNow(vm, structure);
 40 object->finishCreation(vm);
 41 return object;
 42}
 43
 44Structure* TemporalNow::createStructure(VM& vm, JSGlobalObject* globalObject)
 45{
 46 return Structure::create(vm, globalObject, globalObject->objectPrototype(), TypeInfo(ObjectType, StructureFlags), info());
 47}
 48
 49void TemporalNow::finishCreation(VM& vm)
 50{
 51 Base::finishCreation(vm);
 52 ASSERT(inherits(vm, info()));
 53 JSC_TO_STRING_TAG_WITHOUT_TRANSITION();
 54}
 55
 56} // namespace JSC

Source/JavaScriptCore/runtime/TemporalNow.h

 1/*
 2 * Copyright (C) 2021 Igalia, S.L. All rights reserved.
 3 *
 4 * This library is free software; you can redistribute it and/or
 5 * modify it under the terms of the GNU Lesser General Public
 6 * License as published by the Free Software Foundation; either
 7 * version 2 of the License, or (at your option) any later version.
 8 *
 9 * This library is distributed in the hope that it will be useful,
 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
 12 * Lesser General Public License for more details.
 13 *
 14 * You should have received a copy of the GNU Lesser General Public
 15 * License along with this library; if not, write to the Free Software
 16 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
 17 *
 18 */
 19
 20#pragma once
 21
 22#include "JSObject.h"
 23
 24namespace JSC {
 25
 26class TemporalNow final : public JSNonFinalObject {
 27public:
 28 using Base = JSNonFinalObject;
 29
 30 template<typename CellType, SubspaceAccess>
 31 static IsoSubspace* subspaceFor(VM& vm)
 32 {
 33 STATIC_ASSERT_ISO_SUBSPACE_SHARABLE(TemporalNow, Base);
 34 return &vm.plainObjectSpace;
 35 }
 36
 37 static TemporalNow* create(VM&, Structure*);
 38 static Structure* createStructure(VM&, JSGlobalObject*);
 39
 40 DECLARE_INFO;
 41
 42private:
 43 TemporalNow(VM&, Structure*);
 44 void finishCreation(VM&);
 45};
 46
 47} // namespace JSC

Source/JavaScriptCore/runtime/TemporalObject.cpp

 1/*
 2 * Copyright (C) 2021 Igalia S.L. All rights reserved.
 3 *
 4 * This library is free software; you can redistribute it and/or
 5 * modify it under the terms of the GNU Lesser General Public
 6 * License as published by the Free Software Foundation; either
 7 * version 2 of the License, or (at your option) any later version.
 8 *
 9 * This library is distributed in the hope that it will be useful,
 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
 12 * Lesser General Public License for more details.
 13 *
 14 * You should have received a copy of the GNU Lesser General Public
 15 * License along with this library; if not, write to the Free Software
 16 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
 17 *
 18 */
 19
 20#include "config.h"
 21#include "TemporalObject.h"
 22
 23#include "JSGlobalObject.h"
 24#include "ObjectPrototype.h"
 25#include "TemporalNow.h"
 26
 27namespace JSC {
 28
 29STATIC_ASSERT_IS_TRIVIALLY_DESTRUCTIBLE(TemporalObject);
 30
 31static JSValue createNowObject(VM& vm, JSObject* object)
 32{
 33 TemporalObject* temporalObject = jsCast<TemporalObject*>(object);
 34 JSGlobalObject* globalObject = temporalObject->globalObject(vm);
 35 return TemporalNow::create(vm, TemporalNow::createStructure(vm, globalObject));
 36}
 37
 38} // namespace JSC
 39
 40#include "TemporalObject.lut.h"
 41
 42namespace JSC {
 43
 44/* Source for TemporalObject.lut.h
 45@begin temporalObjectTable
 46 now createNowObject DontEnum|PropertyCallback
 47@end
 48*/
 49
 50const ClassInfo TemporalObject::s_info = { "Temporal", &Base::s_info, &temporalObjectTable, nullptr, CREATE_METHOD_TABLE(TemporalObject) };
 51
 52TemporalObject::TemporalObject(VM& vm, Structure* structure)
 53 : Base(vm, structure)
 54{
 55}
 56
 57TemporalObject* TemporalObject::create(VM& vm, Structure* structure)
 58{
 59 TemporalObject* object = new (NotNull, allocateCell<TemporalObject>(vm.heap)) TemporalObject(vm, structure);
 60 object->finishCreation(vm);
 61 return object;
 62}
 63
 64Structure* TemporalObject::createStructure(VM& vm, JSGlobalObject* globalObject)
 65{
 66 return Structure::create(vm, globalObject, globalObject->objectPrototype(), TypeInfo(ObjectType, StructureFlags), info());
 67}
 68
 69void TemporalObject::finishCreation(VM& vm)
 70{
 71 Base::finishCreation(vm);
 72 ASSERT(inherits(vm, info()));
 73 JSC_TO_STRING_TAG_WITHOUT_TRANSITION();
 74}
 75
 76} // namespace JSC

Source/JavaScriptCore/runtime/TemporalObject.h

 1/*
 2 * Copyright (C) 2021 Igalia, S.L. All rights reserved.
 3 *
 4 * This library is free software; you can redistribute it and/or
 5 * modify it under the terms of the GNU Lesser General Public
 6 * License as published by the Free Software Foundation; either
 7 * version 2 of the License, or (at your option) any later version.
 8 *
 9 * This library is distributed in the hope that it will be useful,
 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
 12 * Lesser General Public License for more details.
 13 *
 14 * You should have received a copy of the GNU Lesser General Public
 15 * License along with this library; if not, write to the Free Software
 16 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
 17 *
 18 */
 19
 20#pragma once
 21
 22#include "JSObject.h"
 23
 24namespace JSC {
 25
 26class TemporalObject final : public JSNonFinalObject {
 27public:
 28 using Base = JSNonFinalObject;
 29 static constexpr unsigned StructureFlags = Base::StructureFlags | HasStaticPropertyTable;
 30
 31 template<typename CellType, SubspaceAccess>
 32 static IsoSubspace* subspaceFor(VM& vm)
 33 {
 34 STATIC_ASSERT_ISO_SUBSPACE_SHARABLE(TemporalObject, Base);
 35 return &vm.plainObjectSpace;
 36 }
 37
 38 static TemporalObject* create(VM&, Structure*);
 39 static Structure* createStructure(VM&, JSGlobalObject*);
 40
 41 DECLARE_INFO;
 42
 43private:
 44 TemporalObject(VM&, Structure*);
 45 void finishCreation(VM&);
 46};
 47
 48} // namespace JSC