Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

String serialization of functions doesn't behaves as on Blink or Gecko #14704

Merged
merged 1 commit into from Jun 18, 2023

Conversation

colinvidal
Copy link
Contributor

@colinvidal colinvidal commented Jun 6, 2023

55ae3a1

String serialization of functions doesn't behaves as on Blink or Gecko

https://bugs.webkit.org/show_bug.cgi?id=242810

Reviewed by Yusuke Suzuki.

While Blink or Gecko does a string serialization of functions by returning the
strict content of the function expression/declaration from the source code,
WebKit starts with `function `, `function* ` for generators, `async function `
and to on then concatenate the rest of the function declaration/expression from
the source code.

This can create mismatch depending, for instance, the number of spaces between
the `function` keyword and the parameter list. This change makes WebKit to
returns the entire function expression/declaration when serializing a function.

Main code changes are:

- At AST/Parser level, propagating up the start of the expression (or
  declaration) through the `asyncKeywordStart`.
- Adding this start value in the UnlinkedFunctionExecutable class, replacing
  `m_unlinkedFunctionNameStart` to avoid increasing the memory footprint.
- Updating the FunctionExecutable method doing the serialization.
- Adding a dedicated test file for this.
- Numerous unit test updates.
- Bunch of test262 tests are now passing, so removing them from expectation
  file.

