Add ClassSpec for most built-ins
Categories
(Core :: JavaScript Engine, task, P3)
Tracking
()
Tracking | Status | |
---|---|---|
firefox72 | --- | fixed |
People
(Reporter: anba, Assigned: anba)
Details
Attachments
(16 files)
47 bytes,
text/x-phabricator-request
|
Details | Review | |
47 bytes,
text/x-phabricator-request
|
Details | Review | |
47 bytes,
text/x-phabricator-request
|
Details | Review | |
47 bytes,
text/x-phabricator-request
|
Details | Review | |
47 bytes,
text/x-phabricator-request
|
Details | Review | |
47 bytes,
text/x-phabricator-request
|
Details | Review | |
47 bytes,
text/x-phabricator-request
|
Details | Review | |
47 bytes,
text/x-phabricator-request
|
Details | Review | |
47 bytes,
text/x-phabricator-request
|
Details | Review | |
47 bytes,
text/x-phabricator-request
|
Details | Review | |
47 bytes,
text/x-phabricator-request
|
Details | Review | |
47 bytes,
text/x-phabricator-request
|
Details | Review | |
47 bytes,
text/x-phabricator-request
|
Details | Review | |
47 bytes,
text/x-phabricator-request
|
Details | Review | |
47 bytes,
text/x-phabricator-request
|
Details | Review | |
47 bytes,
text/x-phabricator-request
|
Details | Review |
The majority of all built-ins are already using ClassSpec. Let's convert the remaining ones to use it, too.
Updated•5 years ago
|
Assignee | ||
Comment 1•5 years ago
|
||
Boolean.prototype is itself a Boolean object, so the ClassSpec needs to use
a custom 'createPrototype' function to create and initialise the prototype
object.
Assignee | ||
Comment 2•5 years ago
|
||
In addition to a custom 'createProperty' hook, the Number ClassSpec also uses
a 'FinishClassInitOp' to initialise Number-related global properties like
isNaN
and to initialise functions which are shared between Number and the
global object (i.e. parseInt
).
Depends on D52657
Assignee | ||
Comment 3•5 years ago
|
||
Move String to ClassSpec using similar changes like done for Number in part 2.
Depends on D52658
Assignee | ||
Comment 4•5 years ago
|
||
A ClassSpec's 'FinishClassInitOp' isn't called when InitBareBuiltinCtor
is
used, which allows us to unconditionally define all well-known symbols in
SymbolClassFinish
. That means we no longer need the separate InitBareSymbolCtor
function.
Depends on D52659
Assignee | ||
Comment 5•5 years ago
|
||
The JSON ClassSpec uses a custom 'createConstructor', because the JSON object
is a singleton object and not a built-in constructor function.
Depends on D52660
Assignee | ||
Comment 6•5 years ago
|
||
Similar to the JSON changes in part 5. Additionally 'FinishClassInitOp' is
needed to initialise the double constant properties.
Depends on D52661
Assignee | ||
Comment 7•5 years ago
|
||
Similar changes like in part 5, only now for the Atomics object.
Depends on D52662
Assignee | ||
Comment 8•5 years ago
|
||
Depends on D52663
Assignee | ||
Comment 9•5 years ago
|
||
Depends on D52664
Assignee | ||
Comment 10•5 years ago
|
||
Proxy JSClasses are defined through a special macro (PROXY_CLASS_DEF
), which
ensures all Proxy related bits are set correctly. The macro doesn't allow to
specify a ClassSpec, so we need to add a new macro which supports that
functionality.
Depends on D52665
Assignee | ||
Comment 11•5 years ago
|
||
Assignee | ||
Comment 12•5 years ago
|
||
The "constructor" property of the GeneratorFunction prototype is non-writable,
so we need to manually adjust the property attributes in the FinishClassInitOp
.
This change needs to happen first to ensure "constructor" is still stored in
the last property, which in turn ensures the property can be modified without
triggering a transition into dictionary mode.
jsapi.cpp:
Remove the JSProto_GeneratorFunction special cases now that we can use
ClassSpec::DontDefineConstructor
.
Assignee | ||
Comment 13•5 years ago
|
||
Update AsyncFunction similar to the changes performed in part 13.
Depends on D52677
Assignee | ||
Comment 14•5 years ago
|
||
Depends on D52679
Assignee | ||
Comment 15•5 years ago
|
||
Also use ClassSpec initialisation for all WebAssembly namespace constructors
to ensure a failed initialisation can still be retried.
Assignee | ||
Comment 16•5 years ago
|
||
All JSProtoKey entries are now using InitViaClassSpec
, so we can remove the 'init'
parameter from JS_FOR_PROTOTYPES
and update all callers accordingly. Furthermore
the protoTable
array can be changed to an array of JSClass*
and
GlobalObject::resolveConstructor
can be cleaned-up to always use the ClassSpec
initialisation path.
Depends on D52705
Comment 17•5 years ago
|
||
Pushed by csabou@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/f082e5173ed4 Part 1: Change Boolean to use ClassSpec. r=mgaudet https://hg.mozilla.org/integration/autoland/rev/61d25028669b Part 2: Change Number to use ClassSpec. r=mgaudet https://hg.mozilla.org/integration/autoland/rev/338ad438e066 Part 3: Change String to use ClassSpec. r=mgaudet https://hg.mozilla.org/integration/autoland/rev/6c917c2ca4a7 Part 4: Change Symbol to use ClassSpec. r=mgaudet https://hg.mozilla.org/integration/autoland/rev/d5f5e9091fb0 Part 5: Change JSON to use ClassSpec. r=mgaudet https://hg.mozilla.org/integration/autoland/rev/68c5cdced300 Part 6: Change Math to use ClassSpec. r=mgaudet https://hg.mozilla.org/integration/autoland/rev/fef5c8d5cb90 Part 7: Change Atomics to use ClassSpec. r=mgaudet https://hg.mozilla.org/integration/autoland/rev/3b0e242d762a Part 8: Change Reflect to use ClassSpec. r=mgaudet https://hg.mozilla.org/integration/autoland/rev/29ec5ccb4adf Part 9: Change Intl to use ClassSpec. r=mgaudet https://hg.mozilla.org/integration/autoland/rev/a514661afdda Part 10: Change Proxy to use ClassSpec. r=mgaudet https://hg.mozilla.org/integration/autoland/rev/e089ebe699d2 Part 11: Change TypedObject to use ClassSpec. r=mgaudet https://hg.mozilla.org/integration/autoland/rev/2ce96c6187c2 Part 12: Change GeneratorFunction to use ClassSpec. r=mgaudet https://hg.mozilla.org/integration/autoland/rev/b11677f10f9d Part 13: Change AsyncFunction to use ClassSpec. r=mgaudet https://hg.mozilla.org/integration/autoland/rev/de5c2cca64c6 Part 14: Change AsyncGeneratorFunction to use ClassSpec. r=mgaudet https://hg.mozilla.org/integration/autoland/rev/8e8c4124f219 Part 15: Change WebAssembly to use ClassSpec. r=mgaudet https://hg.mozilla.org/integration/autoland/rev/3b5c6aaf5a18 Part 16: Remove old-style initialisation for ProtoKey constructors. r=mgaudet
Comment 18•5 years ago
|
||
Failure logs: https://treeherder.mozilla.org/logviewer.html#?job_id=276446721&repo=autoland
Backout link: https://hg.mozilla.org/integration/autoland/rev/ec8cad6891215a6db48cf2bc927ef6c77838035f
task 2019-11-15T16:11:03.505Z] 16:11:03 INFO - /builds/worker/fetches/sccache/sccache /builds/worker/fetches/clang/bin/clang++ -isysroot /builds/worker/workspace/build/src/MacOSX10.11.sdk -isysroot /builds/worker/workspace/build/src/MacOSX10.11.sdk --target=x86_64-apple-darwin -o Unified_cpp_js_src_fuzz-tests0.o -c -fvisibility=hidden -fvisibility-inlines-hidden -U_FORTIFY_SOURCE -DNDEBUG=1 -DTRIMMED=1 -DMOZ_HAS_MOZGLUE -DEXPORT_JS_API -Dtopsrcdir=/builds/worker/workspace/build/src/js/src -I/builds/worker/workspace/build/src/js/src/fuzz-tests -I/builds/worker/workspace/build/src/obj-firefox/js/src/fuzz-tests -I/builds/worker/workspace/build/src/obj-firefox/js/src -I/builds/worker/workspace/build/src/js/src -I/builds/worker/workspace/build/src/obj-firefox/dist/include -I/builds/worker/workspace/build/src/obj-firefox/dist/include/nspr -fPIC -DMOZILLA_CLIENT -include /builds/worker/workspace/build/src/obj-firefox/js/src/js-confdefs.h -Qunused-arguments -Qunused-arguments -Wall -Wbitfield-enum-conversion -Wempty-body -Wignored-qualifiers -Woverloaded-virtual -Wpointer-arith -Wshadow-field-in-constructor-modified -Wsign-compare -Wtype-limits -Wunreachable-code -Wunreachable-code-return -Wwrite-strings -Wno-invalid-offsetof -Wclass-varargs -Wfloat-overflow-conversion -Wfloat-zero-conversion -Wloop-analysis -Wc++1z-compat -Wc++2a-compat -Wcomma -Wimplicit-fallthrough -Werror=non-literal-null-conversion -Wstring-conversion -Wtautological-overlap-compare -Wtautological-unsigned-enum-zero-compare -Wtautological-unsigned-zero-compare -Wno-error=tautological-type-limit-compare -Wno-inline-new-delete -Wno-error=deprecated-declarations -Wno-error=array-bounds -Wno-error=backend-plugin -Wno-error=return-std-move -Wno-error=atomic-alignment -Wformat -Wformat-security -Wno-gnu-zero-variadic-macro-arguments -Wno-noexcept-type -Wno-unknown-warning-option -Wno-return-type-c-linkage -fno-sized-deallocation -fno-aligned-new -fsanitize=address -fcrash-diagnostics-dir=/builds/worker/artifacts -fcrash-diagnostics-dir=/builds/worker/artifacts -fno-common -stdlib=libc++ -fno-rtti -ffunction-sections -fdata-sections -fno-exceptions -fno-math-errno -pthread -pipe -g -Xclang -load -Xclang /builds/worker/workspace/build/src/obj-firefox/build/clang-plugin/libclang-plugin.so -Xclang -add-plugin -Xclang moz-check -O2 -fno-omit-frame-pointer -funwind-tables -Werror -fno-strict-aliasing -Werror=format -Wno-shadow -fsanitize=fuzzer-no-link -MD -MP -MF .deps/Unified_cpp_js_src_fuzz-tests0.o.pp Unified_cpp_js_src_fuzz-tests0.cpp
[task 2019-11-15T16:11:03.507Z] 16:11:03 INFO - In file included from Unified_cpp_js_src_fuzz-tests0.cpp:29:
[task 2019-11-15T16:11:03.508Z] 16:11:03 ERROR - /builds/worker/workspace/build/src/js/src/fuzz-tests/testWasm.cpp:30:34: error: use of undeclared identifier 'InitWebAssemblyClass'
[task 2019-11-15T16:11:03.509Z] 16:11:03 INFO - if (!wasm::HasSupport(gCx) || !InitWebAssemblyClass(gCx, gCx->global())) {
[task 2019-11-15T16:11:03.509Z] 16:11:03 INFO - ^
[task 2019-11-15T16:11:03.510Z] 16:11:03 INFO - 1 error generated.
[task 2019-11-15T16:11:03.511Z] 16:11:03 INFO - /builds/worker/workspace/build/src/config/rules.mk:787: recipe for target 'Unified_cpp_js_src_fuzz-tests0.o' failed
[task 2019-11-15T16:11:03.512Z] 16:11:03 ERROR - make[4]: *** [Unified_cpp_js_src_fuzz-tests0.o] Error 1
[task 2019-11-15T16:11:03.513Z] 16:11:03 INFO - make[4]: Leaving directory '/builds/worker/workspace/build/src/obj-firefox/js/src/fuzz-tests'
[task 2019-11-15T16:11:03.514Z] 16:11:03 INFO - /builds/worker/workspace/build/src/config/recurse.mk:74: recipe for target 'js/src/fuzz-tests/target-objects' failed
[task 2019-11-15T16:11:03.515Z] 16:11:03 ERROR - make[3]: *** [js/src/fuzz-tests/target-objects] Error 2
[task 2019-11-15T16:11:03.516Z] 16:11:03 INFO - make[3]: *** Waiting for unfinished jobs....
Assignee | ||
Updated•5 years ago
|
Comment 19•5 years ago
|
||
Pushed by dluca@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/613925254cb8 Part 1: Change Boolean to use ClassSpec. r=mgaudet https://hg.mozilla.org/integration/autoland/rev/c93bb8aa55cb Part 2: Change Number to use ClassSpec. r=mgaudet https://hg.mozilla.org/integration/autoland/rev/a7e09c93804f Part 3: Change String to use ClassSpec. r=mgaudet https://hg.mozilla.org/integration/autoland/rev/be375beb4e75 Part 4: Change Symbol to use ClassSpec. r=mgaudet https://hg.mozilla.org/integration/autoland/rev/028807d73e93 Part 5: Change JSON to use ClassSpec. r=mgaudet https://hg.mozilla.org/integration/autoland/rev/30ee34be3dac Part 6: Change Math to use ClassSpec. r=mgaudet https://hg.mozilla.org/integration/autoland/rev/841c1f990ec7 Part 7: Change Atomics to use ClassSpec. r=mgaudet https://hg.mozilla.org/integration/autoland/rev/3f41226844ac Part 8: Change Reflect to use ClassSpec. r=mgaudet https://hg.mozilla.org/integration/autoland/rev/8717b7b9fa56 Part 9: Change Intl to use ClassSpec. r=mgaudet https://hg.mozilla.org/integration/autoland/rev/c9a3fbdf8c36 Part 10: Change Proxy to use ClassSpec. r=mgaudet https://hg.mozilla.org/integration/autoland/rev/785554d48e47 Part 11: Change TypedObject to use ClassSpec. r=mgaudet https://hg.mozilla.org/integration/autoland/rev/4e3823588b5c Part 12: Change GeneratorFunction to use ClassSpec. r=mgaudet https://hg.mozilla.org/integration/autoland/rev/bdd5039fbf61 Part 13: Change AsyncFunction to use ClassSpec. r=mgaudet https://hg.mozilla.org/integration/autoland/rev/1b2aaf181221 Part 14: Change AsyncGeneratorFunction to use ClassSpec. r=mgaudet https://hg.mozilla.org/integration/autoland/rev/b979171954b6 Part 15: Change WebAssembly to use ClassSpec. r=mgaudet https://hg.mozilla.org/integration/autoland/rev/72473d430f13 Part 16: Remove old-style initialisation for ProtoKey constructors. r=mgaudet
Comment 20•5 years ago
|
||
bugherder |
https://hg.mozilla.org/mozilla-central/rev/613925254cb8
https://hg.mozilla.org/mozilla-central/rev/c93bb8aa55cb
https://hg.mozilla.org/mozilla-central/rev/a7e09c93804f
https://hg.mozilla.org/mozilla-central/rev/be375beb4e75
https://hg.mozilla.org/mozilla-central/rev/028807d73e93
https://hg.mozilla.org/mozilla-central/rev/30ee34be3dac
https://hg.mozilla.org/mozilla-central/rev/841c1f990ec7
https://hg.mozilla.org/mozilla-central/rev/3f41226844ac
https://hg.mozilla.org/mozilla-central/rev/8717b7b9fa56
https://hg.mozilla.org/mozilla-central/rev/c9a3fbdf8c36
https://hg.mozilla.org/mozilla-central/rev/785554d48e47
https://hg.mozilla.org/mozilla-central/rev/4e3823588b5c
https://hg.mozilla.org/mozilla-central/rev/bdd5039fbf61
https://hg.mozilla.org/mozilla-central/rev/1b2aaf181221
https://hg.mozilla.org/mozilla-central/rev/b979171954b6
https://hg.mozilla.org/mozilla-central/rev/72473d430f13
Description
•