Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: e2c5cd5d4c07dff63d3670741f6e559534eae2cb
      
https://github.com/WebKit/WebKit/commit/e2c5cd5d4c07dff63d3670741f6e559534eae2cb
  Author: Yusuke Suzuki <[email protected]>
  Date:   2024-12-21 (Sat, 21 Dec 2024)

  Changed paths:
    A JSTests/stress/json-parse-source-text-access.js
    A JSTests/stress/json-raw-json-stringify.js
    A JSTests/stress/json-raw-json.js
    M JSTests/test262/config.yaml
    M LayoutTests/js/Object-getOwnPropertyNames-expected.txt
    M LayoutTests/js/script-tests/Object-getOwnPropertyNames.js
    M Source/JavaScriptCore/API/JSValueRef.cpp
    M Source/JavaScriptCore/API/glib/JSCValue.cpp
    M Source/JavaScriptCore/JavaScriptCore.xcodeproj/project.pbxproj
    M 
Source/JavaScriptCore/SaferCPPExpectations/NoUncountedMemberCheckerExpectations
    M 
Source/JavaScriptCore/SaferCPPExpectations/UncountedCallArgsCheckerExpectations
    M Source/JavaScriptCore/Sources.txt
    M Source/JavaScriptCore/heap/Heap.cpp
    M Source/JavaScriptCore/heap/Heap.h
    M Source/JavaScriptCore/interpreter/Interpreter.cpp
    M Source/JavaScriptCore/runtime/CommonIdentifiers.h
    M Source/JavaScriptCore/runtime/JSGlobalObject.cpp
    M Source/JavaScriptCore/runtime/JSGlobalObject.h
    M Source/JavaScriptCore/runtime/JSGlobalObjectFunctions.cpp
    M Source/JavaScriptCore/runtime/JSGlobalObjectInlines.h
    M Source/JavaScriptCore/runtime/JSONObject.cpp
    M Source/JavaScriptCore/runtime/JSONObject.h
    A Source/JavaScriptCore/runtime/JSRawJSONObject.cpp
    A Source/JavaScriptCore/runtime/JSRawJSONObject.h
    M Source/JavaScriptCore/runtime/LiteralParser.cpp
    M Source/JavaScriptCore/runtime/LiteralParser.h
    M Source/JavaScriptCore/runtime/OptionsList.h
    M Source/JavaScriptCore/runtime/SmallStrings.h

  Log Message:
  -----------
  [JSC] Implement JSON.parse source text access proposal
https://bugs.webkit.org/show_bug.cgi?id=248031
rdar://131579181

Reviewed by Yijia Huang.

This patch implements JSON.parse source text access proposal[1], which is now 
stage-3.
This patch implements two major things in the proposal.
The most important part of this patch is not regressing the existing
extremely optimized JSON implementation for the fast path. Thus this
patch adds template parameter to LiteralParser and disable all the
slight changes when we are using the fast path.

1. JSON.rawJSON mechaism. Now new object type is integrated, and JSON.rawJSON 
can wrap JSON text
   with this object, which is a tool to inject raw JSON text into 
JSON.stringify. JSON.stringify
   uses held string from rawJSON-created object.
2. JSON.parse collects source information during parsing, and offer substring 
of text as a third parameter
   of JSON.parse reviver function.

[1]: https://github.com/tc39/proposal-json-parse-with-source

* JSTests/stress/json-parse-source-text-access.js: Added.
(shouldBe):
* JSTests/stress/json-raw-json-stringify.js: Added.
(shouldBe):
(shouldBe.JSON.stringify):
* JSTests/stress/json-raw-json.js: Added.
(shouldBe):
(shouldThrow):
(SyntaxError.JSON.Parse.error.Single.quotes.shouldThrow):
* Source/JavaScriptCore/JavaScriptCore.xcodeproj/project.pbxproj:
* Source/JavaScriptCore/Sources.txt:
* Source/JavaScriptCore/heap/Heap.cpp:
* Source/JavaScriptCore/heap/Heap.h:
* Source/JavaScriptCore/runtime/CommonIdentifiers.h:
* Source/JavaScriptCore/runtime/JSGlobalObject.cpp:
(JSC::createJSONProperty):
(JSC::JSGlobalObject::init):
* Source/JavaScriptCore/runtime/JSGlobalObject.h:
(JSC::JSGlobalObject::rawJSONObjectStructure const):
* Source/JavaScriptCore/runtime/JSONObject.cpp:
(JSC::JSONObject::finishCreation):
(JSC::Stringifier::appendStringifiedValue):
(JSC::Walker::Walker):
(JSC::Walker::callReviver):
(JSC::Walker::walk):
(JSC::JSC_DEFINE_HOST_FUNCTION):
* Source/JavaScriptCore/runtime/JSONObject.h:
* Source/JavaScriptCore/runtime/JSRawJSONObject.cpp: Added.
(JSC::JSRawJSONObject::JSRawJSONObject):
(JSC::JSRawJSONObject::finishCreation):
(JSC::JSRawJSONObject::createStructure):
(JSC::JSRawJSONObject::rawJSON):
* Source/JavaScriptCore/runtime/JSRawJSONObject.h: Copied from 
Source/JavaScriptCore/runtime/JSONObject.h.
* Source/JavaScriptCore/runtime/LiteralParser.cpp:
(JSC::LiteralParser<CharType>::tryJSONPParse):
(JSC::LiteralParser<CharType>::parse):
* Source/JavaScriptCore/runtime/LiteralParser.h:
(JSC::JSONRanges::JSONRanges):
(JSC::JSONRanges::root const):
(JSC::LiteralParser::tryLiteralParse):
(JSC::LiteralParser::tryLiteralParsePrimitiveValue):
(JSC::LiteralParser::Lexer::Lexer):
(JSC::LiteralParser::Lexer::start const):
* Source/JavaScriptCore/runtime/OptionsList.h:

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



To unsubscribe from these emails, change your notification settings at 
https://github.com/WebKit/WebKit/settings/notifications
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to