* JSTests/ChakraCore/test/Array/array_literal.baseline:
* JSTests/ChakraCore/test/Function/toString.baseline-jsc:
* JSTests/ChakraCore/test/es5/ObjLitGetSet.baseline-jsc:
* JSTests/mozilla/js1_5/Scope/regress-185485.js:
(expect):
* JSTests/stress/function-constructor-name.js:
(async var):
* JSTests/stress/function-to-string.js:
(async shouldBe):
* JSTests/test262/expectations.yaml:
* LayoutTests/fast/canvas/2d.setTransform.matrix-expected.txt:
* LayoutTests/fast/canvas/canvas-pattern-transform-expected.txt:
* LayoutTests/fast/dom/TreeWalker/acceptNode-filter-expected.txt:
* LayoutTests/fast/dom/Window/Location/window-override-location-using-defineGetter-expected.txt:
* LayoutTests/fast/dom/Window/Location/window-override-window-using-defineGetter-expected.txt:
* LayoutTests/fast/dom/getter-on-window-object2-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/FileAPI/blob/Blob-constructor-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/FileAPI/blob/Blob-constructor.any-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/FileAPI/blob/Blob-constructor.any.worker-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/FileAPI/file/File-constructor-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/FileAPI/file/File-constructor.any-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/FileAPI/file/File-constructor.any.worker-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/IndexedDB/structured-clone.any-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/IndexedDB/structured-clone.any.worker_101-last-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/IndexedDB/structured-clone.any_101-last-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/clipboard-apis/async-navigator-clipboard-basics.https-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/cors/origin-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/credential-management/credentialscontainer-create-basics.https-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/css/cssom-view/MediaQueryList-addListener-handleEvent-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/css/cssom-view/idlharness-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/css/cssom/at-namespace-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/css/geometry/DOMMatrix-001-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/domparsing/innerhtml-01-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/feature-policy/reporting/picture-in-picture-reporting-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/feature-policy/reporting/screen-wake-lock-reporting.https-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/fetch/api/abort/general.any-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/fetch/api/abort/general.any.serviceworker-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/fetch/api/abort/general.any.sharedworker-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/fetch/api/abort/general.any.worker-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/fetch/api/abort/serviceworker-intercepted.https-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/fetch/api/basic/request-upload.any-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/fetch/api/basic/request-upload.any.serviceworker-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/fetch/api/basic/request-upload.any.sharedworker-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/fetch/api/basic/request-upload.any.worker-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/fetch/api/basic/request-upload.h2.any-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/fetch/api/basic/request-upload.h2.any.serviceworker-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/fetch/api/basic/request-upload.h2.any.sharedworker-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/fetch/api/basic/request-upload.h2.any.worker-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/fetch/api/redirect/redirect-upload.h2.any-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/fetch/api/redirect/redirect-upload.h2.any.serviceworker-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/fetch/api/redirect/redirect-upload.h2.any.sharedworker-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/fetch/api/redirect/redirect-upload.h2.any.worker-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/fetch/api/request/request-consume-empty-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/fetch/api/request/request-consume-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/fetch/api/request/request-consume.any-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/fetch/api/request/request-consume.any.serviceworker-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/fetch/api/request/request-consume.any.sharedworker-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/fetch/api/request/request-consume.any.worker-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/fetch/api/response/json.any-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/fetch/api/response/json.any.worker-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/fetch/api/response/response-consume-empty-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/fetch/api/response/response-error-from-stream-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/fetch/api/response/response-error-from-stream.any-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/fetch/api/response/response-error-from-stream.any.serviceworker-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/fetch/api/response/response-error-from-stream.any.sharedworker-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/fetch/api/response/response-error-from-stream.any.worker-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/file-system-access/sandboxed_FileSystemDirectoryHandle-move.https.any-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/file-system-access/sandboxed_FileSystemDirectoryHandle-move.https.any.worker-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/fs/FileSystemFileHandle-sync-access-handle-writable-lock.https.tentative.worker-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/fullscreen/api/element-request-fullscreen-namespaces-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/html/browsers/history/the-history-interface/history_properties_only_fully_active-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/html/browsers/history/the-location-interface/location-prototype-setting-cross-origin.sub-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/html/browsers/origin/cross-origin-objects/cross-origin-objects-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/html/browsers/origin/relaxing-the-same-origin-restriction/document_domain_setter-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/html/browsers/the-windowproxy-exotic-object/windowproxy-prototype-setting-cross-origin.sub-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/html/browsers/windows/auxiliary-browsing-contexts/opener-setter.window-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/html/canvas/element/drawing-images-to-the-canvas/2d.drawImage.nonexistent-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/html/canvas/element/fill-and-stroke-styles/2d.pattern.image.nonexistent-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/html/canvas/element/filters/2d.filter.canvasFilterObject.blur.exceptions-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/html/canvas/element/filters/2d.filter.canvasFilterObject.blur.exceptions.tentative-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/html/canvas/element/filters/2d.filter.canvasFilterObject.colorMatrix-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/html/canvas/element/filters/2d.filter.canvasFilterObject.colorMatrix.tentative-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/html/canvas/element/filters/2d.filter.canvasFilterObject.convolveMatrix.exceptions-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/html/canvas/element/filters/2d.filter.canvasFilterObject.convolveMatrix.exceptions.tentative-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/html/canvas/element/filters/2d.filter.canvasFilterObject.turbulence.inputTypes.tentative-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/html/canvas/element/manual/imagebitmap/createImageBitmap-invalid-args-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/html/canvas/element/pixel-manipulation/2d.imageData.object.ctor.basics-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/html/canvas/offscreen/filters/2d.filter.canvasFilterObject.blur.exceptions-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/html/canvas/offscreen/filters/2d.filter.canvasFilterObject.blur.exceptions.tentative-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/html/canvas/offscreen/filters/2d.filter.canvasFilterObject.blur.exceptions.tentative.worker-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/html/canvas/offscreen/filters/2d.filter.canvasFilterObject.colorMatrix-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/html/canvas/offscreen/filters/2d.filter.canvasFilterObject.colorMatrix.tentative-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/html/canvas/offscreen/filters/2d.filter.canvasFilterObject.colorMatrix.tentative.worker-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/html/canvas/offscreen/filters/2d.filter.canvasFilterObject.convolveMatrix.exceptions-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/html/canvas/offscreen/filters/2d.filter.canvasFilterObject.convolveMatrix.exceptions.tentative-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/html/canvas/offscreen/filters/2d.filter.canvasFilterObject.convolveMatrix.exceptions.tentative.worker-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/html/canvas/offscreen/filters/2d.filter.canvasFilterObject.turbulence.inputTypes.tentative-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/html/canvas/offscreen/filters/2d.filter.canvasFilterObject.turbulence.inputTypes.tentative.worker-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/html/dom/idlharness.https_include=HTML._-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/html/semantics/embedded-content/the-canvas-element/imagedata-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/html/semantics/embedded-content/the-canvas-element/security.pattern.fillStyle.sub-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/html/webappapis/scripting/events/event-handler-spec-example-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/html/webappapis/scripting/events/event-handler-spec-example.window-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/media-source/mediasource-sourcebuffer-mode-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/mediacapture-record/MediaRecorder-events-and-exceptions-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/payment-request/payment-is-showing.https-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/payment-request/payment-request-hasenrolledinstrument-method.tentative.https-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/payment-request/show-consume-activation.https-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/screen-orientation/active-lock-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/screen-orientation/nested-documents-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/screen-orientation/unlock-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/service-workers/cache-storage/cache-add.https.any-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/service-workers/cache-storage/cache-add.https.any.serviceworker-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/service-workers/cache-storage/cache-add.https.any.sharedworker-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/service-workers/cache-storage/cache-add.https.any.worker-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/fetch-event.https-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/update.https-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/streams/idlharness.any-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/streams/idlharness.any.serviceworker-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/streams/idlharness.any.sharedworker-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/streams/idlharness.any.worker-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/svg/animations/scripted/SVGAnimationElement-exceptions-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/svg/types/scripted/SVGLength-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/web-share/disabled-by-permissions-policy.https.sub-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/web-share/share-sharePromise-internal-slot.https-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/webrtc/RTCPeerConnection-setLocalDescription-answer-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/webrtc/RTCPeerConnection-setLocalDescription-pranswer-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/websockets/Create-protocols-repeated-case-insensitive.any-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/websockets/Create-protocols-repeated-case-insensitive.any.worker-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/websockets/Create-protocols-repeated-case-insensitive.any.worker_wss-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/websockets/Create-protocols-repeated-case-insensitive.any_wss-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/websockets/interfaces/WebSocket/send/010-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/websockets/interfaces/WebSocket/send/010_wss-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/webstorage/missing_arguments.window-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/webstorage/storage_string_conversion.window-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/webxr/xrDevice_requestSession_requiredFeatures_unknown.https-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/xhr/open-url-multi-window-3-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/xhr/open-url-multi-window-6-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/xhr/send-data-sharedarraybuffer.any-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/xhr/send-data-sharedarraybuffer.any.worker-expected.txt:
* LayoutTests/inspector/audit/non-minified-default-audits.html:
* LayoutTests/inspector/console/command-line-api-copy.html:
* LayoutTests/inspector/console/console-table-expected.txt:
* LayoutTests/inspector/model/remote-object-get-properties-expected.txt:
* LayoutTests/inspector/model/remote-object/class-expected.txt:
* LayoutTests/inspector/model/remote-object/function-expected.txt:
* LayoutTests/inspector/runtime/getDisplayableProperties-expected.txt:
* LayoutTests/inspector/runtime/getProperties-expected.txt:
* LayoutTests/js/const-expected.txt:
* LayoutTests/js/destructuring-assignment-expected.txt:
* LayoutTests/js/dfg-redundant-load-of-captured-variable-proven-constant-expected.txt:
* LayoutTests/js/dfg-resolve-global-specific-dictionary-expected.txt:
* LayoutTests/js/dom/JSON-parse-complex-expected.txt:
* LayoutTests/js/dom/JSON-parse-expected.txt:
* LayoutTests/js/dom/JSON-stringify-expected.txt:
* LayoutTests/js/dom/dfg-strcat-over-objects-then-exit-on-it-expected.txt:
* LayoutTests/js/dom/function-prototype-expected.txt:
* LayoutTests/js/dom/function-prototype.html:
* LayoutTests/js/dom/script-tests/dfg-strcat-over-objects-then-exit-on-it.js:
* LayoutTests/js/dom/toString-and-valueOf-override-expected.txt:
* LayoutTests/js/kde/lval-exceptions-expected.txt:
* LayoutTests/js/object-literal-computed-methods-expected.txt:
* LayoutTests/js/object-literal-methods-expected.txt:
* LayoutTests/js/script-tests/dfg-redundant-load-of-captured-variable-proven-constant.js:
* LayoutTests/js/script-tests/dfg-resolve-global-specific-dictionary.js:
* LayoutTests/js/script-tests/function-toString-vs-name.js:
(runTest):
* LayoutTests/js/script-tests/object-literal-computed-methods.js:
* LayoutTests/js/script-tests/object-literal-methods.js:
* LayoutTests/media/modern-media-controls/button/button-icon-name-expected.txt:
* LayoutTests/platform/glib/http/wpt/push-api/pushManager.any-expected.txt:
* LayoutTests/platform/glib/http/wpt/push-api/pushManager.any.serviceworker-expected.txt:
* LayoutTests/platform/glib/imported/w3c/web-platform-tests/cors/origin-expected.txt:
* LayoutTests/platform/glib/imported/w3c/web-platform-tests/fetch/api/basic/request-upload.any-expected.txt:
* LayoutTests/platform/glib/imported/w3c/web-platform-tests/fetch/api/basic/request-upload.any.serviceworker-expected.txt:
* LayoutTests/platform/glib/imported/w3c/web-platform-tests/fetch/api/basic/request-upload.any.sharedworker-expected.txt:
* LayoutTests/platform/glib/imported/w3c/web-platform-tests/fetch/api/basic/request-upload.any.worker-expected.txt:
* LayoutTests/platform/glib/imported/w3c/web-platform-tests/fetch/content-encoding/bad-gzip-body.any.serviceworker-expected.txt:
* LayoutTests/platform/glib/imported/w3c/web-platform-tests/fetch/content-encoding/bad-gzip-body.any.sharedworker-expected.txt:
* LayoutTests/platform/glib/imported/w3c/web-platform-tests/html/browsers/origin/relaxing-the-same-origin-restriction/document_domain_setter-expected.txt:
* LayoutTests/platform/glib/imported/w3c/web-platform-tests/media-source/mediasource-sourcebuffer-mode-expected.txt:
* LayoutTests/platform/ios-wk2/imported/w3c/web-platform-tests/feature-policy/reporting/picture-in-picture-reporting-expected.txt:
* LayoutTests/platform/ios-wk2/imported/w3c/web-platform-tests/html/dom/idlharness.https_include=HTML._-expected.txt:
* LayoutTests/platform/ios/imported/w3c/web-platform-tests/html/user-activation/idlharness.https_include=HTML._-expected.txt:
* LayoutTests/platform/mac-wk1/imported/w3c/web-platform-tests/html/dom/idlharness.https_include=HTML._-expected.txt:
* LayoutTests/platform/mac-wk1/imported/w3c/web-platform-tests/html/semantics/forms/textfieldselection/selection-not-application-expected.txt:
* LayoutTests/platform/mac-wk1/imported/w3c/web-platform-tests/html/semantics/forms/textfieldselection/selection-not-application_week,month-expected.txt:
* LayoutTests/storage/domstorage/localstorage/string-conversion-expected.txt:
* LayoutTests/storage/domstorage/sessionstorage/string-conversion-expected.txt:
* LayoutTests/streams/reference-implementation/transform-stream-expected.txt:
* LayoutTests/webaudio/convolver-channels-expected.txt:
* Source/JavaScriptCore/API/tests/FunctionOverridesTest.cpp:
(testFunctionOverrides):
* Source/JavaScriptCore/API/tests/FunctionToStringTests.cpp: Added.
(testFunctionToString):
* Source/JavaScriptCore/API/tests/FunctionToStringTests.h: Added.
* Source/JavaScriptCore/API/tests/testapi.c:
(main):
* Source/JavaScriptCore/JavaScriptCore.xcodeproj/project.pbxproj:
* Source/JavaScriptCore/bytecode/CodeBlock.cpp:
(JSC::CodeBlock::sourceCodeForTools const):
(JSC::CodeBlock::dumpSource):
(JSC::CodeBlock::finishCreation):
(JSC::CodeBlock::insertBasicBlockBoundariesForControlFlowProfiler):
* Source/JavaScriptCore/bytecode/CodeBlock.h:
* Source/JavaScriptCore/bytecode/UnlinkedFunctionExecutable.cpp:
(JSC::UnlinkedFunctionExecutable::UnlinkedFunctionExecutable):
(JSC::UnlinkedFunctionExecutable::setInvalidTypeProfilingOffsets): Deleted.
* Source/JavaScriptCore/bytecode/UnlinkedFunctionExecutable.h:
* Source/JavaScriptCore/bytecompiler/BytecodeGenerator.cpp:
(JSC::BytecodeGenerator::emitNewDefaultConstructor):
* Source/JavaScriptCore/parser/ASTBuilder.h:
(JSC::ASTBuilder::createFunctionMetadata):
* Source/JavaScriptCore/parser/Nodes.cpp:
(JSC::FunctionMetadataNode::FunctionMetadataNode):
(JSC::FunctionMetadataNode::operator== const):
(JSC::FunctionMetadataNode::dump const):
* Source/JavaScriptCore/parser/Nodes.h:
* Source/JavaScriptCore/parser/Parser.cpp:
(JSC::Parser<LexerType>::parseGeneratorFunctionSourceElements):
(JSC::Parser<LexerType>::parseAsyncFunctionSourceElements):
(JSC::Parser<LexerType>::parseAsyncGeneratorFunctionSourceElements):
(JSC::Parser<LexerType>::parseSingleFunction):
(JSC::Parser<LexerType>::parseStatementListItem):
(JSC::Parser<LexerType>::parseFunctionBody):
(JSC::Parser<LexerType>::parseFunctionInfo):
(JSC::Parser<LexerType>::parseFunctionDeclaration):
(JSC::Parser<LexerType>::parseAsyncFunctionDeclaration):
(JSC::Parser<LexerType>::parseClass):
(JSC::Parser<LexerType>::parseExportDeclaration):
(JSC::Parser<LexerType>::parseAssignmentExpression):
(JSC::Parser<LexerType>::parseProperty):
(JSC::Parser<LexerType>::parsePropertyMethod):
(JSC::Parser<LexerType>::parseFunctionExpression):
(JSC::Parser<LexerType>::parseAsyncFunctionExpression):
(JSC::Parser<LexerType>::parsePrimaryExpression):
(JSC::Parser<LexerType>::parseArrowFunctionExpression):
* Source/JavaScriptCore/parser/Parser.h:
* Source/JavaScriptCore/runtime/CachedTypes.cpp:
(JSC::CachedFunctionExecutable::unlinkedFunctionStart const):
(JSC::CachedFunctionExecutable::unlinkedFunctionEnd const):
(JSC::CachedFunctionExecutable::encode):
(JSC::UnlinkedFunctionExecutable::UnlinkedFunctionExecutable):
(JSC::CachedFunctionExecutable::unlinkedFunctionNameStart const): Deleted.
(JSC::CachedFunctionExecutable::typeProfilingStartOffset const): Deleted.
(JSC::CachedFunctionExecutable::typeProfilingEndOffset const): Deleted.
* Source/JavaScriptCore/runtime/FunctionExecutable.cpp:
(JSC::FunctionExecutable::ensureRareDataSlow):
(JSC::FunctionExecutable::toStringSlow):
(JSC::FunctionExecutable::overrideInfo):
* Source/JavaScriptCore/runtime/FunctionExecutable.h:
* Source/JavaScriptCore/runtime/JSModuleRecord.cpp:
(JSC::JSModuleRecord::instantiateDeclarations):
* Source/JavaScriptCore/runtime/ModuleProgramExecutable.cpp:
(JSC::ModuleProgramExecutable::ModuleProgramExecutable):
* Source/JavaScriptCore/runtime/ProgramExecutable.cpp:
(JSC::ProgramExecutable::ProgramExecutable):
(JSC::ProgramExecutable::initializeGlobalProperties):
* Source/JavaScriptCore/runtime/ScriptExecutable.cpp:
(JSC::ScriptExecutable::typeProfilingStartOffset const):
(JSC::ScriptExecutable::typeProfilingEndOffset const):
* Source/JavaScriptCore/runtime/ScriptExecutable.h:
* Source/JavaScriptCore/shell/CMakeLists.txt:
* Source/JavaScriptCore/tools/FunctionOverrides.cpp:
(JSC::initializeOverrideInfo):
* Source/JavaScriptCore/tools/FunctionOverrides.h:
* Source/JavaScriptCore/tools/JSDollarVM.cpp:
(JSC::JSC_DEFINE_HOST_FUNCTION):

