Ignore:
Timestamp:
Aug 29, 2017, 5:06:43 PM (8 years ago)
Author:
Yusuke Suzuki
Message:

[JSC] Use reifying system for "name" property of builtin JSFunction
https://bugs.webkit.org/show_bug.cgi?id=175260

Reviewed by Saam Barati.

JSTests:

  • stress/accessors-get-set-prefix.js:
  • stress/builtin-function-name.js: Added.

(shouldBe):
(shouldThrow):
(shouldBe.JSON.stringify.Object.getOwnPropertyDescriptor):
(shouldBe.JSON.stringify.Object.getOwnPropertyNames.Array.prototype.filter.sort):

Source/JavaScriptCore:

Currently builtin JSFunction uses direct property for "name", which is different
from usual JSFunction. Usual JSFunction uses reifying system for "name". We would like
to apply this reifying mechanism to builtin JSFunction to simplify code and drop
JSFunction::createBuiltinFunction.

We would like to store the "correct" name in FunctionExecutable. For example,
we would like to store the name like "get [Symbol.species]" to FunctionExecutable
instead of specifying name when creating JSFunction. To do so, we add a new
annotations, @getter and @overriddenName. When @getter is specified, the name of
the function becomes "get xxx". And when @overriddenName="xxx" is specified,
the name of the function becomes "xxx".

  • Scripts/builtins/builtins_generate_combined_header.py:

(generate_section_for_code_table_macro):

  • Scripts/builtins/builtins_generate_combined_implementation.py:

(BuiltinsCombinedImplementationGenerator.generate_secondary_header_includes):

  • Scripts/builtins/builtins_generate_separate_header.py:

(generate_section_for_code_table_macro):

  • Scripts/builtins/builtins_generate_separate_implementation.py:

(BuiltinsSeparateImplementationGenerator.generate_secondary_header_includes):

  • Scripts/builtins/builtins_model.py:

(BuiltinFunction.init):
(BuiltinFunction.fromString):

  • Scripts/builtins/builtins_templates.py:
  • Scripts/tests/builtins/JavaScriptCore-Builtin.prototype-Combined.js:

(overriddenName.string_appeared_here.match):
(intrinsic.RegExpTestIntrinsic.test):

  • Scripts/tests/builtins/JavaScriptCore-Builtin.prototype-Separate.js:

(overriddenName.string_appeared_here.match):
(intrinsic.RegExpTestIntrinsic.test):

  • Scripts/tests/builtins/expected/JavaScriptCore-Builtin.Promise-Combined.js-result:
  • Scripts/tests/builtins/expected/JavaScriptCore-Builtin.Promise-Separate.js-result:
  • Scripts/tests/builtins/expected/JavaScriptCore-Builtin.prototype-Combined.js-result:
  • Scripts/tests/builtins/expected/JavaScriptCore-Builtin.prototype-Separate.js-result:
  • Scripts/tests/builtins/expected/JavaScriptCore-BuiltinConstructor-Combined.js-result:
  • Scripts/tests/builtins/expected/JavaScriptCore-BuiltinConstructor-Separate.js-result:
  • Scripts/tests/builtins/expected/JavaScriptCore-InternalClashingNames-Combined.js-result:
  • Scripts/tests/builtins/expected/WebCore-AnotherGuardedInternalBuiltin-Separate.js-result:
  • Scripts/tests/builtins/expected/WebCore-ArbitraryConditionalGuard-Separate.js-result:
  • Scripts/tests/builtins/expected/WebCore-GuardedBuiltin-Separate.js-result:
  • Scripts/tests/builtins/expected/WebCore-GuardedInternalBuiltin-Separate.js-result:
  • Scripts/tests/builtins/expected/WebCore-UnguardedBuiltin-Separate.js-result:
  • Scripts/tests/builtins/expected/WebCore-xmlCasingTest-Separate.js-result:
  • builtins/BuiltinExecutables.cpp:

(JSC::BuiltinExecutables::BuiltinExecutables):

  • builtins/BuiltinExecutables.h:
  • builtins/FunctionPrototype.js:

(symbolHasInstance): Deleted.

  • builtins/GlobalOperations.js:

(globalPrivate.speciesGetter): Deleted.

  • builtins/IteratorPrototype.js:

(symbolIteratorGetter): Deleted.

  • builtins/RegExpPrototype.js:

(match): Deleted.
(replace): Deleted.
(search): Deleted.
(split): Deleted.

  • jsc.cpp:

(functionCreateBuiltin):

  • runtime/FunctionPrototype.cpp:

(JSC::FunctionPrototype::addFunctionProperties):

  • runtime/IteratorPrototype.cpp:

(JSC::IteratorPrototype::finishCreation):

  • runtime/JSFunction.cpp:

(JSC::JSFunction::getOwnNonIndexPropertyNames):
(JSC::JSFunction::reifyLazyBoundNameIfNeeded):
(JSC::JSFunction::createBuiltinFunction): Deleted.

  • runtime/JSFunction.h:
  • runtime/JSGlobalObject.cpp:

(JSC::JSGlobalObject::init):

  • runtime/JSObject.cpp:

(JSC::JSObject::putDirectBuiltinFunction):
(JSC::JSObject::putDirectBuiltinFunctionWithoutTransition):

  • runtime/JSTypedArrayViewPrototype.cpp:

(JSC::JSTypedArrayViewPrototype::finishCreation):

  • runtime/Lookup.cpp:

(JSC::reifyStaticAccessor):

  • runtime/RegExpPrototype.cpp:

(JSC::RegExpPrototype::finishCreation):

Source/WebCore:

Use @getter for JSBuiltin getters.

  • Modules/fetch/FetchResponse.js:

(bodyUsed): Deleted.
(body): Deleted.

  • Modules/streams/ReadableByteStreamController.js:

(byobRequest): Deleted.
(desiredSize): Deleted.

  • Modules/streams/ReadableStream.js:

(locked): Deleted.

  • Modules/streams/ReadableStreamBYOBReader.js:

(closed): Deleted.

  • Modules/streams/ReadableStreamBYOBRequest.js:

(view): Deleted.

  • Modules/streams/ReadableStreamDefaultController.js:

(desiredSize): Deleted.

  • Modules/streams/ReadableStreamDefaultReader.js:

(closed): Deleted.

  • Modules/streams/WritableStream.js:

(closed): Deleted.
(ready): Deleted.
(state): Deleted.

  • bindings/js/JSDOMBuiltinConstructor.h:

(WebCore::JSDOMBuiltinConstructor<JSClass>::finishCreation):

LayoutTests:

  • js/dom/builtin-getter-name-expected.txt: Added.
  • js/dom/builtin-getter-name.html: Added.
