Changeset 165521 in webkit


Ignore:
Timestamp:
Mar 12, 2014 5:41:58 PM (10 years ago)
Author:
BJ Burg
Message:

Web Replay: add infrastructure for memoizing nondeterministic DOM APIs
https://bugs.webkit.org/show_bug.cgi?id=129445

Reviewed by Timothy Hatcher.

Source/JavaScriptCore:

There was a bug in the replay inputs code generator that would include
headers for definitions of enum classes, even though they can be safely
forward-declared.

  • replay/scripts/CodeGeneratorReplayInputs.py:

(Generator.generate_includes): Only include for copy constructor if the
type is a heavy scalar (i.e., String, URL), not a normal scalar
(i.e., int, double, enum classes).

(Generator.generate_type_forward_declarations): Forward-declare scalars
that are enums or enum classes.

Source/WebCore:

Add two pieces of infrastructure to support memoization of selected DOM APIs.

The first piece is MemoizedDOMResult, a templated replay input class that knows
how to serialize a DOM API's return value, ctype, and exception code.

The second piece is the addition of a new IDL attribute called Nondeterministic.
When placed on a DOM function or attribute, the code generator will emit code
to save the DOM API's return value or use a memoized return value instead,
depending on the current replay state. This new emitted code path is behind
a feature flag.

No new tests, as no new inputs are addressed by this change. Per-DOM API replay
regression tests will be added when those APIs are marked as nondeterministic.

  • WebCore.xcodeproj/project.pbxproj:
  • bindings/scripts/CodeGeneratorJS.pm: Add support of the Nondeterministic attribute.

(GenerateImplementation): Handle cases for attributes and getters with exceptions.
(GenerateImplementationFunctionCall): Handle function calls with and without exceptions.
(GetNativeTypeForMemoization): Added. Converts DOMString to WTF::String.

  • bindings/scripts/IDLAttributes.txt: Add new Nondeterministic attribute.
  • bindings/scripts/test/JS/JSTestEventTarget.cpp:

(WebCore::jsTestEventTargetPrototypeFunctionItem):
(WebCore::jsTestEventTargetPrototypeFunctionDispatchEvent):

  • bindings/scripts/test/JS/JSTestInterface.cpp:

(WebCore::jsTestInterfacePrototypeFunctionImplementsMethod2):
(WebCore::jsTestInterfacePrototypeFunctionSupplementalMethod2):

  • bindings/scripts/test/JS/JSTestObj.cpp:

(WebCore::jsTestObjAttrWithGetterException):
(WebCore::jsTestObjStringAttrWithGetterException):
(WebCore::jsTestObjWithScriptStateAttributeRaises):
(WebCore::jsTestObjWithScriptExecutionContextAttributeRaises):
(WebCore::jsTestObjWithScriptExecutionContextAndScriptStateAttributeRaises):
(WebCore::jsTestObjNullableStringValue):
(WebCore::jsTestObjPrototypeFunctionByteMethod):
(WebCore::jsTestObjPrototypeFunctionByteMethodWithArgs):
(WebCore::jsTestObjPrototypeFunctionOctetMethod):
(WebCore::jsTestObjPrototypeFunctionOctetMethodWithArgs):
(WebCore::jsTestObjPrototypeFunctionLongMethod):
(WebCore::jsTestObjPrototypeFunctionLongMethodWithArgs):
(WebCore::jsTestObjPrototypeFunctionObjMethod):
(WebCore::jsTestObjPrototypeFunctionObjMethodWithArgs):
(WebCore::jsTestObjPrototypeFunctionMethodReturningSequence):
(WebCore::jsTestObjPrototypeFunctionMethodThatRequiresAllArgsAndThrows):
(WebCore::jsTestObjPrototypeFunctionWithScriptStateObj):
(WebCore::jsTestObjPrototypeFunctionWithScriptStateObjException):
(WebCore::jsTestObjPrototypeFunctionWithScriptExecutionContextAndScriptStateObjException):
(WebCore::jsTestObjPrototypeFunctionWithScriptExecutionContextAndScriptStateWithSpaces):
(WebCore::jsTestObjPrototypeFunctionConditionalMethod1):
(WebCore::jsTestObjConstructorFunctionClassMethodWithOptional):
(WebCore::jsTestObjPrototypeFunctionStringArrayFunction):
(WebCore::jsTestObjPrototypeFunctionDomStringListFunction):
(WebCore::jsTestObjPrototypeFunctionGetSVGDocument):
(WebCore::jsTestObjPrototypeFunctionMutablePointFunction):
(WebCore::jsTestObjPrototypeFunctionImmutablePointFunction):
(WebCore::jsTestObjPrototypeFunctionStrictFunction):
(WebCore::jsTestObjPrototypeFunctionStrictFunctionWithSequence):
(WebCore::jsTestObjPrototypeFunctionStrictFunctionWithArray):

  • bindings/scripts/test/JS/JSTestTypedefs.cpp:

(WebCore::jsTestTypedefsAttrWithGetterException):
(WebCore::jsTestTypedefsStringAttrWithGetterException):
(WebCore::jsTestTypedefsPrototypeFunctionMethodWithSequenceArg):
(WebCore::jsTestTypedefsPrototypeFunctionImmutablePointFunction):
(WebCore::jsTestTypedefsPrototypeFunctionStringArrayFunction):
(WebCore::jsTestTypedefsPrototypeFunctionStringArrayFunction2):
(WebCore::jsTestTypedefsPrototypeFunctionCallWithSequenceThatRequiresInclude):

  • replay/AllReplayInputs.h:
  • replay/MemoizedDOMResult.cpp: Added.

(WebCore::MemoizedDOMResultBase::type):
(WebCore::MemoizedDOMResultBase::createFromEncodedResult):
(InputTraits<MemoizedDOMResultBase>::type):
(InputTraits<MemoizedDOMResultBase>::encode):
(InputTraits<MemoizedDOMResultBase>::decode):

  • replay/MemoizedDOMResult.h: Added. Every specialization of MemoizedDOMResult<T>

stores a binding name, ctype, result value of type T, and optional exception code.
The ctype-specific code uses the CTypeTraits struct to abstract over enum names and
compiler types. The actual encode/decode methods just use methods from EncodingTraits<T>.

(WebCore::MemoizedDOMResultBase::MemoizedDOMResultBase):
(WebCore::MemoizedDOMResultBase::~MemoizedDOMResultBase):
(WebCore::MemoizedDOMResultBase::attribute):
(WebCore::MemoizedDOMResultBase::ctype):
(WebCore::MemoizedDOMResultBase::exceptionCode):
(WebCore::CTypeTraits::decode):
(WebCore::MemoizedDOMResultBase::convertTo):
(JSC::InputTraits<MemoizedDOMResultBase>::queue):

  • replay/ReplayInputTypes.cpp: See below.

(WebCore::ReplayInputTypes::ReplayInputTypes):

  • replay/ReplayInputTypes.h: See below.
  • replay/SerializationMethods.cpp: We need to special-case the encoding