Canonical link: https://commits.webkit.org/265284@main

2f95066

Misc iOS, tvOS & watchOS macOS Linux Windows
❌ πŸ§ͺ style βœ… πŸ›  ios βœ… πŸ›  mac βœ… πŸ›  wpe βœ… πŸ›  wincairo
βœ… πŸ§ͺ bindings βœ… πŸ›  ios-sim βœ… πŸ›  mac-AS-debug βœ… πŸ§ͺ wpe-wk2
βœ… πŸ§ͺ webkitperl βœ… πŸ§ͺ ios-wk2 βœ… πŸ§ͺ api-mac βœ… πŸ›  gtk
βœ… πŸ§ͺ ios-wk2-wpt βœ… πŸ§ͺ mac-wk1 βœ… πŸ§ͺ gtk-wk2
βœ… πŸ›  πŸ§ͺ jsc βœ… πŸ§ͺ api-ios βœ… πŸ§ͺ mac-wk2 βœ… πŸ§ͺ api-gtk
βœ… πŸ›  πŸ§ͺ jsc-arm64 βœ… πŸ›  tv ❌ πŸ§ͺ mac-AS-debug-wk2 βœ… πŸ›  jsc-armv7
βœ… πŸ›  tv-sim βœ… πŸ§ͺ mac-wk2-stress βœ… πŸ§ͺ jsc-armv7-tests
βœ… πŸ›  πŸ§ͺ merge βœ… πŸ›  watch βœ… πŸ›  jsc-mips
βœ… πŸ›  watch-sim βœ… πŸ§ͺ jsc-mips-tests

@colinvidal colinvidal requested a review from a team as a code owner June 6, 2023 19:19
"valid &&= f2.toString() == 'async()=>{}'" "\n"
"let f3 = async () => {}" "\n"
"valid &&= f3.toString() == 'async () => {}'" "\n"
"valid";
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I initially wrote this way:

    const auto inputScript = R"(
        var valid = true;

        function foo2   () {}
        valid &&= foo2.toString() == "function foo2   () {}"

        function       foo3()   {}
        valid &&= foo3.toString() == "function       foo3()   {}"

        function*  fooGen   (){}
        valid &&= fooGen.toString() == "function*  fooGen   (){}"

        async function fnasync() {}
        valid &&= fnasync.toString() == "async function fnasync() {}"

        let f1 = async function() {}
        valid &&= f1.toString() == "async function() {}"

        let f2 = async()=>{}
        valid &&= f2.toString() == "async()=>{}"

        let f3 = async  ()    =>     {}
        valid &&= f3.toString() == "async  ()    =>     {}"

        valid
    )";

As it seems clearer to me, but I understand raw string aren't accepted/considered as bad practice in this project?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This API test is awesome! And at the same time, you can add tests to JSTests/stress/*.js easily too.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For Raw string, it is fine :)

Copy link
Contributor Author

@colinvidal colinvidal Jun 6, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank for your comments :-) I wasn't sure how to run those tests, looks like I definitely broke a bunch of legit test cases

expectations-diff.txt

(I suspect some changes aren't related to this PR, but I'll double check that later once I fixed what I broke for sure)

I'll figure out what's wrong and follow-up. (And also re-add raw string then, plus few extra tests cases and add those in JSTests/stress).

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also, probably you need to adjust / modify / verify the test failures in JSTests etc. (as JSC tests are failing).
You can run these tests with Tools/Scripts/run-javascriptcore-tests command. https://ews-build.webkit.org/#/builders/12/builds/8723
Maybe, some are real issues. Some are not (need to rebase test expectations).

#include "FunctionToStringTests.h"

#include "InitializeThreading.h"
#include "JavaScript.h"
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I got this error locally (and visible on the pipeline check here):