Location:
trunk/Source/JavaScriptCore/Scripts
Files:
21 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/JavaScriptCore/Scripts/builtins/builtins_generate_combined_header.py

    r206533 r221327  
    124124            function_args = {
    125125                'funcName': function.function_name,
     126                'overriddenName': function.overridden_name,
    126127                'codeName': BuiltinsGenerator.mangledNameForFunction(function) + 'Code',
    127128            }
    128129
    129             lines.append("    macro(%(codeName)s, %(funcName)s, s_%(codeName)sLength) \\" % function_args)
     130            lines.append("    macro(%(codeName)s, %(funcName)s, %(overriddenName)s, s_%(codeName)sLength) \\" % function_args)
    130131        return '\n'.join(lines)
    131132
  • trunk/Source/JavaScriptCore/Scripts/builtins/builtins_generate_combined_implementation.py

    r208063 r221327  
    9191            ),
    9292            (["JavaScriptCore", "WebCore"],
     93                ("JavaScriptCore", "runtime/IdentifierInlines.h"),
     94            ),
     95            (["JavaScriptCore", "WebCore"],
    9396                ("JavaScriptCore", "runtime/Intrinsic.h"),
    9497            ),
  • trunk/Source/JavaScriptCore/Scripts/builtins/builtins_generate_separate_header.py

    r206533 r221327  
    173173            function_args = {
    174174                'funcName': function.function_name,
     175                'overriddenName': function.overridden_name,
    175176                'codeName': BuiltinsGenerator.mangledNameForFunction(function) + 'Code',
    176177            }
    177178
    178             lines.append("    macro(%(codeName)s, %(funcName)s, s_%(codeName)sLength) \\" % function_args)
     179            lines.append("    macro(%(codeName)s, %(funcName)s, %(overriddenName)s, s_%(codeName)sLength) \\" % function_args)
    179180        return '\n'.join(lines)
    180181
  • trunk/Source/JavaScriptCore/Scripts/builtins/builtins_generate_separate_implementation.py

    r208063 r221327  
    103103            ),
    104104            (["JavaScriptCore", "WebCore"],
     105                ("JavaScriptCore", "runtime/IdentifierInlines.h"),
     106            ),
     107            (["JavaScriptCore", "WebCore"],
    105108                ("JavaScriptCore", "runtime/Intrinsic.h"),
    106109            ),
  • trunk/Source/JavaScriptCore/Scripts/builtins/builtins_model.py

    r202986 r221327  
    4343}
    4444
    45 functionHeadRegExp = re.compile(r"(?:@[\w|=]+\s*\n)*function\s+\w+\s*\(.*?\)", re.MULTILINE | re.DOTALL)
     45functionHeadRegExp = re.compile(r"(?:@[\w|=\[\] \"\.]+\s*\n)*function\s+\w+\s*\(.*?\)", re.MULTILINE | re.DOTALL)
    4646functionGlobalPrivateRegExp = re.compile(r".*^@globalPrivate", re.MULTILINE | re.DOTALL)
    4747functionIntrinsicRegExp = re.compile(r".*^@intrinsic=(\w+)", re.MULTILINE | re.DOTALL)
    4848functionIsConstructorRegExp = re.compile(r".*^@constructor", re.MULTILINE | re.DOTALL)
     49functionIsGetterRegExp = re.compile(r".*^@getter", re.MULTILINE | re.DOTALL)
    4950functionNameRegExp = re.compile(r"function\s+(\w+)\s*\(", re.MULTILINE | re.DOTALL)
     51functionOverriddenNameRegExp = re.compile(r".*^@overriddenName=(\".+\")$", re.MULTILINE | re.DOTALL)
    5052functionParameterFinder = re.compile(r"^function\s+(?:\w+)\s*\(((?:\s*\w+)?\s*(?:\s*,\s*\w+)*)?\s*\)", re.MULTILINE | re.DOTALL)
    5153
     
    98100
    99101class BuiltinFunction:
    100     def __init__(self, function_name, function_source, parameters, is_constructor, is_global_private, intrinsic):
     102    def __init__(self, function_name, function_source, parameters, is_constructor, is_global_private, intrinsic, overridden_name):
    101103        self.function_name = function_name
    102104        self.function_source = function_source
     
    105107        self.is_global_private = is_global_private
    106108        self.intrinsic = intrinsic
     109        self.overridden_name = overridden_name
    107110        self.object = None  # Set by the owning BuiltinObject
    108111
     
    117120            function_source = functionIntrinsicRegExp.sub("", function_source)
    118121
     122        overridden_name = None
     123        overriddenNameMatch = functionOverriddenNameRegExp.search(function_source)
     124        if overriddenNameMatch:
     125            overridden_name = overriddenNameMatch.group(1)
     126            function_source = functionOverriddenNameRegExp.sub("", function_source)
     127
    119128        if os.getenv("CONFIGURATION", "Debug").startswith("Debug"):
    120129            function_source = lineWithOnlySingleLineCommentRegExp.sub("", function_source)
     
    124133        function_name = functionNameRegExp.findall(function_source)[0]
    125134        is_constructor = functionIsConstructorRegExp.match(function_source) != None
     135        is_getter = functionIsGetterRegExp.match(function_source) != None
    126136        is_global_private = functionGlobalPrivateRegExp.match(function_source) != None
    127137        parameters = [s.strip() for s in functionParameterFinder.findall(function_source)[0].split(',')]
     
    129139            parameters = []
    130140
    131         return BuiltinFunction(function_name, function_source, parameters, is_constructor, is_global_private, intrinsic)
     141        if is_getter and not overridden_name:
     142            overridden_name = "\"get %s\"" % (function_name)
     143
     144        if not overridden_name:
     145            overridden_name = "static_cast<const char*>(nullptr)"
     146
     147        return BuiltinFunction(function_name, function_source, parameters, is_constructor, is_global_private, intrinsic, overridden_name)
    132148
    133149    def __str__(self):
  • trunk/Source/JavaScriptCore/Scripts/builtins/builtins_templates.py

    r210149 r221327  
    6868
    6969    CombinedHeaderStaticMacros = (
    70     """#define DECLARE_BUILTIN_GENERATOR(codeName, functionName, argumentCount) \\
     70    """#define DECLARE_BUILTIN_GENERATOR(codeName, functionName, overriddenName, argumentCount) \\
    7171    JSC::FunctionExecutable* codeName##Generator(JSC::VM&);
    7272
     
    7575
    7676    SeparateHeaderStaticMacros = (
    77     """#define DECLARE_BUILTIN_GENERATOR(codeName, functionName, argumentCount) \\
     77    """#define DECLARE_BUILTIN_GENERATOR(codeName, functionName, overriddenName, argumentCount) \\
    7878    JSC::FunctionExecutable* codeName##Generator(JSC::VM&);
    7979
     
    8383    CombinedJSCImplementationStaticMacros = (
    8484    """
    85 #define DEFINE_BUILTIN_GENERATOR(codeName, functionName, argumentCount) \\
     85#define DEFINE_BUILTIN_GENERATOR(codeName, functionName, overriddenName, argumentCount) \\
    8686JSC::FunctionExecutable* codeName##Generator(JSC::VM& vm) \\
    8787{\\
     
    9494    SeparateJSCImplementationStaticMacros = (
    9595    """
    96 #define DEFINE_BUILTIN_GENERATOR(codeName, functionName, argumentCount) \\
     96#define DEFINE_BUILTIN_GENERATOR(codeName, functionName, overriddenName, argumentCount) \\
    9797JSC::FunctionExecutable* codeName##Generator(JSC::VM& vm) \\
    9898{\\
     
    105105    CombinedWebCoreImplementationStaticMacros = (
    106106        """
    107 #define DEFINE_BUILTIN_GENERATOR(codeName, functionName, argumentCount) \\
     107#define DEFINE_BUILTIN_GENERATOR(codeName, functionName, overriddenName, argumentCount) \\
    108108JSC::FunctionExecutable* codeName##Generator(JSC::VM& vm) \\
    109109{\\
     
    117117    SeparateWebCoreImplementationStaticMacros = (
    118118        """
    119 #define DEFINE_BUILTIN_GENERATOR(codeName, functionName, argumentCount) \\
     119#define DEFINE_BUILTIN_GENERATOR(codeName, functionName, overriddenName, argumentCount) \\
    120120JSC::FunctionExecutable* codeName##Generator(JSC::VM& vm) \\
    121121{\\
     
    133133        : m_vm(*vm)
    134134        ${macroPrefix}_FOREACH_${objectMacro}_BUILTIN_FUNCTION_NAME(INITIALIZE_BUILTIN_NAMES)
    135 #define INITIALIZE_BUILTIN_SOURCE_MEMBERS(name, functionName, length) , m_##name##Source(JSC::makeSource(StringImpl::createFromLiteral(s_##name, length), { }))
     135#define INITIALIZE_BUILTIN_SOURCE_MEMBERS(name, functionName, overriddenName, length) , m_##name##Source(JSC::makeSource(StringImpl::createFromLiteral(s_##name, length), { }))
    136136        ${macroPrefix}_FOREACH_${objectMacro}_BUILTIN_CODE(INITIALIZE_BUILTIN_SOURCE_MEMBERS)
    137137#undef INITIALIZE_BUILTIN_SOURCE_MEMBERS
     
    139139    }
    140140
    141 #define EXPOSE_BUILTIN_EXECUTABLES(name, functionName, length) \\
     141#define EXPOSE_BUILTIN_EXECUTABLES(name, functionName, overriddenName, length) \\
    142142    JSC::UnlinkedFunctionExecutable* name##Executable(); \\
    143143    const JSC::SourceCode& name##Source() const { return m_##name##Source; }
     
    154154    ${macroPrefix}_FOREACH_${objectMacro}_BUILTIN_FUNCTION_NAME(DECLARE_BUILTIN_NAMES)
    155155
    156 #define DECLARE_BUILTIN_SOURCE_MEMBERS(name, functionName, length) \\
     156#define DECLARE_BUILTIN_SOURCE_MEMBERS(name, functionName, overriddenName, length) \\
    157157    JSC::SourceCode m_##name##Source;\\
    158158    JSC::Weak<JSC::UnlinkedFunctionExecutable> m_##name##Executable;
     
    162162};
    163163
    164 #define DEFINE_BUILTIN_EXECUTABLES(name, functionName, length) \\
     164#define DEFINE_BUILTIN_EXECUTABLES(name, functionName, overriddenName, length) \\
    165165inline JSC::UnlinkedFunctionExecutable* ${objectName}BuiltinsWrapper::name##Executable() \\
    166166{\\
    167     if (!m_##name##Executable)\\
    168         m_##name##Executable = JSC::Weak<JSC::UnlinkedFunctionExecutable>(JSC::createBuiltinExecutable(m_vm, m_##name##Source, functionName##PublicName(), s_##name##ConstructAbility), this, &m_##name##Executable);\\
     167    if (!m_##name##Executable) {\\
     168        JSC::Identifier executableName = functionName##PublicName();\\
     169        if (overriddenName)\\
     170            executableName = JSC::Identifier::fromString(&m_vm, overriddenName);\\
     171        m_##name##Executable = JSC::Weak<JSC::UnlinkedFunctionExecutable>(JSC::createBuiltinExecutable(m_vm, m_##name##Source, executableName, s_##name##ConstructAbility), this, &m_##name##Executable);\\
     172    }\\
    169173    return m_##name##Executable.get();\\
    170174}
     
    198202inline void ${objectName}BuiltinFunctions::init(JSC::JSGlobalObject& globalObject)
    199203{
    200 #define EXPORT_FUNCTION(codeName, functionName, length)\\
    201     m_##functionName##Function.set(m_vm, &globalObject, JSC::JSFunction::createBuiltinFunction(m_vm, codeName##Generator(m_vm), &globalObject));
     204#define EXPORT_FUNCTION(codeName, functionName, overriddenName, length)\\
     205    m_##functionName##Function.set(m_vm, &globalObject, JSC::JSFunction::create(m_vm, codeName##Generator(m_vm), &globalObject));
    202206    ${macroPrefix}_FOREACH_${objectMacro}_BUILTIN_CODE(EXPORT_FUNCTION)
    203207#undef EXPORT_FUNCTION
  • trunk/Source/JavaScriptCore/Scripts/tests/builtins/JavaScriptCore-Builtin.prototype-Combined.js

    r191433 r221327  
    7777    }
    7878}
     79
     80@overriddenName="[Symbol.match]"
     81function match(strArg)
     82{
     83    "use strict";
     84
     85    if (!@isObject(this))
     86        @throwTypeError("RegExp.prototype.@@match requires that |this| be an Object");
     87
     88    let regexp = this;
     89
     90    // Check for observable side effects and call the fast path if there aren't any.
     91    if (!@hasObservableSideEffectsForRegExpMatch(regexp))
     92        return @regExpMatchFast.@call(regexp, strArg);
     93
     94    let str = @toString(strArg);
     95
     96    if (!regexp.global)
     97        return @regExpExec(regexp, str);
     98   
     99    let unicode = regexp.unicode;
     100    regexp.lastIndex = 0;
     101    let resultList = [];
     102
     103    // FIXME: It would be great to implement a solution similar to what we do in
     104    // RegExpObject::matchGlobal(). It's not clear if this is possible, since this loop has
     105    // effects. https://bugs.webkit.org/show_bug.cgi?id=158145
     106    const maximumReasonableMatchSize = 100000000;
     107
     108    while (true) {
     109        let result = @regExpExec(regexp, str);
     110       
     111        if (result === null) {
     112            if (resultList.length === 0)
     113                return null;
     114            return resultList;
     115        }
     116
     117        if (resultList.length > maximumReasonableMatchSize)
     118            @throwOutOfMemoryError();
     119
     120        if (!@isObject(result))
     121            @throwTypeError("RegExp.prototype.@@match call to RegExp.exec didn't return null or an object");
     122
     123        let resultString = @toString(result[0]);
     124
     125        if (!resultString.length)
     126            regexp.lastIndex = @advanceStringIndex(str, regexp.lastIndex, unicode);
     127
     128        resultList.@push(resultString);
     129    }
     130}
     131
     132@intrinsic=RegExpTestIntrinsic
     133function test(strArg)
     134{
     135    "use strict";
     136
     137    let regexp = this;
     138
     139    // Check for observable side effects and call the fast path if there aren't any.
     140    if (@isRegExpObject(regexp) && @tryGetById(regexp, "exec") === @regExpBuiltinExec)
     141        return @regExpTestFast.@call(regexp, strArg);
     142
     143    // 1. Let R be the this value.
     144    // 2. If Type(R) is not Object, throw a TypeError exception.
     145    if (!@isObject(regexp))
     146        @throwTypeError("RegExp.prototype.test requires that |this| be an Object");
     147
     148    // 3. Let string be ? ToString(S).
     149    let str = @toString(strArg);
     150
     151    // 4. Let match be ? RegExpExec(R, string).
     152    let match = @regExpExec(regexp, str);
     153
     154    // 5. If match is not null, return true; else return false.
     155    if (match !== null)
     156        return true;
     157    return false;
     158}
  • trunk/Source/JavaScriptCore/Scripts/tests/builtins/JavaScriptCore-Builtin.prototype-Separate.js

    r191433 r221327  
    7777    }
    7878}
     79
     80@overriddenName="[Symbol.match]"
     81function match(strArg)
     82{
     83    "use strict";
     84
     85    if (!@isObject(this))
     86        @throwTypeError("RegExp.prototype.@@match requires that |this| be an Object");
     87
     88    let regexp = this;
     89
     90    // Check for observable side effects and call the fast path if there aren't any.
     91    if (!@hasObservableSideEffectsForRegExpMatch(regexp))
     92        return @regExpMatchFast.@call(regexp, strArg);
     93
     94    let str = @toString(strArg);
     95
     96    if (!regexp.global)
     97        return @regExpExec(regexp, str);
     98   
     99    let unicode = regexp.unicode;
     100    regexp.lastIndex = 0;
     101    let resultList = [];
     102
     103    // FIXME: It would be great to implement a solution similar to what we do in
     104    // RegExpObject::matchGlobal(). It's not clear if this is possible, since this loop has
     105    // effects. https://bugs.webkit.org/show_bug.cgi?id=158145
     106    const maximumReasonableMatchSize = 100000000;
     107
     108    while (true) {
     109        let result = @regExpExec(regexp, str);
     110       
     111        if (result === null) {
     112            if (resultList.length === 0)
     113                return null;
     114            return resultList;
     115        }
     116
     117        if (resultList.length > maximumReasonableMatchSize)
     118            @throwOutOfMemoryError();
     119
     120        if (!@isObject(result))
     121            @throwTypeError("RegExp.prototype.@@match call to RegExp.exec didn't return null or an object");
     122
     123        let resultString = @toString(result[0]);
     124
     125        if (!resultString.length)
     126            regexp.lastIndex = @advanceStringIndex(str, regexp.lastIndex, unicode);
     127
     128        resultList.@push(resultString);
     129    }
     130}
     131
     132@intrinsic=RegExpTestIntrinsic
     133function test(strArg)
     134{
     135    "use strict";
     136
     137    let regexp = this;
     138
     139    // Check for observable side effects and call the fast path if there aren't any.
     140    if (@isRegExpObject(regexp) && @tryGetById(regexp, "exec") === @regExpBuiltinExec)
     141        return @regExpTestFast.@call(regexp, strArg);
     142
     143    // 1. Let R be the this value.
     144    // 2. If Type(R) is not Object, throw a TypeError exception.
     145    if (!@isObject(regexp))
     146        @throwTypeError("RegExp.prototype.test requires that |this| be an Object");
     147
     148    // 3. Let string be ? ToString(S).
     149    let str = @toString(strArg);
     150
     151    // 4. Let match be ? RegExpExec(R, string).
     152    let match = @regExpExec(regexp, str);
     153
     154    // 5. If match is not null, return true; else return false.
     155    if (match !== null)
     156        return true;
     157    return false;
     158}
  • trunk/Source/JavaScriptCore/Scripts/tests/builtins/expected/JavaScriptCore-Builtin.Promise-Combined.js-result

    r208985 r221327  
    5454
    5555#define JSC_FOREACH_BUILTIN_CODE(macro) \
    56     macro(builtinPromiseRejectPromiseCode, rejectPromise, s_builtinPromiseRejectPromiseCodeLength) \
    57     macro(builtinPromiseFulfillPromiseCode, fulfillPromise, s_builtinPromiseFulfillPromiseCodeLength) \
     56    macro(builtinPromiseRejectPromiseCode, rejectPromise, static_cast<const char*>(nullptr), s_builtinPromiseRejectPromiseCodeLength) \
     57    macro(builtinPromiseFulfillPromiseCode, fulfillPromise, static_cast<const char*>(nullptr), s_builtinPromiseFulfillPromiseCodeLength) \
    5858
    5959#define JSC_FOREACH_BUILTIN_FUNCTION_NAME(macro) \
     
    6363#define JSC_FOREACH_BUILTIN_FUNCTION_PRIVATE_GLOBAL_NAME(macro) \
    6464
    65 #define DECLARE_BUILTIN_GENERATOR(codeName, functionName, argumentCount) \
     65#define DECLARE_BUILTIN_GENERATOR(codeName, functionName, overriddenName, argumentCount) \
    6666    JSC::FunctionExecutable* codeName##Generator(JSC::VM&);
    6767
     
    108108#include "BuiltinExecutables.h"
    109109#include "HeapInlines.h"
     110#include "IdentifierInlines.h"
    110111#include "Intrinsic.h"
    111112#include "JSCellInlines.h"
     
    150151
    151152
    152 #define DEFINE_BUILTIN_GENERATOR(codeName, functionName, argumentCount) \
     153#define DEFINE_BUILTIN_GENERATOR(codeName, functionName, overriddenName, argumentCount) \
    153154JSC::FunctionExecutable* codeName##Generator(JSC::VM& vm) \
    154155{\
  • trunk/Source/JavaScriptCore/Scripts/tests/builtins/expected/JavaScriptCore-Builtin.Promise-Separate.js-result

    r208985 r221327  
    5656
    5757#define JSC_FOREACH_BUILTIN.PROMISE_BUILTIN_CODE(macro) \
    58     macro(builtinPromiseRejectPromiseCode, rejectPromise, s_builtinPromiseRejectPromiseCodeLength) \
    59     macro(builtinPromiseFulfillPromiseCode, fulfillPromise, s_builtinPromiseFulfillPromiseCodeLength) \
     58    macro(builtinPromiseRejectPromiseCode, rejectPromise, static_cast<const char*>(nullptr), s_builtinPromiseRejectPromiseCodeLength) \
     59    macro(builtinPromiseFulfillPromiseCode, fulfillPromise, static_cast<const char*>(nullptr), s_builtinPromiseFulfillPromiseCodeLength) \
    6060
    6161#define JSC_FOREACH_BUILTIN.PROMISE_BUILTIN_FUNCTION_NAME(macro) \
     
    6363    macro(rejectPromise) \
    6464
    65 #define DECLARE_BUILTIN_GENERATOR(codeName, functionName, argumentCount) \
     65#define DECLARE_BUILTIN_GENERATOR(codeName, functionName, overriddenName, argumentCount) \
    6666    JSC::FunctionExecutable* codeName##Generator(JSC::VM&);
    6767
     
    108108#include "BuiltinExecutables.h"
    109109#include "HeapInlines.h"
     110#include "IdentifierInlines.h"
    110111#include "Intrinsic.h"
    111112#include "JSCellInlines.h"
     
    149150
    150151
    151 #define DEFINE_BUILTIN_GENERATOR(codeName, functionName, argumentCount) \
     152#define DEFINE_BUILTIN_GENERATOR(codeName, functionName, overriddenName, argumentCount) \
    152153JSC::FunctionExecutable* codeName##Generator(JSC::VM& vm) \
    153154{\
  • trunk/Source/JavaScriptCore/Scripts/tests/builtins/expected/JavaScriptCore-Builtin.prototype-Combined.js-result

    r208985 r221327  
    4848extern const int s_builtinPrototypeForEachCodeLength;
    4949extern const JSC::ConstructAbility s_builtinPrototypeForEachCodeConstructAbility;
     50extern const char* s_builtinPrototypeMatchCode;
     51extern const int s_builtinPrototypeMatchCodeLength;
     52extern const JSC::ConstructAbility s_builtinPrototypeMatchCodeConstructAbility;
     53extern const char* s_builtinPrototypeTestCode;
     54extern const int s_builtinPrototypeTestCodeLength;
     55extern const JSC::ConstructAbility s_builtinPrototypeTestCodeConstructAbility;
    5056
    5157#define JSC_FOREACH_BUILTINPROTOTYPE_BUILTIN_DATA(macro) \
    5258    macro(every, builtinPrototypeEvery, 1) \
    5359    macro(forEach, builtinPrototypeForEach, 1) \
     60    macro(match, builtinPrototypeMatch, 1) \
     61    macro(test, builtinPrototypeTest, 1) \
    5462
    5563#define JSC_FOREACH_BUILTIN_CODE(macro) \
    56     macro(builtinPrototypeEveryCode, every, s_builtinPrototypeEveryCodeLength) \
    57     macro(builtinPrototypeForEachCode, forEach, s_builtinPrototypeForEachCodeLength) \
     64    macro(builtinPrototypeEveryCode, every, static_cast<const char*>(nullptr), s_builtinPrototypeEveryCodeLength) \
     65    macro(builtinPrototypeForEachCode, forEach, static_cast<const char*>(nullptr), s_builtinPrototypeForEachCodeLength) \
     66    macro(builtinPrototypeMatchCode, match, "[Symbol.match]", s_builtinPrototypeMatchCodeLength) \
     67    macro(builtinPrototypeTestCode, test, static_cast<const char*>(nullptr), s_builtinPrototypeTestCodeLength) \
    5868
    5969#define JSC_FOREACH_BUILTIN_FUNCTION_NAME(macro) \
    6070    macro(every) \
    6171    macro(forEach) \
     72    macro(match) \
     73    macro(test) \
    6274
    6375#define JSC_FOREACH_BUILTIN_FUNCTION_PRIVATE_GLOBAL_NAME(macro) \
    6476
    65 #define DECLARE_BUILTIN_GENERATOR(codeName, functionName, argumentCount) \
     77#define DECLARE_BUILTIN_GENERATOR(codeName, functionName, overriddenName, argumentCount) \
    6678    JSC::FunctionExecutable* codeName##Generator(JSC::VM&);
    6779
     
    108120#include "BuiltinExecutables.h"
    109121#include "HeapInlines.h"
     122#include "IdentifierInlines.h"
    110123#include "Intrinsic.h"
    111124#include "JSCellInlines.h"
     
    173186;
    174187
    175 
    176 #define DEFINE_BUILTIN_GENERATOR(codeName, functionName, argumentCount) \
     188const JSC::ConstructAbility s_builtinPrototypeMatchCodeConstructAbility = JSC::ConstructAbility::CannotConstruct;
     189const int s_builtinPrototypeMatchCodeLength = 1198;
     190static const JSC::Intrinsic s_builtinPrototypeMatchCodeIntrinsic = JSC::NoIntrinsic;
     191const char* s_builtinPrototypeMatchCode =
     192    "(function (strArg)\n" \
     193    "{\n" \
     194    "    \"use strict\";\n" \
     195    "    if (!@isObject(this))\n" \
     196    "        @throwTypeError(\"RegExp.prototype.@@match requires that |this| be an Object\");\n" \
     197    "    let regexp = this;\n" \
     198    "    if (!@hasObservableSideEffectsForRegExpMatch(regexp))\n" \
     199    "        return @regExpMatchFast.@call(regexp, strArg);\n" \
     200    "    let str = @toString(strArg);\n" \
     201    "    if (!regexp.global)\n" \
     202    "        return @regExpExec(regexp, str);\n" \
     203    "    \n" \
     204    "    let unicode = regexp.unicode;\n" \
     205    "    regexp.lastIndex = 0;\n" \
     206    "    let resultList = [];\n" \
     207    "    const maximumReasonableMatchSize = 100000000;\n" \
     208    "    while (true) {\n" \
     209    "        let result = @regExpExec(regexp, str);\n" \
     210    "        \n" \
     211    "        if (result === null) {\n" \
     212    "            if (resultList.length === 0)\n" \
     213    "                return null;\n" \
     214    "            return resultList;\n" \
     215    "        }\n" \
     216    "        if (resultList.length > maximumReasonableMatchSize)\n" \
     217    "            @throwOutOfMemoryError();\n" \
     218    "        if (!@isObject(result))\n" \
     219    "            @throwTypeError(\"RegExp.prototype.@@match call to RegExp.exec didn't return null or an object\");\n" \
     220    "        let resultString = @toString(result[0]);\n" \
     221    "        if (!resultString.length)\n" \
     222    "            regexp.lastIndex = @advanceStringIndex(str, regexp.lastIndex, unicode);\n" \
     223    "        resultList.@push(resultString);\n" \
     224    "    }\n" \
     225    "})\n" \
     226;
     227
     228const JSC::ConstructAbility s_builtinPrototypeTestCodeConstructAbility = JSC::ConstructAbility::CannotConstruct;
     229const int s_builtinPrototypeTestCodeLength = 456;
     230static const JSC::Intrinsic s_builtinPrototypeTestCodeIntrinsic = JSC::RegExpTestIntrinsic;
     231const char* s_builtinPrototypeTestCode =
     232    "(function (strArg)\n" \
     233    "{\n" \
     234    "    \"use strict\";\n" \
     235    "    let regexp = this;\n" \
     236    "    if (@isRegExpObject(regexp) && @tryGetById(regexp, \"exec\") === @regExpBuiltinExec)\n" \
     237    "        return @regExpTestFast.@call(regexp, strArg);\n" \
     238    "    if (!@isObject(regexp))\n" \
     239    "        @throwTypeError(\"RegExp.prototype.test requires that |this| be an Object\");\n" \
     240    "    let str = @toString(strArg);\n" \
     241    "    let match = @regExpExec(regexp, str);\n" \
     242    "    if (match !== null)\n" \
     243    "        return true;\n" \
     244    "    return false;\n" \
     245    "})\n" \
     246;
     247
     248
     249#define DEFINE_BUILTIN_GENERATOR(codeName, functionName, overriddenName, argumentCount) \
    177250JSC::FunctionExecutable* codeName##Generator(JSC::VM& vm) \
    178251{\
  • trunk/Source/JavaScriptCore/Scripts/tests/builtins/expected/JavaScriptCore-Builtin.prototype-Separate.js-result

    r208985 r221327  
    4747extern const int s_builtinPrototypeForEachCodeLength;
    4848extern const JSC::ConstructAbility s_builtinPrototypeForEachCodeConstructAbility;
     49extern const char* s_builtinPrototypeMatchCode;
     50extern const int s_builtinPrototypeMatchCodeLength;
     51extern const JSC::ConstructAbility s_builtinPrototypeMatchCodeConstructAbility;
     52extern const char* s_builtinPrototypeTestCode;
     53extern const int s_builtinPrototypeTestCodeLength;
     54extern const JSC::ConstructAbility s_builtinPrototypeTestCodeConstructAbility;
    4955
    5056#define JSC_FOREACH_BUILTIN_PROTOTYPE_BUILTIN_DATA(macro) \
    5157    macro(every, builtinPrototypeEvery, 1) \
    5258    macro(forEach, builtinPrototypeForEach, 1) \
     59    macro(match, builtinPrototypeMatch, 1) \
     60    macro(test, builtinPrototypeTest, 1) \
    5361
    5462#define JSC_BUILTIN_BUILTIN_PROTOTYPE_EVERY 1
    5563#define JSC_BUILTIN_BUILTIN_PROTOTYPE_FOREACH 1
     64#define JSC_BUILTIN_BUILTIN_PROTOTYPE_MATCH 1
     65#define JSC_BUILTIN_BUILTIN_PROTOTYPE_TEST 1
    5666
    5767#define JSC_FOREACH_BUILTIN.PROTOTYPE_BUILTIN_CODE(macro) \
    58     macro(builtinPrototypeEveryCode, every, s_builtinPrototypeEveryCodeLength) \
    59     macro(builtinPrototypeForEachCode, forEach, s_builtinPrototypeForEachCodeLength) \
     68    macro(builtinPrototypeEveryCode, every, static_cast<const char*>(nullptr), s_builtinPrototypeEveryCodeLength) \
     69    macro(builtinPrototypeForEachCode, forEach, static_cast<const char*>(nullptr), s_builtinPrototypeForEachCodeLength) \
     70    macro(builtinPrototypeMatchCode, match, "[Symbol.match]", s_builtinPrototypeMatchCodeLength) \
     71    macro(builtinPrototypeTestCode, test, static_cast<const char*>(nullptr), s_builtinPrototypeTestCodeLength) \
    6072
    6173#define JSC_FOREACH_BUILTIN.PROTOTYPE_BUILTIN_FUNCTION_NAME(macro) \
    6274    macro(every) \
    6375    macro(forEach) \
    64 
    65 #define DECLARE_BUILTIN_GENERATOR(codeName, functionName, argumentCount) \
     76    macro(match) \
     77    macro(test) \
     78
     79#define DECLARE_BUILTIN_GENERATOR(codeName, functionName, overriddenName, argumentCount) \
    6680    JSC::FunctionExecutable* codeName##Generator(JSC::VM&);
    6781
     
    108122#include "BuiltinExecutables.h"
    109123#include "HeapInlines.h"
     124#include "IdentifierInlines.h"
    110125#include "Intrinsic.h"
    111126#include "JSCellInlines.h"
     
    172187;
    173188
    174 
    175 #define DEFINE_BUILTIN_GENERATOR(codeName, functionName, argumentCount) \
     189const JSC::ConstructAbility s_builtinPrototypeMatchCodeConstructAbility = JSC::ConstructAbility::CannotConstruct;
     190const int s_builtinPrototypeMatchCodeLength = 1198;
     191static const JSC::Intrinsic s_builtinPrototypeMatchCodeIntrinsic = JSC::NoIntrinsic;
     192const char* s_builtinPrototypeMatchCode =
     193    "(function (strArg)\n" \
     194    "{\n" \
     195    "    \"use strict\";\n" \
     196    "    if (!@isObject(this))\n" \
     197    "        @throwTypeError(\"RegExp.prototype.@@match requires that |this| be an Object\");\n" \
     198    "    let regexp = this;\n" \
     199    "    if (!@hasObservableSideEffectsForRegExpMatch(regexp))\n" \
     200    "        return @regExpMatchFast.@call(regexp, strArg);\n" \
     201    "    let str = @toString(strArg);\n" \
     202    "    if (!regexp.global)\n" \
     203    "        return @regExpExec(regexp, str);\n" \
     204    "    \n" \
     205    "    let unicode = regexp.unicode;\n" \
     206    "    regexp.lastIndex = 0;\n" \
     207    "    let resultList = [];\n" \
     208    "    const maximumReasonableMatchSize = 100000000;\n" \
     209    "    while (true) {\n" \
     210    "        let result = @regExpExec(regexp, str);\n" \
     211    "        \n" \
     212    "        if (result === null) {\n" \
     213    "            if (resultList.length === 0)\n" \
     214    "                return null;\n" \
     215    "            return resultList;\n" \
     216    "        }\n" \
     217    "        if (resultList.length > maximumReasonableMatchSize)\n" \
     218    "            @throwOutOfMemoryError();\n" \
     219    "        if (!@isObject(result))\n" \
     220    "            @throwTypeError(\"RegExp.prototype.@@match call to RegExp.exec didn't return null or an object\");\n" \
     221    "        let resultString = @toString(result[0]);\n" \
     222    "        if (!resultString.length)\n" \
     223    "            regexp.lastIndex = @advanceStringIndex(str, regexp.lastIndex, unicode);\n" \
     224    "        resultList.@push(resultString);\n" \
     225    "    }\n" \
     226    "})\n" \
     227;
     228
     229const JSC::ConstructAbility s_builtinPrototypeTestCodeConstructAbility = JSC::ConstructAbility::CannotConstruct;
     230const int s_builtinPrototypeTestCodeLength = 456;
     231static const JSC::Intrinsic s_builtinPrototypeTestCodeIntrinsic = JSC::RegExpTestIntrinsic;
     232const char* s_builtinPrototypeTestCode =
     233    "(function (strArg)\n" \
     234    "{\n" \
     235    "    \"use strict\";\n" \
     236    "    let regexp = this;\n" \
     237    "    if (@isRegExpObject(regexp) && @tryGetById(regexp, \"exec\") === @regExpBuiltinExec)\n" \
     238    "        return @regExpTestFast.@call(regexp, strArg);\n" \
     239    "    if (!@isObject(regexp))\n" \
     240    "        @throwTypeError(\"RegExp.prototype.test requires that |this| be an Object\");\n" \
     241    "    let str = @toString(strArg);\n" \
     242    "    let match = @regExpExec(regexp, str);\n" \
     243    "    if (match !== null)\n" \
     244    "        return true;\n" \
     245    "    return false;\n" \
     246    "})\n" \
     247;
     248
     249
     250#define DEFINE_BUILTIN_GENERATOR(codeName, functionName, overriddenName, argumentCount) \
    176251JSC::FunctionExecutable* codeName##Generator(JSC::VM& vm) \
    177252{\
  • trunk/Source/JavaScriptCore/Scripts/tests/builtins/expected/JavaScriptCore-BuiltinConstructor-Combined.js-result

    r208985 r221327  
    5353
    5454#define JSC_FOREACH_BUILTIN_CODE(macro) \
    55     macro(builtinConstructorOfCode, of, s_builtinConstructorOfCodeLength) \
    56     macro(builtinConstructorFromCode, from, s_builtinConstructorFromCodeLength) \
     55    macro(builtinConstructorOfCode, of, static_cast<const char*>(nullptr), s_builtinConstructorOfCodeLength) \
     56    macro(builtinConstructorFromCode, from, static_cast<const char*>(nullptr), s_builtinConstructorFromCodeLength) \
    5757
    5858#define JSC_FOREACH_BUILTIN_FUNCTION_NAME(macro) \
     
    6262#define JSC_FOREACH_BUILTIN_FUNCTION_PRIVATE_GLOBAL_NAME(macro) \
    6363
    64 #define DECLARE_BUILTIN_GENERATOR(codeName, functionName, argumentCount) \
     64#define DECLARE_BUILTIN_GENERATOR(codeName, functionName, overriddenName, argumentCount) \
    6565    JSC::FunctionExecutable* codeName##Generator(JSC::VM&);
    6666
     
    106106#include "BuiltinExecutables.h"
    107107#include "HeapInlines.h"
     108#include "IdentifierInlines.h"
    108109#include "Intrinsic.h"
    109110#include "JSCellInlines.h"
     
    187188
    188189
    189 #define DEFINE_BUILTIN_GENERATOR(codeName, functionName, argumentCount) \
     190#define DEFINE_BUILTIN_GENERATOR(codeName, functionName, overriddenName, argumentCount) \
    190191JSC::FunctionExecutable* codeName##Generator(JSC::VM& vm) \
    191192{\
  • trunk/Source/JavaScriptCore/Scripts/tests/builtins/expected/JavaScriptCore-BuiltinConstructor-Separate.js-result

    r208985 r221327  
    5555
    5656#define JSC_FOREACH_BUILTINCONSTRUCTOR_BUILTIN_CODE(macro) \
    57     macro(builtinConstructorOfCode, of, s_builtinConstructorOfCodeLength) \
    58     macro(builtinConstructorFromCode, from, s_builtinConstructorFromCodeLength) \
     57    macro(builtinConstructorOfCode, of, static_cast<const char*>(nullptr), s_builtinConstructorOfCodeLength) \
     58    macro(builtinConstructorFromCode, from, static_cast<const char*>(nullptr), s_builtinConstructorFromCodeLength) \
    5959
    6060#define JSC_FOREACH_BUILTINCONSTRUCTOR_BUILTIN_FUNCTION_NAME(macro) \
     
    6262    macro(of) \
    6363
    64 #define DECLARE_BUILTIN_GENERATOR(codeName, functionName, argumentCount) \
     64#define DECLARE_BUILTIN_GENERATOR(codeName, functionName, overriddenName, argumentCount) \
    6565    JSC::FunctionExecutable* codeName##Generator(JSC::VM&);
    6666
     
    106106#include "BuiltinExecutables.h"
    107107#include "HeapInlines.h"
     108#include "IdentifierInlines.h"
    108109#include "Intrinsic.h"
    109110#include "JSCellInlines.h"
     
    186187
    187188
    188 #define DEFINE_BUILTIN_GENERATOR(codeName, functionName, argumentCount) \
     189#define DEFINE_BUILTIN_GENERATOR(codeName, functionName, overriddenName, argumentCount) \
    189190JSC::FunctionExecutable* codeName##Generator(JSC::VM& vm) \
    190191{\
  • trunk/Source/JavaScriptCore/Scripts/tests/builtins/expected/JavaScriptCore-InternalClashingNames-Combined.js-result

    r208985 r221327  
    5454
    5555#define JSC_FOREACH_BUILTIN_CODE(macro) \
    56     macro(internalClashingNamesIsReadableStreamLockedCode, isReadableStreamLocked, s_internalClashingNamesIsReadableStreamLockedCodeLength) \
    57     macro(internalClashingNamesIsReadableStreamLockedCode, isReadableStreamLocked, s_internalClashingNamesIsReadableStreamLockedCodeLength) \
     56    macro(internalClashingNamesIsReadableStreamLockedCode, isReadableStreamLocked, static_cast<const char*>(nullptr), s_internalClashingNamesIsReadableStreamLockedCodeLength) \
     57    macro(internalClashingNamesIsReadableStreamLockedCode, isReadableStreamLocked, static_cast<const char*>(nullptr), s_internalClashingNamesIsReadableStreamLockedCodeLength) \
    5858
    5959#define JSC_FOREACH_BUILTIN_FUNCTION_NAME(macro) \
     
    6262#define JSC_FOREACH_BUILTIN_FUNCTION_PRIVATE_GLOBAL_NAME(macro) \
    6363
    64 #define DECLARE_BUILTIN_GENERATOR(codeName, functionName, argumentCount) \
     64#define DECLARE_BUILTIN_GENERATOR(codeName, functionName, overriddenName, argumentCount) \
    6565    JSC::FunctionExecutable* codeName##Generator(JSC::VM&);
    6666
     
    107107#include "BuiltinExecutables.h"
    108108#include "HeapInlines.h"
     109#include "IdentifierInlines.h"
    109110#include "Intrinsic.h"
    110111#include "JSCellInlines.h"
     
    137138
    138139
    139 #define DEFINE_BUILTIN_GENERATOR(codeName, functionName, argumentCount) \
     140#define DEFINE_BUILTIN_GENERATOR(codeName, functionName, overriddenName, argumentCount) \
    140141JSC::FunctionExecutable* codeName##Generator(JSC::VM& vm) \
    141142{\
  • trunk/Source/JavaScriptCore/Scripts/tests/builtins/expected/WebCore-AnotherGuardedInternalBuiltin-Separate.js-result

    r210149 r221327  
    5555
    5656#define WEBCORE_FOREACH_ANOTHERGUARDEDINTERNALBUILTIN_BUILTIN_CODE(macro) \
    57     macro(anotherGuardedInternalBuiltinLetsFetchCode, letsFetch, s_anotherGuardedInternalBuiltinLetsFetchCodeLength) \
     57    macro(anotherGuardedInternalBuiltinLetsFetchCode, letsFetch, static_cast<const char*>(nullptr), s_anotherGuardedInternalBuiltinLetsFetchCodeLength) \
    5858
    5959#define WEBCORE_FOREACH_ANOTHERGUARDEDINTERNALBUILTIN_BUILTIN_FUNCTION_NAME(macro) \
    6060    macro(letsFetch) \
    6161
    62 #define DECLARE_BUILTIN_GENERATOR(codeName, functionName, argumentCount) \
     62#define DECLARE_BUILTIN_GENERATOR(codeName, functionName, overriddenName, argumentCount) \
    6363    JSC::FunctionExecutable* codeName##Generator(JSC::VM&);
    6464
     
    7171        : m_vm(*vm)
    7272        WEBCORE_FOREACH_ANOTHERGUARDEDINTERNALBUILTIN_BUILTIN_FUNCTION_NAME(INITIALIZE_BUILTIN_NAMES)
    73 #define INITIALIZE_BUILTIN_SOURCE_MEMBERS(name, functionName, length) , m_##name##Source(JSC::makeSource(StringImpl::createFromLiteral(s_##name, length), { }))
     73#define INITIALIZE_BUILTIN_SOURCE_MEMBERS(name, functionName, overriddenName, length) , m_##name##Source(JSC::makeSource(StringImpl::createFromLiteral(s_##name, length), { }))
    7474        WEBCORE_FOREACH_ANOTHERGUARDEDINTERNALBUILTIN_BUILTIN_CODE(INITIALIZE_BUILTIN_SOURCE_MEMBERS)
    7575#undef INITIALIZE_BUILTIN_SOURCE_MEMBERS
     
    7777    }
    7878
    79 #define EXPOSE_BUILTIN_EXECUTABLES(name, functionName, length) \
     79#define EXPOSE_BUILTIN_EXECUTABLES(name, functionName, overriddenName, length) \
    8080    JSC::UnlinkedFunctionExecutable* name##Executable(); \
    8181    const JSC::SourceCode& name##Source() const { return m_##name##Source; }
     
    9292    WEBCORE_FOREACH_ANOTHERGUARDEDINTERNALBUILTIN_BUILTIN_FUNCTION_NAME(DECLARE_BUILTIN_NAMES)
    9393
    94 #define DECLARE_BUILTIN_SOURCE_MEMBERS(name, functionName, length) \
     94#define DECLARE_BUILTIN_SOURCE_MEMBERS(name, functionName, overriddenName, length) \
    9595    JSC::SourceCode m_##name##Source;\
    9696    JSC::Weak<JSC::UnlinkedFunctionExecutable> m_##name##Executable;
     
    100100};
    101101
    102 #define DEFINE_BUILTIN_EXECUTABLES(name, functionName, length) \
     102#define DEFINE_BUILTIN_EXECUTABLES(name, functionName, overriddenName, length) \
    103103inline JSC::UnlinkedFunctionExecutable* AnotherGuardedInternalBuiltinBuiltinsWrapper::name##Executable() \
    104104{\
    105     if (!m_##name##Executable)\
    106         m_##name##Executable = JSC::Weak<JSC::UnlinkedFunctionExecutable>(JSC::createBuiltinExecutable(m_vm, m_##name##Source, functionName##PublicName(), s_##name##ConstructAbility), this, &m_##name##Executable);\
     105    if (!m_##name##Executable) {\
     106        JSC::Identifier executableName = functionName##PublicName();\
     107        if (overriddenName)\
     108            executableName = JSC::Identifier::fromString(&m_vm, overriddenName);\
     109        m_##name##Executable = JSC::Weak<JSC::UnlinkedFunctionExecutable>(JSC::createBuiltinExecutable(m_vm, m_##name##Source, executableName, s_##name##ConstructAbility), this, &m_##name##Executable);\
     110    }\
    107111    return m_##name##Executable.get();\
    108112}
     
    135139inline void AnotherGuardedInternalBuiltinBuiltinFunctions::init(JSC::JSGlobalObject& globalObject)
    136140{
    137 #define EXPORT_FUNCTION(codeName, functionName, length)\
    138     m_##functionName##Function.set(m_vm, &globalObject, JSC::JSFunction::createBuiltinFunction(m_vm, codeName##Generator(m_vm), &globalObject));
     141#define EXPORT_FUNCTION(codeName, functionName, overriddenName, length)\
     142    m_##functionName##Function.set(m_vm, &globalObject, JSC::JSFunction::create(m_vm, codeName##Generator(m_vm), &globalObject));
    139143    WEBCORE_FOREACH_ANOTHERGUARDEDINTERNALBUILTIN_BUILTIN_CODE(EXPORT_FUNCTION)
    140144#undef EXPORT_FUNCTION
     
    191195#include "WebCoreJSClientData.h"
    192196#include <heap/HeapInlines.h>
     197#include <runtime/IdentifierInlines.h>
    193198#include <runtime/Intrinsic.h>
    194199#include <runtime/JSCJSValueInlines.h>
     
    211216
    212217
    213 #define DEFINE_BUILTIN_GENERATOR(codeName, functionName, argumentCount) \
     218#define DEFINE_BUILTIN_GENERATOR(codeName, functionName, overriddenName, argumentCount) \
    214219JSC::FunctionExecutable* codeName##Generator(JSC::VM& vm) \
    215220{\
  • trunk/Source/JavaScriptCore/Scripts/tests/builtins/expected/WebCore-ArbitraryConditionalGuard-Separate.js-result

    r210149 r221327  
    5656
    5757#define WEBCORE_FOREACH_ARBITRARYCONDITIONALGUARD_BUILTIN_CODE(macro) \
    58     macro(arbitraryConditionalGuardIsReadableStreamLockedCode, isReadableStreamLocked, s_arbitraryConditionalGuardIsReadableStreamLockedCodeLength) \
     58    macro(arbitraryConditionalGuardIsReadableStreamLockedCode, isReadableStreamLocked, static_cast<const char*>(nullptr), s_arbitraryConditionalGuardIsReadableStreamLockedCodeLength) \
    5959
    6060#define WEBCORE_FOREACH_ARBITRARYCONDITIONALGUARD_BUILTIN_FUNCTION_NAME(macro) \
    6161    macro(isReadableStreamLocked) \
    6262
    63 #define DECLARE_BUILTIN_GENERATOR(codeName, functionName, argumentCount) \
     63#define DECLARE_BUILTIN_GENERATOR(codeName, functionName, overriddenName, argumentCount) \
    6464    JSC::FunctionExecutable* codeName##Generator(JSC::VM&);
    6565
     
    7272        : m_vm(*vm)
    7373        WEBCORE_FOREACH_ARBITRARYCONDITIONALGUARD_BUILTIN_FUNCTION_NAME(INITIALIZE_BUILTIN_NAMES)
    74 #define INITIALIZE_BUILTIN_SOURCE_MEMBERS(name, functionName, length) , m_##name##Source(JSC::makeSource(StringImpl::createFromLiteral(s_##name, length), { }))
     74#define INITIALIZE_BUILTIN_SOURCE_MEMBERS(name, functionName, overriddenName, length) , m_##name##Source(JSC::makeSource(StringImpl::createFromLiteral(s_##name, length), { }))
    7575        WEBCORE_FOREACH_ARBITRARYCONDITIONALGUARD_BUILTIN_CODE(INITIALIZE_BUILTIN_SOURCE_MEMBERS)
    7676#undef INITIALIZE_BUILTIN_SOURCE_MEMBERS
     
    7878    }
    7979
    80 #define EXPOSE_BUILTIN_EXECUTABLES(name, functionName, length) \
     80#define EXPOSE_BUILTIN_EXECUTABLES(name, functionName, overriddenName, length) \
    8181    JSC::UnlinkedFunctionExecutable* name##Executable(); \
    8282    const JSC::SourceCode& name##Source() const { return m_##name##Source; }
     
    9393    WEBCORE_FOREACH_ARBITRARYCONDITIONALGUARD_BUILTIN_FUNCTION_NAME(DECLARE_BUILTIN_NAMES)
    9494
    95 #define DECLARE_BUILTIN_SOURCE_MEMBERS(name, functionName, length) \
     95#define DECLARE_BUILTIN_SOURCE_MEMBERS(name, functionName, overriddenName, length) \
    9696    JSC::SourceCode m_##name##Source;\
    9797    JSC::Weak<JSC::UnlinkedFunctionExecutable> m_##name##Executable;
     
    101101};
    102102
    103 #define DEFINE_BUILTIN_EXECUTABLES(name, functionName, length) \
     103#define DEFINE_BUILTIN_EXECUTABLES(name, functionName, overriddenName, length) \
    104104inline JSC::UnlinkedFunctionExecutable* ArbitraryConditionalGuardBuiltinsWrapper::name##Executable() \
    105105{\
    106     if (!m_##name##Executable)\
    107         m_##name##Executable = JSC::Weak<JSC::UnlinkedFunctionExecutable>(JSC::createBuiltinExecutable(m_vm, m_##name##Source, functionName##PublicName(), s_##name##ConstructAbility), this, &m_##name##Executable);\
     106    if (!m_##name##Executable) {\
     107        JSC::Identifier executableName = functionName##PublicName();\
     108        if (overriddenName)\
     109            executableName = JSC::Identifier::fromString(&m_vm, overriddenName);\
     110        m_##name##Executable = JSC::Weak<JSC::UnlinkedFunctionExecutable>(JSC::createBuiltinExecutable(m_vm, m_##name##Source, executableName, s_##name##ConstructAbility), this, &m_##name##Executable);\
     111    }\
    108112    return m_##name##Executable.get();\
    109113}
     
    161165#include "WebCoreJSClientData.h"
    162166#include <heap/HeapInlines.h>
     167#include <runtime/IdentifierInlines.h>
    163168#include <runtime/Intrinsic.h>
    164169#include <runtime/JSCJSValueInlines.h>
     
    181186
    182187
    183 #define DEFINE_BUILTIN_GENERATOR(codeName, functionName, argumentCount) \
     188#define DEFINE_BUILTIN_GENERATOR(codeName, functionName, overriddenName, argumentCount) \
    184189JSC::FunctionExecutable* codeName##Generator(JSC::VM& vm) \
    185190{\
  • trunk/Source/JavaScriptCore/Scripts/tests/builtins/expected/WebCore-GuardedBuiltin-Separate.js-result

    r210149 r221327  
    5656
    5757#define WEBCORE_FOREACH_GUARDEDBUILTIN_BUILTIN_CODE(macro) \
    58     macro(guardedBuiltinIsReadableStreamLockedCode, isReadableStreamLocked, s_guardedBuiltinIsReadableStreamLockedCodeLength) \
     58    macro(guardedBuiltinIsReadableStreamLockedCode, isReadableStreamLocked, static_cast<const char*>(nullptr), s_guardedBuiltinIsReadableStreamLockedCodeLength) \
    5959
    6060#define WEBCORE_FOREACH_GUARDEDBUILTIN_BUILTIN_FUNCTION_NAME(macro) \
    6161    macro(isReadableStreamLocked) \
    6262
    63 #define DECLARE_BUILTIN_GENERATOR(codeName, functionName, argumentCount) \
     63#define DECLARE_BUILTIN_GENERATOR(codeName, functionName, overriddenName, argumentCount) \
    6464    JSC::FunctionExecutable* codeName##Generator(JSC::VM&);
    6565
     
    7272        : m_vm(*vm)
    7373        WEBCORE_FOREACH_GUARDEDBUILTIN_BUILTIN_FUNCTION_NAME(INITIALIZE_BUILTIN_NAMES)
    74 #define INITIALIZE_BUILTIN_SOURCE_MEMBERS(name, functionName, length) , m_##name##Source(JSC::makeSource(StringImpl::createFromLiteral(s_##name, length), { }))
     74#define INITIALIZE_BUILTIN_SOURCE_MEMBERS(name, functionName, overriddenName, length) , m_##name##Source(JSC::makeSource(StringImpl::createFromLiteral(s_##name, length), { }))
    7575        WEBCORE_FOREACH_GUARDEDBUILTIN_BUILTIN_CODE(INITIALIZE_BUILTIN_SOURCE_MEMBERS)
    7676#undef INITIALIZE_BUILTIN_SOURCE_MEMBERS
     
    7878    }
    7979
    80 #define EXPOSE_BUILTIN_EXECUTABLES(name, functionName, length) \
     80#define EXPOSE_BUILTIN_EXECUTABLES(name, functionName, overriddenName, length) \
    8181    JSC::UnlinkedFunctionExecutable* name##Executable(); \
    8282    const JSC::SourceCode& name##Source() const { return m_##name##Source; }
     
    9393    WEBCORE_FOREACH_GUARDEDBUILTIN_BUILTIN_FUNCTION_NAME(DECLARE_BUILTIN_NAMES)
    9494
    95 #define DECLARE_BUILTIN_SOURCE_MEMBERS(name, functionName, length) \
     95#define DECLARE_BUILTIN_SOURCE_MEMBERS(name, functionName, overriddenName, length) \
    9696    JSC::SourceCode m_##name##Source;\
    9797    JSC::Weak<JSC::UnlinkedFunctionExecutable> m_##name##Executable;
     
    101101};
    102102
    103 #define DEFINE_BUILTIN_EXECUTABLES(name, functionName, length) \
     103#define DEFINE_BUILTIN_EXECUTABLES(name, functionName, overriddenName, length) \
    104104inline JSC::UnlinkedFunctionExecutable* GuardedBuiltinBuiltinsWrapper::name##Executable() \
    105105{\
    106     if (!m_##name##Executable)\
    107         m_##name##Executable = JSC::Weak<JSC::UnlinkedFunctionExecutable>(JSC::createBuiltinExecutable(m_vm, m_##name##Source, functionName##PublicName(), s_##name##ConstructAbility), this, &m_##name##Executable);\
     106    if (!m_##name##Executable) {\
     107        JSC::Identifier executableName = functionName##PublicName();\
     108        if (overriddenName)\
     109            executableName = JSC::Identifier::fromString(&m_vm, overriddenName);\
     110        m_##name##Executable = JSC::Weak<JSC::UnlinkedFunctionExecutable>(JSC::createBuiltinExecutable(m_vm, m_##name##Source, executableName, s_##name##ConstructAbility), this, &m_##name##Executable);\
     111    }\
    108112    return m_##name##Executable.get();\
    109113}
     
    161165#include "WebCoreJSClientData.h"
    162166#include <heap/HeapInlines.h>
     167#include <runtime/IdentifierInlines.h>
    163168#include <runtime/Intrinsic.h>
    164169#include <runtime/JSCJSValueInlines.h>
     
    181186
    182187
    183 #define DEFINE_BUILTIN_GENERATOR(codeName, functionName, argumentCount) \
     188#define DEFINE_BUILTIN_GENERATOR(codeName, functionName, overriddenName, argumentCount) \
    184189JSC::FunctionExecutable* codeName##Generator(JSC::VM& vm) \
    185190{\
  • trunk/Source/JavaScriptCore/Scripts/tests/builtins/expected/WebCore-GuardedInternalBuiltin-Separate.js-result

    r210149 r221327  
    5656
    5757#define WEBCORE_FOREACH_GUARDEDINTERNALBUILTIN_BUILTIN_CODE(macro) \
    58     macro(guardedInternalBuiltinIsReadableStreamLockedCode, isReadableStreamLocked, s_guardedInternalBuiltinIsReadableStreamLockedCodeLength) \
     58    macro(guardedInternalBuiltinIsReadableStreamLockedCode, isReadableStreamLocked, static_cast<const char*>(nullptr), s_guardedInternalBuiltinIsReadableStreamLockedCodeLength) \
    5959
    6060#define WEBCORE_FOREACH_GUARDEDINTERNALBUILTIN_BUILTIN_FUNCTION_NAME(macro) \
    6161    macro(isReadableStreamLocked) \
    6262
    63 #define DECLARE_BUILTIN_GENERATOR(codeName, functionName, argumentCount) \
     63#define DECLARE_BUILTIN_GENERATOR(codeName, functionName, overriddenName, argumentCount) \
    6464    JSC::FunctionExecutable* codeName##Generator(JSC::VM&);
    6565
     
    7272        : m_vm(*vm)
    7373        WEBCORE_FOREACH_GUARDEDINTERNALBUILTIN_BUILTIN_FUNCTION_NAME(INITIALIZE_BUILTIN_NAMES)
    74 #define INITIALIZE_BUILTIN_SOURCE_MEMBERS(name, functionName, length) , m_##name##Source(JSC::makeSource(StringImpl::createFromLiteral(s_##name, length), { }))
     74#define INITIALIZE_BUILTIN_SOURCE_MEMBERS(name, functionName, overriddenName, length) , m_##name##Source(JSC::makeSource(StringImpl::createFromLiteral(s_##name, length), { }))
    7575        WEBCORE_FOREACH_GUARDEDINTERNALBUILTIN_BUILTIN_CODE(INITIALIZE_BUILTIN_SOURCE_MEMBERS)
    7676#undef INITIALIZE_BUILTIN_SOURCE_MEMBERS
     
    7878    }
    7979
    80 #define EXPOSE_BUILTIN_EXECUTABLES(name, functionName, length) \
     80#define EXPOSE_BUILTIN_EXECUTABLES(name, functionName, overriddenName, length) \
    8181    JSC::UnlinkedFunctionExecutable* name##Executable(); \
    8282    const JSC::SourceCode& name##Source() const { return m_##name##Source; }
     
    9393    WEBCORE_FOREACH_GUARDEDINTERNALBUILTIN_BUILTIN_FUNCTION_NAME(DECLARE_BUILTIN_NAMES)
    9494
    95 #define DECLARE_BUILTIN_SOURCE_MEMBERS(name, functionName, length) \
     95#define DECLARE_BUILTIN_SOURCE_MEMBERS(name, functionName, overriddenName, length) \
    9696    JSC::SourceCode m_##name##Source;\
    9797    JSC::Weak<JSC::UnlinkedFunctionExecutable> m_##name##Executable;
     
    101101};
    102102
    103 #define DEFINE_BUILTIN_EXECUTABLES(name, functionName, length) \
     103#define DEFINE_BUILTIN_EXECUTABLES(name, functionName, overriddenName, length) \
    104104inline JSC::UnlinkedFunctionExecutable* GuardedInternalBuiltinBuiltinsWrapper::name##Executable() \
    105105{\
    106     if (!m_##name##Executable)\
    107         m_##name##Executable = JSC::Weak<JSC::UnlinkedFunctionExecutable>(JSC::createBuiltinExecutable(m_vm, m_##name##Source, functionName##PublicName(), s_##name##ConstructAbility), this, &m_##name##Executable);\
     106    if (!m_##name##Executable) {\
     107        JSC::Identifier executableName = functionName##PublicName();\
     108        if (overriddenName)\
     109            executableName = JSC::Identifier::fromString(&m_vm, overriddenName);\
     110        m_##name##Executable = JSC::Weak<JSC::UnlinkedFunctionExecutable>(JSC::createBuiltinExecutable(m_vm, m_##name##Source, executableName, s_##name##ConstructAbility), this, &m_##name##Executable);\
     111    }\
    108112    return m_##name##Executable.get();\
    109113}
     
    136140inline void GuardedInternalBuiltinBuiltinFunctions::init(JSC::JSGlobalObject& globalObject)
    137141{
    138 #define EXPORT_FUNCTION(codeName, functionName, length)\
    139     m_##functionName##Function.set(m_vm, &globalObject, JSC::JSFunction::createBuiltinFunction(m_vm, codeName##Generator(m_vm), &globalObject));
     142#define EXPORT_FUNCTION(codeName, functionName, overriddenName, length)\
     143    m_##functionName##Function.set(m_vm, &globalObject, JSC::JSFunction::create(m_vm, codeName##Generator(m_vm), &globalObject));
    140144    WEBCORE_FOREACH_GUARDEDINTERNALBUILTIN_BUILTIN_CODE(EXPORT_FUNCTION)
    141145#undef EXPORT_FUNCTION
     
    193197#include "WebCoreJSClientData.h"
    194198#include <heap/HeapInlines.h>
     199#include <runtime/IdentifierInlines.h>
    195200#include <runtime/Intrinsic.h>
    196201#include <runtime/JSCJSValueInlines.h>
     
    213218
    214219
    215 #define DEFINE_BUILTIN_GENERATOR(codeName, functionName, argumentCount) \
     220#define DEFINE_BUILTIN_GENERATOR(codeName, functionName, overriddenName, argumentCount) \
    216221JSC::FunctionExecutable* codeName##Generator(JSC::VM& vm) \
    217222{\
  • trunk/Source/JavaScriptCore/Scripts/tests/builtins/expected/WebCore-UnguardedBuiltin-Separate.js-result

    r210149 r221327  
    5454
    5555#define WEBCORE_FOREACH_UNGUARDEDBUILTIN_BUILTIN_CODE(macro) \
    56     macro(unguardedBuiltinIsReadableStreamLockedCode, isReadableStreamLocked, s_unguardedBuiltinIsReadableStreamLockedCodeLength) \
     56    macro(unguardedBuiltinIsReadableStreamLockedCode, isReadableStreamLocked, static_cast<const char*>(nullptr), s_unguardedBuiltinIsReadableStreamLockedCodeLength) \
    5757
    5858#define WEBCORE_FOREACH_UNGUARDEDBUILTIN_BUILTIN_FUNCTION_NAME(macro) \
    5959    macro(isReadableStreamLocked) \
    6060
    61 #define DECLARE_BUILTIN_GENERATOR(codeName, functionName, argumentCount) \
     61#define DECLARE_BUILTIN_GENERATOR(codeName, functionName, overriddenName, argumentCount) \
    6262    JSC::FunctionExecutable* codeName##Generator(JSC::VM&);
    6363
     
    7070        : m_vm(*vm)
    7171        WEBCORE_FOREACH_UNGUARDEDBUILTIN_BUILTIN_FUNCTION_NAME(INITIALIZE_BUILTIN_NAMES)
    72 #define INITIALIZE_BUILTIN_SOURCE_MEMBERS(name, functionName, length) , m_##name##Source(JSC::makeSource(StringImpl::createFromLiteral(s_##name, length), { }))
     72#define INITIALIZE_BUILTIN_SOURCE_MEMBERS(name, functionName, overriddenName, length) , m_##name##Source(JSC::makeSource(StringImpl::createFromLiteral(s_##name, length), { }))
    7373        WEBCORE_FOREACH_UNGUARDEDBUILTIN_BUILTIN_CODE(INITIALIZE_BUILTIN_SOURCE_MEMBERS)
    7474#undef INITIALIZE_BUILTIN_SOURCE_MEMBERS
     
    7676    }
    7777
    78 #define EXPOSE_BUILTIN_EXECUTABLES(name, functionName, length) \
     78#define EXPOSE_BUILTIN_EXECUTABLES(name, functionName, overriddenName, length) \
    7979    JSC::UnlinkedFunctionExecutable* name##Executable(); \
    8080    const JSC::SourceCode& name##Source() const { return m_##name##Source; }
     
    9191    WEBCORE_FOREACH_UNGUARDEDBUILTIN_BUILTIN_FUNCTION_NAME(DECLARE_BUILTIN_NAMES)
    9292
    93 #define DECLARE_BUILTIN_SOURCE_MEMBERS(name, functionName, length) \
     93#define DECLARE_BUILTIN_SOURCE_MEMBERS(name, functionName, overriddenName, length) \
    9494    JSC::SourceCode m_##name##Source;\
    9595    JSC::Weak<JSC::UnlinkedFunctionExecutable> m_##name##Executable;
     
    9999};
    100100
    101 #define DEFINE_BUILTIN_EXECUTABLES(name, functionName, length) \
     101#define DEFINE_BUILTIN_EXECUTABLES(name, functionName, overriddenName, length) \
    102102inline JSC::UnlinkedFunctionExecutable* UnguardedBuiltinBuiltinsWrapper::name##Executable() \
    103103{\
    104     if (!m_##name##Executable)\
    105         m_##name##Executable = JSC::Weak<JSC::UnlinkedFunctionExecutable>(JSC::createBuiltinExecutable(m_vm, m_##name##Source, functionName##PublicName(), s_##name##ConstructAbility), this, &m_##name##Executable);\
     104    if (!m_##name##Executable) {\
     105        JSC::Identifier executableName = functionName##PublicName();\
     106        if (overriddenName)\
     107            executableName = JSC::Identifier::fromString(&m_vm, overriddenName);\
     108        m_##name##Executable = JSC::Weak<JSC::UnlinkedFunctionExecutable>(JSC::createBuiltinExecutable(m_vm, m_##name##Source, executableName, s_##name##ConstructAbility), this, &m_##name##Executable);\
     109    }\
    106110    return m_##name##Executable.get();\
    107111}
     
    155159#include "WebCoreJSClientData.h"
    156160#include <heap/HeapInlines.h>
     161#include <runtime/IdentifierInlines.h>
    157162#include <runtime/Intrinsic.h>
    158163#include <runtime/JSCJSValueInlines.h>
     
    175180
    176181
    177 #define DEFINE_BUILTIN_GENERATOR(codeName, functionName, argumentCount) \
     182#define DEFINE_BUILTIN_GENERATOR(codeName, functionName, overriddenName, argumentCount) \
    178183JSC::FunctionExecutable* codeName##Generator(JSC::VM& vm) \
    179184{\
  • trunk/Source/JavaScriptCore/Scripts/tests/builtins/expected/WebCore-xmlCasingTest-Separate.js-result

    r210149 r221327  
    6666
    6767#define WEBCORE_FOREACH_XMLCASINGTEST_BUILTIN_CODE(macro) \
    68     macro(xmlCasingTestXMLCasingTestCode, xmlCasingTest, s_xmlCasingTestXMLCasingTestCodeLength) \
    69     macro(xmlCasingTestCssCasingTestCode, cssCasingTest, s_xmlCasingTestCssCasingTestCodeLength) \
    70     macro(xmlCasingTestUrlCasingTestCode, urlCasingTest, s_xmlCasingTestUrlCasingTestCodeLength) \
     68    macro(xmlCasingTestXMLCasingTestCode, xmlCasingTest, static_cast<const char*>(nullptr), s_xmlCasingTestXMLCasingTestCodeLength) \
     69    macro(xmlCasingTestCssCasingTestCode, cssCasingTest, static_cast<const char*>(nullptr), s_xmlCasingTestCssCasingTestCodeLength) \
     70    macro(xmlCasingTestUrlCasingTestCode, urlCasingTest, static_cast<const char*>(nullptr), s_xmlCasingTestUrlCasingTestCodeLength) \
    7171
    7272#define WEBCORE_FOREACH_XMLCASINGTEST_BUILTIN_FUNCTION_NAME(macro) \
     
    7575    macro(xmlCasingTest) \
    7676
    77 #define DECLARE_BUILTIN_GENERATOR(codeName, functionName, argumentCount) \
     77#define DECLARE_BUILTIN_GENERATOR(codeName, functionName, overriddenName, argumentCount) \
    7878    JSC::FunctionExecutable* codeName##Generator(JSC::VM&);
    7979
     
    8686        : m_vm(*vm)
    8787        WEBCORE_FOREACH_XMLCASINGTEST_BUILTIN_FUNCTION_NAME(INITIALIZE_BUILTIN_NAMES)
    88 #define INITIALIZE_BUILTIN_SOURCE_MEMBERS(name, functionName, length) , m_##name##Source(JSC::makeSource(StringImpl::createFromLiteral(s_##name, length), { }))
     88#define INITIALIZE_BUILTIN_SOURCE_MEMBERS(name, functionName, overriddenName, length) , m_##name##Source(JSC::makeSource(StringImpl::createFromLiteral(s_##name, length), { }))
    8989        WEBCORE_FOREACH_XMLCASINGTEST_BUILTIN_CODE(INITIALIZE_BUILTIN_SOURCE_MEMBERS)
    9090#undef INITIALIZE_BUILTIN_SOURCE_MEMBERS
     
    9292    }
    9393
    94 #define EXPOSE_BUILTIN_EXECUTABLES(name, functionName, length) \
     94#define EXPOSE_BUILTIN_EXECUTABLES(name, functionName, overriddenName, length) \
    9595    JSC::UnlinkedFunctionExecutable* name##Executable(); \
    9696    const JSC::SourceCode& name##Source() const { return m_##name##Source; }
     
    107107    WEBCORE_FOREACH_XMLCASINGTEST_BUILTIN_FUNCTION_NAME(DECLARE_BUILTIN_NAMES)
    108108
    109 #define DECLARE_BUILTIN_SOURCE_MEMBERS(name, functionName, length) \
     109#define DECLARE_BUILTIN_SOURCE_MEMBERS(name, functionName, overriddenName, length) \
    110110    JSC::SourceCode m_##name##Source;\
    111111    JSC::Weak<JSC::UnlinkedFunctionExecutable> m_##name##Executable;
     
    115115};
    116116
    117 #define DEFINE_BUILTIN_EXECUTABLES(name, functionName, length) \
     117#define DEFINE_BUILTIN_EXECUTABLES(name, functionName, overriddenName, length) \
    118118inline JSC::UnlinkedFunctionExecutable* xmlCasingTestBuiltinsWrapper::name##Executable() \
    119119{\
    120     if (!m_##name##Executable)\
    121         m_##name##Executable = JSC::Weak<JSC::UnlinkedFunctionExecutable>(JSC::createBuiltinExecutable(m_vm, m_##name##Source, functionName##PublicName(), s_##name##ConstructAbility), this, &m_##name##Executable);\
     120    if (!m_##name##Executable) {\
     121        JSC::Identifier executableName = functionName##PublicName();\
     122        if (overriddenName)\
     123            executableName = JSC::Identifier::fromString(&m_vm, overriddenName);\
     124        m_##name##Executable = JSC::Weak<JSC::UnlinkedFunctionExecutable>(JSC::createBuiltinExecutable(m_vm, m_##name##Source, executableName, s_##name##ConstructAbility), this, &m_##name##Executable);\
     125    }\
    122126    return m_##name##Executable.get();\
    123127}
     
    150154inline void xmlCasingTestBuiltinFunctions::init(JSC::JSGlobalObject& globalObject)
    151155{
    152 #define EXPORT_FUNCTION(codeName, functionName, length)\
    153     m_##functionName##Function.set(m_vm, &globalObject, JSC::JSFunction::createBuiltinFunction(m_vm, codeName##Generator(m_vm), &globalObject));
     156#define EXPORT_FUNCTION(codeName, functionName, overriddenName, length)\
     157    m_##functionName##Function.set(m_vm, &globalObject, JSC::JSFunction::create(m_vm, codeName##Generator(m_vm), &globalObject));
    154158    WEBCORE_FOREACH_XMLCASINGTEST_BUILTIN_CODE(EXPORT_FUNCTION)
    155159#undef EXPORT_FUNCTION
     
    207211#include "WebCoreJSClientData.h"
    208212#include <heap/HeapInlines.h>
     213#include <runtime/IdentifierInlines.h>
    209214#include <runtime/Intrinsic.h>
    210215#include <runtime/JSCJSValueInlines.h>
     
    264269
    265270
    266 #define DEFINE_BUILTIN_GENERATOR(codeName, functionName, argumentCount) \
     271#define DEFINE_BUILTIN_GENERATOR(codeName, functionName, overriddenName, argumentCount) \
    267272JSC::FunctionExecutable* codeName##Generator(JSC::VM& vm) \
    268273{\
Note: See TracChangeset for help on using the changeset viewer.