and decoding of MemoizedDOMResult inputs because the input is not part of
the generated per-framework replay inputs enum.
(JSC::EncodingTraits<NondeterministicInputBase>::encodeValue):
(JSC::EncodingTraits<NondeterministicInputBase>::decodeValue):

  • replay/WebInputs.json: Add the EncodedCType enum as an external enum type,

so that we can use a generated EncodingTraits specialization to encode the enum.

Location:
trunk/Source
Files:
2 added
15 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/JavaScriptCore/ChangeLog

    r165509 r165521  
     12014-03-12  Brian Burg  <bburg@apple.com>
     2
     3        Web Replay: add infrastructure for memoizing nondeterministic DOM APIs
     4        https://bugs.webkit.org/show_bug.cgi?id=129445
     5
     6        Reviewed by Timothy Hatcher.
     7
     8        There was a bug in the replay inputs code generator that would include
     9        headers for definitions of enum classes, even though they can be safely
     10        forward-declared.
     11
     12        * replay/scripts/CodeGeneratorReplayInputs.py:
     13        (Generator.generate_includes): Only include for copy constructor if the
     14        type is a heavy scalar (i.e., String, URL), not a normal scalar
     15        (i.e., int, double, enum classes).
     16
     17        (Generator.generate_type_forward_declarations): Forward-declare scalars
     18        that are enums or enum classes.
     19
    1202014-03-12  Joseph Pecoraro  <pecoraro@apple.com>
    221
  • trunk/Source/JavaScriptCore/replay/scripts/CodeGeneratorReplayInputs.py

    r164986 r165521  
    631631            include_for_enclosing_class = _type.is_enum() and _type.enclosing_class is not None
    632632            # Include headers for types like URL and String which are copied, not owned or shared.
    633             include_for_copyable_member = _type.mode is TypeModes.HEAVY_SCALAR or _type.mode is TypeModes.SCALAR
     633            include_for_copyable_member = _type.mode is TypeModes.HEAVY_SCALAR
    634634            if (not includes_for_types) ^ (include_for_destructor or include_for_enclosing_class or include_for_copyable_member):
    635635                continue
     
    666666            if _type.enclosing_class is not None:
    667667                continue
    668             if _type.mode == TypeModes.SCALAR or _type.mode == TypeModes.HEAVY_SCALAR:
     668            if _type.mode == TypeModes.HEAVY_SCALAR:
     669                continue
     670            if _type.mode == TypeModes.SCALAR and not (_type.is_enum() or _type.is_enum_class()):
    669671                continue
    670672            if _type.is_enum():
  • trunk/Source/WebCore/ChangeLog

    r165520 r165521  
     12014-03-12  Brian Burg  <bburg@apple.com>
     2
     3        Web Replay: add infrastructure for memoizing nondeterministic DOM APIs
     4        https://bugs.webkit.org/show_bug.cgi?id=129445
     5
     6        Reviewed by Timothy Hatcher.
     7
     8        Add two pieces of infrastructure to support memoization of selected DOM APIs.
     9
     10        The first piece is MemoizedDOMResult, a templated replay input class that knows
     11        how to serialize a DOM API's return value, ctype, and exception code.
     12
     13        The second piece is the addition of a new IDL attribute called `Nondeterministic`.
     14        When placed on a DOM function or attribute, the code generator will emit code
     15        to save the DOM API's return value or use a memoized return value instead,
     16        depending on the current replay state. This new emitted code path is behind
     17        a feature flag.
     18
     19        No new tests, as no new inputs are addressed by this change. Per-DOM API replay
     20        regression tests will be added when those APIs are marked as nondeterministic.
     21
     22        * WebCore.xcodeproj/project.pbxproj:
     23        * bindings/scripts/CodeGeneratorJS.pm: Add support of the `Nondeterministic` attribute.
     24        (GenerateImplementation): Handle cases for attributes and getters with exceptions.
     25        (GenerateImplementationFunctionCall): Handle function calls with and without exceptions.
     26        (GetNativeTypeForMemoization): Added. Converts DOMString to WTF::String.
     27        * bindings/scripts/IDLAttributes.txt: Add new `Nondeterministic` attribute.
     28        * bindings/scripts/test/JS/JSTestEventTarget.cpp:
     29        (WebCore::jsTestEventTargetPrototypeFunctionItem):
     30        (WebCore::jsTestEventTargetPrototypeFunctionDispatchEvent):
     31        * bindings/scripts/test/JS/JSTestInterface.cpp:
     32        (WebCore::jsTestInterfacePrototypeFunctionImplementsMethod2):
     33        (WebCore::jsTestInterfacePrototypeFunctionSupplementalMethod2):
     34        * bindings/scripts/test/JS/JSTestObj.cpp:
     35        (WebCore::jsTestObjAttrWithGetterException):
     36        (WebCore::jsTestObjStringAttrWithGetterException):
     37        (WebCore::jsTestObjWithScriptStateAttributeRaises):
     38        (WebCore::jsTestObjWithScriptExecutionContextAttributeRaises):
     39        (WebCore::jsTestObjWithScriptExecutionContextAndScriptStateAttributeRaises):
     40        (WebCore::jsTestObjNullableStringValue):
     41        (WebCore::jsTestObjPrototypeFunctionByteMethod):
     42        (WebCore::jsTestObjPrototypeFunctionByteMethodWithArgs):
     43        (WebCore::jsTestObjPrototypeFunctionOctetMethod):
     44        (WebCore::jsTestObjPrototypeFunctionOctetMethodWithArgs):
     45        (WebCore::jsTestObjPrototypeFunctionLongMethod):
     46        (WebCore::jsTestObjPrototypeFunctionLongMethodWithArgs):
     47        (WebCore::jsTestObjPrototypeFunctionObjMethod):
     48        (WebCore::jsTestObjPrototypeFunctionObjMethodWithArgs):
     49        (WebCore::jsTestObjPrototypeFunctionMethodReturningSequence):
     50        (WebCore::jsTestObjPrototypeFunctionMethodThatRequiresAllArgsAndThrows):
     51        (WebCore::jsTestObjPrototypeFunctionWithScriptStateObj):
     52        (WebCore::jsTestObjPrototypeFunctionWithScriptStateObjException):
     53        (WebCore::jsTestObjPrototypeFunctionWithScriptExecutionContextAndScriptStateObjException):
     54        (WebCore::jsTestObjPrototypeFunctionWithScriptExecutionContextAndScriptStateWithSpaces):
     55        (WebCore::jsTestObjPrototypeFunctionConditionalMethod1):
     56        (WebCore::jsTestObjConstructorFunctionClassMethodWithOptional):
     57        (WebCore::jsTestObjPrototypeFunctionStringArrayFunction):
     58        (WebCore::jsTestObjPrototypeFunctionDomStringListFunction):
     59        (WebCore::jsTestObjPrototypeFunctionGetSVGDocument):
     60        (WebCore::jsTestObjPrototypeFunctionMutablePointFunction):
     61        (WebCore::jsTestObjPrototypeFunctionImmutablePointFunction):
     62        (WebCore::jsTestObjPrototypeFunctionStrictFunction):
     63        (WebCore::jsTestObjPrototypeFunctionStrictFunctionWithSequence):
     64        (WebCore::jsTestObjPrototypeFunctionStrictFunctionWithArray):
     65        * bindings/scripts/test/JS/JSTestTypedefs.cpp:
     66        (WebCore::jsTestTypedefsAttrWithGetterException):
     67        (WebCore::jsTestTypedefsStringAttrWithGetterException):
     68        (WebCore::jsTestTypedefsPrototypeFunctionMethodWithSequenceArg):
     69        (WebCore::jsTestTypedefsPrototypeFunctionImmutablePointFunction):
     70        (WebCore::jsTestTypedefsPrototypeFunctionStringArrayFunction):
     71        (WebCore::jsTestTypedefsPrototypeFunctionStringArrayFunction2):
     72        (WebCore::jsTestTypedefsPrototypeFunctionCallWithSequenceThatRequiresInclude):
     73
     74        * replay/AllReplayInputs.h:
     75        * replay/MemoizedDOMResult.cpp: Added.
     76        (WebCore::MemoizedDOMResultBase::type):
     77        (WebCore::MemoizedDOMResultBase::createFromEncodedResult):
     78        (InputTraits<MemoizedDOMResultBase>::type):
     79        (InputTraits<MemoizedDOMResultBase>::encode):
     80        (InputTraits<MemoizedDOMResultBase>::decode):
     81
     82        * replay/MemoizedDOMResult.h: Added. Every specialization of MemoizedDOMResult<T>
     83        stores a binding name, ctype, result value of type T, and optional exception code.
     84        The ctype-specific code uses the CTypeTraits struct to abstract over enum names and
     85        compiler types. The actual encode/decode methods just use methods from EncodingTraits<T>.
     86
     87        (WebCore::MemoizedDOMResultBase::MemoizedDOMResultBase):
     88        (WebCore::MemoizedDOMResultBase::~MemoizedDOMResultBase):
     89        (WebCore::MemoizedDOMResultBase::attribute):
     90        (WebCore::MemoizedDOMResultBase::ctype):
     91        (WebCore::MemoizedDOMResultBase::exceptionCode):
     92        (WebCore::CTypeTraits::decode):
     93        (WebCore::MemoizedDOMResultBase::convertTo):
     94        (JSC::InputTraits<MemoizedDOMResultBase>::queue):
     95        * replay/ReplayInputTypes.cpp: See below.
     96        (WebCore::ReplayInputTypes::ReplayInputTypes):
     97        * replay/ReplayInputTypes.h: See below.
     98        * replay/SerializationMethods.cpp: We need to special-case the encoding
     99        and decoding of MemoizedDOMResult inputs because the input is not part of
     100        the generated per-framework replay inputs enum.
     101        (JSC::EncodingTraits<NondeterministicInputBase>::encodeValue):
     102        (JSC::EncodingTraits<NondeterministicInputBase>::decodeValue):
     103
     104        * replay/WebInputs.json: Add the EncodedCType enum as an external enum type,
     105        so that we can use a generated EncodingTraits specialization to encode the enum.
     106
    11072014-03-11  Jae Hyun Park  <jaepark@webkit.org>
    2108
  • trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj

    r165479 r165521  
    35113511                9920398218B95BC600B39AF9 /* UserInputBridge.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 9920398018B95BC600B39AF9 /* UserInputBridge.cpp */; };
    35123512                9920398318B95BC600B39AF9 /* UserInputBridge.h in Headers */ = {isa = PBXBuildFile; fileRef = 9920398118B95BC600B39AF9 /* UserInputBridge.h */; settings = {ATTRIBUTES = (Private, ); }; };
     3513                99C7CCB318C663E40032E413 /* MemoizedDOMResult.h in Headers */ = {isa = PBXBuildFile; fileRef = 99C7CCB218C663E40032E413 /* MemoizedDOMResult.h */; };
     3514                99C7CCB518C6B8990032E413 /* MemoizedDOMResult.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 99C7CCB418C6B8990032E413 /* MemoizedDOMResult.cpp */; };
    35133515                99CC0B4D18BE9849006CEBCC /* AllReplayInputs.h in Headers */ = {isa = PBXBuildFile; fileRef = 99CC0B3818BE9849006CEBCC /* AllReplayInputs.h */; };
    35143516                99CC0B4E18BE9849006CEBCC /* CapturingInputCursor.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 99CC0B3918BE9849006CEBCC /* CapturingInputCursor.cpp */; };
     
    1051310515                9920398018B95BC600B39AF9 /* UserInputBridge.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = UserInputBridge.cpp; sourceTree = "<group>"; };
    1051410516                9920398118B95BC600B39AF9 /* UserInputBridge.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = UserInputBridge.h; sourceTree = "<group>"; };
     10517                99C7CCB218C663E40032E413 /* MemoizedDOMResult.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MemoizedDOMResult.h; sourceTree = "<group>"; };
     10518                99C7CCB418C6B8990032E413 /* MemoizedDOMResult.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = MemoizedDOMResult.cpp; sourceTree = "<group>"; };
    1051510519                99CC0B3818BE9849006CEBCC /* AllReplayInputs.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AllReplayInputs.h; sourceTree = "<group>"; };
    1051610520                99CC0B3918BE9849006CEBCC /* CapturingInputCursor.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = CapturingInputCursor.cpp; sourceTree = "<group>"; };
     
    1793617940                                99CC0B3C18BE9849006CEBCC /* EventLoopInputDispatcher.h */,
    1793717941                                99CC0B3D18BE9849006CEBCC /* FunctorInputCursor.h */,
     17942                                99C7CCB418C6B8990032E413 /* MemoizedDOMResult.cpp */,
     17943                                99C7CCB218C663E40032E413 /* MemoizedDOMResult.h */,
    1793817944                                99CC0B3E18BE9849006CEBCC /* ReplayController.cpp */,
    1793917945                                99CC0B3F18BE9849006CEBCC /* ReplayController.h */,
     
    2384723853                                977B386D122883E900B81FF8 /* HTMLEntityTable.h in Headers */,
    2384823854                                A81369D4097374F600D74463 /* HTMLFieldSetElement.h in Headers */,
     23855                                99C7CCB318C663E40032E413 /* MemoizedDOMResult.h in Headers */,
    2384923856                                A8CFF7A60A156978000A4234 /* HTMLFontElement.h in Headers */,
    2385023857                                977B386F122883E900B81FF8 /* HTMLFormattingElementList.h in Headers */,
     
    2890628913                                B2A1F2AA0CEF0ABF00442F6A /* SVGFontElement.cpp in Sources */,
    2890728914                                B2227A140D00BF220071B782 /* SVGFontFaceElement.cpp in Sources */,
     28915                                99C7CCB518C6B8990032E413 /* MemoizedDOMResult.cpp in Sources */,
    2890828916                                B2227A170D00BF220071B782 /* SVGFontFaceFormatElement.cpp in Sources */,
    2890928917                                B2227A1A0D00BF220071B782 /* SVGFontFaceNameElement.cpp in Sources */,
  • trunk/Source/WebCore/bindings/scripts/CodeGeneratorJS.pm

    r165497 r165521  
    44# Copyright (C) 2006, 2007 Samuel Weinig <sam@webkit.org>
    55# Copyright (C) 2006 Alexey Proskuryakov <ap@webkit.org>
    6 # Copyright (C) 2006, 2007, 2008, 2009, 2010, 2013 Apple Inc. All rights reserved.
     6# Copyright (C) 2006, 2007, 2008, 2009, 2010, 2013, 2014 Apple Inc. All rights reserved.
    77# Copyright (C) 2009 Cameron McCormack <cam@mcc.id.au>
    88# Copyright (C) Research In Motion Limited 2010. All rights reserved.
     
    21192119            my $getFunctionName = GetAttributeGetterName($interfaceName, $className, $attribute);
    21202120            my $implGetterFunctionName = $codeGenerator->WK_lcfirst($attribute->signature->extendedAttributes->{"ImplementedAs"} || $name);
     2121            my $getterExceptions = $attribute->signature->extendedAttributes->{"GetterRaisesException"};
    21212122
    21222123            my $attributeConditionalString = $codeGenerator->GenerateConditionalString($attribute->signature);
     
    21522153            }
    21532154
     2155            my @arguments = ();
     2156            if ($getterExceptions && !HasCustomGetter($attribute->signature->extendedAttributes)) {
     2157                push(@arguments, "ec");
     2158                push(@implContent, "    ExceptionCode ec = 0;\n");
     2159            }
     2160
    21542161            # Global constructors can be disabled at runtime.
    21552162            if ($attribute->signature->type =~ /Constructor$/) {
     
    21812188                push(@implContent, "        return JSValue::encode(jsUndefined());\n");
    21822189            }
     2190
     2191            if ($attribute->signature->extendedAttributes->{"Nondeterministic"}) {
     2192                $implIncludes{"<replay/InputCursor.h>"} = 1;
     2193                push(@implContent, "#if ENABLE(WEB_REPLAY)\n");
     2194                push(@implContent, "    JSGlobalObject* globalObject = exec->lexicalGlobalObject();\n");
     2195                push(@implContent, "    InputCursor& cursor = globalObject->inputCursor();\n");
     2196
     2197                $implIncludes{"MemoizedDOMResult.h"} = 1;
     2198                my $nativeType = GetNativeType($type);
     2199                my $memoizedType = GetNativeTypeForMemoization($type);
     2200                my $exceptionCode = $getterExceptions ? "ec" : "0";
     2201                push(@implContent, "    DEFINE_STATIC_LOCAL(const AtomicString, bindingName, (\"$interfaceName.$name\", AtomicString::ConstructFromLiteral));\n");
     2202                push(@implContent, "    if (cursor.isCapturing()) {\n");
     2203                push(@implContent, "        $memoizedType memoizedResult = castedThis->impl().$implGetterFunctionName(" . join(", ", @arguments) . ");\n");
     2204                push(@implContent, "        cursor.appendInput<MemoizedDOMResult<$memoizedType>>(bindingName, memoizedResult, $exceptionCode);\n");
     2205                push(@implContent, "        JSValue result = " . NativeToJSValue($attribute->signature, 0, $interfaceName, "memoizedResult", "castedThis") . ";\n");
     2206                push(@implContent, "        setDOMException(exec, ec);\n") if $getterExceptions;
     2207                push(@implContent, "        return JSValue::encode(result);\n");
     2208                push(@implContent, "     }\n");
     2209                push(@implContent, "\n");
     2210                push(@implContent, "     if (cursor.isReplaying()) {\n");
     2211                push(@implContent, "        $memoizedType memoizedResult;\n");
     2212                push(@implContent, "        MemoizedDOMResultBase* input = cursor.fetchInput<MemoizedDOMResultBase>();\n");
     2213                push(@implContent, "        if (input && input->convertTo<$memoizedType>(memoizedResult)) {\n");
     2214                # FIXME: the generated code should report an error if an input cannot be fetched or converted.
     2215                push(@implContent, "            JSValue result = " . NativeToJSValue($attribute->signature, 0, $interfaceName, "memoizedResult", "castedThis") . ";\n");
     2216                push(@implContent, "            setDOMException(exec, input->exceptionCode());\n") if $getterExceptions;
     2217                push(@implContent, "            return JSValue::encode(result);\n");
     2218                push(@implContent, "        }\n");
     2219                push(@implContent, "    }\n");
     2220                push(@implContent, "#endif\n");
     2221            } # attribute Nondeterministic
    21832222
    21842223            if (HasCustomGetter($attribute->signature->extendedAttributes)) {
     
    22742313
    22752314            } else {
    2276                 my @arguments = ("ec");
    2277                 push(@implContent, "    ExceptionCode ec = 0;\n");
    2278 
    22792315                if ($isNullable) {
    22802316                    push(@implContent, "    bool isNull = false;\n");
     
    22862322                if ($svgPropertyOrListPropertyType) {
    22872323                    push(@implContent, "    $svgPropertyOrListPropertyType impl(*castedThis->impl());\n");
    2288                     push(@implContent, "    JSC::JSValue result = " . NativeToJSValue($attribute->signature, 0, $interfaceName, "impl.$implGetterFunctionName(" . join(", ", @arguments) . ")", "castedThis") . ";\n");
     2324                    push(@implContent, "    JSValue result = " . NativeToJSValue($attribute->signature, 0, $interfaceName, "impl.$implGetterFunctionName(" . join(", ", @arguments) . ")", "castedThis") . ";\n");
    22892325                } else {
    22902326                    push(@implContent, "    $interfaceName& impl = castedThis->impl();\n");
    2291                     push(@implContent, "    JSC::JSValue result = " . NativeToJSValue($attribute->signature, 0, $interfaceName, "impl.$implGetterFunctionName(" . join(", ", @arguments) . ")", "castedThis") . ";\n");
     2327                    push(@implContent, "    JSValue result = " . NativeToJSValue($attribute->signature, 0, $interfaceName, "impl.$implGetterFunctionName(" . join(", ", @arguments) . ")", "castedThis") . ";\n");
    22922328                }
    22932329
     
    35023538    my $interfaceName = shift;
    35033539
     3540    my $nondeterministic = $function->signature->extendedAttributes->{"Nondeterministic"};
    35043541    my $raisesException = $function->signature->extendedAttributes->{"RaisesException"};
    35053542
    35063543    if ($function->signature->type eq "void") {
    3507         push(@implContent, $indent . "$functionString;\n");
    3508         push(@implContent, $indent . "setDOMException(exec, ec);\n") if $raisesException;
     3544        if ($nondeterministic) {
     3545            $implIncludes{"<replay/InputCursor.h>"} = 1;
     3546            push(@implContent, "#if ENABLE(WEB_REPLAY)\n");
     3547            push(@implContent, $indent . "InputCursor& cursor = exec->lexicalGlobalObject()->inputCursor();\n");
     3548            push(@implContent, $indent . "if (!cursor.isReplaying()) {\n");
     3549            push(@implContent, $indent . "    $functionString;\n");
     3550            push(@implContent, $indent . "    setDOMException(exec, ec);\n") if $raisesException;
     3551            push(@implContent, $indent . "}\n");
     3552            push(@implContent, "#else\n");
     3553            push(@implContent, $indent . "$functionString;\n");
     3554            push(@implContent, $indent . "setDOMException(exec, ec);\n") if $raisesException;
     3555            push(@implContent, "#endif\n");
     3556        } else {
     3557            push(@implContent, $indent . "$functionString;\n");
     3558            push(@implContent, $indent . "setDOMException(exec, ec);\n") if $raisesException;
     3559        }
    35093560
    35103561        if ($svgPropertyType and !$function->isStatic) {
     
    35203571    } else {
    35213572        my $thisObject = $function->isStatic ? 0 : "castedThis";
    3522         push(@implContent, "\n" . $indent . "JSC::JSValue result = " . NativeToJSValue($function->signature, 1, $interfaceName, $functionString, $thisObject) . ";\n");
    3523         push(@implContent, $indent . "setDOMException(exec, ec);\n") if $raisesException;
     3573        if ($nondeterministic) {
     3574            $implIncludes{"MemoizedDOMResult.h"} = 1;
     3575            $implIncludes{"<replay/InputCursor.h>"} = 1;
     3576            my $nativeType = GetNativeTypeFromSignature($function->signature);
     3577            my $memoizedType = GetNativeTypeForMemoization($function->signature->type);
     3578            my $bindingName = $interfaceName . "." . $function->signature->name;
     3579            push(@implContent, $indent . "JSValue result;\n");
     3580            push(@implContent, "#if ENABLE(WEB_REPLAY)\n");
     3581            push(@implContent, $indent . "InputCursor& cursor = exec->lexicalGlobalObject()->inputCursor();\n");
     3582            push(@implContent, $indent . "DEFINE_STATIC_LOCAL(const AtomicString, bindingName, (\"$bindingName\", AtomicString::ConstructFromLiteral));\n");
     3583            push(@implContent, $indent . "if (cursor.isCapturing()) {\n");
     3584            push(@implContent, $indent . "    $nativeType memoizedResult = $functionString;\n");
     3585            my $exceptionCode = $raisesException ? "ec" : "0";
     3586            push(@implContent, $indent . "    cursor.appendInput<MemoizedDOMResult<$memoizedType>>(bindingName, memoizedResult, $exceptionCode);\n");
     3587            push(@implContent, $indent . "    result = " . NativeToJSValue($function->signature, 1, $interfaceName, "memoizedResult", $thisObject) . ";\n");
     3588            push(@implContent, $indent . "} else if (cursor.isReplaying()) {\n");
     3589            push(@implContent, $indent . "    MemoizedDOMResultBase* input = cursor.fetchInput<MemoizedDOMResultBase>();\n");
     3590            push(@implContent, $indent . "    $memoizedType memoizedResult;\n");
     3591            # FIXME: the generated code should report an error if an input cannot be fetched or converted.
     3592            push(@implContent, $indent . "    if (input && input->convertTo<$memoizedType>(memoizedResult)) {\n");
     3593            push(@implContent, $indent . "        result = " . NativeToJSValue($function->signature, 1, $interfaceName, "memoizedResult", $thisObject) . ";\n");
     3594            push(@implContent, $indent . "        ec = input->exceptionCode();\n") if $raisesException;
     3595            push(@implContent, $indent . "    } else\n");
     3596            push(@implContent, $indent . "        result = " . NativeToJSValue($function->signature, 1, $interfaceName, $functionString, $thisObject) . ";\n");
     3597            push(@implContent, $indent . "} else\n");
     3598            push(@implContent, $indent . "    result = " . NativeToJSValue($function->signature, 1, $interfaceName, $functionString, $thisObject) . ";\n");
     3599            push(@implContent, "#else\n");
     3600            push(@implContent, $indent . "result = " . NativeToJSValue($function->signature, 1, $interfaceName, $functionString, $thisObject) . ";\n");
     3601            push(@implContent, "#endif\n");
     3602        } else {
     3603            push(@implContent, $indent . "JSValue result = " . NativeToJSValue($function->signature, 1, $interfaceName, $functionString, $thisObject) . ";\n");
     3604        }
     3605        push(@implContent, "\n" . $indent . "setDOMException(exec, ec);\n") if $raisesException;
    35243606
    35253607        if ($codeGenerator->ExtendedAttributeContains($function->signature->extendedAttributes->{"CallWith"}, "ScriptState")) {
     
    36093691}
    36103692
     3693sub GetNativeTypeForMemoization
     3694{
     3695    my $type = shift;
     3696    return "String" if $type eq "DOMString";
     3697
     3698    return GetNativeType($type);
     3699}
     3700
    36113701sub GetSVGPropertyTypes
    36123702{
  • trunk/Source/WebCore/bindings/scripts/IDLAttributes.txt

    r164853 r165521  
    8686NewImpurePropertyFiresWatchpoints
    8787NoInterfaceObject
     88Nondeterministic
    8889NotEnumerable
    8990NotDeletable
  • trunk/Source/WebCore/bindings/scripts/test/JS/JSTestEventTarget.cpp

    r165497 r165521  
    211211    if (UNLIKELY(exec->hadException()))
    212212        return JSValue::encode(jsUndefined());
    213 
    214     JSC::JSValue result = toJS(exec, castedThis->globalObject(), WTF::getPtr(impl.item(index)));
     213    JSValue result = toJS(exec, castedThis->globalObject(), WTF::getPtr(impl.item(index)));
    215214    return JSValue::encode(result);
    216215}
     
    260259    if (UNLIKELY(exec->hadException()))
    261260        return JSValue::encode(jsUndefined());
    262 
    263     JSC::JSValue result = jsBoolean(impl.dispatchEvent(evt, ec));
     261    JSValue result = jsBoolean(impl.dispatchEvent(evt, ec));
     262
    264263    setDOMException(exec, ec);
    265264    return JSValue::encode(result);
  • trunk/Source/WebCore/bindings/scripts/test/JS/JSTestInterface.cpp

    r165497 r165521  
    686686    if (UNLIKELY(exec->hadException()))
    687687        return JSValue::encode(jsUndefined());
    688 
    689     JSC::JSValue result = toJS(exec, castedThis->globalObject(), WTF::getPtr(impl.implementsMethod2(scriptContext, strArg, objArg, ec)));
     688    JSValue result = toJS(exec, castedThis->globalObject(), WTF::getPtr(impl.implementsMethod2(scriptContext, strArg, objArg, ec)));
     689
    690690    setDOMException(exec, ec);
    691691    return JSValue::encode(result);
     
    752752    if (UNLIKELY(exec->hadException()))
    753753        return JSValue::encode(jsUndefined());
    754 
    755     JSC::JSValue result = toJS(exec, castedThis->globalObject(), WTF::getPtr(TestSupplemental::supplementalMethod2(&impl, scriptContext, strArg, objArg, ec)));
     754    JSValue result = toJS(exec, castedThis->globalObject(), WTF::getPtr(TestSupplemental::supplementalMethod2(&impl, scriptContext, strArg, objArg, ec)));
     755
    756756    setDOMException(exec, ec);
    757757    return JSValue::encode(result);
  • trunk/Source/WebCore/bindings/scripts/test/JS/JSTestObj.cpp

    r165497 r165521  
    940940    ExceptionCode ec = 0;
    941941    TestObj& impl = castedThis->impl();
    942     JSC::JSValue result = jsNumber(impl.attrWithGetterException(ec));
     942    JSValue result = jsNumber(impl.attrWithGetterException(ec));
    943943    setDOMException(exec, ec);
    944944    return JSValue::encode(result);
     
    979979    ExceptionCode ec = 0;
    980980    TestObj& impl = castedThis->impl();
    981     JSC::JSValue result = jsStringWithCache(exec, impl.stringAttrWithGetterException(ec));
     981    JSValue result = jsStringWithCache(exec, impl.stringAttrWithGetterException(ec));
    982982    setDOMException(exec, ec);
    983983    return JSValue::encode(result);
     
    10731073    ExceptionCode ec = 0;
    10741074    TestObj& impl = castedThis->impl();
    1075     JSC::JSValue result = toJS(exec, castedThis->globalObject(), WTF::getPtr(impl.withScriptStateAttributeRaises(exec, ec)));
     1075    JSValue result = toJS(exec, castedThis->globalObject(), WTF::getPtr(impl.withScriptStateAttributeRaises(exec, ec)));
    10761076    setDOMException(exec, ec);
    10771077    return JSValue::encode(result);
     
    10961096        return JSValue::encode(jsUndefined());
    10971097    TestObj& impl = castedThis->impl();
    1098     JSC::JSValue result = toJS(exec, castedThis->globalObject(), WTF::getPtr(impl.withScriptExecutionContextAttributeRaises(scriptContext, ec)));
     1098    JSValue result = toJS(exec, castedThis->globalObject(), WTF::getPtr(impl.withScriptExecutionContextAttributeRaises(scriptContext, ec)));
    10991099    setDOMException(exec, ec);
    11001100    return JSValue::encode(result);
     
    11401140        return JSValue::encode(jsUndefined());
    11411141    TestObj& impl = castedThis->impl();
    1142     JSC::JSValue result = toJS(exec, castedThis->globalObject(), WTF::getPtr(impl.withScriptExecutionContextAndScriptStateAttributeRaises(exec, scriptContext, ec)));
     1142    JSValue result = toJS(exec, castedThis->globalObject(), WTF::getPtr(impl.withScriptExecutionContextAndScriptStateAttributeRaises(exec, scriptContext, ec)));
    11431143    setDOMException(exec, ec);
    11441144    return JSValue::encode(result);
     
    16591659    bool isNull = false;
    16601660    TestObj& impl = castedThis->impl();
    1661     JSC::JSValue result = jsNumber(impl.nullableStringValue(isNull, ec));
     1661    JSValue result = jsNumber(impl.nullableStringValue(isNull, ec));
    16621662    if (isNull)
    16631663        return JSValue::encode(jsNull());
     
    26742674    ASSERT_GC_OBJECT_INHERITS(castedThis, JSTestObj::info());
    26752675    TestObj& impl = castedThis->impl();
    2676 
    2677     JSC::JSValue result = jsNumber(impl.byteMethod());
     2676    JSValue result = jsNumber(impl.byteMethod());
    26782677    return JSValue::encode(result);
    26792678}
     
    26982697    if (UNLIKELY(exec->hadException()))
    26992698        return JSValue::encode(jsUndefined());
    2700 
    2701     JSC::JSValue result = jsNumber(impl.byteMethodWithArgs(byteArg, strArg, objArg));
     2699    JSValue result = jsNumber(impl.byteMethodWithArgs(byteArg, strArg, objArg));
    27022700    return JSValue::encode(result);
    27032701}
     
    27112709    ASSERT_GC_OBJECT_INHERITS(castedThis, JSTestObj::info());
    27122710    TestObj& impl = castedThis->impl();
    2713 
    2714     JSC::JSValue result = jsNumber(impl.octetMethod());
     2711    JSValue result = jsNumber(impl.octetMethod());
    27152712    return JSValue::encode(result);
    27162713}
     
    27352732    if (UNLIKELY(exec->hadException()))
    27362733        return JSValue::encode(jsUndefined());
    2737 
    2738     JSC::JSValue result = jsNumber(impl.octetMethodWithArgs(octetArg, strArg, objArg));
     2734    JSValue result = jsNumber(impl.octetMethodWithArgs(octetArg, strArg, objArg));
    27392735    return JSValue::encode(result);
    27402736}
     
    27482744    ASSERT_GC_OBJECT_INHERITS(castedThis, JSTestObj::info());
    27492745    TestObj& impl = castedThis->impl();
    2750 
    2751     JSC::JSValue result = jsNumber(impl.longMethod());
     2746    JSValue result = jsNumber(impl.longMethod());
    27522747    return JSValue::encode(result);
    27532748}
     
    27722767    if (UNLIKELY(exec->hadException()))
    27732768        return JSValue::encode(jsUndefined());
    2774 
    2775     JSC::JSValue result = jsNumber(impl.longMethodWithArgs(longArg, strArg, objArg));
     2769    JSValue result = jsNumber(impl.longMethodWithArgs(longArg, strArg, objArg));
    27762770    return JSValue::encode(result);
    27772771}
     
    27852779    ASSERT_GC_OBJECT_INHERITS(castedThis, JSTestObj::info());
    27862780    TestObj& impl = castedThis->impl();
    2787 
    2788     JSC::JSValue result = toJS(exec, castedThis->globalObject(), WTF::getPtr(impl.objMethod()));
     2781    JSValue result = toJS(exec, castedThis->globalObject(), WTF::getPtr(impl.objMethod()));
    27892782    return JSValue::encode(result);
    27902783}
     
    28092802    if (UNLIKELY(exec->hadException()))
    28102803        return JSValue::encode(jsUndefined());
    2811 
    2812     JSC::JSValue result = toJS(exec, castedThis->globalObject(), WTF::getPtr(impl.objMethodWithArgs(longArg, strArg, objArg)));
     2804    JSValue result = toJS(exec, castedThis->globalObject(), WTF::getPtr(impl.objMethodWithArgs(longArg, strArg, objArg)));
    28132805    return JSValue::encode(result);
    28142806}
     
    28442836    if (UNLIKELY(exec->hadException()))
    28452837        return JSValue::encode(jsUndefined());
    2846 
    2847     JSC::JSValue result = jsArray(exec, castedThis->globalObject(), impl.methodReturningSequence(longArg));
     2838    JSValue result = jsArray(exec, castedThis->globalObject(), impl.methodReturningSequence(longArg));
    28482839    return JSValue::encode(result);
    28492840}
     
    28852876    if (UNLIKELY(exec->hadException()))
    28862877        return JSValue::encode(jsUndefined());
    2887 
    2888     JSC::JSValue result = toJS(exec, castedThis->globalObject(), WTF::getPtr(impl.methodThatRequiresAllArgsAndThrows(strArg, objArg, ec)));
     2878    JSValue result = toJS(exec, castedThis->globalObject(), WTF::getPtr(impl.methodThatRequiresAllArgsAndThrows(strArg, objArg, ec)));
     2879
    28892880    setDOMException(exec, ec);
    28902881    return JSValue::encode(result);
     
    30123003    ASSERT_GC_OBJECT_INHERITS(castedThis, JSTestObj::info());
    30133004    TestObj& impl = castedThis->impl();
    3014 
    3015     JSC::JSValue result = toJS(exec, castedThis->globalObject(), WTF::getPtr(impl.withScriptStateObj(exec)));
     3005    JSValue result = toJS(exec, castedThis->globalObject(), WTF::getPtr(impl.withScriptStateObj(exec)));
    30163006    if (UNLIKELY(exec->hadException()))
    30173007        return JSValue::encode(jsUndefined());
     
    30423032    TestObj& impl = castedThis->impl();
    30433033    ExceptionCode ec = 0;
    3044 
    3045     JSC::JSValue result = toJS(exec, castedThis->globalObject(), WTF::getPtr(impl.withScriptStateObjException(exec, ec)));
     3034    JSValue result = toJS(exec, castedThis->globalObject(), WTF::getPtr(impl.withScriptStateObjException(exec, ec)));
     3035
    30463036    setDOMException(exec, ec);
    30473037    if (UNLIKELY(exec->hadException()))
     
    30923082    if (!scriptContext)
    30933083        return JSValue::encode(jsUndefined());
    3094 
    3095     JSC::JSValue result = toJS(exec, castedThis->globalObject(), WTF::getPtr(impl.withScriptExecutionContextAndScriptStateObjException(exec, scriptContext, ec)));
     3084    JSValue result = toJS(exec, castedThis->globalObject(), WTF::getPtr(impl.withScriptExecutionContextAndScriptStateObjException(exec, scriptContext, ec)));
     3085
    30963086    setDOMException(exec, ec);
    30973087    if (UNLIKELY(exec->hadException()))
     
    31113101    if (!scriptContext)
    31123102        return JSValue::encode(jsUndefined());
    3113 
    3114     JSC::JSValue result = toJS(exec, castedThis->globalObject(), WTF::getPtr(impl.withScriptExecutionContextAndScriptStateWithSpaces(exec, scriptContext)));
     3103    JSValue result = toJS(exec, castedThis->globalObject(), WTF::getPtr(impl.withScriptExecutionContextAndScriptStateWithSpaces(exec, scriptContext)));
    31153104    if (UNLIKELY(exec->hadException()))
    31163105        return JSValue::encode(jsUndefined());
     
    33543343    ASSERT_GC_OBJECT_INHERITS(castedThis, JSTestObj::info());
    33553344    TestObj& impl = castedThis->impl();
    3356 
    3357     JSC::JSValue result = jsStringWithCache(exec, impl.conditionalMethod1());
     3345    JSValue result = jsStringWithCache(exec, impl.conditionalMethod1());
    33583346    return JSValue::encode(result);
    33593347}
     
    36343622    size_t argsCount = exec->argumentCount();
    36353623    if (argsCount <= 0) {
    3636 
    3637         JSC::JSValue result = jsNumber(TestObj::classMethodWithOptional());
     3624        JSValue result = jsNumber(TestObj::classMethodWithOptional());
    36383625        return JSValue::encode(result);
    36393626    }
     
    36423629    if (UNLIKELY(exec->hadException()))
    36433630        return JSValue::encode(jsUndefined());
    3644 
    3645     JSC::JSValue result = jsNumber(TestObj::classMethodWithOptional(arg));
     3631    JSValue result = jsNumber(TestObj::classMethodWithOptional(arg));
    36463632    return JSValue::encode(result);
    36473633}
     
    37623748    if (UNLIKELY(exec->hadException()))
    37633749        return JSValue::encode(jsUndefined());
    3764 
    3765     JSC::JSValue result = jsArray(exec, castedThis->globalObject(), impl.stringArrayFunction(values, ec));
     3750    JSValue result = jsArray(exec, castedThis->globalObject(), impl.stringArrayFunction(values, ec));
     3751
    37663752    setDOMException(exec, ec);
    37673753    return JSValue::encode(result);
     
    37823768    if (UNLIKELY(exec->hadException()))
    37833769        return JSValue::encode(jsUndefined());
    3784 
    3785     JSC::JSValue result = toJS(exec, castedThis->globalObject(), WTF::getPtr(impl.domStringListFunction(values, ec)));
     3770    JSValue result = toJS(exec, castedThis->globalObject(), WTF::getPtr(impl.domStringListFunction(values, ec)));
     3771
    37863772    setDOMException(exec, ec);
    37873773    return JSValue::encode(result);
     
    37993785    if (!shouldAllowAccessToNode(exec, impl.getSVGDocument(ec)))
    38003786        return JSValue::encode(jsNull());
    3801 
    3802     JSC::JSValue result = toJS(exec, castedThis->globalObject(), WTF::getPtr(impl.getSVGDocument(ec)));
     3787    JSValue result = toJS(exec, castedThis->globalObject(), WTF::getPtr(impl.getSVGDocument(ec)));
     3788
    38033789    setDOMException(exec, ec);
    38043790    return JSValue::encode(result);
     
    38813867    ASSERT_GC_OBJECT_INHERITS(castedThis, JSTestObj::info());
    38823868    TestObj& impl = castedThis->impl();
    3883 
    3884     JSC::JSValue result = toJS(exec, castedThis->globalObject(), WTF::getPtr(SVGPropertyTearOff<SVGPoint>::create(impl.mutablePointFunction())));
     3869    JSValue result = toJS(exec, castedThis->globalObject(), WTF::getPtr(SVGPropertyTearOff<SVGPoint>::create(impl.mutablePointFunction())));
    38853870    return JSValue::encode(result);
    38863871}
     
    38943879    ASSERT_GC_OBJECT_INHERITS(castedThis, JSTestObj::info());
    38953880    TestObj& impl = castedThis->impl();
    3896 
    3897     JSC::JSValue result = toJS(exec, castedThis->globalObject(), WTF::getPtr(SVGPropertyTearOff<SVGPoint>::create(impl.immutablePointFunction())));
     3881    JSValue result = toJS(exec, castedThis->globalObject(), WTF::getPtr(SVGPropertyTearOff<SVGPoint>::create(impl.immutablePointFunction())));
    38983882    return JSValue::encode(result);
    38993883}
     
    39313915    if (UNLIKELY(exec->hadException()))
    39323916        return JSValue::encode(jsUndefined());
    3933 
    3934     JSC::JSValue result = toJS(exec, castedThis->globalObject(), WTF::getPtr(impl.strictFunction(str, a, b, ec)));
     3917    JSValue result = toJS(exec, castedThis->globalObject(), WTF::getPtr(impl.strictFunction(str, a, b, ec)));
     3918
    39353919    setDOMException(exec, ec);
    39363920    return JSValue::encode(result);
     
    39563940    if (UNLIKELY(exec->hadException()))
    39573941        return JSValue::encode(jsUndefined());
    3958 
    3959     JSC::JSValue result = toJS(exec, castedThis->globalObject(), WTF::getPtr(impl.strictFunctionWithSequence(objArg, a, ec)));
     3942    JSValue result = toJS(exec, castedThis->globalObject(), WTF::getPtr(impl.strictFunctionWithSequence(objArg, a, ec)));
     3943
    39603944    setDOMException(exec, ec);
    39613945    return JSValue::encode(result);
     
    39813965    if (UNLIKELY(exec->hadException()))
    39823966        return JSValue::encode(jsUndefined());
    3983 
    3984     JSC::JSValue result = toJS(exec, castedThis->globalObject(), WTF::getPtr(impl.strictFunctionWithArray(objArg, array, ec)));
     3967    JSValue result = toJS(exec, castedThis->globalObject(), WTF::getPtr(impl.strictFunctionWithArray(objArg, array, ec)));
     3968
    39853969    setDOMException(exec, ec);
    39863970    return JSValue::encode(result);
  • trunk/Source/WebCore/bindings/scripts/test/JS/JSTestTypedefs.cpp

    r165497 r165521  
    246246    ExceptionCode ec = 0;
    247247    TestTypedefs& impl = castedThis->impl();
    248     JSC::JSValue result = jsNumber(impl.attrWithGetterException(ec));
     248    JSValue result = jsNumber(impl.attrWithGetterException(ec));
    249249    setDOMException(exec, ec);
    250250    return JSValue::encode(result);
     
    285285    ExceptionCode ec = 0;
    286286    TestTypedefs& impl = castedThis->impl();
    287     JSC::JSValue result = jsStringWithCache(exec, impl.stringAttrWithGetterException(ec));
     287    JSValue result = jsStringWithCache(exec, impl.stringAttrWithGetterException(ec));
    288288    setDOMException(exec, ec);
    289289    return JSValue::encode(result);
     
    507507    if (UNLIKELY(exec->hadException()))
    508508        return JSValue::encode(jsUndefined());
    509 
    510     JSC::JSValue result = jsNumber(impl.methodWithSequenceArg(sequenceArg));
     509    JSValue result = jsNumber(impl.methodWithSequenceArg(sequenceArg));
    511510    return JSValue::encode(result);
    512511}
     
    574573    ASSERT_GC_OBJECT_INHERITS(castedThis, JSTestTypedefs::info());
    575574    TestTypedefs& impl = castedThis->impl();
    576 
    577     JSC::JSValue result = toJS(exec, castedThis->globalObject(), WTF::getPtr(SVGPropertyTearOff<SVGPoint>::create(impl.immutablePointFunction())));
     575    JSValue result = toJS(exec, castedThis->globalObject(), WTF::getPtr(SVGPropertyTearOff<SVGPoint>::create(impl.immutablePointFunction())));
    578576    return JSValue::encode(result);
    579577}
     
    593591    if (UNLIKELY(exec->hadException()))
    594592        return JSValue::encode(jsUndefined());
    595 
    596     JSC::JSValue result = jsArray(exec, castedThis->globalObject(), impl.stringArrayFunction(values, ec));
     593    JSValue result = jsArray(exec, castedThis->globalObject(), impl.stringArrayFunction(values, ec));
     594
    597595    setDOMException(exec, ec);
    598596    return JSValue::encode(result);
     
    613611    if (UNLIKELY(exec->hadException()))
    614612        return JSValue::encode(jsUndefined());
    615 
    616     JSC::JSValue result = jsArray(exec, castedThis->globalObject(), impl.stringArrayFunction2(values, ec));
     613    JSValue result = jsArray(exec, castedThis->globalObject(), impl.stringArrayFunction2(values, ec));
     614
    617615    setDOMException(exec, ec);
    618616    return JSValue::encode(result);
     
    632630    if (UNLIKELY(exec->hadException()))
    633631        return JSValue::encode(jsUndefined());
    634 
    635     JSC::JSValue result = jsBoolean(impl.callWithSequenceThatRequiresInclude(sequenceArg));
     632    JSValue result = jsBoolean(impl.callWithSequenceThatRequiresInclude(sequenceArg));
    636633    return JSValue::encode(result);
    637634}
  • trunk/Source/WebCore/replay/AllReplayInputs.h

    r164986 r165521  
    3737#if ENABLE(WEB_REPLAY)
    3838
     39#include "MemoizedDOMResult.h"
    3940#include "WebReplayInputs.h"
    4041#include <JavaScriptCore/JSReplayInputs.h>
  • trunk/Source/WebCore/replay/ReplayInputTypes.cpp

    r164986 r165521  
    4040JS_REPLAY_INPUT_NAMES_FOR_EACH(INITIALIZE_INPUT_TYPE)
    4141WEB_REPLAY_INPUT_NAMES_FOR_EACH(INITIALIZE_INPUT_TYPE)
     42INITIALIZE_INPUT_TYPE(MemoizedDOMResult)
    4243{
    4344    UNUSED_PARAM(dummy);
  • trunk/Source/WebCore/replay/ReplayInputTypes.h

    r164986 r165521  
    4747    JS_REPLAY_INPUT_NAMES_FOR_EACH(DECLARE_REPLAY_INPUT_TYPES)
    4848    WEB_REPLAY_INPUT_NAMES_FOR_EACH(DECLARE_REPLAY_INPUT_TYPES)
     49    DECLARE_REPLAY_INPUT_TYPES(MemoizedDOMResult);
    4950#undef DECLARE_REPLAY_INPUT_TYPES
    5051};
  • trunk/Source/WebCore/replay/SerializationMethods.cpp

    r164986 r165521  
    6464#undef ENCODE_IF_TYPE_TAG_MATCHES
    6565
     66    // The macro won't work here because of the class template argument.
     67    if (type == inputTypes().MemoizedDOMResult) {
     68        InputTraits<MemoizedDOMResultBase>::encode(encodedValue, static_cast<const MemoizedDOMResultBase&>(input));
     69        return encodedValue;
     70    }
     71
    6672    ASSERT_NOT_REACHED();
    6773    return EncodedValue();
     
    8793    WEB_REPLAY_INPUT_NAMES_FOR_EACH(DECODE_IF_TYPE_TAG_MATCHES)
    8894#undef DECODE_IF_TYPE_TAG_MATCHES
     95
     96    if (type == inputTypes().MemoizedDOMResult) {
     97        std::unique_ptr<MemoizedDOMResultBase> decodedInput;
     98        if (!InputTraits<MemoizedDOMResultBase>::decode(encodedValue, decodedInput))
     99            return false;
     100
     101        input = std::move(decodedInput);
     102        return true;
     103    }
    89104
    90105    return false;
  • trunk/Source/WebCore/replay/WebInputs.json

    r164986 r165521  
    3030                "name": "URL", "mode": "HEAVY_SCALAR",
    3131                "header": "platform/URL.h"
     32            },
     33            {
     34                "name": "EncodedCType", "mode": "SCALAR", "storage": "uint8_t",
     35                "flags": ["ENUM_CLASS"],
     36                "values": [
     37                    "Boolean",
     38                    "Int",
     39                    "String",
     40                    "Unsigned"
     41                ],
     42                "header": "replay/MemoizedDOMResult.h"
    3243            },
    3344            {
Note: See TracChangeset for help on using the changeset viewer.