ERROR: Source/JavaScriptCore/API/tests/FunctionToStringTests.cpp:27:  Found other header before a header this file implements. Should be: config.h, primary header, blank line, and then alphabetically sorted.  [build/include_order] [4]

But I'm not sure what I get wrong here - seems that I respect what's asked here, isn't it?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's ignore this. This warning is for non testapi thing.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I was just curious why this error was triggered, and found this in the style checker:

# Test .cpp, .mm, .c files do not have primary header files.
if any(target_base.endswith(suffix) for suffix in ['Test', 'Tests']):
    return _OTHER_HEADER

Not sure why that'd be necessary though, since if test files didn't have headers there'd be no primary header anyway, so I can't see this would need to be a special case. Not that it matters anyway.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @tadeuzagallo -- Should I create a bug for this?

@Constellation
Copy link
Member

@colinvidal Can you also run test262-runner --release --save to update test262 results (And see whether it is valid change against test262?).

@webkit-ews-buildbot webkit-ews-buildbot added the merging-blocked Applied to prevent a change from being merged label Jun 6, 2023
Copy link
Member

@Constellation Constellation left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

r- for now since EWS are red. But this is good work!

@colinvidal
Copy link
Contributor Author

Latest updates mostly focused on getting test262 fixed - which is done now, putting aside a comment I left in the code).

Note I'm not done yet: I still have to investigate/fix run-javascript-core-tests (that said from a quick glance at a local run logs I spot a bunch of those which are expected, i.e. some toString comparaison with spacing between function and parameters, hopefully I didn't broke too much things).

I also need to port the test case added in apitest in JSTests/stress. Will follow-up tomorrow.

strict mode: 'Test262Error: Expected Sun Dec 31 1899 23:59:59 GMT+0009 (Central European Standard Time) to be -2208988801000 milliseconds from the Unix epoch'
test/built-ins/Date/S15.9.3.1_A5_T6.js:
default: 'Test262Error: Expected Sun Dec 31 1899 23:59:59 GMT+0009 (Central European Standard Time) to be -2208988800001 milliseconds from the Unix epoch'
strict mode: 'Test262Error: Expected Sun Dec 31 1899 23:59:59 GMT+0009 (Central European Standard Time) to be -2208988800001 milliseconds from the Unix epoch'
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't get how those changes introduce this -- Feels like it's something locally wrong on my machine but I'll follow-up on this tomorrow.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So I think I should probably not introduce this diff here: I got those failure on my machine even from main branch (as well as a bunch of timedate related tests running form run-javascriptcore-tests). Let's remove that?

strict mode: "SyntaxError: Invalid unicode escape in identifier: '\\u{1123F}'"
test/language/identifiers/start-unicode-15.0.0.js:
default: "SyntaxError: Invalid character '\\ud804'"
strict mode: "SyntaxError: Invalid character '\\ud804'"
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think those are related by those changes either. Likely something gets fixed previously in the repo but test262 haven't been run/added to the commit.

@@ -263,7 +263,7 @@ class UnlinkedFunctionExecutable final : public JSCell {
unsigned m_isGeneratedFromCache : 1;
unsigned m_lineCount : 31;
unsigned m_hasCapturedVariables : 1;
unsigned m_unlinkedFunctionNameStart : 31;
unsigned m_unlinkedFunctionStart: 31;
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hard to find a meaningful name for this - "expressionStart" feels wrong as it's not always an expression "declarationStart" neither for the antagonist reason.

Also, looking at the parser code I'm wondering if this couldn't be "merged" with m_typeProfilingStartOffset -- Probably not a good idea to do it there but just a though.

@@ -31,6 +31,6 @@ return 42
var agf = AsyncGeneratorFunction(`return 42`);
shouldBe(typeof anonymous, `undefined`);
shouldBe(agf.toString(),
`async function* anonymous() {
`async function*anonymous() {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Those two cases used to work before function* , and async function* where prefixing the rest of the function definition (from name or parameter list). So it didn't matter how the function was written (i.e. function* or function *, etc.).

Now we're actually starting from the actual "start" of the function definition, it matters. And function constructor are generated internally by the runtime, in FunctionConstructor.cpp::stringifyFunction. For a reason I don't know (probably arbitrary) function generators are function * and async function generator are async function*. That's why I had to update the spaces between the times symbol.

If preferred, I can revert this change and update FunctionConstructor instead. I don't know what can be the consequences elsewhere/on other debugging tools though.

I understand toString behavior of function constructor is not specified anyway (V8 for instance generate totally different output:

> let fga =async function*(){ console.log('foo')}
> fga.constructor.toString()
'function AsyncGeneratorFunction() { [native code] }'

function () { return _foo; }
function (value) { _foo = value; }
get foo() { return _foo; }
set foo(value) { _foo = value; }
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Those two things are outstanding (and it's not even the Chakra baseline) but as I understand the ECMA spec, this is what it should be. See

JSTests/test262/test/built-ins/Function/prototype/toString/getter-object.js

@@ -18,7 +18,7 @@ PASS o.add(42, -10) is 32
PASS typeof o.add is 'function'
PASS o.add.length is 2
PASS o.add.name is 'add'
PASS o.add.toString() is 'function (x, y) { return x + y; }'
PASS o.add.toString() is '[methodName](x, y) { return x + y; }'
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As weird as those two guys looked, that's how I understand the spec.

Also tested on SpiderMonday and V8 to cross-check, and they behaves the same as this:

> o = { ['f'+'oo']() { return 10; } };
> o.foo.toString()
"['f'+'oo']() { return 10; }"
> methodName = 'add'; o = { [methodName](x, y) { return x + y; } };
> o.add.toString()
'[methodName](x, y) { return x + y; }'

@colinvidal
Copy link
Contributor Author

colinvidal commented Jun 9, 2023

Adding another bunch of fixes (layout js tests), but one test remain to fix, will do ASAP. (as well as adding the apitest in stress test as well).

Sorry - size of this PR grows legs, but it's only test updates so far.

@colinvidal
Copy link
Contributor Author

colinvidal commented Jun 12, 2023

Looks like all tests are now fixed, putting aside mac-AS-debug-wk2, the two failing (hitting an assert) are

media/modern-media-controls/pip-support/pip-support-click.html
media/track/track-webvtt-snap-to-lines-inline-style.html

I hardly see the connection between those and the changes in the PR when looking at tests and the code from the two stack provided:

ASSERTION FAILED: foundContainer
/Volumes/Data/worker/macOS-AppleSilicon-Ventura-Debug-WK2-Tests-EWS/build/Source/WebCore/rendering/RenderGeometryMap.cpp(97) : void WebCore::RenderGeometryMap::mapToContainer(WebCore::TransformState &, const WebCore::RenderLayerModelObject *) const
1   0x137fbe600 WTFCrash
2   0x283f1da60 WebCore::NetworkResourcesData::ResourceData::hasContent() const
3   0x284f93250 WebCore::RenderGeometryMap::mapToContainer(WebCore::TransformState&, WebCore::RenderLayerModelObject const*) const
4   0x284f93854 WebCore::RenderGeometryMap::mapToContainer(WebCore::FloatRect const&, WebCore::RenderLayerModelObject const*) const
5   0x284ee2524 WebCore::RenderBox::outlineBoundsForRepaint(WebCore::RenderLayerModelObject const*, WebCore::RenderGeometryMap const*) const
6   0x284fc7984 WebCore::RenderLayer::computeRepaintRects(WebCore::RenderLayerModelObject const*, WebCore::RenderGeometryMap const*)
7   0x284fc6258 WebCore::RenderLayer::recursiveUpdateLayerPositions(WebCore::RenderGeometryMap*, WTF::OptionSet<WebCore::RenderLayer::UpdateLayerPositionsFlag>)
8   0x284fc6b14 WebCore::RenderLayer::updateLayerPositionsAfterLayout(bool, bool)
9   0x28448af4c WebCore::LocalFrameView::didLayout(WTF::WeakPtr<WebCore::RenderElement, WTF::DefaultWeakPtrImpl>)
10  0x2844a3db4 WebCore::LocalFrameViewLayoutContext::performLayout()
11  0x284482500 WebCore::LocalFrameViewLayoutContext::layout()
12  0x28360fe10 WebCore::Document::updateLayout()
13  0x2836113e0 WebCore::Document::updateLayoutIgnorePendingStylesheets(WebCore::Document::RunPostLayoutTasks)
14  0x283253f8c WebCore::ComputedStyleExtractor::propertyValue(WebCore::CSSPropertyID, WebCore::ComputedStyleExtractor::UpdateLayout, WebCore::ComputedStyleExtractor::PropertyValueType)
15  0x28311606c WebCore::CSSComputedStyleDeclaration::getPropertyCSSValue(WebCore::CSSPropertyID, WebCore::ComputedStyleExtractor::UpdateLayout) const
16  0x283116180 WebCore::CSSComputedStyleDeclaration::getPropertyValue(WebCore::CSSPropertyID) const
17  0x283116ab4 WebCore::CSSComputedStyleDeclaration::getPropertyValueInternal(WebCore::CSSPropertyID)
18  0x28320bbf8 WebCore::CSSStyleDeclaration::propertyValueForCamelCasedIDLAttribute(WTF::AtomString const&)
19  0x2808f114c WebCore::jsCSSStyleDeclaration_propertyValueForCamelCasedIDLAttributeGetter(JSC::JSGlobalObject&, WebCore::JSCSSStyleDeclaration&, JSC::PropertyName)
20  0x280855700 long long WebCore::IDLAttribute<WebCore::JSCSSStyleDeclaration>::getPassingPropertyName<&WebCore::jsCSSStyleDeclaration_propertyValueForCamelCasedIDLAttributeGetter(JSC::JSGlobalObject&, WebCore::JSCSSStyleDeclaration&, JSC::PropertyName), (WebCore::CastedThisErrorBehavior)3>(JSC::JSGlobalObject&, long long, JSC::PropertyName)
21  0x2808555c4 WebCore::jsCSSStyleDeclaration_propertyValueForCamelCasedIDLAttribute(JSC::JSGlobalObject*, long long, JSC::PropertyName)
22  0x139badce8 WTF::FunctionPtr<(WTF::PtrTag)57072, long long (JSC::JSGlobalObject*, long long, JSC::PropertyName), (WTF::FunctionAttributes)1>::operator()(JSC::JSGlobalObject*, long long, JSC::PropertyName) const
23  0x139e07b80 JSC::PropertySlot::customGetter(JSC::VM&, JSC::PropertyName) const
24  0x1392c8804 JSC::PropertySlot::getValue(JSC::JSGlobalObject*, JSC::PropertyName) const
25  0x1392cd0e8 JSC::JSValue::get(JSC::JSGlobalObject*, JSC::PropertyName, JSC::PropertySlot&) const
26  0x139910ab8 JSC::LLInt::performLLIntGetByID(JSC::BytecodeIndex, JSC::CodeBlock*, JSC::JSGlobalObject*, JSC::JSValue, JSC::Identifier const&, JSC::GetByIdModeMetadata&)
27  0x1399108b8 llint_slow_path_get_by_id
28  0x13865c608 llint_entry
29  0x138676660 llint_entry
30  0x138676660 llint_entry
31  0x1386505bc vmEntryToJavaScript
com.apple.WebKit.WebContent.Development terminated (pid 24490) for reason: crash
LEAK: 1 WebPageProxy

And

ASSERTION FAILED: firstChild()
/Volumes/Data/worker/macOS-AppleSilicon-Ventura-Debug-WK2-Tests-EWS/build/Source/WebCore/rendering/RenderVTTCue.cpp(79) : bool WebCore::RenderVTTCue::initializeLayoutParameters(WebCore::LayoutUnit &, WebCore::LayoutUnit &)
1   0x137bfe600 WTFCrash
2   0x283f1da60 WebCore::NetworkResourcesData::ResourceData::hasContent() const
3   0x2850fef40 WebCore::RenderVTTCue::initializeLayoutParameters(WebCore::LayoutUnit&, WebCore::LayoutUnit&)
4   0x2850feaec WebCore::RenderVTTCue::repositionCueSnapToLinesSet()
5   0x2850fea74 WebCore::RenderVTTCue::layout()
6   0x284185300 WebCore::RenderElement::layoutIfNeeded()
7   0x284ead8a8 WebCore::RenderBlock::layoutPositionedObject(WebCore::RenderBox&, bool, bool)
8   0x284eac418 WebCore::RenderBlock::layoutPositionedObjects(bool, bool)
9   0x284eabf9c WebCore::RenderBlock::simplifiedLayout()
10  0x284ec66b4 WebCore::RenderBlockFlow::layoutBlock(bool, WebCore::LayoutUnit)
11  0x284eaa5d4 WebCore::RenderBlock::layout()
12  0x284185300 WebCore::RenderElement::layoutIfNeeded()
13  0x284ead8a8 WebCore::RenderBlock::layoutPositionedObject(WebCore::RenderBox&, bool, bool)
14  0x284eac418 WebCore::RenderBlock::layoutPositionedObjects(bool, bool)
15  0x284ec6d88 WebCore::RenderBlockFlow::layoutBlock(bool, WebCore::LayoutUnit)
16  0x284eaa5d4 WebCore::RenderBlock::layout()
17  0x284fbac1c WebCore::RenderImage::layoutShadowContent(WebCore::LayoutSize const&)
18  0x284fba7fc WebCore::RenderImage::layout()
19  0x28506397c WebCore::RenderMedia::layout()
20  0x2851010c4 WebCore::RenderVideo::layout()
21  0x284185300 WebCore::RenderElement::layoutIfNeeded()
22  0x284ecb7a4 WebCore::RenderBlockFlow::layoutModernLines(bool, WebCore::LayoutUnit&, WebCore::LayoutUnit&)
23  0x284ec919c WebCore::RenderBlockFlow::layoutInlineChildren(bool, WebCore::LayoutUnit&, WebCore::LayoutUnit&)
24  0x284ec76e4 WebCore::RenderBlockFlow::layoutInFlowChildren(bool, WebCore::LayoutUnit&, WebCore::LayoutUnit&, WebCore::LayoutUnit&)
25  0x284ec68dc WebCore::RenderBlockFlow::layoutBlock(bool, WebCore::LayoutUnit)
26  0x284eaa5d4 WebCore::RenderBlock::layout()
27  0x284eca2bc WebCore::RenderBlockFlow::layoutBlockChild(WebCore::RenderBox&, WebCore::RenderBlockFlow::MarginInfo&, WebCore::LayoutUnit&, WebCore::LayoutUnit&)
28  0x284ec94fc WebCore::RenderBlockFlow::layoutBlockChildren(bool, WebCore::LayoutUnit&)
29  0x284ec7720 WebCore::RenderBlockFlow::layoutInFlowChildren(bool, WebCore::LayoutUnit&, WebCore::LayoutUnit&, WebCore::LayoutUnit&)
30  0x284ec68dc WebCore::RenderBlockFlow::layoutBlock(bool, WebCore::LayoutUnit)
31  0x284eaa5d4 WebCore::RenderBlock::layout()
com.apple.WebKit.WebContent.Development terminated (pid 24502) for reason: crash
LEAK: 1 WebPageProxy

I run those locally few times on debug on macOS Ventura/M1 machine and those two tests passed successfully.
Could it be flacky tests? (I know they re-run w/o my changes on the build pipeline, but...) Running out of ideas at the moment.

Thanks

(FYI @Constellation )

@@ -2250,6 +2250,7 @@ namespace JSC {
FunctionMode functionMode() { return m_functionMode; }

int functionNameStart() const { return m_functionNameStart; }
unsigned functionStart() const { return m_functionStart.has_value() ? *m_functionStart : static_cast<unsigned>(m_functionKeywordStart); }
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You can use m_functionStart.value_or(static_cast<unsigned>(m_functionKeywordStart)).

unsigned m_isBuiltinFunction : 1;
unsigned m_unlinkedFunctionNameStart : 31;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's keep it here. Otherwise, it enlarges the size of this struct (31 and 1 is paired).

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah yes, I guess this change would forbid the next field (m_isBuiltinFunction) to be packed (as the previous takes 31 bits). Thanks!

@@ -5499,7 +5518,7 @@ template <class TreeBuilder> TreeExpression Parser<LexerType>::parseMemberExpres
}

template <typename LexerType>
template <class TreeBuilder> TreeExpression Parser<LexerType>::parseArrowFunctionExpression(TreeBuilder& context, bool isAsync)
template <class TreeBuilder> TreeExpression Parser<LexerType>::parseArrowFunctionExpression(TreeBuilder& context, std::optional<unsigned> functionStart)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's have isAsync and functionStart separately. They have different meanings, and it is confusing that making std::nullopt functionStart as non-async.

}
}
if (isArrowFunctionParameters(context)) {
if (wasOpenParen)
currentScope()->revertToPreviousUsedVariables(usedVariablesSize);
return parseArrowFunctionExpression(context, isAsyncArrow);
return parseArrowFunctionExpression(context, isAsync, functionStart);
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Constellation thanks for spotting this, it's fixed now (isAsync is now a separate parameter). The reason is that I initially try/hacked it by looking for async keywords, and in this case the presence/absence of this keyword would (relatively) explicitly tells if it was an async function or not. Obviously it was a totally wrong assumption now as we're looking for "function start" which can be either async, get, set, whatever JS enable to start a function depending the context.

I take this opportunity to point out something a bit odd with my changes: in lot of places in the parser, there are now functionStart (that I added) and functionKeywordStart (already there):

  1. either those two values are conceptually similar (i.e. function foo() {}, etc.) In practice, functionStart might be nullopt. functionKetwordStart is used to fill the node m_functionStart field
  2. either those two values are different (i.e. let x = async function ..., etc.), and functionStart is used to fill the node m_functionStart field.

This is terribly confusing and the reason I didn't removed functionKeywordStart (yet) is because this value is used in the UnlinkedFunctionExecutable m_typeProfilingStartOffset field. I would be tempted to say "we don't need this anymore, let's just use functionStart":

  • that would make parser code simpler/less confusing (as we would remove functionKeywordStart and functionStart wouldn't be an optional)
  • that would also make a small memory footprint win as it would be possible to remove m_typeProfilingStartOffset field

But is this correct from profiling tools perspective? One thing that would lead me to say "that's fine" is the fact there are a bunch of function that doesn't even have the function keyword, but I really have no clues about actual use case of this profiling start offset field, so... Any insight would be much appreciated :-))

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I actually just pushed commit 37b8276 which is an attempt of what I'm discussing just above.

All jsc tests (including stress ones) are passing locally, no new failures on test262, and no obvious jsc related breakage on layout ones, so I'll give a try here.

But my question above remain, not sure if what I'm doing in this commit is totally right (regarding some profiling flow) or not.

Copy link
Member

@Constellation Constellation left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

r=me, nice

@Constellation Constellation removed the merging-blocked Applied to prevent a change from being merged label Jun 17, 2023
@Constellation
Copy link
Member

Please squash all into one commit (with appropriate commit message format), and ping me.
Then I'll put it to merge-queue.

@webkit-ews-buildbot webkit-ews-buildbot added the merging-blocked Applied to prevent a change from being merged label Jun 17, 2023
@colinvidal
Copy link
Contributor Author

Hi @Constellation - I just squashed the history/updated the commit message. (I also added your name as reviewer)

Thanks!

@Constellation Constellation added merge-queue Applied to send a pull request to merge-queue and removed merging-blocked Applied to prevent a change from being merged labels Jun 18, 2023
https://bugs.webkit.org/show_bug.cgi?id=242810

Reviewed by Yusuke Suzuki.

While Blink or Gecko does a string serialization of functions by returning the
strict content of the function expression/declaration from the source code,
WebKit starts with `function `, `function* ` for generators, `async function `
and to on then concatenate the rest of the function declaration/expression from
the source code.

This can create mismatch depending, for instance, the number of spaces between
the `function` keyword and the parameter list. This change makes WebKit to
returns the entire function expression/declaration when serializing a function.

Main code changes are:

- At AST/Parser level, propagating up the start of the expression (or
  declaration) through the `asyncKeywordStart`.
- Adding this start value in the UnlinkedFunctionExecutable class, replacing
  `m_unlinkedFunctionNameStart` to avoid increasing the memory footprint.
- Updating the FunctionExecutable method doing the serialization.
- Adding a dedicated test file for this.
- Numerous unit test updates.
- Bunch of test262 tests are now passing, so removing them from expectation
  file.

* JSTests/ChakraCore/test/Array/array_literal.baseline:
* JSTests/ChakraCore/test/Function/toString.baseline-jsc:
* JSTests/ChakraCore/test/es5/ObjLitGetSet.baseline-jsc:
* JSTests/mozilla/js1_5/Scope/regress-185485.js:
(expect):
* JSTests/stress/function-constructor-name.js:
(async var):
* JSTests/stress/function-to-string.js:
(async shouldBe):
* JSTests/test262/expectations.yaml:
* LayoutTests/fast/canvas/2d.setTransform.matrix-expected.txt:
* LayoutTests/fast/canvas/canvas-pattern-transform-expected.txt:
* LayoutTests/fast/dom/TreeWalker/acceptNode-filter-expected.txt:
* LayoutTests/fast/dom/Window/Location/window-override-location-using-defineGetter-expected.txt:
* LayoutTests/fast/dom/Window/Location/window-override-window-using-defineGetter-expected.txt:
* LayoutTests/fast/dom/getter-on-window-object2-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/FileAPI/blob/Blob-constructor-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/FileAPI/blob/Blob-constructor.any-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/FileAPI/blob/Blob-constructor.any.worker-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/FileAPI/file/File-constructor-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/FileAPI/file/File-constructor.any-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/FileAPI/file/File-constructor.any.worker-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/IndexedDB/structured-clone.any-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/IndexedDB/structured-clone.any.worker_101-last-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/IndexedDB/structured-clone.any_101-last-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/clipboard-apis/async-navigator-clipboard-basics.https-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/cors/origin-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/credential-management/credentialscontainer-create-basics.https-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/css/cssom-view/MediaQueryList-addListener-handleEvent-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/css/cssom-view/idlharness-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/css/cssom/at-namespace-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/css/geometry/DOMMatrix-001-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/domparsing/innerhtml-01-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/feature-policy/reporting/picture-in-picture-reporting-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/feature-policy/reporting/screen-wake-lock-reporting.https-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/fetch/api/abort/general.any-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/fetch/api/abort/general.any.serviceworker-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/fetch/api/abort/general.any.sharedworker-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/fetch/api/abort/general.any.worker-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/fetch/api/abort/serviceworker-intercepted.https-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/fetch/api/basic/request-upload.any-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/fetch/api/basic/request-upload.any.serviceworker-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/fetch/api/basic/request-upload.any.sharedworker-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/fetch/api/basic/request-upload.any.worker-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/fetch/api/basic/request-upload.h2.any-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/fetch/api/basic/request-upload.h2.any.serviceworker-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/fetch/api/basic/request-upload.h2.any.sharedworker-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/fetch/api/basic/request-upload.h2.any.worker-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/fetch/api/redirect/redirect-upload.h2.any-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/fetch/api/redirect/redirect-upload.h2.any.serviceworker-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/fetch/api/redirect/redirect-upload.h2.any.sharedworker-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/fetch/api/redirect/redirect-upload.h2.any.worker-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/fetch/api/request/request-consume-empty-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/fetch/api/request/request-consume-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/fetch/api/request/request-consume.any-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/fetch/api/request/request-consume.any.serviceworker-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/fetch/api/request/request-consume.any.sharedworker-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/fetch/api/request/request-consume.any.worker-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/fetch/api/response/json.any-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/fetch/api/response/json.any.worker-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/fetch/api/response/response-consume-empty-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/fetch/api/response/response-error-from-stream-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/fetch/api/response/response-error-from-stream.any-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/fetch/api/response/response-error-from-stream.any.serviceworker-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/fetch/api/response/response-error-from-stream.any.sharedworker-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/fetch/api/response/response-error-from-stream.any.worker-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/file-system-access/sandboxed_FileSystemDirectoryHandle-move.https.any-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/file-system-access/sandboxed_FileSystemDirectoryHandle-move.https.any.worker-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/fs/FileSystemFileHandle-sync-access-handle-writable-lock.https.tentative.worker-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/fullscreen/api/element-request-fullscreen-namespaces-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/html/browsers/history/the-history-interface/history_properties_only_fully_active-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/html/browsers/history/the-location-interface/location-prototype-setting-cross-origin.sub-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/html/browsers/origin/cross-origin-objects/cross-origin-objects-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/html/browsers/origin/relaxing-the-same-origin-restriction/document_domain_setter-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/html/browsers/the-windowproxy-exotic-object/windowproxy-prototype-setting-cross-origin.sub-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/html/browsers/windows/auxiliary-browsing-contexts/opener-setter.window-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/html/canvas/element/drawing-images-to-the-canvas/2d.drawImage.nonexistent-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/html/canvas/element/fill-and-stroke-styles/2d.pattern.image.nonexistent-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/html/canvas/element/filters/2d.filter.canvasFilterObject.blur.exceptions-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/html/canvas/element/filters/2d.filter.canvasFilterObject.blur.exceptions.tentative-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/html/canvas/element/filters/2d.filter.canvasFilterObject.colorMatrix-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/html/canvas/element/filters/2d.filter.canvasFilterObject.colorMatrix.tentative-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/html/canvas/element/filters/2d.filter.canvasFilterObject.convolveMatrix.exceptions-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/html/canvas/element/filters/2d.filter.canvasFilterObject.convolveMatrix.exceptions.tentative-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/html/canvas/element/filters/2d.filter.canvasFilterObject.turbulence.inputTypes.tentative-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/html/canvas/element/manual/imagebitmap/createImageBitmap-invalid-args-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/html/canvas/element/pixel-manipulation/2d.imageData.object.ctor.basics-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/html/canvas/offscreen/filters/2d.filter.canvasFilterObject.blur.exceptions-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/html/canvas/offscreen/filters/2d.filter.canvasFilterObject.blur.exceptions.tentative-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/html/canvas/offscreen/filters/2d.filter.canvasFilterObject.blur.exceptions.tentative.worker-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/html/canvas/offscreen/filters/2d.filter.canvasFilterObject.colorMatrix-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/html/canvas/offscreen/filters/2d.filter.canvasFilterObject.colorMatrix.tentative-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/html/canvas/offscreen/filters/2d.filter.canvasFilterObject.colorMatrix.tentative.worker-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/html/canvas/offscreen/filters/2d.filter.canvasFilterObject.convolveMatrix.exceptions-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/html/canvas/offscreen/filters/2d.filter.canvasFilterObject.convolveMatrix.exceptions.tentative-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/html/canvas/offscreen/filters/2d.filter.canvasFilterObject.convolveMatrix.exceptions.tentative.worker-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/html/canvas/offscreen/filters/2d.filter.canvasFilterObject.turbulence.inputTypes.tentative-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/html/canvas/offscreen/filters/2d.filter.canvasFilterObject.turbulence.inputTypes.tentative.worker-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/html/dom/idlharness.https_include=HTML._-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/html/semantics/embedded-content/the-canvas-element/imagedata-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/html/semantics/embedded-content/the-canvas-element/security.pattern.fillStyle.sub-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/html/webappapis/scripting/events/event-handler-spec-example-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/html/webappapis/scripting/events/event-handler-spec-example.window-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/media-source/mediasource-sourcebuffer-mode-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/mediacapture-record/MediaRecorder-events-and-exceptions-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/payment-request/payment-is-showing.https-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/payment-request/payment-request-hasenrolledinstrument-method.tentative.https-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/payment-request/show-consume-activation.https-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/screen-orientation/active-lock-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/screen-orientation/nested-documents-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/screen-orientation/unlock-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/service-workers/cache-storage/cache-add.https.any-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/service-workers/cache-storage/cache-add.https.any.serviceworker-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/service-workers/cache-storage/cache-add.https.any.sharedworker-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/service-workers/cache-storage/cache-add.https.any.worker-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/fetch-event.https-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/update.https-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/streams/idlharness.any-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/streams/idlharness.any.serviceworker-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/streams/idlharness.any.sharedworker-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/streams/idlharness.any.worker-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/svg/animations/scripted/SVGAnimationElement-exceptions-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/svg/types/scripted/SVGLength-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/web-share/disabled-by-permissions-policy.https.sub-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/web-share/share-sharePromise-internal-slot.https-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/webrtc/RTCPeerConnection-setLocalDescription-answer-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/webrtc/RTCPeerConnection-setLocalDescription-pranswer-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/websockets/Create-protocols-repeated-case-insensitive.any-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/websockets/Create-protocols-repeated-case-insensitive.any.worker-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/websockets/Create-protocols-repeated-case-insensitive.any.worker_wss-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/websockets/Create-protocols-repeated-case-insensitive.any_wss-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/websockets/interfaces/WebSocket/send/010-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/websockets/interfaces/WebSocket/send/010_wss-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/webstorage/missing_arguments.window-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/webstorage/storage_string_conversion.window-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/webxr/xrDevice_requestSession_requiredFeatures_unknown.https-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/xhr/open-url-multi-window-3-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/xhr/open-url-multi-window-6-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/xhr/send-data-sharedarraybuffer.any-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/xhr/send-data-sharedarraybuffer.any.worker-expected.txt:
* LayoutTests/inspector/audit/non-minified-default-audits.html:
* LayoutTests/inspector/console/command-line-api-copy.html:
* LayoutTests/inspector/console/console-table-expected.txt:
* LayoutTests/inspector/model/remote-object-get-properties-expected.txt:
* LayoutTests/inspector/model/remote-object/class-expected.txt:
* LayoutTests/inspector/model/remote-object/function-expected.txt:
* LayoutTests/inspector/runtime/getDisplayableProperties-expected.txt:
* LayoutTests/inspector/runtime/getProperties-expected.txt:
* LayoutTests/js/const-expected.txt:
* LayoutTests/js/destructuring-assignment-expected.txt:
* LayoutTests/js/dfg-redundant-load-of-captured-variable-proven-constant-expected.txt:
* LayoutTests/js/dfg-resolve-global-specific-dictionary-expected.txt:
* LayoutTests/js/dom/JSON-parse-complex-expected.txt:
* LayoutTests/js/dom/JSON-parse-expected.txt:
* LayoutTests/js/dom/JSON-stringify-expected.txt:
* LayoutTests/js/dom/dfg-strcat-over-objects-then-exit-on-it-expected.txt:
* LayoutTests/js/dom/function-prototype-expected.txt:
* LayoutTests/js/dom/function-prototype.html:
* LayoutTests/js/dom/script-tests/dfg-strcat-over-objects-then-exit-on-it.js:
* LayoutTests/js/dom/toString-and-valueOf-override-expected.txt:
* LayoutTests/js/kde/lval-exceptions-expected.txt:
* LayoutTests/js/object-literal-computed-methods-expected.txt:
* LayoutTests/js/object-literal-methods-expected.txt:
* LayoutTests/js/script-tests/dfg-redundant-load-of-captured-variable-proven-constant.js:
* LayoutTests/js/script-tests/dfg-resolve-global-specific-dictionary.js:
* LayoutTests/js/script-tests/function-toString-vs-name.js:
(runTest):
* LayoutTests/js/script-tests/object-literal-computed-methods.js:
* LayoutTests/js/script-tests/object-literal-methods.js:
* LayoutTests/media/modern-media-controls/button/button-icon-name-expected.txt:
* LayoutTests/platform/glib/http/wpt/push-api/pushManager.any-expected.txt:
* LayoutTests/platform/glib/http/wpt/push-api/pushManager.any.serviceworker-expected.txt:
* LayoutTests/platform/glib/imported/w3c/web-platform-tests/cors/origin-expected.txt:
* LayoutTests/platform/glib/imported/w3c/web-platform-tests/fetch/api/basic/request-upload.any-expected.txt:
* LayoutTests/platform/glib/imported/w3c/web-platform-tests/fetch/api/basic/request-upload.any.serviceworker-expected.txt:
* LayoutTests/platform/glib/imported/w3c/web-platform-tests/fetch/api/basic/request-upload.any.sharedworker-expected.txt:
* LayoutTests/platform/glib/imported/w3c/web-platform-tests/fetch/api/basic/request-upload.any.worker-expected.txt:
* LayoutTests/platform/glib/imported/w3c/web-platform-tests/fetch/content-encoding/bad-gzip-body.any.serviceworker-expected.txt:
* LayoutTests/platform/glib/imported/w3c/web-platform-tests/fetch/content-encoding/bad-gzip-body.any.sharedworker-expected.txt:
* LayoutTests/platform/glib/imported/w3c/web-platform-tests/html/browsers/origin/relaxing-the-same-origin-restriction/document_domain_setter-expected.txt:
* LayoutTests/platform/glib/imported/w3c/web-platform-tests/media-source/mediasource-sourcebuffer-mode-expected.txt:
* LayoutTests/platform/ios-wk2/imported/w3c/web-platform-tests/feature-policy/reporting/picture-in-picture-reporting-expected.txt:
* LayoutTests/platform/ios-wk2/imported/w3c/web-platform-tests/html/dom/idlharness.https_include=HTML._-expected.txt:
* LayoutTests/platform/ios/imported/w3c/web-platform-tests/html/user-activation/idlharness.https_include=HTML._-expected.txt:
* LayoutTests/platform/mac-wk1/imported/w3c/web-platform-tests/html/dom/idlharness.https_include=HTML._-expected.txt:
* LayoutTests/platform/mac-wk1/imported/w3c/web-platform-tests/html/semantics/forms/textfieldselection/selection-not-application-expected.txt:
* LayoutTests/platform/mac-wk1/imported/w3c/web-platform-tests/html/semantics/forms/textfieldselection/selection-not-application_week,month-expected.txt:
* LayoutTests/storage/domstorage/localstorage/string-conversion-expected.txt:
* LayoutTests/storage/domstorage/sessionstorage/string-conversion-expected.txt:
* LayoutTests/streams/reference-implementation/transform-stream-expected.txt:
* LayoutTests/webaudio/convolver-channels-expected.txt:
* Source/JavaScriptCore/API/tests/FunctionOverridesTest.cpp:
(testFunctionOverrides):
* Source/JavaScriptCore/API/tests/FunctionToStringTests.cpp: Added.
(testFunctionToString):
* Source/JavaScriptCore/API/tests/FunctionToStringTests.h: Added.
* Source/JavaScriptCore/API/tests/testapi.c:
(main):
* Source/JavaScriptCore/JavaScriptCore.xcodeproj/project.pbxproj:
* Source/JavaScriptCore/bytecode/CodeBlock.cpp:
(JSC::CodeBlock::sourceCodeForTools const):
(JSC::CodeBlock::dumpSource):
(JSC::CodeBlock::finishCreation):
(JSC::CodeBlock::insertBasicBlockBoundariesForControlFlowProfiler):
* Source/JavaScriptCore/bytecode/CodeBlock.h:
* Source/JavaScriptCore/bytecode/UnlinkedFunctionExecutable.cpp:
(JSC::UnlinkedFunctionExecutable::UnlinkedFunctionExecutable):
(JSC::UnlinkedFunctionExecutable::setInvalidTypeProfilingOffsets): Deleted.
* Source/JavaScriptCore/bytecode/UnlinkedFunctionExecutable.h:
* Source/JavaScriptCore/bytecompiler/BytecodeGenerator.cpp:
(JSC::BytecodeGenerator::emitNewDefaultConstructor):
* Source/JavaScriptCore/parser/ASTBuilder.h:
(JSC::ASTBuilder::createFunctionMetadata):
* Source/JavaScriptCore/parser/Nodes.cpp:
(JSC::FunctionMetadataNode::FunctionMetadataNode):
(JSC::FunctionMetadataNode::operator== const):
(JSC::FunctionMetadataNode::dump const):
* Source/JavaScriptCore/parser/Nodes.h:
* Source/JavaScriptCore/parser/Parser.cpp:
(JSC::Parser<LexerType>::parseGeneratorFunctionSourceElements):
(JSC::Parser<LexerType>::parseAsyncFunctionSourceElements):
(JSC::Parser<LexerType>::parseAsyncGeneratorFunctionSourceElements):
(JSC::Parser<LexerType>::parseSingleFunction):
(JSC::Parser<LexerType>::parseStatementListItem):
(JSC::Parser<LexerType>::parseFunctionBody):
(JSC::Parser<LexerType>::parseFunctionInfo):
(JSC::Parser<LexerType>::parseFunctionDeclaration):
(JSC::Parser<LexerType>::parseAsyncFunctionDeclaration):
(JSC::Parser<LexerType>::parseClass):
(JSC::Parser<LexerType>::parseExportDeclaration):
(JSC::Parser<LexerType>::parseAssignmentExpression):
(JSC::Parser<LexerType>::parseProperty):
(JSC::Parser<LexerType>::parsePropertyMethod):
(JSC::Parser<LexerType>::parseFunctionExpression):
(JSC::Parser<LexerType>::parseAsyncFunctionExpression):
(JSC::Parser<LexerType>::parsePrimaryExpression):
(JSC::Parser<LexerType>::parseArrowFunctionExpression):
* Source/JavaScriptCore/parser/Parser.h:
* Source/JavaScriptCore/runtime/CachedTypes.cpp:
(JSC::CachedFunctionExecutable::unlinkedFunctionStart const):
(JSC::CachedFunctionExecutable::unlinkedFunctionEnd const):
(JSC::CachedFunctionExecutable::encode):
(JSC::UnlinkedFunctionExecutable::UnlinkedFunctionExecutable):
(JSC::CachedFunctionExecutable::unlinkedFunctionNameStart const): Deleted.
(JSC::CachedFunctionExecutable::typeProfilingStartOffset const): Deleted.
(JSC::CachedFunctionExecutable::typeProfilingEndOffset const): Deleted.
* Source/JavaScriptCore/runtime/FunctionExecutable.cpp:
(JSC::FunctionExecutable::ensureRareDataSlow):
(JSC::FunctionExecutable::toStringSlow):
(JSC::FunctionExecutable::overrideInfo):
* Source/JavaScriptCore/runtime/FunctionExecutable.h:
* Source/JavaScriptCore/runtime/JSModuleRecord.cpp:
(JSC::JSModuleRecord::instantiateDeclarations):
* Source/JavaScriptCore/runtime/ModuleProgramExecutable.cpp:
(JSC::ModuleProgramExecutable::ModuleProgramExecutable):
* Source/JavaScriptCore/runtime/ProgramExecutable.cpp:
(JSC::ProgramExecutable::ProgramExecutable):
(JSC::ProgramExecutable::initializeGlobalProperties):
* Source/JavaScriptCore/runtime/ScriptExecutable.cpp:
(JSC::ScriptExecutable::typeProfilingStartOffset const):
(JSC::ScriptExecutable::typeProfilingEndOffset const):
* Source/JavaScriptCore/runtime/ScriptExecutable.h:
* Source/JavaScriptCore/shell/CMakeLists.txt:
* Source/JavaScriptCore/tools/FunctionOverrides.cpp:
(JSC::initializeOverrideInfo):
* Source/JavaScriptCore/tools/FunctionOverrides.h:
* Source/JavaScriptCore/tools/JSDollarVM.cpp:
(JSC::JSC_DEFINE_HOST_FUNCTION):

Canonical link: https://commits.webkit.org/265284@main
@webkit-commit-queue
Copy link
Collaborator

Committed 265284@main (55ae3a1): https://commits.webkit.org/265284@main

Reviewed commits have been landed. Closing PR #14704 and removing active labels.

@webkit-commit-queue webkit-commit-queue merged commit 55ae3a1 into WebKit:main Jun 18, 2023
@webkit-commit-queue webkit-commit-queue removed the merge-queue Applied to send a pull request to merge-queue label Jun 18, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
6 participants